@@ -1,11 +1,11 @@ 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 | - define( 'SUPER_DUPER_VER', '1.2.25' ); |
|
| 8 | + define('SUPER_DUPER_VER', '1.2.25'); |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress. |
@@ -38,40 +38,40 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Take the array options and use them to build. |
| 40 | 40 | */ |
| 41 | - public function __construct( $options ) { |
|
| 41 | + public function __construct($options) { |
|
| 42 | 42 | global $sd_widgets; |
| 43 | 43 | |
| 44 | - $sd_widgets[ $options['base_id'] ] = array( |
|
| 44 | + $sd_widgets[$options['base_id']] = array( |
|
| 45 | 45 | 'name' => $options['name'], |
| 46 | 46 | 'class_name' => $options['class_name'], |
| 47 | 47 | 'output_types' => !empty($options['output_types']) ? $options['output_types'] : array() |
| 48 | 48 | ); |
| 49 | - $this->base_id = $options['base_id']; |
|
| 49 | + $this->base_id = $options['base_id']; |
|
| 50 | 50 | // lets filter the options before we do anything |
| 51 | - $options = apply_filters( "wp_super_duper_options", $options ); |
|
| 52 | - $options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options ); |
|
| 53 | - $options = $this->add_name_from_key( $options ); |
|
| 51 | + $options = apply_filters("wp_super_duper_options", $options); |
|
| 52 | + $options = apply_filters("wp_super_duper_options_{$this->base_id}", $options); |
|
| 53 | + $options = $this->add_name_from_key($options); |
|
| 54 | 54 | $this->options = $options; |
| 55 | 55 | |
| 56 | 56 | $this->base_id = $options['base_id']; |
| 57 | - $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array(); |
|
| 57 | + $this->arguments = isset($options['arguments']) ? $options['arguments'] : array(); |
|
| 58 | 58 | |
| 59 | 59 | // nested blocks can't work as a widget |
| 60 | - if(!empty($this->options['nested-block'])){ |
|
| 61 | - if(empty($this->options['output_types'])){ |
|
| 62 | - $this->options['output_types'] = array('shortcode','block'); |
|
| 60 | + if (!empty($this->options['nested-block'])) { |
|
| 61 | + if (empty($this->options['output_types'])) { |
|
| 62 | + $this->options['output_types'] = array('shortcode', 'block'); |
|
| 63 | 63 | }elseif (($key = array_search('widget', $this->options['output_types'])) !== false) { |
| 64 | 64 | unset($this->options['output_types'][$key]); |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // init parent |
| 69 | - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ |
|
| 70 | - parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] ); |
|
| 69 | + if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) { |
|
| 70 | + parent::__construct($options['base_id'], $options['name'], $options['widget_ops']); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | |
| 74 | - if ( isset( $options['class_name'] ) ) { |
|
| 74 | + if (isset($options['class_name'])) { |
|
| 75 | 75 | // register widget |
| 76 | 76 | $this->class_name = $options['class_name']; |
| 77 | 77 | |
@@ -80,68 +80,68 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | // Fusion Builder (avada) support |
| 83 | - if ( function_exists( 'fusion_builder_map' ) ) { |
|
| 84 | - add_action( 'init', array( $this, 'register_fusion_element' ) ); |
|
| 83 | + if (function_exists('fusion_builder_map')) { |
|
| 84 | + add_action('init', array($this, 'register_fusion_element')); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // maybe load the Bricks transformer class |
| 88 | - if( class_exists('\Bricks\Elements', false) ){ |
|
| 89 | - add_action( 'init', array( $this, 'load_bricks_element_class' ) ); |
|
| 88 | + if (class_exists('\Bricks\Elements', false)) { |
|
| 89 | + add_action('init', array($this, 'load_bricks_element_class')); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // register block |
| 93 | - if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){ |
|
| 94 | - add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) ); |
|
| 93 | + if (empty($this->options['output_types']) || in_array('block', $this->options['output_types'])) { |
|
| 94 | + add_action('admin_enqueue_scripts', array($this, 'register_block')); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // add the CSS and JS we need ONCE |
| 99 | 99 | global $sd_widget_scripts; |
| 100 | 100 | |
| 101 | - if ( ! $sd_widget_scripts ) { |
|
| 102 | - wp_add_inline_script( 'admin-widgets', $this->widget_js() ); |
|
| 103 | - wp_add_inline_script( 'customize-controls', $this->widget_js() ); |
|
| 104 | - wp_add_inline_style( 'widgets', $this->widget_css() ); |
|
| 101 | + if (!$sd_widget_scripts) { |
|
| 102 | + wp_add_inline_script('admin-widgets', $this->widget_js()); |
|
| 103 | + wp_add_inline_script('customize-controls', $this->widget_js()); |
|
| 104 | + wp_add_inline_style('widgets', $this->widget_css()); |
|
| 105 | 105 | |
| 106 | 106 | // maybe add elementor editor styles |
| 107 | - add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) ); |
|
| 107 | + add_action('elementor/editor/after_enqueue_styles', array($this, 'elementor_editor_styles')); |
|
| 108 | 108 | |
| 109 | 109 | $sd_widget_scripts = true; |
| 110 | 110 | |
| 111 | 111 | // add shortcode insert button once |
| 112 | - add_action( 'media_buttons', array( $this, 'wp_media_buttons' ), 1 ); |
|
| 113 | - add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) ); |
|
| 112 | + add_action('media_buttons', array($this, 'wp_media_buttons'), 1); |
|
| 113 | + add_action('media_buttons', array($this, 'shortcode_insert_button')); |
|
| 114 | 114 | // generatepress theme sections compatibility |
| 115 | - if ( function_exists( 'generate_sections_sections_metabox' ) ) { |
|
| 116 | - add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) ); |
|
| 115 | + if (function_exists('generate_sections_sections_metabox')) { |
|
| 116 | + add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script')); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /* Load script on Divi theme builder page */ |
| 120 | - if ( ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) || ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() && isset( $_GET['et_fb'] ) && '1' === $_GET['et_fb'] && et_pb_is_allowed( 'use_visual_builder' ) ) ) { |
|
| 120 | + if ((function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) || (function_exists('et_builder_d5_enabled') && et_builder_d5_enabled() && isset($_GET['et_fb']) && '1' === $_GET['et_fb'] && et_pb_is_allowed('use_visual_builder'))) { |
|
| 121 | 121 | add_thickbox(); |
| 122 | - add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
| 122 | + add_action('admin_footer', array($this, 'shortcode_insert_button_script')); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if ( $this->is_preview() ) { |
|
| 126 | - add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) ); |
|
| 125 | + if ($this->is_preview()) { |
|
| 126 | + add_action('wp_footer', array($this, 'shortcode_insert_button_script')); |
|
| 127 | 127 | // this makes the insert button work for elementor |
| 128 | - add_action( 'elementor/editor/after_enqueue_scripts', array( |
|
| 128 | + add_action('elementor/editor/after_enqueue_scripts', array( |
|
| 129 | 129 | $this, |
| 130 | 130 | 'shortcode_insert_button_script' |
| 131 | - ) ); // for elementor |
|
| 131 | + )); // for elementor |
|
| 132 | 132 | } |
| 133 | 133 | // this makes the insert button work for cornerstone |
| 134 | - add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) ); |
|
| 134 | + add_action('wp_print_footer_scripts', array(__CLASS__, 'maybe_cornerstone_builder')); |
|
| 135 | 135 | |
| 136 | - add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) ); |
|
| 137 | - add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) ); |
|
| 136 | + add_action('wp_ajax_super_duper_get_widget_settings', array(__CLASS__, 'get_widget_settings')); |
|
| 137 | + add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker')); |
|
| 138 | 138 | |
| 139 | 139 | // add generator text to head |
| 140 | - add_action( 'admin_head', array( $this, 'generator' ), 99 ); |
|
| 141 | - add_action( 'wp_head', array( $this, 'generator' ), 99 ); |
|
| 140 | + add_action('admin_head', array($this, 'generator'), 99); |
|
| 141 | + add_action('wp_head', array($this, 'generator'), 99); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - do_action( 'wp_super_duper_widget_init', $options, $this ); |
|
| 144 | + do_action('wp_super_duper_widget_init', $options, $this); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return void |
| 158 | 158 | */ |
| 159 | 159 | public function _register() { |
| 160 | - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ |
|
| 160 | + if (empty($this->options['output_types']) || in_array('widget', $this->options['output_types'])) { |
|
| 161 | 161 | parent::_register(); |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | * Add our widget CSS to elementor editor. |
| 167 | 167 | */ |
| 168 | 168 | public function elementor_editor_styles() { |
| 169 | - wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) ); |
|
| 169 | + wp_add_inline_style('elementor-editor', $this->widget_css(false)); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public function register_fusion_element() { |
| 173 | 173 | |
| 174 | 174 | $options = $this->options; |
| 175 | 175 | |
| 176 | - if ( $this->base_id ) { |
|
| 176 | + if ($this->base_id) { |
|
| 177 | 177 | |
| 178 | 178 | $params = $this->get_fusion_params(); |
| 179 | 179 | |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | 'allow_generator' => true, |
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | - if ( ! empty( $params ) ) { |
|
| 187 | + if (!empty($params)) { |
|
| 188 | 188 | $args['params'] = $params; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - fusion_builder_map( $args ); |
|
| 191 | + fusion_builder_map($args); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | } |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | $params = array(); |
| 198 | 198 | $arguments = $this->get_arguments(); |
| 199 | 199 | |
| 200 | - if ( ! empty( $arguments ) ) { |
|
| 201 | - foreach ( $arguments as $key => $val ) { |
|
| 200 | + if (!empty($arguments)) { |
|
| 201 | + foreach ($arguments as $key => $val) { |
|
| 202 | 202 | $param = array(); |
| 203 | 203 | // type |
| 204 | 204 | $param['type'] = str_replace( |
@@ -220,38 +220,38 @@ discard block |
||
| 220 | 220 | $val['type'] ); |
| 221 | 221 | |
| 222 | 222 | // multiselect |
| 223 | - if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) { |
|
| 223 | + if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) { |
|
| 224 | 224 | $param['type'] = 'multiple_select'; |
| 225 | 225 | $param['multiple'] = true; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | // heading |
| 229 | - $param['heading'] = isset( $val['title'] ) ? $val['title'] : ''; |
|
| 229 | + $param['heading'] = isset($val['title']) ? $val['title'] : ''; |
|
| 230 | 230 | |
| 231 | 231 | // description |
| 232 | - $param['description'] = isset( $val['desc'] ) ? $val['desc'] : ''; |
|
| 232 | + $param['description'] = isset($val['desc']) ? $val['desc'] : ''; |
|
| 233 | 233 | |
| 234 | 234 | // param_name |
| 235 | 235 | $param['param_name'] = $key; |
| 236 | 236 | |
| 237 | 237 | // Default |
| 238 | - $param['default'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
| 238 | + $param['default'] = isset($val['default']) ? $val['default'] : ''; |
|
| 239 | 239 | |
| 240 | 240 | // Group |
| 241 | - if ( isset( $val['group'] ) ) { |
|
| 241 | + if (isset($val['group'])) { |
|
| 242 | 242 | $param['group'] = $val['group']; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | // value |
| 246 | - if ( $val['type'] == 'checkbox' ) { |
|
| 247 | - if ( isset( $val['default'] ) && $val['default'] == '0' ) { |
|
| 248 | - unset( $param['default'] ); |
|
| 246 | + if ($val['type'] == 'checkbox') { |
|
| 247 | + if (isset($val['default']) && $val['default'] == '0') { |
|
| 248 | + unset($param['default']); |
|
| 249 | 249 | } |
| 250 | - $param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) ); |
|
| 251 | - } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) { |
|
| 252 | - $param['value'] = isset( $val['options'] ) ? $val['options'] : array(); |
|
| 250 | + $param['value'] = array('0' => __("No", 'ayecode-connect'), '1' => __("Yes", 'ayecode-connect')); |
|
| 251 | + } elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') { |
|
| 252 | + $param['value'] = isset($val['options']) ? $val['options'] : array(); |
|
| 253 | 253 | } else { |
| 254 | - $param['value'] = isset( $val['default'] ) ? $val['default'] : ''; |
|
| 254 | + $param['value'] = isset($val['default']) ? $val['default'] : ''; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // setup the param |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder |
| 269 | 269 | */ |
| 270 | 270 | public static function maybe_cornerstone_builder() { |
| 271 | - if ( did_action( 'cornerstone_before_boot_app' ) ) { |
|
| 271 | + if (did_action('cornerstone_before_boot_app')) { |
|
| 272 | 272 | self::shortcode_insert_button_script(); |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -280,12 +280,12 @@ discard block |
||
| 280 | 280 | * |
| 281 | 281 | * @return string |
| 282 | 282 | */ |
| 283 | - public static function get_picker( $editor_id = '' ) { |
|
| 283 | + public static function get_picker($editor_id = '') { |
|
| 284 | 284 | |
| 285 | 285 | ob_start(); |
| 286 | - if ( isset( $_POST['editor_id'] ) ) { |
|
| 287 | - $editor_id = esc_attr( $_POST['editor_id'] ); |
|
| 288 | - } elseif ( isset( $_REQUEST['et_fb'] ) ) { |
|
| 286 | + if (isset($_POST['editor_id'])) { |
|
| 287 | + $editor_id = esc_attr($_POST['editor_id']); |
|
| 288 | + } elseif (isset($_REQUEST['et_fb'])) { |
|
| 289 | 289 | $editor_id = 'main_content_content_vb_tiny_mce'; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -296,14 +296,14 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | <div class="sd-shortcode-left-wrap"> |
| 298 | 298 | <?php |
| 299 | - ksort( $sd_widgets ); |
|
| 299 | + ksort($sd_widgets); |
|
| 300 | 300 | // print_r($sd_widgets);exit; |
| 301 | - if ( ! empty( $sd_widgets ) ) { |
|
| 301 | + if (!empty($sd_widgets)) { |
|
| 302 | 302 | echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">'; |
| 303 | - echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>"; |
|
| 304 | - foreach ( $sd_widgets as $shortcode => $class ) { |
|
| 305 | - if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; } |
|
| 306 | - echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>"; |
|
| 303 | + echo "<option>" . __('Select shortcode', 'ayecode-connect') . "</option>"; |
|
| 304 | + foreach ($sd_widgets as $shortcode => $class) { |
|
| 305 | + if (!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])) { continue; } |
|
| 306 | + echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>"; |
|
| 307 | 307 | } |
| 308 | 308 | echo "</select>"; |
| 309 | 309 | |
@@ -314,32 +314,32 @@ discard block |
||
| 314 | 314 | <div class="sd-shortcode-right-wrap"> |
| 315 | 315 | <textarea id='sd-shortcode-output' disabled></textarea> |
| 316 | 316 | <div id='sd-shortcode-output-actions'> |
| 317 | - <?php if ( $editor_id != '' ) { ?> |
|
| 318 | - <button class="button sd-insert-shortcode-button" onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { echo "'" . $editor_id . "'"; } ?>)"><?php esc_html_e( 'Insert shortcode', 'ayecode-connect' ); ?></button> |
|
| 317 | + <?php if ($editor_id != '') { ?> |
|
| 318 | + <button class="button sd-insert-shortcode-button" onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) { echo "'" . $editor_id . "'"; } ?>)"><?php esc_html_e('Insert shortcode', 'ayecode-connect'); ?></button> |
|
| 319 | 319 | <?php } ?> |
| 320 | - <button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e( 'Copy shortcode' ); ?></button> |
|
| 320 | + <button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e('Copy shortcode'); ?></button> |
|
| 321 | 321 | </div> |
| 322 | 322 | </div> |
| 323 | 323 | <?php |
| 324 | 324 | $html = ob_get_clean(); |
| 325 | 325 | |
| 326 | - if ( wp_doing_ajax() ) { |
|
| 326 | + if (wp_doing_ajax()) { |
|
| 327 | 327 | echo $html; |
| 328 | 328 | $should_die = true; |
| 329 | 329 | |
| 330 | 330 | // some builder get the editor via ajax so we should not die on those occasions |
| 331 | 331 | $dont_die = array( |
| 332 | - 'parent_tag',// WP Bakery |
|
| 332 | + 'parent_tag', // WP Bakery |
|
| 333 | 333 | 'avia_request' // enfold |
| 334 | 334 | ); |
| 335 | 335 | |
| 336 | - foreach ( $dont_die as $request ) { |
|
| 337 | - if ( isset( $_REQUEST[ $request ] ) ) { |
|
| 336 | + foreach ($dont_die as $request) { |
|
| 337 | + if (isset($_REQUEST[$request])) { |
|
| 338 | 338 | $should_die = false; |
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if ( $should_die ) { |
|
| 342 | + if ($should_die) { |
|
| 343 | 343 | wp_die(); |
| 344 | 344 | } |
| 345 | 345 | } else { |
@@ -353,22 +353,22 @@ discard block |
||
| 353 | 353 | * Output the version in the header. |
| 354 | 354 | */ |
| 355 | 355 | public function generator() { |
| 356 | - $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) ); |
|
| 357 | - $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) ); |
|
| 356 | + $file = str_replace(array("/", "\\"), "/", realpath(__FILE__)); |
|
| 357 | + $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR)); |
|
| 358 | 358 | |
| 359 | 359 | // Find source plugin/theme of SD |
| 360 | 360 | $source = array(); |
| 361 | - if ( strpos( $file, $plugins_dir ) !== false ) { |
|
| 362 | - $source = explode( "/", plugin_basename( $file ) ); |
|
| 363 | - } else if ( function_exists( 'get_theme_root' ) ) { |
|
| 364 | - $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) ); |
|
| 361 | + if (strpos($file, $plugins_dir) !== false) { |
|
| 362 | + $source = explode("/", plugin_basename($file)); |
|
| 363 | + } else if (function_exists('get_theme_root')) { |
|
| 364 | + $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root())); |
|
| 365 | 365 | |
| 366 | - if ( strpos( $file, $themes_dir ) !== false ) { |
|
| 367 | - $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) ); |
|
| 366 | + if (strpos($file, $themes_dir) !== false) { |
|
| 367 | + $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/")); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - echo '<meta name="generator" content="WP Super Duper v' . esc_attr( $this->version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />'; |
|
| 371 | + echo '<meta name="generator" content="WP Super Duper v' . esc_attr($this->version) . '"' . (!empty($source[0]) ? ' data-sd-source="' . esc_attr($source[0]) . '"' : '') . ' />'; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -379,16 +379,16 @@ discard block |
||
| 379 | 379 | public static function get_widget_settings() { |
| 380 | 380 | global $sd_widgets; |
| 381 | 381 | |
| 382 | - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; |
|
| 383 | - if ( ! $shortcode ) { |
|
| 382 | + $shortcode = isset($_REQUEST['shortcode']) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes($_REQUEST['shortcode']) : ''; |
|
| 383 | + if (!$shortcode) { |
|
| 384 | 384 | wp_die(); |
| 385 | 385 | } |
| 386 | - $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; |
|
| 387 | - if ( ! $widget_args ) { |
|
| 386 | + $widget_args = isset($sd_widgets[$shortcode]) ? $sd_widgets[$shortcode] : ''; |
|
| 387 | + if (!$widget_args) { |
|
| 388 | 388 | wp_die(); |
| 389 | 389 | } |
| 390 | - $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
| 391 | - if ( ! $class_name ) { |
|
| 390 | + $class_name = isset($widget_args['class_name']) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; |
|
| 391 | + if (!$class_name) { |
|
| 392 | 392 | wp_die(); |
| 393 | 393 | } |
| 394 | 394 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $widget = new $class_name; |
| 397 | 397 | |
| 398 | 398 | ob_start(); |
| 399 | - $widget->form( array() ); |
|
| 399 | + $widget->form(array()); |
|
| 400 | 400 | $form = ob_get_clean(); |
| 401 | 401 | echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>"; |
| 402 | 402 | echo "<style>" . $widget->widget_css() . "</style>"; |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | *@since 1.0.0 |
| 416 | 416 | * |
| 417 | 417 | */ |
| 418 | - public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) { |
|
| 418 | + public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') { |
|
| 419 | 419 | global $sd_widgets, $shortcode_insert_button_once; |
| 420 | - if ( $shortcode_insert_button_once ) { |
|
| 420 | + if ($shortcode_insert_button_once) { |
|
| 421 | 421 | return; |
| 422 | 422 | } |
| 423 | 423 | add_thickbox(); |
@@ -426,21 +426,21 @@ discard block |
||
| 426 | 426 | * Cornerstone makes us play dirty tricks :/ |
| 427 | 427 | * 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. |
| 428 | 428 | */ |
| 429 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
| 429 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
| 430 | 430 | echo '<span id="insert-media-button">'; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - echo self::shortcode_button( 'this', 'true' ); |
|
| 433 | + echo self::shortcode_button('this', 'true'); |
|
| 434 | 434 | |
| 435 | 435 | // see opening note |
| 436 | - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { |
|
| 436 | + if (function_exists('cornerstone_plugin_init') && !is_admin()) { |
|
| 437 | 437 | echo '</span>'; // end #insert-media-button |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | // Add separate script for generatepress theme sections |
| 441 | - if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { |
|
| 441 | + if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) { |
|
| 442 | 442 | } else { |
| 443 | - self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); |
|
| 443 | + self::shortcode_insert_button_script($editor_id, $insert_shortcode_function); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | $shortcode_insert_button_once = true; |
@@ -454,12 +454,12 @@ discard block |
||
| 454 | 454 | * |
| 455 | 455 | * @return mixed |
| 456 | 456 | */ |
| 457 | - public static function shortcode_button( $id = '', $search_for_id = '' ) { |
|
| 457 | + public static function shortcode_button($id = '', $search_for_id = '') { |
|
| 458 | 458 | ob_start(); |
| 459 | 459 | ?> |
| 460 | 460 | <span class="sd-lable-shortcode-inserter"> |
| 461 | 461 | <a onclick="sd_ajax_get_picker(<?php echo $id; |
| 462 | - if ( $search_for_id ) { |
|
| 462 | + if ($search_for_id) { |
|
| 463 | 463 | echo "," . $search_for_id; |
| 464 | 464 | } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed" |
| 465 | 465 | class="thickbox button super-duper-content-open" title="Add Shortcode"> |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $html = ob_get_clean(); |
| 476 | 476 | |
| 477 | 477 | // remove line breaks so we can use it in js |
| 478 | - return preg_replace( "/\r|\n/", "", trim( $html ) ); |
|
| 478 | + return preg_replace("/\r|\n/", "", trim($html)); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | jQuery($this).data('sd-widget-enabled', true); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" 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>'; |
|
| 534 | + var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" 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>'; |
|
| 535 | 535 | var form = jQuery($this).parents('' + $selector + ''); |
| 536 | 536 | |
| 537 | 537 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -566,10 +566,10 @@ discard block |
||
| 566 | 566 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 567 | 567 | */ |
| 568 | 568 | |
| 569 | - return str_replace( array( |
|
| 569 | + return str_replace(array( |
|
| 570 | 570 | '<script>', |
| 571 | 571 | '</script>' |
| 572 | - ), '', $output ); |
|
| 572 | + ), '', $output); |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | /** |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | *@since 1.0.6 |
| 582 | 582 | * |
| 583 | 583 | */ |
| 584 | - public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { |
|
| 584 | + public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') { |
|
| 585 | 585 | ?> |
| 586 | 586 | <style> |
| 587 | 587 | .sd-shortcode-left-wrap { |
@@ -700,25 +700,25 @@ discard block |
||
| 700 | 700 | width: 100%; |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | - <?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?> |
|
| 703 | + <?php if (function_exists('generate_sections_sections_metabox')) { ?> |
|
| 704 | 704 | .generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter { |
| 705 | 705 | display: inline; |
| 706 | 706 | } |
| 707 | 707 | <?php } ?> |
| 708 | - <?php if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { ?> |
|
| 708 | + <?php if (function_exists('et_builder_is_tb_admin_screen') && et_builder_is_tb_admin_screen()) { ?> |
|
| 709 | 709 | body.divi_page_et_theme_builder div#TB_window.gd-tb-window{z-index:9999999} |
| 710 | 710 | <?php } ?> |
| 711 | 711 | </style> |
| 712 | 712 | <?php |
| 713 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
| 713 | + if (class_exists('SiteOrigin_Panels')) { |
|
| 714 | 714 | echo "<script>" . self::siteorigin_js() . "</script>"; |
| 715 | 715 | } |
| 716 | 716 | ?> |
| 717 | 717 | <script> |
| 718 | 718 | <?php |
| 719 | - if(! empty( $insert_shortcode_function )){ |
|
| 719 | + if (!empty($insert_shortcode_function)) { |
|
| 720 | 720 | echo $insert_shortcode_function; |
| 721 | - }else{ |
|
| 721 | + } else { |
|
| 722 | 722 | |
| 723 | 723 | /** |
| 724 | 724 | * Function for super duper insert shortcode. |
@@ -731,9 +731,9 @@ discard block |
||
| 731 | 731 | if ($shortcode) { |
| 732 | 732 | if (!$editor_id) { |
| 733 | 733 | <?php |
| 734 | - if ( isset( $_REQUEST['et_fb'] ) ) { |
|
| 734 | + if (isset($_REQUEST['et_fb'])) { |
|
| 735 | 735 | echo '$editor_id = "#main_content_content_vb_tiny_mce";'; |
| 736 | - } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) { |
|
| 736 | + } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') { |
|
| 737 | 737 | echo '$editor_id = "#elementor-controls .wp-editor-container textarea";'; |
| 738 | 738 | } else { |
| 739 | 739 | echo '$editor_id = "#wp-content-editor-container textarea";'; |
@@ -815,11 +815,11 @@ discard block |
||
| 815 | 815 | 'shortcode': $short_code, |
| 816 | 816 | 'attributes': 123, |
| 817 | 817 | 'post_id': 321, |
| 818 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
| 818 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
| 819 | 819 | }; |
| 820 | 820 | |
| 821 | 821 | if (typeof ajaxurl === 'undefined') { |
| 822 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>"; |
|
| 822 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | jQuery.post(ajaxurl, data, function (response) { |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | }); |
| 945 | 945 | |
| 946 | 946 | // The below tries to add the shortcode builder button to the builders own raw/shortcode sections. |
| 947 | - <?php if ( function_exists( 'et_setup_theme' ) ) { ?> |
|
| 947 | + <?php if (function_exists('et_setup_theme')) { ?> |
|
| 948 | 948 | // DIVI |
| 949 | 949 | jQuery(document).on('focusin', '.et-fb-codemirror', function () { |
| 950 | 950 | // insert the shortcode button to the textarea lable if not there already |
@@ -1036,11 +1036,11 @@ discard block |
||
| 1036 | 1036 | var data = { |
| 1037 | 1037 | 'action': 'super_duper_get_picker', |
| 1038 | 1038 | 'editor_id': $id, |
| 1039 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>' |
|
| 1039 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>' |
|
| 1040 | 1040 | }; |
| 1041 | 1041 | |
| 1042 | 1042 | if (!ajaxurl) { |
| 1043 | - var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>"; |
|
| 1043 | + var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; |
|
| 1044 | 1044 | } |
| 1045 | 1045 | |
| 1046 | 1046 | jQuery.post(ajaxurl, data, function (response) { |
@@ -1062,9 +1062,9 @@ discard block |
||
| 1062 | 1062 | */ |
| 1063 | 1063 | function sd_shortcode_button($id) { |
| 1064 | 1064 | if ($id) { |
| 1065 | - return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>'; |
|
| 1065 | + return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>'; |
|
| 1066 | 1066 | } else { |
| 1067 | - return '<?php echo self::shortcode_button();?>'; |
|
| 1067 | + return '<?php echo self::shortcode_button(); ?>'; |
|
| 1068 | 1068 | } |
| 1069 | 1069 | } |
| 1070 | 1070 | </script> |
@@ -1078,11 +1078,11 @@ discard block |
||
| 1078 | 1078 | * |
| 1079 | 1079 | * @return mixed |
| 1080 | 1080 | */ |
| 1081 | - public function widget_css( $advanced = true ) { |
|
| 1081 | + public function widget_css($advanced = true) { |
|
| 1082 | 1082 | ob_start(); |
| 1083 | 1083 | ?> |
| 1084 | 1084 | <style> |
| 1085 | - <?php if( $advanced ){ ?> |
|
| 1085 | + <?php if ($advanced) { ?> |
|
| 1086 | 1086 | .sd-advanced-setting { |
| 1087 | 1087 | display: none; |
| 1088 | 1088 | } |
@@ -1126,10 +1126,10 @@ discard block |
||
| 1126 | 1126 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1127 | 1127 | */ |
| 1128 | 1128 | |
| 1129 | - return str_replace( array( |
|
| 1129 | + return str_replace(array( |
|
| 1130 | 1130 | '<style>', |
| 1131 | 1131 | '</style>' |
| 1132 | - ), '', $output ); |
|
| 1132 | + ), '', $output); |
|
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | /** |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | jQuery($this).data('sd-widget-enabled', true); |
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | - var $button = '<button title="<?php _e( 'Advanced Settings', 'ayecode-connect' );?>" style="line-height: 28px;" 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>'; |
|
| 1199 | + var $button = '<button title="<?php _e('Advanced Settings', 'ayecode-connect'); ?>" style="line-height: 28px;" 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>'; |
|
| 1200 | 1200 | var form = $form ? $form : jQuery($this).parents('' + $selector + ''); |
| 1201 | 1201 | |
| 1202 | 1202 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | }); |
| 1288 | 1288 | |
| 1289 | 1289 | } |
| 1290 | - <?php do_action( 'wp_super_duper_widget_js', $this ); ?> |
|
| 1290 | + <?php do_action('wp_super_duper_widget_js', $this); ?> |
|
| 1291 | 1291 | </script> |
| 1292 | 1292 | <?php |
| 1293 | 1293 | $output = ob_get_clean(); |
@@ -1296,10 +1296,10 @@ discard block |
||
| 1296 | 1296 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 1297 | 1297 | */ |
| 1298 | 1298 | |
| 1299 | - return str_replace( array( |
|
| 1299 | + return str_replace(array( |
|
| 1300 | 1300 | '<script>', |
| 1301 | 1301 | '</script>' |
| 1302 | - ), '', $output ); |
|
| 1302 | + ), '', $output); |
|
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | |
@@ -1310,14 +1310,14 @@ discard block |
||
| 1310 | 1310 | * |
| 1311 | 1311 | * @return mixed |
| 1312 | 1312 | */ |
| 1313 | - private function add_name_from_key( $options, $arguments = false ) { |
|
| 1314 | - if ( ! empty( $options['arguments'] ) ) { |
|
| 1315 | - foreach ( $options['arguments'] as $key => $val ) { |
|
| 1316 | - $options['arguments'][ $key ]['name'] = $key; |
|
| 1313 | + private function add_name_from_key($options, $arguments = false) { |
|
| 1314 | + if (!empty($options['arguments'])) { |
|
| 1315 | + foreach ($options['arguments'] as $key => $val) { |
|
| 1316 | + $options['arguments'][$key]['name'] = $key; |
|
| 1317 | 1317 | } |
| 1318 | - } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { |
|
| 1319 | - foreach ( $options as $key => $val ) { |
|
| 1320 | - $options[ $key ]['name'] = $key; |
|
| 1318 | + } elseif ($arguments && is_array($options) && !empty($options)) { |
|
| 1319 | + foreach ($options as $key => $val) { |
|
| 1320 | + $options[$key]['name'] = $key; |
|
| 1321 | 1321 | } |
| 1322 | 1322 | } |
| 1323 | 1323 | |
@@ -1330,8 +1330,8 @@ discard block |
||
| 1330 | 1330 | * @since 1.0.0 |
| 1331 | 1331 | */ |
| 1332 | 1332 | public function register_shortcode() { |
| 1333 | - add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) ); |
|
| 1334 | - add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) ); |
|
| 1333 | + add_shortcode($this->base_id, array($this, 'shortcode_output')); |
|
| 1334 | + add_action('wp_ajax_super_duper_output_shortcode', array($this, 'render_shortcode')); |
|
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | /** |
@@ -1340,50 +1340,50 @@ discard block |
||
| 1340 | 1340 | * @since 1.0.0 |
| 1341 | 1341 | */ |
| 1342 | 1342 | public function render_shortcode() { |
| 1343 | - check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); |
|
| 1344 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 1343 | + check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true); |
|
| 1344 | + if (!current_user_can('manage_options')) { |
|
| 1345 | 1345 | wp_die(); |
| 1346 | 1346 | } |
| 1347 | 1347 | |
| 1348 | 1348 | // we might need the $post value here so lets set it. |
| 1349 | - if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) { |
|
| 1350 | - $post_obj = get_post( absint( $_POST['post_id'] ) ); |
|
| 1351 | - if ( ! empty( $post_obj ) && empty( $post ) ) { |
|
| 1349 | + if (isset($_POST['post_id']) && $_POST['post_id']) { |
|
| 1350 | + $post_obj = get_post(absint($_POST['post_id'])); |
|
| 1351 | + if (!empty($post_obj) && empty($post)) { |
|
| 1352 | 1352 | global $post; |
| 1353 | 1353 | $post = $post_obj; |
| 1354 | 1354 | } |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | - if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { |
|
| 1357 | + if (isset($_POST['shortcode']) && $_POST['shortcode']) { |
|
| 1358 | 1358 | $is_preview = $this->is_preview(); |
| 1359 | - $shortcode_name = sanitize_title_with_dashes( $_POST['shortcode'] ); |
|
| 1360 | - $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
| 1359 | + $shortcode_name = sanitize_title_with_dashes($_POST['shortcode']); |
|
| 1360 | + $attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array(); |
|
| 1361 | 1361 | $attributes = ''; |
| 1362 | - if ( ! empty( $attributes_array ) ) { |
|
| 1363 | - foreach ( $attributes_array as $key => $value ) { |
|
| 1364 | - if ( is_array( $value ) ) { |
|
| 1365 | - $value = implode( ",", $value ); |
|
| 1362 | + if (!empty($attributes_array)) { |
|
| 1363 | + foreach ($attributes_array as $key => $value) { |
|
| 1364 | + if (is_array($value)) { |
|
| 1365 | + $value = implode(",", $value); |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | - if ( ! empty( $value ) ) { |
|
| 1369 | - $value = wp_unslash( $value ); |
|
| 1368 | + if (!empty($value)) { |
|
| 1369 | + $value = wp_unslash($value); |
|
| 1370 | 1370 | |
| 1371 | 1371 | // Encode [ and ]. |
| 1372 | - if ( $is_preview ) { |
|
| 1373 | - $value = $this->encode_shortcodes( $value ); |
|
| 1372 | + if ($is_preview) { |
|
| 1373 | + $value = $this->encode_shortcodes($value); |
|
| 1374 | 1374 | } |
| 1375 | 1375 | } |
| 1376 | - $attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' "; |
|
| 1376 | + $attributes .= " " . esc_attr(sanitize_title_with_dashes($key)) . "='" . esc_attr($value) . "' "; |
|
| 1377 | 1377 | } |
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | - $shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]"; |
|
| 1380 | + $shortcode = "[" . esc_attr($shortcode_name) . " " . $attributes . "]"; |
|
| 1381 | 1381 | |
| 1382 | - $content = do_shortcode( $shortcode ); |
|
| 1382 | + $content = do_shortcode($shortcode); |
|
| 1383 | 1383 | |
| 1384 | 1384 | // Decode [ and ]. |
| 1385 | - if ( ! empty( $content ) && $is_preview ) { |
|
| 1386 | - $content = $this->decode_shortcodes( $content ); |
|
| 1385 | + if (!empty($content) && $is_preview) { |
|
| 1386 | + $content = $this->decode_shortcodes($content); |
|
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | 1389 | echo $content; |
@@ -1399,21 +1399,21 @@ discard block |
||
| 1399 | 1399 | * |
| 1400 | 1400 | * @return string |
| 1401 | 1401 | */ |
| 1402 | - public function shortcode_output( $args = array(), $content = '' ) { |
|
| 1402 | + public function shortcode_output($args = array(), $content = '') { |
|
| 1403 | 1403 | $_instance = $args; |
| 1404 | 1404 | |
| 1405 | - $args = $this->argument_values( $args ); |
|
| 1405 | + $args = $this->argument_values($args); |
|
| 1406 | 1406 | |
| 1407 | 1407 | // add extra argument so we know its a output to gutenberg |
| 1408 | 1408 | //$args |
| 1409 | - $args = $this->string_to_bool( $args ); |
|
| 1409 | + $args = $this->string_to_bool($args); |
|
| 1410 | 1410 | |
| 1411 | 1411 | // if we have a enclosed shortcode we add it to the special `html` argument |
| 1412 | - if ( ! empty( $content ) ) { |
|
| 1412 | + if (!empty($content)) { |
|
| 1413 | 1413 | $args['html'] = $content; |
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - if ( ! $this->is_preview() ) { |
|
| 1416 | + if (!$this->is_preview()) { |
|
| 1417 | 1417 | /** |
| 1418 | 1418 | * Filters the settings for a particular widget args. |
| 1419 | 1419 | * |
@@ -1424,40 +1424,40 @@ discard block |
||
| 1424 | 1424 | *@since 1.0.28 |
| 1425 | 1425 | * |
| 1426 | 1426 | */ |
| 1427 | - $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance ); |
|
| 1427 | + $args = apply_filters('wp_super_duper_widget_display_callback', $args, $this, $_instance); |
|
| 1428 | 1428 | |
| 1429 | - if ( ! is_array( $args ) ) { |
|
| 1429 | + if (!is_array($args)) { |
|
| 1430 | 1430 | return $args; |
| 1431 | 1431 | } |
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | - $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; |
|
| 1435 | - $class .= " sdel-".$this->get_instance_hash(); |
|
| 1434 | + $class = isset($this->options['widget_ops']['classname']) ? esc_attr($this->options['widget_ops']['classname']) : ''; |
|
| 1435 | + $class .= " sdel-" . $this->get_instance_hash(); |
|
| 1436 | 1436 | |
| 1437 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
| 1438 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
| 1437 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
| 1438 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
| 1439 | 1439 | |
| 1440 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
| 1441 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
| 1440 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
| 1441 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
| 1442 | 1442 | |
| 1443 | 1443 | $shortcode_args = array(); |
| 1444 | 1444 | $output = ''; |
| 1445 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
| 1446 | - if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) { |
|
| 1445 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
| 1446 | + if (isset($args['no_wrap']) && $args['no_wrap']) { |
|
| 1447 | 1447 | $no_wrap = true; |
| 1448 | 1448 | } |
| 1449 | - $main_content = $this->output( $args, $shortcode_args, $content ); |
|
| 1450 | - if ( $main_content && ! $no_wrap ) { |
|
| 1449 | + $main_content = $this->output($args, $shortcode_args, $content); |
|
| 1450 | + if ($main_content && !$no_wrap) { |
|
| 1451 | 1451 | // wrap the shortcode in a div with the same class as the widget |
| 1452 | 1452 | $output .= '<div class="' . $class . '" ' . $attrs . '>'; |
| 1453 | - if ( ! empty( $args['title'] ) ) { |
|
| 1453 | + if (!empty($args['title'])) { |
|
| 1454 | 1454 | // if its a shortcode and there is a title try to grab the title wrappers |
| 1455 | - $shortcode_args = array( 'before_title' => '', 'after_title' => '' ); |
|
| 1456 | - if ( empty( $instance ) ) { |
|
| 1455 | + $shortcode_args = array('before_title' => '', 'after_title' => ''); |
|
| 1456 | + if (empty($instance)) { |
|
| 1457 | 1457 | global $wp_registered_sidebars; |
| 1458 | - if ( ! empty( $wp_registered_sidebars ) ) { |
|
| 1459 | - foreach ( $wp_registered_sidebars as $sidebar ) { |
|
| 1460 | - if ( ! empty( $sidebar['before_title'] ) ) { |
|
| 1458 | + if (!empty($wp_registered_sidebars)) { |
|
| 1459 | + foreach ($wp_registered_sidebars as $sidebar) { |
|
| 1460 | + if (!empty($sidebar['before_title'])) { |
|
| 1461 | 1461 | $shortcode_args['before_title'] = $sidebar['before_title']; |
| 1462 | 1462 | $shortcode_args['after_title'] = $sidebar['after_title']; |
| 1463 | 1463 | break; |
@@ -1465,20 +1465,20 @@ discard block |
||
| 1465 | 1465 | } |
| 1466 | 1466 | } |
| 1467 | 1467 | } |
| 1468 | - $output .= $this->output_title( $shortcode_args, $args ); |
|
| 1468 | + $output .= $this->output_title($shortcode_args, $args); |
|
| 1469 | 1469 | } |
| 1470 | 1470 | $output .= $main_content; |
| 1471 | 1471 | $output .= '</div>'; |
| 1472 | - } elseif ( $main_content && $no_wrap ) { |
|
| 1472 | + } elseif ($main_content && $no_wrap) { |
|
| 1473 | 1473 | $output .= $main_content; |
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | 1476 | // if preview show a placeholder if empty |
| 1477 | - if ( $this->is_preview() && $output == '' ) { |
|
| 1478 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
| 1477 | + if ($this->is_preview() && $output == '') { |
|
| 1478 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
| 1479 | 1479 | } |
| 1480 | 1480 | |
| 1481 | - return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); |
|
| 1481 | + return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this); |
|
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | /** |
@@ -1488,8 +1488,8 @@ discard block |
||
| 1488 | 1488 | * |
| 1489 | 1489 | * @return string |
| 1490 | 1490 | */ |
| 1491 | - public function preview_placeholder_text( $name = '' ) { |
|
| 1492 | - return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "</div>"; |
|
| 1491 | + public function preview_placeholder_text($name = '') { |
|
| 1492 | + return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . wp_sprintf(__('Placeholder for: %s', 'ayecode-connect'), $name) . "</div>"; |
|
| 1493 | 1493 | } |
| 1494 | 1494 | |
| 1495 | 1495 | /** |
@@ -1499,13 +1499,13 @@ discard block |
||
| 1499 | 1499 | * |
| 1500 | 1500 | * @return mixed |
| 1501 | 1501 | */ |
| 1502 | - public function string_to_bool( $options ) { |
|
| 1502 | + public function string_to_bool($options) { |
|
| 1503 | 1503 | // convert bool strings to booleans |
| 1504 | - foreach ( $options as $key => $val ) { |
|
| 1505 | - if ( $val == 'false' ) { |
|
| 1506 | - $options[ $key ] = false; |
|
| 1507 | - } elseif ( $val == 'true' ) { |
|
| 1508 | - $options[ $key ] = true; |
|
| 1504 | + foreach ($options as $key => $val) { |
|
| 1505 | + if ($val == 'false') { |
|
| 1506 | + $options[$key] = false; |
|
| 1507 | + } elseif ($val == 'true') { |
|
| 1508 | + $options[$key] = true; |
|
| 1509 | 1509 | } |
| 1510 | 1510 | } |
| 1511 | 1511 | |
@@ -1521,26 +1521,26 @@ discard block |
||
| 1521 | 1521 | *@since 1.0.12 Don't set checkbox default value if the value is empty. |
| 1522 | 1522 | * |
| 1523 | 1523 | */ |
| 1524 | - public function argument_values( $instance ) { |
|
| 1524 | + public function argument_values($instance) { |
|
| 1525 | 1525 | $argument_values = array(); |
| 1526 | 1526 | |
| 1527 | 1527 | // set widget instance |
| 1528 | 1528 | $this->instance = $instance; |
| 1529 | 1529 | |
| 1530 | - if ( empty( $this->arguments ) ) { |
|
| 1530 | + if (empty($this->arguments)) { |
|
| 1531 | 1531 | $this->arguments = $this->get_arguments(); |
| 1532 | 1532 | } |
| 1533 | 1533 | |
| 1534 | - if ( ! empty( $this->arguments ) ) { |
|
| 1535 | - foreach ( $this->arguments as $key => $args ) { |
|
| 1534 | + if (!empty($this->arguments)) { |
|
| 1535 | + foreach ($this->arguments as $key => $args) { |
|
| 1536 | 1536 | // set the input name from the key |
| 1537 | 1537 | $args['name'] = $key; |
| 1538 | 1538 | // |
| 1539 | - $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; |
|
| 1540 | - if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) { |
|
| 1539 | + $argument_values[$key] = isset($instance[$key]) ? $instance[$key] : ''; |
|
| 1540 | + if ($args['type'] == 'checkbox' && $argument_values[$key] == '') { |
|
| 1541 | 1541 | // don't set default for an empty checkbox |
| 1542 | - } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { |
|
| 1543 | - $argument_values[ $key ] = $args['default']; |
|
| 1542 | + } elseif ($argument_values[$key] == '' && isset($args['default'])) { |
|
| 1543 | + $argument_values[$key] = $args['default']; |
|
| 1544 | 1544 | } |
| 1545 | 1545 | } |
| 1546 | 1546 | } |
@@ -1567,15 +1567,15 @@ discard block |
||
| 1567 | 1567 | * |
| 1568 | 1568 | */ |
| 1569 | 1569 | public function get_arguments() { |
| 1570 | - if ( empty( $this->arguments ) ) { |
|
| 1570 | + if (empty($this->arguments)) { |
|
| 1571 | 1571 | $this->arguments = $this->set_arguments(); |
| 1572 | 1572 | } |
| 1573 | 1573 | |
| 1574 | - $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance ); |
|
| 1575 | - $this->arguments = $this->add_name_from_key( $this->arguments, true ); |
|
| 1574 | + $this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance); |
|
| 1575 | + $this->arguments = $this->add_name_from_key($this->arguments, true); |
|
| 1576 | 1576 | |
| 1577 | - if( !empty( $this->arguments['title']['value'] ) ){ |
|
| 1578 | - $this->arguments['title']['value'] = wp_kses_post( $this->arguments['title']['value'] ); |
|
| 1577 | + if (!empty($this->arguments['title']['value'])) { |
|
| 1578 | + $this->arguments['title']['value'] = wp_kses_post($this->arguments['title']['value']); |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | return $this->arguments; |
@@ -1588,7 +1588,7 @@ discard block |
||
| 1588 | 1588 | * @param array $widget_args |
| 1589 | 1589 | * @param string $content |
| 1590 | 1590 | */ |
| 1591 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
| 1591 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
| 1592 | 1592 | |
| 1593 | 1593 | } |
| 1594 | 1594 | |
@@ -1596,9 +1596,9 @@ discard block |
||
| 1596 | 1596 | * Add the dynamic block code inline when the wp-block in enqueued. |
| 1597 | 1597 | */ |
| 1598 | 1598 | public function register_block() { |
| 1599 | - wp_add_inline_script( 'wp-blocks', $this->block() ); |
|
| 1600 | - if ( class_exists( 'SiteOrigin_Panels' ) ) { |
|
| 1601 | - wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() ); |
|
| 1599 | + wp_add_inline_script('wp-blocks', $this->block()); |
|
| 1600 | + if (class_exists('SiteOrigin_Panels')) { |
|
| 1601 | + wp_add_inline_script('wp-blocks', $this->siteorigin_js()); |
|
| 1602 | 1602 | } |
| 1603 | 1603 | } |
| 1604 | 1604 | |
@@ -1612,9 +1612,9 @@ discard block |
||
| 1612 | 1612 | $show = false; |
| 1613 | 1613 | $arguments = $this->get_arguments(); |
| 1614 | 1614 | |
| 1615 | - if ( ! empty( $arguments ) ) { |
|
| 1616 | - foreach ( $arguments as $argument ) { |
|
| 1617 | - if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { |
|
| 1615 | + if (!empty($arguments)) { |
|
| 1616 | + foreach ($arguments as $argument) { |
|
| 1617 | + if (isset($argument['advanced']) && $argument['advanced']) { |
|
| 1618 | 1618 | $show = true; |
| 1619 | 1619 | break; // no need to continue if we know we have it |
| 1620 | 1620 | } |
@@ -1632,19 +1632,19 @@ discard block |
||
| 1632 | 1632 | public function get_url() { |
| 1633 | 1633 | $url = $this->url; |
| 1634 | 1634 | |
| 1635 | - if ( ! $url ) { |
|
| 1636 | - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); |
|
| 1637 | - $content_url = untrailingslashit( WP_CONTENT_URL ); |
|
| 1635 | + if (!$url) { |
|
| 1636 | + $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR)); |
|
| 1637 | + $content_url = untrailingslashit(WP_CONTENT_URL); |
|
| 1638 | 1638 | |
| 1639 | 1639 | // Replace http:// to https://. |
| 1640 | - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { |
|
| 1641 | - $content_url = str_replace( 'http://', 'https://', $content_url ); |
|
| 1640 | + if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) { |
|
| 1641 | + $content_url = str_replace('http://', 'https://', $content_url); |
|
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | 1644 | // Check if we are inside a plugin |
| 1645 | - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); |
|
| 1646 | - $url = str_replace( $content_dir, $content_url, $file_dir ); |
|
| 1647 | - $url = trailingslashit( $url ); |
|
| 1645 | + $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__))); |
|
| 1646 | + $url = str_replace($content_dir, $content_url, $file_dir); |
|
| 1647 | + $url = trailingslashit($url); |
|
| 1648 | 1648 | $this->url = $url; |
| 1649 | 1649 | } |
| 1650 | 1650 | |
@@ -1660,15 +1660,15 @@ discard block |
||
| 1660 | 1660 | |
| 1661 | 1661 | $url = $this->url; |
| 1662 | 1662 | |
| 1663 | - if ( ! $url ) { |
|
| 1663 | + if (!$url) { |
|
| 1664 | 1664 | // check if we are inside a plugin |
| 1665 | - $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) ); |
|
| 1665 | + $file_dir = str_replace("/includes", "", dirname(__FILE__)); |
|
| 1666 | 1666 | |
| 1667 | - $dir_parts = explode( "/wp-content/", $file_dir ); |
|
| 1668 | - $url_parts = explode( "/wp-content/", plugins_url() ); |
|
| 1667 | + $dir_parts = explode("/wp-content/", $file_dir); |
|
| 1668 | + $url_parts = explode("/wp-content/", plugins_url()); |
|
| 1669 | 1669 | |
| 1670 | - if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) { |
|
| 1671 | - $url = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] ); |
|
| 1670 | + if (!empty($url_parts[0]) && !empty($dir_parts[1])) { |
|
| 1671 | + $url = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]); |
|
| 1672 | 1672 | $this->url = $url; |
| 1673 | 1673 | } |
| 1674 | 1674 | } |
@@ -1689,45 +1689,45 @@ discard block |
||
| 1689 | 1689 | * @return string |
| 1690 | 1690 | *@since 1.1.0 |
| 1691 | 1691 | */ |
| 1692 | - public function get_block_icon( $icon ) { |
|
| 1692 | + public function get_block_icon($icon) { |
|
| 1693 | 1693 | |
| 1694 | 1694 | // check if we have a Font Awesome icon |
| 1695 | 1695 | $fa_type = ''; |
| 1696 | - if ( substr( $icon, 0, 7 ) === "fas fa-" ) { |
|
| 1696 | + if (substr($icon, 0, 7) === "fas fa-") { |
|
| 1697 | 1697 | $fa_type = 'solid'; |
| 1698 | - } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) { |
|
| 1698 | + } elseif (substr($icon, 0, 7) === "far fa-") { |
|
| 1699 | 1699 | $fa_type = 'regular'; |
| 1700 | - } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) { |
|
| 1700 | + } elseif (substr($icon, 0, 7) === "fab fa-") { |
|
| 1701 | 1701 | $fa_type = 'brands'; |
| 1702 | 1702 | } else { |
| 1703 | 1703 | $icon = "'" . $icon . "'"; |
| 1704 | 1704 | } |
| 1705 | 1705 | |
| 1706 | 1706 | // set the icon if we found one |
| 1707 | - if ( $fa_type ) { |
|
| 1708 | - $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon ); |
|
| 1707 | + if ($fa_type) { |
|
| 1708 | + $fa_icon = str_replace(array("fas fa-", "far fa-", "fab fa-"), "", $icon); |
|
| 1709 | 1709 | $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 . "'}))"; |
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | 1712 | return $icon; |
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | - public function group_arguments( $arguments ) { |
|
| 1716 | - if ( ! empty( $arguments ) ) { |
|
| 1715 | + public function group_arguments($arguments) { |
|
| 1716 | + if (!empty($arguments)) { |
|
| 1717 | 1717 | $temp_arguments = array(); |
| 1718 | - $general = __( "General", 'ayecode-connect' ); |
|
| 1718 | + $general = __("General", 'ayecode-connect'); |
|
| 1719 | 1719 | $add_sections = false; |
| 1720 | - foreach ( $arguments as $key => $args ) { |
|
| 1721 | - if ( isset( $args['group'] ) ) { |
|
| 1722 | - $temp_arguments[ $args['group'] ][ $key ] = $args; |
|
| 1720 | + foreach ($arguments as $key => $args) { |
|
| 1721 | + if (isset($args['group'])) { |
|
| 1722 | + $temp_arguments[$args['group']][$key] = $args; |
|
| 1723 | 1723 | $add_sections = true; |
| 1724 | 1724 | } else { |
| 1725 | - $temp_arguments[ $general ][ $key ] = $args; |
|
| 1725 | + $temp_arguments[$general][$key] = $args; |
|
| 1726 | 1726 | } |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | 1729 | // only add sections if more than one |
| 1730 | - if ( $add_sections ) { |
|
| 1730 | + if ($add_sections) { |
|
| 1731 | 1731 | $arguments = $temp_arguments; |
| 1732 | 1732 | } |
| 1733 | 1733 | } |
@@ -1740,38 +1740,38 @@ discard block |
||
| 1740 | 1740 | * |
| 1741 | 1741 | * @since 1.1.17 |
| 1742 | 1742 | */ |
| 1743 | - public function group_block_tabs( $tabs, $arguments ) { |
|
| 1744 | - if ( ! empty( $tabs ) && ! empty( $arguments ) ) { |
|
| 1743 | + public function group_block_tabs($tabs, $arguments) { |
|
| 1744 | + if (!empty($tabs) && !empty($arguments)) { |
|
| 1745 | 1745 | $has_sections = false; |
| 1746 | 1746 | |
| 1747 | - foreach ( $this->arguments as $key => $args ) { |
|
| 1748 | - if ( isset( $args['group'] ) ) { |
|
| 1747 | + foreach ($this->arguments as $key => $args) { |
|
| 1748 | + if (isset($args['group'])) { |
|
| 1749 | 1749 | $has_sections = true; |
| 1750 | 1750 | break; |
| 1751 | 1751 | } |
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | - if ( ! $has_sections ) { |
|
| 1754 | + if (!$has_sections) { |
|
| 1755 | 1755 | return $tabs; |
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | 1758 | $new_tabs = array(); |
| 1759 | 1759 | |
| 1760 | - foreach ( $tabs as $tab_key => $tab ) { |
|
| 1760 | + foreach ($tabs as $tab_key => $tab) { |
|
| 1761 | 1761 | $new_groups = array(); |
| 1762 | 1762 | |
| 1763 | - if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) { |
|
| 1764 | - foreach ( $tab['groups'] as $group ) { |
|
| 1765 | - if ( isset( $arguments[ $group ] ) ) { |
|
| 1763 | + if (!empty($tab['groups']) && is_array($tab['groups'])) { |
|
| 1764 | + foreach ($tab['groups'] as $group) { |
|
| 1765 | + if (isset($arguments[$group])) { |
|
| 1766 | 1766 | $new_groups[] = $group; |
| 1767 | 1767 | } |
| 1768 | 1768 | } |
| 1769 | 1769 | } |
| 1770 | 1770 | |
| 1771 | - if ( ! empty( $new_groups ) ) { |
|
| 1771 | + if (!empty($new_groups)) { |
|
| 1772 | 1772 | $tab['groups'] = $new_groups; |
| 1773 | 1773 | |
| 1774 | - $new_tabs[ $tab_key ] = $tab; |
|
| 1774 | + $new_tabs[$tab_key] = $tab; |
|
| 1775 | 1775 | } |
| 1776 | 1776 | } |
| 1777 | 1777 | |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | ?> |
| 1799 | 1799 | <script> |
| 1800 | 1800 | <?php |
| 1801 | - if ( ! $sd_is_js_functions_loaded ) { |
|
| 1801 | + if (!$sd_is_js_functions_loaded) { |
|
| 1802 | 1802 | $sd_is_js_functions_loaded = true; |
| 1803 | 1803 | ?> |
| 1804 | 1804 | function sd_show_view_options($this){ |
@@ -2121,7 +2121,7 @@ discard block |
||
| 2121 | 2121 | } |
| 2122 | 2122 | } |
| 2123 | 2123 | |
| 2124 | -<?php if( !isset( $_REQUEST['sd-block-recover-debug'] ) ){ ?> |
|
| 2124 | +<?php if (!isset($_REQUEST['sd-block-recover-debug'])) { ?> |
|
| 2125 | 2125 | // Wait will window is loaded before calling. |
| 2126 | 2126 | window.onload = function() { |
| 2127 | 2127 | sd_auto_recover_blocks(); |
@@ -2300,7 +2300,7 @@ discard block |
||
| 2300 | 2300 | $classes = []; |
| 2301 | 2301 | |
| 2302 | 2302 | <?php |
| 2303 | - if($aui_bs5){ |
|
| 2303 | + if ($aui_bs5) { |
|
| 2304 | 2304 | ?> |
| 2305 | 2305 | $aui_bs5 = true; |
| 2306 | 2306 | $p_ml = 'ms-'; |
@@ -2309,7 +2309,7 @@ discard block |
||
| 2309 | 2309 | $p_pl = 'ps-'; |
| 2310 | 2310 | $p_pr = 'pe-'; |
| 2311 | 2311 | <?php |
| 2312 | - }else{ |
|
| 2312 | + } else { |
|
| 2313 | 2313 | ?> |
| 2314 | 2314 | $aui_bs5 = false; |
| 2315 | 2315 | $p_ml = 'ml-'; |
@@ -2497,7 +2497,7 @@ discard block |
||
| 2497 | 2497 | } |
| 2498 | 2498 | |
| 2499 | 2499 | function sd_get_class_build_keys(){ |
| 2500 | - return <?php echo json_encode(sd_get_class_build_keys());?>; |
|
| 2500 | + return <?php echo json_encode(sd_get_class_build_keys()); ?>; |
|
| 2501 | 2501 | } |
| 2502 | 2502 | |
| 2503 | 2503 | <?php |
@@ -2505,7 +2505,7 @@ discard block |
||
| 2505 | 2505 | |
| 2506 | 2506 | } |
| 2507 | 2507 | |
| 2508 | - if(method_exists($this,'block_global_js')){ |
|
| 2508 | + if (method_exists($this, 'block_global_js')) { |
|
| 2509 | 2509 | echo $this->block_global_js(); |
| 2510 | 2510 | } |
| 2511 | 2511 | ?> |
@@ -2537,9 +2537,9 @@ discard block |
||
| 2537 | 2537 | var InnerBlocks = blockEditor.InnerBlocks; |
| 2538 | 2538 | |
| 2539 | 2539 | var term_query_type = ''; |
| 2540 | - var post_type_rest_slugs = <?php if(! empty( $this->arguments ) && isset($this->arguments['post_type']['onchange_rest']['values'])){echo "[".json_encode($this->arguments['post_type']['onchange_rest']['values'])."]";}else{echo "[]";} ?>; |
|
| 2541 | - const taxonomies_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
| 2542 | - const sort_by_<?php echo str_replace("-","_", $this->id);?> = [{label: "Please wait", value: 0}]; |
|
| 2540 | + var post_type_rest_slugs = <?php if (!empty($this->arguments) && isset($this->arguments['post_type']['onchange_rest']['values'])) {echo "[" . json_encode($this->arguments['post_type']['onchange_rest']['values']) . "]"; } else {echo "[]"; } ?>; |
|
| 2541 | + const taxonomies_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
| 2542 | + const sort_by_<?php echo str_replace("-", "_", $this->id); ?> = [{label: "Please wait", value: 0}]; |
|
| 2543 | 2543 | const MediaUpload = wp.blockEditor.MediaUpload; |
| 2544 | 2544 | |
| 2545 | 2545 | /** |
@@ -2554,87 +2554,87 @@ discard block |
||
| 2554 | 2554 | * @return {?WPBlock} The block, if it has been successfully |
| 2555 | 2555 | * registered; otherwise `undefined`. |
| 2556 | 2556 | */ |
| 2557 | - 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. |
|
| 2558 | - apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>, |
|
| 2559 | - title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title. |
|
| 2560 | - description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title. |
|
| 2561 | - 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/. |
|
| 2557 | + 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. |
|
| 2558 | + apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2; ?>, |
|
| 2559 | + title: '<?php echo addslashes($this->options['name']); ?>', // Block title. |
|
| 2560 | + description: '<?php echo addslashes($this->options['widget_ops']['description'])?>', // Block title. |
|
| 2561 | + 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/. |
|
| 2562 | 2562 | supports: { |
| 2563 | 2563 | <?php |
| 2564 | - if(!isset($this->options['block-supports']['renaming'])){ |
|
| 2564 | + if (!isset($this->options['block-supports']['renaming'])) { |
|
| 2565 | 2565 | $this->options['block-supports']['renaming'] = false; |
| 2566 | 2566 | } |
| 2567 | - if ( isset( $this->options['block-supports'] ) ) { |
|
| 2568 | - echo $this->array_to_attributes( $this->options['block-supports'] ); |
|
| 2567 | + if (isset($this->options['block-supports'])) { |
|
| 2568 | + echo $this->array_to_attributes($this->options['block-supports']); |
|
| 2569 | 2569 | } |
| 2570 | 2570 | ?> |
| 2571 | 2571 | }, |
| 2572 | 2572 | __experimentalLabel( attributes, { context } ) { |
| 2573 | 2573 | var visibility_html = attributes && attributes.visibility_conditions ? ' 👁' : ''; |
| 2574 | 2574 | var metadata_name = attributes && attributes.metadata && attributes.metadata.name ? attributes.metadata.name : ''; |
| 2575 | - var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr( addslashes( $this->options['name'] ) ) . "'"; ?>; |
|
| 2575 | + var label_name = <?php echo !empty($this->options['block-label']) ? $this->options['block-label'] : "'" . esc_attr(addslashes($this->options['name'])) . "'"; ?>; |
|
| 2576 | 2576 | return metadata_name ? metadata_name + visibility_html : label_name + visibility_html; |
| 2577 | 2577 | }, |
| 2578 | - 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. |
|
| 2579 | - <?php if ( isset( $this->options['block-keywords'] ) ) { |
|
| 2578 | + 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. |
|
| 2579 | + <?php if (isset($this->options['block-keywords'])) { |
|
| 2580 | 2580 | echo "keywords : " . $this->options['block-keywords'] . ","; |
| 2581 | 2581 | } |
| 2582 | 2582 | |
| 2583 | 2583 | |
| 2584 | 2584 | // block hover preview. |
| 2585 | 2585 | $example_args = array(); |
| 2586 | - if(!empty($this->arguments)){ |
|
| 2587 | - foreach($this->arguments as $key => $a_args){ |
|
| 2588 | - if(isset($a_args['example'])){ |
|
| 2586 | + if (!empty($this->arguments)) { |
|
| 2587 | + foreach ($this->arguments as $key => $a_args) { |
|
| 2588 | + if (isset($a_args['example'])) { |
|
| 2589 | 2589 | $example_args[$key] = $a_args['example']; |
| 2590 | 2590 | } |
| 2591 | 2591 | } |
| 2592 | 2592 | } |
| 2593 | - $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: '.absint($this->options['example']['viewportWidth']) : ''; |
|
| 2593 | + $viewport_width = isset($this->options['example']['viewportWidth']) ? 'viewportWidth: ' . absint($this->options['example']['viewportWidth']) : ''; |
|
| 2594 | 2594 | $example_inner_blocks = !empty($this->options['example']['innerBlocks']) && is_array($this->options['example']['innerBlocks']) ? 'innerBlocks: ' . wp_json_encode($this->options['example']['innerBlocks']) : ''; |
| 2595 | - if( isset( $this->options['example'] ) && $this->options['example'] === false ){ |
|
| 2595 | + if (isset($this->options['example']) && $this->options['example'] === false) { |
|
| 2596 | 2596 | // no preview if set to false |
| 2597 | - }elseif( !empty( $example_args ) ){ |
|
| 2598 | - echo "example : {attributes:{".$this->array_to_attributes( $example_args )."},$viewport_width},"; |
|
| 2599 | - }elseif( !empty( $this->options['example'] ) ){ |
|
| 2597 | + }elseif (!empty($example_args)) { |
|
| 2598 | + echo "example : {attributes:{" . $this->array_to_attributes($example_args) . "},$viewport_width},"; |
|
| 2599 | + }elseif (!empty($this->options['example'])) { |
|
| 2600 | 2600 | unset($this->options['example']['viewportWidth']); |
| 2601 | 2601 | unset($this->options['example']['innerBlocks']); |
| 2602 | - $example_atts = $this->array_to_attributes( $this->options['example'] ); |
|
| 2602 | + $example_atts = $this->array_to_attributes($this->options['example']); |
|
| 2603 | 2603 | $example_parts = array(); |
| 2604 | - if($example_atts){ |
|
| 2605 | - $example_parts[] = rtrim($example_atts,","); |
|
| 2604 | + if ($example_atts) { |
|
| 2605 | + $example_parts[] = rtrim($example_atts, ","); |
|
| 2606 | 2606 | } |
| 2607 | - if($viewport_width){ |
|
| 2607 | + if ($viewport_width) { |
|
| 2608 | 2608 | $example_parts[] = $viewport_width; |
| 2609 | 2609 | } |
| 2610 | - if($example_inner_blocks){ |
|
| 2610 | + if ($example_inner_blocks) { |
|
| 2611 | 2611 | $example_parts[] = $example_inner_blocks; |
| 2612 | 2612 | } |
| 2613 | - if(!empty($example_parts)){ |
|
| 2614 | - echo "example : {".implode(',', $example_parts)."},"; |
|
| 2613 | + if (!empty($example_parts)) { |
|
| 2614 | + echo "example : {" . implode(',', $example_parts) . "},"; |
|
| 2615 | 2615 | } |
| 2616 | - }else{ |
|
| 2616 | + } else { |
|
| 2617 | 2617 | echo 'example : {viewportWidth: 500},'; |
| 2618 | 2618 | } |
| 2619 | 2619 | |
| 2620 | 2620 | |
| 2621 | 2621 | |
| 2622 | 2622 | // limit to parent |
| 2623 | - if( !empty( $this->options['parent'] ) ){ |
|
| 2624 | - echo "parent : " . wp_json_encode( $this->options['parent'] ) . ","; |
|
| 2623 | + if (!empty($this->options['parent'])) { |
|
| 2624 | + echo "parent : " . wp_json_encode($this->options['parent']) . ","; |
|
| 2625 | 2625 | } |
| 2626 | 2626 | |
| 2627 | 2627 | // limit allowed blocks |
| 2628 | - if( !empty( $this->options['allowed-blocks'] ) ){ |
|
| 2629 | - echo "allowedBlocks : " . wp_json_encode( $this->options['allowed-blocks'] ) . ","; |
|
| 2628 | + if (!empty($this->options['allowed-blocks'])) { |
|
| 2629 | + echo "allowedBlocks : " . wp_json_encode($this->options['allowed-blocks']) . ","; |
|
| 2630 | 2630 | } |
| 2631 | 2631 | |
| 2632 | 2632 | // maybe set no_wrap |
| 2633 | - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; |
|
| 2634 | - if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) { |
|
| 2633 | + $no_wrap = isset($this->options['no_wrap']) && $this->options['no_wrap'] ? true : false; |
|
| 2634 | + if (isset($this->arguments['no_wrap']) && $this->arguments['no_wrap']) { |
|
| 2635 | 2635 | $no_wrap = true; |
| 2636 | 2636 | } |
| 2637 | - if ( $no_wrap ) { |
|
| 2637 | + if ($no_wrap) { |
|
| 2638 | 2638 | $this->options['block-wrap'] = ''; |
| 2639 | 2639 | } |
| 2640 | 2640 | |
@@ -2644,7 +2644,7 @@ discard block |
||
| 2644 | 2644 | |
| 2645 | 2645 | echo "attributes : {"; |
| 2646 | 2646 | |
| 2647 | - if ( $show_advanced ) { |
|
| 2647 | + if ($show_advanced) { |
|
| 2648 | 2648 | echo "show_advanced: {"; |
| 2649 | 2649 | echo " type: 'boolean',"; |
| 2650 | 2650 | echo " default: false"; |
@@ -2652,60 +2652,60 @@ discard block |
||
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 2654 | 2654 | // Block wrap element |
| 2655 | - if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this? |
|
| 2655 | + if (!empty($this->options['block-wrap'])) { //@todo we should validate this? |
|
| 2656 | 2656 | echo "block_wrap: {"; |
| 2657 | 2657 | echo " type: 'string',"; |
| 2658 | - echo " default: '" . esc_attr( $this->options['block-wrap'] ) . "'"; |
|
| 2658 | + echo " default: '" . esc_attr($this->options['block-wrap']) . "'"; |
|
| 2659 | 2659 | echo "},"; |
| 2660 | 2660 | } |
| 2661 | 2661 | |
| 2662 | - if ( ! empty( $this->arguments ) ) { |
|
| 2663 | - foreach ( $this->arguments as $key => $args ) { |
|
| 2664 | - if ( $args['type'] == 'image' || $args['type'] == 'images' ) { |
|
| 2662 | + if (!empty($this->arguments)) { |
|
| 2663 | + foreach ($this->arguments as $key => $args) { |
|
| 2664 | + if ($args['type'] == 'image' || $args['type'] == 'images') { |
|
| 2665 | 2665 | $img_drag_drop = true; |
| 2666 | 2666 | } |
| 2667 | 2667 | |
| 2668 | 2668 | // Set if we should show alignment. |
| 2669 | - if ( $key == 'alignment' ) { |
|
| 2669 | + if ($key == 'alignment') { |
|
| 2670 | 2670 | $show_alignment = true; |
| 2671 | 2671 | } |
| 2672 | 2672 | |
| 2673 | 2673 | $extra = ''; |
| 2674 | - $_default = isset( $args['default'] ) && ! is_null( $args['default'] ) ? $args['default'] : ''; |
|
| 2674 | + $_default = isset($args['default']) && !is_null($args['default']) ? $args['default'] : ''; |
|
| 2675 | 2675 | |
| 2676 | - if ( ! empty( $_default ) ) { |
|
| 2677 | - $_default = wp_slash( $_default ); |
|
| 2676 | + if (!empty($_default)) { |
|
| 2677 | + $_default = wp_slash($_default); |
|
| 2678 | 2678 | } |
| 2679 | 2679 | |
| 2680 | - if ( $args['type'] == 'notice' || $args['type'] == 'tab' ) { |
|
| 2680 | + if ($args['type'] == 'notice' || $args['type'] == 'tab') { |
|
| 2681 | 2681 | continue; |
| 2682 | - } else if ( $args['type'] == 'checkbox' ) { |
|
| 2682 | + } else if ($args['type'] == 'checkbox') { |
|
| 2683 | 2683 | $type = 'boolean'; |
| 2684 | 2684 | $default = $_default ? 'true' : 'false'; |
| 2685 | - } else if ( $args['type'] == 'number' ) { |
|
| 2685 | + } else if ($args['type'] == 'number') { |
|
| 2686 | 2686 | $type = 'number'; |
| 2687 | 2687 | $default = "'" . $_default . "'"; |
| 2688 | - } else if ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) { |
|
| 2688 | + } else if ($args['type'] == 'select' && !empty($args['multiple'])) { |
|
| 2689 | 2689 | $type = 'array'; |
| 2690 | - if ( isset( $args['default'] ) && is_array( $args['default'] ) ) { |
|
| 2691 | - $default = ! empty( $_default ) ? "['" . implode( "','", $_default ) . "']" : "[]"; |
|
| 2690 | + if (isset($args['default']) && is_array($args['default'])) { |
|
| 2691 | + $default = !empty($_default) ? "['" . implode("','", $_default) . "']" : "[]"; |
|
| 2692 | 2692 | } else { |
| 2693 | 2693 | $default = "'" . $_default . "'"; |
| 2694 | 2694 | } |
| 2695 | - } else if ( $args['type'] == 'tagselect' ) { |
|
| 2695 | + } else if ($args['type'] == 'tagselect') { |
|
| 2696 | 2696 | $type = 'array'; |
| 2697 | 2697 | $default = "'" . $_default . "'"; |
| 2698 | - } else if ( $args['type'] == 'multiselect' ) { |
|
| 2698 | + } else if ($args['type'] == 'multiselect') { |
|
| 2699 | 2699 | $type = 'array'; |
| 2700 | 2700 | $default = "'" . $_default . "'"; |
| 2701 | - } else if ( $args['type'] == 'image_xy' ) { |
|
| 2701 | + } else if ($args['type'] == 'image_xy') { |
|
| 2702 | 2702 | $type = 'object'; |
| 2703 | 2703 | $default = "'" . $_default . "'"; |
| 2704 | - } else if ( $args['type'] == 'image' ) { |
|
| 2704 | + } else if ($args['type'] == 'image') { |
|
| 2705 | 2705 | $type = 'string'; |
| 2706 | 2706 | $default = "'" . $_default . "'"; |
| 2707 | 2707 | } else { |
| 2708 | - $type = ! empty( $args['hidden_type'] ) ? esc_attr( $args['hidden_type'] ) : 'string'; |
|
| 2708 | + $type = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string'; |
|
| 2709 | 2709 | $default = "'" . $_default . "'"; |
| 2710 | 2710 | } |
| 2711 | 2711 | |
@@ -2719,7 +2719,7 @@ discard block |
||
| 2719 | 2719 | echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},"; |
| 2720 | 2720 | echo "sd_shortcode : {type : 'string',default: ''},"; |
| 2721 | 2721 | |
| 2722 | - if ( ! empty( $this->options['nested-block'] ) || ! empty( $this->arguments['html'] ) ) { |
|
| 2722 | + if (!empty($this->options['nested-block']) || !empty($this->arguments['html'])) { |
|
| 2723 | 2723 | echo "sd_shortcode_close : {type : 'string',default: ''},"; |
| 2724 | 2724 | } |
| 2725 | 2725 | |
@@ -2731,7 +2731,7 @@ discard block |
||
| 2731 | 2731 | const selectedBlock = wp.data.select('core/block-editor').getSelectedBlock(); |
| 2732 | 2732 | <?php |
| 2733 | 2733 | // only include the drag/drop functions if required. |
| 2734 | -if ( $img_drag_drop ) { |
|
| 2734 | +if ($img_drag_drop) { |
|
| 2735 | 2735 | ?> |
| 2736 | 2736 | |
| 2737 | 2737 | function enableDragSort(listClass) { |
@@ -2796,9 +2796,9 @@ discard block |
||
| 2796 | 2796 | } |
| 2797 | 2797 | |
| 2798 | 2798 | <?php |
| 2799 | - if(!empty($this->options['block-edit-raw'])) { |
|
| 2799 | + if (!empty($this->options['block-edit-raw'])) { |
|
| 2800 | 2800 | echo $this->options['block-edit-raw']; // strings have to be in single quotes, may cause issues |
| 2801 | - }else{ |
|
| 2801 | + } else { |
|
| 2802 | 2802 | ?> |
| 2803 | 2803 | |
| 2804 | 2804 | function hasSelectedInnerBlock(props) { |
@@ -2822,7 +2822,7 @@ discard block |
||
| 2822 | 2822 | var $value = ''; |
| 2823 | 2823 | <?php |
| 2824 | 2824 | // if we have a post_type and a category then link them |
| 2825 | - if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){ |
|
| 2825 | + if (isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked'])) { |
|
| 2826 | 2826 | ?> |
| 2827 | 2827 | if(typeof(prev_attributes[props.clientId]) != 'undefined' && selectedBlock && selectedBlock.clientId === props.clientId){ |
| 2828 | 2828 | $pt = props.attributes.post_type; |
@@ -2837,9 +2837,9 @@ discard block |
||
| 2837 | 2837 | } |
| 2838 | 2838 | <?php |
| 2839 | 2839 | $cat_path = ''; |
| 2840 | - if ( ! empty( $this->arguments['post_type']['onchange_rest']['path'] ) ) { |
|
| 2841 | - $cat_path = esc_js( strip_tags( $this->arguments['post_type']['onchange_rest']['path'] ) ); |
|
| 2842 | - $cat_path = str_replace( array( '"', ''' ), array( '"', "'" ), $cat_path ); |
|
| 2840 | + if (!empty($this->arguments['post_type']['onchange_rest']['path'])) { |
|
| 2841 | + $cat_path = esc_js(strip_tags($this->arguments['post_type']['onchange_rest']['path'])); |
|
| 2842 | + $cat_path = str_replace(array('"', '''), array('"', "'"), $cat_path); |
|
| 2843 | 2843 | } |
| 2844 | 2844 | ?> |
| 2845 | 2845 | /* taxonomies */ |
@@ -2847,15 +2847,15 @@ discard block |
||
| 2847 | 2847 | if (!window.gdCPTCats) { |
| 2848 | 2848 | window.gdCPTCats = []; |
| 2849 | 2849 | } |
| 2850 | - var gdCatPath = "<?php echo ( ! empty( $cat_path ) ? $cat_path : "/wp/v2/" + $value + "/categories/?per_page=100" ); ?>"; |
|
| 2850 | + var gdCatPath = "<?php echo (!empty($cat_path) ? $cat_path : "/wp/v2/" +$value + "/categories/?per_page=100"); ?>"; |
|
| 2851 | 2851 | if (window.gdCPTCats[gdCatPath]) { |
| 2852 | 2852 | terms = window.gdCPTCats[gdCatPath]; |
| 2853 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
| 2854 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
| 2853 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
| 2854 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
| 2855 | 2855 | } |
| 2856 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
| 2856 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
| 2857 | 2857 | jQuery.each( terms, function( key, val ) { |
| 2858 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
| 2858 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
| 2859 | 2859 | }); |
| 2860 | 2860 | |
| 2861 | 2861 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2865,12 +2865,12 @@ discard block |
||
| 2865 | 2865 | } else { |
| 2866 | 2866 | wp.apiFetch({path: gdCatPath}).then(terms => { |
| 2867 | 2867 | window.gdCPTCats[gdCatPath] = terms; |
| 2868 | - while (taxonomies_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
| 2869 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
| 2868 | + while (taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
| 2869 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
| 2870 | 2870 | } |
| 2871 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: "All", value: 0}); |
|
| 2871 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: "All", value: 0}); |
|
| 2872 | 2872 | jQuery.each( terms, function( key, val ) { |
| 2873 | - taxonomies_<?php echo str_replace("-","_", $this->id);?>.push({label: val.name, value: val.id}); |
|
| 2873 | + taxonomies_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val.name, value: val.id}); |
|
| 2874 | 2874 | }); |
| 2875 | 2875 | |
| 2876 | 2876 | /* Setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. */ |
@@ -2878,7 +2878,7 @@ discard block |
||
| 2878 | 2878 | props.setAttributes({category: [0] }); |
| 2879 | 2879 | props.setAttributes({category: $old_cat_value }); |
| 2880 | 2880 | |
| 2881 | - return taxonomies_<?php echo str_replace("-","_", $this->id);?>; |
|
| 2881 | + return taxonomies_<?php echo str_replace("-", "_", $this->id); ?>; |
|
| 2882 | 2882 | }); |
| 2883 | 2883 | } |
| 2884 | 2884 | } |
@@ -2890,12 +2890,12 @@ discard block |
||
| 2890 | 2890 | } |
| 2891 | 2891 | if (window.gdCPTSort[$pt]) { |
| 2892 | 2892 | response = window.gdCPTSort[$pt]; |
| 2893 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
| 2894 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
| 2893 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
| 2894 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
| 2895 | 2895 | } |
| 2896 | 2896 | |
| 2897 | 2897 | jQuery.each( response, function( key, val ) { |
| 2898 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
| 2898 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
| 2899 | 2899 | }); |
| 2900 | 2900 | |
| 2901 | 2901 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2910,12 +2910,12 @@ discard block |
||
| 2910 | 2910 | jQuery.post(ajaxurl, data, function(response) { |
| 2911 | 2911 | response = JSON.parse(response); |
| 2912 | 2912 | window.gdCPTSort[$pt] = response; |
| 2913 | - while (sort_by_<?php echo str_replace("-","_", $this->id);?>.length) { |
|
| 2914 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.pop(); |
|
| 2913 | + while (sort_by_<?php echo str_replace("-", "_", $this->id); ?>.length) { |
|
| 2914 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.pop(); |
|
| 2915 | 2915 | } |
| 2916 | 2916 | |
| 2917 | 2917 | jQuery.each( response, function( key, val ) { |
| 2918 | - sort_by_<?php echo str_replace("-","_", $this->id);?>.push({label: val, value: key}); |
|
| 2918 | + sort_by_<?php echo str_replace("-", "_", $this->id); ?>.push({label: val, value: key}); |
|
| 2919 | 2919 | }); |
| 2920 | 2920 | |
| 2921 | 2921 | // setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options. |
@@ -2923,7 +2923,7 @@ discard block |
||
| 2923 | 2923 | props.setAttributes({sort_by: [0] }); |
| 2924 | 2924 | props.setAttributes({sort_by: $old_sort_by_value }); |
| 2925 | 2925 | |
| 2926 | - return sort_by_<?php echo str_replace("-","_", $this->id);?>; |
|
| 2926 | + return sort_by_<?php echo str_replace("-", "_", $this->id); ?>; |
|
| 2927 | 2927 | }); |
| 2928 | 2928 | } |
| 2929 | 2929 | } |
@@ -2931,9 +2931,9 @@ discard block |
||
| 2931 | 2931 | <?php } ?> |
| 2932 | 2932 | <?php |
| 2933 | 2933 | $current_screen = function_exists('get_current_screen') ? get_current_screen() : ''; |
| 2934 | -if(!empty($current_screen->base) && $current_screen->base==='widgets'){ |
|
| 2934 | +if (!empty($current_screen->base) && $current_screen->base === 'widgets') { |
|
| 2935 | 2935 | echo 'const { deviceType } = "";'; |
| 2936 | -}else{ |
|
| 2936 | +} else { |
|
| 2937 | 2937 | ?> |
| 2938 | 2938 | /** Get device type const. */ |
| 2939 | 2939 | const wpVersion = '<?php global $wp_version; echo esc_attr($wp_version); ?>'; |
@@ -2982,13 +2982,13 @@ discard block |
||
| 2982 | 2982 | |
| 2983 | 2983 | var data = { |
| 2984 | 2984 | 'action': 'super_duper_output_shortcode', |
| 2985 | - 'shortcode': '<?php echo $this->options['base_id'];?>', |
|
| 2985 | + 'shortcode': '<?php echo $this->options['base_id']; ?>', |
|
| 2986 | 2986 | 'attributes': props.attributes, |
| 2987 | 2987 | 'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '', |
| 2988 | - 'post_id': <?php global $post; if ( isset( $post->ID ) ) { |
|
| 2988 | + 'post_id': <?php global $post; if (isset($post->ID)) { |
|
| 2989 | 2989 | echo $post->ID; |
| 2990 | - }else{echo '0';}?>, |
|
| 2991 | - '_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>' |
|
| 2990 | + } else {echo '0'; }?>, |
|
| 2991 | + '_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>' |
|
| 2992 | 2992 | }; |
| 2993 | 2993 | |
| 2994 | 2994 | jQuery.post(ajaxurl, data, function (response) { |
@@ -2996,17 +2996,17 @@ discard block |
||
| 2996 | 2996 | }).then(function (env) { |
| 2997 | 2997 | // if the content is empty then we place some placeholder text |
| 2998 | 2998 | if (env == '') { |
| 2999 | - env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for:', 'ayecode-connect' );?> " + props.name + "</div>"; |
|
| 2999 | + env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for:', 'ayecode-connect'); ?> " + props.name + "</div>"; |
|
| 3000 | 3000 | } |
| 3001 | 3001 | |
| 3002 | 3002 | <?php |
| 3003 | - if(!empty($this->options['nested-block'])){ |
|
| 3003 | + if (!empty($this->options['nested-block'])) { |
|
| 3004 | 3004 | ?> |
| 3005 | 3005 | // props.setAttributes({content: env}); |
| 3006 | 3006 | is_fetching = false; |
| 3007 | 3007 | prev_attributes[props.clientId] = props.attributes; |
| 3008 | 3008 | <?php |
| 3009 | - }else{ |
|
| 3009 | + } else { |
|
| 3010 | 3010 | ?> |
| 3011 | 3011 | props.setAttributes({content: env}); |
| 3012 | 3012 | is_fetching = false; |
@@ -3026,35 +3026,35 @@ discard block |
||
| 3026 | 3026 | } |
| 3027 | 3027 | |
| 3028 | 3028 | <?php |
| 3029 | - if(!empty($this->options['block-edit-js'])) { |
|
| 3030 | - echo $this->options['block-edit-js'] ; // strings have to be in single quotes, may cause issues |
|
| 3029 | + if (!empty($this->options['block-edit-js'])) { |
|
| 3030 | + echo $this->options['block-edit-js']; // strings have to be in single quotes, may cause issues |
|
| 3031 | 3031 | } |
| 3032 | 3032 | |
| 3033 | - if(empty($this->options['block-save-return'])){ |
|
| 3033 | + if (empty($this->options['block-save-return'])) { |
|
| 3034 | 3034 | ?> |
| 3035 | 3035 | /////////////////////////////////////////////////////////////////////// |
| 3036 | 3036 | |
| 3037 | 3037 | // build the shortcode. |
| 3038 | - shortcode = "[<?php echo $this->options['base_id'];?>"; |
|
| 3038 | + shortcode = "[<?php echo $this->options['base_id']; ?>"; |
|
| 3039 | 3039 | <?php |
| 3040 | 3040 | |
| 3041 | - if(! empty( $this->arguments )){ |
|
| 3041 | + if (!empty($this->arguments)) { |
|
| 3042 | 3042 | |
| 3043 | - foreach($this->arguments as $key => $args){ |
|
| 3043 | + foreach ($this->arguments as $key => $args) { |
|
| 3044 | 3044 | // if($args['type']=='tabs'){continue;} |
| 3045 | 3045 | |
| 3046 | 3046 | // don't add metadata arguments |
| 3047 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
| 3047 | + if (substr($key, 0, 9) === 'metadata_') { |
|
| 3048 | 3048 | continue; |
| 3049 | 3049 | } |
| 3050 | 3050 | ?> |
| 3051 | - if (props.attributes.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
| 3052 | - if ('<?php echo esc_attr( $key );?>' == 'html') { |
|
| 3053 | - } else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') { |
|
| 3054 | - shortcode += props.attributes.<?php echo esc_attr( $key );?>.length && ( props.attributes.<?php echo esc_attr( $key );?>.x.length || props.attributes.<?php echo esc_attr( $key );?>.y.length ) ? " <?php echo esc_attr( $key );?>='{x:" + props.attributes.<?php echo esc_attr( $key );?>.x + ",y:"+props.attributes.<?php echo esc_attr( $key );?>.y +"}' " : ""; |
|
| 3051 | + if (props.attributes.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
| 3052 | + if ('<?php echo esc_attr($key); ?>' == 'html') { |
|
| 3053 | + } else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') { |
|
| 3054 | + shortcode += props.attributes.<?php echo esc_attr($key); ?>.length && ( props.attributes.<?php echo esc_attr($key); ?>.x.length || props.attributes.<?php echo esc_attr($key); ?>.y.length ) ? " <?php echo esc_attr($key); ?>='{x:" + props.attributes.<?php echo esc_attr($key); ?>.x + ",y:"+props.attributes.<?php echo esc_attr($key); ?>.y +"}' " : ""; |
|
| 3055 | 3055 | } else { |
| 3056 | - //shortcode += props.attributes.<?php echo esc_attr( $key );?>.length ? " <?php echo esc_attr( $key );?>='" + props.attributes.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' " : ""; |
|
| 3057 | - shortcode += " <?php echo esc_attr( $key );?>='" + props.attributes.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' "; |
|
| 3056 | + //shortcode += props.attributes.<?php echo esc_attr($key); ?>.length ? " <?php echo esc_attr($key); ?>='" + props.attributes.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' " : ""; |
|
| 3057 | + shortcode += " <?php echo esc_attr($key); ?>='" + props.attributes.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' "; |
|
| 3058 | 3058 | } |
| 3059 | 3059 | } |
| 3060 | 3060 | <?php |
@@ -3073,8 +3073,8 @@ discard block |
||
| 3073 | 3073 | |
| 3074 | 3074 | |
| 3075 | 3075 | <?php |
| 3076 | - if(!empty($this->options['nested-block']) || !empty($this->arguments['html']) ){ |
|
| 3077 | - echo "props.setAttributes({sd_shortcode_close: '[/".esc_attr( $this->options['base_id'] )."]'});"; |
|
| 3076 | + if (!empty($this->options['nested-block']) || !empty($this->arguments['html'])) { |
|
| 3077 | + echo "props.setAttributes({sd_shortcode_close: '[/" . esc_attr($this->options['base_id']) . "]'});"; |
|
| 3078 | 3078 | } |
| 3079 | 3079 | ?> |
| 3080 | 3080 | } |
@@ -3089,7 +3089,7 @@ discard block |
||
| 3089 | 3089 | |
| 3090 | 3090 | el(wp.blockEditor.BlockControls, {key: 'controls'}, |
| 3091 | 3091 | |
| 3092 | - <?php if($show_alignment){?> |
|
| 3092 | + <?php if ($show_alignment) {?> |
|
| 3093 | 3093 | el( |
| 3094 | 3094 | wp.blockEditor.AlignmentToolbar, |
| 3095 | 3095 | { |
@@ -3107,9 +3107,9 @@ discard block |
||
| 3107 | 3107 | |
| 3108 | 3108 | <?php |
| 3109 | 3109 | |
| 3110 | - if(! empty( $this->arguments )){ |
|
| 3110 | + if (!empty($this->arguments)) { |
|
| 3111 | 3111 | |
| 3112 | - if ( $show_advanced ) { |
|
| 3112 | + if ($show_advanced) { |
|
| 3113 | 3113 | ?> |
| 3114 | 3114 | el('div', { |
| 3115 | 3115 | style: {'padding-left': '16px','padding-right': '16px'} |
@@ -3129,42 +3129,42 @@ discard block |
||
| 3129 | 3129 | <?php |
| 3130 | 3130 | } |
| 3131 | 3131 | |
| 3132 | - $arguments = $this->group_arguments( $this->arguments ); |
|
| 3133 | - $block_group_tabs = ! empty( $this->options['block_group_tabs'] ) ? $this->group_block_tabs( $this->options['block_group_tabs'], $arguments ) : array(); |
|
| 3132 | + $arguments = $this->group_arguments($this->arguments); |
|
| 3133 | + $block_group_tabs = !empty($this->options['block_group_tabs']) ? $this->group_block_tabs($this->options['block_group_tabs'], $arguments) : array(); |
|
| 3134 | 3134 | |
| 3135 | 3135 | // Do we have sections? |
| 3136 | 3136 | $has_sections = $arguments == $this->arguments ? false : true; |
| 3137 | 3137 | |
| 3138 | - if($has_sections){ |
|
| 3138 | + if ($has_sections) { |
|
| 3139 | 3139 | $panel_count = 0; |
| 3140 | 3140 | $open_tab = ''; |
| 3141 | 3141 | |
| 3142 | 3142 | $open_tab_groups = array(); |
| 3143 | 3143 | $used_tabs = array(); |
| 3144 | 3144 | |
| 3145 | - foreach ( $arguments as $key => $args ) { |
|
| 3145 | + foreach ($arguments as $key => $args) { |
|
| 3146 | 3146 | $close_tab = false; |
| 3147 | 3147 | $close_tabs = false; |
| 3148 | 3148 | |
| 3149 | - if ( ! empty( $block_group_tabs ) ) { |
|
| 3150 | - foreach ( $block_group_tabs as $tab_name => $tab_args ) { |
|
| 3151 | - if ( in_array( $key, $tab_args['groups'] ) ) { |
|
| 3149 | + if (!empty($block_group_tabs)) { |
|
| 3150 | + foreach ($block_group_tabs as $tab_name => $tab_args) { |
|
| 3151 | + if (in_array($key, $tab_args['groups'])) { |
|
| 3152 | 3152 | $open_tab_groups[] = $key; |
| 3153 | 3153 | |
| 3154 | - if ( $open_tab != $tab_name ) { |
|
| 3154 | + if ($open_tab != $tab_name) { |
|
| 3155 | 3155 | $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false; |
| 3156 | 3156 | $tab_args['tab']['open'] = true; |
| 3157 | 3157 | |
| 3158 | - $this->block_tab_start( '', $tab_args ); |
|
| 3158 | + $this->block_tab_start('', $tab_args); |
|
| 3159 | 3159 | $open_tab = $tab_name; |
| 3160 | 3160 | $used_tabs[] = $tab_name; |
| 3161 | 3161 | } |
| 3162 | 3162 | |
| 3163 | - if ( $open_tab_groups == $tab_args['groups'] ) { |
|
| 3163 | + if ($open_tab_groups == $tab_args['groups']) { |
|
| 3164 | 3164 | $close_tab = true; |
| 3165 | 3165 | $open_tab_groups = array(); |
| 3166 | 3166 | |
| 3167 | - if ( $used_tabs == array_keys( $block_group_tabs ) ) { |
|
| 3167 | + if ($used_tabs == array_keys($block_group_tabs)) { |
|
| 3168 | 3168 | $close_tabs = true; |
| 3169 | 3169 | } |
| 3170 | 3170 | } |
@@ -3173,27 +3173,27 @@ discard block |
||
| 3173 | 3173 | } |
| 3174 | 3174 | ?> |
| 3175 | 3175 | el(wp.components.PanelBody, { |
| 3176 | - title: '<?php esc_attr_e( $key ); ?>', |
|
| 3177 | - initialOpen: <?php if ( $panel_count ) { |
|
| 3176 | + title: '<?php esc_attr_e($key); ?>', |
|
| 3177 | + initialOpen: <?php if ($panel_count) { |
|
| 3178 | 3178 | echo "false"; |
| 3179 | 3179 | } else { |
| 3180 | 3180 | echo "true"; |
| 3181 | 3181 | }?> |
| 3182 | 3182 | }, |
| 3183 | 3183 | <?php |
| 3184 | - foreach ( $args as $k => $a ) { |
|
| 3185 | - $this->block_tab_start( $k, $a ); |
|
| 3186 | - $this->block_row_start( $k, $a ); |
|
| 3187 | - $this->build_block_arguments( $k, $a ); |
|
| 3188 | - $this->block_row_end( $k, $a ); |
|
| 3189 | - $this->block_tab_end( $k, $a ); |
|
| 3184 | + foreach ($args as $k => $a) { |
|
| 3185 | + $this->block_tab_start($k, $a); |
|
| 3186 | + $this->block_row_start($k, $a); |
|
| 3187 | + $this->build_block_arguments($k, $a); |
|
| 3188 | + $this->block_row_end($k, $a); |
|
| 3189 | + $this->block_tab_end($k, $a); |
|
| 3190 | 3190 | } |
| 3191 | 3191 | ?> |
| 3192 | 3192 | ), |
| 3193 | 3193 | <?php |
| 3194 | - $panel_count ++; |
|
| 3194 | + $panel_count++; |
|
| 3195 | 3195 | |
| 3196 | - if($close_tab || $close_tabs){ |
|
| 3196 | + if ($close_tab || $close_tabs) { |
|
| 3197 | 3197 | $tab_args = array( |
| 3198 | 3198 | 'tab' => array( |
| 3199 | 3199 | 'tabs_close' => $close_tabs, |
@@ -3201,24 +3201,24 @@ discard block |
||
| 3201 | 3201 | ) |
| 3202 | 3202 | |
| 3203 | 3203 | ); |
| 3204 | - $this->block_tab_end( '', $tab_args ); |
|
| 3204 | + $this->block_tab_end('', $tab_args); |
|
| 3205 | 3205 | // echo '###close'; print_r($tab_args); |
| 3206 | 3206 | $panel_count = 0; |
| 3207 | 3207 | } |
| 3208 | 3208 | // |
| 3209 | 3209 | |
| 3210 | 3210 | } |
| 3211 | - }else { |
|
| 3211 | + } else { |
|
| 3212 | 3212 | ?> |
| 3213 | 3213 | el(wp.components.PanelBody, { |
| 3214 | - title: '<?php esc_attr_e( "Settings", 'ayecode-connect' ); ?>', |
|
| 3214 | + title: '<?php esc_attr_e("Settings", 'ayecode-connect'); ?>', |
|
| 3215 | 3215 | initialOpen: true |
| 3216 | 3216 | }, |
| 3217 | 3217 | <?php |
| 3218 | - foreach ( $this->arguments as $key => $args ) { |
|
| 3219 | - $this->block_row_start( $key, $args ); |
|
| 3220 | - $this->build_block_arguments( $key, $args ); |
|
| 3221 | - $this->block_row_end( $key, $args ); |
|
| 3218 | + foreach ($this->arguments as $key => $args) { |
|
| 3219 | + $this->block_row_start($key, $args); |
|
| 3220 | + $this->build_block_arguments($key, $args); |
|
| 3221 | + $this->block_row_end($key, $args); |
|
| 3222 | 3222 | } |
| 3223 | 3223 | ?> |
| 3224 | 3224 | ), |
@@ -3232,11 +3232,11 @@ discard block |
||
| 3232 | 3232 | |
| 3233 | 3233 | <?php |
| 3234 | 3234 | // If the user sets block-output array then build it |
| 3235 | - if ( ! empty( $this->options['block-output'] ) ) { |
|
| 3236 | - $this->block_element( $this->options['block-output'] ); |
|
| 3237 | - }elseif(!empty($this->options['block-edit-return'])){ |
|
| 3235 | + if (!empty($this->options['block-output'])) { |
|
| 3236 | + $this->block_element($this->options['block-output']); |
|
| 3237 | + }elseif (!empty($this->options['block-edit-return'])) { |
|
| 3238 | 3238 | echo $this->options['block-edit-return']; |
| 3239 | - }else{ |
|
| 3239 | + } else { |
|
| 3240 | 3240 | // if no block-output is set then we try and get the shortcode html output via ajax. |
| 3241 | 3241 | $block_edit_wrap_tag = !empty($this->options['block_edit_wrap_tag']) ? esc_attr($this->options['block_edit_wrap_tag']) : 'div'; |
| 3242 | 3242 | ?> |
@@ -3263,27 +3263,27 @@ discard block |
||
| 3263 | 3263 | var align = ''; |
| 3264 | 3264 | |
| 3265 | 3265 | // build the shortcode. |
| 3266 | - var content = "[<?php echo $this->options['base_id'];?>"; |
|
| 3266 | + var content = "[<?php echo $this->options['base_id']; ?>"; |
|
| 3267 | 3267 | $html = ''; |
| 3268 | 3268 | <?php |
| 3269 | 3269 | |
| 3270 | - if(! empty( $this->arguments )){ |
|
| 3270 | + if (!empty($this->arguments)) { |
|
| 3271 | 3271 | |
| 3272 | - foreach($this->arguments as $key => $args){ |
|
| 3272 | + foreach ($this->arguments as $key => $args) { |
|
| 3273 | 3273 | // if($args['type']=='tabs'){continue;} |
| 3274 | 3274 | |
| 3275 | 3275 | // don't add metadata arguments |
| 3276 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
| 3276 | + if (substr($key, 0, 9) === 'metadata_') { |
|
| 3277 | 3277 | continue; |
| 3278 | 3278 | } |
| 3279 | 3279 | ?> |
| 3280 | - if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) { |
|
| 3281 | - if ('<?php echo esc_attr( $key );?>' == 'html') { |
|
| 3282 | - $html = attr.<?php echo esc_attr( $key );?>; |
|
| 3283 | - } else if ('<?php echo esc_attr( $args['type'] );?>' == 'image_xy') { |
|
| 3284 | - content += " <?php echo esc_attr( $key );?>='{x:" + attr.<?php echo esc_attr( $key );?>.x + ",y:"+attr.<?php echo esc_attr( $key );?>.y +"}' "; |
|
| 3280 | + if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) { |
|
| 3281 | + if ('<?php echo esc_attr($key); ?>' == 'html') { |
|
| 3282 | + $html = attr.<?php echo esc_attr($key); ?>; |
|
| 3283 | + } else if ('<?php echo esc_attr($args['type']); ?>' == 'image_xy') { |
|
| 3284 | + content += " <?php echo esc_attr($key); ?>='{x:" + attr.<?php echo esc_attr($key); ?>.x + ",y:"+attr.<?php echo esc_attr($key); ?>.y +"}' "; |
|
| 3285 | 3285 | } else { |
| 3286 | - content += " <?php echo esc_attr( $key );?>='" + attr.<?php echo esc_attr( $key );?>.toString().replace('\'',''') + "' "; |
|
| 3286 | + content += " <?php echo esc_attr($key); ?>='" + attr.<?php echo esc_attr($key); ?>.toString().replace('\'',''') + "' "; |
|
| 3287 | 3287 | } |
| 3288 | 3288 | } |
| 3289 | 3289 | <?php |
@@ -3303,7 +3303,7 @@ discard block |
||
| 3303 | 3303 | ?> |
| 3304 | 3304 | // if has html element |
| 3305 | 3305 | if ($html) { |
| 3306 | - //content += $html + "[/<?php echo $this->options['base_id'];?>]"; |
|
| 3306 | + //content += $html + "[/<?php echo $this->options['base_id']; ?>]"; |
|
| 3307 | 3307 | } |
| 3308 | 3308 | |
| 3309 | 3309 | // @todo should we add inline style here or just css classes? |
@@ -3333,7 +3333,7 @@ discard block |
||
| 3333 | 3333 | // <x?php |
| 3334 | 3334 | // }else |
| 3335 | 3335 | |
| 3336 | - if(!empty($this->options['block-output'])){ |
|
| 3336 | + if (!empty($this->options['block-output'])) { |
|
| 3337 | 3337 | // echo "return"; |
| 3338 | 3338 | // $this->block_element( $this->options['block-output'], true ); |
| 3339 | 3339 | // echo ";"; |
@@ -3343,30 +3343,30 @@ discard block |
||
| 3343 | 3343 | '', |
| 3344 | 3344 | {}, |
| 3345 | 3345 | // el('', {dangerouslySetInnerHTML: {__html: content}}), |
| 3346 | - <?php $this->block_element( $this->options['block-output'], true ); ?> |
|
| 3347 | - // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
| 3346 | + <?php $this->block_element($this->options['block-output'], true); ?> |
|
| 3347 | + // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
| 3348 | 3348 | ); |
| 3349 | 3349 | <?php |
| 3350 | 3350 | |
| 3351 | - }elseif(!empty($this->options['block-save-return'])){ |
|
| 3351 | + }elseif (!empty($this->options['block-save-return'])) { |
|
| 3352 | 3352 | echo 'return ' . $this->options['block-save-return']; |
| 3353 | - }elseif(!empty($this->options['nested-block'])){ |
|
| 3353 | + }elseif (!empty($this->options['nested-block'])) { |
|
| 3354 | 3354 | ?> |
| 3355 | 3355 | return el( |
| 3356 | 3356 | '', |
| 3357 | 3357 | {}, |
| 3358 | 3358 | el('', {dangerouslySetInnerHTML: {__html: content+"\n"}}), |
| 3359 | 3359 | InnerBlocks.Content ? el( InnerBlocks.Content ) : '', // @todo i think we need a comma here |
| 3360 | - // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}}) |
|
| 3360 | + // el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id']; ?>]"}}) |
|
| 3361 | 3361 | ); |
| 3362 | 3362 | <?php |
| 3363 | - }elseif(!empty( $this->options['block-save-return'] ) ){ |
|
| 3364 | - echo "return ". $this->options['block-edit-return'].";"; |
|
| 3365 | - }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){ |
|
| 3363 | + }elseif (!empty($this->options['block-save-return'])) { |
|
| 3364 | + echo "return " . $this->options['block-edit-return'] . ";"; |
|
| 3365 | + }elseif (isset($this->options['block-wrap']) && $this->options['block-wrap'] == '') { |
|
| 3366 | 3366 | ?> |
| 3367 | 3367 | return content; |
| 3368 | 3368 | <?php |
| 3369 | - }else{ |
|
| 3369 | + } else { |
|
| 3370 | 3370 | ?> |
| 3371 | 3371 | var block_wrap = 'div'; |
| 3372 | 3372 | if (attr.hasOwnProperty("block_wrap")) { |
@@ -3395,48 +3395,48 @@ discard block |
||
| 3395 | 3395 | * We only add the <script> tags for code highlighting, so we strip them from the output. |
| 3396 | 3396 | */ |
| 3397 | 3397 | |
| 3398 | - return str_replace( array( |
|
| 3398 | + return str_replace(array( |
|
| 3399 | 3399 | '<script>', |
| 3400 | 3400 | '</script>' |
| 3401 | - ), '', $output ); |
|
| 3401 | + ), '', $output); |
|
| 3402 | 3402 | } |
| 3403 | 3403 | |
| 3404 | 3404 | |
| 3405 | 3405 | |
| 3406 | - public function block_row_start($key, $args){ |
|
| 3406 | + public function block_row_start($key, $args) { |
|
| 3407 | 3407 | |
| 3408 | 3408 | // check for row |
| 3409 | - if(!empty($args['row'])){ |
|
| 3409 | + if (!empty($args['row'])) { |
|
| 3410 | 3410 | |
| 3411 | - if(!empty($args['row']['open'])){ |
|
| 3411 | + if (!empty($args['row']['open'])) { |
|
| 3412 | 3412 | |
| 3413 | 3413 | // element require |
| 3414 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
| 3415 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
| 3416 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
| 3414 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
| 3415 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
| 3416 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
| 3417 | 3417 | $device_type_icon = ''; |
| 3418 | - if($device_type=='Desktop'){ |
|
| 3418 | + if ($device_type == 'Desktop') { |
|
| 3419 | 3419 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
| 3420 | - }elseif($device_type=='Tablet'){ |
|
| 3420 | + }elseif ($device_type == 'Tablet') { |
|
| 3421 | 3421 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
| 3422 | - }elseif($device_type=='Mobile'){ |
|
| 3422 | + }elseif ($device_type == 'Mobile') { |
|
| 3423 | 3423 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
| 3424 | 3424 | } |
| 3425 | 3425 | echo $element_require; |
| 3426 | 3426 | echo $device_type_require; |
| 3427 | 3427 | |
| 3428 | - if(false){?><script><?php }?> |
|
| 3428 | + if (false) {?><script><?php }?> |
|
| 3429 | 3429 | el('div', { |
| 3430 | 3430 | className: 'bsui components-base-control', |
| 3431 | 3431 | }, |
| 3432 | - <?php if(!empty($args['row']['title'])){ ?> |
|
| 3432 | + <?php if (!empty($args['row']['title'])) { ?> |
|
| 3433 | 3433 | el('label', { |
| 3434 | 3434 | className: 'components-base-control__label position-relative', |
| 3435 | 3435 | style: {width:"100%"} |
| 3436 | 3436 | }, |
| 3437 | - el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['row']['title'] ) ?>'}}), |
|
| 3438 | - <?php if($device_type_icon){ ?> |
|
| 3439 | - deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}}) |
|
| 3437 | + el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['row']['title']) ?>'}}), |
|
| 3438 | + <?php if ($device_type_icon) { ?> |
|
| 3439 | + deviceType == '<?php echo $device_type; ?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}}) |
|
| 3440 | 3440 | <?php |
| 3441 | 3441 | } |
| 3442 | 3442 | ?> |
@@ -3444,17 +3444,17 @@ discard block |
||
| 3444 | 3444 | |
| 3445 | 3445 | ), |
| 3446 | 3446 | <?php }?> |
| 3447 | - <?php if(!empty($args['row']['desc'])){ ?> |
|
| 3447 | + <?php if (!empty($args['row']['desc'])) { ?> |
|
| 3448 | 3448 | el('p', { |
| 3449 | 3449 | className: 'components-base-control__help mb-0', |
| 3450 | 3450 | }, |
| 3451 | - '<?php echo addslashes( $args['row']['desc'] ); ?>' |
|
| 3451 | + '<?php echo addslashes($args['row']['desc']); ?>' |
|
| 3452 | 3452 | ), |
| 3453 | 3453 | <?php }?> |
| 3454 | 3454 | el( |
| 3455 | 3455 | 'div', |
| 3456 | 3456 | { |
| 3457 | - className: 'row mb-n2 <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>', |
|
| 3457 | + className: 'row mb-n2 <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>', |
|
| 3458 | 3458 | }, |
| 3459 | 3459 | el( |
| 3460 | 3460 | 'div', |
@@ -3463,36 +3463,36 @@ discard block |
||
| 3463 | 3463 | }, |
| 3464 | 3464 | |
| 3465 | 3465 | <?php |
| 3466 | - if(false){?></script><?php } |
|
| 3467 | - }elseif(!empty($args['row']['close'])){ |
|
| 3468 | - if(false){?><script><?php }?> |
|
| 3466 | + if (false) {?></script><?php } |
|
| 3467 | + }elseif (!empty($args['row']['close'])) { |
|
| 3468 | + if (false) {?><script><?php }?> |
|
| 3469 | 3469 | el( |
| 3470 | 3470 | 'div', |
| 3471 | 3471 | { |
| 3472 | 3472 | className: 'col pl-0 ps-0', |
| 3473 | 3473 | }, |
| 3474 | 3474 | <?php |
| 3475 | - if(false){?></script><?php } |
|
| 3476 | - }else{ |
|
| 3477 | - if(false){?><script><?php }?> |
|
| 3475 | + if (false) {?></script><?php } |
|
| 3476 | + } else { |
|
| 3477 | + if (false) {?><script><?php }?> |
|
| 3478 | 3478 | el( |
| 3479 | 3479 | 'div', |
| 3480 | 3480 | { |
| 3481 | 3481 | className: 'col pl-0 ps-0 pr-2 pe-2', |
| 3482 | 3482 | }, |
| 3483 | 3483 | <?php |
| 3484 | - if(false){?></script><?php } |
|
| 3484 | + if (false) {?></script><?php } |
|
| 3485 | 3485 | } |
| 3486 | 3486 | |
| 3487 | 3487 | } |
| 3488 | 3488 | |
| 3489 | 3489 | } |
| 3490 | 3490 | |
| 3491 | - public function block_row_end($key, $args){ |
|
| 3491 | + public function block_row_end($key, $args) { |
|
| 3492 | 3492 | |
| 3493 | - if(!empty($args['row'])){ |
|
| 3493 | + if (!empty($args['row'])) { |
|
| 3494 | 3494 | // maybe close |
| 3495 | - if(!empty($args['row']['close'])){ |
|
| 3495 | + if (!empty($args['row']['close'])) { |
|
| 3496 | 3496 | echo "))"; |
| 3497 | 3497 | } |
| 3498 | 3498 | |
@@ -3500,14 +3500,14 @@ discard block |
||
| 3500 | 3500 | } |
| 3501 | 3501 | } |
| 3502 | 3502 | |
| 3503 | - public function block_tab_start($key, $args){ |
|
| 3503 | + public function block_tab_start($key, $args) { |
|
| 3504 | 3504 | |
| 3505 | 3505 | // check for row |
| 3506 | - if(!empty($args['tab'])){ |
|
| 3506 | + if (!empty($args['tab'])) { |
|
| 3507 | 3507 | |
| 3508 | - if(!empty($args['tab']['tabs_open'])){ |
|
| 3508 | + if (!empty($args['tab']['tabs_open'])) { |
|
| 3509 | 3509 | |
| 3510 | - if(false){?><script><?php }?> |
|
| 3510 | + if (false) {?><script><?php }?> |
|
| 3511 | 3511 | |
| 3512 | 3512 | el('div',{className: 'bsui'}, |
| 3513 | 3513 | |
@@ -3516,52 +3516,52 @@ discard block |
||
| 3516 | 3516 | { |
| 3517 | 3517 | activeClass: 'is-active', |
| 3518 | 3518 | className: 'btn-groupx', |
| 3519 | - initialTabName: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
| 3519 | + initialTabName: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
| 3520 | 3520 | tabs: [ |
| 3521 | 3521 | |
| 3522 | 3522 | <?php |
| 3523 | - if(false){?></script><?php } |
|
| 3523 | + if (false) {?></script><?php } |
|
| 3524 | 3524 | } |
| 3525 | 3525 | |
| 3526 | - if(!empty($args['tab']['open'])){ |
|
| 3526 | + if (!empty($args['tab']['open'])) { |
|
| 3527 | 3527 | |
| 3528 | - if(false){?><script><?php }?> |
|
| 3528 | + if (false) {?><script><?php }?> |
|
| 3529 | 3529 | { |
| 3530 | - name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>', |
|
| 3531 | - title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}), |
|
| 3532 | - className: '<?php echo addslashes( esc_attr( $args['tab']['class']) ); ?>', |
|
| 3533 | - content: el('div',{}, <?php if(!empty($args['tab']['desc'])){ ?>el('p', { |
|
| 3530 | + name: '<?php echo addslashes(esc_attr($args['tab']['key'])); ?>', |
|
| 3531 | + title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes(esc_attr($args['tab']['title'])); ?>'}}), |
|
| 3532 | + className: '<?php echo addslashes(esc_attr($args['tab']['class'])); ?>', |
|
| 3533 | + content: el('div',{}, <?php if (!empty($args['tab']['desc'])) { ?>el('p', { |
|
| 3534 | 3534 | className: 'components-base-control__help mb-0', |
| 3535 | - dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'} |
|
| 3535 | + dangerouslySetInnerHTML: {__html:'<?php echo addslashes($args['tab']['desc']); ?>'} |
|
| 3536 | 3536 | }),<?php } |
| 3537 | - if(false){?></script><?php } |
|
| 3537 | + if (false) {?></script><?php } |
|
| 3538 | 3538 | } |
| 3539 | 3539 | |
| 3540 | 3540 | } |
| 3541 | 3541 | |
| 3542 | 3542 | } |
| 3543 | 3543 | |
| 3544 | - public function block_tab_end($key, $args){ |
|
| 3544 | + public function block_tab_end($key, $args) { |
|
| 3545 | 3545 | |
| 3546 | - if(!empty($args['tab'])){ |
|
| 3546 | + if (!empty($args['tab'])) { |
|
| 3547 | 3547 | // maybe close |
| 3548 | - if(!empty($args['tab']['close'])){ |
|
| 3548 | + if (!empty($args['tab']['close'])) { |
|
| 3549 | 3549 | echo ")}, /* tab close */"; |
| 3550 | 3550 | } |
| 3551 | 3551 | |
| 3552 | - if(!empty($args['tab']['tabs_close'])){ |
|
| 3553 | - if(false){?><script><?php }?> |
|
| 3552 | + if (!empty($args['tab']['tabs_close'])) { |
|
| 3553 | + if (false) {?><script><?php }?> |
|
| 3554 | 3554 | ]}, ( tab ) => { |
| 3555 | 3555 | return tab.content; |
| 3556 | 3556 | } |
| 3557 | 3557 | )), /* tabs close */ |
| 3558 | - <?php if(false){ ?></script><?php } |
|
| 3558 | + <?php if (false) { ?></script><?php } |
|
| 3559 | 3559 | } |
| 3560 | 3560 | } |
| 3561 | 3561 | } |
| 3562 | 3562 | |
| 3563 | - public function build_block_arguments( $key, $args ) { |
|
| 3564 | - $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : ''; |
|
| 3563 | + public function build_block_arguments($key, $args) { |
|
| 3564 | + $custom_attributes = !empty($args['custom_attributes']) ? $this->array_to_attributes($args['custom_attributes']) : ''; |
|
| 3565 | 3565 | $options = ''; |
| 3566 | 3566 | $extra = ''; |
| 3567 | 3567 | $require = ''; |
@@ -3569,28 +3569,28 @@ discard block |
||
| 3569 | 3569 | $after_elements = ''; |
| 3570 | 3570 | |
| 3571 | 3571 | // `content` is a protected and special argument |
| 3572 | - if ( $key == 'content' ) { |
|
| 3572 | + if ($key == 'content') { |
|
| 3573 | 3573 | return; |
| 3574 | 3574 | } |
| 3575 | 3575 | |
| 3576 | - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; |
|
| 3577 | - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
| 3576 | + $device_type = !empty($args['device_type']) ? esc_attr($args['device_type']) : ''; |
|
| 3577 | + $device_type_require = !empty($args['device_type']) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; |
|
| 3578 | 3578 | $device_type_icon = ''; |
| 3579 | - if($device_type=='Desktop'){ |
|
| 3579 | + if ($device_type == 'Desktop') { |
|
| 3580 | 3580 | $device_type_icon = '<span class="dashicons dashicons-desktop" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
| 3581 | - }elseif($device_type=='Tablet'){ |
|
| 3581 | + }elseif ($device_type == 'Tablet') { |
|
| 3582 | 3582 | $device_type_icon = '<span class="dashicons dashicons-tablet" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
| 3583 | - }elseif($device_type=='Mobile'){ |
|
| 3583 | + }elseif ($device_type == 'Mobile') { |
|
| 3584 | 3584 | $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>'; |
| 3585 | 3585 | } |
| 3586 | 3586 | |
| 3587 | 3587 | // icon |
| 3588 | 3588 | $icon = ''; |
| 3589 | - if( !empty( $args['icon'] ) ){ |
|
| 3589 | + if (!empty($args['icon'])) { |
|
| 3590 | 3590 | $icon .= "el('div', {"; |
| 3591 | - $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},"; |
|
| 3591 | + $icon .= "dangerouslySetInnerHTML: {__html: '" . self::get_widget_icon(esc_attr($args['icon'])) . "'},"; |
|
| 3592 | 3592 | $icon .= "className: 'text-center',"; |
| 3593 | - $icon .= "title: '".addslashes( $args['title'] )."',"; |
|
| 3593 | + $icon .= "title: '" . addslashes($args['title']) . "',"; |
|
| 3594 | 3594 | $icon .= "}),"; |
| 3595 | 3595 | |
| 3596 | 3596 | // blank title as its added to the icon. |
@@ -3598,27 +3598,27 @@ discard block |
||
| 3598 | 3598 | } |
| 3599 | 3599 | |
| 3600 | 3600 | // require advanced |
| 3601 | - $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : ""; |
|
| 3601 | + $require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : ""; |
|
| 3602 | 3602 | |
| 3603 | 3603 | // element require |
| 3604 | - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; |
|
| 3604 | + $element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : ""; |
|
| 3605 | 3605 | |
| 3606 | 3606 | |
| 3607 | 3607 | $onchange = "props.setAttributes({ $key: $key } )"; |
| 3608 | - $onchangecomplete = ""; |
|
| 3608 | + $onchangecomplete = ""; |
|
| 3609 | 3609 | $value = "props.attributes.$key"; |
| 3610 | - $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' ); |
|
| 3611 | - if ( in_array( $args['type'], $text_type ) ) { |
|
| 3610 | + $text_type = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx', 'range'); |
|
| 3611 | + if (in_array($args['type'], $text_type)) { |
|
| 3612 | 3612 | $type = 'TextControl'; |
| 3613 | 3613 | // Save numbers as numbers and not strings |
| 3614 | - if ( $args['type'] == 'number' ) { |
|
| 3614 | + if ($args['type'] == 'number') { |
|
| 3615 | 3615 | $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )"; |
| 3616 | 3616 | } |
| 3617 | 3617 | |
| 3618 | - if (substr($key, 0, 9 ) === 'metadata_') { |
|
| 3619 | - $real_key = str_replace('metadata_','', $key ); |
|
| 3618 | + if (substr($key, 0, 9) === 'metadata_') { |
|
| 3619 | + $real_key = str_replace('metadata_', '', $key); |
|
| 3620 | 3620 | $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )"; |
| 3621 | - $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; |
|
| 3621 | + $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; |
|
| 3622 | 3622 | } |
| 3623 | 3623 | } |
| 3624 | 3624 | // else if ( $args['type'] == 'popup' ) { |
@@ -3638,12 +3638,12 @@ discard block |
||
| 3638 | 3638 | // |
| 3639 | 3639 | // $value = "props.attributes.$key ? props.attributes.$key : ''"; |
| 3640 | 3640 | // } |
| 3641 | - else if ( $args['type'] == 'styleid' ) { |
|
| 3641 | + else if ($args['type'] == 'styleid') { |
|
| 3642 | 3642 | $type = 'TextControl'; |
| 3643 | 3643 | $args['type'] == 'text'; |
| 3644 | 3644 | // Save numbers as numbers and not strings |
| 3645 | - $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
| 3646 | - }else if ( $args['type'] == 'notice' ) { |
|
| 3645 | + $value = "props.attributes.$key ? props.attributes.$key : ''"; |
|
| 3646 | + } else if ($args['type'] == 'notice') { |
|
| 3647 | 3647 | |
| 3648 | 3648 | $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : ''; |
| 3649 | 3649 | $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info'; |
@@ -3705,11 +3705,11 @@ discard block |
||
| 3705 | 3705 | return; |
| 3706 | 3706 | } |
| 3707 | 3707 | */ |
| 3708 | - elseif ( $args['type'] == 'color' ) { |
|
| 3708 | + elseif ($args['type'] == 'color') { |
|
| 3709 | 3709 | $type = 'ColorPicker'; |
| 3710 | 3710 | $onchange = ""; |
| 3711 | 3711 | $extra = "color: $value,"; |
| 3712 | - if(!empty($args['disable_alpha'])){ |
|
| 3712 | + if (!empty($args['disable_alpha'])) { |
|
| 3713 | 3713 | $extra .= "disableAlpha: true,"; |
| 3714 | 3714 | } |
| 3715 | 3715 | $onchangecomplete = "onChangeComplete: function($key) { |
@@ -3718,7 +3718,7 @@ discard block |
||
| 3718 | 3718 | $key: value |
| 3719 | 3719 | }); |
| 3720 | 3720 | },"; |
| 3721 | - }elseif ( $args['type'] == 'gradient' ) { |
|
| 3721 | + }elseif ($args['type'] == 'gradient') { |
|
| 3722 | 3722 | $type = 'GradientPicker'; |
| 3723 | 3723 | $extra .= "gradients: [{ |
| 3724 | 3724 | name: 'Vivid cyan blue to vivid purple', |
@@ -3757,7 +3757,7 @@ discard block |
||
| 3757 | 3757 | slug: 'cool-to-warm-spectrum', |
| 3758 | 3758 | }],"; |
| 3759 | 3759 | |
| 3760 | - }elseif ( $args['type'] == 'image' ) { |
|
| 3760 | + }elseif ($args['type'] == 'image') { |
|
| 3761 | 3761 | // print_r($args); |
| 3762 | 3762 | |
| 3763 | 3763 | $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key || props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{ |
@@ -3819,7 +3819,7 @@ discard block |
||
| 3819 | 3819 | $onchange = ""; |
| 3820 | 3820 | |
| 3821 | 3821 | //$inside_elements = ",el('div',{},'file upload')"; |
| 3822 | - } else if ( $args['type'] == 'images' ) { |
|
| 3822 | + } else if ($args['type'] == 'images') { |
|
| 3823 | 3823 | $img_preview = "props.attributes.$key && (function() { |
| 3824 | 3824 | let uploads = JSON.parse('['+props.attributes.$key+']'); |
| 3825 | 3825 | let images = []; |
@@ -3832,7 +3832,7 @@ discard block |
||
| 3832 | 3832 | el('i',{ |
| 3833 | 3833 | className: 'fas fa-times-circle text-danger position-absolute ml-n2 mt-n1 bg-white rounded-circle c-pointer', |
| 3834 | 3834 | onClick: function() { |
| 3835 | - aui_confirm('".esc_attr__('Are you sure?')."', '".esc_attr__('Delete')."', '".esc_attr__('Cancel')."', true).then(function(confirmed) { |
|
| 3835 | + aui_confirm('" . esc_attr__('Are you sure?') . "', '" . esc_attr__('Delete') . "', '" . esc_attr__('Cancel') . "', true).then(function(confirmed) { |
|
| 3836 | 3836 | if (confirmed) { |
| 3837 | 3837 | let new_uploads = JSON.parse('['+props.attributes.$key+']'); |
| 3838 | 3838 | new_uploads.splice(index, 1); |
@@ -3895,36 +3895,36 @@ discard block |
||
| 3895 | 3895 | |
| 3896 | 3896 | //$inside_elements = ",el('div',{},'file upload')"; |
| 3897 | 3897 | } |
| 3898 | - elseif ( $args['type'] == 'checkbox' ) { |
|
| 3898 | + elseif ($args['type'] == 'checkbox') { |
|
| 3899 | 3899 | $type = 'CheckboxControl'; |
| 3900 | 3900 | $extra .= "checked: props.attributes.$key,"; |
| 3901 | 3901 | $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; |
| 3902 | - } elseif ( $args['type'] == 'textarea' ) { |
|
| 3902 | + } elseif ($args['type'] == 'textarea') { |
|
| 3903 | 3903 | $type = 'TextareaControl'; |
| 3904 | 3904 | |
| 3905 | - } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { |
|
| 3905 | + } elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') { |
|
| 3906 | 3906 | $type = 'SelectControl'; |
| 3907 | 3907 | |
| 3908 | - if($args['name'] == 'category' && !empty($args['post_type_linked'])){ |
|
| 3909 | - $options .= "options: taxonomies_".str_replace("-","_", $this->id).","; |
|
| 3910 | - }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ |
|
| 3911 | - $options .= "options: sort_by_".str_replace("-","_", $this->id).","; |
|
| 3912 | - }else { |
|
| 3908 | + if ($args['name'] == 'category' && !empty($args['post_type_linked'])) { |
|
| 3909 | + $options .= "options: taxonomies_" . str_replace("-", "_", $this->id) . ","; |
|
| 3910 | + }elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) { |
|
| 3911 | + $options .= "options: sort_by_" . str_replace("-", "_", $this->id) . ","; |
|
| 3912 | + } else { |
|
| 3913 | 3913 | |
| 3914 | - if ( ! empty( $args['options'] ) ) { |
|
| 3914 | + if (!empty($args['options'])) { |
|
| 3915 | 3915 | $options .= "options: ["; |
| 3916 | - foreach ( $args['options'] as $option_val => $option_label ) { |
|
| 3917 | - $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },"; |
|
| 3916 | + foreach ($args['options'] as $option_val => $option_label) { |
|
| 3917 | + $options .= "{ value: '" . esc_attr($option_val) . "', label: '" . esc_js(addslashes($option_label)) . "' },"; |
|
| 3918 | 3918 | } |
| 3919 | 3919 | $options .= "],"; |
| 3920 | 3920 | } |
| 3921 | 3921 | } |
| 3922 | - if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
| 3922 | + if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 |
|
| 3923 | 3923 | $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, '; |
| 3924 | 3924 | } |
| 3925 | 3925 | |
| 3926 | - if($args['type'] == 'multiselect' || ( isset( $args['multiple'] ) && $args['multiple'] ) ){ |
|
| 3927 | - $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
| 3926 | + if ($args['type'] == 'multiselect' || (isset($args['multiple']) && $args['multiple'])) { |
|
| 3927 | + $after_elements .= "props.attributes.$key && el( wp.components.Button, { |
|
| 3928 | 3928 | className: 'components-button components-circular-option-picker__clear is-secondary is-small', |
| 3929 | 3929 | style: {margin:'-8px 0 8px 0',display: 'block'}, |
| 3930 | 3930 | onClick: function(){ |
@@ -3936,7 +3936,7 @@ discard block |
||
| 3936 | 3936 | 'Clear' |
| 3937 | 3937 | ),"; |
| 3938 | 3938 | } |
| 3939 | - } elseif ( $args['type'] == 'tagselect' ) { |
|
| 3939 | + } elseif ($args['type'] == 'tagselect') { |
|
| 3940 | 3940 | // $type = 'FormTokenField'; |
| 3941 | 3941 | // |
| 3942 | 3942 | // if ( ! empty( $args['options'] ) ) { |
@@ -3971,19 +3971,19 @@ discard block |
||
| 3971 | 3971 | // $value = "[]"; |
| 3972 | 3972 | // $extra .= ' __experimentalExpandOnFocus: true,'; |
| 3973 | 3973 | |
| 3974 | - } else if ( $args['type'] == 'alignment' ) { |
|
| 3974 | + } else if ($args['type'] == 'alignment') { |
|
| 3975 | 3975 | $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example |
| 3976 | - } else if ( $args['type'] == 'margins' ) { |
|
| 3976 | + } else if ($args['type'] == 'margins') { |
|
| 3977 | 3977 | |
| 3978 | - } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) { |
|
| 3978 | + } else if ($args['type'] == 'visibility_conditions' && (function_exists('wp_is_block_theme') && wp_is_block_theme())) { |
|
| 3979 | 3979 | $type = 'TextControl'; |
| 3980 | 3980 | $value = "(props.attributes.$key ? props.attributes.$key : '')"; |
| 3981 | 3981 | $args['type'] = 'text'; |
| 3982 | 3982 | $options .= 'disabled:true,'; |
| 3983 | - $bsvc_title = esc_attr( addslashes( $args['title'] ) ); |
|
| 3984 | - $bsvc_body = $this->block_visibility_fields( $args ); |
|
| 3983 | + $bsvc_title = esc_attr(addslashes($args['title'])); |
|
| 3984 | + $bsvc_body = $this->block_visibility_fields($args); |
|
| 3985 | 3985 | // @TODO reset button |
| 3986 | - $bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __( 'Reset', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __( 'Close', 'ayecode-connect' ) . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __( 'Save Rules', 'ayecode-connect' ) . '</button>'; |
|
| 3986 | + $bsvc_footer = '<button type="button" class="btn btn-danger d-none">' . __('Reset', 'ayecode-connect') . '</button><button type="button" class="btn btn-secondary bs-vc-close text-white" data-bs-dismiss="modal">' . __('Close', 'ayecode-connect') . '</button><button type="button" class="btn btn-primary bs-vc-save">' . __('Save Rules', 'ayecode-connect') . '</button>'; |
|
| 3987 | 3987 | $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, { |
| 3988 | 3988 | className: 'components-button components-circular-option-picker__clear is-primary is-smallx', |
| 3989 | 3989 | onClick: function() { |
@@ -4002,25 +4002,25 @@ discard block |
||
| 4002 | 4002 | jQuery('.bs-vc-modal-form').trigger('change'); |
| 4003 | 4003 | } |
| 4004 | 4004 | }); |
| 4005 | - aui_modal('" . $bsvc_title . "', '" . addslashes( $bsvc_body ) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
| 4005 | + aui_modal('" . $bsvc_title . "', '" . addslashes($bsvc_body) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); |
|
| 4006 | 4006 | jQuery(document).off('change', '#bsvc_raw_value').on('change', '#bsvc_raw_value', function(e) { |
| 4007 | 4007 | props.setAttributes({" . $key . ": e.target.value}); |
| 4008 | 4008 | }); |
| 4009 | 4009 | } |
| 4010 | 4010 | }, |
| 4011 | - '" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "' |
|
| 4011 | + '" . addslashes(!empty($args['button_title']) ? $args['button_title'] : $args['title']) . "' |
|
| 4012 | 4012 | ) ),"; |
| 4013 | 4013 | } else { |
| 4014 | - return;// if we have not implemented the control then don't break the JS. |
|
| 4014 | + return; // if we have not implemented the control then don't break the JS. |
|
| 4015 | 4015 | } |
| 4016 | 4016 | |
| 4017 | 4017 | // color input does not show the labels so we add them |
| 4018 | - if($args['type']=='color'){ |
|
| 4018 | + if ($args['type'] == 'color') { |
|
| 4019 | 4019 | // add show only if advanced |
| 4020 | 4020 | echo $require_advanced; |
| 4021 | 4021 | // add setting require if defined |
| 4022 | 4022 | echo $element_require; |
| 4023 | - echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),"; |
|
| 4023 | + echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),"; |
|
| 4024 | 4024 | } |
| 4025 | 4025 | |
| 4026 | 4026 | // add show only if advanced |
@@ -4032,22 +4032,22 @@ discard block |
||
| 4032 | 4032 | // icon |
| 4033 | 4033 | echo $icon; |
| 4034 | 4034 | ?> |
| 4035 | - el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components.".$type; ?>, { |
|
| 4036 | - label: <?php if ( empty( $args['title'] ) ) { echo "''"; } else if ( empty( $args['row'] ) && ! empty( $args['device_type'] ) ) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes( $args['title'] ) ?>'}}),<?php if ( $device_type_icon ) { ?>deviceType == '<?php echo $device_type;?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php |
|
| 4037 | - } else { ?>'<?php echo addslashes( trim( esc_html( $args['title'] ) ) ); ?>'<?php } ?>, |
|
| 4038 | - help: <?php echo ( isset( $args['desc'] ) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim( wp_kses_post( addslashes( $args['desc'] ) ) ) . "'}})" : "''" ); ?>, |
|
| 4035 | + el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type : "wp.components." . $type; ?>, { |
|
| 4036 | + label: <?php if (empty($args['title'])) { echo "''"; } else if (empty($args['row']) && !empty($args['device_type'])) { ?>el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: '<?php echo addslashes($args['title']) ?>'}}),<?php if ($device_type_icon) { ?>deviceType == '<?php echo $device_type; ?>' && el('span',{dangerouslySetInnerHTML: {__html: '<?php echo $device_type_icon; ?>'},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}})<?php } ?>)<?php |
|
| 4037 | + } else { ?>'<?php echo addslashes(trim(esc_html($args['title']))); ?>'<?php } ?>, |
|
| 4038 | + help: <?php echo (isset($args['desc']) ? "el('span', {dangerouslySetInnerHTML: {__html: '" . trim(wp_kses_post(addslashes($args['desc']))) . "'}})" : "''"); ?>, |
|
| 4039 | 4039 | value: <?php echo $value; ?>, |
| 4040 | - <?php if ( $type == 'TextControl' && $args['type'] != 'text' ) { |
|
| 4041 | - echo "type: '" . addslashes( $args['type'] ) . "',"; |
|
| 4040 | + <?php if ($type == 'TextControl' && $args['type'] != 'text') { |
|
| 4041 | + echo "type: '" . addslashes($args['type']) . "',"; |
|
| 4042 | 4042 | } ?> |
| 4043 | - <?php if ( ! empty( $args['placeholder'] ) ) { |
|
| 4044 | - echo "placeholder: '" . esc_js( addslashes( trim( esc_html( $args['placeholder'] ) ) ) ) . "',"; |
|
| 4043 | + <?php if (!empty($args['placeholder'])) { |
|
| 4044 | + echo "placeholder: '" . esc_js(addslashes(trim(esc_html($args['placeholder'])))) . "',"; |
|
| 4045 | 4045 | } ?> |
| 4046 | 4046 | <?php echo $options; ?> |
| 4047 | 4047 | <?php echo $extra; ?> |
| 4048 | 4048 | <?php echo $custom_attributes; ?> |
| 4049 | 4049 | <?php echo $onchangecomplete; ?> |
| 4050 | - <?php if ( $onchange ) { ?> |
|
| 4050 | + <?php if ($onchange) { ?> |
|
| 4051 | 4051 | onChange: function ( <?php echo $key; ?> ) { |
| 4052 | 4052 | <?php echo $onchange; ?> |
| 4053 | 4053 | } |
@@ -4066,15 +4066,15 @@ discard block |
||
| 4066 | 4066 | *@todo there is prob a faster way to do this, also we could add some validation here. |
| 4067 | 4067 | * |
| 4068 | 4068 | */ |
| 4069 | - public function array_to_attributes( $custom_attributes, $html = false ) { |
|
| 4069 | + public function array_to_attributes($custom_attributes, $html = false) { |
|
| 4070 | 4070 | $attributes = ''; |
| 4071 | - if ( ! empty( $custom_attributes ) ) { |
|
| 4071 | + if (!empty($custom_attributes)) { |
|
| 4072 | 4072 | |
| 4073 | - foreach ( $custom_attributes as $key => $val ) { |
|
| 4074 | - if(is_array($val)){ |
|
| 4075 | - $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},'; |
|
| 4076 | - }else{ |
|
| 4077 | - $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
| 4073 | + foreach ($custom_attributes as $key => $val) { |
|
| 4074 | + if (is_array($val)) { |
|
| 4075 | + $attributes .= $key . ': {' . $this->array_to_attributes($val, $html) . '},'; |
|
| 4076 | + } else { |
|
| 4077 | + $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; |
|
| 4078 | 4078 | } |
| 4079 | 4079 | } |
| 4080 | 4080 | |
@@ -4092,113 +4092,113 @@ discard block |
||
| 4092 | 4092 | * |
| 4093 | 4093 | * @param $args |
| 4094 | 4094 | */ |
| 4095 | - public function block_element( $args, $save = false ) { |
|
| 4095 | + public function block_element($args, $save = false) { |
|
| 4096 | 4096 | |
| 4097 | 4097 | // print_r($args);echo '###';exit; |
| 4098 | 4098 | |
| 4099 | - if ( ! empty( $args ) ) { |
|
| 4100 | - foreach ( $args as $element => $new_args ) { |
|
| 4099 | + if (!empty($args)) { |
|
| 4100 | + foreach ($args as $element => $new_args) { |
|
| 4101 | 4101 | |
| 4102 | - if ( is_array( $new_args ) ) { // its an element |
|
| 4102 | + if (is_array($new_args)) { // its an element |
|
| 4103 | 4103 | |
| 4104 | 4104 | |
| 4105 | - if ( isset( $new_args['element'] ) ) { |
|
| 4105 | + if (isset($new_args['element'])) { |
|
| 4106 | 4106 | |
| 4107 | - if ( isset( $new_args['element_require'] ) ) { |
|
| 4108 | - echo str_replace( array( |
|
| 4107 | + if (isset($new_args['element_require'])) { |
|
| 4108 | + echo str_replace(array( |
|
| 4109 | 4109 | "'+", |
| 4110 | 4110 | "+'" |
| 4111 | - ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; |
|
| 4112 | - unset( $new_args['element_require'] ); |
|
| 4111 | + ), '', $this->block_props_replace($new_args['element_require'])) . " && "; |
|
| 4112 | + unset($new_args['element_require']); |
|
| 4113 | 4113 | } |
| 4114 | 4114 | |
| 4115 | - if($new_args['element']=='InnerBlocks'){ |
|
| 4115 | + if ($new_args['element'] == 'InnerBlocks') { |
|
| 4116 | 4116 | echo "\n el( InnerBlocks, {"; |
| 4117 | - }elseif($new_args['element']=='innerBlocksProps'){ |
|
| 4117 | + }elseif ($new_args['element'] == 'innerBlocksProps') { |
|
| 4118 | 4118 | $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div'; |
| 4119 | 4119 | // echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {"; |
| 4120 | 4120 | // echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
| 4121 | 4121 | echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; |
| 4122 | 4122 | echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {"; |
| 4123 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
| 4123 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
| 4124 | 4124 | |
| 4125 | 4125 | echo "} ), {"; |
| 4126 | - echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : ''; |
|
| 4126 | + echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element($new_args['innerBlocksProps'], $save) : ''; |
|
| 4127 | 4127 | // echo '###'; |
| 4128 | 4128 | |
| 4129 | 4129 | // echo '###'; |
| 4130 | - }elseif($new_args['element']=='BlocksProps'){ |
|
| 4130 | + }elseif ($new_args['element'] == 'BlocksProps') { |
|
| 4131 | 4131 | |
| 4132 | - if ( isset($new_args['if_inner_element']) ) { |
|
| 4132 | + if (isset($new_args['if_inner_element'])) { |
|
| 4133 | 4133 | $element = $new_args['if_inner_element']; |
| 4134 | - }else { |
|
| 4135 | - $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'"; |
|
| 4134 | + } else { |
|
| 4135 | + $element = isset($new_args['inner_element']) ? "'" . esc_attr($new_args['inner_element']) . "'" : "'div'"; |
|
| 4136 | 4136 | } |
| 4137 | 4137 | |
| 4138 | 4138 | unset($new_args['inner_element']); |
| 4139 | 4139 | echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {"; |
| 4140 | - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; |
|
| 4140 | + echo !empty($new_args['blockProps']) ? $this->block_element($new_args['blockProps'], $save) : ''; |
|
| 4141 | 4141 | |
| 4142 | 4142 | |
| 4143 | 4143 | // echo "} ),"; |
| 4144 | 4144 | |
| 4145 | - }else{ |
|
| 4145 | + } else { |
|
| 4146 | 4146 | echo "\n el( '" . $new_args['element'] . "', {"; |
| 4147 | 4147 | } |
| 4148 | 4148 | |
| 4149 | 4149 | |
| 4150 | 4150 | // get the attributes |
| 4151 | - foreach ( $new_args as $new_key => $new_value ) { |
|
| 4151 | + foreach ($new_args as $new_key => $new_value) { |
|
| 4152 | 4152 | |
| 4153 | 4153 | |
| 4154 | - if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) { |
|
| 4154 | + if ($new_key == 'element' || $new_key == 'content' || $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) { |
|
| 4155 | 4155 | // do nothing |
| 4156 | 4156 | } else { |
| 4157 | - echo $this->block_element( array( $new_key => $new_value ),$save ); |
|
| 4157 | + echo $this->block_element(array($new_key => $new_value), $save); |
|
| 4158 | 4158 | } |
| 4159 | 4159 | } |
| 4160 | 4160 | |
| 4161 | - echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes |
|
| 4161 | + echo $new_args['element'] == 'BlocksProps' ? '} ),' : "},"; // end attributes |
|
| 4162 | 4162 | |
| 4163 | 4163 | // get the content |
| 4164 | 4164 | $first_item = 0; |
| 4165 | - foreach ( $new_args as $new_key => $new_value ) { |
|
| 4166 | - if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) { |
|
| 4165 | + foreach ($new_args as $new_key => $new_value) { |
|
| 4166 | + if ($new_key === 'content' || $new_key === 'if_content' || is_array($new_value)) { |
|
| 4167 | 4167 | |
| 4168 | - if ( $new_key === 'content' ) { |
|
| 4169 | - echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'"; |
|
| 4170 | - }else if ( $new_key === 'if_content' ) { |
|
| 4171 | - echo $this->block_props_replace( $new_value ); |
|
| 4168 | + if ($new_key === 'content') { |
|
| 4169 | + echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'"; |
|
| 4170 | + } else if ($new_key === 'if_content') { |
|
| 4171 | + echo $this->block_props_replace($new_value); |
|
| 4172 | 4172 | } |
| 4173 | 4173 | |
| 4174 | - if ( is_array( $new_value ) ) { |
|
| 4174 | + if (is_array($new_value)) { |
|
| 4175 | 4175 | |
| 4176 | - if ( isset( $new_value['element_require'] ) ) { |
|
| 4177 | - echo str_replace( array( |
|
| 4176 | + if (isset($new_value['element_require'])) { |
|
| 4177 | + echo str_replace(array( |
|
| 4178 | 4178 | "'+", |
| 4179 | 4179 | "+'" |
| 4180 | - ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; |
|
| 4181 | - unset( $new_value['element_require'] ); |
|
| 4180 | + ), '', $this->block_props_replace($new_value['element_require'])) . " && "; |
|
| 4181 | + unset($new_value['element_require']); |
|
| 4182 | 4182 | } |
| 4183 | 4183 | |
| 4184 | - if ( isset( $new_value['element_repeat'] ) ) { |
|
| 4184 | + if (isset($new_value['element_repeat'])) { |
|
| 4185 | 4185 | $x = 1; |
| 4186 | - while ( $x <= absint( $new_value['element_repeat'] ) ) { |
|
| 4187 | - $this->block_element( array( '' => $new_value ),$save ); |
|
| 4188 | - $x ++; |
|
| 4186 | + while ($x <= absint($new_value['element_repeat'])) { |
|
| 4187 | + $this->block_element(array('' => $new_value), $save); |
|
| 4188 | + $x++; |
|
| 4189 | 4189 | } |
| 4190 | 4190 | } else { |
| 4191 | - $this->block_element( array( '' => $new_value ),$save ); |
|
| 4191 | + $this->block_element(array('' => $new_value), $save); |
|
| 4192 | 4192 | } |
| 4193 | 4193 | } |
| 4194 | - $first_item ++; |
|
| 4194 | + $first_item++; |
|
| 4195 | 4195 | } |
| 4196 | 4196 | } |
| 4197 | 4197 | |
| 4198 | - if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){ |
|
| 4199 | - echo "))";// end content |
|
| 4200 | - }else{ |
|
| 4201 | - echo ")";// end content |
|
| 4198 | + if ($new_args['element'] == 'innerBlocksProps' || $new_args['element'] == 'xBlocksProps') { |
|
| 4199 | + echo "))"; // end content |
|
| 4200 | + } else { |
|
| 4201 | + echo ")"; // end content |
|
| 4202 | 4202 | } |
| 4203 | 4203 | |
| 4204 | 4204 | |
@@ -4207,26 +4207,26 @@ discard block |
||
| 4207 | 4207 | } |
| 4208 | 4208 | } else { |
| 4209 | 4209 | |
| 4210 | - if ( substr( $element, 0, 3 ) === "if_" ) { |
|
| 4210 | + if (substr($element, 0, 3) === "if_") { |
|
| 4211 | 4211 | $extra = ''; |
| 4212 | - if( strpos($new_args, '[%WrapClass%]') !== false ){ |
|
| 4213 | - $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args); |
|
| 4214 | - $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args); |
|
| 4212 | + if (strpos($new_args, '[%WrapClass%]') !== false) { |
|
| 4213 | + $new_args = str_replace('[%WrapClass%]"', '" + sd_build_aui_class(props.attributes)', $new_args); |
|
| 4214 | + $new_args = str_replace('[%WrapClass%]', '+ sd_build_aui_class(props.attributes)', $new_args); |
|
| 4215 | 4215 | } |
| 4216 | - echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ","; |
|
| 4217 | - } elseif ( $element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false ) { |
|
| 4218 | - $new_args = str_replace('[%WrapStyle%]','',$new_args); |
|
| 4219 | - echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
| 4216 | + echo str_replace("if_", "", $element) . ": " . $this->block_props_replace($new_args, true) . ","; |
|
| 4217 | + } elseif ($element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false) { |
|
| 4218 | + $new_args = str_replace('[%WrapStyle%]', '', $new_args); |
|
| 4219 | + echo $element . ": {..." . $this->block_props_replace($new_args) . " , ...sd_build_aui_styles(props.attributes) },"; |
|
| 4220 | 4220 | // echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
| 4221 | - } elseif ( $element == 'style' ) { |
|
| 4222 | - echo $element . ": " . $this->block_props_replace( $new_args ) . ","; |
|
| 4223 | - } elseif ( ( $element == 'class' || $element == 'className' ) && strpos($new_args, '[%WrapClass%]') !== false ) { |
|
| 4224 | - $new_args = str_replace('[%WrapClass%]','',$new_args); |
|
| 4225 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),"; |
|
| 4226 | - } elseif ( $element == 'template' && $new_args ) { |
|
| 4221 | + } elseif ($element == 'style') { |
|
| 4222 | + echo $element . ": " . $this->block_props_replace($new_args) . ","; |
|
| 4223 | + } elseif (($element == 'class' || $element == 'className') && strpos($new_args, '[%WrapClass%]') !== false) { |
|
| 4224 | + $new_args = str_replace('[%WrapClass%]', '', $new_args); |
|
| 4225 | + echo $element . ": '" . $this->block_props_replace($new_args) . "' + sd_build_aui_class(props.attributes),"; |
|
| 4226 | + } elseif ($element == 'template' && $new_args) { |
|
| 4227 | 4227 | echo $element . ": $new_args,"; |
| 4228 | 4228 | } else { |
| 4229 | - echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; |
|
| 4229 | + echo $element . ": '" . $this->block_props_replace($new_args) . "',"; |
|
| 4230 | 4230 | } |
| 4231 | 4231 | |
| 4232 | 4232 | } |
@@ -4241,11 +4241,11 @@ discard block |
||
| 4241 | 4241 | * |
| 4242 | 4242 | * @return mixed |
| 4243 | 4243 | */ |
| 4244 | - public function block_props_replace( $string, $no_wrap = false ) { |
|
| 4245 | - if ( $no_wrap ) { |
|
| 4246 | - $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string ); |
|
| 4244 | + public function block_props_replace($string, $no_wrap = false) { |
|
| 4245 | + if ($no_wrap) { |
|
| 4246 | + $string = str_replace(array("[%", "%]", "%:checked]"), array("props.attributes.", "", ""), $string); |
|
| 4247 | 4247 | } else { |
| 4248 | - $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string ); |
|
| 4248 | + $string = str_replace(array("![%", "[%", "%]", "%:checked]"), array("'+!props.attributes.", "'+props.attributes.", "+'", "+'"), $string); |
|
| 4249 | 4249 | } |
| 4250 | 4250 | |
| 4251 | 4251 | return $string; |
@@ -4257,65 +4257,65 @@ discard block |
||
| 4257 | 4257 | * @param array $args |
| 4258 | 4258 | * @param array $instance |
| 4259 | 4259 | */ |
| 4260 | - public function widget( $args, $instance ) { |
|
| 4261 | - if ( ! is_array( $args ) ) { |
|
| 4260 | + public function widget($args, $instance) { |
|
| 4261 | + if (!is_array($args)) { |
|
| 4262 | 4262 | $args = array(); |
| 4263 | 4263 | } |
| 4264 | 4264 | |
| 4265 | 4265 | // Get the filtered values |
| 4266 | - $argument_values = $this->argument_values( $instance ); |
|
| 4267 | - $argument_values = $this->string_to_bool( $argument_values ); |
|
| 4268 | - $output = $this->output( $argument_values, $args ); |
|
| 4266 | + $argument_values = $this->argument_values($instance); |
|
| 4267 | + $argument_values = $this->string_to_bool($argument_values); |
|
| 4268 | + $output = $this->output($argument_values, $args); |
|
| 4269 | 4269 | |
| 4270 | 4270 | $no_wrap = false; |
| 4271 | - if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) { |
|
| 4271 | + if (isset($argument_values['no_wrap']) && $argument_values['no_wrap']) { |
|
| 4272 | 4272 | $no_wrap = true; |
| 4273 | 4273 | } |
| 4274 | 4274 | |
| 4275 | 4275 | ob_start(); |
| 4276 | - if ( $output && ! $no_wrap ) { |
|
| 4276 | + if ($output && !$no_wrap) { |
|
| 4277 | 4277 | |
| 4278 | 4278 | $class_original = $this->options['widget_ops']['classname']; |
| 4279 | - $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash(); |
|
| 4279 | + $class = $this->options['widget_ops']['classname'] . " sdel-" . $this->get_instance_hash(); |
|
| 4280 | 4280 | |
| 4281 | 4281 | // Before widget |
| 4282 | - $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : ''; |
|
| 4283 | - $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget; |
|
| 4284 | - $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this ); |
|
| 4285 | - $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this ); |
|
| 4282 | + $before_widget = !empty($args['before_widget']) ? $args['before_widget'] : ''; |
|
| 4283 | + $before_widget = $before_widget ? str_replace($class_original, $class, $before_widget) : $before_widget; |
|
| 4284 | + $before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this); |
|
| 4285 | + $before_widget = apply_filters('wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this); |
|
| 4286 | 4286 | |
| 4287 | 4287 | // After widget |
| 4288 | - $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : ''; |
|
| 4289 | - $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this ); |
|
| 4290 | - $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this ); |
|
| 4288 | + $after_widget = !empty($args['after_widget']) ? $args['after_widget'] : ''; |
|
| 4289 | + $after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this); |
|
| 4290 | + $after_widget = apply_filters('wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this); |
|
| 4291 | 4291 | |
| 4292 | 4292 | echo $before_widget; |
| 4293 | 4293 | // elementor strips the widget wrapping div so we check for and add it back if needed |
| 4294 | - if ( $this->is_elementor_widget_output() ) { |
|
| 4294 | + if ($this->is_elementor_widget_output()) { |
|
| 4295 | 4295 | // Filter class & attrs for elementor widget output. |
| 4296 | - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); |
|
| 4297 | - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); |
|
| 4296 | + $class = apply_filters('wp_super_duper_div_classname', $class, $args, $this); |
|
| 4297 | + $class = apply_filters('wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this); |
|
| 4298 | 4298 | |
| 4299 | - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); |
|
| 4300 | - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); |
|
| 4299 | + $attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this); |
|
| 4300 | + $attrs = apply_filters('wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this); |
|
| 4301 | 4301 | |
| 4302 | - echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">"; |
|
| 4302 | + echo "<span class='" . esc_attr($class) . "' " . $attrs . ">"; |
|
| 4303 | 4303 | } |
| 4304 | - echo $this->output_title( $args, $instance ); |
|
| 4304 | + echo $this->output_title($args, $instance); |
|
| 4305 | 4305 | echo $output; |
| 4306 | - if ( $this->is_elementor_widget_output() ) { |
|
| 4306 | + if ($this->is_elementor_widget_output()) { |
|
| 4307 | 4307 | echo "</span>"; |
| 4308 | 4308 | } |
| 4309 | 4309 | echo $after_widget; |
| 4310 | - } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty |
|
| 4311 | - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); |
|
| 4310 | + } elseif ($this->is_preview() && $output == '') {// if preview show a placeholder if empty |
|
| 4311 | + $output = $this->preview_placeholder_text("{{" . $this->base_id . "}}"); |
|
| 4312 | 4312 | echo $output; |
| 4313 | - } elseif ( $output && $no_wrap ) { |
|
| 4313 | + } elseif ($output && $no_wrap) { |
|
| 4314 | 4314 | echo $output; |
| 4315 | 4315 | } |
| 4316 | 4316 | $output = ob_get_clean(); |
| 4317 | 4317 | |
| 4318 | - $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); |
|
| 4318 | + $output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this); |
|
| 4319 | 4319 | |
| 4320 | 4320 | echo $output; |
| 4321 | 4321 | } |
@@ -4328,7 +4328,7 @@ discard block |
||
| 4328 | 4328 | */ |
| 4329 | 4329 | public function is_elementor_widget_output() { |
| 4330 | 4330 | $result = false; |
| 4331 | - if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { |
|
| 4331 | + if (defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID') { |
|
| 4332 | 4332 | $result = true; |
| 4333 | 4333 | } |
| 4334 | 4334 | |
@@ -4343,7 +4343,7 @@ discard block |
||
| 4343 | 4343 | */ |
| 4344 | 4344 | public function is_elementor_preview() { |
| 4345 | 4345 | $result = false; |
| 4346 | - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { |
|
| 4346 | + if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) { |
|
| 4347 | 4347 | $result = true; |
| 4348 | 4348 | } |
| 4349 | 4349 | |
@@ -4358,7 +4358,7 @@ discard block |
||
| 4358 | 4358 | */ |
| 4359 | 4359 | public function is_divi_preview() { |
| 4360 | 4360 | $result = false; |
| 4361 | - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { |
|
| 4361 | + if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) { |
|
| 4362 | 4362 | $result = true; |
| 4363 | 4363 | } |
| 4364 | 4364 | |
@@ -4373,7 +4373,7 @@ discard block |
||
| 4373 | 4373 | */ |
| 4374 | 4374 | public function is_beaver_preview() { |
| 4375 | 4375 | $result = false; |
| 4376 | - if ( isset( $_REQUEST['fl_builder'] ) ) { |
|
| 4376 | + if (isset($_REQUEST['fl_builder'])) { |
|
| 4377 | 4377 | $result = true; |
| 4378 | 4378 | } |
| 4379 | 4379 | |
@@ -4388,7 +4388,7 @@ discard block |
||
| 4388 | 4388 | */ |
| 4389 | 4389 | public function is_siteorigin_preview() { |
| 4390 | 4390 | $result = false; |
| 4391 | - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { |
|
| 4391 | + if (!empty($_REQUEST['siteorigin_panels_live_editor'])) { |
|
| 4392 | 4392 | $result = true; |
| 4393 | 4393 | } |
| 4394 | 4394 | |
@@ -4403,7 +4403,7 @@ discard block |
||
| 4403 | 4403 | */ |
| 4404 | 4404 | public function is_cornerstone_preview() { |
| 4405 | 4405 | $result = false; |
| 4406 | - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { |
|
| 4406 | + if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') { |
|
| 4407 | 4407 | $result = true; |
| 4408 | 4408 | } |
| 4409 | 4409 | |
@@ -4418,7 +4418,7 @@ discard block |
||
| 4418 | 4418 | */ |
| 4419 | 4419 | public function is_fusion_preview() { |
| 4420 | 4420 | $result = false; |
| 4421 | - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { |
|
| 4421 | + if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) { |
|
| 4422 | 4422 | $result = true; |
| 4423 | 4423 | } |
| 4424 | 4424 | |
@@ -4433,7 +4433,7 @@ discard block |
||
| 4433 | 4433 | */ |
| 4434 | 4434 | public function is_oxygen_preview() { |
| 4435 | 4435 | $result = false; |
| 4436 | - if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) { |
|
| 4436 | + if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) { |
|
| 4437 | 4437 | $result = true; |
| 4438 | 4438 | } |
| 4439 | 4439 | |
@@ -4450,7 +4450,7 @@ discard block |
||
| 4450 | 4450 | public function is_kallyas_zion_preview() { |
| 4451 | 4451 | $result = false; |
| 4452 | 4452 | |
| 4453 | - if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) { |
|
| 4453 | + if (function_exists('znhg_kallyas_theme_config') && !empty($_REQUEST['zn_pb_edit'])) { |
|
| 4454 | 4454 | $result = true; |
| 4455 | 4455 | } |
| 4456 | 4456 | |
@@ -4467,7 +4467,7 @@ discard block |
||
| 4467 | 4467 | public function is_bricks_preview() { |
| 4468 | 4468 | $result = false; |
| 4469 | 4469 | |
| 4470 | - if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) { |
|
| 4470 | + if (function_exists('bricks_is_builder') && (bricks_is_builder() || bricks_is_builder_call())) { |
|
| 4471 | 4471 | $result = true; |
| 4472 | 4472 | } |
| 4473 | 4473 | |
@@ -4482,25 +4482,25 @@ discard block |
||
| 4482 | 4482 | */ |
| 4483 | 4483 | public function is_preview() { |
| 4484 | 4484 | $preview = false; |
| 4485 | - if ( $this->is_divi_preview() ) { |
|
| 4485 | + if ($this->is_divi_preview()) { |
|
| 4486 | 4486 | $preview = true; |
| 4487 | - } elseif ( $this->is_elementor_preview() ) { |
|
| 4487 | + } elseif ($this->is_elementor_preview()) { |
|
| 4488 | 4488 | $preview = true; |
| 4489 | - } elseif ( $this->is_beaver_preview() ) { |
|
| 4489 | + } elseif ($this->is_beaver_preview()) { |
|
| 4490 | 4490 | $preview = true; |
| 4491 | - } elseif ( $this->is_siteorigin_preview() ) { |
|
| 4491 | + } elseif ($this->is_siteorigin_preview()) { |
|
| 4492 | 4492 | $preview = true; |
| 4493 | - } elseif ( $this->is_cornerstone_preview() ) { |
|
| 4493 | + } elseif ($this->is_cornerstone_preview()) { |
|
| 4494 | 4494 | $preview = true; |
| 4495 | - } elseif ( $this->is_fusion_preview() ) { |
|
| 4495 | + } elseif ($this->is_fusion_preview()) { |
|
| 4496 | 4496 | $preview = true; |
| 4497 | - } elseif ( $this->is_oxygen_preview() ) { |
|
| 4497 | + } elseif ($this->is_oxygen_preview()) { |
|
| 4498 | 4498 | $preview = true; |
| 4499 | - } elseif( $this->is_kallyas_zion_preview() ) { |
|
| 4499 | + } elseif ($this->is_kallyas_zion_preview()) { |
|
| 4500 | 4500 | $preview = true; |
| 4501 | - } elseif( $this->is_block_content_call() ) { |
|
| 4501 | + } elseif ($this->is_block_content_call()) { |
|
| 4502 | 4502 | $preview = true; |
| 4503 | - } elseif( $this->is_bricks_preview() ) { |
|
| 4503 | + } elseif ($this->is_bricks_preview()) { |
|
| 4504 | 4504 | $preview = true; |
| 4505 | 4505 | } |
| 4506 | 4506 | |
@@ -4515,44 +4515,44 @@ discard block |
||
| 4515 | 4515 | * |
| 4516 | 4516 | * @return string |
| 4517 | 4517 | */ |
| 4518 | - public function output_title( $args, $instance = array() ) { |
|
| 4518 | + public function output_title($args, $instance = array()) { |
|
| 4519 | 4519 | $output = ''; |
| 4520 | - if ( ! empty( $instance['title'] ) ) { |
|
| 4520 | + if (!empty($instance['title'])) { |
|
| 4521 | 4521 | /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ |
| 4522 | - $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
|
| 4522 | + $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); |
|
| 4523 | 4523 | |
| 4524 | - if ( empty( $instance['widget_title_tag'] ) ) { |
|
| 4525 | - if ( ! isset( $args['before_title'] ) ) { |
|
| 4524 | + if (empty($instance['widget_title_tag'])) { |
|
| 4525 | + if (!isset($args['before_title'])) { |
|
| 4526 | 4526 | $args['before_title'] = ''; |
| 4527 | 4527 | } |
| 4528 | 4528 | |
| 4529 | - if ( ! isset( $args['after_title'] ) ) { |
|
| 4529 | + if (!isset($args['after_title'])) { |
|
| 4530 | 4530 | $args['after_title'] = ''; |
| 4531 | 4531 | } |
| 4532 | 4532 | |
| 4533 | 4533 | $output = $args['before_title'] . $title . $args['after_title']; |
| 4534 | 4534 | } else { |
| 4535 | - $tag = esc_attr( $instance['widget_title_tag'] ); |
|
| 4536 | - $allowed_tags = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p' ); |
|
| 4537 | - $title_tag = in_array( $tag, $allowed_tags, true ) ? esc_attr( $tag ) : 'h2'; |
|
| 4535 | + $tag = esc_attr($instance['widget_title_tag']); |
|
| 4536 | + $allowed_tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'div', 'p'); |
|
| 4537 | + $title_tag = in_array($tag, $allowed_tags, true) ? esc_attr($tag) : 'h2'; |
|
| 4538 | 4538 | |
| 4539 | 4539 | // classes |
| 4540 | 4540 | $title_classes = array(); |
| 4541 | - $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : ''; |
|
| 4542 | - $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : ''; |
|
| 4543 | - $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : ''; |
|
| 4544 | - $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : ''; |
|
| 4545 | - $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : ''; |
|
| 4546 | - $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : ''; |
|
| 4547 | - $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : ''; |
|
| 4548 | - $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : ''; |
|
| 4549 | - $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : ''; |
|
| 4550 | - $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : ''; |
|
| 4551 | - $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : ''; |
|
| 4552 | - $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : ''; |
|
| 4553 | - $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : ''; |
|
| 4554 | - |
|
| 4555 | - $class = !empty( $title_classes ) ? implode(" ",$title_classes) : ''; |
|
| 4541 | + $title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : ''; |
|
| 4542 | + $title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : ''; |
|
| 4543 | + $title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : ''; |
|
| 4544 | + $title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : ''; |
|
| 4545 | + $title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : ''; |
|
| 4546 | + $title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : ''; |
|
| 4547 | + $title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : ''; |
|
| 4548 | + $title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : ''; |
|
| 4549 | + $title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : ''; |
|
| 4550 | + $title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : ''; |
|
| 4551 | + $title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : ''; |
|
| 4552 | + $title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : ''; |
|
| 4553 | + $title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : ''; |
|
| 4554 | + |
|
| 4555 | + $class = !empty($title_classes) ? implode(" ", $title_classes) : ''; |
|
| 4556 | 4556 | $output = "<$title_tag class='$class' >$title</$title_tag>"; |
| 4557 | 4557 | } |
| 4558 | 4558 | |
@@ -4566,7 +4566,7 @@ discard block |
||
| 4566 | 4566 | * |
| 4567 | 4567 | * @param array $instance The widget options. |
| 4568 | 4568 | */ |
| 4569 | - public function form( $instance ) { |
|
| 4569 | + public function form($instance) { |
|
| 4570 | 4570 | |
| 4571 | 4571 | // set widget instance |
| 4572 | 4572 | $this->instance = $instance; |
@@ -4574,20 +4574,20 @@ discard block |
||
| 4574 | 4574 | // set it as a SD widget |
| 4575 | 4575 | echo $this->widget_advanced_toggle(); |
| 4576 | 4576 | |
| 4577 | - echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>"; |
|
| 4577 | + echo "<p>" . esc_attr($this->options['widget_ops']['description']) . "</p>"; |
|
| 4578 | 4578 | $arguments_raw = $this->get_arguments(); |
| 4579 | 4579 | |
| 4580 | - if ( is_array( $arguments_raw ) ) { |
|
| 4580 | + if (is_array($arguments_raw)) { |
|
| 4581 | 4581 | |
| 4582 | - $arguments = $this->group_arguments( $arguments_raw ); |
|
| 4582 | + $arguments = $this->group_arguments($arguments_raw); |
|
| 4583 | 4583 | |
| 4584 | 4584 | // Do we have sections? |
| 4585 | 4585 | $has_sections = $arguments == $arguments_raw ? false : true; |
| 4586 | 4586 | |
| 4587 | 4587 | |
| 4588 | - if ( $has_sections ) { |
|
| 4588 | + if ($has_sections) { |
|
| 4589 | 4589 | $panel_count = 0; |
| 4590 | - foreach ( $arguments as $key => $args ) { |
|
| 4590 | + foreach ($arguments as $key => $args) { |
|
| 4591 | 4591 | |
| 4592 | 4592 | ?> |
| 4593 | 4593 | <script> |
@@ -4597,26 +4597,26 @@ discard block |
||
| 4597 | 4597 | |
| 4598 | 4598 | $hide = $panel_count ? ' style="display:none;" ' : ''; |
| 4599 | 4599 | $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down'; |
| 4600 | - 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>"; |
|
| 4601 | - echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>"; |
|
| 4600 | + 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>"; |
|
| 4601 | + echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>"; |
|
| 4602 | 4602 | |
| 4603 | - foreach ( $args as $k => $a ) { |
|
| 4603 | + foreach ($args as $k => $a) { |
|
| 4604 | 4604 | |
| 4605 | 4605 | $this->widget_inputs_row_start($k, $a); |
| 4606 | - $this->widget_inputs( $a, $instance ); |
|
| 4606 | + $this->widget_inputs($a, $instance); |
|
| 4607 | 4607 | $this->widget_inputs_row_end($k, $a); |
| 4608 | 4608 | |
| 4609 | 4609 | } |
| 4610 | 4610 | |
| 4611 | 4611 | echo "</div>"; |
| 4612 | 4612 | |
| 4613 | - $panel_count ++; |
|
| 4613 | + $panel_count++; |
|
| 4614 | 4614 | |
| 4615 | 4615 | } |
| 4616 | 4616 | } else { |
| 4617 | - foreach ( $arguments as $key => $args ) { |
|
| 4617 | + foreach ($arguments as $key => $args) { |
|
| 4618 | 4618 | $this->widget_inputs_row_start($key, $args); |
| 4619 | - $this->widget_inputs( $args, $instance ); |
|
| 4619 | + $this->widget_inputs($args, $instance); |
|
| 4620 | 4620 | $this->widget_inputs_row_end($key, $args); |
| 4621 | 4621 | } |
| 4622 | 4622 | } |
@@ -4624,28 +4624,28 @@ discard block |
||
| 4624 | 4624 | } |
| 4625 | 4625 | } |
| 4626 | 4626 | |
| 4627 | - public function widget_inputs_row_start( $key, $args ) { |
|
| 4628 | - if ( ! empty( $args['row'] ) ) { |
|
| 4627 | + public function widget_inputs_row_start($key, $args) { |
|
| 4628 | + if (!empty($args['row'])) { |
|
| 4629 | 4629 | // Maybe open |
| 4630 | - if ( ! empty( $args['row']['open'] ) ) { |
|
| 4630 | + if (!empty($args['row']['open'])) { |
|
| 4631 | 4631 | ?> |
| 4632 | - <div class='bsui sd-argument' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php echo ( ! empty( $args['row']['element_require'] ) ? $this->convert_element_require( $args['row']['element_require'] ) : '' ); ?>'> |
|
| 4633 | - <?php if ( ! empty( $args['row']['title'] ) ) { ?> |
|
| 4632 | + <div class='bsui sd-argument' data-argument='<?php echo esc_attr($args['row']['key']); ?>' data-element_require='<?php echo (!empty($args['row']['element_require']) ? $this->convert_element_require($args['row']['element_require']) : ''); ?>'> |
|
| 4633 | + <?php if (!empty($args['row']['title'])) { ?> |
|
| 4634 | 4634 | <?php |
| 4635 | - if ( isset( $args['row']['icon'] ) ) { |
|
| 4635 | + if (isset($args['row']['icon'])) { |
|
| 4636 | 4636 | $args['row']['icon'] = ''; |
| 4637 | 4637 | } |
| 4638 | 4638 | |
| 4639 | - if ( ! isset( $args['row']['device_type'] ) && isset( $args['device_type'] ) ) { |
|
| 4639 | + if (!isset($args['row']['device_type']) && isset($args['device_type'])) { |
|
| 4640 | 4640 | $args['row']['device_type'] = $args['device_type']; |
| 4641 | 4641 | } |
| 4642 | 4642 | ?> |
| 4643 | - <label class="mb-0"><?php echo $this->widget_field_title( $args['row'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label> |
|
| 4643 | + <label class="mb-0"><?php echo $this->widget_field_title($args['row']); ?><?php echo $this->widget_field_desc($args['row']); ?></label> |
|
| 4644 | 4644 | <?php } ?> |
| 4645 | - <div class='row<?php echo ( ! empty( $args['row']['class'] ) ? ' ' . esc_attr( $args['row']['class'] ) : '' ); ?>'> |
|
| 4645 | + <div class='row<?php echo (!empty($args['row']['class']) ? ' ' . esc_attr($args['row']['class']) : ''); ?>'> |
|
| 4646 | 4646 | <div class='col pr-2'> |
| 4647 | 4647 | <?php |
| 4648 | - } else if ( ! empty( $args['row']['close'] ) ) { |
|
| 4648 | + } else if (!empty($args['row']['close'])) { |
|
| 4649 | 4649 | echo "<div class='col pl-0 ps-0'>"; |
| 4650 | 4650 | } else { |
| 4651 | 4651 | echo "<div class='col pl-0 ps-0 pr-2 pe-2'>"; |
@@ -4653,10 +4653,10 @@ discard block |
||
| 4653 | 4653 | } |
| 4654 | 4654 | } |
| 4655 | 4655 | |
| 4656 | - public function widget_inputs_row_end( $key, $args ) { |
|
| 4657 | - if ( ! empty( $args['row'] ) ) { |
|
| 4656 | + public function widget_inputs_row_end($key, $args) { |
|
| 4657 | + if (!empty($args['row'])) { |
|
| 4658 | 4658 | // Maybe close |
| 4659 | - if ( ! empty( $args['row']['close'] ) ) { |
|
| 4659 | + if (!empty($args['row']['close'])) { |
|
| 4660 | 4660 | echo "</div></div>"; |
| 4661 | 4661 | } |
| 4662 | 4662 | echo "</div>"; |
@@ -4671,7 +4671,7 @@ discard block |
||
| 4671 | 4671 | public function widget_advanced_toggle() { |
| 4672 | 4672 | |
| 4673 | 4673 | $output = ''; |
| 4674 | - if ( $this->block_show_advanced() ) { |
|
| 4674 | + if ($this->block_show_advanced()) { |
|
| 4675 | 4675 | $val = 1; |
| 4676 | 4676 | } else { |
| 4677 | 4677 | $val = 0; |
@@ -4691,14 +4691,14 @@ discard block |
||
| 4691 | 4691 | *@since 1.0.0 |
| 4692 | 4692 | * |
| 4693 | 4693 | */ |
| 4694 | - public function convert_element_require( $input ) { |
|
| 4695 | - $input = str_replace( "'", '"', $input );// we only want double quotes |
|
| 4694 | + public function convert_element_require($input) { |
|
| 4695 | + $input = str_replace("'", '"', $input); // we only want double quotes |
|
| 4696 | 4696 | |
| 4697 | - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( |
|
| 4697 | + $output = esc_attr(str_replace(array("[%", "%]", "%:checked]"), array( |
|
| 4698 | 4698 | "jQuery(form).find('[data-argument=\"", |
| 4699 | 4699 | "\"]').find('input,select,textarea').val()", |
| 4700 | 4700 | "\"]').find('input:checked').val()" |
| 4701 | - ), $input ) ); |
|
| 4701 | + ), $input)); |
|
| 4702 | 4702 | |
| 4703 | 4703 | return $output; |
| 4704 | 4704 | } |
@@ -4709,48 +4709,48 @@ discard block |
||
| 4709 | 4709 | * @param $args |
| 4710 | 4710 | * @param $instance |
| 4711 | 4711 | */ |
| 4712 | - public function widget_inputs( $args, $instance ) { |
|
| 4712 | + public function widget_inputs($args, $instance) { |
|
| 4713 | 4713 | |
| 4714 | 4714 | $class = ""; |
| 4715 | 4715 | $element_require = ""; |
| 4716 | 4716 | $custom_attributes = ""; |
| 4717 | 4717 | |
| 4718 | 4718 | // get value |
| 4719 | - if ( isset( $instance[ $args['name'] ] ) ) { |
|
| 4720 | - $value = $instance[ $args['name'] ]; |
|
| 4721 | - } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) { |
|
| 4722 | - $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] ); |
|
| 4719 | + if (isset($instance[$args['name']])) { |
|
| 4720 | + $value = $instance[$args['name']]; |
|
| 4721 | + } elseif (!isset($instance[$args['name']]) && !empty($args['default'])) { |
|
| 4722 | + $value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']); |
|
| 4723 | 4723 | } else { |
| 4724 | 4724 | $value = ''; |
| 4725 | 4725 | } |
| 4726 | 4726 | |
| 4727 | 4727 | // get placeholder |
| 4728 | - if ( ! empty( $args['placeholder'] ) ) { |
|
| 4729 | - $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; |
|
| 4728 | + if (!empty($args['placeholder'])) { |
|
| 4729 | + $placeholder = "placeholder='" . esc_html($args['placeholder']) . "'"; |
|
| 4730 | 4730 | } else { |
| 4731 | 4731 | $placeholder = ''; |
| 4732 | 4732 | } |
| 4733 | 4733 | |
| 4734 | 4734 | // get if advanced |
| 4735 | - if ( isset( $args['advanced'] ) && $args['advanced'] ) { |
|
| 4735 | + if (isset($args['advanced']) && $args['advanced']) { |
|
| 4736 | 4736 | $class .= " sd-advanced-setting "; |
| 4737 | 4737 | } |
| 4738 | 4738 | |
| 4739 | 4739 | // element_require |
| 4740 | - if ( isset( $args['element_require'] ) && $args['element_require'] ) { |
|
| 4740 | + if (isset($args['element_require']) && $args['element_require']) { |
|
| 4741 | 4741 | $element_require = $args['element_require']; |
| 4742 | 4742 | } |
| 4743 | 4743 | |
| 4744 | 4744 | // custom_attributes |
| 4745 | - if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { |
|
| 4746 | - $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); |
|
| 4745 | + if (isset($args['custom_attributes']) && $args['custom_attributes']) { |
|
| 4746 | + $custom_attributes = $this->array_to_attributes($args['custom_attributes'], true); |
|
| 4747 | 4747 | } |
| 4748 | 4748 | |
| 4749 | 4749 | // before wrapper |
| 4750 | 4750 | ?> |
| 4751 | - <p class="sd-argument <?php echo esc_attr( $class ); ?>" data-argument='<?php echo esc_attr( $args['name'] ); ?>' data-element_require='<?php if ( $element_require ) { echo $this->convert_element_require( $element_require );} ?>'> |
|
| 4751 | + <p class="sd-argument <?php echo esc_attr($class); ?>" data-argument='<?php echo esc_attr($args['name']); ?>' data-element_require='<?php if ($element_require) { echo $this->convert_element_require($element_require); } ?>'> |
|
| 4752 | 4752 | <?php |
| 4753 | - switch ( $args['type'] ) { |
|
| 4753 | + switch ($args['type']) { |
|
| 4754 | 4754 | //array('text','password','number','email','tel','url','color') |
| 4755 | 4755 | case "text": |
| 4756 | 4756 | case "password": |
@@ -4760,33 +4760,33 @@ discard block |
||
| 4760 | 4760 | case "url": |
| 4761 | 4761 | case "color": |
| 4762 | 4762 | ?> |
| 4763 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
| 4764 | - <input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="<?php echo esc_attr( $args['type'] ); ?>" value="<?php echo esc_attr( $value ); ?>"> |
|
| 4763 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
| 4764 | + <input <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="<?php echo esc_attr($args['type']); ?>" value="<?php echo esc_attr($value); ?>"> |
|
| 4765 | 4765 | <?php |
| 4766 | 4766 | |
| 4767 | 4767 | break; |
| 4768 | 4768 | case "select": |
| 4769 | - $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false; |
|
| 4770 | - if ( $multiple ) { |
|
| 4771 | - if ( empty( $value ) ) { |
|
| 4769 | + $multiple = isset($args['multiple']) && $args['multiple'] ? true : false; |
|
| 4770 | + if ($multiple) { |
|
| 4771 | + if (empty($value)) { |
|
| 4772 | 4772 | $value = array(); |
| 4773 | 4773 | } |
| 4774 | 4774 | } |
| 4775 | 4775 | ?> |
| 4776 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
| 4777 | - <select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); if ( $multiple ) { echo "[]"; } ?>" |
|
| 4778 | - <?php if ( $multiple ) { |
|
| 4776 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
| 4777 | + <select <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); if ($multiple) { echo "[]"; } ?>" |
|
| 4778 | + <?php if ($multiple) { |
|
| 4779 | 4779 | echo "multiple"; |
| 4780 | 4780 | } //@todo not implemented yet due to gutenberg not supporting it |
| 4781 | 4781 | ?>> |
| 4782 | 4782 | <?php |
| 4783 | 4783 | |
| 4784 | - if ( ! empty( $args['options'] ) ) { |
|
| 4785 | - foreach ( $args['options'] as $val => $label ) { |
|
| 4786 | - if ( $multiple ) { |
|
| 4787 | - $selected = in_array( $val, $value ) ? 'selected="selected"' : ''; |
|
| 4784 | + if (!empty($args['options'])) { |
|
| 4785 | + foreach ($args['options'] as $val => $label) { |
|
| 4786 | + if ($multiple) { |
|
| 4787 | + $selected = in_array($val, $value) ? 'selected="selected"' : ''; |
|
| 4788 | 4788 | } else { |
| 4789 | - $selected = selected( $value, $val, false ); |
|
| 4789 | + $selected = selected($value, $val, false); |
|
| 4790 | 4790 | } |
| 4791 | 4791 | echo "<option value='$val' " . $selected . ">$label</option>"; |
| 4792 | 4792 | } |
@@ -4797,20 +4797,20 @@ discard block |
||
| 4797 | 4797 | break; |
| 4798 | 4798 | case "checkbox": |
| 4799 | 4799 | ?> |
| 4800 | - <input <?php echo $placeholder; ?> <?php checked( 1, $value, true ) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox" value="1"> |
|
| 4801 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
| 4800 | + <input <?php echo $placeholder; ?> <?php checked(1, $value, true) ?> <?php echo $custom_attributes; ?> class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox" value="1"> |
|
| 4801 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
| 4802 | 4802 | <?php |
| 4803 | 4803 | break; |
| 4804 | 4804 | case "textarea": |
| 4805 | 4805 | ?> |
| 4806 | - <label for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label> |
|
| 4807 | - <textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"><?php echo esc_attr( $value ); ?></textarea> |
|
| 4806 | + <label for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label> |
|
| 4807 | + <textarea <?php echo $placeholder; ?> class="widefat" <?php echo $custom_attributes; ?> id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"><?php echo esc_attr($value); ?></textarea> |
|
| 4808 | 4808 | <?php |
| 4809 | 4809 | |
| 4810 | 4810 | break; |
| 4811 | 4811 | case "hidden": |
| 4812 | 4812 | ?> |
| 4813 | - <input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>"> |
|
| 4813 | + <input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>" name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden" value="<?php echo esc_attr($value); ?>"> |
|
| 4814 | 4814 | <?php |
| 4815 | 4815 | break; |
| 4816 | 4816 | default: |
@@ -4820,15 +4820,15 @@ discard block |
||
| 4820 | 4820 | ?></p><?php |
| 4821 | 4821 | } |
| 4822 | 4822 | |
| 4823 | - public function get_widget_icon($icon = 'box-top', $title = ''){ |
|
| 4824 | - if($icon=='box-top'){ |
|
| 4825 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>'; |
|
| 4826 | - }elseif($icon=='box-right'){ |
|
| 4827 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>'; |
|
| 4828 | - }elseif($icon=='box-bottom'){ |
|
| 4829 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>'; |
|
| 4830 | - }elseif($icon=='box-left'){ |
|
| 4831 | - return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>'; |
|
| 4823 | + public function get_widget_icon($icon = 'box-top', $title = '') { |
|
| 4824 | + if ($icon == 'box-top') { |
|
| 4825 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>'; |
|
| 4826 | + }elseif ($icon == 'box-right') { |
|
| 4827 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>'; |
|
| 4828 | + }elseif ($icon == 'box-bottom') { |
|
| 4829 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>'; |
|
| 4830 | + }elseif ($icon == 'box-left') { |
|
| 4831 | + return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>'; |
|
| 4832 | 4832 | } |
| 4833 | 4833 | } |
| 4834 | 4834 | |
@@ -4840,14 +4840,14 @@ discard block |
||
| 4840 | 4840 | * @return string |
| 4841 | 4841 | * @todo, need to make its own tooltip script |
| 4842 | 4842 | */ |
| 4843 | - public function widget_field_desc( $args ) { |
|
| 4843 | + public function widget_field_desc($args) { |
|
| 4844 | 4844 | |
| 4845 | 4845 | $description = ''; |
| 4846 | - if ( isset( $args['desc'] ) && $args['desc'] ) { |
|
| 4847 | - if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) { |
|
| 4848 | - $description = $this->desc_tip( $args['desc'] ); |
|
| 4846 | + if (isset($args['desc']) && $args['desc']) { |
|
| 4847 | + if (isset($args['desc_tip']) && $args['desc_tip']) { |
|
| 4848 | + $description = $this->desc_tip($args['desc']); |
|
| 4849 | 4849 | } else { |
| 4850 | - $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>'; |
|
| 4850 | + $description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>'; |
|
| 4851 | 4851 | } |
| 4852 | 4852 | } |
| 4853 | 4853 | |
@@ -4861,18 +4861,18 @@ discard block |
||
| 4861 | 4861 | * |
| 4862 | 4862 | * @return string |
| 4863 | 4863 | */ |
| 4864 | - public function widget_field_title( $args ) { |
|
| 4864 | + public function widget_field_title($args) { |
|
| 4865 | 4865 | $title = ''; |
| 4866 | 4866 | |
| 4867 | - if ( isset( $args['title'] ) && $args['title'] ) { |
|
| 4868 | - if ( ! empty( $args['device_type'] ) ) { |
|
| 4867 | + if (isset($args['title']) && $args['title']) { |
|
| 4868 | + if (!empty($args['device_type'])) { |
|
| 4869 | 4869 | $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title. |
| 4870 | 4870 | } |
| 4871 | 4871 | |
| 4872 | - if ( isset( $args['icon'] ) && $args['icon'] ) { |
|
| 4873 | - $title = self::get_widget_icon( $args['icon'], $args['title'] ); |
|
| 4872 | + if (isset($args['icon']) && $args['icon']) { |
|
| 4873 | + $title = self::get_widget_icon($args['icon'], $args['title']); |
|
| 4874 | 4874 | } else { |
| 4875 | - $title = esc_attr( $args['title'] ); |
|
| 4875 | + $title = esc_attr($args['title']); |
|
| 4876 | 4876 | } |
| 4877 | 4877 | } |
| 4878 | 4878 | |
@@ -4887,11 +4887,11 @@ discard block |
||
| 4887 | 4887 | * |
| 4888 | 4888 | * @return string |
| 4889 | 4889 | */ |
| 4890 | - function desc_tip( $tip, $allow_html = false ) { |
|
| 4891 | - if ( $allow_html ) { |
|
| 4892 | - $tip = $this->sanitize_tooltip( $tip ); |
|
| 4890 | + function desc_tip($tip, $allow_html = false) { |
|
| 4891 | + if ($allow_html) { |
|
| 4892 | + $tip = $this->sanitize_tooltip($tip); |
|
| 4893 | 4893 | } else { |
| 4894 | - $tip = esc_attr( $tip ); |
|
| 4894 | + $tip = esc_attr($tip); |
|
| 4895 | 4895 | } |
| 4896 | 4896 | |
| 4897 | 4897 | return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>'; |
@@ -4904,8 +4904,8 @@ discard block |
||
| 4904 | 4904 | * |
| 4905 | 4905 | * @return string |
| 4906 | 4906 | */ |
| 4907 | - public function sanitize_tooltip( $var ) { |
|
| 4908 | - return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( |
|
| 4907 | + public function sanitize_tooltip($var) { |
|
| 4908 | + return htmlspecialchars(wp_kses(html_entity_decode($var), array( |
|
| 4909 | 4909 | 'br' => array(), |
| 4910 | 4910 | 'em' => array(), |
| 4911 | 4911 | 'strong' => array(), |
@@ -4915,7 +4915,7 @@ discard block |
||
| 4915 | 4915 | 'li' => array(), |
| 4916 | 4916 | 'ol' => array(), |
| 4917 | 4917 | 'p' => array(), |
| 4918 | - ) ) ); |
|
| 4918 | + ))); |
|
| 4919 | 4919 | } |
| 4920 | 4920 | |
| 4921 | 4921 | /** |
@@ -4927,30 +4927,30 @@ discard block |
||
| 4927 | 4927 | * @return array |
| 4928 | 4928 | * @todo we should add some sanitation here. |
| 4929 | 4929 | */ |
| 4930 | - public function update( $new_instance, $old_instance ) { |
|
| 4930 | + public function update($new_instance, $old_instance) { |
|
| 4931 | 4931 | |
| 4932 | 4932 | //save the widget |
| 4933 | - $instance = array_merge( (array) $old_instance, (array) $new_instance ); |
|
| 4933 | + $instance = array_merge((array) $old_instance, (array) $new_instance); |
|
| 4934 | 4934 | |
| 4935 | 4935 | // set widget instance |
| 4936 | 4936 | $this->instance = $instance; |
| 4937 | 4937 | |
| 4938 | - if ( empty( $this->arguments ) ) { |
|
| 4938 | + if (empty($this->arguments)) { |
|
| 4939 | 4939 | $this->get_arguments(); |
| 4940 | 4940 | } |
| 4941 | 4941 | |
| 4942 | 4942 | // check for checkboxes |
| 4943 | - if ( ! empty( $this->arguments ) ) { |
|
| 4944 | - foreach ( $this->arguments as $argument ) { |
|
| 4945 | - if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) { |
|
| 4946 | - $instance[ $argument['name'] ] = '0'; |
|
| 4943 | + if (!empty($this->arguments)) { |
|
| 4944 | + foreach ($this->arguments as $argument) { |
|
| 4945 | + if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) { |
|
| 4946 | + $instance[$argument['name']] = '0'; |
|
| 4947 | 4947 | } |
| 4948 | 4948 | } |
| 4949 | 4949 | } |
| 4950 | 4950 | |
| 4951 | 4951 | // maybe sanitize widget title |
| 4952 | - if(!empty($instance['title'])) { |
|
| 4953 | - $instance['title'] = wp_kses_post( $instance['title'] ); |
|
| 4952 | + if (!empty($instance['title'])) { |
|
| 4953 | + $instance['title'] = wp_kses_post($instance['title']); |
|
| 4954 | 4954 | } |
| 4955 | 4955 | |
| 4956 | 4956 | return $instance; |
@@ -4966,7 +4966,7 @@ discard block |
||
| 4966 | 4966 | */ |
| 4967 | 4967 | public function is_block_content_call() { |
| 4968 | 4968 | $result = false; |
| 4969 | - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { |
|
| 4969 | + if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') { |
|
| 4970 | 4970 | $result = true; |
| 4971 | 4971 | } |
| 4972 | 4972 | |
@@ -4979,9 +4979,9 @@ discard block |
||
| 4979 | 4979 | * @return string |
| 4980 | 4980 | *@since 1.0.20 |
| 4981 | 4981 | */ |
| 4982 | - public function get_instance_hash(){ |
|
| 4983 | - $instance_string = $this->base_id.serialize($this->instance); |
|
| 4984 | - return hash('crc32b',$instance_string); |
|
| 4982 | + public function get_instance_hash() { |
|
| 4983 | + $instance_string = $this->base_id . serialize($this->instance); |
|
| 4984 | + return hash('crc32b', $instance_string); |
|
| 4985 | 4985 | } |
| 4986 | 4986 | |
| 4987 | 4987 | /** |
@@ -4992,14 +4992,14 @@ discard block |
||
| 4992 | 4992 | * @return string |
| 4993 | 4993 | *@since 1.0.20 |
| 4994 | 4994 | */ |
| 4995 | - public function get_instance_style($rules = array()){ |
|
| 4995 | + public function get_instance_style($rules = array()) { |
|
| 4996 | 4996 | $css = ''; |
| 4997 | 4997 | |
| 4998 | - if(!empty($rules)){ |
|
| 4998 | + if (!empty($rules)) { |
|
| 4999 | 4999 | $rules = array_unique($rules); |
| 5000 | 5000 | $instance_hash = $this->get_instance_hash(); |
| 5001 | 5001 | $css .= "<style>"; |
| 5002 | - foreach($rules as $rule){ |
|
| 5002 | + foreach ($rules as $rule) { |
|
| 5003 | 5003 | $css .= ".sdel-$instance_hash $rule"; |
| 5004 | 5004 | } |
| 5005 | 5005 | $css .= "</style>"; |
@@ -5017,9 +5017,9 @@ discard block |
||
| 5017 | 5017 | *@since 1.0.28 |
| 5018 | 5018 | * |
| 5019 | 5019 | */ |
| 5020 | - public function encode_shortcodes( $content ) { |
|
| 5020 | + public function encode_shortcodes($content) { |
|
| 5021 | 5021 | // Avoids existing encoded tags. |
| 5022 | - $trans = array( |
|
| 5022 | + $trans = array( |
|
| 5023 | 5023 | '[' => '[', |
| 5024 | 5024 | ']' => ']', |
| 5025 | 5025 | '&#91;' => '[', |
@@ -5030,7 +5030,7 @@ discard block |
||
| 5030 | 5030 | '&gt;' => '&0gt;', |
| 5031 | 5031 | ); |
| 5032 | 5032 | |
| 5033 | - $content = strtr( $content, $trans ); |
|
| 5033 | + $content = strtr($content, $trans); |
|
| 5034 | 5034 | |
| 5035 | 5035 | $trans = array( |
| 5036 | 5036 | '[' => '[', |
@@ -5041,7 +5041,7 @@ discard block |
||
| 5041 | 5041 | "'" => ''', |
| 5042 | 5042 | ); |
| 5043 | 5043 | |
| 5044 | - $content = strtr( $content, $trans ); |
|
| 5044 | + $content = strtr($content, $trans); |
|
| 5045 | 5045 | |
| 5046 | 5046 | return $content; |
| 5047 | 5047 | } |
@@ -5055,8 +5055,8 @@ discard block |
||
| 5055 | 5055 | *@since 1.0.28 |
| 5056 | 5056 | * |
| 5057 | 5057 | */ |
| 5058 | - public function decode_shortcodes( $content ) { |
|
| 5059 | - $trans = array( |
|
| 5058 | + public function decode_shortcodes($content) { |
|
| 5059 | + $trans = array( |
|
| 5060 | 5060 | '[' => '[', |
| 5061 | 5061 | ']' => ']', |
| 5062 | 5062 | '&#91;' => '[', |
@@ -5069,7 +5069,7 @@ discard block |
||
| 5069 | 5069 | ''' => "'", |
| 5070 | 5070 | ); |
| 5071 | 5071 | |
| 5072 | - $content = strtr( $content, $trans ); |
|
| 5072 | + $content = strtr($content, $trans); |
|
| 5073 | 5073 | |
| 5074 | 5074 | $trans = array( |
| 5075 | 5075 | '[' => '[', |
@@ -5082,31 +5082,31 @@ discard block |
||
| 5082 | 5082 | '&0gt;' => '>', |
| 5083 | 5083 | ); |
| 5084 | 5084 | |
| 5085 | - $content = strtr( $content, $trans ); |
|
| 5085 | + $content = strtr($content, $trans); |
|
| 5086 | 5086 | |
| 5087 | 5087 | return $content; |
| 5088 | 5088 | } |
| 5089 | 5089 | |
| 5090 | - public function block_visibility_fields( $args ) { |
|
| 5091 | - $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : ''; |
|
| 5090 | + public function block_visibility_fields($args) { |
|
| 5091 | + $value = !empty($args['value']) ? esc_attr($args['value']) : ''; |
|
| 5092 | 5092 | $content = '<div class="bs-vc-rule-template d-none">'; |
| 5093 | 5093 | $content .= '<div class="p-3 pb-0 mb-3 border border-1 rounded-1 position-relative bs-vc-rule" data-bs-index="BSVCINDEX" >'; |
| 5094 | 5094 | $content .= '<div class="row">'; |
| 5095 | 5095 | $content .= '<div class="col-sm-12">'; |
| 5096 | - $content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__( 'Remove Rule', 'ayecode-connect' ) . '"><i class="fas fa-circle-minus fs-6"></i></span></div>'; |
|
| 5096 | + $content .= '<div class="bs-rule-action position-absolute top-0 end-0 p-2 zindex-5"><span class="text-danger c-pointer bs-vc-remove-rule" title="' . esc_attr__('Remove Rule', 'ayecode-connect') . '"><i class="fas fa-circle-minus fs-6"></i></span></div>'; |
|
| 5097 | 5097 | $content .= aui()->select( |
| 5098 | 5098 | array( |
| 5099 | 5099 | 'id' => 'bsvc_rule_BSVCINDEX', |
| 5100 | 5100 | 'name' => 'bsvc_rule_BSVCINDEX', |
| 5101 | - 'label' => __( 'Rule', 'ayecode-connect' ), |
|
| 5102 | - 'placeholder' => __( 'Select Rule...', 'ayecode-connect' ), |
|
| 5101 | + 'label' => __('Rule', 'ayecode-connect'), |
|
| 5102 | + 'placeholder' => __('Select Rule...', 'ayecode-connect'), |
|
| 5103 | 5103 | 'class' => 'bsvc_rule form-select-sm no-select2 mw-100', |
| 5104 | 5104 | 'options' => sd_visibility_rules_options(), |
| 5105 | 5105 | 'default' => '', |
| 5106 | 5106 | 'value' => '', |
| 5107 | 5107 | 'label_type' => '', |
| 5108 | 5108 | 'select2' => false, |
| 5109 | - 'input_group_left' => __( 'Rule:', 'ayecode-connect' ), |
|
| 5109 | + 'input_group_left' => __('Rule:', 'ayecode-connect'), |
|
| 5110 | 5110 | 'extra_attributes' => array( |
| 5111 | 5111 | 'data-minimum-results-for-search' => '-1' |
| 5112 | 5112 | ) |
@@ -5115,15 +5115,15 @@ discard block |
||
| 5115 | 5115 | |
| 5116 | 5116 | $content .= '</div>'; |
| 5117 | 5117 | |
| 5118 | - if ( class_exists( 'GeoDirectory' ) ) { |
|
| 5118 | + if (class_exists('GeoDirectory')) { |
|
| 5119 | 5119 | $content .= '<div class="col-md-7 col-sm-12">'; |
| 5120 | 5120 | |
| 5121 | 5121 | $content .= aui()->select( |
| 5122 | 5122 | array( |
| 5123 | 5123 | 'id' => 'bsvc_gd_field_BSVCINDEX', |
| 5124 | 5124 | 'name' => 'bsvc_gd_field_BSVCINDEX', |
| 5125 | - 'label' => __( 'FIELD', 'ayecode-connect' ), |
|
| 5126 | - 'placeholder' => __( 'FIELD', 'ayecode-connect' ), |
|
| 5125 | + 'label' => __('FIELD', 'ayecode-connect'), |
|
| 5126 | + 'placeholder' => __('FIELD', 'ayecode-connect'), |
|
| 5127 | 5127 | 'class' => 'bsvc_gd_field form-select-sm no-select2 mw-100', |
| 5128 | 5128 | 'options' => sd_visibility_gd_field_options(), |
| 5129 | 5129 | 'default' => '', |
@@ -5144,8 +5144,8 @@ discard block |
||
| 5144 | 5144 | array( |
| 5145 | 5145 | 'id' => 'bsvc_gd_field_condition_BSVCINDEX', |
| 5146 | 5146 | 'name' => 'bsvc_gd_field_condition_BSVCINDEX', |
| 5147 | - 'label' => __( 'CONDITION', 'ayecode-connect' ), |
|
| 5148 | - 'placeholder' => __( 'CONDITION', 'ayecode-connect' ), |
|
| 5147 | + 'label' => __('CONDITION', 'ayecode-connect'), |
|
| 5148 | + 'placeholder' => __('CONDITION', 'ayecode-connect'), |
|
| 5149 | 5149 | 'class' => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100', |
| 5150 | 5150 | 'options' => sd_visibility_field_condition_options(), |
| 5151 | 5151 | 'default' => '', |
@@ -5167,9 +5167,9 @@ discard block |
||
| 5167 | 5167 | 'type' => 'text', |
| 5168 | 5168 | 'id' => 'bsvc_gd_field_search_BSVCINDEX', |
| 5169 | 5169 | 'name' => 'bsvc_gd_field_search_BSVCINDEX', |
| 5170 | - 'label' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
| 5170 | + 'label' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
| 5171 | 5171 | 'class' => 'bsvc_gd_field_search form-control-sm', |
| 5172 | - 'placeholder' => __( 'VALUE TO MATCH', 'ayecode-connect' ), |
|
| 5172 | + 'placeholder' => __('VALUE TO MATCH', 'ayecode-connect'), |
|
| 5173 | 5173 | 'label_type' => '', |
| 5174 | 5174 | 'value' => '', |
| 5175 | 5175 | 'element_require' => '([%bsvc_rule_BSVCINDEX%]=="gd_field" && [%bsvc_gd_field_condition_BSVCINDEX%] && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_empty" && [%bsvc_gd_field_condition_BSVCINDEX%]!="is_not_empty")' |
@@ -5179,15 +5179,15 @@ discard block |
||
| 5179 | 5179 | $content .= '</div>'; |
| 5180 | 5180 | } |
| 5181 | 5181 | |
| 5182 | - $content .= apply_filters( 'sd_block_visibility_fields', '', $args ); |
|
| 5182 | + $content .= apply_filters('sd_block_visibility_fields', '', $args); |
|
| 5183 | 5183 | |
| 5184 | 5184 | $content .= '</div>'; |
| 5185 | 5185 | |
| 5186 | - $content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __( 'Select User Roles:', 'ayecode-connect' ) . '</label>'; |
|
| 5186 | + $content .= '<div class="row aui-conditional-field" data-element-require="jQuery(form).find(\'[name=bsvc_rule_BSVCINDEX]\').val()==\'user_roles\'" data-argument="bsvc_user_roles_BSVCINDEX_1"><label for="bsvc_user_roles_BSVCINDEX_1" class="form-label mb-3">' . __('Select User Roles:', 'ayecode-connect') . '</label>'; |
|
| 5187 | 5187 | $role_options = sd_user_roles_options(); |
| 5188 | 5188 | |
| 5189 | 5189 | $role_option_i = 0; |
| 5190 | - foreach ( $role_options as $role_option_key => $role_option_name ) { |
|
| 5190 | + foreach ($role_options as $role_option_key => $role_option_name) { |
|
| 5191 | 5191 | $role_option_i++; |
| 5192 | 5192 | |
| 5193 | 5193 | $content .= '<div class="col-sm-6">'; |
@@ -5207,19 +5207,19 @@ discard block |
||
| 5207 | 5207 | $content .= '</div>'; |
| 5208 | 5208 | } |
| 5209 | 5209 | $content .= '</div>'; |
| 5210 | - $content .= '<div class="bs-vc-sep-wrap text-center position-absolute top-0 mt-n3"><div class="bs-vc-sep-cond d-inline-block badge text-dark bg-gray mt-1">' . esc_html__( 'AND', 'ayecode-connect' ) . '</div></div>'; |
|
| 5210 | + $content .= '<div class="bs-vc-sep-wrap text-center position-absolute top-0 mt-n3"><div class="bs-vc-sep-cond d-inline-block badge text-dark bg-gray mt-1">' . esc_html__('AND', 'ayecode-connect') . '</div></div>'; |
|
| 5211 | 5211 | $content .= '</div>'; |
| 5212 | 5212 | $content .= '</div>'; |
| 5213 | 5213 | $content .= '<form id="bs-vc-modal-form" class="bs-vc-modal-form">'; |
| 5214 | 5214 | $content .= '<div class="bs-vc-rule-sets"></div>'; |
| 5215 | - $content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __( 'Add Rule', 'ayecode-connect' ) . '</button></div></div>'; |
|
| 5215 | + $content .= '<div class="row"><div class="col-sm-12 text-center pt-1 pb-4"><button type="button" class="btn btn-sm btn-primary d-block w-100 bs-vc-add-rule"><i class="fas fa-plus"></i> ' . __('Add Rule', 'ayecode-connect') . '</button></div></div>'; |
|
| 5216 | 5216 | $content .= '<div class="row"><div class="col-md-6 col-sm-12">'; |
| 5217 | 5217 | $content .= aui()->select( |
| 5218 | 5218 | array( |
| 5219 | 5219 | 'id' => 'bsvc_output', |
| 5220 | 5220 | 'name' => 'bsvc_output', |
| 5221 | - 'label' => __( 'What should happen if rules met.', 'ayecode-connect' ), |
|
| 5222 | - 'placeholder' => __( 'Show Block', 'ayecode-connect' ), |
|
| 5221 | + 'label' => __('What should happen if rules met.', 'ayecode-connect'), |
|
| 5222 | + 'placeholder' => __('Show Block', 'ayecode-connect'), |
|
| 5223 | 5223 | 'class' => 'bsvc_output form-select-sm no-select2 mw-100', |
| 5224 | 5224 | 'options' => sd_visibility_output_options(), |
| 5225 | 5225 | 'default' => '', |
@@ -5238,8 +5238,8 @@ discard block |
||
| 5238 | 5238 | array( |
| 5239 | 5239 | 'id' => 'bsvc_page', |
| 5240 | 5240 | 'name' => 'bsvc_page', |
| 5241 | - 'label' => __( 'Page Content', 'ayecode-connect' ), |
|
| 5242 | - 'placeholder' => __( 'Select Page ID...', 'ayecode-connect' ), |
|
| 5241 | + 'label' => __('Page Content', 'ayecode-connect'), |
|
| 5242 | + 'placeholder' => __('Select Page ID...', 'ayecode-connect'), |
|
| 5243 | 5243 | 'class' => 'bsvc_page form-select-sm no-select2 mw-100', |
| 5244 | 5244 | 'options' => sd_template_page_options(), |
| 5245 | 5245 | 'default' => '', |
@@ -5254,8 +5254,8 @@ discard block |
||
| 5254 | 5254 | array( |
| 5255 | 5255 | 'id' => 'bsvc_tmpl_part', |
| 5256 | 5256 | 'name' => 'bsvc_tmpl_part', |
| 5257 | - 'label' => __( 'Template Part', 'ayecode-connect' ), |
|
| 5258 | - 'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ), |
|
| 5257 | + 'label' => __('Template Part', 'ayecode-connect'), |
|
| 5258 | + 'placeholder' => __('Select Template Part...', 'ayecode-connect'), |
|
| 5259 | 5259 | 'class' => 'bsvc_tmpl_part form-select-sm no-select2 mw-100', |
| 5260 | 5260 | 'options' => sd_template_part_options(), |
| 5261 | 5261 | 'default' => '', |
@@ -5273,8 +5273,8 @@ discard block |
||
| 5273 | 5273 | array( |
| 5274 | 5274 | 'id' => 'bsvc_message_type', |
| 5275 | 5275 | 'name' => 'bsvc_message_type', |
| 5276 | - 'label' => __( 'Custom Message Type', 'ayecode-connect' ), |
|
| 5277 | - 'placeholder' => __( 'Default (none)', 'ayecode-connect' ), |
|
| 5276 | + 'label' => __('Custom Message Type', 'ayecode-connect'), |
|
| 5277 | + 'placeholder' => __('Default (none)', 'ayecode-connect'), |
|
| 5278 | 5278 | 'class' => 'bsvc_message_type form-select-sm no-select2 mw-100', |
| 5279 | 5279 | 'options' => sd_aui_colors(), |
| 5280 | 5280 | 'default' => '', |
@@ -5297,7 +5297,7 @@ discard block |
||
| 5297 | 5297 | 'name' => 'bsvc_message', |
| 5298 | 5298 | 'label' => '', |
| 5299 | 5299 | 'class' => 'bsvc_message form-control-sm mb-3', |
| 5300 | - 'placeholder' => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ), |
|
| 5300 | + 'placeholder' => __('CUSTOM MESSAGE TO SHOW', 'ayecode-connect'), |
|
| 5301 | 5301 | 'label_type' => '', |
| 5302 | 5302 | 'value' => '', |
| 5303 | 5303 | 'form_group_class' => ' ', |
@@ -5310,8 +5310,8 @@ discard block |
||
| 5310 | 5310 | array( |
| 5311 | 5311 | 'id' => 'bsvc_output_n', |
| 5312 | 5312 | 'name' => 'bsvc_output_n', |
| 5313 | - 'label' => __( 'What should happen if rules NOT met.', 'ayecode-connect' ), |
|
| 5314 | - 'placeholder' => __( 'Show Block', 'ayecode-connect' ), |
|
| 5313 | + 'label' => __('What should happen if rules NOT met.', 'ayecode-connect'), |
|
| 5314 | + 'placeholder' => __('Show Block', 'ayecode-connect'), |
|
| 5315 | 5315 | 'class' => 'bsvc_output_n form-select-sm no-select2 mw-100', |
| 5316 | 5316 | 'options' => sd_visibility_output_options(), |
| 5317 | 5317 | 'default' => '', |
@@ -5330,8 +5330,8 @@ discard block |
||
| 5330 | 5330 | array( |
| 5331 | 5331 | 'id' => 'bsvc_page_n', |
| 5332 | 5332 | 'name' => 'bsvc_page_n', |
| 5333 | - 'label' => __( 'Page Content', 'ayecode-connect' ), |
|
| 5334 | - 'placeholder' => __( 'Select Page ID...', 'ayecode-connect' ), |
|
| 5333 | + 'label' => __('Page Content', 'ayecode-connect'), |
|
| 5334 | + 'placeholder' => __('Select Page ID...', 'ayecode-connect'), |
|
| 5335 | 5335 | 'class' => 'bsvc_page_n form-select-sm no-select2 mw-100', |
| 5336 | 5336 | 'options' => sd_template_page_options(), |
| 5337 | 5337 | 'default' => '', |
@@ -5346,8 +5346,8 @@ discard block |
||
| 5346 | 5346 | array( |
| 5347 | 5347 | 'id' => 'bsvc_tmpl_part_n', |
| 5348 | 5348 | 'name' => 'bsvc_tmpl_part_n', |
| 5349 | - 'label' => __( 'Template Part', 'ayecode-connect' ), |
|
| 5350 | - 'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ), |
|
| 5349 | + 'label' => __('Template Part', 'ayecode-connect'), |
|
| 5350 | + 'placeholder' => __('Select Template Part...', 'ayecode-connect'), |
|
| 5351 | 5351 | 'class' => 'bsvc_tmpl_part_n form-select-sm no-select2 mw-100', |
| 5352 | 5352 | 'options' => sd_template_part_options(), |
| 5353 | 5353 | 'default' => '', |
@@ -5365,8 +5365,8 @@ discard block |
||
| 5365 | 5365 | array( |
| 5366 | 5366 | 'id' => 'bsvc_message_type_n', |
| 5367 | 5367 | 'name' => 'bsvc_message_type_n', |
| 5368 | - 'label' => __( 'Custom Message Type', 'ayecode-connect' ), |
|
| 5369 | - 'placeholder' => __( 'Default (none)', 'ayecode-connect' ), |
|
| 5368 | + 'label' => __('Custom Message Type', 'ayecode-connect'), |
|
| 5369 | + 'placeholder' => __('Default (none)', 'ayecode-connect'), |
|
| 5370 | 5370 | 'class' => 'bsvc_message_type_n form-select-sm no-select2 mw-100', |
| 5371 | 5371 | 'options' => sd_aui_colors(), |
| 5372 | 5372 | 'default' => '', |
@@ -5389,7 +5389,7 @@ discard block |
||
| 5389 | 5389 | 'name' => 'bsvc_message_n', |
| 5390 | 5390 | 'label' => '', |
| 5391 | 5391 | 'class' => 'bsvc_message_n form-control-sm', |
| 5392 | - 'placeholder' => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ), |
|
| 5392 | + 'placeholder' => __('CUSTOM MESSAGE TO SHOW', 'ayecode-connect'), |
|
| 5393 | 5393 | 'label_type' => '', |
| 5394 | 5394 | 'value' => '', |
| 5395 | 5395 | 'form_group_class' => ' ', |
@@ -5411,7 +5411,7 @@ discard block |
||
| 5411 | 5411 | global $shortcode_insert_button_once; |
| 5412 | 5412 | |
| 5413 | 5413 | // Fix conflicts with UpSolution Core in header template edit element. |
| 5414 | - if ( defined( 'US_CORE_DIR' ) && ! empty( $_REQUEST['action'] ) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html' ) { |
|
| 5414 | + if (defined('US_CORE_DIR') && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'us_ajax_hb_get_ebuilder_html') { |
|
| 5415 | 5415 | $shortcode_insert_button_once = true; |
| 5416 | 5416 | } |
| 5417 | 5417 | } |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | * @package GetPaid |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -defined( 'ABSPATH' ) || exit; |
|
| 18 | +defined('ABSPATH') || exit; |
|
| 19 | 19 | |
| 20 | 20 | // Define constants. |
| 21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
| 22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
| 21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
| 22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
| 26 | - define( 'WPINV_VERSION', '2.8.30' ); |
|
| 25 | +if (!defined('WPINV_VERSION')) { |
|
| 26 | + define('WPINV_VERSION', '2.8.30'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // Include the main Invoicing class. |
| 30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
| 31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
| 30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
| 31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | function getpaid() { |
| 41 | 41 | |
| 42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
| 42 | + if (empty($GLOBALS['invoicing'])) { |
|
| 43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @since 2.0.8 |
| 53 | 53 | */ |
| 54 | 54 | function getpaid_deactivation_hook() { |
| 55 | - update_option( 'wpinv_flush_permalinks', 1 ); |
|
| 55 | + update_option('wpinv_flush_permalinks', 1); |
|
| 56 | 56 | } |
| 57 | -register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' ); |
|
| 57 | +register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook'); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @deprecated |
@@ -64,4 +64,4 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Kickstart the plugin. |
| 67 | -add_action( 'plugins_loaded', 'getpaid', 0 ); |
|
| 67 | +add_action('plugins_loaded', 'getpaid', 0); |
|