/** * _processValidator() - internal function that is called in the existence of VALID metadata * * @throws SessionException * @return void */ private static function _processValidators() { foreach ($_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) { if (!class_exists($validator_name)) { Loader::loadClass($validator_name); } /** @var SessionValidatorInterface $validator */ $validator = new $validator_name(); if ($validator->validate() === false) { throw new SessionException("This session is not valid according to {$validator_name}."); } } }
/** * Load a plugin via the name provided * * @param string $name * @param bool $throwExceptions Whether or not to throw exceptions if the * class is not resolved * @return false|string Class name of loaded class; false if $throwExceptions * if false and no class found * @throws AmfException */ public function load($name, $throwExceptions = true) { echo "\nLoading resource:{$name}"; $name = $this->_formatName($name); if ($this->isLoaded($name)) { return $this->getClassName($name); } if ($this->_useStaticRegistry) { $registry = self::$_staticPrefixToPaths[$this->_useStaticRegistry]; } else { $registry = $this->_prefixToPaths; } $registry = array_reverse($registry, true); $found = false; if (false !== strpos($name, '\\')) { $classFile = str_replace('\\', DIRECTORY_SEPARATOR, $name) . '.php'; } else { $classFile = str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php'; } $incFile = self::getIncludeFileCache(); foreach ($registry as $prefix => $paths) { $className = $prefix . $name; if (class_exists($className, false)) { $found = true; break; } $paths = array_reverse($paths, true); foreach ($paths as $path) { $loadFile = $path . $classFile; if (Loader::isReadable($loadFile)) { include_once $loadFile; if (class_exists($className, false)) { if (null !== $incFile) { self::_appendIncFile($loadFile); } $found = true; break 2; } } } } if (!$found) { if (!$throwExceptions) { return false; } $message = "Plugin by name '{$name}' was not found in the registry; used paths:"; foreach ($registry as $prefix => $paths) { $message .= "\n{$prefix}: " . implode(PATH_SEPARATOR, $paths); } throw new AmfException($message); } if ($this->_useStaticRegistry) { self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name] = $className; } else { $this->_loadedPlugins[$name] = $className; } return $className; }