_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q29400 | Container.replaceParameters | train | public function replaceParameters($data)
{
//@todo: this mostly repeats core from Supra::buildContainer(). Should we merge it?
if (is_string($data)) {
return $this->replaceParametersScalar($data);
}
$obj = $this;
array_walk_recursive($data, function (&$value) use ($obj) {
if (is_string($value)) {
... | php | {
"resource": ""
} |
q29401 | Container.replaceParametersScalar | train | public function replaceParametersScalar($data)
{
$count = preg_match_all('/%[a-z\\._]+%/i', $data, $matches);
if (!$count) {
return $data;
}
$replacements = array();
foreach ($matches as $expression) {
$parameter = trim($expression[0], '%');
$replacements[$expression[0]] = $this->getParameter($pa... | php | {
"resource": ""
} |
q29402 | Container.getParameter | train | public function getParameter($name)
{
$chunks = explode('.', $name);
$name = $chunks[0] .
(isset($chunks[1]) ? '.' . $chunks[1] : '');
if (!isset($this->parameters[$name])) {
throw new ReferenceException(sprintf('Parameter "%s" is not defined in the container', $name));
}
$value = $this->parameters[... | php | {
"resource": ""
} |
q29403 | Arguments.canAccept | train | public function canAccept(self $arguments): bool
{
if ($this->values === null) {
return true;
}
if ($this->equal($arguments)) {
return true;
}
$values = $arguments->getValues();
if ($values === null) {
return false;
}
... | php | {
"resource": ""
} |
q29404 | Controller.run | train | public function run($action, $request=null) {
$this->action = $action;
$this->defaultView = $action;
if($request === null)
$request = new Request;
$this->request = $request;
$this->response = new Response;
$this->response->setRequest($this->request);
#before filters
$result = null;
foreach($this-... | php | {
"resource": ""
} |
q29405 | Controller.url | train | public function url($action, $params=[]) {
if(is_array($action))
return $this->resolver->url($action, $params);
else
return $this->resolver->url([get_called_class(), $action], $params);
} | php | {
"resource": ""
} |
q29406 | Controller.set | train | public function set($name, $value) {
\Asgard\Common\ArrayUtils::set($this->parameters, $name, $value);
return $this;
} | php | {
"resource": ""
} |
q29407 | Definition.call | train | public function call(Entity $entity, $name, array $arguments) {
if(isset($this->calls[$name])) {
array_unshift($arguments, $entity);
return call_user_func_array($this->calls[$name], $arguments);
}
else {
foreach($this->callsCatchAll as $behavior) {
$processed = false;
$res = call_user_func_array(... | php | {
"resource": ""
} |
q29408 | Definition.callStatic | train | public function callStatic($name, array $arguments) {
if(isset($this->statics[$name]))
return call_user_func_array($this->statics[$name], $arguments);
else {
foreach($this->staticsCatchAll as $behavior) {
$processed = false;
$res = call_user_func_array([$behavior, 'staticCatchAll'], [$name, $arguments... | php | {
"resource": ""
} |
q29409 | Definition.loadBehaviors | train | public function loadBehaviors($behaviors) {
if($this->generalHookManager !== null)
$this->generalHookManager->trigger('Asgard.Entity.LoadBehaviors', [$this, &$behaviors]);
foreach($behaviors as $behavior)
$this->loadBehavior($behavior);
} | php | {
"resource": ""
} |
q29410 | Definition.loadBehavior | train | public function loadBehavior($behavior) {
if(!is_object($behavior))
return;
if(!$behavior instanceof \Asgard\Entity\Behavior)
throw new \Exception($this->entityClass.' has an invalid behavior object.');
$behavior->setDefinition($this);
$behavior->load($this);
$reflection = new \ReflectionClass($behavio... | php | {
"resource": ""
} |
q29411 | Definition.set | train | public function set($name, $value) {
\Asgard\Common\ArrayUtils::set($this->metas, $name, $value);
return $this;
} | php | {
"resource": ""
} |
q29412 | Definition.processPreSet | train | public function processPreSet($entity, $name, &$value, $locale=null, $hook=true, $silentException=false) {
if($hook)
$this->trigger('set', [$entity, $name, &$value, $locale]);
if($this->hasProperty($name)) {
if($this->property($name)->get('hooks.set')) {
$hook = $this->property($name)->get('hooks.set');
... | php | {
"resource": ""
} |
q29413 | Definition.processPreAdd | train | public function processPreAdd($entity, $name, &$value, $locale=null, $hook=true, $silentException=false) {
if($hook)
$this->trigger('set', [$entity, $name, &$value, $locale]);
if(!$this->hasProperty($name))
return;
if($this->property($name)->get('hooks.set')) {
$hook = $this->property($name)->get('hoo... | php | {
"resource": ""
} |
q29414 | Definition.make | train | public function make(array $attrs=null, $locale=null) {
$entityClass = $this->entityClass;
$entity = new $entityClass($attrs, $locale, $this);
return $entity;
} | php | {
"resource": ""
} |
q29415 | AbstractRequireTokenParser.getRealAssetName | train | protected function getRealAssetName($assetName)
{
$prefix = 0 === strpos($assetName, '?') ? '?' : '';
$assetName = ltrim($assetName, '?');
if (null !== $this->replacementManager && $this->replacementManager->hasReplacement($assetName)) {
$assetName = $this->replacementManager->g... | php | {
"resource": ""
} |
q29416 | Message.requeue | train | public function requeue($delay, $backoff = false)
{
$this->isResponded = true;
$this->delegate->onRequeue($this, $delay, $backoff);
} | php | {
"resource": ""
} |
q29417 | JavascriptCodeGen.makeOptions | train | static function makeOptions (array $options, $indent = '')
{
$o = mapAndFilter ($options, function ($v, $k) use ($indent) {
if (is_object ($v)) {
if ($v instanceof \RawText)
return "$k: $v";
if (method_exists ($v, 'toArray'))
$v = $v->toArray ();
else $v = (array)... | php | {
"resource": ""
} |
q29418 | TagTrait.hasPosts | train | public static function hasPosts($tagID, $postTypeSlug = '')
{
$postTypeSlug($postTypeSlug ? $postTypeSlug : PostType::getSlug());
$queryObject = DB::table(tagsRelationTable($postTypeSlug))->where('tagID', $tagID);
if($queryObject->count() > 0) {
return true;
}
r... | php | {
"resource": ""
} |
q29419 | TagTrait.featuredImageURL | train | public function featuredImageURL($width = null, $height = null, $defaultFeaturedImageURL = '')
{
if($this->hasFeaturedImage()) {
if(!$width && !$height) {
return url($this->featuredImage->url);
}else{
return $this->featuredImage->thumb($width, $height,... | php | {
"resource": ""
} |
q29420 | HtmlFilter.parseSupraLinkStart | train | protected function parseSupraLinkStart(LinkReferencedElement $link)
{
$tag = new HtmlTagStart('a');
$title = ReferencedElementUtils::getLinkReferencedElementTitle(
$link,
$this->container->getDoctrine()->getManager(),
$this->container->getLocaleManager()->getCurrentLocale()
);
// @TODO: what if w... | php | {
"resource": ""
} |
q29421 | HtmlFilter.parseSupraImage | train | protected function parseSupraImage(ImageReferencedElement $imageData)
{
$imageId = $imageData->getImageId();
$fileStorage = $this->container['cms.file_storage'];
/* @var $fileStorage \Supra\Package\Cms\FileStorage\FileStorage */
$image = $fileStorage->findImage($imageId);
if ($image === null) {
return ... | php | {
"resource": ""
} |
q29422 | Filter.filterWithRepository | train | final public function filterWithRepository(Collection $collection, Repository $repository, WhereExpressionCollector $sqlStatement, &$params)
{
$speciatedFilter = $repository->getRepositorySpecificFilter($this);
if ($speciatedFilter) {
$filtered = $speciatedFilter->doFilterWithRepository(... | php | {
"resource": ""
} |
q29423 | PostTrait.noty | train | public function noty($type, $message, $key = "")
{
array_push(
$this->notyMessages, [
'key' => $key,
'type' => $type,
'message' => $message,
]
);
return;
} | php | {
"resource": ""
} |
q29424 | PostTrait.findBySlug | train | public static function findBySlug($slug, $postTypeSlug = '')
{
$postTypeSlug = ($postTypeSlug ? $postTypeSlug : PostType::getSlug());
$postObj = (new Post())->setTable($postTypeSlug);
$post = $postObj
->where('slug_'.App::getLocale(), $slug)
->with($postObj->getDefau... | php | {
"resource": ""
} |
q29425 | PostTrait.findByID | train | public static function findByID($postID, $postTypeSlug = '')
{
$postTypeSlug = ($postTypeSlug ? $postTypeSlug : PostType::getSlug());
$postObj = (new Post())->setTable($postTypeSlug);
$post = $postObj
->where('postID', $postID)
->with($postObj->getDefaultRelations(get... | php | {
"resource": ""
} |
q29426 | PostTrait.handleObjectOrArrayValues | train | private static function handleObjectOrArrayValues($formData, $translatable, $languages = [])
{
if($formData['type']['inputType'] == 'db') {
$tmpArr = [];
$primaryKey = "";
if($formData['dbTable']['belongsTo'] == 'User') {
$primaryKey = "userID";
... | php | {
"resource": ""
} |
q29427 | PostTrait.insertCategories | train | public static function insertCategories($selectedCategories, $postID, $postTypeSlug)
{
if (count($selectedCategories)) {
$categoriesIDs = [];
$newCategoryRelation = [];
foreach ($selectedCategories as $selectedCategory){
$newCategoryRelation[] = [
... | php | {
"resource": ""
} |
q29428 | PostTrait.insertTags | train | public static function insertTags($selectedTags, $postID, $postType)
{
if(count($selectedTags)) {
$tagsIDs = [];
$newTagsRelations = [];
foreach ($selectedTags as $langSlug => $selectedTagForLanguage){
if($selectedTagForLanguage) {
for... | php | {
"resource": ""
} |
q29429 | PostTrait.insertMedia | train | public static function insertMedia($mediaFiles, $postID, $postTypeSlug, $languages, $notTranslatableFiles, $filesToBeIgnored = [])
{
$imagesArr = array();
foreach($mediaFiles as $fileKey => $files){
// feature image is treated as a default column
if($fileKey == 'featuredImage... | php | {
"resource": ""
} |
q29430 | PostTrait.getAdvancedSearchFields | train | public static function getAdvancedSearchFields($postType)
{
$postTypeFields = json_decode(DB::table('post_type')->where("slug", $postType)->first()->fields);
$advancedSearchFields = array();
foreach ($postTypeFields as $fieldArray){
if($fieldArray->type->inputType == "image"
... | php | {
"resource": ""
} |
q29431 | PostTrait.getCustomTemplate | train | public static function getCustomTemplate($baseTemplateName, $postType)
{
//fix post type name
if(strstr($postType, '_')) {
$explodePostTypeName = explode('_', $postType);
$postType = $explodePostTypeName[1];
}
$postTypeFileName = $baseTemplateName.ucfirst($po... | php | {
"resource": ""
} |
q29432 | PostTrait.featuredImageURL | train | public function featuredImageURL($width = null, $height = null, $defaultFeaturedImageURL = '', array $options = [])
{
$imageURL = null;
if ($this->hasFeaturedImage()) {
if (!$width && !$height) {
$imageURL = url($this->featuredImage->url) . "?" . strtotime($this->updated_... | php | {
"resource": ""
} |
q29433 | PostTrait.printTags | train | public function printTags($customView = '', $ulClass ="")
{
if($this->hasTags()) {
$tags = "tags";
return new HtmlString(
view()->make(
($customView ? $customView : "vendor.tags.default"), [
'tagsList' => $this->$tags,
... | php | {
"resource": ""
} |
q29434 | PostTrait.hasTags | train | public function hasTags()
{
$tags = "tags";
$postType = getPostType($this->getTable());
return ($postType->hasTags && isset($this->$tags) && !$this->$tags->isEmpty());
} | php | {
"resource": ""
} |
q29435 | PostTrait.hasCategory | train | public function hasCategory()
{
$postType = getPostType($this->getTable());
return ($postType->hasCategories && isset($this->categories) && !$this->categories->isEmpty());
} | php | {
"resource": ""
} |
q29436 | PostTrait.content | train | public function content()
{
ob_start();
// Call pre events
print $this->beforeContentEvents();
print $this->content;
print $this->afterContentEvents();
$content = ob_get_contents();
ob_end_clean();
return $content;
} | php | {
"resource": ""
} |
q29437 | PostTrait.isInMenuLinks | train | public static function isInMenuLinks($postID, $postType)
{
$isInMenulinks = MenuLink::where('belongsToID', $postID)->where('belongsTo', $postType)->count();
if ($isInMenulinks) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q29438 | PostTrait.updateMenulink | train | public static function updateMenulink($post)
{
if(self::isInMenuLinks($post->postID, $post->getTable())) {
$menuLinks = MenuLink::where('belongsToID', $post->postID)->where('belongsTo', $post->getTable())->get();
foreach($menuLinks as $menuLink){
$menuLink->params = $... | php | {
"resource": ""
} |
q29439 | PostTrait.getDefaultPostRoutes | train | public static function getDefaultPostRoutes( $postType)
{
$baseRouteName = str_replace('_', '.', $postType->slug);
return [
'defaultRoute' => $baseRouteName.'.single',
'list' => [
$baseRouteName.'.single' => $postType->name.' single Post',
]
];
... | php | {
"resource": ""
} |
q29440 | PostTrait.getDefaultPostTypeRoutes | train | public static function getDefaultPostTypeRoutes($postType)
{
$baseRouteName = str_replace('_', '.', $postType->slug);
return [
'defaultRoute' => $baseRouteName.'.index',
'list' => [
$baseRouteName.'.index' => $postType->name.' Index'
]
];
} | php | {
"resource": ""
} |
q29441 | HookableTrait.trigger | train | public function trigger($name, array $args=[], $cb=null, &$chain=null) {
if(!$this->getHookManager())
return;
return $this->getHookManager()->trigger($name, $args, $cb, $chain);
} | php | {
"resource": ""
} |
q29442 | HookableTrait.preHook | train | public function preHook($hookName, $cb) {
$args = [$hookName, $cb];
return call_user_func_array([$this->getHookManager(), 'preHook'], $args);
} | php | {
"resource": ""
} |
q29443 | HookableTrait.postHook | train | public function postHook($hookName, $cb) {
$args = [$hookName, $cb];
return call_user_func_array([$this->getHookManager(), 'postHook'], $args);
} | php | {
"resource": ""
} |
q29444 | PageElasticaSubscriber.onFlush | train | public function onFlush(OnFlushEventArgs $eventArgs)
{
$this->pages = new ArrayCollection();
$this->manager = $eventArgs->getEntityManager();
$uow = $this->manager->getUnitOfWork();
foreach ($uow->getScheduledEntityUpdates() as $entity) {
$this->handleEntity($entity);
... | php | {
"resource": ""
} |
q29445 | PageElasticaSubscriber.handleEntity | train | private function handleEntity($entity)
{
if (null !== $page = $this->findRelatedPage($entity)) {
if (null === $page->getId()) {
return;
}
if (!$this->pages->contains($page)) {
$this->pages->add($page);
}
}
} | php | {
"resource": ""
} |
q29446 | PageElasticaSubscriber.findRelatedPage | train | private function findRelatedPage($entity)
{
// By Translation
if ($entity instanceof Cms\PageTranslationInterface) {
return $entity->getTranslatable();
}
// By Seo
if ($entity instanceof Cms\SeoTranslationInterface && null !== $entity->getId()) {
retu... | php | {
"resource": ""
} |
q29447 | DB.getDriver | train | public static function getDriver(string $connectionString)
{
$connection = [
'orig' => $connectionString,
'type' => null,
'user' => null,
'pass' => null,
'host' => null,
'port' => null,
'name' => null,
'opts' => ... | php | {
"resource": ""
} |
q29448 | DB.one | train | public function one(string $sql, $par = null, bool $opti = true)
{
return $this->get($sql, $par, null, false, $opti)->value();
} | php | {
"resource": ""
} |
q29449 | DB.all | train | public function all(string $sql, $par = null, string $key = null, bool $skip = false, bool $opti = true) : array
{
return $this->get($sql, $par, $key, $skip, $opti)->toArray();
} | php | {
"resource": ""
} |
q29450 | DB.getSchema | train | public function getSchema($asPlainArray = true)
{
return !$asPlainArray ? $this->tables : array_map(function ($table) {
return [
'name' => $table->getName(),
'pkey' => $table->getPrimaryKey(),
'comment' => $table->getComment(),
'col... | php | {
"resource": ""
} |
q29451 | DB.table | train | public function table($table, bool $mapped = false)
{
return $mapped ?
new TableQueryMapped($this, $this->definition($table)) :
new TableQuery($this, $this->definition($table));
} | php | {
"resource": ""
} |
q29452 | OpauthResponseHelper.get_last_name | train | public static function get_last_name($source) {
$name = explode(' ', self::parse_source_path('info.name', $source));
array_shift($name);
return join(' ', $name);
} | php | {
"resource": ""
} |
q29453 | OpauthResponseHelper.get_google_locale | train | public static function get_google_locale($source) {
$locale = self::parse_source_path('raw.locale', $source);
if(!$locale) {
return self::get_smart_locale();
}
return str_replace('-', '_', $locale);
} | php | {
"resource": ""
} |
q29454 | OpauthResponseHelper.get_smart_locale | train | public static function get_smart_locale($language = null) {
require_once FRAMEWORK_PATH . '/thirdparty/Zend/Locale.php';
$locale = Zend_Locale::getBrowser();
if(!$locale) {
if($language) {
return i18n::get_locale_from_lang($language);
}
else {
return i18n::get_locale();
}
}
$locale = ar... | php | {
"resource": ""
} |
q29455 | OpauthResponseHelper.parse_source_path | train | public static function parse_source_path($path, $source) {
$fragments = explode('.', $path);
$currentFrame = $source;
foreach($fragments as $fragment) {
if(!isset($currentFrame[$fragment])) {
return null;
}
$currentFrame = $currentFrame[$fragment];
}
return $currentFrame;
} | php | {
"resource": ""
} |
q29456 | Strings.camelToUnderdash | train | public static function camelToUnderdash($s)
{
$s = preg_replace('#(.)(?=[A-Z])#', '$1_', $s);
$s = strtolower($s);
$s = rawurlencode($s);
return $s;
} | php | {
"resource": ""
} |
q29457 | Strings.underdashToCamel | train | public static function underdashToCamel($s)
{
$s = strtolower($s);
$s = preg_replace('#_(?=[a-z])#', ' ', $s);
$s = substr(ucwords('x' . $s), 1);
$s = str_replace(' ', '', $s);
return $s;
} | php | {
"resource": ""
} |
q29458 | UriResolver.resolve | train | public static function resolve(Uri $baseUri, Uri $targetUri)
{
if (!$baseUri->isAbsolute()) {
throw new InvalidArgumentException('Base uri must be absolute');
}
// if the target uri is absolute
if ($targetUri->isAbsolute()) {
$path = $targetUri->getPath();
... | php | {
"resource": ""
} |
q29459 | UriResolver.percentEncode | train | public static function percentEncode($value, $preventDoubleEncode = true)
{
$len = strlen($value);
$val = '';
for ($i = 0; $i < $len; $i++) {
$j = ord($value[$i]);
if ($j <= 0xFF) {
// check for double encoding
if ($preventDoubleEncod... | php | {
"resource": ""
} |
q29460 | PermalinkTrait.getByName | train | public static function getByName($belongsTo, $name, $defaultURL = '')
{
$singlePermalink = Permalink::where('belongsTo', $belongsTo)->where("name", $name)->first();
if ($singlePermalink && $singlePermalink->custom_url) {
return $singlePermalink->custom_url;
}
if(!$single... | php | {
"resource": ""
} |
q29461 | StrList.removeIndex | train | public static function removeIndex(string $list, $index, string $separator): string
{
$items = self::explode($separator, $list);
if (isset($items[$index])) {
unset($items[$index]);
}
return implode($separator, $items);
} | php | {
"resource": ""
} |
q29462 | Cache.drop | train | public static function drop($name) {
if (!isset(self::$_config[$name])) {
return false;
}
unset(self::$_config[$name], self::$_engines[$name], self::$_logs[$name]);
return true;
} | php | {
"resource": ""
} |
q29463 | Cache.clearGroup | train | public static function clearGroup($group, $config = 'default') {
if (!self::isInitialized($config)) {
return false;
}
$start = microtime(true);
$success = self::$_engines[$config]->clearGroup($group);
self::__logActivity($config, 'clearGroup', '', $success, $start);
self::set(null, $config);
self::$_q... | php | {
"resource": ""
} |
q29464 | Cache.settings | train | public static function settings($name = 'default') {
if (!empty(self::$_engines[$name])) {
return self::$_engines[$name]->settings();
}
return array();
} | php | {
"resource": ""
} |
q29465 | Cache.__logActivity | train | private static function __logActivity($config, $type, $key, $success, $startTime) {
$queryTime = round((microtime(true) - $startTime) * 1000, 2);
self::$_logs[$config][] = array(
'type' => $type,
'key' => $key,
'success' => $success,
'time' => $queryTime
);
self::$_queriesTime += $queryTime;
if ... | php | {
"resource": ""
} |
q29466 | CThemeEngine.getVariable | train | public function getVariable($which)
{
if (isset($this->data[$which])) {
return $this->data[$which];
} elseif (isset($this->config["data"])) {
return $this->config["data"][$which];
}
return null;
} | php | {
"resource": ""
} |
q29467 | GetAvailableOptions.getTimezoneRegions | train | protected function getTimezoneRegions()
{
return [
'UTC' => DateTimeZone::UTC,
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Asia' => DateTimeZone::ASIA,
... | php | {
"resource": ""
} |
q29468 | GetAvailableOptions.getTimezoneLocations | train | protected function getTimezoneLocations($region)
{
$locations = [];
foreach (DateTimeZone::listIdentifiers($region) as $timezone) {
$locations[] = substr($timezone, strpos($timezone, '/') + 1);
}
return $locations;
} | php | {
"resource": ""
} |
q29469 | PagesGroupController.deleteAction | train | public function deleteAction()
{
$this->checkLock();
$this->isPostRequest();
$folder = $this->getPageLocalization()
->getMaster();
if ($folder->hasChildren()) {
throw new CmsException(null, 'Cannot remove non-empty folder.');
}
$this->getEntityManager()->remove($folder);
$this->getEntityManager... | php | {
"resource": ""
} |
q29470 | PagesGroupController.saveAction | train | public function saveAction()
{
$this->isPostRequest();
$this->checkLock();
$localization = $this->getPageLocalization();
if (! $localization instanceof GroupLocalization) {
throw new \UnexpectedValueException(sprintf(
'Expecting instanceof GroupLocalization, [%s] received.',
get_class($locali... | php | {
"resource": ""
} |
q29471 | ResponseContext.flushToContext | train | public function flushToContext(ResponseContext $mainContext)
{
foreach ($this->getAllValues() as $key => $value) {
$mainContext->setValue($key, $value);
}
foreach ($this->layoutSnippetResponses as $key => $responses) {
foreach ($responses as $snippet) {
$mainContext->addToLayoutSnippet($key, $snippet)... | php | {
"resource": ""
} |
q29472 | ResponseContext.getNext | train | public function getNext()
{
if (! $this->valid()) {
throw new \OutOfBoundsException('End of iterator reached.');
}
$value = $this->get($this->key());
$this->next();
return $value;
} | php | {
"resource": ""
} |
q29473 | ThemeSupport.apply | train | public function apply()
{
if ($this->config->hasKey(self::REMOVE)) {
$removeConfig = $this->config->getSubConfig(self::REMOVE);
$this->remove($removeConfig->getArrayCopy());
}
if ($this->config->hasKey(self::ADD)) {
$addConfig = $this->config->getSubConfi... | php | {
"resource": ""
} |
q29474 | ThemeSupport.add | train | protected function add(array $items)
{
array_walk($items, function ($value, string $key) {
add_theme_support($key, $value);
});
} | php | {
"resource": ""
} |
q29475 | MultipleSelectField.getCheckboxes | train | public function getCheckboxes(array $options=[]) {
if(isset($options['choices']))
$choices = $options['choices'];
else
$choices = $this->getChoices();
$checkboxes = [];
foreach($choices as $k=>$v) {
$checkbox_options = $options;
$checkbox_options['value'] = $k;
$checkbox_options['widge... | php | {
"resource": ""
} |
q29476 | MultipleSelectField.getCheckbox | train | public function getCheckbox($name, array $options=[]) {
$choices = $this->getChoices();
$default = $this->value;
$value = isset($options['value']) ? $options['value']:null;
if($value===null) {
foreach($choices as $k=>$v) {
if($v == $name) {
$value = $k;
break;
}
}
}
if(... | php | {
"resource": ""
} |
q29477 | CategoryModel.href | train | public function href($routeName = '', $customAttributes = [])
{
if(!$routeName) {
$routeName = 'category.posts';
}
$getRoute = Route::getRoutes()->getByName($routeName);
if($getRoute) {
$routeParams = Route::getRoutes()->getByName($routeName)->parameterNames()... | php | {
"resource": ""
} |
q29478 | CategoryModel.scopeVisible | train | public function scopeVisible($query, $languageSlug = '')
{
if(!$languageSlug) {
$languageSlug = App::getLocale();
}
return $query->where('isVisible->'.$languageSlug, true);
} | php | {
"resource": ""
} |
q29479 | SelectField.getRadios | train | public function getRadios(array $options=[]) {
if(isset($options['choices']))
$choices = $options['choices'];
else
$choices = $this->getChoices();
$radios = [];
foreach($choices as $k=>$v) {
$radio_options = $options;
$radio_options['value'] = $k;
$radio_options['widget_name'] = $v;
... | php | {
"resource": ""
} |
q29480 | GnMashupTokensApi.GetMashupTokensPage | train | public function GetMashupTokensPage(string $tag, int $lastKnownScanTicks = 0, int $pageSize = 50)
{
$tokens = $this->ExecuteCall("GetMashupTokensPage", (object)[
"tag" => $tag,
"lastKnownScanTicks" => $lastKnownScanTicks,
"pageSize" => $pageSize
], GnResponseType:... | php | {
"resource": ""
} |
q29481 | Credentials.getAccessToken | train | public function getAccessToken()
{
if (is_string($this->access_token) && $this->isValidToken() ) {
$this->accessToken = $this->token_type . ' ' . $this->access_token;
return $this->accessToken;
}
return false;
} | php | {
"resource": ""
} |
q29482 | Credentials.getRefreshToken | train | public function getRefreshToken()
{
if (is_string($this->refresh_token) && $this->isValidToken() ){
$this->refreshToken = $this->token_type . ' ' . $this->refresh_token;
return $this->refreshToken;
}
return false;
} | php | {
"resource": ""
} |
q29483 | Credentials.set | train | public function set($key, $value=null)
{
// Set the time that this token was saved for the first time
$this->setAcquisitionTime();
if (is_null($value) && is_array($key)) {
// An array of attributes was passed in so save each one
foreach($key as $attribute => $value){... | php | {
"resource": ""
} |
q29484 | Credentials.setValue | train | private function setValue($key, $value)
{
$this->$key = $value;
if ($key == 'expires_in') $this->setExpiration($value);
} | php | {
"resource": ""
} |
q29485 | Credentials.setExpiration | train | private function setExpiration($expires_in)
{
$this->expiresAtTimestamp = time() + $expires_in;
$this->expiresAt = date('Y-m-d H:i:s', time() + $expires_in);
} | php | {
"resource": ""
} |
q29486 | Credentials.setAcquisitionTime | train | private function setAcquisitionTime()
{
if (is_null($this->acquisitionTime)) {
$this->acquisitionTime = date('Y-m-d H:i:s');
$this->acquisitionTimestamp = time();
};
} | php | {
"resource": ""
} |
q29487 | SeoRepository.findOneById | train | public function findOneById($seoId)
{
$qb = $this->createQueryBuilder('s');
$query = $qb
->andWhere($qb->expr()->eq('s.id', $seoId))
->setMaxResults(1)
->getQuery()
//->useResultCache(true, 3600, 'ekyna_cms.seo[id:'.$seoId.']') // TODO doctrine cache c... | php | {
"resource": ""
} |
q29488 | FilterMapper.mount | train | private function mount(array &$array, string $path, $message)
{
if ($path == '.') {
throw new MapperException(
"Unable to mount error `{$message}` to `{$path}` (root path is forbidden)"
);
}
$step = explode('.', $path);
while ($name = array_sh... | php | {
"resource": ""
} |
q29489 | FilterMapper.iterate | train | private function iterate(InputInterface $input, array $map): \Generator
{
$values = $input->getValue($map[self::ITERATE_SOURCE], $map[self::ITERATE_ORIGIN]);
if (empty($values) || !is_array($values)) {
return [];
}
foreach (array_keys($values) as $key) {
yiel... | php | {
"resource": ""
} |
q29490 | PageLocalization.setPathData | train | public function setPathData(Path $path = null, $active = true, $limited = false, $inSitemap = true)
{
// \Log::debug('QQQ: ', $this->getId(), ' - ', $this->getPathEntity()->isVisibleInSitemap(), ' --> ', $inSitemap);
$this->getPathEntity()->setPath($path);
$this->getPathEntity()->setActive($active);
$this->get... | php | {
"resource": ""
} |
q29491 | PageLocalization.getFullPath | train | public function getFullPath($format = Path::FORMAT_NO_DELIMITERS)
{
$pathString = $this->getPath()
->getFullPath($format);
return $pathString;
} | php | {
"resource": ""
} |
q29492 | PageLocalization.getRealPath | train | private function getRealPath($activeOnly)
{
$path = $this->getPathEntity()->getPath();
$active = $this->getPathEntity()->isActive();
// Method will return NullPath instance
if (is_null($path)) {
$path = NullPath::getInstance();
$this->getPathEntity()->setPath($path);
} elseif ($activeOnly && ! $active... | php | {
"resource": ""
} |
q29493 | PageLocalization.setPathPart | train | public function setPathPart($pathPart)
{
// Remove all special characters
$pathPart = strtr($pathPart, array('/' => '', '\\' => '', '#' => '', '?' => '', ' ' => '', '%' => ''));
$pathPart = trim($pathPart);
$this->pathPart = $pathPart;
} | php | {
"resource": ""
} |
q29494 | PageLocalization.isPublic | train | public function isPublic()
{
// This page not active
if ( ! $this->active) {
return false;
}
$pathEntity = $this->getPathEntity();
return $pathEntity->isActive()
&& $pathEntity->getPath() !== null;
} | php | {
"resource": ""
} |
q29495 | Find.voArray | train | public function voArray(VOArray $arrayValueObject)
{
if ($key = VOArray::fromArray($this->getValue())->getKey($arrayValueObject->current())) {
return $arrayValueObject->isLast() ? $key
: static::fromArray($key)
->voArray($arrayValueObject->dropFirst());
... | php | {
"resource": ""
} |
q29496 | LocaleManager.findLocalizedAsset | train | protected function findLocalizedAsset($locale, $asset)
{
$localized = $this->doFindLocalizedAsset($locale, $asset);
if (0 === \count($localized)) {
$localized = $this->doFindLocalizedAsset($this->getFallbackLocale(), $asset);
}
return $localized;
} | php | {
"resource": ""
} |
q29497 | LocaleManager.doFindLocalizedAsset | train | protected function doFindLocalizedAsset($locale, $asset)
{
if (isset($this->assets[$locale][$asset])) {
return $this->assets[$locale][$asset];
}
if (0 < $pos = strpos($locale, '_')) {
return $this->doFindLocalizedAsset(substr($locale, 0, $pos), $asset);
}
... | php | {
"resource": ""
} |
q29498 | LocaleManager.getCurrentLocale | train | protected function getCurrentLocale($locale = null)
{
return null !== $locale
? LocaleUtils::formatLocale($locale)
: $this->getLocale();
} | php | {
"resource": ""
} |
q29499 | LocaleManager.cleanArray | train | protected function cleanArray($property, $key, $subKey): void
{
$val = &$this->{$property};
unset($val[$key][$subKey]);
if (\array_key_exists($key, $val) && 0 === \count($val[$key])) {
unset($val[$key]);
}
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.