_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q1000
Formatter.onAfterExercise
train
public function onAfterExercise(TestworkEvent\AfterExerciseCompleted $event) {
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,
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' =>
php
{ "resource": "" }
q1003
ConfigurationFetcherRegistry.getFetcher
train
public function getFetcher($alias) { if (!is_string($alias)) { throw new UnexpectedTypeException($alias, 'string'); } if (!isset($this->fetchers[$alias])) {
php
{ "resource": "" }
q1004
Date.seeDateIsInDays
train
public function seeDateIsInDays($date, $days) { \PHPUnit_Framework_Assert::assertEquals($days,
php
{ "resource": "" }
q1005
Date.dontSeeDateIsInDays
train
public function dontSeeDateIsInDays($date, $days) { \PHPUnit_Framework_Assert::assertNotEquals($days,
php
{ "resource": "" }
q1006
Date.seeDateIsInMonths
train
public function seeDateIsInMonths($date, $months) { \PHPUnit_Framework_Assert::assertEquals($months,
php
{ "resource": "" }
q1007
Date.dontSeeDateIsInMonths
train
public function dontSeeDateIsInMonths($date, $months) { \PHPUnit_Framework_Assert::assertNotEquals($months,
php
{ "resource": "" }
q1008
Date.seeDateIsInYears
train
public function seeDateIsInYears($date, $years) { \PHPUnit_Framework_Assert::assertEquals($years,
php
{ "resource": "" }
q1009
Date.dontSeeDateIsInYears
train
public function dontSeeDateIsInYears($date, $years) { \PHPUnit_Framework_Assert::assertNotEquals($years,
php
{ "resource": "" }
q1010
Date.seeDateIsMonday
train
public function seeDateIsMonday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_
php
{ "resource": "" }
q1011
Date.dontSeeDateIsMonday
train
public function dontSeeDateIsMonday($date) { \PHPUnit_Framework_Assert::assertFalse($this
php
{ "resource": "" }
q1012
Date.seeDateIsTuesday
train
public function seeDateIsTuesday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_
php
{ "resource": "" }
q1013
Date.dontSeeDateIsTuesday
train
public function dontSeeDateIsTuesday($date) { \PHPUnit_Framework_Assert::assertFalse($this
php
{ "resource": "" }
q1014
Date.seeDateIsWednesday
train
public function seeDateIsWednesday($date) { \PHPUnit_Framework_Assert::assertTrue($this->
php
{ "resource": "" }
q1015
Date.dontSeeDateIsWednesday
train
public function dontSeeDateIsWednesday($date) { \PHPUnit_Framework_Assert::assertFalse($thi
php
{ "resource": "" }
q1016
Date.seeDateIsThursday
train
public function seeDateIsThursday($date) { \PHPUnit_Framework_Assert::assertTrue($this->
php
{ "resource": "" }
q1017
Date.dontSeeDateIsThursday
train
public function dontSeeDateIsThursday($date) { \PHPUnit_Framework_Assert::assertFalse($thi
php
{ "resource": "" }
q1018
Date.seeDateIsFriday
train
public function seeDateIsFriday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_
php
{ "resource": "" }
q1019
Date.dontSeeDateIsFriday
train
public function dontSeeDateIsFriday($date) { \PHPUnit_Framework_Assert::assertFalse($this
php
{ "resource": "" }
q1020
Date.seeDateIsSaturday
train
public function seeDateIsSaturday($date) { \PHPUnit_Framework_Assert::assertTrue($this->
php
{ "resource": "" }
q1021
Date.dontSeeDateIsSaturday
train
public function dontSeeDateIsSaturday($date) { \PHPUnit_Framework_Assert::assertFalse($thi
php
{ "resource": "" }
q1022
Date.seeDateIsSunday
train
public function seeDateIsSunday($date) { \PHPUnit_Framework_Assert::assertTrue($this->_
php
{ "resource": "" }
q1023
Date.dontSeeDateIsSunday
train
public function dontSeeDateIsSunday($date) { \PHPUnit_Framework_Assert::assertFalse($this
php
{ "resource": "" }
q1024
Date.seeDateMatches
train
public function seeDateMatches($d1, $d2) { \PHPUnit_Framework_Assert::assertTrue($this
php
{ "resource": "" }
q1025
Date.dontSeeDateMatches
train
public function dontSeeDateMatches($d1, $d2) { \PHPUnit_Framework_Assert::assertTrue($th
php
{ "resource": "" }
q1026
Date.seeDateInQuarter
train
public function seeDateInQuarter($date, $quarter) { \PHPUnit_Framework_Assert::assertEqu
php
{ "resource": "" }
q1027
Date.dontSeeDateInQuarter
train
public function dontSeeDateInQuarter($date, $quarter) {
php
{ "resource": "" }
q1028
Date.seeDayInWeek
train
public function seeDayInWeek($date, $day) { \PHPUnit_Framework_Assert::assertEquals($day,
php
{ "resource": "" }
q1029
Date.dontSeeDayInWeek
train
public function dontSeeDayInWeek($date, $day) { \PHPUnit_Framework_Assert::assertNotEqu
php
{ "resource": "" }
q1030
Date.seeDayInMonth
train
public function seeDayInMonth($date, $day) { \PHPUnit_Framework_Assert::assertEqua
php
{ "resource": "" }
q1031
Date.dontSeeDayInMonth
train
public function dontSeeDayInMonth($date, $day) { \PHPUnit_Framework_Assert::assertNot
php
{ "resource": "" }
q1032
Date.seeDayInYear
train
public function seeDayInYear($date, $day) { \PHPUnit_Framework_Assert::assertEquals($day,
php
{ "resource": "" }
q1033
Date.dontSeeDayInYear
train
public function dontSeeDayInYear($date, $day) { \PHPUnit_Framework_Assert::assertNotEqu
php
{ "resource": "" }
q1034
Date.seeWeekInYear
train
public function seeWeekInYear($date, $week) { \PHPUnit_Framework_Assert::assertEquals($week,
php
{ "resource": "" }
q1035
Date.dontSeeWeekInYear
train
public function dontSeeWeekInYear($date, $week) { \PHPUnit_Framework_Assert::assertNotEq
php
{ "resource": "" }
q1036
Date.seeMonthInYear
train
public function seeMonthInYear($date, $month) { \PHPUnit_Framework_Assert::assertEqua
php
{ "resource": "" }
q1037
Date.dontSeeMonthInYear
train
public function dontSeeMonthInYear($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
php
{ "resource": "" }
q1039
Comment.setSubject
train
public function setSubject($subject) { self::validateSubject($subject, true); $this->model_class = $subject->className();
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($subject->primaryKey)
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);
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 WireException("Cannot delete $template->name, because it's fieldgroup is used by at least one other template."); // Remove all pages of that template $selector = "template=$template, include=all,
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', [ 'customer-id' => $customerId, 'username' => $username, 'name' => $name, 'company' => $company, 'address-line-1' => $address, 'city' => $city, 'state'
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', [ 'username' => $username, 'passwd' => $passwd, 'name' => $name, 'company' => $company, 'address-line-1' => $address, 'city' => $city,
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: %s ", $config_location) ); } if ( $path ) { include_once $path;
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, $options); $captcha_snippet .= '<script type="text/javascript" src="'. $this->_buildServerURI() . '"></script> <noscript> <iframe
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 = isset($_POST['recaptcha_response_field']) ? $this->_sanitizeField($_POST['recaptcha_response_field'])
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'=>''); $remote_url = parse_url(self::RECAPTCHA_VERIFY_SERVER); $httpQuery = http_build_query($data); $requestHeader = sprintf( self::RECAPTCHA_HEADER, $remote_url['path'], $remote_url['host'], strlen($httpQuery), $httpQuery); if ( function_exists('fsockopen') ) { $handler = @fsockopen($remote_url['host'], 80, $errno, $errstr, $this->timeout); if( false == ( $handler ) ) { throw new CaptchaException( sprintf('Could not open sock to check reCAPTCHA at %s.', self::RECAPTCHA_VERIFY_SERVER) ); } stream_set_timeout($handler, $this->timeout); fwrite($handler, $requestHeader); $remote_response = stream_get_line($handler, 32, "\n"); if (strpos($remote_response, '200 OK') !== false) { while (!feof($handler)) { $responseHeader .= stream_get_line($handler, 356); } fclose($handler); $responseHeader = str_replace("\r\n", "\n", $responseHeader); $responseHeader = explode("\n\n", $responseHeader); array_shift($responseHeader); $responseHeader = explode("\n", implode("\n\n", $responseHeader));
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='
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($node);
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::$relationships)) { static::$_classRelationships[$className] = array_merge(static::$_classRelationships[$className], $class::$relationships); }
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($options)) {
php
{ "resource": "" }
q1054
RecordValidator.resolveValue
train
protected function resolveValue($field) { $cur = &$this->_record; if (array_key_exists($field, $cur)) { $cur = &$cur[$field];
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 !==
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) {
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);
php
{ "resource": "" }
q1059
Migration.removeFromTemplate
train
protected function removeFromTemplate($template, $field) { $t = $this->getTemplate($template); $f = $this->getField($field); $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);
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=?") ->execute('date', $dc->activeRecord->id); } if ($dc->activeRecord->multiple) { // Reset multiple in database $db->prepare("UPDATE " . $this->table . " SET multiple=? WHERE id=?") ->execute('', $dc->activeRecord->id); } break; case 'color': if (!in_array($dc->activeRecord->rgxp, array('alnum', 'extnd'))) { // Change rgxp in database $db->prepare("UPDATE " .
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 "
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->activeRecord->id); } if ($dc->activeRecord->sortBy != 'html5media') { // Change sortBy in database $db->prepare("UPDATE " . $this->table . " SET sortBy=?
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'])
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->activeRecord->groups;
php
{ "resource": "" }
q1066
tl_pattern.getForms
train
public function getForms() { $arrForms = array(); $objForms = $this->Database->execute("SELECT id, title FROM tl_form
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 DCA $this->loadDataContainer('tl_elements'); // Get the order fields $objDcaExtractor = \DcaExtractor::getInstance('tl_elements'); $arrOrder = $objDcaExtractor->getOrderFields(); // Get all content blocks $objContentBlocks = $this->Database->prepare("SELECT * FROM
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->addDataRow($xml, $table, $objContentPattern->row(), $arrOrder);
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); } // Otherwise, we return all possible combinations
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 ($subsetSize >= $sourceSetSize) { return [$sourceDataSet]; } else if ($subsetSize == 1) { return array_chunk($sourceDataSet, 1, true); } else if ($subsetSize == 0) {
php
{ "resource": "" }
q1071
Combination._getCombination
train
private function _getCombination($sourceDataSet, $setKeyList, Pointer $pointer) { $combination = array(); $indexPointerList = $pointer->getPointerList(); foreach ($indexPointerList as $indexPointer) {
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://github.com/contao/core-bundle/blob/2a85914f4ba858780ffbac38a468acb7028772c7/src/Resources/contao/drivers/DC_Table.php#L3191) if (!empty($this->parent)) { if (isset($GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent])) { $GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] .= ',' . $strVirtualField; } else { $GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = $this->parent; $GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] = $strVirtualField; } } else { $GLOBALS['TL_DCA']['tl_content']['palettes'][$this->alias] .= ',' . $strVirtualField; } */ $GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',' . $strVirtualField; } // Add necessary virtual field callbacks if ($bolCallbacks) { $arrFieldDCA['eval']['doNotSaveEmpty'] = true; $arrFieldDCA['load_callback'] = is_array($arrFieldDCA['load_callback']) ? $arrFieldDCA['load_callback'] : array(); $arrFieldDCA['save_callback'] = is_array($arrFieldDCA['save_callback']) ? $arrFieldDCA['save_callback'] : array();
php
{ "resource": "" }
q1073
Pattern.virtualFieldName
train
protected function virtualFieldName($strFieldName) { $strVirtualField = $this->pattern . '-' .
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(); }
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)
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]); $box[$i]
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,
php
{ "resource": "" }
q1078
CommentQuery.subject
train
public function subject($model) { Comment::validateSubject($model, true); $this->modelClass($model::className());
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']))
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\':735,\'title\':\''.\StringUtil::specialchars(str_replace("'", "\\'",
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'); } // Try to find content block elements for the theme $objLayout = \LayoutModel::findById(\Agoat\CustomContentElementsBundle\Contao\Controller::getLayoutId($ptable, $pid)); $colElements = \ElementsModel::findPublishedByPid($objLayout->pid); $arrElements = array(); $strGroup = 'cte'; if ($colElements !== null) { foreach ($colElements as $objElement) { if ($objElement->type == 'group') {
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::findById(\Agoat\CustomContentElementsBundle\Contao\Controller::getLayoutId($ptable, $pid)); $objDefault = \ElementsModel::findDefaultPublishedElementByPid($objLayout->pid);
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('.', \Input::get('target'))[2] : $dc->id; $objContent = \ContentModel::findByPk($intId); if ($objContent === null) { return; } // Get block element $objElement = \ElementsModel::findOneByAlias($objContent->type); if ($objElement === null) { return; } // Add default palette (for type selection) $GLOBALS['TL_DCA']['tl_content']['palettes'][$objElement->alias] = '{type_legend},type'; // Add pattern to palette $colPattern = \PatternModel::findVisibleByPid($objElement->id); if ($colPattern === null) { return; } $arrData = array(); $colData = \DataModel::findByPid($intId); if ($colData !== null) { foreach ($colData as $objData) { $arrData[$objData->pattern] = $objData; } } foreach($colPattern as $objPattern) {
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']))
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']; $parent = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['parent']; $column = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['column']; if ($id !== null) { $objData = \DataModel::findByPK($id); } else { $objData = \DataModel::findByPidAndPatternAndParent($dc->activeRecord->id, $pattern, $parent); } if ($objData === null) { // if no dataset exist make a new one
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']);
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]['inputType'] == 'fileTree') { $this->arrModifiedData[$orderField] = array_map('\StringUtil::uuidToBin',
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))
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);
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 = \StringUtil::deserialize($objData->data); if (!is_array($data)) { return; } // Get the currently available fields $arrFields
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),
php
{ "resource": "" }
q1092
ProjectEndpoint.findProperty
train
public function findProperty($projectId, $propertyKey) { return
php
{ "resource": "" }
q1093
ProjectEndpoint.findRole
train
public function findRole($projectId, $roleId) { return
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)) { $parameters['user'] = $user; } else { $parameters['group'] = $group; }
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)) { $parameters['user'] = $user; } else { $parameters['group'] = $group; }
php
{ "resource": "" }
q1096
ProjectEndpoint.deleteRole
train
public function deleteRole($projectId, $roleId) { return $this->apiClient->callEndpoint( sprintf('%s/%s/role/%s', self::ENDPOINT, $projectId, $roleId),
php
{ "resource": "" }
q1097
Time.dontSeeTimeIsInSecs
train
public function dontSeeTimeIsInSecs($time, $seconds) { \PHPUnit_Framework_Assert::assertNotEquals($seconds,
php
{ "resource": "" }
q1098
Time.seeTimeWasInSecs
train
public function seeTimeWasInSecs($time, $seconds) { \PHPUnit_Framework_Assert::assertEquals($seconds,
php
{ "resource": "" }
q1099
Time.seeTimeIsInMins
train
public function seeTimeIsInMins($time, $minutes) { \PHPUnit_Framework_Assert::assertEquals($minutes,
php
{ "resource": "" }