1
1
Fork 0

some more renamings & doku

This commit is contained in:
Philipp Holzer 2018-10-10 08:54:18 +02:00
parent 307286fc47
commit 3d04562c87
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
3 changed files with 49 additions and 26 deletions

View file

@ -88,12 +88,12 @@ class App
/**
* @var string The App basepath
*/
private $basepath;
private $basePath;
/**
* @var string The App URL path
*/
private $urlpath;
private $urlPath;
/**
* @var bool true, if the call is from the Friendica APP, otherwise false
@ -182,20 +182,20 @@ class App
/**
* @brief App constructor.
*
* @param string $basepath Path to the app base folder
* @param string $basePath Path to the app base folder
* @param bool $backend true, if the call is from backend, otherwise set to true (Default true)
*
* @throws Exception if the Basepath is not usable
*/
public function __construct($basepath, $backend = true)
public function __construct($basePath, $backend = true)
{
if (!static::isDirectoryUsable($basepath, false)) {
throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
if (!static::isDirectoryUsable($basePath, false)) {
throw new Exception('Basepath ' . $basePath . ' isn\'t usable.');
}
BaseObject::setApp($this);
$this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
$this->basePath = rtrim($basePath, DIRECTORY_SEPARATOR);
$this->checkBackend($backend);
$this->checkFriendicaApp();
@ -220,7 +220,7 @@ class App
$this->callstack['rendering'] = [];
$this->callstack['parser'] = [];
$this->mode = new App\Mode($basepath);
$this->mode = new App\Mode($basePath);
$this->reload();
@ -450,7 +450,7 @@ class App
* INI;
* // Keep this line
*
* @param type $filepath
* @param string $filepath
* @param bool $overwrite Force value overwrite if the config key already exists
* @throws Exception
*/
@ -522,7 +522,7 @@ class App
*/
private function determineURLPath()
{
$this->urlpath = $this->getConfigValue('system', 'urlpath');
$this->urlPath = $this->getConfigValue('system', 'urlpath');
/* SCRIPT_URL gives /path/to/friendica/module/parameter
* QUERY_STRING gives pagename=module/parameter
@ -538,8 +538,8 @@ class App
$path = trim($_SERVER['SCRIPT_URL'], '/');
}
if ($path && $path != $this->urlpath) {
$this->urlpath = $path;
if ($path && $path != $this->urlPath) {
$this->urlPath = $path;
}
}
}
@ -593,7 +593,7 @@ class App
*/
public function getBasePath()
{
$basepath = $this->basepath;
$basepath = $this->basePath;
if (!$basepath) {
$basepath = Config::get('system', 'basepath');
@ -701,7 +701,7 @@ class App
$hostname .= ':' . $parsed['port'];
}
if (x($parsed, 'path')) {
$this->urlpath = trim($parsed['path'], '\\/');
$this->urlPath = trim($parsed['path'], '\\/');
}
if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
@ -729,7 +729,7 @@ class App
public function getURLPath()
{
return $this->urlpath;
return $this->urlPath;
}
public function setPagerTotal($n)
@ -942,24 +942,51 @@ class App
/**
* @brief Returns the active template engine.
*
* @return string
* @return string the active template engine
*/
public function getActiveTemplateEngine()
{
return $this->theme['template_engine'];
}
/**
* sets the active template engine
*
* @param string $engine the template engine (default is Smarty3)
*/
public function setActiveTemplateEngine($engine = 'smarty3')
{
$this->theme['template_engine'] = $engine;
}
public function getTemplateLdelim($engine = 'smarty3')
/**
* Gets the right delimiter for a template engine
*
* Currently:
* Internal = ''
* Smarty3 = '{{'
*
* @param string $engine The template engine (default is Smarty3)
*
* @return string the right delimiter
*/
public function getTemplateLeftDelimiter($engine = 'smarty3')
{
return $this->ldelim[$engine];
}
public function getTemplateRdelim($engine = 'smarty3')
/**
* Gets the left delimiter for a template engine
*
* Currently:
* Internal = ''
* Smarty3 = '}}'
*
* @param string $engine The template engine (default is Smarty3)
*
* @return string the left delimiter
*/
public function getTemplateRightDelimiter($engine = 'smarty3')
{
return $this->rdelim[$engine];
}
@ -1040,6 +1067,8 @@ class App
* This isn't a perfect solution. But we need this check very early.
* So we cannot wait until the modules are loaded.
*
* @param string $backend true, if the backend flag was set during App initialization
*
*/
private function checkBackend($backend) {
static $backends = [

View file

@ -38,8 +38,8 @@ class FriendicaSmarty extends Smarty
$this->setConfigDir('view/smarty3/config/');
$this->setCacheDir('view/smarty3/cache/');
$this->left_delimiter = $a->getTemplateLdelim('smarty3');
$this->right_delimiter = $a->getTemplateRdelim('smarty3');
$this->left_delimiter = $a->getTemplateLeftDelimiter('smarty3');
$this->right_delimiter = $a->getTemplateRightDelimiter('smarty3');
// Don't report errors so verbosely
$this->error_reporting = E_ALL & ~E_NOTICE;

View file

@ -4,16 +4,10 @@
*/
namespace Friendica\Util;
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Network\Curl;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Util\XML;
use DOMDocument;
use DomXPath;