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


PHP jApp::appPath方法代码示例

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


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

示例1: getDictionary

 /**
  * Get JSON containing all translation for a given jelix property file.
  * @param string $property Name of the property file. Ex: map if searched file is map.UTF-8.properties
  * @param string $lang Language. Ex: fr_FR (optional)
  * @return binary object The image for this project.
  */
 function getDictionary()
 {
     $rep = $this->getResponse('json');
     // Get the property file
     $property = $this->param('property');
     $lang = $this->param('lang');
     if (!$lang) {
         $lang = jLocale::getCurrentLang() . '_' . jLocale::getCurrentCountry();
     }
     $data = array();
     $path = jApp::appPath() . 'modules/view/locales/' . $lang . '/' . $property . '.UTF-8.properties';
     if (file_exists($path)) {
         $lines = file($path);
         foreach ($lines as $lineNumber => $lineContent) {
             if (!empty($lineContent) and $lineContent != '\\n') {
                 $exp = explode('=', trim($lineContent));
                 if (!empty($exp[0])) {
                     $data[$exp[0]] = jLocale::get('view~dictionnary.' . $exp[0], null, $lang);
                 }
             }
         }
     }
     $rep->data = $data;
     return $rep;
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:31,代码来源:translate.classic.php

示例2: _createPath

 protected function _createPath()
 {
     if (!isset(jApp::config()->_modulesPathList[$this->module])) {
         throw new jExceptionSelector('jelix~errors.selector.module.unknown', $this->toString(true));
     }
     // we see if the forms have been redefined in var/
     $overloadedPath = jApp::varPath('overloads/' . $this->module . '/' . $this->_dirname . $this->resource . $this->_suffix);
     if (is_readable($overloadedPath)) {
         $this->_path = $overloadedPath;
         $this->_where = 'var/';
         return;
     }
     // we see if the forms have been redefined in app/
     $overloadedPath = jApp::appPath('app/overloads/' . $this->module . '/' . $this->_dirname . $this->resource . $this->_suffix);
     if (is_readable($overloadedPath)) {
         $this->_path = $overloadedPath;
         $this->_where = 'app/';
         return;
     }
     $this->_path = jApp::config()->_modulesPathList[$this->module] . $this->_dirname . $this->resource . $this->_suffix;
     if (!is_readable($this->_path)) {
         throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), $this->type));
     }
     $this->_where = 'modules/';
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:25,代码来源:jSelectorForm.class.php

示例3: atStart

 function atStart($config)
 {
     if ($config->sessions['storage'] == 'files') {
         $config->sessions['files_path'] = str_replace(array('lib:', 'app:'), array(LIB_PATH, jApp::appPath()), $config->sessions['files_path']);
     }
     $config->sessions['_class_to_load'] = array();
     if ($config->sessions['loadClasses'] != '') {
         trigger_error("Configuration: loadClasses is deprecated, use instead autoload configuration in module.xml files", E_USER_NOTICE);
         $list = preg_split('/ *, */', $config->sessions['loadClasses']);
         foreach ($list as $sel) {
             if (preg_match("/^([a-zA-Z0-9_\\.]+)~([a-zA-Z0-9_\\.\\/]+)\$/", $sel, $m)) {
                 if (!isset($config->_modulesPathList[$m[1]])) {
                     throw new Exception('Error in the configuration file -- in loadClasses parameter, ' . $m[1] . ' is not a valid or activated module');
                 }
                 if (($p = strrpos($m[2], '/')) !== false) {
                     $className = substr($m[2], $p + 1);
                     $subpath = substr($m[2], 0, $p + 1);
                 } else {
                     $className = $m[2];
                     $subpath = '';
                 }
                 $path = $config->_modulesPathList[$m[1]] . 'classes/' . $subpath . $className . '.class.php';
                 if (!file_exists($path) || strpos($subpath, '..') !== false) {
                     throw new Exception('Error in the configuration file -- in loadClasses parameter, bad class selector: ' . $sel);
                 }
                 $config->sessions['_class_to_load'][] = $path;
             } else {
                 throw new Exception('Error in the configuration file --  in loadClasses parameter, bad class selector: ' . $sel);
             }
         }
     }
 }
开发者ID:medali1990,项目名称:medsite,代码行数:32,代码来源:session.configcompiler.php

示例4: _createPath

 protected function _createPath()
 {
     if (!isset(jApp::config()->_modulesPathList[$this->module])) {
         throw new jExceptionSelector('jelix~errors.selector.module.unknown', $this->toString());
     }
     // check if the dao was redefined (overloaded) in var/
     $overloadedPath = jApp::varPath('overloads/' . $this->module . '/' . $this->_dirname . $this->resource . $this->_suffix);
     if (is_readable($overloadedPath)) {
         $this->_path = $overloadedPath;
         $this->_where = 'var/';
         return;
     }
     // check if the dao was redefined (overloaded) in app/
     $overloadedPath = jApp::appPath('app/overloads/' . $this->module . '/' . $this->_dirname . $this->resource . $this->_suffix);
     if (is_readable($overloadedPath)) {
         $this->_path = $overloadedPath;
         $this->_where = 'app/';
         return;
     }
     // else check if the module exists in the current module
     $this->_path = jApp::config()->_modulesPathList[$this->module] . $this->_dirname . $this->resource . $this->_suffix;
     if (!is_readable($this->_path)) {
         throw new jExceptionSelector('jelix~errors.selector.invalid.target', array($this->toString(), "dao"));
     }
     $this->_where = 'modules/';
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:26,代码来源:jSelectorDao.class.php

示例5: install

 function install()
 {
     $cmdFile = jApp::appPath('cmd.php');
     if (!file_exists($cmdFile)) {
         $content = "<" . "?php\n/**\n* @package  jelix\n* @author   Laurent Jouanneau\n* @contributor\n* @copyright 2011 Laurent Jouanneau\n* @link     http://jelix.org\n* @licence  http://www.gnu.org/licenses/gpl.html GNU General Public Licence, see LICENCE file\n*/\nrequire (dirname(__FILE__).'/application.init.php');\nrequire(LIB_PATH.'jelix-scripts/includes/cmd.inc.php');\n";
         file_put_contents($cmdFile, $content);
     }
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:8,代码来源:upgrade_to_1.3pre.1919_cmd.php

示例6: __construct

 function __construct($profile)
 {
     $this->profile = $profile;
     $prof = $profile;
     $user = '';
     $password = '';
     $dsn = '';
     if (isset($profile['dsn'])) {
         $this->dbms = substr($profile['dsn'], 0, strpos($profile['dsn'], ':'));
         $dsn = $profile['dsn'];
         unset($prof['dsn']);
         if ($this->dbms == 'sqlite') {
             $dsn = str_replace(array('app:', 'lib:', 'var:'), array(jApp::appPath(), LIB_PATH, jApp::varPath()), $dsn);
         }
     } else {
         $this->dbms = $profile['driver'];
         $db = $profile['database'];
         $dsn = $this->dbms . ':host=' . $profile['host'] . ';dbname=' . $db;
         if ($this->dbms != 'sqlite') {
             $dsn = $this->dbms . ':host=' . $profile['host'] . ';dbname=' . $db;
         } else {
             if (preg_match('/^(app|lib|var)\\:/', $db, $m)) {
                 $dsn = 'sqlite:' . str_replace(array('app:', 'lib:', 'var:'), array(jApp::appPath(), LIB_PATH, jApp::varPath()), $db);
             } else {
                 $dsn = 'sqlite:' . jApp::varPath('db/sqlite/' . $db);
             }
         }
     }
     if (isset($prof['usepdo'])) {
         unset($prof['usepdo']);
     }
     if (isset($prof['user'])) {
         $user = $prof['user'];
         unset($prof['user']);
     }
     if (isset($prof['password'])) {
         $password = $profile['password'];
         unset($prof['password']);
     }
     unset($prof['driver']);
     parent::__construct($dsn, $user, $password, $prof);
     $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('jDbPDOResultSet'));
     $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     if ($this->dbms == 'mysql') {
         $this->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
     }
     if ($this->dbms == 'oci') {
         $this->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
     }
     if (isset($prof['force_encoding']) && $prof['force_encoding'] == true) {
         $charset = jApp::config()->charset;
         if ($this->dbms == 'mysql' && isset($this->_mysqlCharsets[$charset])) {
             $this->exec("SET NAMES '" . $this->_mysqlCharsets[$charset] . "'");
         } elseif ($this->dbms == 'pgsql' && isset($this->_pgsqlCharsets[$charset])) {
             $this->exec("SET client_encoding to '" . $this->_pgsqlCharsets[$charset] . "'");
         }
     }
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:58,代码来源:jDbPDOConnection.class.php

示例7: 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

示例8: _connect

 protected function _connect()
 {
     $db = $this->profile['database'];
     if (preg_match('/^(app|lib|var)\\:/', $db)) {
         $path = str_replace(array('app:', 'lib:', 'var:'), array(jApp::appPath(), LIB_PATH, jApp::varPath()), $db);
     } else {
         $path = jApp::varPath('db/sqlite3/' . $db);
     }
     return new SQLite3($path);
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:10,代码来源:sqlite3.dbconnection.php

示例9: getInfo

 public function getInfo()
 {
     $file = jApp::appPath('project.xml');
     if (!file_exists($file)) {
         return null;
     }
     $project = new projectinfo();
     $project = $this->parse($file, $project);
     return $project;
 }
开发者ID:havefnubb,项目名称:havefnubb,代码行数:10,代码来源:projectxml.class.php

示例10: 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

示例11: testBundleUnknownFile

 public function testBundleUnknownFile()
 {
     $this->filePath = jApp::appPath() . 'modules/jelix_tests/locales/';
     $b = new bundleTest('', '');
     try {
         $b->readProperties($this->filePath . 'unknownfile');
         $this->fail('should throw an exception when trying reading unknownfile');
     } catch (Exception $e) {
         $this->assertTrue($e->getMessage() == 'Cannot load the resource ' . $this->filePath . 'unknownfile', 'should throw the right exception when trying reading unknownfile (wrong message: ' . $e->getMessage() . ')');
     }
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:11,代码来源:core.jlocale.html_cli.php

示例12: index

 /**
  * Display a summary of the information taken from the ~ configuration file.
  *
  * @return Administration backend for the repositories.
  */
 function index()
 {
     $rep = $this->getResponse('html');
     // Get repository data
     $repository = $this->param('repository');
     // Get rights for repositories per subject and groups
     $cnx = jDb::getConnection('jacl2_profile');
     $repositories = array();
     $data = array();
     foreach (lizmap::getRepositoryList() as $repo) {
         //$sql = " SELECT r.id_aclsbj, group_concat(g.name, ' - ') AS group_names";
         $sql = " SELECT r.id_aclsbj, g.name AS group_name";
         $sql .= " FROM jacl2_rights r";
         $sql .= " INNER JOIN jacl2_group g ON r.id_aclgrp = g.id_aclgrp";
         $sql .= " WHERE g.grouptype = 0 AND r.id_aclgrp NOT IN ('" . implode("','", $this->groupBlacklist) . "')";
         $sql .= " AND id_aclres=" . $cnx->quote($repo);
         //$sql.= " GROUP BY r.id_aclsbj;";
         $sql .= " ORDER BY g.name";
         $rights = $cnx->query($sql);
         $group_names = array();
         foreach ($rights as $r) {
             if (!array_key_exists($r->id_aclsbj, $group_names)) {
                 $group_names[$r->id_aclsbj] = array();
             }
             $group_names[$r->id_aclsbj][] = $r->group_name;
         }
         foreach ($group_names as $k => $v) {
             $group_names[$k] = implode(' - ', $v);
         }
         $rights = (object) $group_names;
         $repositories[] = lizmap::getRepository($repo);
         $data[$repo] = $rights;
     }
     // Subjects labels
     $labels = array();
     $daosubject = jDao::get('jacl2db~jacl2subject', 'jacl2_profile');
     foreach ($daosubject->findAllSubject() as $subject) {
         $labels[$subject->id_aclsbj] = $this->getLabel($subject->id_aclsbj, $subject->label_key);
     }
     // Get Lizmap version from project.xml
     $xmlPath = jApp::appPath('project.xml');
     $xmlLoad = simplexml_load_file($xmlPath);
     $version = (string) $xmlLoad->info->version;
     $tpl = new jTpl();
     $tpl->assign('services', lizmap::getServices());
     $tpl->assign('repositories', $repositories);
     $tpl->assign('data', $data);
     $tpl->assign('labels', $labels);
     $tpl->assign('version', $version);
     $rep->body->assign('MAIN', $tpl->fetch('config'));
     $rep->body->assign('selectedMenuItem', 'lizmap_configuration');
     return $rep;
 }
开发者ID:jonniedeb,项目名称:lizmap-web-client,代码行数:58,代码来源:config.classic.php

示例13: 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

示例14: _connect

 protected function _connect()
 {
     $funcconnect = isset($this->profile['persistent']) && $this->profile['persistent'] ? 'sqlite_popen' : 'sqlite_open';
     $db = $this->profile['database'];
     if (preg_match('/^(app|lib|var)\\:/', $db)) {
         $path = str_replace(array('app:', 'lib:', 'var:'), array(jApp::appPath(), LIB_PATH, jApp::varPath()), $db);
     } else {
         $path = jApp::varPath('db/sqlite/' . $db);
     }
     if ($cnx = @$funcconnect($path)) {
         return $cnx;
     } else {
         throw new jException('jelix~db.error.connection', $db);
     }
 }
开发者ID:hadrienl,项目名称:jelix,代码行数:15,代码来源:sqlite.dbconnection.php

示例15: loadProjectXml

 /**
  * load the content of the project.xml file, and store the corresponding DOM
  * into the $projectXml property
  */
 protected function loadProjectXml()
 {
     $doc = new DOMDocument();
     if (!$doc->load(jApp::appPath($this->projectXmlFilename))) {
         throw new Exception("cannot load " . $this->projectXmlFilename);
     }
     $root = $doc->documentElement;
     if ($root->namespaceURI != JELIX_NAMESPACE_BASE . 'project/1.0') {
         throw new Exception("bad namespace in " . $this->projectXmlFilename);
     }
     $info = $root->getElementsByTagName("info");
     if ($info->length && $info->item(0)->hasAttribute('name')) {
         $this->appName = $info->item(0)->getAttribute('name');
     }
     $this->projectXml = $doc;
 }
开发者ID:medali1990,项目名称:medsite,代码行数:20,代码来源:jInstallerApplication.class.php


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