Esempio n. 1
0
 /**
  * Returns a specified value or all values.
  *
  * @param   string|null $spec
  * @return  mixed|array
  */
 public function getAssign($spec = null)
 {
     if ($this->template !== null) {
         return $this->template->getTemplateVars($spec);
     }
     return $this->engine->getTemplateVars($spec);
 }
 /**
  * Iterate all template and config variables of the given template object and write them
  * into the internal log object.
  *
  * @param \Enlight_Template_Default|\Enlight_Template_Manager $template
  */
 public function logTemplate($template)
 {
     $template_name = isset($template->template_resource) ? $template->template_resource : 'Global';
     $template_name = $this->encode($template_name, 30);
     $template_vars = (array) $template->getTemplateVars();
     unset($template_vars['smarty']);
     if (!empty($template_vars)) {
         $rows = array(array('spec', 'value'));
         foreach ($template_vars as $template_spec => $template_var) {
             $template_var = $this->encode($template_var);
             $rows[] = array($template_spec, $template_var);
         }
         $table = array('Template Vars > ' . $template_name . ' (' . count($template_vars) . ')', $rows);
         try {
             $this->results[] = $table;
         } catch (Exception $e) {
             die((string) $e);
         }
     }
     $config_vars = (array) $template->getConfigVars();
     if (!empty($config_vars)) {
         $rows = array(array('spec', 'value'));
         foreach ($config_vars as $config_spec => $config_var) {
             $rows[] = array($config_spec, $config_var);
         }
         $table = array('Config Vars > ' . $template_name . ' (' . count($config_vars) . ')', $rows);
         $this->results[] = $table;
     }
 }
Esempio n. 3
0
 /**
  * Returns a specified value or all values.
  *
  * @param   string|null $spec
  * @return  mixed|array
  */
 public function getAssign($spec = null)
 {
     return $this->template->getTemplateVars($spec);
 }