C:\xampp\htdocs\landing\wp-content\plugins\js_composer\include\autoload\class-vc-vendor-presets.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
if ( ! defined'ABSPATH' ) ) {
    die( 
'-1' );
}

/**
 * Singleton to hold all vendor presets
 *
 * @since 4.8
 */
class Vc_Vendor_Preset {

    private static 
$instance;
    private static 
$presets = array();

    
/**
     * @return \Vc_Vendor_Preset
     */
    
public static function getInstance() {
        if ( ! 
self::$instance ) {
            
self::$instance = new self();
        }

        return 
self::$instance;
    }

    protected function 
__construct() {
    }

    
/**
     * Add vendor preset to collection
     *
     * @param string $title
     * @param string $shortcode
     * @param array $params
     * @param bool $default
     *
     * @return bool
     * @since 4.8
     *
     */
    
public function add$title$shortcode$params$default false ) {
        if ( ! 
$title || ! is_string$title ) || ! $shortcode || ! is_string$shortcode ) || ! $params || ! is_array$params ) ) {
            return 
false;
        }

        
$preset = array(
            
'shortcode' => $shortcode,
            
'default' => $default,
            
'params' => $params,
            
'title' => $title,
        );

        
// @codingStandardsIgnoreLine
        
$id md5serialize$preset ) );

        
self::$presets$id ] = $preset;

        return 
true;
    }

    
/**
     * Get specific vendor preset
     *
     * @param string $id
     *
     * @return mixed array|false
     * @since 4.8
     *
     */
    
public function get$id ) {
        if ( isset( 
self::$presets$id ] ) ) {
            return 
self::$presets$id ];
        }

        return 
false;
    }

    
/**
     * Get all vendor presets for specific shortcode
     *
     * @param string $shortcode
     *
     * @return array
     * @since 4.8
     *
     */
    
public function getAll$shortcode ) {
        
$list = array();

        foreach ( 
self::$presets as $id => $preset ) {
            if ( 
$shortcode === $preset['shortcode'] ) {
                
$list$id ] = $preset;
            }
        }

        return 
$list;
    }

    
/**
     * Get all default vendor presets
     *
     * Include only one default preset per shortcode
     *
     * @return array
     * @since 4.8
     *
     */
    
public function getDefaults() {
        
$list = array();

        
$added = array();

        foreach ( 
self::$presets as $id => $preset ) {
            if ( 
$preset['default'] && ! in_array$preset['shortcode'], $addedtrue ) ) {
                
$added[] = $preset['shortcode'];
                
$list$id ] = $preset;
            }
        }

        return 
$list;
    }

    
/**
     * Get ID of default preset for specific shortcode
     *
     * If multiple presets are default, return first
     *
     * @param string $shortcode
     *
     * @return string|null
     * @since 4.8
     *
     */
    
public function getDefaultId$shortcode ) {
        foreach ( 
self::$presets as $id => $preset ) {
            if ( 
$shortcode === $preset['shortcode'] && $preset['default'] ) {
                return 
$id;
            }
        }

        return 
null;
    }
}
x

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