Feature Mute for Dabr (Twitter Client)


First, you create a file mute.php and place in a /common/ folder, the file contents mute.php with the code below

code:

<?php

function muted_page($query) {
/*
mute landing page to show the mutedlist account
thanks for your respect to not change any information here🙂
*/

$content = "<p>Muted Feature is help you to mute an annoying tweets from your timeline <img src=’/smile/mv/sip.gif’><br/>";
$content .= "<br/>Just go to user profile page and click <b>`mute`</b> button to mute him/her tweet <img src=’/smile/mv/ketawa.gif’>";
$content .= "</p>";

$act = $_REQUEST[‘act’];
$screen_name = $_REQUEST[‘user’];

if ($act != "" && $act != NULL) {
mute_save($screen_name,$act);
header(‘Location: ‘. BASE_URL . "mute");exit();

} else {
$muted_list = mute_read();
$content .= "<ul>";
foreach ($muted_list as $item) {
$content .= "<li>@$item&nbsp;";
$content .= "<a href=’mute/?act=unmute&user={$item}’>Unmute</a></li>";
}
$content .= "</ul>";
theme(‘page’, ‘Muted List’, $content);
}
}

function sensor($tl) {
/*
lembaga sensor tweets
here we censored any tweeps from mutedlist account
*/

$muted_list = mute_read();
$new_tl = array();

foreach ($tl as $item) {
$user = strtolower($item->from->screen_name);
if (!in_array($user,$muted_list)) $new_tl[strval($item->id)] = $item;
}
$hsl = json_decode(json_encode($new_tl));
return $hsl;
}

function mute_read() {
/* mutelist reader */

$muted_list = unserialize(base64_decode($_COOKIE[‘muted’]));
if (!$muted_list) { return array();}
else { return json_decode($muted_list); }
}

function mute_save($new,$act) {
/* mutelist writer */

$new = strtolower($new);
$muted_list = mute_read();
if ($act == "mute") {
if (!in_array($new,$muted_list)) array_push($muted_list,$new);
} elseif ($act == "unmute") {
$tmp = array();
foreach ($muted_list as $item) {
if ($item != $new) array_push($tmp,$item);
}
$muted_list = $tmp;
}
$muted_list = json_encode($muted_list);
$duration = time() + (3600 * 24 * 365);
setcookie(‘muted’, base64_encode(serialize($muted_list)), $duration, ‘/’);
}

/* Remove mutedlist cookies when user logout */

if (!isset($GLOBALS[‘user’])) {
if(!array_key_exists(‘USER_AUTH’, $_COOKIE)) {
$duration = time() – 3600;
setcookie("muted", NULL, $duration, ‘/’);
setcookie("muted", NULL, $duration);
}
}

?>

The next step, go to file /common/twitter.php, then add:

Calling code mute.php file by adding require ‘mute.php’; at the beginning of the file after code <?php

add the code in menu_register(array(

code:

‘mute’ => array(
‘callback’ => ‘muted_page’,
‘security’ => true,
),

still in the same file, find the function twitter_home_page ()
replace the code:

code:

$tl = twitter_standard_timeline($tl, ‘friends’);

to

code:

$tl = sensor(twitter_standard_timeline($tl, ‘friends’));

still in the same file, find the function theme_user_header($user) , add the code below:

code:

if ($user->following !== false) {
$muted_list = mute_read();
if (in_array(strtolower($user->screen_name),$muted_list)) {
$out .= " | <a href=’/mute/?act=unmute&user={$user->screen_name}’>Unmute</a>";
} else {
$out .= " | <a href=’/mute/?act=mute&user={$user->screen_name}’>Mute</a>";
}
}

before

code:

$out .= " | <a href=’confirm/spam/{$user->screen_name}/{$user->id}’>Report Spam</a>";
$out .= " | <a href=’search?query=%40{$user->screen_name}’>Search @{$user->screen_name}</a>";
$out .= "</div></div>";
return $out;
}

Do not forget to visit & use Twitter Client from us at the address www.imorv.com🙂

@fays_ozunu

hp with the code below

code:

<?php

function muted_page($query) {
/*
mute landing page to show the mutedlist account
thanks for your respect to not change any information here🙂
*/

$content = "<p>Muted Feature is help you to mute an annoying tweets from your timeline <img src=’/smile/mv/sip.gif’><br/>";
$content .= "<br/>Just go to user profile page and click <b>`mute`</b> button to mute him/her tweet <img src=’/smile/mv/ketawa.gif’>";
$content .= "</p>";

$act = $_REQUEST[‘act’];
$screen_name = $_REQUEST[‘user’];

if ($act != "" && $act != NULL) {
mute_save($screen_name,$act);
header(‘Location: ‘. BASE_URL . "mute");exit();

} else {
$muted_list = mute_read();
$content .= "<ul>";
foreach ($muted_list as $item) {
$content .= "<li>@$item&nbsp;";
$content .= "<a href=’mute/?act=unmute&user={$item}’>Unmute</a></li>";
}
$content .= "</ul>";
theme(‘page’, ‘Muted List’, $content);
}
}

function sensor($tl) {
/*
lembaga sensor tweets
here we censored any tweeps from mutedlist account
*/

$muted_list = mute_read();
$new_tl = array();

foreach ($tl as $item) {
$user = strtolower($item->from->screen_name);
if (!in_array($user,$muted_list)) $new_tl[strval($item->id)] = $item;
}
$hsl = json_decode(json_encode($new_tl));
return $hsl;
}

function mute_read() {
/* mutelist reader */

$muted_list = unserialize(base64_decode($_COOKIE[‘muted’]));
if (!$muted_list) { return array();}
else { return json_decode($muted_list); }
}

function mute_save($new,$act) {
/* mutelist writer */

$new = strtolower($new);
$muted_list = mute_read();
if ($act == "mute") {
if (!in_array($new,$muted_list)) array_push($muted_list,$new);
} elseif ($act == "unmute") {
$tmp = array();
foreach ($muted_list as $item) {
if ($item != $new) array_push($tmp,$item);
}
$muted_list = $tmp;
}
$muted_list = json_encode($muted_list);
$duration = time() + (3600 * 24 * 365);
setcookie(‘muted’, base64_encode(serialize($muted_list)), $duration, ‘/’);
}

/* Remove mutedlist cookies when user logout */

if (!isset($GLOBALS[‘user’])) {
if(!array_key_exists(‘USER_AUTH’, $_COOKIE)) {
$duration = time() – 3600;
setcookie("muted", NULL, $duration, ‘/’);
setcookie("muted", NULL, $duration);
}
}

?>

The next step, go to file /common/twitter.php, then add:

Calling code mute.php file by adding require ‘mute.php’; at the beginning of the file after code <?php

add the code in menu_register(array(

code:

‘mute’ => array(
‘callback’ => ‘muted_page’,
‘security’ => true,
),

still in the same file, find the function twitter_home_page ()
replace the code:

code:

$tl = twitter_standard_timeline($tl, ‘friends’);

to

code:

$tl = sensor(twitter_standard_timeline($tl, ‘friends’));

still in the same file, find the function theme_user_header($user) , add the code below:

code:

if ($user->following !== false) {
$muted_list = mute_read();
if (in_array(strtolower($user->screen_name),$muted_list)) {
$out .= " | <a href=’/mute/?act=unmute&user={$user->screen_name}’>Unmute</a>";
} else {
$out .= " | <a href=’/mute/?act=mute&user={$user->screen_name}’>Mute</a>";
}
}

before

code:

$out .= " | <a href=’confirm/spam/{$user->screen_name}/{$user->id}’>Report Spam</a>";
$out .= " | <a href=’search?query=%40{$user->screen_name}’>Search @{$user->screen_name}</a>";
$out .= "</div></div>";
return $out;
}

Do not forget to visit & use Twitter Client from us at the address www.imorv.com🙂

@fays_ozunu

2 Tanggapan

  1. cok eror kabeh su

  2. eror gan…..

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: