示例#1
0
function cate($i2)
{
    if (preg_match("/all/i", $i2)) {
        return "All";
    } else {
        if (preg_match("/autos/i", $i2)) {
            return "Autos";
        } else {
            if (preg_match("/howto/i", $i2)) {
                return "Howto";
            } else {
                if (preg_match("/news/i", $i2)) {
                    return "News";
                } else {
                    if (preg_match("/people/i", $i2)) {
                        return "People";
                    } else {
                        if (preg_match("/sports/i", $i2)) {
                            return "Sports";
                        } else {
                            if (preg_match("/travel/i", $i2)) {
                                return "Travel";
                                eco("!!!!!!!!!!!!!\n");
                            } else {
                                if (preg_match("/comedy/i", $i2)) {
                                    return "Comedy";
                                } else {
                                    if (preg_match("/education/i", $i2)) {
                                        return "Education";
                                    } else {
                                        if (preg_match("/entertainment/i", $i2)) {
                                            return "Entertainment";
                                        } else {
                                            if (preg_match("/film/i", $i2)) {
                                                return "Film";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
示例#2
0
文件: test.php 项目: philum/cms
function test_xml($f)
{
    $d = get_file($f);
    echo $enc = embed_detect(strtolower($d), 'encoding="', '"');
    if (strtolower($enc) == 'utf-8') {
        $d = utf8_decode_b($d);
    }
    //echo substr_count($d,'<').'-'.substr_count($d,'>');
    eco($d, 1);
    $r = simplexml_load_string($d);
    $xml = explode("\n", $f);
    if (!$r) {
        $rr = libxml_get_errors();
        foreach ($rr as $er) {
            $ret .= display_xml_error($er, $xml);
        }
        libxml_clear_errors();
        return $ret;
    }
}
示例#3
0
文件: tri.php 项目: philum/cms
function vacuum($f, $sj = '')
{
    $f = https($f);
    $f = http($f);
    $f = utmsrc($f);
    $reb = vaccum_ses($f);
    if (!$reb) {
        $_SESSION['vacuum'][nohttp($f)] = '';
        return array('nothing');
    }
    if ($_POST['see']) {
        eco($reb, 1);
    }
    $enc = embed_detect(strtolower($reb), 'charset=', '"');
    if (!$enc) {
        $enc = mb_detect_encoding($reb);
    }
    list($defid, $defs) = verif_defcon($f);
    //defcons
    if (!$defs) {
        $defs = known_defcon($reb);
    }
    if (!$defs) {
        $defs = recognize_defcon($reb);
    }
    $auv = auto_video($f, 'pop');
    if (!$defs && !$auv) {
        add_defcon($f);
        return array('Title', $f, $f, '', '', '');
    }
    if (strtolower($enc) == 'utf-8' or $_POST['utf'] or $defs[5]) {
        $reb = utf8_decode_b($reb);
    }
    if ($defs[2]) {
        if (!$defs[3]) {
            $suj = embed_detect_c($reb, $defs[2]);
        } elseif ($defs[3]) {
            $suj = embed_detect($reb, $defs[2], $defs[3]);
        }
        $suj = trim(del_n($suj));
        $suj = interpret_html($suj, "ok");
    }
    if ($defs[0]) {
        if (!$defs[1]) {
            $rec = embed_detect_c($reb, $defs[0]);
        } elseif ($defs[1]) {
            $rec = embed_detect($reb, $defs[0], $defs[1]);
        }
    } else {
        $rec = embed_detect_c($reb, '<body');
    }
    if ($defs[8]) {
        if (!$defs[9]) {
            $opt = embed_detect_c($reb, $defs[8]);
        } elseif ($defs[9]) {
            $opt = embed_detect($reb, $defs[8], $defs[9]);
        }
        if ($opt) {
            $opt .= br() . br();
        }
    }
    if ($defs[4] && $defs[4] != 1) {
        if (strpos($reb, $defs[4]) !== false) {
            $end = embed_detect_c($reb, $defs[4]);
        }
        if ($end) {
            $end = br() . br() . $end;
        }
    }
    if ($auv) {
        $ret = $auv;
    } elseif (strpos($f, 'twitter.com')) {
        //twit
        list($suj, $ret, $day) = plugin_func('twit', 'twit_vacuum', $f);
    } else {
        $ret = converthtml($opt . $rec . $end);
    }
    //foot
    if ($suj) {
        $title = clean_title($suj);
    } else {
        $title = clean_internaltag(pre_clean($sj ? $sj : 'Title'));
    }
    if ($defs[6]) {
        $ret = post_treat_batch($ret, $title, $defs[6]);
    }
    //post_treat
    if ($_SESSION['sugm']) {
        $sug = sugnote();
    }
    if (!$auv) {
        $ret .= "\n\n" . $sug . '[' . $f . ']';
    }
    //eco($rec,1);
    return array($title, $ret, $rec, $defid, $defs);
}
 function give_json()
 {
     // fabrication et sortie du json à partir de $this->data, alimenté via extract_post_data()
     // eco('$this->data :');
     eco(export_object($this->data));
     eco();
     // eco('sortie json :');
     if (get_param('context') == 'graphLinks') {
         $couples = $this->data['links'];
         $result = [];
         foreach ($couples as $couple) {
             $result[] = $couple;
         }
         $this->json = json_encode($result);
     } else {
         $this->json = json_encode($this->data);
     }
     echo $this->json;
 }
 function give_json()
 {
     // fabrication et sortie du json à partir de $this->data, alimenté via extract_post_data()
     // eco('$this->data :');
     eco(export_object($this->data));
     eco();
     // eco('sortie json :');
     $this->json = json_encode($this->data);
     echo $this->json;
 }