code
stringlengths
17
247k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public static function reset() { self::$_files=null; }
Cleans up the loaded CUploadedFile instances. This method is mainly used by test scripts to set up a fixture. @since 1.1.4
reset
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
protected static function prefetchFiles() { self::$_files = array(); if(!isset($_FILES) || !is_array($_FILES)) return; foreach($_FILES as $class=>$info) self::collectFilesRecursive($class, $info['name'], $info['tmp_name'], $info['type'], $info['size'], $info['error']); }
Initially processes $_FILES superglobal for easier use. Only for internal usage.
prefetchFiles
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function __construct($name,$tempName,$type,$size,$error) { $this->_name=$name; $this->_tempName=$tempName; $this->_type=$type; $this->_size=$size; $this->_error=$error; }
Constructor. Use {@link getInstance} to get an instance of an uploaded file. @param string $name the original name of the file being uploaded @param string $tempName the path of the uploaded file on the server. @param string $type the MIME-type of the uploaded file (such as "image/gif"). @param integer $size the actual size of the uploaded file in bytes @param integer $error the error code
__construct
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function __toString() { return $this->_name; }
String output. This is PHP magic method that returns string representation of an object. The implementation here returns the uploaded file's name. @return string the string representation of the object
__toString
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function saveAs($file,$deleteTempFile=true) { if($this->_error==UPLOAD_ERR_OK) { if($deleteTempFile) return move_uploaded_file($this->_tempName,$file); elseif(is_uploaded_file($this->_tempName)) return copy($this->_tempName, $file); else return false; } else return false; }
Saves the uploaded file. Note: this method uses php's move_uploaded_file() method. As such, if the target file ($file) already exists it is overwritten. @param string $file the file path used to save the uploaded file @param boolean $deleteTempFile whether to delete the temporary file after saving. If true, you will not be able to save the uploaded file again in the current request. @return boolean true whether the file is saved successfully In some exceptional cases such as not enough permissions to write to the path specified PHP warning is triggered.
saveAs
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function getTempName() { return $this->_tempName; }
@return string the path of the uploaded file on the server. Note, this is a temporary file which will be automatically deleted by PHP after the current request is processed.
getTempName
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function getType() { return $this->_type; }
@return string the MIME-type of the uploaded file (such as "image/gif"). Since this MIME type is not checked on the server side, do not take this value for granted. Instead, use {@link CFileHelper::getMimeType} to determine the exact MIME type.
getType
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function getError() { return $this->_error; }
Returns an error code describing the status of this file uploading. @return integer the error code @see https://www.php.net/manual/en/features.file-upload.errors.php
getError
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function getExtensionName() { return CFileHelper::getExtension($this->_name); }
@return string the file extension name for {@link name}. The extension name does not include the dot character. An empty string is returned if {@link name} does not have an extension name.
getExtensionName
php
yiisoft/yii
framework/web/CUploadedFile.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUploadedFile.php
BSD-3-Clause
public function renderInternal($_viewFile_,$_data_=null,$_return_=false) { // we use special variable names here to avoid conflict when extracting data if(is_array($_data_)) extract($_data_,EXTR_PREFIX_SAME,'data'); else $data=$_data_; if($_return_) { ob_start(); ob_implicit_flush(false); require($_viewFile_); return ob_get_clean(); } else require($_viewFile_); }
Renders a view file. This method includes the view file as a PHP script and captures the display result if required. @param string $_viewFile_ view file @param array $_data_ data to be extracted and made available to the view file @param boolean $_return_ whether the rendering result should be returned as a string @return string the rendering result. Null if the rendering result is not required.
renderInternal
php
yiisoft/yii
framework/web/CBaseController.php
https://github.com/yiisoft/yii/blob/master/framework/web/CBaseController.php
BSD-3-Clause
public function endClip() { $this->endWidget('CClipWidget'); }
Ends recording a clip. This method is an alias to {@link endWidget}.
endClip
php
yiisoft/yii
framework/web/CBaseController.php
https://github.com/yiisoft/yii/blob/master/framework/web/CBaseController.php
BSD-3-Clause
public function endCache() { $this->endWidget('COutputCache'); }
Ends fragment caching. This is an alias to {@link endWidget}. @see beginCache
endCache
php
yiisoft/yii
framework/web/CBaseController.php
https://github.com/yiisoft/yii/blob/master/framework/web/CBaseController.php
BSD-3-Clause
public function endContent() { $this->endWidget('CContentDecorator'); }
Ends the rendering of content. @see beginContent
endContent
php
yiisoft/yii
framework/web/CBaseController.php
https://github.com/yiisoft/yii/blob/master/framework/web/CBaseController.php
BSD-3-Clause
public function processRequest() { if(is_array($this->catchAllRequest) && isset($this->catchAllRequest[0])) { $route=$this->catchAllRequest[0]; foreach(array_splice($this->catchAllRequest,1) as $name=>$value) $_GET[$name]=$value; } else $route=$this->getUrlManager()->parseUrl($this->getRequest()); $this->runController($route); }
Processes the current request. It first resolves the request into controller and action, and then creates the controller to perform the action.
processRequest
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
protected function registerCoreComponents() { parent::registerCoreComponents(); $components=array( 'session'=>array( 'class'=>'CHttpSession', ), 'assetManager'=>array( 'class'=>'CAssetManager', ), 'user'=>array( 'class'=>'CWebUser', ), 'themeManager'=>array( 'class'=>'CThemeManager', ), 'authManager'=>array( 'class'=>'CPhpAuthManager', ), 'clientScript'=>array( 'class'=>'CClientScript', ), 'widgetFactory'=>array( 'class'=>'CWidgetFactory', ), ); $this->setComponents($components); }
Registers the core application components. This method overrides the parent implementation by registering additional core components. @see setComponents
registerCoreComponents
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function getViewRenderer() { return $this->getComponent('viewRenderer'); }
Returns the view renderer. If this component is registered and enabled, the default view rendering logic defined in {@link CBaseController} will be replaced by this renderer. @return IViewRenderer the view renderer.
getViewRenderer
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function getClientScript() { return $this->getComponent('clientScript'); }
Returns the client script manager. @return CClientScript the client script manager
getClientScript
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function runController($route) { if(($ca=$this->createController($route))!==null) { list($controller,$actionID)=$ca; $oldController=$this->_controller; $this->_controller=$controller; $controller->init(); $controller->run($actionID); $this->_controller=$oldController; } else throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".', array('{route}'=>$route===''?$this->defaultController:$route))); }
Creates the controller and performs the specified action. @param string $route the route of the current request. See {@link createController} for more details. @throws CHttpException if the controller could not be created.
runController
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function createController($route,$owner=null) { if($owner===null) $owner=$this; if((array)$route===$route || ($route=trim($route,'/'))==='') $route=$owner->defaultController; $caseSensitive=$this->getUrlManager()->caseSensitive; $route.='/'; while(($pos=strpos($route,'/'))!==false) { $id=substr($route,0,$pos); if(!preg_match('/^\w+$/',$id)) return null; if(!$caseSensitive) $id=strtolower($id); $route=(string)substr($route,$pos+1); if(!isset($basePath)) // first segment { if(isset($owner->controllerMap[$id])) { return array( Yii::createComponent($owner->controllerMap[$id],$id,$owner===$this?null:$owner), $this->parseActionParams($route), ); } if(($module=$owner->getModule($id))!==null) return $this->createController($route,$module); $basePath=$owner->getControllerPath(); $controllerID=''; } else $controllerID.='/'; $className=ucfirst($id).'Controller'; $classFile=$basePath.DIRECTORY_SEPARATOR.$className.'.php'; if($owner->controllerNamespace!==null) $className=$owner->controllerNamespace.'\\'.str_replace('/','\\',$controllerID).$className; if(is_file($classFile)) { if(!class_exists($className,false)) require($classFile); if(class_exists($className,false) && is_subclass_of($className,'CController')) { $id[0]=strtolower($id[0]); return array( new $className($controllerID.$id,$owner===$this?null:$owner), $this->parseActionParams($route), ); } return null; } $controllerID.=$id; $basePath.=DIRECTORY_SEPARATOR.$id; } }
Creates a controller instance based on a route. The route should contain the controller ID and the action ID. It may also contain additional GET variables. All these must be concatenated together with slashes. This method will attempt to create a controller in the following order: <ol> <li>If the first segment is found in {@link controllerMap}, the corresponding controller configuration will be used to create the controller;</li> <li>If the first segment is found to be a module ID, the corresponding module will be used to create the controller;</li> <li>Otherwise, it will search under the {@link controllerPath} to create the corresponding controller. For example, if the route is "admin/user/create", then the controller will be created using the class file "protected/controllers/admin/UserController.php".</li> </ol> @param string $route the route of the request. @param CWebModule $owner the module that the new controller will belong to. Defaults to null, meaning the application instance is the owner. @return array the controller instance and the action ID. Null if the controller class does not exist or the route is invalid.
createController
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
protected function parseActionParams($pathInfo) { if(($pos=strpos($pathInfo,'/'))!==false) { $manager=$this->getUrlManager(); $manager->parsePathInfo((string)substr($pathInfo,$pos+1)); $actionID=substr($pathInfo,0,$pos); return $manager->caseSensitive ? $actionID : strtolower($actionID); } else return $pathInfo; }
Parses a path info into an action ID and GET variables. @param string $pathInfo path info @return string action ID
parseActionParams
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function beforeControllerAction($controller,$action) { return true; }
The pre-filter for controller actions. This method is invoked before the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done before all controller actions. @param CController $controller the controller @param CAction $action the action @return boolean whether the action should be executed.
beforeControllerAction
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function afterControllerAction($controller,$action) { }
The post-filter for controller actions. This method is invoked after the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done after all controller actions. @param CController $controller the controller @param CAction $action the action
afterControllerAction
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function findModule($id) { if(($controller=$this->getController())!==null && ($module=$controller->getModule())!==null) { do { if(($m=$module->getModule($id))!==null) return $m; } while(($module=$module->getParentModule())!==null); } if(($m=$this->getModule($id))!==null) return $m; }
Do not call this method. This method is used internally to search for a module by its ID. @param string $id module ID @return CWebModule the module that has the specified ID. Null if no module is found.
findModule
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
protected function init() { parent::init(); // preload 'request' so that it has chance to respond to onBeginRequest event. $this->getRequest(); }
Initializes the application. This method overrides the parent implementation by preloading the 'request' component.
init
php
yiisoft/yii
framework/web/CWebApplication.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebApplication.php
BSD-3-Clause
public function getViewPath() { if($this->_viewPath===null) { $class=new ReflectionClass(get_class($this)); $this->_viewPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.'views'; } return $this->_viewPath; }
Returns the directory containing view files for this controller. This method overrides the parent implementation by specifying the view path to be the "views" subdirectory under the directory containing the controller class file. @return string the directory containing the view files for this controller.
getViewPath
php
yiisoft/yii
framework/web/CExtController.php
https://github.com/yiisoft/yii/blob/master/framework/web/CExtController.php
BSD-3-Clause
public function __construct($modelClass=null) { $this->modelClass=$modelClass; }
Constructor. @param string $modelClass the class name of data models that need to be sorted. This should be a child class of {@link CActiveRecord}.
__construct
php
yiisoft/yii
framework/web/CSort.php
https://github.com/yiisoft/yii/blob/master/framework/web/CSort.php
BSD-3-Clause
public function applyOrder($criteria) { $order=$this->getOrderBy($criteria); if(!empty($order)) { if(!empty($criteria->order)) $criteria->order.=', '; $criteria->order.=$order; } }
Modifies the query criteria by changing its {@link CDbCriteria::order} property. This method will use {@link directions} to determine which columns need to be sorted. They will be put in the ORDER BY clause. If the criteria already has non-empty {@link CDbCriteria::order} value, the new value will be appended to it. @param CDbCriteria $criteria the query criteria
applyOrder
php
yiisoft/yii
framework/web/CSort.php
https://github.com/yiisoft/yii/blob/master/framework/web/CSort.php
BSD-3-Clause
public function resolveLabel($attribute) { $definition=$this->resolveAttribute($attribute); if(is_array($definition)) { if(isset($definition['label'])) return $definition['label']; } elseif(is_string($definition)) $attribute=$definition; if($this->modelClass!==null) return $this->getModel($this->modelClass)->getAttributeLabel($attribute); else return $attribute; }
Resolves the attribute label for the specified attribute. This will invoke {@link CActiveRecord::getAttributeLabel} to determine what label to use. If the attribute refers to a virtual attribute declared in {@link attributes}, then the label given in the {@link attributes} will be returned instead. @param string $attribute the attribute name. @return string the attribute label
resolveLabel
php
yiisoft/yii
framework/web/CSort.php
https://github.com/yiisoft/yii/blob/master/framework/web/CSort.php
BSD-3-Clause
public function getDirections() { if($this->_directions===null) { $this->_directions=array(); if(isset($_GET[$this->sortVar]) && is_string($_GET[$this->sortVar])) { $attributes=explode($this->separators[0],$_GET[$this->sortVar]); foreach($attributes as $attribute) { if(($pos=strrpos($attribute,$this->separators[1]))!==false) { $descending=substr($attribute,$pos+1)===$this->descTag; if($descending) $attribute=substr($attribute,0,$pos); } else $descending=false; if(($this->resolveAttribute($attribute))!==false) { $this->_directions[$attribute]=$descending; if(!$this->multiSort) return $this->_directions; } } } if($this->_directions===array() && is_array($this->defaultOrder)) $this->_directions=$this->defaultOrder; } return $this->_directions; }
Returns the currently requested sort information. @return array sort directions indexed by attribute names. Sort direction can be either CSort::SORT_ASC for ascending order or CSort::SORT_DESC for descending order.
getDirections
php
yiisoft/yii
framework/web/CSort.php
https://github.com/yiisoft/yii/blob/master/framework/web/CSort.php
BSD-3-Clause
public function getDirection($attribute) { $this->getDirections(); return isset($this->_directions[$attribute]) ? $this->_directions[$attribute] : null; }
Returns the sort direction of the specified attribute in the current request. @param string $attribute the attribute name @return mixed Sort direction of the attribute. Can be either CSort::SORT_ASC for ascending order or CSort::SORT_DESC for descending order. Value is null if the attribute doesn't need to be sorted.
getDirection
php
yiisoft/yii
framework/web/CSort.php
https://github.com/yiisoft/yii/blob/master/framework/web/CSort.php
BSD-3-Clause
public function createUrl($controller,$directions) { $sorts=array(); foreach($directions as $attribute=>$descending) $sorts[]=$descending ? $attribute.$this->separators[1].$this->descTag : $attribute; $params=$this->params===null ? $_GET : $this->params; $params[$this->sortVar]=implode($this->separators[0],$sorts); return $controller->createUrl($this->route,$params); }
Creates a URL that can lead to generating sorted data. @param CController $controller the controller that will be used to create the URL. @param array $directions the sort directions indexed by attribute names. The sort direction can be either CSort::SORT_ASC for ascending order or CSort::SORT_DESC for descending order. @return string the URL for sorting
createUrl
php
yiisoft/yii
framework/web/CSort.php
https://github.com/yiisoft/yii/blob/master/framework/web/CSort.php
BSD-3-Clause
protected function createLink($attribute,$label,$url,$htmlOptions) { return CHtml::link($label,$url,$htmlOptions); }
Creates a hyperlink based on the given label and URL. You may override this method to customize the link generation. @param string $attribute the name of the attribute that this link is for @param string $label the label of the hyperlink @param string $url the URL @param array $htmlOptions additional HTML options @return string the generated hyperlink
createLink
php
yiisoft/yii
framework/web/CSort.php
https://github.com/yiisoft/yii/blob/master/framework/web/CSort.php
BSD-3-Clause
public function init() { parent::init(); $this->processRules(); }
Initializes the application component.
init
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
public function addRules($rules,$append=true) { if ($append) { foreach($rules as $pattern=>$route) $this->_rules[]=$this->createUrlRule($route,$pattern); } else { $rules=array_reverse($rules); foreach($rules as $pattern=>$route) array_unshift($this->_rules, $this->createUrlRule($route,$pattern)); } }
Adds new URL rules. In order to make the new rules effective, this method must be called BEFORE {@link CWebApplication::processRequest}. @param array $rules new URL rules (pattern=>route). @param boolean $append whether the new URL rules should be appended to the existing ones. If false, they will be inserted at the beginning. @since 1.1.4
addRules
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
protected function createUrlRule($route,$pattern) { if(is_array($route) && isset($route['class'])) return $route; else { $urlRuleClass=Yii::import($this->urlRuleClass,true); return new $urlRuleClass($route,$pattern); } }
Creates a URL rule instance. The default implementation returns a CUrlRule object. @param mixed $route the route part of the rule. This could be a string or an array @param string $pattern the pattern part of the rule @return CUrlRule the URL rule instance @since 1.1.0
createUrlRule
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
protected function createUrlDefault($route,$params,$ampersand) { if($this->getUrlFormat()===self::PATH_FORMAT) { $url=rtrim($this->getBaseUrl().'/'.$route,'/'); if($this->appendParams) { $url=rtrim($url.'/'.$this->createPathInfo($params,'/','/'),'/'); return $route==='' ? $url : $url.$this->urlSuffix; } else { if($route!=='') $url.=$this->urlSuffix; $query=$this->createPathInfo($params,'=',$ampersand); return $query==='' ? $url : $url.'?'.$query; } } else { $url=$this->getBaseUrl(); if(!$this->showScriptName) $url.='/'; if($route!=='') { $url.='?'.$this->routeVar.'='.$route; if(($query=$this->createPathInfo($params,'=',$ampersand))!=='') $url.=$ampersand.$query; } elseif(($query=$this->createPathInfo($params,'=',$ampersand))!=='') $url.='?'.$query; return $url; } }
Creates a URL based on default settings. @param string $route the controller and the action (e.g. article/read) @param array $params list of GET parameters @param string $ampersand the token separating name-value pairs in the URL. @return string the constructed URL
createUrlDefault
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
public function parsePathInfo($pathInfo) { if($pathInfo==='') return; $segs=explode('/',$pathInfo.'/'); $n=count($segs); for($i=0;$i<$n-1;$i+=2) { $key=$segs[$i]; if($key==='') continue; $value=$segs[$i+1]; if(($pos=strpos($key,'['))!==false && ($m=preg_match_all('/\[(.*?)\]/',$key,$matches))>0) { $name=substr($key,0,$pos); for($j=$m-1;$j>=0;--$j) { if($matches[1][$j]==='') $value=array($value); else $value=array($matches[1][$j]=>$value); } if(isset($_GET[$name]) && is_array($_GET[$name])) $value=CMap::mergeArray($_GET[$name],$value); $_REQUEST[$name]=$_GET[$name]=$value; } else $_REQUEST[$key]=$_GET[$key]=$value; } }
Parses a path info into URL segments and saves them to $_GET and $_REQUEST. @param string $pathInfo path info
parsePathInfo
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
public function removeUrlSuffix($pathInfo,$urlSuffix) { if($urlSuffix!=='' && substr($pathInfo,-strlen($urlSuffix))===$urlSuffix) return substr($pathInfo,0,-strlen($urlSuffix)); else return $pathInfo; }
Removes the URL suffix from path info. @param string $pathInfo path info part in the URL @param string $urlSuffix the URL suffix to be removed @return string path info with URL suffix removed.
removeUrlSuffix
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
public function getBaseUrl() { if($this->_baseUrl!==null) return $this->_baseUrl; else { if($this->showScriptName) $this->_baseUrl=Yii::app()->getRequest()->getScriptUrl(); else $this->_baseUrl=Yii::app()->getRequest()->getBaseUrl(); return $this->_baseUrl; } }
Returns the base URL of the application. @return string the base URL of the application (the part after host name and before query string). If {@link showScriptName} is true, it will include the script name part. Otherwise, it will not, and the ending slashes are stripped off.
getBaseUrl
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
public function getUrlFormat() { return $this->_urlFormat; }
Returns the URL format. @return string the URL format. Defaults to 'path'. Valid values include 'path' and 'get'. Please refer to the guide for more details about the difference between these two formats.
getUrlFormat
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
protected function escapeRegexpSpecialChars($matches) { return preg_quote($matches[0]); }
Callback for preg_replace_callback in counstructor
escapeRegexpSpecialChars
php
yiisoft/yii
framework/web/CUrlManager.php
https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php
BSD-3-Clause
public function init() { parent::init(); if($this->enableSkin && $this->skinPath===null) $this->skinPath=Yii::app()->getViewPath().DIRECTORY_SEPARATOR.'skins'; }
Initializes the application component. This method overrides the parent implementation by resolving the skin path.
init
php
yiisoft/yii
framework/web/CWidgetFactory.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWidgetFactory.php
BSD-3-Clause
protected function getSkin($className,$skinName) { if(!isset($this->_skins[$className][$skinName])) { $skinFile=$this->skinPath.DIRECTORY_SEPARATOR.$className.'.php'; if(is_file($skinFile)) $this->_skins[$className]=require($skinFile); else $this->_skins[$className]=array(); if(($theme=Yii::app()->getTheme())!==null) { $skinFile=$theme->getSkinPath().DIRECTORY_SEPARATOR.$className.'.php'; if(is_file($skinFile)) { $skins=require($skinFile); foreach($skins as $name=>$skin) $this->_skins[$className][$name]=$skin; } } if(!isset($this->_skins[$className][$skinName])) $this->_skins[$className][$skinName]=array(); } return $this->_skins[$className][$skinName]; }
Returns the skin for the specified widget class and skin name. @param string $className the widget class name @param string $skinName the widget skin name @return array the skin (name=>value) for the widget
getSkin
php
yiisoft/yii
framework/web/CWidgetFactory.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWidgetFactory.php
BSD-3-Clause
public function reset() { $this->hasScripts=false; $this->coreScripts=array(); $this->cssFiles=array(); $this->css=array(); $this->scriptFiles=array(); $this->scripts=array(); $this->metaTags=array(); $this->linkTags=array(); $this->recordCachingAction('clientScript','reset',array()); }
Cleans all registered scripts.
reset
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function render(&$output) { if(!$this->hasScripts) return; $this->renderCoreScripts(); if(!empty($this->scriptMap)) $this->remapScripts(); $this->unifyScripts(); $this->renderHead($output); if($this->enableJavaScript) { $this->renderBodyBegin($output); $this->renderBodyEnd($output); } }
Renders the registered scripts. This method is called in {@link CController::render} when it finishes rendering content. CClientScript thus gets a chance to insert script tags at <code>head</code> and <code>body</code> sections in the HTML output. @param string $output the existing output that needs to be inserted with script tags
render
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function getCoreScriptUrl() { if($this->_baseUrl!==null) return $this->_baseUrl; else return $this->_baseUrl=Yii::app()->getAssetManager()->publish(YII_PATH.'/web/js/source'); }
Returns the base URL of all core javascript files. If the base URL is not explicitly set, this method will publish the whole directory 'framework/web/js/source' and return the corresponding URL. @return string the base URL of all core javascript files
getCoreScriptUrl
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function setCoreScriptUrl($value) { $this->_baseUrl=$value; }
Sets the base URL of all core javascript files. This setter is provided in case when core javascript files are manually published to a pre-specified location. This may save asset publishing time for large-scale applications. @param string $value the base URL of all core javascript files.
setCoreScriptUrl
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function getPackageBaseUrl($name) { if(!isset($this->coreScripts[$name])) return false; $package=$this->coreScripts[$name]; if(isset($package['baseUrl'])) { $baseUrl=$package['baseUrl']; if($baseUrl==='' || $baseUrl[0]!=='/' && strpos($baseUrl,'://')===false) $baseUrl=Yii::app()->getRequest()->getBaseUrl().'/'.$baseUrl; $baseUrl=rtrim($baseUrl,'/'); } elseif(isset($package['basePath'])) $baseUrl=Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias($package['basePath'])); else $baseUrl=$this->getCoreScriptUrl(); return $this->coreScripts[$name]['baseUrl']=$baseUrl; }
Returns the base URL for a registered package with the specified name. If needed, this method may publish the assets of the package and returns the published base URL. @param string $name the package name @return string the base URL for the named package. False is returned if the package is not registered yet. @see registerPackage @since 1.1.8
getPackageBaseUrl
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function hasPackage($name) { if(isset($this->coreScripts[$name])) return true; if(isset($this->packages[$name])) return true; else { if($this->corePackages===null) $this->corePackages=require(YII_PATH.'/web/js/packages.php'); if(isset($this->corePackages[$name])) return true; } return false; }
Checks if package is available. @param string $name the name of the script package. @return bool @since 1.1.18 @see registerPackage
hasPackage
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function registerCss($id,$css,$media='') { $this->hasScripts=true; $this->css[$id]=array($css,$media); $params=func_get_args(); $this->recordCachingAction('clientScript','registerCss',$params); return $this; }
Registers a piece of CSS code. @param string $id ID that uniquely identifies this piece of CSS code @param string $css the CSS code @param string $media media that the CSS code should be applied to. If empty, it means all media types. @return static the CClientScript object itself (to support method chaining, available since version 1.1.5).
registerCss
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function isCssFileRegistered($url) { return isset($this->cssFiles[$url]); }
Checks whether the CSS file has been registered. @param string $url URL of the CSS file @return boolean whether the CSS file is already registered
isCssFileRegistered
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function isCssRegistered($id) { return isset($this->css[$id]); }
Checks whether the CSS code has been registered. @param string $id ID that uniquely identifies the CSS code @return boolean whether the CSS code is already registered
isCssRegistered
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function isScriptFileRegistered($url,$position=self::POS_HEAD) { return isset($this->scriptFiles[$position][$url]); }
Checks whether the JavaScript file has been registered. @param string $url URL of the javascript file @param integer $position the position of the JavaScript code. Valid values include the following: <ul> <li>CClientScript::POS_HEAD : the script is inserted in the head section right before the title element.</li> <li>CClientScript::POS_BEGIN : the script is inserted at the beginning of the body section.</li> <li>CClientScript::POS_END : the script is inserted at the end of the body section.</li> </ul> @return boolean whether the javascript file is already registered
isScriptFileRegistered
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function isScriptRegistered($id,$position=self::POS_READY) { return isset($this->scripts[$position][$id]); }
Checks whether the JavaScript code has been registered. @param string $id ID that uniquely identifies the JavaScript code @param integer $position the position of the JavaScript code. Valid values include the following: <ul> <li>CClientScript::POS_HEAD : the script is inserted in the head section right before the title element.</li> <li>CClientScript::POS_BEGIN : the script is inserted at the beginning of the body section.</li> <li>CClientScript::POS_END : the script is inserted at the end of the body section.</li> <li>CClientScript::POS_LOAD : the script is inserted in the window.onload() function.</li> <li>CClientScript::POS_READY : the script is inserted in the jQuery's ready function.</li> </ul> @return boolean whether the javascript code is already registered
isScriptRegistered
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
protected function recordCachingAction($context,$method,$params) { if(($controller=Yii::app()->getController())!==null) $controller->recordCachingAction($context,$method,$params); }
Records a method call when an output cache is in effect. This is a shortcut to Yii::app()->controller->recordCachingAction. In case when controller is absent, nothing is recorded. @param string $context a property name of the controller. It refers to an object whose method is being called. If empty it means the controller itself. @param string $method the method name @param array $params parameters passed to the method @see COutputCache
recordCachingAction
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function addPackage($name,$definition) { $this->packages[$name]=$definition; return $this; }
Adds a package to packages list. @param string $name the name of the script package. @param array $definition the definition array of the script package, @see CClientScript::packages. @return static the CClientScript object itself (to support method chaining, available since version 1.1.10). @since 1.1.9
addPackage
php
yiisoft/yii
framework/web/CClientScript.php
https://github.com/yiisoft/yii/blob/master/framework/web/CClientScript.php
BSD-3-Clause
public function getName() { return basename($this->getId()); }
Returns the name of this module. The default implementation simply returns {@link id}. You may override this method to customize the name of this module. @return string the name of this module.
getName
php
yiisoft/yii
framework/web/CWebModule.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebModule.php
BSD-3-Clause
public function getDescription() { return ''; }
Returns the description of this module. The default implementation returns an empty string. You may override this method to customize the description of this module. @return string the description of this module.
getDescription
php
yiisoft/yii
framework/web/CWebModule.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebModule.php
BSD-3-Clause
public function getVersion() { return '1.0'; }
Returns the version of this module. The default implementation returns '1.0'. You may override this method to customize the version of this module. @return string the version of this module.
getVersion
php
yiisoft/yii
framework/web/CWebModule.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebModule.php
BSD-3-Clause
public function getControllerPath() { if($this->_controllerPath!==null) return $this->_controllerPath; else return $this->_controllerPath=$this->getBasePath().DIRECTORY_SEPARATOR.'controllers'; }
@return string the directory that contains the controller classes. Defaults to 'moduleDir/controllers' where moduleDir is the directory containing the module class.
getControllerPath
php
yiisoft/yii
framework/web/CWebModule.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebModule.php
BSD-3-Clause
public function getViewPath() { if($this->_viewPath!==null) return $this->_viewPath; else return $this->_viewPath=$this->getBasePath().DIRECTORY_SEPARATOR.'views'; }
@return string the root directory of view files. Defaults to 'moduleDir/views' where moduleDir is the directory containing the module class.
getViewPath
php
yiisoft/yii
framework/web/CWebModule.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebModule.php
BSD-3-Clause
public function getLayoutPath() { if($this->_layoutPath!==null) return $this->_layoutPath; else return $this->_layoutPath=$this->getViewPath().DIRECTORY_SEPARATOR.'layouts'; }
@return string the root directory of layout files. Defaults to 'moduleDir/views/layouts' where moduleDir is the directory containing the module class.
getLayoutPath
php
yiisoft/yii
framework/web/CWebModule.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebModule.php
BSD-3-Clause
public function afterControllerAction($controller,$action) { if(($parent=$this->getParentModule())===null) $parent=Yii::app(); $parent->afterControllerAction($controller,$action); }
The post-filter for controller actions. This method is invoked after the currently requested controller action and all its filters are executed. If you override this method, make sure you call the parent implementation at the end. @param CController $controller the controller @param CAction $action the action
afterControllerAction
php
yiisoft/yii
framework/web/CWebModule.php
https://github.com/yiisoft/yii/blob/master/framework/web/CWebModule.php
BSD-3-Clause
public function getId() { return $this->_id; }
Returns the ID that uniquely identifies the data provider. @return string the unique ID that uniquely identifies the data provider among all data providers.
getId
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function getPagination($className='CPagination') { if($this->_pagination===null) { $this->_pagination=new $className; if(($id=$this->getId())!='') $this->_pagination->pageVar=$id.'_page'; } return $this->_pagination; }
Returns the pagination object. @param string $className the pagination object class name. Parameter is available since version 1.1.13. @return CPagination|false the pagination object. If this is false, it means the pagination is disabled.
getPagination
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function setPagination($value) { if(is_array($value)) { if(isset($value['class'])) { $pagination=$this->getPagination($value['class']); unset($value['class']); } else $pagination=$this->getPagination(); foreach($value as $k=>$v) $pagination->$k=$v; } else $this->_pagination=$value; }
Sets the pagination for this data provider. @param mixed $value the pagination to be used by this data provider. This could be a {@link CPagination} object or an array used to configure the pagination object. If this is false, it means the pagination should be disabled. You can configure this property same way as a component: <pre> array( 'class' => 'MyPagination', 'pageSize' => 20, ), </pre>
setPagination
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function setSort($value) { if(is_array($value)) { if(isset($value['class'])) { $sort=$this->getSort($value['class']); unset($value['class']); } else $sort=$this->getSort(); foreach($value as $k=>$v) $sort->$k=$v; } else $this->_sort=$value; }
Sets the sorting for this data provider. @param mixed $value the sorting to be used by this data provider. This could be a {@link CSort} object or an array used to configure the sorting object. If this is false, it means the sorting should be disabled. You can configure this property same way as a component: <pre> array( 'class' => 'MySort', 'attributes' => array('name', 'weight'), ), </pre>
setSort
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function getData($refresh=false) { if($this->_data===null || $refresh) $this->_data=$this->fetchData(); return $this->_data; }
Returns the data items currently available. @param boolean $refresh whether the data should be re-fetched from persistent storage. @return array the list of data items currently available in this data provider.
getData
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function setData($value) { $this->_data=$value; }
Sets the data items for this provider. @param array $value put the data items into this provider.
setData
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function setKeys($value) { $this->_keys=$value; }
Sets the data item keys for this provider. @param array $value put the data item keys into this provider.
setKeys
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function getItemCount($refresh=false) { return count($this->getData($refresh)); }
Returns the number of data items in the current page. This is equivalent to <code>count($provider->getData())</code>. When {@link pagination} is set false, this returns the same value as {@link totalItemCount}. @param boolean $refresh whether the number of data items should be re-calculated. @return integer the number of data items in the current page.
getItemCount
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function getTotalItemCount($refresh=false) { if($this->_totalItemCount===null || $refresh) $this->_totalItemCount=$this->calculateTotalItemCount(); return $this->_totalItemCount; }
Returns the total number of data items. When {@link pagination} is set false, this returns the same value as {@link itemCount}. @param boolean $refresh whether the total number of data items should be re-calculated. @return integer total number of possible data items.
getTotalItemCount
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function setTotalItemCount($value) { $this->_totalItemCount=$value; }
Sets the total number of data items. This method is provided in case when the total number cannot be determined by {@link calculateTotalItemCount}. @param integer $value the total number of data items. @since 1.1.1
setTotalItemCount
php
yiisoft/yii
framework/web/CDataProvider.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDataProvider.php
BSD-3-Clause
public function init() { $this->_cache=Yii::app()->getComponent($this->cacheID); if(!($this->_cache instanceof ICache)) throw new CException(Yii::t('yii','CCacheHttpSession.cacheID is invalid. Please make sure "{id}" refers to a valid cache application component.', array('{id}'=>$this->cacheID))); parent::init(); }
Initializes the application component. This method overrides the parent implementation by checking if cache is available.
init
php
yiisoft/yii
framework/web/CCacheHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CCacheHttpSession.php
BSD-3-Clause
public function getUseCustomStorage() { return true; }
Returns a value indicating whether to use custom session storage. This method overrides the parent implementation and always returns true. @return boolean whether to use custom storage.
getUseCustomStorage
php
yiisoft/yii
framework/web/CCacheHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CCacheHttpSession.php
BSD-3-Clause
public function readSession($id) { $data=$this->_cache->get($this->calculateKey($id)); return $data===false?'':$data; }
Session read handler. Do not call this method directly. @param string $id session ID @return string the session data
readSession
php
yiisoft/yii
framework/web/CCacheHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CCacheHttpSession.php
BSD-3-Clause
public function writeSession($id,$data) { return $this->_cache->set($this->calculateKey($id),$data,$this->getTimeout()); }
Session write handler. Do not call this method directly. @param string $id session ID @param string $data session data @return boolean whether session write is successful
writeSession
php
yiisoft/yii
framework/web/CCacheHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CCacheHttpSession.php
BSD-3-Clause
protected function calculateKey($id) { return self::CACHE_KEY_PREFIX.$id; }
Generates a unique key used for storing session data in cache. @param string $id session variable name @return string a safe cache key associated with the session variable name
calculateKey
php
yiisoft/yii
framework/web/CCacheHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CCacheHttpSession.php
BSD-3-Clause
public function regenerateID($deleteOldSession=false) { $oldID=session_id(); // if no session is started, there is nothing to regenerate if(empty($oldID)) return; parent::regenerateID(false); $newID=session_id(); $db=$this->getDbConnection(); $row=$db->createCommand() ->select() ->from($this->sessionTableName) ->where('id=:id',array(':id'=>$oldID)) ->queryRow(); if($row!==false) { if($deleteOldSession) $db->createCommand()->update($this->sessionTableName,array( 'id'=>$newID ),'id=:oldID',array(':oldID'=>$oldID)); else { $row['id']=$newID; $db->createCommand()->insert($this->sessionTableName, $row); } } else { // shouldn't reach here normally $db->createCommand()->insert($this->sessionTableName, array( 'id'=>$newID, 'expire'=>time()+$this->getTimeout(), 'data'=>'', )); } }
Updates the current session id with a newly generated one. Please refer to {@link https://php.net/session_regenerate_id} for more details. @param boolean $deleteOldSession Whether to delete the old associated session file or not. @since 1.1.8
regenerateID
php
yiisoft/yii
framework/web/CDbHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDbHttpSession.php
BSD-3-Clause
public function openSession($savePath,$sessionName) { if($this->autoCreateSessionTable) { $db=$this->getDbConnection(); $db->setActive(true); try { $db->createCommand()->delete($this->sessionTableName,'expire<:expire',array(':expire'=>time())); } catch(Exception $e) { $this->createSessionTable($db,$this->sessionTableName); } } return true; }
Session open handler. Do not call this method directly. @param string $savePath session save path @param string $sessionName session name @return boolean whether session is opened successfully
openSession
php
yiisoft/yii
framework/web/CDbHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDbHttpSession.php
BSD-3-Clause
public function destroySession($id) { $this->getDbConnection()->createCommand() ->delete($this->sessionTableName,'id=:id',array(':id'=>$id)); return true; }
Session destroy handler. Do not call this method directly. @param string $id session ID @return boolean whether session is destroyed successfully
destroySession
php
yiisoft/yii
framework/web/CDbHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDbHttpSession.php
BSD-3-Clause
public function gcSession($maxLifetime) { $this->getDbConnection()->createCommand() ->delete($this->sessionTableName,'expire<:expire',array(':expire'=>time())); return true; }
Session GC (garbage collection) handler. Do not call this method directly. @param integer $maxLifetime the number of seconds after which data will be seen as 'garbage' and cleaned up. @return boolean whether session is GCed successfully
gcSession
php
yiisoft/yii
framework/web/CDbHttpSession.php
https://github.com/yiisoft/yii/blob/master/framework/web/CDbHttpSession.php
BSD-3-Clause
public function getRequestedView() { if($this->_viewPath===null) { if(!empty($_GET[$this->viewParam]) && is_string($_GET[$this->viewParam])) $this->_viewPath=$_GET[$this->viewParam]; else $this->_viewPath=$this->defaultView; } return $this->_viewPath; }
Returns the name of the view requested by the user. If the user doesn't specify any view, the {@link defaultView} will be returned. @return string the name of the view requested by the user. This is in the format of 'path.to.view'.
getRequestedView
php
yiisoft/yii
framework/web/actions/CViewAction.php
https://github.com/yiisoft/yii/blob/master/framework/web/actions/CViewAction.php
BSD-3-Clause
protected function resolveView($viewPath) { // start with a word char and have word chars, dots and dashes only if(preg_match('/^\w[\w\.\-]*$/',$viewPath)) { $view=strtr($viewPath,'.','/'); if(!empty($this->basePath)) $view=$this->basePath.'/'.$view; if($this->getController()->getViewFile($view)!==false) { $this->view=$view; return; } } throw new CHttpException(404,Yii::t('yii','The requested view "{name}" was not found.', array('{name}'=>$viewPath))); }
Resolves the user-specified view into a valid view name. @param string $viewPath user-specified view in the format of 'path.to.view'. @throws CHttpException if the user-specified view is invalid
resolveView
php
yiisoft/yii
framework/web/actions/CViewAction.php
https://github.com/yiisoft/yii/blob/master/framework/web/actions/CViewAction.php
BSD-3-Clause
public function run() { $this->resolveView($this->getRequestedView()); $controller=$this->getController(); if($this->layout!==null) { $layout=$controller->layout; $controller->layout=$this->layout; } $this->onBeforeRender($event=new CEvent($this)); if(!$event->handled) { if($this->renderAsText) { $text=file_get_contents($controller->getViewFile($this->view)); $controller->renderText($text); } else $controller->render($this->view); $this->onAfterRender(new CEvent($this)); } if($this->layout!==null) $controller->layout=$layout; }
Runs the action. This method displays the view requested by the user. @throws CHttpException if the view is invalid
run
php
yiisoft/yii
framework/web/actions/CViewAction.php
https://github.com/yiisoft/yii/blob/master/framework/web/actions/CViewAction.php
BSD-3-Clause
public function onBeforeRender($event) { $this->raiseEvent('onBeforeRender',$event); }
Raised right before the action invokes the render method. Event handlers can set the {@link CEvent::handled} property to be true to stop further view rendering. @param CEvent $event event parameter
onBeforeRender
php
yiisoft/yii
framework/web/actions/CViewAction.php
https://github.com/yiisoft/yii/blob/master/framework/web/actions/CViewAction.php
BSD-3-Clause
public function onAfterRender($event) { $this->raiseEvent('onAfterRender',$event); }
Raised right after the action invokes the render method. @param CEvent $event event parameter
onAfterRender
php
yiisoft/yii
framework/web/actions/CViewAction.php
https://github.com/yiisoft/yii/blob/master/framework/web/actions/CViewAction.php
BSD-3-Clause
public function runWithParams($params) { $method=new ReflectionMethod($this, 'run'); if($method->getNumberOfParameters()>0) return $this->runWithParamsInternal($this, $method, $params); $this->run(); return true; }
Runs the action with the supplied request parameters. This method is internally called by {@link CController::runAction()}. @param array $params the request parameters (name=>value) @return boolean whether the request parameters are valid @since 1.1.7
runWithParams
php
yiisoft/yii
framework/web/actions/CAction.php
https://github.com/yiisoft/yii/blob/master/framework/web/actions/CAction.php
BSD-3-Clause
public function run() { $method='action'.$this->getId(); $this->getController()->$method(); }
Runs the action. The action method defined in the controller is invoked. This method is required by {@link CAction}.
run
php
yiisoft/yii
framework/web/actions/CInlineAction.php
https://github.com/yiisoft/yii/blob/master/framework/web/actions/CInlineAction.php
BSD-3-Clause
public static function encode($text) { return htmlspecialchars((string)$text,ENT_QUOTES,Yii::app()->charset); }
Encodes special characters into HTML entities. The {@link CApplication::charset application charset} will be used for encoding. @param string $text data to be encoded @return string the encoded data @see https://www.php.net/manual/en/function.htmlspecialchars.php
encode
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function decode($text) { return htmlspecialchars_decode($text,ENT_QUOTES); }
Decodes special HTML entities back to the corresponding characters. This is the opposite of {@link encode()}. @param string $text data to be decoded @return string the decoded data @see https://www.php.net/manual/en/function.htmlspecialchars-decode.php @since 1.1.8
decode
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function closeTag($tag) { return '</'.$tag.'>'; }
Generates a close HTML element. @param string $tag the tag name @return string the generated HTML element tag
closeTag
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function cdata($text) { return '<![CDATA[' . $text . ']]>'; }
Encloses the given string within a CDATA tag. @param string $text the string to be enclosed @return string the CDATA tag with the enclosed content.
cdata
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function css($text,$media='') { if($media!=='') $media=' media="'.$media.'"'; if(self::$cdataScriptAndStyleContents) $text="/*<![CDATA[*/\n{$text}\n/*]]>*/"; return "<style type=\"text/css\"{$media}>\n{$text}\n</style>"; }
Encloses the given CSS content with a CSS tag. @param string $text the CSS content @param string $media the media that this CSS should apply to. @return string the CSS properly enclosed
css
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function refresh($seconds,$url='') { $content="$seconds"; if($url!=='') $content.=';url='.self::normalizeUrl($url); Yii::app()->clientScript->registerMetaTag($content,null,'refresh'); }
Registers a 'refresh' meta tag. This method can be invoked anywhere in a view. It will register a 'refresh' meta tag with {@link CClientScript} so that the page can be refreshed in the specified seconds. @param integer $seconds the number of seconds to wait before refreshing the page @param string $url the URL to which the page should be redirected to. If empty, it means the current page. @since 1.1.1
refresh
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function cssFile($url,$media='') { return CHtml::linkTag('stylesheet','text/css',$url,$media!=='' ? $media : null); }
Links to the specified CSS file. @param string $url the CSS URL @param string $media the media that this CSS should apply to. @return string the CSS link.
cssFile
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function pageStateField($value) { return '<input type="hidden" name="'.CController::STATE_INPUT_NAME.'" value="'.$value.'" />'; }
Generates a hidden field for storing persistent page states. This method is internally used by {@link statefulForm}. @param string $value the persistent page states in serialized format @return string the generated hidden field
pageStateField
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function asset($path,$hashByName=false) { return Yii::app()->getAssetManager()->publish($path,$hashByName); }
Generates the URL for the published assets. @param string $path the path of the asset to be published @param boolean $hashByName whether the published directory should be named as the hashed basename. If false, the name will be the hashed dirname of the path being published. Defaults to false. Set true if the path being published is shared among different extensions. @return string the asset URL
asset
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
public static function normalizeUrl($url) { if(is_array($url)) { if(isset($url[0])) { if(($c=Yii::app()->getController())!==null) $url=$c->createUrl($url[0],array_splice($url,1)); else $url=Yii::app()->createUrl($url[0],array_splice($url,1)); } else $url=''; } return $url==='' ? Yii::app()->getRequest()->getUrl() : $url; }
Normalizes the input parameter to be a valid URL. If the input parameter is an empty string, the currently requested URL will be returned. If the input parameter is a non-empty string, it is treated as a valid URL and will be returned without any change. If the input parameter is an array, it is treated as a controller route and a list of GET parameters, and the {@link CController::createUrl} method will be invoked to create a URL. In this case, the first array element refers to the controller route, and the rest key-value pairs refer to the additional GET parameters for the URL. For example, <code>array('post/list', 'page'=>3)</code> may be used to generate the URL <code>/index.php?r=post/list&page=3</code>. @param mixed $url the parameter to be used to generate a valid URL @return string the normalized URL
normalizeUrl
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause
protected static function inputField($type,$name,$value,$htmlOptions) { $htmlOptions['type']=$type; $htmlOptions['value']=$value; $htmlOptions['name']=$name; if(!isset($htmlOptions['id'])) $htmlOptions['id']=self::getIdByName($name); elseif($htmlOptions['id']===false) unset($htmlOptions['id']); return self::tag('input',$htmlOptions); }
Generates an input HTML tag. This method generates an input HTML tag based on the given input name and value. @param string $type the input type (e.g. 'text', 'radio') @param string $name the input name @param string $value the input value @param array $htmlOptions additional HTML attributes for the HTML tag (see {@link tag}). @return string the generated input tag
inputField
php
yiisoft/yii
framework/web/helpers/CHtml.php
https://github.com/yiisoft/yii/blob/master/framework/web/helpers/CHtml.php
BSD-3-Clause