_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q23200
BitmapFormat.getDefaultPngCompressionLevel
train
public function getDefaultPngCompressionLevel() { $result = $this->config->get('concrete.misc.default_png_image_compression'); if ($this->valn->integer($result, 0, 9)) { $result = (int) $result; } else { $result = static::DEFAULT_PNG_COMPRESSIONLEVEL; } ...
php
{ "resource": "" }
q23201
BitmapFormat.normalizeFormat
train
protected function normalizeFormat($format) { $format = strtolower(trim((string) $format)); if ($format === 'jpg') { $format = static::FORMAT_JPEG; } return $format; }
php
{ "resource": "" }
q23202
RequestMediaTypeParser.isMediaTypeSupported
train
public function isMediaTypeSupported($mediaType, $minWeight = null) { $data = $this->getMediaTypeData($mediaType); if ($minWeight === null) { return $data !== []; } $minWeight = (float) $minWeight; foreach ($data as $item) { if ($item['q'] >= $minWeigh...
php
{ "resource": "" }
q23203
RequestMediaTypeParser.getMediaTypeData
train
public function getMediaTypeData($mediaType) { $map = $this->getRequestAcceptMap(); list($type, $subType) = $this->normalizeMediaType($mediaType); $result = []; foreach ($this->getMediaTypeAlternatives($type, $subType) as $alternative) { if (isset($map[$alternative])) { ...
php
{ "resource": "" }
q23204
RequestMediaTypeParser.getRequestAcceptMap
train
public function getRequestAcceptMap() { if ($this->requestAcceptMap === null) { $requestAccept = $this->getRequestAccept(); $requestAcceptMap = $this->parseRequestAccept($requestAccept); $requestAcceptMap = $this->sortRequestAcceptMap($requestAcceptMap); $this...
php
{ "resource": "" }
q23205
RequestMediaTypeParser.getRequestAccept
train
protected function getRequestAccept() { $accept = $this->request->headers->get('accept'); if (!is_string($accept)) { return ''; } return trim($accept); }
php
{ "resource": "" }
q23206
FeedService.load
train
public function load($url, $cache = 3600) { if ($cache !== false) { Reader::setCache(new ZendCacheDriver('cache/expensive', $cache)); } // Load the RSS feed, either from remote URL or from cache // (if specified above and still fresh) $feed = Reader::import($url)...
php
{ "resource": "" }
q23207
Redirect.createRedirectResponse
train
protected static function createRedirectResponse($url, $code, $headers) { $r = new RedirectResponse($url, $code, $headers); $r->setRequest(Request::getInstance()); return $r; }
php
{ "resource": "" }
q23208
Redirect.to
train
public static function to() { // Is what we're providing a URL object? $args = func_get_args(); if (is_object($args[0]) && $args[0] instanceof UrlInterface) { $url = $args[0]; } else { $url = call_user_func_array('\URL::to', func_get_args()); } ...
php
{ "resource": "" }
q23209
Redirect.page
train
public static function page(Page $c, $code = 302, $headers = array()) { if ($c->getCollectionPath()) { $url = Core::make('helper/navigation')->getLinkToCollection($c, true); } else { $url = \URL::to($c); } $r = static::createRedirectResponse((string) $url, $co...
php
{ "resource": "" }
q23210
ItemList.getTotal
train
public function getTotal() { if ($this->total == -1) { $this->total = count($this->items); } return $this->total; }
php
{ "resource": "" }
q23211
ItemList.getPage
train
public function getPage($page = false) { $this->setCurrentPage($page); $offset = 0; if ($this->currentPage > 1) { $offset = min($this->itemsPerPage * ($this->currentPage - 1), 2147483647); } return $this->get($this->itemsPerPage, $offset); }
php
{ "resource": "" }
q23212
ItemList.displaySummary
train
public function displaySummary($right_content = '') { if ($this->getTotal() < 1) { return false; } $summary = $this->getSummary(); if ($summary->currentEnd == -1) { $html = '<div class="ccm-paging-top">'. t('Viewing <b>%s</b> to <b>%s</b> (<b>%s</b> Total)', $...
php
{ "resource": "" }
q23213
ItemList.displayPagingV2
train
public function displayPagingV2($script = false, $return = false, $additionalVars = array()) { $summary = $this->getSummary(); $paginator = $this->getPagination($script, $additionalVars); if ($summary->pages > 1) { $html = ''; $html .= '<div class="ccm-search-results-...
php
{ "resource": "" }
q23214
ItemList.displayPaging
train
public function displayPaging($script = false, $return = false, $additionalVars = array()) { $summary = $this->getSummary(); $paginator = $this->getPagination($script, $additionalVars); if ($summary->pages > 1) { $html = '<div class="ccm-spacer"></div>'; $html .= '<di...
php
{ "resource": "" }
q23215
ItemList.getSummary
train
public function getSummary() { $ss = new \stdClass(); $ss->chunk = $this->itemsPerPage; $ss->order = $this->sortByDirection; $ss->startAt = $this->start; $ss->total = $this->getTotal(); $ss->startAt = ($ss->startAt < $ss->chunk) ? '0' : $ss->startAt; $itc = ...
php
{ "resource": "" }
q23216
ServiceCommand.parseRuleOptions
train
protected function parseRuleOptions(InputInterface $input) { $ruleOptions = []; foreach ($input->getArgument('rule-options') as $keyValuePair) { list($key, $value) = explode('=', $keyValuePair, 2); $key = trim($key); if (substr($key, -2) === '[]') { ...
php
{ "resource": "" }
q23217
Configuration.forceMaxInitialMigration
train
public function forceMaxInitialMigration() { $forcedInitialMigration = null; foreach (array_reverse($this->getMigrations()) as $migration) { /* @var \Doctrine\DBAL\Migrations\Version $migration */ if ($migration->isMigrated() && !$migration->getMigration() instanceof Repeatab...
php
{ "resource": "" }
q23218
Configuration.forceInitialMigration
train
public function forceInitialMigration($reference, $criteria = self::FORCEDMIGRATION_INCLUSIVE) { $reference = trim((string) $reference); if ($reference === '') { throw new Exception(t('Invalid initial migration reference.')); } if (!in_array($criteria, [static::FORCEDMIGR...
php
{ "resource": "" }
q23219
Configuration.registerPreviousMigratedVersions
train
public function registerPreviousMigratedVersions() { $app = Application::getFacadeApplication(); $db = $app->make(Connection::class); try { $minimum = $db->fetchColumn('select min(version) from SystemDatabaseMigrations'); } catch (Exception $e) { return; ...
php
{ "resource": "" }
q23220
Configuration.findInitialMigrationByCoreVersion
train
protected function findInitialMigrationByCoreVersion($coreVersion, $criteria) { $coreVersionNormalized = preg_replace('/(\.0+)+$/', '', $coreVersion); if (version_compare($coreVersionNormalized, '5.7') < 0) { throw new Exception(t('Invalid version specified (%s).', $coreVersion)); ...
php
{ "resource": "" }
q23221
SitemapPageAlternativeLanguage.getFinalHrefLang
train
protected function getFinalHrefLang() { $result = $this->getOverriddenHrefLang(); if ($result === '') { $result = strtolower(str_replace('_', '-', $this->getSection()->getLocale())); } return $result; }
php
{ "resource": "" }
q23222
Gathering.generateGatheringItems
train
public function generateGatheringItems() { $configuredDataSources = $this->getConfiguredGatheringDataSources(); $items = array(); foreach ($configuredDataSources as $configuration) { $dataSource = $configuration->getGatheringDataSourceObject(); $dataSourceItems = $dat...
php
{ "resource": "" }
q23223
Comparator.areEqual
train
public function areEqual(RepetitionInterface $r1, RepetitionInterface $r2) { if ($r1->getStartDate() != $r2->getStartDate()) { return false; } if ($r1->getTimezone()->getName() != $r2->getTimezone()->getName()) { return false; } if ($r1->getEndDate()...
php
{ "resource": "" }
q23224
ThumbnailMiddleware.process
train
public function process(Request $request, DelegateInterface $frame) { $response = $frame->next($request); if ($response && $this->app->isInstalled() && $this->config->get('concrete.misc.basic_thumbnailer_generation_strategy') == 'now') { $responseStatusCode = (int) $response->getStatusC...
php
{ "resource": "" }
q23225
ThumbnailMiddleware.generateThumbnail
train
private function generateThumbnail(array $thumbnail) { $file = $this->getEntityManager()->find(File::class, $thumbnail['fileID']); if ($this->attemptBuild($file, $thumbnail)) { $result = true; } else { $this->failBuild($file, $thumbnail); $result = false;...
php
{ "resource": "" }
q23226
ThumbnailMiddleware.markThumbnailAsBuilt
train
private function markThumbnailAsBuilt(Connection $connection, array $thumbnail, $built = true) { $key = $thumbnail; unset($key['lockID']); unset($key['lockExpires']); unset($key['path']); unset($key['isBuilt']); $connection->update('FileImageThumbnailPaths', ['isBuilt...
php
{ "resource": "" }
q23227
ThumbnailMiddleware.failBuild
train
private function failBuild(File $file, array $thumbnail) { $this->app->make(LoggerInterface::class) ->critical('Failed to generate or locate the thumbnail for file "' . $file->getFileID() . '"'); }
php
{ "resource": "" }
q23228
View.action
train
public function action($action) { $a = func_get_args(); $controllerPath = $this->controller->getControllerActionPath(); array_unshift($a, $controllerPath); $ret = call_user_func_array([$this, 'url'], $a); return $ret; }
php
{ "resource": "" }
q23229
View.loadViewThemeObject
train
protected function loadViewThemeObject() { $env = Environment::get(); $app = Facade::getFacadeApplication(); $tmpTheme = $app->make(ThemeRouteCollection::class) ->getThemeByRoute($this->getViewPath()); if (isset($tmpTheme[0])) { $this->themeHandle = $tmpTheme[...
php
{ "resource": "" }
q23230
AutomatedLogout.view
train
public function view() { $this->set('trustedProxyUrl', $this->urls->resolve(['/dashboard/system/permissions/trusted_proxies'])); $this->set('invalidateOnIPMismatch', $this->config->get(self::ITEM_IP)); $this->set('invalidateOnUserAgentMismatch', $this->config->get(self::ITEM_USER_AGENT)); ...
php
{ "resource": "" }
q23231
AutomatedLogout.save
train
public function save() { if (!$this->token->validate('save_automated_logout')) { $this->error->add($this->token->getErrorMessage()); $this->flash('error', $this->error); // Redirect away from this save endpoint return $this->factory->redirect($this->action()...
php
{ "resource": "" }
q23232
AutomatedLogout.invalidate_sessions
train
public function invalidate_sessions($token = '') { if (!$this->token->validate('invalidate_sessions', $token)) { $this->error->add($this->token->getErrorMessage()); $this->flash('error', $this->error); // Redirect away from this save endpoint return $this->f...
php
{ "resource": "" }
q23233
AutomatedLogout.invalidateSessions
train
protected function invalidateSessions() { // Save the configuration that invalidates sessions $this->config->save(self::ITEM_SESSION_INVALIDATE, Carbon::now('utc')->getTimestamp()); // Invalidate the current session explicitly so that we get back to the login page with a nice error message ...
php
{ "resource": "" }
q23234
GlobalVersionList.filterByApprovedAfter
train
public function filterByApprovedAfter(\DateTime $date) { $this->query->andWhere( 'cv.cvDateApproved >= ' . $this->query->createNamedParameter($date->format('Y-m-d H:i-s')) ); }
php
{ "resource": "" }
q23235
GlobalVersionList.filterByApprovedBefore
train
public function filterByApprovedBefore(\DateTime $date) { $this->query->andWhere( 'cv.cvDateApproved <= ' . $this->query->createNamedParameter($date->format('Y-m-d H:i-s')) ); }
php
{ "resource": "" }
q23236
StorageLocationFactory.persist
train
public function persist(StorageLocationEntity $storageLocation) { return $this->entityManager->transactional(function (EntityManagerInterface $em) use ($storageLocation) { if ($storageLocation->isDefault()) { $qb = $em->createQueryBuilder()->update(StorageLocationEntity::class, '...
php
{ "resource": "" }
q23237
UserServiceProvider.bindContainer
train
protected function bindContainer(Application $app) { $this->app->when(PasswordUsageTracker::class)->needs('$maxReuse')->give(function () { return $this->app['config']->get('concrete.user.password.reuse.track', 5); }); $this->app->bindShared('user/registration', function () use (...
php
{ "resource": "" }
q23238
UserServiceProvider.handleEvent
train
public function handleEvent(Event $event, UserNotificationEventHandler $service) { // If our event is the wrong type, just do a null/void return if (!$event instanceof DeactivateUser) { return; } $entity = $event->getUserEntity(); if ($entity) { $ser...
php
{ "resource": "" }
q23239
Theme.getAvailableThemes
train
public static function getAvailableThemes($filterInstalled = true) { $db = Loader::db(); $dh = Loader::helper('file'); $themes = $dh->getDirectoryContents(DIR_FILES_THEMES); if ($filterInstalled) { // strip out themes we've already installed $handles = $db->G...
php
{ "resource": "" }
q23240
Theme.getThemeCustomizableStyleList
train
public function getThemeCustomizableStyleList() { if (!isset($this->styleList)) { $env = Environment::get(); $r = $env->getRecord( DIRNAME_THEMES.'/'.$this->getThemeHandle( ).'/'.DIRNAME_CSS.'/'.FILENAME_STYLE_CUSTOMIZER_STYLES, $this->...
php
{ "resource": "" }
q23241
Theme.getThemeCustomizablePreset
train
public function getThemeCustomizablePreset($handle) { $env = Environment::get(); if ($this->isThemeCustomizable()) { $file = $env->getRecord( DIRNAME_THEMES.'/'.$this->getThemeHandle( ).'/'.DIRNAME_CSS.'/'.DIRNAME_STYLE_CUSTOMIZER_PRESETS.'/'.$handle.stati...
php
{ "resource": "" }
q23242
Theme.getThemeCustomizableStylePresets
train
public function getThemeCustomizableStylePresets() { $presets = []; $env = Environment::get(); if ($this->isThemeCustomizable()) { $directory = $env->getPath( DIRNAME_THEMES.'/'.$this->getThemeHandle( ).'/'.DIRNAME_CSS.'/'.DIRNAME_STYLE_CUSTOMIZER_...
php
{ "resource": "" }
q23243
Theme.getStylesheet
train
public function getStylesheet($stylesheet) { $stylesheet = $this->getStylesheetObject($stylesheet); $styleValues = $this->getThemeCustomStyleObjectValues(); if (!is_null($styleValues)) { $stylesheet->setValueList($styleValues); } if (!$this->isThemePreviewRequest(...
php
{ "resource": "" }
q23244
Theme.getThemeCustomStyleObject
train
public function getThemeCustomStyleObject() { $db = Loader::db(); $row = $db->FetchAssoc('select * from PageThemeCustomStyles where pThemeID = ?', [$this->getThemeID()]); if (isset($row['pThemeID'])) { $o = new \Concrete\Core\Page\CustomStyle(); $o->setThemeID($this->...
php
{ "resource": "" }
q23245
Theme.getFilesInTheme
train
public function getFilesInTheme() { $dh = Loader::helper('file'); $templateList = PageTemplate::getList(); $pts = []; foreach ($templateList as $pt) { $pts[] = $pt->getPageTemplateHandle(); } $files = []; $filesTmp = $dh->getDirectoryContents($this...
php
{ "resource": "" }
q23246
Identifier.generate
train
public function generate($table, $key, $length = 12, $lowercase = false) { $foundHash = false; $db = Application::make(Connection::class); while ($foundHash == false) { $string = $this->getString($length); if ($lowercase) { $string = strtolower($string...
php
{ "resource": "" }
q23247
Identifier.getString
train
public function getString($length = 12) { $size = ceil($length / 2); try { if (function_exists('random_bytes')) { $bytes = random_bytes($size); } else { $hash = new PasswordHash(8, false); $bytes = $hash->get_random_bytes($size...
php
{ "resource": "" }
q23248
EncryptionService.decrypt
train
public static function decrypt($text) { if (function_exists('mcrypt_decrypt')) { $iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $len = mcrypt_get_key_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); /** @var \Co...
php
{ "resource": "" }
q23249
EncryptionService.encrypt
train
public static function encrypt($text) { if (function_exists('mcrypt_encrypt')) { $iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $len = mcrypt_get_key_size(MCRYPT_XTEA, MCRYPT_MODE_ECB); /** @var \Co...
php
{ "resource": "" }
q23250
PasswordUsageTracker.trackUse
train
public function trackUse($string, $subject) { $id = $this->resolveUserID($subject); // If the subject is invalid return false if (!$id) { return false; } if (!is_string($string)) { throw new \InvalidArgumentException(t('Invalid mixed value provided. ...
php
{ "resource": "" }
q23251
PasswordUsageTracker.pruneUses
train
private function pruneUses($subject) { $repository = $this->entityManager->getRepository(UsedString::class); $usedStrings = $repository->findBy(['subject' => $subject], ['id' => 'desc']); // IF there are extra used strings, prune the extras if (count($usedStrings) > $this->maxReuse)...
php
{ "resource": "" }
q23252
Avatar.getImagePath
train
public function getImagePath($uo, $withNoCacheStr = true) { if (!$uo->hasAvatar()) { return false; } $avatar = $uo->getUserAvatar(); return $avatar->getPath(); }
php
{ "resource": "" }
q23253
IndexSearch.pagesToQueue
train
protected function pagesToQueue() { $qb = $this->connection->createQueryBuilder(); $timeout = intval($this->app['config']->get('concrete.misc.page_search_index_lifetime')); // Find all pages that need indexing $query = $qb ->select('p.cID') ->from('Pages', 'p...
php
{ "resource": "" }
q23254
CacheLocal.key
train
public static function key($group, $id) { if (!empty($id)) { return trim($group, '/') . '/' . trim($id, '/'); } else { return trim($group, '/'); } }
php
{ "resource": "" }
q23255
LoggedStorage.log
train
protected function log($level, $message, array $context = []) { if ($this->logger) { $metadata = $this->getMetadataBag(); $context['metadata'] = [ 'created' => $metadata->getCreated(), 'lifetime' => $metadata->getLifetime(), 'lastused'...
php
{ "resource": "" }
q23256
LoggedStorage.clear
train
public function clear() { $this->logInfo('Clearing Session.'); $metadata = $this->getMetadataBag(); $lifetime = $metadata->getLifetime(); $lastUsed = $metadata->getLastUsed(); // If the existing session has expired on its own if ($lifetime && time() > $lastUsed + $l...
php
{ "resource": "" }
q23257
GeolocatorController.getFileRecord
train
protected function getFileRecord($file) { $result = null; $segment = implode('/', [DIRNAME_GEOLOCATION, $this->geolocator->getGeolocatorHandle(), $file]); $fileLocator = $this->app->make(FileLocator::class); /* @var FileLocator $fileLocator */ $package = $this->geolocator->ge...
php
{ "resource": "" }
q23258
CacheClearer.getCaches
train
protected function getCaches() { foreach ($this->caches as $key => $cache) { if (!$cache instanceof FlushableInterface) { $cache = $this->application->make($cache); } if ($cache instanceof FlushableInterface) { yield $key => $cache; ...
php
{ "resource": "" }
q23259
CacheClearer.clearCacheDirectory
train
protected function clearCacheDirectory($directory) { foreach ($this->filesToClear($directory) as $file) { if ($file->isDir()) { $this->filesystem->deleteDirectory($file->getPathname()); } else { $this->filesystem->delete($file->getPathname()); ...
php
{ "resource": "" }
q23260
Controller.getPlaceHolderText
train
public function getPlaceHolderText($handle) { $pageValues = $this->getAvailablePageValues(); if (in_array($handle, array_keys($pageValues))) { $placeHolder = $pageValues[$handle]; } else { $attributeKey = CollectionAttributeKey::getByHandle($handle); if (i...
php
{ "resource": "" }
q23261
Strings.alphanum
train
public function alphanum($value, $allowSpaces = false, $allowDashes = false) { $allowedCharsRegex = 'A-Za-z0-9'; if ($allowSpaces) { $allowedCharsRegex .= ' '; } if ($allowDashes) { $allowedCharsRegex .= '\-'; } return $this->notempty($value) ...
php
{ "resource": "" }
q23262
Strings.min
train
public function min($str, $length) { return $this->notempty($str) && strlen(trim($str)) >= $length; }
php
{ "resource": "" }
q23263
Strings.max
train
public function max($str, $length) { return $this->notempty($str) && strlen(trim($str)) <= $length; }
php
{ "resource": "" }
q23264
DependencyChecker.setInstalledPackages
train
public function setInstalledPackages(array $installedPackages) { $dictionary = []; foreach ($installedPackages as $installedPackage) { $dictionary[$installedPackage->getPackageHandle()] = $installedPackage; } $this->installedPackages = $dictionary; return $this; ...
php
{ "resource": "" }
q23265
DependencyChecker.getInstalledPackages
train
protected function getInstalledPackages() { if ($this->installedPackages === null) { $installedPackages = []; $packageService = $this->application->make(PackageService::class); foreach ($packageService->getInstalledHandles() as $packageHandle) { $installed...
php
{ "resource": "" }
q23266
DependencyChecker.getPackageRequirementsForPackage
train
protected function getPackageRequirementsForPackage(Package $package, Package $otherPackage) { $dependencies = $package->getPackageDependencies(); $otherPackageHandle = $otherPackage->getPackageHandle(); return isset($dependencies[$otherPackageHandle]) ? $dependencies[$otherPackageHandle] :...
php
{ "resource": "" }
q23267
ThemeGridColumn.getAreaLayoutColumnOffsetEditClass
train
public function getAreaLayoutColumnOffsetEditClass() { /* * @var ThemeGridLayout $this->arLayout */ $gf = $this->arLayout->getThemeGridFrameworkObject(); if (is_object($gf)) { $class = $gf->getPageThemeGridFrameworkColumnAdditionalClasses(); if ($cla...
php
{ "resource": "" }
q23268
Install.getInstaller
train
protected function getInstaller() { if ($this->installer === null) { $this->installer = $this->app->make(Installer::class); } return $this->installer; }
php
{ "resource": "" }
q23269
DatabaseLoader.load
train
public function load($environment, $group, $namespace = null) { $result = array(); $db = Database::getActiveConnection(); $query = $db->createQueryBuilder(); $query ->select('configValue', 'configItem') ->from('Config', 'c') ->where('configGroup ...
php
{ "resource": "" }
q23270
DatabaseLoader.getNamespaces
train
public function getNamespaces() { $db = Database::getActiveConnection(); /** @var PDOStatement $results */ $results = $db->createQueryBuilder() ->select('configNamespace') ->from('Config', 'c') ->where('configNamespace != ""') ->groupBy('confi...
php
{ "resource": "" }
q23271
DefaultBooter.boot
train
public function boot() { $app = $this->app; /* * ---------------------------------------------------------------------------- * Bind the IOC container to our facades * Completely indebted to Taylor Otwell & Laravel for this. * ------------------------------------...
php
{ "resource": "" }
q23272
DefaultBooter.initializeConfig
train
private function initializeConfig(Application $app) { $config_provider = $app->make('Concrete\Core\Config\ConfigServiceProvider'); $config_provider->register(); /* * @var \Concrete\Core\Config\Repository\Repository */ $config = $app->make('config'); return...
php
{ "resource": "" }
q23273
DefaultBooter.setupErrorReporting
train
private function setupErrorReporting(Repository $config) { $error_reporting = $config->get('concrete.debug.error_reporting'); if ((string) $error_reporting !== '') { error_reporting((int) $error_reporting); } }
php
{ "resource": "" }
q23274
DefaultBooter.validateDatabaseDetails
train
private function validateDatabaseDetails($environment) { $db_config = []; $configFile = DIR_CONFIG_SITE . '/database.php'; $environmentConfig = DIR_CONFIG_SITE . "/{$environment}.database.php"; // If the database.php file exists, load it first if (file_exists($configFile)) {...
php
{ "resource": "" }
q23275
DefaultBooter.checkInstall
train
private function checkInstall(Application $app, Request $request) { if (!$app->isInstalled()) { if ( !$request->matches('/install/*') && $request->getPath() != '/install' && !$request->matches('/ccm/assets/localization/*') ) { ...
php
{ "resource": "" }
q23276
Template.getGatheringItemTemplateSlotWidth
train
public function getGatheringItemTemplateSlotWidth(GatheringItem $item) { if ($this->getGatheringItemTemplateFixedSlotWidth()) { return $this->getGatheringItemTemplateFixedSlotWidth(); } $w = 0; $handles = $this->getGatheringItemTemplateFeatureHandles(); $assignme...
php
{ "resource": "" }
q23277
FileLoader.clearNamespace
train
public function clearNamespace($namespace) { $paths = $this->getNamespaceDefaultPaths($namespace); foreach ($paths as $path) { if ($this->files->isDirectory($path)) { $this->files->deleteDirectory($path); } } }
php
{ "resource": "" }
q23278
CsvWriter.projectList
train
private function projectList(UserList $list) { $statement = $list->deliverQueryObject()->execute(); foreach ($statement as $result) { $user = $list->getResult($result); yield iterator_to_array($this->projectUser($user)); } }
php
{ "resource": "" }
q23279
CsvWriter.projectUser
train
private function projectUser(UserInfo $user) { yield $user->getUserName(); yield $user->getUserEmail(); $userRegistrationDate = $user->getUserDateAdded(); yield $this->date->formatCustom(\DateTime::ATOM, $userRegistrationDate); list($active, $inactive) = $this->getTranslate...
php
{ "resource": "" }
q23280
CsvWriter.getAttributeKeys
train
private function getAttributeKeys() { if (!isset($this->attributeKeys)) { $this->attributeKeys = $this->category->getList(); } return $this->attributeKeys; }
php
{ "resource": "" }
q23281
CsvWriter.getTranslatedStatus
train
private function getTranslatedStatus() { if ($this->status === null) { $this->status = [t('Active'), t('Inactive')]; } return $this->status; }
php
{ "resource": "" }
q23282
Service.report
train
public function report($content, $author, $email, $ip, $ua, $additionalArgs = array()) { $args['content'] = $content; $args['author'] = $author; $args['author_email'] = $email; $args['ip_address'] = $ip; $args['user_agent'] = $ua; foreach ($additionalArgs as $key => ...
php
{ "resource": "" }
q23283
CLIRunner.run
train
public function run() { $console = $this->console; $this->app->instance('console', $console); $this->loadBootstrap(); $this->initializeSystemTimezone(); $input = new ArgvInput(); if ($input->getFirstArgument() !== 'c5:update') { if ($this->app->isInstall...
php
{ "resource": "" }
q23284
ApacheConfigurator.getConfiguredRule
train
protected function getConfiguredRule($configuration, RuleInterface $rule) { $configurationNormalized = str_replace(array("\r\n", "\r"), "\n", (string) $configuration); $rxSearch = '/'; // First of all we have either the start of the file or a line ending $rxSearch .= '(^|\n)'; ...
php
{ "resource": "" }
q23285
Section.getByID
train
public static function getByID($cID, $cvID = 'RECENT') { $entity = self::getLocaleFromHomePageID($cID); if ($entity) { $obj = parent::getByID($cID, $cvID); $obj->setLocale($entity); return $obj; } return false; }
php
{ "resource": "" }
q23286
Section.getCurrentSection
train
public static function getCurrentSection() { static $lang; if (!isset($lang)) { $c = Page::getCurrentPage(); if ($c instanceof Page) { $lang = self::getBySectionOfSite($c); } } return $lang; }
php
{ "resource": "" }
q23287
Section.getTranslatedPageID
train
public function getTranslatedPageID($page) { $ids = static::getIDList(); if (in_array($page->getCollectionID(), $ids)) { return $this->locale->getSiteTree()->getSiteHomePageID(); } $mpRelationID = self::getMultilingualPageRelationID($page->getCollectionID()); if...
php
{ "resource": "" }
q23288
Section.getSectionInterfaceTranslations
train
public function getSectionInterfaceTranslations($untranslatedFirst = false) { $translations = new Translations(); $translations->setLanguage($this->getLocale()); $translations->setPluralForms($this->getNumberOfPluralForms(), $this->getPluralsRule()); $db = \Database::get(); $...
php
{ "resource": "" }
q23289
PageListGenerator.generatePageList
train
public function generatePageList() { $this->now = new DateTime(); $siteTreeIDList = array_merge([0], $this->getSiteTreesIDList()); $connection = $this->getConnection(); $rs = $connection->executeQuery('select cID from Pages where siteTreeID is null or siteTreeID in (' . implode(', ',...
php
{ "resource": "" }
q23290
PageListGenerator.isMultilingualEnabled
train
public function isMultilingualEnabled() { if ($this->isMultilingualEnabled === null) { $this->isMultilingualEnabled = count($this->getMultilingualSections()) > 1; } return $this->isMultilingualEnabled; }
php
{ "resource": "" }
q23291
PageListGenerator.getMultilingualSections
train
public function getMultilingualSections() { if ($this->multilingualSections === null) { $site = $this->getSite(); if ($site === null) { $this->multilingualSections = []; } else { $list = []; foreach (MultilingualSection::get...
php
{ "resource": "" }
q23292
PageListGenerator.canIncludePageInSitemap
train
public function canIncludePageInSitemap(Page $page) { $result = false; if ($this->isPageStandard($page)) { if ($this->isPagePublished($page)) { if (!$this->isPageExcludedFromSitemap($page)) { if ($this->isPageAccessible($page)) { ...
php
{ "resource": "" }
q23293
PageListGenerator.getSite
train
public function getSite() { if ($this->site === false) { $this->site = $this->app->make('site')->getDefault(); } return $this->site; }
php
{ "resource": "" }
q23294
PageListGenerator.setSite
train
public function setSite(Site $site) { if ($this->site !== $site) { $this->site = $site; $this->multilingualSections = null; $this->isMultilingualEnabled = null; } return $this; }
php
{ "resource": "" }
q23295
ContentSwapper.swapContent
train
public function swapContent(Package $package, $options) { if ($this->validateClearSiteContents($options)) { \Core::make('cache/request')->disable(); $pl = new PageList(); $pages = $pl->getResults(); foreach ($pages as $c) { $c->delete(); ...
php
{ "resource": "" }
q23296
ClassSymbol.resolveMethods
train
protected function resolveMethods() { $methods = $this->reflectionClass->getMethods(); if ($this->isFacade()) { $methods = array_merge($methods, $this->getFacadeReflectionClass()->getMethods()); } foreach ($methods as $method) { $this->methods[] = new MethodSy...
php
{ "resource": "" }
q23297
ClassSymbol.render
train
public function render($eol = "\n", $padding = ' ', $methodFilter = null) { $rendered = ''; $comment = $this->comment; if ($comment !== false) { $comment = trim($comment); if ($comment !== '') { $rendered .= str_replace($eol . '*', $eol . ' *', impl...
php
{ "resource": "" }
q23298
Timezone.getCompatibleTimezones
train
public function getCompatibleTimezones() { $validTimezones = []; foreach ($this->dateHelper->getTimezones() as $timezoneID => $timezoneName) { if ($this->getDeltaTimezone($timezoneID) === null) { $validTimezones[$timezoneID] = $timezoneName; } } ...
php
{ "resource": "" }
q23299
Timezone.getDeltaTimezone
train
public function getDeltaTimezone($phpTimezone) { if (!($phpTimezone instanceof DateTimeZone)) { $phpTimezone = new DateTimeZone($phpTimezone); } $data = $this->getDatabaseTimestamps(); extract($data); $sometimesSame = false; $maxDeltaMinutes = 0; f...
php
{ "resource": "" }