getThemes(); if ($themes) { $options = $this->widget('Widget_Options'); $siteUrl = $options->siteUrl; $adminUrl = $options->adminUrl; $activated = 0; $result = array(); foreach ($themes as $key => $theme) { $themeFile = $theme . '/index.php'; if (file_exists($themeFile)) { $info = Typecho_Plugin::parseInfo($themeFile); $info['name'] = $this->getTheme($theme, $key); if ($info['activated'] = ($options->theme == $info['name'])) { $activated = $key; } $screen = glob($theme . '/screen*.{jpg,png,gif,bmp,jpeg,JPG,PNG,GIF,BMG,JPEG}', GLOB_BRACE); if ($screen) { $info['screen'] = $options->themeUrl(basename(current($screen)), $info['name']); } else { $info['screen'] = Typecho_Common::url('noscreen.png', $options->adminStaticUrl('img')); } $result[$key] = $info; } } $clone = $result[$activated]; unset($result[$activated]); array_unshift($result, $clone); array_filter($result, array($this, 'push')); } } }