diff --git a/includes/class-geodir-ajax.php b/includes/class-geodir-ajax.php index 8d1970f3..d1cffb8e 100644 --- a/includes/class-geodir-ajax.php +++ b/includes/class-geodir-ajax.php @@ -171,7 +171,7 @@ private static function gd_ajax_headers() { * @since 2.0.0 */ public static function manual_map() { - global $geodirectory, $mapzoom, $geodir_manual_map; + global $geodirectory, $mapzoom, $geodir_manual_map,$aui_bs5; $prefix = isset( $_POST['trigger'] ) ? sanitize_title( geodir_clean( $_POST['trigger'] ) ) : 'geodir_manual_location_'; $prefix = esc_attr( $prefix ); @@ -233,7 +233,7 @@ public static function manual_map() { if( $design_style ) { ?>
- +
Listings additional css class(es) attribute is not working - FIXED +* Near me manual popup for setting location cancel button not working with BS5 styles - FIXED = GeoDirectory v2.3.49 - 2024-04-15 = * Extra sanitization for shortcode tag selectors, contributor+ user with details template access could potentially output JS code - FIXED/SECURITY diff --git a/vendor/autoload.php b/vendor/autoload.php index b6895964..e1e44182 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -2,6 +2,24 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); +} + require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit3225cff1a6fbcb5c09d8a0b088568404::getLoader(); diff --git a/vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php b/vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php index 206cb114..6b45fd99 100644 --- a/vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php +++ b/vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php @@ -15,7 +15,7 @@ */ add_action('after_setup_theme', function () { global $ayecode_ui_version,$ayecode_ui_file_key; - $this_version = "0.2.11"; + $this_version = "0.2.12"; if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){ $ayecode_ui_version = $this_version ; $ayecode_ui_file_key = wp_hash( __FILE__ ); diff --git a/vendor/ayecode/wp-ayecode-ui/change-log.txt b/vendor/ayecode/wp-ayecode-ui/change-log.txt index 7357386f..0f418e18 100644 --- a/vendor/ayecode/wp-ayecode-ui/change-log.txt +++ b/vendor/ayecode/wp-ayecode-ui/change-log.txt @@ -1,3 +1,6 @@ += 0.2.12 - 2024-04-25 = +* Enhance BS4 to BS5 class replacements - CHANGED + = 0.2.11 - 2024-04-11 = * .link-* classes not respecting editor color change - FIXED diff --git a/vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php b/vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php index 77efa749..881d7242 100644 --- a/vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php +++ b/vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php @@ -35,7 +35,7 @@ class AyeCode_UI_Settings { * * @var string */ - public $version = '0.2.11'; + public $version = '0.2.12'; /** * Class textdomain. diff --git a/vendor/ayecode/wp-ayecode-ui/includes/inc/bs-conversion.php b/vendor/ayecode/wp-ayecode-ui/includes/inc/bs-conversion.php index 3bd13569..fc940651 100644 --- a/vendor/ayecode/wp-ayecode-ui/includes/inc/bs-conversion.php +++ b/vendor/ayecode/wp-ayecode-ui/includes/inc/bs-conversion.php @@ -17,13 +17,24 @@ function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' global $aui_bs5; if ( $aui_bs5 ) { - $convert = array( - 'ml-' => 'ms-', - 'mr-' => 'me-', - 'pl-' => 'ps-', - 'pr-' => 'pe-', - ' form-row' => ' row', + '"ml-' => '"ms-', + '"mr-' => '"me-', + '"pl-' => '"ps-', + '"pr-' => '"pe-', + "'ml-" => "'ms-", + "'mr-" => "'me-", + "'pl-" => "'ps-", + "'pr-" => "'pe-", + ' ml-' => ' ms-', + ' mr-' => ' me-', + ' pl-' => ' ps-', + ' pr-' => ' pe-', + '.ml-' => '.ms-', + '.mr-' => '.me-', + '.pl-' => '.ps-', + '.pr-' => '.pe-', + ' form-row' => ' row', ' embed-responsive-item' => '', ' embed-responsive' => ' ratio', '-1by1' => '-1x1', diff --git a/vendor/ayecode/wp-super-duper/change-log.txt b/vendor/ayecode/wp-super-duper/change-log.txt index af0e983a..6b6f5f5e 100644 --- a/vendor/ayecode/wp-super-duper/change-log.txt +++ b/vendor/ayecode/wp-super-duper/change-log.txt @@ -1,3 +1,10 @@ += 1.1.39 - 2024-04-18 = +* Better block recovery - UPDATED + += 1.1.38 - 2024-04-16 = +* Escape shortcode param names - ADDED +* Better block recovery - UPDATED + = 1.1.37 - 2024-04-11 = * Font size option as inherit could output a 0 as a class - FIXED * Block rename functionality removed by default and added back with new function metadata_name = sd_get_custom_name_input() - CHANGED diff --git a/vendor/ayecode/wp-super-duper/wp-super-duper.php b/vendor/ayecode/wp-super-duper/wp-super-duper.php old mode 100755 new mode 100644 index f1903056..8c41a213 --- a/vendor/ayecode/wp-super-duper/wp-super-duper.php +++ b/vendor/ayecode/wp-super-duper/wp-super-duper.php @@ -1,60 +1,60 @@ $options['name'], - 'class_name' => $options['class_name'], - 'output_types' => !empty($options['output_types']) ? $options['output_types'] : array() - ); - $this->base_id = $options['base_id']; - // lets filter the options before we do anything - $options = apply_filters( "wp_super_duper_options", $options ); - $options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options ); - $options = $this->add_name_from_key( $options ); - $this->options = $options; - - $this->base_id = $options['base_id']; - $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array(); + define( 'SUPER_DUPER_VER', '1.1.39' ); + + /** + * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress. + * + * Should not be called direct but extended instead. + * + * Class WP_Super_Duper + * @since 1.0.16 change log moved to file change-log.txt - CHANGED + * @ver 1.1.1 + */ + class WP_Super_Duper extends WP_Widget { + + public $version = SUPER_DUPER_VER; + public $font_awesome_icon_version = "5.11.2"; + public $block_code; + public $options; + public $base_id; + public $settings_hash; + public $arguments = array(); + public $instance = array(); + private $class_name; + + /** + * The relative url to the current folder. + * + * @var string + */ + public $url = ''; + + /** + * Take the array options and use them to build. + */ + public function __construct( $options ) { + global $sd_widgets; + + $sd_widgets[ $options['base_id'] ] = array( + 'name' => $options['name'], + 'class_name' => $options['class_name'], + 'output_types' => !empty($options['output_types']) ? $options['output_types'] : array() + ); + $this->base_id = $options['base_id']; + // lets filter the options before we do anything + $options = apply_filters( "wp_super_duper_options", $options ); + $options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options ); + $options = $this->add_name_from_key( $options ); + $this->options = $options; + + $this->base_id = $options['base_id']; + $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array(); // nested blocks can't work as a widget if(!empty($this->options['nested-block'])){ @@ -65,3409 +65,3402 @@ public function __construct( $options ) { } } - // init parent - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ + // init parent + if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] ); - } + } - if ( isset( $options['class_name'] ) ) { - // register widget - $this->class_name = $options['class_name']; + if ( isset( $options['class_name'] ) ) { + // register widget + $this->class_name = $options['class_name']; - // register shortcode, this needs to be done even for blocks and widgets + // register shortcode, this needs to be done even for blocks and widgets $this->register_shortcode(); - // Fusion Builder (avada) support - if ( function_exists( 'fusion_builder_map' ) ) { - add_action( 'init', array( $this, 'register_fusion_element' ) ); - } + // Fusion Builder (avada) support + if ( function_exists( 'fusion_builder_map' ) ) { + add_action( 'init', array( $this, 'register_fusion_element' ) ); + } - // register block - if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){ - add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) ); + // register block + if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){ + add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) ); } - } - - // add the CSS and JS we need ONCE - global $sd_widget_scripts; - - if ( ! $sd_widget_scripts ) { - wp_add_inline_script( 'admin-widgets', $this->widget_js() ); - wp_add_inline_script( 'customize-controls', $this->widget_js() ); - wp_add_inline_style( 'widgets', $this->widget_css() ); - - // maybe add elementor editor styles - add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) ); - - $sd_widget_scripts = true; - - // add shortcode insert button once - add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) ); - // generatepress theme sections compatibility - if ( function_exists( 'generate_sections_sections_metabox' ) ) { - add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) ); - } - /* Load script on Divi theme builder page */ - if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) { - add_thickbox(); - add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) ); - } - - if ( $this->is_preview() ) { - add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) ); - // this makes the insert button work for elementor - add_action( 'elementor/editor/after_enqueue_scripts', array( - $this, - 'shortcode_insert_button_script' - ) ); // for elementor - } - // this makes the insert button work for cornerstone - add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) ); - - add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) ); - add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) ); - - // add generator text to head - add_action( 'admin_head', array( $this, 'generator' ), 99 ); - add_action( 'wp_head', array( $this, 'generator' ), 99 ); - } - - do_action( 'wp_super_duper_widget_init', $options, $this ); - } + } - /** - * The register widget function - * @return void - */ - public function _register() { - if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){ - parent::_register(); - } - } - - /** - * Add our widget CSS to elementor editor. - */ - public function elementor_editor_styles() { - wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) ); - } - - public function register_fusion_element() { - - $options = $this->options; - - if ( $this->base_id ) { - - $params = $this->get_fusion_params(); - - $args = array( - 'name' => $options['name'], - 'shortcode' => $this->base_id, - 'icon' => $options['block-icon'] ? $options['block-icon'] : 'far fa-square', - 'allow_generator' => true, - ); - - if ( ! empty( $params ) ) { - $args['params'] = $params; - } - - fusion_builder_map( $args ); - } - - } - - public function get_fusion_params() { - $params = array(); - $arguments = $this->get_arguments(); - - if ( ! empty( $arguments ) ) { - foreach ( $arguments as $key => $val ) { - $param = array(); - // type - $param['type'] = str_replace( - array( - "text", - "number", - "email", - "color", - "checkbox" - ), - array( - "textfield", - "textfield", - "textfield", - "colorpicker", - "select", - - ), - $val['type'] ); - - // multiselect - if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) { - $param['type'] = 'multiple_select'; - $param['multiple'] = true; - } - - // heading - $param['heading'] = isset( $val['title'] ) ? $val['title'] : ''; - - // description - $param['description'] = isset( $val['desc'] ) ? $val['desc'] : ''; - - // param_name - $param['param_name'] = $key; - - // Default - $param['default'] = isset( $val['default'] ) ? $val['default'] : ''; - - // Group - if ( isset( $val['group'] ) ) { - $param['group'] = $val['group']; - } - - // value - if ( $val['type'] == 'checkbox' ) { - if ( isset( $val['default'] ) && $val['default'] == '0' ) { - unset( $param['default'] ); - } - $param['value'] = array( '0' => __( "No", 'ayecode-connect' ), '1' => __( "Yes", 'ayecode-connect' ) ); - } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) { - $param['value'] = isset( $val['options'] ) ? $val['options'] : array(); - } else { - $param['value'] = isset( $val['default'] ) ? $val['default'] : ''; - } - - // setup the param - $params[] = $param; - - } - } - - - return $params; - } - - /** - * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder - */ - public static function maybe_cornerstone_builder() { - if ( did_action( 'cornerstone_before_boot_app' ) ) { - self::shortcode_insert_button_script(); - } - } - - /** - * A function to ge the shortcode builder picker html. - * - * @param string $editor_id - * - * @return string - */ - public static function get_picker( $editor_id = '' ) { - - ob_start(); - if ( isset( $_POST['editor_id'] ) ) { - $editor_id = esc_attr( $_POST['editor_id'] ); - } elseif ( isset( $_REQUEST['et_fb'] ) ) { - $editor_id = 'main_content_content_vb_tiny_mce'; - } - - global $sd_widgets; + // add the CSS and JS we need ONCE + global $sd_widget_scripts; -// print_r($sd_widgets);exit; - ?> - -
- '; - echo ""; - foreach ( $sd_widgets as $shortcode => $class ) { - if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; } - echo ""; - } - echo ""; - - } - ?> -
- -
- -
- -
- - - - -
-
- version ) . '"' . ( ! empty( $source[0] ) ? ' data-sd-source="' . esc_attr( $source[0] ) . '"' : '' ) . ' />'; - } - - /** - * Get widget settings. - * - * @since 1.0.0 - */ - public static function get_widget_settings() { - global $sd_widgets; - - $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : ''; - if ( ! $shortcode ) { - wp_die(); - } - $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : ''; - if ( ! $widget_args ) { - wp_die(); - } - $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : ''; - if ( ! $class_name ) { - wp_die(); - } - - // invoke an instance method - $widget = new $class_name; - - ob_start(); - $widget->form( array() ); - $form = ob_get_clean(); - echo "
" . $form . "
"; - echo ""; - echo ""; - ?> - '; - } - - echo self::shortcode_button( 'this', 'true' ); - - // see opening note - if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { - echo ''; // end #insert-media-button - } - - // Add separate script for generatepress theme sections - if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { - } else { - self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); - } - - $shortcode_insert_button_once = true; - } - - /** - * Gets the shortcode insert button html. - * - * @param string $id - * @param string $search_for_id - * - * @return mixed - */ - public static function shortcode_button( $id = '', $search_for_id = '' ) { - ob_start(); - ?> - - );" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed" - class="thickbox button super-duper-content-open" title="Add Shortcode"> - - - - - - - - tags for code highlighting, so we strip them from the output. - */ - - return str_replace( array( - '' - ), '', $output ); - } - - /** - * Output the JS and CSS for the shortcode insert button. - * - * @param string $editor_id - * @param string $insert_shortcode_function - * - *@since 1.0.6 - * - */ - public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { - ?> - - " . self::siteorigin_js() . ""; - } - ?> - - - - tags for code highlighting, so we strip them from the output. - */ - - return str_replace( array( - '' - ), '', $output ); - } - - /** - * Gets some JS for the widgets screen. - * - * @return mixed - */ - public function widget_js() { - ob_start(); - ?> - - tags for code highlighting, so we strip them from the output. - */ - - return str_replace( array( - '' - ), '', $output ); - } - - - /** - * Set the name from the argument key. - * - * @param $options - * - * @return mixed - */ - private function add_name_from_key( $options, $arguments = false ) { - if ( ! empty( $options['arguments'] ) ) { - foreach ( $options['arguments'] as $key => $val ) { - $options['arguments'][ $key ]['name'] = $key; - } - } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { - foreach ( $options as $key => $val ) { - $options[ $key ]['name'] = $key; - } - } - - return $options; - } - - /** - * Register the parent shortcode. - * - * @since 1.0.0 - */ - public function register_shortcode() { - add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) ); - add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) ); - } - - /** - * Render the shortcode via ajax so we can return it to Gutenberg. - * - * @since 1.0.0 - */ - public function render_shortcode() { - check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); - if ( ! current_user_can( 'manage_options' ) ) { - wp_die(); - } - - // we might need the $post value here so lets set it. - if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) { - $post_obj = get_post( absint( $_POST['post_id'] ) ); - if ( ! empty( $post_obj ) && empty( $post ) ) { - global $post; - $post = $post_obj; - } - } - - if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { - $is_preview = $this->is_preview(); - $shortcode_name = sanitize_title_with_dashes( $_POST['shortcode'] ); - $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array(); - $attributes = ''; - if ( ! empty( $attributes_array ) ) { - foreach ( $attributes_array as $key => $value ) { - if ( is_array( $value ) ) { - $value = implode( ",", $value ); - } - - if ( ! empty( $value ) ) { - $value = wp_unslash( $value ); - - // Encode [ and ]. - if ( $is_preview ) { - $value = $this->encode_shortcodes( $value ); - } - } - $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' "; - } - } - - $shortcode = "[" . $shortcode_name . " " . $attributes . "]"; - - $content = do_shortcode( $shortcode ); - - // Decode [ and ]. - if ( ! empty( $content ) && $is_preview ) { - $content = $this->decode_shortcodes( $content ); - } - - echo $content; - } - wp_die(); - } - - /** - * Output the shortcode. - * - * @param array $args - * @param string $content - * - * @return string - */ - public function shortcode_output( $args = array(), $content = '' ) { - $_instance = $args; - - $args = $this->argument_values( $args ); - - // add extra argument so we know its a output to gutenberg - //$args - $args = $this->string_to_bool( $args ); - - // if we have a enclosed shortcode we add it to the special `html` argument - if ( ! empty( $content ) ) { - $args['html'] = $content; - } - - if ( ! $this->is_preview() ) { - /** - * Filters the settings for a particular widget args. - * - * @param array $args The current widget instance's settings. - * @param WP_Super_Duper $widget The current widget settings. - * @param array $_instance An array of default widget arguments. - * - *@since 1.0.28 - * - */ - $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance ); - - if ( ! is_array( $args ) ) { - return $args; - } - } - - $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; - $class .= " sdel-".$this->get_instance_hash(); - - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); - - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); - - $shortcode_args = array(); - $output = ''; - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; - if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) { - $no_wrap = true; - } - $main_content = $this->output( $args, $shortcode_args, $content ); - if ( $main_content && ! $no_wrap ) { - // wrap the shortcode in a div with the same class as the widget - $output .= '
'; - if ( ! empty( $args['title'] ) ) { - // if its a shortcode and there is a title try to grab the title wrappers - $shortcode_args = array( 'before_title' => '', 'after_title' => '' ); - if ( empty( $instance ) ) { - global $wp_registered_sidebars; - if ( ! empty( $wp_registered_sidebars ) ) { - foreach ( $wp_registered_sidebars as $sidebar ) { - if ( ! empty( $sidebar['before_title'] ) ) { - $shortcode_args['before_title'] = $sidebar['before_title']; - $shortcode_args['after_title'] = $sidebar['after_title']; - break; - } - } - } - } - $output .= $this->output_title( $shortcode_args, $args ); - } - $output .= $main_content; - $output .= '
'; - } elseif ( $main_content && $no_wrap ) { - $output .= $main_content; - } - - // if preview show a placeholder if empty - if ( $this->is_preview() && $output == '' ) { - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); - } - - return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); - } - - /** - * Placeholder text to show if output is empty and we are on a preview/builder page. - * - * @param string $name - * - * @return string - */ - public function preview_placeholder_text( $name = '' ) { - return "
" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "
"; - } - - /** - * Sometimes booleans values can be turned to strings, so we fix that. - * - * @param $options - * - * @return mixed - */ - public function string_to_bool( $options ) { - // convert bool strings to booleans - foreach ( $options as $key => $val ) { - if ( $val == 'false' ) { - $options[ $key ] = false; - } elseif ( $val == 'true' ) { - $options[ $key ] = true; - } - } - - return $options; - } - - /** - * Get the argument values that are also filterable. - * - * @param $instance - * - * @return array - *@since 1.0.12 Don't set checkbox default value if the value is empty. - * - */ - public function argument_values( $instance ) { - $argument_values = array(); - - // set widget instance - $this->instance = $instance; - - if ( empty( $this->arguments ) ) { - $this->arguments = $this->get_arguments(); - } - - if ( ! empty( $this->arguments ) ) { - foreach ( $this->arguments as $key => $args ) { - // set the input name from the key - $args['name'] = $key; - // - $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; - if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) { - // don't set default for an empty checkbox - } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { - $argument_values[ $key ] = $args['default']; - } - } - } - - return $argument_values; - } - - /** - * Set arguments in super duper. - * - * @return array Set arguments. - *@since 1.0.0 - * - */ - public function set_arguments() { - return $this->arguments; - } - - /** - * Get arguments in super duper. - * - * @return array Get arguments. - *@since 1.0.0 - * - */ - public function get_arguments() { - if ( empty( $this->arguments ) ) { - $this->arguments = $this->set_arguments(); - } - - $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance ); - $this->arguments = $this->add_name_from_key( $this->arguments, true ); - - return $this->arguments; - } - - /** - * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class. - * - * @param array $args - * @param array $widget_args - * @param string $content - */ - public function output( $args = array(), $widget_args = array(), $content = '' ) { - - } - - /** - * Add the dynamic block code inline when the wp-block in enqueued. - */ - public function register_block() { - wp_add_inline_script( 'wp-blocks', $this->block() ); - if ( class_exists( 'SiteOrigin_Panels' ) ) { - wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() ); - } - } - - /** - * Check if we need to show advanced options. - * - * @return bool - */ - public function block_show_advanced() { - - $show = false; - $arguments = $this->get_arguments(); - - if ( ! empty( $arguments ) ) { - foreach ( $arguments as $argument ) { - if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { - $show = true; - break; // no need to continue if we know we have it - } - } - } - - return $show; - } - - /** - * Get the url path to the current folder. - * - * @return string - */ - public function get_url() { - $url = $this->url; - - if ( ! $url ) { - $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); - $content_url = untrailingslashit( WP_CONTENT_URL ); - - // Replace http:// to https://. - if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { - $content_url = str_replace( 'http://', 'https://', $content_url ); - } - - // Check if we are inside a plugin - $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); - $url = str_replace( $content_dir, $content_url, $file_dir ); - $url = trailingslashit( $url ); - $this->url = $url; - } - - return $url; - } - - /** - * Get the url path to the current folder. - * - * @return string - */ - public function get_url_old() { - - $url = $this->url; - - if ( ! $url ) { - // check if we are inside a plugin - $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) ); - - $dir_parts = explode( "/wp-content/", $file_dir ); - $url_parts = explode( "/wp-content/", plugins_url() ); - - if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) { - $url = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] ); - $this->url = $url; - } - } - - - return $url; - } - - /** - * Generate the block icon. - * - * Enables the use of Font Awesome icons. - * - * @note xlink:href is actually deprecated but href is not supported by all so we use both. - * - * @param $icon - * - * @return string - *@since 1.1.0 - */ - public function get_block_icon( $icon ) { - - // check if we have a Font Awesome icon - $fa_type = ''; - if ( substr( $icon, 0, 7 ) === "fas fa-" ) { - $fa_type = 'solid'; - } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) { - $fa_type = 'regular'; - } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) { - $fa_type = 'brands'; - } else { - $icon = "'" . $icon . "'"; - } - - // set the icon if we found one - if ( $fa_type ) { - $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon ); - $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 . "'}))"; - } - - return $icon; - } - - public function group_arguments( $arguments ) { - if ( ! empty( $arguments ) ) { - $temp_arguments = array(); - $general = __( "General", 'ayecode-connect' ); - $add_sections = false; - foreach ( $arguments as $key => $args ) { - if ( isset( $args['group'] ) ) { - $temp_arguments[ $args['group'] ][ $key ] = $args; - $add_sections = true; - } else { - $temp_arguments[ $general ][ $key ] = $args; - } - } - - // only add sections if more than one - if ( $add_sections ) { - $arguments = $temp_arguments; - } - } - - return $arguments; - } - - /** - * Parse used group tabs. - * - * @since 1.1.17 - */ - public function group_block_tabs( $tabs, $arguments ) { - if ( ! empty( $tabs ) && ! empty( $arguments ) ) { - $has_sections = false; - - foreach ( $this->arguments as $key => $args ) { - if ( isset( $args['group'] ) ) { - $has_sections = true; - break; - } - } - - if ( ! $has_sections ) { - return $tabs; - } - - $new_tabs = array(); - - foreach ( $tabs as $tab_key => $tab ) { - $new_groups = array(); - - if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) { - foreach ( $tab['groups'] as $group ) { - if ( isset( $arguments[ $group ] ) ) { - $new_groups[] = $group; - } - } - } - - if ( ! empty( $new_groups ) ) { - $tab['groups'] = $new_groups; - - $new_tabs[ $tab_key ] = $tab; - } - } - - $tabs = $new_tabs; - } - - return $tabs; - } - - /** - * Output the JS for building the dynamic Guntenberg block. - * - * @return mixed - *@since 1.0.9 Save numbers as numbers and not strings. - * @since 1.1.0 Font Awesome classes can be used for icons. - * @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. - */ - public function block() { - global $sd_is_js_functions_loaded, $aui_bs5; - - $show_advanced = $this->block_show_advanced(); - - ob_start(); - ?> - "; + ?> + '; + } - // hover animations - if ( $args['hover_animations'] !== undefined && $args['hover_animations'] ) { $classes.push($args['hover_animations'].toString().replace(',',' ')); } + echo self::shortcode_button( 'this', 'true' ); - // absolute_position - if ( $args['absolute_position'] !== undefined ) { - if ( 'top-left' === $args['absolute_position'] ) { - $classes.push('start-0 top-0'); - } else if ( 'top-center' === $args['absolute_position'] ) { - $classes.push('start-50 top-0 translate-middle'); - } else if ( 'top-right' === $args['absolute_position'] ) { - $classes.push('end-0 top-0'); - } else if ( 'center-left' === $args['absolute_position'] ) { - $classes.push('start-0 bottom-50'); - } else if ( 'center' === $args['absolute_position'] ) { - $classes.push('start-50 top-50 translate-middle'); - } else if ( 'center-right' === $args['absolute_position'] ) { - $classes.push('end-0 top-50'); - } else if ( 'bottom-left' === $args['absolute_position'] ) { - $classes.push('start-0 bottom-0'); - } else if ( 'bottom-center' === $args['absolute_position'] ) { - $classes.push('start-50 bottom-0 translate-middle'); - } else if ( 'bottom-right' === $args['absolute_position'] ) { - $classes.push('end-0 bottom-0'); - } - } - - // build classes from build keys - $build_keys = sd_get_class_build_keys(); - if ( $build_keys.length ) { - $build_keys.forEach($key => { - - if($key.endsWith("-MTD")){ - - $k = $key.replace("-MTD",""); - - // Mobile, Tablet, Desktop - if ( $args[$k] !== undefined && $args[$k] !== '' ) { $classes.push( $args[$k] ); $v = $args[$k]; }else{$v = null;} - if ( $args[$k + '_md'] !== undefined && $args[$k + '_md'] !== '' ) { $classes.push( $args[$k + '_md'] ); $v_md = $args[$k + '_md']; }else{$v_md = null;} - if ( $args[$k + '_lg'] !== undefined && $args[$k + '_lg'] !== '' ) { if($v == null && $v_md == null){ $classes.push( $args[$k + '_lg'].replace('-lg','') ); }else{$classes.push( $args[$k + '_lg'] ); } } - - }else{ - if ( $key == 'font_size' && ( $args[ $key ] == 'custom' || $args[ $key ] === '0' ) ) { - return; - } - if ( $args[$key] !== undefined && $args[$key] !== '' ) { $classes.push($args[$key]); } - } - - }); - } + // see opening note + if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) { + echo ''; // end #insert-media-button + } - return $classes.join(" "); + // Add separate script for generatepress theme sections + if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) { + } else { + self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function ); } - function sd_get_class_build_keys(){ - return ; - } + $shortcode_insert_button_once = true; + } + + /** + * Gets the shortcode insert button html. + * + * @param string $id + * @param string $search_for_id + * + * @return mixed + */ + public static function shortcode_button( $id = '', $search_for_id = '' ) { + ob_start(); + ?> + + );" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed" + class="thickbox button super-duper-content-open" title="Add Shortcode"> + + + + + + tags for code highlighting, so we strip them from the output. + */ - // maybe set no_wrap - $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; - if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) { - $no_wrap = true; - } - if ( $no_wrap ) { - $this->options['block-wrap'] = ''; - } - - // maybe load the drag/drop functions. - $img_drag_drop = false; - - $show_alignment = false; - // align feature - /*echo "supports: {"; - echo " align: true,"; - echo " html: false"; - echo "},";*/ - - if ( ! empty( $this->arguments ) ) { - echo "attributes : {"; - - if ( $show_advanced ) { - echo "show_advanced: {"; - echo " type: 'boolean',"; - echo " default: false,"; - echo "},"; - } - - // block wrap element - if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this? - echo "block_wrap: {"; - echo " type: 'string',"; - echo " default: '" . esc_attr( $this->options['block-wrap'] ) . "',"; - echo "},"; - } - - - - foreach ( $this->arguments as $key => $args ) { - - if( $args['type'] == 'image' || $args['type'] == 'images' ){ - $img_drag_drop = true; - } - - // set if we should show alignment - if ( $key == 'alignment' ) { - $show_alignment = true; - } - - $extra = ''; - - if ( $args['type'] == 'notice' || $args['type'] == 'tab' ) { - continue; - } - elseif ( $args['type'] == 'checkbox' ) { - $type = 'boolean'; - $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false'; - } elseif ( $args['type'] == 'number' ) { - $type = 'number'; - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; - } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) { - $type = 'array'; - if ( isset( $args['default'] ) && is_array( $args['default'] ) ) { - $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]"; - } else { - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; - } - } elseif ( $args['type'] == 'tagselect' ) { - $type = 'array'; - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; - } elseif ( $args['type'] == 'multiselect' ) { - $type = 'array'; - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; - } elseif ( $args['type'] == 'image_xy' ) { - $type = 'object'; - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; - } elseif ( $args['type'] == 'image' ) { - $type = 'string'; - $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''"; + return str_replace( array( + '' + ), '', $output ); + } - // add a field for ID -// echo $key . "_id : {"; -// echo "type : 'number',"; -// echo "},"; -// echo $key . "_xy : {"; -// echo "type : 'object',"; -// echo "},"; + /** + * Output the JS and CSS for the shortcode insert button. + * + * @param string $editor_id + * @param string $insert_shortcode_function + * + *@since 1.0.6 + * + */ + public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) { + ?> + + " . self::siteorigin_js() . ""; + } + ?> + + + + - if (attr.hasOwnProperty("")) { - if ('' == 'html') { - $html = attr.; - } else if ('' == 'image_xy') { - content += " ='{x:" + attr..x + ",y:"+attr..y +"}' "; - } else { - content += " ='" + attr..toString().replace('\'',''') + "' "; - } - } - - content += "]"; + /* + * We only add the - tags for code highlighting, so we strip them from the output. - */ + $element_require = $element_require.replace("'", "'"); // replace single quotes + $element_require = $element_require.replace(""", '"'); // replace double quotes - return str_replace( array( - '' - ), '', $output ); - } + if (eval($element_require)) { + jQuery(this).removeClass('sd-require-hide'); + } else { + jQuery(this).addClass('sd-require-hide'); + } + } + }); + } + /** + * Initialise widgets from the widgets screen. + */ + function sd_init_widgets($selector) { + jQuery(".sd-show-advanced").each(function (index) { + sd_init_widget(this, $selector); + }); + } + /** + * Initialise a individual widget. + */ + function sd_init_widget($this, $selector, $form) { + if (!$selector) { + $selector = 'form'; + } + // Only run once. + if (jQuery($this).data('sd-widget-enabled')) { + return; + } else { + jQuery($this).data('sd-widget-enabled', true); + } - public function block_row_start($key, $args){ + var $button = ''; + var form = $form ? $form : jQuery($this).parents('' + $selector + ''); - // check for row - if(!empty($args['row'])){ + if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) { + console.log('add advanced button'); + if (jQuery(form).find('.widget-control-save').length > 0) { + jQuery(form).find('.widget-control-save').after($button); + } else { + jQuery(form).find('.sd-show-advanced').after($button); + } + } else { + console.log('no advanced button, ' + jQuery($this).val() + ', ' + jQuery(form).find('.sd-advanced-button').length); + } - if(!empty($args['row']['open'])){ + /* Show hide on form change */ + jQuery(form).on("change", function() { + sd_show_hide(form); + }); - // element require - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; - $device_type_icon = ''; - if($device_type=='Desktop'){ - $device_type_icon = ''; - }elseif($device_type=='Tablet'){ - $device_type_icon = ''; - }elseif($device_type=='Mobile'){ - $device_type_icon = ''; + /* Show hide on load */ + sd_show_hide(form); } - echo $element_require; - echo $device_type_require; - if(false){?>array_to_attributes( $args['custom_attributes'] ) : ''; - $options = ''; - $extra = ''; - $require = ''; - $inside_elements = ''; - $after_elements = ''; + // init widgets on load + wp.customize.control.each(function (section) { + sd_init_customizer_widget(section); + }); - // `content` is a protected and special argument - if ( $key == 'content' ) { - return; - } + // init widgets on add + wp.customize.control.bind('add', function (section) { + sd_init_customizer_widget(section); + }); - $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; - $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; - $device_type_icon = ''; - if($device_type=='Desktop'){ - $device_type_icon = ''; - }elseif($device_type=='Tablet'){ - $device_type_icon = ''; - }elseif($device_type=='Mobile'){ - $device_type_icon = ''; - } + }); - // icon - $icon = ''; - if( !empty( $args['icon'] ) ){ - $icon .= "el('div', {"; - $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},"; - $icon .= "className: 'text-center',"; - $icon .= "title: '".addslashes( $args['title'] )."',"; - $icon .= "}),"; - - // blank title as its added to the icon. - $args['title'] = ''; - } - - // require advanced - $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : ""; - - // element require - $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; - - - $onchange = "props.setAttributes({ $key: $key } )"; - $onchangecomplete = ""; - $value = "props.attributes.$key"; - $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' ); - if ( in_array( $args['type'], $text_type ) ) { - $type = 'TextControl'; - // Save numbers as numbers and not strings - if ( $args['type'] == 'number' ) { - $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )"; - } - - if (substr($key, 0, 9 ) === 'metadata_') { - $real_key = str_replace('metadata_','', $key ); - $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )"; - $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; - } - } -// else if ( $args['type'] == 'popup' ) { -// $type = 'TextControl'; -// $args['type'] == 'text'; -// $after_elements .= "el( wp.components.Button, { -// className: 'components-button components-circular-option-picker__clear is-primary is-smallx', + } + + + tags for code highlighting, so we strip them from the output. + */ + + return str_replace( array( + '' + ), '', $output ); + } + + + /** + * Set the name from the argument key. + * + * @param $options + * + * @return mixed + */ + private function add_name_from_key( $options, $arguments = false ) { + if ( ! empty( $options['arguments'] ) ) { + foreach ( $options['arguments'] as $key => $val ) { + $options['arguments'][ $key ]['name'] = $key; + } + } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) { + foreach ( $options as $key => $val ) { + $options[ $key ]['name'] = $key; + } + } + + return $options; + } + + /** + * Register the parent shortcode. + * + * @since 1.0.0 + */ + public function register_shortcode() { + add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) ); + add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) ); + } + + /** + * Render the shortcode via ajax so we can return it to Gutenberg. + * + * @since 1.0.0 + */ + public function render_shortcode() { + check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true ); + if ( ! current_user_can( 'manage_options' ) ) { + wp_die(); + } + + // we might need the $post value here so lets set it. + if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) { + $post_obj = get_post( absint( $_POST['post_id'] ) ); + if ( ! empty( $post_obj ) && empty( $post ) ) { + global $post; + $post = $post_obj; + } + } + + if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) { + $is_preview = $this->is_preview(); + $shortcode_name = sanitize_title_with_dashes( $_POST['shortcode'] ); + $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array(); + $attributes = ''; + if ( ! empty( $attributes_array ) ) { + foreach ( $attributes_array as $key => $value ) { + if ( is_array( $value ) ) { + $value = implode( ",", $value ); + } + + if ( ! empty( $value ) ) { + $value = wp_unslash( $value ); + + // Encode [ and ]. + if ( $is_preview ) { + $value = $this->encode_shortcodes( $value ); + } + } + $attributes .= " " . esc_attr( sanitize_title_with_dashes( $key ) ) . "='" . esc_attr( $value ) . "' "; + } + } + + $shortcode = "[" . esc_attr( $shortcode_name ) . " " . $attributes . "]"; + + $content = do_shortcode( $shortcode ); + + // Decode [ and ]. + if ( ! empty( $content ) && $is_preview ) { + $content = $this->decode_shortcodes( $content ); + } + + echo $content; + } + wp_die(); + } + + /** + * Output the shortcode. + * + * @param array $args + * @param string $content + * + * @return string + */ + public function shortcode_output( $args = array(), $content = '' ) { + $_instance = $args; + + $args = $this->argument_values( $args ); + + // add extra argument so we know its a output to gutenberg + //$args + $args = $this->string_to_bool( $args ); + + // if we have a enclosed shortcode we add it to the special `html` argument + if ( ! empty( $content ) ) { + $args['html'] = $content; + } + + if ( ! $this->is_preview() ) { + /** + * Filters the settings for a particular widget args. + * + * @param array $args The current widget instance's settings. + * @param WP_Super_Duper $widget The current widget settings. + * @param array $_instance An array of default widget arguments. + * + *@since 1.0.28 + * + */ + $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance ); + + if ( ! is_array( $args ) ) { + return $args; + } + } + + $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : ''; + $class .= " sdel-".$this->get_instance_hash(); + + $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); + $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); + + $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); + $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); + + $shortcode_args = array(); + $output = ''; + $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false; + if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) { + $no_wrap = true; + } + $main_content = $this->output( $args, $shortcode_args, $content ); + if ( $main_content && ! $no_wrap ) { + // wrap the shortcode in a div with the same class as the widget + $output .= '
'; + if ( ! empty( $args['title'] ) ) { + // if its a shortcode and there is a title try to grab the title wrappers + $shortcode_args = array( 'before_title' => '', 'after_title' => '' ); + if ( empty( $instance ) ) { + global $wp_registered_sidebars; + if ( ! empty( $wp_registered_sidebars ) ) { + foreach ( $wp_registered_sidebars as $sidebar ) { + if ( ! empty( $sidebar['before_title'] ) ) { + $shortcode_args['before_title'] = $sidebar['before_title']; + $shortcode_args['after_title'] = $sidebar['after_title']; + break; + } + } + } + } + $output .= $this->output_title( $shortcode_args, $args ); + } + $output .= $main_content; + $output .= '
'; + } elseif ( $main_content && $no_wrap ) { + $output .= $main_content; + } + + // if preview show a placeholder if empty + if ( $this->is_preview() && $output == '' ) { + $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); + } + + return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this ); + } + + /** + * Placeholder text to show if output is empty and we are on a preview/builder page. + * + * @param string $name + * + * @return string + */ + public function preview_placeholder_text( $name = '' ) { + return "
" . wp_sprintf( __( 'Placeholder for: %s', 'ayecode-connect' ), $name ) . "
"; + } + + /** + * Sometimes booleans values can be turned to strings, so we fix that. + * + * @param $options + * + * @return mixed + */ + public function string_to_bool( $options ) { + // convert bool strings to booleans + foreach ( $options as $key => $val ) { + if ( $val == 'false' ) { + $options[ $key ] = false; + } elseif ( $val == 'true' ) { + $options[ $key ] = true; + } + } + + return $options; + } + + /** + * Get the argument values that are also filterable. + * + * @param $instance + * + * @return array + *@since 1.0.12 Don't set checkbox default value if the value is empty. + * + */ + public function argument_values( $instance ) { + $argument_values = array(); + + // set widget instance + $this->instance = $instance; + + if ( empty( $this->arguments ) ) { + $this->arguments = $this->get_arguments(); + } + + if ( ! empty( $this->arguments ) ) { + foreach ( $this->arguments as $key => $args ) { + // set the input name from the key + $args['name'] = $key; + // + $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : ''; + if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) { + // don't set default for an empty checkbox + } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) { + $argument_values[ $key ] = $args['default']; + } + } + } + + return $argument_values; + } + + /** + * Set arguments in super duper. + * + * @return array Set arguments. + *@since 1.0.0 + * + */ + public function set_arguments() { + return $this->arguments; + } + + /** + * Get arguments in super duper. + * + * @return array Get arguments. + *@since 1.0.0 + * + */ + public function get_arguments() { + if ( empty( $this->arguments ) ) { + $this->arguments = $this->set_arguments(); + } + + $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance ); + $this->arguments = $this->add_name_from_key( $this->arguments, true ); + + return $this->arguments; + } + + /** + * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class. + * + * @param array $args + * @param array $widget_args + * @param string $content + */ + public function output( $args = array(), $widget_args = array(), $content = '' ) { + + } + + /** + * Add the dynamic block code inline when the wp-block in enqueued. + */ + public function register_block() { + wp_add_inline_script( 'wp-blocks', $this->block() ); + if ( class_exists( 'SiteOrigin_Panels' ) ) { + wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() ); + } + } + + /** + * Check if we need to show advanced options. + * + * @return bool + */ + public function block_show_advanced() { + + $show = false; + $arguments = $this->get_arguments(); + + if ( ! empty( $arguments ) ) { + foreach ( $arguments as $argument ) { + if ( isset( $argument['advanced'] ) && $argument['advanced'] ) { + $show = true; + break; // no need to continue if we know we have it + } + } + } + + return $show; + } + + /** + * Get the url path to the current folder. + * + * @return string + */ + public function get_url() { + $url = $this->url; + + if ( ! $url ) { + $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); + $content_url = untrailingslashit( WP_CONTENT_URL ); + + // Replace http:// to https://. + if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) { + $content_url = str_replace( 'http://', 'https://', $content_url ); + } + + // Check if we are inside a plugin + $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) ); + $url = str_replace( $content_dir, $content_url, $file_dir ); + $url = trailingslashit( $url ); + $this->url = $url; + } + + return $url; + } + + /** + * Get the url path to the current folder. + * + * @return string + */ + public function get_url_old() { + + $url = $this->url; + + if ( ! $url ) { + // check if we are inside a plugin + $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) ); + + $dir_parts = explode( "/wp-content/", $file_dir ); + $url_parts = explode( "/wp-content/", plugins_url() ); + + if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) { + $url = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] ); + $this->url = $url; + } + } + + + return $url; + } + + /** + * Generate the block icon. + * + * Enables the use of Font Awesome icons. + * + * @note xlink:href is actually deprecated but href is not supported by all so we use both. + * + * @param $icon + * + * @return string + *@since 1.1.0 + */ + public function get_block_icon( $icon ) { + + // check if we have a Font Awesome icon + $fa_type = ''; + if ( substr( $icon, 0, 7 ) === "fas fa-" ) { + $fa_type = 'solid'; + } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) { + $fa_type = 'regular'; + } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) { + $fa_type = 'brands'; + } else { + $icon = "'" . $icon . "'"; + } + + // set the icon if we found one + if ( $fa_type ) { + $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon ); + $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 . "'}))"; + } + + return $icon; + } + + public function group_arguments( $arguments ) { + if ( ! empty( $arguments ) ) { + $temp_arguments = array(); + $general = __( "General", 'ayecode-connect' ); + $add_sections = false; + foreach ( $arguments as $key => $args ) { + if ( isset( $args['group'] ) ) { + $temp_arguments[ $args['group'] ][ $key ] = $args; + $add_sections = true; + } else { + $temp_arguments[ $general ][ $key ] = $args; + } + } + + // only add sections if more than one + if ( $add_sections ) { + $arguments = $temp_arguments; + } + } + + return $arguments; + } + + /** + * Parse used group tabs. + * + * @since 1.1.17 + */ + public function group_block_tabs( $tabs, $arguments ) { + if ( ! empty( $tabs ) && ! empty( $arguments ) ) { + $has_sections = false; + + foreach ( $this->arguments as $key => $args ) { + if ( isset( $args['group'] ) ) { + $has_sections = true; + break; + } + } + + if ( ! $has_sections ) { + return $tabs; + } + + $new_tabs = array(); + + foreach ( $tabs as $tab_key => $tab ) { + $new_groups = array(); + + if ( ! empty( $tab['groups'] ) && is_array( $tab['groups'] ) ) { + foreach ( $tab['groups'] as $group ) { + if ( isset( $arguments[ $group ] ) ) { + $new_groups[] = $group; + } + } + } + + if ( ! empty( $new_groups ) ) { + $tab['groups'] = $new_groups; + + $new_tabs[ $tab_key ] = $tab; + } + } + + $tabs = $new_tabs; + } + + return $tabs; + } + + /** + * Output the JS for building the dynamic Guntenberg block. + * + * @return mixed + *@since 1.0.9 Save numbers as numbers and not strings. + * @since 1.1.0 Font Awesome classes can be used for icons. + * @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. + */ + public function block() { + global $sd_is_js_functions_loaded, $aui_bs5; + + $show_advanced = $this->block_show_advanced(); + + ob_start(); + ?> + + tags for code highlighting, so we strip them from the output. + */ + + return str_replace( array( + '' + ), '', $output ); + } + + + + public function block_row_start($key, $args){ + + // check for row + if(!empty($args['row'])){ + + if(!empty($args['row']['open'])){ + + // element require + $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; + $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; + $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; + $device_type_icon = ''; + if($device_type=='Desktop'){ + $device_type_icon = ''; + }elseif($device_type=='Tablet'){ + $device_type_icon = ''; + }elseif($device_type=='Mobile'){ + $device_type_icon = ''; + } + echo $element_require; + echo $device_type_require; + + if(false){?>array_to_attributes( $args['custom_attributes'] ) : ''; + $options = ''; + $extra = ''; + $require = ''; + $inside_elements = ''; + $after_elements = ''; + + // `content` is a protected and special argument + if ( $key == 'content' ) { + return; + } + + $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : ''; + $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : ''; + $device_type_icon = ''; + if($device_type=='Desktop'){ + $device_type_icon = ''; + }elseif($device_type=='Tablet'){ + $device_type_icon = ''; + }elseif($device_type=='Mobile'){ + $device_type_icon = ''; + } + + // icon + $icon = ''; + if( !empty( $args['icon'] ) ){ + $icon .= "el('div', {"; + $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},"; + $icon .= "className: 'text-center',"; + $icon .= "title: '".addslashes( $args['title'] )."',"; + $icon .= "}),"; + + // blank title as its added to the icon. + $args['title'] = ''; + } + + // require advanced + $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : ""; + + // element require + $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : ""; + + + $onchange = "props.setAttributes({ $key: $key } )"; + $onchangecomplete = ""; + $value = "props.attributes.$key"; + $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' ); + if ( in_array( $args['type'], $text_type ) ) { + $type = 'TextControl'; + // Save numbers as numbers and not strings + if ( $args['type'] == 'number' ) { + $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )"; + } + + if (substr($key, 0, 9 ) === 'metadata_') { + $real_key = str_replace('metadata_','', $key ); + $onchange = "props.setAttributes({ metadata: { $real_key: $key } } )"; + $value = "props.attributes.metadata && props.attributes.metadata.$real_key ? props.attributes.metadata.$real_key : ''"; + } + } +// else if ( $args['type'] == 'popup' ) { +// $type = 'TextControl'; +// $args['type'] == 'text'; +// $after_elements .= "el( wp.components.Button, { +// className: 'components-button components-circular-option-picker__clear is-primary is-smallx', // onClick: function(){ // aui_modal('',''); // const source = document.getElementById('zzz'); @@ -3478,1659 +3471,1659 @@ public function build_block_arguments( $key, $args ) { // 'test' // ),"; // -// $value = "props.attributes.$key ? props.attributes.$key : ''"; -// } - else if ( $args['type'] == 'styleid' ) { - $type = 'TextControl'; - $args['type'] == 'text'; - // Save numbers as numbers and not strings - $value = "props.attributes.$key ? props.attributes.$key : ''"; - }else if ( $args['type'] == 'notice' ) { - - $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : ''; - $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info'; - - $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),"; - echo $notice_message ? $element_require . $notice : ''; - return; - } - /* - * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout - elseif($args['type']=='tabs'){ - ?> - el( - wp.components.TabPanel, - { - activeClass: 'active-tab', - initialTabName: deviceType, - tabs: [ - { - name: 'Desktop', - title: el('div', {dangerouslySetInnerHTML: {__html: ''}}), - className: 'tab-one' + deviceType == 'Desktop' ? ' active-tab' : '', - content: el('div', {dangerouslySetInnerHTML: {__html: 'ddd'}}) - }, - { - name: 'Tablet', - title: el('div', {dangerouslySetInnerHTML: {__html: ''}}), - className: 'tab-two' + deviceType == 'Tablet' ? ' active-tab' : '', - content: el('div', {dangerouslySetInnerHTML: {__html: 'ttt'}}) - }, - { - name: 'Mobile', - title: el('div', {dangerouslySetInnerHTML: {__html: ''}}), - className: 'tab-two' + deviceType == 'Mobile' ? ' active-tab' : '', - content: el('div', {dangerouslySetInnerHTML: {__html: 'mmm'}}) - }, - ], - }, - ( tab ) => { +// $value = "props.attributes.$key ? props.attributes.$key : ''"; +// } + else if ( $args['type'] == 'styleid' ) { + $type = 'TextControl'; + $args['type'] == 'text'; + // Save numbers as numbers and not strings + $value = "props.attributes.$key ? props.attributes.$key : ''"; + }else if ( $args['type'] == 'notice' ) { + + $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : ''; + $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info'; + + $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 pe-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),"; + echo $notice_message ? $element_require . $notice : ''; + return; + } + /* + * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout + elseif($args['type']=='tabs'){ + ?> + el( + wp.components.TabPanel, + { + activeClass: 'active-tab', + initialTabName: deviceType, + tabs: [ + { + name: 'Desktop', + title: el('div', {dangerouslySetInnerHTML: {__html: ''}}), + className: 'tab-one' + deviceType == 'Desktop' ? ' active-tab' : '', + content: el('div', {dangerouslySetInnerHTML: {__html: 'ddd'}}) + }, + { + name: 'Tablet', + title: el('div', {dangerouslySetInnerHTML: {__html: ''}}), + className: 'tab-two' + deviceType == 'Tablet' ? ' active-tab' : '', + content: el('div', {dangerouslySetInnerHTML: {__html: 'ttt'}}) + }, + { + name: 'Mobile', + title: el('div', {dangerouslySetInnerHTML: {__html: ''}}), + className: 'tab-two' + deviceType == 'Mobile' ? ' active-tab' : '', + content: el('div', {dangerouslySetInnerHTML: {__html: 'mmm'}}) + }, + ], + }, + ( tab ) => { + +// @todo https://github.com/WordPress/gutenberg/issues/39248 + if(tab.name=='Desktop'){ + wp.data.dispatch('core/edit-post').__experimentalSetPreviewDeviceType('Desktop'); +wp.data.select('core/edit-post').__experimentalGetPreviewDeviceType(); + }else if(tab.name=='Tablet'){ + wp.data.dispatch('core/edit-post').__experimentalSetPreviewDeviceType('Tablet'); +wp.data.select('core/edit-post').__experimentalGetPreviewDeviceType(); + }else if(tab.name=='Mobile'){ + wp.data.dispatch('core/edit-post').__experimentalSetPreviewDeviceType('Mobile'); +wp.data.select('core/edit-post').__experimentalGetPreviewDeviceType(); + } + + return tab.content; + + } + ), + + get_url()."icons/placeholder.png' : props.attributes.$key, + value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy : {x: 0.5,y: 0.5,}, +// value: props.attributes.{$key}_xy, + onChange: function(focalPoint){ + console.log(props.attributes); + return props.setAttributes({ + {$key}_xy: focalPoint + }); + }, + // @todo for some reason this does not work as expected. +// onDrag: function(focalPointTemp){ +// return props.setAttributes({ +// {$key}_xy: focalPointTemp +// }); +// } + + + }), "; + + + $value = '""'; + $type = 'MediaUpload'; + $extra .= "onSelect: function(media){ + return props.setAttributes({ + $key: media.url, + {$key}_id: media.id + }); + },"; + $extra .= "type: 'image',"; + $extra .= "render: function (obj) { + return el( 'div',{}, + ( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, { + className: 'components-button components-circular-option-picker__clear is-primary is-smallx', + onClick: obj.open + }, + 'Upload Image' + ), + $img_preview + props.attributes.$key && el( wp.components.Button, { + className: 'components-button components-circular-option-picker__clear is-secondary is-small', + style: {margin:'8px 0',display: 'block'}, + onClick: function(){ + return props.setAttributes({ + $key: '', + {$key}_id: '' + }); + } + }, + props.attributes.$key? 'Clear' : '' + ) + ) + + + + }"; + $onchange = ""; + + //$inside_elements = ",el('div',{},'file upload')"; + } else if ( $args['type'] == 'images' ) { + $img_preview = "props.attributes.$key && (function() { + let uploads = JSON.parse('['+props.attributes.$key+']'); + let images = []; + uploads.map((upload, index) => ( + images.push( el('div',{ className: 'col p-2', draggable: 'true', 'data-index': index }, + el('img', { + src: (upload.sizes && upload.sizes.thumbnail ? upload.sizes.thumbnail.url : upload.url), + style: { maxWidth:'100%', background: '#ccc', pointerEvents:'none' } + }), + el('i',{ + className: 'fas fa-times-circle text-danger position-absolute ml-n2 mt-n1 bg-white rounded-circle c-pointer', + onClick: function() { + aui_confirm('".esc_attr__('Are you sure?')."', '".esc_attr__('Delete')."', '".esc_attr__('Cancel')."', true).then(function(confirmed) { + if (confirmed) { + let new_uploads = JSON.parse('['+props.attributes.$key+']'); + new_uploads.splice(index, 1); + return props.setAttributes({ {$key}: JSON.stringify( new_uploads ).replace('[','').replace(']','') }); + } + }); + }}, + '') + )) + )); + return images; +})(),"; + + + $value = '""'; + $type = 'MediaUpload'; + $extra .= "onSelect: function(media){ + let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : []; + if(media.length){ + for (var i=0; i < media.length; i++) { + slim_images.push({id: media[i].id, caption: media[i].caption, description: media[i].description,title: media[i].title,alt: media[i].alt,sizes: media[i].sizes, url: media[i].url}); + } + } + var slimImagesV = JSON.stringify(slim_images); + if (slimImagesV) { + slimImagesV = slimImagesV.replace('[','').replace(']','').replace(/'/g, '''); + } + return props.setAttributes({ $key: slimImagesV}); +},"; + $extra .= "type: 'image',"; + $extra .= "multiple: true,"; + $extra .= "render: function (obj) { + /* Init the sort */ + enableDragSort('sd-sortable'); + return el( 'div',{}, + el( wp.components.Button, { + className: 'components-button components-circular-option-picker__clear is-primary is-smallx', + onClick: obj.open + }, + 'Upload Images' + ), + el('div',{ + className: 'row row-cols-3 px-2 sd-sortable', + 'data-field':'$key' + }, + $img_preview + ), + props.attributes.$key && el( wp.components.Button, { + className: 'components-button components-circular-option-picker__clear is-secondary is-small', + style: {margin:'8px 0'}, + onClick: function(){ + return props.setAttributes({ $key: '' }); + } + }, + props.attributes.$key ? 'Clear All' : '' + ) + ) +}"; + $onchange = ""; + + //$inside_elements = ",el('div',{},'file upload')"; + } + elseif ( $args['type'] == 'checkbox' ) { + $type = 'CheckboxControl'; + $extra .= "checked: props.attributes.$key,"; + $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; + } elseif ( $args['type'] == 'textarea' ) { + $type = 'TextareaControl'; + + } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { + $type = 'SelectControl'; + + if($args['name'] == 'category' && !empty($args['post_type_linked'])){ + $options .= "options: taxonomies_".str_replace("-","_", $this->id).","; + }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ + $options .= "options: sort_by_".str_replace("-","_", $this->id).","; + }else { + + if ( ! empty( $args['options'] ) ) { + $options .= "options: ["; + foreach ( $args['options'] as $option_val => $option_label ) { + $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },"; + } + $options .= "],"; + } + } + if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 + $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, '; + } + + if($args['type'] == 'multiselect' || ( isset( $args['multiple'] ) && $args['multiple'] ) ){ + $after_elements .= "props.attributes.$key && el( wp.components.Button, { + className: 'components-button components-circular-option-picker__clear is-secondary is-small', + style: {margin:'-8px 0 8px 0',display: 'block'}, + onClick: function(){ + return props.setAttributes({ + $key: '', + }); + } + }, + 'Clear' + ),"; + } + } elseif ( $args['type'] == 'tagselect' ) { +// $type = 'FormTokenField'; +// +// if ( ! empty( $args['options'] ) ) { +// $options .= "suggestions: ["; +// foreach ( $args['options'] as $option_val => $option_label ) { +// $options .= "{ value: '" . esc_attr( $option_val ) . "', title: '" . addslashes( $option_label ) . "' },"; +//// $options .= "'" . esc_attr( $option_val ) . "':'" . addslashes( $option_label ) . "',"; +// } +// $options .= "],"; +// } +// +// $onchangex = "{ ( selectedItems ) => { +// // Build array of selected posts. +// let selectedPostsArray = []; +// selectedPosts.map( +// ( postName ) => { +// const matchingPost = posts.find( ( post ) => { +// return post.title.raw === postName; +// +// } ); +// if ( matchingPost !== undefined ) { +// selectedPostsArray.push( matchingPost.id ); +// } +// } +// ) +// +// setAttributes( { selectedPosts: selectedPostsArray } ); +// } } "; +// $onchange = '';// "props.setAttributes({ $key: [ props.attributes.$key ] } )"; +// +//// $options = ""; +// $value = "[]"; +// $extra .= ' __experimentalExpandOnFocus: true,'; + + } else if ( $args['type'] == 'alignment' ) { + $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example + } else if ( $args['type'] == 'margins' ) { + + } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) { + $type = 'TextControl'; + $value = "(props.attributes.$key ? props.attributes.$key : '')"; + $args['type'] = 'text'; + $options .= 'disabled:true,'; + $bsvc_title = esc_attr( addslashes( $args['title'] ) ); + $bsvc_body = $this->block_visibility_fields( $args ); + // @TODO reset button + $bsvc_footer = ''; + $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, { + className: 'components-button components-circular-option-picker__clear is-primary is-smallx', + onClick: function() { + var sValue = props.attributes." . $key . "; + var oValue; + try {oValue = JSON.parse(sValue);} catch(err) {} + jQuery(document).off('show.bs.modal', '.bs-vc-modal').on('show.bs.modal', '.bs-vc-modal', function (e) { + if (e.target && jQuery(e.target).hasClass('bs-vc-modal')) { + sd_block_visibility_render_fields(oValue); + if (!jQuery('.bs-vc-modal-form .bs-vc-rule-sets .bs-vc-rule').length) { + jQuery('.bs-vc-modal-form .bs-vc-add-rule').trigger('click'); + } + if(typeof aui_init_select2 == 'function') { + aui_init_select2(); + } + jQuery('.bs-vc-modal-form').trigger('change'); + } + }); + aui_modal('" . $bsvc_title . "', '" . addslashes( $bsvc_body ) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); + jQuery(document).off('change', '#bsvc_raw_value').on('change', '#bsvc_raw_value', function(e) { + props.setAttributes({" . $key . ": e.target.value}); + }); + } + }, + '" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "' + ) ),"; + } else { + return;// if we have not implemented the control then don't break the JS. + } + + // color input does not show the labels so we add them + if($args['type']=='color'){ + // add show only if advanced + echo $require_advanced; + // add setting require if defined + echo $element_require; + echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),"; + } + + // add show only if advanced + echo $require_advanced; + // add setting require if defined + echo $element_require; + echo $device_type_require; + + // icon + echo $icon; + ?> + el( , { + label: el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: ''}}),deviceType == '' && el('span',{dangerouslySetInnerHTML: {__html: ''},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}}))'', + help: , + value: , + + + + + + + + onChange: function ( ) { + + } + + } ), + $val ) { + if(is_array($val)){ + $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},'; + }else{ + $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; + } + } + + } + + return $attributes; + } + + + + /** + * A self looping function to create the output for JS block elements. + * + * This is what is output in the WP Editor visual view. + * + * @param $args + */ + public function block_element( $args, $save = false ) { + + + if ( ! empty( $args ) ) { + foreach ( $args as $element => $new_args ) { + + if ( is_array( $new_args ) ) { // its an element + + + if ( isset( $new_args['element'] ) ) { + + if ( isset( $new_args['element_require'] ) ) { + echo str_replace( array( + "'+", + "+'" + ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; + unset( $new_args['element_require'] ); + } + + if($new_args['element']=='InnerBlocks'){ + echo "\n el( InnerBlocks, {"; + }elseif($new_args['element']=='innerBlocksProps'){ + $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div'; + // echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {"; +// echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; + echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; + echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {"; + echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; + + echo "} ), {"; + echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : ''; + // echo '###'; + + // echo '###'; + }elseif($new_args['element']=='BlocksProps'){ + + if ( isset($new_args['if_inner_element']) ) { + $element = $new_args['if_inner_element']; + }else { + $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'"; + } + + unset($new_args['inner_element']); + echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {"; + echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; + + + // echo "} ),"; + + }else{ + echo "\n el( '" . $new_args['element'] . "', {"; + } + + + // get the attributes + foreach ( $new_args as $new_key => $new_value ) { + + + if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) { + // do nothing + } else { + echo $this->block_element( array( $new_key => $new_value ),$save ); + } + } + + echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes + + // get the content + $first_item = 0; + foreach ( $new_args as $new_key => $new_value ) { + if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) { + + if ( $new_key === 'content' ) { + echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'"; + }else if ( $new_key === 'if_content' ) { + echo $this->block_props_replace( $new_value ); + } + + if ( is_array( $new_value ) ) { + + if ( isset( $new_value['element_require'] ) ) { + echo str_replace( array( + "'+", + "+'" + ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; + unset( $new_value['element_require'] ); + } + + if ( isset( $new_value['element_repeat'] ) ) { + $x = 1; + while ( $x <= absint( $new_value['element_repeat'] ) ) { + $this->block_element( array( '' => $new_value ),$save ); + $x ++; + } + } else { + $this->block_element( array( '' => $new_value ),$save ); + } + } + $first_item ++; + } + } + + if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){ + echo "))";// end content + }else{ + echo ")";// end content + } + + + echo ", \n"; + + } + } else { + + if ( substr( $element, 0, 3 ) === "if_" ) { + $extra = ''; + if( strpos($new_args, '[%WrapClass%]') !== false ){ + $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args); + $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args); + } + echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ","; + } elseif ( $element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false ) { + $new_args = str_replace('[%WrapStyle%]','',$new_args); + echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },"; +// echo $element . ": " . $this->block_props_replace( $new_args ) . ","; + } elseif ( $element == 'style' ) { + echo $element . ": " . $this->block_props_replace( $new_args ) . ","; + } elseif ( ( $element == 'class' || $element == 'className' ) && strpos($new_args, '[%WrapClass%]') !== false ) { + $new_args = str_replace('[%WrapClass%]','',$new_args); + echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),"; + } elseif ( $element == 'template' && $new_args ) { + echo $element . ": $new_args,"; + } else { + echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; + } + + } + } + } + } + + /** + * Replace block attributes placeholders with the proper naming. + * + * @param $string + * + * @return mixed + */ + public function block_props_replace( $string, $no_wrap = false ) { + if ( $no_wrap ) { + $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string ); + } else { + $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string ); + } + + return $string; + } + + /** + * Outputs the content of the widget + * + * @param array $args + * @param array $instance + */ + public function widget( $args, $instance ) { + if ( ! is_array( $args ) ) { + $args = array(); + } + + // Get the filtered values + $argument_values = $this->argument_values( $instance ); + $argument_values = $this->string_to_bool( $argument_values ); + $output = $this->output( $argument_values, $args ); + + $no_wrap = false; + if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) { + $no_wrap = true; + } + + ob_start(); + if ( $output && ! $no_wrap ) { + + $class_original = $this->options['widget_ops']['classname']; + $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash(); + + // Before widget + $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : ''; + $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget; + $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this ); + $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this ); + + // After widget + $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : ''; + $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this ); + $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this ); + + echo $before_widget; + // elementor strips the widget wrapping div so we check for and add it back if needed + if ( $this->is_elementor_widget_output() ) { + // Filter class & attrs for elementor widget output. + $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); + $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); + + $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); + $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); + + echo ""; + } + echo $this->output_title( $args, $instance ); + echo $output; + if ( $this->is_elementor_widget_output() ) { + echo ""; + } + echo $after_widget; + } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty + $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); + echo $output; + } elseif ( $output && $no_wrap ) { + echo $output; + } + $output = ob_get_clean(); + + $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); + + echo $output; + } + + /** + * Tests if the current output is inside a elementor container. + * + * @return bool + *@since 1.0.4 + */ + public function is_elementor_widget_output() { + $result = false; + if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { + $result = true; + } + + return $result; + } + + /** + * Tests if the current output is inside a elementor preview. + * + * @return bool + *@since 1.0.4 + */ + public function is_elementor_preview() { + $result = false; + if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { + $result = true; + } + + return $result; + } + + /** + * Tests if the current output is inside a Divi preview. + * + * @return bool + *@since 1.0.6 + */ + public function is_divi_preview() { + $result = false; + if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { + $result = true; + } + + return $result; + } + + /** + * Tests if the current output is inside a Beaver builder preview. + * + * @return bool + *@since 1.0.6 + */ + public function is_beaver_preview() { + $result = false; + if ( isset( $_REQUEST['fl_builder'] ) ) { + $result = true; + } + + return $result; + } + + /** + * Tests if the current output is inside a siteorigin builder preview. + * + * @return bool + *@since 1.0.6 + */ + public function is_siteorigin_preview() { + $result = false; + if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { + $result = true; + } + + return $result; + } + + /** + * Tests if the current output is inside a cornerstone builder preview. + * + * @return bool + *@since 1.0.8 + */ + public function is_cornerstone_preview() { + $result = false; + if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { + $result = true; + } + + return $result; + } + + /** + * Tests if the current output is inside a fusion builder preview. + * + * @return bool + *@since 1.1.0 + */ + public function is_fusion_preview() { + $result = false; + if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { + $result = true; + } + + return $result; + } + + /** + * Tests if the current output is inside a Oxygen builder preview. + * + * @return bool + *@since 1.0.18 + */ + public function is_oxygen_preview() { + $result = false; + if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) { + $result = true; + } + + return $result; + } + + /** + * Check for Kallyas theme Zion builder preview. + * + * @since 1.1.22 + * + * @return bool True when preview page otherwise false. + */ + public function is_kallyas_zion_preview() { + $result = false; + + if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) { + $result = true; + } + + return $result; + } + + /** + * Check for Bricks theme builder preview. + * + * @since 1.1.31 + * + * @return bool True when preview page otherwise false. + */ + public function is_bricks_preview() { + $result = false; + + if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) { + $result = true; + } + + return $result; + } + + /** + * General function to check if we are in a preview situation. + * + * @return bool + *@since 1.0.6 + */ + public function is_preview() { + $preview = false; + if ( $this->is_divi_preview() ) { + $preview = true; + } elseif ( $this->is_elementor_preview() ) { + $preview = true; + } elseif ( $this->is_beaver_preview() ) { + $preview = true; + } elseif ( $this->is_siteorigin_preview() ) { + $preview = true; + } elseif ( $this->is_cornerstone_preview() ) { + $preview = true; + } elseif ( $this->is_fusion_preview() ) { + $preview = true; + } elseif ( $this->is_oxygen_preview() ) { + $preview = true; + } elseif( $this->is_kallyas_zion_preview() ) { + $preview = true; + } elseif( $this->is_block_content_call() ) { + $preview = true; + } elseif( $this->is_bricks_preview() ) { + $preview = true; + } + + return $preview; + } + + /** + * Output the super title. + * + * @param $args + * @param array $instance + * + * @return string + */ + public function output_title( $args, $instance = array() ) { + $output = ''; + if ( ! empty( $instance['title'] ) ) { + /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ + $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); + + if(empty($instance['widget_title_tag'])){ + $output = $args['before_title'] . $title . $args['after_title']; + }else{ + $title_tag = esc_attr( $instance['widget_title_tag'] ); + + // classes + $title_classes = array(); + $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : ''; + $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : ''; + + $class = !empty( $title_classes ) ? implode(" ",$title_classes) : ''; + $output = "<$title_tag class='$class' >$title"; + } -// @todo https://github.com/WordPress/gutenberg/issues/39248 - if(tab.name=='Desktop'){ - wp.data.dispatch('core/edit-post').__experimentalSetPreviewDeviceType('Desktop'); -wp.data.select('core/edit-post').__experimentalGetPreviewDeviceType(); - }else if(tab.name=='Tablet'){ - wp.data.dispatch('core/edit-post').__experimentalSetPreviewDeviceType('Tablet'); -wp.data.select('core/edit-post').__experimentalGetPreviewDeviceType(); - }else if(tab.name=='Mobile'){ - wp.data.dispatch('core/edit-post').__experimentalSetPreviewDeviceType('Mobile'); -wp.data.select('core/edit-post').__experimentalGetPreviewDeviceType(); - } + } - return tab.content; + return $output; + } - } - ), + /** + * Outputs the options form inputs for the widget. + * + * @param array $instance The widget options. + */ + public function form( $instance ) { - instance = $instance; - $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,{ - url: props.attributes.{$key}_use_featured === true ? '".$this->get_url()."icons/placeholder.png' : props.attributes.$key, - value: props.attributes.{$key}_xy.x !== undefined && props.attributes.{$key}_xy.x >= 0 ? props.attributes.{$key}_xy : {x: 0.5,y: 0.5,}, -// value: props.attributes.{$key}_xy, - onChange: function(focalPoint){ - console.log(props.attributes); - return props.setAttributes({ - {$key}_xy: focalPoint - }); - }, - // @todo for some reason this does not work as expected. -// onDrag: function(focalPointTemp){ -// return props.setAttributes({ -// {$key}_xy: focalPointTemp -// }); -// } + // set it as a SD widget + echo $this->widget_advanced_toggle(); + echo "

" . esc_attr( $this->options['widget_ops']['description'] ) . "

"; + $arguments_raw = $this->get_arguments(); - }), "; + if ( is_array( $arguments_raw ) ) { + $arguments = $this->group_arguments( $arguments_raw ); - $value = '""'; - $type = 'MediaUpload'; - $extra .= "onSelect: function(media){ - return props.setAttributes({ - $key: media.url, - {$key}_id: media.id - }); - },"; - $extra .= "type: 'image',"; - $extra .= "render: function (obj) { - return el( 'div',{}, - ( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, { - className: 'components-button components-circular-option-picker__clear is-primary is-smallx', - onClick: obj.open - }, - 'Upload Image' - ), - $img_preview - props.attributes.$key && el( wp.components.Button, { - className: 'components-button components-circular-option-picker__clear is-secondary is-small', - style: {margin:'8px 0',display: 'block'}, - onClick: function(){ - return props.setAttributes({ - $key: '', - {$key}_id: '' - }); - } - }, - props.attributes.$key? 'Clear' : '' - ) - ) + // Do we have sections? + $has_sections = $arguments == $arguments_raw ? false : true; + if ( $has_sections ) { + $panel_count = 0; + foreach ( $arguments as $key => $args ) { - }"; - $onchange = ""; + ?> + + ( - images.push( el('div',{ className: 'col p-2', draggable: 'true', 'data-index': index }, - el('img', { - src: (upload.sizes && upload.sizes.thumbnail ? upload.sizes.thumbnail.url : upload.url), - style: { maxWidth:'100%', background: '#ccc', pointerEvents:'none' } - }), - el('i',{ - className: 'fas fa-times-circle text-danger position-absolute ml-n2 mt-n1 bg-white rounded-circle c-pointer', - onClick: function() { - aui_confirm('".esc_attr__('Are you sure?')."', '".esc_attr__('Delete')."', '".esc_attr__('Cancel')."', true).then(function(confirmed) { - if (confirmed) { - let new_uploads = JSON.parse('['+props.attributes.$key+']'); - new_uploads.splice(index, 1); - return props.setAttributes({ {$key}: JSON.stringify( new_uploads ).replace('[','').replace(']','') }); - } - }); - }}, - '') - )) - )); - return images; -})(),"; + $hide = $panel_count ? ' style="display:none;" ' : ''; + $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down'; + echo ""; + echo "
"; + foreach ( $args as $k => $a ) { - $value = '""'; - $type = 'MediaUpload'; - $extra .= "onSelect: function(media){ - let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : []; - if(media.length){ - for (var i=0; i < media.length; i++) { - slim_images.push({id: media[i].id, caption: media[i].caption, description: media[i].description,title: media[i].title,alt: media[i].alt,sizes: media[i].sizes, url: media[i].url}); - } - } - var slimImagesV = JSON.stringify(slim_images); - if (slimImagesV) { - slimImagesV = slimImagesV.replace('[','').replace(']','').replace(/'/g, '''); - } - return props.setAttributes({ $key: slimImagesV}); -},"; - $extra .= "type: 'image',"; - $extra .= "multiple: true,"; - $extra .= "render: function (obj) { - /* Init the sort */ - enableDragSort('sd-sortable'); - return el( 'div',{}, - el( wp.components.Button, { - className: 'components-button components-circular-option-picker__clear is-primary is-smallx', - onClick: obj.open - }, - 'Upload Images' - ), - el('div',{ - className: 'row row-cols-3 px-2 sd-sortable', - 'data-field':'$key' - }, - $img_preview - ), - props.attributes.$key && el( wp.components.Button, { - className: 'components-button components-circular-option-picker__clear is-secondary is-small', - style: {margin:'8px 0'}, - onClick: function(){ - return props.setAttributes({ $key: '' }); - } - }, - props.attributes.$key ? 'Clear All' : '' - ) - ) -}"; - $onchange = ""; + $this->widget_inputs_row_start($k, $a); + $this->widget_inputs( $a, $instance ); + $this->widget_inputs_row_end($k, $a); - //$inside_elements = ",el('div',{},'file upload')"; - } - elseif ( $args['type'] == 'checkbox' ) { - $type = 'CheckboxControl'; - $extra .= "checked: props.attributes.$key,"; - $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )"; - } elseif ( $args['type'] == 'textarea' ) { - $type = 'TextareaControl'; - - } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) { - $type = 'SelectControl'; - - if($args['name'] == 'category' && !empty($args['post_type_linked'])){ - $options .= "options: taxonomies_".str_replace("-","_", $this->id).","; - }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){ - $options .= "options: sort_by_".str_replace("-","_", $this->id).","; - }else { - - if ( ! empty( $args['options'] ) ) { - $options .= "options: ["; - foreach ( $args['options'] as $option_val => $option_label ) { - $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . esc_js( addslashes( $option_label ) ) . "' },"; - } - $options .= "],"; - } - } - if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550 - $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px","overflow-y":"auto"}, '; - } - - if($args['type'] == 'multiselect' || ( isset( $args['multiple'] ) && $args['multiple'] ) ){ - $after_elements .= "props.attributes.$key && el( wp.components.Button, { - className: 'components-button components-circular-option-picker__clear is-secondary is-small', - style: {margin:'-8px 0 8px 0',display: 'block'}, - onClick: function(){ - return props.setAttributes({ - $key: '', - }); - } - }, - 'Clear' - ),"; - } - } elseif ( $args['type'] == 'tagselect' ) { -// $type = 'FormTokenField'; -// -// if ( ! empty( $args['options'] ) ) { -// $options .= "suggestions: ["; -// foreach ( $args['options'] as $option_val => $option_label ) { -// $options .= "{ value: '" . esc_attr( $option_val ) . "', title: '" . addslashes( $option_label ) . "' },"; -//// $options .= "'" . esc_attr( $option_val ) . "':'" . addslashes( $option_label ) . "',"; -// } -// $options .= "],"; -// } -// -// $onchangex = "{ ( selectedItems ) => { -// // Build array of selected posts. -// let selectedPostsArray = []; -// selectedPosts.map( -// ( postName ) => { -// const matchingPost = posts.find( ( post ) => { -// return post.title.raw === postName; -// -// } ); -// if ( matchingPost !== undefined ) { -// selectedPostsArray.push( matchingPost.id ); -// } -// } -// ) -// -// setAttributes( { selectedPosts: selectedPostsArray } ); -// } } "; -// $onchange = '';// "props.setAttributes({ $key: [ props.attributes.$key ] } )"; -// -//// $options = ""; -// $value = "[]"; -// $extra .= ' __experimentalExpandOnFocus: true,'; + } - } else if ( $args['type'] == 'alignment' ) { - $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example - } else if ( $args['type'] == 'margins' ) { - - } else if ( $args['type'] == 'visibility_conditions' && ( function_exists( 'wp_is_block_theme' ) && wp_is_block_theme() ) ) { - $type = 'TextControl'; - $value = "(props.attributes.$key ? props.attributes.$key : '')"; - $args['type'] = 'text'; - $options .= 'disabled:true,'; - $bsvc_title = esc_attr( addslashes( $args['title'] ) ); - $bsvc_body = $this->block_visibility_fields( $args ); - // @TODO reset button - $bsvc_footer = ''; - $after_elements .= "el('div', {className: 'components-base-control bs-vc-button-wrap'}, el(wp.components.Button, { - className: 'components-button components-circular-option-picker__clear is-primary is-smallx', - onClick: function() { - var sValue = props.attributes." . $key . "; - var oValue; - try {oValue = JSON.parse(sValue);} catch(err) {} - jQuery(document).off('show.bs.modal', '.bs-vc-modal').on('show.bs.modal', '.bs-vc-modal', function (e) { - if (e.target && jQuery(e.target).hasClass('bs-vc-modal')) { - sd_block_visibility_render_fields(oValue); - if (!jQuery('.bs-vc-modal-form .bs-vc-rule-sets .bs-vc-rule').length) { - jQuery('.bs-vc-modal-form .bs-vc-add-rule').trigger('click'); - } - if(typeof aui_init_select2 == 'function') { - aui_init_select2(); - } - jQuery('.bs-vc-modal-form').trigger('change'); - } - }); - aui_modal('" . $bsvc_title . "', '" . addslashes( $bsvc_body ) . "', '" . $bsvc_footer . "', true, 'bs-vc-modal', 'modal-lg', ''); - jQuery(document).off('change', '#bsvc_raw_value').on('change', '#bsvc_raw_value', function(e) { - props.setAttributes({" . $key . ": e.target.value}); - }); - } - }, - '" . addslashes( ! empty( $args['button_title'] ) ? $args['button_title'] : $args['title'] ) . "' - ) ),"; - } else { - return;// if we have not implemented the control then don't break the JS. - } - - // color input does not show the labels so we add them - if($args['type']=='color'){ - // add show only if advanced - echo $require_advanced; - // add setting require if defined - echo $element_require; - echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),"; - } - - // add show only if advanced - echo $require_advanced; - // add setting require if defined - echo $element_require; - echo $device_type_require; + echo "
"; - // icon - echo $icon; - ?> - el( , { - label: el('label',{className:'components-base-control__label',style:{width:"100%"}},el('span',{dangerouslySetInnerHTML: {__html: ''}}),deviceType == '' && el('span',{dangerouslySetInnerHTML: {__html: ''},title: deviceType + ": Set preview mode to change",style: {right:"0",position:"absolute",color:"var(--wp-admin-theme-color)"}}))'', - help: , - value: , - - - - - - - - onChange: function ( ) { - - } - - } ), - $val ) { - if(is_array($val)){ - $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},'; - }else{ - $attributes .= $html ? " $key='$val' " : "'$key': '$val',"; - } - } - - } - - return $attributes; - } - - - - /** - * A self looping function to create the output for JS block elements. - * - * This is what is output in the WP Editor visual view. - * - * @param $args - */ - public function block_element( $args, $save = false ) { - - - if ( ! empty( $args ) ) { - foreach ( $args as $element => $new_args ) { - - if ( is_array( $new_args ) ) { // its an element - - - if ( isset( $new_args['element'] ) ) { - - if ( isset( $new_args['element_require'] ) ) { - echo str_replace( array( - "'+", - "+'" - ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " && "; - unset( $new_args['element_require'] ); - } + $panel_count ++; - if($new_args['element']=='InnerBlocks'){ - echo "\n el( InnerBlocks, {"; - }elseif($new_args['element']=='innerBlocksProps'){ - $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div'; - // echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {"; -// echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; - echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( "; - echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {"; - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; + } + } else { + foreach ( $arguments as $key => $args ) { + $this->widget_inputs_row_start($key, $args); + $this->widget_inputs( $args, $instance ); + $this->widget_inputs_row_end($key, $args); + } + } - echo "} ), {"; - echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : ''; - // echo '###'; + } + } - // echo '###'; - }elseif($new_args['element']=='BlocksProps'){ + public function widget_inputs_row_start( $key, $args ) { + if ( ! empty( $args['row'] ) ) { + // Maybe open + if ( ! empty( $args['row']['open'] ) ) { + ?> +
' data-element_require='convert_element_require( $args['row']['element_require'] ) : '' ); ?>'> + + + + +
'> +
+ "; + } else { + echo "
"; + } + } + } - unset($new_args['inner_element']); - echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {"; - echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : ''; + public function widget_inputs_row_end( $key, $args ) { + if ( ! empty( $args['row'] ) ) { + // Maybe close + if ( ! empty( $args['row']['close'] ) ) { + echo "
"; + } + echo "
"; + } + } + /** + * Get the hidden input that when added makes the advanced button show on widget settings. + * + * @return string + */ + public function widget_advanced_toggle() { - // echo "} ),"; + $output = ''; + if ( $this->block_show_advanced() ) { + $val = 1; + } else { + $val = 0; + } - }else{ - echo "\n el( '" . $new_args['element'] . "', {"; - } + $output .= ""; + return $output; + } - // get the attributes - foreach ( $new_args as $new_key => $new_value ) { - - - if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) { - // do nothing - } else { - echo $this->block_element( array( $new_key => $new_value ),$save ); - } - } - - echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes - - // get the content - $first_item = 0; - foreach ( $new_args as $new_key => $new_value ) { - if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) { - - if ( $new_key === 'content' ) { - echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'"; - }else if ( $new_key === 'if_content' ) { - echo $this->block_props_replace( $new_value ); - } - - if ( is_array( $new_value ) ) { - - if ( isset( $new_value['element_require'] ) ) { - echo str_replace( array( - "'+", - "+'" - ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " && "; - unset( $new_value['element_require'] ); - } - - if ( isset( $new_value['element_repeat'] ) ) { - $x = 1; - while ( $x <= absint( $new_value['element_repeat'] ) ) { - $this->block_element( array( '' => $new_value ),$save ); - $x ++; - } - } else { - $this->block_element( array( '' => $new_value ),$save ); - } - } - $first_item ++; - } - } + /** + * Convert require element. + * + * @param string $input Input element. + * + * @return string $output + *@since 1.0.0 + * + */ + public function convert_element_require( $input ) { + $input = str_replace( "'", '"', $input );// we only want double quotes - if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){ - echo "))";// end content - }else{ - echo ")";// end content + $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( + "jQuery(form).find('[data-argument=\"", + "\"]').find('input,select,textarea').val()", + "\"]').find('input:checked').val()" + ), $input ) ); + + return $output; + } + + /** + * Builds the inputs for the widget options. + * + * @param $args + * @param $instance + */ + public function widget_inputs( $args, $instance ) { + + $class = ""; + $element_require = ""; + $custom_attributes = ""; + + // get value + if ( isset( $instance[ $args['name'] ] ) ) { + $value = $instance[ $args['name'] ]; + } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) { + $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] ); + } else { + $value = ''; + } + + // get placeholder + if ( ! empty( $args['placeholder'] ) ) { + $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; + } else { + $placeholder = ''; + } + + // get if advanced + if ( isset( $args['advanced'] ) && $args['advanced'] ) { + $class .= " sd-advanced-setting "; + } + + // element_require + if ( isset( $args['element_require'] ) && $args['element_require'] ) { + $element_require = $args['element_require']; + } + + // custom_attributes + if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { + $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); + } + + // before wrapper + ?> +

' data-element_require='convert_element_require( $element_require );} ?>'> + + + class="widefat" id="get_field_id( $args['name'] ) ); ?>" name="get_field_name( $args['name'] ) ); ?>" type="" value=""> + + + + + class="widefat" id="get_field_id( $args['name'] ) ); ?>" name="get_field_name( $args['name'] ) ); ?>" type="checkbox" value="1"> + + + + + + +

'; + }elseif($icon=='box-right'){ + return ''; + }elseif($icon=='box-bottom'){ + return ''; + }elseif($icon=='box-left'){ + return ''; + } + } - echo ", \n"; + /** + * Get the widget input description html. + * + * @param $args + * + * @return string + * @todo, need to make its own tooltip script + */ + public function widget_field_desc( $args ) { + + $description = ''; + if ( isset( $args['desc'] ) && $args['desc'] ) { + if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) { + $description = $this->desc_tip( $args['desc'] ); + } else { + $description = '' . wp_kses_post( $args['desc'] ) . ''; + } + } - } - } else { + return $description; + } - if ( substr( $element, 0, 3 ) === "if_" ) { - $extra = ''; - if( strpos($new_args, '[%WrapClass%]') !== false ){ - $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args); - $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args); - } - echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ","; - } elseif ( $element == 'style' && strpos($new_args, '[%WrapStyle%]') !== false ) { - $new_args = str_replace('[%WrapStyle%]','',$new_args); - echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },"; -// echo $element . ": " . $this->block_props_replace( $new_args ) . ","; - } elseif ( $element == 'style' ) { - echo $element . ": " . $this->block_props_replace( $new_args ) . ","; - } elseif ( ( $element == 'class' || $element == 'className' ) && strpos($new_args, '[%WrapClass%]') !== false ) { - $new_args = str_replace('[%WrapClass%]','',$new_args); - echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),"; - } elseif ( $element == 'template' && $new_args ) { - echo $element . ": $new_args,"; - } else { - echo $element . ": '" . $this->block_props_replace( $new_args ) . "',"; - } - - } - } - } - } - - /** - * Replace block attributes placeholders with the proper naming. - * - * @param $string - * - * @return mixed - */ - public function block_props_replace( $string, $no_wrap = false ) { - if ( $no_wrap ) { - $string = str_replace( array( "[%", "%]", "%:checked]" ), array( "props.attributes.", "", "" ), $string ); - } else { - $string = str_replace( array( "![%", "[%", "%]", "%:checked]" ), array( "'+!props.attributes.", "'+props.attributes.", "+'", "+'" ), $string ); - } - - return $string; - } - - /** - * Outputs the content of the widget - * - * @param array $args - * @param array $instance - */ - public function widget( $args, $instance ) { - if ( ! is_array( $args ) ) { - $args = array(); - } - - // Get the filtered values - $argument_values = $this->argument_values( $instance ); - $argument_values = $this->string_to_bool( $argument_values ); - $output = $this->output( $argument_values, $args ); - - $no_wrap = false; - if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) { - $no_wrap = true; - } - - ob_start(); - if ( $output && ! $no_wrap ) { - - $class_original = $this->options['widget_ops']['classname']; - $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash(); - - // Before widget - $before_widget = ! empty( $args['before_widget'] ) ? $args['before_widget'] : ''; - $before_widget = $before_widget ? str_replace( $class_original, $class, $before_widget ) : $before_widget; - $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this ); - $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this ); - - // After widget - $after_widget = ! empty( $args['after_widget'] ) ? $args['after_widget'] : ''; - $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this ); - $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this ); - - echo $before_widget; - // elementor strips the widget wrapping div so we check for and add it back if needed - if ( $this->is_elementor_widget_output() ) { - // Filter class & attrs for elementor widget output. - $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this ); - $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this ); - - $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this ); - $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this ); - - echo ""; - } - echo $this->output_title( $args, $instance ); - echo $output; - if ( $this->is_elementor_widget_output() ) { - echo ""; - } - echo $after_widget; - } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty - $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" ); - echo $output; - } elseif ( $output && $no_wrap ) { - echo $output; - } - $output = ob_get_clean(); - - $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this ); - - echo $output; - } - - /** - * Tests if the current output is inside a elementor container. - * - * @return bool - *@since 1.0.4 - */ - public function is_elementor_widget_output() { - $result = false; - if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) { - $result = true; - } - - return $result; - } - - /** - * Tests if the current output is inside a elementor preview. - * - * @return bool - *@since 1.0.4 - */ - public function is_elementor_preview() { - $result = false; - if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) { - $result = true; - } - - return $result; - } - - /** - * Tests if the current output is inside a Divi preview. - * - * @return bool - *@since 1.0.6 - */ - public function is_divi_preview() { - $result = false; - if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) { - $result = true; - } - - return $result; - } - - /** - * Tests if the current output is inside a Beaver builder preview. - * - * @return bool - *@since 1.0.6 - */ - public function is_beaver_preview() { - $result = false; - if ( isset( $_REQUEST['fl_builder'] ) ) { - $result = true; - } - - return $result; - } - - /** - * Tests if the current output is inside a siteorigin builder preview. - * - * @return bool - *@since 1.0.6 - */ - public function is_siteorigin_preview() { - $result = false; - if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) { - $result = true; - } - - return $result; - } - - /** - * Tests if the current output is inside a cornerstone builder preview. - * - * @return bool - *@since 1.0.8 - */ - public function is_cornerstone_preview() { - $result = false; - if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) { - $result = true; - } - - return $result; - } - - /** - * Tests if the current output is inside a fusion builder preview. - * - * @return bool - *@since 1.1.0 - */ - public function is_fusion_preview() { - $result = false; - if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) { - $result = true; - } - - return $result; - } - - /** - * Tests if the current output is inside a Oxygen builder preview. - * - * @return bool - *@since 1.0.18 - */ - public function is_oxygen_preview() { - $result = false; - if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) { - $result = true; - } - - return $result; - } - - /** - * Check for Kallyas theme Zion builder preview. - * - * @since 1.1.22 - * - * @return bool True when preview page otherwise false. - */ - public function is_kallyas_zion_preview() { - $result = false; - - if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) { - $result = true; - } - - return $result; - } - - /** - * Check for Bricks theme builder preview. - * - * @since 1.1.31 - * - * @return bool True when preview page otherwise false. - */ - public function is_bricks_preview() { - $result = false; - - if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) { - $result = true; - } - - return $result; - } - - /** - * General function to check if we are in a preview situation. - * - * @return bool - *@since 1.0.6 - */ - public function is_preview() { - $preview = false; - if ( $this->is_divi_preview() ) { - $preview = true; - } elseif ( $this->is_elementor_preview() ) { - $preview = true; - } elseif ( $this->is_beaver_preview() ) { - $preview = true; - } elseif ( $this->is_siteorigin_preview() ) { - $preview = true; - } elseif ( $this->is_cornerstone_preview() ) { - $preview = true; - } elseif ( $this->is_fusion_preview() ) { - $preview = true; - } elseif ( $this->is_oxygen_preview() ) { - $preview = true; - } elseif( $this->is_kallyas_zion_preview() ) { - $preview = true; - } elseif( $this->is_block_content_call() ) { - $preview = true; - } elseif( $this->is_bricks_preview() ) { - $preview = true; - } - - return $preview; - } - - /** - * Output the super title. - * - * @param $args - * @param array $instance - * - * @return string - */ - public function output_title( $args, $instance = array() ) { - $output = ''; - if ( ! empty( $instance['title'] ) ) { - /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ - $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); - - if(empty($instance['widget_title_tag'])){ - $output = $args['before_title'] . $title . $args['after_title']; - }else{ - $title_tag = esc_attr( $instance['widget_title_tag'] ); - - // classes - $title_classes = array(); - $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : ''; - $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : ''; - - $class = !empty( $title_classes ) ? implode(" ",$title_classes) : ''; - $output = "<$title_tag class='$class' >$title"; - } - - } - - return $output; - } - - /** - * Outputs the options form inputs for the widget. - * - * @param array $instance The widget options. - */ - public function form( $instance ) { - - // set widget instance - $this->instance = $instance; - - // set it as a SD widget - echo $this->widget_advanced_toggle(); - - echo "

" . esc_attr( $this->options['widget_ops']['description'] ) . "

"; - $arguments_raw = $this->get_arguments(); - - if ( is_array( $arguments_raw ) ) { - - $arguments = $this->group_arguments( $arguments_raw ); - - // Do we have sections? - $has_sections = $arguments == $arguments_raw ? false : true; - - - if ( $has_sections ) { - $panel_count = 0; - foreach ( $arguments as $key => $args ) { - - ?> - - " . esc_attr( $key ) . " "; - echo "
"; - - foreach ( $args as $k => $a ) { - - $this->widget_inputs_row_start($k, $a); - $this->widget_inputs( $a, $instance ); - $this->widget_inputs_row_end($k, $a); - - } - - echo "
"; - - $panel_count ++; - - } - } else { - foreach ( $arguments as $key => $args ) { - $this->widget_inputs_row_start($key, $args); - $this->widget_inputs( $args, $instance ); - $this->widget_inputs_row_end($key, $args); - } - } - - } - } - - public function widget_inputs_row_start( $key, $args ) { - if ( ! empty( $args['row'] ) ) { - // Maybe open - if ( ! empty( $args['row']['open'] ) ) { - ?> -
' data-element_require='convert_element_require( $args['row']['element_require'] ) : '' ); ?>'> - - - - -
'> -
- "; - } else { - echo "
"; - } - } - } - - public function widget_inputs_row_end( $key, $args ) { - if ( ! empty( $args['row'] ) ) { - // Maybe close - if ( ! empty( $args['row']['close'] ) ) { - echo "
"; - } - echo "
"; - } - } - - /** - * Get the hidden input that when added makes the advanced button show on widget settings. - * - * @return string - */ - public function widget_advanced_toggle() { - - $output = ''; - if ( $this->block_show_advanced() ) { - $val = 1; - } else { - $val = 0; - } - - $output .= ""; - - return $output; - } - - /** - * Convert require element. - * - * @param string $input Input element. - * - * @return string $output - *@since 1.0.0 - * - */ - public function convert_element_require( $input ) { - $input = str_replace( "'", '"', $input );// we only want double quotes - - $output = esc_attr( str_replace( array( "[%", "%]", "%:checked]" ), array( - "jQuery(form).find('[data-argument=\"", - "\"]').find('input,select,textarea').val()", - "\"]').find('input:checked').val()" - ), $input ) ); - - return $output; - } - - /** - * Builds the inputs for the widget options. - * - * @param $args - * @param $instance - */ - public function widget_inputs( $args, $instance ) { - - $class = ""; - $element_require = ""; - $custom_attributes = ""; - - // get value - if ( isset( $instance[ $args['name'] ] ) ) { - $value = $instance[ $args['name'] ]; - } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) { - $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] ); - } else { - $value = ''; - } - - // get placeholder - if ( ! empty( $args['placeholder'] ) ) { - $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'"; - } else { - $placeholder = ''; - } - - // get if advanced - if ( isset( $args['advanced'] ) && $args['advanced'] ) { - $class .= " sd-advanced-setting "; - } - - // element_require - if ( isset( $args['element_require'] ) && $args['element_require'] ) { - $element_require = $args['element_require']; - } - - // custom_attributes - if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) { - $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true ); - } - - // before wrapper - ?> -

' data-element_require='convert_element_require( $element_require );} ?>'> - - - class="widefat" id="get_field_id( $args['name'] ) ); ?>" name="get_field_name( $args['name'] ) ); ?>" type="" value=""> - - - - - class="widefat" id="get_field_id( $args['name'] ) ); ?>" name="get_field_name( $args['name'] ) ); ?>" type="checkbox" value="1"> - - - - - - -

'; - }elseif($icon=='box-right'){ - return ''; - }elseif($icon=='box-bottom'){ - return ''; - }elseif($icon=='box-left'){ - return ''; - } - } - - /** - * Get the widget input description html. - * - * @param $args - * - * @return string - * @todo, need to make its own tooltip script - */ - public function widget_field_desc( $args ) { - - $description = ''; - if ( isset( $args['desc'] ) && $args['desc'] ) { - if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) { - $description = $this->desc_tip( $args['desc'] ); - } else { - $description = '' . wp_kses_post( $args['desc'] ) . ''; - } - } - - return $description; - } - - /** - * Get the widget input title html. - * - * @param $args - * - * @return string - */ - public function widget_field_title( $args ) { - $title = ''; - - if ( isset( $args['title'] ) && $args['title'] ) { - if ( ! empty( $args['device_type'] ) ) { - $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title. - } - - if ( isset( $args['icon'] ) && $args['icon'] ) { - $title = self::get_widget_icon( $args['icon'], $args['title'] ); - } else { - $title = esc_attr( $args['title'] ); - } - } - - return $title; - } - - /** - * Get the tool tip html. - * - * @param $tip - * @param bool $allow_html - * - * @return string - */ - function desc_tip( $tip, $allow_html = false ) { - if ( $allow_html ) { - $tip = $this->sanitize_tooltip( $tip ); - } else { - $tip = esc_attr( $tip ); - } - - return ''; - } - - /** - * Sanitize a string destined to be a tooltip. - * - * @param string $var - * - * @return string - */ - public function sanitize_tooltip( $var ) { - return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( - 'br' => array(), - 'em' => array(), - 'strong' => array(), - 'small' => array(), - 'span' => array(), - 'ul' => array(), - 'li' => array(), - 'ol' => array(), - 'p' => array(), - ) ) ); - } - - /** - * Processing widget options on save - * - * @param array $new_instance The new options - * @param array $old_instance The previous options - * - * @return array - * @todo we should add some sanitation here. - */ - public function update( $new_instance, $old_instance ) { - - //save the widget - $instance = array_merge( (array) $old_instance, (array) $new_instance ); - - // set widget instance - $this->instance = $instance; - - if ( empty( $this->arguments ) ) { - $this->get_arguments(); - } - - // check for checkboxes - if ( ! empty( $this->arguments ) ) { - foreach ( $this->arguments as $argument ) { - if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) { - $instance[ $argument['name'] ] = '0'; - } - } - } - - return $instance; - } - - /** - * Checks if the current call is a ajax call to get the block content. - * - * This can be used in your widget to return different content as the block content. - * - * @return bool - *@since 1.0.3 - */ - public function is_block_content_call() { - $result = false; - if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { - $result = true; - } - - return $result; - } - - /** - * Get an instance hash that will be unique to the type and settings. - * - * @return string - *@since 1.0.20 - */ - public function get_instance_hash(){ - $instance_string = $this->base_id.serialize($this->instance); - return hash('crc32b',$instance_string); - } - - /** - * Generate and return inline styles from CSS rules that will match the unique class of the instance. - * - * @param array $rules - * - * @return string - *@since 1.0.20 - */ - public function get_instance_style($rules = array()){ - $css = ''; - - if(!empty($rules)){ - $rules = array_unique($rules); - $instance_hash = $this->get_instance_hash(); - $css .= ""; - } - - return $css; - } - - /** - * Encode shortcodes tags. - * - * @param string $content Content to search for shortcode tags. - * + /** + * Get the widget input title html. + * + * @param $args + * + * @return string + */ + public function widget_field_title( $args ) { + $title = ''; + + if ( isset( $args['title'] ) && $args['title'] ) { + if ( ! empty( $args['device_type'] ) ) { + $args['title'] .= ' (' . $args['device_type'] . ')'; // Append device type to title. + } + + if ( isset( $args['icon'] ) && $args['icon'] ) { + $title = self::get_widget_icon( $args['icon'], $args['title'] ); + } else { + $title = esc_attr( $args['title'] ); + } + } + + return $title; + } + + /** + * Get the tool tip html. + * + * @param $tip + * @param bool $allow_html + * + * @return string + */ + function desc_tip( $tip, $allow_html = false ) { + if ( $allow_html ) { + $tip = $this->sanitize_tooltip( $tip ); + } else { + $tip = esc_attr( $tip ); + } + + return ''; + } + + /** + * Sanitize a string destined to be a tooltip. + * + * @param string $var + * + * @return string + */ + public function sanitize_tooltip( $var ) { + return htmlspecialchars( wp_kses( html_entity_decode( $var ), array( + 'br' => array(), + 'em' => array(), + 'strong' => array(), + 'small' => array(), + 'span' => array(), + 'ul' => array(), + 'li' => array(), + 'ol' => array(), + 'p' => array(), + ) ) ); + } + + /** + * Processing widget options on save + * + * @param array $new_instance The new options + * @param array $old_instance The previous options + * + * @return array + * @todo we should add some sanitation here. + */ + public function update( $new_instance, $old_instance ) { + + //save the widget + $instance = array_merge( (array) $old_instance, (array) $new_instance ); + + // set widget instance + $this->instance = $instance; + + if ( empty( $this->arguments ) ) { + $this->get_arguments(); + } + + // check for checkboxes + if ( ! empty( $this->arguments ) ) { + foreach ( $this->arguments as $argument ) { + if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) { + $instance[ $argument['name'] ] = '0'; + } + } + } + + return $instance; + } + + /** + * Checks if the current call is a ajax call to get the block content. + * + * This can be used in your widget to return different content as the block content. + * + * @return bool + *@since 1.0.3 + */ + public function is_block_content_call() { + $result = false; + if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) { + $result = true; + } + + return $result; + } + + /** + * Get an instance hash that will be unique to the type and settings. + * + * @return string + *@since 1.0.20 + */ + public function get_instance_hash(){ + $instance_string = $this->base_id.serialize($this->instance); + return hash('crc32b',$instance_string); + } + + /** + * Generate and return inline styles from CSS rules that will match the unique class of the instance. + * + * @param array $rules + * + * @return string + *@since 1.0.20 + */ + public function get_instance_style($rules = array()){ + $css = ''; + + if(!empty($rules)){ + $rules = array_unique($rules); + $instance_hash = $this->get_instance_hash(); + $css .= ""; + } + + return $css; + } + + /** + * Encode shortcodes tags. + * + * @param string $content Content to search for shortcode tags. + * *@return string Content with shortcode tags removed. - *@since 1.0.28 - * - */ - public function encode_shortcodes( $content ) { - // Avoids existing encoded tags. - $trans = array( - '[' => '[', - ']' => ']', - '&#91;' => '[', - '&#93;' => ']', - '<' => '&0lt;', - '>' => '&0gt;', - '&lt;' => '&0lt;', - '&gt;' => '&0gt;', - ); - - $content = strtr( $content, $trans ); - - $trans = array( - '[' => '[', - ']' => ']', - '<' => '<', - '>' => '>', - '"' => '"', - "'" => ''', - ); - - $content = strtr( $content, $trans ); - - return $content; - } - - /** - * Remove encoded shortcod tags. - * - * @param string $content Content to search for shortcode tags. - * + *@since 1.0.28 + * + */ + public function encode_shortcodes( $content ) { + // Avoids existing encoded tags. + $trans = array( + '[' => '[', + ']' => ']', + '&#91;' => '[', + '&#93;' => ']', + '<' => '&0lt;', + '>' => '&0gt;', + '&lt;' => '&0lt;', + '&gt;' => '&0gt;', + ); + + $content = strtr( $content, $trans ); + + $trans = array( + '[' => '[', + ']' => ']', + '<' => '<', + '>' => '>', + '"' => '"', + "'" => ''', + ); + + $content = strtr( $content, $trans ); + + return $content; + } + + /** + * Remove encoded shortcod tags. + * + * @param string $content Content to search for shortcode tags. + * *@return string Content with decoded shortcode tags. - *@since 1.0.28 - * - */ - public function decode_shortcodes( $content ) { - $trans = array( - '[' => '[', - ']' => ']', - '&#91;' => '[', - '&#93;' => ']', - '<' => '<', - '>' => '>', - '&lt;' => '<', - '&gt;' => '>', - '"' => '"', - ''' => "'", - ); - - $content = strtr( $content, $trans ); - - $trans = array( - '[' => '[', - ']' => ']', - '&#091;' => '[', - '&#093;' => ']', - '&0lt;' => '<', - '&0gt;' => '>', - '&0lt;' => '<', - '&0gt;' => '>', - ); - - $content = strtr( $content, $trans ); - - return $content; - } - - public function block_visibility_fields( $args ) { - $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : ''; - $content = '
'; - $content .= '
'; - $content .= '
'; - $content .= '
'; - $content .= '
'; - $content .= aui()->select( - array( - 'id' => 'bsvc_rule_BSVCINDEX', - 'name' => 'bsvc_rule_BSVCINDEX', - 'label' => __( 'Rule', 'ayecode-connect' ), - 'placeholder' => __( 'Select Rule...', 'ayecode-connect' ), - 'class' => 'bsvc_rule form-select-sm no-select2 mw-100', - 'options' => sd_visibility_rules_options(), - 'default' => '', - 'value' => '', - 'label_type' => '', - 'select2' => false, - 'input_group_left' => __( 'Rule:', 'ayecode-connect' ), - 'extra_attributes' => array( - 'data-minimum-results-for-search' => '-1' - ) - ) - ); - - $content .= '
'; - - if ( class_exists( 'GeoDirectory' ) ) { - $content .= '
'; - - $content .= aui()->select( - array( - 'id' => 'bsvc_gd_field_BSVCINDEX', - 'name' => 'bsvc_gd_field_BSVCINDEX', - 'label' => __( 'FIELD', 'ayecode-connect' ), - 'placeholder' => __( 'FIELD', 'ayecode-connect' ), - 'class' => 'bsvc_gd_field form-select-sm no-select2 mw-100', - 'options' => sd_visibility_gd_field_options(), - 'default' => '', - 'value' => '', - 'label_type' => '', - 'select2' => false, - 'element_require' => '[%bsvc_rule_BSVCINDEX%]=="gd_field"', - 'extra_attributes' => array( - 'data-minimum-results-for-search' => '-1' - ) - ) - ); - - $content .= '
'; - $content .= '
'; - - $content .= aui()->select( - array( - 'id' => 'bsvc_gd_field_condition_BSVCINDEX', - 'name' => 'bsvc_gd_field_condition_BSVCINDEX', - 'label' => __( 'CONDITION', 'ayecode-connect' ), - 'placeholder' => __( 'CONDITION', 'ayecode-connect' ), - 'class' => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100', - 'options' => sd_visibility_field_condition_options(), - 'default' => '', - 'value' => '', - 'label_type' => '', - 'select2' => false, - 'element_require' => '[%bsvc_rule_BSVCINDEX%]=="gd_field"', - 'extra_attributes' => array( - 'data-minimum-results-for-search' => '-1' - ) - ) - ); - - $content .= '
'; - $content .= '
'; - - $content .= aui()->input( - array( - 'type' => 'text', - 'id' => 'bsvc_gd_field_search_BSVCINDEX', - 'name' => 'bsvc_gd_field_search_BSVCINDEX', - 'label' => __( 'VALUE TO MATCH', 'ayecode-connect' ), - 'class' => 'bsvc_gd_field_search form-control-sm', - 'placeholder' => __( 'VALUE TO MATCH', 'ayecode-connect' ), - 'label_type' => '', - 'value' => '', - '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")' - ) - ); - - $content .= '
'; - } - - $content .= '
'; - - $content .= '
'; - $role_options = sd_user_roles_options(); - - $role_option_i = 0; - foreach ( $role_options as $role_option_key => $role_option_name ) { - $role_option_i++; - - $content .= '
'; - $content .= aui()->input( - array( - 'id' => 'bsvc_user_roles_BSVCINDEX_' . $role_option_i, - 'name' => 'bsvc_user_roles_BSVCINDEX[]', - 'type' => 'checkbox', - 'label' => $role_option_name, - 'label_type' => 'hidden', - 'class' => 'bsvc_user_roles', - 'value' => $role_option_key, - 'switch' => 'md', - 'no_wrap' => true - ) - ); - $content .= '
'; - } - $content .= '
'; - $content .= '
'; - $content .= '
'; - $content .= '
'; - $content .= '
'; - $content .= '
'; - $content .= '
'; - $content .= aui()->select( - array( - 'id' => 'bsvc_output', - 'name' => 'bsvc_output', - 'label' => __( 'What should happen if rules met.', 'ayecode-connect' ), - 'placeholder' => __( 'Default Output', 'ayecode-connect' ), - 'class' => 'bsvc_output form-select-sm no-select2 mw-100', - 'options' => sd_visibility_output_options(), - 'default' => '', - 'value' => '', - 'label_type' => 'top', - 'select2' => false, - 'extra_attributes' => array( - 'data-minimum-results-for-search' => '-1' - ) - ) - ); - - $content .= '
'; - - $content .= aui()->select( - array( - 'id' => 'bsvc_page', - 'name' => 'bsvc_page', - 'label' => __( 'Page Content', 'ayecode-connect' ), - 'placeholder' => __( 'Select Page ID...', 'ayecode-connect' ), - 'class' => 'bsvc_page form-select-sm no-select2 mw-100', - 'options' => sd_template_page_options(), - 'default' => '', - 'value' => '', - 'label_type' => 'top', - 'select2' => false, - 'element_require' => '[%bsvc_output%]=="page"' - ) - ); - - $content .= aui()->select( - array( - 'id' => 'bsvc_tmpl_part', - 'name' => 'bsvc_tmpl_part', - 'label' => __( 'Template Part', 'ayecode-connect' ), - 'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ), - 'class' => 'bsvc_tmpl_part form-select-sm no-select2 mw-100', - 'options' => sd_template_part_options(), - 'default' => '', - 'value' => '', - 'label_type' => 'top', - 'select2' => false, - 'element_require' => '[%bsvc_output%]=="template_part"', - 'extra_attributes' => array( - 'data-minimum-results-for-search' => '-1' - ) - ) - ); - - $content .= aui()->select( - array( - 'id' => 'bsvc_message_type', - 'name' => 'bsvc_message_type', - 'label' => __( 'Custom Message Type', 'ayecode-connect' ), - 'placeholder' => __( 'Default (none)', 'ayecode-connect' ), - 'class' => 'bsvc_message_type form-select-sm no-select2 mw-100', - 'options' => sd_aui_colors(), - 'default' => '', - 'value' => '', - 'label_type' => 'top', - 'select2' => false, - 'element_require' => '[%bsvc_output%]=="message"', - 'extra_attributes' => array( - 'data-minimum-results-for-search' => '-1' - ) - ) - ); - - $content .= '
'; - - $content .= aui()->input( - array( - 'type' => 'text', - 'id' => 'bsvc_message', - 'name' => 'bsvc_message', - 'label' => '', - 'class' => 'bsvc_message form-control-sm', - 'placeholder' => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ), - 'label_type' => '', - 'value' => '', - 'form_group_class' => ' ', - 'element_require' => '[%bsvc_output%]=="message"', - ) - ); - - $content .= '
'; - - return $content; - } - } + *@since 1.0.28 + * + */ + public function decode_shortcodes( $content ) { + $trans = array( + '[' => '[', + ']' => ']', + '&#91;' => '[', + '&#93;' => ']', + '<' => '<', + '>' => '>', + '&lt;' => '<', + '&gt;' => '>', + '"' => '"', + ''' => "'", + ); + + $content = strtr( $content, $trans ); + + $trans = array( + '[' => '[', + ']' => ']', + '&#091;' => '[', + '&#093;' => ']', + '&0lt;' => '<', + '&0gt;' => '>', + '&0lt;' => '<', + '&0gt;' => '>', + ); + + $content = strtr( $content, $trans ); + + return $content; + } + + public function block_visibility_fields( $args ) { + $value = ! empty( $args['value'] ) ? esc_attr( $args['value'] ) : ''; + $content = '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= aui()->select( + array( + 'id' => 'bsvc_rule_BSVCINDEX', + 'name' => 'bsvc_rule_BSVCINDEX', + 'label' => __( 'Rule', 'ayecode-connect' ), + 'placeholder' => __( 'Select Rule...', 'ayecode-connect' ), + 'class' => 'bsvc_rule form-select-sm no-select2 mw-100', + 'options' => sd_visibility_rules_options(), + 'default' => '', + 'value' => '', + 'label_type' => '', + 'select2' => false, + 'input_group_left' => __( 'Rule:', 'ayecode-connect' ), + 'extra_attributes' => array( + 'data-minimum-results-for-search' => '-1' + ) + ) + ); + + $content .= '
'; + + if ( class_exists( 'GeoDirectory' ) ) { + $content .= '
'; + + $content .= aui()->select( + array( + 'id' => 'bsvc_gd_field_BSVCINDEX', + 'name' => 'bsvc_gd_field_BSVCINDEX', + 'label' => __( 'FIELD', 'ayecode-connect' ), + 'placeholder' => __( 'FIELD', 'ayecode-connect' ), + 'class' => 'bsvc_gd_field form-select-sm no-select2 mw-100', + 'options' => sd_visibility_gd_field_options(), + 'default' => '', + 'value' => '', + 'label_type' => '', + 'select2' => false, + 'element_require' => '[%bsvc_rule_BSVCINDEX%]=="gd_field"', + 'extra_attributes' => array( + 'data-minimum-results-for-search' => '-1' + ) + ) + ); + + $content .= '
'; + $content .= '
'; + + $content .= aui()->select( + array( + 'id' => 'bsvc_gd_field_condition_BSVCINDEX', + 'name' => 'bsvc_gd_field_condition_BSVCINDEX', + 'label' => __( 'CONDITION', 'ayecode-connect' ), + 'placeholder' => __( 'CONDITION', 'ayecode-connect' ), + 'class' => 'bsvc_gd_field_condition form-select-sm no-select2 mw-100', + 'options' => sd_visibility_field_condition_options(), + 'default' => '', + 'value' => '', + 'label_type' => '', + 'select2' => false, + 'element_require' => '[%bsvc_rule_BSVCINDEX%]=="gd_field"', + 'extra_attributes' => array( + 'data-minimum-results-for-search' => '-1' + ) + ) + ); + + $content .= '
'; + $content .= '
'; + + $content .= aui()->input( + array( + 'type' => 'text', + 'id' => 'bsvc_gd_field_search_BSVCINDEX', + 'name' => 'bsvc_gd_field_search_BSVCINDEX', + 'label' => __( 'VALUE TO MATCH', 'ayecode-connect' ), + 'class' => 'bsvc_gd_field_search form-control-sm', + 'placeholder' => __( 'VALUE TO MATCH', 'ayecode-connect' ), + 'label_type' => '', + 'value' => '', + '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")' + ) + ); + + $content .= '
'; + } + + $content .= '
'; + + $content .= '
'; + $role_options = sd_user_roles_options(); + + $role_option_i = 0; + foreach ( $role_options as $role_option_key => $role_option_name ) { + $role_option_i++; + + $content .= '
'; + $content .= aui()->input( + array( + 'id' => 'bsvc_user_roles_BSVCINDEX_' . $role_option_i, + 'name' => 'bsvc_user_roles_BSVCINDEX[]', + 'type' => 'checkbox', + 'label' => $role_option_name, + 'label_type' => 'hidden', + 'class' => 'bsvc_user_roles', + 'value' => $role_option_key, + 'switch' => 'md', + 'no_wrap' => true + ) + ); + $content .= '
'; + } + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= aui()->select( + array( + 'id' => 'bsvc_output', + 'name' => 'bsvc_output', + 'label' => __( 'What should happen if rules met.', 'ayecode-connect' ), + 'placeholder' => __( 'Default Output', 'ayecode-connect' ), + 'class' => 'bsvc_output form-select-sm no-select2 mw-100', + 'options' => sd_visibility_output_options(), + 'default' => '', + 'value' => '', + 'label_type' => 'top', + 'select2' => false, + 'extra_attributes' => array( + 'data-minimum-results-for-search' => '-1' + ) + ) + ); + + $content .= '
'; + + $content .= aui()->select( + array( + 'id' => 'bsvc_page', + 'name' => 'bsvc_page', + 'label' => __( 'Page Content', 'ayecode-connect' ), + 'placeholder' => __( 'Select Page ID...', 'ayecode-connect' ), + 'class' => 'bsvc_page form-select-sm no-select2 mw-100', + 'options' => sd_template_page_options(), + 'default' => '', + 'value' => '', + 'label_type' => 'top', + 'select2' => false, + 'element_require' => '[%bsvc_output%]=="page"' + ) + ); + + $content .= aui()->select( + array( + 'id' => 'bsvc_tmpl_part', + 'name' => 'bsvc_tmpl_part', + 'label' => __( 'Template Part', 'ayecode-connect' ), + 'placeholder' => __( 'Select Template Part...', 'ayecode-connect' ), + 'class' => 'bsvc_tmpl_part form-select-sm no-select2 mw-100', + 'options' => sd_template_part_options(), + 'default' => '', + 'value' => '', + 'label_type' => 'top', + 'select2' => false, + 'element_require' => '[%bsvc_output%]=="template_part"', + 'extra_attributes' => array( + 'data-minimum-results-for-search' => '-1' + ) + ) + ); + + $content .= aui()->select( + array( + 'id' => 'bsvc_message_type', + 'name' => 'bsvc_message_type', + 'label' => __( 'Custom Message Type', 'ayecode-connect' ), + 'placeholder' => __( 'Default (none)', 'ayecode-connect' ), + 'class' => 'bsvc_message_type form-select-sm no-select2 mw-100', + 'options' => sd_aui_colors(), + 'default' => '', + 'value' => '', + 'label_type' => 'top', + 'select2' => false, + 'element_require' => '[%bsvc_output%]=="message"', + 'extra_attributes' => array( + 'data-minimum-results-for-search' => '-1' + ) + ) + ); + + $content .= '
'; + + $content .= aui()->input( + array( + 'type' => 'text', + 'id' => 'bsvc_message', + 'name' => 'bsvc_message', + 'label' => '', + 'class' => 'bsvc_message form-control-sm', + 'placeholder' => __( 'CUSTOM MESSAGE TO SHOW', 'ayecode-connect' ), + 'label_type' => '', + 'value' => '', + 'form_group_class' => ' ', + 'element_require' => '[%bsvc_output%]=="message"', + ) + ); + + $content .= '
'; + + return $content; + } + } } diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index afef3fa2..7824d8f7 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -42,35 +42,37 @@ */ class ClassLoader { - /** @var ?string */ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr0 = array(); @@ -78,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array + * @var array */ private $classMap = array(); @@ -87,29 +88,29 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array + * @var array */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); } /** - * @return string[] + * @return array> */ public function getPrefixes() { @@ -121,8 +122,7 @@ public function getPrefixes() } /** - * @return array[] - * @psalm-return array> + * @return array> */ public function getPrefixesPsr4() { @@ -130,8 +130,7 @@ public function getPrefixesPsr4() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirs() { @@ -139,8 +138,7 @@ public function getFallbackDirs() } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirsPsr4() { @@ -148,8 +146,7 @@ public function getFallbackDirsPsr4() } /** - * @return string[] Array of classname => path - * @psalm-return array + * @return array Array of classname => path */ public function getClassMap() { @@ -157,8 +154,7 @@ public function getClassMap() } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap + * @param array $classMap Class to filename map * * @return void */ @@ -175,24 +171,25 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -201,19 +198,19 @@ public function add($prefix, $paths, $prepend = false) $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -222,9 +219,9 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -232,17 +229,18 @@ public function add($prefix, $paths, $prepend = false) */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -252,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false) throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -272,8 +270,8 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories * * @return void */ @@ -290,8 +288,8 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -425,7 +423,8 @@ public function unregister() public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -476,9 +475,9 @@ public function findFile($class) } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array */ public static function getRegisteredLoaders() { @@ -555,18 +554,26 @@ private function findFileWithExtension($class, $ext) return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index d50e0c9f..51e734a7 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -21,12 +21,14 @@ * See also https://getcomposer.org/doc/07-runtime.md#installed-versions * * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final */ class InstalledVersions { /** * @var mixed[]|null - * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null */ private static $installed; @@ -37,7 +39,7 @@ class InstalledVersions /** * @var array[] - * @psalm-var array}> + * @psalm-var array}> */ private static $installedByVendor = array(); @@ -96,7 +98,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; } } @@ -117,7 +119,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true) */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints($constraint); + $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -241,7 +243,7 @@ public static function getInstallPath($packageName) /** * @return array - * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} */ public static function getRootPackage() { @@ -255,7 +257,7 @@ public static function getRootPackage() * * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @return array[] - * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} */ public static function getRawData() { @@ -278,7 +280,7 @@ public static function getRawData() * Returns the raw data of all installed.php which are currently loaded for custom implementations * * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ public static function getAllRawData() { @@ -301,7 +303,7 @@ public static function getAllRawData() * @param array[] $data A vendor/composer/installed.php data set * @return void * - * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data */ public static function reload($data) { @@ -311,7 +313,7 @@ public static function reload($data) /** * @return array[] - * @psalm-return list}> + * @psalm-return list}> */ private static function getInstalled() { @@ -326,7 +328,9 @@ private static function getInstalled() if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -338,12 +342,17 @@ private static function getInstalled() // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; } else { self::$installed = array(); } } - $installed[] = self::$installed; + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } return $installed; } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 9c08f155..3ac14a39 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2,7 +2,7 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index 05da11ff..ec3143e1 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -2,12 +2,12 @@ // autoload_files.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + 'e8d544c98e79f913e13eae1306ab635e' => $vendorDir . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', '942e926b62933a5c0292cfd46ab28c95' => $vendorDir . '/ayecode/wp-country-database/wp-country-database.php', '24583d3588ebda5228dd453cfaa070da' => $vendorDir . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php', '42671a413efb740d7040437ff2a982cd' => $vendorDir . '/ayecode/wp-super-duper/sd-functions.php', - 'e8d544c98e79f913e13eae1306ab635e' => $vendorDir . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', ); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index b7fc0125..15a2ff3a 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 12ea9ccc..e480e283 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index de94e76c..75d10120 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -25,56 +25,26 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; spl_autoload_register(array('ComposerAutoloaderInit3225cff1a6fbcb5c09d8a0b088568404', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInit3225cff1a6fbcb5c09d8a0b088568404', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require __DIR__ . '/autoload_static.php'; + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInit3225cff1a6fbcb5c09d8a0b088568404::getInitializer($loader)); - call_user_func(\Composer\Autoload\ComposerStaticInit3225cff1a6fbcb5c09d8a0b088568404::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } + $loader->register(true); - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } + $filesToLoad = \Composer\Autoload\ComposerStaticInit3225cff1a6fbcb5c09d8a0b088568404::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); + require $file; } - } - - $loader->register(true); - - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit3225cff1a6fbcb5c09d8a0b088568404::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire3225cff1a6fbcb5c09d8a0b088568404($fileIdentifier, $file); + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); } return $loader; } } - -/** - * @param string $fileIdentifier - * @param string $file - * @return void - */ -function composerRequire3225cff1a6fbcb5c09d8a0b088568404($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } -} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 3ec88691..7f9860a7 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -7,10 +7,10 @@ class ComposerStaticInit3225cff1a6fbcb5c09d8a0b088568404 { public static $files = array ( + 'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', '942e926b62933a5c0292cfd46ab28c95' => __DIR__ . '/..' . '/ayecode/wp-country-database/wp-country-database.php', '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php', '42671a413efb740d7040437ff2a982cd' => __DIR__ . '/..' . '/ayecode/wp-super-duper/sd-functions.php', - 'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php', ); public static $prefixLengthsPsr4 = array ( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 642ad7dd..ce6da437 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -55,20 +55,20 @@ }, { "name": "ayecode/wp-ayecode-ui", - "version": "0.2.11", - "version_normalized": "0.2.11.0", + "version": "0.2.12", + "version_normalized": "0.2.12.0", "source": { "type": "git", "url": "https://github.com/AyeCode/wp-ayecode-ui.git", - "reference": "47f6f0ad1b7e2aefe17dc1d6618b8614a4da90c4" + "reference": "b0b1d246540e82c9bbcc62bb22fb4b3151df5b06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AyeCode/wp-ayecode-ui/zipball/47f6f0ad1b7e2aefe17dc1d6618b8614a4da90c4", - "reference": "47f6f0ad1b7e2aefe17dc1d6618b8614a4da90c4", + "url": "https://api.github.com/repos/AyeCode/wp-ayecode-ui/zipball/b0b1d246540e82c9bbcc62bb22fb4b3151df5b06", + "reference": "b0b1d246540e82c9bbcc62bb22fb4b3151df5b06", "shasum": "" }, - "time": "2024-04-11T13:06:14+00:00", + "time": "2024-04-25T09:26:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -97,7 +97,7 @@ ], "support": { "issues": "https://github.com/AyeCode/wp-ayecode-ui/issues", - "source": "https://github.com/AyeCode/wp-ayecode-ui/tree/0.2.11" + "source": "https://github.com/AyeCode/wp-ayecode-ui/tree/0.2.12" }, "install-path": "../ayecode/wp-ayecode-ui" }, @@ -246,24 +246,24 @@ }, { "name": "ayecode/wp-super-duper", - "version": "1.1.37", - "version_normalized": "1.1.37.0", + "version": "1.1.39", + "version_normalized": "1.1.39.0", "source": { "type": "git", "url": "https://github.com/AyeCode/wp-super-duper.git", - "reference": "6ec94389d86572b4975c65881c887858fbfe165c" + "reference": "b6d557cee33213e8b775d4ec595209bab4b8c440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AyeCode/wp-super-duper/zipball/6ec94389d86572b4975c65881c887858fbfe165c", - "reference": "6ec94389d86572b4975c65881c887858fbfe165c", + "url": "https://api.github.com/repos/AyeCode/wp-super-duper/zipball/b6d557cee33213e8b775d4ec595209bab4b8c440", + "reference": "b6d557cee33213e8b775d4ec595209bab4b8c440", "shasum": "" }, "require": { "composer/installers": "~1.0", "php": ">=5.3.0" }, - "time": "2024-04-11T13:01:09+00:00", + "time": "2024-04-18T10:11:36+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -295,7 +295,7 @@ ], "support": { "issues": "https://github.com/AyeCode/wp-super-duper/issues", - "source": "https://github.com/AyeCode/wp-super-duper/tree/1.1.37" + "source": "https://github.com/AyeCode/wp-super-duper/tree/1.1.39" }, "install-path": "../ayecode/wp-super-duper" }, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 1cbafb92..9aed655f 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,85 +1,85 @@ array( + 'name' => 'ayecode/geodirectory', 'pretty_version' => 'dev-master', 'version' => 'dev-master', + 'reference' => 'dbc93f47aed8caa34d2e58ede4a02bcbb3335fe6', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '68b6f9d526f7505e5ec321466252449424112fc4', - 'name' => 'ayecode/geodirectory', 'dev' => true, ), 'versions' => array( 'ayecode/ayecode-connect-helper' => array( 'pretty_version' => '1.0.4', 'version' => '1.0.4.0', + 'reference' => 'd9d9ba849b808a38bb23532e7585c4186bc086cd', 'type' => 'library', 'install_path' => __DIR__ . '/../ayecode/ayecode-connect-helper', 'aliases' => array(), - 'reference' => 'd9d9ba849b808a38bb23532e7585c4186bc086cd', 'dev_requirement' => false, ), 'ayecode/geodirectory' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', + 'reference' => 'dbc93f47aed8caa34d2e58ede4a02bcbb3335fe6', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '68b6f9d526f7505e5ec321466252449424112fc4', 'dev_requirement' => false, ), 'ayecode/wp-ayecode-ui' => array( - 'pretty_version' => '0.2.11', - 'version' => '0.2.11.0', + 'pretty_version' => '0.2.12', + 'version' => '0.2.12.0', + 'reference' => 'b0b1d246540e82c9bbcc62bb22fb4b3151df5b06', 'type' => 'library', 'install_path' => __DIR__ . '/../ayecode/wp-ayecode-ui', 'aliases' => array(), - 'reference' => '47f6f0ad1b7e2aefe17dc1d6618b8614a4da90c4', 'dev_requirement' => false, ), 'ayecode/wp-country-database' => array( 'pretty_version' => '1.0.4', 'version' => '1.0.4.0', + 'reference' => 'c23ae6061fe373525ecd069a5069e376ed9b8178', 'type' => 'library', 'install_path' => __DIR__ . '/../ayecode/wp-country-database', 'aliases' => array(), - 'reference' => 'c23ae6061fe373525ecd069a5069e376ed9b8178', 'dev_requirement' => false, ), 'ayecode/wp-deactivation-survey' => array( 'pretty_version' => '1.0.7', 'version' => '1.0.7.0', + 'reference' => '674f19132ca65e88f600dd212b721bbb8967c678', 'type' => 'library', 'install_path' => __DIR__ . '/../ayecode/wp-deactivation-survey', 'aliases' => array(), - 'reference' => '674f19132ca65e88f600dd212b721bbb8967c678', 'dev_requirement' => false, ), 'ayecode/wp-font-awesome-settings' => array( 'pretty_version' => '1.1.7', 'version' => '1.1.7.0', + 'reference' => 'f52f48d05ff760eb1e22e747a2d011c669f25ed1', 'type' => 'library', 'install_path' => __DIR__ . '/../ayecode/wp-font-awesome-settings', 'aliases' => array(), - 'reference' => 'f52f48d05ff760eb1e22e747a2d011c669f25ed1', 'dev_requirement' => false, ), 'ayecode/wp-super-duper' => array( - 'pretty_version' => '1.1.37', - 'version' => '1.1.37.0', + 'pretty_version' => '1.1.39', + 'version' => '1.1.39.0', + 'reference' => 'b6d557cee33213e8b775d4ec595209bab4b8c440', 'type' => 'library', 'install_path' => __DIR__ . '/../ayecode/wp-super-duper', 'aliases' => array(), - 'reference' => '6ec94389d86572b4975c65881c887858fbfe165c', 'dev_requirement' => false, ), 'composer/installers' => array( 'pretty_version' => '1.x-dev', 'version' => '1.9999999.9999999.9999999-dev', + 'reference' => '894a0b5c5d34c88b69b097f2aae1439730fa6836', 'type' => 'composer-plugin', 'install_path' => __DIR__ . '/./installers', 'aliases' => array(), - 'reference' => '894a0b5c5d34c88b69b097f2aae1439730fa6836', 'dev_requirement' => false, ), 'roundcube/plugin-installer' => array(