C:\xampp\htdocs\landing\wp-content\plugins\Ultimate_VC_Addons\admin\bsf-core\includes\helpers.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?php
/**
 * Helper functions for BSF Core.
 * 
 * @author Brainstorm Force
 * @package bsf-core
 */

function bsf_get_api_site$prefer_unsecure false ) {

    if ( 
defined'BSF_API_URL' ) ) {
        
$bsf_api_site BSF_API_URL;
    } else {
        
$bsf_api_site 'http://support.brainstormforce.com/';

        if ( 
false == $prefer_unsecure && wp_http_supports( array( 'ssl' ) ) ) {
            
$bsf_api_site set_url_scheme$bsf_api_site'https' );
        }
    }

    return 
$bsf_api_site;
}

function 
bsf_get_api_url$prefer_unsecure false ) {
    
$url bsf_get_api_site$prefer_unsecure ) . 'wp-admin/admin-ajax.php';

    return 
$url;
}

if ( ! 
function_exists'bsf_convert_core_path_to_relative' ) ) {

    
/**
     * Depracate bsf_convert_core_path_to_relative() to in favour of bsf_core_url()
     *
     * @param  $path $path depracated
     * @return String       URL of bsf-core directory.
     */
    
function bsf_convert_core_path_to_relative$path ) {
        
_deprecated_function__FUNCTION__'1.22.46''bsf_core_url' );

        return 
bsf_core_url'' );
    }
}

if ( ! 
function_exists'bsf_core_url' ) ) {

    function 
bsf_core_url$append '' ) {
        
$path       wp_normalize_pathBSF_UPDATER_PATH );
        
$theme_dir  wp_normalize_pathget_template_directory() );
        
$plugin_dir wp_normalize_pathWP_PLUGIN_DIR );

        if ( 
strpos$path$theme_dir ) !== false ) {
            return 
rtrimget_template_directory_uri() . '/admin/bsf-core/''/' ) . $append;
        } elseif ( 
strpos$path$plugin_dir ) !== false ) {
            return 
rtrimplugin_dir_urlBSF_UPDATER_FILE ), '/' ) . $append;
        } elseif ( 
strpos$pathdirnameplugin_basenameBSF_UPDATER_FILE ) ) ) !== false ) {
            return 
rtrimplugin_dir_urlBSF_UPDATER_FILE ), '/' ) . $append;
        }

        return 
false;
    }
}

if ( ! 
function_exists'get_brainstorm_product' ) ) {

    function 
get_brainstorm_product$product_id '' ) {

        
$all_products brainstorm_get_all_products();

        foreach ( 
$all_products as $key => $product ) {

            
$product_id_bsf = isset( $product['id'] ) ? $product['id'] : '';

            if ( 
$product_id == $product_id_bsf ) {

                return 
$product;
            }
        }
    }
}

if ( ! 
function_exists'brainstorm_get_all_products' ) ) {

    function 
brainstorm_get_all_products$skip_plugins false$skip_themes false$skip_bundled false ) {

        
$brainstrom_products         get_option'brainstrom_products', array() );
        
$brainstrom_bundled_products get_option'brainstrom_bundled_products', array() );
        
$brainstorm_plugins          = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array();
        
$brainstorm_themes           = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array();

        if ( 
$skip_plugins == true ) {
            
$all_products $brainstorm_themes;
        } elseif ( 
$skip_themes == true ) {
            
$all_products $brainstorm_plugins;
        } else {
            
$all_products $brainstorm_plugins $brainstorm_themes;
        }

        if ( 
$skip_bundled == false ) {

            foreach ( 
$brainstrom_bundled_products as $parent_id => $parent ) {

                foreach ( 
$parent as $key => $product ) {

                    if ( isset( 
$all_products$product->id ] ) ) {
                        
$all_products$product->id ] = array_merge$all_products$product->id ], (array) $product );
                    } else {
                        
$all_products$product->id ] = (array) $product;
                    }
                }
            }
        }

        return 
$all_products;
    }
}

/**
 * Generate's markup to generate notice to ask users to install required extensions.
 *
 * @since Graupi 1.9
 *
 * $product_id (string) Product ID of the brainstorm product
 * $mu_updater (bool) If True - give nag to separately install brainstorm updater multisite plugin
 */
if ( ! function_exists'bsf_extension_nag' ) ) {

    function 
bsf_extension_nag$product_id ''$mu_updater false ) {

        
$display_nag get_user_metaget_current_user_id(), $product_id '-bsf_nag_dismiss'true );

        if ( 
$mu_updater == true ) {
            
bsf_nag_brainstorm_updater_multisite();
        }

        if ( 
$display_nag === '1' ||
            ! 
user_canget_current_user_id(), 'activate_plugins' ) ||
            ! 
user_canget_current_user_id(), 'install_plugins' ) ) {
            return;
        }

        
$bsf_installed_plugins     '';
        
$bsf_not_installed_plugins '';
        
$bsf_not_activated_plugins '';
        
$installer                 '';
        
$bsf_install               false;
        
$bsf_activate              false;
        
$bsf_bundled_products      bsf_bundled_plugins$product_id );
        
$bsf_product_name          brainstrom_product_name$product_id );

        foreach ( 
$bsf_bundled_products as $key => $plugin ) {

            if ( ! isset( 
$plugin->id ) || $plugin->id == '' || ! isset( $plugin->must_have_extension ) || $plugin->must_have_extension == 'false' ) {
                continue;
            }

            
$plugin_abs_path WP_PLUGIN_DIR '/' $plugin->init;
            if ( 
is_file$plugin_abs_path ) ) {

                if ( ! 
is_plugin_active$plugin->init ) ) {
                    
$bsf_not_activated_plugins .= $bsf_bundled_products$key ]->name ', ';
                }
            } else {
                
$bsf_not_installed_plugins .= $bsf_bundled_products$key ]->name ', ';
            }
        }

        
$bsf_not_activated_plugins rtrim$bsf_not_activated_plugins', ' );
        
$bsf_not_installed_plugins rtrim$bsf_not_installed_plugins', ' );

        if ( 
$bsf_not_activated_plugins !== '' || $bsf_not_installed_plugins !== '' ) {
            echo 
'<div class="updated notice is-dismissible"><p></p>';
            if ( 
$bsf_not_activated_plugins !== '' ) {
                echo 
'<p>';
                echo 
$bsf_product_name __' requires following plugins to be active : ''bsf' );
                echo 
'<strong><em>';
                echo 
$bsf_not_activated_plugins;
                echo 
'</strong></em>';
                echo 
'</p>';
                
$bsf_activate true;
            }

            if ( 
$bsf_not_installed_plugins !== '' ) {
                echo 
'<p>';
                echo 
$bsf_product_name __' requires following plugins to be installed and activated : ''bsf' );
                echo 
'<strong><em>';
                echo 
$bsf_not_installed_plugins;
                echo 
'</strong></em>';
                echo 
'</p>';
                
$bsf_install true;
            }

            if ( 
$bsf_activate == true ) {
                
$installer .= '<a href="' get_admin_url() . 'plugins.php?plugin_status=inactive">' __'Begin activating plugins''bsf' ) . '</a> | ';
            }

            if ( 
$bsf_install == true ) {
                
$installer .= '<a href="' bsf_exension_installer_url$product_id ) . '">' __'Begin installing plugins''bsf' ) . '</a> | ';
            }

            
$installer .= '<a href="' esc_urladd_query_arg'bsf-dismiss-notice'$product_id ) ) . '">' __'Dismiss This Notice''bsf' ) . '</a>';

            
$installer ltrim$installer'| ' );
            echo 
'<p><strong>';
            echo 
rtrim$installer' |' );
            echo 
'</p></strong>';

            echo 
'<p></p></div>';
        }
    }
    
}

if ( ! 
function_exists'bsf_nag_brainstorm_updater_multisite' ) ) {

    function 
bsf_nag_brainstorm_updater_multisite() {

        if ( ! 
function_exists'is_plugin_active_for_network' ) ) {
            require_once 
ABSPATH '/wp-admin/includes/plugin.php';
        }

        if ( ! 
is_multisite() || is_plugin_active_for_network'brainstorm-updater/index.php' ) ) {
            return;
        }

        echo 
'<div class="notice notice-error uct-notice is-dismissible"><p>';
        
printf(
            
__'Looks like you are on a WordPress Multisite, you will need to install and network activate %1$s Brainstorm Updater for Multisite %2$s plugin. Download it from %3$s here %4$s''bsf' ),
            
'<strong><em>',
            
'</strong></em>',
            
'<a href="http://bsf.io/bsf-updater-mu" target="_blank">',
            
'</a>'
        
);

        echo 
'</p>';
        echo 
'</div>';
    }

}
x

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