Changeset 49
- Timestamp:
- 12/17/05 19:51:08 (3 years ago)
- Files:
-
- trunk/frontend/config/app.yml (modified) (1 diff)
- trunk/frontend/config/filters.yml (modified) (1 diff)
- trunk/frontend/lib/myTagFilter.class.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/frontend/config/app.yml
r47 r49 8 8 feed: 9 9 max_questions: 10 10 11 .global: 12 universe: on trunk/frontend/config/filters.yml
r47 r49 2 2 class: myTagFilter 3 3 param: 4 active: on5 4 host_exclude_regex: /^(www|askeet)/ trunk/frontend/lib/myTagFilter.class.php
r47 r49 24 24 25 25 // execute this filter only once 26 if ( !isset($loaded))26 if (APP_UNIVERSE && !isset($loaded)) 27 27 { 28 28 // load the filter 29 29 $loaded = true; 30 30 31 if ($this->getParameter('active')) 31 // is there a tag in the hostname? 32 $request = $this->getContext()->getRequest(); 33 $hostname = $request->getHost(); 34 if (!preg_match($this->getParameter('host_exclude_regex'), $hostname) && $pos = strpos($hostname, '.')) 32 35 { 33 // have a tag in hostname? 34 $request = $this->getContext()->getRequest(); 35 $hostname = $request->getHost(); 36 if (!preg_match($this->getParameter('host_exclude_regex'), $hostname) && $pos = strpos($hostname, '.')) 37 { 38 $tag = Tag::normalize(substr($hostname, 0, $pos)); 36 $tag = Tag::normalize(substr($hostname, 0, $pos)); 39 37 40 // add a request parameter41 define('APP_PERMANENT_TAG', $tag);38 // add a permanent tag constant 39 define('APP_PERMANENT_TAG', $tag); 42 40 43 // add a custom stylesheet 44 $request->setAttribute('app/tag_filter', $tag, 'helper/asset/auto/stylesheet'); 45 } 41 // add a custom stylesheet 42 $request->setAttribute('app/tag_filter', $tag, 'helper/asset/auto/stylesheet'); 46 43 } 47 44 } … … 50 47 $filterChain->execute(); 51 48 } 52 53 /**54 * Initialize this filter.55 *56 * @param Context The current application context.57 * @param array An associative array of initialization parameters.58 *59 * @return bool true, if initialization completes successfully, otherwise false.60 *61 * @throws <b>FilterException</b> If an error occurs during initialization.62 */63 public function initialize ($context, $parameters = null)64 {65 // initialize parent66 parent::initialize($context, $parameters);67 68 return true;69 }70 49 } 71 50
