当前位置: 首页>>代码示例>>PHP>>正文


PHP PKPApplication::getRequest方法代码示例

本文整理汇总了PHP中PKPApplication::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP PKPApplication::getRequest方法的具体用法?PHP PKPApplication::getRequest怎么用?PHP PKPApplication::getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PKPApplication的用法示例。


在下文中一共展示了PKPApplication::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: callbackTemplateArticlePageFooter

 /**
  * @see templates/article/footer.tpl
  */
 function callbackTemplateArticlePageFooter($hookName, $params)
 {
     $smarty =& $params[1];
     $output =& $params[2];
     // Identify similarity terms for the given article.
     $displayedArticle = $smarty->get_template_vars('article');
     $articleId = $displayedArticle->getId();
     import('classes.search.ArticleSearch');
     $articleSearch = new ArticleSearch();
     $searchTerms = $articleSearch->getSimilarityTerms($articleId);
     if (empty($searchTerms)) {
         return false;
     }
     // If we got similarity terms then execute a search with...
     // ... request, journal and error messages, ...
     $request = PKPApplication::getRequest();
     $router = $request->getRouter();
     $journal = $router->getContext($request);
     $error = null;
     // ... search keywords ...
     $query = implode(' ', $searchTerms);
     $keywords = array(null => $query);
     // ... and pagination.
     $rangeInfo = Handler::getRangeInfo($request, 'articlesBySimilarity');
     $rangeInfo->setCount(RECOMMEND_BY_SIMILARITY_PLUGIN_COUNT);
     $results = $articleSearch->retrieveResults($request, $journal, $keywords, $error, null, null, $rangeInfo, array($articleId));
     $smarty->assign('articlesBySimilarity', $results);
     $smarty->assign('articlesBySimilarityQuery', $query);
     $output .= $smarty->fetch($this->getTemplatePath() . 'articleFooter.tpl');
     return false;
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:34,代码来源:RecommendBySimilarityPlugin.inc.php

示例2: isConfigured

 /**
  * Check if there is a payment plugin and if is configured
  * @return bool
  */
 function isConfigured()
 {
     $paymentPlugin =& $this->getPaymentPlugin();
     if ($paymentPlugin !== null) {
         return $paymentPlugin->isConfigured(PKPApplication::getRequest());
     }
     return false;
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:12,代码来源:PaymentManager.inc.php

示例3: register

 function register($category, $path)
 {
     $success = parent::register($category, $path);
     $this->addLocaleData();
     $request =& PKPApplication::getRequest();
     $templateMgr =& TemplateManager::getManager($request);
     $templateMgr->register_modifier('bibtex_escape', array(&$this, 'bibtexEscape'));
     return $success;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:9,代码来源:BibtexCitationPlugin.inc.php

示例4: readInputData

 /**
  * @see Form::readInputData()
  */
 function readInputData()
 {
     $this->readUserVars($this->_getFormFields());
     $request = PKPApplication::getRequest();
     $password = $request->getUserVar('password');
     if ($password === LUCENE_PLUGIN_PASSWORD_PLACEHOLDER) {
         $plugin =& $this->_plugin;
         $password = $plugin->getSetting(0, 'password');
     }
     $this->setData('password', $password);
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:14,代码来源:LuceneSettingsForm.inc.php

示例5: readInputData

 /**
  * @see Form::readInputData()
  */
 function readInputData()
 {
     $this->readUserVars(array('dvnUri', 'username', 'password'));
     $request =& PKPApplication::getRequest();
     $password = $request->getUserVar('password');
     if ($password === DATAVERSE_PLUGIN_PASSWORD_SLUG) {
         $plugin =& $this->_plugin;
         $password = $plugin->getSetting($this->_journalId, 'password');
     }
     $this->setData('password', $password);
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:14,代码来源:DataverseAuthForm.inc.php

示例6: readInputData

 /**
  * @see Form::readInputData()
  */
 function readInputData()
 {
     $this->readUserVars(array('dvnUri', 'username', 'password'));
     $request =& PKPApplication::getRequest();
     $password = $request->getUserVar('password');
     if ($password === DATAVERSE_PLUGIN_PASSWORD_SLUG) {
         $plugin =& $this->_plugin;
         $password = $plugin->getSetting($this->_journalId, 'password');
     }
     if (!$password) {
         // Password not required when API token provided, but SWORDAPPClient
         // requires a non-null password.
         $password = DATAVERSE_PLUGIN_PASSWORD_SLUG;
     }
     $this->setData('password', $password);
     $this->setData('dvnUri', preg_replace("/\\/+\$/", '', $this->getData('dvnUri')));
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:20,代码来源:DataverseAuthForm.inc.php

示例7: _attachEntities

 /**
  * Attach any dependent entities to a new file upload.
  * @param $submissionFile SubmissionFile
  */
 protected function _attachEntities($submissionFile)
 {
     switch ($submissionFile->getFileStage()) {
         case SUBMISSION_FILE_REVIEW_FILE:
         case SUBMISSION_FILE_REVIEW_ATTACHMENT:
         case SUBMISSION_FILE_REVIEW_REVISION:
             // Add the uploaded review file to the review round.
             $reviewRound = $this->getReviewRound();
             $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
             $submissionFileDao->assignRevisionToReviewRound($submissionFile->getFileId(), $submissionFile->getRevision(), $reviewRound);
             if ($submissionFile->getFileStage() == SUBMISSION_FILE_REVIEW_REVISION) {
                 // Get a list of author user IDs
                 $authorUserIds = array();
                 $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
                 $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($reviewRound->getSubmissionId(), ROLE_ID_AUTHOR);
                 while ($assignment = $submitterAssignments->next()) {
                     $authorUserIds[] = $assignment->getUserId();
                 }
                 // Update the notifications
                 $notificationMgr = new NotificationManager();
                 $notificationMgr->updateNotification(PKPApplication::getRequest(), array(NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS, NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS), $authorUserIds, ASSOC_TYPE_SUBMISSION, $reviewRound->getSubmissionId());
                 $notificationMgr->updateNotification(PKPApplication::getRequest(), array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId());
             }
             break;
     }
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:30,代码来源:PKPFileUploadWizardHandler.inc.php

示例8: _informTechAdmin

 /**
  * Send an email to the site's tech admin
  * warning that an indexing error has occured.
  *
  * @param $error array An array of article ids.
  * @param $journal Journal A journal object.
  * @param $isSearchProblem boolean Whether a search problem
  *  is being reported.
  */
 function _informTechAdmin($error, $journal = null, $isSearchProblem = false)
 {
     if (!$this->_spamCheck()) {
         return;
     }
     // Is this a search or an indexing problem?
     if ($isSearchProblem) {
         $mail =& $this->getMailTemplate('LUCENE_SEARCH_SERVICE_ERROR_NOTIFICATION', $journal);
     } else {
         // Check whether this is journal or article index update problem.
         if (is_a($journal, 'Journal')) {
             // This must be a journal indexing problem.
             $mail =& $this->getMailTemplate('LUCENE_JOURNAL_INDEXING_ERROR_NOTIFICATION', $journal);
         } else {
             // Instantiate an article mail template.
             $mail =& $this->getMailTemplate('LUCENE_ARTICLE_INDEXING_ERROR_NOTIFICATION');
         }
     }
     // Assign parameters.
     $request =& PKPApplication::getRequest();
     $site =& $request->getSite();
     $mail->assignParams(array('siteName' => $site->getLocalizedTitle(), 'error' => $error));
     // Send to the site's tech contact.
     $mail->addRecipient($site->getLocalizedContactEmail(), $site->getLocalizedContactName());
     // Send the mail.
     $mail->send($request);
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:36,代码来源:LucenePlugin.inc.php

示例9: _addArticleXml

 /**
  * Add the metadata XML of a single article to an
  * XML article list.
  *
  * @param $articleDoc DOMDocument
  * @param $article PublishedArticle
  * @param $journal Journal
  * @param $markToDelete boolean If true the returned XML
  *  will only contain a deletion marker.
  */
 function _addArticleXml(&$articleDoc, &$article, &$journal, $markToDelete = false)
 {
     assert(is_a($article, 'Article'));
     // Get the root node of the list.
     assert(is_a($articleDoc, 'DOMDocument'));
     $articleList =& $articleDoc->documentElement;
     // Create a new article node.
     $articleNode =& XMLCustomWriter::createElement($articleDoc, 'article');
     // Add ID information.
     XMLCustomWriter::setAttribute($articleNode, 'id', $article->getId());
     XMLCustomWriter::setAttribute($articleNode, 'sectionId', $article->getSectionId());
     XMLCustomWriter::setAttribute($articleNode, 'journalId', $article->getJournalId());
     XMLCustomWriter::setAttribute($articleNode, 'instId', $this->_instId);
     // Set the load action.
     $loadAction = $markToDelete ? 'delete' : 'replace';
     XMLCustomWriter::setAttribute($articleNode, 'loadAction', $loadAction);
     XMLCustomWriter::appendChild($articleList, $articleNode);
     // The XML for an article marked to be deleted contains no metadata.
     if ($markToDelete) {
         return;
     }
     assert(is_a($article, 'PublishedArticle'));
     // Add authors.
     $authors = $article->getAuthors();
     if (!empty($authors)) {
         $authorList =& XMLCustomWriter::createElement($articleDoc, 'authorList');
         foreach ($authors as $author) {
             /* @var $author Author */
             XMLCustomWriter::createChildWithText($articleDoc, $authorList, 'author', $author->getFullName(true));
         }
         XMLCustomWriter::appendChild($articleNode, $authorList);
     }
     // We need the request to retrieve locales and build URLs.
     $request = PKPApplication::getRequest();
     // Get all supported locales.
     $site = $request->getSite();
     $supportedLocales = $site->getSupportedLocales() + array_keys($journal->getSupportedLocaleNames());
     assert(!empty($supportedLocales));
     // Add titles.
     $titleList =& XMLCustomWriter::createElement($articleDoc, 'titleList');
     // Titles are used for sorting, we therefore need
     // them in all supported locales.
     assert(!empty($supportedLocales));
     foreach ($supportedLocales as $locale) {
         $localizedTitle = $article->getLocalizedTitle($locale);
         if (!is_null($localizedTitle)) {
             // Add the localized title.
             $titleNode =& XMLCustomWriter::createChildWithText($articleDoc, $titleList, 'title', $localizedTitle);
             XMLCustomWriter::setAttribute($titleNode, 'locale', $locale);
             // If the title does not exist in the given locale
             // then use the localized title for sorting only.
             $title = $article->getTitle($locale);
             $sortOnly = empty($title) ? 'true' : 'false';
             XMLCustomWriter::setAttribute($titleNode, 'sortOnly', $sortOnly);
         }
     }
     XMLCustomWriter::appendChild($articleNode, $titleList);
     // Add abstracts.
     $abstracts = $article->getAbstract(null);
     // return all locales
     if (!empty($abstracts)) {
         $abstractList =& XMLCustomWriter::createElement($articleDoc, 'abstractList');
         foreach ($abstracts as $locale => $abstract) {
             $abstractNode =& XMLCustomWriter::createChildWithText($articleDoc, $abstractList, 'abstract', $abstract);
             XMLCustomWriter::setAttribute($abstractNode, 'locale', $locale);
         }
         XMLCustomWriter::appendChild($articleNode, $abstractList);
     }
     // Add discipline.
     $disciplines = $article->getDiscipline(null);
     // return all locales
     if (!empty($disciplines)) {
         $disciplineList =& XMLCustomWriter::createElement($articleDoc, 'disciplineList');
         foreach ($disciplines as $locale => $discipline) {
             $disciplineNode =& XMLCustomWriter::createChildWithText($articleDoc, $disciplineList, 'discipline', $discipline);
             XMLCustomWriter::setAttribute($disciplineNode, 'locale', $locale);
         }
         XMLCustomWriter::appendChild($articleNode, $disciplineList);
     }
     // Add subjects and subject classes.
     $subjectClasses = $article->getSubjectClass(null);
     $subjects = $article->getSubject(null);
     if (!empty($subjectClasses) || !empty($subjects)) {
         $subjectList =& XMLCustomWriter::createElement($articleDoc, 'subjectList');
         if (!is_array($subjectClasses)) {
             $subjectClasses = array();
         }
         if (!is_array($subjects)) {
             $subjects = array();
         }
//.........这里部分代码省略.........
开发者ID:mosvits,项目名称:ojs,代码行数:101,代码来源:SolrWebService.inc.php

示例10: smartyUrl

 /**
  * Generate a URL into a PKPApp. (This is a wrapper around Dispatcher::url() to make it available to Smarty templates.)
  * {url} 標籤
  */
 function smartyUrl($params, &$smarty)
 {
     if (!isset($params['context'])) {
         // Extract the variables named in $paramList, and remove them
         // from the params array. Variables remaining in params will be
         // passed along to Request::url as extra parameters.
         $context = array();
         $contextList = Application::getContextList();
         foreach ($contextList as $contextName) {
             if (isset($params[$contextName])) {
                 $context[$contextName] = $params[$contextName];
                 unset($params[$contextName]);
             } else {
                 $context[$contextName] = null;
             }
         }
         $params['context'] = $context;
     }
     // Extract the variables named in $paramList, and remove them
     // from the params array. Variables remaining in params will be
     // passed along to Request::url as extra parameters.
     $paramList = array('router', 'context', 'page', 'component', 'op', 'path', 'anchor', 'escape', 'source');
     foreach ($paramList as $param) {
         if (isset($params[$param])) {
             ${$param} = $params[$param];
             unset($params[$param]);
         } else {
             ${$param} = null;
         }
     }
     if (isset($source)) {
         $params['source'] = Request::getRequestUri();
     }
     // Set the default router
     $request =& PKPApplication::getRequest();
     if (is_null($router)) {
         if (is_a($request->getRouter(), 'PKPComponentRouter')) {
             $router = ROUTE_COMPONENT;
         } else {
             $router = ROUTE_PAGE;
         }
     }
     // Check the router
     $dispatcher =& PKPApplication::getDispatcher();
     $routerShortcuts = array_keys($dispatcher->getRouterNames());
     assert(in_array($router, $routerShortcuts));
     // Identify the handler
     switch ($router) {
         case ROUTE_PAGE:
             $handler = $page;
             break;
         case ROUTE_COMPONENT:
             $handler = $component;
             break;
         default:
             // Unknown router type
             assert(false);
     }
     // Let the dispatcher create the url
     return $dispatcher->url($request, $router, $context, $handler, $op, $path, $params, $anchor, !isset($escape) || $escape);
 }
开发者ID:pulipulichen,项目名称:ocs,代码行数:65,代码来源:PKPTemplateManager.inc.php

示例11: isValid

 /**
  * Check if the CSRF token is correct.
  * overrides FormValidator::isValid()
  * @return boolean
  */
 function isValid()
 {
     $request = PKPApplication::getRequest();
     return $request->checkCSRF();
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:10,代码来源:FormValidatorCSRF.inc.php

示例12: callback

 /**
  * Callback that renders the block.
  *
  * @param $hookName string
  * @param $args array
  * @return string
  */
 function callback($hookName, $args)
 {
     $params =& $args[0];
     $smarty =& $args[1];
     $output =& $args[2];
     $output .= $this->getContents($smarty, PKPApplication::getRequest());
     return false;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:15,代码来源:BlockPlugin.inc.php

示例13: getCurrentContextId

 /**
  * Get the current context ID or the site-wide context ID (0) if no context
  * can be found.
  */
 function getCurrentContextId()
 {
     $context = PKPApplication::getRequest()->getContext();
     return is_null($context) ? 0 : $context->getId();
 }
开发者ID:pkp,项目名称:pkp-lib,代码行数:9,代码来源:GatewayPlugin.inc.php

示例14: callbackTemplateArticlePageFooter

 /**
  * @see templates/article/footer.tpl
  */
 function callbackTemplateArticlePageFooter($hookName, $params)
 {
     $smarty =& $params[1];
     $output =& $params[2];
     // Find articles of the same author(s).
     $displayedArticle = $smarty->get_template_vars('article');
     $authors = $displayedArticle->getAuthors();
     $authorDao = DAORegistry::getDAO('AuthorDAO');
     /* @var $authorDao AuthorDAO */
     $foundArticles = array();
     foreach ($authors as $author) {
         /* @var $author Author */
         // The following article search is by name only as authors are
         // not normalized in OJS. This is rather crude and may produce
         // false positives or miss some entries. But there's no other way
         // until OJS allows users to consistently normalize authors (via name,
         // email, ORCID, whatever).
         $articles = $authorDao->getPublishedArticlesForAuthor(null, $author->getFirstName(), $author->getMiddleName(), $author->getLastName(), $author->getLocalizedAffiliation(), $author->getCountry());
         foreach ($articles as $article) {
             /* @var $article PublishedArticle */
             if ($displayedArticle->getId() == $article->getId()) {
                 continue;
             }
             $foundArticles[] = $article->getId();
         }
     }
     $results = array_unique($foundArticles);
     // Order results by metric.
     $application = PKPApplication::getApplication();
     $metricType = $application->getDefaultMetricType();
     if (empty($metricType)) {
         $smarty->assign('noMetricSelected', true);
     }
     $column = STATISTICS_DIMENSION_ARTICLE_ID;
     $filter = array(STATISTICS_DIMENSION_ASSOC_TYPE => array(ASSOC_TYPE_GALLEY, ASSOC_TYPE_ARTICLE), STATISTICS_DIMENSION_ARTICLE_ID => array($results));
     $orderBy = array(STATISTICS_METRIC => STATISTICS_ORDER_DESC);
     $statsReport = $application->getMetrics($metricType, $column, $filter, $orderBy);
     $orderedResults = array();
     foreach ($statsReport as $reportRow) {
         $orderedResults[] = $reportRow['submission_id'];
     }
     // Make sure we even get results that have no statistics (yet) and that
     // we get them in some consistent order for paging.
     $remainingResults = array_diff($results, $orderedResults);
     sort($remainingResults);
     $orderedResults = array_merge($orderedResults, $remainingResults);
     // Pagination.
     $request = PKPApplication::getRequest();
     $rangeInfo = Handler::getRangeInfo($request, 'articlesBySameAuthor');
     if ($rangeInfo && $rangeInfo->isValid()) {
         $page = $rangeInfo->getPage();
     } else {
         $page = 1;
     }
     $totalResults = count($orderedResults);
     $itemsPerPage = RECOMMEND_BY_AUTHOR_PLUGIN_COUNT;
     $offset = $itemsPerPage * ($page - 1);
     $length = max($totalResults - $offset, 0);
     $length = min($itemsPerPage, $length);
     if ($length == 0) {
         $pagedResults = array();
     } else {
         $pagedResults = array_slice($orderedResults, $offset, $length);
     }
     // Visualization.
     import('classes.search.ArticleSearch');
     $articleSearch = new ArticleSearch();
     $pagedResults = $articleSearch->formatResults($pagedResults);
     import('lib.pkp.classes.core.VirtualArrayIterator');
     $returner = new VirtualArrayIterator($pagedResults, $totalResults, $page, $itemsPerPage);
     $smarty->assign('articlesBySameAuthor', $returner);
     $output .= $smarty->fetch($this->getTemplatePath() . 'articleFooter.tpl');
     return false;
 }
开发者ID:pkp,项目名称:ojs,代码行数:77,代码来源:RecommendByAuthorPlugin.inc.php

示例15: smartyUrl

 /**
  * Generate a URL into a PKPApp.
  * @param $params array
  * @param $smarty object
  * Available parameters:
  * - router: which router to use
  * - context
  * - page
  * - component
  * - op
  * - path (array)
  * - anchor
  * - escape (default to true unless otherwise specified)
  * - params: parameters to include in the URL if available as an array
  */
 function smartyUrl($parameters, &$smarty)
 {
     if (!isset($parameters['context'])) {
         // Extract the variables named in $paramList, and remove them
         // from the parameters array. Variables remaining in params will be
         // passed along to Request::url as extra parameters.
         $context = array();
         $contextList = Application::getContextList();
         foreach ($contextList as $contextName) {
             if (isset($parameters[$contextName])) {
                 $context[$contextName] = $parameters[$contextName];
                 unset($parameters[$contextName]);
             } else {
                 $context[$contextName] = null;
             }
         }
         $parameters['context'] = $context;
     }
     // Extract the reserved variables named in $paramList, and remove them
     // from the parameters array. Variables remaining in parameters will be passed
     // along to Request::url as extra parameters.
     $paramList = array('params', 'router', 'context', 'page', 'component', 'op', 'path', 'anchor', 'escape');
     foreach ($paramList as $parameter) {
         if (isset($parameters[$parameter])) {
             ${$parameter} = $parameters[$parameter];
             unset($parameters[$parameter]);
         } else {
             ${$parameter} = null;
         }
     }
     // Merge parameters specified in the {url paramName=paramValue} format with
     // those optionally supplied in {url params=$someAssociativeArray} format
     $parameters = array_merge($parameters, (array) $params);
     // Set the default router
     $request =& PKPApplication::getRequest();
     if (is_null($router)) {
         if (is_a($request->getRouter(), 'PKPComponentRouter')) {
             $router = ROUTE_COMPONENT;
         } else {
             $router = ROUTE_PAGE;
         }
     }
     // Check the router
     $dispatcher =& PKPApplication::getDispatcher();
     $routerShortcuts = array_keys($dispatcher->getRouterNames());
     assert(in_array($router, $routerShortcuts));
     // Identify the handler
     switch ($router) {
         case ROUTE_PAGE:
             $handler = $page;
             break;
         case ROUTE_COMPONENT:
             $handler = $component;
             break;
         default:
             // Unknown router type
             assert(false);
     }
     // Let the dispatcher create the url
     return $dispatcher->url($request, $router, $context, $handler, $op, $path, $parameters, $anchor, !isset($escape) || $escape);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:76,代码来源:PKPTemplateManager.inc.php


注:本文中的PKPApplication::getRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。