From bbf6f92408d9737beb4465415a18d7c1a12d7c08 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Fri, 22 Mar 2024 21:29:38 +0800 Subject: [PATCH] updated integrator --- composer.json | 2 +- composer.lock | 14 ++++---- memberdash-cryptopay-gateway.php | 16 ++------- vendor/autoload.php | 2 +- .../cryptopay-integrator/composer.json | 2 +- .../cryptopay-integrator/phpcs.xml | 4 +++ .../cryptopay-integrator/src/Helpers.php | 35 +++++++++++++++++++ .../cryptopay-integrator/src/Session.php | 4 ++- .../cryptopay-integrator/views/message-1.php | 19 ++++++++++ .../cryptopay-integrator/views/message-2.php | 16 +++++++++ .../cryptopay-integrator/views/pay.php | 23 ++++++++++++ vendor/composer/autoload_real.php | 8 ++--- vendor/composer/autoload_static.php | 8 ++--- vendor/composer/installed.json | 14 ++++---- vendor/composer/installed.php | 10 +++--- .../MS_Gateway_CryptoPay_Lite_View_Button.php | 3 +- views/MS_Gateway_CryptoPay_View_Button.php | 3 +- 17 files changed, 134 insertions(+), 49 deletions(-) create mode 100644 vendor/beycanpress/cryptopay-integrator/views/message-1.php create mode 100644 vendor/beycanpress/cryptopay-integrator/views/message-2.php diff --git a/composer.json b/composer.json index 887f041..b3a9aa3 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,6 @@ } }, "require": { - "beycanpress/cryptopay-integrator": "^0.1.8" + "beycanpress/cryptopay-integrator": "^0.1.10" } } diff --git a/composer.lock b/composer.lock index 6965f1c..9a21c57 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0b588e2e3118b6a111006bb6d905d6b6", + "content-hash": "d790c17a0fbe6d9c27793420cf646a1f", "packages": [ { "name": "beycanpress/cryptopay-integrator", - "version": "0.1.8", + "version": "0.1.10", "source": { "type": "git", "url": "https://github.com/BeycanPress/cryptopay-integrator.git", - "reference": "c28bbee3ca84fd1e4ca02f4867f6dadbee0c117d" + "reference": "6ac799ad5b3c9b952ee77d4d974162f525ff0f2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/c28bbee3ca84fd1e4ca02f4867f6dadbee0c117d", - "reference": "c28bbee3ca84fd1e4ca02f4867f6dadbee0c117d", + "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/6ac799ad5b3c9b952ee77d4d974162f525ff0f2a", + "reference": "6ac799ad5b3c9b952ee77d4d974162f525ff0f2a", "shasum": "" }, "require": { @@ -37,9 +37,9 @@ "homepage": "https://github.com/BeycanPress/cryptopay-integrator", "support": { "issues": "https://github.com/BeycanPress/cryptopay-integrator/issues", - "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.8" + "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.10" }, - "time": "2024-03-11T06:09:27+00:00" + "time": "2024-03-22T11:55:55+00:00" } ], "packages-dev": [], diff --git a/memberdash-cryptopay-gateway.php b/memberdash-cryptopay-gateway.php index 6eb001c..3326485 100644 --- a/memberdash-cryptopay-gateway.php +++ b/memberdash-cryptopay-gateway.php @@ -53,25 +53,13 @@ function memberdash_cryptopay_addModels(): void load_plugin_textdomain('md-cryptopay', false, basename(__DIR__) . '/languages'); if (!defined('MEMBERDASH_VERSION')) { - add_action('admin_notices', function (): void { - ?> -
-

' . esc_html__('clicking here', 'md-cryptopay') . ''); ?>

-
- -
-

' . esc_html__('clicking here', 'md-cryptopay') . ''); ?>

-
- + + + 0 + diff --git a/vendor/beycanpress/cryptopay-integrator/src/Helpers.php b/vendor/beycanpress/cryptopay-integrator/src/Helpers.php index cc937c3..3d6c7e3 100644 --- a/vendor/beycanpress/cryptopay-integrator/src/Helpers.php +++ b/vendor/beycanpress/cryptopay-integrator/src/Helpers.php @@ -143,6 +143,30 @@ public static function response(string $method, ...$args): mixed } } + /** + * @param string $currentPlugin + * @param string $pluginLink + * @param bool $download + * @return void + */ + public static function requirePluginMessage(string $currentPlugin, string $pluginLink, bool $download = true): void + { + add_action('admin_notices', function () use ($currentPlugin, $pluginLink, $download): void { + require dirname(__DIR__) . '/views/message-1.php'; + }); + } + + /** + * @param string $currentPlugin + * @return void + */ + public static function requireCryptoPayMessage(string $currentPlugin): void + { + add_action('admin_notices', function () use ($currentPlugin): void { + require dirname(__DIR__) . '/views/message-2.php'; + }); + } + /** * @param array $data * @return string @@ -181,6 +205,17 @@ public static function createSPP(array $data): string return home_url("/?cp_spp={$token}"); } + /** + * @param string $url + * @return string|null + */ + public static function getSPPToken(string $url): ?string + { + /** @var array $matches */ + preg_match('/[?&]cp_spp=([^&]+)/', $url, $matches); + return isset($matches[1]) ? $matches[1] : null; + } + /** * @return void */ diff --git a/vendor/beycanpress/cryptopay-integrator/src/Session.php b/vendor/beycanpress/cryptopay-integrator/src/Session.php index b2f3db3..78e7802 100644 --- a/vendor/beycanpress/cryptopay-integrator/src/Session.php +++ b/vendor/beycanpress/cryptopay-integrator/src/Session.php @@ -59,7 +59,9 @@ public static function has(string $key): bool public static function remove(string $key): void { self::start(); - unset($_SESSION['cp_integrator'][$key]); + if (self::has($key)) { + unset($_SESSION['cp_integrator'][$key]); + } } /** diff --git a/vendor/beycanpress/cryptopay-integrator/views/message-1.php b/vendor/beycanpress/cryptopay-integrator/views/message-1.php new file mode 100644 index 0000000..9600d46 --- /dev/null +++ b/vendor/beycanpress/cryptopay-integrator/views/message-1.php @@ -0,0 +1,19 @@ +
+

+ ' . esc_html__('clicking here', 'cryptopay') . '', + $pluginLink + ) + ) + ), + ['a' => ['href' => [], 'target' => []]] + ); ?> +

+
\ No newline at end of file diff --git a/vendor/beycanpress/cryptopay-integrator/views/message-2.php b/vendor/beycanpress/cryptopay-integrator/views/message-2.php new file mode 100644 index 0000000..7f86956 --- /dev/null +++ b/vendor/beycanpress/cryptopay-integrator/views/message-2.php @@ -0,0 +1,16 @@ + +
+

+ ' . esc_html__('clicking here', 'cryptopay') . '', + esc_html($currentPlugin) + ) + ), + ['a' => ['href' => [], 'target' => []]] + ); ?> +

+
\ No newline at end of file diff --git a/vendor/beycanpress/cryptopay-integrator/views/pay.php b/vendor/beycanpress/cryptopay-integrator/views/pay.php index c29c948..ed6d5e8 100644 --- a/vendor/beycanpress/cryptopay-integrator/views/pay.php +++ b/vendor/beycanpress/cryptopay-integrator/views/pay.php @@ -49,7 +49,26 @@ border-radius: 5px; } + .go-to-back { + text-align: center; + margin: 20px 0; + } + + .go-to-back a { + display: inline-block; + padding: 10px 20px; + background-color: #007bff; + color: #fff; + text-decoration: none; + border-radius: 5px; + } + @media screen and (max-width: 768px) { + body { + padding: 0 20px; + text-align: center; + } + .container { flex-direction: column; } @@ -59,6 +78,7 @@ margin-right: 0; margin-bottom: 20px; max-width: 100%; + width: 100%; } } @@ -84,6 +104,9 @@ +
+ "> +
\ No newline at end of file diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 2ff5b69..fde1850 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit6be0de7c2c544c6b51cbdeae0bbe23be +class ComposerAutoloaderInitd790c17a0fbe6d9c27793420cf646a1fx { private static $loader; @@ -24,12 +24,12 @@ public static function getLoader() require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInit6be0de7c2c544c6b51cbdeae0bbe23be', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitd790c17a0fbe6d9c27793420cf646a1fx', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); - spl_autoload_unregister(array('ComposerAutoloaderInit6be0de7c2c544c6b51cbdeae0bbe23be', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitd790c17a0fbe6d9c27793420cf646a1fx', 'loadClassLoader')); require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit6be0de7c2c544c6b51cbdeae0bbe23be::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitd790c17a0fbe6d9c27793420cf646a1fx::getInitializer($loader)); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index b5a5192..c9bcf18 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit6be0de7c2c544c6b51cbdeae0bbe23be +class ComposerStaticInitd790c17a0fbe6d9c27793420cf646a1fx { public static $prefixLengthsPsr4 = array ( 'B' => @@ -32,9 +32,9 @@ class ComposerStaticInit6be0de7c2c544c6b51cbdeae0bbe23be public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit6be0de7c2c544c6b51cbdeae0bbe23be::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit6be0de7c2c544c6b51cbdeae0bbe23be::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit6be0de7c2c544c6b51cbdeae0bbe23be::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitd790c17a0fbe6d9c27793420cf646a1fx::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitd790c17a0fbe6d9c27793420cf646a1fx::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitd790c17a0fbe6d9c27793420cf646a1fx::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 97e828c..b0f000d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,23 +2,23 @@ "packages": [ { "name": "beycanpress/cryptopay-integrator", - "version": "0.1.8", - "version_normalized": "0.1.8.0", + "version": "0.1.10", + "version_normalized": "0.1.10.0", "source": { "type": "git", "url": "https://github.com/BeycanPress/cryptopay-integrator.git", - "reference": "c28bbee3ca84fd1e4ca02f4867f6dadbee0c117d" + "reference": "6ac799ad5b3c9b952ee77d4d974162f525ff0f2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/c28bbee3ca84fd1e4ca02f4867f6dadbee0c117d", - "reference": "c28bbee3ca84fd1e4ca02f4867f6dadbee0c117d", + "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/6ac799ad5b3c9b952ee77d4d974162f525ff0f2a", + "reference": "6ac799ad5b3c9b952ee77d4d974162f525ff0f2a", "shasum": "" }, "require": { "php": ">=8.1" }, - "time": "2024-03-11T06:09:27+00:00", + "time": "2024-03-22T11:55:55+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -34,7 +34,7 @@ "homepage": "https://github.com/BeycanPress/cryptopay-integrator", "support": { "issues": "https://github.com/BeycanPress/cryptopay-integrator/issues", - "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.8" + "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.10" }, "install-path": "../beycanpress/cryptopay-integrator" } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 0d137c5..e5ef95b 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '0ac3bdb97647841a668e920f7b26eefa36035ea7', + 'reference' => '61310372788f82907506971c2ae580bfc7ec2cb7', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,16 +13,16 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '0ac3bdb97647841a668e920f7b26eefa36035ea7', + 'reference' => '61310372788f82907506971c2ae580bfc7ec2cb7', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'beycanpress/cryptopay-integrator' => array( - 'pretty_version' => '0.1.8', - 'version' => '0.1.8.0', - 'reference' => 'c28bbee3ca84fd1e4ca02f4867f6dadbee0c117d', + 'pretty_version' => '0.1.10', + 'version' => '0.1.10.0', + 'reference' => '6ac799ad5b3c9b952ee77d4d974162f525ff0f2a', 'type' => 'library', 'install_path' => __DIR__ . '/../beycanpress/cryptopay-integrator', 'aliases' => array(), diff --git a/views/MS_Gateway_CryptoPay_Lite_View_Button.php b/views/MS_Gateway_CryptoPay_Lite_View_Button.php index be617df..7f96061 100644 --- a/views/MS_Gateway_CryptoPay_Lite_View_Button.php +++ b/views/MS_Gateway_CryptoPay_Lite_View_Button.php @@ -104,8 +104,7 @@ public function to_html(): string ?> - + - +