Plugin Directory

Changeset 2006385


Ignore:
Timestamp:
01/04/2019 04:05:27 PM (7 years ago)
Author:
ryner1
Message:

carousel real time added

Location:
cryptocurrency-shortcodes/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cryptocurrency-shortcodes/trunk/assets/admin_js_crypto.js

    r1999111 r2006385  
    153153        $('.rgcs_tab_general .rgcs_pre_loader').show();
    154154        var val = $('.rgcs_tab_general .rgcs_selected_num_max').val();
     155        var ret = $('.rgcs_refresh_rate_select.selected').attr('data_type');
     156
    155157        jQuery.ajax({
    156158            type : "post",
    157159            dataType : "json",
    158160            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 },
    160162            success: function(response) {
    161163                $('.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                    });
    166171                }
     172
    167173                $('.rgcs_select_options').fadeIn(function(){
    168174                    $(this).delay(0100).fadeOut();
     
    303309    };
    304310
     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
    305331    $(window).load(function(){
    306332
  • cryptocurrency-shortcodes/trunk/assets/backup - admin_js_crypto.js

    r1999111 r2006385  
    372372    });
    373373
    374     // SAVE SELECTED NUMBER
     374    // SAVE SELECTED NUMBER AND RATE
    375375    function rgcs_save_selected_numbers(){
    376376        $('.rgcs_tab_general .rgcs_pre_loader').show();
    377377        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
    378386        jQuery.ajax({
    379387            type : "post",
    380388            dataType : "json",
    381389            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 },
    383391            success: function(response) {
    384392                $('.rgcs_tab_general .rgcs_selected_num_max').val(response['result']);
     
    388396                    rynerG_crypto_save_selected_currencies('num_reload');   
    389397                }
     398
     399                $('.rgcs_refresh_rate_selection').html(response['rate_html']);
    390400               
    391401                $('.rgcs_tab_general .rgcs_pre_loader').hide();
     
    430440    };
    431441   
     442    // SELECT REFRESH RATE
     443   
    432444
    433445    $(window).load(function(){
  • cryptocurrency-shortcodes/trunk/functions.php

    r2005843 r2006385  
    4848        if($check_content == false){
    4949            $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=1000&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';
    5151            $APIREST = new APIREST($CoinsUrl);
    5252            $CallCoins = $APIREST->call(
     
    5656            $data_json = json_decode($CallCoins);
    5757            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        }
    6260       
    6361
     
    7270        if($now_det > $det_cmp){
    7371            $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=1000&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';
    7573            $APIREST = new APIREST($CoinsUrl);
    7674            $CallCoins = $APIREST->call(
     
    8482            return $data_json;
    8583        }                       
     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;
    8695    }
    8796
     
    178187require_once('my-admin/rgcs-template-options-ajax.php');
    179188require_once('my-admin/admin-return-html-templates/rg-shortcode-template.php');
     189
    180190if( !function_exists('rynerg_rgcs_initialize_class') ):
    181191
     
    186196            delete_option('rynerg_rgcs_api_crypto_json');
    187197            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');
    189200        }
    190201
     
    229240        }else{
    230241            if($rsg_version !== rynerg_crypto_plugin_version){
    231                 rynerg_rgcs_initialize_class();
     242
     243                // rynerg_rgcs_initialize_class();
    232244            }
    233245        }
  • cryptocurrency-shortcodes/trunk/my-admin/admin-return-html-templates/rg-shortcode-template-carousel.php

    r2005911 r2006385  
    55Author URI: https://profiles.wordpress.org/ryner1
    66*/
     7$get_previous_rate = get_option('rynerg_rgcs_refresh_rate_of_currencies');
    78
     9if( $get_previous_rate == 'activated' ){
    810
     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;
    919$data       = get_option('rynerg_rgcs_api_crypto_json');
    1020$coins_id   = get_option('rynerg_rgcs_selected_currencies');
    1121$img_url    = 'https://s2.coinmarketcap.com/static/img/coins/16x16/';
    12 $ctr_coins  = count($coins_id);
    13 $max_countdown = $max;
     22
     23if( $coins_id != false ):
     24    $ctr_coins  = count($coins_id);
     25
     26
     27
     28
    1429?>
    1530<style>
     
    5469</div>
    5570
     71<?php endif;
  • cryptocurrency-shortcodes/trunk/my-admin/rgcs-template-options-ajax.php

    r1999111 r2006385  
    138138function rynerg_rgcs_numbers_save_selected(){
    139139    $val                    = $_REQUEST['val'];
     140    $ret                    = $_REQUEST['ret'];
     141
    140142    $get_previous_number    = get_option('rynerg_rgcs_number_of_currencies_to_retrieve');
     143
    141144    $result['remove']       = 'false';
    142145
     
    144147        $result['remove'] = 'true';
    145148    }
     149
    146150    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
    147167    $result['result'] = get_option('rynerg_rgcs_number_of_currencies_to_retrieve');
    148168
  • cryptocurrency-shortcodes/trunk/my-admin/rgcs-template-options.php

    r1999111 r2006385  
    88
    99function rynerg_rgcs_callback(){
    10 
    11     $p_link = new RynerG_crypto_shortcode();
    12     $p_link = $p_link->define_me()['rg__Plugin_LINK']; 
    13 
    1410    // $apiCrypto = new RynerG_crypto_shortcode();
    1511    // $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');
    2112    // $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');
    2420?>
    2521
    2622<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">
    2824        <img src="<?php echo $p_link; ?>/my-images/rgcs_crypto_logo.png" class="rg_logo">
    2925    &emsp;Cryptocurrency Shortcodes</p>
  • cryptocurrency-shortcodes/trunk/my-admin/rgcs-template-tab-content-general.php

    r1999111 r2006385  
    66*/
    77?>
     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>
    838
    939<div class="rgcs__tab_">
     
    1747        <input type="number" class="rgcs_selected_num_max" placeholder="Number of coins to retrieve" value="<?php echo $num_retrieve; ?>" max="1000">
    1848        <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 (100 items). 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.
    2050            <br>
    2151            <span class="fa fa-exclamation">&nbsp;</span>Important Note: The higher the number the slower the loading process.
     
    2656        </p>
    2757    </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>
    2888
    2989    <p>
    30         <button type="button" class="rgcs_save_btn" data-action="save_selected_number">Save</button>
     90        <button type="button" class="rgcs_save_btn" data-action="save_selected_number">SAVE CHANGES</button>
    3191    </p>
    3292</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.