Advertisement
Guenni007

toggles

Jan 22nd, 2022
1,047
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 37.79 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Accordion and toggles
  4.  *
  5.  * Creates toggles or accordions
  6.  */
  7. if( ! defined( 'ABSPATH' ) ) {  exit;  }    // Exit if accessed directly
  8.  
  9.  
  10. if( ! class_exists( 'avia_sc_toggle' ) )
  11. {
  12.     class avia_sc_toggle extends aviaShortcodeTemplate
  13.     {
  14.         /**
  15.          *
  16.          * @var int
  17.          */
  18.         static protected $toggle_id = 1;
  19.  
  20.         /**
  21.          *
  22.          * @var int
  23.          */
  24.         static protected $counter = 1;
  25.  
  26.         /**
  27.          *
  28.          * @var int
  29.          */
  30.         static protected $initial = 0;
  31.  
  32.         /**
  33.          *
  34.          * @var array
  35.          */
  36.         static protected $tags = array();
  37.  
  38.         /**
  39.          *
  40.          * @since 4.8.8
  41.          * @var boolean
  42.          */
  43.         protected $in_sc_exec;
  44.  
  45.         /**
  46.          *
  47.          * @since 4.5.5
  48.          * @param AviaBuilder $builder
  49.          */
  50.         public function __construct( $builder )
  51.         {
  52.             $this->in_sc_exec = false;
  53.  
  54.             parent::__construct( $builder );
  55.         }
  56.  
  57.         /**
  58.          * @since 4.5.5
  59.          */
  60.         public function __destruct()
  61.         {
  62.             parent::__destruct();
  63.         }
  64.  
  65.         /**
  66.          * Create the config array for the shortcode button
  67.          */
  68.         function shortcode_insert_button()
  69.         {
  70.             $this->config['version']        = '1.0';
  71.             $this->config['self_closing']   = 'no';
  72.             $this->config['base_element']   = 'yes';
  73.  
  74.             $this->config['name']           = __( 'Accordion', 'avia_framework' );
  75.             $this->config['tab']            = __( 'Content Elements', 'avia_framework' );
  76.             $this->config['icon']           = AviaBuilder::$path['imagesURL'] . 'sc-accordion.png';
  77.             $this->config['order']          = 70;
  78.             $this->config['target']         = 'avia-target-insert';
  79.             $this->config['shortcode']      = 'av_toggle_container';
  80.             $this->config['shortcode_nested'] = array( 'av_toggle' );
  81.             $this->config['tooltip']        = __( 'Creates toggles or accordions (can be used for FAQ)', 'avia_framework' );
  82.             $this->config['preview']        = 'large';
  83.             $this->config['disabling_allowed'] = true;
  84.             $this->config['id_name']        = 'id';
  85.             $this->config['id_show']        = 'yes';
  86.             $this->config['alb_desc_id']    = 'alb_description';
  87.             $this->config['name_item']      = __( 'Accordion Item', 'avia_framework' );
  88.             $this->config['tooltip_item']   = __( 'An Accordion Item (toggle, accordions, FAQ)', 'avia_framework' );
  89.         }
  90.  
  91.         function admin_assets()
  92.         {
  93.             $ver = AviaBuilder::VERSION;
  94.  
  95.             wp_register_script('avia_tab_toggle_js', AviaBuilder::$path['assetsURL'] . 'js/avia-tab-toggle.js', array( 'avia_modal_js' ), $ver, true );
  96.             Avia_Builder()->add_registered_admin_script( 'avia_tab_toggle_js' );
  97.         }
  98.  
  99.         function extra_assets()
  100.         {
  101.             //load css
  102.             wp_enqueue_style( 'avia-module-toggles', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/toggles/toggles.css', array( 'avia-layout' ), false );
  103.  
  104.                 //load js
  105.             wp_enqueue_script( 'avia-module-toggles', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/toggles/toggles.js', array( 'avia-shortcodes' ), false, true );
  106.         }
  107.  
  108.  
  109.         /**
  110.          * Popup Elements
  111.          *
  112.          * If this function is defined in a child class the element automatically gets an edit button, that, when pressed
  113.          * opens a modal window that allows to edit the element properties
  114.          *
  115.          * @return void
  116.          */
  117.         function popup_elements()
  118.         {
  119.             $this->elements = array(
  120.  
  121.                 array(
  122.                         'type'  => 'tab_container',
  123.                         'nodescription' => true
  124.                     ),
  125.  
  126.                 array(
  127.                         'type'  => 'tab',
  128.                         'name'  => __( 'Content', 'avia_framework' ),
  129.                         'nodescription' => true
  130.                     ),
  131.  
  132.                     array(
  133.                             'type'          => 'template',
  134.                             'template_id'   => 'toggle_container',
  135.                             'templates_include' => array(
  136.                                                     $this->popup_key( 'content_togles' ),
  137.                                                     $this->popup_key( 'content_behaviour' )
  138.                                                 ),
  139.                             'nodescription' => true
  140.                         ),
  141.  
  142.                 array(
  143.                         'type'  => 'tab_close',
  144.                         'nodescription' => true
  145.                     ),
  146.  
  147.                 array(
  148.                         'type'  => 'tab',
  149.                         'name'  => __( 'Styling', 'avia_framework' ),
  150.                         'nodescription' => true
  151.                     ),
  152.  
  153.                     array(
  154.                             'type'          => 'template',
  155.                             'template_id'   => 'toggle_container',
  156.                             'templates_include' => array(
  157.                                                     $this->popup_key( 'styling_toggles' ),
  158.                                                     $this->popup_key( 'styling_colors' )
  159.                                                 ),
  160.                             'nodescription' => true
  161.                         ),
  162.  
  163.                 array(
  164.                         'type'  => 'tab_close',
  165.                         'nodescription' => true
  166.                     ),
  167.  
  168.                 array(
  169.                         'type'  => 'tab',
  170.                         'name'  => __( 'Advanced', 'avia_framework' ),
  171.                         'nodescription' => true
  172.                     ),
  173.  
  174.                     array(
  175.                             'type'  => 'toggle_container',
  176.                             'nodescription' => true
  177.                         ),
  178.  
  179.                         array(
  180.                                 'type'          => 'template',
  181.                                 'template_id'   => 'screen_options_toggle',
  182.                                 'lockable'      => true
  183.                             ),
  184.  
  185.                         array(
  186.                                 'type'          => 'template',
  187.                                 'template_id'   => 'developer_options_toggle',
  188.                                 'args'          => array( 'sc' => $this )
  189.                             ),
  190.  
  191.                     array(
  192.                             'type'  => 'toggle_container_close',
  193.                             'nodescription' => true
  194.                         ),
  195.  
  196.                 array(
  197.                         'type'  => 'tab_close',
  198.                         'nodescription' => true
  199.                     ),
  200.  
  201.                 array(
  202.                         'type'          => 'template',
  203.                         'template_id'   => 'element_template_selection_tab',
  204.                         'args'          => array( 'sc' => $this )
  205.                     ),
  206.  
  207.                 array(
  208.                         'type'  => 'tab_container_close',
  209.                         'nodescription' => true
  210.                     )
  211.  
  212.  
  213.                 );
  214.  
  215.         }
  216.  
  217.         /**
  218.          * Create and register templates for easier maintainance
  219.          *
  220.          * @since 4.6.4
  221.          */
  222.         protected function register_dynamic_templates()
  223.         {
  224.  
  225.             $this->register_modal_group_templates();
  226.  
  227.             /**
  228.              * Content Tab
  229.              * ===========
  230.              */
  231.  
  232.             $c = array(
  233.                         array(
  234.                             'name'          => __( 'Add/Edit Toggles', 'avia_framework' ),
  235.                             'desc'          => __( 'Here you can add, remove and edit the toggles you want to display.', 'avia_framework' ),
  236.                             'type'          => 'modal_group',
  237.                             'id'            => 'content',
  238.                             'modal_title'   => __( 'Edit Form Element', 'avia_framework' ),
  239.                             'editable_item' => true,
  240.                             'lockable'      => true,
  241.                             'tmpl_set_default'  => false,
  242.                             'std'           => array(
  243.                                                     array( 'title' => __( 'Toggle 1', 'avia_framework' ), 'tags' => '' ),
  244.                                                     array( 'title' => __( 'Toggle 2', 'avia_framework' ), 'tags' => '' ),
  245.                                                 ),
  246.                             'subelements'   => $this->create_modal()
  247.                         ),
  248.  
  249.                         array(
  250.                             'name'  => __( 'Use as FAQ Page (SEO improvement)', 'avia_framework' ),
  251.                             'desc'  => __( 'Select if content is used as FAQ and add schema.org markup to support Google Search. You must enable theme option &quot;Automated Schema.org HTML Markup&quot; (SEO tab). For valid structured HTML only one FAQ section allowed per page - you can activate &quot;Sorting&quot; and group questions if needed.', 'avia_framework' ),
  252.                             'id'    => 'faq_markup',
  253.                             'type'  => 'select',
  254.                             'std'   => '',
  255.                             'lockable'  => true,
  256.                             'tmpl_set_default'  => false,
  257.                             'subtype'   => array(
  258.                                                 __( 'No markup needed', 'avia_framework' )  => '',
  259.                                                 __( 'Add FAQ markup', 'avia_framework' )    => 'faq_markup'
  260.                                             )
  261.                         )
  262.  
  263.                 );
  264.  
  265.             $template = array(
  266.                             array(
  267.                                 'type'          => 'template',
  268.                                 'template_id'   => 'toggle',
  269.                                 'title'         => __( 'Toggles', 'avia_framework' ),
  270.                                 'content'       => $c
  271.                             ),
  272.                     );
  273.  
  274.             AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'content_togles' ), $template );
  275.  
  276.  
  277.             $c = array(
  278.                         array(
  279.                             'name'  => __( 'Initial Open', 'avia_framework' ),
  280.                             'desc'  => __( 'Enter the Number of the Accordion Item that should be open initially. Set to Zero if all should be close on page load', 'avia_framework' ),
  281.                             'id'    => 'initial',
  282.                             'type'  => 'input',
  283.                             'std'   => '0',
  284.                             'lockable'  => true,
  285.                         ),
  286.  
  287.                         array(
  288.                             'name'  => __( 'Behavior', 'avia_framework' ),
  289.                             'desc'  => __( 'Should only one toggle be active at a time and the others be hidden or can multiple toggles be open at the same time?', 'avia_framework' ),
  290.                             'id'    => 'mode',
  291.                             'type'  => 'select',
  292.                             'std'   => 'accordion',
  293.                             'lockable'  => true,
  294.                             'subtype'   => array(
  295.                                                 __( 'Only one toggle open at a time (Accordion Mode)', 'avia_framework' )   => 'accordion',
  296.                                                 __( 'Multiple toggles open allowed (Toggle Mode)', 'avia_framework' )       => 'toggle'
  297.                                             )
  298.                         ),
  299.  
  300.                         array(
  301.                             'name'  => __( 'Sorting', 'avia_framework' ),
  302.                             'desc'  => __( 'Display the toggle sorting menu? (You also need to add a number of tags to each toggle to make sorting possible)', 'avia_framework' ),
  303.                             'id'    => 'sort',
  304.                             'type'  => 'select',
  305.                             'std'   => '',
  306.                             'lockable'  => true,
  307.                             'subtype'   => array(
  308.                                                 __( 'No Sorting', 'avia_framework' )        => '',
  309.                                                 __( 'Sorting Active', 'avia_framework' )    => 'true'
  310.                                             )
  311.                         )
  312.  
  313.                 );
  314.  
  315.             $template = array(
  316.                             array(
  317.                                 'type'          => 'template',
  318.                                 'template_id'   => 'toggle',
  319.                                 'title'         => __( 'Behaviour', 'avia_framework' ),
  320.                                 'content'       => $c
  321.                             ),
  322.                     );
  323.  
  324.             AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'content_behaviour' ), $template );
  325.  
  326.             /**
  327.              * Styling Tab
  328.              * ===========
  329.              */
  330.  
  331.             $c = array(
  332.                         array(
  333.                             'name'  => __( 'Styling', 'avia_framework' ),
  334.                             'desc'  => __( 'Select the styling of the toggles', 'avia_framework' ),
  335.                             'id'    => 'styling',
  336.                             'type'  => 'select',
  337.                             'std'   => '',
  338.                             'lockable'  => true,
  339.                             'subtype'   => array(
  340.                                                 __( 'Default', 'avia_framework' )   => '',
  341.                                                 __( 'Minimal', 'avia_framework' )   => 'av-minimal-toggle',
  342.                                                 __( 'Elegant', 'avia_framework' )   => 'av-elegant-toggle'
  343.                                             )
  344.                         ),
  345.  
  346.  
  347.                 );
  348.  
  349.             $template = array(
  350.                             array(
  351.                                 'type'          => 'template',
  352.                                 'template_id'   => 'toggle',
  353.                                 'title'         => __( 'Toggles Styling', 'avia_framework' ),
  354.                                 'content'       => $c
  355.                             ),
  356.                     );
  357.  
  358.             AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_toggles' ), $template );
  359.  
  360.             $c = array(
  361.                         array(
  362.                             'name'  => __( 'Colors', 'avia_framework' ),
  363.                             'desc'  => __( 'Either use the themes default colors or apply some custom ones', 'avia_framework' ),
  364.                             'id'    => 'colors',
  365.                             'type'  => 'select',
  366.                             'std'   => '',
  367.                             'lockable'  => true,
  368.                             'subtype'   => array(
  369.                                                 __( 'Default', 'avia_framework' )               => '',
  370.                                                 __( 'Define Custom Colors', 'avia_framework' )  => 'custom'
  371.                                             ),
  372.                         ),
  373.  
  374.                         array(
  375.                             'name'  => __( 'Custom Font Color', 'avia_framework' ),
  376.                             'desc'  => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  377.                             'id'    => 'font_color',
  378.                             'type'  => 'colorpicker',
  379.                             'std'   => '',
  380.                             'rgba'  => true,
  381.                             'lockable'  => true,
  382.                             'required'  => array( 'colors', 'equals', 'custom' ),
  383.                             'container_class'   => 'av_third av_third_first'
  384.                         ),
  385.  
  386.                         array(
  387.                             'name'  => __( 'Custom Background Color', 'avia_framework' ),
  388.                             'desc'  => __( 'Select a custom background color. Leave empty to use the default', 'avia_framework' ),
  389.                             'id'    => 'background_color',
  390.                             'type'  => 'colorpicker',
  391.                             'std'   => '',
  392.                             'rgba'  => true,
  393.                             'lockable'  => true,
  394.                             'required'  => array( 'colors', 'equals', 'custom' ),
  395.                             'container_class'   => 'av_third',
  396.                         ),
  397.  
  398.                         array(
  399.                             'name'  => __( 'Custom Border Color', 'avia_framework' ),
  400.                             'desc'  => __( 'Select a custom border color. Leave empty to use the default', 'avia_framework' ),
  401.                             'id'    => 'border_color',
  402.                             'type'  => 'colorpicker',
  403.                             'std'   => '',
  404.                             'rgba'  => true,
  405.                             'lockable'  => true,
  406.                             'required'  => array( 'colors', 'equals', 'custom' ),
  407.                             'container_class'   => 'av_third',
  408.                         ),
  409.  
  410.                         array(
  411.                             'name'  => __( 'Custom +/- Icon Color', 'avia_framework' ),
  412.                             'desc'  => __( 'Select a custom color for the toggle icon. Leave empty to use default', 'avia_framework' ),
  413.                             'id'    => 'toggle_icon_color',
  414.                             'type'  => 'colorpicker',
  415.                             'std'   => '',
  416.                             'rgba'  => true,
  417.                             'lockable'  => true,
  418.                             'required'  => array( 'colors', 'equals', 'custom' ),
  419.                             'container_class'   => 'av_third av_third_first',
  420.                         ),
  421.  
  422.                         array(
  423.                             'name'  => __( 'Current Toggle Appearance', 'avia_framework' ),
  424.                             'desc'  => __( 'Highlight title bar of open toggles', 'avia_framework' ),
  425.                             'id'    => 'colors_current',
  426.                             'type'  => 'select',
  427.                             'std'   => '',
  428.                             'lockable'  => true,
  429.                             'subtype'   => array(
  430.                                                 __( 'Default', 'avia_framework' )               => '',
  431.                                                 __( 'Define Custom Colors', 'avia_framework' )  => 'custom'
  432.                                             ),
  433.                         ),
  434.  
  435.                         array(
  436.                             'name'  => __( 'Custom Font Color Current Toggle', 'avia_framework' ),
  437.                             'desc'  => __( 'Select a custom font color for the current active toggle. Leave empty to use the default', 'avia_framework' ),
  438.                             'id'    => 'font_color_current',
  439.                             'type'  => 'colorpicker',
  440.                             'std'   => '',
  441.                             'rgba'  => true,
  442.                             'lockable'  => true,
  443.                             'required'  => array( 'colors_current', 'equals', 'custom' ),
  444.                             'container_class'   => 'av_half av_half_first',
  445.                         ),
  446.  
  447.                         array(
  448.                             'name'  => __( 'Custom +/- Icon Color Current Toggle', 'avia_framework' ),
  449.                             'desc'  => __( 'Select a custom color for the current active toggle icon. Leave empty to use default', 'avia_framework' ),
  450.                             'id'    => 'toggle_icon_color_current',
  451.                             'type'  => 'colorpicker',
  452.                             'std'   => '',
  453.                             'rgba'  => true,
  454.                             'lockable'  => true,
  455.                             'required'  => array( 'colors_current', 'equals', 'custom' ),
  456.                             'container_class'   => 'av_half',
  457.                         ),
  458.  
  459.                         array(
  460.                             'name'  => __( 'Background Current Toggle', 'avia_framework' ),
  461.                             'desc'  => __( 'Select the type of background for the current active toggle title bar.', 'avia_framework' ),
  462.                             'id'    => 'background_current',
  463.                             'type'  => 'select',
  464.                             'std'   => '',
  465.                             'lockable'  => true,
  466.                             'required'  => array( 'colors_current', 'equals', 'custom' ),
  467.                             'subtype'   => array(
  468.                                                 __( 'Default', 'avia_framework' )               => '',
  469.                                                 __( 'Background Color', 'avia_framework' )      => 'bg_color',
  470.                                                 __( 'Background Gradient', 'avia_framework' )   => 'bg_gradient',
  471.                                             )
  472.                         ),
  473.  
  474.                         array(
  475.                             'name'  => __( 'Title Bar Custom Background Color', 'avia_framework' ),
  476.                             'desc'  => __( 'Select a custom background color. Leave empty for default color', 'avia_framework' ),
  477.                             'id'    => 'background_color_current',
  478.                             'type'  => 'colorpicker',
  479.                             'std'   => '',
  480.                             'rgba'  => true,
  481.                             'lockable'  => true,
  482.                             'required'  => array( 'background_current', 'equals', 'bg_color' ),
  483.                         ),
  484.  
  485.                         array(
  486.                             'type'          => 'template',
  487.                             'template_id'   => 'gradient_colors',
  488.                             'id'            => array( 'background_gradient_current_direction', 'background_gradient_current_color1', 'background_gradient_current_color2', 'background_gradient_current_color3' ),
  489.                             'lockable'      => true,
  490.                             'required'      => array( 'background_current', 'equals', 'bg_gradient' ),
  491.                             'container_class'   => array( '', 'av_third av_third_first', 'av_third', 'av_third' )
  492.                         ),
  493.  
  494.                         array(
  495.                             'name'  => __( 'Hover Toggle Appearance', 'avia_framework' ),
  496.                             'desc'  => __( 'Appearance of toggles on mouse hover', 'avia_framework' ),
  497.                             'id'    => 'hover_colors',
  498.                             'type'  => 'select',
  499.                             'std'   => '',
  500.                             'lockable'  => true,
  501.                             'subtype'   => array(
  502.                                                 __( 'Default', 'avia_framework' )               => '',
  503.                                                 __( 'Define Custom Colors', 'avia_framework' )  => 'custom'
  504.                                             ),
  505.                         ),
  506.  
  507.                         array(
  508.                             'name'  => __( 'Custom Hover Font Color', 'avia_framework' ),
  509.                             'desc'  => __( 'Select a custom hover font color. Leave empty to use the default', 'avia_framework' ),
  510.                             'id'    => 'hover_font_color',
  511.                             'type'  => 'colorpicker',
  512.                             'std'   => '',
  513.                             'rgba'  => true,
  514.                             'lockable'  => true,
  515.                             'container_class' => 'av_third av_third_first',
  516.                             'required'  => array( 'hover_colors', 'equals', 'custom' )
  517.                         ),
  518.  
  519.                         array(
  520.                             'name'  => __( 'Custom Hover Background Color', 'avia_framework' ),
  521.                             'desc'  => __( 'Select a custom hover background color. Leave empty to use the default', 'avia_framework' ),
  522.                             'id'    => 'hover_background_color',
  523.                             'type'  => 'colorpicker',
  524.                             'std'   => '',
  525.                             'rgba'  => true,
  526.                             'lockable'  => true,
  527.                             'container_class' => 'av_third',
  528.                             'required'  => array( 'hover_colors', 'equals', 'custom')
  529.                         ),
  530.  
  531.                         array(
  532.                             'name'  => __( 'Custom Hover +/- Icon Color', 'avia_framework' ),
  533.                             'desc'  => __( 'Select a custom hover color for the toggle icon. Leave empty to use &quot;Custom Hover Font Color&quot;', 'avia_framework' ),
  534.                             'id'    => 'hover_toggle_icon_color',
  535.                             'type'  => 'colorpicker',
  536.                             'std'   => '',
  537.                             'rgba'  => true,
  538.                             'lockable'  => true,
  539.                             'container_class' => 'av_third',
  540.                             'required'  => array( 'hover_colors', 'equals', 'custom')
  541.                         )
  542.  
  543.                 );
  544.  
  545.             $template = array(
  546.                             array(
  547.                                 'type'          => 'template',
  548.                                 'template_id'   => 'toggle',
  549.                                 'title'         => __( 'Colors', 'avia_framework' ),
  550.                                 'content'       => $c
  551.                             ),
  552.                     );
  553.  
  554.             AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_colors' ), $template );
  555.  
  556.         }
  557.  
  558.         /**
  559.          * Creates the modal popup for a single entry
  560.          *
  561.          * @since 4.6.4
  562.          * @return array
  563.          */
  564.         protected function create_modal()
  565.         {
  566.             $elements = array(
  567.  
  568.                 array(
  569.                         'type'  => 'tab_container',
  570.                         'nodescription' => true
  571.                     ),
  572.  
  573.                 array(
  574.                         'type'  => 'tab',
  575.                         'name'  => __( 'Content', 'avia_framework' ),
  576.                         'nodescription' => true
  577.                     ),
  578.  
  579.                     array(
  580.                             'type'          => 'template',
  581.                             'template_id'   => $this->popup_key( 'modal_content_toggle' )
  582.                         ),
  583.  
  584.                 array(
  585.                         'type'  => 'tab_close',
  586.                         'nodescription' => true
  587.                     ),
  588.  
  589.                 array(
  590.                         'type'  => 'tab',
  591.                         'name'  => __( 'Advanced', 'avia_framework' ),
  592.                         'nodescription' => true
  593.                     ),
  594.  
  595.                     array(
  596.                             'type'          => 'template',
  597.                             'template_id'   => 'toggle_container',
  598.                             'templates_include' => array(
  599.                                                     $this->popup_key( 'modal_advanced_developer' )
  600.                                                 ),
  601.                             'nodescription' => true
  602.                         ),
  603.  
  604.                 array(
  605.                         'type'  => 'tab_close',
  606.                         'nodescription' => true
  607.                     ),
  608.  
  609.                 array(
  610.                         'type'          => 'template',
  611.                         'template_id'   => 'element_template_selection_tab',
  612.                         'args'          => array(
  613.                                                 'sc'            => $this,
  614.                                                 'modal_group'   => true
  615.                                             )
  616.                     ),
  617.  
  618.                 array(
  619.                         'type'  => 'tab_container_close',
  620.                         'nodescription' => true
  621.                     )
  622.  
  623.  
  624.                 );
  625.  
  626.             return $elements;
  627.         }
  628.  
  629.         /**
  630.          * Register all templates for the modal group popup
  631.          *
  632.          * @since 4.6.4
  633.          */
  634.         protected function register_modal_group_templates()
  635.         {
  636.             /**
  637.              * Content Tab
  638.              * ===========
  639.              */
  640.  
  641.             $c = array(
  642.                         array(
  643.                             'name'  => __( 'Toggle Title', 'avia_framework' ),
  644.                             'desc'  => __( 'Enter the toggle title here (Better keep it short)', 'avia_framework' ),
  645.                             'id'    => 'title',
  646.                             'type'  => 'input',
  647.                             'std'   => 'Toggle Title',
  648.                             'lockable'  => true,
  649.                         ),
  650.  
  651.                         array(
  652.                             'name'  => __( 'Toggle Content', 'avia_framework' ),
  653.                             'desc'  => __( 'Enter some content here', 'avia_framework' ),
  654.                             'id'    => 'content',
  655.                             'type'  => 'tiny_mce',
  656.                             'std'   => __( 'Toggle Content goes here', 'avia_framework' ),
  657.                             'lockable'  => true,
  658.                         ),
  659.  
  660.                         array(
  661.                             'name'  => __( 'Toggle Sorting Tags', 'avia_framework' ),
  662.                             'desc'  => __( 'Enter any number of comma separated tags here. If sorting is active the user can filter the visible toggles with the help of these tags', 'avia_framework' ),
  663.                             'id'    => 'tags',
  664.                             'type'  => 'input',
  665.                             'std'   => '',
  666.                             'lockable'  => true,
  667.                         ),
  668.  
  669.                 );
  670.  
  671.             AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_content_toggle' ), $c );
  672.  
  673.             $setting_id = Avia_Builder()->get_developer_settings( 'custom_id' );
  674.             $class = in_array( $setting_id, array( 'deactivate', 'hide' ) ) ? 'avia-hidden' : '';
  675.  
  676.             $c = array(
  677.                         array(
  678.                             'name'  => __( 'For Developers: Custom Tab ID','avia_framework' ),
  679.                             'desc'  => __( 'Insert a custom ID for the element here. Make sure to only use allowed characters (latin characters, underscores, dashes and numbers, no special characters can be used)','avia_framework' ),
  680.                             'id'    => 'custom_id',
  681.                             'type'  => 'input',
  682.                             'std'   => '',
  683.                             'container_class'   => $class,
  684.                         )
  685.                 );
  686.  
  687.             $template = array(
  688.                             array(
  689.                                 'type'          => 'template',
  690.                                 'template_id'   => 'toggle',
  691.                                 'title'         => __( 'Developer Settings', 'avia_framework' ),
  692.                                 'content'       => $c
  693.                             ),
  694.                     );
  695.  
  696.             AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_advanced_developer' ), $template );
  697.  
  698.         }
  699.  
  700.  
  701.         /**
  702.          * Editor Sub Element - this function defines the visual appearance of an element that is displayed within a modal window and on click opens its own modal window
  703.          * Works in the same way as Editor Element
  704.          * @param array $params this array holds the default values for $content and $args.
  705.          * @return $params the return array usually holds an innerHtml key that holds item specific markup.
  706.          */
  707.         function editor_sub_element( $params )
  708.         {
  709.             $default = array();
  710.             $locked = array();
  711.             $attr = $params['args'];
  712.             Avia_Element_Templates()->set_locked_attributes( $attr, $this, $this->config['shortcode_nested'][0], $default, $locked );
  713.  
  714.             $template = $this->update_option_lockable( 'title', $locked );
  715.  
  716.             $params['innerHtml']  = '';
  717.             $params['innerHtml'] .= "<div class='avia_title_container' {$template} data-update_element_template='yes'>{$attr['title']}</div>";
  718.  
  719.             return $params;
  720.         }
  721.  
  722.         /**
  723.          * Create custom stylings
  724.          *
  725.          * @since 4.8.4
  726.          * @param array $args
  727.          * @return array
  728.          */
  729.         protected function get_element_styles( array $args )
  730.         {
  731.             $result = parent::get_element_styles( $args );
  732.  
  733.             extract( $result );
  734.  
  735.             $default = array(
  736.                         'initial'           => '0',
  737.                         'mode'              => 'accordion',
  738.                         'sort'              => '',
  739.                         'faq_markup'        => '',
  740.                         'styling'           => '',
  741.                         'colors'            => '',
  742.                         'border_color'      => '',
  743.                         'toggle_icon_color' => '',
  744.                         'font_color'        => '',
  745.                         'background_color'  => '',
  746.                         'colors_current'    => '',
  747.                         'font_color_current'        => '',
  748.                         'toggle_icon_color_current' => '',
  749.                         'background_current'        => '',
  750.                         'background_color_current'  => '',
  751.                         'background_gradient_current_color1'    => '',
  752.                         'background_gradient_current_color2'    => '',
  753.                         'background_gradient_current_color3'    => '',
  754.                         'background_gradient_current_direction' => '',
  755.                         'hover_colors'              => '',
  756.                         'hover_background_color'    => '',
  757.                         'hover_font_color'          => ''
  758.                 );
  759.  
  760.             $default = $this->sync_sc_defaults_array( $default, 'no_modal_item', 'no_content' );
  761.  
  762.  
  763.             $locked = array();
  764.             Avia_Element_Templates()->set_locked_attributes( $atts, $this, $shortcodename, $default, $locked, $content );
  765.             Avia_Element_Templates()->add_template_class( $meta, $atts, $default );
  766.  
  767.             $this->in_sc_exec = true;
  768.  
  769.             $atts = shortcode_atts( $default, $atts, $this->config['shortcode'] );
  770.  
  771.  
  772.             if( ! is_numeric( $atts['initial'] ) || $atts['initial'] < 0 )
  773.             {
  774.                 $atts['initial'] = 0;
  775.             }
  776.             else
  777.             {
  778.                 $atts['initial'] = (int) $atts['initial'];
  779.                 $nr_toggles = substr_count( $content, '[av_toggle ' );
  780.  
  781.                 if( $atts['initial'] > $nr_toggles )
  782.                 {
  783.                     $atts['initial'] = $nr_toggles;
  784.                 }
  785.             }
  786.  
  787.             $element_styling->create_callback_styles( $atts );
  788.  
  789.             $classes = array(
  790.                         'togglecontainer',
  791.                         $element_id,
  792.                         $atts['styling']
  793.                     );
  794.  
  795.             $element_styling->add_classes( 'container', $classes );
  796.             $element_styling->add_classes_from_array( 'container', $meta, 'el_class' );
  797.             $element_styling->add_responsive_classes( 'container', 'hide_element', $atts );
  798.  
  799.             if( $atts['mode'] == 'accordion' )
  800.             {
  801.                 $element_styling->add_classes( 'container', 'toggle_close_all' );
  802.             }
  803.  
  804.             $cols = array(
  805.                         'color'             => $atts['font_color'],
  806.                         'background-color'  => $atts['background_color'],
  807.                         'border-color'      => $atts['border_color']
  808.                     );
  809.  
  810.             if( 'custom' == $atts['colors'] )
  811.             {
  812.                 /**
  813.                  * Styling: when font color is set, then icon gets font color, else border color
  814.                  */
  815.                 $element_styling->add_styles( 'toggle', $cols );
  816.                 $element_styling->add_styles( 'toggle-content', $cols );
  817.  
  818.                 $icon_color = '';
  819.                 if( ! empty( $atts['font_color'] ) || ! empty( $atts['toggle_icon_color'] ) )
  820.                 {
  821.                     $icon_color = ! empty( $atts['toggle_icon_color'] ) ? $atts['toggle_icon_color'] : $atts['font_color'];
  822.                 }
  823.  
  824.                 if( ! empty( $icon_color ) )
  825.                 {
  826.                     $element_styling->add_styles( 'toggle-icon', array(
  827.                                                             'color'         => $icon_color,
  828.                                                             'border-color'  => $icon_color
  829.                                                         ) );
  830.  
  831.                     if( empty( $atts['toggle_icon_color'] ) )
  832.                     {
  833.                         $element_styling->add_classes( 'item_inherit', array( 'av-inherit-font-color', 'hasCustomColor' ) );
  834.                     }
  835.                     else
  836.                     {
  837.                         $element_styling->add_styles( 'toggle-icon-inner', array(
  838.                                                             'color'         => $icon_color,
  839.                                                             'border-color'  => $icon_color
  840.                                                         ) );
  841.                     }
  842.                 }
  843.  
  844.                 if( ! empty( $atts['border_color'] ) )
  845.                 {
  846.                     $element_styling->add_classes( 'item_inherit', 'av-inherit-border-color' );
  847.                 }
  848.             }
  849.  
  850.             if( 'custom' == $atts['colors_current'] )
  851.             {
  852.                 if( ! empty( $atts['font_color_current'] ) )
  853.                 {
  854.                     $element_styling->add_styles( 'toggle-current', array(
  855.                                                                     'color'         => $atts['font_color_current'],
  856.                                                                     'border-color'  => $atts['font_color_current']
  857.                                                                 ) );
  858.  
  859.                     if( ! ( 'custom' == $atts['colors'] && ! empty( $atts['toggle_icon_color'] ) ) )
  860.                     {
  861.                         $element_styling->add_classes( 'container', 'hasCurrentStyle' );
  862.                     }
  863.                 }
  864.  
  865.                 if( ! empty( $atts['toggle_icon_color_current'] ) )
  866.                 {
  867.                     $element_styling->add_styles( 'toggle-icon-current', array(
  868.                                                                     'color'         => $atts['toggle_icon_color_current'],
  869.                                                                     'border-color'  => $atts['toggle_icon_color_current']
  870.                                                                 ) );
  871.                 }
  872.  
  873.                 if( 'bg_color' == $atts['background_current'] )
  874.                 {
  875.                     $element_styling->add_styles( 'toggle-current', array( 'background-color' => $atts['background_color_current'] ) );
  876.                 }
  877.                 else if( 'bg_gradient' == $atts['background_current'] )
  878.                 {
  879.                     $element_styling->add_callback_styles( 'toggle-current', array( 'background_gradient_current_direction' ) );
  880.                 }
  881.             }
  882.  
  883.             if( 'custom' == $atts['hover_colors'] )
  884.             {
  885.                 $element_styling->add_styles( 'toggle-hover-not', array(
  886.                                                                     'color'             => $atts['hover_font_color'],
  887.                                                                     'background-color'  => $atts['hover_background_color']
  888.                                                                 ) );
  889.  
  890.                 $icon_color = ! empty( $atts['hover_toggle_icon_color'] ) ? $atts['hover_toggle_icon_color'] : $atts['hover_font_color'];
  891.  
  892.                 //  must be important due to shortcode.css !!
  893.                 $element_styling->add_styles( 'toggle-icon-hover-not', array( 'border-color' => $icon_color . ' !important' ) );
  894.             }
  895.  
  896.             //  #top needed when placed inside section
  897.             $selectors = array(
  898.                         'container'         => "#top .togglecontainer.{$element_id}",
  899.                         'toggle'            => "#top .togglecontainer.{$element_id} h3.toggler",
  900.                         'toggle-current'    => "#top .togglecontainer.{$element_id} h3.toggler.activeTitle",
  901.                         'toggle-hover'      => "#top .togglecontainer.{$element_id} h3.toggler:hover",
  902.                         'toggle-hover-not'  => "#top .togglecontainer.{$element_id} h3.toggler:not(.activeTitle):hover",
  903.                         'toggle-icon-hover-not' => "#top .togglecontainer.{$element_id} h3.toggler:not(.activeTitle):hover .toggle_icon, #top .togglecontainer.{$element_id} h3.toggler:not(.activeTitle):hover .toggle_icon *",
  904.                         'toggle-icon'       => "#top .togglecontainer.{$element_id} h3.toggler .toggle_icon",
  905.                         'toggle-icon-inner' => "#top .togglecontainer.{$element_id} h3.toggler .toggle_icon > span",
  906.                         'toggle-icon-current'   => "#top .togglecontainer.{$element_id} h3.toggler.activeTitle .toggle_icon, #top .togglecontainer.{$element_id} h3.toggler.activeTitle .toggle_icon > span",
  907.                         'toggle-content'    => "#top .togglecontainer.{$element_id} .toggle_wrap .toggle_content",
  908.                     );
  909.  
  910.             $element_styling->add_selectors( $selectors );
  911.  
  912.             $result['default'] = $default;
  913.             $result['atts'] = $atts;
  914.             $result['content'] = $content;
  915.             $result['element_styling'] = $element_styling;
  916.  
  917.             $this->parent_atts = $atts;
  918.             avia_sc_toggle::$initial = $atts['initial'];
  919.             avia_sc_toggle::$tags = array();
  920.  
  921.             $this->el_styling = $element_styling;
  922.  
  923.             return $result;
  924.         }
  925.  
  926.         /**
  927.          * Create custom stylings for items
  928.          *
  929.          * @since 4.8.4
  930.          * @param array $args
  931.          * @return array
  932.          */
  933.         protected function get_element_styles_item( array $args )
  934.         {
  935.             $result = parent::get_element_styles_item( $args );
  936.  
  937.             /**
  938.              * Fixes a problem when 3-rd party plugins call nested shortcodes without executing main shortcode  (like YOAST in wpseo-filter-shortcodes)
  939.              */
  940.             if( ! $this->in_sc_exec )
  941.             {
  942.                 return $result;
  943.             }
  944.  
  945.             extract( $result );
  946.  
  947.             $default = array(
  948.                         'title'         => '',
  949.                         'tags'          => '',
  950.                         'custom_id'     => '',
  951.                         'custom_markup' => ''
  952.                 );
  953.  
  954.             $default = $this->sync_sc_defaults_array( $default, 'modal_item', 'no_content' );
  955.  
  956.  
  957.             $locked = array();
  958.             Avia_Element_Templates()->set_locked_attributes( $atts, $this, $shortcodename, $default, $locked, $content );
  959.  
  960.             $atts = shortcode_atts( $default, $atts, $this->config['shortcode_nested'][0] );
  961.  
  962.  
  963.             $classes = array(
  964.                         'av_toggle_section',
  965.                         $element_id
  966.                     );
  967.  
  968.             $element_styling->add_classes( 'container', $classes );
  969.  
  970.  
  971.  
  972.             $selectors = array(
  973.                         'container' => ".togglecontainer .av_toggle_section.{$element_id}",
  974.                         'toggler'   => ".togglecontainer .av_toggle_section.{$element_id} .toggler"
  975.                     );
  976.  
  977.             $element_styling->add_selectors( $selectors );
  978.  
  979.             $result['default'] = $default;
  980.             $result['atts'] = $atts;
  981.             $result['content'] = $content;
  982.             $result['element_styling'] = $element_styling;
  983.  
  984.             return $result;
  985.         }
  986.  
  987.         /**
  988.          * Frontend Shortcode Handler
  989.          *
  990.          * @param array $atts array of attributes
  991.          * @param string $content text within enclosing form of shortcode element
  992.          * @param string $shortcodename the shortcode found, when == callback name
  993.          * @return string $output returns the modified html string
  994.          */
  995.         function shortcode_handler( $atts, $content = '', $shortcodename = '', $meta = '' )
  996.         {
  997.             $result = $this->get_element_styles( compact( array( 'atts', 'content', 'shortcodename', 'meta' ) ) );
  998.  
  999.             extract( $result );
  1000.             extract( $atts );
  1001.  
  1002.             $this->subitem_inline_styles = '';
  1003.  
  1004.             $markup_faq = '';
  1005.             if( ! empty( $atts['faq_markup'] ) )
  1006.             {
  1007.                 $markup_faq = avia_markup_helper( array( 'context' => 'faq_section', 'echo' => false ) );
  1008.             }
  1009.  
  1010.             avia_sc_toggle::$counter = 1;
  1011.  
  1012.             $content = ShortcodeHelper::avia_remove_autop( $content, true );
  1013.  
  1014.             $style_tag = $element_styling->get_style_tag( $element_id );
  1015.             $item_tag = $element_styling->style_tag_html( $this->subitem_inline_styles, 'sub-' . $element_id );
  1016.             $container_class = $element_styling->get_class_string( 'container' );
  1017.  
  1018.             $output  = '';
  1019.             $output .= $style_tag;
  1020.             $output .= $item_tag;
  1021.             $output .= "<div {$meta['custom_el_id']} class='{$container_class}' {$markup_faq}>";
  1022.             $output .=      ! empty( $sort ) ? $this->sort_list( $atts ) : '';
  1023.             $output .=      $content;
  1024.             $output .= '</div>';
  1025.  
  1026.             $this->in_sc_exec = false;
  1027.  
  1028.             return $output;
  1029.         }
  1030.  
  1031.  
  1032.         /**
  1033.          * Shortcode handler
  1034.          *
  1035.          * @param array $atts
  1036.          * @param string $content
  1037.          * @param string $shortcodename
  1038.          * @return string
  1039.          */
  1040.         public function av_toggle( $atts, $content = '', $shortcodename = '' )
  1041.         {
  1042.             /**
  1043.              * Fixes a problem when 3-rd party plugins call nested shortcodes without executing main shortcode  (like YOAST in wpseo-filter-shortcodes)
  1044.              */
  1045.             if( ! $this->in_sc_exec )
  1046.             {
  1047.                 return '';
  1048.             }
  1049.  
  1050.             $result = $this->get_element_styles_item( compact( array( 'atts', 'content', 'shortcodename' ) ) );
  1051.  
  1052.             extract( $result );
  1053.  
  1054.             $toggle_atts = $atts;
  1055.  
  1056.  
  1057.             /**
  1058.              * We keep class settings in shortcode handler for better readability
  1059.              */
  1060.  
  1061.             $toggle_init_open_style = '';
  1062.  
  1063.             if( is_numeric( avia_sc_toggle::$initial ) && avia_sc_toggle::$counter == avia_sc_toggle::$initial )
  1064.             {
  1065.                 $element_styling->add_classes( 'titleClass', 'activeTitle' );
  1066.                 $element_styling->add_classes( 'contentClass', 'active_tc' );
  1067.  
  1068.                 //  must be set inline to avoid jumping to wrong tab in frontend
  1069.                 $toggle_init_open_style = "style='display:block;'";
  1070.             }
  1071.  
  1072.             if( empty( $toggle_atts['title'] ) )
  1073.             {
  1074.                 $toggle_atts['title'] = avia_sc_toggle::$counter;
  1075.             }
  1076.  
  1077.             $setting_id = Avia_Builder()->get_developer_settings( 'custom_id' );
  1078.             if( empty( $toggle_atts['custom_id'] ) || in_array( $setting_id, array( 'deactivate' ) ) )
  1079.             {
  1080.                 $toggle_atts['custom_id'] = 'toggle-id-' . avia_sc_toggle::$toggle_id++;
  1081.             }
  1082.             else
  1083.             {
  1084.                 $toggle_atts['custom_id'] = AviaHelper::save_string( $toggle_atts['custom_id'], '-' );
  1085.             }
  1086.  
  1087.  
  1088.             if( '' == $this->parent_atts['faq_markup'] )
  1089.             {
  1090.                 $markup_tab = avia_markup_helper( array( 'context' => 'entry', 'echo' => false, 'custom_markup' => $toggle_atts['custom_markup'] ) );
  1091.                 $markup_title = avia_markup_helper( array( 'context' => 'entry_title', 'echo' => false, 'custom_markup' => $toggle_atts['custom_markup'] ) );
  1092.                 $markup_answer = '';
  1093.                 $markup_text = avia_markup_helper( array( 'context' => 'entry_content', 'echo' => false, 'custom_markup' => $toggle_atts['custom_markup'] ) );
  1094.             }
  1095.             else
  1096.             {
  1097.                 $markup_tab = avia_markup_helper( array( 'context' => 'faq_question_container', 'echo' => false, 'custom_markup' => $toggle_atts['custom_markup'] ) );
  1098.                 $markup_title = avia_markup_helper( array( 'context' => 'faq_question_title', 'echo' => false, 'custom_markup' => $toggle_atts['custom_markup'] ) );
  1099.                 $markup_answer = avia_markup_helper( array( 'context' => 'faq_question_answer', 'echo' => false, 'custom_markup' => $toggle_atts['custom_markup'] ) );
  1100.                 $markup_text = avia_markup_helper( array( 'context' => 'entry_content', 'echo' => false, 'custom_markup' => $toggle_atts['custom_markup'] ) );
  1101.             }
  1102.  
  1103.  
  1104.  
  1105.             $this->subitem_inline_styles .= $element_styling->get_style_tag( $element_id, 'rules_only' );
  1106.  
  1107.             $item_titleClass = $this->el_styling->get_class_string( 'item_titleClass' );
  1108.             $item_contentClass = $this->el_styling->get_class_string( 'item_contentClass' );
  1109.             $item_inherit = $this->el_styling->get_class_string( 'item_inherit' );
  1110.  
  1111.             $section_class = $element_styling->get_class_string( 'container' );
  1112.             $titleClass = $element_styling->get_class_string( 'titleClass' );
  1113.             $contentClass = $element_styling->get_class_string( 'contentClass' );
  1114.  
  1115.             $output  = '';
  1116.             $output .= "<section class='{$section_class}' {$markup_tab}>";
  1117.             $output .=      '<div role="tablist" class="single_toggle" ' . $this->create_tag_string( $toggle_atts['tags'], $toggle_atts ) . '  >';
  1118.             $output .=          "<h3 data-fake-id='#{$toggle_atts['custom_id']}' class='toggler {$item_titleClass} {$titleClass} {$item_inherit}' {$markup_title} role='tab' tabindex='0' aria-controls='{$toggle_atts['custom_id']}'>";
  1119.             $output .=              $toggle_atts['title'];
  1120.             $output .=              '<span class="toggle_icon">';
  1121.             $output .=                  '<span class="vert_icon"></span>';
  1122.             $output .=                  '<span class="hor_icon"></span>';
  1123.             $output .=              '</span>';
  1124.             $output .=          '</h3>';
  1125.             $output .=          "<div id='{$toggle_atts['custom_id']}' class='toggle_wrap {$item_contentClass} {$contentClass}' {$toggle_init_open_style} {$markup_answer}>";
  1126.             $output .=              "<div class='toggle_content invers-color {$item_inherit}' {$markup_text}>";
  1127.             $output .=                  ShortcodeHelper::avia_apply_autop( ShortcodeHelper::avia_remove_autop( $content ) );
  1128.             $output .=              '</div>';
  1129.             $output .=          '</div>';
  1130.             $output .=      '</div>';
  1131.             $output .= '</section>';
  1132.  
  1133.             avia_sc_toggle::$counter ++;
  1134.  
  1135.             return $output;
  1136.         }
  1137.  
  1138.         /**
  1139.          * Returns the data string for the tags
  1140.          *
  1141.          * @param string $tags
  1142.          * @param array $toggle_atts
  1143.          * @return string
  1144.          */
  1145.         protected function create_tag_string( $tags, $toggle_atts )
  1146.         {
  1147.             $first_item_text = apply_filters( 'avf_toggle_sort_first_label', __( 'All', 'avia_framework' ), $toggle_atts );
  1148.  
  1149.             $tag_string = '{' . $first_item_text . '} ';
  1150.             if( trim( $tags ) != '' )
  1151.             {
  1152.                 $tags = explode( ',', $tags );
  1153.  
  1154.                 foreach( $tags as $tag )
  1155.                 {
  1156.                     $tag = esc_html( trim( $tag ) );
  1157.                     if( ! empty( $tag ) )
  1158.                     {
  1159.                         $tag_string .= '{' . $tag . '} ';
  1160.                         avia_sc_toggle::$tags[ $tag ] = true;
  1161.                     }
  1162.                 }
  1163.             }
  1164.  
  1165.             $tag_string = 'data-tags="' . $tag_string . '"';
  1166.  
  1167.             return $tag_string;
  1168.         }
  1169.  
  1170.         /**
  1171.          * Returns the HTML for the sort tags
  1172.          *
  1173.          * @param array $toggle_atts
  1174.          * @return string
  1175.          */
  1176.         protected function sort_list( $toggle_atts )
  1177.         {
  1178.             $output = '';
  1179.             $first = 'activeFilter';
  1180.  
  1181.             if( ! empty( avia_sc_toggle::$tags ) )
  1182.             {
  1183.                 ksort( avia_sc_toggle::$tags );
  1184.  
  1185.                 $first_item_text = apply_filters( 'avf_toggle_sort_first_label', __( 'All', 'avia_framework' ), $toggle_atts );
  1186.                 $start = array( $first_item_text => true );
  1187.                 avia_sc_toggle::$tags = $start + avia_sc_toggle::$tags;
  1188.  
  1189.                 $sep = apply_filters( 'avf_toggle_sort_seperator', '/', $toggle_atts );
  1190.  
  1191.                 foreach( avia_sc_toggle::$tags as $key => $value )
  1192.                 {
  1193.                     $output .= '<a href="#" data-tag="{' . $key . '}" class="' . $first . '">' . $key . '</a>';
  1194.                     $output .= "<span class='tag-seperator'>{$sep}</span>";
  1195.                     $first = '';
  1196.                 }
  1197.             }
  1198.  
  1199.             if( ! empty( $output ) )
  1200.             {
  1201.                 $output = "<div class='taglist'>{$output}</div>";
  1202.             }
  1203.  
  1204.             return $output;
  1205.         }
  1206.  
  1207.     }
  1208. }
  1209.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement