In your code, like in the function addon_name_content(), load the template file and execute it passing needed values:
```php
+use Friendica\Core\Renderer;
+
# load template file. first argument is the template name,
# second is the addon path relative to friendica top folder
$tpl = Renderer::getMarkupTemplate('mytemplate.tpl', __DIR__);
// 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
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
use Friendica\Core\ACL;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
use Friendica\Worker\Delivery;
use Friendica\Core\Config;
use Friendica\Core\Session;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Attach;
use Friendica\Model\User;
use Friendica\Util\Strings;
use FastRoute\RouteCollector;
use FastRoute\RouteParser\Std;
use Friendica\Core\Hook;
+use Friendica\DI;
use Friendica\Network\HTTPException;
/**
use Friendica\Core\Config\Cache\ConfigCache;
use Friendica\Database\Database;
use Friendica\Database\DBStructure;
+use Friendica\DI;
use Friendica\Util\Images;
use Friendica\Util\Network;
use Friendica\Util\Strings;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
+use Friendica\DI;
use Friendica\Util\DateTimeFormat;
require_once __DIR__ . '/../../include/dba.php';
* @param integer $uid User ID
*
* @return integer|boolean Public contact id for given user id
- * @throws Exception
+ * @throws \Exception
*/
public static function getPublicIdByUserId($uid)
{
use Friendica\BaseModule;
use Friendica\Core\Renderer;
+use Friendica\DI;
/**
* Show a credits page for all the developers who helped with the project
use Friendica\BaseModule;
use Friendica\Content\Text;
use Friendica\Core\Renderer;
+use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Util\XML;
use Friendica\Core\Protocol;
use Friendica\Core\Search;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Network\HTTPException;
* echoes account data and items as separated json, one per line
*
* @param App $a
- * @throws Exception
+ * @throws \Exception
*/
private static function exportAll(App $a)
{
namespace Friendica\Test\Util;
+use Friendica\Core\Cache\Duration;
+
trait DbaCacheMockTrait
{
/**
$this->mockIsResult(['v' => $value], isset($return), $times);
}
- protected function mockSet($key, $value, $ttl = Cache::FIVE_MINUTES, $time = null, $return = true, $times = null)
+ protected function mockSet($key, $value, $ttl = Duration::FIVE_MINUTES, $time = null, $return = true, $times = null)
{
if ($time === null) {
$time = time();