/** * * @param \Illuminate\Config\Repository $config * @param \Illuminate\Filesystem\Filesystem $files * @param \Illuminate\View\Factory $view * @param string $publicPath */ public function __construct(ConfigRepository $config, Filesystem $files, $view, $publicPath) { $this->config = $config; $this->files = $files; $this->view = $view; $this->public_path = $publicPath; $this->showWarnings = $this->config->get('laravel-dompdf::show_warnings', false); //To prevent old configs from not working.. if ($this->config->has('laravel-dompdf::paper')) { $this->paper = $this->config->get('laravel-dompdf::paper'); } else { $this->paper = DOMPDF_DEFAULT_PAPER_SIZE; } $this->orientation = $this->config->get('laravel-dompdf::orientation') ?: 'portrait'; $this->dompdf = new \DOMPDF(); $this->dompdf->set_base_path(realpath($publicPath)); }
/** * Setup * * @throws Exception */ private function setUp() { if (!$this->config->has('purifier')) { if (!$this->config->has('mews.purifier')) { throw new Exception('Configuration parameters not loaded!'); } $this->config->set('purifier', $this->config->get('mews.purifier')); } $this->checkCacheDirectory(); // Create a new configuration object $config = HTMLPurifier_Config::createDefault(); // Allow configuration to be modified if (!$this->config->get('purifier.finalize')) { $config->autoFinalize = false; } $config->loadArray($this->getConfig()); if ($def = $config->maybeGetRawHTMLDefinition()) { if ($addElement = $this->config->get('purifier.addElement')) { foreach ($addElement as $item) { call_user_func_array(array($def, "addElement"), $item); } } if ($addAttribute = $this->config->get('purifier.addAttribute')) { foreach ($addAttribute as $item) { call_user_func_array(array($def, "addAttribute"), $item); } } } // Create HTMLPurifier object $this->purifier = new HTMLPurifier($config); }
protected function setEnvironment() { if ($this->config->has('custom.environment')) { $this->environment = $this->config->get('custom.environment'); } else { $this->environment = $this->config->get('general.environment'); } }
/** * Init configuration * * @return void */ protected function configure() { if ($this->config->has('sphinx_search')) { foreach ($this->config->get('sphinx_search') as $key => $val) { $key = $this->camel($key); $this->{$key} = $val; } } }
/** * Init configuration * * @return void */ protected function configure() { if ($this->config->has('google_suggest')) { foreach ($this->config->get('google_suggest') as $key => $val) { $key = $this->camel($key); $this->{$key} = $val; } } }
/** * Cache the passed response * * @param \Illuminate\Routing\Route $route * @param \Illuminate\Http\Request $request * @param \Symfony\Component\HttpFoundation\Response $response * * @return void */ public function store(Route $route, Request $request, Response $response) { if ($ttl = $this->ttl) { $key = $this->makeCacheKey($request); if (!$this->cache->has($key)) { $cacheable = $this->serializeResponse($response); $this->cache->put($key, $cacheable, $ttl); } } }
/** * Load the messages for the given locale. * * @param string $locale * @param string $group * @param string $namespace * @return array */ public function loadSource($locale, $group, $namespace = '*') { if ($this->cache->has($locale, $group, $namespace)) { return $this->cache->get($locale, $group, $namespace); } else { $source = $this->fallback->load($locale, $group, $namespace); $this->cache->put($locale, $group, $namespace, $source, $this->cacheTimeout); return $source; } }
public function __construct(Config $config, SessionStore $session) { if ($config->has('ttwitter::config')) { $this->tconfig = $config->get('ttwitter::config'); } else { if ($config->get('ttwitter')) { $this->tconfig = $config->get('ttwitter'); } else { throw new Exception('No config found'); } } $this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false; $this->parent_config = []; $this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY']; $this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET']; $this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN']; $this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET']; if ($session->has('access_token')) { $access_token = $session->get('access_token'); if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) { $this->parent_config['token'] = $access_token['oauth_token']; $this->parent_config['secret'] = $access_token['oauth_token_secret']; } } $this->parent_config['use_ssl'] = $this->tconfig['USE_SSL']; $this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION; $config = array_merge($this->parent_config, $this->tconfig); parent::__construct($this->parent_config); }
/** * @param Repository $config */ protected function extractProperties(Repository $config) { if ($config->has(self::REPOSITORY_KEY)) { $data = $config->get(self::REPOSITORY_KEY); $this->properties = $data['properties'][$data['use']]; } }
/** * Retrieves a cached locale from the specified locale code. * * @param string $code * * @return bool */ protected function getCacheLocale($code) { $id = sprintf('translation.%s', $code); if ($this->cache->has($id)) { return $this->cache->get($id); } return false; }
/** * @param string $config * @return void */ protected function configure($config) { if ($this->config->has('captcha.' . $config)) { foreach ($this->config->get('captcha.' . $config) as $key => $val) { $this->{$key} = $val; } } }
/** * Setup * * @throws Exception */ private function setUp() { if (!$this->config->has('purifier')) { if (!$this->config->has('mews.purifier')) { throw new Exception('Configuration parameters not loaded!'); } $this->config->set('purifier', $this->config->get('mews.purifier')); } $this->checkCacheDirectory(); // Create a new configuration object $config = HTMLPurifier_Config::createDefault(); // Allow configuration to be modified if (!$this->config->get('purifier.finalize')) { $config->autoFinalize = false; } $config->loadArray($this->getConfig()); // Create HTMLPurifier object $this->purifier = new HTMLPurifier($this->configure($config)); }
/** * Handle dynamic method calls into the model. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { $className = class_basename($this); $config = implode('.', ['relationship', $className, $method]); if (Config::has($config)) { $function = Config::get($config); return $function($this); } return parent::__call($method, $parameters); }
/** * Returns a list of all available locales. * * @return array */ public function availableLocales() { if ($this->config->has('translator.locales')) { return $this->config->get('translator.locales'); } if ($this->tableExists()) { $locales = $this->model->distinct()->get()->pluck('locale')->toArray(); $this->config->set('translator.locales', $locales); return $locales; } return $this->defaultAvailableLocales; }
/** * Retrieves a configuration value from Laravel. * * @param $option * @return mixed */ protected function getLaravelConfigValue($option) { $option = implode('.', (array) $option); // Laravel 5 $optionKey = self::PACKAGE_CONFIG_NAMESPACE . '.' . $option; if ($this->laravelConfig->has($optionKey)) { return $this->laravelConfig->get($optionKey); } // Laravel 4 $optionKey = self::PACKAGE_CONFIG_NAMESPACE . '::' . $option; return $this->laravelConfig->get($optionKey); }
/** * * @param string $config * @return void */ protected function configure($config, $formId = false) { if ($this->config->has('captcha.' . $config)) { foreach ($this->config->get('captcha.' . $config) as $key => $val) { $this->{$key} = $val; } } if ($formId !== false) { $this->formId = $formId; } elseif ($this->unique) { $this->formId = $this->str->random(32); } }
/** * Check if file is on disk * * @param string $url * @param array $options * @return string */ public function getUrlFromCache($url, $options = array()) { $path = $this->getCachedFile($url, $options); if (!$this->filesystem->has($path)) { return false; } else { $prefix = '/public'; if (substr($path, 0, strlen($prefix)) == $prefix) { $path = substr($path, strlen($prefix)); } } if ($this->config->get('image::cache.store') == 's3') { $path = "http://{$this->config->get('image::cache.bucket')}.s3.amazonaws.com{$path}"; } return $path; }
/** * Init configuration * * @param string $config * @return void */ protected function configure($config) { if ($this->config->has('emoji.' . $config)) { foreach ($this->config->get('emoji.' . $config) as $key => $val) { $key = $this->camel($key); $this->{$key} = $val; } } if (is_null($this->ecodeToImageFile)) { $this->ecodeToImageFile = __DIR__ . '/../data/ecode_to_image.php'; } if (is_null($this->ecodeToAliasFile)) { $this->ecodeToAliasFile = __DIR__ . '/../data/ecode_to_alias.php'; } try { $this->ecodeToImageList = (require $this->ecodeToImageFile); $this->ecodeToAliasList = (require $this->ecodeToAliasFile); } catch (Exception $e) { throw $e; } }
/** * Determine if the given configuration value exists. * * @param string $key * @return bool * @static */ public static function has($key) { return \Illuminate\Config\Repository::has($key); }
/** * @param Repository $config */ private function initializeTimezone(Repository $config) { if (!$config->has('app.timezone')) { // There is no timezone set. $config->set('app.timezone', @date_default_timezone_get()); } if (!$config->has('app.server_timezone')) { // There is no server timezone set. $config->set('app.server_timezone', @date_default_timezone_get()); } @date_default_timezone_set($config->get('app.timezone')); }
/** * Check a setting exists in config * * @param string $key * * @return boolean */ public function configHas($key) { return $this->config->has($key) ? true : false; }
/** * Determine if the given configuration value exists. * * @param string $key * * @return bool */ public function has($key) : bool { return $this->delegate->has($key); }
/** * Determine if the given configuration value exists. * * @param string $key * * @return bool */ public function has($key) { return $this->repository->has($key); }