The path will never end with a '/'.
public resolvePath ( string | null $path ) : string | null | ||
$path | string | null | The path we should resolve. This option may be null. |
리턴 | string | null | $path if $path is an absolute path, or $path prepended with the base directory of this SimpleSAMLphp installation. We will return NULL if $path is null. |
/** * Setup twig. */ private function setupTwig() { $auto_reload = $this->configuration->getBoolean('template.auto_reload', true); $cache = false; if (!$auto_reload) { // Cache only used if auto_reload = false $cache = $this->configuration->getString('template.cache', $this->configuration->resolvePath('cache')); } // set up template paths $loader = $this->setupTwigTemplatepaths(); // abort if twig template does not exist if (!$loader->exists($this->twig_template)) { return false; } // load extra i18n domains if ($this->module) { $this->localization->addModuleDomain($this->module); } $options = array('cache' => $cache, 'auto_reload' => $auto_reload, 'translation_function' => array('\\SimpleSAML\\Locale\\Translate', 'translateSingularNativeGettext'), 'translation_function_plural' => array('\\SimpleSAML\\Locale\\Translate', 'translatePluralNativeGettext')); // set up translation if ($this->localization->i18nBackend === \SimpleSAML\Locale\Localization::GETTEXT_I18N_BACKEND) { $options['translation_function'] = array('\\SimpleSAML\\Locale\\Translate', 'translateSingularGettext'); $options['translation_function_plural'] = array('\\SimpleSAML\\Locale\\Translate', 'translatePluralGettext'); } // TODO: add a branch for the old SimpleSAMLphp backend $twig = new Twig_Environment($loader, $options); $twig->addExtension(new Twig_Extensions_Extension_I18n()); return $twig; }
public function __construct(\SimpleSAML_Configuration $config) { $storeConfig = $config->getValue('ticketstore', array('directory' => 'ticketcache')); if (!is_string($storeConfig['directory'])) { throw new Exception('Invalid directory option in config.'); } $path = $config->resolvePath($storeConfig['directory']); if (!is_dir($path)) { throw new Exception('Directory for CAS Server ticket storage [' . $path . '] does not exists. '); } if (!is_writable($path)) { throw new Exception('Directory for CAS Server ticket storage [' . $path . '] is not writable. '); } $this->pathToTicketDirectory = preg_replace('/\\/$/', '', $path); }
public function __construct(array $config) { if (!is_string($config['directory'])) { throw new Exception('Invalid directory option in config.'); } $conf = new SimpleSAML_Configuration(array(), ''); $path = $conf->resolvePath($config['directory']); if (!is_dir($path)) { throw new Exception('Invalid storage directory [' . $path . '].'); } if (!is_writable($path)) { throw new Exception('Storage directory [' . $path . '] is not writable.'); } $this->directory = preg_replace('/\\/$/', '', $path) . '/'; }
/** * Get the default locale dir for a specific module aka. domain * * @param string $domain Name of module/domain */ public function getDomainLocaleDir($domain) { $localeDir = $this->configuration->resolvePath('modules') . '/' . $domain . '/locales'; return $localeDir; }
private function evilObjectCreator($id, $expire) { $conf = new \SimpleSAML_Configuration(array(), ''); $path = $conf->resolvePath('tests'); $filename = $path . '/' . $expire . '-' . $id; file_put_contents($filename, serialize(array('jsonString' => array(json_encode('dummy')), 'objectClass' => array('jsonObject')))); }