function layout() { global $pagelines_layout; global $post; $this->css .= '/* Dynamic Layout */' . "\n\n"; if (VPRO) { /* Fixed Width Page */ $fixed_page = $pagelines_layout->content->width + 20; $this->css .= ".fixed_width #page, .fixed_width #footer{width:" . $fixed_page . "px}\n"; } /* Content Width */ $content_with_border = $pagelines_layout->content->width + 2; $this->css .= "#page-main .content{width:" . $content_with_border . "px}\n"; $this->css .= "#site{min-width:" . $content_with_border . "px}\n"; // Fix small horizontal scroll issue $this->css .= "#site .content, .wcontent, #primary-nav ul.main-nav.nosearch{width:" . $pagelines_layout->content->width . "px}\n"; /* Navigation Width */ $nav_width = $pagelines_layout->content->width - 220; $this->css .= "#primary-nav ul{width:" . $nav_width . "px}\n"; $this->css .= "\n"; /* Layout Modes */ foreach (get_the_layouts() as $layout_mode) { $pagelines_layout->build_layout($layout_mode); //Setup for CSS $mode = '.' . $layout_mode . ' '; $this->css .= $mode . "#pagelines_content #column-main, " . $mode . ".wmain, " . $mode . "#buddypress-page #container{width:" . $pagelines_layout->main_content->width . "px}\n"; $this->css .= $mode . "#pagelines_content #sidebar1, " . $mode . "#buddypress-page #sidebar1{width:" . $pagelines_layout->sidebar1->width . "px}\n"; $this->css .= $mode . "#pagelines_content #sidebar2, " . $mode . "#buddypress-page #sidebar2{width:" . $pagelines_layout->sidebar2->width . "px}\n"; $this->css .= $mode . "#pagelines_content #column-wrap, " . $mode . "#buddypress-page #container{width:" . $pagelines_layout->column_wrap->width . "px}\n"; $this->css .= $mode . "#pagelines_content #sidebar-wrap, " . $mode . "#buddypress-page #sidebar-wrap{width:" . $pagelines_layout->sidebar_wrap->width . "px}\n\n"; } }
LayoutSelectControl(this); // For Layout Builder mode e.g. 'one-sidebar-right' LayoutMode = jQuery(this).parent().find('.layoutinput').val(); // Deactivate old builder jQuery('.layout_controls').find('.layouteditor').removeClass('selectededitor'); if ( window['OuterLayout'] ) window['OuterLayout'].destroy(); if ( window['InnerLayout'] ) window['InnerLayout'].destroy(); // Display selected builder jQuery('.'+LayoutMode).addClass('selectededitor'); <?php foreach (get_the_layouts() as $layout) { $mylayout = new PageLinesLayout($layout); $default_margin = $mylayout->margin->bwidth; ?> if (LayoutMode == '<?php echo $layout; ?> ') { marginwidth = mwidth; innereastwidth = <?php echo $mylayout->east->bwidth; ?> ; innerwestwidth = <?php echo $mylayout->west->bwidth; ?>
function layout(){ global $pagelines_layout; global $post; if( $this->comments ) $this->css .= '/* Dynamic Layout --------------- */'.$this->nl2; /* Fixed Width Page */ $fixed_page = $pagelines_layout->content->width + 20; $this->css .= ".fixed_width #page, .fixed_width #footer, .canvas #page-canvas{width:".$fixed_page."px}".$this->nl; /* Content Width */ $content_with_border = $pagelines_layout->content->width + 2; $this->css .= "#page-main .content{width:".$content_with_border."px}".$this->nl; $this->css .= "#site{min-width:".$content_with_border."px}".$this->nl; // Fix small horizontal scroll issue $this->css .= "#site .content, .wcontent, #primary-nav ul.main-nav.nosearch{width:".$pagelines_layout->content->width."px}".$this->nl; /* Navigation Width */ $nav_width = $pagelines_layout->content->width - 220; $this->css .= "#primary-nav ul.main-nav{width:".$nav_width."px}".$this->nl; $this->css .= $this->nl; // For inline CSS in Multisite // TODO clean up layout variable handling $page_layout = $pagelines_layout->layout_mode; /* Layout Modes */ foreach(get_the_layouts() as $layout_mode){ $pagelines_layout->build_layout($layout_mode); //Setup for CSS $mode = '.'.$layout_mode.' '; $this->css .= $mode."#pagelines_content #column-main, ".$mode.".wmain, ".$mode."#buddypress-page #container{width:". $pagelines_layout->main_content->width."px}".$this->nl; $this->css .= $mode."#pagelines_content #sidebar1, ".$mode."#buddypress-page #sidebar1{width:". $pagelines_layout->sidebar1->width."px}".$this->nl; $this->css .= $mode."#pagelines_content #sidebar2, ".$mode."#buddypress-page #sidebar2{width:". $pagelines_layout->sidebar2->width."px}".$this->nl; $this->css .= $mode."#pagelines_content #column-wrap, ".$mode."#buddypress-page #container{width:". $pagelines_layout->column_wrap->width."px}".$this->nl; $this->css .= $mode."#pagelines_content #sidebar-wrap, ".$mode."#buddypress-page #sidebar-wrap{width:". $pagelines_layout->sidebar_wrap->width."px}".$this->nl2; } // Put back to original mode for page layouts in multisite $pagelines_layout->build_layout($page_layout); }
/** * * * Layout Select (Layout Selector) * * * @package EPANEL_WP Core * @subpackage Options * @since 4.0 * */ function _get_layout_select($optionid, $option_settings){ ?> <div id="layout_selector" class="template-edit-panel"> <div class="layout-selections layout-select-default fix"> <div class="layout-overview">Default Layout</div> <?php global $epanel_layout; foreach(get_the_layouts() as $layout): ?> <div class="layout-select-item"> <span class="layout-image-border <?php if($epanel_layout->layout_map['saved_layout'] == $layout) echo 'selectedlayout';?>"><span class="layout-image <?php echo $layout;?>"> </span></span> <input type="radio" class="layoutinput" name="<?php echo EPANEL_SETTINGS; ?>[layout][saved_layout]" value="<?php echo $layout;?>" <?php if($epanel_layout->layout_map['saved_layout'] == $layout) echo 'checked';?>> </div> <?php endforeach;?> </div> </div> <div class="clear"></div> <?php }
/** * * * Layout Select (Layout Selector) * * * @package PageLines Core * @subpackage Options * @since 4.0 * */ function _get_layout_select($optionid, $option_settings) { ?> <div id="layout_selector" class="template-edit-panel"> <div class="layout-selections layout-select-default fix"> <div class="layout-overview">Default Layout</div> <?php global $pagelines_layout; foreach (get_the_layouts() as $layout) { ?> <div class="layout-select-item"> <span class="layout-image-border <?php if ($pagelines_layout->layout_map['saved_layout'] == $layout) { echo 'selectedlayout'; } ?> "><span class="layout-image <?php echo $layout; ?> "> </span></span> <input type="radio" class="layoutinput" name="<?php pagelines_option_name('layout', 'saved_layout'); ?> " value="<?php echo $layout; ?> " <?php if ($pagelines_layout->layout_map['saved_layout'] == $layout) { echo 'checked'; } ?> > </div> <?php } ?> </div> </div> <div class="clear"></div> <?php }
/** * * @TODO document * */ function get_layout_inline() { $l = $this->calculate_dimensions($this->layout_mode); $mode = '.' . $this->layout_mode . ' '; $css = ''; $c = $this->content->width; $p = $this->content->percent; // Selectors // Setup Page Width $page_width_array = apply_filters('pl_page_width', array('body.fixed_width #page', 'body.fixed_width #footer', 'body.canvas .page-canvas')); $page_width_sel = join(',', $page_width_array); // Setup Content Width $content_width_array = apply_filters('pl_content_width', array('#site .content', '#footer .content')); $content_width_sel = join(',', $content_width_array); // Options $layout_handling = ploption('layout_handling'); $design_mode = ploption('site_design_mode'); $contained = $design_mode == 'fixed_width' && !pl_is_disabled('color_control') ? true : false; // Set CSS for content and page width if ($layout_handling == 'percent') { if ($contained) { $css .= sprintf($page_width_sel . '{ width: %s%%;}', $p); $css .= sprintf($content_width_sel . '{ width: %s%%; }', '100'); } else { $css .= sprintf($content_width_sel . '{ width: %s%%; }', $p); } } elseif ($layout_handling == 'pixels') { $css .= sprintf($page_width_sel . '{ max-width:%spx; }', $c); $css .= sprintf($content_width_sel . '{ width: 100%%; max-width:%spx;}', $c); } else { $css .= sprintf($page_width_sel . '{ max-width:%spx; }', $c); $css .= sprintf($content_width_sel . '{ width:%spx;}', $c); } // Set CSS for inner elements based on mode $content_id = apply_filters('pl_content_id', '#pagelines_content'); $main_col_id = apply_filters('pl_main_id', '#column-main'); foreach (get_the_layouts() as $mode) { $l = $this->calculate_dimensions($mode); $mode_selector = '.' . $mode; $css .= sprintf('%1$s %3$s %4$s{ %2$s }', $mode_selector, $l['main'], $content_id, $main_col_id); $css .= sprintf('%1$s %3$s #sidebar1{ %2$s }', $mode_selector, $l['sb1'], $content_id); $css .= sprintf('%1$s %3$s #sidebar2{ %2$s }', $mode_selector, $l['sb2'], $content_id); $css .= sprintf('%1$s %3$s #column-wrap{ %2$s }', $mode_selector, $l['colwrap'], $content_id); $css .= sprintf('%1$s %3$s #sidebar-wrap{ %2$s }', $mode_selector, $l['sbwrap'], $content_id); } return $css; }
/** * * @TODO document * */ function layout_control_javascript() { ?> <script type="text/javascript">/*<![CDATA[*/ jQuery(document).ready(function(){ /* Layout Builder Control */ // Default Layout Select jQuery(' .layout-select-default .layout-image-border').click(function(){ LayoutSelectControl(this); }); <?php $the_last_edited = pagelines_sub_option('layout', 'last_edit') ? pagelines_sub_option('layout', 'last_edit') : null; // Set up layout object for loaded page $load_layout = new PageLinesLayout($the_last_edited); // Values for loading layout $layout_mode = $load_layout->layout_mode; $load_margin = $load_layout->margin->bwidth; $load_west = $load_layout->west->bwidth; $load_east = $load_layout->east->bwidth; $load_gutter = $load_layout->gutter->bwidth; ?> setLayoutBuilder('<?php echo $layout_mode; ?> ', <?php echo $load_margin; ?> , <?php echo $load_east; ?> , <?php echo $load_west; ?> , 10); jQuery('.selected_template .layout-builder-select .layout-image-border').click(function(){ var LayoutMode; var marginwidth; var innerwestwidth; var innereastwidth; var gtrwidth; // Get previous selected layout margin var mwidth = jQuery('.selectededitor .margin-west').width(); // substract border // Control selector class & visualization LayoutSelectControl(this); // For Layout Builder mode e.g. 'one-sidebar-right' LayoutMode = jQuery(this).parent().find('.layoutinput').val(); deactivateCurrentBuilder(); // Display selected builder jQuery('.'+LayoutMode).addClass('selectededitor'); <?php foreach (get_the_layouts() as $layout) { $mylayout = new PageLinesLayout($layout); $default_margin = $mylayout->margin->bwidth; $ewidth = $mylayout->east->bwidth; $wwidth = $mylayout->west->bwidth; ?> if (LayoutMode == '<?php echo $layout; ?> ') { marginwidth = mwidth + 2; innereastwidth = <?php echo $ewidth; ?> ; innerwestwidth = <?php echo $wwidth; ?> ; gtrwidth = 10 } <?php } ?> setLayoutBuilder(LayoutMode, marginwidth, innereastwidth, innerwestwidth, gtrwidth); }); }); /*]]>*/</script><?php }