missing linebreaks
parent
1353417182
commit
7b89168f89
|
@ -994,7 +994,8 @@ The following API calls from the Twitter API are not implemented in either Frien
|
||||||
/usr/bin/curl -u USER:PASS https://YOUR.FRIENDICA.TLD/api/statuses/update.xml -d source="some source id" -d status="the status you want to post"
|
/usr/bin/curl -u USER:PASS https://YOUR.FRIENDICA.TLD/api/statuses/update.xml -d source="some source id" -d status="the status you want to post"
|
||||||
|
|
||||||
### Python
|
### Python
|
||||||
The [RSStoFriedika](https://github.com/pafcu/RSStoFriendika) code can be used as an example of how to use the API with python. The lines for posting are located at [line 21](https://github.com/pafcu/RSStoFriendika/blob/master/RSStoFriendika.py#L21) and following.
|
The [RSStoFriedika](https://github.com/pafcu/RSStoFriendika) code can be used as an example of how to use the API with python.
|
||||||
|
The lines for posting are located at [line 21](https://github.com/pafcu/RSStoFriendika/blob/master/RSStoFriendika.py#L21) and following.
|
||||||
|
|
||||||
def tweet(server, message, group_allow=None):
|
def tweet(server, message, group_allow=None):
|
||||||
url = server + '/api/statuses/update'
|
url = server + '/api/statuses/update'
|
||||||
|
|
|
@ -38,7 +38,8 @@ The class `ItemsManager` has been declared in the `Friendica` namespace.
|
||||||
Namespaces are useful to keep classes separated and avoid names conflicts (could be that a library you want to use also defines a class named `ItemsManager`, but as long as it is in another namespace, you don't have any problem)
|
Namespaces are useful to keep classes separated and avoid names conflicts (could be that a library you want to use also defines a class named `ItemsManager`, but as long as it is in another namespace, you don't have any problem)
|
||||||
|
|
||||||
Let's say now that you need to load some items in a view, maybe in a fictional `mod/network.php`.
|
Let's say now that you need to load some items in a view, maybe in a fictional `mod/network.php`.
|
||||||
In order for the Composer autoloader to work, it must first be included. In Friendica this is already done at the top of `boot.php`, with `require_once('vendor/autoload.php');`.
|
In order for the Composer autoloader to work, it must first be included.
|
||||||
|
In Friendica this is already done at the top of `boot.php`, with `require_once('vendor/autoload.php');`.
|
||||||
|
|
||||||
The code will be something like:
|
The code will be something like:
|
||||||
|
|
||||||
|
@ -58,7 +59,8 @@ function network_content(App $a) {
|
||||||
That's a quite simple example, but look: no `require()`!
|
That's a quite simple example, but look: no `require()`!
|
||||||
If you need to use a class, you can simply use it and you don't need to do anything else.
|
If you need to use a class, you can simply use it and you don't need to do anything else.
|
||||||
|
|
||||||
Going further: now we have a bunch of `*Manager` classes that cause some code duplication, let's define a `BaseManager` class, where we move all common code between all managers:
|
Going further: now we have a bunch of `*Manager` classes that cause some code duplication.
|
||||||
|
Let's define a `BaseManager` class, where we move all common code between all managers:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
// src/BaseManager.php
|
// src/BaseManager.php
|
||||||
|
|
Loading…
Reference in New Issue