Changeset 1977635
- Timestamp:
- 11/20/2018 07:43:47 PM (7 years ago)
- Location:
- cryptocurrency-prices
- Files:
-
- 6 added
- 8 edited
-
assets/banner-1544x500.png (added)
-
assets/banner-772x250.png (modified) (previous)
-
trunk/cryptocurrency-prices.php (modified) (3 diffs)
-
trunk/css/cp_admin.css (added)
-
trunk/css/cp_base.css (added)
-
trunk/css/cp_dark.css (modified) (1 diff)
-
trunk/css/cp_light.css (modified) (1 diff)
-
trunk/includes/admin.class.php (modified) (7 diffs)
-
trunk/includes/common.class.php (modified) (1 diff)
-
trunk/includes/cryptocurrency-dashboard-affiliate.php (added)
-
trunk/includes/currencyall.class.php (modified) (9 diffs)
-
trunk/parts (added)
-
trunk/parts/cryptocurrency-affiliate-panel.php (added)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cryptocurrency-prices/trunk/cryptocurrency-prices.php
r1965350 r1977635 7 7 Plugin URI: https://zwaply.com/ 8 8 Description: Provides multiple cryptocurrency features: accepting payments, displaying prices and exchange rates, cryptocurrency calculator, accepting donations. 9 Version: 3.0.1 110 Author: zwaply9 Version: 3.0.12 10 Author: Zwaply 11 11 Author URI: https://zwaply.com/ 12 12 Text Domain: cryprocurrency-prices … … 27 27 require_once( dirname( __FILE__ ) . '/includes/currencytickerwidget.class.php' ); 28 28 require_once( dirname( __FILE__ ) . '/includes/common.class.php' ); 29 require_once( dirname( __FILE__ ) . '/includes/cryptocurrency-dashboard-affiliate.php' ); 29 30 30 31 if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { … … 50 51 //add custom stylesheet 51 52 add_action('wp_head', array( 'CPCommon', 'cp_custom_styles'), 100); 52 add_action( 'wp_enqueue_scripts', array( 'CPCommon', 'cp_enqueue_styles') ); 53 add_action( 'wp_enqueue_scripts', array( 'CPCommon', 'cp_enqueue_styles'), 15 ); 54 55 //add admin stylesheet 56 add_action( 'admin_enqueue_scripts', array( 'CPCommon', 'cp_enqueue_admin_styles'), 15 ); 53 57 54 58 //add translation -
cryptocurrency-prices/trunk/css/cp_dark.css
r1960857 r1977635 79 79 } 80 80 81 table.cp-table button { 82 83 padding: 0 1.1rem; 84 85 } 86 81 87 /* form styles */ 82 88 -
cryptocurrency-prices/trunk/css/cp_light.css
r1960857 r1977635 79 79 } 80 80 81 table.cp-table button { 82 83 padding: 0 1.1rem; 84 85 } 86 81 87 /* form styles */ 82 88 -
cryptocurrency-prices/trunk/includes/admin.class.php
r1928926 r1977635 31 31 //add admin menu 32 32 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 } 35 48 } 36 49 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 37 56 38 57 … … 117 136 'cryptocurrency-prices', 118 137 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 119 156 __( 'Premium and Updates', 'cryptocurrency' ), 120 157 … … 245 282 246 283 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 } 248 298 249 299 … … 257 307 $admin_message_html = ''; 258 308 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 259 327 260 328 … … 275 343 } 276 344 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 277 362 278 363 … … 328 413 329 414 } 330 331 415 332 416 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 333 433 echo ' 334 434 … … 343 443 <form action="" method="post"> 344 444 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 345 456 <h2>Design:</h2> 346 457 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 347 470 <label>Use default design (insludes default CSS): </label> 348 471 -
cryptocurrency-prices/trunk/includes/common.class.php
r1928926 r1977635 3 3 4 4 public static function cp_enqueue_styles(){ 5 wp_enqueue_style('cp-base', CP_URL.'css/cp_base.css'); 6 5 7 $default_css = get_option('cryptocurrency-prices-default-css'); 6 8 wp_register_style('cp-'.$default_css, CP_URL.'css/cp_'.$default_css.'.css'); 7 9 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'); 8 14 } 9 15 -
cryptocurrency-prices/trunk/includes/currencyall.class.php
r1965333 r1977635 41 41 } else { 42 42 43 $perpage = 10 0;43 $perpage = 10; 44 44 45 45 } … … 59 59 } 60 60 61 $show_trade_button = 'no' !== get_option('cryptocurrency-prices-show-trade-button'); 62 63 $affiliate_id = get_option('cryptocurrency-prices-zwaply-affiliate-id'); 61 64 62 65 … … 81 84 var apiUrl = \'https://api.coinmarketcap.com/v1/ticker/?convert=\'+\''.$base_currency.'\'+\'&limit='.$limit.'\'; 82 85 83 console.log(apiUrl);86 var coinsNames = {}; 84 87 85 88 jQuery.get( apiUrl, function( data ) { … … 93 96 for (var currentCurrency in data){ 94 97 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 95 143 //console.log(data[currentCurrency]); 96 144 97 145 var name = data[currentCurrency].name; 98 146 147 var symbol = data[currentCurrency].symbol; 148 99 149 var rank = data[currentCurrency].rank; 100 150 101 var price_number = data[currentCurrency][\'price_'.mb_strtolower($base_currency).'\'];151 //var price_number = data[currentCurrency][\'price_'.mb_strtolower($base_currency).'\']; 102 152 103 153 //var price = price_number.toLocaleString('.$locale.')+\' \'+toCurrency; … … 111 161 if (data[currentCurrency].percent_change_24h > 0){ 112 162 163 data[currentCurrency].percent_change_24h = "+" + data[currentCurrency].percent_change_24h; 164 113 165 var changeClass = "change-inc"; 114 166 … … 119 171 } 120 172 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>"; 122 176 123 177 var marketCap = parseInt(data[currentCurrency][\'market_cap_'.mb_strtolower($base_currency).'\']).toLocaleString('.$locale.'); 124 178 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;\" />"; 126 180 127 181 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]); 130 185 131 186 } … … 135 190 //show datatable 136 191 137 jQuery(".cp-cryptocurrencies-table").DataTable({192 var dataTableArgs = { 138 193 139 194 data: dataSet, 140 195 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\'] ], 144 214 145 215 "pageLength": '.$perpage.', … … 147 217 "lengthMenu": [ [10, 50, 100, 500, 1000, -1], [10, 50, 100, 500, 1000, "All"] ], 148 218 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 149 235 drawCallback: function() { 150 236 … … 161 247 }, 162 248 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 163 273 responsive: true, 164 274 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 165 311 }); 166 312 167 313 } ); 168 314 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 169 321 </script> 170 322 -
cryptocurrency-prices/trunk/readme.txt
r1965333 r1977635 1 1 === Cryptocurrency All-in-One === 2 Contributors: zwaply2 Contributors: Zwaply 3 3 Donate link: https://zwaply.com/ 4 4 Tags: bitcoin, cryptocurrency, bitcoin, ethereum, ripple, exchange, prices, rates, trading, payments, orders, token, btc, eth, etc, ltc, zec, xmr, ppc, dsh, candlestick, usd, eur … … 12 12 13 13 == Description == 14 15 Update: 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 17 Because 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 19 Signup to create your affiliate account at Zwaply (https://zwaply.com/register) and place your username in your admin panel. That’s it. 20 21 P.S. If you don’t want to earn crypto, just remove the Trade button from the Settings page. 14 22 15 23 Notice: 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/) … … 167 175 == Changelog == 168 176 177 = 3.0.12 = 178 * Some style changes. 179 * Added coin trade option via Zwaply.com 180 169 181 = 3.0.11 = 170 182 * Bugfixes. Plugin developer changed.
Note: See TracChangeset
for help on using the changeset viewer.