本文整理汇总了PHP中Registry::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::exists方法的具体用法?PHP Registry::exists怎么用?PHP Registry::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::exists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handlePagina
/**
* handlePagina controleer of er inloggegevens zijn gepost, zo ja, log in en redirect naar homepage
* @throws WebsiteException
*/
public function handlePagina()
{
// standaard wordt dit scherm getoond
$oResult = $this;
if (Registry::exists('Bezoeker')) {
$oGebruiker = Registry::get('Bezoeker');
} else {
// gebruiker moet al bestaan, dus fout
throw new WebsiteException('Gebruiker object bestaat niet');
}
if (!$oGebruiker->isIngelogd()) {
// gebruiker was nog niet ingelogd
$oValidator = InputValidator::instantiate();
$oValidator->addValidation('gebruiker', InputValidator::SCOPE_POST, InputValidator::TYPE_STRING, true);
$oValidator->addValidation('wachtwoord', InputValidator::SCOPE_POST, InputValidator::TYPE_STRING, true);
if ($oValidator->validateAll() == InputValidator::RESULT_OK) {
// inloggegevens gepost
if ($oGebruiker->login($oValidator->getValue('gebruiker', InputValidator::SCOPE_POST), $oValidator->getValue('wachtwoord', InputValidator::SCOPE_POST))) {
// login gelukt
$oResult = SchermGenerator::genereerSchermObject(SchermGenerator::BEHEER);
}
}
} else {
// gebruiker was al eerder ingelogd, ga naar homepage
$oResult = SchermGenerator::genereerSchermObject(SchermGenerator::BEHEER);
}
return $oResult;
}
示例2: addEntry
public static function addEntry($type, $action, $uid = FALSE)
{
if (\Registry::exists('LOGGER')) {
$logger = \Registry::get('LOGGER');
} else {
$logger = new self();
\Registry::set('LOGGER', $logger);
}
/*
eFiction 3 log types:
"RG" => _NEWREG
"ED" => _ADMINEDIT
"DL" => _ADMINDELETE
"VS" => _VALIDATESTORY
"LP"=> _LOSTPASSWORD
"BL" => _BADLOGIN
"RE" => "Reviews"
"AM" => "Admin Maintenance"
"EB" => _EDITBIO
*/
// Force add entry
$logger->reset();
// Submitted data:
$logger->type = $type;
$logger->action = $action;
// Use id of active user, unless specified
$logger->uid = $uid ? $uid : $_SESSION['userID'];
$logger->ip = $_SERVER['REMOTE_ADDR'];
$logger->version = 2;
// Add entry
$test = $logger->save();
}
示例3: database
/**
* Construct DB\SQL
* @return DB\SQL
*/
public static function database($db = [])
{
if (!Registry::exists('database')) {
$db = $db ?: Base::instance()->get('database');
return Registry::set('database', new DB\SQL('mysql:host=' . $db['host'] . ';port=' . $db['port'] . ';dbname=' . $db['name'], $db['user'], $db['password']));
}
return Registry::get('database');
}
示例4: instance
/**
* Return class instance
* @return static
**/
static function instance()
{
if (!Registry::exists($class = get_called_class())) {
$ref = new Reflectionclass($class);
$args = func_get_args();
Registry::set($class, $args ? $ref->newinstanceargs($args) : new $class());
}
return Registry::get($class);
}
示例5: instance
public static function instance()
{
if (\Registry::exists('CONFIG')) {
$cfg = \Registry::get('CONFIG');
} else {
$cfg = new self();
\Registry::set('CONFIG', $cfg);
}
return $cfg;
}
示例6: bouwScherm
/**
* bouwScherm bouwt het zoekresultaatscherm op
* @param array $p_aGegevens geassocieerde array met artikelgegevens
* @return boolean False als er iets mis is gegaan, anders true
*/
public function bouwScherm()
{
if (Registry::exists('Exception')) {
$oException = Registry::get('Exception');
$this->m_sTemplate = 'error.tpl';
$this->m_aData['exception'] = array('message' => $oException->getMessage(), 'trace' => $oException->getTraceAsString());
} else {
$this->m_sTemplate = 'error.tpl';
$this->m_aData['exception'] = array('message' => 'Onbekende fout!', 'trace' => '');
}
return true;
}
示例7: setError
function setError($error, $error_number = '', $query = '')
{
if ($this->error_reporting === true) {
$this->error = $error;
$this->error_number = $error_number;
$this->error_query = $query;
error_log('[MYSQL] ' . $this->error . ' (' . $this->error_number . '): [QUERY] ' . $this->error_query);
if (Registry::exists('MessageStack')) {
Registry::get('MessageStack')->add('debug', $this->getError());
}
}
}
示例8: instance
public static function instance()
{
if (\Registry::exists('ICONSET')) {
return \Registry::get('ICONSET');
} else {
$icon = new self();
if (empty($icon->_name)) {
$icon = self::rebuild($icon);
}
\Registry::set('ICONSET', $icon);
return $icon;
}
}
示例9: handlePagina
/**
* handlePagina controleer of er inloggegevens zijn gepost, zo ja, log in en redirect naar homepage
* @throws WebsiteException
*/
public function handlePagina()
{
// standaard wordt dit scherm getoond
$oResult = $this;
if (Registry::exists('Bezoeker')) {
$oGebruiker = Registry::get('Bezoeker');
} else {
// gebruiker moet al bestaan, dus fout
throw new WebsiteException('Gebruiker object bestaat niet');
}
if ($oGebruiker->isIngelogd()) {
// Gebruiker wordt uitgelogd
$oGebruiker->logout();
$oResult = SchermGenerator::genereerSchermObject(SchermGenerator::WELKOM);
} else {
// gebruiker was al eerder uitgelogd / niet ingelogd, ga naar homepage
$oResult = SchermGenerator::genereerSchermObject(SchermGenerator::WELKOM);
}
return $oResult;
}
示例10: getUserLevels
/**
* Return the Administration Tool Application modules the administrator has access to
*
* @param int $id The ID of the administrator
* @access public
* @return array
*/
public static function getUserLevels($id, $site = null)
{
if (empty($site)) {
$site = OSCOM::getSite();
}
$data = array('id' => $id);
$applications = array();
foreach (OSCOM::callDB('GetAccessUserLevels', $data, 'Core') as $am) {
$applications[] = $am['module'];
}
if (in_array('*', $applications)) {
$applications = array();
$DLapps = new DirectoryListing(OSCOM::BASE_DIRECTORY . 'Core/Site/' . $site . '/Application');
$DLapps->setIncludeFiles(false);
foreach ($DLapps->getFiles() as $file) {
if (preg_match('/[A-Z]/', substr($file['name'], 0, 1)) && !in_array($file['name'], call_user_func(array('osCommerce\\OM\\Core\\Site\\' . $site . '\\Controller', 'getGuestApplications'))) && file_exists($DLapps->getDirectory() . '/' . $file['name'] . '/Controller.php')) {
// HPDL remove preg_match
$applications[] = $file['name'];
}
}
}
$shortcuts = array();
foreach (OSCOM::callDB('GetAccessUserShortcuts', $data, 'Core') as $as) {
$shortcuts[] = $as['module'];
}
$levels = array();
foreach ($applications as $app) {
$application_class = 'osCommerce\\OM\\Core\\Site\\' . $site . '\\Application\\' . $app . '\\Controller';
if (class_exists($application_class)) {
if (Registry::exists('Application') && $app == OSCOM::getSiteApplication()) {
$OSCOM_Application = Registry::get('Application');
} else {
Registry::get('Language')->loadIniFile($app . '.php');
$OSCOM_Application = new $application_class(false);
}
$levels[$app] = array('module' => $app, 'icon' => $OSCOM_Application->getIcon(), 'title' => $OSCOM_Application->getTitle(), 'group' => $OSCOM_Application->getGroup(), 'linkable' => $OSCOM_Application->canLinkTo(), 'shortcut' => in_array($app, $shortcuts), 'sort_order' => $OSCOM_Application->getSortOrder());
}
}
return $levels;
}
示例11: __construct
/**
* constructor
* Deze constructor controleert of de gebruiker is ingelogd, is dat het geval,
* dan wordt het ingelogde menu gecreeerd. Als de gebruiker de rechten admin heeft,
* wordt het adminmenu gecreeerd.
* @param string $p_sTitel De getoonde titel op het scherm
* @param array $p_aRechten array bevat alle benodigde rechten om deze pagina op te roepen. Een lege array
* @throws InsufficientRightsException
*/
public function __construct($p_sTitel, $p_aRechten)
{
$this->m_sTitel = $p_sTitel;
$this->m_sHTML = '';
$this->m_aData = array();
$this->m_aScripts = array();
$this->m_oSmarty = null;
$this->m_sTemplate = '';
if (is_array($p_aRechten)) {
$this->m_aBenodigdeRechten = $p_aRechten;
} else {
$this->m_aBenodigdeRechten = array(Gebruiker::TOEGANG_GEWEIGERD);
}
// genereer het menu aan de hand van de gebruikerrechten
if (Registry::exists('Bezoeker')) {
$this->m_oGebruiker = Registry::get('Bezoeker');
if ($this->m_oGebruiker->isIngelogd()) {
$oValidator = InputValidator::instantiate();
$nPagina = intVal($oValidator->getValue('page', InputValidator::SCOPE_GET | InputValidator::SCOPE_POST));
if ($nPagina >= MenuGenerator::BEHEER) {
$aRechten = $this->m_oGebruiker->__get('Rechten');
$this->m_oMenu = MenuGenerator::genereerMenuObject(MenuGenerator::BEHEER, $aRechten);
if (!$this->checkRechten()) {
// genereer een Exception zodat dit scherm nooit per ongeluk getoond kan worden
throw new OnvoldoendeRechtenException('Pagina ' . $p_sTitel);
}
} else {
$this->m_oMenu = MenuGenerator::genereerMenuObject(MenuGenerator::BEZOEKER, array());
}
} else {
$this->m_oMenu = MenuGenerator::genereerMenuObject(MenuGenerator::BEZOEKER, array());
}
} else {
$this->m_oGebruiker = null;
}
}
示例12: instance
/**
* @param $cid
* @return CortexCollection
*/
public static function instance($cid)
{
if (!\Registry::exists($cid)) {
trigger_error(sprintf(self::E_UnknownCID, $cid));
}
return \Registry::get($cid);
}
示例13: getRelInstance
/**
* creates and caches related mapper objects
* @param string $model
* @param array $relConf
* @param string $key
* @param bool $pushFilter
* @return Cortex
*/
protected function getRelInstance($model = null, $relConf = null, $key = '', $pushFilter = false)
{
if (!$model && !$relConf) {
trigger_error(self::E_MISSING_REL_CONF);
}
$relConf = $model ? $model::resolveConfiguration() : $relConf;
$relName = ($model ?: 'Cortex') . '\\' . $relConf['db']->uuid() . '\\' . $relConf['table'] . '\\' . $key;
if (\Registry::exists($relName)) {
$rel = \Registry::get($relName);
$rel->reset();
} else {
$rel = $model ? new $model() : new Cortex($relConf['db'], $relConf['table']);
if (!$rel instanceof Cortex) {
trigger_error(self::E_WRONG_RELATION_CLASS);
}
\Registry::set($relName, $rel);
}
// restrict fields of related mapper
if (!empty($key) && isset($this->relWhitelist[$key])) {
if (isset($this->relWhitelist[$key][0])) {
$rel->fields($this->relWhitelist[$key][0], false);
}
if (isset($this->relWhitelist[$key][1])) {
$rel->fields($this->relWhitelist[$key][1], true);
}
}
if ($pushFilter && !empty($key)) {
if (isset($this->relFilter[$key . '.'])) {
foreach ($this->relFilter[$key . '.'] as $fkey => $conf) {
$rel->filter($fkey, $conf[0], $conf[1]);
}
}
if (isset($this->hasCond[$key . '.'])) {
foreach ($this->hasCond[$key . '.'] as $fkey => $conf) {
$rel->has($fkey, $conf[0], $conf[1]);
}
}
}
return $rel;
}
示例14: getLink
/**
* Return an internal URL address.
*
* @param string $site The Site to link to. Default: The currently used Site.
* @param string $application The Site Application to link to. Default: The currently used Site Application.
* @param string $parameters Parameters to add to the link. Example: key1=value1&key2=value2
* @param string $connection The type of connection to use for the link. Values: NONSSL, SSL, AUTO. Default: NONSSL.
* @param bool $add_session_id Add the session ID to the link. Default: True.
* @param bool $search_engine_safe Use search engine safe URLs. Default: True.
* @return string The URL address.
*/
public static function getLink($site = null, $application = null, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
if ( empty($site) ) {
$site = static::getSite();
}
if ( empty($application) && ($site == static::getSite()) ) {
$application = static::getSiteApplication();
}
if ( !in_array($connection, array('NONSSL', 'SSL', 'AUTO')) ) {
$connection = 'NONSSL';
}
if ( !is_bool($add_session_id) ) {
$add_session_id = true;
}
if ( !is_bool($search_engine_safe) ) {
$search_engine_safe = true;
}
// Wrapper for RPC links; RPC cannot perform cross domain requests
$real_site = ($site == 'RPC') ? $application : $site;
if ( $connection == 'AUTO' ) {
if ( (static::getRequestType() == 'SSL') && (static::getConfig('enable_ssl', $real_site) == 'true') ) {
$link = static::getConfig('https_server', $real_site) . static::getConfig('dir_ws_https_server', $real_site);
} else {
$link = static::getConfig('http_server', $real_site) . static::getConfig('dir_ws_http_server', $real_site);
}
} elseif ( ($connection == 'SSL') && (static::getConfig('enable_ssl', $real_site) == 'true') ) {
$link = static::getConfig('https_server', $real_site) . static::getConfig('dir_ws_https_server', $real_site);
} else {
$link = static::getConfig('http_server', $real_site) . static::getConfig('dir_ws_http_server', $real_site);
}
$link .= static::getConfig('bootstrap_file', 'OSCOM') . '?';
if ( $site != static::getDefaultSite() ) {
$link .= $site . '&';
}
if ( !empty($application) && ($application != static::getDefaultSiteApplication()) ) {
$link .= $application . '&';
}
if ( !empty($parameters) ) {
$link .= HTML::output($parameters) . '&';
}
if ( ($add_session_id === true) && Registry::exists('Session') && Registry::get('Session')->hasStarted() && (SERVICE_SESSION_FORCE_COOKIE_USAGE == '-1') ) {
if ( strlen(SID) > 0 ) {
$_sid = SID;
} elseif ( ((static::getRequestType() == 'NONSSL') && ($connection == 'SSL') && (static::getConfig('enable_ssl', $site) == 'true')) || ((static::getRequestType() == 'SSL') && ($connection != 'SSL')) ) {
if ( static::getConfig('http_cookie_domain', $site) != static::getConfig('https_cookie_domain', $site) ) {
$_sid = Registry::get('Session')->getName() . '=' . Registry::get('Session')->getID();
}
}
}
if ( isset($_sid) ) {
$link .= HTML::output($_sid);
}
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) {
$link = substr($link, 0, -1);
}
if ( ($search_engine_safe === true) && Registry::exists('osC_Services') && Registry::get('osC_Services')->isStarted('sefu') ) {
$link = str_replace(array('?', '&', '='), array('/', '/', ','), $link);
}
return $link;
}
示例15: getLink
/**
* Return an internal URL address.
*
* @param string $site The Site to link to. Default: The currently used Site.
* @param string $application The Site Application to link to. Default: The currently used Site Application.
* @param string $parameters Parameters to add to the link. Example: key1=value1&key2=value2
* @param string $connection The type of connection to use for the link. Values: NONSSL, SSL, AUTO. Default: NONSSL.
* @param bool $add_session_id Add the session ID to the link. Default: True.
* @param bool $search_engine_safe Use search engine safe URLs. Default: True.
* @return string The URL address.
*/
public static function getLink($site = null, $application = null, $parameters = null, $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
{
if (empty($site)) {
$site = self::getSite();
}
if (empty($application) && $site == self::getSite()) {
$application = self::getSiteApplication();
}
if (!in_array($connection, array('NONSSL', 'SSL', 'AUTO'))) {
$connection = 'NONSSL';
}
if (!is_bool($add_session_id)) {
$add_session_id = true;
}
if (!is_bool($search_engine_safe)) {
$search_engine_safe = true;
}
if ($connection == 'AUTO') {
if (self::getRequestType() == 'SSL' && ENABLE_SSL === true) {
$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
} else {
$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
}
} elseif ($connection == 'SSL' && ENABLE_SSL === true) {
$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
} else {
$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
}
$link .= OSCOM_BOOTSTRAP_FILE . '?';
if ($site != self::getDefaultSite()) {
$link .= $site . '&';
}
if (!empty($application)) {
$link .= $application . '&';
}
if (!empty($parameters)) {
$link .= $parameters . '&';
}
if ($add_session_id === true && Registry::exists('Session') && Registry::get('Session')->hasStarted() && SERVICE_SESSION_FORCE_COOKIE_USAGE == '-1') {
if (strlen(SID) > 0) {
$_sid = SID;
} elseif (self::getRequestType() == 'NONSSL' && $connection == 'SSL' && ENABLE_SSL === true || self::getRequestType() == 'SSL' && $connection != 'SSL') {
if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
$_sid = Registry::get('Session')->getName() . '=' . Registry::get('Session')->getID();
}
}
}
if (isset($_sid)) {
$link .= osc_output_string($_sid);
}
while (substr($link, -1) == '&' || substr($link, -1) == '?') {
$link = substr($link, 0, -1);
}
if ($search_engine_safe === true && Registry::exists('osC_Services') && Registry::get('osC_Services')->isStarted('sefu')) {
$link = str_replace(array('?', '&', '='), array('/', '/', ','), $link);
}
return $link;
}