_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q10500
ConnectionFactory.build
train
public static function build(string $connectionName = null) : Connection { $configs = Application::current()->config('database'); $connectionName = $connectionName ?: $configs['default']; if (!isset($configs[$connectionName])) { throw new \Exception("Unknown database connection:...
php
{ "resource": "" }
q10501
Http.call
train
public function call($url, $callback, $additionalData = null, $options = []) { $curlJob = $this->factory->createCurlJob($url, $callback, $additionalData, $options); // Start job execution. $this->factory->startJob($curlJob); }
php
{ "resource": "" }
q10502
Http.get
train
public function get($url, callable $callback, $additionalData = null, $options = []) { $defaultOptions = [ CURLOPT_FOLLOWLOCATION => true, CURLOPT_USERAGENT => "eXpansionPluginPack v ".AbstractApplication::EXPANSION_VERSION, ]; $options = $options + $defaultOptions;...
php
{ "resource": "" }
q10503
Http.post
train
public function post($url, $fields, callable $callback, $additionalData = null, $options = []) { $this->doCall("POST", $url, $fields, $callback, $additionalData, $options); }
php
{ "resource": "" }
q10504
Http.process
train
public function process(HttpRequest $curl) { $data = $curl->getData(); $additionalData = $curl->getAdditionalData(); $callback = $additionalData['callback']; unset($additionalData['callback']); $obj = new HttpResult($data['response'], $data['curlInfo'], $curl->getCurlError()...
php
{ "resource": "" }
q10505
LoggerException.addContext
train
public function addContext(array $context) { if ($context) { $this->context = array_merge($this->context, $context); } return $this; }
php
{ "resource": "" }
q10506
JwtController.newTokenAction
train
public function newTokenAction(Request $request, $userClass) { try { $this->get('bengor_user.' . $userClass . '.api_command_bus')->handle( new LogInUserCommand( $request->getUser(), $request->getPassword() ) ); ...
php
{ "resource": "" }
q10507
ElasticaFormatter.getDocument
train
protected function getDocument($record) { $document = new Document(); $document->setData($record); $document->setType($this->type); $document->setIndex($this->index); return $document; }
php
{ "resource": "" }
q10508
CheckoutStepController.init
train
public function init() { // If the step is not a registered step exit if (!in_array($this->step, CheckoutSteps::getSteps())) { $this->redirect($this->Link('/')); } // If no ReservationSession exists redirect back to the base event controller elseif (empty(Reserva...
php
{ "resource": "" }
q10509
CheckoutStepController.Link
train
public function Link($action = null) { if (!$action) { $action = $this->step; } return $this->dataRecord->RelativeLink($action); }
php
{ "resource": "" }
q10510
DateUtil.Validate
train
public static function Validate($date, $format = DATEFORMAT::YMD, $separator = "/") { $timestamp = DateUtil::TimeStampFromStr($date, $format); $dateCheck = DateUtil::FormatDate($timestamp, $format, $separator, true); $date = $date . substr('--/--/---- 00:00:00', strlen($date)); $timestamp2 = DateUtil::TimeSt...
php
{ "resource": "" }
q10511
ScriptsRenderer.get
train
public function get( $withScript = false ) { $retVal = ''; if ( $withScript ) { $retVal .= "<script type='text/javascript'>\n"; } $retVal .= $this->current(); if ( $withScript ) { $retVal .= "\n</script>\n"; } ...
php
{ "resource": "" }
q10512
UserOptionSetField.getValue
train
public function getValue() { if ($option = $this->Options()->byID($this->getField('Value'))) { return $option->Title; } return null; }
php
{ "resource": "" }
q10513
ConvertPrice.setPrice
train
public function setPrice($price, $format = self::EURO) { $this->validatePriceFormat($format); // sanitize: price is null if value like -1.123E-11 provided if (preg_match('/^\-?\d+\.\d+E(\+|\-)\d+$/u', (string) $price)) { $this->price = 0; return $this; } ...
php
{ "resource": "" }
q10514
ConvertPrice.sanitize
train
public function sanitize($price, $format = self::EURO) { return $this->setPrice($price, $format)->getPrice($format); }
php
{ "resource": "" }
q10515
Map.initMxmaps
train
public function initMxmaps($overrideExisting = true) { if (null !== $this->collMxmaps && !$overrideExisting) { return; } $collectionClassName = MxmapTableMap::getTableMap()->getCollectionClassName(); $this->collMxmaps = new $collectionClassName; $this->collMxmap...
php
{ "resource": "" }
q10516
Map.getMxmaps
train
public function getMxmaps(Criteria $criteria = null, ConnectionInterface $con = null) { $partial = $this->collMxmapsPartial && !$this->isNew(); if (null === $this->collMxmaps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collMxmaps) { // retu...
php
{ "resource": "" }
q10517
Map.countMxmaps
train
public function countMxmaps(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collMxmapsPartial && !$this->isNew(); if (null === $this->collMxmaps || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collMxmaps) { ...
php
{ "resource": "" }
q10518
Map.addMxmap
train
public function addMxmap(ChildMxmap $l) { if ($this->collMxmaps === null) { $this->initMxmaps(); $this->collMxmapsPartial = true; } if (!$this->collMxmaps->contains($l)) { $this->doAddMxmap($l); if ($this->mxmapsScheduledForDeletion and $this...
php
{ "resource": "" }
q10519
Services_Webservice.createServer
train
private function createServer() { $server = new SoapServer(null, $this->soapServerOptions); $server->SetClass($this->wsdlclassname); $server->handle(); }
php
{ "resource": "" }
q10520
Services_Webservice.intoStruct
train
protected function intoStruct() { $class = new ReflectionObject($this); $this->classname = $class->getName(); $this->wsdlclassname = str_replace('\\', '.', $class->getName()); $this->classMethodsIntoStruct(); $this->classStructDispatch(); }
php
{ "resource": "" }
q10521
Services_Webservice.classPropertiesIntoStruct
train
protected function classPropertiesIntoStruct($className) { if (!isset($this->wsdlStruct[$className])) { $class = new ReflectionClass($className); $properties = $class->getProperties(); $this->wsdlStruct['class'][$className]['property'] = array(); for ($i = 0; ...
php
{ "resource": "" }
q10522
Services_Webservice.createWSDL_definitions
train
protected function createWSDL_definitions() { /* <definitions name="myService" targetNamespace="urn:myService" xmlns:typens="urn:myService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmln...
php
{ "resource": "" }
q10523
Services_Webservice.createWSDL_types
train
protected function createWSDL_types() { /* <types> <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:myService"/> </types> */ $types = $this->wsdl->createElement('types'); $schema = $this->wsdl->createElement('xsd:schema'); ...
php
{ "resource": "" }
q10524
Services_Webservice.createWSDL_messages
train
protected function createWSDL_messages() { /* <message name="hello"> <part name="i" type="xsd:int"/> <part name="j" type="xsd:string"/> </message> <message name="helloResponse"> <part name="helloResponse" type="xsd:string"/> </message> ...
php
{ "resource": "" }
q10525
Services_Webservice.createWSDL_binding
train
protected function createWSDL_binding() { /* <binding name="myServiceBinding" type="typens:myServicePort"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="hello"> <soap:operation soapAction="urn:myServiceAc...
php
{ "resource": "" }
q10526
Services_Webservice.createWSDL_portType
train
protected function createWSDL_portType() { /* <portType name="myServicePort"> <operation name="hello"> <input message="typens:hello"/> <output message="typens:helloResponse"/> </operation> </portType> */ $portType = $thi...
php
{ "resource": "" }
q10527
Services_Webservice.createWSDL_service
train
protected function createWSDL_service() { /* <service name="myService"> <port name="myServicePort" binding="typens:myServiceBinding"> <soap:address location="http://dschini.org/test1.php"/> </port> </service> */ $service = $this->wsdl->createElement('s...
php
{ "resource": "" }
q10528
AbstractServiceProvider.registerTokenParser
train
protected function registerTokenParser() { $this->app->singleton('tymon.jwt.parser', function ($app) { $parser = new Parser( $app['request'], [ new AuthHeaders, new QueryString, new InputSource, ...
php
{ "resource": "" }
q10529
Dropdown.setSelectedByValue
train
public function setSelectedByValue($value) { $x = 0; foreach ($this->options as $idx => $data) { if ($value == $data) { $this->setSelectedIndex($x); return; } $x++; } $this->setSelectedIndex(-1); }
php
{ "resource": "" }
q10530
ExamplePaymentSlipPdf.writePaymentSlipLines
train
protected function writePaymentSlipLines($elementName, $element) { echo sprintf('Write the element "%s"<br>', $elementName); parent::writePaymentSlipLines($elementName, $element); echo '<br>'; return $this; }
php
{ "resource": "" }
q10531
CostCenterManager.getCostCenterChildrenIds
train
public function getCostCenterChildrenIds($id) { $ids = array(); $this->CostCenter->byParent($id)->each(function($CostCenter) use (&$ids) { if($CostCenter->is_group) { $ids = array_merge($ids, $this->getCostCenterChildrenIds($CostCenter->id)); } array_push($ids, $CostCente...
php
{ "resource": "" }
q10532
CostCenterManager.getCostCenterChildren
train
public function getCostCenterChildren($input) { $CostCenter = $this->CostCenter->byId($input['id']); $costCenterTree = array('text' => $CostCenter->key . ' ' . $CostCenter->name, 'state' => array('opened' => true), 'icon' => 'fa fa-sitemap', 'children' => array()); $this->CostCenter->byParent($input['id...
php
{ "resource": "" }
q10533
Filter._getModelInfoFromField
train
protected function _getModelInfoFromField($field = null, $plugin = null) { $result = false; if (empty($field) || !is_string($field)) { return $result; } if (strpos($field, '.') === false) { return $result; } list($modelName, $fieldName) = pluginSplit($field); if (!empty($plugin)) { $modelName =...
php
{ "resource": "" }
q10534
Filter._parseConditionSign
train
protected function _parseConditionSign($conditionSign = null) { $result = ''; if (empty($conditionSign)) { return $result; } $conditionSign = (string)mb_convert_case($conditionSign, MB_CASE_LOWER); switch ($conditionSign) { case 'gt': $result = '>'; break; case 'ge': $result = '>='; ...
php
{ "resource": "" }
q10535
Filter._parseConditionGroup
train
protected function _parseConditionGroup($condition = null) { $result = 'AND'; if (empty($condition)) { return $result; } $condition = (string)mb_convert_case($condition, MB_CASE_UPPER); if (in_array($condition, ['AND', 'OR', 'NOT'])) { $result = $condition; } return $result; }
php
{ "resource": "" }
q10536
Filter.buildConditions
train
public function buildConditions($filterData = null, $filterConditions = null, $plugin = null, $limit = CAKE_THEME_FILTER_ROW_LIMIT) { $result = []; if (empty($filterData) || !is_array($filterData)) { return $result; } if (!is_array($filterConditions)) { $filterConditions = []; } $conditionsGroup = n...
php
{ "resource": "" }
q10537
Bar.getOptions
train
public function getOptions() { $opts = array(); $first = array(); $second = array(); if ( $this->axisRenderer ) { $first['renderer'] = '#' . $this->axisRenderer . '#'; } if( isset( $this->options['ticks'] ) ) { $first['ticks'] = $this->options['ticks']; } $second['m...
php
{ "resource": "" }
q10538
AdminGroupConfiguration.getGroupPermissions
train
public function getGroupPermissions($groupName) { if (!isset($this->config[$groupName])) { return []; } return array_keys($this->config[$groupName]['permissions']); }
php
{ "resource": "" }
q10539
AdminGroupConfiguration.getGroupLabel
train
public function getGroupLabel($groupName) { if (!isset($this->config[$groupName])) { return ""; } return $this->config[$groupName]['label']->get(); }
php
{ "resource": "" }
q10540
Generate.makeMaintenanceFile
train
public function makeMaintenanceFile() { $filePath = $this->downClass->getFilePath(); $template = __DIR__ .'/.maintenance'; return exec('cat '.$template.' > '.$filePath); }
php
{ "resource": "" }
q10541
Player.updateWithScores
train
public function updateWithScores($scores) { // Update the winner player. if (isset($scores['winnerplayer'])) { $player = $this->getPlayer($scores['winnerplayer']); if ($player) { $this->playerQueryBuilder->save($player); } } // Upd...
php
{ "resource": "" }
q10542
Player.updatePlayer
train
protected function updatePlayer($player) { $time = time(); $upTime = $time - $this->playerLastUpTime[$player->getLogin()]; $this->playerLastUpTime[$player->getLogin()] = $time; $player->setOnlineTime($player->getOnlineTime() + $upTime); }
php
{ "resource": "" }
q10543
Player.getPlayer
train
public function getPlayer($login) { if (isset($this->loggedInPlayers[$login])) { return $this->loggedInPlayers[$login]; } return $this->playerQueryBuilder->findByLogin($login); }
php
{ "resource": "" }
q10544
ChartRenderer.render
train
public static function render( Chart $chart, array $styleOptions = array() ) { if ( empty( self::$rendererChain ) ) { self::pushRenderer( '\Altamira\ChartRenderer\DefaultRenderer' ); } $outputString = ''; for ( $i = count( self::$rendererChain ) - 1; $i >= 0; $i-- ) ...
php
{ "resource": "" }
q10545
ChartRenderer.pushRenderer
train
public static function pushRenderer( $renderer ) { if (! in_array( 'Altamira\ChartRenderer\RendererInterface', class_implements( $renderer ) ) ) { throw new \UnexpectedValueException( "Renderer must be instance of or string name of a class implementing RendererInterface" ); } ar...
php
{ "resource": "" }
q10546
ChartRenderer.unshiftRenderer
train
public static function unshiftRenderer( $renderer ) { if (! in_array( 'Altamira\ChartRenderer\RendererInterface', class_implements( $renderer ) ) ) { throw new \UnexpectedValueException( "Renderer must be instance of or string name of a class implementing RendererInterface" ); } ...
php
{ "resource": "" }
q10547
UserField.createField
train
public function createField($fieldName, $defaultValue = null) { $fieldType = $this->fieldType; $field = $fieldType::create($fieldName, $this->Title, $defaultValue); $field->addExtraClass($this->ExtraClass); $this->extend('updateCreateField', $field); return $field; }
php
{ "resource": "" }
q10548
ManialinkFactory.create
train
public function create($group) { if (is_string($group)) { $group = $this->groupFactory->createForPlayer($group); } else { if (is_array($group)) { $group = $this->groupFactory->createForPlayers($group); } } if (!is_null($this->guiHa...
php
{ "resource": "" }
q10549
ManialinkFactory.update
train
public function update($group) { if (is_string($group)) { $group = $this->groupFactory->createForPlayer($group); } else { if (is_array($group)) { $group = $this->groupFactory->createForPlayers($group); } } $ml = $this->guiHandler->...
php
{ "resource": "" }
q10550
ManialinkFactory.destroy
train
public function destroy(Group $group) { $ml = $this->guiHandler->getManialink($group, $this); if ($ml) { $this->guiHandler->addToHide($ml, $this); } }
php
{ "resource": "" }
q10551
ManialinkFactory.createManialink
train
protected function createManialink(Group $group) { $className = $this->className; return new $className($this, $group, $this->name, $this->sizeX, $this->sizeY, $this->posX, $this->posY); }
php
{ "resource": "" }
q10552
MxKarmaService.connect
train
public function connect($serverLogin, $apikey) { $this->apiKey = $apikey; $this->serverLogin = $serverLogin; if (empty($this->apiKey)) { $this->console->writeln('MxKarma error: You need to define a api key'); return; } if (empty($this->serverLogin))...
php
{ "resource": "" }
q10553
MxKarmaService.loadVotes
train
public function loadVotes($players = array(), $getVotesOnly = false) { if (!$this->connected) { $this->console->writeln('> MxKarma trying to load votes when not connected: $ff0aborting!'); return; } $this->console->writeln('> MxKarma attempting to load votes...'); ...
php
{ "resource": "" }
q10554
Gzip.zip
train
public function zip($sSourceFile, $sDestinationFile=null) { if($sDestinationFile === null) $sDestinationFile = $this->getDefaultDestinationFilename($sSourceFile); if(! ($fh = fopen($sSourceFile, 'rb'))) throw new FileOpenException($sSourceFile); if(! ($zp = gzopen($sDestinationFile, 'wb9'))) throw new...
php
{ "resource": "" }
q10555
Params.error
train
private function error(OutputInterface $output, $message, $args = array()) { /** @noinspection HtmlUnknownTag */ $output->writeln('<error>' . sprintf($message, $args) . '</error>'); exit(0); }
php
{ "resource": "" }
q10556
RequestRememberPasswordController.requestRememberPasswordAction
train
public function requestRememberPasswordAction(Request $request, $userClass) { $form = $this->get('form.factory')->createNamedBuilder('', RequestRememberPasswordType::class, null, [ 'csrf_protection' => false, ])->getForm(); $form->handleRequest($request); if ($form->isVa...
php
{ "resource": "" }
q10557
Session.get
train
public function get($key, $default = null) { if (!$this->id) { throw new Exception('Cannot use get without active session.'); } return array_key_exists($key, $this->data) ? $this->data[$key] : $default; }
php
{ "resource": "" }
q10558
Session.id
train
public function id($id = null) { if ($id) { if (!$this->isValidId($id)) { throw new \InvalidArgumentException('$id may contain only [a-zA-Z0-9-_]'); } if ($this->id) { throw new Exception('Cannot set id while session is active'); ...
php
{ "resource": "" }
q10559
Session.persistedDataExists
train
public function persistedDataExists($id) { if (!$this->id) { $this->handler->open($this->savePath, $this->name); } $ret = (bool)$this->handler->read($id); if (!$this->id) { $this->handler->close(); } return $ret; }
php
{ "resource": "" }
q10560
Session.destroy
train
public function destroy($removeCookie = false) { if ($this->id) { if ($removeCookie) { $this->removeCookie(); } $this->handler->destroy($this->id); $this->handler->close(); $this->id = ''; $this->data = null; ...
php
{ "resource": "" }
q10561
Session.regenerateId
train
public function regenerateId($deleteOldSession = false) { if (headers_sent() || !$this->id) { return false; } $oldId = $this->id; $this->id = IdGenerator::generateSessionId($this->idLength); $this->setCookie($this->name, $this->id); if ($oldId && $deleteOl...
php
{ "resource": "" }
q10562
Session.removeCookie
train
public function removeCookie() { return setcookie( $this->name, '', time() - 86400, $this->cookie_path, $this->cookie_domain, (bool)$this->cookie_secure, (bool)$this->cookie_httponly ); }
php
{ "resource": "" }
q10563
Session.sendStartHeaders
train
protected function sendStartHeaders() { // send optional cache limiter // this is actual session behavior rather than what's documented. $lastModified = self::formatAsGmt(filemtime($_SERVER['SCRIPT_FILENAME'])); $ce = $this->cache_expire; switch ($this->cache_limiter) { ...
php
{ "resource": "" }
q10564
ValidatorDecorator.validate
train
public function validate($value, $constraints = null, $groups = null) { return $this->decoratedValidator->validate($value, $constraints, $groups); }
php
{ "resource": "" }
q10565
ValidatorDecorator.validateProperty
train
public function validateProperty($object, $propertyName, $groups = null) { return $this->decoratedValidator->validateProperty($object, $propertyName, $groups); }
php
{ "resource": "" }
q10566
ValidatorDecorator.validatePropertyValue
train
public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) { return $this->decoratedValidator->validatePropertyValue($objectOrClass, $propertyName, $value, $groups); }
php
{ "resource": "" }
q10567
ViewExtensionComponent.isHtml
train
public function isHtml() { $ext = $this->_controller->request->param('ext'); if (empty($ext)) { return true; } $prefers = $this->_controller->RequestHandler->prefers(); if (empty($prefers)) { $prefers = 'html'; } $responseMimeType = $this->_controller->response->getMimeType($prefers); if (!$resp...
php
{ "resource": "" }
q10568
ViewExtensionComponent._addSpecificResponse
train
protected function _addSpecificResponse(Controller &$controller) { $controller->response->type(['sse' => 'text/event-stream']); $controller->response->type(['mod' => 'text/html']); $controller->response->type(['pop' => 'text/html']); $controller->response->type(['prt' => 'text/html']); }
php
{ "resource": "" }
q10569
ViewExtensionComponent._setUiLangVar
train
protected function _setUiLangVar(Controller &$controller) { $uiLcid2 = $this->_language->getCurrentUiLang(true); $uiLcid3 = $this->_language->getCurrentUiLang(false); $controller->set(compact('uiLcid2', 'uiLcid3')); }
php
{ "resource": "" }
q10570
ViewExtensionComponent._setLayout
train
protected function _setLayout(Controller &$controller) { $isModal = $controller->request->is('modal'); $isPopup = $controller->request->is('popup'); $isSSE = $controller->request->is('sse'); $isPrint = $controller->request->is('print'); if ($isModal || $isPopup || $isSSE) { $controller->layout = 'CakeTheme...
php
{ "resource": "" }
q10571
ViewExtensionComponent._getSessionKeyRedirect
train
protected function _getSessionKeyRedirect($key = null) { if (empty($key)) { $key = $this->_controller->request->here(); } $cacheKey = md5((string)$key); return $cacheKey; }
php
{ "resource": "" }
q10572
ViewExtensionComponent.setRedirectUrl
train
public function setRedirectUrl($redirect = null, $key = null) { if (empty($redirect)) { $redirect = $this->_controller->request->referer(true); } elseif ($redirect === true) { $redirect = $this->_controller->request->here(true); } if (empty($redirect) || $this->_controller->request->is('popup') || $thi...
php
{ "resource": "" }
q10573
ViewExtensionComponent._getRedirectCache
train
protected function _getRedirectCache($key = null) { $cacheKey = $this->_getSessionKeyRedirect($key); $redirect = CakeSession::consume($cacheKey); return $redirect; }
php
{ "resource": "" }
q10574
ViewExtensionComponent.getRedirectUrl
train
public function getRedirectUrl($defaultRedirect = null, $key = null) { $redirect = $this->_getRedirectCache($key); if (empty($redirect)) { if (!empty($defaultRedirect)) { if ($defaultRedirect === true) { $redirect = $this->_controller->request->here(); } else { $redirect = $defaultRedirect; ...
php
{ "resource": "" }
q10575
ViewExtensionComponent.redirectByUrl
train
public function redirectByUrl($defaultRedirect = null, $key = null) { $redirectUrl = $this->getRedirectUrl($defaultRedirect, $key); return $this->_controller->redirect($redirectUrl); }
php
{ "resource": "" }
q10576
ViewExtensionComponent._setLocale
train
protected function _setLocale() { $language = $this->_language->getCurrentUiLang(false); return (bool)setlocale(LC_ALL, $language); }
php
{ "resource": "" }
q10577
ViewExtensionComponent.setProgressSseTask
train
public function setProgressSseTask($taskName = null) { if (empty($taskName)) { return false; } $tasks = (array)CakeSession::read('SSE.progress'); if (in_array($taskName, $tasks)) { return true; } $tasks[] = $taskName; return CakeSession::write('SSE.progress', $tasks); }
php
{ "resource": "" }
q10578
ViewExtensionComponent.setExceptionMessage
train
public function setExceptionMessage($message = '', $defaultRedirect = null, $key = null) { $statusCode = null; $redirectUrl = null; if ($message instanceof Exception) { if ($this->_controller->request->is('ajax')) { $statusCode = $message->getCode(); } } if (empty($statusCode)) { $this->_controll...
php
{ "resource": "" }
q10579
ScriptSettingsWindowFactory.callbackApply
train
public function callbackApply(ManialinkInterface $manialink, $login, $entries, $args) { /** @var GridBuilder $grid */ $grid = $manialink->getData('grid'); $grid->updateDataCollection($entries); // update datacollection // build settings array from datacollection $settings = ...
php
{ "resource": "" }
q10580
ScriptSettingsWindowFactory.fetchScriptSettings
train
public function fetchScriptSettings() { $data = []; $scriptSettings = $this->factory->getConnection()->getModeScriptSettings(); /** * @var string $i */ $i = 1; foreach ($scriptSettings as $name => $value) { $data[] = [ 'index' =...
php
{ "resource": "" }
q10581
DedimaniaService.processRecord
train
public function processRecord($login, $score, $checkpoints) { if ($this->enabled->get() == false) { return false; } if ($this->isDisabled()) { return false; } $tempRecords = $this->recordsByLogin; $tempPositions = $this->ranksByLogin; ...
php
{ "resource": "" }
q10582
VoteManager.onVoteNew
train
public function onVoteNew(Player $player, $cmdName, $cmdValue) { if ($cmdValue instanceof Vote) { $this->updateVoteWidgetFactory->create($this->players); $this->voteWidgetFactory->create($this->players); } else { $this->voteService->startVote($player, $cmdName, ['...
php
{ "resource": "" }
q10583
VoteManager.onVoteCancelled
train
public function onVoteCancelled(Player $player, $cmdName, $cmdValue) { if ($cmdValue instanceof Vote) { $this->voteWidgetFactory->destroy($this->players); $this->updateVoteWidgetFactory->destroy($this->players); } else { $this->voteService->cancel(); } ...
php
{ "resource": "" }
q10584
VoteManager.onVoteNo
train
public function onVoteNo(Player $player, $vote) { if ($this->voteService->getCurrentVote() instanceof AbstractVotePlugin) { $this->updateVoteWidgetFactory->updateVote($vote); } }
php
{ "resource": "" }
q10585
MoveBehavior._getBehaviorConfig
train
protected function _getBehaviorConfig(Model $model, $configParam = null) { if (empty($configParam) || !isset($model->Behaviors->Tree->settings[$model->alias][$configParam])) { return null; } $result = $model->Behaviors->Tree->settings[$model->alias][$configParam]; return $result; }
php
{ "resource": "" }
q10586
MoveBehavior._changeParent
train
protected function _changeParent(Model $model, $id = null, $parentId = null) { $parentField = $this->_getBehaviorConfig($model, 'parent'); if (empty($id) || ($parentField === null)) { return false; } $model->recursive = -1; $treeItem = $model->read(null, $id); if (empty($treeItem)) { return false; ...
php
{ "resource": "" }
q10587
MoveBehavior._getSubTree
train
protected function _getSubTree(Model $model, $id = null) { $result = []; $parentField = $this->_getBehaviorConfig($model, 'parent'); $leftField = $this->_getBehaviorConfig($model, 'left'); if (($parentField === null) || ($leftField === null)) { return $result; } $conditions = [ $model->alias . '.' . ...
php
{ "resource": "" }
q10588
MoveBehavior.moveItem
train
public function moveItem(Model $model, $direct = null, $id = null, $delta = 1) { $direct = mb_strtolower($direct); $delta = (int)$delta; if (in_array($direct, ['up', 'down']) && ($delta < 0)) { throw new InternalErrorException(__d('view_extension', 'Invalid delta for moving record')); } if (!in_array($dir...
php
{ "resource": "" }
q10589
MoveBehavior.moveDrop
train
public function moveDrop(Model $model, $id = null, $newParentId = null, $oldParentId = null, $dropData = null) { if (empty($id)) { return false; } $changeRoot = false; $dataSource = $model->getDataSource(); $dataSource->begin(); if ($newParentId != $oldParentId) { $changeRoot = true; if (!$this->_...
php
{ "resource": "" }
q10590
Assets._wp_oembed_blog_card_render
train
public function _wp_oembed_blog_card_render() { if ( empty( $_GET['url'] ) ) { return; } header( 'Content-Type: text/html; charset=utf-8' ); $url = esc_url_raw( wp_unslash( $_GET['url'] ) ); echo wp_kses_post( View::get_template( $url ) ); die(); }
php
{ "resource": "" }
q10591
PeriodManager.getLastPeriodOfFiscalYear
train
public function getLastPeriodOfFiscalYear(array $input) { $period = $this->Period->lastPeriodbyOrganizationAndByFiscalYear($this->AuthenticationManager->getCurrentUserOrganizationId(), $input['id'])->toArray(); $period['endDate'] = $this->Carbon->createFromFormat('Y-m-d', $period['end_date'])->format($this->...
php
{ "resource": "" }
q10592
PeriodManager.getCurrentMonthPeriod
train
public function getCurrentMonthPeriod($organizationId = null) { if(empty($organizationId)) { $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id'); } $fiscalYearId = $this->FiscalYear->lastFiscalYearByOrganization($organizationId); $Date = new Carbon('first day o...
php
{ "resource": "" }
q10593
PeriodManager.getPeriodByDateAndByOrganizationId
train
public function getPeriodByDateAndByOrganizationId($date, $organizationId = null, $databaseConnectionName = null) { if(empty($organizationId)) { $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id'); } return $this->Period->periodByDateAndByOrganizationId($date, $orga...
php
{ "resource": "" }
q10594
PeriodManager.getBalanceAccountsClosingPeriods
train
public function getBalanceAccountsClosingPeriods(array $input) { $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id'); $fiscalYearId = $this->FiscalYear->lastFiscalYearByOrganization($organizationId); if($fiscalYearId == $input['id']) { return json_encode(array('inf...
php
{ "resource": "" }
q10595
PeriodManager.openPeriod
train
public function openPeriod(array $input) { $this->DB->transaction(function() use ($input) { $loggedUserId = $this->AuthenticationManager->getLoggedUserId(); $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id'); $Period = $this->Period->byId($input['id']); $...
php
{ "resource": "" }
q10596
PeriodManager.closePeriod
train
public function closePeriod(array $input) { $canBeClosed = true; $this->DB->transaction(function() use ($input, &$canBeClosed) { $loggedUserId = $this->AuthenticationManager->getLoggedUserId(); $organizationId = $this->AuthenticationManager->getCurrentUserOrganization('id'); if($this->...
php
{ "resource": "" }
q10597
OAuthRequest.get_signable_parameters
train
public function get_signable_parameters() {/*{{{*/ // Grab all parameters $params = $this->parameters; // Remove oauth_signature if present if (isset($params['oauth_signature'])) { unset($params['oauth_signature']); } // Urlencode both keys and values $keys = OAuthUtil::urlencode_rfc...
php
{ "resource": "" }
q10598
OAuthRequest.to_postdata
train
public function to_postdata() {/*{{{*/ $total = array(); foreach ($this->parameters as $k => $v) { if (is_array($v)) { foreach ($v as $va) { $total[] = OAuthUtil::urlencode_rfc3986($k) . "[]=" . OAuthUtil::urlencode_rfc3986($va); } } else { $total[] = OAuthUtil::url...
php
{ "resource": "" }
q10599
EmbeddedEntityListAttribute.buildValidationRules
train
protected function buildValidationRules() { $rules = new RuleList(); $options = $this->getOptions(); $options[self::OPTION_ENTITY_TYPES] = $this->getEmbeddedEntityTypeMap(); $rules->push( new EmbeddedEntityListRule('valid-embedded-entity-list-data', $options) );...
php
{ "resource": "" }