repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
yiisoft/yii
framework/gii/CCodeGenerator.php
CCodeGenerator.actionDiff
public function actionDiff() { Yii::import('gii.components.TextDiff'); $model=$this->prepare(); if(isset($_GET['id']) && isset($model->files[$_GET['id']])) { $file=$model->files[$_GET['id']]; if(!in_array($file->type,array('php', 'txt','js','css','sql'))) $diff=false; elseif($file->operation===CC...
php
public function actionDiff() { Yii::import('gii.components.TextDiff'); $model=$this->prepare(); if(isset($_GET['id']) && isset($model->files[$_GET['id']])) { $file=$model->files[$_GET['id']]; if(!in_array($file->type,array('php', 'txt','js','css','sql'))) $diff=false; elseif($file->operation===CC...
[ "public", "function", "actionDiff", "(", ")", "{", "Yii", "::", "import", "(", "'gii.components.TextDiff'", ")", ";", "$", "model", "=", "$", "this", "->", "prepare", "(", ")", ";", "if", "(", "isset", "(", "$", "_GET", "[", "'id'", "]", ")", "&&", ...
The code diff action. This action shows up the difference between the newly generated code and the corresponding existing code. @throws CHttpException if unable to find code generated.
[ "The", "code", "diff", "action", ".", "This", "action", "shows", "up", "the", "difference", "between", "the", "newly", "generated", "code", "and", "the", "corresponding", "existing", "code", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeGenerator.php#L98-L120
train
yiisoft/yii
framework/gii/CCodeGenerator.php
CCodeGenerator.getViewPath
public function getViewPath() { if($this->_viewPath===null) { $class=new ReflectionClass(get_class($this)); $this->_viewPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.'views'; } return $this->_viewPath; }
php
public function getViewPath() { if($this->_viewPath===null) { $class=new ReflectionClass(get_class($this)); $this->_viewPath=dirname($class->getFileName()).DIRECTORY_SEPARATOR.'views'; } return $this->_viewPath; }
[ "public", "function", "getViewPath", "(", ")", "{", "if", "(", "$", "this", "->", "_viewPath", "===", "null", ")", "{", "$", "class", "=", "new", "ReflectionClass", "(", "get_class", "(", "$", "this", ")", ")", ";", "$", "this", "->", "_viewPath", "=...
Returns the view path of the generator. The "views" directory under the directory containing the generator class file will be returned. @return string the view path of the generator
[ "Returns", "the", "view", "path", "of", "the", "generator", ".", "The", "views", "directory", "under", "the", "directory", "containing", "the", "generator", "class", "file", "will", "be", "returned", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeGenerator.php#L127-L135
train
yiisoft/yii
framework/gii/CCodeGenerator.php
CCodeGenerator.prepare
protected function prepare() { if($this->codeModel===null) throw new CException(get_class($this).'.codeModel property must be specified.'); $modelClass=Yii::import($this->codeModel,true); $model=new $modelClass; $model->loadStickyAttributes(); if(isset($_POST[$modelClass])) { $model->attributes=$_POS...
php
protected function prepare() { if($this->codeModel===null) throw new CException(get_class($this).'.codeModel property must be specified.'); $modelClass=Yii::import($this->codeModel,true); $model=new $modelClass; $model->loadStickyAttributes(); if(isset($_POST[$modelClass])) { $model->attributes=$_POS...
[ "protected", "function", "prepare", "(", ")", "{", "if", "(", "$", "this", "->", "codeModel", "===", "null", ")", "throw", "new", "CException", "(", "get_class", "(", "$", "this", ")", ".", "'.codeModel property must be specified.'", ")", ";", "$", "modelCla...
Prepares the code model.
[ "Prepares", "the", "code", "model", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeGenerator.php#L148-L166
train
yiisoft/yii
framework/i18n/CChoiceFormat.php
CChoiceFormat.format
public static function format($messages, $number) { $n=preg_match_all('/\s*([^#]*)\s*#([^\|]*)\|/',$messages.'|',$matches); if($n===0) return $messages; for($i=0;$i<$n;++$i) { $expression=$matches[1][$i]; $message=$matches[2][$i]; if($expression===(string)(int)$expression) { if($expression==...
php
public static function format($messages, $number) { $n=preg_match_all('/\s*([^#]*)\s*#([^\|]*)\|/',$messages.'|',$matches); if($n===0) return $messages; for($i=0;$i<$n;++$i) { $expression=$matches[1][$i]; $message=$matches[2][$i]; if($expression===(string)(int)$expression) { if($expression==...
[ "public", "static", "function", "format", "(", "$", "messages", ",", "$", "number", ")", "{", "$", "n", "=", "preg_match_all", "(", "'/\\s*([^#]*)\\s*#([^\\|]*)\\|/'", ",", "$", "messages", ".", "'|'", ",", "$", "matches", ")", ";", "if", "(", "$", "n", ...
Formats a message according to the specified number value. @param string $messages the candidate messages in the format of 'expr1#message1|expr2#message2|expr3#message3'. See {@link CChoiceFormat} for more details. @param mixed $number the number value @return string the selected message
[ "Formats", "a", "message", "according", "to", "the", "specified", "number", "value", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CChoiceFormat.php#L46-L64
train
yiisoft/yii
demos/blog/protected/controllers/PostController.php
PostController.actionSuggestTags
public function actionSuggestTags() { if(isset($_GET['q']) && ($keyword=trim($_GET['q']))!=='') { $tags=Tag::model()->suggestTags($keyword); if($tags!==array()) echo implode("\n",$tags); } }
php
public function actionSuggestTags() { if(isset($_GET['q']) && ($keyword=trim($_GET['q']))!=='') { $tags=Tag::model()->suggestTags($keyword); if($tags!==array()) echo implode("\n",$tags); } }
[ "public", "function", "actionSuggestTags", "(", ")", "{", "if", "(", "isset", "(", "$", "_GET", "[", "'q'", "]", ")", "&&", "(", "$", "keyword", "=", "trim", "(", "$", "_GET", "[", "'q'", "]", ")", ")", "!==", "''", ")", "{", "$", "tags", "=", ...
Suggests tags based on the current user input. This is called via AJAX when the user is entering the tags input.
[ "Suggests", "tags", "based", "on", "the", "current", "user", "input", ".", "This", "is", "called", "via", "AJAX", "when", "the", "user", "is", "entering", "the", "tags", "input", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/controllers/PostController.php#L156-L164
train
yiisoft/yii
demos/blog/protected/controllers/PostController.php
PostController.newComment
protected function newComment($post) { $comment=new Comment; if(isset($_POST['ajax']) && $_POST['ajax']==='comment-form') { echo CActiveForm::validate($comment); Yii::app()->end(); } if(isset($_POST['Comment'])) { $comment->attributes=$_POST['Comment']; if($post->addComment($comment)) { ...
php
protected function newComment($post) { $comment=new Comment; if(isset($_POST['ajax']) && $_POST['ajax']==='comment-form') { echo CActiveForm::validate($comment); Yii::app()->end(); } if(isset($_POST['Comment'])) { $comment->attributes=$_POST['Comment']; if($post->addComment($comment)) { ...
[ "protected", "function", "newComment", "(", "$", "post", ")", "{", "$", "comment", "=", "new", "Comment", ";", "if", "(", "isset", "(", "$", "_POST", "[", "'ajax'", "]", ")", "&&", "$", "_POST", "[", "'ajax'", "]", "===", "'comment-form'", ")", "{", ...
Creates a new comment. This method attempts to create a new comment based on the user input. If the comment is successfully created, the browser will be redirected to show the created comment. @param Post the post that the new comment belongs to @return Comment the comment instance
[ "Creates", "a", "new", "comment", ".", "This", "method", "attempts", "to", "create", "a", "new", "comment", "based", "on", "the", "user", "input", ".", "If", "the", "comment", "is", "successfully", "created", "the", "browser", "will", "be", "redirected", "...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/controllers/PostController.php#L196-L215
train
yiisoft/yii
framework/base/CSecurityManager.php
CSecurityManager.encrypt
public function encrypt($data,$key=null) { if($key===null) $key=$this->getEncryptionKey(); $this->validateEncryptionKey($key); $module=$this->openCryptModule(); srand(); $iv=@mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND); @mcrypt_generic_init($module,$key,$iv); $encrypted=$iv.@mcrypt_...
php
public function encrypt($data,$key=null) { if($key===null) $key=$this->getEncryptionKey(); $this->validateEncryptionKey($key); $module=$this->openCryptModule(); srand(); $iv=@mcrypt_create_iv(mcrypt_enc_get_iv_size($module), MCRYPT_RAND); @mcrypt_generic_init($module,$key,$iv); $encrypted=$iv.@mcrypt_...
[ "public", "function", "encrypt", "(", "$", "data", ",", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "===", "null", ")", "$", "key", "=", "$", "this", "->", "getEncryptionKey", "(", ")", ";", "$", "this", "->", "validateEncryptionKey", ...
Encrypts data. @param string $data data to be encrypted. @param string $key the decryption key. This defaults to null, meaning using {@link getEncryptionKey EncryptionKey}. @return string the encrypted data @throws CException if PHP Mcrypt extension is not loaded or key is invalid
[ "Encrypts", "data", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CSecurityManager.php#L218-L231
train
yiisoft/yii
framework/base/CSecurityManager.php
CSecurityManager.validateData
public function validateData($data,$key=null) { if (!is_string($data)) return false; $len=$this->strlen($this->computeHMAC('test')); if($this->strlen($data)>=$len) { $hmac=$this->substr($data,0,$len); $data2=$this->substr($data,$len,$this->strlen($data)); return $this->compareString($hmac,$this->c...
php
public function validateData($data,$key=null) { if (!is_string($data)) return false; $len=$this->strlen($this->computeHMAC('test')); if($this->strlen($data)>=$len) { $hmac=$this->substr($data,0,$len); $data2=$this->substr($data,$len,$this->strlen($data)); return $this->compareString($hmac,$this->c...
[ "public", "function", "validateData", "(", "$", "data", ",", "$", "key", "=", "null", ")", "{", "if", "(", "!", "is_string", "(", "$", "data", ")", ")", "return", "false", ";", "$", "len", "=", "$", "this", "->", "strlen", "(", "$", "this", "->",...
Validates if data is tampered. @param string $data data to be validated. The data must be previously generated using {@link hashData()}. @param string $key the private key to be used for generating HMAC. Defaults to null, meaning using {@link validationKey}. @return string the real data with HMAC stripped off. False if...
[ "Validates", "if", "data", "is", "tampered", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CSecurityManager.php#L298-L312
train
yiisoft/yii
framework/base/CSecurityManager.php
CSecurityManager.generateRandomBytes
public function generateRandomBytes($length,$cryptographicallyStrong=true) { $bytes=''; if(function_exists('openssl_random_pseudo_bytes')) { $bytes=openssl_random_pseudo_bytes($length,$strong); if($this->strlen($bytes)>=$length && ($strong || !$cryptographicallyStrong)) return $this->substr($bytes,0,$l...
php
public function generateRandomBytes($length,$cryptographicallyStrong=true) { $bytes=''; if(function_exists('openssl_random_pseudo_bytes')) { $bytes=openssl_random_pseudo_bytes($length,$strong); if($this->strlen($bytes)>=$length && ($strong || !$cryptographicallyStrong)) return $this->substr($bytes,0,$l...
[ "public", "function", "generateRandomBytes", "(", "$", "length", ",", "$", "cryptographicallyStrong", "=", "true", ")", "{", "$", "bytes", "=", "''", ";", "if", "(", "function_exists", "(", "'openssl_random_pseudo_bytes'", ")", ")", "{", "$", "bytes", "=", "...
Generates a string of random bytes. @param integer $length number of random bytes to be generated. @param boolean $cryptographicallyStrong whether to fail if a cryptographically strong result cannot be generated. The method attempts to read from a cryptographically strong pseudorandom number generator (CS-PRNG), see {@...
[ "Generates", "a", "string", "of", "random", "bytes", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CSecurityManager.php#L391-L432
train
yiisoft/yii
framework/base/CSecurityManager.php
CSecurityManager.generateSessionRandomBlock
public function generateSessionRandomBlock() { ini_set('session.entropy_length',20); if(ini_get('session.entropy_length')!=20) return false; // These calls are (supposed to be, according to PHP manual) safe even if // there is already an active session for the calling script. @session_start(); @session...
php
public function generateSessionRandomBlock() { ini_set('session.entropy_length',20); if(ini_get('session.entropy_length')!=20) return false; // These calls are (supposed to be, according to PHP manual) safe even if // there is already an active session for the calling script. @session_start(); @session...
[ "public", "function", "generateSessionRandomBlock", "(", ")", "{", "ini_set", "(", "'session.entropy_length'", ",", "20", ")", ";", "if", "(", "ini_get", "(", "'session.entropy_length'", ")", "!=", "20", ")", "return", "false", ";", "// These calls are (supposed to ...
Get random bytes from the system entropy source via PHP session manager. @return boolean|string 20-byte random binary string or false on error. @since 1.1.14
[ "Get", "random", "bytes", "from", "the", "system", "entropy", "source", "via", "PHP", "session", "manager", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CSecurityManager.php#L477-L496
train
yiisoft/yii
framework/base/CSecurityManager.php
CSecurityManager.substr
private function substr($string,$start,$length) { return $this->_mbstring ? mb_substr($string,$start,$length,'8bit') : substr($string,$start,$length); }
php
private function substr($string,$start,$length) { return $this->_mbstring ? mb_substr($string,$start,$length,'8bit') : substr($string,$start,$length); }
[ "private", "function", "substr", "(", "$", "string", ",", "$", "start", ",", "$", "length", ")", "{", "return", "$", "this", "->", "_mbstring", "?", "mb_substr", "(", "$", "string", ",", "$", "start", ",", "$", "length", ",", "'8bit'", ")", ":", "s...
Returns the portion of string specified by the start and length parameters. If available uses the multibyte string function mb_substr @param string $string the input string. Must be one character or longer. @param integer $start the starting position @param integer $length the desired portion length @return string the ...
[ "Returns", "the", "portion", "of", "string", "specified", "by", "the", "start", "and", "length", "parameters", ".", "If", "available", "uses", "the", "multibyte", "string", "function", "mb_substr" ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CSecurityManager.php#L517-L520
train
yiisoft/yii
framework/base/CSecurityManager.php
CSecurityManager.unmaskToken
public function unmaskToken($maskedToken) { $decoded=base64_decode(strtr($maskedToken,'-_','+/')); $length=$this->strlen($decoded)/2; // Check if the masked token has an even length. if(!is_int($length)) return ''; return $this->substr($decoded,$length,$length)^$this->substr($decoded,0,$length); }
php
public function unmaskToken($maskedToken) { $decoded=base64_decode(strtr($maskedToken,'-_','+/')); $length=$this->strlen($decoded)/2; // Check if the masked token has an even length. if(!is_int($length)) return ''; return $this->substr($decoded,$length,$length)^$this->substr($decoded,0,$length); }
[ "public", "function", "unmaskToken", "(", "$", "maskedToken", ")", "{", "$", "decoded", "=", "base64_decode", "(", "strtr", "(", "$", "maskedToken", ",", "'-_'", ",", "'+/'", ")", ")", ";", "$", "length", "=", "$", "this", "->", "strlen", "(", "$", "...
Unmasks a token previously masked by `maskToken`. @param string $maskedToken A masked token. @return string An unmasked token, or an empty string in case of token format is invalid. @since 1.1.18
[ "Unmasks", "a", "token", "previously", "masked", "by", "maskToken", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CSecurityManager.php#L639-L647
train
yiisoft/yii
framework/i18n/gettext/CGettextPoFile.php
CGettextPoFile.load
public function load($file,$context) { $pattern='/(msgctxt\s+"(.*?(?<!\\\\))")?\s+' .'msgid\s+((?:".*(?<!\\\\)"\s*)+)\s+' .'msgstr\s+((?:".*(?<!\\\\)"\s*)+)/'; $matches=array(); $n=preg_match_all($pattern,file_get_contents($file),$matches); $messages=array(); for($i=0; $i<$n; $i++) { if($matches[...
php
public function load($file,$context) { $pattern='/(msgctxt\s+"(.*?(?<!\\\\))")?\s+' .'msgid\s+((?:".*(?<!\\\\)"\s*)+)\s+' .'msgstr\s+((?:".*(?<!\\\\)"\s*)+)/'; $matches=array(); $n=preg_match_all($pattern,file_get_contents($file),$matches); $messages=array(); for($i=0; $i<$n; $i++) { if($matches[...
[ "public", "function", "load", "(", "$", "file", ",", "$", "context", ")", "{", "$", "pattern", "=", "'/(msgctxt\\s+\"(.*?(?<!\\\\\\\\))\")?\\s+'", ".", "'msgid\\s+((?:\".*(?<!\\\\\\\\)\"\\s*)+)\\s+'", ".", "'msgstr\\s+((?:\".*(?<!\\\\\\\\)\"\\s*)+)/'", ";", "$", "matches", ...
Loads messages from a PO file. @param string $file file path @param string $context message context @return array message translations (source message => translated message)
[ "Loads", "messages", "from", "a", "PO", "file", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/gettext/CGettextPoFile.php#L26-L45
train
yiisoft/yii
framework/cli/commands/shell/ModelCommand.php
ModelCommand.generateClassNames
protected function generateClassNames($schema,$pattern=null) { $this->_tables=array(); foreach($schema->getTableNames() as $name) { if($pattern===null) $this->_tables[$name]=$this->generateClassName($this->removePrefix($name)); elseif(preg_match($pattern,$name,$matches)) { if(count($matches)>1 &...
php
protected function generateClassNames($schema,$pattern=null) { $this->_tables=array(); foreach($schema->getTableNames() as $name) { if($pattern===null) $this->_tables[$name]=$this->generateClassName($this->removePrefix($name)); elseif(preg_match($pattern,$name,$matches)) { if(count($matches)>1 &...
[ "protected", "function", "generateClassNames", "(", "$", "schema", ",", "$", "pattern", "=", "null", ")", "{", "$", "this", "->", "_tables", "=", "array", "(", ")", ";", "foreach", "(", "$", "schema", "->", "getTableNames", "(", ")", "as", "$", "name",...
Generates the mapping table between table names and class names. @param CDbSchema $schema the database schema @param string $pattern a regular expression that may be used to filter table names
[ "Generates", "the", "mapping", "table", "between", "table", "names", "and", "class", "names", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/commands/shell/ModelCommand.php#L201-L217
train
yiisoft/yii
framework/zii/widgets/grid/CDataColumn.php
CDataColumn.init
public function init() { parent::init(); if($this->name===null) $this->sortable=false; if($this->name===null && $this->value===null) throw new CException(Yii::t('zii','Either "name" or "value" must be specified for CDataColumn.')); }
php
public function init() { parent::init(); if($this->name===null) $this->sortable=false; if($this->name===null && $this->value===null) throw new CException(Yii::t('zii','Either "name" or "value" must be specified for CDataColumn.')); }
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "$", "this", "->", "name", "===", "null", ")", "$", "this", "->", "sortable", "=", "false", ";", "if", "(", "$", "this", "->", "name", "===", "null", ...
Initializes the column.
[ "Initializes", "the", "column", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/grid/CDataColumn.php#L78-L85
train
yiisoft/yii
framework/zii/widgets/grid/CDataColumn.php
CDataColumn.getHeaderCellContent
public function getHeaderCellContent() { if($this->grid->enableSorting && $this->sortable && $this->name!==null) return $this->grid->dataProvider->getSort()->link($this->name,$this->header,array('class'=>'sort-link')); elseif($this->name!==null && $this->header===null) { if($this->grid->dataProvider instan...
php
public function getHeaderCellContent() { if($this->grid->enableSorting && $this->sortable && $this->name!==null) return $this->grid->dataProvider->getSort()->link($this->name,$this->header,array('class'=>'sort-link')); elseif($this->name!==null && $this->header===null) { if($this->grid->dataProvider instan...
[ "public", "function", "getHeaderCellContent", "(", ")", "{", "if", "(", "$", "this", "->", "grid", "->", "enableSorting", "&&", "$", "this", "->", "sortable", "&&", "$", "this", "->", "name", "!==", "null", ")", "return", "$", "this", "->", "grid", "->...
Returns the header cell content. This method will render a link that can trigger the sorting if the column is sortable. @return string the header cell content. @since 1.1.16
[ "Returns", "the", "header", "cell", "content", ".", "This", "method", "will", "render", "a", "link", "that", "can", "trigger", "the", "sorting", "if", "the", "column", "is", "sortable", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/grid/CDataColumn.php#L116-L129
train
yiisoft/yii
framework/caching/dependencies/CDirectoryCacheDependency.php
CDirectoryCacheDependency.generateDependentData
protected function generateDependentData() { if($this->directory!==null) return $this->generateTimestamps($this->directory); else throw new CException(Yii::t('yii','CDirectoryCacheDependency.directory cannot be empty.')); }
php
protected function generateDependentData() { if($this->directory!==null) return $this->generateTimestamps($this->directory); else throw new CException(Yii::t('yii','CDirectoryCacheDependency.directory cannot be empty.')); }
[ "protected", "function", "generateDependentData", "(", ")", "{", "if", "(", "$", "this", "->", "directory", "!==", "null", ")", "return", "$", "this", "->", "generateTimestamps", "(", "$", "this", "->", "directory", ")", ";", "else", "throw", "new", "CExce...
Generates the data needed to determine if dependency has been changed. This method returns the modification timestamps for files under the directory. @throws CException if {@link directory} is empty @return mixed the data needed to determine if dependency has been changed.
[ "Generates", "the", "data", "needed", "to", "determine", "if", "dependency", "has", "been", "changed", ".", "This", "method", "returns", "the", "modification", "timestamps", "for", "files", "under", "the", "directory", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/dependencies/CDirectoryCacheDependency.php#L66-L72
train
yiisoft/yii
framework/i18n/CLocale.php
CLocale.getInstance
public static function getInstance($id) { static $locales=array(); if(isset($locales[$id])) return $locales[$id]; else return $locales[$id]=new CLocale($id); }
php
public static function getInstance($id) { static $locales=array(); if(isset($locales[$id])) return $locales[$id]; else return $locales[$id]=new CLocale($id); }
[ "public", "static", "function", "getInstance", "(", "$", "id", ")", "{", "static", "$", "locales", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "locales", "[", "$", "id", "]", ")", ")", "return", "$", "locales", "[", "$", "id", "]",...
Returns the instance of the specified locale. Since the constructor of CLocale is protected, you can only use this method to obtain an instance of the specified locale. @param string $id the locale ID (e.g. en_US) @return CLocale the locale instance
[ "Returns", "the", "instance", "of", "the", "specified", "locale", ".", "Since", "the", "constructor", "of", "CLocale", "is", "protected", "you", "can", "only", "use", "this", "method", "to", "obtain", "an", "instance", "of", "the", "specified", "locale", "."...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CLocale.php#L58-L65
train
yiisoft/yii
framework/i18n/CLocale.php
CLocale.getMonthNames
public function getMonthNames($width='wide',$standAlone=false) { if($standAlone) return isset($this->_data['monthNamesSA'][$width]) ? $this->_data['monthNamesSA'][$width] : $this->_data['monthNames'][$width]; else return isset($this->_data['monthNames'][$width]) ? $this->_data['monthNames'][$width] : $this->...
php
public function getMonthNames($width='wide',$standAlone=false) { if($standAlone) return isset($this->_data['monthNamesSA'][$width]) ? $this->_data['monthNamesSA'][$width] : $this->_data['monthNames'][$width]; else return isset($this->_data['monthNames'][$width]) ? $this->_data['monthNames'][$width] : $this->...
[ "public", "function", "getMonthNames", "(", "$", "width", "=", "'wide'", ",", "$", "standAlone", "=", "false", ")", "{", "if", "(", "$", "standAlone", ")", "return", "isset", "(", "$", "this", "->", "_data", "[", "'monthNamesSA'", "]", "[", "$", "width...
Returns the month names in the specified width. @param string $width month name width. It can be 'wide', 'abbreviated' or 'narrow'. @param boolean $standAlone whether the month names should be returned in stand-alone format @return array month names indexed by month values (1-12)
[ "Returns", "the", "month", "names", "in", "the", "specified", "width", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CLocale.php#L217-L223
train
yiisoft/yii
framework/i18n/CLocale.php
CLocale.getWeekDayNames
public function getWeekDayNames($width='wide',$standAlone=false) { if($standAlone) return isset($this->_data['weekDayNamesSA'][$width]) ? $this->_data['weekDayNamesSA'][$width] : $this->_data['weekDayNames'][$width]; else return isset($this->_data['weekDayNames'][$width]) ? $this->_data['weekDayNames'][$widt...
php
public function getWeekDayNames($width='wide',$standAlone=false) { if($standAlone) return isset($this->_data['weekDayNamesSA'][$width]) ? $this->_data['weekDayNamesSA'][$width] : $this->_data['weekDayNames'][$width]; else return isset($this->_data['weekDayNames'][$width]) ? $this->_data['weekDayNames'][$widt...
[ "public", "function", "getWeekDayNames", "(", "$", "width", "=", "'wide'", ",", "$", "standAlone", "=", "false", ")", "{", "if", "(", "$", "standAlone", ")", "return", "isset", "(", "$", "this", "->", "_data", "[", "'weekDayNamesSA'", "]", "[", "$", "w...
Returns the week day names in the specified width. @param string $width weekday name width. It can be 'wide', 'abbreviated' or 'narrow'. @param boolean $standAlone whether the week day name should be returned in stand-alone format @return array the weekday names indexed by weekday values (0-6, 0 means Sunday, 1 Monday...
[ "Returns", "the", "week", "day", "names", "in", "the", "specified", "width", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CLocale.php#L246-L252
train
yiisoft/yii
framework/i18n/CLocale.php
CLocale.getLanguageID
public function getLanguageID($id) { // normalize id $id = $this->getCanonicalID($id); // remove sub tags if(($underscorePosition=strpos($id, '_'))!== false) { $id = substr($id, 0, $underscorePosition); } return $id; }
php
public function getLanguageID($id) { // normalize id $id = $this->getCanonicalID($id); // remove sub tags if(($underscorePosition=strpos($id, '_'))!== false) { $id = substr($id, 0, $underscorePosition); } return $id; }
[ "public", "function", "getLanguageID", "(", "$", "id", ")", "{", "// normalize id", "$", "id", "=", "$", "this", "->", "getCanonicalID", "(", "$", "id", ")", ";", "// remove sub tags", "if", "(", "(", "$", "underscorePosition", "=", "strpos", "(", "$", "...
Converts a locale ID to a language ID. A language ID consists of only the first group of letters before an underscore or dash. @param string $id the locale ID to be converted @return string the language ID @since 1.1.9
[ "Converts", "a", "locale", "ID", "to", "a", "language", "ID", ".", "A", "language", "ID", "consists", "of", "only", "the", "first", "group", "of", "letters", "before", "an", "underscore", "or", "dash", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CLocale.php#L330-L340
train
yiisoft/yii
framework/i18n/CLocale.php
CLocale.getScriptID
public function getScriptID($id) { // normalize id $id = $this->getCanonicalID($id); // find sub tags if(($underscorePosition=strpos($id, '_'))!==false) { $subTag = explode('_', $id); // script sub tags can be distinguished from territory sub tags by length if (strlen($subTag[1])===4) { $id =...
php
public function getScriptID($id) { // normalize id $id = $this->getCanonicalID($id); // find sub tags if(($underscorePosition=strpos($id, '_'))!==false) { $subTag = explode('_', $id); // script sub tags can be distinguished from territory sub tags by length if (strlen($subTag[1])===4) { $id =...
[ "public", "function", "getScriptID", "(", "$", "id", ")", "{", "// normalize id", "$", "id", "=", "$", "this", "->", "getCanonicalID", "(", "$", "id", ")", ";", "// find sub tags", "if", "(", "(", "$", "underscorePosition", "=", "strpos", "(", "$", "id",...
Converts a locale ID to a script ID. A script ID consists of only the last four characters after an underscore or dash. @param string $id the locale ID to be converted @return string the script ID @since 1.1.9
[ "Converts", "a", "locale", "ID", "to", "a", "script", "ID", ".", "A", "script", "ID", "consists", "of", "only", "the", "last", "four", "characters", "after", "an", "underscore", "or", "dash", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CLocale.php#L349-L372
train
yiisoft/yii
framework/i18n/CLocale.php
CLocale.getTerritoryID
public function getTerritoryID($id) { // normalize id $id = $this->getCanonicalID($id); // find sub tags if (($underscorePosition=strpos($id, '_'))!== false) { $subTag = explode('_', $id); // territory sub tags can be distinguished from script sub tags by length if (isset($subTag[2]) && strlen($subT...
php
public function getTerritoryID($id) { // normalize id $id = $this->getCanonicalID($id); // find sub tags if (($underscorePosition=strpos($id, '_'))!== false) { $subTag = explode('_', $id); // territory sub tags can be distinguished from script sub tags by length if (isset($subTag[2]) && strlen($subT...
[ "public", "function", "getTerritoryID", "(", "$", "id", ")", "{", "// normalize id", "$", "id", "=", "$", "this", "->", "getCanonicalID", "(", "$", "id", ")", ";", "// find sub tags", "if", "(", "(", "$", "underscorePosition", "=", "strpos", "(", "$", "i...
Converts a locale ID to a territory ID. A territory ID consists of only the last two to three letter or digits after an underscore or dash. @param string $id the locale ID to be converted @return string the territory ID @since 1.1.9
[ "Converts", "a", "locale", "ID", "to", "a", "territory", "ID", ".", "A", "territory", "ID", "consists", "of", "only", "the", "last", "two", "to", "three", "letter", "or", "digits", "after", "an", "underscore", "or", "dash", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CLocale.php#L381-L408
train
yiisoft/yii
framework/collections/CAttributeCollection.php
CAttributeCollection.__isset
public function __isset($name) { if($this->contains($name)) return $this->itemAt($name)!==null; else return parent::__isset($name); }
php
public function __isset($name) { if($this->contains($name)) return $this->itemAt($name)!==null; else return parent::__isset($name); }
[ "public", "function", "__isset", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "contains", "(", "$", "name", ")", ")", "return", "$", "this", "->", "itemAt", "(", "$", "name", ")", "!==", "null", ";", "else", "return", "parent", "::", ...
Checks if a property value is null. This method overrides the parent implementation by checking if the key exists in the collection and contains a non-null value. @param string $name the property name or the event name @return boolean whether the property value is null
[ "Checks", "if", "a", "property", "value", "is", "null", ".", "This", "method", "overrides", "the", "parent", "implementation", "by", "checking", "if", "the", "key", "exists", "in", "the", "collection", "and", "contains", "a", "non", "-", "null", "value", "...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/collections/CAttributeCollection.php#L74-L80
train
yiisoft/yii
framework/collections/CAttributeCollection.php
CAttributeCollection.mergeWith
public function mergeWith($data,$recursive=true) { if(!$this->caseSensitive && (is_array($data) || $data instanceof Traversable)) { $d=array(); foreach($data as $key=>$value) $d[strtolower($key)]=$value; return parent::mergeWith($d,$recursive); } parent::mergeWith($data,$recursive); }
php
public function mergeWith($data,$recursive=true) { if(!$this->caseSensitive && (is_array($data) || $data instanceof Traversable)) { $d=array(); foreach($data as $key=>$value) $d[strtolower($key)]=$value; return parent::mergeWith($d,$recursive); } parent::mergeWith($data,$recursive); }
[ "public", "function", "mergeWith", "(", "$", "data", ",", "$", "recursive", "=", "true", ")", "{", "if", "(", "!", "$", "this", "->", "caseSensitive", "&&", "(", "is_array", "(", "$", "data", ")", "||", "$", "data", "instanceof", "Traversable", ")", ...
Merges iterable data into the map. Existing elements in the map will be overwritten if their keys are the same as those in the source. If the merge is recursive, the following algorithm is performed: <ul> <li>the map data is saved as $a, and the source data is saved as $b;</li> <li>if $a and $b both have an array inde...
[ "Merges", "iterable", "data", "into", "the", "map", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/collections/CAttributeCollection.php#L202-L212
train
yiisoft/yii
framework/web/CDataProvider.php
CDataProvider.getPagination
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; }
php
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; }
[ "public", "function", "getPagination", "(", "$", "className", "=", "'CPagination'", ")", "{", "if", "(", "$", "this", "->", "_pagination", "===", "null", ")", "{", "$", "this", "->", "_pagination", "=", "new", "$", "className", ";", "if", "(", "(", "$"...
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.
[ "Returns", "the", "pagination", "object", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDataProvider.php#L69-L78
train
yiisoft/yii
framework/web/CDataProvider.php
CDataProvider.getSort
public function getSort($className='CSort') { if($this->_sort===null) { $this->_sort=new $className; if(($id=$this->getId())!='') $this->_sort->sortVar=$id.'_sort'; } return $this->_sort; }
php
public function getSort($className='CSort') { if($this->_sort===null) { $this->_sort=new $className; if(($id=$this->getId())!='') $this->_sort->sortVar=$id.'_sort'; } return $this->_sort; }
[ "public", "function", "getSort", "(", "$", "className", "=", "'CSort'", ")", "{", "if", "(", "$", "this", "->", "_sort", "===", "null", ")", "{", "$", "this", "->", "_sort", "=", "new", "$", "className", ";", "if", "(", "(", "$", "id", "=", "$", ...
Returns the sort object. @param string $className the sorting object class name. Parameter is available since version 1.1.13. @return CSort|false the sorting object. If this is false, it means the sorting is disabled.
[ "Returns", "the", "sort", "object", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDataProvider.php#L117-L126
train
yiisoft/yii
framework/web/CDataProvider.php
CDataProvider.getData
public function getData($refresh=false) { if($this->_data===null || $refresh) $this->_data=$this->fetchData(); return $this->_data; }
php
public function getData($refresh=false) { if($this->_data===null || $refresh) $this->_data=$this->fetchData(); return $this->_data; }
[ "public", "function", "getData", "(", "$", "refresh", "=", "false", ")", "{", "if", "(", "$", "this", "->", "_data", "===", "null", "||", "$", "refresh", ")", "$", "this", "->", "_data", "=", "$", "this", "->", "fetchData", "(", ")", ";", "return",...
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.
[ "Returns", "the", "data", "items", "currently", "available", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDataProvider.php#L165-L170
train
yiisoft/yii
framework/web/CDataProvider.php
CDataProvider.getKeys
public function getKeys($refresh=false) { if($this->_keys===null || $refresh) $this->_keys=$this->fetchKeys(); return $this->_keys; }
php
public function getKeys($refresh=false) { if($this->_keys===null || $refresh) $this->_keys=$this->fetchKeys(); return $this->_keys; }
[ "public", "function", "getKeys", "(", "$", "refresh", "=", "false", ")", "{", "if", "(", "$", "this", "->", "_keys", "===", "null", "||", "$", "refresh", ")", "$", "this", "->", "_keys", "=", "$", "this", "->", "fetchKeys", "(", ")", ";", "return",...
Returns the key values associated with the data items. @param boolean $refresh whether the keys should be re-calculated. @return array the list of key values corresponding to {@link data}. Each data item in {@link data} is uniquely identified by the corresponding key value in this array.
[ "Returns", "the", "key", "values", "associated", "with", "the", "data", "items", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDataProvider.php#L187-L192
train
yiisoft/yii
framework/web/auth/CAuthItem.php
CAuthItem.assign
public function assign($userId,$bizRule=null,$data=null) { return $this->_auth->assign($this->_name,$userId,$bizRule,$data); }
php
public function assign($userId,$bizRule=null,$data=null) { return $this->_auth->assign($this->_name,$userId,$bizRule,$data); }
[ "public", "function", "assign", "(", "$", "userId", ",", "$", "bizRule", "=", "null", ",", "$", "data", "=", "null", ")", "{", "return", "$", "this", "->", "_auth", "->", "assign", "(", "$", "this", "->", "_name", ",", "$", "userId", ",", "$", "b...
Assigns this item to a user. @param mixed $userId the user ID (see {@link IWebUser::getId}) @param string $bizRule the business rule to be executed when {@link checkAccess} is called for this particular authorization item. @param mixed $data additional data associated with this assignment @return CAuthAssignment the au...
[ "Assigns", "this", "item", "to", "a", "user", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CAuthItem.php#L239-L242
train
yiisoft/yii
build/commands/lite/protected/controllers/SiteController.php
SiteController.actionLogin
public function actionLogin() { $user=new LoginForm; if(Yii::app()->request->isPostRequest) { // collect user input data if(isset($_POST['LoginForm'])) $user->setAttributes($_POST['LoginForm']); // validate user input and redirect to previous page if valid if($user->validate()) $this->redirec...
php
public function actionLogin() { $user=new LoginForm; if(Yii::app()->request->isPostRequest) { // collect user input data if(isset($_POST['LoginForm'])) $user->setAttributes($_POST['LoginForm']); // validate user input and redirect to previous page if valid if($user->validate()) $this->redirec...
[ "public", "function", "actionLogin", "(", ")", "{", "$", "user", "=", "new", "LoginForm", ";", "if", "(", "Yii", "::", "app", "(", ")", "->", "request", "->", "isPostRequest", ")", "{", "// collect user input data", "if", "(", "isset", "(", "$", "_POST",...
Displays a login form to login a user.
[ "Displays", "a", "login", "form", "to", "login", "a", "user", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/controllers/SiteController.php#L33-L47
train
yiisoft/yii
framework/web/auth/CDbAuthManager.php
CDbAuthManager.hasItemChild
public function hasItemChild($itemName,$childName) { return $this->db->createCommand() ->select('parent') ->from($this->itemChildTable) ->where('parent=:parent AND child=:child', array( ':parent'=>$itemName, ':child'=>$childName)) ->queryScalar() !== false; }
php
public function hasItemChild($itemName,$childName) { return $this->db->createCommand() ->select('parent') ->from($this->itemChildTable) ->where('parent=:parent AND child=:child', array( ':parent'=>$itemName, ':child'=>$childName)) ->queryScalar() !== false; }
[ "public", "function", "hasItemChild", "(", "$", "itemName", ",", "$", "childName", ")", "{", "return", "$", "this", "->", "db", "->", "createCommand", "(", ")", "->", "select", "(", "'parent'", ")", "->", "from", "(", "$", "this", "->", "itemChildTable",...
Returns a value indicating whether a child exists within a parent. @param string $itemName the parent item name @param string $childName the child item name @return boolean whether the child exists
[ "Returns", "a", "value", "indicating", "whether", "a", "child", "exists", "within", "a", "parent", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CDbAuthManager.php#L195-L204
train
yiisoft/yii
framework/web/auth/CDbAuthManager.php
CDbAuthManager.isAssigned
public function isAssigned($itemName,$userId) { return $this->db->createCommand() ->select('itemname') ->from($this->assignmentTable) ->where('itemname=:itemname AND userid=:userid', array( ':itemname'=>$itemName, ':userid'=>$userId)) ->queryScalar() !== false; }
php
public function isAssigned($itemName,$userId) { return $this->db->createCommand() ->select('itemname') ->from($this->assignmentTable) ->where('itemname=:itemname AND userid=:userid', array( ':itemname'=>$itemName, ':userid'=>$userId)) ->queryScalar() !== false; }
[ "public", "function", "isAssigned", "(", "$", "itemName", ",", "$", "userId", ")", "{", "return", "$", "this", "->", "db", "->", "createCommand", "(", ")", "->", "select", "(", "'itemname'", ")", "->", "from", "(", "$", "this", "->", "assignmentTable", ...
Returns a value indicating whether the item has been assigned to the user. @param string $itemName the item name @param mixed $userId the user ID (see {@link IWebUser::getId}) @return boolean whether the item has been assigned to the user.
[ "Returns", "a", "value", "indicating", "whether", "the", "item", "has", "been", "assigned", "to", "the", "user", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CDbAuthManager.php#L288-L297
train
yiisoft/yii
framework/web/auth/CDbAuthManager.php
CDbAuthManager.getAuthAssignments
public function getAuthAssignments($userId) { $rows=$this->db->createCommand() ->select() ->from($this->assignmentTable) ->where('userid=:userid', array(':userid'=>$userId)) ->queryAll(); $assignments=array(); foreach($rows as $row) { if(($data=@unserialize($row['data']))===false) $data=null...
php
public function getAuthAssignments($userId) { $rows=$this->db->createCommand() ->select() ->from($this->assignmentTable) ->where('userid=:userid', array(':userid'=>$userId)) ->queryAll(); $assignments=array(); foreach($rows as $row) { if(($data=@unserialize($row['data']))===false) $data=null...
[ "public", "function", "getAuthAssignments", "(", "$", "userId", ")", "{", "$", "rows", "=", "$", "this", "->", "db", "->", "createCommand", "(", ")", "->", "select", "(", ")", "->", "from", "(", "$", "this", "->", "assignmentTable", ")", "->", "where",...
Returns the item assignments for the specified user. @param mixed $userId the user ID (see {@link IWebUser::getId}) @return array the item assignment information for the user. An empty array will be returned if there is no item assigned to the user.
[ "Returns", "the", "item", "assignments", "for", "the", "specified", "user", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CDbAuthManager.php#L331-L346
train
yiisoft/yii
framework/web/auth/CDbAuthManager.php
CDbAuthManager.saveAuthAssignment
public function saveAuthAssignment($assignment) { $this->db->createCommand() ->update($this->assignmentTable, array( 'bizrule'=>$assignment->getBizRule(), 'data'=>serialize($assignment->getData()), ), 'itemname=:itemname AND userid=:userid', array( 'itemname'=>$assignment->getItemName(), 'useri...
php
public function saveAuthAssignment($assignment) { $this->db->createCommand() ->update($this->assignmentTable, array( 'bizrule'=>$assignment->getBizRule(), 'data'=>serialize($assignment->getData()), ), 'itemname=:itemname AND userid=:userid', array( 'itemname'=>$assignment->getItemName(), 'useri...
[ "public", "function", "saveAuthAssignment", "(", "$", "assignment", ")", "{", "$", "this", "->", "db", "->", "createCommand", "(", ")", "->", "update", "(", "$", "this", "->", "assignmentTable", ",", "array", "(", "'bizrule'", "=>", "$", "assignment", "->"...
Saves the changes to an authorization assignment. @param CAuthAssignment $assignment the assignment that has been changed.
[ "Saves", "the", "changes", "to", "an", "authorization", "assignment", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CDbAuthManager.php#L352-L362
train
yiisoft/yii
framework/web/auth/CDbAuthManager.php
CDbAuthManager.clearAll
public function clearAll() { $this->clearAuthAssignments(); $this->db->createCommand()->delete($this->itemChildTable); $this->db->createCommand()->delete($this->itemTable); }
php
public function clearAll() { $this->clearAuthAssignments(); $this->db->createCommand()->delete($this->itemChildTable); $this->db->createCommand()->delete($this->itemTable); }
[ "public", "function", "clearAll", "(", ")", "{", "$", "this", "->", "clearAuthAssignments", "(", ")", ";", "$", "this", "->", "db", "->", "createCommand", "(", ")", "->", "delete", "(", "$", "this", "->", "itemChildTable", ")", ";", "$", "this", "->", ...
Removes all authorization data.
[ "Removes", "all", "authorization", "data", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CDbAuthManager.php#L548-L553
train
yiisoft/yii
framework/validators/CEmailValidator.php
CEmailValidator.validateValue
public function validateValue($value) { if(is_string($value) && $this->validateIDN) $value=$this->encodeIDN($value); // make sure string length is limited to avoid DOS attacks $valid=is_string($value) && strlen($value)<=254 && (preg_match($this->pattern,$value) || $this->allowName && preg_match($this->fullPat...
php
public function validateValue($value) { if(is_string($value) && $this->validateIDN) $value=$this->encodeIDN($value); // make sure string length is limited to avoid DOS attacks $valid=is_string($value) && strlen($value)<=254 && (preg_match($this->pattern,$value) || $this->allowName && preg_match($this->fullPat...
[ "public", "function", "validateValue", "(", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", "&&", "$", "this", "->", "validateIDN", ")", "$", "value", "=", "$", "this", "->", "encodeIDN", "(", "$", "value", ")", ";", "// make ...
Validates a static value to see if it is a valid email. This method is provided so that you can call it directly without going through the model validation rule mechanism. Note that this method does not respect the {@link allowEmpty} property. @param mixed $value the value to be validated @return boolean whether the ...
[ "Validates", "a", "static", "value", "to", "see", "if", "it", "is", "a", "valid", "email", ".", "This", "method", "is", "provided", "so", "that", "you", "can", "call", "it", "directly", "without", "going", "through", "the", "model", "validation", "rule", ...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/validators/CEmailValidator.php#L98-L111
train
yiisoft/yii
framework/validators/CBooleanValidator.php
CBooleanValidator.validateValue
public function validateValue($value) { if ($this->strict) return $value===$this->trueValue || $value===$this->falseValue; else return $value==$this->trueValue || $value==$this->falseValue; }
php
public function validateValue($value) { if ($this->strict) return $value===$this->trueValue || $value===$this->falseValue; else return $value==$this->trueValue || $value==$this->falseValue; }
[ "public", "function", "validateValue", "(", "$", "value", ")", "{", "if", "(", "$", "this", "->", "strict", ")", "return", "$", "value", "===", "$", "this", "->", "trueValue", "||", "$", "value", "===", "$", "this", "->", "falseValue", ";", "else", "...
Validates a static value to see if it is a valid boolean. This method is provided so that you can call it directly without going through the model validation rule mechanism. Note that this method does not respect the {@link allowEmpty} property. @param mixed $value the value to be validated @return boolean whether th...
[ "Validates", "a", "static", "value", "to", "see", "if", "it", "is", "a", "valid", "boolean", ".", "This", "method", "is", "provided", "so", "that", "you", "can", "call", "it", "directly", "without", "going", "through", "the", "model", "validation", "rule",...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/validators/CBooleanValidator.php#L81-L87
train
yiisoft/yii
framework/caching/CRedisCache.php
CRedisCache.parseResponse
private function parseResponse() { if(($line=fgets($this->_socket))===false) throw new CException('Failed reading data from redis connection socket.'); $type=$line[0]; $line=substr($line,1,-2); switch($type) { case '+': // Status reply return true; case '-': // Error reply throw new CExcepti...
php
private function parseResponse() { if(($line=fgets($this->_socket))===false) throw new CException('Failed reading data from redis connection socket.'); $type=$line[0]; $line=substr($line,1,-2); switch($type) { case '+': // Status reply return true; case '-': // Error reply throw new CExcepti...
[ "private", "function", "parseResponse", "(", ")", "{", "if", "(", "(", "$", "line", "=", "fgets", "(", "$", "this", "->", "_socket", ")", ")", "===", "false", ")", "throw", "new", "CException", "(", "'Failed reading data from redis connection socket.'", ")", ...
Reads the result from socket and parses it @return array|bool|null|string @throws CException socket or data problems
[ "Reads", "the", "result", "from", "socket", "and", "parses", "it" ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/CRedisCache.php#L143-L180
train
yiisoft/yii
demos/blog/protected/models/Lookup.php
Lookup.item
public static function item($type,$code) { if(!isset(self::$_items[$type])) self::loadItems($type); return isset(self::$_items[$type][$code]) ? self::$_items[$type][$code] : false; }
php
public static function item($type,$code) { if(!isset(self::$_items[$type])) self::loadItems($type); return isset(self::$_items[$type][$code]) ? self::$_items[$type][$code] : false; }
[ "public", "static", "function", "item", "(", "$", "type", ",", "$", "code", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "_items", "[", "$", "type", "]", ")", ")", "self", "::", "loadItems", "(", "$", "type", ")", ";", "return", "...
Returns the item name for the specified type and code. @param string the item type (e.g. 'PostStatus'). @param integer the item code (corresponding to the 'code' column value) @return string the item name for the specified the code. False is returned if the item type or code does not exist.
[ "Returns", "the", "item", "name", "for", "the", "specified", "type", "and", "code", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/models/Lookup.php#L52-L57
train
yiisoft/yii
demos/blog/protected/models/Lookup.php
Lookup.loadItems
private static function loadItems($type) { self::$_items[$type]=array(); $models=self::model()->findAll(array( 'condition'=>'type=:type', 'params'=>array(':type'=>$type), 'order'=>'position', )); foreach($models as $model) self::$_items[$type][$model->code]=$model->name; }
php
private static function loadItems($type) { self::$_items[$type]=array(); $models=self::model()->findAll(array( 'condition'=>'type=:type', 'params'=>array(':type'=>$type), 'order'=>'position', )); foreach($models as $model) self::$_items[$type][$model->code]=$model->name; }
[ "private", "static", "function", "loadItems", "(", "$", "type", ")", "{", "self", "::", "$", "_items", "[", "$", "type", "]", "=", "array", "(", ")", ";", "$", "models", "=", "self", "::", "model", "(", ")", "->", "findAll", "(", "array", "(", "'...
Loads the lookup items for the specified type from the database. @param string the item type
[ "Loads", "the", "lookup", "items", "for", "the", "specified", "type", "from", "the", "database", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/models/Lookup.php#L63-L73
train
yiisoft/yii
framework/caching/dependencies/CCacheDependency.php
CCacheDependency.getHash
private function getHash() { if($this->_hash===null) $this->_hash=sha1(serialize($this)); return $this->_hash; }
php
private function getHash() { if($this->_hash===null) $this->_hash=sha1(serialize($this)); return $this->_hash; }
[ "private", "function", "getHash", "(", ")", "{", "if", "(", "$", "this", "->", "_hash", "===", "null", ")", "$", "this", "->", "_hash", "=", "sha1", "(", "serialize", "(", "$", "this", ")", ")", ";", "return", "$", "this", "->", "_hash", ";", "}"...
Generates a unique hash that identifies this cache dependency. @return string the hash for this cache dependency
[ "Generates", "a", "unique", "hash", "that", "identifies", "this", "cache", "dependency", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/dependencies/CCacheDependency.php#L111-L116
train
yiisoft/yii
framework/web/form/CForm.php
CForm.submitted
public function submitted($buttonName='submit',$loadData=true) { $ret=$this->clicked($this->getUniqueId()) && $this->clicked($buttonName); if($ret && $loadData) $this->loadData(); return $ret; }
php
public function submitted($buttonName='submit',$loadData=true) { $ret=$this->clicked($this->getUniqueId()) && $this->clicked($buttonName); if($ret && $loadData) $this->loadData(); return $ret; }
[ "public", "function", "submitted", "(", "$", "buttonName", "=", "'submit'", ",", "$", "loadData", "=", "true", ")", "{", "$", "ret", "=", "$", "this", "->", "clicked", "(", "$", "this", "->", "getUniqueId", "(", ")", ")", "&&", "$", "this", "->", "...
Returns a value indicating whether this form is submitted. @param string $buttonName the name of the submit button @param boolean $loadData whether to call {@link loadData} if the form is submitted so that the submitted data can be populated to the associated models. @return boolean whether this form is submitted. @see...
[ "Returns", "a", "value", "indicating", "whether", "this", "form", "is", "submitted", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CForm.php#L202-L208
train
yiisoft/yii
framework/web/form/CForm.php
CForm.clicked
public function clicked($name) { if(strcasecmp($this->getRoot()->method,'get')) return isset($_POST[$name]); else return isset($_GET[$name]); }
php
public function clicked($name) { if(strcasecmp($this->getRoot()->method,'get')) return isset($_POST[$name]); else return isset($_GET[$name]); }
[ "public", "function", "clicked", "(", "$", "name", ")", "{", "if", "(", "strcasecmp", "(", "$", "this", "->", "getRoot", "(", ")", "->", "method", ",", "'get'", ")", ")", "return", "isset", "(", "$", "_POST", "[", "$", "name", "]", ")", ";", "els...
Returns a value indicating whether the specified button is clicked. @param string $name the button name @return boolean whether the button is clicked.
[ "Returns", "a", "value", "indicating", "whether", "the", "specified", "button", "is", "clicked", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CForm.php#L215-L221
train
yiisoft/yii
framework/web/form/CForm.php
CForm.getModel
public function getModel($checkParent=true) { if(!$checkParent) return $this->_model; $form=$this; while($form->_model===null && $form->getParent() instanceof self) $form=$form->getParent(); return $form->_model; }
php
public function getModel($checkParent=true) { if(!$checkParent) return $this->_model; $form=$this; while($form->_model===null && $form->getParent() instanceof self) $form=$form->getParent(); return $form->_model; }
[ "public", "function", "getModel", "(", "$", "checkParent", "=", "true", ")", "{", "if", "(", "!", "$", "checkParent", ")", "return", "$", "this", "->", "_model", ";", "$", "form", "=", "$", "this", ";", "while", "(", "$", "form", "->", "_model", "=...
Returns the model that this form is associated with. @param boolean $checkParent whether to return parent's model if this form doesn't have model by itself. @return CModel the model associated with this form. If this form does not have a model, it will look for a model in its ancestors.
[ "Returns", "the", "model", "that", "this", "form", "is", "associated", "with", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CForm.php#L306-L314
train
yiisoft/yii
framework/web/form/CForm.php
CForm.getModels
public function getModels() { $models=array(); if($this->_model!==null) $models[]=$this->_model; foreach($this->getElements() as $element) { if($element instanceof self) $models=array_merge($models,$element->getModels()); } return $models; }
php
public function getModels() { $models=array(); if($this->_model!==null) $models[]=$this->_model; foreach($this->getElements() as $element) { if($element instanceof self) $models=array_merge($models,$element->getModels()); } return $models; }
[ "public", "function", "getModels", "(", ")", "{", "$", "models", "=", "array", "(", ")", ";", "if", "(", "$", "this", "->", "_model", "!==", "null", ")", "$", "models", "[", "]", "=", "$", "this", "->", "_model", ";", "foreach", "(", "$", "this",...
Returns all models that are associated with this form or its sub-forms. @return array the models that are associated with this form or its sub-forms.
[ "Returns", "all", "models", "that", "are", "associated", "with", "this", "form", "or", "its", "sub", "-", "forms", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CForm.php#L328-L339
train
yiisoft/yii
framework/web/form/CForm.php
CForm.getUniqueId
protected function getUniqueId() { if(isset($this->attributes['id'])) return 'yform_'.$this->attributes['id']; else return 'yform_'.sprintf('%x',crc32(serialize(array_keys($this->getElements()->toArray())))); }
php
protected function getUniqueId() { if(isset($this->attributes['id'])) return 'yform_'.$this->attributes['id']; else return 'yform_'.sprintf('%x',crc32(serialize(array_keys($this->getElements()->toArray())))); }
[ "protected", "function", "getUniqueId", "(", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "attributes", "[", "'id'", "]", ")", ")", "return", "'yform_'", ".", "$", "this", "->", "attributes", "[", "'id'", "]", ";", "else", "return", "'yform_'"...
Returns a unique ID that identifies this form in the current page. @return string the unique ID identifying this form
[ "Returns", "a", "unique", "ID", "that", "identifies", "this", "form", "in", "the", "current", "page", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CForm.php#L593-L599
train
yiisoft/yii
framework/validators/CUrlValidator.php
CUrlValidator.encodeIDN
private function encodeIDN($value) { if(preg_match_all('/^(.*):\/\/([^\/]+)(.*)$/',$value,$matches)) { if(function_exists('idn_to_ascii')) $value=$matches[1][0].'://'.idn_to_ascii($matches[2][0]).$matches[3][0]; else { require_once(Yii::getPathOfAlias('system.vendors.Net_IDNA2.Net').DIRECTORY_SEPA...
php
private function encodeIDN($value) { if(preg_match_all('/^(.*):\/\/([^\/]+)(.*)$/',$value,$matches)) { if(function_exists('idn_to_ascii')) $value=$matches[1][0].'://'.idn_to_ascii($matches[2][0]).$matches[3][0]; else { require_once(Yii::getPathOfAlias('system.vendors.Net_IDNA2.Net').DIRECTORY_SEPA...
[ "private", "function", "encodeIDN", "(", "$", "value", ")", "{", "if", "(", "preg_match_all", "(", "'/^(.*):\\/\\/([^\\/]+)(.*)$/'", ",", "$", "value", ",", "$", "matches", ")", ")", "{", "if", "(", "function_exists", "(", "'idn_to_ascii'", ")", ")", "$", ...
Converts given IDN to the punycode. @param string $value IDN to be converted. @return string resulting punycode. @since 1.1.13
[ "Converts", "given", "IDN", "to", "the", "punycode", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/validators/CUrlValidator.php#L167-L181
train
yiisoft/yii
framework/validators/CUrlValidator.php
CUrlValidator.decodeIDN
private function decodeIDN($value) { if(preg_match_all('/^(.*):\/\/([^\/]+)(.*)$/',$value,$matches)) { if(function_exists('idn_to_utf8')) $value=$matches[1][0].'://'.idn_to_utf8($matches[2][0]).$matches[3][0]; else { require_once(Yii::getPathOfAlias('system.vendors.Net_IDNA2.Net').DIRECTORY_SEPARA...
php
private function decodeIDN($value) { if(preg_match_all('/^(.*):\/\/([^\/]+)(.*)$/',$value,$matches)) { if(function_exists('idn_to_utf8')) $value=$matches[1][0].'://'.idn_to_utf8($matches[2][0]).$matches[3][0]; else { require_once(Yii::getPathOfAlias('system.vendors.Net_IDNA2.Net').DIRECTORY_SEPARA...
[ "private", "function", "decodeIDN", "(", "$", "value", ")", "{", "if", "(", "preg_match_all", "(", "'/^(.*):\\/\\/([^\\/]+)(.*)$/'", ",", "$", "value", ",", "$", "matches", ")", ")", "{", "if", "(", "function_exists", "(", "'idn_to_utf8'", ")", ")", "$", "...
Converts given punycode to the IDN. @param string $value punycode to be converted. @return string resulting IDN. @since 1.1.13
[ "Converts", "given", "punycode", "to", "the", "IDN", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/validators/CUrlValidator.php#L189-L203
train
yiisoft/yii
framework/zii/widgets/CMenu.php
CMenu.renderMenu
protected function renderMenu($items) { if(count($items)) { echo CHtml::openTag('ul',$this->htmlOptions)."\n"; $this->renderMenuRecursive($items); echo CHtml::closeTag('ul'); } }
php
protected function renderMenu($items) { if(count($items)) { echo CHtml::openTag('ul',$this->htmlOptions)."\n"; $this->renderMenuRecursive($items); echo CHtml::closeTag('ul'); } }
[ "protected", "function", "renderMenu", "(", "$", "items", ")", "{", "if", "(", "count", "(", "$", "items", ")", ")", "{", "echo", "CHtml", "::", "openTag", "(", "'ul'", ",", "$", "this", "->", "htmlOptions", ")", ".", "\"\\n\"", ";", "$", "this", "...
Renders the menu items. @param array $items menu items. Each menu item will be an array with at least two elements: 'label' and 'active'. It may have three other optional elements: 'items', 'linkOptions' and 'itemOptions'.
[ "Renders", "the", "menu", "items", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/CMenu.php#L177-L185
train
yiisoft/yii
framework/zii/widgets/CMenu.php
CMenu.renderMenuRecursive
protected function renderMenuRecursive($items) { $count=0; $n=count($items); foreach($items as $item) { $count++; $options=isset($item['itemOptions']) ? $item['itemOptions'] : array(); $class=array(); if($item['active'] && $this->activeCssClass!='') $class[]=$this->activeCssClass; if($count=...
php
protected function renderMenuRecursive($items) { $count=0; $n=count($items); foreach($items as $item) { $count++; $options=isset($item['itemOptions']) ? $item['itemOptions'] : array(); $class=array(); if($item['active'] && $this->activeCssClass!='') $class[]=$this->activeCssClass; if($count=...
[ "protected", "function", "renderMenuRecursive", "(", "$", "items", ")", "{", "$", "count", "=", "0", ";", "$", "n", "=", "count", "(", "$", "items", ")", ";", "foreach", "(", "$", "items", "as", "$", "item", ")", "{", "$", "count", "++", ";", "$"...
Recursively renders the menu items. @param array $items the menu items to be rendered recursively
[ "Recursively", "renders", "the", "menu", "items", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/CMenu.php#L191-L236
train
yiisoft/yii
framework/db/schema/mysql/CMysqlCommandBuilder.php
CMysqlCommandBuilder.applyJoin
public function applyJoin($sql,$join) { if($join=='') return $sql; if(strpos($sql,'UPDATE')===0 && ($pos=strpos($sql,'SET'))!==false) return substr($sql,0,$pos).$join.' '.substr($sql,$pos); elseif(strpos($sql,'DELETE FROM ')===0) { $tableName=substr($sql,12); return "DELETE {$tableName} FROM {$tab...
php
public function applyJoin($sql,$join) { if($join=='') return $sql; if(strpos($sql,'UPDATE')===0 && ($pos=strpos($sql,'SET'))!==false) return substr($sql,0,$pos).$join.' '.substr($sql,$pos); elseif(strpos($sql,'DELETE FROM ')===0) { $tableName=substr($sql,12); return "DELETE {$tableName} FROM {$tab...
[ "public", "function", "applyJoin", "(", "$", "sql", ",", "$", "join", ")", "{", "if", "(", "$", "join", "==", "''", ")", "return", "$", "sql", ";", "if", "(", "strpos", "(", "$", "sql", ",", "'UPDATE'", ")", "===", "0", "&&", "(", "$", "pos", ...
Alters the SQL to apply JOIN clause. This method handles the mysql specific syntax where JOIN has to come before SET in UPDATE statement and for DELETE where JOIN has to be after FROM part. @param string $sql the SQL statement to be altered @param string $join the JOIN clause (starting with join type, such as INNER JOI...
[ "Alters", "the", "SQL", "to", "apply", "JOIN", "clause", ".", "This", "method", "handles", "the", "mysql", "specific", "syntax", "where", "JOIN", "has", "to", "come", "before", "SET", "in", "UPDATE", "statement", "and", "for", "DELETE", "where", "JOIN", "h...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mysql/CMysqlCommandBuilder.php#L28-L42
train
yiisoft/yii
framework/validators/CDefaultValueValidator.php
CDefaultValueValidator.validateAttribute
protected function validateAttribute($object,$attribute) { if(!$this->setOnEmpty) $object->$attribute=$this->value; else { $value=$object->$attribute; if($value===null || $value==='') $object->$attribute=$this->value; } }
php
protected function validateAttribute($object,$attribute) { if(!$this->setOnEmpty) $object->$attribute=$this->value; else { $value=$object->$attribute; if($value===null || $value==='') $object->$attribute=$this->value; } }
[ "protected", "function", "validateAttribute", "(", "$", "object", ",", "$", "attribute", ")", "{", "if", "(", "!", "$", "this", "->", "setOnEmpty", ")", "$", "object", "->", "$", "attribute", "=", "$", "this", "->", "value", ";", "else", "{", "$", "v...
Validates the attribute of the object. @param CModel $object the object being validated @param string $attribute the attribute being validated
[ "Validates", "the", "attribute", "of", "the", "object", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/validators/CDefaultValueValidator.php#L38-L48
train
yiisoft/yii
framework/web/CActiveDataProvider.php
CActiveDataProvider.getSort
public function getSort($className='CSort') { if(($sort=parent::getSort($className))!==false) $sort->modelClass=$this->modelClass; return $sort; }
php
public function getSort($className='CSort') { if(($sort=parent::getSort($className))!==false) $sort->modelClass=$this->modelClass; return $sort; }
[ "public", "function", "getSort", "(", "$", "className", "=", "'CSort'", ")", "{", "if", "(", "(", "$", "sort", "=", "parent", "::", "getSort", "(", "$", "className", ")", ")", "!==", "false", ")", "$", "sort", "->", "modelClass", "=", "$", "this", ...
Returns the sorting object. @param string $className the sorting object class name. Parameter is available since version 1.1.13. @return CSort the sorting object. If this is false, it means the sorting is disabled.
[ "Returns", "the", "sorting", "object", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CActiveDataProvider.php#L148-L153
train
yiisoft/yii
framework/web/CActiveDataProvider.php
CActiveDataProvider.calculateTotalItemCount
protected function calculateTotalItemCount() { $baseCriteria=$this->model->getDbCriteria(false); if($baseCriteria!==null) $baseCriteria=clone $baseCriteria; $count=$this->model->count($this->getCountCriteria()); $this->model->setDbCriteria($baseCriteria); return $count; }
php
protected function calculateTotalItemCount() { $baseCriteria=$this->model->getDbCriteria(false); if($baseCriteria!==null) $baseCriteria=clone $baseCriteria; $count=$this->model->count($this->getCountCriteria()); $this->model->setDbCriteria($baseCriteria); return $count; }
[ "protected", "function", "calculateTotalItemCount", "(", ")", "{", "$", "baseCriteria", "=", "$", "this", "->", "model", "->", "getDbCriteria", "(", "false", ")", ";", "if", "(", "$", "baseCriteria", "!==", "null", ")", "$", "baseCriteria", "=", "clone", "...
Calculates the total number of data items. @return integer the total number of data items.
[ "Calculates", "the", "total", "number", "of", "data", "items", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CActiveDataProvider.php#L223-L231
train
yiisoft/yii
framework/console/CConsoleCommandRunner.php
CConsoleCommandRunner.run
public function run($args) { $this->_scriptName=$args[0]; array_shift($args); if(isset($args[0])) { $name=$args[0]; array_shift($args); } else $name='help'; $oldCommand=$this->_command; if(($command=$this->createCommand($name))===null) $command=$this->createCommand('help'); $this->_comma...
php
public function run($args) { $this->_scriptName=$args[0]; array_shift($args); if(isset($args[0])) { $name=$args[0]; array_shift($args); } else $name='help'; $oldCommand=$this->_command; if(($command=$this->createCommand($name))===null) $command=$this->createCommand('help'); $this->_comma...
[ "public", "function", "run", "(", "$", "args", ")", "{", "$", "this", "->", "_scriptName", "=", "$", "args", "[", "0", "]", ";", "array_shift", "(", "$", "args", ")", ";", "if", "(", "isset", "(", "$", "args", "[", "0", "]", ")", ")", "{", "$...
Executes the requested command. @param array $args list of user supplied parameters (including the entry script name and the command name). @return integer|null application exit code returned by the command. if null is returned, application will not exit explicitly. See also {@link CConsoleApplication::processRequest()...
[ "Executes", "the", "requested", "command", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommandRunner.php#L54-L74
train
yiisoft/yii
framework/console/CConsoleCommandRunner.php
CConsoleCommandRunner.findCommands
public function findCommands($path) { if(($dir=@opendir($path))===false) return array(); $commands=array(); while(($name=readdir($dir))!==false) { $file=$path.DIRECTORY_SEPARATOR.$name; if(!strcasecmp(substr($name,-11),'Command.php') && is_file($file)) $commands[strtolower(substr($name,0,-11))]=$f...
php
public function findCommands($path) { if(($dir=@opendir($path))===false) return array(); $commands=array(); while(($name=readdir($dir))!==false) { $file=$path.DIRECTORY_SEPARATOR.$name; if(!strcasecmp(substr($name,-11),'Command.php') && is_file($file)) $commands[strtolower(substr($name,0,-11))]=$f...
[ "public", "function", "findCommands", "(", "$", "path", ")", "{", "if", "(", "(", "$", "dir", "=", "@", "opendir", "(", "$", "path", ")", ")", "===", "false", ")", "return", "array", "(", ")", ";", "$", "commands", "=", "array", "(", ")", ";", ...
Searches for commands under the specified directory. @param string $path the directory containing the command class files. @return array list of commands (command name=>command class file)
[ "Searches", "for", "commands", "under", "the", "specified", "directory", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommandRunner.php#L108-L121
train
yiisoft/yii
framework/console/CConsoleCommandRunner.php
CConsoleCommandRunner.addCommands
public function addCommands($path) { if(($commands=$this->findCommands($path))!==array()) { foreach($commands as $name=>$file) { if(!isset($this->commands[$name])) $this->commands[$name]=$file; } } }
php
public function addCommands($path) { if(($commands=$this->findCommands($path))!==array()) { foreach($commands as $name=>$file) { if(!isset($this->commands[$name])) $this->commands[$name]=$file; } } }
[ "public", "function", "addCommands", "(", "$", "path", ")", "{", "if", "(", "(", "$", "commands", "=", "$", "this", "->", "findCommands", "(", "$", "path", ")", ")", "!==", "array", "(", ")", ")", "{", "foreach", "(", "$", "commands", "as", "$", ...
Adds commands from the specified command path. If a command already exists, the new one will be ignored. @param string $path the alias of the directory containing the command class files.
[ "Adds", "commands", "from", "the", "specified", "command", "path", ".", "If", "a", "command", "already", "exists", "the", "new", "one", "will", "be", "ignored", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommandRunner.php#L128-L138
train
yiisoft/yii
framework/zii/widgets/jui/CJuiDialog.php
CJuiDialog.init
public function init() { parent::init(); $id=$this->getId(); if(isset($this->htmlOptions['id'])) $id=$this->htmlOptions['id']; else $this->htmlOptions['id']=$id; $options=CJavaScript::encode($this->options); Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}').dialog($o...
php
public function init() { parent::init(); $id=$this->getId(); if(isset($this->htmlOptions['id'])) $id=$this->htmlOptions['id']; else $this->htmlOptions['id']=$id; $options=CJavaScript::encode($this->options); Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}').dialog($o...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "$", "id", "=", "$", "this", "->", "getId", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "htmlOptions", "[", "'id'", "]", ")", ")", "$", "id", "...
Renders the open tag of the dialog. This method also registers the necessary javascript code.
[ "Renders", "the", "open", "tag", "of", "the", "dialog", ".", "This", "method", "also", "registers", "the", "necessary", "javascript", "code", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/jui/CJuiDialog.php#L62-L76
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.getLastInsertID
public function getLastInsertID($table) { $this->ensureTable($table); if($table->sequenceName!==null) return $this->_connection->getLastInsertID($table->sequenceName); else return null; }
php
public function getLastInsertID($table) { $this->ensureTable($table); if($table->sequenceName!==null) return $this->_connection->getLastInsertID($table->sequenceName); else return null; }
[ "public", "function", "getLastInsertID", "(", "$", "table", ")", "{", "$", "this", "->", "ensureTable", "(", "$", "table", ")", ";", "if", "(", "$", "table", "->", "sequenceName", "!==", "null", ")", "return", "$", "this", "->", "_connection", "->", "g...
Returns the last insertion ID for the specified table. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @return mixed last insertion id. Null is returned if no sequence name.
[ "Returns", "the", "last", "insertion", "ID", "for", "the", "specified", "table", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L58-L65
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.createFindCommand
public function createFindCommand($table,$criteria,$alias='t') { $this->ensureTable($table); $select=is_array($criteria->select) ? implode(', ',$criteria->select) : $criteria->select; if($criteria->alias!='') $alias=$criteria->alias; $alias=$this->_schema->quoteTableName($alias); // issue 1432: need to e...
php
public function createFindCommand($table,$criteria,$alias='t') { $this->ensureTable($table); $select=is_array($criteria->select) ? implode(', ',$criteria->select) : $criteria->select; if($criteria->alias!='') $alias=$criteria->alias; $alias=$this->_schema->quoteTableName($alias); // issue 1432: need to e...
[ "public", "function", "createFindCommand", "(", "$", "table", ",", "$", "criteria", ",", "$", "alias", "=", "'t'", ")", "{", "$", "this", "->", "ensureTable", "(", "$", "table", ")", ";", "$", "select", "=", "is_array", "(", "$", "criteria", "->", "s...
Creates a SELECT command for a single table. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param CDbCriteria $criteria the query criteria @param string $alias the alias name of the primary table. Defaults to 't'. @return CDbCommand query command.
[ "Creates", "a", "SELECT", "command", "for", "a", "single", "table", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L74-L102
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.createDeleteCommand
public function createDeleteCommand($table,$criteria) { $this->ensureTable($table); $sql="DELETE FROM {$table->rawName}"; $sql=$this->applyJoin($sql,$criteria->join); $sql=$this->applyCondition($sql,$criteria->condition); $sql=$this->applyGroup($sql,$criteria->group); $sql=$this->applyHaving($sql,$criteria...
php
public function createDeleteCommand($table,$criteria) { $this->ensureTable($table); $sql="DELETE FROM {$table->rawName}"; $sql=$this->applyJoin($sql,$criteria->join); $sql=$this->applyCondition($sql,$criteria->condition); $sql=$this->applyGroup($sql,$criteria->group); $sql=$this->applyHaving($sql,$criteria...
[ "public", "function", "createDeleteCommand", "(", "$", "table", ",", "$", "criteria", ")", "{", "$", "this", "->", "ensureTable", "(", "$", "table", ")", ";", "$", "sql", "=", "\"DELETE FROM {$table->rawName}\"", ";", "$", "sql", "=", "$", "this", "->", ...
Creates a DELETE command. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param CDbCriteria $criteria the query criteria @return CDbCommand delete command.
[ "Creates", "a", "DELETE", "command", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L187-L200
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.createSqlCommand
public function createSqlCommand($sql,$params=array()) { $command=$this->_connection->createCommand($sql); $this->bindValues($command,$params); return $command; }
php
public function createSqlCommand($sql,$params=array()) { $command=$this->_connection->createCommand($sql); $this->bindValues($command,$params); return $command; }
[ "public", "function", "createSqlCommand", "(", "$", "sql", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "command", "=", "$", "this", "->", "_connection", "->", "createCommand", "(", "$", "sql", ")", ";", "$", "this", "->", "bindValues", ...
Creates a command based on a given SQL statement. @param string $sql the explicitly specified SQL statement @param array $params parameters that will be bound to the SQL statement @return CDbCommand the created command
[ "Creates", "a", "command", "based", "on", "a", "given", "SQL", "statement", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L454-L459
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.bindValues
public function bindValues($command, $values) { if(($n=count($values))===0) return; if(isset($values[0])) // question mark placeholders { for($i=0;$i<$n;++$i) $command->bindValue($i+1,$values[$i]); } else // named placeholders { foreach($values as $name=>$value) { if($name[0]!==':') ...
php
public function bindValues($command, $values) { if(($n=count($values))===0) return; if(isset($values[0])) // question mark placeholders { for($i=0;$i<$n;++$i) $command->bindValue($i+1,$values[$i]); } else // named placeholders { foreach($values as $name=>$value) { if($name[0]!==':') ...
[ "public", "function", "bindValues", "(", "$", "command", ",", "$", "values", ")", "{", "if", "(", "(", "$", "n", "=", "count", "(", "$", "values", ")", ")", "===", "0", ")", "return", ";", "if", "(", "isset", "(", "$", "values", "[", "0", "]", ...
Binds parameter values for an SQL command. @param CDbCommand $command database command @param array $values values for binding (integer-indexed array for question mark placeholders, string-indexed array for named placeholders)
[ "Binds", "parameter", "values", "for", "an", "SQL", "command", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L553-L571
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.createCriteria
public function createCriteria($condition='',$params=array()) { if(is_array($condition)) $criteria=new CDbCriteria($condition); elseif($condition instanceof CDbCriteria) $criteria=clone $condition; else { $criteria=new CDbCriteria; $criteria->condition=$condition; $criteria->params=$params; } ...
php
public function createCriteria($condition='',$params=array()) { if(is_array($condition)) $criteria=new CDbCriteria($condition); elseif($condition instanceof CDbCriteria) $criteria=clone $condition; else { $criteria=new CDbCriteria; $criteria->condition=$condition; $criteria->params=$params; } ...
[ "public", "function", "createCriteria", "(", "$", "condition", "=", "''", ",", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "is_array", "(", "$", "condition", ")", ")", "$", "criteria", "=", "new", "CDbCriteria", "(", "$", "condition", ...
Creates a query criteria. @param mixed $condition query condition or criteria. If a string, it is treated as query condition (the WHERE clause); If an array, it is treated as the initial values for constructing a {@link CDbCriteria} object; Otherwise, it should be an instance of {@link CDbCriteria}. @param array $param...
[ "Creates", "a", "query", "criteria", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L585-L598
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.createPkCriteria
public function createPkCriteria($table,$pk,$condition='',$params=array(),$prefix=null) { $this->ensureTable($table); $criteria=$this->createCriteria($condition,$params); if($criteria->alias!='') $prefix=$this->_schema->quoteTableName($criteria->alias).'.'; if(!is_array($pk)) // single key $pk=array($pk)...
php
public function createPkCriteria($table,$pk,$condition='',$params=array(),$prefix=null) { $this->ensureTable($table); $criteria=$this->createCriteria($condition,$params); if($criteria->alias!='') $prefix=$this->_schema->quoteTableName($criteria->alias).'.'; if(!is_array($pk)) // single key $pk=array($pk)...
[ "public", "function", "createPkCriteria", "(", "$", "table", ",", "$", "pk", ",", "$", "condition", "=", "''", ",", "$", "params", "=", "array", "(", ")", ",", "$", "prefix", "=", "null", ")", "{", "$", "this", "->", "ensureTable", "(", "$", "table...
Creates a query criteria with the specified primary key. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param mixed $pk primary key value(s). Use array for multiple primary keys. For composite key, each key value must be an array (column name=>column value). @param mixed $con...
[ "Creates", "a", "query", "criteria", "with", "the", "specified", "primary", "key", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L614-L631
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.createColumnCriteria
public function createColumnCriteria($table,$columns,$condition='',$params=array(),$prefix=null) { $this->ensureTable($table); $criteria=$this->createCriteria($condition,$params); if($criteria->alias!='') $prefix=$this->_schema->quoteTableName($criteria->alias).'.'; $bindByPosition=isset($criteria->params[0...
php
public function createColumnCriteria($table,$columns,$condition='',$params=array(),$prefix=null) { $this->ensureTable($table); $criteria=$this->createCriteria($condition,$params); if($criteria->alias!='') $prefix=$this->_schema->quoteTableName($criteria->alias).'.'; $bindByPosition=isset($criteria->params[0...
[ "public", "function", "createColumnCriteria", "(", "$", "table", ",", "$", "columns", ",", "$", "condition", "=", "''", ",", "$", "params", "=", "array", "(", ")", ",", "$", "prefix", "=", "null", ")", "{", "$", "this", "->", "ensureTable", "(", "$",...
Creates a query criteria with the specified column values. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param array $columns column values that should be matched in the query (name=>value) @param mixed $condition query condition or criteria. If a string, it is treated as qu...
[ "Creates", "a", "query", "criteria", "with", "the", "specified", "column", "values", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L661-L709
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.createSearchCondition
public function createSearchCondition($table,$columns,$keywords,$prefix=null,$caseSensitive=true) { $this->ensureTable($table); if(!is_array($keywords)) $keywords=preg_split('/\s+/u',$keywords,-1,PREG_SPLIT_NO_EMPTY); if(empty($keywords)) return ''; if($prefix===null) $prefix=$table->rawName.'.'; $c...
php
public function createSearchCondition($table,$columns,$keywords,$prefix=null,$caseSensitive=true) { $this->ensureTable($table); if(!is_array($keywords)) $keywords=preg_split('/\s+/u',$keywords,-1,PREG_SPLIT_NO_EMPTY); if(empty($keywords)) return ''; if($prefix===null) $prefix=$table->rawName.'.'; $c...
[ "public", "function", "createSearchCondition", "(", "$", "table", ",", "$", "columns", ",", "$", "keywords", ",", "$", "prefix", "=", "null", ",", "$", "caseSensitive", "=", "true", ")", "{", "$", "this", "->", "ensureTable", "(", "$", "table", ")", ";...
Generates the expression for searching the specified keywords within a list of columns. The search expression is generated using the 'LIKE' SQL syntax. Every word in the keywords must be present and appear in at least one of the columns. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (s...
[ "Generates", "the", "expression", "for", "searching", "the", "specified", "keywords", "within", "a", "list", "of", "columns", ".", "The", "search", "expression", "is", "generated", "using", "the", "LIKE", "SQL", "syntax", ".", "Every", "word", "in", "the", "...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L724-L751
train
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
CDbCommandBuilder.ensureTable
protected function ensureTable(&$table) { if(is_string($table) && ($table=$this->_schema->getTable($tableName=$table))===null) throw new CDbException(Yii::t('yii','Table "{table}" does not exist.', array('{table}'=>$tableName))); }
php
protected function ensureTable(&$table) { if(is_string($table) && ($table=$this->_schema->getTable($tableName=$table))===null) throw new CDbException(Yii::t('yii','Table "{table}" does not exist.', array('{table}'=>$tableName))); }
[ "protected", "function", "ensureTable", "(", "&", "$", "table", ")", "{", "if", "(", "is_string", "(", "$", "table", ")", "&&", "(", "$", "table", "=", "$", "this", "->", "_schema", "->", "getTable", "(", "$", "tableName", "=", "$", "table", ")", "...
Checks if the parameter is a valid table schema. If it is a string, the corresponding table schema will be retrieved. @param mixed $table table schema ({@link CDbTableSchema}) or table name (string). If this refers to a valid table name, this parameter will be returned with the corresponding table schema. @throws CDbEx...
[ "Checks", "if", "the", "parameter", "is", "a", "valid", "table", "schema", ".", "If", "it", "is", "a", "string", "the", "corresponding", "table", "schema", "will", "be", "retrieved", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/CDbCommandBuilder.php#L859-L864
train
yiisoft/yii
framework/base/CDbStatePersister.php
CDbStatePersister.save
public function save($state) { $command=$this->db->createCommand(); if(false===$this->exists()) return $command->insert($this->stateTableName,array( $this->keyField=>Yii::app()->name, $this->valueField=>serialize($state) )); else return $command->update($this->stateTableName,array($this->valueFi...
php
public function save($state) { $command=$this->db->createCommand(); if(false===$this->exists()) return $command->insert($this->stateTableName,array( $this->keyField=>Yii::app()->name, $this->valueField=>serialize($state) )); else return $command->update($this->stateTableName,array($this->valueFi...
[ "public", "function", "save", "(", "$", "state", ")", "{", "$", "command", "=", "$", "this", "->", "db", "->", "createCommand", "(", ")", ";", "if", "(", "false", "===", "$", "this", "->", "exists", "(", ")", ")", "return", "$", "command", "->", ...
Saves application state in persistent storage. @param mixed $state state data (must be serializable). @return int
[ "Saves", "application", "state", "in", "persistent", "storage", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CDbStatePersister.php#L105-L118
train
yiisoft/yii
framework/base/CDbStatePersister.php
CDbStatePersister.createTable
protected function createTable() { try { $command=$this->db->createCommand(); $command->createTable($this->stateTableName,array( $this->keyField=>'string NOT NULL', $this->valueField=>'text NOT NULL', 'PRIMARY KEY ('.$this->db->quoteColumnName($this->keyField).')' )); } catch (CDbException...
php
protected function createTable() { try { $command=$this->db->createCommand(); $command->createTable($this->stateTableName,array( $this->keyField=>'string NOT NULL', $this->valueField=>'text NOT NULL', 'PRIMARY KEY ('.$this->db->quoteColumnName($this->keyField).')' )); } catch (CDbException...
[ "protected", "function", "createTable", "(", ")", "{", "try", "{", "$", "command", "=", "$", "this", "->", "db", "->", "createCommand", "(", ")", ";", "$", "command", "->", "createTable", "(", "$", "this", "->", "stateTableName", ",", "array", "(", "$"...
Creates state persister table @throws CException
[ "Creates", "state", "persister", "table" ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CDbStatePersister.php#L137-L152
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.format
public function format($pattern,$time) { if($time===null) return null; if(is_string($time)) { if(ctype_digit($time) || ($time{0}=='-' && ctype_digit(substr($time, 1)))) $time=(int)$time; else $time=strtotime($time); } $date=CTimestamp::getDate($time,false,false); $tokens=$this->parseForma...
php
public function format($pattern,$time) { if($time===null) return null; if(is_string($time)) { if(ctype_digit($time) || ($time{0}=='-' && ctype_digit(substr($time, 1)))) $time=(int)$time; else $time=strtotime($time); } $date=CTimestamp::getDate($time,false,false); $tokens=$this->parseForma...
[ "public", "function", "format", "(", "$", "pattern", ",", "$", "time", ")", "{", "if", "(", "$", "time", "===", "null", ")", "return", "null", ";", "if", "(", "is_string", "(", "$", "time", ")", ")", "{", "if", "(", "ctype_digit", "(", "$", "time...
Formats a date according to a customized pattern. @param string $pattern the pattern (See {@link http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns}) @param mixed $time UNIX timestamp or a string in strtotime format @return string formatted date time. Null if $time is null. (the null value check i...
[ "Formats", "a", "date", "according", "to", "a", "customized", "pattern", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L86-L106
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.formatDateTime
public function formatDateTime($timestamp,$dateWidth='medium',$timeWidth='medium') { if(!empty($dateWidth)) $date=$this->format($this->_locale->getDateFormat($dateWidth),$timestamp); if(!empty($timeWidth)) $time=$this->format($this->_locale->getTimeFormat($timeWidth),$timestamp); if(isset($date) && isset...
php
public function formatDateTime($timestamp,$dateWidth='medium',$timeWidth='medium') { if(!empty($dateWidth)) $date=$this->format($this->_locale->getDateFormat($dateWidth),$timestamp); if(!empty($timeWidth)) $time=$this->format($this->_locale->getTimeFormat($timeWidth),$timestamp); if(isset($date) && isset...
[ "public", "function", "formatDateTime", "(", "$", "timestamp", ",", "$", "dateWidth", "=", "'medium'", ",", "$", "timeWidth", "=", "'medium'", ")", "{", "if", "(", "!", "empty", "(", "$", "dateWidth", ")", ")", "$", "date", "=", "$", "this", "->", "f...
Formats a date according to a predefined pattern. The predefined pattern is determined based on the date pattern width and time pattern width. @param mixed $timestamp UNIX timestamp or a string in strtotime format @param string $dateWidth width of the date pattern. It can be 'full', 'long', 'medium' and 'short'. If nul...
[ "Formats", "a", "date", "according", "to", "a", "predefined", "pattern", ".", "The", "predefined", "pattern", "is", "determined", "based", "on", "the", "date", "pattern", "width", "and", "time", "pattern", "width", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L118-L135
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.parseFormat
protected function parseFormat($pattern) { static $formats=array(); // cache if(isset($formats[$pattern])) return $formats[$pattern]; $tokens=array(); $n=strlen($pattern); $isLiteral=false; $literal=''; for($i=0;$i<$n;++$i) { $c=$pattern[$i]; if($c==="'") { if($i<$n-1 && $pattern[$i+1]...
php
protected function parseFormat($pattern) { static $formats=array(); // cache if(isset($formats[$pattern])) return $formats[$pattern]; $tokens=array(); $n=strlen($pattern); $isLiteral=false; $literal=''; for($i=0;$i<$n;++$i) { $c=$pattern[$i]; if($c==="'") { if($i<$n-1 && $pattern[$i+1]...
[ "protected", "function", "parseFormat", "(", "$", "pattern", ")", "{", "static", "$", "formats", "=", "array", "(", ")", ";", "// cache", "if", "(", "isset", "(", "$", "formats", "[", "$", "pattern", "]", ")", ")", "return", "$", "formats", "[", "$",...
Parses the datetime format pattern. @param string $pattern the pattern to be parsed @return array tokenized parsing result
[ "Parses", "the", "datetime", "format", "pattern", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L142-L194
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.formatMinutes
protected function formatMinutes($pattern,$date) { $minutes=$date['minutes']; if($pattern==='m') return $minutes; elseif($pattern==='mm') return str_pad($minutes,2,'0',STR_PAD_LEFT); else throw new CException(Yii::t('yii','The pattern for minutes must be "m" or "mm".')); }
php
protected function formatMinutes($pattern,$date) { $minutes=$date['minutes']; if($pattern==='m') return $minutes; elseif($pattern==='mm') return str_pad($minutes,2,'0',STR_PAD_LEFT); else throw new CException(Yii::t('yii','The pattern for minutes must be "m" or "mm".')); }
[ "protected", "function", "formatMinutes", "(", "$", "pattern", ",", "$", "date", ")", "{", "$", "minutes", "=", "$", "date", "[", "'minutes'", "]", ";", "if", "(", "$", "pattern", "===", "'m'", ")", "return", "$", "minutes", ";", "elseif", "(", "$", ...
Get the minutes. "m" for non-padding, "mm" will always return 2 characters. @param string $pattern a pattern. @param array $date result of {@link CTimestamp::getdate}. @throws CException if "minutes" pattern is unknown @return string minutes.
[ "Get", "the", "minutes", ".", "m", "for", "non", "-", "padding", "mm", "will", "always", "return", "2", "characters", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L453-L462
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.formatSeconds
protected function formatSeconds($pattern,$date) { $seconds=$date['seconds']; if($pattern==='s') return $seconds; elseif($pattern==='ss') return str_pad($seconds,2,'0',STR_PAD_LEFT); else throw new CException(Yii::t('yii','The pattern for seconds must be "s" or "ss".')); }
php
protected function formatSeconds($pattern,$date) { $seconds=$date['seconds']; if($pattern==='s') return $seconds; elseif($pattern==='ss') return str_pad($seconds,2,'0',STR_PAD_LEFT); else throw new CException(Yii::t('yii','The pattern for seconds must be "s" or "ss".')); }
[ "protected", "function", "formatSeconds", "(", "$", "pattern", ",", "$", "date", ")", "{", "$", "seconds", "=", "$", "date", "[", "'seconds'", "]", ";", "if", "(", "$", "pattern", "===", "'s'", ")", "return", "$", "seconds", ";", "elseif", "(", "$", ...
Get the seconds. "s" for non-padding, "ss" will always return 2 characters. @param string $pattern a pattern. @param array $date result of {@link CTimestamp::getdate}. @throws CException if "seconds" pattern is unknown @return string seconds
[ "Get", "the", "seconds", ".", "s", "for", "non", "-", "padding", "ss", "will", "always", "return", "2", "characters", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L472-L481
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.formatWeekInYear
protected function formatWeekInYear($pattern,$date) { if($pattern==='w') return @date('W',@mktime(0,0,0,$date['mon'],$date['mday'],$date['year'])); else throw new CException(Yii::t('yii','The pattern for week in year must be "w".')); }
php
protected function formatWeekInYear($pattern,$date) { if($pattern==='w') return @date('W',@mktime(0,0,0,$date['mon'],$date['mday'],$date['year'])); else throw new CException(Yii::t('yii','The pattern for week in year must be "w".')); }
[ "protected", "function", "formatWeekInYear", "(", "$", "pattern", ",", "$", "date", ")", "{", "if", "(", "$", "pattern", "===", "'w'", ")", "return", "@", "date", "(", "'W'", ",", "@", "mktime", "(", "0", ",", "0", ",", "0", ",", "$", "date", "["...
Get the week in the year. @param string $pattern a pattern. @param array $date result of {@link CTimestamp::getdate}. @throws CException if "weekInYear" pattern is unknown @return integer week in year
[ "Get", "the", "week", "in", "the", "year", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L490-L496
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.formatWeekInMonth
protected function formatWeekInMonth($pattern,$date) { if($pattern==='W') { $weekDay=date('N',mktime(0,0,0,$date['mon'],1,$date['year'])); return floor(($weekDay+$date['mday']-2)/7)+1; } else throw new CException(Yii::t('yii','The pattern for week in month must be "W".')); }
php
protected function formatWeekInMonth($pattern,$date) { if($pattern==='W') { $weekDay=date('N',mktime(0,0,0,$date['mon'],1,$date['year'])); return floor(($weekDay+$date['mday']-2)/7)+1; } else throw new CException(Yii::t('yii','The pattern for week in month must be "W".')); }
[ "protected", "function", "formatWeekInMonth", "(", "$", "pattern", ",", "$", "date", ")", "{", "if", "(", "$", "pattern", "===", "'W'", ")", "{", "$", "weekDay", "=", "date", "(", "'N'", ",", "mktime", "(", "0", ",", "0", ",", "0", ",", "$", "dat...
Get week in the month. @param array $pattern result of {@link CTimestamp::getdate}. @param string $date a pattern. @throws CException if "weekInMonth" pattern is unknown @return integer week in month
[ "Get", "week", "in", "the", "month", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L505-L514
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.formatTimeZone
protected function formatTimeZone($pattern,$date) { if($pattern[0]==='z' || $pattern[0]==='v') return @date('T', @mktime($date['hours'], $date['minutes'], $date['seconds'], $date['mon'], $date['mday'], $date['year'])); elseif($pattern[0]==='Z') return @date('P', @mktime($date['hours'], $date['minutes'], $dat...
php
protected function formatTimeZone($pattern,$date) { if($pattern[0]==='z' || $pattern[0]==='v') return @date('T', @mktime($date['hours'], $date['minutes'], $date['seconds'], $date['mon'], $date['mday'], $date['year'])); elseif($pattern[0]==='Z') return @date('P', @mktime($date['hours'], $date['minutes'], $dat...
[ "protected", "function", "formatTimeZone", "(", "$", "pattern", ",", "$", "date", ")", "{", "if", "(", "$", "pattern", "[", "0", "]", "===", "'z'", "||", "$", "pattern", "[", "0", "]", "===", "'v'", ")", "return", "@", "date", "(", "'T'", ",", "@...
Get the timezone of the server machine. @param string $pattern a pattern. @param array $date result of {@link CTimestamp::getdate}. @throws CException if "timeZone" pattern is unknown @return string time zone @todo How to get the timezone for a different region?
[ "Get", "the", "timezone", "of", "the", "server", "machine", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L524-L532
train
yiisoft/yii
framework/i18n/CDateFormatter.php
CDateFormatter.formatEra
protected function formatEra($pattern,$date) { $era=$date['year']>0 ? 1 : 0; switch($pattern) { case 'G': case 'GG': case 'GGG': return $this->_locale->getEraName($era,'abbreviated'); case 'GGGG': return $this->_locale->getEraName($era,'wide'); case 'GGGGG': return $this->_locale->getE...
php
protected function formatEra($pattern,$date) { $era=$date['year']>0 ? 1 : 0; switch($pattern) { case 'G': case 'GG': case 'GGG': return $this->_locale->getEraName($era,'abbreviated'); case 'GGGG': return $this->_locale->getEraName($era,'wide'); case 'GGGGG': return $this->_locale->getE...
[ "protected", "function", "formatEra", "(", "$", "pattern", ",", "$", "date", ")", "{", "$", "era", "=", "$", "date", "[", "'year'", "]", ">", "0", "?", "1", ":", "0", ";", "switch", "(", "$", "pattern", ")", "{", "case", "'G'", ":", "case", "'G...
Get the era. i.e. in gregorian, year > 0 is AD, else BC. @param string $pattern a pattern. @param array $date result of {@link CTimestamp::getdate}. @throws CException if "era" pattern is unknown @return string era @todo How to support multiple Eras?, e.g. Japanese.
[ "Get", "the", "era", ".", "i", ".", "e", ".", "in", "gregorian", "year", ">", "0", "is", "AD", "else", "BC", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CDateFormatter.php#L542-L558
train
yiisoft/yii
framework/logging/CFileLogRoute.php
CFileLogRoute.processLogs
protected function processLogs($logs) { $text=''; foreach($logs as $log) $text.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]); $logFile=$this->getLogPath().DIRECTORY_SEPARATOR.$this->getLogFile(); $fp=@fopen($logFile,'a'); @flock($fp,LOCK_EX); if(@filesize($logFile)>$this->getMaxFileSize()*1...
php
protected function processLogs($logs) { $text=''; foreach($logs as $log) $text.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]); $logFile=$this->getLogPath().DIRECTORY_SEPARATOR.$this->getLogFile(); $fp=@fopen($logFile,'a'); @flock($fp,LOCK_EX); if(@filesize($logFile)>$this->getMaxFileSize()*1...
[ "protected", "function", "processLogs", "(", "$", "logs", ")", "{", "$", "text", "=", "''", ";", "foreach", "(", "$", "logs", "as", "$", "log", ")", "$", "text", ".=", "$", "this", "->", "formatLogMessage", "(", "$", "log", "[", "0", "]", ",", "$...
Saves log messages in files. @param array $logs list of log messages
[ "Saves", "log", "messages", "in", "files", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CFileLogRoute.php#L144-L166
train
yiisoft/yii
framework/web/helpers/CGoogleApi.php
CGoogleApi.init
public static function init($apiKey=null) { if($apiKey===null) return CHtml::scriptFile(self::$bootstrapUrl); else return CHtml::scriptFile(self::$bootstrapUrl.'?key='.$apiKey); }
php
public static function init($apiKey=null) { if($apiKey===null) return CHtml::scriptFile(self::$bootstrapUrl); else return CHtml::scriptFile(self::$bootstrapUrl.'?key='.$apiKey); }
[ "public", "static", "function", "init", "(", "$", "apiKey", "=", "null", ")", "{", "if", "(", "$", "apiKey", "===", "null", ")", "return", "CHtml", "::", "scriptFile", "(", "self", "::", "$", "bootstrapUrl", ")", ";", "else", "return", "CHtml", "::", ...
Renders the jsapi script file. @param string $apiKey the API key. Null if you do not have a key. @return string the script tag that loads Google jsapi.
[ "Renders", "the", "jsapi", "script", "file", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/helpers/CGoogleApi.php#L30-L36
train
yiisoft/yii
demos/blog/protected/models/Tag.php
Tag.findTagWeights
public function findTagWeights($limit=20) { $models=$this->findAll(array( 'order'=>'frequency DESC', 'limit'=>$limit, )); $total=0; foreach($models as $model) $total+=$model->frequency; $tags=array(); if($total>0) { foreach($models as $model) $tags[$model->name]=8+(int)(16*$model->frequ...
php
public function findTagWeights($limit=20) { $models=$this->findAll(array( 'order'=>'frequency DESC', 'limit'=>$limit, )); $total=0; foreach($models as $model) $total+=$model->frequency; $tags=array(); if($total>0) { foreach($models as $model) $tags[$model->name]=8+(int)(16*$model->frequ...
[ "public", "function", "findTagWeights", "(", "$", "limit", "=", "20", ")", "{", "$", "models", "=", "$", "this", "->", "findAll", "(", "array", "(", "'order'", "=>", "'frequency DESC'", ",", "'limit'", "=>", "$", "limit", ",", ")", ")", ";", "$", "to...
Returns tag names and their corresponding weights. Only the tags with the top weights will be returned. @param integer the maximum number of tags that should be returned @return array weights indexed by tag names.
[ "Returns", "tag", "names", "and", "their", "corresponding", "weights", ".", "Only", "the", "tags", "with", "the", "top", "weights", "will", "be", "returned", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/models/Tag.php#L70-L89
train
yiisoft/yii
framework/web/CAssetManager.php
CAssetManager.setBasePath
public function setBasePath($value) { if(($basePath=realpath($value))!==false && is_dir($basePath) && is_writable($basePath)) $this->_basePath=$basePath; else throw new CException(Yii::t('yii','CAssetManager.basePath "{path}" is invalid. Please make sure the directory exists and is writable by the Web server...
php
public function setBasePath($value) { if(($basePath=realpath($value))!==false && is_dir($basePath) && is_writable($basePath)) $this->_basePath=$basePath; else throw new CException(Yii::t('yii','CAssetManager.basePath "{path}" is invalid. Please make sure the directory exists and is writable by the Web server...
[ "public", "function", "setBasePath", "(", "$", "value", ")", "{", "if", "(", "(", "$", "basePath", "=", "realpath", "(", "$", "value", ")", ")", "!==", "false", "&&", "is_dir", "(", "$", "basePath", ")", "&&", "is_writable", "(", "$", "basePath", ")"...
Sets the root directory storing published asset files. @param string $value the root directory storing published asset files @throws CException if the base path is invalid
[ "Sets", "the", "root", "directory", "storing", "published", "asset", "files", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CAssetManager.php#L133-L140
train
yiisoft/yii
framework/web/CAssetManager.php
CAssetManager.getPublishedUrl
public function getPublishedUrl($path,$hashByName=false) { if(isset($this->_published[$path])) return $this->_published[$path]; if(is_string($path) && ($path=realpath($path))!==false) { $base=$this->getBaseUrl().'/'.$this->generatePath($path,$hashByName); return is_file($path) ? $base.'/'.basename($path...
php
public function getPublishedUrl($path,$hashByName=false) { if(isset($this->_published[$path])) return $this->_published[$path]; if(is_string($path) && ($path=realpath($path))!==false) { $base=$this->getBaseUrl().'/'.$this->generatePath($path,$hashByName); return is_file($path) ? $base.'/'.basename($path...
[ "public", "function", "getPublishedUrl", "(", "$", "path", ",", "$", "hashByName", "=", "false", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "_published", "[", "$", "path", "]", ")", ")", "return", "$", "this", "->", "_published", "[", "$",...
Returns the URL of a published file path. This method does not perform any publishing. It merely tells you if the file path is published, what the URL will be to access it. @param string $path directory or file path being published @param boolean $hashByName whether the published directory should be named as the hashed...
[ "Returns", "the", "URL", "of", "a", "published", "file", "path", ".", "This", "method", "does", "not", "perform", "any", "publishing", ".", "It", "merely", "tells", "you", "if", "the", "file", "path", "is", "published", "what", "the", "URL", "will", "be"...
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CAssetManager.php#L294-L305
train
yiisoft/yii
framework/web/CAssetManager.php
CAssetManager.generatePath
protected function generatePath($file,$hashByName=false) { if (is_file($file)) $pathForHashing=$hashByName ? dirname($file) : dirname($file).filemtime($file); else $pathForHashing=$hashByName ? $file : $file.filemtime($file); return $this->hash($pathForHashing); }
php
protected function generatePath($file,$hashByName=false) { if (is_file($file)) $pathForHashing=$hashByName ? dirname($file) : dirname($file).filemtime($file); else $pathForHashing=$hashByName ? $file : $file.filemtime($file); return $this->hash($pathForHashing); }
[ "protected", "function", "generatePath", "(", "$", "file", ",", "$", "hashByName", "=", "false", ")", "{", "if", "(", "is_file", "(", "$", "file", ")", ")", "$", "pathForHashing", "=", "$", "hashByName", "?", "dirname", "(", "$", "file", ")", ":", "d...
Generates path segments relative to basePath. @param string $file for which public path will be created. @param bool $hashByName whether the published directory should be named as the hashed basename. @return string path segments without basePath. @since 1.1.13
[ "Generates", "path", "segments", "relative", "to", "basePath", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CAssetManager.php#L325-L333
train
yiisoft/yii
framework/gii/CCodeModel.php
CCodeModel.sticky
public function sticky($attribute,$params) { if(!$this->hasErrors()) $this->_stickyAttributes[$attribute]=$this->$attribute; }
php
public function sticky($attribute,$params) { if(!$this->hasErrors()) $this->_stickyAttributes[$attribute]=$this->$attribute; }
[ "public", "function", "sticky", "(", "$", "attribute", ",", "$", "params", ")", "{", "if", "(", "!", "$", "this", "->", "hasErrors", "(", ")", ")", "$", "this", "->", "_stickyAttributes", "[", "$", "attribute", "]", "=", "$", "this", "->", "$", "at...
The "sticky" validator. This validator does not really validate the attributes. It actually saves the attribute value in a file to make it sticky. @param string $attribute the attribute to be validated @param array $params the validation parameters
[ "The", "sticky", "validator", ".", "This", "validator", "does", "not", "really", "validate", "the", "attributes", ".", "It", "actually", "saves", "the", "attribute", "value", "in", "a", "file", "to", "make", "it", "sticky", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeModel.php#L353-L357
train
yiisoft/yii
framework/gii/CCodeModel.php
CCodeModel.loadStickyAttributes
public function loadStickyAttributes() { $this->_stickyAttributes=array(); $path=$this->getStickyFile(); if(is_file($path)) { $result=@include($path); if(is_array($result)) { $this->_stickyAttributes=$result; foreach($this->_stickyAttributes as $name=>$value) { if(property_exists($thi...
php
public function loadStickyAttributes() { $this->_stickyAttributes=array(); $path=$this->getStickyFile(); if(is_file($path)) { $result=@include($path); if(is_array($result)) { $this->_stickyAttributes=$result; foreach($this->_stickyAttributes as $name=>$value) { if(property_exists($thi...
[ "public", "function", "loadStickyAttributes", "(", ")", "{", "$", "this", "->", "_stickyAttributes", "=", "array", "(", ")", ";", "$", "path", "=", "$", "this", "->", "getStickyFile", "(", ")", ";", "if", "(", "is_file", "(", "$", "path", ")", ")", "...
Loads sticky attributes from a file and populates them into the model.
[ "Loads", "sticky", "attributes", "from", "a", "file", "and", "populates", "them", "into", "the", "model", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeModel.php#L362-L379
train
yiisoft/yii
framework/gii/CCodeModel.php
CCodeModel.saveStickyAttributes
public function saveStickyAttributes() { $path=$this->getStickyFile(); @mkdir(dirname($path),0755,true); file_put_contents($path,"<?php\nreturn ".var_export($this->_stickyAttributes,true).";\n"); }
php
public function saveStickyAttributes() { $path=$this->getStickyFile(); @mkdir(dirname($path),0755,true); file_put_contents($path,"<?php\nreturn ".var_export($this->_stickyAttributes,true).";\n"); }
[ "public", "function", "saveStickyAttributes", "(", ")", "{", "$", "path", "=", "$", "this", "->", "getStickyFile", "(", ")", ";", "@", "mkdir", "(", "dirname", "(", "$", "path", ")", ",", "0755", ",", "true", ")", ";", "file_put_contents", "(", "$", ...
Saves sticky attributes into a file.
[ "Saves", "sticky", "attributes", "into", "a", "file", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeModel.php#L384-L389
train
yiisoft/yii
framework/gii/CCodeModel.php
CCodeModel.class2name
public function class2name($name,$ucwords=true) { $result=trim(strtolower(str_replace('_',' ',preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $name)))); return $ucwords ? ucwords($result) : $result; }
php
public function class2name($name,$ucwords=true) { $result=trim(strtolower(str_replace('_',' ',preg_replace('/(?<![A-Z])[A-Z]/', ' \0', $name)))); return $ucwords ? ucwords($result) : $result; }
[ "public", "function", "class2name", "(", "$", "name", ",", "$", "ucwords", "=", "true", ")", "{", "$", "result", "=", "trim", "(", "strtolower", "(", "str_replace", "(", "'_'", ",", "' '", ",", "preg_replace", "(", "'/(?<![A-Z])[A-Z]/'", ",", "' \\0'", "...
Converts a class name into space-separated words. For example, 'PostTag' will be converted as 'Post Tag'. @param string $name the string to be converted @param boolean $ucwords whether to capitalize the first letter in each word @return string the resulting words
[ "Converts", "a", "class", "name", "into", "space", "-", "separated", "words", ".", "For", "example", "PostTag", "will", "be", "converted", "as", "Post", "Tag", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeModel.php#L454-L458
train
yiisoft/yii
framework/gii/CCodeModel.php
CCodeModel.validateReservedWord
public function validateReservedWord($attribute,$params) { $value=$this->$attribute; if(in_array(strtolower($value),self::$keywords)) $this->addError($attribute, $this->getAttributeLabel($attribute).' cannot take a reserved PHP keyword.'); }
php
public function validateReservedWord($attribute,$params) { $value=$this->$attribute; if(in_array(strtolower($value),self::$keywords)) $this->addError($attribute, $this->getAttributeLabel($attribute).' cannot take a reserved PHP keyword.'); }
[ "public", "function", "validateReservedWord", "(", "$", "attribute", ",", "$", "params", ")", "{", "$", "value", "=", "$", "this", "->", "$", "attribute", ";", "if", "(", "in_array", "(", "strtolower", "(", "$", "value", ")", ",", "self", "::", "$", ...
Validates an attribute to make sure it is not taking a PHP reserved keyword. @param string $attribute the attribute to be validated @param array $params validation parameters
[ "Validates", "an", "attribute", "to", "make", "sure", "it", "is", "not", "taking", "a", "PHP", "reserved", "keyword", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeModel.php#L478-L483
train
yiisoft/yii
framework/web/widgets/CActiveForm.php
CActiveForm.validate
public static function validate($models, $attributes=null, $loadInput=true) { $result=array(); if(!is_array($models)) $models=array($models); foreach($models as $model) { $modelName=CHtml::modelName($model); if($loadInput && isset($_POST[$modelName])) $model->attributes=$_POST[$modelName]; $mod...
php
public static function validate($models, $attributes=null, $loadInput=true) { $result=array(); if(!is_array($models)) $models=array($models); foreach($models as $model) { $modelName=CHtml::modelName($model); if($loadInput && isset($_POST[$modelName])) $model->attributes=$_POST[$modelName]; $mod...
[ "public", "static", "function", "validate", "(", "$", "models", ",", "$", "attributes", "=", "null", ",", "$", "loadInput", "=", "true", ")", "{", "$", "result", "=", "array", "(", ")", ";", "if", "(", "!", "is_array", "(", "$", "models", ")", ")",...
Validates one or several models and returns the results in JSON format. This is a helper method that simplifies the way of writing AJAX validation code. @param mixed $models a single model instance or an array of models. @param array $attributes list of attributes that should be validated. Defaults to null, meaning any...
[ "Validates", "one", "or", "several", "models", "and", "returns", "the", "results", "in", "JSON", "format", ".", "This", "is", "a", "helper", "method", "that", "simplifies", "the", "way", "of", "writing", "AJAX", "validation", "code", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CActiveForm.php#L977-L992
train
yiisoft/yii
framework/web/widgets/captcha/CCaptcha.php
CCaptcha.registerClientScript
public function registerClientScript() { $cs=Yii::app()->clientScript; $id=$this->imageOptions['id']; $url=$this->getController()->createUrl($this->captchaAction,array(CCaptchaAction::REFRESH_GET_VAR=>true)); $js=""; if($this->showRefreshButton) { // reserve a place in the registered script so that any...
php
public function registerClientScript() { $cs=Yii::app()->clientScript; $id=$this->imageOptions['id']; $url=$this->getController()->createUrl($this->captchaAction,array(CCaptchaAction::REFRESH_GET_VAR=>true)); $js=""; if($this->showRefreshButton) { // reserve a place in the registered script so that any...
[ "public", "function", "registerClientScript", "(", ")", "{", "$", "cs", "=", "Yii", "::", "app", "(", ")", "->", "clientScript", ";", "$", "id", "=", "$", "this", "->", "imageOptions", "[", "'id'", "]", ";", "$", "url", "=", "$", "this", "->", "get...
Registers the needed client scripts.
[ "Registers", "the", "needed", "client", "scripts", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/captcha/CCaptcha.php#L110-L156
train
yiisoft/yii
framework/web/widgets/captcha/CCaptcha.php
CCaptcha.checkRequirements
public static function checkRequirements($extension=null) { if(extension_loaded('imagick')) { $imagick=new Imagick(); $imagickFormats=$imagick->queryFormats('PNG'); } if(extension_loaded('gd')) { $gdInfo=gd_info(); } if($extension===null) { if(isset($imagickFormats) && in_array('PNG',$imagi...
php
public static function checkRequirements($extension=null) { if(extension_loaded('imagick')) { $imagick=new Imagick(); $imagickFormats=$imagick->queryFormats('PNG'); } if(extension_loaded('gd')) { $gdInfo=gd_info(); } if($extension===null) { if(isset($imagickFormats) && in_array('PNG',$imagi...
[ "public", "static", "function", "checkRequirements", "(", "$", "extension", "=", "null", ")", "{", "if", "(", "extension_loaded", "(", "'imagick'", ")", ")", "{", "$", "imagick", "=", "new", "Imagick", "(", ")", ";", "$", "imagickFormats", "=", "$", "ima...
Checks if specified graphic extension support is loaded. @param string $extension name to be checked. Possible values are 'gd', 'imagick' and null. Default value is null meaning that both extensions will be checked. This parameter is available since 1.1.13. @return boolean true if ImageMagick extension with PNG support...
[ "Checks", "if", "specified", "graphic", "extension", "support", "is", "loaded", "." ]
af3cbce71db83c4476c8a4289517b2984c740f31
https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/captcha/CCaptcha.php#L167-L190
train
sendgrid/sendgrid-php
lib/mail/SpamCheck.php
SpamCheck.jsonSerialize
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'threshold' => $this->getThreshold(), 'post_to_url' => $this->getPostToUrl() ], function ($value) { return $value !== n...
php
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'threshold' => $this->getThreshold(), 'post_to_url' => $this->getPostToUrl() ], function ($value) { return $value !== n...
[ "public", "function", "jsonSerialize", "(", ")", "{", "return", "array_filter", "(", "[", "'enable'", "=>", "$", "this", "->", "getEnable", "(", ")", ",", "'threshold'", "=>", "$", "this", "->", "getThreshold", "(", ")", ",", "'post_to_url'", "=>", "$", ...
Return an array representing a SpamCheck object for the Twilio SendGrid API @return null|array
[ "Return", "an", "array", "representing", "a", "SpamCheck", "object", "for", "the", "Twilio", "SendGrid", "API" ]
37fa19d3ae019842f07a2a43e92ed0f566ad927d
https://github.com/sendgrid/sendgrid-php/blob/37fa19d3ae019842f07a2a43e92ed0f566ad927d/lib/mail/SpamCheck.php#L148-L160
train
sendgrid/sendgrid-php
lib/mail/TrackingSettings.php
TrackingSettings.setGanalytics
public function setGanalytics( $enable, $utm_source = null, $utm_medium = null, $utm_term = null, $utm_content = null, $utm_campaign = null ) { if ($enable instanceof Ganalytics) { $ganalytics = $enable; $this->ganalytics = $ganalytics;...
php
public function setGanalytics( $enable, $utm_source = null, $utm_medium = null, $utm_term = null, $utm_content = null, $utm_campaign = null ) { if ($enable instanceof Ganalytics) { $ganalytics = $enable; $this->ganalytics = $ganalytics;...
[ "public", "function", "setGanalytics", "(", "$", "enable", ",", "$", "utm_source", "=", "null", ",", "$", "utm_medium", "=", "null", ",", "$", "utm_term", "=", "null", ",", "$", "utm_content", "=", "null", ",", "$", "utm_campaign", "=", "null", ")", "{...
Set the Google analytics settings on a TrackingSettings object @param Ganalytics|bool $enable The Ganalytics object or an indication if the setting is enabled @param string|null $utm_source Name of the referrer source. (e.g. Google, SomeDomain.com, or Marketing Email) @param string|null $utm_medium Name of the marketi...
[ "Set", "the", "Google", "analytics", "settings", "on", "a", "TrackingSettings", "object" ]
37fa19d3ae019842f07a2a43e92ed0f566ad927d
https://github.com/sendgrid/sendgrid-php/blob/37fa19d3ae019842f07a2a43e92ed0f566ad927d/lib/mail/TrackingSettings.php#L200-L221
train
sendgrid/sendgrid-php
lib/mail/TrackingSettings.php
TrackingSettings.jsonSerialize
public function jsonSerialize() { return array_filter( [ 'click_tracking' => $this->getClickTracking(), 'open_tracking' => $this->getOpenTracking(), 'subscription_tracking' => $this->getSubscriptionTracking(), 'ganalytics' => $this-...
php
public function jsonSerialize() { return array_filter( [ 'click_tracking' => $this->getClickTracking(), 'open_tracking' => $this->getOpenTracking(), 'subscription_tracking' => $this->getSubscriptionTracking(), 'ganalytics' => $this-...
[ "public", "function", "jsonSerialize", "(", ")", "{", "return", "array_filter", "(", "[", "'click_tracking'", "=>", "$", "this", "->", "getClickTracking", "(", ")", ",", "'open_tracking'", "=>", "$", "this", "->", "getOpenTracking", "(", ")", ",", "'subscripti...
Return an array representing a TrackingSettings object for the Twilio SendGrid API @return null|array
[ "Return", "an", "array", "representing", "a", "TrackingSettings", "object", "for", "the", "Twilio", "SendGrid", "API" ]
37fa19d3ae019842f07a2a43e92ed0f566ad927d
https://github.com/sendgrid/sendgrid-php/blob/37fa19d3ae019842f07a2a43e92ed0f566ad927d/lib/mail/TrackingSettings.php#L238-L251
train
sendgrid/sendgrid-php
lib/mail/ClickTracking.php
ClickTracking.jsonSerialize
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'enable_text' => $this->getEnableText() ], function ($value) { return $value !== null; } ) ?: null; }
php
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'enable_text' => $this->getEnableText() ], function ($value) { return $value !== null; } ) ?: null; }
[ "public", "function", "jsonSerialize", "(", ")", "{", "return", "array_filter", "(", "[", "'enable'", "=>", "$", "this", "->", "getEnable", "(", ")", ",", "'enable_text'", "=>", "$", "this", "->", "getEnableText", "(", ")", "]", ",", "function", "(", "$"...
Return an array representing a ClickTracking object for the Twilio SendGrid API @return null|array
[ "Return", "an", "array", "representing", "a", "ClickTracking", "object", "for", "the", "Twilio", "SendGrid", "API" ]
37fa19d3ae019842f07a2a43e92ed0f566ad927d
https://github.com/sendgrid/sendgrid-php/blob/37fa19d3ae019842f07a2a43e92ed0f566ad927d/lib/mail/ClickTracking.php#L102-L113
train
sendgrid/sendgrid-php
lib/mail/Footer.php
Footer.jsonSerialize
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'text' => $this->getText(), 'html' => $this->getHtml() ], function ($value) { return $value !== null; } ...
php
public function jsonSerialize() { return array_filter( [ 'enable' => $this->getEnable(), 'text' => $this->getText(), 'html' => $this->getHtml() ], function ($value) { return $value !== null; } ...
[ "public", "function", "jsonSerialize", "(", ")", "{", "return", "array_filter", "(", "[", "'enable'", "=>", "$", "this", "->", "getEnable", "(", ")", ",", "'text'", "=>", "$", "this", "->", "getText", "(", ")", ",", "'html'", "=>", "$", "this", "->", ...
Return an array representing a Footer object for the Twilio SendGrid API @return null|array
[ "Return", "an", "array", "representing", "a", "Footer", "object", "for", "the", "Twilio", "SendGrid", "API" ]
37fa19d3ae019842f07a2a43e92ed0f566ad927d
https://github.com/sendgrid/sendgrid-php/blob/37fa19d3ae019842f07a2a43e92ed0f566ad927d/lib/mail/Footer.php#L131-L143
train
sendgrid/sendgrid-php
lib/mail/Header.php
Header.jsonSerialize
public function jsonSerialize() { return array_filter( [ 'key' => $this->getKey(), 'value' => $this->getValue() ], function ($value) { return $value !== null; } ) ?: null; }
php
public function jsonSerialize() { return array_filter( [ 'key' => $this->getKey(), 'value' => $this->getValue() ], function ($value) { return $value !== null; } ) ?: null; }
[ "public", "function", "jsonSerialize", "(", ")", "{", "return", "array_filter", "(", "[", "'key'", "=>", "$", "this", "->", "getKey", "(", ")", ",", "'value'", "=>", "$", "this", "->", "getValue", "(", ")", "]", ",", "function", "(", "$", "value", ")...
Return an array representing a Header object for the Twilio SendGrid API @return null|array
[ "Return", "an", "array", "representing", "a", "Header", "object", "for", "the", "Twilio", "SendGrid", "API" ]
37fa19d3ae019842f07a2a43e92ed0f566ad927d
https://github.com/sendgrid/sendgrid-php/blob/37fa19d3ae019842f07a2a43e92ed0f566ad927d/lib/mail/Header.php#L104-L115
train