1
0
Fork 0

Replace deprecated Addon::callHooks with Hook::callAll

- Update documentation
This commit is contained in:
Hypolite Petovan 2018-12-26 01:06:24 -05:00
commit 55e54bb950
58 changed files with 450 additions and 475 deletions

View file

@ -5,7 +5,7 @@
use Friendica\App;
use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
@ -305,7 +305,7 @@ function acl_content(App $a)
'search' => $search,
];
Addon::callHooks('acl_lookup_end', $results);
Hook::callAll('acl_lookup_end', $results);
$o = [
'tot' => $results['tot'],

View file

@ -7,8 +7,8 @@ use Friendica\App;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
@ -190,7 +190,7 @@ function directory_content(App $a)
$arr = ['contact' => $rr, 'entry' => $entry];
Addon::callHooks('directory_item', $arr);
Hook::callAll('directory_item', $arr);
unset($profile);
unset($location);

View file

@ -4,7 +4,6 @@
*/
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;

View file

@ -6,6 +6,7 @@
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -126,7 +127,7 @@ function friendica_content(App $a)
$o .= '</tbody></table></div>' . PHP_EOL;
}
Addon::callHooks('about_hook', $o);
Hook::callAll('about_hook', $o);
return $o;
}

View file

@ -3,8 +3,8 @@
* @file mod/home.php
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
@ -14,7 +14,7 @@ if(! function_exists('home_init')) {
function home_init(App $a) {
$ret = [];
Addon::callHooks('home_init',$ret);
Hook::callAll('home_init',$ret);
if (local_user() && ($a->user['nickname'])) {
$a->internalRedirect('network');
@ -51,7 +51,7 @@ function home_content(App $a) {
$login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
$content = '';
Addon::callHooks("home_content",$content);
Hook::callAll("home_content",$content);
$tpl = Renderer::getMarkupTemplate('home.tpl');

View file

@ -19,8 +19,8 @@ use Friendica\App;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
@ -54,7 +54,7 @@ function item_post(App $a) {
exit();
}
Addon::callHooks('post_local_start', $_REQUEST);
Hook::callAll('post_local_start', $_REQUEST);
Logger::log('postvars ' . print_r($_REQUEST, true), Logger::DATA);
@ -679,7 +679,7 @@ function item_post(App $a) {
exit();
}
Addon::callHooks('post_local',$datarray);
Hook::callAll('post_local',$datarray);
if (!empty($datarray['cancel'])) {
Logger::log('mod_item: post cancelled by addon.');
@ -795,7 +795,7 @@ function item_post(App $a) {
}
}
Addon::callHooks('post_local_end', $datarray);
Hook::callAll('post_local_end', $datarray);
if (strlen($emailcc) && $profile_uid == local_user()) {
$erecips = explode(',', $emailcc);

View file

@ -3,7 +3,7 @@
* @file mod/lockview.php
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\Model\Item;
@ -40,7 +40,7 @@ function lockview_content(App $a)
exit();
}
Addon::callHooks('lockview_content', $item);
Hook::callAll('lockview_content', $item);
if ($item['uid'] != local_user()) {
echo L10n::t('Remote privacy information not available.') . '<br />';

View file

@ -4,10 +4,9 @@
*/
use Friendica\App;
use Friendica\Core\Authentication;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
function manage_post(App $a) {
@ -116,7 +115,7 @@ function manage_post(App $a) {
}
$ret = [];
Addon::callHooks('home_init',$ret);
Hook::callAll('home_init',$ret);
$a->internalRedirect('profile/' . $a->user['nickname'] );
// NOTREACHED

View file

@ -12,7 +12,6 @@ use Friendica\Content\Pager;
use Friendica\Content\Widget;
use Friendica\Content\Text\HTML;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
@ -355,7 +354,7 @@ function network_content(App $a, $update = 0, $parent = 0)
/// @TODO Is this really necessary? $a is already available to hooks
$arr = ['query' => $a->query_string];
Addon::callHooks('network_content_init', $arr);
Hook::callAll('network_content_init', $arr);
$flat_mode = false;
@ -1024,7 +1023,7 @@ function network_tabs(App $a)
}
$arr = ['tabs' => $tabs];
Addon::callHooks('network_tabs', $arr);
Hook::callAll('network_tabs', $arr);
$tpl = Renderer::getMarkupTemplate('common_tabs.tpl');

View file

@ -10,7 +10,7 @@
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
@ -97,7 +97,7 @@ function parse_url_content(App $a)
$arr = ['url' => $url, 'text' => ''];
Addon::callHooks('parse_link', $arr);
Hook::callAll('parse_link', $arr);
if (strlen($arr['text'])) {
echo $arr['text'];

View file

@ -9,13 +9,12 @@ use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -666,7 +665,7 @@ function photos_post(App $a)
// default post action - upload a photo
Addon::callHooks('photo_post_init', $_POST);
Hook::callAll('photo_post_init', $_POST);
// Determine the album to use
$album = !empty($_REQUEST['album']) ? Strings::escapeTags(trim($_REQUEST['album'])) : '';
@ -714,7 +713,7 @@ function photos_post(App $a)
$ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];
Addon::callHooks('photo_post_file', $ret);
Hook::callAll('photo_post_file', $ret);
if (!empty($ret['src']) && !empty($ret['filesize'])) {
$src = $ret['src'];
@ -754,7 +753,7 @@ function photos_post(App $a)
}
@unlink($src);
$foo = 0;
Addon::callHooks('photo_post_end', $foo);
Hook::callAll('photo_post_end', $foo);
return;
}
@ -770,7 +769,7 @@ function photos_post(App $a)
notice(L10n::t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)) . EOL);
@unlink($src);
$foo = 0;
Addon::callHooks('photo_post_end', $foo);
Hook::callAll('photo_post_end', $foo);
return;
}
@ -778,7 +777,7 @@ function photos_post(App $a)
notice(L10n::t('Image file is empty.') . EOL);
@unlink($src);
$foo = 0;
Addon::callHooks('photo_post_end', $foo);
Hook::callAll('photo_post_end', $foo);
return;
}
@ -793,7 +792,7 @@ function photos_post(App $a)
notice(L10n::t('Unable to process image.') . EOL);
@unlink($src);
$foo = 0;
Addon::callHooks('photo_post_end',$foo);
Hook::callAll('photo_post_end',$foo);
exit();
}
@ -879,7 +878,7 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
Addon::callHooks('photo_post_end', $item_id);
Hook::callAll('photo_post_end', $item_id);
// addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
// if they do not wish to be redirected
@ -1042,7 +1041,7 @@ function photos_content(App $a)
'addon_text' => $uploader,
'default_upload' => true];
Addon::callHooks('photo_upload_form',$ret);
Hook::callAll('photo_upload_form',$ret);
$default_upload_box = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_box.tpl'), []);
$default_upload_submit = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_submit.tpl'), [

View file

@ -4,12 +4,11 @@
*/
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\ForumManager;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
@ -129,7 +128,7 @@ function ping_init(App $a)
if (DBA::isResult($items)) {
$items_unseen = Item::inArray($items);
$arr = ['items' => $items_unseen];
Addon::callHooks('network_ping', $arr);
Hook::callAll('network_ping', $arr);
foreach ($items_unseen as $item) {
if ($item['wall']) {

View file

@ -14,12 +14,11 @@
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Item;
use Friendica\Util\Strings;
@ -129,9 +128,9 @@ function poke_init(App $a)
$arr['object'] .= XML::escape('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
$item_id = Item::insert($arr);
Item::insert($arr);
Addon::callHooks('post_local_end', $arr);
Hook::callAll('post_local_end', $arr);
return;
}
@ -143,9 +142,6 @@ function poke_content(App $a)
return;
}
$name = '';
$id = '';
if (empty($_GET['c'])) {
return;
}

View file

@ -8,10 +8,9 @@ use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -167,7 +166,7 @@ function profile_content(App $a, $update = 0)
if ($tab === 'profile') {
$o .= Profile::getAdvanced($a);
Addon::callHooks('profile_advanced', $o);
Hook::callAll('profile_advanced', $o);
return $o;
}

View file

@ -8,8 +8,8 @@ use Friendica\BaseModule;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
@ -186,7 +186,7 @@ function profiles_post(App $a) {
$namechanged = false;
Addon::callHooks('profile_post', $_POST);
Hook::callAll('profile_post', $_POST);
if (($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) {
$orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@ -645,7 +645,7 @@ function profiles_content(App $a) {
]);
$arr = ['profile' => $r[0], 'entry' => $o];
Addon::callHooks('profile_edit', $arr);
Hook::callAll('profile_edit', $arr);
return $o;
} else {

View file

@ -6,8 +6,8 @@
use Friendica\App;
use Friendica\BaseModule;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
@ -26,7 +26,7 @@ function register_post(App $a)
$blocked = 1;
$arr = ['post' => $_POST];
Addon::callHooks('register_post', $arr);
Hook::callAll('register_post', $arr);
$max_dailies = intval(Config::get('system', 'max_daily_registrations'));
if ($max_dailies) {
@ -241,7 +241,7 @@ function register_content(App $a)
$arr = ['template' => $tpl];
Addon::callHooks('register_form', $arr);
Hook::callAll('register_form', $arr);
$tpl = $arr['template'];

View file

@ -8,8 +8,8 @@ use Friendica\BaseModule;
use Friendica\Content\Feature;
use Friendica\Content\Nav;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
@ -215,7 +215,7 @@ function settings_post(App $a)
if (($a->argc > 1) && ($a->argv[1] == 'addon')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/addon', 'settings_addon');
Addon::callHooks('addon_settings_post', $_POST);
Hook::callAll('addon_settings_post', $_POST);
return;
}
@ -297,7 +297,7 @@ function settings_post(App $a)
}
}
Addon::callHooks('connector_settings_post', $_POST);
Hook::callAll('connector_settings_post', $_POST);
return;
}
@ -372,7 +372,7 @@ function settings_post(App $a)
intval(local_user())
);
Addon::callHooks('display_settings_post', $_POST);
Hook::callAll('display_settings_post', $_POST);
$a->internalRedirect('settings/display');
return; // NOTREACHED
}
@ -385,7 +385,7 @@ function settings_post(App $a)
$a->internalRedirect('settings');
}
Addon::callHooks('settings_post', $_POST);
Hook::callAll('settings_post', $_POST);
if (!empty($_POST['password']) || !empty($_POST['confirm'])) {
$newpass = $_POST['password'];
@ -743,7 +743,7 @@ function settings_content(App $a)
$settings_addons = L10n::t('No Addon settings configured');
}
Addon::callHooks('addon_settings', $settings_addons);
Hook::callAll('addon_settings', $settings_addons);
$tpl = Renderer::getMarkupTemplate('settings/addons.tpl');
@ -790,7 +790,7 @@ function settings_content(App $a)
}
$settings_connectors = '';
Addon::callHooks('connector_settings', $settings_connectors);
Hook::callAll('connector_settings', $settings_connectors);
if (is_site_admin()) {
$diasp_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? L10n::t('enabled') : L10n::t('disabled')));
@ -863,7 +863,7 @@ function settings_content(App $a)
'$submit' => L10n::t('Save Settings'),
]);
Addon::callHooks('display_settings', $o);
Hook::callAll('display_settings', $o);
return $o;
}
@ -1262,7 +1262,7 @@ function settings_content(App $a)
]);
Addon::callHooks('settings_form', $o);
Hook::callAll('settings_form', $o);
$o .= '</form>' . "\r\n";

View file

@ -3,7 +3,7 @@
* @file mod/subthread.php
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
@ -149,7 +149,7 @@ EOT;
$arr['id'] = $post_id;
Addon::callHooks('post_local_end', $arr);
Hook::callAll('post_local_end', $arr);
exit();

View file

@ -3,7 +3,7 @@
* @file mod/tagger.php
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\System;
@ -199,7 +199,7 @@ EOT;
$arr['id'] = $post_id;
Addon::callHooks('post_local_end', $arr);
Hook::callAll('post_local_end', $arr);
Worker::add(PRIORITY_HIGH, "Notifier", "tag", $post_id);

View file

@ -3,7 +3,7 @@
* @file mod/uexport.php
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
@ -45,7 +45,7 @@ function uexport_content(App $a) {
['uexport/account', L10n::t('Export account'), L10n::t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')],
['uexport/backup', L10n::t('Export all'), L10n::t("Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account \x28photos are not exported\x29")],
];
Addon::callHooks('uexport_options', $options);
Hook::callAll('uexport_options', $options);
$tpl = Renderer::getMarkupTemplate("uexport.tpl");
return Renderer::replaceMacros($tpl, [

View file

@ -4,7 +4,7 @@
*/
use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
@ -127,7 +127,7 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r)
);
$arr = ['user' => $r, 'xml' => $o];
Addon::callHooks('personal_xrd', $arr);
Hook::callAll('personal_xrd', $arr);
echo $arr['xml'];
exit();