-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
296 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,6 @@ | |
} | ||
}, | ||
"require": { | ||
"beycanpress/cryptopay-integrator": "^0.1.3" | ||
"beycanpress/cryptopay-integrator": "^0.1.5" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BeycanPress\CryptoPay\Integrator; | ||
|
||
class Session | ||
{ | ||
/** | ||
* @return void | ||
*/ | ||
public static function start(): void | ||
{ | ||
if (PHP_SESSION_NONE === session_status()) { | ||
session_start(); | ||
} | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param mixed $value | ||
* @return void | ||
*/ | ||
public static function set(string $key, mixed $value): void | ||
{ | ||
self::start(); | ||
if (!isset($_SESSION['cp_integrator'])) { | ||
$_SESSION['cp_integrator'] = []; | ||
} | ||
$_SESSION['cp_integrator'][$key] = $value; | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @param mixed $default | ||
* @return mixed | ||
*/ | ||
public static function get(string $key, mixed $default = null): mixed | ||
{ | ||
self::start(); | ||
return $_SESSION['cp_integrator'][$key] ?? $default; | ||
} | ||
|
||
/** | ||
* @param string $key | ||
* @return bool | ||
*/ | ||
public static function has(string $key): bool | ||
{ | ||
self::start(); | ||
return isset($_SESSION['cp_integrator'][$key]); | ||
} | ||
|
||
|
||
/** | ||
* @param string $key | ||
* @return void | ||
*/ | ||
public static function remove(string $key): void | ||
{ | ||
self::start(); | ||
unset($_SESSION['cp_integrator'][$key]); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public static function clear(): void | ||
{ | ||
self::start(); | ||
session_unset(); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public static function destroy(): void | ||
{ | ||
self::start(); | ||
session_destroy(); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public static function regenerate(): void | ||
{ | ||
self::start(); | ||
session_regenerate_id(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BeycanPress\CryptoPay\Integrator; | ||
|
||
enum Type | ||
{ | ||
case PRO; | ||
case LITE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title><?php echo esc_html__('CryptoPay Single Page Payment') ?></title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
background-color: #f0f0f0; | ||
color: #333; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-around; | ||
align-items: flex-start; | ||
padding: 20px; | ||
background-color: #fff; | ||
border-radius: 10px; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
margin: 20px auto; | ||
max-width: 800px; | ||
} | ||
|
||
.payment-info { | ||
flex: 1; | ||
max-width: 400px; | ||
margin-right: 20px; | ||
} | ||
|
||
.payment-info h2 { | ||
margin-top: 0; | ||
} | ||
|
||
.payment-form { | ||
flex: 1; | ||
max-width: 400px; | ||
} | ||
|
||
.payment-info img { | ||
max-width: 100%; | ||
height: auto; | ||
border-radius: 5px; | ||
} | ||
|
||
@media screen and (max-width: 768px) { | ||
.container { | ||
flex-direction: column; | ||
} | ||
|
||
.payment-info, | ||
.payment-form { | ||
margin-right: 0; | ||
margin-bottom: 20px; | ||
max-width: 100%; | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="payment-info"> | ||
<h2><?php echo esc_html__('Payment Information') ?></h2> | ||
<?php if (isset($order['id'])): ?> | ||
<p><strong><?php echo esc_html__('Order ID') ?>:</strong> <?php echo esc_html($order['id']) ?></p> | ||
<?php endif; ?> | ||
<?php if (isset($order['amount'])): ?> | ||
<p><strong><?php echo esc_html__('Amount') ?>:</strong> <?php echo esc_html($order['amount']) ?> <?php echo esc_html($order['currency']) ?></p> | ||
<?php endif; ?> | ||
<?php if (isset($addon)): ?> | ||
<p><strong><?php echo esc_html__('Addon') ?>:</strong> <?php echo esc_html($addon) ?></p> | ||
<?php endif; ?> | ||
<p> | ||
<?php echo esc_html__('This page is the single payment page, after you make your payment on this page you will be returned to the addon\'s page that redirected you to this page.') ?> | ||
</p> | ||
</div> | ||
<div class="payment-form"> | ||
<?php echo $cryptopay; ?> | ||
</div> | ||
</div> | ||
<?php do_action('wp_print_footer_scripts'); ?> | ||
</body> | ||
</html> |
Oops, something went wrong.