← All changes
|
vendor/ayecode/wp-super-duper/wp-super-duper.php
+38
-31
1.2.66
→
1.2.77
View file →
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | if ( ! class_exists( 'WP_Super_Duper' ) ) { |
| 7 | 7 | |
| 8 | - define( 'SUPER_DUPER_VER', '1.2.33' ); | |
| 8 | + define( 'SUPER_DUPER_VER', '1.2.37' ); | |
| 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. |
| 12 | 12 | * |
| @@ -290,34 +290,36 @@ | ||
| 290 | 290 | * |
| 291 | 291 | * @return string |
| 292 | 292 | */ |
| 293 | 293 | public static function get_picker( $editor_id = '' ) { |
| 294 | + global $sd_widgets; | |
| 294 | 295 | |
| 295 | - ob_start(); | |
| 296 | + if ( wp_doing_ajax() ) { | |
| 297 | + check_ajax_referer( 'super_duper_picker', '_ajax_nonce' ); | |
| 298 | + } | |
| 299 | + | |
| 296 | 300 | if ( isset( $_POST['editor_id'] ) ) { |
| 297 | - $editor_id = esc_attr( $_POST['editor_id'] ); | |
| 301 | + $editor_id = sanitize_text_field( wp_unslash( $_POST['editor_id'] ) ); | |
| 298 | 302 | } elseif ( isset( $_REQUEST['et_fb'] ) ) { |
| 299 | 303 | $editor_id = 'main_content_content_vb_tiny_mce'; |
| 300 | 304 | } |
| 301 | 305 | |
| 302 | - global $sd_widgets; | |
| 306 | + ksort( $sd_widgets ); | |
| 303 | 307 | |
| 304 | -// print_r($sd_widgets);exit; | |
| 308 | + ob_start(); | |
| 305 | 309 | ?> |
| 306 | - | |
| 307 | 310 | <div class="sd-shortcode-left-wrap"> |
| 308 | 311 | <?php |
| 309 | - ksort( $sd_widgets ); | |
| 310 | - // print_r($sd_widgets);exit; | |
| 311 | 312 | if ( ! empty( $sd_widgets ) ) { |
| 312 | 313 | echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">'; |
| 313 | 314 | echo "<option>" . __( 'Select shortcode', 'ayecode-connect' ) . "</option>"; |
| 314 | 315 | foreach ( $sd_widgets as $shortcode => $class ) { |
| 315 | - if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; } | |
| 316 | - echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>"; | |
| 316 | + if ( ! empty( $class['output_types'] ) && ! in_array( 'shortcode', $class['output_types'] ) ) { | |
| 317 | + continue; | |
| 318 | + } | |
| 319 | + echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_html( $shortcode ) . " (" . esc_html( $class['name'] ) . ")</option>"; | |
| 317 | 320 | } |
| 318 | 321 | echo "</select>"; |
| 319 | - | |
| 320 | 322 | } |
| 321 | 323 | ?> |
| 322 | 324 | <div class="sd-shortcode-settings"></div> |
| 323 | 325 | </div> |
| @@ -324,11 +326,11 @@ | ||
| 324 | 326 | <div class="sd-shortcode-right-wrap"> |
| 325 | 327 | <textarea id='sd-shortcode-output' disabled></textarea> |
| 326 | 328 | <div id='sd-shortcode-output-actions'> |
| 327 | 329 | <?php if ( $editor_id != '' ) { ?> |
| 328 | - <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> | |
| 330 | + <button class="button sd-insert-shortcode-button" onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) { echo "'" . esc_js( $editor_id ) . "'"; } ?>)"><?php esc_html_e( 'Insert Shortcode', 'ayecode-connect' ); ?></button> | |
| 329 | 331 | <?php } ?> |
| 330 | - <button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e( 'Copy shortcode' ); ?></button> | |
| 332 | + <button class="button" onclick="sd_copy_to_clipboard()"><?php esc_html_e( 'Copy Shortcode', 'ayecode-connect' ); ?></button> | |
| 331 | 333 | </div> |
| 332 | 334 | </div> |
| 333 | 335 | <?php |
| 334 | 336 | $html = ob_get_clean(); |
| @@ -388,9 +390,9 @@ | ||
| 388 | 390 | */ |
| 389 | 391 | public static function get_widget_settings() { |
| 390 | 392 | global $sd_widgets; |
| 391 | 393 | |
| 392 | - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; | |
| 394 | + $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( wp_unslash( $_REQUEST['shortcode'] ) ) : ''; | |
| 393 | 395 | if ( ! $shortcode ) { |
| 394 | 396 | wp_die(); |
| 395 | 397 | } |
| 396 | 398 | $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; |
| @@ -407,9 +409,9 @@ | ||
| 407 | 409 | |
| 408 | 410 | ob_start(); |
| 409 | 411 | $widget->form( array() ); |
| 410 | 412 | $form = ob_get_clean(); |
| 411 | - echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>"; | |
| 413 | + echo "<form id='" . esc_attr( $shortcode ) . "'>" . $form . "<div class=\"widget-control-save\"></div></form>"; | |
| 412 | 414 | echo "<style>" . $widget->widget_css() . "</style>"; |
| 413 | 415 | echo "<script>" . $widget->widget_js() . "</script>"; |
| 414 | 416 | ?> |
| 415 | 417 | <?php |
| @@ -595,9 +597,10 @@ | ||
| 595 | 597 | ?> |
| 596 | 598 | <style> |
| 597 | 599 | .sd-shortcode-left-wrap { |
| 598 | 600 | float: left; |
| 599 | - width: 60%; | |
| 601 | + width: calc(60% - .75rem); | |
| 602 | + padding-top: .75rem; | |
| 600 | 603 | } |
| 601 | 604 | |
| 602 | 605 | .sd-shortcode-left-wrap .gd-help-tip { |
| 603 | 606 | float: none; |
| @@ -690,9 +693,10 @@ | ||
| 690 | 693 | } |
| 691 | 694 | |
| 692 | 695 | .sd-shortcode-right-wrap { |
| 693 | 696 | float: right; |
| 694 | - width: 35%; | |
| 697 | + width: 40%; | |
| 698 | + padding-top: .75rem; | |
| 695 | 699 | } |
| 696 | 700 | |
| 697 | 701 | #sd-shortcode-output { |
| 698 | 702 | background: rgba(255, 255, 255, .5); |
| @@ -702,13 +706,11 @@ | ||
| 702 | 706 | overflow: auto; |
| 703 | 707 | padding: 2px 6px; |
| 704 | 708 | line-height: 1.4; |
| 705 | 709 | resize: vertical; |
| 706 | - } | |
| 707 | - | |
| 708 | - #sd-shortcode-output { | |
| 709 | 710 | height: 250px; |
| 710 | 711 | width: 100%; |
| 712 | + margin-bottom: .75rem; | |
| 711 | 713 | } |
| 712 | 714 | |
| 713 | 715 | <?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?> |
| 714 | 716 | .generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter { |
| @@ -1205,9 +1207,9 @@ | ||
| 1205 | 1207 | } else { |
| 1206 | 1208 | jQuery($this).data('sd-widget-enabled', true); |
| 1207 | 1209 | } |
| 1208 | 1210 | |
| 1209 | - 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>'; | |
| 1211 | + var $button = '<button title="<?php esc_attr_e( 'Advanced Settings', 'ayecode-connect' );?>" style="line-height:1.5rem;margin:.5rem 0 0 0!important;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width:1.5rem;font-size:1.5rem;height:1.5rem;line-height:1.5rem;margin:0;padding:0"></span></button>'; | |
| 1210 | 1212 | var form = $form ? $form : jQuery($this).parents('' + $selector + ''); |
| 1211 | 1213 | |
| 1212 | 1214 | if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { |
| 1213 | 1215 | console.log('add advanced button'); |
| @@ -1799,12 +1801,17 @@ | ||
| 1799 | 1801 | * @since 1.1.0 Font Awesome classes can be used for icons. |
| 1800 | 1802 | * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap. |
| 1801 | 1803 | */ |
| 1802 | 1804 | public function block() { |
| 1803 | - global $sd_is_js_functions_loaded, $aui_bs5; | |
| 1805 | + global $wp_version, $sd_is_js_functions_loaded, $aui_bs5; | |
| 1804 | 1806 | |
| 1805 | - $show_advanced = $this->block_show_advanced(); | |
| 1807 | + $show_advanced = $this->block_show_advanced(); | |
| 1808 | + $block_api_version = version_compare( $wp_version, '6.9', '>=' ) ? 3 : 2; // Block apiVersion | |
| 1806 | 1809 | |
| 1810 | + if ( isset( $this->options['block-api-version'] ) && absint( $this->options['block-api-version'] ) > 0 ) { | |
| 1811 | + $block_api_version = absint( $this->options['block-api-version'] ); | |
| 1812 | + } | |
| 1813 | + | |
| 1807 | 1814 | ob_start(); |
| 1808 | 1815 | ?> |
| 1809 | 1816 | <script> |
| 1810 | 1817 | <?php |
| @@ -2564,9 +2571,9 @@ | ||
| 2564 | 2571 | * @return {?WPBlock} The block, if it has been successfully |
| 2565 | 2572 | * registered; otherwise `undefined`. |
| 2566 | 2573 | */ |
| 2567 | 2574 | 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. |
| 2568 | - apiVersion: <?php echo isset($this->options['block-api-version']) ? absint($this->options['block-api-version']) : 2 ; ?>, | |
| 2575 | + apiVersion: <?php echo absint( $block_api_version ); ?>, | |
| 2569 | 2576 | title: '<?php echo addslashes( $this->options['name'] ); ?>', // Block title. |
| 2570 | 2577 | description: '<?php echo addslashes( $this->options['widget_ops']['description'] )?>', // Block title. |
| 2571 | 2578 | 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/. |
| 2572 | 2579 | supports: { |
| @@ -3138,9 +3145,9 @@ | ||
| 3138 | 3145 | |
| 3139 | 3146 | if ( $show_advanced ) { |
| 3140 | 3147 | ?> |
| 3141 | 3148 | el('div', { |
| 3142 | - style: {'padding-left': '16px','padding-right': '16px'} | |
| 3149 | + style: {'paddingLeft': '16px','paddingRight': '16px'} | |
| 3143 | 3150 | }, |
| 3144 | 3151 | el( |
| 3145 | 3152 | wp.components.ToggleControl, |
| 3146 | 3153 | { |
| @@ -5052,13 +5059,13 @@ | ||
| 5052 | 5059 | |
| 5053 | 5060 | /** |
| 5054 | 5061 | * Encode shortcodes tags. |
| 5055 | 5062 | * |
| 5063 | + * @since 1.0.28 | |
| 5064 | + * | |
| 5056 | 5065 | * @param string $content Content to search for shortcode tags. |
| 5057 | 5066 | * |
| 5058 | -*@return string Content with shortcode tags removed. | |
| 5059 | - *@since 1.0.28 | |
| 5060 | - * | |
| 5067 | + * @return string Content with shortcode tags removed. | |
| 5061 | 5068 | */ |
| 5062 | 5069 | public function encode_shortcodes( $content ) { |
| 5063 | 5070 | // Avoids existing encoded tags. |
| 5064 | 5071 | $trans = array( |
| @@ -5090,13 +5097,13 @@ | ||
| 5090 | 5097 | |
| 5091 | 5098 | /** |
| 5092 | 5099 | * Remove encoded shortcod tags. |
| 5093 | 5100 | * |
| 5101 | + * @since 1.0.28 | |
| 5102 | + * | |
| 5094 | 5103 | * @param string $content Content to search for shortcode tags. |
| 5095 | 5104 | * |
| 5096 | -*@return string Content with decoded shortcode tags. | |
| 5097 | - *@since 1.0.28 | |
| 5098 | - * | |
| 5105 | + * @return string Content with decoded shortcode tags. | |
| 5099 | 5106 | */ |
| 5100 | 5107 | public function decode_shortcodes( $content ) { |
| 5101 | 5108 | $trans = array( |
| 5102 | 5109 | '[' => '[', |