当前位置: 首页>>代码示例>>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;未经允许,请勿转载。