コード例 #1
0
ファイル: request.php プロジェクト: ASDAFF/open_bx
 public function getRequestedPageDirectory()
 {
     if ($this->requestedFileDirectory != null) {
         return $this->requestedFileDirectory;
     }
     $requestedFile = $this->getRequestedPage();
     return $this->requestedFileDirectory = IO\Path::getDirectory($requestedFile);
 }
コード例 #2
0
ファイル: loc.php プロジェクト: ASDAFF/open_bx
 /**
  * Loads language messages for specified file
  *
  * @param string $file
  * @param string $language
  * @return array
  */
 public static function loadLanguageFile($file, $language = null)
 {
     if ($language === null) {
         $language = self::getCurrentLang();
     }
     if (!isset(self::$messages[$language])) {
         self::$messages[$language] = array();
     }
     //first time call only for lang
     if (self::$customMessages === null) {
         self::$customMessages = self::loadCustomMessages($language);
     }
     $path = Path::getDirectory($file);
     static $langDirCache = array();
     if (isset($langDirCache[$path])) {
         $langDir = $langDirCache[$path];
         $fileName = substr($file, strlen($langDir) - 5);
     } else {
         //let's find language folder
         $langDir = $fileName = "";
         $filePath = $file;
         while (($slashPos = strrpos($filePath, "/")) !== false) {
             $filePath = substr($filePath, 0, $slashPos);
             if (is_dir($filePath . "/lang")) {
                 $langDir = $filePath . "/lang";
                 $fileName = substr($file, $slashPos);
                 $langDirCache[$path] = $langDir;
                 break;
             }
         }
     }
     $mess = array();
     if ($langDir != "") {
         //load messages for default lang first
         $defaultLang = self::getDefaultLang($language);
         if ($defaultLang != $language) {
             $langFile = $langDir . "/" . $defaultLang . $fileName;
             if (file_exists($langFile)) {
                 $mess = self::includeFile($langFile);
             }
         }
         //then load messages for specified lang
         $langFile = $langDir . "/" . $language . $fileName;
         if (file_exists($langFile)) {
             $mess = array_merge($mess, self::includeFile($langFile));
         }
         foreach ($mess as $key => $val) {
             self::$messages[$language][$key] = $val;
         }
     }
     return $mess;
 }
コード例 #3
0
ファイル: filesystementry.php プロジェクト: ASDAFF/open_bx
 public function getDirectoryName()
 {
     return Path::getDirectory($this->path);
 }
コード例 #4
0
ファイル: httpclient.php プロジェクト: ASDAFF/open_bx
 /**
  * Downloads and saves a file.
  *
  * @param string $url URI to download
  * @param string $filePath Absolute file path
  * @return bool
  */
 public function download($url, $filePath)
 {
     $dir = IO\Path::getDirectory($filePath);
     IO\Directory::createDirectory($dir);
     $file = new IO\File($filePath);
     $handler = $file->open("w+");
     if ($handler !== false) {
         $this->setOutputStream($handler);
         $res = $this->query(self::HTTP_GET, $url);
         fclose($handler);
         return $res;
     }
     return false;
 }