當前位置: 首頁>>代碼示例>>PHP>>正文


PHP valid::standard_text方法代碼示例

本文整理匯總了PHP中valid::standard_text方法的典型用法代碼示例。如果您正苦於以下問題:PHP valid::standard_text方法的具體用法?PHP valid::standard_text怎麽用?PHP valid::standard_text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在valid的用法示例。


在下文中一共展示了valid::standard_text方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: valid_standard_text_test

 public function valid_standard_text_test()
 {
     $this->assert_true_strict(valid::standard_text('some valid_text-to.test 123'))->assert_false_strict(valid::standard_text('some !real| ju0n_%k'));
 }
開發者ID:enormego,項目名稱:EightPHP,代碼行數:4,代碼來源:validhelper.php

示例2: snip_edit

 public function snip_edit()
 {
     $input = Input::instance();
     $post = $_POST;
     if (isset($post["user"]) and isset($post['snipID']) and isset($post['title']) and isset($post['lang']) and isset($post['private_check']) and isset($post['snippet'])) {
         $userID = $post["user"];
         $snipID = mysql_real_escape_string($post["snipID"]);
         $title = $post['title'];
         $snips_model = new Snip_Model();
         $language = $snips_model->brush_to_lang($post['lang']);
         $snippet = $post['snippet'];
         $private = mysql_real_escape_string($post['private_check']);
         //$description = $post['description'];
         $description = $input->post('description', NULL, TRUE);
         if (valid::standard_text($title) and valid::standard_text($userID) and strlen($private) == 1) {
             $preRestoreChars = array("~AMP~", "~EQUAL~");
             $restoreChars = array("&", "=");
             $snippet = str_replace($preRestoreChars, $restoreChars, $snippet);
             $title = str_replace($preRestoreChars, $restoreChars, $title);
             $description = str_replace($preRestoreChars, $restoreChars, $description);
             $snippet = htmlspecialchars($snippet);
             $title = mysql_real_escape_string($title);
             $snippet = mysql_real_escape_string($snippet);
             $parser_class = MARKDOWN_PARSER_CLASS;
             $parser = new $parser_class();
             $db = Database::instance();
             if ($description == 'null') {
                 $sql = "UPDATE `snippetz`.`snips` SET `language` = '" . $language . "' , `snippet` = '" . $snippet . "' , `title` = '" . $title . "' , `date_added` = CURRENT_TIMESTAMP , `private` = " . $private . " WHERE `snip_id` = " . $snipID . ";";
                 $result = $db->query($sql);
             } else {
                 $description = $parser->transform($description);
                 $description = str_replace("\n", "<br />", $description);
                 $sql = "UPDATE `snippetz`.`snips` SET `language` = '" . $language . "' , `snippet` = '" . $snippet . "' , `title` = '" . $title . "' , `date_added` = CURRENT_TIMESTAMP , `private` = " . $private . " , `description` = '" . mysql_real_escape_string($description) . "' WHERE `snip_id` = '" . $snipID . "';";
                 $result = $db->query($sql);
             }
             if ($result) {
                 echo "Success! Your snippet has been updated, view it now: <a href='/home/snip/" . $snipID . "'>here</a> .";
             } else {
                 echo "DB error";
             }
         } else {
             echo "Error: title field contains illegal characters";
             die;
         }
     } else {
         echo "Error: wrong params";
         die;
     }
 }
開發者ID:kevinroberts,項目名稱:snippetz,代碼行數:49,代碼來源:snips.php


注:本文中的valid::standard_text方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。