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


PHP Core::getBaseDir方法代码示例

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


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

示例1: register

 /**
  * @copydoc Plugin::register
  */
 function register($category, $path)
 {
     $this->pluginPath = $path;
     $result = parent::register($category, $path);
     $request = $this->getRequest();
     if ($result && $this->getEnabled() && !defined('SESSION_DISABLE_INIT')) {
         $templateManager = TemplateManager::getManager($request);
         HookRegistry::register('PageHandler::displayCss', array($this, '_displayCssCallback'));
         // Add the stylesheet.
         $dispatcher = $request->getDispatcher();
         $templateManager->addStyleSheet($dispatcher->url($request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css', null, array('name' => $this->getName())), STYLE_SEQUENCE_LATE);
         // If this theme uses templates, ensure they're given priority.
         array_unshift($templateManager->template_dir, $path = Core::getBaseDir() . DIRECTORY_SEPARATOR . $this->getPluginPath() . '/templates');
     }
     return $result;
 }
开发者ID:relaciones-internacionales-journal,项目名称:pkp-lib,代码行数:19,代码来源:ThemePlugin.inc.php

示例2: __construct

 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function __construct($request)
 {
     assert(is_a($request, 'PKPRequest'));
     $this->_request = $request;
     parent::__construct();
     // Set up Smarty configuration
     $baseDir = Core::getBaseDir();
     $cachePath = CacheManager::getFileCachePath();
     // Set the default template dir (app's template dir)
     $this->app_template_dir = $baseDir . DIRECTORY_SEPARATOR . 'templates';
     // Set fallback template dir (core's template dir)
     $this->core_template_dir = $baseDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'templates';
     $this->template_dir = array($this->app_template_dir, $this->core_template_dir);
     $this->compile_dir = $cachePath . DIRECTORY_SEPARATOR . 't_compile';
     $this->config_dir = $cachePath . DIRECTORY_SEPARATOR . 't_config';
     $this->cache_dir = $cachePath . DIRECTORY_SEPARATOR . 't_cache';
     $this->_cacheability = CACHEABILITY_NO_STORE;
     // Safe default
 }
开发者ID:jalperin,项目名称:pkp-lib,代码行数:24,代码来源:PKPTemplateManager.inc.php

示例3: activate

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

示例4: PKPTemplateManager

 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function PKPTemplateManager($request)
 {
     assert(is_a($request, 'PKPRequest'));
     $this->_request = $request;
     parent::Smarty();
     // Set up Smarty configuration
     $baseDir = Core::getBaseDir();
     $cachePath = CacheManager::getFileCachePath();
     // Set the default template dir (app's template dir)
     $this->app_template_dir = $baseDir . DIRECTORY_SEPARATOR . 'templates';
     // Set fallback template dir (core's template dir)
     $this->core_template_dir = $baseDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'templates';
     $this->template_dir = array($this->app_template_dir, $this->core_template_dir);
     $this->compile_dir = $cachePath . DIRECTORY_SEPARATOR . 't_compile';
     $this->config_dir = $cachePath . DIRECTORY_SEPARATOR . 't_config';
     $this->cache_dir = $cachePath . DIRECTORY_SEPARATOR . 't_cache';
     $this->_cacheability = CACHEABILITY_NO_STORE;
     // Safe default
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:26,代码来源:PKPTemplateManager.inc.php

示例5: register

 /**
  * @copydoc Plugin::register
  */
 function register($category, $path)
 {
     if (!parent::register($category, $path)) {
         return false;
     }
     $request = $this->getRequest();
     if ($this->getEnabled() && !defined('SESSION_DISABLE_INIT')) {
         $templateManager = TemplateManager::getManager($request);
         HookRegistry::register('PageHandler::displayCss', array($this, '_displayCssCallback'));
         $context = $request->getContext();
         $site = $request->getSite();
         $contextOrSite = $context ? $context : $site;
         // Add the stylesheet.
         if ($contextOrSite->getSetting('themePluginPath') == basename($path)) {
             $dispatcher = $request->getDispatcher();
             $templateManager->addStyleSheet($dispatcher->url($request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css', null, array('name' => $this->getName())), STYLE_SEQUENCE_LATE);
             // If this theme uses templates, ensure they're given priority.
             array_unshift($templateManager->template_dir, $path = Core::getBaseDir() . DIRECTORY_SEPARATOR . $this->getPluginPath() . '/templates');
         }
     }
     return true;
 }
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:25,代码来源:ThemePlugin.inc.php

示例6: setUp

 /**
  * @copydoc PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $this->setBackupGlobals(true);
     // Rather than using "include_once()", ADOdb uses
     // a global variable to maintain the information
     // whether its library has been included before (wtf!).
     // This causes problems with PHPUnit as PHPUnit will
     // delete all global state between two consecutive
     // tests to isolate tests from each other.
     if (function_exists('_array_change_key_case')) {
         global $ADODB_INCLUDED_LIB;
         $ADODB_INCLUDED_LIB = 1;
     }
     Config::setConfigFileName(Core::getBaseDir() . DIRECTORY_SEPARATOR . 'config.inc.php');
     // Backup DAOs.
     foreach ($this->getMockedDAOs() as $mockedDao) {
         $this->daoBackup[$mockedDao] = DAORegistry::getDAO($mockedDao);
     }
     // Backup registry keys.
     foreach ($this->getMockedRegistryKeys() as $mockedRegistryKey) {
         $this->registryBackup[$mockedRegistryKey] = Registry::get($mockedRegistryKey);
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:26,代码来源:PKPTestCase.inc.php

示例7: FBVTemplateManager

 function FBVTemplateManager()
 {
     parent::TemplateManager();
     $this->caching = 0;
     // look for templates in the test directory
     $baseDir = Core::getBaseDir();
     $test_template_dir = $baseDir . DIRECTORY_SEPARATOR . PKP_LIB_PATH . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'ui' . DIRECTORY_SEPARATOR . 'fbv';
     $this->template_dir[] = $test_template_dir;
     // $baseUrl has to be reset to properly reference the javascript files and stylesheets
     $baseUrl = '';
     $uriComponents = explode('/', $_SERVER['REQUEST_URI']);
     for ($i = 0, $count = count($uriComponents); $i < $count; $i++) {
         if ($uriComponents[$i] == 'tools' && $uriComponents[$i + 1] == 'fbvVisualResults.php') {
             break;
         } else {
             if (empty($uriComponents[$i])) {
                 continue;
             } else {
                 $baseUrl .= '/' . $uriComponents[$i];
             }
         }
     }
     $this->assign('baseUrl', $baseUrl);
 }
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:24,代码来源:fbvVisualResults.php

示例8: upgradePlugin

 /**
  * Upgrade a plugin to a newer version from the user's filesystem
  * @param $category string
  * @param $plugin string
  * @param $path string path to plugin Directory
  * @param $category string
  * @param $plugin string
  * @return Version|null The upgraded version, on success; null on fail
  */
 function upgradePlugin($category, $plugin, $path, &$errorMsg)
 {
     $versionFile = $path . '/' . PLUGIN_VERSION_FILE;
     $pluginVersion = VersionCheck::getValidPluginVersionInfo($versionFile, $errorMsg);
     if (!$pluginVersion) {
         return null;
     }
     // Check whether the uploaded plug-in fits the original plug-in.
     if ('plugins.' . $category != $pluginVersion->getProductType()) {
         $errorMsg = __('manager.plugins.wrongCategory');
         return null;
     }
     if ($plugin != $pluginVersion->getProduct()) {
         $errorMsg = __('manager.plugins.wrongName');
         return null;
     }
     $versionDao = DAORegistry::getDAO('VersionDAO');
     $installedPlugin = $versionDao->getCurrentVersion($pluginVersion->getProductType(), $pluginVersion->getProduct(), true);
     if (!$installedPlugin) {
         $errorMsg = __('manager.plugins.pleaseInstall');
         return null;
     }
     if ($this->_checkIfNewer($pluginVersion->getProductType(), $pluginVersion->getProduct(), $pluginVersion)) {
         $errorMsg = __('manager.plugins.installedVersionNewer');
         return null;
     } else {
         $pluginDest = Core::getBaseDir() . '/plugins/' . $category . '/' . $plugin;
         $pluginLibDest = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/plugins/' . $category . '/' . $plugin;
         // Delete existing files.
         $fileManager = new FileManager();
         if (is_dir($pluginDest)) {
             $fileManager->rmtree($pluginDest);
         }
         if (is_dir($pluginLibDest)) {
             $fileManager->rmtree($pluginLibDest);
         }
         // Check whether deleting has worked.
         if (is_dir($pluginDest) || is_dir($pluginLibDest)) {
             $errorMsg = __('message', 'manager.plugins.deleteError');
             return null;
         }
         // Copy the plug-in from the temporary folder to the
         // target folder.
         // Start with the library part (if any).
         $libPath = $path . '/lib';
         if (is_dir($libPath)) {
             if (!$fileManager->copyDir($libPath, $pluginLibDest)) {
                 $errorMsg = __('manager.plugins.copyError');
                 return null;
             }
             // Remove the library part of the temporary folder.
             $fileManager->rmtree($libPath);
         }
         // Continue with the application-specific part (mandatory).
         if (!$fileManager->copyDir($path, $pluginDest)) {
             $errorMsg = __('manager.plugins.copyError');
             return null;
         }
         // Remove the temporary folder.
         $fileManager->rmtree(dirname($path));
         $upgradeFile = $pluginDest . '/' . PLUGIN_UPGRADE_FILE;
         if ($fileManager->fileExists($upgradeFile)) {
             $params = $this->_getConnectionParams();
             $installer = new Upgrade($params, $upgradeFile, true);
             if (!$installer->execute()) {
                 $errorMsg = __('manager.plugins.upgradeFailed', array('errorString' => $installer->getErrorString()));
                 return null;
             }
         }
         $installedPlugin->setCurrent(0);
         $pluginVersion->setCurrent(1);
         $versionDao->insertVersion($pluginVersion, true);
         return $pluginVersion;
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:84,代码来源:PluginHelper.inc.php

示例9: activate

 function activate(&$templateMgr)
 {
     $templateMgr->template_dir[0] = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . 'modern' . DIRECTORY_SEPARATOR . 'templates';
     $templateMgr->compile_id = 'modernTheme';
 }
开发者ID:prisnormando,项目名称:OJS-Modern-Theme,代码行数:5,代码来源:ModernTheme.inc.php

示例10: editLocaleFile

 function editLocaleFile($args, $request)
 {
     $this->validate();
     $plugin =& $this->plugin;
     $this->setupTemplate($request);
     $locale = array_shift($args);
     if (!AppLocale::isLocaleValid($locale)) {
         $request->redirect(null, null, 'index');
     }
     $filename = urldecode(urldecode(array_shift($args)));
     if (!TranslatorAction::isLocaleFile($locale, $filename)) {
         $request->redirect(null, null, 'edit', $locale);
     }
     $templateMgr = TemplateManager::getManager($request);
     if (!is_writeable(Core::getBaseDir() . DIRECTORY_SEPARATOR . $filename)) {
         $templateMgr->assign('error', true);
     }
     import('lib.pkp.classes.file.EditableLocaleFile');
     $localeContentsRangeInfo = $this->getRangeInfo($request, 'localeContents');
     $localeContents = EditableLocaleFile::load($filename);
     // Handle a search, if one was executed.
     $searchKey = $request->getUserVar('searchKey');
     $found = false;
     $index = 0;
     $pageIndex = 0;
     if (!empty($searchKey)) {
         foreach ($localeContents as $key => $value) {
             if ($index % $localeContentsRangeInfo->getCount() == 0) {
                 $pageIndex++;
             }
             if ($key == $searchKey) {
                 $found = true;
                 break;
             }
             $index++;
         }
     }
     if ($found) {
         $localeContentsRangeInfo->setPage($pageIndex);
         $templateMgr->assign('searchKey', $searchKey);
     }
     $templateMgr->assign('filename', $filename);
     $templateMgr->assign('locale', $locale);
     import('lib.pkp.classes.core.ArrayItemIterator');
     $templateMgr->assign('localeContents', new ArrayItemIterator($localeContents, $localeContentsRangeInfo->getPage(), $localeContentsRangeInfo->getCount()));
     $templateMgr->assign('referenceLocaleContents', EditableLocaleFile::load(TranslatorAction::determineReferenceFilename($locale, $filename)));
     $templateMgr->display($plugin->getTemplatePath() . 'localeFile.tpl');
 }
开发者ID:jalperin,项目名称:ojs,代码行数:48,代码来源:TranslatorHandler.inc.php

示例11: getFileCachePath

 /**
  * Get the path in which file caches will be stored.
  * @return string The full path to the file cache directory
  */
 static function getFileCachePath()
 {
     return Core::getBaseDir() . DIRECTORY_SEPARATOR . 'cache';
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:8,代码来源:CacheManager.inc.php

示例12: deletePlugin

 /**
  * Delete a plugin from the system
  * @param plugin string
  */
 function deletePlugin($plugin)
 {
     $templateMgr =& TemplateManager::getManager();
     $this->setupTemplate(true);
     $templateMgr->assign('path', 'delete');
     $templateMgr->assign('deleted', false);
     $templateMgr->assign('error', false);
     $templateMgr->assign('pageHierarchy', PluginManagementHandler::setBreadcrumbs(true));
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     $installedPlugin = $versionDao->getCurrentVersion($plugin);
     $category = $this->getPluginCategory($plugin);
     if ($installedPlugin) {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin;
         //make sure plugin type is valid and then delete the files
         if (in_array($category, PluginRegistry::getCategories())) {
             FileManager::rmtree($pluginDest);
         }
         if (FileManager::fileExists($pluginDest, 'dir')) {
             $templateMgr->assign('error', true);
             $templateMgr->assign('message', 'manager.plugins.deleteError');
         } else {
             $versionDao->disableVersion($plugin);
             $templateMgr->assign('deleted', true);
         }
     } else {
         $templateMgr->assign('error', true);
         $templateMgr->assign('message', 'manager.plugins.doesNotExist');
     }
     $templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true, $category));
     $templateMgr->display('manager/plugins/managePlugins.tpl');
 }
开发者ID:jalperin,项目名称:ocs,代码行数:35,代码来源:PluginManagementHandler.inc.php

示例13: define

 * @defgroup config
 */
/**
 * @file classes/config/Config.inc.php
 *
 * Copyright (c) 2000-2011 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class Config
 * @ingroup config
 *
 * @brief Config class for accessing configuration parameters.
 */
// $Id$
/** The path to the default configuration file */
define('CONFIG_FILE', Core::getBaseDir() . DIRECTORY_SEPARATOR . 'config.inc.php');
import('lib.pkp.classes.config.ConfigParser');
class Config
{
    /**
     * Retrieve a specified configuration variable.
     * @param $section string
     * @param $key string
     * @return string
     */
    function getVar($section, $key)
    {
        $configData =& Config::getData();
        return isset($configData[$section][$key]) ? $configData[$section][$key] : null;
    }
    /**
开发者ID:master3395,项目名称:CBPPlatform,代码行数:31,代码来源:Config.inc.php

示例14: testGetCacheFilenameWithoutPathinfo

 /**
  * @covers PKPPageRouter::getCacheFilename
  */
 public function testGetCacheFilenameWithoutPathinfo()
 {
     $mockApplication = $this->_setUpMockEnvironment(self::PATHINFO_DISABLED);
     $_GET = array('firstContext' => 'something', 'secondContext' => 'something', 'page' => 'index');
     $expectedId = 'something-something-index---en_US';
     self::assertEquals(Core::getBaseDir() . '/cache/wc-' . md5($expectedId) . '.html', $this->router->getCacheFilename($this->request));
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:10,代码来源:PKPPageRouterTest.php

示例15: deletePlugin

 /**
  * Delete a plugin from the system
  * @param $category string
  * @param $plugin string
  */
 function deletePlugin($category, $plugin)
 {
     $this->validate();
     $templateMgr =& TemplateManager::getManager();
     $this->setupTemplate(true);
     $templateMgr->assign('path', 'delete');
     $templateMgr->assign('deleted', false);
     $templateMgr->assign('error', false);
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     /* @var $versionDao VersionDAO */
     $installedPlugin = $versionDao->getCurrentVersion('plugins.' . $category, $plugin, true);
     if ($installedPlugin) {
         $pluginDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin;
         $pluginLibDest = Core::getBaseDir() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pkp' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $category . DIRECTORY_SEPARATOR . $plugin;
         //make sure plugin type is valid and then delete the files
         if (in_array($category, PluginRegistry::getCategories())) {
             // Delete the plugin from the file system.
             FileManager::rmtree($pluginDest);
             FileManager::rmtree($pluginLibDest);
         }
         if (is_dir($pluginDest) || is_dir($pluginLibDest)) {
             $templateMgr->assign('error', true);
             $templateMgr->assign('message', 'manager.plugins.deleteError');
         } else {
             $versionDao->disableVersion('plugins.' . $category, $plugin);
             $templateMgr->assign('deleted', true);
         }
     } else {
         $templateMgr->assign('error', true);
         $templateMgr->assign('message', 'manager.plugins.doesNotExist');
     }
     $templateMgr->assign('pageHierarchy', $this->setBreadcrumbs(true, $category));
     $templateMgr->display('manager/plugins/managePlugins.tpl');
 }
开发者ID:ramonsodoma,项目名称:ojs,代码行数:39,代码来源:PluginManagementHandler.inc.php


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