You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 line
2.9KB

  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace common\helpers;
  8. use yii ;
  9. class Url
  10. {
  11. public static function frontend()
  12. {
  13. $server_name = Yii::$app->getRequest()->serverName ;
  14. if($server_name == 'localhost')
  15. {
  16. return 'http://localhost/reservation_pain/frontend/web/' ;
  17. }
  18. elseif($server_name == 'www.laboiteapain.net' ||
  19. $server_name == 'boulanger.laboiteapain.net')
  20. {
  21. return 'http://www.laboiteapain.net/' ;
  22. }
  23. elseif($server_name == 'dev.laboiteapain.net' ||
  24. $server_name == 'boulanger-dev.laboiteapain.net')
  25. {
  26. return 'http://dev.laboiteapain.net/' ;
  27. }
  28. elseif($server_name == 'demo.laboiteapain.net' ||
  29. $server_name == 'boulanger-demo.laboiteapain.net')
  30. {
  31. return 'http://demo.laboiteapain.net/' ;
  32. }
  33. }
  34. public static function backend()
  35. {
  36. $server_name = Yii::$app->getRequest()->serverName ;
  37. if($server_name == 'localhost')
  38. {
  39. return 'http://localhost/reservation_pain/backend/web/' ;
  40. }
  41. elseif($server_name == 'www.laboiteapain.net' ||
  42. $server_name == 'boulanger.laboiteapain.net')
  43. {
  44. return 'http://boulanger.laboiteapain.net/' ;
  45. }
  46. elseif($server_name == 'dev.laboiteapain.net' ||
  47. $server_name == 'boulanger-dev.laboiteapain.net')
  48. {
  49. return 'http://boulanger-dev.laboiteapain.net/' ;
  50. }
  51. elseif($server_name == 'demo.laboiteapain.net' ||
  52. $server_name == 'boulanger-demo.laboiteapain.net')
  53. {
  54. return 'http://boulanger-demo.laboiteapain.net/' ;
  55. }
  56. }
  57. public static function env($env, $section)
  58. {
  59. $server_name = Yii::$app->getRequest()->serverName ;
  60. if($section == 'backend')
  61. {
  62. if($server_name == 'localhost')
  63. {
  64. return 'http://localhost/reservation_pain/backend/web/' ;
  65. }
  66. else {
  67. if($env == 'prod')
  68. {
  69. return 'http://boulanger.laboiteapain.net/' ;
  70. }
  71. else {
  72. return 'http://boulanger-'.$env.'.laboiteapain.net/' ;
  73. }
  74. }
  75. }
  76. else {
  77. if($server_name == 'localhost')
  78. {
  79. return 'http://localhost/reservation_pain/frontend/web/' ;
  80. }
  81. else {
  82. if($env == 'prod')
  83. {
  84. return 'http://www.laboiteapain.net/' ;
  85. }
  86. else {
  87. return 'http://'.$env.'.laboiteapain.net/' ;
  88. }
  89. }
  90. }
  91. }
  92. }