Ejemplo n.º 1
0
 /**
  * Section template.
  */
 function section_template()
 {
     if (pl_is_static_template('sec template')) {
         global $pl_static_template_output;
         $binding = "plclassname: [ (tplwrap() == 'wrapped') ? 'pl-content-area' : '' ]";
         printf('<div class="pl-page-content" data-bind="%s">%s</div>', $binding, $pl_static_template_output);
     }
 }
Ejemplo n.º 2
0
 /**
  * Get all information related to drawing a page.
  * Includes sections, data, and their model keys
  * @return array uniqueIDs, Data, option keys for model
  */
 function get_view_model()
 {
     $view_model = $this->list['sections'];
     foreach ($view_model as $uid => &$info) {
         // Dont need the data added below
         unset($info['data']);
         $info['values'] = array('type' => '', 'value' => '', 'opts' => '');
         $defaults = isset($this->factory[$info['object']]) ? $this->factory[$info['object']]->section_defaults() : array();
         $data = isset($this->sections_data[$uid]) ? $this->sections_data[$uid] : $defaults;
         $modelized_data = pl_defaults_model($data);
         $keys = array();
         $opts = array();
         if (pl_is_static_template('viewmodel') && $info['object'] == 'PL_Content') {
             $opts = pl_get_template_settings();
         } elseif (isset($this->factory[$info['object']])) {
             $opts = $this->factory[$info['object']]->section_opts();
         }
         $keys = $this->recursive_parse_opts($opts, $data);
         /** Parse together for standard section options which aren't in array */
         $info['values'] = wp_parse_args($keys, $modelized_data);
         $info = apply_filters('pl_model_' . $info['object'], $info);
     }
     unset($info);
     // set by reference
     if (isset($view_model[''])) {
         unset($view_model['']);
     }
     return $view_model;
 }
Ejemplo n.º 3
0
 function __construct()
 {
     global $pl_static_template_output;
     global $pl_running_integration;
     $pl_static_template_output = false;
     add_action('pl_start_template', array($this, 'do_footer'));
     /** Capture template and output in content */
     if (pl_is_static_template('int')) {
         add_action('pl_start_template', array($this, 'start_new_integration'));
         add_action('pl_after_template', array($this, 'get_integration_output'));
     }
 }