<script type="text/javascript"> function dspSwitch(id) { var d = document.getElementById(id).style; d.display = (d.display == 'block')?'none':'block'; } </script> <?php // include xml lib include_once '../lib.xml.inc.php'; // convert an rdf item to an associative array function asArray($item) { $a = array(); while ($item) { $a[$item->nodeName] = $item->firstChild->nodeValue; $item = $item->nextSibling; } return $a; } // get the feed $rdf = new XML('http://slashdot.org/index.rss'); // get article items $items = $rdf->getElementsByTagName('item'); // loop and gather info $out = ''; foreach ($items as $k => $item) { $a = asArray($item->firstChild); $out .= '<a href="javascript:;" ' . 'onclick="dspSwitch(\'item' . $k . '\')">' . $a['title'] . '</a> (' . $a['dc:date'] . ')<br />' . '<div id="item' . $k . '" style="display:none">' . $a['description'] . ' [<a href="' . $a['link'] . '">more</a>]' . '<br /><br /></div>'; } // display info echo $out;
/** * Fetch list of themes in the skin. * @param string $theme * @return array */ public static function getThemeList($skin = null) { global $application; static $themes_cache = array(); if (!$skin) { $skin = modApiFunc('Look_Feel', 'getCurrentSkin'); } if (isset($themes_cache[$skin])) { return $themes_cache[$skin]; } $themes_pattern = $application->getAppIni('PATH_THEMES') . $skin . '/themes/' . THEME_FILENAME_HEAD . '*' . THEME_FILENAME_TAIL; $themes_raw = asArray(glob($themes_pattern)); $re = '/' . prepareRE($application->getAppIni('PATH_THEMES') . $skin . '/themes/' . THEME_FILENAME_HEAD) . '(.*)' . prepareRE(THEME_FILENAME_TAIL) . '/'; $themes = array(); foreach ($themes_raw as $theme_path) { if (preg_match($re, $theme_path, $match) && is_file($theme_path)) { $path = $application->getAppIni('PATH_THEME') . 'themes/' . THEME_FILENAME_HEAD . $match[1] . THEME_FILENAME_TAIL; $themes[$match[1]] = array('name' => $match[1], 'url' => $application->getAppIni('URL_THEME') . 'themes/' . THEME_FILENAME_HEAD . $match[1] . THEME_FILENAME_TAIL, 'path' => $path, 'editable' => is_writable($path)); } } $themes_cache[$skin] = $themes; return $themes; }