function kt_add_option_to_vc() { $color_arr = array('vc_btn', 'vc_icon', 'vc_tta_accordion', 'vc_tta_tabs', 'vc_tta_tour'); foreach ($color_arr as $item) { $button_colors = WPBMap::getParam($item, 'color'); $button_colors['value'][esc_html__('Accent color', 'adroit')] = 'accent'; vc_update_shortcode_param($item, $button_colors); } $background_arr = array('vc_icon'); foreach ($background_arr as $item) { $button_colors = WPBMap::getParam($item, 'background_color'); $button_colors['value'][esc_html__('Accent color', 'adroit')] = 'accent'; vc_update_shortcode_param($item, $button_colors); } $image_styles = WPBMap::getParam('vc_single_image', 'style'); $image_styles['value'][esc_html__('Border box', 'adroit')] = 'border-box'; $image_styles['value'][esc_html__('Border box Left', 'adroit')] = 'border-left'; $image_styles['value'][esc_html__('Border box Right', 'adroit')] = 'border-right'; $image_styles['value'][esc_html__('Creative Left', 'adroit')] = 'creative-left'; $image_styles['value'][esc_html__('Creative Right', 'adroit')] = 'creative-right'; $image_styles['value'][esc_html__('Creative When hover', 'adroit')] = 'creative-hover'; vc_update_shortcode_param('vc_single_image', $image_styles); $icon_btn = array('i_type', 'i_icon_fontawesome', 'i_icon_openiconic', 'i_icon_typicons', 'i_icon_entypo', 'i_icon_linecons', 'i_icon_pixelicons', 'css_animation', 'el_class'); foreach ($icon_btn as $item) { vc_remove_param('vc_btn', $item); } }
public function __construct() { // make sure all vc shortcodes are loaded (needed for ajax pagination) if (method_exists('WPBMap', 'addAllMappedShortcodes')) { WPBMap::addAllMappedShortcodes(); } add_action('the_content', array($this, 'render_custom_css')); // this adds the [Fields and Views] to editor of visual composers text element if (array_key_exists('action', $_POST) && $_POST['action'] == 'vc_edit_form') { add_filter('wpv_filter_dialog_for_editors_requires_post', '__return_false'); } }
public static function generateUserData($force = false) { if (!$force && self::$user_sc !== false && self::$user_categories !== false) { return true; } $settings = self::getSettings(); self::$user_sc = self::$user_categories = array(); foreach (self::$sc as $name => $values) { if (!isset($settings[self::$user_role]['shortcodes']) || isset($settings[self::$user_role]['shortcodes'][$name]) && (int) $settings[self::$user_role]['shortcodes'][$name] == 1) { if ($name != 'vc_column' && (!isset($values['content_element']) || $values['content_element'] === true)) { $categories = isset($values['category']) ? $values['category'] : '_other_category_'; $values['_category_ids'] = array(); if (is_array($categories)) { foreach ($categories as $c) { if (array_search($c, self::$user_categories) === false) { self::$user_categories[] = $c; } $values['_category_ids'][] = md5($c); // array_search($category, self::$categories); } } else { if (array_search($categories, self::$user_categories) === false) { self::$user_categories[] = $categories; } $values['_category_ids'][] = md5($categories); // array_search($category, self::$categories); } } self::$user_sc[$name] = $values; } } }
function qode_remove_vc_image_zoom() { //Remove zoom from click action on single image $param = WPBMap::getParam('vc_single_image', 'onclick'); unset($param['value']['Zoom']); vc_update_shortcode_param('vc_single_image', $param); }
/** * Add Shortcode Params * * @return none */ function zoShortcodeAddParams() { $extra_params_folder = get_template_directory() . '/vc_params'; $files = zoFileScanDirectory($extra_params_folder, '/^zo_.*\\.php/'); if (!empty($files)) { foreach ($files as $file) { if (WPBMap::exists($file->name)) { include $file->uri; if (isset($params) && is_array($params)) { foreach ($params as $param) { if (is_array($param)) { $param['group'] = __('Template', ZO_NAME); $param['edit_field_class'] = isset($param['edit_field_class']) ? $param['edit_field_class'] . ' zo_custom_param vc_col-sm-12 vc_column' : 'zo_custom_param vc_col-sm-12 vc_column'; $param['class'] = 'zo-extra-param'; if (isset($param['template']) && !empty($param['template'])) { if (!is_array($param['template'])) { $param['template'] = array($param['template']); } $param['dependency'] = array("element" => "zo_template", "value" => $param['template']); } vc_add_param($file->name, $param); } } } } } } }
function laborator_vc_row_full_width() { # Full Width Param $param = WPBMap::getParam('vc_row', 'full_width'); $param['value'][__('Full width', 'lab_composer')] = 'lab-full-width'; vc_update_shortcode_param('vc_row', $param); }
function cruxstore_add_option_to_vc() { $image_styles = WPBMap::getParam('vc_single_image', 'style'); $image_styles['value'][esc_html__('Border box inner 1', 'cruxstore')] = 'border-box-1'; $image_styles['value'][esc_html__('Border box inner 2', 'cruxstore')] = 'border-box-2'; $image_styles['value'][esc_html__('Zoom In', 'cruxstore')] = 'zoomin'; $image_styles['value'][esc_html__('Zoom Out', 'cruxstore')] = 'zoomout'; $image_styles['value'][esc_html__('Slide', 'cruxstore')] = 'slide'; $image_styles['value'][esc_html__('Shine', 'cruxstore')] = 'shine'; vc_update_shortcode_param('vc_single_image', $image_styles); $accordion_styles = WPBMap::getParam('vc_tta_accordion', 'style'); $accordion_styles['value'][esc_html__('Outline Wrapper', 'cruxstore')] = 'wrapper'; $accordion_styles['value'][esc_html__('Outline Wrapper Shadow', 'cruxstore')] = 'wrapper shadow'; vc_update_shortcode_param('vc_tta_accordion', $accordion_styles); $accordion_iconss = WPBMap::getParam('vc_tta_accordion', 'c_icon'); $accordion_iconss['value'][esc_html__('Arrow Circle', 'cruxstore')] = 'arrow-circle'; vc_update_shortcode_param('vc_tta_accordion', $accordion_iconss); $tab_styles = WPBMap::getParam('vc_tta_tabs', 'style'); $tab_styles['value'][esc_html__('Outline Wrapper', 'cruxstore')] = 'wrapper'; $tab_styles['value'][esc_html__('Outline Wrapper Shadow', 'cruxstore')] = 'wrapper shadow'; vc_update_shortcode_param('vc_tta_tabs', $tab_styles); $cta_styles = WPBMap::getParam('vc_cta', 'style'); $cta_styles['value'][esc_html__('Transparent', 'cruxstore')] = 'transparent'; vc_update_shortcode_param('vc_cta', $cta_styles); $button_colors = WPBMap::getParam('vc_btn', 'color'); $button_colors['value'][esc_html__('Accent color', 'cruxstore')] = 'accent'; vc_update_shortcode_param('vc_btn', $button_colors); }
/** * Call all stored activities. * * Called by init method. List of activities stored by $init_activity are created by other objects called after * initialization. * * @since 4.2 * @access public */ protected function callActivities() { while ( $activity = each( $this->init_activity ) ) { list( $object, $method, $params ) = $activity[1]; if ( $object == 'mapper' ) { switch ( $method ) { case 'map': WPBMap::map( $params['name'], $params['attributes'] ); break; case 'drop_param': WPBMap::dropParam( $params['name'], $params['attribute_name'] ); break; case 'add_param': WPBMap::addParam( $params['name'], $params['attribute'] ); break; case 'mutate_param': WPBMap::mutateParam( $params['name'], $params['attribute'] ); break; case 'drop_shortcode': WPBMap::dropShortcode( $params['name'] ); break; case 'modify': WPBMap::modify( $params['name'], $params['setting_name'], $params['value'] ); break; } } } }
function check_vc($content) { if (class_exists('Vc_Base')) { global $post; $course_status = vibe_get_option('start_course'); $force_include_pages = apply_filters('wplms_vc_force_include_pages', array($course_status)); $force_include_post_types = apply_filters('wplms_vc_force_include_custom_post_types', array('course', 'unit', 'quiz', 'question')); if (in_array($post->ID, $force_include_pages) || in_array($post->post_type, $force_include_post_types)) { if (strpos($content, 'vc_row')) { /* wp_register_style( 'js_composer_front', vc_asset_url( 'css/js_composer.min.css' ), array(), WPB_VC_VERSION ); wp_register_script( 'wpb_composer_front_js', vc_asset_url( 'js/dist/js_composer_front.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true ); wp_enqueue_style( 'js_composer_front'); wp_enqueue_script( 'wpb_composer_front_js'); */ echo "<link rel='stylesheet' id='swiftype-css' href='" . vc_asset_url('css/js_composer.min.css') . "' type='text/css' media='all'/>"; echo "<script type='text/javascript' src='" . vc_asset_url('js/dist/js_composer_front.min.js') . "'></script>"; global $vc_manager; foreach (WPBMap::getShortCodes() as $sc_base => $el) { $vc_manager->shortcodes[$sc_base] = new WPBakeryShortCodeFishBones($el); } } } } return $content; }
/** * Used to update default parms * * @since 3.0.0 * @access public */ public function update_params() { $param = WPBMap::getParam('vc_single_image', 'img_size'); if ($param) { $param['value'] = 'full'; vc_update_shortcode_param('vc_single_image', $param); } }
/** * WPBakery Visual Composer helpers functions * * @package WPBakeryVisualComposer * */ function wpb_map($attributes) { if (!isset($attributes['base'])) { trigger_error(__("Wrong wpb_map object. Base attribute is required", 'js_composer'), E_USER_ERROR); die; } WPBMap::map($attributes['base'], $attributes); }
function add_cta_button_super_color() { //Get current values stored in the color param in "Call to Action" element $param = WPBMap::getParam('vc_cta', 'color'); //Append new value to the 'value' array $param['value'][__('WF', 'webidia')] = 'btn-wf-color'; $param['std'] = 'btn-wf-color'; //Finally "mutate" param with new values vc_update_shortcode_param('vc_cta', $param); }
public function build() { $element = vc_post_param('element'); $shortCode = stripslashes(vc_post_param('shortcode')); visual_composer()->removeShortCode($element); $settings = WPBMap::getShortCode($element); new WPBakeryShortCode_Settings($settings); echo do_shortcode($shortCode); die; }
function lab_vc_tta_tabs_setup() { $new_param = array('Theme Styled (if selected, other style settings will be ignored)' => 'theme-styled'); $new_param_minimal = array('Theme Styled Minimal (if selected, other style settings will be ignored)' => 'theme-styled-minimal'); $tabs_param = WPBMap::getParam('vc_tta_tabs', 'style'); $accordion_param = WPBMap::getParam('vc_tta_accordion', 'style'); $tabs_param['value'] = array_merge($new_param, $new_param_minimal, $tabs_param['value']); $accordion_param['value'] = array_merge($new_param, $accordion_param['value']); vc_update_shortcode_param('vc_tta_tabs', $tabs_param); vc_update_shortcode_param('vc_tta_accordion', $accordion_param); }
function kt_add_option_to_vc() { $image_styles = WPBMap::getParam('vc_single_image', 'style'); $image_styles['value'][esc_html__('Border box', 'mondova')] = 'border-box'; $image_styles['value'][esc_html__('Border box inner 1', 'mondova')] = 'border-box-1'; $image_styles['value'][esc_html__('Border box inner 2', 'mondova')] = 'border-box-2'; $image_styles['value'][esc_html__('Zoom In', 'mondova')] = 'zoomin'; $image_styles['value'][esc_html__('Zoom Out', 'mondova')] = 'zoomout'; $image_styles['value'][esc_html__('Slide', 'mondova')] = 'slide'; $image_styles['value'][esc_html__('Shine', 'mondova')] = 'shine'; vc_update_shortcode_param('vc_single_image', $image_styles); }
/** * Sort WPB Elements */ function om_wpb_sort_elements() { $elements = array('vc_row', 'vc_column_text', 'vc_separator', 'vc_text_separator', 'om_icon_separator', 'vc_message', 'vc_facebook', 'vc_tweetmeme', 'vc_googleplus', 'vc_pinterest', 'vc_toggle', 'vc_single_image', 'vc_gallery', 'vc_images_carousel', 'vc_tabs', 'vc_tour', 'vc_accordion', 'vc_btn', 'vc_cta', 'vc_icon', 'vc_video', 'vc_gmaps', 'vc_raw_html', 'vc_raw_js', 'vc_flickr', 'vc_progress_bar', 'vc_pie', 'vc_empty_space', 'vc_custom_heading', 'om_box', 'om_counter', 'om_a_button', 'om_pricing_table', 'om_pricing_table_column', 'om_html_table', 'om_posts', 'om_testimonials', 'om_portfolio', 'om_logos', 'om_chart', 'om_person', 'om_click_box', 'om_moving_box', 'om_click_icon_box', 'om_click_icon_box2', 'om_teaser'); $elements = array_reverse($elements); $w = 10; foreach ($elements as $v) { if (WPBMap::exists($v)) { vc_map_update($v, array('weight' => $w)); $w += 10; } } }
/** * Used to update default parms * * @since 3.0.0 */ public function update_params() { // Only needed on front-end if (!is_admin()) { return; } // Set ID weight $param = WPBMap::getParam('vc_row', 'el_id'); if ($param) { $param['weight'] = 99; vc_update_shortcode_param('vc_row', $param); } // Set class weight $param = WPBMap::getParam('vc_row', 'el_class'); if ($param) { $param['weight'] = 98; $time_start = microtime(true); vc_update_shortcode_param('vc_row', $param); } // Move video parallax setting $param = WPBMap::getParam('vc_row', 'video_bg_parallax'); if ($param) { $param['group'] = __('Video', 'wpex'); $param['dependency'] = array('element' => 'video_bg', 'value' => 'youtube'); vc_update_shortcode_param('vc_row', $param); } // Move youtube url $param = WPBMap::getParam('vc_row', 'video_bg_url'); if ($param) { $param['group'] = __('Video', 'wpex'); $param['dependency'] = array('element' => 'video_bg', 'value' => 'youtube'); vc_update_shortcode_param('vc_row', $param); } // Alter Parallax dropdown $param = WPBMap::getParam('vc_row', 'parallax'); if ($param) { $param['group'] = __('Parallax', 'wpex'); $param['value'][__('Advanced Parallax', 'wpex')] = 'vcex_parallax'; vc_update_shortcode_param('vc_row', $param); } // Alter Parallax image location $param = WPBMap::getParam('vc_row', 'parallax_image'); if ($param) { $param['group'] = __('Parallax', 'wpex'); vc_update_shortcode_param('vc_row', $param); } // Move design options $param = WPBMap::getParam('vc_row', 'css'); if ($param) { $param['weight'] = -1; vc_update_shortcode_param('vc_row', $param); } }
/** * Used to update default parms * * @since 3.0.0 * @access public */ public function update_params() { $param = WPBMap::getParam('vc_single_image', 'img_size'); if ($param) { $param['value'] = 'full'; vc_update_shortcode_param('vc_single_image', $param); } $param = WPBMap::getParam('vc_single_image', 'img_link_target'); if ($param) { $param['value'][esc_html__('Local', 'total')] = 'local'; vc_update_shortcode_param('vc_single_image', $param); } }
/** * Add shared Mm parameters/atts to all VC components. * * @since 1.0.0 */ function mm_vc_custom_component_atts() { // Get all available VC components. $components = WPBMap::getShortCodes(); // Create custom group title. $custom_group = __('Mm Custom Settings', 'mm-components'); // Text color. $atts[] = array('type' => 'dropdown', 'heading' => __('Text Color Scheme', 'mm-components'), 'param_name' => 'mm_class_text_color', 'group' => $custom_group, 'value' => array(__('Default', 'mm-components ') => '', __('Dark', 'mm-components ') => 'dark', __('Light', 'mm-components ') => 'light', __('Medium', 'mm-components ') => 'medium')); // Text alignment. $atts[] = array('type' => 'dropdown', 'heading' => __('Text Alignment', 'mm-components'), 'param_name' => 'mm_class_text_align', 'group' => $custom_group, 'value' => array(__('Default', 'mm-components ') => '', __('Left', 'mm-components ') => 'left', __('Center', 'mm-components ') => 'center', __('Right', 'mm-components ') => 'right')); // Custom Class. $atts[] = array('type' => 'textfield', 'heading' => __('Custom Class', 'mm-components'), 'param_name' => 'mm_custom_class', 'group' => $custom_group); // Add each param to each VC component. foreach ($atts as $att) { foreach ($components as $component) { vc_add_param($component['base'], $att); } } }
/** * Get list of categories allowed for user. * * Categories list depends on user policies for shortcodes. If none of allowed shortcodes are in the category, this * category not displayed. * * @return string */ public function contentCategories() { $output = '<ul class="isotope-filter vc_filter-content-elements"><li class="active"><a href="#" data-filter="*">' . __('Show all', "js_composer") . '</a></li>'; $_other_category_index = 0; $show_other = false; foreach (WPBMap::getUserCategories() as $key => $name) { if ($name === '_other_category_') { $_other_category_index = $key; $show_other = true; } else { $output .= '<li><a href="#" data-filter=".category-' . md5($name) . '">' . __($name, "js_composer") . '</a></li>'; } } if ($show_other) { $output .= '<li><a href="#" data-filter=".category-' . $_other_category_index . '">' . __('Other', "js_composer") . '</a></li>'; } $output .= '</ul>'; return apply_filters('vc_add_element_box_categories', $output); }
function lab_vc_custom_icon_fonts() { # Add Extra Icon Fonts $param = WPBMap::getParam('vc_icon', 'type'); if (!is_array($param)) { return false; } $param['weight'] = 2; $param['value'] = array('Linea' => 'linea') + $param['value']; vc_update_shortcode_param('vc_icon', $param); # Add Param Type $attributes = array('type' => 'iconpicker', 'heading' => __('Icon', 'lab_composer'), 'param_name' => 'icon_linea', 'value' => 'icon-basic-accelerator', 'weight' => 1, 'settings' => array('emptyIcon' => false, 'type' => 'linea', 'iconsPerPage' => -1), 'dependency' => array('element' => 'type', 'value' => 'linea'), 'description' => __('Select icon from library.', 'lab_composer')); vc_add_param('vc_icon', $attributes); # Set Default Color to Black $param = WPBMap::getParam('vc_icon', 'color'); $param['std'] = 'black'; vc_update_shortcode_param('vc_icon', $param); # Custom Icon add_action('admin_print_styles', 'lab_vc_custom_icon_css'); }
public function getAttributes($atts) { $text = $google_fonts = $font_container = $el_class = $css = ''; /** * Get default values from VC_MAP. **/ $google_fonts_field = WPBMap::getParam('vc_custom_heading', 'google_fonts'); $font_container_field = WPBMap::getParam('vc_custom_heading', 'font_container'); $el_class_field = WPBMap::getParam('vc_custom_heading', 'el_class'); $css_field = WPBMap::getParam('vc_custom_heading', 'css'); $text_field = WPBMap::getParam('vc_custom_heading', 'text'); extract(shortcode_atts(array('text' => isset($text_field['value']) ? $text_field['value'] : '', 'google_fonts' => isset($google_fonts_field['value']) ? $google_fonts_field['value'] : '', 'font_container' => isset($font_container_field['value']) ? $font_container_field['value'] : '', 'el_class' => isset($el_class_field['value']) ? $el_class_field['value'] : '', 'css' => isset($css_field['value']) ? $css_field['value'] : ''), $atts)); $el_class = $this->getExtraClass($el_class); $font_container_obj = new Vc_Font_Container(); $google_fonts_obj = new Vc_Google_Fonts(); $font_container_field_settings = isset($font_container_field['settings'], $font_container_field['settings']['fields']) ? $font_container_field['settings']['fields'] : array(); $google_fonts_field_settings = isset($google_fonts_field['settings'], $google_fonts_field['settings']['fields']) ? $google_fonts_field['settings']['fields'] : array(); $font_container_data = $font_container_obj->_vc_font_container_parse_attributes($font_container_field_settings, $font_container); $google_fonts_data = $google_fonts_obj->_vc_google_fonts_parse_attributes($google_fonts_field_settings, $google_fonts); return array('text' => $text, 'google_fonts' => $google_fonts, 'font_container' => $font_container, 'el_class' => $el_class, 'css' => $css, 'font_container_data' => $font_container_data, 'google_fonts_data' => $google_fonts_data); }
<?php extract(shortcode_atts(array('height' => WPBMap::getParam('vc_empty_space', 'height'), 'el_class' => '', 'background_image' => '', 'image_repeat' => ''), $atts)); $class = "vc_empty_space "; $pattern = '/^(\\d*(?:\\.\\d+)?)\\s*(px|\\%|in|cm|mm|em|rem|ex|pt|pc|vw|vh|vmin|vmax)?$/'; // allowed metrics: http://www.w3schools.com/cssref/css_units.asp $regexr = preg_match($pattern, $height, $matches); $value = isset($matches[1]) ? (double) $matches[1] : (double) WPBMap::getParam('vc_empty_space', 'height'); $unit = isset($matches[2]) ? $matches[2] : 'px'; $height = $value . $unit; $inline_css = (double) $height >= 0.0 ? ' style="height: ' . $height . '"' : ''; $class .= $this->getExtraClass($el_class); $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class, $this->settings['base'], $atts); $image = ""; if ($background_image != "") { if (is_numeric($background_image)) { $image_src = wp_get_attachment_url($background_image); } $image .= 'style="background-image:url(' . $image_src . ');'; if ($image_repeat != "") { $image .= 'background-repeat:' . $image_repeat . ';"'; } } ?> <div class="<?php echo esc_attr(trim($css_class)); ?> " <?php echo $inline_css; ?> ><span
/** * Shorthand function for WPBMap::dropParam * @param $name * @param $attribute_name */ function vc_remove_param($name = '', $attribute_name = '') { return WPBMap::dropParam($name, $attribute_name); }
<ul class="tabs_controls"> </ul> %content% </div>', 'default_content' => ' [vc_tab title="' . __('Tab 1', 'js_composer') . '" tab_id="' . $tab_id_1 . '"][/vc_tab] [vc_tab title="' . __('Tab 2', 'js_composer') . '" tab_id="' . $tab_id_2 . '"][/vc_tab] ', "js_view" => $vc_is_wp_version_3_6_more ? 'VcTabsView' : 'VcTabsView35')); /* Tour section ---------------------------------------------------------- */ $tab_id_1 = time() . '-1-' . rand(0, 100); $tab_id_2 = time() . '-2-' . rand(0, 100); WPBMap::map('vc_tour', array("name" => __("Tour Section", "js_composer"), "base" => "vc_tour", "show_settings_on_create" => false, "is_container" => true, "container_not_allowed" => true, "icon" => "icon-wpb-ui-tab-content-vertical", "category" => __('Content', 'js_composer'), "wrapper_class" => "clearfix", "params" => array(array("type" => "textfield", "heading" => __("Widget title", "js_composer"), "param_name" => "title", "description" => __("What text use as a widget title. Leave blank if no title is needed.", "js_composer")), array("type" => "dropdown", "heading" => __("Auto rotate slides", "js_composer"), "param_name" => "interval", "value" => array(__("Disable", "js_composer") => 0, 3, 5, 10, 15), "description" => __("Auto rotate slides each X seconds.", "js_composer")), array("type" => "textfield", "heading" => __("Extra class name", "js_composer"), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "js_composer"))), "custom_markup" => ' <div class="wpb_tabs_holder wpb_holder clearfix vc_container_for_children"> <ul class="tabs_controls"> </ul> %content% </div>', 'default_content' => ' [vc_tab title="' . __('Slide 1', 'js_composer') . '" tab_id="' . $tab_id_1 . '"][/vc_tab] [vc_tab title="' . __('Slide 2', 'js_composer') . '" tab_id="' . $tab_id_2 . '"][/vc_tab] ', "js_view" => $vc_is_wp_version_3_6_more ? 'VcTabsView' : 'VcTabsView35')); vc_map(array("name" => __("Tab", "js_composer"), "base" => "vc_tab", "allowed_container_element" => 'vc_row', "is_container" => true, "content_element" => false, "params" => array(array("type" => "textfield", "heading" => __("Title", "js_composer"), "param_name" => "title", "description" => __("Tab title.", "js_composer")), array("type" => "tab_id", "heading" => __("Tab ID", "js_composer"), "param_name" => "tab_id")), 'js_view' => $vc_is_wp_version_3_6_more ? 'VcTabView' : 'VcTabView35')); /* Accordion block ---------------------------------------------------------- */ vc_map(array("name" => __("Accordion", "js_composer"), "base" => "vc_accordion", "show_settings_on_create" => false, "is_container" => true, "icon" => "icon-wpb-ui-accordion", "category" => __('Content', 'js_composer'), "params" => array(array("type" => "textfield", "heading" => __("Widget title", "js_composer"), "param_name" => "title", "description" => __("What text use as a widget title. Leave blank if no title is needed.", "js_composer")), array("type" => "textfield", "heading" => __("Active tab", "js_composer"), "param_name" => "active_tab", "description" => __("Enter tab number to be active on load or enter false to collapse all tabs.", "js_composer")), array("type" => 'checkbox', "heading" => __("Allow collapsible all", "js_composer"), "param_name" => "collapsible", "description" => __("Select checkbox to allow for all sections to be be collapsible.", "js_composer"), "value" => array(__("Allow", "js_composer") => 'yes')), array("type" => "textfield", "heading" => __("Extra class name", "js_composer"), "param_name" => "el_class", "description" => __("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", "js_composer"))), "custom_markup" => ' <div class="wpb_accordion_holder wpb_holder clearfix vc_container_for_children"> %content% </div> <div class="tab_controls"> <button class="add_tab" title="' . __("Add accordion section", "js_composer") . '">' . __("Add accordion section", "js_composer") . '</button> </div> ', 'default_content' => '
/** * Access groups * @deprecated 4.8 */ public function groups_access_rules_callback() { // _deprecated_function( '\Vc_Settings::groups_access_rules_callback', '4.8 (will be removed in 4.11)' ); global $wp_roles; $groups = is_object($wp_roles) ? $wp_roles->roles : array(); $settings = ($settings = get_option(self::$field_prefix . 'groups_access_rules')) ? $settings : array(); $show_types = array('all' => __('Show Visual Composer & default editor', 'js_composer'), 'only' => __('Show only Visual Composer', 'js_composer'), 'no' => __("Don't allow to use Visual Composer", 'js_composer')); $shortcodes = WPBMap::getShortCodes(); $size_line = ceil(count(array_keys($shortcodes)) / 3); ?> <div class="wpb_settings_accordion" id="wpb_js_settings_access_groups" xmlns="http://www.w3.org/1999/html"> <?php if (is_array($groups)) { foreach ($groups as $key => $params) { if (isset($params['capabilities']['edit_posts']) && true === $params['capabilities']['edit_posts'] || isset($params['capabilities']['edit_pages']) && true === $params['capabilities']['edit_pages']) { $allowed_setting = isset($settings[$key]['show']) ? $settings[$key]['show'] : 'all'; $shortcode_settings = isset($settings[$key]['shortcodes']) ? $settings[$key]['shortcodes'] : array(); ?> <h3 id="wpb-settings-group-<?php echo $key; ?> -header"> <a href="#wpb-settings-group-<?php echo $key; ?> "> <?php echo $params['name']; ?> </a> </h3> <div id="wpb-settings-group-<?php echo $key; ?> " class="accordion-body"> <div class="visibility settings-block"> <label for="wpb_composer_access_<?php echo $key; ?> "><b><?php _e('Visual Composer access', 'js_composer'); ?> </b></label> <select id="wpb_composer_access_<?php echo $key; ?> " name="<?php echo self::$field_prefix . 'groups_access_rules[' . $key . '][show]'; ?> "> <?php foreach ($show_types as $i_key => $name) { ?> <option value="<?php echo $i_key; ?> "<?php echo $allowed_setting == $i_key ? ' selected="true"' : ''; ?> ><?php echo $name; ?> </option> <?php } ?> </select> </div> <div class="shortcodes settings-block"> <div class="title"><b><?php _e('Enabled shortcodes', 'js_composer'); ?> </b></div> <?php $z = 1; foreach ($shortcodes as $sc_base => $el) { ?> <?php if (!in_array($el['base'], array('vc_column', 'vc_row', 'vc_row_inner', 'vc_column_inner'))) { ?> <?php if (1 === $z) { ?> <div class="pull-left"><?php } ?> <label> <input type="checkbox" <?php if (isset($shortcode_settings[$sc_base]) && 1 === (int) $shortcode_settings[$sc_base]) { ?> checked="true" <?php } ?> name="<?php echo self::$field_prefix . 'groups_access_rules[' . $key . '][shortcodes][' . $sc_base . ']'; ?> " value="1"/> <?php echo $el['name']; if (isset($el['deprecated']) && false !== $el['deprecated']) { echo ' <i>' . sprintf(__('(deprecated since v%s)', 'js_composer'), $el['deprecated']) . '</i>'; } ?> </label> <?php if ($z == $size_line) { ?> </div><?php $z = 0; } $z += 1; ?> <?php } ?> <?php } ?> <?php if (1 !== $z) { ?> </div><?php } ?> <div class="vc_clearfix"></div> <div class="select-all"> <a href="#" class="wpb-settings-select-all-shortcodes"><?php echo __('Select All', 'js_composer'); ?> </a> | <a href="#" class="wpb-settings-select-none-shortcodes"><?php echo __('Select none', 'js_composer'); ?> </a> </div> </div> </div> <?php } } } ?> </div> <p class="description"><?php _e('Define access rules for different user groups.', 'js_composer'); ?> </p> <?php }
function OMWPBScParams($tag) { $this->sc = $tag; $settings = WPBMap::getShortCode($tag); if (!empty($settings) && isset($settings['params'])) { $this->params = $settings['params']; } }
/** * @since 4.4 * * @output/@return string - grid data for ajax request. */ public function getGridDataForAjax() { // if ( vc_request_param( 'action' ) === 'vc_get_vc_grid_data' ) { if (vc_request_param('tag') === 'vc_masonry_grid') { $settings = WPBMap::getShortCode('vc_masonry_grid'); require_once vc_path_dir('SHORTCODES_DIR', 'vc-masonry-grid.php'); $vc_grid = new WPBakeryShortcode_VC_Masonry_Grid($settings); } else { if (vc_request_param('tag') === 'vc_media_grid') { $settings = WPBMap::getShortCode('vc_media_grid'); require_once vc_path_dir('SHORTCODES_DIR', 'vc-media-grid.php'); $vc_grid = new WPBakeryShortcode_VC_Media_Grid($settings); } else { if (vc_request_param('tag') === 'vc_masonry_media_grid') { $settings = WPBMap::getShortCode('vc_masonry_media_grid'); require_once vc_path_dir('SHORTCODES_DIR', 'vc-masonry-media-grid.php'); $vc_grid = new WPBakeryShortcode_VC_Masonry_Media_Grid($settings); } else { $settings = WPBMap::getShortCode('vc_basic_grid'); require_once vc_path_dir('SHORTCODES_DIR', 'vc-basic-grid.php'); $vc_grid = new WPBakeryShortcode_VC_Basic_Grid($settings); } } } die($vc_grid->renderAjax(vc_request_param('data'))); // } }
/** * Button */ private function elementButton() { // color $param = WPBMap::getParam('vc_button', 'color'); $param['value'] = array('Default' => 'btn-default', 'Primary' => 'btn-success', 'Success' => 'btn-success', 'Info' => 'btn-warning', 'Danger' => 'btn-danger', 'Link' => 'btn-link'); $param['heading'] = 'Type'; WPBMap::mutateParam('vc_button', $param); // icon $param = WPBMap::getParam('vc_button', 'icon'); $param['type'] = 'textfield'; $param['value'] = ''; WPBMap::mutateParam('vc_button', $param); // size $param = WPBMap::getParam('vc_button', 'size'); $param['value'] = array('Default' => '', 'Large' => 'btn-lg', 'Small' => 'btn-sm', 'Extra small' => 'btn-xs'); WPBMap::mutateParam('vc_button', $param); }
/** * Get param value by providing key * * @param $key * * @since 4.4 * @return array|bool */ protected function getParamData($key) { return WPBMap::getParam($this->shortcode, $this->getField($key)); }