@@ -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,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 |
@@ -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 | } |
@@ -15,7 +15,9 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function download( $filename, $content ) |
| 17 | 17 | { |
| 18 | - if( !current_user_can( Application::CAPABILITY ))return; |
|
| 18 | + if( !current_user_can( Application::CAPABILITY )) { |
|
| 19 | + return; |
|
| 20 | + } |
|
| 19 | 21 | nocache_headers(); |
| 20 | 22 | header( 'Content-Type: text/plain' ); |
| 21 | 23 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function download( $filename, $content ) |
| 17 | 17 | { |
| 18 | - if( !current_user_can( Application::CAPABILITY ))return; |
|
| 18 | + if( !current_user_can( Application::CAPABILITY ) )return; |
|
| 19 | 19 | nocache_headers(); |
| 20 | 20 | header( 'Content-Type: text/plain' ); |
| 21 | 21 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function execute( $command ) |
| 32 | 32 | { |
| 33 | - $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command )); |
|
| 34 | - if( !class_exists( $handlerClass )) { |
|
| 33 | + $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) ); |
|
| 34 | + if( !class_exists( $handlerClass ) ) { |
|
| 35 | 35 | throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' ); |
| 36 | 36 | } |
| 37 | 37 | try { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | catch( Exception $e ) { |
| 41 | 41 | status_header( 400 ); |
| 42 | - glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() )); |
|
| 42 | + glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) ); |
|
| 43 | 43 | glsr_log()->error( $e->getMessage() ); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -49,6 +49,6 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | protected function getPostId() |
| 51 | 51 | { |
| 52 | - return intval( filter_input( INPUT_GET, 'post' )); |
|
| 52 | + return intval( filter_input( INPUT_GET, 'post' ) ); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | { |
| 83 | 83 | $this->render()->div( glsr( Notice::class )->get(), [ |
| 84 | 84 | 'id' => 'glsr-notices', |
| 85 | - ]); |
|
| 85 | + ] ); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -130,8 +130,8 @@ |
||
| 130 | 130 | public function validateRequired( $attribute, $value ) |
| 131 | 131 | { |
| 132 | 132 | return is_null( $value ) |
| 133 | - || ( is_string( $value ) && trim( $value ) === '' ) |
|
| 134 | - || ( is_array( $value ) && count( $value ) < 1 ) |
|
| 133 | + || (is_string( $value ) && trim( $value ) === '') |
|
| 134 | + || (is_array( $value ) && count( $value ) < 1) |
|
| 135 | 135 | ? false |
| 136 | 136 | : true; |
| 137 | 137 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function build( $partialPath, array $args = [] ) |
| 14 | 14 | { |
| 15 | 15 | $className = glsr( Helper::class )->buildClassName( $partialPath, 'Modules\Html\Partials' ); |
| 16 | - if( !class_exists( $className )) { |
|
| 16 | + if( !class_exists( $className ) ) { |
|
| 17 | 17 | glsr_log()->error( 'Partial missing: '.$className ); |
| 18 | 18 | return; |
| 19 | 19 | } |