@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | * @param string $id |
| 394 | 394 | * @param string $search_for_id |
| 395 | 395 | * |
| 396 | - * @return mixed |
|
| 396 | + * @return string |
|
| 397 | 397 | */ |
| 398 | 398 | public static function shortcode_button( $id = '', $search_for_id = '' ) { |
| 399 | 399 | ob_start(); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * Makes SD work with the siteOrigin page builder. |
| 424 | 424 | * |
| 425 | 425 | * @since 1.0.6 |
| 426 | - * @return mixed |
|
| 426 | + * @return string |
|
| 427 | 427 | */ |
| 428 | 428 | public static function siteorigin_js() { |
| 429 | 429 | ob_start(); |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | /** |
| 999 | 999 | * Gets some CSS for the widgets screen. |
| 1000 | 1000 | * |
| 1001 | - * @return mixed |
|
| 1001 | + * @return string |
|
| 1002 | 1002 | */ |
| 1003 | 1003 | public function widget_css() { |
| 1004 | 1004 | ob_start(); |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | /** |
| 1053 | 1053 | * Gets some JS for the widgets screen. |
| 1054 | 1054 | * |
| 1055 | - * @return mixed |
|
| 1055 | + * @return string |
|
| 1056 | 1056 | */ |
| 1057 | 1057 | public function widget_js() { |
| 1058 | 1058 | ob_start(); |
@@ -1592,7 +1592,7 @@ discard block |
||
| 1592 | 1592 | * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap. |
| 1593 | 1593 | * @since 1.0.9 Save numbers as numbers and not strings. |
| 1594 | 1594 | * @since 1.1.0 Font Awesome classes can be used for icons. |
| 1595 | - * @return mixed |
|
| 1595 | + * @return string |
|
| 1596 | 1596 | */ |
| 1597 | 1597 | public function block() { |
| 1598 | 1598 | ob_start(); |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 2 | +if (!defined('ABSPATH')) { |
|
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -if ( ! class_exists( 'WP_Super_Duper' ) ) { |
|
| 6 | +if (!class_exists('WP_Super_Duper')) { |
|
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | /** |
@@ -54,27 +54,27 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * Take the array options and use them to build. |
| 56 | 56 | */ |
| 57 | - public function __construct( $options ) { |
|
| 57 | + public function __construct($options) { |
|
| 58 | 58 | global $sd_widgets; |
| 59 | 59 | |
| 60 | - $sd_widgets[ $options['base_id'] ] = array( |
|
| 60 | + $sd_widgets[$options['base_id']] = array( |
|
| 61 | 61 | 'name' => $options['name'], |
| 62 | 62 | 'class_name' => $options['class_name'] |
| 63 | 63 | ); |
| 64 | - $this->base_id = $options['base_id']; |
|
| 64 | + $this->base_id = $options['base_id']; |
|
| 65 | 65 | // lets filter the options before we do anything |
| 66 | - $options = apply_filters( "wp_super_duper_options", $options ); |
|
| 67 | - $options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options ); |
|
| 68 | - $options = $this->add_name_from_key( $options ); |
|
| 66 | + $options = apply_filters("wp_super_duper_options", $options); |
|
| 67 | + $options = apply_filters("wp_super_duper_options_{$this->base_id}", $options); |
|
| 68 | + $options = $this->add_name_from_key($options); |
|
| 69 | 69 | $this->options = $options; |
| 70 | 70 | |
| 71 | 71 | $this->base_id = $options['base_id']; |
| 72 | - $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array(); |
|
| 72 | + $this->arguments = isset($options['arguments']) ? $options['arguments'] : array(); |
|
| 73 | 73 | |
| 74 | 74 | // init parent |
| 75 | - parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] ); |
|
| 75 | + parent::__construct($options['base_id'], $options['name'], $options['widget_ops']); |
|
| 76 | 76 | |
| 77 | - if ( isset( $options['class_name'] ) ) { |
|
| 77 | + if (isset($options['class_name'])) { |
|
| 78 | 78 | // register widget |
| 79 | 79 | $this->class_name = $options['class_name']; |
| 80 | 80 | |
@@ -82,54 +82,54 @@ discard block |
||
| 82 | 82 | $this->register_shortcode(); |
| 83 | 83 | |
| 84 | 84 | // Fusion Builder (avada) support |
| 85 | - if( function_exists('fusion_builder_map') ){ $this->register_fusion_element(); } |
|
| 85 | + if (function_exists('fusion_builder_map')) { $this->register_fusion_element(); } |
|
| 86 | 86 | |
| 87 | 87 | // register block |
| 88 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) ); |
|
| 88 | + add_action('admin_enqueue_scripts', array($this, 'register_block')); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // add the CSS and JS we need ONCE |
| 92 | 92 | global $sd_widget_scripts; |
| 93 | 93 | |
| 94 | - if ( ! $sd_widget_scripts ) { |
|
| 95 | - wp_add_inline_script( 'admin-widgets', $this->widget_js() ); |
|
| 96 | - wp_add_inline_script( 'customize-controls', $this->widget_js() ); |
|
| 97 | - wp_add_inline_style( 'widgets', $this->widget_css() ); |
|
| 94 | + if (!$sd_widget_scripts) { |
|
| 95 | + wp_add_inline_script('admin-widgets', $this->widget_js()); |
|
| 96 | + wp_add_inline_script('customize-controls', $this->widget_js()); |
|
| 97 | + wp_add_inline_style('widgets', $this->widget_css()); |
|
| 98 | 98 | |
| 99 | 99 | $sd_widget_scripts = true; |
| 100 | 100 | |
| 101 | 101 | // add shortcode insert button once |
| 102 | - add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) ); |
|
| 102 | + add_action('media_buttons', array($this, 'shortcode_insert_button')); |
|
| 103 | 103 | // generatepress theme sections compatibility |
| 104 | - if ( function_exists( 'generate_sections_sections_metabox' ) ) { |
|
| 105 | - add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) ); |
|
| 104 | + if (function_exists('generate_sections_sections_metabox')) { |
|
| 105 | + add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script')); |
|
| 106 | 106 | } |
| 107 | - if ( $this->is_preview() ) { |
|
| 108 | - add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
| 107 | + if ($this->is_preview()) { |
|
| 108 | + add_action('wp_footer', array($this, 'shortcode_insert_button_script')); |
|
| 109 | 109 | // this makes the insert button work for elementor |
| 110 | - add_action( 'elementor/editor/after_enqueue_scripts', array( |
|
| 110 | + add_action('elementor/editor/after_enqueue_scripts', array( |
|
| 111 | 111 | $this, |
| 112 | 112 | 'shortcode_insert_button_script' |
| 113 | - ) ); // for elementor |
|
| 113 | + )); // for elementor |
|
| 114 | 114 | } |
| 115 | 115 | // this makes the insert button work for cornerstone |
| 116 | - add_action('wp_print_footer_scripts',array( __CLASS__, 'maybe_cornerstone_builder' )); |
|
| 116 | + add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder')); |
|
| 117 | 117 | |
| 118 | - add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) ); |
|
| 119 | - add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) ); |
|
| 118 | + add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings')); |
|
| 119 | + add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker')); |
|
| 120 | 120 | |
| 121 | 121 | // add generator text to admin head |
| 122 | - add_action( 'admin_head', array( $this, 'generator' ) ); |
|
| 122 | + add_action('admin_head', array($this, 'generator')); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - do_action( 'wp_super_duper_widget_init', $options, $this ); |
|
| 125 | + do_action('wp_super_duper_widget_init', $options, $this); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function register_fusion_element(){ |
|
| 128 | + public function register_fusion_element() { |
|
| 129 | 129 | |
| 130 | 130 | $options = $this->options; |
| 131 | 131 | |
| 132 | - if($this->base_id){ |
|
| 132 | + if ($this->base_id) { |
|
| 133 | 133 | |
| 134 | 134 | $params = $this->get_fusion_params(); |
| 135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | 'allow_generator' => true, |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - if(!empty($params)){ |
|
| 143 | + if (!empty($params)) { |
|
| 144 | 144 | $args['params'] = $params; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - public function get_fusion_params(){ |
|
| 152 | + public function get_fusion_params() { |
|
| 153 | 153 | $params = array(); |
| 154 | 154 | $arguments = $this->get_arguments(); |
| 155 | 155 | |
| 156 | - if(!empty($arguments)){ |
|
| 157 | - foreach($arguments as $key => $val){ |
|
| 156 | + if (!empty($arguments)) { |
|
| 157 | + foreach ($arguments as $key => $val) { |
|
| 158 | 158 | $param = array(); |
| 159 | 159 | // type |
| 160 | 160 | $param['type'] = str_replace( |
@@ -188,19 +188,19 @@ discard block |
||
| 188 | 188 | $param['default'] = isset($val['default']) ? $val['default'] : ''; |
| 189 | 189 | |
| 190 | 190 | // Group |
| 191 | - if(isset($val['group'])){ |
|
| 191 | + if (isset($val['group'])) { |
|
| 192 | 192 | $param['group'] = $val['group']; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // value |
| 196 | - if($val['type'] == 'checkbox'){ |
|
| 197 | - if(isset($val['default']) && $val['default'] == '0'){ |
|
| 196 | + if ($val['type'] == 'checkbox') { |
|
| 197 | + if (isset($val['default']) && $val['default'] == '0') { |
|
| 198 | 198 | unset($param['default']); |
| 199 | 199 | } |
| 200 | - $param['value'] = array(''=>__("No"),'1'=>__("Yes")); |
|
| 201 | - }elseif($param['type'] == 'select'){ |
|
| 200 | + $param['value'] = array(''=>__("No"), '1'=>__("Yes")); |
|
| 201 | + }elseif ($param['type'] == 'select') { |
|
| 202 | 202 | $param['value'] = isset($val['options']) ? $val['options'] : array(); |
| 203 | - }else{ |
|
| 203 | + } else { |
|
| 204 | 204 | $param['value'] = isset($val['default']) ? $val['default'] : ''; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | /** |
| 218 | 218 | * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder |
| 219 | 219 | */ |
| 220 | - public static function maybe_cornerstone_builder(){ |
|
| 221 | - if(did_action('cornerstone_before_boot_app')){ |
|
| 220 | + public static function maybe_cornerstone_builder() { |
|
| 221 | + if (did_action('cornerstone_before_boot_app')) { |
|
| 222 | 222 | self::shortcode_insert_button_script(); |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @return string |
| 232 | 232 | */ |
| 233 | - public static function get_picker( $editor_id = '' ) { |
|
| 233 | + public static function get_picker($editor_id = '') { |
|
| 234 | 234 | |
| 235 | 235 | ob_start(); |
| 236 | - if ( isset( $_POST['editor_id'] ) ) { |
|
| 237 | - $editor_id = esc_attr( $_POST['editor_id'] ); |
|
| 238 | - } elseif ( isset( $_REQUEST['et_fb'] ) ) { |
|
| 236 | + if (isset($_POST['editor_id'])) { |
|
| 237 | + $editor_id = esc_attr($_POST['editor_id']); |
|
| 238 | + } elseif (isset($_REQUEST['et_fb'])) { |
|
| 239 | 239 | $editor_id = 'main_content_content_vb_tiny_mce'; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | <div class="sd-shortcode-left-wrap"> |
| 246 | 246 | <?php |
| 247 | - ksort( $sd_widgets ); |
|
| 247 | + ksort($sd_widgets); |
|
| 248 | 248 | // print_r($sd_widgets);exit; |
| 249 | - if ( ! empty( $sd_widgets ) ) { |
|
| 249 | + if (!empty($sd_widgets)) { |
|
| 250 | 250 | echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">'; |
| 251 | - echo "<option>" . __( 'Select shortcode' ) . "</option>"; |
|
| 252 | - foreach ( $sd_widgets as $shortcode => $class ) { |
|
| 253 | - echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>"; |
|
| 251 | + echo "<option>" . __('Select shortcode') . "</option>"; |
|
| 252 | + foreach ($sd_widgets as $shortcode => $class) { |
|
| 253 | + echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>"; |
|
| 254 | 254 | } |
| 255 | 255 | echo "</select>"; |
| 256 | 256 | |
@@ -263,37 +263,37 @@ discard block |
||
| 263 | 263 | <div class="sd-shortcode-right-wrap"> |
| 264 | 264 | <textarea id='sd-shortcode-output' disabled></textarea> |
| 265 | 265 | <div id='sd-shortcode-output-actions'> |
| 266 | - <?php if ( $editor_id != '' ) { ?> |
|
| 266 | + <?php if ($editor_id != '') { ?> |
|
| 267 | 267 | <button class="button sd-insert-shortcode-button" |
| 268 | - onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { |
|
| 268 | + onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) { |
|
| 269 | 269 | echo "'" . $editor_id . "'"; |
| 270 | - } ?>)"><?php _e( 'Insert shortcode' ); ?></button> |
|
| 270 | + } ?>)"><?php _e('Insert shortcode'); ?></button> |
|
| 271 | 271 | <?php } ?> |
| 272 | 272 | <button class="button" |
| 273 | - onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button> |
|
| 273 | + onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button> |
|
| 274 | 274 | </div> |
| 275 | 275 | </div> |
| 276 | 276 | <?php |
| 277 | 277 | |
| 278 | 278 | $html = ob_get_clean(); |
| 279 | 279 | |
| 280 | - if ( wp_doing_ajax() ) { |
|
| 280 | + if (wp_doing_ajax()) { |
|
| 281 | 281 | echo $html; |
| 282 | 282 | $should_die = true; |
| 283 | 283 | |
| 284 | 284 | // some builder get the editor via ajax so we should not die on those ocasions |
| 285 | 285 | $dont_die = array( |
| 286 | - 'parent_tag',// WP Bakery |
|
| 286 | + 'parent_tag', // WP Bakery |
|
| 287 | 287 | 'avia_request' // enfold |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | - foreach ( $dont_die as $request ) { |
|
| 291 | - if ( isset( $_REQUEST[ $request ] ) ) { |
|
| 290 | + foreach ($dont_die as $request) { |
|
| 291 | + if (isset($_REQUEST[$request])) { |
|
| 292 | 292 | $should_die = false; |
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - if ( $should_die ) { |
|
| 296 | + if ($should_die) { |
|
| 297 | 297 | wp_die(); |
| 298 | 298 | } |
| 299 | 299 | |
@@ -320,16 +320,16 @@ discard block |
||
| 320 | 320 | public static function get_widget_settings() { |
| 321 | 321 | global $sd_widgets; |
| 322 | 322 | |
| 323 | - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; |
|
| 324 | - if ( ! $shortcode ) { |
|
| 323 | + $shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : ''; |
|
| 324 | + if (!$shortcode) { |
|
| 325 | 325 | wp_die(); |
| 326 | 326 | } |
| 327 | - $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; |
|
| 328 | - if ( ! $widget_args ) { |
|
| 327 | + $widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : ''; |
|
| 328 | + if (!$widget_args) { |
|
| 329 | 329 | wp_die(); |
| 330 | 330 | } |
| 331 | - $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
| 332 | - if ( ! $class_name ) { |
|
| 331 | + $class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
| 332 | + if (!$class_name) { |
|
| 333 | 333 | wp_die(); |
| 334 | 334 | } |
| 335 | 335 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $widget = new $class_name; |
| 338 | 338 | |
| 339 | 339 | ob_start(); |
| 340 | - $widget->form( array() ); |
|
| 340 | + $widget->form(array()); |
|
| 341 | 341 | $form = ob_get_clean(); |
| 342 | 342 | echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>"; |
| 343 | 343 | echo "<style>" . $widget->widget_css() . "</style>"; |
@@ -355,9 +355,9 @@ discard block |
||
| 355 | 355 | * @param string $editor_id Optional. Shortcode editor id. Default null. |
| 356 | 356 | * @param string $insert_shortcode_function Optional. Insert shotcode function. Default null. |
| 357 | 357 | */ |
| 358 | - public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) { |
|
| 358 | + public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') { |
|
| 359 | 359 | global $sd_widgets, $shortcode_insert_button_once; |
| 360 | - if ( $shortcode_insert_button_once ) { |
|
| 360 | + if ($shortcode_insert_button_once) { |
|
| 361 | 361 | return; |
| 362 | 362 | } |
| 363 | 363 | add_thickbox(); |
@@ -367,21 +367,21 @@ discard block |
||
| 367 | 367 | * Cornerstone makes us play dirty tricks :/ |
| 368 | 368 | * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed. |
| 369 | 369 | */ |
| 370 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
| 370 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
| 371 | 371 | echo '<span id="insert-media-button">'; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - echo self::shortcode_button( 'this', 'true' ); |
|
| 374 | + echo self::shortcode_button('this', 'true'); |
|
| 375 | 375 | |
| 376 | 376 | // see opening note |
| 377 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
| 377 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
| 378 | 378 | echo '</span>'; // end #insert-media-button |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | // Add separate script for generatepress theme sections |
| 382 | - if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { |
|
| 382 | + if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) { |
|
| 383 | 383 | } else { |
| 384 | - self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); |
|
| 384 | + self::shortcode_insert_button_script($editor_id, $insert_shortcode_function); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | $shortcode_insert_button_once = true; |
@@ -395,12 +395,12 @@ discard block |
||
| 395 | 395 | * |
| 396 | 396 | * @return mixed |
| 397 | 397 | */ |
| 398 | - public static function shortcode_button( $id = '', $search_for_id = '' ) { |
|
| 398 | + public static function shortcode_button($id = '', $search_for_id = '') { |
|
| 399 | 399 | ob_start(); |
| 400 | 400 | ?> |
| 401 | 401 | <span class="sd-lable-shortcode-inserter"> |
| 402 | 402 | <a onclick="sd_ajax_get_picker(<?php echo $id; |
| 403 | - if ( $search_for_id ) { |
|
| 403 | + if ($search_for_id) { |
|
| 404 | 404 | echo "," . $search_for_id; |
| 405 | 405 | } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed" |
| 406 | 406 | class="thickbox button super-duper-content-open" title="Add Shortcode"> |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $html = ob_get_clean(); |
| 417 | 417 | |
| 418 | 418 | // remove line breaks so we can use it in js |
| 419 | - return preg_replace( "/\r|\n/", "", trim( $html ) ); |
|
| 419 | + return preg_replace("/\r|\n/", "", trim($html)); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | jQuery($this).data('sd-widget-enabled', true); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - var $button = '<button title="<?php _e( 'Advanced Settings' );?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>'; |
|
| 477 | + var $button = '<button title="<?php _e('Advanced Settings'); ?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>'; |
|
| 478 | 478 | var form = jQuery($this).parents('' + $selector + ''); |
| 479 | 479 | |
| 480 | 480 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -511,10 +511,10 @@ discard block |
||
| 511 | 511 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 512 | 512 | */ |
| 513 | 513 | |
| 514 | - return str_replace( array( |
|
| 514 | + return str_replace(array( |
|
| 515 | 515 | '<script>', |
| 516 | 516 | '</script>' |
| 517 | - ), '', $output ); |
|
| 517 | + ), '', $output); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | * @param string $editor_id |
| 526 | 526 | * @param string $insert_shortcode_function |
| 527 | 527 | */ |
| 528 | - public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { |
|
| 528 | + public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') { |
|
| 529 | 529 | ?> |
| 530 | 530 | <style> |
| 531 | 531 | .sd-shortcode-left-wrap { |
@@ -643,22 +643,22 @@ discard block |
||
| 643 | 643 | height: 250px; |
| 644 | 644 | width: 100%; |
| 645 | 645 | } |
| 646 | - <?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?> |
|
| 646 | + <?php if (function_exists('generate_sections_sections_metabox')) { ?> |
|
| 647 | 647 | .generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter { |
| 648 | 648 | display: inline; |
| 649 | 649 | } |
| 650 | 650 | <?php } ?> |
| 651 | 651 | </style> |
| 652 | 652 | <?php |
| 653 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
| 653 | + if (class_exists('SiteOrigin_Panels')) { |
|
| 654 | 654 | echo "<script>" . self::siteorigin_js() . "</script>"; |
| 655 | 655 | } |
| 656 | 656 | ?> |
| 657 | 657 | <script> |
| 658 | 658 | <?php |
| 659 | - if(! empty( $insert_shortcode_function )){ |
|
| 659 | + if (!empty($insert_shortcode_function)) { |
|
| 660 | 660 | echo $insert_shortcode_function; |
| 661 | - }else{ |
|
| 661 | + } else { |
|
| 662 | 662 | |
| 663 | 663 | /** |
| 664 | 664 | * Function for super duper insert shortcode. |
@@ -671,9 +671,9 @@ discard block |
||
| 671 | 671 | if ($shortcode) { |
| 672 | 672 | if (!$editor_id) { |
| 673 | 673 | <?php |
| 674 | - if ( isset( $_REQUEST['et_fb'] ) ) { |
|
| 674 | + if (isset($_REQUEST['et_fb'])) { |
|
| 675 | 675 | echo '$editor_id = "#main_content_content_vb_tiny_mce";'; |
| 676 | - } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) { |
|
| 676 | + } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') { |
|
| 677 | 677 | echo '$editor_id = "#elementor-controls .wp-editor-container textarea";'; |
| 678 | 678 | } else { |
| 679 | 679 | echo '$editor_id = "#wp-content-editor-container textarea";'; |
@@ -758,11 +758,11 @@ discard block |
||
| 758 | 758 | 'shortcode': $short_code, |
| 759 | 759 | 'attributes': 123, |
| 760 | 760 | 'post_id': 321, |
| 761 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
| 761 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
| 762 | 762 | }; |
| 763 | 763 | |
| 764 | 764 | if (typeof ajaxurl === 'undefined') { |
| 765 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>"; |
|
| 765 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | jQuery.post(ajaxurl, data, function (response) { |
@@ -960,11 +960,11 @@ discard block |
||
| 960 | 960 | var data = { |
| 961 | 961 | 'action': 'super_duper_get_picker', |
| 962 | 962 | 'editor_id': $id, |
| 963 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>' |
|
| 963 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>' |
|
| 964 | 964 | }; |
| 965 | 965 | |
| 966 | 966 | if (!ajaxurl) { |
| 967 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; |
|
| 967 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | jQuery.post(ajaxurl, data, function (response) { |
@@ -985,9 +985,9 @@ discard block |
||
| 985 | 985 | */ |
| 986 | 986 | function sd_shortcode_button($id) { |
| 987 | 987 | if ($id) { |
| 988 | - return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>'; |
|
| 988 | + return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>'; |
|
| 989 | 989 | } else { |
| 990 | - return '<?php echo self::shortcode_button();?>'; |
|
| 990 | + return '<?php echo self::shortcode_button(); ?>'; |
|
| 991 | 991 | } |
| 992 | 992 | } |
| 993 | 993 | |
@@ -1043,10 +1043,10 @@ discard block |
||
| 1043 | 1043 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1044 | 1044 | */ |
| 1045 | 1045 | |
| 1046 | - return str_replace( array( |
|
| 1046 | + return str_replace(array( |
|
| 1047 | 1047 | '<style>', |
| 1048 | 1048 | '</style>' |
| 1049 | - ), '', $output ); |
|
| 1049 | + ), '', $output); |
|
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | /** |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | jQuery($this).data('sd-widget-enabled', true); |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | - var $button = '<button title="<?php _e( 'Advanced Settings' );?>" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>'; |
|
| 1119 | + var $button = '<button title="<?php _e('Advanced Settings'); ?>" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>'; |
|
| 1120 | 1120 | var form = jQuery($this).parents('' + $selector + ''); |
| 1121 | 1121 | |
| 1122 | 1122 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | }); |
| 1209 | 1209 | |
| 1210 | 1210 | } |
| 1211 | - <?php do_action( 'wp_super_duper_widget_js', $this ); ?> |
|
| 1211 | + <?php do_action('wp_super_duper_widget_js', $this); ?> |
|
| 1212 | 1212 | </script> |
| 1213 | 1213 | <?php |
| 1214 | 1214 | $output = ob_get_clean(); |
@@ -1217,10 +1217,10 @@ discard block |
||
| 1217 | 1217 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1218 | 1218 | */ |
| 1219 | 1219 | |
| 1220 | - return str_replace( array( |
|
| 1220 | + return str_replace(array( |
|
| 1221 | 1221 | '<script>', |
| 1222 | 1222 | '</script>' |
| 1223 | - ), '', $output ); |
|
| 1223 | + ), '', $output); |
|
| 1224 | 1224 | } |
| 1225 | 1225 | |
| 1226 | 1226 | |
@@ -1231,14 +1231,14 @@ discard block |
||
| 1231 | 1231 | * |
| 1232 | 1232 | * @return mixed |
| 1233 | 1233 | */ |
| 1234 | - private function add_name_from_key( $options, $arguments = false ) { |
|
| 1235 | - if ( ! empty( $options['arguments'] ) ) { |
|
| 1236 | - foreach ( $options['arguments'] as $key => $val ) { |
|
| 1237 | - $options['arguments'][ $key ]['name'] = $key; |
|
| 1234 | + private function add_name_from_key($options, $arguments = false) { |
|
| 1235 | + if (!empty($options['arguments'])) { |
|
| 1236 | + foreach ($options['arguments'] as $key => $val) { |
|
| 1237 | + $options['arguments'][$key]['name'] = $key; |
|
| 1238 | 1238 | } |
| 1239 | - } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { |
|
| 1240 | - foreach ( $options as $key => $val ) { |
|
| 1241 | - $options[ $key ]['name'] = $key; |
|
| 1239 | + } elseif ($arguments && is_array($options) && !empty($options)) { |
|
| 1240 | + foreach ($options as $key => $val) { |
|
| 1241 | + $options[$key]['name'] = $key; |
|
| 1242 | 1242 | } |
| 1243 | 1243 | } |
| 1244 | 1244 | |
@@ -1251,8 +1251,8 @@ discard block |
||
| 1251 | 1251 | * @since 1.0.0 |
| 1252 | 1252 | */ |
| 1253 | 1253 | public function register_shortcode() { |
| 1254 | - add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) ); |
|
| 1255 | - add_action( 'wp_ajax_super_duper_output_shortcode', array( __CLASS__, 'render_shortcode' ) ); |
|
| 1254 | + add_shortcode($this->base_id, array($this, 'shortcode_output')); |
|
| 1255 | + add_action('wp_ajax_super_duper_output_shortcode', array(__CLASS__, 'render_shortcode')); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | /** |
@@ -1262,33 +1262,33 @@ discard block |
||
| 1262 | 1262 | */ |
| 1263 | 1263 | public static function render_shortcode() { |
| 1264 | 1264 | |
| 1265 | - check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); |
|
| 1266 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 1265 | + check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true); |
|
| 1266 | + if (!current_user_can('manage_options')) { |
|
| 1267 | 1267 | wp_die(); |
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | // we might need the $post value here so lets set it. |
| 1271 | - if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) { |
|
| 1272 | - $post_obj = get_post( absint( $_POST['post_id'] ) ); |
|
| 1273 | - if ( ! empty( $post_obj ) && empty( $post ) ) { |
|
| 1271 | + if (isset($_POST['post_id']) && $_POST['post_id']) { |
|
| 1272 | + $post_obj = get_post(absint($_POST['post_id'])); |
|
| 1273 | + if (!empty($post_obj) && empty($post)) { |
|
| 1274 | 1274 | global $post; |
| 1275 | 1275 | $post = $post_obj; |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | - if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { |
|
| 1280 | - $shortcode_name = sanitize_title_with_dashes( $_POST['shortcode'] ); |
|
| 1281 | - $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
| 1279 | + if (isset($_POST['shortcode']) && $_POST['shortcode']) { |
|
| 1280 | + $shortcode_name = sanitize_title_with_dashes($_POST['shortcode']); |
|
| 1281 | + $attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
| 1282 | 1282 | $attributes = ''; |
| 1283 | - if ( ! empty( $attributes_array ) ) { |
|
| 1284 | - foreach ( $attributes_array as $key => $value ) { |
|
| 1285 | - $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . wp_slash( $value ) . "' "; |
|
| 1283 | + if (!empty($attributes_array)) { |
|
| 1284 | + foreach ($attributes_array as $key => $value) { |
|
| 1285 | + $attributes .= " " . sanitize_title_with_dashes($key) . "='" . wp_slash($value) . "' "; |
|
| 1286 | 1286 | } |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | $shortcode = "[" . $shortcode_name . " " . $attributes . "]"; |
| 1290 | 1290 | |
| 1291 | - echo do_shortcode( $shortcode ); |
|
| 1291 | + echo do_shortcode($shortcode); |
|
| 1292 | 1292 | |
| 1293 | 1293 | } |
| 1294 | 1294 | wp_die(); |
@@ -1302,37 +1302,37 @@ discard block |
||
| 1302 | 1302 | * |
| 1303 | 1303 | * @return string |
| 1304 | 1304 | */ |
| 1305 | - public function shortcode_output( $args = array(), $content = '' ) { |
|
| 1306 | - $args = self::argument_values( $args ); |
|
| 1305 | + public function shortcode_output($args = array(), $content = '') { |
|
| 1306 | + $args = self::argument_values($args); |
|
| 1307 | 1307 | |
| 1308 | 1308 | // add extra argument so we know its a output to gutenberg |
| 1309 | 1309 | //$args |
| 1310 | - $args = $this->string_to_bool( $args ); |
|
| 1310 | + $args = $this->string_to_bool($args); |
|
| 1311 | 1311 | |
| 1312 | 1312 | |
| 1313 | - $calss = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; |
|
| 1313 | + $calss = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : ''; |
|
| 1314 | 1314 | |
| 1315 | - $calss = apply_filters( 'wp_super_duper_div_classname', $calss, $args, $this ); |
|
| 1316 | - $calss = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $calss, $args, $this ); |
|
| 1315 | + $calss = apply_filters('wp_super_duper_div_classname', $calss, $args, $this); |
|
| 1316 | + $calss = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $calss, $args, $this); |
|
| 1317 | 1317 | |
| 1318 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
| 1319 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
| 1318 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
| 1319 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
| 1320 | 1320 | |
| 1321 | 1321 | $shortcode_args = array(); |
| 1322 | 1322 | $output = ''; |
| 1323 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
| 1324 | - $main_content = $this->output( $args, $shortcode_args, $content ); |
|
| 1325 | - if ( $main_content && ! $no_wrap ) { |
|
| 1323 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
| 1324 | + $main_content = $this->output($args, $shortcode_args, $content); |
|
| 1325 | + if ($main_content && !$no_wrap) { |
|
| 1326 | 1326 | // wrap the shortcode in a dive with the same class as the widget |
| 1327 | 1327 | $output .= '<div class="' . $calss . '" ' . $attrs . '>'; |
| 1328 | - if ( ! empty( $args['title'] ) ) { |
|
| 1328 | + if (!empty($args['title'])) { |
|
| 1329 | 1329 | // if its a shortcode and there is a title try to grab the title wrappers |
| 1330 | - $shortcode_args = array( 'before_title' => '', 'after_title' => '' ); |
|
| 1331 | - if ( empty( $instance ) ) { |
|
| 1330 | + $shortcode_args = array('before_title' => '', 'after_title' => ''); |
|
| 1331 | + if (empty($instance)) { |
|
| 1332 | 1332 | global $wp_registered_sidebars; |
| 1333 | - if ( ! empty( $wp_registered_sidebars ) ) { |
|
| 1334 | - foreach ( $wp_registered_sidebars as $sidebar ) { |
|
| 1335 | - if ( ! empty( $sidebar['before_title'] ) ) { |
|
| 1333 | + if (!empty($wp_registered_sidebars)) { |
|
| 1334 | + foreach ($wp_registered_sidebars as $sidebar) { |
|
| 1335 | + if (!empty($sidebar['before_title'])) { |
|
| 1336 | 1336 | $shortcode_args['before_title'] = $sidebar['before_title']; |
| 1337 | 1337 | $shortcode_args['after_title'] = $sidebar['after_title']; |
| 1338 | 1338 | break; |
@@ -1340,20 +1340,20 @@ discard block |
||
| 1340 | 1340 | } |
| 1341 | 1341 | } |
| 1342 | 1342 | } |
| 1343 | - $output .= $this->output_title( $shortcode_args, $args ); |
|
| 1343 | + $output .= $this->output_title($shortcode_args, $args); |
|
| 1344 | 1344 | } |
| 1345 | 1345 | $output .= $main_content; |
| 1346 | 1346 | $output .= '</div>'; |
| 1347 | - } elseif ( $main_content && $no_wrap ) { |
|
| 1347 | + } elseif ($main_content && $no_wrap) { |
|
| 1348 | 1348 | $output .= $main_content; |
| 1349 | 1349 | } |
| 1350 | 1350 | |
| 1351 | 1351 | // if preview show a placeholder if empty |
| 1352 | - if ( $this->is_preview() && $output == '' ) { |
|
| 1353 | - $output = $this->preview_placeholder_text( "[{" . $this->base_id . "}]" ); |
|
| 1352 | + if ($this->is_preview() && $output == '') { |
|
| 1353 | + $output = $this->preview_placeholder_text("[{" . $this->base_id . "}]"); |
|
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | - return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); |
|
| 1356 | + return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this); |
|
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | /** |
@@ -1363,8 +1363,8 @@ discard block |
||
| 1363 | 1363 | * |
| 1364 | 1364 | * @return string |
| 1365 | 1365 | */ |
| 1366 | - public function preview_placeholder_text( $name = '' ) { |
|
| 1367 | - return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>"; |
|
| 1366 | + public function preview_placeholder_text($name = '') { |
|
| 1367 | + return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf(__('Placeholder for: %s'), $name) . "</div>"; |
|
| 1368 | 1368 | } |
| 1369 | 1369 | |
| 1370 | 1370 | /** |
@@ -1374,13 +1374,13 @@ discard block |
||
| 1374 | 1374 | * |
| 1375 | 1375 | * @return mixed |
| 1376 | 1376 | */ |
| 1377 | - public function string_to_bool( $options ) { |
|
| 1377 | + public function string_to_bool($options) { |
|
| 1378 | 1378 | // convert bool strings to booleans |
| 1379 | - foreach ( $options as $key => $val ) { |
|
| 1380 | - if ( $val == 'false' ) { |
|
| 1381 | - $options[ $key ] = false; |
|
| 1382 | - } elseif ( $val == 'true' ) { |
|
| 1383 | - $options[ $key ] = true; |
|
| 1379 | + foreach ($options as $key => $val) { |
|
| 1380 | + if ($val == 'false') { |
|
| 1381 | + $options[$key] = false; |
|
| 1382 | + } elseif ($val == 'true') { |
|
| 1383 | + $options[$key] = true; |
|
| 1384 | 1384 | } |
| 1385 | 1385 | } |
| 1386 | 1386 | |
@@ -1396,27 +1396,27 @@ discard block |
||
| 1396 | 1396 | * |
| 1397 | 1397 | * @return array |
| 1398 | 1398 | */ |
| 1399 | - public function argument_values( $instance ) { |
|
| 1399 | + public function argument_values($instance) { |
|
| 1400 | 1400 | $argument_values = array(); |
| 1401 | 1401 | |
| 1402 | 1402 | // set widget instance |
| 1403 | 1403 | $this->instance = $instance; |
| 1404 | 1404 | |
| 1405 | - if ( empty( $this->arguments ) ) { |
|
| 1405 | + if (empty($this->arguments)) { |
|
| 1406 | 1406 | $this->arguments = $this->get_arguments(); |
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | - if ( ! empty( $this->arguments ) ) { |
|
| 1410 | - foreach ( $this->arguments as $key => $args ) { |
|
| 1409 | + if (!empty($this->arguments)) { |
|
| 1410 | + foreach ($this->arguments as $key => $args) { |
|
| 1411 | 1411 | // set the input name from the key |
| 1412 | 1412 | $args['name'] = $key; |
| 1413 | 1413 | // |
| 1414 | - $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
|
| 1415 | - if($args['type']=='checkbox' && $argument_values[ $key ] == ''){ |
|
| 1414 | + $argument_values[$key] = isset($instance[$key]) ? $instance[$key] : ''; |
|
| 1415 | + if ($args['type'] == 'checkbox' && $argument_values[$key] == '') { |
|
| 1416 | 1416 | // don't set default for an empty checkbox |
| 1417 | 1417 | } |
| 1418 | - elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
| 1419 | - $argument_values[ $key ] = $args['default']; |
|
| 1418 | + elseif ($argument_values[$key] == '' && isset($args['default'])) { |
|
| 1419 | + $argument_values[$key] = $args['default']; |
|
| 1420 | 1420 | } |
| 1421 | 1421 | } |
| 1422 | 1422 | } |
@@ -1443,12 +1443,12 @@ discard block |
||
| 1443 | 1443 | * @return array Get arguments. |
| 1444 | 1444 | */ |
| 1445 | 1445 | public function get_arguments() { |
| 1446 | - if ( empty( $this->arguments ) ) { |
|
| 1446 | + if (empty($this->arguments)) { |
|
| 1447 | 1447 | $this->arguments = $this->set_arguments(); |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | - $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance ); |
|
| 1451 | - $this->arguments = $this->add_name_from_key( $this->arguments, true ); |
|
| 1450 | + $this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance); |
|
| 1451 | + $this->arguments = $this->add_name_from_key($this->arguments, true); |
|
| 1452 | 1452 | |
| 1453 | 1453 | return $this->arguments; |
| 1454 | 1454 | } |
@@ -1460,7 +1460,7 @@ discard block |
||
| 1460 | 1460 | * @param array $widget_args |
| 1461 | 1461 | * @param string $content |
| 1462 | 1462 | */ |
| 1463 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
| 1463 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
| 1464 | 1464 | |
| 1465 | 1465 | } |
| 1466 | 1466 | |
@@ -1468,10 +1468,10 @@ discard block |
||
| 1468 | 1468 | * Add the dynamic block code inline when the wp-block in enqueued. |
| 1469 | 1469 | */ |
| 1470 | 1470 | public function register_block() { |
| 1471 | - wp_add_inline_script( 'wp-blocks', $this->block() ); |
|
| 1472 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
| 1471 | + wp_add_inline_script('wp-blocks', $this->block()); |
|
| 1472 | + if (class_exists('SiteOrigin_Panels')) { |
|
| 1473 | 1473 | |
| 1474 | - wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() ); |
|
| 1474 | + wp_add_inline_script('wp-blocks', $this->siteorigin_js()); |
|
| 1475 | 1475 | |
| 1476 | 1476 | } |
| 1477 | 1477 | } |
@@ -1486,13 +1486,13 @@ discard block |
||
| 1486 | 1486 | $show = false; |
| 1487 | 1487 | $arguments = $this->arguments; |
| 1488 | 1488 | |
| 1489 | - if ( empty( $arguments ) ) { |
|
| 1489 | + if (empty($arguments)) { |
|
| 1490 | 1490 | $arguments = $this->get_arguments(); |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | - if ( ! empty( $arguments ) ) { |
|
| 1494 | - foreach ( $arguments as $argument ) { |
|
| 1495 | - if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { |
|
| 1493 | + if (!empty($arguments)) { |
|
| 1494 | + foreach ($arguments as $argument) { |
|
| 1495 | + if (isset($argument['advanced']) && $argument['advanced']) { |
|
| 1496 | 1496 | $show = true; |
| 1497 | 1497 | break; // no need to continue if we know we have it |
| 1498 | 1498 | } |
@@ -1511,15 +1511,15 @@ discard block |
||
| 1511 | 1511 | |
| 1512 | 1512 | $url = $this->url; |
| 1513 | 1513 | |
| 1514 | - if(!$url){ |
|
| 1514 | + if (!$url) { |
|
| 1515 | 1515 | // check if we are inside a plugin |
| 1516 | - $file_dir = str_replace("/includes","", dirname( __FILE__ )); |
|
| 1516 | + $file_dir = str_replace("/includes", "", dirname(__FILE__)); |
|
| 1517 | 1517 | |
| 1518 | - $dir_parts = explode("/wp-content/",$file_dir); |
|
| 1519 | - $url_parts = explode("/wp-content/",plugins_url()); |
|
| 1518 | + $dir_parts = explode("/wp-content/", $file_dir); |
|
| 1519 | + $url_parts = explode("/wp-content/", plugins_url()); |
|
| 1520 | 1520 | |
| 1521 | - if(!empty($url_parts[0]) && !empty($dir_parts[1])){ |
|
| 1522 | - $url = trailingslashit( $url_parts[0]."/wp-content/".$dir_parts[1] ); |
|
| 1521 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
| 1522 | + $url = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]); |
|
| 1523 | 1523 | $this->url = $url; |
| 1524 | 1524 | } |
| 1525 | 1525 | } |
@@ -1538,46 +1538,46 @@ discard block |
||
| 1538 | 1538 | * @since 1.1.0 |
| 1539 | 1539 | * @return string |
| 1540 | 1540 | */ |
| 1541 | - public function get_block_icon($icon){ |
|
| 1541 | + public function get_block_icon($icon) { |
|
| 1542 | 1542 | |
| 1543 | 1543 | // check if we have a Font Awesome icon |
| 1544 | 1544 | $fa_type = ''; |
| 1545 | - if(substr( $icon, 0, 7 ) === "fas fa-"){ |
|
| 1545 | + if (substr($icon, 0, 7) === "fas fa-") { |
|
| 1546 | 1546 | $fa_type = 'solid'; |
| 1547 | - }elseif(substr( $icon, 0, 7 ) === "far fa-"){ |
|
| 1547 | + }elseif (substr($icon, 0, 7) === "far fa-") { |
|
| 1548 | 1548 | $fa_type = 'regular'; |
| 1549 | - }elseif(substr( $icon, 0, 7 ) === "fab fa-"){ |
|
| 1549 | + }elseif (substr($icon, 0, 7) === "fab fa-") { |
|
| 1550 | 1550 | $fa_type = 'brands'; |
| 1551 | - }else{ |
|
| 1552 | - $icon = "'".$icon."'"; |
|
| 1551 | + } else { |
|
| 1552 | + $icon = "'" . $icon . "'"; |
|
| 1553 | 1553 | } |
| 1554 | 1554 | |
| 1555 | 1555 | // set the icon if we found one |
| 1556 | - if($fa_type){ |
|
| 1557 | - $fa_icon = str_replace(array("fas fa-","far fa-","fab fa-"),"",$icon); |
|
| 1558 | - $icon = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '".$this->get_url()."icons/".$fa_type.".svg#".$fa_icon."','href': '".$this->get_url()."icons/".$fa_type.".svg#".$fa_icon."'}))"; |
|
| 1556 | + if ($fa_type) { |
|
| 1557 | + $fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon); |
|
| 1558 | + $icon = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))"; |
|
| 1559 | 1559 | } |
| 1560 | 1560 | |
| 1561 | 1561 | return $icon; |
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | - public function group_arguments($arguments){ |
|
| 1564 | + public function group_arguments($arguments) { |
|
| 1565 | 1565 | // echo '###';print_r($arguments); |
| 1566 | - if(!empty($arguments)){ |
|
| 1566 | + if (!empty($arguments)) { |
|
| 1567 | 1567 | $temp_arguments = array(); |
| 1568 | 1568 | $general = __("General"); |
| 1569 | 1569 | $add_sections = false; |
| 1570 | - foreach($arguments as $key => $args){ |
|
| 1571 | - if(isset($args['group'])){ |
|
| 1570 | + foreach ($arguments as $key => $args) { |
|
| 1571 | + if (isset($args['group'])) { |
|
| 1572 | 1572 | $temp_arguments[$args['group']][$key] = $args; |
| 1573 | 1573 | $add_sections = true; |
| 1574 | - }else{ |
|
| 1574 | + } else { |
|
| 1575 | 1575 | $temp_arguments[$general][$key] = $args; |
| 1576 | 1576 | } |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | 1579 | // only add sections if more than one |
| 1580 | - if($add_sections){ |
|
| 1580 | + if ($add_sections) { |
|
| 1581 | 1581 | $arguments = $temp_arguments; |
| 1582 | 1582 | } |
| 1583 | 1583 | } |
@@ -1629,19 +1629,19 @@ discard block |
||
| 1629 | 1629 | * @return {?WPBlock} The block, if it has been successfully |
| 1630 | 1630 | * registered; otherwise `undefined`. |
| 1631 | 1631 | */ |
| 1632 | - registerBlockType('<?php echo str_replace( "_", "-", sanitize_title_with_dashes( $this->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->options['class_name'] ) ); ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block. |
|
| 1633 | - title: '<?php echo $this->options['name'];?>', // Block title. |
|
| 1634 | - description: '<?php echo esc_attr( $this->options['widget_ops']['description'] )?>', // Block title. |
|
| 1635 | - icon: <?php echo $this->get_block_icon($this->options['block-icon']);?>,//'<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/. |
|
| 1632 | + registerBlockType('<?php echo str_replace("_", "-", sanitize_title_with_dashes($this->options['textdomain']) . '/' . sanitize_title_with_dashes($this->options['class_name'])); ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block. |
|
| 1633 | + title: '<?php echo $this->options['name']; ?>', // Block title. |
|
| 1634 | + description: '<?php echo esc_attr($this->options['widget_ops']['description'])?>', // Block title. |
|
| 1635 | + icon: <?php echo $this->get_block_icon($this->options['block-icon']); ?>,//'<?php echo isset($this->options['block-icon']) ? esc_attr($this->options['block-icon']) : 'shield-alt'; ?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/. |
|
| 1636 | 1636 | supports: { |
| 1637 | 1637 | <?php |
| 1638 | - if(isset($this->options['block-supports'])){ |
|
| 1639 | - echo $this->array_to_attributes( $this->options['block-supports'] ); |
|
| 1638 | + if (isset($this->options['block-supports'])) { |
|
| 1639 | + echo $this->array_to_attributes($this->options['block-supports']); |
|
| 1640 | 1640 | } |
| 1641 | 1641 | ?> |
| 1642 | 1642 | }, |
| 1643 | - category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed. |
|
| 1644 | - <?php if ( isset( $this->options['block-keywords'] ) ) { |
|
| 1643 | + category: '<?php echo isset($this->options['block-category']) ? esc_attr($this->options['block-category']) : 'common'; ?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed. |
|
| 1644 | + <?php if (isset($this->options['block-keywords'])) { |
|
| 1645 | 1645 | echo "keywords : " . $this->options['block-keywords'] . ","; |
| 1646 | 1646 | }?> |
| 1647 | 1647 | |
@@ -1656,10 +1656,10 @@ discard block |
||
| 1656 | 1656 | echo " html: false"; |
| 1657 | 1657 | echo "},";*/ |
| 1658 | 1658 | |
| 1659 | - if ( ! empty( $this->arguments ) ) { |
|
| 1659 | + if (!empty($this->arguments)) { |
|
| 1660 | 1660 | echo "attributes : {"; |
| 1661 | 1661 | |
| 1662 | - if ( $show_advanced ) { |
|
| 1662 | + if ($show_advanced) { |
|
| 1663 | 1663 | echo "show_advanced: {"; |
| 1664 | 1664 | echo " type: 'boolean',"; |
| 1665 | 1665 | echo " default: false,"; |
@@ -1667,41 +1667,41 @@ discard block |
||
| 1667 | 1667 | } |
| 1668 | 1668 | |
| 1669 | 1669 | // block wrap element |
| 1670 | - if ( isset( $this->options['block-wrap'] ) ) { //@todo we should validate this? |
|
| 1670 | + if (isset($this->options['block-wrap'])) { //@todo we should validate this? |
|
| 1671 | 1671 | echo "block_wrap: {"; |
| 1672 | 1672 | echo " type: 'string',"; |
| 1673 | - echo " default: '" . esc_attr( $this->options['block-wrap'] ) . "',"; |
|
| 1673 | + echo " default: '" . esc_attr($this->options['block-wrap']) . "',"; |
|
| 1674 | 1674 | echo "},"; |
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | - foreach ( $this->arguments as $key => $args ) { |
|
| 1677 | + foreach ($this->arguments as $key => $args) { |
|
| 1678 | 1678 | |
| 1679 | 1679 | // set if we should show alignment |
| 1680 | - if ( $key == 'alignment' ) { |
|
| 1680 | + if ($key == 'alignment') { |
|
| 1681 | 1681 | $show_alignment = true; |
| 1682 | 1682 | } |
| 1683 | 1683 | |
| 1684 | 1684 | $extra = ''; |
| 1685 | 1685 | |
| 1686 | - if ( $args['type'] == 'checkbox' ) { |
|
| 1686 | + if ($args['type'] == 'checkbox') { |
|
| 1687 | 1687 | $type = 'boolean'; |
| 1688 | - $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false'; |
|
| 1689 | - } elseif ( $args['type'] == 'number' ) { |
|
| 1688 | + $default = isset($args['default']) && $args['default'] ? 'true' : 'false'; |
|
| 1689 | + } elseif ($args['type'] == 'number') { |
|
| 1690 | 1690 | $type = 'number'; |
| 1691 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
| 1692 | - } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) { |
|
| 1691 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
| 1692 | + } elseif ($args['type'] == 'select' && !empty($args['multiple'])) { |
|
| 1693 | 1693 | $type = 'array'; |
| 1694 | - if ( is_array( $args['default'] ) ) { |
|
| 1695 | - $default = isset( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]"; |
|
| 1694 | + if (is_array($args['default'])) { |
|
| 1695 | + $default = isset($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]"; |
|
| 1696 | 1696 | } else { |
| 1697 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
| 1697 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
| 1698 | 1698 | } |
| 1699 | - } elseif ( $args['type'] == 'multiselect' ) { |
|
| 1699 | + } elseif ($args['type'] == 'multiselect') { |
|
| 1700 | 1700 | $type = 'array'; |
| 1701 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
| 1701 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
| 1702 | 1702 | } else { |
| 1703 | 1703 | $type = 'string'; |
| 1704 | - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; |
|
| 1704 | + $default = isset($args['default']) ? "'" . $args['default'] . "'" : "''"; |
|
| 1705 | 1705 | } |
| 1706 | 1706 | echo $key . " : {"; |
| 1707 | 1707 | echo "type : '$type',"; |
@@ -1732,12 +1732,12 @@ discard block |
||
| 1732 | 1732 | is_fetching = true; |
| 1733 | 1733 | var data = { |
| 1734 | 1734 | 'action': 'super_duper_output_shortcode', |
| 1735 | - 'shortcode': '<?php echo $this->options['base_id'];?>', |
|
| 1735 | + 'shortcode': '<?php echo $this->options['base_id']; ?>', |
|
| 1736 | 1736 | 'attributes': props.attributes, |
| 1737 | - 'post_id': <?php global $post; if ( isset( $post->ID ) ) { |
|
| 1737 | + 'post_id': <?php global $post; if (isset($post->ID)) { |
|
| 1738 | 1738 | echo $post->ID; |
| 1739 | 1739 | }?>, |
| 1740 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
| 1740 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
| 1741 | 1741 | }; |
| 1742 | 1742 | |
| 1743 | 1743 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1746,7 +1746,7 @@ discard block |
||
| 1746 | 1746 | |
| 1747 | 1747 | // if the content is empty then we place some placeholder text |
| 1748 | 1748 | if (env == '') { |
| 1749 | - env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for: ' );?>" + props.name + "</div>"; |
|
| 1749 | + env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for: '); ?>" + props.name + "</div>"; |
|
| 1750 | 1750 | } |
| 1751 | 1751 | |
| 1752 | 1752 | props.setAttributes({content: env}); |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | |
| 1766 | 1766 | el(wp.editor.BlockControls, {key: 'controls'}, |
| 1767 | 1767 | |
| 1768 | - <?php if($show_alignment){?> |
|
| 1768 | + <?php if ($show_alignment) {?> |
|
| 1769 | 1769 | el( |
| 1770 | 1770 | wp.editor.AlignmentToolbar, |
| 1771 | 1771 | { |
@@ -1783,9 +1783,9 @@ discard block |
||
| 1783 | 1783 | |
| 1784 | 1784 | <?php |
| 1785 | 1785 | |
| 1786 | - if(! empty( $this->arguments )){ |
|
| 1786 | + if (!empty($this->arguments)) { |
|
| 1787 | 1787 | |
| 1788 | - if ( $show_advanced ) { |
|
| 1788 | + if ($show_advanced) { |
|
| 1789 | 1789 | ?> |
| 1790 | 1790 | el( |
| 1791 | 1791 | wp.components.ToggleControl, |
@@ -1807,17 +1807,17 @@ discard block |
||
| 1807 | 1807 | $has_sections = $arguments == $this->arguments ? false : true; |
| 1808 | 1808 | |
| 1809 | 1809 | |
| 1810 | - if($has_sections){ |
|
| 1810 | + if ($has_sections) { |
|
| 1811 | 1811 | $panel_count = 0; |
| 1812 | - foreach($arguments as $key => $args){ |
|
| 1812 | + foreach ($arguments as $key => $args) { |
|
| 1813 | 1813 | ?> |
| 1814 | 1814 | el(wp.components.PanelBody, { |
| 1815 | 1815 | title: '<?php esc_attr_e($key); ?>', |
| 1816 | - initialOpen: <?php if($panel_count){echo "false";}else{echo "true";}?> |
|
| 1816 | + initialOpen: <?php if ($panel_count) {echo "false"; } else {echo "true"; }?> |
|
| 1817 | 1817 | }, |
| 1818 | 1818 | <?php |
| 1819 | 1819 | |
| 1820 | - foreach($args as $k => $a){ |
|
| 1820 | + foreach ($args as $k => $a) { |
|
| 1821 | 1821 | $this->build_block_arguments($k, $a); |
| 1822 | 1822 | } |
| 1823 | 1823 | ?> |
@@ -1826,8 +1826,8 @@ discard block |
||
| 1826 | 1826 | $panel_count++; |
| 1827 | 1827 | |
| 1828 | 1828 | } |
| 1829 | - }else{ |
|
| 1830 | - foreach($this->arguments as $key => $args){ |
|
| 1829 | + } else { |
|
| 1830 | + foreach ($this->arguments as $key => $args) { |
|
| 1831 | 1831 | $this->build_block_arguments($key, $args); |
| 1832 | 1832 | } |
| 1833 | 1833 | } |
@@ -1841,9 +1841,9 @@ discard block |
||
| 1841 | 1841 | |
| 1842 | 1842 | <?php |
| 1843 | 1843 | // If the user sets block-output array then build it |
| 1844 | - if ( ! empty( $this->options['block-output'] ) ) { |
|
| 1845 | - $this->block_element( $this->options['block-output'] ); |
|
| 1846 | - }else{ |
|
| 1844 | + if (!empty($this->options['block-output'])) { |
|
| 1845 | + $this->block_element($this->options['block-output']); |
|
| 1846 | + } else { |
|
| 1847 | 1847 | // if no block-output is set then we try and get the shortcode html output via ajax. |
| 1848 | 1848 | ?> |
| 1849 | 1849 | el('div', { |
@@ -1867,14 +1867,14 @@ discard block |
||
| 1867 | 1867 | var align = ''; |
| 1868 | 1868 | |
| 1869 | 1869 | // build the shortcode. |
| 1870 | - var content = "[<?php echo $this->options['base_id'];?>"; |
|
| 1870 | + var content = "[<?php echo $this->options['base_id']; ?>"; |
|
| 1871 | 1871 | <?php |
| 1872 | 1872 | |
| 1873 | - if(! empty( $this->arguments )){ |
|
| 1874 | - foreach($this->arguments as $key => $args){ |
|
| 1873 | + if (!empty($this->arguments)) { |
|
| 1874 | + foreach ($this->arguments as $key => $args) { |
|
| 1875 | 1875 | ?> |
| 1876 | - if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
| 1877 | - content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>+ "' "; |
|
| 1876 | + if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
| 1877 | + content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>+ "' "; |
|
| 1878 | 1878 | } |
| 1879 | 1879 | <?php |
| 1880 | 1880 | } |
@@ -1915,82 +1915,82 @@ discard block |
||
| 1915 | 1915 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1916 | 1916 | */ |
| 1917 | 1917 | |
| 1918 | - return str_replace( array( |
|
| 1918 | + return str_replace(array( |
|
| 1919 | 1919 | '<script>', |
| 1920 | 1920 | '</script>' |
| 1921 | - ), '', $output ); |
|
| 1921 | + ), '', $output); |
|
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | - public function build_block_arguments($key,$args){ |
|
| 1925 | - $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : ''; |
|
| 1924 | + public function build_block_arguments($key, $args) { |
|
| 1925 | + $custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : ''; |
|
| 1926 | 1926 | $options = ''; |
| 1927 | 1927 | $extra = ''; |
| 1928 | 1928 | $require = ''; |
| 1929 | 1929 | $onchange = "props.setAttributes({ $key: $key } )"; |
| 1930 | 1930 | $value = "props.attributes.$key"; |
| 1931 | - $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'color' ); |
|
| 1932 | - if ( in_array( $args['type'], $text_type ) ) { |
|
| 1931 | + $text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'color'); |
|
| 1932 | + if (in_array($args['type'], $text_type)) { |
|
| 1933 | 1933 | $type = 'TextControl'; |
| 1934 | 1934 | // Save numbers as numbers and not strings |
| 1935 | - if ( $args['type'] == 'number' ) { |
|
| 1935 | + if ($args['type'] == 'number') { |
|
| 1936 | 1936 | $onchange = "props.setAttributes({ $key: Number($key) } )"; |
| 1937 | 1937 | } |
| 1938 | 1938 | } |
| 1939 | 1939 | // elseif ( $args['type'] == 'color' ) { //@todo ColorPicker labels are not shown yet, we use html5 color input for now https://github.com/WordPress/gutenberg/issues/14378 |
| 1940 | 1940 | // $type = 'ColorPicker'; |
| 1941 | 1941 | // } |
| 1942 | - elseif ( $args['type'] == 'checkbox' ) { |
|
| 1942 | + elseif ($args['type'] == 'checkbox') { |
|
| 1943 | 1943 | $type = 'CheckboxControl'; |
| 1944 | 1944 | $extra .= "checked: props.attributes.$key,"; |
| 1945 | 1945 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
| 1946 | - } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { |
|
| 1946 | + } elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') { |
|
| 1947 | 1947 | $type = 'SelectControl'; |
| 1948 | - if ( ! empty( $args['options'] ) ) { |
|
| 1948 | + if (!empty($args['options'])) { |
|
| 1949 | 1949 | $options .= "options : ["; |
| 1950 | - foreach ( $args['options'] as $option_val => $option_label ) { |
|
| 1951 | - $options .= "{ value : '" . esc_attr( $option_val ) . "', label : '" . esc_attr( $option_label ) . "' },"; |
|
| 1950 | + foreach ($args['options'] as $option_val => $option_label) { |
|
| 1951 | + $options .= "{ value : '" . esc_attr($option_val) . "', label : '" . esc_attr($option_label) . "' },"; |
|
| 1952 | 1952 | } |
| 1953 | 1953 | $options .= "],"; |
| 1954 | 1954 | } |
| 1955 | - if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
| 1955 | + if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
| 1956 | 1956 | $extra .= ' multiple: true, '; |
| 1957 | 1957 | //$onchange = "props.setAttributes({ $key: ['edit'] } )"; |
| 1958 | 1958 | //$value = "['edit', 'delete']"; |
| 1959 | 1959 | } |
| 1960 | - } elseif ( $args['type'] == 'alignment' ) { |
|
| 1960 | + } elseif ($args['type'] == 'alignment') { |
|
| 1961 | 1961 | $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example |
| 1962 | 1962 | } else { |
| 1963 | - return;// if we have not implemented the control then don't break the JS. |
|
| 1963 | + return; // if we have not implemented the control then don't break the JS. |
|
| 1964 | 1964 | } |
| 1965 | 1965 | |
| 1966 | 1966 | // add show only if advanced |
| 1967 | - if ( ! empty( $args['advanced'] ) ) { |
|
| 1967 | + if (!empty($args['advanced'])) { |
|
| 1968 | 1968 | echo "props.attributes.show_advanced && "; |
| 1969 | 1969 | } |
| 1970 | 1970 | // add setting require if defined |
| 1971 | - if ( ! empty( $args['element_require'] ) ) { |
|
| 1972 | - echo $this->block_props_replace( $args['element_require'], true ) . " && "; |
|
| 1971 | + if (!empty($args['element_require'])) { |
|
| 1972 | + echo $this->block_props_replace($args['element_require'], true) . " && "; |
|
| 1973 | 1973 | } |
| 1974 | 1974 | ?> |
| 1975 | 1975 | el( |
| 1976 | - wp.components.<?php echo esc_attr( $type );?>, |
|
| 1976 | + wp.components.<?php echo esc_attr($type); ?>, |
|
| 1977 | 1977 | { |
| 1978 | - label: '<?php echo esc_attr( $args['title'] );?>', |
|
| 1979 | - help: '<?php if ( isset( $args['desc'] ) ) { |
|
| 1980 | - echo esc_attr( $args['desc'] ); |
|
| 1978 | + label: '<?php echo esc_attr($args['title']); ?>', |
|
| 1979 | + help: '<?php if (isset($args['desc'])) { |
|
| 1980 | + echo esc_attr($args['desc']); |
|
| 1981 | 1981 | }?>', |
| 1982 | - value: <?php echo $value;?>, |
|
| 1983 | - <?php if ( $type == 'TextControl' && $args['type'] != 'text' ) { |
|
| 1984 | - echo "type: '" . esc_attr( $args['type'] ) . "',"; |
|
| 1982 | + value: <?php echo $value; ?>, |
|
| 1983 | + <?php if ($type == 'TextControl' && $args['type'] != 'text') { |
|
| 1984 | + echo "type: '" . esc_attr($args['type']) . "',"; |
|
| 1985 | 1985 | }?> |
| 1986 | - <?php if ( ! empty( $args['placeholder'] ) ) { |
|
| 1987 | - echo "placeholder: '" . esc_attr( $args['placeholder'] ) . "',"; |
|
| 1986 | + <?php if (!empty($args['placeholder'])) { |
|
| 1987 | + echo "placeholder: '" . esc_attr($args['placeholder']) . "',"; |
|
| 1988 | 1988 | }?> |
| 1989 | - <?php echo $options;?> |
|
| 1990 | - <?php echo $extra;?> |
|
| 1991 | - <?php echo $custom_attributes;?> |
|
| 1992 | - onChange: function ( <?php echo $key;?> ) { |
|
| 1993 | - <?php echo $onchange;?> |
|
| 1989 | + <?php echo $options; ?> |
|
| 1990 | + <?php echo $extra; ?> |
|
| 1991 | + <?php echo $custom_attributes; ?> |
|
| 1992 | + onChange: function ( <?php echo $key; ?> ) { |
|
| 1993 | + <?php echo $onchange; ?> |
|
| 1994 | 1994 | } |
| 1995 | 1995 | } |
| 1996 | 1996 | ), |
@@ -2006,16 +2006,16 @@ discard block |
||
| 2006 | 2006 | * |
| 2007 | 2007 | * @return string |
| 2008 | 2008 | */ |
| 2009 | - public function array_to_attributes( $custom_attributes, $html = false ) { |
|
| 2009 | + public function array_to_attributes($custom_attributes, $html = false) { |
|
| 2010 | 2010 | $attributes = ''; |
| 2011 | - if ( ! empty( $custom_attributes ) ) { |
|
| 2011 | + if (!empty($custom_attributes)) { |
|
| 2012 | 2012 | |
| 2013 | - if ( $html ) { |
|
| 2014 | - foreach ( $custom_attributes as $key => $val ) { |
|
| 2013 | + if ($html) { |
|
| 2014 | + foreach ($custom_attributes as $key => $val) { |
|
| 2015 | 2015 | $attributes .= " $key='$val' "; |
| 2016 | 2016 | } |
| 2017 | 2017 | } else { |
| 2018 | - foreach ( $custom_attributes as $key => $val ) { |
|
| 2018 | + foreach ($custom_attributes as $key => $val) { |
|
| 2019 | 2019 | $attributes .= "'$key': '$val',"; |
| 2020 | 2020 | } |
| 2021 | 2021 | } |
@@ -2031,86 +2031,86 @@ discard block |
||
| 2031 | 2031 | * |
| 2032 | 2032 | * @param $args |
| 2033 | 2033 | */ |
| 2034 | - public function block_element( $args ) { |
|
| 2034 | + public function block_element($args) { |
|
| 2035 | 2035 | |
| 2036 | 2036 | |
| 2037 | - if ( ! empty( $args ) ) { |
|
| 2038 | - foreach ( $args as $element => $new_args ) { |
|
| 2037 | + if (!empty($args)) { |
|
| 2038 | + foreach ($args as $element => $new_args) { |
|
| 2039 | 2039 | |
| 2040 | - if ( is_array( $new_args ) ) { // its an element |
|
| 2040 | + if (is_array($new_args)) { // its an element |
|
| 2041 | 2041 | |
| 2042 | 2042 | |
| 2043 | - if ( isset( $new_args['element'] ) ) { |
|
| 2043 | + if (isset($new_args['element'])) { |
|
| 2044 | 2044 | |
| 2045 | - if ( isset( $new_args['element_require'] ) ) { |
|
| 2046 | - echo str_replace( array( |
|
| 2045 | + if (isset($new_args['element_require'])) { |
|
| 2046 | + echo str_replace(array( |
|
| 2047 | 2047 | "'+", |
| 2048 | 2048 | "+'" |
| 2049 | - ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; |
|
| 2050 | - unset( $new_args['element_require'] ); |
|
| 2049 | + ), '', $this->block_props_replace($new_args['element_require'])) . " && "; |
|
| 2050 | + unset($new_args['element_require']); |
|
| 2051 | 2051 | } |
| 2052 | 2052 | |
| 2053 | 2053 | echo "\n el( '" . $new_args['element'] . "', {"; |
| 2054 | 2054 | |
| 2055 | 2055 | // get the attributes |
| 2056 | - foreach ( $new_args as $new_key => $new_value ) { |
|
| 2056 | + foreach ($new_args as $new_key => $new_value) { |
|
| 2057 | 2057 | |
| 2058 | 2058 | |
| 2059 | - if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) { |
|
| 2059 | + if ($new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) { |
|
| 2060 | 2060 | // do nothing |
| 2061 | 2061 | } else { |
| 2062 | - echo $this->block_element( array( $new_key => $new_value ) ); |
|
| 2062 | + echo $this->block_element(array($new_key => $new_value)); |
|
| 2063 | 2063 | } |
| 2064 | 2064 | } |
| 2065 | 2065 | |
| 2066 | - echo "},";// end attributes |
|
| 2066 | + echo "},"; // end attributes |
|
| 2067 | 2067 | |
| 2068 | 2068 | // get the content |
| 2069 | 2069 | $first_item = 0; |
| 2070 | - foreach ( $new_args as $new_key => $new_value ) { |
|
| 2071 | - if ( $new_key === 'content' || is_array( $new_value ) ) { |
|
| 2070 | + foreach ($new_args as $new_key => $new_value) { |
|
| 2071 | + if ($new_key === 'content' || is_array($new_value)) { |
|
| 2072 | 2072 | |
| 2073 | - if ( $new_key === 'content' ) { |
|
| 2074 | - echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'"; |
|
| 2073 | + if ($new_key === 'content') { |
|
| 2074 | + echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'"; |
|
| 2075 | 2075 | } |
| 2076 | 2076 | |
| 2077 | - if ( is_array( $new_value ) ) { |
|
| 2077 | + if (is_array($new_value)) { |
|
| 2078 | 2078 | |
| 2079 | - if ( isset( $new_value['element_require'] ) ) { |
|
| 2080 | - echo str_replace( array( |
|
| 2079 | + if (isset($new_value['element_require'])) { |
|
| 2080 | + echo str_replace(array( |
|
| 2081 | 2081 | "'+", |
| 2082 | 2082 | "+'" |
| 2083 | - ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; |
|
| 2084 | - unset( $new_value['element_require'] ); |
|
| 2083 | + ), '', $this->block_props_replace($new_value['element_require'])) . " && "; |
|
| 2084 | + unset($new_value['element_require']); |
|
| 2085 | 2085 | } |
| 2086 | 2086 | |
| 2087 | - if ( isset( $new_value['element_repeat'] ) ) { |
|
| 2087 | + if (isset($new_value['element_repeat'])) { |
|
| 2088 | 2088 | $x = 1; |
| 2089 | - while ( $x <= absint( $new_value['element_repeat'] ) ) { |
|
| 2090 | - $this->block_element( array( '' => $new_value ) ); |
|
| 2091 | - $x ++; |
|
| 2089 | + while ($x <= absint($new_value['element_repeat'])) { |
|
| 2090 | + $this->block_element(array('' => $new_value)); |
|
| 2091 | + $x++; |
|
| 2092 | 2092 | } |
| 2093 | 2093 | } else { |
| 2094 | - $this->block_element( array( '' => $new_value ) ); |
|
| 2094 | + $this->block_element(array('' => $new_value)); |
|
| 2095 | 2095 | } |
| 2096 | 2096 | } |
| 2097 | - $first_item ++; |
|
| 2097 | + $first_item++; |
|
| 2098 | 2098 | } |
| 2099 | 2099 | } |
| 2100 | 2100 | |
| 2101 | - echo ")";// end content |
|
| 2101 | + echo ")"; // end content |
|
| 2102 | 2102 | |
| 2103 | 2103 | echo ", \n"; |
| 2104 | 2104 | |
| 2105 | 2105 | } |
| 2106 | 2106 | } else { |
| 2107 | 2107 | |
| 2108 | - if ( substr( $element, 0, 3 ) === "if_" ) { |
|
| 2109 | - echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ","; |
|
| 2110 | - } elseif ( $element == 'style' ) { |
|
| 2111 | - echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
|
| 2108 | + if (substr($element, 0, 3) === "if_") { |
|
| 2109 | + echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ","; |
|
| 2110 | + } elseif ($element == 'style') { |
|
| 2111 | + echo $element . ": " . $this->block_props_replace($new_args) . ","; |
|
| 2112 | 2112 | } else { |
| 2113 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; |
|
| 2113 | + echo $element . ": '" . $this->block_props_replace($new_args) . "',"; |
|
| 2114 | 2114 | } |
| 2115 | 2115 | |
| 2116 | 2116 | } |
@@ -2125,12 +2125,12 @@ discard block |
||
| 2125 | 2125 | * |
| 2126 | 2126 | * @return mixed |
| 2127 | 2127 | */ |
| 2128 | - public function block_props_replace( $string, $no_wrap = false ) { |
|
| 2128 | + public function block_props_replace($string, $no_wrap = false) { |
|
| 2129 | 2129 | |
| 2130 | - if ( $no_wrap ) { |
|
| 2131 | - $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string ); |
|
| 2130 | + if ($no_wrap) { |
|
| 2131 | + $string = str_replace(array("[%", "%]"), array("props.attributes.", ""), $string); |
|
| 2132 | 2132 | } else { |
| 2133 | - $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string ); |
|
| 2133 | + $string = str_replace(array("[%", "%]"), array("'+props.attributes.", "+'"), $string); |
|
| 2134 | 2134 | } |
| 2135 | 2135 | |
| 2136 | 2136 | return $string; |
@@ -2142,43 +2142,43 @@ discard block |
||
| 2142 | 2142 | * @param array $args |
| 2143 | 2143 | * @param array $instance |
| 2144 | 2144 | */ |
| 2145 | - public function widget( $args, $instance ) { |
|
| 2145 | + public function widget($args, $instance) { |
|
| 2146 | 2146 | |
| 2147 | 2147 | // get the filtered values |
| 2148 | - $argument_values = $this->argument_values( $instance ); |
|
| 2149 | - $argument_values = $this->string_to_bool( $argument_values ); |
|
| 2150 | - $output = $this->output( $argument_values, $args ); |
|
| 2148 | + $argument_values = $this->argument_values($instance); |
|
| 2149 | + $argument_values = $this->string_to_bool($argument_values); |
|
| 2150 | + $output = $this->output($argument_values, $args); |
|
| 2151 | 2151 | |
| 2152 | 2152 | ob_start(); |
| 2153 | - if ( $output ) { |
|
| 2153 | + if ($output) { |
|
| 2154 | 2154 | // Before widget |
| 2155 | 2155 | $before_widget = $args['before_widget']; |
| 2156 | - $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this ); |
|
| 2157 | - $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this ); |
|
| 2156 | + $before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this); |
|
| 2157 | + $before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this); |
|
| 2158 | 2158 | |
| 2159 | 2159 | // After widget |
| 2160 | 2160 | $after_widget = $args['after_widget']; |
| 2161 | - $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this ); |
|
| 2162 | - $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this ); |
|
| 2161 | + $after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this); |
|
| 2162 | + $after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this); |
|
| 2163 | 2163 | |
| 2164 | 2164 | echo $before_widget; |
| 2165 | 2165 | // elementor strips the widget wrapping div so we check for and add it back if needed |
| 2166 | - if ( $this->is_elementor_widget_output() ) { |
|
| 2167 | - echo ! empty( $this->options['widget_ops']['classname'] ) ? "<span class='" . esc_attr( $this->options['widget_ops']['classname'] ) . "'>" : ''; |
|
| 2166 | + if ($this->is_elementor_widget_output()) { |
|
| 2167 | + echo !empty($this->options['widget_ops']['classname']) ? "<span class='" . esc_attr($this->options['widget_ops']['classname']) . "'>" : ''; |
|
| 2168 | 2168 | } |
| 2169 | - echo $this->output_title( $args, $instance ); |
|
| 2169 | + echo $this->output_title($args, $instance); |
|
| 2170 | 2170 | echo $output; |
| 2171 | - if ( $this->is_elementor_widget_output() ) { |
|
| 2172 | - echo ! empty( $this->options['widget_ops']['classname'] ) ? "</span>" : ''; |
|
| 2171 | + if ($this->is_elementor_widget_output()) { |
|
| 2172 | + echo !empty($this->options['widget_ops']['classname']) ? "</span>" : ''; |
|
| 2173 | 2173 | } |
| 2174 | 2174 | echo $after_widget; |
| 2175 | - } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty |
|
| 2176 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
| 2175 | + } elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty |
|
| 2176 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
| 2177 | 2177 | echo $output; |
| 2178 | 2178 | } |
| 2179 | 2179 | $output = ob_get_clean(); |
| 2180 | 2180 | |
| 2181 | - $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); |
|
| 2181 | + $output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this); |
|
| 2182 | 2182 | |
| 2183 | 2183 | echo $output; |
| 2184 | 2184 | } |
@@ -2191,7 +2191,7 @@ discard block |
||
| 2191 | 2191 | */ |
| 2192 | 2192 | public function is_elementor_widget_output() { |
| 2193 | 2193 | $result = false; |
| 2194 | - if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { |
|
| 2194 | + if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') { |
|
| 2195 | 2195 | $result = true; |
| 2196 | 2196 | } |
| 2197 | 2197 | |
@@ -2206,7 +2206,7 @@ discard block |
||
| 2206 | 2206 | */ |
| 2207 | 2207 | public function is_elementor_preview() { |
| 2208 | 2208 | $result = false; |
| 2209 | - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { |
|
| 2209 | + if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) { |
|
| 2210 | 2210 | $result = true; |
| 2211 | 2211 | } |
| 2212 | 2212 | |
@@ -2221,7 +2221,7 @@ discard block |
||
| 2221 | 2221 | */ |
| 2222 | 2222 | public function is_divi_preview() { |
| 2223 | 2223 | $result = false; |
| 2224 | - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { |
|
| 2224 | + if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) { |
|
| 2225 | 2225 | $result = true; |
| 2226 | 2226 | } |
| 2227 | 2227 | |
@@ -2236,7 +2236,7 @@ discard block |
||
| 2236 | 2236 | */ |
| 2237 | 2237 | public function is_beaver_preview() { |
| 2238 | 2238 | $result = false; |
| 2239 | - if ( isset( $_REQUEST['fl_builder'] ) ) { |
|
| 2239 | + if (isset($_REQUEST['fl_builder'])) { |
|
| 2240 | 2240 | $result = true; |
| 2241 | 2241 | } |
| 2242 | 2242 | |
@@ -2251,7 +2251,7 @@ discard block |
||
| 2251 | 2251 | */ |
| 2252 | 2252 | public function is_siteorigin_preview() { |
| 2253 | 2253 | $result = false; |
| 2254 | - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { |
|
| 2254 | + if (!empty($_REQUEST['siteorigin_panels_live_editor'])) { |
|
| 2255 | 2255 | $result = true; |
| 2256 | 2256 | } |
| 2257 | 2257 | |
@@ -2266,7 +2266,7 @@ discard block |
||
| 2266 | 2266 | */ |
| 2267 | 2267 | public function is_cornerstone_preview() { |
| 2268 | 2268 | $result = false; |
| 2269 | - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { |
|
| 2269 | + if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') { |
|
| 2270 | 2270 | $result = true; |
| 2271 | 2271 | } |
| 2272 | 2272 | |
@@ -2281,7 +2281,7 @@ discard block |
||
| 2281 | 2281 | */ |
| 2282 | 2282 | public function is_fusion_preview() { |
| 2283 | 2283 | $result = false; |
| 2284 | - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { |
|
| 2284 | + if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) { |
|
| 2285 | 2285 | $result = true; |
| 2286 | 2286 | } |
| 2287 | 2287 | |
@@ -2296,17 +2296,17 @@ discard block |
||
| 2296 | 2296 | */ |
| 2297 | 2297 | public function is_preview() { |
| 2298 | 2298 | $preview = false; |
| 2299 | - if ( $this->is_divi_preview() ) { |
|
| 2299 | + if ($this->is_divi_preview()) { |
|
| 2300 | 2300 | $preview = true; |
| 2301 | - } elseif ( $this->is_elementor_preview() ) { |
|
| 2301 | + } elseif ($this->is_elementor_preview()) { |
|
| 2302 | 2302 | $preview = true; |
| 2303 | - } elseif ( $this->is_beaver_preview() ) { |
|
| 2303 | + } elseif ($this->is_beaver_preview()) { |
|
| 2304 | 2304 | $preview = true; |
| 2305 | - } elseif ( $this->is_siteorigin_preview() ) { |
|
| 2305 | + } elseif ($this->is_siteorigin_preview()) { |
|
| 2306 | 2306 | $preview = true; |
| 2307 | - } elseif ( $this->is_cornerstone_preview() ) { |
|
| 2307 | + } elseif ($this->is_cornerstone_preview()) { |
|
| 2308 | 2308 | $preview = true; |
| 2309 | - } elseif ( $this->is_fusion_preview() ) { |
|
| 2309 | + } elseif ($this->is_fusion_preview()) { |
|
| 2310 | 2310 | $preview = true; |
| 2311 | 2311 | } |
| 2312 | 2312 | |
@@ -2321,11 +2321,11 @@ discard block |
||
| 2321 | 2321 | * |
| 2322 | 2322 | * @return string |
| 2323 | 2323 | */ |
| 2324 | - public function output_title( $args, $instance = array() ) { |
|
| 2324 | + public function output_title($args, $instance = array()) { |
|
| 2325 | 2325 | $output = ''; |
| 2326 | - if ( ! empty( $instance['title'] ) ) { |
|
| 2326 | + if (!empty($instance['title'])) { |
|
| 2327 | 2327 | /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ |
| 2328 | - $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
|
| 2328 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); |
|
| 2329 | 2329 | $output = $args['before_title'] . $title . $args['after_title']; |
| 2330 | 2330 | } |
| 2331 | 2331 | |
@@ -2337,7 +2337,7 @@ discard block |
||
| 2337 | 2337 | * |
| 2338 | 2338 | * @param array $instance The widget options. |
| 2339 | 2339 | */ |
| 2340 | - public function form( $instance ) { |
|
| 2340 | + public function form($instance) { |
|
| 2341 | 2341 | |
| 2342 | 2342 | // set widget instance |
| 2343 | 2343 | $this->instance = $instance; |
@@ -2345,10 +2345,10 @@ discard block |
||
| 2345 | 2345 | // set it as a SD widget |
| 2346 | 2346 | echo $this->widget_advanced_toggle(); |
| 2347 | 2347 | |
| 2348 | - echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>"; |
|
| 2348 | + echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>"; |
|
| 2349 | 2349 | $arguments_raw = $this->get_arguments(); |
| 2350 | 2350 | |
| 2351 | - if ( is_array( $arguments_raw ) ) { |
|
| 2351 | + if (is_array($arguments_raw)) { |
|
| 2352 | 2352 | |
| 2353 | 2353 | $arguments = $this->group_arguments($arguments_raw); |
| 2354 | 2354 | |
@@ -2356,9 +2356,9 @@ discard block |
||
| 2356 | 2356 | $has_sections = $arguments == $arguments_raw ? false : true; |
| 2357 | 2357 | |
| 2358 | 2358 | |
| 2359 | - if($has_sections){ |
|
| 2359 | + if ($has_sections) { |
|
| 2360 | 2360 | $panel_count = 0; |
| 2361 | - foreach($arguments as $key => $args){ |
|
| 2361 | + foreach ($arguments as $key => $args) { |
|
| 2362 | 2362 | |
| 2363 | 2363 | ?> |
| 2364 | 2364 | <script> |
@@ -2368,10 +2368,10 @@ discard block |
||
| 2368 | 2368 | |
| 2369 | 2369 | $hide = $panel_count ? ' style="display:none;" ' : ''; |
| 2370 | 2370 | $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down'; |
| 2371 | - echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle".sanitize_title_with_dashes($key)."'>".esc_attr($key)." <i style='float:right;' class='".$icon_class."'></i></button>"; |
|
| 2372 | - echo "<div class='sd-toggle-group sd-input-group-".sanitize_title_with_dashes($key)."' $hide>"; |
|
| 2371 | + echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes($key) . "'>" . esc_attr($key) . " <i style='float:right;' class='" . $icon_class . "'></i></button>"; |
|
| 2372 | + echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>"; |
|
| 2373 | 2373 | |
| 2374 | - foreach($args as $k => $a){ |
|
| 2374 | + foreach ($args as $k => $a) { |
|
| 2375 | 2375 | $this->widget_inputs($a, $instance); |
| 2376 | 2376 | } |
| 2377 | 2377 | |
@@ -2380,9 +2380,9 @@ discard block |
||
| 2380 | 2380 | $panel_count++; |
| 2381 | 2381 | |
| 2382 | 2382 | } |
| 2383 | - }else{ |
|
| 2384 | - foreach ( $arguments as $key => $args ) { |
|
| 2385 | - $this->widget_inputs( $args, $instance ); |
|
| 2383 | + } else { |
|
| 2384 | + foreach ($arguments as $key => $args) { |
|
| 2385 | + $this->widget_inputs($args, $instance); |
|
| 2386 | 2386 | } |
| 2387 | 2387 | } |
| 2388 | 2388 | |
@@ -2397,7 +2397,7 @@ discard block |
||
| 2397 | 2397 | public function widget_advanced_toggle() { |
| 2398 | 2398 | |
| 2399 | 2399 | $output = ''; |
| 2400 | - if ( $this->block_show_advanced() ) { |
|
| 2400 | + if ($this->block_show_advanced()) { |
|
| 2401 | 2401 | $val = 1; |
| 2402 | 2402 | } else { |
| 2403 | 2403 | $val = 0; |
@@ -2417,14 +2417,14 @@ discard block |
||
| 2417 | 2417 | * |
| 2418 | 2418 | * @return string $output |
| 2419 | 2419 | */ |
| 2420 | - public function convert_element_require( $input ) { |
|
| 2420 | + public function convert_element_require($input) { |
|
| 2421 | 2421 | |
| 2422 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
| 2422 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
| 2423 | 2423 | |
| 2424 | - $output = esc_attr( str_replace( array( "[%", "%]" ), array( |
|
| 2424 | + $output = esc_attr(str_replace(array("[%", "%]"), array( |
|
| 2425 | 2425 | "jQuery(form).find('[data-argument=\"", |
| 2426 | 2426 | "\"]').find('input,select').val()" |
| 2427 | - ), $input ) ); |
|
| 2427 | + ), $input)); |
|
| 2428 | 2428 | |
| 2429 | 2429 | return $output; |
| 2430 | 2430 | } |
@@ -2435,54 +2435,54 @@ discard block |
||
| 2435 | 2435 | * @param $args |
| 2436 | 2436 | * @param $instance |
| 2437 | 2437 | */ |
| 2438 | - public function widget_inputs( $args, $instance ) { |
|
| 2438 | + public function widget_inputs($args, $instance) { |
|
| 2439 | 2439 | |
| 2440 | 2440 | $class = ""; |
| 2441 | 2441 | $element_require = ""; |
| 2442 | 2442 | $custom_attributes = ""; |
| 2443 | 2443 | |
| 2444 | 2444 | // get value |
| 2445 | - if ( isset( $instance[ $args['name'] ] ) ) { |
|
| 2446 | - $value = $instance[ $args['name'] ]; |
|
| 2447 | - } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) { |
|
| 2448 | - $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] ); |
|
| 2445 | + if (isset($instance[$args['name']])) { |
|
| 2446 | + $value = $instance[$args['name']]; |
|
| 2447 | + } elseif (!isset($instance[$args['name']]) && !empty($args['default'])) { |
|
| 2448 | + $value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']); |
|
| 2449 | 2449 | } else { |
| 2450 | 2450 | $value = ''; |
| 2451 | 2451 | } |
| 2452 | 2452 | |
| 2453 | 2453 | // get placeholder |
| 2454 | - if ( ! empty( $args['placeholder'] ) ) { |
|
| 2455 | - $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; |
|
| 2454 | + if (!empty($args['placeholder'])) { |
|
| 2455 | + $placeholder = "placeholder='" . esc_html($args['placeholder']) . "'"; |
|
| 2456 | 2456 | } else { |
| 2457 | 2457 | $placeholder = ''; |
| 2458 | 2458 | } |
| 2459 | 2459 | |
| 2460 | 2460 | // get if advanced |
| 2461 | - if ( isset( $args['advanced'] ) && $args['advanced'] ) { |
|
| 2461 | + if (isset($args['advanced']) && $args['advanced']) { |
|
| 2462 | 2462 | $class .= " sd-advanced-setting "; |
| 2463 | 2463 | } |
| 2464 | 2464 | |
| 2465 | 2465 | // element_require |
| 2466 | - if ( isset( $args['element_require'] ) && $args['element_require'] ) { |
|
| 2466 | + if (isset($args['element_require']) && $args['element_require']) { |
|
| 2467 | 2467 | $element_require = $args['element_require']; |
| 2468 | 2468 | } |
| 2469 | 2469 | |
| 2470 | 2470 | // custom_attributes |
| 2471 | - if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { |
|
| 2472 | - $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); |
|
| 2471 | + if (isset($args['custom_attributes']) && $args['custom_attributes']) { |
|
| 2472 | + $custom_attributes = $this->array_to_attributes($args['custom_attributes'], true); |
|
| 2473 | 2473 | } |
| 2474 | 2474 | |
| 2475 | 2475 | // before wrapper |
| 2476 | 2476 | ?> |
| 2477 | - <p class="sd-argument <?php echo esc_attr( $class ); ?>" |
|
| 2478 | - data-argument='<?php echo esc_attr( $args['name'] ); ?>' |
|
| 2479 | - data-element_require='<?php if ( $element_require ) { |
|
| 2480 | - echo $this->convert_element_require( $element_require ); |
|
| 2477 | + <p class="sd-argument <?php echo esc_attr($class); ?>" |
|
| 2478 | + data-argument='<?php echo esc_attr($args['name']); ?>' |
|
| 2479 | + data-element_require='<?php if ($element_require) { |
|
| 2480 | + echo $this->convert_element_require($element_require); |
|
| 2481 | 2481 | } ?>' |
| 2482 | 2482 | > |
| 2483 | 2483 | <?php |
| 2484 | 2484 | |
| 2485 | - switch ( $args['type'] ) { |
|
| 2485 | + switch ($args['type']) { |
|
| 2486 | 2486 | //array('text','password','number','email','tel','url','color') |
| 2487 | 2487 | case "text": |
| 2488 | 2488 | case "password": |
@@ -2493,46 +2493,46 @@ discard block |
||
| 2493 | 2493 | case "color": |
| 2494 | 2494 | ?> |
| 2495 | 2495 | <label |
| 2496 | - for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
| 2496 | + for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
| 2497 | 2497 | <input <?php echo $placeholder; ?> class="widefat" |
| 2498 | 2498 | <?php echo $custom_attributes; ?> |
| 2499 | - id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
| 2500 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" |
|
| 2501 | - type="<?php echo esc_attr( $args['type'] ); ?>" |
|
| 2502 | - value="<?php echo esc_attr( $value ); ?>"> |
|
| 2499 | + id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
| 2500 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" |
|
| 2501 | + type="<?php echo esc_attr($args['type']); ?>" |
|
| 2502 | + value="<?php echo esc_attr($value); ?>"> |
|
| 2503 | 2503 | <?php |
| 2504 | 2504 | |
| 2505 | 2505 | break; |
| 2506 | 2506 | case "select": |
| 2507 | - $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false; |
|
| 2508 | - if ( $multiple ) { |
|
| 2509 | - if ( empty( $value ) ) { |
|
| 2507 | + $multiple = isset($args['multiple']) && $args['multiple'] ? true : false; |
|
| 2508 | + if ($multiple) { |
|
| 2509 | + if (empty($value)) { |
|
| 2510 | 2510 | $value = array(); |
| 2511 | 2511 | } |
| 2512 | 2512 | } |
| 2513 | 2513 | ?> |
| 2514 | 2514 | <label |
| 2515 | - for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
| 2515 | + for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
| 2516 | 2516 | <select <?php echo $placeholder; ?> class="widefat" |
| 2517 | 2517 | <?php echo $custom_attributes; ?> |
| 2518 | - id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
| 2519 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); |
|
| 2520 | - if ( $multiple ) { |
|
| 2518 | + id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
| 2519 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); |
|
| 2520 | + if ($multiple) { |
|
| 2521 | 2521 | echo "[]"; |
| 2522 | 2522 | } ?>" |
| 2523 | - <?php if ( $multiple ) { |
|
| 2523 | + <?php if ($multiple) { |
|
| 2524 | 2524 | echo "multiple"; |
| 2525 | 2525 | } //@todo not implemented yet due to gutenberg not supporting it |
| 2526 | 2526 | ?> |
| 2527 | 2527 | > |
| 2528 | 2528 | <?php |
| 2529 | 2529 | |
| 2530 | - if ( ! empty( $args['options'] ) ) { |
|
| 2531 | - foreach ( $args['options'] as $val => $label ) { |
|
| 2532 | - if ( $multiple ) { |
|
| 2533 | - $selected = in_array( $val, $value ) ? 'selected="selected"' : ''; |
|
| 2530 | + if (!empty($args['options'])) { |
|
| 2531 | + foreach ($args['options'] as $val => $label) { |
|
| 2532 | + if ($multiple) { |
|
| 2533 | + $selected = in_array($val, $value) ? 'selected="selected"' : ''; |
|
| 2534 | 2534 | } else { |
| 2535 | - $selected = selected( $value, $val, false ); |
|
| 2535 | + $selected = selected($value, $val, false); |
|
| 2536 | 2536 | } |
| 2537 | 2537 | echo "<option value='$val' " . $selected . ">$label</option>"; |
| 2538 | 2538 | } |
@@ -2544,20 +2544,20 @@ discard block |
||
| 2544 | 2544 | case "checkbox": |
| 2545 | 2545 | ?> |
| 2546 | 2546 | <input <?php echo $placeholder; ?> |
| 2547 | - <?php checked( 1, $value, true ) ?> |
|
| 2547 | + <?php checked(1, $value, true) ?> |
|
| 2548 | 2548 | <?php echo $custom_attributes; ?> |
| 2549 | - class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
| 2550 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox" |
|
| 2549 | + class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
| 2550 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox" |
|
| 2551 | 2551 | value="1"> |
| 2552 | 2552 | <label |
| 2553 | - for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo esc_attr( $args['title'] ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
| 2553 | + for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo esc_attr($args['title']); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
| 2554 | 2554 | <?php |
| 2555 | 2555 | break; |
| 2556 | 2556 | case "hidden": |
| 2557 | 2557 | ?> |
| 2558 | - <input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" |
|
| 2559 | - name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden" |
|
| 2560 | - value="<?php echo esc_attr( $value ); ?>"> |
|
| 2558 | + <input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" |
|
| 2559 | + name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden" |
|
| 2560 | + value="<?php echo esc_attr($value); ?>"> |
|
| 2561 | 2561 | <?php |
| 2562 | 2562 | break; |
| 2563 | 2563 | default: |
@@ -2579,14 +2579,14 @@ discard block |
||
| 2579 | 2579 | * @return string |
| 2580 | 2580 | * @todo, need to make its own tooltip script |
| 2581 | 2581 | */ |
| 2582 | - public function widget_field_desc( $args ) { |
|
| 2582 | + public function widget_field_desc($args) { |
|
| 2583 | 2583 | |
| 2584 | 2584 | $description = ''; |
| 2585 | - if ( isset( $args['desc'] ) && $args['desc'] ) { |
|
| 2586 | - if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) { |
|
| 2587 | - $description = $this->desc_tip( $args['desc'] ); |
|
| 2585 | + if (isset($args['desc']) && $args['desc']) { |
|
| 2586 | + if (isset($args['desc_tip']) && $args['desc_tip']) { |
|
| 2587 | + $description = $this->desc_tip($args['desc']); |
|
| 2588 | 2588 | } else { |
| 2589 | - $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>'; |
|
| 2589 | + $description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>'; |
|
| 2590 | 2590 | } |
| 2591 | 2591 | } |
| 2592 | 2592 | |
@@ -2601,11 +2601,11 @@ discard block |
||
| 2601 | 2601 | * |
| 2602 | 2602 | * @return string |
| 2603 | 2603 | */ |
| 2604 | - function desc_tip( $tip, $allow_html = false ) { |
|
| 2605 | - if ( $allow_html ) { |
|
| 2606 | - $tip = $this->sanitize_tooltip( $tip ); |
|
| 2604 | + function desc_tip($tip, $allow_html = false) { |
|
| 2605 | + if ($allow_html) { |
|
| 2606 | + $tip = $this->sanitize_tooltip($tip); |
|
| 2607 | 2607 | } else { |
| 2608 | - $tip = esc_attr( $tip ); |
|
| 2608 | + $tip = esc_attr($tip); |
|
| 2609 | 2609 | } |
| 2610 | 2610 | |
| 2611 | 2611 | return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>'; |
@@ -2618,8 +2618,8 @@ discard block |
||
| 2618 | 2618 | * |
| 2619 | 2619 | * @return string |
| 2620 | 2620 | */ |
| 2621 | - public function sanitize_tooltip( $var ) { |
|
| 2622 | - return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( |
|
| 2621 | + public function sanitize_tooltip($var) { |
|
| 2622 | + return htmlspecialchars(wp_kses(html_entity_decode($var), array( |
|
| 2623 | 2623 | 'br' => array(), |
| 2624 | 2624 | 'em' => array(), |
| 2625 | 2625 | 'strong' => array(), |
@@ -2629,7 +2629,7 @@ discard block |
||
| 2629 | 2629 | 'li' => array(), |
| 2630 | 2630 | 'ol' => array(), |
| 2631 | 2631 | 'p' => array(), |
| 2632 | - ) ) ); |
|
| 2632 | + ))); |
|
| 2633 | 2633 | } |
| 2634 | 2634 | |
| 2635 | 2635 | /** |
@@ -2641,23 +2641,23 @@ discard block |
||
| 2641 | 2641 | * @return array |
| 2642 | 2642 | * @todo we should add some sanitation here. |
| 2643 | 2643 | */ |
| 2644 | - public function update( $new_instance, $old_instance ) { |
|
| 2644 | + public function update($new_instance, $old_instance) { |
|
| 2645 | 2645 | |
| 2646 | 2646 | //save the widget |
| 2647 | - $instance = array_merge( (array) $old_instance, (array) $new_instance ); |
|
| 2647 | + $instance = array_merge((array)$old_instance, (array)$new_instance); |
|
| 2648 | 2648 | |
| 2649 | 2649 | // set widget instance |
| 2650 | 2650 | $this->instance = $instance; |
| 2651 | 2651 | |
| 2652 | - if ( empty( $this->arguments ) ) { |
|
| 2652 | + if (empty($this->arguments)) { |
|
| 2653 | 2653 | $this->get_arguments(); |
| 2654 | 2654 | } |
| 2655 | 2655 | |
| 2656 | 2656 | // check for checkboxes |
| 2657 | - if ( ! empty( $this->arguments ) ) { |
|
| 2658 | - foreach ( $this->arguments as $argument ) { |
|
| 2659 | - if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) { |
|
| 2660 | - $instance[ $argument['name'] ] = '0'; |
|
| 2657 | + if (!empty($this->arguments)) { |
|
| 2658 | + foreach ($this->arguments as $argument) { |
|
| 2659 | + if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) { |
|
| 2660 | + $instance[$argument['name']] = '0'; |
|
| 2661 | 2661 | } |
| 2662 | 2662 | } |
| 2663 | 2663 | } |
@@ -2675,7 +2675,7 @@ discard block |
||
| 2675 | 2675 | */ |
| 2676 | 2676 | public function is_block_content_call() { |
| 2677 | 2677 | $result = false; |
| 2678 | - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { |
|
| 2678 | + if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') { |
|
| 2679 | 2679 | $result = true; |
| 2680 | 2680 | } |
| 2681 | 2681 | |
@@ -12,19 +12,19 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // MUST have WordPress. |
| 15 | -if ( !defined( 'WPINC' ) ) { |
|
| 16 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
| 15 | +if (!defined('WPINC')) { |
|
| 16 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if ( !defined( 'WPINV_VERSION' ) ) { |
|
| 20 | - define( 'WPINV_VERSION', '1.0.12' ); |
|
| 19 | +if (!defined('WPINV_VERSION')) { |
|
| 20 | + define('WPINV_VERSION', '1.0.12'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if ( !defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
| 24 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
| 23 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
| 24 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wpinv.php'; |
|
| 27 | +require plugin_dir_path(__FILE__) . 'includes/class-wpinv.php'; |
|
| 28 | 28 | |
| 29 | 29 | function wpinv_run() { |
| 30 | 30 | global $invoicing; |