Example #1
0
 public function setSaasUrl($url)
 {
     if ($url) {
         self::$SAAS_URL = $url;
     } else {
         self::$SAAS_URL = '';
     }
 }
 /**
  * Prepare correct domain name
  * @param string $domain - domain name
  * @return type
  */
 public function prepareDomain($domain)
 {
     $CI =& get_instance();
     $template = $CI->config->item('template');
     if ($template != 'administrator') {
         if (file_exists($this->getPoFileUrl($template, 'templates', CUR_LOCALE))) {
             if (!self::$CURRENT_TEMPLATE_PATHS) {
                 $po_array = $this->toArray($template, 'templates', CUR_LOCALE, FALSE);
                 self::$CURRENT_TEMPLATE_PATHS = $po_array['settings']['SearchPath'];
             }
             switch ($this->getDomainType($domain)) {
                 case 'modules':
                     $contains = array_filter(self::$CURRENT_TEMPLATE_PATHS, function ($path, $domain) {
                         return strstr($path, 'modules/' . $domain) ? TRUE : FALSE;
                     });
                     return !empty($contains) ? $template : $domain;
                 case 'main':
                     $contains = array_filter(self::$CURRENT_TEMPLATE_PATHS, function ($path) {
                         $main_path = 'system/language/form_validation';
                         return strstr($path, $main_path) ? TRUE : FALSE;
                     });
                     return !empty($contains) ? $template : $domain;
                 default:
                     return $domain;
             }
         }
     }
     return $domain;
 }