public static function the_post($post) { if (self::$forceDisable) { return; } global $post, $page, $pages, $multipage; // Get previous and next posts. $prevPost = self::getPrevNextPost(true); $nextPost = self::getPrevNextPost(false); /* * Prepare the sliders if * a) This is a single post with multiple pages. * - OR - * b) Previous/next post navigation is enabled and we do have a previous or a next post. */ if (!(self::isCompatiblePost() && ($multipage || $prevPost || $nextPost))) { return; } // Save some variables that we'll also use in the_content() $post->theiaPostSlider = array('srcId' => 'tps_src_' . $post->ID, 'destId' => 'tps_dest_' . $post->ID, 'navIdUpper' => 'tps_nav_upper_' . $post->ID, 'navIdLower' => 'tps_nav_lower_' . $post->ID, 'prevPostId' => $prevPost, 'nextPostId' => $nextPost, 'prevPostUrl' => $prevPost ? get_permalink($prevPost) : null, 'nextPostUrl' => $nextPost ? get_permalink($nextPost) : null); // Add sliders to the page. $content = ''; // Header $content .= '<div class="_header">' . TpsShortCodes::extractShortCode($pages[0], TpsMisc::$beginHeaderShortCode, TpsMisc::$endHeaderShortCode) . '</div>'; // Top slider if (in_array(TpsOptions::get('nav_vertical_position'), array('top_and_bottom', 'top'))) { $content .= TpsMisc::getNavigationBar(array('currentSlide' => $page, 'totalSlides' => count($pages), 'prevPostUrl' => $post->theiaPostSlider['prevPostUrl'], 'nextPostUrl' => $post->theiaPostSlider['nextPostUrl'], 'id' => $post->theiaPostSlider['navIdUpper'], 'class' => '_upper')); } // Empty destination slide $content .= '<div id="' . $post->theiaPostSlider['destId'] . '" class="theiaPostSlider_slides"></div>'; // Source slides $content .= '<div id="' . $post->theiaPostSlider['srcId'] . '" class="theiaPostSlider_slides"><div>'; $content .= "\n\n" . trim($pages[$page - 1]) . "\n\n"; $content .= '</div></div>'; // Bottom slider if (in_array(TpsOptions::get('nav_vertical_position'), array('top_and_bottom', 'bottom'))) { $content .= TpsMisc::getNavigationBar(array('currentSlide' => $page, 'totalSlides' => count($pages), 'prevPostUrl' => $post->theiaPostSlider['prevPostUrl'], 'nextPostUrl' => $post->theiaPostSlider['nextPostUrl'], 'id' => $post->theiaPostSlider['navIdLower'], 'class' => '_lower')); } // Footer $content .= '<div class="_footer">' . TpsShortCodes::extractShortCode($pages[count($pages) - 1], TpsMisc::$beginFooterShortCode, TpsMisc::$endFooterShortCode) . '</div>'; // Save the page. $pages[$page - 1] = $content; // Set this to false so that the theme doesn't display pagination buttons. Kind of a hack. $multipage = false; }
public static function do_page() { $tabs = array('general' => array('title' => __("General", 'theia-post-slider'), 'class' => 'General'), 'navigationBar' => array('title' => __("Navigation Bar", 'theia-post-slider'), 'class' => 'NavigationBar')); if (array_key_exists('tab', $_GET) && array_key_exists($_GET['tab'], $tabs)) { $currentTab = $_GET['tab']; } else { $currentTab = 'general'; } ?> <div class="wrap" xmlns="http://www.w3.org/1999/html"> <div id="icon-options-general" class="icon32"><br></div> <h2>Theia Post Slider</h2> <?php settings_errors(); ?> <h2 class="nav-tab-wrapper"> <?php foreach ($tabs as $id => $tab) { $class = 'nav-tab'; if ($id == $currentTab) { $class .= ' nav-tab-active'; } ?> <a href="?page=tps&tab=<?php echo $id; ?> " class="<?php echo $class; ?> "><?php echo $tab['title']; ?> </a> <?php } ?> </h2> <?php $class = 'TpsAdmin_' . $tabs[$currentTab]['class']; require $class . '.php'; $page = new $class(); $page->echoPage(); ?> <h3><?php _e("Live Preview", 'theia-post-slider'); ?> </h3> <div class="theiaPostSlider_adminPreview"> <?php echo TpsMisc::getNavigationBar(array('currentSlide' => 1, 'totalSlides' => 3, 'id' => 'tps_nav_upper', 'class' => '_upper', 'style' => in_array(TpsOptions::get('nav_vertical_position'), array('top_and_bottom', 'top')) ? '' : 'display: none')); ?> <div id="tps_dest" class="theiaPostSlider_slides"></div> <div id="tps_src" class="theiaPostSlider_slides"> <?php include dirname(__FILE__) . '/preview-slider.php'; ?> </div> <?php echo TpsMisc::getNavigationBar(array('currentSlide' => 1, 'totalSlides' => 3, 'id' => 'tps_nav_lower', 'class' => '_lower', 'style' => in_array(TpsOptions::get('nav_vertical_position'), array('top_and_bottom', 'bottom')) ? '' : 'display: none')); $sliderOptions = array('src' => '#tps_src > div', 'dest' => '#tps_dest', 'nav' => array('#tps_nav_upper', '#tps_nav_lower'), 'navText' => TpsOptions::get('navigation_text'), 'helperText' => TpsOptions::get('helper_text'), 'transitionEffect' => TpsOptions::get('transition_effect'), 'transitionSpeed' => TpsOptions::get('transition_speed'), 'keyboardShortcuts' => true, 'prevText' => TpsOptions::get('prev_text'), 'nextText' => TpsOptions::get('next_text'), 'buttonWidth' => TpsOptions::get('button_width')); ?> <script type='text/javascript'> var slider, theme; jQuery(document).ready(function() { slider = new tps.createSlideshow(<?php echo json_encode($sliderOptions); ?> ); }); </script> </div> </div> <?php }