/**
  * Before main content
  *
  * @since eVision Corporate 1.0.0
  *
  * @param null
  * @return null
  *
  */
 function evision_corporate_front_page()
 {
     if ('posts' == get_option('show_on_front')) {
         include get_home_template();
     } elseif (1 != evision_corporate_if_all_disable()) {
         include get_page_template();
     } else {
         /*home banner section*/
         do_action('evision_corporate_action_front_slider');
         /*about section*/
         do_action('evision_corporate_action_front_about');
         /*service section*/
         do_action('evision_corporate_action_front_service');
         /*portfolio section*/
         do_action('evision_corporate_action_front_portfolio');
         /*client section*/
         do_action('evision_corporate_action_front_client');
         /*testimonial section*/
         do_action('evision_corporate_action_front_testimonial');
         /*blog section*/
         do_action('evision_corporate_action_front_blog');
         /*team section*/
         do_action('evision_corporate_action_front_team');
         /*map section*/
         do_action('evision_corporate_action_front_map');
         /*contact section*/
         do_action('evision_corporate_action_front_contact');
     }
 }
Ejemplo n.º 2
0
function getWpTemplate()
{
    if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
        $template = false;
        if (is_404() && ($template = get_404_template())) {
        } elseif (is_search() && ($template = get_search_template())) {
        } elseif (is_tax() && ($template = get_taxonomy_template())) {
        } elseif (is_front_page() && ($template = get_front_page_template())) {
        } elseif (is_home() && ($template = get_home_template())) {
        } elseif (is_attachment() && ($template = get_attachment_template())) {
        } elseif (is_single() && ($template = get_single_template())) {
        } elseif (is_page() && ($template = get_page_template())) {
        } elseif (is_category() && ($template = get_category_template())) {
        } elseif (is_tag() && ($template = get_tag_template())) {
        } elseif (is_author() && ($template = get_author_template())) {
        } elseif (is_date() && ($template = get_date_template())) {
        } elseif (is_archive() && ($template = get_archive_template())) {
        } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
        } elseif (is_paged() && ($template = get_paged_template())) {
        } else {
            $template = get_index_template();
        }
        return str_replace(ABSPATH, '', $template);
    } else {
        return null;
    }
}
 /**
  * Copy-pasta of wp-includes/template-loader.php
  */
 private function load_template()
 {
     do_action('template_redirect');
     $template = false;
     if (is_404() && ($template = get_404_template())) {
     } elseif (is_search() && ($template = get_search_template())) {
     } elseif (is_front_page() && ($template = get_front_page_template())) {
     } elseif (is_home() && ($template = get_home_template())) {
     } elseif (is_post_type_archive() && ($template = get_post_type_archive_template())) {
     } elseif (is_tax() && ($template = get_taxonomy_template())) {
     } elseif (is_attachment() && ($template = get_attachment_template())) {
         remove_filter('the_content', 'prepend_attachment');
     } elseif (is_single() && ($template = get_single_template())) {
     } elseif (is_page() && ($template = get_page_template())) {
     } elseif (is_category() && ($template = get_category_template())) {
     } elseif (is_tag() && ($template = get_tag_template())) {
     } elseif (is_author() && ($template = get_author_template())) {
     } elseif (is_date() && ($template = get_date_template())) {
     } elseif (is_archive() && ($template = get_archive_template())) {
     } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
     } elseif (is_paged() && ($template = get_paged_template())) {
     } else {
         $template = get_index_template();
     }
     /**
      * Filter the path of the current template before including it.
      *
      * @since 3.0.0
      *
      * @param string $template The path of the template to include.
      */
     if ($template = apply_filters('template_include', $template)) {
         $template_contents = file_get_contents($template);
         $included_header = $included_footer = false;
         if (false !== stripos($template_contents, 'get_header();')) {
             do_action('get_header', null);
             locate_template('header.php', true, false);
             $included_header = true;
         }
         include $template;
         if (false !== stripos($template_contents, 'get_footer();')) {
             do_action('get_footer', null);
             locate_template('footer.php', true, false);
             $included_footer = true;
         }
         if ($included_header && $included_footer) {
             global $wp_scripts;
             $wp_scripts->done = array();
         }
     }
     return;
 }
 function create_admin_page()
 {
     $data = array();
     $data['theme_dir'] = get_stylesheet_directory();
     $home = get_home_template();
     $home = pathinfo($home);
     $data['home_file']['name'] = $home['basename'];
     $data['timber_base'] = TIMBER_URL_PATH;
     $data['home_file']['path'] = trailingslashit(get_stylesheet_directory()) . $data['home_file']['name'];
     $data['home_file']['contents'] = htmlentities(file_get_contents(realpath($data['home_file']['path'])));
     $data['home_file']['location'] = str_replace(ABSPATH, '', trailingslashit(get_stylesheet_directory()));
     Timber::render('timber-admin.twig', $data);
 }
Ejemplo n.º 5
0
 function supermag_front_page()
 {
     if ('posts' == get_option('show_on_front')) {
         include get_home_template();
     } elseif (is_active_sidebar('supermag-home')) {
         ?>
         <div id="primary" class="content-area">
             <main id="main" class="site-main" role="main">
                 <?php 
         dynamic_sidebar('supermag-home');
         ?>
             </main>
             <!-- #main -->
         </div><!-- #primary -->
         <?php 
     } else {
         include get_page_template();
     }
 }
Ejemplo n.º 6
0
 /**
  * Before main content
  *
  * @since biography 1.0.0
  *
  * @param null
  * @return null
  *
  */
 function biography_front_page()
 {
     if ('posts' == get_option('show_on_front')) {
         include get_home_template();
     } elseif (1 == biography_if_all_disable()) {
         /**
          * homepage hook
          * @since Biography 1.0.0
          *
          * @hooked biography_home_service -  10
          * @hooked biography_home_review -  20
          * @subhooked biography_home_testimonial 10
          * @hooked biography_home_history -  30
          */
         do_action('homepage');
     } else {
         include get_page_template();
     }
 }
Ejemplo n.º 7
0
function xtreme_get_template()
{
    global $wp;
    if (defined('WP_USE_THEMES') && constant('WP_USE_THEMES')) {
        if (is_404() && ($template = get_404_template())) {
            return redefine_pagenow($template);
        } elseif (is_search() && ($template = get_search_template())) {
            return redefine_pagenow($template);
        } elseif (is_tax() && ($template = get_taxonomy_template())) {
            return redefine_pagenow($template);
        } elseif (is_front_page() && ($template = get_front_page_template())) {
            return redefine_pagenow($template);
        } elseif (is_home() && ($template = get_home_template())) {
            return redefine_pagenow($template);
        } elseif (is_attachment() && ($template = get_attachment_template())) {
            return redefine_pagenow($template);
        } elseif (is_single() && ($template = get_single_template())) {
            return redefine_pagenow($template);
        } elseif (is_page() && ($template = get_page_template())) {
            return redefine_pagenow($template);
        } elseif (is_category() && ($template = get_category_template())) {
            return redefine_pagenow($template);
        } elseif (is_tag() && ($template = get_tag_template())) {
            return redefine_pagenow($template);
        } elseif (is_author() && ($template = get_author_template())) {
            return redefine_pagenow($template);
        } elseif (is_date() && ($template = get_date_template())) {
            return redefine_pagenow($template);
        } elseif (is_archive() && ($template = get_archive_template())) {
            return redefine_pagenow($template);
        } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
            return redefine_pagenow($template);
        } elseif (is_paged() && ($template = get_paged_template())) {
            return redefine_pagenow($template);
        } else {
            $template = get_index_template();
            return redefine_pagenow($template);
        }
    }
}
 /**
  * Get the fork's parent post, set up a query, and load correct template.
  *
  * Duplicates the functionality of /wp-includes/template-loader.php and includes
  * a lot of copypasta, but that's only to ensure that it follows the same logic.
  *
  */
 function choose_template()
 {
     $p = get_queried_object_id();
     if (get_post_type($p) !== 'fork') {
         return;
     }
     $pp = get_post($p)->post_parent;
     $parent = get_post($pp);
     if ($parent->post_type == 'page') {
         $query = array('page_id' => $pp);
     } else {
         $query = array('p' => $pp);
     }
     $t = new WP_Query($query);
     $template = false;
     if ($t->is_404() && ($template = get_404_template())) {
     } elseif ($t->is_search() && ($template = get_search_template())) {
     } elseif ($t->is_tax() && ($template = get_taxonomy_template())) {
     } elseif ($t->is_front_page() && ($template = get_front_page_template())) {
     } elseif ($t->is_home() && ($template = get_home_template())) {
     } elseif ($t->is_attachment() && ($template = get_attachment_template())) {
         remove_filter('the_content', 'prepend_attachment');
     } elseif ($t->is_single() && ($template = get_single_template())) {
     } elseif ($t->is_page && ($template = get_page_template())) {
     } elseif ($t->is_category() && ($template = get_category_template())) {
     } elseif ($t->is_tag() && ($template = get_tag_template())) {
     } elseif ($t->is_author() && ($template = get_author_template())) {
     } elseif ($t->is_date() && ($template = get_date_template())) {
     } elseif ($t->is_archive() && ($template = get_archive_template())) {
     } elseif ($t->is_comments_popup() && ($template = get_comments_popup_template())) {
     } elseif ($t->is_paged() && ($template = get_paged_template())) {
     } else {
         $template = get_index_template();
     }
     if ($template = apply_filters('template_include', $template)) {
         include $template;
     }
     return;
 }
Ejemplo n.º 9
0
/**
 * Function is responsible for locating the template to use
 * and showing it to the user
 */
function do_template()
{
    //called last as default
    Router::connect('/:controller/:action/*');
    $template = '';
    $route = Router::parse();
    if (is('five-contents') && ($template = get_real_template())) {
    } elseif (have_controller() && ($template = get_general_template())) {
    }
    // if we can't figure anything out, then return the 404
    if (!($template = apply_filters('template_include', $template))) {
        $template = get_home_template();
    }
    if (!headers_sent() && config('theme.gzip')) {
        ob_start("ob_gzhandler");
    }
    //_520($template);_520();
    // we want to get the template first and then echo it.
    // this allows redirects from any point within our program
    // this allows us to gzip the output as well
    echo get_show_view($template);
}
Ejemplo n.º 10
0
 function check_template()
 {
     if (is_404() && ($template = get_404_template())) {
         $this->template = $template;
     } elseif (is_search() && ($template = get_search_template())) {
         $this->template = $template;
     } elseif (is_tax() && ($template = get_taxonomy_template())) {
         $this->template = $template;
     } elseif (is_home() && ($template = get_home_template())) {
         $this->template = $template;
     } elseif (is_attachment() && ($template = get_attachment_template())) {
         $this->template = $template;
     } elseif (is_single() && ($template = get_single_template())) {
         $this->template = $template;
     } elseif (is_page() && ($template = get_page_template())) {
         $this->template = $template;
     } elseif (is_category() && ($template = get_category_template())) {
         $this->template = $template;
     } elseif (is_tag() && ($template = get_tag_template())) {
         $this->template = $template;
     } elseif (is_author() && ($template = get_author_template())) {
         $this->template = $template;
     } elseif (is_date() && ($template = get_date_template())) {
         $this->template = $template;
     } elseif (is_archive() && ($template = get_archive_template())) {
         $this->template = $template;
     } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
         $this->template = $template;
     } elseif (is_paged() && ($template = get_paged_template())) {
         $this->template = $template;
     } else {
         $this->template = function_exists('get_index_template') ? get_index_template() : TEMPLATEPATH . "/index.php";
     }
     $this->template = apply_filters('template_include', $this->template);
     // Hook into the footer so we can echo the active template
     add_action('wp_footer', array(&$this, 'show_template'), 100);
 }
Ejemplo n.º 11
0
 public function templateLoad($defaultView = '')
 {
     global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
     $content = '';
     /**
      * Loads the correct template based on the visitor's url
      * @package WordPress
      */
     if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
         do_action('template_redirect');
     }
     /**
      * Filter whether to allow 'HEAD' requests to generate content.
      *
      * Provides a significant performance bump by exiting before the page
      * content loads for 'HEAD' requests. See #14348.
      *
      * @since 3.5.0
      *
      * @param bool $exit Whether to exit without generating any content for 'HEAD' requests. Default true.
      */
     if ('HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters('exit_on_http_head', true)) {
         exit;
     }
     // Process feeds and trackbacks even if not using themes.
     if (is_robots()) {
         /**
          * Fired when the template loader determines a robots.txt request.
          *
          * @since 2.1.0
          */
         do_action('do_robots');
         return $content;
     } elseif (is_feed()) {
         do_feed();
         return $content;
     } elseif (is_trackback()) {
         include ABSPATH . 'wp-trackback.php';
         return $content;
     }
     if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
         $template = false;
         if (is_404() && ($template = get_404_template())) {
         } elseif (is_search() && ($template = get_search_template())) {
         } elseif (is_front_page() && ($template = get_front_page_template())) {
         } elseif (is_home() && ($template = get_home_template())) {
         } elseif (is_post_type_archive() && ($template = get_post_type_archive_template())) {
         } elseif (is_tax() && ($template = get_taxonomy_template())) {
         } elseif (is_attachment() && ($template = get_attachment_template())) {
             remove_filter('the_content', 'prepend_attachment');
         } elseif (is_single() && ($template = get_single_template())) {
         } elseif (is_page() && ($template = get_page_template())) {
         } elseif (is_category() && ($template = get_category_template())) {
         } elseif (is_tag() && ($template = get_tag_template())) {
         } elseif (is_author() && ($template = get_author_template())) {
         } elseif (is_date() && ($template = get_date_template())) {
         } elseif (is_archive() && ($template = get_archive_template())) {
         } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
         } elseif (is_paged() && ($template = get_paged_template())) {
         } else {
             $template = get_index_template();
         }
         /**
          * Filter the path of the current template before including it.
          *
          * @since 3.0.0
          *
          * @param string $template The path of the template to include.
          */
         if ($template = apply_filters('template_include', $this->defaultView ?: $template)) {
             load_template($template, false);
         }
         return $content;
     }
 }
Ejemplo n.º 12
0
<?php

/**
 * The template for displaying front page content.
 *
 * This template will then load home.php or page.php depending on users front page display settings.
 *
 * @package ThinkUpThemes
 */
if ('posts' == get_option('show_on_front')) {
    include get_home_template();
} else {
    include get_page_template();
}
Ejemplo n.º 13
0
 /**
  * @expectedDeprecated get_themes
  * @expectedDeprecated get_current_theme
  */
 function test_switch_theme()
 {
     $themes = get_themes();
     // Switch to each theme in sequence.
     // Do it twice to make sure we switch to the first theme, even if it's our starting theme.
     // Do it a third time to ensure switch_theme() works with one argument.
     for ($i = 0; $i < 3; $i++) {
         foreach ($themes as $name => $theme) {
             // switch to this theme
             if ($i === 2) {
                 switch_theme($theme['Template'], $theme['Stylesheet']);
             } else {
                 switch_theme($theme['Stylesheet']);
             }
             $this->assertEquals($name, get_current_theme());
             // make sure the various get_* functions return the correct values
             $this->assertEquals($theme['Template'], get_template());
             $this->assertEquals($theme['Stylesheet'], get_stylesheet());
             $root_fs = get_theme_root();
             $this->assertTrue(is_dir($root_fs));
             $root_uri = get_theme_root_uri();
             $this->assertTrue(!empty($root_uri));
             $this->assertEquals($root_fs . '/' . get_stylesheet(), get_stylesheet_directory());
             $this->assertEquals($root_uri . '/' . get_stylesheet(), get_stylesheet_directory_uri());
             $this->assertEquals($root_uri . '/' . get_stylesheet() . '/style.css', get_stylesheet_uri());
             #				$this->assertEquals($root_uri . '/' . get_stylesheet(), get_locale_stylesheet_uri());
             $this->assertEquals($root_fs . '/' . get_template(), get_template_directory());
             $this->assertEquals($root_uri . '/' . get_template(), get_template_directory_uri());
             //get_query_template
             // template file that doesn't exist
             $this->assertEquals('', get_query_template(rand_str()));
             // template files that do exist
             //foreach ($theme['Template Files'] as $path) {
             //$file = basename($path, '.php');
             // FIXME: untestable because get_query_template uses TEMPLATEPATH
             //$this->assertEquals('', get_query_template($file));
             //}
             // these are kind of tautologies but at least exercise the code
             $this->assertEquals(get_404_template(), get_query_template('404'));
             $this->assertEquals(get_archive_template(), get_query_template('archive'));
             $this->assertEquals(get_author_template(), get_query_template('author'));
             $this->assertEquals(get_category_template(), get_query_template('category'));
             $this->assertEquals(get_date_template(), get_query_template('date'));
             $this->assertEquals(get_home_template(), get_query_template('home', array('home.php', 'index.php')));
             $this->assertEquals(get_page_template(), get_query_template('page'));
             $this->assertEquals(get_paged_template(), get_query_template('paged'));
             $this->assertEquals(get_search_template(), get_query_template('search'));
             $this->assertEquals(get_single_template(), get_query_template('single'));
             $this->assertEquals(get_attachment_template(), get_query_template('attachment'));
             // this one doesn't behave like the others
             if (get_query_template('comments-popup')) {
                 $this->assertEquals(get_comments_popup_template(), get_query_template('comments-popup'));
             } else {
                 $this->assertEquals(get_comments_popup_template(), ABSPATH . 'wp-includes/theme-compat/comments-popup.php');
             }
             $this->assertEquals(get_tag_template(), get_query_template('tag'));
             // nb: this probably doesn't run because WP_INSTALLING is defined
             $this->assertTrue(validate_current_theme());
         }
     }
 }
	if ( is_robots() ) {
		do_action('do_robots');
		return;
	} else if ( is_feed() ) {
		do_feed();
		return;
	} else if ( is_trackback() ) {
		include(ABSPATH . 'wp-trackback.php');
		return;
	} else if ( is_404() && $template = get_404_template() ) {
		include($template);
		return;
	} else if ( is_search() && $template = get_search_template() ) {
		include($template);
		return;
	} else if ( is_home() && $template = get_home_template() ) {
		include($template);
		return;
	} else if ( is_attachment() && $template = get_attachment_template() ) {
		remove_filter('the_content', 'prepend_attachment');
		include($template);
		return;
	} else if ( is_single() && $template = get_single_template() ) {
		include($template);
		return;
	} else if ( is_page() && $template = get_page_template() ) {
		include($template);
		return;
	} else if ( is_category() && $template = get_category_template()) {
		include($template);
		return;
if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
	do_action('template_redirect');
	if ( is_feed() && empty($doing_rss) ) {
		include(ABSPATH . '/wp-feed.php');
		exit;
	} else if ( is_trackback() && empty($doing_trackback) ) {
		include(ABSPATH . '/wp-trackback.php');
		exit;
	} else if ( is_404() && get_404_template() ) {
		include(get_404_template());
		exit;
	} else if ( is_search() && get_search_template() ) {
		include(get_search_template());
		exit;
	} else if ( is_home() && get_home_template() ) {
		include(get_home_template());
		exit;
	} else if ( is_single() && get_single_template() ) {
		include(get_single_template());
		exit;
	} else if ( is_page() && get_page_template() ) {
		include(get_page_template());
		exit;
	} else if ( is_category() && get_category_template()) {
		include(get_category_template());
		exit;		
	} else if ( is_author() && get_author_template() ) {
		include(get_author_template());
		exit;
	} else if ( is_date() && get_date_template() ) {
		include(get_date_template());
Ejemplo n.º 16
0
 public function render($request)
 {
     $this->parse($request);
     add_action('wp_footer', array($this, 'start_editor'), 999);
     load_template(get_home_template());
     die;
 }
Ejemplo n.º 17
0
/**
 * Choose appropriate template file when paged and not default language
 *
 * Some fix when somebody uses 'page_on_front', set page with custom Template,
 * this page has Loop of posts. Before that, when you changed language to
 * non-default and paged, WPML looses page Template and uses index.php from theme
 *
 * @since 3.1.5
 *
 * @param string $template Template path retrieved from @see wp-includes/template-loader.php
 *
 * @return string New template path (or default)
 *
 */
function icl_template_paged($template)
{
    global $wp_query, $sitepress;
    // we don't want to run this on default language
    if (ICL_LANGUAGE_CODE == icl_get_default_language()) {
        return $template;
    }
    // seems WPML overwrite 'page' param too early, let's fix this
    if ($sitepress->get_setting('language_negotiation_type') == 3) {
        set_query_var('page', get_query_var('paged'));
    }
    // if template is chosen correctly there is no need to change it
    if ($template != get_home_template()) {
        return $template;
    }
    // this is a place where real error occurs. on paged page result we loose
    // $wp_query->queried_object. so if it set correctly, there is no need to
    // change template
    if ($wp_query->get_queried_object() != null) {
        return $template;
    }
    // does our site really use custom page as front page?
    if (1 > intval(get_option('page_on_front'))) {
        return $template;
    }
    // get template slug for custom page chosen as front page
    $template_slug = get_page_template_slug(get_option('page_on_front'));
    // "The function get_page_template_slug() returns an empty string when the value of '_wp_page_template' is either empty or 'default'."
    if (!$template_slug) {
        return $template;
    }
    $templates = array();
    $templates[] = $template_slug;
    $template = get_query_template('page', $templates);
    return $template;
}
Ejemplo n.º 18
0
 private function getContent()
 {
     $template = false;
     if (is_404() && ($template = get_404_template())) {
     } elseif (is_search() && ($template = get_search_template())) {
     } elseif (is_tax() && ($template = get_taxonomy_template())) {
     } elseif (is_front_page() && ($template = get_front_page_template())) {
     } elseif (is_home() && ($template = get_home_template())) {
     } elseif (is_attachment() && ($template = get_attachment_template())) {
         remove_filter('the_content', 'prepend_attachment');
     } elseif (is_single() && ($template = get_single_template())) {
     } elseif (is_page() && ($template = get_page_template())) {
     } elseif (is_category() && ($template = get_category_template())) {
     } elseif (is_tag() && ($template = get_tag_template())) {
     } elseif (is_author() && ($template = get_author_template())) {
     } elseif (is_date() && ($template = get_date_template())) {
     } elseif (is_archive() && ($template = get_archive_template())) {
     } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
     } elseif (is_paged() && ($template = get_paged_template())) {
     } else {
         $template = get_index_template();
     }
     if ($template = apply_filters('template_include', $template)) {
         ob_start();
         include $template;
         $contents = ob_get_contents();
         ob_end_clean();
         return $contents;
     } else {
         return;
     }
 }
Ejemplo n.º 19
0
 public static function auto_post_images()
 {
     //check if date is Instagram or not
     $date_check = get_option('itw_post_date');
     $debugmode = get_option('itw_debugmode') ? get_option('itw_debugmode') : false;
     $is_home = get_option('itw_ishome') ? get_option('itw_ishome') : false;
     if ($date_check == false) {
         $date_check = 'now';
     }
     //debug
     $debug = "------------------------------------------------------------------------------------------------------------------------------------------\n";
     $debug .= "Instagrate to WordPress - Plugin Debug Output: " . Date(DATE_RFC822) . "\n";
     $debug .= "PAGE LOAD " . Date(DATE_RFC822) . "\n";
     $debug .= "------------------------------------------------------------------------------------------------------------------------------------------\n";
     $debug .= "Home page is: " . get_home_template() . "\n";
     $debug .= "Current page is: " . get_page_template() . "\n";
     $debug .= "------------------------------------------------------------------------------------------------------------------------------------------\n";
     //check if page is blog page - only run
     if ($is_home == true || $is_home == false && (is_home() || is_category(get_option('itw_postcats')))) {
         //if (is_home()) {
         $ishomecheck = $is_home ? "set" : "not set";
         $ishome = is_home() ? 'TRUE' : 'FALSE';
         $debug .= "--START Blog is_home() check " . $ishome . " " . Date(DATE_RFC822) . "\n";
         $debug .= "--CHECK is_home() override " . $ishomecheck . " " . Date(DATE_RFC822) . "\n";
         $debug .= "--START Auto post function START " . Date(DATE_RFC822) . "\n";
         $debug .= "--Marker: " . get_transient('itw_posting') . "\n";
         // Check if auto_post_process has NOT already been
         $marker = get_transient('itw_posting');
         $last_run = get_option('itw_last_run');
         if ($last_run === false) {
             $last_run = 0;
         }
         if ((false === $marker || $marker != 'processing') && time() - $last_run > 60) {
             try {
                 //set cache transient to mark as processing
                 set_transient('itw_posting', 'processing', 60 * 5);
                 $manuallstid = get_option('itw_manuallstid');
                 //debug
                 $debug .= "----START Auto post function: " . Date(DATE_RFC822) . "\n";
                 $debug .= "----Marker: " . get_transient('itw_posting') . "\n";
                 $debug .= "----Last ID:" . $manuallstid . "\n";
                 $images = self::get_images();
                 //$images = array_reverse($images_orig);
                 //get count of array of images
                 if (!empty($images)) {
                     $count = sizeof($images);
                     //debug
                     $debug .= "----Count of Images: " . $count . "\n";
                     //set counter
                     $last_id = 0;
                     //debug
                     $debug .= "------START Auto post function Image Loop:  " . Date(DATE_RFC822) . "\n";
                     //loop through array to get image data
                     for ($i = 0; $i < $count; $i++) {
                         //debug
                         $debug .= "--------" . $i . ": Loop:  " . Date(DATE_RFC822) . "\n";
                         $img_exists = self::instagrate_id_exists($images[$i]["id"]);
                         $img_exists_check = $img_exists ? 'TRUE' : 'FALSE';
                         $debug .= "--------CHECK If image exists:  " . $img_exists_check . " " . Date(DATE_RFC822) . "\n";
                         //Don't include image of $manuallstid
                         if ($images[$i]["id"] != $manuallstid && !$img_exists) {
                             //debug
                             $debug .= "--------Image Id:" . $images[$i]["id"] . " Does not equal Last Id:" . $manuallstid . "\n";
                             // only allow the posting to happen if image timestamp is 2 minutes ago, to stop double posting through API
                             if (time() - $images[$i]["created"] > 120) {
                                 //get image variables
                                 $title = $images[$i]["title"];
                                 $image = $images[$i]["image_large"];
                                 $last_id = $images[$i]["id"];
                                 $image_id = $images[$i]["id"];
                                 //debug
                                 $debug .= "----------Auto post function Ready to Post:  " . Date(DATE_RFC822) . "\n";
                                 $debug .= "----------Title: " . $title . "\n";
                                 $debug .= "----------Image: " . $image . "\n";
                                 if ($date_check == 'instagram') {
                                     $post_date = $images[$i]["created"];
                                     $post_date = date('Y-m-d H:i:s', $post_date);
                                     $post_date_gmt = $post_date;
                                 } else {
                                     $post_date_gmt = date('Y-m-d H:i:s', current_time('timestamp', 1) - ($count - $i) * 20);
                                     $post_date = date('Y-m-d H:i:s', current_time('timestamp', 0) - ($count - $i) * 20);
                                 }
                                 //post new images to wordpress
                                 $debug .= self::blog_post($title, $image, $image_id, $post_date, $post_date_gmt);
                             } else {
                                 //debug
                                 $debug .= "------END Auto post function: " . Date(DATE_RFC822) . "\n";
                                 $debug .= "------Image created within 2 minutes of posting loop\n";
                                 $debug .= "------Image Created:" . $images[$i]["created"] . "\n";
                                 $debug .= "------Posting Time:" . time() . "\n";
                                 //break out of image loop
                                 break;
                             }
                         } else {
                             //transient exists already posting ignore
                             //debug
                             //debug
                             $debug .= "--------" . $images[$i]["id"] . " == " . $manuallstid . "\n";
                             $debug .= "--------Image Id already exists " . $img_exists_check . "\n";
                             $debug .= "--------END Auto post function STOP as last ID already posted " . Date(DATE_RFC822) . "\n";
                         }
                         //set last run timestamp
                         update_option('itw_last_run', time());
                     }
                     if ($last_id != 0) {
                         //update last id field in database with last id of image added
                         //echo '<h1>'.$images[0]["id"].'</h1>';
                         //debug
                         $debug .= "----------START End loop write Last Image ID: " . Date(DATE_RFC822) . "\n";
                         $debug .= "----------First Image ID of Loop: " . $images[0]["id"] . "\n";
                         $debug .= "----------Current Last ID: " . get_option('itw_manuallstid') . "\n";
                         $debug .= "----------Writing Last ID " . Date(DATE_RFC822) . "\n";
                         //update_option('itw_manuallstid', $images[0]["id"]);
                         update_option('itw_manuallstid', $last_id);
                         $debug .= "----------Written Last ID: " . get_option('itw_manuallstid') . "\n";
                     }
                 }
             } catch (Exception $e) {
                 //var_dump $e;
                 $debug .= "------EXCEPTION - " . $e->getMessage() . " " . Date(DATE_RFC822) . "\n";
             }
             //clear processing marker
             set_transient('itw_posting', 'done', 60 * 5);
             //debug
             $debug .= "------END Auto post function Image Loop:  " . Date(DATE_RFC822) . "\n";
             $debug .= "------Marker:  " . get_transient('itw_posting') . "\n";
         } else {
             //transient exists already posting ignore
             //debug
             $debug .= "----END Auto post function failed as Transient Exists: " . $marker . " (Already posting) " . Date(DATE_RFC822) . "\n";
             $debug .= "----END Auto post function failed as started less than a minute since last run - " . $last_run . " Now - " . time() . "\n";
         }
         //debug
         $debug .= "--END Auto post function END " . Date(DATE_RFC822) . "\n";
     } else {
         //not blog page so don't run
         //debug
         $debug .= "--END Blog is_home() check FALSE " . Date(DATE_RFC822) . "\n";
     }
     if ($debugmode) {
         self::plugin_debug_write($debug);
     }
 }
 /**
  * Returns current group
  *
  * @return string
  */
 function get_group()
 {
     static $group = null;
     if ($group === null) {
         switch (true) {
             case is_404() && ($template = get_404_template()):
             case is_search() && ($template = get_search_template()):
             case is_tax() && ($template = get_taxonomy_template()):
             case is_home() && ($template = get_home_template()):
             case is_attachment() && ($template = get_attachment_template()):
             case is_single() && ($template = get_single_template()):
             case is_page() && ($template = get_page_template()):
             case is_category() && ($template = get_category_template()):
             case is_tag() && ($template = get_tag_template()):
             case is_author() && ($template = get_author_template()):
             case is_date() && ($template = get_date_template()):
             case is_archive() && ($template = get_archive_template()):
             case is_comments_popup() && ($template = get_comments_popup_template()):
             case is_paged() && ($template = get_paged_template()):
                 $group = basename($template, '.php');
                 break;
             default:
                 $group = 'default';
                 break;
         }
     }
     return $group;
 }
 /**
  * Load the correct front page template.
  *
  * If a page hasn't been selected for the front page, show the blog (home)
  * template.
  *
  * Otherwise, allow certain templates in the page template dropdown to
  * override the default front-page.php template.
  *
  * @since 1.0.0
  *
  * @param string $template Template file.
  * @return string
  */
 public function template_overrides($template)
 {
     if (is_front_page()) {
         if ('page' != get_option('show_on_front')) {
             $template = get_home_template();
         } elseif (is_page_template() && ($templates = $this->get_templates())) {
             foreach ((array) $templates as $key => $filename) {
                 if (is_page_template($filename)) {
                     $template = get_page_template();
                     break;
                 }
             }
         }
     }
     return $template;
 }
 /**
  * @DEPRICATED
  */
 public function getDefaultTemplate($post)
 {
     if ($post->post_status == 'auto-draft') {
         return false;
     }
     $args = array('p' => $post->ID, 'post_type' => $post->post_type);
     if ($post->post_type == 'page') {
         $args = array('page_id' => $post->ID);
     }
     $template = false;
     if (is_404() && ($template = get_404_template())) {
     } elseif (is_search() && ($template = get_search_template())) {
     } elseif (is_tax() && ($template = get_taxonomy_template())) {
     } elseif (is_front_page() && ($template = get_front_page_template())) {
     } elseif (is_home() && ($template = get_home_template())) {
     } elseif (is_attachment() && ($template = get_attachment_template())) {
     } elseif (is_single() && ($template = get_single_template())) {
     } elseif (is_page() && ($template = get_page_template())) {
     } elseif (is_category() && ($template = get_category_template())) {
     } elseif (is_tag() && ($template = get_tag_template())) {
     } elseif (is_author() && ($template = get_author_template())) {
     } elseif (is_date() && ($template = get_date_template())) {
     } elseif (is_archive() && ($template = get_archive_template())) {
     } elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
     } elseif (is_paged() && ($template = get_paged_template())) {
     } else {
         $template = get_index_template();
     }
     // wp_reset_query();
     if ($template && is_file($template)) {
         $template = basename($template);
     } else {
         $template = false;
     }
     return $template;
 }
Ejemplo n.º 23
0
<?php

/**
 * Front page template for theme
 * 
 * All themes have to follow core's template hierarchy:
 * See: https://developer.wordpress.org/themes/basics/template-hierarchy/
 * 
 */
get_header();
if (get_option('show_on_front') == 'posts') {
    load_template(get_home_template());
} else {
    get_template_part('slider');
    get_template_part('content', 'page');
}
get_footer();
Ejemplo n.º 24
0
 if (is_single() && ($wp_template = get_single_template())) {
     if (is_attachment()) {
         add_filter('the_content', 'prepend_attachment');
     }
     include $wp_template;
 } else {
     if (is_page() && ($wp_template = get_page_template())) {
         if (is_attachment()) {
             add_filter('the_content', 'prepend_attachment');
         }
         include $wp_template;
     } else {
         if (is_category() && ($wp_template = get_category_template())) {
             include $wp_template;
         } else {
             if (is_author() && !empty($wpSettings['usersOwnBlogs']) && ($wp_template = get_home_template())) {
                 include $wp_template;
             } else {
                 if (is_author() && ($wp_template = get_author_template())) {
                     include $wp_template;
                 } else {
                     if (is_date() && ($wp_template = get_date_template())) {
                         include $wp_template;
                     } else {
                         if (is_archive() && ($wp_template = get_archive_template())) {
                             include $wp_template;
                         } else {
                             if (is_comments_popup() && ($wp_template = get_comments_popup_template())) {
                                 include $wp_template;
                             } else {
                                 if (is_paged() && ($wp_template = get_paged_template())) {
     do_feed();
     return;
 } else {
     if (is_trackback()) {
         include ABSPATH . '/wp-trackback.php';
         return;
     } else {
         if (is_404() && ($template = get_404_template())) {
             include $template;
             return;
         } else {
             if (is_search() && ($template = get_search_template())) {
                 include $template;
                 return;
             } else {
                 if (is_home() && ($template = get_home_template())) {
                     include $template;
                     return;
                 } else {
                     if (is_attachment() && ($template = get_attachment_template())) {
                         include $template;
                         return;
                     } else {
                         if (is_single() && ($template = get_single_template())) {
                             if (is_attachment()) {
                                 add_filter('the_content', 'prepend_attachment');
                             }
                             include $template;
                             return;
                         } else {
                             if (is_page() && ($template = get_page_template())) {
Ejemplo n.º 26
0
    }
}
?>

    </optgroup>

    <optgroup label="<?php 
echo $lang->system;
?>
" id="system">
        <?php 
/*
 * Blog
 */
if ($pageForPosts == 0) {
    $blogPath = explode('/', get_home_template());
    $blogFile = end($blogPath);
    showOption(home_url(), $blogFile, null, false, false, 'Blog');
}
/*
 * 404
 */
$notFoundTemplate = get_404_template();
if (!empty($notFoundTemplate)) {
    $notFoundPath = explode('/', $notFoundTemplate);
    $notFoundFile = end($notFoundPath);
    //TODO: permalink_structure
    $permalinkStructure = get_option('permalink_structure');
    $str = empty($permalinkStructure) ? '/?error=404' : '/error/404';
    $link = home_url($str);
    showOption($link, $notFoundFile, null, false, false, '404');
Ejemplo n.º 27
0
 /**
  * Returns current template
  *
  * @return string
  */
 function get_template()
 {
     static $template = null;
     if ($template === null) {
         switch (true) {
             case is_404() && ($template_file = get_404_template()):
             case is_search() && ($template_file = get_search_template()):
             case is_tax() && ($template_file = get_taxonomy_template()):
             case is_front_page() && function_exists('get_front_page_template') && ($template_file = get_front_page_template()):
             case is_home() && ($template_file = get_home_template()):
             case is_attachment() && ($template_file = get_attachment_template()):
             case is_single() && ($template_file = get_single_template()):
             case is_page() && ($template_file = get_page_template()):
             case is_category() && ($template_file = get_category_template()):
             case is_tag() && ($template_file = get_tag_template()):
             case is_author() && ($template_file = get_author_template()):
             case is_date() && ($template_file = get_date_template()):
             case is_archive() && ($template_file = get_archive_template()):
             case is_comments_popup() && ($template_file = get_comments_popup_template()):
             case is_paged() && ($template_file = get_paged_template()):
                 break;
             default:
                 if (function_exists('get_index_template')) {
                     $template_file = get_index_template();
                 } else {
                     $template_file = 'index.php';
                 }
                 break;
         }
         $template = basename($template_file, '.php');
     }
     return $template;
 }
Ejemplo n.º 28
0
 /**
  * Emits template loads to the console
  */
 public function wps_filter_template_include($template)
 {
     if (isset($this->options['no-templates'])) {
         return $template;
     }
     //
     // Try to work out what the template is
     //
     $want_template = '';
     $got_template = '';
     if (is_404()) {
         $want_template = '404';
     } elseif (is_search()) {
         $want_template = 'Search';
     } elseif (is_tax()) {
         $want_template = 'Taxonomy';
     } elseif (is_front_page()) {
         $want_template = 'Front page';
     } elseif (is_home()) {
         $want_template = 'Home';
     } elseif (is_attachment()) {
         $want_template = 'Attachment';
     } elseif (is_single()) {
         $want_template = 'Single';
     } elseif (is_page()) {
         $want_template = 'Page';
     } elseif (is_category()) {
         $want_template = 'Category';
     } elseif (is_tag()) {
         $want_template = 'Tag';
     } elseif (is_author()) {
         $want_template = 'Author';
     } elseif (is_date()) {
         $want_template = 'Date';
     } elseif (is_archive()) {
         $want_template = 'Archive';
     } elseif (is_comments_popup()) {
         $want_template = 'Comments popup';
     } elseif (is_paged()) {
         $want_template = 'Paged';
     }
     if ($template == get_404_template()) {
         $got_template = '404';
     } elseif ($template == get_search_template()) {
         $got_template = 'Search';
     } elseif ($template == get_taxonomy_template()) {
         $got_template = 'Taxonomy';
     } elseif ($template == get_front_page_template()) {
         $got_template = 'Front page';
     } elseif ($template == get_home_template()) {
         $got_template = 'Home';
     } elseif ($template == get_attachment_template()) {
         $got_template = 'Attachment';
     } elseif ($template == get_single_template()) {
         $got_template = 'Single';
     } elseif ($template == get_page_template()) {
         $got_template = 'Page';
     } elseif ($template == get_category_template()) {
         $got_template = 'Category';
     } elseif ($template == get_tag_template()) {
         $got_template = 'Tag';
     } elseif ($template == get_author_template()) {
         $got_template = 'Author';
     } elseif ($template == get_date_template()) {
         $got_template = 'Date';
     } elseif ($template == get_archive_template()) {
         $got_template = 'Archive';
     } elseif ($template == get_comments_popup_template()) {
         $got_template = 'Comments popup';
     } elseif ($template == get_paged_template()) {
         $got_template = 'Paged';
     } elseif ($template == get_index_template()) {
         $got_template = 'Index';
     } else {
         $got_template = 'Unknown';
     }
     $this->message(Colours::fg('yellow') . "Template load: " . Colours::off() . "wanted {$want_template}, got {$got_template} (" . str_replace($this->options['wp-root'] . "/wp-content/", '', $template) . ")");
     return $template;
 }