goto aJKI3; PtBuK: function check_license_before_update() { $license_status = get_option("license_status", "unknown"); if ($license_status !== "aktif") { remove_action("after_setup_theme", "initiate_theme_update_checker"); add_filter("site_transient_update_themes", "disable_theme_updates"); } } goto JN7Eh; dOplF: add_action("admin_head", "add_theme_update_notification"); goto qxlL8; QecCX: function theme_update_page_content() { $update_info = get_theme_update_info(); $current_version = wp_get_theme()->get("Version");
<div class="wrap">
<h1>Pembaruan WPNews</h1>
if (!is_license_valid()) {
<div class="notice notice-warning">
<p><strong>Lisensi Tidak Valid</strong></p>
<p>Lisensi Anda tidak valid atau telah kedaluwarsa. Pembaruan tidak tersedia hingga lisensi Anda diperbarui.
Harap periksa pengaturan lisensi Anda melalui <a href="echo esc_url(admin_url("admin.php?page=license-settings"));
">Pengaturan Lisensi</a>.</p>
</div>
} else {
if ($update_info && is_array($update_info)) {
$latest_version = $update_info[0]["version"] ?? null; if ($latest_version && version_compare($current_version, $latest_version, "<")) {
<div class="notice notice-info">
<p><strong><span class="dashicons dashicons-update"></span> Pembaruan Tersedia</strong></p>
<p>Anda menggunakan WPNews versi <strong>echo esc_html($current_version);
</strong>.
Versi terbaru yang tersedia adalah <strong>echo esc_html($latest_version);
</strong>.</p>
<p><strong>Instruksi Pembaruan:</strong></p>
<ol>
<li>Masuk ke <strong>Dashboard > Updates</strong>.</li>
<li>Periksa daftar tema yang tersedia untuk pembaruan.</li>
<li>Klik <strong>Update</strong> pada WPNews untuk memulai proses pembaruan.</li>
</ol>
<p>Pastikan koneksi internet Anda stabil selama proses pembaruan.</p>
</div>
} else {
<div class="notice notice-success">
<p><strong><span class="dashicons dashicons-yes-alt"></span> WPNews Sudah Terbaru</strong></p>
<p>Anda menggunakan versi terbaru dari tema WPNews, yaitu <strong>echo esc_html($current_version);
</strong>.</p>
</div>
}
} else {
<div class="notice notice-error">
<p><strong><span class="dashicons dashicons-warning"></span> Kesalahan Pengambilan Informasi</strong></p>
<p>Gagal mendapatkan informasi pembaruan. Pastikan server tema tersedia dan koneksi Anda aktif.</p>
</div>
}
}
</div>
<div class="wrap">
<h1>Riwayat Pembaruan</h1>
if ($update_info && is_array($update_info)) {
foreach ($update_info as $update) {
<p><strong>VERSION echo esc_html($update["version"]);
(echo esc_html(date("Y-m-d", strtotime($update["release_date"])));
)</strong></p>
<ul>
$descriptions = explode("
", $update["description"]); $i = 1; foreach ($descriptions as $description) {
if (!empty($description)) {
<li>echo esc_html($i . . $description);
</li>
$i++;
}
}
</ul>
}
}
</div>
} goto G8ZNf; EznIn: function clear_license_check_schedule() { $timestamp = wp_next_scheduled("check_license_and_updates_event"); if ($timestamp) { wp_unschedule_event($timestamp, "check_license_and_updates_event"); } } goto jok9c; G8ZNf: function add_theme_update_notification() { $update_info = get_theme_update_info(); $current_version = wp_get_theme()->get("Version"); if ($update_info && is_array($update_info)) { $latest_version = $update_info[0]["version"] ?? null; if ($latest_version && version_compare($current_version, $latest_version, "<")) { echo "<script>\xa document.addEventListener("DOMContentLoaded", function() {\xa var menu = document.querySelector("#toplevel_page_theme-update .wp-menu-name");\xa if (menu && "" . esc_js($latest_version) . "" !== "") {\xa menu.setAttribute("data-version", "" . esc_js($latest_version) . "");
}\xa });\xa </script>"; } else { echo "<script>
document.addEventListener("DOMContentLoaded", function() {\xa var menu = document.querySelector("#toplevel_page_theme-update .wp-menu-name");
if (menu) {\xa menu.removeAttribute("data-version");\xa }
});\xa </script>"; } } } goto dOplF; qxlL8: function disable_theme_updates($transient) { if (isset($transient->response["wpnews"])) { unset($transient->response["wpnews"]); } return $transient; } goto PtBuK; qon_N: function get_theme_update_info() { $update_info_url = "https://wpnews.kreatornusa.com/api/release.json"; $response = wp_remote_get($update_info_url); if (is_wp_error($response)) { return false; } $body = wp_remote_retrieve_body($response); $update_info = json_decode($body, true); if (json_last_error() === JSON_ERROR_NONE && is_array($update_info)) { return $update_info; } return false; } goto QecCX; ruSuv: function check_license_and_updates() { if (is_license_valid()) { $update_info = get_theme_update_info(); if ($update_info) { update_option("last_update_check", time()); } } } goto yLoWn; eLcZ8: function is_license_valid() { $license_status = get_option("license_status", "unknown"); return $license_status === "aktif"; } goto qon_N; I0O8L: add_action("check_license_and_updates_event", "check_license_and_updates"); goto EznIn; i11dm: function update_check_theme() { } goto ruSuv; Csp8I: add_action("wp", "schedule_license_check"); goto I0O8L; JN7Eh: add_action("after_setup_theme", "check_license_before_update", 1); goto BVmIm; yLoWn: function schedule_license_check() { if (!wp_next_scheduled("check_license_and_updates_event")) { wp_schedule_event(time(), "hourly", "check_license_and_updates_event"); } } goto Csp8I; vJci5: function add_theme_update_page() { add_menu_page("Updates", "Changelog", "manage_options", "theme-update", "theme_update_page_content", "dashicons-update", 100); } goto pP0pV; aJKI3: $example_update_checker = new ThemeUpdateChecker("wpnews", "https://wpnews.kreatornusa.com/api/release.json"); goto vJci5; pP0pV: add_action("admin_menu", "add_theme_update_page"); goto eLcZ8; BVmIm: function initiate_theme_update_checker() { require get_template_directory() . "/update/theme-update-checker.php"; $update_checker = new ThemeUpdateChecker("wpnews", "https://wpnews.kreatornusa.com/api/release.json"); } goto i11dm; jok9c: add_action("switch_theme", "clear_license_check_schedule");
© 2023 Quttera Ltd. All rights reserved.