File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 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" >
You can’t perform that action at this time.
0 commit comments