本文整理汇总了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;
}
}
示例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']);
}
示例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!');
}
}
示例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));
}
示例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!');
}
}
示例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;
}