/** * * @param type $content : inner shortcode elements of this column * @param string $shortcode_data * @return string */ public function element_in_pgbldr($content = '', $shortcode_data = '') { $column_html = empty($content) ? '' : IG_Pb_Helper_Shortcode::do_shortcode_admin($content, true); $span = !empty($this->params['span']) ? $this->params['span'] : 'span12'; $shortcode_data = '[' . $this->config['shortcode'] . ' span="' . $span . '"]'; // Remove empty value attributes of shortcode tag. $shortcode_data = preg_replace('/\\[*([a-z_]*[\\n\\s\\t]*=[\\n\\s\\t]*"")/', '', $shortcode_data); $rnd_id = IG_Pb_Utils_Common::random_string(); $column[] = '<div class="jsn-column-container clearafter shortcode-container "> <div class="jsn-column ' . $span . '"> <div class="thumbnail clearafter"> <textarea class="hidden" name="shortcode_content[]" >' . $shortcode_data . '</textarea> <div class="jsn-column-content item-container" data-column-class="' . $span . '" > <div class="jsn-handle-drag jsn-horizontal jsn-iconbar-trigger"><div class="jsn-iconbar layout"><a class="item-delete column" onclick="return false;" title="' . __('Delete column', IGPBL) . '" href="#"><i class="icon-trash"></i></a></div></div> <div class="jsn-element-container item-container-content">' . $column_html . '</div> <a class="jsn-add-more ig-more-element" href="javascript:void(0);"><i class="icon-plus"></i>' . __('Add Element', IGPBL) . '</a> </div> <textarea class="hidden" name="shortcode_content[]" >[/' . $this->config['shortcode'] . ']</textarea> </div> </div> </div>'; return $column; }
/** * * @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; }
</div> </div> </div> <!-- END Save as new template modal --> </div> <!-- IG PageBuilder elements --> <div class="jsn-section-content jsn-style-light" id="form-design-content"> <div id="ig-pbd-loading" class="text-center"><i class="jsn-icon32 jsn-icon-loading"></i></div> <div class="ig-pb-form-container jsn-layout"> <?php global $post; $pagebuilder_content = get_post_meta($post->ID, '_ig_page_builder_content', true); if (!empty($pagebuilder_content)) { $builder = new IG_Pb_Helper_Shortcode(); echo balanceTags($builder->do_shortcode_admin($pagebuilder_content)); } ?> <a href="javascript:void(0);" id="jsn-add-container" class="jsn-add-more"><i class="icon-plus"></i><?php _e('Add Row', IGPBL); ?> </a> <input type="hidden" id="ig-select-media" value="" /> </div> <div id="deactivate-msg" class="jsn-section-empty hidden"> <p class="jsn-bglabel"> <span class="jsn-icon64 jsn-icon-remove"></span> <?php _e('PageBuilder for this page is currently off.', IGPBL); ?>
/** * Update PageBuilder when switch Classic Editor to IG PageBuilder * * @return string */ function text_to_pagebuilder() { if (!isset($_POST[IGNONCE]) || !wp_verify_nonce($_POST[IGNONCE], IGNONCE)) { return; } if (!isset($_POST['content'])) { return; } // $content = urldecode( $_POST['content'] ); $content = $_POST['content']; $content = stripslashes($content); $empty_str = IG_Pb_Helper_Shortcode::check_empty_($content); if (strlen(trim($content)) && strlen(trim($empty_str))) { $builder = new IG_Pb_Helper_Shortcode(); // remove wrap p tag $content = preg_replace('/^<p>(.*)<\\/p>$/', '$1', $content); $content = balanceTags($content); echo balanceTags($builder->do_shortcode_admin($content, false, true)); } else { echo ''; } exit; }