_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q1000
Formatter.onAfterExercise
train
public function onAfterExercise(TestworkEvent\AfterExerciseCompleted $event) { $this->timer->stop(); $this->renderer->render(); $this->printer->write($this->renderer->getResult()); }
php
{ "resource": "" }
q1001
JqlEndpoint.search
train
public function search($jql, $startAt = null, $maxResults = null, $validateQuery = null, $fields = null, $expand = null) { $parameters = array( 'jql' => $jql, 'startAt' => $startAt, 'maxResults' => $maxResults, 'validateQuery' => $validateQuery, 'f...
php
{ "resource": "" }
q1002
Step.getProcessedResult
train
public function getProcessedResult() { $status = StepResult::SKIPPED; if (!empty(static::$resultLabels[$this->getResultCode()])) { $status = static::$resultLabels[$this->getResultCode()]; } return [ 'status' => $status, 'error_message' => $this->...
php
{ "resource": "" }
q1003
ConfigurationFetcherRegistry.getFetcher
train
public function getFetcher($alias) { if (!is_string($alias)) { throw new UnexpectedTypeException($alias, 'string'); } if (!isset($this->fetchers[$alias])) { throw new \InvalidArgumentException(sprintf('Could not load configuration fetcher "%s"', $alias)); } ...
php
{ "resource": "" }
q1004
Date.seeDateIsInDays
train
public function seeDateIsInDays($date, $days) { \PHPUnit_Framework_Assert::assertEquals($days, $this->_GetNow()->diffInDays($this->_ParseDate($date), false)); }
php
{ "resource": "" }
q1005
Date.dontSeeDateIsInDays
train
public function dontSeeDateIsInDays($date, $days) { \PHPUnit_Framework_Assert::assertNotEquals($days, $this->_GetNow()->diffInDays($this->_ParseDate($date), false)); }
php
{ "resource": "" }
q1006
Date.seeDateIsInMonths
train
public function seeDateIsInMonths($date, $months) { \PHPUnit_Framework_Assert::assertEquals($months, $this->_GetNow()->diffInMonths($this->_ParseDate($date), false)); }
php
{ "resource": "" }
q1007
Date.dontSeeDateIsInMonths
train
public function dontSeeDateIsInMonths($date, $months) { \PHPUnit_Framework_Assert::assertNotEquals($months, $this->_GetNow()->diffInMonths($this->_ParseDate($date), false)); }
php
{ "resource": "" }
q1008
Date.seeDateIsInYears
train
public function seeDateIsInYears($date, $years) { \PHPUnit_Framework_Assert::assertEquals($years, $this->_GetNow()->diffInYears($this->_ParseDate($date), false)); }
php
{ "resource": "" }
q1009
Date.dontSeeDateIsInYears
train
public function dontSeeDateIsInYears($date, $years) { \PHPUnit_Framework_Assert::assertNotEquals($years, $this->_GetNow()->diffInYears($this->_ParseDate($date), false)); }
php
{ "resource": "" }
q1010
Date.seeDateIsMonday
train
public function seeDateIsMonday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($date)->dayOfWeek == Carbon::MONDAY); }
php
{ "resource": "" }
q1011
Date.dontSeeDateIsMonday
train
public function dontSeeDateIsMonday($date) { \PHPUnit_Framework_Assert::assertFalse($this->_ParseDate($date)->dayOfWeek == Carbon::MONDAY); }
php
{ "resource": "" }
q1012
Date.seeDateIsTuesday
train
public function seeDateIsTuesday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($date)->dayOfWeek == Carbon::TUESDAY); }
php
{ "resource": "" }
q1013
Date.dontSeeDateIsTuesday
train
public function dontSeeDateIsTuesday($date) { \PHPUnit_Framework_Assert::assertFalse($this->_ParseDate($date)->dayOfWeek == Carbon::TUESDAY); }
php
{ "resource": "" }
q1014
Date.seeDateIsWednesday
train
public function seeDateIsWednesday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($date)->dayOfWeek == Carbon::WEDNESDAY); }
php
{ "resource": "" }
q1015
Date.dontSeeDateIsWednesday
train
public function dontSeeDateIsWednesday($date) { \PHPUnit_Framework_Assert::assertFalse($this->_ParseDate($date)->dayOfWeek == Carbon::WEDNESDAY); }
php
{ "resource": "" }
q1016
Date.seeDateIsThursday
train
public function seeDateIsThursday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($date)->dayOfWeek == Carbon::THURSDAY); }
php
{ "resource": "" }
q1017
Date.dontSeeDateIsThursday
train
public function dontSeeDateIsThursday($date) { \PHPUnit_Framework_Assert::assertFalse($this->_ParseDate($date)->dayOfWeek == Carbon::THURSDAY); }
php
{ "resource": "" }
q1018
Date.seeDateIsFriday
train
public function seeDateIsFriday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($date)->dayOfWeek == Carbon::FRIDAY); }
php
{ "resource": "" }
q1019
Date.dontSeeDateIsFriday
train
public function dontSeeDateIsFriday($date) { \PHPUnit_Framework_Assert::assertFalse($this->_ParseDate($date)->dayOfWeek == Carbon::FRIDAY); }
php
{ "resource": "" }
q1020
Date.seeDateIsSaturday
train
public function seeDateIsSaturday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($date)->dayOfWeek == Carbon::SATURDAY); }
php
{ "resource": "" }
q1021
Date.dontSeeDateIsSaturday
train
public function dontSeeDateIsSaturday($date) { \PHPUnit_Framework_Assert::assertFalse($this->_ParseDate($date)->dayOfWeek == Carbon::SATURDAY); }
php
{ "resource": "" }
q1022
Date.seeDateIsSunday
train
public function seeDateIsSunday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($date)->dayOfWeek == Carbon::SUNDAY); }
php
{ "resource": "" }
q1023
Date.dontSeeDateIsSunday
train
public function dontSeeDateIsSunday($date) { \PHPUnit_Framework_Assert::assertFalse($this->_ParseDate($date)->dayOfWeek == Carbon::SUNDAY); }
php
{ "resource": "" }
q1024
Date.seeDateMatches
train
public function seeDateMatches($d1, $d2) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($d1)->eq($this->_ParseDate($d2))); }
php
{ "resource": "" }
q1025
Date.dontSeeDateMatches
train
public function dontSeeDateMatches($d1, $d2) { \PHPUnit_Framework_Assert::assertTrue($this->_ParseDate($d1)->ne($this->_ParseDate($d2))); }
php
{ "resource": "" }
q1026
Date.seeDateInQuarter
train
public function seeDateInQuarter($date, $quarter) { \PHPUnit_Framework_Assert::assertEquals($quarter, $this->_ParseDate($date)->quarter); }
php
{ "resource": "" }
q1027
Date.dontSeeDateInQuarter
train
public function dontSeeDateInQuarter($date, $quarter) { \PHPUnit_Framework_Assert::assertNotEquals($quarter, $this->_ParseDate($date)->quarter); }
php
{ "resource": "" }
q1028
Date.seeDayInWeek
train
public function seeDayInWeek($date, $day) { \PHPUnit_Framework_Assert::assertEquals($day, $this->_ParseDate($date)->dayOfWeek); }
php
{ "resource": "" }
q1029
Date.dontSeeDayInWeek
train
public function dontSeeDayInWeek($date, $day) { \PHPUnit_Framework_Assert::assertNotEquals($day, $this->_ParseDate($date)->dayOfWeek); }
php
{ "resource": "" }
q1030
Date.seeDayInMonth
train
public function seeDayInMonth($date, $day) { \PHPUnit_Framework_Assert::assertEquals($day, $this->_ParseDate($date)->day); }
php
{ "resource": "" }
q1031
Date.dontSeeDayInMonth
train
public function dontSeeDayInMonth($date, $day) { \PHPUnit_Framework_Assert::assertNotEquals($day, $this->_ParseDate($date)->day); }
php
{ "resource": "" }
q1032
Date.seeDayInYear
train
public function seeDayInYear($date, $day) { \PHPUnit_Framework_Assert::assertEquals($day, $this->_ParseDate($date)->dayOfYear); }
php
{ "resource": "" }
q1033
Date.dontSeeDayInYear
train
public function dontSeeDayInYear($date, $day) { \PHPUnit_Framework_Assert::assertNotEquals($day, $this->_ParseDate($date)->dayOfYear); }
php
{ "resource": "" }
q1034
Date.seeWeekInYear
train
public function seeWeekInYear($date, $week) { \PHPUnit_Framework_Assert::assertEquals($week, $this->_ParseDate($date)->weekOfYear); }
php
{ "resource": "" }
q1035
Date.dontSeeWeekInYear
train
public function dontSeeWeekInYear($date, $week) { \PHPUnit_Framework_Assert::assertNotEquals($week, $this->_ParseDate($date)->weekOfYear); }
php
{ "resource": "" }
q1036
Date.seeMonthInYear
train
public function seeMonthInYear($date, $month) { \PHPUnit_Framework_Assert::assertEquals($month, $this->_ParseDate($date)->month); }
php
{ "resource": "" }
q1037
Date.dontSeeMonthInYear
train
public function dontSeeMonthInYear($date, $month) { \PHPUnit_Framework_Assert::assertNotEquals($month, $this->_ParseDate($date)->month); }
php
{ "resource": "" }
q1038
Comment.getSubject
train
public function getSubject() { if (!$this->isNewRecord && $this->subject === null) { $this->subject = call_user_func([$this->model_class, 'findOne'], $this->foreign_pk); if ($this->subject === null) { $msg = Yii::t('app', 'Could not find model for attachment `{attachment}`', [ 'attachment'=>$this->id ...
php
{ "resource": "" }
q1039
Comment.setSubject
train
public function setSubject($subject) { self::validateSubject($subject, true); $this->model_class = $subject->className(); $this->foreign_pk = $subject->getPrimaryKey(true); $this->subject = $subject; }
php
{ "resource": "" }
q1040
Comment.validateSubject
train
public static function validateSubject($subject, $throwException = true) { if (!ComponentConfig::isActiveRecord($subject, $throwException)) return false; if (!ComponentConfig::hasBehavior($subject, CommentsBehavior::className(), $throwException)) return false; if (empty($subject->primaryKey) || (is_array($subje...
php
{ "resource": "" }
q1041
TemplateMigration.update
train
public function update() { $t = new Template; $t->name = $this->getTemplateName(); $fg = new Fieldgroup; $fg->name = $this->getTemplateName(); foreach($this->fields as $field) { // add global fields if(!($field->flags & Field::flagGlobal)) continue; $fg->add($field); } $fg->save(); $t->fieldgrou...
php
{ "resource": "" }
q1042
TemplateMigration.downgrade
train
public function downgrade() { $template = $this->getTemplate($this->getTemplateName()); $fieldgroup = $template->fieldgroup; $fg = $this->wire('fieldgroups')->get($template->name); $minNumberToError = $fg->id == $fieldgroup->id ? 2 : 1; if($fg->numTemplates() >= $minNumberToError) throw new WireExceptio...
php
{ "resource": "" }
q1043
ProductHolder.loadDescendantProductGroupIDListInto
train
public function loadDescendantProductGroupIDListInto(&$idList) { if ($children = $this->AllChildren()) { foreach ($children as $child) { if (in_array($child->ID, $idList)) { continue; } if ($child instanceof self) { ...
php
{ "resource": "" }
q1044
Customers.modify
train
public function modify( $customerId, $username, $name, $company, $address, $city, $state, $country, $zipCode, $phoneCC, $phone, $lang ) { return $this->post( 'modify', [ ...
php
{ "resource": "" }
q1045
Customers.signup
train
public function signup( $username, $passwd, $name, $company, $address, $city, $state, $country, $zipCode, $phoneCC, $phone, $lang ) { return $this->post( 'signup', [ 'u...
php
{ "resource": "" }
q1046
Captcha.setConfig
train
public function setConfig($config_location = NULL) { static $CAPTCHA_CONFIG = array(); $path = ( NULL === $config_location ) ? __DIR__ . DIRECTORY_SEPARATOR . 'captcha_config.php' : realpath($config_location); if ( false === $path ) { throw new CaptchaException( sprintf("Config File not found in: ...
php
{ "resource": "" }
q1047
Captcha.displayHTML
train
public function displayHTML($theme_name = NULL, $options = array()) { if ( strlen($this->_publicKey == 0) ) { throw new CaptchaException('To use reCAPTCHA you must get a Public API key from https://www.google.com/recaptcha/admin'); } // append a Theme $captcha_snippet = $this->_theme($theme_name, $option...
php
{ "resource": "" }
q1048
Captcha.isValid
train
public function isValid() { // Skip without submission if (strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') { return FALSE; } else { $captchaChallenge = isset($_POST['recaptcha_challenge_field']) ? $this->_sanitizeField($_POST['recaptcha_challenge_field']) : NULL; $captchaResponse = iss...
php
{ "resource": "" }
q1049
Captcha._postHttpChallenge
train
protected function _postHttpChallenge(array $data) { if ( strlen($this->_privateKey) == 0 ) { throw new CaptchaException( 'To use reCAPTCHA you must get a Private API key from https://www.google.com/recaptcha/admin' ); } $responseHeader = ''; $result = array('isvalid'=>'false', 'error'=>''); $rem...
php
{ "resource": "" }
q1050
Captcha._buildServerURI
train
private function _buildServerURI($path = 'challenge') { // Scheme $uri = ( TRUE === $this->_ssl ) ? 'https://' : 'http://'; // Host $uri .= self::RECAPTCHA_API_SERVER; // Path $uri .= ($path !== 'challenge') ? 'noscript' : $path; // Query $uri .= '?k=' . $this->_publicKey; $uri .= ($this->_e...
php
{ "resource": "" }
q1051
RSSParser.getNodes
train
public function getNodes($content) { $items = array(); $document = $this->createDocumentFromXML($content); $nodes = $document->getElementsByTagName('item'); if ($nodes->length) { foreach ($nodes as $node) { try { $item = $this->create($...
php
{ "resource": "" }
q1052
Relations._defineRelationships
train
protected static function _defineRelationships() { $className = get_called_class(); $classes = class_parents($className); array_unshift($classes, $className); static::$_classRelationships[$className] = []; while ($class = array_pop($classes)) { if (!empty($class::...
php
{ "resource": "" }
q1053
Relations._initRelationships
train
protected static function _initRelationships() { $className = get_called_class(); if (!empty(static::$_classRelationships[$className])) { $relationships = []; foreach (static::$_classRelationships[$className] as $relationship => $options) { if (is_array($optio...
php
{ "resource": "" }
q1054
RecordValidator.resolveValue
train
protected function resolveValue($field) { $cur = &$this->_record; if (array_key_exists($field, $cur)) { $cur = &$cur[$field]; } else { return null; } return $cur; }
php
{ "resource": "" }
q1055
CommentsBehavior.getComments
train
public function getComments($newestFirst=true, $limit=null, $offset=null) { $query = Comment::find()->subject($this->owner); $query->orderNewestFirst($newestFirst); if ($limit !== null) $query->limit($limit); if ($offset !== null) $query->offset($offset); return $query->all(); }
php
{ "resource": "" }
q1056
PatternFileTree.getImageSizeList
train
protected function getImageSizeList() { $arrSizes = \System::getContainer()->get('contao.image.image_sizes')->getAllOptions(); if (is_array($arrList = \StringUtil::deserialize($this->sizeList))) { $arrSizes['image_sizes'] = array_intersect_key($arrSizes['image_sizes'], array_flip($arrList)); } else { ...
php
{ "resource": "" }
q1057
Migration.eachPageUncache
train
protected function eachPageUncache($selector, callable $callback) { $num = 0; $id = 0; while (true) { $p = $this->pages->get("{$selector}, id>$id"); if(!$id = $p->id) break; $callback($p); $this->pages->uncacheAll($p); $num++; } return $num; }
php
{ "resource": "" }
q1058
Migration.insertIntoTemplate
train
protected function insertIntoTemplate ($template, $field, $reference = null, $after = true) { $template = $this->getTemplate($template); $fieldgroup = $template->fieldgroup; $method = $after ? 'insertAfter' : 'insertBefore'; $field = $this->getField($field); // Get reference if supplied if($reference ins...
php
{ "resource": "" }
q1059
Migration.removeFromTemplate
train
protected function removeFromTemplate($template, $field) { $t = $this->getTemplate($template); $f = $this->getField($field); $success = $t->fieldgroup->remove($f); $t->fieldgroup->save(); return $success; }
php
{ "resource": "" }
q1060
Migration.editInTemplateContext
train
protected function editInTemplateContext ($template, $field, callable $callback) { $template = $this->getTemplate($template); $fieldgroup = $template->fieldgroup; $field = $this->getField($field); $context = $fieldgroup->getField($field->name, true); $callback($context, $template); $this->fields->saveFiel...
php
{ "resource": "" }
q1061
tl_pattern.setPickerOptions
train
public function setPickerOptions($value, $dc) { $db = Database::getInstance(); switch ($value) { case 'datetime': if (!in_array($dc->activeRecord->rgxp, array('date', 'time', 'datim'))) { // Change rgxp in database $db->prepare("UPDATE " . $this->table . " SET rgxp=? WHERE id=?") ...
php
{ "resource": "" }
q1062
tl_pattern.setMultipleOption
train
public function setMultipleOption($value, $dc) { $db = Database::getInstance(); if ($value > 3 && $dc->activeRecord->maxLength > 200) { // change maxLegth in database $db->prepare("UPDATE " . $this->table . " SET maxLength=? WHERE id=?") ->execute(200, $dc->activeRecord->id); } return $valu...
php
{ "resource": "" }
q1063
tl_pattern.setSourceOptions
train
public function setSourceOptions($value, $dc) { $db = Database::getInstance(); if ($value == 'video' || $value == 'audio') { if (!$dc->activeRecord->multiSource) { // Change multiSource in database $db->prepare("UPDATE " . $this->table . " SET multiSource=? WHERE id=?") ->execute(1, $dc->...
php
{ "resource": "" }
q1064
tl_pattern.getPattern
train
public function getPattern($dc) { $pattern = array(); foreach ($GLOBALS['TL_CTP'] as $k=>$v) { foreach ($v as $kk=>$vv) { if (!$vv['unique']) { $pattern[$k][] = $kk; } elseif (\PatternModel::countByPidAndType($dc->activeRecord->pid, $kk) < 1 || $dc->activeRecord->type == ...
php
{ "resource": "" }
q1065
tl_pattern.saveGroups
train
public function saveGroups ($dc) { $db = Database::getInstance(); // Change predefined groups if ($dc->activeRecord->type == 'protection' && !$dc->activeRecord->canChangeGroups) { // Serialize array if not $groups = is_array($dc->activeRecord->groups) ? serialize($dc->activeRecord->groups) : $dc->a...
php
{ "resource": "" }
q1066
tl_pattern.getForms
train
public function getForms() { $arrForms = array(); $objForms = $this->Database->execute("SELECT id, title FROM tl_form ORDER BY title"); while ($objForms->next()) { $arrForms[$objForms->id] = $objForms->title . ' (ID ' . $objForms->id . ')'; } return $arrForms; }
php
{ "resource": "" }
q1067
Theme.exportTables
train
public function exportTables ($xml, $objArchive, $objThemeId) { // Find tables node $tables = $xml->getElementsByTagName('tables')[0]; // Add the table (elements) $table = $xml->createElement('table'); $table->setAttribute('name', 'tl_elements'); $table = $tables->appendChild($table); // Load the DC...
php
{ "resource": "" }
q1068
Theme.addPatternData
train
protected function addPatternData ($xml, $table, $arrOrder, $intParentID) { // Get all content patterns $objContentPattern = $this->Database->prepare("SELECT * FROM tl_pattern WHERE pid=?") ->execute($intParentID); // Add the rows while ($objContentPattern->next()) { $this->addDataRo...
php
{ "resource": "" }
q1069
Combination.getCombinations
train
public function getCombinations(array $sourceDataSet, $subsetSize = null) { // If the subset size is supplied, then just return the combinations that match such size if (isset($subsetSize)) { return $this->_getCombinationSubset($sourceDataSet, $subsetSize); } // ...
php
{ "resource": "" }
q1070
Combination._getCombinationSubset
train
protected function _getCombinationSubset(array $sourceDataSet, $subsetSize) { if (!isset($subsetSize) || $subsetSize < 0) { throw new \InvalidArgumentException('Subset size cannot be empty or less than 0'); } $sourceSetSize = count($sourceDataSet); if ($subsetSi...
php
{ "resource": "" }
q1071
Combination._getCombination
train
private function _getCombination($sourceDataSet, $setKeyList, Pointer $pointer) { $combination = array(); $indexPointerList = $pointer->getPointerList(); foreach ($indexPointerList as $indexPointer) { $namedKey = $setKeyList[$indexPointer]; $combination[...
php
{ "resource": "" }
q1072
Pattern.generateDCA
train
public function generateDCA($strFieldName, $arrFieldDCA=array(), $bolVisble=true, $bolCallbacks=true) { $strVirtualField = $this->virtualFieldName($strFieldName); // Add to palette if ($bolVisble) { /* Using the subpalette system of the DC_TABLE not possible because of direct database check (see https...
php
{ "resource": "" }
q1073
Pattern.virtualFieldName
train
protected function virtualFieldName($strFieldName) { $strVirtualField = $this->pattern . '-' . $strFieldName; if ($this->data !== null) { $strVirtualField .= '-' . $this->data->id; } return $strVirtualField; }
php
{ "resource": "" }
q1074
Pattern.writeToTemplate
train
public function writeToTemplate($value) { if (is_array($this->arrMapper)) { $arrValue[$this->arrMapper[0]] = $this->Template->{$this->arrMapper[0]}; $map =& $arrValue; foreach ($this->arrMapper as $key) { if (!is_array($map[$key])) { $map[$key] = array(); } $map =& $m...
php
{ "resource": "" }
q1075
Pattern.hasData
train
public static function hasData($strName) { foreach ($GLOBALS['TL_CTP'] as $v) { foreach ($v as $kk=>$vv) { if ($kk == $strName) { return ($vv['data']) ?:false; } } } return null; }
php
{ "resource": "" }
q1076
rc4crypt.encrypt
train
static function encrypt ($pwd, $data, $ispwdHex = 0) { if ($ispwdHex) $pwd = @pack('H*', $pwd); // valid input, please! $key[] = ''; $box[] = ''; $cipher = ''; $pwd_length = strlen($pwd); $data_length = strlen($data); for ($i = 0; $i < 256; $i++) { $key[$i] = ord($pwd[$i % $pwd_length]); ...
php
{ "resource": "" }
q1077
OrderHistoryPage.getOrders
train
public function getOrders($limit = 10) { if ($Member = Security::getCurrentUser()) { $Orders = $Member->Orders()->sort('TransactionDate', 'DESC'); $list = new PaginatedList($Orders, Controller::curr()->getRequest()); $list->setPageLength($limit); return $lis...
php
{ "resource": "" }
q1078
CommentQuery.subject
train
public function subject($model) { Comment::validateSubject($model, true); $this->modelClass($model::className()); $this->andWhere(['foreign_pk'=>$this->createPrimaryKeyJson($model)]); return $this; }
php
{ "resource": "" }
q1079
tl_content_elements.addCteType
train
public function addCteType($arrRow) { $return = \tl_content::addCteType($arrRow); if (($objElement = $objElement = \ElementsModel::findOneByAlias($arrRow['type'])) === null && !array_key_exists($arrRow['type'], $GLOBALS['TL_DCA']['tl_content']['palettes'])) { $tag = '<span style="color: #222;">' . $GLOBAL...
php
{ "resource": "" }
q1080
tl_content_elements.addTypeHelpWizard
train
public function addTypeHelpWizard ($dc) { return ' <a href="contao/help.php?table='.$dc->table.'&amp;field='.$dc->field.'&amp;ptable='.$dc->parentTable.'&amp;pid='.$dc->activeRecord->pid.'" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['helpWizard']) . '" onclick="Backend.openModalIframe({\'width\'...
php
{ "resource": "" }
q1081
tl_content_elements.getElements
train
public function getElements ($dc) { if ($dc->activeRecord !== null) { $ptable = $dc->activeRecord->ptable; $pid = $dc->activeRecord->pid; } else { // If no activeRecord try to use get parameters (submitted by the custom help wizard) $ptable = \Input::get('ptable'); $pid = \Input::get('pid');...
php
{ "resource": "" }
q1082
tl_content_elements.setDefaultType
train
public function setDefaultType($value, $dc) { if (!$value) { if ($dc->activeRecord !== null) { $ptable = $dc->activeRecord->ptable; $pid = $dc->activeRecord->pid; } else { return $value; } // Try to find content block elements for the theme $objLayout = \LayoutModel::findBy...
php
{ "resource": "" }
q1083
tl_content_elements.buildPaletteAndFields
train
public function buildPaletteAndFields ($dc) { // Build the content block elements palette and fields only when editing a content element (see #5) if (\Input::get('act') != 'edit' && \Input::get('act') != 'show' && !isset($_GET['target'])) { return; } $intId = (isset($_GET['target'])) ? explode('.', \In...
php
{ "resource": "" }
q1084
tl_content_elements.loadFieldValue
train
public function loadFieldValue ($value, $dc) { if (!empty($value)) { return $value; } if (!empty($GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field]['data'])) { return $GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field]['data']; } return null; }
php
{ "resource": "" }
q1085
tl_content_elements.saveData
train
public function saveData (&$dc) { // Save all modified values foreach ($this->arrModifiedData as $field => $value) { // Get virtual field attributes from DCA $id = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['id']; $pattern = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['pattern']; $pare...
php
{ "resource": "" }
q1086
tl_content_elements.prepareOrderValue
train
public function prepareOrderValue ($value, $dc) { $orderField = $GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field]['eval']['orderField']; $orderData = \StringUtil::deserialize($GLOBALS['TL_DCA']['tl_content']['fields'][$orderField]['data']); $GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field]['eval'][$...
php
{ "resource": "" }
q1087
tl_content_elements.saveOrderValue
train
public function saveOrderValue ($value, $dc) { $orderField = $GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field]['eval']['orderField']; $orderData = \Input::post($orderField); if ($orderData) { // Convert UUID to binary data for file sources if ($GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field...
php
{ "resource": "" }
q1088
tl_content_elements.setAceCodeHighlighting
train
public function setAceCodeHighlighting($value, $dc) { $pattern = $GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field]['pattern']; $highlight = $GLOBALS['TL_DCA']['tl_content']['fields'][$pattern . '-highlight']['data']; if (!empty($highlight)) { $GLOBALS['TL_DCA']['tl_content']['fields'][$dc->field]['eva...
php
{ "resource": "" }
q1089
tl_content_elements.createDataVersion
train
public function createDataVersion ($strTable, $intPid, $intVersion) { $db = Database::getInstance(); $objData = $db->prepare("SELECT * FROM tl_data WHERE pid=?") ->execute($intPid); if ($objData === null) { return; } $db->prepare("INSERT INTO tl_version (pid, tstamp, version, fromTable...
php
{ "resource": "" }
q1090
tl_content_elements.restoreDataVersion
train
public function restoreDataVersion ($strTable, $intPid, $intVersion) { $db = Database::getInstance(); $objData = $db->prepare("SELECT * FROM tl_version WHERE fromTable=? AND pid=? AND version=?") ->execute('tl_data', $intPid, $intVersion); if ($objData->numRows < 1) { return; } $data = \St...
php
{ "resource": "" }
q1091
ProjectEndpoint.convertAvatar
train
public function convertAvatar($projectId, $cropperWidth, $cropperOffsetX, $cropperOffsetY, $needsCropping) { return $this->apiClient->callEndpoint( sprintf('%s/%s/avatar', self::ENDPOINT, $projectId), array( "cropperWidth" => $cropperWidth, "cropperOff...
php
{ "resource": "" }
q1092
ProjectEndpoint.findProperty
train
public function findProperty($projectId, $propertyKey) { return $this->apiClient->callEndpoint(sprintf('%s/%s/properties/%s', self::ENDPOINT, $projectId, $propertyKey)); }
php
{ "resource": "" }
q1093
ProjectEndpoint.findRole
train
public function findRole($projectId, $roleId) { return $this->apiClient->callEndpoint(sprintf('%s/%s/role/%s', self::ENDPOINT, $projectId, $roleId)); }
php
{ "resource": "" }
q1094
ProjectEndpoint.updateRole
train
public function updateRole($projectId, $roleId, $user = null, $group = null) { $parameters = []; if ((is_null($user) && is_null($group)) || (!is_null($user) && !is_null($group))) { throw new EndpointParameterException('User or group should be given'); } elseif (!is_null($user)) {...
php
{ "resource": "" }
q1095
ProjectEndpoint.addRole
train
public function addRole($projectId, $roleId, $user = null, $group = null) { $parameters = []; if ((is_null($user) && is_null($group)) || (!is_null($user) && !is_null($group))) { throw new EndpointParameterException('User or group should be given'); } elseif (!is_null($user)) { ...
php
{ "resource": "" }
q1096
ProjectEndpoint.deleteRole
train
public function deleteRole($projectId, $roleId) { return $this->apiClient->callEndpoint( sprintf('%s/%s/role/%s', self::ENDPOINT, $projectId, $roleId), array(), null, HttpMethod::REQUEST_DELETE ); }
php
{ "resource": "" }
q1097
Time.dontSeeTimeIsInSecs
train
public function dontSeeTimeIsInSecs($time, $seconds) { \PHPUnit_Framework_Assert::assertNotEquals($seconds, $this->_GetNow()->diffInSeconds($this->_ParseDate($time), false)); }
php
{ "resource": "" }
q1098
Time.seeTimeWasInSecs
train
public function seeTimeWasInSecs($time, $seconds) { \PHPUnit_Framework_Assert::assertEquals($seconds, $this->_ParseDate($time)->diffInSeconds($this->_GetNow(), false)); }
php
{ "resource": "" }
q1099
Time.seeTimeIsInMins
train
public function seeTimeIsInMins($time, $minutes) { \PHPUnit_Framework_Assert::assertEquals($minutes, $this->_GetNow()->diffInMinutes($this->_ParseDate($time), false)); }
php
{ "resource": "" }