/** * Get shortcode structure with default attributes * eg: [ig_text title="The text"]Lorem ipsum[/ig_text] * Enter description here ... */ function get_default_shortcode_structure() { if (!isset($_POST[IGNONCE]) || !wp_verify_nonce($_POST[IGNONCE], IGNONCE)) { return; } if (!$_POST['shortcode']) { return; } $shortcode = $_POST['shortcode']; $class = IG_Pb_Helper_Shortcode::get_shortcode_class($shortcode); if (class_exists($class)) { $element = new $class(); $element->init_element(); echo $element->config['shortcode_structure']; } exit; }
?> "> <div class="ig-pb-form-container jsn-bootstrap3"> <div id="modalOptions" class="form-horizontal <?php echo esc_attr($submodal); ?> "> <?php if (!empty($params)) { $params = stripslashes($params); $params = urldecode($params); } // elements if ($el_type == 'element') { // get shortcode class $class = IG_Pb_Helper_Shortcode::get_shortcode_class($shortcode); if (class_exists($class)) { global $Ig_Pb; $elements = $Ig_Pb->get_elements(); $instance = isset($elements['element'][strtolower($class)]) ? $elements['element'][strtolower($class)] : null; if (!is_object($instance)) { $instance = new $class(); } $instance->init_element(); // Generate default params if they were not posted. if (empty($params)) { $params = $instance->config['shortcode_structure']; } if (!empty($params)) { $params = str_replace('#_EDITTED', '', $params); $extract_params = IG_Pb_Helper_Shortcode::extract_params($params, $shortcode);
/** * Return html structure of shortcode in Page Builder area * * @param type $shortcode_name * @param type $attr * @param type $content */ public static function shortcode_to_pagebuilder($shortcode_name, $content = '', $shortcode_data = '', $shortcode_params = '') { $class = IG_Pb_Helper_Shortcode::get_shortcode_class($shortcode_name); if (class_exists($class)) { global $Ig_Pb; $elements = $Ig_Pb->get_elements(); $instance = isset($elements['element'][strtolower($class)]) ? $elements['element'][strtolower($class)] : null; if (!is_object($instance)) { $instance = new $class(); } $instance->init_element(); $el_title = ''; if ($class != 'IG_Widget') { // extract param of shortcode ( now for column ) if (isset($instance->config['extract_param'])) { parse_str(trim($shortcode_params), $output); foreach ($instance->config['extract_param'] as $param) { if (isset($output[$param])) { $instance->params[$param] = IG_Pb_Utils_Common::remove_quotes($output[$param]); } } } // get content in pagebuilder of shortcode: Element Title must always first option of Content tab if (isset($instance->items['content']) && isset($instance->items['content'][0])) { $title = $instance->items['content'][0]; if ($title['role'] == 'title') { $params = shortcode_parse_atts($shortcode_params); $el_title = !empty($params[$title['id']]) ? $params[$title['id']] : __('(Untitled)', IGPBL); } } } else { $widget_info = IG_Pb_Helper_Shortcode::extract_widget_params($shortcode_data); $el_title = !empty($widget_info['title']) ? $widget_info['title'] : ''; $params = IG_Pb_Helper_Shortcode::extract_params($shortcode_data); $instance->config['shortcode'] = $params['widget_id']; $instance->config['el_type'] = 'widget'; } $shortcode_view = $instance->element_in_pgbldr($content, $shortcode_data, $el_title); return $shortcode_view[0]; } }