5 if ( ! defined(
'GRAVITYVIEW_DIR' ) ) {
14 if ( ! class_exists(
'\GV\Gamajo_Template_Loader' ) ) {
15 require
gravityview()->plugin->dir(
'future/lib/class-gamajo-template-loader.php' );
24 abstract class Template extends \GV\Gamajo_Template_Loader {
29 private static $data_stack = array();
34 public $located_template =
'';
43 $this->plugin_directory =
gravityview()->plugin->dir();
68 $dir_name = ( dirname( $slug ) !=
'.' ) ? trailingslashit( dirname( $slug ) ) :
'';
69 $slug_name = basename( $slug ) . (
$name ?
"-$name" :
'' );
71 return array( $dir_name, $slug_name );
90 if ( ! isset( self::$data_stack[ $var_name ] ) ) {
91 self::$data_stack[ $var_name ] = array();
96 if ( isset( $wp_query->query_vars[ $var_name ] ) ) {
97 array_push( self::$data_stack[ $var_name ], $wp_query->query_vars[ $var_name ] );
100 $this->set_template_data( $data, $var_name );
116 if ( ! empty( self::$data_stack[ $var_name ] ) ) {
117 $this->set_template_data( array_pop( self::$data_stack[ $var_name ] ), $var_name );
__destruct()
Disallow any cleanup for fear of loss of global data.
static split_slug( $slug, $name=null)
Get a directory part and a full slug+name (file) components.
push_template_data( $data, $var_name='data')
Push the current template data down the stack and set.
If this file is called directly, abort.
__construct()
General template initialization.
gravityview()
The main GravityView wrapper function.
pop_template_data( $var_name='data')
Restore the template data from the stack.