_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q19300 | CJoinElement.lazyFind | train | 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 | {
"resource": ""
} |
q19301 | CJoinElement.findWithBase | train | 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 | {
"resource": ""
} |
q19302 | CJoinElement.count | train | 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 | {
"resource": ""
} |
q19303 | CJoinElement.buildQuery | train | 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 | php | {
"resource": ""
} |
q19304 | CJoinElement.runQuery | train | public function runQuery($query)
{
$command=$query->createCommand($this->_builder); | php | {
"resource": ""
} |
q19305 | CJoinElement.populateRecord | train | 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 | {
"resource": ""
} |
q19306 | CJoinElement.joinOneMany | train | 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 | {
"resource": ""
} |
q19307 | CJoinQuery.join | train | 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;
| php | {
"resource": ""
} |
q19308 | CJoinQuery.createCommand | train | 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 | {
"resource": ""
} |
q19309 | CStatElement.query | train | public function query()
{
if(preg_match('/^\s*(.*?)\((.*)\)\s*$/',$this->relation->foreignKey,$matches)) | php | {
"resource": ""
} |
q19310 | CTabView.renderHeader | train | 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"' : '';
| php | {
"resource": ""
} |
q19311 | CTabView.renderBody | train | 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 | {
"resource": ""
} |
q19312 | CTreeView.init | train | 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 | {
"resource": ""
} |
q19313 | CTreeView.saveDataAsHtml | train | 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 | {
"resource": ""
} |
q19314 | CLinkColumn.getDataCellContent | train | public function getDataCellContent($row)
{
$data=$this->grid->dataProvider->data[$row];
if($this->urlExpression!==null)
$url=$this->evaluateExpression($this->urlExpression,array('data'=>$data,'row'=>$row));
else
$url=$this->url;
| php | {
"resource": ""
} |
q19315 | CBaseListView.renderKeys | train | public function renderKeys()
{
echo CHtml::openTag('div',array(
'class'=>'keys',
'style'=>'display:none',
| php | {
"resource": ""
} |
q19316 | CBaseListView.renderSummary | train | public function renderSummary()
{
if(($count=$this->dataProvider->getItemCount())<=0)
return;
echo CHtml::openTag($this->summaryTagName, array('class'=>$this->summaryCssClass));
if($this->enablePagination)
{
$pagination=$this->dataProvider->getPagination();
$total=$this->dataProvider->getTotalItemCou... | php | {
"resource": ""
} |
q19317 | CHtmlPurifier.purify | train | public function purify($content)
{
if(is_array($content))
$content=array_map(array($this,'purify'),$content);
else
| php | {
"resource": ""
} |
q19318 | CHtmlPurifier.createNewHtmlPurifierInstance | train | protected function createNewHtmlPurifierInstance()
{
$this->_purifier=new HTMLPurifier($this->getOptions());
| php | {
"resource": ""
} |
q19319 | CUploadedFile.getInstancesByName | train | public static function getInstancesByName($name)
{
if(null===self::$_files)
self::prefetchFiles();
$len=strlen($name);
$results=array();
foreach(array_keys(self::$_files) as $key)
if(0===strncmp($key, | php | {
"resource": ""
} |
q19320 | WebAppCommand.setPermissions | train | protected function setPermissions($targetDir)
{
@chmod($targetDir.'/assets',0777);
@chmod($targetDir.'/protected/runtime',0777);
@chmod($targetDir.'/protected/data',0777);
| php | {
"resource": ""
} |
q19321 | WebAppCommand.addFileModificationCallbacks | train | protected function addFileModificationCallbacks(&$fileList)
{
$fileList['index.php']['callback']=array($this,'generateIndex');
$fileList['index-test.php']['callback']=array($this,'generateIndex');
| php | {
"resource": ""
} |
q19322 | WebAppCommand.generateIndex | train | public function generateIndex($source,$params)
{
$content=file_get_contents($source);
$yii=realpath(dirname(__FILE__).'/../../yii.php');
$yii=$this->getRelativePath($yii,$this->_rootPath.DIRECTORY_SEPARATOR.'index.php');
| php | {
"resource": ""
} |
q19323 | WebAppCommand.generateYiic | train | public function generateYiic($source,$params)
{
$content=file_get_contents($source);
$yiic=realpath(dirname(__FILE__).'/../../yiic.php');
$yiic=$this->getRelativePath($yiic,$this->_rootPath.DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'yiic.php'); | php | {
"resource": ""
} |
q19324 | CProfileLogRoute.processLogs | train | public function processLogs($logs)
{
$app=Yii::app();
if(!($app instanceof CWebApplication) || $app->getRequest()->getIsAjaxRequest()) | php | {
"resource": ""
} |
q19325 | CProfileLogRoute.displayCallstack | train | protected function displayCallstack($logs)
{
$stack=array();
$results=array();
$n=0;
foreach($logs as $log)
{
if($log[1]!==CLogger::LEVEL_PROFILE)
continue;
$message=$log[0];
if(!strncasecmp($message,'begin:',6))
{
$log[0]=substr($message,6);
$log[4]=$n;
$stack[]=$log;
$n++;
... | php | {
"resource": ""
} |
q19326 | CProfileLogRoute.displaySummary | train | protected function displaySummary($logs)
{
$stack=array();
$results=array();
foreach($logs as $log)
{
if($log[1]!==CLogger::LEVEL_PROFILE)
continue;
$message=$log[0];
if(!strncasecmp($message,'begin:',6))
{
$log[0]=substr($message,6);
$stack[]=$log;
}
elseif(!strncasecmp($message,... | php | {
"resource": ""
} |
q19327 | CProfileLogRoute.aggregateResult | train | protected function aggregateResult($result,$delta)
{
list($token,$calls,$min,$max,$total)=$result;
| php | {
"resource": ""
} |
q19328 | CActiveRecord.delete | train | public function delete()
{
if(!$this->getIsNewRecord())
{
Yii::trace(get_class($this).'.delete()','system.db.ar.CActiveRecord');
if($this->beforeDelete())
| php | {
"resource": ""
} |
q19329 | CActiveRecord.find | train | public function find($condition='',$params=array())
{
Yii::trace(get_class($this).'.find()','system.db.ar.CActiveRecord');
| php | {
"resource": ""
} |
q19330 | CActiveRecord.findBySql | train | public function findBySql($sql,$params=array())
{
Yii::trace(get_class($this).'.findBySql()','system.db.ar.CActiveRecord');
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && !empty($criteria->with)) | php | {
"resource": ""
} |
q19331 | CActiveRecord.findAllBySql | train | public function findAllBySql($sql,$params=array())
{
Yii::trace(get_class($this).'.findAllBySql()','system.db.ar.CActiveRecord');
$this->beforeFind();
if(($criteria=$this->getDbCriteria(false))!==null && | php | {
"resource": ""
} |
q19332 | CDataProviderIterator.loadPage | train | protected function loadPage()
{
$this->_dataProvider->getPagination()->setCurrentPage($this->_currentPage); | php | {
"resource": ""
} |
q19333 | CDataProviderIterator.key | train | public function key()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize(); | php | {
"resource": ""
} |
q19334 | CDataProviderIterator.next | train | public function next()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize();
$this->_currentIndex++;
if($this->_currentIndex >= $pageSize)
{
| php | {
"resource": ""
} |
q19335 | CDbCache.createCacheTable | train | protected function createCacheTable($db,$tableName)
{
$driver=$db->getDriverName();
if($driver==='mysql')
$blob='LONGBLOB';
elseif($driver==='pgsql')
$blob='BYTEA';
else
$blob='BLOB';
$sql=<<<EOD
CREATE TABLE $tableName
( | php | {
"resource": ""
} |
q19336 | CTimestamp.isLeapYear | train | public static function isLeapYear($year)
{
$year = self::digitCheck($year);
if ($year % 4 != 0)
return false;
if ($year % 400 == 0)
return true;
// if gregorian calendar (>1582), century not-divisible | php | {
"resource": ""
} |
q19337 | CTimestamp.digitCheck | train | protected static function digitCheck($y)
{
if ($y < 100){
$yr = (integer) date("Y");
$century = (integer) ($yr /100);
if ($yr%100 > 50) {
$c1 = $century + 1;
$c0 = $century;
} else {
$c1 = $century;
$c0 = $century - 1;
}
$c1 *= 100;
// if 2-digit year is less than 30 years in fu... | php | {
"resource": ""
} |
q19338 | CTimestamp.isValidTime | train | public static function isValidTime($h,$m,$s,$hs24=true)
{
if($hs24 && ($h < 0 || $h > 23) || !$hs24 && ($h < 1 || $h > 12)) return false;
if($m > 59 || $m | php | {
"resource": ""
} |
q19339 | CArrayDataProvider.getSortingFieldValue | train | protected function getSortingFieldValue($data, $fields)
{
if(is_object($data))
{
foreach($fields as $field)
$data=isset($data->$field) ? $data->$field : null;
}
else
{
foreach($fields as | php | {
"resource": ""
} |
q19340 | CArrayDataProvider.getSortDirections | train | protected function getSortDirections($order)
{
$segs=explode(',',$order);
$directions=array();
foreach($segs as $seg)
{
if(preg_match('/(.*?)(\s+(desc|asc))?$/i',trim($seg),$matches))
| php | {
"resource": ""
} |
q19341 | SiteController.actionError | train | public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest)
echo | php | {
"resource": ""
} |
q19342 | SiteController.actionContact | train | public function actionContact()
{
$model=new ContactForm;
if(isset($_POST['ContactForm']))
{
$model->attributes=$_POST['ContactForm'];
if($model->validate())
{
$name='=?UTF-8?B?'.base64_encode($model->name).'?=';
$subject='=?UTF-8?B?'.base64_encode($model->subject).'?=';
| php | {
"resource": ""
} |
q19343 | CViewAction.resolveView | train | protected function resolveView($viewPath)
{
// start with a word char and have word chars, dots and dashes only
if(preg_match('/^\w[\w\.\-]*$/',$viewPath))
{
$view=strtr($viewPath,'.','/');
if(!empty($this->basePath))
$view=$this->basePath.'/'.$view;
if($this->getController()->getViewFile($view)!==f... | php | {
"resource": ""
} |
q19344 | CLogFilter.filter | train | public function filter(&$logs)
{
if (!empty($logs))
{
if(($message=$this->getContext())!=='')
| php | {
"resource": ""
} |
q19345 | CDbLogRoute.processLogs | train | protected function processLogs($logs)
{
$command=$this->getDbConnection()->createCommand();
foreach($logs as $log) | php | {
"resource": ""
} |
q19346 | CBasePager.getPages | train | public function getPages()
{
if($this->_pages===null) | php | {
"resource": ""
} |
q19347 | CCubridSchema.loadTable | train | protected function loadTable($name)
{
$table=new CCubridTableSchema;
$this->resolveTableNames($table,$name);
if($this->findColumns($table))
{
| php | {
"resource": ""
} |
q19348 | CCubridSchema.findPrimaryKeys | train | protected function findPrimaryKeys($table)
{
$pks=$this->getDbConnection()->getPdoInstance()->cubrid_schema(PDO::CUBRID_SCH_PRIMARY_KEY,$table->name);
foreach($pks as $pk)
{
$c = $table->columns[$pk['ATTR_NAME']];
$c->isPrimaryKey = true;
if($table->primaryKey===null)
$table->primaryKey=$c->name;
... | php | {
"resource": ""
} |
q19349 | CFormInputElement.renderInput | train | public function renderInput()
{
if(isset(self::$coreTypes[$this->type]))
{
$method=self::$coreTypes[$this->type];
if(strpos($method,'List')!==false)
return CHtml::$method($this->getParent()->getModel(), $this->name, $this->items, $this->attributes);
else
return CHtml::$method($this->getParent()->g... | php | {
"resource": ""
} |
q19350 | CPasswordHelper.hashPassword | train | public static function hashPassword($password,$cost=13)
{
self::checkBlowfish();
$salt=self::generateSalt($cost);
$hash=crypt($password,$salt);
if(!is_string($hash) || (function_exists('mb_strlen') ? mb_strlen($hash, '8bit') | php | {
"resource": ""
} |
q19351 | CPasswordHelper.verifyPassword | train | public static function verifyPassword($password, $hash)
{
self::checkBlowfish();
if(!is_string($password) || $password==='')
return false;
if (!$password || !preg_match('{^\$2[axy]\$(\d\d)\$[\./0-9A-Za-z]{22}}',$hash,$matches) || | php | {
"resource": ""
} |
q19352 | CPasswordHelper.same | train | public static function same($a,$b)
{
if(!is_string($a) || !is_string($b))
return false;
$mb=function_exists('mb_strlen');
$length=$mb ? | php | {
"resource": ""
} |
q19353 | Text_Diff_Engine_shell._getLines | train | function _getLines(&$text_lines, &$line_no, $end = false)
{
if (!empty($end)) {
$lines = array();
// We can shift even more
while ($line_no <= $end) {
array_push($lines, array_shift($text_lines));
| php | {
"resource": ""
} |
q19354 | CCacheHttpSession.init | train | public function init()
{
$this->_cache=Yii::app()->getComponent($this->cacheID);
if(!($this->_cache instanceof ICache))
throw new CException(Yii::t('yii','CCacheHttpSession.cacheID is invalid. Please make sure "{id}" refers | php | {
"resource": ""
} |
q19355 | COutputCache.checkContentCache | train | protected function checkContentCache()
{
if((empty($this->requestTypes) || in_array(Yii::app()->getRequest()->getRequestType(),$this->requestTypes))
&& ($this->_cache=$this->getCache())!==null)
{
if($this->duration>0 && ($data=$this->_cache->get($this->getCacheKey()))!==false)
{
$this->_content=$data[... | php | {
"resource": ""
} |
q19356 | COutputCache.replayActions | train | protected function replayActions()
{
if(empty($this->_actions))
return;
$controller=$this->getController();
$cs=Yii::app()->getClientScript();
foreach($this->_actions as $action)
{
if($action[0]==='clientScript')
$object=$cs;
elseif($action[0]==='')
$object=$controller;
else
$object=$... | php | {
"resource": ""
} |
q19357 | CDbHttpSession.createSessionTable | train | protected function createSessionTable($db,$tableName)
{
switch($db->getDriverName())
{
case 'mysql':
$blob='LONGBLOB';
break;
case 'pgsql':
$blob='BYTEA';
break;
case 'sqlsrv':
case 'mssql':
case 'dblib':
$blob='VARBINARY(MAX)';
break;
default:
$blob='BLOB';
| php | {
"resource": ""
} |
q19358 | CDbHttpSession.openSession | train | public function openSession($savePath,$sessionName)
{
if($this->autoCreateSessionTable)
{
$db=$this->getDbConnection();
$db->setActive(true);
try
{
| php | {
"resource": ""
} |
q19359 | CCaptchaAction.getSessionKey | train | protected function getSessionKey()
{
return self::SESSION_VAR_PREFIX . Yii::app()->getId() . '.' | php | {
"resource": ""
} |
q19360 | TranslationsCommand.checkFiles | train | protected function checkFiles($translatedFilePath = null, $sourceFilePath = null)
{
$errors = array();
if($translatedFilePath!==null && !file_exists($translatedFilePath)) { | php | {
"resource": ""
} |
q19361 | TranslationsCommand.highlightDiff | train | protected function highlightDiff($diff)
{
$lines = explode("\n", $diff);
foreach ($lines as $key => $val) {
if (mb_substr($val,0,1,'utf-8') === '@') {
$lines[$key] = '<span class="info">'.CHtml::encode($val).'</span>';
}
else if (mb_substr($val,0,1,'utf-8') === '+') {
$lines[$key] | php | {
"resource": ""
} |
q19362 | CFormElement.configure | train | public function configure($config)
{
if(is_string($config))
$config=require(Yii::getPathOfAlias($config).'.php');
if(is_array($config))
{
| php | {
"resource": ""
} |
q19363 | CPhpAuthManager.init | train | public function init()
{
parent::init();
if($this->authFile===null) | php | {
"resource": ""
} |
q19364 | CPhpAuthManager.save | train | public function save()
{
$items=array();
foreach($this->_items as $name=>$item)
{
$items[$name]=array(
'type'=>$item->getType(),
'description'=>$item->getDescription(),
'bizRule'=>$item->getBizRule(),
'data'=>$item->getData(),
);
if(isset($this->_children[$name]))
{
foreach($this-... | php | {
"resource": ""
} |
q19365 | CPhpAuthManager.load | train | public function load()
{
$this->clearAll();
$items=$this->loadFromFile($this->authFile);
foreach($items as $name=>$item)
$this->_items[$name]=new CAuthItem($this,$name,$item['type'],$item['description'],$item['bizRule'],$item['data']);
foreach($items as $name=>$item)
{
if(isset($item['children']))
... | php | {
"resource": ""
} |
q19366 | SiteController.beforeWebMethod | train | public function beforeWebMethod($service)
{
$safeMethods=array(
'login',
'getContacts',
);
$pattern='/^('.implode('|',$safeMethods).')$/i';
if(!Yii::app()->user->isGuest || | php | {
"resource": ""
} |
q19367 | SiteController.saveContact | train | public function saveContact($contact)
{
if($contact->id > 0) // update
{
$contact->isNewRecord=false;
if(($oldContact=Contact::model()->findByPk($contact->id))!==null)
{
$oldContact->attributes=$contact->attributes;
return $oldContact->save();
| php | {
"resource": ""
} |
q19368 | Text_Diff_Renderer.getParams | train | function getParams()
{
$params = array();
foreach (get_object_vars($this) as $k => $v) {
if ($k[0] == '_') {
| php | {
"resource": ""
} |
q19369 | Text_Diff_Renderer.render | train | function render($diff)
{
$xi = $yi = 1;
$block = false;
$context = array();
$nlead = $this->_leading_context_lines;
$ntrail = $this->_trailing_context_lines;
$output = $this->_startDiff();
$diffs = $diff->getDiff();
foreach ($diffs as $i => $edit) {... | php | {
"resource": ""
} |
q19370 | CTextHighlighter.highlight | train | public function highlight($content)
{
$this->registerClientScript();
$options['use_language']=true;
$options['tabsize']=$this->tabSize;
if($this->showLineNumbers)
$options['numbers']=($this->lineNumberStyle==='list')?HL_NUMBERS_LI:HL_NUMBERS_TABLE;
$highlighter=empty($this->language)?false:Text_Highligh... | php | {
"resource": ""
} |
q19371 | CErrorHandler.handleException | train | protected function handleException($exception)
{
$app=Yii::app();
if($app instanceof CWebApplication)
{
if(($trace=$this->getExactTrace($exception))===null)
{
$fileName=$exception->getFile();
$errorLine=$exception->getLine();
}
else
{
$fileName=$trace['file'];
$errorLine=$trace['li... | php | {
"resource": ""
} |
q19372 | CErrorHandler.getExactTrace | train | protected function getExactTrace($exception)
{
$traces=$exception->getTrace();
foreach($traces as $trace)
{
// property access exception
| php | {
"resource": ""
} |
q19373 | CErrorHandler.getViewFile | train | protected function getViewFile($view,$code)
{
$viewPaths=array(
Yii::app()->getTheme()===null ? null : Yii::app()->getTheme()->getSystemViewPath(),
Yii::app() instanceof CWebApplication ? Yii::app()->getSystemViewPath() : null,
YII_PATH.DIRECTORY_SEPARATOR.'views',
);
foreach($viewPaths as $i=>$viewPa... | php | {
"resource": ""
} |
q19374 | CErrorHandler.getViewFileInternal | train | protected function getViewFileInternal($viewPath,$view,$code,$srcLanguage=null)
{
$app=Yii::app();
if($view==='error')
{
$viewFile=$app->findLocalizedFile($viewPath.DIRECTORY_SEPARATOR."error{$code}.php",$srcLanguage); | php | {
"resource": ""
} |
q19375 | CErrorHandler.getVersionInfo | train | protected function getVersionInfo()
{
if(YII_DEBUG)
{
$version='<a href="http://www.yiiframework.com/">Yii Framework</a>/'.Yii::getVersion(); | php | {
"resource": ""
} |
q19376 | CErrorHandler.isCoreCode | train | protected function isCoreCode($trace)
{
if(isset($trace['file']))
{
$systemPath=realpath(dirname(__FILE__).'/..');
return | php | {
"resource": ""
} |
q19377 | CErrorHandler.renderSourceCode | train | protected function renderSourceCode($file,$errorLine,$maxLines)
{
$errorLine--; // adjust line number to 0-based from 1-based
if($errorLine<0 || ($lines=@file($file))===false || ($lineCount=count($lines))<=$errorLine)
return '';
$halfLines=(int)($maxLines/2);
$beginLine=$errorLine-$halfLines>0 ? $errorLine... | php | {
"resource": ""
} |
q19378 | CMultiFileUpload.run | train | public function run()
{
list($name,$id)=$this->resolveNameID();
if(substr($name,-2)!=='[]')
$name.='[]';
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
| php | {
"resource": ""
} |
q19379 | CListView.renderItems | train | public function renderItems()
{
echo CHtml::openTag($this->itemsTagName,array('class'=>$this->itemsCssClass))."\n";
$data=$this->dataProvider->getData();
if(($n=count($data))>0)
{
$owner=$this->getOwner();
$viewFile=$owner->getViewFile($this->itemView);
$j=0;
foreach($data as $i=>$item)
{
$d... | php | {
"resource": ""
} |
q19380 | CListView.renderSorter | train | public function renderSorter()
{
if($this->dataProvider->getItemCount()<=0 || !$this->enableSorting || empty($this->sortableAttributes))
return;
echo CHtml::openTag('div',array('class'=>$this->sorterCssClass))."\n";
echo $this->sorterHeader===null ? Yii::t('zii','Sort by: ') : $this->sorterHeader;
echo "<ul... | php | {
"resource": ""
} |
q19381 | UserIdentity.authenticate | train | public function authenticate()
{
if($this->username==='demo' && $this->password==='demo')
$this->errorCode=self::ERROR_NONE;
else
| php | {
"resource": ""
} |
q19382 | CAutoComplete.init | train | public function init()
{
list($name,$id)=$this->resolveNameID();
if(isset($this->htmlOptions['id']))
$id=$this->htmlOptions['id'];
else
$this->htmlOptions['id']=$id;
if(isset($this->htmlOptions['name']))
$name=$this->htmlOptions['name'];
$this->registerClientScript();
if($this->hasModel())
{
... | php | {
"resource": ""
} |
q19383 | CGettextMoFile.save | train | public function save($file,$messages)
{
if(!($fw=@fopen($file,'wb')))
throw new CException(Yii::t('yii','Unable to write file "{file}".',
array('{file}'=>$file)));
if(!@flock($fw,LOCK_EX))
throw new CException(Yii::t('yii','Unable to lock file "{file}" for writing.',
array('{file}'=>$file)));
// ... | php | {
"resource": ""
} |
q19384 | CGettextMoFile.writeInteger | train | protected function writeInteger($fw,$data)
{
return | php | {
"resource": ""
} |
q19385 | CGettextMoFile.readString | train | protected function readString($fr,$length,$offset=null)
{
if($offset!==null)
| php | {
"resource": ""
} |
q19386 | CPropertyValue.ensureArray | train | public static function ensureArray($value)
{
if(is_string($value))
{
$value = trim($value);
$len = strlen($value);
if ($len >= 2 && $value[0] == '(' && $value[$len-1] == ')')
{
try
{
return eval('return array' . $value . ';');
}
| php | {
"resource": ""
} |
q19387 | CPropertyValue.ensureEnum | train | public static function ensureEnum($value,$enumType)
{
static $types=array();
if(!isset($types[$enumType]))
$types[$enumType]=new ReflectionClass($enumType);
if($types[$enumType]->hasConstant($value))
| php | {
"resource": ""
} |
q19388 | ModelCode.isRelationTable | train | protected function isRelationTable($table)
{
$pk=$table->primaryKey;
$count=is_array($pk) ? count($pk) : 1;
return ($count === 2 // we want 2 columns
&& isset($table->foreignKeys[$pk[0]]) // pk column 1 is also a foreign key
&& isset($table->foreignKeys[$pk[1]]) // pk column 2 | php | {
"resource": ""
} |
q19389 | CAuthManager.executeBizRule | train | public function executeBizRule($bizRule,$params,$data)
{
if($bizRule==='' || $bizRule===null)
return true;
if ($this->showErrors)
return eval($bizRule)!=0;
else
{
try
| php | {
"resource": ""
} |
q19390 | CAuthManager.checkItemChildType | train | protected function checkItemChildType($parentType,$childType)
{
static $types=array('operation','task','role');
if($parentType < $childType) | php | {
"resource": ""
} |
q19391 | CNumberFormatter.formatCurrency | train | public function formatCurrency($value,$currency)
{
return | php | {
"resource": ""
} |
q19392 | CFileValidator.emptyAttribute | train | protected function emptyAttribute($object, $attribute)
{
if($this->safe)
$object->$attribute=null;
if(!$this->allowEmpty) | php | {
"resource": ""
} |
q19393 | Text_Diff.reverse | train | function reverse()
{
if (version_compare(zend_version(), '2', '>')) {
$rev = clone($this);
} else {
$rev = $this;
}
$rev->_edits = array();
| php | {
"resource": ""
} |
q19394 | Text_Diff.getOriginal | train | function getOriginal()
{
$lines = array();
foreach ($this->_edits as $edit) {
if ($edit->orig) {
| php | {
"resource": ""
} |
q19395 | Text_Diff.getFinal | train | function getFinal()
{
$lines = array();
foreach ($this->_edits as $edit) {
if ($edit->final) {
| php | {
"resource": ""
} |
q19396 | Text_Diff._getTempDir | train | function _getTempDir()
{
$tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
'c:\windows\temp', 'c:\winnt\temp');
/* Try PHP's upload_tmp_dir directive. */
$tmp = ini_get('upload_tmp_dir');
/* Otherwise, try to determine the TMPDIR envi... | php | {
"resource": ""
} |
q19397 | Text_Diff._check | train | function _check($from_lines, $to_lines)
{
if (serialize($from_lines) != serialize($this->getOriginal())) {
trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
}
if (serialize($to_lines) != serialize($this->getFinal())) {
trigger_error("Reconstructed f... | php | {
"resource": ""
} |
q19398 | CMssqlColumnSchema.init | train | public function init($dbType, $defaultValue)
{
if ($defaultValue=='(NULL)') | php | {
"resource": ""
} |
q19399 | GiiModule.init | train | public function init()
{
parent::init();
Yii::setPathOfAlias('gii',dirname(__FILE__));
Yii::app()->setComponents(array(
'errorHandler'=>array(
'class'=>'CErrorHandler',
'errorAction'=>$this->getId().'/default/error',
),
'user'=>array(
'class'=>'CWebUser',
'stateKeyPrefix'=>'gii',
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.