Skip to content

Commit

Permalink
GH action for PHPCS (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mte90 committed Sep 30, 2021
1 parent 7ed24a9 commit 67941da
Show file tree
Hide file tree
Showing 44 changed files with 708 additions and 1,554 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://docs.github.com/en/actions

name: "Code Standards"

on: [push, pull_request]

jobs:
phpcs:
name: WPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: WPCS check
uses: 10up/wpcs-action@develop
with:
use_local_config: 'true'
paths: '.'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
style.css
.DS_Store
vendor
composer.lock
6 changes: 3 additions & 3 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
<p class="not-found__copy">
<?php if ( isset( $options['error_404_copy'] ) && strlen( $options['error_404_copy'] ) > 0 ) : ?>
<?php echo esc_html( $options['error_404_copy'] ); ?>
<?php else : ?>
<?php else : ?>
<?php esc_html_e( 'Ooops, looks like the page you are trying to reach is no longer available. If you are having trouble locating a destination on Community Portal, try visiting the home page.', 'community-portal' ); ?>
<?php endif; ?>
</p>
<a href="<?php echo get_home_url() ?>" class="not-found__cta"><?php esc_html_e( 'Return Home', 'community-portal' ); ?></a>
<a href="<?php echo esc_html( get_home_url() ); ?>" class="not-found__cta"><?php esc_html_e( 'Return Home', 'community-portal' ); ?></a>
</div>
<div class="not-found__image-container">
<div class="not-found__image-container">
<img src="<?php echo esc_url_raw( $theme_directory ); ?>/images/404.png" class="not-found__image" />
</div>
<div>
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ To live update the styles run ```npm run watch```
To activate the theme through the Wordpress admin panel.

### Wordpress

```
./vendor/bin/phpcs --standard=WordPress .
./vendor/bin/phpcbf --standard=WordPress .
```

#### Pages

The following pages need to be created along with their corresponding slugs

Title: Activate
Expand Down
6 changes: 3 additions & 3 deletions buddypress/groups/index-directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@
<div class="groups__card-tags">
<?php
$tag_counter = 0;
$group_tags = isset($meta['group_tags']) ? array_unique( array_filter( $meta['group_tags'], 'mozilla_filter_inactive_tags')) : null;
$group_tags = isset( $meta['group_tags'] ) ? array_unique( array_filter( $meta['group_tags'], 'mozilla_filter_inactive_tags' ) ) : null;
?>
<?php if ( isset($group_tags ) && is_array( $group_tags ) ) : ?>
<?php if ( isset( $group_tags ) && is_array( $group_tags ) ) : ?>
<ul class="groups__card-tags__container">
<?php foreach ( $group_tags as $key => $value ) : ?>
<?php
Expand All @@ -482,7 +482,7 @@ function( $e ) use ( &$value ) {
<?php $tag_counter++; ?>
<?php endif; ?>
<?php if ( 2 === $tag_counter && count( $group_tags ) > 2 ) : ?>
<li class="groups__tag">+ <?php echo esc_html( count( $group_tags ) - 2 ); ?> <?php esc_html_e( ' more tags', 'community-portal' ); ?></li>
<li class="groups__tag">+ <?php echo esc_html( count( $group_tags ) - 2 ); ?> <?php esc_html_e( ' more tags', 'community-portal' ); ?></li>
<?php break; ?>
<?php endif; ?>
<?php endforeach; ?>
Expand Down
32 changes: 18 additions & 14 deletions buddypress/groups/single/group.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
} else {
$member_country = $info['location']->value;
}
if ( isset($countries[ $member_country ] ) ) {
if ( isset( $countries[ $member_country ] ) ) {
$used_country_list[ $member_country ] = $countries[ $member_country ];
}
}
Expand Down Expand Up @@ -858,7 +858,7 @@
?>
<?php echo esc_url_raw( "/{$current_translation}" ); ?><?php endif; ?>/groups/<?php echo esc_attr( $group->slug ); ?>/?view=people"><?php esc_html_e( 'Our Members', 'community-portal' ); ?></a></li>
<li class="menu-item"><a class="group__menu-link" href="
<?php echo esc_url_raw( "/events.ics?group=" . esc_attr( $group->slug ) ); ?>"><?php esc_html_e( 'ICS Feed', 'community-portal' ); ?></a></li>
<?php echo esc_url_raw( '/events.ics?group=' . esc_attr( $group->slug ) ); ?>"><?php esc_html_e( 'ICS Feed', 'community-portal' ); ?></a></li>
</ul>
</div>
<div class="group__nav group__nav--mobile">
Expand Down Expand Up @@ -930,13 +930,13 @@
}
?>
</div>
<?php if ( $info['location']->display && $info['location']->value && isset($countries[ $info['location']->value] ) ) : ?>
<?php if ( $info['location']->display && $info['location']->value && isset( $countries[ $info['location']->value ] ) ) : ?>
<div class="members__location">
<svg width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14 7.66602C14 12.3327 8 16.3327 8 16.3327C8 16.3327 2 12.3327 2 7.66602C2 6.07472 2.63214 4.54859 3.75736 3.42337C4.88258 2.29816 6.4087 1.66602 8 1.66602C9.5913 1.66602 11.1174 2.29816 12.2426 3.42337C13.3679 4.54859 14 6.07472 14 7.66602Z" stroke="#737373" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8 9.66602C9.10457 9.66602 10 8.77059 10 7.66602C10 6.56145 9.10457 5.66602 8 5.66602C6.89543 5.66602 6 6.56145 6 7.66602C6 8.77059 6.89543 9.66602 8 9.66602Z" stroke="#737373" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>&nbsp;
<?php echo esc_html( $countries[$info['location']->value] ); ?>
<?php echo esc_html( $countries[ $info['location']->value ] ); ?>
</div>
<?php endif; ?>
</div>
Expand Down Expand Up @@ -1103,7 +1103,7 @@
}
?>
</div>
<?php if ( $info['location']->display && $info['location']->value && isset($countries[$info['location']->value])) : ?>
<?php if ( $info['location']->display && $info['location']->value && isset( $countries[ $info['location']->value ] ) ) : ?>
<div class="members__location">
<svg width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14 7.66602C14 12.3327 8 16.3327 8 16.3327C8 16.3327 2 12.3327 2 7.66602C2 6.07472 2.63214 4.54859 3.75736 3.42337C4.88258 2.29816 6.4087 1.66602 8 1.66602C9.5913 1.66602 11.1174 2.29816 12.2426 3.42337C13.3679 4.54859 14 6.07472 14 7.66602Z" stroke="#737373" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
Expand All @@ -1127,10 +1127,10 @@
<?php

$args = array(
'group' => $group->id,
'scope' => 'all',
'orderby' => 'event_start_date',
'order' => 'DESC',
'group' => $group->id,
'scope' => 'all',
'orderby' => 'event_start_date',
'order' => 'DESC',
);
$events = EM_Events::get( $args );
?>
Expand Down Expand Up @@ -1455,7 +1455,7 @@ class="st1"
$discourse_api_url = rtrim( $options['discourse_url'], '/' );

$discourse_category_id = intval( trim( $discourse_group['discourse_category_id'] ) );
$api_url = "{$options['discourse_url']}/c/{$discourse_category_id}";
$api_url = "{$options['discourse_url']}/c/{$discourse_category_id}";

$topics = mozilla_discourse_get_category_topics( $api_url );
$topics = array_slice( $topics, 0, 4 );
Expand Down Expand Up @@ -1528,7 +1528,11 @@ class="st1"
$events = EM_Events::get( $args );
$event_count = count( $events );
?>
<a href="<?php if ( $current_translation ) : ?><?php echo esc_url_raw( "/{$current_translation}" ); ?><?php endif; ?>/groups/<?php echo esc_attr( $group->slug ); ?>/?view=events" class="group__member-count">
<a href="
<?php
if ( $current_translation ) :
?>
<?php echo esc_url_raw( "/{$current_translation}" ); ?><?php endif; ?>/groups/<?php echo esc_attr( $group->slug ); ?>/?view=events" class="group__member-count">
<div class="group__member-count-container">
<p>
<span class="group__member-count__numeral"><?php echo esc_html( $event_count ); ?></span>
Expand Down Expand Up @@ -1682,13 +1686,13 @@ class="st1"
<p class="group__card-content__subtitle"><?php esc_html_e( 'Preferred Language', 'community-portal' ); ?></p>
</div>
<div class="group__language">
<a href="<?php echo esc_url_raw( add_query_arg( array('language' => strtolower( $group_meta['group_language'] ) ),get_home_url( null, 'groups') ) ); ?>" class="group__language-link"><?php echo esc_html( $languages[ strtolower( $group_meta['group_language'] ) ] ); ?></a>
<a href="<?php echo esc_url_raw( add_query_arg( array( 'language' => strtolower( $group_meta['group_language'] ) ), get_home_url( null, 'groups' ) ) ); ?>" class="group__language-link"><?php echo esc_html( $languages[ strtolower( $group_meta['group_language'] ) ] ); ?></a>
</div>
</div>
</div>
<?php endif; ?>
<?php $group_tags = isset($group_meta['group_tags']) ? array_unique( array_filter( $group_meta['group_tags'], 'mozilla_filter_inactive_tags')) : false; ?>
<?php if ( isset( $group_tags ) && is_array($group_tags) && count( $group_tags ) > 0 ) : ?>
<?php $group_tags = isset( $group_meta['group_tags'] ) ? array_unique( array_filter( $group_meta['group_tags'], 'mozilla_filter_inactive_tags' ) ) : false; ?>
<?php if ( isset( $group_tags ) && is_array( $group_tags ) && count( $group_tags ) > 0 ) : ?>
<div class="group__card">
<div class="group__card-content group__card-content--small">
<div>
Expand Down
6 changes: 3 additions & 3 deletions buddypress/members/index-directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
$member_country = $info['location']->value;
}

if ( isset($countries[$member_country]) ) {
if ( isset( $countries[ $member_country ] ) ) {
$used_country_list[ $member_country ] = $countries[ $member_country ];
}
}
Expand Down Expand Up @@ -360,7 +360,7 @@
continue;
}


// Search / location / language!
if ( $search_user && false === $get_tag && $country_code && $language_code ) {
if ( $info['languages']->display &&
Expand Down Expand Up @@ -874,7 +874,7 @@
}
?>
</div>
<?php if ( $info['location']->display && $info['location']->value && isset($countries[$info['location']->value])) : ?>
<?php if ( $info['location']->display && $info['location']->value && isset( $countries[ $info['location']->value ] ) ) : ?>
<div class="members__location">
<svg width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14 7.66602C14 12.3327 8 16.3327 8 16.3327C8 16.3327 2 12.3327 2 7.66602C2 6.07472 2.63214 4.54859 3.75736 3.42337C4.88258 2.29816 6.4087 1.66602 8 1.66602C9.5913 1.66602 11.1174 2.29816 12.2426 3.42337C13.3679 4.54859 14 6.07472 14 7.66602Z" stroke="#737373" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
Expand Down
12 changes: 6 additions & 6 deletions buddypress/members/single/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<a href="<?php echo esc_attr( get_home_url( null, 'people/' . $username . '/profile/edit/group/1' ) ); ?>" class="btn btn--dark btn--submit">
<?php esc_html_e( 'Complete your profile', 'community-portal' ); ?>
</a>
<a href="<?php echo esc_url_raw(get_home_url()); ?>" class="btn btn--light btn--submit">
<a href="<?php echo esc_url_raw( get_home_url() ); ?>" class="btn btn--light btn--submit">
<?php esc_html_e( 'Go back to browsing', 'community-portal' ); ?>
</a>
</div>
Expand All @@ -58,7 +58,7 @@
<h1 class="profile__title">
<?php ( isset( $meta['agree'][0] ) && 'I Agree' === $meta['agree'][0] ) ? esc_html_e( 'Edit Profile', 'community-portal' ) : esc_html_e( 'Complete Profile', 'community-portal' ); ?>
</h1>
<?php if ( !isset( $meta['agree'][0] ) || 'I Agree' !== $meta['agree'][0] ) : ?>
<?php if ( ! isset( $meta['agree'][0] ) || 'I Agree' !== $meta['agree'][0] ) : ?>
<p class="profile__hero-copy profile__hero-copy--green">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
Expand All @@ -70,7 +70,7 @@
<a href="https://wiki.mozilla.org/IAM/Frequently_asked_questions" class="profile__hero-link"><?php esc_html_e( 'Mozilla SSO.', 'community-portal' ); ?></a>
</span>
</p>
<?php endif;?>
<?php endif; ?>

</div>
</div>
Expand Down Expand Up @@ -370,7 +370,7 @@ class="form__error-container
<option value="">
<?php esc_html_e( 'Preferred Pronoun', 'community-portal' ); ?>
</option>
<?php foreach ( $pronouns as $key=>$p ) : ?>
<?php foreach ( $pronouns as $key => $p ) : ?>
<option
value="<?php echo esc_attr( $key ); ?>"
<?php
Expand Down Expand Up @@ -875,7 +875,7 @@ class="profile__input"
}
?>
<input
placeholder="<?php esc_attr_e('username:domain', 'community-portal') ?>"
placeholder="<?php esc_attr_e( 'username:domain', 'community-portal' ); ?>"
type="text"
name="matrix"
id="matrix"
Expand Down Expand Up @@ -922,7 +922,7 @@ class="profile__input"
}
?>
<input
placeholder="<?php esc_attr_e('https://youtube.com/channel/XXXXXX', 'community-portal') ?>"
placeholder="<?php esc_attr_e( 'https://youtube.com/channel/XXXXXX', 'community-portal' ); ?>"
type="text"
name="youtube"
id="youtube"
Expand Down
Loading

0 comments on commit 67941da

Please sign in to comment.