Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2. class some_code
  3. {
  4. public
  5. function __construct()
  6. {
  7. add_action('init', 'change_url');
  8. add_action('wp_head', 'print_header_scripts');
  9. }
  10.  
  11. function change_url()
  12. {
  13. $domain_name = $_SERVER['SERVER_NAME'];
  14. $country_code = get_country_code();
  15. if ($country_code == "PK")
  16. {
  17. header("location: http://///////////////");
  18. exit();
  19. }
  20. else if ($country_code == "AU" && $domain_name !== "au.cacricketbats.com")
  21. {
  22.  
  23.  
  24. header("location: https:///////////////////" .
  25. parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
  26. exit();
  27. }
  28. }
  29.  
  30. function print_header_scripts()
  31. {
  32. ?> /***************************************************************************/
  33. <script>
  34. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  35. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  36. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  37. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  38.  
  39. ga('create', 'UA-xxxxxxxxx-x', 'auto');
  40. ga('send', 'pageview');
  41. </script>"
  42. <?php
  43. }
  44. }
  45. $myCode = new some_code();
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement