本文整理汇总了PHP中PublicFileManager::getSiteFilesPath方法的典型用法代码示例。如果您正苦于以下问题:PHP PublicFileManager::getSiteFilesPath方法的具体用法?PHP PublicFileManager::getSiteFilesPath怎么用?PHP PublicFileManager::getSiteFilesPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PublicFileManager
的用法示例。
在下文中一共展示了PublicFileManager::getSiteFilesPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Save the new image file.
* @param $request Request.
*/
function execute($request)
{
$temporaryFile = $this->fetchTemporaryFile($request);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
if (is_a($temporaryFile, 'TemporaryFile')) {
$type = $temporaryFile->getFileType();
$extension = $publicFileManager->getImageExtension($type);
if (!$extension) {
return false;
}
$locale = AppLocale::getLocale();
$uploadName = $this->getFileSettingName() . '_' . $locale . $extension;
if ($publicFileManager->copyFile($temporaryFile->getFilePath(), $publicFileManager->getSiteFilesPath() . '/' . $uploadName)) {
// Get image dimensions
$filePath = $publicFileManager->getSiteFilesPath();
list($width, $height) = getimagesize($filePath . '/' . $uploadName);
$site = $request->getSite();
$siteDao = DAORegistry::getDAO('SiteDAO');
$value = $site->getSetting($this->getFileSettingName());
$imageAltText = $this->getData('imageAltText');
$value[$locale] = array('originalFilename' => $temporaryFile->getOriginalFileName(), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate(), 'altText' => $imageAltText[$locale]);
$site->updateSetting($this->getFileSettingName(), $value, 'object', true);
// Clean up the temporary file
$this->removeTemporaryFile($request);
return true;
}
}
return false;
}
示例2: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
* @param $request PKPRequest
*/
function TemplateManager($request)
{
parent::PKPTemplateManager($request);
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).
*/
$context = $request->getContext();
$site = $request->getSite();
$publicFileManager = new PublicFileManager();
$siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
$this->assign('sitePublicFilesDir', $siteFilesDir);
$this->assign('publicFilesDir', $siteFilesDir);
// May be overridden by press
$siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
if (file_exists($siteStyleFilename)) {
$this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename, STYLE_SEQUENCE_LAST);
}
if (isset($context)) {
$this->assign('currentPress', $context);
$this->assign('siteTitle', $context->getLocalizedName());
$this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId()));
$this->assign('primaryLocale', $context->getPrimaryLocale());
$this->assign('alternateLocales', $context->getSetting('alternateLocales'));
// Assign page header
$this->assign('displayPageHeaderTitle', $context->getPageHeaderTitle());
$this->assign('displayPageHeaderLogo', $context->getPageHeaderLogo());
$this->assign('alternatePageHeader', $context->getLocalizedSetting('pageHeader'));
$this->assign('metaSearchDescription', $context->getLocalizedSetting('searchDescription'));
$this->assign('metaSearchKeywords', $context->getLocalizedSetting('searchKeywords'));
$this->assign('metaCustomHeaders', $context->getLocalizedSetting('customHeaders'));
$this->assign('numPageLinks', $context->getSetting('numPageLinks'));
$this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
$this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
// Assign stylesheets and footer
$contextStyleSheet = $context->getSetting('styleSheet');
if ($contextStyleSheet) {
$this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath(ASSOC_TYPE_PRESS, $context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
}
// Include footer links if they have been defined.
$footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
$footerCategories = $footerCategoryDao->getNotEmptyByContextId($context->getId());
$this->assign('footerCategories', $footerCategories->toArray());
$footerLinkDao = DAORegistry::getDAO('FooterLinkDAO');
$this->assign('maxLinks', $footerLinkDao->getLargestCategoryTotalbyContextId($context->getId()));
$this->assign('pageFooter', $context->getLocalizedSetting('pageFooter'));
} else {
// Add the site-wide logo, if set for this locale or the primary locale
$displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
$this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
if (isset($displayPageHeaderTitle['altText'])) {
$this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
}
$this->assign('siteTitle', $site->getLocalizedTitle());
}
}
}
示例3: uploadProfileImage
function uploadProfileImage()
{
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
$user =& $this->user;
$type = $fileManager->getUploadedFileType('profileImage');
$extension = $fileManager->getImageExtension($type);
if (!$extension) {
return false;
}
$uploadName = 'profileImage-' . (int) $user->getId() . $extension;
if (!$fileManager->uploadSiteFile('profileImage', $uploadName)) {
return false;
}
$filePath = $fileManager->getSiteFilesPath();
list($width, $height) = getimagesize($filePath . '/' . $uploadName);
if ($width > 150 || $height > 150 || $width <= 0 || $height <= 0) {
$userSetting = null;
$user->updateSetting('profileImage', $userSetting);
$fileManager->removeSiteFile($filePath);
return false;
}
$userSetting = array('name' => $fileManager->getUploadedFileName('profileImage'), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate());
$user->updateSetting('profileImage', $userSetting);
return true;
}
示例4: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
* @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
*/
function TemplateManager($request = null)
{
// FIXME: for backwards compatibility only - remove
if (!isset($request)) {
// FIXME: Trigger a deprecation warning when enough instances of this
// call have been fixed to not clutter the error log.
$request =& Registry::get('request');
}
assert(is_a($request, 'PKPRequest'));
parent::PKPTemplateManager($request);
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();
$publicFileManager = new PublicFileManager();
$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('displayPageHeaderLogo', $customLogo);
}
$this->assign('siteTitle', $site->getLocalizedTitle());
$this->assign('enableSubmit', $site->getSetting('enableSubmit'));
}
}
示例5: TemplateManager
/**
* 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'));
}
}
示例6: uploadImage
/**
* Uploads an image.
* @param $settingName string setting key associated with the file
*/
function uploadImage($settingName)
{
$site =& Request::getSite();
$settingsDao = DAORegistry::getDAO('SiteSettingsDAO');
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
if ($fileManager->uploadedFileExists($settingName)) {
$type = $fileManager->getUploadedFileType($settingName);
$extension = $fileManager->getImageExtension($type);
if (!$extension) {
return false;
}
$uploadName = $settingName . $extension;
if ($fileManager->uploadSiteFile($settingName, $uploadName)) {
// Get image dimensions
$filePath = $fileManager->getSiteFilesPath();
list($width, $height) = getimagesize($filePath . '/' . $settingName . $extension);
$value = array('name' => $fileManager->getUploadedFileName($settingName), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate());
return $settingsDao->updateSetting($settingName, $value, 'object');
}
}
return false;
}
示例7: execute
/**
* Save the new image file.
* @param $request Request.
*/
function execute($request)
{
$temporaryFile = $this->fetchTemporaryFile($request);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
if (is_a($temporaryFile, 'TemporaryFile')) {
$type = $temporaryFile->getFileType();
if ($type != 'text/plain' && $type != 'text/css') {
return false;
}
$settingName = $this->getFileSettingName();
$site = $request->getSite();
$uploadName = $site->getSiteStyleFilename();
if ($publicFileManager->copyFile($temporaryFile->getFilePath(), $publicFileManager->getSiteFilesPath() . '/' . $uploadName)) {
$siteDao = DAORegistry::getDAO('SiteDAO');
$site->setOriginalStyleFilename($temporaryFile->getOriginalFileName());
$siteDao->updateObject($site);
// Clean up the temporary file
$this->removeTemporaryFile($request);
return true;
}
}
return false;
}
示例8: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
* @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
*/
function TemplateManager($request = null)
{
parent::PKPTemplateManager($request);
// Retrieve the router
$router =& $this->request->getRouter();
assert(is_a($router, 'PKPRouter'));
// Are we using implicit authentication?
$this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
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).
*/
$journal =& $router->getContext($this->request);
$site =& $this->request->getSite();
$publicFileManager = new PublicFileManager();
$siteFilesDir = $this->request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
$this->assign('sitePublicFilesDir', $siteFilesDir);
$this->assign('publicFilesDir', $siteFilesDir);
// May be overridden by journal
$siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
if (file_exists($siteStyleFilename)) {
$this->addStyleSheet($this->request->getBaseUrl() . '/' . $siteStyleFilename);
}
$this->assign('homeContext', array());
$this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
if (isset($journal)) {
$this->assign_by_ref('currentJournal', $journal);
$journalTitle = $journal->getLocalizedTitle();
$this->assign('siteTitle', $journalTitle);
$this->assign('publicFilesDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
$this->assign('primaryLocale', $journal->getPrimaryLocale());
$this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
// Assign additional navigation bar items
$navMenuItems =& $journal->getLocalizedSetting('navItems');
$this->assign_by_ref('navMenuItems', $navMenuItems);
// Assign journal page header
$this->assign('displayPageHeaderTitle', $journal->getLocalizedPageHeaderTitle());
$this->assign('displayPageHeaderLogo', $journal->getLocalizedPageHeaderLogo());
$this->assign('displayPageHeaderTitleAltText', $journal->getLocalizedSetting('pageHeaderTitleImageAltText'));
$this->assign('displayPageHeaderLogoAltText', $journal->getLocalizedSetting('pageHeaderLogoImageAltText'));
$this->assign('displayFavicon', $journal->getLocalizedFavicon());
$this->assign('faviconDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
$this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
$this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
$this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
$this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
$this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
$this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
$this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
$this->assign('hideRegisterLink', !$journal->getSetting('allowRegReviewer') && !$journal->getSetting('allowRegReader') && !$journal->getSetting('allowRegAuthor'));
// Load and apply theme plugin, if chosen
$themePluginPath = $journal->getSetting('journalTheme');
if (!empty($themePluginPath)) {
// Load and activate the theme
$themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
if ($themePlugin) {
$themePlugin->activate($this);
}
}
// Assign stylesheets and footer
$journalStyleSheet = $journal->getSetting('journalStyleSheet');
if ($journalStyleSheet) {
$this->addStyleSheet($this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $journalStyleSheet['uploadName']);
}
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($this->request);
$this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
$this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
} else {
// Add the site-wide logo, if set for this locale or the primary locale
$displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
$this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
if (isset($displayPageHeaderTitle['altText'])) {
$this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
}
$this->assign('siteTitle', $site->getLocalizedTitle());
// Load and apply theme plugin, if chosen
$themePluginPath = $site->getSetting('siteTheme');
if (!empty($themePluginPath)) {
// Load and activate the theme
$themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
if ($themePlugin) {
$themePlugin->activate($this);
}
}
}
if (!$site->getRedirect()) {
$this->assign('hasOtherJournals', true);
}
// Add java script for notifications
$user =& $this->request->getUser();
if ($user) {
$this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
//.........这里部分代码省略.........
示例9: substr
function _handleOjsUrl($matchArray)
{
$request = Application::getRequest();
$url = $matchArray[2];
$anchor = null;
if (($i = strpos($url, '#')) !== false) {
$anchor = substr($url, $i + 1);
$url = substr($url, 0, $i);
}
$urlParts = explode('/', $url);
if (isset($urlParts[0])) {
switch (strtolower_codesafe($urlParts[0])) {
case 'journal':
$url = $request->url(isset($urlParts[1]) ? $urlParts[1] : $request->getRequestedJournalPath(), null, null, null, null, $anchor);
break;
case 'article':
if (isset($urlParts[1])) {
$url = $request->url(null, 'article', 'view', $urlParts[1], null, $anchor);
}
break;
case 'issue':
if (isset($urlParts[1])) {
$url = $request->url(null, 'issue', 'view', $urlParts[1], null, $anchor);
} else {
$url = $request->url(null, 'issue', 'current', null, null, $anchor);
}
break;
case 'sitepublic':
array_shift($urlParts);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath() . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
case 'public':
array_shift($urlParts);
$journal = $request->getJournal();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
}
}
return $matchArray[1] . $url . $matchArray[3];
}
示例10: uploadPlugin
/**
* Decompress uploaded plugin and install in the correct plugin directory.
* @param $function string type of operation to perform after upload ('upgrade' or 'install')
* @param $category string the category of the uploaded plugin (upgrade only)
* @param $plugin string the name of the uploaded plugin (upgrade only)
*/
function uploadPlugin($function, $category = null, $plugin = null)
{
$this->validate();
$templateMgr =& TemplateManager::getManager();
$this->setupTemplate(true);
$templateMgr->assign('error', false);
$templateMgr->assign('uploaded', false);
$templateMgr->assign('path', $function);
$errorMsg = '';
if (Request::getUserVar('uploadPlugin')) {
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$pluginFile = Core::getBaseDir() . DIRECTORY_SEPARATOR . $publicFileManager->getSiteFilesPath() . DIRECTORY_SEPARATOR . $_FILES['newPlugin']['name'];
// tar archive basename (less potential version number) must equal plugin directory name
// and plugin files must be in a directory named after the plug-in.
$matches = array();
String::regexp_match_get('/^[a-zA-Z0-9]+/', basename($pluginFile, '.tar.gz'), $matches);
$pluginName = array_pop($matches);
} else {
$errorMsg = 'manager.plugins.fileSelectError';
}
if (empty($errorMsg)) {
if ($publicFileManager->uploadSiteFile('newPlugin', basename($pluginFile))) {
// Create random dirname to avoid symlink attacks.
$pluginDir = Core::getBaseDir() . DIRECTORY_SEPARATOR . $publicFileManager->getSiteFilesPath() . DIRECTORY_SEPARATOR . $pluginName . substr(md5(mt_rand()), 0, 10);
mkdir($pluginDir);
} else {
$errorMsg = 'manager.plugins.uploadError';
}
}
if (empty($errorMsg)) {
// Test whether the tar binary is available for the export to work
$tarBinary = Config::getVar('cli', 'tar');
if (!empty($tarBinary) && file_exists($tarBinary)) {
exec($tarBinary . ' -xzf ' . escapeshellarg($pluginFile) . ' -C ' . escapeshellarg($pluginDir));
} else {
$errorMsg = 'manager.plugins.tarCommandNotFound';
}
}
if (empty($errorMsg)) {
// We should now find a directory named after the
// plug-in within the extracted archive.
$pluginDir .= DIRECTORY_SEPARATOR . $pluginName;
if (is_dir($pluginDir)) {
if ($function == 'install') {
$this->installPlugin($pluginDir, $templateMgr);
} else {
if ($function == 'upgrade') {
$this->upgradePlugin($pluginDir, $templateMgr, $category, $plugin);
}
}
$publicFileManager->removeSiteFile(basename($pluginFile));
} else {
$errorMsg = 'manager.plugins.invalidPluginArchive';
}
}
if (!empty($errorMsg)) {
$templateMgr->assign('error', true);
$templateMgr->assign('message', $errorMsg);
}
$templateMgr->display('admin/managePlugins.tpl');
}
示例11: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
*/
function TemplateManager()
{
parent::PKPTemplateManager();
// Are we using implicit authentication?
$this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
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).
*/
$journal =& Request::getJournal();
$site =& Request::getSite();
$siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
$this->assign('sitePublicFilesDir', $siteFilesDir);
$this->assign('publicFilesDir', $siteFilesDir);
// May be overridden by journal
$siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
if (file_exists($siteStyleFilename)) {
$this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
}
if (isset($journal)) {
$this->assign_by_ref('currentJournal', $journal);
$journalTitle = $journal->getJournalTitle();
$this->assign('siteTitle', $journalTitle);
$this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()));
$this->assign('primaryLocale', $journal->getPrimaryLocale());
$this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
// Assign additional navigation bar items
$navMenuItems =& $journal->getLocalizedSetting('navItems');
$this->assign_by_ref('navMenuItems', $navMenuItems);
// Assign journal page header
$this->assign('displayPageHeaderTitle', $journal->getJournalPageHeaderTitle());
$this->assign('displayPageHeaderLogo', $journal->getJournalPageHeaderLogo());
$this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
$this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
$this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
$this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
$this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
$this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
$this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
// Load and apply theme plugin, if chosen
$themePluginPath = $journal->getSetting('journalTheme');
if (!empty($themePluginPath)) {
// Load and activate the theme
$themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
if ($themePlugin) {
$themePlugin->activate($this);
}
}
// Assign stylesheets and footer
$journalStyleSheet = $journal->getSetting('journalStyleSheet');
if ($journalStyleSheet) {
$this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()) . '/' . $journalStyleSheet['uploadName']);
}
import('payment.ojs.OJSPaymentManager');
$paymentManager =& OJSPaymentManager::getManager();
$this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
$this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
} else {
// Add the site-wide logo, if set for this locale or the primary locale
$this->assign('displayPageHeaderTitle', $site->getSitePageHeaderTitle());
$this->assign('siteTitle', $site->getSiteTitle());
}
if (!$site->getRedirect()) {
$this->assign('hasOtherJournals', true);
}
}
}
示例12: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
* @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
*/
function TemplateManager($request = null)
{
// FIXME: for backwards compatibility only - remove
if (!isset($request)) {
// FIXME: Trigger a deprecation warning when enough instances of this
// call have been fixed to not clutter the error log.
$request =& Registry::get('request');
}
assert(is_a($request, 'PKPRequest'));
parent::PKPTemplateManager($request);
// Retrieve the router
$router =& $request->getRouter();
assert(is_a($router, 'PKPRouter'));
// Are we using implicit authentication?
$this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
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).
*/
$press =& $router->getContext($request);
$site =& $request->getSite();
$siteFilesDir = $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
$this->assign('sitePublicFilesDir', $siteFilesDir);
$this->assign('publicFilesDir', $siteFilesDir);
// May be overridden by press
$siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
if (file_exists($siteStyleFilename)) {
$this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
}
$this->assign('homeContext', array());
if (isset($press)) {
$this->assign_by_ref('currentPress', $press);
$pressTitle = $press->getLocalizedName();
$this->assign('siteTitle', $pressTitle);
$this->assign('publicFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getPressFilesPath($press->getId()));
$this->assign('primaryLocale', $press->getPrimaryLocale());
$this->assign('alternateLocales', $press->getSetting('alternateLocales'));
// Assign additional navigation bar items
$navMenuItems =& $press->getLocalizedSetting('navItems');
$this->assign_by_ref('navMenuItems', $navMenuItems);
// Assign press page header
$this->assign('displayPageHeaderTitle', $press->getPressPageHeaderTitle());
$this->assign('displayPageHeaderLogo', $press->getPressPageHeaderLogo());
$this->assign('alternatePageHeader', $press->getLocalizedSetting('pressPageHeader'));
$this->assign('metaSearchDescription', $press->getLocalizedSetting('searchDescription'));
$this->assign('metaSearchKeywords', $press->getLocalizedSetting('searchKeywords'));
$this->assign('metaCustomHeaders', $press->getLocalizedSetting('customHeaders'));
$this->assign('numPageLinks', $press->getSetting('numPageLinks'));
$this->assign('itemsPerPage', $press->getSetting('itemsPerPage'));
$this->assign('enableAnnouncements', $press->getSetting('enableAnnouncements'));
// Load and apply theme plugin, if chosen
$themePluginPath = $press->getSetting('pressTheme');
if (!empty($themePluginPath)) {
// Load and activate the theme
$themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
if ($themePlugin) {
$themePlugin->activate($this);
}
}
// Assign stylesheets and footer
$pressStyleSheet = $press->getSetting('pressStyleSheet');
if ($pressStyleSheet) {
$this->addStyleSheet($request->getBaseUrl() . '/' . PublicFileManager::getPressFilesPath($press->getId()) . '/' . $pressStyleSheet['uploadName']);
}
$this->assign('pageFooter', $press->getLocalizedSetting('pressPageFooter'));
} else {
// Add the site-wide logo, if set for this locale or the primary locale
$displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
$this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
if (isset($displayPageHeaderTitle['altText'])) {
$this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
}
$this->assign('siteTitle', $site->getLocalizedTitle());
}
if (!$site->getRedirect()) {
$this->assign('hasOtherPresses', true);
}
}
}
示例13: TemplateManager
/**
* Constructor.
* Initialize template engine and assign basic template variables.
* @param $request PKPRequest
*/
function TemplateManager($request)
{
parent::PKPTemplateManager($request);
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).
*/
$context = $request->getContext();
$site = $request->getSite();
$publicFileManager = new PublicFileManager();
$siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
$this->assign('sitePublicFilesDir', $siteFilesDir);
$this->assign('publicFilesDir', $siteFilesDir);
// May be overridden by journal
$siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
if (file_exists($siteStyleFilename)) {
$this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename, STYLE_SEQUENCE_LAST);
}
$this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
if (isset($context)) {
$this->assign('currentJournal', $context);
$this->assign('siteTitle', $context->getLocalizedName());
$this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
$this->assign('primaryLocale', $context->getPrimaryLocale());
$this->assign('alternateLocales', $context->getSetting('alternateLocales'));
// Assign page header
$this->assign('displayPageHeaderTitle', $context->getLocalizedPageHeaderTitle());
$this->assign('displayPageHeaderLogo', $context->getLocalizedPageHeaderLogo());
$this->assign('displayPageHeaderLogoAltText', $context->getLocalizedSetting('pageHeaderLogoImageAltText'));
$this->assign('displayFavicon', $context->getLocalizedFavicon());
$this->assign('faviconDir', $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
$this->assign('metaSearchDescription', $context->getLocalizedSetting('searchDescription'));
$this->assign('metaSearchKeywords', $context->getLocalizedSetting('searchKeywords'));
$this->assign('metaCustomHeaders', $context->getLocalizedSetting('customHeaders'));
$this->assign('numPageLinks', $context->getSetting('numPageLinks'));
$this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
$this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
$this->assign('contextSettings', $context->getSettingsDAO()->getSettings($context->getId()));
// Assign stylesheets and footer
$contextStyleSheet = $context->getSetting('journalStyleSheet');
if ($contextStyleSheet) {
$this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
}
// Get a link to the settings page for the current context.
// This allows us to reduce template duplication by using this
// variable in templates/common/header.tpl, instead of
// reproducing a lot of OMP/OJS-specific logic there.
$router = $request->getRouter();
$dispatcher = $request->getDispatcher();
$this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'journal'));
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
$this->assign('pageFooter', $context->getLocalizedSetting('journalPageFooter'));
} else {
// Add the site-wide logo, if set for this locale or the primary locale
$displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
$this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
if (isset($displayPageHeaderTitle['altText'])) {
$this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
}
$this->assign('siteTitle', $site->getLocalizedTitle());
$this->assign('primaryLocale', $site->getPrimaryLocale());
}
}
}
示例14: fetch
/**
* Fetch the form.
* @param $request PKPRequest
* @return string JSON-encoded form contents.
*/
function fetch($request)
{
$templateMgr = TemplateManager::getManager($request);
$publicFileManager = new PublicFileManager();
$templateMgr->assign(array('profileImage' => $request->getUser()->getSetting('profileImage'), 'profileImageMaxWidth' => PROFILE_IMAGE_MAX_WIDTH, 'profileImageMaxHeight' => PROFILE_IMAGE_MAX_HEIGHT, 'publicSiteFilesPath' => $publicFileManager->getSiteFilesPath()));
return parent::fetch($request);
}
示例15: substr
function _handleOmpUrl($matchArray)
{
$request = Application::getRequest();
$url = $matchArray[2];
$anchor = null;
if (($i = strpos($url, '#')) !== false) {
$anchor = substr($url, $i + 1);
$url = substr($url, 0, $i);
}
$urlParts = explode('/', $url);
if (isset($urlParts[0])) {
switch (strtolower_codesafe($urlParts[0])) {
case 'press':
$url = $request->url(isset($urlParts[1]) ? $urlParts[1] : $request->getRequestedPressPath(), null, null, null, null, $anchor);
break;
case 'monograph':
if (isset($urlParts[1])) {
$url = $request->url(null, 'catalog', 'book', $urlParts[1], null, $anchor);
}
break;
case 'sitepublic':
array_shift($urlParts);
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath() . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
case 'public':
array_shift($urlParts);
$press = $request->getPress();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$url = $request->getBaseUrl() . '/' . $publicFileManager->getPressFilesPath($press->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
break;
}
}
return $matchArray[1] . $url . $matchArray[3];
}