@@ -15,9 +15,13 @@ |
||
| 15 | 15 | ]; |
| 16 | 16 | foreach( $namespaces as $prefix => $base_dir ) { |
| 17 | 17 | $len = strlen( $prefix ); |
| 18 | - if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
|
| 18 | + if( strncmp( $prefix, $className, $len ) !== 0 ) { |
|
| 19 | + continue; |
|
| 20 | + } |
|
| 19 | 21 | $file = $base_dir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
| 20 | - if( !file_exists( $file ))continue; |
|
| 22 | + if( !file_exists( $file )) { |
|
| 23 | + continue; |
|
| 24 | + } |
|
| 21 | 25 | require $file; |
| 22 | 26 | break; |
| 23 | 27 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | defined( 'WPINC' ) || die; |
| 4 | 4 | |
| 5 | -require_once( ABSPATH.WPINC.'/class-phpass.php' ); |
|
| 5 | +require_once(ABSPATH.WPINC.'/class-phpass.php'); |
|
| 6 | 6 | |
| 7 | 7 | spl_autoload_register( function( $className ) { |
| 8 | 8 | $namespaces = [ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | foreach( $namespaces as $prefix => $base_dir ) { |
| 17 | 17 | $len = strlen( $prefix ); |
| 18 | 18 | if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
| 19 | - $file = $base_dir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
|
| 20 | - if( !file_exists( $file ))continue; |
|
| 19 | + $file = $base_dir.str_replace( '\\', '/', substr( $className, $len ) ).'.php'; |
|
| 20 | + if( !file_exists( $file ) )continue; |
|
| 21 | 21 | require $file; |
| 22 | 22 | break; |
| 23 | 23 | } |
@@ -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(); |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | [], |
| 28 | 28 | glsr()->version |
| 29 | 29 | ); |
| 30 | - if( !$this->isCurrentScreen() )return; |
|
| 30 | + if( !$this->isCurrentScreen() ) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 31 | 33 | wp_enqueue_script( |
| 32 | 34 | Application::ID, |
| 33 | 35 | glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ), |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | { |
| 87 | 89 | $variables = []; |
| 88 | 90 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
| 89 | - if( empty( $args['required'] ))continue; |
|
| 91 | + if( empty( $args['required'] )) { |
|
| 92 | + continue; |
|
| 93 | + } |
|
| 90 | 94 | $variables[$tag] = $args['required']; |
| 91 | 95 | } |
| 92 | 96 | return $variables; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $dependencies = []; //glsr( Html::class )->getDependencies(); |
| 63 | 63 | $dependencies = array_merge( $dependencies, [ |
| 64 | 64 | 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
| 65 | - ]); |
|
| 65 | + ] ); |
|
| 66 | 66 | return $dependencies; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | protected function isCurrentScreen() |
| 73 | 73 | { |
| 74 | 74 | $screen = glsr_current_screen(); |
| 75 | - return $screen && ( $screen->post_type == Application::POST_TYPE |
|
| 75 | + return $screen && ($screen->post_type == Application::POST_TYPE |
|
| 76 | 76 | || $screen->base == 'post' |
| 77 | 77 | || $screen->id == 'dashboard' |
| 78 | 78 | || $screen->id == 'widgets' |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | $variables = []; |
| 88 | 88 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
| 89 | - if( empty( $args['required'] ))continue; |
|
| 89 | + if( empty($args['required']) )continue; |
|
| 90 | 90 | $variables[$tag] = $args['required']; |
| 91 | 91 | } |
| 92 | 92 | return $variables; |
@@ -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 | } |
@@ -17,7 +17,9 @@ discard block |
||
| 17 | 17 | wp_localize_script( Application::ID, 'site_reviews_pointers', [ |
| 18 | 18 | 'pointers' => $pointers, |
| 19 | 19 | ]); |
| 20 | - if( empty( $pointers ))return; |
|
| 20 | + if( empty( $pointers )) { |
|
| 21 | + return; |
|
| 22 | + } |
|
| 21 | 23 | wp_enqueue_style( 'wp-pointer' ); |
| 22 | 24 | wp_enqueue_script( 'wp-pointer' ); |
| 23 | 25 | } |
@@ -31,8 +33,12 @@ discard block |
||
| 31 | 33 | $dismissedPointers = explode( ',', (string)$dismissedPointers ); |
| 32 | 34 | $generatedPointers = []; |
| 33 | 35 | foreach( $pointers as $pointer ) { |
| 34 | - if( $pointer['screen'] != glsr_current_screen()->id )continue; |
|
| 35 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
| 36 | + if( $pointer['screen'] != glsr_current_screen()->id ) { |
|
| 37 | + continue; |
|
| 38 | + } |
|
| 39 | + if( in_array( $pointer['id'], $dismissedPointers )) { |
|
| 40 | + continue; |
|
| 41 | + } |
|
| 36 | 42 | $generatedPointers[] = $this->generatePointer( $pointer ); |
| 37 | 43 | } |
| 38 | 44 | return $generatedPointers; |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $pointers = $this->generatePointers( $command->pointers ); |
| 17 | 17 | wp_localize_script( Application::ID, 'site_reviews_pointers', [ |
| 18 | 18 | 'pointers' => $pointers, |
| 19 | - ]); |
|
| 20 | - if( empty( $pointers ))return; |
|
| 19 | + ] ); |
|
| 20 | + if( empty($pointers) )return; |
|
| 21 | 21 | wp_enqueue_style( 'wp-pointer' ); |
| 22 | 22 | wp_enqueue_script( 'wp-pointer' ); |
| 23 | 23 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $generatedPointers = []; |
| 33 | 33 | foreach( $pointers as $pointer ) { |
| 34 | 34 | if( $pointer['screen'] != glsr_current_screen()->id )continue; |
| 35 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
| 35 | + if( in_array( $pointer['id'], $dismissedPointers ) )continue; |
|
| 36 | 36 | $generatedPointers[] = $this->generatePointer( $pointer ); |
| 37 | 37 | } |
| 38 | 38 | return $generatedPointers; |
@@ -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_categories_meta_box', |
| 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 | } |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | global $menu, $typenow; |
| 24 | 24 | foreach( $menu as $key => $value ) { |
| 25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 25 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
| 26 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
| 27 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
| 28 | 28 | 'class' => 'pending-count', |
| 29 | - ]); |
|
| 29 | + ] ); |
|
| 30 | 30 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
| 31 | 31 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
| 32 | - ]); |
|
| 32 | + ] ); |
|
| 33 | 33 | $menu[$key][0] .= ' '.$awaitingModeration; |
| 34 | 34 | if( $typenow === Application::POST_TYPE ) { |
| 35 | - $menu[$key][4].= ' current'; |
|
| 35 | + $menu[$key][4] .= ' current'; |
|
| 36 | 36 | } |
| 37 | 37 | break; |
| 38 | 38 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
| 50 | 50 | 'addons' => __( 'Add-Ons', 'site-reviews' ), |
| 51 | 51 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
| 52 | - ]); |
|
| 52 | + ] ); |
|
| 53 | 53 | foreach( $pages as $slug => $title ) { |
| 54 | 54 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
| 55 | 55 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
| 56 | - if( !is_callable( $callback ))continue; |
|
| 56 | + if( !is_callable( $callback ) )continue; |
|
| 57 | 57 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $this->renderPage( 'addons', [ |
| 69 | 69 | 'template' => glsr( Template::class ), |
| 70 | - ]); |
|
| 70 | + ] ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
| 84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
| 85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | $this->renderPage( 'documentation', [ |
| 88 | 88 | 'tabs' => $tabs, |
| 89 | - ]); |
|
| 89 | + ] ); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -103,15 +103,15 @@ discard block |
||
| 103 | 103 | 'schema' => __( 'Schema', 'site-reviews' ), |
| 104 | 104 | 'translations' => __( 'Translations', 'site-reviews' ), |
| 105 | 105 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
| 106 | - ]); |
|
| 107 | - if( !apply_filters( 'site-reviews/addon/licenses', false )) { |
|
| 108 | - unset( $tabs['licenses'] ); |
|
| 106 | + ] ); |
|
| 107 | + if( !apply_filters( 'site-reviews/addon/licenses', false ) ) { |
|
| 108 | + unset($tabs['licenses']); |
|
| 109 | 109 | } |
| 110 | 110 | $this->renderPage( 'settings', [ |
| 111 | 111 | 'form' => glsr( Form::class ), |
| 112 | 112 | 'html' => glsr( Html::class ), |
| 113 | 113 | 'tabs' => $tabs, |
| 114 | - ]); |
|
| 114 | + ] ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
| 126 | 126 | 'logging' => __( 'Logging', 'site-reviews' ), |
| 127 | 127 | 'system-info' => __( 'System Info', 'site-reviews' ), |
| 128 | - ]); |
|
| 128 | + ] ); |
|
| 129 | 129 | $this->renderPage( 'tools', [ |
| 130 | 130 | 'data' => [ |
| 131 | 131 | 'context' => [ |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | ], |
| 137 | 137 | 'html' => glsr( Html::class ), |
| 138 | 138 | 'tabs' => $tabs, |
| 139 | - ]); |
|
| 139 | + ] ); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -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 | /** |
@@ -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 | } |