Changeset 1784393
- Timestamp:
- 12/10/2017 08:00:27 PM (8 years ago)
- Location:
- satoshipay
- Files:
-
- 2 added
- 25 edited
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (modified) (previous)
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-10.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
assets/screenshot-3.png (modified) (previous)
-
assets/screenshot-4.png (modified) (previous)
-
assets/screenshot-5.png (modified) (previous)
-
assets/screenshot-6.png (modified) (previous)
-
assets/screenshot-7.png (modified) (previous)
-
assets/screenshot-8.png (modified) (previous)
-
assets/screenshot-9.png (modified) (previous)
-
trunk/assets/css/style_tinymce.css (modified) (4 diffs)
-
trunk/assets/images/tinymce-audio.png (modified) (previous)
-
trunk/assets/images/tinymce-download.png (modified) (previous)
-
trunk/assets/images/tinymce-image.png (modified) (previous)
-
trunk/assets/images/tinymce-video.png (modified) (previous)
-
trunk/assets/js/script_post.js (modified) (3 diffs)
-
trunk/assets/js/tinymce_satoshipay.js (modified) (3 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/satoshipay.php (modified) (4 diffs)
-
trunk/src/SatoshiPay/Api/Client.php (modified) (3 diffs)
-
trunk/src/SatoshiPay/SatoshiPayAdminPlugin.php (modified) (4 diffs)
-
trunk/src/SatoshiPay/SatoshiPayInstall.php (added)
-
trunk/src/SatoshiPay/SatoshiPayPlugin.php (modified) (2 diffs)
-
trunk/views/admin/options/ad_blocker_detection_section/settings.phtml (modified) (3 diffs)
-
trunk/views/admin/posts/metabox.phtml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
satoshipay/trunk/assets/css/style_tinymce.css
r1669082 r1784393 9 9 10 10 img.satoshipay-tinymce-placeholder-image { 11 background: #f feaccurl(../images/tinymce-image.png) no-repeat 15px 15px;12 border: 1px solid #f feacc;11 background: #f2fcfe url(../images/tinymce-image.png) no-repeat 15px 15px; 12 border: 1px solid #f2fcfe; 13 13 cursor: default; 14 14 display: block; … … 19 19 20 20 img.satoshipay-tinymce-placeholder-audio { 21 background: #f feaccurl(../images/tinymce-audio.png) no-repeat 15px 15px;22 border: 1px solid #f feacc;21 background: #f2fcfe url(../images/tinymce-audio.png) no-repeat 15px 15px; 22 border: 1px solid #f2fcfe; 23 23 cursor: default; 24 24 display: block; … … 29 29 30 30 img.satoshipay-tinymce-placeholder-video { 31 background: #f feaccurl(../images/tinymce-video.png) no-repeat 15px 15px;32 border: 1px solid #f feacc;31 background: #f2fcfe url(../images/tinymce-video.png) no-repeat 15px 15px; 32 border: 1px solid #f2fcfe; 33 33 cursor: default; 34 34 display: block; … … 39 39 40 40 img.satoshipay-tinymce-placeholder-download { 41 background: #f feaccurl(../images/tinymce-download.png) no-repeat 15px 15px;42 border: 1px solid #f feacc;41 background: #f2fcfe url(../images/tinymce-download.png) no-repeat 15px 15px; 42 border: 1px solid #f2fcfe; 43 43 cursor: default; 44 44 display: block; -
satoshipay/trunk/assets/js/script_post.js
r1360759 r1784393 1 var satoshiToBtc = function (satoshis) { 2 return satoshis / Math.pow(10,8); 3 }; 4 5 var fromSatoshis = function (satoshis, rate) { 6 return (satoshiToBtc(satoshis) * rate).toFixed(6).replace(/\.?0+$/, ""); 1 var fromLumens = function (lumens, rate) { 2 return (lumens * rate).toFixed(6).replace(/\.?0+$/, ""); 7 3 }; 8 4 … … 18 14 Rates.prototype.fetch = function() { 19 15 var self = this; 20 jQuery.get('https:// bitpay.com/api/rates/' + this.currency, function(res) {21 self.rate.resolve(res .rate);16 jQuery.get('https://api.coinmarketcap.com/v1/ticker/stellar/?convert=EUR', function(res) { 17 self.rate.resolve(res[0].price_eur); 22 18 }); 23 19 }; 24 20 25 21 /** 26 * Converts satoshiamounts to fiat.27 * @param {number} satoshis Amount as integer22 * Converts lumen amounts to fiat. 23 * @param {number} lumens Amount as integer 28 24 * @return {number} 29 25 */ 30 Rates.prototype.from Satoshis = function(satoshis) {26 Rates.prototype.fromLumens = function(lumens) { 31 27 var Promise = jQuery.Deferred(); 32 28 this.rate.done(function (rate) { 33 Promise.resolve(from Satoshis(satoshis, rate));29 Promise.resolve(fromLumens(lumens, rate)); 34 30 }); 35 31 return Promise.promise(); … … 39 35 40 36 jQuery(document).ready(function() { 41 var satoshis = jQuery('#satoshipay_pricing_satoshi').val() || 8000;42 convertEur.from Satoshis(satoshis).done(function (eur) {43 jQuery('#satoshipay_pricing_satoshi_fiat').html( satoshis + ' Satoshi≅ ' + eur + '€');37 var lumens = jQuery('#satoshipay_pricing_satoshi').val() || 8000; 38 convertEur.fromLumens(lumens).done(function (eur) { 39 jQuery('#satoshipay_pricing_satoshi_fiat').html(lumens + ' lumens ≅ ' + eur + '€'); 44 40 }); 45 41 jQuery('#satoshipay_pricing_satoshi').on('keyup', function (event) { 46 var satoshis = event.target.value;42 var lumens = event.target.value; 47 43 var max_limit = 2e6; 48 44 49 if ( satoshis > max_limit) {45 if (lumens > max_limit) { 50 46 event.target.value = satoshis = max_limit; 51 47 } 52 48 53 convertEur.from Satoshis(satoshis).done(function (eur) {54 jQuery('#satoshipay_pricing_satoshi_fiat').html( satoshis + ' Satoshis ≅ ' + eur + '€');49 convertEur.fromLumens(lumens).done(function (eur) { 50 jQuery('#satoshipay_pricing_satoshi_fiat').html(lumens + ' lumens ≅ ' + eur + '€'); 55 51 }); 56 52 }); -
satoshipay/trunk/assets/js/tinymce_satoshipay.js
r1669082 r1784393 62 62 attributes: [ 63 63 attributes.attachmentId, 64 attributes.width, 64 65 attributes.height, 65 attributes.width,66 66 attributes.preview 67 67 ] … … 74 74 attributes: [ 75 75 attributes.attachmentId, 76 attributes.width, 76 77 attributes.height, 77 attributes.width,78 78 attributes.autoplay, 79 79 attributes.preview … … 265 265 subtype: 'number', 266 266 name: 'price', 267 label: 'Price ( satoshi)',267 label: 'Price (lumen)', 268 268 value: item['price'] 269 269 } -
satoshipay/trunk/readme.txt
r1669082 r1784393 2 2 3 3 Contributors: satoshipay 4 Tags: micropayments, bitcoin, blockchain, paypal, paywall, paid content, paid downloads, payment, satoshipay, nanopayments, widget, adblocking, digital goods4 Tags: micropayments, stellar, lumen, blockchain, paypal, paywall, paid content, paid downloads, payment, satoshipay, nanopayments, widget, adblocking, digital goods 5 5 Requires at least: 4.4.5 6 Tested up to: 4. 7.57 Stable tag: 0. 86 Tested up to: 4.9.1 7 Stable tag: 0.9 8 8 License: MIT 9 9 License URI: https://opensource.org/licenses/MIT … … 15 15 SatoshiPay is a cross-website, 1-click content payment service based on blockchain technology. To use SatoshiPay your readers don't need to sign up anywhere or download any additional software. If they come to your site with a pre-filled wallet, they will be able to pay for your content with just a single click. Generating extra income with your content through micro or nanopayments has never been this easy! 16 16 17 In addition to charging per post, image, audio, video or download, you can also enable an ad blocker detection, which asks users that have an ad blocker installed for a payment on each post they visit. You can set your own price for this. We recommend to set it low (e.g. 2 000 satoshis) so users are more likely to pay.17 In addition to charging per post, image, audio, video or download, you can also enable an ad blocker detection, which asks users that have an ad blocker installed for a payment on each post they visit. You can set your own price for this. We recommend to set it low (e.g. 2 lumens) so users are more likely to pay. 18 18 19 19 As a publisher you only need to install the plugin, register at [SatoshiPay Dashboard](https://dashboard.satoshipay.io/sign-up), create a blockchain wallet for your earnings, and you are ready to go. … … 31 31 There are two options for paid content: 32 32 33 1. Paid posts: Simply edit the post or page you want to charge for, activate the "Paid Post" checkbox in the SatoshiPay metabox on the right, set a price (for example 4000 satoshis - that's less than 15c), and press Publish/Update. Your post will now show the SatoshiPay payment interface to your reader and will only be accessible after the reader pays for it.33 1. Paid posts: Simply edit the post or page you want to charge for, activate the "Paid Post" checkbox in the SatoshiPay metabox on the right, set a price (for example 2 lumens - that's less than 30c), and press Publish/Update. Your post will now show the SatoshiPay payment interface to your reader and will only be accessible after the reader pays for it. 34 34 35 2. Paid media inside a post: Edit a post and select "Add Paid Audio" from the SatoshiPay menu in the top toolbar of the visual editor. The media library will open and let you pick an existing audio file or upload one. Select an audio file and press "Insert". The next dialog will let you set a price (for example 8000 satoshis - that's less than 30c). Press "OK" to insert the paid audio. The editor will display a placeholder where the audio will appear on your post. Click the placeholder to edit options or remove the paid audio from the post. The procedure is very similar for paid downloads, images and videos. Try it out!35 2. Paid media inside a post: Edit a post and select "Add Paid Audio" from the SatoshiPay menu in the top toolbar of the visual editor. The media library will open and let you pick an existing audio file or upload one. Select an audio file and press "Insert". The next dialog will let you set a price (for example 4 lumens - that's less than 50c). Press "OK" to insert the paid audio. The editor will display a placeholder where the audio will appear on your post. Click the placeholder to edit options or remove the paid audio from the post. The procedure is very similar for paid downloads, images and videos. Try it out! 36 36 37 37 = How do I show a free teaser of my paid post? = … … 66 66 == Screenshots == 67 67 68 1. NEW:Inserting a paid video into a post.69 2. NEW:Setting price for paid video.70 3. NEW:View post with paid video and SatoshiPay widget.68 1. Inserting a paid video into a post. 69 2. Setting price for paid video. 70 3. View post with paid video and SatoshiPay widget. 71 71 4. Editing and pricing a post. 72 72 5. Define free-to-read teaser via Start Tag. … … 78 78 79 79 == Changelog == 80 81 = 0.9 = 82 83 * Added support for Stellar lumens. Your old satoshi prices will be automatically converted when installing this version. 84 * Removed Bitcoin support. 85 * Fixed bug incorrectly displaying image/video dimensions. 80 86 81 87 = 0.8 = -
satoshipay/trunk/satoshipay.php
r1669082 r1784393 12 12 * Plugin URI: https://wordpress.org/plugins/satoshipay/ 13 13 * Description: Integrates SatoshiPay into WordPress. Quick start: 1) Select SatoshiPay from the left-hand admin menu, 2) add SatoshiPay API credentials, 3) edit a post, 4) activate "Paid Post" in SatoshiPay meta box, 5) set a price, 6) publish and view post. The SatoshiPay widget will appear and allow readers to pay for the post. 14 * Version: 0. 814 * Version: 0.9 15 15 * Author: SatoshiPay 16 16 * Author URI: https://satoshipay.io … … 30 30 // Plugin version, used in user-agent string for API calls; keep in sync with 31 31 // version in plugin description above! 32 define('SATOSHIPAY_VERSION', '0. 8');32 define('SATOSHIPAY_VERSION', '0.9'); 33 33 34 34 // Plugin root file … … 60 60 } 61 61 if (!defined('SATOSHIPAY_API_URL')) { 62 define('SATOSHIPAY_API_URL', 'https://api.satoshipay.io/v 1');62 define('SATOSHIPAY_API_URL', 'https://api.satoshipay.io/v2'); 63 63 } 64 64 if (!defined('SATOSHIPAY_CLIENT_URL')) { … … 80 80 add_action('plugins_loaded', array(SatoshiPayPlugin::getInstance(__FILE__), 'init')); 81 81 } 82 83 // installation procedure 84 include_once __DIR__ . '/src/SatoshiPay/SatoshiPayInstall.php'; 85 register_activation_hook(__FILE__, array( 'SatoshiPay\SatoshiPayInstall', 'install' ) ); -
satoshipay/trunk/src/SatoshiPay/Api/Client.php
r1669082 r1784393 65 65 public function createNewGood(array $goodData) 66 66 { 67 // set asset to XLM (Lumens) 68 $goodData['asset'] = 'XLM'; 69 70 // transform price from lumen to stroops 71 $goodData['price'] *= 10000000; 72 67 73 $url = rtrim($this->serverUrl, '/') . '/goods'; 68 74 $body = json_encode($goodData); … … 85 91 return; 86 92 } 93 // set asset to XLM (Lumens) 94 $goodData['asset'] = 'XLM'; 95 96 // transform price from lumen to stroops 97 $goodData['price'] *= 10000000; 98 87 99 $url = rtrim($this->serverUrl, '/') . '/goods/' . (string)$goodId; 88 100 $body = json_encode($goodData); … … 123 135 return false; 124 136 } 125 137 126 138 return (int)$request['response']['code']; 127 139 } -
satoshipay/trunk/src/SatoshiPay/SatoshiPayAdminPlugin.php
r1669082 r1784393 404 404 $output['price'] = $this->validateAdBlockerDetectionPrice($input); 405 405 if ($output['price'] === false) { 406 $errorMessage = 'The price you entered does not appear to be valid. Please enter a whole number for satoshis per post/page.';406 $errorMessage = 'The price you entered does not appear to be valid. Please enter a whole number for lumens per post/page.'; 407 407 add_settings_error('price', 'price', $errorMessage, 'error'); 408 408 $output = $currentValues; … … 839 839 'title' => $post->post_title, 840 840 'url' => get_permalink($post->ID), 841 'spmeta' => json_encode($metaData) ,841 'spmeta' => json_encode($metaData) 842 842 ); 843 843 … … 857 857 // Update metadata `_satoshipay_id` for post 858 858 update_post_meta($post->ID, '_satoshipay_id', $satoshiPayId, true); 859 860 // Update metadata `_satoshipay_asset` for post 861 update_post_meta($post->ID, '_satoshipay_asset', 'XLM', true); 859 862 } 860 863 } … … 1298 1301 'title' => $post->post_title, 1299 1302 'url' => get_permalink($post->ID), 1300 'spmeta' => $metaData ,1303 'spmeta' => $metaData 1301 1304 ), 1302 1305 ); -
satoshipay/trunk/src/SatoshiPay/SatoshiPayPlugin.php
r1669082 r1784393 189 189 $satoshipayId = get_post_meta($post->ID, '_satoshipay_id', true); 190 190 $pricing = get_post_meta($post->ID, '_satoshipay_pricing', true); 191 192 if (!$satoshipayId || empty($pricing) || !isset($pricing['enabled']) || $pricing['enabled'] !== true) { 191 $asset = get_post_meta($post->ID, '_satoshipay_asset', true); 192 193 if (!$satoshipayId || empty($pricing) || !isset($pricing['enabled']) || $pricing['enabled'] !== true || empty($asset) || $asset !== 'XLM') { 193 194 return false; 194 195 } … … 398 399 { 399 400 return preg_replace_callback( 400 '/<!--satoshipay:(image|audio|video|download).*attachment-id="(\d+)"(.* height="(\d+)")?(.*width="(\d+)")?(.*autoplay="(true|false)")?(.*preview="(.*)")?-->/',401 '/<!--satoshipay:(image|audio|video|download).*attachment-id="(\d+)"(.*width="(\d+)")?(.*height="(\d+)")?(.*autoplay="(true|false)")?(.*preview="(.*)")?-->/', 401 402 function ($matches) { 402 403 $attachmentId = $matches[2]; 403 404 $attachmentAttributes = array( 404 'height' => $matches[ 4],405 'width' => $matches[ 6],405 'height' => $matches[6], 406 'width' => $matches[4], 406 407 'autoplay' => $matches[8], 407 408 'preview' => $matches[10], -
satoshipay/trunk/views/admin/options/ad_blocker_detection_section/settings.phtml
r1338096 r1784393 6 6 </label> 7 7 </p> 8 8 9 9 <p> 10 10 <label> … … 13 13 </label> 14 14 </p> 15 15 16 16 <ul> 17 17 <li> … … 19 19 Price: 20 20 <input type="text" id="satoshipay_ad_blocker_detection_price" class="medium-text" name="satoshipay_ad_blocker_detection[price]" value="<?php echo esc_attr($price); ?>" <?php echo $enabled ? '' : 'disabled="disabled"'; ?> /> 21 satoshis per post/page21 lumens per post/page 22 22 </label> 23 23 </li> -
satoshipay/trunk/views/admin/posts/metabox.phtml
r1669082 r1784393 12 12 <label for="satoshipay_pricing_satoshi"><span class="label"><?php _e('Price', $this->textdomain); ?></span></label> 13 13 <input class="price" type="number" name="satoshipay_pricing_satoshi" id="satoshipay_pricing_satoshi" value="<?php echo ((isset($pricing['satoshi']) && $pricing['enabled']) ? esc_attr($pricing['satoshi']) : ''); ?>" <?php echo ($validCredentials ? '' : 'disabled="disabled"') ?>> 14 <span class="legend"><?php _e('In satoshis, e.g. "8000" (max. "2000000")', $this->textdomain); ?></span>14 <span class="legend"><?php _e('In lumens, e.g. "2" (max. "2000000")', $this->textdomain); ?></span> 15 15 <span class="legend" id="satoshipay_pricing_satoshi_fiat"></span> 16 16 </div>
Note: See TracChangeset
for help on using the changeset viewer.