コード例 #1
0
 /**
  * Populates the theme array and returns it. The theme array contains information about
  * all the currently available themes.
  * @return array
  */
 function getThemes()
 {
     if (empty($this->themes)) {
         $themedir = SERVERPATH . "/themes";
         $themes = array();
         if ($dp = @opendir($themedir)) {
             while (false !== ($dir = readdir($dp))) {
                 if (substr($dir, 0, 1) != "." && is_dir("{$themedir}/{$dir}")) {
                     $themefile = $themedir . "/{$dir}/theme_description.php";
                     $dir8 = FilesystemToUTF8($dir);
                     if (file_exists($themefile)) {
                         $theme_description = array();
                         require $themefile;
                         $themes[$dir8] = sanitize($theme_description, 1);
                     } else {
                         if (file_exists($themedir . "/{$dir}/theme.txt")) {
                             $themes[$dir8] = parseThemeDef($themedir . "/{$dir}/theme.txt");
                         }
                     }
                 }
             }
             ksort($themes);
         }
         $this->themes = $themes;
     }
     return $this->themes;
 }
コード例 #2
0
 /**
  * Populates the theme array and returns it. The theme array contains information about
  * all the currently available themes.
  * @return array
  */
 function getThemes()
 {
     if (empty($this->themes)) {
         $themedir = SERVERPATH . "/themes";
         $themes = array();
         if ($dp = @opendir($themedir)) {
             while (false !== ($dir = readdir($dp))) {
                 if (substr($dir, 0, 1) != "." && is_dir("{$themedir}/{$dir}")) {
                     $themefile = $themedir . "/{$dir}/theme_description.php";
                     $dir8 = filesystemToInternal($dir);
                     if (file_exists($themefile)) {
                         $theme_description = array();
                         require $themefile;
                         $themes[$dir8] = sanitize($theme_description, 1);
                     } else {
                         if (file_exists($themedir . "/{$dir}/theme.txt")) {
                             $themes[$dir8] = parseThemeDef($themedir . "/{$dir}/theme.txt");
                         } else {
                             $themes[$dir8] = array('name' => gettext('Unknown'), 'author' => gettext('Unknown'), 'version' => gettext('Unknown'), 'desc' => gettext('<strong>Missing theme info file!</strong>'), 'date' => gettext('Unknown'));
                         }
                     }
                 }
             }
             ksort($themes, SORT_LOCALE_STRING);
         }
         $this->themes = $themes;
     }
     return $this->themes;
 }