Changeset 47

Show
Ignore:
Timestamp:
12/17/05 11:40:24 (3 years ago)
Author:
fabien
Message:

moved the filter configuration into filters.yml configuration file

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/frontend/config/app.yml

    r42 r47  
    88  feed: 
    99    max_questions:       10 
    10  
    11   .global: 
    12     host_exclude_regex:  /^(www|askeet)/ 
  • trunk/frontend/config/filters.yml

    r40 r47  
    11myTagFilter: 
    22  class: myTagFilter 
     3  param: 
     4    active:             on 
     5    host_exclude_regex: /^(www|askeet)/ 
  • trunk/frontend/lib/myTagFilter.class.php

    r40 r47  
    2929      $loaded = true; 
    3030 
    31       // have a tag in hostname? 
    32       $request  = $this->getContext()->getRequest(); 
    33       $hostname = $request->getHost(); 
    34       if (!preg_match(APP_HOST_EXCLUDE_REGEX, $hostname) && $pos = strpos($hostname, '.')) 
     31      if ($this->getParameter('active')) 
    3532      { 
    36         $tag = Tag::normalize(substr($hostname, 0, $pos)); 
     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)); 
    3739 
    38         // add a request parameter 
    39         define('APP_PERMANENT_TAG', $tag); 
     40          // add a request parameter 
     41          define('APP_PERMANENT_TAG', $tag); 
    4042 
    41         // add a custom stylesheet 
    42         $request->setAttribute('app/tag_filter', $tag, 'helper/asset/auto/stylesheet'); 
     43          // add a custom stylesheet 
     44          $request->setAttribute('app/tag_filter', $tag, 'helper/asset/auto/stylesheet'); 
     45        } 
    4346      } 
    4447    }