Changeset 1774331
- Timestamp:
- 11/23/2017 08:17:52 PM (8 years ago)
- Location:
- truvisibility-plagiarism-checker/trunk
- Files:
-
- 7 edited
-
css/common.css (modified) (1 diff)
-
js/settings.js (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
services/TruVisibilityPlagiarismRestApi.php (modified) (3 diffs)
-
services/TruVisibilityPlagiarismSettings.php (modified) (5 diffs)
-
services/clients/TruVisibilityAuthClient.php (modified) (3 diffs)
-
services/clients/TruVisibilityPlagiarismClient.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
truvisibility-plagiarism-checker/trunk/css/common.css
r1773200 r1774331 24 24 display: none; 25 25 } 26 27 td.rast-row { 28 padding: 5px 10px; 29 } -
truvisibility-plagiarism-checker/trunk/js/settings.js
r1773200 r1774331 17 17 $("#auth-code").show(); 18 18 $("#auth-code-apply").click(function () { 19 var code = $("#auth-code-value").val(); 20 21 $.get(restUrl + "auth/" + code) 22 .done(function (data, statusText, xhr) { 23 if (xhr.status === 200) { 24 window.location.reload(); 25 } 26 }); 19 $.get(restUrl + "auth/" + $("#auth-code-value").val()).done(function() { 20 $.post(restUrl + "account/ensure").done(function() { 21 window.location.reload(); 22 }); 23 }); 27 24 }); 28 25 }); … … 39 36 } 40 37 }); 38 }); 39 40 $.get(restUrl + "plans").done(function (plans) { 41 $("#rast-plans-loading").remove(); 42 43 var header = $("<tr>").css("font-weight", "600") 44 .append($("<td>").text("Name").addClass("rast-row")) 45 .append($("<td>").text("Checks included").addClass("rast-row")) 46 .append($("<td>").text("Price").addClass("rast-row")) 47 .append($("<td>").text("Cost of additional check").addClass("rast-row")); 48 49 var table = $("#rast-plans").append(header); 50 51 var isFreePlanActive = plans.some(function(p) { return p.code.startsWith("free") && p.isActive; }); 52 53 plans = plans 54 .filter(function(p) { return p.code !== "free-12" && p.code !== "free-24" && p.code !== "free-36"; }) 55 .sort(function(a, b) { return a.price - b.price; }); 56 57 for (var j = 0; j < plans.length; j++) { 58 var plan = plans[j]; 59 60 if (plan.code === "free-1") plan.isActive = isFreePlanActive; 61 if (plan.code.endsWith("-1")) plan.name += " (monthly)"; 62 63 var subscriptionUpgradeLink = "https://sites." + umbrellaRoot + "/client/purchase#plagiarism-packages:" + plan.code.replace("-", ":"); 64 65 var row = $("<tr>").css("font-weight", plan.isActive ? "600" : "normal"); 66 row.append($("<td>").text(plan.name).addClass("rast-row")); 67 row.append($("<td>").text(plan.checksPerMonth + " per month").addClass("rast-row")); 68 row.append($("<td>").text("$" + plan.price.toFixed(2)).addClass("rast-row")); 69 row.append($("<td>").text("$" + getExtraCheckPrice(plan.code).toFixed(2)).addClass("rast-row")); 70 row.append($("<td>").html(plan.isActive ? 'current' : '<a href="' + subscriptionUpgradeLink + '" target="_blank">select</a>').addClass("rast-row")); 71 table.append(row); 72 } 73 74 function getExtraCheckPrice(planCode) { 75 if (planCode.startsWith("basic")) return 1.0; 76 if (planCode.startsWith("pro")) return 0.9; 77 return 1.3; 78 } 41 79 }); 42 80 -
truvisibility-plagiarism-checker/trunk/readme.txt
r1773200 r1774331 13 13 TruVisibility Plagiarism Checker plugin for WordPress helps you find out which pages on the Web have quoted or copied your original content and whether they have violated your intellectual property and publishing permissions. It also helps you ensure that your content is original as well. 14 14 15 When TruVisibility Plagiarism Checker detects a page which used your content against permitted usage, a single click enables you to obtain this user s WHOISinformation such as name, email, phone and address, enabling you to send a DMCA notice in order to take down that pages.15 When TruVisibility Plagiarism Checker detects a page which used your content against permitted usage, a single click enables you to obtain this user's WHOIS information such as name, email, phone and address, enabling you to send a DMCA notice in order to take down that pages. 16 16 17 17 Not only does TruVisibility Plagiarism Checker help protect your content, but it also provides you with a valuable tool to track the way others react to your content in order to understand how to improve your publishing experience. … … 30 30 * Disable email alerts for specific domains. 31 31 * Ability to exclude certain categories and posts from schedule check. 32 * Easily grab user s WHOIS information for domains that contains pirated pages to help you send DMCA notification.32 * Easily grab user's WHOIS information for domains that contains pirated pages to help you send DMCA notification. 33 33 34 34 == Installation == -
truvisibility-plagiarism-checker/trunk/services/TruVisibilityPlagiarismRestApi.php
r1773200 r1774331 18 18 register_rest_route('truvisibility/plagiarism/v1', '/auth/(?P<code>[\\w\\d]+)', array('methods' => 'GET', 'callback' => array($this, 'complete_authorization'))); 19 19 register_rest_route('truvisibility/plagiarism/v1', '/auth/clean', array('methods' => 'POST', 'callback' => array($this, 'clean_authorization'))); 20 register_rest_route('truvisibility/plagiarism/v1', '/plans', array('methods' => 'GET', 'callback' => array($this, 'get_plans'))); 20 21 register_rest_route('truvisibility/plagiarism/v1', '/account', array('methods' => 'GET', 'callback' => array($this, 'get_account'))); 22 register_rest_route('truvisibility/plagiarism/v1', '/account/ensure', array('methods' => 'POST', 'callback' => array($this, 'ensure_account'))); 21 23 register_rest_route('truvisibility/plagiarism/v1', '/history', array('methods' => 'GET', 'callback' => array($this, 'get_history'))); 22 24 register_rest_route('truvisibility/plagiarism/v1', '/checks/quota', array('methods' => 'GET', 'callback' => array($this, 'get_quota'))); … … 29 31 } 30 32 33 function get_plans() 34 { 35 return $this->plagiarism_client->get_plans(); 36 } 37 31 38 function get_account() 32 39 { … … 36 43 37 44 return $account; 45 } 46 47 function ensure_account() 48 { 49 return $this->auth_client->ensure_account(); 38 50 } 39 51 -
truvisibility-plagiarism-checker/trunk/services/TruVisibilityPlagiarismSettings.php
r1773200 r1774331 33 33 register_setting('plagiarism', 'truvisibility_plagiarism_usage', array($this, 'sanitize_settings')); 34 34 35 add_settings_section(' plagiarism_section_account', 'Account', array($this, 'plagiarism_section_account_cb'), 'truvisibility_plagiarism_settings');35 add_settings_section('section_account', 'Account', array($this, 'section_account_cb'), 'truvisibility_plagiarism_settings'); 36 36 37 37 if (get_option('truvisibility_plagiarism_account') != false) 38 38 { 39 add_settings_section(' plagiarism_section_usage', 'Usage', array($this, 'plagiarism_section_usage_cb'), 'truvisibility_plagiarism_settings');39 add_settings_section('section_usage', 'Usage', array($this, 'section_usage_cb'), 'truvisibility_plagiarism_settings'); 40 40 41 41 $usage = get_option('truvisibility_plagiarism_usage'); 42 42 43 43 add_settings_field( 44 ' plagiarism_field_enabled',44 'field_enabled', 45 45 'Plagiarism checking is enabled', 46 array($this, ' plagiarism_field_enabled_cb'),47 'truvisibility_plagiarism_settings', 48 ' plagiarism_section_usage',46 array($this, 'field_enabled_cb'), 47 'truvisibility_plagiarism_settings', 48 'section_usage', 49 49 $usage); 50 50 51 51 add_settings_field( 52 ' plagiarism_field_send_notif',52 'field_send_notif', 53 53 'Send notification to site owner', 54 array($this, ' plagiarism_field_send_notif_cb'),55 'truvisibility_plagiarism_settings', 56 ' plagiarism_section_usage',54 array($this, 'field_send_notif_cb'), 55 'truvisibility_plagiarism_settings', 56 'section_usage', 57 57 $usage); 58 58 59 59 add_settings_field( 60 ' plagiarism_field_stop_limit',60 'field_stop_limit', 61 61 'Minimum acceptable uniqueness', 62 array($this, ' plagiarism_field_stop_limit_cb'),63 'truvisibility_plagiarism_settings', 64 ' plagiarism_section_usage',62 array($this, 'field_stop_limit_cb'), 63 'truvisibility_plagiarism_settings', 64 'section_usage', 65 65 $usage); 66 66 67 add_settings_field( 68 'plagiarism_field_quota', 69 'Quota usage', 70 array($this, 'plagiarism_field_quota_cb'), 71 'truvisibility_plagiarism_settings', 72 'plagiarism_section_usage'); 67 add_settings_section('section_subscription', 'Subscription', array($this, 'section_subscription_cb'), 'truvisibility_plagiarism_settings'); 68 69 add_settings_field( 70 'field_quota', 71 'Current usage', 72 array($this, 'field_quota_cb'), 73 'truvisibility_plagiarism_settings', 74 'section_subscription'); 75 76 add_settings_field( 77 'field_plans', 78 'Available subscriptions', 79 array($this, 'field_plans_cb'), 80 'truvisibility_plagiarism_settings', 81 'section_subscription'); 82 83 73 84 } 74 85 } … … 82 93 } 83 94 84 public function plagiarism_section_usage_cb( $args ) {} 85 public function plagiarism_section_account_cb($args) 95 public function section_usage_cb( $args ) {} 96 public function section_subscription_cb($args) {} 97 public function section_account_cb($args) 86 98 { 87 99 $account = get_option('truvisibility_plagiarism_account'); … … 103 115 <b><?php echo $account['name']; ?></b> <i>(<?php echo $account['email']; ?>)</i><br/> 104 116 <div style="padding: 10px 0;"> 105 <a href="https://auth.<?php echo TruVisibilityPlagiarismConfig::$TvUmbrellaRoot ?>/account/profile#products" target="_blank" class="button button-primary">Manage Subscriptions</a>106 117 <div id="clean-auth-button" class="button">Sign Out</div> 107 118 </div> … … 109 120 } 110 121 } 111 112 public function plagiarism_field_enabled_cb($usage)122 123 public function field_enabled_cb($usage) 113 124 { 114 125 echo '<input type="checkbox" '.checked($usage['checking_enabled'], 'on', false).' name="truvisibility_plagiarism_usage[checking_enabled]" />'; 115 126 } 116 127 117 public function plagiarism_field_send_notif_cb($usage)128 public function field_send_notif_cb($usage) 118 129 { 119 130 echo '<input type="checkbox" '.checked($usage['notification_enabled'], 'on', false).' name="truvisibility_plagiarism_usage[notification_enabled]" style="position: relative; top: -2px;" /> '; … … 122 133 } 123 134 124 public function plagiarism_field_stop_limit_cb($usage)135 public function field_stop_limit_cb($usage) 125 136 { 126 137 echo '<input type="number" min="0", max="100" name="truvisibility_plagiarism_usage[min_uniqueness]" value="'.esc_attr($usage['min_uniqueness']).'" /> %'; 127 138 } 128 139 129 public function plagiarism_field_quota_cb($args) 140 public function field_plans_cb($args) 141 { 142 ?> 143 <img id="rast-plans-loading" src="<?php echo get_admin_url(); ?>images/loading.gif" /> 144 <table id="rast-plans" style="margin: 0 0 0 -10px;"></table> 145 <?php 146 } 147 148 public function field_quota_cb($args) 130 149 { 131 150 ?> 132 < div id="rast-quota-loading">Loading...</div>151 <img id="rast-quota-loading" src="<?php echo get_admin_url(); ?>images/loading.gif" /> 133 152 <div id="rast-quota-view" style="display: none;"> 134 153 <span id="rast-quota-used"></span> of <span id="rast-quota-limit"></span> checks used. <span id="rast-purchase-info"></span> 135 154 <p id="rast-purchasing-ok" class="description" style="display: none;"> 136 You can <a href="javascript:void()" id="rast-upgrade"><strong> upgrade</strong></a> your quota by purchasing anadditional checks.155 You can <a href="javascript:void()" id="rast-upgrade"><strong>increase</strong></a> your quota by purchasing additional checks. 137 156 </p> 138 157 <p id="rast-purchasing-no-card" class="description" style="display: none;"> 139 For purchasing an additional checks you should enter credit card into your <a href="https://auth.<?php echo TruVisibilityPlagiarismConfig::$TvUmbrellaRoot; ?>/account/profile#credit-card" target="_blank">TruVisibility account</a>.158 Please update your <a href="https://auth.<?php echo TruVisibilityPlagiarismConfig::$TvUmbrellaRoot; ?>/account/profile#credit-card" target="_blank">TruVisibility account</a> with credit card information to unblock additional checks. 140 159 </p> 141 160 </div> -
truvisibility-plagiarism-checker/trunk/services/clients/TruVisibilityAuthClient.php
r1773200 r1774331 5 5 6 6 private $redirect_uri; 7 8 private $api_endpoint; 7 9 8 10 private $client_id = '6202f4a6-c009-4ff8-8cec-60b120119577'; … … 14 16 $this->auth_token_endpoint = 'https://auth.'.TruVisibilityPlagiarismConfig::$TvUmbrellaRoot.'/oauth/token'; 15 17 $this->redirect_uri = 'https://auth.'.TruVisibilityPlagiarismConfig::$TvUmbrellaRoot.'/oauth/authorization-code'; 18 $this->api_endpoint = 'https://auth.'.TruVisibilityPlagiarismConfig::$TvUmbrellaRoot.'/account/api'; 19 } 20 21 public function ensure_account() 22 { 23 $response = wp_remote_post($this->api_endpoint.'/charge/customer/ensure', $this->default_args()); 24 25 return self::parse($response); 16 26 } 17 27 … … 83 93 return json_decode($response['body']); ; 84 94 } 95 96 private static function parse($response) 97 { 98 return (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) ? $response : json_decode($response['body']); 99 } 100 101 private function default_args() 102 { 103 return array( 104 'timeout' => 30, 105 'sslverify' => TruVisibilityPlagiarismConfig::$SslVerify, 106 'headers' => array('Authorization' => 'Bearer '.get_option('truvisibility_plagiarism_account')['access-token'])); 107 } 85 108 } 86 109 ?> -
truvisibility-plagiarism-checker/trunk/services/clients/TruVisibilityPlagiarismClient.php
r1773200 r1774331 88 88 } 89 89 90 public function get_plans() 91 { 92 $this->auth_client->update_access_if_expired(); 93 94 $response = wp_remote_get($this->plagiarism_endpoint.'/plans', $this->default_args()); 95 96 return self::parse($response); 97 } 98 90 99 public function notify_about_plagiarized_post($email, $title, $url, $uniqueness, $min_uniqueness) 91 100 {
Note: See TracChangeset
for help on using the changeset viewer.