Replace deprecated Addon::callHooks with Hook::callAll

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

View file

@ -4,10 +4,9 @@
*/
namespace Friendica\Util;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Util\Strings;
use ASN_BASE;
use ASNValue;
@ -372,7 +371,7 @@ class Crypto
return $result;
} else {
$x = ['data' => $data, 'pubkey' => $pubkey, 'alg' => $alg, 'result' => $data];
Addon::callHooks('other_encapsulate', $x);
Hook::callAll('other_encapsulate', $x);
return $x['result'];
}
@ -455,7 +454,7 @@ class Crypto
return self::$fn(Strings::base64UrlDecode($data['data']), $k, $i);
} else {
$x = ['data' => $data, 'prvkey' => $prvkey, 'alg' => $alg, 'result' => $data];
Addon::callHooks('other_unencapsulate', $x);
Hook::callAll('other_unencapsulate', $x);
return $x['result'];
}

View file

@ -4,8 +4,8 @@
*/
namespace Friendica\Util;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Protocol\Email;
@ -33,7 +33,7 @@ class Emailer
*/
public static function send($params)
{
Addon::callHooks('emailer_send_prepare', $params);
Hook::callAll('emailer_send_prepare', $params);
$email_textonly = false;
if (!empty($params['uid'])) {
@ -89,7 +89,7 @@ class Emailer
'parameters' => $sendmail_params
];
Addon::callHooks("emailer_send", $hookdata);
Hook::callAll("emailer_send", $hookdata);
$res = mail(
$hookdata['to'],

View file

@ -4,7 +4,7 @@
*/
namespace Friendica\Util;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
/**
* Leaflet Map related functions
@ -14,19 +14,19 @@ class Map {
$coord = trim($coord);
$coord = str_replace([',','/',' '],[' ',' ',' '],$coord);
$arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'mode' => $html_mode, 'html' => ''];
Addon::callHooks('generate_map',$arr);
Hook::callAll('generate_map',$arr);
return ($arr['html']) ? $arr['html'] : $coord;
}
public static function byLocation($location, $html_mode = 0) {
$arr = ['location' => $location, 'mode' => $html_mode, 'html' => ''];
Addon::callHooks('generate_named_map',$arr);
Hook::callAll('generate_named_map',$arr);
return ($arr['html']) ? $arr['html'] : $location;
}
public static function getCoordinates($location) {
$arr = ['location' => $location, 'lat' => false, 'lon' => false];
Addon::callHooks('Map::getCoordinates', $arr);
Hook::callAll('Map::getCoordinates', $arr);
return $arr;
}
}

View file

@ -4,12 +4,11 @@
*/
namespace Friendica\Util;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Network\CurlResult;
use Friendica\Util\Strings;
use DOMDocument;
use DomXPath;
@ -533,7 +532,7 @@ class Network
$avatar['url'] = '';
$avatar['success'] = false;
Addon::callHooks('avatar_lookup', $avatar);
Hook::callAll('avatar_lookup', $avatar);
if (! $avatar['success']) {
$avatar['url'] = System::baseUrl() . '/images/person-300.jpg';

View file

@ -8,11 +8,10 @@ namespace Friendica\Util;
use DOMDocument;
use DOMXPath;
use Friendica\Content\OEmbed;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Object\Image;
use Friendica\Util\Strings;
/**
* @brief Class with methods for extracting certain content from an url
@ -422,7 +421,7 @@ class ParseUrl
Logger::log('Siteinfo for ' . $url . ' ' . print_r($siteinfo, true), Logger::DEBUG);
Addon::callHooks('getsiteinfo', $siteinfo);
Hook::callAll('getsiteinfo', $siteinfo);
return $siteinfo;
}