| 1 |
<?php |
| 2 |
|
| 3 |
namespace FL\Assistant\Services; |
| 4 |
|
| 5 |
class ThemeService { |
| 6 |
|
| 7 |
/** |
| 8 |
* @return array |
| 9 |
*/ |
| 10 |
public function get_current_theme_data() { |
| 11 |
return $this->get_theme_data(); |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* @return array |
| 16 |
*/ |
| 17 |
public function get_theme_data( $slug = '' ) { |
| 18 |
$theme = wp_get_theme( $slug ); |
| 19 |
$template = $theme->get( 'Template' ); |
| 20 |
|
| 21 |
$data = [ |
| 22 |
'name' => $theme->get( 'Name' ), |
| 23 |
'description' => $theme->get( 'Description' ), |
| 24 |
'url' => $theme->get( 'ThemeURI' ), |
| 25 |
'author' => $theme->get( 'Author' ), |
| 26 |
'author_url' => $theme->get( 'AuthorURI' ), |
| 27 |
'slug' => $theme->get_stylesheet(), |
| 28 |
'parent' => $template ? $this->get_theme_data( $template ) : null |
| 29 |
]; |
| 30 |
|
| 31 |
return $data; |
| 32 |
} |
| 33 |
} |
| 34 |
|