本文整理汇总了PHP中SimpleSAML_Module::getModules方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Module::getModules方法的具体用法?PHP SimpleSAML_Module::getModules怎么用?PHP SimpleSAML_Module::getModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSAML_Module
的用法示例。
在下文中一共展示了SimpleSAML_Module::getModules方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: core_hook_sanitycheck
/**
* Hook to do sanitycheck
*
* @param array &$hookinfo hookinfo
*/
function core_hook_sanitycheck(&$hookinfo)
{
assert('is_array($hookinfo)');
assert('array_key_exists("errors", $hookinfo)');
assert('array_key_exists("info", $hookinfo)');
$config = SimpleSAML_Configuration::getInstance();
if ($config->getString('auth.adminpassword', '123') === '123') {
$hookinfo['errors'][] = '[core] Password in config.php is not set properly';
} else {
$hookinfo['info'][] = '[core] Password in config.php is set properly';
}
if ($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') {
$hookinfo['errors'][] = '[core] In config.php technicalcontact_email is not set properly';
} else {
$hookinfo['info'][] = '[core] In config.php technicalcontact_email is set properly';
}
if (version_compare(phpversion(), '5.3', '>=')) {
$hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. Great.';
} else {
$hookinfo['errors'][] = '[core] You are running PHP version ' . phpversion() . '. SimpleSAMLphp requires version >= 5.3. Please upgrade!';
}
$info = array();
$mihookinfo = array('info' => &$info);
$availmodules = SimpleSAML_Module::getModules();
SimpleSAML_Module::callHooks('moduleinfo', $mihookinfo);
foreach ($info as $mi => $i) {
if (isset($i['dependencies']) && is_array($i['dependencies'])) {
foreach ($i['dependencies'] as $dep) {
if (!in_array($dep, $availmodules)) {
$hookinfo['errors'][] = '[core] Module dependency not met: ' . $mi . ' requires ' . $dep;
}
}
}
}
}
示例2: getInstance
public static function getInstance()
{
if (self::$instance !== null) {
return self::$instance;
}
$loader = new \Twig_Loader_Filesystem();
$translator = Translator::getInstance();
$modules = \SimpleSAML_Module::getModules();
foreach ($modules as $module) {
if (\SimpleSAML_Module::isModuleEnabled($module)) {
$path = \SimpleSAML_Module::getModuleDir($module);
$templatePath = self::resourceExists('templates', $path);
if (false !== $templatePath) {
$loader->addPath($templatePath, $module);
}
$translationPath = self::resourceExists('translations', $path);
if (false !== $translationPath) {
$translations = new Finder();
$translations->files()->in($translationPath)->name('/\\.[a-zA-Z_]+\\.yml$/');
/** @var SplFileInfo $translation */
foreach ($translations as $translation) {
$name = $translation->getBasename('.yml');
$locale = substr($name, strrpos($name, '.') + 1);
$translator->addResource('yaml', $translation->getPathname(), $locale, $module);
}
}
}
}
self::$instance = new \Twig_Environment($loader);
self::$instance->addExtension(new TranslationExtension($translator));
return self::$instance;
}
示例3: idpinstaller_hook_step5
/**
* Hook a ejecutar antes del paso 5 de la instalación
* Extrae cuales son las fuentes de datos principales que podría utilizarse
*
* @param array &$data Los datos a utilizar por las plantillas de tipo stepn
*/
function idpinstaller_hook_step5(&$data)
{
$data['datasources'] = getDataSources();
$require_mods = array("saml", "idpinstaller", "modinfo", "ldap", "sqlauth", "core", "portal", "sir2skin");
//Modulos obligatorios
$ssphpobj = $data['ssphpobj'];
$modules = SimpleSAML_Module::getModules();
sort($modules);
$perms_ko = array();
$modules_ko = array();
foreach ($modules as $m) {
$f = realpath(__DIR__ . '/../../' . $m);
if (!file_exists($f . '/default-disable') && !file_exists($f . '/default-enable') && in_array($m, $require_mods)) {
$modules_ko[] = $f;
} elseif (file_exists($f . '/default-disable') && !is_writable($f . '/default-disable') || file_exists($f . '/default-enable') && !is_writable($f . '/default-enable')) {
$perms_ko[] = $f;
} else {
if (in_array($m, $require_mods)) {
//PARA LOS QUE SI QUEREMOS ACTIVAR
if (file_exists($f . '/default-disable')) {
@unlink($f . '/default-disable');
@touch($f . '/default-enable');
if (!file_exists($f . '/default-enable')) {
$data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
}
}
} else {
//PARA LOS QUE QUEREMOS DESACTIVAR
if (file_exists($f . '/default-enable')) {
@unlink($f . '/default-enable');
@touch($f . '/default-disable');
if (!file_exists($f . '/default-disable')) {
$data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
}
}
}
}
}
if (count($modules_ko) > 0) {
$data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
} elseif (count($perms_ko) > 0) {
if (function_exists('posix_getgrnam')) {
$aux = "<br/>" . $ssphpobj->t('{idpinstaller:idpinstaller:step4_perms_ko}');
$filename = $perms_ko[0];
$file_owner = posix_getpwuid(fileowner($filename));
$group = posix_getgrgid(posix_getgid());
$recursive = is_dir($filename) ? "-R" : "";
$aux .= "<pre>> chown {$recursive} " . $file_owner['name'] . ":" . $group['name'] . " {$filename}\n> chmod {$recursive} g+w " . $filename . "</pre>";
}
$data['errors'][] = $aux;
$data['errors'][] = $ssphpobj->t("{idpinstaller:idpinstaller:step1_remember_change_perms}");
}
if (count($data['errors']) == 0) {
$data['info'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_all_ok}');
}
/*else {
$data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
}*/
return true;
}
示例4: cmpa
<?php
$modules = SimpleSAML_Module::getModules();
sort($modules);
$modinfo = array();
foreach ($modules as $m) {
$modinfo[$m] = array('enabled' => SimpleSAML_Module::isModuleEnabled($m));
if (sspmod_core_ModuleDefinition::isDefined($m)) {
$modinfo[$m]['def'] = sspmod_core_ModuleDefinition::load($m);
}
}
function cmpa($a, $b)
{
if (isset($a['def']) && !isset($b['def'])) {
return -1;
}
if (isset($b['def']) && !isset($a['def'])) {
return 1;
}
return 0;
}
uasort($modinfo, 'cmpa');
$config = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($config, 'modinfo:modlist.php');
$t->data['modules'] = $modinfo;
$t->show();