PluginProbe
Filter Everything — WordPress & WooCommerce Filters / trunk
Filter Everything — WordPress & WooCommerce Filters vtrunk
1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 All 51 releases
filter-everything / src / TemplateManager.php

TemplateManager.php in Filter Everything — WordPress & WooCommerce Filters trunk, at src/TemplateManager.php

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FilterEverything\Filter;
4
5 if ( ! defined('ABSPATH') ) {
6 exit;
7 }
8
9 class TemplateManager
10 {
11 private $pluginRootDir;
12
13 private $themeRootDir;
14
15 private $pluginUrl;
16
17 public function __construct( $pluginFilePath )
18 {
19 $this->pluginRootDir = $pluginFilePath;
20 $this->pluginUrl = plugin_dir_url( $pluginFilePath );
21 $this->themeRootDir = get_stylesheet_directory();
22 }
23
24 public function includeAdminView( $path, array $variables = [] )
25 {
26 $file = $this->pluginRootDir . 'views/admin/' . $path . '.php';
27
28 $file = apply_filters( 'wpc_include_admin_view', $file, $path, $variables );
29
30 if( file_exists( $file ) ){
31 extract( $variables );
32 include $file;
33 }
34
35 }
36
37 public function includeFrontView( $path, $variables = [] )
38 {
39 $file = locate_template( array( FLRT_TEMPLATES_DIR_NAME . '/' . $path . '.php') );
40
41 if( '' === $file ){
42 $file = $this->pluginRootDir . 'views/frontend/' . $path . '.php';
43 }
44
45 $file = apply_filters( 'wpc_include_front_view', $file, $path, $variables );
46
47 if( file_exists( $file ) ){
48 extract( $variables );
49 include $file;
50 }
51 }
52 }