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/db/CDbMigration.php | CDbMigration.alterColumn | public function alterColumn($table, $column, $type)
{
echo " > alter column $column in table $table to $type ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->alterColumn($table, $column, $type);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function alterColumn($table, $column, $type)
{
echo " > alter column $column in table $table to $type ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->alterColumn($table, $column, $type);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"alterColumn",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"type",
")",
"{",
"echo",
"\" > alter column $column in table $table to $type ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getDbC... | Builds and executes a SQL statement for changing the definition of a column.
@param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
@param string $column the name of the column to be changed. The name will be properly quoted by the method.
@param string $type... | [
"Builds",
"and",
"executes",
"a",
"SQL",
"statement",
"for",
"changing",
"the",
"definition",
"of",
"a",
"column",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L342-L348 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.addForeignKey | public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete=null, $update=null)
{
echo " > add foreign key $name: $table (".(is_array($columns) ? implode(',', $columns) : $columns).
") references $refTable (".(is_array($refColumns) ? implode(',', $refColumns) : $refColumns).") ...";... | php | public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete=null, $update=null)
{
echo " > add foreign key $name: $table (".(is_array($columns) ? implode(',', $columns) : $columns).
") references $refTable (".(is_array($refColumns) ? implode(',', $refColumns) : $refColumns).") ...";... | [
"public",
"function",
"addForeignKey",
"(",
"$",
"name",
",",
"$",
"table",
",",
"$",
"columns",
",",
"$",
"refTable",
",",
"$",
"refColumns",
",",
"$",
"delete",
"=",
"null",
",",
"$",
"update",
"=",
"null",
")",
"{",
"echo",
"\" > add foreign key $n... | Builds a SQL statement for adding a foreign key constraint to an existing table.
The method will properly quote the table and column names.
@param string $name the name of the foreign key constraint.
@param string $table the table that the foreign key constraint will be added to.
@param string|array $columns the name o... | [
"Builds",
"a",
"SQL",
"statement",
"for",
"adding",
"a",
"foreign",
"key",
"constraint",
"to",
"an",
"existing",
"table",
".",
"The",
"method",
"will",
"properly",
"quote",
"the",
"table",
"and",
"column",
"names",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L361-L368 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.dropForeignKey | public function dropForeignKey($name, $table)
{
echo " > drop foreign key $name from table $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropForeignKey($name, $table);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function dropForeignKey($name, $table)
{
echo " > drop foreign key $name from table $table ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->dropForeignKey($name, $table);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"dropForeignKey",
"(",
"$",
"name",
",",
"$",
"table",
")",
"{",
"echo",
"\" > drop foreign key $name from table $table ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
... | Builds a SQL statement for dropping a foreign key constraint.
@param string $name the name of the foreign key constraint to be dropped. The name will be properly quoted by the method.
@param string $table the table whose foreign is to be dropped. The name will be properly quoted by the method. | [
"Builds",
"a",
"SQL",
"statement",
"for",
"dropping",
"a",
"foreign",
"key",
"constraint",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L375-L381 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.createIndex | public function createIndex($name, $table, $columns, $unique=false)
{
echo " > create".($unique ? ' unique':'')." index $name on $table (".(is_array($columns) ? implode(',', $columns) : $columns).") ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->createIndex($name, $table, $columns, $u... | php | public function createIndex($name, $table, $columns, $unique=false)
{
echo " > create".($unique ? ' unique':'')." index $name on $table (".(is_array($columns) ? implode(',', $columns) : $columns).") ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->createIndex($name, $table, $columns, $u... | [
"public",
"function",
"createIndex",
"(",
"$",
"name",
",",
"$",
"table",
",",
"$",
"columns",
",",
"$",
"unique",
"=",
"false",
")",
"{",
"echo",
"\" > create\"",
".",
"(",
"$",
"unique",
"?",
"' unique'",
":",
"''",
")",
".",
"\" index $name on $tab... | Builds and executes a SQL statement for creating a new index.
@param string $name the name of the index. The name will be properly quoted by the method.
@param string $table the table that the new index will be created for. The table name will be properly quoted by the method.
@param string|array $columns the column(s)... | [
"Builds",
"and",
"executes",
"a",
"SQL",
"statement",
"for",
"creating",
"a",
"new",
"index",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L391-L397 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.refreshTableSchema | public function refreshTableSchema($table)
{
echo " > refresh table $table schema cache ...";
$time=microtime(true);
$this->getDbConnection()->getSchema()->getTable($table,true);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | php | public function refreshTableSchema($table)
{
echo " > refresh table $table schema cache ...";
$time=microtime(true);
$this->getDbConnection()->getSchema()->getTable($table,true);
echo " done (time: ".sprintf('%.3f', microtime(true)-$time)."s)\n";
} | [
"public",
"function",
"refreshTableSchema",
"(",
"$",
"table",
")",
"{",
"echo",
"\" > refresh table $table schema cache ...\"",
";",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"this",
"->",
"getDbConnection",
"(",
")",
"->",
"getSchema",
"(",... | Refreshed schema cache for a table
@param string $table name of the table to refresh
@since 1.1.9 | [
"Refreshed",
"schema",
"cache",
"for",
"a",
"table"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L417-L423 | train |
yiisoft/yii | framework/db/CDbMigration.php | CDbMigration.addPrimaryKey | public function addPrimaryKey($name,$table,$columns)
{
echo " > alter table $table add constraint $name primary key (".(is_array($columns) ? implode(',', $columns) : $columns).") ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->addPrimaryKey($name,$table,$columns);
echo " done (time: ... | php | public function addPrimaryKey($name,$table,$columns)
{
echo " > alter table $table add constraint $name primary key (".(is_array($columns) ? implode(',', $columns) : $columns).") ...";
$time=microtime(true);
$this->getDbConnection()->createCommand()->addPrimaryKey($name,$table,$columns);
echo " done (time: ... | [
"public",
"function",
"addPrimaryKey",
"(",
"$",
"name",
",",
"$",
"table",
",",
"$",
"columns",
")",
"{",
"echo",
"\" > alter table $table add constraint $name primary key (\"",
".",
"(",
"is_array",
"(",
"$",
"columns",
")",
"?",
"implode",
"(",
"','",
",",... | Builds and executes a SQL statement for creating a primary key, supports composite primary keys.
@param string $name name of the primary key constraint to add
@param string $table name of the table to add primary key to
@param string|array $columns comma separated string or array of columns that the primary key will co... | [
"Builds",
"and",
"executes",
"a",
"SQL",
"statement",
"for",
"creating",
"a",
"primary",
"key",
"supports",
"composite",
"primary",
"keys",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/CDbMigration.php#L433-L439 | train |
yiisoft/yii | framework/yiilite.php | CWidgetFactory.init | public function init()
{
parent::init();
if($this->enableSkin && $this->skinPath===null)
$this->skinPath=Yii::app()->getViewPath().DIRECTORY_SEPARATOR.'skins';
} | php | public function init()
{
parent::init();
if($this->enableSkin && $this->skinPath===null)
$this->skinPath=Yii::app()->getViewPath().DIRECTORY_SEPARATOR.'skins';
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"enableSkin",
"&&",
"$",
"this",
"->",
"skinPath",
"===",
"null",
")",
"$",
"this",
"->",
"skinPath",
"=",
"Yii",
"::",
"app",
"(",
... | class name, skin name, property name => value | [
"class",
"name",
"skin",
"name",
"property",
"name",
"=",
">",
"value"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/yiilite.php#L6194-L6199 | train |
yiisoft/yii | framework/zii/widgets/grid/CButtonColumn.php | CButtonColumn.getDataCellContent | public function getDataCellContent($row)
{
$data=$this->grid->dataProvider->data[$row];
$tr=array();
ob_start();
foreach($this->buttons as $id=>$button)
{
$this->renderButton($id,$button,$row,$data);
$tr['{'.$id.'}']=ob_get_contents();
ob_clean();
}
ob_end_clean();
return strtr($this->template... | php | public function getDataCellContent($row)
{
$data=$this->grid->dataProvider->data[$row];
$tr=array();
ob_start();
foreach($this->buttons as $id=>$button)
{
$this->renderButton($id,$button,$row,$data);
$tr['{'.$id.'}']=ob_get_contents();
ob_clean();
}
ob_end_clean();
return strtr($this->template... | [
"public",
"function",
"getDataCellContent",
"(",
"$",
"row",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"grid",
"->",
"dataProvider",
"->",
"data",
"[",
"$",
"row",
"]",
";",
"$",
"tr",
"=",
"array",
"(",
")",
";",
"ob_start",
"(",
")",
";",
... | Returns the data cell content.
This method renders the view, update and delete buttons 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",
"the",
"view",
"update",
"and",
"delete",
"buttons",
"in",
"the",
"data",
"cell",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/grid/CButtonColumn.php#L314-L327 | train |
yiisoft/yii | demos/blog/protected/models/Post.php | Post.addComment | public function addComment($comment)
{
if(Yii::app()->params['commentNeedApproval'])
$comment->status=Comment::STATUS_PENDING;
else
$comment->status=Comment::STATUS_APPROVED;
$comment->post_id=$this->id;
return $comment->save();
} | php | public function addComment($comment)
{
if(Yii::app()->params['commentNeedApproval'])
$comment->status=Comment::STATUS_PENDING;
else
$comment->status=Comment::STATUS_APPROVED;
$comment->post_id=$this->id;
return $comment->save();
} | [
"public",
"function",
"addComment",
"(",
"$",
"comment",
")",
"{",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"params",
"[",
"'commentNeedApproval'",
"]",
")",
"$",
"comment",
"->",
"status",
"=",
"Comment",
"::",
"STATUS_PENDING",
";",
"else",
"$",
... | Adds a new comment to this post.
This method will set status and post_id of the comment accordingly.
@param Comment the comment to be added
@return boolean whether the comment is saved successfully | [
"Adds",
"a",
"new",
"comment",
"to",
"this",
"post",
".",
"This",
"method",
"will",
"set",
"status",
"and",
"post_id",
"of",
"the",
"comment",
"accordingly",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/models/Post.php#L123-L131 | train |
yiisoft/yii | build/commands/lite/protected/controllers/PostController.php | PostController.actionList | public function actionList()
{
$pages=new CPagination(Post::model()->count());
$postList=Post::model()->findAll($this->getListCriteria($pages));
$this->render('list',array(
'postList'=>$postList,
'pages'=>$pages));
} | php | public function actionList()
{
$pages=new CPagination(Post::model()->count());
$postList=Post::model()->findAll($this->getListCriteria($pages));
$this->render('list',array(
'postList'=>$postList,
'pages'=>$pages));
} | [
"public",
"function",
"actionList",
"(",
")",
"{",
"$",
"pages",
"=",
"new",
"CPagination",
"(",
"Post",
"::",
"model",
"(",
")",
"->",
"count",
"(",
")",
")",
";",
"$",
"postList",
"=",
"Post",
"::",
"model",
"(",
")",
"->",
"findAll",
"(",
"$",
... | Lists all posts. | [
"Lists",
"all",
"posts",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/controllers/PostController.php#L41-L49 | train |
yiisoft/yii | build/commands/lite/protected/controllers/PostController.php | PostController.actionCreate | public function actionCreate()
{
$post=new Post;
if(Yii::app()->request->isPostRequest)
{
if(isset($_POST['Post']))
$post->setAttributes($_POST['Post']);
if($post->save())
$this->redirect(array('show','id'=>$post->id));
}
$this->render('create',array('post'=>$post));
} | php | public function actionCreate()
{
$post=new Post;
if(Yii::app()->request->isPostRequest)
{
if(isset($_POST['Post']))
$post->setAttributes($_POST['Post']);
if($post->save())
$this->redirect(array('show','id'=>$post->id));
}
$this->render('create',array('post'=>$post));
} | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"post",
"=",
"new",
"Post",
";",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"isPostRequest",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"'Post'",
"]",
")",
... | Creates a new post.
If creation is successful, the browser will be redirected to the 'show' page. | [
"Creates",
"a",
"new",
"post",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"show",
"page",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/controllers/PostController.php#L63-L74 | train |
yiisoft/yii | build/commands/lite/protected/controllers/PostController.php | PostController.actionUpdate | public function actionUpdate()
{
$post=$this->loadPost();
if(Yii::app()->request->isPostRequest)
{
if(isset($_POST['Post']))
$post->setAttributes($_POST['Post']);
if($post->save())
$this->redirect(array('show','id'=>$post->id));
}
$this->render('update',array('post'=>$post));
} | php | public function actionUpdate()
{
$post=$this->loadPost();
if(Yii::app()->request->isPostRequest)
{
if(isset($_POST['Post']))
$post->setAttributes($_POST['Post']);
if($post->save())
$this->redirect(array('show','id'=>$post->id));
}
$this->render('update',array('post'=>$post));
} | [
"public",
"function",
"actionUpdate",
"(",
")",
"{",
"$",
"post",
"=",
"$",
"this",
"->",
"loadPost",
"(",
")",
";",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"isPostRequest",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_POST",
... | Updates a particular post.
If update is successful, the browser will be redirected to the 'show' page. | [
"Updates",
"a",
"particular",
"post",
".",
"If",
"update",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"show",
"page",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/controllers/PostController.php#L80-L91 | train |
yiisoft/yii | build/commands/lite/protected/controllers/PostController.php | PostController.actionDelete | public function actionDelete()
{
if(Yii::app()->request->isPostRequest)
{
// we only allow deletion via POST request
$this->loadPost()->delete();
$this->redirect(array('list'));
}
else
throw new CHttpException(500,'Invalid request. Please do not repeat this request again.');
} | php | public function actionDelete()
{
if(Yii::app()->request->isPostRequest)
{
// we only allow deletion via POST request
$this->loadPost()->delete();
$this->redirect(array('list'));
}
else
throw new CHttpException(500,'Invalid request. Please do not repeat this request again.');
} | [
"public",
"function",
"actionDelete",
"(",
")",
"{",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"isPostRequest",
")",
"{",
"// we only allow deletion via POST request",
"$",
"this",
"->",
"loadPost",
"(",
")",
"->",
"delete",
"(",
")",
... | Deletes a particular post.
If deletion is successful, the browser will be redirected to the 'list' page. | [
"Deletes",
"a",
"particular",
"post",
".",
"If",
"deletion",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"list",
"page",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/controllers/PostController.php#L97-L107 | train |
yiisoft/yii | build/commands/lite/protected/controllers/PostController.php | PostController.loadPost | protected function loadPost()
{
if(isset($_GET['id']))
$post=Post::model()->findbyPk($_GET['id']);
if(isset($post))
return $post;
else
throw new CHttpException(500,'The requested post does not exist.');
} | php | protected function loadPost()
{
if(isset($_GET['id']))
$post=Post::model()->findbyPk($_GET['id']);
if(isset($post))
return $post;
else
throw new CHttpException(500,'The requested post does not exist.');
} | [
"protected",
"function",
"loadPost",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"'id'",
"]",
")",
")",
"$",
"post",
"=",
"Post",
"::",
"model",
"(",
")",
"->",
"findbyPk",
"(",
"$",
"_GET",
"[",
"'id'",
"]",
")",
";",
"if",
"(",
... | Loads the data model based on the primary key given in the GET variable.
If the data model is not found, an HTTP exception will be raised. | [
"Loads",
"the",
"data",
"model",
"based",
"on",
"the",
"primary",
"key",
"given",
"in",
"the",
"GET",
"variable",
".",
"If",
"the",
"data",
"model",
"is",
"not",
"found",
"an",
"HTTP",
"exception",
"will",
"be",
"raised",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/controllers/PostController.php#L113-L121 | train |
yiisoft/yii | build/commands/lite/protected/controllers/PostController.php | PostController.generateColumnHeader | protected function generateColumnHeader($column)
{
$params=$_GET;
if(isset($params['sort']) && $params['sort']===$column)
{
if(isset($params['desc']))
unset($params['desc']);
else
$params['desc']=1;
}
else
{
$params['sort']=$column;
unset($params['desc']);
}
$url=$this->createUrl('l... | php | protected function generateColumnHeader($column)
{
$params=$_GET;
if(isset($params['sort']) && $params['sort']===$column)
{
if(isset($params['desc']))
unset($params['desc']);
else
$params['desc']=1;
}
else
{
$params['sort']=$column;
unset($params['desc']);
}
$url=$this->createUrl('l... | [
"protected",
"function",
"generateColumnHeader",
"(",
"$",
"column",
")",
"{",
"$",
"params",
"=",
"$",
"_GET",
";",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'sort'",
"]",
")",
"&&",
"$",
"params",
"[",
"'sort'",
"]",
"===",
"$",
"column",
")",
... | Generates the header cell for the specified column.
This method will generate a hyperlink for the column.
Clicking on the link will cause the data to be sorted according to the column.
@param string the column name
@return string the generated header cell content | [
"Generates",
"the",
"header",
"cell",
"for",
"the",
"specified",
"column",
".",
"This",
"method",
"will",
"generate",
"a",
"hyperlink",
"for",
"the",
"column",
".",
"Clicking",
"on",
"the",
"link",
"will",
"cause",
"the",
"data",
"to",
"be",
"sorted",
"acc... | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/commands/lite/protected/controllers/PostController.php#L150-L167 | train |
yiisoft/yii | framework/web/widgets/CStarRating.php | CStarRating.registerClientScript | public function registerClientScript($id)
{
$jsOptions=$this->getClientOptions();
$jsOptions=empty($jsOptions) ? '' : CJavaScript::encode($jsOptions);
$js="jQuery('#{$id} > input').rating({$jsOptions});";
$cs=Yii::app()->getClientScript();
$cs->registerCoreScript('rating');
$cs->registerScript('Yii.CStarRa... | php | public function registerClientScript($id)
{
$jsOptions=$this->getClientOptions();
$jsOptions=empty($jsOptions) ? '' : CJavaScript::encode($jsOptions);
$js="jQuery('#{$id} > input').rating({$jsOptions});";
$cs=Yii::app()->getClientScript();
$cs->registerCoreScript('rating');
$cs->registerScript('Yii.CStarRa... | [
"public",
"function",
"registerClientScript",
"(",
"$",
"id",
")",
"{",
"$",
"jsOptions",
"=",
"$",
"this",
"->",
"getClientOptions",
"(",
")",
";",
"$",
"jsOptions",
"=",
"empty",
"(",
"$",
"jsOptions",
")",
"?",
"''",
":",
"CJavaScript",
"::",
"encode"... | Registers the necessary javascript and css scripts.
@param string $id the ID of the container | [
"Registers",
"the",
"necessary",
"javascript",
"and",
"css",
"scripts",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CStarRating.php#L122-L133 | train |
yiisoft/yii | framework/web/widgets/CStarRating.php | CStarRating.renderStars | protected function renderStars($id,$name)
{
$inputCount=(int)(($this->maxRating-$this->minRating)/$this->ratingStepSize+1);
$starSplit=(int)($inputCount/$this->starCount);
if($this->hasModel())
{
$attr=$this->attribute;
CHtml::resolveName($this->model,$attr);
$selection=$this->model->$attr;
}
else... | php | protected function renderStars($id,$name)
{
$inputCount=(int)(($this->maxRating-$this->minRating)/$this->ratingStepSize+1);
$starSplit=(int)($inputCount/$this->starCount);
if($this->hasModel())
{
$attr=$this->attribute;
CHtml::resolveName($this->model,$attr);
$selection=$this->model->$attr;
}
else... | [
"protected",
"function",
"renderStars",
"(",
"$",
"id",
",",
"$",
"name",
")",
"{",
"$",
"inputCount",
"=",
"(",
"int",
")",
"(",
"(",
"$",
"this",
"->",
"maxRating",
"-",
"$",
"this",
"->",
"minRating",
")",
"/",
"$",
"this",
"->",
"ratingStepSize",... | Renders the stars.
@param string $id the ID of the container
@param string $name the name of the input | [
"Renders",
"the",
"stars",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CStarRating.php#L152-L175 | train |
yiisoft/yii | framework/web/widgets/pagers/CListPager.php | CListPager.generatePageText | protected function generatePageText($page)
{
if($this->pageTextFormat!==null)
return sprintf($this->pageTextFormat,$page+1);
else
return $page+1;
} | php | protected function generatePageText($page)
{
if($this->pageTextFormat!==null)
return sprintf($this->pageTextFormat,$page+1);
else
return $page+1;
} | [
"protected",
"function",
"generatePageText",
"(",
"$",
"page",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pageTextFormat",
"!==",
"null",
")",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"pageTextFormat",
",",
"$",
"page",
"+",
"1",
")",
";",
"else",
"r... | Generates the list option for the specified page number.
You may override this method to customize the option display.
@param integer $page zero-based page number
@return string the list option for the page number | [
"Generates",
"the",
"list",
"option",
"for",
"the",
"specified",
"page",
"number",
".",
"You",
"may",
"override",
"this",
"method",
"to",
"customize",
"the",
"option",
"display",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/pagers/CListPager.php#L81-L87 | train |
yiisoft/yii | framework/web/form/CFormElementCollection.php | CFormElementCollection.remove | public function remove($key)
{
if(($item=parent::remove($key))!==null)
$this->_form->removedElement($key,$item,$this->_forButtons);
} | php | public function remove($key)
{
if(($item=parent::remove($key))!==null)
$this->_form->removedElement($key,$item,$this->_forButtons);
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"(",
"$",
"item",
"=",
"parent",
"::",
"remove",
"(",
"$",
"key",
")",
")",
"!==",
"null",
")",
"$",
"this",
"->",
"_form",
"->",
"removedElement",
"(",
"$",
"key",
",",
"$",
... | Removes the specified element by key.
@param string $key the name of the element to be removed from the collection
@throws CException | [
"Removes",
"the",
"specified",
"element",
"by",
"key",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/form/CFormElementCollection.php#L107-L111 | train |
yiisoft/yii | framework/zii/widgets/grid/CGridView.php | CGridView.renderFilter | public function renderFilter()
{
if($this->filter!==null)
{
echo "<tr class=\"{$this->filterCssClass}\">\n";
foreach($this->columns as $column)
$column->renderFilterCell();
echo "</tr>\n";
}
} | php | public function renderFilter()
{
if($this->filter!==null)
{
echo "<tr class=\"{$this->filterCssClass}\">\n";
foreach($this->columns as $column)
$column->renderFilterCell();
echo "</tr>\n";
}
} | [
"public",
"function",
"renderFilter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"filter",
"!==",
"null",
")",
"{",
"echo",
"\"<tr class=\\\"{$this->filterCssClass}\\\">\\n\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"column",
")",
"$... | Renders the filter.
@since 1.1.1 | [
"Renders",
"the",
"filter",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/grid/CGridView.php#L533-L542 | train |
yiisoft/yii | demos/hangman/protected/controllers/GameController.php | GameController.actionPlay | public function actionPlay()
{
static $levels=array(
'10'=>'Easy game; you are allowed 10 misses.',
'5'=>'Medium game; you are allowed 5 misses.',
'3'=>'Hard game; you are allowed 3 misses.',
);
// if a difficulty level is correctly chosen
if(isset($_POST['level']) && isset($levels[$_POST['level']]))... | php | public function actionPlay()
{
static $levels=array(
'10'=>'Easy game; you are allowed 10 misses.',
'5'=>'Medium game; you are allowed 5 misses.',
'3'=>'Hard game; you are allowed 3 misses.',
);
// if a difficulty level is correctly chosen
if(isset($_POST['level']) && isset($levels[$_POST['level']]))... | [
"public",
"function",
"actionPlay",
"(",
")",
"{",
"static",
"$",
"levels",
"=",
"array",
"(",
"'10'",
"=>",
"'Easy game; you are allowed 10 misses.'",
",",
"'5'",
"=>",
"'Medium game; you are allowed 5 misses.'",
",",
"'3'",
"=>",
"'Hard game; you are allowed 3 misses.'"... | The 'play' action.
In this action, users are asked to choose a difficulty level
of the game. | [
"The",
"play",
"action",
".",
"In",
"this",
"action",
"users",
"are",
"asked",
"to",
"choose",
"a",
"difficulty",
"level",
"of",
"the",
"game",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/hangman/protected/controllers/GameController.php#L32-L61 | train |
yiisoft/yii | demos/hangman/protected/controllers/GameController.php | GameController.actionGuess | public function actionGuess()
{
// check to see if the letter is guessed correctly
if(isset($_GET['g'][0]) && ($result=$this->guess($_GET['g'][0]))!==null)
$this->render($result ? 'win' : 'lose');
else // the letter is guessed correctly, but not win yet
{
$guessed=$this->getPageState('guessed',array());
... | php | public function actionGuess()
{
// check to see if the letter is guessed correctly
if(isset($_GET['g'][0]) && ($result=$this->guess($_GET['g'][0]))!==null)
$this->render($result ? 'win' : 'lose');
else // the letter is guessed correctly, but not win yet
{
$guessed=$this->getPageState('guessed',array());
... | [
"public",
"function",
"actionGuess",
"(",
")",
"{",
"// check to see if the letter is guessed correctly",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"'g'",
"]",
"[",
"0",
"]",
")",
"&&",
"(",
"$",
"result",
"=",
"$",
"this",
"->",
"guess",
"(",
"$",
"_GE... | The 'guess' action.
This action is invoked each time when the user makes a guess. | [
"The",
"guess",
"action",
".",
"This",
"action",
"is",
"invoked",
"each",
"time",
"when",
"the",
"user",
"makes",
"a",
"guess",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/hangman/protected/controllers/GameController.php#L67-L79 | train |
yiisoft/yii | demos/hangman/protected/controllers/GameController.php | GameController.generateWord | protected function generateWord()
{
$wordFile=dirname(__FILE__).'/words.txt';
$words=preg_split("/[\s,]+/",file_get_contents($wordFile));
do
{
$i=rand(0,count($words)-1);
$word=$words[$i];
} while(strlen($word)<5 || !ctype_alpha($word));
return strtoupper($word);
} | php | protected function generateWord()
{
$wordFile=dirname(__FILE__).'/words.txt';
$words=preg_split("/[\s,]+/",file_get_contents($wordFile));
do
{
$i=rand(0,count($words)-1);
$word=$words[$i];
} while(strlen($word)<5 || !ctype_alpha($word));
return strtoupper($word);
} | [
"protected",
"function",
"generateWord",
"(",
")",
"{",
"$",
"wordFile",
"=",
"dirname",
"(",
"__FILE__",
")",
".",
"'/words.txt'",
";",
"$",
"words",
"=",
"preg_split",
"(",
"\"/[\\s,]+/\"",
",",
"file_get_contents",
"(",
"$",
"wordFile",
")",
")",
";",
"... | Generates a word to be guessed.
@return string the word to be guessed | [
"Generates",
"a",
"word",
"to",
"be",
"guessed",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/hangman/protected/controllers/GameController.php#L105-L115 | train |
yiisoft/yii | demos/hangman/protected/controllers/GameController.php | GameController.guess | protected function guess($letter)
{
$word=$this->word;
$guessWord=$this->guessWord;
$pos=0;
$success=false;
while(($pos=strpos($word,$letter,$pos))!==false)
{
$guessWord[$pos]=$letter;
$success=true;
$pos++;
}
if($success)
{
$this->guessWord=$guessWord;
if($guessWord===$word)
retur... | php | protected function guess($letter)
{
$word=$this->word;
$guessWord=$this->guessWord;
$pos=0;
$success=false;
while(($pos=strpos($word,$letter,$pos))!==false)
{
$guessWord[$pos]=$letter;
$success=true;
$pos++;
}
if($success)
{
$this->guessWord=$guessWord;
if($guessWord===$word)
retur... | [
"protected",
"function",
"guess",
"(",
"$",
"letter",
")",
"{",
"$",
"word",
"=",
"$",
"this",
"->",
"word",
";",
"$",
"guessWord",
"=",
"$",
"this",
"->",
"guessWord",
";",
"$",
"pos",
"=",
"0",
";",
"$",
"success",
"=",
"false",
";",
"while",
"... | Checks to see if a letter is guessed correctly.
@param string the letter
@return mixed true if the word is guessed correctly, false
if the user has used up all guesses and the word is guessed
incorrectly, and null if the letter is guessed correctly but
the whole word is guessed correctly yet. | [
"Checks",
"to",
"see",
"if",
"a",
"letter",
"is",
"guessed",
"correctly",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/hangman/protected/controllers/GameController.php#L125-L149 | train |
yiisoft/yii | framework/collections/CConfiguration.php | CConfiguration.loadFromFile | public function loadFromFile($configFile)
{
$data=require($configFile);
if($this->getCount()>0)
$this->mergeWith($data);
else
$this->copyFrom($data);
} | php | public function loadFromFile($configFile)
{
$data=require($configFile);
if($this->getCount()>0)
$this->mergeWith($data);
else
$this->copyFrom($data);
} | [
"public",
"function",
"loadFromFile",
"(",
"$",
"configFile",
")",
"{",
"$",
"data",
"=",
"require",
"(",
"$",
"configFile",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getCount",
"(",
")",
">",
"0",
")",
"$",
"this",
"->",
"mergeWith",
"(",
"$",
"dat... | Loads configuration data from a file and merges it with the existing configuration.
A config file must be a PHP script returning a configuration array (like the following)
<pre>
return array
(
'name'=>'My Application',
'defaultController'=>'index',
);
</pre>
@param string $configFile configuration file path (if using... | [
"Loads",
"configuration",
"data",
"from",
"a",
"file",
"and",
"merges",
"it",
"with",
"the",
"existing",
"configuration",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/collections/CConfiguration.php#L70-L77 | train |
yiisoft/yii | framework/web/helpers/CJavaScript.php | CJavaScript.quote | public static function quote($js,$forUrl=false)
{
$js = (string)$js;
Yii::import('system.vendors.zend-escaper.Escaper');
$escaper=new Escaper(Yii::app()->charset);
if($forUrl)
return $escaper->escapeUrl($js);
else
return $escaper->escapeJs($js);
} | php | public static function quote($js,$forUrl=false)
{
$js = (string)$js;
Yii::import('system.vendors.zend-escaper.Escaper');
$escaper=new Escaper(Yii::app()->charset);
if($forUrl)
return $escaper->escapeUrl($js);
else
return $escaper->escapeJs($js);
} | [
"public",
"static",
"function",
"quote",
"(",
"$",
"js",
",",
"$",
"forUrl",
"=",
"false",
")",
"{",
"$",
"js",
"=",
"(",
"string",
")",
"$",
"js",
";",
"Yii",
"::",
"import",
"(",
"'system.vendors.zend-escaper.Escaper'",
")",
";",
"$",
"escaper",
"=",... | Quotes a javascript string.
After processing, the string can be safely enclosed within a pair of
quotation marks and serve as a javascript string.
@param string $js string to be quoted
@param boolean $forUrl whether this string is used as a URL
@return string the quoted string | [
"Quotes",
"a",
"javascript",
"string",
".",
"After",
"processing",
"the",
"string",
"can",
"be",
"safely",
"enclosed",
"within",
"a",
"pair",
"of",
"quotation",
"marks",
"and",
"serve",
"as",
"a",
"javascript",
"string",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/helpers/CJavaScript.php#L28-L38 | train |
yiisoft/yii | framework/web/helpers/CJavaScript.php | CJavaScript.encode | public static function encode($value,$safe=false)
{
if(is_string($value))
{
if(strpos($value,'js:')===0 && $safe===false)
return substr($value,3);
else
return "'".self::quote($value)."'";
}
elseif($value===null)
return 'null';
elseif(is_bool($value))
return $value?'true':'false';
elseif... | php | public static function encode($value,$safe=false)
{
if(is_string($value))
{
if(strpos($value,'js:')===0 && $safe===false)
return substr($value,3);
else
return "'".self::quote($value)."'";
}
elseif($value===null)
return 'null';
elseif(is_bool($value))
return $value?'true':'false';
elseif... | [
"public",
"static",
"function",
"encode",
"(",
"$",
"value",
",",
"$",
"safe",
"=",
"false",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"value",
",",
"'js:'",
")",
"===",
"0",
"&&",
"$",
"... | Encodes a PHP variable into javascript representation.
Example:
<pre>
$options=array('key1'=>true,'key2'=>123,'key3'=>'value');
echo CJavaScript::encode($options);
// The following javascript code would be generated:
// {'key1':true,'key2':123,'key3':'value'}
</pre>
For highly complex data structures use {@link jsonE... | [
"Encodes",
"a",
"PHP",
"variable",
"into",
"javascript",
"representation",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/helpers/CJavaScript.php#L63-L109 | train |
yiisoft/yii | framework/logging/CLogRouter.php | CLogRouter.init | public function init()
{
parent::init();
foreach($this->_routes as $name=>$route)
{
$route=Yii::createComponent($route);
$route->init();
$this->_routes[$name]=$route;
}
Yii::getLogger()->attachEventHandler('onFlush',array($this,'collectLogs'));
Yii::app()->attachEventHandler('onEndRequest',array($... | php | public function init()
{
parent::init();
foreach($this->_routes as $name=>$route)
{
$route=Yii::createComponent($route);
$route->init();
$this->_routes[$name]=$route;
}
Yii::getLogger()->attachEventHandler('onFlush',array($this,'collectLogs'));
Yii::app()->attachEventHandler('onEndRequest',array($... | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_routes",
"as",
"$",
"name",
"=>",
"$",
"route",
")",
"{",
"$",
"route",
"=",
"Yii",
"::",
"createComponent",
"(",
"$",
"route",... | Initializes this application component.
This method is required by the IApplicationComponent interface. | [
"Initializes",
"this",
"application",
"component",
".",
"This",
"method",
"is",
"required",
"by",
"the",
"IApplicationComponent",
"interface",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CLogRouter.php#L60-L71 | train |
yiisoft/yii | build/tasks/YiiPearTask.php | YiiPearTask.main | function main()
{
$pkg = new PEAR_PackageFileManager2();
$e = $pkg->setOptions(array
(
'baseinstalldir' => 'yii',
'packagedirectory' => $this->pkgdir,
'filelistgenerator' => 'file',
'simpleoutput' => true,
'ignore' => array(),
'roles' => array('*' => 'php'),
)
);
//... | php | function main()
{
$pkg = new PEAR_PackageFileManager2();
$e = $pkg->setOptions(array
(
'baseinstalldir' => 'yii',
'packagedirectory' => $this->pkgdir,
'filelistgenerator' => 'file',
'simpleoutput' => true,
'ignore' => array(),
'roles' => array('*' => 'php'),
)
);
//... | [
"function",
"main",
"(",
")",
"{",
"$",
"pkg",
"=",
"new",
"PEAR_PackageFileManager2",
"(",
")",
";",
"$",
"e",
"=",
"$",
"pkg",
"->",
"setOptions",
"(",
"array",
"(",
"'baseinstalldir'",
"=>",
"'yii'",
",",
"'packagedirectory'",
"=>",
"$",
"this",
"->",... | Main entrypoint of the task | [
"Main",
"entrypoint",
"of",
"the",
"task"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/build/tasks/YiiPearTask.php#L87-L130 | train |
yiisoft/yii | framework/utils/CLocalizedFormatter.php | CLocalizedFormatter.setLocale | public function setLocale($locale)
{
if(is_string($locale))
$locale=CLocale::getInstance($locale);
$this->sizeFormat['decimalSeparator']=$locale->getNumberSymbol('decimal');
$this->_locale=$locale;
} | php | public function setLocale($locale)
{
if(is_string($locale))
$locale=CLocale::getInstance($locale);
$this->sizeFormat['decimalSeparator']=$locale->getNumberSymbol('decimal');
$this->_locale=$locale;
} | [
"public",
"function",
"setLocale",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"locale",
")",
")",
"$",
"locale",
"=",
"CLocale",
"::",
"getInstance",
"(",
"$",
"locale",
")",
";",
"$",
"this",
"->",
"sizeFormat",
"[",
"'decimalSepa... | Set the locale to use for formatting values.
@param CLocale|string $locale an instance of CLocale or a locale ID | [
"Set",
"the",
"locale",
"to",
"use",
"for",
"formatting",
"values",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CLocalizedFormatter.php#L54-L60 | train |
yiisoft/yii | framework/caching/CCache.php | CCache.init | public function init()
{
parent::init();
if($this->keyPrefix===null)
$this->keyPrefix=Yii::app()->getId();
} | php | public function init()
{
parent::init();
if($this->keyPrefix===null)
$this->keyPrefix=Yii::app()->getId();
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"keyPrefix",
"===",
"null",
")",
"$",
"this",
"->",
"keyPrefix",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"getId",
"(",
")",
";",
... | Initializes the application component.
This method overrides the parent implementation by setting default cache key prefix. | [
"Initializes",
"the",
"application",
"component",
".",
"This",
"method",
"overrides",
"the",
"parent",
"implementation",
"by",
"setting",
"default",
"cache",
"key",
"prefix",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/CCache.php#L81-L86 | train |
yiisoft/yii | framework/caching/CCache.php | CCache.get | public function get($id)
{
$value = $this->getValue($this->generateUniqueKey($id));
if($value===false || $this->serializer===false)
return $value;
if($this->serializer===null)
$value=unserialize($value);
else
$value=call_user_func($this->serializer[1], $value);
if(is_array($value) && (!$value[1] ins... | php | public function get($id)
{
$value = $this->getValue($this->generateUniqueKey($id));
if($value===false || $this->serializer===false)
return $value;
if($this->serializer===null)
$value=unserialize($value);
else
$value=call_user_func($this->serializer[1], $value);
if(is_array($value) && (!$value[1] ins... | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getValue",
"(",
"$",
"this",
"->",
"generateUniqueKey",
"(",
"$",
"id",
")",
")",
";",
"if",
"(",
"$",
"value",
"===",
"false",
"||",
"$",
"this",
"->",... | Retrieves a value from cache with a specified key.
@param string $id a key identifying the cached value
@return mixed the value stored in cache, false if the value is not in the cache, expired or the dependency has changed. | [
"Retrieves",
"a",
"value",
"from",
"cache",
"with",
"a",
"specified",
"key",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/CCache.php#L102-L118 | train |
yiisoft/yii | framework/caching/CCache.php | CCache.set | public function set($id,$value,$expire=0,$dependency=null)
{
Yii::trace('Saving "'.$id.'" to cache','system.caching.'.get_class($this));
if ($dependency !== null && $this->serializer !== false)
$dependency->evaluateDependency();
if ($this->serializer === null)
$value = serialize(array($value,$dependency)... | php | public function set($id,$value,$expire=0,$dependency=null)
{
Yii::trace('Saving "'.$id.'" to cache','system.caching.'.get_class($this));
if ($dependency !== null && $this->serializer !== false)
$dependency->evaluateDependency();
if ($this->serializer === null)
$value = serialize(array($value,$dependency)... | [
"public",
"function",
"set",
"(",
"$",
"id",
",",
"$",
"value",
",",
"$",
"expire",
"=",
"0",
",",
"$",
"dependency",
"=",
"null",
")",
"{",
"Yii",
"::",
"trace",
"(",
"'Saving \"'",
".",
"$",
"id",
".",
"'\" to cache'",
",",
"'system.caching.'",
"."... | Stores a value identified by a key into cache.
If the cache already contains such a key, the existing value and
expiration time will be replaced with the new ones.
@param string $id the key identifying the value to be cached
@param mixed $value the value to be cached
@param integer $expire the number of seconds in whi... | [
"Stores",
"a",
"value",
"identified",
"by",
"a",
"key",
"into",
"cache",
".",
"If",
"the",
"cache",
"already",
"contains",
"such",
"a",
"key",
"the",
"existing",
"value",
"and",
"expiration",
"time",
"will",
"be",
"replaced",
"with",
"the",
"new",
"ones",
... | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/CCache.php#L173-L186 | train |
yiisoft/yii | framework/caching/CCache.php | CCache.delete | public function delete($id)
{
Yii::trace('Deleting "'.$id.'" from cache','system.caching.'.get_class($this));
return $this->deleteValue($this->generateUniqueKey($id));
} | php | public function delete($id)
{
Yii::trace('Deleting "'.$id.'" from cache','system.caching.'.get_class($this));
return $this->deleteValue($this->generateUniqueKey($id));
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
"{",
"Yii",
"::",
"trace",
"(",
"'Deleting \"'",
".",
"$",
"id",
".",
"'\" from cache'",
",",
"'system.caching.'",
".",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"return",
"$",
"this",
"->",
"del... | Deletes a value with the specified key from cache
@param string $id the key of the value to be deleted
@return boolean if no error happens during deletion | [
"Deletes",
"a",
"value",
"with",
"the",
"specified",
"key",
"from",
"cache"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/caching/CCache.php#L217-L221 | train |
yiisoft/yii | framework/zii/widgets/jui/CJuiWidget.php | CJuiWidget.resolvePackagePath | protected function resolvePackagePath()
{
if($this->scriptUrl===null || $this->themeUrl===null)
{
$cs=Yii::app()->getClientScript();
if($this->scriptUrl===null)
$this->scriptUrl=$cs->getCoreScriptUrl().'/jui/js';
if($this->themeUrl===null)
$this->themeUrl=$cs->getCoreScriptUrl().'/jui/css';
}
} | php | protected function resolvePackagePath()
{
if($this->scriptUrl===null || $this->themeUrl===null)
{
$cs=Yii::app()->getClientScript();
if($this->scriptUrl===null)
$this->scriptUrl=$cs->getCoreScriptUrl().'/jui/js';
if($this->themeUrl===null)
$this->themeUrl=$cs->getCoreScriptUrl().'/jui/css';
}
} | [
"protected",
"function",
"resolvePackagePath",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"scriptUrl",
"===",
"null",
"||",
"$",
"this",
"->",
"themeUrl",
"===",
"null",
")",
"{",
"$",
"cs",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"getClientScript",... | Determine the JUI package installation path.
This method will identify the JavaScript root URL and theme root URL.
If they are not explicitly specified, it will publish the included JUI package
and use that to resolve the needed paths. | [
"Determine",
"the",
"JUI",
"package",
"installation",
"path",
".",
"This",
"method",
"will",
"identify",
"the",
"JavaScript",
"root",
"URL",
"and",
"theme",
"root",
"URL",
".",
"If",
"they",
"are",
"not",
"explicitly",
"specified",
"it",
"will",
"publish",
"... | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/jui/CJuiWidget.php#L92-L102 | train |
yiisoft/yii | framework/zii/widgets/jui/CJuiWidget.php | CJuiWidget.registerCoreScripts | protected function registerCoreScripts()
{
$cs=Yii::app()->getClientScript();
if(is_string($this->cssFile))
$cs->registerCssFile($this->themeUrl.'/'.$this->theme.'/'.$this->cssFile);
elseif(is_array($this->cssFile))
{
foreach($this->cssFile as $cssFile)
$cs->registerCssFile($this->themeUrl.'/'.$this-... | php | protected function registerCoreScripts()
{
$cs=Yii::app()->getClientScript();
if(is_string($this->cssFile))
$cs->registerCssFile($this->themeUrl.'/'.$this->theme.'/'.$this->cssFile);
elseif(is_array($this->cssFile))
{
foreach($this->cssFile as $cssFile)
$cs->registerCssFile($this->themeUrl.'/'.$this-... | [
"protected",
"function",
"registerCoreScripts",
"(",
")",
"{",
"$",
"cs",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"getClientScript",
"(",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"cssFile",
")",
")",
"$",
"cs",
"->",
"registerCssFile"... | Registers the core script files.
This method registers jquery and JUI JavaScript files and the theme CSS file. | [
"Registers",
"the",
"core",
"script",
"files",
".",
"This",
"method",
"registers",
"jquery",
"and",
"JUI",
"JavaScript",
"files",
"and",
"the",
"theme",
"CSS",
"file",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/jui/CJuiWidget.php#L108-L127 | train |
yiisoft/yii | framework/utils/CMarkdownParser.php | CMarkdownParser._doCodeBlocks_callback | public function _doCodeBlocks_callback($matches)
{
$codeblock = $this->outdent($matches[1]);
if(($codeblock = $this->highlightCodeBlock($codeblock)) !== null)
return "\n\n".$this->hashBlock($codeblock)."\n\n";
else
return parent::_doCodeBlocks_callback($matches);
} | php | public function _doCodeBlocks_callback($matches)
{
$codeblock = $this->outdent($matches[1]);
if(($codeblock = $this->highlightCodeBlock($codeblock)) !== null)
return "\n\n".$this->hashBlock($codeblock)."\n\n";
else
return parent::_doCodeBlocks_callback($matches);
} | [
"public",
"function",
"_doCodeBlocks_callback",
"(",
"$",
"matches",
")",
"{",
"$",
"codeblock",
"=",
"$",
"this",
"->",
"outdent",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
";",
"if",
"(",
"(",
"$",
"codeblock",
"=",
"$",
"this",
"->",
"highlightCodeBl... | Callback function when a code block is matched.
@param array $matches matches
@return string the highlighted code block | [
"Callback",
"function",
"when",
"a",
"code",
"block",
"is",
"matched",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CMarkdownParser.php#L97-L104 | train |
yiisoft/yii | framework/utils/CMarkdownParser.php | CMarkdownParser.highlightCodeBlock | protected function highlightCodeBlock($codeblock)
{
if(($tag=$this->getHighlightTag($codeblock))!==null && ($highlighter=$this->createHighLighter($tag)))
{
$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
$tagLen = strpos($codeblock, $tag)+strlen($tag);
$codeblock = ltrim(substr($codeblock, $ta... | php | protected function highlightCodeBlock($codeblock)
{
if(($tag=$this->getHighlightTag($codeblock))!==null && ($highlighter=$this->createHighLighter($tag)))
{
$codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
$tagLen = strpos($codeblock, $tag)+strlen($tag);
$codeblock = ltrim(substr($codeblock, $ta... | [
"protected",
"function",
"highlightCodeBlock",
"(",
"$",
"codeblock",
")",
"{",
"if",
"(",
"(",
"$",
"tag",
"=",
"$",
"this",
"->",
"getHighlightTag",
"(",
"$",
"codeblock",
")",
")",
"!==",
"null",
"&&",
"(",
"$",
"highlighter",
"=",
"$",
"this",
"->"... | Highlights the code block.
@param string $codeblock the code block
@return string the highlighted code block. Null if the code block does not need to highlighted | [
"Highlights",
"the",
"code",
"block",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CMarkdownParser.php#L121-L133 | train |
yiisoft/yii | framework/utils/CMarkdownParser.php | CMarkdownParser.getHighlightTag | protected function getHighlightTag($codeblock)
{
$str = trim(current(preg_split("/\r|\n/", $codeblock,2)));
if(strlen($str) > 2 && $str[0] === '[' && $str[strlen($str)-1] === ']')
return $str;
} | php | protected function getHighlightTag($codeblock)
{
$str = trim(current(preg_split("/\r|\n/", $codeblock,2)));
if(strlen($str) > 2 && $str[0] === '[' && $str[strlen($str)-1] === ']')
return $str;
} | [
"protected",
"function",
"getHighlightTag",
"(",
"$",
"codeblock",
")",
"{",
"$",
"str",
"=",
"trim",
"(",
"current",
"(",
"preg_split",
"(",
"\"/\\r|\\n/\"",
",",
"$",
"codeblock",
",",
"2",
")",
")",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"str",
... | Returns the user-entered highlighting options.
@param string $codeblock code block with highlighting options.
@return string the user-entered highlighting options. Null if no option is entered. | [
"Returns",
"the",
"user",
"-",
"entered",
"highlighting",
"options",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CMarkdownParser.php#L140-L145 | train |
yiisoft/yii | framework/utils/CMarkdownParser.php | CMarkdownParser.createHighLighter | protected function createHighLighter($options)
{
if(!class_exists('Text_Highlighter', false))
{
require_once(Yii::getPathOfAlias('system.vendors.TextHighlighter.Text.Highlighter').'.php');
require_once(Yii::getPathOfAlias('system.vendors.TextHighlighter.Text.Highlighter.Renderer.Html').'.php');
}
$lang =... | php | protected function createHighLighter($options)
{
if(!class_exists('Text_Highlighter', false))
{
require_once(Yii::getPathOfAlias('system.vendors.TextHighlighter.Text.Highlighter').'.php');
require_once(Yii::getPathOfAlias('system.vendors.TextHighlighter.Text.Highlighter.Renderer.Html').'.php');
}
$lang =... | [
"protected",
"function",
"createHighLighter",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'Text_Highlighter'",
",",
"false",
")",
")",
"{",
"require_once",
"(",
"Yii",
"::",
"getPathOfAlias",
"(",
"'system.vendors.TextHighlighter.Text.Highli... | Creates a highlighter instance.
@param string $options the user-entered options
@return Text_Highlighter the highlighter instance | [
"Creates",
"a",
"highlighter",
"instance",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CMarkdownParser.php#L152-L164 | train |
yiisoft/yii | framework/utils/CMarkdownParser.php | CMarkdownParser.getHighlightConfig | public function getHighlightConfig($options)
{
$config = array('use_language'=>true);
if( $this->getInlineOption('showLineNumbers', $options, false) )
$config['numbers'] = HL_NUMBERS_LI;
$config['tabsize'] = $this->getInlineOption('tabSize', $options, 4);
return $config;
} | php | public function getHighlightConfig($options)
{
$config = array('use_language'=>true);
if( $this->getInlineOption('showLineNumbers', $options, false) )
$config['numbers'] = HL_NUMBERS_LI;
$config['tabsize'] = $this->getInlineOption('tabSize', $options, 4);
return $config;
} | [
"public",
"function",
"getHighlightConfig",
"(",
"$",
"options",
")",
"{",
"$",
"config",
"=",
"array",
"(",
"'use_language'",
"=>",
"true",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getInlineOption",
"(",
"'showLineNumbers'",
",",
"$",
"options",
",",
"fal... | Generates the config for the highlighter.
@param string $options user-entered options
@return array the highlighter config | [
"Generates",
"the",
"config",
"for",
"the",
"highlighter",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CMarkdownParser.php#L171-L178 | train |
yiisoft/yii | framework/utils/CMarkdownParser.php | CMarkdownParser.getInlineOption | protected function getInlineOption($name, $str, $defaultValue)
{
if(preg_match('/'.$name.'(\s*=\s*(\d+))?/i', $str, $v) && count($v) > 2)
return $v[2];
else
return $defaultValue;
} | php | protected function getInlineOption($name, $str, $defaultValue)
{
if(preg_match('/'.$name.'(\s*=\s*(\d+))?/i', $str, $v) && count($v) > 2)
return $v[2];
else
return $defaultValue;
} | [
"protected",
"function",
"getInlineOption",
"(",
"$",
"name",
",",
"$",
"str",
",",
"$",
"defaultValue",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/'",
".",
"$",
"name",
".",
"'(\\s*=\\s*(\\d+))?/i'",
",",
"$",
"str",
",",
"$",
"v",
")",
"&&",
"count",... | Retrieves the specified configuration.
@param string $name the configuration name
@param string $str the user-entered options
@param mixed $defaultValue default value if the configuration is not present
@return mixed the configuration value | [
"Retrieves",
"the",
"specified",
"configuration",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CMarkdownParser.php#L201-L207 | train |
yiisoft/yii | framework/utils/CFileHelper.php | CFileHelper.copyDirectory | public static function copyDirectory($src,$dst,$options=array())
{
$fileTypes=array();
$exclude=array();
$level=-1;
extract($options);
if(!is_dir($dst))
self::createDirectory($dst,isset($options['newDirMode'])?$options['newDirMode']:null,true);
self::copyDirectoryRecursive($src,$dst,'',$fileTypes,$excl... | php | public static function copyDirectory($src,$dst,$options=array())
{
$fileTypes=array();
$exclude=array();
$level=-1;
extract($options);
if(!is_dir($dst))
self::createDirectory($dst,isset($options['newDirMode'])?$options['newDirMode']:null,true);
self::copyDirectoryRecursive($src,$dst,'',$fileTypes,$excl... | [
"public",
"static",
"function",
"copyDirectory",
"(",
"$",
"src",
",",
"$",
"dst",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"fileTypes",
"=",
"array",
"(",
")",
";",
"$",
"exclude",
"=",
"array",
"(",
")",
";",
"$",
"level",
"=... | Copies a directory recursively as another.
If the destination directory does not exist, it will be created recursively.
@param string $src the source directory
@param string $dst the destination directory
@param array $options options for directory copy. Valid options are:
<ul>
<li>fileTypes: array, list of file name s... | [
"Copies",
"a",
"directory",
"recursively",
"as",
"another",
".",
"If",
"the",
"destination",
"directory",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"recursively",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFileHelper.php#L54-L64 | train |
yiisoft/yii | framework/utils/CFileHelper.php | CFileHelper.findFiles | public static function findFiles($dir,$options=array())
{
$fileTypes=array();
$exclude=array();
$level=-1;
$absolutePaths=true;
extract($options);
$list=self::findFilesRecursive($dir,'',$fileTypes,$exclude,$level,$absolutePaths);
sort($list);
return $list;
} | php | public static function findFiles($dir,$options=array())
{
$fileTypes=array();
$exclude=array();
$level=-1;
$absolutePaths=true;
extract($options);
$list=self::findFilesRecursive($dir,'',$fileTypes,$exclude,$level,$absolutePaths);
sort($list);
return $list;
} | [
"public",
"static",
"function",
"findFiles",
"(",
"$",
"dir",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"fileTypes",
"=",
"array",
"(",
")",
";",
"$",
"exclude",
"=",
"array",
"(",
")",
";",
"$",
"level",
"=",
"-",
"1",
";",
"... | Returns the files found under the specified directory and subdirectories.
@param string $dir the directory under which the files will be looked for
@param array $options options for file searching. Valid options are:
<ul>
<li>fileTypes: array, list of file name suffix (without dot). Only files with these suffixes will ... | [
"Returns",
"the",
"files",
"found",
"under",
"the",
"specified",
"directory",
"and",
"subdirectories",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFileHelper.php#L126-L136 | train |
yiisoft/yii | framework/utils/CFileHelper.php | CFileHelper.validatePath | protected static function validatePath($base,$file,$isFile,$fileTypes,$exclude)
{
foreach($exclude as $e)
{
if($file===$e || strpos($base.'/'.$file,$e)===0)
return false;
}
if(!$isFile || empty($fileTypes))
return true;
if(($type=self::getExtension($file))!=='')
return in_array($type,$fileTypes)... | php | protected static function validatePath($base,$file,$isFile,$fileTypes,$exclude)
{
foreach($exclude as $e)
{
if($file===$e || strpos($base.'/'.$file,$e)===0)
return false;
}
if(!$isFile || empty($fileTypes))
return true;
if(($type=self::getExtension($file))!=='')
return in_array($type,$fileTypes)... | [
"protected",
"static",
"function",
"validatePath",
"(",
"$",
"base",
",",
"$",
"file",
",",
"$",
"isFile",
",",
"$",
"fileTypes",
",",
"$",
"exclude",
")",
"{",
"foreach",
"(",
"$",
"exclude",
"as",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"file",
"==="... | Validates a file or directory.
@param string $base the path relative to the original source directory
@param string $file the file or directory name
@param boolean $isFile whether this is a file
@param array $fileTypes list of valid file name suffixes (without dot).
@param array $exclude list of directory and file excl... | [
"Validates",
"a",
"file",
"or",
"directory",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFileHelper.php#L242-L255 | train |
yiisoft/yii | framework/utils/CFileHelper.php | CFileHelper.getMimeTypeByExtension | public static function getMimeTypeByExtension($file,$magicFile=null)
{
static $extensions,$customExtensions=array();
if($magicFile===null && $extensions===null)
$extensions=require(Yii::getPathOfAlias('system.utils.mimeTypes').'.php');
elseif($magicFile!==null && !isset($customExtensions[$magicFile]))
$cus... | php | public static function getMimeTypeByExtension($file,$magicFile=null)
{
static $extensions,$customExtensions=array();
if($magicFile===null && $extensions===null)
$extensions=require(Yii::getPathOfAlias('system.utils.mimeTypes').'.php');
elseif($magicFile!==null && !isset($customExtensions[$magicFile]))
$cus... | [
"public",
"static",
"function",
"getMimeTypeByExtension",
"(",
"$",
"file",
",",
"$",
"magicFile",
"=",
"null",
")",
"{",
"static",
"$",
"extensions",
",",
"$",
"customExtensions",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"magicFile",
"===",
"null",
... | Determines the MIME type based on the extension name of the specified file.
This method will use a local map between extension name and MIME type.
@param string $file the file name.
@param string $magicFile the path of the file that contains all available MIME type information.
If this is not set, the default 'system.u... | [
"Determines",
"the",
"MIME",
"type",
"based",
"on",
"the",
"extension",
"name",
"of",
"the",
"specified",
"file",
".",
"This",
"method",
"will",
"use",
"a",
"local",
"map",
"between",
"extension",
"name",
"and",
"MIME",
"type",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFileHelper.php#L301-L317 | train |
yiisoft/yii | framework/utils/CFileHelper.php | CFileHelper.getExtensionByMimeType | public static function getExtensionByMimeType($file,$magicFile=null)
{
static $mimeTypes,$customMimeTypes=array();
if($magicFile===null && $mimeTypes===null)
$mimeTypes=require(Yii::getPathOfAlias('system.utils.fileExtensions').'.php');
elseif($magicFile!==null && !isset($customMimeTypes[$magicFile]))
$cus... | php | public static function getExtensionByMimeType($file,$magicFile=null)
{
static $mimeTypes,$customMimeTypes=array();
if($magicFile===null && $mimeTypes===null)
$mimeTypes=require(Yii::getPathOfAlias('system.utils.fileExtensions').'.php');
elseif($magicFile!==null && !isset($customMimeTypes[$magicFile]))
$cus... | [
"public",
"static",
"function",
"getExtensionByMimeType",
"(",
"$",
"file",
",",
"$",
"magicFile",
"=",
"null",
")",
"{",
"static",
"$",
"mimeTypes",
",",
"$",
"customMimeTypes",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"magicFile",
"===",
"null",
"&... | Determines the file extension name based on its MIME type.
This method will use a local map between MIME type and extension name.
@param string $file the file name.
@param string $magicFile the path of the file that contains all available extension information.
If this is not set, the default 'system.utils.fileExtensio... | [
"Determines",
"the",
"file",
"extension",
"name",
"based",
"on",
"its",
"MIME",
"type",
".",
"This",
"method",
"will",
"use",
"a",
"local",
"map",
"between",
"MIME",
"type",
"and",
"extension",
"name",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFileHelper.php#L328-L344 | train |
yiisoft/yii | framework/web/widgets/COutputProcessor.php | COutputProcessor.processOutput | public function processOutput($output)
{
if($this->hasEventHandler('onProcessOutput'))
{
$event=new COutputEvent($this,$output);
$this->onProcessOutput($event);
if(!$event->handled)
echo $output;
}
else
echo $output;
} | php | public function processOutput($output)
{
if($this->hasEventHandler('onProcessOutput'))
{
$event=new COutputEvent($this,$output);
$this->onProcessOutput($event);
if(!$event->handled)
echo $output;
}
else
echo $output;
} | [
"public",
"function",
"processOutput",
"(",
"$",
"output",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasEventHandler",
"(",
"'onProcessOutput'",
")",
")",
"{",
"$",
"event",
"=",
"new",
"COutputEvent",
"(",
"$",
"this",
",",
"$",
"output",
")",
";",
"$"... | Processes the captured output.
The default implementation raises an {@link onProcessOutput} event.
If the event is not handled by any event handler, the output will be echoed.
@param string $output the captured output to be processed | [
"Processes",
"the",
"captured",
"output",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/COutputProcessor.php#L55-L66 | train |
yiisoft/yii | framework/web/CSort.php | CSort.link | public function link($attribute,$label=null,$htmlOptions=array())
{
if($label===null)
$label=$this->resolveLabel($attribute);
if(($definition=$this->resolveAttribute($attribute))===false)
return $label;
$directions=$this->getDirections();
if(isset($directions[$attribute]))
{
$class=$directions[$attr... | php | public function link($attribute,$label=null,$htmlOptions=array())
{
if($label===null)
$label=$this->resolveLabel($attribute);
if(($definition=$this->resolveAttribute($attribute))===false)
return $label;
$directions=$this->getDirections();
if(isset($directions[$attribute]))
{
$class=$directions[$attr... | [
"public",
"function",
"link",
"(",
"$",
"attribute",
",",
"$",
"label",
"=",
"null",
",",
"$",
"htmlOptions",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"$",
"label",
"===",
"null",
")",
"$",
"label",
"=",
"$",
"this",
"->",
"resolveLabel",
"(",
... | Generates a hyperlink that can be clicked to cause sorting.
@param string $attribute the attribute name. This must be the actual attribute name, not alias.
If it is an attribute of a related AR object, the name should be prefixed with
the relation name (e.g. 'author.name', where 'author' is the relation name).
@param s... | [
"Generates",
"a",
"hyperlink",
"that",
"can",
"be",
"clicked",
"to",
"cause",
"sorting",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CSort.php#L279-L309 | train |
yiisoft/yii | framework/web/CSort.php | CSort.getDirections | public function getDirections()
{
if($this->_directions===null)
{
$this->_directions=array();
if(isset($_GET[$this->sortVar]) && is_string($_GET[$this->sortVar]))
{
$attributes=explode($this->separators[0],$_GET[$this->sortVar]);
foreach($attributes as $attribute)
{
if(($pos=strrpos($attr... | php | public function getDirections()
{
if($this->_directions===null)
{
$this->_directions=array();
if(isset($_GET[$this->sortVar]) && is_string($_GET[$this->sortVar]))
{
$attributes=explode($this->separators[0],$_GET[$this->sortVar]);
foreach($attributes as $attribute)
{
if(($pos=strrpos($attr... | [
"public",
"function",
"getDirections",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_directions",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_directions",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"_GET",
"[",
"$",
"this",
"->",... | Returns the currently requested sort information.
@return array sort directions indexed by attribute names.
Sort direction can be either CSort::SORT_ASC for ascending order or
CSort::SORT_DESC for descending order. | [
"Returns",
"the",
"currently",
"requested",
"sort",
"information",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CSort.php#L341-L372 | train |
yiisoft/yii | framework/web/CSort.php | CSort.getDirection | public function getDirection($attribute)
{
$this->getDirections();
return isset($this->_directions[$attribute]) ? $this->_directions[$attribute] : null;
} | php | public function getDirection($attribute)
{
$this->getDirections();
return isset($this->_directions[$attribute]) ? $this->_directions[$attribute] : null;
} | [
"public",
"function",
"getDirection",
"(",
"$",
"attribute",
")",
"{",
"$",
"this",
"->",
"getDirections",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"_directions",
"[",
"$",
"attribute",
"]",
")",
"?",
"$",
"this",
"->",
"_directions",
... | Returns the sort direction of the specified attribute in the current request.
@param string $attribute the attribute name
@return mixed Sort direction of the attribute. Can be either CSort::SORT_ASC
for ascending order or CSort::SORT_DESC for descending order. Value is null
if the attribute doesn't need to be sorted. | [
"Returns",
"the",
"sort",
"direction",
"of",
"the",
"specified",
"attribute",
"in",
"the",
"current",
"request",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CSort.php#L381-L385 | train |
yiisoft/yii | framework/web/CSort.php | CSort.createUrl | public function createUrl($controller,$directions)
{
$sorts=array();
foreach($directions as $attribute=>$descending)
$sorts[]=$descending ? $attribute.$this->separators[1].$this->descTag : $attribute;
$params=$this->params===null ? $_GET : $this->params;
$params[$this->sortVar]=implode($this->separators[0],... | php | public function createUrl($controller,$directions)
{
$sorts=array();
foreach($directions as $attribute=>$descending)
$sorts[]=$descending ? $attribute.$this->separators[1].$this->descTag : $attribute;
$params=$this->params===null ? $_GET : $this->params;
$params[$this->sortVar]=implode($this->separators[0],... | [
"public",
"function",
"createUrl",
"(",
"$",
"controller",
",",
"$",
"directions",
")",
"{",
"$",
"sorts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"directions",
"as",
"$",
"attribute",
"=>",
"$",
"descending",
")",
"$",
"sorts",
"[",
"]",
"... | Creates a URL that can lead to generating sorted data.
@param CController $controller the controller that will be used to create the URL.
@param array $directions the sort directions indexed by attribute names.
The sort direction can be either CSort::SORT_ASC for ascending order or
CSort::SORT_DESC for descending order... | [
"Creates",
"a",
"URL",
"that",
"can",
"lead",
"to",
"generating",
"sorted",
"data",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CSort.php#L395-L403 | train |
yiisoft/yii | framework/web/CSort.php | CSort.resolveAttribute | public function resolveAttribute($attribute)
{
if($this->attributes!==array())
$attributes=$this->attributes;
elseif($this->modelClass!==null)
$attributes=$this->getModel($this->modelClass)->attributeNames();
else
return false;
foreach($attributes as $name=>$definition)
{
if(is_string($name))
... | php | public function resolveAttribute($attribute)
{
if($this->attributes!==array())
$attributes=$this->attributes;
elseif($this->modelClass!==null)
$attributes=$this->getModel($this->modelClass)->attributeNames();
else
return false;
foreach($attributes as $name=>$definition)
{
if(is_string($name))
... | [
"public",
"function",
"resolveAttribute",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"attributes",
"!==",
"array",
"(",
")",
")",
"$",
"attributes",
"=",
"$",
"this",
"->",
"attributes",
";",
"elseif",
"(",
"$",
"this",
"->",
"model... | Returns the real definition of an attribute given its name.
The resolution is based on {@link attributes} and {@link CActiveRecord::attributeNames}.
<ul>
<li>When {@link attributes} is an empty array, if the name refers to an attribute of {@link modelClass},
then the name is returned back.</li>
<li>When {@link attribu... | [
"Returns",
"the",
"real",
"definition",
"of",
"an",
"attribute",
"given",
"its",
"name",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CSort.php#L420-L444 | train |
yiisoft/yii | framework/web/CSort.php | CSort.createLink | protected function createLink($attribute,$label,$url,$htmlOptions)
{
return CHtml::link($label,$url,$htmlOptions);
} | php | protected function createLink($attribute,$label,$url,$htmlOptions)
{
return CHtml::link($label,$url,$htmlOptions);
} | [
"protected",
"function",
"createLink",
"(",
"$",
"attribute",
",",
"$",
"label",
",",
"$",
"url",
",",
"$",
"htmlOptions",
")",
"{",
"return",
"CHtml",
"::",
"link",
"(",
"$",
"label",
",",
"$",
"url",
",",
"$",
"htmlOptions",
")",
";",
"}"
] | Creates a hyperlink based on the given label and URL.
You may override this method to customize the link generation.
@param string $attribute the name of the attribute that this link is for
@param string $label the label of the hyperlink
@param string $url the URL
@param array $htmlOptions additional HTML options
@retu... | [
"Creates",
"a",
"hyperlink",
"based",
"on",
"the",
"given",
"label",
"and",
"URL",
".",
"You",
"may",
"override",
"this",
"method",
"to",
"customize",
"the",
"link",
"generation",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CSort.php#L468-L471 | train |
yiisoft/yii | framework/zii/widgets/grid/CCheckBoxColumn.php | CCheckBoxColumn.init | public function init()
{
if(isset($this->checkBoxHtmlOptions['name']))
$name=$this->checkBoxHtmlOptions['name'];
else
{
$name=$this->id;
if(substr($name,-2)!=='[]')
$name.='[]';
$this->checkBoxHtmlOptions['name']=$name;
}
$name=strtr($name,array('['=>"\\[",']'=>"\\]"));
if($this->selectabl... | php | public function init()
{
if(isset($this->checkBoxHtmlOptions['name']))
$name=$this->checkBoxHtmlOptions['name'];
else
{
$name=$this->id;
if(substr($name,-2)!=='[]')
$name.='[]';
$this->checkBoxHtmlOptions['name']=$name;
}
$name=strtr($name,array('['=>"\\[",']'=>"\\]"));
if($this->selectabl... | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"checkBoxHtmlOptions",
"[",
"'name'",
"]",
")",
")",
"$",
"name",
"=",
"$",
"this",
"->",
"checkBoxHtmlOptions",
"[",
"'name'",
"]",
";",
"else",
"{",
"$",
"name... | Initializes the column.
This method registers necessary client script for the checkbox column. | [
"Initializes",
"the",
"column",
".",
"This",
"method",
"registers",
"necessary",
"client",
"script",
"for",
"the",
"checkbox",
"column",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/grid/CCheckBoxColumn.php#L131-L187 | train |
yiisoft/yii | framework/zii/widgets/grid/CCheckBoxColumn.php | CCheckBoxColumn.getDataCellContent | public function getDataCellContent($row)
{
$data=$this->grid->dataProvider->data[$row];
if($this->value!==null)
$value=$this->evaluateExpression($this->value,array('data'=>$data,'row'=>$row));
elseif($this->name!==null)
$value=CHtml::value($data,$this->name);
else
$value=$this->grid->dataProvider->key... | php | public function getDataCellContent($row)
{
$data=$this->grid->dataProvider->data[$row];
if($this->value!==null)
$value=$this->evaluateExpression($this->value,array('data'=>$data,'row'=>$row));
elseif($this->name!==null)
$value=CHtml::value($data,$this->name);
else
$value=$this->grid->dataProvider->key... | [
"public",
"function",
"getDataCellContent",
"(",
"$",
"row",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"grid",
"->",
"dataProvider",
"->",
"data",
"[",
"$",
"row",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"value",
"!==",
"null",
")",
"$",
"valu... | Returns the data cell content.
This method renders a checkbox 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",
"checkbox",
"in",
"the",
"data",
"cell",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/zii/widgets/grid/CCheckBoxColumn.php#L220-L243 | train |
yiisoft/yii | demos/blog/protected/controllers/CommentController.php | CommentController.actionDelete | public function actionDelete()
{
if(Yii::app()->request->isPostRequest)
{
// we only allow deletion via POST request
$this->loadModel()->delete();
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_POST['ajax']))
$this->redirect(array('in... | php | public function actionDelete()
{
if(Yii::app()->request->isPostRequest)
{
// we only allow deletion via POST request
$this->loadModel()->delete();
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_POST['ajax']))
$this->redirect(array('in... | [
"public",
"function",
"actionDelete",
"(",
")",
"{",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"isPostRequest",
")",
"{",
"// we only allow deletion via POST request",
"$",
"this",
"->",
"loadModel",
"(",
")",
"->",
"delete",
"(",
")",
... | Deletes a particular model.
If deletion is successful, the browser will be redirected to the 'index' page. | [
"Deletes",
"a",
"particular",
"model",
".",
"If",
"deletion",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"index",
"page",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/controllers/CommentController.php#L67-L80 | train |
yiisoft/yii | demos/blog/protected/controllers/CommentController.php | CommentController.actionApprove | public function actionApprove()
{
if(Yii::app()->request->isPostRequest)
{
$comment=$this->loadModel();
$comment->approve();
$this->redirect(array('index'));
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
} | php | public function actionApprove()
{
if(Yii::app()->request->isPostRequest)
{
$comment=$this->loadModel();
$comment->approve();
$this->redirect(array('index'));
}
else
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
} | [
"public",
"function",
"actionApprove",
"(",
")",
"{",
"if",
"(",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"isPostRequest",
")",
"{",
"$",
"comment",
"=",
"$",
"this",
"->",
"loadModel",
"(",
")",
";",
"$",
"comment",
"->",
"approve",
"(",... | Approves a particular comment.
If approval is successful, the browser will be redirected to the comment index page. | [
"Approves",
"a",
"particular",
"comment",
".",
"If",
"approval",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"comment",
"index",
"page",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/demos/blog/protected/controllers/CommentController.php#L103-L113 | train |
yiisoft/yii | framework/web/auth/CBaseUserIdentity.php | CBaseUserIdentity.getState | public function getState($name,$defaultValue=null)
{
return isset($this->_state[$name])?$this->_state[$name]:$defaultValue;
} | php | public function getState($name,$defaultValue=null)
{
return isset($this->_state[$name])?$this->_state[$name]:$defaultValue;
} | [
"public",
"function",
"getState",
"(",
"$",
"name",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"_state",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"_state",
"[",
"$",
"name",
"]",
":",
"$... | Gets the persisted state by the specified name.
@param string $name the name of the state
@param mixed $defaultValue the default value to be returned if the named state does not exist
@return mixed the value of the named state | [
"Gets",
"the",
"persisted",
"state",
"by",
"the",
"specified",
"name",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/auth/CBaseUserIdentity.php#L108-L111 | train |
yiisoft/yii | framework/web/CPagination.php | CPagination.applyLimit | public function applyLimit($criteria)
{
$criteria->limit=$this->getLimit();
$criteria->offset=$this->getOffset();
} | php | public function applyLimit($criteria)
{
$criteria->limit=$this->getLimit();
$criteria->offset=$this->getOffset();
} | [
"public",
"function",
"applyLimit",
"(",
"$",
"criteria",
")",
"{",
"$",
"criteria",
"->",
"limit",
"=",
"$",
"this",
"->",
"getLimit",
"(",
")",
";",
"$",
"criteria",
"->",
"offset",
"=",
"$",
"this",
"->",
"getOffset",
"(",
")",
";",
"}"
] | Applies LIMIT and OFFSET to the specified query criteria.
@param CDbCriteria $criteria the query criteria that should be applied with the limit | [
"Applies",
"LIMIT",
"and",
"OFFSET",
"to",
"the",
"specified",
"query",
"criteria",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/CPagination.php#L214-L218 | train |
yiisoft/yii | framework/i18n/CGettextMessageSource.php | CGettextMessageSource.init | public function init()
{
parent::init();
if($this->basePath===null)
$this->basePath=Yii::getPathOfAlias('application.messages');
} | php | public function init()
{
parent::init();
if($this->basePath===null)
$this->basePath=Yii::getPathOfAlias('application.messages');
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"basePath",
"===",
"null",
")",
"$",
"this",
"->",
"basePath",
"=",
"Yii",
"::",
"getPathOfAlias",
"(",
"'application.messages'",
")",
";"... | Initializes the application component.
This method overrides the parent implementation by preprocessing
the user request data. | [
"Initializes",
"the",
"application",
"component",
".",
"This",
"method",
"overrides",
"the",
"parent",
"implementation",
"by",
"preprocessing",
"the",
"user",
"request",
"data",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/i18n/CGettextMessageSource.php#L71-L76 | train |
yiisoft/yii | framework/validators/CCaptchaValidator.php | CCaptchaValidator.getCaptchaAction | protected function getCaptchaAction()
{
if(($captcha=Yii::app()->getController()->createAction($this->captchaAction))===null)
{
if(strpos($this->captchaAction,'/')!==false) // contains controller or module
{
if(($ca=Yii::app()->createController($this->captchaAction))!==null)
{
list($controller,$... | php | protected function getCaptchaAction()
{
if(($captcha=Yii::app()->getController()->createAction($this->captchaAction))===null)
{
if(strpos($this->captchaAction,'/')!==false) // contains controller or module
{
if(($ca=Yii::app()->createController($this->captchaAction))!==null)
{
list($controller,$... | [
"protected",
"function",
"getCaptchaAction",
"(",
")",
"{",
"if",
"(",
"(",
"$",
"captcha",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"getController",
"(",
")",
"->",
"createAction",
"(",
"$",
"this",
"->",
"captchaAction",
")",
")",
"===",
"null",
")",... | Returns the CAPTCHA action object.
@throws CException if {@link action} is invalid
@return CCaptchaAction the action object
@since 1.1.7 | [
"Returns",
"the",
"CAPTCHA",
"action",
"object",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/validators/CCaptchaValidator.php#L64-L81 | train |
yiisoft/yii | framework/utils/CFormatter.php | CFormatter.format | public function format($value,$type)
{
$method='format'.$type;
if(method_exists($this,$method))
return $this->$method($value);
else
throw new CException(Yii::t('yii','Unknown type "{type}".',array('{type}'=>$type)));
} | php | public function format($value,$type)
{
$method='format'.$type;
if(method_exists($this,$method))
return $this->$method($value);
else
throw new CException(Yii::t('yii','Unknown type "{type}".',array('{type}'=>$type)));
} | [
"public",
"function",
"format",
"(",
"$",
"value",
",",
"$",
"type",
")",
"{",
"$",
"method",
"=",
"'format'",
".",
"$",
"type",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"return",
"$",
"this",
"->",
"$",
"m... | Formats a value based on the given type.
@param mixed $value the value to be formatted
@param string $type the data type. This must correspond to a format method available in CFormatter.
For example, we can use 'text' here because there is method named {@link formatText}.
@throws CException if given type is unknown
@re... | [
"Formats",
"a",
"value",
"based",
"on",
"the",
"given",
"type",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFormatter.php#L124-L131 | train |
yiisoft/yii | framework/utils/CFormatter.php | CFormatter.normalizeDateValue | protected function normalizeDateValue($time)
{
if(is_string($time))
{
if(ctype_digit($time) || ($time{0}=='-' && ctype_digit(substr($time, 1))))
return (int)$time;
else
return strtotime($time);
}
elseif (class_exists('DateTime', false) && $time instanceof DateTime)
return $time->getTimestamp()... | php | protected function normalizeDateValue($time)
{
if(is_string($time))
{
if(ctype_digit($time) || ($time{0}=='-' && ctype_digit(substr($time, 1))))
return (int)$time;
else
return strtotime($time);
}
elseif (class_exists('DateTime', false) && $time instanceof DateTime)
return $time->getTimestamp()... | [
"protected",
"function",
"normalizeDateValue",
"(",
"$",
"time",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"time",
")",
")",
"{",
"if",
"(",
"ctype_digit",
"(",
"$",
"time",
")",
"||",
"(",
"$",
"time",
"{",
"0",
"}",
"==",
"'-'",
"&&",
"ctype_di... | Normalizes an expression as a timestamp.
@param mixed $time the time expression to be normalized
@return int the normalized result as a UNIX timestamp | [
"Normalizes",
"an",
"expression",
"as",
"a",
"timestamp",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFormatter.php#L228-L241 | train |
yiisoft/yii | framework/utils/CFormatter.php | CFormatter.formatUrl | public function formatUrl($value)
{
$url=$value;
if(strpos($url,'http://')!==0 && strpos($url,'https://')!==0)
$url='http://'.$url;
return CHtml::link(CHtml::encode($value),$url);
} | php | public function formatUrl($value)
{
$url=$value;
if(strpos($url,'http://')!==0 && strpos($url,'https://')!==0)
$url='http://'.$url;
return CHtml::link(CHtml::encode($value),$url);
} | [
"public",
"function",
"formatUrl",
"(",
"$",
"value",
")",
"{",
"$",
"url",
"=",
"$",
"value",
";",
"if",
"(",
"strpos",
"(",
"$",
"url",
",",
"'http://'",
")",
"!==",
"0",
"&&",
"strpos",
"(",
"$",
"url",
",",
"'https://'",
")",
"!==",
"0",
")",... | Formats the value as a hyperlink.
@param mixed $value the value to be formatted
@return string the formatted result | [
"Formats",
"the",
"value",
"as",
"a",
"hyperlink",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFormatter.php#L279-L285 | train |
yiisoft/yii | framework/utils/CFormatter.php | CFormatter.formatSize | public function formatSize($value,$verbose=false)
{
$base=$this->sizeFormat['base'];
for($i=0; $base<=$value && $i<5; $i++)
$value=$value/$base;
$value=round($value, $this->sizeFormat['decimals']);
$formattedValue=isset($this->sizeFormat['decimalSeparator']) ? str_replace('.',$this->sizeFormat['decimalSepa... | php | public function formatSize($value,$verbose=false)
{
$base=$this->sizeFormat['base'];
for($i=0; $base<=$value && $i<5; $i++)
$value=$value/$base;
$value=round($value, $this->sizeFormat['decimals']);
$formattedValue=isset($this->sizeFormat['decimalSeparator']) ? str_replace('.',$this->sizeFormat['decimalSepa... | [
"public",
"function",
"formatSize",
"(",
"$",
"value",
",",
"$",
"verbose",
"=",
"false",
")",
"{",
"$",
"base",
"=",
"$",
"this",
"->",
"sizeFormat",
"[",
"'base'",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"base",
"<=",
"$",
"value",
... | Formats the value in bytes as a size in human readable form.
@param integer $value value in bytes to be formatted
@param boolean $verbose if full names should be used (e.g. bytes, kilobytes, ...).
Defaults to false meaning that short names will be used (e.g. B, KB, ...).
@return string the formatted result
@see sizeFor... | [
"Formats",
"the",
"value",
"in",
"bytes",
"as",
"a",
"size",
"in",
"human",
"readable",
"form",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/utils/CFormatter.php#L318-L341 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.run | public function run($args)
{
list($action, $options, $args)=$this->resolveRequest($args);
$methodName='action'.$action;
if(!preg_match('/^\w+$/',$action) || !method_exists($this,$methodName))
$this->usageError("Unknown action: ".$action);
$method=new ReflectionMethod($this,$methodName);
$params=array();
... | php | public function run($args)
{
list($action, $options, $args)=$this->resolveRequest($args);
$methodName='action'.$action;
if(!preg_match('/^\w+$/',$action) || !method_exists($this,$methodName))
$this->usageError("Unknown action: ".$action);
$method=new ReflectionMethod($this,$methodName);
$params=array();
... | [
"public",
"function",
"run",
"(",
"$",
"args",
")",
"{",
"list",
"(",
"$",
"action",
",",
"$",
"options",
",",
"$",
"args",
")",
"=",
"$",
"this",
"->",
"resolveRequest",
"(",
"$",
"args",
")",
";",
"$",
"methodName",
"=",
"'action'",
".",
"$",
"... | Executes the command.
The default implementation will parse the input parameters and
dispatch the command request to an appropriate action with the corresponding
option values
@param array $args command line parameters for this command.
@return integer application exit code, which is returned by the invoked action. 0 i... | [
"Executes",
"the",
"command",
".",
"The",
"default",
"implementation",
"will",
"parse",
"the",
"input",
"parameters",
"and",
"dispatch",
"the",
"command",
"request",
"to",
"an",
"appropriate",
"action",
"with",
"the",
"corresponding",
"option",
"values"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L117-L176 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.beforeAction | protected function beforeAction($action,$params)
{
if($this->hasEventHandler('onBeforeAction'))
{
$event = new CConsoleCommandEvent($this,$params,$action);
$this->onBeforeAction($event);
return !$event->stopCommand;
}
else
{
return true;
}
} | php | protected function beforeAction($action,$params)
{
if($this->hasEventHandler('onBeforeAction'))
{
$event = new CConsoleCommandEvent($this,$params,$action);
$this->onBeforeAction($event);
return !$event->stopCommand;
}
else
{
return true;
}
} | [
"protected",
"function",
"beforeAction",
"(",
"$",
"action",
",",
"$",
"params",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasEventHandler",
"(",
"'onBeforeAction'",
")",
")",
"{",
"$",
"event",
"=",
"new",
"CConsoleCommandEvent",
"(",
"$",
"this",
",",
"... | This method is invoked right before an action is to be executed.
You may override this method to do last-minute preparation for the action.
@param string $action the action name
@param array $params the parameters to be passed to the action method.
@return boolean whether the action should be executed. | [
"This",
"method",
"is",
"invoked",
"right",
"before",
"an",
"action",
"is",
"to",
"be",
"executed",
".",
"You",
"may",
"override",
"this",
"method",
"to",
"do",
"last",
"-",
"minute",
"preparation",
"for",
"the",
"action",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L185-L197 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.afterAction | protected function afterAction($action,$params,$exitCode=0)
{
$event=new CConsoleCommandEvent($this,$params,$action,$exitCode);
if($this->hasEventHandler('onAfterAction'))
$this->onAfterAction($event);
return $event->exitCode;
} | php | protected function afterAction($action,$params,$exitCode=0)
{
$event=new CConsoleCommandEvent($this,$params,$action,$exitCode);
if($this->hasEventHandler('onAfterAction'))
$this->onAfterAction($event);
return $event->exitCode;
} | [
"protected",
"function",
"afterAction",
"(",
"$",
"action",
",",
"$",
"params",
",",
"$",
"exitCode",
"=",
"0",
")",
"{",
"$",
"event",
"=",
"new",
"CConsoleCommandEvent",
"(",
"$",
"this",
",",
"$",
"params",
",",
"$",
"action",
",",
"$",
"exitCode",
... | This method is invoked right after an action finishes execution.
You may override this method to do some postprocessing for the action.
@param string $action the action name
@param array $params the parameters to be passed to the action method.
@param integer $exitCode the application exit code returned by the action m... | [
"This",
"method",
"is",
"invoked",
"right",
"after",
"an",
"action",
"finishes",
"execution",
".",
"You",
"may",
"override",
"this",
"method",
"to",
"do",
"some",
"postprocessing",
"for",
"the",
"action",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L207-L213 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.resolveRequest | protected function resolveRequest($args)
{
$options=array(); // named parameters
$params=array(); // unnamed parameters
foreach($args as $arg)
{
if(preg_match('/^--(\w+)(=(.*))?$/',$arg,$matches)) // an option
{
$name=$matches[1];
$value=isset($matches[3]) ? $matches[3] : true;
if(isset($opt... | php | protected function resolveRequest($args)
{
$options=array(); // named parameters
$params=array(); // unnamed parameters
foreach($args as $arg)
{
if(preg_match('/^--(\w+)(=(.*))?$/',$arg,$matches)) // an option
{
$name=$matches[1];
$value=isset($matches[3]) ? $matches[3] : true;
if(isset($opt... | [
"protected",
"function",
"resolveRequest",
"(",
"$",
"args",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"// named parameters",
"$",
"params",
"=",
"array",
"(",
")",
";",
"// unnamed parameters",
"foreach",
"(",
"$",
"args",
"as",
"$",
"arg",
... | Parses the command line arguments and determines which action to perform.
@param array $args command line arguments
@return array the action name, named options (name=>value), and unnamed options
@since 1.1.5 | [
"Parses",
"the",
"command",
"line",
"arguments",
"and",
"determines",
"which",
"action",
"to",
"perform",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L221-L249 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.getHelp | public function getHelp()
{
$help='Usage: '.$this->getCommandRunner()->getScriptName().' '.$this->getName();
$options=$this->getOptionHelp();
if(empty($options))
return $help."\n";
if(count($options)===1)
return $help.' '.$options[0]."\n";
$help.=" <action>\nActions:\n";
foreach($options as $option)
... | php | public function getHelp()
{
$help='Usage: '.$this->getCommandRunner()->getScriptName().' '.$this->getName();
$options=$this->getOptionHelp();
if(empty($options))
return $help."\n";
if(count($options)===1)
return $help.' '.$options[0]."\n";
$help.=" <action>\nActions:\n";
foreach($options as $option)
... | [
"public",
"function",
"getHelp",
"(",
")",
"{",
"$",
"help",
"=",
"'Usage: '",
".",
"$",
"this",
"->",
"getCommandRunner",
"(",
")",
"->",
"getScriptName",
"(",
")",
".",
"' '",
".",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"options",
"=",
... | Provides the command description.
This method may be overridden to return the actual command description.
@return string the command description. Defaults to 'Usage: php entry-script.php command-name'. | [
"Provides",
"the",
"command",
"description",
".",
"This",
"method",
"may",
"be",
"overridden",
"to",
"return",
"the",
"actual",
"command",
"description",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L272-L284 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.getOptionHelp | public function getOptionHelp()
{
$options=array();
$class=new ReflectionClass(get_class($this));
foreach($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
{
$name=$method->getName();
if(!strncasecmp($name,'action',6) && strlen($name)>6)
{
$name=substr($name,6);
$name[0]=strtolower($... | php | public function getOptionHelp()
{
$options=array();
$class=new ReflectionClass(get_class($this));
foreach($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
{
$name=$method->getName();
if(!strncasecmp($name,'action',6) && strlen($name)>6)
{
$name=substr($name,6);
$name[0]=strtolower($... | [
"public",
"function",
"getOptionHelp",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
"class",
"=",
"new",
"ReflectionClass",
"(",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"foreach",
"(",
"$",
"class",
"->",
"getMethods",
"(",
... | Provides the command option help information.
The default implementation will return all available actions together with their
corresponding option information.
@return array the command option help information. Each array element describes
the help information for a single action.
@since 1.1.5 | [
"Provides",
"the",
"command",
"option",
"help",
"information",
".",
"The",
"default",
"implementation",
"will",
"return",
"all",
"available",
"actions",
"together",
"with",
"their",
"corresponding",
"option",
"information",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L294-L328 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.copyFiles | public function copyFiles($fileList,$overwriteAll=false)
{
foreach($fileList as $name=>$file)
{
$source=strtr($file['source'],'/\\',DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR);
$target=strtr($file['target'],'/\\',DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR);
$callback=isset($file['callback']) ? $file['callback']... | php | public function copyFiles($fileList,$overwriteAll=false)
{
foreach($fileList as $name=>$file)
{
$source=strtr($file['source'],'/\\',DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR);
$target=strtr($file['target'],'/\\',DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR);
$callback=isset($file['callback']) ? $file['callback']... | [
"public",
"function",
"copyFiles",
"(",
"$",
"fileList",
",",
"$",
"overwriteAll",
"=",
"false",
")",
"{",
"foreach",
"(",
"$",
"fileList",
"as",
"$",
"name",
"=>",
"$",
"file",
")",
"{",
"$",
"source",
"=",
"strtr",
"(",
"$",
"file",
"[",
"'source'"... | Copies a list of files from one place to another.
@param array $fileList the list of files to be copied (name=>spec).
The array keys are names displayed during the copy process, and array values are specifications
for files to be copied. Each array value must be an array of the following structure:
<ul>
<li>source: req... | [
"Copies",
"a",
"list",
"of",
"files",
"from",
"one",
"place",
"to",
"another",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L361-L417 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.ensureDirectory | public function ensureDirectory($directory)
{
if(!is_dir($directory))
{
$this->ensureDirectory(dirname($directory));
echo " mkdir ".strtr($directory,'\\','/')."\n";
mkdir($directory);
}
} | php | public function ensureDirectory($directory)
{
if(!is_dir($directory))
{
$this->ensureDirectory(dirname($directory));
echo " mkdir ".strtr($directory,'\\','/')."\n";
mkdir($directory);
}
} | [
"public",
"function",
"ensureDirectory",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"directory",
")",
")",
"{",
"$",
"this",
"->",
"ensureDirectory",
"(",
"dirname",
"(",
"$",
"directory",
")",
")",
";",
"echo",
"\" mkdir \... | Creates all parent directories if they do not exist.
@param string $directory the directory to be checked | [
"Creates",
"all",
"parent",
"directories",
"if",
"they",
"do",
"not",
"exist",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L457-L465 | train |
yiisoft/yii | framework/console/CConsoleCommand.php | CConsoleCommand.pluralize | public function pluralize($name)
{
$rules=array(
'/(m)ove$/i' => '\1oves',
'/(f)oot$/i' => '\1eet',
'/(c)hild$/i' => '\1hildren',
'/(h)uman$/i' => '\1umans',
'/(m)an$/i' => '\1en',
'/(s)taff$/i' => '\1taff',
'/(t)ooth$/i' => '\1eeth',
'/(p)erson$/i' => '\1eople',
'/([m|l])ouse$/i' => '\1ic... | php | public function pluralize($name)
{
$rules=array(
'/(m)ove$/i' => '\1oves',
'/(f)oot$/i' => '\1eet',
'/(c)hild$/i' => '\1hildren',
'/(h)uman$/i' => '\1umans',
'/(m)an$/i' => '\1en',
'/(s)taff$/i' => '\1taff',
'/(t)ooth$/i' => '\1eeth',
'/(p)erson$/i' => '\1eople',
'/([m|l])ouse$/i' => '\1ic... | [
"public",
"function",
"pluralize",
"(",
"$",
"name",
")",
"{",
"$",
"rules",
"=",
"array",
"(",
"'/(m)ove$/i'",
"=>",
"'\\1oves'",
",",
"'/(f)oot$/i'",
"=>",
"'\\1eet'",
",",
"'/(c)hild$/i'",
"=>",
"'\\1hildren'",
",",
"'/(h)uman$/i'",
"=>",
"'\\1umans'",
",",... | Converts a word to its plural form.
@param string $name the word to be pluralized
@return string the pluralized word | [
"Converts",
"a",
"word",
"to",
"its",
"plural",
"form",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/console/CConsoleCommand.php#L496-L524 | train |
yiisoft/yii | framework/db/schema/pgsql/CPgsqlSchema.php | CPgsqlSchema.findPrimaryKey | protected function findPrimaryKey($table,$indices)
{
$indices=implode(', ',preg_split('/\s+/',$indices));
$sql=<<<EOD
SELECT attnum, attname FROM pg_catalog.pg_attribute WHERE
attrelid=(
SELECT oid FROM pg_catalog.pg_class WHERE relname=:table AND relnamespace=(
SELECT oid FROM pg_catalog.pg_namespace WHERE ... | php | protected function findPrimaryKey($table,$indices)
{
$indices=implode(', ',preg_split('/\s+/',$indices));
$sql=<<<EOD
SELECT attnum, attname FROM pg_catalog.pg_attribute WHERE
attrelid=(
SELECT oid FROM pg_catalog.pg_class WHERE relname=:table AND relnamespace=(
SELECT oid FROM pg_catalog.pg_namespace WHERE ... | [
"protected",
"function",
"findPrimaryKey",
"(",
"$",
"table",
",",
"$",
"indices",
")",
"{",
"$",
"indices",
"=",
"implode",
"(",
"', '",
",",
"preg_split",
"(",
"'/\\s+/'",
",",
"$",
"indices",
")",
")",
";",
"$",
"sql",
"=",
"<<<EOD\nSELECT attnum, attna... | Collects primary key information.
@param CPgsqlTableSchema $table the table metadata
@param string $indices pgsql primary key index list | [
"Collects",
"primary",
"key",
"information",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/pgsql/CPgsqlSchema.php#L286-L315 | train |
yiisoft/yii | framework/db/schema/pgsql/CPgsqlSchema.php | CPgsqlSchema.findForeignKey | protected function findForeignKey($table,$src)
{
$matches=array();
$brackets='\(([^\)]+)\)';
$pattern="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
if(preg_match($pattern,str_replace('"','',$src),$matches))
{
$keys=preg_split('/,\s+/', $matches[1]);
$tableName=$matches[2];
$fk... | php | protected function findForeignKey($table,$src)
{
$matches=array();
$brackets='\(([^\)]+)\)';
$pattern="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
if(preg_match($pattern,str_replace('"','',$src),$matches))
{
$keys=preg_split('/,\s+/', $matches[1]);
$tableName=$matches[2];
$fk... | [
"protected",
"function",
"findForeignKey",
"(",
"$",
"table",
",",
"$",
"src",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"$",
"brackets",
"=",
"'\\(([^\\)]+)\\)'",
";",
"$",
"pattern",
"=",
"\"/FOREIGN\\s+KEY\\s+{$brackets}\\s+REFERENCES\\s+([^\\(]+){... | Collects foreign key information.
@param CPgsqlTableSchema $table the table metadata
@param string $src pgsql foreign key definition | [
"Collects",
"foreign",
"key",
"information",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/pgsql/CPgsqlSchema.php#L322-L339 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlCommandBuilder.php | CMssqlCommandBuilder.createFindCommand | public function createFindCommand($table,$criteria,$alias='t')
{
$criteria=$this->checkCriteria($table,$criteria);
return parent::createFindCommand($table,$criteria,$alias);
} | php | public function createFindCommand($table,$criteria,$alias='t')
{
$criteria=$this->checkCriteria($table,$criteria);
return parent::createFindCommand($table,$criteria,$alias);
} | [
"public",
"function",
"createFindCommand",
"(",
"$",
"table",
",",
"$",
"criteria",
",",
"$",
"alias",
"=",
"'t'",
")",
"{",
"$",
"criteria",
"=",
"$",
"this",
"->",
"checkCriteria",
"(",
"$",
"table",
",",
"$",
"criteria",
")",
";",
"return",
"parent"... | Creates a SELECT command for a single table.
Override parent implementation to check if an orderby clause if specified when querying with an offset
@param CDbTableSchema $table the table metadata
@param CDbCriteria $criteria the query criteria
@param string $alias the alias name of the primary table. Defaults to 't'.
@... | [
"Creates",
"a",
"SELECT",
"command",
"for",
"a",
"single",
"table",
".",
"Override",
"parent",
"implementation",
"to",
"check",
"if",
"an",
"orderby",
"clause",
"if",
"specified",
"when",
"querying",
"with",
"an",
"offset"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlCommandBuilder.php#L45-L50 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlCommandBuilder.php | CMssqlCommandBuilder.createUpdateCommand | public function createUpdateCommand($table,$data,$criteria)
{
$criteria=$this->checkCriteria($table,$criteria);
$fields=array();
$values=array();
$bindByPosition=isset($criteria->params[0]);
$i=0;
foreach($data as $name=>$value)
{
if(($column=$table->getColumn($name))!==null)
{
if ($table->sequ... | php | public function createUpdateCommand($table,$data,$criteria)
{
$criteria=$this->checkCriteria($table,$criteria);
$fields=array();
$values=array();
$bindByPosition=isset($criteria->params[0]);
$i=0;
foreach($data as $name=>$value)
{
if(($column=$table->getColumn($name))!==null)
{
if ($table->sequ... | [
"public",
"function",
"createUpdateCommand",
"(",
"$",
"table",
",",
"$",
"data",
",",
"$",
"criteria",
")",
"{",
"$",
"criteria",
"=",
"$",
"this",
"->",
"checkCriteria",
"(",
"$",
"table",
",",
"$",
"criteria",
")",
";",
"$",
"fields",
"=",
"array",
... | Creates an UPDATE command.
Override parent implementation because mssql don't want to update an identity column
@param CDbTableSchema $table the table metadata
@param array $data list of columns to be updated (name=>value)
@param CDbCriteria $criteria the query criteria
@throws CDbException if no columns are being upda... | [
"Creates",
"an",
"UPDATE",
"command",
".",
"Override",
"parent",
"implementation",
"because",
"mssql",
"don",
"t",
"want",
"to",
"update",
"an",
"identity",
"column"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlCommandBuilder.php#L61-L106 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlCommandBuilder.php | CMssqlCommandBuilder.createDeleteCommand | public function createDeleteCommand($table,$criteria)
{
$criteria=$this->checkCriteria($table, $criteria);
return parent::createDeleteCommand($table, $criteria);
} | php | public function createDeleteCommand($table,$criteria)
{
$criteria=$this->checkCriteria($table, $criteria);
return parent::createDeleteCommand($table, $criteria);
} | [
"public",
"function",
"createDeleteCommand",
"(",
"$",
"table",
",",
"$",
"criteria",
")",
"{",
"$",
"criteria",
"=",
"$",
"this",
"->",
"checkCriteria",
"(",
"$",
"table",
",",
"$",
"criteria",
")",
";",
"return",
"parent",
"::",
"createDeleteCommand",
"(... | Creates a DELETE command.
Override parent implementation to check if an orderby clause if specified when querying with an offset
@param CDbTableSchema $table the table metadata
@param CDbCriteria $criteria the query criteria
@return CDbCommand delete command. | [
"Creates",
"a",
"DELETE",
"command",
".",
"Override",
"parent",
"implementation",
"to",
"check",
"if",
"an",
"orderby",
"clause",
"if",
"specified",
"when",
"querying",
"with",
"an",
"offset"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlCommandBuilder.php#L115-L119 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlCommandBuilder.php | CMssqlCommandBuilder.applyJoin | public function applyJoin($sql,$join)
{
if(trim($join)!=='')
$sql=preg_replace('/^\s*DELETE\s+FROM\s+((\[.+\])|([^\s]+))\s*/i',"DELETE \\1 FROM \\1",$sql);
return parent::applyJoin($sql,$join);
} | php | public function applyJoin($sql,$join)
{
if(trim($join)!=='')
$sql=preg_replace('/^\s*DELETE\s+FROM\s+((\[.+\])|([^\s]+))\s*/i',"DELETE \\1 FROM \\1",$sql);
return parent::applyJoin($sql,$join);
} | [
"public",
"function",
"applyJoin",
"(",
"$",
"sql",
",",
"$",
"join",
")",
"{",
"if",
"(",
"trim",
"(",
"$",
"join",
")",
"!==",
"''",
")",
"$",
"sql",
"=",
"preg_replace",
"(",
"'/^\\s*DELETE\\s+FROM\\s+((\\[.+\\])|([^\\s]+))\\s*/i'",
",",
"\"DELETE \\\\1 FRO... | Alters the SQL to apply JOIN clause.
Overrides parent implementation to comply with the DELETE command syntax required when multiple tables are referenced.
@param string $sql the SQL statement to be altered
@param string $join the JOIN clause (starting with join type, such as INNER JOIN)
@return string the altered SQL ... | [
"Alters",
"the",
"SQL",
"to",
"apply",
"JOIN",
"clause",
".",
"Overrides",
"parent",
"implementation",
"to",
"comply",
"with",
"the",
"DELETE",
"command",
"syntax",
"required",
"when",
"multiple",
"tables",
"are",
"referenced",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlCommandBuilder.php#L143-L148 | train |
yiisoft/yii | framework/db/schema/mssql/CMssqlCommandBuilder.php | CMssqlCommandBuilder.applyLimit | public function applyLimit($sql, $limit, $offset)
{
$limit = $limit!==null ? (int)$limit : -1;
$offset = $offset!==null ? (int)$offset : -1;
if ($limit > 0 && $offset <= 0) //just limit
$sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i',"\\1SELECT\\2 TOP $limit", $sql);
elseif($limit > 0 &&... | php | public function applyLimit($sql, $limit, $offset)
{
$limit = $limit!==null ? (int)$limit : -1;
$offset = $offset!==null ? (int)$offset : -1;
if ($limit > 0 && $offset <= 0) //just limit
$sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i',"\\1SELECT\\2 TOP $limit", $sql);
elseif($limit > 0 &&... | [
"public",
"function",
"applyLimit",
"(",
"$",
"sql",
",",
"$",
"limit",
",",
"$",
"offset",
")",
"{",
"$",
"limit",
"=",
"$",
"limit",
"!==",
"null",
"?",
"(",
"int",
")",
"$",
"limit",
":",
"-",
"1",
";",
"$",
"offset",
"=",
"$",
"offset",
"!=... | This is a port from Prado Framework.
Overrides parent implementation. Alters the sql to apply $limit and $offset.
The idea for limit with offset is done by modifying the sql on the fly
with numerous assumptions on the structure of the sql string.
The modification is done with reference to the notes from
http://troels.... | [
"This",
"is",
"a",
"port",
"from",
"Prado",
"Framework",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/schema/mssql/CMssqlCommandBuilder.php#L194-L203 | train |
yiisoft/yii | framework/logging/CSysLogRoute.php | CSysLogRoute.processLogs | protected function processLogs($logs)
{
static $syslogLevels=array(
CLogger::LEVEL_TRACE=>LOG_DEBUG,
CLogger::LEVEL_WARNING=>LOG_WARNING,
CLogger::LEVEL_ERROR=>LOG_ERR,
CLogger::LEVEL_INFO=>LOG_INFO,
CLogger::LEVEL_PROFILE=>LOG_DEBUG,
);
openlog($this->identity,LOG_ODELAY|LOG_PID,$this->facility)... | php | protected function processLogs($logs)
{
static $syslogLevels=array(
CLogger::LEVEL_TRACE=>LOG_DEBUG,
CLogger::LEVEL_WARNING=>LOG_WARNING,
CLogger::LEVEL_ERROR=>LOG_ERR,
CLogger::LEVEL_INFO=>LOG_INFO,
CLogger::LEVEL_PROFILE=>LOG_DEBUG,
);
openlog($this->identity,LOG_ODELAY|LOG_PID,$this->facility)... | [
"protected",
"function",
"processLogs",
"(",
"$",
"logs",
")",
"{",
"static",
"$",
"syslogLevels",
"=",
"array",
"(",
"CLogger",
"::",
"LEVEL_TRACE",
"=>",
"LOG_DEBUG",
",",
"CLogger",
"::",
"LEVEL_WARNING",
"=>",
"LOG_WARNING",
",",
"CLogger",
"::",
"LEVEL_ER... | Sends log messages to syslog.
@param array $logs list of log messages. | [
"Sends",
"log",
"messages",
"to",
"syslog",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/logging/CSysLogRoute.php#L35-L49 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CActiveFinder.query | public function query($criteria,$all=false)
{
$this->joinAll=$criteria->together===true;
if($criteria->alias!='')
{
$this->_joinTree->tableAlias=$criteria->alias;
$this->_joinTree->rawTableAlias=$this->_builder->getSchema()->quoteTableName($criteria->alias);
}
$this->_joinTree->find($criteria);
$th... | php | public function query($criteria,$all=false)
{
$this->joinAll=$criteria->together===true;
if($criteria->alias!='')
{
$this->_joinTree->tableAlias=$criteria->alias;
$this->_joinTree->rawTableAlias=$this->_builder->getSchema()->quoteTableName($criteria->alias);
}
$this->_joinTree->find($criteria);
$th... | [
"public",
"function",
"query",
"(",
"$",
"criteria",
",",
"$",
"all",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"joinAll",
"=",
"$",
"criteria",
"->",
"together",
"===",
"true",
";",
"if",
"(",
"$",
"criteria",
"->",
"alias",
"!=",
"''",
")",
"{",... | Do not call this method. This method is used internally to perform the relational query
based on the given DB criteria.
@param CDbCriteria $criteria the DB criteria
@param boolean $all whether to bring back all records
@return mixed the query result | [
"Do",
"not",
"call",
"this",
"method",
".",
"This",
"method",
"is",
"used",
"internally",
"to",
"perform",
"the",
"relational",
"query",
"based",
"on",
"the",
"given",
"DB",
"criteria",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L58-L90 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.destroy | public function destroy()
{
if(!empty($this->children))
{
foreach($this->children as $child)
$child->destroy();
}
unset($this->_finder, $this->_parent, $this->model, $this->relation, $this->master, $this->slave, $this->records, $this->children, $this->stats);
} | php | public function destroy()
{
if(!empty($this->children))
{
foreach($this->children as $child)
$child->destroy();
}
unset($this->_finder, $this->_parent, $this->model, $this->relation, $this->master, $this->slave, $this->records, $this->children, $this->stats);
} | [
"public",
"function",
"destroy",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"children",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"$",
"child",
"->",
"destroy",
"(",
")",
";",
"}",... | Removes references to child elements and finder to avoid circular references.
This is internally used. | [
"Removes",
"references",
"to",
"child",
"elements",
"and",
"finder",
"to",
"avoid",
"circular",
"references",
".",
"This",
"is",
"internally",
"used",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L419-L427 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.find | public function find($criteria=null)
{
if($this->_parent===null) // root element
{
$query=new CJoinQuery($this,$criteria);
$this->_finder->baseLimited=($criteria->offset>=0 || $criteria->limit>=0);
$this->buildQuery($query);
$this->_finder->baseLimited=false;
$this->runQuery($query);
}
elseif(!$... | php | public function find($criteria=null)
{
if($this->_parent===null) // root element
{
$query=new CJoinQuery($this,$criteria);
$this->_finder->baseLimited=($criteria->offset>=0 || $criteria->limit>=0);
$this->buildQuery($query);
$this->_finder->baseLimited=false;
$this->runQuery($query);
}
elseif(!$... | [
"public",
"function",
"find",
"(",
"$",
"criteria",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_parent",
"===",
"null",
")",
"// root element",
"{",
"$",
"query",
"=",
"new",
"CJoinQuery",
"(",
"$",
"this",
",",
"$",
"criteria",
")",
";",
... | Performs the recursive finding with the criteria.
@param CDbCriteria $criteria the query criteria | [
"Performs",
"the",
"recursive",
"finding",
"with",
"the",
"criteria",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L433-L457 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.lazyFind | public function lazyFind($baseRecord)
{
if(is_string($this->_table->primaryKey))
$this->records[$baseRecord->{$this->_table->primaryKey}]=$baseRecord;
else
{
$pk=array();
foreach($this->_table->primaryKey as $name)
$pk[$name]=$baseRecord->$name;
$this->records[serialize($pk)]=$baseRecord;
}
... | php | public function lazyFind($baseRecord)
{
if(is_string($this->_table->primaryKey))
$this->records[$baseRecord->{$this->_table->primaryKey}]=$baseRecord;
else
{
$pk=array();
foreach($this->_table->primaryKey as $name)
$pk[$name]=$baseRecord->$name;
$this->records[serialize($pk)]=$baseRecord;
}
... | [
"public",
"function",
"lazyFind",
"(",
"$",
"baseRecord",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"_table",
"->",
"primaryKey",
")",
")",
"$",
"this",
"->",
"records",
"[",
"$",
"baseRecord",
"->",
"{",
"$",
"this",
"->",
"_table",
... | Performs lazy find with the specified base record.
@param CActiveRecord $baseRecord the active record whose related object is to be fetched. | [
"Performs",
"lazy",
"find",
"with",
"the",
"specified",
"base",
"record",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L463-L529 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.findWithBase | public function findWithBase($baseRecords)
{
if(!is_array($baseRecords))
$baseRecords=array($baseRecords);
if(is_string($this->_table->primaryKey))
{
foreach($baseRecords as $baseRecord)
$this->records[$baseRecord->{$this->_table->primaryKey}]=$baseRecord;
}
else
{
foreach($baseRecords as $bas... | php | public function findWithBase($baseRecords)
{
if(!is_array($baseRecords))
$baseRecords=array($baseRecords);
if(is_string($this->_table->primaryKey))
{
foreach($baseRecords as $baseRecord)
$this->records[$baseRecord->{$this->_table->primaryKey}]=$baseRecord;
}
else
{
foreach($baseRecords as $bas... | [
"public",
"function",
"findWithBase",
"(",
"$",
"baseRecords",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"baseRecords",
")",
")",
"$",
"baseRecords",
"=",
"array",
"(",
"$",
"baseRecords",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",... | Performs the eager loading with the base records ready.
@param mixed $baseRecords the available base record(s). | [
"Performs",
"the",
"eager",
"loading",
"with",
"the",
"base",
"records",
"ready",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L693-L722 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.count | public function count($criteria=null)
{
$query=new CJoinQuery($this,$criteria);
// ensure only one big join statement is used
$this->_finder->baseLimited=false;
$this->_finder->joinAll=true;
$this->buildQuery($query);
$query->limit=$query->offset=-1;
if(!empty($criteria->group) || !empty($criteria->hav... | php | public function count($criteria=null)
{
$query=new CJoinQuery($this,$criteria);
// ensure only one big join statement is used
$this->_finder->baseLimited=false;
$this->_finder->joinAll=true;
$this->buildQuery($query);
$query->limit=$query->offset=-1;
if(!empty($criteria->group) || !empty($criteria->hav... | [
"public",
"function",
"count",
"(",
"$",
"criteria",
"=",
"null",
")",
"{",
"$",
"query",
"=",
"new",
"CJoinQuery",
"(",
"$",
"this",
",",
"$",
"criteria",
")",
";",
"// ensure only one big join statement is used",
"$",
"this",
"->",
"_finder",
"->",
"baseLi... | Count the number of primary records returned by the join statement.
@param CDbCriteria $criteria the query criteria
@return string number of primary records. Note: type is string to keep max. precision. | [
"Count",
"the",
"number",
"of",
"primary",
"records",
"returned",
"by",
"the",
"join",
"statement",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L729-L768 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.buildQuery | public function buildQuery($query)
{
foreach($this->children as $child)
{
if($child->master!==null)
$child->_joined=true;
elseif($child->relation instanceof CHasOneRelation || $child->relation instanceof CBelongsToRelation
|| $this->_finder->joinAll || $child->relation->together || (!$this->_finder->... | php | public function buildQuery($query)
{
foreach($this->children as $child)
{
if($child->master!==null)
$child->_joined=true;
elseif($child->relation instanceof CHasOneRelation || $child->relation instanceof CBelongsToRelation
|| $this->_finder->joinAll || $child->relation->together || (!$this->_finder->... | [
"public",
"function",
"buildQuery",
"(",
"$",
"query",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"children",
"as",
"$",
"child",
")",
"{",
"if",
"(",
"$",
"child",
"->",
"master",
"!==",
"null",
")",
"$",
"child",
"->",
"_joined",
"=",
"true",
"... | Builds the join query with all descendant HAS_ONE and BELONGS_TO nodes.
@param CJoinQuery $query the query being built up | [
"Builds",
"the",
"join",
"query",
"with",
"all",
"descendant",
"HAS_ONE",
"and",
"BELONGS_TO",
"nodes",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L787-L801 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.runQuery | public function runQuery($query)
{
$command=$query->createCommand($this->_builder);
foreach($command->queryAll() as $row)
$this->populateRecord($query,$row);
} | php | public function runQuery($query)
{
$command=$query->createCommand($this->_builder);
foreach($command->queryAll() as $row)
$this->populateRecord($query,$row);
} | [
"public",
"function",
"runQuery",
"(",
"$",
"query",
")",
"{",
"$",
"command",
"=",
"$",
"query",
"->",
"createCommand",
"(",
"$",
"this",
"->",
"_builder",
")",
";",
"foreach",
"(",
"$",
"command",
"->",
"queryAll",
"(",
")",
"as",
"$",
"row",
")",
... | Executes the join query and populates the query results.
@param CJoinQuery $query the query to be executed. | [
"Executes",
"the",
"join",
"query",
"and",
"populates",
"the",
"query",
"results",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L807-L812 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.populateRecord | private function populateRecord($query,$row)
{
// determine the primary key value
if(is_string($this->_pkAlias)) // single key
{
if(isset($row[$this->_pkAlias]))
$pk=$row[$this->_pkAlias];
else // no matching related objects
return null;
}
else // is_array, composite key
{
$pk=array();
... | php | private function populateRecord($query,$row)
{
// determine the primary key value
if(is_string($this->_pkAlias)) // single key
{
if(isset($row[$this->_pkAlias]))
$pk=$row[$this->_pkAlias];
else // no matching related objects
return null;
}
else // is_array, composite key
{
$pk=array();
... | [
"private",
"function",
"populateRecord",
"(",
"$",
"query",
",",
"$",
"row",
")",
"{",
"// determine the primary key value",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"_pkAlias",
")",
")",
"// single key",
"{",
"if",
"(",
"isset",
"(",
"$",
"row",
"[... | Populates the active records with the query data.
@param CJoinQuery $query the query executed
@param array $row a row of data
@return CActiveRecord the populated record | [
"Populates",
"the",
"active",
"records",
"with",
"the",
"query",
"data",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L820-L892 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinElement.joinOneMany | private function joinOneMany($fke,$fks,$pke,$parent)
{
$schema=$this->_builder->getSchema();
$joins=array();
if(is_string($fks))
$fks=preg_split('/\s*,\s*/',$fks,-1,PREG_SPLIT_NO_EMPTY);
foreach($fks as $i=>$fk)
{
if(!is_int($i))
{
$pk=$fk;
$fk=$i;
}
if(!isset($fke->_table->columns[$f... | php | private function joinOneMany($fke,$fks,$pke,$parent)
{
$schema=$this->_builder->getSchema();
$joins=array();
if(is_string($fks))
$fks=preg_split('/\s*,\s*/',$fks,-1,PREG_SPLIT_NO_EMPTY);
foreach($fks as $i=>$fk)
{
if(!is_int($i))
{
$pk=$fk;
$fk=$i;
}
if(!isset($fke->_table->columns[$f... | [
"private",
"function",
"joinOneMany",
"(",
"$",
"fke",
",",
"$",
"fks",
",",
"$",
"pke",
",",
"$",
"parent",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"_builder",
"->",
"getSchema",
"(",
")",
";",
"$",
"joins",
"=",
"array",
"(",
")",
";",... | Generates the join statement for one-many relationship.
This works for HAS_ONE, HAS_MANY and BELONGS_TO.
@param CJoinElement $fke the join element containing foreign keys
@param array $fks the foreign keys
@param CJoinElement $pke the join element contains primary keys
@param CJoinElement $parent the parent join elemen... | [
"Generates",
"the",
"join",
"statement",
"for",
"one",
"-",
"many",
"relationship",
".",
"This",
"works",
"for",
"HAS_ONE",
"HAS_MANY",
"and",
"BELONGS_TO",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L1088-L1129 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinQuery.join | public function join($element)
{
if($element->slave!==null)
$this->join($element->slave);
if(!empty($element->relation->select))
$this->selects[]=$element->getColumnSelect($element->relation->select);
$this->conditions[]=$element->relation->condition;
$this->orders[]=$element->relation->order;
$this->j... | php | public function join($element)
{
if($element->slave!==null)
$this->join($element->slave);
if(!empty($element->relation->select))
$this->selects[]=$element->getColumnSelect($element->relation->select);
$this->conditions[]=$element->relation->condition;
$this->orders[]=$element->relation->order;
$this->j... | [
"public",
"function",
"join",
"(",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"->",
"slave",
"!==",
"null",
")",
"$",
"this",
"->",
"join",
"(",
"$",
"element",
"->",
"slave",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"element",
"->"... | Joins with another join element
@param CJoinElement $element the element to be joined | [
"Joins",
"with",
"another",
"join",
"element"
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L1312-L1333 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CJoinQuery.createCommand | public function createCommand($builder)
{
$sql=($this->distinct ? 'SELECT DISTINCT ':'SELECT ') . implode(', ',$this->selects);
$sql.=' FROM ' . implode(' ',array_unique($this->joins));
$conditions=array();
foreach($this->conditions as $condition)
if($condition!=='')
$conditions[]=$condition;
if($con... | php | public function createCommand($builder)
{
$sql=($this->distinct ? 'SELECT DISTINCT ':'SELECT ') . implode(', ',$this->selects);
$sql.=' FROM ' . implode(' ',array_unique($this->joins));
$conditions=array();
foreach($this->conditions as $condition)
if($condition!=='')
$conditions[]=$condition;
if($con... | [
"public",
"function",
"createCommand",
"(",
"$",
"builder",
")",
"{",
"$",
"sql",
"=",
"(",
"$",
"this",
"->",
"distinct",
"?",
"'SELECT DISTINCT '",
":",
"'SELECT '",
")",
".",
"implode",
"(",
"', '",
",",
"$",
"this",
"->",
"selects",
")",
";",
"$",
... | Creates the SQL statement.
@param CDbCommandBuilder $builder the command builder
@return CDbCommand DB command instance representing the SQL statement | [
"Creates",
"the",
"SQL",
"statement",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L1340-L1377 | train |
yiisoft/yii | framework/db/ar/CActiveFinder.php | CStatElement.query | public function query()
{
if(preg_match('/^\s*(.*?)\((.*)\)\s*$/',$this->relation->foreignKey,$matches))
$this->queryManyMany($matches[1],$matches[2]);
else
$this->queryOneMany();
} | php | public function query()
{
if(preg_match('/^\s*(.*?)\((.*)\)\s*$/',$this->relation->foreignKey,$matches))
$this->queryManyMany($matches[1],$matches[2]);
else
$this->queryOneMany();
} | [
"public",
"function",
"query",
"(",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^\\s*(.*?)\\((.*)\\)\\s*$/'",
",",
"$",
"this",
"->",
"relation",
"->",
"foreignKey",
",",
"$",
"matches",
")",
")",
"$",
"this",
"->",
"queryManyMany",
"(",
"$",
"matches",
"["... | Performs the STAT query. | [
"Performs",
"the",
"STAT",
"query",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/db/ar/CActiveFinder.php#L1414-L1420 | train |
yiisoft/yii | framework/web/widgets/CTabView.php | CTabView.renderHeader | protected function renderHeader()
{
echo "<ul class=\"tabs\">\n";
foreach($this->tabs as $id=>$tab)
{
$title=isset($tab['title'])?$tab['title']:'undefined';
$active=$id===$this->activeTab?' class="active"' : '';
$url=isset($tab['url'])?$tab['url']:"#{$id}";
echo "<li><a href=\"{$url}\"{$active}>{$tit... | php | protected function renderHeader()
{
echo "<ul class=\"tabs\">\n";
foreach($this->tabs as $id=>$tab)
{
$title=isset($tab['title'])?$tab['title']:'undefined';
$active=$id===$this->activeTab?' class="active"' : '';
$url=isset($tab['url'])?$tab['url']:"#{$id}";
echo "<li><a href=\"{$url}\"{$active}>{$tit... | [
"protected",
"function",
"renderHeader",
"(",
")",
"{",
"echo",
"\"<ul class=\\\"tabs\\\">\\n\"",
";",
"foreach",
"(",
"$",
"this",
"->",
"tabs",
"as",
"$",
"id",
"=>",
"$",
"tab",
")",
"{",
"$",
"title",
"=",
"isset",
"(",
"$",
"tab",
"[",
"'title'",
... | Renders the header part. | [
"Renders",
"the",
"header",
"part",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CTabView.php#L182-L193 | train |
yiisoft/yii | framework/web/widgets/CTabView.php | CTabView.renderBody | protected function renderBody()
{
foreach($this->tabs as $id=>$tab)
{
$inactive=$id!==$this->activeTab?' style="display:none"' : '';
echo "<div class=\"view\" id=\"{$id}\"{$inactive}>\n";
if(isset($tab['content']))
echo $tab['content'];
elseif(isset($tab['view']))
{
if(isset($tab['data']))
... | php | protected function renderBody()
{
foreach($this->tabs as $id=>$tab)
{
$inactive=$id!==$this->activeTab?' style="display:none"' : '';
echo "<div class=\"view\" id=\"{$id}\"{$inactive}>\n";
if(isset($tab['content']))
echo $tab['content'];
elseif(isset($tab['view']))
{
if(isset($tab['data']))
... | [
"protected",
"function",
"renderBody",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"tabs",
"as",
"$",
"id",
"=>",
"$",
"tab",
")",
"{",
"$",
"inactive",
"=",
"$",
"id",
"!==",
"$",
"this",
"->",
"activeTab",
"?",
"' style=\"display:none\"'",
":",... | Renders the body part. | [
"Renders",
"the",
"body",
"part",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CTabView.php#L198-L221 | train |
yiisoft/yii | framework/web/widgets/CTreeView.php | CTreeView.init | public function init()
{
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
$id=$this->htmlOptions['id']=$this->getId();
if($this->url!==null)
$this->url=CHtml::normalizeUrl($this->url);
$cs=Yii::app()->getClientScript();
$cs->registerCoreScript('treeview');
$options=$this->get... | php | public function init()
{
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
$id=$this->htmlOptions['id']=$this->getId();
if($this->url!==null)
$this->url=CHtml::normalizeUrl($this->url);
$cs=Yii::app()->getClientScript();
$cs->registerCoreScript('treeview');
$options=$this->get... | [
"public",
"function",
"init",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"htmlOptions",
"[",
"'id'",
"]",
")",
")",
"$",
"id",
"=",
"$",
"this",
"->",
"htmlOptions",
"[",
"'id'",
"]",
";",
"else",
"$",
"id",
"=",
"$",
"this",
"-... | Initializes the widget.
This method registers all needed client scripts and renders
the tree view content. | [
"Initializes",
"the",
"widget",
".",
"This",
"method",
"registers",
"all",
"needed",
"client",
"scripts",
"and",
"renders",
"the",
"tree",
"view",
"content",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CTreeView.php#L134-L154 | train |
yiisoft/yii | framework/web/widgets/CTreeView.php | CTreeView.saveDataAsHtml | public static function saveDataAsHtml($data)
{
$html='';
if(is_array($data))
{
foreach($data as $node)
{
if(!isset($node['text']))
continue;
if(isset($node['expanded']))
$css=$node['expanded'] ? 'open' : 'closed';
else
$css='';
if(isset($node['hasChildren']) && $node['hasCh... | php | public static function saveDataAsHtml($data)
{
$html='';
if(is_array($data))
{
foreach($data as $node)
{
if(!isset($node['text']))
continue;
if(isset($node['expanded']))
$css=$node['expanded'] ? 'open' : 'closed';
else
$css='';
if(isset($node['hasChildren']) && $node['hasCh... | [
"public",
"static",
"function",
"saveDataAsHtml",
"(",
"$",
"data",
")",
"{",
"$",
"html",
"=",
"''",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"isset",
... | Generates tree view nodes in HTML from the data array.
@param array $data the data for the tree view (see {@link data} for possible data structure).
@return string the generated HTML for the tree view | [
"Generates",
"tree",
"view",
"nodes",
"in",
"HTML",
"from",
"the",
"data",
"array",
"."
] | af3cbce71db83c4476c8a4289517b2984c740f31 | https://github.com/yiisoft/yii/blob/af3cbce71db83c4476c8a4289517b2984c740f31/framework/web/widgets/CTreeView.php#L183-L228 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.