_webnukes = $GLOBALS['_webnukes']; /** Clone the jr_base_class object */ $this->_spans = array('1' => 'span3', '2' => 'span6', '3' => 'span9', '4' => 'span12'); } function meta_box() { require_once(BASEPATH.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'layout.php'); $sidebars = ''; foreach($GLOBALS['wp_registered_sidebars'] as $k=>$v) { $sidebars[$k] = $v['name'];//''; } $this->_webnukes->html->layout('layout/index', array('fields'=>$options, 'default_settings'=>$default_settings, 'sidebars'=> $sidebars)); /** Load the side links **/ echo $GLOBALS['_webnukes']->html->build(); } private function html_settings($fields, $settings) { $data = array(); foreach($fields as $k=>$v) { $section = (!empty($v['settings']['section'])) ? $v['settings']['section'] : 'general'; //$tab = (!empty($v['settings']['tab'])) ? $v['settings']['tab'] : 'default'; if($k == 'DYNAMIC') { $first = key((array)$v); $section = ( ! empty($v[$first]['settings']['section'])) ? $v[$first]['settings']['section'] : 'general'; //$data[$section][$tab][$k] = $this->_dynamic_fields($v); /** Call another function to bypass 100 times recusive function limitation */ $data[$section][$k] = $this->_dynamic_fields($v); /** Call another function to bypass 100 times recusive function limitation */ $data[$section]['DYNAMIC_SAMPLE_DATA'] = $this->_dynamic_fields($v, true); } else //$data[$section][$tab][$k] = $this->_webnukes->html->generator($k, $v, $settings); $data[$section][$k] = $this->_webnukes->html->generator($k, $v, $settings); } return $data; } function publish_page($post_id) { global $post; //printr($_POST); $layout = kvalue($_POST, 'layout'); //printr($layout); if( $layout ) update_post_meta($post_id, 'page_builder_data', $layout); } /** Page bulder front end output methods */ function sidebar( $settings, $position = 'left' ) { //$builder = (kvalue( $meta, 'page_builder') == 'on') ? true : false; if( ! $settings ) return ; //$struct = kvalue( $settings, 'structure' ); $sidebars = kvalue( $settings, 'sidebars'); $sidebar1 = kvalue( $sidebars, 'left'); $sidebar2 = kvalue( $sidebars, 'right'); $pos = kvalue( $settings, 'structure' ); if( $pos == 'col-full' ) return; switch( $position ) { case 'left': if( $pos == 'col-left' ) $this->aside( $sidebar1); elseif( $pos == 'col-both' ) $this->aside( $sidebar1, 'span3' ); elseif( $pos == 'col-left2' ){ $this->aside( $sidebar1, 'span3' ); $this->aside( $sidebar2, 'span3' ); } break; case 'right': if( $pos == 'col-right' ) $this->aside( $sidebar2 ); elseif( $pos == 'col-both' ) $this->aside( $sidebar2, 'span3' ); elseif( $pos == 'col-right2' ){ $this->aside( $sidebar1, 'span3' ); $this->aside( $sidebar2, 'span3' ); } break; } } function aside( $sidebar, $span = 'span4' ) { ?> _spans[$cols] ) ) return $this->_spans[$cols]; } function build_page($settings) { //printr($settings); if( is_array( $settings ) ) { if( isset( $settings['structure'] ) ) unset( $settings['structure'] ); if( isset( $settings['sidebars'] ) ) unset( $settings['sidebars'] ); foreach( $settings as $array ){ $name = kvalue( $array, 'id' ); //echo $name.'
'; if( method_exists($this, $name ) ) {?>
$name(kvalue($array, 'data'));?>
'.apply_filters( 'the_content', $shortcode ).''; } protected function content($vals) { if( $content = kvalue( $vals, 'content') ) echo '
'.apply_filters( 'the_content', $content ).'
'; } protected function playlist($vals) { $args = array(); if( $title = kvalue( $vals, 'title') ) $args['title'] = $title; if( kvalue( $vals, 'post' ) == 'rand' ) { $posts = get_posts( array('post_type'=>'jr_audio', 'orderby'=>'rand', 'post_status'=>'publish', 'posts_per_page'=>1 ) ); $post_parent = kvalue( current( (array)$posts ), 'ID'); }else $post_parent = kvalue( $vals, 'post'); $q_args = array('post_parent'=>$post_parent,'post_type'=>'attachment', 'post_status'=>'inherit', 'post_mime_type'=>array('audio')); if( kvalue( $vals, 'number' ) ) $q_args['showposts'] = kvalue( $vals, 'number' ); $audios = get_children( $q_args ); //printr($audios); $args['no-margin'] = true; jr_audio_playlist( $audios, $args ); } protected function singers( $vals ) { global $wp_query; $q_args = array('post_type'=>'jr_singer' ); if( kvalue( $vals, 'number' ) ) $q_args['showposts'] = kvalue( $vals, 'number'); $wp_query = new WP_Query( $q_args );?> 'jr_event', 'meta_key' =>'jr_event_start_time', 'meta_query' => array(array('key' => 'jr_event_start_time', 'value' => date('d-m-Y h:i:s'), 'type' => 'date', 'compare' => '>=' )), 'orderby'=>'meta_value', 'order'=>'ASC'); if( kvalue( $vals, 'number' ) ) $q_args['showposts'] = kvalue( $vals, 'number' ); $query = new WP_Query($q_args);//printr($query); jr_upcoming_events( $query ); wp_reset_query(); } protected function albums($vals) { global $wp_query; $args = array('post_type'=>'jr_audio'); if( $number = kvalue( $vals, 'number' )) $args['showposts'] = $number; $query = new WP_Query($args);?> jr_get_settings('sub_contact_page_settings'); jr_contact_form($settings); } protected function blog($vals) { global $wp_query; $args = array('post_type'=>'post'); if( $cat = kvalue($vals, 'category')) $args['category__in'] = $cat; if( $num = kvalue($vals, 'number')) $args['showposts'] = $num; $wp_query = new WP_Query($args); jr_blog_listing(); wp_reset_query(); } protected function heading($vals) { //$vals = kvalue( $vals, 'data'); $heading = kvalue( $vals, 'heading'); $tag = kvalue($vals, 'tag', '2'); if( $heading ) echo ''.$heading.''; } }