Changeset 2006385
- Timestamp:
- 01/04/2019 04:05:27 PM (7 years ago)
- Location:
- cryptocurrency-shortcodes/trunk
- Files:
-
- 7 edited
-
assets/admin_js_crypto.js (modified) (2 diffs)
-
assets/backup - admin_js_crypto.js (modified) (3 diffs)
-
functions.php (modified) (7 diffs)
-
my-admin/admin-return-html-templates/rg-shortcode-template-carousel.php (modified) (2 diffs)
-
my-admin/rgcs-template-options-ajax.php (modified) (2 diffs)
-
my-admin/rgcs-template-options.php (modified) (1 diff)
-
my-admin/rgcs-template-tab-content-general.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cryptocurrency-shortcodes/trunk/assets/admin_js_crypto.js
r1999111 r2006385 153 153 $('.rgcs_tab_general .rgcs_pre_loader').show(); 154 154 var val = $('.rgcs_tab_general .rgcs_selected_num_max').val(); 155 var ret = $('.rgcs_refresh_rate_select.selected').attr('data_type'); 156 155 157 jQuery.ajax({ 156 158 type : "post", 157 159 dataType : "json", 158 160 url : myAjax.ajaxurl, 159 data : { action : "rynerg_rgcs_numbers_save_selected", val : val },161 data : { action : "rynerg_rgcs_numbers_save_selected", val : val , ret : ret }, 160 162 success: function(response) { 161 163 $('.rgcs_tab_general .rgcs_selected_num_max').val(response['result']); 162 if( response['remove'] == 'true' ){ 163 164 }else{ 165 164 console.log(response['ret']); 165 if( response['ret'] == 'activated' ){ 166 $('.rgcs_selected_num_max').keyup(function(){ 167 if( $('.rgcs_selected_num_max').val() > 30 ){ 168 $('.rgcs_selected_num_max').val('30'); 169 } 170 }); 166 171 } 172 167 173 $('.rgcs_select_options').fadeIn(function(){ 168 174 $(this).delay(0100).fadeOut(); … … 303 309 }; 304 310 311 $('.rgcs_refresh_rate_select').click(function(){ 312 refresh_type = $(this).attr('data_type'); 313 314 if( $(this).hasClass('selected') ){ 315 $(this).removeClass('selected'); 316 if( refresh_type == 'deactivate' ){ 317 $('.rgcs_refresh_rate_activated').addClass('selected'); 318 }else{ 319 $('.rgcs_refresh_rate_deactivated').addClass('selected'); 320 } 321 }else{ 322 $(this).addClass('selected'); 323 if( refresh_type == 'deactivate' ){ 324 $('.rgcs_refresh_rate_activated').removeClass('selected'); 325 }else{ 326 $('.rgcs_refresh_rate_deactivated').removeClass('selected'); 327 } 328 } 329 }); 330 305 331 $(window).load(function(){ 306 332 -
cryptocurrency-shortcodes/trunk/assets/backup - admin_js_crypto.js
r1999111 r2006385 372 372 }); 373 373 374 // SAVE SELECTED NUMBER 374 // SAVE SELECTED NUMBER AND RATE 375 375 function rgcs_save_selected_numbers(){ 376 376 $('.rgcs_tab_general .rgcs_pre_loader').show(); 377 377 var val = $('.rgcs_tab_general .rgcs_selected_num_max').val(); 378 379 if( $('.rgcs_refresh_rate_deactivated').hasClass('selected') ){ 380 ret = 'deactivated'; 381 }else{ 382 ret = 'activated'; 383 } 384 385 378 386 jQuery.ajax({ 379 387 type : "post", 380 388 dataType : "json", 381 389 url : myAjax.ajaxurl, 382 data : { action : "rynerg_rgcs_numbers_save_selected", val : val },390 data : { action : "rynerg_rgcs_numbers_save_selected", val : val,ret:ret }, 383 391 success: function(response) { 384 392 $('.rgcs_tab_general .rgcs_selected_num_max').val(response['result']); … … 388 396 rynerG_crypto_save_selected_currencies('num_reload'); 389 397 } 398 399 $('.rgcs_refresh_rate_selection').html(response['rate_html']); 390 400 391 401 $('.rgcs_tab_general .rgcs_pre_loader').hide(); … … 430 440 }; 431 441 442 // SELECT REFRESH RATE 443 432 444 433 445 $(window).load(function(){ -
cryptocurrency-shortcodes/trunk/functions.php
r2005843 r2006385 48 48 if($check_content == false){ 49 49 $ApiKey = file_get_contents(rg__Plugin_LINK.'crypto_api/api_my_key.txt'); 50 $CoinsUrl ='https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?sort=market_cap&start=1&limit=10 00&convert=USD&cryptocurrency_type=coins';50 $CoinsUrl ='https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?sort=market_cap&start=1&limit=10&convert=USD&cryptocurrency_type=coins'; 51 51 $APIREST = new APIREST($CoinsUrl); 52 52 $CallCoins = $APIREST->call( … … 56 56 $data_json = json_decode($CallCoins); 57 57 update_option('rynerg_rgcs_api_crypto_json',$data_json); 58 update_option('rynerg_rgcs_number_of_currencies_to_retrieve',1000); 59 } 60 61 58 update_option('rynerg_rgcs_number_of_currencies_to_retrieve',10); 59 } 62 60 63 61 … … 72 70 if($now_det > $det_cmp){ 73 71 $ApiKey = file_get_contents(rg__Plugin_LINK.'crypto_api/api_my_key.txt'); 74 $CoinsUrl ='https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?sort=market_cap&start=1&limit=10 00&convert=USD&cryptocurrency_type=coins';72 $CoinsUrl ='https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?sort=market_cap&start=1&limit=10&convert=USD&cryptocurrency_type=coins'; 75 73 $APIREST = new APIREST($CoinsUrl); 76 74 $CallCoins = $APIREST->call( … … 84 82 return $data_json; 85 83 } 84 } 85 86 function callCurrencyRealTime(){ 87 $ApiKey = file_get_contents(rg__Plugin_LINK.'crypto_api/api_my_key.txt'); 88 $CoinsUrl ='https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?sort=market_cap&start=1&limit=30&convert=USD&cryptocurrency_type=coins'; 89 $APIREST = new APIREST($CoinsUrl); 90 $CallCoins = $APIREST->call( array('X-CMC_PRO_API_KEY:'.$ApiKey) ); 91 $data_json = json_decode($CallCoins); 92 $new_data_json = update_option('rynerg_rgcs_api_crypto_json',$data_json); 93 94 return $new_data_json; 86 95 } 87 96 … … 178 187 require_once('my-admin/rgcs-template-options-ajax.php'); 179 188 require_once('my-admin/admin-return-html-templates/rg-shortcode-template.php'); 189 180 190 if( !function_exists('rynerg_rgcs_initialize_class') ): 181 191 … … 186 196 delete_option('rynerg_rgcs_api_crypto_json'); 187 197 delete_option('rynerg_rgcs_selected_currencies'); 188 delete_option('rynerg_rgcs_number_of_currencies_to_retrieve'); 198 delete_option('rynerg_rgcs_number_of_currencies_to_retrieve'); 199 delete_option('rynerg_rgcs_refresh_rate_of_currencies'); 189 200 } 190 201 … … 229 240 }else{ 230 241 if($rsg_version !== rynerg_crypto_plugin_version){ 231 rynerg_rgcs_initialize_class(); 242 243 // rynerg_rgcs_initialize_class(); 232 244 } 233 245 } -
cryptocurrency-shortcodes/trunk/my-admin/admin-return-html-templates/rg-shortcode-template-carousel.php
r2005911 r2006385 5 5 Author URI: https://profiles.wordpress.org/ryner1 6 6 */ 7 $get_previous_rate = get_option('rynerg_rgcs_refresh_rate_of_currencies'); 7 8 9 if( $get_previous_rate == 'activated' ){ 8 10 11 $det = get_option('rynerg_rgcs_refresh_json_content'); 12 $now_det = new DateTime(); 13 $apiCrypto = new RynerG_crypto_shortcode(); 14 update_option('rynerg_rgcs_refresh_json_content',$now_det); 15 $apiCrypto->callCurrencyRealTime(); 16 } 17 18 $max_countdown = $max; 9 19 $data = get_option('rynerg_rgcs_api_crypto_json'); 10 20 $coins_id = get_option('rynerg_rgcs_selected_currencies'); 11 21 $img_url = 'https://s2.coinmarketcap.com/static/img/coins/16x16/'; 12 $ctr_coins = count($coins_id); 13 $max_countdown = $max; 22 23 if( $coins_id != false ): 24 $ctr_coins = count($coins_id); 25 26 27 28 14 29 ?> 15 30 <style> … … 54 69 </div> 55 70 71 <?php endif; -
cryptocurrency-shortcodes/trunk/my-admin/rgcs-template-options-ajax.php
r1999111 r2006385 138 138 function rynerg_rgcs_numbers_save_selected(){ 139 139 $val = $_REQUEST['val']; 140 $ret = $_REQUEST['ret']; 141 140 142 $get_previous_number = get_option('rynerg_rgcs_number_of_currencies_to_retrieve'); 143 141 144 $result['remove'] = 'false'; 142 145 … … 144 147 $result['remove'] = 'true'; 145 148 } 149 146 150 update_option('rynerg_rgcs_number_of_currencies_to_retrieve',$val,yes); 151 152 if( $ret == 'activate' ){ 153 154 update_option('rynerg_rgcs_refresh_rate_of_currencies','activated'); 155 $det = get_option('rynerg_rgcs_refresh_json_content'); 156 $now_det = new DateTime(); 157 $apiCrypto = new RynerG_crypto_shortcode(); 158 update_option('rynerg_rgcs_refresh_json_content',$now_det); 159 $apiCrypto->callCurrencyRealTime(); 160 161 }else{ 162 update_option('rynerg_rgcs_refresh_rate_of_currencies','deactivated'); 163 } 164 $result['ret'] = get_option('rynerg_rgcs_refresh_rate_of_currencies'); 165 166 147 167 $result['result'] = get_option('rynerg_rgcs_number_of_currencies_to_retrieve'); 148 168 -
cryptocurrency-shortcodes/trunk/my-admin/rgcs-template-options.php
r1999111 r2006385 8 8 9 9 function rynerg_rgcs_callback(){ 10 11 $p_link = new RynerG_crypto_shortcode();12 $p_link = $p_link->define_me()['rg__Plugin_LINK'];13 14 10 // $apiCrypto = new RynerG_crypto_shortcode(); 15 11 // $apiCrypto = $apiCrypto->callCurrency(); 16 17 $redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];18 $img_url = 'https://s2.coinmarketcap.com/static/img/coins/16x16/';19 20 $num_retrieve = get_option('rynerg_rgcs_number_of_currencies_to_retrieve');21 12 // $items = json_decode($apiCrypto); 22 $items = get_option('rynerg_rgcs_api_crypto_json'); 23 $selected_items = get_option('rynerg_rgcs_selected_currencies'); 13 $p_link = new RynerG_crypto_shortcode(); 14 $p_link = $p_link->define_me()['rg__Plugin_LINK']; 15 $redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; 16 $img_url = 'https://s2.coinmarketcap.com/static/img/coins/16x16/'; 17 $num_retrieve = get_option('rynerg_rgcs_number_of_currencies_to_retrieve'); 18 $items = get_option('rynerg_rgcs_api_crypto_json'); 19 $selected_items = get_option('rynerg_rgcs_selected_currencies'); 24 20 ?> 25 21 26 22 <div class="rynerg_cs_container"> 27 <p class="rgcs_big_title rgcs_logo"> <!-- <i class="fa fa-coins"></i> -->23 <p class="rgcs_big_title rgcs_logo"> 28 24 <img src="<?php echo $p_link; ?>/my-images/rgcs_crypto_logo.png" class="rg_logo"> 29 25  Cryptocurrency Shortcodes</p> -
cryptocurrency-shortcodes/trunk/my-admin/rgcs-template-tab-content-general.php
r1999111 r2006385 6 6 */ 7 7 ?> 8 <style> 9 .rgcs_refresh_rate_select{ 10 font-weight: 800; 11 background: #eee; 12 color: #222; 13 display: inline-block; 14 width: auto; 15 padding: 10px; 16 border-radius: 5px; 17 cursor: pointer; 18 } 19 .rgcs_refresh_rate_select.selected{ 20 background: #4885ed; 21 color: #fff; 22 } 23 .rgcs_refresh_rate_selection{ 24 background: #eeeeee; 25 width: auto; 26 display: inline-block; 27 border-radius: 5px; 28 } 29 .rgcs_refresh_rate_deactivated{ 30 border-bottom-right-radius: 0; 31 border-top-right-radius: 0; 32 } 33 .rgcs_refresh_rate_activated{ 34 border-bottom-left-radius: 0; 35 border-top-left-radius: 0; 36 } 37 </style> 8 38 9 39 <div class="rgcs__tab_"> … … 17 47 <input type="number" class="rgcs_selected_num_max" placeholder="Number of coins to retrieve" value="<?php echo $num_retrieve; ?>" max="1000"> 18 48 <p class="labeling" style="padding-left: 15px;"> 19 <i>Note: This sets the number of coins to retrieve from <a href="https://coinmarketcap.com/all/views/all/" target="_blank"> coinmarketcap.com</a>. Default (10 0items). Maximum coins to retrieve is 1000.49 <i>Note: This sets the number of coins to retrieve from <a href="https://coinmarketcap.com/all/views/all/" target="_blank"> coinmarketcap.com</a>. Default (10 items). Maximum coins to retrieve is 1000. 20 50 <br> 21 51 <span class="fa fa-exclamation"> </span>Important Note: The higher the number the slower the loading process. … … 26 56 </p> 27 57 </p> 58 <hr> 59 <p class="rgcs__tab_title">Real Time</p> 60 <?php 61 62 $get_previous_rate = get_option('rynerg_rgcs_refresh_rate_of_currencies'); 63 $deact_stat = $act_stat = $act_text = $deact_text = ''; 64 65 $r_stats = array( 'd_stat' => 'selected' ,'a_stat'=>'','d_text'=>'Deactivated','a_text'=>'Activate' ); 66 67 if( $get_previous_rate == 'activated' ){ 68 $r_stats = array( 'd_stat' => '' ,'a_stat'=>'selected','d_text'=>'Deactivate','a_text'=>'Activated' ); 69 } 70 71 ?> 72 <div class="rgcs_refresh_rate"> 73 <p class="labeling"> 74 <i>This will set the refresh rate to real time but will reduce the max items to be collected to 30. And due to API restrictions, if the data was changed, wait for atleast 1-5 minutes for the data to be recollected.</i> 75 </p><br> 76 <div class="rgcs_refresh_rate_selection"> 77 <div class="rgcs_refresh_rate_deactivated rgcs_refresh_rate_select <?php echo $r_stats['d_stat']; ?>" data_type = 'deactivate'> 78 <?php echo $r_stats['d_text']; ?> 79 </div> 80 <div class="rgcs_refresh_rate_activated rgcs_refresh_rate_select <?php echo $r_stats['a_stat']; ?>" data_type = 'activate'> 81 <?php echo $r_stats['a_text']; ?> 82 </div> 83 </div> 84 85 </div> 86 87 <br><hr> 28 88 29 89 <p> 30 <button type="button" class="rgcs_save_btn" data-action="save_selected_number">S ave</button>90 <button type="button" class="rgcs_save_btn" data-action="save_selected_number">SAVE CHANGES</button> 31 91 </p> 32 92 </div> 93 <script type="text/javascript"> 94 if( jQuery('.rgcs_refresh_rate_activated').hasClass('selected') ){ 95 jQuery('.rgcs_selected_num_max').keyup(function(){ 96 if( jQuery('.rgcs_selected_num_max').val() > 30 ){ 97 jQuery('.rgcs_selected_num_max').val('30'); 98 } 99 }); 100 } 101 </script>
Note: See TracChangeset
for help on using the changeset viewer.