/* Plugin Name: Ultimate Addons for Visual Composer Plugin URI: https://brainstormforce.com/demos/ultimate/ Author: Brainstorm Force Author URI: https://www.brainstormforce.com Version: 3.16.1 Description: Includes Visual Composer premium addon elements like Icon, Info Box, Interactive Banner, Flip Box, Info List & Counter. Best of all - provides A Font Icon Manager allowing users to upload / delete custom icon fonts. Text Domain: ultimate_vc */ if(!defined('__ULTIMATE_ROOT__')){ define('__ULTIMATE_ROOT__', dirname(__FILE__)); } if(!defined('ULTIMATE_VERSION')){ define('ULTIMATE_VERSION', '3.16.1'); } register_activation_hook( __FILE__, 'uvc_plugin_activate'); function uvc_plugin_activate() { update_option('ultimate_vc_addons_redirect',true); $memory = ini_get('memory_limit'); $allowed_memory = preg_replace("/[^0-9]/","",$memory)*1024*1024; $peak_memory = memory_get_peak_usage(true); if($allowed_memory - $peak_memory <= 14436352){ $pre = __('Unfortunately, plugin could not be activated. Not enough memory available.','ultimate_vc'); $sub = __('Please contact', 'ultimate_vc'); trigger_error( $pre.' '.$sub.' '.__('plugin support','ultimate_vc').'.',E_USER_ERROR ); } // theme depend custom row class $themes = array( 'X' => 'x-content-band', 'HighendWP' => 'vc_row', 'Vellum' => 'vc_section_wrapper', 'Curves' => 'default-section', ); $site_theme = wp_get_theme(); $current_theme = $site_theme->get( 'Name' ); if(array_key_exists($current_theme, $themes)) { if(!get_option('ultimate_custom_vc_row') || get_option('ultimate_custom_vc_row') == '') update_option('ultimate_custom_vc_row',$themes[$current_theme]); } if(!get_option('ultimate_js') || get_option('ultimate_js') == '') update_option('ultimate_js', 'enable'); if(!get_option('ultimate_css') || get_option('ultimate_css') == '') update_option('ultimate_css', 'enable'); } add_action('vc_after_init', 'load_ulitmate_presets'); function load_ulitmate_presets() { $ultimate_preset_path = realpath(dirname(__FILE__).'/presets'); foreach (glob($ultimate_preset_path."/*.php") as $filename) { include_once($filename); $base = (isset($array['base'])) ? $array['base'] : ''; if($base === '') continue; $presets = (isset($array['presets'])) ? $array['presets'] : array(); if(empty($presets)) continue; foreach ($presets as $key => $preset) { $title = (isset($preset['title'])) ? $preset['title'] : ''; $default = (isset($preset['default'])) ? $preset['default'] : ''; $settings = (isset($preset['settings'])) ? $preset['settings'] : array(); do_action( 'vc_register_settings_preset', $title, $base, $settings, $default ); } } } if(!class_exists('Ultimate_VC_Addons')) { add_action('admin_init','init_addons'); $plugin = plugin_basename(__FILE__); add_filter('plugin_action_links_'.$plugin, 'ultimate_plugins_page_link' ); function ultimate_plugins_page_link($links) { $tutorial_link = ''.__('Video Tutorials','ultimate_vc').''; if(is_multisite()) $settins_link = ''.__('Settings','ultimate_vc').''; else $settins_link = ''.__('Settings','ultimate_vc').''; array_unshift($links, $tutorial_link); //array_push($links, $tutorial_link); array_push($links, $settins_link); return $links; } function init_addons() { $required_vc = '3.7'; if(defined('WPB_VC_VERSION')){ if( version_compare( $required_vc, WPB_VC_VERSION, '>' )){ add_action( 'admin_notices', 'admin_notice_for_version'); add_action('network_admin_notices','admin_notice_for_version'); } } else { add_action( 'admin_notices', 'admin_notice_for_vc_activation'); add_action('network_admin_notices','admin_notice_for_vc_activation'); } }// end init_addons function admin_notice_for_version() { $is_multisite = is_multisite(); $is_network_admin = is_network_admin(); if(($is_multisite && $is_network_admin) || !$is_multisite) echo '

'.__('The','ultimate_vc').' Ultimate addons for Visual Composer '.__('plugin requires','ultimate_vc').' Visual Composer '.__('version 3.7.2 or greater.','ultimate_vc').'

'; } function admin_notice_for_vc_activation() { $is_multisite = is_multisite(); $is_network_admin = is_network_admin(); if(($is_multisite && $is_network_admin) || !$is_multisite) echo '

'.__('The','ultimate_vc').' Ultimate addons for Visual Composer '.__('plugin requires','ultimate_vc').' Visual Composer '.__('Plugin installed and activated.','ultimate_vc').'

'; } // plugin class class Ultimate_VC_Addons { var $paths = array(); var $module_dir; var $params_dir; var $assets_js; var $assets_css; var $admin_js; var $admin_css; var $vc_template_dir; var $vc_dest_dir; function __construct() { //add_action( 'init', array($this,'init_addons')); add_action('init', array($this, 'load_vc_translation')); $this->vc_template_dir = plugin_dir_path( __FILE__ ).'vc_templates/'; $this->vc_dest_dir = get_template_directory().'/vc_templates/'; $this->module_dir = plugin_dir_path( __FILE__ ).'modules/'; $this->params_dir = plugin_dir_path( __FILE__ ).'params/'; $this->assets_js = plugins_url('assets/js/',__FILE__); $this->assets_css = plugins_url('assets/css/',__FILE__); $this->admin_js = plugins_url('admin/js/',__FILE__); $this->admin_css = plugins_url('admin/css/',__FILE__); $this->paths = wp_upload_dir(); $this->paths['fonts'] = 'smile_fonts'; if (stripos(get_option('siteurl'), 'https://') === 0) { $scheme = 'https'; } else { $scheme = 'http'; } $this->paths['fonturl'] = set_url_scheme($this->paths['baseurl'].'/'.$this->paths['fonts'], $scheme); add_action('after_setup_theme',array($this,'aio_init')); add_action('admin_enqueue_scripts',array($this,'aio_admin_scripts')); add_action('wp_enqueue_scripts',array($this,'aio_front_scripts'),99); add_action('admin_init',array($this,'toggle_updater'), 1); if(!get_option('ultimate_row')){ update_option('ultimate_row','enable'); } if(!get_option('ultimate_animation')){ update_option('ultimate_animation','disable'); } add_action('wp_head',array($this, 'ultimate_init_vars')); //add_action('admin_init', array($this, 'aio_move_templates')); }// end constructor function ultimate_init_vars() { $ultimate_smooth_scroll_compatible = get_option('ultimate_smooth_scroll_compatible'); if($ultimate_smooth_scroll_compatible === 'enable') return false; $ultimate_smooth_scroll = get_option('ultimate_smooth_scroll'); if($ultimate_smooth_scroll !== 'enable') return false; $ultimate_smooth_scroll_options = get_option('ultimate_smooth_scroll_options'); $step = (isset($ultimate_smooth_scroll_options['step']) && $ultimate_smooth_scroll_options['step'] != '') ? $ultimate_smooth_scroll_options['step'] : 80; $speed = (isset($ultimate_smooth_scroll_options['speed']) && $ultimate_smooth_scroll_options['speed'] != '') ? $ultimate_smooth_scroll_options['speed'] : 480; echo ""; } function load_vc_translation() { load_plugin_textdomain('ultimate_vc', FALSE, dirname(plugin_basename(__FILE__)).'/languages/'); } function aio_init() { // activate - params foreach(glob($this->params_dir."/*.php") as $param) { require_once($param); } // activate addons one by one from modules directory $ultimate_modules = get_option('ultimate_modules'); $ultimate_modules[] = 'ultimate_just_icon'; $ultimate_modules[] = 'ultimate_functions'; $ultimate_modules[] = 'ultimate_icon_manager'; $ultimate_modules[] = 'ultimate_font_manager'; if(get_option('ultimate_row') == "enable") $ultimate_modules[] = 'ultimate_parallax'; foreach(glob($this->module_dir."/*.php") as $module) { $ultimate_file = basename($module); $ultimate_fileName = preg_replace('/\\.[^.\\s]{3,4}$/', '', $ultimate_file); if(is_array($ultimate_modules) && !empty($ultimate_modules)){ if(in_array(strtolower($ultimate_fileName),$ultimate_modules) ){ require_once($module); } } } if(in_array("woocomposer",$ultimate_modules) ){ if(defined('WOOCOMMERCE_VERSION')) { if(version_compare( '2.1.0', WOOCOMMERCE_VERSION, '<' )) { foreach(glob(plugin_dir_path( __FILE__ ).'woocomposer/modules/*.php') as $module) { require_once($module); } } else { //add_action( 'admin_notices', array($this, 'woocomposer_admin_notice_for_woocommerce')); } } else { //add_action( 'admin_notices', array($this, 'woocomposer_admin_notice_for_woocommerce')); } } }// end aio_init function woocomposer_admin_notice_for_woocommerce(){ echo '

'._('The','ultimate_vc').' WooComposer '.__('plugin requires','ultimate_vc').' WooCommerce '.__('plugin installed and activated with version greater than 2.1.0.', 'ultimate_vc').'

'; } function aio_admin_scripts($hook) { // enqueue css files on backend' if($hook == "post.php" || $hook == "post-new.php" || $hook == 'visual-composer_page_vc-roles'){ $bsf_dev_mode = bsf_get_option('dev_mode'); if($bsf_dev_mode === 'enable') { wp_enqueue_style('ult-animate',$this->assets_css.'animate.css'); wp_enqueue_style('aio-icon-manager',$this->admin_css.'icon-manager.css'); } if(wp_script_is( 'vc_inline_custom_view_js', 'enqueued' )) wp_enqueue_script('vc-inline-editor',$this->assets_js.'vc-inline-editor.js',array('vc_inline_custom_view_js'),'1.5',true); $fonts = get_option('smile_fonts'); if(is_array($fonts)) { foreach($fonts as $font => $info) { if(strpos($info['style'], 'http://' ) !== false) { wp_enqueue_style('bsf-'.$font,$info['style']); } else { wp_enqueue_style('bsf-'.$font,trailingslashit($this->paths['fonturl']).$info['style']); } } } } }// end aio_admin_scripts function check_our_element_on_page($post_content) { // check for background $found_ultimate_backgrounds = false; if(stripos( $post_content, 'bg_type=')) { preg_match('/bg_type="(.*?)"/', $post_content, $output); if( $output[1] === 'bg_color' || $output[1] === 'grad' || $output[1] === 'image' || $output[1] === 'u_iframe' || $output[1] === 'video' ) { $found_ultimate_backgrounds = true; } } if( stripos( $post_content, '[ultimate_spacer') || stripos( $post_content, '[ult_buttons') || stripos( $post_content, '[ultimate_icon_list') || stripos( $post_content, '[just_icon') || stripos( $post_content, '[ult_animation_block') || stripos( $post_content, '[icon_counter') || stripos( $post_content, '[ultimate_google_map') || stripos( $post_content, '[icon_timeline') || stripos( $post_content, '[bsf-info-box') || stripos( $post_content, '[info_list') || stripos( $post_content, '[ultimate_info_table') || stripos( $post_content, '[interactive_banner_2') || stripos( $post_content, '[interactive_banner') || stripos( $post_content, '[ultimate_pricing') || stripos( $post_content, '[ultimate_icons') || stripos( $post_content, '[ultimate_heading') || stripos( $post_content, '[ultimate_carousel') || stripos( $post_content, '[ult_countdown') || stripos( $post_content, '[ultimate_info_banner') || stripos( $post_content, '[swatch_container') || stripos( $post_content, '[ult_ihover') || stripos( $post_content, '[ult_hotspot') || stripos( $post_content, '[ult_content_box') || stripos( $post_content, '[ultimate_ctation') || stripos( $post_content, '[stat_counter') || stripos( $post_content, '[ultimate_video_banner') || stripos( $post_content, '[ult_dualbutton') || stripos( $post_content, '[ult_createlink') || stripos( $post_content, '[ultimate_img_separator') || stripos( $post_content, '[ult_tab_element') || stripos( $post_content, '[ultimate_exp_section') || stripos( $post_content, '[info_circle') || stripos( $post_content, '[ultimate_modal') || stripos( $post_content, '[ult_sticky_section') || stripos( $post_content, '[ult_team') || stripos( $post_content, '[ultimate_fancytext') || stripos( $post_content, '[ult_range_slider') || $found_ultimate_backgrounds ) { return true; } else { return false; } } function aio_front_scripts() { $isAjax = false; $ultimate_ajax_theme = get_option('ultimate_ajax_theme'); if($ultimate_ajax_theme == 'enable') $isAjax = true; $dependancy = array('jquery'); $bsf_dev_mode = bsf_get_option('dev_mode'); if($bsf_dev_mode === 'enable') { $js_path = 'assets/js/'; $css_path = 'assets/css/'; $ext = ''; } else { $js_path = 'assets/min-js/'; $css_path = 'assets/min-css/'; $ext = '.min'; } $ultimate_smooth_scroll_compatible = get_option('ultimate_smooth_scroll_compatible'); // register js wp_register_script('ultimate-script',plugins_url('assets/min-js/ultimate.min.js',__FILE__),array('jquery', 'jquery-ui-core' ), ULTIMATE_VERSION, false); wp_register_script('ultimate-appear',plugins_url($js_path.'jquery-appear'.$ext.'.js',__FILE__),array('jquery'), ULTIMATE_VERSION); wp_register_script('ultimate-custom',plugins_url($js_path.'custom'.$ext.'.js',__FILE__),array('jquery'), ULTIMATE_VERSION); wp_register_script('ultimate-vc-params',plugins_url($js_path.'ultimate-params'.$ext.'.js',__FILE__),array('jquery'), ULTIMATE_VERSION); if($ultimate_smooth_scroll_compatible === 'enable') { $smoothScroll = 'SmoothScroll-compatible.min.js'; } else { $smoothScroll = 'SmoothScroll.min.js'; } wp_register_script('ultimate-smooth-scroll',plugins_url('assets/min-js/'.$smoothScroll,__FILE__),array('jquery'),ULTIMATE_VERSION,true); wp_register_script("ultimate-modernizr",plugins_url($js_path.'modernizr-custom'.$ext.'.js',__FILE__),array('jquery'),ULTIMATE_VERSION); wp_register_script("ultimate-tooltip",plugins_url($js_path.'tooltip'.$ext.'.js',__FILE__),array('jquery'),ULTIMATE_VERSION); // register css wp_register_style('ultimate-animate',plugins_url($css_path.'animate'.$ext.'.css',__FILE__),array(),ULTIMATE_VERSION); wp_register_style('ultimate-style',plugins_url($css_path.'style'.$ext.'.css',__FILE__),array(),ULTIMATE_VERSION); wp_register_style('ultimate-style-min',plugins_url('assets/min-css/ultimate.min.css',__FILE__),array(),ULTIMATE_VERSION); wp_register_style('ultimate-tooltip',plugins_url($css_path.'tooltip'.$ext.'.css',__FILE__),array(),ULTIMATE_VERSION); $ultimate_smooth_scroll = get_option('ultimate_smooth_scroll'); if($ultimate_smooth_scroll == "enable" || $ultimate_smooth_scroll_compatible === 'enable') { wp_enqueue_script('ultimate-smooth-scroll'); } if(function_exists('vc_is_editor')){ if(vc_is_editor()){ wp_enqueue_style('vc-fronteditor',plugins_url('assets/min-css/vc-fronteditor.min.css',__FILE__)); } } $fonts = get_option('smile_fonts'); if(is_array($fonts)) { foreach($fonts as $font => $info) { $style_url = $info['style']; if(strpos($style_url, 'http://' ) !== false) { wp_enqueue_style('bsf-'.$font,$info['style']); } else { wp_enqueue_style('bsf-'.$font,trailingslashit($this->paths['fonturl']).$info['style']); } } } $ultimate_global_scripts = bsf_get_option('ultimate_global_scripts'); if($ultimate_global_scripts === 'enable') { wp_enqueue_script('ultimate-modernizr'); wp_enqueue_script('jquery_ui'); wp_enqueue_script('masonry'); if(defined('DISABLE_ULTIMATE_GOOGLE_MAP_API') && (DISABLE_ULTIMATE_GOOGLE_MAP_API == true || DISABLE_ULTIMATE_GOOGLE_MAP_API == 'true')) $load_map_api = false; else $load_map_api = true; if($load_map_api) wp_enqueue_script('googleapis'); wp_enqueue_script('ultimate-script'); wp_enqueue_script('ultimate-modal-all'); wp_enqueue_script('jquery.shake',plugins_url($js_path.'jparallax'.$ext.'.js',__FILE__)); wp_enqueue_script('jquery.vhparallax',plugins_url($js_path.'vhparallax'.$ext.'.js',__FILE__)); wp_enqueue_style('ultimate-style-min'); wp_enqueue_style("ult-icons"); wp_enqueue_style('ultimate-vidcons',plugins_url('assets/fonts/vidcons.css',__FILE__)); wp_enqueue_script('jquery.ytplayer',plugins_url($js_path.'mb-YTPlayer'.$ext.'.js',__FILE__)); $Ultimate_Google_Font_Manager = new Ultimate_Google_Font_Manager; $Ultimate_Google_Font_Manager->enqueue_selected_ultimate_google_fonts(); return false; } if(!is_404() && !is_search()){ global $post; if(!$post) return false; $post_content = $post->post_content; $is_element_on_page = $this->check_our_element_on_page($post_content); if(stripos($post_content, 'font_call:')) { preg_match_all('/font_call:(.*?)"/',$post_content, $display); enquque_ultimate_google_fonts_optimzed($display[1]); } if(!$is_element_on_page) return false; $ultimate_js = get_option('ultimate_js'); if(($ultimate_js == 'enable' || $isAjax == true) && ($bsf_dev_mode != 'enable') ) { if( stripos( $post_content, '[swatch_container') || stripos( $post_content, '[ultimate_modal') ) { wp_enqueue_script('ultimate-modernizr'); } if( stripos( $post_content, '[ultimate_exp_section') || stripos( $post_content, '[info_circle') ) { wp_enqueue_script('jquery_ui'); } if( stripos( $post_content, '[icon_timeline') ) { wp_enqueue_script('masonry'); } if($isAjax == true) { // if ajax site load all js wp_enqueue_script('masonry'); } if( stripos( $post_content, '[ultimate_google_map') ) { if(defined('DISABLE_ULTIMATE_GOOGLE_MAP_API') && (DISABLE_ULTIMATE_GOOGLE_MAP_API == true || DISABLE_ULTIMATE_GOOGLE_MAP_API == 'true')) $load_map_api = false; else $load_map_api = true; if($load_map_api) wp_enqueue_script('googleapis'); } if( stripos( $post_content, '[ult_range_slider') ) { wp_enqueue_script('jquery-ui-mouse'); wp_enqueue_script('jquery-ui-widget'); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('ult_range_tick'); wp_enqueue_script('ult_ui_touch_punch'); } wp_enqueue_script('ultimate-script'); if( stripos( $post_content, '[ultimate_modal') ) { //$modal_fixer = get_option('ultimate_modal_fixer'); //if($modal_fixer === 'enable') //wp_enqueue_script('ultimate-modal-all-switched'); //else wp_enqueue_script('ultimate-modal-all'); } } else if($ultimate_js == 'disable') { wp_enqueue_script('ultimate-vc-params'); if( stripos( $post_content, '[ultimate_spacer') || stripos( $post_content, '[ult_buttons') || stripos( $post_content, '[ult_team') || stripos( $post_content, '[ultimate_icon_list') ) { wp_enqueue_script('ultimate-custom'); } if( stripos( $post_content, '[just_icon') || stripos( $post_content, '[ult_animation_block') || stripos( $post_content, '[icon_counter') || stripos( $post_content, '[ultimate_google_map') || stripos( $post_content, '[icon_timeline') || stripos( $post_content, '[bsf-info-box') || stripos( $post_content, '[info_list') || stripos( $post_content, '[ultimate_info_table') || stripos( $post_content, '[interactive_banner_2') || stripos( $post_content, '[interactive_banner') || stripos( $post_content, '[ultimate_pricing') || stripos( $post_content, '[ultimate_icons') ) { wp_enqueue_script('ultimate-appear'); wp_enqueue_script('ultimate-custom'); } if( stripos( $post_content, '[ultimate_heading') ) { wp_enqueue_script("ultimate-headings-script"); } if( stripos( $post_content, '[ultimate_carousel') ) { wp_enqueue_script('ult-slick'); wp_enqueue_script('ultimate-appear'); wp_enqueue_script('ult-slick-custom'); } if( stripos( $post_content, '[ult_countdown') ) { wp_enqueue_script('jquery.timecircle'); wp_enqueue_script('jquery.countdown'); } if( stripos( $post_content, '[icon_timeline') ) { wp_enqueue_script('masonry'); } if( stripos( $post_content, '[ultimate_info_banner') ) { wp_enqueue_script('ultimate-appear'); wp_enqueue_script('utl-info-banner-script'); } if( stripos( $post_content, '[ultimate_google_map') ) { if(defined('DISABLE_ULTIMATE_GOOGLE_MAP_API') && (DISABLE_ULTIMATE_GOOGLE_MAP_API == true || DISABLE_ULTIMATE_GOOGLE_MAP_API == 'true')) $load_map_api = false; else $load_map_api = true; if($load_map_api) wp_enqueue_script('googleapis'); } if( stripos( $post_content, '[swatch_container') ) { wp_enqueue_script('ultimate-modernizr'); wp_enqueue_script('swatchbook-js'); } if( stripos( $post_content, '[ult_ihover') ) { wp_enqueue_script('ult_ihover_js'); } if( stripos( $post_content, '[ult_hotspot') ) { wp_enqueue_script('ult_hotspot_tooltipster_js'); wp_enqueue_script('ult_hotspot_js'); } if( stripos( $post_content, '[ult_content_box') ) { wp_enqueue_script('ult_content_box_js'); } if( stripos( $post_content, '[bsf-info-box') ) { wp_enqueue_script('info_box_js'); } if( stripos( $post_content, '[icon_counter') ) { wp_enqueue_script('flip_box_js'); } if( stripos( $post_content, '[ultimate_ctation') ) { wp_enqueue_script('utl-ctaction-script'); } if( stripos( $post_content, '[stat_counter') ) { wp_enqueue_script('ultimate-appear'); wp_enqueue_script('ult-stats-counter-js'); //wp_enqueue_script('ult-slick-custom'); wp_enqueue_script('ultimate-custom'); array_push($dependancy,'stats-counter-js'); } if( stripos( $post_content, '[ultimate_video_banner') ) { wp_enqueue_script('ultimate-video-banner-script'); } if( stripos( $post_content, '[ult_dualbutton') ) { wp_enqueue_script('jquery.dualbtn'); } if( stripos( $post_content, '[ult_createlink') ) { wp_enqueue_script('jquery.ult_cllink'); } if( stripos( $post_content, '[ultimate_img_separator') ) { wp_enqueue_script('ultimate-appear'); wp_enqueue_script('ult-easy-separator-script'); wp_enqueue_script('ultimate-custom'); } if( stripos( $post_content, '[ult_tab_element') ) { wp_enqueue_script('ultimate-appear'); wp_enqueue_script('ult_tabs_rotate'); wp_enqueue_script('ult_tabs_acordian_js'); } if( stripos( $post_content, '[ultimate_exp_section') ) { wp_enqueue_script('jquery_ui'); wp_enqueue_script('jquery_ultimate_expsection'); } if( stripos( $post_content, '[info_circle') ) { wp_enqueue_script('jquery_ui'); wp_enqueue_script('ultimate-appear'); wp_enqueue_script('info-circle'); //wp_enqueue_script('info-circle-ui-effect'); } if( stripos( $post_content, '[ultimate_modal') ) { wp_enqueue_script('ultimate-modernizr'); //$modal_fixer = get_option('ultimate_modal_fixer'); //if($modal_fixer === 'enable') //wp_enqueue_script('ultimate-modal-all-switched'); //else wp_enqueue_script('ultimate-modal-all'); } if( stripos( $post_content, '[ult_sticky_section') ) { wp_enqueue_script('ult_sticky_js'); wp_enqueue_script('ult_sticky_section_js'); } if( stripos( $post_content, '[ult_team') ) { wp_enqueue_script('ultimate-team'); } if( stripos( $post_content, '[ult_range_slider') ) { wp_enqueue_script('jquery-ui-mouse'); wp_enqueue_script('jquery-ui-widget'); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('ult_range_tick'); wp_enqueue_script('ult_range_slider_js'); wp_enqueue_script('ult_ui_touch_punch'); } } $ultimate_css = get_option('ultimate_css'); if($ultimate_css == "enable"){ wp_enqueue_style('ultimate-style-min'); if( stripos( $post_content, '[ultimate_carousel') ) { wp_enqueue_style("ult-icons"); } } else { $ib_2_found = $ib_found = false; wp_enqueue_style('ultimate-style'); if( stripos( $post_content, '[ult_animation_block') ) { wp_enqueue_style('ultimate-animate'); } if( stripos( $post_content, '[icon_counter') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ult-flip-style'); } if( stripos( $post_content, '[ult_countdown') ) { wp_enqueue_style('ult-countdown'); } if( stripos( $post_content, '[ultimate_icon_list') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ultimate-tooltip'); } if( stripos( $post_content, '[ultimate_carousel') ) { wp_enqueue_style("ult-slick"); wp_enqueue_style("ult-icons"); wp_enqueue_style("ultimate-animate"); } if( stripos( $post_content, '[ultimate_fancytext') ) { wp_enqueue_style('ultimate-fancytext-style'); } if( stripos( $post_content, '[ultimate_ctation') ) { wp_enqueue_style('utl-ctaction-style'); } if( stripos( $post_content, '[ult_buttons') ) { wp_enqueue_style( 'ult-btn' ); } if( stripos( $post_content, '[ultimate_heading') ) { wp_enqueue_style("ultimate-headings-style"); } if( stripos( $post_content, '[ultimate_icons') || stripos( $post_content, '[single_icon')) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ultimate-tooltip'); } if( stripos( $post_content, '[ult_ihover') ) { wp_enqueue_style( 'ult_ihover_css' ); } if( stripos( $post_content, '[ult_hotspot') ) { wp_enqueue_style( 'ult_hotspot_css' ); wp_enqueue_style( 'ult_hotspot_tooltipster_css' ); } if( stripos( $post_content, '[ult_content_box') ) { wp_enqueue_style('ult_content_box_css'); } if( stripos( $post_content, '[bsf-info-box') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('info-box-style'); } if( stripos( $post_content, '[info_circle') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('info-circle'); } if( stripos( $post_content, '[ultimate_info_banner') ) { wp_enqueue_style('utl-info-banner-style'); wp_enqueue_style('ultimate-animate'); } if( stripos( $post_content, '[icon_timeline') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ultimate-timeline-style'); } if( stripos( $post_content, '[just_icon') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ultimate-tooltip'); } if( stripos( $post_content, '[interactive_banner_2') ) { $ib_2_found = true; } if(stripos( $post_content, '[interactive_banner') && !stripos( $post_content, '[interactive_banner_2')) { $ib_found = true; } if(stripos( $post_content, '[interactive_banner ') && stripos( $post_content, '[interactive_banner_2')) { $ib_found = true; $ib_2_found = true; } if( $ib_found && !$ib_2_found ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ult-interactive-banner'); } else if( !$ib_found && $ib_2_found ) { wp_enqueue_style('ult-ib2-style'); } else if($ib_found && $ib_2_found) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ult-interactive-banner'); wp_enqueue_style('ult-ib2-style'); } if( stripos( $post_content, '[info_list') ) { wp_enqueue_style('ultimate-animate'); } if( stripos( $post_content, '[ultimate_modal') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ultimate-modal'); } if( stripos( $post_content, '[ultimate_info_table') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style("ultimate-pricing"); } if( stripos( $post_content, '[ultimate_pricing') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style("ultimate-pricing"); } if( stripos( $post_content, '[swatch_container') ) { wp_enqueue_style('swatchbook-css'); } if( stripos( $post_content, '[stat_counter') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ult-stats-counter-style'); } if( stripos( $post_content, '[ultimate_video_banner') ) { wp_enqueue_style('ultimate-video-banner-style'); } if( stripos( $post_content, '[ult_dualbutton') ) { wp_enqueue_style('ult-dualbutton'); } if( stripos( $post_content, '[ult_createlink') ) { wp_enqueue_style('ult_cllink'); } if( stripos( $post_content, '[ultimate_img_separator') ) { wp_enqueue_style('ultimate-animate'); wp_enqueue_style('ult-easy-separator-style'); } if( stripos( $post_content, '[ult_tab_element') ) { wp_enqueue_style('ult_tabs'); wp_enqueue_style('ult_tabs_acordian'); } if( stripos( $post_content, '[ultimate_exp_section') ) { wp_enqueue_style('style_ultimate_expsection'); } if( stripos( $post_content, '[ult_sticky_section') ) { wp_enqueue_style('ult_sticky_section_css'); } if( stripos( $post_content, '[ult_team') ) { wp_enqueue_style('ultimate-team'); } if( stripos( $post_content, '[ult_range_slider') ) { wp_enqueue_style('ult_range_slider_css'); } } } }// end aio_front_scripts function aio_move_templates() { // Make destination directory if (!is_dir($this->vc_dest_dir)) { wp_mkdir_p($this->vc_dest_dir); } @chmod($this->vc_dest_dir,0777); foreach(glob($this->vc_template_dir.'*') as $file) { $new_file = basename($file); @copy($file,$this->vc_dest_dir.$new_file); } }// end aio_move_templates function toggle_updater(){ if(defined('ULTIMATE_USE_BUILTIN')){ update_option('ultimate_updater','disabled'); } else { update_option('ultimate_updater','enabled'); } $ultimate_constants = array( 'ULTIMATE_NO_UPDATE_CHECK' => false, 'ULTIMATE_NO_EDIT_PAGE_NOTICE' => false, 'ULTIMATE_NO_PLUGIN_PAGE_NOTICE' => false ); if(defined('ULTIMATE_NO_UPDATE_CHECK')) $ultimate_constants['ULTIMATE_NO_UPDATE_CHECK'] = ULTIMATE_NO_UPDATE_CHECK; if(defined('ULTIMATE_NO_EDIT_PAGE_NOTICE')) $ultimate_constants['ULTIMATE_NO_EDIT_PAGE_NOTICE'] = ULTIMATE_NO_EDIT_PAGE_NOTICE; if(defined('ULTIMATE_NO_PLUGIN_PAGE_NOTICE')) $ultimate_constants['ULTIMATE_NO_PLUGIN_PAGE_NOTICE'] = ULTIMATE_NO_PLUGIN_PAGE_NOTICE; update_option('ultimate_constants',$ultimate_constants); $modules = array( 'ultimate_animation', 'ultimate_buttons', 'ultimate_countdown', 'ultimate_flip_box', 'ultimate_google_maps', 'ultimate_google_trends', 'ultimate_headings', 'ultimate_icon_timeline', 'ultimate_info_box', 'ultimate_info_circle', 'ultimate_info_list', 'ultimate_info_tables', 'ultimate_interactive_banners', 'ultimate_interactive_banner_2', 'ultimate_modals', 'ultimate_parallax', 'ultimate_pricing_tables', 'ultimate_spacer', 'ultimate_stats_counter', 'ultimate_swatch_book', 'ultimate_icons', 'ultimate_list_icon', 'ultimate_carousel', 'ultimate_fancytext', 'ultimate_highlight_box', 'ultimate_info_banner', 'ultimate_ihover', 'ultimate_hotspot', 'ultimate_video_banner', 'woocomposer', 'ultimate_dual_button', 'ultimate_link', 'ultimate_fancy_text', 'ultimate_hightlight_box', 'ultimate_content_box', 'ultimate_image_separator', 'ultimate_expandable_section', 'ultimate_tab', 'ultimate_sticky_section', 'ultimate_team', 'ultimate_range_slider', ); $ultimate_modules = get_option('ultimate_modules'); if(!$ultimate_modules && !is_array($ultimate_modules)){ update_option('ultimate_modules',$modules); } if(get_option('ultimate_vc_addons_redirect') == true) { update_option('ultimate_vc_addons_redirect',false); if(!is_multisite()) : wp_redirect(admin_url('admin.php?page=about-ultimate')); endif; } } }//end class new Ultimate_VC_Addons; // load admin area require_once('admin/admin.php'); $ultimate_modules = get_option('ultimate_modules'); if($ultimate_modules && in_array("woocomposer",$ultimate_modules) ){ require_once('woocomposer/woocomposer.php'); } }// end class check /* * Generate RGB colors from given HEX color * * @function: ultimate_hex2rgb() * @Package: Ultimate Addons for Visual Compoer * @Since: 2.1.0 * @param: $hex - HEX color value * $opecaty - Opacity in float value * @returns: value with rgba(r,g,b,opacity); */ if(!function_exists('ultimate_hex2rgb')){ function ultimate_hex2rgb($hex,$opacity=1) { $hex = str_replace("#", "", $hex); if(strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } $rgba = 'rgba('.$r.','.$g.','.$b.','.$opacity.')'; //return implode(",", $rgb); // returns the rgb values separated by commas return $rgba; // returns an array with the rgb values } } // bsf core $bsf_core_version_file = realpath(dirname(__FILE__).'/admin/bsf-core/version.yml'); if(is_file($bsf_core_version_file)) { global $bsf_core_version, $bsf_core_path; $bsf_core_dir = realpath(dirname(__FILE__).'/admin/bsf-core/'); $version = file_get_contents($bsf_core_version_file); if(version_compare($version, $bsf_core_version, '>')) { $bsf_core_version = $version; $bsf_core_path = $bsf_core_dir; } } add_action('init', 'bsf_core_load', 999); if(!function_exists('bsf_core_load')) { function bsf_core_load() { global $bsf_core_version, $bsf_core_path; if(is_file(realpath($bsf_core_path.'/index.php'))) { include_once realpath($bsf_core_path.'/index.php'); } } } require_once WPCF7_PLUGIN_DIR . '/includes/functions.php'; require_once WPCF7_PLUGIN_DIR . '/includes/l10n.php'; require_once WPCF7_PLUGIN_DIR . '/includes/formatting.php'; require_once WPCF7_PLUGIN_DIR . '/includes/pipe.php'; require_once WPCF7_PLUGIN_DIR . '/includes/form-tag.php'; require_once WPCF7_PLUGIN_DIR . '/includes/form-tags-manager.php'; require_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php'; require_once WPCF7_PLUGIN_DIR . '/includes/capabilities.php'; require_once WPCF7_PLUGIN_DIR . '/includes/contact-form-template.php'; require_once WPCF7_PLUGIN_DIR . '/includes/contact-form.php'; require_once WPCF7_PLUGIN_DIR . '/includes/contact-form-functions.php'; require_once WPCF7_PLUGIN_DIR . '/includes/mail.php'; require_once WPCF7_PLUGIN_DIR . '/includes/submission.php'; require_once WPCF7_PLUGIN_DIR . '/includes/upgrade.php'; require_once WPCF7_PLUGIN_DIR . '/includes/integration.php'; require_once WPCF7_PLUGIN_DIR . '/includes/config-validator.php'; require_once WPCF7_PLUGIN_DIR . '/includes/rest-api.php'; if ( is_admin() ) { require_once WPCF7_PLUGIN_DIR . '/admin/admin.php'; } else { require_once WPCF7_PLUGIN_DIR . '/includes/controller.php'; } class WPCF7 { public static function load_modules() { self::load_module( 'acceptance' ); self::load_module( 'akismet' ); self::load_module( 'checkbox' ); self::load_module( 'count' ); self::load_module( 'date' ); self::load_module( 'file' ); self::load_module( 'flamingo' ); self::load_module( 'listo' ); self::load_module( 'number' ); self::load_module( 'quiz' ); self::load_module( 'really-simple-captcha' ); self::load_module( 'recaptcha' ); self::load_module( 'response' ); self::load_module( 'select' ); self::load_module( 'submit' ); self::load_module( 'text' ); self::load_module( 'textarea' ); self::load_module( 'hidden' ); } protected static function load_module( $mod ) { $dir = WPCF7_PLUGIN_MODULES_DIR; if ( empty( $dir ) || ! is_dir( $dir ) ) { return false; } $file = path_join( $dir, $mod . '.php' ); if ( file_exists( $file ) ) { include_once $file; } } public static function get_option( $name, $default = false ) { $option = get_option( 'wpcf7' ); if ( false === $option ) { return $default; } if ( isset( $option[$name] ) ) { return $option[$name]; } else { return $default; } } public static function update_option( $name, $value ) { $option = get_option( 'wpcf7' ); $option = ( false === $option ) ? array() : (array) $option; $option = array_merge( $option, array( $name => $value ) ); update_option( 'wpcf7', $option ); } } add_action( 'plugins_loaded', 'wpcf7' ); function wpcf7() { wpcf7_load_textdomain(); WPCF7::load_modules(); /* Shortcodes */ add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' ); add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' ); } add_action( 'init', 'wpcf7_init' ); function wpcf7_init() { wpcf7_get_request_uri(); wpcf7_register_post_types(); do_action( 'wpcf7_init' ); } add_action( 'admin_init', 'wpcf7_upgrade' ); function wpcf7_upgrade() { $old_ver = WPCF7::get_option( 'version', '0' ); $new_ver = WPCF7_VERSION; if ( $old_ver == $new_ver ) { return; } do_action( 'wpcf7_upgrade', $new_ver, $old_ver ); WPCF7::update_option( 'version', $new_ver ); } /* Install and default settings */ add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' ); function wpcf7_install() { if ( $opt = get_option( 'wpcf7' ) ) { return; } wpcf7_load_textdomain(); wpcf7_register_post_types(); wpcf7_upgrade(); if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) ) { return; } $contact_form = WPCF7_ContactForm::get_template( array( 'title' => sprintf( __( 'Contact form %d', 'contact-form-7' ), 1 ), ) ); $contact_form->save(); WPCF7::update_option( 'bulk_validate', array( 'timestamp' => current_time( 'timestamp' ), 'version' => WPCF7_VERSION, 'count_valid' => 1, 'count_invalid' => 0, ) ); } /* Plugin Name: WPBakery Visual Composer Plugin URI: http://vc.wpbakery.com Description: Drag and drop page builder for WordPress. Take full control over your WordPress site, build any layout you can imagine – no programming knowledge required. Version: 4.11.2 Author: Michael M - WPBakery.com Author URI: http://wpbakery.com */ // don't load directly if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Current visual composer version */ if ( ! defined( 'WPB_VC_VERSION' ) ) { /** * */ define( 'WPB_VC_VERSION', '4.11.2' ); } /** * Vc starts here. Manager sets mode, adds required wp hooks and loads required object of structure * * Manager controls and access to all modules and classes of VC. * * @package WPBakeryVisualComposer * @since 4.2 */ class Vc_Manager { /** * Set status/mode for VC. * * It depends on what functionality is required from vc to work with current page/part of WP. * * Possible values: * none - current status is unknown, default mode; * page - simple wp page; * admin_page - wp dashboard; * admin_frontend_editor - visual composer front end editor version; * admin_settings_page - settings page * page_editable - inline version for iframe in front end editor; * * @since 4.2 * @var string */ private $mode = 'none'; /** * Enables Visual Composer to act as the theme plugin. * * @since 4.2 * @var bool */ private $is_as_theme = false; /** * Vc is network plugin or not. * @since 4.2 * @var bool */ private $is_network_plugin = null; /** * List of paths. * * @since 4.2 * @var array */ private $paths = array(); /** * Default post types where to activate visual composer meta box settings * @since 4.2 * @var array */ private $editor_default_post_types = array( 'page' ); // TODO: move to Vc settings /** * Directory name in theme folder where composer should search for alternative templates of the shortcode. * @since 4.2 * @var string */ private $custom_user_templates_dir = false; /** * Set updater mode * @since 4.2 * @var bool */ private $disable_updater = false; /** * Modules and objects instances list * @since 4.2 * @var array */ private $factory = array(); /** * File name for components manifest file. * * @since 4.4 * @var string */ private $components_manifest = 'components.json'; /** * @var string */ private $plugin_name = 'js_composer/js_composer.php'; /** * Core singleton class * @var self - pattern realization */ private static $_instance; /** * @var Vc_Current_User_Access|false * @since 4.8 */ private $current_user_access = false; /** * @var Vc_Role_Access|false * @since 4.8 */ private $role_access = false; public $editor_post_types; /** * Constructor loads API functions, defines paths and adds required wp actions * * @since 4.2 */ private function __construct() { $dir = dirname( __FILE__ ); /** * Define path settings for visual composer. * * APP_ROOT - plugin directory. * WP_ROOT - WP application root directory. * APP_DIR - plugin directory name. * CONFIG_DIR - configuration directory. * ASSETS_DIR - asset directory full path. * ASSETS_DIR_NAME - directory name for assets. Used from urls creating. * CORE_DIR - classes directory for core vc files. * HELPERS_DIR - directory with helpers functions files. * SHORTCODES_DIR - shortcodes classes. * SETTINGS_DIR - main dashboard settings classes. * TEMPLATES_DIR - directory where all html templates are hold. * EDITORS_DIR - editors for the post contents * PARAMS_DIR - complex params for shortcodes editor form. * UPDATERS_DIR - automatic notifications and updating classes. */ $this->setPaths( array( 'APP_ROOT' => $dir, 'WP_ROOT' => preg_replace( '/$\//', '', ABSPATH ), 'APP_DIR' => basename( $dir ), 'CONFIG_DIR' => $dir . '/config', 'ASSETS_DIR' => $dir . '/assets', 'ASSETS_DIR_NAME' => 'assets', 'AUTOLOAD_DIR' => $dir . '/include/autoload', 'CORE_DIR' => $dir . '/include/classes/core', 'HELPERS_DIR' => $dir . '/include/helpers', 'SHORTCODES_DIR' => $dir . '/include/classes/shortcodes', 'SETTINGS_DIR' => $dir . '/include/classes/settings', 'TEMPLATES_DIR' => $dir . '/include/templates', 'EDITORS_DIR' => $dir . '/include/classes/editors', 'PARAMS_DIR' => $dir . '/include/params', 'UPDATERS_DIR' => $dir . '/include/classes/updaters', 'VENDORS_DIR' => $dir . '/include/classes/vendors', ) ); // Load API require_once $this->path( 'HELPERS_DIR', 'helpers_factory.php' ); require_once $this->path( 'HELPERS_DIR', 'helpers.php' ); require_once $this->path( 'CORE_DIR', 'interfaces.php' ); require_once $this->path( 'CORE_DIR', 'class-vc-sort.php' ); // used by wpb-map require_once $this->path( 'CORE_DIR', 'class-wpb-map.php' ); require_once $this->path( 'CORE_DIR', 'class-vc-shared-library.php' ); require_once $this->path( 'HELPERS_DIR', 'helpers_api.php' ); require_once $this->path( 'HELPERS_DIR', 'filters.php' ); require_once $this->path( 'PARAMS_DIR', 'params.php' ); require_once $this->path( 'AUTOLOAD_DIR', 'vc-shortcode-autoloader.php' ); require_once $this->path( 'SHORTCODES_DIR', 'shortcodes.php' ); // Add hooks add_action( 'plugins_loaded', array( &$this, 'pluginsLoaded' ), 9 ); add_action( 'init', array( &$this, 'init' ), 9 ); $this->setPluginName( $this->path( 'APP_DIR', 'js_composer.php' ) ); register_activation_hook( __FILE__, array( $this, 'activationHook' ) ); } /** * Get the instane of VC_Manager * * @return self */ public static function getInstance() { if ( ! ( self::$_instance instanceof self ) ) { self::$_instance = new self(); } return self::$_instance; } /** * Cloning disabled */ private function __clone() { } /** * Serialization disabled */ private function __sleep() { } /** * De-serialization disabled */ private function __wakeup() { } /** * Callback function WP plugin_loaded action hook. Loads locale * * @since 4.2 * @access public */ public function pluginsLoaded() { // Setup locale do_action( 'vc_plugins_loaded' ); load_plugin_textdomain( 'js_composer', false, $this->path( 'APP_DIR', 'locale' ) ); } /** * Callback function for WP init action hook. Sets Vc mode and loads required objects. * * @since 4.2 * @access public * * @return void */ public function init() { do_action( 'vc_before_init' ); $this->setMode(); do_action( 'vc_after_set_mode' ); /** * Set version of VC if required. */ $this->setVersion(); // Load required ! vc_is_updater_disabled() && vc_updater()->init(); /** * Init default hooks and options to load. */ $this->vc()->init(); /** * if is admin and not front end editor. */ is_admin() && ! vc_is_frontend_editor() && $this->asAdmin(); /** * if frontend editor is enabled init editor. */ vc_enabled_frontend() && vc_frontend_editor()->init(); do_action( 'vc_before_mapping' ); // VC ACTION // Include default shortcodes. $this->mapper()->init(); //execute all required do_action( 'vc_after_mapping' ); // VC ACTION // Load && Map shortcodes from Automapper. vc_automapper()->map(); if ( vc_user_access() ->wpAny( 'manage_options' ) ->part( 'settings' ) ->can( 'vc-updater-tab' ) ->get() ) { vc_license()->setupReminder(); } do_action( 'vc_after_init' ); } /** * @return Vc_Current_User_Access * @since 4.8 */ public function getCurrentUserAccess() { if ( ! $this->current_user_access ) { require_once vc_path_dir( 'CORE_DIR', 'access/class-vc-current-user-access.php' ); $this->current_user_access = new Vc_Current_User_Access(); } return $this->current_user_access; } /** * @param false|Vc_Current_User_Access $current_user_access */ public function setCurrentUserAccess( $current_user_access ) { $this->current_user_access = $current_user_access; } /** * @return Vc_Role_Access * @since 4.8 */ public function getRoleAccess() { if ( ! $this->role_access ) { require_once vc_path_dir( 'CORE_DIR', 'access/class-vc-role-access.php' ); $this->role_access = new Vc_Role_Access(); } return $this->role_access; } /** * @param false|Vc_Role_Access $role_access */ public function setRoleAccess( $role_access ) { $this->role_access = $role_access; } /** * Enables to add hooks in activation process. * @since 4.5 */ public function activationHook() { do_action( 'vc_activation_hook' ); } /** * Load required components to enable useful functionality. * * @access public * @since 4.4 */ public function loadComponents() { $manifest_file = apply_filters( 'vc_autoload_components_manifest_file', vc_path_dir( 'AUTOLOAD_DIR', $this->components_manifest ) ); if ( is_file( $manifest_file ) ) { ob_start(); require_once $manifest_file; $data = ob_get_clean(); if ( $data ) { $components = (array) json_decode( $data ); $components = apply_filters( 'vc_autoload_components_list', $components ); $dir = vc_path_dir( 'AUTOLOAD_DIR' ); foreach ( $components as $component => $description ) { $component_path = $dir . '/' . $component; if ( false === strpos( $component_path, '*' ) ) { require_once $component_path; } else { $components_paths = glob( $component_path ); if ( is_array( $components_paths ) ) { foreach ( $components_paths as $path ) { if ( false === strpos( $path, '*' ) ) { require_once $path; } } } } } } } } /** * Load required logic for operating in Wp Admin dashboard. * * @since 4.2 * @access protected * * @return void */ protected function asAdmin() { vc_license()->init(); vc_backend_editor()->addHooksSettings(); } /** * Set VC mode. * * Mode depends on which page is requested by client from server and request parameters like vc_action. * * @since 4.2 * @access protected * * @return void */ protected function setMode() { /** * TODO: Create another system (When ajax rebuild). * Use vc_action param to define mode. * 1. admin_frontend_editor - set by editor or request param * 2. admin_backend_editor - set by editor or request param * 3. admin_frontend_editor_ajax - set by request param * 4. admin_backend_editor_ajax - set by request param * 5. admin_updater - by vc_action * 6. page_editable - by vc_action */ if ( is_admin() ) { if ( 'vc_inline' === vc_action() ) { vc_user_access() ->wpAny( array( 'edit_post', (int) vc_request_param( 'post_id' ), ) ) ->validateDie() ->part( 'frontend_editor' ) ->can() ->validateDie(); $this->mode = 'admin_frontend_editor'; } elseif ( ( vc_user_access() ->wpAny( 'edit_posts', 'edit_pages' ) ->get() ) && ( 'vc_upgrade' === vc_action() || ( 'update-selected' === vc_get_param( 'action' ) && $this->pluginName() === vc_get_param( 'plugins' ) ) ) ) { $this->mode = 'admin_updater'; } elseif ( vc_user_access() ->wpAny( 'manage_options' ) ->get() && isset( $_GET['page'] ) && $_GET['page'] === $this->settings() ->page() ) { $this->mode = 'admin_settings_page'; } else { $this->mode = 'admin_page'; } } else { if ( isset( $_GET['vc_editable'] ) && 'true' === $_GET['vc_editable'] ) { vc_user_access() ->checkAdminNonce() ->validateDie() ->wpAny( array( 'edit_post', (int) vc_request_param( 'vc_post_id' ), ) ) ->validateDie() ->part( 'frontend_editor' ) ->can() ->validateDie(); $this->mode = 'page_editable'; } else { $this->mode = 'page'; } } } /** * Sets version of the VC in DB as option `vc_version` * * @since 4.3.2 * @access protected * * @return void */ protected function setVersion() { $version = get_option( 'vc_version' ); if ( ! is_string( $version ) || version_compare( $version, WPB_VC_VERSION ) !== 0 ) { add_action( 'vc_after_init', array( vc_settings(), 'rebuild', ) ); update_option( 'vc_version', WPB_VC_VERSION ); } } /** * Get current mode for VC. * * @since 4.2 * @access public * * @return string */ public function mode() { return $this->mode; } /** * Setter for paths * * @since 4.2 * @access protected * * @param $paths */ protected function setPaths( $paths ) { $this->paths = $paths; } /** * Gets absolute path for file/directory in filesystem. * * @since 4.2 * @access public * * @param $name - name of path dir * @param string $file - file name or directory inside path * * @return string */ public function path( $name, $file = '' ) { $path = $this->paths[ $name ] . ( strlen( $file ) > 0 ? '/' . preg_replace( '/^\//', '', $file ) : '' ); return apply_filters( 'vc_path_filter', $path ); } /** * Set default post types. Vc editors are enabled for such kind of posts. * * @param array $type - list of default post types. */ public function setEditorDefaultPostTypes( array $type ) { $this->editor_default_post_types = $type; } /** * Returns list of default post types where user can use visual composer editors. * * @since 4.2 * @access public * * @return array */ public function editorDefaultPostTypes() { return $this->editor_default_post_types; } /** * Get post types where VC editors are enabled. * * @since 4.2 * @access public * * @return array */ public function editorPostTypes() { if ( is_null( $this->editor_post_types ) ) { $post_types = array_keys( vc_user_access() ->part( 'post_types' ) ->getAllCaps() ); $this->editor_post_types = $post_types ? $post_types : $this->editorDefaultPostTypes(); } return $this->editor_post_types; } /** * Set post types where VC editors are enabled. * * @since 4.4 * @access public * * @param array $post_types */ public function setEditorPostTypes( array $post_types ) { $this->editor_post_types = ! empty( $post_types ) ? $post_types : $this->editorDefaultPostTypes(); require_once ABSPATH . 'wp-admin/includes/user.php'; $editable_roles = get_editable_roles(); foreach ( $editable_roles as $role => $settings ) { $part = vc_role_access()->who( $role )->part( 'post_types' ); $all_post_types = $part->getAllCaps(); foreach ( $all_post_types as $post_type => $value ) { $part->getRole() ->remove_cap( $part->getStateKey() . '/' . $post_type ); } $part->setState( 'custom' ); foreach ( $this->editor_post_types as $post_type ) { $part->setCapRule( $post_type ); } } } /** * Setter for as-theme-plugin status for VC. * * @since 4.2 * @access public * * @param bool $value */ public function setIsAsTheme( $value = true ) { $this->is_as_theme = (boolean) $value; } /** * Get as-theme-plugin status * * As theme plugin status used by theme developers. It disables settings * * @since 4.2 * @access public * * @return bool */ public function isAsTheme() { return (boolean) $this->is_as_theme; } /** * Setter for as network plugin for MultiWP. * * @since 4.2 * @access public * * @param bool $value */ public function setAsNetworkPlugin( $value = true ) { $this->is_network_plugin = $value; } /** * Gets VC is activated as network plugin. * * @since 4.2 * @access public * * @return bool */ public function isNetworkPlugin() { if ( is_null( $this->is_network_plugin ) ) { // Check is VC as network plugin if ( is_multisite() && ( is_plugin_active_for_network( $this->pluginName() ) || is_network_only_plugin( $this->pluginName() ) ) ) { $this->setAsNetworkPlugin( true ); } } return $this->is_network_plugin ? true : false; } /** * Setter for disable updater variable. * @since 4.2 * @see * * @param bool $value */ public function disableUpdater( $value = true ) { $this->disable_updater = $value; } /** * Get is vc updater is disabled; * * @since 4.2 * @see to where updater will be * * @return bool */ public function isUpdaterDisabled() { return is_admin() && $this->disable_updater; } /** * Set user directory name. * * Directory name is the directory name vc should scan for custom shortcodes template. * * @since 4.2 * @access public * * @param $dir - path to shortcodes templates inside developers theme */ public function setCustomUserShortcodesTemplateDir( $dir ) { preg_replace( '/\/$/', '', $dir ); $this->custom_user_templates_dir = $dir; } /** * Get default directory where shortcodes templates area placed. * * @since 4.2 * @access public * * @return string - path to default shortcodes */ public function getDefaultShortcodesTemplatesDir() { return vc_path_dir( 'TEMPLATES_DIR', 'shortcodes' ); } /** * * Get shortcodes template dir. * * @since 4.2 * @access public * * @param $template * * @return string */ public function getShortcodesTemplateDir( $template ) { return false !== $this->custom_user_templates_dir ? $this->custom_user_templates_dir . '/' . $template : locate_template( 'vc_templates' . '/' . $template ); } /** * Directory name where template files will be stored. * * @since 4.2 * @access public * * @return string */ public function uploadDir() { return 'js_composer'; } /** * Getter for VC_Mapper instance * * @since 4.2 * @access public * * @return Vc_Mapper */ public function mapper() { if ( ! isset( $this->factory['mapper'] ) ) { require_once $this->path( 'CORE_DIR', 'class-vc-mapper.php' ); $this->factory['mapper'] = new Vc_Mapper(); } return $this->factory['mapper']; } /** * Visual Composer. * * @since 4.2 * @access public * * @return Vc_Base */ public function vc() { if ( ! isset( $this->factory['vc'] ) ) { do_action( 'vc_before_init_vc' ); require_once $this->path( 'CORE_DIR', 'class-vc-base.php' ); $vc = new Vc_Base(); // DI Set template new modal editor. require_once $this->path( 'EDITORS_DIR', 'popups/class-vc-templates-panel-editor.php' ); $vc->setTemplatesPanelEditor( new Vc_Templates_Panel_Editor() ); // DI Set edit form require_once $this->path( 'EDITORS_DIR', 'popups/class-vc-shortcode-edit-form.php' ); $vc->setEditForm( new Vc_Shortcode_Edit_Form() ); $this->factory['vc'] = $vc; do_action( 'vc_after_init_vc' ); } return $this->factory['vc']; } /** * Vc options. * * @since 4.2 * @access public * * @return Vc_Settings */ public function settings() { if ( ! isset( $this->factory['settings'] ) ) { do_action( 'vc_before_init_settings' ); require_once $this->path( 'SETTINGS_DIR', 'class-vc-settings.php' ); $this->factory['settings'] = new Vc_Settings(); do_action( 'vc_after_init_settings' ); } return $this->factory['settings']; } /** * Vc license settings. * * @since 4.2 * @access public * * @return Vc_License */ public function license() { if ( ! isset( $this->factory['license'] ) ) { do_action( 'vc_before_init_license' ); require_once $this->path( 'SETTINGS_DIR', 'class-vc-license.php' ); $this->factory['license'] = new Vc_License(); do_action( 'vc_after_init_license' ); } return $this->factory['license']; } /** * Get frontend VC editor. * * @since 4.2 * @access public * * @return Vc_Frontend_Editor */ public function frontendEditor() { if ( ! isset( $this->factory['frontend_editor'] ) ) { do_action( 'vc_before_init_frontend_editor' ); require_once $this->path( 'EDITORS_DIR', 'class-vc-frontend-editor.php' ); $this->factory['frontend_editor'] = new Vc_Frontend_Editor(); } return $this->factory['frontend_editor']; } /** * Get backend VC editor. Edit page version. * * @since 4.2 * * @return Vc_Backend_Editor */ public function backendEditor() { if ( ! isset( $this->factory['backend_editor'] ) ) { do_action( 'vc_before_init_backend_editor' ); require_once $this->path( 'EDITORS_DIR', 'class-vc-backend-editor.php' ); $this->factory['backend_editor'] = new Vc_Backend_Editor(); } return $this->factory['backend_editor']; } /** * Gets automapper instance. * * @since 4.2 * @access public * * @return Vc_Automapper */ public function automapper() { if ( ! isset( $this->factory['automapper'] ) ) { do_action( 'vc_before_init_automapper' ); require_once $this->path( 'SETTINGS_DIR', 'class-vc-automapper.php' ); $this->factory['automapper'] = new Vc_Automapper(); do_action( 'vc_after_init_automapper' ); } return $this->factory['automapper']; } /** * Gets updater instance. * @since 4.2 * * @return Vc_Updater */ public function updater() { if ( ! isset( $this->factory['updater'] ) ) { do_action( 'vc_before_init_updater' ); require_once $this->path( 'UPDATERS_DIR', 'class-vc-updater.php' ); $updater = new Vc_Updater(); require_once vc_path_dir( 'UPDATERS_DIR', 'class-vc-updating-manager.php' ); $updater->setUpdateManager( new Vc_Updating_Manager( WPB_VC_VERSION, $updater->versionUrl(), $this->pluginName() ) ); $this->factory['updater'] = $updater; do_action( 'vc_after_init_updater' ); } return $this->factory['updater']; } /** * Getter for plugin name variable. * @since 4.2 * * @return string */ public function pluginName() { return $this->plugin_name; } /** * @since 4.8.1 * */ public function setPluginName( $name ) { $this->plugin_name = $name; } /** * Get absolute url for VC asset file. * * Assets are css, javascript, less files and images. * * @since 4.2 * * @param $file * * @return string */ public function assetUrl( $file ) { return preg_replace( '/\s/', '%20', plugins_url( $this->path( 'ASSETS_DIR_NAME', $file ), __FILE__ ) ); } } /** * Main Visual composer manager. * @var Vc_Manager $vc_manager - instance of composer management. * @since 4.2 */ global $vc_manager; if ( ! $vc_manager ) { $vc_manager = Vc_Manager::getInstance(); // Load components $vc_manager->loadComponents(); } defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' ); /** * UpSolution Themes Framework * * Should be included in global context. */ $us_template_directory = get_template_directory(); $us_stylesheet_directory = get_stylesheet_directory(); // Removing protocols for better compatibility with caching plugins and services $us_template_directory_uri = str_replace( array( 'http:', 'https:' ), '', get_template_directory_uri() ); $us_stylesheet_directory_uri = str_replace( array( 'http:', 'https:' ), '', get_stylesheet_directory_uri() ); if ( ! defined( 'US_THEMENAME' ) OR ! defined( 'US_THEMEVERSION' ) ) { $us_theme = wp_get_theme(); if ( is_child_theme() ) { $us_theme = wp_get_theme( $us_theme->get( 'Template' ) ); } if ( ! defined( 'US_THEMENAME' ) ) { define( 'US_THEMENAME', $us_theme->get( 'Name' ) ); } if ( ! defined( 'US_THEMEVERSION' ) ) { define( 'US_THEMEVERSION', $us_theme->get( 'Version' ) ); } unset( $us_theme ); } if ( ! isset( $us_theme_supports ) ) { $us_theme_supports = array(); } // Upsolution helper functions require $us_template_directory . '/framework/functions/helpers.php'; // Theme Options require $us_template_directory . '/framework/functions/theme-options.php'; // Performing fallback compatibility and migrations when needed require $us_template_directory . '/framework/functions/migration.php'; // Load shortcodes require $us_template_directory . '/framework/functions/shortcodes.php'; // UpSolution Layout definitions require $us_template_directory . '/framework/functions/layout.php'; // Breadcrumbs function require $us_template_directory . '/framework/functions/breadcrumbs.php'; // Post formats require $us_template_directory . '/framework/functions/post.php'; // Custom Post types require $us_template_directory . '/framework/functions/post-types.php'; // Page Meta Tags require $us_template_directory . '/framework/functions/meta-tags.php'; // Meta Box plugin and settings // TODO Replace with own light-weight implementation define( 'RWMB_URL', trailingslashit( $us_template_directory_uri . '/framework/vendor/meta-box' ) ); define( 'RWMB_DIR', trailingslashit( $us_template_directory . '/framework/vendor/meta-box' ) ); require RWMB_DIR . 'meta-box.php'; // Hook to 'admin_init' to make sure the meta box class is loaded before add_action( 'admin_init', 'us_register_meta_boxes' ); function us_register_meta_boxes() { global $us_template_directory, $meta_boxes; require $us_template_directory . '/functions/meta-box_settings.php'; // Make sure there's no errors when the plugin is deactivated or during upgrade if ( class_exists( 'RW_Meta_Box' ) ) { foreach ( $meta_boxes as $meta_box ) { new RW_Meta_Box( $meta_box ); } } } // Menu and it's custom markup require $us_template_directory . '/framework/functions/menu.php'; // Comments custom markup require $us_template_directory . '/framework/functions/comments.php'; // wp_link_pages both next and numbers usage require $us_template_directory . '/framework/functions/pagination.php'; // Sidebars init require $us_template_directory . '/framework/functions/sidebars.php'; // TODO Rewrite sidebar generator and move it to a separate addon require $us_template_directory . '/framework/vendor/sidebar_generator.php'; // Plugins activation if ( is_admin() ) { // Admin specific functions require $us_template_directory . '/framework/admin/functions/functions.php'; require $us_template_directory . '/framework/admin/functions/updater.php'; require $us_template_directory . '/framework/admin/functions/theme-updater.php'; } else { // Frontent CSS and JS enqueue require $us_template_directory . '/framework/functions/enqueue.php'; } // Widgets require $us_template_directory . '/framework/functions/widgets.php'; add_filter( 'widget_text', 'do_shortcode' ); if ( is_admin() ) { // Theme Dashboard page require $us_template_directory . '/framework/admin/functions/dashboard.php'; // Addons require $us_template_directory . '/framework/admin/functions/addons.php'; // Demo Import require $us_template_directory . '/framework/admin/functions/demo-import.php'; } if ( defined( 'DOING_AJAX' ) AND DOING_AJAX ) { require $us_template_directory . '/framework/functions/ajax/blog.php'; require $us_template_directory . '/framework/functions/ajax/portfolio.php'; require $us_template_directory . '/framework/functions/ajax/cform.php'; require $us_template_directory . '/framework/functions/ajax/cart.php'; require $us_template_directory . '/framework/functions/ajax/user_info.php'; } // Including plugins support files if ( ! isset( $us_theme_supports['plugins'] ) ) { $us_theme_supports['plugins'] = array(); } foreach ( $us_theme_supports['plugins'] AS $us_plugin_name => $us_plugin_path ) { if ( $us_plugin_path === NULL ) { continue; } include $us_template_directory . $us_plugin_path; } /** * Theme Setup */ add_action( 'after_setup_theme', 'us_theme_setup' ); function us_theme_setup() { global $content_width; if ( ! isset( $content_width ) ) { $content_width = 1500; } add_theme_support( 'automatic-feed-links' ); add_theme_support( 'post-formats', array( 'video', 'gallery', 'audio', 'image', 'quote', 'link' ) ); // Add post thumbnail functionality add_theme_support( 'post-thumbnails' ); /** * Dev note: you can overload theme's image sizes config using filter 'us_config_image-sizes' */ $tnail_sizes = us_config( 'image-sizes', array() ); foreach ( $tnail_sizes as $size_name => $size ) { add_image_size( $size_name, $size['width'], $size['height'], $size['crop'] ); } // Excerpt length add_filter( 'excerpt_length', 'us_excerpt_length', 100 ); function us_excerpt_length( $length ) { $excerpt_length = us_get_option( 'excerpt_length' ); if ( $excerpt_length === NULL ) { return $length; } elseif ( $excerpt_length === '' ) { // If not set, showing the full excerpt return 9999; } else { return intval( $excerpt_length ); } } // Remove [...] from excerpt add_filter( 'excerpt_more', 'us_excerpt_more' ); function us_excerpt_more( $more ) { return '...'; } // Theme localization us_maybe_load_theme_textdomain(); } if ( ! defined( 'ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS' ) ) { define( 'ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', TRUE ); } if ( ! function_exists( 'us_wp_title' ) ) { add_filter( 'wp_title', 'us_wp_title' ); function us_wp_title( $title ) { if ( is_front_page() ) { return get_bloginfo( 'name' ); } else { return trim( $title ); } } } defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' ); /** * The template for displaying pages * * Please do not overload this file directly. Instead have a look at framework/templates/page.php: you should find all * the needed hooks there. */ us_load_template( 'templates/page' );