getBaseUrl() 공개 정적인 메소드

The base URL never ends with a /. This is similar to getBasePath(), except that it also includes the script filename (e.g. index.php) if one exists.
public static getBaseUrl ( ) : string
리턴 string The raw URL (i.e. not urldecoded)
예제 #1
0
 public function baseUrl()
 {
     if ($this->_baseUrl === null) {
         $this->_baseUrl = $this->_request->getBaseUrl();
     }
     return $this->_baseUrl;
 }
예제 #2
0
 /**
  * Tries to match a URL path with a set of routes.
  *
  * If the matcher can not find information, it must throw one of the
  * exceptions documented below.
  *
  * @param string $pathinfo The path info to be parsed (raw format, i.e. not
  *                         urldecoded)
  *
  * @return array An array of parameters
  *
  * @throws ResourceNotFoundException If the resource could not be found
  * @throws MethodNotAllowedException If the resource was found but the
  *                                   request method is not allowed
  */
 public function match($pathinfo)
 {
     $urlMatcher = new UrlMatcher($this->routeCollection, $this->getContext());
     $result = $urlMatcher->match($pathinfo);
     if (!empty($result)) {
         try {
             // The route matches, now check if it actually exists
             $result['content'] = $this->contentManager->findActiveBySlug($result['slug']);
         } catch (NoResultException $e) {
             try {
                 //is it directory index
                 if (substr($result['slug'], -1) == '/' || $result['slug'] == '') {
                     $result['content'] = $this->contentManager->findActiveBySlug($result['slug'] . 'index');
                 } else {
                     if ($this->contentManager->findActiveBySlug($result['slug'] . '/index')) {
                         $redirect = new RedirectResponse($this->request->getBaseUrl() . "/" . $result['slug'] . '/');
                         $redirect->sendHeaders();
                         exit;
                     }
                 }
             } catch (NoResultException $ex) {
                 try {
                     $result['content'] = $this->contentManager->findActiveByAlias($result['slug']);
                 } catch (NoResultException $ex) {
                     throw new ResourceNotFoundException('No page found for slug ' . $pathinfo);
                 }
             }
         }
     }
     return $result;
 }
예제 #3
0
 /**
  * return the path to the icon for this type
  * @return string
  */
 function getIconLocation()
 {
     $baseUrl = Request::getBaseUrl() . '/lib/pkp/templates/images/icons/';
     switch ($this->getAssocType()) {
         case NOTIFICATION_TYPE_MONOGRAPH_SUBMITTED:
             return $baseUrl . 'page_new.gif';
             break;
         case NOTIFICATION_TYPE_METADATA_MODIFIED:
         case NOTIFICATION_TYPE_GALLEY_MODIFIED:
             return $baseUrl . 'edit.gif';
             break;
         case NOTIFICATION_TYPE_SUBMISSION_COMMENT:
         case NOTIFICATION_TYPE_LAYOUT_COMMENT:
         case NOTIFICATION_TYPE_COPYEDIT_COMMENT:
         case NOTIFICATION_TYPE_PROOFREAD_COMMENT:
         case NOTIFICATION_TYPE_REVIEWER_COMMENT:
         case NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT:
         case NOTIFICATION_TYPE_EDITOR_DECISION_COMMENT:
         case NOTIFICATION_TYPE_USER_COMMENT:
             return $baseUrl . 'comment_new.gif';
             break;
         case NOTIFICATION_TYPE_PUBLISHED_MONOGRAPH:
             return $baseUrl . 'list_world.gif';
             break;
         case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT:
             return $baseUrl . 'note_new.gif';
             break;
         default:
             return $baseUrl . 'page_alert.gif';
     }
 }
 public function send(Request $request)
 {
     $functionUrl = $request->getBaseUrl() . '/' . $request->getFunction();
     if (count($request->getUrlParams()) > 0) {
         $finalUrl = $functionUrl . '?' . http_build_query($request->getUrlParams());
     } else {
         $finalUrl = $functionUrl;
     }
     $ch = curl_init($finalUrl);
     $headerArray = [];
     foreach ($request->getHeaders() as $key => $value) {
         $headerArray[] = ucfirst($key) . ': ' . $value;
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $method = strtoupper($request->getMethod());
     switch ($method) {
         case "GET":
             break;
         case "POST":
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getParams());
             break;
         case "DELETE":
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
             break;
         case "PUT":
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
             curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request->getParams()));
             break;
     }
     return json_decode(curl_exec($ch));
 }
예제 #5
0
 function displayTemplateCallback($hookName, $args)
 {
     $templateMgr =& $args[0];
     $template =& $args[1];
     if ($template != 'article/article.tpl') {
         return false;
     }
     // Determine the query terms to use.
     $queryVariableNames = array('q', 'p', 'ask', 'searchfor', 'key', 'query', 'search', 'keyword', 'keywords', 'qry', 'searchitem', 'kwd', 'recherche', 'search_text', 'search_term', 'term', 'terms', 'qq', 'qry_str', 'qu', 's', 'k', 't', 'va');
     $this->queryTerms = array();
     if (($referer = getenv('HTTP_REFERER')) == '') {
         return false;
     }
     $urlParts = parse_url($referer);
     if (!isset($urlParts['query'])) {
         return false;
     }
     $queryArray = explode('&', $urlParts['query']);
     foreach ($queryArray as $var) {
         $varArray = explode('=', $var);
         if (in_array($varArray[0], $queryVariableNames) && !empty($varArray[1])) {
             $this->queryTerms += $this->parse_quote_string($varArray[1]);
         }
     }
     if (empty($this->queryTerms)) {
         return false;
     }
     $templateMgr->addStylesheet(Request::getBaseUrl() . '/' . $this->getPluginPath() . '/sehl.css');
     $templateMgr->register_outputfilter(array(&$this, 'outputFilter'));
     return false;
 }
예제 #6
0
 public function sign(Request $request)
 {
     $currentHeaders = $request->getHeaders();
     $signatureHeader = $this->getV1SignatureHeader($this->credentials->getPublicId(), base64_decode($this->credentials->getSecret()));
     $currentHeaders['x-signature'] = $signatureHeader;
     return new ApiRequest($request->getBaseUrl(), $request->getFunction(), $request->getUrlParams(), $request->getMethod(), $request->getParams(), $currentHeaders);
 }
예제 #7
0
    /**
     * Add the tinyMCE script for editing sidebar blocks with a WYSIWYG editor
     */
    function addTinyMCE()
    {
        $journalId = $this->journalId;
        $plugin =& $this->plugin;
        $templateMgr =& TemplateManager::getManager();
        // Enable TinyMCE with specific params
        $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
        import('classes.file.JournalFileManager');
        $publicFileManager = new PublicFileManager();
        $tinyMCE_script = '
		<script language="javascript" type="text/javascript" src="' . Request::getBaseUrl() . '/' . TINYMCE_JS_PATH . '/tiny_mce.js"></script>
		<script language="javascript" type="text/javascript">
			tinyMCE.init({
			mode : "textareas",
			plugins : "style,paste",
			theme : "advanced",
			theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink",
			theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,|,cleanup,help,code,",
			theme_advanced_toolbar_location : "bottom",
			theme_advanced_toolbar_align : "left",
			content_css : "' . Request::getBaseUrl() . '/styles/common.css", 
			relative_urls : false, 		
			document_base_url : "' . Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/", 
			extended_valid_elements : "span[*], div[*]"
			});
		</script>';
        $templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $tinyMCE_script);
    }
예제 #8
0
 /**
  * return the path to the icon for this type
  * @return string
  */
 function getIconLocation()
 {
     $baseUrl = Request::getBaseUrl() . '/lib/pkp/templates/images/icons/';
     switch ($this->getAssocType()) {
         case NOTIFICATION_TYPE_PAPER_SUBMITTED:
             return $baseUrl . 'page_new.gif';
             break;
         case NOTIFICATION_TYPE_SUPP_FILE_MODIFIED:
         case NOTIFICATION_TYPE_SUPP_FILE_ADDED:
             return $baseUrl . 'page_attachment.gif';
             break;
         case NOTIFICATION_TYPE_METADATA_MODIFIED:
         case NOTIFICATION_TYPE_GALLEY_MODIFIED:
             return $baseUrl . 'edit.gif';
             break;
         case NOTIFICATION_TYPE_SUBMISSION_COMMENT:
         case NOTIFICATION_TYPE_REVIEWER_COMMENT:
         case NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT:
         case NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT:
         case NOTIFICATION_TYPE_USER_COMMENT:
             return $baseUrl . 'comment_new.gif';
             break;
         case NOTIFICATION_TYPE_NEW_ANNOUNCEMENT:
             return $baseUrl . 'note_new.gif';
             break;
         default:
             return $baseUrl . 'page_alert.gif';
     }
 }
예제 #9
0
 /**
  * For public access:
  * If no press is selected, display list of presses associated with this system.
  * Otherwise, display the index page for the selected press.
  *
  * For private access (user is logged in):
  * Display the dashboard.
  *
  * @param $args array
  * @param $request Request
  */
 function index($args, &$request)
 {
     $this->validate();
     // FIXME: Replace with an authorization policy, see #6100.
     // Get the requested press.
     $router =& $request->getRouter();
     $requestedPressPath = $router->getRequestedContextPath(&$request);
     // No press requested: should we redirect to a specific press by default?
     $pressDao =& DAORegistry::getDAO('PressDAO');
     /* @var $pressDao PressDAO */
     $site =& $request->getSite();
     if ($requestedPressPath == 'index' && $site->getRedirect()) {
         $press =& $pressDao->getPress($site->getRedirect());
     } else {
         $press =& $router->getContext($request);
     }
     // Check whether the press exists and identify the actual target press path.
     if ($press && is_a($press, 'Press')) {
         $targetPressPath = $press->getPath();
     } else {
         $targetPressPath = 'index';
     }
     // Is this a private access? Then redirect to the dashboard of the target press.
     $user =& $request->getUser();
     if (is_a($user, 'User')) {
         $request->redirect($targetPressPath, 'dashboard');
         return;
     }
     // Do we have to redirect to another target press?
     if ($requestedPressPath != $targetPressPath && $targetPressPath != 'index') {
         $request->redirect($targetPressPath);
         return;
     }
     // This is a public request: set up the template.
     $this->setupTemplate();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', 'user.home');
     // If the request is for the site, display the overview page with all presses.
     if ($targetPressPath == 'index') {
         $templateMgr->assign('intro', $site->getLocalizedIntro());
         $templateMgr->assign('pressFilesPath', Request::getBaseUrl() . '/' . Config::getVar('files', 'public_files_dir') . '/presses/');
         $presses =& $pressDao->getEnabledPresses();
         $templateMgr->assign_by_ref('presses', $presses);
         $templateMgr->setCacheability(CACHEABILITY_PUBLIC);
         $templateMgr->display('index/site.tpl');
     } else {
         // Assign header and content for home page.
         $templateMgr->assign('displayPageHeaderTitle', $press->getPressPageHeaderTitle(true));
         $templateMgr->assign('displayPageHeaderLogo', $press->getPressPageHeaderLogo(true));
         $templateMgr->assign('additionalHomeContent', $press->getLocalizedSetting('additionalHomeContent'));
         $templateMgr->assign('homepageImage', $press->getLocalizedSetting('homepageImage'));
         $templateMgr->assign('pressDescription', $press->getLocalizedSetting('description'));
         // Display creative commons logo/licence if enabled.
         $templateMgr->assign('displayCreativeCommons', $press->getSetting('includeCreativeCommons'));
         // Disable announcements if enabled.
         $enableAnnouncements = $press->getSetting('enableAnnouncements');
         $templateMgr->display('index/press.tpl');
     }
 }
예제 #10
0
 /**
  * Activate the theme.
  */
 function activate(&$templateMgr)
 {
     // Subclasses may override this function.
     if (($stylesheetFilename = $this->getStylesheetFilename()) != null) {
         $path = Request::getBaseUrl() . '/' . $this->getPluginPath() . '/' . $stylesheetFilename;
         $templateMgr->addStyleSheet($path);
     }
 }
 /**
  * Display the form.
  */
 function display()
 {
     $journalId = $this->journalId;
     $plugin =& $this->plugin;
     // Ensure upload file settings are reloaded when the form is displayed.
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('journalStyleSheet', $plugin->getSetting($journalId, 'externalFeedStyleSheet'));
     $templateMgr->assign('defaultStyleSheetUrl', Request::getBaseUrl() . '/' . $plugin->getDefaultStyleSheetFile());
     parent::display();
 }
 /**
  * Template manager display hook callback to register smarty filters.
  * @param $hookName string
  * @param $args array
  * @return boolean
  */
 function callbackDisplay($hookName, $args)
 {
     $smarty = $args[0];
     /* @var $smarty Smarty */
     $additionalHeadData = $smarty->get_template_vars('additionalHeadData');
     $pluginScriptImportString = '<script language="javascript" type="text/javascript" src="' . Request::getBaseUrl() . DIRECTORY_SEPARATOR . $this->getPluginPath() . DIRECTORY_SEPARATOR . 'js/modernThemeSiteHandler.js"></script>';
     $googleFonts = "<link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css' />" . "<link href='http://fonts.googleapis.com/css?family=Open+Sans:700,400' rel='stylesheet' type='text/css' />";
     $smarty->assign('additionalHeadData', $pluginScriptImportString . $googleFonts);
     $smarty->register_prefilter(array(&$this, 'addPluginSiteController'));
     return false;
 }
예제 #13
0
 /**
  * Display the form.
  */
 function display()
 {
     import('file.PublicFileManager');
     $site =& Request::getSite();
     $schedConf =& Request::getSchedConf();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('helpTopicId', 'conference.currentConferences.program');
     $templateMgr->assign('publicSchedConfFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()));
     $templateMgr->assign('programFile', $schedConf->getSetting('programFile'));
     parent::display();
 }
예제 #14
0
 function display()
 {
     $templateMgr =& TemplateManager::getManager();
     $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
     $additionalHeadData .= '<script type="text/javascript" src="' . Request::getBaseUrl() . '/plugins/themes/custom/picker.js"></script>' . "\n";
     $templateMgr->addStyleSheet(Request::getBaseUrl() . '/plugins/themes/custom/picker.css');
     $templateMgr->assign('additionalHeadData', $additionalHeadData);
     $stylesheetFileLocation = $this->plugin->getPluginPath() . '/' . $this->plugin->getStylesheetFilename();
     $templateMgr->assign('canSave', is_writable($stylesheetFileLocation));
     $templateMgr->assign('stylesheetFileLocation', $stylesheetFileLocation);
     return parent::display();
 }
예제 #15
0
 /**
  * Returns a View object.
  * 
  * @route GET /?method=example.request
  * @route GET /example/request
  * 
  * @param Request $request
  * @return View
  */
 public function requestAction($request)
 {
     $view = new View();
     $view->setLayout('main');
     $view->method = $request->getMethod();
     $view->controller = $request->getController();
     $view->action = $request->getAction();
     $view->baseUrl = $request->getBaseUrl();
     $view->urlPath = $request->getUrlPath();
     $view->params = $request->getParams();
     return $view;
 }
 public function __invoke(array $record)
 {
     $record['context']['app'] = $this->appName;
     $record['context']['environement'] = $this->environment;
     $record['context']['Hostname'] = gethostname();
     try {
         if (null === $this->request) {
             $this->request = $this->container->get('request');
         }
         $record['request']['base_url'] = $this->request->getBaseUrl();
         $record['request']['scheme'] = $this->request->getScheme();
         $record['request']['port'] = $this->request->getPort();
         $record['request']['request_uri'] = $this->request->getRequestUri();
         $record['request']['uri'] = $this->request->getUri();
         $record['request']['query_string'] = $this->request->getQueryString();
         $record['request']['_route'] = $this->request->get('_route');
     } catch (\Exception $e) {
         // This stops errors occuring in the CLI
     }
     return $record;
 }
예제 #17
0
 /**
  * Display the form.
  */
 function display()
 {
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $schedConf =& Request::getSchedConf();
     $templateMgr =& TemplateManager::getManager();
     $site =& Request::getSite();
     $templateMgr->assign('helpTopicId', 'conference.currentConferences.accommodation');
     $templateMgr->assign('publicSchedConfFilesDir', Request::getBaseUrl() . '/' . $publicFileManager->getSchedConfFilesPath($schedConf->getId()));
     $templateMgr->assign('accommodationFiles', $schedConf->getSetting('accommodationFiles'));
     parent::display();
 }
예제 #18
0
 /**
  * If no journal is selected, display list of journals.
  * Otherwise, display the index page for the selected journal.
  */
 function index($args)
 {
     parent::validate();
     $templateMgr =& TemplateManager::getManager();
     $journalDao =& DAORegistry::getDAO('JournalDAO');
     $journalPath = Request::getRequestedJournalPath();
     $templateMgr->assign('helpTopicId', 'user.home');
     if ($journalPath != 'index' && $journalDao->journalExistsByPath($journalPath)) {
         $journal =& Request::getJournal();
         // Assign header and content for home page
         $templateMgr->assign('displayPageHeaderTitle', $journal->getJournalPageHeaderTitle(true));
         $templateMgr->assign('displayPageHeaderLogo', $journal->getJournalPageHeaderLogo(true));
         $templateMgr->assign('additionalHomeContent', $journal->getLocalizedSetting('additionalHomeContent'));
         $templateMgr->assign('homepageImage', $journal->getLocalizedSetting('homepageImage'));
         $templateMgr->assign('journalDescription', $journal->getLocalizedSetting('description'));
         $displayCurrentIssue = $journal->getSetting('displayCurrentIssue');
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         $issue =& $issueDao->getCurrentIssue($journal->getJournalId());
         if ($displayCurrentIssue && isset($issue)) {
             import('pages.issue.IssueHandler');
             // The current issue TOC/cover page should be displayed below the custom home page.
             IssueHandler::setupIssueTemplate($issue);
         }
         // Display creative commons logo/licence if enabled
         $templateMgr->assign('displayCreativeCommons', $journal->getSetting('includeCreativeCommons'));
         $enableAnnouncements = $journal->getSetting('enableAnnouncements');
         if ($enableAnnouncements) {
             $enableAnnouncementsHomepage = $journal->getSetting('enableAnnouncementsHomepage');
             if ($enableAnnouncementsHomepage) {
                 $numAnnouncementsHomepage = $journal->getSetting('numAnnouncementsHomepage');
                 $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
                 $announcements =& $announcementDao->getNumAnnouncementsNotExpiredByJournalId($journal->getJournalId(), $numAnnouncementsHomepage);
                 $templateMgr->assign('announcements', $announcements);
                 $templateMgr->assign('enableAnnouncementsHomepage', $enableAnnouncementsHomepage);
             }
         }
         $templateMgr->display('index/journal.tpl');
     } else {
         $siteDao =& DAORegistry::getDAO('SiteDAO');
         $site =& $siteDao->getSite();
         if ($site->getRedirect() && ($journal = $journalDao->getJournal($site->getJournalRedirect())) != null) {
             Request::redirect($journal->getPath());
         }
         $templateMgr->assign('intro', $site->getSiteIntro());
         $templateMgr->assign('journalFilesPath', Request::getBaseUrl() . '/' . Config::getVar('files', 'public_files_dir') . '/journals/');
         $journals =& $journalDao->getEnabledJournals();
         $templateMgr->assign_by_ref('journals', $journals);
         $templateMgr->setCacheability(CACHEABILITY_PUBLIC);
         $templateMgr->display('index/site.tpl');
     }
 }
예제 #19
0
 function register($category, $path)
 {
     if (parent::register($category, $path)) {
         if (!Config::getVar('general', 'installed')) {
             return false;
         }
         HookRegistry::register('SchemaPlugin::displayRecordSummary', array(&$this, 'displayTemplateCallback'));
         HookRegistry::register('SchemaPlugin::displayRecord', array(&$this, 'displayTemplateCallback'));
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->addStylesheet(Request::getBaseUrl() . '/' . $this->getPluginPath() . '/sehl.css');
         return true;
     }
     return false;
 }
예제 #20
0
 /**
  * 解析Url为数组
  * 
  */
 public function parseUrlToArray()
 {
     $requestUri = '';
     if (empty($_SERVER['QUERY_STRING'])) {
         $requestUri = $_SERVER['REQUEST_URI'];
     } else {
         $requestUri = str_replace('?' . $_SERVER['QUERY_STRING'], '', $_SERVER['REQUEST_URI']);
     }
     $baseUrl = $this->_request->getBaseUrl();
     if ($requestUri != $baseUrl) {
         $requestUri = str_replace($baseUrl, '', $requestUri);
     }
     $uriArray = explode('/', $requestUri);
     return $uriArray;
 }
 /**
  * Hook callback function for TemplateManager::display
  * @param $hookName string Hook name
  * @param $args array Hook arguments
  */
 function _displayCallback($hookName, $args)
 {
     if ($this->getEnabled()) {
         $templateMgr =& $args[0];
         $template =& $args[1];
         switch ($template) {
             case 'issue/issueGalley.tpl':
                 $templatePath = $this->getTemplatePath();
                 $templateMgr->assign('pluginTemplatePath', $templatePath);
                 $templateMgr->assign('pluginUrl', Request::getBaseUrl() . DIRECTORY_SEPARATOR . $this->getPluginPath());
                 $template = $templatePath . 'issueGalley.tpl';
                 break;
         }
         return false;
     }
 }
 /**
  * Activate the theme.
  */
 function activate(&$templateMgr)
 {
     // Add in jQuery from CMS
     $jQueryCMS = '	<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>';
     $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
     $templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $jQueryCMS);
     // Not even the javascript array as in the case of stylesheets
     $object_aux = method_exists($templateMgr, 'addJavaScript') ? $templateMgr : $this;
     // Add in Bootstrap JS
     $object_aux->addJavaScript($templateMgr, 'plugins/themes/bootstrappish/js/bootstrap.min.js');
     // Add in custom JS scripts to hold miscellany
     $object_aux->addJavaScript($templateMgr, 'plugins/themes/bootstrappish/js/custom.js');
     if (($stylesheetFilename = $this->getStylesheetFilename()) != null) {
         $path = Request::getBaseUrl() . '/' . $this->getPluginPath() . '/css/' . $stylesheetFilename . '?bootstrappish';
         $templateMgr->addStyleSheet($path);
     }
 }
예제 #23
0
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True iff plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success && $this->getEnabled()) {
         $this->import('ExternalFeedDAO');
         $externalFeedDao = new ExternalFeedDAO($this->getName());
         $returner =& DAORegistry::registerDAO('ExternalFeedDAO', $externalFeedDao);
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $this->getStyleSheetFile());
         // Journal home page display
         HookRegistry::register('TemplateManager::display', array(&$this, 'displayHomepage'));
         // Register also as a block plugin
         HookRegistry::register('PluginRegistry::loadCategory', array(&$this, 'callbackLoadCategory'));
         // Journal Manager link to externalFeed management pages
         HookRegistry::register('Templates::Manager::Index::ManagementPages', array($this, 'displayManagerLink'));
     }
     return $success;
 }
 /**
  * Get pages social meta tags
  * @return social tags string
  */
 function getPageSocialMetaTags()
 {
     $journal = Request::getJournal();
     $title = $journal->getLocalizedTitle();
     $type = 'webpage';
     $url = Request::url();
     $description = str_replace('"', '', $journal->getLocalizedDescription());
     $description = strip_tags($description);
     $description = $this->truncate($description, 140);
     if ($journal->getLocalizedPageHeaderLogo()) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $coverPagePath = Request::getBaseUrl() . '/';
         $coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
         $pageHeaderLogo = $journal->getLocalizedPageHeaderLogo();
         $journalImage = $coverPagePath . $pageHeaderLogo['uploadName'];
     } elseif ($journal->getLocalizedPageHeaderTitle()) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $coverPagePath = Request::getBaseUrl() . '/';
         $coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
         $pageHeaderTitle = $journal->getLocalizedPageHeaderTitle();
         $journalImage = $coverPagePath . $pageHeaderTitle['uploadName'];
     } else {
         $journalImage = NULL;
     }
     $tagsStr = "\n\n<!-- Open Graph -->\n";
     $tagsStr .= '<meta property="og:title" content="' . $title . '" />' . "\n";
     $tagsStr .= '<meta property="og:type" content="' . $type . '" />' . "\n";
     $tagsStr .= '<meta property="og:url" content="' . $url . '" />' . "\n";
     $tagsStr .= '<meta property="og:description" content="' . $description . '" />' . "\n";
     if ($journalImage) {
         $tagsStr .= '<meta property="og:image" content="' . $journalImage . '" />' . "\n";
     }
     $tagsStr .= "\n\n<!-- Twitter Cards -->\n";
     $tagsStr .= '<meta name="twitter:card" content="summary" />' . "\n";
     $tagsStr .= '<meta name="twitter:title" content="' . str_replace('"', '', $title) . '" />' . "\n";
     $tagsStr .= '<meta name="twitter:description" content="' . $description . '" />' . "\n";
     if ($journalImage) {
         $tagsStr .= '<meta name="twitter:image" content="' . $journalImage . '" />' . "\n";
     }
     return $tagsStr;
 }
 function index()
 {
     AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_COMMON, LOCALE_COMPONENT_APPLICATION_COMMON));
     $templateMgr =& TemplateManager::getManager();
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $schedConfId = $schedConf ? $schedConf->getId() : $conference->getId();
     $templateMgr->addStyleSheet(Request::getBaseUrl() . '/plugins/generic/listOfAttendees/listOfAttendees.css');
     $templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'index', 'index'), $conference->getConferenceTitle(), true), array(Request::url(null, null, 'index'), $schedConf->getSchedConfTitle(), true)));
     $templateMgr->assign('title', __('plugins.generic.listOfAttendees.pageTitle'));
     $listOfAttendeesDAO =& DAORegistry::getDAO('ListOfAttendeesDAO');
     $attendees =& $listOfAttendeesDAO->getListOfAttendees($schedConfId);
     $attendees =& $attendees->toArray();
     $templateMgr->assign_by_ref('attendees', $attendees);
     $countryDao =& DAORegistry::getDAO('CountryDAO');
     $countries =& $countryDao->getCountries();
     $templateMgr->assign_by_ref('countries', $countries);
     $listOfAttendeesPlugin =& PluginRegistry::getPlugin('generic', 'ListOfAttendeesPlugin');
     $templateMgr->display($listOfAttendeesPlugin->getTemplatePath() . 'index.tpl');
 }
예제 #26
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::PKPTemplateManager();
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $site =& Request::getSite();
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         $this->assign('isAdmin', Validation::isSiteAdmin());
         // assign an empty home context
         $this->assign('homeContext', array());
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         // Load and apply theme plugin, if chosen
         $themePluginPath = $site->getSetting('theme');
         if (!empty($themePluginPath)) {
             // Load and activate the theme
             $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
             if ($themePlugin) {
                 $themePlugin->activate($this);
             }
         }
         // Add the site-wide logo, if set for this locale or the primary locale
         $this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
         $customLogo = $site->getSetting('customLogo');
         if ($customLogo) {
             $this->assign('useCustomLogo', $customLogo);
         }
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $this->assign('enableSubmit', $site->getSetting('enableSubmit'));
     }
 }
 /**
  * Display the form
  */
 function display()
 {
     $templateMgr =& TemplateManager::getManager();
     $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
     $additionalHeadData .= '<script type="text/javascript" src="' . Request::getBaseUrl() . '/plugins/themes/custom/picker.js"></script>' . "\n";
     $templateMgr->addStyleSheet(Request::getBaseUrl() . '/plugins/themes/custom/picker.css');
     $templateMgr->assign('additionalHeadData', $additionalHeadData);
     $stylesheetFilePluginLocation = $this->plugin->getPluginPath() . '/' . $this->plugin->getStylesheetFilename();
     if (!$this->_canUsePluginPath() || $this->plugin->getSetting($this->journalId, 'customThemePerJournal')) {
         if (!$this->_canUsePluginPath()) {
             $templateMgr->assign('disablePluginPath', true);
             $templateMgr->assign('stylesheetFilePluginLocation', $stylesheetFilePluginLocation);
         }
         import('classes.file.PublicFileManager');
         $fileManager = new PublicFileManager();
         $stylesheetFileLocation = $fileManager->getJournalFilesPath($this->journalId) . '/' . $this->plugin->getStylesheetFilename();
     } else {
         $stylesheetFileLocation = $stylesheetFilePluginLocation;
     }
     $templateMgr->assign('canSave', $this->_is_writable($stylesheetFileLocation));
     $templateMgr->assign('stylesheetFileLocation', $stylesheetFileLocation);
     return parent::display();
 }
예제 #28
0
 /**
  * Given a scheduled conference, set up the template with all the
  * required variables for schedConf/view.tpl to function properly.
  * @param $schedConf object The scheduled conference to display
  * 	the cover page will be displayed. Otherwise table of contents
  * 	will be displayed.
  */
 function setupTemplate(&$conference, &$schedConf)
 {
     parent::setupTemplate();
     $templateMgr =& TemplateManager::getManager();
     AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_MANAGER));
     // Ensure the user is entitled to view the scheduled conference...
     if (isset($schedConf) && ($conference->getEnabled() || (Validation::isDirector($conference->getId()) || Validation::isConferenceManager($conference->getId())))) {
         // Assign header and content for home page
         $templateMgr->assign('displayPageHeaderTitle', $conference->getPageHeaderTitle(true));
         $templateMgr->assign('displayPageHeaderLogo', $conference->getPageHeaderLogo(true));
         $templateMgr->assign('displayPageHeaderTitleAltText', $conference->getLocalizedSetting('homeHeaderTitleImageAltText'));
         $templateMgr->assign('displayPageHeaderLogoAltText', $conference->getLocalizedSetting('homeHeaderLogoImageAltText'));
         $templateMgr->assign_by_ref('schedConf', $schedConf);
         $templateMgr->assign('additionalHomeContent', $conference->getLocalizedSetting('additionalHomeContent'));
     } else {
         Request::redirect(null, 'index');
     }
     if ($styleFileName = $schedConf->getStyleFileName()) {
         import('file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $publicFileManager->getConferenceFilesPath($conference->getId()) . '/' . $styleFileName);
     }
     $this->checkRole($conference, $schedConf);
     $templateMgr->assign("conferenceUrl", Request::url(null, 'index'));
     $templateMgr->assign("conferenceId", $conference->getId());
     $templateMgr->assign("schedConfId", $schedConf->getId());
     $templateMgr->assign("schedConfUrl", Request::url(null, $conference->getSetting('path')));
     $templateMgr->assign("conferencePath", $conference->getSetting('path'));
 }
예제 #29
0
 function updateProgressBar($progress, $total)
 {
     static $lastPercent;
     $percent = round($progress * 100 / $total);
     if (!isset($lastPercent) || $lastPercent != $percent) {
         for ($i = 1; $i <= $percent - $lastPercent; $i++) {
             echo '<img src="' . Request::getBaseUrl() . '/templates/images/progbar.gif" width="5" height="15">';
         }
     }
     $lastPercent = $percent;
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->flush();
 }
예제 #30
0
 /**
  * Get the URL to the index script.
  * @return string
  */
 function getIndexUrl()
 {
     static $indexUrl;
     if (!isset($indexUrl)) {
         $indexUrl = Request::getBaseUrl() . '/' . INDEX_SCRIPTNAME;
         HookRegistry::call('Request::getIndexUrl', array(&$indexUrl));
     }
     return $indexUrl;
 }