Пример #1
0
 public static function linkPublic()
 {
     $args = func_get_args();
     if (!isset($args[0])) {
         $args[0] = null;
     }
     if (!isset($args[1])) {
         $args[1] = null;
     }
     $args[2] = false;
     $page = $args[0];
     $req_site = static::$site;
     if (strpos($page, '/') !== false && preg_match('/^([A-Z][A-Za-z0-9-_]*)\\/(.*)$/', $page, $matches) === 1 && OSCOM::siteExists($matches[1], false)) {
         $req_site = $matches[1];
         $page = $matches[2];
     }
     $args[0] = 'Shop/public/Sites/' . $req_site . '/' . $page;
     $url = forward_static_call_array('static::link', $args);
     return $url;
 }
Пример #2
0
 public function loadDefinitions($group, $language_code = null, $scope = null)
 {
     $language_code = isset($language_code) && $this->exists($language_code) ? $language_code : $this->get('code');
     if (!isset($scope)) {
         $scope = 'global';
     }
     $site = OSCOM::getSite();
     if (strpos($group, '/') !== false && preg_match('/^([A-Z][A-Za-z0-9-_]*)\\/(.*)$/', $group, $matches) === 1 && OSCOM::siteExists($matches[1])) {
         $site = $matches[1];
         $group = $matches[2];
     }
     $pathname = OSCOM::getConfig('dir_root', $site) . 'includes/languages/' . $this->get('directory', $language_code) . '/' . $group;
     // legacy
     if (is_file($pathname . '.php')) {
         include $pathname . '.php';
         return true;
     }
     $pathname .= '.txt';
     if ($language_code != 'en') {
         call_user_func([$this, __FUNCTION__], $group, 'en', $scope);
     }
     $defs = $this->getDefinitions($group, $language_code, $pathname);
     $this->injectDefinitions($defs, $scope);
 }