]> git.mxchange.org Git - friendica.git/commitdiff
some more renamings & doku
authorPhilipp Holzer <admin@philipp.info>
Wed, 10 Oct 2018 06:54:18 +0000 (08:54 +0200)
committerPhilipp Holzer <admin@philipp.info>
Wed, 10 Oct 2018 06:54:18 +0000 (08:54 +0200)
src/App.php
src/Render/FriendicaSmarty.php
src/Util/Network.php

index e94067a08fbeb06002b69948b787b585d14c950f..fcde77846e172aa04315f76798748d9c480c1e0f 100644 (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 = [
index 559d501ca958486652a4bf427134bf6a32641a0e..2052aa9e87a6f5627948d99d18b6464dcb3af8a9 100644 (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;
index ec8b8c9b09e8f5367b8ea141899b1dfe6588aeeb..163be21d3a427ae152fdfbc30096ba535ff022b8 100644 (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;