Merge pull request #3076 from Hypolite/issue/#3039-boot-doc-include

Normalize App parameter declaration (doc-include folders, boot)
This commit is contained in:
Michael Vogel 2017-01-11 09:01:48 +01:00 committed by GitHub
commit 3c51820515
20 changed files with 144 additions and 144 deletions

View File

@ -1540,7 +1540,7 @@ function check_db() {
* Sets the base url for use in cmdline programs which don't have
* $_SERVER variables
*/
function check_url(App &$a) {
function check_url(App $a) {
$url = get_config('system','url');
@ -1562,7 +1562,7 @@ function check_url(App &$a) {
/**
* @brief Automatic database updates
*/
function update_db(App &$a) {
function update_db(App $a) {
$build = get_config('system','build');
if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION);
@ -1678,7 +1678,7 @@ function run_update_function($x) {
* @param App $a
*
*/
function check_plugins(App &$a) {
function check_plugins(App $a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if (dbm::is_result($r))
@ -2414,7 +2414,7 @@ function get_temppath() {
}
/// @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
/// 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
function myhook_function(&$a, &$b) {
function myhook_function(App $a, &$b) {
}
@ -77,9 +77,9 @@ This will include:
$a->argc = 3
$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.
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.
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.
You may also have plugin_name_init(App $a) which is called very early on and often does module initialisation.
Templates
---

View File

@ -68,7 +68,7 @@ The code will be something like:
file: mod/network.php
<?php
function network_content(App &$a) {
function network_content(App $a) {
$itemsmanager = new \Friendica\ItemsManager();
$items = $itemsmanager->getAll();
@ -160,7 +160,7 @@ But if you want to use classes from another library, you need to use the full na
```
<?php
namespace \Frienidca;
namespace \Friendica;
class Diaspora {
public function md2bbcode() {
@ -173,7 +173,7 @@ if you use that class in many places of the code and you don't want to write the
```
<?php
namespace \Frienidca;
namespace \Friendica;
use \Michelf\MarkdownExtra;

View File

@ -40,7 +40,7 @@ Argumente
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->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.
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.
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.
Du kannst ebenso plugin_name_init(App $a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
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.
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
if (! local_user()) {
return;
@ -168,7 +168,7 @@ The content of this file should be something like
<?php
/* meta informations for the theme, see below */
function duepuntozero_lr_init(App &$a) {
function duepuntozero_lr_init(App $a) {
$a-> theme_info = array(
'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.
So in the case of quattro it is
function quattro_init(App &$a) {
function quattro_init(App $a) {
$a->theme_info = array();
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
*/
function posts_from_gcontact($a, $gcontact_id) {
function posts_from_gcontact(App $a, $gcontact_id) {
require_once('include/conversation.php');
@ -664,7 +664,7 @@ function posts_from_gcontact($a, $gcontact_id) {
*
* @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');

View File

@ -943,7 +943,7 @@ function scale_image($width, $height, $max) {
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`
WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
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
$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()) {
return '';
@ -691,7 +691,7 @@ function acl_lookup(&$a, $out_type = 'json') {
* @param App $a
* @return array with the search results
*/
function navbar_complete(App &$a) {
function navbar_complete(App $a) {
// logger('navbar_complete');

View File

@ -133,7 +133,7 @@
* @hook 'logged_in'
* array $user logged user record
*/
function api_login(App &$a){
function api_login(App $a){
// login with oauth
try{
$oauth = new FKOAuth1();
@ -251,7 +251,7 @@
* @param App $a
* @return string API call result
*/
function api_call(App &$a){
function api_call(App $a){
global $API, $called_api;
$type="json";
@ -404,7 +404,7 @@
* @param array $user_info
* @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);
$arr['$user'] = $user_info;
$arr['$rss'] = array(
@ -444,7 +444,7 @@
* @param int|string $contact_id Contact ID or URL
* @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;
$user = null;
$extra_query = "";
@ -712,7 +712,7 @@
* @param array $item : item from db
* @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"]);

View File

@ -466,7 +466,7 @@ function item_condition() {
*/
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/Contact.php');

View File

@ -343,7 +343,7 @@ function cron_poll_contacts($argc, $argv) {
*
* @param App $a
*/
function cron_clear_cache(App &$a) {
function cron_clear_cache(App $a) {
$last = get_config('system','cache_last_cleared');
@ -430,7 +430,7 @@ function cron_clear_cache(App &$a) {
*
* @param App $a
*/
function cron_repair_diaspora(App &$a) {
function cron_repair_diaspora(App $a) {
$r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
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');
return $a;

View File

@ -31,7 +31,7 @@ require_once("mod/proxy.php");
* @param int $profile
* @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",
dbesc($nickname)
@ -598,7 +598,7 @@ function get_events() {
));
}
function advanced_profile(App &$a) {
function advanced_profile(App $a) {
$o = '';
$uid = $a->profile['uid'];
@ -755,7 +755,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
array(
'label'=>t('Status'),
'url' => $url,
'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''),
'sel' => ((!isset($tab) && $a->argv[0]=='profile')?'active':''),
'title' => t('Status Messages and Posts'),
'id' => 'status-tab',
'accesskey' => 'm',
@ -771,7 +771,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
array(
'label' => t('Photos'),
'url' => App::get_baseurl() . '/photos/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''),
'sel' => ((!isset($tab) && $a->argv[0]=='photos')?'active':''),
'title' => t('Photo Albums'),
'id' => 'photo-tab',
'accesskey' => 'h',
@ -779,7 +779,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
array(
'label' => t('Videos'),
'url' => App::get_baseurl() . '/videos/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='videos')?'active':''),
'sel' => ((!isset($tab) && $a->argv[0]=='videos')?'active':''),
'title' => t('Videos'),
'id' => 'video-tab',
'accesskey' => 'v',
@ -791,7 +791,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array(
'label' => t('Events'),
'url' => App::get_baseurl() . '/events',
'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''),
'sel' =>((!isset($tab) && $a->argv[0]=='events')?'active':''),
'title' => t('Events and Calendar'),
'id' => 'events-tab',
'accesskey' => 'e',
@ -802,7 +802,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array(
'label' => t('Events'),
'url' => App::get_baseurl() . '/cal/' . $nickname,
'sel' =>((!isset($tab)&&$a->argv[0]=='cal')?'active':''),
'sel' =>((!isset($tab) && $a->argv[0]=='cal')?'active':''),
'title' => t('Events and Calendar'),
'id' => 'events-tab',
'accesskey' => 'e',
@ -813,7 +813,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array(
'label' => t('Personal Notes'),
'url' => App::get_baseurl() . '/notes',
'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''),
'sel' =>((!isset($tab) && $a->argv[0]=='notes')?'active':''),
'title' => t('Only You Can See This'),
'id' => 'notes-tab',
'accesskey' => 't',
@ -824,7 +824,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array(
'label' => t('Contacts'),
'url' => App::get_baseurl() . '/viewcontacts/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='viewcontacts')?'active':''),
'sel' => ((!isset($tab) && $a->argv[0]=='viewcontacts')?'active':''),
'title' => t('Contacts'),
'id' => 'viewcontacts-tab',
'accesskey' => 'k',
@ -845,7 +845,7 @@ function get_my_url() {
return false;
}
function zrl_init(App &$a) {
function zrl_init(App $a) {
$tmp_str = get_my_url();
if(validate_url($tmp_str)) {

View File

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

View File

@ -2072,7 +2072,7 @@ class ostatus {
*
* @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`
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
*/
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
$URLSearchString = "^\[\]";

View File

@ -1,6 +1,6 @@
<?php
function auto_redir(&$a, $contact_nick) {
function auto_redir(App $a, $contact_nick) {
// 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;

View File

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

View File

@ -78,7 +78,7 @@ function import_cleanup($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']);
/*
STEPS