@@ -15,8 +15,8 @@ |
||
15 | 15 | */ |
16 | 16 | protected function sanitize( array $args ) |
17 | 17 | { |
18 | - if( empty( $args['id'] )) { |
|
19 | - $args['id'] = substr( md5( serialize( $args )), 0, 8 ); |
|
18 | + if( empty($args['id']) ) { |
|
19 | + $args['id'] = substr( md5( serialize( $args ) ), 0, 8 ); |
|
20 | 20 | } |
21 | 21 | return $args; |
22 | 22 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | public function fields() |
13 | 13 | { |
14 | 14 | return [[ |
15 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )), |
|
15 | + 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ), |
|
16 | 16 | 'minWidth' => 320, |
17 | 17 | 'type' => 'container', |
18 | - ],[ |
|
18 | + ], [ |
|
19 | 19 | 'label' => esc_html__( 'Title', 'site-reviews' ), |
20 | 20 | 'name' => 'title', |
21 | 21 | 'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ), |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'name' => 'assigned_to', |
29 | 29 | 'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ), |
30 | 30 | 'type' => 'textbox', |
31 | - ],[ |
|
31 | + ], [ |
|
32 | 32 | 'label' => esc_html__( 'Schema', 'site-reviews' ), |
33 | 33 | 'name' => 'schema', |
34 | 34 | 'options' => [ |
@@ -37,34 +37,34 @@ discard block |
||
37 | 37 | ], |
38 | 38 | 'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ), |
39 | 39 | 'type' => 'listbox', |
40 | - ],[ |
|
40 | + ], [ |
|
41 | 41 | 'label' => esc_html__( 'Classes', 'site-reviews' ), |
42 | 42 | 'name' => 'class', |
43 | 43 | 'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
44 | 44 | 'type' => 'textbox', |
45 | - ],[ |
|
45 | + ], [ |
|
46 | 46 | 'columns' => 2, |
47 | 47 | 'items' => [[ |
48 | 48 | 'type' => 'checkbox', |
49 | 49 | 'name' => 'hide_bars', |
50 | 50 | 'text' => esc_html__( 'Bars', 'site-reviews' ), |
51 | 51 | 'tooltip' => esc_attr__( 'Hide the percentage bars?', 'site-reviews' ), |
52 | - ],[ |
|
52 | + ], [ |
|
53 | 53 | 'type' => 'checkbox', |
54 | 54 | 'name' => 'hide_if_empty', |
55 | 55 | 'text' => esc_html__( 'If Empty', 'site-reviews' ), |
56 | 56 | 'tooltip' => esc_attr__( 'Hide the summary if no reviews are found?', 'site-reviews' ), |
57 | - ],[ |
|
57 | + ], [ |
|
58 | 58 | 'type' => 'checkbox', |
59 | 59 | 'name' => 'hide_rating', |
60 | 60 | 'text' => esc_html__( 'Rating', 'site-reviews' ), |
61 | 61 | 'tooltip' => esc_attr__( 'Hide the rating?', 'site-reviews' ), |
62 | - ],[ |
|
62 | + ], [ |
|
63 | 63 | 'type' => 'checkbox', |
64 | 64 | 'name' => 'hide_stars', |
65 | 65 | 'text' => esc_html__( 'Stars', 'site-reviews' ), |
66 | 66 | 'tooltip' => esc_attr__( 'Hide the stars?', 'site-reviews' ), |
67 | - ],[ |
|
67 | + ], [ |
|
68 | 68 | 'type' => 'checkbox', |
69 | 69 | 'name' => 'hide_summary', |
70 | 70 | 'text' => esc_html__( 'Summary', 'site-reviews' ), |
@@ -14,14 +14,14 @@ |
||
14 | 14 | { |
15 | 15 | foreach( $command->shortcodes as $slug => $label ) { |
16 | 16 | $buttonClass = glsr( Helper::class )->buildClassName( $slug.'-button', 'Shortcodes' ); |
17 | - if( !class_exists( $buttonClass )) { |
|
18 | - glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass )); |
|
17 | + if( !class_exists( $buttonClass ) ) { |
|
18 | + glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ) ); |
|
19 | 19 | continue; |
20 | 20 | } |
21 | 21 | $shortcode = glsr( $buttonClass )->register( $slug, [ |
22 | 22 | 'label' => $label, |
23 | 23 | 'title' => $label, |
24 | - ]); |
|
24 | + ] ); |
|
25 | 25 | glsr()->mceShortcodes[$slug] = $shortcode->properties; |
26 | 26 | } |
27 | 27 | } |
@@ -14,8 +14,8 @@ |
||
14 | 14 | { |
15 | 15 | foreach( $command->shortcodes as $shortcode ) { |
16 | 16 | $shortcodeClass = glsr( Helper::class )->buildClassName( $shortcode.'-shortcode', 'Shortcodes' ); |
17 | - if( !class_exists( $shortcodeClass )) { |
|
18 | - glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass )); |
|
17 | + if( !class_exists( $shortcodeClass ) ) { |
|
18 | + glsr_log()->error( sprintf( 'Class missing (%s)', $shortcodeClass ) ); |
|
19 | 19 | continue; |
20 | 20 | } |
21 | 21 | add_shortcode( $shortcode, [glsr( $shortcodeClass ), 'buildShortcode'] ); |
@@ -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 | } |
@@ -16,8 +16,8 @@ |
||
16 | 16 | global $wp_widget_factory; |
17 | 17 | foreach( $command->widgets as $key => $values ) { |
18 | 18 | $widgetClass = glsr( Helper::class )->buildClassName( $key.'-widget', 'Widgets' ); |
19 | - if( !class_exists( $widgetClass )) { |
|
20 | - glsr_log()->error( sprintf( 'Class missing (%s)', $widgetClass )); |
|
19 | + if( !class_exists( $widgetClass ) ) { |
|
20 | + glsr_log()->error( sprintf( 'Class missing (%s)', $widgetClass ) ); |
|
21 | 21 | continue; |
22 | 22 | } |
23 | 23 | // Here we bypass register_widget() in order to pass our custom values to the widget |
@@ -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; |
@@ -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 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | public function handle( Command $command ) |
14 | 14 | { |
15 | - if( !get_post( $command->id )) { |
|
15 | + if( !get_post( $command->id ) ) { |
|
16 | 16 | return false; |
17 | 17 | } |
18 | - if( is_null( $command->pinned )) { |
|
18 | + if( is_null( $command->pinned ) ) { |
|
19 | 19 | $meta = get_post_meta( $command->id, 'pinned', true ); |
20 | 20 | $command->pinned = !wp_validate_boolean( $meta ); |
21 | 21 | } |