C:\xampp\htdocs\landing\wp-content\plugins\js_composer\include\classes\shortcodes\vc-tabs.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
if ( ! defined'ABSPATH' ) ) {
    die( 
'-1' );
}

/**
 * Class WPBakeryShortCode_Vc_Tabs
 */
class WPBakeryShortCode_Vc_Tabs extends WPBakeryShortCode {
    public static 
$filter_added false;
    protected 
$controls_css_settings 'out-tc vc_controls-content-widget';
    protected 
$controls_list = array(
        
'edit',
        
'clone',
        
'delete',
    );

    
/**
     * WPBakeryShortCode_Vc_Tabs constructor.
     * @param $settings
     */
    
public function __construct$settings ) {
        
parent::__construct$settings );
        if ( ! 
self::$filter_added ) {
            
add_filter'vc_inline_template_content', array(
                
$this,
                
'setCustomTabId',
            ) );
            
self::$filter_added true;
        }
    }

    
/**
     * @param $atts
     * @param null $content
     * @return mixed|string
     * @throws \Exception
     */
    
public function contentAdmin$atts$content null ) {
        
$width $custom_markup '';
        
$shortcode_attributes = array( 'width' => '1/1' );
        foreach ( 
$this->settings['params'] as $param ) {
            if ( 
'content' !== $param['param_name'] ) {
                
$shortcode_attributes$param['param_name'] ] = isset( $param['value'] ) ? $param['value'] : null;
            } elseif ( 
'content' === $param['param_name'] && null === $content ) {
                
$content $param['value'];
            }
        }
        
extractshortcode_atts$shortcode_attributes$atts ) );

        
// Extract tab titles

        
preg_match_all'/vc_tab title="([^\"]+)"(\stab_id\=\"([^\"]+)\"){0,1}/i'$content$matchesPREG_OFFSET_CAPTURE );

        
$tab_titles = array();

        if ( isset( 
$matches[0] ) ) {
            
$tab_titles $matches[0];
        }
        
$tmp '';
        if ( 
count$tab_titles ) ) {
            
$tmp .= '<ul class="clearfix tabs_controls">';
            foreach ( 
$tab_titles as $tab ) {
                
preg_match'/title="([^\"]+)"(\stab_id\=\"([^\"]+)\"){0,1}/i'$tab[0], $tab_matchesPREG_OFFSET_CAPTURE );
                if ( isset( 
$tab_matches[1][0] ) ) {
                    
$tmp .= '<li><a href="#tab-' . ( isset( $tab_matches[3][0] ) ? $tab_matches[3][0] : sanitize_title$tab_matches[1][0] ) ) . '">' $tab_matches[1][0] . '</a></li>';

                }
            }
            
$tmp .= '</ul>' "\n";
        }

        
$elem $this->getElementHolder$width );

        
$iner '';
        foreach ( 
$this->settings['params'] as $param ) {
            
$param_value = isset( ${$param['param_name']} ) ? ${$param['param_name']} : '';
            if ( 
is_array$param_value ) ) {
                
// Get first element from the array
                
reset$param_value );
                
$first_key key$param_value );
                
$param_value $param_value$first_key ];
            }
            
$iner .= $this->singleParamHtmlHolder$param$param_value );
        }

        if ( isset( 
$this->settings['custom_markup'] ) && '' !== $this->settings['custom_markup'] ) {
            if ( 
'' !== $content ) {
                
$custom_markup str_ireplace'%content%'$tmp $content$this->settings['custom_markup'] );
            } elseif ( 
'' === $content && isset( $this->settings['default_content_in_template'] ) && '' !== $this->settings['default_content_in_template'] ) {
                
$custom_markup str_ireplace'%content%'$this->settings['default_content_in_template'], $this->settings['custom_markup'] );
            } else {
                
$custom_markup str_ireplace'%content%'''$this->settings['custom_markup'] );
            }
            
$iner .= do_shortcode$custom_markup );
        }
        
$elem str_ireplace'%wpb_element_content%'$iner$elem );
        
$output $elem;

        return 
$output;
    }

    
/**
     * @return string
     */
    
public function getTabTemplate() {
        return 
'<div class="wpb_template">' do_shortcode'[vc_tab title="Tab" tab_id=""][/vc_tab]' ) . '</div>';
    }

    
/**
     * @param $content
     * @return string|string[]|null
     */
    
public function setCustomTabId$content ) {
        return 
preg_replace'/tab\_id\=\"([^\"]+)\"/''tab_id="$1-' time() . '"'$content );
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586