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 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'))); // } }
function toString( $shortcode, $content ) { $shortcode_settings = WPBMap::getShortCode( $shortcode['tag'] ); $is_container = ( isset( $shortcode_settings['is_container'] ) && $shortcode_settings['is_container'] === true ) || ( isset( $shortcode_settings['as_parent'] ) && $shortcode_settings['as_parent'] !== false ); return do_shortcode( '<div class="vc-element" data-tag="' . $shortcode['tag'] . '" data-model-id="' . $shortcode['id'] . '"' . self::cleanStyle() . '>' . $this->wrapperStart() . '[' . $shortcode['tag'] . ' ' . $shortcode['attrs_query'] . ']' . ( $is_container ? '[vc_container_anchor]' : '' ) . $this->parseShortcodesString( $content, $is_container, $shortcode['id'] ) . '[/' . $shortcode['tag'] . ']' . $this->wrapperEnd() . '</div>' ); }
public function showEditFormJavascript_callback() { $element = $this->post('element'); $shortCode = stripslashes($this->post('shortcode')); $this->removeShortCode($element); $settings = WPBMap::getShortCode($element); new WPBakeryShortCode_Settings($settings); echo do_shortcode($shortCode); die; }
/** * Construct Form fields. * * @since 4.4 * * @param $tag - shortcode tag * @param $atts - list of attribute assign to the shortcode. */ public function __construct($tag, $atts) { $this->tag = $tag; $this->atts = apply_filters('vc_edit_form_fields_attributes_' . $this->tag, $atts); $this->setSettings(WPBMap::getShortCode($this->tag)); }
/** * Parse shortcodes custom css string. * * This function is used by self::buildShortcodesCustomCss and creates css string from shortcodes attributes * like 'css_editor'. * * @see WPBakeryVisualComposerCssEditor * @since 4.2 * @access public * * @param $content * * @return string */ public function parseShortcodesCustomCss($content) { $css = ''; if (!preg_match('/\\s*(\\.[^\\{]+)\\s*\\{\\s*([^\\}]+)\\s*\\}\\s*/', $content)) { return $css; } preg_match_all('/' . get_shortcode_regex() . '/', $content, $shortcodes); foreach ($shortcodes[2] as $index => $tag) { $shortcode = WPBMap::getShortCode($tag); $attr_array = shortcode_parse_atts(trim($shortcodes[3][$index])); if (isset($shortcode['params']) && !empty($shortcode['params'])) { foreach ($shortcode['params'] as $param) { if ($param['type'] == 'css_editor' && isset($attr_array[$param['param_name']])) { $css .= $attr_array[$param['param_name']]; } } } } foreach ($shortcodes[5] as $shortcode_content) { $css .= $this->parseShortcodesCustomCss($shortcode_content); } return $css; }
$list['vc_button2'] = $shortcode_vc_button2; $list['vc_button2']['post_type'] = Vc_Grid_Item_Editor::postType(); } $shortcode_vc_btn = WPBMap::getShortCode('vc_btn'); if (is_array($shortcode_vc_btn) && isset($shortcode_vc_btn['base'])) { $list['vc_btn'] = $shortcode_vc_btn; $list['vc_btn']['post_type'] = Vc_Grid_Item_Editor::postType(); unset($list['vc_btn']['params'][1]); } $shortcode_vc_custom_heading = WPBMap::getShortCode('vc_custom_heading'); if (is_array($shortcode_vc_custom_heading) && isset($shortcode_vc_custom_heading['base'])) { $list['vc_custom_heading'] = $shortcode_vc_custom_heading; $list['vc_custom_heading']['post_type'] = Vc_Grid_Item_Editor::postType(); unset($list['vc_custom_heading']['params'][1]); } $shortcode_vc_empty_space = WPBMap::getShortCode('vc_empty_space'); if (is_array($shortcode_vc_empty_space) && isset($shortcode_vc_empty_space['base'])) { $list['vc_empty_space'] = $shortcode_vc_empty_space; $list['vc_empty_space']['post_type'] = Vc_Grid_Item_Editor::postType(); } foreach (array('vc_icon', 'vc_button2', 'vc_btn', 'vc_custom_heading', 'vc_single_image') as $key) { if (isset($list[$key])) { if (!isset($list[$key]['params'])) { $list[$key]['params'] = array(); } if ('vc_button2' === $key) { // change settings for vc_link in dropdown. Add dependency. $list[$key]['params'][0] = array('type' => 'vc_link', 'heading' => __('URL (Link)', 'js_composer'), 'param_name' => 'url', 'dependency' => array('element' => 'link', 'value' => array('custom')), 'description' => __('Add custom link.', 'js_composer')); } else { array_unshift($list[$key]['params'], array('type' => 'vc_link', 'heading' => __('URL (Link)', 'js_composer'), 'param_name' => 'url', 'dependency' => array('element' => 'link', 'value' => array('custom')), 'description' => __('Add custom link.', 'js_composer'))); }
/** * @param $name * * @return null */ public function settings($name) { $settings = WPBMap::getShortCode($this->tag); return isset($settings[$name]) ? $settings[$name] : null; }
/** * Get settings of the mapped shortcode. * * @param $tag * * @since 4.4.3 * @return array|null - settings or null if shortcode not mapped */ function vc_get_shortcode($tag) { return WPBMap::getShortCode($tag); }