"https://www.1qlick.com", "testing" => "https://testing.1qlick.com", ]; /** @var bool */ private $assetsAdded; public function __construct() { $this->assetsAdded = false; } public static function hook() { $button = new self(); foreach ( WC_Admin_Settings::get_option("1qlick_button_location", []) as $location ) { add_action($location, [$button, "getOneQlickButton"]); } } public function getOneQlickButton() { $qr = WC_Admin_Settings::get_option("1qlick_qrcode", "no") === "yes" ? "qr" : ""; if (!$this->assetsAdded) { $this->assetsAdded = true; wp_register_script( "what_is_1qlick_js", plugins_url("whatis.js", __FILE__), [], true, true ); wp_enqueue_script("what_is_1qlick_js"); wp_register_script( "1qlick_qr_js_dependency", "https://www.easyproject.cn/easyqrcodejs/easy.qrcode.min.js?v=4", [], true, true ); wp_enqueue_script("1qlick_qr_js_dependency"); wp_register_script( "1qlick_qr_js", plugins_url("qrcode.js", __FILE__), [], true, true ); wp_enqueue_script("1qlick_qr_js"); wp_enqueue_style( "what_is_1qlick_css", plugins_url("whatis.css", __FILE__), [], true ); WC()->session->set("1qlick_order", null); WC()->session->set("1qlick_status", null); } echo "" . # DEVONLY START QR Code and Status "
" . "" . "
" . esc_html__("Scan QR code for ", "1qlick") . "
" . esc_html__("1Qlick Mobile Checkout", "1qlick") . "
" . "
" . "
" . esc_html__("1Qlick in progress", "1qlick") . "
" . "
" . "
" . esc_html__("Payment in progress", "1qlick") . "
" . "
" . "
" . # DEVONLY END QR Code and Status # DEVONLY START Checkout Button "" . str_replace( "%icon", "", esc_html__("Checkout with %icon", "1qlick") ) . "" . # DEVONLY END Checkout Button # DEVONLY START Explanation "
" . "" . esc_html__("What is 1Qlick?", "1qlick") . "" . "
" . "
" . "
" . "" . esc_html__("What is 1Qlick?", "1qlick") . "" . "" . esc_html__("Enter details automatically,", "1qlick") . "
" . esc_html__("wherever you shop", "1qlick") . "
" . "" . "
" . "
" . # DEVONLY END Explanation ""; } }