本文整理汇总了PHP中Registry::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::getConfig方法的具体用法?PHP Registry::getConfig怎么用?PHP Registry::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::getConfig方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_json
public function get_json()
{
if (Registry::getConfig('DEBUG')) {
return array('message' => $this->message, 'exception_message' => $this->e_message, 'trace' => $this->trace);
} else {
return array('message' => $this->message);
}
}
示例2: __construct
/**
* Create a Data Map
*
* @param string $connection [optional] database connection info
* @param string $username [optional] username to connect with
* @param string $password [optional] password to connect with
*/
public function __construct($connection = null, $username = null, $password = null)
{
$this->registry = Registry::getInstance();
// take conn and credentials from config, unless overriden in constructor
if ($connection == null) {
$connection = $this->registry->getConfig("DATABASE_CONNECTION", true);
}
if ($username == null) {
$username = $this->registry->getConfig("DATABASE_USERNAME", true);
}
if ($password == null) {
$password = $this->registry->getConfig("DATABASE_PASSWORD", true);
}
// assign it
$this->connection = $connection;
$this->username = $username;
$this->password = $password;
}
示例3: getRequestEscapedParameter
/**
* Returns escaped value of parameter stored in POST,GET.
*
* @param string $name Name of parameter.
* @param string $defaultValue Default value if no value provided.
*
* @return mixed
*/
public function getRequestEscapedParameter($name, $defaultValue = null)
{
$value = $this->getRequestParameter($name, $defaultValue);
// TODO: remove this after special chars concept implementation
$isAdmin = Registry::getConfig()->isAdmin() && Registry::getSession()->getVariable("blIsAdmin");
if ($value !== null && !$isAdmin) {
$this->checkParamSpecialChars($value);
}
return $value;
}
示例4: index
public function index()
{
$config = Registry::getConfig();
$pag['total'] = 0;
$pag['limit'] = $_REQUEST['limit'] ? $_REQUEST['limit'] : $config->get("defaultLimit");
$pag['limitStart'] = $_REQUEST['limitStart'];
$this->setData("results", User::select($_REQUEST, $pag['limit'], $pag['limitStart'], $pag['total']));
$this->setData("pag", $pag);
$html = $this->view("views.list");
$this->render($html);
}
示例5: generate
/**
* @return string
*/
public static function generate()
{
$length = OptinCodeGenerator::DEFAULT_CODE_LENGTH;
$config = Registry::getConfig();
$optinConfig = $config->get('optin');
if ($optinConfig) {
$length = Registry::getConfig()->optin->code->length;
}
$randomCharacters = str_split(md5(mt_rand(0, 200000) . microtime(true)));
$mergedCharacters = array_merge($randomCharacters, range('a', 'z'));
shuffle($mergedCharacters);
return substr(implode('', $mergedCharacters), 0, $length);
}
示例6: index
public function index()
{
//Remember filters
if (!$_REQUEST['fresh']) {
rememberFilter('search');
rememberFilter('limit');
rememberFilter('limitStart');
rememberFilter('order');
rememberFilter('orderDir');
}
$config = Registry::getConfig();
$pag['total'] = 0;
$pag['limit'] = $_REQUEST['limit'] ? $_REQUEST['limit'] : $config->get("defaultLimit");
$pag['limitStart'] = $_REQUEST['limitStart'];
$this->setData("results", Entrada::select($_REQUEST, $pag['limit'], $pag['limitStart'], $pag['total']));
$this->setData("pag", $pag);
$html = $this->view("views.list");
$this->render($html);
//Log
Log::add(LOG_LISTAR_ENTRADA);
}
示例7: required
/**
* Check whether or not an installation is required
*
* @return boolean
*/
public static function required()
{
$query = new DBQuery("SHOW TABLES IN " . Registry::getConfig('DB_DATABASE'));
$query->execute();
$tables_in_db = array();
while ($row = $query->rowNotAssoc()) {
$tables_in_db[] = $row[0];
}
foreach (self::$required_tables as $table => $statement) {
if (!in_array($table, $tables_in_db)) {
return true;
}
}
// Count number of users in database
$query = new DBQuery("SELECT COUNT(*) AS `NumRows` FROM `users`");
$query->execute();
$row = $query->row();
// If no users, offer installation
if ($row['NumRows'] == 0) {
return true;
}
return false;
}
示例8: defined
<?php
defined('_EXE') or die('Restricted access');
?>
<!-- Debugging Modals -->
<?php
$config = Registry::getConfig();
if ($config->get("debug")) {
?>
<?php
$debug = Registry::getDebug();
?>
<!-- Current Queries Debug Modal -->
<?php
$controller->setData("debug", $debug);
?>
<?php
$controller->setData("debugModalId", "Current");
?>
<?php
echo $controller->view("modules.debug.modalQueries");
?>
<!-- Previous Queries Debug Modal -->
<?php
if ($_SESSION['debug']['queries']) {
?>
<?php
$controller->setData("debug", $_SESSION['debug']);
?>
<?php
示例9: logout
/**
* Logout
*
* @return bool
*/
public static function logout()
{
$config = Registry::getConfig();
//Destroy Cookies
unset($_COOKIE[$config->get("cookie")]);
setcookie($config->get("cookie"), null, -1, "/");
//Log
Log::add(LOG_LOGOUT);
return true;
}
示例10: __construct
public function __construct(Registry $registry)
{
$this->config = $registry->getConfig();
$this->registry = $registry;
}