@@ -16,9 +16,13 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $queries = []; |
| 18 | 18 | foreach( $keys as $key ) { |
| 19 | - if( !array_key_exists( $key, $values ))continue; |
|
| 19 | + if( !array_key_exists( $key, $values )) { |
|
| 20 | + continue; |
|
| 21 | + } |
|
| 20 | 22 | $methodName = glsr( Helper::class )->buildMethodName( $key, $prefix = __METHOD__ ); |
| 21 | - if( !method_exists( $this, $methodName ))continue; |
|
| 23 | + if( !method_exists( $this, $methodName )) { |
|
| 24 | + continue; |
|
| 25 | + } |
|
| 22 | 26 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
| 23 | 27 | if( is_array( $query )) { |
| 24 | 28 | $queries[] = $query; |
@@ -90,7 +94,9 @@ discard block |
||
| 90 | 94 | */ |
| 91 | 95 | protected function buildQueryAssignedTo( $value ) |
| 92 | 96 | { |
| 93 | - if( empty( $value ))return; |
|
| 97 | + if( empty( $value )) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 94 | 100 | return [ |
| 95 | 101 | 'compare' => 'IN', |
| 96 | 102 | 'key' => 'assigned_to', |
@@ -104,7 +110,9 @@ discard block |
||
| 104 | 110 | */ |
| 105 | 111 | protected function buildQueryCategory( $value ) |
| 106 | 112 | { |
| 107 | - if( empty( $value ))return; |
|
| 113 | + if( empty( $value )) { |
|
| 114 | + return; |
|
| 115 | + } |
|
| 108 | 116 | return [ |
| 109 | 117 | 'field' => 'term_id', |
| 110 | 118 | 'taxonomy' => Application::TAXONOMY, |
@@ -118,7 +126,9 @@ discard block |
||
| 118 | 126 | */ |
| 119 | 127 | protected function buildQueryRating( $value ) |
| 120 | 128 | { |
| 121 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
| 129 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
| 130 | + return; |
|
| 131 | + } |
|
| 122 | 132 | return [ |
| 123 | 133 | 'compare' => '>=', |
| 124 | 134 | 'key' => 'rating', |
@@ -132,7 +142,9 @@ discard block |
||
| 132 | 142 | */ |
| 133 | 143 | protected function buildQueryType( $value ) |
| 134 | 144 | { |
| 135 | - if( in_array( $value, ['','all'] ))return; |
|
| 145 | + if( in_array( $value, ['','all'] )) { |
|
| 146 | + return; |
|
| 147 | + } |
|
| 136 | 148 | return [ |
| 137 | 149 | 'key' => 'review_type', |
| 138 | 150 | 'value' => $value, |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $queries = []; |
| 18 | 18 | foreach( $keys as $key ) { |
| 19 | - if( !array_key_exists( $key, $values ))continue; |
|
| 19 | + if( !array_key_exists( $key, $values ) )continue; |
|
| 20 | 20 | $methodName = glsr( Helper::class )->buildMethodName( $key, $prefix = __METHOD__ ); |
| 21 | - if( !method_exists( $this, $methodName ))continue; |
|
| 21 | + if( !method_exists( $this, $methodName ) )continue; |
|
| 22 | 22 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
| 23 | - if( is_array( $query )) { |
|
| 23 | + if( is_array( $query ) ) { |
|
| 24 | 24 | $queries[] = $query; |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function buildSqlOr( $values, $sprintfFormat ) |
| 37 | 37 | { |
| 38 | - if( !is_array( $values )) { |
|
| 38 | + if( !is_array( $values ) ) { |
|
| 39 | 39 | $values = explode( ',', $values ); |
| 40 | 40 | } |
| 41 | - $values = array_filter( array_map( 'trim', (array)$values )); |
|
| 42 | - $values = array_map( function( $value ) use( $sprintfFormat ) { |
|
| 41 | + $values = array_filter( array_map( 'trim', (array)$values ) ); |
|
| 42 | + $values = array_map( function( $value ) use($sprintfFormat) { |
|
| 43 | 43 | return sprintf( $sprintfFormat, $value ); |
| 44 | 44 | }, $values ); |
| 45 | 45 | return implode( ' OR ', $values ); |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function filterSearchByTitle( $search, WP_Query $query ) |
| 56 | 56 | { |
| 57 | - if( empty( $search ) || empty( $query->get( 'search_terms' ))) { |
|
| 57 | + if( empty($search) || empty($query->get( 'search_terms' )) ) { |
|
| 58 | 58 | return $search; |
| 59 | 59 | } |
| 60 | 60 | global $wpdb; |
| 61 | - $n = empty( $query->get( 'exact' )) |
|
| 61 | + $n = empty($query->get( 'exact' )) |
|
| 62 | 62 | ? '%' |
| 63 | 63 | : ''; |
| 64 | 64 | $search = []; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function getPaged( $isEnabled = true ) |
| 80 | 80 | { |
| 81 | 81 | $paged = $isEnabled |
| 82 | - ? intval( get_query_var( is_front_page() ? 'page' : Application::PAGED_QUERY_VAR )) |
|
| 82 | + ? intval( get_query_var( is_front_page() ? 'page' : Application::PAGED_QUERY_VAR ) ) |
|
| 83 | 83 | : 1; |
| 84 | 84 | return max( 1, $paged ); |
| 85 | 85 | } |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function buildQueryAssignedTo( $value ) |
| 92 | 92 | { |
| 93 | - if( empty( $value ))return; |
|
| 93 | + if( empty($value) )return; |
|
| 94 | 94 | return [ |
| 95 | 95 | 'compare' => 'IN', |
| 96 | 96 | 'key' => 'assigned_to', |
| 97 | - 'value' => array_filter( array_map( 'trim', explode( ',', $value )), 'is_numeric' ), |
|
| 97 | + 'value' => array_filter( array_map( 'trim', explode( ',', $value ) ), 'is_numeric' ), |
|
| 98 | 98 | ]; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function buildQueryCategory( $value ) |
| 106 | 106 | { |
| 107 | - if( empty( $value ))return; |
|
| 107 | + if( empty($value) )return; |
|
| 108 | 108 | return [ |
| 109 | 109 | 'field' => 'term_id', |
| 110 | 110 | 'taxonomy' => Application::TAXONOMY, |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | protected function buildQueryRating( $value ) |
| 120 | 120 | { |
| 121 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
| 121 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ) ) )return; |
|
| 122 | 122 | return [ |
| 123 | 123 | 'compare' => '>=', |
| 124 | 124 | 'key' => 'rating', |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | protected function buildQueryType( $value ) |
| 134 | 134 | { |
| 135 | - if( in_array( $value, ['','all'] ))return; |
|
| 135 | + if( in_array( $value, ['', 'all'] ) )return; |
|
| 136 | 136 | return [ |
| 137 | 137 | 'key' => 'review_type', |
| 138 | 138 | 'value' => $value, |
@@ -38,7 +38,9 @@ |
||
| 38 | 38 | protected function normalize( array $settings ) |
| 39 | 39 | { |
| 40 | 40 | array_walk( $settings, function( &$setting ) { |
| 41 | - if( isset( $setting['default'] ))return; |
|
| 41 | + if( isset( $setting['default'] )) { |
|
| 42 | + return; |
|
| 43 | + } |
|
| 42 | 44 | $setting['default'] = null; |
| 43 | 45 | }); |
| 44 | 46 | return $settings; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $settings = include glsr()->path( 'config/settings.php' ); |
| 16 | 16 | $settings = apply_filters( 'site-reviews/addon/settings', $settings ); |
| 17 | 17 | $settings = $this->normalize( $settings ); |
| 18 | - $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' )); |
|
| 18 | + $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) ); |
|
| 19 | 19 | return glsr( Helper::class )->convertDotNotationArray( $defaults ); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | protected function normalize( array $settings ) |
| 39 | 39 | { |
| 40 | 40 | array_walk( $settings, function( &$setting ) { |
| 41 | - if( isset( $setting['default'] ))return; |
|
| 41 | + if( isset($setting['default']) )return; |
|
| 42 | 42 | $setting['default'] = null; |
| 43 | 43 | }); |
| 44 | 44 | return $settings; |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | class Cache |
| 8 | 8 | { |
| 9 | 9 | /** |
| 10 | - * @return array |
|
| 10 | + * @return array |
|
| 11 | 11 | */ |
| 12 | 12 | public function getCloudflareIps() |
| 13 | 13 | { |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | $ipAddresses = array_fill_keys( ['v4', 'v6'], [] ); |
| 18 | 18 | foreach( array_keys( $ipAddresses ) as $version ) { |
| 19 | 19 | $response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version ); |
| 20 | - if( is_wp_error( $response ))continue; |
|
| 21 | - $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ))); |
|
| 20 | + if( is_wp_error( $response ) )continue; |
|
| 21 | + $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ) ) ); |
|
| 22 | 22 | } |
| 23 | 23 | wp_cache_set( Application::ID, $ipAddresses, '_cloudflare_ips' ); |
| 24 | 24 | } |
@@ -17,7 +17,9 @@ |
||
| 17 | 17 | $ipAddresses = array_fill_keys( ['v4', 'v6'], [] ); |
| 18 | 18 | foreach( array_keys( $ipAddresses ) as $version ) { |
| 19 | 19 | $response = wp_remote_get( 'https://www.cloudflare.com/ips-'.$version ); |
| 20 | - if( is_wp_error( $response ))continue; |
|
| 20 | + if( is_wp_error( $response )) { |
|
| 21 | + continue; |
|
| 22 | + } |
|
| 21 | 23 | $ipAddresses[$version] = array_filter( explode( PHP_EOL, wp_remote_retrieve_body( $response ))); |
| 22 | 24 | } |
| 23 | 25 | wp_cache_set( Application::ID, $ipAddresses, '_cloudflare_ips' ); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | function glsr( $alias = null ) { |
| 8 | 8 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 9 | - return empty( $alias ) |
|
| 9 | + return empty($alias) |
|
| 10 | 10 | ? $app |
| 11 | 11 | : $app->make( $alias ); |
| 12 | 12 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | * @return \WP_Screen|object |
| 17 | 17 | */ |
| 18 | 18 | function glsr_current_screen() { |
| 19 | - if( function_exists( 'get_current_screen' )) { |
|
| 19 | + if( function_exists( 'get_current_screen' ) ) { |
|
| 20 | 20 | $screen = get_current_screen(); |
| 21 | 21 | } |
| 22 | - return empty( $screen ) |
|
| 22 | + return empty($screen) |
|
| 23 | 23 | ? (object)array_fill_keys( ['base', 'id', 'post_type'], null ) |
| 24 | 24 | : $screen; |
| 25 | 25 | } |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | function glsr_log() { |
| 56 | 56 | $args = func_get_args(); |
| 57 | - $context = isset( $args[1] ) |
|
| 57 | + $context = isset($args[1]) |
|
| 58 | 58 | ? $args[1] |
| 59 | 59 | : []; |
| 60 | 60 | $logger = glsr( 'Modules\Logger' ); |
| 61 | - return empty( $args ) |
|
| 61 | + return empty($args) |
|
| 62 | 62 | ? $logger |
| 63 | 63 | : $logger->log( 'debug', $args[0], $context ); |
| 64 | 64 | } |
@@ -4,7 +4,8 @@ discard block |
||
| 4 | 4 | /** |
| 5 | 5 | * @return mixed |
| 6 | 6 | */ |
| 7 | -function glsr( $alias = null ) { |
|
| 7 | +function glsr( $alias = null ) |
|
| 8 | +{ |
|
| 8 | 9 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 9 | 10 | return empty( $alias ) |
| 10 | 11 | ? $app |
@@ -15,7 +16,8 @@ discard block |
||
| 15 | 16 | * get_current_screen() is unreliable because it is not defined on all admin pages |
| 16 | 17 | * @return \WP_Screen|object |
| 17 | 18 | */ |
| 18 | -function glsr_current_screen() { |
|
| 19 | +function glsr_current_screen() |
|
| 20 | +{ |
|
| 19 | 21 | if( function_exists( 'get_current_screen' )) { |
| 20 | 22 | $screen = get_current_screen(); |
| 21 | 23 | } |
@@ -27,7 +29,8 @@ discard block |
||
| 27 | 29 | /** |
| 28 | 30 | * @return \GeminiLabs\SiteReviews\Database |
| 29 | 31 | */ |
| 30 | -function glsr_db() { |
|
| 32 | +function glsr_db() |
|
| 33 | +{ |
|
| 31 | 34 | return glsr( 'Database' ); |
| 32 | 35 | } |
| 33 | 36 | |
@@ -35,7 +38,8 @@ discard block |
||
| 35 | 38 | * @param mixed ...$vars |
| 36 | 39 | * @return void |
| 37 | 40 | */ |
| 38 | -function glsr_debug( ...$vars ) { |
|
| 41 | +function glsr_debug( ...$vars ) |
|
| 42 | +{ |
|
| 39 | 43 | if( count( $vars ) == 1 ) { |
| 40 | 44 | $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' ); |
| 41 | 45 | printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value ); |
@@ -52,7 +56,8 @@ discard block |
||
| 52 | 56 | /** |
| 53 | 57 | * @return \GeminiLabs\SiteReviews\Modules\Logger |
| 54 | 58 | */ |
| 55 | -function glsr_log() { |
|
| 59 | +function glsr_log() |
|
| 60 | +{ |
|
| 56 | 61 | $args = func_get_args(); |
| 57 | 62 | $context = isset( $args[1] ) |
| 58 | 63 | ? $args[1] |
@@ -68,7 +73,8 @@ discard block |
||
| 68 | 73 | * @return void |
| 69 | 74 | * @callback register_taxonomy() "meta_box_cb" |
| 70 | 75 | */ |
| 71 | -function glsr_categories_meta_box( $post, $box ) { |
|
| 76 | +function glsr_categories_meta_box( $post, $box ) |
|
| 77 | +{ |
|
| 72 | 78 | glsr( 'Controllers\EditorController' )->renderTaxonomyMetabox( $post, $box ); |
| 73 | 79 | } |
| 74 | 80 | |
@@ -77,14 +83,16 @@ discard block |
||
| 77 | 83 | * @param mixed $fallback |
| 78 | 84 | * @return string|array |
| 79 | 85 | */ |
| 80 | -function glsr_get_option( $option_path = '', $fallback = '' ) { |
|
| 86 | +function glsr_get_option( $option_path = '', $fallback = '' ) |
|
| 87 | +{ |
|
| 81 | 88 | return glsr( 'Database\OptionManager' )->get( 'settings.'.$option_path, $fallback ); |
| 82 | 89 | } |
| 83 | 90 | |
| 84 | 91 | /** |
| 85 | 92 | * @return array |
| 86 | 93 | */ |
| 87 | -function glsr_get_options() { |
|
| 94 | +function glsr_get_options() |
|
| 95 | +{ |
|
| 88 | 96 | return glsr( 'Database\OptionManager' )->get( 'settings' ); |
| 89 | 97 | } |
| 90 | 98 | |
@@ -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'; |
|
@@ -4,6 +4,6 @@ |
||
| 4 | 4 | <html> |
| 5 | 5 | <head> |
| 6 | 6 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 7 | - <title><?= wp_specialchars_decode( (string) get_option( 'blogname', '' ), ENT_QUOTES ); ?></title> |
|
| 7 | + <title><?= wp_specialchars_decode( (string)get_option( 'blogname', '' ), ENT_QUOTES ); ?></title> |
|
| 8 | 8 | </head> |
| 9 | 9 | <body> |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | <?php |
| 8 | 8 | |
| 9 | 9 | $html->renderNotices(); |
| 10 | - $html->renderPartial( 'tabs' , [ |
|
| 10 | + $html->renderPartial( 'tabs', [ |
|
| 11 | 11 | 'page' => $page, |
| 12 | 12 | 'tab' => $currentTab, |
| 13 | 13 | 'tabs' => $tabs, |
| 14 | - ]); |
|
| 15 | - $html->renderPartial( 'sections' , [ |
|
| 14 | + ] ); |
|
| 15 | + $html->renderPartial( 'sections', [ |
|
| 16 | 16 | 'page' => $page, |
| 17 | 17 | 'section' => $currentSection, |
| 18 | 18 | 'tab' => $currentTab, |
| 19 | 19 | 'tabs' => $tabs, |
| 20 | - ]); |
|
| 20 | + ] ); |
|
| 21 | 21 | $file = $currentSection ? $currentTab.'/'.$currentSection : $currentTab; |
| 22 | 22 | $file = trailingslashit( __DIR__ ).$page.'/'.$file.'.php'; |
| 23 | 23 | $file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data ); |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | 'link' => 'https://niftyplugins.com/addons/site-reviews-tripadvisor/', |
| 9 | 9 | 'name' => 'tripadvisor', |
| 10 | 10 | 'title' => 'Tripadvisor Reviews', |
| 11 | -]); |
|
| 11 | +] ); |
|
| 12 | 12 | glsr( 'Modules\Html' )->renderTemplate( 'addons/addon', [ |
| 13 | 13 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
| 14 | 14 | 'link' => 'https://niftyplugins.com/addons/site-reviews-yelp/', |
| 15 | 15 | 'name' => 'yelp', |
| 16 | 16 | 'title' => 'Yelp Reviews', |
| 17 | -]); |
|
| 17 | +] ); |
|
| 18 | 18 | ?> |
| 19 | 19 | </div> |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | <p>{{ data.s1 }}</p> |
| 4 | 4 | <p>{{ data.p1 }}</p> |
| 5 | 5 | <p class="row-actions"> |
| 6 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 6 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 7 | 7 | </p> |
| 8 | 8 | <button type="button" class="toggle-row"> |
| 9 | 9 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |