@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function __call( $name, array $args = [] ) |
| 15 | 15 | { |
| 16 | - if( !method_exists( $this, $name ))return; |
|
| 16 | + if( !method_exists( $this, $name ) )return; |
|
| 17 | 17 | $defaults = call_user_func_array( [$this, $name], $args ); |
| 18 | 18 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
| 19 | 19 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function get() |
| 110 | 110 | { |
| 111 | - return empty( $this->log ) |
|
| 111 | + return empty($this->log) |
|
| 112 | 112 | ? __( 'Console is empty', 'site-reviews' ) |
| 113 | 113 | : $this->log; |
| 114 | 114 | } |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | public function humanSize( $valueIfEmpty = null ) |
| 121 | 121 | { |
| 122 | 122 | $bytes = $this->size(); |
| 123 | - if( empty( $bytes ) && is_string( $valueIfEmpty )) { |
|
| 123 | + if( empty($bytes) && is_string( $valueIfEmpty ) ) { |
|
| 124 | 124 | return $valueIfEmpty; |
| 125 | 125 | } |
| 126 | - $exponent = floor( log( max( $bytes, 1 ), 1024 )); |
|
| 127 | - return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent]; |
|
| 126 | + $exponent = floor( log( max( $bytes, 1 ), 1024 ) ); |
|
| 127 | + return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent]; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | public function log( $level, $message, array $context = [] ) |
| 148 | 148 | { |
| 149 | 149 | $constants = (new ReflectionClass( __CLASS__ ))->getConstants(); |
| 150 | - if( in_array( $level, $constants, true )) { |
|
| 150 | + if( in_array( $level, $constants, true ) ) { |
|
| 151 | 151 | $entry = $this->buildLogEntry( $level, $message, $context ); |
| 152 | - file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX ); |
|
| 152 | + file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX ); |
|
| 153 | 153 | $this->reset(); |
| 154 | 154 | } |
| 155 | 155 | return $this; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | protected function interpolate( $message, $context = [] ) |
| 224 | 224 | { |
| 225 | - if( $this->isObjectOrArray( $message ) || !is_array( $context )) { |
|
| 225 | + if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) { |
|
| 226 | 226 | return print_r( $message, true ); |
| 227 | 227 | } |
| 228 | 228 | $replace = []; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if( $value instanceof DateTime ) { |
| 251 | 251 | $value = $value->format( 'Y-m-d H:i:s' ); |
| 252 | 252 | } |
| 253 | - else if( $this->isObjectOrArray( $value )) { |
|
| 253 | + else if( $this->isObjectOrArray( $value ) ) { |
|
| 254 | 254 | $value = json_encode( $value ); |
| 255 | 255 | } |
| 256 | 256 | return (string)$value; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $this->clear(); |
| 266 | 266 | file_put_contents( |
| 267 | 267 | $this->file, |
| 268 | - $this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' )) |
|
| 268 | + $this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ) ) |
|
| 269 | 269 | ); |
| 270 | 270 | } |
| 271 | 271 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) { |
| 23 | 23 | $column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [ |
| 24 | 24 | 'href' => (string)get_the_permalink( $assignedPost->ID ), |
| 25 | - ]); |
|
| 25 | + ] ); |
|
| 26 | 26 | } |
| 27 | 27 | return $column; |
| 28 | 28 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | $pinned = get_post_meta( $postId, 'pinned', true ) |
| 37 | 37 | ? 'pinned ' |
| 38 | 38 | : ''; |
| 39 | - return glsr( Builder::class )->i([ |
|
| 39 | + return glsr( Builder::class )->i( [ |
|
| 40 | 40 | 'class' => $pinned.'dashicons dashicons-sticky', |
| 41 | 41 | 'data-id' => $postId, |
| 42 | - ]); |
|
| 42 | + ] ); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function buildColumnReviewer( $postId ) |
| 50 | 50 | { |
| 51 | - return strval( get_post_meta( $postId, 'author', true )); |
|
| 51 | + return strval( get_post_meta( $postId, 'author', true ) ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | public function buildColumnRating( $postId ) |
| 60 | 60 | { |
| 61 | 61 | return glsr( Partial::class )->build( 'star-rating', [ |
| 62 | - 'rating' => intval( get_post_meta( $postId, 'rating', true )), |
|
| 63 | - ]); |
|
| 62 | + 'rating' => intval( get_post_meta( $postId, 'rating', true ) ), |
|
| 63 | + ] ); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public function renderFilters( $postType ) |
| 83 | 83 | { |
| 84 | 84 | if( $postType !== Application::POST_TYPE )return; |
| 85 | - if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
|
| 85 | + if( !($status = filter_input( INPUT_GET, 'post_status' )) ) { |
|
| 86 | 86 | $status = 'publish'; |
| 87 | 87 | } |
| 88 | 88 | $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status ); |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function renderFilterRatings( $ratings ) |
| 113 | 113 | { |
| 114 | - if( empty( $ratings ))return; |
|
| 115 | - $ratings = array_flip( array_reverse( $ratings )); |
|
| 114 | + if( empty($ratings) )return; |
|
| 115 | + $ratings = array_flip( array_reverse( $ratings ) ); |
|
| 116 | 116 | array_walk( $ratings, function( &$value, $key ) { |
| 117 | 117 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
| 118 | 118 | $value = sprintf( $label, $key ); |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [ |
| 121 | 121 | 'class' => 'screen-reader-text', |
| 122 | 122 | 'for' => 'rating', |
| 123 | - ]); |
|
| 124 | - echo glsr( Builder::class )->select([ |
|
| 123 | + ] ); |
|
| 124 | + echo glsr( Builder::class )->select( [ |
|
| 125 | 125 | 'name' => 'rating', |
| 126 | 126 | 'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings, |
| 127 | 127 | 'value' => filter_input( INPUT_GET, 'rating' ), |
| 128 | - ]); |
|
| 128 | + ] ); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
| 139 | 139 | 'class' => 'screen-reader-text', |
| 140 | 140 | 'for' => 'review_type', |
| 141 | - ]); |
|
| 142 | - echo glsr( Builder::class )->select([ |
|
| 141 | + ] ); |
|
| 142 | + echo glsr( Builder::class )->select( [ |
|
| 143 | 143 | 'name' => 'review_type', |
| 144 | 144 | 'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes, |
| 145 | 145 | 'value' => filter_input( INPUT_GET, 'review_type' ), |
| 146 | - ]); |
|
| 146 | + ] ); |
|
| 147 | 147 | } |
| 148 | 148 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | 'loader' => '<div class="glsr-loader"></div>', |
| 28 | 28 | 'screen_reader_text' => __( 'Site Reviews navigation', 'site-reviews' ), |
| 29 | 29 | ], |
| 30 | - ]); |
|
| 30 | + ] ); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected function buildLinks() |
| 37 | 37 | { |
| 38 | - $args = glsr( Style::class )->paginationArgs([ |
|
| 38 | + $args = glsr( Style::class )->paginationArgs( [ |
|
| 39 | 39 | 'current' => $this->args['paged'], |
| 40 | 40 | 'total' => $this->args['total'], |
| 41 | - ]); |
|
| 41 | + ] ); |
|
| 42 | 42 | if( is_front_page() ) { |
| 43 | - unset( $args['format'] ); |
|
| 43 | + unset($args['format']); |
|
| 44 | 44 | } |
| 45 | 45 | if( $args['type'] == 'array' ) { |
| 46 | 46 | $args['type'] = 'plain'; |
@@ -56,6 +56,6 @@ discard block |
||
| 56 | 56 | return wp_parse_args( $args, [ |
| 57 | 57 | 'paged' => glsr( QueryBuilder::class )->getPaged(), |
| 58 | 58 | 'total' => 1, |
| 59 | - ]); |
|
| 59 | + ] ); |
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
| 18 | 18 | if( !$review ) { |
| 19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
| 20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
| 20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
| 23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
| 24 | 24 | glsr( Notification::class )->send( $review ); |
| 25 | 25 | if( $command->ajax_request )return; |
| 26 | - wp_safe_redirect( $this->getReferer( $command )); |
|
| 26 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
| 27 | 27 | exit; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected function getReferer( Command $command ) |
| 34 | 34 | { |
| 35 | - $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
| 36 | - if( empty( $referer )) { |
|
| 35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
| 36 | + if( empty($referer) ) { |
|
| 37 | 37 | $referer = $command->referer; |
| 38 | 38 | } |
| 39 | - if( empty( $referer )) { |
|
| 39 | + if( empty($referer) ) { |
|
| 40 | 40 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
| 41 | 41 | $referer = home_url(); |
| 42 | 42 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $fields = []; |
| 30 | 30 | foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) { |
| 31 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
| 31 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
| 32 | 32 | } |
| 33 | 33 | return $fields; |
| 34 | 34 | } |
@@ -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; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $app = new GeminiLabs\SiteReviews\Application; |
| 31 | 31 | $app->make( 'Provider' )->register( $app ); |
| 32 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
| 33 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
| 34 | -register_shutdown_function( array( $app, 'catchFatalError' )); |
|
| 32 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
| 33 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
| 34 | +register_shutdown_function( array( $app, 'catchFatalError' ) ); |
|
| 35 | 35 | $app->init(); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | <p>{{ data.s1 }}</p> |
| 8 | 8 | </div> |
| 9 | 9 | <p class="row-actions"> |
| 10 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 10 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 11 | 11 | </p> |
| 12 | 12 | </td> |
| 13 | 13 | <td class="glsr-string-td2"> |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | <p>{{ data.p1 }}</p> |
| 9 | 9 | </div> |
| 10 | 10 | <p class="row-actions"> |
| 11 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 11 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 12 | 12 | </p> |
| 13 | 13 | </td> |
| 14 | 14 | <td class="glsr-string-td2"> |