| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/themes/dt-the7/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 = sanitize_file_name( basename( (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 );
}
}