X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=superblock%2Fsuperblock.php;h=1462c184df56defa62dc5521c45d4e266a9d4bff;hb=b141c2cff1c59f0002e925a99a400beceadcb5eb;hp=41abb47146d0534953fb00c2261fd147b9d00948;hpb=4a400894aac9e71d33bec4562de6feb8265b40a4;p=friendica-addons.git diff --git a/superblock/superblock.php b/superblock/superblock.php index 41abb471..1462c184 100755 --- a/superblock/superblock.php +++ b/superblock/superblock.php @@ -15,6 +15,8 @@ function superblock_install() { register_hook('plugin_settings_post', 'addon/superblock/superblock.php', 'superblock_addon_settings_post'); register_hook('conversation_start', 'addon/superblock/superblock.php', 'superblock_conversation_start'); register_hook('item_photo_menu', 'addon/superblock/superblock.php', 'superblock_item_photo_menu'); + register_hook('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store'); + } @@ -24,6 +26,7 @@ function superblock_uninstall() { unregister_hook('plugin_settings_post', 'addon/superblock/superblock.php', 'superblock_addon_settings_post'); unregister_hook('conversation_start', 'addon/superblock/superblock.php', 'superblock_conversation_start'); unregister_hook('item_photo_menu', 'addon/superblock/superblock.php', 'superblock_item_photo_menu'); + unregister_hook('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store'); } @@ -52,7 +55,7 @@ function superblock_addon_settings(&$a,&$s) { $s .= ''; $s .= '
'; - $s .= '
'; + $s .= '
'; return; @@ -69,6 +72,35 @@ function superblock_addon_settings_post(&$a,&$b) { } } +function superblock_enotify_store(&$a,&$b) { + + $words = get_pconfig($b['uid'],'system','blocked'); + if($words) { + $arr = explode(',',$words); + } + else { + return; + } + + $found = false; + if(count($arr)) { + foreach($arr as $word) { + if(! strlen(trim($word))) { + continue; + } + + if(link_compare($b['url'],$word)) { + $found = true; + break; + } + } + } + if($found) { + $b['abort'] = true; + } +} + + function superblock_conversation_start(&$a,&$b) { if(! local_user()) @@ -108,7 +140,7 @@ function superblock_item_photo_menu(&$a,&$b) { } } - $b['menu'][ t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\');'; + $b['menu'][ t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;'; } function superblock_module() {}