| 1 |
<?php |
| 2 |
|
| 3 |
namespace LIBRARY; |
| 4 |
|
| 5 |
class ViewHelpers { |
| 6 |
|
| 7 |
public static function plugin_header_output() { |
| 8 |
ob_start(); ?> |
| 9 |
<nav class="borderless-library__header navbar py-3 sticky-top"> |
| 10 |
<div class="container-fluid"> |
| 11 |
<a class="navbar-brand" href="#"> |
| 12 |
<img src=<?php echo BORDERLESS__ASSETS . "img/borderless.svg" ?> alt="Logo"> |
| 13 |
</a> |
| 14 |
</div> |
| 15 |
</nav> |
| 16 |
<?php $plugin_title = ob_get_clean(); |
| 17 |
|
| 18 |
return Helpers::apply_filters( 'library/plugin_page_title', $plugin_title ); |
| 19 |
} |
| 20 |
|
| 21 |
public static function small_theme_card( $selected = null ) { |
| 22 |
$theme = wp_get_theme(); |
| 23 |
$screenshot = $theme->get_screenshot(); |
| 24 |
$name = $theme->name; |
| 25 |
|
| 26 |
if ( isset( $selected ) ) { |
| 27 |
$library = BorderlessLibraryImporter::get_instance(); |
| 28 |
$selected_data = $library->import_files[ $selected ]; |
| 29 |
$name = ! empty( $selected_data['import_file_name'] ) ? $selected_data['import_file_name'] : $name; |
| 30 |
$screenshot = ! empty( $selected_data['import_preview_image_url'] ) ? $selected_data['import_preview_image_url'] : $screenshot; |
| 31 |
} |
| 32 |
|
| 33 |
ob_start(); ?> |
| 34 |
<div class="library__card library__card--theme"> |
| 35 |
<div class="library__card-content"> |
| 36 |
<?php if ( $screenshot ) : ?> |
| 37 |
<div class="screenshot"><img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Theme screenshot', 'borderless' ); ?>" /></div> |
| 38 |
<?php else : ?> |
| 39 |
<div class="screenshot blank"></div> |
| 40 |
<?php endif; ?> |
| 41 |
</div> |
| 42 |
<div class="library__card-footer"> |
| 43 |
<h3><?php echo esc_html( $name ); ?></h3> |
| 44 |
</div> |
| 45 |
</div> |
| 46 |
<?php |
| 47 |
return ob_get_clean(); |
| 48 |
} |
| 49 |
} |
| 50 |
|