@@ -1,26 +1,26 @@ |
||
| 1 | -<?php defined('WPINC') || die; ?> |
|
| 1 | +<?php defined( 'WPINC' ) || die; ?> |
|
| 2 | 2 | |
| 3 | 3 | <div id="titlediv"> |
| 4 | - <input type="text" id="title" value="<?= $post->post_title ? esc_attr($post->post_title) : sprintf('(%s)', __('no title', 'site-reviews')); ?>" readonly> |
|
| 4 | + <input type="text" id="title" value="<?= $post->post_title ? esc_attr( $post->post_title ) : sprintf( '(%s)', __( 'no title', 'site-reviews' ) ); ?>" readonly> |
|
| 5 | 5 | </div> |
| 6 | 6 | |
| 7 | 7 | <div id="contentdiv" class="wp-editor-container"> |
| 8 | - <textarea readonly><?= esc_attr($post->post_content); ?></textarea> |
|
| 8 | + <textarea readonly><?= esc_attr( $post->post_content ); ?></textarea> |
|
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | -<?php if (empty($response)) { |
|
| 11 | +<?php if( empty($response) ) { |
|
| 12 | 12 | return; |
| 13 | 13 | } ?> |
| 14 | 14 | |
| 15 | 15 | <div class="postbox glsr-response-postbox"> |
| 16 | 16 | <button type="button" class="handlediv" aria-expanded="true"> |
| 17 | - <span class="screen-reader-text"><?= __('Toggle panel: Public Response', 'site-reviews'); ?></span> |
|
| 17 | + <span class="screen-reader-text"><?= __( 'Toggle panel: Public Response', 'site-reviews' ); ?></span> |
|
| 18 | 18 | <span class="toggle-indicator" aria-hidden="true"></span> |
| 19 | 19 | </button> |
| 20 | 20 | <h2 class="hndle"> |
| 21 | - <span><?= __('Public Response', 'site-reviews'); ?></span> |
|
| 21 | + <span><?= __( 'Public Response', 'site-reviews' ); ?></span> |
|
| 22 | 22 | </h2> |
| 23 | 23 | <div class="inside"> |
| 24 | - <?= wpautop(esc_attr($response)); ?> |
|
| 24 | + <?= wpautop( esc_attr( $response ) ); ?> |
|
| 25 | 25 | </div> |
| 26 | 26 | </div> |
@@ -1,22 +1,22 @@ |
||
| 1 | -<?php defined('WPINC') || die; ?> |
|
| 1 | +<?php defined( 'WPINC' ) || die; ?> |
|
| 2 | 2 | |
| 3 | 3 | <textarea id="log-file" class="large-text code glsr-code glsr-code-large" rows="20" readonly>{{ console }}</textarea> |
| 4 | 4 | <form method="post" class="glsr-float-left"> |
| 5 | 5 | <input type="hidden" name="{{ id }}[_action]" value="download-console"> |
| 6 | - <?php wp_nonce_field('download-console'); ?> |
|
| 7 | - <?php submit_button(__('Download Console', 'site-reviews'), 'primary', '', false); ?> |
|
| 6 | + <?php wp_nonce_field( 'download-console' ); ?> |
|
| 7 | + <?php submit_button( __( 'Download Console', 'site-reviews' ), 'primary', '', false ); ?> |
|
| 8 | 8 | </form> |
| 9 | 9 | <form method="post" class="glsr-float-left"> |
| 10 | 10 | <input type="hidden" name="{{ id }}[_action]" value="fetch-console"> |
| 11 | - <?php wp_nonce_field('fetch-console'); ?> |
|
| 11 | + <?php wp_nonce_field( 'fetch-console' ); ?> |
|
| 12 | 12 | <button type="submit" class="glsr-button button" id="fetch-console"> |
| 13 | - <span data-loading="<?= __('Reloading...', 'site-reviews'); ?>"><?= __('Reload', 'site-reviews'); ?></span> |
|
| 13 | + <span data-loading="<?= __( 'Reloading...', 'site-reviews' ); ?>"><?= __( 'Reload', 'site-reviews' ); ?></span> |
|
| 14 | 14 | </button> |
| 15 | 15 | </form> |
| 16 | 16 | <form method="post"> |
| 17 | 17 | <input type="hidden" name="{{ id }}[_action]" value="clear-console"> |
| 18 | - <?php wp_nonce_field('clear-console'); ?> |
|
| 18 | + <?php wp_nonce_field( 'clear-console' ); ?> |
|
| 19 | 19 | <button type="submit" class="glsr-button button" id="clear-console"> |
| 20 | - <span data-loading="<?= __('Clearing...', 'site-reviews'); ?>"><?= __('Clear', 'site-reviews'); ?></span> |
|
| 20 | + <span data-loading="<?= __( 'Clearing...', 'site-reviews' ); ?>"><?= __( 'Clear', 'site-reviews' ); ?></span> |
|
| 21 | 21 | </button> |
| 22 | 22 | </form> |
@@ -10,158 +10,158 @@ |
||
| 10 | 10 | |
| 11 | 11 | class EnqueueAdminAssets |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @var array |
|
| 15 | - */ |
|
| 16 | - protected $pointers; |
|
| 13 | + /** |
|
| 14 | + * @var array |
|
| 15 | + */ |
|
| 16 | + protected $pointers; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @return void |
|
| 20 | - */ |
|
| 21 | - public function handle(Command $command) |
|
| 22 | - { |
|
| 23 | - $this->generatePointers($command->pointers); |
|
| 24 | - $this->enqueueAssets(); |
|
| 25 | - $this->localizeAssets(); |
|
| 26 | - } |
|
| 18 | + /** |
|
| 19 | + * @return void |
|
| 20 | + */ |
|
| 21 | + public function handle(Command $command) |
|
| 22 | + { |
|
| 23 | + $this->generatePointers($command->pointers); |
|
| 24 | + $this->enqueueAssets(); |
|
| 25 | + $this->localizeAssets(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function enqueueAssets() |
|
| 32 | - { |
|
| 33 | - if (!$this->isCurrentScreen()) { |
|
| 34 | - return; |
|
| 35 | - } |
|
| 36 | - wp_enqueue_style( |
|
| 37 | - Application::ID, |
|
| 38 | - glsr()->url('assets/styles/'.Application::ID.'-admin.css'), |
|
| 39 | - [], |
|
| 40 | - glsr()->version |
|
| 41 | - ); |
|
| 42 | - wp_enqueue_script( |
|
| 43 | - Application::ID, |
|
| 44 | - glsr()->url('assets/scripts/'.Application::ID.'-admin.js'), |
|
| 45 | - $this->getDependencies(), |
|
| 46 | - glsr()->version, |
|
| 47 | - true |
|
| 48 | - ); |
|
| 49 | - if (!empty($this->pointers)) { |
|
| 50 | - wp_enqueue_style('wp-pointer'); |
|
| 51 | - wp_enqueue_script('wp-pointer'); |
|
| 52 | - } |
|
| 53 | - } |
|
| 28 | + /** |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function enqueueAssets() |
|
| 32 | + { |
|
| 33 | + if (!$this->isCurrentScreen()) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 36 | + wp_enqueue_style( |
|
| 37 | + Application::ID, |
|
| 38 | + glsr()->url('assets/styles/'.Application::ID.'-admin.css'), |
|
| 39 | + [], |
|
| 40 | + glsr()->version |
|
| 41 | + ); |
|
| 42 | + wp_enqueue_script( |
|
| 43 | + Application::ID, |
|
| 44 | + glsr()->url('assets/scripts/'.Application::ID.'-admin.js'), |
|
| 45 | + $this->getDependencies(), |
|
| 46 | + glsr()->version, |
|
| 47 | + true |
|
| 48 | + ); |
|
| 49 | + if (!empty($this->pointers)) { |
|
| 50 | + wp_enqueue_style('wp-pointer'); |
|
| 51 | + wp_enqueue_script('wp-pointer'); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @return void |
|
| 57 | - */ |
|
| 58 | - public function localizeAssets() |
|
| 59 | - { |
|
| 60 | - $variables = [ |
|
| 61 | - 'action' => Application::PREFIX.'action', |
|
| 62 | - 'addons' => [], |
|
| 63 | - 'ajaxurl' => admin_url('admin-ajax.php'), |
|
| 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(), |
|
| 68 | - ], |
|
| 69 | - 'nameprefix' => Application::ID, |
|
| 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'), |
|
| 78 | - ], |
|
| 79 | - 'pointers' => $this->pointers, |
|
| 80 | - 'shortcodes' => [], |
|
| 81 | - 'tinymce' => [ |
|
| 82 | - 'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'), |
|
| 83 | - ], |
|
| 84 | - ]; |
|
| 85 | - if (user_can_richedit()) { |
|
| 86 | - $variables['shortcodes'] = $this->localizeShortcodes(); |
|
| 87 | - } |
|
| 88 | - $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables); |
|
| 89 | - wp_localize_script(Application::ID, 'GLSR', $variables); |
|
| 90 | - } |
|
| 55 | + /** |
|
| 56 | + * @return void |
|
| 57 | + */ |
|
| 58 | + public function localizeAssets() |
|
| 59 | + { |
|
| 60 | + $variables = [ |
|
| 61 | + 'action' => Application::PREFIX.'action', |
|
| 62 | + 'addons' => [], |
|
| 63 | + 'ajaxurl' => admin_url('admin-ajax.php'), |
|
| 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(), |
|
| 68 | + ], |
|
| 69 | + 'nameprefix' => Application::ID, |
|
| 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'), |
|
| 78 | + ], |
|
| 79 | + 'pointers' => $this->pointers, |
|
| 80 | + 'shortcodes' => [], |
|
| 81 | + 'tinymce' => [ |
|
| 82 | + 'glsr_shortcode' => glsr()->url('assets/scripts/mce-plugin.js'), |
|
| 83 | + ], |
|
| 84 | + ]; |
|
| 85 | + if (user_can_richedit()) { |
|
| 86 | + $variables['shortcodes'] = $this->localizeShortcodes(); |
|
| 87 | + } |
|
| 88 | + $variables = apply_filters('site-reviews/enqueue/admin/localize', $variables); |
|
| 89 | + wp_localize_script(Application::ID, 'GLSR', $variables); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * @return array |
|
| 94 | - */ |
|
| 95 | - protected function getDependencies() |
|
| 96 | - { |
|
| 97 | - $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []); |
|
| 98 | - $dependencies = array_merge($dependencies, [ |
|
| 99 | - 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
|
| 100 | - ]); |
|
| 101 | - return $dependencies; |
|
| 102 | - } |
|
| 92 | + /** |
|
| 93 | + * @return array |
|
| 94 | + */ |
|
| 95 | + protected function getDependencies() |
|
| 96 | + { |
|
| 97 | + $dependencies = apply_filters('site-reviews/enqueue/admin/dependencies', []); |
|
| 98 | + $dependencies = array_merge($dependencies, [ |
|
| 99 | + 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
|
| 100 | + ]); |
|
| 101 | + return $dependencies; |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * @return array |
|
| 106 | - */ |
|
| 107 | - protected function generatePointer(array $pointer) |
|
| 108 | - { |
|
| 109 | - return [ |
|
| 110 | - 'id' => $pointer['id'], |
|
| 111 | - 'options' => [ |
|
| 112 | - 'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>', |
|
| 113 | - 'position' => $pointer['position'], |
|
| 114 | - ], |
|
| 115 | - 'screen' => $pointer['screen'], |
|
| 116 | - 'target' => $pointer['target'], |
|
| 117 | - ]; |
|
| 118 | - } |
|
| 104 | + /** |
|
| 105 | + * @return array |
|
| 106 | + */ |
|
| 107 | + protected function generatePointer(array $pointer) |
|
| 108 | + { |
|
| 109 | + return [ |
|
| 110 | + 'id' => $pointer['id'], |
|
| 111 | + 'options' => [ |
|
| 112 | + 'content' => '<h3>'.$pointer['title'].'</h3><p>'.$pointer['content'].'</p>', |
|
| 113 | + 'position' => $pointer['position'], |
|
| 114 | + ], |
|
| 115 | + 'screen' => $pointer['screen'], |
|
| 116 | + 'target' => $pointer['target'], |
|
| 117 | + ]; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * @return void |
|
| 122 | - */ |
|
| 123 | - protected function generatePointers(array $pointers) |
|
| 124 | - { |
|
| 125 | - $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true); |
|
| 126 | - $dismissedPointers = explode(',', (string) $dismissedPointers); |
|
| 127 | - $generatedPointers = []; |
|
| 128 | - foreach ($pointers as $pointer) { |
|
| 129 | - if ($pointer['screen'] != glsr_current_screen()->id) { |
|
| 130 | - continue; |
|
| 131 | - } |
|
| 132 | - if (in_array($pointer['id'], $dismissedPointers)) { |
|
| 133 | - continue; |
|
| 134 | - } |
|
| 135 | - $generatedPointers[] = $this->generatePointer($pointer); |
|
| 136 | - } |
|
| 137 | - $this->pointers = $generatedPointers; |
|
| 138 | - } |
|
| 120 | + /** |
|
| 121 | + * @return void |
|
| 122 | + */ |
|
| 123 | + protected function generatePointers(array $pointers) |
|
| 124 | + { |
|
| 125 | + $dismissedPointers = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true); |
|
| 126 | + $dismissedPointers = explode(',', (string) $dismissedPointers); |
|
| 127 | + $generatedPointers = []; |
|
| 128 | + foreach ($pointers as $pointer) { |
|
| 129 | + if ($pointer['screen'] != glsr_current_screen()->id) { |
|
| 130 | + continue; |
|
| 131 | + } |
|
| 132 | + if (in_array($pointer['id'], $dismissedPointers)) { |
|
| 133 | + continue; |
|
| 134 | + } |
|
| 135 | + $generatedPointers[] = $this->generatePointer($pointer); |
|
| 136 | + } |
|
| 137 | + $this->pointers = $generatedPointers; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * @return bool |
|
| 142 | - */ |
|
| 143 | - protected function isCurrentScreen() |
|
| 144 | - { |
|
| 145 | - $screen = glsr_current_screen(); |
|
| 146 | - return Application::POST_TYPE == $screen->post_type |
|
| 147 | - || 'dashboard' == $screen->id |
|
| 148 | - || 'plugins_page_'.Application::ID == $screen->id |
|
| 149 | - || 'post' == $screen->base |
|
| 150 | - || 'widgets' == $screen->id; |
|
| 151 | - } |
|
| 140 | + /** |
|
| 141 | + * @return bool |
|
| 142 | + */ |
|
| 143 | + protected function isCurrentScreen() |
|
| 144 | + { |
|
| 145 | + $screen = glsr_current_screen(); |
|
| 146 | + return Application::POST_TYPE == $screen->post_type |
|
| 147 | + || 'dashboard' == $screen->id |
|
| 148 | + || 'plugins_page_'.Application::ID == $screen->id |
|
| 149 | + || 'post' == $screen->base |
|
| 150 | + || 'widgets' == $screen->id; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * @return array |
|
| 155 | - */ |
|
| 156 | - protected function localizeShortcodes() |
|
| 157 | - { |
|
| 158 | - $variables = []; |
|
| 159 | - foreach (glsr()->mceShortcodes as $tag => $args) { |
|
| 160 | - if (empty($args['required'])) { |
|
| 161 | - continue; |
|
| 162 | - } |
|
| 163 | - $variables[$tag] = $args['required']; |
|
| 164 | - } |
|
| 165 | - return $variables; |
|
| 166 | - } |
|
| 153 | + /** |
|
| 154 | + * @return array |
|
| 155 | + */ |
|
| 156 | + protected function localizeShortcodes() |
|
| 157 | + { |
|
| 158 | + $variables = []; |
|
| 159 | + foreach (glsr()->mceShortcodes as $tag => $args) { |
|
| 160 | + if (empty($args['required'])) { |
|
| 161 | + continue; |
|
| 162 | + } |
|
| 163 | + $variables[$tag] = $args['required']; |
|
| 164 | + } |
|
| 165 | + return $variables; |
|
| 166 | + } |
|
| 167 | 167 | } |
@@ -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 | } |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function enqueueAssets() |
| 32 | 32 | { |
| 33 | - if (!$this->isCurrentScreen()) { |
|
| 33 | + if( !$this->isCurrentScreen() ) { |
|
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | wp_enqueue_style( |
| 37 | 37 | Application::ID, |
| 38 | - glsr()->url('assets/styles/'.Application::ID.'-admin.css'), |
|
| 38 | + glsr()->url( 'assets/styles/'.Application::ID.'-admin.css' ), |
|
| 39 | 39 | [], |
| 40 | 40 | glsr()->version |
| 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']; |