Exemple #1
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;
 }
Exemple #2
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;
 }