]> git.mxchange.org Git - friendica.git/blobdiff - doc/autoloader.md
added spaces
[friendica.git] / doc / autoloader.md
index 947eade23cfa62701ccd2c08051b95fb29419185..69c62451cd9453f04dc9dbc0ec04aaa2924d2550 100644 (file)
@@ -32,7 +32,7 @@ Let's say you have a php file in "include/" that define a very useful class:
     file: include/ItemsManager.php\r
     <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class ItemsManager {\r
        public function getAll() { ... }\r
        public function getByID($id) { ... }\r
@@ -67,11 +67,11 @@ The code will be something like:
 ```\r
     file: mod/network.php\r
     <?php\r
-    \r
-    function network_content(&$a) {\r
+\r
+    function network_content(App $a) {\r
        $itemsmanager = new \Friendica\ItemsManager();\r
        $items = $itemsmanager->getAll();\r
-    \r
+\r
        // pass $items to template\r
        // return result\r
     }\r
@@ -86,7 +86,7 @@ Going further: now we have a bunch of "*Manager" classes that cause some code du
     file: include/BaseManager.php\r
     <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class BaseManager {\r
       public function thatFunctionEveryManagerUses() { ... }\r
     }\r
@@ -98,7 +98,7 @@ and then let's change the ItemsManager class to use this code
     file: include/ItemsManager.php\r
     <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class ItemsManager extends BaseManager {\r
        public function getAll() { ... }\r
        public function getByID($id) { ... }\r
@@ -110,9 +110,9 @@ It works with the "BaseManager" example here, it works when we need to call stat
 \r
 ```\r
     file: include/dfrn.php\r
-    <?php    \r
+    <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class dfrn {\r
       public static function  mail($item, $owner) { ... }\r
     }\r
@@ -121,7 +121,7 @@ It works with the "BaseManager" example here, it works when we need to call stat
 ```\r
     file: mod/mail.php\r
     <?php\r
-    \r
+\r
     mail_post($a){\r
      ...\r
      \Friendica\dfrn::mail($item, $owner);\r
@@ -134,15 +134,15 @@ If your code is in same namespace as the class you need, you don't need to prepe
 ```\r
     file: include/delivery.php\r
     <?php\r
-    \r
+\r
     namespace \Friendica;\r
-    \r
-    // this is the same content of current include/delivery.php, \r
+\r
+    // this is the same content of current include/delivery.php,\r
     // but has been declared to be in "Friendica" namespace\r
-    \r
+\r
     [...]\r
     switch($contact['network']) {\r
-    \r
+\r
         case NETWORK_DFRN:\r
             if ($mail) {\r
                 $item['body'] = ...\r
@@ -160,11 +160,11 @@ But if you want to use classes from another library, you need to use the full na
 \r
 ```\r
     <?php\r
-    namespace \Frienidca;\r
-    \r
+    namespace \Friendica;\r
+\r
     class Diaspora {\r
       public function md2bbcode() {\r
-        $html = \Michelf\MarkdownExtra::defaultTransform($text); \r
+        $html = \Michelf\MarkdownExtra::defaultTransform($text);\r
       }\r
     }\r
 ```\r
@@ -173,13 +173,13 @@ if you use that class in many places of the code and you don't want to write the
 \r
 ```\r
     <?php\r
-    namespace \Frienidca;\r
-    \r
+    namespace \Friendica;\r
+\r
     use \Michelf\MarkdownExtra;\r
-    \r
+\r
     class Diaspora {\r
       public function md2bbcode() {\r
-        $html = MarkdownExtra::defaultTransform($text); \r
+        $html = MarkdownExtra::defaultTransform($text);\r
       }\r
     }\r
 ```\r
@@ -190,7 +190,7 @@ You can go more deep if you want to, like:
 ```\r
     <?php\r
     namespace \Friendica\Network;\r
-    \r
+\r
     class DFRN {\r
     }\r
 ```\r
@@ -200,7 +200,7 @@ or
 ```\r
     <?php\r
     namespace \Friendica\DBA;\r
-    \r
+\r
     class MySQL {\r
     }\r
 ```\r