Plugin Directory

Changeset 1977635


Ignore:
Timestamp:
11/20/2018 07:43:47 PM (7 years ago)
Author:
zwaply
Message:

Zwaply update

Location:
cryptocurrency-prices
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • cryptocurrency-prices/trunk/cryptocurrency-prices.php

    r1965350 r1977635  
    77Plugin URI: https://zwaply.com/
    88Description: Provides multiple cryptocurrency features: accepting payments, displaying prices and exchange rates, cryptocurrency calculator, accepting donations.
    9 Version: 3.0.11
    10 Author: zwaply
     9Version: 3.0.12
     10Author: Zwaply
    1111Author URI: https://zwaply.com/
    1212Text Domain: cryprocurrency-prices
     
    2727require_once( dirname( __FILE__ ) . '/includes/currencytickerwidget.class.php' );
    2828require_once( dirname( __FILE__ ) . '/includes/common.class.php' );
     29require_once( dirname( __FILE__ ) . '/includes/cryptocurrency-dashboard-affiliate.php' );
    2930
    3031if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
     
    5051//add custom stylesheet
    5152add_action('wp_head', array( 'CPCommon', 'cp_custom_styles'), 100);
    52 add_action( 'wp_enqueue_scripts', array( 'CPCommon', 'cp_enqueue_styles') );
     53add_action( 'wp_enqueue_scripts', array( 'CPCommon', 'cp_enqueue_styles'), 15 );
     54
     55//add admin stylesheet
     56add_action( 'admin_enqueue_scripts', array( 'CPCommon', 'cp_enqueue_admin_styles'), 15 );
    5357
    5458//add translation
  • cryptocurrency-prices/trunk/css/cp_dark.css

    r1960857 r1977635  
    7979}
    8080
     81table.cp-table button {
     82
     83  padding: 0 1.1rem;
     84
     85}
     86
    8187/* form styles */
    8288
  • cryptocurrency-prices/trunk/css/cp_light.css

    r1960857 r1977635  
    7979}
    8080
     81table.cp-table button {
     82
     83  padding: 0 1.1rem;
     84
     85}
     86
    8187/* form styles */
    8288
  • cryptocurrency-prices/trunk/includes/admin.class.php

    r1928926 r1977635  
    3131    //add admin menu
    3232
    33     add_action('admin_menu', array( 'CPAdmin', 'register_menu_page' ));
    34 
     33    add_action( 'admin_menu', array( 'CPAdmin', 'register_menu_page' ) );
     34        add_action( 'admin_init', array( 'CPAdmin', 'dismiss_notices' ) );
     35        add_action( 'admin_notices', array( 'CPAdmin', 'admin_notices' ) );
     36
     37  }
     38 
     39    public static function admin_notices() {
     40        if ( get_option( 'cryptocurrency-hide-update-notice-3.0.12' ) != true ) {
     41            ?>
     42    <div class="notice notice-info is-dismissible">
     43        <p><?php _e( 'Thanks for updating Cryptocurrency. With this new version, you can now EARN CRYPTO! Rush to <a target="_blank" href="https://zwaply.com/register/">create your Zwaply username</a> and start earning crypto. <a target="_blank" href="https://zwaply.com/zwaply-for-web/">Learn more about Zwaply</a>.', 'cryptocurrency-prices' ); ?></p>
     44        <p style="margin-bottom:10px;font-size: 8pt;"><a href="<?php echo admin_url( '?action=cryptocurrency-dismiss-update-notice' ); ?>"><?php _e( 'Dismiss notice', 'crypto-coin-ticker' ); ?></a></p>
     45    </div>
     46            <?php
     47        }
    3548    }
    3649
     50    public static function dismiss_notices() {
     51        if ( isset( $_GET['action'] ) && 'cryptocurrency-dismiss-update-notice' === $_GET['action'] ) {
     52            update_option( 'cryptocurrency-hide-update-notice-3.0.12', true );
     53        }
     54    }
     55
    3756 
    3857
     
    117136      'cryptocurrency-prices',
    118137
     138      __( 'Affiliate Panel', 'cryptocurrency' ),
     139
     140      __( 'Affiliate Panel', 'cryptocurrency' ),
     141
     142      'manage_options',
     143
     144      'affiliate-panel',
     145
     146      array('CPAdmin', 'cryptocurrency_prices_admin_affiliate_panel')
     147
     148    );
     149
     150   
     151
     152    add_submenu_page(
     153
     154      'cryptocurrency-prices',
     155
    119156      __( 'Premium and Updates', 'cryptocurrency' ),
    120157
     
    245282     
    246283
    247   }     
     284  } 
     285
     286 
     287
     288  public static function cryptocurrency_prices_admin_affiliate_panel(){
     289
     290    //check if user has admin capability
     291
     292    if (current_user_can( 'manage_options' )){
     293          include_once dirname( __FILE__ ) . '/../parts/cryptocurrency-affiliate-panel.php';
     294    }
     295     
     296
     297  }     
    248298
    249299 
     
    257307      $admin_message_html = '';
    258308
     309     
     310
     311      if (isset($_POST['cryptocurrency-prices-zwaply-affiliate-id'])){
     312
     313        //check nonce
     314
     315        check_admin_referer( self::NONCE );
     316
     317       
     318
     319        $sanitized_ethereum_api = sanitize_text_field($_POST['cryptocurrency-prices-zwaply-affiliate-id']);
     320
     321        update_option('cryptocurrency-prices-zwaply-affiliate-id', $sanitized_ethereum_api);
     322
     323        $admin_message_html = '<div class="notice notice-success"><p>Plugin settings have been updated!</p></div>';
     324
     325      }
     326
    259327
    260328
     
    275343      }
    276344
     345
     346      if (isset($_POST['cryptocurrency-prices-show-trade-button'])){
     347
     348        //check nonce
     349
     350        check_admin_referer( self::NONCE );
     351
     352       
     353
     354        $show_trade_button = 'yes' === $_POST['cryptocurrency-prices-show-trade-button'] ? 'yes' : 'no';
     355
     356        update_option('cryptocurrency-prices-show-trade-button', $show_trade_button);
     357
     358        $admin_message_html = '<div class="notice notice-success"><p>Plugin settings have been updated!</p></div>';
     359
     360      }
     361
    277362     
    278363
     
    328413
    329414      }
    330 
    331415     
    332416
     417      $show_trade_button_option_yes = '';
     418
     419      $show_trade_button_option_no = '';
     420
     421      if (get_option('cryptocurrency-prices-show-trade-button') == 'yes'){
     422
     423        $show_trade_button_option_yes = 'selected="selected"';
     424
     425      } elseif (get_option('cryptocurrency-prices-show-trade-button') == 'no'){
     426
     427        $show_trade_button_option_no = 'selected="selected"';
     428
     429      }
     430
     431     
     432
    333433      echo '
    334434
     
    343443        <form action="" method="post">
    344444
     445          <h2>Affiliate:</h2>
     446
     447          <label>Your Zwaply.com username: </label>
     448
     449          <div style="display: inline-block;">
     450          <label for="cryptocurrency-prices-zwaply-affiliate-id">
     451            <input class="cryptocurrency-prices-zwaply-affiliate-id" id="cryptocurrency-prices-zwaply-affiliate-id" name="cryptocurrency-prices-zwaply-affiliate-id" type="text" value="'.get_option('cryptocurrency-prices-zwaply-affiliate-id').'">
     452          </label>
     453          <span><span class="description"><a href="https://zwaply.com/register/" target="_blank">Get yours here to start earning crypto</a></span></span>
     454          </div>
     455
    345456          <h2>Design:</h2>
    346457
     458          <label>Show Trade button: </label>
     459
     460          <select name="cryptocurrency-prices-show-trade-button">
     461
     462            <option value="yes" '.$show_trade_button_option_yes.'>Yes</option>
     463
     464            <option value="no" '.$show_trade_button_option_no.'>No</option>
     465
     466          </select>
     467
     468          <p></p>
     469
    347470          <label>Use default design (insludes default CSS): </label>
    348471
  • cryptocurrency-prices/trunk/includes/common.class.php

    r1928926 r1977635  
    33
    44  public static function cp_enqueue_styles(){
     5    wp_enqueue_style('cp-base', CP_URL.'css/cp_base.css');
     6
    57    $default_css = get_option('cryptocurrency-prices-default-css');
    68    wp_register_style('cp-'.$default_css, CP_URL.'css/cp_'.$default_css.'.css');
    79    wp_enqueue_style('cp-'.$default_css);
     10  }
     11
     12  public static function cp_enqueue_admin_styles(){
     13    wp_enqueue_style('cp-admin', CP_URL.'css/cp_admin.css');
    814  }
    915 
  • cryptocurrency-prices/trunk/includes/currencyall.class.php

    r1965333 r1977635  
    4141    } else {
    4242
    43       $perpage = 100;
     43      $perpage = 10;
    4444
    4545    }
     
    5959    }
    6060
     61    $show_trade_button = 'no' !== get_option('cryptocurrency-prices-show-trade-button');
     62
     63    $affiliate_id = get_option('cryptocurrency-prices-zwaply-affiliate-id');
    6164
    6265
     
    8184    var apiUrl = \'https://api.coinmarketcap.com/v1/ticker/?convert=\'+\''.$base_currency.'\'+\'&limit='.$limit.'\';
    8285
    83     console.log(apiUrl);
     86    var coinsNames = {};
    8487
    8588    jQuery.get( apiUrl, function( data ) {
     
    9396      for (var currentCurrency in data){
    9497
     98        coinPriceData = "";
     99        if (toCurrency == "USD") {
     100          coinPriceData = data[currentCurrency].price_usd;
     101          var price_number = parseFloat(coinPriceData);
     102          if (price_number > 1.0) {
     103            // Round to 3 decimal places after zero
     104            price_number = parseFloat(price_number).toFixed(2);
     105          } else {
     106            // Round to 6 decimal places after zero
     107            price_number = parseFloat(price_number).toFixed(6);
     108          }
     109          coinPriceData = price_number;
     110        } else if (toCurrency == "Satoshi") {
     111     
     112          // 1 Bitcoin = 100m Satoshi
     113          coinPriceData = data[currentCurrency].price_btc;
     114          var price_number = parseFloat(coinPriceData);
     115          price_number = price_number * 100000000;
     116          if (price_number > 1.0) {
     117            // Round to 3 decimal places after zero
     118            price_number = parseFloat(price_number).toFixed(2);
     119          } else {
     120            // Round to 6 decimal places after zero
     121            price_number = parseFloat(price_number).toFixed(6);
     122          }
     123          coinPriceData = price_number;
     124        } else {
     125          lcCurrency = toCurrency.toLowerCase();
     126          coinPriceKey = "price_".lcCurrency; // should be: price_eur
     127     
     128          for (var key in data[currentCurrency]) {
     129            if (key.indexOf(coinPriceKey) !== -1) {
     130              var price_number = parseFloat(data[currentCurrency][key]);
     131              if (price_number > 1.0) {
     132                // Round to 3 decimal places after zero
     133                price_number = parseFloat(price_number).toFixed(2);
     134              } else {
     135                // Round to 6 decimal places after zero
     136                price_number = parseFloat(price_number).toFixed(6);
     137              }
     138              coinPriceData = price_number;
     139            }
     140          }
     141        }
     142
    95143        //console.log(data[currentCurrency]);
    96144
    97145        var name = data[currentCurrency].name;
    98146
     147        var symbol = data[currentCurrency].symbol;
     148
    99149        var rank = data[currentCurrency].rank;
    100150
    101         var price_number = data[currentCurrency][\'price_'.mb_strtolower($base_currency).'\'];
     151        //var price_number = data[currentCurrency][\'price_'.mb_strtolower($base_currency).'\'];
    102152
    103153        //var price = price_number.toLocaleString('.$locale.')+\' \'+toCurrency;
     
    111161        if (data[currentCurrency].percent_change_24h > 0){
    112162
     163          data[currentCurrency].percent_change_24h = "+" + data[currentCurrency].percent_change_24h;
     164
    113165          var changeClass = "change-inc";
    114166
     
    119171        }
    120172
    121         var change = "<span class=\""+changeClass+"\">"+data[currentCurrency].percent_change_24h+\'%\'+"</span>";
     173        var percent_change_24h = parseFloat( data[currentCurrency].percent_change_24h ).toFixed(2);
     174
     175        var change = "<span class=\""+changeClass+"\">"+percent_change_24h+\'%\'+"</span>";
    122176
    123177        var marketCap = parseInt(data[currentCurrency][\'market_cap_'.mb_strtolower($base_currency).'\']).toLocaleString('.$locale.');
    124178
    125         var image = "<img class=\"lazy\" data-src=\"'.CP_URL.'images/coins32x32/"+data[currentCurrency].symbol.toLowerCase()+".png\" style=\"max-width:20px;\" />";
     179        var image = "<img class=\"lazy\" data-src=\"'.CP_URL.'images/coins32x32/"+symbol.toLowerCase()+".png\" style=\"max-width:20px;\" />";
    126180
    127181       
    128 
    129         dataSet.push([rank, image+\' \'+name, marketCap, price, volume, supply, change]);
     182        coinsNames[symbol] = data[currentCurrency].name;
     183
     184        dataSet.push([symbol, rank, image+\' \'+name + " (" + symbol.toUpperCase() + ")", "$" + price, change, ' . ( $show_trade_button ? '"TRADE BUTTON", ' : '' ) . '"$" + marketCap]);
    130185
    131186      }
     
    135190      //show datatable
    136191
    137       jQuery(".cp-cryptocurrencies-table").DataTable({
     192      var dataTableArgs = {
    138193
    139194        data: dataSet,
    140195
    141         columns: [{ title: "#" },{ title: "Coin" }, { title: "Market Cap, '.$base_currency.'" }, { title: "Price, '.$base_currency.'" }, { title: "Volume (24h), '.$base_currency.'" }, { title: "Circulating supply" }, { title: "Change (24h)" }, ],
    142 
    143         "order": [ [0, \'asc\'] ],
     196        columns: [
     197          { title: "Symbol" },
     198          { title: "#" },
     199          {
     200            title: "Coin",
     201            data: null,
     202            render: function ( data, type, row ) {
     203              var nameValue = coinsNames[data[0]].toLowerCase().replace(" ", "-");
     204              return "<a href=\"https://coinmarketcap.com/currencies/"+nameValue+"/\" ref=\"nofollow\" target=\"_blank\">" + data[2] + "</a>"
     205            }
     206          },
     207          { title: "Price ('.$base_currency.')" },
     208          { title: "Change (24h)" },
     209          ' . ( $show_trade_button ? '{ title: "TRADE" },' : '' ) . '
     210          { title: "Market Cap ('.$base_currency.')" },
     211        ],
     212
     213        "order": [ [1, \'asc\'] ],
    144214
    145215        "pageLength": '.$perpage.',
     
    147217        "lengthMenu": [ [10, 50, 100, 500, 1000, -1], [10, 50, 100, 500, 1000, "All"] ],
    148218
     219        oLanguage: {
     220
     221          sSearch: "",
     222 
     223          sSearchPlaceholder: "Search coins",
     224         
     225          "sInfo": "Showing _START_ to _END_ of _TOTAL_",
     226         
     227          "sInfoEmpty": "Showing 0 to 0 of 0",
     228         
     229          "sInfoFiltered": "(filtered from _MAX_ total)",
     230         
     231          "sLengthMenu": "Show _MENU_",
     232
     233        },
     234
    149235        drawCallback: function() {
    150236
     
    161247        },
    162248
     249        "columnDefs": [ {
     250
     251          "targets": 0,
     252
     253          "visible": false,
     254
     255          "searchable": false
     256
     257        },
     258
     259        ' . ( $show_trade_button ? '{
     260
     261          "targets": 5,
     262
     263          "responsivePriority": 1,
     264
     265          "data": null,
     266
     267          "defaultContent": "<button class=\'trade-button\'>TRADE</button>"
     268
     269        },' : '' ) . '
     270
     271         ],
     272
    163273        responsive: true,
    164274
     275        dom: \'<"top">t<"bottom"<lp>f<"dataTables_powered_by">><"clear">\',
     276
     277        pagingType: "simple",
     278
     279      };
     280
     281      if( "function" === typeof jQuery().DataTable ) {
     282
     283        cpInitDataTable(dataTableArgs);
     284
     285      } else {
     286
     287        var dataTableLoadInterval = setInterval( function() {
     288
     289          if( "function" === typeof jQuery().DataTable ) {
     290
     291            clearInterval(dataTableLoadInterval);
     292   
     293            cpInitDataTable(dataTableArgs);
     294   
     295          }
     296
     297        }, 500);
     298
     299      }
     300
     301      jQuery(".cp-cryptocurrencies-table").on("click", ".trade-button", function() {
     302
     303        var $elm = jQuery(this);
     304
     305        var row_data = jQuery(".cp-cryptocurrencies-table").DataTable().row( $elm.parents("tr") ).data();
     306
     307        var symbol = row_data[0];
     308
     309        window.open(\'https://zwaply.com/exchange/?' . ( ! empty( $affiliate_id ) ? 'affiliate_id=' . $affiliate_id . '&' : '' ) . 'source_coin=\'+symbol);
     310
    165311      });
    166312
    167313    } );
    168314
     315    function cpInitDataTable( args ) {
     316      var $table = jQuery(".cp-cryptocurrencies-table");
     317      $table.DataTable( args );
     318      $table.parents(".dataTables_wrapper").find(".dataTables_powered_by").html("<a target=\"_blank\" href=\'https://wordpress.org/plugins/cryptocurrency-prices/\'>By Zwaply.com</a>");
     319    }
     320
    169321    </script>
    170322
  • cryptocurrency-prices/trunk/readme.txt

    r1965333 r1977635  
    11=== Cryptocurrency All-in-One ===
    2 Contributors: zwaply
     2Contributors: Zwaply
    33Donate link: https://zwaply.com/
    44Tags: bitcoin, cryptocurrency, bitcoin, ethereum, ripple, exchange, prices, rates, trading, payments, orders, token, btc, eth, etc, ltc, zec, xmr, ppc, dsh, candlestick, usd, eur 
     
    1212
    1313== Description ==
     14
     15Update: Finally bloggers can earn crypto with their blogs! In our recent update you’ll see a Trade button next to a crypto currency. When your readers make a crypto-to-crypto exchange, you’ll make a commission (50% of what we make) in the receiving coin.
     16
     17Because we’re deep believers in the crypto revolution, we’re working around the clock to bring to life new widgets and creative formats to help bloggers like you make lots of crypto.
     18
     19Signup to create your affiliate account at Zwaply (https://zwaply.com/register) and place your username in your admin panel. That’s it.
     20
     21P.S. If you don’t want to earn crypto, just remove the Trade button from the Settings page.
    1422
    1523Notice: From major version 3.0 some of the old features are only available in the premium version. [Get premium now](https://creditstocks.com/cryptocurrency-one-wordpress-plugin/)
     
    167175== Changelog ==
    168176
     177= 3.0.12 =
     178* Some style changes.
     179* Added coin trade option via Zwaply.com
     180
    169181= 3.0.11 =
    170182* Bugfixes. Plugin developer changed.
Note: See TracChangeset for help on using the changeset viewer.