Skip to content

Commit b8259b2

Browse files
committed
Update theme.blade.php
1 parent 6422f78 commit b8259b2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

resources/views/studio/theme.blade.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,24 @@
2020
<?php if ($handle = opendir('themes')) {
2121
while (false !== ($entry = readdir($handle))) {
2222
if ($entry != "." && $entry != "..") {
23-
echo '<option >'; print_r($entry); echo '</option>'; }}} ?>
24-
<option selected>default</option>
23+
if(file_exists(base_path('themes') . '/' . $entry . '/readme.md')){
24+
$text = file_get_contents(base_path('themes') . '/' . $entry . '/readme.md');
25+
$pattern = '/Theme Name:.*/';
26+
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
27+
if(sizeof($matches) > 0) {
28+
$themeName = substr($matches[0][0],12);
29+
}
30+
}
31+
if($page->theme != $entry){echo '<option value="'; print_r($entry); echo '">'; echo $themeName; echo '</option>'; }}}} ?>
32+
<?php
33+
if($page->theme != "default"){
34+
if(file_exists(base_path('themes') . '/' . $page->theme . '/readme.md')){
35+
$text = file_get_contents(base_path('themes') . '/' . $page->theme . '/readme.md');
36+
$pattern = '/Theme Name:.*/';
37+
preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
38+
$themeName = substr($matches[0][0],12);}
39+
echo '<option value="'.$page->theme.'" selected>'.$themeName.'</option>';} ?>
40+
<?php echo '<option value="default"'; if($page->theme == "default"){echo 'selected';} echo '>Default</option>'; ?>
2541
</select>
2642
</div>
2743
<div class="col">

0 commit comments

Comments
 (0)