| 1 |
<?php |
| 2 |
|
| 3 |
namespace YayMail\Integrations\AdminAndSiteEnhancements; |
| 4 |
|
| 5 |
use YayMail\Utils\SingletonTrait; |
| 6 |
|
| 7 |
/** |
| 8 |
* Admin and Site Enhancements (ASE) |
| 9 |
* Link: https://wordpress.org/plugins/admin-site-enhancements/ |
| 10 |
* |
| 11 |
* AdminAndSiteEnhancements |
| 12 |
* * @method static AdminAndSiteEnhancements get_instance() |
| 13 |
*/ |
| 14 |
class AdminAndSiteEnhancements { |
| 15 |
use SingletonTrait; |
| 16 |
|
| 17 |
private function __construct() { |
| 18 |
if ( self::is_3rd_party_installed() ) { |
| 19 |
$this->initialize_hooks(); |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
public static function is_3rd_party_installed() { |
| 24 |
return class_exists( 'ASENHA\Classes\Activation' ); |
| 25 |
} |
| 26 |
|
| 27 |
private function initialize_hooks() { |
| 28 |
add_action( 'admin_head', [ $this, 'yaymail_custom_wp_content_width' ], 99 ); |
| 29 |
} |
| 30 |
|
| 31 |
public function yaymail_custom_wp_content_width() { |
| 32 |
$current_screen = get_current_screen(); |
| 33 |
$ase_options = get_option( ASENHA_SLUG_U, [] ); |
| 34 |
|
| 35 |
if ( $current_screen->id !== 'yaycommerce_page_yaymail-settings' || ! isset( $ase_options['wider_admin_menu'] ) || ! $ase_options['wider_admin_menu'] ) { |
| 36 |
return; |
| 37 |
} |
| 38 |
|
| 39 |
$admin_menu_width = $ase_options['admin_menu_width'] ?? '160px'; |
| 40 |
|
| 41 |
?> |
| 42 |
<style> |
| 43 |
#wpcontent { |
| 44 |
margin-left: <?php echo esc_attr( $admin_menu_width ); ?> !important; |
| 45 |
} |
| 46 |
|
| 47 |
.yaymail-header__navbar, .yaymail-footer{ |
| 48 |
width: calc(100% - <?php echo esc_attr( $admin_menu_width ); ?>) !important; |
| 49 |
} |
| 50 |
</style> |
| 51 |
<?php |
| 52 |
} |
| 53 |
} |
| 54 |
|