Esempio n. 1
0
function GetWordVideo($wr, $prev)
{
    $words = array();
    $arr = array();
    $vname = "";
    $clink = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
    $xx = strpos($clink, "/php/");
    if ($xx > 0) {
        $clink = substr($clink, 0, $xx);
    }
    $vpath = $clink . "/res/video/";
    $phr = $wr;
    $xx = 1;
    while ($xx > 0) {
        $xx = strpos($phr, ",");
        if ($xx > 0) {
            $wr = substr($phr, 0, $xx);
            $phr = substr($phr, $xx + 1, strlen($phr) - $xx);
        } else {
            $wr = $phr;
        }
        if (FoundInDic($wr)) {
            $vname = $vpath . GetVideoName($wr) . "/1.3gp";
            array_push($words, $vname);
        } else {
            $arr = SearchInDic($wr, $prev);
            if (count($arr) > 0) {
                for ($i = 0; $i < count($arr); $i++) {
                    $vname = $vpath . GetVideoName($arr[$i]) . "/1.3gp";
                    array_push($words, $vname);
                }
            } else {
                array_push($words, $vpath . "000.3gp");
            }
        }
    }
    $proto = '{ 

"videos":[
   ]}';
    $videoarray = json_decode($proto, true);
    $temp = array();
    for ($i = 0; $i < count($words); $i++) {
        $temp["vpath"] = $words[$i];
        array_push($videoarray["videos"], $temp);
    }
    return $videoarray;
}
Esempio n. 2
0
function SearchExprssions($phrase)
{
    $str = array();
    if (strpos($phrase, " ") !== false) {
        $str = explode(" ", $phrase);
    } else {
        array_push($str, $phrase);
    }
    $sss = array();
    $ss = "";
    for ($k = 2; $k <= count($str); $k++) {
        for ($i = 0; $i <= count($str) - $k; $i++) {
            $ss = "";
            for ($j = $i; $j < $i + $k; $j++) {
                $ss = $ss . " " . $str[$j];
            }
            $ss = trim($ss);
            array_push($sss, Noquots($ss));
        }
    }
    $temp = "";
    $vvv = Noquots($phrase);
    $expr = array();
    for ($i = 0; $i < count($sss); $i++) {
        if (FoundInDic($sss[$i])) {
            array_push($expr, $sss[$i]);
        }
    }
    if (count($expr) > 0) {
        for ($i = 0; $i < count($expr); $i++) {
            $temp = "~" . $i;
            $vvv = str_replace($vvv, $expr[$i], $temp);
        }
        $estr = explode(" ", $vvv);
        $j = 0;
        for ($k = 0; $k < count($expr); $k++) {
            for ($i = 0; $i < count($estr); $i++) {
                $temp = "~" . $j;
                if ($estr[$i] == $temp) {
                    $estr[$i] = $expr[$j];
                    $j++;
                }
            }
        }
        return $estr;
    } else {
        return $str;
    }
}