Merge pull request #10165 from nupplaphil/bug/strip_pageinfo
[friendica.git/.git] / doc / autoloader.md
index 1a3b9a5..e158868 100644 (file)
@@ -47,8 +47,10 @@ The code will be something like:
 // mod/network.php
 <?php
 
+use Friendica\App;
+
 function network_content(App $a) {
-       $itemsmanager = new Friendica\ItemsManager();
+       $itemsmanager = new \Friendica\ItemsManager();
        $items = $itemsmanager->getAll();
 
        // pass $items to template
@@ -104,7 +106,7 @@ class Dfrn {
 
 mail_post($a){
        ...
-       Friendica\dfrn::mail($item, $owner);
+       Friendica\Protocol\DFRN::mail($item, $owner);
        ...
 }
 ```
@@ -117,6 +119,8 @@ If your code is in same namespace as the class you need, you don't need to prepe
 
 namespace Friendica;
 
+use Friendica\Protocol\DFRN;
+
 // this is the same content of current include/delivery.php,
 // but has been declared to be in "Friendica" namespace
 
@@ -125,12 +129,12 @@ switch($contact['network']) {
        case NETWORK_DFRN:
                if ($mail) {
                        $item['body'] = ...
-                       $atom = Dfrn::mail($item, $owner);
+                       $atom = DFRN::mail($item, $owner);
                } elseif ($fsuggest) {
-                       $atom = Dfrn::fsuggest($item, $owner);
+                       $atom = DFRN::fsuggest($item, $owner);
                        q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));
                } elseif ($relocate)
-                       $atom = Dfrn::relocate($owner, $uid);
+                       $atom = DFRN::relocate($owner, $uid);
 [...]
 ```