Пример #1
0
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options)) {
         return false;
     }
     isset($options['browsable_fields']) || ($options['browsable_fields'] = array(TIP_PRIVILEGE_NONE => array('__ALL__')));
     return true;
 }
Пример #2
0
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options)) {
         return false;
     }
     TIP::arrayDefault($options, 'owner_field', null);
     TIP::arrayDefault($options, 'statistics', array());
     TIP::arrayDefault($options, 'browsable_fields', array(TIP_PRIVILEGE_ADMIN => array('__ALL__')));
     return true;
 }
Пример #3
0
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options) || !isset($options['master'])) {
         return false;
     }
     isset($options['statistics']) || ($options['statistics'] = array('_onAdd' => '_comments', '_onEdit' => null, '_onDelete' => '_deleted_comments'));
     if (is_string($options['master'])) {
         $options['master'] =& TIP_Type::getInstance($options['master']);
     } elseif (is_array($options['master'])) {
         $options['master'] =& TIP_Type::singleton($options['master']);
     }
     return $options['master'] instanceof TIP_Content;
 }
Пример #4
0
 protected static function checkOptions(&$options)
 {
     if (!isset($options['locale'])) {
         return false;
     }
     // The 'data' option must be defined before calling parent::checkOptions()
     // so I can force the 'fieldset' option on the 'data' object
     isset($options['data']) || ($options['data'] = $options['id']);
     if (is_string($options['data'])) {
         $options['data'] = array('path' => TIP_Application::getGlobal('data_prefix') . $options['data'], 'fieldset' => array('id', $options['locale']));
     }
     return parent::checkOptions($options);
 }
Пример #5
0
 protected static function checkOptions(&$options)
 {
     if (!parent::checkOptions($options)) {
         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 (isset($options['master']) && !$options['master'] instanceof TIP_Content) {
         return false;
     }
     isset($options['action']) || ($options['action'] = 'browse,-id-');
     return true;
 }
Пример #6
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;
     }
     // Check if the master module has the same data engine:
     // this is required to be able to use transactions
     $master_data =& $options['master']->getProperty('data');
     $this_engine =& $options['data']->getProperty('engine');
     return $master_data->getProperty('engine') == $this_engine;
 }
Пример #7
0
 protected static function checkOptions(&$options)
 {
     if (@is_string($options['data'])) {
         $options['data'] = array('path' => $options['data']);
     }
     // The data path is a required option
     if (!@is_array($options['data']) || !isset($options['data']['path'])) {
         return false;
     }
     TIP::arrayDefault($options, 'id_type', 'string');
     TIP::arrayDefault($options['data'], 'data_engine', array('id' => 'picasa2', 'type' => array('data_engine', 'xml'), 'fields_xpath' => array('id' => 'link[contains(@rel,"#canonical")]/@href', 'title' => 'media:group/media:title[@type="plain"]', 'description' => 'media:group/media:description[@type="plain"]', 'imageurl' => 'media:group/media:content[@medium="image"]/@url', 'thumbnail' => 'media:group/media:thumbnail[3]/@url', 'thumbnail_width' => 'media:group/media:thumbnail[3]/@width', 'thumbnail_height' => 'media:group/media:thumbnail[3]/@height', 'date' => 'published', 'author' => '../author/name', 'uploader' => 'media:group/media:credit')));
     return parent::checkOptions($options);
 }
Пример #8
0
 protected static function checkOptions(&$options)
 {
     if (@is_string($options['data'])) {
         $options['data'] = array('path' => $options['data']);
     }
     // The data path is a required option
     if (!@is_array($options['data']) || !isset($options['data']['path'])) {
         return false;
     }
     TIP::arrayDefault($options, 'id_type', 'string');
     TIP::arrayDefault($options['data'], 'primary_key', 'link');
     TIP::arrayDefault($options['data'], 'data_engine', array('id' => 'devhelp2', 'type' => array('data_engine', 'xml'), 'parent_field' => 'parent', 'base_xpath' => '/book/chapters', 'row_xpath' => 'sub', 'fields_xpath' => array('link' => '@link', 'title' => '@name')));
     return parent::checkOptions($options);
 }
Пример #9
0
 protected static function checkOptions(&$options)
 {
     if (@is_string($options['data'])) {
         $options['data'] = array('path' => $options['data']);
     }
     // The data path is a required option
     if (!@is_array($options['data']) || !isset($options['data']['path'])) {
         return false;
     }
     // If the 'data' option does not start with "http://", it is
     // supposed to be a BOSS developer API and treated as such
     if (strncmp($options['data']['path'], 'http://', 7) != 0) {
         $options['data']['path'] = 'http://boss.yahooapis.com/ysearch/web/v1/{terms}' . '?format=xml&abstract=long&appid=' . $options['data']['path'];
     }
     // The TIP_XML engine used to access TIP_Boss1 modules
     // is non-reentrant and shared among multiple instances
     // (this is obtained by using the same id, 'boss1').
     TIP::arrayDefault($options['data'], 'data_engine', array('id' => 'boss1', 'type' => array('data_engine', 'xml'), 'base_xpath' => 'resultset_web', 'row_xpath' => 'result', 'fields_xpath' => array('title' => 'title', 'summary' => 'abstract', 'displayurl' => 'dispurl', 'url' => 'url', 'clickurl' => 'clickurl')));
     // Allows queries for everyone
     TIP::arrayDefault($options, 'browsable_fields', array(TIP_PRIVILEGE_NONE => array('__ALL__')));
     return parent::checkOptions($options);
 }
Пример #10
0
 protected static function checkOptions(&$options)
 {
     if (@is_string($options['data'])) {
         $options['data'] = array('path' => $options['data']);
     }
     // The data path is a required option
     if (!@is_array($options['data']) || !isset($options['data']['path'])) {
         return false;
     }
     TIP::arrayDefault($options, 'id_type', 'string');
     TIP::arrayDefault($options['data'], 'data_engine', array('id' => 'youtube2', 'type' => array('data_engine', 'xml'), 'fields_xpath' => array('id' => 'media:group/yt:videoid', 'title' => 'media:group/media:title[@type="plain"]', 'description' => 'media:group/media:description[@type="plain"]', 'swfurl' => 'media:group/media:content[@yt:format="5"]/@url', 'thumbnail120x90' => 'media:group/media:thumbnail[@width="120" and @height="90"]/@url', 'thumbnail480x360' => 'media:group/media:thumbnail[@width="480" and @height="360"]/@url', 'date' => 'media:group/yt:uploaded', 'uploader' => 'media:group/media:credit[@role="uploader"]', 'author' => 'author/name', 'duration' => 'media:group/yt:duration/@seconds', 'hits' => 'yt:statistics/@viewCount', 'favorites' => 'yt:statistics/@favoriteCount', 'rating' => 'gd:rating/@average', 'raters' => 'gd:rating/@numRaters')));
     return parent::checkOptions($options);
 }