Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. if ( !function_exists('jsredirect') )
  4. {
  5. function jsredirect($url, $top = false)
  6. {
  7. $script_redirect = '<script type="text/javascript">';
  8. $script_redirect .= 'window';
  9. if( $top ) $script_redirect .= '.top';
  10. $script_redirect .= '.location.href="'.$url.'"';
  11. $script_redirect .= '</script>';
  12. echo $script_redirect;
  13. die();
  14. }
  15. }
  16.  
  17. if ( !function_exists('arr2json') )
  18. {
  19. function arr2json($arr, $echo = true)
  20. {
  21. if( $echo )
  22. {
  23. header('Content-type: application/json');
  24. echo json_encode($arr);
  25. }
  26.  
  27. else
  28. {
  29. return json_encode($arr);
  30. }
  31. }
  32. }
  33.  
  34. if ( !function_exists('pr') )
  35. {
  36. function pr($arr)
  37. {
  38. echo '<PRE>';
  39. print_r($arr);
  40. echo '</PRE>';
  41. }
  42. }
  43.  
  44. if ( !function_exists('pd') )
  45. {
  46. function pd($arr)
  47. {
  48. echo '<PRE>';
  49. var_dump($arr);
  50. echo '</PRE>';
  51. }
  52. }
  53.  
  54. if ( !function_exists('prd') )
  55. {
  56. function prd($arr)
  57. {
  58. echo '<PRE>';
  59. print_r($arr);
  60. echo '</PRE>';
  61. die();
  62. }
  63. }
  64.  
  65. if ( !function_exists('dd') )
  66. {
  67. function dd($arr)
  68. {
  69. echo '<PRE>';
  70. var_dump($arr);
  71. echo '</PRE>';
  72. die();
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement