_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q10600 | ChartIterator.getScripts | train | public function getScripts()
{
$retVal = '';
while ( $this->scripts->valid() ) {
$retVal .= "<script type='text/javascript'>\n{$this->scripts->get()}\n</script>\n"; | php | {
"resource": ""
} |
q10601 | ChartIterator.getLibraries | train | public function getLibraries()
{
$config = \Altamira\Config::getInstance();
$libraryToPath = array(
\Altamira\JsWriter\Flot::LIBRARY => $config['js.flotlib'],
\Altamira\JsWriter\JqPlot::LIBRARY => $config['js.jqplotlib']
);
$libraryKeys = array_unique( array_keys( $this->libraries | php | {
"resource": ""
} |
q10602 | ChartIterator.renderCss | train | public function renderCss()
{
$config = \Altamira\Config::getInstance();
foreach ( $this->libraries as $library => $junk ) {
switch( $library ) {
case \Altamira\JsWriter\Flot::LIBRARY:
break;
case \Altamira\JsWriter\JqPlot::LIBRARY:
default:
$cssPath = $config['css.jqplotpath'];
| php | {
"resource": ""
} |
q10603 | InstallerController.getForm | train | protected function getForm($configPath)
{
$form = null;
$melisConfig = $this->serviceLocator->get('MelisInstallerConfig');
$formConfig = $melisConfig->getItem($configPath);
if ($formConfig) {
$factory = new \Zend\Form\Factory();
$formElements | php | {
"resource": ""
} |
q10604 | InstallerController.systemConfigurationChecker | train | protected function systemConfigurationChecker()
{
$response = [];
$data = [];
$errors = [];
$dataExt = [];
$dataVar = [];
$checkDataExt = 0;
$success = 0;
$translator = $this->getServiceLocator()->get('translator');
$installHelper = $this->getServiceLocator()->get('InstallerHelper');
$installHelper->setRequiredExtensions([
'openssl',
'json',
'pdo_mysql',
'intl',
]);
foreach ($installHelper->getRequiredExtensions() as $ext) {
if (in_array($ext, $installHelper->getPhpExtensions())) {
$dataExt[$ext] = $installHelper->isExtensionsExists($ext);
} else {
$dataExt[$ext] = sprintf($translator->translate('tr_melis_installer_step_1_0_extension_not_loaded'), $ext);
}
}
$dataVar = $installHelper->checkEnvironmentVariables();
// checks if all PHP configuration is | php | {
"resource": ""
} |
q10605 | InstallerController.vHostSetupChecker | train | protected function vHostSetupChecker()
{
$translator = $this->getServiceLocator()->get('translator');
$success = 0;
$error = [];
$platform = null;
$module = null;
if (!empty(getenv('MELIS_PLATFORM'))) {
$platform = getenv('MELIS_PLATFORM');
} else {
$error['platform'] = $translator->translate('tr_melis_installer_step_1_1_no_paltform_declared');
}
if (!empty(getenv('MELIS_MODULE'))) {
$module = getenv('MELIS_MODULE');
} else {
$error['module'] = $translator->translate('tr_melis_installer_step_1_1_no_module_declared');
}
| php | {
"resource": ""
} |
q10606 | InstallerController.checkDirectoryRights | train | protected function checkDirectoryRights()
{
$translator = $this->getServiceLocator()->get('translator');
$installHelper = $this->getServiceLocator()->get('InstallerHelper');
$configDir = $installHelper->getDir('config');
$module = $this->getModuleSvc()->getAllModules();
$success = 0;
$errors = [];
$data = [];
for ($x = 0; $x < count($configDir); $x++) {
$configDir[$x] = 'config/' . $configDir[$x];
}
array_push($configDir, 'config');
/**
* Add config platform, MelisSites and public dir to check permission
*/
array_push($configDir, 'config/autoload/platforms/');
array_push($configDir, 'module/MelisModuleConfig/');
array_push($configDir, 'module/MelisModuleConfig/languages');
array_push($configDir, 'module/MelisModuleConfig/config');
array_push($configDir, 'module/MelisSites/');
array_push($configDir, 'dbdeploy/');
array_push($configDir, 'dbdeploy/data');
array_push($configDir, 'public/');
array_push($configDir, 'cache/');
array_push($configDir, 'test/');
for ($x = 0; $x < count($module); $x++) {
$module[$x] = $this->getModuleSvc()->getModulePath($module[$x], false) . '/config';
}
$dirs = array_merge($configDir, $module);
$results = [];
foreach ($dirs as $dir) {
| php | {
"resource": ""
} |
q10607 | InstallerController.getEnvironments | train | protected function getEnvironments()
{
$env = [];
$container = new Container('melisinstaller');
if (isset($container['environments']) && isset($container['environments']['new'])) { | php | {
"resource": ""
} |
q10608 | InstallerController.getCurrentPlatform | train | protected function getCurrentPlatform()
{
$env = [];
$container = new Container('melisinstaller');
if (isset($container['environments']) && isset($container['environments']['default_environment'])) {
| php | {
"resource": ""
} |
q10609 | InstallerController.checkSysConfigAction | train | public function checkSysConfigAction()
{
$success = 0;
$errors = [];
if ($this->getRequest()->isXmlHttpRequest()) {
$response = $this->systemConfigurationChecker();
$success = $response['success'];
$errors = $response['errors'];
// add status to session
| php | {
"resource": ""
} |
q10610 | InstallerController.checkVhostSetupAction | train | public function checkVhostSetupAction()
{
$success = 0;
$errors = [];
if ($this->getRequest()->isXmlHttpRequest()) {
$response = $this->vHostSetupChecker();
$success = $response['success'];
$errors = $response['errors'];
// add status to session
| php | {
"resource": ""
} |
q10611 | InstallerController.checkFileSystemRightsAction | train | public function checkFileSystemRightsAction()
{
$success = 0;
$errors = [];
if ($this->getRequest()->isXmlHttpRequest()) {
$response = $this->checkDirectoryRights();
$success = $response['success'];
$errors = $response['errors'];
// add status to session
| php | {
"resource": ""
} |
q10612 | InstallerController.rollBackAction | train | public function rollBackAction()
{
$success = 0;
$errors = [];
$installHelper = $this->getServiceLocator()->get('InstallerHelper');
$container = new Container('melisinstaller');
if (!empty($container->getArrayCopy()) && in_array(array_keys($container['steps']), [$this->steps])) {
$tablesInstalled = isset($container['db_install_tables']) ? $container['db_install_tables'] : [];
$siteModule = 'module/MelisSites/' . $container['cms_data']['website_module'] . '/';
$dbConfigFile = 'config/autoload/platforms/' . $installHelper->getMelisPlatform() . '.php';
$config = include($dbConfigFile);
// drop table
$installHelper->setDbAdapter($config['db']);
foreach ($tablesInstalled as $table) {
if ($installHelper->isDbTableExists($table)) {
$installHelper->executeRawQuery("DROP TABLE " . trim($table));
}
}
| php | {
"resource": ""
} |
q10613 | InstallerController.hasMelisCmsModule | train | protected function hasMelisCmsModule()
{
$modulesSvc = $this->getServiceLocator()->get('MelisAssetManagerModulesService');
$modules = $modulesSvc->getAllModules();
$path = $modulesSvc->getModulePath('MelisCms');
| php | {
"resource": ""
} |
q10614 | TextListField.build | train | public function build(ConfigInterface $config, $width, ManialinkInterface $manialink, ManialinkFactory $manialinkFactory): Renderable
{
$input = $this
->uiFactory
->createInput($config->getPath(), '')
->setWidth($width * 0.66);
$addButton = $this->uiFactory
->createButton('Add')
->setWidth($width * 0.33)
->setAction(
$this->actionFactory->createManialinkAction(
$manialink,
function (ManialinkInterface $manialink, $login, $entries, $args) use ($manialinkFactory) {
/** @var TextListConfig $config */
$config = $args['config'];
if (!empty($entries[$config->getPath()])) {
$config->add(trim($entries[$config->getPath()]));
| php | {
"resource": ""
} |
q10615 | TextListField.getElementLine | train | protected function getElementLine($config, $manialink, $element, $width, $manialinkFactory)
{
$label = $this->uiFactory
->createLabel($this->getElementName($element))
->setX(2)
->setWidth($width * 0.66);
$delButton = $this->uiFactory
->createButton('Remove')
->setWidth($width * 0.33)
->setAction(
$this->actionFactory->createManialinkAction(
| php | {
"resource": ""
} |
q10616 | ActionButtons.renderActions | train | private function renderActions()
{
$this->beginButtonGroup();
foreach ($this->visibleActions as $action) {
$label = ArrayHelper::getValue($action, $this->actionLabelProperty, '');
$url = ArrayHelper::getValue($action, $this->actionUrlProperty, null);
$options = ArrayHelper::getValue($action, $this->actionOptionsProperty, []);
// Use $this->buttonClasses as base classes, then override with any classes specified in options
| php | {
"resource": ""
} |
q10617 | ActionButtons.renderActionButton | train | private function renderActionButton()
{
$actionButtonOptions = $this->actionButtonOptions;
Html::addCssClass($actionButtonOptions, $this->linkClasses);
$this->beginButtonGroup();
echo Html::button($this->actionsButtonLabel . $this->caretHtml, $actionButtonOptions);
echo Html::beginTag('ul', ['class' => 'dropdown-menu dropdown-menu-right']);
foreach ($this->visibleActions as $action) {
$label = ArrayHelper::getValue($action, $this->actionLabelProperty, '');
| php | {
"resource": ""
} |
q10618 | File.copy | train | public function copy(string $destination, $overwrite = false) : bool
{
$copied = false;
if ($this->isFile()) {
$exists = file_exists($destination);
if (!$exists || ($exists && $overwrite)) {
| php | {
"resource": ""
} |
q10619 | File.delete | train | public function delete() : bool
{
$removed = null;
if ($this->isDirectory()) {
$removed = rmdir($this->realPath);
} else {
| php | {
"resource": ""
} |
q10620 | File.getSize | train | public function getSize() : int
{
$size = -1;
if ($this->isFile()) { | php | {
"resource": ""
} |
q10621 | File.read | train | public function read()
{
$contents = false;
if ($this->isFile() && $this->isReadable()) | php | {
"resource": ""
} |
q10622 | File.rename | train | public function rename(string $newName) : bool
{
$renamed = rename($this->realPath, $newName);
if ($renamed) {
| php | {
"resource": ""
} |
q10623 | AutoLoad.autoLoad_XmlnukeFramework | train | protected function autoLoad_XmlnukeFramework($className)
{
foreach (AutoLoad::$_folders[AutoLoad::FRAMEWORK_XMLNUKE] as $prefix)
{
// PSR-0 Classes
// convert namespace to full file path
$class = PHPXMLNUKEDIR . $prefix . str_replace('\\', '/', $className);
$class = (
file_exists("$class.php")
? "$class.php"
: (
| php | {
"resource": ""
} |
q10624 | AutoLoad.autoLoad_UserProjects | train | protected function autoLoad_UserProjects($className)
{
$class = str_replace('\\', '/', ($className[0] == '\\' ? substr($className, 1) : $className));
foreach (AutoLoad::$_folders[AutoLoad::USER_PROJECTS] as $libName => $libDir)
{
| php | {
"resource": ""
} |
q10625 | PaymentProcessor.createPayment | train | public function createPayment($gateway)
{
if (!GatewayInfo::isSupported($gateway)) {
user_error(_t(
"PaymentProcessor.INVALID_GATEWAY",
"`{gateway}` is not supported.",
null,
array('gateway' => (string)$gateway)
), E_USER_ERROR);
}
// Create a payment
$this->payment = Payment::create()->init(
$gateway,
| php | {
"resource": ""
} |
q10626 | PaymentProcessor.createServiceFactory | train | public function createServiceFactory()
{
$factory = ServiceFactory::create();
$service = $factory->getService($this->payment, ServiceFactory::INTENT_PAYMENT);
try {
$serviceResponse = $service->initiate($this->getGatewayData());
} catch (Exception $ex) {
| php | {
"resource": ""
} |
q10627 | SfdcResultHydrator.doHydrateList | train | public function doHydrateList(array $list, $parentKey = null)
{
$retVal = parent::doHydrateList($list, $parentKey);
if('Id' === $parentKey)
{
if($retVal->count() > 0)
| php | {
"resource": ""
} |
q10628 | Collection.remove | train | public function remove($key, $remove = true)
{
if ($remove && $this->has($key, self::HAS_EXISTS)) {
$key = $this->normalizeKey($key);
| php | {
"resource": ""
} |
q10629 | Collection.removeEmpty | train | public function removeEmpty($considerEmpty = [''])
{
foreach ($this->all() as $key => $value) {
if (!is_scalar($value) && !is_null($value)) {
| php | {
"resource": ""
} |
q10630 | Collection.sort | train | public function sort($sortBy = self::SORT_BY_KEYS_ASC, $sortFlags = SORT_REGULAR)
{
/** @noinspection SpellCheckingInspection */
$sortFunctions = [
self::SORT_BY_KEYS_ASC => 'ksort',
self::SORT_BY_KEYS_DESC => 'krsort',
| php | {
"resource": ""
} |
q10631 | XSLTheme.generateList | train | private function generateList($caption, $paragraph, $filelist, $xslUsed, $xsl)
{
$paragraph->addXmlnukeObject(new XmlnukeText($caption,true));
$listCollection = new XmlListCollection(XmlListType::UnorderedList );
$paragraph->addXmlnukeObject($listCollection);
foreach($filelist as $file)
{
$xslname = FileUtil::ExtractFileName($file);
$xslname = $xsl->removeLanguage($xslname);
if(!in_array ($xslname, $xslUsed)) | php | {
"resource": ""
} |
q10632 | PathTranslator.translate | train | function translate($path)
{
if(static::isWindowsOS())
{
if(preg_match('%^([A-Z]):(.*)%', $path, $matches))
{
// $path contains something like 'C:' at the start,
// so it's an absolute path from the root.
$drive = $matches[1];
$file = $matches[2];
$unixFile = str_replace('\\', '/', $file);
if(static::isWindowsMsys())
{
$path = '/' . strtolower($drive) . $unixFile;
}
else if(static::isWindowsCygwin())
{
$path = '/cygdrive/' . strtolower($drive) . $unixFile;
| php | {
"resource": ""
} |
q10633 | DebugExtension.definition | train | private function definition(ContainerBuilder $container, $class, $tag, array $arguments = [])
{
$definition = new Definition(strtr(__NAMESPACE__, ['ServiceContainer' => $class]), $arguments);
return $container
| php | {
"resource": ""
} |
q10634 | Container.invoke | train | public function invoke(
$obj,
string $method,
array $params = []
) {
if (is_string($obj)) {
//Attempt to retrieve object from
//the container.
$obj = $this->get($obj);
| php | {
"resource": ""
} |
q10635 | Container.build | train | private function build(string $name)
{
$instance = null;
$map = $this->map[$name];
if (is_array($map)) {
$params = $this->getParamsFromMap($map);
$instance = new $name(...$params);
| php | {
"resource": ""
} |
q10636 | Collections.sort | train | public static function sort(ArrayList &$list, Comparator $comparator)
{
$array = $list->toArray();
| php | {
"resource": ""
} |
q10637 | Config.getPluginPath | train | public function getPluginPath( $library )
{
switch ( $library ) {
case \Altamira\JsWriter\Flot::LIBRARY:
| php | {
"resource": ""
} |
q10638 | Dispatcher.reset | train | public function reset(Map $map)
{
$this->pluginManager->reset($map); | php | {
"resource": ""
} |
q10639 | EventSynchronizer.prepareEntriesToDeliver | train | private function prepareEntriesToDeliver(array $entries)
{
$binaryAttributes = ['objectguid', 'objectsid'];
foreach ($entries as $key => &$entry) {
foreach ($binaryAttributes as $binaryAttribute) {
if (array_key_exists($binaryAttribute, $entry)) {
if (is_array($entry[$binaryAttribute])) {
foreach ($entry[$binaryAttribute] as &$value) {
| php | {
"resource": ""
} |
q10640 | Consumer.consume | train | public function consume($url, Provider $provider = null, $format = self::FORMAT_DEFAULT)
{
if ($this->requestParameters instanceof RequestParameters) {
$cacheKey = sha1($url . json_encode($this->requestParameters->toArray()));
} else {
$cacheKey = sha1($url);
}
// Check if the resource is cached
if ($this->resourceCache->has($cacheKey)) {
return $this->resourceCache->get($cacheKey);
}
try {
// Try to find a provider matching the supplied URL if no one has been supplied.
if (!$provider) {
$provider = $this->findProviderForUrl($url);
}
if ($provider instanceof Provider) {
// If a provider was supplied or we found one, store the endpoint URL.
$endPoint = $provider->getEndpoint();
} else {
// If no provider was found, try to discover the endpoint URL.
$discover = new Discoverer();
| php | {
"resource": ""
} |
q10641 | Consumer.buildOEmbedRequestUrl | train | protected function buildOEmbedRequestUrl($resource, $endPoint, $format = self::FORMAT_DEFAULT)
{
$parameters = [
'url' => $resource,
'format' => $format,
'version' => self::VERSION
];
if ($this->getRequestParameters() !== null) {
$parameters = Arrays::arrayMergeRecursiveOverrule($this->getRequestParameters()->toArray(), $parameters);
| php | {
"resource": ""
} |
q10642 | Consumer.findProviderForUrl | train | protected function findProviderForUrl($url)
{
foreach ($this->providers as $provider) {
| php | {
"resource": ""
} |
q10643 | Radio._checkSelected | train | protected function _checkSelected(array $options, $selectedVal)
{
if (!empty($selectedVal) && !Arr::key($selectedVal, $options)) {
$selectedVal = self::KEY_NO_EXITS_VAL;
| php | {
"resource": ""
} |
q10644 | AdapterTrait.getNewSandBox | train | public function getNewSandBox(callable $action)
{
$errorHandler = $this->getOption('error_reporting');
if ($errorHandler !== null && !is_callable($errorHandler)) {
$errorReporting = $errorHandler;
$errorHandler = function ($number, $message, $file, $line) use ($errorReporting) {
if ($errorReporting & $number) | php | {
"resource": ""
} |
q10645 | AdapterTrait.getSandboxCall | train | private function getSandboxCall(&$source, $method, $path, $input, callable $getSource, array $parameters)
{
return $this->getNewSandBox(function () use (&$source, $method, $path, $input, $getSource, $parameters) {
$adapter = $this->getAdapter();
$cacheEnabled = (
$adapter->hasOption('cache_dir') && $adapter->getOption('cache_dir') ||
$this->hasOption('cache_dir') && $this->getOption('cache_dir')
);
| php | {
"resource": ""
} |
q10646 | DirectAdmin.send | train | private function send(string $method, string $command, array $options = []): array
{
$result | php | {
"resource": ""
} |
q10647 | Select._checkNoSelected | train | protected function _checkNoSelected(array $options, array $selected, $isMultiply = false)
{
if ($isMultiply === 'multiple') {
return array($options, $selected);
}
$_selected = array_pop($selected);
if (!Arr::key($_selected, $options) && !empty($selected)) {
| php | {
"resource": ""
} |
q10648 | Select._createGroup | train | protected function _createGroup($key, array $gOptions, array $selected, array $options)
{
$label = (is_int($key)) ? sprintf($this->_translate('Select group %s'), $key) : $key;
$output = array(
'<optgroup label="' . $this->_translate($label) . '">'
);
foreach ($gOptions as $value => $label) {
if (Arr::key($value, $options)) {
continue;
}
$classes = implode(' ', array(
| php | {
"resource": ""
} |
q10649 | Select._getOptions | train | protected function _getOptions(array $options, array $selected = array(), $isMultiple = false)
{
$output = array();
list($options, $_selected) = $this->_checkNoSelected($options, $selected, $isMultiple);
foreach ($options as $key => $data) {
$label = $data;
$value = $key;
$classes = implode(' ', array(
$this->_jbSrt('option'),
$this->_jbSrt('option-' . Str::slug($value, true)),
));
$isSelected = $this->_isSelected($value, $_selected);
| php | {
"resource": ""
} |
q10650 | Select._option | train | protected function _option($value, $selected = false, $class = '', $label = '')
{
if ($selected === true) {
$selected = ' selected="selected"';
| php | {
"resource": ""
} |
q10651 | FileAdapter.cache | train | public function cache($path, $input, callable $rendered, &$success = null)
{
$cacheFolder = $this->getCacheDirectory();
$destination = $path;
if (!$this->isCacheUpToDate($destination, $input)) {
if (!is_writable($cacheFolder)) {
throw new RuntimeException(sprintf('Cache directory must be writable. "%s" is not.', $cacheFolder), 6);
}
$compiler = $this->getRenderer()->getCompiler();
$fullPath = $compiler->locate($path) ?: $path;
$output = $rendered($fullPath, $input);
| php | {
"resource": ""
} |
q10652 | FileAdapter.displayCached | train | public function displayCached($path, $input, callable $rendered, array $variables, &$success = null)
{
$__pug_parameters = $variables;
$__pug_path = $this->cache($path, $input, $rendered, $success);
call_user_func(function () | php | {
"resource": ""
} |
q10653 | FileAdapter.cacheFileIfChanged | train | public function cacheFileIfChanged($path)
{
$outputFile = $path;
if (!$this->isCacheUpToDate($outputFile)) {
$compiler = $this->getRenderer()->getCompiler();
return $this->cacheFileContents(
$outputFile,
| php | {
"resource": ""
} |
q10654 | FileAdapter.cacheDirectory | train | public function cacheDirectory($directory)
{
$success = 0;
$errors = 0;
$errorDetails = [];
$renderer = $this->getRenderer();
$events = $renderer->getCompiler()->getEventListeners();
foreach ($renderer->scanDirectory($directory) as $inputFile) {
$renderer->initCompiler();
$compiler = $renderer->getCompiler();
$compiler->mergeEventListeners($events);
| php | {
"resource": ""
} |
q10655 | FileAdapter.isCacheUpToDate | train | private function isCacheUpToDate(&$path, $input = null)
{
if (!$input) {
$compiler = $this->getRenderer()->getCompiler();
$input = $compiler->resolve($path);
$path = $this->getCachePath(
($this->getOption('keep_base_name') ? basename($path) : '').
$this->hashPrint($input)
);
// If up_to_date_check never refresh the cache
| php | {
"resource": ""
} |
q10656 | XmlnukePoll.getPollConfig | train | protected function getPollConfig()
{
$pollfile = new AnydatasetFilenameProcessor("_poll");
$anyconfig = new AnyDataset($pollfile->FullQualifiedNameAndPath());
$it = $anyconfig->getIterator();
if ($it->hasNext())
{
$sr = $it->moveNext();
$this->_isdb = $sr->getField("dbname") != "-anydata-";
| php | {
"resource": ""
} |
q10657 | XmlnukePoll.getAnyData | train | protected function getAnyData()
{
$filepoll = new AnydatasetFilenameProcessor("poll_list");
$this->_anyPoll = new AnyDataset($filepoll->FullQualifiedNameAndPath()); | php | {
"resource": ""
} |
q10658 | ToursController.steps | train | public function steps() {
Configure::write('debug', 0);
if (!$this->request->is('ajax') || !$this->request->is('post') ||
!$this->RequestHandler->prefers('json')) { | php | {
"resource": ""
} |
q10659 | FirePHPHandler.write | train | protected function write(array $record)
{
if (!self::$sendHeaders) {
return;
}
// WildFire-specific headers must be sent prior to any messages
if (!self::$initialized) {
self::$initialized = true;
self::$sendHeaders = $this->headersAccepted();
if (!self::$sendHeaders) {
return;
}
foreach ($this->getInitHeaders() as $header => $content) {
| php | {
"resource": ""
} |
q10660 | GuiHandler.displayManialinks | train | protected function displayManialinks()
{
$size = 0;
foreach ($this->getManialinksToDisplay() as $mlData) {
$currentSize = $size;
$size += strlen($mlData['ml']);
if ($currentSize != 0 && $size > $this->charLimit) {
$this->executeMultiCall();
$size = strlen($mlData['ml']);
}
$logins = array_filter($mlData['logins'], function ($value) {
return $value != '';
});
if (!empty($logins)) {
$this->factory->getConnection()->sendDisplayManialinkPage(
$mlData['logins'],
$mlData['ml'],
$mlData['timeout'],
| php | {
"resource": ""
} |
q10661 | GuiHandler.executeMultiCall | train | protected function executeMultiCall()
{
try {
$this->factory->getConnection()->executeMulticall();
} catch (\Exception $e) {
$this->logger->error("Couldn't deliver all manialinks : | php | {
"resource": ""
} |
q10662 | GuiHandler.getManialinksToDisplay | train | protected function getManialinksToDisplay()
{
foreach ($this->displayQueu as $groupName => $manialinks) {
foreach ($manialinks as $factoryId => $manialink) {
$logins = $manialink->getUserGroup()->getLogins();
$this->displayeds[$groupName][$factoryId] = $manialink;
if (!empty($logins)) {
yield ['logins' => $logins, 'ml' => $manialink->getXml(), "timeout" => $manialink->getTimeout()];
}
}
}
foreach ($this->individualQueu as $manialinks) {
// Fetch all logins
$logins = [];
$lastManialink = null;
foreach ($manialinks as $login => $manialink) {
$logins[] = $login;
$lastManialink = $manialink;
}
if ($lastManialink) {
$xml = $manialink->getXml();
| php | {
"resource": ""
} |
q10663 | Button.render | train | public function render($name = '', $content = '', array $attrs = array(), $type = 'submit')
{
$attrs = array_merge(array('text' => null, 'name' => $name), $attrs);
$attrs = $this->_getBtnClasses($attrs);
$attrs['type'] = $type;
if (Arr::key('icon', $attrs)) {
| php | {
"resource": ""
} |
q10664 | Search.CreatePage | train | public function CreatePage()
{
$myWords = $this->WordCollection();
$this->_titlePage = $myWords->Value("TITLE", $this->_context->get("SERVER_NAME") );
$this->_abstractPage = $myWords->Value("ABSTRACT", $this->_context->get("SERVER_NAME") );
$this->_document = new XmlnukeDocument($this->_titlePage, $this->_abstractPage);
$this->txtSearch = | php | {
"resource": ""
} |
q10665 | MapListDataProvider.updateMapList | train | protected function updateMapList()
{
$start = 0;
do {
try {
$maps = $this->factory->getConnection()->getMapList(self::BATCH_SIZE, $start);
} catch (IndexOutOfBoundException $e) {
// This is normal error when we we are trying to find all maps and we are out of bounds.
return;
} catch (NextMapException $ex) {
// this is if no maps defined
| php | {
"resource": ""
} |
q10666 | MapListDataProvider.onMapListModified | train | public function onMapListModified($curMapIndex, $nextMapIndex, $isListModified)
{
if ($isListModified) {
$oldMaps = $this->mapStorage->getMaps();
$this->mapStorage->resetMapData();
$this->updateMapList();
// We will dispatch even only when list is modified. If not we dispatch specific events.
$this->dispatch(__FUNCTION__, [$oldMaps, $curMapIndex, $nextMapIndex, $isListModified]);
}
try {
$currentMap = $this->factory->getConnection()->getCurrentMapInfo(); // sync better
} catch (\Exception $e) {
// fallback to use map storage
$currentMap = $this->mapStorage->getMapByIndex($curMapIndex);
} // current map can be false if map by index is not found..
if ($currentMap) {
if ($this->mapStorage->getCurrentMap()->uId != $currentMap->uId) {
$previousMap = $this->mapStorage->getCurrentMap();
$this->mapStorage->setCurrentMap($currentMap);
$this->dispatch('onExpansionMapChange', [$currentMap, $previousMap]);
}
}
try {
| php | {
"resource": ""
} |
q10667 | PopulateTimeZonesTask.rebuildTitles | train | protected function rebuildTitles()
{
// Update the Title field in the dataobjects. This saves the time to build the title dynamically each time.
foreach (TimeZoneData::get() as $tz) {
$newTitle = $tz->prepareTitle();
| php | {
"resource": ""
} |
q10668 | PopulateTimeZonesTask.message | train | protected function message($text)
{
if (Controller::curr() instanceof DatabaseAdmin) { | php | {
"resource": ""
} |
q10669 | EventsController.ssecfg | train | public function ssecfg() {
Configure::write('debug', 0);
if (!$this->request->is('ajax') || !$this->request->is('post') ||
!$this->RequestHandler->prefers('json')) { | php | {
"resource": ""
} |
q10670 | EventsController.tasks | train | public function tasks() {
$this->response->disableCache();
Configure::write('debug', 0);
if (!$this->request->is('ajax') || !$this->request->is('post') ||
!$this->RequestHandler->prefers('json')) {
throw new BadRequestException();
}
$data = [
'result' => false, | php | {
"resource": ""
} |
q10671 | EventsController.queue | train | public function queue($type = null, $retry = 3000) {
$this->response->disableCache();
Configure::write('debug', 0);
if (!$this->request->is('sse')) {
throw new BadRequestException();
}
$type = (string)$type;
$result = [
'type' => '',
'progress' => 0,
'msg' => '',
'result' => null
];
$event = 'progressBar';
$retry = (int)$retry;
if (empty($type)) {
$data = json_encode($result);
$this->set(compact('retry', 'data', 'event'));
return;
}
$timestamp = null;
$workermaxruntime = (int)Configure::read('Queue.workermaxruntime');
if ($workermaxruntime > 0) {
$timestamp = time() - $workermaxruntime;
}
$jobInfo = $this->ExtendQueuedTask->getPendingJob($type, true, $timestamp);
if (empty($jobInfo)) {
$result['type'] = $type;
$result['result'] = false;
$data = json_encode($result);
$this->set(compact('retry', 'data', 'event'));
return;
}
switch ($jobInfo['ExtendQueuedTask']['status']) {
case 'COMPLETED':
| php | {
"resource": ""
} |
q10672 | CheckInValidator.validate | train | public function validate($ticketCode = null)
{
if (filter_var($ticketCode, FILTER_VALIDATE_URL)) {
$asURL = explode('/', parse_url($ticketCode, PHP_URL_PATH));
$ticketCode = end($asURL);
}
// Check if a code is given to the validator
if (!isset($ticketCode)) {
return $result = array(
'Code' => self::MESSAGE_NO_CODE,
'Message' => self::message(self::MESSAGE_NO_CODE, $ticketCode),
'Type' => self::MESSAGE_TYPE_BAD,
'Ticket' => $ticketCode,
'Attendee' => null
);
}
// Check if a ticket exists with the given ticket code
if (!$this->attendee = Attendee::get()->find('TicketCode', $ticketCode)) {
return $result = array(
'Code' => self::MESSAGE_CODE_NOT_FOUND,
'Message' => self::message(self::MESSAGE_CODE_NOT_FOUND, $ticketCode),
'Type' => self::MESSAGE_TYPE_BAD,
'Ticket' => $ticketCode,
'Attendee' => null
);
} else {
$name = $this->attendee->getName();
}
// Check if the reservation is not canceled
if (!(bool)$this->attendee->Event()->getGuestList()->find('ID', $this->attendee->ID)) {
return $result = array(
'Code' => self::MESSAGE_TICKET_CANCELLED,
'Message' => self::message(self::MESSAGE_TICKET_CANCELLED, $name),
'Type' => self::MESSAGE_TYPE_BAD,
'Ticket' => $ticketCode,
'Attendee' => $this->attendee
);
}
// Check if the ticket is already checked in and not allowed to check out
elseif ((bool)$this->attendee->CheckedIn && !(bool)self::config()->get('allow_checkout')) {
return $result = array(
'Code' => self::MESSAGE_ALREADY_CHECKED_IN,
'Message' => self::message(self::MESSAGE_ALREADY_CHECKED_IN, $name),
'Type' => self::MESSAGE_TYPE_BAD,
'Ticket' => $ticketCode,
| php | {
"resource": ""
} |
q10673 | TypedArray.offsetSet | train | public function offsetSet($index, $newval)
{
if ($newval instanceof $this->type) {
parent::offsetSet($index, $newval);
return;
}
if ($this->allowedTypes[$this->type]($newval)) {
parent::offsetSet($index, $newval);
return;
| php | {
"resource": ""
} |
q10674 | ImageListCommand.buildSearchParameter | train | protected function buildSearchParameter(array $searchFilters)
{
$search = [];
foreach ($searchFilters as $filter) {
$parts = explode(' ', trim($filter), 2);
if (empty($parts) || 2 !== \count($parts)) {
| php | {
"resource": ""
} |
q10675 | ImageListCommand.buildSortParameter | train | protected function buildSortParameter(array $sorts)
{
$sorting = [];
foreach ($sorts as $sort) {
$parts = explode(' ', trim($sort), 2);
if (empty($parts)) {
| php | {
"resource": ""
} |
q10676 | AgentCrud.getAll | train | public final function getAll(string $query, array $queryParams = null, string $fetchClass = | php | {
"resource": ""
} |
q10677 | Registry.hasLogger | train | public static function hasLogger($logger)
{
if ($logger instanceof Logger) {
$index = array_search($logger, self::$loggers, true);
return false !== | php | {
"resource": ""
} |
q10678 | Registry.removeLogger | train | public static function removeLogger($logger)
{
if ($logger instanceof Logger) {
if (false !== ($idx = array_search($logger, self::$loggers, true))) {
| php | {
"resource": ""
} |
q10679 | Registry.getInstance | train | public static function getInstance($name)
{
if (!isset(self::$loggers[$name])) {
throw | php | {
"resource": ""
} |
q10680 | AbstractPipes.unblock | train | protected function unblock()
{
if (!$this->blocked) {
return;
}
foreach ($this->pipes as $pipe) {
| php | {
"resource": ""
} |
q10681 | Discoverer.getEndpointForUrl | train | public function getEndpointForUrl($url)
{
$cacheKey = sha1($url . $this->preferredFormat . json_encode($this->supportedFormats));
if (!isset($this->cachedEndpoints[$url])) {
$this->cachedEndpoints[$url] = $this->fetchEndpointForUrl($url);
if (trim($this->cachedEndpoints[$url]) === '') {
throw new Exception('Empty url endpoints', 1360175845);
| php | {
"resource": ""
} |
q10682 | Discoverer.fetchEndpointForUrl | train | protected function fetchEndpointForUrl($url)
{
$endPoint = null;
try {
$content = $this->browser->getContent($url);
} catch (Exception $exception) {
throw new Exception(
'Unable to fetch the page body for "' . $url . '": ' . $exception->getMessage(),
Exception::PAGE_BODY_FETCH_FAILED
);
}
preg_match_all("/<link rel=\"alternate\"[^>]+>/i",
$content,
$out);
if ($out[0]) {
foreach ($out[0] as $link) {
if (strpos($link, | php | {
"resource": ""
} |
q10683 | FlashHandler.all | train | public function all()
{
return array_merge($this->messages[self::DURABLE | php | {
"resource": ""
} |
q10684 | FlashHandler.load | train | protected function load()
{
$this->reset();
$messages = $this->cookie->get($this->cookieKey);
if ($messages) {
$messages = json_decode($messages, true);
if (!empty($messages[self::DURABLE])) {
$this->messages[self::DURABLE] = $messages[self::DURABLE];
}
| php | {
"resource": ""
} |
q10685 | FlashHandler.reset | train | public function reset()
{
$this->messages = [];
foreach (self::$when | php | {
"resource": ""
} |
q10686 | FlashHandler.save | train | protected function save()
{
$messages = [];
foreach ([self::DURABLE, self::NEXT] as $when) {
if (!empty($this->messages[$when])) {
$messages[$when] = $this->messages[$when];
| php | {
"resource": ""
} |
q10687 | ProcessBuilder.setTimeout | train | public function setTimeout($timeout)
{
if (null === $timeout) {
$this->timeout = null;
return $this;
}
$timeout = (float) | php | {
"resource": ""
} |
q10688 | Poller.setupLogging | train | public function setupLogging(LoggerInterface $logger, array $incrementalAttributesToLog = ['dn'])
{
if (empty($incrementalAttributesToLog)) {
throw new InvalidArgumentException('List of entry attributes to be logged during incremental sync cannot be empty');
| php | {
"resource": ""
} |
q10689 | Poller.poll | train | public function poll($forceFullSync = false)
{
/** @var PollTaskRepository $pollTaskRepository */
$pollTaskRepository = $this->entityManager->getRepository(PollTask::class);
$lastSuccessfulPollTask = $pollTaskRepository->findLastSuccessfulForPoller($this->getName());
$rootDseDnsHostName = $this->fetcher->getRootDseDnsHostName();
$invocationId = $this->fetcher->getInvocationId();
$isFullSyncRequired = $this->isFullSyncRequired($forceFullSync, $lastSuccessfulPollTask, $rootDseDnsHostName, $invocationId);
$highestCommitedUSN = $this->fetcher->getHighestCommittedUSN();
$currentTask = $this->createCurrentPollTask(
$invocationId,
$highestCommitedUSN,
$rootDseDnsHostName,
$lastSuccessfulPollTask,
$isFullSyncRequired
);
$this->entityManager->persist($currentTask);
$this->entityManager->flush();
try {
if ($isFullSyncRequired) {
$fetchedEntriesCount = $this->fullSync($currentTask, $highestCommitedUSN);
| php | {
"resource": ""
} |
q10690 | Poller.createCurrentPollTask | train | protected function createCurrentPollTask($invocationId, $highestCommitedUSN, $rootDseDnsHostName, $lastSuccessfulPollTask, $isFullSync)
{
$currentTask = new PollTask(
$this->name,
$invocationId,
| php | {
"resource": ""
} |
q10691 | Poller.isFullSyncRequired | train | private function isFullSyncRequired($forceFullSync, PollTask $lastSuccessfulSyncTask = null, $currentRootDseDnsHostName, $currentInvocationId)
{
if ($forceFullSync) {
return true;
}
if (!$lastSuccessfulSyncTask) {
return true;
}
if ($lastSuccessfulSyncTask->getRootDseDnsHostName() != | php | {
"resource": ""
} |
q10692 | Poller.fullSync | train | private function fullSync(PollTask $currentTask, $highestCommitedUSN)
{
$entries = $this->fetcher->fullFetch($highestCommitedUSN);
$this->synchronizer->fullSync($this->name, | php | {
"resource": ""
} |
q10693 | Poller.incrementalSync | train | private function incrementalSync(PollTask $currentTask, $usnChangedStartFrom, $highestCommitedUSN)
{
list($changed, $deleted) = $this->fetcher->incrementalFetch($usnChangedStartFrom, $highestCommitedUSN, $this->detectDeleted);
| php | {
"resource": ""
} |
q10694 | Poller.logFullSync | train | private function logFullSync($entries)
{
if ($this->logger) {
| php | {
"resource": ""
} |
q10695 | Poller.logIncrementalSync | train | private function logIncrementalSync($changed, $deleted)
{
if ($this->logger) {
$entriesLogReducer = function ($entry) {
return array_intersect_key($entry, array_flip($this->incrementalAttributesToLog));
};
| php | {
"resource": ""
} |
q10696 | ArrayListTrait.filter | train | public function filter(\Closure $closure)
{
$newInstance = new self();
| php | {
"resource": ""
} |
q10697 | ArrayListTrait.filterByKeys | train | public function filterByKeys(array $keys)
{
/** @noinspection PhpMethodParametersCountMismatchInspection */
$newInstance = new self();
$newInstance->setArray(array_filter($this->array, function ($key) use ($keys) {
| php | {
"resource": ""
} |
q10698 | ArrayListTrait.map | train | public function map(\closure $mapFunction)
{
$newInstance = new self();
| php | {
"resource": ""
} |
q10699 | ArrayListTrait.flatten | train | public function flatten()
{
$flattenedArray = [];
array_walk_recursive($this->array, function ($item) use (&$flattenedArray) {
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.