public function remove_word() { $id = intval(key($this->request->post('remove'))); $id = $this->hook->fire('remove_censoring_word_start', $id); $result = DB::for_table('censoring')->find_one($id); $result = $this->hook->fireDB('remove_censoring_word', $result); $result = $result->delete(); // Regenerate the censoring cache $this->feather->cache->store('search_for', Cache::get_censoring('search_for')); $this->feather->cache->store('replace_with', Cache::get_censoring('replace_with')); Url::redirect($this->feather->urlFor('adminCensoring'), __('Word removed redirect')); }
public function remove_word() { $id = intval(key(Input::post('remove'))); $id = Container::get('hooks')->fire('model.admin.censoring.remove_censoring_word_start', $id); $result = DB::for_table('censoring')->find_one($id); $result = Container::get('hooks')->fireDB('model.admin.censoring.remove_censoring_word', $result); $result = $result->delete(); // Regenerate the censoring cache Container::get('cache')->store('search_for', Cache::get_censoring('search_for')); Container::get('cache')->store('replace_with', Cache::get_censoring('replace_with')); return Router::redirect(Router::pathFor('adminCensoring'), __('Word removed redirect')); }
public static function censor($text) { static $search_for, $replace_with; $feather = \Slim\Slim::getInstance(); if (!$feather->cache->isCached('search_for')) { $feather->cache->store('search_for', Cache::get_censoring('search_for')); $search_for = $feather->cache->retrieve('search_for'); } if (!$feather->cache->isCached('replace_with')) { $feather->cache->store('replace_with', Cache::get_censoring('replace_with')); $replace_with = $feather->cache->retrieve('replace_with'); } if (!empty($search_for) && !empty($replace_with)) { return substr(self::ucp_preg_replace($search_for, $replace_with, ' ' . $text . ' '), 1, -1); } else { return $text; } }
public static function censor($text) { static $search_for, $replace_with; if (!Container::get('cache')->isCached('search_for')) { Container::get('cache')->store('search_for', Cache::get_censoring('search_for')); } $search_for = Container::get('cache')->retrieve('search_for'); if (!Container::get('cache')->isCached('replace_with')) { Container::get('cache')->store('replace_with', Cache::get_censoring('replace_with')); } $replace_with = Container::get('cache')->retrieve('replace_with'); if (!empty($search_for) && !empty($replace_with)) { return substr(self::ucp_preg_replace($search_for, $replace_with, ' ' . $text . ' '), 1, -1); } else { return $text; } }