Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add theme_info function to manage relative path and split dir/name
  • Loading branch information
mariez committed Dec 22, 2016
1 parent 0c28dd8 commit d779571
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 21 additions & 1 deletion functions.php
Expand Up @@ -113,4 +113,24 @@ function _topMenu()
$topmenu .= '</div>';

return $topmenu;
}
}


## pick up theme_info (name or dir)
function theme_info($data = "dir"){
$thinfo = dirname(__FILE__) . '/theme_info';
if ( is_file($thinfo) ) {
$theme_info = file_get_contents($thinfo);
$lines = explode("\n", $theme_info);
$info = array();
foreach ($lines as $line) {
if (preg_match('/(\w+)=([\p{L}\p{N}&\#; \-\(\)]+)/u', $line, $regs)) {
$info[$regs[1]] = $regs[2];
}
}
$dir = ( !empty($info['dir']) ) ? 'ui/'.$info['dir'] : 'ui/phplist-ui-bootlist';
$return = ($data == 'name') ? $info['name'] : $dir;

return $return;
}
}
2 changes: 2 additions & 0 deletions theme_info
@@ -0,0 +1,2 @@
name=Bootlist
dir=phplist-ui-bootlist

0 comments on commit d779571

Please sign in to comment.