@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function add( $type, $message, array $args = [] ) |
| 17 | 17 | { |
| 18 | - if( empty( array_filter( [$message, $type] )))return; |
|
| 18 | + if( empty(array_filter( [$message, $type] )) )return; |
|
| 19 | 19 | $args['message'] = $message; |
| 20 | 20 | $args['type'] = $type; |
| 21 | - add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ))); |
|
| 21 | + add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) ); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | public function get() |
| 55 | 55 | { |
| 56 | 56 | $notices = array_map( 'unserialize', |
| 57 | - array_unique( array_map( 'serialize', get_settings_errors( Application::ID ))) |
|
| 57 | + array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) ) |
|
| 58 | 58 | ); |
| 59 | - if( empty( $notices ))return; |
|
| 59 | + if( empty($notices) )return; |
|
| 60 | 60 | return array_reduce( $notices, function( $carry, $notice ) { |
| 61 | - return $carry.$this->buildNotice( json_decode( $notice['message'], true )); |
|
| 61 | + return $carry.$this->buildNotice( json_decode( $notice['message'], true ) ); |
|
| 62 | 62 | }); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | return glsr( Builder::class )->div( $messages, [ |
| 81 | 81 | 'class' => $class, |
| 82 | - ]); |
|
| 82 | + ] ); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | 'type' => '', |
| 95 | 95 | ]; |
| 96 | 96 | $args = shortcode_atts( $defaults, $args ); |
| 97 | - if( !in_array( $args['type'], ['error', 'warning', 'success'] )) { |
|
| 97 | + if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) { |
|
| 98 | 98 | $args['type'] = 'success'; |
| 99 | 99 | } |
| 100 | 100 | $args['messages'] = is_wp_error( $args['message'] ) |
| 101 | 101 | ? (array)$args['message']->get_error_message() |
| 102 | 102 | : (array)$args['message']; |
| 103 | - unset( $args['message'] ); |
|
| 103 | + unset($args['message']); |
|
| 104 | 104 | return $args; |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function build( $partialPath, array $args = [] ) |
| 14 | 14 | { |
| 15 | 15 | $className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' ); |
| 16 | - if( !class_exists( $className )) { |
|
| 16 | + if( !class_exists( $className ) ) { |
|
| 17 | 17 | glsr_log()->error( 'Partial missing: '.$className ); |
| 18 | 18 | return; |
| 19 | 19 | } |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | // 'is_test' => 1, |
| 32 | 32 | ]; |
| 33 | 33 | foreach( $_SERVER as $key => $value ) { |
| 34 | - if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue; |
|
| 34 | + if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ) )continue; |
|
| 35 | 35 | $submission[$key] = $value; |
| 36 | 36 | } |
| 37 | - return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review )); |
|
| 37 | + return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ) ); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $query = []; |
| 59 | 59 | foreach( $data as $key => $value ) { |
| 60 | - if( is_array( $value ) || is_object( $value ))continue; |
|
| 60 | + if( is_array( $value ) || is_object( $value ) )continue; |
|
| 61 | 61 | if( $value === false ) { |
| 62 | 62 | $value = '0'; |
| 63 | 63 | } |
| 64 | 64 | $value = trim( $value ); |
| 65 | - if( !strlen( $value ))continue; |
|
| 65 | + if( !strlen( $value ) )continue; |
|
| 66 | 66 | $query[] = urlencode( $key ).'='.urlencode( $value ); |
| 67 | 67 | } |
| 68 | 68 | return implode( '&', $query ); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | || !is_callable( ['Akismet', 'get_api_key'] ) |
| 78 | 78 | || !is_callable( ['Akismet', 'http_post'] ) |
| 79 | 79 | ? false |
| 80 | - : (bool) AkismetPlugin::get_api_key(); |
|
| 80 | + : (bool)AkismetPlugin::get_api_key(); |
|
| 81 | 81 | return apply_filters( 'site-reviews/akismet/is-active', $check ); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | public function __construct( $input ) |
| 11 | 11 | { |
| 12 | 12 | $this->id = $input['id']; |
| 13 | - $this->pinned = isset( $input['pinned'] ) |
|
| 13 | + $this->pinned = isset($input['pinned']) |
|
| 14 | 14 | ? wp_validate_boolean( $input['pinned'] ) |
| 15 | 15 | : null; |
| 16 | 16 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $diff = time() - strtotime( $date ); |
| 32 | 32 | foreach( static::$TIME_PERIODS as $i => $timePeriod ) { |
| 33 | 33 | if( $diff > $timePeriod[0] )continue; |
| 34 | - $unit = intval( floor( $diff / $timePeriod[1] )); |
|
| 34 | + $unit = intval( floor( $diff / $timePeriod[1] ) ); |
|
| 35 | 35 | $relativeDates = [ |
| 36 | 36 | _n( '%s second ago', '%s seconds ago', $unit, 'site-reviews' ), |
| 37 | 37 | _n( '%s minute ago', '%s minutes ago', $unit, 'site-reviews' ), |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | $ipAddresses = array_fill_keys( ['v4', 'v6'], [] ); |
| 20 | 20 | foreach( array_keys( $ipAddresses ) as $version ) { |
| 21 | 21 | $response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version ); |
| 22 | - if( is_wp_error( $response )) { |
|
| 22 | + if( is_wp_error( $response ) ) { |
|
| 23 | 23 | glsr_log()->error( $response->get_error_message() ); |
| 24 | 24 | continue; |
| 25 | 25 | } |
| 26 | - $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ))); |
|
| 26 | + $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) ); |
|
| 27 | 27 | } |
| 28 | 28 | set_transient( Application::ID.'_cloudflare_ips', $ipAddresses, static::EXPIRY_TIME ); |
| 29 | 29 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if( $test === false ) { |
| 58 | 58 | $response = wp_remote_post( 'https://api.wordpress.org/stats/php/1.0/' ); |
| 59 | 59 | $test = !is_wp_error( $response ) |
| 60 | - && in_array( $response['response']['code'], range( 200, 299 )) |
|
| 60 | + && in_array( $response['response']['code'], range( 200, 299 ) ) |
|
| 61 | 61 | ? 'Works' |
| 62 | 62 | : 'Does not work'; |
| 63 | 63 | set_transient( Application::ID.'_remote_post_test', $test, static::EXPIRY_TIME ); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php defined( 'WPINC' ) || die; |
| 2 | 2 | |
| 3 | -include trailingslashit(__DIR__).'header.php'; |
|
| 4 | -include trailingslashit(__DIR__).'body.php'; |
|
| 5 | -include trailingslashit(__DIR__).'footer.php'; |
|
| 3 | +include trailingslashit( __DIR__ ).'header.php'; |
|
| 4 | +include trailingslashit( __DIR__ ).'body.php'; |
|
| 5 | +include trailingslashit( __DIR__ ).'footer.php'; |
|
@@ -12,11 +12,11 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function handle( Command $command ) |
| 14 | 14 | { |
| 15 | - $postId = wp_update_post([ |
|
| 15 | + $postId = wp_update_post( [ |
|
| 16 | 16 | 'ID' => $command->id, |
| 17 | 17 | 'post_status' => $command->status, |
| 18 | - ]); |
|
| 19 | - if( is_wp_error( $postId )) { |
|
| 18 | + ] ); |
|
| 19 | + if( is_wp_error( $postId ) ) { |
|
| 20 | 20 | glsr_log()->error( $postId->get_error_message() ); |
| 21 | 21 | return []; |
| 22 | 22 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')', |
| 38 | 38 | 'class' => 'row-title', |
| 39 | 39 | 'href' => get_edit_post_link( $postId ), |
| 40 | - ]); |
|
| 40 | + ] ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | protected function getPostState( $postId ) |
| 48 | 48 | { |
| 49 | 49 | ob_start(); |
| 50 | - _post_states( get_post( $postId )); |
|
| 50 | + _post_states( get_post( $postId ) ); |
|
| 51 | 51 | return ob_get_clean(); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | protected function normalize( array $data ) |
| 52 | 52 | { |
| 53 | 53 | $arrayKeys = ['context', 'globals']; |
| 54 | - $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
|
| 54 | + $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) ); |
|
| 55 | 55 | foreach( $arrayKeys as $key ) { |
| 56 | - if( is_array( $data[$key] ))continue; |
|
| 56 | + if( is_array( $data[$key] ) )continue; |
|
| 57 | 57 | $data[$key] = []; |
| 58 | 58 | } |
| 59 | 59 | return $data; |