/*
* @version $Id: Pont V8.1 2022-05-18 szathmari.hu $
* @copyright Copyright (C) 2022 szathmari.hu - All rights reserved.
* @license commerical
* @url https://szathmari.hu
*/
class WC_Pont_AutoUpdate { public static $current_version; public static $update_path; public static $plugin_slug; public static $license_key; public static $host; public static $slug; public function __construct($current_version, $update_path, $plugin_slug, $license_key = '', $host = '') { goto eHMEJ; FQ5BV: list($t1, $t2) = explode("/", $plugin_slug); goto azoGz; azoGz: self::$slug = str_replace(".php", '', $t2); goto R_Bjm; QgpBp: self::$plugin_slug = $plugin_slug; goto FQ5BV; eHMEJ: add_filter("upgrader_pre_download", array($this, "upgrader_pre_download"), 10, 3); goto RqQ8J; R_Bjm: add_filter("pre_set_site_transient_update_plugins", array($this, "check_update")); goto LSQcf; IKsax: self::$host = $_SERVER["HTTP_HOST"]; goto N_JJT; N_JJT: self::$license_key = $license_key; goto QgpBp; LSQcf: add_filter("plugins_api", array($this, "check_info"), 10, 3); goto m2amH; RqQ8J: self::$current_version = $current_version; goto VI5fa; VI5fa: self::$update_path = $update_path; goto IKsax; m2amH: } public static function check_update($transient) { goto GxEb8; MznTg: WB7zv: goto GX0db; eJFj7: $obj->icons = $remote_version->icons; goto ni13N; nRPfN: $obj->homepage = $remote_version->homepage; goto I8IW7; so3iL: if (!version_compare(self::$current_version, $remote_version->new_version, "<")) { goto h5yeu; } goto qKI8Y; OhCLb: $obj->package = $remote_version->package; goto mCtwE; qKI8Y: $obj = new stdClass(); goto xCpRt; Y9237: $obj->upgrade_notice = $remote_version->upgrade_notice; goto OhCLb; XyA29: return $transient; goto MznTg; f3EX3: $obj->new_version = $remote_version->new_version; goto nRPfN; DAQO3: $obj->plugin = self::$plugin_slug; goto Y9237; I8IW7: $obj->url = $remote_version->url; goto DAQO3; GX0db: $remote_version = self::getRemote_version(); goto M4pqu; fkDG8: return $transient; goto mUqKQ; GxEb8: if (!empty($transient->checked)) { goto WB7zv; } goto XyA29; mCtwE: $obj->tested = $remote_version->tested; goto eJFj7; ni13N: $transient->response[self::$plugin_slug] = $obj; goto MoBm9; M4pqu: WC_Pont::log("Update: remote_version: " . json_encode($remote_version), "info"); goto so3iL; MoBm9: h5yeu: goto fkDG8; xCpRt: $obj->slug = self::$slug; goto f3EX3; mUqKQ: } public static function check_info($false, $action, $arg) { goto uqGSL; uqGSL: if (!(isset($arg->slug) && $arg->slug === self::$slug)) { goto WfDQC; } goto oDCD5; oDCD5: $information = self::getRemote_information(); goto XQc0A; yjnEa: return $false; goto IcLYK; XQc0A: return $information; goto GbJD7; GbJD7: WfDQC: goto yjnEa; IcLYK: } public static function getRemote_version() { goto Qoljm; n0rm2: $request = wp_remote_post(self::$update_path, $params); goto iC6y8; BnQRR: ALsqm: goto s5Adv; Qoljm: $params = array("body" => array("action" => "version", "host" => self::$host, "license_key" => self::$license_key)); goto n0rm2; iC6y8: if (!(!is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200)) { goto ALsqm; } goto rcVTz; rcVTz: return unserialize($request["body"]); goto BnQRR; s5Adv: return false; goto x0ikg; x0ikg: } public static function getRemote_information() { goto up1Zh; MyKIm: $request = wp_remote_post(self::$update_path, $params); goto K1thL; JSH6J: return false; goto qLWaR; cU7j_: ID1E8: goto JSH6J; ZA95b: return unserialize($request["body"]); goto cU7j_; up1Zh: $params = array("body" => array("action" => "info", "host" => self::$host, "license_key" => self::$license_key, "version" => self::$current_version)); goto MyKIm; K1thL: if (!(!is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200)) { goto ID1E8; } goto ZA95b; qLWaR: } public static function getRemote_license() { goto Sdl7i; csINe: return unserialize($request["body"]); goto mCNad; Sdl7i: $params = array("body" => array("action" => "license", "host" => self::$host, "license_key" => self::$license_key)); goto lFwEs; gfnvz: if (!(!is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200)) { goto CqCDg; } goto csINe; oVg1n: return false; goto rrHy9; lFwEs: $request = wp_remote_post(self::$update_path, $params); goto gfnvz; mCNad: CqCDg: goto oVg1n; rrHy9: } public function upgrader_pre_download($reply, $package, $upgrader) { goto vj1wr; w4Dr0: tJU1u: goto NF3Si; vj1wr: if (!(isset($upgrader->skin->plugin_info) && $upgrader->skin->plugin_info["Name"] === "Pont shipping for Woocommerce")) { goto tJU1u; } goto Dm3dc; mTfX5: return new WP_Error("fs_unavailable", $upgrader->strings["fs_unavailable"]); goto kN0iE; kN0iE: cUDu0: goto f2d3o; hSMjU: $upgrader->skin->feedback("wc_pont_download_error"); goto rgtYd; hZpmD: $upgrader->skin->feedback("wc_pont_download"); goto wEV7q; NwFlv: remove_filter("http_response", array($this, "alter_update_message"), 10, 3); goto PL0kM; cpHsO: FVMJP: goto DLUQM; PL0kM: if (!is_wp_error($download_file)) { goto Yn5G0; } goto qYPWZ; Dm3dc: $upgrader->strings["wc_pont_download"] = __("Pont szállítási plugin letöltése...", "wc_pont"); goto hZpmD; WZRid: CSpQ7: goto aM0Ix; R5EsI: $download_file = download_url($package); goto NwFlv; By9ny: CXiPx: goto Uhxss; aM0Ix: return new WP_Error("wc_pont_download_error", $error_msg); goto cpHsO; x030G: $error_msg = self::update_error($error_code, __("Hiba történt a Pont szállítási plugin letöltése közben.", "wc_pont")); goto k2sU9; Acgqu: if ($res) { goto cUDu0; } goto mTfX5; T4P6b: ut5rK: goto By9ny; wEV7q: $res = $upgrader->fs_connect(array(WP_CONTENT_DIR)); goto Acgqu; Lvb8f: return $download_file; goto w4Dr0; Aajz7: $upgrader->skin->result = new WP_Error("wc_pont_download_error", $error_msg); goto QjwjC; Uhxss: if (is_a($upgrader->skin, "Bulk_Plugin_Upgrader_Skin")) { goto CSpQ7; } goto VCfhL; VCfhL: $upgrader->strings["wc_pont_error"] = "<div class="error inline"><p><strong>" . $error_msg . "</strong></p></div>"; goto UCY_a; rgtYd: $error_code = $download_file->get_error_message(); goto x030G; QjwjC: return new WP_Error("wc_pont_download_error", ''); goto b4t2o; UCY_a: $upgrader->skin->feedback("wc_pont_error"); goto Aajz7; DLUQM: Yn5G0: goto Lvb8f; qYPWZ: $upgrader->strings["wc_pont_download_error"] = __("A Pont szállítási plugin letöltése meghiúsult. Hibakód: " . $download_file->get_error_message(), "wc_pont"); goto hSMjU; k2sU9: switch ($error_code) { case 500: case 503: $error = __("Sajnos a kiszolgáló nem működik. Próbáld később.", "wc_pont"); goto CXiPx; case 609: $error_msg = $error_msg . " :("; default: goto ZBVzQ; YPOyr: if (!$message) { goto yRmKb; } goto uuDYz; c94BJ: goto CXiPx; goto Wk51L; QoWn1: yRmKb: goto c94BJ; uuDYz: $error .= "<br>" . $message; goto QoWn1; ZBVzQ: $error = __("Ismeretlen hiba lépett fel a Pont szállítási plugin telepítése során!", "wc_pont"); goto YPOyr; Wk51L: } goto T4P6b; f2d3o: add_filter("http_response", array($this, "alter_update_message"), 10, 3); goto R5EsI; NF3Si: return $reply; goto dq197; b4t2o: goto FVMJP; goto WZRid; dq197: } public function alter_update_message($response, $r, $url) { goto RIj14; RIj14: $code = wp_remote_retrieve_response_code($response); goto RaNki; RaNki: $response["response"]["message"] = $code; goto b14XM; b14XM: return $response; goto tsQdB; tsQdB: } public function is_zip($f) { goto DS8sU; nOh0D: $res = $zip->open($f, ZipArchive::CHECKCONS); goto oyLAW; DS8sU: $zip = new ZipArchive(); goto nOh0D; U3UvV: c2tfy: goto Qk21J; oyLAW: switch ($res) { case ZipArchive::ER_NOZIP: return false; case ZipArchive::ER_INCONS: return false; case ZipArchive::ER_CRC: return false; default: return ture; } goto U3UvV; Qk21J: KWAgv: goto b2spy; b2spy: } public static function update_error($error_code, $print = null) { goto khL_O; frgJY: $print = $error_code->get_error_message(); goto Kj9jB; Tucyt: qRz9U: goto T8vBS; r1BGE: return $error_msg; goto XLfsn; GNa8t: wvaxo: goto r1BGE; khL_O: if (!is_wp_error($error_code)) { goto qRz9U; } goto frgJY; EkKTM: Uby9I: goto GNa8t; T8vBS: switch ($error_code) { case 608: $error_msg = sprintf(__("Állítsd be a telepítési kulcsot a %s oldalon.", "wc_pont"), "<a href="" . admin_url("admin.php?page=wc-settings&tab=pont") . "" target="_top">" . __("Pont", "wc_pont") . "</a>"); goto wvaxo; case 609: $error_msg .= " " . sprintf(__("Lejárt a támogatási időszak a %s oldalon. %s", "wc_pont"), $_SERVER["HTTP_HOST"], " <a href="https://szathmari.hu/wordpress/15-pick-pack-pont-posta-pont-gls-csomagpont-woocommerce-szallitasi-modul" target="_blank">" . __("Bővebb információ", "wc_pont") . "</a>"); goto wvaxo; default: $error_msg = $print ? $print : __("Hiba történt!", "wc_pont") . " [" . $error_code . "]"; goto wvaxo; } goto EkKTM; Kj9jB: $error_code = $error_code->get_error_code(); goto Tucyt; XLfsn: } }
© 2023 Quttera Ltd. All rights reserved.