_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q28400 | Client.executeHttpRequest | train | private function executeHttpRequest(RequestInterface $httpRequest)
{
// Authorization
if ($this->authenticationMethod) {
$this->authenticationMethod->authorizeRequest($this, $httpRequest);
}
// Execution
$httpResponse = $this->client->send($httpRequest);
... | php | {
"resource": ""
} |
q28401 | Search.addProvider | train | public function addProvider(ProviderInterface $provider)
{
if (array_key_exists($name = $provider->getName(), $this->providers)) {
throw new \InvalidArgumentException("Wide search provider '{$name}' is already registered.");
}
$this->providers[$name] = $provider;
} | php | {
"resource": ""
} |
q28402 | Search.search | train | public function search($expression)
{
$results = [];
foreach ($this->providers as $provider) {
$results = array_merge($results, $provider->search($expression));
}
usort($results, function (Result $a, Result $b) {
if ($a->getScore() == $b->getScore()) {
... | php | {
"resource": ""
} |
q28403 | GoogleFonts.apply | train | public function apply()
{
$fonts = $this->getOnFonts($this->config->getArrayCopy());
$url = $this->fontsUrl($fonts);
$this->enqueue($url);
} | php | {
"resource": ""
} |
q28404 | GoogleFonts.fontsUrl | train | protected function fontsUrl($fonts): string
{
$font_families = \array_keys($fonts);
$query_args = [
'family' => \rawurlencode(\implode('|', $font_families)),
'subset' => \rawurlencode('latin,latin-ext'),
];
return \add_query_arg($query_args, 'https://fonts.g... | php | {
"resource": ""
} |
q28405 | CLogger.setContext | train | public function setContext($context = 'development')
{
switch ($context) {
case 'production':
break;
case 'development':
error_reporting(-1); // Report all type of errors
ini_set('display_errors', 1); // Display all e... | php | {
"resource": ""
} |
q28406 | Editor.getBlockManager | train | public function getBlockManager()
{
if (null === $this->blockManager) {
$this->blockManager = new Manager\BlockManager(
$this->config['default_block_plugin']
);
$this->blockManager->setEditor($this);
}
return $this->blockManager;
} | php | {
"resource": ""
} |
q28407 | Editor.getRowManager | train | public function getRowManager()
{
if (null === $this->rowManager) {
$this->rowManager = new Manager\RowManager();
$this->rowManager->setEditor($this);
}
return $this->rowManager;
} | php | {
"resource": ""
} |
q28408 | Editor.getContainerManager | train | public function getContainerManager()
{
if (null === $this->containerManager) {
$this->containerManager = new Manager\ContainerManager(
$this->config['default_container_plugin']
);
$this->containerManager->setEditor($this);
}
return $this-... | php | {
"resource": ""
} |
q28409 | Editor.getContentManager | train | public function getContentManager()
{
if (null === $this->contentManager) {
$this->contentManager = new Manager\ContentManager();
$this->contentManager->setEditor($this);
}
return $this->contentManager;
} | php | {
"resource": ""
} |
q28410 | Editor.getLayoutAdapter | train | public function getLayoutAdapter()
{
if (null === $this->layoutAdapter) {
$class = $this->config['layout']['adapter'];
$this->layoutAdapter = new $class;
$this->layoutAdapter->setEditor($this);
}
return $this->layoutAdapter;
} | php | {
"resource": ""
} |
q28411 | Editor.getViewBuilder | train | public function getViewBuilder()
{
if (null === $this->viewBuilder) {
$this->viewBuilder = new View\ViewBuilder();
$this->viewBuilder->setEditor($this);
}
return $this->viewBuilder;
} | php | {
"resource": ""
} |
q28412 | Editor.getContentData | train | public function getContentData()
{
$data = [
'locale' => $this->contentLocaleProvider->getCurrentLocale(),
];
if (null !== $page = $this->pageHelper->getCurrent()) {
$data['id'] = $page->getId();
}
return $data;
} | php | {
"resource": ""
} |
q28413 | Editor.createDefaultContainer | train | public function createDefaultContainer($type = null, array $data = [], EM\ContentInterface $content = null)
{
return $this->getContainerManager()->create($content, $type, $data);
} | php | {
"resource": ""
} |
q28414 | Editor.createDefaultRow | train | public function createDefaultRow(array $data = [], EM\ContainerInterface $container = null)
{
return $this->getRowManager()->create($container, $data);
} | php | {
"resource": ""
} |
q28415 | Editor.createDefaultBlock | train | public function createDefaultBlock($type = null, array $data = [], EM\RowInterface $row = null)
{
return $this->getBlockManager()->create($row, $type, $data);
} | php | {
"resource": ""
} |
q28416 | Editor.getPluginsConfig | train | public function getPluginsConfig()
{
$config = [
'block' => [],
'container' => [],
];
foreach ($this->pluginRegistry->getBlockPlugins() as $plugin) {
$config['block'][] = [
'name' => $plugin->getName(),
'title' => $plug... | php | {
"resource": ""
} |
q28417 | MySqlIndex.getDefinition | train | public function getDefinition()
{
$columnNames = " (`" . implode("`,`", $this->columnNames) . "`)";
switch ($this->indexType) {
case self::PRIMARY:
return "PRIMARY KEY" . $columnNames;
break;
case self::INDEX:
return "KEY `" . $... | php | {
"resource": ""
} |
q28418 | PageHelper.getHomePage | train | public function getHomePage(): ?PageInterface
{
if (false === $this->homePage) {
$this->homePage = $this->findByRoute($this->homeRoute);
}
return $this->homePage;
} | php | {
"resource": ""
} |
q28419 | PageHelper.getCmsRoutes | train | private function getCmsRoutes(): array
{
if ($this->routes) {
return $this->routes;
}
$item = $this->cache->getItem(self::PAGES_ROUTES_CACHE_KEY);
if ($item->isHit()) {
return $this->routes = $item->get();
}
$routes = $this->repository->getP... | php | {
"resource": ""
} |
q28420 | Session.getGlobalSessionId | train | public static function getGlobalSessionId() {
if(isset($_SERVER['PHPSESSID']))
return $_SERVER['PHPSESSID'];
elseif(isset($_POST['PHPSESSID']))
return $_POST['PHPSESSID'];
elseif(isset($_GET['PHPSESSID']))
return $_GET['PHPSESSID'];
} | php | {
"resource": ""
} |
q28421 | Session.get | train | public function get($path, $default=null) {
if(!$this->has($path))
return $default;
return ArrayUtils::get($_SESSION, $path);
} | php | {
"resource": ""
} |
q28422 | Session.set | train | public function set($path, $value=null) {
#to set multiple variables at once.
if(is_array($path)) {
foreach($path as $k=>$v)
static::set($k, $v);
}
else
ArrayUtils::set($_SESSION, $path, $value);
} | php | {
"resource": ""
} |
q28423 | ImageSizeCreatorListener.createImageSize | train | protected function createImageSize(ImageReferencedElement $entity, EntityManager $em)
{
$imageId = $entity->getImageId();
$fileStorage = $this->container['cms.file_storage'];
/* @var $fileStorage \Supra\Package\Cms\FileStorage\FileStorage */
$image = $fileStorage->findImage($imageId);
if ($image === null)... | php | {
"resource": ""
} |
q28424 | SearchConditionAbstraction.add | train | public function add($field, $relation, $value)
{
$this->conditions[] = array(
self::FIELD_POS => $field,
self::RELATION_POS => $relation,
self::VALUE_POS => $value
);
} | php | {
"resource": ""
} |
q28425 | ImageBlockType.buildImageOptionsForm | train | private function buildImageOptionsForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('align', Type\ChoiceType::class, [
'label' => 'ekyna_cms.block.field.align',
'choices' => [
'Left' => 'left',
'Cent... | php | {
"resource": ""
} |
q28426 | Is.email | train | public static function email(string $value): bool
{
$result = filter_var($value, FILTER_VALIDATE_EMAIL);
return is_string($result) && $value === $result;
} | php | {
"resource": ""
} |
q28427 | Is.url | train | public static function url(string $value): bool
{
$result = filter_var($value, FILTER_VALIDATE_URL);
return is_string($result) && $value === $result;
} | php | {
"resource": ""
} |
q28428 | Is.ip | train | public static function ip(string $value): bool
{
$result = filter_var($value, FILTER_VALIDATE_IP);
return is_string($result) && $value === $result;
} | php | {
"resource": ""
} |
q28429 | Is.macAddress | train | public static function macAddress(string $value): bool
{
$result = filter_var($value, FILTER_VALIDATE_MAC);
return is_string($result) && $value === $result;
} | php | {
"resource": ""
} |
q28430 | AbstractPaginationQuery.filter | train | public function filter($value, SolrDisMaxQuery $query = null, Facets $facets = null)
{
if (null === $query) {
throw new DomainException('$query must not be null');
}
if (null === $facets) {
throw new DomainException('$facets must not be null');
}
... | php | {
"resource": ""
} |
q28431 | Logger.handle | train | protected function handle(\Plop\RecordInterface $record)
{
if ($this->filters->filter($record)) {
$this->callHandlers($record);
}
return $this;
} | php | {
"resource": ""
} |
q28432 | Logger.callHandlers | train | protected function callHandlers(\Plop\RecordInterface $record)
{
if (!count($this->handlers) && !$this->emittedWarning) {
$stderr = $this->getStderr();
fprintf(
$stderr,
'No handlers could be found for logger ("%s" in "%s")' . "\n",
$th... | php | {
"resource": ""
} |
q28433 | FrontendModelController.showlist | train | public function showlist() {
if ($this->getRecord() && $this->getRecord() instanceof ItemList) {
if ($this->request->getExtension() == 'csv') {
$this->response->addHeader('Content-type', 'text/csv');
return $this->getRecord()->toCSV();
} else {
$content = $this->getRecord()->forTemplate();
i... | php | {
"resource": ""
} |
q28434 | Kernel.getContainer | train | public function getContainer() {
if(!$this->container) {
$this->container = $this->buildContainer();
$this->container['kernel'] = $this;
}
return $this->container;
} | php | {
"resource": ""
} |
q28435 | Kernel.getConfig | train | public function getConfig() {
if(!$this->config) {
$this->config = $config = new \Asgard\Config\Config($this->getCache());
if(file_exists($this->params['root'].'/config'))
$config->loadDir($this->params['root'].'/config', $this->getEnv());
}
return $this->config;
} | php | {
"resource": ""
} |
q28436 | Kernel.setup | train | public function setup() {
$this->errorHandler = $errorHandler = \Asgard\Debug\ErrorHandler::register();
if(php_sapi_name() !== 'cli')
\Asgard\Debug\Debug::setFormat('html');
register_shutdown_function([$this, 'shutdownFunction']);
$this->addShutdownCallback([$errorHandler, 'shutdownFunction']);
$compiled... | php | {
"resource": ""
} |
q28437 | Kernel.loadBundles | train | public function loadBundles() {
if($this->loaded)
return;
$this->bundles = $this->doGetBundles();
$container = $this->getContainer();
if($this->params['env']) {
if(file_exists($this->params['root'].'/app/bootstrap_'.strtolower($this->params['env']).'.php'))
include $this->params['root'].'/app/bootst... | php | {
"resource": ""
} |
q28438 | Kernel.setDefaultEnvironment | train | protected function setDefaultEnvironment() {
#Using _ENV_ and $_SERVER only as the last chance to guess the environment.
#User can and should set the environment through constructor or setEnv($env).
if(isset($this->params['env']))
return;
if(defined('_ENV_'))
$this->params['env'] = _ENV_;
elseif(file_e... | php | {
"resource": ""
} |
q28439 | Kernel.buildContainer | train | protected function buildContainer() {
$cache = $this->getCache();
if($cache) {
if(($container = $cache->fetch('asgard.container')) instanceof \Asgard\Container\Container) {
$container['kernel'] = $this;
$container['errorHandler'] = $this->errorHandler;
$this->container = $container;
#make $this-... | php | {
"resource": ""
} |
q28440 | Kernel.runBundles | train | protected function runBundles() {
$bundles = $this->getAllBundles();
foreach($bundles as $bundle)
$bundle->run($this->container);
} | php | {
"resource": ""
} |
q28441 | Kernel.getAllBundles | train | public function getAllBundles() {
if($this->bundles === null)
$this->bundles = $this->doGetBundles();
return $this->bundles;
} | php | {
"resource": ""
} |
q28442 | Kernel.getHooksAnnotationReader | train | public function getHooksAnnotationReader() {
$AnnotationReader = new \Asgard\Hook\AnnotationReader;
if($this->getCache())
$AnnotationReader->setCache($this->getCache());
$AnnotationReader->setDebug($this->getConfig()['debug']);
return $AnnotationReader;
} | php | {
"resource": ""
} |
q28443 | Kernel.getControllersAnnotationReader | train | public function getControllersAnnotationReader() {
$AnnotationReader = new \Asgard\Http\AnnotationReader;
if($this->getCache())
$AnnotationReader->setCache($this->getCache());
$AnnotationReader->setDebug($this->getConfig()['debug']);
return $AnnotationReader;
} | php | {
"resource": ""
} |
q28444 | Kernel.doGetBundles | train | protected function doGetBundles() {
$cache = $this->getCache();
if($cache)
$bundles = $cache->fetch('asgard.bundles');
if(!isset($bundles) || $bundles === false) {
$bundles = array_merge($this->addedBundles, $this->getBundles());
$newBundles = false;
foreach($bundles as $k=>$v) {
if(is_string($v... | php | {
"resource": ""
} |
q28445 | Kernel.getCompiledFile | train | public function getCompiledFile() {
if($this->compiledFile === null)
$this->compiledFile = $this->params['root'].'/storage/compiled.php';#default path
return $this->compiledFile;
} | php | {
"resource": ""
} |
q28446 | TableBuilderTemplateMigration.saveTblNameInSession | train | protected function saveTblNameInSession($name) {
if ($session = Yii::$app->getComponents()) {
if (isset($session['session'])) {
if ($mName = Yii::$app->session->get($this->tableName)) {
return $mName;
}
Yii::$app->session->set($thi... | php | {
"resource": ""
} |
q28447 | TableBuilderTemplateMigration.resetSessionMigrationName | train | public function resetSessionMigrationName() {
if ($session = Yii::$app->getComponents()) {
if (isset($session['session'])) {
Yii::$app->session->set($this->tableName, null);
}
}
} | php | {
"resource": ""
} |
q28448 | TableBuilderTemplateMigration.getMigrationName | train | public function getMigrationName($name = '') {
$name = $name ? : $this->prefix . $this->tableNameRaw;
$components = Yii::$app->getComponents();
if (isset($components['session'])) {
Yii::$app->session->set($this->tableName, '');
}
$this->migrationName= $this->migratio... | php | {
"resource": ""
} |
q28449 | Iban.getCountryCode | train | public function getCountryCode()
{
$countryCode = '';
$iban = $this->getIban();
if (!empty($iban)) {
$countryCode = substr($iban, 0, 2);
}
return $countryCode;
} | php | {
"resource": ""
} |
q28450 | Iban.getCheckDigits | train | public function getCheckDigits()
{
$checkDigits = '';
$iban = $this->getIban();
if (!empty($iban)) {
$checkDigits = substr($iban, 2, 2);
}
return $checkDigits;
} | php | {
"resource": ""
} |
q28451 | Iban.prepareCheckDigitsCalculate | train | public function prepareCheckDigitsCalculate($iban)
{
$firstPlaces = substr((string)$iban, 0, 2);
$lastPlaces = substr((string)$iban, 4);
$conversion = strtr((string)$lastPlaces . (string)$firstPlaces . '00', $this->charMatching);
return $conversion;
} | php | {
"resource": ""
} |
q28452 | RepositoryAbstraction.add | train | public function add(NodeInterface $node)
{
$max = $this->getMax();
$node->setLeftValue($max + 1);
$node->setRightValue($max + 2);
$node->setLevel(0);
} | php | {
"resource": ""
} |
q28453 | RepositoryAbstraction.getRootNodes | train | public function getRootNodes()
{
$searchCondition = $this->createSearchCondition();
$searchCondition->levelEqualsTo(0);
$rootNodes = $this->search($searchCondition);
return $rootNodes;
} | php | {
"resource": ""
} |
q28454 | RepositoryAbstraction.drawTree | train | public function drawTree()
{
$searchCondition = $this->createSearchCondition();
$orderRule = $this->createSelectOrderRule()
->byLeftAscending();
$nodes = $this->search($searchCondition, $orderRule);
$output = Node\NodeAbstraction::output($nodes);
return $output;
} | php | {
"resource": ""
} |
q28455 | ORM.relation | train | public function relation($relationName) {
if(!$this->dataMapper->hasRelation($this->definition, $relationName))
throw new \Exception('Relation '.$relationName.' does not exist.');
$relation = $this->dataMapper->relation($this->definition, $relationName);
$reverseRelation = $relation->reverse();
$reverse... | php | {
"resource": ""
} |
q28456 | ORM.updateConditions | train | protected function updateConditions(array $conditions, $table, $alias) {
$res = [];
foreach($conditions as $k=>$v) {
if(is_array($v))
$v = $this->updateConditions($v, $table, $alias);
else
$v = preg_replace('/(?<![\.a-zA-Z0-9-_`\(\)])'.$table.'\./', $alias.'.', $v);
$k = preg_replace('/(?<... | php | {
"resource": ""
} |
q28457 | ORM.getNewAlias | train | protected function getNewAlias($name, array $existing) {
$i=1;
$alias = $name;
while(in_array($alias, $existing))
$alias = $name.$i++;
return $alias;
} | php | {
"resource": ""
} |
q28458 | ORM.hydrate | train | protected function hydrate(\Asgard\Entity\Entity $entity, array $raw) {
$this->unserialize($entity, $raw);
$entity->setParameter('persisted', true);
$entity->resetChanged();
return $entity;
} | php | {
"resource": ""
} |
q28459 | ORM.unserialize | train | protected function unserialize(\Asgard\Entity\Entity $entity, array $data, $locale=null) {
foreach($this->dataMapper->getEntityDefinition($entity)->properties() as $k=>$prop) {
$v = isset($data[$k]) ? $data[$k]:null;
if($prop->get('type') === 'entity') {
if($prop->get('many'))
$data[$k] = new Pe... | php | {
"resource": ""
} |
q28460 | ORM._getDAL | train | public function _getDAL() {
$dal = new \Asgard\Db\DAL($this->dataMapper->getDB());
$table = $this->getTable();
$dal->orderBy($this->orderBy);
if($this->reversed)
$dal->reverse();
$dal->limit($this->limit);
$dal->offset($this->offset);
if($this->groupBy === null)
$dal->groupBy($table.'.id');... | php | {
"resource": ""
} |
q28461 | ORM.recursiveJointures | train | protected function recursiveJointures(\Asgard\Db\DAL $dal, $jointures, \Asgard\Entity\Definition $definition, $table) {
$alias = null;
if(is_array($jointures)) {
foreach($jointures as $relation=>$v) {
#jointure type
if(preg_match('/^[^ ]+join /', $relation, $matches)) {
$type = trim($matches[0... | php | {
"resource": ""
} |
q28462 | ORM.replaceTable | train | protected function replaceTable($sql) {
$table = $this->getTable();
$i18nTable = $this->getTranslationTable();
preg_match_all('/(?<![\.a-zA-Z0-9-_`\(\)])([a-z_][a-zA-Z0-9-_]*)(?![\.`\(\)])/', $sql, $matches);
foreach($matches[0] as $property) {
if($this->definition->hasProperty($property))
$table =... | php | {
"resource": ""
} |
q28463 | ORM.processConditions | train | protected function processConditions(array $conditions) {
foreach($cp=$conditions as $k=>$v) {
if(is_numeric($k) || in_array(strtolower($k), ['and', 'or', 'xor', 'not'])) {
$newK = $k;
if(is_array($v))
$v = $this->processConditions($v);
else
$v = $this->replaceTable($v);
}
else... | php | {
"resource": ""
} |
q28464 | ORM.rewind | train | public function rewind() {
if(!$this->tmp_dal)
$this->tmp_dal = $this->getDAL();
$this->tmp_dal->rewind();
} | php | {
"resource": ""
} |
q28465 | ORM.current | train | public function current() {
if(!($r = $this->tmp_dal->current()))
return null;
else {
$entity = $this->definition->make([], $this->locale);
return $this->hydrate($entity, $r);
}
} | php | {
"resource": ""
} |
q28466 | ORM.union | train | public function union($dals) {
if(!is_array($dals))
$dals = [$dals];
$this->unions = array_merge($this->unions, $dals);
return $this;
} | php | {
"resource": ""
} |
q28467 | CPageContent.getContentForRoute | train | public function getContentForRoute()
{
$route = $this->di->request->getRoute();
$parts = $this->di->request->getRouteParts();
$toc = $this->getTableOfContent($parts[0]);
$route = $this->mapRoute2Toc($route, $toc);
$baseroute = dirname($route);
$filter = $this->con... | php | {
"resource": ""
} |
q28468 | CPageContent.mapRoute2Toc | train | public function mapRoute2Toc($route, $toc)
{
if (key_exists($route, $toc)) {
return $route;
} elseif (key_exists($route . "/index", $toc)) {
return $route . "/index";
}
throw new \Anax\Exception\NotFoundException(t('The page does not exists.'));
} | php | {
"resource": ""
} |
q28469 | CPageContent.getTitleFromFirstLine | train | public function getTitleFromFirstLine($file)
{
$content = file_get_contents($file, false, null, -1, 512);
$title = strstr($content, "\n", true);
return $title;
} | php | {
"resource": ""
} |
q28470 | CPageContent.getTableOfContent | train | public function getTableOfContent($id)
{
if ($this->toc) {
return $this->toc;
}
$key = $this->di->cache->createKey(__CLASS__, 'toc-' . $id);
$this->toc = $this->di->cache->get($key);
if (!$this->toc) {
$this->toc = $this->createTableOfContent();
... | php | {
"resource": ""
} |
q28471 | CPageContent.createTableOfContent | train | public function createTableOfContent()
{
$basepath = $this->config['basepath'];
$pattern = $this->config['pattern'];
$route = $this->di->request->getRoute();
// if dir, add index if file exists.
// partly for adding doc/index to work
// partly to make doc/ ... | php | {
"resource": ""
} |
q28472 | SubmittedFormForListExtension.updateItemTableFormatting | train | public function updateItemTableFormatting(&$formatting) {
foreach ($this->owner->Values() as $field) {
$fieldVal = $field->getFormattedValue();
$this->owner->{$field->Name} = $fieldVal;
}
} | php | {
"resource": ""
} |
q28473 | Headers.setHeader | train | public function setHeader(string $header, string $content): Headers
{
$this->headers[self::processKey($header)] = $content;
return $this;
} | php | {
"resource": ""
} |
q28474 | Headers.setHeaders | train | public function setHeaders(array $headers = []): Headers
{
$this->headers = array();
foreach ($headers as $header => $data) {
$this->setHeader((string)$header, (string)$data);
}
return $this;
} | php | {
"resource": ""
} |
q28475 | Headers.headerExists | train | public function headerExists(string $header): bool
{
return array_key_exists(self::processKey($header), $this->getHeaders());
} | php | {
"resource": ""
} |
q28476 | Headers.parseHeaders | train | public static function parseHeaders(string $headers): array
{
$parsedHeaders = array();
foreach (explode("\n", $headers) as $header) {
@list($headerTitle, $headerValue) = explode(':', $header, 2);
if (!isset($headerValue)) {
continue;
}
... | php | {
"resource": ""
} |
q28477 | Bootstrap3Adapter.validateBlockLayout | train | protected function validateBlockLayout(array $data)
{
foreach (array_keys(static::getDevices()) as $device) {
// If layout set for this device
if (!isset($data[$device])) {
continue;
}
$size = isset($data[$device][static::SIZE]) ? $data[$devic... | php | {
"resource": ""
} |
q28478 | Bootstrap3Adapter.cleanUpBlockLayout | train | protected function cleanUpBlockLayout(Model\BlockInterface $block, array $data)
{
$clean = [];
// TODO responsive padding
if (isset($data[static::PADDING_TOP]) && 0 < $data[static::PADDING_TOP]) {
$clean[static::PADDING_TOP] = $data[static::PADDING_TOP];
}
if (is... | php | {
"resource": ""
} |
q28479 | Bootstrap3Adapter.validateLayoutStyles | train | protected function validateLayoutStyles(array $layout)
{
if (isset($layout[static::PADDING_TOP])
&& (0 > $layout[static::PADDING_TOP] || 300 < $layout[static::PADDING_TOP])
) {
throw new InvalidArgumentException('Invalid layout padding top');
}
if (isset($lay... | php | {
"resource": ""
} |
q28480 | Bootstrap3Adapter.applyLayoutStyles | train | protected function applyLayoutStyles(View\AttributesInterface $attributes, array $layout)
{
foreach ([static::PADDING_TOP => '%spx', static::PADDING_BOTTOM => '%spx'] as $property => $template) {
if (isset($layout[$property]) && 0 < $layout[$property]) {
$attributes->addStyle(
... | php | {
"resource": ""
} |
q28481 | Bootstrap3Adapter.getCurrentBlockProperty | train | protected function getCurrentBlockProperty(Model\BlockInterface $block, $property, $default)
{
$layout = $block->getLayout();
$currentSize = $default;
foreach ($this->resolveLowerDevices() as $d) {
if (isset($layout[$d]) && isset($layout[$d][$property])) {
$curre... | php | {
"resource": ""
} |
q28482 | Bootstrap3Adapter.setCurrentBlockProperty | train | protected function setCurrentBlockProperty(Model\BlockInterface $block, $property, $current)
{
$layout = $block->getLayout();
// Update the current device layout
$currentDevice = $this->resolveCurrentDevice();
$layout = array_replace_recursive($layout, [
$currentDevice =... | php | {
"resource": ""
} |
q28483 | Bootstrap3Adapter.resolveCurrentDevice | train | private function resolveCurrentDevice()
{
if (0 == $viewportWidth = $this->editor->getViewportWidth()) {
throw new RuntimeException('Unexpected editor viewport width.');
}
foreach (static::getDevices() as $device => $config) {
if ($viewportWidth >= $config['max']) {
... | php | {
"resource": ""
} |
q28484 | Bootstrap3Adapter.resolveGreaterDevices | train | private function resolveGreaterDevices()
{
if (0 == $viewportWidth = $this->editor->getViewportWidth()) {
throw new RuntimeException('Unexpected editor viewport width.');
}
$devices = [];
foreach (static::getDevices() as $device => $config) {
if ($device ===... | php | {
"resource": ""
} |
q28485 | Rectangle.getContent | train | public function getContent()
{
$this->tagName = 'rect';
$this->addAttribute('x', $this->x);
$this->addAttribute('y', $this->y);
$this->addAttribute('width', $this->width);
$this->addAttribute('height', $this->height);
$this->addAttribute('fill', $this->color);
... | php | {
"resource": ""
} |
q28486 | ObjectCreatorPage.ReviewItemsViewable | train | public function ReviewItemsViewable() {
$reviewItems = $this->ReviewItems();
if (!$reviewItems) {
return;
}
$result = array();
foreach ($reviewItems as $page)
{
if ($page && $page->_canView && !$page->_canEdit)
{
$result[] = $page;
}
}
return new ArrayList($result);
} | php | {
"resource": ""
} |
q28487 | ObjectCreatorPage.ReviewItemsEditable | train | public function ReviewItemsEditable() {
$reviewItems = $this->ReviewItems();
if (!$reviewItems) {
return;
}
$result = array();
foreach ($reviewItems as $page)
{
if ($page && $page->_canEdit)
{
$result[] = $page;
}
}
$result = new ArrayList($result);
$result = $result->sort(array(
'_... | php | {
"resource": ""
} |
q28488 | ObjectCreatorPage.canReview | train | public function canReview($member, $record) {
$extended = $this->extendedCan(__FUNCTION__, $member);
if($extended !== null) return $extended;
if (!class_exists('FrontEndWorkflowController')) {
// Cannot review if there's no workflow module installed
return false;
}
// NOTE(Jake): Might *want* to updat... | php | {
"resource": ""
} |
q28489 | ObjectCreatorPage_Controller.createLocationFilter | train | public function createLocationFilter($node) {
$allow = $this->extend('filterCreateLocations', $node);
if (count($allow) == 0) {
return true;
}
return min($allow) > 0;
} | php | {
"resource": ""
} |
q28490 | ObjectCreatorPage_Controller.NewObject | train | public function NewObject() {
$id = (int) $this->request->requestVar('new');
if ($id) {
$item = DataObject::get_by_id($this->CreateType, $id);
if (!$item) {
$item = Versioned::get_by_stage($this->CreateType, 'Stage')->byID($id);
}
return $item;
}
return null;
} | php | {
"resource": ""
} |
q28491 | ObjectCreatorPage_Controller.doReview | train | public function doReview($data) {
$id = isset($data['ID']) ? (int)$data['ID'] : null;
if (!$id) {
user_error('Invalid ID passed for review action');
$this->redirectBack();
}
return $this->owner->redirect(Controller::join_links($this->owner->Link('review'), $id));
} | php | {
"resource": ""
} |
q28492 | ObjectCreatorPage_Controller.objectExists | train | public function objectExists() {
if ($this->data()->useObjectExistsHandling()) {
return singleton($this->CreateType)->objectExists($this->request->postVars(), $this->pid);
}
} | php | {
"resource": ""
} |
q28493 | MacrosService.createMacroInstance | train | function createMacroInstance ($tagName)
{
$propsClass = $tagName . 'Properties';
$path = $this->findMacroFile ($tagName);
$com = new MacroCall;
$com->propsClass = $propsClass;
$com->templateUrl = $path;
return $com;
} | php | {
"resource": ""
} |
q28494 | Form.render | train | public function render()
{
if (array_key_exists($this->formType, $this->formsType)) {
$this->form = new $this->formsType[$this->formType]
(
$this->idName,
$this->elements,
$this->method,
$this->action
);
... | php | {
"resource": ""
} |
q28495 | GnApi.GetLoginApiForAdmin | train | public function GetLoginApiForAdmin(string $loginId = NULL, string $langId = NULL)
{
if (GnUtil::IsNullOrEmpty($langId)) {
$langId = GnSettings::$CurrentLangId;
}
$loginApi = new Modules\GnLoginApiAdmin($this, NULL, $loginId, $langId);
return $loginApi;
} | php | {
"resource": ""
} |
q28496 | GnApi.GetLoginApiForEndUser | train | public function GetLoginApiForEndUser(string $appKey = NULL, string $loginId = NULL, string $langId = NULL)
{
if (GnUtil::IsNullOrEmpty($langId)) {
$langId = GnSettings::$CurrentLangId;
}
$loginApi = new Modules\GnLoginApiEndUser($this, $appKey, $loginId, $langId);
retu... | php | {
"resource": ""
} |
q28497 | CmsProcessor.generateSeo | train | protected function generateSeo(CmsModel\SeoSubjectInterface $subject)
{
$seo = $this->seoRepository->createNew();
if (0 < strlen($name = $this->objectToString($subject))) {
$seo
->setTitle($name . ' seo title')
->setDescription($name . ' seo description');... | php | {
"resource": ""
} |
q28498 | CmsProcessor.objectToString | train | protected function objectToString($object)
{
$r = new \ReflectionClass(get_class($object));
if ($r->hasMethod('__toString')) {
return (string)$object;
}
foreach (['getName', 'getTitle'] as $getter) {
if ($r->hasMethod($getter)) {
try {
... | php | {
"resource": ""
} |
q28499 | SecureRandom.getDefaultGenerator | train | private function getDefaultGenerator()
{
foreach (self::$defaultGenerators as $generator) {
/** @var Generator\Generator $generator */
$generator = new $generator();
if ($generator->isSupported()) {
return $generator;
}
}
thro... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.