Changeset 2607215
- Timestamp:
- 09/30/2021 11:30:55 AM (3 years ago)
- Location:
- simple-crypto-shortcodes
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
simple-crypto-shortcodes/trunk/readme.txt
r2598481 r2607215 5 5 Tested up to: 5.8 6 6 Requires PHP: 5.6 7 Stable tag: 1.0 7 Stable tag: 1.0.1 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl.html -
simple-crypto-shortcodes/trunk/simple_crypto_shortcodes.php
r2598481 r2607215 4 4 Plugin URI: https://bitcoinminingsoftware.com/simple-crypto-shortcodes-wordpress-plugin/ 5 5 Description: Simple shortcodes to show crypto prices and other data from CoinMarketCap API! 6 Version: 1.0 6 Version: 1.0.1 7 7 Author: stefanristic 8 8 Author URI: https://migratewptoday.com … … 176 176 } else { 177 177 $data = json_decode(scs_get_coin_info($symbol)); 178 return round($data->data->$symbol->quote->USD->percent_change_1h, 3) . '%'; 178 if($data->data->$symbol->quote->USD->percent_change_1h > 0) { 179 $span_before = '<span style="color:green;">'; 180 $span_after = '</span>'; 181 } elseif($data->data->$symbol->quote->USD->percent_change_1h < 0) { 182 $span_before = '<span style="color:red;">'; 183 $span_after = '</span>'; 184 } else { 185 $span_before = ''; 186 $span_after = ''; 187 } 188 return $span_before . round($data->data->$symbol->quote->USD->percent_change_1h, 3) . '%' . $span_after; 179 189 } 180 190 } … … 189 199 } else { 190 200 $data = json_decode(scs_get_coin_info($symbol)); 191 return round($data->data->$symbol->quote->USD->percent_change_24h, 3) . '%'; 201 if($data->data->$symbol->quote->USD->percent_change_24h > 0) { 202 $span_before = '<span style="color:green;">'; 203 $span_after = '</span>'; 204 } elseif($data->data->$symbol->quote->USD->percent_change_24h < 0) { 205 $span_before = '<span style="color:red;">'; 206 $span_after = '</span>'; 207 } else { 208 $span_before = ''; 209 $span_after = ''; 210 } 211 return $span_before . round($data->data->$symbol->quote->USD->percent_change_24h, 3) . '%' . $span_after; 192 212 } 193 213 } … … 202 222 } else { 203 223 $data = json_decode(scs_get_coin_info($symbol)); 204 return round($data->data->$symbol->quote->USD->percent_change_7d, 3) . '%'; 224 if($data->data->$symbol->quote->USD->percent_change_7d > 0) { 225 $span_before = '<span style="color:green;">'; 226 $span_after = '</span>'; 227 } elseif($data->data->$symbol->quote->USD->percent_change_7d < 0) { 228 $span_before = '<span style="color:red;">'; 229 $span_after = '</span>'; 230 } else { 231 $span_before = ''; 232 $span_after = ''; 233 } 234 return $span_before . round($data->data->$symbol->quote->USD->percent_change_7d, 3) . '%' . $span_after; 205 235 } 206 236 } … … 215 245 } else { 216 246 $data = json_decode(scs_get_coin_info($symbol)); 217 return round($data->data->$symbol->quote->USD->percent_change_30d, 3) . '%'; 247 if($data->data->$symbol->quote->USD->percent_change_30d > 0) { 248 $span_before = '<span style="color:green;">'; 249 $span_after = '</span>'; 250 } elseif($data->data->$symbol->quote->USD->percent_change_30d < 0) { 251 $span_before = '<span style="color:red;">'; 252 $span_after = '</span>'; 253 } else { 254 $span_before = ''; 255 $span_after = ''; 256 } 257 return $span_before . round($data->data->$symbol->quote->USD->percent_change_30d, 3) . '%' . $span_after; 218 258 } 219 259 } … … 228 268 } else { 229 269 $data = json_decode(scs_get_coin_info($symbol)); 230 return round($data->data->$symbol->quote->USD->percent_change_60d, 3) . '%'; 270 if($data->data->$symbol->quote->USD->percent_change_60d > 0) { 271 $span_before = '<span style="color:green;">'; 272 $span_after = '</span>'; 273 } elseif($data->data->$symbol->quote->USD->percent_change_60d < 0) { 274 $span_before = '<span style="color:red;">'; 275 $span_after = '</span>'; 276 } else { 277 $span_before = ''; 278 $span_after = ''; 279 } 280 return $span_before . round($data->data->$symbol->quote->USD->percent_change_60d, 3) . '%' . $span_after; 231 281 } 232 282 } … … 241 291 } else { 242 292 $data = json_decode(scs_get_coin_info($symbol)); 243 return round($data->data->$symbol->quote->USD->percent_change_90d, 3) . '%'; 293 if($data->data->$symbol->quote->USD->percent_change_90d > 0) { 294 $span_before = '<span style="color:green;">'; 295 $span_after = '</span>'; 296 } elseif($data->data->$symbol->quote->USD->percent_change_90d < 0) { 297 $span_before = '<span style="color:red;">'; 298 $span_after = '</span>'; 299 } else { 300 $span_before = ''; 301 $span_after = ''; 302 } 303 return $span_before . round($data->data->$symbol->quote->USD->percent_change_90d, 3) . '%' . $span_after; 244 304 } 245 305 }
Note: See TracChangeset
for help on using the changeset viewer.