本文整理汇总了PHP中AMP_Registry::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP AMP_Registry::instance方法的具体用法?PHP AMP_Registry::instance怎么用?PHP AMP_Registry::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMP_Registry
的用法示例。
在下文中一共展示了AMP_Registry::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setBase
function setBase($page = "index.php")
{
$reg =& AMP_Registry::instance();
$this->baseURL = "/";
$this->toplink = $this->baseURL . $page;
$this->current_section = $this->top;
}
示例2: getPaymentFields
function getPaymentFields()
{
$payment_field_set = $this->payment_fields;
$reg =& AMP_Registry::instance();
$payment_set = new PaymentItemSet($reg->getDbcon());
$payment_set->readData();
$payment_field_set['payment_items_id']['values'] = $payment_set->optionValues();
return $payment_field_set;
}
示例3:
function &getDbcon()
{
static $dbcon = false;
if (!$dbcon) {
$registry =& AMP_Registry::instance();
$dbcon = $registry->getEntry(AMP_REGISTRY_DBCON);
}
return $dbcon;
}
示例4: _initThumbAttrs
function _initThumbAttrs()
{
$reg =& AMP_Registry::instance();
if ($thumb_attr = $reg->getEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES)) {
$this->_thumb_attr = array_merge($this->_thumb_attr, $thumb_attr);
} else {
$this->_thumb_attr['width'] = AMP_IMAGE_WIDTH_THUMB;
}
}
示例5: _init_fields
function _init_fields()
{
if (!empty($this->_fields)) {
return $this->_fields;
}
$modin = $this->getModin();
if (!$modin) {
return false;
}
$sourceDef = get_class($this) . $modin;
//check registry for field defs
$reg =& AMP_Registry::instance();
$definedSources =& $reg->getEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
if (!$definedSources) {
$definedSources = AMP_cache_get(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS);
}
if ($definedSources && isset($definedSources[$sourceDef])) {
return $definedSources[$sourceDef];
}
require_once 'AMP/System/UserData.php';
$moduleSource =& new AMPSystem_UserData($this->dbcon, $modin);
if (!$moduleSource->hasData()) {
return false;
}
$md = $moduleSource->getData();
$fields = $this->_allowed_keys;
$keys = array('label', 'public', 'type', 'required', 'values', 'lookup', 'size', 'enabled');
foreach ($fields as $fname) {
if (!$fname) {
continue;
}
if (!(isset($md['enabled_' . $fname]) && $md['enabled_' . $fname])) {
continue;
}
$field = array();
foreach ($keys as $key) {
$field[$key] = $md[$key . "_" . $fname];
}
$field = $this->_register_lookups($field);
$this->_fields[$fname] = $field;
}
//Publish Field Hack
if ($md['publish']) {
$publish_field = array('type' => 'checkbox', 'label' => '<span class=publish_label>PUBLISH</span>', 'required' => false, 'public' => false, 'values' => 0, 'size' => null, 'enabled' => true);
$this->_fields['publish'] = $publish_field;
}
//cache field defs to registry
$definedSources[$sourceDef] = $this->_fields;
$reg->setEntry(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
AMP_cache_set(AMP_REGISTRY_SYSTEM_DATASOURCE_DEFS, $definedSources);
return $this->_fields;
}
示例6: recalculate
function recalculate(&$target_set, $args = null)
{
$new_sizes = array();
if (isset($args['image_width_thumb']) && is_numeric($args['image_width_thumb']) && $args['image_width_thumb'] && $args['image_width_thumb'] != AMP_IMAGE_WIDTH_THUMB) {
$new_sizes['thumb'] = $args['image_width_thumb'];
$reg =& AMP_Registry::instance();
$reg_value = array('width' => $new_sizes['thumb']);
$reg->setEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES, $reg_value);
}
if (isset($args['image_width_tall']) && is_numeric($args['image_width_tall']) && $args['image_width_tall'] && $args['image_width_tall'] != AMP_IMAGE_WIDTH_TALL) {
$new_sizes['tall'] = $args['image_width_tall'];
}
if (isset($args['image_width_wide']) && is_numeric($args['image_width_wide']) && $args['image_width_wide'] && $args['image_width_wide'] != AMP_IMAGE_WIDTH_WIDE) {
$new_sizes['wide'] = $args['image_width_wide'];
}
if (empty($new_sizes)) {
return false;
}
$this->_saveNewWidthSettings($new_sizes);
foreach ($target_set as $target) {
$this->resize($target, $new_sizes);
}
$this->_clear_cache($target);
}
示例7: isset
<?php
require_once 'AMP/System/Base.php';
require_once 'AMP/System/Page/Menu.inc.php';
require_once 'AMP/System/Page/Display.php';
$id = isset($_GET['id']) && $_GET['id'] ? $_GET['id'] : 'home';
$menu = new AMP_System_Page_Menu($id);
$display = new AMP_System_Page_Display(AMP_Registry::instance());
$display->add($menu);
print $display->execute();
示例8: _init_thumbnail_attributes
function _init_thumbnail_attributes()
{
if (AMP_IMAGE_CLASS_THUMB == $this->_list_image_class) {
$reg =& AMP_Registry::instance();
if ($thumb_attr = $reg->getEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES)) {
$this->_thumb_attr = array_merge($this->_thumb_attr, $thumb_attr);
}
}
}
示例9: define
<?php
require_once 'AMP/BaseDB.php';
$GLOBALS['admin_auth'] =& AMP_Registry::instance();
$db_type = 'mysql';
$db_host = AMP_DB_HOST;
$db_name = AMP_DB_NAME;
$db_username = AMP_DB_USER;
$db_password = AMP_DB_PASS;
$db_prefix = 'punbb_';
$p_connect = false;
$cookie_name = 'punbb_cookie';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
$cookie_seed = '744c5f12';
if (defined('AMP_LOCAL_PATH')) {
if (!defined('PUN_CACHE_DIR')) {
define('PUN_CACHE_DIR', AMP_LOCAL_PATH . '/cache/punbb');
}
if (!defined('PUN_STYLE_PATH')) {
define('PUN_STYLE_PATH', '/custom/punbb/styles/');
}
if (!defined('PUN_STYLE_DIR')) {
define('PUN_STYLE_DIR', AMP_LOCAL_PATH . PUN_STYLE_PATH);
}
} else {
if (!defined('PUN_CACHE_DIR')) {
define('PUN_CACHE_DIR', PUN_ROOT . 'cache/');
}
}
示例10: _HTML_media_thumbnail
function _HTML_media_thumbnail($url)
{
if (!$url) {
return false;
}
$reg =& AMP_Registry::instance();
if ($thumb_attr = $reg->getEntry(AMP_REGISTRY_CONTENT_IMAGE_THUMB_ATTRIBUTES)) {
$this->_thumb_attr = array_merge($this->_thumb_attr, $thumb_attr);
}
return $this->_HTML_image($url, $this->_thumb_attr);
}
示例11: AMP_URL_Read
<?php
require_once 'AMP/Content/Page.inc.php';
require_once 'AMP/Content/Map/Breadcrumb.inc.php';
$breadcrumb =& AMP_Breadcrumb_Content::instance();
$urlvars = AMP_URL_Read();
$reg =& AMP_Registry::instance();
$intro_id = $reg->getEntry(AMP_REGISTRY_CONTENT_INTRO_ID);
if (isset($urlvars['list']) && $urlvars['list'] == AMP_CONTENT_LISTTYPE_CLASS) {
$breadcrumb->findClass($urlvars[AMP_CONTENT_LISTTYPE_CLASS]);
}
if (isset($urlvars['id']) && $urlvars['id'] && !isset($urlvars['list']) && strpos($_SERVER['PHP_SELF'], 'article.php') !== FALSE) {
$breadcrumb->findArticle($urlvars['id']);
}
if (isset($urlvars['list']) && $urlvars['list'] == AMP_CONTENT_LISTTYPE_SECTION) {
$breadcrumb->findSection($urlvars[AMP_CONTENT_LISTTYPE_SECTION]);
}
if (strpos($_SERVER['PHP_SELF'], 'article.php') === FALSE && isset($intro_id) && $intro_id !== 1) {
$breadcrumb->findIntroText($intro_id);
}
$currentPage =& AMPContent_Page::instance();
if (isset($currentPage) && ($page_section = $currentPage->getSectionId())) {
$breadcrumb->findSection($page_section);
}
if (isset($urlvars['template_section']) && $urlvars['template_section']) {
$breadcrumb->findSection($urlvars['template_section']);
}
//this guard clause is a temporary measure until breadcrumb is reliably called
//by the template
if (!isset($avoid_printing_breadcrumb)) {
print $breadcrumb->execute();
示例12: die
die("Incomplete database configuration. Please contact your system administrator.");
}
} else {
die("Couldn't find a local site configuration file. Please contact your system administrator.");
}
if (!isset($ADODB_CACHE_DIR) || !is_dir($ADODB_CACHE_DIR) || !is_writable($ADODB_CACHE_DIR)) {
$ADODB_CACHE_DIR = AMP_urlFlip(AMP_LOCAL_PATH . '/cache');
}
if (!defined('AMP_BASE_PATH')) {
define('AMP_BASE_PATH', $_SERVER['DOCUMENT_ROOT']);
}
if (!defined('AMP_BASE_INCLUDE_PATH')) {
define('AMP_BASE_INCLUDE_PATH', $_SERVER['DOCUMENT_ROOT'] . '/include/');
}
// turn on APD debugger when set by config file
if (defined('AMP_DEBUG_MODE_APD') && AMP_DEBUG_MODE_APD && function_exists('apd_set_pprof_trace')) {
apd_set_pprof_trace();
}
// Connect to the database.
if (!defined('AMP_DB_TYPE')) {
define('AMP_DB_TYPE', 'mysql');
}
ADOLoadCode(AMP_DB_TYPE);
$dbcon = ADONewConnection(AMP_DB_TYPE);
if (!$dbcon->Connect(AMP_DB_HOST, AMP_DB_USER, AMP_DB_PASS, AMP_DB_NAME)) {
die('Connection to database ' . AMP_DB_NAME . ' was refused. Please check your site configuration file.');
}
require_once 'AMP/Registry.php';
//add the dbcon to the Registry
$registry = AMP_Registry::instance();
$registry->setDbcon($dbcon);
示例13: setUP
function setUP()
{
$registry = AMP_Registry::instance();
$dbcon = $registry->getDbcon();
$this->udm = new UserData($dbcon, 1);
}
示例14: AMP_load_site_command_line
function AMP_load_site_command_line()
{
$local_path_pattern = '/home/%s/public_html/';
#$local_path_pattern = '/home/%s/';
$site_folder = $_SERVER['argv'][1];
if (!$site_folder) {
trigger_error('Usage: login_link.php sitename');
return false;
}
define('AMP_LOCAL_PATH', sprintf($local_path_pattern, $site_folder));
#define( 'AMP_SYSTEM_CACHE', false );
$config_file_path = sprintf($local_path_pattern, $site_folder) . 'custom/';
$lib_file_path = sprintf($local_path_pattern, $site_folder) . 'lib/';
$include_path = sprintf($local_path_pattern, 'amp') . 'include/';
$include_path = '/home/amp/public_html/include/';
define('AMP_BASE_INCLUDE_PATH', $include_path);
$config_file1 = 'SiteConfig.php';
$config_file2 = 'config.php';
$incpath = ini_get('include_path');
// Search local paths for includes.
ini_set('include_path', $include_path . ':' . $config_file_path . ':' . $lib_file_path . ':' . ini_get('include_path'));
if (!file_exists($config_file_path . $config_file1) && !file_exists($config_file_path . $config_file2)) {
trigger_error('path not found: ' . $config_file_path . $config_file2);
return false;
}
require_once 'utility.system.functions.inc.php';
require_once 'utility.functions.inc.php';
require_once 'AMP/System/Flash.php';
if (file_exists($config_file_path . $config_file1)) {
require_once $config_file_path . $config_file1;
} else {
require_once $config_file_path . $config_file2;
if (isset($MM_DBTYPE)) {
define('AMP_DB_TYPE', $MM_DBTYPE);
}
define('AMP_DB_HOST', $MM_HOSTNAME);
define('AMP_DB_USER', $MM_USERNAME);
define('AMP_DB_PASS', $MM_PASSWORD);
define('AMP_DB_NAME', $MM_DATABASE);
}
require_once 'adodb/adodb.inc.php';
if (!defined('AMP_DB_TYPE')) {
define('AMP_DB_TYPE', 'mysql');
}
ADOLoadCode(AMP_DB_TYPE);
$dbcon = ADONewConnection(AMP_DB_TYPE);
if (!$dbcon->Connect(AMP_DB_HOST, AMP_DB_USER, AMP_DB_PASS, AMP_DB_NAME)) {
trigger_error('database connection failed');
return false;
}
require_once 'AMP/Registry.php';
$registry = AMP_Registry::instance();
$registry->setDbcon($dbcon);
//define( 'AMP_SYSTEM_CACHE', false );
define('AMP_SITE_CACHE_TIMEOUT', 0);
require_once 'AMP/System/Config.inc.php';
require_once 'AMP/System/Language/Config.php';
require_once 'AMP/Base/Debug.php';
//require_once( 'AMP/System/Cache/Config.inc.php');
AMP_config_load('cache');
require_once 'AMP/Base/Setup.php';
//require_once( 'AMP/System/User/Config.php');
AMP_config_load('tools');
require_once 'AMP/Base/Lookups.php';
AMP_config_load('site');
AMP_config_load('content');
require_once 'AMP/Content/Map.inc.php';
return $site_folder;
}
示例15: _set_public_page
function _set_public_page(&$public_page)
{
if (!$public_page) {
return;
}
$this->_public_page_id = $public_page->id;
$this->_display->add($public_page->getDisplay(), AMP_CONTENT_DISPLAY_KEY_INTRO);
$reg =& AMP_Registry::instance();
$reg->setEntry(AMP_REGISTRY_CONTENT_INTRO_ID, $this->_public_page_id);
if (!isset($this->_page)) {
require_once 'AMP/Content/Page.inc.php';
$this->_page = AMPContent_Page::instance();
}
$this->_page->setIntroText($this->_public_page_id);
$this->_page->initLocation();
}