Changeset 1753861
- Timestamp:
- 10/27/2017 11:54:55 AM (8 years ago)
- Location:
- live-ticker-cryptocoin/trunk
- Files:
-
- 3 edited
-
cryptocoin-live-ticker.php (modified) (5 diffs)
-
include/common.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
live-ticker-cryptocoin/trunk/cryptocoin-live-ticker.php
r1747902 r1753861 23 23 public function widget( $args, $instance ) { 24 24 $pairs = explode(',', $instance['pairs']); 25 $tableHeaders = explode(',', $instance['table_headers']); 26 27 $decimalsSep = $instance['decimals_sep']; 28 $thousandsSep = $instance['thousands_sep']; 29 30 25 31 $cacheDataTimeout = $instance['cache_data_timeout']; 26 32 $pairsData = clt_get_pair_data($pairs, $cacheDataTimeout); … … 29 35 <div class="pairs-data"> 30 36 <div class="pairs-header"> 31 <div> Pair</div>32 <div> Rate</div>33 <div> 24H %</div>34 <div> 7D %</div>37 <div><?php echo $tableHeaders[0] ?></div> 38 <div><?php echo $tableHeaders[1] ?></div> 39 <div><?php echo $tableHeaders[2] ?></div> 40 <div><?php echo $tableHeaders[3] ?></div> 35 41 </div> 36 42 <?php … … 57 63 <div class="pair-data" id="pair-<?php echo $pair ?>"> 58 64 <div class="pair"><?php echo $pair ?></div> 59 <div class="price"><?php echo number_format($pairData['price'], 2 ) ?></div>60 <div class="pchange-24hours<?php echo $pchange_24hoursClass ?>"><?php echo ($pairData['pchange_24hours'] > 0 ? '+' : '') . number_format($pairData['pchange_24hours'], 2 ) ?></div>61 <div class="pchange-7days<?php echo $pchange_7daysClass ?>"><?php echo ($pairData['pchange_7days'] > 0 ? '+' : '') . number_format($pairData['pchange_7days'], 2 ) ?></div>65 <div class="price"><?php echo number_format($pairData['price'], 2, $decimalsSep, $thousandsSep) ?></div> 66 <div class="pchange-24hours<?php echo $pchange_24hoursClass ?>"><?php echo ($pairData['pchange_24hours'] > 0 ? '+' : '') . number_format($pairData['pchange_24hours'], 2, $decimalsSep, $thousandsSep) ?></div> 67 <div class="pchange-7days<?php echo $pchange_7daysClass ?>"><?php echo ($pairData['pchange_7days'] > 0 ? '+' : '') . number_format($pairData['pchange_7days'], 2, $decimalsSep, $thousandsSep) ?></div> 62 68 </div> 63 69 <?php … … 74 80 public function form( $instance ) { 75 81 $pairs = !empty( $instance['pairs'] ) ? $instance['pairs'] : 'BTCUSD,LTCUSD,ETHUSD'; 82 $tableHeaders = !empty( $instance['table_headers'] ) ? $instance['table_headers'] : 'Pair,Rate,24H %,7D %'; 83 $decimalsSep = isset( $instance['decimals_sep'] ) ? $instance['decimals_sep'] : '.'; 84 $thousandsSep = isset( $instance['thousands_sep'] ) ? $instance['thousands_sep'] : ','; 85 76 86 $cacheDataTimeout = !empty( $instance['cache_data_timeout'] ) ? $instance['cache_data_timeout'] : $GLOBALS['cltConfig']['cacheDataTimeout']; 77 87 $showCoinalyzeLink = !empty($instance['show_coinalyze_link']) ? $instance['show_coinalyze_link'] : 'on'; 78 88 ?> 79 89 <p> 80 <label for="<?php echo $this->get_field_id( 'pairs' ); ?>">Pairs to display, comma separated. Available pairs: <span style="font-size: 0.85em;"><?php echo implode(' ', $GLOBALS['cltConfig']['availablePairs']) ?></span></label>81 <input style="width:100%;" type="text" id="<?php echo $this->get_field_id( 'pairs' ); ?>" name="<?php echo $this->get_field_name( 'pairs' ); ?>" value="<?php echo esc_attr( $pairs ); ?>" />90 <label for="<?php echo $this->get_field_id( 'pairs' ); ?>">Pairs to display, comma separated. Available pairs: <span style="font-size: 0.85em;"><?php echo implode(' ', $GLOBALS['cltConfig']['availablePairs']) ?></span></label> 91 <input style="width:100%;" type="text" id="<?php echo $this->get_field_id( 'pairs' ); ?>" name="<?php echo $this->get_field_name( 'pairs' ); ?>" value="<?php echo esc_attr( $pairs ); ?>" /> 82 92 </p> 83 93 <p> 84 <label for="<?php echo $this->get_field_id( 'cache_data_timeout' ); ?>">Cached data timeout in seconds, not lower than <?php echo $GLOBALS['cltConfig']['cacheDataTimeout'] ?></label> 85 <input style="width:100%;" type="text" id="<?php echo $this->get_field_id( 'cache_data_timeout' ); ?>" name="<?php echo $this->get_field_name( 'cache_data_timeout' ); ?>" value="<?php echo esc_attr( $cacheDataTimeout ); ?>" /> 94 <label for="<?php echo $this->get_field_id( 'table_headers' ); ?>">Table headers, comma separated</label> 95 <input style="width:100%;" type="text" id="<?php echo $this->get_field_id( 'table_headers' ); ?>" name="<?php echo $this->get_field_name( 'table_headers' ); ?>" value="<?php echo esc_attr( $tableHeaders ); ?>" /> 96 </p> 97 98 <p> 99 <div style="display: inline-block; width: 45%;"> 100 <label for="<?php echo $this->get_field_id( 'decimals_sep' ); ?>">Decimals separator</label> 101 <input style="width:100%;" type="text" id="<?php echo $this->get_field_id( 'decimals_sep' ); ?>" name="<?php echo $this->get_field_name( 'decimals_sep' ); ?>" value="<?php echo esc_attr( $decimalsSep ); ?>" /> 102 </div> 103 <div style="display: inline-block; width: 45%; float: right;"> 104 <label for="<?php echo $this->get_field_id( 'thousands_sep' ); ?>">Thousands separator</label> 105 <input style="width:100%;" type="text" id="<?php echo $this->get_field_id( 'thousands_sep' ); ?>" name="<?php echo $this->get_field_name( 'thousands_sep' ); ?>" value="<?php echo esc_attr( $thousandsSep ); ?>" /> 106 </div> 107 </p> 108 109 <p> 110 <label for="<?php echo $this->get_field_id( 'cache_data_timeout' ); ?>">Cached data timeout in seconds, not lower than <?php echo $GLOBALS['cltConfig']['cacheDataTimeout'] ?></label> 111 <input style="width:100%;" type="text" id="<?php echo $this->get_field_id( 'cache_data_timeout' ); ?>" name="<?php echo $this->get_field_name( 'cache_data_timeout' ); ?>" value="<?php echo esc_attr( $cacheDataTimeout ); ?>" /> 86 112 </p> 87 113 <p> … … 95 121 $instance = $old_instance; 96 122 $instance['pairs'] = str_replace(' ', '', $new_instance['pairs']); 123 $instance['table_headers'] = $new_instance['table_headers']; 124 $instance['decimals_sep'] = $new_instance['decimals_sep']; 125 $instance['thousands_sep'] = $new_instance['thousands_sep']; 126 97 127 $instance['show_coinalyze_link'] = empty($new_instance['show_coinalyze_link']) ? 'off' : 'on'; 98 128 $cacheDataTimeout = (int)$new_instance['cache_data_timeout']; -
live-ticker-cryptocoin/trunk/include/common.php
r1744439 r1753861 1 1 <?php 2 2 $GLOBALS['cltConfig'] = array( 3 'availablePairs' => array('BTCUSD', 'BTCEUR', 'LTCUSD', 'LTCEUR', 'LTCBTC', 'ETHUSD', 'ETHEUR', 'ETHBTC', 'XMRUSD', 'XRPUSD', 'XRPEUR', 'IOTUSD', 'DSHUSD', 'NEOUSD' ),3 'availablePairs' => array('BTCUSD', 'BTCEUR', 'LTCUSD', 'LTCEUR', 'LTCBTC', 'ETHUSD', 'ETHEUR', 'ETHBTC', 'XMRUSD', 'XRPUSD', 'XRPEUR', 'IOTUSD', 'DSHUSD', 'NEOUSD', 'BTCJPY', 'ETHJPY', 'BTCGBP', 'BTCCAD', 'ETHCAD', 'BTCAUD', 'ETHAUD', 'LTCAUD', 'BTCCNY', 'LTCCNY'), 4 4 'cacheDataTimeout' => 30, 5 5 'dataApiUrl' => 'https://coinalyze.net/service-widgets/pairsdata/' -
live-ticker-cryptocoin/trunk/readme.txt
r1744439 r1753861 9 9 == Description == 10 10 11 Display cryptocoins current price, 24 hours price change and 7 days price change on your website. You can select which coins/pairs to display. Supported pairs: BTCUSD BTCEUR LTCUSD LTCEUR LTCBTC ETHUSD ETHEUR ETHBTC XMRUSD XRPUSD XRPEUR IOTUSD DSHUSD NEOUSD 11 Display cryptocoins current price, 24 hours price change and 7 days price change on your website. You can select which coins/pairs to display. Supported pairs: BTCUSD BTCEUR LTCUSD LTCEUR LTCBTC ETHUSD ETHEUR ETHBTC XMRUSD XRPUSD XRPEUR IOTUSD DSHUSD NEOUSD BTCJPY ETHJPY BTCGBP BTCCAD ETHCAD BTCAUD ETHAUD LTCAUD BTCCNY LTCCNY 12 12 13 13 The widget is highly customizable
Note: See TracChangeset
for help on using the changeset viewer.