Пример #1
0
 function display()
 {
     $loki = new Loki2($this->name, $this->value, $this->_resolve_widgets($this->widgets));
     if (!empty($this->paths['image_feed'])) {
         $loki->set_feed('images', $this->paths['image_feed']);
     }
     if (!empty($this->paths['site_feed'])) {
         $loki->set_feed('sites', $this->paths['site_feed']);
     }
     if (!empty($this->paths['finder_feed'])) {
         $loki->set_feed('finder', $this->paths['finder_feed']);
     }
     if (!empty($this->paths['default_site_regexp'])) {
         $loki->set_default_site_regexp($this->paths['default_site_regexp']);
     }
     if (!empty($this->paths['default_type_regexp'])) {
         $loki->set_default_type_regexp($this->paths['default_type_regexp']);
     }
     if (!empty($this->paths['css'])) {
         $loki->add_document_style_sheets($this->paths['css']);
     }
     if (!empty($this->allowable_tags)) {
         $loki->set_allowable_tags($this->allowable_tags);
     }
     if (!empty($this->crash_report_uri)) {
         $loki->set_crash_report_uri($this->crash_report_uri);
     }
     $loki->print_form_children($this->rows, $this->cols);
 }
Пример #2
0
 /**
  * Gets the paths/URLs that loki needs in a format that plasmature can use
  *
  * returns an array with the following keys:
  *  -- site_feed (the URL of the feed that lists sites available, and contains the URLs of the feeds for their types)
  *  -- finder_feed (the URL of the feed that will provide the URLs of the site and type feeds that point to a given URL passed in the query string)
  *  -- image_feed (the URL of the feed that lists images in the site, and their URLs)
  *  -- default_site_regexp (a js-style regex that will find the current site's type feed URL in the site feed)
  *  -- default_type_regexp (a js-style regex thatr will find the page type in a type feed)
  *
  * @param int $site_id The id of the current site
  * @return array $paths
  * @access private
  *
  * @author Matt Ryan
  * @date 2006-09-21
  */
 function _get_paths($site_id)
 {
     include_once 'paths.php';
     if (file_exists(LOKI_2_INC . 'loki.php')) {
         include_once LOKI_2_INC . 'loki.php';
     } else {
         trigger_error('Loki 2 file structure has changed slightly. Please update LOKI_2_INC in package_settings.php to reference the ' . LOKI_2_INC . '/helpers/php/ directory.');
         include_once LOKI_2_INC . '/helpers/php/loki.php';
     }
     $paths = array();
     $id_of_site_type = id_of('site');
     $paths['site_feed'] = FEED_GENERATOR_STUB_PATH . '?type_id=' . $id_of_site_type . '&site_id=' . id_of('master_admin') . '&feed=editor_sites&site_context=' . $site_id;
     $paths['finder_feed'] = FEED_GENERATOR_STUB_PATH . '?type_id=' . $id_of_site_type . '&feed=editor_feed_finder&site_context=' . $site_id;
     $loki_obj = new Loki2('temp');
     if (!empty($site_id)) {
         $paths['image_feed'] = FEED_GENERATOR_STUB_PATH . '?type_id=' . id_of('image') . '&feed=images&site_id=' . $site_id;
         $paths['default_site_regexp'] = $loki_obj->js_regexp_quote('//' . REASON_HOST . FEED_GENERATOR_STUB_PATH . '?type_id=' . id_of('type') . '&site_id=' . $site_id) . '[$&]';
     } else {
         $paths['image_feed'] = '';
         $paths['default_site_regexp'] = '';
         trigger_error('No site id passed to get_loki_paths');
     }
     $paths['default_type_regexp'] = $loki_obj->js_regexp_quote('//' . REASON_HOST . FEED_GENERATOR_STUB_PATH . '?type_id=' . id_of('minisite_page') . '&site_id=') . '[^&]*' . $loki_obj->js_regexp_quote('&feed=editor_links_for_minisite_page');
     $css = array();
     if (defined('UNIVERSAL_CSS_PATH') && UNIVERSAL_CSS_PATH) {
         $css[] = UNIVERSAL_CSS_PATH;
     }
     if (defined('REASON_LOKI_CSS_FILE') && REASON_LOKI_CSS_FILE) {
         $css[] = REASON_LOKI_CSS_FILE;
     }
     if (!empty($css)) {
         $paths['css'] = $css;
     }
     return $paths;
 }