本文整理汇总了PHP中EasySCP_Registry::set方法的典型用法代码示例。如果您正苦于以下问题:PHP EasySCP_Registry::set方法的具体用法?PHP EasySCP_Registry::set怎么用?PHP EasySCP_Registry::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasySCP_Registry
的用法示例。
在下文中一共展示了EasySCP_Registry::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _processConfiguration
/**
* Load configuration parameters from the database
*
* This function retrieves all the parameters from the database and merge
* them with the basis configuration object.
*
* Parameters that exists in the basis configuration object will be replaced
* by them that come from the database. The basis configuration object
* contains parameters that come from the easyscp.conf configuration file or
* any parameter defined in the {@link environment.php} file.
*
* @return void
*/
protected function _processConfiguration()
{
// We get an EasySCP_Config_Handler_Db object
$dbConfig = new EasySCP_Config_Handler_Db();
// Now, we can override our basis configuration object with parameter
// that come from the database
$this->_config->replaceWith($dbConfig);
// Finally, we register the EasySCP_Config_Handler_Db for shared access
EasySCP_Registry::set('Db_Config', $dbConfig);
}
示例2: spl_autoload_register
*/
require_once INCLUDEPATH . '/easyscp-autoloader.php';
spl_autoload_register('AutoLoader::loadClass');
/**
* Exception Handler for uncaught exceptions
*
* Sets the exception handler for uncaught exceptions
*/
EasySCP_Exception::setHandler();
/**
* Encryption data
*/
require_once INCLUDEPATH . '/easyscp-load-db-keys.php';
if ($easyscp_db_pass_key != '{KEY}' && $easyscp_db_pass_iv != '{IV}') {
EasySCP_Registry::set('MCRYPT_KEY', $easyscp_db_pass_key);
EasySCP_Registry::set('MCRYPT_IV', $easyscp_db_pass_iv);
unset($easyscp_db_pass_key, $easyscp_db_pass_iv);
} else {
throw new EasySCP_Exception('Error: Database key and/or initialization vector was not generated!');
}
/**
* Include EasySCP common functions
*/
require_once 'Net/IDNA2.php';
require_once INCLUDEPATH . '/easyscp-functions.php';
/**
* Bootstrap the EasySCP environment, and default configuration
*
* @see {@link EasySCP_Bootstrap} class
* @see {@link EasySCP_Initializer} class
*/
示例3: add_update_services
/**
* Adds or updates a services ports
*
* @since 1.0.7
* @param boolean $mode TRUE on add, FALSE on update
* @return void
*/
function add_update_services($mode)
{
// Gets a reference to the EasySCP_ConfigHandler_Db instance
$db_cfg = EasySCP_Registry::get('Db_Config');
// Create a pool for messages on error and gets a reference to him
$messages =& EasySCP_Registry::set('Page_Messages', array());
// Create a pool for error fields ids and gets a reference to him
$error_fields_ids =& EasySCP_Registry::set('Error_Fields_Ids', array());
// Adds a service port
if ($mode) {
$port = $_POST['port_new'];
$proto = $_POST['port_type_new'];
$name = strtoupper($_POST['name_new']);
$show = $_POST['show_val_new'];
$ip = $_POST['ip_new'];
if (validates_service($name, $ip, $port, $proto, $show)) {
$db_sname = "PORT_{$name}";
// Add the service port in the database
// See EasySCP_ConfigHandler_Db adapter class to learn how it work
$db_cfg->{$db_sname} = "{$port};{$proto};{$name};{$show};1;{$ip}";
write_log(get_session('user_logged') . ": Added service port {$name} ({$port})!");
}
// Updates one or more services ports
} else {
// Reset counter of update queries
$db_cfg->resetQueriesCounter('update');
foreach ($_POST['name'] as $index => $name) {
$port = $_POST['port'][$index];
$proto = $_POST['port_type'][$index];
$name = strtoupper($name);
$show = $_POST['show_val'][$index];
$custom = $_POST['custom'][$index];
$ip = $_POST['ip'][$index];
if (validates_service($name, $ip, $port, $proto, $show, $index)) {
$db_sname = $_POST['var_name'][$index];
// Update the service port in the database
// See EasySCP_ConfigHandler_Db adapter class to learn how it work
$db_cfg->{$db_sname} = "{$port};{$proto};{$name};{$show};{$custom};{$ip}";
}
}
}
// Prepare data and messages for error page
if (!empty($error_fields_ids)) {
to_session($mode);
set_page_message(implode('<br />', array_unique($messages)), 'error');
// Prepares message for page on add
} elseif ($mode) {
set_page_message(tr('Service port was added!'), 'success');
// Prepares message for page on update
} else {
// gets the number of queries that were been executed
$updt_count = $db_cfg->countQueries('update');
// An Update was been made in the database ?
if ($updt_count == 1) {
set_page_message(tr('%d Service port was updated!', $updt_count), 'success');
} elseif ($updt_count > 1) {
set_page_message(tr('%d Services port were updated!', $updt_count), 'success');
} else {
set_page_message(tr("Nothing's been changed!"), 'info');
}
}
}