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


PHP PublicFileManager::getPressFilesPath方法代码示例

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


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

示例1: uploadImage

 /**
  * Uploads a press image.
  * @param $settingName string setting key associated with the file
  * @param $locale string
  */
 function uploadImage($settingName, $locale)
 {
     $press =& Request::getPress();
     $settingsDao =& DAORegistry::getDAO('PressSettingsDAO');
     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 . '_' . $locale . $extension;
         if ($fileManager->uploadPressFile($press->getId(), $settingName, $uploadName)) {
             // Get image dimensions
             $filePath = $fileManager->getPressFilesPath($press->getId());
             list($width, $height) = getimagesize($filePath . '/' . $uploadName);
             $value = $press->getSetting($settingName);
             $value[$locale] = array('name' => $fileManager->getUploadedFileName($settingName, $locale), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate());
             $settingsDao->updateSetting($press->getId(), $settingName, $value, 'object', true);
             return true;
         }
     }
     return false;
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:30,代码来源:PressSetupStep5Form.inc.php

示例2: 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);
         }
     }
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:86,代码来源:TemplateManager.inc.php

示例3: deleteContext

 /**
  * Delete a press.
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function deleteContext($args, $request)
 {
     // Identify the current context.
     $context = $request->getContext();
     // Identify the press Id.
     $pressId = $request->getUserVar('rowId');
     $pressDao = DAORegistry::getDAO('PressDAO');
     $press = $pressDao->getById($pressId);
     if ($pressId) {
         $pressDao->deleteById($pressId);
         // Add publication formats tombstones for all press published monographs.
         import('classes.publicationFormat.PublicationFormatTombstoneManager');
         $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager();
         $publicationFormatTombstoneMgr->insertTombstonesByPress($press);
         // Delete press file tree
         // FIXME move this somewhere better.
         import('lib.pkp.classes.file.ContextFileManager');
         $pressFileManager = new ContextFileManager($pressId);
         $pressFileManager->rmtree($pressFileManager->getBasePath());
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $publicFileManager->rmtree($publicFileManager->getPressFilesPath($pressId));
         // If user is deleting the same press where he is...
         if ($context && $context->getId() == $pressId) {
             // return a redirect js event to index handler.
             $dispatcher = $request->getDispatcher();
             $url = $dispatcher->url($request, ROUTE_PAGE, null, 'index');
             return $request->redirectUrlJson($url);
         }
         return DAO::getDataChangedEvent($pressId);
     }
     return new JSONMessage();
 }
开发者ID:josekarvalho,项目名称:omp,代码行数:39,代码来源:PressGridHandler.inc.php

示例4: deletePress

 /**
  * Delete a press.
  * @param $args array first parameter is the ID of the press to delete
  */
 function deletePress($args)
 {
     $this->validate();
     $pressDao =& DAORegistry::getDAO('PressDAO');
     if (isset($args) && !empty($args) && !empty($args[0])) {
         $pressId = $args[0];
         if ($pressDao->deletePressById($pressId)) {
             // Delete press file tree
             // FIXME move this somewhere better.
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $pressPath = Config::getVar('files', 'files_dir') . '/presses/' . $pressId;
             $fileManager->rmtree($pressPath);
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $publicFileManager->rmtree($publicFileManager->getPressFilesPath($pressId));
         }
     }
     Request::redirect(null, null, 'presses');
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:24,代码来源:AdminPressHandler.inc.php

示例5: 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];
 }
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:37,代码来源:HtmlMonographFilePlugin.inc.php


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