本文整理汇总了PHP中Config::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getData方法的具体用法?PHP Config::getData怎么用?PHP Config::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemoveBaseUrlOverride
/**
* Test Core::removeBaseUrl method using the base_url[...]
* override config settings.
* @param $contextPath string
* @param $baseUrl string
* @param $url string
* @param $expectUrl string
* @covers removeBaseUrl
* @dataProvider testRemoveBaseUrlOverrideDataProvider
*/
public function testRemoveBaseUrlOverride($contextPath, $baseUrl, $url, $expectUrl)
{
$configData =& Config::getData();
$configData['general']['base_url[' . $contextPath . ']'] = $baseUrl;
$configData['general']['base_url[test2]'] = $baseUrl . '/test';
$actualUrl = Core::removeBaseUrl($url);
$this->assertEquals($expectUrl, $actualUrl);
}
示例2: testReloadDataAndGetData
/**
* @depends testSetConfigFileName
* @covers Config::reloadData
*/
public function testReloadDataAndGetData()
{
Config::setConfigFileName('lib/pkp/tests/config/config.mysql.inc.php');
$result = Config::reloadData();
$expectedResult = array('installed' => true, 'base_url' => 'http://pkp.sfu.ca/ojs', 'registry_dir' => 'lib/pkp/tests/registry', 'session_cookie_name' => 'OJSSID', 'session_lifetime' => 30, 'scheduled_tasks' => false, 'date_format_trunc' => '%m-%d', 'date_format_short' => '%Y-%m-%d', 'date_format_long' => '%B %e, %Y', 'datetime_format_short' => '%Y-%m-%d %I:%M %p', 'datetime_format_long' => '%B %e, %Y - %I:%M %p', 'disable_path_info' => false);
// We'll only check part of the configuration data to
// keep the test less verbose.
self::assertEquals($expectedResult, $result['general']);
$result =& Config::getData();
self::assertEquals($expectedResult, $result['general']);
}
示例3: sendMobile
public function sendMobile()
{
$data = Config::getData();
$params = ['data' => $data];
// HTTP Params
$this->sender->setData($params);
// Send Data To Server
$response = $this->sender->send();
$this->feedback = new Feedback();
$this->feedback->setFeedback($response);
$this->feedback->parseFeedback();
// Render Feedback
$rendered = $this->feedback->build();
return $rendered;
}
示例4: saveSystemConfig
/**
* Save modified system configuration settings.
*/
function saveSystemConfig()
{
$this->validate();
$this->setupTemplate(true);
$configData =& Config::getData();
// Update configuration based on user-supplied data
foreach ($configData as $sectionName => $sectionData) {
$newData = Request::getUserVar($sectionName);
foreach ($sectionData as $settingName => $settingValue) {
if (isset($newData[$settingName])) {
$newValue = $newData[$settingName];
if (strtolower($newValue) == "true" || strtolower($newValue) == "on") {
$newValue = "On";
} else {
if (strtolower($newValue) == "false" || strtolower($newValue) == "off") {
$newValue = "Off";
}
}
$configData[$sectionName][$settingName] = $newValue;
}
}
}
$templateMgr =& TemplateManager::getManager();
// Update contents of configuration file
$configParser = new ConfigParser();
if (!$configParser->updateConfig(Config::getConfigFileName(), $configData)) {
// Error reading config file (this should never happen)
$templateMgr->assign('errorMsg', 'admin.systemConfigFileReadError');
$templateMgr->assign('backLink', Request::url(null, null, null, null, 'systemInfo'));
$templateMgr->assign('backLinkLabel', 'admin.systemInformation');
$templateMgr->display('common/error.tpl');
} else {
$writeConfigFailed = false;
$displayConfigContents = Request::getUserVar('display') == null ? false : true;
$configFileContents = $configParser->getFileContents();
if (!$displayConfigContents) {
if (!$configParser->writeConfig(Config::getConfigFileName())) {
$writeConfigFailed = true;
}
}
// Display confirmation
$templateMgr->assign('writeConfigFailed', $writeConfigFailed);
$templateMgr->assign('displayConfigContents', $displayConfigContents);
$templateMgr->assign('configFileContents', $configFileContents);
$templateMgr->assign('helpTopicId', 'site.administrativeFunctions');
$templateMgr->display('admin/systemConfigUpdated.tpl');
}
}
示例5: __construct
function __construct()
{
// Testing Data
$this->data = Config::getData();
$this->template = new Templater();
// TODO Set API paths
$design = Settings::$server . 'mobile-api/design/view/assets';
$this->template->setTemplateAPI('design', $design);
// Template path
if (Config::$controller) {
$this->view = Config::$controller . DS . Config::$action . '.php';
} else {
// Default Design
$this->view = false;
}
}
示例6: initialize
/**
* @copydoc PKPHandler::initialize()
*/
function initialize($request)
{
parent::initialize($request);
// Load user-related translations.
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_APP_ADMIN, LOCALE_COMPONENT_PKP_ADMIN, LOCALE_COMPONENT_APP_MANAGER, LOCALE_COMPONENT_APP_COMMON);
// Basic grid configuration.
$this->setTitle('admin.systemConfiguration');
//
// Grid columns.
//
import('lib.pkp.controllers.grid.admin.systemInfo.InfoGridCellProvider');
$infoGridCellProvider = new InfoGridCellProvider();
// setting name.
$this->addColumn(new GridColumn('name', 'admin.systemInfo.settingName', null, null, $infoGridCellProvider, array('width' => 20)));
// setting value.
$this->addColumn(new GridColumn('value', 'admin.systemInfo.settingValue', null, null, $infoGridCellProvider));
$this->_configData = Config::getData();
}
示例7: systemInfo
/**
* Show system information summary.
*/
function systemInfo($args, &$request)
{
$this->validate();
$this->setupTemplate($request, true);
$configData =& Config::getData();
$dbconn =& DBConnection::getConn();
$dbServerInfo = $dbconn->ServerInfo();
$versionDao = DAORegistry::getDAO('VersionDAO');
$currentVersion =& $versionDao->getCurrentVersion();
$versionHistory =& $versionDao->getVersionHistory();
$serverInfo = array('admin.server.platform' => Core::serverPHPOS(), 'admin.server.phpVersion' => Core::serverPHPVersion(), 'admin.server.apacheVersion' => function_exists('apache_get_version') ? apache_get_version() : __('common.notAvailable'), 'admin.server.dbDriver' => Config::getVar('database', 'driver'), 'admin.server.dbVersion' => empty($dbServerInfo['description']) ? $dbServerInfo['version'] : $dbServerInfo['description']);
$templateMgr =& TemplateManager::getManager($request);
$templateMgr->assign_by_ref('currentVersion', $currentVersion);
$templateMgr->assign_by_ref('versionHistory', $versionHistory);
$templateMgr->assign_by_ref('configData', $configData);
$templateMgr->assign_by_ref('serverInfo', $serverInfo);
if ($request->getUserVar('versionCheck')) {
$latestVersionInfo =& VersionCheck::getLatestVersion();
$latestVersionInfo['patch'] = VersionCheck::getPatch($latestVersionInfo);
$templateMgr->assign_by_ref('latestVersionInfo', $latestVersionInfo);
}
$templateMgr->display('admin/systemInfo.tpl');
}
示例8: getVar
/**
* Retrieve a specified configuration variable.
* @param $section string
* @param $key string
* @return string
*/
function getVar($section, $key)
{
$configData =& Config::getData();
return isset($configData[$section][$key]) ? $configData[$section][$key] : null;
}
示例9: RESTresourceDetail
function RESTresourceDetail()
{
$type = validatetype(processRESTarg(1, ARG_STRING));
$deleted = processInputVar('deleted', ARG_NUMERIC, 0);
if ($deleted != 0 && $deleted != 1) {
$deleted = 0;
}
$name = processInputVar('name', ARG_STRING, '*');
$tmp = processInputVar('prettyname', ARG_STRING, '*');
if ($name == '*' && $tmp != '*') {
$name = $tmp;
}
if (is_null($type)) {
RESTresponse(404, "invalid resource type");
return;
}
$subid = processRESTarg(2, ARG_NUMERIC, 0);
if ($type == 'image') {
$resources = getUserResources(array("imageAdmin", "imageCheckOut"), array('available'), 0, $deleted);
} elseif ($type == 'computer') {
$resources = getUserResources(array("computerAdmin"), array("administer"), 0, $deleted);
} elseif ($type == 'config') {
$resources = getUserResources(array("configAdmin"), array('available'), 0, $deleted);
}
# TODO
#elseif ...
if ($subid && !array_key_exists($subid, $resources[$type])) {
RESTresponse(404, "specified resource does not exist");
printArray($resources[$type]);
return;
}
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
if (RESTdeleteResource($type, $subid)) {
RESTresponse(204);
} else {
RESTresponse(404, "specified resource does not exist 2");
}
return;
}
if ($type == 'image') {
$items = getImages($deleted, $subid);
$data = array();
foreach (array_keys($resources[$type]) as $id) {
if ($name != '*' && !preg_match("/^{$name}\$/i", $items[$id]['prettyname'])) {
continue;
}
if (array_key_exists($id, $items)) {
$data[$id] = $items[$id];
}
}
} elseif ($type == 'computer') {
$data = getComputers(1, 0, $subid);
} elseif ($type == 'config') {
$cluster = processInputVar('cluster', ARG_NUMERIC, -1);
$cfg = new Config();
$items = $cfg->getData($cfg->defaultGetDataArgs);
$data = array();
foreach (array_keys($resources[$type]) as $id) {
if ($name != '*' && !preg_match("/^{$name}\$/i", $items[$id]['name'])) {
continue;
}
if (array_key_exists($id, $items)) {
if ($cluster == -1 || $cluster == 0 && $items[$id]['configtype'] != 'Cluster' || $cluster == 1 && $items[$id]['configtype'] == 'Cluster') {
$data[$id] = $items[$id];
}
}
}
}
#elseif ...
if ($subid == 0) {
sendREST(dataToJSON($data));
return;
}
sendREST(dataToJSON($data[$subid], 1));
}
示例10: generateSalt
public static function generateSalt($section)
{
$length = Config::getData($section, "salt_length");
return openssl_random_pseudo_bytes($length);
}
示例11: array
/**
* Get context base urls from config file.
* @return array Empty array if none is set.
*/
function &getContextBaseUrls()
{
$contextBaseUrls =& Registry::get('contextBaseUrls');
// Reference required.
if (is_null($contextBaseUrls)) {
$contextBaseUrls = array();
$configData = Config::getData();
// Filter the settings.
$matches = null;
foreach ($configData['general'] as $settingName => $settingValue) {
if (preg_match('/base_url\\[(.*)\\]/', $settingName, $matches)) {
$workingContextPath = $matches[1];
$contextBaseUrls[$workingContextPath] = $settingValue;
}
}
}
return $contextBaseUrls;
}
示例12: _setReportErrorOnly
/**
* Set the scheduled_task_report_error_only setting value.
* @param $state string 'On' or 'Off'
*/
private function _setReportErrorOnly($state)
{
$configData =& Config::getData();
$configData['general']['scheduled_tasks_report_error_only'] = $state;
}
示例13: merge
/**
* @param Config $config
* @param string $prefix prefix
* @return $this
*/
public function merge(Config $config, $prefix = null)
{
$this->addResources($config->getResources());
$this->addData($config->getData(), $prefix);
return $this;
}
示例14: getVar
/**
* Retrieve a specified configuration variable.
* @param $section string
* @param $key string
* @param $default string optional
* @return string
*/
function getVar($section, $key, $default = null)
{
$configData =& Config::getData();
return isset($configData[$section][$key]) ? $configData[$section][$key] : $default;
}
示例15: load
/**
* Load
*
* @param string $type
*
* @return boolean
*/
private function load($type)
{
$data = Config::getData($type);
foreach ($data as $values) {
foreach ($values as $key => $value) {
if ($value == 1) {
if ($type == 'plugin') {
$key = $key . '/' . $key;
}
$file = constant(strtoupper($type) . '_DIR') . $key . '.php';
if (!file_exists($file)) {
$file = APP_DIR . $type . '/' . $key . '.php';
if (strpos($key, '/') !== false && !file_exists($file)) {
$file = PLUGIN_DIR . str_replace('/', '/' . $type . '/', $key) . '.php';
}
}
if (file_exists($file)) {
include_once $file;
if ($type == 'module') {
$this->loadedModules[] = $key;
}
if ($type == 'library') {
$this->loadedLibraries[] = $key;
}
} else {
Clockwork::throwError('Could not load ' . $type . ' (' . $key . ')');
}
}
}
}
}