typography_helper.php 2.3 KB

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