Yii Framework v1.1.10 绫诲弬鑰

COutputProcessor

system.web.widgets
缁ф壙 class COutputProcessor » CFilterWidget » CWidget » CBaseController » CComponent
瀹炵幇 IFilter
瀛愮被 CContentDecorator, CHtmlPurifier, CMarkdown, CTextHighlighter
婧愯嚜 1.0
鐗堟湰 $Id: COutputProcessor.php 2799 2011-01-01 19:31:13Z qiang.xue $
婧愮爜 framework/web/widgets/COutputProcessor.php
COutputProcessor 灏嗗唴瀹硅浆鎹负涓嶅悓鐨勬牸寮忋

COutputProcessor 鑾峰彇涓涓姩浣滄垨瑙嗗浘鐗囨鐢熸垚鐨勮緭鍑哄苟浼犻掑埌 瀹冪殑onProcessOutput浜嬩欢澶勭悊鍣ㄨ繘琛岃繘涓姝ョ殑澶勭悊銆

浜嬩欢澶勭悊鍣ㄥ彲浠ュ杈撳嚭杩涜澶勭悊骞跺皢澶勭悊缁撴灉淇濆瓨鍒COutputEvent::output 灞炴т腑銆傞氳繃璁剧疆浜嬩欢鍙傛暟鐨handled灞炴т负鐪燂紝 杈撳嚭灏嗕笉浼氳鏄剧ず銆傚惁鍒欙紙榛樿鎯呭喌)锛岃緭鍑哄皢琚樉绀哄嚭鏉ャ

鍏叡灞炴

闅愯棌缁ф壙灞炴

灞炴绫诲瀷鎻忚堪瀹氫箟鍦
actionPrefix string actions鐨処D鐨勫墠缂銆 褰撳井浠跺湪CController::actions涓0鏄庝簡 鍔ㄤ綔鎻愪緵鑰咃紝鍙互涓哄叾鍔ㄤ綔鐨処D鎸囧畾鍓嶇紑浠ュ尯鍒 浜庡埆鐨勫井浠舵垨鎺у埗鍣ㄣ傚綋寰欢鐢ㄤ簬鎺у埗鍣 鐨勮鍥句腑鏃讹紝蹇呴』閰嶇疆鍚屾牱鐨勫墠缂銆 CWidget
controller CController 杩斿洖姝ゅ井浠舵墍灞炵殑鎺у埗鍣ㄣ CWidget
id string 杩斿洖姝ゅ井浠剁殑ID銆傚鏋滈渶瑕佺殑璇濓紝灏嗙敓浜т竴涓柊鐨処D骞跺皢鍏惰繑鍥炪 CWidget
isFilter boolean 杩欎釜widget鏄惁浣滀负涓涓繃婊ゅ櫒浣跨敤銆 CFilterWidget
owner CBaseController 杩斿洖姝ゅ井浠剁殑鎵鏈夎呮垨鍒涘缓鑰呫 CWidget
skin mixed 寰欢浣跨敤鐨勭毊鑲ょ殑鍚嶇О銆傞粯璁や负鈥渄efault鈥濄 濡傛灉姝ゅ睘鎬ц缃负false锛屽井浠跺皢涓嶄細鏈夌毊鑲よ浣跨敤銆 CWidget
stopAction boolean 褰撹繖涓獁idget鐢ㄤ綔涓涓繃婊ゅ櫒鏃舵槸鍚﹀仠姝㈠姩浣滅殑鎵ц銆 姝ゅ睘鎬у簲褰撲粎鍦CWidget::init鏂规硶涓繘琛屾敼鍙樸 榛樿鍊兼槸false锛岃〃绀哄姩浣滃皢浼氳鎵ц銆 CFilterWidget
viewPath string 杩斿洖鍖呭惈姝ゅ井浠舵墍闇鐨勮鍥炬枃浠剁殑璺緞銆 CWidget

鍏叡鏂规硶

闅愯棌缁ф壙鏂规硶

鏂规硶鎻忚堪瀹氫箟鍦
__call() 濡傛灉绫讳腑娌℃湁璋冪殑鏂规硶鍚嶏紝鍒欒皟鐢ㄨ繖涓柟娉曘 CComponent
__construct() 鏋勯犲櫒銆 CFilterWidget
__get() 杩斿洖涓涓睘鎬у笺佷竴涓簨浠跺鐞嗙▼搴忓垪琛ㄦ垨涓涓涓哄悕绉般 CComponent
__isset() 妫鏌ヤ竴涓睘鎬ф槸鍚︿负null銆 CComponent
__set() 璁剧疆涓涓粍浠剁殑灞炴у笺 CComponent
__unset() 璁剧疆涓涓粍浠剁殑灞炴т负null銆 CComponent
actions() 杩斿洖姝idget浣跨敤鐨勫姩浣滅殑鍒楄〃銆 CWidget
asa() 杩斿洖杩欎釜鍚嶅瓧鐨勮涓哄璞° CComponent
attachBehavior() 闄勫姞涓涓涓哄埌缁勪欢銆 CComponent
attachBehaviors() 闄勫姞涓涓涓哄垪琛ㄥ埌缁勪欢銆 CComponent
attachEventHandler() 涓轰簨浠堕檮鍔犱竴涓簨浠跺鐞嗙▼搴忋 CComponent
beginCache() Begins fragment caching. CBaseController
beginClip() Begins recording a clip. CBaseController
beginContent() Begins the rendering of content that is to be decorated by the specified view. CBaseController
beginWidget() Creates a widget and executes it. CBaseController
canGetProperty() 纭畾灞炴ф槸鍚﹀彲璇汇 CComponent
canSetProperty() 纭畾灞炴ф槸鍚﹀彲鍐欍 CComponent
createWidget() Creates a widget and initializes it. CBaseController
detachBehavior() 浠庣粍浠朵腑鍒嗙涓涓涓恒 CComponent
detachBehaviors() 浠庣粍浠朵腑鍒嗙鎵鏈夎涓恒 CComponent
detachEventHandler() 鍒嗙涓涓瓨鍦ㄧ殑浜嬩欢澶勭悊绋嬪簭銆 CComponent
disableBehavior() 绂佺敤涓涓檮鍔犺涓恒 CComponent
disableBehaviors() 绂佺敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
enableBehavior() 鍚敤涓涓檮鍔犺涓恒 CComponent
enableBehaviors() 鍚敤缁勪欢闄勫姞鐨勬墍鏈夎涓恒 CComponent
endCache() Ends fragment caching. CBaseController
endClip() Ends recording a clip. CBaseController
endContent() Ends the rendering of content. CBaseController
endWidget() Ends the execution of the named widget. CBaseController
evaluateExpression() 璁$畻涓涓狿HP琛ㄨ揪寮忥紝鎴栨牴鎹粍浠朵笂涓嬫枃鎵ц鍥炶皟銆 CComponent
filter() 鎵ц杩囨护銆 CFilterWidget
getController() 杩斿洖姝ゅ井浠舵墍灞炵殑鎺у埗鍣ㄣ CWidget
getEventHandlers() 杩斿洖涓涓簨浠剁殑闄勫姞澶勭悊绋嬪簭鍒楄〃銆 CComponent
getId() 杩斿洖姝ゅ井浠剁殑ID銆傚鏋滈渶瑕佺殑璇濓紝灏嗙敓浜т竴涓柊鐨処D骞跺皢鍏惰繑鍥炪 CWidget
getIsFilter() 妫鏌ヨ繖涓獁idget鏄惁浣滀负涓涓繃婊ゅ櫒浣跨敤銆 CFilterWidget
getOwner() 杩斿洖姝ゅ井浠剁殑鎵鏈夎呮垨鍒涘缓鑰呫 CWidget
getViewFile() 鏍规嵁瑙嗗浘鍚嶆煡鎵捐鍥炬枃浠躲 CWidget
getViewPath() 杩斿洖鍖呭惈姝ゅ井浠舵墍闇鐨勮鍥炬枃浠剁殑璺緞銆 CWidget
hasEvent() 纭畾涓涓簨浠舵槸鍚﹀畾涔夈 CComponent
hasEventHandler() 妫鏌ヤ簨浠舵槸鍚︽湁闄勫姞鐨勫鐞嗙▼搴忋 CComponent
hasProperty() 纭畾灞炴ф槸鍚﹁瀹氫箟銆 CComponent
init() 鍒濆鍖栨灏忕墿浠躲 COutputProcessor
onProcessOutput() 褰撹幏鍙栧埌杈撳嚭鏃舵縺鍙戙 COutputProcessor
processOutput() 澶勭悊鑾峰彇鐨勮緭鍑恒 COutputProcessor
raiseEvent() 鍙戣捣涓涓簨浠躲 CComponent
render() 娓叉煋涓涓鍥俱 CWidget
renderFile() Renders a view file. CBaseController
renderInternal() Renders a view file. CBaseController
run() 杩愯姝ゅ皬鐗╀欢銆 COutputProcessor
setId() 璁剧疆姝ゅ井浠剁殑ID銆 CWidget
widget() Creates a widget and executes it. CBaseController

浜嬩欢

闅愯棌缁ф壙浜嬩欢

浜嬩欢鎻忚堪瀹氫箟鍦
onProcessOutput 褰撹幏鍙栧埌杈撳嚭鏃舵縺鍙戙 COutputProcessor

鏂规硶璇︾粏

init() 鏂规硶
public void init()
婧愮爜锛 framework/web/widgets/COutputProcessor.php#32 (鏄剧ず)
public function init()
{
    
ob_start();
    
ob_implicit_flush(false);
}

鍒濆鍖栨灏忕墿浠躲 姝ゆ柟娉曞紑濮嬪杈撳嚭杩涜缂撳啿銆

onProcessOutput() 鏂规硶
public void onProcessOutput(COutputEvent $event)
$event COutputEvent 浜嬩欢鍙傛暟
婧愮爜锛 framework/web/widgets/COutputProcessor.php#73 (鏄剧ず)
public function onProcessOutput($event)
{
    
$this->raiseEvent('onProcessOutput',$event);
}

褰撹幏鍙栧埌杈撳嚭鏃舵縺鍙戙

processOutput() 鏂规硶
public void processOutput(string $output)
$output string 闇瑕佸鐞嗙殑鑾峰彇鐨勮緭鍑
婧愮爜锛 framework/web/widgets/COutputProcessor.php#56 (鏄剧ず)
public function processOutput($output)
{
    if(
$this->hasEventHandler('onProcessOutput'))
    {
        
$event=new COutputEvent($this,$output);
        
$this->onProcessOutput($event);
        if(!
$event->handled)
            echo 
$output;
    }
    else
        echo 
$output;
}

澶勭悊鑾峰彇鐨勮緭鍑恒

榛樿鐨勫疄鐜版槸婵鍙戜竴涓onProcessOutput浜嬩欢銆 濡傛灉璇ヤ簨浠舵湭琚换浣曚簨浠跺鐞嗗櫒澶勭悊锛岃緭鍑哄皢鐩存帴琚樉绀恒

run() 鏂规硶
public void run()
婧愮爜锛 framework/web/widgets/COutputProcessor.php#42 (鏄剧ず)
public function run()
{
    
$output=ob_get_clean();
    
$this->processOutput($output);
}

杩愯姝ゅ皬鐗╀欢銆 姝ゆ柟娉曞仠姝㈠杈撳嚭鐨勭紦鍐插苟瀵硅幏鍙栫殑杈撳嚭鍐呭杩涜澶勭悊銆

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.