X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=superblock%2Fsuperblock.php;h=8e42d4737e380b93ccff684ba6bee89e1fd7b0ac;hb=c9a8974165c34bb70874d80a2639b46baf533ffc;hp=b6d19de456b90f1208f757f7ff75d6e47105f9e7;hpb=c71f7b0e1a7bb5ca88347b295dd3a4cc3106c5a9;p=friendica-addons.git diff --git a/superblock/superblock.php b/superblock/superblock.php index b6d19de4..8e42d473 100644 --- a/superblock/superblock.php +++ b/superblock/superblock.php @@ -1,6 +1,4 @@ page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; - $words = PConfig::get(local_user(),'system','blocked'); - if(! $words) { + $words = PConfig::get(local_user(), 'system', 'blocked'); + if (!$words) { $words = ''; } $s .= ''; - $s .= '

' . t('"Superblock"') . '

'; + $s .= '

' . L10n::t('Superblock') . '

'; $s .= '
'; $s .= ''; + $s .= '
'; return; } -function superblock_addon_settings_post(&$a,&$b) { - - if(! local_user()) +function superblock_addon_settings_post(&$a, &$b) +{ + if (!local_user()) { return; + } - if($_POST['superblock-submit']) { - PConfig::set(local_user(),'system','blocked',trim($_POST['superblock-words'])); - info( t('SUPERBLOCK Settings saved.') . EOL); + if (!empty($_POST['superblock-submit'])) { + PConfig::set(local_user(), 'system', 'blocked',trim($_POST['superblock-words'])); + info(L10n::t('SUPERBLOCK Settings saved.') . EOL); } } function superblock_enotify_store(&$a,&$b) { - $words = PConfig::get($b['uid'],'system','blocked'); - if($words) { - $arr = explode(',',$words); - } - else { + $words = PConfig::get($b['uid'], 'system', 'blocked'); + if ($words) { + $arr = explode(',', $words); + } else { return; } $found = false; - if(count($arr)) { - foreach($arr as $word) { - if(! strlen(trim($word))) { + if (count($arr)) { + foreach ($arr as $word) { + if (!strlen(trim($word))) { continue; } - if(link_compare($b['url'],$word)) { + if (link_compare($b['url'], $word)) { $found = true; break; } } } - if($found) { + if ($found) { $b['abort'] = true; } } -function superblock_conversation_start(&$a,&$b) { - - if(! local_user()) +function superblock_conversation_start(&$a, &$b) +{ + if (!local_user()) { return; + } - $words = PConfig::get(local_user(),'system','blocked'); - if($words) { - $a->data['superblock'] = explode(',',$words); + $words = PConfig::get(local_user(), 'system', 'blocked'); + if ($words) { + $a->data['superblock'] = explode(',', $words); } $a->page['htmlhead'] .= <<< EOT @@ -131,42 +124,44 @@ EOT; } -function superblock_item_photo_menu(&$a,&$b) { - - if((! local_user()) || ($b['item']['self'])) +function superblock_item_photo_menu(&$a, &$b) +{ + if (!local_user() || $b['item']['self']) { return; + } $blocked = false; $author = $b['item']['author-link']; - if(is_array($a->data['superblock'])) { - foreach($a->data['superblock'] as $bloke) { - if(link_compare($bloke,$author)) { + if (!empty($a->data['superblock'])) { + foreach ($a->data['superblock'] as $bloke) { + if (link_compare($bloke, $author)) { $blocked = true; break; } } } - $b['menu'][ t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;'; + $b['menu'][L10n::t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;'; } function superblock_module() {} -function superblock_init(&$a) { - - if(! local_user()) +function superblock_init(&$a) +{ + if (!local_user()) { return; + } - $words = PConfig::get(local_user(),'system','blocked'); + $words = PConfig::get(local_user(), 'system', 'blocked'); - if(array_key_exists('block',$_GET) && $_GET['block']) { - if(strlen($words)) + if (array_key_exists('block', $_GET) && $_GET['block']) { + if (strlen($words)) $words .= ','; $words .= trim($_GET['block']); } - PConfig::set(local_user(),'system','blocked',$words); - info( t('superblock settings updated') . EOL ); + PConfig::set(local_user(), 'system', 'blocked', $words); + info(L10n::t('superblock settings updated') . EOL ); killme(); }