typography_helper.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. * CodeIgniter Typography Helpers
  18. *
  19. * @package CodeIgniter
  20. * @subpackage Helpers
  21. * @category Helpers
  22. * @author ExpressionEngine Dev Team
  23. * @link http://codeigniter.com/user_guide/helpers/typography_helper.html
  24. */
  25. // ------------------------------------------------------------------------
  26. /**
  27. * Convert newlines to HTML line breaks except within PRE tags
  28. *
  29. * @access public
  30. * @param string
  31. * @return string
  32. */
  33. if ( ! function_exists('nl2br_except_pre'))
  34. {
  35. function nl2br_except_pre($str)
  36. {
  37. $CI =& get_instance();
  38. $CI->load->library('typography');
  39. return $CI->typography->nl2br_except_pre($str);
  40. }
  41. }
  42. // ------------------------------------------------------------------------
  43. /**
  44. * Auto Typography Wrapper Function
  45. *
  46. *
  47. * @access public
  48. * @param string
  49. * @param bool whether to allow javascript event handlers
  50. * @param bool whether to reduce multiple instances of double newlines to two
  51. * @return string
  52. */
  53. if ( ! function_exists('auto_typography'))
  54. {
  55. function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE)
  56. {
  57. $CI =& get_instance();
  58. $CI->load->library('typography');
  59. return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks);
  60. }
  61. }
  62. // --------------------------------------------------------------------
  63. /**
  64. * HTML Entities Decode
  65. *
  66. * This function is a replacement for html_entity_decode()
  67. *
  68. * @access public
  69. * @param string
  70. * @return string
  71. */
  72. if ( ! function_exists('entity_decode'))
  73. {
  74. function entity_decode($str, $charset='UTF-8')
  75. {
  76. global $SEC;
  77. return $SEC->entity_decode($str, $charset);
  78. }
  79. }
  80. /* End of file typography_helper.php */
  81. /* Location: ./system/helpers/typography_helper.php */