- <?php
-
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
- namespace common\helpers;
-
- class Url
- {
- public static function frontend($action = '')
- {
- $server_name = Yii::$app->getRequest()->serverName ;
- $address = '' ;
- if($server_name == 'localhost')
- {
- $address = 'http://localhost/reservation_pain/frontend/web/' ;
- }
- elseif($server_name == 'www.laboiteapain.net' ||
- $server_name == 'boulanger.laboiteapain.net')
- {
- $address = 'http://www.laboiteapain.net/' ;
- }
- elseif($server_name == 'dev.laboiteapain.net' ||
- $server_name == 'boulanger-dev.laboiteapain.net')
- {
- $address = 'http://dev.laboiteapain.net/' ;
- }
- elseif($server_name == 'demo.laboiteapain.net' ||
- $server_name == 'boulanger-demo.laboiteapain.net')
- {
- $address = 'http://demo.laboiteapain.net/' ;
- }
-
- if(strlen($action))
- {
- $address .= 'index.php?r='.$action ;
- }
-
- return $address ;
- }
-
- public static function backend($action = '')
- {
- $server_name = Yii::$app->getRequest()->serverName ;
- $address = '' ;
- if($server_name == 'localhost')
- {
- $address = 'http://localhost/reservation_pain/backend/web/' ;
- }
- elseif($server_name == 'www.laboiteapain.net' ||
- $server_name == 'boulanger.laboiteapain.net')
- {
- $address = 'http://boulanger.laboiteapain.net/' ;
- }
- elseif($server_name == 'dev.laboiteapain.net' ||
- $server_name == 'boulanger-dev.laboiteapain.net')
- {
- $address = 'http://boulanger-dev.laboiteapain.net/' ;
- }
- elseif($server_name == 'demo.laboiteapain.net' ||
- $server_name == 'boulanger-demo.laboiteapain.net')
- {
- $address = 'http://boulanger-demo.laboiteapain.net/' ;
- }
-
- if(strlen($action))
- {
- $address .= 'index.php?r='.$action ;
- }
-
- return $address ;
- }
-
- public static function env($env, $section)
- {
- $server_name = Yii::$app->getRequest()->serverName ;
-
- if($section == 'backend')
- {
- if($server_name == 'localhost')
- {
- return 'http://localhost/reservation_pain/backend/web/' ;
- }
- else {
- if($env == 'prod')
- {
- return 'http://boulanger.laboiteapain.net/' ;
- }
- else {
- return 'http://boulanger-'.$env.'.laboiteapain.net/' ;
- }
- }
- }
- else {
- if($server_name == 'localhost')
- {
- return 'http://localhost/reservation_pain/frontend/web/' ;
- }
- else {
- if($env == 'prod')
- {
- return 'http://www.laboiteapain.net/' ;
- }
- else {
- return 'http://'.$env.'.laboiteapain.net/' ;
- }
- }
- }
- }
-
- public static function slugify($string) {
- return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string)));
- }
- }
|