コード例 #1
0
 /**
  * Gets the configured error level.
  *
  * @return string
  */
 protected function getErrorLevel()
 {
     if (!isset($this->errorLevel)) {
         $this->errorLevel = $this->configFactory->get('system.logging')->get('error_level');
     }
     return $this->errorLevel;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function resolveCurrencyLocale($language_type = LanguageInterface::TYPE_CONTENT)
 {
     if (empty($this->currencyLocales[$language_type])) {
         $currency_locale = NULL;
         $language_code = $this->languageManager->getCurrentLanguage($language_type)->getId();
         // Try this request's country code.
         $country_code = $this->eventDispatcher->resolveCountryCode();
         if ($country_code) {
             $currency_locale = $this->currencyLocaleStorage->load($language_code . '_' . $country_code);
         }
         // Try the site's default country code.
         if (!$currency_locale) {
             $country_code = $this->configFactory->get('system.data')->get('country.default');
             if ($country_code) {
                 $currency_locale = $this->currencyLocaleStorage->load($language_code . '_' . $country_code);
             }
         }
         // Try the Currency default.
         if (!$currency_locale) {
             $currency_locale = $this->currencyLocaleStorage->load($this::DEFAULT_LOCALE);
         }
         if ($currency_locale) {
             $this->currencyLocales[$language_type] = $currency_locale;
         } else {
             throw new \RuntimeException(sprintf('The currency locale for %s could not be loaded.', $this::DEFAULT_LOCALE));
         }
     }
     return $this->currencyLocales[$language_type];
 }
コード例 #3
0
ファイル: UploadHandler.php プロジェクト: DrupalTV/DrupalTV
 /**
  * Constructs dropzone upload controller route controller.
  *
  * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
  *   The request stack.
  * @param \Drupal\Core\Config\ConfigFactoryInterface $config
  *   Config factory.
  * @param \Drupal\Core\Transliteration\PhpTransliteration $transliteration
  *   Transliteration service.
  */
 public function __construct(RequestStack $request_stack, ConfigFactoryInterface $config, TransliterationInterface $transliteration)
 {
     $this->request = $request_stack->getCurrentRequest();
     $tmp_override = $config->get('dropzonejs.settings')->get('tmp_dir');
     $this->temporaryUploadLocation = $tmp_override ?: $config->get('system.file')->get('path.temporary');
     $this->transliteration = $transliteration;
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function collect(Request $request, Response $response, \Exception $exception = NULL)
 {
     $connections = [];
     foreach (Database::getAllConnectionInfo() as $key => $info) {
         $database = Database::getConnection('default', $key);
         $connections[$key] = $database->getLogger()->get('webprofiler');
     }
     $this->data['connections'] = array_keys($connections);
     $data = [];
     foreach ($connections as $key => $queries) {
         foreach ($queries as $query) {
             // Remove caller args.
             unset($query['caller']['args']);
             // Remove query args element if empty.
             if (empty($query['args'])) {
                 unset($query['args']);
             }
             // Save time in milliseconds.
             $query['time'] = $query['time'] * 1000;
             $query['database'] = $key;
             $data[] = $query;
         }
     }
     $querySort = $this->configFactory->get('webprofiler.config')->get('query_sort');
     if ('duration' === $querySort) {
         usort($data, ["Drupal\\webprofiler\\DataCollector\\DatabaseDataCollector", "orderQueryByTime"]);
     }
     $this->data['queries'] = $data;
     $options = $this->database->getConnectionOptions();
     // Remove password for security.
     unset($options['password']);
     $this->data['database'] = $options;
 }
コード例 #5
0
ファイル: AliasCleaner.php プロジェクト: aakb/cfia
 /**
  * {@inheritdoc}
  */
 public function getCleanSeparators($string, $separator = NULL)
 {
     $config = $this->configFactory->get('pathauto.settings');
     if (!isset($separator)) {
         $separator = $config->get('separator');
     }
     $output = $string;
     if (strlen($separator)) {
         // Trim any leading or trailing separators.
         $output = trim($output, $separator);
         // Escape the separator for use in regular expressions.
         $seppattern = preg_quote($separator, '/');
         // Replace multiple separators with a single one.
         $output = preg_replace("/{$seppattern}+/", $separator, $output);
         // Replace trailing separators around slashes.
         if ($separator !== '/') {
             $output = preg_replace("/\\/+{$seppattern}\\/+|{$seppattern}\\/+|\\/+{$seppattern}/", "/", $output);
         } else {
             // If the separator is a slash, we need to re-add the leading slash
             // dropped by the trim function.
             $output = '/' . $output;
         }
     }
     return $output;
 }
コード例 #6
0
 /**
  * Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processInbound().
  */
 public function processInbound($path, Request $request)
 {
     if (empty($path)) {
         $path = $this->config->get('system.site')->get('page.front');
     }
     return $path;
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
 {
     $config = $this->configFactory->get('shield.settings');
     $allow_cli = $config->get('allow_cli');
     $user = $config->get('user');
     $pass = $config->get('pass');
     if (empty($user) || PHP_SAPI === 'cli' && $allow_cli) {
         // If username is empty, then authentication is disabled,
         // or if request is coming from a cli and it is allowed,
         // then proceed with response without shield authentication.
         return $this->httpKernel->handle($request, $type, $catch);
     } else {
         if ($request->server->has('PHP_AUTH_USER') && $request->server->has('PHP_AUTH_PW')) {
             $input_user = $request->server->get('PHP_AUTH_USER');
             $input_pass = $request->server->get('PHP_AUTH_PW');
         } elseif ($request->server->has('HTTP_AUTHORIZATION')) {
             list($input_user, $input_pass) = explode(':', base64_decode(substr($request->server->get('HTTP_AUTHORIZATION'), 6)), 2);
         } elseif ($request->server->has('REDIRECT_HTTP_AUTHORIZATION')) {
             list($input_user, $input_pass) = explode(':', base64_decode(substr($request->server->get('REDIRECT_HTTP_AUTHORIZATION'), 6)), 2);
         }
         if (isset($input_user) && $input_user === $user && Crypt::hashEquals($pass, $input_pass)) {
             return $this->httpKernel->handle($request, $type, $catch);
         }
     }
     $response = new Response();
     $response->headers->add(['WWW-Authenticate' => 'Basic realm="' . strtr($config->get('print'), ['[user]' => $user, '[pass]' => $pass]) . '"']);
     $response->setStatusCode(401);
     return $response;
 }
コード例 #8
0
ファイル: ConfigSubscriber.php プロジェクト: dmyerson/d8ecs
 /**
  * Causes the container to be rebuilt on the next request.
  *
  * This event subscriber assumes that the new default langcode and old default
  * langcode are valid langcodes. If the schema definition of either
  * system.site:default_langcode or language.negotiation::url.prefixes changes
  * then this event must be changed to work with both the old and new schema
  * definition so this event is update safe.
  *
  * @param ConfigCrudEvent $event
  *   The configuration event.
  */
 public function onConfigSave(ConfigCrudEvent $event)
 {
     $saved_config = $event->getConfig();
     if ($saved_config->getName() == 'system.site' && $event->isChanged('default_langcode')) {
         $new_default_langcode = $saved_config->get('default_langcode');
         $default_language = $this->configFactory->get('language.entity.' . $new_default_langcode);
         // During an import the language might not exist yet.
         if (!$default_language->isNew()) {
             $this->languageDefault->set(new Language($default_language->get()));
             $this->languageManager->reset();
             // Directly update language negotiation settings instead of calling
             // language_negotiation_url_prefixes_update() to ensure that the code
             // obeys the hook_update_N() restrictions.
             $negotiation_config = $this->configFactory->getEditable('language.negotiation');
             $negotiation_changed = FALSE;
             $url_prefixes = $negotiation_config->get('url.prefixes');
             $old_default_langcode = $saved_config->getOriginal('default_langcode');
             if (empty($url_prefixes[$old_default_langcode])) {
                 $negotiation_config->set('url.prefixes.' . $old_default_langcode, $old_default_langcode);
                 $negotiation_changed = TRUE;
             }
             if (empty($url_prefixes[$new_default_langcode])) {
                 $negotiation_config->set('url.prefixes.' . $new_default_langcode, '');
                 $negotiation_changed = TRUE;
             }
             if ($negotiation_changed) {
                 $negotiation_config->save(TRUE);
             }
         }
         // Trigger a container rebuild on the next request by invalidating it.
         ConfigurableLanguageManager::rebuildServices();
     }
 }
コード例 #9
0
 /**
  * Gets the configuration object when needed.
  *
  * Since this service is injected into all static menu link objects, but
  * only used when updating one, avoid actually loading the config when it's
  * not needed.
  */
 protected function getConfig()
 {
     if (empty($this->config)) {
         $this->config = $this->configFactory->get($this->configName);
     }
     return $this->config;
 }
コード例 #10
0
 /**
  * {@inheritdoc}
  */
 public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 {
     $settings = $this->configFactory->get('ivw_integration.settings');
     if ($settings->get('offering_overridable')) {
         $element['offering'] = array('#type' => 'textfield', '#title' => t('Offering code'), '#default_value' => isset($items[$delta]->offering) ? $items[$delta]->offering : NULL, '#description' => t('A single ivw site can have multiple offerings, they can be differentiated by different numbers.'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#min' => 1);
     }
     if ($settings->get('language_overridable')) {
         $element['language'] = array('#type' => 'select', '#options' => array(1 => 'Deutsch', 2 => 'Andere Sprache, Inhalt prüfbar', 3 => 'Andere Sprache, Inhalt nicht prüfbar'), '#title' => t('Language'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->language) ? $items[$delta]->language : NULL);
     }
     if ($settings->get('format_overridable')) {
         $element['format'] = array('#type' => 'select', '#options' => array(1 => 'Bild/Text', 2 => 'Audio', 3 => 'Video', 4 => 'Andere dynamische Formate'), '#title' => t('Format'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->format) ? $items[$delta]->format : NULL);
     }
     if ($settings->get('creator_overridable')) {
         $element['creator'] = array('#type' => 'select', '#options' => array(1 => 'Redaktion', 2 => 'User', 3 => 'Unbekannt'), '#title' => t('Creator'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->creator) ? $items[$delta]->creator : NULL);
     }
     if ($settings->get('homepage_overridable')) {
         $element['homepage'] = array('#type' => 'select', '#options' => array(1 => 'Homepage des Angebots', 2 => 'Keine Homepage', 3 => 'Hompage der Fremddomains bei Multi-Angeboten'), '#title' => t('Homepage flag'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->homepage) ? $items[$delta]->homepage : NULL);
     }
     if ($settings->get('delivery_overridable')) {
         $element['delivery'] = array('#type' => 'select', '#options' => array(1 => 'Online', 2 => 'Mobile', 3 => 'Connected TV'), '#title' => t('Delivery'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->delivery) ? $items[$delta]->delivery : NULL);
     }
     if ($settings->get('app_overridable')) {
         $element['app'] = array('#type' => 'select', '#options' => array(1 => 'App', 2 => 'Keine App'), '#title' => t('Fallback app flag'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->app) ? $items[$delta]->app : NULL);
     }
     if ($settings->get('paid_overridable')) {
         $element['paid'] = array('#type' => 'select', '#options' => array(1 => 'Paid', 2 => 'Nicht zugeordnet'), '#title' => t('Paid flag'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->paid) ? $items[$delta]->paid : NULL);
     }
     if ($settings->get('content_overridable')) {
         $element['content'] = array('#type' => 'select', '#group' => 'ivw_integration_settings_override', '#options' => array('01' => 'Nachrichten', '02' => 'Sport', '03' => 'Entertainment/Boulevard/Stars/Film/Musik', '04' => 'Fashion/Beauty', '05' => 'Familie/Kinder/Lebenshilfe', '06' => 'Liebe/Psychologie/Beziehungen', '07' => 'Fahrzeuge/Verkehr/Mobilität', '08' => 'Reise/Touristik', '09' => 'Computer', '10' => 'Consumer Electronics', '11' => 'Telekommunikation/Internetdienste', '12' => 'Spiele', '13' => 'Wohnen/Immobilien/Garten/Haushalt', '14' => 'Wirtschaft/Finanzen/Job/Karriere', '15' => 'Gesundheit', '16' => 'Essen/Trinken', '17' => 'Kunst/Kultur/Literatur', '18' => 'Erotik', '19' => 'Wissenschaft/Bildung/Natur/Umwelt', '20' => 'Angebotsinformation', '21' => 'Vermischtes (multithematisch)', '22' => 'Sonstiges (monothematisch)', '23' => 'Übersichtsseite zu Spiele', '24' => 'Casual Games', '25' => 'Core Games', '26' => 'Sonstiges (Bereich Spiele)', '27' => 'Social Networking - Privat', '28' => 'Social Networking - Business', '29' => 'Partnersuche/Dating', '30' => 'Newsletter', '31' => 'E-Mail/SMS/E-Cards', '32' => 'Messenger/Chat', '33' => 'Sonstiges (Bereich Networking/Kommunikation', '34' => 'Suchmaschinen', '35' => 'Verzeichnisse/Auskunftsdienste', '36' => 'Sonstiges (Bereich Suchmaschinen/Verzeichnisse)', '37' => 'Onlineshops/Shopping Mall/Auktionen/B2bMarktplätze', '38' => 'Immobilien Rubrikenmärkte/Kleinanzeigen', '39' => 'Jobs Rubrikenmärkte/Kleinanzeigen', '40' => 'Fahrzeuge Rubrikenmärkte/Kleinanzeigen', '41' => 'Sonstiges Rubrikenmärkte/Kleinanzeigen', '42' => 'Sonstiges (Bereich E-Commerce)'), '#title' => t('Content category'), '#required' => FALSE, '#empty_option' => t('Site default value'), '#default_value' => isset($items[$delta]->content) ? $items[$delta]->content : NULL);
     }
     return $element;
 }
コード例 #11
0
 /**
  * Checks access to the given user's contact page.
  *
  * @param \Drupal\user\UserInterface $user
  *   The user being contacted.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  *
  * @return \Drupal\Core\Access\AccessResultInterface
  *   The access result.
  */
 public function access(UserInterface $user, AccountInterface $account)
 {
     $contact_account = $user;
     // Anonymous users cannot have contact forms.
     if ($contact_account->isAnonymous()) {
         return AccessResult::forbidden();
     }
     // Users may not contact themselves.
     if ($account->id() == $contact_account->id()) {
         return AccessResult::forbidden()->cachePerUser();
     }
     // User administrators should always have access to personal contact forms.
     $access = AccessResult::neutral()->cachePerRole();
     $permission_access = AccessResult::allowedIfHasPermission($account, 'administer users');
     if ($permission_access->isAllowed()) {
         return $access->orIf($permission_access);
     }
     // If requested user has been blocked, do not allow users to contact them.
     $access->cacheUntilEntityChanges($contact_account);
     if ($contact_account->isBlocked()) {
         return $access;
     }
     // If the requested user has disabled their contact form, do not allow users
     // to contact them.
     $account_data = $this->userData->get('contact', $contact_account->id(), 'enabled');
     if (isset($account_data) && empty($account_data)) {
         return $access;
     } else {
         if (!$this->configFactory->get('contact.settings')->get('user_default_enabled')) {
             return $access;
         }
     }
     return $access->orIf(AccessResult::allowedIfHasPermission($account, 'access user contact forms'));
 }
コード例 #12
0
 /**
  * Checks access to the given user's contact page.
  *
  * @param \Drupal\user\UserInterface $user
  *   The user being contacted.
  * @param \Drupal\Core\Session\AccountInterface $account
  *   The currently logged in account.
  *
  * @return string
  *   A \Drupal\Core\Access\AccessInterface constant value.
  */
 public function access(UserInterface $user, AccountInterface $account)
 {
     $contact_account = $user;
     // Anonymous users cannot have contact forms.
     if ($contact_account->isAnonymous()) {
         return static::DENY;
     }
     // Users may not contact themselves.
     if ($account->id() == $contact_account->id()) {
         return static::DENY;
     }
     // User administrators should always have access to personal contact forms.
     if ($account->hasPermission('administer users')) {
         return static::ALLOW;
     }
     // If requested user has been blocked, do not allow users to contact them.
     if ($contact_account->isBlocked()) {
         return static::DENY;
     }
     // If the requested user has disabled their contact form, do not allow users
     // to contact them.
     $account_data = $this->userData->get('contact', $contact_account->id(), 'enabled');
     if (isset($account_data) && empty($account_data)) {
         return static::DENY;
     } else {
         if (!$this->configFactory->get('contact.settings')->get('user_default_enabled')) {
             return static::DENY;
         }
     }
     return $account->hasPermission('access user contact forms') ? static::ALLOW : static::DENY;
 }
コード例 #13
0
 /**
  * Constructs an EntityComparisonBase object.
  *
  * @param DiffBuilderManager $diffBuilderManager
  *   The diff field builder plugin manager.
  * @param EntityManagerInterface $entityManager
  *   Entity Manager service.
  * @param ConfigFactoryInterface $configFactory
  *   The configuration factory.
  */
 public function __construct(DiffBuilderManager $diffBuilderManager, EntityManagerInterface $entityManager, ConfigFactoryInterface $configFactory)
 {
     $this->entityManager = $entityManager;
     $this->config = $configFactory->get('diff.settings');
     $this->pluginsConfig = $configFactory->get('diff.plugins');
     $this->diffBuilderManager = $diffBuilderManager;
 }
コード例 #14
0
 /**
  * {@inheritdoc}
  */
 public function on404(GetResponseForExceptionEvent $event)
 {
     $custom_404_path = $this->configFactory->get('system.site')->get('page.404');
     if (!empty($custom_404_path)) {
         $this->makeSubrequest($event, $custom_404_path, Response::HTTP_NOT_FOUND);
     }
 }
コード例 #15
0
 /**
  * Redirects on 403 Access Denied kernel exceptions.
  *
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  *   The Event to process.
  */
 public function onKernelException(GetResponseEvent $event)
 {
     $exception = $event->getException();
     if (!$exception instanceof AccessDeniedHttpException) {
         return;
     }
     $config = $this->configFactory->get('r4032login.settings');
     $options = array();
     $options['query'] = $this->redirectDestination->getAsArray();
     $options['absolute'] = TRUE;
     $code = $config->get('default_redirect_code');
     if ($this->currentUser->isAnonymous()) {
         // Show custom access denied message if set.
         if ($config->get('display_denied_message')) {
             $message = $config->get('access_denied_message');
             $message_type = $config->get('access_denied_message_type');
             drupal_set_message(Xss::filterAdmin($message), $message_type);
         }
         // Handle redirection to the login form.
         $login_route = $config->get('user_login_route');
         $url = Url::fromRoute($login_route, array(), $options)->toString();
         $response = new RedirectResponse($url, $code);
         $event->setResponse($response);
     } else {
         // Check to see if we are to redirect the user.
         $redirect = $config->get('redirect_authenticated_users_to');
         if ($redirect) {
             // Custom access denied page for logged in users.
             $url = Url::fromUserInput($redirect, $options)->toString();
             $response = new RedirectResponse($url, $code);
             $event->setResponse($response);
         }
     }
 }
コード例 #16
0
ファイル: CasLogin.php プロジェクト: anarshi/recap
 /**
  * Attempts to log the authenticated CAS user into Drupal.
  *
  * This method should be used to login a user after they have successfully
  * authenticated with the CAS server.
  *
  * @param CasPropertyBag $property_bag
  *   CasPropertyBag containing username and attributes from CAS.
  *
  * @throws CasLoginException
  */
 public function loginToDrupal(CasPropertyBag $property_bag, $ticket)
 {
     $this->eventDispatcher->dispatch(CasHelper::CAS_PROPERTY_ALTER, new CasPropertyEvent($property_bag));
     $account = $this->userLoadByName($property_bag->getUsername());
     if (!$account) {
         $config = $this->settings->get('cas.settings');
         if ($config->get('user_accounts.auto_register') === TRUE) {
             if (!$property_bag->getRegisterStatus()) {
                 $_SESSION['cas_temp_disable'] = TRUE;
                 throw new CasLoginException("Cannot register user, an event listener denied access.");
             }
             $account = $this->registerUser($property_bag->getUsername());
         } else {
             throw new CasLoginException("Cannot login, local Drupal user account does not exist.");
         }
     }
     $this->eventDispatcher->dispatch(CasHelper::CAS_USER_ALTER, new CasUserEvent($account, $property_bag));
     $account->save();
     if (!$property_bag->getLoginStatus()) {
         $_SESSION['cas_temp_disable'] = TRUE;
         throw new CasLoginException("Cannot login, an event listener denied access.");
     }
     $this->userLoginFinalize($account);
     $this->storeLoginSessionData($this->sessionManager->getId(), $ticket);
 }
コード例 #17
0
 /**
  * Sets options based on admin input parameters for rendering.
  *
  * @param array $options
  *   The array of options to the sitemap theme.
  * @param string $option_string
  *   The string index given from the admin form to match.
  * @param int $equal_param
  *   Result of param test, 0 or 1.
  * @param string $set_string
  *   Index of option to set, or the option name.
  * @param bool $set_value
  *   The option, on or off, or strings or ints for other options.
  */
 public function setOption(array &$options, $option_string, $equal_param, $set_string, $set_value)
 {
     $config = $this->configFactory->get('sitemap.settings');
     if ($config->get($option_string) == $equal_param) {
         $options[$set_string] = $set_value;
     }
 }
コード例 #18
0
 /**
  * Gets the current front page path.
  *
  * @return string
  *   The front page path.
  */
 protected function getFrontPagePath()
 {
     // Lazy-load front page config.
     if (!isset($this->frontPage)) {
         $this->frontPage = $this->configFactory->get('system.site')->get('page.front');
     }
     return $this->frontPage;
 }
コード例 #19
0
 /**
  * {@inheritdoc}
  */
 public function generateLink($file, $line)
 {
     $ide_link = $this->config_factory->get('webprofiler.config')->get('ide_link');
     $ide_link_remote = $this->config_factory->get('webprofiler.config')->get('ide_link_remote');
     $ide_link_local = $this->config_factory->get('webprofiler.config')->get('ide_link_local');
     $file = str_replace($ide_link_remote, $ide_link_local, $file);
     return new FormattableMarkup($ide_link, ['@file' => $file, '@line' => $line]);
 }
コード例 #20
0
ファイル: Profiler.php プロジェクト: ddrozdik/dmaps
 /**
  * Constructor.
  *
  * @param \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface $storage
  *   A ProfilerStorageInterface instance
  * @param \Psr\Log\LoggerInterface $logger
  *   A LoggerInterface instance
  * @param \Drupal\Core\Config\ConfigFactoryInterface $config
  */
 public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = NULL, ConfigFactoryInterface $config)
 {
     parent::__construct($storage, $logger);
     $this->localStorage = $storage;
     $this->localLogger = $logger;
     $this->config = $config;
     $this->activeToolbarItems = $this->config->get('webprofiler.config')->get('active_toolbar_items');
 }
コード例 #21
0
 /**
  * {@inheritdoc}
  */
 public function matches(Request $request)
 {
     $path = $request->getPathInfo();
     $patterns = $this->configFactory->get('xhprof.config')->get('exclude');
     // never collect phpinfo page.
     $patterns .= "\r\n/admin/reports/status/php";
     return !$this->pathMatcher->matchPath($path, $patterns);
 }
コード例 #22
0
 /**
  * {@inheritdoc}
  */
 public function loadAll()
 {
     $rates_data = $this->configFactory->get('currency.exchanger.fixed_rates')->get('rates');
     $rates = array();
     foreach ($rates_data as $rate_data) {
         $rates[$rate_data['currency_code_from']][$rate_data['currency_code_to']] = $rate_data['rate'];
     }
     return $rates;
 }
コード例 #23
0
ファイル: DbUpdateNegotiator.php プロジェクト: ddrozdik/dmaps
 /**
  * {@inheritdoc}
  */
 public function determineActiveTheme(RouteMatchInterface $route_match)
 {
     $custom_theme = Settings::get('maintenance_theme', 'seven');
     if (!$custom_theme) {
         $config = $this->configFactory->get('system.theme');
         $custom_theme = $config->get('default');
     }
     return $custom_theme;
 }
コード例 #24
0
 function __construct(Connection $connection, ConfigFactoryInterface $config_factory, SitemapGenerator $generator)
 {
     $this->set_language();
     $this->db = $connection;
     $this->config_factory = $config_factory;
     $this->generator = $generator;
     $this->config = $this->config_factory->get(self::CONFIG_SETTINGS);
     $this->sitemap = $this->get_sitemap_from_db();
 }
コード例 #25
0
 /**
  * {@inheritdoc}
  */
 public function applies($object)
 {
     if (parent::applies($object)) {
         /** @var \Drupal\taxonomy\TermInterface $object */
         $vid = $this->configFactory->get('forum.settings')->get('vocabulary');
         return $object->getVocabularyId() == $vid;
     }
     return FALSE;
 }
コード例 #26
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $this->config = $this->configFactory()->getEditable('ng_lightbox.settings');
     $form['container']['patterns'] = array('#type' => 'textarea', '#title' => $this->t('Paths'), '#default_value' => $this->config->get('patterns'), '#description' => $this->t('New line separated paths that must start with a leading slash. Wildcard character is *. E.g. /comment/*/reply.'));
     $form['container']['default_width'] = array('#type' => 'textfield', '#title' => $this->t('Default Width'), '#default_value' => $this->config->get('default_width'), '#description' => $this->t('The default with for modals opened with NG Lightbox'));
     $form['container']['skip_admin_paths'] = array('#title' => $this->t('Skip all admin paths'), '#type' => 'checkbox', '#default_value' => $this->config->get('skip_admin_paths'), '#description' => $this->t('This will exclude all admin paths from the lightbox. If you want some paths, see hook_ng_lightbox_ajax_path_alter().'));
     $form['container']['renderer'] = array('#title' => $this->t('Renderer'), '#type' => 'select', '#default_value' => $this->config->get('renderer') ?: NgLightbox::DEFAULT_MODAL, '#description' => $this->t('Select which renderer should be used for the lightbox.'), '#options' => $this->renderers);
     return parent::buildForm($form, $form_state);
 }
コード例 #27
0
 /**
  * {@inheritdoc}
  */
 public function matches(Request $request)
 {
     $path = $request->getPathInfo();
     $patterns = $this->configFactory->get('webprofiler.config')->get('exclude');
     // never add Webprofiler to phpinfo page.
     $patterns .= "\r\n/admin/reports/status/php";
     // never add Webprofiler to uninstall confirm page.
     $patterns .= "\r\n/admin/modules/uninstall/*";
     return !$this->pathMatcher->matchPath($path, $patterns);
 }
コード例 #28
0
 /**
  * {@inheritdoc}
  */
 public function loadDefault()
 {
     $default = NULL;
     $uuid = $this->configFactory->get('commerce_store.settings')->get('default_store');
     if ($uuid) {
         $entities = $this->loadByProperties(['uuid' => $uuid]);
         $default = reset($entities);
     }
     return $default;
 }
コード例 #29
0
  public function getPdftkPath() {
    $path_to_pdftk = $this->configFactory->get('fillpdf.settings')
      ->get('pdftk_path');

    if (empty($path_to_pdftk)) {
      $path_to_pdftk = 'pdftk';
      return $path_to_pdftk;
    }
    return $path_to_pdftk;
  }
コード例 #30
0
 /**
  * {@inheritdoc}
  */
 protected function alterRoutes(RouteCollection $collection)
 {
     if ($this->configFactory->get('support_ticket.settings')->get('use_admin_theme')) {
         foreach ($collection->all() as $route) {
             if ($route->hasOption('_support_ticket_operation_route')) {
                 $route->setOption('_admin_route', TRUE);
             }
         }
     }
 }