15
15
* @example https://gourl.io/lib/examples/example_customize_box.php <----
16
16
* @gitHub https://github.com/cryptoapi/Payment-Gateway
17
17
* @license Free GPLv2
18
- * @version 2.1.7
18
+ * @version 2.2.0
19
19
*
20
20
*
21
21
* CLASS CRYPTOBOX - LIST OF METHODS:
79
79
elseif (!defined ('ABSPATH ' )) exit ; // Wordpress
80
80
81
81
82
- define ("CRYPTOBOX_VERSION " , "2.1.7 " );
82
+ define ("CRYPTOBOX_VERSION " , "2.2.0 " );
83
83
84
84
// GoUrl supported crypto currencies
85
85
define ("CRYPTOBOX_COINS " , json_encode (array ('bitcoin ' , 'bitcoincash ' , 'bitcoinsv ' , 'litecoin ' , 'dash ' , 'dogecoin ' , 'speedcoin ' , 'reddcoin ' , 'potcoin ' , 'feathercoin ' , 'vertcoin ' , 'peercoin ' , 'monetaryunit ' , 'universalcurrency ' )));
@@ -131,6 +131,7 @@ class Cryptobox {
131
131
private $ processed = false ; // optional - set flag to paid & processed
132
132
private $ cookieName = "" ; // user cookie/session name (if cookies/sessions use)
133
133
private $ localisation = "" ; // localisation; en - English, es - Spanish, fr - French, de - German, nl - Dutch, it - Italian, ru - Russian, pl - Polish, pt - Portuguese, fa - Persian, ko - Korean, ja - Japanese, id - Indonesian, tr - Turkish, ar - Arabic, cn - Simplified Chinese, zh - Traditional Chinese, hi - Hindi
134
+ private $ ver = "" ; // version
134
135
135
136
136
137
public function __construct ($ options = array ())
@@ -141,8 +142,7 @@ public function __construct($options = array())
141
142
if (!function_exists ( 'curl_init ' )) die (sprintf ("Error. Please enable <a target='_blank' href='%s'>CURL extension</a> in PHP. <a target='_blank' href='%s'>Read here »</a> " , "http://php.net/manual/en/book.curl.php " , "http://stackoverflow.com/questions/1347146/how-to-enable-curl-in-php-xampp " ));
142
143
if (!function_exists ( 'mysqli_connect ' )) die (sprintf ("Error. Please enable <a target='_blank' href='%s'>MySQLi extension</a> in PHP. <a target='_blank' href='%s'>Read here »</a> " , "http://php.net/manual/en/book.mysqli.php " , "http://crybit.com/how-to-enable-mysqli-extension-on-web-server/ " ));
143
144
if (version_compare (phpversion (), '5.4.0 ' , '< ' )) die (sprintf ("Error. You need PHP 5.4.0 (or greater). Current php version: %s " , phpversion ()));
144
-
145
-
145
+
146
146
foreach ($ options as $ key => $ value )
147
147
if (in_array ($ key , array ("public_key " , "private_key " , "webdev_key " , "amount " , "amountUSD " , "period " , "language " , "iframeID " , "orderID " , "userID " , "userFormat " ))) $ this ->$ key = (is_string ($ value )) ? trim ($ value ) : $ value ;
148
148
@@ -241,6 +241,18 @@ public function __construct($options = array())
241
241
}
242
242
}
243
243
244
+ // version string
245
+ $ this ->ver = "version | gourlphp " . CRYPTOBOX_VERSION ;
246
+ if (CRYPTOBOX_WORDPRESS ) $ this ->ver .= " | gourlwordpress " . (defined ('GOURL_VERSION ' ) ? " " .GOURL_VERSION : "" );
247
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLWC_VERSION ' ) && strpos ($ this ->orderID , "gourlwoocommerce. " ) === 0 ) $ this ->ver .= " | gourlwoocommerce " . GOURLWC_VERSION ;
248
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLAP_VERSION ' ) && strpos ($ this ->orderID , "gourlappthemes. " ) === 0 ) $ this ->ver .= " | gourlappthemes " . GOURLAP_VERSION ;
249
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLEDD_VERSION ' ) && strpos ($ this ->orderID , "gourledd. " ) === 0 ) $ this ->ver .= " | gourledd " . GOURLEDD_VERSION ;
250
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLPMP_VERSION ' ) && strpos ($ this ->orderID , "gourlpmpro. " ) === 0 ) $ this ->ver .= " | gourlpmpro " . GOURLPMP_VERSION ;
251
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLGV_VERSION ' ) && strpos ($ this ->orderID , "gourlgive. " ) === 0 ) $ this ->ver .= " | gourlgive " . GOURLGV_VERSION ;
252
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLJI_VERSION ' ) && strpos ($ this ->orderID , "gourljigoshop. " ) === 0 ) $ this ->ver .= " | gourljigoshop " . GOURLJI_VERSION ;
253
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLWPSC_VERSION ' ) && strpos ($ this ->orderID , "gourlwpecommerce. " ) === 0 ) $ this ->ver .= " | gourlwpecommerce " . GOURLWPSC_VERSION ;
254
+ if (CRYPTOBOX_WORDPRESS && defined ('GOURLMP_VERSION ' ) && strpos ($ this ->orderID , "gourlmarketpress. " ) === 0 ) $ this ->ver .= " | gourlmarketpress " . GOURLMP_VERSION ;
255
+
244
256
if (!$ this ->iframeID ) $ this ->iframeID = $ this ->iframe_id ();
245
257
246
258
$ this ->check_payment ();
@@ -273,6 +285,8 @@ public function display_cryptobox($submit_btn = true, $width = "540", $height =
273
285
274
286
$ width = intval ($ width );
275
287
$ height = intval ($ height );
288
+
289
+ $ box_style = trim ($ box_style , "; " ) .";max-width: " .$ width ."px !important;max-height: " .$ height ."px !important; " ;
276
290
277
291
$ cryptobox_html = "" ;
278
292
$ val = md5 ($ this ->iframeID .$ this ->private_key .$ this ->userID );
@@ -295,7 +309,7 @@ public function display_cryptobox($submit_btn = true, $width = "540", $height =
295
309
296
310
$ cryptobox_html .= "<div align='center' style='min-width: " .$ width ."px'><iframe id=' $ this ->iframeID ' " .($ box_style ?'style=" ' .htmlspecialchars ($ box_style , ENT_COMPAT ).'" ' :'' )." scrolling='no' marginheight='0' marginwidth='0' frameborder='0' width=' $ width' height=' $ height'></iframe></div> " ;
297
311
$ cryptobox_html .= "<div><script type='text/javascript'> " ;
298
- $ cryptobox_html .= "cryptobox_show( $ this ->boxID , ' $ this ->coinName ', ' $ this ->public_key ', $ this ->amount , $ this ->amountUSD , ' $ this ->period ', ' $ this ->language ', ' $ this ->iframeID ', ' $ this ->userID ', ' $ this ->userFormat ', ' $ this ->orderID ', ' $ this ->cookieName ', ' $ this ->webdev_key ', ' $ hash', $ width, $ height); " ;
312
+ $ cryptobox_html .= "cryptobox_show( $ this ->boxID , ' $ this ->coinName ', ' $ this ->public_key ', $ this ->amount , $ this ->amountUSD , ' $ this ->period ', ' $ this ->language ', ' $ this ->iframeID ', ' $ this ->userID ', ' $ this ->userFormat ', ' $ this ->orderID ', ' $ this ->cookieName ', ' $ this ->webdev_key ', ' " . base64_encode ( $ this -> ver ). " ', ' $ hash', $ width, $ height); " ;
299
313
$ cryptobox_html .= "</script></div> " ;
300
314
301
315
if ($ submit_btn && !$ this ->paid )
@@ -355,6 +369,7 @@ public function cryptobox_json_url()
355
369
"j " => 1 , // json
356
370
"d " => base64_encode ($ ip ),
357
371
"f " => base64_encode ($ this ->ua (false )),
372
+ "t " => base64_encode ($ this ->ver ),
358
373
"h " => $ hash
359
374
);
360
375
@@ -433,8 +448,8 @@ public function get_json_values()
433
448
public function cryptobox_hash ($ json = false , $ width = 0 , $ height = 0 )
434
449
{
435
450
436
- if ($ json ) $ hash_str = $ this ->boxID ."| " .$ this ->coinName ."| " .$ this ->public_key ."| " .$ this ->private_key ."| " .$ this ->webdev_key ."| " .$ this ->amount ."| " .$ this ->amountUSD ."| " .$ this ->period ."| " . $ this ->language ."| " .$ this ->orderID ."| " .$ this ->userID ."| " .$ this ->userFormat ."| " .$ this ->ip_address ();
437
- else $ hash_str = $ this ->boxID ."| " .$ this ->coinName ."| " .$ this ->public_key ."| " .$ this ->private_key ."| " .$ this ->webdev_key ."| " .$ this ->amount ."| " .$ this ->amountUSD ."| " .$ this ->period ."| " . $ this ->language ."| " .$ this ->orderID ."| " .$ this ->userID ."| " .$ this ->userFormat ."| " .$ this ->iframeID ."| " .$ width ."| " .$ height ;
451
+ if ($ json ) $ hash_str = $ this ->boxID ."| " .$ this ->coinName ."| " .$ this ->public_key ."| " .$ this ->private_key ."| " .$ this ->webdev_key ."| " .$ this ->amount ."| " .$ this ->amountUSD ."| " .$ this ->period ."| " . $ this ->language ."| " .$ this ->orderID ."| " .$ this ->userID ."| " .$ this ->userFormat ."| " .$ this ->ver . " | " . $ this -> ip_address ();
452
+ else $ hash_str = $ this ->boxID ."| " .$ this ->coinName ."| " .$ this ->public_key ."| " .$ this ->private_key ."| " .$ this ->webdev_key ."| " .$ this ->amount ."| " .$ this ->amountUSD ."| " .$ this ->period ."| " . $ this ->language ."| " .$ this ->orderID ."| " .$ this ->userID ."| " .$ this ->userFormat ."| " .$ this ->ver . " | " . $ this -> iframeID ."| " .$ width ."| " .$ height ;
438
453
439
454
440
455
$ hash = md5 ($ hash_str );
@@ -1317,7 +1332,7 @@ private function check_payment_live()
1317
1332
{
1318
1333
$ ip = $ this ->ip_address ();
1319
1334
$ private_key_hash = strtolower (hash ("sha512 " , $ this ->private_key ));
1320
- $ hash = md5 ($ this ->boxID .$ private_key_hash .$ this ->userID .$ this ->orderID .$ this ->language .$ this ->period .$ ip );
1335
+ $ hash = md5 ($ this ->boxID .$ private_key_hash .$ this ->userID .$ this ->orderID .$ this ->language .$ this ->period .$ this -> ver . $ ip );
1321
1336
$ box_status = "" ;
1322
1337
1323
1338
$ data = array (
@@ -1327,6 +1342,7 @@ private function check_payment_live()
1327
1342
"u " => $ this ->userID ,
1328
1343
"l " => $ this ->language ,
1329
1344
"e " => $ this ->period ,
1345
+ "t " => $ this ->ver ,
1330
1346
"i " => $ ip ,
1331
1347
"h " => $ hash
1332
1348
);
@@ -2379,14 +2395,14 @@ function run_sql($sql)
2379
2395
);
2380
2396
2381
2397
if (!defined ("CRYPTOBOX_LOCALISATION " )) define ("CRYPTOBOX_LOCALISATION " , json_encode ($ cryptobox_localisation ));
2382
- unset($ cryptobox_localisation );
2398
+ unset($ cryptobox_localisation );
2383
2399
2384
2400
if (!CRYPTOBOX_WORDPRESS || defined ("CRYPTOBOX_PRIVATE_KEYS " ))
2385
2401
{
2386
2402
$ cryptobox_private_keys = explode ("^ " , CRYPTOBOX_PRIVATE_KEYS );
2387
2403
foreach ($ cryptobox_private_keys as $ v )
2388
2404
if (strpos ($ v , " " ) !== false || strpos ($ v , "PRV " ) === false || strpos ($ v , "AA " ) === false || strpos ($ v , "77 " ) === false ) die ("Invalid Private Key - " . (CRYPTOBOX_WORDPRESS ? "please setup it on your plugin settings page " : "$ v in variable \$cryptobox_private_keys, file cryptobox.config.php. " ));
2389
2405
2390
- unset($ v ); unset($ cryptobox_private_keys );
2406
+ unset($ v ); unset($ cryptobox_private_keys );
2391
2407
}
2392
2408
?>
0 commit comments