/** * Section template. */ function section_template() { ?> <div class="notfound boomboard"> <?php if (current_user_can('edit_posts') && isset($_GET['boxes']) || isset($_GET['feature']) || isset($_GET['banners'])) { ?> <h2 class="notavail center"><?php _e('Direct Previewing <em>of</em> "Special Post Types" Not Available... Yet', 'pagelines'); ?> </h2> <p class="subhead center"><?php _e('Sorry, direct previewing of special post types such as <strong>features</strong> or <strong>boxes</strong> is unavailable. This WordPress functionality is new and rapidly developing, so it should be available soon.', 'pagelines'); ?> </p> <p class="subhead center"> <?php _e('To preview a "custom post type" just view a page with that "section" on it.', 'pagelines'); ?> </p> <?php } else { ?> <h2 class="hugetext center"><?php _e('404!', 'pagelines'); ?> </h2> <p class="subhead center"><?php _e('Sorry, This Page Does not exist.', 'pagelines'); ?> <br/><?php _e('Go', 'pagelines'); ?> <a href="<?php echo home_url(); ?> "><?php _e('home', 'pagelines'); ?> </a> <?php _e('or try a search?', 'pagelines'); ?> </p> <?php } ?> <div class="center fix"><?php get_search_form(); ?> </div> </div> <?php pagelines_register_hook('pagelines_not_found_actions'); // Hook }
function section_template() { ?> <?php pagelines_register_hook( 'pagelines_section_before_postnav' ); // Hook ?> <div class="post-nav fix"> <span class="previous"><?php previous_post_link('%link') ?></span> <span class="next"><?php next_post_link('%link') ?></span> </div> <?php pagelines_register_hook( 'pagelines_section_after_postnav' ); // Hook ?> <?php }
/** * Section template. */ function section_template() { global $pagelines_layout; ?> <div id="pagelines_content" class="<?php echo $pagelines_layout->layout_mode; ?> fix"> <?php pagelines_register_hook('pagelines_content_before_columns', 'maincontent'); // Hook ?> <div id="column-wrap" class="fix"> <?php pagelines_register_hook('pagelines_content_before_maincolumn', 'maincontent'); // Hook ?> <div id="column-main" class="mcolumn fix"> <div class="mcolumn-pad" > <?php pagelines_template_area('pagelines_main', 'main'); ?> </div> </div> <?php if ($pagelines_layout->layout_mode == 'two-sidebar-center') { ?> <?php pagelines_register_hook('pagelines_content_before_sidebar1', 'maincontent'); // Hook ?> <div id="sidebar1" class="scolumn fix"> <div class="scolumn-pad"> <?php pagelines_template_area('pagelines_sidebar1', 'sidebar1'); ?> </div> </div> <?php pagelines_register_hook('pagelines_content_after_sidebar1', 'maincontent'); // Hook ?> <?php } ?> </div> <?php get_sidebar(); ?> </div> <?php }
/** * PageLines <head> Includes * */ function pagelines_head_common(){ pagelines_register_hook('pagelines_code_before_head'); // Hook printf('<meta http-equiv="Content-Type" content="%s; charset=%s" />', get_bloginfo('html_type'), get_bloginfo('charset')); pagelines_title_tag(); if(!VDEV) echo "<!-- Platform WordPress Framework By PageLines - www.PageLines.com -->\n"; /* Meta Images */ if(pagelines_option('pagelines_favicon')) printf('<link rel="shortcut icon" href="%s" type="image/x-icon" />%s', pagelines_option('pagelines_favicon'), "\n"); if(pagelines_option('pagelines_touchicon')) printf('<link rel="apple-touch-icon" href="%s" />%s', pagelines_option('pagelines_touchicon'), "\n"); if(!apply_filters( 'pagelines_xfn', '' )) echo '<link rel="profile" href="http://gmpg.org/xfn/11" />'."\n"; // bbPress Header... doesn't support hooks, or they need to be reloaded. if( pagelines_bbpress_forum() ){ pagelines_load_css( bb_get_stylesheet_uri(), 'pagelines-bbpress', CORE_VERSION); bb_feed_head(); bb_head(); } // Get Pro Styles if(VPRO) pagelines_load_css_relative('pro/pro.css', 'pagelines-pro'); // Get Main Styles pagelines_load_css( get_bloginfo('stylesheet_url'), 'pagelines-stylesheet', pagelines_get_style_ver()); // RTL Language Support if(is_rtl()) pagelines_load_css_relative( 'rtl.css', 'pagelines-rtl'); // Queue Common Javascript Libraries wp_enqueue_script("jquery"); // Fix IE and special handling pagelines_fix_ie(); // Cufon replacement pagelines_font_replacement(); // Headerscripts option > custom code print_pagelines_option('headerscripts'); // Header Scripts Input Option }
/** * * Register HTML sections for use in the theme. * * @package Platform * @subpackage Config * @since 1.4.0 * */ function pagelines_register_sections(){ // Common WP pagelines_register_section('PageLinesContent', 'wp', 'content'); pagelines_register_section('PageLinesPostLoop', 'wp', 'postloop'); pagelines_register_section('PageLinesPostNav', 'wp', 'postnav'); pagelines_register_section('PageLinesComments', 'wp', 'comments'); pagelines_register_section('PageLinesPagination', 'wp', 'pagination'); pagelines_register_section('PageLinesShareBar', 'wp', 'sharebar'); pagelines_register_section('PageLinesNoPosts', 'wp', 'noposts'); pagelines_register_section('PageLinesPostAuthor', 'wp', 'postauthor'); pagelines_register_section('PageLinesPostsInfo', 'wp', 'postsinfo'); // In Header pagelines_register_section('PageLinesNav', 'nav'); pagelines_register_section('PageLinesSecondNav', 'secondnav'); pagelines_register_section('PageLinesBranding', 'wp', 'branding'); pagelines_register_section('BrandNav', 'brandnav', 'brandnav', array('deps'=>'PageLinesNav') ); pagelines_register_section('PageLinesBreadcrumb', 'breadcrumb'); // Sections With Custom Post Types pagelines_register_section('PageLinesFeatures', 'features'); // 'features' pagelines_register_section('PageLinesBoxes', 'boxes'); // 'boxes' pagelines_register_section('PageLinesBanners', 'banners'); // 'boxes' // Sidebar Sections & Widgets pagelines_register_section('PrimarySidebar', 'sidebars', 'sb_primary'); pagelines_register_section('SecondarySidebar', 'sidebars', 'sb_secondary'); pagelines_register_section('TertiarySidebar', 'sidebars', 'sb_tertiary'); pagelines_register_section('UniversalSidebar', 'sidebars', 'sb_universal'); pagelines_register_section('FullWidthSidebar', 'sidebars', 'sb_fullwidth'); pagelines_register_section('ContentSidebar', 'sidebars', 'sb_content'); pagelines_register_section('PageLinesMorefoot', 'sidebars', 'morefoot'); pagelines_register_section('PageLinesFootCols', 'sidebars', 'footcols'); // Misc & Dependent Sections pagelines_register_section('PageLinesSoapbox', 'soapbox'); pagelines_register_section('PageLinesCarousel', 'carousel'); pagelines_register_section('PageLinesHighlight', 'highlight'); pagelines_register_section('PageLinesTwitterBar', 'twitterbar'); pagelines_register_section('PageLinesSimpleFooterNav', 'footer_nav'); pagelines_register_section('PageLinesCallout','callout'); // Do a hook for registering sections pagelines_register_hook('pagelines_register_sections'); // Hook }
function section_template() { ?> <?php if (pagelines('twittername')) { ?> <div class="tbubble"> <?php if (function_exists('twitter_messages') && pagelines('twittername')) { ?> <span class="twitter"> <?php pagelines_register_hook('pagelines_before_twitterbar_text', $this->id); ?> "<?php twitter_messages(pagelines('twittername'), 1, false, false, '', false, false, false); ?> " — <a class="twitteraccount" href="http://www.twitter.com/<?php echo pagelines('twittername'); ?> "><?php echo pagelines('twittername'); ?> </a> </span> <?php } else { ?> <span class="twitter"><?php _e('Please install and activate the "Twitter for WordPress" plugin to use this section.', 'pagelines'); ?> </span> <?php } ?> </div> <?php } else { ?> <div class="tbubble"> <?php _e('Set your Twitter account name in your settings to use the TwitterBar Section.', 'pagelines'); ?> </div> <?php } ?> <?php }
function pl_load_registers() { /** * Load Singleton Globals */ $GLOBALS['pl_section_factory'] = new PageLinesSectionFactory(); /** * Add Extension Handlers */ // require_once( PL_INCLUDES . '/class.register.php' ); global $editorsections; $editorsections->register_sections(); pagelines_register_hook('pagelines_setup'); // Hook $GLOBALS['render_css'] = new PageLinesRenderCSS(); if (pl_setting('enable_debug')) { require_once PL_INCLUDES . '/class.debug.php'; } }
function section_template() { pagelines_main_logo(); pagelines_register_hook( 'brandnav_after_brand', 'brandnav' ); // Hook ?> <div class="inline-nav main_nav fix"> <?php if(function_exists('wp_nav_menu')){ wp_nav_menu( array('menu_class' => 'main-nav'.pagelines_nav_classes(), 'container' => null, 'container_class' => '', 'depth' => 3, 'theme_location'=>'primary', 'fallback_cb'=>'pagelines_nav_fallback') ); }else{ pagelines_nav_fallback(); } pagelines_register_hook( 'brandnav_after_nav', 'brandnav' ); // Hook ?> </div> <?php }
function section_template() { pagelines_register_hook('pagelines_section_before_postnav'); // Hook ?> <div class="post-nav fix"> <span class="previous"><?php previous_post_link('%link', '<i class="icon icon-angle-left"></i> %title'); ?> </span> <span class="next"><?php next_post_link('%link', '%title <i class="icon icon-angle-right"></i>'); ?> </span> </div> <?php pagelines_register_hook('pagelines_section_after_postnav'); // Hook }
/** * Section template. */ function section_template() { pagelines_main_logo($this->id); if (has_action('brandnav_after_brand')) { pagelines_register_hook('brandnav_after_brand', 'brandnav'); // Hook } else { ?> <div class="brandnav-nav main_nav fix"> <?php wp_nav_menu(array('menu_class' => 'main-nav tabbed-list' . pagelines_nav_classes(), 'container' => null, 'container_class' => '', 'depth' => 3, 'theme_location' => 'brandnav', 'fallback_cb' => 'pagelines_nav_fallback')); pagelines_register_hook('brandnav_after_nav', 'brandnav'); // Hook ?> </div> <div class="clear"></div> <?php } }
/** * Section template. */ function section_template() { printf('<div class="branding_wrap fix">'); pagelines_main_logo(); pagelines_register_hook('pagelines_before_branding_icons', 'branding'); // Hook printf('<div class="icons" style="bottom: %spx; right: %spx;">', intval(pagelines_option('icon_pos_bottom')), pagelines_option('icon_pos_right')); pagelines_register_hook('pagelines_branding_icons_start', 'branding'); // Hook if (ploption('rsslink')) { printf('<a target="_blank" href="%s" class="rsslink"><img src="%s" alt="RSS"/></a>', apply_filters('pagelines_branding_rssurl', get_bloginfo('rss2_url')), $this->base_url . '/rss.png'); } if (VPRO) { if (ploption('twitterlink')) { printf('<a target="_blank" href="%s" class="twitterlink"><img src="%s" alt="Twitter"/></a>', ploption('twitterlink'), $this->base_url . '/twitter.png'); } if (ploption('facebooklink')) { printf('<a target="_blank" href="%s" class="facebooklink"><img src="%s" alt="Facebook"/></a>', ploption('facebooklink'), $this->base_url . '/facebook.png'); } if (ploption('linkedinlink')) { printf('<a target="_blank" href="%s" class="linkedinlink"><img src="%s" alt="LinkedIn"/></a>', ploption('linkedinlink'), $this->base_url . '/linkedin.png'); } if (ploption('youtubelink')) { printf('<a target="_blank" href="%s" class="youtubelink"><img src="%s" alt="Youtube"/></a>', ploption('youtubelink'), $this->base_url . '/youtube.png'); } if (ploption('gpluslink')) { printf('<a target="_blank" href="%s" class="gpluslink"><img src="%s" alt="Google+"/></a>', ploption('gpluslink'), $this->base_url . '/google.png'); } pagelines_register_hook('pagelines_branding_icons_end', 'branding'); // Hook } echo '</div></div>'; pagelines_register_hook('pagelines_after_branding_wrap', 'branding'); // Hook ?> <script type="text/javascript"> jQuery('.icons a').hover(function(){ jQuery(this).fadeTo('fast', 1); },function(){ jQuery(this).fadeTo('fast', 0.5);}); </script> <?php }
// Load the global meta settings tab /** * Build Version */ require_once PL_INCLUDES . '/version.php'; require_once PL_INCLUDES . '/class.render.css.php'; if (defined('WP_CLI') && WP_CLI) { require_once PL_INCLUDES . '/cli.commands.php'; } /** * Load site actions */ require_once PL_INCLUDES . '/actions.site.php'; if (ploption('enable_debug')) { require_once PL_ADMIN . '/class.debug.php'; } /** * Run the pagelines_init Hook */ pagelines_register_hook('pagelines_hook_init'); // Hook if (is_admin()) { include PL_ADMIN . '/init.admin.php'; } /** * Load updater class */ //require_once (PL_ADMIN.'/class.updates.php'); // //if ( is_admin() ) // new PageLinesUpdateCheck( PL_CORE_VERSION );
/** * Scans THEMEDIR/sections recursively for section files and auto loads them. * Child section folder also scanned if found and dependencies resolved. * * Section files MUST include a class header and optional depends header. * * Example section header: * * Section: BrandNav Section * Author: PageLines * Description: Branding and Nav Inline * Version: 1.0.0 * Class Name: BrandNav * Depends: PageLinesNav * * @since 2.0 */ function pagelines_register_sections($reset = false, $echo = false) { global $pl_section_factory; if ($reset) { pl_purge_section_cache(); } /** * If cache exists load into $sections array * If not populate array and prime cache */ if (!($sections = get_transient('pagelines_sections_cache'))) { foreach (pl_get_section_dirs() as $type => $dir) { $sections[$type] = $this->get_sections($dir, $type); } // check for deps within the main parent sections, load last if found. foreach ($sections['parent'] as $key => $section) { if (!empty($section['depends'])) { unset($sections['parent'][$key]); $sections['parent'][$key] = $section; } } set_transient('pagelines_sections_cache', $sections, 86400); } if ($echo) { return $sections; } // filter main array containing child, parent and any custom sections $sections = apply_filters('pagelines_section_admin', $sections); $disabled = pl_get_disabled_sections(); foreach ($sections as $tkey => $type) { if (!is_array($type)) { continue; } foreach ($type as $section) { if (empty($section['loadme'])) { $section['loadme'] = false; } if ('parent' == $section['type'] || !is_multisite()) { $section['loadme'] = true; } /** * Checks to see if we are a child section, if so disable the parent * Also if a parent section and disabled, skip. */ if ('parent' != $section['type'] && isset($sections['parent'][$section['class']])) { $disabled['parent'][$section['class']] = true; } if (isset($disabled[$section['type']][$section['class']]) && !$section['persistant']) { continue; } // consolidate array vars $dep = 'parent' != $section['type'] && $section['depends'] ? $section['depends'] : null; $parent_dep = isset($sections['parent'][$section['depends']]) ? $sections['parent'][$section['depends']] : null; $dep_data = array('base_dir' => isset($parent_dep['base_dir']) ? $parent_dep['base_dir'] : null, 'base_url' => isset($parent_dep['base_url']) ? $parent_dep['base_url'] : null, 'base_file' => isset($parent_dep['base_file']) ? $parent_dep['base_file'] : null, 'name' => isset($parent_dep['name']) ? $parent_dep['name'] : null); $section_data = array('base_dir' => $section['base_dir'], 'base_url' => $section['base_url'], 'base_file' => $section['base_file'], 'name' => $section['name']); // do we have a dependency? if (isset($dep) && $section['loadme']) { if (!class_exists($dep) && is_file($dep_data['base_file'])) { include $dep_data['base_file']; $pl_section_factory->register($dep, $dep_data); } // dep loaded... if (!class_exists($section['class']) && class_exists($dep) && is_file($section['base_file'])) { include $section['base_file']; $pl_section_factory->register($section['class'], $section_data); } } else { if (!class_exists($section['class']) && is_file($section['base_file']) && !isset($disabled['parent'][$section['depends']])) { include $section['base_file']; $pl_section_factory->register($section['class'], $section_data); } } } } pagelines_register_hook('pagelines_register_sections'); // Hook }
/** * Section template. */ function section_template($location = false) { $passive = 'passive' == $location ? true : false; $class = array(); // if fixed mode if ($passive || $this->meta['draw'] == 'area') { $class[] = 'navbar-full-width'; $content_width_class = 'pl-content boxed-wrap boxed-nobg'; } else { $class[] = 'navbar-content-width'; $content_width_class = ''; } $theme = $this->opt('navbar_theme') ? $this->opt('navbar_theme') : false; if (is_array($theme)) { $theme = reset($theme); } $align = $this->opt('navbar_alignment') ? $this->opt('navbar_alignment') : false; $hidesearch = $this->opt('navbar_hidesearch') ? $this->opt('navbar_hidesearch') : false; $menu = $this->opt('navbar_menu') ? $this->opt('navbar_menu') : null; $class[] = $this->opt('navbar_enable_hover') ? 'plnav_hover' : ''; $pull = $align ? 'right' : 'left'; $align_class = sprintf('pull-%s', $pull); $class[] = $theme ? sprintf('pl-color-%s', $theme) : 'pl-color-black-trans'; $classes = join(' ', $class); $brand = $this->opt('navbar_logo') || $this->opt('navbar_logo') != '' ? sprintf('<img src="%s" alt="%s" />', $this->opt('navbar_logo'), get_bloginfo('name')) : false; $navbartitle = $this->opt('navbar_title'); ?> <div class="navbar fix <?php echo $classes; ?> "> <div class="navbar-inner <?php echo $content_width_class; ?> "> <div class="navbar-content-pad fix"> <?php if ($navbartitle) { printf('<span class="navbar-title">%s</span>', $navbartitle); } ?> <a href="javascript:void(0)" class="nav-btn nav-btn-navbar mm-toggle"> <?php _e('MENU', 'pagelines'); ?> <i class="icon icon-reorder"></i> </a> <?php if ($brand) { printf('<a class="plbrand" href="%s" title="%s">%s</a>', esc_url(home_url()), esc_attr(get_bloginfo('name')), apply_filters('navbar_brand', $brand)); } pagelines_register_hook('pagelines_navbar_before_menu'); ?> <div class="nav-collapse collapse"> <?php if (!$hidesearch) { pagelines_register_hook('pagelines_navbar_before_search'); pl_get_search_form(); pagelines_register_hook('pagelines_navbar_after_search'); } if (is_array(wp_get_nav_menu_items($menu)) || has_nav_menu('main_nav')) { wp_nav_menu(array('menu_class' => 'font-sub navline pldrop ' . $align_class, 'menu' => $menu, 'container' => null, 'container_class' => '', 'depth' => 3, 'fallback_cb' => '', 'theme_location' => 'main_nav')); } else { pl_nav_fallback('navline pldrop ' . $align_class); } ?> </div> <?php pagelines_register_hook('pagelines_navbar_after_menu'); ?> <div class="clear"></div> </div> </div> </div> <?php }
"> <!-- #site // Wraps #header, #page-main, #footer - closed in footer --> <?php pagelines_register_hook('pagelines_before_page'); // Hook ?> <div id="page"> <!-- #page // Wraps #header, #page-main - closed in footer --> <div id="page-canvas"> <?php pagelines_register_hook('pagelines_before_header'); ?> <div id="header" class="container-group fix"> <div class="outline"> <?php pagelines_template_area('pagelines_header', 'header'); // Hook ?> </div> </div> <?php pagelines_register_hook('pagelines_before_main'); // Hook ?> <div id="page-main" class="container-group fix"> <!-- #page-main // closed in footer --> <div id="dynamic-content" class="outline fix"> <?php if (pagelines_is_buddypress_page()) { ?> <div id="buddypress-page" class="fix"> <div class="content fix"> <?php }
/** * * @TODO document * */ function pagelines_build_option_interface() { pagelines_register_hook('pagelines_before_optionUI'); $args = array('sanitize' => 'pagelines_settings_callback'); $optionUI = new PageLinesOptionsUI($args); }
function pagelines_toolbox() { ?> <div class="pl-toolbox-pusher"> </div> <div id="PageLinesToolbox" class="pl-toolbox"> <div class="resizer-handle"></div> <div class="toolbox-handle fix"> <ul class="unstyled controls"> <li class="el-closer" ><span class="btn-toolbox btn-closer" title="Close [esc]"><i class="icon icon-remove"></i></span></li> <?php foreach ($this->get_toolbar_config() as $key => $tab) { if (!isset($tab['type'])) { $tab['type'] = 'panel'; } if ($tab['type'] == 'hidden' || $tab['type'] == 'dropup' && empty($tab['panel'])) { continue; } if ($tab['type'] == 'output') { echo $tab['output']; continue; } $data = ''; $suffix = ''; $content = ''; $li_class = array(); $li_class[] = 'type-' . $tab['type']; $li_class[] = 'el-' . $key; if ($tab['type'] == 'dropup' && !empty($tab['panel'])) { $data = 'data-toggle="dropdown"'; $suffix = ' <i class="uxi icon icon-caret-right"></i>'; $li_class[] = 'dropup'; $menu = ''; foreach ($tab['panel'] as $key => $i) { $menu .= sprintf('<li><a href="#" class="btn-action" data-action="%s">%s</a></li>', $key, $i['name']); } $content = sprintf('<ul class="dropdown-menu">%s</ul>', $menu); } $li_classes = join(' ', $li_class); $class = array(); $class[] = $tab['type'] == 'panel' ? 'btn-panel' : ''; $class[] = $tab['type'] == 'btn-panel' ? 'btn-panel' : ''; $class[] = $tab['type'] == 'btn' ? 'btn-action' : ''; $class[] = $tab['type'] == 'link' ? 'btn-link' : ''; $class[] = 'btn-' . $key; $el_type = $tab['type'] == 'link' ? 'a' : 'span'; if ($tab['type'] == 'link') { $data .= sprintf(' href="%s" target="_blank"', $tab['link']); } $classes = join(' ', $class); $the_name = isset($tab['name']) && $tab['type'] != 'btn-panel' ? $tab['name'] : ''; $name = sprintf('<span class="txt">%s</span>', $the_name); $icon = isset($tab['icon']) ? sprintf('<i class="uxi icon %s"></i> ', $tab['icon']) : ''; $tip = isset($tab['tip']) && $tab['tip'] != '' ? $tab['tip'] : $the_name; $title = sprintf('title="%s"', $tip); printf('<li class="%s"><%s class="btn-toolbox %s" data-action="%s" %s %s>%s%s%s</%s>%s</li>', $li_classes, $el_type, $classes, $key, $data, $title, $icon, $name, $suffix, $el_type, $content); } ?> </ul> <ul class="unstyled controls send-right"> <li class="li-refresh type-btn"><span class="btn-toolbox btn-save btn-refresh" data-mode="pagerefresh" title="<?php _e('Refresh needed to view changes.', 'pagelines'); ?> "><i class="icon icon-refresh"></i></li> <li class="li-publish"><span class="btn-toolbox btn-save btn-publish" data-mode="publish" title="<?php _e('Publish Live', 'pagelines'); ?> (alt+s)"><i class="icon icon-ok"></i> <span class="txt"><?php _e('Publish', 'pagelines'); ?> </span></li> </ul> <ul class="unstyled controls not-btn send-right"> <li class="switch-btn btn-saving"><span class="btn-toolbox not-btn"><i class="icon icon-refresh icon-spin"></i> <span class="txt"><?php _e('Saving', 'pagelines'); ?> </span></li> <li class="switch-btn btn-layout-resize"><span class="btn-toolbox not-btn"> <i class="icon icon-fullscreen"></i> <span class="txt"><?php _e('Width', 'pagelines'); ?> : <span class="resize-px"></span> / <span class="resize-percent"></span></span> </li> </ul> </div> <?php pagelines_register_hook('before_toolbox_panel'); // Hook ?> <div class="toolbox-panel-wrap"> <div class="toolbox-panel"> <div class="toolbox-content fix"> <div class="toolbox-content-pad option-panel"> <?php foreach ($this->get_toolbar_config() as $key => $tab) { if (isset($tab['panel']) && !empty($tab['panel'])) { $this->panel($key, $tab['panel']); } else { printf('<div class="panel-%s tabbed-set error-panel"><i class="icon icon-spinner icon-spin"></i></div>', $key); } } ?> </div> </div> </div> </div> </div> <?php }
function section_template() { ?> <div id="feature_slider" class="fix"> <div id="feature-area"> <div id="cycle"> <?php global $post; global $pagelines_layout; $current_page_post = $post; $feature_posts = $this->get_feature_posts(); if (!empty($feature_posts) && is_array($feature_posts)) { foreach ($feature_posts as $post) { // Setup For Std WP functions setup_postdata($post); // Get Feature Style if (get_post_meta($post->ID, 'feature-style', true)) { $feature_style = get_post_meta($post->ID, 'feature-style', true); } else { $feature_style = 'text-left'; } if (get_post_meta($post->ID, 'feature-link-text', true)) { $flink_text = get_post_meta($post->ID, 'feature-link-text', true); } else { $flink_text = __('More', 'pagelines'); } //Get the Thumbnail URL $feature_background_image = get_post_meta($post->ID, 'feature-background-image', true); $feature_design = get_post_meta($post->ID, 'feature-design', true) ? get_post_meta($post->ID, 'feature-design', true) : ''; ?> <div id="<?php echo 'feature_' . $post->ID; ?> " class="fcontainer <?php echo $feature_style . ' ' . $feature_design; ?> fix" > <div class="feature-wrap wcontent" <?php if ($feature_background_image) { ?> style="background: url('<?php echo $feature_background_image; ?> ') no-repeat top center" <?php } ?> > <div class="feature-pad fix"> <?php pagelines_register_hook('pagelines_feature_before', $this->id); // Hook ?> <div class="fcontent <?php if (get_post_meta($post->ID, 'fcontent-bg', true)) { echo get_post_meta($post->ID, 'fcontent-bg', true); } ?> "> <div class="dcol-pad fix"> <?php pagelines_register_hook('pagelines_fcontent_before', $this->id); ?> <div class="fheading"> <h2 class="ftitle"><?php the_title(); ?> </h2> </div> <div class="ftext"> <?php pagelines_register_hook('pagelines_feature_text_top', $this->id); // Hook ?> <div class="fexcerpt"> <?php if (pagelines_option('feature_source') == 'posts') { the_excerpt(); } else { the_content(); } ?> </div> <?php if (get_post_meta($post->ID, 'feature-link-url', true)) { ?> <a class="flink" href="<?php echo get_post_meta($post->ID, 'feature-link-url', true); ?> "><span class="featurelink" ><?php echo $flink_text; ?> </span></a> <?php } ?> <?php pagelines_register_hook('pagelines_feature_text_bottom', $this->id); // Hook ?> <?php edit_post_link(__('<span>Edit</span>', 'pagelines'), '', ''); ?> </div> <?php pagelines_register_hook('pagelines_fcontent_after', $this->id); ?> </div> </div> <div class="fmedia" style=""> <div class="dcol-pad"> <?php pagelines_register_hook('pagelines_feature_media_top', $this->id); // Hook ?> <?php if (get_post_meta($post->ID, 'feature-media-image', true)) { ?> <div class="media-frame"> <img src="<?php echo get_post_meta($post->ID, 'feature-media-image', true); ?> " /> </div> <?php } elseif (get_post_meta($post->ID, 'feature-media', true)) { ?> <?php echo get_post_meta($post->ID, 'feature-media', true); ?> <?php } ?> </div> </div> <?php pagelines_register_hook('pagelines_feature_after', $this->id); ?> <div class="clear"></div> </div> </div> </div> <?php } ?> <?php } else { ?> <h4 style="padding: 50px; text-align: center"><?php _e('No feature posts matched this pages criteria', 'pagelines'); ?> </h4> <?php } ?> <?php $post = $current_page_post; ?> </div> <?php if (pagelines('feature_nav_type') == 'arrows') { ?> <div id="arrownav"> <a href="#"><span id="prev"> </span></a> <a href="#"><span id="next"> </span></a> </div> <?php } ?> </div> <div id="feature-footer" class="<?php e_pagelines('feature_nav_type', ''); ?> <?php if (count($this->the_feature_posts) == 1) { echo 'nonav'; } ?> fix"> <div class="feature-footer-pad"> <?php pagelines_register_hook('pagelines_feature_nav_before', $this->id); ?> <?php if (pagelines('timeout') != 0 && pagelines('feature_playpause')) { ?> <span class="playpause pause"><span> </span></span><?php } ?> <div id="featurenav" class="fix"> </div> <div class="clear"></div> </div> </div> </div> <div class="clear"></div> <?php }
/** * Get post excerpt and markup * * @since 2.0.0 * * @return string the excerpt markup */ function post_excerpt_markup($mode = '', $thumbnail = '') { ob_start(); pagelines_register_hook('pagelines_loop_before_excerpt', 'theloop'); // Hook if ($mode == 'left-excerpt' || $mode == 'right-excerpt') { printf('<aside class="post-excerpt">%s %s</aside>', $thumbnail, get_the_excerpt()); } else { printf('<aside class="post-excerpt">%s</aside>', get_the_excerpt()); } if (pagelines_is_posts_page() && !$this->pagelines_show_content(get_the_ID())) { // 'Continue Reading' link echo $this->get_continue_reading_link(get_the_ID()); } pagelines_register_hook('pagelines_loop_after_excerpt', 'theloop'); // Hook $pagelines_excerpt = ob_get_clean(); return apply_filters('pagelines_excerpt', $pagelines_excerpt); }
/** * * @TODO document * */ function draw_features($f, $class, $clone_id = null) { // Setup global $post; global $pagelines_ID; global $pagelines_layout; $current_page_post = $post; if (empty($f)) { echo setup_section_notify($this, __("No Feature posts matched this page's criteria", 'pagelines')); return; } // Options $feature_source = ploption('feature_source', $this->oset); $timeout = ploption('timeout', $this->oset); $playpause = ploption('feature_playpause', $this->oset); $feature_nav_type = ploption('feature_nav_type', $this->oset); // Refine $no_nav = isset($f) && count($f) == 1 ? ' nonav' : ''; $footer_nav_class = $class . ' ' . $feature_nav_type . $no_nav; $cycle_selector = "fclone" . $clone_id; ?> <div id="feature_slider" class="<?php echo $cycle_selector . '_wrap ' . $class; ?> fix"> <div id="feature-area" class="fset_height"> <div id="cycle" class="<?php echo $cycle_selector; ?> "> <?php foreach ($f as $post) { // Setup For Std WP functions setup_postdata($post); $oset = array('post_id' => $post->ID); $target = apply_filters('pagelines_features_target', '', $post); $feature_style = ploption('feature-style', $oset) ? ploption('feature-style', $oset) : 'text-left'; $feature_style = apply_filters('pagelines-feature-style', $feature_style); $flink_text = ploption('feature-link-text', $oset) ? __(ploption('feature-link-text', $oset)) : __('More', 'pagelines'); if ($feature_source == 'posts' || $feature_source == 'posts_all') { $feature_background_image = ''; if (plmeta('feature-background-image', $oset)) { $feature_background_image = plmeta('feature-background-image', $oset); } elseif (has_post_thumbnail($post->ID)) { $feature_background_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); $feature_background_image = $feature_background_image[0]; } else { $feature_background_image = apply_filters('pagelines-feature-cat-default-image', $this->base_url . '/images/feature1.jpg', $post); } $background_class = 'bg_cover'; } else { $feature_background_image = ploption('feature-background-image', $oset); $background_class = 'bg_cover'; } $feature_design = ploption('feature-design', $oset) ? ploption('feature-design', $oset) : ''; if ($feature_source == 'posts' || $feature_source == 'posts_all') { setup_postdata($post); } if (plmeta('feature-link-url', $oset)) { $action = plmeta('feature-link-url', $oset); } elseif (ploption('feature-link-url', $oset)) { $action = ploption('feature-link-url', $oset); } elseif ($feature_source == 'posts' || $feature_source == 'posts_all') { $action = get_permalink(); } else { $action = ''; } $fcontent_class = ploption('fcontent-bg', $oset) ? ploption('feature-bg', $oset) : ''; $media_image = ploption('feature-media-image', $oset); $feature_media = ploption('feature-media', $oset); $feature_media_full = ploption('feature-media-full', $oset); $feature_wrap_markup = $feature_style == 'text-none' && $action ? 'a' : 'div'; $feature_wrap_link = $feature_style == 'text-none' && $action ? sprintf('href="%s"', $action) : ''; $more_link = $feature_style != 'text-none' && $action ? sprintf(' <a %s class="plmore" href="%s" >%s</a>', $target, $action, $flink_text) : ''; $background_css = $feature_background_image ? sprintf('style="background-image: url(\'%s\');"', $feature_background_image) : ''; printf('<div id="%s" class="fcontainer %s %s fix" >', 'feature_' . $post->ID, $feature_style, $feature_design); printf('<%s class="feature-wrap fset_height %s" %s %s >', $feature_wrap_markup, $background_class, $feature_wrap_link, $background_css); if ($feature_wrap_markup != 'a') { if ($feature_media && $feature_media_full) { echo $feature_media; } else { ?> <div class="feature-pad fset_height fix"> <div class="fcontent scale_text fset_height <?php echo $fcontent_class; ?> "> <div class="fcontent-pad fix"> <?php pagelines_register_hook('pagelines_feature_text_top', $this->id); // Hook $link = $feature_source == 'posts' || $feature_source == 'posts_all' ? sprintf('<a %s href="%s">%s</a>', $target, $action, $post->post_title) : $post->post_title; $title = sprintf('<div class="fheading"> <h2 class="ftitle">%s</h2> </div>', $link); $content = $feature_source == 'posts' || $feature_source == 'posts_all' ? apply_filters('pagelines_feature_output', custom_trim_excerpt(get_the_excerpt(), '30')) : do_shortcode(get_the_content()); printf('%s<div class="ftext"><div class="fexcerpt">%s%s%s</div></div>', $title, $content, $more_link, pledit($post->ID)); pagelines_register_hook('pagelines_fcontent_after', $this->id); // Hook ?> </div> </div> <div class="fmedia fset_height" style=""> <div class="fmedia-pad"> <?php pagelines_register_hook('pagelines_feature_media_top', $this->id); // Hook if ($media_image) { printf('<div class="media-frame"><img src="%s" /></div>', $media_image); } elseif ($feature_media) { echo do_shortcode($feature_media); } ?> </div> </div> <?php pagelines_register_hook('pagelines_feature_after', $this->id); // Hook ?> <div class="clear"></div> </div> <?php } } printf('</%s>', $feature_wrap_markup); echo '</div>'; } $post = $current_page_post; ?> </div> </div> <?php pagelines_register_hook('pagelines_feature_nav_before', $this->id); // Hook $playpause = $timeout != 0 && $playpause ? sprintf('<span class="playpause pause %s"><span> </span></span>', $cycle_selector) : ''; $nav = sprintf('<div id="featurenav" class="%s subtext fix"></div>', $cycle_selector); printf('<div id="feature-footer" class="%s fix"><div class="feature-footer-pad">%s%s<div class="clear"></div></div></div>', $footer_nav_class, $playpause, $nav); ?> </div> <div class="clear"></div> <?php }
function section_template($clone_id = null) { $carousel_class = isset($clone_id) && $clone_id != 1 ? 'crsl' . $clone_id : 'crsl'; // Set Up Variables $carouselitems = ploption('carousel_items', $this->oset) ? ploption('carousel_items', $this->oset) : 30; $carousel_post_id = ploption('carousel_post_id', $this->oset) ? ploption('carousel_post_id', $this->oset) : null; $carousel_image_width = ploption('carousel_image_width', $this->oset) ? ploption('carousel_image_width', $this->oset) : 64; $carousel_image_height = ploption('carousel_image_height', $this->oset) ? ploption('carousel_image_height', $this->oset) : 64; $cmode = ploption('carousel_mode', $this->oset) ? ploption('carousel_mode', $this->oset) : null; $ngen_id = ploption('carousel_ngen_gallery', $this->oset) ? ploption('carousel_ngen_gallery', $this->oset) : 1; if ($cmode == 'flickr' && !function_exists('get_flickrRSS') || $cmode == 'ngen_gallery' && !function_exists('nggDisplayRandomImages')) { echo setup_section_notify($this, __("The <strong>plugin</strong> for the selected carousel mode needs to be activated (FlickrRSS or NextGen Gallery).", 'pagelines'), admin_url() . 'plugins.php', 'Setup Plugin'); } else { ?> <div class="<?php echo $carousel_class; ?> thecarousel"> <ul id="mycarousel" class="mycarousel"> <?php if (function_exists('nggDisplayRandomImages') && $cmode == 'ngen_gallery') { echo do_shortcode('[nggallery id=' . $ngen_id . ' template=plcarousel]'); } elseif (function_exists('get_flickrRSS') && $cmode == 'flickr') { if (!function_exists('get_and_delete_option')) { // fixes instantiation within the function in the plugin :/ get_flickrRSS(array('num_items' => $carouselitems, 'html' => '<li><a href="%flickr_page%" title="%title%"><img src="%image_square%" alt="%title%"/><span class="list-title">%title%</span></a></li>')); } } elseif ($cmode == 'hook') { pagelines_register_hook('pagelines_carousel_list'); } else { $carousel_post_query = 'numberposts=' . $carouselitems; if ($carousel_post_id) { $carousel_post_query .= '&category_name=' . $carousel_post_id; } $recentposts = get_posts($carousel_post_query); foreach ($recentposts as $cid => $c) { $a = array(); if (has_post_thumbnail($c->ID)) { $img_data = wp_get_attachment_image_src(get_post_thumbnail_id($c->ID)); $a['img'] = $img_data[0] != '' ? $img_data[0] : $this->base_url . '/post-blank.jpg'; $a['width'] = $img_data[1]; $a['height'] = $img_data[2]; } else { $a['img'] = $this->base_url . '/post-blank.jpg'; $a['width'] = 100; $a['height'] = 100; } $args = array('title' => $c->post_title, 'link' => get_permalink($c->ID), 'img' => $a['img'], 'maxheight' => $carousel_image_height, 'maxwidth' => $carousel_image_width, 'height' => $a['height'], 'width' => $a['width']); echo $this->carousel_item($args); } } ?> </ul> </div> <?php } }
function after_section($s) { $controls_foot = ''; // ( $s->level == 0 ) ? '' : $this->editor->section_controls_footer( $s ); pagelines_register_hook('pagelines_inside_bottom_' . $s->id, $s->id); printf('</div>%s</section>', $controls_foot); pagelines_register_hook('pagelines_after_' . $s->id, $s->id); }
function draw_boxes($b, $perline = 3, $class = "") { global $post; global $pagelines_ID; $box_thumb_type = pagelines_option('box_thumb_type', $pagelines_ID) ? pagelines_option('box_thumb_type', $pagelines_ID) : 'inline_thumbs'; $count = $perline; ?> <div class="dcol_container_<?php echo $perline; ?> <?php echo $class; ?> fboxes fix"> <?php foreach ($b as $bpost) { setup_postdata($bpost); $box_link = get_post_meta($bpost->ID, 'the_box_icon_link', true); $box_icon = get_post_meta($bpost->ID, 'the_box_icon', true); ?> <div id="<?php echo 'fbox_' . $bpost->ID; ?> " class="dcol_<?php echo $perline; ?> dcol fbox"> <div class="dcol-pad <?php echo $box_thumb_type; ?> "> <?php if ($box_icon) { ?> <div class="fboxgraphic"> <?php echo self::_get_box_image($bpost, $box_icon, $box_link); ?> </div> <?php } ?> <div class="fboxinfo fix"> <div class="fboxtitle"> <h3> <?php if ($box_link) { printf('<a href="%s">%s</a>', $box_link, $bpost->post_title); } else { echo do_shortcode($bpost->post_title); } ?> </h3> </div> <div class="fboxtext"><?php echo do_shortcode($bpost->post_content); edit_post_link(__('[Edit Box]', 'pagelines'), '<br/>', '', $bpost->ID); ?> </div> </div> <?php pagelines_register_hook('pagelines_box_inside_bottom', $this->id); // Hook ?> </div> </div> <?php $end = ($count + 1) / $perline; if (is_int($end)) { echo '<div class="clear"></div>'; } $count++; } ?> </div> <div class="clear"></div> <?php }
<?php pagelines_template_area('pagelines_sidebar1', 'sidebar1'); // Hook ?> </div> </div> <?php } if ($pagelines_layout->num_columns == 3) { ?> <div id="sidebar2" class="scolumn"> <div class="scolumn-pad"> <?php pagelines_template_area('pagelines_sidebar2', 'sidebar2'); // Hook ?> </div> </div> <?php } if (ploption('sidebar_wrap_widgets') == 'bottom') { pagelines_template_area('pagelines_sidebar_wrap', 'sidebar_wrap'); // Hook } ?> </div> <?php } pagelines_register_hook('pagelines_after_sidebar_wrap'); // Hook }
/** * After Section * * Closes CSS containers opened by before_section() * Dynamically creates unique hooks: pagelines_inside_bottom_, and pagelines_after_ with matching ids to the dynamically created hooks made in before_section() * * @since ... * * @param string $markup * * @uses pagelines_register_hook */ function after_section($markup = 'content') { if (isset($this->settings['markup'])) { $set_markup = $this->settings['markup']; } else { $set_markup = $markup; } pagelines_register_hook('pagelines_inside_bottom_' . $this->id, $this->id); if ($set_markup == 'copy') { printf('<div class="clear"></div></div></section>'); } elseif ($set_markup == 'content') { // Standard content width and padding divs if ($this->settings['format'] == 'textured' || $this->settings['format'] == 'standard') { printf('</div></div>'); } // Draw textured div for background texturing if ($this->settings['format'] == 'textured') { printf('</div>'); } // Draw wrapper unless using 'raw' format if ($this->settings['format'] != 'raw') { printf('</section>'); } } pagelines_register_hook('pagelines_after_' . $this->id, $this->id); }
</div> <?php pagelines_register_hook('pagelines_after_main'); // Hook ?> <div class="clear"></div> </div> </div> </div> <?php pagelines_register_hook('pagelines_after_page'); // Hook ?> </div> </div> <?php pagelines_register_hook('pagelines_after_footer'); // Hook ?> </div> <?php } print_pagelines_option('footerscripts'); // Load footer scripts option wp_footer(); // Hook (WordPress) ?> </body> </html>
<?php pagelines_main_logo(); ?> <?php pagelines_register_hook( 'pagelines_before_branding_icons', 'branding' ); // Hook ?> <div class="icons" style="bottom: <?php echo intval(pagelines_option('icon_pos_bottom'));?>px; right: <?php echo pagelines_option('icon_pos_right');?>px;"> <?php if(pagelines('rsslink')):?> <a target="_blank" href="<?php echo apply_filters( 'pagelines_branding_rssurl', get_bloginfo('rss2_url') );?>" class="rsslink"></a> <?php endif;?> <?php if(VPRO):?> <?php pagelines_register_hook( 'pagelines_branding_icons_start', 'branding' ); // Hook ?> <?php if(pagelines_option('twitterlink')):?> <a target="_blank" href="<?php echo pagelines_option('twitterlink');?>" class="twitterlink"></a> <?php endif;?> <?php if(pagelines_option('facebooklink')):?> <a target="_blank" href="<?php echo pagelines_option('facebooklink');?>" class="facebooklink"></a> <?php endif;?> <?php if(pagelines_option('linkedinlink')):?> <a target="_blank" href="<?php echo pagelines_option('linkedinlink');?>" class="linkedinlink"></a> <?php endif;?> <?php if(pagelines_option('youtubelink')):?> <a target="_blank" href="<?php echo pagelines_option('youtubelink');?>" class="youtubelink"></a> <?php endif;?> <?php pagelines_register_hook( 'pagelines_branding_icons_end', 'branding' ); // Hook ?> <?php endif;?> </div> </div> <?php pagelines_register_hook( 'pagelines_after_branding_wrap', 'branding' ); // Hook ?>
function section_template() { if( !pagelines('twittername') ) : ?><div class="tbubble"> <?php _e('Set your Twitter account name in your settings to use the TwitterBar Section.</div>', 'pagelines'); return; endif; if ( false === ( $tweets = get_transient( 'section-twitter' ) ) ) { $params = array( 'screen_name'=>pagelines('twittername'), // Twitter account name 'trim_user'=>true, // only basic user data (slims the result) 'include_entities'=>false, // as of Sept 2010 entities were not included in all applicable Tweets. regex still better 'include_rts' => true ); /** * The exclude_replies parameter filters out replies on the server. If combined with count it only filters that number of tweets (not all tweets up to the requested count) * If we are not filtering out replies then we should specify our requested tweet count */ $twitter_json_url = esc_url_raw( 'http://api.twitter.com/1/statuses/user_timeline.json?' . http_build_query( $params ), array( 'http', 'https' ) ); unset( $params ); $response = wp_remote_get( $twitter_json_url, array( 'User-Agent' => 'WordPress.com Twitter Widget' ) ); $response_code = wp_remote_retrieve_response_code( $response ); if ( 200 == $response_code ) { $tweets = wp_remote_retrieve_body( $response ); $tweets = json_decode( $tweets, true ); $expire = 900; if ( !is_array( $tweets ) || isset( $tweets['error'] ) ) { $tweets = 'error'; $expire = 300; } } else { $tweets = 'error'; $expire = 300; set_transient( 'section-twitter-response-code', $response_code, $expire ); } set_transient( 'section-twitter', $tweets, $expire ); } echo '<div class="tbubble">'; echo '<span class="twitter">"'; pagelines_register_hook( 'pagelines_before_twitterbar_text', $this->id ); // Hook if ( 'error' != $tweets ) { echo $tweets[0]['text']; } else { $error = get_transient( 'section-twitter-response-code' ); switch( $error ) { case 401: echo wp_kses( sprintf( __( 'Error: Please make sure the Twitter account is <a href="%s">public</a>.', 'pagelines' ), 'http://support.twitter.com/forums/10711/entries/14016' ), array( 'a' => array( 'href' => true ) ) ); break; case 403: _e( 'Error 403: Your IP is being rate limited by Twitter.', 'pagelines' ); break; case 404: _e( 'Error 404: Your username was not found on Twitter.', 'pagelines' ); break; case 420: _e( 'Error 420: Your IP is being rate limited by Twitter.', 'pagelines' ); break; case 502: _e( 'Error 502: Twitter is being upgraded.', 'pagelines' ); break; default: _e( 'Unknown Twitter error.', 'pagelines' ); break; } } echo '— <a class="twitteraccount" href="http://twitter.com/#!/' . pagelines('twittername') . '">' . pagelines('twittername') . '</a></span></div>'; }
function load_libs() { if (!pl_use_editor()) { return; } global $plpg; global $pldraft; global $plopts; global $editorless; global $storeapi; global $fileopts; global $sections_handler; global $templates_handler; global $sections_data_handler; $plpg = $this->page = new PageLinesPage(); $pldraft = $this->draft = new EditorDraft($this->page); $storeapi = $this->storeapi = new EditorStoreFront(); $this->layout = new EditorLayout(); $sections_data_handler = new PLSectionData(); $templates_handler = new EditorTemplates(); // Mapping $this->map = new PageLinesTemplates($templates_handler); // this needs to be rewritten and moved to mapping class $this->saving_utility = new PageLinesSave(); // Must come before settings $this->foundry = new PageLinesFoundry(); $this->typography = new EditorTypography($this->foundry); $this->importexport = new PLImportExport(); $this->color = new EditorColor(); $this->siteset = new EditorSettings(); $this->extensions = new EditorExtensions(); $less_engine = new PageLinesLESSEngine(); $pless = new PageLinesLess(); $fileOpts = new EditorFileOpts(); $this->editor_less = new EditorLessHandler($pless); $loader = new PageLinesPageLoader(); $help = new EditorHelpPanel(); pagelines_register_hook('pl_after_settings_load'); // hook $plopts = $this->opts = new PageLinesOpts(); // Mobile $this->mobile_menu = new PageLinesMobileMenu(); // Interfaces $this->xlist = new EditorXList(); $sections_handler = new PageLinesSectionsHandler(); $sections_handler->load_ui_actions(); $this->settings_panel = new PageLinesSettingsPanel(); $this->themer = new EditorThemeHandler(); $this->code = new EditorCode($this->draft); $this->areas = new PageLinesAreas(); // Editor UX Elements $this->interface = new EditorInterface($this->page, $this->siteset, $this->draft, $templates_handler, $this->map, $this->extensions, $this->themer); // Master UX Handler $this->handler = new PageLinesTemplateHandler($this->interface, $this->areas, $this->page, $this->siteset, $this->foundry, $this->map, $this->draft, $this->opts, $this->layout, $this->extensions); }
/** * Scans THEMEDIR/sections recursively for section files and auto loads them. * Child section folder also scanned if found and dependencies resolved. * * Section files MUST include a class header and optional depends header. * * Example section header: * * Section: BrandNav Section * Author: PageLines * Description: Branding and Nav Inline * Version: 1.0.0 * Class Name: BrandNav * Depends: PageLinesNav * * @package PageLines Framework * @subpackage Config * @since 2.0 * */ function pagelines_register_sections($reset = null, $echo = null) { global $pl_section_factory; if ($reset === true) { delete_transient('pagelines_sections_cache'); } /** * Load our main section folders * @filter pagelines_section_dirs */ $section_dirs = array('child' => PL_EXTEND_DIR, 'parent' => PL_SECTIONS); if (is_child_theme() && is_dir(get_stylesheet_directory() . '/sections')) { $section_dirs = array_merge(array('custom' => get_stylesheet_directory() . '/sections'), $section_dirs); } $section_dirs = apply_filters('pagelines_sections_dirs', $section_dirs); /** * If cache exists load into $sections array * If not populate array and prime cache */ if (!($sections = get_transient('pagelines_sections_cache'))) { foreach ($section_dirs as $type => $dir) { $sections[$type] = $this->pagelines_getsections($dir, $type); } // check for deps within the main parent sections, load last if found. foreach ($sections['parent'] as $key => $section) { if (!empty($section['depends'])) { unset($sections['parent'][$key]); $sections['parent'][$key] = $section; } } /** * TODO switch this to activation/deactivation interface * TODO better idea, clear cached vars on settings save. */ set_transient('pagelines_sections_cache', $sections, 86400); } if (true === $echo) { return $sections; } // filter main array containing child and parent and any custom sections $sections = apply_filters('pagelines_section_admin', $sections); $disabled = get_option('pagelines_sections_disabled', array('child' => array(), 'parent' => array(), 'custom' => array())); foreach ($sections as $type) { if (is_array($type)) { foreach ($type as $section) { if (!isset($section['loadme'])) { $section['loadme'] = false; } if ('parent' == $section['type'] || !is_multisite()) { $section['loadme'] = true; } /** * Checks to see if we are a child section, if so disable the parent * Also if a parent section and disabled, skip. */ if ('parent' != $section['type'] && isset($sections['parent'][$section['class']])) { $disabled['parent'][$section['class']] = true; } if (isset($disabled[$section['type']][$section['class']]) && !$section['persistant']) { continue; } // consolidate array vars $dep = 'parent' != $section['type'] && $section['depends'] != '' ? $section['depends'] : null; $parent_dep = isset($sections['parent'][$section['depends']]) ? $sections['parent'][$section['depends']] : null; $dep_data = array('base_dir' => isset($parent_dep['base_dir']) ? $parent_dep['base_dir'] : null, 'base_url' => isset($parent_dep['base_url']) ? $parent_dep['base_url'] : null, 'base_file' => isset($parent_dep['base_file']) ? $parent_dep['base_file'] : null, 'name' => isset($parent_dep['name']) ? $parent_dep['name'] : null); $section_data = array('base_dir' => $section['base_dir'], 'base_url' => $section['base_url'], 'base_file' => $section['base_file'], 'name' => $section['name']); if (isset($dep) && $section['loadme']) { // do we have a dependency? if (!class_exists($dep) && is_file($dep_data['base_file'])) { include $dep_data['base_file']; $pl_section_factory->register($dep, $dep_data); } // dep loaded... if (!class_exists($section['class']) && is_file($section['base_file'])) { include $section['base_file']; $pl_section_factory->register($section['class'], $section_data); } } else { if (!class_exists($section['class']) && is_file($section['base_file']) && !isset($disabled['parent'][$section['depends']])) { include $section['base_file']; $pl_section_factory->register($section['class'], $section_data); } } } } } pagelines_register_hook('pagelines_register_sections'); // Hook }