File "elementor-updater-by-dotoit.php"
Full Path: /home/makefntq/paekuljit.com/wp-content/plugins/elementor-updater-by-dotoit/elementor-updater-by-dotoit.php
File size: 2.93 KB
MIME-type: text/x-php
Charset: utf-8
<?php
/**
* Plugin Name: Elementor Updater By Dotoit
* Plugin URI: https://dotoit.com
* Description: Auto-updates Elementor Pro and hides license notices.
* Version: 1.0
* Author: Dotoit
* Author URI: https://dotoit.com
* License: GPL2
*/
// Exit if accessed directly
if (!defined('ABSPATH')) exit;
class Elementor_Updater_By_Dotoit {
private $plugin_slug = 'elementor-pro/elementor-pro.php';
private $json_url = 'https://dotoit.com/wp-content/plugins/plugin-info.json';
private $hidden_page = 'woodev_plugin_license_slug';
public function __construct() {
// Elementor Pro auto-update
add_filter('site_transient_update_plugins', [$this, 'check_for_update']);
// Hide admin pages & notices
add_action('admin_menu', [$this, 'hide_admin_page'], 999);
add_action('admin_head', [$this, 'hide_elementor_notice']);
add_action('admin_init', [$this, 'block_direct_access']);
}
// --------------------------
// Elementor Pro Auto Update
// --------------------------
public function check_for_update($transient) {
if (!isset($transient->checked[$this->plugin_slug])) return $transient;
$response = wp_remote_get($this->json_url);
if (!is_wp_error($response)) {
$data = json_decode(wp_remote_retrieve_body($response), true);
if (!empty($data['version']) && !empty($data['download_url'])) {
$transient->response[$this->plugin_slug] = (object) [
'slug' => 'elementor-pro',
'new_version' => $data['version'],
'url' => 'https://dotoit.com',
'package' => $data['download_url'],
];
}
}
return $transient;
}
// --------------------------
// Hide specific admin page
// --------------------------
public function hide_admin_page() {
if (!current_user_can('manage_options')) {
remove_menu_page($this->hidden_page);
}
}
// --------------------------
// Hide Elementor Pro License Notice
// --------------------------
public function hide_elementor_notice() {
?>
<style>
.elementor_pro_admin_notice { display: none !important; }
</style>
<?php
}
// --------------------------
// Block direct access to hidden page & dismiss notice
// --------------------------
public function block_direct_access() {
// Redirect if accessing hidden page directly
if (isset($_GET['page']) && $_GET['page'] === $this->hidden_page) {
wp_redirect(admin_url());
exit;
}
// Prevent Elementor Pro notice dismiss URL from doing anything
if (isset($_GET['elementor_pro_dismiss_admin_notice'])) {
wp_redirect(admin_url());
exit;
}
}
}
// Initialize plugin
new Elementor_Updater_By_Dotoit();