/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $inner_content = IG_Pb_Helper_Shortcode::remove_autop($content); $custom_style = IG_Pb_Utils_Placeholder::get_placeholder('custom_style'); return "{$heading}<!--heading-->{$icon}<!--icon--><div id='pane{index}' class='tab-pane {active} {fade_effect}' {$custom_style}>\n\t\t\t\t\t{$inner_content}\n\t\t\t\t</div><!--seperate-->"; }
/** * * @param type $content : inner shortcode elements of this row * @param type $shortcode_data : not used * @return string */ public function element_in_pgbldr($content = '', $shortcode_data = '') { if (empty($content)) { $column = new IG_Column(); $column_html = $column->element_in_pgbldr(); $column_html = $column_html[0]; } else { $column_html = IG_Pb_Helper_Shortcode::do_shortcode_admin($content); } if (empty($shortcode_data)) { $shortcode_data = $this->config['shortcode_structure']; } // remove [/ig_row][ig_column...] from $shortcode_data $shortcode_data = explode('][', $shortcode_data); $shortcode_data = $shortcode_data[0] . ']'; // Remove empty value attributes of shortcode tag. $shortcode_data = preg_replace('/\\[*([a-z_]*[\\n\\s\\t]*=[\\n\\s\\t]*"")/', '', $shortcode_data); $custom_style = IG_Pb_Utils_Placeholder::get_placeholder('custom_style'); $row[] = '<div class="jsn-row-container ui-sortable row-fluid shortcode-container" ' . $custom_style . '> <textarea class="hidden" data-sc-info="shortcode_content" name="shortcode_content[]" >' . $shortcode_data . '</textarea> <div class="jsn-iconbar left"> <a href="javascript:void(0);" title="' . __('Move Up', IGPBL) . '" class="jsn-move-up disabled"><i class="icon-chevron-up"></i></a> <a href="javascript:void(0);" title="' . __('Move Down', IGPBL) . '" class="jsn-move-down disabled"><i class=" icon-chevron-down"></i></a> </div> <div class="ig-row-content"> ' . $column_html . ' </div> <div class="jsn-iconbar jsn-vertical"> <a href="javascript:void(0);" class="add-container" title="' . __('Add column', IGPBL) . '"><i class="icon-plus"></i></a> <a href="javascript:void(0);" title="Edit row" data-shortcode="' . $this->config['shortcode'] . '" class="element-edit row" data-use-ajax="' . ($this->config['edit_using_ajax'] ? 1 : 0) . '"><i class="icon-pencil"></i></a> <a href="javascript:void(0);" class="item-delete row" title="' . __('Delete row', IGPBL) . '"><i class="icon-trash"></i></a> </div> <textarea class="hidden" name="shortcode_content[]" >[/' . $this->config['shortcode'] . ']</textarea> </div>'; return $row; }
/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Heading', 'plumtree'), 'id' => 'heading', 'type' => 'text_field', 'class' => 'jsn-input-xxlarge-fluid', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Testimonials Item %s', 'index'), 'plumtree'), 'tooltip' => __('Set the text of your heading items', 'plumtree')), array('name' => __('Image File', 'plumtree'), 'id' => 'image_file', 'type' => 'select_media', 'std' => '', 'class' => 'jsn-input-large-fluid', 'tooltip' => __('Select background image for item', 'plumtree')), array('name' => __('Body', 'plumtree'), 'id' => 'body', 'role' => 'content', 'type' => 'editor', 'std' => IG_Pb_Helper_Type::lorem_text(), 'tooltip' => __('Set content of element', 'plumtree')), array('name' => __('Signature', 'plumtree'), 'id' => 'sign', 'type' => 'text_field', 'class' => 'jsn-input-xxlarge-fluid', 'role' => 'title', 'std' => '', 'tooltip' => __('Set the text items', 'plumtree')))); }
/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Title', IGPBL), 'id' => 'title', 'type' => 'text_field', 'class' => 'input-sm', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Button %s', 'index'), IGPBL), 'tooltip' => __('Set text for tooltip on hover', IGPBL)), array('name' => __('URL for button', IGPBL), 'id' => 'url', 'type' => 'text_field', 'role' => 'url', 'class' => 'input-sm', 'std' => __('http://', IGPBL), 'tooltip' => __('Enter an url', IGPBL)), array('name' => __('Icon for button', IGPBL), 'id' => 'icon', 'type' => 'text_field', 'role' => 'icon', 'class' => 'input-sm', 'std' => __('Example: facebook, twitter, gplus', IGPBL), 'tooltip' => __('Enter name of icon according to FontAwesome icons', IGPBL)))); }
/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Heading', IGPBL), 'id' => 'heading', 'type' => 'text_field', 'class' => 'input-sm', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Accordion Item %s', 'index'), IGPBL), 'tooltip' => __('Set heading text of item', IGPBL)), array('name' => __('Body', IGPBL), 'id' => 'body', 'role' => 'content', 'type' => 'editor', 'std' => IG_Pb_Helper_Type::lorem_text(), 'tooltip' => __('Set content of element', IGPBL)), array('name' => __('Icon', IGPBL), 'id' => 'icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', IGPBL)), array('name' => __('Tag', IGPBL), 'id' => 'tag', 'type' => 'tag', 'std' => '', 'tooltip' => __('Organize your content and group items by tags', IGPBL)))); }
/** * DEFINE setting options of shortcode */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Heading', 'plumtree'), 'id' => 'heading', 'type' => 'text_field', 'class' => 'jsn-input-xxlarge-fluid', 'role' => 'title', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Carousel Item %s', 'index'), 'plumtree'), 'tooltip' => __('Set the text of your heading items', 'plumtree')), array('name' => __('Body', 'plumtree'), 'id' => 'body', 'role' => 'content', 'type' => 'editor', 'std' => IG_Pb_Helper_Type::lorem_text(), 'tooltip' => __('Set content of element', 'plumtree')), array('name' => __('Icon', 'plumtree'), 'id' => 'icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', 'plumtree')))); }
/** * DEFINE html structure of shortcode in Page Builder area * * @param string $content * @param string $shortcode_data: string stores params (which is modified default value) of shortcode * @param string $el_title: Element Title used to identifying elements in IG PageBuilder * @param int $index * @param bool $inlude_sc_structure * @param array $extra_params * Ex: param-tag=h6¶m-text=Your+heading¶m-font=custom¶m-font-family=arial * @return string */ public function element_in_pgbldr($content = '', $shortcode_data = '', $el_title = '', $index = '', $inlude_sc_structure = true, $extra_params = array()) { // Init neccessary data to render element in backend. $this->init_element(); $shortcode = $this->config['shortcode']; $is_sub_element = isset($this->config['sub_element']) ? true : false; $parent_shortcode = $is_sub_element ? str_replace('ig_item_', '', $shortcode) : $shortcode; $type = !empty($this->config['el_type']) ? $this->config['el_type'] : 'widget'; // Empty content if this is not sub element if (!$is_sub_element) { $content = ''; } $exception = isset($this->config['exception']) ? $this->config['exception'] : array(); $content = isset($exception['default_content']) ? $exception['default_content'] : $content; $modal_title = ''; // if is widget if ($type == 'widget') { global $Ig_Pb_Widgets; if (isset($Ig_Pb_Widgets[$shortcode]) && is_array($Ig_Pb_Widgets[$shortcode]) && isset($Ig_Pb_Widgets[$shortcode]['identity_name'])) { $modal_title = $Ig_Pb_Widgets[$shortcode]['identity_name']; $content = $this->config['exception']['data-modal-title'] = $modal_title; } } // if content is still empty, Generate it if (empty($content)) { if (!$is_sub_element) { $content = ucfirst(str_replace('ig_', '', $shortcode)); } else { if (isset($exception['item_text'])) { if (!empty($exception['item_text'])) { $content = IG_Pb_Utils_Placeholder::add_placeholder($exception['item_text'] . ' %s', 'index'); } } else { $content = IG_Pb_Utils_Placeholder::add_placeholder(__(ucfirst($parent_shortcode), IGPBL) . ' ' . __('Item', IGPBL) . ' %s', 'index'); } } } $content = !empty($el_title) ? $content . ': ' . "<span>{$el_title}</span>" : $content; // element name if ($type == 'element') { if (!$is_sub_element) { $name = ucfirst(str_replace('ig_', '', $shortcode)); } else { $name = __(ucfirst($parent_shortcode), IGPBL) . ' ' . __('Item', IGPBL); } } else { $name = $content; } if (empty($shortcode_data)) { $shortcode_data = $this->config['shortcode_structure']; } // Process index for subitem element if (!empty($index)) { $shortcode_data = str_replace('_IG_INDEX_', $index, $shortcode_data); } $shortcode_data = stripslashes($shortcode_data); $element_wrapper = !empty($exception['item_wrapper']) ? $exception['item_wrapper'] : ($is_sub_element ? 'li' : 'div'); $content_class = $is_sub_element ? 'jsn-item-content' : 'ig-pb-element'; $modal_title = empty($modal_title) ? !empty($exception['data-modal-title']) ? "data-modal-title='{$exception['data-modal-title']}'" : '' : $modal_title; $element_type = "data-el-type='{$type}'"; $edit_using_ajax = !empty($exception['edit_using_ajax']) ? sprintf("data-using-ajax='%s'", esc_attr($exception['edit_using_ajax'])) : ''; $data = array('element_wrapper' => $element_wrapper, 'modal_title' => $modal_title, 'element_type' => $element_type, 'edit_using_ajax' => $edit_using_ajax, 'name' => $name, 'shortcode' => $shortcode, 'shortcode_data' => $shortcode_data, 'content_class' => $content_class, 'content' => $content, 'action_btn' => empty($exception['action_btn']) ? '' : $exception['action_btn']); // Merge extra params if it exists. if (!empty($extra_params)) { $data = array_merge($data, $extra_params); } $extra = array(); if (isset($this->config['exception']['disable_preview_container'])) { $extra = array('has_preview' => FALSE); } $data = array_merge($data, $extra); $html_preview = IG_Pb_Helper_Functions::get_element_item_html($data, $inlude_sc_structure); return array($html_preview); }
/** * Handle empty icon & heading for Carousel, ,Tab, Accordion, List item * * @param type $heading * @param type $icon */ static function heading_icon(&$heading, &$icon, $heading_empty = false) { if (strpos($heading, IG_Pb_Utils_Placeholder::get_placeholder('index')) !== false) { $heading = ''; } if (empty($icon) && empty($heading)) { $heading = !$heading_empty ? __('(Untitled)', IGPBL) : ''; } }
/** * Define shortcode settings. * * @return void */ public function element_items() { $this->items = array('Notab' => array(array('name' => __('Text', IGPBL), 'id' => 'button_text', 'type' => 'text_field', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('ButtonBar Item %s', 'index'), IGPBL), 'role' => 'title', 'tooltip' => __('Set the text on the button', IGPBL)), array('name' => __('On Click', IGPBL), 'id' => 'link_type', 'type' => 'select', 'class' => 'input-sm', 'std' => 'url', 'options' => IG_Pb_Helper_Type::get_link_types(), 'has_depend' => '1', 'tooltip' => __('Select link types: link to post, page, category...', IGPBL)), array('name' => __('URL', IGPBL), 'id' => 'button_type_url', 'type' => 'text_field', 'class' => 'input-sm', 'std' => 'http://', 'dependency' => array('link_type', '=', 'url'), 'tooltip' => __('Set url of button', IGPBL)), array('name' => __('Single Item', IGPBL), 'id' => 'single_item', 'type' => 'type_group', 'std' => '', 'items' => IG_Pb_Helper_Type::get_single_item_button_bar('link_type', array('type' => 'items_list', 'options_type' => 'select', 'class' => 'select2-select', 'ul_wrap' => false)), 'tooltip' => __('Choose item to link to', IGPBL)), array('name' => __('Open in', IGPBL), 'id' => 'open_in', 'type' => 'select', 'class' => 'input-sm', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_open_in_options()), 'options' => IG_Pb_Helper_Type::get_open_in_options(), 'dependency' => array('link_type', '!=', 'no_link'), 'tooltip' => __('Select type of opening action when click on element', IGPBL)), array('name' => __('Icon', IGPBL), 'id' => 'icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', IGPBL)), array('name' => __('Size', IGPBL), 'id' => 'button_size', 'type' => 'select', 'class' => 'input-sm', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_button_size()), 'options' => IG_Pb_Helper_Type::get_button_size(), 'tooltip' => __('Set the size of the button', IGPBL)), array('name' => __('Color', IGPBL), 'id' => 'button_color', 'type' => 'select', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_button_color()), 'options' => IG_Pb_Helper_Type::get_button_color(), 'container_class' => 'color_select2', 'tooltip' => __('Select the color of the button', IGPBL)))); }
public function element_items() { $this->items = array('Notab' => array(array('name' => __('Text', IGPBL), 'id' => 'pbar_text', 'type' => 'text_field', 'class' => 'input-sm', 'std' => __(IG_Pb_Utils_Placeholder::add_placeholder('Progress Bar Item %s', 'index'), IGPBL), 'role' => 'title', 'tooltip' => __('Text', IGPBL)), array('name' => __('Percentage', IGPBL), 'id' => 'pbar_percentage', 'type' => 'text_append', 'input_type' => 'number', 'class' => 'input-mini', 'std' => '25', 'append' => '%', 'validate' => 'number', 'parent_class' => 'combo-item', 'tooltip' => __('Percentage', IGPBL)), array('name' => __('Color', IGPBL), 'id' => 'pbar_color', 'type' => 'select', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_progress_bar_color()), 'options' => IG_Pb_Helper_Type::get_progress_bar_color(), 'tooltip' => __('Color', IGPBL), 'container_class' => 'color_select2'), array('name' => __('Style', IGPBL), 'id' => 'pbar_item_style', 'type' => 'select', 'class' => 'input-sm', 'std' => IG_Pb_Helper_Type::get_first_option(IG_Pb_Helper_Type::get_progress_bar_item_style()), 'options' => IG_Pb_Helper_Type::get_progress_bar_item_style(), 'tooltip' => __('Style', IGPBL)), array('name' => __('Icon', IGPBL), 'id' => 'pbar_icon', 'type' => 'icons', 'std' => '', 'role' => 'title_prepend', 'title_prepend_type' => 'icon', 'tooltip' => __('Select an icon', IGPBL)), array('id' => 'pbar_group', 'class' => 'pbar_group_type', 'type' => 'hidden', 'std' => 'multiple-bars'))); }
/** * Show IG PageBuilder content for Frontend post * * @param string $content * @return string */ function pagebuilder_to_frontend($content) { global $post; // Get what tab (Classic - Pagebuilder) is active when Save content of this post $ig_page_active_tab = get_post_meta($post->ID, '_ig_page_active_tab', true); $ig_deactivate_pb = get_post_meta($post->ID, '_ig_deactivate_pb', true); // if Pagebuilder is active when save and pagebuilder is not deactivate on this post if ($ig_page_active_tab && empty($ig_deactivate_pb)) { $ig_pagebuilder_content = get_post_meta($post->ID, '_ig_page_builder_content', true); if (!empty($ig_pagebuilder_content)) { // remove placeholder text which was inserted to < and > $ig_pagebuilder_content = IG_Pb_Utils_Placeholder::remove_placeholder($ig_pagebuilder_content, 'wrapper_append', ''); $ig_pagebuilder_content = preg_replace_callback('/\\[ig_widget\\s+([A-Za-z0-9_-]+=\\"[^"\']*\\"\\s*)*\\s*\\](.*)\\[\\/ig_widget\\]/Us', array('IG_Pb_Helper_Shortcode', 'widget_content'), $ig_pagebuilder_content); $content = $ig_pagebuilder_content; } } return $content; }
/** * Do shortcode & Return final html output for frontend * * @param type $content */ public static function doshortcode_content($ig_pagebuilder_content) { // remove placeholder text which was inserted to < and > $ig_pagebuilder_content = IG_Pb_Utils_Placeholder::remove_placeholder($ig_pagebuilder_content, 'wrapper_append', ''); $ig_pagebuilder_content = preg_replace_callback('/\\[ig_widget\\s+([A-Za-z0-9_-]+=\\"[^"\']*\\"\\s*)*\\s*\\](.*)\\[\\/ig_widget\\]/Us', array('self', 'widget_content'), $ig_pagebuilder_content); $output = do_shortcode($ig_pagebuilder_content); return $output; }
/** * Generate HTML code from shortcode content. * * @param array $atts Shortcode attributes. * @param string $content Current content. * * @return string */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); $initial_open = intval($arr_params['initial_open']); $tab_position = $arr_params['tab_position']; $random_id = IG_Pb_Utils_Common::random_string(); $tab_navigator = array(); $tab_navigator[] = '<ul class="nav nav-tabs">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = $initial_open > count($items) ? 1 : $initial_open; $fade_effect = ''; if ($arr_params['fade_effect'] == 'yes') { $fade_effect = 'fade in'; } foreach ($items as $idx => $item) { // Extract icon & heading $ex_heading = explode('<!--heading-->', $item); $ex_icon = explode('<!--icon-->', isset($ex_heading[1]) ? $ex_heading[1] : ''); $new_key = $random_id . $idx; $active = $idx + 1 == $initial_open ? 'active' : ''; $item = isset($ex_icon[1]) ? $ex_icon[1] : ''; $item = str_replace('{index}', $new_key, $item); $item = str_replace('{active}', $active, $item); $item = str_replace('{fade_effect}', $fade_effect, $item); $items[$idx] = $item; $icon = !empty($ex_icon[0]) ? "<i class='{$ex_icon[0]}'></i> " : ''; $heading = !empty($ex_heading[0]) ? $ex_heading[0] : __('Tab Item ') . ' ' . $idx; IG_Pb_Helper_Functions::heading_icon($heading, $icon); $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $tab_navigator[] = "<li {$active_li}><a href='#pane{$new_key}' data-toggle='tab'>{$icon}{$heading}</a></li>"; } $sub_shortcode = implode('', $items); $tab_content = "<div class='tab-content'>{$sub_shortcode}</div>"; // update min-height of each tab content in case tap position is left/right if (in_array($tab_position, array('left', 'right'))) { $min_height = 36 * count($items); $tab_content = IG_Pb_Utils_Placeholder::remove_placeholder($tab_content, 'custom_style', "style='min-height: {$min_height}px'"); } $tab_navigator[] = '</ul>'; $tab_positions = array('top' => '', 'left' => 'tabs-left', 'right' => 'tabs-right', 'bottom' => 'tabs-below'); $extra_class = $tab_positions[$tab_position]; if ($tab_position == 'bottom') { $tab_content .= implode('', $tab_navigator); } else { $tab_content = implode('', $tab_navigator) . $tab_content; } $html_element = "<div class='tabbable {$extra_class}' id='tab_{ID}'>{$tab_content}</div>"; $html_element = str_replace('{ID}', "{$random_id}", $html_element); return $this->element_wrapper($html_element, $arr_params); }