function getPrintedItem() { if (!empty($_REQUEST['data'])) { $item_array = json_decode(rawUrlDecode($_REQUEST['data']), true); die(pbGetContentBuilderItem($item_array)); } die('<div class="error">Empty Reqeist</div>'); }
function pbGetContentBuilder() { global $post, $jw_startPrinted, $jw_pbItems; $endPrint = false; ob_start(); $_pb_row_array = json_decode(rawUrlDecode(get_post_meta($post->ID, '_pb_content', true)), true); if (empty($_pb_row_array)) { return false; } else { $layoutsEcho = ''; $prllx = false; foreach ($_pb_row_array as $_pb_row) { $rowContrast = isset($_pb_row['row_width']) ? ' ' . $_pb_row['row_width'] : ''; $rowwidth = $_pb_row['row_width'] == 'inside' ? ' ' . $_pb_row['row_width'] : '100%'; $containerTitle = isset($_pb_row['row_container_title']) ? ' ' . $_pb_row['row_container_title'] : ''; $containerDesc = isset($_pb_row['row_container_desc']) ? ' ' . $_pb_row['row_container_desc'] : ''; if (!empty($_pb_row['row_container_title'])) { $ContainerTitleDivider = '<div class="bottomdivider clearfix"></div>'; $containerTitle = '<div class="container_title"><h1>' . $containerTitle . '</h1>' . $ContainerTitleDivider . '<p>' . $containerDesc . '</p></div>'; } else { $containerTitle = ''; } $rowParallax = isset($_pb_row['background_prllx']) ? $_pb_row['background_prllx'] == 'true' ? ' bg-parallax' : '' : ''; $rowCustomClass = !empty($_pb_row['row_custom_class']) ? $_pb_row['row_custom_class'] : ''; $bgAttachment = !empty($rowParallax) ? 'fixed' : (isset($_pb_row['background_attachment']) ? $_pb_row['background_attachment'] : 'scroll'); if (!$prllx) { $prllx = !empty($rowParallax) ? true : false; } $class = $rowContrast . $rowParallax . ' ' . $rowCustomClass; $_pb_row['background_color'] = isset($_pb_row['background_color']) ? str_replace(' ', '', $_pb_row['background_color']) : ''; $style = 'background-attachment:' . $bgAttachment . ';'; $style .= empty($_pb_row['background_color']) ? '' : 'background-color:' . $_pb_row['background_color'] . ';'; $style .= empty($_pb_row['background_image']) ? '' : 'background-image:url(' . $_pb_row['background_image'] . ');'; $style .= empty($_pb_row['background_repeat']) ? '' : 'background-repeat:' . $_pb_row['background_repeat'] . ';'; $style .= empty($_pb_row['background_position']) ? '' : 'background-position:' . $_pb_row['background_position'] . ';'; $layoutsEcho .= '<div class="row-container' . $class . '" ' . (!empty($rowCustomClass) ? ' id="' . $rowCustomClass . '"' : '') . ' style="' . $style . '"><div class="container" style="width:' . $rowwidth . '">' . $containerTitle . '<div class="row">'; foreach ($_pb_row['layouts'] as $_pb_layout) { if ($_pb_layout['size'] !== 'size-0-0') { global $jw_layoutSize; $jw_layoutSize = $_pb_layout['size']; $layoutsEcho .= '[jw_layout size="' . pbTextToFoundation($_pb_layout['size']) . '" layout_custom_class="' . (isset($_pb_layout['layout_custom_class']) ? $_pb_layout['layout_custom_class'] : '') . '"]'; $jw_startPrinted = false; $colCounter = 0; $start = 'true'; foreach ($_pb_layout['items'] as $item_array) { list($colCounter, $start) = rowStart($colCounter, pbTextToFoundation($_pb_layout['size']) === 'span3' ? 12 : pbTextToInt($item_array['size'])); $endPrint = true; $rowClass = $item_array['row-type'] = !empty($jw_pbItems[$item_array['slug']]['row-type']) ? $jw_pbItems[$item_array['slug']]['row-type'] : 'row-fluid'; if ($start === "true") { if ($jw_startPrinted) { $layoutsEcho .= '</div>'; } $jw_startPrinted = true; $layoutsEcho .= '<div class="' . $rowClass . '">'; } $layoutsEcho .= pbGetContentBuilderItem($item_array); } if ($jw_startPrinted) { $layoutsEcho .= '</div>'; } $layoutsEcho .= '[/jw_layout]'; } } $layoutsEcho .= '</div></div></div>'; } if ($prllx) { add_action('wp_footer', 'jw_parallax_script'); } if ($endPrint) { echo $layoutsEcho; } else { return false; } } $output = ob_get_clean(); return $output; }