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


PHP PKPRequest::getRequestedPage方法代码示例

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


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

示例1: isCacheable

 /**
  * Determine whether or not the request is cacheable.
  * @return boolean
  */
 function isCacheable()
 {
     if (defined('SESSION_DISABLE_INIT')) {
         return false;
     }
     if (!Config::getVar('general', 'installed')) {
         return false;
     }
     if (!empty($_POST) || Validation::isLoggedIn()) {
         return false;
     }
     if (!PKPRequest::isPathInfoEnabled()) {
         $ok = array('journal', 'page', 'op', 'path');
         if (!empty($_GET) && count(array_diff(array_keys($_GET), $ok)) != 0) {
             return false;
         }
     } else {
         if (!empty($_GET)) {
             return false;
         }
     }
     if (in_array(PKPRequest::getRequestedPage(), array('about', 'announcement', 'help', 'index', 'information', 'rt', 'issue', ''))) {
         return true;
     }
     return false;
 }
开发者ID:Jouper,项目名称:jouper,代码行数:30,代码来源:OJSApplication.inc.php

示例2: initialize

 /**
  * Initialize the template manager.
  */
 function initialize()
 {
     $locale = AppLocale::getLocale();
     $application = PKPApplication::getApplication();
     $router = $this->_request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     $currentContext = $this->_request->getContext();
     $this->assign(array('defaultCharset' => Config::getVar('i18n', 'client_charset'), 'basePath' => $this->_request->getBasePath(), 'baseUrl' => $this->_request->getBaseUrl(), 'requiresFormRequest' => $this->_request->isPost(), 'currentUrl' => $this->_request->getCompleteUrl(), 'dateFormatTrunc' => Config::getVar('general', 'date_format_trunc'), 'dateFormatShort' => Config::getVar('general', 'date_format_short'), 'dateFormatLong' => Config::getVar('general', 'date_format_long'), 'datetimeFormatShort' => Config::getVar('general', 'datetime_format_short'), 'datetimeFormatLong' => Config::getVar('general', 'datetime_format_long'), 'timeFormat' => Config::getVar('general', 'time_format'), 'currentContext' => $currentContext, 'currentLocale' => $locale, 'pageTitle' => $application->getNameKey(), 'applicationName' => __($application->getNameKey())));
     if (is_a($router, 'PKPPageRouter')) {
         $this->assign(array('requestedPage' => $router->getRequestedPage($this->_request), 'requestedOp' => $router->getRequestedOp($this->_request)));
         // Register the jQuery script
         $min = Config::getVar('general', 'enable_minified') ? '.min' : '';
         if (Config::getVar('general', 'enable_cdn')) {
             $jquery = '//ajax.googleapis.com/ajax/libs/jquery/' . CDN_JQUERY_VERSION . '/jquery' . $min . '.js';
             $jqueryUI = '//ajax.googleapis.com/ajax/libs/jqueryui/' . CDN_JQUERY_UI_VERSION . '/jquery-ui' . $min . '.js';
         } else {
             $jquery = $this->_request->getBaseUrl() . '/lib/pkp/lib/components/jquery/jquery' . $min . '.js';
             $jqueryUI = $this->_request->getBaseUrl() . '/lib/pkp/lib/components/jquery-ui/jquery-ui' . $min . '.js';
         }
         $this->addJavaScript('jquery', $jquery, array('priority' => STYLE_SEQUENCE_CORE, 'contexts' => 'backend'));
         $this->addJavaScript('jqueryUI', $jqueryUI, array('priority' => STYLE_SEQUENCE_CORE, 'contexts' => 'backend'));
         // Register the pkp-lib JS library
         $this->registerJSLibraryData();
         $this->registerJSLibrary();
         // Load Noto Sans font from Google Font CDN
         // To load extended latin or other character sets, see:
         // https://www.google.com/fonts#UsePlace:use/Collection:Noto+Sans
         if (Config::getVar('general', 'enable_cdn')) {
             $this->addStyleSheet('pkpLibNotoSans', '//fonts.googleapis.com/css?family=Noto+Sans:400,400italic,700,700italic', array('priority' => STYLE_SEQUENCE_CORE, 'contexts' => 'backend'));
         }
         // Register the primary backend stylesheet
         if ($dispatcher = $this->_request->getDispatcher()) {
             $this->addStyleSheet('pkpLib', $dispatcher->url($this->_request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css'), array('priority' => STYLE_SEQUENCE_CORE, 'contexts' => 'backend'));
         }
         // Add reading language flag based on locale
         $this->assign('currentLocaleLangDir', AppLocale::getLocaleDirection($locale));
         // If there's a locale-specific stylesheet, add it.
         if (($localeStyleSheet = AppLocale::getLocaleStyleSheet($locale)) != null) {
             $this->addStyleSheet('pkpLibLocale', $this->_request->getBaseUrl() . '/' . $localeStyleSheet, array('contexts' => array('frontend', 'backend')));
         }
         // Register colour picker assets on the appearance page
         $this->addJavaScript('spectrum', $this->_request->getBaseUrl() . '/lib/pkp/js/lib/jquery/plugins/spectrum/spectrum.js', array('contexts' => array('backend-management-settings', 'backend-admin-settings', 'backend-admin-contexts')));
         $this->addStyleSheet('spectrum', $this->_request->getBaseUrl() . '/lib/pkp/js/lib/jquery/plugins/spectrum/spectrum.css', array('contexts' => array('backend-management-settings', 'backend-admin-settings', 'backend-admin-contexts')));
         // Register recaptcha on relevant pages
         if (Config::getVar('captcha', 'recaptcha') && Config::getVar('captcha', 'captcha_on_register')) {
             $this->addJavaScript('recaptcha', 'https://www.google.com/recaptcha/api.js', array('contexts' => array('frontend-user-register', 'frontend-user-registerUser')));
         }
         // Register meta tags
         if (Config::getVar('general', 'installed')) {
             if (($this->_request->getRequestedPage() == '' || $this->_request->getRequestedPage() == 'index') && $currentContext && $currentContext->getLocalizedSetting('searchDescription')) {
                 $this->addHeader('searchDescription', '<meta name="description" content="' . $currentContext->getLocalizedSetting('searchDescription') . '">');
             }
             $this->addHeader('generator', '<meta name="generator" content="' . __($application->getNameKey()) . ' ' . $application->getCurrentVersion()->getVersionString(false) . '">', array('contexts' => array('frontend', 'backend')));
             if ($currentContext) {
                 $customHeaders = $currentContext->getLocalizedSetting('customHeaders');
                 if (!empty($customHeaders)) {
                     $this->addHeader('customHeaders', $customHeaders);
                 }
             }
         }
         if ($currentContext && !$currentContext->getEnabled()) {
             $this->addHeader('noindex', '<meta name="robots" content="noindex,nofollow">', array('contexts' => array('frontend', 'backend')));
         }
     }
     // Register custom functions
     $this->register_modifier('translate', array('AppLocale', 'translate'));
     $this->register_modifier('strip_unsafe_html', array('PKPString', 'stripUnsafeHtml'));
     $this->register_modifier('String_substr', array('PKPString', 'substr'));
     $this->register_modifier('dateformatPHP2JQueryDatepicker', array('PKPString', 'dateformatPHP2JQueryDatepicker'));
     $this->register_modifier('to_array', array($this, 'smartyToArray'));
     $this->register_modifier('compare', array($this, 'smartyCompare'));
     $this->register_modifier('concat', array($this, 'smartyConcat'));
     $this->register_modifier('strtotime', array($this, 'smartyStrtotime'));
     $this->register_modifier('explode', array($this, 'smartyExplode'));
     $this->register_modifier('assign', array($this, 'smartyAssign'));
     $this->register_function('csrf', array($this, 'smartyCSRF'));
     $this->register_function('translate', array($this, 'smartyTranslate'));
     $this->register_function('null_link_action', array($this, 'smartyNullLinkAction'));
     $this->register_function('help', array($this, 'smartyHelp'));
     $this->register_function('flush', array($this, 'smartyFlush'));
     $this->register_function('call_hook', array($this, 'smartyCallHook'));
     $this->register_function('html_options_translate', array($this, 'smartyHtmlOptionsTranslate'));
     $this->register_block('iterate', array($this, 'smartyIterate'));
     $this->register_function('page_links', array($this, 'smartyPageLinks'));
     $this->register_function('page_info', array($this, 'smartyPageInfo'));
     $this->register_function('pluck_files', array($this, 'smartyPluckFiles'));
     // Modified vocabulary for creating forms
     $fbv = $this->getFBV();
     $this->register_block('fbvFormSection', array($fbv, 'smartyFBVFormSection'));
     $this->register_block('fbvFormArea', array($fbv, 'smartyFBVFormArea'));
     $this->register_function('fbvFormButtons', array($fbv, 'smartyFBVFormButtons'));
     $this->register_function('fbvElement', array($fbv, 'smartyFBVElement'));
     $this->assign('fbvStyles', $fbv->getStyles());
     $this->register_function('fieldLabel', array($fbv, 'smartyFieldLabel'));
     // register the resource name "core"
     $coreResource = new PKPTemplateResource($this->core_template_dir);
     $this->register_resource('core', array(array($coreResource, 'fetch'), array($coreResource, 'fetchTimestamp'), array($coreResource, 'getSecure'), array($coreResource, 'getTrusted')));
//.........这里部分代码省略.........
开发者ID:jalperin,项目名称:pkp-lib,代码行数:101,代码来源:PKPTemplateManager.inc.php

示例3: activate

    /**
     * Activate the theme.
     */
    function activate(&$templateMgr)
    {
        // Resets the template directory to the files in this directory -- Credit to https://github.com/cu-library/OJS-Modern-Theme for the fix/redirection
        $templateMgr->template_dir[0] = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . 'ojs-bootstrapped' . DIRECTORY_SEPARATOR . 'templates';
        $templateMgr->compile_id = 'bootstrapped';
        // Add viewport
        $viewport = ' <meta name="viewport" content="width=device-width, initial-scale=1">';
        // Add Font Awesome
        $fontAwesome = ' <link rel="stylesheet" id="font-awesome-css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" type="text/css" media="screen">';
        // Add in jQuery
        $jQuery = '	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>';
        // Selctivizr for IE Pseudo classes
        $selctivizr = '<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.5.1/mootools-yui-compressed.js"></script>
						<!--[if (gte IE 6)&(lte IE 8)]>
  							<script type="text/javascript" src="assets/js/selectivizr-min.js"></script>
						<![endif]-->';
        $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
        $templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $jQuery . "\n" . $viewport . "\n" . $fontAwesome . "\n" . $selctivizr);
        // Add Scroll2Top JS
        $templateMgr->addJavaScript($this->getPluginPath() . '/assets/js/scroll2top.js');
        // Add Modernizr JS
        $templateMgr->addJavaScript($this->getPluginPath() . '/assets/js/modernizr.js');
        // Add in Bootstrap JS
        $templateMgr->addJavaScript($this->getPluginPath() . '/components/bootstrap-sass/assets/javascripts/bootstrap.min.js');
        // Add Custom JS
        $templateMgr->addJavaScript($this->getPluginPath() . '/assets/js/custom.js');
        if (($stylesheetFilename = $this->getStylesheetFilename()) != null) {
            $path = Request::getBaseUrl() . '/' . $this->getPluginPath() . '/assets/stylesheets/' . $stylesheetFilename;
            $templateMgr->addStyleSheet($path);
        }
        // borrows logic from user block plugin to handle user dropdown
        if (!defined('SESSION_DISABLE_INIT')) {
            $session =& Request::getSession();
            $templateMgr->assign_by_ref('userSession', $session);
            $templateMgr->assign('loggedInUsername', $session->getSessionVar('username'));
        }
        $requestedPage = PKPRequest::getRequestedPage();
        if ($requestedPage == 'article') {
            $path = Request::getBaseUrl() . '/' . $this->getPluginPath() . '/assets/stylesheets/style_article.css';
            $templateMgr->addStyleSheet($path);
            $templateMgr->addJavaScript($this->getPluginPath() . '/js/article.js');
        }
    }
开发者ID:abdillahwb,项目名称:ojs-bootstrapped,代码行数:46,代码来源:BootstrappedThemePlugin.inc.php


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