コード例 #1
0
ファイル: showThemeFile.php プロジェクト: jtomeck/jtwebfolio
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;
    }
}
コード例 #2
0
 function redirect_expired()
 {
     global $wp_query;
     if (is_singular()) {
         if ('expired' == $wp_query->post->post_status) {
             if (function_exists('is_syndicated') and is_syndicated($wp_query->post->ID)) {
                 $source = get_syndication_feed_object($wp_query->post->ID);
                 $redirect_url = $source->setting('expired post redirect to', 'expired_post_redirect_to', NULL);
             } else {
                 $redirect_url = get_option('feedwordpress_expired_post_redirect_to', NULL);
             }
             if (!is_null($redirect_url) and strlen(esc_url($redirect_url)) > 0 and 'none' != $redirect_url) {
                 header("HTTP/1.1 301 Moved Permanently");
                 header("Location: " . $redirect_url);
             } else {
                 // Meh.
                 if (!($template = get_404_template())) {
                     $template = get_index_template();
                 }
                 if ($template = apply_filters('template_include', $template)) {
                     header("HTTP/1.1 410 Gone");
                     include $template;
                 }
             }
             exit;
         }
     }
 }
コード例 #3
0
 /**
  * Launch and display the 404 page depending upon the template
  *
  * @param   void
  * @return  void
  **/
 public function throw404()
 {
     // Change WP Query
     global $wp_query;
     $wp_query->set_404();
     status_header(404);
     // Disable that pesky Admin Bar
     add_filter('show_admin_bar', '__return_false', 900);
     remove_action('admin_footer', 'wp_admin_bar_render', 10);
     remove_action('wp_head', 'wp_admin_bar_header', 10);
     remove_action('wp_head', '_admin_bar_bump_cb', 10);
     wp_dequeue_script('admin-bar');
     wp_dequeue_style('admin-bar');
     // Template
     $four_tpl = apply_filters('LD_404', get_404_template());
     // Handle the admin bar
     @define('APP_REQUEST', TRUE);
     @define('DOING_AJAX', TRUE);
     if (empty($four_tpl) or !file_exists($four_tpl)) {
         // We're gonna try and get TwentyTen's one
         $twenty_ten_tpl = apply_filters('LD_404_FALLBACK', WP_CONTENT_DIR . '/themes/twentyfourteen/404.php');
         if (file_exists($twenty_ten_tpl)) {
             require $twenty_ten_tpl;
         } else {
             wp_die('404 - File not found!', '', array('response' => 404));
         }
     } else {
         // Their theme has a template!
         require $four_tpl;
     }
     // Either way, it's gonna stop right here.
     exit;
 }
コード例 #4
0
 private static function get_404_template()
 {
     if (!($template = get_404_template())) {
         $template = get_index_template();
     }
     return $template;
 }
コード例 #5
0
 /**
  * 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;
 }
コード例 #6
0
 static function login_to_notfound()
 {
     if (isset($_REQUEST['logout'])) {
         return;
     }
     if (preg_match('/wp-login.php/', $_SERVER['REQUEST_URI'])) {
         if ($_REQUEST['action'] == 'register' || $_REQUEST['action'] == 'login') {
             $template = get_404_template();
             include $template;
             exit;
         }
     }
 }
コード例 #7
0
ファイル: security.php プロジェクト: danielcoats/schoolpress
 /**
  * Sets a 404 error for wp-login.php if it's disabled
  *
  * @since 6.3
  * @access public
  */
 public function init()
 {
     global $wp_query, $pagenow;
     if ('wp-login.php' == $pagenow && $this->get_option('private_login')) {
         $pagenow = 'index.php';
         $wp_query->set_404();
         status_header(404);
         nocache_headers();
         if (!($template = get_404_template())) {
             $template = 'index.php';
         }
         include $template;
         exit;
     }
 }
コード例 #8
0
ファイル: theme-security.php プロジェクト: besimhu/legacy
/**
 * Function to prevent visitors without admin permissions
 * to access the wordpress backend. If you wish to permit
 * others besides admins acces, change the user_level
 * to a different number.
 *
 * http://codex.wordpress.org/Roles_and_Capabilities#level_8
 *
 * @global <type> $user_level
 *
 * in order to use this for wpmu, you need to follow the comment
 * instructions below in all locations and make the changes
 */
function jr_security_check()
{
    $jr_access_level = get_option('jr_admin_security');
    if (!isset($jr_access_level) || $jr_access_level == '') {
        $jr_access_level = 'read';
    }
    // if there's no value then give everyone access
    if (!current_user_can($jr_access_level)) {
        // comment out the above two lines and uncomment this line if you are using
        // wpmu and want to block back office access to everyone except admins
        // if (!is_site_admin()) {
        status_header(404);
        nocache_headers();
        include get_404_template();
        exit;
    }
}
コード例 #9
0
ファイル: rewrites.php プロジェクト: uwitec/findgreatmaster
 /**
  * Include store template
  *
  * @param type $template
  * @return string
  */
 function store_template($template)
 {
     $store_name = get_query_var('store');
     if (!empty($store_name)) {
         $store_user = get_user_by('slug', $store_name);
         // no user found
         if (!$store_user) {
             return get_404_template();
         }
         // check if the user is seller
         if (!dokan_is_user_seller($store_user->ID)) {
             return get_404_template();
         }
         $templates = array("store-{$store_name}.php", 'store.php');
         return get_query_template('store', $templates);
     }
     return $template;
 }
コード例 #10
0
 /**
  * Pick the correct template to include
  *
  * @param string $template Path to template
  *
  * @return string Path to template
  */
 public static function templateChooser($template)
 {
     $events = Tribe__Events__Main::instance();
     do_action('tribe_tec_template_chooser', $template);
     // no non-events need apply
     if (!tribe_is_event_query()) {
         return $template;
     }
     // if it's a single 404 event
     if (is_single() && is_404()) {
         return get_404_template();
     }
     if (!is_single() && !tribe_events_is_view_enabled($events->displaying) && 'day' != $events->displaying) {
         return get_404_template();
     }
     // add the theme slug to the body class
     add_filter('body_class', array(__CLASS__, 'theme_body_class'));
     // add the template name to the body class
     add_filter('body_class', array(__CLASS__, 'template_body_class'));
     // user has selected a page/custom page template
     if (tribe_get_option('tribeEventsTemplate', 'default') != '') {
         if (!is_single() || !post_password_required()) {
             add_action('loop_start', array(__CLASS__, 'setup_ecp_template'));
         }
         $template = locate_template(tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default'));
         if ($template == '') {
             $template = get_index_template();
         }
         // remove singular body class if sidebar-page.php
         if ($template == get_stylesheet_directory() . '/sidebar-page.php') {
             add_filter('body_class', array(__CLASS__, 'remove_singular_body_class'));
         } else {
             add_filter('body_class', array(__CLASS__, 'add_singular_body_class'));
         }
     } else {
         $template = self::getTemplateHierarchy('default-template');
     }
     // if this is an oembed, override the wrapping template and use the embed template
     if (Tribe__Templates::is_embed()) {
         $template = self::getTemplateHierarchy('embed');
     }
     self::$template = $template;
     return $template;
 }
コード例 #11
0
/**
 * Function to prevent visitors without admin permissions
 * to access the wordpress backend. If you wish to permit
 * others besides admins acces, change the user_level
 * to a different number.
 *
 * http://codex.wordpress.org/Roles_and_Capabilities#level_8
 *
 * @global <type> $user_level
 *
 * in order to use this for wpmu, you need to follow the comment
 * instructions below in all locations and make the changes
 */
function colabs_security_check()
{
    // secure the backend for non ajax calls
    if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) != 'admin-ajax.php') {
        $colabs_access_level = get_option('colabs_admin_security');
    }
    if (!isset($colabs_access_level) || $colabs_access_level == '') {
        $colabs_access_level = 'read';
    }
    // if there's no value then give everyone access
    if (is_user_logged_in() && !current_user_can($colabs_access_level)) {
        // comment out the above two lines and uncomment this line if you are using
        // wpmu and want to block back office access to everyone except admins
        // if (!is_site_admin()) {
        status_header(404);
        nocache_headers();
        include get_404_template();
        exit;
    }
}
コード例 #12
0
/**
 * Load the 404 Not Found error page and display it (optional)
 *
 * @param bool $redirect Redirect browser to the page?
 * @param bool $display Display the page?
 * @since WP_Basic_Bootstrap 1.0
 */
function set_error_404($redirect = true, $display = false)
{
    /* @var $wp_query \WP_Query */
    global $wp_query;
    $wp_query->set_404();
    $status = basicbootstrap_get_status();
    if ($redirect && $status != 404) {
        wp_redirect(site_url('?error=404'));
    } elseif ($display) {
        status_header(404);
        nocache_headers();
        $tpl = get_404_template();
        if (!empty($tpl)) {
            include $tpl;
        } else {
            echo '<p>Page not found!</p>';
        }
        exit;
    }
}
コード例 #13
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);
        }
    }
}
コード例 #14
0
 /**
  * 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;
 }
コード例 #15
0
ファイル: show-template.php プロジェクト: ksolomon/Solo-Frame
 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);
 }
コード例 #16
0
ファイル: MainController.php プロジェクト: ycms/module-main
 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;
     }
 }
コード例 #17
0
 /**
  * Ends the request with a 404 (Not Found) HTTP status code. Loads the 404 template if it exists.
  */
 private static function die_404()
 {
     global $wp_query;
     status_header(404);
     $wp_query->set_404();
     $template_path = get_404_template();
     if (file_exists($template_path)) {
         require_once $template_path;
     }
     die;
 }
コード例 #18
0
 static function aiowps_set_404()
 {
     global $wp_query;
     status_header(404);
     $wp_query->set_404();
     if ((($template = get_404_template()) || ($template = get_index_template())) && ($template = apply_filters('template_include', $template))) {
         include $template;
     }
     die;
 }
コード例 #19
0
ファイル: theme.php プロジェクト: Benrajalu/philRaj
 /**
  * @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());
         }
     }
 }
コード例 #20
0
 /**
  * Loads theme files in appropriate hierarchy: 1) child theme,
  * 2) parent template, 3) plugin resources. will look in the events/
  * directory in a theme and the views/ directory in the plugin
  *
  * @param string $template template file to search for
  * @param array $args additional arguments to affect the template path
  *  - subfolder
  *  - namespace
  *  - plugin_path
  *  - disable_view_check - bypass the check to see if the view is enabled
  * @return template path
  * @author Matt Wiebe
  **/
 public static function getTemplateHierarchy($template, $args = array())
 {
     if (!is_array($args)) {
         $args = array();
         $passed = func_get_args();
         $backwards_map = array('subfolder', 'namespace', 'plugin_path');
         if (count($passed > 1)) {
             for ($i = 1; $i < count($passed); $i++) {
                 $args[$backwards_map[$i - 1]] = $passed[$i];
             }
         }
     }
     $args = wp_parse_args($args, array('subfolder' => '', 'namespace' => '/', 'plugin_path' => '', 'disable_view_check' => false));
     /**
      * @var string $subfolder
      * @var string $namespace
      * @var string $pluginpath
      * @var bool $disable_view_check
      */
     extract($args);
     $tec = TribeEvents::instance();
     if (substr($template, -4) != '.php') {
         $template .= '.php';
     }
     // setup the meta definitions
     require_once $tec->pluginPath . 'public/advanced-functions/meta.php';
     // Allow base path for templates to be filtered
     $template_base_paths = apply_filters('tribe_events_template_paths', (array) TribeEvents::instance()->pluginPath);
     // backwards compatibility if $plugin_path arg is used
     if ($plugin_path && !in_array($plugin_path, $template_base_paths)) {
         $template_base_paths[] = $plugin_path;
     }
     // ensure that addon plugins look in the right override folder in theme
     $namespace = !empty($namespace) && $namespace[0] != '/' ? '/' . trailingslashit($namespace) : trailingslashit($namespace);
     // setup subfolder options
     $subfolder = !empty($subfolder) ? trailingslashit($subfolder) : $subfolder;
     $file = '';
     foreach ($template_base_paths as $template_base_path) {
         if ($theme_file = locate_template(array('tribe-events' . $namespace . $subfolder . $template), false, false)) {
             $file = $theme_file;
         } else {
             // protect from concat folder with filename
             $subfolder = empty($subfolder) ? trailingslashit($subfolder) : $subfolder;
             $subfolder = $subfolder[0] != '/' ? '/' . $subfolder : $subfolder;
             $file = $template_base_path . 'views' . $subfolder . $template;
             // echo $file;
         }
         if (!$disable_view_check && in_array($tec->displaying, tribe_events_disabled_views())) {
             $file = get_404_template();
         }
         $file = apply_filters('tribe_events_template', $file, $template);
         // return the first one found
         if (file_exists($file)) {
             break;
         }
     }
     return apply_filters('tribe_events_template_' . $template, $file);
 }
コード例 #21
0
ファイル: wordfenceClass.php プロジェクト: ashenkar/sanga
 /**
  * Modify the query to prevent username enumeration.
  *
  * @param array $query_vars
  * @return array
  */
 public static function preventAuthorNScans($query_vars)
 {
     if (wfConfig::get('loginSec_disableAuthorScan') && !is_admin() && !empty($query_vars['author']) && is_numeric(preg_replace('/[^0-9]/', '', $query_vars['author'])) && (isset($_GET['author']) && is_numeric(preg_replace('/[^0-9]/', '', $_GET['author'])) || isset($_POST['author']) && is_numeric(preg_replace('/[^0-9]/', '', $_POST['author'])))) {
         status_header(404);
         nocache_headers();
         include get_404_template();
         exit;
     }
     return $query_vars;
 }
コード例 #22
0
ファイル: total-security.php プロジェクト: briandamage/duk-wp
 public function block_access()
 {
     $settings = $this->fdx_get_settings();
     $url = esc_url('http' . (empty($_SERVER['HTTPS']) ? '' : 's') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
     status_header(404);
     nocache_headers();
     if (!$settings['p6_url']) {
         require_once get_404_template();
     } else {
         header('Location: ' . $settings['p6_url']);
     }
     die;
 }
コード例 #23
0
 /**
  * Set a 404 error.
  *
  * Forces the given page to a WordPress 404 error.
  *
  * @since 4.0.0
  *
  * @return void
  */
 public static function set_404()
 {
     global $wp_query;
     status_header(404);
     if (function_exists('nocache_headers')) {
         nocache_headers();
     }
     $wp_query->set_404();
     $page_404 = get_404_template();
     if (1 < strlen($page_404)) {
         include $page_404;
     } else {
         include get_query_template('index');
     }
     die;
 }
コード例 #24
0
 public function wp_loaded()
 {
     global $pagenow;
     if (is_admin() && !is_user_logged_in() && !defined('DOING_AJAX')) {
         status_header(404);
         nocache_headers();
         include get_404_template();
         exit;
     }
     $request = parse_url($_SERVER['REQUEST_URI']);
     if ($pagenow === 'wp-login.php' && $request['path'] !== $this->user_trailingslashit($request['path']) && get_option('permalink_structure')) {
         wp_safe_redirect($this->user_trailingslashit($this->new_login_url()) . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''));
         die;
     } elseif ($this->wp_login_php) {
         if (($referer = wp_get_referer()) && strpos($referer, 'wp-activate.php') !== false && ($referer = parse_url($referer)) && !empty($referer['query'])) {
             parse_str($referer['query'], $referer);
             if (!empty($referer['key']) && ($result = wpmu_activate_signup($referer['key'])) && is_wp_error($result) && ($result->get_error_code() === 'already_active' || $result->get_error_code() === 'blog_taken')) {
                 wp_safe_redirect($this->new_login_url() . (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''));
                 die;
             }
         }
         $this->wp_template_loader();
     } elseif ($pagenow === 'wp-login.php') {
         global $error, $interim_login, $action, $user_login;
         @(require_once ABSPATH . 'wp-login.php');
         die;
     }
 }
コード例 #25
0
ファイル: links.php プロジェクト: jinpingv/website_wrapper
        ?>
		</div>

	</div>
	<?php 
        comments_template();
        ?>

<?php 
    }
    ?>

<?php 
} else {
    /* NO posts */
    if ('' != get_404_template()) {
        include get_404_template();
    } else {
        echo "<h3><?php _e( 'Upss, not found...', 'default' ); ?></h3>";
    }
}
?>
	
</div>

<?php 
get_sidebar();
?>

<?php 
get_footer();
                        <?php 
        }
        ?>
                        </tbody>
                    </table>
                </div>
            </div>
        <?php 
    }
    ?>
        <?php 
} else {
    ?>

            <?php 
    get_404_template();
    ?>

        <?php 
}
?>

    </div>

    <?php 
//get the right sidebar
?>
    <?php 
get_sidebar('right');
?>
コード例 #27
0
if (defined('WP_USE_THEMES') && constant('WP_USE_THEMES')) {
    do_action('template_redirect');
    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())) {
                                include $template;
                                return;
                            } else {
コード例 #28
0
if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
	if ( get_settings('gzipcompression') ) 
		gzip_compression();
}

// Template redirection
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());
コード例 #29
0
ファイル: Minify.php プロジェクト: novichkovv/candoweightloss
 /**
  * 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;
 }
コード例 #30
0
/**
 * Loads the correct template based on the visitor's url
 * @package WordPress
 */
if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
	do_action('template_redirect');
	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;