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


PHP Security::encode_php_tags方法代码示例

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


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

示例1: insBook

 /**
  * @param bool $id
  * @return bool
  * @throws Kohana_Exception
  *
  * insert or update book
  */
 public function insBook($id = false)
 {
     $_POST = Arr::map('trim', $_POST);
     $post = Validation::factory($_POST);
     $post->rule('name', 'not_empty')->rule('name', 'alpha_numeric', array(':value', false))->rule('name', 'min_length', array(':value', 2))->rule('name', 'max_length', array(':value', 20))->rule('email', 'email')->rule('body', 'not_empty')->rule('body', 'max_length', array(':value', 1024));
     if ($post->check()) {
         if ($id) {
             $book = ORM::factory('Guestbook', $id);
         } else {
             $book = ORM::factory('Guestbook');
         }
         $book->name = Security::encode_php_tags(HTML::chars($_POST['name']));
         $book->email = Security::encode_php_tags(HTML::chars($_POST['email']));
         $book->body = Security::encode_php_tags(HTML::chars($_POST['body']));
         try {
             if ($id) {
                 $book->update();
             } else {
                 $book->create();
             }
             return true;
         } catch (ORM_Validation_Exception $e) {
             return false;
         }
     } else {
         //$errors = $post -> errors('validation');
         return false;
     }
 }
开发者ID:alex-bro,项目名称:test-vezom,代码行数:36,代码来源:Guestbook.php

示例2: action_del

 /**
  * @throws Kohana_Exception
  *
  * delete news
  */
 public function action_del()
 {
     $id = $this->request->param('id');
     $id = Security::encode_php_tags(HTML::chars($id));
     $news = new Model_New();
     $news->delNew($id);
     HTTP::redirect($_SERVER['HTTP_REFERER']);
 }
开发者ID:alex-bro,项目名称:test-vezom,代码行数:13,代码来源:Admin.php

示例3: action_editbook

 /**
  * @throws HTTP_Exception_404
  *
  * edit book
  */
 public function action_editbook()
 {
     $id = $this->request->param('id');
     $id = Security::encode_php_tags(HTML::chars($id));
     $session = Session::instance();
     $data['page'] = $session->get("page", '');
     $book = new Model_Guestbook();
     $data = $book->getBook($id);
     if ($data) {
         if ($_POST) {
             $book->insBook($id);
             $data['msg'] = 'Запись добавлена';
             HTTP::redirect($_SERVER['HTTP_REFERER']);
         } else {
             $data['msg'] = 'Запись не добавлена';
         }
         $content = View::factory($this->itemBookView);
         $content->bind('data', $data);
         $this->template->content = $content;
     } else {
         throw new HTTP_Exception_404('File not found!');
     }
 }
开发者ID:alex-bro,项目名称:test-vezom,代码行数:28,代码来源:Adminbook.php

示例4: test_encode_php_tags

 /**
  * Tests Security::encode_php_tags()
  *
  * @test
  * @dataProvider provider_encode_php_tags
  * @covers Security::encode_php_tags
  */
 public function test_encode_php_tags($expected, $input)
 {
     $this->assertSame($expected, Security::encode_php_tags($input));
 }
开发者ID:trie0856,项目名称:sidemik,代码行数:11,代码来源:SecurityTest.php

示例5: action_viewguest

 /**
  * @throws HTTP_Exception_404
  * @throws Kohana_Exception
  *
  * view pagination list book
  */
 public function action_viewguest()
 {
     if (isset($_GET['page'])) {
         $get['page'] = Security::encode_php_tags(HTML::chars($_GET['page']));
     } else {
         $get['page'] = 1;
     }
     $valid = Validation::factory($get);
     $valid->rule('page', 'numeric');
     if (!$valid->check()) {
         HTTP::redirect('/');
     }
     if ((int) $get['page'] <= 0) {
         $get['page'] = 1;
     }
     $items_per_page = Kohana::$config->load('pagination')->get('default')['items_per_page'];
     $books = new Model_Guestbook();
     $data = $books->getPagination(((int) $get['page'] - 1) * (int) $items_per_page, $items_per_page);
     if ($data) {
         $session = Session::instance();
         $session->set("page", $get['page']);
         $total_items = $books->getCount();
         $content = View::factory($this->bookView);
         $content->bind('data', $data);
         $content->pagination = Pagination::factory(array('total_items' => $total_items));
         $this->template->content = $content;
     } else {
         throw new HTTP_Exception_404('File not found!');
     }
 }
开发者ID:alex-bro,项目名称:test-vezom,代码行数:36,代码来源:Appcontroller.php

示例6: action_catalogCounter

 public function action_catalogCounter()
 {
     $gid = Arr::get($_GET, 'gid', 0);
     foreach ($_GET as $key => $value) {
         $key = Security::encode_php_tags($key);
         $value = Security::encode_php_tags($value);
         $ready[$key] = $value;
     }
     $catalog = new Model_Material('group');
     if (isset($ready['go'])) {
         unset($ready['go']);
     }
     unset($ready['gid']);
     $config = Kohana::$config->load('main')->site;
     $search_string = Arr::get($ready, 'searchtext', NULL);
     $count = $catalog->getCountFullMaterials2($gid, $search_string, $ready);
     try {
         $count = $catalog->getCountFullMaterials2($gid, $search_string, $ready);
     } catch (Exception $e) {
         $count = 0;
     }
     echo $count;
 }
开发者ID:chernogolov,项目名称:blank,代码行数:23,代码来源:Ajax.php


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