本文整理汇总了PHP中Config::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getVar方法的具体用法?PHP Config::getVar怎么用?PHP Config::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::getVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setApprovalNoticeId
/**
* Set the ID of the approval notice.
* @param $approvalNoticeId int
*/
function setApprovalNoticeId($approvalNoticeId)
{
if (Config::getVar('debug', 'deprecation_warnings')) {
trigger_error('Deprecated function.');
}
return $this->setId($approvalNoticeId);
}
示例2: testDOIAndURN
/**
* SCENARIO OUTLINE: Export article in DC format over OAI
* GIVEN a DOI and a URN have been assigned for a given {publishing object}
* WHEN I export the corresponding article in DC format over OAI
* THEN DOI and URN specific {DC fields} will be present in the OAI-message.
*
* EXAMPLES:
* publishing object | DC fields
* ==================|================================================
* issue | <dc:source>10.4321/t.v1i1</dc:source>
* issue | <dc:source>urn:nbn:de:0000-t.v1i19</dc:source>
* article | <dc:identifier>10.4321/t.v1i1.1</dc:identifier>
* article | <dc:identifier>urn:nbn:de:0000-t.v1i1.18</dc:identifier>
* galley | <dc:relation>10.4321/t.v1i1.g1</dc:relation>
* galley | <dc:relation>urn:nbn:de:0000-t.v1i1.1.g17</dc:relation>
* supp-file | <dc:relation>10.4321/t.v1i1.s1</dc:relation>
* supp-file | <dc:relation>urn:nbn:de:0000-t.v1i1.1.s19</dc:relation>
*/
public function testDOIAndURN()
{
// Configure the web service request
$params = array('verb' => 'GetRecord', 'metadataPrefix' => 'oai_dc', 'identifier' => 'oai:' . Config::getVar('oai', 'repository_id') . ':article/1');
$this->webServiceRequest->setParams($params);
// Check DOI node with XPath.
$namespaces = array('oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'dc' => 'http://purl.org/dc/elements/1.1/');
$domXPath = $this->getXPath($namespaces);
$testCases = array('/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:source' => array('urn:nbn:de:0000-t.v1i19', '10.1234/t.v1i1'), '/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:identifier' => array('urn:nbn:de:0000-t.v1i1.18', '10.1234/t.v1i1.1'), '/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:relation' => array('urn:nbn:de:0000-t.v1i1.1.g17', 'urn:nbn:de:0000-t.v1i1.1.s19', '10.1234/t.v1i1.1.g1', '10.1234/t.v1i1.1.s1'));
foreach ($testCases as $xPath => $expectedDoiList) {
$nodeList = $domXPath->query($xPath);
self::assertGreaterThan(1, $nodeList->length, "Error while checking {$xPath}: No nodes found.");
foreach ($expectedDoiList as $expectedDoi) {
for ($index = 1; $index <= $nodeList->length; $index++) {
$node = $nodeList->item($index - 1);
// self::assertType() has been removed from PHPUnit 3.6
// but self::assertInstanceOf() is not present in PHPUnit 3.4
// which is our current test server version.
// FIXME: change this to assertInstanceOf() after upgrading the
// test server.
self::assertTrue(is_a($node, 'DOMNode'));
if ($node->textContent == $expectedDoi) {
break;
}
}
if ($index > $nodeList->length) {
self::fail("Error while checking {$xPath}: Node with {$expectedDoi} not found.");
}
}
}
}
示例3: setSuppFileId
/**
* Set ID of supplementary file.
* @param $suppFileId int
*/
function setSuppFileId($suppFileId)
{
if (Config::getVar('debug', 'deprecation_warnings')) {
trigger_error('Deprecated function.');
}
return $this->setId($suppFileId);
}
示例4: getEnabled
/**
* Determine whether the plugin is enabled. Overrides parent so that
* the plugin will be displayed during install.
*/
function getEnabled()
{
if (!Config::getVar('general', 'installed')) {
return true;
}
return parent::getEnabled();
}
示例5: setAccessKeyId
/**
* Set the ID of the access key.
* @param $accessKeyId int
*/
function setAccessKeyId($accessKeyId)
{
if (Config::getVar('debug', 'deprecation_warnings')) {
trigger_error('Deprecated function.');
}
return $this->setId($accessKeyId);
}
示例6: export
/**
* Export the locale files to the browser as a tarball.
* Requires tar for operation (configured in config.inc.php).
*/
function export($locale)
{
// Construct the tar command
$tarBinary = Config::getVar('cli', 'tar');
if (empty($tarBinary) || !file_exists($tarBinary)) {
// We can use fatalError() here as we already have a user
// friendly way of dealing with the missing tar on the
// index page.
fatalError('The tar binary must be configured in config.inc.php\'s cli section to use the export function of this plugin!');
}
$command = $tarBinary . ' cz';
$localeFilesList = TranslatorAction::getLocaleFiles($locale);
$localeFilesList = array_merge($localeFilesList, TranslatorAction::getMiscLocaleFiles($locale));
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
$localeFilesList[] = $emailTemplateDao->getMainEmailTemplateDataFilename($locale);
foreach (array_values(TranslatorAction::getEmailFileMap($locale)) as $emailFile) {
}
// Include locale files (main file and plugin files)
foreach ($localeFilesList as $file) {
if (file_exists($file)) {
$command .= ' ' . escapeshellarg($file);
}
}
header('Content-Type: application/x-gtar');
header("Content-Disposition: attachment; filename=\"{$locale}.tar.gz\"");
header('Cache-Control: private');
// Workarounds for IE weirdness
passthru($command);
}
示例7: _assignTemplateCounterXML
/**
* Internal function to assign information for the Counter part of a report
*/
function _assignTemplateCounterXML($templateManager, $begin, $end = '')
{
$journal =& Request::getJournal();
$counterReportDao =& DAORegistry::getDAO('CounterReportDAO');
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journalIds = $counterReportDao->getJournalIds();
if ($end == '') {
$end = $begin;
}
$i = 0;
foreach ($journalIds as $journalId) {
$journal =& $journalDao->getById($journalId);
if (!$journal) {
continue;
}
$entries = $counterReportDao->getMonthlyLogRange($journalId, $begin, $end);
$journalsArray[$i]['entries'] = $this->_arrangeEntries($entries, $begin, $end);
$journalsArray[$i]['journalTitle'] = $journal->getLocalizedTitle();
$journalsArray[$i]['publisherInstitution'] = $journal->getSetting('publisherInstitution');
$journalsArray[$i]['printIssn'] = $journal->getSetting('printIssn');
$journalsArray[$i]['onlineIssn'] = $journal->getSetting('onlineIssn');
$i++;
}
$siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
$siteTitle = $siteSettingsDao->getSetting('title', AppLocale::getLocale());
$base_url =& Config::getVar('general', 'base_url');
$reqUser =& Request::getUser();
$templateManager->assign_by_ref('reqUser', $reqUser);
$templateManager->assign_by_ref('journalsArray', $journalsArray);
$templateManager->assign('siteTitle', $siteTitle);
$templateManager->assign('base_url', $base_url);
}
示例8: assert
/**
* Call a web service
* @param $webServiceRequest WebServiceRequest
* @return string the result of the web service or null in case of an error.
*/
function &call(&$webServiceRequest)
{
assert(is_a($webServiceRequest, 'WebServiceRequest'));
switch ($webServiceRequest->getMethod()) {
case 'POST':
$result = $this->_callPostWebService($webServiceRequest);
break;
case 'GET':
$result = $this->_callGetWebService($webServiceRequest);
break;
default:
// We currently only support GET and POST requests
assert(false);
}
// Catch web service errors
$nullVar = null;
if (!$result) {
return $nullVar;
}
// Clean the result
$result = stripslashes($result);
if (Config::getVar('i18n', 'charset_normalization') == 'On' && !String::utf8_compliant($result)) {
$result = String::utf8_normalize($result);
}
return $result;
}
示例9: setRegistrationId
/**
* Set the ID of the registration.
* @param $registrationId int
*/
function setRegistrationId($registrationId)
{
if (Config::getVar('debug', 'deprecation_warnings')) {
trigger_error('Deprecated function.');
}
return $this->setId($registrationId);
}
示例10: index
/**
* Display conference management index page.
*/
function index($args, &$request)
{
// Manager requests should come to the Conference context, not Sched Conf
if ($request->getRequestedSchedConfPath() != 'index') {
$request->redirect(null, 'index', 'manager');
}
$this->validate();
$this->setupTemplate($request);
$conference =& $request->getConference();
$templateMgr =& TemplateManager::getManager($request);
// Display a warning message if there is a new version of OJS available
$newVersionAvailable = false;
if (Config::getVar('general', 'show_upgrade_warning')) {
import('lib.pkp.classes.site.VersionCheck');
if ($latestVersion = VersionCheck::checkIfNewVersionExists()) {
$newVersionAvailable = true;
$templateMgr->assign('latestVersion', $latestVersion);
$currentVersion =& VersionCheck::getCurrentDBVersion();
$templateMgr->assign('currentVersion', $currentVersion->getVersionString());
// Get contact information for site administrator
$roleDao = DAORegistry::getDAO('RoleDAO');
$siteAdmins =& $roleDao->getUsersByRoleId(ROLE_ID_SITE_ADMIN);
$templateMgr->assign_by_ref('siteAdmin', $siteAdmins->next());
}
}
$templateMgr->assign('newVersionAvailable', $newVersionAvailable);
$schedConfDao = DAORegistry::getDAO('SchedConfDAO');
$schedConfs = $schedConfDao->getAll(false, $conference->getId());
$templateMgr->assign_by_ref('schedConfs', $schedConfs);
$templateMgr->assign('announcementsEnabled', $conference->getSetting('enableAnnouncements'));
$templateMgr->assign('helpTopicId', 'conference.index');
$templateMgr->display(ROLE_PATH_MANAGER . '/index.tpl');
}
示例11: UserRegistrationForm
/**
* Constructor
* @param $typeId int Registration type to use
*/
function UserRegistrationForm($typeId)
{
$schedConf =& Request::getSchedConf();
$this->typeId = (int) $typeId;
parent::Form('registration/userRegistrationForm.tpl');
$this->addCheck(new FormValidatorCustom($this, 'registrationTypeId', 'required', 'manager.registration.form.typeIdValid', create_function('$registrationTypeId, $schedConfId, $typeId', '$registrationTypeDao =& DAORegistry::getDAO(\'RegistrationTypeDAO\'); return $registrationTypeDao->openRegistrationTypeExistsByTypeId($typeId, $schedConfId);'), array($schedConf->getId(), $typeId)));
import('captcha.CaptchaManager');
$captchaManager = new CaptchaManager();
$this->captchaEnabled = $captchaManager->isEnabled() && Config::getVar('captcha', 'captcha_on_register') ? true : false;
$user =& Request::getUser();
if (!$user) {
$site =& Request::getSite();
$this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired'));
$this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired'));
$this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.account.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array(), true));
$this->addCheck(new FormValidatorAlphaNum($this, 'username', 'required', 'user.account.form.usernameAlphaNumeric'));
$this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.account.form.passwordLengthTooShort', '>=', $site->getMinPasswordLength()));
$this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.account.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this)));
$this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired'));
$this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired'));
$this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired'));
$this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.account.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array(), true));
if ($this->captchaEnabled) {
$this->addCheck(new FormValidatorCaptcha($this, 'captcha', 'captchaId', 'common.captchaField.badCaptcha'));
}
$authDao =& DAORegistry::getDAO('AuthSourceDAO');
$this->defaultAuth =& $authDao->getDefaultPlugin();
if (isset($this->defaultAuth)) {
$this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.account.form.usernameExists', create_function('$username,$form,$auth', 'return (!$auth->userExists($username) || $auth->authenticate($username, $form->getData(\'password\')));'), array(&$this, $this->defaultAuth)));
}
}
$this->addCheck(new FormValidatorPost($this));
}
示例12: initData
/**
* Initialize form data from the associated author.
* @param $args array
* @param $request PKPRequest
*/
function initData($args, $request)
{
$userDao = DAORegistry::getDAO('UserDAO');
$user = $request->getUser();
$context = $request->getContext();
$signoff = $this->getSignoff();
$auditorId = $signoff->getUserId();
$auditor = $userDao->getById($auditorId);
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($this->getSubmissionId());
$email = $this->_getMailTemplate($submission);
// Format the review due date
$signoffDueDate = strtotime($signoff->getDateUnderway());
$dateFormatShort = Config::getVar('general', 'date_format_short');
if ($signoffDueDate == -1) {
$signoffDueDate = $dateFormatShort;
} else {
$signoffDueDate = strftime($dateFormatShort, $signoffDueDate);
}
import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $auditor->getId());
$dispatcher = $request->getDispatcher();
$auditUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('submissionId' => $submission->getId()));
$paramArray = array('reviewerName' => $auditor->getFullName(), 'reviewDueDate' => $signoffDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'auditorUserName' => $auditor->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $auditor->getUsername(), array('confirm' => Validation::generatePasswordResetHash($auditor->getId()))), 'submissionReviewUrl' => $auditUrl, 'contextName' => $context->getLocalizedName(), 'submissionTitle' => $submission->getLocalizedTitle());
$email->assignParams($paramArray);
$this->setData('submissionId', $submission->getId());
$this->setData('stageId', $this->getStageId());
$this->setData('signoffId', $signoff->getId());
$this->setData('signoff', $signoff);
$this->setData('auditorName', $auditor->getFullName());
$this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature'));
}
示例13: display
/**
* Display the form.
*/
function display(&$args)
{
$meetingId = isset($args[0]) ? $args[0] : 0;
$journal =& Request::getJournal();
$journalId = $journal->getId();
$user =& Request::getUser();
$sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
$sort = Request::getUserVar('sort');
$sort = isset($sort) ? $sort : 'id';
$sortDirection = Request::getUserVar('sortDirection');
$availableSectionDecisions =& $sectionDecisionDao->getSectionDecisionsAvailableForMeeting($user->getSecretaryCommitteeId(), $journalId, $sort, $sortDirection);
/*Get the selected submissions to be reviewed*/
$meetingDao =& DAORegistry::getDAO('MeetingDAO');
$meeting =& $meetingDao->getMeetingById($meetingId);
/*Get the selected submissions to be reviewed*/
$meetingSectionDecisionDao =& DAORegistry::getDAO('MeetingSectionDecisionDAO');
$mSectionDecisions = $meetingSectionDecisionDao->getMeetingSectionDecisionsByMeetingId($meetingId);
$sectionDecisionsId = array();
foreach ($mSectionDecisions as $mSectionDecision) {
array_push($sectionDecisionsId, $mSectionDecision->getSectionDecisionId());
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('sort', $sort);
$templateMgr->assign('sortDirection', $sortDirection);
$templateMgr->assign('meetingId', $meetingId);
$templateMgr->assign('meetingDate', $meeting->getDate());
$templateMgr->assign('meetingLength', $meeting->getLength());
$templateMgr->assign('location', $meeting->getLocation());
$templateMgr->assign('investigator', $meeting->getInvestigator());
$templateMgr->assign_by_ref('availableSectionDecisions', $availableSectionDecisions);
$templateMgr->assign_by_ref('sectionDecisionsId', $sectionDecisionsId);
$templateMgr->assign('baseUrl', Config::getVar('general', "base_url"));
parent::display();
}
示例14: handleRequest
/**
* Handle a new request.
*/
function handleRequest()
{
if (!Config::getVar('general', 'installed') && pageRequiresInstall()) {
// Redirect to installer if application has not been installed
Request::redirect(null, 'install');
}
// Determine the handler for this request
$page = Request::getRequestedPage();
$op = Request::getRequestedOp();
$sourceFile = sprintf('pages/%s/index.php', $page);
// If a hook has been registered to handle this page, give it the
// opportunity to load required resources and set HANDLER_CLASS.
if (!HookRegistry::call('LoadHandler', array(&$page, &$op, &$sourceFile))) {
if (file_exists($sourceFile)) {
require $sourceFile;
} else {
require 'pages/index/index.php';
}
}
if (!defined('SESSION_DISABLE_INIT')) {
// Initialize session
$sessionManager =& SessionManager::getManager();
$session =& $sessionManager->getUserSession();
}
$methods = array_map('strtolower', get_class_methods(HANDLER_CLASS));
if (in_array(strtolower($op), $methods)) {
// Call a specific operation
call_user_func(array(HANDLER_CLASS, $op), Request::getRequestedArgs());
} else {
// Call the selected handler's index operation
call_user_func(array(HANDLER_CLASS, 'index'), Request::getRequestedArgs());
}
}
示例15: getCache
/**
* Get a cache.
* @param $context string
* @param $cacheId string
* @param $fallback callback
* @param $type string Type of cache: CACHE_TYPE_...
* @return object Cache
*/
function getCache($context, $cacheId, $fallback, $type = CACHE_TYPE_FILE)
{
switch ($this->getCacheImplementation($type)) {
case 'xcache':
import('lib.pkp.classes.cache.XCacheCache');
$cache = new XCacheCache($context, $cacheId, $fallback);
break;
case 'apc':
import('lib.pkp.classes.cache.APCCache');
$cache = new APCCache($context, $cacheId, $fallback);
break;
case 'memcache':
import('lib.pkp.classes.cache.MemcacheCache');
$cache = new MemcacheCache($context, $cacheId, $fallback, Config::getVar('cache', 'memcache_hostname'), Config::getVar('cache', 'memcache_port'));
break;
case '':
// Provide a default if not specified
// Provide a default if not specified
case 'file':
$cache = $this->getFileCache($context, $cacheId, $fallback);
break;
case 'none':
import('lib.pkp.classes.cache.GenericCache');
$cache = new GenericCache($context, $cacheId, $fallback);
break;
default:
die("Unknown cache type \"{$type}\"!\n");
break;
}
return $cache;
}