Skip to content

Commit 47e2915

Browse files
committed
update
1 parent 122c7fa commit 47e2915

File tree

2 files changed

+103
-24
lines changed

2 files changed

+103
-24
lines changed

gourl.php

Lines changed: 103 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,10 @@ private function check_download()
16131613

16141614
if (!$this->record["defCoin"]) $this->record_errors[] = __("Field 'PaymentBox Coin' - cannot be empty", GOURL);
16151615
elseif (!isset($this->coin_names[$this->record["defCoin"]])) $this->record_errors[] = __("Field 'PaymentBox Coin' - invalid value", GOURL);
1616-
elseif (!isset($this->payments[$this->record["defCoin"]])) $this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please re-save record", GOURL), $this->coin_names[$this->record["defCoin"]]);
1616+
elseif (!isset($this->payments[$this->record["defCoin"]])) {
1617+
if (!$this->payments) $this->record_errors[] = sprintf(__("You must choose at least one payment method. Please enter your GoUrl Public/Private Keys on <a href='%s'>settings page</a>. Instruction <a href='%s'>here &#187;</a>", GOURL), GOURL_ADMIN.GOURL.'settings#gourlcurrencyconverterapi_key', GOURL_ADMIN.GOURL."#i3");
1618+
$this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please re-save record", GOURL), $this->coin_names[$this->record["defCoin"]]);
1619+
}
16171620
elseif ($this->record["priceCoin"] != 0 && $this->record["defCoin"] != $this->record["priceLabel"])
16181621
{
16191622
if (isset($this->payments[$this->record["priceLabel"]])) $this->record["defCoin"] = $this->record["priceLabel"];
@@ -2088,7 +2091,7 @@ public function shortcode_download($arr)
20882091
global $wpdb, $current_user;
20892092

20902093
// not available activated coins
2091-
if (!$this->payments) return "";
2094+
if (!$this->payments) { $html = $this->display_error_nokeys(); return $html; }
20922095

20932096
if (!isset($arr["id"]) || !intval($arr["id"])) return '<div>'.sprintf(__('Invalid format. Use %s', GOURL), '&#160; ['.GOURL_TAG_DOWNLOAD.' id=..id..]').'</div>';
20942097

@@ -2190,7 +2193,7 @@ public function shortcode_download($arr)
21902193

21912194
if(!defined("CRYPTOBOX_PRIVATE_KEYS")) define("CRYPTOBOX_PRIVATE_KEYS", implode("^", $cryptobox_private_keys));
21922195

2193-
if (!$available_coins) return '<div>'.__('No Available Payments -', GOURL).' '.$short_code.'</div>';
2196+
if (!$available_coins) { $html = '<div>'.$this->display_error_nokeys().' '.$short_code.'</div>'; return $html; }
21942197

21952198
if (!in_array($defCoin, $available_coins)) { $vals = array_values($available_coins); $defCoin = array_shift($vals); }
21962199

@@ -2458,7 +2461,10 @@ private function check_view()
24582461

24592462
if (!$this->options2["ppvCoin"]) $this->record_errors[] = __("Field 'PaymentBox Coin' - cannot be empty", GOURL);
24602463
elseif (!isset($this->coin_names[$this->options2["ppvCoin"]])) $this->record_errors[] = __("Field 'PaymentBox Coin' - invalid value", GOURL);
2461-
elseif (!isset($this->payments[$this->options2["ppvCoin"]])) $this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please click on 'Save Settings' button", GOURL), $this->coin_names[$this->options2["ppvCoin"]]);
2464+
elseif (!isset($this->payments[$this->options2["ppvCoin"]])) {
2465+
if (!$this->payments) $this->record_errors[] = sprintf(__("You must choose at least one payment method. Please enter your GoUrl Public/Private Keys on <a href='%s'>settings page</a>. Instruction <a href='%s'>here &#187;</a>", GOURL), GOURL_ADMIN.GOURL.'settings#gourlcurrencyconverterapi_key', GOURL_ADMIN.GOURL."#i3");
2466+
$this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please click on 'Save Settings' button", GOURL), $this->coin_names[$this->options2["ppvCoin"]]);
2467+
}
24622468
elseif ($this->options2["ppvPriceCoin"] != 0 && $this->options2["ppvCoin"] != $this->options2["ppvPriceLabel"]) $this->record_errors[] = sprintf(__("Field 'PaymentBox Coin' - please select '%s' because you have entered price in %s", GOURL), $this->coin_names[$this->options2["ppvPriceLabel"]], $this->coin_names[$this->options2["ppvPriceLabel"]]);
24632469

24642470
if ($this->options2["ppvPriceCoin"] != 0 && !$this->options2["ppvOneCoin"]) $this->record_errors[] = sprintf(__("Field 'Use Default Coin Only' - check it because you have entered price in %s. Please use price in USD if you want to accept multiple coins", GOURL), $this->coin_names[$this->options2["ppvPriceLabel"]]);
@@ -2807,7 +2813,7 @@ public function is_premium_payperview_user ($full = true)
28072813

28082814
if(!defined("CRYPTOBOX_PRIVATE_KEYS")) define("CRYPTOBOX_PRIVATE_KEYS", implode("^", $cryptobox_private_keys));
28092815

2810-
if (!$available_coins) { echo '<div>'.__('No Available Payments -', GOURL).' '.$short_code.'</div>'; return false; }
2816+
if (!$available_coins) { echo '<div>'.$this->display_error_nokeys().' '.$short_code.'</div>'; return false; }
28112817

28122818
if (!in_array($defCoin, $available_coins)) { $vals = array_values($available_coins); $defCoin = array_shift($vals); }
28132819

@@ -2892,12 +2898,46 @@ private function shortcode_view_init($image = "", $frame = "", $iwidth = "", $ih
28922898
// another tag [gourl-membership] with hgh priority exists on page
28932899
if ($this->lock_type == GOURL_TAG_MEMBERSHIP) return "";
28942900

2895-
// not available activated coins
2896-
if (!$this->payments) return "";
2897-
2898-
28992901
// preview admin mode
2900-
$preview_mode = (stripos($_SERVER["REQUEST_URI"], "wp-admin/admin.php?") && $this->page == "gourlpayperview") ? true : false;
2902+
$preview_mode = (stripos($_SERVER["REQUEST_URI"], "wp-admin/admin.php?") && $this->page == "gourlpayperview" && current_user_can('administrator')) ? true : false;
2903+
2904+
2905+
// not available activated bitcoin/altcoin
2906+
if (!$this->payments)
2907+
{
2908+
if (!$preview_mode)
2909+
{
2910+
add_filter('the_content', 'gourl_lock_filter', 11111);
2911+
add_filter('the_content_rss', 'gourl_lock_filter', 11111);
2912+
add_filter('the_content_feed', 'gourl_lock_filter', 11111);
2913+
add_filter("wp_title", 'gourl_hide_headtitle', 11111);
2914+
add_filter("wp_title_rss", 'gourl_hide_headtitle', 11111);
2915+
add_filter('the_title', 'gourl_hide_all_titles', 11111);
2916+
add_filter('the_title_rss', 'gourl_hide_all_titles', 11111);
2917+
add_filter('the_title', 'gourl_hide_menu_titles', 11111);
2918+
add_filter('the_title_rss', 'gourl_hide_menu_titles', 11111);
2919+
add_filter("wp_title", 'gourl_hide_headtitle', 11111);
2920+
add_filter("wp_title_rss", 'gourl_hide_headtitle', 11111);
2921+
add_filter('the_title', 'gourl_hide_page_title', 11111);
2922+
add_filter('the_title_rss', 'gourl_hide_page_title', 11111);
2923+
add_filter('get_comment_author_link', 'gourl_return_false', 11111);
2924+
add_filter('comment_text', 'gourl_lock_comments', 11111);
2925+
add_filter('post_comments_link', 'gourl_return_false', 1);
2926+
add_filter('comment_reply_link', 'gourl_return_false', 1);
2927+
add_filter('comments_open', 'gourl_return_false', 1);
2928+
add_action('do_feed', 'gourl_disable_feed', 1);
2929+
add_action('do_feed_rdf', 'gourl_disable_feed', 1);
2930+
add_action('do_feed_rss', 'gourl_disable_feed', 1);
2931+
add_action('do_feed_rss2', 'gourl_disable_feed', 1);
2932+
add_action('do_feed_atom', 'gourl_disable_feed', 1);
2933+
}
2934+
2935+
$html = GOURL_LOCK_START.$this->display_error_nokeys().GOURL_LOCK_END;
2936+
2937+
return $html;
2938+
}
2939+
2940+
29012941

29022942

29032943
// if user already bought pay-per-view
@@ -3000,7 +3040,7 @@ private function shortcode_view_init($image = "", $frame = "", $iwidth = "", $ih
30003040

30013041
if(!defined("CRYPTOBOX_PRIVATE_KEYS")) define("CRYPTOBOX_PRIVATE_KEYS", implode("^", $cryptobox_private_keys));
30023042

3003-
if (!$available_coins) { $html = '<div>'.__('No Available Payments -', GOURL).' '.$short_code.'</div>'; return $html; }
3043+
if (!$available_coins) { $html = '<div>'.$this->display_error_nokeys().' '.$short_code.'</div>'; return $html; }
30043044

30053045
if (!in_array($defCoin, $available_coins)) { $vals = array_values($available_coins); $defCoin = array_shift($vals); }
30063046

@@ -3199,7 +3239,6 @@ private function shortcode_view_init($image = "", $frame = "", $iwidth = "", $ih
31993239

32003240

32013241

3202-
32033242

32043243

32053244

@@ -3277,7 +3316,10 @@ private function check_membership()
32773316

32783317
if (!$this->options3["ppmCoin"]) $this->record_errors[] = __("Field 'PaymentBox Coin' - cannot be empty", GOURL);
32793318
elseif (!isset($this->coin_names[$this->options3["ppmCoin"]])) $this->record_errors[] = __("Field 'PaymentBox Coin' - invalid value", GOURL);
3280-
elseif (!isset($this->payments[$this->options3["ppmCoin"]])) $this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please click on 'Save Settings' button", GOURL), $this->coin_names[$this->options3["ppmCoin"]]);
3319+
elseif (!isset($this->payments[$this->options3["ppmCoin"]])) {
3320+
if (!$this->payments) $this->record_errors[] = sprintf(__("You must choose at least one payment method. Please enter your GoUrl Public/Private Keys on <a href='%s'>settings page</a>. Instruction <a href='%s'>here &#187;</a>", GOURL), GOURL_ADMIN.GOURL.'settings#gourlcurrencyconverterapi_key', GOURL_ADMIN.GOURL."#i3");
3321+
$this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please click on 'Save Settings' button", GOURL), $this->coin_names[$this->options3["ppmCoin"]]);
3322+
}
32813323
elseif ($this->options3["ppmPriceCoin"] != 0 && $this->options3["ppmCoin"] != $this->options3["ppmPriceLabel"]) $this->record_errors[] = sprintf(__("Field 'PaymentBox Coin' - please select '%s' because you have entered price in %s", GOURL), $this->coin_names[$this->options3["ppmPriceLabel"]], $this->coin_names[$this->options3["ppmPriceLabel"]]);
32823324

32833325
if ($this->options3["ppmPriceCoin"] != 0 && !$this->options3["ppmOneCoin"]) $this->record_errors[] = sprintf(__("Field 'Use Default Coin Only' - check it because you have entered price in %s. Please use price in USD if you want to accept multiple coins", GOURL), $this->coin_names[$this->options3["ppmPriceLabel"]]);
@@ -3681,13 +3723,37 @@ private function shortcode_membership_init($image = "", $frame = "", $iwidth = "
36813723
// empty by dafault
36823724
$html = "";
36833725

3726+
// preview admin mode
3727+
$preview_mode = (stripos($_SERVER["REQUEST_URI"], "wp-admin/admin.php?") && $this->page == "gourlpaypermembership" && current_user_can('administrator')) ? true : false;
36843728

3685-
// not available activated coins
3686-
if (!$this->payments) return "";
3729+
3730+
// not available activated bitcoin/altcoin
3731+
if (!$this->payments)
3732+
{
3733+
add_filter('the_content', 'gourl_lock_filter', 11111);
3734+
add_filter('the_content_rss', 'gourl_lock_filter', 11111);
3735+
add_filter('the_content_feed', 'gourl_lock_filter', 11111);
3736+
add_filter("wp_title", 'gourl_hide_headtitle_unlogged', 11111);
3737+
add_filter("wp_title_rss", 'gourl_hide_headtitle_unlogged', 11111);
3738+
add_filter('the_title', 'gourl_hide_all_titles', 11111);
3739+
add_filter('the_title_rss', 'gourl_hide_all_titles', 11111);
3740+
add_filter('get_comment_author_link', 'gourl_return_false', 11111);
3741+
add_filter('comment_text', 'gourl_lock_comments', 11111);
3742+
add_filter('post_comments_link', 'gourl_return_false', 1);
3743+
add_filter('comment_reply_link', 'gourl_return_false', 1);
3744+
add_filter('comments_open', 'gourl_return_false', 1);
3745+
add_action('do_feed', 'gourl_disable_feed', 1);
3746+
add_action('do_feed_rdf', 'gourl_disable_feed', 1);
3747+
add_action('do_feed_rss', 'gourl_disable_feed', 1);
3748+
add_action('do_feed_rss2', 'gourl_disable_feed', 1);
3749+
add_action('do_feed_atom', 'gourl_disable_feed', 1);
3750+
3751+
$html = GOURL_LOCK_START.$this->display_error_nokeys().GOURL_LOCK_END;
3752+
3753+
return $html;
3754+
}
36873755

36883756

3689-
// preview admin mode
3690-
$preview_mode = (stripos($_SERVER["REQUEST_URI"], "wp-admin/admin.php?") && $this->page == "gourlpaypermembership") ? true : false;
36913757

36923758

36933759
// if premium user already or don't need upgade user membership
@@ -3820,7 +3886,7 @@ private function shortcode_membership_init($image = "", $frame = "", $iwidth = "
38203886

38213887
if(!defined("CRYPTOBOX_PRIVATE_KEYS")) define("CRYPTOBOX_PRIVATE_KEYS", implode("^", $cryptobox_private_keys));
38223888

3823-
if (!$available_coins) { $html = '<div>'.__('No Available Payments -', GOURL).' '.$short_code.'</div>'; return $html; }
3889+
if (!$available_coins) { $html = '<div>'.$this->display_error_nokeys().' '.$short_code.'</div>'; return $html; }
38243890

38253891
if (!in_array($defCoin, $available_coins)) { $vals = array_values($available_coins); $defCoin = array_shift($vals); }
38263892

@@ -4340,7 +4406,10 @@ public function check_product()
43404406

43414407
if (!$this->record["defCoin"]) $this->record_errors[] = __("Field 'PaymentBox Coin' - cannot be empty", GOURL);
43424408
elseif (!isset($this->coin_names[$this->record["defCoin"]])) $this->record_errors[] = __("Field 'PaymentBox Coin' - invalid value", GOURL);
4343-
elseif (!isset($this->payments[$this->record["defCoin"]])) $this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please re-save record", GOURL), $this->coin_names[$this->record["defCoin"]]);
4409+
elseif (!isset($this->payments[$this->record["defCoin"]])) {
4410+
if (!$this->payments) $this->record_errors[] = sprintf(__("You must choose at least one payment method. Please enter your GoUrl Public/Private Keys on <a href='%s'>settings page</a>. Instruction <a href='%s'>here &#187;</a>", GOURL), GOURL_ADMIN.GOURL.'settings#gourlcurrencyconverterapi_key', GOURL_ADMIN.GOURL."#i3");
4411+
$this->record_errors[] = sprintf( __("Field 'PaymentBox Coin' - payments in %s not available. Please re-save record", GOURL), $this->coin_names[$this->record["defCoin"]]);
4412+
}
43444413
elseif ($this->record["priceCoin"] != 0 && $this->record["defCoin"] != $this->record["priceLabel"]) $this->record_errors[] = sprintf(__("Field 'PaymentBox Coin' - please select '%s' because you have entered price in %s", GOURL), $this->coin_names[$this->record["priceLabel"]], $this->coin_names[$this->record["priceLabel"]]);
43454414

43464415
if ($this->record["emailUser"])
@@ -4851,7 +4920,7 @@ public function shortcode_product($arr, $preview_final = false)
48514920
global $wpdb, $current_user;
48524921

48534922
// not available activated coins
4854-
if (!$this->payments) return "";
4923+
if (!$this->payments) { $html = $this->display_error_nokeys(); return $html; }
48554924

48564925
if (!isset($arr["id"]) || !intval($arr["id"])) return '<div>'.sprintf(__('Invalid format. Use %s', GOURL), '&#160; ['.GOURL_TAG_PRODUCT.' id="..id.."]').'</div>';
48574926

@@ -4943,7 +5012,7 @@ public function shortcode_product($arr, $preview_final = false)
49435012

49445013
if(!defined("CRYPTOBOX_PRIVATE_KEYS")) define("CRYPTOBOX_PRIVATE_KEYS", implode("^", $cryptobox_private_keys));
49455014

4946-
if (!$available_coins) return '<div>'.__('No Available Payments -', GOURL).' '.$short_code.'</div>';
5015+
if (!$available_coins) { $html = '<div>'.$this->display_error_nokeys().' '.$short_code.'</div>'; return $html; }
49475016

49485017
if (!in_array($defCoin, $available_coins)) { $vals = array_values($available_coins); $defCoin = array_shift($vals); }
49495018

@@ -6064,7 +6133,7 @@ public function cryptopayments ($pluginName, $amount, $amountLabel = "USD", $ord
60646133
if ($userID && $userID != "guest" && (!is_numeric($userID) || preg_replace('/[^0-9]/', '', $userID) != $userID)) return array("error" => sprintf(__("Error. Invalid User ID - %s. Allowed numeric values or 'guest' value", GOURL), $userID));
60656134
if (!$userID) return array("error" => __("Error.", GOURL).__("You need first to login or register on the website to make Bitcoin/Altcoin Payments", GOURL));
60666135

6067-
if (!$this->payments) return array("error" => __("Error. Please try a different payment method. GoUrl Bitcoin Plugin not configured - need setup payment box keys on GoUrl Bitcoin Gateway Options page", GOURL));
6136+
if (!$this->payments) return array("error" => __("Error. Please try a different payment method. GoUrl.io Bitcoin plugin is not configured yet. Need to setup GoUrl Public/Private Keys on plugin settings page. Please contact the website administrator.", GOURL));
60686137

60696138
$icon_width = str_replace("px", "", $icon_width);
60706139
if (!is_numeric($icon_width) || $icon_width < 30 || $icon_width > 250) $icon_width = 60;
@@ -6588,10 +6657,20 @@ public function exclude_js_file($exclude)
65886657
return $exclude . ", cryptobox.min";
65896658
}
65906659

6660+
65916661

6662+
/*
6663+
* 79. Need to setup gourl.io keys
6664+
*/
6665+
public function display_error_nokeys()
6666+
{
6667+
return "<div align='center'><a href='".$_SERVER['REQUEST_URI']."'><img border='0' src='".plugins_url('/images/error_keys.png', __FILE__)."'></img></a></div>";
6668+
}
65926669

6670+
6671+
65936672
/*
6594-
* 79. Supported Functions
6673+
* 80. Supported Functions
65956674
*/
65966675
private function sel($val1, $val2)
65976676
{
@@ -8574,5 +8653,5 @@ function gourl_altcoin_btc_price ($altcoin, $interval = 1)
85748653
}
85758654

85768655

8577-
return 0;
8656+
return 0;
85788657
}

images/error_keys.png

59.8 KB
Loading

0 commit comments

Comments
 (0)