Exemplo n.º 1
0
function title_privmsg($trailing, $channel, $show_rd)
{
    $list_http = explode("http://", $trailing);
    array_shift($list_http);
    for ($i = 0; $i < count($list_http); $i++) {
        $parts = explode(" ", $list_http[$i]);
        $list_http[$i] = "http://" . $parts[0];
        if (substr($list_http[$i], 0, 7) != "http://") {
            unset($list_http[$i]);
        }
    }
    $list_http = array_values($list_http);
    $list_https = explode("https://", $trailing);
    array_shift($list_https);
    for ($i = 0; $i < count($list_https); $i++) {
        $parts = explode(" ", $list_https[$i]);
        $list_https[$i] = "https://" . $parts[0];
        if (substr($list_https[$i], 0, 8) != "https://") {
            unset($list_https[$i]);
        }
    }
    $list_https = array_values($list_https);
    $list = array_merge($list_http, $list_https);
    $out = array();
    for ($i = 0; $i < min(4, count($list)); $i++) {
        $redirect_data = get_redirected_url($list[$i], "", "", array());
        if ($redirect_data === False) {
            continue;
        }
        $rd_url = $redirect_data["url"];
        # INCORPORATED THE FOLLOWING CONDITION TO ACCOMMODATE ohmibod YOUTUBE TITLES
        if (strpos($rd_url, "youtube") !== False and $channel == "##anime-japanese") {
            continue;
        }
        $raw = get_raw_title($redirect_data);
        if ($raw !== False) {
            $def = translate("auto", "en", $raw);
            $msg = chr(3) . "13" . $raw . chr(3);
            if ($def != $raw and $def != "") {
                $msg = $msg . " [" . chr(3) . "04" . $def . chr(3) . "]";
            }
            if ($rd_url != $list[$i] and $show_rd == True) {
                $msg = $msg . " - " . chr(3) . "03" . $rd_url;
            }
            $out[] = $msg;
        } else {
            term_echo("title: get_raw_title returned false");
        }
    }
    $n = count($out);
    if ($n == 0) {
        term_echo("title: no titles to output");
    }
    for ($i = 0; $i < $n; $i++) {
        if ($i == $n - 1) {
            pm($channel, "└─ " . $out[$i]);
        } else {
            pm($channel, "├─ " . $out[$i]);
        }
    }
}
Exemplo n.º 2
0
            privmsg("  titles disabled for " . chr(3) . "10{$dest}");
        }
    } elseif (strtolower($trailing) == "url on") {
        set_bucket("<exec_title_url_{$dest}>", "on");
        privmsg("  enabled redirected url output for titles in " . chr(3) . "10{$dest}");
    } elseif (strtolower($trailing) == "url off") {
        unset_bucket("<exec_title_url_{$dest}>");
        privmsg("  disabled redirected url output for titles in " . chr(3) . "10{$dest}");
    } else {
        $redirect_data = get_redirected_url($trailing, "", "", array());
        if ($redirect_data === False) {
            term_echo("  title: get_redirected_url=false");
            return;
        }
        $rd_url = $redirect_data["url"];
        $raw = get_raw_title($redirect_data);
        if ($raw !== False) {
            $def = translate("auto", "en", $raw);
            $msg = chr(3) . "13" . $raw . chr(3);
            if ($def != $raw) {
                $msg = $msg . " [" . chr(3) . "04" . $def . chr(3) . "]";
            }
            if ($rd_url != $trailing) {
                $msg = $msg . " - " . chr(3) . "03" . $rd_url;
            }
            privmsg($msg);
        } else {
            term_echo("  title: get_raw_title returned false");
        }
    }
}