本文整理汇总了PHP中jApp::varPath方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::varPath方法的具体用法?PHP jApp::varPath怎么用?PHP jApp::varPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jApp
的用法示例。
在下文中一共展示了jApp::varPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _connect
public function _connect()
{
if (isset($this->_profile['storage_dir']) && $this->_profile['storage_dir'] != '') {
$this->_storage_dir = str_replace(array('var:', 'temp:'), array(jApp::varPath(), jApp::tempPath()), $this->_profile['storage_dir']);
$this->_storage_dir = rtrim($this->_storage_dir, '\\/') . DIRECTORY_SEPARATOR;
} else {
$this->_storage_dir = jApp::varPath('kvfiles/');
}
jFile::createDir($this->_storage_dir);
if (isset($this->_profile['file_locking'])) {
$this->_file_locking = $this->_profile['file_locking'] ? true : false;
}
if (isset($this->_profile['automatic_cleaning_factor'])) {
$this->automatic_cleaning_factor = $this->_profile['automatic_cleaning_factor'];
}
if (isset($this->_profile['directory_level']) && $this->_profile['directory_level'] > 0) {
$this->_directory_level = $this->_profile['directory_level'];
if ($this->_directory_level > 16) {
$this->_directory_level = 16;
}
}
if (isset($this->_profile['directory_umask']) && is_string($this->_profile['directory_umask']) && $this->_profile['directory_umask'] != '') {
$this->_directory_umask = octdec($this->_profile['directory_umask']);
}
if (isset($this->_profile['file_umask']) && is_string($this->_profile['file_umask']) && $this->_profile['file_umask'] != '') {
$this->file_umask = octdec($this->_profile['file_umask']);
}
}
示例2: __construct
/**
* initialize some member
*/
function __construct()
{
$config = jApp::config();
$this->defaultLang = $config->locale;
$this->CharSet = $config->charset;
$this->Mailer = $config->mailer['mailerType'];
if ($config->mailer['mailerType']) {
$this->Mailer = $config->mailer['mailerType'];
}
$this->Hostname = $config->mailer['hostname'];
$this->Sendmail = $config->mailer['sendmailPath'];
$this->Host = $config->mailer['smtpHost'];
$this->Port = $config->mailer['smtpPort'];
$this->Helo = $config->mailer['smtpHelo'];
$this->SMTPAuth = $config->mailer['smtpAuth'];
$this->SMTPSecure = $config->mailer['smtpSecure'];
$this->Username = $config->mailer['smtpUsername'];
$this->Password = $config->mailer['smtpPassword'];
$this->Timeout = $config->mailer['smtpTimeout'];
if ($config->mailer['webmasterEmail'] != '') {
$this->From = $config->mailer['webmasterEmail'];
}
$this->FromName = $config->mailer['webmasterName'];
$this->filePath = jApp::varPath($config->mailer['filesDir']);
$this->copyToFiles = $config->mailer['copyToFiles'];
parent::__construct(true);
}
示例3: testFileMail
public function testFileMail()
{
//if (file_exists(jApp::varPath().'mails/mail.txt'))
// unlink(jApp::varPath().'mails/mail.txt');
$mail = new testJMailer();
$mail->From = 'toto@truc.local';
$mail->FromName = 'Super Me';
$mail->Sender = 'toto@truc.com';
$mail->Subject = 'Email test';
$mail->Body = 'This is a test mail';
$mail->AddAddress('titi@machin.local');
$mail->AddAddress('toto@machin.local');
$mail->IsFile();
$mail->Send();
$this->assertEqual(jApp::varPath() . 'mails/', $mail->filePath);
$this->assertEqual(jApp::varPath() . 'mails/mail.txt', $mail->getStorageFile2());
if ($this->assertTrue(file_exists(jApp::varPath() . 'mails/mail.txt'))) {
$content = file_get_contents(jApp::varPath() . 'mails/mail.txt');
$this->assertTrue(strpos($content, 'Return-Path: toto@truc.com') !== false);
$this->assertTrue(strpos($content, 'To: titi@machin.local, toto@machin.local') !== false);
$this->assertTrue(strpos($content, 'From: Super Me <toto@truc.local>') !== false);
$this->assertTrue(strpos($content, 'Subject: Email test') !== false);
$this->assertTrue(strpos($content, 'Content-Transfer-Encoding: 8bit') !== false);
$this->assertTrue(strpos($content, 'Content-Type: text/plain; charset="UTF-8"') !== false);
$this->assertTrue(strpos($content, 'This is a test mail') !== false);
}
}
示例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/';
}
示例5: _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/';
}
示例6: read_rss
/**
* display the RSS of the forum
*/
public function read_rss()
{
$ftitle = jUrl::escape($this->param('ftitle'), true);
$id_forum = (int) $this->param('id_forum');
if (!jAcl2::check('hfnu.posts.list', 'forum' . $id_forum)) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
if ($id_forum == 0) {
$rep = $this->getResponse('redirect');
$rep->action = 'default:index';
return $rep;
}
$forum = jClasses::getService('havefnubb~hfnuforum')->getForum($id_forum);
if (jUrl::escape($forum->forum_name, true) != $ftitle) {
$rep = $this->getResponse('redirect');
$rep->action = jApp::config()->urlengine['notfoundAct'];
return $rep;
}
jApp::coord()->getPlugin('history')->change('label', htmlentities($forum->forum_name, ENT_COMPAT, 'UTF-8'));
$feed_reader = new jFeedReader();
$feed_reader->setCacheDir(jApp::varPath('feeds'));
$feed_reader->setTimeout(2);
$feed_reader->setUserAgent('HaveFnuBB - http://www.havefnubb.org/');
$feed = $feed_reader->parse($forum->forum_url);
$rep = $this->getResponse('html');
$tpl = new jTpl();
$tpl->assign('feed', $feed);
$tpl->assign('forum', $forum);
$rep->title = $forum->forum_name;
$rep->body->assign('MAIN', $tpl->fetch('havefnubb~forum_rss.view'));
return $rep;
}
示例7: run
public function run()
{
$this->loadAppConfig();
$config = jApp::config();
$model_lang = $this->getParam('model_lang', $config->locale);
$lang = $this->getParam('lang');
foreach ($config->_modulesPathList as $module => $dir) {
$source_dir = $dir . 'locales/' . $model_lang . '/';
if (!file_exists($source_dir)) {
continue;
}
$target_dir = jApp::varPath('overloads/' . $module . '/locales/' . $lang . '/');
jFile::createDir($target_dir);
if ($dir_r = opendir($source_dir)) {
while (FALSE !== ($fich = readdir($dir_r))) {
if ($fich != "." && $fich != ".." && is_file($source_dir . $fich) && strpos($fich, '.' . $config->charset . '.properties') && !file_exists($target_dir . $fich)) {
copy($source_dir . $fich, $target_dir . $fich);
if ($this->verbose()) {
echo "Copy Locales file {$fich} from {$source_dir} to {$target_dir}.\n";
}
}
}
closedir($dir_r);
}
}
}
示例8: __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] . "'");
}
}
}
示例9: 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());
}
示例10: readManifest
/**
* get the info of a given theme
* @param string $theme the name of the theme
* @return array details of the theme
*/
static function readManifest($theme)
{
$themeInfos = array();
$path = jApp::varPath() . '/themes/' . $theme . '/theme.php';
if (file_exists($path)) {
include $path;
}
return $themeInfos;
}
示例11: 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;
}
示例12: _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);
}
示例13: run
public function run()
{
$paths = array();
$paths[] = jApp::tempBasePath();
$paths[] = jApp::logPath();
$paths[] = jApp::varPath('mails');
$paths[] = jApp::varPath('db');
foreach ($paths as $path) {
$this->setRights($path);
}
}
示例14: __construct
public function __construct()
{
// read the lizmap configuration file
$readConfigPath = parse_ini_file(jApp::varPath() . $this->config, True);
$this->data = $readConfigPath;
// set generic parameters
foreach ($this->properties as $prop) {
if (isset($readConfigPath['services'][$prop])) {
$this->{$prop} = $readConfigPath['services'][$prop];
}
}
}
示例15: getPath
public function getPath()
{
// add a trailing slash if needed
if (!preg_match('#/$#', $this->data['path'])) {
$this->data['path'] .= '/';
}
// if path is relative, get full path
if ($this->data['path'][0] != '/' and $this->data['path'][1] != ':') {
return jApp::varPath() . $this->data['path'];
}
return $this->data['path'];
}