@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @return string |
| 52 | 52 | */ |
| 53 | - public function render(array $attributes) |
|
| 53 | + public function render( array $attributes ) |
|
| 54 | 54 | { |
| 55 | 55 | $attributes['class'] = $attributes['className']; |
| 56 | - $shortcode = glsr(Shortcode::class); |
|
| 57 | - if ('edit' == filter_input(INPUT_GET, 'context')) { |
|
| 58 | - $attributes = $this->normalize($attributes); |
|
| 56 | + $shortcode = glsr( Shortcode::class ); |
|
| 57 | + if( 'edit' == filter_input( INPUT_GET, 'context' ) ) { |
|
| 58 | + $attributes = $this->normalize( $attributes ); |
|
| 59 | 59 | $this->filterShortcodeClass(); |
| 60 | - if (!$this->hasVisibleFields($shortcode, $attributes)) { |
|
| 60 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
| 61 | 61 | $this->filterInterpolation(); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - return $shortcode->buildShortcode($attributes); |
|
| 64 | + return $shortcode->buildShortcode( $attributes ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | protected function filterInterpolation() |
| 71 | 71 | { |
| 72 | - add_filter('site-reviews/interpolate/reviews-summary', function ($context) { |
|
| 72 | + add_filter( 'site-reviews/interpolate/reviews-summary', function( $context ) { |
|
| 73 | 73 | $context['class'] = 'glsr-default glsr-block-disabled'; |
| 74 | - $context['text'] = __('You have hidden all of the fields for this block.', 'site-reviews'); |
|
| 74 | + $context['text'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' ); |
|
| 75 | 75 | return $context; |
| 76 | 76 | }); |
| 77 | 77 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | protected function filterShortcodeClass() |
| 83 | 83 | { |
| 84 | - add_filter('site-reviews/style', function () { |
|
| 84 | + add_filter( 'site-reviews/style', function() { |
|
| 85 | 85 | return 'default'; |
| 86 | 86 | }); |
| 87 | 87 | } |
@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - public function render(array $attributes) |
|
| 41 | + public function render( array $attributes ) |
|
| 42 | 42 | { |
| 43 | 43 | $attributes['class'] = $attributes['className']; |
| 44 | - $shortcode = glsr(Shortcode::class); |
|
| 45 | - if ('edit' == filter_input(INPUT_GET, 'context')) { |
|
| 44 | + $shortcode = glsr( Shortcode::class ); |
|
| 45 | + if( 'edit' == filter_input( INPUT_GET, 'context' ) ) { |
|
| 46 | 46 | $this->filterFormFields(); |
| 47 | 47 | $this->filterRatingField(); |
| 48 | 48 | $this->filterShortcodeClass(); |
| 49 | 49 | $this->filterSubmitButton(); |
| 50 | - if (!$this->hasVisibleFields($shortcode, $attributes)) { |
|
| 50 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
| 51 | 51 | $this->filterInterpolation(); |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | - return $shortcode->buildShortcode($attributes); |
|
| 54 | + return $shortcode->buildShortcode( $attributes ); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected function filterFormFields() |
| 61 | 61 | { |
| 62 | - add_filter('site-reviews/config/forms/submission-form', function (array $config) { |
|
| 63 | - array_walk($config, function (&$field) { |
|
| 62 | + add_filter( 'site-reviews/config/forms/submission-form', function( array $config ) { |
|
| 63 | + array_walk( $config, function( &$field ) { |
|
| 64 | 64 | $field['disabled'] = true; |
| 65 | 65 | $field['tabindex'] = '-1'; |
| 66 | 66 | }); |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | protected function filterInterpolation() |
| 75 | 75 | { |
| 76 | - add_filter('site-reviews/interpolate/reviews-form', function ($context) { |
|
| 76 | + add_filter( 'site-reviews/interpolate/reviews-form', function( $context ) { |
|
| 77 | 77 | $context['class'] = 'glsr-default glsr-block-disabled'; |
| 78 | - $context['fields'] = __('You have hidden all of the fields for this block.', 'site-reviews'); |
|
| 78 | + $context['fields'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' ); |
|
| 79 | 79 | $context['response'] = ''; |
| 80 | 80 | $context['submit_button'] = ''; |
| 81 | 81 | return $context; |
@@ -87,15 +87,15 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected function filterRatingField() |
| 89 | 89 | { |
| 90 | - add_filter('site-reviews/rendered/field', function ($html, $type, $args) { |
|
| 91 | - if ('rating' == $args['path']) { |
|
| 90 | + add_filter( 'site-reviews/rendered/field', function( $html, $type, $args ) { |
|
| 91 | + if( 'rating' == $args['path'] ) { |
|
| 92 | 92 | $stars = '<span class="glsr-stars">'; |
| 93 | - $stars.= str_repeat('<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5); |
|
| 94 | - $stars.= '</span>'; |
|
| 95 | - $html = preg_replace('/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html); |
|
| 93 | + $stars .= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5 ); |
|
| 94 | + $stars .= '</span>'; |
|
| 95 | + $html = preg_replace( '/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html ); |
|
| 96 | 96 | } |
| 97 | 97 | return $html; |
| 98 | - }, 10, 3); |
|
| 98 | + }, 10, 3 ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function filterShortcodeClass() |
| 105 | 105 | { |
| 106 | - add_filter('site-reviews/style', function () { |
|
| 106 | + add_filter( 'site-reviews/style', function() { |
|
| 107 | 107 | return 'default'; |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | protected function filterSubmitButton() |
| 115 | 115 | { |
| 116 | - add_filter('site-reviews/rendered/template/form/submit-button', function ($template) { |
|
| 117 | - return str_replace('type="submit"', 'tabindex="-1"', $template); |
|
| 116 | + add_filter( 'site-reviews/rendered/template/form/submit-button', function( $template ) { |
|
| 117 | + return str_replace( 'type="submit"', 'tabindex="-1"', $template ); |
|
| 118 | 118 | }); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -17,18 +17,18 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @return array |
| 19 | 19 | */ |
| 20 | - public function normalize(array $attributes) |
|
| 20 | + public function normalize( array $attributes ) |
|
| 21 | 21 | { |
| 22 | - $hide = array_flip(explode(',', $attributes['hide'])); |
|
| 22 | + $hide = array_flip( explode( ',', $attributes['hide'] ) ); |
|
| 23 | 23 | unset($hide['if_empty']); |
| 24 | - $attributes['hide'] = implode(',', array_keys($hide)); |
|
| 25 | - if (!isset($attributes['assigned_to'])) { |
|
| 24 | + $attributes['hide'] = implode( ',', array_keys( $hide ) ); |
|
| 25 | + if( !isset($attributes['assigned_to']) ) { |
|
| 26 | 26 | return $attributes; |
| 27 | 27 | } |
| 28 | - if ('post_id' == $attributes['assigned_to']) { |
|
| 28 | + if( 'post_id' == $attributes['assigned_to'] ) { |
|
| 29 | 29 | $attributes['assigned_to'] = $attributes['post_id']; |
| 30 | - } elseif ('parent_id' == $attributes['assigned_to']) { |
|
| 31 | - $attributes['assigned_to'] = wp_get_post_parent_id($attributes['post_id']); |
|
| 30 | + } elseif( 'parent_id' == $attributes['assigned_to'] ) { |
|
| 31 | + $attributes['assigned_to'] = wp_get_post_parent_id( $attributes['post_id'] ); |
|
| 32 | 32 | } |
| 33 | 33 | return $attributes; |
| 34 | 34 | } |
@@ -36,35 +36,35 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | - public function register($block) |
|
| 39 | + public function register( $block ) |
|
| 40 | 40 | { |
| 41 | - if (!function_exists('register_block_type')) { |
|
| 41 | + if( !function_exists( 'register_block_type' ) ) { |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | - register_block_type(Application::ID.'/'.$block, [ |
|
| 44 | + register_block_type( Application::ID.'/'.$block, [ |
|
| 45 | 45 | 'attributes' => $this->attributes(), |
| 46 | 46 | 'editor_script' => Application::ID.'/blocks', |
| 47 | 47 | 'editor_style' => Application::ID.'/blocks', |
| 48 | 48 | 'render_callback' => [$this, 'render'], |
| 49 | 49 | 'style' => Application::ID, |
| 50 | - ]); |
|
| 50 | + ] ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
| 56 | - abstract public function render(array $attributes); |
|
| 56 | + abstract public function render( array $attributes ); |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param mixed $shortcode |
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
| 62 | - protected function hasVisibleFields($shortcode, array $attributes) |
|
| 62 | + protected function hasVisibleFields( $shortcode, array $attributes ) |
|
| 63 | 63 | { |
| 64 | - $args = $shortcode->normalizeAtts($attributes); |
|
| 64 | + $args = $shortcode->normalizeAtts( $attributes ); |
|
| 65 | 65 | $defaults = $shortcode->getHideOptions(); |
| 66 | - $hide = array_flip($args['hide']); |
|
| 66 | + $hide = array_flip( $args['hide'] ); |
|
| 67 | 67 | unset($defaults['if_empty'], $hide['if_empty']); |
| 68 | - return !empty(array_diff_key($defaults, $hide)); |
|
| 68 | + return !empty(array_diff_key( $defaults, $hide )); |
|
| 69 | 69 | } |
| 70 | 70 | } |
@@ -62,21 +62,21 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public function render(array $attributes) |
|
| 65 | + public function render( array $attributes ) |
|
| 66 | 66 | { |
| 67 | 67 | $attributes['class'] = $attributes['className']; |
| 68 | - $shortcode = glsr(Shortcode::class); |
|
| 69 | - if ('edit' == filter_input(INPUT_GET, 'context')) { |
|
| 70 | - $attributes = $this->normalize($attributes); |
|
| 68 | + $shortcode = glsr( Shortcode::class ); |
|
| 69 | + if( 'edit' == filter_input( INPUT_GET, 'context' ) ) { |
|
| 70 | + $attributes = $this->normalize( $attributes ); |
|
| 71 | 71 | $this->filterReviewLinks(); |
| 72 | 72 | $this->filterShortcodeClass(); |
| 73 | - $this->filterShowMoreLinks('content'); |
|
| 74 | - $this->filterShowMoreLinks('response'); |
|
| 75 | - if (!$this->hasVisibleFields($shortcode, $attributes)) { |
|
| 73 | + $this->filterShowMoreLinks( 'content' ); |
|
| 74 | + $this->filterShowMoreLinks( 'response' ); |
|
| 75 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
| 76 | 76 | $this->filterInterpolation(); |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | - return $shortcode->buildShortcode($attributes); |
|
| 79 | + return $shortcode->buildShortcode( $attributes ); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function filterInterpolation() |
| 86 | 86 | { |
| 87 | - add_filter('site-reviews/interpolate/reviews', function ($context) { |
|
| 87 | + add_filter( 'site-reviews/interpolate/reviews', function( $context ) { |
|
| 88 | 88 | $context['class'] = 'glsr-default glsr-block-disabled'; |
| 89 | - $context['reviews'] = __('You have hidden all of the fields for this block.', 'site-reviews'); |
|
| 89 | + $context['reviews'] = __( 'You have hidden all of the fields for this block.', 'site-reviews' ); |
|
| 90 | 90 | return $context; |
| 91 | 91 | }); |
| 92 | 92 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected function filterReviewLinks() |
| 98 | 98 | { |
| 99 | - add_filter('site-reviews/rendered/template/reviews', function ($template) { |
|
| 100 | - return str_replace('<a', '<a tabindex="-1"', $template); |
|
| 99 | + add_filter( 'site-reviews/rendered/template/reviews', function( $template ) { |
|
| 100 | + return str_replace( '<a', '<a tabindex="-1"', $template ); |
|
| 101 | 101 | }); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | protected function filterShortcodeClass() |
| 108 | 108 | { |
| 109 | - add_filter('site-reviews/style', function () { |
|
| 109 | + add_filter( 'site-reviews/style', function() { |
|
| 110 | 110 | return 'default'; |
| 111 | 111 | }); |
| 112 | 112 | } |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | * @param string $field |
| 116 | 116 | * @return void |
| 117 | 117 | */ |
| 118 | - protected function filterShowMoreLinks($field) |
|
| 118 | + protected function filterShowMoreLinks( $field ) |
|
| 119 | 119 | { |
| 120 | - add_filter('site-reviews/review/wrap/'.$field, function ($value) { |
|
| 120 | + add_filter( 'site-reviews/review/wrap/'.$field, function( $value ) { |
|
| 121 | 121 | $value = preg_replace( |
| 122 | 122 | '/(.*)(<span class="glsr-hidden)(.*)(<\/span>)(.*)/s', |
| 123 | - '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__('Show more', 'site-reviews').'</a>$5', |
|
| 123 | + '$1... <a href="#" class="glsr-read-more" tabindex="-1">'.__( 'Show more', 'site-reviews' ).'</a>$5', |
|
| 124 | 124 | $value |
| 125 | 125 | ); |
| 126 | 126 | return $value; |
@@ -12,48 +12,48 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | protected $widgetArgs; |
| 14 | 14 | |
| 15 | - public function __construct($idBase, $name, $values) |
|
| 15 | + public function __construct( $idBase, $name, $values ) |
|
| 16 | 16 | { |
| 17 | 17 | $controlOptions = $widgetOptions = []; |
| 18 | - if (isset($values['class'])) { |
|
| 18 | + if( isset($values['class']) ) { |
|
| 19 | 19 | $widgetOptions['classname'] = $values['class']; |
| 20 | 20 | } |
| 21 | - if (isset($values['description'])) { |
|
| 21 | + if( isset($values['description']) ) { |
|
| 22 | 22 | $widgetOptions['description'] = $values['description']; |
| 23 | 23 | } |
| 24 | - if (isset($values['width'])) { |
|
| 24 | + if( isset($values['width']) ) { |
|
| 25 | 25 | $controlOptions['width'] = $values['width']; |
| 26 | 26 | } |
| 27 | - parent::__construct($idBase, $name, $widgetOptions, $controlOptions); |
|
| 27 | + parent::__construct( $idBase, $name, $widgetOptions, $controlOptions ); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @param string $tag |
| 32 | 32 | * @return void |
| 33 | 33 | */ |
| 34 | - protected function renderField($tag, array $args = []) |
|
| 34 | + protected function renderField( $tag, array $args = [] ) |
|
| 35 | 35 | { |
| 36 | - $args = $this->normalizeFieldAttributes($tag, $args); |
|
| 37 | - $field = glsr(Builder::class)->{$tag}($args['name'], $args); |
|
| 38 | - echo glsr(Builder::class)->div($field, [ |
|
| 36 | + $args = $this->normalizeFieldAttributes( $tag, $args ); |
|
| 37 | + $field = glsr( Builder::class )->{$tag}($args['name'], $args); |
|
| 38 | + echo glsr( Builder::class )->div( $field, [ |
|
| 39 | 39 | 'class' => 'glsr-field', |
| 40 | - ]); |
|
| 40 | + ] ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @param string $tag |
| 45 | 45 | * @return array |
| 46 | 46 | */ |
| 47 | - protected function normalizeFieldAttributes($tag, array $args) |
|
| 47 | + protected function normalizeFieldAttributes( $tag, array $args ) |
|
| 48 | 48 | { |
| 49 | - if (empty($args['value'])) { |
|
| 49 | + if( empty($args['value']) ) { |
|
| 50 | 50 | $args['value'] = $this->widgetArgs[$args['name']]; |
| 51 | 51 | } |
| 52 | - if (empty($this->widgetArgs['options']) && in_array($tag, ['checkbox', 'radio'])) { |
|
| 53 | - $args['checked'] = in_array($args['value'], (array) $this->widgetArgs[$args['name']]); |
|
| 52 | + if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) { |
|
| 53 | + $args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] ); |
|
| 54 | 54 | } |
| 55 | - $args['id'] = $this->get_field_id($args['name']); |
|
| 56 | - $args['name'] = $this->get_field_name($args['name']); |
|
| 55 | + $args['id'] = $this->get_field_id( $args['name'] ); |
|
| 56 | + $args['name'] = $this->get_field_name( $args['name'] ); |
|
| 57 | 57 | $args['is_widget'] = true; |
| 58 | 58 | return $args; |
| 59 | 59 | } |
@@ -11,17 +11,17 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * @return void |
| 13 | 13 | */ |
| 14 | - public function handle(Command $command) |
|
| 14 | + public function handle( Command $command ) |
|
| 15 | 15 | { |
| 16 | 16 | global $wp_widget_factory; |
| 17 | - foreach ($command->widgets as $key => $values) { |
|
| 18 | - $widgetClass = glsr(Helper::class)->buildClassName($key.'-widget', 'Widgets'); |
|
| 19 | - if (!class_exists($widgetClass)) { |
|
| 20 | - glsr_log()->error(sprintf('Class missing (%s)', $widgetClass)); |
|
| 17 | + foreach( $command->widgets as $key => $values ) { |
|
| 18 | + $widgetClass = glsr( Helper::class )->buildClassName( $key.'-widget', 'Widgets' ); |
|
| 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 |
| 24 | - $widget = new $widgetClass(Application::ID.'_'.$key, $values['title'], $values); |
|
| 24 | + $widget = new $widgetClass( Application::ID.'_'.$key, $values['title'], $values ); |
|
| 25 | 25 | $wp_widget_factory->widgets[$widgetClass] = $widget; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -10,18 +10,18 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * @return void |
| 12 | 12 | */ |
| 13 | - public function handle(Command $command) |
|
| 13 | + public function handle( Command $command ) |
|
| 14 | 14 | { |
| 15 | - foreach ($command->popups as $slug => $label) { |
|
| 16 | - $buttonClass = glsr(Helper::class)->buildClassName($slug.'-popup', 'Shortcodes'); |
|
| 17 | - if (!class_exists($buttonClass)) { |
|
| 18 | - glsr_log()->error(sprintf('Class missing (%s)', $buttonClass)); |
|
| 15 | + foreach( $command->popups as $slug => $label ) { |
|
| 16 | + $buttonClass = glsr( Helper::class )->buildClassName( $slug.'-popup', 'Shortcodes' ); |
|
| 17 | + if( !class_exists( $buttonClass ) ) { |
|
| 18 | + glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ) ); |
|
| 19 | 19 | continue; |
| 20 | 20 | } |
| 21 | - $shortcode = glsr($buttonClass)->register($slug, [ |
|
| 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 | } |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | /** |
| 11 | 11 | * @return void |
| 12 | 12 | */ |
| 13 | - public function handle(Command $command) |
|
| 13 | + public function handle( Command $command ) |
|
| 14 | 14 | { |
| 15 | - register_taxonomy(Application::TAXONOMY, Application::POST_TYPE, $command->args); |
|
| 16 | - register_taxonomy_for_object_type(Application::TAXONOMY, Application::POST_TYPE); |
|
| 15 | + register_taxonomy( Application::TAXONOMY, Application::POST_TYPE, $command->args ); |
|
| 16 | + register_taxonomy_for_object_type( Application::TAXONOMY, Application::POST_TYPE ); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * @return void |
| 20 | 20 | */ |
| 21 | - public function handle(Command $command) |
|
| 21 | + public function handle( Command $command ) |
|
| 22 | 22 | { |
| 23 | - $this->generatePointers($command->pointers); |
|
| 23 | + $this->generatePointers( $command->pointers ); |
|
| 24 | 24 | $this->enqueueAssets(); |
| 25 | 25 | $this->localizeAssets(); |
| 26 | 26 | } |
@@ -32,23 +32,23 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | wp_enqueue_style( |
| 34 | 34 | Application::ID, |
| 35 | - glsr()->url('assets/styles/'.Application::ID.'-admin.css'), |
|
| 35 | + glsr()->url( 'assets/styles/'.Application::ID.'-admin.css' ), |
|
| 36 | 36 | [], |
| 37 | 37 | glsr()->version |
| 38 | 38 | ); |
| 39 | - if (!$this->isCurrentScreen()) { |
|
| 39 | + if( !$this->isCurrentScreen() ) { |
|
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | wp_enqueue_script( |
| 43 | 43 | Application::ID, |
| 44 | - glsr()->url('assets/scripts/'.Application::ID.'-admin.js'), |
|
| 44 | + glsr()->url( 'assets/scripts/'.Application::ID.'-admin.js' ), |
|
| 45 | 45 | $this->getDependencies(), |
| 46 | 46 | glsr()->version, |
| 47 | 47 | true |
| 48 | 48 | ); |
| 49 | - if (!empty($this->pointers)) { |
|
| 50 | - wp_enqueue_style('wp-pointer'); |
|
| 51 | - wp_enqueue_script('wp-pointer'); |
|
| 49 | + if( !empty($this->pointers) ) { |
|
| 50 | + wp_enqueue_style( 'wp-pointer' ); |
|
| 51 | + wp_enqueue_script( 'wp-pointer' ); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -60,33 +60,33 @@ discard block |
||
| 60 | 60 | $variables = [ |
| 61 | 61 | 'action' => Application::PREFIX.'action', |
| 62 | 62 | 'addons' => [], |
| 63 | - 'ajaxurl' => admin_url('admin-ajax.php'), |
|
| 63 | + 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
|
| 64 | 64 | 'hideoptions' => [ |
| 65 | - 'site_reviews' => glsr(SiteReviewsShortcode::class)->getHideOptions(), |
|
| 66 | - 'site_reviews_form' => glsr(SiteReviewsFormShortcode::class)->getHideOptions(), |
|
| 67 | - 'site_reviews_summary' => glsr(SiteReviewsSummaryShortcode::class)->getHideOptions(), |
|
| 65 | + 'site_reviews' => glsr( SiteReviewsShortcode::class )->getHideOptions(), |
|
| 66 | + 'site_reviews_form' => glsr( SiteReviewsFormShortcode::class )->getHideOptions(), |
|
| 67 | + 'site_reviews_summary' => glsr( SiteReviewsSummaryShortcode::class )->getHideOptions(), |
|
| 68 | 68 | ], |
| 69 | 69 | 'nameprefix' => Application::ID, |
| 70 | 70 | 'nonce' => [ |
| 71 | - 'change-status' => wp_create_nonce('change-status'), |
|
| 72 | - 'clear-console' => wp_create_nonce('clear-console'), |
|
| 73 | - 'count-reviews' => wp_create_nonce('count-reviews'), |
|
| 74 | - 'fetch-console' => wp_create_nonce('fetch-console'), |
|
| 75 | - 'mce-shortcode' => wp_create_nonce('mce-shortcode'), |
|
| 76 | - 'sync-reviews' => wp_create_nonce('sync-reviews'), |
|
| 77 | - 'toggle-pinned' => wp_create_nonce('toggle-pinned'), |
|
| 71 | + 'change-status' => wp_create_nonce( 'change-status' ), |
|
| 72 | + 'clear-console' => wp_create_nonce( 'clear-console' ), |
|
| 73 | + 'count-reviews' => wp_create_nonce( 'count-reviews' ), |
|
| 74 | + 'fetch-console' => wp_create_nonce( 'fetch-console' ), |
|
| 75 | + 'mce-shortcode' => wp_create_nonce( 'mce-shortcode' ), |
|
| 76 | + 'sync-reviews' => wp_create_nonce( 'sync-reviews' ), |
|
| 77 | + 'toggle-pinned' => wp_create_nonce( 'toggle-pinned' ), |
|
| 78 | 78 | ], |
| 79 | 79 | 'pointers' => $this->pointers, |
| 80 | 80 | 'shortcodes' => [], |
| 81 | 81 | 'tinymce' => [ |
| 82 | - 'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'), |
|
| 82 | + 'glsr_shortcode' => glsr()->url( 'assets/scripts/mce-plugin.js' ), |
|
| 83 | 83 | ], |
| 84 | 84 | ]; |
| 85 | - if (user_can_richedit()) { |
|
| 85 | + if( user_can_richedit() ) { |
|
| 86 | 86 | $variables['shortcodes'] = $this->localizeShortcodes(); |
| 87 | 87 | } |
| 88 | - $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables); |
|
| 89 | - wp_localize_script(Application::ID, 'GLSR', $variables); |
|
| 88 | + $variables = apply_filters( 'site-reviews/enqueue/admin/localize', $variables ); |
|
| 89 | + wp_localize_script( Application::ID, 'GLSR', $variables ); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | protected function getDependencies() |
| 96 | 96 | { |
| 97 | - $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []); |
|
| 98 | - $dependencies = array_merge($dependencies, [ |
|
| 97 | + $dependencies = apply_filters( 'site-reviews/enqueue/admin/dependencies', [] ); |
|
| 98 | + $dependencies = array_merge( $dependencies, [ |
|
| 99 | 99 | 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
| 100 | - ]); |
|
| 100 | + ] ); |
|
| 101 | 101 | return $dependencies; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @return array |
| 106 | 106 | */ |
| 107 | - protected function generatePointer(array $pointer) |
|
| 107 | + protected function generatePointer( array $pointer ) |
|
| 108 | 108 | { |
| 109 | 109 | return [ |
| 110 | 110 | 'id' => $pointer['id'], |
@@ -120,19 +120,19 @@ discard block |
||
| 120 | 120 | /** |
| 121 | 121 | * @return void |
| 122 | 122 | */ |
| 123 | - protected function generatePointers(array $pointers) |
|
| 123 | + protected function generatePointers( array $pointers ) |
|
| 124 | 124 | { |
| 125 | - $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true); |
|
| 126 | - $dismissedPointers = explode(',', (string) $dismissedPointers); |
|
| 125 | + $dismissedPointers = get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ); |
|
| 126 | + $dismissedPointers = explode( ',', (string)$dismissedPointers ); |
|
| 127 | 127 | $generatedPointers = []; |
| 128 | - foreach ($pointers as $pointer) { |
|
| 129 | - if ($pointer['screen'] != glsr_current_screen()->id) { |
|
| 128 | + foreach( $pointers as $pointer ) { |
|
| 129 | + if( $pointer['screen'] != glsr_current_screen()->id ) { |
|
| 130 | 130 | continue; |
| 131 | 131 | } |
| 132 | - if (in_array($pointer['id'], $dismissedPointers)) { |
|
| 132 | + if( in_array( $pointer['id'], $dismissedPointers ) ) { |
|
| 133 | 133 | continue; |
| 134 | 134 | } |
| 135 | - $generatedPointers[] = $this->generatePointer($pointer); |
|
| 135 | + $generatedPointers[] = $this->generatePointer( $pointer ); |
|
| 136 | 136 | } |
| 137 | 137 | $this->pointers = $generatedPointers; |
| 138 | 138 | } |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | protected function localizeShortcodes() |
| 157 | 157 | { |
| 158 | 158 | $variables = []; |
| 159 | - foreach (glsr()->mceShortcodes as $tag => $args) { |
|
| 160 | - if (empty($args['required'])) { |
|
| 159 | + foreach( glsr()->mceShortcodes as $tag => $args ) { |
|
| 160 | + if( empty($args['required']) ) { |
|
| 161 | 161 | continue; |
| 162 | 162 | } |
| 163 | 163 | $variables[$tag] = $args['required']; |