"Default sidebar"); $sidebars = get_option('sbg_sidebars'); if (!empty($sidebars)) { foreach ($sidebars as $sidebar) { $arraySidebar[$sidebar] = $sidebar; } } //Slider global $wpdb; $table_name = $wpdb->prefix . "revslider_sliders"; $sliders = $wpdb->get_results( "SELECT * FROM $table_name" ); $arraySlider = array("0" => "Select Slider"); if(!empty($sliders)) { foreach($sliders as $item) { $name = empty($item->title) ? ('Unnamed('.$item->id.')') : $item->title; $arraySlider[$item->id]=$name; } } //Link Target $linkTarget = array("_blank" => "Blank", "_self" => "Self"); //Yes No $arrayYesNo = array("true" => "Yes", "false" => "No"); //Post Type $arrayPostType = array("post" => "Post", "portfolio" => "Portfolio"); //Post Catigories $categories = get_categories("hide_empty=0"); $post_categories = array("0" => "Select Category"); if(!empty($categories)) { foreach ($categories as $category) { $post_categories["$category->term_id"] = $category->name; } } //Portfolio Catigories $portfolios = get_terms('portfolios', 'hide_empty=0'); $port_categories = array("0" => "Select Category"); if(!empty($portfolios)) { foreach ($portfolios as $portfolio) { $port_categories["$portfolio->term_id"] = $portfolio->name; } } //Pricing Table Catigories $prices = get_terms('prices', 'hide_empty=0'); $price_categories = array("0" => "Select Category"); if(!empty($prices)) { foreach ($prices as $price) { $price_categories["$price->term_id"] = $price->name; } } //Team Catigories $teams = get_terms('position', 'hide_empty=0'); $team_categories = array("0" => "Select Category"); if(!empty($teams)) { foreach ($teams as $team) { $team_categories["$team->term_id"] = $team->name; } } //Testimonials Catigories $testimonials = get_terms('testimonials', 'hide_empty=0'); $testim_categories = array("0" => "Select Category"); if(!empty($testimonials)) { foreach ($testimonials as $testimonial) { $testim_categories["$testimonial->term_id"] = $testimonial->name; } } //includes require_once (THEME_PATH . "/framework/pagebuilder/elements.php"); require_once (THEME_PATH . "/framework/pagebuilder/pagebuilder_render.php"); //====== END - Globals ====== //====== START - Functions ====== if (!function_exists('pbInitGlobalScripts')) { function pbInitGlobalScripts() { global $post; $pID=''; if(isset($post->ID)){ $pID=$post->ID; } echo''; } } add_action('admin_footer', 'pbInitGlobalScripts'); if (!function_exists('pbTextToFoundation')) { function pbTextToFoundation($size = '1 / 3') { switch ($size) { case'size-1-4' : case'1 / 4' : { $size = 'span3'; break; } case'size-1-3' : case'1 / 3' : { $size = 'span4'; break; } case'size-1-2' : case'1 / 2' : { $size = 'span6'; break; } case'size-2-3' : case'2 / 3' : { $size = 'span8'; break; } case'size-3-4' : case'3 / 4' : { $size = 'span9'; break; } case'size-1-1' : case'1 / 1' : { $size = 'span12'; break; } } return $size; } } if (!function_exists('pbTextToInt')) { function pbTextToInt($size = '1 / 3') { switch ($size) { case'size-1-4' : case'1 / 4' : { $size = 3; break; } case'size-1-3' : case'1 / 3' : { $size = 4; break; } case'size-1-2' : case'1 / 2' : { $size = 6; break; } case'size-2-3' : case'2 / 3' : { $size = 8; break; } case'size-3-4' : case'3 / 4' : { $size = 9; break; } case'size-1-1' : case'1 / 1' : { $size = 12; break; } } return $size; } } if (!function_exists('pbSizeToText')) { function pbSizeToText($size = 'size-1-3') { switch ($size) { case'size-1-4' : { $size = '1 / 4'; break; } case'size-1-3' : { $size = '1 / 3'; break; } case'size-1-2' : { $size = '1 / 2'; break; } case'size-2-3' : { $size = '2 / 3'; break; } case'size-3-4' : { $size = '3 / 4'; break; } case'size-1-1' : { $size = '1 / 1'; break; } } return $size; } } if (!function_exists('pbTextToSize')) { function pbTextToSize($size = '1 / 3') { switch ($size) { case'1 / 4' : { $size = 'size-1-4'; break; } case'1 / 3' : { $size = 'size-1-3'; break; } case'1 / 2' : { $size = 'size-1-2'; break; } case'2 / 3' : { $size = 'size-2-3'; break; } case'3 / 4' : { $size = 'size-3-4'; break; } case'1 / 1' : { $size = 'size-1-1'; break; } } return $size; } } if (!function_exists('getItemField')) { function getItemField($itemSlug, $itemArray) { $title = isset($itemArray['title']) ? $itemArray['title'] : ''; $type = isset($itemArray['type']) ? $itemArray['type'] : ''; $default = isset($itemArray['default']) ? $itemArray['default'] : ''; $desc = isset($itemArray['desc']) ? $itemArray['desc'] : ''; $holder = isset($itemArray['holder']) ? $itemArray['holder'] : ''; $selector = isset($itemArray['selector']) ? $itemArray['selector'] : ''; $save_to = isset($itemArray['save_to']) ? $itemArray['save_to'] : ''; $tinyMCE = isset($itemArray['tinyMCE']) ? $itemArray['tinyMCE'] : ''; $class = 'field'; ?>
'.$title.'
'; $default = rawUrlDecode($default); } ?>
'; $tmpItem = $itemArray['data']['item']; $tmpSettings = $itemArray['data']['settings']; getItemField($tmpSettings, $tw_pbItems[$tmpItem]['settings'][$tmpSettings]); echo '
'; } break; } case 'color': { ?>
/>
'; } break; } case 'container': { $title_as = isset($itemArray['title_as']) ? $itemArray['title_as'] : ''; $add_button = isset($itemArray['add_button']) ? $itemArray['add_button'] : ''; $container_type = isset($itemArray['container_type']) ? $itemArray['container_type'] : ''; ?>
-+ D X
'; } $faPrint=true; foreach ($data as $slug => $setting) { if(isset($setting['need_fa'])&&$setting['need_fa']==='true'&&$faPrint){ echo getItemField('fa', array("type"=> "fa")); } if($slug==='fa'){$faPrint=false;} echo getItemField($slug, $setting); } ?>
'.$desc.'';} ?>
data-help="" title="">
E D X
$pbHeadSetting) { $pbHeadSetting['default'] = isset($itemNewData[$pbHeadSettingSlug]) ? $itemNewData[$pbHeadSettingSlug] : $pbHeadSetting['default']; echo getItemField($pbHeadSettingSlug, $pbHeadSetting); } ?>
$pbItemSetting) { if ($pbItemSetting['type'] === 'container' && isset($itemNewData['settings'][$pbItemSettingSlug])) { $templateContainerItem = $pbItemSetting['default'][0]; foreach ($itemNewData['settings'][$pbItemSettingSlug] as $index => $containerItemNewData) { foreach ($containerItemNewData as $containerItemNewFieldSlug => $containerItemNewFieldValue) { $templateContainerItem[$containerItemNewFieldSlug]['default'] = $containerItemNewFieldValue; $itemNewData['settings'][$pbItemSettingSlug][$index][$containerItemNewFieldSlug] = $templateContainerItem[$containerItemNewFieldSlug]; } } } $pbItemSetting['default'] = isset($itemNewData['settings'][$pbItemSettingSlug]) ? $itemNewData['settings'][$pbItemSettingSlug] : $pbItemSetting['default']; echo getItemField($pbItemSettingSlug, $pbItemSetting); } ?>
ID, '_pb_content', true); $_pb_layout_array = json_decode(rawUrlDecode($_pb_content), true); $pbLayoutCount=0; if(!empty($_pb_layout_array)){ foreach($_pb_layout_array as $_pb_layout){ $pbLayoutCount++; $_layout_open='
'; $_pb_content_area_layouts .= $_layout_open; $_pb_content_area .= $_layout_open; foreach ($_pb_layout['items'] as $item_array) { $_pb_content_area .= pbGetItem($item_array['slug'], $item_array); } $_layout_close='
'; $_pb_content_area_layouts .= $_layout_close; $_pb_content_area .= $_layout_close; } } while($pbLayoutCount++<3){ $_empty_layout = '
'; $_pb_content_area .= $_empty_layout; $_pb_content_area_layouts .= $_empty_layout; } $templates = '
'; $templates .= ''; $templates .= '
'; wp_nonce_field(plugin_basename(__FILE__), 'myplugin_noncename'); foreach ($tw_pbItems as $pbItemSlug => $pbItemArray) { if(empty($pbItemArray['only']) || $pbItemArray['only']==='builder'){ $items .= pbGetItem($pbItemSlug); } } $pbLayout = get_metabox('layout'); if($pbLayout===''){$pbLayout='full';}; $pbLayouts = 'Left Sidebar Full Right Sidebar'; echo '

Select Page Layout

Choose the layout for this page.
' . $pbLayouts . '

Select Your Element

Choose the layout for this page.
' . $items . '
' . $templates . '
'.$_pb_content_area_layouts.'
'; } } // Save fields data if (!function_exists('pbSectionBoxSavePostData')) { function pbSectionBoxSavePostData($post_id) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id; if (isset($_GET['post_type']) && 'page' == $_GET['post_type']) { if (!current_user_can('edit_page', $post_id)) return $post_id; } else { if (!current_user_can('edit_post', $post_id)) return $post_id; } if (isset($_POST['pb_content'])) { update_post_meta($post_id, '_pb_content', $_POST['pb_content']); } if (isset($_POST['pb_content'])) { set_metabox('layout',$_POST['pb-page-layout']); } } } add_action('save_post', 'pbSectionBoxSavePostData'); // Template Ajax Action if (!function_exists('pbTemplateAdd') && is_user_logged_in()) { function pbTemplateAdd() { if (isset($_REQUEST['template_name']) && isset($_REQUEST['template_layout']) && isset($_REQUEST['template_content'])) { $response = ''; $templates_array = get_option('tw_pb_'.strtolower(THEMENAME).'_templates'); if (isset($templates_array[$_REQUEST['template_name']])) { $response .= '
' . __('Template name is allready exist. Please insert the template name and try again', 'themewaves') . '
'; } else { $templates_array[$_REQUEST['template_name']] = array( 'layout' => $_REQUEST['template_layout'], 'content' => $_REQUEST['template_content'] ); update_option('tw_pb_'.strtolower(THEMENAME).'_templates', $templates_array); $response .= '
' . __('Template added', 'themewaves') . '
'; } die('
' . $response . '
'); } } } add_action('wp_ajax_template_add', 'pbTemplateAdd'); if (!function_exists('pbTemplateGet') && is_user_logged_in()) { function pbTemplateGet() { if (isset($_REQUEST['template_name'])) { $response = ''; $templates_array = get_option('tw_pb_'.strtolower(THEMENAME).'_templates'); if (isset($templates_array[$_REQUEST['template_name']])) { $template = $templates_array[$_REQUEST['template_name']]; $response .= '
'; $response .= '
' . $template['layout'] . '
'; $response .= '
'. rawUrlDecode($template['content']) . '
'; $response .= '
'; } else { $response .= '
' . __('Template name not exsist', 'themewaves') . '
'; } die('
' . $response . '
'); } } } add_action('wp_ajax_template_get', 'pbTemplateGet'); if (!function_exists('pbTemplateRemove') && is_user_logged_in()) { function pbTemplateRemove() { if (isset($_REQUEST['template_name'])) { $response = ''; $templates_array = get_option('tw_pb_'.strtolower(THEMENAME).'_templates'); if (isset($templates_array[$_REQUEST['template_name']])) { unset($templates_array[$_REQUEST['template_name']]); update_option('tw_pb_'.strtolower(THEMENAME).'_templates', $templates_array); } else { $response .= '
' . __('Template name not exsist', 'themewaves') . '
'; } die('
' . $response . '
'); } } } add_action('wp_ajax_template_remove', 'pbTemplateRemove'); if (!function_exists('pbGetFontawesome') && is_user_logged_in()) { function pbGetFontawesome() { require_once (THEME_PATH . "/framework/pagebuilder/font-awesome.php"); die(); } } add_action('wp_ajax_get_fontawesome', 'pbGetFontawesome'); //====== END - Functions ====== ?>