@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | { |
| 22 | 22 | global $menu, $typenow; |
| 23 | 23 | foreach( $menu as $key => $value ) { |
| 24 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 24 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | 25 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 26 | 26 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 27 | 27 | 'class' => 'pending-count', |
| 28 | - ]); |
|
| 28 | + ] ); |
|
| 29 | 29 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
| 30 | 30 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
| 31 | - ]); |
|
| 31 | + ] ); |
|
| 32 | 32 | $menu[$key][0] .= ' '.$awaitingModeration; |
| 33 | 33 | if( $typenow === Application::POST_TYPE ) { |
| 34 | - $menu[$key][4].= ' current'; |
|
| 34 | + $menu[$key][4] .= ' current'; |
|
| 35 | 35 | } |
| 36 | 36 | break; |
| 37 | 37 | } |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | 'tools' => __( 'Tools', 'site-reviews' ), |
| 49 | 49 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 50 | 50 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
| 51 | - ]); |
|
| 51 | + ] ); |
|
| 52 | 52 | foreach( $pages as $slug => $title ) { |
| 53 | 53 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 54 | 54 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 55 | - if( !is_callable( $callback ))continue; |
|
| 55 | + if( !is_callable( $callback ) )continue; |
|
| 56 | 56 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $this->renderPage( 'addons', [ |
| 68 | 68 | 'template' => glsr( Template::class ), |
| 69 | - ]); |
|
| 69 | + ] ); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
| 83 | 83 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
| 84 | 84 | 'functions' => __( 'Functions', 'site-reviews' ), |
| 85 | - ]); |
|
| 85 | + ] ); |
|
| 86 | 86 | $this->renderPage( 'documentation', [ |
| 87 | 87 | 'tabs' => $tabs, |
| 88 | - ]); |
|
| 88 | + ] ); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -103,17 +103,17 @@ discard block |
||
| 103 | 103 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 104 | 104 | 'addons' => __( 'Addons', 'site-reviews' ), |
| 105 | 105 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 106 | - ]); |
|
| 107 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
| 108 | - unset( $tabs['addons'] ); |
|
| 106 | + ] ); |
|
| 107 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
| 108 | + unset($tabs['addons']); |
|
| 109 | 109 | } |
| 110 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
| 111 | - unset( $tabs['licenses'] ); |
|
| 110 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
| 111 | + unset($tabs['licenses']); |
|
| 112 | 112 | } |
| 113 | 113 | $this->renderPage( 'settings', [ |
| 114 | 114 | 'html' => glsr( Html::class ), |
| 115 | 115 | 'tabs' => $tabs, |
| 116 | - ]); |
|
| 116 | + ] ); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
| 129 | 129 | 'console' => __( 'Console', 'site-reviews' ), |
| 130 | 130 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 131 | - ]); |
|
| 132 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
| 133 | - unset( $tabs['sync'] ); |
|
| 131 | + ] ); |
|
| 132 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
| 133 | + unset($tabs['sync']); |
|
| 134 | 134 | } |
| 135 | 135 | $this->renderPage( 'tools', [ |
| 136 | 136 | 'data' => [ |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ], |
| 144 | 144 | 'html' => glsr( Html::class ), |
| 145 | 145 | 'tabs' => $tabs, |
| 146 | - ]); |
|
| 146 | + ] ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -10,13 +10,13 @@ |
||
| 10 | 10 | <p>{{ description }}</p> |
| 11 | 11 | </div> |
| 12 | 12 | <div class="glsr-addon-footer"> |
| 13 | - <?php if( !is_wp_error( validate_plugin( $plugin ))) : ?> |
|
| 14 | - <?php if( is_plugin_active( $plugin )) : ?> |
|
| 13 | + <?php if( !is_wp_error( validate_plugin( $plugin ) ) ) : ?> |
|
| 14 | + <?php if( is_plugin_active( $plugin ) ) : ?> |
|
| 15 | 15 | <span class="glsr-addon-link button button-secondary" disabled> |
| 16 | 16 | <?= __( 'Installed', 'site-reviews' ); ?> |
| 17 | 17 | </span> |
| 18 | 18 | <?php else: ?> |
| 19 | - <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary"> |
|
| 19 | + <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin ); ?>" class="glsr-addon-link button button-secondary"> |
|
| 20 | 20 | <?= __( 'Activate', 'site-reviews' ); ?> |
| 21 | 21 | </a> |
| 22 | 22 | <?php endif; ?> |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | <form method="post"> |
| 39 | 39 | <div class="tablenav bottom"> |
| 40 | 40 | <div class="actions"> |
| 41 | - <?php if( count( $sites ) > 1) : ?> |
|
| 41 | + <?php if( count( $sites ) > 1 ) : ?> |
|
| 42 | 42 | <label for="bulk-action-selector-bottom" class="screen-reader-text">Select a site to sync</label> |
| 43 | 43 | <select name="{{ id }}[site]"> |
| 44 | 44 | <option>- <?= __( 'Select a Site', 'site-reviews' ); ?> -</option> |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | 'title' => 'Tripadvisor Reviews', |
| 14 | 14 | ], |
| 15 | 15 | 'plugin' => 'site-reviews-tripadvisor/site-reviews-tripadvisor.php', |
| 16 | - ]); |
|
| 16 | + ] ); |
|
| 17 | 17 | $template->render( 'partials/addons/addon', [ |
| 18 | 18 | 'context' => [ |
| 19 | 19 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | 'title' => 'Yelp Reviews', |
| 23 | 23 | ], |
| 24 | 24 | 'plugin' => 'site-reviews-yelp/site-reviews-yelp.php', |
| 25 | - ]); |
|
| 25 | + ] ); |
|
| 26 | 26 | ?> |
| 27 | 27 | </div> |
| 28 | 28 | </div> |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function __get( $key ) |
| 21 | 21 | { |
| 22 | - if( array_key_exists( $key, $this->values )) { |
|
| 22 | + if( array_key_exists( $key, $this->values ) ) { |
|
| 23 | 23 | return $this->values[$key]; |
| 24 | 24 | } |
| 25 | 25 | return ''; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->versions = wp_parse_args( $versions, array( |
| 31 | 31 | 'php' => static::MIN_PHP_VERSION, |
| 32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
| 33 | - )); |
|
| 33 | + ) ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | if( $this->isValid() ) { |
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
| 45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
| 44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
| 45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
| 138 | 138 | filter_input( INPUT_GET, 'paged' ), |
| 139 | 139 | filter_input( INPUT_GET, 's' ) |
| 140 | - ))); |
|
| 140 | + ) ) ); |
|
| 141 | 141 | exit; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | defined( 'WPINC' ) || die; |
| 20 | 20 | |
| 21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
| 21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | 24 | if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
@@ -27,6 +27,6 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $app = new GeminiLabs\SiteReviews\Application; |
| 29 | 29 | $app->make( 'Provider' )->register( $app ); |
| 30 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
| 31 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
| 30 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
| 31 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
| 32 | 32 | $app->init(); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function __call( $method, array $arguments ) |
| 41 | 41 | { |
| 42 | - $value = isset( $arguments[0] ) |
|
| 42 | + $value = isset($arguments[0]) |
|
| 43 | 43 | ? $arguments[0] |
| 44 | 44 | : ''; |
| 45 | 45 | return $this->setProperty( $method, $value ); |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | * @param mixed $default |
| 97 | 97 | * @return mixed |
| 98 | 98 | */ |
| 99 | - public function getProperty( $property, $default = null) |
|
| 99 | + public function getProperty( $property, $default = null ) |
|
| 100 | 100 | { |
| 101 | - return isset( $this->properties[$property] ) |
|
| 101 | + return isset($this->properties[$property]) |
|
| 102 | 102 | ? $this->properties[$property] |
| 103 | 103 | : $default; |
| 104 | 104 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function offsetUnset( $offset ) |
| 168 | 168 | { |
| 169 | - unset( $this->properties[$offset] ); |
|
| 169 | + unset($this->properties[$offset]); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -212,16 +212,16 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | protected function getParents( $parents = null ) |
| 214 | 214 | { |
| 215 | - if( !isset( $parents )) { |
|
| 215 | + if( !isset($parents) ) { |
|
| 216 | 216 | $parents = $this->parents; |
| 217 | 217 | } |
| 218 | 218 | $newParents = $parents; |
| 219 | 219 | foreach( $parents as $parent ) { |
| 220 | 220 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 221 | - if( !class_exists( $parentClass ))continue; |
|
| 222 | - $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
|
| 221 | + if( !class_exists( $parentClass ) )continue; |
|
| 222 | + $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) ); |
|
| 223 | 223 | } |
| 224 | - return array_values( array_unique( $newParents )); |
|
| 224 | + return array_values( array_unique( $newParents ) ); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | $parents = $this->getParents(); |
| 233 | 233 | foreach( $parents as $parent ) { |
| 234 | 234 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 235 | - if( !class_exists( $parentClass ))continue; |
|
| 236 | - $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
|
| 235 | + if( !class_exists( $parentClass ) )continue; |
|
| 236 | + $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) ); |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | protected function serializeProperty( $property ) |
| 245 | 245 | { |
| 246 | - if( is_array( $property )) { |
|
| 246 | + if( is_array( $property ) ) { |
|
| 247 | 247 | return array_map( [$this, 'serializeProperty'], $property ); |
| 248 | 248 | } |
| 249 | 249 | if( $property instanceof Type ) { |
| 250 | 250 | $property = $property->toArray(); |
| 251 | - unset( $property['@context'] ); |
|
| 251 | + unset($property['@context']); |
|
| 252 | 252 | } |
| 253 | 253 | if( $property instanceof DateTimeInterface ) { |
| 254 | 254 | $property = $property->format( DateTime::ATOM ); |
| 255 | 255 | } |
| 256 | - if( is_object( $property )) { |
|
| 256 | + if( is_object( $property ) ) { |
|
| 257 | 257 | throw new InvalidProperty(); |
| 258 | 258 | } |
| 259 | 259 | return $property; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function routeAdminPostRequest() |
| 17 | 17 | { |
| 18 | 18 | $request = $this->getRequest(); |
| 19 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 19 | + if( !$this->isValidPostRequest( $request ) )return; |
|
| 20 | 20 | check_admin_referer( $request['action'] ); |
| 21 | 21 | $this->routeRequest( 'admin', $request['action'], $request ); |
| 22 | 22 | } |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | if( is_admin() )return; |
| 42 | 42 | $request = $this->getRequest(); |
| 43 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 44 | - if( !$this->isValidPublicNonce( $request ))return; |
|
| 43 | + if( !$this->isValidPostRequest( $request ) )return; |
|
| 44 | + if( !$this->isValidPublicNonce( $request ) )return; |
|
| 45 | 45 | $this->routeRequest( 'public', $request['action'], $request ); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | protected function checkAjaxNonce( array $request ) |
| 52 | 52 | { |
| 53 | 53 | if( !is_user_logged_in() )return; |
| 54 | - if( !isset( $request['nonce'] )) { |
|
| 54 | + if( !isset($request['nonce']) ) { |
|
| 55 | 55 | $this->sendAjaxError( 'The request is missing a nonce', $request ); |
| 56 | 56 | } |
| 57 | - if( !wp_verify_nonce( $request['nonce'], $request['action'] )) { |
|
| 57 | + if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) { |
|
| 58 | 58 | $this->sendAjaxError( 'The request failed the nonce check', $request, 403 ); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected function checkAjaxRequest( array $request ) |
| 66 | 66 | { |
| 67 | - if( !isset( $request['action'] )) { |
|
| 67 | + if( !isset($request['action']) ) { |
|
| 68 | 68 | $this->sendAjaxError( 'The request must include an action', $request ); |
| 69 | 69 | } |
| 70 | - if( empty( $request['ajax_request'] )) { |
|
| 70 | + if( empty($request['ajax_request']) ) { |
|
| 71 | 71 | $this->sendAjaxError( 'The request is invalid', $request ); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return glsr( Helper::class )->filterInputArray( Application::ID ); |
| 85 | 85 | } |
| 86 | 86 | $request = glsr( Helper::class )->filterInputArray( 'request' ); |
| 87 | - if( empty( $request )) { |
|
| 87 | + if( empty($request) ) { |
|
| 88 | 88 | $request = glsr( Helper::class )->filterInputArray( Application::ID ); |
| 89 | 89 | } |
| 90 | 90 | return $this->normalizeRequest( $request ); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function isValidPostRequest( array $request = [] ) |
| 97 | 97 | { |
| 98 | - return !empty( $request['action'] ) && empty( $request['ajax_request'] ); |
|
| 98 | + return !empty($request['action']) && empty($request['ajax_request']); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function isValidPublicNonce( array $request ) |
| 105 | 105 | { |
| 106 | - if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] )) { |
|
| 106 | + if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] ) ) { |
|
| 107 | 107 | glsr_log()->error( 'Nonce check failed for public request' )->info( $request ); |
| 108 | 108 | return false; |
| 109 | 109 | } |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | protected function routeRequest( $type, $action, array $request = [] ) |
| 133 | 133 | { |
| 134 | 134 | $actionHook = 'site-reviews/route/'.$type.'/request'; |
| 135 | - $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' )); |
|
| 135 | + $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) ); |
|
| 136 | 136 | $method = glsr( Helper::class )->buildMethodName( $action, 'router' ); |
| 137 | 137 | $request = apply_filters( 'site-reviews/route/request', $request, $action, $type ); |
| 138 | 138 | do_action( $actionHook, $action, $request ); |
| 139 | - if( is_callable( [$controller, $method] )) { |
|
| 139 | + if( is_callable( [$controller, $method] ) ) { |
|
| 140 | 140 | call_user_func( [$controller, $method], $request ); |
| 141 | 141 | return; |
| 142 | 142 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | protected function sendAjaxError( $error, array $request, $statusCode = 400 ) |
| 154 | 154 | { |
| 155 | 155 | glsr_log()->error( $error )->info( $request ); |
| 156 | - wp_send_json_error([ |
|
| 156 | + wp_send_json_error( [ |
|
| 157 | 157 | 'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ), |
| 158 | 158 | 'error' => $error, |
| 159 | 159 | ], $statusCode ); |