]> git.mxchange.org Git - friendica-addons.git/blobdiff - blockem/blockem.php
Diaspora - set host to empty if it doesn't exist.
[friendica-addons.git] / blockem / blockem.php
index 2a5fd8b60e0248791e17211a59dd886fd882be93..e0c0a74a29894870218f17afc584c9f1c0e97373 100644 (file)
@@ -8,31 +8,32 @@
  */
 
 use Friendica\App;
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Util\Strings;
 
 function blockem_install()
 {
-       Addon::registerHook('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter');
-       Addon::registerHook('display_item'               , 'addon/blockem/blockem.php', 'blockem_display_item');
-       Addon::registerHook('addon_settings'             , 'addon/blockem/blockem.php', 'blockem_addon_settings');
-       Addon::registerHook('addon_settings_post'        , 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
-       Addon::registerHook('conversation_start'         , 'addon/blockem/blockem.php', 'blockem_conversation_start');
-       Addon::registerHook('item_photo_menu'            , 'addon/blockem/blockem.php', 'blockem_item_photo_menu');
-       Addon::registerHook('enotify_store'              , 'addon/blockem/blockem.php', 'blockem_enotify_store');
+       Hook::register('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter');
+       Hook::register('display_item'               , 'addon/blockem/blockem.php', 'blockem_display_item');
+       Hook::register('addon_settings'             , 'addon/blockem/blockem.php', 'blockem_addon_settings');
+       Hook::register('addon_settings_post'        , 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
+       Hook::register('conversation_start'         , 'addon/blockem/blockem.php', 'blockem_conversation_start');
+       Hook::register('item_photo_menu'            , 'addon/blockem/blockem.php', 'blockem_item_photo_menu');
+       Hook::register('enotify_store'              , 'addon/blockem/blockem.php', 'blockem_enotify_store');
 }
 
 function blockem_uninstall()
 {
-       Addon::unregisterHook('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter');
-       Addon::unregisterHook('prepare_body'               , 'addon/blockem/blockem.php', 'blockem_prepare_body');
-       Addon::unregisterHook('display_item'               , 'addon/blockem/blockem.php', 'blockem_display_item');
-       Addon::unregisterHook('addon_settings'             , 'addon/blockem/blockem.php', 'blockem_addon_settings');
-       Addon::unregisterHook('addon_settings_post'        , 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
-       Addon::unregisterHook('conversation_start'         , 'addon/blockem/blockem.php', 'blockem_conversation_start');
-       Addon::unregisterHook('item_photo_menu'            , 'addon/blockem/blockem.php', 'blockem_item_photo_menu');
-       Addon::unregisterHook('enotify_store'              , 'addon/blockem/blockem.php', 'blockem_enotify_store');
+       Hook::unregister('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter');
+       Hook::unregister('prepare_body'               , 'addon/blockem/blockem.php', 'blockem_prepare_body');
+       Hook::unregister('display_item'               , 'addon/blockem/blockem.php', 'blockem_display_item');
+       Hook::unregister('addon_settings'             , 'addon/blockem/blockem.php', 'blockem_addon_settings');
+       Hook::unregister('addon_settings_post'        , 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
+       Hook::unregister('conversation_start'         , 'addon/blockem/blockem.php', 'blockem_conversation_start');
+       Hook::unregister('item_photo_menu'            , 'addon/blockem/blockem.php', 'blockem_item_photo_menu');
+       Hook::unregister('enotify_store'              , 'addon/blockem/blockem.php', 'blockem_enotify_store');
 }
 
 function blockem_addon_settings (App $a, &$s)
@@ -100,7 +101,7 @@ function blockem_enotify_store(App $a, array &$b)
                                continue;
                        }
 
-                       if (link_compare($b['url'], $word)) {
+                       if (Strings::compareLink($b['url'], $word)) {
                                $found = true;
                                break;
                        }
@@ -133,7 +134,7 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data)
        $found = false;
 
        foreach ($profiles_array as $word) {
-               if (link_compare($hook_data['item']['author-link'], trim($word))) {
+               if (Strings::compareLink($hook_data['item']['author-link'], trim($word))) {
                        $found = true;
                        break;
                }
@@ -192,7 +193,7 @@ function blockem_item_photo_menu(App $a, array &$b)
 
        if (!empty($a->data['blockem'])) {
                foreach($a->data['blockem'] as $bloke) {
-                       if (link_compare($bloke,$author)) {
+                       if (Strings::compareLink($bloke,$author)) {
                                $blocked = true;
                                break;
                        }
@@ -231,7 +232,7 @@ function blockem_init(App $a)
 
                if (count($arr)) {
                        foreach ($arr as $x) {
-                               if (!link_compare(trim($x), trim($_GET['unblock']))) {
+                               if (!Strings::compareLink(trim($x), trim($_GET['unblock']))) {
                                        $newarr[] = $x;
                                }
                        }
@@ -242,5 +243,5 @@ function blockem_init(App $a)
 
        PConfig::set(local_user(), 'blockem', 'words', $words);
        info(L10n::t('blockem settings updated') . EOL);
-       killme();
+       exit();
 }