Browse Source

Rename App Methods

- renamed a lot of App methods to CamelCase
- replaced direct public variables with get-/set-Methods
pull/5862/head
Philipp Holzer 3 years ago
parent
commit
5a02e39a65
No known key found for this signature in database GPG Key ID: 517BE60E2CE5C8A5
94 changed files with 481 additions and 338 deletions
  1. +1
    -1
      bin/worker.php
  2. +12
    -12
      boot.php
  3. +1
    -1
      include/api.php
  4. +1
    -1
      include/enotify.php
  5. +1
    -1
      include/items.php
  6. +7
    -7
      include/text.php
  7. +4
    -6
      index.php
  8. +14
    -14
      mod/admin.php
  9. +1
    -1
      mod/allfriends.php
  10. +1
    -1
      mod/common.php
  11. +1
    -1
      mod/community.php
  12. +1
    -1
      mod/contacts.php
  13. +4
    -4
      mod/dfrn_request.php
  14. +2
    -2
      mod/directory.php
  15. +2
    -2
      mod/dirfind.php
  16. +1
    -1
      mod/display.php
  17. +1
    -1
      mod/hcard.php
  18. +2
    -2
      mod/home.php
  19. +1
    -1
      mod/hostxrd.php
  20. +2
    -2
      mod/match.php
  21. +1
    -1
      mod/message.php
  22. +5
    -5
      mod/network.php
  23. +1
    -1
      mod/nodeinfo.php
  24. +1
    -1
      mod/notes.php
  25. +1
    -1
      mod/notifications.php
  26. +1
    -1
      mod/notify.php
  27. +1
    -1
      mod/openid.php
  28. +1
    -1
      mod/opensearch.php
  29. +1
    -1
      mod/photo.php
  30. +5
    -5
      mod/photos.php
  31. +1
    -1
      mod/ping.php
  32. +2
    -2
      mod/profile.php
  33. +1
    -1
      mod/profiles.php
  34. +1
    -1
      mod/pubsubhubbub.php
  35. +1
    -1
      mod/redir.php
  36. +2
    -2
      mod/register.php
  37. +3
    -3
      mod/settings.php
  38. +2
    -2
      mod/videos.php
  39. +1
    -1
      mod/viewcontacts.php
  40. +3
    -3
      mod/xrd.php
  41. +141
    -112
      src/App.php
  42. +1
    -1
      src/Content/Nav.php
  43. +5
    -5
      src/Content/Text/BBCode.php
  44. +1
    -1
      src/Content/Text/Markdown.php
  45. +3
    -3
      src/Core/Addon.php
  46. +4
    -4
      src/Core/Cache.php
  47. +2
    -2
      src/Core/Cache/AbstractCacheDriver.php
  48. +2
    -2
      src/Core/Console/AutomaticInstallation.php
  49. +1
    -1
      src/Core/Console/DocBloxErrorChecker.php
  50. +1
    -1
      src/Core/Install.php
  51. +1
    -1
      src/Core/NotificationsManager.php
  52. +3
    -3
      src/Core/System.php
  53. +1
    -1
      src/Core/Theme.php
  54. +2
    -2
      src/Core/Worker.php
  55. +4
    -4
      src/Database/DBA.php
  56. +1
    -1
      src/Database/DBStructure.php
  57. +2
    -2
      src/Model/Contact.php
  58. +3
    -3
      src/Model/Item.php
  59. +1
    -1
      src/Model/Photo.php
  60. +2
    -2
      src/Model/Profile.php
  61. +1
    -1
      src/Model/User.php
  62. +9
    -9
      src/Module/Login.php
  63. +1
    -1
      src/Module/Logout.php
  64. +2
    -2
      src/Module/Magic.php
  65. +2
    -2
      src/Module/Proxy.php
  66. +92
    -0
      src/Network/Curl.php
  67. +1
    -1
      src/Network/Probe.php
  68. +5
    -5
      src/Object/Image.php
  69. +4
    -4
      src/Object/Post.php
  70. +6
    -6
      src/Protocol/DFRN.php
  71. +2
    -2
      src/Protocol/Diaspora.php
  72. +1
    -1
      src/Protocol/Feed.php
  73. +1
    -1
      src/Protocol/OStatus.php
  74. +2
    -2
      src/Protocol/PortableContact.php
  75. +4
    -4
      src/Protocol/Salmon.php
  76. +2
    -2
      src/Render/FriendicaSmarty.php
  77. +2
    -2
      src/Util/ExAuth.php
  78. +1
    -1
      src/Util/HTTPSignature.php
  79. +39
    -20
      src/Util/Network.php
  80. +1
    -1
      src/Util/Proxy.php
  81. +1
    -1
      src/Worker/Cron.php
  82. +3
    -3
      src/Worker/CronJobs.php
  83. +2
    -2
      src/Worker/Delivery.php
  84. +1
    -1
      src/Worker/Notifier.php
  85. +2
    -2
      src/Worker/OnePoll.php
  86. +1
    -1
      src/Worker/PubSubPublish.php
  87. +2
    -3
      tests/ApiTest.php
  88. +7
    -1
      tests/DatabaseTest.php
  89. +1
    -1
      tests/src/Core/Cache/MemoryCacheTest.php
  90. +1
    -1
      view/theme/duepuntozero/theme.php
  91. +1
    -1
      view/theme/frio/php/default.php
  92. +2
    -2
      view/theme/frio/theme.php
  93. +1
    -1
      view/theme/smoothly/theme.php
  94. +2
    -2
      view/theme/vier/theme.php

+ 1
- 1
bin/worker.php View File

@ -45,7 +45,7 @@ if (Config::get('system', 'maintenance', false, true)) {
return;
}
$a->set_baseurl(Config::get('system', 'url'));
$a->setBaseURL(Config::get('system', 'url'));
Addon::loadHooks();


+ 12
- 12
boot.php View File

@ -556,7 +556,7 @@ function check_url(App $a)
// and www.example.com vs example.com.
// We will only change the url to an ip address if there is no existing setting
if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname()))) {
if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->getHostName()))) {
Config::set('system', 'url', System::baseUrl());
}
@ -975,27 +975,27 @@ function get_temppath()
$temppath = Config::get("system", "temppath");
if (($temppath != "") && App::directory_usable($temppath)) {
if (($temppath != "") && App::isDirectoryUsable($temppath)) {
// We have a temp path and it is usable
return App::realpath($temppath);
return App::getRealPath($temppath);
}
// We don't have a working preconfigured temp path, so we take the system path.
$temppath = sys_get_temp_dir();
// Check if it is usable
if (($temppath != "") && App::directory_usable($temppath)) {
if (($temppath != "") && App::isDirectoryUsable($temppath)) {
// Always store the real path, not the path through symlinks
$temppath = App::realpath($temppath);
$temppath = App::getRealPath($temppath);
// To avoid any interferences with other systems we create our own directory
$new_temppath = $temppath . "/" . $a->get_hostname();
$new_temppath = $temppath . "/" . $a->getHostName();
if (!is_dir($new_temppath)) {
/// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
mkdir($new_temppath);
}
if (App::directory_usable($new_temppath)) {
if (App::isDirectoryUsable($new_temppath)) {
// The new path is usable, we are happy
Config::set("system", "temppath", $new_temppath);
return $new_temppath;
@ -1077,8 +1077,8 @@ function get_itemcachepath()
}
$itemcache = Config::get('system', 'itemcache');
if (($itemcache != "") && App::directory_usable($itemcache)) {
return App::realpath($itemcache);
if (($itemcache != "") && App::isDirectoryUsable($itemcache)) {
return App::getRealPath($itemcache);
}
$temppath = get_temppath();
@ -1089,7 +1089,7 @@ function get_itemcachepath()
mkdir($itemcache);
}
if (App::directory_usable($itemcache)) {
if (App::isDirectoryUsable($itemcache)) {
Config::set("system", "itemcache", $itemcache);
return $itemcache;
}
@ -1105,7 +1105,7 @@ function get_itemcachepath()
function get_spoolpath()
{
$spoolpath = Config::get('system', 'spoolpath');
if (($spoolpath != "") && App::directory_usable($spoolpath)) {
if (($spoolpath != "") && App::isDirectoryUsable($spoolpath)) {
// We have a spool path and it is usable
return $spoolpath;
}
@ -1120,7 +1120,7 @@ function get_spoolpath()
mkdir($spoolpath);
}
if (App::directory_usable($spoolpath)) {
if (App::isDirectoryUsable($spoolpath)) {
// The new path is usable, we are happy
Config::set("system", "spoolpath", $spoolpath);
return $spoolpath;


+ 1
- 1
include/api.php View File

@ -3344,7 +3344,7 @@ function api_statusnet_config($type)
$a = get_app();
$name = Config::get('config', 'sitename');
$server = $a->get_hostname();
$server = $a->getHostName();
$logo = System::baseUrl() . '/images/friendica-64.png';
$email = Config::get('config', 'admin_email');
$closed = intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 'true' : 'false';


+ 1
- 1
include/enotify.php View File

@ -61,7 +61,7 @@ function notification($params)
}
$sender_name = $sitename;
$hostname = $a->get_hostname();
$hostname = $a->getHostName();
if (strpos($hostname, ':')) {
$hostname = substr($hostname, 0, strpos($hostname, ':'));
}


+ 1
- 1
include/items.php View File

@ -318,7 +318,7 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub
Network::post($url, $params);
logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG);
logger('subscribe_to_hub: returns: ' . Network::getCurl()->getCode(), LOGGER_DEBUG);
return;


+ 7
- 7
include/text.php View File

@ -42,7 +42,7 @@ function replace_macros($s, $r) {
// pass $baseurl to all templates
$r['$baseurl'] = System::baseUrl();
$t = $a->template_engine();
$t = $a->getTemplateEngine();
try {
$output = $t->replaceMacros($s, $r);
} catch (Exception $e) {
@ -50,7 +50,7 @@ function replace_macros($s, $r) {
killme();
}
$a->save_timestamp($stamp1, "rendering");
$a->saveTimestamp($stamp1, "rendering");
return $output;
}
@ -473,7 +473,7 @@ function get_markup_template($s, $root = '') {
$stamp1 = microtime(true);
$a = get_app();
$t = $a->template_engine();
$t = $a->getTemplateEngine();
try {
$template = $t->getTemplateFile($s, $root);
} catch (Exception $e) {
@ -481,7 +481,7 @@ function get_markup_template($s, $root = '') {
killme();
}
$a->save_timestamp($stamp1, "file");
$a->saveTimestamp($stamp1, "file");
return $template;
}
@ -574,7 +574,7 @@ function logger($msg, $level = LOGGER_INFO) {
$stamp1 = microtime(true);
@file_put_contents($logfile, $logline, FILE_APPEND);
$a->save_timestamp($stamp1, "file");
$a->saveTimestamp($stamp1, "file");
}
/**
@ -634,7 +634,7 @@ function dlogger($msg, $level = LOGGER_INFO) {
$stamp1 = microtime(true);
@file_put_contents($logfile, $logline, FILE_APPEND);
$a->save_timestamp($stamp1, "file");
$a->saveTimestamp($stamp1, "file");
}
@ -1414,7 +1414,7 @@ function get_plink($item) {
];
if (x($item, 'plink')) {
$ret["href"] = $a->remove_baseurl($item['plink']);
$ret["href"] = $a->removeBaseURL($item['plink']);
$ret["title"] = L10n::t('link to source');
}


+ 4
- 6
index.php View File

@ -23,11 +23,9 @@ use Friendica\Module\Login;
require_once 'boot.php';
$a = new App(__DIR__);
// We assume that the index.php is called by a frontend process
// The value is set to "true" by default in boot.php
$a->backend = false;
$a = new App(__DIR__, false);
/**
* Try to open the database;
@ -49,7 +47,7 @@ if ($a->isMaxProcessesReached() || $a->isMaxLoadReached()) {
}
if (!$a->getMode()->isInstall()) {
if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http")
if (Config::get('system', 'force_ssl') && ($a->getScheme() == "http")
&& (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
&& (substr(System::baseUrl(), 0, 8) == "https://")
&& ($_SERVER['REQUEST_METHOD'] == 'GET')) {
@ -78,10 +76,10 @@ L10n::loadTranslationTable($lang);
*/
// Exclude the backend processes from the session management
if (!$a->is_backend()) {
if (!$a->isBackend()) {
$stamp1 = microtime(true);
session_start();
$a->save_timestamp($stamp1, "parser");
$a->saveTimestamp($stamp1, "parser");
} else {
$_SESSION = [];
Worker::executeIfIdle();


+ 14
- 14
mod/admin.php View File

@ -475,8 +475,8 @@ function admin_page_contactblock(App $a)
$total = DBA::count('contact', $condition);
$a->set_pager_total($total);
$a->set_pager_itemspage(30);
$a->setPagerTotal($total);
$a->setPagerItemsPage(30);
$statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
@ -866,15 +866,15 @@ function admin_page_summary(App $a)
// Legacy config file warning
if (file_exists('.htconfig.php')) {
$showwarning = true;
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.ini.php, please copy config/local-sample.ini.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->get_baseurl() . '/help/Config');
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.ini.php, please copy config/local-sample.ini.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config');
}
// Check server vitality
if (!admin_page_server_vital()) {
$showwarning = true;
$well_known = $a->get_baseurl() . '/.well-known/host-meta';
$well_known = $a->getBaseURL() . '/.well-known/host-meta';
$warningtext[] = L10n::t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.',
$well_known, $well_known, $a->get_baseurl() . '/help/Install');
$well_known, $well_known, $a->getBaseURL() . '/help/Install');
}
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
@ -1012,7 +1012,7 @@ function admin_page_site_post(App $a)
// update config
Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
Config::set('system', 'url', $new_url);
$a->set_baseurl($new_url);
$a->setBaseURL($new_url);
// send relocate
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
@ -1124,7 +1124,7 @@ function admin_page_site_post(App $a)
Worker::add(PRIORITY_LOW, 'Directory');
}
if ($a->get_path() != "") {
if ($a->getURLpath() != "") {
$diaspora_enabled = false;
}
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
@ -1261,7 +1261,7 @@ function admin_page_site_post(App $a)
Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
if ($itemcache != '') {
$itemcache = App::realpath($itemcache);
$itemcache = App::getRealPath($itemcache);
}
Config::set('system', 'itemcache', $itemcache);
@ -1269,13 +1269,13 @@ function admin_page_site_post(App $a)
Config::set('system', 'max_comments', $max_comments);
if ($temppath != '') {
$temppath = App::realpath($temppath);
$temppath = App::getRealPath($temppath);
}
Config::set('system', 'temppath', $temppath);
if ($basepath != '') {
$basepath = App::realpath($basepath);
$basepath = App::getRealPath($basepath);
}
Config::set('system', 'basepath', $basepath);
@ -1419,9 +1419,9 @@ function admin_page_site(App $a)
];
if (empty(Config::get('config', 'hostname'))) {
Config::set('config', 'hostname', $a->get_hostname());
Config::set('config', 'hostname', $a->getHostName());
}
$diaspora_able = ($a->get_path() == "");
$diaspora_able = ($a->getURLpath() == "");
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
@ -1801,8 +1801,8 @@ function admin_page_users(App $a)
/* get users */
$total = q("SELECT COUNT(*) AS `total` FROM `user` WHERE 1");
if (count($total)) {
$a->set_pager_total($total[0]['total']);
$a->set_pager_itemspage(100);
$a->setPagerTotal($total[0]['total']);
$a->setPagerItemsPage(100);
}
/* ordering */


+ 1
- 1
mod/allfriends.php View File

@ -46,7 +46,7 @@ function allfriends_content(App $a)
$total = GContact::countAllFriends(local_user(), $cid);
$a->set_pager_total($total);
$a->setPagerTotal($total);
$r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
if (!DBA::isResult($r)) {


+ 1
- 1
mod/common.php View File

@ -88,7 +88,7 @@ function common_content(App $a)
}
if ($t > 0) {
$a->set_pager_total($t);
$a->setPagerTotal($t);
} else {
notice(L10n::t('No contacts in common.') . EOL);
return $o;


+ 1
- 1
mod/community.php View File

@ -153,7 +153,7 @@ function community_content(App $a, $update = 0)
$itemspage_network = $a->force_max_items;
}
$a->set_pager_itemspage($itemspage_network);
$a->setPagerItemsPage($itemspage_network);
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content, $accounttype);


+ 1
- 1
mod/contacts.php View File

@ -793,7 +793,7 @@ function contacts_content(App $a, $update = 0)
intval($_SESSION['uid'])
);
if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
$a->setPagerTotal($r[0]['total']);
$total = $r[0]['total'];
}


+ 4
- 4
mod/dfrn_request.php View File

@ -451,10 +451,10 @@ function dfrn_request_post(App $a)
// Diaspora needs the uri in the format user@domain.tld
// Diaspora will support the remote subscription in a future version
if ($network == Protocol::DIASPORA) {
$uri = $nickname . '@' . $a->get_hostname();
$uri = $nickname . '@' . $a->getHostName();
if ($a->get_path()) {
$uri .= '/' . $a->get_path();
if ($a->getURLpath()) {
$uri .= '/' . $a->getURLpath();
}
$uri = urlencode($uri);
@ -609,7 +609,7 @@ function dfrn_request_content(App $a)
} elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
$myaddr = $_GET['address'];
} elseif (local_user()) {
if (strlen($a->urlpath)) {
if (strlen($a->getURLpath())) {
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
} else {
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);


+ 2
- 2
mod/directory.php View File

@ -16,7 +16,7 @@ use Friendica\Util\Proxy as ProxyUtils;
function directory_init(App $a)
{
$a->set_pager_itemspage(60);
$a->setPagerItemsPage(60);
if (local_user()) {
$a->page['aside'] .= Widget::findPeople();
@ -87,7 +87,7 @@ function directory_content(App $a)
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` $sql_extra");
if (DBA::isResult($cnt)) {
$a->set_pager_total($cnt['total']);
$a->setPagerTotal($cnt['total']);
}
$order = " ORDER BY `name` ASC ";


+ 2
- 2
mod/dirfind.php View File

@ -188,8 +188,8 @@ function dirfind_content(App $a, $prefix = "") {
}
if ($j->total) {
$a->set_pager_total($j->total);
$a->set_pager_itemspage($j->items_page);
$a->setPagerTotal($j->total);
$a->setPagerItemsPage($j->items_page);
}
if (!empty($j->results)) {


+ 1
- 1
mod/display.php View File

@ -365,7 +365,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$title = trim(HTML::toPlaintext(BBCode::convert($item["title"], false), 0, true));
$author_name = $item["author-name"];
$image = $a->remove_baseurl($item["author-avatar"]);
$image = $a->removeBaseURL($item["author-avatar"]);
if ($title == "") {
$title = $author_name;


+ 1
- 1
mod/hcard.php View File

@ -50,7 +50,7 @@ function hcard_init(App $a)
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->urlpath) ? '/' . $a->urlpath : ''));
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLpath()) ? '/' . $a->getURLpath() : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);


+ 2
- 2
mod/home.php View File

@ -38,8 +38,8 @@ function home_content(App $a) {
$customhome = false;
$defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
$homefilepath = $a->basepath . "/home.html";
$cssfilepath = $a->basepath . "/home.css";
$homefilepath = $a->getBasePath() . "/home.html";
$cssfilepath = $a->getBasePath() . "/home.css";
if (file_exists($homefilepath)) {
$customhome = $homefilepath;
if (file_exists($cssfilepath)) {


+ 1
- 1
mod/hostxrd.php View File

@ -23,7 +23,7 @@ function hostxrd_init(App $a)
$tpl = get_markup_template('xrd_host.tpl');
echo replace_macros($tpl, [
'$zhost' => $a->get_hostname(),
'$zhost' => $a->getHostName(),
'$zroot' => System::baseUrl(),
'$domain' => System::baseUrl(),
'$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey'))]


+ 2
- 2
mod/match.php View File

@ -67,8 +67,8 @@ function match_content(App $a)
$j = json_decode($x);
if ($j->total) {
$a->set_pager_total($j->total);
$a->set_pager_itemspage($j->items_page);
$a->setPagerTotal($j->total);
$a->setPagerItemsPage($j->items_page);
}
if (count($j->results)) {


+ 1
- 1
mod/message.php View File

@ -279,7 +279,7 @@ function message_content(App $a)
);
if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
$a->setPagerTotal($r[0]['total']);
}
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);


+ 5
- 5
mod/network.php View File

@ -302,7 +302,7 @@ function networkPager($a, $update)
$itemspage_network = $a->force_max_items;
}
$a->set_pager_itemspage($itemspage_network);
$a->setPagerItemsPage($itemspage_network);
return sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
}
@ -721,7 +721,7 @@ function networkThreadedView(App $a, $update, $parent)
if ($last_received != '') {
$last_date = $last_received;
$sql_range .= sprintf(" AND $sql_table.`received` < '%s'", DBA::escape($last_received));
$a->set_pager_page(1);
$a->setPagerPage(1);
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
}
break;
@ -729,7 +729,7 @@ function networkThreadedView(App $a, $update, $parent)
if ($last_commented != '') {
$last_date = $last_commented;
$sql_range .= sprintf(" AND $sql_table.`commented` < '%s'", DBA::escape($last_commented));
$a->set_pager_page(1);
$a->setPagerPage(1);
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
}
break;
@ -737,14 +737,14 @@ function networkThreadedView(App $a, $update, $parent)
if ($last_created != '') {
$last_date = $last_created;
$sql_range .= sprintf(" AND $sql_table.`created` < '%s'", DBA::escape($last_created));
$a->set_pager_page(1);
$a->setPagerPage(1);
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
}
break;
case 'id':
if (($last_id > 0) && ($sql_table == '`thread`')) {
$sql_range .= sprintf(" AND $sql_table.`iid` < '%s'", DBA::escape($last_id));
$a->set_pager_page(1);
$a->setPagerPage(1);
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
}
break;


+ 1
- 1
mod/nodeinfo.php View File

@ -215,7 +215,7 @@ function nodeinfo_cron() {
logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
// Now trying to register
$url = 'http://the-federation.info/register/'.$a->get_hostname();
$url = 'http://the-federation.info/register/'.$a->getHostName();
logger('registering url: '.$url, LOGGER_DEBUG);
$ret = Network::fetchUrl($url);
logger('registering answer: '.$ret, LOGGER_DEBUG);


+ 1
- 1
mod/notes.php View File

@ -61,7 +61,7 @@ function notes_content(App $a, $update = false)
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
'wall' => false, 'contact-id'=> $a->contact['id']];
$a->set_pager_itemspage(40);
$a->setPagerItemsPage(40);
$params = ['order' => ['created' => true],
'limit' => [$a->pager['start'], $a->pager['itemspage']]];


+ 1
- 1
mod/notifications.php View File

@ -120,7 +120,7 @@ function notifications_content(App $a)
}
// Set the pager
$a->set_pager_itemspage($perpage);
$a->setPagerItemsPage($perpage);
// Add additional informations (needed for json output)
$notifs['items_page'] = $a->pager['itemspage'];


+ 1
- 1
mod/notify.php View File

@ -27,7 +27,7 @@ function notify_init(App $a)
$nm->setSeen($note);
// The friendica client has problems with the GUID. this is some workaround
if ($a->is_friendica_app()) {
if ($a->isFriendicaApp()) {
require_once("include/items.php");
$urldata = parse_url($note['link']);
$guid = basename($urldata["path"]);


+ 1
- 1
mod/openid.php View File

@ -19,7 +19,7 @@ function openid_content(App $a) {
if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
$openid = new LightOpenID($a->get_hostname());
$openid = new LightOpenID($a->getHostName());
if($openid->validate()) {


+ 1
- 1
mod/opensearch.php View File

@ -11,7 +11,7 @@ function opensearch_content(App $a) {
$o = replace_macros($tpl, [
'$baseurl' => System::baseUrl(),
'$nodename' => $a->get_hostname(),
'$nodename' => $a->getHostName(),
]);
echo $o;


+ 1
- 1
mod/photo.php View File

@ -192,7 +192,7 @@ function photo_init(App $a)
// If the photo is public and there is an existing photo directory store the photo there
if ($public and $file != '') {
// If the photo path isn't there, try to create it
$basepath = $a->get_basepath();
$basepath = $a->getBasePath();
if (!is_dir($basepath . "/photo")) {
if (is_writable($basepath)) {
mkdir($basepath . "/photo");


+ 5
- 5
mod/photos.php View File

@ -1143,8 +1143,8 @@ function photos_content(App $a)
DBA::escape($album)
);
if (DBA::isResult($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
$a->setPagerTotal(count($r));
$a->setPagerItemsPage(20);
}
/// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
@ -1393,7 +1393,7 @@ function photos_content(App $a)
$link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
$a->set_pager_total(DBA::count('item', $condition));
$a->setPagerTotal(DBA::count('item', $condition));
$params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
$result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
@ -1655,8 +1655,8 @@ function photos_content(App $a)
);
if (DBA::isResult($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
$a->setPagerTotal(count($r));
$a->setPagerItemsPage(20);
}
$r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,


+ 1
- 1
mod/ping.php View File

@ -350,7 +350,7 @@ function ping_init(App $a)
$regularnotifications = (!empty($_GET['uid']) && !empty($_GET['_']));
foreach ($notifs as $notif) {
if ($a->is_friendica_app() || !$regularnotifications) {
if ($a->isFriendicaApp() || !$regularnotifications) {
$notif['message'] = str_replace("{0}", $notif['name'], $notif['message']);
}


+ 2
- 2
mod/profile.php View File

@ -91,7 +91,7 @@ function profile_init(App $a)
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : ''));
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . ($a->getURLpath() ? '/' . $a->getURLpath() : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
@ -307,7 +307,7 @@ function profile_content(App $a, $update = 0)
$itemspage_network = $a->force_max_items;
}
$a->set_pager_itemspage($itemspage_network);
$a->setPagerItemsPage($itemspage_network);
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));


+ 1
- 1
mod/profiles.php View File

@ -667,7 +667,7 @@ function profiles_content(App $a) {
$profiles = '';
foreach ($r as $rr) {
$profiles .= replace_macros($tpl, [
'$photo' => $a->remove_baseurl($rr['thumb']),
'$photo' => $a->removeBaseURL($rr['thumb']),
'$id' => $rr['id'],
'$alt' => L10n::t('Profile Image'),
'$profile_name' => $rr['profile-name'],


+ 1
- 1
mod/pubsubhubbub.php View File

@ -105,7 +105,7 @@ function pubsubhubbub_init(App $a) {
// Social/StatusNet doesn't honour it (yet)
$body = Network::fetchUrl($hub_callback . "?" . $params);
$ret = $a->get_curl_code();
$ret = Network::getCurl()->getCode();
// give up if the HTTP return code wasn't a success (2xx)
if ($ret < 200 || $ret > 299) {


+ 1
- 1
mod/redir.php View File

@ -57,7 +57,7 @@ function redir_init(App $a) {
}
if (remote_user()) {
$host = substr(System::baseUrl() . ($a->urlpath ? '/' . $a->urlpath : ''), strpos(System::baseUrl(), '://') + 3);
$host = substr(System::baseUrl() . ($a->getURLpath() ? '/' . $a->getURLpath() : ''), strpos(System::baseUrl(), '://') + 3);
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
// On a local instance we have to check if the local user has already authenticated


+ 2
- 2
mod/register.php View File

@ -274,7 +274,7 @@ function register_content(App $a)
'$passwords' => $passwords,
'$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
'$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->get_hostname()),
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->getHostName()),
'$nicklabel' => L10n::t('Choose a nickname: '),
'$photo' => $photo,
'$publish' => $profile_publish,
@ -283,7 +283,7 @@ function register_content(App $a)
'$email' => $email,
'$nickname' => $nickname,
'$license' => $license,
'$sitename' => $a->get_hostname(),
'$sitename' => $a->getHostName(),
'$importh' => L10n::t('Import'),
'$importt' => L10n::t('Import your profile to this friendica instance'),
'$showtoslink' => Config::get('system', 'tosdisplay'),


+ 3
- 3
mod/settings.php View File

@ -547,7 +547,7 @@ function settings_post(App $a)
if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
if (Network::isUrlValid($openid)) {
logger('updating openidserver');
$open_id_obj = new LightOpenID($a->get_hostname());
$open_id_obj = new LightOpenID($a->getHostName());
$open_id_obj->identity = $openid;
$openidserver = $open_id_obj->discover($open_id_obj->identity);
} else {
@ -1136,8 +1136,8 @@ function settings_content(App $a)
$tpl_addr = get_markup_template('settings/nick_set.tpl');
$prof_addr = replace_macros($tpl_addr,[
'$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->get_hostname() . $a->get_path(), System::baseUrl() . '/profile/' . $nickname),
'$basepath' => $a->get_hostname()
'$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLpath(), System::baseUrl() . '/profile/' . $nickname),
'$basepath' => $a->getHostName()
]);
$stpl = get_markup_template('settings/settings.tpl');


+ 2
- 2
mod/videos.php View File

@ -341,8 +341,8 @@ function videos_content(App $a)
);
if (DBA::isResult($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
$a->setPagerTotal(count($r));
$a->setPagerItemsPage(20);
}
$r = q("SELECT hash, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`created`) AS `created`,


+ 1
- 1
mod/viewcontacts.php View File

@ -71,7 +71,7 @@ function viewcontacts_content(App $a)
DBA::escape(Protocol::OSTATUS)
);
if (DBA::isResult($r)) {
$a->set_pager_total($r[0]['total']);
$a->setPagerTotal($r[0]['total']);
}
$r = q("SELECT * FROM `contact`


+ 3
- 3
mod/xrd.php View File

@ -55,9 +55,9 @@ function xrd_init(App $a)
$alias = str_replace('/profile/', '/~', $profile_url);
$addr = 'acct:'.$user['nickname'].'@'.$a->get_hostname();
if ($a->get_path()) {
$addr .= '/'.$a->get_path();
$addr = 'acct:'.$user['nickname'].'@'.$a->getHostName();
if ($a->getURLpath()) {
$addr .= '/'.$a->getURLpath();
}
if ($mode == 'xml') {


+ 141
- 112
src/App.php View File

@ -54,8 +54,6 @@ class App
public $argc;
public $module;
public $strings;
public $basepath;
public $urlpath;
public $hooks = [];
public $timezone;
public $interactive = true;
@ -65,11 +63,9 @@ class App
public $identities;
public $is_mobile = false;
public $is_tablet = false;
public $is_friendica_app;
public $performance = [];
public $callstack = [];
public $theme_info = [];
public $backend = true;
public $nav_sel;
public $category;
// Allow themes to control internal parameters
@ -89,6 +85,31 @@ class App
*/
private $mode;
/**
* @var string The App basepath
*/
private $basepath;
/**
* @var string The App URL path
*/
private $urlpath;
/**
* @var bool true, if the call is from the Friendica APP, otherwise false
*/
private $isFriendicaApp;
/**
* @var bool true, if the call is from an backend node (f.e. worker)
*/
private $isBackend;
/**
* @var string The name of the current theme
*/
private $currentTheme;
/**
* Register a stylesheet file path to be included in the <head> tag of every page.
* Inclusion is done in App->initHead().
@ -100,7 +121,7 @@ class App
*/
public function registerStylesheet($path)
{
$url = str_replace($this->get_basepath() . DIRECTORY_SEPARATOR, '', $path);
$url = str_replace($this->getBasePath() . DIRECTORY_SEPARATOR, '', $path);
$this->stylesheets[] = trim($url, '/');
}
@ -116,7 +137,7 @@ class App
*/
public function registerFooterScript($path)
{
$url = str_replace($this->get_basepath() . DIRECTORY_SEPARATOR, '', $path);
$url = str_replace($this->getBasePath() . DIRECTORY_SEPARATOR, '', $path);
$this->footerScripts[] = trim($url, '/');
}
@ -157,26 +178,26 @@ class App
];
private $scheme;
private $hostname;
private $curl_code;
private $curl_content_type;
private $curl_headers;
/**
* @brief App constructor.
*
* @param string $basepath Path to the app base folder
* @param bool $backend true, if the call is from backend, otherwise set to true (Default true)
*
* @throws Exception if the Basepath is not usable
*/
public function __construct($basepath)
public function __construct($basepath, $backend = true)
{
if (!static::directory_usable($basepath, false)) {
if (!static::isDirectoryUsable($basepath, false)) {
throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
}
BaseObject::setApp($this);
$this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
$this->checkBackend($backend);
$this->checkFriendicaApp();
$this->performance['start'] = microtime(true);
$this->performance['database'] = 0;
@ -230,9 +251,9 @@ class App
set_include_path(
get_include_path() . PATH_SEPARATOR
. $this->basepath . DIRECTORY_SEPARATOR . 'include' . PATH_SEPARATOR
. $this->basepath . DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
. $this->basepath);
. $this->getBasePath() . DIRECTORY_SEPARATOR . 'include' . PATH_SEPARATOR
. $this->getBasePath(). DIRECTORY_SEPARATOR . 'library' . PATH_SEPARATOR
. $this->getBasePath());
if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 9) === 'pagename=') {
$this->query_string = substr($_SERVER['QUERY_STRING'], 9);
@ -301,11 +322,8 @@ class App
$this->is_mobile = $mobile_detect->isMobile();
$this->is_tablet = $mobile_detect->isTablet();
// Friendica-Client
$this->is_friendica_app = isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'Apache-HttpClient/UNAVAILABLE (java 1.4)';
// Register template engines
$this->register_template_engine('Friendica\Render\FriendicaSmartyEngine');
$this->registerTemplateEngine('Friendica\Render\FriendicaSmartyEngine');
}
/**
@ -334,9 +352,9 @@ class App
$this->loadDatabase();
$this->getMode()->determine($this->basepath);
$this->getMode()->determine($this->getBasePath());
$this->determineUrlPath();
$this->determineURLPath();
Config::load();
@ -372,20 +390,20 @@ class App
*/
private function loadConfigFiles()
{
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.ini.php');
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.ini.php');
$this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.ini.php');
$this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.ini.php');
// Legacy .htconfig.php support
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
$a = $this;
include $this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php';
include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php';
}
// Legacy .htconfig.php support
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php')) {
if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htconfig.php')) {
$a = $this;
include $this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php';
include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htconfig.php';
$this->setConfigValue('database', 'hostname', $db_host);
$this->setConfigValue('database', 'username', $db_user);
@ -413,8 +431,8 @@ class App
}
}
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', true);
if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
$this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php', true);
}
}
@ -473,8 +491,8 @@ class App
Core\Addon::callHooks('load_config');
// Load the local addon config file to overwritten default addon config values
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php')) {
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php', true);
if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php')) {
$this->loadConfigFile($this->getBasePath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php', true);
}
}
@ -502,7 +520,7 @@ class App
/**
* Figure out if we are running at the top of a domain or in a sub-directory and adjust accordingly
*/
private function determineUrlPath()
private function determineURLPath()
{
$this->urlpath = $this->getConfigValue('system', 'urlpath');
@ -562,7 +580,7 @@ class App
DBA::connect($db_host, $db_user, $db_pass, $db_data, $charset);
unset($db_host, $db_user, $db_pass, $db_data, $charset);
$this->save_timestamp($stamp1, 'network');
$this->saveTimestamp($stamp1, 'network');
}
/**
@ -573,7 +591,7 @@ class App
*
* @return string
*/
public function get_basepath()
public function getBasePath()
{
$basepath = $this->basepath;
@ -589,7 +607,7 @@ class App
$basepath = $_SERVER['PWD'];
}
return self::realpath($basepath);
return self::getRealPath($basepath);
}
/**
@ -602,7 +620,7 @@ class App
* @param string $path The path that is about to be normalized
* @return string normalized path - when possible
*/
public static function realpath($path)
public static function getRealPath($path)
{
$normalized = realpath($path);
@ -613,7 +631,7 @@ class App
}
}
public function get_scheme()
public function getScheme()
{
return $this->scheme;
}
@ -632,7 +650,7 @@ class App
* @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN
* @return string Friendica server base URL
*/
public function get_baseurl($ssl = false)
public function getBaseURL($ssl = false)
{
$scheme = $this->scheme;
@ -655,7 +673,7 @@ class App
$this->hostname = Config::get('config', 'hostname');
}
return $scheme . '://' . $this->hostname . (!empty($this->urlpath) ? '/' . $this->urlpath : '' );
return $scheme . '://' . $this->hostname . (!empty($this->getURLpath()) ? '/' . $this->getURLpath() : '' );
}
/**
@ -665,7 +683,7 @@ class App
*
* @param string $url
*/
public function set_baseurl($url)
public function setBaseURL($url)
{
$parsed = @parse_url($url);
$hostname = '';
@ -686,8 +704,8 @@ class App
$this->urlpath = trim($parsed['path'], '\\/');
}
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
include $this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php';
if (file_exists($this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
include $this->getBasePath() . DIRECTORY_SEPARATOR . '.htpreconfig.php';
}
if (Config::get('config', 'hostname') != '') {
@ -700,7 +718,7 @@ class App
}
}
public function get_hostname()
public function getHostName()
{
if (Config::get('config', 'hostname') != '') {
$this->hostname = Config::get('config', 'hostname');
@ -709,23 +727,23 @@ class App
return $this->hostname;
}
public function get_path()
public function getURLpath()
{
return $this->urlpath;
}
public function set_pager_total($n)
public function setPagerTotal($n)
{
$this->pager['total'] = intval($n);
}
public function set_pager_itemspage($n)
public function setPagerItemsPage($n)
{
$this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0);
$this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
}
public function set_pager_page($n)
public function setPagerPage($n)
{
$this->pager['page'] = $n;
$this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage'];
@ -791,7 +809,7 @@ class App
* being first
*/
$this->page['htmlhead'] = replace_macros($tpl, [
'$baseurl' => $this->get_baseurl(),
'$baseurl' => $this->getBaseURL(),
'$local_user' => local_user(),
'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
'$delitem' => L10n::t('Delete this item?'),
@ -847,41 +865,11 @@ class App
$tpl = get_markup_template('footer.tpl');
$this->page['footer'] = replace_macros($tpl, [
'$baseurl' => $this->get_baseurl(),
'$baseurl' => $this->getBaseURL(),
'$footerScripts' => $this->footerScripts,
]) . $this->page['footer'];
}
public function set_curl_code($code)
{
$this->curl_code = $code;
}
public function get_curl_code()
{
return $this->curl_code;
}
public function set_curl_content_type($content_type)
{
$this->curl_content_type = $content_type;
}
public function get_curl_content_type()
{
return $this->curl_content_type;
}
public function set_curl_headers($headers)
{
$this->curl_headers = $headers;
}
public function get_curl_headers()
{
return $this->curl_headers;
}
/**
* @brief Removes the base url from an url. This avoids some mixed content problems.
*
@ -889,11 +877,11 @@ class App
*
* @return string The cleaned url
*/
public function remove_baseurl($orig_url)
public function removeBaseURL($orig_url)
{
// Remove the hostname from the url if it is an internal link
$nurl = normalise_link($orig_url);
$base = normalise_link($this->get_baseurl());
$base = normalise_link($this->getBaseURL());
$url = str_replace($base . '/', '', $nurl);
// if it is an external link return the orignal value
@ -909,7 +897,7 @@ class App
*
* @param string $class
*/
private function register_template_engine($class)
private function registerTemplateEngine($class)
{
$v = get_class_vars($class);
if (x($v, 'name')) {
@ -929,7 +917,7 @@ class App
*
* @return object Template Engine instance
*/
public function template_engine()
public function getTemplateEngine()
{
$template_engine = 'smarty3';
if (x($this->theme, 'template_engine')) {
@ -956,33 +944,40 @@ class App
*
* @return string
*/
public function get_template_engine()
public function getActiveTemplateEngine()
<