Plugin Directory

Changeset 1784393


Ignore:
Timestamp:
12/10/2017 08:00:27 PM (8 years ago)
Author:
satoshipay
Message:

update to 0.9

Location:
satoshipay
Files:
2 added
25 edited

Legend:

Unmodified
Added
Removed
  • satoshipay/trunk/assets/css/style_tinymce.css

    r1669082 r1784393  
    99
    1010img.satoshipay-tinymce-placeholder-image {
    11   background: #ffeacc url(../images/tinymce-image.png) no-repeat 15px 15px;
    12   border: 1px solid #ffeacc;
     11  background: #f2fcfe url(../images/tinymce-image.png) no-repeat 15px 15px;
     12  border: 1px solid #f2fcfe;
    1313  cursor: default;
    1414  display: block;
     
    1919
    2020img.satoshipay-tinymce-placeholder-audio {
    21   background: #ffeacc url(../images/tinymce-audio.png) no-repeat 15px 15px;
    22   border: 1px solid #ffeacc;
     21  background: #f2fcfe url(../images/tinymce-audio.png) no-repeat 15px 15px;
     22  border: 1px solid #f2fcfe;
    2323  cursor: default;
    2424  display: block;
     
    2929
    3030img.satoshipay-tinymce-placeholder-video {
    31   background: #ffeacc url(../images/tinymce-video.png) no-repeat 15px 15px;
    32   border: 1px solid #ffeacc;
     31  background: #f2fcfe url(../images/tinymce-video.png) no-repeat 15px 15px;
     32  border: 1px solid #f2fcfe;
    3333  cursor: default;
    3434  display: block;
     
    3939
    4040img.satoshipay-tinymce-placeholder-download {
    41   background: #ffeacc url(../images/tinymce-download.png) no-repeat 15px 15px;
    42   border: 1px solid #ffeacc;
     41  background: #f2fcfe url(../images/tinymce-download.png) no-repeat 15px 15px;
     42  border: 1px solid #f2fcfe;
    4343  cursor: default;
    4444  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+$/, "");
     1var fromLumens = function (lumens, rate) {
     2  return (lumens * rate).toFixed(6).replace(/\.?0+$/, "");
    73};
    84
     
    1814Rates.prototype.fetch = function() {
    1915  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);
    2218  });
    2319};
    2420
    2521/**
    26  * Converts satoshi amounts to fiat.
    27  * @param {number} satoshis Amount as integer
     22 * Converts lumen amounts to fiat.
     23 * @param {number} lumens Amount as integer
    2824 * @return {number}
    2925 */
    30 Rates.prototype.fromSatoshis = function(satoshis) {
     26Rates.prototype.fromLumens = function(lumens) {
    3127  var Promise = jQuery.Deferred();
    3228  this.rate.done(function (rate) {
    33     Promise.resolve(fromSatoshis(satoshis, rate));
     29    Promise.resolve(fromLumens(lumens, rate));
    3430  });
    3531  return Promise.promise();
     
    3935
    4036jQuery(document).ready(function() {
    41   var satoshis = jQuery('#satoshipay_pricing_satoshi').val() || 8000;
    42   convertEur.fromSatoshis(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 + '€');
    4440  });
    4541  jQuery('#satoshipay_pricing_satoshi').on('keyup', function (event) {
    46     var satoshis = event.target.value;
     42    var lumens = event.target.value;
    4743    var max_limit = 2e6;
    4844
    49     if (satoshis > max_limit) {
     45    if (lumens > max_limit) {
    5046      event.target.value = satoshis = max_limit;
    5147    }
    5248
    53     convertEur.fromSatoshis(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 + '€');
    5551    });
    5652  });
  • satoshipay/trunk/assets/js/tinymce_satoshipay.js

    r1669082 r1784393  
    6262        attributes: [
    6363          attributes.attachmentId,
     64          attributes.width,
    6465          attributes.height,
    65           attributes.width,
    6666          attributes.preview
    6767        ]
     
    7474        attributes: [
    7575          attributes.attachmentId,
     76          attributes.width,
    7677          attributes.height,
    77           attributes.width,
    7878          attributes.autoplay,
    7979          attributes.preview
     
    265265          subtype: 'number',
    266266          name: 'price',
    267           label: 'Price (satoshi)',
     267          label: 'Price (lumen)',
    268268          value: item['price']
    269269        }
  • satoshipay/trunk/readme.txt

    r1669082 r1784393  
    22
    33Contributors: satoshipay
    4 Tags: micropayments, bitcoin, blockchain, paypal, paywall, paid content, paid downloads, payment, satoshipay, nanopayments, widget, adblocking, digital goods
     4Tags: micropayments, stellar, lumen, blockchain, paypal, paywall, paid content, paid downloads, payment, satoshipay, nanopayments, widget, adblocking, digital goods
    55Requires at least: 4.4.5
    6 Tested up to: 4.7.5
    7 Stable tag: 0.8
     6Tested up to: 4.9.1
     7Stable tag: 0.9
    88License: MIT
    99License URI: https://opensource.org/licenses/MIT
     
    1515SatoshiPay 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!
    1616
    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. 2000 satoshis) so users are more likely to pay.
     17In 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.
    1818
    1919As 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.
     
    3131There are two options for paid content:
    3232
    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.
     331. 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.
    3434
    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!
     352. 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!
    3636
    3737= How do I show a free teaser of my paid post? =
     
    6666== Screenshots ==
    6767
    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.
     681. Inserting a paid video into a post.
     692. Setting price for paid video.
     703. View post with paid video and SatoshiPay widget.
    71714. Editing and pricing a post.
    72725. Define free-to-read teaser via Start Tag.
     
    7878
    7979== 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.
    8086
    8187= 0.8 =
  • satoshipay/trunk/satoshipay.php

    r1669082 r1784393  
    1212 * Plugin URI:        https://wordpress.org/plugins/satoshipay/
    1313 * 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.8
     14 * Version:           0.9
    1515 * Author:            SatoshiPay
    1616 * Author URI:        https://satoshipay.io
     
    3030// Plugin version, used in user-agent string for API calls; keep in sync with
    3131// version in plugin description above!
    32 define('SATOSHIPAY_VERSION', '0.8');
     32define('SATOSHIPAY_VERSION', '0.9');
    3333
    3434// Plugin root file
     
    6060}
    6161if (!defined('SATOSHIPAY_API_URL')) {
    62     define('SATOSHIPAY_API_URL', 'https://api.satoshipay.io/v1');
     62    define('SATOSHIPAY_API_URL', 'https://api.satoshipay.io/v2');
    6363}
    6464if (!defined('SATOSHIPAY_CLIENT_URL')) {
     
    8080    add_action('plugins_loaded', array(SatoshiPayPlugin::getInstance(__FILE__), 'init'));
    8181}
     82
     83// installation procedure
     84include_once __DIR__ . '/src/SatoshiPay/SatoshiPayInstall.php';
     85register_activation_hook(__FILE__, array( 'SatoshiPay\SatoshiPayInstall', 'install' ) );
  • satoshipay/trunk/src/SatoshiPay/Api/Client.php

    r1669082 r1784393  
    6565    public function createNewGood(array $goodData)
    6666    {
     67        // set asset to XLM (Lumens)
     68        $goodData['asset'] = 'XLM';
     69
     70        // transform price from lumen to stroops
     71        $goodData['price'] *= 10000000;
     72
    6773        $url = rtrim($this->serverUrl, '/') . '/goods';
    6874        $body = json_encode($goodData);
     
    8591            return;
    8692        }
     93        // set asset to XLM (Lumens)
     94        $goodData['asset'] = 'XLM';
     95
     96        // transform price from lumen to stroops
     97        $goodData['price'] *= 10000000;
     98
    8799        $url = rtrim($this->serverUrl, '/') . '/goods/' . (string)$goodId;
    88100        $body = json_encode($goodData);
     
    123135            return false;
    124136        }
    125        
     137
    126138        return (int)$request['response']['code'];
    127139    }
  • satoshipay/trunk/src/SatoshiPay/SatoshiPayAdminPlugin.php

    r1669082 r1784393  
    404404            $output['price'] = $this->validateAdBlockerDetectionPrice($input);
    405405            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.';
    407407                add_settings_error('price', 'price', $errorMessage, 'error');
    408408                $output = $currentValues;
     
    839839                    'title' => $post->post_title,
    840840                    'url' => get_permalink($post->ID),
    841                     'spmeta' => json_encode($metaData),
     841                    'spmeta' => json_encode($metaData)
    842842                );
    843843
     
    857857                // Update metadata `_satoshipay_id` for post
    858858                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);
    859862            }
    860863        }
     
    12981301                            'title' => $post->post_title,
    12991302                            'url' => get_permalink($post->ID),
    1300                             'spmeta' => $metaData,
     1303                            'spmeta' => $metaData
    13011304                        ),
    13021305                    );
  • satoshipay/trunk/src/SatoshiPay/SatoshiPayPlugin.php

    r1669082 r1784393  
    189189        $satoshipayId = get_post_meta($post->ID, '_satoshipay_id', true);
    190190        $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') {
    193194            return false;
    194195        }
     
    398399    {
    399400        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="(.*)")?-->/',
    401402            function ($matches) {
    402403                $attachmentId = $matches[2];
    403404                $attachmentAttributes = array(
    404                     'height' => $matches[4],
    405                     'width' => $matches[6],
     405                    'height' => $matches[6],
     406                    'width' => $matches[4],
    406407                    'autoplay' => $matches[8],
    407408                    'preview' => $matches[10],
  • satoshipay/trunk/views/admin/options/ad_blocker_detection_section/settings.phtml

    r1338096 r1784393  
    66    </label>
    77  </p>
    8  
     8
    99  <p>
    1010    <label>
     
    1313    </label>
    1414  </p>
    15  
     15
    1616  <ul>
    1717    <li>
     
    1919        Price:
    2020        <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/page
     21        lumens per post/page
    2222      </label>
    2323    </li>
  • satoshipay/trunk/views/admin/posts/metabox.phtml

    r1669082 r1784393  
    1212    <label for="satoshipay_pricing_satoshi"><span class="label"><?php _e('Price', $this->textdomain); ?></span></label>
    1313    <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>
    1515    <span class="legend" id="satoshipay_pricing_satoshi_fiat"></span>
    1616</div>
Note: See TracChangeset for help on using the changeset viewer.