Normalize App parameter declaration (doc-include folders, boot)

This commit is contained in:
Hypolite Petovan 2017-01-09 23:09:01 +11:00
parent ee39aba490
commit 87eb3d5ef2
20 changed files with 142 additions and 142 deletions

View file

@ -1540,7 +1540,7 @@ function check_db() {
* Sets the base url for use in cmdline programs which don't have * Sets the base url for use in cmdline programs which don't have
* $_SERVER variables * $_SERVER variables
*/ */
function check_url(App &$a) { function check_url(App $a) {
$url = get_config('system','url'); $url = get_config('system','url');
@ -1562,7 +1562,7 @@ function check_url(App &$a) {
/** /**
* @brief Automatic database updates * @brief Automatic database updates
*/ */
function update_db(App &$a) { function update_db(App $a) {
$build = get_config('system','build'); $build = get_config('system','build');
if(! x($build)) if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION); $build = set_config('system','build',DB_UPDATE_VERSION);
@ -1678,7 +1678,7 @@ function run_update_function($x) {
* @param App $a * @param App $a
* *
*/ */
function check_plugins(App &$a) { function check_plugins(App $a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1"); $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if (dbm::is_result($r)) if (dbm::is_result($r))
@ -2414,7 +2414,7 @@ function get_temppath() {
} }
/// @deprecated /// @deprecated
function set_template_engine(App &$a, $engine = 'internal') { function set_template_engine(App $a, $engine = 'internal') {
/// @note This function is no longer necessary, but keep it as a wrapper to the class method /// @note This function is no longer necessary, but keep it as a wrapper to the class method
/// to avoid breaking themes again unnecessarily /// to avoid breaking themes again unnecessarily

View file

@ -40,7 +40,7 @@ Arguments
--- ---
Your hook callback functions will be called with at least one and possibly two arguments Your hook callback functions will be called with at least one and possibly two arguments
function myhook_function(&$a, &$b) { function myhook_function(App $a, &$b) {
} }
@ -77,9 +77,9 @@ This will include:
$a->argc = 3 $a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2'); $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Your module functions will often contain the function plugin_name_content(App &$a), which defines and returns the page body content. Your module functions will often contain the function plugin_name_content(App $a), which defines and returns the page body content.
They may also contain plugin_name_post(App &$a) which is called before the _content function and typically handles the results of POST forms. They may also contain plugin_name_post(App $a) which is called before the _content function and typically handles the results of POST forms.
You may also have plugin_name_init(App &$a) which is called very early on and often does module initialisation. You may also have plugin_name_init(App $a) which is called very early on and often does module initialisation.
Templates Templates
--- ---

View file

@ -68,7 +68,7 @@ The code will be something like:
file: mod/network.php file: mod/network.php
<?php <?php
function network_content(App &$a) { function network_content(App $a) {
$itemsmanager = new \Friendica\ItemsManager(); $itemsmanager = new \Friendica\ItemsManager();
$items = $itemsmanager->getAll(); $items = $itemsmanager->getAll();

View file

@ -40,7 +40,7 @@ Argumente
Deine Hook-Callback-Funktion wird mit mindestens einem und bis zu zwei Argumenten aufgerufen Deine Hook-Callback-Funktion wird mit mindestens einem und bis zu zwei Argumenten aufgerufen
function myhook_function(&$a, &$b) { function myhook_function(App $a, &$b) {
} }
@ -67,9 +67,9 @@ So würde http://example.com/plugin/arg1/arg2 nach einem Modul "plugin" suchen u
$a->argc = 3 $a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2'); $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(App &$a), welche den Seiteninhalt definiert und zurückgibt. Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(App $a), welche den Seiteninhalt definiert und zurückgibt.
Sie können auch plugin_name_post(App &$a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt. Sie können auch plugin_name_post(App $a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
Du kannst ebenso plugin_name_init(App &$a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert. Du kannst ebenso plugin_name_init(App $a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
Derzeitige Hooks Derzeitige Hooks

View file

@ -122,7 +122,7 @@ the 1st part of the line is the name of the CSS file (without the .css) the 2nd
Calling the t() function with the common name makes the string translateable. Calling the t() function with the common name makes the string translateable.
The selected 1st part will be saved in the database by the theme_post function. The selected 1st part will be saved in the database by the theme_post function.
function theme_post(App &$a){ function theme_post(App $a){
// non local users shall not pass // non local users shall not pass
if (! local_user()) { if (! local_user()) {
return; return;
@ -168,7 +168,7 @@ The content of this file should be something like
<?php <?php
/* meta informations for the theme, see below */ /* meta informations for the theme, see below */
function duepuntozero_lr_init(App &$a) { function duepuntozero_lr_init(App $a) {
$a-> theme_info = array( $a-> theme_info = array(
'extends' => 'duepuntozero'. 'extends' => 'duepuntozero'.
); );
@ -251,7 +251,7 @@ Next crucial part of the theme.php file is a definition of an init function.
The name of the function is <theme-name>_init. The name of the function is <theme-name>_init.
So in the case of quattro it is So in the case of quattro it is
function quattro_init(App &$a) { function quattro_init(App $a) {
$a->theme_info = array(); $a->theme_info = array();
set_template_engine($a, 'smarty3'); set_template_engine($a, 'smarty3');
} }

View file

@ -612,7 +612,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
* *
* @return string posts in HTML * @return string posts in HTML
*/ */
function posts_from_gcontact($a, $gcontact_id) { function posts_from_gcontact(App $a, $gcontact_id) {
require_once('include/conversation.php'); require_once('include/conversation.php');
@ -664,7 +664,7 @@ function posts_from_gcontact($a, $gcontact_id) {
* *
* @return string posts in HTML * @return string posts in HTML
*/ */
function posts_from_contact_url($a, $contact_url) { function posts_from_contact_url(App $a, $contact_url) {
require_once('include/conversation.php'); require_once('include/conversation.php');

View file

@ -943,7 +943,7 @@ function scale_image($width, $height, $max) {
return array("width" => $dest_width, "height" => $dest_height); return array("width" => $dest_width, "height" => $dest_height);
} }
function store_photo($a, $uid, $imagedata = "", $url = "") { function store_photo(App $a, $uid, $imagedata = "", $url = "") {
$r = q("SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid` $r = q("SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`
WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1", WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
intval($uid)); intval($uid));

View file

@ -372,7 +372,7 @@ function populate_acl($user = null, $show_jotnets = false) {
} }
function construct_acl_data(&$a, $user) { function construct_acl_data(App $a, $user) {
// Get group and contact information for html ACL selector // Get group and contact information for html ACL selector
$acl_data = acl_lookup($a, 'html'); $acl_data = acl_lookup($a, 'html');
@ -404,7 +404,7 @@ function construct_acl_data(&$a, $user) {
} }
function acl_lookup(&$a, $out_type = 'json') { function acl_lookup(App $a, $out_type = 'json') {
if (!local_user()) { if (!local_user()) {
return ''; return '';
@ -691,7 +691,7 @@ function acl_lookup(&$a, $out_type = 'json') {
* @param App $a * @param App $a
* @return array with the search results * @return array with the search results
*/ */
function navbar_complete(App &$a) { function navbar_complete(App $a) {
// logger('navbar_complete'); // logger('navbar_complete');

View file

@ -133,7 +133,7 @@
* @hook 'logged_in' * @hook 'logged_in'
* array $user logged user record * array $user logged user record
*/ */
function api_login(App &$a){ function api_login(App $a){
// login with oauth // login with oauth
try{ try{
$oauth = new FKOAuth1(); $oauth = new FKOAuth1();
@ -251,7 +251,7 @@
* @param App $a * @param App $a
* @return string API call result * @return string API call result
*/ */
function api_call(App &$a){ function api_call(App $a){
global $API, $called_api; global $API, $called_api;
$type="json"; $type="json";
@ -404,7 +404,7 @@
* @param array $user_info * @param array $user_info
* @return array * @return array
*/ */
function api_rss_extra(&$a, $arr, $user_info){ function api_rss_extra(App $a, $arr, $user_info){
if (is_null($user_info)) $user_info = api_get_user($a); if (is_null($user_info)) $user_info = api_get_user($a);
$arr['$user'] = $user_info; $arr['$user'] = $user_info;
$arr['$rss'] = array( $arr['$rss'] = array(
@ -444,7 +444,7 @@
* @param int|string $contact_id Contact ID or URL * @param int|string $contact_id Contact ID or URL
* @param string $type Return type (for errors) * @param string $type Return type (for errors)
*/ */
function api_get_user(&$a, $contact_id = Null, $type = "json"){ function api_get_user(App $a, $contact_id = Null, $type = "json"){
global $called_api; global $called_api;
$user = null; $user = null;
$extra_query = ""; $extra_query = "";
@ -712,7 +712,7 @@
* @param array $item : item from db * @param array $item : item from db
* @return array(array:author, array:owner) * @return array(array:author, array:owner)
*/ */
function api_item_get_user(&$a, $item) { function api_item_get_user(App $a, $item) {
$status_user = api_get_user($a, $item["author-link"]); $status_user = api_get_user($a, $item["author-link"]);

View file

@ -466,7 +466,7 @@ function item_condition() {
*/ */
if(!function_exists('conversation')) { if(!function_exists('conversation')) {
function conversation(&$a, $items, $mode, $update, $preview = false) { function conversation(App $a, $items, $mode, $update, $preview = false) {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
require_once('include/Contact.php'); require_once('include/Contact.php');

View file

@ -343,7 +343,7 @@ function cron_poll_contacts($argc, $argv) {
* *
* @param App $a * @param App $a
*/ */
function cron_clear_cache(App &$a) { function cron_clear_cache(App $a) {
$last = get_config('system','cache_last_cleared'); $last = get_config('system','cache_last_cleared');
@ -430,7 +430,7 @@ function cron_clear_cache(App &$a) {
* *
* @param App $a * @param App $a
*/ */
function cron_repair_diaspora(App &$a) { function cron_repair_diaspora(App $a) {
$r = q("SELECT `id`, `url` FROM `contact` $r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '') WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA)); ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));

View file

@ -206,7 +206,7 @@ function bbtoevent($s) {
} }
function sort_by_date(App &$a) { function sort_by_date(App $a) {
usort($a,'ev_compare'); usort($a,'ev_compare');
return $a; return $a;

View file

@ -31,7 +31,7 @@ require_once("mod/proxy.php");
* @param int $profile * @param int $profile
* @param array $profiledata * @param array $profiledata
*/ */
function profile_load(&$a, $nickname, $profile = 0, $profiledata = array()) { function profile_load(App $a, $nickname, $profile = 0, $profiledata = array()) {
$user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1", $user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
@ -598,7 +598,7 @@ function get_events() {
)); ));
} }
function advanced_profile(App &$a) { function advanced_profile(App $a) {
$o = ''; $o = '';
$uid = $a->profile['uid']; $uid = $a->profile['uid'];
@ -845,7 +845,7 @@ function get_my_url() {
return false; return false;
} }
function zrl_init(App &$a) { function zrl_init(App $a) {
$tmp_str = get_my_url(); $tmp_str = get_my_url();
if(validate_url($tmp_str)) { if(validate_url($tmp_str)) {

View file

@ -1,6 +1,6 @@
<?php <?php
function nav(App &$a) { function nav(App $a) {
/* /*
* *

View file

@ -2072,7 +2072,7 @@ class ostatus {
* *
* @return string XML feed * @return string XML feed
*/ */
public static function feed(&$a, $owner_nick, $last_update) { public static function feed(App $a, $owner_nick, $last_update) {
$r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags` $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`

View file

@ -296,7 +296,7 @@ function shortenmsg($msg, $limit, $twitter = false) {
* *
* @return string The converted message * @return string The converted message
*/ */
function plaintext($a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = "") { function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = "") {
// Remove the hash tags // Remove the hash tags
$URLSearchString = "^\[\]"; $URLSearchString = "^\[\]";

View file

@ -1,6 +1,6 @@
<?php <?php
function auto_redir(&$a, $contact_nick) { function auto_redir(App $a, $contact_nick) {
// prevent looping // prevent looping

View file

@ -106,7 +106,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
function can_write_wall(&$a,$owner) { function can_write_wall(App $a, $owner) {
static $verified = 0; static $verified = 0;

View file

@ -276,7 +276,7 @@ if(! function_exists('paginate_data')) {
* @param int $count [optional] item count (used with alt pager) * @param int $count [optional] item count (used with alt pager)
* @return Array data for pagination template * @return Array data for pagination template
*/ */
function paginate_data(&$a, $count=null) { function paginate_data(App $a, $count=null) {
$stripped = preg_replace('/([&?]page=[0-9]*)/','',$a->query_string); $stripped = preg_replace('/([&?]page=[0-9]*)/','',$a->query_string);
$stripped = str_replace('q=','',$stripped); $stripped = str_replace('q=','',$stripped);
@ -369,7 +369,7 @@ if(! function_exists('paginate')) {
* @param App $a App instance * @param App $a App instance
* @return string html for pagination #FIXME remove html * @return string html for pagination #FIXME remove html
*/ */
function paginate(App &$a) { function paginate(App $a) {
$data = paginate_data($a); $data = paginate_data($a);
$tpl = get_markup_template("paginate.tpl"); $tpl = get_markup_template("paginate.tpl");
@ -384,7 +384,7 @@ if(! function_exists('alt_pager')) {
* @param int $i * @param int $i
* @return string html for pagination #FIXME remove html * @return string html for pagination #FIXME remove html
*/ */
function alt_pager(&$a, $i) { function alt_pager(App $a, $i) {
$data = paginate_data($a, $i); $data = paginate_data($a, $i);
$tpl = get_markup_template("paginate.tpl"); $tpl = get_markup_template("paginate.tpl");

View file

@ -78,7 +78,7 @@ function import_cleanup($newuid) {
q("DELETE FROM `pconfig` WHERE uid = %d", $newuid); q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);
} }
function import_account(&$a, $file) { function import_account(App $a, $file) {
logger("Start user import from " . $file['tmp_name']); logger("Start user import from " . $file['tmp_name']);
/* /*
STEPS STEPS