Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
home
/
getwphos
/
www
/
dumpsterbm
/
wp-content
/
plugins
/
tatsu
/
includes
/
File Content:
class-tatsu-post-templates.php
<?php /** * Handles Post templates added by tatsu * @source https://github.com/wpexplorer/page-templater/blob/master/pagetemplater.php */ class Tatsu_Post_Templates { private static $instance; private $templates; public static function getInstance() { if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } public function __construct() { $this->templates = array(); } public function init() { $this->templates = apply_filters( 'tatsu_post_templates', array( 'page' => array ( 'blank.php' => esc_html__('Tatsu Template', 'tatsu') ), 'post' => array ( 'blank.php' => esc_html__('Tatsu Template', 'tatsu'), ) ) ); if ( !version_compare( floatval( get_bloginfo( 'version' ) ), '4.7', '<' ) ) { foreach( $this->templates as $post_type => $templates ) { add_filter( "theme_{$post_type}_templates", array( $this, 'add_new_template' ), 10, 4 ); } add_filter( 'wp_insert_post_data', array( $this, 'register_project_templates' ) ); add_filter( 'template_include', array( $this, 'view_project_template') ); } } public function add_new_template( $posts_templates, $theme, $post, $post_type ) { if( array_key_exists( $post_type, $this->templates ) ) { $posts_templates = array_merge( $posts_templates, $this->templates[$post_type] ); } return $posts_templates; } public function register_project_templates( $atts ) { $post_type = tatsu_admin_get_post_type(); if( !is_array( $this->templates ) || !array_key_exists( $post_type, $this->templates ) ) { return $atts; } $cache_key = 'post_templates-' . md5( get_theme_root() . '/' . get_stylesheet() ); $current_cache = wp_cache_get( $cache_key, 'themes' ); if( empty( $current_cache ) ) { $current_cache = array(); } if( !array_key_exists( $post_type, $current_cache ) ) { $current_cache[$post_type] = array(); } $new_cache = $current_cache; wp_cache_delete( $cache_key , 'themes'); $new_cache[$post_type] = array_merge( $current_cache[$post_type], $this->templates[$post_type] ); wp_cache_add( $cache_key, $new_cache, 'themes', 1800 ); return $atts; } public function view_project_template( $template ) { global $post; if ( is_search() ) { return $template; } if ( ! $post ) { return $template; } $post_type = get_post_type(); $current_template = get_post_meta( $post->ID, '_wp_page_template', true ); if ( ! isset( $this->templates[$post_type] ) || ! isset( $this->templates[$post_type][ $current_template ] ) ) { return $template; } $folder_path = apply_filters( "tatsu_{$post_type}_folder_path", plugin_dir_path( __FILE__ ) . 'templates/' ); $file = $folder_path . $current_template; if ( file_exists( $file ) ) { return $file; } else { echo $file; } return $template; } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
colorhub
---
0755
colors
---
0755
concepts
---
0755
demo-import
---
0755
footer-builder
---
0755
header-builder
---
0755
helpers
---
0755
icons
---
0755
integrations
---
0755
modules
---
0755
rest_api
---
0755
templates
---
0755
typehub
---
0755
class-tatsu-activator.php
1216 bytes
0644
class-tatsu-colors.php
2064 bytes
0644
class-tatsu-config.php
17720 bytes
0644
class-tatsu-content-parser.php
13190 bytes
0644
class-tatsu-deactivator.php
687 bytes
0644
class-tatsu-forms-process.php
10934 bytes
0644
class-tatsu-global-module-options.php
1574 bytes
0644
class-tatsu-global-section-meta.php
970 bytes
0644
class-tatsu-i18n.php
899 bytes
0644
class-tatsu-icons.php
2049 bytes
0644
class-tatsu-integrations.php
13786 bytes
0644
class-tatsu-loader.php
4865 bytes
0644
class-tatsu-post-templates.php
3641 bytes
0644
class-tatsu-svgs.php
1030 bytes
0644
class-tatsu-theme-support.php
2276 bytes
0644
class-tatsu.php
32953 bytes
0644
customizer-controls.php
2284 bytes
0644
global-section-metas.php
662 bytes
0644
index.php
26 bytes
0644
N4ST4R_ID | Naxtarrr