protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options)) {
         return false;
     }
     if (isset($options['cache_root']) && is_string($options['cache_root'])) {
         $options['cache_root'] = array($options['cache_root']);
     }
     if (isset($options['compiled_root']) && is_string($options['compiled_root'])) {
         $options['compiled_root'] = array($options['compiled_root']);
     }
     return true;
 }
Beispiel #2
0
 /**
  * Check the options
  *
  * Builds an unique 'id' from the 'path' option (required).
  * It also checks for the template engine definition and
  * builds the template path, by checking its existence inside
  * "template_root" directory before and in "fallback_root" after.
  *
  * @param  array &$options Properties values
  * @return bool            true on success or false on error
  */
 protected static function checkOptions(&$options)
 {
     if (!isset($options['engine'])) {
         $options['engine'] =& TIP_Application::getGlobal('engine');
     }
     if (!isset($options['path']) || !$options['engine'] instanceof TIP_Template_Engine) {
         return false;
     }
     $path =& $options['path'];
     $engine =& $options['engine'];
     if (is_null($path = $engine->getTemplatePath($path))) {
         return false;
     }
     $options['id'] = implode(DIRECTORY_SEPARATOR, $path);
     return parent::checkOptions($options);
 }
Beispiel #3
0
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options) || !isset($options['master'])) {
         return false;
     }
     if (is_string($options['master'])) {
         $options['master'] =& TIP_Type::getInstance($options['master']);
     } elseif (is_array($options['master'])) {
         $options['master'] =& TIP_Type::singleton($options['master']);
     }
     if (!$options['master'] instanceof TIP_Content) {
         return false;
     }
     isset($options['action']) || ($options['action'] = 'view,-id-');
     return true;
 }
Beispiel #4
0
 /**
  * Check the options
  *
  * Overridable static method that checks $options for missing or invalid
  * values and eventually corrects its content.
  *
  * @param  array &$options Properties values
  * @return bool            true on success or false on error
  */
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options)) {
         return false;
     }
     TIP::requiredOption($options, 'engine');
     TIP::requiredOption($options, 'anonymous_privilege', TIP_PRIVILEGE_NONE);
     TIP::requiredOption($options, 'default_privilege', TIP_PRIVILEGE_NONE);
     if (is_string($options['engine'])) {
         $options['engine'] =& TIP_Type::singleton(array('type' => array('template_engine', $options['engine'])));
     } elseif (is_array($options['engine'])) {
         $options['engine'] =& TIP_Type::singleton($options['engine']);
     }
     if (!$options['engine'] instanceof TIP_Template_Engine) {
         return false;
     }
     isset($options['locale_prefix']) || ($options['locale_prefix'] = end($options['type']));
     return true;
 }
Beispiel #5
0
 /**
  * Check the options
  *
  * Overridable static method that checks $options for missing or invalid
  * values and eventually corrects its content.
  *
  * @param  array &$options Properties values
  * @return bool            true on success or false on error
  */
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options) || !isset($options['path'])) {
         return false;
     }
     TIP::requiredOption($options, 'data_engine');
     if (is_string($options['data_engine'])) {
         $options['engine'] =& TIP_Type::singleton(array('type' => array('data_engine', $options['data_engine'])));
     } elseif (is_array($options['data_engine'])) {
         $options['engine'] =& TIP_Type::singleton($options['data_engine']);
     } else {
         $options['engine'] =& $options['data_engine'];
     }
     unset($options['data_engine']);
     if (!$options['engine'] instanceof TIP_Data_Engine) {
         return false;
     }
     // Forced overriding of the default id ('data')
     $options['id'] = $options['engine']->getProperty('id') . ':' . $options['path'];
     isset($options['fieldset']) && ($options['id'] .= '(' . implode(',', $options['fieldset']) . ')');
     return true;
 }