Skip to content

Commit

Permalink
Wire the theme index into the gallery ui, but it's still untested.
Browse files Browse the repository at this point in the history
Part of #5.
  • Loading branch information
sbrl committed Aug 26, 2019
1 parent 90109bc commit 26c3a4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.sh
Expand Up @@ -157,7 +157,7 @@ AWK
fi
preview_regen=true;

screenshot_loc_full="$(dirname "${filename}")/preview_full.png";
screenshot_loc_full="$(dirname "${filename}")/preview_large.png";
screenshot_loc_small="$(dirname "${filename}")/preview_small.png";

# Set the theme
Expand Down
14 changes: 9 additions & 5 deletions modules/feature-theme-gallery.php
Expand Up @@ -27,10 +27,14 @@
exit(page_renderer::render_main("Error - Theme Gallery - $settings->sitename", "<p>Error: Failed to download theme index file from <code>" . htmlentities($url) . "</code>."));
}

$themes_available = array_merge(
$themes_available,
$next_obj
);
foreach($next_obj as $theme) {
$theme["index_url"] = $url;
$theme["root"] = dirname($url) . "/{$theme["id"]}";
$theme["url"] = "{$theme["root"]}/theme.css";
$theme["preview_large"] = "{$theme["root"]}/preview_large.png";
$theme["preview_small"] = "{$theme["root"]}/preview_small.png";
$themes_available[] = $theme;
}
}

$content = "<h1>Theme Gallery</h1>
Expand All @@ -41,7 +45,7 @@
<a href='" . htmlentities($theme["preview_large"]) . "'><img src='" . htmlentities($theme["preview_small"]) . "' title='Click to enlarge.' /></a>
<label for='" . htmlentities($theme["id"]) . "'>" . htmlentities($theme["name"]) . "</label>
<p>" . str_replace("\n", "</p>\n<p>", htmlentities($theme["description"])) . "</p>
<p>By <a href='" . htmlentities($theme["author_link"]) . "'>" . htmlentities($theme["author"]) . "</a> (<a href='" . htmlentities($theme["url"]) . "'>View CSS</a>)
<p>By <a href='" . htmlentities($theme["author_link"]) . "'>" . htmlentities($theme["author"]) . "</a> (<a href='" . htmlentities($theme["url"]) . "'>View CSS</a>, <a href='" . htmlentities($theme["index_url"]) . "'>View Index</a>)
</div>";
}
$content .= "</div>";
Expand Down

0 comments on commit 26c3a4d

Please sign in to comment.