Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CFilter
  • CFilterChain
  • CHttpCacheFilter
  • CInlineFilter
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * CInlineFilter class file.
 4:  *
 5:  * @author Qiang Xue <qiang.xue@gmail.com>
 6:  * @link http://www.yiiframework.com/
 7:  * @copyright 2008-2013 Yii Software LLC
 8:  * @license http://www.yiiframework.com/license/
 9:  */
10: 
11: /**
12:  * CInlineFilter represents a filter defined as a controller method.
13:  *
14:  * CInlineFilter executes the 'filterXYZ($action)' method defined
15:  * in the controller, where the name 'XYZ' can be retrieved from the {@link name} property.
16:  *
17:  * @author Qiang Xue <qiang.xue@gmail.com>
18:  * @package system.web.filters
19:  * @since 1.0
20:  */
21: class CInlineFilter extends CFilter
22: {
23:     /**
24:      * @var string name of the filter. It stands for 'XYZ' in the filter method name 'filterXYZ'.
25:      */
26:     public $name;
27: 
28:     /**
29:      * Creates an inline filter instance.
30:      * The creation is based on a string describing the inline method name
31:      * and action names that the filter shall or shall not apply to.
32:      * @param CController $controller the controller who hosts the filter methods
33:      * @param string $filterName the filter name
34:      * @return CInlineFilter the created instance
35:      * @throws CException if the filter method does not exist
36:      */
37:     public static function create($controller,$filterName)
38:     {
39:         if(method_exists($controller,'filter'.$filterName))
40:         {
41:             $filter=new CInlineFilter;
42:             $filter->name=$filterName;
43:             return $filter;
44:         }
45:         else
46:             throw new CException(Yii::t('yii','Filter "{filter}" is invalid. Controller "{class}" does not have the filter method "filter{filter}".',
47:                 array('{filter}'=>$filterName, '{class}'=>get_class($controller))));
48:     }
49: 
50:     /**
51:      * Performs the filtering.
52:      * This method calls the filter method defined in the controller class.
53:      * @param CFilterChain $filterChain the filter chain that the filter is on.
54:      */
55:     public function filter($filterChain)
56:     {
57:         $method='filter'.$this->name;
58:         $filterChain->controller->$method($filterChain);
59:     }
60: }
61: 
API documentation generated by ApiGen 2.8.0