X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=blockem%2Fblockem.php;h=223a1990c336d17a20635017e16d6d222695fad8;hb=a25f694960a39fffd12d40a0b00cb40ad96c0214;hp=43f34554e24071cc92a492c2121a4b8d244f8632;hpb=d7bd2246c18f5880fc3c083bf3d698fe4f29fcb6;p=friendica-addons.git
diff --git a/blockem/blockem.php b/blockem/blockem.php
index 43f34554..223a1990 100755
--- a/blockem/blockem.php
+++ b/blockem/blockem.php
@@ -16,6 +16,7 @@ function blockem_install() {
register_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
register_hook('conversation_start', 'addon/blockem/blockem.php', 'blockem_conversation_start');
register_hook('item_photo_menu', 'addon/blockem/blockem.php', 'blockem_item_photo_menu');
+ register_hook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store' );
}
@@ -26,6 +27,7 @@ function blockem_uninstall() {
unregister_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
unregister_hook('conversation_start', 'addon/blockem/blockem.php', 'blockem_conversation_start');
unregister_hook('item_photo_menu', 'addon/blockem/blockem.php', 'blockem_item_photo_menu');
+ unregister_hook('enotify_store', 'addon/blockem/blockem.php', 'blockem_enotify_store' );
}
@@ -47,14 +49,20 @@ function blockem_addon_settings(&$a,&$s) {
if(! $words)
$words = '';
- $s .= '
';
- $s .= '
' . t('"Blockem" Settings') . '
';
+ $s .= '
';
+ $s .= '' . t('"Blockem"') . '
';
+ $s .= '';
+ $s .= '
';
+ $s .= '
';
+ $s .= '' . t('"Blockem"') . '
';
+ $s .= '';
+
$s .= '
';
$s .= '';
$s .= '';
$s .= '
';
- $s .= '
';
+ $s .= '
';
return;
@@ -71,6 +79,35 @@ function blockem_addon_settings_post(&$a,&$b) {
}
}
+
+function blockem_enotify_store(&$a,&$b) {
+
+ $words = get_pconfig($b['uid'],'blockem','words');
+ 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 blockem_prepare_body(&$a,&$b) {
if(! local_user())
@@ -101,15 +138,15 @@ function blockem_prepare_body(&$a,&$b) {
}
}
if($found) {
- $rnd = random_string(8);
+ $rnd = random_string(8);
$b['html'] = '' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '
' . $b['html'] . '
';
}
}
function blockem_display_item(&$a,&$b) {
- if(strstr($b['output'],'id="blockem-wrap-'))
- $b['output'] = preg_replace('/\
/','
get_baseurl() . "/images/default-profile-sm.jpg" . '" class="wall-item-photo$3>',$b['output']);
+ if(strstr($b['output']['body'],'id="blockem-wrap-'))
+ $b['output']['thumb'] = $a->get_baseurl() . "/images/person-80.jpg";
}
@@ -157,9 +194,9 @@ function blockem_item_photo_menu(&$a,&$b) {
}
}
if($blocked)
- $b['menu'][ t('Unblock Author')] = 'javascript:blockemUnblock("' . $author . '");';
+ $b['menu'][ t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');';
else
- $b['menu'][ t('Block Author')] = 'javascript:blockemBlock("' . $author . '");';
+ $b['menu'][ t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');';
}
function blockem_module() {}
@@ -193,4 +230,4 @@ function blockem_init(&$a) {
set_pconfig(local_user(),'blockem','words',$words);
info( t('blockem settings updated') . EOL );
killme();
-}
\ No newline at end of file
+}