forked from friendica/friendica-addons
blockem update
This commit is contained in:
parent
1069db936b
commit
7fcc7b9bb0
BIN
blockem.tgz
BIN
blockem.tgz
Binary file not shown.
|
@ -8,6 +8,8 @@
|
||||||
#blockem-words {
|
#blockem-words {
|
||||||
float: left;
|
float: left;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
width: 400px;
|
||||||
|
height: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#blockem-submit {
|
#blockem-submit {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
function blockem_install() {
|
function blockem_install() {
|
||||||
register_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
|
register_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
|
||||||
|
register_hook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item');
|
||||||
register_hook('plugin_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings');
|
register_hook('plugin_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings');
|
||||||
register_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
|
register_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ function blockem_install() {
|
||||||
|
|
||||||
function blockem_uninstall() {
|
function blockem_uninstall() {
|
||||||
unregister_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
|
unregister_hook('prepare_body', 'addon/blockem/blockem.php', 'blockem_prepare_body');
|
||||||
|
unregister_hook('display_item', 'addon/blockem/blockem.php', 'blockem_display_item');
|
||||||
unregister_hook('plugin_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings');
|
unregister_hook('plugin_settings', 'addon/blockem/blockem.php', 'blockem_addon_settings');
|
||||||
unregister_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
|
unregister_hook('plugin_settings_post', 'addon/blockem/blockem.php', 'blockem_addon_settings_post');
|
||||||
|
|
||||||
|
@ -30,7 +32,6 @@ function blockem_uninstall() {
|
||||||
|
|
||||||
function blockem_addon_settings(&$a,&$s) {
|
function blockem_addon_settings(&$a,&$s) {
|
||||||
|
|
||||||
|
|
||||||
if(! local_user())
|
if(! local_user())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@ function blockem_addon_settings(&$a,&$s) {
|
||||||
$s .= '<h3>' . t('"Blockem" Settings') . '</h3>';
|
$s .= '<h3>' . t('"Blockem" Settings') . '</h3>';
|
||||||
$s .= '<div id="blockem-wrapper">';
|
$s .= '<div id="blockem-wrapper">';
|
||||||
$s .= '<label id="blockem-label" for="blockem-words">' . t('Comma separated profile URLS to block') . ' </label>';
|
$s .= '<label id="blockem-label" for="blockem-words">' . t('Comma separated profile URLS to block') . ' </label>';
|
||||||
$s .= '<input id="blockem-words" type="text" name="blockem-words" value="' . $words .'" />';
|
$s .= '<textarea id="blockem-words" type="text" name="blockem-words" >' . htmlspecialchars($words) . '</textarea>';
|
||||||
$s .= '</div><div class="clear"></div>';
|
$s .= '</div><div class="clear"></div>';
|
||||||
|
|
||||||
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blockem-submit" name="blockem-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
|
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blockem-submit" name="blockem-submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>';
|
||||||
|
@ -97,10 +98,14 @@ function blockem_prepare_body(&$a,&$b) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($found) {
|
if($found) {
|
||||||
$rnd = random_string(8);
|
$rnd = random_string(8);
|
||||||
$b['item']['author-avatar'] = $a->get_baseurl() . "/images/default-profile-sm.jpg";
|
$b['html'] = '<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
|
||||||
$b['html'] =
|
|
||||||
'<script>$("#wall-item-photo-' . $b['item']['id'] . '").removeAttr("src")</script>' .
|
|
||||||
'<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function blockem_display_item(&$a,&$b) {
|
||||||
|
if(strstr($b['output'],'id="blockem-wrap-'))
|
||||||
|
$b['output'] = preg_replace('/\<img(.*?)src=\"(.*?)\" class=\"wall\-item\-photo(.*?)\>/','<img$1src="' . $a->get_baseurl() . "/images/default-profile-sm.jpg" . '" class="wall-item-photo$3>',$b['output']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue