1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
---|
2 | /** |
---|
3 | * CodeIgniter |
---|
4 | * |
---|
5 | * An open source application development framework for PHP 5.1.6 or newer |
---|
6 | * |
---|
7 | * @package CodeIgniter |
---|
8 | * @author ExpressionEngine Dev Team |
---|
9 | * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. |
---|
10 | * @license http://codeigniter.com/user_guide/license.html |
---|
11 | * @link http://codeigniter.com |
---|
12 | * @since Version 1.0 |
---|
13 | * @filesource |
---|
14 | */ |
---|
15 | |
---|
16 | // ------------------------------------------------------------------------ |
---|
17 | |
---|
18 | /** |
---|
19 | * CodeIgniter Typography Helpers |
---|
20 | * |
---|
21 | * @package CodeIgniter |
---|
22 | * @subpackage Helpers |
---|
23 | * @category Helpers |
---|
24 | * @author ExpressionEngine Dev Team |
---|
25 | * @link http://codeigniter.com/user_guide/helpers/typography_helper.html |
---|
26 | */ |
---|
27 | |
---|
28 | // ------------------------------------------------------------------------ |
---|
29 | |
---|
30 | /** |
---|
31 | * Convert newlines to HTML line breaks except within PRE tags |
---|
32 | * |
---|
33 | * @access public |
---|
34 | * @param string |
---|
35 | * @return string |
---|
36 | */ |
---|
37 | if ( ! function_exists('nl2br_except_pre')) |
---|
38 | { |
---|
39 | function nl2br_except_pre($str) |
---|
40 | { |
---|
41 | $CI =& get_instance(); |
---|
42 | |
---|
43 | $CI->load->library('typography'); |
---|
44 | |
---|
45 | return $CI->typography->nl2br_except_pre($str); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | // ------------------------------------------------------------------------ |
---|
50 | |
---|
51 | /** |
---|
52 | * Auto Typography Wrapper Function |
---|
53 | * |
---|
54 | * |
---|
55 | * @access public |
---|
56 | * @param string |
---|
57 | * @param bool whether to allow javascript event handlers |
---|
58 | * @param bool whether to reduce multiple instances of double newlines to two |
---|
59 | * @return string |
---|
60 | */ |
---|
61 | if ( ! function_exists('auto_typography')) |
---|
62 | { |
---|
63 | function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE) |
---|
64 | { |
---|
65 | $CI =& get_instance(); |
---|
66 | $CI->load->library('typography'); |
---|
67 | return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks); |
---|
68 | } |
---|
69 | } |
---|
70 | |
---|
71 | |
---|
72 | // -------------------------------------------------------------------- |
---|
73 | |
---|
74 | /** |
---|
75 | * HTML Entities Decode |
---|
76 | * |
---|
77 | * This function is a replacement for html_entity_decode() |
---|
78 | * |
---|
79 | * @access public |
---|
80 | * @param string |
---|
81 | * @return string |
---|
82 | */ |
---|
83 | if ( ! function_exists('entity_decode')) |
---|
84 | { |
---|
85 | function entity_decode($str, $charset='UTF-8') |
---|
86 | { |
---|
87 | global $SEC; |
---|
88 | return $SEC->entity_decode($str, $charset); |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | /* End of file typography_helper.php */ |
---|
93 | /* Location: ./system/helpers/typography_helper.php */ |
---|