Created
April 17, 2012 15:16
-
-
Save fabrixxm/2406686 to your computer and use it in GitHub Desktop.
Friendica themes gallery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<link rel="stylesheet" href="library/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" /> | |
<script type="text/javascript" src="js/jquery.js" ></script> | |
<script type="text/javascript" src="library/fancybox/jquery.fancybox-1.3.4.pack.js"></script> | |
<style> | |
.theme { width: 210px; height: 300px; float: left; } | |
.theme img { width: 200px; } | |
.theme .name {} | |
</style> | |
<header><h1>Friendica themes gallery</h1></header> | |
<?php | |
/** | |
* Put this file in your friendica install directory | |
*/ | |
$folders= glob("view/theme/*"); | |
$themes = array(); | |
foreach($folders as $f){ | |
$name = explode("/",$f); | |
$name = $name[2]; | |
if (file_exists($f."/theme.php")){ | |
$info = file_get_contents($f."/theme.php"); | |
list($info, $junk) = explode("*/",$info); | |
list($junk, $info) = explode("/*",$info); | |
$info = explode("\n",$info); | |
$tinfo = array(); | |
foreach($info as $i){ | |
$i = trim($i, "\r \t*"); | |
if ($i!=""){ | |
list($k,$v) = explode(":",$i,2); | |
$tinfo[trim($k)] = trim($v); | |
} | |
} | |
$themename = ((isset($tinfo['Name']))?$tinfo['Name']:$name); | |
$themeimg = ((file_exists("$f/screenshot.jpg"))?"$f/screenshot.jpg":false); | |
if ($themeimg===false) $themeimg = ((file_exists("$f/screenshot.png"))?"$f/screenshot.png":false); | |
if ($themeimg===false) { $themeimg = "images/nosign.jpg"; $tinfo['Description']="No screenshot for this theme."; } | |
echo " | |
<div class='theme'> | |
<div class='name'>$themename</div> | |
<a href='$themeimg' rel='fc-theme' title='$themename - ".$tinfo['Description']." '><img src='$themeimg ' alt='screenshot'></a> | |
</div> | |
"; | |
} | |
} | |
?> | |
<script type="text/javascript"> | |
$(".theme a").fancybox(); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment