_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q18100 | RequestHandler.Link | train | public function Link($action = null)
{
// Check configured url_segment
$url = $this->config()->get('url_segment');
if ($url) {
$link = Controller::join_links($url, $action, '/');
// Give extensions the chance to modify by reference
$this->extend('updateLi... | php | {
"resource": ""
} |
q18101 | RequestHandler.getReturnReferer | train | public function getReturnReferer()
{
$referer = $this->getReferer();
| php | {
"resource": ""
} |
q18102 | SQLUpdate.create | train | public static function create($table = null, $assignment = array(), $where = | php | {
"resource": ""
} |
q18103 | TinyMCECombinedGenerator.generateContent | train | public function generateContent(TinyMCEConfig $config)
{
$tinymceDir = $config->getTinyMCEResource();
// List of string / ModuleResource references to embed
$files = [];
// Add core languages
$language = $config->getOption('language');
if ($language) {
$... | php | {
"resource": ""
} |
q18104 | TinyMCECombinedGenerator.checkName | train | protected function checkName(TinyMCEConfig $config)
{
$configs = HTMLEditorConfig::get_available_configs_map();
foreach ($configs as $id => $name) {
| php | {
"resource": ""
} |
q18105 | TinyMCECombinedGenerator.generateFilename | train | public function generateFilename(TinyMCEConfig $config)
{
$hash = substr(sha1(json_encode($config->getAttributes())), 0, 10);
$name = $this->checkName($config);
$url = str_replace(
['{name}', '{hash}'],
| php | {
"resource": ""
} |
q18106 | TinyMCECombinedGenerator.resolveRelativeResource | train | protected function resolveRelativeResource($base, $resource)
{
// Return resource path based on relative resource path
foreach (['', '.min.js', '.js'] as $ext) {
// Map resource
if ($base instanceof ModuleResource) {
| php | {
"resource": ""
} |
q18107 | TinyMCECombinedGenerator.resourceExists | train | protected function resourceExists($resource)
{
if (!$resource) {
return false;
}
if ($resource instanceof ModuleResource) | php | {
"resource": ""
} |
q18108 | InstallRequirements.checkDatabase | train | public function checkDatabase($databaseConfig)
{
// Check if support is available
if (!$this->requireDatabaseFunctions(
$databaseConfig,
array(
"Database Configuration",
"Database support",
"Database support in PHP",
... | php | {
"resource": ""
} |
q18109 | InstallRequirements.getOriginalIni | train | protected function getOriginalIni($settingName)
{
if (isset($this->originalIni[$settingName])) {
| php | {
"resource": ""
} |
q18110 | InstallRequirements.requireNoClasses | train | public function requireNoClasses($classNames, $testDetails)
{
$this->testing($testDetails);
$badClasses = array();
foreach ($classNames as $className) {
if (class_exists($className)) {
$badClasses[] = $className;
}
}
if ($badClasses) {
... | php | {
"resource": ""
} |
q18111 | DBDate.DayOfMonth | train | public function DayOfMonth($includeOrdinal = false)
{
$number = $this->Format('d');
if ($includeOrdinal && $number) { | php | {
"resource": ""
} |
q18112 | DBDate.Long | train | public function Long()
{
if (!$this->value) {
return null;
}
| php | {
"resource": ""
} |
q18113 | DBDate.Full | train | public function Full()
{
if (!$this->value) {
return null;
}
| php | {
"resource": ""
} |
q18114 | DBDate.getFormatter | train | public function getFormatter($dateLength = IntlDateFormatter::MEDIUM, $timeLength = | php | {
"resource": ""
} |
q18115 | DBDate.FormatFromSettings | train | public function FormatFromSettings($member = null)
{
if (!$member) {
$member = Security::getCurrentUser();
}
// Fall back to nice
if (!$member) {
| php | {
"resource": ""
} |
q18116 | DBDate.RangeString | train | public function RangeString($otherDateObj, $includeOrdinals = false)
{
$d1 = $this->DayOfMonth($includeOrdinals);
$d2 = $otherDateObj->DayOfMonth($includeOrdinals);
$m1 = $this->ShortMonth();
$m2 = $otherDateObj->ShortMonth();
$y1 = $this->Year();
$y2 = $otherDateObj-... | php | {
"resource": ""
} |
q18117 | DBDate.Rfc2822 | train | public function Rfc2822()
{
$formatter = $this->getInternalFormatter();
$formatter->setPattern('y-MM-dd | php | {
"resource": ""
} |
q18118 | DBDate.TimeDiffIn | train | public function TimeDiffIn($format)
{
if (!$this->value) {
return null;
}
$now = DBDatetime::now()->getTimestamp();
$time = $this->getTimestamp();
$ago = abs($time - $now);
switch ($format) {
case "seconds":
$span = $ago;
... | php | {
"resource": ""
} |
q18119 | DBDate.IsToday | train | public function IsToday()
{
return $this->Format(self::ISO_DATE) | php | {
"resource": ""
} |
q18120 | DBDate.fixInputDate | train | protected function fixInputDate($value)
{
// split
list($year, $month, $day, $time) = $this->explodeDateString($value);
if ((int)$year === 0 && (int)$month === 0 && (int)$day === 0) {
return null;
| php | {
"resource": ""
} |
q18121 | DBDate.explodeDateString | train | protected function explodeDateString($value)
{
// split on known delimiters (. / -)
if (!preg_match(
'#^(?<first>\\d+)[-/\\.](?<second>\\d+)[-/\\.](?<third>\\d+)(?<time>.*)$#',
$value,
$matches
)) {
throw new InvalidArgumentException(
... | php | {
"resource": ""
} |
q18122 | FormTemplateHelper.generateFieldID | train | public function generateFieldID($field)
{
if ($form = $field->getForm()) {
return sprintf(
"%s_%s",
| php | {
"resource": ""
} |
q18123 | SSViewer_DataPresenter.cacheIteratorProperties | train | protected function cacheIteratorProperties()
{
if (self::$iteratorProperties !== null) {
return;
}
self::$iteratorProperties = $this->getPropertiesFromProvider(
| php | {
"resource": ""
} |
q18124 | SSViewer_DataPresenter.popScope | train | public function popScope()
{
$upIndex = $this->getUpIndex();
if ($upIndex !== null) {
$itemStack = | php | {
"resource": ""
} |
q18125 | SSViewer_DataPresenter.processTemplateOverride | train | protected function processTemplateOverride($property, $overrides)
{
if (!isset($overrides[$property])) {
return null;
}
// Detect override type
$override = $overrides[$property];
// Late-evaluate this value
if (!is_string($override) && is_callable($overr... | php | {
"resource": ""
} |
q18126 | SSViewer_DataPresenter.getValueSource | train | protected function getValueSource($property)
{
// Check for a presenter-specific override
$overlay = $this->processTemplateOverride($property, $this->overlay);
if (isset($overlay)) {
return $overlay;
}
// Check if the method to-be-called exists on the target obje... | php | {
"resource": ""
} |
q18127 | SSViewer_DataPresenter.castValue | train | protected function castValue($value, $source)
{
// Already cast
if (is_object($value)) {
return $value;
}
// Get provided or default cast
$casting = empty($source['casting'])
| php | {
"resource": ""
} |
q18128 | SwiftPlugin.beforeSendPerformed | train | public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
{
/** @var \Swift_Message $message */
$message = $evt->getMessage();
$sendAllTo = Email::getSendAllEmailsTo();
if (!empty($sendAllTo)) {
$this->setTo($message, $sendAllTo);
}
$ccAllTo = Em... | php | {
"resource": ""
} |
q18129 | MarkedSet.getChildren | train | protected function getChildren(DataObject $node)
{
$method = $this->getChildrenMethod();
| php | {
"resource": ""
} |
q18130 | MarkedSet.setChildrenMethod | train | public function setChildrenMethod($method)
{
// Check method is valid
if (!$this->rootNode->hasMethod($method)) {
throw new InvalidArgumentException(sprintf(
"Can't find the method '%s' on class '%s' for getting tree children",
| php | {
"resource": ""
} |
q18131 | MarkedSet.setNumChildrenMethod | train | public function setNumChildrenMethod($method)
{
// Check method is valid
if (!$this->rootNode->hasMethod($method)) {
throw new InvalidArgumentException(sprintf(
"Can't find the method '%s' on class '%s' for counting tree children",
| php | {
"resource": ""
} |
q18132 | MarkedSet.getChildrenAsArray | train | public function getChildrenAsArray($serialiseEval = null)
{
if (!$serialiseEval) {
$serialiseEval = function ($data) {
/** @var DataObject $node */
$node = $data['node'];
return [
'id' => $node->ID,
'title' =... | php | {
"resource": ""
} |
q18133 | MarkedSet.renderSubtree | train | protected function renderSubtree($data, $template, $context = [])
{
// Render children
$childNodes = new ArrayList();
foreach ($data['children'] as $child) {
$childData = $this->renderSubtree($child, $template, $context);
$childNodes->push($childData);
}
... | php | {
"resource": ""
} |
q18134 | MarkedSet.getSubtreeAsArray | train | protected function getSubtreeAsArray($data, $serialiseEval)
{
$output = $data;
// Serialise node
$serialised = $serialiseEval($data['node']);
// Force serialisation of DBField instances
if (is_array($serialised)) {
foreach ($serialised as $key => $value) {
... | php | {
"resource": ""
} |
q18135 | MarkedSet.getSubtree | train | protected function getSubtree($node, $depth = 0)
{
// Check if this node is limited due to child count
$numChildren = $this->getNumChildren($node);
$limited = $this->isNodeLimited($node, $numChildren);
// Build root rode
$expanded = $this->isExpanded($node);
$opened ... | php | {
"resource": ""
} |
q18136 | MarkedSet.markClosed | train | public function markClosed(DataObject $node)
{
$id = $node->ID ?: 0;
$this->markedNodes[$id] = $node;
| php | {
"resource": ""
} |
q18137 | MarkedSet.isExpanded | train | public function isExpanded(DataObject $node)
{
$id = $node->ID ?: 0;
| php | {
"resource": ""
} |
q18138 | MarkedSet.isTreeOpened | train | public function isTreeOpened(DataObject $node)
{
$id = $node->ID ?: 0;
| php | {
"resource": ""
} |
q18139 | MarkedSet.isNodeLimited | train | protected function isNodeLimited(DataObject $node, $count = null)
{
// Singleton root node isn't limited
if (!$node->ID) {
return false;
}
// Check if limiting is enabled first
if (!$this->getLimitingEnabled()) {
return false;
| php | {
"resource": ""
} |
q18140 | TinyMCEConfig.getInternalPlugins | train | public function getInternalPlugins()
{
// Return only plugins with no custom url
$plugins = [];
foreach ($this->getPlugins() as $name => $url) {
| php | {
"resource": ""
} |
q18141 | TinyMCEConfig.setButtonsForLine | train | public function setButtonsForLine($line, $buttons)
{
if (func_num_args() > 2) {
$buttons = func_get_args();
| php | {
"resource": ""
} |
q18142 | TinyMCEConfig.modifyButtons | train | protected function modifyButtons($name, $offset, $del = 0, $add = null)
{
foreach ($this->buttons as &$buttons) {
if (($idx = array_search($name, $buttons)) !== false) {
if ($add) {
array_splice($buttons, $idx + $offset, $del, $add);
} else {
... | php | {
"resource": ""
} |
q18143 | TinyMCEConfig.removeButtons | train | public function removeButtons($buttons)
{
if (func_num_args() > 1) {
$buttons = func_get_args();
}
if (!is_array($buttons)) {
$buttons = [$buttons];
| php | {
"resource": ""
} |
q18144 | TinyMCEConfig.getEditorCSS | train | protected function getEditorCSS()
{
$editor = [];
$resourceLoader = ModuleResourceLoader::singleton();
foreach ($this->getContentCSS() as $contentCSS) {
| php | {
"resource": ""
} |
q18145 | TinyMCEConfig.getContentCSS | train | public function getContentCSS()
{
// Prioritise instance specific content
if (isset($this->contentCSS)) {
return $this->contentCSS;
}
// Add standard editor.css
$editor = [];
$editorCSSFiles = $this->config()->get('editor_css');
if ($editorCSSFile... | php | {
"resource": ""
} |
q18146 | TinyMCEConfig.get_tinymce_lang | train | public static function get_tinymce_lang()
{
$lang = static::config()->get('tinymce_lang');
$locale = i18n::get_locale();
| php | {
"resource": ""
} |
q18147 | TinyMCEConfig.getTinyMCEResource | train | public function getTinyMCEResource()
{
$configDir = static::config()->get('base_dir');
if ($configDir) {
return ModuleResourceLoader::singleton()->resolveResource($configDir);
| php | {
"resource": ""
} |
q18148 | HTTPApplication.handle | train | public function handle(HTTPRequest $request)
{
$flush = array_key_exists('flush', $request->getVars()) || ($request->getURL() === 'dev/build');
// Ensure boot is invoked
| php | {
"resource": ""
} |
q18149 | HTTPApplication.execute | train | public function execute(HTTPRequest $request, callable $callback, $flush = false)
{
try {
return $this->callMiddleware($request, function ($request) use ($callback, $flush) {
| php | {
"resource": ""
} |
q18150 | Session.destroy | train | public function destroy($removeCookie = true)
{
if (session_id()) {
if ($removeCookie) {
$path = $this->config()->get('cookie_path') ?: Director::baseURL();
$domain = $this->config()->get('cookie_domain');
| php | {
"resource": ""
} |
q18151 | Session.set | train | public function set($name, $val)
{
$var = &$this->nestedValueRef($name, $this->data);
// Mark changed
if ($var !== $val) {
$var = $val; | php | {
"resource": ""
} |
q18152 | Session.markChanged | train | protected function markChanged($name)
{
$diffVar = &$this->changedData;
foreach (explode('.', $name) as $namePart) {
if (!isset($diffVar[$namePart])) {
| php | {
"resource": ""
} |
q18153 | Session.addToArray | train | public function addToArray($name, $val)
{
$names = explode('.', $name);
// We still want to do this even if we have strict path checking for legacy code
$var = &$this->data;
$diffVar = &$this->changedData;
foreach ($names as $n) { | php | {
"resource": ""
} |
q18154 | Session.clear | train | public function clear($name)
{
// Get var by path
$var = $this->nestedValue($name, $this->data);
// Unset var
if ($var !== null) {
// Unset parent key
$parentParts = explode('.', $name);
| php | {
"resource": ""
} |
q18155 | Session.clearAll | train | public function clearAll()
{
if ($this->data && is_array($this->data)) {
foreach (array_keys($this->data) as $key) { | php | {
"resource": ""
} |
q18156 | Session.& | train | protected function &nestedValueRef($name, &$source)
{
// Find var to change
$var = &$source;
foreach (explode('.', $name) as $namePart) {
| php | {
"resource": ""
} |
q18157 | Session.nestedValue | train | protected function nestedValue($name, $source)
{
// Find var to change
$var = $source;
foreach (explode('.', $name) as | php | {
"resource": ""
} |
q18158 | Session.recursivelyApplyChanges | train | protected function recursivelyApplyChanges($changes, $source, &$destination)
{
$source = $source ?: [];
foreach ($changes as $key => $changed) {
if ($changed === true) {
// Determine if replacement or removal
if (array_key_exists($key, $source)) {
| php | {
"resource": ""
} |
q18159 | ErrorControlChain.lastErrorWasFatal | train | protected function lastErrorWasFatal()
{
if ($this->lastException) {
| php | {
"resource": ""
} |
q18160 | FieldList.recursiveWalk | train | public function recursiveWalk(callable $callback)
{
$stack = $this->toArray();
while (!empty($stack)) {
/** @var FormField $field */
$field = array_shift($stack);
$callback($field);
| php | {
"resource": ""
} |
q18161 | FieldList.flattenFields | train | public function flattenFields()
{
$fields = [];
$this->recursiveWalk(function (FormField $field) use (&$fields) {
$fields[] | php | {
"resource": ""
} |
q18162 | FieldList.fieldNameError | train | protected function fieldNameError(FormField $field, $functionName)
{
if ($this->form) {
$errorSuffix = sprintf(
" in your '%s' form called '%s'",
get_class($this->form),
$this->form->getName()
);
} else {
$errorSuffi... | php | {
"resource": ""
} |
q18163 | FieldList.removeFieldFromTab | train | public function removeFieldFromTab($tabName, $fieldName)
{
$this->flushFieldsCache();
// Find the tab
$tab = $this->findTab($tabName);
| php | {
"resource": ""
} |
q18164 | FieldList.removeByName | train | public function removeByName($fieldName, $dataFieldOnly = false)
{
if (!$fieldName) {
user_error('FieldList::removeByName() was called with a blank field name.', E_USER_WARNING);
}
// Handle array syntax
if (is_array($fieldName)) {
foreach ($fieldName as $fie... | php | {
"resource": ""
} |
q18165 | FieldList.replaceField | train | public function replaceField($fieldName, $newField, $dataFieldOnly = true)
{
$this->flushFieldsCache();
foreach ($this as $i => $field) {
if ($field->getName() == $fieldName && (!$dataFieldOnly || $field->hasData())) {
$this->items[$i] = $newField;
| php | {
"resource": ""
} |
q18166 | FieldList.renameField | train | public function renameField($fieldName, $newFieldTitle)
{
$field = $this->dataFieldByName($fieldName);
if (!$field) {
return false;
}
| php | {
"resource": ""
} |
q18167 | FieldList.findTab | train | public function findTab($tabName)
{
$parts = explode('.', $tabName);
$last_idx = count($parts) - 1;
$currentPointer = $this;
foreach ($parts as $k => $part) {
$parentPointer = $currentPointer;
/** @var FormField | php | {
"resource": ""
} |
q18168 | FieldList.findOrMakeTab | train | public function findOrMakeTab($tabName, $title = null)
{
$parts = explode('.', $tabName);
$last_idx = count($parts) - 1;
// We could have made this recursive, but I've chosen to keep all the logic code within FieldList rather than
// add it to TabSet and Tab too.
$currentPoin... | php | {
"resource": ""
} |
q18169 | FieldList.fieldByName | train | public function fieldByName($name)
{
if (strpos($name, '.') !== false) {
list($name, $remainder) = explode('.', $name, 2);
} else {
$remainder = null;
}
foreach ($this as $child) {
if (trim($name) == trim($child->getName()) || $name == $child->id)... | php | {
"resource": ""
} |
q18170 | FieldList.dataFieldByName | train | public function dataFieldByName($name)
{
if ($dataFields = $this->dataFields()) {
foreach ($dataFields as $child) {
| php | {
"resource": ""
} |
q18171 | FieldList.push | train | public function push($item)
{
$this->onBeforeInsert($item); | php | {
"resource": ""
} |
q18172 | FieldList.unshift | train | public function unshift($item)
{
$this->onBeforeInsert($item); | php | {
"resource": ""
} |
q18173 | FieldList.onBeforeInsert | train | protected function onBeforeInsert($item)
{
$this->flushFieldsCache();
if ($item->getName()) {
| php | {
"resource": ""
} |
q18174 | FieldList.setValues | train | public function setValues($data)
{
foreach ($this->dataFields() as $field) {
$fieldName = $field->getName();
| php | {
"resource": ""
} |
q18175 | FieldList.VisibleFields | train | public function VisibleFields()
{
$visibleFields = new FieldList();
foreach ($this as $field) {
| php | {
"resource": ""
} |
q18176 | FieldList.makeFieldReadonly | train | public function makeFieldReadonly($field)
{
if (!is_array($field)) {
$field = [$field];
}
foreach ($field as $item) {
$fieldName = ($item instanceof FormField) ? $item->getName() : $item;
$srcField = $this->dataFieldByName($fieldName);
if ($sr... | php | {
"resource": ""
} |
q18177 | DetailedErrorFormatter.findInTrace | train | protected function findInTrace(array $trace, $file, $line)
{
foreach ($trace as $i => $call) {
if (isset($call['file']) && isset($call['line']) && $call['file'] == $file && $call['line'] | php | {
"resource": ""
} |
q18178 | DetailedErrorFormatter.output | train | protected function output($errno, $errstr, $errfile, $errline, $errcontext)
{
$reporter = Debug::create_debug_view();
// Coupling alert: This relies on knowledge of how the director gets its URL, it could be improved.
$httpRequest = null;
if (isset($_SERVER['REQUEST_URI'])) {
... | php | {
"resource": ""
} |
q18179 | SessionAuthenticationHandler.regenerateSessionId | train | protected static function regenerateSessionId()
{
if (!Member::config()->get('session_regenerate_id')) {
return;
}
// This can be called via CLI during testing.
if (Director::is_cli()) {
return;
}
$file = '';
$line = '';
// @... | php | {
"resource": ""
} |
q18180 | CLI.supports_colour | train | public static function supports_colour()
{
// Special case for buildbot
if (isset($_ENV['_']) && strpos($_ENV['_'], 'buildbot') !== false) {
return false;
}
if (!defined('STDOUT')) { | php | {
"resource": ""
} |
q18181 | CLI.text | train | public static function text($text, $fgColour = null, $bgColour = null, $bold = false)
{
if (!self::supports_colour()) {
return $text;
}
if ($fgColour || $bgColour || $bold) {
$prefix = self::start_colour($fgColour, $bgColour, $bold);
| php | {
"resource": ""
} |
q18182 | CLI.start_colour | train | public static function start_colour($fgColour = null, $bgColour = null, $bold = false)
{
if (!self::supports_colour()) {
return "";
}
$colours = array(
'black' => 0,
'red' => 1,
'green' => 2,
'yellow' => 3,
'blue' => 4,
... | php | {
"resource": ""
} |
q18183 | YamlFixture.writeInto | train | public function writeInto(FixtureFactory $factory)
{
$parser = new Parser();
if (isset($this->fixtureString)) {
$fixtureContent = $parser->parse($this->fixtureString);
} else {
if (!file_exists($this->fixtureFile)) {
return;
}
... | php | {
"resource": ""
} |
q18184 | Environment.getVariables | train | public static function getVariables()
{
// Suppress return by-ref
$vars = [ 'env' => static::$env ];
// needs to use a for loop, using `array_merge([], $GLOBALS);` left reference traces somehow
| php | {
"resource": ""
} |
q18185 | Environment.getEnv | train | public static function getEnv($name)
{
switch (true) {
case is_array(static::$env) && array_key_exists($name, static::$env):
return static::$env[$name];
case is_array($_ENV) && array_key_exists($name, $_ENV):
return $_ENV[$name];
| php | {
"resource": ""
} |
q18186 | i18nTextCollector.collect | train | public function collect($restrictToModules = array(), $mergeWithExisting = false)
{
$entitiesByModule = $this->getEntitiesByModule();
// Resolve conflicts between duplicate keys across modules
$entitiesByModule = $this->resolveDuplicateConflicts($entitiesByModule);
// Optionally me... | php | {
"resource": ""
} |
q18187 | i18nTextCollector.resolveDuplicateConflicts | train | protected function resolveDuplicateConflicts($entitiesByModule)
{
// Find all keys that exist across multiple modules
$conflicts = $this->getConflicts($entitiesByModule);
foreach ($conflicts as $conflict) {
// Determine if we can narrow down the ownership
$bestModule ... | php | {
"resource": ""
} |
q18188 | i18nTextCollector.getConflicts | train | protected function getConflicts($entitiesByModule)
{
$modules = array_keys($entitiesByModule);
$allConflicts = array();
// bubble-compare each group of modules
for ($i = 0; $i < count($modules) - 1; $i++) {
$left = array_keys($entitiesByModule[$modules[$i]]);
... | php | {
"resource": ""
} |
q18189 | i18nTextCollector.getBestModuleForKey | train | protected function getBestModuleForKey($entitiesByModule, $key)
{
// Check classes
$class = current(explode('.', $key));
if (array_key_exists($class, $this->classModuleCache)) {
return $this->classModuleCache[$class];
}
$owner = $this->findModuleForClass($class);
... | php | {
"resource": ""
} |
q18190 | i18nTextCollector.findModuleForClass | train | protected function findModuleForClass($class)
{
if (ClassInfo::exists($class)) {
$module = ClassLoader::inst()
->getManifest()
->getOwnerModule($class);
if ($module) {
return $module->getName();
}
}
// If we... | php | {
"resource": ""
} |
q18191 | i18nTextCollector.mergeWithExisting | train | protected function mergeWithExisting($entitiesByModule)
{
// For each module do a simple merge of the default yml with these strings
foreach ($entitiesByModule as $module => $messages) {
// Load existing localisations
$masterFile = "{$this->basePath}/{$module}/lang/{$this->de... | php | {
"resource": ""
} |
q18192 | i18nTextCollector.getEntitiesByModule | train | protected function getEntitiesByModule()
{
// A master string tables array (one mst per module)
$entitiesByModule = array();
$modules = ModuleLoader::inst()->getManifest()->getModules();
foreach ($modules as $module) {
// we store the master string tables
$pro... | php | {
"resource": ""
} |
q18193 | i18nTextCollector.write | train | public function write(Module $module, $entities)
{
$this->getWriter()->write(
$entities,
$this->defaultLocale,
| php | {
"resource": ""
} |
q18194 | i18nTextCollector.getFileListForModule | train | protected function getFileListForModule(Module $module)
{
$modulePath = $module->getPath();
// Search all .ss files in themes
if (stripos($module->getRelativePath(), 'themes/') === 0) {
return $this->getFilesRecursive($modulePath, null, 'ss');
}
// If non-standa... | php | {
"resource": ""
} |
q18195 | i18nTextCollector.collectFromEntityProviders | train | public function collectFromEntityProviders($filePath, Module $module = null)
{
$entities = array();
$classes = ClassInfo::classes_for_file($filePath);
foreach ($classes as $class) {
// Skip non-implementing classes
if (!class_exists($class) || !is_a($class, i18nEntity... | php | {
"resource": ""
} |
q18196 | i18nTextCollector.normalizeEntity | train | protected function normalizeEntity($fullName, $_namespace = null)
{
// split fullname into entity parts
$entityParts = explode('.', $fullName);
if (count($entityParts) > 1) {
// templates don't have a custom namespace
$entity = array_pop($entityParts);
// ... | php | {
"resource": ""
} |
q18197 | ClassInfo.getValidSubClasses | train | public static function getValidSubClasses($class = SiteTree::class, $includeUnbacked = false)
{
if (is_string($class) && !class_exists($class)) {
return array();
}
$class = self::class_name($class);
if ($includeUnbacked) {
$table = DataObject::getSchema()->ta... | php | {
"resource": ""
} |
q18198 | ClassInfo.dataClassesFor | train | public static function dataClassesFor($nameOrObject)
{
if (is_string($nameOrObject) && !class_exists($nameOrObject)) {
return [];
}
// Get all classes
$class = self::class_name($nameOrObject);
$classes = array_merge(
self::ancestry($class),
... | php | {
"resource": ""
} |
q18199 | ClassInfo.class_name | train | public static function class_name($nameOrObject)
{
if (is_object($nameOrObject)) {
return get_class($nameOrObject);
}
$key = strtolower($nameOrObject);
if (!isset(static::$_cache_class_names[$key])) {
// Get manifest name
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.