/**
  * @see com_salamon_interface_views::getCanonicalURL()
  */
 public function getCanonicalURL()
 {
     $canonicals = array();
     $canonicalsDomains = array();
     $request_uri = $_SERVER['REQUEST_URI'];
     $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $path = $this->_Setting->getSetting('pathtoapp', 'paths') . $this->_Setting->getSetting('configuration', 'paths') . 'canonicals' . ($this->getModule() != '' ? '_' . $this->getModule() : '') . '.php';
     if (file_exists($path)) {
         include $path;
         if (isset($canonicalsDomains[APP_DOMAIN])) {
             if (isset($canonicals[$request_uri])) {
                 $url = 'http://' . $this->_Setting->getSetting('env', 'defaults') . '.' . $canonicalsDomains[APP_DOMAIN] . $canonicals[$request_uri];
                 $canonical_tag = '<link rel="canonical" href="' . $url . '" />';
                 $canonical_tag .= '<meta property="og:url" content="' . $url . '" />';
             } else {
                 if ($_SERVER["REQUEST_URI"] == '/') {
                     $url = 'http://' . $this->_Setting->getSetting('env', 'defaults') . '.' . $canonicalsDomains[APP_DOMAIN];
                 } else {
                     $url = 'http://' . $this->_Setting->getSetting('env', 'defaults') . '.' . $canonicalsDomains[APP_DOMAIN] . $_SERVER["REQUEST_URI"];
                 }
             }
         } else {
             if (isset($canonicals[$request_uri])) {
                 $url = 'http://' . $_SERVER['SERVER_NAME'] . $canonicals[$request_uri];
             }
         }
     }
     return $url;
 }
 protected function setDefaults($framework_path = '', $application_path = '', $folders = array(), $version = '', $appName = '', $mapingAppNameSpace = array(), $enviroments = array())
 {
     if ($application_path != '') {
         $this->application_path = $application_path;
     }
     if ($framework_path != '') {
         $this->framework_path = $framework_path;
     }
     if ($appName != '') {
         $this->appName = $appName;
     }
     if (count($folders) > 0) {
         $this->folders = $folders;
     }
     if ($version != '') {
         $this->version = $version;
     }
     if (count($mapingAppNameSpace) > 0) {
         $this->mapingAppNameSpace = $mapingAppNameSpace;
     }
     if (count($enviroments) > 0) {
         $this->enviroments = $enviroments;
     }
     $path = $this->framework_path . PATH_SEPARATOR . $this->framework_path . 'PEARS/' . PATH_SEPARATOR . $this->framework_path . 'com/salamon/v' . $this->version . '/';
     $path .= PATH_SEPARATOR . $this->application_path . 'com/' . $this->appName . '/' . PATH_SEPARATOR . $this->application_path . $this->folders['handlers'] . PATH_SEPARATOR . $this->application_path . $this->folders['configs'] . PATH_SEPARATOR . $this->application_path . $this->folders['views'] . PATH_SEPARATOR . $this->application_path . $this->folders['layouts'];
     ini_set($path, ini_get('include_path'));
     spl_autoload_extensions('.php');
     spl_autoload_register(array($this, 'objectLoader'));
     /**
      * Load nececery libs
      */
     require_once 'com.salamon.settings.php';
     require_once 'com.salamon.views.php';
     require_once 'com.salamon.settings.php';
     require_once 'com.salamon.controllers.php';
     require_once 'com.salamon.events.php';
     require_once 'com.salamon.session.php';
     require_once 'com.salamon.routes.php';
     require_once 'database/com.salamon.database.mysql.php';
     require_once 'com.salamon.general.php';
     require_once 'com.salamon.translations.php';
     /**
      * Namespace
      */
     $this->setAppNamespace();
     /**
      * Settings
      */
     $Setting = new com_salamon_settings($this->_settings_default_sett_name, $this->_settings_path_sett_dir);
     for ($i = 0; $i < count($this->enviroments); $i++) {
         $Setting->setEnv($this->enviroments[$i]['name'], $this->enviroments[$i]['subdomain'] . $this->thisDomain);
     }
     $Setting->setAppNamespace($this->thisAppNamescpace);
     $Setting->loadSetting();
     $Setting->loadEnvSetting();
     /**
      * Load Routes for Application
      */
     $SettingRoutes = new com_salamon_settings($this->_settings_route_config_name, $this->_settings_path_sett_dir);
     $SettingRoutes->setAppNamespace($this->thisAppNamescpace);
     $SettingRoutes->loadSetting();
     $Routes = new com_salamon_routes($SettingRoutes);
     /**
      * Seesion and Events
      */
     $Session = new com_salamon_session($Setting);
     $Event = new com_salamon_events($Setting, $Session, $Routes);
     /**
      * Translations
      */
     $currentlang = $Event->getValue('lang', 'post&get&session', '') != '' ? $Event->getValue('lang', 'post&get', '') : $Setting->getSetting('lang', 'defaults');
     $t = new com_salamon_translations($this->application_path . $this->folders['translations'], $currentlang);
     $Event->setTranslations($t);
     /**
      * Database
      */
     $this->_db = new com_salamon_database_mysql($Setting->getSetting('db_user', 'database'), $Setting->getSetting('db_serv', 'database'), $Setting->getSetting('db_pasw', 'database'), $Setting->getSetting('db_type', 'database'), $Setting->getSetting('db_name', 'database'));
     $this->_db->connection();
     $this->_Event = $Event;
     $this->_Setting = $Setting;
     $this->_Routes = $Routes;
     $this->_T = $t;
     $this->_Session = $Session;
 }