Changeset 49

Show
Ignore:
Timestamp:
12/17/05 19:51:08 (3 years ago)
Author:
fabien
Message:

changes for day 18

Files:

Legend:

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

    r47 r49  
    88  feed: 
    99    max_questions:       10 
     10 
     11  .global: 
     12    universe:            on 
  • trunk/frontend/config/filters.yml

    r47 r49  
    22  class: myTagFilter 
    33  param: 
    4     active:             on 
    54    host_exclude_regex: /^(www|askeet)/ 
  • trunk/frontend/lib/myTagFilter.class.php

    r47 r49  
    2424 
    2525    // execute this filter only once 
    26     if (!isset($loaded)) 
     26    if (APP_UNIVERSE && !isset($loaded)) 
    2727    { 
    2828      // load the filter 
    2929      $loaded = true; 
    3030 
    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, '.')) 
    3235      { 
    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)); 
    3937 
    40           // add a request parameter 
    41           define('APP_PERMANENT_TAG', $tag); 
     38        // add a permanent tag constant 
     39        define('APP_PERMANENT_TAG', $tag); 
    4240 
    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'); 
    4643      } 
    4744    } 
     
    5047    $filterChain->execute(); 
    5148  } 
    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 parent 
    66     parent::initialize($context, $parameters); 
    67  
    68     return true; 
    69   } 
    7049} 
    7150