function vc_page_settings_tab_color_submit_attributes($submitButtonAttributes)
{
    $submitButtonAttributes['data-vc-less-path'] = vc_asset_url('less/js_composer.less');
    $submitButtonAttributes['data-vc-less-root'] = vc_asset_url('less');
    $submitButtonAttributes['data-vc-less-variables'] = json_encode(apply_filters('vc_settings-less-variables', array('vc_grey' => array('key' => 'wpb_js_vc_color', 'default' => vc_settings()->getDefault('vc_color')), 'vc_grey_hover' => array('key' => 'wpb_js_vc_color_hover', 'default' => vc_settings()->getDefault('vc_color_hover')), 'vc_image_slider_link_active' => 'wpb_js_vc_color_hover', 'vc_call_to_action_bg' => 'wpb_js_vc_color_call_to_action_bg', 'vc_call_to_action_2_bg' => 'wpb_js_vc_color_call_to_action_bg', 'vc_call_to_action_border' => array('key' => 'wpb_js_vc_color_call_to_action_border', 'default_key' => 'wpb_js_vc_color', 'modify_output' => array(array('plain' => array('darken({{ value }}, 5%)')))), 'vc_google_maps_bg' => 'wpb_js_vc_color_google_maps_bg', 'vc_post_slider_caption_bg' => 'wpb_js_vc_color_post_slider_caption_bg', 'vc_progress_bar_bg' => 'wpb_js_vc_color_progress_bar_bg', 'vc_separator_border' => 'wpb_js_vc_color_separator_border', 'vc_tab_bg' => 'wpb_js_vc_color_tab_bg', 'vc_tab_bg_active' => 'wpb_js_vc_color_tab_bg_active', 'vc_element_margin_bottom' => array('key' => 'wpb_js_margin', 'default' => vc_settings()->getDefault('margin')), 'grid-gutter-width' => array('key' => 'wpb_js_gutter', 'default' => vc_settings()->getDefault('gutter'), 'modify_output' => array(array('plain' => array('{{ value }}px')))), 'screen-sm-min' => array('key' => 'wpb_js_responsive_max', 'default' => vc_settings()->getDefault('responsive_max'), 'modify_output' => array(array('plain' => array('{{ value }}px')))))));
    return $submitButtonAttributes;
}
 /**
  *
  */
 public function activate()
 {
     $params = array();
     $params['username'] = vc_post_param('username');
     $params['version'] = WPB_VC_VERSION;
     $params['key'] = vc_post_param('key');
     $params['api_key'] = vc_post_param('api_key');
     $params['url'] = get_site_url();
     $params['ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
     $params['dkey'] = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
     $string = 'activatelicense?';
     $request_url = self::getWpbControlUrl(array($string, http_build_query($params, '', '&')));
     $response = wp_remote_get($request_url, array('timeout' => 300));
     if (is_wp_error($response)) {
         echo json_encode(array('result' => false));
         die;
     }
     $result = json_decode($response['body']);
     if (!is_object($result)) {
         echo json_encode(array('result' => false));
         die;
     }
     if ((bool) $result->result === true || (int) $result->code === 401 && isset($result->deactivation_key)) {
         $this->setDeactivation(isset($result->code) && (int) $result->code === 401 ? $result->deactivation_key : $params['dkey']);
         vc_settings()->set('envato_username', $params['username']);
         vc_settings()->set('envato_api_key', $params['api_key']);
         vc_settings()->set('js_composer_purchase_code', $params['key']);
         echo json_encode(array('result' => true));
         die;
     }
     echo $response['body'];
     die;
 }
Beispiel #3
0
function vc_column_offset_class_merge($column_offset, $width)
{
    // Remove offset settings if
    if (vc_settings()->get('not_responsive_css') === '1') {
        $column_offset = preg_replace('/vc_col\\-(lg|md|xs)[^\\s]*/', '', $column_offset);
    }
    if (preg_match('/vc_col\\-sm\\-\\d+/', $column_offset)) {
        return $column_offset;
    }
    return $width . (empty($column_offset) ? '' : ' ' . $column_offset);
}
Beispiel #4
0
 /**
  * Method adds css class to body tag.
  *
  * Hooked class method by body_class WP filter. Method adds custom css class to body tag of the page to help
  * identify and build design specially for VC shortcodes.
  *
  * @since  4.2
  * @access public
  * @param $classes
  * @return array
  */
 public function bodyClass($classes)
 {
     $classes[] = 'wpb-js-composer js-comp-ver-' . WPB_VC_VERSION;
     $disable_responsive = vc_settings()->get('not_responsive_css');
     if ($disable_responsive !== '1') {
         $classes[] = 'vc_responsive';
     } else {
         $classes[] = 'vc_non_responsive';
     }
     return $classes;
 }
 public function getControlScreenSize()
 {
     $disable_responsive = vc_settings()->get('not_responsive_css');
     if ($disable_responsive !== '1') {
         $screen_sizes = array(array('title' => __('Desktop', LANGUAGE_ZONE), 'size' => '100%', 'key' => 'default', 'active' => true), array('title' => __('Tablet landscape mode', LANGUAGE_ZONE), 'size' => '1024px', 'key' => 'landscape-tablets'), array('title' => __('Tablet portrait mode', LANGUAGE_ZONE), 'size' => '768px', 'key' => 'portrait-tablets'), array('title' => __('Smartphone landscape mode', LANGUAGE_ZONE), 'size' => '480px', 'key' => 'landscape-smartphones'), array('title' => __('Smartphone portrait mode', LANGUAGE_ZONE), 'size' => '320px', 'key' => 'portrait-smartphones'));
         $output = '<li class="vc_pull-right">' . '<div class="vc_dropdown" id="vc_screen-size-control">' . '<a href="#" class="vc_dropdown-toggle"' . ' title="' . __("Responsive preview", LANGUAGE_ZONE) . '"><i class="vc_icon default"' . ' id="vc_screen-size-current"></i><b class="vc_caret"></b></a>' . '<ul class="vc_dropdown-list">';
         while ($screen = current($screen_sizes)) {
             $output .= '<li><a href="#" title="' . esc_attr($screen['title']) . '"' . ' class="vc_screen-width ' . $screen['key'] . (isset($screen['active']) && $screen['active'] ? ' active' : '') . '" data-size="' . $screen['size'] . '"></a></li>';
             next($screen_sizes);
         }
         $output .= '</ul></div></li>';
         return $output;
     }
     return '';
 }
 function TS_VCSC_Widgets_Post_Compooser()
 {
     if (function_exists('vc_editor_post_types') && function_exists('vc_set_default_editor_post_types') && function_exists('vc_settings')) {
         $TS_VCSC_ComposerContentTypes = vc_editor_post_types();
         $TS_VCSC_ComposerDefaultTypes = array();
         if (!in_array('ts_widgets', $TS_VCSC_ComposerContentTypes, true)) {
             foreach ($TS_VCSC_ComposerContentTypes as $value) {
                 array_push($TS_VCSC_ComposerDefaultTypes, $value);
             }
             array_push($TS_VCSC_ComposerDefaultTypes, 'ts_widgets');
             vc_set_default_editor_post_types($TS_VCSC_ComposerDefaultTypes);
             vc_settings()->set('content_types', $TS_VCSC_ComposerDefaultTypes);
         }
     }
 }
Beispiel #7
0
 function Ep_After_Setup()
 {
     if (class_exists('WPBakeryVisualComposerAbstract')) {
         //Enable Visual composer in portfolio
         $pt_array = vc_settings()->get('content_types');
         if (is_array($pt_array)) {
             if (!in_array("portfolio", $pt_array)) {
                 $pt_array[] = "portfolio";
             }
             if (!in_array("page", $pt_array)) {
                 $pt_array[] = "page";
             }
             vc_settings()->set('content_types', $pt_array);
         }
     }
     //Initialize default options
     //delete_option(OPTIONS_KEY);
     $options = get_option(OPTIONS_KEY);
     $defaults = ep_admin_get_defaults();
     // Are our options saved in the DB?
     if (false !== $options) {
         $changed = false;
         //Add new keys if any
         foreach ($defaults as $key => $value) {
             if (!array_key_exists($key, $options)) {
                 //Add default value
                 $options[$key] = $value;
                 $changed = true;
             }
         }
         //Check if any key removed from defaults
         foreach ($options as $key => $value) {
             if (!array_key_exists($key, $defaults)) {
                 //Remove the option
                 unset($options[$key]);
                 $changed = true;
             }
         }
         if ($changed) {
             update_option(OPTIONS_KEY, $options);
         }
         return;
     }
     // If not, we'll save our default options
     add_option(OPTIONS_KEY, $defaults);
 }
 /**
  * Gets user role and access rules for current user.
  *
  * @static
  * @return mixed
  */
 protected static function getSettings()
 {
     global $current_user;
     if (self::$settings === null) {
         if (function_exists('get_currentuserinfo')) {
             get_currentuserinfo();
             /** @var $settings - get use group access rules */
             if (!empty($current_user->roles)) {
                 self::$user_role = $current_user->roles[0];
             } else {
                 self::$user_role = 'author';
             }
         } else {
             self::$user_role = 'author';
         }
         self::$settings = vc_settings()->get('groups_access_rules');
     }
     return self::$settings;
 }
Beispiel #9
0
 /**
  * Downloads new VC from Envato marketplace and unzips into temporary directory.
  *
  * @param $reply
  * @param $package
  * @param $updater
  * @return mixed|string|WP_Error
  */
 public function upgradeFilterFromEnvato($reply, $package, $updater)
 {
     global $wp_filesystem;
     if (isset($updater->skin->plugin) && $updater->skin->plugin === vc_plugin_name() || isset($updater->skin->plugin_info) && $updater->skin->plugin_info['Name'] === $this->title) {
         $updater->strings['download_envato'] = __('Downloading package from envato market...', LANGUAGE_ZONE);
         $updater->skin->feedback('download_envato');
         $package_filename = 'js_composer.zip';
         $res = $updater->fs_connect(array(WP_CONTENT_DIR));
         if (!$res) {
             return new WP_Error('no_credentials', __("Error! Can't connect to filesystem", LANGUAGE_ZONE));
         }
         $username = vc_settings()->get('envato_username');
         $api_key = vc_settings()->get('envato_api_key');
         $purchase_code = vc_settings()->get('js_composer_purchase_code');
         if (empty($username) || empty($api_key) || empty($purchase_code)) {
             return new WP_Error('no_credentials', __('Error! Envato username, api key and your purchase code are required for downloading updates from Envato marketplace for the Visual Composer. Visit <a href="' . admin_url('options-general.php?page=vc_settings&tab=updater') . '' . '" target="_blank">Settings</a> to fix.', LANGUAGE_ZONE));
         }
         $json = wp_remote_get($this->envatoDownloadPurchaseUrl($username, $api_key, $purchase_code));
         $result = json_decode($json['body'], true);
         if (!isset($result['download-purchase']['download_url'])) {
             return new WP_Error('no_credentials', __('Error! Envato API error' . (isset($result['error']) ? ': ' . $result['error'] : '.'), LANGUAGE_ZONE));
         }
         $result['download-purchase']['download_url'];
         $download_file = download_url($result['download-purchase']['download_url']);
         if (is_wp_error($download_file)) {
             return $download_file;
         }
         $upgrade_folder = $wp_filesystem->wp_content_dir() . 'uploads/js_composer_envato_package';
         if (is_dir($upgrade_folder)) {
             $wp_filesystem->delete($upgrade_folder);
         }
         $result = unzip_file($download_file, $upgrade_folder);
         if ($result && is_file($upgrade_folder . '/' . $package_filename)) {
             return $upgrade_folder . '/' . $package_filename;
         }
         return new WP_Error('no_credentials', __('Error on unzipping package', LANGUAGE_ZONE));
     }
     return $reply;
 }
Beispiel #10
0
 /**
  * Functions that run on init
  *
  * @since 2.0.0
  */
 public function init()
 {
     // Override editor logo
     add_filter('vc_nav_front_logo', array($this, 'nav_logo'));
     // Remove templatera notice
     remove_action('admin_notices', 'templatera_notice');
     // Set defaults for admin
     if (function_exists('vc_set_default_editor_post_types')) {
         vc_set_default_editor_post_types(array('page', 'portfolio', 'staff', 'templatera'));
     }
     // Set defaults for editor
     if (function_exists('vc_editor_set_post_types ')) {
         $types = vc_settings()->get('content_types');
         if (empty($types)) {
             vc_editor_set_post_types(array('page', 'portfolio', 'staff'));
         }
     }
     // Array of elements to remove
     $elements = array('vc_teaser_grid', 'vc_posts_grid', 'vc_posts_slider', 'vc_carousel', 'vc_gallery', 'vc_wp_text', 'vc_wp_pages', 'vc_wp_links', 'vc_wp_categories', 'vc_wp_meta', 'vc_images_carousel');
     // Add filter for child theme tweaking
     $elements = apply_filters('wpex_vc_remove_elements', $elements);
     // Loop through elements to remove and remove them
     if (is_array($elements)) {
         foreach ($elements as $element) {
             vc_remove_element($element);
         }
     }
     // Add param to tabs
     vc_add_param('vc_tabs', array('type' => 'dropdown', 'heading' => esc_html__('Style', 'total'), 'param_name' => 'style', 'value' => array(esc_html__('Default', 'total') => 'default', esc_html__('Alternative #1', 'total') => 'alternative-one', esc_html__('Alternative #2', 'total') => 'alternative-two')));
     // Add param Tours
     vc_add_param('vc_tour', array('type' => 'dropdown', 'heading' => esc_html__('Style', 'total'), 'param_name' => 'style', 'value' => array(esc_html__('Default', 'total') => 'default', esc_html__('Alternative #1', 'total') => 'alternative-one', esc_html__('Alternative #2', 'total') => 'alternative-two')));
     // Include custom modules
     if (function_exists('vc_lean_map') && wpex_get_mod('extend_visual_composer', true)) {
         $this->total_custom_vc_shortcodes();
     }
 }
 /**
  * Shows message on Wp plugins page with a link for updating from envato.
  */
 public function addUpgradeMessageLink()
 {
     $username = vc_settings()->get('envato_username');
     $api_key = vc_settings()->get('envato_api_key');
     $purchase_code = vc_settings()->get('js_composer_purchase_code');
     echo '<style type="text/css" media="all">tr#wpbakery-visual-composer + tr.plugin-update-tr a.thickbox + em { display: none; }</style>';
     if (empty($username) || empty($api_key) || empty($purchase_code)) {
         echo ' <a href="' . $this->url . '">' . __('Download new version from CodeCanyon.', 'js_composer') . '</a>';
     } else {
         // update.php?action=upgrade-plugin&plugin=testimonials-widget%2Ftestimonials-widget.php&_wpnonce=6178d48b6e
         // echo '<a href="' . wp_nonce_url( admin_url( 'plugins.php?vc_action=vc_upgrade' ) ) . '">' . __( 'Update Visual Composer now.', 'js_composer' ) . '</a>';
         echo '<a href="' . wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . vc_plugin_name()), 'upgrade-plugin_' . vc_plugin_name()) . '">' . __('Update Visual Composer now.', 'js_composer') . '</a>';
     }
 }
Beispiel #12
0
function get_custom_column_class( $class ) {
	$custom_array = (array)vc_settings()->get( 'column_css_classes' );
	return ! empty( $custom_array[$class] ) ? $custom_array[$class] : '';
}
	function showButton( $post_id = null ) {
		global $current_user;
		get_currentuserinfo();
		$show = true;

		if ( ! self::inlineEnabled() || ! current_user_can( 'edit_post', $post_id ) ) return false;
		/** @var $settings - get use group access rules */

		$settings = vc_settings()->get( 'groups_access_rules' );
		foreach ( $current_user->roles as $role ) {
			if ( isset( $settings[$role]['show'] ) && $settings[$role]['show'] === 'no' ) {
				$show = false;
				break;
			}
		}
		return $show && in_array( get_post_type(), vc_editor_post_types() );
	}
Beispiel #14
0
/**
 * @deprecated 4.2
 * @since 4.2
 * @return mixed|string|void
 */
function get_row_css_class()
{
    // _deprecated_function( 'get_row_css_class', '4.2 (will be removed in 4.10)' );
    $custom = vc_settings()->get('row_css_class');
    return !empty($custom) ? $custom : 'vc_row-fluid';
}
 /**
  * Build theme dropdown
  * @deprecated not used anymore and will be removed
  */
 public function settingsFieldThemes()
 {
     $this->getThemes();
     $field_prefix = vc_settings()->getFieldPrefix();
     $value = ($value = get_option($field_prefix . 'themes')) ? $value : '';
     echo '<select name="' . $field_prefix . 'themes' . '">';
     echo '<option value=""></option>';
     foreach ($this->themes as $key => $title) {
         echo '<option value="' . $key . '"' . ($value === $key ? ' selected="true"' : '') . '>' . __($title, "templatera") . '</option>';
     }
     echo '</select>';
     echo '<p class="description indicator-hint">' . __('Select CSS Theme to change content elements visual appearance.', "templatera") . '</p>';
 }
Beispiel #16
0
 /**
  * Register front css styles.
  *
  * Calls wp_register_style for required css libraries files.
  *
  * @since  3.1
  * @access public
  */
 public function frontCss()
 {
     wp_register_style('flexslider', vc_asset_url('lib/bower/flexslider/flexslider.css'), false, WPB_VC_VERSION, 'screen');
     wp_register_style('nivo-slider-css', vc_asset_url('lib/bower/nivoslider/nivo-slider.css'), false, WPB_VC_VERSION, 'screen');
     wp_register_style('nivo-slider-theme', vc_asset_url('lib/bower/nivoslider/themes/default/default.css'), array('nivo-slider-css'), WPB_VC_VERSION, 'screen');
     wp_register_style('prettyphoto', vc_asset_url('lib/prettyphoto/css/prettyPhoto.css'), false, WPB_VC_VERSION, 'screen');
     wp_register_style('isotope-css', vc_asset_url('css/lib/isotope.css'), false, WPB_VC_VERSION, 'all');
     wp_register_style('font-awesome', vc_asset_url('lib/bower/font-awesome/css/font-awesome.min.css'), false, WPB_VC_VERSION, 'screen');
     $front_css_file = vc_asset_url('css/js_composer.min.css');
     $upload_dir = wp_upload_dir();
     if ('1' === vc_settings()->get('use_custom') && is_file($upload_dir['basedir'] . '/' . vc_upload_dir() . '/js_composer_front_custom.css')) {
         $front_css_file = $upload_dir['baseurl'] . '/' . vc_upload_dir() . '/js_composer_front_custom.css';
         // fix @since 4.4, TODO: review it.
         $front_css_file = str_replace(array('http://', 'https://'), '//', $front_css_file);
     }
     wp_register_style('js_composer_front', $front_css_file, false, WPB_VC_VERSION, 'all');
     $custom_css_path = $upload_dir['basedir'] . '/' . vc_upload_dir() . '/custom.css';
     if (is_file($upload_dir['basedir'] . '/' . vc_upload_dir() . '/custom.css')) {
         $custom_css_url = $upload_dir['baseurl'] . '/' . vc_upload_dir() . '/custom.css';
         // TODO: fix file_get_content()
         if (strlen(trim(vc_file_get_contents($custom_css_path))) > 0) {
             $custom_css_url = str_replace(array('http://', 'https://'), '//', $custom_css_url);
             wp_register_style('js_composer_custom_css', $custom_css_url, array(), WPB_VC_VERSION, 'screen');
         }
     }
     add_action('wp_enqueue_scripts', array(&$this, 'enqueueStyle'));
     /**
      * @since 4.4
      */
     do_action('vc_base_register_front_css');
 }
Beispiel #17
0
function my_custom_function()
{
    $vcGroupAccess = vc_settings()->get('groups_access_rules');
    $vcGroupAccess["administrator"]["show"] = "only";
    vc_settings()->set('groups_access_rules', $vcGroupAccess);
}
?>
<script type="text/javascript">
	var vc_user_mapper = <?php 
echo json_encode(WPBMap::getUserShortCodes());
?>
,
		vc_mapper = <?php 
echo json_encode(WPBMap::getShortCodes());
?>
,
		vc_settings_presets = <?php 
echo json_encode(Vc_Settings_Preset::listDefaultSettingsPresets());
?>
,
		vc_roles = <?php 
echo json_encode(array_merge(array('current_user' => $current_user->roles), (array) vc_settings()->get('groups_access_rules')));
?>
,
		vc_frontend_enabled = <?php 
echo vc_enabled_frontend() ? 'true' : 'false';
?>
,
		vc_mode = '<?php 
echo vc_mode();
?>
';
</script>

<script type="text/html" id="vc_settings-image-block">
	<li class="added">
		<div class="inner" style="width: 80px; height: 80px; overflow: hidden;text-align: center;">
Beispiel #19
0
<?php

$tabs = array();
foreach (vc_settings()->getTabs() as $tab => $title) {
    $tabs[] = array($tab . '-tab', $title);
}
vc_include_template('pages/partials/vc-roles-parts/_part.tpl.php', array('part' => $part, 'role' => $role, 'params_prefix' => 'vc_roles[' . $role . '][' . $part . ']', 'controller' => vc_role_access()->who($role)->part($part), 'custom_value' => 'custom', 'capabilities' => $tabs, 'options' => array(array(true, __('All', 'js_composer')), array('custom', __('Custom', 'js_composer')), array(false, __('Disabled', 'js_composer'))), 'main_label' => __('Settings options', 'js_composer'), 'custom_label' => __('Settings options', 'js_composer'), 'description' => __('Control access rights to Visual Composer admin settings tabs (e.g. General Settings, Shortcode Mapper, ...)', 'js_composer')));
Beispiel #20
0
<div class="vc_column-offset" data-column-offset="true">
	<?php 
if (vc_settings()->get('not_responsive_css') === '1') {
    ?>
  	<div class="wpb_alert wpb_content_element vc_alert_rounded wpb_alert-warning">
		<div class="messagebox_text">
			<p><?php 
    printf(__('Responsive design settings are currently disabled. You can enable them in Visual Composer <a href="%s">settings page</a> by unchecking "Disable responsive content elements".', LANGUAGE_ZONE), admin_url('options-general.php?page=vc_settings'));
    ?>
</p>
		</div>
  	</div>
  	<?php 
}
?>
	<input name="<?php 
esc_attr_e($settings['param_name']);
?>
" class="wpb_vc_param_value <?php 
esc_attr_e($settings['param_name']);
?>
	<?php 
esc_attr_e($settings['type']);
?>
 '_field" type="hidden" value="<?php 
esc_attr_e($value);
?>
" />
	<table class="vc_table vc_column-offset-table">
		<tr>
			<th>
 /**
  * @param $string
  *
  * @return string
  */
 function filterAdminBodyClass($string)
 {
     $string .= (strlen($string) > 0 ? ' ' : '') . 'vc_editor vc_inline-shortcode-edit-form';
     if (vc_settings()->get('not_responsive_css') === '1') {
         $string .= ' vc_responsive_disabled';
     }
     return $string;
 }
Beispiel #22
0
 /**
  * Get subsets for google fonts.
  *
  * @since  4.3
  * @access public
  * @return array
  */
 public function googleFontsSubsets()
 {
     if (!isset($this->google_fonts_subsets_settings)) {
         $pt_array = vc_settings()->get('google_fonts_subsets');
         $this->google_fonts_subsets_settings = $pt_array ? $pt_array : $this->googleFontsSubsetsDefault();
     }
     return $this->google_fonts_subsets_settings;
 }
Beispiel #23
0
 /**
  * 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();
     vc_settings()->set('content_types', $this->editor_post_types);
 }
 /**
  * Does user has access to modify/clone/delete/add shortcode
  *
  * @param $shortcode
  *
  * @since 4.5
  * @return bool
  */
 public function userHasAccess($shortcode)
 {
     if ($this->isCheckForAccess()) {
         if (isset($this->hasAccess[$shortcode])) {
             return $this->hasAccess[$shortcode];
         } else {
             global $current_user;
             get_currentuserinfo();
             $show = true;
             $settings = vc_settings()->get('groups_access_rules');
             foreach ($current_user->roles as $role) {
                 if (isset($settings[$role]['shortcodes']) && !isset($settings[$role]['shortcodes'][$shortcode])) {
                     $show = false;
                     break;
                 }
             }
             $this->hasAccess[$shortcode] = $show;
         }
         return $this->hasAccess[$shortcode];
     }
     return true;
 }
 /**
  * @deprecated 4.8
  * @return string
  */
 public function showRulesValue()
 {
     global $current_user;
     get_currentuserinfo();
     /** @var $settings - get use group access rules */
     $settings = vc_settings()->get('groups_access_rules');
     $role = is_object($current_user) && isset($current_user->roles[0]) ? $current_user->roles[0] : '';
     return isset($settings[$role]['show']) ? $settings[$role]['show'] : '';
 }
 /**
  * @param $string
  *
  * @return string
  */
 function filterAdminBodyClass($string)
 {
     // @todo check vc_inline-shortcode-edit-form class looks like incorrect place
     $string .= (strlen($string) > 0 ? ' ' : '') . 'vc_editor vc_inline-shortcode-edit-form';
     if ('1' === vc_settings()->get('not_responsive_css')) {
         $string .= ' vc_responsive_disabled';
     }
     return $string;
 }
 /**
  * Register front css styles.
  *
  * Calls wp_register_style for required css libraries files.
  *
  * @since  3.1
  * @access public
  */
 public function frontCss()
 {
     wp_register_style('isotope-css', vc_asset_url('css/lib/isotope.css'), false, WPB_VC_VERSION, 'all');
     $front_css_file = vc_asset_url('css/js_composer.css');
     $upload_dir = wp_upload_dir();
     if (vc_settings()->get('use_custom') == '1' && is_file($upload_dir['basedir'] . '/' . vc_upload_dir() . '/js_composer_front_custom.css')) {
         $front_css_file = $upload_dir['baseurl'] . '/' . vc_upload_dir() . '/js_composer_front_custom.css';
         // fix @since 4.4, todo review it.
         $front_css_file = str_replace(array('http://', 'https://'), '//', $front_css_file);
     }
     wp_register_style('js_composer_front', $front_css_file, false, WPB_VC_VERSION, 'all');
     $custom_css_path = $upload_dir['basedir'] . '/' . vc_upload_dir() . '/custom.css';
     if (is_file($upload_dir['basedir'] . '/' . vc_upload_dir() . '/custom.css')) {
         $custom_css_url = $upload_dir['baseurl'] . '/' . vc_upload_dir() . '/custom.css';
         // @todo fix file_get_content()
         if (strlen(trim(vc_file_get_contents($custom_css_path))) > 0) {
             $custom_css_url = str_replace(array('http://', 'https://'), '//', $custom_css_url);
             wp_register_style('js_composer_custom_css', $custom_css_url, array(), WPB_VC_VERSION, 'screen');
         }
     }
     add_action('wp_enqueue_scripts', array(&$this, 'enqueueStyle'));
     /**
      * @since 4.4
      */
     do_action('vc_base_register_front_css');
     // add_action( 'wp_head', array( &$this, 'addShortcodesCustomCss' ), 1000 );
 }
Beispiel #28
0
 /**
  * Register front css styles.
  *
  * Calls wp_register_style for required css libraries files.
  *
  * @since  3.1
  * @access public
  */
 public function frontCss()
 {
     //wp_register_style( 'bootstrap', vc_asset_url( 'bootstrap/css/bootstrap.css' ), false, WPB_VC_VERSION, 'screen' );
     wp_register_style('flexslider', vc_asset_url('lib/flexslider/flexslider.css'), false, WPB_VC_VERSION, 'screen');
     wp_register_style('nivo-slider-css', vc_asset_url('lib/nivoslider/nivo-slider.css'), false, WPB_VC_VERSION, 'screen');
     wp_register_style('nivo-slider-theme', vc_asset_url('lib/nivoslider/themes/default/default.css'), array('nivo-slider-css'), WPB_VC_VERSION, 'screen');
     wp_register_style('prettyphoto', vc_asset_url('lib/prettyphoto/css/prettyPhoto.css'), false, WPB_VC_VERSION, 'screen');
     wp_register_style('isotope-css', vc_asset_url('css/isotope.css'), false, WPB_VC_VERSION, 'all');
     $front_css_file = vc_asset_url('css/js_composer_front.css');
     $upload_dir = wp_upload_dir();
     if (vc_settings()->get('use_custom') == '1' && is_file($upload_dir['basedir'] . '/' . vc_upload_dir() . '/js_composer_front_custom.css')) {
         $front_css_file = $upload_dir['baseurl'] . '/' . vc_upload_dir() . '/js_composer_front_custom.css';
     }
     wp_register_style('js_composer_front', $front_css_file, false, WPB_VC_VERSION, 'all');
     if (is_file($upload_dir['basedir'] . '/' . vc_upload_dir() . '/custom.css')) {
         wp_register_style('js_composer_custom_css', $upload_dir['baseurl'] . '/' . vc_upload_dir() . '/custom.css', array('js_composer_front'), WPB_VC_VERSION, 'screen');
     }
 }
Beispiel #29
0
 /**
  * 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);
     }
 }
Beispiel #30
0
 /**
  * Get post types where VC editors are enabled.
  *
  * @since  4.2
  * @access public
  * @return array
  */
 public function editorPostTypes()
 {
     if (!isset($this->editor_post_types)) {
         $pt_array = vc_settings()->get('content_types');
         $this->editor_post_types = $pt_array ? $pt_array : $this->editorDefaultPostTypes();
     }
     return $this->editor_post_types;
 }