Ejemplo n.º 1
0
 protected function findSecondLevel($str, $secondLevel)
 {
     preg_match_all('[' . $secondLevel . ']', $str, $result, PREG_OFFSET_CAPTURE);
     if (empty($result)) {
         return $str;
     } else {
         $keywordFilter = new KeywordFilter();
         $str = $keywordFilter->filter($str);
         return $str;
     }
 }
Ejemplo n.º 2
0
 public function indexAction(Request $request)
 {
     $sensitiveWordSetting = $this->getSettingService()->get("sensitiveWord", array());
     if ($request->getMethod() == 'POST') {
         $fields = $request->request->all();
         $sensitiveWordSetting = ArrayToolkit::parts($fields, array("enabled", "ignoreWord", "wordReplace", "firstLevel", "secondLevel"));
         $keywords = explode("\r\n", $sensitiveWordSetting["secondLevel"]);
         $keywordFilter = new KeywordFilter();
         $keywordFilter->addKeywords($keywords);
         $this->getSettingService()->set("sensitiveWord", $sensitiveWordSetting);
     }
     return $this->render('TopxiaAdminBundle:SensitiveWord:index.html.twig', array("sensitiveWordSetting" => $sensitiveWordSetting));
 }