11if (!defined(
'XOOPS_ROOT_PATH')) {
15require_once XOOPS_ROOT_PATH .
'/core/XCube_ActionForm.class.php';
16require_once XOOPS_MODULE_PATH .
'/legacy/class/Legacy_Validator.class.php';
20 public $mQueries = [];
21 public $_mKeywordMin = 0;
25 parent::__construct();
26 $this->_mKeywordMin = (int)$keywordMin;
42 $this->mFieldProperties[
'andor']->setDependsByArray([
'mask']);
43 $this->mFieldProperties[
'andor']->addMessage(
'mask', _MD_LEGACY_ERROR_MASK, _MD_LEGACY_LANG_ANDOR);
44 $this->mFieldProperties[
'andor']->addVar(
'mask',
'/^(AND|OR|exact)$/i');
54 if (
'exact' == $this->
get(
'andor') && strlen($this->
get(
'query')) >= $this->_mKeywordMin) {
55 $this->mQueries[] = $myts->addSlashes($this->
get(
'query'));
57 $query = $this->
get(
'query');
58 if (defined(
'XOOPS_USE_MULTIBYTES')) {
59 $query = xoops_trim($query);
62 $separator =
'/[\s,]+/';
63 if (defined(
'_MD_LEGACY_FORMAT_SEARCH_SEPARATOR')) {
64 $separator = _MD_LEGACY_FORMAT_SEARCH_SEPARATOR;
67 $tmpArr = preg_split($separator, $query);
68 foreach ($tmpArr as $tmp) {
69 if (strlen($tmp) >= $this->_mKeywordMin) {
70 $this->mQueries[] = $myts->addSlashes($tmp);
75 $this->
set(
'query', implode(
' ', $this->mQueries));
78 public function fetchAndor()
80 if (
'' == $this->
get(
'andor')) {
81 $this->
set(
'andor',
'AND');
89 if (!count($this->mQueries)) {
96 $mids = $this->
get(
'mids');
97 if ((is_countable($mids) ? count($mids) : 0) > 0) {
98 $params[
'mids'] = $mids;
101 $params[
'queries'] = $this->mQueries;
102 $params[
'andor'] = $this->
get(
'andor');
103 $params[
'maxhit'] = LEGACY_SEARCH_RESULT_MAXHIT;
[Abstract] Used for validating member property values of XCube_ActionForm.
Represents int[] property. XCube_GenericArrayProperty<XCube_IntProperty>.
Represents string property.