blob: 5c5fffa8091d08c4aabff6e514e6c3ce91c0925d [file] [log] [blame]
Derek Jones0b59f272008-05-13 04:22:33 +00001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allardd2df9bc2007-04-15 17:41:17 +00002/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 4.3.2 or newer
6 *
7 * @package CodeIgniter
Derek Allard3d879d52008-01-18 19:41:32 +00008 * @author ExpressionEngine Dev Team
Derek Allardd2df9bc2007-04-15 17:41:17 +00009 * @copyright Copyright (c) 2006, EllisLab, Inc.
Derek Jones7a9193a2008-01-21 18:39:20 +000010 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
Derek Allardd2df9bc2007-04-15 17:41:17 +000012 * @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
Derek Allard3d879d52008-01-18 19:41:32 +000024 * @author ExpressionEngine Dev Team
Derek Jones7a9193a2008-01-21 18:39:20 +000025 * @link http://codeigniter.com/user_guide/helpers/typography_helper.html
Derek Allardd2df9bc2007-04-15 17:41:17 +000026 */
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 */
Derek Jones0b59f272008-05-13 04:22:33 +000037if ( ! function_exists('nl2br_except_pre'))
Derek Allardd2df9bc2007-04-15 17:41:17 +000038{
Derek Jones269b9422008-01-28 21:00:20 +000039 function nl2br_except_pre($str)
Derek Allardd2df9bc2007-04-15 17:41:17 +000040 {
Rick Ellis9907df42008-09-12 07:22:21 +000041 $CI =& get_instance();
Derek Allardd2df9bc2007-04-15 17:41:17 +000042
Rick Ellis9907df42008-09-12 07:22:21 +000043 $CI->load->library('typography');
Derek Jones269b9422008-01-28 21:00:20 +000044
Rick Ellis9907df42008-09-12 07:22:21 +000045 return $CI->typography->nl2br_except_pre($str);
Derek Jones269b9422008-01-28 21:00:20 +000046 }
Derek Allardd2df9bc2007-04-15 17:41:17 +000047}
48
49// ------------------------------------------------------------------------
50
51/**
52 * Auto Typography Wrapper Function
53 *
54 *
55 * @access public
56 * @param string
Rick Ellis55741102008-09-11 20:11:59 +000057 * @param bool whether to allow javascript event handlers
58 * @param bool whether to reduce multiple instances of double newlines to two
Derek Allardd2df9bc2007-04-15 17:41:17 +000059 * @return string
60 */
Derek Jones0b59f272008-05-13 04:22:33 +000061if ( ! function_exists('auto_typography'))
Derek Allardd2df9bc2007-04-15 17:41:17 +000062{
Rick Ellis3bc791f2008-09-12 23:15:52 +000063 function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE)
Derek Jones269b9422008-01-28 21:00:20 +000064 {
Rick Ellis3bc791f2008-09-12 23:15:52 +000065 $CI =& get_instance();
Rick Ellis037a5bc2008-09-10 22:58:21 +000066 $CI->load->library('typography');
Rick Ellis3bc791f2008-09-12 23:15:52 +000067 return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks);
Derek Jones269b9422008-01-28 21:00:20 +000068 }
Derek Allardd2df9bc2007-04-15 17:41:17 +000069}
Derek Jones0b59f272008-05-13 04:22:33 +000070
71/* End of file typography_helper.php */
Derek Jonesa3ffbbb2008-05-11 18:18:29 +000072/* Location: ./system/helpers/typography_helper.php */