/** * Begin content layer * * @since 1.0 * * @param string $content * @return string */ public static function beginContent() { if (is_page_template('tpl-hidden-content.php')) { return ''; } // Content $content = \Drone\HTML::make(); $main = $content->addNew('div')->class('main'); // Layout $layout = Everything::po('layout/layout/layout', '__hidden_ns', Everything::to_('sidebar/layout')->value()); $layout = apply_filters('everything_layout', $layout); // Sidebars $pad = array('left' => 0, 'right' => 0); $side = 'left'; foreach ($layout as $sidebar) { if ($sidebar == '#') { $side = 'right'; } else { if ($sidebar) { $sidebar = apply_filters('everything_sidebar', $sidebar, 'aside'); $width = Everything::to(array('sidebar/list/builtin/' . $sidebar), null, Everything::to_('sidebar/list/additional')->value($sidebar)); if (is_array($width)) { $width = $width['width']; } $pad[$side] += $side == 'right' ? $width : Everything::DEFAULT_SIDEBAR_WIDTH; $GLOBALS['content_width'] = $width - 50; $aside = \Drone\HTML::aside()->addClass('aside', $side == 'left' ? 'alpha' : 'beta')->add(\Drone\Func::functionGetOutputBuffer('dynamic_sidebar', $sidebar)); if ($side == 'right') { $aside->style = "width: {$width}px;"; } if ($side == 'left' && $layout[0] && $layout[1] == '#' && $layout[2]) { // left-content-right $content->insert($aside); } else { if ($side == 'right' && $layout[0] == '#') { // content-right-right $content->insert($aside, 1); } else { $content->add($aside); } } } } } $main->addClass($pad['right'] ? 'alpha' : ($pad['left'] ? 'beta' : '')); $main->style = sprintf('padding: 0 %2$dpx 0 %1$dpx; margin: 0 -%2$dpx 0 -%1$dpx;', $pad['left'], $pad['right']); // Content width $GLOBALS['content_width'] = apply_filters('everything_content_width', Everything::$max_width - array_sum($pad) - 50); if (false) { global $content_width; // Theme-Check } // Content ob_start(function ($buffer) use($content, $main) { $main->add($buffer); return $content->html(); }); }