/halogy/helpers/typography_helper.php

https://bitbucket.org/haloweb/halogy-1.0/ · PHP · 71 lines · 19 code · 9 blank · 43 comment · 3 complexity · 3950682b5d5873df0c671477e7822be9 MD5 · raw file

  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * CodeIgniter
  4. *
  5. * An open source application development framework for PHP 4.3.2 or newer
  6. *
  7. * @package CodeIgniter
  8. * @author ExpressionEngine Dev Team
  9. * @copyright Copyright (c) 2008 - 2009, 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 reduce multiple instances of double newlines to two
  50. * @return string
  51. */
  52. if ( ! function_exists('auto_typography'))
  53. {
  54. function auto_typography($str, $reduce_linebreaks = FALSE)
  55. {
  56. $CI =& get_instance();
  57. $CI->load->library('typography');
  58. return $CI->typography->auto_typography($str, $reduce_linebreaks);
  59. }
  60. }
  61. /* End of file typography_helper.php */
  62. /* Location: ./system/helpers/typography_helper.php */