PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.2.4
Filter Everything — WordPress & WooCommerce Filters v1.2.4
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 1.2.4, at src/TemplateManager.php

54 lines 1.1 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('WPINC') ) {
6 wp_die();
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 if( file_exists( $file ) ){
29 extract( $variables );
30 include $file;
31 }
32
33 }
34
35 public function includeFrontView( $path, $variables = [] )
36 {
37 $file = locate_template( array( FLRT_TEMPLATES_DIR_NAME . '/' . $path . '.php') );
38
39 if( '' === $file ){
40 $file = $this->pluginRootDir . 'views/frontend/' . $path . '.php';
41 }
42
43 if( file_exists( $file ) ){
44 extract( $variables );
45 include $file;
46 }
47 }
48
49 public function locateTemplate( $path )
50 {
51
52 }
53
54 }