Jobs
10 months ago
Options
9 months ago
Views
1 year ago
Ajax.php
1 year ago
Assets.php
2 months ago
Hooks.php
9 months ago
Menu.php
1 year ago
PluginSettings.php
9 months ago
Proxy.php
11 months ago
Redirects.php
1 year ago
Hooks.php
61 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Hostinger\Admin; |
| 4 | |
| 5 | use Hostinger\Helper; |
| 6 | use Hostinger\WpHelper\Utils; |
| 7 | |
| 8 | defined( 'ABSPATH' ) || exit; |
| 9 | |
| 10 | class Hooks { |
| 11 | /** |
| 12 | * @var Helper |
| 13 | */ |
| 14 | private Helper $helper; |
| 15 | |
| 16 | /** |
| 17 | * @var Utils |
| 18 | */ |
| 19 | private Utils $utils; |
| 20 | |
| 21 | public function __construct( $utils ) { |
| 22 | $this->helper = new Helper(); |
| 23 | $this->utils = $utils ?? new Utils(); |
| 24 | add_action( 'admin_footer', array( $this, 'rate_plugin' ) ); |
| 25 | add_filter( 'wp_kses_allowed_html', array( $this, 'custom_kses_allowed_html' ), 10, 1 ); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * @return void |
| 30 | */ |
| 31 | public function rate_plugin(): void { |
| 32 | $admin_path = parse_url( admin_url(), PHP_URL_PATH ); |
| 33 | |
| 34 | if ( ! $this->utils->isThisPage( $admin_path . 'admin.php?page=' . Menu::MENU_SLUG ) ) { |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | require_once HOSTINGER_ABSPATH . 'includes/Admin/Views/Partials/RateUs.php'; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | |
| 43 | public function custom_kses_allowed_html( $allowed ) { |
| 44 | $allowed['svg'] = array( |
| 45 | 'xmlns' => true, |
| 46 | 'width' => true, |
| 47 | 'height' => true, |
| 48 | 'viewBox' => true, |
| 49 | 'fill' => true, |
| 50 | 'style' => true, |
| 51 | 'class' => true, |
| 52 | ); |
| 53 | $allowed['path'] = array( |
| 54 | 'd' => true, |
| 55 | 'fill' => true, |
| 56 | ); |
| 57 | |
| 58 | return $allowed; |
| 59 | } |
| 60 | } |
| 61 |