Skip to content

Commit

Permalink
Fix test parameters function not working
Browse files Browse the repository at this point in the history
  • Loading branch information
drov0 committed Jun 4, 2019
1 parent 455334f commit 57d6256
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin/class-steempress_sp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ public function steempress_sp_custom_box_html($post)
<input type='text' name='steempress_sp_permlink' value='" . $permlink . "'/><br>
";
// Minified js to handle the "test parameters" function
$body .= "<script>function steempress_sp_createCORSRequest(){var e=\"" . steempress_sp_twoway_api_url . "/test_param\",t=new XMLHttpRequest;return\"withCredentials\"in t?t.open(\"POST\",e,!0):\"undefined\"!=typeof XDomainRequest?(t=new XDomainRequest).open(\"POST\",e):t=null,t}function steempress_sp_test_params(){document.getElementById(\"steempress_sp_status\").innerHTML=\"loading...\";var e=steempress_sp_createCORSRequest(),s=document.getElementsByName(\"steempress_sp_author\")[0].value,n=document.getElementsByName(\"steempress_sp_permlink\")[0].value,r=\"username=\"+s+\"&permlink=\"+n;e.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\"),e&&(e.username=s,e.permlink=n,e.onload=function(){var t=e.responseText;document.getElementById(\"steempress_sp_status\").innerHTML=\"ok\"===t?\"The parameters are correct. this article is linked to this <a href='https://steemit.com/@\"+this.username+\"/\"+this.permlink+\"'>steem post</a>\":\"Error : the permlink or username is incorrect.\"},e.send(r))}</script>";
$body .= "<script>function steempress_sp_createCORSRequest(){var e=\"" . steempress_sp_twoway_api_back . "/test_param\",t=new XMLHttpRequest;return\"withCredentials\"in t?t.open(\"POST\",e,!0):\"undefined\"!=typeof XDomainRequest?(t=new XDomainRequest).open(\"POST\",e):t=null,t}function steempress_sp_test_params(){document.getElementById(\"steempress_sp_status\").innerHTML=\"loading...\";var e=steempress_sp_createCORSRequest(),s=document.getElementsByName(\"steempress_sp_author\")[0].value,n=document.getElementsByName(\"steempress_sp_permlink\")[0].value,r=\"username=\"+s+\"&permlink=\"+n;e.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\"),e&&(e.username=s,e.permlink=n,e.onload=function(){var t=e.responseText;document.getElementById(\"steempress_sp_status\").innerHTML=\"ok\"===t?\"The parameters are correct. this article is linked to this <a href='https://steemit.com/@\"+this.username+\"/\"+this.permlink+\"'>steem post</a>\":\"Error : the permlink or username is incorrect.\"},e.send(r))}</script>";

$body .= "<button type=\"button\" onclick='steempress_sp_test_params()'>Test parameters</button><br/><p id='steempress_sp_status'></p>";

Expand Down
6 changes: 4 additions & 2 deletions steempress_sp.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @wordpress-plugin
* Plugin Name: Steempress
* Description: Publishes your article to the steem blockchain automatically to allow you to earn money and reach new audiences.
* Version: 2.4
* Version: 2.4.1
* Author: Martin Lees
* Author URI: https://steemit.com/@howo
* License: GPL-2.0+
Expand All @@ -32,13 +32,15 @@
* Currently plugin version.
* using SemVer - https://semver.org
*/
define( 'steempress_sp_compte', '2.4');
define( 'steempress_sp_compte', '2.4.1');

define( 'steempress_sp_api_url', 'https://api.steempress.io');
define( 'steempress_sp_twoway_api_url', 'https://two.steempress.io');
define( 'steempress_sp_twoway_api_back', 'https://sc.steempress.io');

//define( 'steempress_sp_twoway_api_url', 'http://localhost:3000');
//define( 'steempress_sp_api_url', 'http://localhost:8001');
//define( 'steempress_sp_twoway_api_back', 'http://localhost:8102');

/**
* The code that runs during plugin activation.
Expand Down

0 comments on commit 57d6256

Please sign in to comment.