X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=geocoordinates%2Fgeocoordinates.php;h=69b73f726699075989531861bf7b11e40b1c8a5b;hb=58495893b950574fddd06b94ee35503eb9ad2e34;hp=116431681c5c6ee31415dec8e1448eca7c5d26a6;hpb=639a32fe19fb2b1943f9ac657ff86b658732b10e;p=friendica-addons.git diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 11643168..69b73f72 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -6,20 +6,24 @@ * Author: Michael Vogel */ +use Friendica\Core\Cache; use Friendica\Core\Config; -function geocoordinates_install() { +function geocoordinates_install() +{ register_hook('post_local', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook'); register_hook('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook'); } -function geocoordinates_uninstall() { +function geocoordinates_uninstall() +{ unregister_hook('post_local', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook'); unregister_hook('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook'); } -function geocoordinates_resolve_item(&$item) { +function geocoordinates_resolve_item(&$item) +{ if((!$item["coord"]) || ($item["location"])) return; @@ -72,11 +76,13 @@ function geocoordinates_resolve_item(&$item) { Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]); } -function geocoordinates_post_hook($a, &$item) { +function geocoordinates_post_hook($a, &$item) +{ geocoordinates_resolve_item($item); } -function geocoordinates_plugin_admin(&$a,&$o) { +function geocoordinates_plugin_admin(&$a, &$o) +{ $t = get_markup_template("admin.tpl", "addon/geocoordinates/"); @@ -87,7 +93,8 @@ function geocoordinates_plugin_admin(&$a,&$o) { )); } -function geocoordinates_plugin_admin_post(&$a) { +function geocoordinates_plugin_admin_post(&$a) +{ $api_key = ((x($_POST,'api_key')) ? notags(trim($_POST['api_key'])) : ''); Config::set('geocoordinates','api_key',$api_key);