Changeset 1961920
- Timestamp:
- 10/24/2018 09:49:42 AM (7 years ago)
- Location:
- currency-switcher/trunk
- Files:
-
- 4 edited
-
index.php (modified) (8 diffs)
-
js/plugin_options.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
views/plugin_options.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
currency-switcher/trunk/index.php
r1860396 r1961920 5 5 Description: Currency Switcher for WordPress 6 6 Author: realmag777 7 Version: 1.1. 27 Version: 1.1.3 8 8 Requires at least: WP 3.5.0 9 Tested up to: WP 4.9. 59 Tested up to: WP 4.9.8 10 10 Text Domain: currency-switcher 11 11 Domain Path: /languages … … 36 36 include_once WPCS_PATH . 'classes/auto_switcher.php'; 37 37 38 // 17-04-201838 //24-10-2018 39 39 final class WPCS { 40 40 41 public $the_plugin_version = '1.1. 2';41 public $the_plugin_version = '1.1.3'; 42 42 public $storage = null; 43 43 public $options = array(); … … 839 839 switch ($mode) { 840 840 case 'yahoo': 841 //http://www.idiotinside.com/2015/01/28/create-a-currency-converter-in-php-python-javascript-and-jquery-using-yahoo-currency-api/ 842 $yql_base_url = "http://query.yahooapis.com/v1/public/yql"; 843 $yql_query = 'select * from yahoo.finance.xchange where pair in ("' . $this->default_currency . $this->escape($_REQUEST['currency_name']) . '")'; 844 $yql_query_url = $yql_base_url . "?q=" . urlencode($yql_query); 845 $yql_query_url .= "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"; 846 //*** 841 $date = current_time('timestamp', true); 842 $yql_query_url = 'https://query1.finance.yahoo.com/v8/finance/chart/' . $this->default_currency . $this->escape($_REQUEST['currency_name']) . '=X?symbol=' . $this->default_currency . $this->escape($_REQUEST['currency_name']) . '%3DX&period1=' . ( $date - 60 * 86400 ) . '&period2=' . $date . '&interval=1d&includePrePost=false&events=div%7Csplit%7Cearn&lang=en-US®ion=US&corsDomain=finance.yahoo.com'; 847 843 if (function_exists('curl_init') AND $wpcs_use_curl) { 848 844 $res = $this->file_get_contents_curl($yql_query_url); … … 850 846 $res = file_get_contents($yql_query_url); 851 847 } 848 //$yql_query_url="http://query.yahooapis.com/v1/public/yql?q=select+%2A+from+yahoo.finance.xchange+where+pair+in+EURGBP&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"; 852 849 //*** 853 $yql_json = json_decode($res, true); 854 $request = (float) $yql_json['query']['results']['rate']['Rate']; 855 856 850 $data = json_decode($res, true); 851 $result = isset($data['chart']['result'][0]['indicators']['quote'][0]['open']) ? $data['chart']['result'][0]['indicators']['quote'][0]['open'] : ( isset($data['chart']['result'][0]['meta']['previousClose']) ? array($data['chart']['result'][0]['meta']['previousClose']) : array() ); 852 853 if (count($result) && is_array($result)) { 854 $request = end($result); 855 } 857 856 break; 858 857 … … 861 860 $from_Currency = urlencode($this->default_currency); 862 861 $to_Currency = urlencode($this->escape($_REQUEST['currency_name'])); 863 //$url = "http://www.google.com/finance/converter?a=$amount&from=$from_Currency&to=$to_Currency"; 864 $url = "https://finance.google.com/finance?q=" . $from_Currency . $to_Currency; 862 if ($to_Currency == $from_Currency) { 863 $request = 1; 864 break; 865 } 866 $url = 'https://www.google.com/async/currency_update?yv=2&async=source_amount:1,source_currency:' . $from_Currency . ',target_currency:' . $to_Currency . ',chart_width:270,chart_height:94,lang:en,country:vn,_fmt:jspb'; 865 867 if (function_exists('curl_init') AND $wpcs_use_curl) { 866 868 $html = $this->file_get_contents_curl($url); … … 869 871 } 870 872 871 preg_match_all('/<span class=bld>(.*?)<\/span>/s', $html, $matches); 872 if (isset($matches[1][0])) { 873 $request = floatval($matches[1][0]); 874 } else { 875 $request = sprintf(__("no data for %s", 'currency-switcher'), $this->escape($_REQUEST['currency_name'])); 876 } 877 873 if ($html) { 874 preg_match('/CurrencyUpdate\":\[\[(.+?)\,/', $html, $matches); 875 876 if (count($matches) > 0) { 877 $request = isset($matches[1]) ? $matches[1] : 1; 878 } else { 879 $request = sprintf(__("no data for %s", 'woocommerce-currency-switcher'), $this->escape($_REQUEST['currency_name'])); 880 } 881 } 878 882 break; 879 883 … … 1181 1185 $to_Currency = urlencode($this->escape($_REQUEST['currency_name'])); 1182 1186 //http://www.xe.com/currencyconverter/convert/?Amount=1&From=ZWD&To=CUP 1183 $url = "http ://www.xe.com/currencyconverter/convert/?Amount=1&From=" . $from_Currency . "&To=" . $to_Currency;1187 $url = "https://www.xe.com/currencyconverter/convert/?Amount=1&From=" . $from_Currency . "&To=" . $to_Currency; 1184 1188 if (function_exists('curl_init')) { 1185 1189 $html = $this->file_get_contents_curl($url); … … 1188 1192 } 1189 1193 //test 1190 preg_match_all('/<span class=\'uccResultAmount\'>(.*?)<\/span>/s', $html, $matches); 1194 var_dump($html); 1195 preg_match_all('/<span class="converterresult-toAmount">(.*?)<\/span>/s', $html, $matches); 1191 1196 if (isset($matches[1][0])) { 1192 1197 $request = floatval(str_replace(",", "", $matches[1][0])); -
currency-switcher/trunk/js/plugin_options.js
r1860391 r1961920 278 278 //jQuery("[name='wpcs_settings[wpcs_customer_signs]']").attr('readonly', 'readonly'); 279 279 280 280 jQuery('.wpcs_del_currency').life('click', function () { 281 jQuery(this).parents('li').hide(220, function () { 282 jQuery(this).remove(); 283 }); 284 return false; 285 }); 281 286 282 287 jQuery('.wpcs_is_etalon').life('click', function () { -
currency-switcher/trunk/readme.txt
r1860397 r1961920 4 4 Tags: currency, switcher, currency switcher, converter, marketing 5 5 Requires at least: 3.5.0 6 Tested up to: 4.9. 57 Stable tag: 1.1. 26 Tested up to: 4.9.8 7 Stable tag: 1.1.3 8 8 Requires PHP: 5.4 9 9 License: GPLv2 or later … … 111 111 == Changelog == 112 112 113 = 1.1.3 = 114 * removed currency agregators which stopped to work 115 * added back Google and Yahoo currency agregators 116 113 117 = 1.1.2 = 114 118 * new feature: Side switcher - https://wordpress.currency-switcher.com/documentation/#section_1_1 … … 147 151 == License == 148 152 149 This plugin is copyright pluginus.net © 2012-201 8with [GNU General Public License][] by realmag777.153 This plugin is copyright pluginus.net © 2012-2019 with [GNU General Public License][] by realmag777. 150 154 151 155 This program is free software; you can redistribute it and/or modify it under the terms of the [GNU General Public License][] as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -
currency-switcher/trunk/views/plugin_options.php
r1860394 r1961920 117 117 'css' => 'min-width:300px;', 118 118 'options' => array( 119 //'yahoo' => __('http://finance.yahoo.com', 'currency-switcher'),120 //'google' => __('http://google.com/finance', 'currency-switcher'),121 'appspot' => __('http://rate-exchange.appspot.com', 'currency-switcher'),119 'yahoo' => __('http://finance.yahoo.com', 'currency-switcher'), 120 'google' => __('http://google.com/finance', 'currency-switcher'), 121 //'appspot' => __('http://rate-exchange.appspot.com', 'currency-switcher'), 122 122 'rf' => __('http://www.cbr.ru - russian centrobank', 'currency-switcher'), 123 123 'privatbank' => 'api.privatbank.ua - ukrainian privatbank', … … 125 125 'free_converter' => 'The Free Currency Converter', 126 126 'cryptocompare' => 'CryptoCompare', 127 'xe' => 'XE Currency Converter'127 //'xe' => 'XE Currency Converter' 128 128 ), 129 129 'default' => 'free_converter' … … 298 298 <div class="wfc-control-section"> 299 299 300 300 301 <div style="display: none;"> 301 302 <div id="wpcs_item_tpl"><?php … … 327 328 328 329 329 <b style="color:red;"><?php _e('Hint' ,'currency-switcher'); ?>:</b> <?php _e('To update all currencies rates by one click - press radio button of the basic currency and then press "Save changes" button!', 'currency-switcher'); ?><br />330 <b style="color:red;"><?php _e('Hint'); ?>:</b> <?php _e('To update all currencies rates by one click - press radio button of the basic currency and then press "Save changes" button!', 'currency-switcher'); ?><br /> 330 331 331 332 </div><!--/ .wfc-control-section--> … … 460 461 </select> 461 462 <div class="wfc-description"><?php _e("Style of the fixed switcher", 'currency-switcher') ?></div> 462 463 464 <div class="wpcs_roll_blocks_wight" <?php if ($wpcs_auto_switcher_skin != 'roll_blocks'): ?>style="display: none;"<?php endif; ?>> 465 <?php $wpcs_auto_switcher_roll_px = (isset($this->options['auto_switcher_roll_px'])) ? $this->options['auto_switcher_roll_px'] : 90; ?> 466 <input type="text" name="wpcs_settings[auto_switcher_roll_px]" placeholder="<?php _e('enter roll width', 'currency-switcher') ?>" id="wpcs_auto_switcher_roll_px" style="min-width: 300px; margin-top: 3px;" value="<?php echo $wpcs_auto_switcher_roll_px ?>" > 463 <div class="wpcs_roll_blocks_wight" <?php if($wpcs_auto_switcher_skin !='roll_blocks'):?>style="display: none;"<?php endif;?>> 464 <?php 465 $wpcs_auto_switcher_roll_px = (isset($this->options['auto_switcher_roll_px'])) ? $this->options['auto_switcher_roll_px'] : 90; 466 ?> 467 <input type="text" name="wpcs_settings[auto_switcher_roll_px]" id="wpcs_auto_switcher_roll_px" style="min-width: 100px;" value="<?php echo $wpcs_auto_switcher_roll_px ?>" > 468 <label for="wpcs_auto_switcher_roll_px">px;<?php _e('How much to roll. ', 'currency-switcher') ?></label> 467 469 </div> 468 469 470 470 </td> 471 471 </tr> … … 502 502 ?> 503 503 <input type="text" name="wpcs_settings[auto_switcher_top_margin]" id="wpcs_auto_switcher_top_margin" style="min-width: 300px;" value="<?php echo $wpcs_auto_switcher_top_margin ?>" > 504 <div class="wfc-description"><?php _e("Distance from the top of the screen to the switcher html block. You can set in px or in %. Example 1: 100px. Example 2: 10%.", 'currency-switcher') ?></div>504 <div class="wfc-description"><?php _e("Distance from the top of the screen", 'currency-switcher') ?></div> 505 505 </td> 506 506 </tr> … … 821 821 <hr /> 822 822 823 <div style="font-style: italic;">In the free version of the plugin <b style="color: red;">you can operate with 2 ANY currencies only</b>. If you want more currencies and features you can make <a href="http://wordpress.currency-switcher.com/a/buy" target="_blank">upgrade to the premium version of the plugin</a></div><br />823 <div style="font-style: italic;">In the free version of the plugin <b>you can operate with 2 ANY currencies only</b>. If you want more currencies and features you can make <a href="http://wordpress.currency-switcher.com/a/buy" target="_blank">upgrade to the premium version of the plugin</a></div><br /> 824 824 825 825 <table style="width: 100%;"> … … 827 827 <tr> 828 828 <td style="width: 50%;"> 829 <h3 style="color: tomato;"><?php _e("UPGRADE to Full version", 'currency-switcher') ?>:</h3>829 <h3>Get the full version of the plugin from Codecanyon:</h3> 830 830 <a href="http://wordpress.currency-switcher.com/a/buy" target="_blank"><img width="200" src="<?php echo WPCS_LINK ?>img/wpcs_banner.png" alt="full version of the plugin"></a> 831 831 </td> … … 834 834 <a href="http://www.currency-switcher.com/a/buy" target="_blank"><img width="200" src="<?php echo WPCS_LINK ?>img/woocs_banner.png" alt="WooCommerce Currency Switcher"></a> 835 835 </td> 836 837 <!-- <td style="width: 33%;">838 <h3><?php _e("AliDropship is the best solution for drop shipping", 'currency-switcher') ?>:</h3>839 <a href="https://alidropship.com/plugin/?via=4352" target="_blank"><img width="200" src="<?php echo WPCS_LINK ?>img/drop-ship.jpg" alt="<?php _e("AliDropship is the best solution for drop shipping", 'currency-switcher'); ?>" /></a>840 </td> -->841 836 837 <!-- <td style="width: 33%;"> 838 <h3><?php _e("AliDropship is the best solution for drop shipping", 'currency-switcher') ?>:</h3> 839 <a href="https://alidropship.com/plugin/?via=4352" target="_blank"><img width="200" src="<?php echo WPCS_LINK ?>img/drop-ship.jpg" alt="<?php _e("AliDropship is the best solution for drop shipping", 'woocommerce-currency-switcher'); ?>" /></a> 840 </td> --> 841 842 842 </tr> 843 843 </tbody> … … 904 904 <input type="hidden" value="<?php echo $flag ?>" class="wpcs_flag_input" name="wpcs_flag[]" /> 905 905 <a href="#" class="wpcs_flag help_tip" data-tip="<?php _e("Click to select the flag", 'currency-switcher'); ?>"><img src="<?php echo $flag ?>" alt="<?php _e("Flag", 'currency-switcher'); ?>" /></a> 906 <a href="#" class="button wpcs_del_currency help_tip" data-tip="<?php _e("remove", 'currency-switcher'); ?>" style="vertical-align: middle;">X</a> 906 907 <a href="#" class="help_tip" data-tip="<?php _e("drag and drope", 'currency-switcher'); ?>"><img style="width: 22px; vertical-align: middle;" src="<?php echo WPCS_LINK ?>img/move.png" alt="<?php _e("move", 'currency-switcher'); ?>" /></a> 907 908 </li>
Note: See TracChangeset
for help on using the changeset viewer.