@@ -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, 'renderFilterTaxonomy'], 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, 'renderFilterTaxonomy'], 9 ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -58,15 +58,15 @@ discard block |
||
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 | 60 | )return; |
61 | - printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' )); |
|
62 | - $selected = isset( $wp_query->query[Application::TAXONOMY] ) |
|
61 | + printf( '<label class="screen-reader-text" for="%s">%s</label>', Application::TAXONOMY, __( 'Filter by category', 'site-reviews' ) ); |
|
62 | + $selected = isset($wp_query->query[Application::TAXONOMY]) |
|
63 | 63 | ? $wp_query->query[Application::TAXONOMY] |
64 | 64 | : ''; |
65 | 65 | $taxonomy = get_taxonomy( Application::TAXONOMY ); |
66 | 66 | $showOptionAll = $taxonomy |
67 | - ? ucfirst( strtolower( $taxonomy->labels->all_items )) |
|
67 | + ? ucfirst( strtolower( $taxonomy->labels->all_items ) ) |
|
68 | 68 | : ''; |
69 | - wp_dropdown_categories([ |
|
69 | + wp_dropdown_categories( [ |
|
70 | 70 | 'depth' => 3, |
71 | 71 | 'hide_empty' => true, |
72 | 72 | 'hide_if_empty' => true, |
@@ -78,6 +78,6 @@ discard block |
||
78 | 78 | 'show_option_all' => $showOptionAll, |
79 | 79 | 'taxonomy' => Application::TAXONOMY, |
80 | 80 | 'value_field' => 'slug', |
81 | - ]); |
|
81 | + ] ); |
|
82 | 82 | } |
83 | 83 | } |
@@ -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 |
@@ -109,7 +109,9 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function renderReviewEditor( WP_Post $post ) |
111 | 111 | { |
112 | - if( !$this->isReviewEditable( $post ) )return; |
|
112 | + if( !$this->isReviewEditable( $post ) ) { |
|
113 | + return; |
|
114 | + } |
|
113 | 115 | glsr()->render( 'editor/review', [ |
114 | 116 | 'post' => $post, |
115 | 117 | ]); |
@@ -121,7 +123,9 @@ discard block |
||
121 | 123 | */ |
122 | 124 | public function renderReviewNotice( WP_Post $post ) |
123 | 125 | { |
124 | - if( !$this->isReviewEditable( $post ) )return; |
|
126 | + if( !$this->isReviewEditable( $post ) ) { |
|
127 | + return; |
|
128 | + } |
|
125 | 129 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
126 | 130 | glsr()->render( 'editor/notice' ); |
127 | 131 | } |
@@ -132,13 +136,19 @@ discard block |
||
132 | 136 | */ |
133 | 137 | public function renderTinymceButton() |
134 | 138 | { |
135 | - if( glsr_current_screen()->base != 'post' )return; |
|
139 | + if( glsr_current_screen()->base != 'post' ) { |
|
140 | + return; |
|
141 | + } |
|
136 | 142 | $shortcodes = []; |
137 | 143 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
138 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
144 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) { |
|
145 | + continue; |
|
146 | + } |
|
139 | 147 | $shortcodes[$shortcode] = $values; |
140 | 148 | } |
141 | - if( empty( $shortcodes ))return; |
|
149 | + if( empty( $shortcodes )) { |
|
150 | + return; |
|
151 | + } |
|
142 | 152 | glsr()->render( 'editor/tinymce', [ |
143 | 153 | 'shortcodes' => $shortcodes, |
144 | 154 | ]); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $links[] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [ |
34 | 34 | 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ), |
35 | - ]); |
|
35 | + ] ); |
|
36 | 36 | return $links; |
37 | 37 | } |
38 | 38 | |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | { |
45 | 45 | $postType = Application::POST_TYPE; |
46 | 46 | $postCount = wp_count_posts( $postType ); |
47 | - if( !isset( $postCount->publish ) || !$postCount->publish ) { |
|
47 | + if( !isset($postCount->publish) || !$postCount->publish ) { |
|
48 | 48 | return $items; |
49 | 49 | } |
50 | 50 | $postTypeObject = get_post_type_object( $postType ); |
51 | 51 | $text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' ); |
52 | - $text = sprintf( $text, number_format_i18n( $postCount->publish )); |
|
52 | + $text = sprintf( $text, number_format_i18n( $postCount->publish ) ); |
|
53 | 53 | $items[] = $postTypeObject && current_user_can( $postTypeObject->cap->edit_posts ) |
54 | 54 | ? sprintf( '<a class="glsr-review-count" href="edit.php?post_type=%s">%s</a>', $postType, $text ) |
55 | 55 | : sprintf( '<span class="glsr-review-count">%s</span>', $text ); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function filterTinymcePlugins( array $plugins ) |
64 | 64 | { |
65 | 65 | if( user_can_richedit() |
66 | - && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) { |
|
66 | + && (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) { |
|
67 | 67 | $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' ); |
68 | 68 | } |
69 | 69 | return $plugins; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function registerPointers() |
77 | 77 | { |
78 | - $command = new RegisterPointers([[ |
|
78 | + $command = new RegisterPointers( [[ |
|
79 | 79 | 'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ), |
80 | 80 | 'id' => 'glsr-pointer-pinned', |
81 | 81 | 'position' => [ |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | 'screen' => Application::POST_TYPE, |
86 | 86 | 'target' => '#misc-pub-pinned', |
87 | 87 | 'title' => __( 'Pin Your Reviews', 'site-reviews' ), |
88 | - ]]); |
|
88 | + ]] ); |
|
89 | 89 | $this->execute( $command ); |
90 | 90 | } |
91 | 91 | |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function registerShortcodeButtons() |
97 | 97 | { |
98 | - $command = new RegisterShortcodeButtons([ |
|
98 | + $command = new RegisterShortcodeButtons( [ |
|
99 | 99 | 'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ), |
100 | 100 | 'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ), |
101 | 101 | 'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ), |
102 | - ]); |
|
102 | + ] ); |
|
103 | 103 | $this->execute( $command ); |
104 | 104 | } |
105 | 105 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if( !$this->isReviewEditable( $post ) )return; |
113 | 113 | glsr()->render( 'editor/review', [ |
114 | 114 | 'post' => $post, |
115 | - ]); |
|
115 | + ] ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | public function renderReviewNotice( WP_Post $post ) |
123 | 123 | { |
124 | 124 | if( !$this->isReviewEditable( $post ) )return; |
125 | - glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
|
125 | + glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) ); |
|
126 | 126 | glsr()->render( 'editor/notice' ); |
127 | 127 | } |
128 | 128 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | if( glsr_current_screen()->base != 'post' )return; |
136 | 136 | $shortcodes = []; |
137 | 137 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
138 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
138 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ) )continue; |
|
139 | 139 | $shortcodes[$shortcode] = $values; |
140 | 140 | } |
141 | - if( empty( $shortcodes ))return; |
|
141 | + if( empty($shortcodes) )return; |
|
142 | 142 | glsr()->render( 'editor/tinymce', [ |
143 | 143 | 'shortcodes' => $shortcodes, |
144 | - ]); |
|
144 | + ] ); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | public function routerClearLog() |
151 | 151 | { |
152 | 152 | glsr( Logger::class )->clear(); |
153 | - glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' )); |
|
153 | + glsr( Notice::class )->addSuccess( __( 'Log cleared.', 'site-reviews' ) ); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -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 | } |
@@ -20,14 +20,14 @@ 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 )continue; |
|
24 | 24 | $postCount = wp_count_posts( Application::POST_TYPE ); |
25 | 25 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
26 | 26 | 'class' => 'pending-count', |
27 | - ]); |
|
27 | + ] ); |
|
28 | 28 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
29 | 29 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
30 | - ]); |
|
30 | + ] ); |
|
31 | 31 | $menu[$key][0] .= $awaitingModeration; |
32 | 32 | if( $typenow === Application::POST_TYPE ) { |
33 | 33 | $menu[$key][4] .= ' current'; |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | 'tools' => __( 'Tools', 'site-reviews' ), |
49 | 49 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
50 | 50 | 'addons' => __( 'Add-Ons', '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 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
85 | 85 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
86 | 86 | 'functions' => __( 'Functions', 'site-reviews' ), |
87 | - ]); |
|
87 | + ] ); |
|
88 | 88 | $this->renderMenu( 'documentation', $tabs ); |
89 | 89 | } |
90 | 90 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | 'schema' => __( 'Schema', 'site-reviews' ), |
104 | 104 | 'translations' => __( 'Translations', 'site-reviews' ), |
105 | 105 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
106 | - ]); |
|
106 | + ] ); |
|
107 | 107 | $this->renderMenu( 'settings', $tabs, [ |
108 | 108 | 'databaseKey' => OptionManager::databaseKey(), |
109 | 109 | 'settings' => glsr()->getDefaults(), |
110 | - ]); |
|
110 | + ] ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
123 | 123 | 'logging' => __( 'Logging', 'site-reviews' ), |
124 | 124 | 'system-info' => __( 'System Info', 'site-reviews' ), |
125 | - ]); |
|
125 | + ] ); |
|
126 | 126 | $this->renderMenu( 'tools', $tabs, [ |
127 | 127 | 'id' => Application::ID, |
128 | 128 | 'logger' => glsr( Logger::class ), |
129 | 129 | 'prefix' => Application::PREFIX, |
130 | 130 | 'system' => glsr( System::class ), |
131 | - ]); |
|
131 | + ] ); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | protected function getCurrentSection( array $tabs, $tab ) |
150 | 150 | { |
151 | 151 | $currentSection = filter_input( INPUT_GET, 'section' ); |
152 | - if( empty( $tabs[$tab]['sections'][$currentSection] )) { |
|
153 | - $currentSection = isset( $tabs[$tab]['sections'] ) |
|
152 | + if( empty($tabs[$tab]['sections'][$currentSection]) ) { |
|
153 | + $currentSection = isset($tabs[$tab]['sections']) |
|
154 | 154 | ? key( $tabs[$tab]['sections'] ) |
155 | 155 | : ''; |
156 | 156 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | protected function getCurrentTab( array $tabs ) |
164 | 164 | { |
165 | 165 | $currentTab = filter_input( INPUT_GET, 'tab' ); |
166 | - if( !array_key_exists( $currentTab, $tabs )) { |
|
166 | + if( !array_key_exists( $currentTab, $tabs ) ) { |
|
167 | 167 | $currentTab = key( $tabs ); |
168 | 168 | } |
169 | 169 | return $currentTab; |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | protected function normalizeTabs( array $tabs ) |
176 | 176 | { |
177 | 177 | foreach( $tabs as $key => $value ) { |
178 | - if( !is_array( $value )) { |
|
178 | + if( !is_array( $value ) ) { |
|
179 | 179 | $value = ['title' => $value]; |
180 | 180 | } |
181 | 181 | $tabs[$key] = wp_parse_args( $value, [ |
182 | 182 | 'sections' => [], |
183 | 183 | 'title' => '', |
184 | - ]); |
|
184 | + ] ); |
|
185 | 185 | $useLicenses = apply_filters( 'site-reviews/addon/licenses', false ); |
186 | 186 | if( !$useLicenses ) { |
187 | - unset( $tabs['licenses'] ); |
|
187 | + unset($tabs['licenses']); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | return $tabs; |
@@ -206,6 +206,6 @@ discard block |
||
206 | 206 | 'tabs' => $tabs, |
207 | 207 | ]; |
208 | 208 | $data = apply_filters( 'site-reviews/addon/page/data', $data, $defaults ); |
209 | - glsr()->render( 'pages/index', wp_parse_args( $data, $defaults )); |
|
209 | + glsr()->render( 'pages/index', wp_parse_args( $data, $defaults ) ); |
|
210 | 210 | } |
211 | 211 | } |