Ejemplo n.º 1
0
 public static function getIDWords($MxWord, $BoValidate = TRUE)
 {
     #
     # If needs validate, we've understand that the default argument has given
     # Then, we expected a simple text (string).
     #
     if (!empty($BoValidate)) {
         self::$StText = $MxWord;
         self::WordExplode();
         self::WordValidate();
         $ArWord = self::$ArWord;
         self::reset();
         unset($MxWord);
     } else {
         #
         # Otherwise, we expect an array. Probably, in this case, the method
         # has been called from own object
         #
         $ArWord = (array) $MxWord;
         unset($MxWord);
     }
     if (empty($ArWord) || !is_array($ArWord)) {
         return array();
     }
     $ArWordDB = array();
     $ArIDWord = array();
     $StIN = "'" . implode("' , '", $ArWord) . "'";
     $StSQL = "SELECT IDWord\n       FROM Word \n     WHERE \n       StWord IN ({$StIN})\n     ORDER BY \n       ItCount DESC\n     LIMIT 1000;";
     SearchHandler::getDBinstance();
     SearchHandler::$DBHandler->execSQL($StSQL);
     $ArResult = SearchHandler::$DBHandler->getResult("string");
     foreach ((array) $ArResult as $Row) {
         $ArIDWord[] = $Row['IDWord'];
     }
     self::$ArIDWord = $ArIDWord;
     return $ArIDWord;
 }