_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q21700
AbstractAdmin.getAccess
train
protected function getAccess() { $access = array_merge([ 'acl' => 'MASTER', 'export' => 'EXPORT', 'historyCompareRevisions' => 'EDIT', 'historyViewRevision' => 'EDIT', 'history' => 'EDIT', 'edit' => 'EDIT', 'show' => 'VIEW',...
php
{ "resource": "" }
q21701
AbstractAdmin.buildRoutes
train
private function buildRoutes(): void { if ($this->loaded['routes']) { return; } $this->loaded['routes'] = true; $this->routes = new RouteCollection( $this->getBaseCodeRoute(), $this->getBaseRouteName(), $this->getBaseRoutePattern(), ...
php
{ "resource": "" }
q21702
RouteCollection.actionify
train
public function actionify($action) { if (false !== ($pos = strrpos($action, '.'))) { $action = substr($action, $pos + 1); } // if this is a service rather than just a
php
{ "resource": "" }
q21703
GroupMenuProvider.get
train
public function get($name, array $options = []) { $group = $options['group']; $menuItem = $this->menuFactory->createItem($options['name']); if (empty($group['on_top']) || false === $group['on_top']) { foreach ($group['items'] as $item) { if ($this->canGenerateMe...
php
{ "resource": "" }
q21704
CRUDController.renderWithExtraParams
train
public function renderWithExtraParams($view, array $parameters = [], Response $response = null) { if (!$this->isXmlHttpRequest()) { $parameters['breadcrumbs_builder'] = $this->get('sonata.admin.breadcrumbs_builder'); } $parameters['admin'] = $parameters['admin'] ?? $t...
php
{ "resource": "" }
q21705
CRUDController.batchActionDelete
train
public function batchActionDelete(ProxyQueryInterface $query) { $this->admin->checkAccess('batchDelete'); $modelManager = $this->admin->getModelManager(); try { $modelManager->batchDelete($this->admin->getClass(), $query); $this->addFlash(
php
{ "resource": "" }
q21706
CRUDController.showAction
train
public function showAction($id = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to find the object with id: %s', $i...
php
{ "resource": "" }
q21707
CRUDController.historyAction
train
public function historyAction($id = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to find the object with id: %s',...
php
{ "resource": "" }
q21708
CRUDController.historyViewRevisionAction
train
public function historyViewRevisionAction($id = null, $revision = null) { $request = $this->getRequest(); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject($id); if (!$object) { throw $this->createNotFoundException(sprintf('unable to...
php
{ "resource": "" }
q21709
CRUDController.historyCompareRevisionsAction
train
public function historyCompareRevisionsAction($id = null, $base_revision = null, $compare_revision = null) { $request = $this->getRequest(); $this->admin->checkAccess('historyCompareRevisions'); $id = $request->get($this->admin->getIdParameter()); $object = $this->admin->getObject...
php
{ "resource": "" }
q21710
CRUDController.exportAction
train
public function exportAction(Request $request) { $this->admin->checkAccess('export'); $format = $request->get('format'); // NEXT_MAJOR: remove the check if (!$this->has('sonata.admin.admin_exporter')) { @trigger_error( 'Not registering the exporter bundl...
php
{ "resource": "" }
q21711
CRUDController.aclAction
train
public function aclAction($id = null) { $request = $this->getRequest(); if (!$this->admin->isAclEnabled()) { throw $this->createNotFoundException('ACL are not enabled for this admin'); } $id = $request->get($this->admin->getIdParameter()); $object = $this->admi...
php
{ "resource": "" }
q21712
CRUDController.getRestMethod
train
protected function getRestMethod() { $request = $this->getRequest(); if (Request::getHttpMethodParameterOverride() ||
php
{ "resource": "" }
q21713
CRUDController.configure
train
protected function configure() { $request = $this->getRequest(); $adminCode = $request->get('_sonata_admin'); if (!$adminCode) { throw new \RuntimeException(sprintf( 'There is no `_sonata_admin` defined for the controller `%s` and the current route `%s`', ...
php
{ "resource": "" }
q21714
CRUDController.getLogger
train
protected function getLogger() { if ($this->container->has('logger')) { $logger = $this->container->get('logger');
php
{ "resource": "" }
q21715
CRUDController.redirectToList
train
final protected function redirectToList() { $parameters = []; if ($filter = $this->admin->getFilterParameters()) { $parameters['filter'] = $filter;
php
{ "resource": "" }
q21716
CRUDController.isInPreviewMode
train
protected function isInPreviewMode() { return $this->admin->supportsPreviewMode() && ($this->isPreviewRequested()
php
{ "resource": "" }
q21717
CRUDController.getAclUsers
train
protected function getAclUsers() { $aclUsers = []; $userManagerServiceName = $this->container->getParameter('sonata.admin.security.acl_user_manager'); if (null !== $userManagerServiceName && $this->has($userManagerServiceName)) {
php
{ "resource": "" }
q21718
CRUDController.getAclRoles
train
protected function getAclRoles() { $aclRoles = []; $roleHierarchy = $this->container->getParameter('security.role_hierarchy.roles'); $pool = $this->container->get('sonata.admin.pool'); foreach ($pool->getAdminServiceIds() as $id) { try { $admin = $pool->g...
php
{ "resource": "" }
q21719
CRUDController.validateCsrfToken
train
protected function validateCsrfToken($intention) { $request = $this->getRequest(); $token = $request->request->get('_sonata_csrf_token', false); if ($this->container->has('security.csrf.token_manager')) { $valid = $this->container->get('security.csrf.token_manager')->isTokenVali...
php
{ "resource": "" }
q21720
ModelChoiceList.getEntity
train
public function getEntity($key) { if (\count($this->identifier) > 1) { // $key is a collection index $entities = $this->getEntities(); return $entities[$key] ?? null; } elseif ($this->entities) {
php
{ "resource": "" }
q21721
ModelChoiceList.getIdentifierValues
train
public function getIdentifierValues($entity) { try { return $this->modelManager->getIdentifierValues($entity); } catch (\Exception $e) {
php
{ "resource": "" }
q21722
ModelChoiceList.load
train
protected function load($choices) { if (\is_array($choices) && \count($choices) > 0) { $entities = $choices; } elseif ($this->query) { $entities = $this->modelManager->executeQuery($this->query); } else { $entities = $this->modelManager->findBy($this->clas...
php
{ "resource": "" }
q21723
ModelChoiceList.getReflProperty
train
private function getReflProperty(string $property): ReflectionProperty { if (!isset($this->reflProperties[$property])) { $this->reflProperties[$property]
php
{ "resource": "" }
q21724
SonataAdminExtension.renderListElement
train
public function renderListElement( Environment $environment, $object, FieldDescriptionInterface $fieldDescription, $params = [] ) { $template = $this->getTemplate( $fieldDescription, // NEXT_MAJOR: Remove this line and use commented line below instead ...
php
{ "resource": "" }
q21725
SonataAdminExtension.renderViewElement
train
public function renderViewElement( Environment $environment, FieldDescriptionInterface $fieldDescription, $object ) { $template = $this->getTemplate( $fieldDescription, '@SonataAdmin/CRUD/base_show_field.html.twig', $environment ); ...
php
{ "resource": "" }
q21726
SonataAdminExtension.renderViewElementCompare
train
public function renderViewElementCompare( Environment $environment, FieldDescriptionInterface $fieldDescription, $baseObject, $compareObject ) { $template = $this->getTemplate( $fieldDescription, '@SonataAdmin/CRUD/base_show_field.html.twig', ...
php
{ "resource": "" }
q21727
SonataAdminExtension.getUrlsafeIdentifier
train
public function getUrlsafeIdentifier($model, AdminInterface $admin = null) { if (null === $admin) {
php
{ "resource": "" }
q21728
SonataAdminExtension.getCanonicalizedLocaleForMoment
train
final public function getCanonicalizedLocaleForMoment(array $context) { $locale = strtolower(str_replace('_', '-', $context['app']->getRequest()->getLocale())); // "en" language doesn't require localization. if (('en' === $lang = substr($locale, 0, 2)) && !\in_array($locale, ['en-au', 'en-c...
php
{ "resource": "" }
q21729
SonataAdminExtension.getCanonicalizedLocaleForSelect2
train
final public function getCanonicalizedLocaleForSelect2(array $context) { $locale = str_replace('_', '-', $context['app']->getRequest()->getLocale()); // "en" language doesn't require localization. if ('en' === $lang = substr($locale, 0, 2)) { return null; } swit...
php
{ "resource": "" }
q21730
reporter.add
train
public function add($line, $nlBefore = 0, $nlAfter = 0) { $output = str_repeat("\n", $nlBefore).$line.str_repeat("\n", $nlAfter); if (fwrite($this->file, $output) === false) {
php
{ "resource": "" }
q21731
reporter.addToSection
train
public function addToSection($section, $test, $filePath, $lineNumber, $codeLine) { if (empty($section)) {
php
{ "resource": "" }
q21732
reporter.addSections
train
public function addSections() { foreach ($this->sectionBuffers as $section => $filePaths) { $this->add('# '.$section, 1, 1); foreach ($filePaths as $filePath => $tests) { $this->add('#### '.$filePath, 0,
php
{ "resource": "" }
q21733
scanner.recursiveScan
train
private function recursiveScan($startFolder) { if (is_file($startFolder)) { $this->files[] = $startFolder; return; } $contents = scandir($startFolder); foreach ($contents as $content) { if (strpos($content, '.') === 0) { continue; } $path = $startFolder.DIRECTORY_SEPARATOR.$content; if (i...
php
{ "resource": "" }
q21734
scanner.scanNextFile
train
public function scanNextFile() { $_file = each($this->files); if ($_file === false) { return false; } $file = $_file['value']; $lines
php
{ "resource": "" }
q21735
options.printOptionsAndExit
train
private function printOptionsAndExit() { echo "Available Options:\n"; foreach ($this->validShortOptions as $option => $info) { echo "-\033[1m{$option}\033[0m\n {$info['comment']}\n {$info['description']}\n
php
{ "resource": "" }
q21736
options.parseOption
train
private function parseOption($rawOption) { $regex = "#^(?P<option>-[a-zA-Z]{1}|--[a-zA-Z-]{2,})(?:=(?P<value>['|\"]?.+?['|\"]?))?$#"; if (preg_match($regex, trim($rawOption), $matches)) { if (isset($matches['option'])) { $option = ltrim($matches['option'], '-'); if (isset($matches['value'])) { $valu...
php
{ "resource": "" }
q21737
options.enforceOptions
train
private function enforceOptions() { foreach ($this->validShortOptions as $option => $info) { if ($info['option'] === self::OPTION_REQUIRED && !isset($this->options[$option])) { die("The option `{$option}` is required to be given.\n {$info['comment']}\n {$info['description']}\n Example: {$info['example']}\n"); ...
php
{ "resource": "" }
q21738
main.run
train
private function run() { $issues = []; $totalFiles = 0; $totalLines = 0; $filePath = $this->scanner->getCurrentFilePath(); if (!$this->options->getOption('t') || in_array('syntax', $this->options->getOption('t'), true)) { $checkSyntax = true; $versionGood = $this->tests->getPHPVersion(); if (!$versio...
php
{ "resource": "" }
q21739
main.getRealPath
train
static public function getRealPath($path) { if (strpos($path, '~') === 0) { $path = substr_replace($path, $_SERVER['HOME'], 0,
php
{ "resource": "" }
q21740
Uninstall.getExtensionEntity
train
protected function getExtensionEntity() { if (!isset($this->extensionEntity)) { $processId = $this->getProcessId(); $this->extensionEntity = $this->getEntityManager()->getEntity('Extension', $processId); if (!isset($this->extensionEntity)) {
php
{ "resource": "" }
q21741
Utils.normalizeOptions
train
public function normalizeOptions(array $options) { $options['useSsl'] = (bool) ($options['useSsl'] == 'SSL'); $options['useStartTls'] = (bool) ($options['useStartTls'] == 'TLS');
php
{ "resource": "" }
q21742
Utils.getOption
train
public function getOption($name, $returns = null) { if (!isset($this->options)) { $this->getOptions(); }
php
{ "resource": "" }
q21743
Utils.getLdapClientOptions
train
public function getLdapClientOptions() { $options = $this->getOptions(); $zendOptions
php
{ "resource": "" }
q21744
AdminNotifications.jobCheckNewVersion
train
public function jobCheckNewVersion($data) { $config = $this->getConfig(); if (!$config->get('adminNotifications') || !$config->get('adminNotificationsNewVersion')) { return true; } $latestRelease = $this->getLatestRelease(); if (empty($latestRelease['version']))...
php
{ "resource": "" }
q21745
AdminNotifications.jobCheckNewExtensionVersion
train
public function jobCheckNewExtensionVersion($data) { $config = $this->getConfig(); if (!$config->get('adminNotifications') || !$config->get('adminNotificationsNewExtensionVersion')) { return true; } $pdo = $this->getEntityManager()->getPDO(); $query = " ...
php
{ "resource": "" }
q21746
Language.getData
train
protected function getData() { $currentLanguage = $this->getLanguage();
php
{ "resource": "" }
q21747
Language.delete
train
public function delete($scope, $category, $name) { if (is_array($name)) { foreach ($name as $rowLabel) { $this->delete($scope, $category, $rowLabel); } return; } $this->deletedData[$scope][$category][] = $name; $currentLanguage = ...
php
{ "resource": "" }
q21748
RelationManager.getForeignLink
train
private function getForeignLink($parentLinkName, $parentLinkParams, $currentEntityDefs) { if (isset($parentLinkParams['foreign']) && isset($currentEntityDefs['links'][$parentLinkParams['foreign']])) { return array( 'name' => $parentLinkParams['foreign'],
php
{ "resource": "" }
q21749
ScheduledJob.getClassName
train
protected function getClassName($name) { $name = Util::normilizeClassName($name); $data = $this->getAll(); $name = ucfirst($name);
php
{ "resource": "" }
q21750
ScheduledJob.isCronConfigured
train
public function isCronConfigured() { $r1From = new \DateTime('-' . $this->checkingCronPeriod); $r1To = new \DateTime('+' . $this->checkingCronPeriod); $r2From = new \DateTime('- 1 hour'); $r2To = new \DateTime(); $format = \Espo\Core\Utils\DateTime::$systemDateTimeFormat; ...
php
{ "resource": "" }
q21751
LDAP.loginByToken
train
protected function loginByToken($username, \Espo\Entities\AuthToken $authToken = null) { if (!isset($authToken)) { return null; } $userId = $authToken->get('userId'); $user = $this->getEntityManager()->getEntity('User', $userId); $tokenUsername = $user->get('use...
php
{ "resource": "" }
q21752
LDAP.adminLogin
train
protected function adminLogin($username, $password) { $hash = $this->getPasswordHash()->hash($password); $user = $this->getEntityManager()->getRepository('User')->findOne([ 'whereClause' => [ 'userName' => $username,
php
{ "resource": "" }
q21753
LDAP.createUser
train
protected function createUser(array $userData, $isPortal = false) { $GLOBALS['log']->info('Creating new user ...'); $data = array(); // show full array of the LDAP user $GLOBALS['log']->debug('LDAP: user data: ' .print_r($userData, true)); //set values from ldap server ...
php
{ "resource": "" }
q21754
LDAP.findLdapUserDnByUsername
train
protected function findLdapUserDnByUsername($username) { $ldapClient = $this->getLdapClient(); $options = $this->getUtils()->getOptions(); $loginFilterString = ''; if (!empty($options['userLoginFilter'])) { $loginFilterString = $this->convertToFilterFormat($options['user...
php
{ "resource": "" }
q21755
LDAP.convertToFilterFormat
train
protected function convertToFilterFormat($filter) { $filter = trim($filter); if (substr($filter, 0, 1) != '(') { $filter = '(' . $filter; }
php
{ "resource": "" }
q21756
LDAP.loadFields
train
protected function loadFields($type) { $options = $this->getUtils()->getOptions(); $typeMap = $type . 'FieldMap'; $fields = array(); foreach ($this->$typeMap as $fieldName => $fieldValue) {
php
{ "resource": "" }
q21757
FileUnifier.unify
train
public function unify(array $paths, $isReturnModuleNames = false) { $data = $this->loadData($paths['corePath']); if (!empty($paths['modulePath'])) { $moduleDir = strstr($paths['modulePath'], '{*}', true); $moduleList = isset($this->metadata) ? $this->getMetadata()->getModule...
php
{ "resource": "" }
q21758
FileUnifier.loadData
train
protected function loadData($filePath, $returns = array()) { if (file_exists($filePath)) { $content = $this->getFileManager()->getContents($filePath); $data = Json::getArrayData($content); if (empty($data)) { $GLOBALS['log']->warning('FileUnifier::unify() ...
php
{ "resource": "" }
q21759
ScheduledJob.addLogRecord
train
public function addLogRecord($scheduledJobId, $status, $runTime = null, $targetId = null, $targetType = null) { if (!isset($runTime)) { $runTime = date('Y-m-d H:i:s'); } $entityManager = $this->getEntityManager(); $scheduledJob = $entityManager->getEntity('ScheduledJob'...
php
{ "resource": "" }
q21760
Helper.getFieldDefsByType
train
public function getFieldDefsByType($fieldDef) { if (is_string($fieldDef)) { $fieldDef = array('type' => $fieldDef); } if (isset($fieldDef['type'])) { return
php
{ "resource": "" }
q21761
Helper.getAdditionalFieldList
train
public function getAdditionalFieldList($fieldName, array $fieldParams, array $definitionList) { if (empty($fieldParams['type']) || empty($definitionList)) { return; } $fieldType = $fieldParams['type']; $fieldDefinition = isset($definitionList[$fieldType]) ? $definitionLi...
php
{ "resource": "" }
q21762
SystemRequirements.getPhpRequiredList
train
protected function getPhpRequiredList($requiredOnly, array $additionalData = null) { $requiredList = [ 'requiredPhpVersion', 'requiredPhpLibs', ]; if (!$requiredOnly) { $requiredList = array_merge($requiredList, [
php
{ "resource": "" }
q21763
SystemRequirements.getDatabaseRequiredList
train
protected function getDatabaseRequiredList($requiredOnly, array $additionalData = null) { $databaseTypeName = 'Mysql'; $databaseHelper = $this->getDatabaseHelper(); $databaseParams = isset($additionalData['database']) ? $additionalData['database'] : null; $dbalConnection = $databas...
php
{ "resource": "" }
q21764
SystemRequirements.checkPhpRequirements
train
protected function checkPhpRequirements($type, $data, array $additionalData = null) { $list = []; switch ($type) { case 'requiredPhpVersion': $actualVersion = $this->getSystemHelper()->getPhpVersion(); $requiredVersion = $data; $acceptabl...
php
{ "resource": "" }
q21765
SystemRequirements.checkDatabaseRequirements
train
protected function checkDatabaseRequirements($type, $data, array $additionalData = null) { $list = []; $databaseHelper = $this->getDatabaseHelper(); $databaseParams = isset($additionalData['database']) ? $additionalData['database'] : null; $pdo = $databaseHelper->createPdoConnectio...
php
{ "resource": "" }
q21766
Base.process
train
public function process($itemName, $entityName) { $inputs = array( 'itemName' => $itemName, 'entityName' => $entityName, ); $this->setMethods($inputs); $convertedDefs = $this->load($itemName, $entityName);
php
{ "resource": "" }
q21767
Install.backupExistingFiles
train
protected function backupExistingFiles() { parent::backupExistingFiles(); $backupPath = $this->getPath('backupPath');
php
{ "resource": "" }
q21768
Install.findExtension
train
protected function findExtension() { $manifest = $this->getManifest(); $this->extensionEntity = $this->getEntityManager()->getRepository('Extension')->where(array( 'name' => $manifest['name'],
php
{ "resource": "" }
q21769
Install.storeExtension
train
protected function storeExtension() { $entityManager = $this->getEntityManager(); $extensionEntity = $entityManager->getEntity('Extension', $this->getProcessId()); if (!isset($extensionEntity)) { $extensionEntity = $entityManager->getEntity('Extension'); } $mani...
php
{ "resource": "" }
q21770
Install.compareVersion
train
protected function compareVersion() { $manifest = $this->getManifest(); $extensionEntity = $this->getExtensionEntity(); if (isset($extensionEntity)) { $comparedVersion = version_compare($manifest['version'], $extensionEntity->get('version'), '>=');
php
{ "resource": "" }
q21771
Install.uninstallExtension
train
protected function uninstallExtension() { $extensionEntity = $this->getExtensionEntity(); $this->executeAction(ExtensionManager::UNINSTALL, array( 'id' => $extensionEntity->get('id'),
php
{ "resource": "" }
q21772
Install.deleteExtension
train
protected function deleteExtension() { $extensionEntity = $this->getExtensionEntity();
php
{ "resource": "" }
q21773
Base.runScript
train
protected function runScript($type) { $packagePath = $this->getPackagePath(); $scriptNames = $this->getParams('scriptNames'); $scriptName = $scriptNames[$type]; if (!isset($scriptName)) { return; } $beforeInstallScript = Util::concatPath( array($packageP...
php
{ "resource": "" }
q21774
Base.getPath
train
protected function getPath($name = 'packagePath', $isPackage = false) { $postfix = $isPackage ? $this->packagePostfix : ''; $processId = $this->getProcessId();
php
{ "resource": "" }
q21775
Base.getDeleteFileList
train
protected function getDeleteFileList() { if (!isset($this->data['deleteFileList'])) { $deleteFileList = array(); $deleteList = array_merge($this->getDeleteList('delete'), $this->getDeleteList('deleteBeforeCopy'), $this->getDeleteList('vendor')); foreach ($deleteList as $...
php
{ "resource": "" }
q21776
Base.deleteFiles
train
protected function deleteFiles($type = 'delete', $withEmptyDirs = false) { $deleteList = $this->getDeleteList($type); if (!empty($deleteList)) {
php
{ "resource": "" }
q21777
Base.checkManifest
train
protected function checkManifest(array $manifest) { $requiredFields = array( 'name', 'version', ); foreach ($requiredFields as $fieldName) { if
php
{ "resource": "" }
q21778
Base.unzipArchive
train
protected function unzipArchive($packagePath = null) { $packagePath = isset($packagePath) ? $packagePath : $this->getPackagePath(); $packageArchivePath = $this->getPackagePath(true); if (!file_exists($packageArchivePath)) { throw new Error('Package Archive doesn\'t exist.'); ...
php
{ "resource": "" }
q21779
Base.deletePackageFiles
train
protected function deletePackageFiles() { $packagePath = $this->getPackagePath(); $res
php
{ "resource": "" }
q21780
Base.deletePackageArchive
train
protected function deletePackageArchive() { $packageArchive = $this->getPackagePath(true); $res
php
{ "resource": "" }
q21781
Base.executeAction
train
protected function executeAction($actionName, $data) { $actionManager = $this->getActionManager(); $currentAction = $actionManager->getAction();
php
{ "resource": "" }
q21782
StreamHandler.pruneMessage
train
protected function pruneMessage(array $record) { $message = (string) $record['message']; if (strlen($message) > $this->maxErrorMessageLength) {
php
{ "resource": "" }
q21783
PasswordHash.hash
train
public function hash($password, $useMd5 = true) { $salt = $this->getSalt(); if ($useMd5) { $password = md5($password); } $hash = crypt($password,
php
{ "resource": "" }
q21784
PasswordHash.getSalt
train
protected function getSalt() { $salt = $this->getConfig()->get('passwordSalt'); if (!isset($salt)) { throw new Error('Option "passwordSalt" does
php
{ "resource": "" }
q21785
Logger.getLevelCode
train
public function getLevelCode($levelName) { $levelName = strtoupper($levelName); $levels = $this->getLevels(); if (isset($levels[$levelName])) {
php
{ "resource": "" }
q21786
Language.mergeWithDefaults
train
protected function mergeWithDefaults($data) { $defaultLangFile = 'install/core/i18n/'.$this->defaultLanguage.'/install.json'; $defaultData = $this->getLangData($defaultLangFile); foreach ($data as $categoryName => &$labels) { foreach ($defaultData[$categoryName] as $defaultLabel...
php
{ "resource": "" }
q21787
Language.afterRetrieve
train
protected function afterRetrieve(array &$i18n) { /** Get rewrite rules */ $serverType = $this->getSystemHelper()->getServerType(); $serverOs = $this->getSystemHelper()->getOs(); $rewriteRules = $this->getSystemHelper()->getRewriteRules(); if (isset($i18n['options']['modRewri...
php
{ "resource": "" }
q21788
Currency.exchangeRates
train
protected function exchangeRates($baseCurrency, $defaultCurrency, array $currencyRates) { $precision = 5; $defaultCurrencyRate = round(1 / $currencyRates[$defaultCurrency], $precision); $exchangedRates = array();
php
{ "resource": "" }
q21789
Json.encode
train
public static function encode($value, $options = 0) { $json = json_encode($value, $options); $error = self::getLastError(); if ($json === null || !empty($error)) {
php
{ "resource": "" }
q21790
Json.isJSON
train
public static function isJSON($json) { if ($json === '[]' || $json === '{}') {
php
{ "resource": "" }
q21791
System.getServerType
train
public function getServerType() { $serverSoft = $_SERVER['SERVER_SOFTWARE']; preg_match('/^(.*?)\//i', $serverSoft, $match); if (empty($match[1])) {
php
{ "resource": "" }
q21792
HookManager.sortHooks
train
protected function sortHooks(array $hooks) { foreach ($hooks as $scopeName => &$scopeHooks) { foreach ($scopeHooks as $hookName => &$hookList) {
php
{ "resource": "" }
q21793
HookManager.getHookList
train
protected function getHookList($scope, $hookName) { $key = $scope . '_' . $hookName; if (!isset($this->hookListHash[$key])) { $hookList = array(); if (isset($this->data['Common'][$hookName])) { $hookList = $this->data['Common'][$hookName]; } ...
php
{ "resource": "" }
q21794
HookManager.hookExists
train
protected function hookExists($className, array $hookData) { $class = preg_replace('/^.*\\\(.*)$/', '$1', $className); foreach ($hookData as $hookData) {
php
{ "resource": "" }
q21795
Converter.process
train
public function process() { $entityDefs = $this->getEntityDefs(true); $ormMetadata = array(); foreach($entityDefs as $entityName => $entityMetadata) { if (empty($entityMetadata)) { $GLOBALS['log']->critical('Orm\Converter:process(), Entity:'.$entityName.' - meta...
php
{ "resource": "" }
q21796
Converter.convertFields
train
protected function convertFields($entityName, &$entityMetadata) { //List of unmerged fields with default field defenitions in $outputMeta $unmergedFields = array( 'name', ); $outputMeta = array( 'id' => array( 'type' => Entity::ID, ...
php
{ "resource": "" }
q21797
Converter.correctFields
train
protected function correctFields($entityName, array $ormMetadata) { $entityDefs = $this->getEntityDefs(); $entityMetadata = $ormMetadata[$entityName]; //load custom field definitions and customCodes foreach ($entityMetadata['fields'] as $fieldName => $fieldParams) { if (...
php
{ "resource": "" }
q21798
Unifier.unify
train
public function unify($name, $paths, $recursively = false) { $content = $this->unifySingle($paths['corePath'], $name, $recursively); if (!empty($paths['modulePath'])) { $customDir = strstr($paths['modulePath'], '{*}', true); $moduleList = isset($this->metadata) ? $this->get...
php
{ "resource": "" }
q21799
Unifier.unifyGetContents
train
protected function unifyGetContents($paths, $defaults) { $fileContent = $this->getFileManager()->getContents($paths); if ($this->useObjects) { $decoded = Utils\Json::decode($fileContent); } else { $decoded = Utils\Json::getArrayData($fileContent, null); } ...
php
{ "resource": "" }