本文整理汇总了PHP中PublicFileManager类的典型用法代码示例。如果您正苦于以下问题:PHP PublicFileManager类的具体用法?PHP PublicFileManager怎么用?PHP PublicFileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PublicFileManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: viewBookForReview
/**
* Public view book for review details.
*/
function viewBookForReview($args = array(), &$request)
{
$this->setupTemplate(true);
$journal =& $request->getJournal();
$journalId = $journal->getId();
$bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
$bookId = !isset($args) || empty($args) ? null : (int) $args[0];
$bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
// Ensure book for review is valid and for this journal
if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
$book =& $bfrDao->getBookForReview($bookId);
$bfrPlugin->import('classes.BookForReview');
// Ensure book is still available
if ($book->getStatus() == BFR_STATUS_AVAILABLE) {
$isAuthor = Validation::isAuthor();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = $request->getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('coverPagePath', $coverPagePath);
$templateMgr->assign('locale', AppLocale::getLocale());
$templateMgr->assign_by_ref('bookForReview', $book);
$templateMgr->assign('isAuthor', $isAuthor);
$templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl');
}
}
$request->redirect(null, 'booksForReview');
}
开发者ID:yuricampos,项目名称:ojs,代码行数:32,代码来源:BooksForReviewHandler.inc.php
示例2: uploadArchiveImage
function uploadArchiveImage()
{
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
$archive =& $this->archive;
$type = $fileManager->getUploadedFileType('archiveImage');
$extension = $fileManager->getImageExtension($type);
if (!$extension) {
return false;
}
$uploadName = 'archiveImage-' . (int) $archive->getArchiveId() . $extension;
if (!$fileManager->uploadSiteFile('archiveImage', $uploadName)) {
return false;
}
$filePath = $fileManager->getSiteFilesPath();
list($width, $height) = getimagesize($filePath . '/' . $uploadName);
if (!Validation::isSiteAdmin() && ($width > 150 || $height > 150 || $width <= 0 || $height <= 0)) {
$archiveSetting = null;
$archive->updateSetting('archiveImage', $archiveSetting);
$fileManager->removeSiteFile($filePath);
return false;
}
$archiveSetting = array('name' => $fileManager->getUploadedFileName('archiveImage'), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate());
$archive->updateSetting('archiveImage', $archiveSetting);
return true;
}
开发者ID:Rygbee,项目名称:harvester,代码行数:26,代码来源:ArchiveForm.inc.php
示例3: 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();
$context = $request->getContext();
$uploadName = $this->getFileSettingName() . '_' . $locale . $extension;
if ($publicFileManager->copyContextFile($context->getAssocType(), $context->getId(), $temporaryFile->getFilePath(), $uploadName)) {
// Get image dimensions
$filePath = $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId());
list($width, $height) = getimagesize($filePath . '/' . $uploadName);
$value = $context->getSetting($this->getFileSettingName());
$imageAltText = $this->getData('imageAltText');
$value[$locale] = array('name' => $temporaryFile->getOriginalFileName(), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate(), 'altText' => $imageAltText[$locale]);
$settingsDao = $context->getSettingsDAO();
$settingsDao->updateSetting($context->getId(), $this->getFileSettingName(), $value, 'object', true);
// Clean up the temporary file.
$this->removeTemporaryFile($request);
return true;
}
}
return false;
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:34,代码来源:NewContextImageFileForm.inc.php
示例4: addTinyMCE
/**
* 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);
}
开发者ID:reconciler,项目名称:ojs,代码行数:32,代码来源:CustomBlockEditForm.inc.php
示例5: 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());
}
}
}
开发者ID:austinvernsonger,项目名称:omp,代码行数:64,代码来源:TemplateManager.inc.php
示例6: getStylesheetPath
/**
* Get the file path to this plugin's stylesheet.
* @return String stylesheet path
*/
function getStylesheetPath()
{
$journal =& Request::getJournal();
if ($this->getSetting($journal->getId(), 'customThemePerJournal')) {
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
return $fileManager->getJournalFilesPath($journal->getId());
} else {
return $this->getPluginPath();
}
}
开发者ID:EreminDm,项目名称:water-cao,代码行数:15,代码来源:CustomThemePlugin.inc.php
示例7: display
/**
* 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();
}
开发者ID:artkuo,项目名称:ocs,代码行数:15,代码来源:AccommodationSettingsForm.inc.php
示例8: getStyleSheetFile
/**
* Get the filename of the CSS stylesheet for this plugin.
*/
function getStyleSheetFile()
{
$journal =& Request::getJournal();
$journalId = $journal ? $journal->getId() : 0;
$styleSheet = $this->getSetting($journalId, 'externalFeedStyleSheet');
if (empty($styleSheet)) {
return $this->getDefaultStyleSheetFile();
} else {
import('classes.file.PublicFileManager');
$fileManager = new PublicFileManager();
return $fileManager->getJournalFilesPath($journalId) . '/' . $styleSheet['uploadName'];
}
}
开发者ID:JovanyJeff,项目名称:hrp,代码行数:16,代码来源:ExternalFeedPlugin.inc.php
示例9: uploadProfileImage
function uploadProfileImage()
{
import('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->uploadError('profileImage')) {
return false;
}
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;
}
开发者ID:jmacgreg,项目名称:ocs,代码行数:29,代码来源:ProfileForm.inc.php
示例10: addTinyMCE
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 : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,",
theme_advanced_buttons1_add : "fontsizeselect",
theme_advanced_buttons2_add : "separator,preview,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "media,separator",
theme_advanced_buttons4 : "cut,copy,paste,pastetext,pasteword,separator,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,print,separator",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
relative_urls : false,
document_base_url : "' . Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journalId) . '/",
theme : "advanced",
theme_advanced_layout_manager : "SimpleLayout",
extended_valid_elements : "span[*], div[*]",
spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
});
</script>';
$templateMgr->assign('additionalHeadData', $additionalHeadData . "\n" . $tinyMCE_script);
}
开发者ID:master3395,项目名称:CBPPlatform,代码行数:34,代码来源:StaticPagesEditForm.inc.php
示例11: 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'));
}
}
开发者ID:Rygbee,项目名称:harvester,代码行数:52,代码来源:TemplateManager.inc.php
示例12: getPageSocialMetaTags
/**
* 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;
}
开发者ID:daxslab,项目名称:ojs-social-metatags,代码行数:47,代码来源:SocialMetatags.inc.php
示例13: deleteCoverImage
/**
* An action to delete an article cover image.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function deleteCoverImage($args, $request)
{
assert(!empty($args['coverImage']) && !empty($args['submissionId']));
$submission = $this->getSubmission();
$submissionDao = Application::getSubmissionDAO();
$file = $args['coverImage'];
// Remove cover image and alt text from article settings
$submission->setCoverImage('');
$submission->setCoverImageAltText('');
$submissionDao->updateObject($submission);
// Remove the file
$publicFileManager = new PublicFileManager();
if ($publicFileManager->removeJournalFile($submission->getJournalId(), $file)) {
$json = new JSONMessage(true);
$json->setEvent('fileDeleted');
return $json;
} else {
return new JSONMessage(false, __('editor.article.removeCoverImageFileNotFound'));
}
}
开发者ID:bkroll,项目名称:ojs,代码行数:26,代码来源:IssueEntryTabHandler.inc.php
示例14: saveSettings
/**
* Validate and save changes to site settings.
* @param $args array
* @param $request object
*/
function saveSettings($args, &$request)
{
$this->validate();
$this->setupTemplate($request, true);
$site =& $request->getSite();
import('classes.admin.form.SiteSettingsForm');
$settingsForm = new SiteSettingsForm();
$settingsForm->readInputData();
if ($request->getUserVar('uploadSiteStyleSheet')) {
if (!$settingsForm->uploadSiteStyleSheet()) {
$settingsForm->addError('siteStyleSheet', __('admin.settings.siteStyleSheetInvalid'));
}
} elseif ($request->getUserVar('deleteSiteStyleSheet')) {
$publicFileManager = new PublicFileManager();
$publicFileManager->removeSiteFile($site->getSiteStyleFilename());
} elseif ($request->getUserVar('uploadPageHeaderTitleImage')) {
if (!$settingsForm->uploadPageHeaderTitleImage($settingsForm->getFormLocale())) {
$settingsForm->addError('pageHeaderTitleImage', __('admin.settings.homeHeaderImageInvalid'));
}
} elseif ($request->getUserVar('deletePageHeaderTitleImage')) {
$publicFileManager = new PublicFileManager();
$setting = $site->getSetting('pageHeaderTitleImage');
$formLocale = $settingsForm->getFormLocale();
if (isset($setting[$formLocale])) {
$publicFileManager->removeSiteFile($setting[$formLocale]['uploadName']);
$setting[$formLocale] = array();
$site->updateSetting('pageHeaderTitleImage', $setting, 'object', true);
// Refresh site header
$templateMgr =& TemplateManager::getManager($request);
$templateMgr->assign('displaySitePageHeaderTitle', $site->getLocalizedPageHeaderTitle());
}
} elseif ($settingsForm->validate()) {
$settingsForm->execute();
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$user =& $request->getUser();
$notificationManager->createTrivialNotification($user->getId());
$request->redirect(null, null, null, 'index');
}
$settingsForm->display();
}
开发者ID:artkuo,项目名称:ocs,代码行数:46,代码来源:AdminSettingsHandler.inc.php
示例15: saveSettings
/**
* Validate and save changes to site settings.
*/
function saveSettings()
{
$this->validate();
$this->setupTemplate(true);
$site =& Request::getSite();
import('admin.form.SiteSettingsForm');
$settingsForm = new SiteSettingsForm();
$settingsForm->readInputData();
if (Request::getUserVar('uploadSiteStyleSheet')) {
if (!$settingsForm->uploadSiteStyleSheet()) {
$settingsForm->addError('siteStyleSheet', Locale::translate('admin.settings.siteStyleSheetInvalid'));
}
} elseif (Request::getUserVar('deleteSiteStyleSheet')) {
$publicFileManager = new PublicFileManager();
$publicFileManager->removeSiteFile($site->getSiteStyleFilename());
} elseif (Request::getUserVar('uploadPageHeaderTitleImage')) {
if (!$settingsForm->uploadPageHeaderTitleImage($settingsForm->getFormLocale())) {
$settingsForm->addError('pageHeaderTitleImage', Locale::translate('admin.settings.homeHeaderImageInvalid'));
}
} elseif (Request::getUserVar('deletePageHeaderTitleImage')) {
$publicFileManager = new PublicFileManager();
$setting = $site->getSetting('pageHeaderTitleImage');
$formLocale = $settingsForm->getFormLocale();
if (isset($setting[$formLocale])) {
$publicFileManager->removeSiteFile($setting[$formLocale]['uploadName']);
$setting[$formLocale] = array();
$site->updateSetting('pageHeaderTitleImage', $setting, 'object', true);
// Refresh site header
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('displaySitePageHeaderTitle', $site->getLocalizedPageHeaderTitle());
}
} elseif ($settingsForm->validate()) {
$settingsForm->execute();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'settings'), 'pageTitle' => 'admin.siteSettings', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'admin.siteAdmin'));
$templateMgr->display('common/message.tpl');
exit;
}
$settingsForm->display();
}
开发者ID:jalperin,项目名称:ocs,代码行数:43,代码来源:AdminSettingsHandler.inc.php
示例16: 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();
$uploadName = $settingName . '.css';
$context = $request->getContext();
if ($publicFileManager->copyContextFile($context->getAssocType(), $context->getId(), $temporaryFile->getFilePath(), $uploadName)) {
$value = array('name' => $temporaryFile->getOriginalFileName(), 'uploadName' => $uploadName, 'dateUploaded' => Core::getCurrentDate());
$settingsDao = $context->getSettingsDAO();
$settingsDao->updateSetting($context->getId(), $settingName, $value, 'object');
// Clean up the temporary file
$this->removeTemporaryFile($request);
return true;
}
}
return false;
}
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:28,代码来源:NewContextCssFileForm.inc.php
示例17: 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;
}
开发者ID:jprk,项目名称:pkp-lib,代码行数:28,代码来源:NewSiteCssFileForm.inc.php
示例18: 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'));
}
}
开发者ID:jalperin,项目名称:harvester,代码行数:43,代码来源:TemplateManager.inc.php
示例19: uploadStyleSheet
/**
* Uploads conference custom stylesheet.
* @param $settingName string setting key associated with the file
*/
function uploadStyleSheet($settingName)
{
$conference =& Request::getConference();
$settingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
import('file.PublicFileManager');
$fileManager = new PublicFileManager();
if ($fileManager->uploadError($settingName)) {
return false;
}
if ($fileManager->uploadedFileExists($settingName)) {
$type = $fileManager->getUploadedFileType($settingName);
if ($type != 'text/plain' && $type != 'text/css') {
return false;
}
$uploadName = $settingName . '.css';
if ($fileManager->uploadConferenceFile($conference->getId(), $settingName, $uploadName)) {
$value = array('name' => $fileManager->getUploadedFileName($settingName), 'uploadName' => $uploadName, 'dateUploaded' => date("Y-m-d g:i:s"));
$settingsDao->updateSetting($conference->getId(), $settingName, $value, 'object');
return true;
}
}
return false;
}
开发者ID:sedici,项目名称:ocs,代码行数:27,代码来源:ConferenceSetupStep4Form.inc.php
示例20: removeCoverPage
/**
* Remove the cover page image for the book for review
* @param $bookId int
*/
function removeCoverPage($bookId, $locale)
{
$book = $this->getBookForReview($bookId);
if ($book) {
// Delete cover image file from the filesystem and settings
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$publicFileManager->removeJournalFile($book->getJournalId(), $book->getFileName($locale));
$book->setFileName(null, $locale);
$book->setWidth(null, $locale);
$book->setHeight(null, $locale);
$book->setOriginalFileName(null, $locale);
$book->setCoverPageAltText(null, $locale);
$this->updateObject($book);
}
}
开发者ID:utlib,项目名称:ojs,代码行数:20,代码来源:BookForReviewDAO.inc.php
注:本文中的PublicFileManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论