@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function routerChangeStatus( array $request ) |
| 25 | 25 | { |
| 26 | - wp_send_json_success( $this->execute( new ChangeStatus( $request ))); |
|
| 26 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | public function routerClearConsole() |
| 33 | 33 | { |
| 34 | 34 | glsr( AdminController::class )->routerClearConsole(); |
| 35 | - wp_send_json_success([ |
|
| 35 | + wp_send_json_success( [ |
|
| 36 | 36 | 'console' => glsr( Console::class )->get(), |
| 37 | 37 | 'notices' => glsr( Notice::class )->get(), |
| 38 | - ]); |
|
| 38 | + ] ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | public function routerCountReviews() |
| 45 | 45 | { |
| 46 | 46 | glsr( AdminController::class )->routerCountReviews(); |
| 47 | - wp_send_json_success([ |
|
| 47 | + wp_send_json_success( [ |
|
| 48 | 48 | 'notices' => glsr( Notice::class )->get(), |
| 49 | - ]); |
|
| 49 | + ] ); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $shortcode = $request['shortcode']; |
| 58 | 58 | $response = false; |
| 59 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
| 59 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
| 60 | 60 | $data = glsr()->mceShortcodes[$shortcode]; |
| 61 | - if( !empty( $data['errors'] )) { |
|
| 61 | + if( !empty($data['errors']) ) { |
|
| 62 | 62 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
| 63 | 63 | } |
| 64 | 64 | $response = [ |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | public function routerFetchConsole() |
| 79 | 79 | { |
| 80 | 80 | glsr( AdminController::class )->routerFetchConsole(); |
| 81 | - wp_send_json_success([ |
|
| 81 | + wp_send_json_success( [ |
|
| 82 | 82 | 'console' => glsr( Console::class )->get(), |
| 83 | 83 | 'notices' => glsr( Notice::class )->get(), |
| 84 | - ]); |
|
| 84 | + ] ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | public function routerSearchPosts( array $request ) |
| 91 | 91 | { |
| 92 | 92 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
| 93 | - wp_send_json_success([ |
|
| 93 | + wp_send_json_success( [ |
|
| 94 | 94 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
| 95 | 95 | 'items' => $results, |
| 96 | - ]); |
|
| 96 | + ] ); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function routerSearchTranslations( array $request ) |
| 103 | 103 | { |
| 104 | - if( empty( $request['exclude'] )) { |
|
| 104 | + if( empty($request['exclude']) ) { |
|
| 105 | 105 | $request['exclude'] = []; |
| 106 | 106 | } |
| 107 | 107 | $results = glsr( Translation::class ) |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | ->exclude() |
| 110 | 110 | ->exclude( $request['exclude'] ) |
| 111 | 111 | ->renderResults(); |
| 112 | - wp_send_json_success([ |
|
| 112 | + wp_send_json_success( [ |
|
| 113 | 113 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
| 114 | 114 | 'items' => $results, |
| 115 | - ]); |
|
| 115 | + ] ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | public function routerSubmitReview( array $request ) |
| 122 | 122 | { |
| 123 | 123 | $command = glsr( PublicController::class )->routerSubmitReview( $request ); |
| 124 | - $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
| 124 | + $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
| 125 | 125 | $redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command ); |
| 126 | 126 | $data = [ |
| 127 | 127 | 'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ), |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | parse_str( parse_url( glsr_get( $request, 'url' ), PHP_URL_QUERY ), $urlQuery ); |
| 146 | 146 | $args = [ |
| 147 | 147 | 'paged' => glsr_get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 ), |
| 148 | - 'pagedUrl' => home_url( parse_url( glsr_get( $request, 'url' ), PHP_URL_PATH )), |
|
| 148 | + 'pagedUrl' => home_url( parse_url( glsr_get( $request, 'url' ), PHP_URL_PATH ) ), |
|
| 149 | 149 | 'pagination' => 'ajax', |
| 150 | 150 | 'schema' => false, |
| 151 | 151 | ]; |
| 152 | - $atts = (array) json_decode( glsr_get( $request, 'atts' )); |
|
| 153 | - $html = glsr( SiteReviews::class )->build( wp_parse_args( $args, $atts )); |
|
| 154 | - return wp_send_json_success([ |
|
| 152 | + $atts = (array)json_decode( glsr_get( $request, 'atts' ) ); |
|
| 153 | + $html = glsr( SiteReviews::class )->build( wp_parse_args( $args, $atts ) ); |
|
| 154 | + return wp_send_json_success( [ |
|
| 155 | 155 | 'pagination' => $html->getPagination(), |
| 156 | 156 | 'reviews' => $html->getReviews(), |
| 157 | - ]); |
|
| 157 | + ] ); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function routerTogglePinned( array $request ) |
| 164 | 164 | { |
| 165 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
| 166 | - wp_send_json_success([ |
|
| 165 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
| 166 | + wp_send_json_success( [ |
|
| 167 | 167 | 'notices' => glsr( Notice::class )->get(), |
| 168 | 168 | 'pinned' => $isPinned, |
| 169 | - ]); |
|
| 169 | + ] ); |
|
| 170 | 170 | } |
| 171 | 171 | } |
@@ -84,7 +84,8 @@ |
||
| 84 | 84 | * @param mixed $key |
| 85 | 85 | * @return mixed |
| 86 | 86 | */ |
| 87 | - public function offsetGet( $key ) { |
|
| 87 | + public function offsetGet( $key ) |
|
| 88 | + { |
|
| 88 | 89 | if( $key == 'navigation' ) { |
| 89 | 90 | glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.'; |
| 90 | 91 | return $this->pagination; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $this->max_num_pages = $maxPageCount; |
| 37 | 37 | $this->reviews = $reviews; |
| 38 | 38 | $this->pagination = $this->buildPagination(); |
| 39 | - parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
| 39 | + parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'pagination' => $this->getPagination(), |
| 55 | 55 | 'reviews' => $this->getReviews(), |
| 56 | 56 | ], |
| 57 | - ]); |
|
| 57 | + ] ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getReviews() |
| 74 | 74 | { |
| 75 | - $html = empty( $this->reviews ) |
|
| 75 | + $html = empty($this->reviews) |
|
| 76 | 76 | ? $this->getReviewsFallback() |
| 77 | 77 | : implode( PHP_EOL, $this->reviews ); |
| 78 | 78 | $wrapper = '<div class="glsr-reviews">%s</div>'; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.'; |
| 90 | 90 | return $this->pagination; |
| 91 | 91 | } |
| 92 | - if( property_exists( $this, $key )) { |
|
| 92 | + if( property_exists( $this, $key ) ) { |
|
| 93 | 93 | return $this->{$key}; |
| 94 | 94 | } |
| 95 | 95 | return array_key_exists( $key, $this->reviews ) |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | 'baseUrl' => glsr_get( $this->args, 'pagedUrl' ), |
| 107 | 107 | 'current' => glsr_get( $this->args, 'paged' ), |
| 108 | 108 | 'total' => $this->max_num_pages, |
| 109 | - ]); |
|
| 110 | - $html.= sprintf( '<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json'] ); |
|
| 109 | + ] ); |
|
| 110 | + $html .= sprintf( '<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json'] ); |
|
| 111 | 111 | $wrapper = '<div class="glsr-pagination">%s</div>'; |
| 112 | 112 | $wrapper = apply_filters( 'site-reviews/reviews/pagination-wrapper', $wrapper ); |
| 113 | 113 | return sprintf( $wrapper, $html ); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $defaults[] = 'glsr-ajax-pagination'; |
| 126 | 126 | } |
| 127 | 127 | $classes = explode( ' ', $this->args['class'] ); |
| 128 | - $classes = array_unique( array_merge( $defaults, array_filter( $classes ))); |
|
| 128 | + $classes = array_unique( array_merge( $defaults, array_filter( $classes ) ) ); |
|
| 129 | 129 | return implode( ' ', $classes ); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function getReviewsFallback() |
| 136 | 136 | { |
| 137 | - if( empty( $this->args['fallback'] ) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' )) { |
|
| 137 | + if( empty($this->args['fallback']) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' ) ) { |
|
| 138 | 138 | $this->args['fallback'] = __( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' ); |
| 139 | 139 | } |
| 140 | 140 | $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>'; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->args = $args; |
| 30 | 30 | $this->max_num_pages = $maxPageCount; |
| 31 | 31 | $this->reviews = $reviews; |
| 32 | - parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
| 32 | + parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @return mixed |
| 55 | 55 | */ |
| 56 | 56 | public function offsetGet( $key ) { |
| 57 | - if( property_exists( $this, $key )) { |
|
| 57 | + if( property_exists( $this, $key ) ) { |
|
| 58 | 58 | return $this->{$key}; |
| 59 | 59 | } |
| 60 | 60 | return array_key_exists( $key, $this->reviews ) |
@@ -53,7 +53,8 @@ |
||
| 53 | 53 | * @param mixed $key |
| 54 | 54 | * @return mixed |
| 55 | 55 | */ |
| 56 | - public function offsetGet( $key ) { |
|
| 56 | + public function offsetGet( $key ) |
|
| 57 | + { |
|
| 57 | 58 | if( property_exists( $this, $key )) { |
| 58 | 59 | return $this->{$key}; |
| 59 | 60 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $className = str_replace( '.php', '', $file ); |
| 25 | 25 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
| 26 | 26 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
| 27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
| 27 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return; |
|
| 28 | 28 | glsr( 'Modules\\Upgrader\\'.$className ); |
| 29 | 29 | glsr_log()->notice( 'Completed Upgrade for v'.$version.$versionSuffix ); |
| 30 | 30 | }); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->setReviewCounts(); |
| 42 | 42 | $this->updateVersionFrom( $version ); |
| 43 | 43 | } |
| 44 | - else if( !glsr( OptionManager::class )->get( 'last_review_count', false )) { |
|
| 44 | + else if( !glsr( OptionManager::class )->get( 'last_review_count', false ) ) { |
|
| 45 | 45 | $this->setReviewCounts(); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | $filenames = []; |
| 17 | 17 | $iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' ); |
| 18 | 18 | foreach( $iterator as $fileinfo ) { |
| 19 | - if( !$fileinfo->isFile() )continue; |
|
| 19 | + if( !$fileinfo->isFile() ) { |
|
| 20 | + continue; |
|
| 21 | + } |
|
| 20 | 22 | $filenames[] = $fileinfo->getFilename(); |
| 21 | 23 | } |
| 22 | 24 | natsort( $filenames ); |
@@ -24,7 +26,9 @@ discard block |
||
| 24 | 26 | $className = str_replace( '.php', '', $file ); |
| 25 | 27 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
| 26 | 28 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
| 27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
| 29 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' )) { |
|
| 30 | + return; |
|
| 31 | + } |
|
| 28 | 32 | glsr( 'Modules\\Upgrader\\'.$className ); |
| 29 | 33 | glsr_log()->notice( 'Completed Upgrade for v'.$version.$versionSuffix ); |
| 30 | 34 | }); |
@@ -202,7 +202,9 @@ discard block |
||
| 202 | 202 | $levels = $this->getLevels(); |
| 203 | 203 | foreach( $once as $entry ) { |
| 204 | 204 | $levelName = glsr_get( $entry, 'level' ); |
| 205 | - if( !in_array( $levelName, $levels ))continue; |
|
| 205 | + if( !in_array( $levelName, $levels )) { |
|
| 206 | + continue; |
|
| 207 | + } |
|
| 206 | 208 | $level = glsr_get( array_flip( $levels ), $levelName ); |
| 207 | 209 | $message = glsr_get( $entry, 'message' ); |
| 208 | 210 | $backtraceLine = glsr_get( $entry, 'backtrace' ); |
@@ -235,7 +237,9 @@ discard block |
||
| 235 | 237 | return glsr_get( $entry, 'level' ) == $levelName |
| 236 | 238 | && glsr_get( $entry, 'handle' ) == $handle; |
| 237 | 239 | }); |
| 238 | - if( !empty( $filtered ))return; |
|
| 240 | + if( !empty( $filtered )) { |
|
| 241 | + return; |
|
| 242 | + } |
|
| 239 | 243 | $once[] = [ |
| 240 | 244 | 'backtrace' => $this->getBacktraceLineFromData( $data ), |
| 241 | 245 | 'handle' => $handle, |
@@ -424,7 +428,9 @@ discard block |
||
| 424 | 428 | */ |
| 425 | 429 | protected function reset() |
| 426 | 430 | { |
| 427 | - if( $this->size() <= pow( 1024, 2 ) / 8 )return; |
|
| 431 | + if( $this->size() <= pow( 1024, 2 ) / 8 ) { |
|
| 432 | + return; |
|
| 433 | + } |
|
| 428 | 434 | $this->clear(); |
| 429 | 435 | file_put_contents( |
| 430 | 436 | $this->file, |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class Console |
| 12 | 12 | { |
| 13 | - const DEBUG = 0; // Detailed debug information |
|
| 14 | - const INFO = 1; // Interesting events |
|
| 15 | - const NOTICE = 2; // Normal but significant events |
|
| 16 | - const WARNING = 4; // Exceptional occurrences that are not errors |
|
| 17 | - const ERROR = 8; // Runtime errors that do not require immediate action |
|
| 18 | - const CRITICAL = 16; // Critical conditions |
|
| 19 | - const ALERT = 32; // Action must be taken immediately |
|
| 13 | + const DEBUG = 0; // Detailed debug information |
|
| 14 | + const INFO = 1; // Interesting events |
|
| 15 | + const NOTICE = 2; // Normal but significant events |
|
| 16 | + const WARNING = 4; // Exceptional occurrences that are not errors |
|
| 17 | + const ERROR = 8; // Runtime errors that do not require immediate action |
|
| 18 | + const CRITICAL = 16; // Critical conditions |
|
| 19 | + const ALERT = 32; // Action must be taken immediately |
|
| 20 | 20 | const EMERGENCY = 64; // System is unusable |
| 21 | 21 | |
| 22 | 22 | protected $file; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function get() |
| 113 | 113 | { |
| 114 | - return empty( $this->log ) |
|
| 114 | + return empty($this->log) |
|
| 115 | 115 | ? __( 'Console is empty', 'site-reviews' ) |
| 116 | 116 | : $this->log; |
| 117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function getLevel() |
| 123 | 123 | { |
| 124 | - return intval( apply_filters( 'site-reviews/console/level', static::INFO )); |
|
| 124 | + return intval( apply_filters( 'site-reviews/console/level', static::INFO ) ); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getLevels() |
| 131 | 131 | { |
| 132 | - $constants = ( new ReflectionClass( __CLASS__ ))->getConstants(); |
|
| 133 | - return array_map( 'strtolower', array_flip( $constants )); |
|
| 132 | + $constants = (new ReflectionClass( __CLASS__ ))->getConstants(); |
|
| 133 | + return array_map( 'strtolower', array_flip( $constants ) ); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function humanLevel() |
| 140 | 140 | { |
| 141 | 141 | $level = $this->getLevel(); |
| 142 | - return sprintf( '%s (%d)', strtoupper( glsr_get( $this->getLevels(), $level, 'unknown' )), $level ); |
|
| 142 | + return sprintf( '%s (%d)', strtoupper( glsr_get( $this->getLevels(), $level, 'unknown' ) ), $level ); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | public function humanSize( $valueIfEmpty = null ) |
| 150 | 150 | { |
| 151 | 151 | $bytes = $this->size(); |
| 152 | - if( empty( $bytes ) && is_string( $valueIfEmpty )) { |
|
| 152 | + if( empty($bytes) && is_string( $valueIfEmpty ) ) { |
|
| 153 | 153 | return $valueIfEmpty; |
| 154 | 154 | } |
| 155 | - $exponent = floor( log( max( $bytes, 1 ), 1024 )); |
|
| 156 | - return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent]; |
|
| 155 | + $exponent = floor( log( max( $bytes, 1 ), 1024 ) ); |
|
| 156 | + return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent]; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -177,16 +177,16 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function log( $level, $message, $context = [], $backtraceLine = '' ) |
| 179 | 179 | { |
| 180 | - if( empty( $backtraceLine )) { |
|
| 180 | + if( empty($backtraceLine) ) { |
|
| 181 | 181 | $backtraceLine = $this->getBacktraceLine(); |
| 182 | 182 | } |
| 183 | - if( $this->canLogEntry( $level, $backtraceLine )) { |
|
| 183 | + if( $this->canLogEntry( $level, $backtraceLine ) ) { |
|
| 184 | 184 | $levelName = glsr_get( $this->getLevels(), $level ); |
| 185 | 185 | $context = glsr( Helper::class )->consolidateArray( $context ); |
| 186 | 186 | $backtraceLine = $this->normalizeBacktraceLine( $backtraceLine ); |
| 187 | 187 | $message = $this->interpolate( $message, $context ); |
| 188 | 188 | $entry = $this->buildLogEntry( $levelName, $message, $backtraceLine ); |
| 189 | - file_put_contents( $this->file, $entry.PHP_EOL, FILE_APPEND|LOCK_EX ); |
|
| 189 | + file_put_contents( $this->file, $entry.PHP_EOL, FILE_APPEND | LOCK_EX ); |
|
| 190 | 190 | apply_filters( 'console', $message, $levelName, $backtraceLine ); // Show in Blackbar plugin if installed |
| 191 | 191 | $this->reset(); |
| 192 | 192 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $levels = $this->getLevels(); |
| 203 | 203 | foreach( $once as $entry ) { |
| 204 | 204 | $levelName = glsr_get( $entry, 'level' ); |
| 205 | - if( !in_array( $levelName, $levels ))continue; |
|
| 205 | + if( !in_array( $levelName, $levels ) )continue; |
|
| 206 | 206 | $level = glsr_get( array_flip( $levels ), $levelName ); |
| 207 | 207 | $message = glsr_get( $entry, 'message' ); |
| 208 | 208 | $backtraceLine = glsr_get( $entry, 'backtrace' ); |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | public function once( $levelName, $handle, $data ) |
| 232 | 232 | { |
| 233 | 233 | $once = glsr( Helper::class )->consolidateArray( glsr()->{$this->logOnceKey} ); |
| 234 | - $filtered = array_filter( $once, function( $entry ) use( $levelName, $handle ) { |
|
| 234 | + $filtered = array_filter( $once, function( $entry ) use($levelName, $handle) { |
|
| 235 | 235 | return glsr_get( $entry, 'level' ) == $levelName |
| 236 | 236 | && glsr_get( $entry, 'handle' ) == $handle; |
| 237 | 237 | }); |
| 238 | - if( !empty( $filtered ))return; |
|
| 238 | + if( !empty($filtered) )return; |
|
| 239 | 239 | $once[] = [ |
| 240 | 240 | 'backtrace' => $this->getBacktraceLineFromData( $data ), |
| 241 | 241 | 'handle' => $handle, |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | protected function getBacktraceLine() |
| 316 | 316 | { |
| 317 | 317 | $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 6 ); |
| 318 | - $search = array_search( 'log', glsr_array_column( $backtrace, 'function' )); |
|
| 318 | + $search = array_search( 'log', glsr_array_column( $backtrace, 'function' ) ); |
|
| 319 | 319 | if( $search !== false ) { |
| 320 | - $index = glsr_get( $backtrace, ( $search + 2 ).'.function' ) == '{closure}' |
|
| 320 | + $index = glsr_get( $backtrace, ($search + 2).'.function' ) == '{closure}' |
|
| 321 | 321 | ? $search + 4 |
| 322 | 322 | : $search + 1; |
| 323 | 323 | return $this->buildBacktraceLine( $backtrace, $index ); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | protected function interpolate( $message, $context = [] ) |
| 358 | 358 | { |
| 359 | - if( $this->isObjectOrArray( $message ) || !is_array( $context )) { |
|
| 359 | + if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) { |
|
| 360 | 360 | return print_r( $message, true ); |
| 361 | 361 | } |
| 362 | 362 | $replace = []; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | glsr()->path( 'plugin/' ), |
| 386 | 386 | glsr()->path( 'plugin/', false ), |
| 387 | 387 | trailingslashit( glsr()->path() ), |
| 388 | - trailingslashit( glsr()->path( '', false )), |
|
| 388 | + trailingslashit( glsr()->path( '', false ) ), |
|
| 389 | 389 | WP_CONTENT_DIR, |
| 390 | 390 | ABSPATH |
| 391 | 391 | ]; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | if( $value instanceof DateTime ) { |
| 414 | 414 | $value = $value->format( 'Y-m-d H:i:s' ); |
| 415 | 415 | } |
| 416 | - else if( $this->isObjectOrArray( $value )) { |
|
| 416 | + else if( $this->isObjectOrArray( $value ) ) { |
|
| 417 | 417 | $value = json_encode( $value ); |
| 418 | 418 | } |
| 419 | 419 | return (string)$value; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $this->review = $review; |
| 24 | 24 | $this->values = $values; |
| 25 | - parent::__construct( $values, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
| 25 | + parent::__construct( $values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __toString() |
| 32 | 32 | { |
| 33 | - if( empty( $this->values ))return; |
|
| 33 | + if( empty($this->values) )return; |
|
| 34 | 34 | return glsr( Template::class )->build( 'templates/review', [ |
| 35 | 35 | 'context' => $this->values, |
| 36 | 36 | 'review' => $this->review, |
| 37 | - ]); |
|
| 37 | + ] ); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return mixed |
| 43 | 43 | */ |
| 44 | 44 | public function offsetGet( $key ) { |
| 45 | - if( property_exists( $this, $key )) { |
|
| 45 | + if( property_exists( $this, $key ) ) { |
|
| 46 | 46 | return $this->{$key}; |
| 47 | 47 | } |
| 48 | 48 | return array_key_exists( $key, $this->values ) |
@@ -30,7 +30,9 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __toString() |
| 32 | 32 | { |
| 33 | - if( empty( $this->values ))return; |
|
| 33 | + if( empty( $this->values )) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 34 | 36 | return glsr( Template::class )->build( 'templates/review', [ |
| 35 | 37 | 'context' => $this->values, |
| 36 | 38 | 'review' => $this->review, |
@@ -41,7 +43,8 @@ discard block |
||
| 41 | 43 | * @param mixed $key |
| 42 | 44 | * @return mixed |
| 43 | 45 | */ |
| 44 | - public function offsetGet( $key ) { |
|
| 46 | + public function offsetGet( $key ) |
|
| 47 | + { |
|
| 45 | 48 | if( property_exists( $this, $key )) { |
| 46 | 49 | return $this->{$key}; |
| 47 | 50 | } |