blob: c49348e6ab1a7f52e18492c098cbf36f33169291 [file] [log] [blame]
Andrey Andreevdebcc362012-01-07 02:05:29 +02001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Greg Aker741de1c2010-11-10 14:52:57 -06005 * An open source application development framework for PHP 5.1.6 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreevdebcc362012-01-07 02:05:29 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreevdebcc362012-01-07 02:05:29 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
Derek Allard2067d1a2008-11-13 22:59:24 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Derek Allard2067d1a2008-11-13 22:59:24 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
27
28// ------------------------------------------------------------------------
29
30/**
31 * CodeIgniter Typography Helpers
32 *
33 * @package CodeIgniter
34 * @subpackage Helpers
35 * @category Helpers
Derek Jonesf4a4bd82011-10-20 12:18:42 -050036 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000037 * @link http://codeigniter.com/user_guide/helpers/typography_helper.html
38 */
39
40// ------------------------------------------------------------------------
41
42/**
43 * Convert newlines to HTML line breaks except within PRE tags
44 *
45 * @access public
46 * @param string
47 * @return string
Barry Mienydd671972010-10-04 16:33:58 +020048 */
Derek Allard2067d1a2008-11-13 22:59:24 +000049if ( ! function_exists('nl2br_except_pre'))
50{
51 function nl2br_except_pre($str)
52 {
53 $CI =& get_instance();
Derek Allard2067d1a2008-11-13 22:59:24 +000054 $CI->load->library('typography');
Derek Allard2067d1a2008-11-13 22:59:24 +000055 return $CI->typography->nl2br_except_pre($str);
56 }
57}
Barry Mienydd671972010-10-04 16:33:58 +020058
Derek Allard2067d1a2008-11-13 22:59:24 +000059// ------------------------------------------------------------------------
60
61/**
62 * Auto Typography Wrapper Function
63 *
64 *
65 * @access public
66 * @param string
Derek Jones2b7de062010-03-05 10:31:08 -060067 * @param bool whether to allow javascript event handlers
Derek Allard2067d1a2008-11-13 22:59:24 +000068 * @param bool whether to reduce multiple instances of double newlines to two
69 * @return string
70 */
71if ( ! function_exists('auto_typography'))
72{
Derek Jones2b7de062010-03-05 10:31:08 -060073 function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +000074 {
Barry Mienydd671972010-10-04 16:33:58 +020075 $CI =& get_instance();
Derek Allard2067d1a2008-11-13 22:59:24 +000076 $CI->load->library('typography');
Derek Jones2b7de062010-03-05 10:31:08 -060077 return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks);
78 }
79}
80
81
82// --------------------------------------------------------------------
83
84/**
85 * HTML Entities Decode
86 *
87 * This function is a replacement for html_entity_decode()
88 *
Derek Jones2b7de062010-03-05 10:31:08 -060089 * @access public
90 * @param string
Andrey Andreevdebcc362012-01-07 02:05:29 +020091 * @param string
Derek Jones2b7de062010-03-05 10:31:08 -060092 * @return string
93 */
94if ( ! function_exists('entity_decode'))
95{
freewil8cc0cfe2011-08-27 21:53:00 -040096 function entity_decode($str, $charset = NULL)
Derek Jones2b7de062010-03-05 10:31:08 -060097 {
Pascal Kriete6984aaf2011-04-05 14:58:04 -040098 global $SEC;
99 return $SEC->entity_decode($str, $charset);
Derek Allard2067d1a2008-11-13 22:59:24 +0000100 }
101}
102
103/* End of file typography_helper.php */
Andrey Andreevdebcc362012-01-07 02:05:29 +0200104/* Location: ./system/helpers/typography_helper.php */