当前位置: 首页>>代码示例>>PHP>>正文


PHP Filter::filterText方法代码示例

本文整理汇总了PHP中Filter::filterText方法的典型用法代码示例。如果您正苦于以下问题:PHP Filter::filterText方法的具体用法?PHP Filter::filterText怎么用?PHP Filter::filterText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filter的用法示例。


在下文中一共展示了Filter::filterText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createDirectory

 static function createDirectory($name, $owner)
 {
     require_once "common.php";
     $name = Filter::filterText($name);
     $dir = new MailDirectory($name, $owner);
     return $dir->save();
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:7,代码来源:MailManager.php

示例2: searchPostsBy

 private static function searchPostsBy($keys, $options, $echo_query = false)
 {
     require_once "query.php";
     require_once "strings/strings.php";
     define_tables();
     definePostColumns();
     $table = Query::getDBSchema()->getTable(TABLE_POST);
     $loadComments = true;
     $wheres = array();
     foreach ($keys as $key => $value) {
         if ($key == "name" || $key == "title") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_TITLE), Operator::LIKE, "%" . Filter::filterText($value) . "%");
         }
         if ($key == "permalink") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_PERMALINK), Operator::EQUAL, intval($value));
         }
         if ($key == "id") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_ID), Operator::EQUAL, intval($value));
         }
         if ($key == "tag") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_TAGS), Operator::LIKE, "%" . Filter::filterText($value) . "%");
         }
         if ($key == "day") {
             if (!is_numeric($value)) {
                 $value = date_timestamp_get(date_create_from_format("Y-m-d", $value));
             }
             $daystart = date("Y-m-d", $value);
             $dayend = date("Y-m-d", $value + 24 * 60 * 60);
             //echo "<br />" . $daystart . "-" . $dayend; //DEBUG
             $wheres[] = new WhereConstraint($table->getColumn(POST_CREATION_DATE), Operator::GREATEROREQUAL, $daystart);
             $wheres[] = new WhereConstraint($table->getColumn(POST_CREATION_DATE), Operator::LESSER, $dayend);
         }
         if ($key == "category") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_CATEGORIES), Operator::LIKE, "%" . Filter::filterText($value) . "%");
         }
         if ($key == "title") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_TITLE), Operator::LIKE, "%" . Filter::filterText($value) . "%");
         }
         if ($key == "content") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_CONTENT), Operator::LIKE, "%" . Filter::filterText($value) . "%");
         }
         if ($key == "author") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_AUTHOR), Operator::EQUAL, intval($value));
         }
         if ($key == "no_id") {
             $wheres[] = new WhereConstraint($table->getColumn(POST_ID), Operator::NOTEQUAL, intval($value));
         }
         if ($key == "loadComments") {
             $loadComments = $value == true;
         }
     }
     $newopt = array();
     foreach ($options as $key => $value) {
         if ($key == "by") {
             if (!is_array($value)) {
                 $value = array($value);
             }
             $newvalue = array();
             foreach ($value as $column) {
                 if (!is_a($column, "Column")) {
                     $column = $table->getColumn($column);
                 }
                 if (!is_null($column)) {
                     $newvalue[] = $column;
                 }
             }
             $value = $newvalue;
         }
         $newopt[$key] = $value;
     }
     $db = new DBManager();
     $db->execute($s = Query::generateSelectStm(array($table), array(), $wheres, $newopt));
     if ($echo_query) {
         echo "<font color='red'>" . $s . "</font>";
     }
     //DEBUG
     $posts = array();
     while ($row = $db->fetch_result()) {
         require_once "post/Post.php";
         $posts[] = Post::createFromDBResult($row, $loadComments);
     }
     return $posts;
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:83,代码来源:SearchManager.php

示例3: commentPost

 /**
  * Aggiunge un commento al post selezionato e lo salva nel database.
  *
  * @param author: id dell'autore del commento
  * @param post: variabile di tipo Post
  * @param comment: testo del commento
  * @return post: aggiornato.
  */
 static function commentPost($post, $author, $comment)
 {
     require_once "common.php";
     $comment = Filter::filterText($comment);
     require_once "post/PostCommon.php";
     $c = new Comment(array("author" => $author, "post" => $post->getID(), "comment" => $comment));
     $c->save();
     $post->addComment($c);
     return $post;
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:18,代码来源:PostManager.php

示例4: commentPost

 /**
  * Aggiunge un commento al post selezionato e lo salva nel database.
  *
  * @param author: id dell'autore del commento
  * @param post: variabile di tipo Post
  * @param comment: testo del commento
  * @return post: aggiornato.
  */
 static function commentPost($post, $author, $comment)
 {
     $comment = Filter::filterText($comment);
     require_once "dataobject/Comment.php";
     require_once "dao/CommentDao.php";
     $c = new Comment(array("author" => $author, "post" => $post->getID(), "comment" => $comment));
     $commentdao = new CommentDao();
     $comm = $commentdao->save($c);
     $post->addComment($comm);
     return $post;
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:19,代码来源:PostManager.php

示例5: testSaveCollection

 /**
  * Crea un post;
  * Crea una collezione con il post nel contenuto;
  * Carica la collezione e la confronta con quello salvato in memoria;
  */
 function testSaveCollection()
 {
     require_once "common.php";
     $data = $this->post_data_all;
     $p = PostManager::createPost($data);
     $data1 = $this->collection_data_all;
     //$data1["content"] = array($p);
     $p1 = CollectionManager::addCollection($data1);
     $post = CollectionManager::loadCollection($p1->getID());
     //echo "<p>" . $p1 . "</p><p>" . $post . "</p>"; //DEBUG
     if ($post === false) {
         return "<br />Collection saving test NOT PASSED: not created";
     }
     if ($p1->getTitle() != $post->getTitle()) {
         return "<br />Collection saving test NOT PASSED: title";
     }
     if ($p1->getSubtitle() != $post->getSubtitle()) {
         return "<br />Collection saving test NOT PASSED: subtitle";
     }
     //echo Filter::filterText($p1->getHeadline()) . "-" . Filter::filterText($post->getHeadline()); //DEBUG
     if ($p1->getHeadline() != Filter::filterText($post->getHeadline())) {
         return "<br />Collection saving test NOT PASSED: headline";
     }
     if ($p1->getAuthor() != $post->getAuthor()) {
         return "<br />Collection saving test NOT PASSED: author";
     }
     if (isset($row["tags"])) {
         if ($p1->getTags() != $row["tags"]) {
             return "<br />Post saving test NOT PASSED: tags";
         }
     }
     if (isset($row["categories"])) {
         if ($p1->getCategories() != $row["categories"]) {
             return "<br />Post saving test NOT PASSED: categories";
         }
     }
     //echo serialize($p1->getContent()) . "-" . $post->getContent(); //DEBUG
     if ($p1->getContent() != $post->getContent()) {
         return "<br />Collection saving test NOT PASSED: content";
     }
     if ($p1->isVisible() != $post->isVisible()) {
         return "<br />Collection saving test NOT PASSED: visible";
     }
     $first = false;
     if ($first) {
         return "<br />Collection saving test NOT PASSED: not created";
     }
     return "<br />Save Collection test passed";
 }
开发者ID:Esisto,项目名称:IoEsisto,代码行数:54,代码来源:posttest.php


注:本文中的Filter::filterText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。