本文整理汇总了PHP中Kernel类的典型用法代码示例。如果您正苦于以下问题:PHP Kernel类的具体用法?PHP Kernel怎么用?PHP Kernel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kernel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Kernel $kernel)
{
$this->kernel = $kernel;
$this->db = $kernel->getClass('dbEngine');
$this->user = $kernel->getClass('User');
$this->_initEngine();
}
示例2: setUp
public function setUp()
{
parent::setUp();
$this->kernel = new AppKernel('test', true);
$this->kernel->boot();
$this->container = $this->kernel->getContainer();
}
示例3: __construct
/**
* Initializes context.
*
* @param Kernel $kernel
*/
public function __construct($kernel)
{
$this->kernel = $kernel;
$this->container = $kernel->getContainer();
$this->doctrine = $kernel->getContainer()->get('doctrine');
$this->em = $this->doctrine->getManager();
}
示例4: fromString
public function fromString()
{
$string = '[[-1.0, -1.0, -1.0], [-1.0, 16.0, -1.0], [-1.0, -1.0, -1.0]]';
$matrix = array(array(-1.0, -1.0, -1.0), array(-1.0, 16.0, -1.0), array(-1.0, -1.0, -1.0));
$k = new Kernel($string);
$this->assertEquals($matrix, $k->getMatrix());
}
示例5: __construct
public function __construct()
{
chdir(__DIR__);
require __DIR__ . '/../vendor/autoload.php';
$configPath = __DIR__ . '/../app/config/';
$kernel = new Kernel($configPath);
$kernel->loadContainer();
$this->container = $kernel->getContainer();
}
示例6: __construct
public function __construct(Kernel $kernel)
{
$this->db = $kernel->getClass('dbEngine');
if (isset($_POST['loginform']) === true) {
$this->_checkAuth();
}
if ($this->_isGuest() === false) {
$this->_buildUserInfo();
//$this->forceGuestUser();
}
//print_r($this->userInfo);
}
示例7: _createContent
public function _createContent(&$toReturn)
{
$ppo = new CopixPPO();
// Récupération des paramètres
$ppo->classeurId = $this->getParam('classeurId');
$ppo->dossierId = $this->getParam('dossierId', null);
$ppo->dossierCourant = $this->getParam('dossierCourant');
// Paramètres pour la vue popup
$ppo->field = $this->getParam('field');
$ppo->format = $this->getParam('format');
$ppo->withPersonal = $this->getParam('withPersonal', true);
$ppo->moduleType = $this->getParam('moduleType', null);
$ppo->moduleId = $this->getParam('moduleId', null);
$ppo->estAdmin = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId) >= PROFILE_CCV_PUBLISH;
$ppo->withLockers = $ppo->estAdmin || is_null($ppo->dossierId);
// Récupération des dossiers
$dossierDAO = _ioDAO('classeur|classeurdossier');
$ppo->dossiers = $dossierDAO->getEnfantsDirects($ppo->classeurId, $ppo->dossierId, $ppo->withLockers);
_classInclude('classeurservice');
$ppo->dossiersOuverts = ClasseurService::getFoldersTreeState();
if (!is_array($ppo->dossiersOuverts)) {
$ppo->dossiersOuverts = array();
}
$toReturn = $this->_usePPO($ppo, '_arborescence_dossiers.tpl');
}
示例8: startExec
public function startExec()
{
if (_currentUser()->isConnected()) {
$userId = _currentUser()->getId();
$userInfos = Kernel::getUserInfo('ID', $userId);
$this->director = false;
$this->animator = _currentUser()->hasAssistance();
$this->idEn = isset($userInfos['id']) ? $userInfos['id'] : null;
$this->id = $userId * 1;
$this->type = isset($userInfos['type']) ? $userInfos['type'] : null;
$this->root = false;
$this->login = $userInfos['login'];
$this->nom = $userInfos['nom'];
$this->prenom = $userInfos['prenom'];
$this->connected = true;
$this->chartValid = isset($_SESSION['chartValid']) ? $_SESSION['chartValid'] : false;
} else {
$this->director = false;
$this->animator = false;
$this->id = 0;
$this->type = 'USER_ANON';
$this->root = false;
$this->login = 'Anon';
$this->nom = 'Anon';
$this->prenom = 'Anon';
$this->connected = false;
$this->idEn = 0;
$this->chartValid = true;
}
}
示例9: getInstance
public static function getInstance()
{
if (!self::$instance) {
self::$instance = new Kernel();
}
return self::$instance;
}
示例10: processRequest
public function processRequest(MMapRequest $request, MMapResponse $response)
{
ob_start('mb_output_handler');
MMapManager::startSession();
MMapManager::checkSessionExpiration();
$username = $request->issetPOST('username') ? $request->getPOST('username') : '';
$password = $request->issetPOST('password') ? $request->getPOST('password') : '';
$loginPage = $request->issetPOST('loginPage') ? $request->getPOST('loginPage') : '';
$subject = new Subject();
$loginContext = new LoginContext('eyeos-login', $subject);
$cred = new EyeosPasswordCredential();
$cred->setUsername($username);
$cred->setPassword($password, true);
$subject->getPrivateCredentials()->append($cred);
try {
$loginContext->login();
$memoryManager = MemoryManager::getInstance();
Kernel::enterSystemMode();
$memoryManager->set('isExternLogin', 1);
$memoryManager->set('username', $username);
$memoryManager->set('password', $password);
$memoryManager->set('loginPage', $loginPage);
Kernel::exitSystemMode();
header("Location: index.php");
} catch (Exception $e) {
header("Location:" . $loginPage . "?errorLogin=1");
}
}
示例11: _createContent
public function _createContent(&$toReturn)
{
$ppo = new CopixPPO();
// Récupération des paramètres
$ppo->classeurId = $this->getParam('classeurId');
$ppo->dossierId = $this->getParam('dossierId');
$ppo->current = $this->getParam('current');
// Gestion des droits
$ppo->niveauUtilisateur = Kernel::getLevel('MOD_CLASSEUR', $ppo->classeurId);
$ppo->typeUtilisateur = _currentUser()->getExtra('type');
$ppo->vue = !is_null(_sessionGet('classeur|typeVue')) ? _sessionGet('classeur|typeVue') : 'liste';
$ppo->conf_ModClasseur_options = CopixConfig::exists('default|conf_ModClasseur_options') ? CopixConfig::get('default|conf_ModClasseur_options') : 0;
// L'album public est t-il publié ?
$ppo->estPublic = false;
if (!is_null($ppo->dossierId) && $ppo->dossierId != 0) {
$dossierDAO = _ioDAO('classeur|classeurdossier');
$ppo->dossier = $dossierDAO->get($ppo->dossierId);
if ($ppo->dossier->public) {
$ppo->estPublic = true;
}
} else {
$classeurDAO = _ioDAO('classeur|classeur');
$classeur = $classeurDAO->get($ppo->classeurId);
if ($classeur->public) {
$ppo->estPublic = true;
}
}
$toReturn = $this->_usePPO($ppo, '_affichage_menu.tpl');
}
示例12: load
/**
* Loads a list of classes and caches them in one big file.
*
* @param array $classes An array of classes to load
* @param string $cacheDir A cache directory
* @param string $name The cache name prefix
* @param Boolean $autoReload Whether to flush the cache when the cache is stale or not
* @param Boolean $adaptive Whether to remove already declared classes or not
*
* @throws \InvalidArgumentException When class can't be loaded
*/
public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = false)
{
// each $name can only be loaded once per PHP process
if (isset(self::$loaded[$name])) {
return;
}
self::$loaded[$name] = true;
$classes = array_unique($classes);
if ($adaptive) {
// don't include already declared classes
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
// the cache is different depending on which classes are already declared
$name = $name . '-' . substr(md5(implode('|', $classes)), 0, 5);
}
$cache = $cacheDir . '/' . $name . '.php';
// auto-reload
$reload = false;
if ($autoReload) {
$metadata = $cacheDir . '/' . $name . '.meta';
if (!file_exists($metadata) || !file_exists($cache)) {
$reload = true;
} else {
$time = filemtime($cache);
$meta = unserialize(file_get_contents($metadata));
if ($meta[1] != $classes) {
$reload = true;
} else {
foreach ($meta[0] as $resource) {
if (!file_exists($resource) || filemtime($resource) > $time) {
$reload = true;
break;
}
}
}
}
}
if (!$reload && file_exists($cache)) {
require_once $cache;
return;
}
$files = array();
$content = '';
foreach ($classes as $class) {
if (!class_exists($class) && !interface_exists($class)) {
throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
}
$r = new \ReflectionClass($class);
$files[] = $r->getFileName();
$content .= preg_replace(array('/^\\s*<\\?php/', '/\\?>\\s*$/'), '', file_get_contents($r->getFileName()));
}
// cache the core classes
if (!is_dir(dirname($cache))) {
mkdir(dirname($cache), 0777, true);
}
self::writeCacheFile($cache, Kernel::stripComments('<?php ' . $content));
if ($autoReload) {
// save the resources
self::writeCacheFile($metadata, serialize(array($files, $classes)));
}
}
示例13: _createContent
public function _createContent(&$toReturn)
{
$ppo = new CopixPPO();
// Récupération des paramètres
$ppo->cahierId = $this->getParam('cahierId');
$ppo->jour = $this->getParam('date_jour');
$ppo->mois = $this->getParam('date_mois');
$ppo->annee = $this->getParam('date_annee');
$ppo->vue = $this->getParam('vue');
$ppo->eleve = $this->getParam('eleve');
$time = mktime(0, 0, 0, $ppo->mois, $ppo->jour, $ppo->annee);
$cahierInfos = Kernel::getModParent('MOD_CAHIERDETEXTES', $ppo->cahierId);
$nodeId = isset($cahierInfos[0]) ? $cahierInfos[0]->node_id : null;
$ppo->estAdmin = Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) >= PROFILE_CCV_PUBLISH ? true : false;
// Récupération des travaux suivant les accès de l'utilisateur courant (élève / responsable / enseignant)
$travailDAO = _ioDAO('cahierdetextes|cahierdetextestravail');
if ($ppo->estAdmin) {
$ppo->travaux = $travailDAO->findByClasseEtTypeDeTravail($nodeId, DAOCahierDeTextesTravail::TYPE_EN_CLASSE, $time);
} elseif (Kernel::getLevel('MOD_CAHIERDETEXTES', $ppo->cahierId) == PROFILE_CCV_READ) {
$ppo->travaux = $travailDAO->findByEleveEtTypeDeTravail($ppo->eleve, DAOCahierDeTextesTravail::TYPE_EN_CLASSE, $time);
} else {
$ppo->travaux = $travailDAO->findByEleveEtTypeDeTravail(_currentUser()->getExtra('id'), DAOCahierDeTextesTravail::TYPE_EN_CLASSE, $time);
}
$toReturn = $this->_usePPO($ppo, '_travaux_en_classe.tpl');
}
示例14: checkRight
public function checkRight($type, $id, $mini)
{
switch ($type) {
case 'ANNU':
$annuaire_dao = CopixDAOFactory::create("ressource_annuaires");
$annuaire = $annuaire_dao->get($id);
if (!$annuaire) {
return false;
}
$id_annu = $id;
break;
case 'RES':
$ressource_dao = CopixDAOFactory::create("ressource_ressources");
$ressource = $ressource_dao->get($id);
if (!$ressource) {
return false;
}
$id_annu = $ressource->ressources_id_annu;
break;
default:
return false;
}
// Test : if( ! Ressource::checkRight( "RES", $id, PROFILE_CCV_SHOW ) )
if (Kernel::getLevel("MOD_RESSOURCE", $id_annu) >= $mini) {
return true;
}
return false;
}
示例15: setTimelimit
public static function setTimelimit($timelimit)
{
self::$torrentTimelimit = $timelimit;
$id = Sessionmanager::getUserId();
$unixTime = strtotime($timelimit);
Kernel::mysqli()->query("UPDATE usersetting SET timelimit=FROM_UNIXTIME({$unixTime}) WHERE id={$id}");
}