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/zii/widgets/grid/CLinkColumn.php | CLinkColumn.getDataCellContent | public function getDataCellContent($row)
{
$data=$this->grid->dataProvider->data[$row];
if($this->urlExpression!==null)
$url=$this->evaluateExpression($this->urlExpression,array('data'=>$data,'row'=>$row));
else
$url=$this->url;
if($this->labelExpression!==null)
$label=$this->evaluateExpression($this-... | php | public function getDataCellContent($row)
{
$data=$this->grid->dataProvider->data[$row];
if($this->urlExpression!==null)
$url=$this->evaluateExpression($this->urlExpression,array('data'=>$data,'row'=>$row));
else
$url=$this->url;
if($this->labelExpression!==null)
$label=$this->evaluateExpression($this-... | [
"public",
"function",
"getDataCellContent",
"(",
"$",
"row",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"grid",
"->",
"dataProvider",
"->",
"data",
"[",
"$",
"row",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"urlExpression",
"!==",
"null",
")",
"$",... | Returns the data cell content.
This method renders a hyperlink in the data cell.
@param integer $row the row number (zero-based)
@return string the data cell content.
@since 1.1.16 | [
"Returns",
"the",
"data",
"cell",
"content",
".",
"This",
"method",
"renders",
"a",
"hyperlink",
"in",
"the",
"data",
"cell",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/grid/CLinkColumn.php#L96-L112 | train |
yiisoft/yii | framework/zii/widgets/CBaseListView.php | CBaseListView.renderKeys | public function renderKeys()
{
echo CHtml::openTag('div',array(
'class'=>'keys',
'style'=>'display:none',
'title'=>Yii::app()->getRequest()->getUrl(),
));
foreach($this->dataProvider->getKeys() as $key)
echo "<span>".CHtml::encode($key)."</span>";
echo "</div>\n";
} | php | public function renderKeys()
{
echo CHtml::openTag('div',array(
'class'=>'keys',
'style'=>'display:none',
'title'=>Yii::app()->getRequest()->getUrl(),
));
foreach($this->dataProvider->getKeys() as $key)
echo "<span>".CHtml::encode($key)."</span>";
echo "</div>\n";
} | [
"public",
"function",
"renderKeys",
"(",
")",
"{",
"echo",
"CHtml",
"::",
"openTag",
"(",
"'div'",
",",
"array",
"(",
"'class'",
"=>",
"'keys'",
",",
"'style'",
"=>",
"'display:none'",
",",
"'title'",
"=>",
"Yii",
"::",
"app",
"(",
")",
"->",
"getRequest... | Renders the key values of the data in a hidden tag. | [
"Renders",
"the",
"key",
"values",
"of",
"the",
"data",
"in",
"a",
"hidden",
"tag",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/CBaseListView.php#L202-L212 | train |
yiisoft/yii | framework/zii/widgets/CBaseListView.php | CBaseListView.renderSummary | public function renderSummary()
{
if(($count=$this->dataProvider->getItemCount())<=0)
return;
echo CHtml::openTag($this->summaryTagName, array('class'=>$this->summaryCssClass));
if($this->enablePagination)
{
$pagination=$this->dataProvider->getPagination();
$total=$this->dataProvider->getTotalItemCou... | php | public function renderSummary()
{
if(($count=$this->dataProvider->getItemCount())<=0)
return;
echo CHtml::openTag($this->summaryTagName, array('class'=>$this->summaryCssClass));
if($this->enablePagination)
{
$pagination=$this->dataProvider->getPagination();
$total=$this->dataProvider->getTotalItemCou... | [
"public",
"function",
"renderSummary",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"count",
"=",
"$",
"this",
"->",
"dataProvider",
"->",
"getItemCount",
"(",
")",
")",
"<=",
"0",
")",
"return",
";",
"echo",
"CHtml",
"::",
"openTag",
"(",
"$",
"this",
"->",
... | Renders the summary text. | [
"Renders",
"the",
"summary",
"text",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/CBaseListView.php#L217-L257 | train |
yiisoft/yii | framework/web/widgets/CHtmlPurifier.php | CHtmlPurifier.purify | public function purify($content)
{
if(is_array($content))
$content=array_map(array($this,'purify'),$content);
else
$content=$this->getPurifier()->purify($content);
return $content;
} | php | public function purify($content)
{
if(is_array($content))
$content=array_map(array($this,'purify'),$content);
else
$content=$this->getPurifier()->purify($content);
return $content;
} | [
"public",
"function",
"purify",
"(",
"$",
"content",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"content",
")",
")",
"$",
"content",
"=",
"array_map",
"(",
"array",
"(",
"$",
"this",
",",
"'purify'",
")",
",",
"$",
"content",
")",
";",
"else",
"$",... | Purifies the HTML content by removing malicious code.
@param mixed $content the content to be purified.
@return mixed the purified content | [
"Purifies",
"the",
"HTML",
"content",
"by",
"removing",
"malicious",
"code",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CHtmlPurifier.php#L79-L86 | train |
yiisoft/yii | framework/web/widgets/CHtmlPurifier.php | CHtmlPurifier.createNewHtmlPurifierInstance | protected function createNewHtmlPurifierInstance()
{
$this->_purifier=new HTMLPurifier($this->getOptions());
$this->_purifier->config->set('Cache.SerializerPath',Yii::app()->getRuntimePath());
return $this->_purifier;
} | php | protected function createNewHtmlPurifierInstance()
{
$this->_purifier=new HTMLPurifier($this->getOptions());
$this->_purifier->config->set('Cache.SerializerPath',Yii::app()->getRuntimePath());
return $this->_purifier;
} | [
"protected",
"function",
"createNewHtmlPurifierInstance",
"(",
")",
"{",
"$",
"this",
"->",
"_purifier",
"=",
"new",
"HTMLPurifier",
"(",
"$",
"this",
"->",
"getOptions",
"(",
")",
")",
";",
"$",
"this",
"->",
"_purifier",
"->",
"config",
"->",
"set",
"(",... | Create a new HTML Purifier instance.
@return HTMLPurifier | [
"Create",
"a",
"new",
"HTML",
"Purifier",
"instance",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CHtmlPurifier.php#L124-L129 | train |
yiisoft/yii | framework/web/CUploadedFile.php | CUploadedFile.getInstancesByName | public static function getInstancesByName($name)
{
if(null===self::$_files)
self::prefetchFiles();
$len=strlen($name);
$results=array();
foreach(array_keys(self::$_files) as $key)
if(0===strncmp($key, $name.'[', $len+1) && self::$_files[$key]->getError()!=UPLOAD_ERR_NO_FILE)
$results[] = self::$_fil... | php | public static function getInstancesByName($name)
{
if(null===self::$_files)
self::prefetchFiles();
$len=strlen($name);
$results=array();
foreach(array_keys(self::$_files) as $key)
if(0===strncmp($key, $name.'[', $len+1) && self::$_files[$key]->getError()!=UPLOAD_ERR_NO_FILE)
$results[] = self::$_fil... | [
"public",
"static",
"function",
"getInstancesByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"_files",
")",
"self",
"::",
"prefetchFiles",
"(",
")",
";",
"$",
"len",
"=",
"strlen",
"(",
"$",
"name",
")",
";",
"$",
... | Returns an array of instances starting with specified array name.
If multiple files were uploaded and saved as 'Files[0]', 'Files[1]',
'Files[n]'..., you can have them all by passing 'Files' as array name.
@param string $name the name of the array of files
@return CUploadedFile[] the array of CUploadedFile objects. Em... | [
"Returns",
"an",
"array",
"of",
"instances",
"starting",
"with",
"specified",
"array",
"name",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CUploadedFile.php#L99-L110 | train |
yiisoft/yii | framework/cli/commands/WebAppCommand.php | WebAppCommand.setPermissions | protected function setPermissions($targetDir)
{
@chmod($targetDir.'/assets',0777);
@chmod($targetDir.'/protected/runtime',0777);
@chmod($targetDir.'/protected/data',0777);
@chmod($targetDir.'/protected/data/testdrive.db',0777);
@chmod($targetDir.'/protected/yiic',0755);
} | php | protected function setPermissions($targetDir)
{
@chmod($targetDir.'/assets',0777);
@chmod($targetDir.'/protected/runtime',0777);
@chmod($targetDir.'/protected/data',0777);
@chmod($targetDir.'/protected/data/testdrive.db',0777);
@chmod($targetDir.'/protected/yiic',0755);
} | [
"protected",
"function",
"setPermissions",
"(",
"$",
"targetDir",
")",
"{",
"@",
"chmod",
"(",
"$",
"targetDir",
".",
"'/assets'",
",",
"0777",
")",
";",
"@",
"chmod",
"(",
"$",
"targetDir",
".",
"'/protected/runtime'",
",",
"0777",
")",
";",
"@",
"chmod... | Adjusts created application file and directory permissions
@param string $targetDir path to created application | [
"Adjusts",
"created",
"application",
"file",
"and",
"directory",
"permissions"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/commands/WebAppCommand.php#L105-L112 | train |
yiisoft/yii | framework/cli/commands/WebAppCommand.php | WebAppCommand.addFileModificationCallbacks | protected function addFileModificationCallbacks(&$fileList)
{
$fileList['index.php']['callback']=array($this,'generateIndex');
$fileList['index-test.php']['callback']=array($this,'generateIndex');
$fileList['protected/tests/bootstrap.php']['callback']=array($this,'generateTestBoostrap');
$fileList['protected/y... | php | protected function addFileModificationCallbacks(&$fileList)
{
$fileList['index.php']['callback']=array($this,'generateIndex');
$fileList['index-test.php']['callback']=array($this,'generateIndex');
$fileList['protected/tests/bootstrap.php']['callback']=array($this,'generateTestBoostrap');
$fileList['protected/y... | [
"protected",
"function",
"addFileModificationCallbacks",
"(",
"&",
"$",
"fileList",
")",
"{",
"$",
"fileList",
"[",
"'index.php'",
"]",
"[",
"'callback'",
"]",
"=",
"array",
"(",
"$",
"this",
",",
"'generateIndex'",
")",
";",
"$",
"fileList",
"[",
"'index-te... | Adds callbacks that will modify source files
@param array $fileList | [
"Adds",
"callbacks",
"that",
"will",
"modify",
"source",
"files"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/commands/WebAppCommand.php#L127-L133 | train |
yiisoft/yii | framework/cli/commands/WebAppCommand.php | WebAppCommand.generateIndex | public function generateIndex($source,$params)
{
$content=file_get_contents($source);
$yii=realpath(dirname(__FILE__).'/../../yii.php');
$yii=$this->getRelativePath($yii,$this->_rootPath.DIRECTORY_SEPARATOR.'index.php');
$yii=str_replace('\\','\\\\',$yii);
return preg_replace('/\$yii\s*=(.*?);/',"\$yii=$yii;... | php | public function generateIndex($source,$params)
{
$content=file_get_contents($source);
$yii=realpath(dirname(__FILE__).'/../../yii.php');
$yii=$this->getRelativePath($yii,$this->_rootPath.DIRECTORY_SEPARATOR.'index.php');
$yii=str_replace('\\','\\\\',$yii);
return preg_replace('/\$yii\s*=(.*?);/',"\$yii=$yii;... | [
"public",
"function",
"generateIndex",
"(",
"$",
"source",
",",
"$",
"params",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"source",
")",
";",
"$",
"yii",
"=",
"realpath",
"(",
"dirname",
"(",
"__FILE__",
")",
".",
"'/../../yii.php'",
"... | Inserts path to framework's yii.php into application's index.php
@param string $source source file path
@param array $params
@return string modified source file content | [
"Inserts",
"path",
"to",
"framework",
"s",
"yii",
".",
"php",
"into",
"application",
"s",
"index",
".",
"php"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/commands/WebAppCommand.php#L142-L149 | train |
yiisoft/yii | framework/cli/commands/WebAppCommand.php | WebAppCommand.generateYiic | public function generateYiic($source,$params)
{
$content=file_get_contents($source);
$yiic=realpath(dirname(__FILE__).'/../../yiic.php');
$yiic=$this->getRelativePath($yiic,$this->_rootPath.DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'yiic.php');
$yiic=str_replace('\\','\\\\',$yiic);
return preg_repl... | php | public function generateYiic($source,$params)
{
$content=file_get_contents($source);
$yiic=realpath(dirname(__FILE__).'/../../yiic.php');
$yiic=$this->getRelativePath($yiic,$this->_rootPath.DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'yiic.php');
$yiic=str_replace('\\','\\\\',$yiic);
return preg_repl... | [
"public",
"function",
"generateYiic",
"(",
"$",
"source",
",",
"$",
"params",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"source",
")",
";",
"$",
"yiic",
"=",
"realpath",
"(",
"dirname",
"(",
"__FILE__",
")",
".",
"'/../../yiic.php'",
... | Inserts path to framework's yiic.php into application's yiic.php
@param string $source source file path
@param array $params
@return string modified source file content | [
"Inserts",
"path",
"to",
"framework",
"s",
"yiic",
".",
"php",
"into",
"application",
"s",
"yiic",
".",
"php"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/commands/WebAppCommand.php#L174-L181 | train |
yiisoft/yii | framework/logging/CProfileLogRoute.php | CProfileLogRoute.processLogs | public function processLogs($logs)
{
$app=Yii::app();
if(!($app instanceof CWebApplication) || $app->getRequest()->getIsAjaxRequest())
return;
if($this->getReport()==='summary')
$this->displaySummary($logs);
else
$this->displayCallstack($logs);
} | php | public function processLogs($logs)
{
$app=Yii::app();
if(!($app instanceof CWebApplication) || $app->getRequest()->getIsAjaxRequest())
return;
if($this->getReport()==='summary')
$this->displaySummary($logs);
else
$this->displayCallstack($logs);
} | [
"public",
"function",
"processLogs",
"(",
"$",
"logs",
")",
"{",
"$",
"app",
"=",
"Yii",
"::",
"app",
"(",
")",
";",
"if",
"(",
"!",
"(",
"$",
"app",
"instanceof",
"CWebApplication",
")",
"||",
"$",
"app",
"->",
"getRequest",
"(",
")",
"->",
"getIs... | Displays the log messages.
@param array $logs list of log messages | [
"Displays",
"the",
"log",
"messages",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CProfileLogRoute.php#L77-L87 | train |
yiisoft/yii | framework/logging/CProfileLogRoute.php | CProfileLogRoute.displayCallstack | protected function displayCallstack($logs)
{
$stack=array();
$results=array();
$n=0;
foreach($logs as $log)
{
if($log[1]!==CLogger::LEVEL_PROFILE)
continue;
$message=$log[0];
if(!strncasecmp($message,'begin:',6))
{
$log[0]=substr($message,6);
$log[4]=$n;
$stack[]=$log;
$n++;
... | php | protected function displayCallstack($logs)
{
$stack=array();
$results=array();
$n=0;
foreach($logs as $log)
{
if($log[1]!==CLogger::LEVEL_PROFILE)
continue;
$message=$log[0];
if(!strncasecmp($message,'begin:',6))
{
$log[0]=substr($message,6);
$log[4]=$n;
$stack[]=$log;
$n++;
... | [
"protected",
"function",
"displayCallstack",
"(",
"$",
"logs",
")",
"{",
"$",
"stack",
"=",
"array",
"(",
")",
";",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"n",
"=",
"0",
";",
"foreach",
"(",
"$",
"logs",
"as",
"$",
"log",
")",
"{",
"... | Displays the callstack of the profiling procedures for display.
@param array $logs list of logs
@throws CException if Yii::beginProfile() and Yii::endProfile() are not matching | [
"Displays",
"the",
"callstack",
"of",
"the",
"profiling",
"procedures",
"for",
"display",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CProfileLogRoute.php#L94-L130 | train |
yiisoft/yii | framework/logging/CProfileLogRoute.php | CProfileLogRoute.displaySummary | protected function displaySummary($logs)
{
$stack=array();
$results=array();
foreach($logs as $log)
{
if($log[1]!==CLogger::LEVEL_PROFILE)
continue;
$message=$log[0];
if(!strncasecmp($message,'begin:',6))
{
$log[0]=substr($message,6);
$stack[]=$log;
}
elseif(!strncasecmp($message,... | php | protected function displaySummary($logs)
{
$stack=array();
$results=array();
foreach($logs as $log)
{
if($log[1]!==CLogger::LEVEL_PROFILE)
continue;
$message=$log[0];
if(!strncasecmp($message,'begin:',6))
{
$log[0]=substr($message,6);
$stack[]=$log;
}
elseif(!strncasecmp($message,... | [
"protected",
"function",
"displaySummary",
"(",
"$",
"logs",
")",
"{",
"$",
"stack",
"=",
"array",
"(",
")",
";",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"logs",
"as",
"$",
"log",
")",
"{",
"if",
"(",
"$",
"log",
"[",
... | Displays the summary report of the profiling result.
@param array $logs list of logs
@throws CException if Yii::beginProfile() and Yii::endProfile() are not matching | [
"Displays",
"the",
"summary",
"report",
"of",
"the",
"profiling",
"result",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CProfileLogRoute.php#L137-L185 | train |
yiisoft/yii | framework/logging/CProfileLogRoute.php | CProfileLogRoute.aggregateResult | protected function aggregateResult($result,$delta)
{
list($token,$calls,$min,$max,$total)=$result;
if($delta<$min)
$min=$delta;
elseif($delta>$max)
$max=$delta;
$calls++;
$total+=$delta;
return array($token,$calls,$min,$max,$total);
} | php | protected function aggregateResult($result,$delta)
{
list($token,$calls,$min,$max,$total)=$result;
if($delta<$min)
$min=$delta;
elseif($delta>$max)
$max=$delta;
$calls++;
$total+=$delta;
return array($token,$calls,$min,$max,$total);
} | [
"protected",
"function",
"aggregateResult",
"(",
"$",
"result",
",",
"$",
"delta",
")",
"{",
"list",
"(",
"$",
"token",
",",
"$",
"calls",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"total",
")",
"=",
"$",
"result",
";",
"if",
"(",
"$",
"delta",... | Aggregates the report result.
@param array $result log result for this code block
@param float $delta time spent for this code block
@return array | [
"Aggregates",
"the",
"report",
"result",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CProfileLogRoute.php#L205-L215 | train |
yiisoft/yii | framework/db/ar/CActiveRecord.php | CActiveRecord.delete | public function delete()
{
if(!$this->getIsNewRecord())
{
Yii::trace(get_class($this).'.delete()','system.db.ar.CActiveRecord');
if($this->beforeDelete())
{
$result=$this->deleteByPk($this->getPrimaryKey())>0;
$this->afterDelete();
return $result;
}
else
return false;
}
else
t... | php | public function delete()
{
if(!$this->getIsNewRecord())
{
Yii::trace(get_class($this).'.delete()','system.db.ar.CActiveRecord');
if($this->beforeDelete())
{
$result=$this->deleteByPk($this->getPrimaryKey())>0;
$this->afterDelete();
return $result;
}
else
return false;
}
else
t... | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsNewRecord",
"(",
")",
")",
"{",
"Yii",
"::",
"trace",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"'.delete()'",
",",
"'system.db.ar.CActiveRecord'",
")",
";",
"i... | Deletes the row corresponding to this active record.
@throws CDbException if the record is new
@return boolean whether the deletion is successful. | [
"Deletes",
"the",
"row",
"corresponding",
"to",
"this",
"active",
"record",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveRecord.php#L1223-L1239 | train |
yiisoft/yii | framework/db/ar/CActiveRecord.php | CActiveRecord.find | public function find($condition='',$params=array())
{
Yii::trace(get_class($this).'.find()','system.db.ar.CActiveRecord');
$criteria=$this->getCommandBuilder()->createCriteria($condition,$params);
return $this->query($criteria);
} | php | public function find($condition='',$params=array())
{
Yii::trace(get_class($this).'.find()','system.db.ar.CActiveRecord');
$criteria=$this->getCommandBuilder()->createCriteria($condition,$params);
return $this->query($criteria);
} | [
"public",
"function",
"find",
"(",
"$",
"condition",
"=",
"''",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"Yii",
"::",
"trace",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"'.find()'",
",",
"'system.db.ar.CActiveRecord'",
")",
";",
"$",
... | Finds a single active record with the specified condition.
@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 ... | [
"Finds",
"a",
"single",
"active",
"record",
"with",
"the",
"specified",
"condition",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveRecord.php#L1460-L1465 | train |
yiisoft/yii | framework/db/ar/CActiveRecord.php | CActiveRecord.findBySql | public function findBySql($sql,$params=array())
{
Yii::trace(get_class($this).'.findBySql()','system.db.ar.CActiveRecord');
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
{
$this->resetScope(false);
$finder=$this->getActiveFinder($criteria->with);
re... | php | public function findBySql($sql,$params=array())
{
Yii::trace(get_class($this).'.findBySql()','system.db.ar.CActiveRecord');
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
{
$this->resetScope(false);
$finder=$this->getActiveFinder($criteria->with);
re... | [
"public",
"function",
"findBySql",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"Yii",
"::",
"trace",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"'.findBySql()'",
",",
"'system.db.ar.CActiveRecord'",
")",
";",
"$",
"this",
... | Finds a single active record with the specified SQL statement.
@param string $sql the SQL statement
@param array $params parameters to be bound to the SQL statement
@return static|null the record found. Null if none is found. | [
"Finds",
"a",
"single",
"active",
"record",
"with",
"the",
"specified",
"SQL",
"statement",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveRecord.php#L1553-L1568 | train |
yiisoft/yii | framework/db/ar/CActiveRecord.php | CActiveRecord.findAllBySql | public function findAllBySql($sql,$params=array())
{
Yii::trace(get_class($this).'.findAllBySql()','system.db.ar.CActiveRecord');
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
{
$this->resetScope(false);
$finder=$this->getActiveFinder($criteria->with);... | php | public function findAllBySql($sql,$params=array())
{
Yii::trace(get_class($this).'.findAllBySql()','system.db.ar.CActiveRecord');
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with))
{
$this->resetScope(false);
$finder=$this->getActiveFinder($criteria->with);... | [
"public",
"function",
"findAllBySql",
"(",
"$",
"sql",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"Yii",
"::",
"trace",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"'.findAllBySql()'",
",",
"'system.db.ar.CActiveRecord'",
")",
";",
"$",
"thi... | Finds all active records using the specified SQL statement.
@param string $sql the SQL statement
@param array $params parameters to be bound to the SQL statement
@return static[] the records found. An empty array is returned if none is found. | [
"Finds",
"all",
"active",
"records",
"using",
"the",
"specified",
"SQL",
"statement",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveRecord.php#L1576-L1591 | train |
yiisoft/yii | framework/web/CDataProviderIterator.php | CDataProviderIterator.loadPage | protected function loadPage()
{
$this->_dataProvider->getPagination()->setCurrentPage($this->_currentPage);
return $this->_items=$this->dataProvider->getData(true);
} | php | protected function loadPage()
{
$this->_dataProvider->getPagination()->setCurrentPage($this->_currentPage);
return $this->_items=$this->dataProvider->getData(true);
} | [
"protected",
"function",
"loadPage",
"(",
")",
"{",
"$",
"this",
"->",
"_dataProvider",
"->",
"getPagination",
"(",
")",
"->",
"setCurrentPage",
"(",
"$",
"this",
"->",
"_currentPage",
")",
";",
"return",
"$",
"this",
"->",
"_items",
"=",
"$",
"this",
"-... | Loads a page of items
@return array the items from the next page of results | [
"Loads",
"a",
"page",
"of",
"items"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDataProviderIterator.php#L82-L86 | train |
yiisoft/yii | framework/web/CDataProviderIterator.php | CDataProviderIterator.key | public function key()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize();
return $this->_currentPage*$pageSize+$this->_currentIndex;
} | php | public function key()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize();
return $this->_currentPage*$pageSize+$this->_currentIndex;
} | [
"public",
"function",
"key",
"(",
")",
"{",
"$",
"pageSize",
"=",
"$",
"this",
"->",
"_dataProvider",
"->",
"getPagination",
"(",
")",
"->",
"getPageSize",
"(",
")",
";",
"return",
"$",
"this",
"->",
"_currentPage",
"*",
"$",
"pageSize",
"+",
"$",
"thi... | Gets the key of the current item.
This method is required by the Iterator interface.
@return integer the key of the current item | [
"Gets",
"the",
"key",
"of",
"the",
"current",
"item",
".",
"This",
"method",
"is",
"required",
"by",
"the",
"Iterator",
"interface",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDataProviderIterator.php#L103-L107 | train |
yiisoft/yii | framework/web/CDataProviderIterator.php | CDataProviderIterator.next | public function next()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize();
$this->_currentIndex++;
if($this->_currentIndex >= $pageSize)
{
$this->_currentPage++;
$this->_currentIndex=0;
$this->loadPage();
}
} | php | public function next()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize();
$this->_currentIndex++;
if($this->_currentIndex >= $pageSize)
{
$this->_currentPage++;
$this->_currentIndex=0;
$this->loadPage();
}
} | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"pageSize",
"=",
"$",
"this",
"->",
"_dataProvider",
"->",
"getPagination",
"(",
")",
"->",
"getPageSize",
"(",
")",
";",
"$",
"this",
"->",
"_currentIndex",
"++",
";",
"if",
"(",
"$",
"this",
"->",
"... | Moves the pointer to the next item in the list.
This method is required by the Iterator interface. | [
"Moves",
"the",
"pointer",
"to",
"the",
"next",
"item",
"in",
"the",
"list",
".",
"This",
"method",
"is",
"required",
"by",
"the",
"Iterator",
"interface",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDataProviderIterator.php#L113-L123 | train |
yiisoft/yii | framework/caching/CDbCache.php | CDbCache.createCacheTable | protected function createCacheTable($db,$tableName)
{
$driver=$db->getDriverName();
if($driver==='mysql')
$blob='LONGBLOB';
elseif($driver==='pgsql')
$blob='BYTEA';
else
$blob='BLOB';
$sql=<<<EOD
CREATE TABLE $tableName
(
id CHAR(128) PRIMARY KEY,
expire INTEGER,
value $blob
)
EOD;
$db->createC... | php | protected function createCacheTable($db,$tableName)
{
$driver=$db->getDriverName();
if($driver==='mysql')
$blob='LONGBLOB';
elseif($driver==='pgsql')
$blob='BYTEA';
else
$blob='BLOB';
$sql=<<<EOD
CREATE TABLE $tableName
(
id CHAR(128) PRIMARY KEY,
expire INTEGER,
value $blob
)
EOD;
$db->createC... | [
"protected",
"function",
"createCacheTable",
"(",
"$",
"db",
",",
"$",
"tableName",
")",
"{",
"$",
"driver",
"=",
"$",
"db",
"->",
"getDriverName",
"(",
")",
";",
"if",
"(",
"$",
"driver",
"===",
"'mysql'",
")",
"$",
"blob",
"=",
"'LONGBLOB'",
";",
"... | Creates the cache DB table.
@param CDbConnection $db the database connection
@param string $tableName the name of the table to be created | [
"Creates",
"the",
"cache",
"DB",
"table",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/CDbCache.php#L122-L140 | train |
yiisoft/yii | framework/utils/CTimestamp.php | CTimestamp.isLeapYear | public static function isLeapYear($year)
{
$year = self::digitCheck($year);
if ($year % 4 != 0)
return false;
if ($year % 400 == 0)
return true;
// if gregorian calendar (>1582), century not-divisible by 400 is not leap
elseif ($year > 1582 && $year % 100 == 0 )
return false;
return true;
} | php | public static function isLeapYear($year)
{
$year = self::digitCheck($year);
if ($year % 4 != 0)
return false;
if ($year % 400 == 0)
return true;
// if gregorian calendar (>1582), century not-divisible by 400 is not leap
elseif ($year > 1582 && $year % 100 == 0 )
return false;
return true;
} | [
"public",
"static",
"function",
"isLeapYear",
"(",
"$",
"year",
")",
"{",
"$",
"year",
"=",
"self",
"::",
"digitCheck",
"(",
"$",
"year",
")",
";",
"if",
"(",
"$",
"year",
"%",
"4",
"!=",
"0",
")",
"return",
"false",
";",
"if",
"(",
"$",
"year",
... | Checks for leap year, returns true if it is. No 2-digit year check. Also
handles julian calendar correctly.
@param integer $year year to check
@return boolean true if is leap year | [
"Checks",
"for",
"leap",
"year",
"returns",
"true",
"if",
"it",
"is",
".",
"No",
"2",
"-",
"digit",
"year",
"check",
".",
"Also",
"handles",
"julian",
"calendar",
"correctly",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CTimestamp.php#L92-L104 | train |
yiisoft/yii | framework/utils/CTimestamp.php | CTimestamp.digitCheck | protected static function digitCheck($y)
{
if ($y < 100){
$yr = (integer) date("Y");
$century = (integer) ($yr /100);
if ($yr%100 > 50) {
$c1 = $century + 1;
$c0 = $century;
} else {
$c1 = $century;
$c0 = $century - 1;
}
$c1 *= 100;
// if 2-digit year is less than 30 years in fu... | php | protected static function digitCheck($y)
{
if ($y < 100){
$yr = (integer) date("Y");
$century = (integer) ($yr /100);
if ($yr%100 > 50) {
$c1 = $century + 1;
$c0 = $century;
} else {
$c1 = $century;
$c0 = $century - 1;
}
$c1 *= 100;
// if 2-digit year is less than 30 years in fu... | [
"protected",
"static",
"function",
"digitCheck",
"(",
"$",
"y",
")",
"{",
"if",
"(",
"$",
"y",
"<",
"100",
")",
"{",
"$",
"yr",
"=",
"(",
"integer",
")",
"date",
"(",
"\"Y\"",
")",
";",
"$",
"century",
"=",
"(",
"integer",
")",
"(",
"$",
"yr",
... | Fix 2-digit years. Works for any century.
Assumes that if 2-digit is more than 30 years in future, then previous century.
@param integer $y year
@return integer change two digit year into multiple digits | [
"Fix",
"2",
"-",
"digit",
"years",
".",
"Works",
"for",
"any",
"century",
".",
"Assumes",
"that",
"if",
"2",
"-",
"digit",
"is",
"more",
"than",
"30",
"years",
"in",
"future",
"then",
"previous",
"century",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CTimestamp.php#L112-L132 | train |
yiisoft/yii | framework/utils/CTimestamp.php | CTimestamp.isValidTime | public static function isValidTime($h,$m,$s,$hs24=true)
{
if($hs24 && ($h < 0 || $h > 23) || !$hs24 && ($h < 1 || $h > 12)) return false;
if($m > 59 || $m < 0) return false;
if($s > 59 || $s < 0) return false;
return true;
} | php | public static function isValidTime($h,$m,$s,$hs24=true)
{
if($hs24 && ($h < 0 || $h > 23) || !$hs24 && ($h < 1 || $h > 12)) return false;
if($m > 59 || $m < 0) return false;
if($s > 59 || $s < 0) return false;
return true;
} | [
"public",
"static",
"function",
"isValidTime",
"(",
"$",
"h",
",",
"$",
"m",
",",
"$",
"s",
",",
"$",
"hs24",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"hs24",
"&&",
"(",
"$",
"h",
"<",
"0",
"||",
"$",
"h",
">",
"23",
")",
"||",
"!",
"$",
"h... | Checks to see if the hour, minute and second are valid.
@param integer $h hour
@param integer $m minute
@param integer $s second
@param boolean $hs24 whether the hours should be 0 through 23 (default) or 1 through 12.
@return boolean true if valid date, semantic check only. | [
"Checks",
"to",
"see",
"if",
"the",
"hour",
"minute",
"and",
"second",
"are",
"valid",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CTimestamp.php#L201-L207 | train |
yiisoft/yii | framework/web/CArrayDataProvider.php | CArrayDataProvider.getSortingFieldValue | protected function getSortingFieldValue($data, $fields)
{
if(is_object($data))
{
foreach($fields as $field)
$data=isset($data->$field) ? $data->$field : null;
}
else
{
foreach($fields as $field)
$data=isset($data[$field]) ? $data[$field] : null;
}
return $this->caseSensitiveSort ? $data : m... | php | protected function getSortingFieldValue($data, $fields)
{
if(is_object($data))
{
foreach($fields as $field)
$data=isset($data->$field) ? $data->$field : null;
}
else
{
foreach($fields as $field)
$data=isset($data[$field]) ? $data[$field] : null;
}
return $this->caseSensitiveSort ? $data : m... | [
"protected",
"function",
"getSortingFieldValue",
"(",
"$",
"data",
",",
"$",
"fields",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"$",
"data",
"=",
"isset",
"(",
"$",
"... | Get field for sorting, using dot like delimiter in query.
@param mixed $data array or object
@param array $fields sorting fields in $data
@return mixed $data sorting field value | [
"Get",
"field",
"for",
"sorting",
"using",
"dot",
"like",
"delimiter",
"in",
"query",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CArrayDataProvider.php#L167-L180 | train |
yiisoft/yii | framework/web/CArrayDataProvider.php | CArrayDataProvider.getSortDirections | protected function getSortDirections($order)
{
$segs=explode(',',$order);
$directions=array();
foreach($segs as $seg)
{
if(preg_match('/(.*?)(\s+(desc|asc))?$/i',trim($seg),$matches))
$directions[$matches[1]]=isset($matches[3]) && !strcasecmp($matches[3],'desc');
else
$directions[trim($seg)]=fals... | php | protected function getSortDirections($order)
{
$segs=explode(',',$order);
$directions=array();
foreach($segs as $seg)
{
if(preg_match('/(.*?)(\s+(desc|asc))?$/i',trim($seg),$matches))
$directions[$matches[1]]=isset($matches[3]) && !strcasecmp($matches[3],'desc');
else
$directions[trim($seg)]=fals... | [
"protected",
"function",
"getSortDirections",
"(",
"$",
"order",
")",
"{",
"$",
"segs",
"=",
"explode",
"(",
"','",
",",
"$",
"order",
")",
";",
"$",
"directions",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"segs",
"as",
"$",
"seg",
")",
"{"... | Converts the "ORDER BY" clause into an array representing the sorting directions.
@param string $order the "ORDER BY" clause.
@return array the sorting directions (field name => whether it is descending sort) | [
"Converts",
"the",
"ORDER",
"BY",
"clause",
"into",
"an",
"array",
"representing",
"the",
"sorting",
"directions",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CArrayDataProvider.php#L187-L199 | train |
yiisoft/yii | framework/cli/views/webapp/protected/controllers/SiteController.php | SiteController.actionError | public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
} | php | public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo $error['message'];
else
$this->render('error', $error);
}
} | [
"public",
"function",
"actionError",
"(",
")",
"{",
"if",
"(",
"$",
"error",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"errorHandler",
"->",
"error",
")",
"{",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"isAjaxRequest",
")",
"ec... | This is the action to handle external exceptions. | [
"This",
"is",
"the",
"action",
"to",
"handle",
"external",
"exceptions",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/views/webapp/protected/controllers/SiteController.php#L38-L47 | train |
yiisoft/yii | framework/cli/views/webapp/protected/controllers/SiteController.php | SiteController.actionContact | public function actionContact()
{
$model=new ContactForm;
if(isset($_POST['ContactForm']))
{
$model->attributes=$_POST['ContactForm'];
if($model->validate())
{
$name='=?UTF-8?B?'.base64_encode($model->name).'?=';
$subject='=?UTF-8?B?'.base64_encode($model->subject).'?=';
$headers="From: $nam... | php | public function actionContact()
{
$model=new ContactForm;
if(isset($_POST['ContactForm']))
{
$model->attributes=$_POST['ContactForm'];
if($model->validate())
{
$name='=?UTF-8?B?'.base64_encode($model->name).'?=';
$subject='=?UTF-8?B?'.base64_encode($model->subject).'?=';
$headers="From: $nam... | [
"public",
"function",
"actionContact",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"ContactForm",
";",
"if",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"'ContactForm'",
"]",
")",
")",
"{",
"$",
"model",
"->",
"attributes",
"=",
"$",
"_POST",
"[",
"'ContactForm... | Displays the contact page | [
"Displays",
"the",
"contact",
"page"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/views/webapp/protected/controllers/SiteController.php#L52-L73 | train |
yiisoft/yii | framework/web/actions/CViewAction.php | CViewAction.resolveView | protected function resolveView($viewPath)
{
// start with a word char and have word chars, dots and dashes only
if(preg_match('/^\w[\w\.\-]*$/',$viewPath))
{
$view=strtr($viewPath,'.','/');
if(!empty($this->basePath))
$view=$this->basePath.'/'.$view;
if($this->getController()->getViewFile($view)!==f... | php | protected function resolveView($viewPath)
{
// start with a word char and have word chars, dots and dashes only
if(preg_match('/^\w[\w\.\-]*$/',$viewPath))
{
$view=strtr($viewPath,'.','/');
if(!empty($this->basePath))
$view=$this->basePath.'/'.$view;
if($this->getController()->getViewFile($view)!==f... | [
"protected",
"function",
"resolveView",
"(",
"$",
"viewPath",
")",
"{",
"// start with a word char and have word chars, dots and dashes only",
"if",
"(",
"preg_match",
"(",
"'/^\\w[\\w\\.\\-]*$/'",
",",
"$",
"viewPath",
")",
")",
"{",
"$",
"view",
"=",
"strtr",
"(",
... | Resolves the user-specified view into a valid view name.
@param string $viewPath user-specified view in the format of 'path.to.view'.
@return string fully resolved view in the format of 'path/to/view'.
@throws CHttpException if the user-specified view is invalid | [
"Resolves",
"the",
"user",
"-",
"specified",
"view",
"into",
"a",
"valid",
"view",
"name",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/actions/CViewAction.php#L98-L114 | train |
yiisoft/yii | framework/logging/CLogFilter.php | CLogFilter.filter | public function filter(&$logs)
{
if (!empty($logs))
{
if(($message=$this->getContext())!=='')
array_unshift($logs,array($message,CLogger::LEVEL_INFO,'application',YII_BEGIN_TIME));
$this->format($logs);
}
return $logs;
} | php | public function filter(&$logs)
{
if (!empty($logs))
{
if(($message=$this->getContext())!=='')
array_unshift($logs,array($message,CLogger::LEVEL_INFO,'application',YII_BEGIN_TIME));
$this->format($logs);
}
return $logs;
} | [
"public",
"function",
"filter",
"(",
"&",
"$",
"logs",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"logs",
")",
")",
"{",
"if",
"(",
"(",
"$",
"message",
"=",
"$",
"this",
"->",
"getContext",
"(",
")",
")",
"!==",
"''",
")",
"array_unshift",
"... | Filters the given log messages.
This is the main method of CLogFilter. It processes the log messages
by adding context information, etc.
@param array $logs the log messages
@return array | [
"Filters",
"the",
"given",
"log",
"messages",
".",
"This",
"is",
"the",
"main",
"method",
"of",
"CLogFilter",
".",
"It",
"processes",
"the",
"log",
"messages",
"by",
"adding",
"context",
"information",
"etc",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CLogFilter.php#L62-L71 | train |
yiisoft/yii | framework/logging/CDbLogRoute.php | CDbLogRoute.processLogs | protected function processLogs($logs)
{
$command=$this->getDbConnection()->createCommand();
foreach($logs as $log)
{
$command->insert($this->logTableName,array(
'level'=>$log[1],
'category'=>$log[2],
'logtime'=>(int)$log[3],
'message'=>$log[0],
));
}
} | php | protected function processLogs($logs)
{
$command=$this->getDbConnection()->createCommand();
foreach($logs as $log)
{
$command->insert($this->logTableName,array(
'level'=>$log[1],
'category'=>$log[2],
'logtime'=>(int)$log[3],
'message'=>$log[0],
));
}
} | [
"protected",
"function",
"processLogs",
"(",
"$",
"logs",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",
"createCommand",
"(",
")",
";",
"foreach",
"(",
"$",
"logs",
"as",
"$",
"log",
")",
"{",
"$",
"command",
"-... | Stores log messages into database.
@param array $logs list of log messages | [
"Stores",
"log",
"messages",
"into",
"database",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CDbLogRoute.php#L126-L138 | train |
yiisoft/yii | framework/web/widgets/pagers/CBasePager.php | CBasePager.getPages | public function getPages()
{
if($this->_pages===null)
$this->_pages=$this->createPages();
return $this->_pages;
} | php | public function getPages()
{
if($this->_pages===null)
$this->_pages=$this->createPages();
return $this->_pages;
} | [
"public",
"function",
"getPages",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_pages",
"===",
"null",
")",
"$",
"this",
"->",
"_pages",
"=",
"$",
"this",
"->",
"createPages",
"(",
")",
";",
"return",
"$",
"this",
"->",
"_pages",
";",
"}"
] | Returns the pagination information used by this pager.
@return CPagination the pagination information | [
"Returns",
"the",
"pagination",
"information",
"used",
"by",
"this",
"pager",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/pagers/CBasePager.php#L34-L39 | train |
yiisoft/yii | framework/db/schema/cubrid/CCubridSchema.php | CCubridSchema.loadTable | protected function loadTable($name)
{
$table=new CCubridTableSchema;
$this->resolveTableNames($table,$name);
if($this->findColumns($table))
{
$this->findPrimaryKeys($table);
$this->findConstraints($table);
return $table;
}
else
return null;
} | php | protected function loadTable($name)
{
$table=new CCubridTableSchema;
$this->resolveTableNames($table,$name);
if($this->findColumns($table))
{
$this->findPrimaryKeys($table);
$this->findConstraints($table);
return $table;
}
else
return null;
} | [
"protected",
"function",
"loadTable",
"(",
"$",
"name",
")",
"{",
"$",
"table",
"=",
"new",
"CCubridTableSchema",
";",
"$",
"this",
"->",
"resolveTableNames",
"(",
"$",
"table",
",",
"$",
"name",
")",
";",
"if",
"(",
"$",
"this",
"->",
"findColumns",
"... | Creates a table instance representing the metadata for the named table.
@param string $name table name
@return CCubridTableSchema driver dependent table metadata. Null if the table does not exist. | [
"Creates",
"a",
"table",
"instance",
"representing",
"the",
"metadata",
"for",
"the",
"named",
"table",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/cubrid/CCubridSchema.php#L99-L112 | train |
yiisoft/yii | framework/db/schema/cubrid/CCubridSchema.php | CCubridSchema.findPrimaryKeys | protected function findPrimaryKeys($table)
{
$pks=$this->getDbConnection()->getPdoInstance()->cubrid_schema(PDO::CUBRID_SCH_PRIMARY_KEY,$table->name);
foreach($pks as $pk)
{
$c = $table->columns[$pk['ATTR_NAME']];
$c->isPrimaryKey = true;
if($table->primaryKey===null)
$table->primaryKey=$c->name;
... | php | protected function findPrimaryKeys($table)
{
$pks=$this->getDbConnection()->getPdoInstance()->cubrid_schema(PDO::CUBRID_SCH_PRIMARY_KEY,$table->name);
foreach($pks as $pk)
{
$c = $table->columns[$pk['ATTR_NAME']];
$c->isPrimaryKey = true;
if($table->primaryKey===null)
$table->primaryKey=$c->name;
... | [
"protected",
"function",
"findPrimaryKeys",
"(",
"$",
"table",
")",
"{",
"$",
"pks",
"=",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",
"getPdoInstance",
"(",
")",
"->",
"cubrid_schema",
"(",
"PDO",
"::",
"CUBRID_SCH_PRIMARY_KEY",
",",
"$",
"table",
... | Collects the primary key column details for the given table.
@param CCubridTableSchema $table the table metadata | [
"Collects",
"the",
"primary",
"key",
"column",
"details",
"for",
"the",
"given",
"table",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/cubrid/CCubridSchema.php#L210-L228 | train |
yiisoft/yii | framework/web/form/CFormInputElement.php | CFormInputElement.renderInput | public function renderInput()
{
if(isset(self::$coreTypes[$this->type]))
{
$method=self::$coreTypes[$this->type];
if(strpos($method,'List')!==false)
return CHtml::$method($this->getParent()->getModel(), $this->name, $this->items, $this->attributes);
else
return CHtml::$method($this->getParent()->g... | php | public function renderInput()
{
if(isset(self::$coreTypes[$this->type]))
{
$method=self::$coreTypes[$this->type];
if(strpos($method,'List')!==false)
return CHtml::$method($this->getParent()->getModel(), $this->name, $this->items, $this->attributes);
else
return CHtml::$method($this->getParent()->g... | [
"public",
"function",
"renderInput",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"coreTypes",
"[",
"$",
"this",
"->",
"type",
"]",
")",
")",
"{",
"$",
"method",
"=",
"self",
"::",
"$",
"coreTypes",
"[",
"$",
"this",
"->",
"type",
"... | Renders the input field.
The default implementation returns the result of the appropriate CHtml method or the widget.
@return string the rendering result | [
"Renders",
"the",
"input",
"field",
".",
"The",
"default",
"implementation",
"returns",
"the",
"result",
"of",
"the",
"appropriate",
"CHtml",
"method",
"or",
"the",
"widget",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CFormInputElement.php#L224-L243 | train |
yiisoft/yii | framework/utils/CPasswordHelper.php | CPasswordHelper.hashPassword | public static function hashPassword($password,$cost=13)
{
self::checkBlowfish();
$salt=self::generateSalt($cost);
$hash=crypt($password,$salt);
if(!is_string($hash) || (function_exists('mb_strlen') ? mb_strlen($hash, '8bit') : strlen($hash))<32)
throw new CException(Yii::t('yii','Internal error while gener... | php | public static function hashPassword($password,$cost=13)
{
self::checkBlowfish();
$salt=self::generateSalt($cost);
$hash=crypt($password,$salt);
if(!is_string($hash) || (function_exists('mb_strlen') ? mb_strlen($hash, '8bit') : strlen($hash))<32)
throw new CException(Yii::t('yii','Internal error while gener... | [
"public",
"static",
"function",
"hashPassword",
"(",
"$",
"password",
",",
"$",
"cost",
"=",
"13",
")",
"{",
"self",
"::",
"checkBlowfish",
"(",
")",
";",
"$",
"salt",
"=",
"self",
"::",
"generateSalt",
"(",
"$",
"cost",
")",
";",
"$",
"hash",
"=",
... | Generate a secure hash from a password and a random salt.
Uses the
PHP {@link http://php.net/manual/en/function.crypt.php crypt()} built-in function
with the Blowfish hash option.
@param string $password The password to be hashed.
@param int $cost Cost parameter used by the Blowfish hash algorithm.
The higher the val... | [
"Generate",
"a",
"secure",
"hash",
"from",
"a",
"password",
"and",
"a",
"random",
"salt",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CPasswordHelper.php#L92-L102 | train |
yiisoft/yii | framework/utils/CPasswordHelper.php | CPasswordHelper.verifyPassword | public static function verifyPassword($password, $hash)
{
self::checkBlowfish();
if(!is_string($password) || $password==='')
return false;
if (!$password || !preg_match('{^\$2[axy]\$(\d\d)\$[\./0-9A-Za-z]{22}}',$hash,$matches) ||
$matches[1]<4 || $matches[1]>31)
return false;
$test=crypt($password,$... | php | public static function verifyPassword($password, $hash)
{
self::checkBlowfish();
if(!is_string($password) || $password==='')
return false;
if (!$password || !preg_match('{^\$2[axy]\$(\d\d)\$[\./0-9A-Za-z]{22}}',$hash,$matches) ||
$matches[1]<4 || $matches[1]>31)
return false;
$test=crypt($password,$... | [
"public",
"static",
"function",
"verifyPassword",
"(",
"$",
"password",
",",
"$",
"hash",
")",
"{",
"self",
"::",
"checkBlowfish",
"(",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"password",
")",
"||",
"$",
"password",
"===",
"''",
")",
"return",... | Verify a password against a hash.
@param string $password The password to verify. If password is empty or not a string, method will return false.
@param string $hash The hash to verify the password against.
@return bool True if the password matches the hash.
@throws CException on bad password or hash parameters or if ... | [
"Verify",
"a",
"password",
"against",
"a",
"hash",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CPasswordHelper.php#L112-L127 | train |
yiisoft/yii | framework/utils/CPasswordHelper.php | CPasswordHelper.same | public static function same($a,$b)
{
if(!is_string($a) || !is_string($b))
return false;
$mb=function_exists('mb_strlen');
$length=$mb ? mb_strlen($a,'8bit') : strlen($a);
if($length!==($mb ? mb_strlen($b,'8bit') : strlen($b)))
return false;
$check=0;
for($i=0;$i<$length;$i+=1)
$check|=(ord($a[$i... | php | public static function same($a,$b)
{
if(!is_string($a) || !is_string($b))
return false;
$mb=function_exists('mb_strlen');
$length=$mb ? mb_strlen($a,'8bit') : strlen($a);
if($length!==($mb ? mb_strlen($b,'8bit') : strlen($b)))
return false;
$check=0;
for($i=0;$i<$length;$i+=1)
$check|=(ord($a[$i... | [
"public",
"static",
"function",
"same",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"a",
")",
"||",
"!",
"is_string",
"(",
"$",
"b",
")",
")",
"return",
"false",
";",
"$",
"mb",
"=",
"function_exists",
"(",
"'... | Check for sameness of two strings using an algorithm with timing
independent of the string values if the subject strings are of equal length.
The function can be useful to prevent timing attacks. For example, if $a and $b
are both hash values from the same algorithm, then the timing of this function
does not reveal wh... | [
"Check",
"for",
"sameness",
"of",
"two",
"strings",
"using",
"an",
"algorithm",
"with",
"timing",
"independent",
"of",
"the",
"string",
"values",
"if",
"the",
"subject",
"strings",
"are",
"of",
"equal",
"length",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CPasswordHelper.php#L150-L165 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff/Engine/shell.php | Text_Diff_Engine_shell._getLines | function _getLines(&$text_lines, &$line_no, $end = false)
{
if (!empty($end)) {
$lines = array();
// We can shift even more
while ($line_no <= $end) {
array_push($lines, array_shift($text_lines));
$line_no++;
}
} else {
... | php | function _getLines(&$text_lines, &$line_no, $end = false)
{
if (!empty($end)) {
$lines = array();
// We can shift even more
while ($line_no <= $end) {
array_push($lines, array_shift($text_lines));
$line_no++;
}
} else {
... | [
"function",
"_getLines",
"(",
"&",
"$",
"text_lines",
",",
"&",
"$",
"line_no",
",",
"$",
"end",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"end",
")",
")",
"{",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"// We can shift even more"... | Get lines from either the old or new text
@access private
@param array &$text_lines Either $from_lines or $to_lines
@param int &$line_no Current line number
@param int $end Optional end line, when we want to chop more
than one line.
@return array The chopped lines | [
"Get",
"lines",
"from",
"either",
"the",
"old",
"or",
"new",
"text"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff/Engine/shell.php#L147-L162 | train |
yiisoft/yii | framework/web/CCacheHttpSession.php | CCacheHttpSession.init | public function init()
{
$this->_cache=Yii::app()->getComponent($this->cacheID);
if(!($this->_cache instanceof ICache))
throw new CException(Yii::t('yii','CCacheHttpSession.cacheID is invalid. Please make sure "{id}" refers to a valid cache application component.',
array('{id}'=>$this->cacheID)));
parent:... | php | public function init()
{
$this->_cache=Yii::app()->getComponent($this->cacheID);
if(!($this->_cache instanceof ICache))
throw new CException(Yii::t('yii','CCacheHttpSession.cacheID is invalid. Please make sure "{id}" refers to a valid cache application component.',
array('{id}'=>$this->cacheID)));
parent:... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"_cache",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"getComponent",
"(",
"$",
"this",
"->",
"cacheID",
")",
";",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"_cache",
"instanceof",
"ICache"... | Initializes the application component.
This method overrides the parent implementation by checking if cache is available. | [
"Initializes",
"the",
"application",
"component",
".",
"This",
"method",
"overrides",
"the",
"parent",
"implementation",
"by",
"checking",
"if",
"cache",
"is",
"available",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CCacheHttpSession.php#L49-L56 | train |
yiisoft/yii | framework/web/widgets/COutputCache.php | COutputCache.checkContentCache | protected function checkContentCache()
{
if((empty($this->requestTypes) || in_array(Yii::app()->getRequest()->getRequestType(),$this->requestTypes))
&& ($this->_cache=$this->getCache())!==null)
{
if($this->duration>0 && ($data=$this->_cache->get($this->getCacheKey()))!==false)
{
$this->_content=$data[... | php | protected function checkContentCache()
{
if((empty($this->requestTypes) || in_array(Yii::app()->getRequest()->getRequestType(),$this->requestTypes))
&& ($this->_cache=$this->getCache())!==null)
{
if($this->duration>0 && ($data=$this->_cache->get($this->getCacheKey()))!==false)
{
$this->_content=$data[... | [
"protected",
"function",
"checkContentCache",
"(",
")",
"{",
"if",
"(",
"(",
"empty",
"(",
"$",
"this",
"->",
"requestTypes",
")",
"||",
"in_array",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"getRequest",
"(",
")",
"->",
"getRequestType",
"(",
")",
",",... | Looks for content in cache.
@return boolean whether the content is found in cache. | [
"Looks",
"for",
"content",
"in",
"cache",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/COutputCache.php#L233-L250 | train |
yiisoft/yii | framework/web/widgets/COutputCache.php | COutputCache.replayActions | protected function replayActions()
{
if(empty($this->_actions))
return;
$controller=$this->getController();
$cs=Yii::app()->getClientScript();
foreach($this->_actions as $action)
{
if($action[0]==='clientScript')
$object=$cs;
elseif($action[0]==='')
$object=$controller;
else
$object=$... | php | protected function replayActions()
{
if(empty($this->_actions))
return;
$controller=$this->getController();
$cs=Yii::app()->getClientScript();
foreach($this->_actions as $action)
{
if($action[0]==='clientScript')
$object=$cs;
elseif($action[0]==='')
$object=$controller;
else
$object=$... | [
"protected",
"function",
"replayActions",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_actions",
")",
")",
"return",
";",
"$",
"controller",
"=",
"$",
"this",
"->",
"getController",
"(",
")",
";",
"$",
"cs",
"=",
"Yii",
"::",
"app",
... | Replays the recorded method calls. | [
"Replays",
"the",
"recorded",
"method",
"calls",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/COutputCache.php#L340-L363 | train |
yiisoft/yii | framework/web/CDbHttpSession.php | CDbHttpSession.createSessionTable | protected function createSessionTable($db,$tableName)
{
switch($db->getDriverName())
{
case 'mysql':
$blob='LONGBLOB';
break;
case 'pgsql':
$blob='BYTEA';
break;
case 'sqlsrv':
case 'mssql':
case 'dblib':
$blob='VARBINARY(MAX)';
break;
default:
$blob='BLOB';
break;... | php | protected function createSessionTable($db,$tableName)
{
switch($db->getDriverName())
{
case 'mysql':
$blob='LONGBLOB';
break;
case 'pgsql':
$blob='BYTEA';
break;
case 'sqlsrv':
case 'mssql':
case 'dblib':
$blob='VARBINARY(MAX)';
break;
default:
$blob='BLOB';
break;... | [
"protected",
"function",
"createSessionTable",
"(",
"$",
"db",
",",
"$",
"tableName",
")",
"{",
"switch",
"(",
"$",
"db",
"->",
"getDriverName",
"(",
")",
")",
"{",
"case",
"'mysql'",
":",
"$",
"blob",
"=",
"'LONGBLOB'",
";",
"break",
";",
"case",
"'pg... | Creates the session DB table.
@param CDbConnection $db the database connection
@param string $tableName the name of the table to be created | [
"Creates",
"the",
"session",
"DB",
"table",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDbHttpSession.php#L139-L163 | train |
yiisoft/yii | framework/web/CDbHttpSession.php | CDbHttpSession.openSession | public function openSession($savePath,$sessionName)
{
if($this->autoCreateSessionTable)
{
$db=$this->getDbConnection();
$db->setActive(true);
try
{
$db->createCommand()->delete($this->sessionTableName,'expire<:expire',array(':expire'=>time()));
}
catch(Exception $e)
{
$this->createSess... | php | public function openSession($savePath,$sessionName)
{
if($this->autoCreateSessionTable)
{
$db=$this->getDbConnection();
$db->setActive(true);
try
{
$db->createCommand()->delete($this->sessionTableName,'expire<:expire',array(':expire'=>time()));
}
catch(Exception $e)
{
$this->createSess... | [
"public",
"function",
"openSession",
"(",
"$",
"savePath",
",",
"$",
"sessionName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"autoCreateSessionTable",
")",
"{",
"$",
"db",
"=",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
";",
"$",
"db",
"->",
"setAc... | Session open handler.
Do not call this method directly.
@param string $savePath session save path
@param string $sessionName session name
@return boolean whether session is opened successfully | [
"Session",
"open",
"handler",
".",
"Do",
"not",
"call",
"this",
"method",
"directly",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CDbHttpSession.php#L195-L211 | train |
yiisoft/yii | framework/web/widgets/captcha/CCaptchaAction.php | CCaptchaAction.getSessionKey | protected function getSessionKey()
{
return self::SESSION_VAR_PREFIX . Yii::app()->getId() . '.' . $this->getController()->getUniqueId() . '.' . $this->getId();
} | php | protected function getSessionKey()
{
return self::SESSION_VAR_PREFIX . Yii::app()->getId() . '.' . $this->getController()->getUniqueId() . '.' . $this->getId();
} | [
"protected",
"function",
"getSessionKey",
"(",
")",
"{",
"return",
"self",
"::",
"SESSION_VAR_PREFIX",
".",
"Yii",
"::",
"app",
"(",
")",
"->",
"getId",
"(",
")",
".",
"'.'",
".",
"$",
"this",
"->",
"getController",
"(",
")",
"->",
"getUniqueId",
"(",
... | Returns the session variable name used to store verification code.
@return string the session variable name | [
"Returns",
"the",
"session",
"variable",
"name",
"used",
"to",
"store",
"verification",
"code",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/captcha/CCaptchaAction.php#L219-L222 | train |
yiisoft/yii | build/commands/TranslationsCommand.php | TranslationsCommand.checkFiles | protected function checkFiles($translatedFilePath = null, $sourceFilePath = null)
{
$errors = array();
if($translatedFilePath!==null && !file_exists($translatedFilePath)) {
$errors[] = 'Translation does not exist.';
}
if($sourceFilePath!==null && !file_exists($sourceFilePath)) {
$errors[] = 'Source does... | php | protected function checkFiles($translatedFilePath = null, $sourceFilePath = null)
{
$errors = array();
if($translatedFilePath!==null && !file_exists($translatedFilePath)) {
$errors[] = 'Translation does not exist.';
}
if($sourceFilePath!==null && !file_exists($sourceFilePath)) {
$errors[] = 'Source does... | [
"protected",
"function",
"checkFiles",
"(",
"$",
"translatedFilePath",
"=",
"null",
",",
"$",
"sourceFilePath",
"=",
"null",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"translatedFilePath",
"!==",
"null",
"&&",
"!",
"file_exists"... | Checks for files existence
@param string $translatedFilePath
@param string $sourceFilePath
@return array errors | [
"Checks",
"for",
"files",
"existence"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/TranslationsCommand.php#L109-L121 | train |
yiisoft/yii | build/commands/TranslationsCommand.php | TranslationsCommand.highlightDiff | protected function highlightDiff($diff)
{
$lines = explode("\n", $diff);
foreach ($lines as $key => $val) {
if (mb_substr($val,0,1,'utf-8') === '@') {
$lines[$key] = '<span class="info">'.CHtml::encode($val).'</span>';
}
else if (mb_substr($val,0,1,'utf-8') === '+') {
$lines[$key] = '<ins>'.CHtml:... | php | protected function highlightDiff($diff)
{
$lines = explode("\n", $diff);
foreach ($lines as $key => $val) {
if (mb_substr($val,0,1,'utf-8') === '@') {
$lines[$key] = '<span class="info">'.CHtml::encode($val).'</span>';
}
else if (mb_substr($val,0,1,'utf-8') === '+') {
$lines[$key] = '<ins>'.CHtml:... | [
"protected",
"function",
"highlightDiff",
"(",
"$",
"diff",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"diff",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"mb_substr",
"(",... | Adds all necessary HTML tags and classes to diff output
@param string $diff DIFF
@return string highlighted DIFF | [
"Adds",
"all",
"necessary",
"HTML",
"tags",
"and",
"classes",
"to",
"diff",
"output"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/TranslationsCommand.php#L142-L161 | train |
yiisoft/yii | framework/web/form/CFormElement.php | CFormElement.configure | public function configure($config)
{
if(is_string($config))
$config=require(Yii::getPathOfAlias($config).'.php');
if(is_array($config))
{
foreach($config as $name=>$value)
$this->$name=$value;
}
} | php | public function configure($config)
{
if(is_string($config))
$config=require(Yii::getPathOfAlias($config).'.php');
if(is_array($config))
{
foreach($config as $name=>$value)
$this->$name=$value;
}
} | [
"public",
"function",
"configure",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"$",
"config",
"=",
"require",
"(",
"Yii",
"::",
"getPathOfAlias",
"(",
"$",
"config",
")",
".",
"'.php'",
")",
";",
"if",
"(",
"... | Configures this object with property initial values.
@param mixed $config the configuration for this object. This can be an array
representing the property names and their initial values.
It can also be a string representing the file name of the PHP script
that returns a configuration array. | [
"Configures",
"this",
"object",
"with",
"property",
"initial",
"values",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CFormElement.php#L138-L147 | train |
yiisoft/yii | framework/web/auth/CPhpAuthManager.php | CPhpAuthManager.init | public function init()
{
parent::init();
if($this->authFile===null)
$this->authFile=Yii::getPathOfAlias('application.data.auth').'.php';
$this->load();
} | php | public function init()
{
parent::init();
if($this->authFile===null)
$this->authFile=Yii::getPathOfAlias('application.data.auth').'.php';
$this->load();
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"authFile",
"===",
"null",
")",
"$",
"this",
"->",
"authFile",
"=",
"Yii",
"::",
"getPathOfAlias",
"(",
"'application.data.auth'",
")",
".... | Initializes the application component.
This method overrides parent implementation by loading the authorization data
from PHP script. | [
"Initializes",
"the",
"application",
"component",
".",
"This",
"method",
"overrides",
"parent",
"implementation",
"by",
"loading",
"the",
"authorization",
"data",
"from",
"PHP",
"script",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CPhpAuthManager.php#L48-L54 | train |
yiisoft/yii | framework/web/auth/CPhpAuthManager.php | CPhpAuthManager.save | public function save()
{
$items=array();
foreach($this->_items as $name=>$item)
{
$items[$name]=array(
'type'=>$item->getType(),
'description'=>$item->getDescription(),
'bizRule'=>$item->getBizRule(),
'data'=>$item->getData(),
);
if(isset($this->_children[$name]))
{
foreach($this-... | php | public function save()
{
$items=array();
foreach($this->_items as $name=>$item)
{
$items[$name]=array(
'type'=>$item->getType(),
'description'=>$item->getDescription(),
'bizRule'=>$item->getBizRule(),
'data'=>$item->getData(),
);
if(isset($this->_children[$name]))
{
foreach($this-... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"items",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_items",
"as",
"$",
"name",
"=>",
"$",
"item",
")",
"{",
"$",
"items",
"[",
"$",
"name",
"]",
"=",
"array",
"(",
"'type'... | Saves authorization data into persistent storage.
If any change is made to the authorization data, please make
sure you call this method to save the changed data into persistent storage. | [
"Saves",
"authorization",
"data",
"into",
"persistent",
"storage",
".",
"If",
"any",
"change",
"is",
"made",
"to",
"the",
"authorization",
"data",
"please",
"make",
"sure",
"you",
"call",
"this",
"method",
"to",
"save",
"the",
"changed",
"data",
"into",
"per... | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CPhpAuthManager.php#L377-L410 | train |
yiisoft/yii | framework/web/auth/CPhpAuthManager.php | CPhpAuthManager.load | public function load()
{
$this->clearAll();
$items=$this->loadFromFile($this->authFile);
foreach($items as $name=>$item)
$this->_items[$name]=new CAuthItem($this,$name,$item['type'],$item['description'],$item['bizRule'],$item['data']);
foreach($items as $name=>$item)
{
if(isset($item['children']))
... | php | public function load()
{
$this->clearAll();
$items=$this->loadFromFile($this->authFile);
foreach($items as $name=>$item)
$this->_items[$name]=new CAuthItem($this,$name,$item['type'],$item['description'],$item['bizRule'],$item['data']);
foreach($items as $name=>$item)
{
if(isset($item['children']))
... | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"this",
"->",
"clearAll",
"(",
")",
";",
"$",
"items",
"=",
"$",
"this",
"->",
"loadFromFile",
"(",
"$",
"this",
"->",
"authFile",
")",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"name",
"=>",
... | Loads authorization data. | [
"Loads",
"authorization",
"data",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CPhpAuthManager.php#L415-L442 | train |
yiisoft/yii | demos/phonebook/protected/controllers/SiteController.php | SiteController.beforeWebMethod | public function beforeWebMethod($service)
{
$safeMethods=array(
'login',
'getContacts',
);
$pattern='/^('.implode('|',$safeMethods).')$/i';
if(!Yii::app()->user->isGuest || preg_match($pattern,$service->methodName))
return true;
else
throw new CException('Login required.');
} | php | public function beforeWebMethod($service)
{
$safeMethods=array(
'login',
'getContacts',
);
$pattern='/^('.implode('|',$safeMethods).')$/i';
if(!Yii::app()->user->isGuest || preg_match($pattern,$service->methodName))
return true;
else
throw new CException('Login required.');
} | [
"public",
"function",
"beforeWebMethod",
"(",
"$",
"service",
")",
"{",
"$",
"safeMethods",
"=",
"array",
"(",
"'login'",
",",
"'getContacts'",
",",
")",
";",
"$",
"pattern",
"=",
"'/^('",
".",
"implode",
"(",
"'|'",
",",
"$",
"safeMethods",
")",
".",
... | This method is required by IWebServiceProvider.
It makes sure the user is logged in before making changes to data.
@param CWebService the currently requested Web service.
@return boolean whether the remote method should be executed. | [
"This",
"method",
"is",
"required",
"by",
"IWebServiceProvider",
".",
"It",
"makes",
"sure",
"the",
"user",
"is",
"logged",
"in",
"before",
"making",
"changes",
"to",
"data",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/phonebook/protected/controllers/SiteController.php#L57-L68 | train |
yiisoft/yii | demos/phonebook/protected/controllers/SiteController.php | SiteController.saveContact | public function saveContact($contact)
{
if($contact->id > 0) // update
{
$contact->isNewRecord=false;
if(($oldContact=Contact::model()->findByPk($contact->id))!==null)
{
$oldContact->attributes=$contact->attributes;
return $oldContact->save();
}
else
return false;
}
else // insert
... | php | public function saveContact($contact)
{
if($contact->id > 0) // update
{
$contact->isNewRecord=false;
if(($oldContact=Contact::model()->findByPk($contact->id))!==null)
{
$oldContact->attributes=$contact->attributes;
return $oldContact->save();
}
else
return false;
}
else // insert
... | [
"public",
"function",
"saveContact",
"(",
"$",
"contact",
")",
"{",
"if",
"(",
"$",
"contact",
"->",
"id",
">",
"0",
")",
"// update",
"{",
"$",
"contact",
"->",
"isNewRecord",
"=",
"false",
";",
"if",
"(",
"(",
"$",
"oldContact",
"=",
"Contact",
"::... | Updates or inserts a contact.
If the ID is null, an insertion will be performed;
Otherwise it updates the existing one.
@param Contact contact model
@return boolean whether saving is successful
@soap | [
"Updates",
"or",
"inserts",
"a",
"contact",
".",
"If",
"the",
"ID",
"is",
"null",
"an",
"insertion",
"will",
"be",
"performed",
";",
"Otherwise",
"it",
"updates",
"the",
"existing",
"one",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/phonebook/protected/controllers/SiteController.php#L112-L131 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff/Renderer.php | Text_Diff_Renderer.getParams | function getParams()
{
$params = array();
foreach (get_object_vars($this) as $k => $v) {
if ($k[0] == '_') {
$params[substr($k, 1)] = $v;
}
}
return $params;
} | php | function getParams()
{
$params = array();
foreach (get_object_vars($this) as $k => $v) {
if ($k[0] == '_') {
$params[substr($k, 1)] = $v;
}
}
return $params;
} | [
"function",
"getParams",
"(",
")",
"{",
"$",
"params",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"if",
"(",
"$",
"k",
"[",
"0",
"]",
"==",
"'_'",
")",
"{",... | Get any renderer parameters.
@return array All parameters of this renderer object. | [
"Get",
"any",
"renderer",
"parameters",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff/Renderer.php#L53-L63 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff/Renderer.php | Text_Diff_Renderer.render | function render($diff)
{
$xi = $yi = 1;
$block = false;
$context = array();
$nlead = $this->_leading_context_lines;
$ntrail = $this->_trailing_context_lines;
$output = $this->_startDiff();
$diffs = $diff->getDiff();
foreach ($diffs as $i => $edit) {... | php | function render($diff)
{
$xi = $yi = 1;
$block = false;
$context = array();
$nlead = $this->_leading_context_lines;
$ntrail = $this->_trailing_context_lines;
$output = $this->_startDiff();
$diffs = $diff->getDiff();
foreach ($diffs as $i => $edit) {... | [
"function",
"render",
"(",
"$",
"diff",
")",
"{",
"$",
"xi",
"=",
"$",
"yi",
"=",
"1",
";",
"$",
"block",
"=",
"false",
";",
"$",
"context",
"=",
"array",
"(",
")",
";",
"$",
"nlead",
"=",
"$",
"this",
"->",
"_leading_context_lines",
";",
"$",
... | Renders a diff.
@param Text_Diff $diff A Text_Diff object.
@return string The formatted output. | [
"Renders",
"a",
"diff",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff/Renderer.php#L72-L144 | train |
yiisoft/yii | framework/web/widgets/CTextHighlighter.php | CTextHighlighter.highlight | public function highlight($content)
{
$this->registerClientScript();
$options['use_language']=true;
$options['tabsize']=$this->tabSize;
if($this->showLineNumbers)
$options['numbers']=($this->lineNumberStyle==='list')?HL_NUMBERS_LI:HL_NUMBERS_TABLE;
$highlighter=empty($this->language)?false:Text_Highligh... | php | public function highlight($content)
{
$this->registerClientScript();
$options['use_language']=true;
$options['tabsize']=$this->tabSize;
if($this->showLineNumbers)
$options['numbers']=($this->lineNumberStyle==='list')?HL_NUMBERS_LI:HL_NUMBERS_TABLE;
$highlighter=empty($this->language)?false:Text_Highligh... | [
"public",
"function",
"highlight",
"(",
"$",
"content",
")",
"{",
"$",
"this",
"->",
"registerClientScript",
"(",
")",
";",
"$",
"options",
"[",
"'use_language'",
"]",
"=",
"true",
";",
"$",
"options",
"[",
"'tabsize'",
"]",
"=",
"$",
"this",
"->",
"ta... | Highlights the content by the syntax of the specified language.
@param string $content the content to be highlighted.
@return string the highlighted content | [
"Highlights",
"the",
"content",
"by",
"the",
"syntax",
"of",
"the",
"specified",
"language",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CTextHighlighter.php#L84-L103 | train |
yiisoft/yii | framework/base/CErrorHandler.php | CErrorHandler.handleException | protected function handleException($exception)
{
$app=Yii::app();
if($app instanceof CWebApplication)
{
if(($trace=$this->getExactTrace($exception))===null)
{
$fileName=$exception->getFile();
$errorLine=$exception->getLine();
}
else
{
$fileName=$trace['file'];
$errorLine=$trace['li... | php | protected function handleException($exception)
{
$app=Yii::app();
if($app instanceof CWebApplication)
{
if(($trace=$this->getExactTrace($exception))===null)
{
$fileName=$exception->getFile();
$errorLine=$exception->getLine();
}
else
{
$fileName=$trace['file'];
$errorLine=$trace['li... | [
"protected",
"function",
"handleException",
"(",
"$",
"exception",
")",
"{",
"$",
"app",
"=",
"Yii",
"::",
"app",
"(",
")",
";",
"if",
"(",
"$",
"app",
"instanceof",
"CWebApplication",
")",
"{",
"if",
"(",
"(",
"$",
"trace",
"=",
"$",
"this",
"->",
... | Handles the exception.
@param Exception $exception the exception captured | [
"Handles",
"the",
"exception",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CErrorHandler.php#L168-L222 | train |
yiisoft/yii | framework/base/CErrorHandler.php | CErrorHandler.getExactTrace | protected function getExactTrace($exception)
{
$traces=$exception->getTrace();
foreach($traces as $trace)
{
// property access exception
if(isset($trace['function']) && ($trace['function']==='__get' || $trace['function']==='__set'))
return $trace;
}
return null;
} | php | protected function getExactTrace($exception)
{
$traces=$exception->getTrace();
foreach($traces as $trace)
{
// property access exception
if(isset($trace['function']) && ($trace['function']==='__get' || $trace['function']==='__set'))
return $trace;
}
return null;
} | [
"protected",
"function",
"getExactTrace",
"(",
"$",
"exception",
")",
"{",
"$",
"traces",
"=",
"$",
"exception",
"->",
"getTrace",
"(",
")",
";",
"foreach",
"(",
"$",
"traces",
"as",
"$",
"trace",
")",
"{",
"// property access exception",
"if",
"(",
"isset... | Returns the exact trace where the problem occurs.
@param Exception $exception the uncaught exception
@return array the exact trace where the problem occurs | [
"Returns",
"the",
"exact",
"trace",
"where",
"the",
"problem",
"occurs",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CErrorHandler.php#L316-L327 | train |
yiisoft/yii | framework/base/CErrorHandler.php | CErrorHandler.getViewFile | protected function getViewFile($view,$code)
{
$viewPaths=array(
Yii::app()->getTheme()===null ? null : Yii::app()->getTheme()->getSystemViewPath(),
Yii::app() instanceof CWebApplication ? Yii::app()->getSystemViewPath() : null,
YII_PATH.DIRECTORY_SEPARATOR.'views',
);
foreach($viewPaths as $i=>$viewPa... | php | protected function getViewFile($view,$code)
{
$viewPaths=array(
Yii::app()->getTheme()===null ? null : Yii::app()->getTheme()->getSystemViewPath(),
Yii::app() instanceof CWebApplication ? Yii::app()->getSystemViewPath() : null,
YII_PATH.DIRECTORY_SEPARATOR.'views',
);
foreach($viewPaths as $i=>$viewPa... | [
"protected",
"function",
"getViewFile",
"(",
"$",
"view",
",",
"$",
"code",
")",
"{",
"$",
"viewPaths",
"=",
"array",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"getTheme",
"(",
")",
"===",
"null",
"?",
"null",
":",
"Yii",
"::",
"app",
"(",
")",
"-... | Determines which view file should be used.
@param string $view view name (either 'exception' or 'error')
@param integer $code HTTP status code
@return string view file path | [
"Determines",
"which",
"view",
"file",
"should",
"be",
"used",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CErrorHandler.php#L387-L404 | train |
yiisoft/yii | framework/base/CErrorHandler.php | CErrorHandler.getViewFileInternal | protected function getViewFileInternal($viewPath,$view,$code,$srcLanguage=null)
{
$app=Yii::app();
if($view==='error')
{
$viewFile=$app->findLocalizedFile($viewPath.DIRECTORY_SEPARATOR."error{$code}.php",$srcLanguage);
if(!is_file($viewFile))
$viewFile=$app->findLocalizedFile($viewPath.DIRECTORY_SEPARA... | php | protected function getViewFileInternal($viewPath,$view,$code,$srcLanguage=null)
{
$app=Yii::app();
if($view==='error')
{
$viewFile=$app->findLocalizedFile($viewPath.DIRECTORY_SEPARATOR."error{$code}.php",$srcLanguage);
if(!is_file($viewFile))
$viewFile=$app->findLocalizedFile($viewPath.DIRECTORY_SEPARA... | [
"protected",
"function",
"getViewFileInternal",
"(",
"$",
"viewPath",
",",
"$",
"view",
",",
"$",
"code",
",",
"$",
"srcLanguage",
"=",
"null",
")",
"{",
"$",
"app",
"=",
"Yii",
"::",
"app",
"(",
")",
";",
"if",
"(",
"$",
"view",
"===",
"'error'",
... | Looks for the view under the specified directory.
@param string $viewPath the directory containing the views
@param string $view view name (either 'exception' or 'error')
@param integer $code HTTP status code
@param string $srcLanguage the language that the view file is in
@return string view file path | [
"Looks",
"for",
"the",
"view",
"under",
"the",
"specified",
"directory",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CErrorHandler.php#L414-L426 | train |
yiisoft/yii | framework/base/CErrorHandler.php | CErrorHandler.getVersionInfo | protected function getVersionInfo()
{
if(YII_DEBUG)
{
$version='<a href="http://www.yiiframework.com/">Yii Framework</a>/'.Yii::getVersion();
if(isset($_SERVER['SERVER_SOFTWARE']))
$version=$_SERVER['SERVER_SOFTWARE'].' '.$version;
}
else
$version='';
return $version;
} | php | protected function getVersionInfo()
{
if(YII_DEBUG)
{
$version='<a href="http://www.yiiframework.com/">Yii Framework</a>/'.Yii::getVersion();
if(isset($_SERVER['SERVER_SOFTWARE']))
$version=$_SERVER['SERVER_SOFTWARE'].' '.$version;
}
else
$version='';
return $version;
} | [
"protected",
"function",
"getVersionInfo",
"(",
")",
"{",
"if",
"(",
"YII_DEBUG",
")",
"{",
"$",
"version",
"=",
"'<a href=\"http://www.yiiframework.com/\">Yii Framework</a>/'",
".",
"Yii",
"::",
"getVersion",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"_SERVE... | Returns server version information.
If the application is in production mode, empty string is returned.
@return string server version information. Empty if in production mode. | [
"Returns",
"server",
"version",
"information",
".",
"If",
"the",
"application",
"is",
"in",
"production",
"mode",
"empty",
"string",
"is",
"returned",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CErrorHandler.php#L433-L444 | train |
yiisoft/yii | framework/base/CErrorHandler.php | CErrorHandler.isCoreCode | protected function isCoreCode($trace)
{
if(isset($trace['file']))
{
$systemPath=realpath(dirname(__FILE__).'/..');
return $trace['file']==='unknown' || strpos(realpath($trace['file']),$systemPath.DIRECTORY_SEPARATOR)===0;
}
return false;
} | php | protected function isCoreCode($trace)
{
if(isset($trace['file']))
{
$systemPath=realpath(dirname(__FILE__).'/..');
return $trace['file']==='unknown' || strpos(realpath($trace['file']),$systemPath.DIRECTORY_SEPARATOR)===0;
}
return false;
} | [
"protected",
"function",
"isCoreCode",
"(",
"$",
"trace",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"trace",
"[",
"'file'",
"]",
")",
")",
"{",
"$",
"systemPath",
"=",
"realpath",
"(",
"dirname",
"(",
"__FILE__",
")",
".",
"'/..'",
")",
";",
"return",
... | Returns a value indicating whether the call stack is from application code.
@param array $trace the trace data
@return boolean whether the call stack is from application code. | [
"Returns",
"a",
"value",
"indicating",
"whether",
"the",
"call",
"stack",
"is",
"from",
"application",
"code",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CErrorHandler.php#L507-L515 | train |
yiisoft/yii | framework/base/CErrorHandler.php | CErrorHandler.renderSourceCode | protected function renderSourceCode($file,$errorLine,$maxLines)
{
$errorLine--; // adjust line number to 0-based from 1-based
if($errorLine<0 || ($lines=@file($file))===false || ($lineCount=count($lines))<=$errorLine)
return '';
$halfLines=(int)($maxLines/2);
$beginLine=$errorLine-$halfLines>0 ? $errorLine... | php | protected function renderSourceCode($file,$errorLine,$maxLines)
{
$errorLine--; // adjust line number to 0-based from 1-based
if($errorLine<0 || ($lines=@file($file))===false || ($lineCount=count($lines))<=$errorLine)
return '';
$halfLines=(int)($maxLines/2);
$beginLine=$errorLine-$halfLines>0 ? $errorLine... | [
"protected",
"function",
"renderSourceCode",
"(",
"$",
"file",
",",
"$",
"errorLine",
",",
"$",
"maxLines",
")",
"{",
"$",
"errorLine",
"--",
";",
"// adjust line number to 0-based from 1-based",
"if",
"(",
"$",
"errorLine",
"<",
"0",
"||",
"(",
"$",
"lines",
... | Renders the source code around the error line.
@param string $file source file path
@param integer $errorLine the error line number
@param integer $maxLines maximum number of lines to display
@return string the rendering result | [
"Renders",
"the",
"source",
"code",
"around",
"the",
"error",
"line",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/base/CErrorHandler.php#L524-L546 | train |
yiisoft/yii | framework/web/widgets/CMultiFileUpload.php | CMultiFileUpload.run | public function run()
{
list($name,$id)=$this->resolveNameID();
if(substr($name,-2)!=='[]')
$name.='[]';
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
$this->htmlOptions['id']=$id;
$this->registerClientScript();
echo CHtml::fileField($name,'',$this->htmlOptions);
} | php | public function run()
{
list($name,$id)=$this->resolveNameID();
if(substr($name,-2)!=='[]')
$name.='[]';
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
$this->htmlOptions['id']=$id;
$this->registerClientScript();
echo CHtml::fileField($name,'',$this->htmlOptions);
} | [
"public",
"function",
"run",
"(",
")",
"{",
"list",
"(",
"$",
"name",
",",
"$",
"id",
")",
"=",
"$",
"this",
"->",
"resolveNameID",
"(",
")",
";",
"if",
"(",
"substr",
"(",
"$",
"name",
",",
"-",
"2",
")",
"!==",
"'[]'",
")",
"$",
"name",
".=... | Runs the widget.
This method registers all needed client scripts and renders
the multiple file uploader. | [
"Runs",
"the",
"widget",
".",
"This",
"method",
"registers",
"all",
"needed",
"client",
"scripts",
"and",
"renders",
"the",
"multiple",
"file",
"uploader",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CMultiFileUpload.php#L85-L96 | train |
yiisoft/yii | framework/zii/widgets/CListView.php | CListView.renderItems | public function renderItems()
{
echo CHtml::openTag($this->itemsTagName,array('class'=>$this->itemsCssClass))."\n";
$data=$this->dataProvider->getData();
if(($n=count($data))>0)
{
$owner=$this->getOwner();
$viewFile=$owner->getViewFile($this->itemView);
$j=0;
foreach($data as $i=>$item)
{
$d... | php | public function renderItems()
{
echo CHtml::openTag($this->itemsTagName,array('class'=>$this->itemsCssClass))."\n";
$data=$this->dataProvider->getData();
if(($n=count($data))>0)
{
$owner=$this->getOwner();
$viewFile=$owner->getViewFile($this->itemView);
$j=0;
foreach($data as $i=>$item)
{
$d... | [
"public",
"function",
"renderItems",
"(",
")",
"{",
"echo",
"CHtml",
"::",
"openTag",
"(",
"$",
"this",
"->",
"itemsTagName",
",",
"array",
"(",
"'class'",
"=>",
"$",
"this",
"->",
"itemsCssClass",
")",
")",
".",
"\"\\n\"",
";",
"$",
"data",
"=",
"$",
... | Renders the data item list. | [
"Renders",
"the",
"data",
"item",
"list",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/CListView.php#L276-L299 | train |
yiisoft/yii | framework/zii/widgets/CListView.php | CListView.renderSorter | public function renderSorter()
{
if($this->dataProvider->getItemCount()<=0 || !$this->enableSorting || empty($this->sortableAttributes))
return;
echo CHtml::openTag('div',array('class'=>$this->sorterCssClass))."\n";
echo $this->sorterHeader===null ? Yii::t('zii','Sort by: ') : $this->sorterHeader;
echo "<ul... | php | public function renderSorter()
{
if($this->dataProvider->getItemCount()<=0 || !$this->enableSorting || empty($this->sortableAttributes))
return;
echo CHtml::openTag('div',array('class'=>$this->sorterCssClass))."\n";
echo $this->sorterHeader===null ? Yii::t('zii','Sort by: ') : $this->sorterHeader;
echo "<ul... | [
"public",
"function",
"renderSorter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dataProvider",
"->",
"getItemCount",
"(",
")",
"<=",
"0",
"||",
"!",
"$",
"this",
"->",
"enableSorting",
"||",
"empty",
"(",
"$",
"this",
"->",
"sortableAttributes",
")",... | Renders the sorter. | [
"Renders",
"the",
"sorter",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/CListView.php#L304-L324 | train |
yiisoft/yii | build/commands/lite/protected/components/UserIdentity.php | UserIdentity.authenticate | public function authenticate()
{
if($this->username==='demo' && $this->password==='demo')
$this->errorCode=self::ERROR_NONE;
else
$this->errorCode=self::ERROR_PASSWORD_INVALID;
return !$this->errorCode;
} | php | public function authenticate()
{
if($this->username==='demo' && $this->password==='demo')
$this->errorCode=self::ERROR_NONE;
else
$this->errorCode=self::ERROR_PASSWORD_INVALID;
return !$this->errorCode;
} | [
"public",
"function",
"authenticate",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"username",
"===",
"'demo'",
"&&",
"$",
"this",
"->",
"password",
"===",
"'demo'",
")",
"$",
"this",
"->",
"errorCode",
"=",
"self",
"::",
"ERROR_NONE",
";",
"else",
"$"... | Validates the username and password.
This method should check the validity of the provided username
and password in some way. In case of any authentication failure,
set errorCode and errorMessage with appropriate values and return false.
@param string username
@param string password
@return boolean whether the username... | [
"Validates",
"the",
"username",
"and",
"password",
".",
"This",
"method",
"should",
"check",
"the",
"validity",
"of",
"the",
"provided",
"username",
"and",
"password",
"in",
"some",
"way",
".",
"In",
"case",
"of",
"any",
"authentication",
"failure",
"set",
"... | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/components/UserIdentity.php#L19-L26 | train |
yiisoft/yii | framework/web/widgets/CAutoComplete.php | CAutoComplete.init | public function init()
{
list($name,$id)=$this->resolveNameID();
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
$this->htmlOptions['id']=$id;
if(isset($this->htmlOptions['name']))
$name=$this->htmlOptions['name'];
$this->registerClientScript();
if($this->hasModel())
{
... | php | public function init()
{
list($name,$id)=$this->resolveNameID();
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
$this->htmlOptions['id']=$id;
if(isset($this->htmlOptions['name']))
$name=$this->htmlOptions['name'];
$this->registerClientScript();
if($this->hasModel())
{
... | [
"public",
"function",
"init",
"(",
")",
"{",
"list",
"(",
"$",
"name",
",",
"$",
"id",
")",
"=",
"$",
"this",
"->",
"resolveNameID",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'id'",
"]",
")",
")",
"$",
"id"... | Initializes the widget.
This method registers all needed client scripts and renders
the autocomplete input. | [
"Initializes",
"the",
"widget",
".",
"This",
"method",
"registers",
"all",
"needed",
"client",
"scripts",
"and",
"renders",
"the",
"autocomplete",
"input",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CAutoComplete.php#L201-L223 | train |
yiisoft/yii | framework/i18n/gettext/CGettextMoFile.php | CGettextMoFile.save | public function save($file,$messages)
{
if(!($fw=@fopen($file,'wb')))
throw new CException(Yii::t('yii','Unable to write file "{file}".',
array('{file}'=>$file)));
if(!@flock($fw,LOCK_EX))
throw new CException(Yii::t('yii','Unable to lock file "{file}" for writing.',
array('{file}'=>$file)));
// ... | php | public function save($file,$messages)
{
if(!($fw=@fopen($file,'wb')))
throw new CException(Yii::t('yii','Unable to write file "{file}".',
array('{file}'=>$file)));
if(!@flock($fw,LOCK_EX))
throw new CException(Yii::t('yii','Unable to lock file "{file}" for writing.',
array('{file}'=>$file)));
// ... | [
"public",
"function",
"save",
"(",
"$",
"file",
",",
"$",
"messages",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"fw",
"=",
"@",
"fopen",
"(",
"$",
"file",
",",
"'wb'",
")",
")",
")",
"throw",
"new",
"CException",
"(",
"Yii",
"::",
"t",
"(",
"'yii'",
... | Saves messages to an MO file.
@param string $file file path
@param array $messages message translations (message id => translated message).
Note if the message has a context, the message id must be prefixed with
the context with chr(4) as the separator.
@throws CException | [
"Saves",
"messages",
"to",
"an",
"MO",
"file",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/gettext/CGettextMoFile.php#L143-L204 | train |
yiisoft/yii | framework/i18n/gettext/CGettextMoFile.php | CGettextMoFile.writeInteger | protected function writeInteger($fw,$data)
{
return $this->writeByte($fw,pack($this->useBigEndian ? 'N' : 'V', (int)$data));
} | php | protected function writeInteger($fw,$data)
{
return $this->writeByte($fw,pack($this->useBigEndian ? 'N' : 'V', (int)$data));
} | [
"protected",
"function",
"writeInteger",
"(",
"$",
"fw",
",",
"$",
"data",
")",
"{",
"return",
"$",
"this",
"->",
"writeByte",
"(",
"$",
"fw",
",",
"pack",
"(",
"$",
"this",
"->",
"useBigEndian",
"?",
"'N'",
":",
"'V'",
",",
"(",
"int",
")",
"$",
... | Writes a 4-byte integer.
@param resource $fw file handle
@param integer $data the data
@return integer how many bytes are written | [
"Writes",
"a",
"4",
"-",
"byte",
"integer",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/gettext/CGettextMoFile.php#L247-L250 | train |
yiisoft/yii | framework/i18n/gettext/CGettextMoFile.php | CGettextMoFile.readString | protected function readString($fr,$length,$offset=null)
{
if($offset!==null)
fseek($fr,$offset);
return $this->readByte($fr,$length);
} | php | protected function readString($fr,$length,$offset=null)
{
if($offset!==null)
fseek($fr,$offset);
return $this->readByte($fr,$length);
} | [
"protected",
"function",
"readString",
"(",
"$",
"fr",
",",
"$",
"length",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"offset",
"!==",
"null",
")",
"fseek",
"(",
"$",
"fr",
",",
"$",
"offset",
")",
";",
"return",
"$",
"this",
"->"... | Reads a string.
@param resource $fr file handle
@param integer $length string length
@param integer $offset offset of the string in the file. If null, it reads from the current position.
@return string the result | [
"Reads",
"a",
"string",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/gettext/CGettextMoFile.php#L259-L264 | train |
yiisoft/yii | framework/utils/CPropertyValue.php | CPropertyValue.ensureArray | public static function ensureArray($value)
{
if(is_string($value))
{
$value = trim($value);
$len = strlen($value);
if ($len >= 2 && $value[0] == '(' && $value[$len-1] == ')')
{
try
{
return eval('return array' . $value . ';');
}
catch (ParseError $e)
{
return array();
... | php | public static function ensureArray($value)
{
if(is_string($value))
{
$value = trim($value);
$len = strlen($value);
if ($len >= 2 && $value[0] == '(' && $value[$len-1] == ')')
{
try
{
return eval('return array' . $value . ';');
}
catch (ParseError $e)
{
return array();
... | [
"public",
"static",
"function",
"ensureArray",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"trim",
"(",
"$",
"value",
")",
";",
"$",
"len",
"=",
"strlen",
"(",
"$",
"value",
")",
";",
... | Converts a value to array type.
If the value is a string and it is in the form (a,b,c) then an array
consisting of each of the elements will be returned. If the value is a string
and it is not in this form then an array consisting of just the string will be returned,
if the string is empty an empty array will be retur... | [
"Converts",
"a",
"value",
"to",
"array",
"type",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CPropertyValue.php#L108-L130 | train |
yiisoft/yii | framework/utils/CPropertyValue.php | CPropertyValue.ensureEnum | public static function ensureEnum($value,$enumType)
{
static $types=array();
if(!isset($types[$enumType]))
$types[$enumType]=new ReflectionClass($enumType);
if($types[$enumType]->hasConstant($value))
return $value;
else
throw new CException(Yii::t('yii','Invalid enumerable value "{value}". Please make... | php | public static function ensureEnum($value,$enumType)
{
static $types=array();
if(!isset($types[$enumType]))
$types[$enumType]=new ReflectionClass($enumType);
if($types[$enumType]->hasConstant($value))
return $value;
else
throw new CException(Yii::t('yii','Invalid enumerable value "{value}". Please make... | [
"public",
"static",
"function",
"ensureEnum",
"(",
"$",
"value",
",",
"$",
"enumType",
")",
"{",
"static",
"$",
"types",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"types",
"[",
"$",
"enumType",
"]",
")",
")",
"$",
"types",
"... | Converts a value to enum type.
This method checks if the value is of the specified enumerable type.
A value is a valid enumerable value if it is equal to the name of a constant
in the specified enumerable type (class).
For more details about enumerable, see {@link CEnumerable}.
@param string $value the enumerable val... | [
"Converts",
"a",
"value",
"to",
"enum",
"type",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CPropertyValue.php#L155-L165 | train |
yiisoft/yii | framework/gii/generators/model/ModelCode.php | ModelCode.isRelationTable | protected function isRelationTable($table)
{
$pk=$table->primaryKey;
$count=is_array($pk) ? count($pk) : 1;
return ($count === 2 // we want 2 columns
&& isset($table->foreignKeys[$pk[0]]) // pk column 1 is also a foreign key
&& isset($table->foreignKeys[$pk[1]]) // pk column 2 is also a foriegn... | php | protected function isRelationTable($table)
{
$pk=$table->primaryKey;
$count=is_array($pk) ? count($pk) : 1;
return ($count === 2 // we want 2 columns
&& isset($table->foreignKeys[$pk[0]]) // pk column 1 is also a foreign key
&& isset($table->foreignKeys[$pk[1]]) // pk column 2 is also a foriegn... | [
"protected",
"function",
"isRelationTable",
"(",
"$",
"table",
")",
"{",
"$",
"pk",
"=",
"$",
"table",
"->",
"primaryKey",
";",
"$",
"count",
"=",
"is_array",
"(",
"$",
"pk",
")",
"?",
"count",
"(",
"$",
"pk",
")",
":",
"1",
";",
"return",
"(",
"... | Checks if the given table is a "many to many" pivot table.
Their PK has 2 fields, and both of those fields are also FK to other separate tables.
@param CDbTableSchema table to inspect
@return boolean true if table matches description of helper table. | [
"Checks",
"if",
"the",
"given",
"table",
"is",
"a",
"many",
"to",
"many",
"pivot",
"table",
".",
"Their",
"PK",
"has",
"2",
"fields",
"and",
"both",
"of",
"those",
"fields",
"are",
"also",
"FK",
"to",
"other",
"separate",
"tables",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/generators/model/ModelCode.php#L368-L376 | train |
yiisoft/yii | framework/web/auth/CAuthManager.php | CAuthManager.executeBizRule | public function executeBizRule($bizRule,$params,$data)
{
if($bizRule==='' || $bizRule===null)
return true;
if ($this->showErrors)
return eval($bizRule)!=0;
else
{
try
{
return @eval($bizRule)!=0;
}
catch (ParseError $e)
{
return false;
}
}
} | php | public function executeBizRule($bizRule,$params,$data)
{
if($bizRule==='' || $bizRule===null)
return true;
if ($this->showErrors)
return eval($bizRule)!=0;
else
{
try
{
return @eval($bizRule)!=0;
}
catch (ParseError $e)
{
return false;
}
}
} | [
"public",
"function",
"executeBizRule",
"(",
"$",
"bizRule",
",",
"$",
"params",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"bizRule",
"===",
"''",
"||",
"$",
"bizRule",
"===",
"null",
")",
"return",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"sho... | Executes the specified business rule.
@param string $bizRule the business rule to be executed.
@param array $params parameters passed to {@link IAuthManager::checkAccess}.
@param mixed $data additional data associated with the authorization item or assignment.
@return boolean whether the business rule returns true.
If ... | [
"Executes",
"the",
"specified",
"business",
"rule",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CAuthManager.php#L147-L164 | train |
yiisoft/yii | framework/web/auth/CAuthManager.php | CAuthManager.checkItemChildType | protected function checkItemChildType($parentType,$childType)
{
static $types=array('operation','task','role');
if($parentType < $childType)
throw new CException(Yii::t('yii','Cannot add an item of type "{child}" to an item of type "{parent}".',
array('{child}'=>$types[$childType], '{parent}'=>$types[$paren... | php | protected function checkItemChildType($parentType,$childType)
{
static $types=array('operation','task','role');
if($parentType < $childType)
throw new CException(Yii::t('yii','Cannot add an item of type "{child}" to an item of type "{parent}".',
array('{child}'=>$types[$childType], '{parent}'=>$types[$paren... | [
"protected",
"function",
"checkItemChildType",
"(",
"$",
"parentType",
",",
"$",
"childType",
")",
"{",
"static",
"$",
"types",
"=",
"array",
"(",
"'operation'",
",",
"'task'",
",",
"'role'",
")",
";",
"if",
"(",
"$",
"parentType",
"<",
"$",
"childType",
... | Checks the item types to make sure a child can be added to a parent.
@param integer $parentType parent item type
@param integer $childType child item type
@throws CException if the item cannot be added as a child due to its incompatible type. | [
"Checks",
"the",
"item",
"types",
"to",
"make",
"sure",
"a",
"child",
"can",
"be",
"added",
"to",
"a",
"parent",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CAuthManager.php#L172-L178 | train |
yiisoft/yii | framework/i18n/CNumberFormatter.php | CNumberFormatter.formatCurrency | public function formatCurrency($value,$currency)
{
return $this->format($this->_locale->getCurrencyFormat(),$value,$currency);
} | php | public function formatCurrency($value,$currency)
{
return $this->format($this->_locale->getCurrencyFormat(),$value,$currency);
} | [
"public",
"function",
"formatCurrency",
"(",
"$",
"value",
",",
"$",
"currency",
")",
"{",
"return",
"$",
"this",
"->",
"format",
"(",
"$",
"this",
"->",
"_locale",
"->",
"getCurrencyFormat",
"(",
")",
",",
"$",
"value",
",",
"$",
"currency",
")",
";",... | Formats a number using the currency format defined in the locale.
@param mixed $value the number to be formatted
@param string $currency 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.
The currency placeholder in the pattern will be replaced with the ... | [
"Formats",
"a",
"number",
"using",
"the",
"currency",
"format",
"defined",
"in",
"the",
"locale",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CNumberFormatter.php#L108-L111 | train |
yiisoft/yii | framework/validators/CFileValidator.php | CFileValidator.emptyAttribute | protected function emptyAttribute($object, $attribute)
{
if($this->safe)
$object->$attribute=null;
if(!$this->allowEmpty)
{
$message=$this->message!==null?$this->message : Yii::t('yii','{attribute} cannot be blank.');
$this->addError($object,$attribute,$message);
}
} | php | protected function emptyAttribute($object, $attribute)
{
if($this->safe)
$object->$attribute=null;
if(!$this->allowEmpty)
{
$message=$this->message!==null?$this->message : Yii::t('yii','{attribute} cannot be blank.');
$this->addError($object,$attribute,$message);
}
} | [
"protected",
"function",
"emptyAttribute",
"(",
"$",
"object",
",",
"$",
"attribute",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"safe",
")",
"$",
"object",
"->",
"$",
"attribute",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"allowEmpty",
")",
... | Raises an error to inform end user about blank attribute.
Sets the owner attribute to null to prevent setting arbitrary values.
@param CModel $object the object being validated
@param string $attribute the attribute being validated | [
"Raises",
"an",
"error",
"to",
"inform",
"end",
"user",
"about",
"blank",
"attribute",
".",
"Sets",
"the",
"owner",
"attribute",
"to",
"null",
"to",
"prevent",
"setting",
"arbitrary",
"values",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/validators/CFileValidator.php#L269-L279 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff.php | Text_Diff.reverse | function reverse()
{
if (version_compare(zend_version(), '2', '>')) {
$rev = clone($this);
} else {
$rev = $this;
}
$rev->_edits = array();
foreach ($this->_edits as $edit) {
$rev->_edits[] = $edit->reverse();
}
return $rev;... | php | function reverse()
{
if (version_compare(zend_version(), '2', '>')) {
$rev = clone($this);
} else {
$rev = $this;
}
$rev->_edits = array();
foreach ($this->_edits as $edit) {
$rev->_edits[] = $edit->reverse();
}
return $rev;... | [
"function",
"reverse",
"(",
")",
"{",
"if",
"(",
"version_compare",
"(",
"zend_version",
"(",
")",
",",
"'2'",
",",
"'>'",
")",
")",
"{",
"$",
"rev",
"=",
"clone",
"(",
"$",
"this",
")",
";",
"}",
"else",
"{",
"$",
"rev",
"=",
"$",
"this",
";",... | Computes a reversed diff.
Example:
<code>
$diff = new Text_Diff($lines1, $lines2);
$rev = $diff->reverse();
</code>
@return Text_Diff A Diff object representing the inverse of the
original diff. Note that we purposely don't return a
reference here, since this essentially is a clone()
method. | [
"Computes",
"a",
"reversed",
"diff",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff.php#L121-L133 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff.php | Text_Diff.getOriginal | function getOriginal()
{
$lines = array();
foreach ($this->_edits as $edit) {
if ($edit->orig) {
array_splice($lines, count($lines), 0, $edit->orig);
}
}
return $lines;
} | php | function getOriginal()
{
$lines = array();
foreach ($this->_edits as $edit) {
if ($edit->orig) {
array_splice($lines, count($lines), 0, $edit->orig);
}
}
return $lines;
} | [
"function",
"getOriginal",
"(",
")",
"{",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_edits",
"as",
"$",
"edit",
")",
"{",
"if",
"(",
"$",
"edit",
"->",
"orig",
")",
"{",
"array_splice",
"(",
"$",
"lines",
",",... | Gets the original set of lines.
This reconstructs the $from_lines parameter passed to the constructor.
@return array The original sequence of strings. | [
"Gets",
"the",
"original",
"set",
"of",
"lines",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff.php#L175-L184 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff.php | Text_Diff.getFinal | function getFinal()
{
$lines = array();
foreach ($this->_edits as $edit) {
if ($edit->final) {
array_splice($lines, count($lines), 0, $edit->final);
}
}
return $lines;
} | php | function getFinal()
{
$lines = array();
foreach ($this->_edits as $edit) {
if ($edit->final) {
array_splice($lines, count($lines), 0, $edit->final);
}
}
return $lines;
} | [
"function",
"getFinal",
"(",
")",
"{",
"$",
"lines",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_edits",
"as",
"$",
"edit",
")",
"{",
"if",
"(",
"$",
"edit",
"->",
"final",
")",
"{",
"array_splice",
"(",
"$",
"lines",
",",
... | Gets the final set of lines.
This reconstructs the $to_lines parameter passed to the constructor.
@return array The sequence of strings. | [
"Gets",
"the",
"final",
"set",
"of",
"lines",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff.php#L193-L202 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff.php | Text_Diff._getTempDir | function _getTempDir()
{
$tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
'c:\windows\temp', 'c:\winnt\temp');
/* Try PHP's upload_tmp_dir directive. */
$tmp = ini_get('upload_tmp_dir');
/* Otherwise, try to determine the TMPDIR envi... | php | function _getTempDir()
{
$tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
'c:\windows\temp', 'c:\winnt\temp');
/* Try PHP's upload_tmp_dir directive. */
$tmp = ini_get('upload_tmp_dir');
/* Otherwise, try to determine the TMPDIR envi... | [
"function",
"_getTempDir",
"(",
")",
"{",
"$",
"tmp_locations",
"=",
"array",
"(",
"'/tmp'",
",",
"'/var/tmp'",
",",
"'c:\\WUTemp'",
",",
"'c:\\temp'",
",",
"'c:\\windows\\temp'",
",",
"'c:\\winnt\\temp'",
")",
";",
"/* Try PHP's upload_tmp_dir directive. */",
"$",
... | Determines the location of the system temporary directory.
@static
@access protected
@return string A directory name which can be used for temp files.
Returns false if one could not be found. | [
"Determines",
"the",
"location",
"of",
"the",
"system",
"temporary",
"directory",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff.php#L226-L251 | train |
yiisoft/yii | framework/gii/components/Pear/Text/Diff.php | Text_Diff._check | function _check($from_lines, $to_lines)
{
if (serialize($from_lines) != serialize($this->getOriginal())) {
trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
}
if (serialize($to_lines) != serialize($this->getFinal())) {
trigger_error("Reconstructed f... | php | function _check($from_lines, $to_lines)
{
if (serialize($from_lines) != serialize($this->getOriginal())) {
trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
}
if (serialize($to_lines) != serialize($this->getFinal())) {
trigger_error("Reconstructed f... | [
"function",
"_check",
"(",
"$",
"from_lines",
",",
"$",
"to_lines",
")",
"{",
"if",
"(",
"serialize",
"(",
"$",
"from_lines",
")",
"!=",
"serialize",
"(",
"$",
"this",
"->",
"getOriginal",
"(",
")",
")",
")",
"{",
"trigger_error",
"(",
"\"Reconstructed o... | Checks a diff for validity.
This is here only for debugging purposes. | [
"Checks",
"a",
"diff",
"for",
"validity",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/components/Pear/Text/Diff.php#L258-L284 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlColumnSchema.php | CMssqlColumnSchema.init | public function init($dbType, $defaultValue)
{
if ($defaultValue=='(NULL)')
{
$defaultValue=null;
}
parent::init($dbType, $defaultValue);
} | php | public function init($dbType, $defaultValue)
{
if ($defaultValue=='(NULL)')
{
$defaultValue=null;
}
parent::init($dbType, $defaultValue);
} | [
"public",
"function",
"init",
"(",
"$",
"dbType",
",",
"$",
"defaultValue",
")",
"{",
"if",
"(",
"$",
"defaultValue",
"==",
"'(NULL)'",
")",
"{",
"$",
"defaultValue",
"=",
"null",
";",
"}",
"parent",
"::",
"init",
"(",
"$",
"dbType",
",",
"$",
"defau... | Initializes the column with its DB type and default value.
This sets up the column's PHP type, size, precision, scale as well as default value.
@param string $dbType the column's DB type
@param mixed $defaultValue the default value | [
"Initializes",
"the",
"column",
"with",
"its",
"DB",
"type",
"and",
"default",
"value",
".",
"This",
"sets",
"up",
"the",
"column",
"s",
"PHP",
"type",
"size",
"precision",
"scale",
"as",
"well",
"as",
"default",
"value",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlColumnSchema.php#L28-L35 | train |
yiisoft/yii | framework/gii/GiiModule.php | GiiModule.init | public function init()
{
parent::init();
Yii::setPathOfAlias('gii',dirname(__FILE__));
Yii::app()->setComponents(array(
'errorHandler'=>array(
'class'=>'CErrorHandler',
'errorAction'=>$this->getId().'/default/error',
),
'user'=>array(
'class'=>'CWebUser',
'stateKeyPrefix'=>'gii',
'lo... | php | public function init()
{
parent::init();
Yii::setPathOfAlias('gii',dirname(__FILE__));
Yii::app()->setComponents(array(
'errorHandler'=>array(
'class'=>'CErrorHandler',
'errorAction'=>$this->getId().'/default/error',
),
'user'=>array(
'class'=>'CWebUser',
'stateKeyPrefix'=>'gii',
'lo... | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"Yii",
"::",
"setPathOfAlias",
"(",
"'gii'",
",",
"dirname",
"(",
"__FILE__",
")",
")",
";",
"Yii",
"::",
"app",
"(",
")",
"->",
"setComponents",
"(",
"array",
"(",
... | Initializes the gii module. | [
"Initializes",
"the",
"gii",
"module",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/GiiModule.php#L114-L135 | train |
yiisoft/yii | framework/gii/GiiModule.php | GiiModule.findGenerators | protected function findGenerators()
{
$generators=array();
$n=count($this->generatorPaths);
for($i=$n-1;$i>=0;--$i)
{
$alias=$this->generatorPaths[$i];
$path=Yii::getPathOfAlias($alias);
if($path===false || !is_dir($path))
continue;
$names=scandir($path);
foreach($names as $name)
{
i... | php | protected function findGenerators()
{
$generators=array();
$n=count($this->generatorPaths);
for($i=$n-1;$i>=0;--$i)
{
$alias=$this->generatorPaths[$i];
$path=Yii::getPathOfAlias($alias);
if($path===false || !is_dir($path))
continue;
$names=scandir($path);
foreach($names as $name)
{
i... | [
"protected",
"function",
"findGenerators",
"(",
")",
"{",
"$",
"generators",
"=",
"array",
"(",
")",
";",
"$",
"n",
"=",
"count",
"(",
"$",
"this",
"->",
"generatorPaths",
")",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"n",
"-",
"1",
";",
"$",
"i",
... | Finds all available code generators and their code templates.
@return array | [
"Finds",
"all",
"available",
"code",
"generators",
"and",
"their",
"code",
"templates",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/GiiModule.php#L205-L243 | train |
yiisoft/yii | framework/gii/generators/model/ModelGenerator.php | ModelGenerator.actionGetTableNames | public function actionGetTableNames($db)
{
if(Yii::app()->getRequest()->getIsAjaxRequest())
{
$all = array();
if(!empty($db) && Yii::app()->hasComponent($db)!==false && (Yii::app()->getComponent($db) instanceof CDbConnection))
$all=array_keys(Yii::app()->{$db}->schema->getTables());
echo json_encode(... | php | public function actionGetTableNames($db)
{
if(Yii::app()->getRequest()->getIsAjaxRequest())
{
$all = array();
if(!empty($db) && Yii::app()->hasComponent($db)!==false && (Yii::app()->getComponent($db) instanceof CDbConnection))
$all=array_keys(Yii::app()->{$db}->schema->getTables());
echo json_encode(... | [
"public",
"function",
"actionGetTableNames",
"(",
"$",
"db",
")",
"{",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"getRequest",
"(",
")",
"->",
"getIsAjaxRequest",
"(",
")",
")",
"{",
"$",
"all",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"... | Provides autocomplete table names
@param string $db the database connection component id
@return string the json array of tablenames that contains the entered term $q | [
"Provides",
"autocomplete",
"table",
"names"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/generators/model/ModelGenerator.php#L12-L24 | train |
yiisoft/yii | framework/logging/CLogRoute.php | CLogRoute.collectLogs | public function collectLogs($logger, $processLogs=false)
{
$logs=$logger->getLogs($this->levels,$this->categories,$this->except);
$this->logs=empty($this->logs) ? $logs : array_merge($this->logs,$logs);
if($processLogs && !empty($this->logs))
{
if($this->filter!==null)
Yii::createComponent($this->filter... | php | public function collectLogs($logger, $processLogs=false)
{
$logs=$logger->getLogs($this->levels,$this->categories,$this->except);
$this->logs=empty($this->logs) ? $logs : array_merge($this->logs,$logs);
if($processLogs && !empty($this->logs))
{
if($this->filter!==null)
Yii::createComponent($this->filter... | [
"public",
"function",
"collectLogs",
"(",
"$",
"logger",
",",
"$",
"processLogs",
"=",
"false",
")",
"{",
"$",
"logs",
"=",
"$",
"logger",
"->",
"getLogs",
"(",
"$",
"this",
"->",
"levels",
",",
"$",
"this",
"->",
"categories",
",",
"$",
"this",
"->"... | Retrieves filtered log messages from logger for further processing.
@param CLogger $logger logger instance
@param boolean $processLogs whether to process the logs after they are collected from the logger | [
"Retrieves",
"filtered",
"log",
"messages",
"from",
"logger",
"for",
"further",
"processing",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CLogRoute.php#L95-L107 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlSchema.php | CMssqlSchema.compareTableNames | public function compareTableNames($name1,$name2)
{
$name1=str_replace(array('[',']'),'',$name1);
$name2=str_replace(array('[',']'),'',$name2);
return parent::compareTableNames(strtolower($name1),strtolower($name2));
} | php | public function compareTableNames($name1,$name2)
{
$name1=str_replace(array('[',']'),'',$name1);
$name2=str_replace(array('[',']'),'',$name2);
return parent::compareTableNames(strtolower($name1),strtolower($name2));
} | [
"public",
"function",
"compareTableNames",
"(",
"$",
"name1",
",",
"$",
"name2",
")",
"{",
"$",
"name1",
"=",
"str_replace",
"(",
"array",
"(",
"'['",
",",
"']'",
")",
",",
"''",
",",
"$",
"name1",
")",
";",
"$",
"name2",
"=",
"str_replace",
"(",
"... | Compares two table names.
The table names can be either quoted or unquoted. This method
will consider both cases.
@param string $name1 table name 1
@param string $name2 table name 2
@return boolean whether the two table names refer to the same table. | [
"Compares",
"two",
"table",
"names",
".",
"The",
"table",
"names",
"can",
"be",
"either",
"quoted",
"or",
"unquoted",
".",
"This",
"method",
"will",
"consider",
"both",
"cases",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlSchema.php#L76-L81 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlSchema.php | CMssqlSchema.findForeignKeys | protected function findForeignKeys($table)
{
$rc='INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS';
$kcu='INFORMATION_SCHEMA.KEY_COLUMN_USAGE';
if (isset($table->catalogName))
{
$kcu=$table->catalogName.'.'.$kcu;
$rc=$table->catalogName.'.'.$rc;
}
//From http://msdn2.microsoft.com/en-us/library/aa175805(... | php | protected function findForeignKeys($table)
{
$rc='INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS';
$kcu='INFORMATION_SCHEMA.KEY_COLUMN_USAGE';
if (isset($table->catalogName))
{
$kcu=$table->catalogName.'.'.$kcu;
$rc=$table->catalogName.'.'.$rc;
}
//From http://msdn2.microsoft.com/en-us/library/aa175805(... | [
"protected",
"function",
"findForeignKeys",
"(",
"$",
"table",
")",
"{",
"$",
"rc",
"=",
"'INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS'",
";",
"$",
"kcu",
"=",
"'INFORMATION_SCHEMA.KEY_COLUMN_USAGE'",
";",
"if",
"(",
"isset",
"(",
"$",
"table",
"->",
"catalogName",
... | Gets foreign relationship constraint keys and table name
@param CMssqlTableSchema $table table
@return array foreign relationship table name and keys. | [
"Gets",
"foreign",
"relationship",
"constraint",
"keys",
"and",
"table",
"name"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlSchema.php#L228-L273 | train |
yiisoft/yii | framework/web/services/CWsdlGenerator.php | CWsdlGenerator.generateWsdl | public function generateWsdl($className, $serviceUrl, $encoding='UTF-8')
{
$this->operations=array();
$this->types=array();
$this->elements=array();
$this->messages=array();
if($this->serviceName===null)
$this->serviceName=$className;
if($this->namespace===null)
$this->namespace='urn:'.str_replace('\... | php | public function generateWsdl($className, $serviceUrl, $encoding='UTF-8')
{
$this->operations=array();
$this->types=array();
$this->elements=array();
$this->messages=array();
if($this->serviceName===null)
$this->serviceName=$className;
if($this->namespace===null)
$this->namespace='urn:'.str_replace('\... | [
"public",
"function",
"generateWsdl",
"(",
"$",
"className",
",",
"$",
"serviceUrl",
",",
"$",
"encoding",
"=",
"'UTF-8'",
")",
"{",
"$",
"this",
"->",
"operations",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"types",
"=",
"array",
"(",
")",
";"... | Generates the WSDL for the given class.
@param string $className class name
@param string $serviceUrl Web service URL
@param string $encoding encoding of the WSDL. Defaults to 'UTF-8'.
@return string the generated WSDL | [
"Generates",
"the",
"WSDL",
"for",
"the",
"given",
"class",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/services/CWsdlGenerator.php#L236-L260 | train |
yiisoft/yii | framework/cli/commands/ShellCommand.php | ShellCommand.addCommands | protected function addCommands(CConsoleCommandRunner $runner)
{
$runner->addCommands(Yii::getPathOfAlias('system.cli.commands.shell'));
$runner->addCommands(Yii::getPathOfAlias('application.commands.shell'));
if(($_path_=@getenv('YIIC_SHELL_COMMAND_PATH'))!==false)
$runner->addCommands($_path_);
} | php | protected function addCommands(CConsoleCommandRunner $runner)
{
$runner->addCommands(Yii::getPathOfAlias('system.cli.commands.shell'));
$runner->addCommands(Yii::getPathOfAlias('application.commands.shell'));
if(($_path_=@getenv('YIIC_SHELL_COMMAND_PATH'))!==false)
$runner->addCommands($_path_);
} | [
"protected",
"function",
"addCommands",
"(",
"CConsoleCommandRunner",
"$",
"runner",
")",
"{",
"$",
"runner",
"->",
"addCommands",
"(",
"Yii",
"::",
"getPathOfAlias",
"(",
"'system.cli.commands.shell'",
")",
")",
";",
"$",
"runner",
"->",
"addCommands",
"(",
"Yi... | Adds commands to runner
@param CConsoleCommandRunner $runner
@since 1.1.16 | [
"Adds",
"commands",
"to",
"runner"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/cli/commands/ShellCommand.php#L166-L172 | train |
yiisoft/yii | framework/console/CConsoleApplication.php | CConsoleApplication.init | protected function init()
{
parent::init();
if(empty($_SERVER['argv']))
die('This script must be run from the command line.');
$this->_runner=$this->createCommandRunner();
$this->_runner->commands=$this->commandMap;
$this->_runner->addCommands($this->getCommandPath());
} | php | protected function init()
{
parent::init();
if(empty($_SERVER['argv']))
die('This script must be run from the command line.');
$this->_runner=$this->createCommandRunner();
$this->_runner->commands=$this->commandMap;
$this->_runner->addCommands($this->getCommandPath());
} | [
"protected",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"_SERVER",
"[",
"'argv'",
"]",
")",
")",
"die",
"(",
"'This script must be run from the command line.'",
")",
";",
"$",
"this",
"->",
"_r... | Initializes the application by creating the command runner. | [
"Initializes",
"the",
"application",
"by",
"creating",
"the",
"command",
"runner",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleApplication.php#L75-L83 | train |
yiisoft/yii | framework/console/CConsoleApplication.php | CConsoleApplication.processRequest | public function processRequest()
{
$exitCode=$this->_runner->run($_SERVER['argv']);
if(is_int($exitCode))
$this->end($exitCode);
} | php | public function processRequest()
{
$exitCode=$this->_runner->run($_SERVER['argv']);
if(is_int($exitCode))
$this->end($exitCode);
} | [
"public",
"function",
"processRequest",
"(",
")",
"{",
"$",
"exitCode",
"=",
"$",
"this",
"->",
"_runner",
"->",
"run",
"(",
"$",
"_SERVER",
"[",
"'argv'",
"]",
")",
";",
"if",
"(",
"is_int",
"(",
"$",
"exitCode",
")",
")",
"$",
"this",
"->",
"end"... | Processes the user request.
This method uses a console command runner to handle the particular user command.
Since version 1.1.11 this method will exit application with an exit code if one is returned by the user command. | [
"Processes",
"the",
"user",
"request",
".",
"This",
"method",
"uses",
"a",
"console",
"command",
"runner",
"to",
"handle",
"the",
"particular",
"user",
"command",
".",
"Since",
"version",
"1",
".",
"1",
".",
"11",
"this",
"method",
"will",
"exit",
"applica... | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleApplication.php#L90-L95 | train |
yiisoft/yii | framework/web/CTheme.php | CTheme.getViewFile | public function getViewFile($controller,$viewName)
{
$moduleViewPath=$this->getViewPath();
if(($module=$controller->getModule())!==null)
$moduleViewPath.='/'.$module->getId();
return $controller->resolveViewFile($viewName,$this->getViewPath().'/'.$controller->getUniqueId(),$this->getViewPath(),$moduleViewPath... | php | public function getViewFile($controller,$viewName)
{
$moduleViewPath=$this->getViewPath();
if(($module=$controller->getModule())!==null)
$moduleViewPath.='/'.$module->getId();
return $controller->resolveViewFile($viewName,$this->getViewPath().'/'.$controller->getUniqueId(),$this->getViewPath(),$moduleViewPath... | [
"public",
"function",
"getViewFile",
"(",
"$",
"controller",
",",
"$",
"viewName",
")",
"{",
"$",
"moduleViewPath",
"=",
"$",
"this",
"->",
"getViewPath",
"(",
")",
";",
"if",
"(",
"(",
"$",
"module",
"=",
"$",
"controller",
"->",
"getModule",
"(",
")"... | Finds the view file for the specified controller's view.
@param CController $controller the controller
@param string $viewName the view name
@return string the view file path. False if the file does not exist. | [
"Finds",
"the",
"view",
"file",
"for",
"the",
"specified",
"controller",
"s",
"view",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CTheme.php#L99-L105 | train |
yiisoft/yii | framework/web/CTheme.php | CTheme.getLayoutFile | public function getLayoutFile($controller,$layoutName)
{
$moduleViewPath=$basePath=$this->getViewPath();
$module=$controller->getModule();
if(empty($layoutName))
{
while($module!==null)
{
if($module->layout===false)
return false;
if(!empty($module->layout))
break;
$module=$module->g... | php | public function getLayoutFile($controller,$layoutName)
{
$moduleViewPath=$basePath=$this->getViewPath();
$module=$controller->getModule();
if(empty($layoutName))
{
while($module!==null)
{
if($module->layout===false)
return false;
if(!empty($module->layout))
break;
$module=$module->g... | [
"public",
"function",
"getLayoutFile",
"(",
"$",
"controller",
",",
"$",
"layoutName",
")",
"{",
"$",
"moduleViewPath",
"=",
"$",
"basePath",
"=",
"$",
"this",
"->",
"getViewPath",
"(",
")",
";",
"$",
"module",
"=",
"$",
"controller",
"->",
"getModule",
... | Finds the layout file for the specified controller's layout.
@param CController $controller the controller
@param string $layoutName the layout name
@return string the layout file path. False if the file does not exist. | [
"Finds",
"the",
"layout",
"file",
"for",
"the",
"specified",
"controller",
"s",
"layout",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CTheme.php#L113-L139 | train |
yiisoft/yii | framework/gii/models/LoginForm.php | LoginForm.login | public function login()
{
if($this->_identity===null)
{
$this->_identity=new UserIdentity('yiier',$this->password);
$this->_identity->authenticate();
}
if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
{
Yii::app()->user->login($this->_identity);
return true;
}
else
return false;
... | php | public function login()
{
if($this->_identity===null)
{
$this->_identity=new UserIdentity('yiier',$this->password);
$this->_identity->authenticate();
}
if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
{
Yii::app()->user->login($this->_identity);
return true;
}
else
return false;
... | [
"public",
"function",
"login",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_identity",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_identity",
"=",
"new",
"UserIdentity",
"(",
"'yiier'",
",",
"$",
"this",
"->",
"password",
")",
";",
"$",
"this",
... | Logs in the user using the given password in the model.
@return boolean whether login is successful | [
"Logs",
"in",
"the",
"user",
"using",
"the",
"given",
"password",
"in",
"the",
"model",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/models/LoginForm.php#L36-L50 | train |
yiisoft/yii | framework/gii/CCodeGenerator.php | CCodeGenerator.actionIndex | public function actionIndex()
{
$model=$this->prepare();
if($model->files!=array() && isset($_POST['generate'], $_POST['answers']))
{
$model->answers=$_POST['answers'];
$model->status=$model->save() ? CCodeModel::STATUS_SUCCESS : CCodeModel::STATUS_ERROR;
}
$this->render('index',array(
'model'=>$mo... | php | public function actionIndex()
{
$model=$this->prepare();
if($model->files!=array() && isset($_POST['generate'], $_POST['answers']))
{
$model->answers=$_POST['answers'];
$model->status=$model->save() ? CCodeModel::STATUS_SUCCESS : CCodeModel::STATUS_ERROR;
}
$this->render('index',array(
'model'=>$mo... | [
"public",
"function",
"actionIndex",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"prepare",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"files",
"!=",
"array",
"(",
")",
"&&",
"isset",
"(",
"$",
"_POST",
"[",
"'generate'",
"]",
",",
"$... | The code generation action.
This is the action that displays the code generation interface.
Child classes mainly need to provide the 'index' view for collecting user parameters
for code generation. | [
"The",
"code",
"generation",
"action",
".",
"This",
"is",
"the",
"action",
"that",
"displays",
"the",
"code",
"generation",
"interface",
".",
"Child",
"classes",
"mainly",
"need",
"to",
"provide",
"the",
"index",
"view",
"for",
"collecting",
"user",
"parameter... | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeGenerator.php#L61-L73 | train |
yiisoft/yii | framework/gii/CCodeGenerator.php | CCodeGenerator.actionCode | public function actionCode()
{
$model=$this->prepare();
if(isset($_GET['id']) && isset($model->files[$_GET['id']]))
{
$this->renderPartial('/common/code', array(
'file'=>$model->files[$_GET['id']],
));
}
else
throw new CHttpException(404,'Unable to find the code you requested.');
} | php | public function actionCode()
{
$model=$this->prepare();
if(isset($_GET['id']) && isset($model->files[$_GET['id']]))
{
$this->renderPartial('/common/code', array(
'file'=>$model->files[$_GET['id']],
));
}
else
throw new CHttpException(404,'Unable to find the code you requested.');
} | [
"public",
"function",
"actionCode",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"prepare",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"'id'",
"]",
")",
"&&",
"isset",
"(",
"$",
"model",
"->",
"files",
"[",
"$",
"_GET",
"... | The code preview action.
This action shows up the specified generated code.
@throws CHttpException if unable to find code generated. | [
"The",
"code",
"preview",
"action",
".",
"This",
"action",
"shows",
"up",
"the",
"specified",
"generated",
"code",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/gii/CCodeGenerator.php#L80-L91 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.