_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q4400 | User.updateAddress | train | public function updateAddress(array $data, $user)
{
$this->getEventManager()->trigger('updateInfo.pre', $this, array('user' => $user, 'data' => $data));
$form = $this->getServiceManager()->get('playgrounduser_address_form');
$form->bind($user);
$form->setData($data);
$filter = $user->getInputFilter();
| php | {
"resource": ""
} |
q4401 | User.getCSV | train | public function getCSV($array)
{
ob_start(); // buffer the output ...
$out = fopen('php://output', 'w');
fputcsv($out, array_keys($array[0]), ";");
array_shift($array);
foreach ($array as $line) {
fputcsv($out, | php | {
"resource": ""
} |
q4402 | User.getProviderService | train | public function getProviderService()
{
if ($this->providerService == null) {
| php | {
"resource": ""
} |
q4403 | VersionUpdatesCommand.addEnableCommentsField | train | public function addEnableCommentsField()
{
Cache::clear(false, '_cake_model_');
foreach (['Pages', 'Posts'] as $table) {
$Table = $this->loadModel('MeCms.' . $table); | php | {
"resource": ""
} |
q4404 | VersionUpdatesCommand.alterTagColumnSize | train | public function alterTagColumnSize()
{
$Tags = $this->loadModel('MeCms.Tags');
if ($Tags->getSchema()->getColumn('tag')['length'] < | php | {
"resource": ""
} |
q4405 | VersionUpdatesCommand.execute | train | public function execute(Arguments $args, ConsoleIo $io)
{
$this->addEnableCommentsField();
$this->alterTagColumnSize(); | php | {
"resource": ""
} |
q4406 | XMLValidator.getSchemaVersion | train | public static function getSchemaVersion($xml)
{
$doiXML = new \DOMDocument();
$doiXML->loadXML($xml);
$resources = $doiXML->getElementsByTagName('resource');
$theSchema = 'unknown';
if ($resources->length > 0) {
if (isset($resources->item(0)->attributes->item(0)->name)) {
$theSchema = | php | {
"resource": ""
} |
q4407 | XMLValidator.replaceDOIValue | train | public static function replaceDOIValue($doiValue, $xml)
{
$doiXML = new \DOMDocument();
$doiXML->loadXML($xml);
// remove the current identifier
$currentIdentifier = $doiXML->getElementsByTagName('identifier');
for ($i = 0; $i < $currentIdentifier->length; $i++) {
$doiXML
->getElementsByTagName('resource')
->item(0)
->removeChild($currentIdentifier->item($i));
}
// add new identifier to the DOM
$newIdentifier = $doiXML->createElement('identifier', $doiValue);
| php | {
"resource": ""
} |
q4408 | XMLValidator.getDOIValue | train | public static function getDOIValue($xml)
{
$doiXML = new \DOMDocument();
$doiXML->loadXML($xml);
// get the current identifier
| php | {
"resource": ""
} |
q4409 | AdminUserController.showUsers | train | public function showUsers()
{
// Get dependencies
$userMapper = ($this->container->dataMapper)('UserMapper');
// Fetch users
| php | {
"resource": ""
} |
q4410 | Plugin.versions | train | public function versions()
{
$Plugin = new BasePlugin;
$plugins['me_cms'] = trim(file_get_contents($Plugin->path('MeCms', 'version')));
foreach ($Plugin->all(['exclude' => 'MeCms']) as $plugin) {
$file = $Plugin->path($plugin, 'version', true);
$plugins['others'][$plugin] = __d('me_cms', 'n.a.'); | php | {
"resource": ""
} |
q4411 | AbstractCheckup._isWriteable | train | protected function _isWriteable($paths)
{
foreach ((array)$paths as | php | {
"resource": ""
} |
q4412 | DisableElementsCapableFormSettings.setForm | train | public function setForm($formOrContainer)
{
if (!$formOrContainer instanceof FormInterface
&& !$formOrContainer instanceof Container
) {
throw new \InvalidArgumentException('Parameter must be either of | php | {
"resource": ""
} |
q4413 | DisableElementsCapableFormSettings.prepareCheckboxes | train | protected function prepareCheckboxes(array $boxes, $prefix)
{
foreach ($boxes as $box) {
if (is_array($box)) {
$this->prepareCheckboxes($box, $prefix);
} else {
| php | {
"resource": ""
} |
q4414 | DisableElementsCapableFormSettings.createCheckbox | train | protected function createCheckbox($name, $options)
{
$box = new Checkbox($name, $options);
$box->setAttribute('checked', true)
->setAttribute(
| php | {
"resource": ""
} |
q4415 | MenuBuilderHelper.buildLinks | train | protected function buildLinks($links, array $linksOptions = [])
{
return array_map(function ($link) | php | {
"resource": ""
} |
q4416 | MenuBuilderHelper.getMenuMethods | train | protected function getMenuMethods($plugin)
{
//Gets all methods from `$PLUGIN\View\Helper\MenuHelper`
$methods = get_child_methods(sprintf('\%s\View\Helper\MenuHelper', $plugin));
| php | {
"resource": ""
} |
q4417 | MenuBuilderHelper.generate | train | public function generate($plugin)
{
//Gets all menu name methods
$methods = $this->getMenuMethods($plugin);
if (empty($methods)) {
return [];
}
$className = sprintf('%s.Menu', $plugin);
//Loads the helper
$helper = $this->_View->loadHelper($className, compact('className'));
$menus = [];
//Calls dynamically each method
foreach ($methods | php | {
"resource": ""
} |
q4418 | MenuBuilderHelper.renderAsCollapse | train | public function renderAsCollapse($plugin)
{
return implode(PHP_EOL, array_map(function ($menu) {
//Sets the collapse name
$collapseName = 'collapse-' . strtolower(Text::slug($menu['title']));
$titleOptions = optionsParser($menu['titleOptions'], [
'aria-controls' => $collapseName,
'aria-expanded' => 'false',
'class' => 'collapsed',
'data-toggle' => 'collapse',
]);
| php | {
"resource": ""
} |
q4419 | MenuBuilderHelper.renderAsDropdown | train | public function renderAsDropdown($plugin, array $titleOptions = [])
{
return array_map(function ($menu) use ($titleOptions) {
$titleOptions = optionsParser($menu['titleOptions'], $titleOptions);
$links = $this->buildLinks($menu['links'], ['class' => | php | {
"resource": ""
} |
q4420 | FrontBaseController.buildElementsByBlock | train | protected function buildElementsByBlock($elements)
{
if (empty($elements)) {
return $elements;
}
$output = [];
foreach ($elements as $element) {
| php | {
"resource": ""
} |
q4421 | FrontBaseController.buildPageSettings | train | protected function buildPageSettings($settings)
{
if (empty($settings)) {
return $settings;
}
$output = [];
foreach ($settings as $setting) {
| php | {
"resource": ""
} |
q4422 | Email.setFrom | train | public function setFrom($address, $name = null) : EmailInterface
{
// When using mail/sendmail, we need to set the | php | {
"resource": ""
} |
q4423 | Email.setTo | train | public function setTo($address, $name = null) : EmailInterface
{
| php | {
"resource": ""
} |
q4424 | AdminBaseController.mergeSettings | train | public function mergeSettings(array $savedSettings, array $definedSettings)
{
// Test if the saved settings are for site or page. Only site settings have the category key
$pageSetting = isset($savedSettings[0]->category) ? false : true;
// Make index of saved setting keys to setting array for easy lookup
$settingIndex = array_combine(array_column($savedSettings, 'setting_key'), array_keys($savedSettings));
// Loop through defined settings and update with saved values and meta info
foreach ($definedSettings as $defKey => $setting) {
if (isset($settingIndex[$setting->key])) {
$definedSettings[$defKey]->id = $savedSettings[$settingIndex[$setting->key]]->id;
$definedSettings[$defKey]->setting_value = $savedSettings[$settingIndex[$setting->key]]->setting_value;
$definedSettings[$defKey]->created_by = $savedSettings[$settingIndex[$setting->key]]->created_by;
$definedSettings[$defKey]->created_date = $savedSettings[$settingIndex[$setting->key]]->created_date;
$definedSettings[$defKey]->updated_by = $savedSettings[$settingIndex[$setting->key]]->updated_by;
$definedSettings[$defKey]->updated_date = $savedSettings[$settingIndex[$setting->key]]->updated_date;
// Remove saved setting from array parameter now that we have updated the setting definition
unset($savedSettings[$settingIndex[$setting->key]]);
} else {
// If a matching saved setting was NOT found, then set default value
$definedSettings[$defKey]->setting_value = $definedSettings[$defKey]->value;
}
| php | {
"resource": ""
} |
q4425 | AdminBaseController.getPageTemplates | train | public function getPageTemplates(string $templateType = null)
{
$toolbox = $this->container->toolbox;
$json = $this->container->json;
// Validate inputs
if ($templateType !== null && !in_array($templateType, ['page','collection'])) {
throw new Exception("PitonCMS Unexpected $templateType paramter. Expecting 'page' or 'collection'");
}
$jsonPath = ROOT_DIR . "structure/definitions/pages/";
$templates = [];
foreach ($toolbox->getDirectoryFiles($jsonPath) as $row) {
// Get definition files
if (null === $definition = $json->getJson($jsonPath . $row['filename'], 'page')) {
$this->setAlert('danger', 'Page JSON Definition Error', | php | {
"resource": ""
} |
q4426 | Admin.getThemes | train | public function getThemes()
{
$json = $this->container->json;
if (null === $definition = $json->getJson(ROOT_DIR . 'structure/definitions/themes.json', 'themes')) {
throw new Exception('PitonCMS: Get | php | {
"resource": ""
} |
q4427 | Admin.getAlert | train | public function getAlert($context, $key = null)
{
$session = $this->container->sessionHandler;
// Get alert notices from page context, or failing that then session flash data
$alert = (isset($context['alert'])) ? $context['alert'] : $session->getFlashData('alert');
| php | {
"resource": ""
} |
q4428 | Admin.getCollections | train | public function getCollections()
{
if ($this->collections) {
return $this->collections;
}
| php | {
"resource": ""
} |
q4429 | Admin.getGalleries | train | public function getGalleries()
{
if ($this->galleries) {
return $this->galleries;
}
| php | {
"resource": ""
} |
q4430 | Admin.getUnreadMessageCount | train | public function getUnreadMessageCount()
{
$messageMapper = ($this->container->dataMapper)('MessageMapper');
$count | php | {
"resource": ""
} |
q4431 | IntegrationCache.loadOverrides | train | protected function loadOverrides()
{
if ($this->overrides === null) {
$this->overrides = [];
| php | {
"resource": ""
} |
q4432 | ContactUsMailer.contactUsMail | train | public function contactUsMail($data)
{
//Checks that all required data is present
key_exists_or_fail(['email', 'first_name', 'last_name', 'message'], $data);
$this->viewBuilder()->setTemplate('MeCms.Systems/contact_us');
$this->setSender($data['email'], sprintf('%s %s', $data['first_name'], $data['last_name']))
->setReplyTo($data['email'], sprintf('%s %s', $data['first_name'], $data['last_name']))
->setTo(getConfigOrFail('email.webmaster'))
| php | {
"resource": ""
} |
q4433 | AdminCollectionController.showCollections | train | public function showCollections()
{
// Get dependencies
$collectionMapper = ($this->container->dataMapper)('CollectionMapper');
$pageMapper = ($this->container->dataMapper)('PageMapper');
// Fetch collection pages, and chuck pages into sub-array by collection ID with meta info
$collectionPages = $pageMapper->findCollectionPages();
foreach ($collectionPages as $col) {
if (!isset($data['collectionPages'][$col->collection_id])) {
$data['collectionPages'][$col->collection_id]['collection_id'] = $col->collection_id;
$data['collectionPages'][$col->collection_id]['collection_title'] = $col->collection_title;
$data['collectionPages'][$col->collection_id]['collection_slug'] = $col->collection_slug;
}
$data['collectionPages'][$col->collection_id]['pages'][] = $col;
}
// Get available templates and collection groups | php | {
"resource": ""
} |
q4434 | AdminCollectionController.editCollection | train | public function editCollection($args)
{
// Get dependencies
$collectionMapper = ($this->container->dataMapper)('CollectionMapper');
$json = $this->container->json;
$toolbox = $this->container->toolbox;
// Fetch collection group, or create new collection group
if (isset($args['id']) && is_numeric($args['id'])) {
$collection = $collectionMapper->findById($args['id']);
} else {
$definionParam = $this->request->getQueryParam('definition');
// Validate that we have a proper definition file name
if (null === $definionParam || 1 !== preg_match('/^[a-zA-Z0-9]+\.json$/', $definionParam)) {
| php | {
"resource": ""
} |
q4435 | AdminCollectionController.confirmDeleteCollection | train | public function confirmDeleteCollection($args)
{
// Get dependencies
$collectionMapper = ($this->container->dataMapper)('CollectionMapper');
$pageMapper = ($this->container->dataMapper)('PageMapper');
$data = $collectionMapper->findById($args['id']);
| php | {
"resource": ""
} |
q4436 | CallsServices.call | train | public function call(string $service, ...$params)
{
| php | {
"resource": ""
} |
q4437 | AbstractPass.beforeRun | train | protected function beforeRun(array $strings)
{
$this->isOptional = (isset($strings[0]) | php | {
"resource": ""
} |
q4438 | AbstractPass.isSingleCharStringList | train | protected function isSingleCharStringList(array $strings)
{
foreach ($strings as $string)
{
if | php | {
"resource": ""
} |
q4439 | Cookie.logout | train | public function logout()
{
$authService = $this->getServiceManager()->get('zfcuser_auth_service');
$user = $authService->getIdentity();
$cookie = explode("\n", $this->getRememberMeService()->getCookie());
| php | {
"resource": ""
} |
q4440 | Plugin.middleware | train | public function middleware($middleware)
{
$key = Configure::read('Security.cookieKey', md5(Configure::read('Security.salt')));
| php | {
"resource": ""
} |
q4441 | Plugin.setVendorLinks | train | protected function setVendorLinks()
{
$links = array_unique(array_merge(Configure::read('VENDOR_LINKS', []), [
'npm-asset' . DS . 'js-cookie' . DS . 'src' => 'js-cookie',
'sunhater' . DS . 'kcfinder' => 'kcfinder',
| php | {
"resource": ""
} |
q4442 | Plugin.setWritableDirs | train | protected function setWritableDirs()
{
$dirs = array_unique(array_filter(array_merge(Configure::read('WRITABLE_DIRS', []), [
getConfig('Assets.target'),
getConfigOrFail('DatabaseBackup.target'),
getConfigOrFail('Thumber.target'),
BANNERS,
| php | {
"resource": ""
} |
q4443 | UsersController.changePassword | train | public function changePassword()
{
$user = $this->Users->get($this->Auth->user('id'));
if ($this->request->is(['patch', 'post', 'put'])) {
$user = $this->Users->patchEntity($user, $this->request->getData());
if ($this->Users->save($user)) {
//Sends email
$this->getMailer('MeCms.User')->send('changePassword', | php | {
"resource": ""
} |
q4444 | UsersController.changePicture | train | public function changePicture()
{
$id = $this->Auth->user('id');
if ($this->request->getData('file')) {
//Deletes any picture that already exists
foreach (((new Folder(USER_PICTURES))->find($id . '\..+')) as $filename) {
@unlink(USER_PICTURES . $filename);
}
$filename = sprintf('%s.%s', $id, pathinfo($this->request->getData('file')['tmp_name'], PATHINFO_EXTENSION));
$uploaded = $this->Uploader->set($this->request->getData('file'))
->mimetype('image')
->save(USER_PICTURES, $filename);
if (!$uploaded) {
| php | {
"resource": ""
} |
q4445 | UsersController.lastLogin | train | public function lastLogin()
{
//Checks if login logs are enabled
if (!getConfig('users.login_log')) {
$this->Flash->error(I18N_DISABLED);
| php | {
"resource": ""
} |
q4446 | Base.setStyles | train | public function setStyles(OutputInterface $oOutput): void
{
$oWarningStyle = new OutputFormatterStyle('white', 'yellow');
| php | {
"resource": ""
} |
q4447 | Base.confirm | train | protected function confirm($sQuestion, $bDefault)
{
$sQuestion = is_array($sQuestion) ? implode("\n", $sQuestion) : $sQuestion;
$oHelper = $this->getHelper('question');
$sDefault = (bool) $bDefault ? 'Y' : 'N';
| php | {
"resource": ""
} |
q4448 | Base.ask | train | protected function ask($mQuestion, $sDefault)
{
$mQuestion = is_array($mQuestion) ? implode("\n", $mQuestion) : $mQuestion;
$oHelper = $this->getHelper('question');
$oQuestion = | php | {
"resource": ""
} |
q4449 | Base.outputBlock | train | protected function outputBlock(array $aLines, string $sType): void
{
$aLengths = array_map('strlen', $aLines);
$iMaxLength = max($aLengths);
$this->oOutput->writeln('<' . $sType . '> ' . str_pad('', $iMaxLength, ' ') . ' </' . $sType . '>');
foreach ($aLines as $sLine) {
$this->oOutput->writeln('<' | php | {
"resource": ""
} |
q4450 | Base.callCommand | train | protected function callCommand($sCommand, array $aArguments = [], $bInteractive = true, $bSilent = false)
{
$oCmd = $this->getApplication()->find($sCommand);
$aArguments = array_merge(['command' => $sCommand], $aArguments);
$oCmdInput = new ArrayInput($aArguments);
$oCmdInput->setInteractive($bInteractive);
if | php | {
"resource": ""
} |
q4451 | SocialSignOn.getProviders | train | public function getProviders($status = null)
{
if ($status == 'ENABLED') {
return $this->aProviders['enabled'];
} elseif ($status == 'DISABLED') {
| php | {
"resource": ""
} |
q4452 | SocialSignOn.getProvider | train | public function getProvider($provider)
{
if (isset($this->aProviders['all'][strtolower($provider)])) {
| php | {
"resource": ""
} |
q4453 | SocialSignOn.getProviderClass | train | protected function getProviderClass($sProvider)
{
$aProviders = $this->getProviders();
return | php | {
"resource": ""
} |
q4454 | SocialSignOn.authenticate | train | public function authenticate($sProvider, $mParams = null)
{
try {
$sProvider = $this->getProviderClass($sProvider);
return $this->oHybridAuth->authenticate($sProvider, $mParams);
| php | {
"resource": ""
} |
q4455 | SocialSignOn.getUserProfile | train | public function getUserProfile($provider)
{
$oAdapter = $this->authenticate($provider);
try {
| php | {
"resource": ""
} |
q4456 | SocialSignOn.getUserByProviderId | train | public function getUserByProviderId($provider, $identifier)
{
$this->oDb->select('user_id');
$this->oDb->where('provider', $provider);
$this->oDb->where('identifier', $identifier);
$oUser = $this->oDb->get(NAILS_DB_PREFIX . 'user_social')->row();
| php | {
"resource": ""
} |
q4457 | SocialSignOn.restoreSession | train | public function restoreSession($user_id = null)
{
if (empty($user_id)) {
$user_id = activeUser('id');
}
if (empty($user_id)) {
$this->setError('Must specify which user ID\'s session to restore.');
return false;
}
$oUser = $this->oUserModel->getById($user_id);
if (!$oUser) {
$this->setError('Invalid User ID');
return false;
}
// --------------------------------------------------------------------------
// Clean slate
$this->oHybridAuth->logoutAllProviders();
// --------------------------------------------------------------------------
| php | {
"resource": ""
} |
q4458 | SocialSignOn.api | train | public function api($sProvider, $call = '')
{
if (!$this->isConnectedWith($sProvider)) {
$this->setError('Not connected with provider "' . $sProvider . '"');
return false;
}
try {
$sProvider = $this->getProviderClass($sProvider);
$oProvider = $this->oHybridAuth->getAdapter($sProvider); | php | {
"resource": ""
} |
q4459 | ModuleHandle.cacheModuleConfig | train | public function cacheModuleConfig($return=false)
{
$modules = $this->getModulesFromDb();
$arrayModule = array();
foreach($modules as $module) {
if(!in_array($module->folder, $arrayModule))
$arrayModule[] = $module->folder;
}
if($return == false) {
| php | {
"resource": ""
} |
q4460 | ModuleHandle.getModuleConfig | train | public function getModuleConfig($module)
{
Yii::import('mustangostang.spyc.Spyc');
define('DS', DIRECTORY_SEPARATOR);
| php | {
"resource": ""
} |
q4461 | ModuleHandle.deleteModuleDatabase | train | public function deleteModuleDatabase($module)
{
$config = $this->getModuleConfig($module);
$tableName = $config['db_table_name'];
| php | {
"resource": ""
} |
q4462 | ModuleHandle.deleteModuleDb | train | public function deleteModuleDb($module)
{
if($module != null) {
$model = OmmuPlugins::model()->findByAttributes(array('folder'=>$module));
if($model != | php | {
"resource": ""
} |
q4463 | ModuleHandle.setModules | train | public function setModules()
{
$moduleVendorPath = Yii::getPathOfAlias('application.vendor.ommu');
$installedModule = $this->getModulesFromDir();
$cacheModule = file(Yii::getPathOfAlias('application.config').'/cache_module.php');
$toBeInstalled = array();
$caches = array();
foreach($cacheModule as $val) {
$caches[] = trim($val);
}
if(!$installedModule)
$installedModule = array();
foreach($caches as $cache) {
if(!in_array($cache, array_map("trim", $installedModule)))
$this->deleteModuleDb($cache);
}
$moduleDb = $this->cacheModuleConfig(true);
foreach($installedModule as $module) {
$module = trim($module);
if(!in_array($module, array_map("trim", $moduleDb))) {
| php | {
"resource": ""
} |
q4464 | Formatter.fill | train | public function fill($payload)
{
$payload = $this->determineTypeAndMessage($payload);
$payload | php | {
"resource": ""
} |
q4465 | Formatter.fillBlanks | train | public function fillBlanks($payload)
{
$fields = ['doi', 'url', 'message', 'verbosemessage', 'responsecode', 'app_id'];
foreach ($fields as $field) {
| php | {
"resource": ""
} |
q4466 | AttachmentsConfig.setData | train | public function setData(array $data)
{
if (isset($data['attachables'])) {
$this->setAttachables($data['attachables']);
}
if (isset($data['groups'])) {
$this->setGroups($data['groups']);
}
if (isset($data['widgets'])) {
| php | {
"resource": ""
} |
q4467 | AttachmentsConfig.setAttachables | train | public function setAttachables(array $attachables)
{
foreach ($attachables as $attType => $attStruct) {
if (!is_array($attStruct)) {
throw new InvalidArgumentException(sprintf(
'The attachment structure for "%s" must be an array',
$attType
));
}
if (isset($attStruct['attachment_type'])) {
$attType = $attStruct['attachment_type'];
} else {
| php | {
"resource": ""
} |
q4468 | AttachmentsConfig.setGroups | train | public function setGroups(array $groups)
{
foreach ($groups as $groupIdent => $groupStruct) {
if (!is_array($groupStruct)) {
throw new InvalidArgumentException(sprintf(
'The attachment group "%s" must be an array of attachable objects',
$groupIdent
));
}
if (isset($groupStruct['ident'])) {
$groupIdent = $groupStruct['ident'];
| php | {
"resource": ""
} |
q4469 | AttachmentsConfig.setWidgets | train | public function setWidgets(array $widgets)
{
foreach ($widgets as $widgetIdent => $widgetStruct) {
if (!is_array($widgetStruct)) {
throw new InvalidArgumentException(sprintf(
'The attachment widget "%s" must be an array of widget settings',
$widgetIdent
));
}
if (isset($widgetStruct['ident'])) {
$widgetIdent = $widgetStruct['ident'];
| php | {
"resource": ""
} |
q4470 | MergePrefix.getPrefixLength | train | protected function getPrefixLength(array $strings)
{
$len = 1;
$cnt = count($strings[0]); | php | {
"resource": ""
} |
q4471 | MergePrefix.getStringsByPrefix | train | protected function getStringsByPrefix(array $strings)
{
$byPrefix = [];
foreach ($strings as $string)
| php | {
"resource": ""
} |
q4472 | MergePrefix.mergeStrings | train | protected function mergeStrings(array $strings)
{
$len = $this->getPrefixLength($strings);
$newString = array_slice($strings[0], 0, $len);
foreach ($strings as | php | {
"resource": ""
} |
q4473 | MergePrefix.stringsMatch | train | protected function stringsMatch(array $strings, $pos)
{
$value = $strings[0][$pos];
foreach ($strings as $string)
{
| php | {
"resource": ""
} |
q4474 | PostsAndPagesTables.find | train | public function find($type = 'all', $options = [])
{
//Gets from cache the timestamp of the next record to be published
$next = $this->getNextToBePublished();
//If the cache is invalid, it clears the cache and sets the next record
// to be published
if ($next && time() >= $next) { | php | {
"resource": ""
} |
q4475 | NextToBePublishedTrait.setNextToBePublished | train | public function setNextToBePublished()
{
$next = $this->find()
->where([
sprintf('%s.active', $this->getAlias()) => true,
sprintf('%s.created >', $this->getAlias()) => new Time,
| php | {
"resource": ""
} |
q4476 | Types.ensureTypes | train | protected static function ensureTypes()
{
if (self::$doneScanning && count(self::$types) > 0) {
return; | php | {
"resource": ""
} |
q4477 | UsersGroupsController.add | train | public function add()
{
$group = $this->UsersGroups->newEntity();
if ($this->request->is('post')) {
$group = $this->UsersGroups->patchEntity($group, $this->request->getData());
if ($this->UsersGroups->save($group)) {
$this->Flash->success(I18N_OPERATION_OK);
| php | {
"resource": ""
} |
q4478 | UsersGroupsController.edit | train | public function edit($id = null)
{
$group = $this->UsersGroups->get($id);
if ($this->request->is(['patch', 'post', 'put'])) {
$group = $this->UsersGroups->patchEntity($group, $this->request->getData());
if ($this->UsersGroups->save($group)) {
$this->Flash->success(I18N_OPERATION_OK);
| php | {
"resource": ""
} |
q4479 | UsersGroupsController.delete | train | public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$group = $this->UsersGroups->get($id);
//Before deleting, checks if the group is a necessary group or if the group has some users
if ($id > 3 && !$group->user_count) {
$this->UsersGroups->deleteOrFail($group);
| php | {
"resource": ""
} |
q4480 | TicketSettings.getFormData | train | public function getFormData()
{
$data = Client::perform('get-class-values', ['class' => 'client,ticket_settings']);
$this->ticket_emails = $data['ticket_emails'];
| php | {
"resource": ""
} |
q4481 | OmmuPages.getPages | train | public static function getPages($publish=null, $array=true)
{
$criteria=new CDbCriteria;
if($publish != null)
$criteria->compare('t.publish', $publish);
$model = self::model()->findAll($criteria);
if($array == true) {
$items = array();
if($model != | php | {
"resource": ""
} |
q4482 | OmmuMenus.getParentMenu | train | public static function getParentMenu($publish=null, $parent=null, $type=null)
{
$criteria=new CDbCriteria;
if($publish != null)
$criteria->compare('t.publish',$publish);
if($parent != null)
$criteria->compare('t.parent_id',$parent);
| php | {
"resource": ""
} |
q4483 | Io.getResponse | train | public function getResponse($question, $params = array())
{
$params = $this->cleanParamsAndPrintPrompt($question, $params); | php | {
"resource": ""
} |
q4484 | Io.resetOutputLevel | train | public function resetOutputLevel()
{
if (count($this->outputLevelStack) > 0) {
| php | {
"resource": ""
} |
q4485 | Io.getStream | train | private function getStream($type)
{
if (!isset($this->streams[$type])) {
| php | {
"resource": ""
} |
q4486 | UserController.ajaxauthenticateAction | train | public function ajaxauthenticateAction()
{
// $this->getServiceLocator()->get('Zend\Log')->info('ajaxloginAction -
// AUTHENT : ');
if ($this->zfcUserAuthentication()
->getAuthService()
->hasIdentity()) {
return true;
}
$adapter = $this->zfcUserAuthentication()->getAuthAdapter();
$adapter->prepareForAuthentication($this->getRequest());
| php | {
"resource": ""
} |
q4487 | UserController.emailExistsAction | train | public function emailExistsAction()
{
$email = $this->getEvent()->getRouteMatch()->getParam('email');
$request = $this->getRequest();
$response = $this->getResponse();
$user = $this->getUserService()->getUserMapper()->findByEmail($email);
if (empty($user)) {
$result = ['result' => false];
| php | {
"resource": ""
} |
q4488 | UserController.autoCompleteUserAction | train | public function autoCompleteUserAction()
{
$field = $this->getEvent()->getRouteMatch()->getParam('field');
$value = $this->getEvent()->getRouteMatch()->getParam('value');
| php | {
"resource": ""
} |
q4489 | UserController.getPrizeCategoryForm | train | public function getPrizeCategoryForm()
{
if (! $this->prizeCategoryForm) {
$this->setPrizeCategoryForm(
| php | {
"resource": ""
} |
q4490 | UserController.getBlockAccountForm | train | public function getBlockAccountForm()
{
if (! $this->blockAccountForm) {
$this->setBlockAccountForm(
| php | {
"resource": ""
} |
q4491 | UserController.getNewsletterForm | train | public function getNewsletterForm()
{
if (! $this->newsletterForm) {
$this->setNewsletterForm(
| php | {
"resource": ""
} |
q4492 | UserController.getAddressForm | train | public function getAddressForm()
{
if (! $this->addressForm) {
$this->setAddressForm(
| php | {
"resource": ""
} |
q4493 | UserController.getProviderService | train | public function getProviderService()
{
if ($this->providerService == null) {
| php | {
"resource": ""
} |
q4494 | UserController.getHybridAuth | train | public function getHybridAuth()
{
if (!$this->hybridAuth) {
$this->hybridAuth | php | {
"resource": ""
} |
q4495 | Ommu.getDefaultTheme | train | public function getDefaultTheme($type='public')
{
$theme = OmmuThemes::model()->find(array(
'select' => 'folder',
'condition' => 'group_page = :group AND default_theme = :default',
'params' => array(
| php | {
"resource": ""
} |
q4496 | Ommu.getRulePos | train | public static function getRulePos($rules) {
$result = 1;
$before = array();
$after = array();
foreach($rules as $key => $val) {
if($key == '<module:\w+>/<controller:\w+>/<action:\w+>')
break;
$result++;
}
$i = 1;
foreach($rules as $key => $val) {
if($i < $result)
| php | {
"resource": ""
} |
q4497 | Serializer.serializeStrings | train | public function serializeStrings(array $strings)
{
$info = $this->analyzeStrings($strings);
$alternations = array_map([$this, 'serializeString'], $info['strings']);
if (!empty($info['chars']))
{
// Prepend the character class to the list of alternations
| php | {
"resource": ""
} |
q4498 | Serializer.analyzeStrings | train | protected function analyzeStrings(array $strings)
{
$info = ['alternationsCount' => 0, 'quantifier' => ''];
if ($strings[0] === [])
{
$info['quantifier'] = '?';
unset($strings[0]);
}
$chars = $this->getChars($strings);
| php | {
"resource": ""
} |
q4499 | Serializer.getChars | train | protected function getChars(array $strings)
{
$chars = [];
foreach ($strings as | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.