Merge pull request #3423 from Hypolite/improvement/move-app-to-src-2
Move App to `src` redux
This commit is contained in:
commit
fa3fa42d96
6
composer.lock
generated
6
composer.lock
generated
|
@ -226,10 +226,10 @@
|
|||
},
|
||||
{
|
||||
"name": "pear-pear.php.net/PEAR",
|
||||
"version": "1.10.3",
|
||||
"version": "1.10.4",
|
||||
"dist": {
|
||||
"type": "file",
|
||||
"url": "https://pear.php.net/get/PEAR-1.10.3.tgz",
|
||||
"url": "https://pear.php.net/get/PEAR-1.10.4.tgz",
|
||||
"reference": null,
|
||||
"shasum": null
|
||||
},
|
||||
|
@ -247,7 +247,7 @@
|
|||
"pear-pear.php.net/pear_frontend_web": "<=0.4.0.0"
|
||||
},
|
||||
"replace": {
|
||||
"pear-pear/pear": "== 1.10.3.0"
|
||||
"pear-pear/pear": "== 1.10.4.0"
|
||||
},
|
||||
"type": "pear-library",
|
||||
"autoload": {
|
||||
|
|
|
@ -113,3 +113,8 @@ For Composer, this would be:
|
|||
````
|
||||
$> COMPOSER_HOME=/var/tmp/composer sudo -u [web user] util/composer.phar [mode]
|
||||
````
|
||||
|
||||
## Related
|
||||
|
||||
* [Class autoloading](help/autoloader)
|
||||
* [How To Move Classes to `src`](help/Developer-How-To-Move-Classes-to-src)
|
||||
|
|
108
doc/Developer-How-To-Move-Classes-to-src.md
Normal file
108
doc/Developer-How-To-Move-Classes-to-src.md
Normal file
|
@ -0,0 +1,108 @@
|
|||
How To Move Classes to `src`
|
||||
==============
|
||||
|
||||
* [Home](help)
|
||||
* [Developer Intro](help/Developers-Intro)
|
||||
|
||||
Friendica uses [Composer](help/Composer) to manage autoloading.
|
||||
This means that all the PHP class files moved to the `src` folder will be [automatically included](help/autoloader) when the class it defines is first used in the flow.
|
||||
This is an improvement over the current `require` usage since files will be included on an actual usage basis instead of the presence of a `require` call.
|
||||
|
||||
However, there are a significant number of items to check when moving a class file from the `include` folder to the `src` folder, and this page is there to list them.
|
||||
|
||||
## Decide the namespace
|
||||
|
||||
This isn't the most technical decision of them all, but it has long lasting consequences as it will be the name that will be used to refer to this class from now on.
|
||||
There is [a shared Ethercalc sheet](https://ethercalc.org/friendica_classes) to suggest namespace/class names that lists all the already moved class files for inspiration.
|
||||
|
||||
A few pointers though:
|
||||
* `Friendica` is the base namespace for all classes in the `src` folder
|
||||
* Namespaces match the directory structure, with `Friendica` namespace being the base `src` directory. The `Config` class set in the `Friendica\Core` namespace is expected to be found at `src/Core/Config.php`.
|
||||
* Namespaces can help group classes with a similar purpose or relevant to a particular feature
|
||||
|
||||
When you're done deciding the namespace, it's time to use it.
|
||||
Let's say we choose `Friendica\Core` for the `Config` class.
|
||||
|
||||
## Use the namespace
|
||||
|
||||
To declare the namespace, the file `src/Core/Config.php` must start with the following statement:
|
||||
|
||||
````php
|
||||
namespace Friendica\Core;
|
||||
````
|
||||
|
||||
From now on, the `Config` class can be referred to as `Friendica\Core\Config`, however it isn't very practical, especially when the class was previously used as `Config`.
|
||||
Thankfully, PHP provides namespace shortcuts through `use`.
|
||||
|
||||
This language construct just provides a different naming scheme for a namespace or a class, but doesn't trigger the autoload mechanism on its own.
|
||||
Here are the different ways you can use `use`:
|
||||
|
||||
````php
|
||||
// No use
|
||||
$config = new Friendica\Core\Config();
|
||||
````
|
||||
````php
|
||||
// Namespace shortcut
|
||||
use Friendica\Core;
|
||||
|
||||
$config = new Core\Config();
|
||||
````
|
||||
````php
|
||||
// Class name shortcut
|
||||
use Friendica\Core\Config;
|
||||
|
||||
$config = new Config();
|
||||
````
|
||||
````php
|
||||
// Aliasing
|
||||
use Friendica\Core\Config as Cfg;
|
||||
|
||||
$config = new Cfg();
|
||||
````
|
||||
|
||||
Whatever the style chosen, a repository-wide search has to be done to find all the class name usage and either use the fully-qualified class name (including the namespace) or add a `use` statement at the start of each relevant file.
|
||||
|
||||
## Escape non-namespace classes
|
||||
|
||||
The class file you just moved is now in the `Friendica` namespace, but it probably isn't the case for all the classes referenced in this file.
|
||||
Since we added a `namespace Friendica\Core;` to the file, all the class names still declared in `include` will be implicitly understood as `Friendica\Core\ClassName`, which is rarely what we expect.
|
||||
|
||||
To avoid `Class Friendica\Core\ClassName not found` errors, all the `include`-declared class names have to be prepended with a `\`, it tells the autoloader not to look for the class in the namespace but in the global space where non-namespaced classes are set.
|
||||
If there are only a handful of references to a single non-namespaced class, just prepending `\` is enough. However, if there are many instance, we can use `use` again.
|
||||
|
||||
````php
|
||||
namespace Friendica\Core;
|
||||
...
|
||||
if (\dbm::is_result($r)) {
|
||||
...
|
||||
}
|
||||
````
|
||||
````php
|
||||
namespace Friendica\Core;
|
||||
|
||||
use \dbm;
|
||||
|
||||
if (dbm::is_result($r)) {
|
||||
...
|
||||
}
|
||||
````
|
||||
|
||||
## Remove any useless `require`
|
||||
|
||||
Now that you successfully moved your class to the autoloaded `src` folder, there's no need to include this file anywhere in the app ever again.
|
||||
Please remove all the `require_once` mentions of the former file, as they will provoke a Fatal Error even if the class isn't used.
|
||||
|
||||
## Miscellaneous tips
|
||||
|
||||
When you are done with moving the class, please run `php util/typo.php` from the Friendica base directory to check for obvious mistakes.
|
||||
Howevever, this tool isn't bullet-proof, and a staging install of Friendica is recommended to test your class move without impairing your production server if you host one.
|
||||
|
||||
Most of Friendica processes are run in the background, so make sure to turn on your debug log to check for errors that wouldn't show up while simply browsing Friendica.
|
||||
|
||||
Check the class file for any magic constant `__FILE__` or `__DIR__`, as their value changed since you moved the class in the file tree.
|
||||
Most of the time it's used for debugging purposes but there can be instances where it's used to create cache folders for example.
|
||||
|
||||
## Related
|
||||
|
||||
* [Class autoloading](help/autoloader)
|
||||
* [Using Composer](help/Composer)
|
|
@ -52,7 +52,9 @@ Friendica uses [Composer](https://getcomposer.org) to manage dependencies librar
|
|||
|
||||
It's a command-line tool that downloads required libraries into the `vendor` folder and makes any namespaced class in `src` available through the whole application through `boot.php`.
|
||||
|
||||
* [Class autoloading](help/autoloader)
|
||||
* [Using Composer](help/Composer)
|
||||
* [How To Move Classes to `src`](help/Developer-How-To-Move-Classes-to-src)
|
||||
|
||||
###Coding standards
|
||||
|
||||
|
|
34
doc/Home.md
34
doc/Home.md
|
@ -36,21 +36,25 @@ Friendica Documentation and Resources
|
|||
|
||||
**Developer Manual**
|
||||
|
||||
* [Where to get started?](help/Developers-Intro)
|
||||
* [Help on Github](help/Github)
|
||||
* [Help on Vagrant](help/Vagrant)
|
||||
* [How to translate Friendica](help/translations)
|
||||
* [Bugs and Issues](help/Bugs-and-Issues)
|
||||
* [Plugin Development](help/Plugins)
|
||||
* [Theme Development](help/themes)
|
||||
* [Smarty 3 Templates](help/smarty3-templates)
|
||||
* [Protocol Documentation](help/Protocol)
|
||||
* [Database schema documantation](help/database)
|
||||
* [Class Autoloading](help/autoloader)
|
||||
* [Using Composer](help/Composer)
|
||||
* [Code - Reference(Doxygen generated - sets cookies)](doc/html/)
|
||||
* [Twitter/GNU Social API Functions](help/api)
|
||||
|
||||
* [Get started](help/Developers-Intro)
|
||||
* Set up development environment
|
||||
* [Help on Github](help/Github)
|
||||
* [Help on Vagrant](help/Vagrant)
|
||||
* [Bugs and Issues](help/Bugs-and-Issues)
|
||||
* Code structure
|
||||
* [Plugin Development](help/Plugins)
|
||||
* [Theme Development](help/themes)
|
||||
* [Smarty 3 Templates](help/smarty3-templates)
|
||||
* How To
|
||||
* [Translate Friendica](help/translations)
|
||||
* [Use Composer](help/Composer)
|
||||
* [Move classes to `src`](help/Developer-How-To-Move-Classes-to-src)
|
||||
* Reference
|
||||
* [Twitter/GNU Social API Functions](help/api)
|
||||
* [Code (Doxygen generated - sets cookies)](doc/html/)
|
||||
* [Protocol Documentation](help/Protocol)
|
||||
* [Database schema documantation](help/database)
|
||||
* [Class Autoloading](help/autoloader)
|
||||
|
||||
**External Resources**
|
||||
|
||||
|
|
|
@ -24,14 +24,14 @@ For more info about PHP autoloading, please refer to the [official PHP documenta
|
|||
Let's say you have a PHP file in `src/` that define a very useful class:
|
||||
|
||||
```php
|
||||
// src/ItemsManager.php
|
||||
<?php
|
||||
namespace \Friendica;
|
||||
// src/ItemsManager.php
|
||||
<?php
|
||||
namespace Friendica;
|
||||
|
||||
class ItemsManager {
|
||||
class ItemsManager {
|
||||
public function getAll() { ... }
|
||||
public function getByID($id) { ... }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The class `ItemsManager` has been declared in the `Friendica` namespace.
|
||||
|
@ -43,16 +43,16 @@ In order for the Composer autoloader to work, it must first be included. In Frie
|
|||
The code will be something like:
|
||||
|
||||
```php
|
||||
// mod/network.php
|
||||
<?php
|
||||
// mod/network.php
|
||||
<?php
|
||||
|
||||
function network_content(App $a) {
|
||||
$itemsmanager = new \Friendica\ItemsManager();
|
||||
function network_content(App $a) {
|
||||
$itemsmanager = new Friendica\ItemsManager();
|
||||
$items = $itemsmanager->getAll();
|
||||
|
||||
// pass $items to template
|
||||
// return result
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
That's a quite simple example, but look: no `require()`!
|
||||
|
@ -61,65 +61,65 @@ If you need to use a class, you can simply use it and you don't need to do anyth
|
|||
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
|
||||
// src/BaseManager.php
|
||||
<?php
|
||||
namespace \Friendica;
|
||||
// src/BaseManager.php
|
||||
<?php
|
||||
namespace Friendica;
|
||||
|
||||
class BaseManager {
|
||||
class BaseManager {
|
||||
public function thatFunctionEveryManagerUses() { ... }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
and then let's change the ItemsManager class to use this code
|
||||
|
||||
```php
|
||||
// src/ItemsManager.php
|
||||
<?php
|
||||
namespace \Friendica;
|
||||
// src/ItemsManager.php
|
||||
<?php
|
||||
namespace Friendica;
|
||||
|
||||
class ItemsManager extends BaseManager {
|
||||
class ItemsManager extends BaseManager {
|
||||
public function getAll() { ... }
|
||||
public function getByID($id) { ... }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Even though we didn't explicitly include the `src/BaseManager.php` file, the autoloader will when this class is first defined, because it is referenced as a parent class.
|
||||
It works with the "BaseManager" example here and it works when we need to call static methods:
|
||||
|
||||
```php
|
||||
// src/Dfrn.php
|
||||
<?php
|
||||
namespace \Friendica;
|
||||
// src/Dfrn.php
|
||||
<?php
|
||||
namespace Friendica;
|
||||
|
||||
class Dfrn {
|
||||
class Dfrn {
|
||||
public static function mail($item, $owner) { ... }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```php
|
||||
// mod/mail.php
|
||||
<?php
|
||||
// mod/mail.php
|
||||
<?php
|
||||
|
||||
mail_post($a){
|
||||
mail_post($a){
|
||||
...
|
||||
\Friendica\dfrn::mail($item, $owner);
|
||||
Friendica\dfrn::mail($item, $owner);
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If your code is in same namespace as the class you need, you don't need to prepend it:
|
||||
|
||||
```php
|
||||
// include/delivery.php
|
||||
<?php
|
||||
// include/delivery.php
|
||||
<?php
|
||||
|
||||
namespace \Friendica;
|
||||
namespace Friendica;
|
||||
|
||||
// this is the same content of current include/delivery.php,
|
||||
// but has been declared to be in "Friendica" namespace
|
||||
// this is the same content of current include/delivery.php,
|
||||
// but has been declared to be in "Friendica" namespace
|
||||
|
||||
[...]
|
||||
switch($contact['network']) {
|
||||
[...]
|
||||
switch($contact['network']) {
|
||||
case NETWORK_DFRN:
|
||||
if ($mail) {
|
||||
$item['body'] = ...
|
||||
|
@ -129,64 +129,69 @@ If your code is in same namespace as the class you need, you don't need to prepe
|
|||
q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));
|
||||
} elseif ($relocate)
|
||||
$atom = Dfrn::relocate($owner, $uid);
|
||||
[...]
|
||||
[...]
|
||||
```
|
||||
|
||||
This is the current code of `include/delivery.php`, and since the code is declared to be in the "Friendica" namespace, you don't need to write it when you need to use the "Dfrn" class.
|
||||
But if you want to use classes from another library, you need to use the full namespace, e.g.
|
||||
|
||||
```php
|
||||
// src/Diaspora.php
|
||||
<?php
|
||||
// src/Diaspora.php
|
||||
<?php
|
||||
|
||||
namespace \Friendica;
|
||||
namespace Friendica;
|
||||
|
||||
class Diaspora {
|
||||
class Diaspora {
|
||||
public function md2bbcode() {
|
||||
$html = \Michelf\MarkdownExtra::defaultTransform($text);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
if you use that class in many places of the code and you don't want to write the full path to the class every time, you can use the "use" PHP keyword
|
||||
|
||||
```php
|
||||
// src/Diaspora.php
|
||||
<?php
|
||||
namespace \Friendica;
|
||||
// src/Diaspora.php
|
||||
<?php
|
||||
namespace Friendica;
|
||||
|
||||
use \Michelf\MarkdownExtra;
|
||||
use \Michelf\MarkdownExtra;
|
||||
|
||||
class Diaspora {
|
||||
class Diaspora {
|
||||
public function md2bbcode() {
|
||||
$html = MarkdownExtra::defaultTransform($text);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that namespaces are like paths in filesystem, separated by "\", with the first "\" being the global scope.
|
||||
You can go deeper if you want to, like:
|
||||
|
||||
```
|
||||
// src/Network/Dfrn.php
|
||||
<?php
|
||||
namespace \Friendica\Network;
|
||||
// src/Network/Dfrn.php
|
||||
<?php
|
||||
namespace Friendica\Network;
|
||||
|
||||
class Dfrn {
|
||||
}
|
||||
class Dfrn {
|
||||
}
|
||||
```
|
||||
|
||||
Please note that the location of the file defining the class must be placed in the appropriate sub-folders of `src` if the namespace isn't plain `\Friendica`.
|
||||
Please note that the location of the file defining the class must be placed in the appropriate sub-folders of `src` if the namespace isn't plain `Friendica`.
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
// src/Dba/Mysql
|
||||
<?php
|
||||
namespace \Friendica\Dba;
|
||||
// src/Dba/Mysql
|
||||
<?php
|
||||
namespace Friendica\Dba;
|
||||
|
||||
class Mysql {
|
||||
}
|
||||
class Mysql {
|
||||
}
|
||||
```
|
||||
|
||||
So you can think of namespaces as folders in a Unix file system, with global scope as the root ("\").
|
||||
|
||||
## Related
|
||||
|
||||
* [Using Composer](help/Composer)
|
||||
* [How To Move Classes to `src`](help/Developer-How-To-Move-Classes-to-src)
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
// Included here for completeness, but this is a very dangerous operation.
|
||||
// It is the caller's responsibility to confirm the requestor's intent and
|
||||
// authorisation to do this.
|
||||
|
@ -852,4 +854,3 @@ function account_type($contact) {
|
|||
|
||||
return $account_type;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -81,4 +81,3 @@ class Emailer {
|
|||
return $res;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
/**
|
||||
* @file include/ForumManager.php
|
||||
* @brief ForumManager class with its methods related to forum functionality *
|
||||
|
|
|
@ -144,7 +144,6 @@ class NotificationsManager {
|
|||
/**
|
||||
* @brief List of pages for the Notifications TabBar
|
||||
*
|
||||
* @param app $a The
|
||||
* @return array with with notifications TabBar data
|
||||
*/
|
||||
public function getTabs() {
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* @brief This file contains the Photo class for image processing
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once("include/photos.php");
|
||||
|
||||
class Photo {
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use \Friendica\Core\PConfig;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
require_once("include/feed.php");
|
||||
require_once('include/email.php');
|
||||
|
@ -1261,4 +1262,3 @@ class Probe {
|
|||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* @brief This file contains the Smilies class which contains functions to handle smiles
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
/**
|
||||
* This class contains functions to handle smiles
|
||||
*/
|
||||
|
@ -64,41 +66,41 @@ class Smilies {
|
|||
);
|
||||
|
||||
$icons = array(
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-heart.gif" alt="<3" title="<3" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" title="</3" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" title="<\\3" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-smile.gif" alt=":-)" title=":-)" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-wink.gif" alt=";-)" title=";-)" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-frown.gif" alt=":-(" title=":-(" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" title=":-P" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" title=":-P" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" title=":-x" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" title=":-X" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" title=":-D" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" title="8-|" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" title="8-O" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" title="8-O" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" title="\\o/" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" title="o.O" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" title="O.o" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="o_O" title="o_O" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" title="O_o" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" title=":\'("/>',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" title=":-!" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" title=":-/" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" title=":-[" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-cool.gif" alt="8-)" title="8-)" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/beer_mug.gif" alt=":beer" title=":beer" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" title=":homebrew" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/coffee.gif" alt=":coffee" title=":coffee" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" title=":facepalm" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/like.gif" alt=":like" title=":like" />',
|
||||
'<img class="smiley" src="' . app::get_baseurl() . '/images/dislike.gif" alt=":dislike" title=":dislike" />',
|
||||
'<a href="http://friendica.com">~friendica <img class="smiley" src="' . app::get_baseurl() . '/images/friendica-16.png" alt="~friendica" title="~friendica" /></a>',
|
||||
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . app::get_baseurl() . '/images/rm-16.png" alt="red#" title="red#" />matrix</a>',
|
||||
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . app::get_baseurl() . '/images/rm-16.png" alt="red#matrix" title="red#matrix" />matrix</a>'
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-heart.gif" alt="<3" title="<3" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-brokenheart.gif" alt="</3" title="</3" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-brokenheart.gif" alt="<\\3" title="<\\3" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-smile.gif" alt=":-)" title=":-)" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-wink.gif" alt=";-)" title=";-)" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-frown.gif" alt=":-(" title=":-(" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-P" title=":-P" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-tongue-out.gif" alt=":-p" title=":-P" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-x" title=":-x" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-kiss.gif" alt=":-X" title=":-X" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-laughing.gif" alt=":-D" title=":-D" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" title="8-|" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" title="8-O" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-surprised.gif" alt=":-O" title="8-O" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" title="\\o/" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" title="o.O" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" title="O.o" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="o_O" title="o_O" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-Oo.gif" alt="O_o" title="O_o" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-cry.gif" alt=":\'(" title=":\'("/>',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" title=":-!" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-undecided.gif" alt=":-/" title=":-/" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-embarassed.gif" alt=":-[" title=":-[" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-cool.gif" alt="8-)" title="8-)" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/beer_mug.gif" alt=":beer" title=":beer" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" title=":homebrew" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/coffee.gif" alt=":coffee" title=":coffee" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-facepalm.gif" alt=":facepalm" title=":facepalm" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/like.gif" alt=":like" title=":like" />',
|
||||
'<img class="smiley" src="' . App::get_baseurl() . '/images/dislike.gif" alt=":dislike" title=":dislike" />',
|
||||
'<a href="http://friendica.com">~friendica <img class="smiley" src="' . App::get_baseurl() . '/images/friendica-16.png" alt="~friendica" title="~friendica" /></a>',
|
||||
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . App::get_baseurl() . '/images/rm-16.png" alt="red#" title="red#" />matrix</a>',
|
||||
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . App::get_baseurl() . '/images/rm-16.png" alt="red#matrix" title="red#matrix" />matrix</a>'
|
||||
);
|
||||
|
||||
$params = array('texts' => $texts, 'icons' => $icons);
|
||||
|
@ -174,7 +176,7 @@ class Smilies {
|
|||
return $x[0];
|
||||
$t = '';
|
||||
for($cnt = 0; $cnt < strlen($x[1]); $cnt ++)
|
||||
$t .= '<img class="smiley" src="' . app::get_baseurl() . '/images/smiley-heart.gif" alt="<3" />';
|
||||
$t .= '<img class="smiley" src="' . App::get_baseurl() . '/images/smiley-heart.gif" alt="<3" />';
|
||||
$r = str_replace($x[0],$t,$x[0]);
|
||||
return $r;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* @file include/acl_selectors.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once "include/contact_selectors.php";
|
||||
require_once "include/contact_widgets.php";
|
||||
require_once "include/DirSearch.php";
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* @todo Automatically detect if incoming data is HTML or BBCode
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once 'include/HTTPExceptions.php';
|
||||
require_once 'include/bbcode.php';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/security.php');
|
||||
require_once('include/datetime.php');
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
if (sizeof($_SERVER["argv"]) == 0)
|
||||
die();
|
||||
|
||||
|
@ -47,8 +49,9 @@ require_once("boot.php");
|
|||
|
||||
global $a, $db;
|
||||
|
||||
if (is_null($a))
|
||||
$a = new App;
|
||||
if (is_null($a)) {
|
||||
$a = new App(dirname(__DIR__));
|
||||
}
|
||||
|
||||
if (is_null($db)) {
|
||||
@include(".htconfig.php");
|
||||
|
@ -332,4 +335,3 @@ class exAuth {
|
|||
fclose($this->rLogFile);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
use League\HTMLToMarkdown\HtmlConverter;
|
||||
|
||||
require_once "include/oembed.php";
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once 'include/oembed.php';
|
||||
require_once 'include/event.php';
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* @brief Class for storing data for a short time
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use \Friendica\Core\PConfig;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
class Cache {
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php /** @file */
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('boot.php');
|
||||
|
||||
|
@ -11,7 +12,7 @@ function cli_startup() {
|
|||
global $a, $db;
|
||||
|
||||
if (is_null($a)) {
|
||||
$a = new App;
|
||||
$a = new App(dirname(__DIR__));
|
||||
}
|
||||
|
||||
if (is_null($db)) {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
* configurations need to be fixed as of 10/08/2011.
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use \Friendica\Core\PConfig;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
/**
|
||||
* @brief (Deprecated) Loads all configuration values of family into a cached storage.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function follow_widget($value = "") {
|
||||
|
||||
return replace_macros(get_markup_template('follow.tpl'), array(
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once "include/bbcode.php";
|
||||
require_once "include/acl_selectors.php";
|
||||
|
||||
|
||||
/*
|
||||
* Note: the code in 'item_extract_images' and 'item_redir_and_replace_images'
|
||||
* is identical to the code in mod/message.php for 'item_extract_images' and
|
||||
|
|
|
@ -17,4 +17,3 @@ function create_shadowentry_run($argv, $argc) {
|
|||
|
||||
add_shadow_entry($message_id);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function cron_run(&$argv, &$argc){
|
||||
global $a;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function cronhooks_run(&$argv, &$argc) {
|
||||
global $a;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function cronjobs_run(&$argv, &$argc){
|
||||
global $a;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @brief Some functions for date and time related tasks.
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
/**
|
||||
* @brief Two-level sort for timezones.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @brief The script is called from time to time to clean the database entries and remove orphaned data.
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function dbclean_run(&$argv, &$argc) {
|
||||
if (!Config::get('system', 'dbclean', false)) {
|
||||
|
@ -149,4 +149,3 @@ function remove_orphans($stage = 0) {
|
|||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -110,4 +110,3 @@ class dbm {
|
|||
return date('Y-m-d H:i:s', $timestamp);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("boot.php");
|
||||
require_once("include/text.php");
|
||||
|
@ -1745,7 +1746,7 @@ function dbstructure_run(&$argv, &$argc) {
|
|||
global $a, $db;
|
||||
|
||||
if (is_null($a)) {
|
||||
$a = new App;
|
||||
$a = new App(dirname(__DIR__));
|
||||
}
|
||||
|
||||
if (is_null($db)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function dbupdate_run(&$argv, &$argc) {
|
||||
global $a;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/queue_fn.php');
|
||||
require_once('include/html2plain.php');
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* https://github.com/friendica/friendica/blob/master/spec/dfrn2.pdf
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once("include/Contact.php");
|
||||
require_once("include/ostatus.php");
|
||||
require_once("include/enotify.php");
|
||||
|
@ -370,7 +372,7 @@ class dfrn {
|
|||
$ext = Photo::supportedTypes();
|
||||
|
||||
foreach ($rp as $p) {
|
||||
$photos[$p['scale']] = app::get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
|
||||
$photos[$p['scale']] = App::get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
|
||||
}
|
||||
|
||||
unset($rp, $ext);
|
||||
|
@ -431,7 +433,7 @@ class dfrn {
|
|||
$root->setAttribute("xmlns:ostatus", NAMESPACE_OSTATUS);
|
||||
$root->setAttribute("xmlns:statusnet", NAMESPACE_STATUSNET);
|
||||
|
||||
xml::add_element($doc, $root, "id", app::get_baseurl()."/profile/".$owner["nick"]);
|
||||
xml::add_element($doc, $root, "id", App::get_baseurl()."/profile/".$owner["nick"]);
|
||||
xml::add_element($doc, $root, "title", $owner["name"]);
|
||||
|
||||
$attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION);
|
||||
|
@ -448,13 +450,13 @@ class dfrn {
|
|||
// DFRN itself doesn't uses this. But maybe someone else wants to subscribe to the public feed.
|
||||
ostatus::hublinks($doc, $root);
|
||||
|
||||
$attributes = array("rel" => "salmon", "href" => app::get_baseurl()."/salmon/".$owner["nick"]);
|
||||
$attributes = array("rel" => "salmon", "href" => App::get_baseurl()."/salmon/".$owner["nick"]);
|
||||
xml::add_element($doc, $root, "link", "", $attributes);
|
||||
|
||||
$attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => app::get_baseurl()."/salmon/".$owner["nick"]);
|
||||
$attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => App::get_baseurl()."/salmon/".$owner["nick"]);
|
||||
xml::add_element($doc, $root, "link", "", $attributes);
|
||||
|
||||
$attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => app::get_baseurl()."/salmon/".$owner["nick"]);
|
||||
$attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => App::get_baseurl()."/salmon/".$owner["nick"]);
|
||||
xml::add_element($doc, $root, "link", "", $attributes);
|
||||
}
|
||||
|
||||
|
@ -511,7 +513,7 @@ class dfrn {
|
|||
}
|
||||
|
||||
xml::add_element($doc, $author, "name", $owner["name"], $attributes);
|
||||
xml::add_element($doc, $author, "uri", app::get_baseurl().'/profile/'.$owner["nickname"], $attributes);
|
||||
xml::add_element($doc, $author, "uri", App::get_baseurl().'/profile/'.$owner["nickname"], $attributes);
|
||||
xml::add_element($doc, $author, "dfrn:handle", $owner["addr"], $attributes);
|
||||
|
||||
$attributes = array("rel" => "photo", "type" => "image/jpeg",
|
||||
|
@ -812,7 +814,7 @@ class dfrn {
|
|||
$parent = q("SELECT `guid` FROM `item` WHERE `id` = %d", intval($item["parent"]));
|
||||
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
||||
$attributes = array("ref" => $parent_item, "type" => "text/html",
|
||||
"href" => app::get_baseurl().'/display/'.$parent[0]['guid'],
|
||||
"href" => App::get_baseurl().'/display/'.$parent[0]['guid'],
|
||||
"dfrn:diaspora_guid" => $parent[0]['guid']);
|
||||
xml::add_element($doc, $entry, "thr:in-reply-to", "", $attributes);
|
||||
}
|
||||
|
@ -854,7 +856,7 @@ class dfrn {
|
|||
|
||||
// We save this value in "plink". Maybe we should read it from there as well?
|
||||
xml::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
|
||||
"href" => app::get_baseurl()."/display/".$item["guid"]));
|
||||
"href" => App::get_baseurl()."/display/".$item["guid"]));
|
||||
|
||||
// "comment-allow" is some old fashioned stuff for old Friendica versions.
|
||||
// It is included in the rewritten code for completeness
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
* This will change in the future.
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once 'include/items.php';
|
||||
require_once 'include/bb2diaspora.php';
|
||||
|
@ -3819,4 +3820,3 @@ class Diaspora {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/// @TODO no longer used?
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function directory_run(&$argv, &$argc){
|
||||
$dir = get_config('system', 'directory');
|
||||
$dir = Config::get('system', 'directory');
|
||||
|
||||
if (!strlen($dir)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/datetime.php');
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/Emailer.php');
|
||||
require_once('include/email.php');
|
||||
require_once('include/bbcode.php');
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* @brief functions specific to event handling
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/map.php';
|
||||
require_once 'include/datetime.php';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function expire_run(&$argv, &$argc){
|
||||
global $a;
|
||||
|
|
|
@ -366,4 +366,3 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
|
|||
return array("header" => $author, "items" => $items);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -47,4 +47,3 @@ function update_files_for_items() {
|
|||
create_files_from_item($message["id"]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once("include/Scrape.php");
|
||||
require_once("include/socgraph.php");
|
||||
require_once('include/group.php');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/Scrape.php');
|
||||
require_once('include/socgraph.php');
|
||||
|
|
|
@ -325,4 +325,3 @@ function html2bbcode($message)
|
|||
|
||||
return $message;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -233,4 +233,3 @@ function html2plain($html, $wraplength = 75, $compact = false)
|
|||
|
||||
return(trim($message));
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* @file include/identity.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/ForumManager.php');
|
||||
require_once('include/bbcode.php');
|
||||
require_once("mod/proxy.php");
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
* @file include/items.php
|
||||
*/
|
||||
|
||||
use \Friendica\ParseUrl;
|
||||
use Friendica\App;
|
||||
use Friendica\ParseUrl;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/oembed.php';
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once("include/diaspora.php");
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
|
||||
// send a private message
|
||||
|
||||
|
||||
// send a private message
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function send_message($recipient=0, $body='', $subject='', $replyto=''){
|
||||
|
||||
|
|
|
@ -222,4 +222,3 @@ function removelinebreak($message)
|
|||
return(implode("\n", $lines));
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function nav(App $a) {
|
||||
|
||||
/*
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
* @file include/network.php
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("include/xml.php");
|
||||
require_once('include/Probe.php');
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/queue_fn.php');
|
||||
require_once('include/html2plain.php');
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
define('REQUEST_TOKEN_DURATION', 300);
|
||||
define('ACCESS_TOKEN_DURATION', 31536000);
|
||||
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
* @file include/oembed.php
|
||||
*/
|
||||
|
||||
use \Friendica\ParseUrl;
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\ParseUrl;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function oembed_replacecb($matches){
|
||||
$embedurl=$matches[1];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/follow.php');
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
* @file include/ostatus.php
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("include/Contact.php");
|
||||
require_once("include/threads.php");
|
||||
|
@ -2192,7 +2193,7 @@ class ostatus {
|
|||
/**
|
||||
* @brief Creates the XML feed for a given nickname
|
||||
*
|
||||
* @param app $a The application class
|
||||
* @param App $a The application class
|
||||
* @param string $owner_nick Nickname of the feed owner
|
||||
* @param string $last_update Date of the last update
|
||||
*
|
||||
|
@ -2288,4 +2289,3 @@ class ostatus {
|
|||
return(trim($doc->saveXML()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("include/dba.php");
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* @brief Functions related to photo handling.
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use \Friendica\Core\PConfig;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
|
||||
function getGps($exifCoord, $hemi) {
|
||||
$degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0;
|
||||
|
|
|
@ -38,4 +38,3 @@ class pidfile {
|
|||
return(posix_kill(file_get_contents($this->_file), SIGTERM));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
* @file include/plaintext.php
|
||||
*/
|
||||
|
||||
use \Friendica\ParseUrl;
|
||||
use Friendica\App;
|
||||
use Friendica\ParseUrl;
|
||||
|
||||
require_once("include/Photo.php");
|
||||
require_once("include/bbcode.php");
|
||||
|
@ -431,4 +432,3 @@ function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2
|
|||
|
||||
return($post);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* @brief Some functions to handle addons and themes.
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
/**
|
||||
* @brief uninstalls an addon.
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
|
||||
$directory = dirname($_SERVER["argv"][0]);
|
||||
|
||||
|
@ -10,15 +14,13 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
|
|||
chdir($directory);
|
||||
}
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
require_once("boot.php");
|
||||
|
||||
function poller_run($argv, $argc){
|
||||
global $a, $db;
|
||||
|
||||
if(is_null($a)) {
|
||||
$a = new App;
|
||||
if (is_null($a)) {
|
||||
$a = new App(dirname(__DIR__));
|
||||
}
|
||||
|
||||
if(is_null($db)) {
|
||||
|
@ -89,7 +91,6 @@ function poller_run($argv, $argc){
|
|||
if (time() > ($starttime + 3600))
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -687,4 +688,3 @@ if (array_search(__file__,get_included_files())===0){
|
|||
|
||||
killme();
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -258,5 +258,3 @@ function post_update_1206() {
|
|||
logger("Done", LOGGER_DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
use \Friendica\Core\Config;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/items.php');
|
||||
require_once('include/ostatus.php');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/queue_fn.php');
|
||||
require_once('include/dfrn.php');
|
||||
|
|
|
@ -129,4 +129,3 @@ function removetofu($message)
|
|||
|
||||
return($message);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function auto_redir(App $a, $contact_nick) {
|
||||
|
||||
// prevent looping
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @brief Removes orphaned data from deleted contacts
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function remove_contact_run($argv, $argc) {
|
||||
if ($argc != 2) {
|
||||
|
@ -22,4 +22,3 @@ function remove_contact_run($argv, $argc) {
|
|||
// Now we delete all the depending table entries
|
||||
dba::delete('contact', array('id' => $id));
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
/**
|
||||
* @brief Calculate the hash that is needed for the "Friendica" cookie
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("boot.php");
|
||||
require_once("include/threads.php");
|
||||
|
@ -9,7 +10,7 @@ function shadowupdate_run(&$argv, &$argc){
|
|||
global $a, $db;
|
||||
|
||||
if (is_null($a)) {
|
||||
$a = new App;
|
||||
$a = new App(dirname(__DIR__));
|
||||
}
|
||||
|
||||
if (is_null($db)) {
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
* @todo Detect if it is a forum
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('include/datetime.php');
|
||||
require_once("include/Scrape.php");
|
||||
|
@ -2340,4 +2341,3 @@ function poco_serverlist() {
|
|||
}
|
||||
return $r;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* @brief Posts items that wer spooled because they couldn't be posted.
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("include/items.php");
|
||||
|
||||
|
@ -55,4 +55,3 @@ function spool_post_run($argv, $argc) {
|
|||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function create_tags_from_item($itemid) {
|
||||
$profile_base = App::get_baseurl();
|
||||
$profile_data = parse_url($profile_base);
|
||||
|
@ -145,4 +148,3 @@ function update_items() {
|
|||
|
||||
dba::close($messages);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once("include/template_processor.php");
|
||||
require_once("include/friendica_smarty.php");
|
||||
require_once("include/Smilies.php");
|
||||
require_once("include/map.php");
|
||||
require_once("mod/proxy.php");
|
||||
|
||||
|
||||
if(! function_exists('replace_macros')) {
|
||||
/**
|
||||
* This is our template processor
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function add_thread($itemid, $onlyshadow = false) {
|
||||
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,
|
||||
`moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
|
||||
|
@ -293,4 +296,3 @@ function update_shadow_copy() {
|
|||
|
||||
dba::close($messages);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* import account file exported from mod/uexport
|
||||
* args:
|
||||
* $a App Friendica App Class
|
||||
* $file Array array from $_FILES
|
||||
*/
|
||||
use Friendica\App;
|
||||
|
||||
require_once("include/Photo.php");
|
||||
define("IMPORT_DEBUG", False);
|
||||
|
||||
|
@ -75,6 +71,12 @@ function import_cleanup($newuid) {
|
|||
q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Import account file exported from mod/uexport
|
||||
*
|
||||
* @param App $a Friendica App Class
|
||||
* @param array $file array from $_FILES
|
||||
*/
|
||||
function import_account(App $a, $file) {
|
||||
logger("Start user import from " . $file['tmp_name']);
|
||||
/*
|
||||
|
@ -255,10 +257,6 @@ function import_account(App $a, $file) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($account['photo'] as &$photo) {
|
||||
$photo['uid'] = $newuid;
|
||||
$photo['data'] = hex2bin($photo['data']);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function update_gcontact_run(&$argv, &$argc) {
|
||||
global $a;
|
||||
|
|
11
index.php
11
index.php
|
@ -13,12 +13,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once('boot.php');
|
||||
require_once('object/BaseObject.php');
|
||||
require_once 'boot.php';
|
||||
require_once 'object/BaseObject.php';
|
||||
|
||||
$a = new App;
|
||||
$a = new App(__DIR__);
|
||||
BaseObject::set_app($a);
|
||||
|
||||
// We assume that the index.php is called by a frontend process
|
||||
|
@ -73,7 +74,7 @@ if (!$install) {
|
|||
exit();
|
||||
}
|
||||
|
||||
require_once("include/session.php");
|
||||
require_once 'include/session.php';
|
||||
load_hooks();
|
||||
call_hooks('init_1');
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("mod/hostxrd.php");
|
||||
require_once("mod/nodeinfo.php");
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/Scrape.php');
|
||||
|
||||
function acctlink_init(App $a) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
/* ACL selector json backend */
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once 'include/acl_selectors.php';
|
||||
|
||||
function acl_init(App $a) {
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
* @brief Friendica admin
|
||||
*/
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
require_once("include/enotify.php");
|
||||
require_once("include/text.php");
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/Contact.php');
|
||||
require_once('include/contact_selectors.php');
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function amcd_content(App $a) {
|
||||
//header("Content-type: text/json");
|
||||
echo <<< EOT
|
||||
echo <<< JSON
|
||||
{
|
||||
"version":1,
|
||||
"sessionstatus":{
|
||||
|
@ -44,6 +45,6 @@ echo <<< EOT
|
|||
}
|
||||
}
|
||||
}
|
||||
EOT;
|
||||
killme();
|
||||
JSON;
|
||||
killme();
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/api.php');
|
||||
|
||||
function oauth_get_client($request){
|
||||
|
@ -106,8 +108,6 @@ function api_content(App $a) {
|
|||
'$no' => t('No'),
|
||||
));
|
||||
|
||||
//echo "<pre>"; var_dump($app); killme();
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
||||
|
|
24
mod/apps.php
24
mod/apps.php
|
@ -1,25 +1,25 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function apps_content(App $a) {
|
||||
$privateaddons = get_config('config','private_addons');
|
||||
$privateaddons = get_config('config', 'private_addons');
|
||||
if ($privateaddons === "1") {
|
||||
if((! (local_user()))) {
|
||||
info( t("You must be logged in to use addons. "));
|
||||
return;};
|
||||
}
|
||||
if (! local_user()) {
|
||||
info(t('You must be logged in to use addons. '));
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
$title = t('Applications');
|
||||
|
||||
if(count($a->apps)==0)
|
||||
notice( t('No installed applications.') . EOL);
|
||||
if (count($a->apps) == 0) {
|
||||
notice(t('No installed applications.') . EOL);
|
||||
}
|
||||
|
||||
|
||||
$tpl = get_markup_template("apps.tpl");
|
||||
$tpl = get_markup_template('apps.tpl');
|
||||
return replace_macros($tpl, array(
|
||||
'$title' => $title,
|
||||
'$apps' => $a->apps,
|
||||
));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/security.php');
|
||||
|
||||
function attach_init(App $a) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'library/markdown.php';
|
||||
require_once 'include/bb2diaspora.php';
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/conversation.php');
|
||||
require_once('include/items.php');
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
* of the profile owner
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/event.php');
|
||||
require_once('include/redir.php');
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* General purpose landing page for plugins/addons
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function cb_init(App $a) {
|
||||
call_hooks('cb_init');
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/Contact.php');
|
||||
require_once('include/contact_selectors.php');
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use \Friendica\Core\Config;
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Config;
|
||||
|
||||
function community_init(App $a) {
|
||||
if (! local_user()) {
|
||||
|
@ -9,7 +10,6 @@ function community_init(App $a) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function community_content(App $a, $update = 0) {
|
||||
|
||||
$o = '';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/group.php');
|
||||
|
||||
function contactgroup_content(App $a) {
|
||||
|
||||
|
||||
if (! local_user()) {
|
||||
killme();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
require_once('include/Contact.php');
|
||||
require_once('include/socgraph.php');
|
||||
require_once('include/contact_selectors.php');
|
||||
|
@ -828,7 +830,7 @@ function contacts_content(App $a) {
|
|||
*
|
||||
* Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
|
||||
*
|
||||
* @param app $a
|
||||
* @param App $a
|
||||
* @param int $contact_id The ID of the contact
|
||||
* @param int $active_tab 1 if tab should be marked as active
|
||||
*
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
// fast - e.g. one or two milliseconds to fetch parent items for the current content,
|
||||
// and 10-20 milliseconds to fetch all the child items.
|
||||
|
||||
use Friendica\App;
|
||||
|
||||
function content_content(App $a, $update = 0) {
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue