| Server IP : 60.247.133.247 / Your IP : 216.73.217.108 Web Server : Apache System : Linux ebs-119054 5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64 User : goodwill ( 65985) PHP Version : 8.2.20 Disable Function : link,symlink,passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server,pcntl_fork,pcntl_rfork MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/wwwroot/goodwill/wwwroot/wp-content/themes/GoodWill/inc/ |
Upload File : |
<?php
/**
* The7 template manager.
*
* @package The7
*/
defined( 'ABSPATH' ) || exit;
/**
* Class The7_Template_Manager
*/
class The7_Template_Manager {
protected $templates_path;
public function __construct() {
$this->templates_path = array();
}
public function get_template_part( $interface, $slug, $name = null, $args = array() ) {
do_action( "get_template_part_{$slug}", $slug, $name );
$template_names = $this->get_template_names( $interface, $slug, $name );
return $this->locate_template( $template_names, $args, true, false );
}
public function locate_template( $template_names, $args = array(), $load = false, $require_once = true ) {
$located = apply_filters( 'presscore_template_manager_located_template', $this->_locate_template( $template_names ), $template_names );
if ( $load && '' != $located ) {
return $this->load_template( $located, $args, $require_once );
}
return $located;
}
public function load_template( $_template_file, $args = array(), $require_once = true ) {
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
if ( isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ){
extract( $wp_query->query_vars, EXTR_SKIP );
}
extract( $args, EXTR_SKIP );
if ( $require_once ) {
return require_once $_template_file;
} else {
return require $_template_file;
}
}
public function add_path( $interface, $path ) {
$path = is_array( $path ) ? $path : array( $path );
$this->templates_path[ $interface ] = array_map( array( $this, 'sanitize_path' ), $path );
}
public function remove_path( $interface ) {
unset( $this->templates_path[ $interface ] );
}
public function get_path( $interface ) {
return ( isset( $this->templates_path[ $interface ] ) ? $this->templates_path[ $interface ] : array() );
}
protected function sanitize_path( $path ) {
return ltrim( trailingslashit( $path ), '\/' );
}
protected function get_template_names( $interface, $slug, $name = null ) {
$templates = array();
$name = (string) $name;
if ( isset( $this->templates_path[ $interface ] ) ) {
foreach ( $this->templates_path[ $interface ] as $path ) {
if ( '' !== $name ) {
$templates[] = "{$path}{$slug}-{$name}.php";
}
$templates[] = "{$path}{$slug}.php";
}
}
return $templates;
}
protected function _locate_template( $templates ) {
return locate_template( $templates, false );
}
}