| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JFB_Components\Admin\Print_Page; |
| 5 |
|
| 6 |
use JFB_Components\Admin\Print_Page\Interfaces\Page_Assets_It; |
| 7 |
use JFB_Components\Admin\Print_Page\Interfaces\Page_Output_It; |
| 8 |
use JFB_Components\Admin\Print_Page\Traits\Page_Assets_Trait; |
| 9 |
|
| 10 |
// If this file is called directly, abort. |
| 11 |
if ( ! defined( 'WPINC' ) ) { |
| 12 |
die; |
| 13 |
} |
| 14 |
|
| 15 |
class Header implements Page_Assets_It, Page_Output_It { |
| 16 |
|
| 17 |
use Page_Assets_Trait; |
| 18 |
|
| 19 |
protected $body_classes = 'wp-admin wp-core-ui'; |
| 20 |
protected $title = ''; |
| 21 |
|
| 22 |
public function __construct() { |
| 23 |
if ( is_rtl() ) { |
| 24 |
$this->add_body_classes( 'rtl' ); |
| 25 |
} |
| 26 |
|
| 27 |
if ( wp_is_mobile() ) { |
| 28 |
$this->add_body_classes( 'mobile' ); |
| 29 |
} |
| 30 |
|
| 31 |
$this->set_title( __( 'JFB Preview', 'jet-form-builder' ) ); |
| 32 |
} |
| 33 |
|
| 34 |
public function output() { |
| 35 |
require_once jet_form_builder()->plugin_dir( 'components/admin/print-page/templates/header.php' ); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* @param string $body_classes |
| 40 |
*/ |
| 41 |
public function set_body_classes( string $body_classes ) { |
| 42 |
$this->body_classes = $body_classes; |
| 43 |
} |
| 44 |
|
| 45 |
public function add_body_classes( string $body_classes ) { |
| 46 |
$this->body_classes .= ' ' . trim( $body_classes ); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* @return string |
| 51 |
*/ |
| 52 |
public function get_body_classes(): string { |
| 53 |
return $this->body_classes; |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* @return string |
| 58 |
*/ |
| 59 |
public function get_title(): string { |
| 60 |
return $this->title; |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* @param string $title |
| 65 |
*/ |
| 66 |
public function set_title( string $title ) { |
| 67 |
$this->title = $title; |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
} |
| 72 |
|