CInlineFilter

优质
小牛编辑
124浏览
2023-12-01
所有包 | 属性 | 方法
system.web.filters
继承class CInlineFilter » CFilter » CComponent
实现IFilter
源自1.0
版本$Id: CInlineFilter.php 3026 2011-03-06 10:41:56Z haertl.mike $
源码framework/web/filters/CInlineFilter.php
CInlineFilter代表作为控制器的方法定义一个过滤器。

CInlineFilter运行那些在控制器中以’filterXYZ($action)‘这样形式定义, 名字‘XYZ’可以从name属性中读取。

公共属性

隐藏继承属性

属性类型描述定义在
namestring过滤器名字。‘XYZ’代表着‘filterXYZ’过滤方法。CInlineFilter

公共方法

隐藏继承方法

方法描述定义在
__call()如果类中没有调的方法名,则调用这个方法。CComponent
__get()返回一个属性值、一个事件处理程序列表或一个行为名称。CComponent
__isset()检查一个属性是否为null。CComponent
__set()设置一个组件的属性值。CComponent
__unset()设置一个组件的属性为null。CComponent
asa()返回这个名字的行为对象。CComponent
attachBehavior()附加一个行为到组件。CComponent
attachBehaviors()附加一个行为列表到组件。CComponent
attachEventHandler()为事件附加一个事件处理程序。CComponent
canGetProperty()确定属性是否可读。CComponent
canSetProperty()确定属性是否可写。CComponent
create()创建一个内嵌的过滤器实例。CInlineFilter
detachBehavior()从组件中分离一个行为。CComponent
detachBehaviors()从组件中分离所有行为。CComponent
detachEventHandler()分离一个存在的事件处理程序。CComponent
disableBehavior()禁用一个附加行为。CComponent
disableBehaviors()禁用组件附加的所有行为。CComponent
enableBehavior()启用一个附加行为。CComponent
enableBehaviors()启用组件附加的所有行为。CComponent
evaluateExpression()计算一个PHP表达式,或根据组件上下文执行回调。CComponent
filter()执行过滤。CInlineFilter
getEventHandlers()返回一个事件的附加处理程序列表。CComponent
hasEvent()确定一个事件是否定义。CComponent
hasEventHandler()检查事件是否有附加的处理程序。CComponent
hasProperty()确定属性是否被定义。CComponent
init()初始化过滤器。CFilter
raiseEvent()发起一个事件。CComponent

受保护方法

隐藏继承方法

方法描述定义在
postFilter()执行post操作过滤器。CFilter
preFilter()执行预操作过滤器。CFilter

属性详细

name 属性 public string $name;

过滤器名字。‘XYZ’代表着‘filterXYZ’过滤方法。

方法详细

create() 方法
public static CInlineFilter create(CController $controller, string $filterName)
$controllerCController过滤方法的宿主控制器。
$filterNamestring过滤器名字。
{return}CInlineFilter实例化的对象。
源码: framework/web/filters/CInlineFilter.php#38 (显示) publicstaticfunctioncreate($controller,$filterName)
{
if(method_exists($controller,'filter'.$filterName))
{
$filter=newCInlineFilter;
$filter->name=$filterName;
return$filter;
}
else
thrownewCException(Yii::t('yii','Filter"{filter}"isinvalid.Controller"{class}"doesnothavethefiltermethod"filter{filter}".',
array('{filter}'=>$filterName,'{class}'=>get_class($controller))));
}

创建一个内嵌的过滤器实例。 这个创建是基于过滤器是否会应用内嵌的 方法名字描述和动作名字来定的。

filter() 方法
public void filter(CFilterChain $filterChain)
$filterChainCFilterChain透过过滤器已启动。
源码: framework/web/filters/CInlineFilter.php#56 (显示) publicfunctionfilter($filterChain)
{
$method='filter'.$this->name;
$filterChain->controller->$method($filterChain);
}

执行过滤。 这个方法调用定义在控制器里面的过滤方法的。