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


PHP jApp::wwwPath方法代码示例

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


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

示例1: install

 function install()
 {
     // installer le CSS
     $cssFile = jApp::wwwPath('css/localiz.css');
     if (!file_exists($cssFile)) {
         $this->copyFile('css/localiz.css', $cssFile);
     }
     // installer le JS
     $jsFile = jApp::wwwPath('js/localiz.js');
     if (!file_exists($jsFile)) {
         $this->copyFile('js/localiz.js', $jsFile);
     }
     // conf DB
     $localConfFile = jApp::configPath('localconfig.ini.php');
     if (file_exists($localConfFile)) {
         $ini = new jIniFileModifier($localConfFile);
         $ini->setValue('db_driver', 'pgsql', 'localiz_plugin');
         $ini->setValue('db_host', 'pgpool', 'localiz_plugin');
         $ini->setValue('db_port', '5432', 'localiz_plugin');
         $ini->setValue('db_database', 'refgeo2', 'localiz_plugin');
         $ini->setValue('db_user', 'visu', 'localiz_plugin');
         $ini->setValue('db_password', 'visu', 'localiz_plugin');
         $ini->setValue('db_query', "select oid, geometrytype, value, label, longlabel, xmin, ymin, xmax, ymax from MYTABLE where label like '%s%%'", 'localiz_plugin');
         /* Ex with plain text search
            "select oid, typcode, geometrytype(geom) as geometrytype, code as value, lib || complement as label, 
            typ || ' ' || lib || complement || ' (' || code || ')' as longlabel, 
            st_xmin(st_transform(bbox, 4326)) xmin, st_ymin(st_transform(bbox, 4326)) ymin, st_xmax(st_transform(bbox, 4326)) xmax, st_ymax(st_transform(bbox, 4326)) ymax
            from services.ref_search
            where (v @@ to_tsquery('fr', regexp_replace('%1$s', '\\s+', '&', 'g')) )
            order by st_area(bbox) desc"            */
         $ini->save();
     }
 }
开发者ID:aeag,项目名称:lizmap-web-client,代码行数:33,代码来源:install.php

示例2: testContext

 function testContext()
 {
     $appPath = jApp::appPath();
     $varPath = jApp::varPath();
     $logPath = jApp::logPath();
     $configPath = jApp::configPath();
     $wwwPath = jApp::wwwPath();
     $scriptsPath = jApp::scriptsPath();
     $tempPath = jApp::tempPath();
     // first save
     jApp::saveContext();
     // verify that we still have the current path
     $this->assertEquals($appPath, jApp::appPath());
     $this->assertEquals($varPath, jApp::varPath());
     $this->assertEquals($logPath, jApp::logPath());
     $this->assertEquals($configPath, jApp::configPath());
     $this->assertEquals($wwwPath, jApp::wwwPath());
     $this->assertEquals($scriptsPath, jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // change the path
     jApp::initPaths('/myapp/');
     $this->assertEquals('/myapp/', jApp::appPath());
     $this->assertEquals('/myapp/var/', jApp::varPath());
     $this->assertEquals('/myapp/var/log/', jApp::logPath());
     $this->assertEquals('/myapp/var/config/', jApp::configPath());
     $this->assertEquals('/myapp/www/', jApp::wwwPath());
     $this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // second save
     jApp::saveContext();
     jApp::initPaths('/myapp2/');
     $this->assertEquals('/myapp2/', jApp::appPath());
     $this->assertEquals('/myapp2/var/', jApp::varPath());
     $this->assertEquals('/myapp2/var/log/', jApp::logPath());
     $this->assertEquals('/myapp2/var/config/', jApp::configPath());
     $this->assertEquals('/myapp2/www/', jApp::wwwPath());
     $this->assertEquals('/myapp2/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // pop the second save, we should be with the first saved values
     jApp::restoreContext();
     $this->assertEquals('/myapp/', jApp::appPath());
     $this->assertEquals('/myapp/var/', jApp::varPath());
     $this->assertEquals('/myapp/var/log/', jApp::logPath());
     $this->assertEquals('/myapp/var/config/', jApp::configPath());
     $this->assertEquals('/myapp/www/', jApp::wwwPath());
     $this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // pop the first save, we should be with initial paths
     jApp::restoreContext();
     $this->assertEquals($appPath, jApp::appPath());
     $this->assertEquals($varPath, jApp::varPath());
     $this->assertEquals($logPath, jApp::logPath());
     $this->assertEquals($configPath, jApp::configPath());
     $this->assertEquals($wwwPath, jApp::wwwPath());
     $this->assertEquals($scriptsPath, jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:57,代码来源:jAppContextTest.php

示例3: initPaths

 /**
  * initialize the application paths
  *
  * Warning: given paths should be ended by a directory separator.
  * @param string $appPath  application directory
  * @param string $wwwPath  www directory
  * @param string $varPath  var directory
  * @param string $logPath log directory
  * @param string $configPath config directory
  * @param string $scriptPath scripts directory
  */
 public static function initPaths($appPath, $wwwPath = null, $varPath = null, $logPath = null, $configPath = null, $scriptPath = null)
 {
     self::$appPath = $appPath;
     self::$wwwPath = is_null($wwwPath) ? $appPath . 'www/' : $wwwPath;
     self::$varPath = is_null($varPath) ? $appPath . 'var/' : $varPath;
     self::$logPath = is_null($logPath) ? self::$varPath . 'log/' : $logPath;
     self::$configPath = is_null($configPath) ? self::$varPath . 'config/' : $configPath;
     self::$scriptPath = is_null($scriptPath) ? $appPath . 'scripts/' : $scriptPath;
     self::$_isInit = true;
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:21,代码来源:jApp.class.php

示例4: initClassicRequest

 /**
  * initialize a full jelix environment with a coordinator, a request object etc.
  *
  * it initializes a coordinator, a classic request object. It sets jApp::coord(),
  * @param string $url the full requested URL (with http://, the domaine name etc.)
  * @param string $config the configuration file to use, as if you were inside an entry point
  * @param string $entryPoint the entrypoint name as indicated into project.xml
  */
 protected static function initClassicRequest($url, $config = 'index/config.ini.php', $entryPoint = 'index.php')
 {
     self::$fakeServer = new jelix\FakeServerConf\ApacheMod(jApp::wwwPath(), '/' . $entryPoint);
     self::$fakeServer->setHttpRequest($url);
     $config = jConfigCompiler::read($config, true, false, '/' . $entryPoint);
     $coord = new jCoordinatorForTest($config, false);
     jApp::setCoord($coord);
     $request = new jClassicRequest();
     $coord->testSetRequest($request);
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:18,代码来源:junittestcase.class.php

示例5: initPaths

 /**
  * initialize the application paths
  *
  * Warning: given paths should be ended by a directory separator.
  * @param string $appPath  application directory
  * @param string $wwwPath  www directory
  * @param string $varPath  var directory
  * @param string $logPath log directory
  * @param string $configPath config directory
  * @param string $scriptPath scripts directory
  */
 public static function initPaths($appPath, $wwwPath = null, $varPath = null, $logPath = null, $configPath = null, $scriptPath = null)
 {
     self::$appPath = $appPath;
     self::$wwwPath = is_null($wwwPath) ? $appPath . 'www/' : $wwwPath;
     self::$varPath = is_null($varPath) ? $appPath . 'var/' : $varPath;
     self::$logPath = is_null($logPath) ? self::$varPath . 'log/' : $logPath;
     self::$configPath = is_null($configPath) ? self::$varPath . 'config/' : $configPath;
     self::$scriptPath = is_null($scriptPath) ? $appPath . 'scripts/' : $scriptPath;
     self::$_isInit = true;
     self::$_coord = null;
     self::$_config = null;
     self::$configAutoloader = null;
     self::$_mainConfigFile = null;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:25,代码来源:jApp.class.php

示例6: _prepareTpl

 protected function _prepareTpl()
 {
     $lang = jApp::config()->locale;
     if (!$this->param('no_lang_check')) {
         $locale = jLocale::getPreferedLocaleFromRequest();
         if (!$locale) {
             $locale = 'en_US';
         }
         jApp::config()->locale = $locale;
     }
     $messages = new \Jelix\Installer\Checker\Messages($lang);
     $reporter = new \Jelix\Installer\Reporter\HtmlBuffer($messages);
     $check = new \Jelix\Installer\Checker\Checker($reporter, $messages);
     $check->run();
     $this->_tpl->assign('wwwpath', jApp::wwwPath());
     $this->_tpl->assign('configpath', jApp::configPath());
     $this->_tpl->assign('check', $reporter->trace);
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:18,代码来源:check_install.zone.php

示例7: _prepareTpl

 protected function _prepareTpl()
 {
     $lang = jApp::config()->locale;
     if (!$this->getParam('no_lang_check')) {
         $locale = jLocale::getPreferedLocaleFromRequest();
         if (!$locale) {
             $locale = 'en_US';
         }
         jApp::config()->locale = $locale;
     }
     $reporter = new checkZoneInstallReporter();
     $check = new jInstallCheck($reporter, $lang);
     $reporter->messageProvider = $check->messages;
     $check->run();
     $this->_tpl->assign('wwwpath', jApp::wwwPath());
     $this->_tpl->assign('configpath', jApp::configPath());
     $this->_tpl->assign('check', $reporter->trace);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:18,代码来源:check_install.zone.php

示例8: install

 function install()
 {
     // configure the entry point
     $entrypoint = $this->getParameter('entrypoint');
     if (!$entrypoint) {
         $entrypoint = 'soap';
     }
     if (!file_exists(jApp::wwwPath($entrypoint . '.php'))) {
         $this->copyFile('files/soap.php', jApp::wwwPath($entrypoint . '.php'));
     }
     // setup the configuration
     if (!file_exists(jApp::appConfigPath($entrypoint . '/config.ini.php'))) {
         $this->copyFile('files/config.ini.php', jApp::appConfigPath($entrypoint . '/config.ini.php'));
     }
     if ($this->entryPoint->getMainConfigIni()->getValue('soap', 'responses') === null) {
         $this->entryPoint->getMainConfigIni()->setValue('soap', "jsoap~jResponseSoap", "responses");
     }
     $this->declareNewEntryPoint($entrypoint, 'soap', $entrypoint . '/config.ini.php');
 }
开发者ID:jelix,项目名称:soap-server-module,代码行数:19,代码来源:install.php

示例9: __construct

 function __construct($id)
 {
     $dir = jApp::wwwPath('themes');
     $data = array();
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != "." && $file != ".." && $file != ".svn" && $file != '.cvs') {
                     if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
                         $data[$file] = $file;
                     }
                 }
             }
             closedir($dh);
         }
     }
     $this->formId = $id;
     $this->data = $data;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:19,代码来源:themes_datasource.class.php

示例10: testGetOmo2

 function testGetOmo2()
 {
     $cacheName = 'cache/images/' . md5('imagemodifier/logo_test.pngwidth50height30omo1') . '.png';
     $cacheFile = jApp::wwwPath($cacheName);
     if (file_exists($cacheFile)) {
         unlink($cacheFile);
     }
     $attributes = jImageModifier::get('imagemodifier/logo_test.png', array('width' => 50, 'height' => 30, 'omo' => true));
     $this->assertEqual($GLOBALS['gJCoord']->request->getServerURI() . $GLOBALS['gJConfig']->urlengine['basePath'] . $cacheName, $attributes['src']);
     $this->assertEqual('50', $attributes['width']);
     $this->assertEqual('30', $attributes['height']);
     $this->assertTrue(file_exists($cacheFile));
     $image = imagecreatefrompng($cacheFile);
     $this->assertEqual(50, imagesx($image));
     $this->assertEqual(30, imagesy($image));
     @imagedestroy($image);
     if (file_exists($cacheFile)) {
         unlink($cacheFile);
     }
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:20,代码来源:utils.jimagemodifier.html_cli.php

示例11: install

 function install()
 {
     if (!$this->firstExec('config')) {
         return;
     }
     $config = $this->entryPoint->getMainConfigIni();
     $plugins = $config->getValue('plugins', 'jResponseHtml');
     if (strpos($plugins, 'minify') === false) {
         $plugins .= ',minify';
         $config->setValue('plugins', $plugins, 'jResponseHtml', null, true);
     }
     if (null == $config->getValue('minifyCSS', 'jResponseHtml', null, true)) {
         $config->setValue('minifyCSS', 'off', 'jResponseHtml', null, true);
     }
     if (null == $config->getValue('minifyJS', 'jResponseHtml', null, true)) {
         $config->setValue('minifyJS', 'on', 'jResponseHtml', null, true);
     }
     if (null == $config->getValue('minifyExcludeCSS', 'jResponseHtml', null, true)) {
         $config->setValue('minifyExcludeCSS', '', 'jResponseHtml', null, true);
     }
     if (null == $config->getValue('minifyExcludeJS', 'jResponseHtml', null, true)) {
         $config->setValue('minifyExcludeJS', 'jelix/wymeditor/jquery.wymeditor.js', 'jResponseHtml', null, true);
     }
     $entrypoint = $config->getValue('minifyEntryPoint', 'jResponseHtml', null, true);
     if ($entrypoint === null) {
         $config->setValue('minifyEntryPoint', 'minify.php', 'jResponseHtml', null, true);
         $entrypoint = 'minify.php';
     }
     if (!file_exists(jApp::wwwPath($entrypoint))) {
         $this->copyFile('files/minify.php', jApp::wwwPath($entrypoint));
     }
     if (!file_exists(jApp::appConfigPath('minifyConfig.php'))) {
         $this->copyFile('files/minifyConfig.php', jApp::appConfigPath('minifyConfig.php'));
     }
     if (!file_exists(jApp::appConfigPath('minifyGroupsConfig.php'))) {
         $this->copyFile('files/minifyGroupsConfig.php', jApp::appConfigPath('minifyGroupsConfig.php'));
     }
 }
开发者ID:jelix,项目名称:minify-module,代码行数:38,代码来源:install.php

示例12: onjcommunity_save_account

 /**
  * to answer to jcommunity_save_account event
  * @param object $event the given event to answer to
  */
 function onjcommunity_save_account($event)
 {
     $gJConfig = jApp::config();
     $form = $event->getParam('form');
     $form->check();
     if ($form->getData('member_language') != '') {
         $_SESSION['JX_LANG'] = $form->getData('member_language');
         $gJConfig->locale = $form->getData('member_language');
     }
     $ext = '';
     $id = jAuth::getUserSession()->id;
     if ($form->getData('member_avatar') != '') {
         $max_width = $gJConfig->havefnubb['avatar_max_width'];
         $max_height = $gJConfig->havefnubb['avatar_max_height'];
         @unlink(jApp::wwwPath() . 'images/avatars/' . $id . '.png');
         @unlink(jApp::wwwPath() . 'images/avatars/' . $id . '.jpg');
         @unlink(jApp::wwwPath() . 'images/avatars/' . $id . '.jpeg');
         @unlink(jApp::wwwPath() . 'images/avatars/' . $id . '.gif');
         $avatar = $form->getData('member_avatar');
         if (strpos($avatar, '.png') > 0) {
             $ext = '.png';
         } elseif (strpos($avatar, '.jpg') > 0) {
             $ext = '.jpg';
         } elseif (strpos($avatar, '.jpeg') > 0) {
             $ext = '.jpeg';
         } elseif (strpos($avatar, '.gif') > 0) {
             $ext = '.gif';
         }
         $form->saveFile('member_avatar', jApp::wwwPath() . 'hfnu/images/avatars/', $id . $ext);
         list($width, $height) = getimagesize(jApp::wwwPath() . 'hfnu/images/avatars/' . $id . $ext);
         if (empty($width) || empty($height) || $width > $max_width || $height > $max_height) {
             @unlink(jApp::wwwPath() . 'images/avatars/' . $id . $ext);
             jMessage::add(jLocale::get('havefnubb~member.profile.avatar.too.wide', array($max_width . ' x ' . $max_height)), 'error');
             return;
         }
     }
     jMessage::add(jLocale::get('havefnubb~member.profile.updated'), 'ok');
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:42,代码来源:authhavefnubb.listener.php

示例13: getDocumentRoot

function getDocumentRoot()
{
    if (isset($_SERVER['DOCUMENT_ROOT'])) {
        return $_SERVER['DOCUMENT_ROOT'];
    }
    require_once JELIX_LIB_PATH . "core/jConfigCompiler.class.php";
    $config = parse_ini_file(jApp::configPath('defaultconfig.ini.php'));
    $urlengine = $config['urlengine'];
    if ($urlengine['scriptNameServerVariable'] == '') {
        $urlengine['scriptNameServerVariable'] = jConfigCompiler::findServerName('.php');
    }
    $urlScript = $_SERVER[$urlengine['scriptNameServerVariable']];
    $lastslash = strrpos($urlScript, '/');
    $urlScriptPath = substr($urlScript, 0, $lastslash) . '/';
    $basepath = $urlengine['basePath'];
    if ($basepath == '') {
        // for beginners or simple site, we "guess" the base path
        $basepath = $urlScriptPath;
    } elseif ($basepath != '/') {
        if ($basepath[0] != '/') {
            $basepath = '/' . $basepath;
        }
        if (substr($basepath, -1) != '/') {
            $basepath .= '/';
        }
        if (strpos($urlScriptPath, $basepath) !== 0) {
            throw new Exception('Jelix Error: basePath (' . $basepath . ') in config file doesn\'t correspond to current base path. You should setup it to ' . $urlengine['urlScriptPath']);
        }
    }
    if ($basepath == '/') {
        return jApp::wwwPath();
    }
    if (strpos(jApp::wwwPath(), $basepath) === false) {
        return jApp::wwwPath();
    }
    return substr(jApp::wwwPath(), 0, -strlen($basepath));
}
开发者ID:medali1990,项目名称:medsite,代码行数:37,代码来源:jelix_minify.php

示例14: getPaths

 /**
  * calculate miscelaneous path, depending of the server configuration and other informations
  * in the given array : script path, script name, documentRoot ..
  * @param array $urlconf  urlengine configuration. scriptNameServerVariable, basePath,
  * jelixWWWPath, jqueryPath and entrypointExtension should be present
  */
 public static function getPaths(&$urlconf, $pseudoScriptName = '', $isCli = false)
 {
     // retrieve the script path+name.
     // for cli, it will be the path from the directory were we execute the script (given to the php exec).
     // for web, it is the path from the root of the url
     if ($pseudoScriptName) {
         $urlconf['urlScript'] = $pseudoScriptName;
     } else {
         if ($urlconf['scriptNameServerVariable'] == '') {
             $urlconf['scriptNameServerVariable'] = self::findServerName($urlconf['entrypointExtension'], $isCli);
         }
         $urlconf['urlScript'] = $_SERVER[$urlconf['scriptNameServerVariable']];
     }
     $lastslash = strrpos($urlconf['urlScript'], '/');
     // now we separate the path and the name of the script, and then the basePath
     if ($isCli) {
         if ($lastslash === false) {
             $urlconf['urlScriptPath'] = $pseudoScriptName ? jApp::appPath('/scripts/') : getcwd() . '/';
             $urlconf['urlScriptName'] = $urlconf['urlScript'];
         } else {
             $urlconf['urlScriptPath'] = getcwd() . '/' . substr($urlconf['urlScript'], 0, $lastslash) . '/';
             $urlconf['urlScriptName'] = substr($urlconf['urlScript'], $lastslash + 1);
         }
         $basepath = $urlconf['urlScriptPath'];
         $snp = $urlconf['urlScriptName'];
         $urlconf['urlScript'] = $basepath . $snp;
     } else {
         $urlconf['urlScriptPath'] = substr($urlconf['urlScript'], 0, $lastslash) . '/';
         $urlconf['urlScriptName'] = substr($urlconf['urlScript'], $lastslash + 1);
         $basepath = $urlconf['basePath'];
         if ($basepath == '') {
             // for beginners or simple site, we "guess" the base path
             $basepath = $localBasePath = $urlconf['urlScriptPath'];
         } else {
             if ($basepath != '/') {
                 if ($basepath[0] != '/') {
                     $basepath = '/' . $basepath;
                 }
                 if (substr($basepath, -1) != '/') {
                     $basepath .= '/';
                 }
             }
             if ($pseudoScriptName) {
                 // with pseudoScriptName, we aren't in a true context, we could be in a cli context
                 // (the installer), and we want the path like when we are in a web context.
                 // $pseudoScriptName is supposed to be relative to the basePath
                 $urlconf['urlScriptPath'] = substr($basepath, 0, -1) . $urlconf['urlScriptPath'];
                 $urlconf['urlScript'] = $urlconf['urlScriptPath'] . $urlconf['urlScriptName'];
             }
             $localBasePath = $basepath;
             if ($urlconf['backendBasePath']) {
                 $localBasePath = $urlconf['backendBasePath'];
                 // we have to change urlScriptPath. it may contains the base path of the backend server
                 // we should replace this base path by the basePath of the frontend server
                 if (strpos($urlconf['urlScriptPath'], $urlconf['backendBasePath']) === 0) {
                     $urlconf['urlScriptPath'] = $basepath . substr($urlconf['urlScriptPath'], strlen($urlconf['backendBasePath']));
                 } else {
                     $urlconf['urlScriptPath'] = $basepath . substr($urlconf['urlScriptPath'], 1);
                 }
             } elseif (strpos($urlconf['urlScriptPath'], $basepath) !== 0) {
                 throw new Exception('Jelix Error: basePath (' . $basepath . ') in config file doesn\'t correspond to current base path. You should setup it to ' . $urlconf['urlScriptPath']);
             }
         }
         $urlconf['basePath'] = $basepath;
         if ($urlconf['jelixWWWPath'][0] != '/') {
             $urlconf['jelixWWWPath'] = $basepath . $urlconf['jelixWWWPath'];
         }
         if ($urlconf['jqueryPath'][0] != '/') {
             $urlconf['jqueryPath'] = $basepath . $urlconf['jqueryPath'];
         }
         $snp = substr($urlconf['urlScript'], strlen($localBasePath));
         if ($localBasePath == '/') {
             $urlconf['documentRoot'] = jApp::wwwPath();
         } else {
             if (strpos(jApp::wwwPath(), $localBasePath) === false) {
                 if (isset($_SERVER['DOCUMENT_ROOT'])) {
                     $urlconf['documentRoot'] = $_SERVER['DOCUMENT_ROOT'];
                 } else {
                     $urlconf['documentRoot'] = jApp::wwwPath();
                 }
             } else {
                 $urlconf['documentRoot'] = substr(jApp::wwwPath(), 0, -strlen($localBasePath));
             }
         }
     }
     $pos = strrpos($snp, $urlconf['entrypointExtension']);
     if ($pos !== false) {
         $snp = substr($snp, 0, $pos);
     }
     $urlconf['urlScriptId'] = $snp;
     $urlconf['urlScriptIdenc'] = rawurlencode($snp);
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:98,代码来源:jConfigCompiler.class.php

示例15: getPaths

 public static function getPaths(&$urlconf, $pseudoScriptName = '', $isCli = false)
 {
     if ($pseudoScriptName) {
         $urlconf['urlScript'] = $pseudoScriptName;
     } else {
         if ($urlconf['scriptNameServerVariable'] == '') {
             $urlconf['scriptNameServerVariable'] = self::findServerName($urlconf['entrypointExtension'], $isCli);
         }
         $urlconf['urlScript'] = $_SERVER[$urlconf['scriptNameServerVariable']];
     }
     $lastslash = strrpos($urlconf['urlScript'], '/');
     if ($isCli) {
         if ($lastslash === false) {
             $urlconf['urlScriptPath'] = $pseudoScriptName ? jApp::appPath('/scripts/') : getcwd() . '/';
             $urlconf['urlScriptName'] = $urlconf['urlScript'];
         } else {
             $urlconf['urlScriptPath'] = getcwd() . '/' . substr($urlconf['urlScript'], 0, $lastslash) . '/';
             $urlconf['urlScriptName'] = substr($urlconf['urlScript'], $lastslash + 1);
         }
         $basepath = $urlconf['urlScriptPath'];
         $snp = $urlconf['urlScriptName'];
         $urlconf['urlScript'] = $basepath . $snp;
     } else {
         $urlconf['urlScriptPath'] = substr($urlconf['urlScript'], 0, $lastslash) . '/';
         $urlconf['urlScriptName'] = substr($urlconf['urlScript'], $lastslash + 1);
         $basepath = $urlconf['basePath'];
         if ($basepath == '') {
             $basepath = $localBasePath = $urlconf['urlScriptPath'];
         } else {
             if ($basepath != '/') {
                 if ($basepath[0] != '/') {
                     $basepath = '/' . $basepath;
                 }
                 if (substr($basepath, -1) != '/') {
                     $basepath .= '/';
                 }
             }
             if ($pseudoScriptName) {
                 $urlconf['urlScriptPath'] = substr($basepath, 0, -1) . $urlconf['urlScriptPath'];
                 $urlconf['urlScript'] = $urlconf['urlScriptPath'] . $urlconf['urlScriptName'];
             }
             $localBasePath = $basepath;
             if ($urlconf['backendBasePath']) {
                 $localBasePath = $urlconf['backendBasePath'];
                 if (strpos($urlconf['urlScriptPath'], $urlconf['backendBasePath']) === 0) {
                     $urlconf['urlScriptPath'] = $basepath . substr($urlconf['urlScriptPath'], strlen($urlconf['backendBasePath']));
                 } else {
                     $urlconf['urlScriptPath'] = $basepath . substr($urlconf['urlScriptPath'], 1);
                 }
             } elseif (strpos($urlconf['urlScriptPath'], $basepath) !== 0) {
                 throw new Exception('Error in main configuration on basePath -- basePath (' . $basepath . ') in config file doesn\'t correspond to current base path. You should setup it to ' . $urlconf['urlScriptPath']);
             }
         }
         $urlconf['basePath'] = $basepath;
         if ($urlconf['jelixWWWPath'][0] != '/') {
             $urlconf['jelixWWWPath'] = $basepath . $urlconf['jelixWWWPath'];
         }
         if ($urlconf['jqueryPath'][0] != '/') {
             $urlconf['jqueryPath'] = $basepath . $urlconf['jqueryPath'];
         }
         $snp = substr($urlconf['urlScript'], strlen($localBasePath));
         if ($localBasePath == '/') {
             $urlconf['documentRoot'] = jApp::wwwPath();
         } else {
             if (strpos(jApp::wwwPath(), $localBasePath) === false) {
                 if (isset($_SERVER['DOCUMENT_ROOT'])) {
                     $urlconf['documentRoot'] = $_SERVER['DOCUMENT_ROOT'];
                 } else {
                     $urlconf['documentRoot'] = jApp::wwwPath();
                 }
             } else {
                 $urlconf['documentRoot'] = substr(jApp::wwwPath(), 0, -strlen($localBasePath));
             }
         }
     }
     $pos = strrpos($snp, $urlconf['entrypointExtension']);
     if ($pos !== false) {
         $snp = substr($snp, 0, $pos);
     }
     $urlconf['urlScriptId'] = $snp;
     $urlconf['urlScriptIdenc'] = rawurlencode($snp);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:82,代码来源:jConfigCompiler.class.php


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