/** * Перед сохранением нужно прогнать список слов через фильтры */ public function save() { $mb_case = nc_search::get_setting('FilterStringCase'); $apply_filter = !$this->get('dont_filter'); $list = array(); foreach ($this->get('words') as $word) { $word = trim($word); if (strlen($word)) { // пропустить пустые значения // преобразовать регистр, если в дальнейшем не будут применены фильтры $list[] = $apply_filter ? $word : mb_convert_case($word, $mb_case); } } if ($apply_filter) { $context = new nc_search_context(array('language' => $this->get('language'))); $list = nc_search_extension_manager::get('nc_search_language_filter', $context)->until_first('nc_search_language_filter_synonyms')->apply('filter', $list); } if (sizeof($list) < 2) { throw new nc_search_data_exception(NETCAT_MODULE_SEARCH_ADMIN_SYNONYM_LIST_MUST_HAVE_AT_LEAST_TWO_WORDS); } $this->set('words', $list); parent::save(); }
/** * */ public function save() { if (!$this->get('interval_type')) { throw new nc_search_data_exception(NETCAT_MODULE_SEARCH_ADMIN_RULE_MUST_HAVE_INTERVAL_TYPE); } $this->set('area_string', trim($this->get('area_string'))); if ($this->get('interval_type') == 'daily') { $this->set('interval', 1); $this->set('interval_type', 'day'); } parent::save(); $this->schedule_next_run(); return $this; }
/** * */ public function save() { $this->set('last_activity', time()); return parent::save(); }
/** * * @return nc_search_data_persistent */ public function save() { $this->set('timestamp', nc_search_util::sql_datetime()); return parent::save(); }