本文整理汇总了PHP中Registry::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::singleton方法的具体用法?PHP Registry::singleton怎么用?PHP Registry::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::singleton方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
/* TOP CONTROLLER AND CLASS: */
//echo count(Registry::getObject('all'));
foreach (Registry::$_objects as $key => $value) {
if (!isset($this->{$key})) {
$this->{$key} = $value;
}
}
$this->settings = Registry::getAllSettings();
$this->libraries = Registry::getAllLibraries();
$this->routes = Registry::getAllRoutes();
//The RegisterData:
$this->registry = Registry::singleton();
//URI:
if (is_object($this->URI)) {
$this->controller = $this->URI->controller();
$this->method = $this->URI->method();
//$this->param = $this->URI->param();
}
}
示例2: dirname
<?php
/**
* $Horde: horde/services/css.php,v 1.45 2004/02/14 04:02:20 chuck Exp $
*
* Copyright 2000-2004 Charles J. Hagenbuch <chuck@horde.org>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*/
@define('HORDE_BASE', dirname(__FILE__) . '/..');
require_once HORDE_BASE . '/lib/core.php';
$registry =& Registry::singleton(HORDE_SESSION_NONE);
// Figure out if we've been inlined, or called directly.
$send_headers = strstr($_SERVER['PHP_SELF'], 'css.php');
// Set initial $mtime of this script.
$mtime = getlastmod();
if (@file_exists(HORDE_BASE . '/config/conf.php')) {
require HORDE_BASE . '/config/conf.php';
} else {
$conf['css']['cached'] = false;
}
$theme = Util::getFormData('theme');
if (Util::getFormData('inherit') !== 'no') {
if (@file_exists(HORDE_BASE . '/config/html.php')) {
$file = HORDE_BASE . '/config/html.php';
} else {
$file = HORDE_BASE . '/config/html.php.dist';
}
if ($conf['css']['cached']) {
$hmtime = filemtime($file);
示例3: dirname
* Chora base inclusion file.
*
* $Horde: chora/lib/base.php,v 1.98 2004/02/14 04:02:10 chuck Exp $
*
* This file brings in all of the dependencies that every Chora script
* will need, and sets up objects that all scripts use.
*/
// Check for a prior definition of HORDE_BASE (perhaps by an
// auto_prepend_file definition for site customization).
if (!defined('HORDE_BASE')) {
@define('HORDE_BASE', dirname(__FILE__) . '/../..');
}
// Load the Horde Framework core, and set up inclusion paths.
require_once HORDE_BASE . '/lib/core.php';
// Registry
$registry =& Registry::singleton();
if (is_a($pushed = $registry->pushApp('chora', !defined('AUTH_HANDLER')), 'PEAR_Error')) {
if ($pushed->getCode() == 'permission_denied') {
Horde::authenticationFailureRedirect();
}
Horde::fatal($pushed, __FILE__, __LINE__, false);
}
$conf =& $GLOBALS['conf'];
@define('CHORA_TEMPLATES', $registry->getParam('templates'));
// Notification system.
$notification =& Notification::singleton();
$notification->attach('status');
// Find the base file path of Chora.
@define('CHORA_BASE', dirname(__FILE__) . '/..');
// Horde base libraries.
require_once HORDE_LIBS . 'Horde/Text.php';
示例4: dirname
<?php
/**
* $Horde: horde/services/javascript.php,v 1.34 2004/03/03 08:38:18 jan Exp $
*
* Copyright 2000-2004 Charles J. Hagenbuch <chuck@horde.org>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*/
@define('HORDE_BASE', dirname(__FILE__) . '/..');
require_once HORDE_BASE . '/lib/core.php';
$registry =& Registry::singleton(HORDE_SESSION_READONLY);
// Figure out if we've been inlined, or called directly.
$send_headers = strstr($_SERVER['PHP_SELF'], 'javascript.php');
$app = Util::getFormData('app');
$file = Util::getFormData('file');
if (!empty($app) && !empty($file) && strpos($file, '..') === false) {
$script_file = $registry->getParam('templates', $app) . '/javascript/' . $file;
if (@file_exists($script_file)) {
$registry->pushApp($app);
$script = Util::bufferOutput('require', $script_file);
if ($send_headers) {
/* Compress the JS. We need this explicit call since we
* don't include base.php in this file. */
Horde::compressOutput();
$mod_gmt = gmdate('D, d M Y H:i:s', filemtime($script_file)) . ' GMT';
header('Last-Modified: ' . $mod_gmt);
header('Cache-Control: public, max-age=86400');
header('Content-Type: text/javascript');
}