本文整理汇总了PHP中Application::getApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getApplication方法的具体用法?PHP Application::getApplication怎么用?PHP Application::getApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::getApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* @see Form::fetch()
* @param $request PKPRequest
* @param $params array
*/
function fetch($request, $params = null)
{
$site = $request->getSite();
$publicFileManager = new PublicFileManager();
$contextDao = Application::getContextDAO();
$contexts = $contextDao->getNames();
$siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
$cssSettingName = 'siteStyleSheet';
$imageSettingName = 'pageHeaderTitleImage';
// Get link actions.
$uploadCssLinkAction = $this->_getFileUploadLinkAction($cssSettingName, 'css', $request);
$uploadImageLinkAction = $this->_getFileUploadLinkAction($imageSettingName, 'image', $request);
// Get the files view.
$cssView = $this->renderFileView($cssSettingName, $request);
$imageView = $this->renderFileView($imageSettingName, $request);
$application = Application::getApplication();
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign(array('locale' => AppLocale::getLocale(), 'siteStyleFileExists' => file_exists($siteStyleFilename), 'uploadCssLinkAction' => $uploadCssLinkAction, 'uploadImageLinkAction' => $uploadImageLinkAction, 'cssView' => $cssView, 'imageView' => $imageView, 'redirectOptions' => $contexts, 'pageHeaderTitleImage' => $site->getSetting($imageSettingName), 'availableMetricTypes' => $application->getMetricTypes(true)));
$themePlugins = PluginRegistry::getPlugins('themes');
$enabledThemes = array();
$activeThemeOptions = array();
foreach ($themePlugins as $themePlugin) {
$enabledThemes[basename($themePlugin->getPluginPath())] = $themePlugin->getDisplayName();
if ($themePlugin->isActive()) {
$activeThemeOptions = $themePlugin->getOptionsConfig();
$activeThemeOptionsValues = $themePlugin->getOptionValues();
foreach ($activeThemeOptions as $name => $option) {
$activeThemeOptions[$name]['value'] = isset($activeThemeOptionsValues[$name]) ? $activeThemeOptionsValues[$name] : '';
}
}
}
$templateMgr->assign(array('enabledThemes' => $enabledThemes, 'activeThemeOptions' => $activeThemeOptions));
return parent::fetch($request);
}
示例2: fetch
/**
* Display the tabs index page.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function fetch($args, $request)
{
parent::fetch($args, $request);
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('selectedFormatId', $this->getSelectedFormatId());
$submission = $this->getSubmission();
// load in any publication formats assigned to this published monograph
$publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO');
$formats = $publicationFormatDao->getBySubmissionId($submission->getId());
$publicationFormats = array();
while ($publicationFormat = $formats->next()) {
$publicationFormats[] = $publicationFormat;
}
$templateMgr->assign_by_ref('publicationFormats', $publicationFormats);
$application = Application::getApplication();
$request = $application->getRequest();
$router = $request->getRouter();
$dispatcher = $router->getDispatcher();
// These two URLs are catalog/monograph specific.
$tabsUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'modals.submissionMetadata.CatalogEntryHandler', 'fetchFormatInfo', null, array('submissionId' => $submission->getId(), 'stageId' => $this->getStageId()));
$templateMgr->assign('tabsUrl', $tabsUrl);
$tabContentUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'tab.catalogEntry.CatalogEntryTabHandler', 'publicationMetadata', null, array('submissionId' => $submission->getId(), 'stageId' => $this->getStageId()));
$templateMgr->assign('tabContentUrl', $tabContentUrl);
return $templateMgr->fetchJson('controllers/modals/submissionMetadata/catalogEntryTabs.tpl');
}
示例3: fetch
/**
* @see Form::fetch()
* @param $request PKPRequest
* @param $params array
*/
function fetch($request, $params = null)
{
$site = $request->getSite();
$publicFileManager = new PublicFileManager();
$contextDao = Application::getContextDAO();
$contexts = $contextDao->getNames();
$siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
$cssSettingName = 'siteStyleSheet';
$imageSettingName = 'pageHeaderTitleImage';
// Get link actions.
$uploadCssLinkAction = $this->_getFileUploadLinkAction($cssSettingName, 'css', $request);
$uploadImageLinkAction = $this->_getFileUploadLinkAction($imageSettingName, 'image', $request);
// Get the files view.
$cssView = $this->renderFileView($cssSettingName, $request);
$imageView = $this->renderFileView($imageSettingName, $request);
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('locale', AppLocale::getLocale());
$templateMgr->assign('siteStyleFileExists', file_exists($siteStyleFilename));
$templateMgr->assign('uploadCssLinkAction', $uploadCssLinkAction);
$templateMgr->assign('uploadImageLinkAction', $uploadImageLinkAction);
$templateMgr->assign('cssView', $cssView);
$templateMgr->assign('imageView', $imageView);
$templateMgr->assign('redirectOptions', $contexts);
$templateMgr->assign('pageHeaderTitleImage', $site->getSetting($imageSettingName));
$application = Application::getApplication();
$templateMgr->assign('availableMetricTypes', $application->getMetricTypes(true));
$themePlugins = PluginRegistry::loadCategory('themes');
$themePluginOptions = array();
foreach ($themePlugins as $themePlugin) {
$themePluginOptions[basename($themePlugin->getPluginPath())] = $themePlugin->getDisplayName();
}
$templateMgr->assign('themePluginOptions', $themePluginOptions);
return parent::fetch($request);
}
示例4: register
/**
* @see LazyLoadPlugin::register()
*/
function register($category, $path)
{
$success = parent::register($category, $path);
HookRegistry::register('AcronPlugin::parseCronTab', array($this, 'callbackParseCronTab'));
if ($this->getEnabled() && $success) {
// Register callbacks.
HookRegistry::register('PluginRegistry::loadCategory', array($this, 'callbackLoadCategory'));
HookRegistry::register('LoadHandler', array($this, 'callbackLoadHandler'));
// If the plugin will provide the access logs,
// register to the usage event hook provider.
if ($this->getSetting(CONTEXT_ID_NONE, 'createLogFiles')) {
HookRegistry::register('UsageEventPlugin::getUsageEvent', array(&$this, 'logUsageEvent'));
}
$this->_dataPrivacyOn = $this->getSetting(CONTEXT_ID_NONE, 'dataPrivacyOption');
$this->_saltpath = $this->getSetting(CONTEXT_ID_NONE, 'saltFilepath');
// Check config for backward compatibility.
if (!$this->_saltpath) {
$this->_saltpath = Config::getVar('usageStats', 'salt_filepath');
}
$application = Application::getApplication();
$request = $application->getRequest();
$this->_optedOut = $request->getCookieVar('usageStats-opt-out');
if ($this->_optedOut) {
// Renew the Opt-Out cookie if present.
$request->setCookieVar('usageStats-opt-out', true, time() + 60 * 60 * 24 * 365);
}
}
return $success;
}
示例5: ifAdministrateurAccesApplication
/**
* Verification de l'accès d'un utilisateur à l'administration d'une application
* @param object PDO
*/
public static function ifAdministrateurAccesApplication($bdd)
{
$utilisateur = $_SESSION['utilisateur']['id'];
if (!in_array($utilisateur, explode(',', Application::getApplication($bdd)->applicationAdministrateur))) {
Tool::setFlash('Vous n\'avez pas accès à l\'administration cette application', 'erreur');
header('location:' . BASEFRONT . 'dashboard/dashboard.php');
die;
}
}
示例6: urlencode
/**
* Return information about the latest available version.
* @return array
*/
function &getLatestVersion()
{
$application =& Application::getApplication();
$includeId = Config::getVar('general', 'installed') && !defined('RUNNING_UPGRADE') && Config::getVar('general', 'enable_beacon', true);
if ($includeId) {
$pluginSettingsDao =& DAORegistry::getDAO('PluginSettingsDAO');
$uniqueSiteId = $pluginSettingsDao->getSetting(CONTEXT_SITE, 'UsageEventPlugin', 'uniqueSiteId');
} else {
$uniqueSiteId = null;
}
$request =& $application->getRequest();
$returner =& VersionCheck::parseVersionXML($application->getVersionDescriptorUrl() . ($includeId ? '?id=' . urlencode($uniqueSiteId) . '&oai=' . urlencode($request->url('index', 'oai')) : ''));
return $returner;
}
示例7: register
/**
* @see LazyLoadPlugin::register()
*/
function register($category, $path)
{
$success = parent::register($category, $path);
if (!Config::getVar('general', 'installed')) {
return false;
}
$application =& Application::getApplication();
$request =& $application->getRequest();
$router =& $request->getRouter();
$context = $router->getContext($request);
if ($success && $context) {
$this->_apiKey = $this->getSetting($context->getId(), 'apiKey');
HookRegistry::register('TemplateManager::display', array(&$this, 'templateManagerCallback'));
HookRegistry::register('Templates::Article::MoreInfo', array(&$this, 'articleMoreInfoCallback'));
HookRegistry::register('AcronPlugin::parseCronTab', array(&$this, 'callbackParseCronTab'));
}
return $success;
}
示例8: replaceCodeVars
/**
* Replace various variables in the code template with data
* relevant to the assigned article.
* @param PublishedArticle $publishedArticle
*/
function replaceCodeVars($publishedArticle = null)
{
$application = Application::getApplication();
$request = $application->getRequest();
$router = $request->getRouter();
$context = $request->getContext();
$code = $this->getCode();
$codeVariables = array('journalUrl' => $router->url($request, null, 'index'), 'journalName' => $context->getLocalizedName());
if (isset($publishedArticle)) {
$codeVariables = array_merge($codeVariables, array('articleUrl' => $router->url($request, null, 'article', 'view', $publishedArticle->getId()), 'articleTitle' => $publishedArticle->getLocalizedTitle()));
}
// Replace variables in message with values
foreach ($codeVariables as $key => $value) {
if (!is_object($value)) {
$code = str_replace('{$' . $key . '}', $value, $code);
}
}
$this->setCode($code);
}
示例9: fetch
/**
* Display the tabs index page.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function fetch($args, $request)
{
parent::fetch($args, $request);
$templateMgr = TemplateManager::getManager($request);
$submission = $this->getSubmission();
// load in any galley formats assigned to this published article
$galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalleys = $galleyDao->getBySubmissionId($submission->getId());
$templateMgr->assign('galleys', $articleGalleys->toArray());
$application = Application::getApplication();
$request = $application->getRequest();
$router = $request->getRouter();
$dispatcher = $router->getDispatcher();
$tabsUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'modals.submissionMetadata.IssueEntryHandler', 'fetchFormatInfo', null, array('submissionId' => $submission->getId(), 'stageId' => $this->getStageId()));
$templateMgr->assign('tabsUrl', $tabsUrl);
$tabContentUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'tab.issueEntry.IssueEntryTabHandler', 'galleyMetadata', null, array('submissionId' => $submission->getId(), 'stageId' => $this->getStageId()));
$templateMgr->assign('tabContentUrl', $tabContentUrl);
return $templateMgr->fetchJson('controllers/modals/submissionMetadata/issueEntryTabs.tpl');
}
示例10: replaceCodeVars
/**
* Replace various variables in the code template with data
* relevant to the assigned monograph.
* @param PublishedMonograph $publishedMonograph
*/
function replaceCodeVars($publishedMonograph = null)
{
$application = Application::getApplication();
$request = $application->getRequest();
$router = $request->getRouter();
$context = $request->getContext();
$code = $this->getCode();
$codeVariables = array('contextUrl' => $router->url($request, null, 'index'), 'pressName' => $context->getLocalizedName());
if (isset($publishedMonograph)) {
$codeVariables = array_merge($codeVariables, array('bookCatalogUrl' => $router->url($request, null, 'catalog', 'book', $publishedMonograph->getId()), 'bookTitle' => $publishedMonograph->getLocalizedTitle()));
}
// Replace variables in message with values
foreach ($codeVariables as $key => $value) {
if (!is_object($value)) {
$code = str_replace('{$' . $key . '}', $value, $code);
}
}
$this->setCode($code);
}
示例11: buildUsageEvent
/**
* Build an usage event.
* @param $hookName string
* @param $args array
* @return array
*/
protected function buildUsageEvent($hookName, $args)
{
// Finished downloading a file?
if ($hookName == 'FileManager::downloadFileFinished') {
// The usage event for this request is already build and
// passed to any other registered hook.
return null;
}
$application = Application::getApplication();
$request = $application->getRequest();
$router = $request->getRouter();
/* @var $router PageRouter */
$templateMgr = $args[0];
/* @var $templateMgr TemplateManager */
// We are just interested in page requests.
if (!is_a($router, 'PageRouter')) {
return false;
}
// Check whether we are in journal context.
$context = $router->getContext($request);
if (!$context) {
return false;
}
// Prepare request information.
list($pubObject, $downloadSuccess, $assocType, $idParams, $canonicalUrlPage, $canonicalUrlOp, $canonicalUrlParams) = $this->getUsageEventData($hookName, $args, $request, $router, $templateMgr, $context);
if (!$pubObject) {
return false;
}
// Timestamp.
$time = Core::getCurrentDate();
// Actual document size, MIME type.
$htmlPageAssocTypes = $this->getHtmlPageAssocTypes();
if (in_array($assocType, $htmlPageAssocTypes)) {
// HTML pages with no file downloads.
$docSize = 0;
$mimeType = 'text/html';
} else {
// Files.
$docSize = (int) $pubObject->getFileSize();
$mimeType = $pubObject->getFileType();
}
$canonicalUrl = $router->url($request, null, $canonicalUrlPage, $canonicalUrlOp, $canonicalUrlParams);
// Public identifiers.
// 1) A unique system internal ID that will help us to easily attribute
// statistics to a specific publication object.
array_unshift($idParams, 'c' . $context->getId());
$siteId = $this->getUniqueSiteId();
if (empty($siteId)) {
// Create a globally unique, persistent site ID
// so that we can uniquely identify publication
// objects from this site, even if the URL or any
// other externally influenced information changes.
$siteId = uniqid();
$this->updateSetting(0, 'uniqueSiteId', $siteId);
}
array_unshift($idParams, $siteId);
$applicationName = $application->getName();
$applicationId = $applicationName . ':' . implode('-', $idParams);
$idKey = 'other::' . $applicationName;
$identifiers = array($idKey => $applicationId);
// 2) Standardized public identifiers, e.g. DOI, URN, etc.
if ($this->isPubIdObjectType($pubObject)) {
$pubIdPlugins = PluginRegistry::loadCategory('pubIds', true, $context->getId());
if (is_array($pubIdPlugins)) {
foreach ($pubIdPlugins as $pubIdPlugin) {
if (!$pubIdPlugin->getEnabled()) {
continue;
}
$pubId = $pubIdPlugin->getPubId($pubObject);
if ($pubId) {
$identifiers[$pubIdPlugin->getPubIdType()] = $pubId;
}
}
}
}
// Service URI.
$serviceUri = $router->url($request, $context->getPath());
// IP and Host.
$ip = $request->getRemoteAddr();
$host = null;
if (isset($_SERVER['REMOTE_HOST'])) {
// We do NOT actively look up the remote host to
// avoid the performance penalty. We only set the remote
// host if we get it "for free".
$host = $_SERVER['REMOTE_HOST'];
}
// HTTP user agent.
$userAgent = $request->getUserAgent();
// HTTP referrer.
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
// User and roles.
$user = $request->getUser();
$roles = array();
if ($user) {
//.........这里部分代码省略.........
示例12: array
<?php
/*
* AWS stuff.
*/
$application = Application::getApplication(null, null, false, true);
return array('includes' => array('_aws'), 'services' => array('default_settings' => array('params' => array('key' => @$application->setting->filter(function ($model) {
return $model->name === 's3 access key';
})->first()->value, 'secret' => @$application->setting->filter(function ($model) {
return $model->name === 's3 secret';
})->first()->value, 'region' => @$application->setting->filter(function ($model) {
return $model->name === 's3 region';
})->first()->value))));
示例13: statistics
/**
* Display the statistics area.
* @param $args array
* @param $request PKPRequest
*/
function statistics($args, $request)
{
$this->setupTemplate($request);
$context = $request->getContext();
$templateMgr = TemplateManager::getManager($request);
$application = Application::getApplication();
$templateMgr->assign('appSettings', $this->hasAppStatsSettings());
$templateMgr->assign('contextObjectName', __($application->getNameKey()));
$reportPlugins = PluginRegistry::loadCategory('reports');
$templateMgr->assign_by_ref('reportPlugins', $reportPlugins);
$templateMgr->assign('defaultMetricType', $context->getSetting('defaultMetricType'));
$availableMetricTypes = $context->getMetricTypes(true);
$templateMgr->assign('availableMetricTypes', $availableMetricTypes);
if (count($availableMetricTypes) > 1) {
$templateMgr->assign('showMetricTypeSelector', true);
}
$templateMgr->display('management/tools/statistics.tpl');
}
示例14: insertEntry
/**
* @copydoc ListbuilderHandler::insertEntry()
*/
function insertEntry($request, $newRowId)
{
$userDao = DAORegistry::getDAO('UserDAO');
$application = Application::getApplication();
$request = $application->getRequest();
// need to do this because the method version is null.
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($this->_submissionId);
$this->setData('userIds', array_merge($this->getData('userIds'), $newRowId));
}
示例15: insertEntry
/**
* @copydoc ListbuilderHandler::insertEntry()
*/
function insertEntry($request, $newRowId)
{
$userDao = DAORegistry::getDAO('UserDAO');
$application = Application::getApplication();
$request = $application->getRequest();
// need to do this because the method version is null.
$submissionDao = Application::getSubmissionDAO();
$submission = $submissionDao->getById($this->_submissionId);
foreach ($newRowId as $id) {
$this->sendMessage($id, $submission, $request);
}
}