PluginProbe
Hostinger Tools / 3.0.21
Hostinger Tools v3.0.21
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / includes / Admin / Hooks.php

Hooks.php in Hostinger Tools 3.0.21, at includes/Admin/Hooks.php

80 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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_action( 'admin_init', array( $this, 'message_about_plugin_split' ) );
26 add_filter( 'wp_kses_allowed_html', array( $this, 'custom_kses_allowed_html' ), 10, 1 );
27 }
28
29 /**
30 * @return void
31 */
32 public function rate_plugin(): void {
33 if ( ! $this->utils->isThisPage( 'wp-admin/admin.php?page=' . Menu::MENU_SLUG ) ) {
34 return;
35 }
36
37 require_once HOSTINGER_ABSPATH . 'includes/Admin/Views/Partials/RateUs.php';
38 }
39
40 public function message_about_plugin_split(): void {
41 if ( $this->helper->should_plugin_split_notice_shown() ) {
42 add_action( 'admin_notices', array( $this, 'custom_admin_notice' ) );
43 }
44 }
45
46 public function custom_admin_notice() {
47 ?>
48 <div id="hostinger-plugin-split-notice" class="hts-plugin-split notice is-dismissible">
49 <h2><?php echo esc_html__( 'Hostinger plugin updates', 'hostinger' ); ?></h2>
50 <p><?php echo esc_html__( 'The Hostinger plugin has been split into two different plugins:', 'hostinger' ); ?></p>
51 <ul>
52 <li><strong><?php echo esc_html__( 'Hostinger Tools', 'hostinger' ); ?></strong> <?php echo esc_html__( 'offers a toolkit for easier site maintenance.', 'hostinger' ); ?></li>
53 <li><strong><?php echo esc_html__( 'Hostinger Easy Onboarding', 'hostinger' ); ?></strong> <?php echo esc_html__( 'provides guidance and learning resources for beginners to get started with building a site using WordPress.', 'hostinger' ); ?></li>
54 </ul>
55 <button id="plugin-split-close" type="button" class="plugin-split-close notice-dismiss"><?php echo esc_html__( 'Got it', 'hostinger' ); ?></button>
56 </div>
57 <?php
58 wp_nonce_field( 'hts_close_plugin_split', 'hts_close_plugin_split_nonce', true );
59 }
60
61 public function custom_kses_allowed_html( $allowed ) {
62 // Add SVG elements and attributes to the allowed list
63 $allowed['svg'] = array(
64 'xmlns' => true,
65 'width' => true,
66 'height' => true,
67 'viewBox' => true,
68 'fill' => true,
69 'style' => true,
70 'class' => true,
71 );
72 $allowed['path'] = array(
73 'd' => true,
74 'fill' => true,
75 );
76
77 return $allowed;
78 }
79 }
80