@@ -21,7 +21,9 @@ |
||
| 21 | 21 | if( !class_exists( 'GL_Plugin_Check_v1' )) { |
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | -if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' )))return; |
|
| 24 | +if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' ))) { |
|
| 25 | + return; |
|
| 26 | +} |
|
| 25 | 27 | |
| 26 | 28 | require_once __DIR__.'/autoload.php'; |
| 27 | 29 | require_once __DIR__.'/helpers.php'; |
@@ -18,16 +18,16 @@ |
||
| 18 | 18 | |
| 19 | 19 | defined( 'WPINC' ) || die; |
| 20 | 20 | |
| 21 | -if( !class_exists( 'GL_Plugin_Check_v1' )) { |
|
| 21 | +if( !class_exists( 'GL_Plugin_Check_v1' ) ) { |
|
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | -if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' )))return; |
|
| 24 | +if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__, array( 'wordpress' => '4.7.0' ) ) )return; |
|
| 25 | 25 | |
| 26 | 26 | require_once __DIR__.'/autoload.php'; |
| 27 | 27 | require_once __DIR__.'/helpers.php'; |
| 28 | 28 | |
| 29 | 29 | $app = new GeminiLabs\SiteReviews\Application; |
| 30 | 30 | $app->make( 'Provider' )->register( $app ); |
| 31 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
| 32 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
| 31 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
| 32 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
| 33 | 33 | $app->init(); |
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function handle( Command $command ) |
| 13 | 13 | { |
| 14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; |
|
| 14 | + if( in_array( $command->postType, get_post_types( ['_builtin' => true] ))) { |
|
| 15 | + return; |
|
| 16 | + } |
|
| 15 | 17 | register_post_type( $command->postType, $command->args ); |
| 16 | 18 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ |
| 17 | 19 | $command->postType => $command->columns, |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function handle( Command $command ) |
| 13 | 13 | { |
| 14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; |
|
| 14 | + if( in_array( $command->postType, get_post_types( ['_builtin' => true] ) ) )return; |
|
| 15 | 15 | register_post_type( $command->postType, $command->args ); |
| 16 | 16 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ |
| 17 | 17 | $command->postType => $command->columns, |
| 18 | - ]); |
|
| 18 | + ] ); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -57,7 +57,9 @@ |
||
| 57 | 57 | global $wp_query; |
| 58 | 58 | if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ) |
| 59 | 59 | || apply_filters( 'site-reviews/disable/filter/category', false ) |
| 60 | - )return; |
|
| 60 | + ) { |
|
| 61 | + return; |
|
| 62 | + } |
|
| 61 | 63 | printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' )); |
| 62 | 64 | $selected = isset( $wp_query->query[Application::TAXONOMY] ) |
| 63 | 65 | ? $wp_query->query[Application::TAXONOMY] |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | register_taxonomy_for_object_type( Application::TAXONOMY, Application::POST_TYPE ); |
| 17 | 17 | |
| 18 | 18 | add_action( Application::TAXONOMY.'_term_edit_form_top', [$this, 'disableParents'] ); |
| 19 | - add_action( Application::TAXONOMY.'_term_new_form_tag', [$this, 'disableParents'] ); |
|
| 20 | - add_action( Application::TAXONOMY.'_add_form_fields', [$this, 'enableParents'] ); |
|
| 21 | - add_action( Application::TAXONOMY.'_edit_form', [$this, 'enableParents'] ); |
|
| 22 | - add_action( 'restrict_manage_posts', [$this, 'renderTaxonomyFilter'], 9 ); |
|
| 19 | + add_action( Application::TAXONOMY.'_term_new_form_tag', [$this, 'disableParents'] ); |
|
| 20 | + add_action( Application::TAXONOMY.'_add_form_fields', [$this, 'enableParents'] ); |
|
| 21 | + add_action( Application::TAXONOMY.'_edit_form', [$this, 'enableParents'] ); |
|
| 22 | + add_action( 'restrict_manage_posts', [$this, 'renderTaxonomyFilter'], 9 ); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ) |
| 55 | 55 | || apply_filters( 'site-reviews/disable/filter/category', false ) |
| 56 | 56 | )return; |
| 57 | - printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' )); |
|
| 58 | - $selected = isset( $wp_query->query[Application::TAXONOMY] ) |
|
| 57 | + printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' ) ); |
|
| 58 | + $selected = isset($wp_query->query[Application::TAXONOMY]) |
|
| 59 | 59 | ? $wp_query->query[Application::TAXONOMY] |
| 60 | 60 | : ''; |
| 61 | 61 | $taxonomy = get_taxonomy( Application::TAXONOMY ); |
| 62 | 62 | $showOptionAll = $taxonomy |
| 63 | - ? ucfirst( strtolower( $taxonomy->labels->all_items )) |
|
| 63 | + ? ucfirst( strtolower( $taxonomy->labels->all_items ) ) |
|
| 64 | 64 | : ''; |
| 65 | - wp_dropdown_categories([ |
|
| 65 | + wp_dropdown_categories( [ |
|
| 66 | 66 | 'depth' => 3, |
| 67 | 67 | 'hide_empty' => true, |
| 68 | 68 | 'hide_if_empty' => true, |
@@ -74,6 +74,6 @@ discard block |
||
| 74 | 74 | 'show_option_all' => $showOptionAll, |
| 75 | 75 | 'taxonomy' => Application::TAXONOMY, |
| 76 | 76 | 'value_field' => 'slug', |
| 77 | - ]); |
|
| 77 | + ] ); |
|
| 78 | 78 | } |
| 79 | 79 | } |
@@ -19,7 +19,9 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function registerPostType() |
| 21 | 21 | { |
| 22 | - if( !glsr()->hasPermission() )return; |
|
| 22 | + if( !glsr()->hasPermission() ) { |
|
| 23 | + return; |
|
| 24 | + } |
|
| 23 | 25 | $command = new RegisterPostType([ |
| 24 | 26 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], |
| 25 | 27 | 'columns' => [ |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function registerPostType() |
| 21 | 21 | { |
| 22 | 22 | if( !glsr()->hasPermission() )return; |
| 23 | - $command = new RegisterPostType([ |
|
| 23 | + $command = new RegisterPostType( [ |
|
| 24 | 24 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], |
| 25 | 25 | 'columns' => [ |
| 26 | 26 | 'title' => '', |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | 'plural' => __( 'Reviews', 'site-reviews' ), |
| 39 | 39 | 'post_type' => Application::POST_TYPE, |
| 40 | 40 | 'single' => __( 'Review', 'site-reviews' ), |
| 41 | - ]); |
|
| 41 | + ] ); |
|
| 42 | 42 | $this->execute( $command ); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function registerShortcodes() |
| 50 | 50 | { |
| 51 | - $command = new RegisterShortcodes([ |
|
| 51 | + $command = new RegisterShortcodes( [ |
|
| 52 | 52 | 'site_reviews', |
| 53 | 53 | 'site_reviews_form', |
| 54 | 54 | 'site_reviews_summary', |
| 55 | - ]); |
|
| 55 | + ] ); |
|
| 56 | 56 | $this->execute( $command ); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function registerTaxonomy() |
| 64 | 64 | { |
| 65 | - $command = new RegisterTaxonomy([ |
|
| 65 | + $command = new RegisterTaxonomy( [ |
|
| 66 | 66 | 'hierarchical' => true, |
| 67 | 67 | 'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'], |
| 68 | 68 | 'public' => false, |
| 69 | 69 | 'show_admin_column' => true, |
| 70 | 70 | 'show_ui' => true, |
| 71 | - ]); |
|
| 71 | + ] ); |
|
| 72 | 72 | $this->execute( $command ); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function registerWidgets() |
| 80 | 80 | { |
| 81 | - $command = new RegisterWidgets([ |
|
| 81 | + $command = new RegisterWidgets( [ |
|
| 82 | 82 | 'site-reviews' => [ |
| 83 | 83 | 'class' => 'glsr-widget glsr-widget-site-reviews', |
| 84 | 84 | 'description' => __( 'Your site’s most recent reviews.', 'site-reviews' ), |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | 'description' => __( 'A summary of your site’s reviews.', 'site-reviews' ), |
| 95 | 95 | 'title' => __( 'Summary of Reviews', 'site-reviews' ), |
| 96 | 96 | ], |
| 97 | - ]); |
|
| 97 | + ] ); |
|
| 98 | 98 | $this->execute( $command ); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | global $menu, $typenow; |
| 22 | 22 | foreach( $menu as $key => $value ) { |
| 23 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 23 | + if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { |
|
| 24 | + continue; |
|
| 25 | + } |
|
| 24 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 25 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 26 | 28 | 'class' => 'pending-count', |
@@ -52,7 +54,9 @@ discard block |
||
| 52 | 54 | foreach( $pages as $slug => $title ) { |
| 53 | 55 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 54 | 56 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 55 | - if( !is_callable( $callback ))continue; |
|
| 57 | + if( !is_callable( $callback )) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 56 | 60 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
| 57 | 61 | } |
| 58 | 62 | } |
@@ -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' => __( 'Add-Ons', '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 | /** |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | 'schema' => __( 'Schema', 'site-reviews' ), |
| 103 | 103 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 104 | 104 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 105 | - ]); |
|
| 106 | - if( !apply_filters( 'site-reviews/addon/licenses', false )) { |
|
| 107 | - unset( $tabs['licenses'] ); |
|
| 105 | + ] ); |
|
| 106 | + if( !apply_filters( 'site-reviews/addon/licenses', false ) ) { |
|
| 107 | + unset($tabs['licenses']); |
|
| 108 | 108 | } |
| 109 | 109 | $this->renderPage( 'settings', [ |
| 110 | 110 | 'html' => glsr( Html::class ), |
| 111 | 111 | 'tabs' => $tabs, |
| 112 | - ]); |
|
| 112 | + ] ); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
| 124 | 124 | 'logging' => __( 'Logging', 'site-reviews' ), |
| 125 | 125 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 126 | - ]); |
|
| 126 | + ] ); |
|
| 127 | 127 | $this->renderPage( 'tools', [ |
| 128 | 128 | 'data' => [ |
| 129 | 129 | 'context' => [ |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | ], |
| 135 | 135 | 'html' => glsr( Html::class ), |
| 136 | 136 | 'tabs' => $tabs, |
| 137 | - ]); |
|
| 137 | + ] ); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -166,7 +166,9 @@ |
||
| 166 | 166 | { |
| 167 | 167 | $result = []; |
| 168 | 168 | foreach( $array as $key => $value ) { |
| 169 | - if( !$value )continue; |
|
| 169 | + if( !$value ) { |
|
| 170 | + continue; |
|
| 171 | + } |
|
| 170 | 172 | $result[$key] = is_array( $value ) |
| 171 | 173 | ? $this->removeEmptyArrayValues( $value ) |
| 172 | 174 | : $value; |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function buildClassName( $name, $path = '' ) |
| 16 | 16 | { |
| 17 | - $className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name )); |
|
| 17 | + $className = array_map( 'strtolower', (array)preg_split( '/[-_]/', $name ) ); |
|
| 18 | 18 | $className = array_map( 'ucfirst', $className ); |
| 19 | 19 | $className = implode( '', $className ); |
| 20 | 20 | $path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' ); |
| 21 | - return !empty( $path ) |
|
| 21 | + return !empty($path) |
|
| 22 | 22 | ? __NAMESPACE__.'\\'.$path.'\\'.$className |
| 23 | 23 | : $className; |
| 24 | 24 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function buildMethodName( $name, $prefix = '' ) |
| 32 | 32 | { |
| 33 | - return lcfirst( $prefix.$this->buildClassName( $name )); |
|
| 33 | + return lcfirst( $prefix.$this->buildClassName( $name ) ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function buildPropertyName( $name ) |
| 41 | 41 | { |
| 42 | - return lcfirst( $this->buildClassName( $name )); |
|
| 42 | + return lcfirst( $this->buildClassName( $name ) ); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function convertPathToId( $path, $prefix = '' ) |
| 72 | 72 | { |
| 73 | - return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix )); |
|
| 73 | + return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) ); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $levels = explode( '.', $path ); |
| 83 | 83 | return array_reduce( $levels, function( $result, $value ) { |
| 84 | - return $result.= '['.$value.']'; |
|
| 84 | + return $result .= '['.$value.']'; |
|
| 85 | 85 | }, $prefix ); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function dashCase( $string ) |
| 93 | 93 | { |
| 94 | - return str_replace( '_', '-', $this->snakeCase( $string )); |
|
| 94 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | $result = []; |
| 118 | 118 | foreach( $array as $key => $value ) { |
| 119 | 119 | $newKey = ltrim( $prefix.'.'.$key, '.' ); |
| 120 | - if( $this->isIndexedFlatArray( $value )) { |
|
| 120 | + if( $this->isIndexedFlatArray( $value ) ) { |
|
| 121 | 121 | if( $flattenValue ) { |
| 122 | 122 | $value = '['.implode( ', ', $value ).']'; |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | - else if( is_array( $value )) { |
|
| 126 | - $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey )); |
|
| 125 | + else if( is_array( $value ) ) { |
|
| 126 | + $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) ); |
|
| 127 | 127 | continue; |
| 128 | 128 | } |
| 129 | 129 | $result[$newKey] = $value; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | Whip::IPV4 => $cloudflareIps['v4'], |
| 143 | 143 | Whip::IPV6 => $cloudflareIps['v6'], |
| 144 | 144 | ], |
| 145 | - ]))->getValidIpAddress(); |
|
| 145 | + ] ))->getValidIpAddress(); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | $keys = explode( '.', $path ); |
| 157 | 157 | foreach( $keys as $key ) { |
| 158 | - if( !isset( $values[$key] )) { |
|
| 158 | + if( !isset($values[$key]) ) { |
|
| 159 | 159 | return $fallback; |
| 160 | 160 | } |
| 161 | 161 | $values = $values[$key]; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function isIndexedArray( $array ) |
| 171 | 171 | { |
| 172 | - if( !is_array( $array )) { |
|
| 172 | + if( !is_array( $array ) ) { |
|
| 173 | 173 | return false; |
| 174 | 174 | } |
| 175 | 175 | $current = 0; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function isIndexedFlatArray( $array ) |
| 190 | 190 | { |
| 191 | - if( !is_array( $array ) || array_filter( $array, 'is_array' )) { |
|
| 191 | + if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { |
|
| 192 | 192 | return false; |
| 193 | 193 | } |
| 194 | 194 | return $this->isIndexedArray( $array ); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function prefixString( $string, $prefix = '' ) |
| 203 | 203 | { |
| 204 | - return $prefix.str_replace( $prefix, '', trim( $string )); |
|
| 204 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public function snakeCase( $string ) |
| 249 | 249 | { |
| 250 | - if( !ctype_lower( $string )) { |
|
| 250 | + if( !ctype_lower( $string ) ) { |
|
| 251 | 251 | $string = preg_replace( '/\s+/u', '', $string ); |
| 252 | 252 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); |
| 253 | 253 | $string = mb_strtolower( $string, 'UTF-8' ); |
@@ -262,6 +262,6 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function startsWith( $needle, $haystack ) |
| 264 | 264 | { |
| 265 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
| 265 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
| 266 | 266 | } |
| 267 | 267 | } |
@@ -153,7 +153,9 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function scheduleCronJob() |
| 155 | 155 | { |
| 156 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 156 | + if( wp_next_scheduled( static::CRON_EVENT )) { |
|
| 157 | + return; |
|
| 158 | + } |
|
| 157 | 159 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 158 | 160 | } |
| 159 | 161 | |
@@ -184,7 +186,9 @@ discard block |
||
| 184 | 186 | || !in_array( plugin_basename( $this->file ), $data['plugins'] ) |
| 185 | 187 | || $data['action'] != 'update' |
| 186 | 188 | || $data['type'] != 'plugin' |
| 187 | - )return; |
|
| 189 | + ) { |
|
| 190 | + return; |
|
| 191 | + } |
|
| 188 | 192 | $this->upgrade(); |
| 189 | 193 | } |
| 190 | 194 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function getDefaults() |
| 68 | 68 | { |
| 69 | - if( empty( $this->defaults )) { |
|
| 69 | + if( empty($this->defaults) ) { |
|
| 70 | 70 | $this->defaults = $this->make( DefaultsManager::class )->get(); |
| 71 | 71 | $this->upgrade(); |
| 72 | 72 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function hasPermission() |
| 80 | 80 | { |
| 81 | 81 | $isAdmin = $this->isAdmin(); |
| 82 | - return !$isAdmin || ( $isAdmin && current_user_can( static::CAPABILITY )); |
|
| 82 | + return !$isAdmin || ($isAdmin && current_user_can( static::CAPABILITY )); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $types = apply_filters( 'site-reviews/addon/types', [] ); |
| 135 | 135 | $this->reviewTypes = wp_parse_args( $types, [ |
| 136 | 136 | 'local' => __( 'Local', 'site-reviews' ), |
| 137 | - ]); |
|
| 137 | + ] ); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -144,15 +144,15 @@ discard block |
||
| 144 | 144 | public function render( $view, array $data = [] ) |
| 145 | 145 | { |
| 146 | 146 | $file = ''; |
| 147 | - if( glsr( Helper::class )->startsWith( $view, 'templates/' )) { |
|
| 147 | + if( glsr( Helper::class )->startsWith( $view, 'templates/' ) ) { |
|
| 148 | 148 | $file = str_replace( 'templates/', 'site-reviews/', $view ).'.php'; |
| 149 | 149 | $file = get_stylesheet_directory().'/'.$file; |
| 150 | 150 | } |
| 151 | - if( !file_exists( $file )) { |
|
| 151 | + if( !file_exists( $file ) ) { |
|
| 152 | 152 | $file = $this->path( 'views/'.$view.'.php' ); |
| 153 | 153 | } |
| 154 | 154 | $file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data ); |
| 155 | - if( !file_exists( $file )) { |
|
| 155 | + if( !file_exists( $file ) ) { |
|
| 156 | 156 | glsr_log()->error( 'File not found: '.$file ); |
| 157 | 157 | return; |
| 158 | 158 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function scheduleCronJob() |
| 168 | 168 | { |
| 169 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
| 169 | + if( wp_next_scheduled( static::CRON_EVENT ) )return; |
|
| 170 | 170 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function unscheduleCronJob() |
| 177 | 177 | { |
| 178 | - wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT ); |
|
| 178 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -207,6 +207,6 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function url( $path = '' ) |
| 209 | 209 | { |
| 210 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
| 210 | + return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
| 211 | 211 | } |
| 212 | 212 | } |
@@ -76,7 +76,9 @@ discard block |
||
| 76 | 76 | $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
| 77 | 77 | array_walk( $args, function( &$value, $key ) { |
| 78 | 78 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 79 | - if( !method_exists( $this, $methodName ))return; |
|
| 79 | + if( !method_exists( $this, $methodName )) { |
|
| 80 | + return; |
|
| 81 | + } |
|
| 80 | 82 | $value = $this->$methodName( $value ); |
| 81 | 83 | }); |
| 82 | 84 | return $this->sanitize( $args ); |
@@ -141,7 +143,9 @@ discard block |
||
| 141 | 143 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
| 142 | 144 | $labels = array_map( 'trim', explode( ',', $labels )); |
| 143 | 145 | foreach( $defaults as $i => $label ) { |
| 144 | - if( empty( $labels[$i] ))continue; |
|
| 146 | + if( empty( $labels[$i] )) { |
|
| 147 | + continue; |
|
| 148 | + } |
|
| 145 | 149 | $defaults[$i] = $labels[$i]; |
| 146 | 150 | } |
| 147 | 151 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | 'after_widget' => '</div>', |
| 23 | 23 | 'before_title' => '<h3 class="glsr-shortcode-title">', |
| 24 | 24 | 'after_title' => '</h3>', |
| 25 | - ]); |
|
| 25 | + ] ); |
|
| 26 | 26 | $instance = $this->normalize( $instance ); |
| 27 | 27 | $partial = glsr( Html::class )->buildPartial( $shortcodePartial, $instance ); |
| 28 | - if( !empty( $instance['title'] )) { |
|
| 28 | + if( !empty($instance['title']) ) { |
|
| 29 | 29 | $instance['title'] = $args['before_title'].$instance['title'].$args['after_title']; |
| 30 | 30 | } |
| 31 | 31 | return $args['before_widget'].$instance['title'].$partial.$args['after_widget']; |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function normalize( $args ) |
| 70 | 70 | { |
| 71 | - $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
|
| 71 | + $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) ); |
|
| 72 | 72 | array_walk( $args, function( &$value, $key ) { |
| 73 | 73 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 74 | - if( !method_exists( $this, $methodName ))return; |
|
| 74 | + if( !method_exists( $this, $methodName ) )return; |
|
| 75 | 75 | $value = $this->$methodName( $value ); |
| 76 | 76 | }); |
| 77 | 77 | return $this->sanitize( $args ); |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function normalizeHide( $hide ) |
| 105 | 105 | { |
| 106 | - if( is_string( $hide )) { |
|
| 106 | + if( is_string( $hide ) ) { |
|
| 107 | 107 | $hide = explode( ',', $hide ); |
| 108 | 108 | } |
| 109 | 109 | $hiddenKeys = defined( 'static::HIDDEN_KEYS' ) |
| 110 | 110 | ? static::HIDDEN_KEYS |
| 111 | 111 | : []; |
| 112 | - return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hiddenKeys ) { |
|
| 112 | + return array_filter( array_map( 'trim', $hide ), function( $value ) use($hiddenKeys) { |
|
| 113 | 113 | return in_array( $value, $hiddenKeys ); |
| 114 | 114 | }); |
| 115 | 115 | } |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | __( 'Terrible', 'site-reviews' ), |
| 138 | 138 | ]; |
| 139 | 139 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
| 140 | - $labels = array_map( 'trim', explode( ',', $labels )); |
|
| 140 | + $labels = array_map( 'trim', explode( ',', $labels ) ); |
|
| 141 | 141 | foreach( $defaults as $i => $label ) { |
| 142 | - if( empty( $labels[$i] ))continue; |
|
| 142 | + if( empty($labels[$i]) )continue; |
|
| 143 | 143 | $defaults[$i] = $labels[$i]; |
| 144 | 144 | } |
| 145 | 145 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |
@@ -29,7 +29,9 @@ |
||
| 29 | 29 | { |
| 30 | 30 | foreach( $args as $key => $value ) { |
| 31 | 31 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
| 32 | - if( !property_exists( $this, $property ))continue; |
|
| 32 | + if( !property_exists( $this, $property )) { |
|
| 33 | + continue; |
|
| 34 | + } |
|
| 33 | 35 | $this->$property = $value; |
| 34 | 36 | unset( $args[$key] ); |
| 35 | 37 | } |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | foreach( $args as $key => $value ) { |
| 32 | 32 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
| 33 | - if( !property_exists( $this, $property ))continue; |
|
| 33 | + if( !property_exists( $this, $property ) )continue; |
|
| 34 | 34 | $this->$property = $value; |
| 35 | - unset( $args[$key] ); |
|
| 35 | + unset($args[$key]); |
|
| 36 | 36 | } |
| 37 | 37 | $this->args = wp_parse_args( $args, [ |
| 38 | 38 | 'menu_name' => $this->plural, |
| 39 | - ]); |
|
| 39 | + ] ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | 'singular_name' => $this->single, |
| 60 | 60 | 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), |
| 61 | 61 | 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), |
| 62 | - ]); |
|
| 63 | - unset( $this->args['menu_name'] ); |
|
| 62 | + ] ); |
|
| 63 | + unset($this->args['menu_name']); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | protected function normalizeColumns() |
| 70 | 70 | { |
| 71 | 71 | $this->columns = ['cb' => ''] + $this->columns; |
| 72 | - if( array_key_exists( 'category', $this->columns )) { |
|
| 72 | + if( array_key_exists( 'category', $this->columns ) ) { |
|
| 73 | 73 | $keys = array_keys( $this->columns ); |
| 74 | 74 | $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; |
| 75 | 75 | $this->columns = array_combine( $keys, $this->columns ); |
| 76 | 76 | } |
| 77 | - if( array_key_exists( 'pinned', $this->columns )) { |
|
| 77 | + if( array_key_exists( 'pinned', $this->columns ) ) { |
|
| 78 | 78 | $this->columns['pinned'] = glsr( Builder::class )->span( |
| 79 | 79 | '<span>'.$this->columns['pinned'].'</span>', |
| 80 | 80 | ['class' => 'pinned-icon'] |