Changeset 512360
- Timestamp:
- 02/29/2012 02:15:58 PM (14 years ago)
- Location:
- worldcurrency/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (3 diffs)
-
worldcurrency-admin.php (modified) (7 diffs)
-
worldcurrency.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
worldcurrency/trunk/readme.txt
r512117 r512360 5 5 Requires at least: 2.8.0 6 6 Tested up to: 3.3.1 7 Stable tag: 1. 87 Stable tag: 1.9 8 8 9 9 Recognises users by IP address and shows them converted values in their local currency, you can write post/pages in multiple currencies. … … 34 34 * Is possible to choose to hide conversion if target and origin currency are the same 35 35 * Is possible to choose to make ajax calls over SSL 36 * Is possible to choose the decimal and thousands separator for the output format 36 37 37 38 = How To Use (once plugin is installed) = … … 91 92 == Changelog == 92 93 94 = 1.9 (29th February 2012) = 95 * Added: is now possible to choose the decimal and thousands separator for the output formatting 96 93 97 = 1.8 (29th February 2012) = 94 98 * Fix: ajax was not working if wordpress admin is under forced SSL with: define('FORCE_SSL_LOGIN', true); -
worldcurrency/trunk/worldcurrency-admin.php
r512117 r512360 21 21 $dt_wc_options['plugin_priority'] = absint($_POST['plugin_priority']); 22 22 $dt_wc_options['output_format'] = $_POST['output_format']; 23 $dt_wc_options['thousands_separator'] = $_POST['thousands_separator']; 24 $dt_wc_options['decimal_separator'] = $_POST['decimal_separator']; 23 25 $dt_wc_options['additional_css'] = $_POST['additional_css']; 24 26 $dt_wc_options['bottom_select'] = isset($_POST['bottom_select']) ? 'true' : 'false'; … … 53 55 <div id="poststuff"> 54 56 55 < div class="stuffbox">57 <form name="worldcurrency_options_form" action="" method="post"> 56 58 59 <div class="stuffbox"> 57 60 <h3>General Settings</h3> 58 61 <div class="inside"> 59 60 <form name="worldcurrency_options_form" action="" method="post"> 62 61 63 <?php if (function_exists('wp_nonce_field')) {wp_nonce_field('worldcurrency_admin_page_submit'); }?> 62 64 … … 78 80 Does not show the conversion if the origin value currency and the user local currency are the same 79 81 </p> 80 81 <p> 82 <h4> 83 Plugin Link: 84 <input type="checkbox" name="plugin_link" id="plugin_link" <?php if ($dt_wc_options['plugin_link']=='true') {echo 'checked="checked"';}?> /> 85 </h4> 86 By default, a link to the plugin home page is included near the currency select box.<br /> 87 Deselect this parameter if you want to disable the link, but <u>keep in mind that leaving the link is one the best ways to support this plugin</u>. 88 </p> 89 90 <p> 91 <h4> 92 Yahoo Link: 93 <input type="checkbox" name="yahoo_link" id="yahoo_link" <?php if ($dt_wc_options['yahoo_link']=='true') {echo 'checked="checked"';}?> /> 94 </h4> 95 By legal requirement a link to Yahoo! Finance will be shown near the currency select box.<br /> 96 Disable this only if you want to put this link elsewhere (ie: footer). 97 </p> 98 82 99 83 <p> 100 84 <h4> … … 116 100 </ul> 117 101 </p> 102 103 <p> 104 <h4> 105 Thousands separator: 106 <input type="text" size="80" name="thousands_separator" value="<?php echo isset($dt_wc_options['thousands_separator']) ? $dt_wc_options['thousands_separator'] : '.'; ?>" /> 107 </h4> 108 The character used to separate the tousands in the output (usually , or .) 109 </p> 110 111 <p> 112 <h4> 113 Decimals separator: 114 <input type="text" size="80" name="decimal_separator" value="<?php echo isset($dt_wc_options['decimal_separator']) ? $dt_wc_options['decimal_separator'] : ','; ?>" /> 115 </h4> 116 The character used to separate the decimal numbers in the output (usually , or .) 117 </p> 118 118 119 119 <p> … … 125 125 </p> 126 126 127 <p> 128 <h4> 129 Plugin Link: 130 <input type="checkbox" name="plugin_link" id="plugin_link" <?php if ($dt_wc_options['plugin_link']=='true') {echo 'checked="checked"';}?> /> 131 </h4> 132 By default, a link to the plugin home page is included near the currency selection box.<br /> 133 Deselect this parameter if you want to disable the link, but <u>keep in mind that leaving the link is one the best ways to support this plugin</u>. 134 </p> 135 136 <p> 137 <h4> 138 Yahoo Link: 139 <input type="checkbox" name="yahoo_link" id="yahoo_link" <?php if ($dt_wc_options['yahoo_link']=='true') {echo 'checked="checked"';}?> /> 140 </h4> 141 By legal requirement a link to Yahoo! Finance will be shown near the currency selection box.<br /> 142 Disable this only if you want to put this link elsewhere (ie: footer). 143 </p> 144 145 <p> 146 <h4> 147 Additional CSS styles:<br /> 148 <textarea name="additional_css" style="width:90%;height:250px;"><?php echo $dt_wc_options['additional_css']; ?></textarea> 149 </h4> 150 It is possible to change/set the styles of the converted values (.worldcurrency) and of the selection box (.worldcurrency_selection_box). Only for advanced users ;) 151 </p> 152 153 <div style="clear:both"></div> 154 </div> 155 </div> 156 157 158 <!-- Usage Section --> 159 <div class="stuffbox"> 160 <h3>Technical Settings</h3> 161 <div class="inside"> 162 127 163 <p> 128 164 <h4> … … 159 195 </p> 160 196 161 <p> 162 <h4> 163 Additional CSS styles:<br /> 164 <textarea name="additional_css" style="width:90%;height:250px;"><?php echo $dt_wc_options['additional_css']; ?></textarea> 165 </h4> 166 It is possible to change/set the styles of the converted values (.worldcurrency) and of the selection box (.worldcurrency_selection_box). Only for advanced users ;) 167 </p> 168 169 <!-- Show Update Button --> 170 <div class="submit"> 171 <input type="submit" name="dt_wc_options_submit" value="Update Options »"/> 172 <input type="submit" name="dt_wc_options_reset" value="Reset Options »"/> 173 </div> 174 175 176 </form> 177 <div style="clear:both"></div> 178 </div> 179 </div> 180 181 197 </div> 198 </div> 199 200 <!-- Show Update Button --> 201 <div class="submit"> 202 <input type="submit" name="dt_wc_options_submit" value="Update Options »"/> 203 <input type="submit" name="dt_wc_options_reset" value="Reset Options »"/> 204 </div> 205 206 </form> 207 182 208 <!-- Usage Section --> 183 209 <div class="stuffbox"> … … 200 226 </p> 201 227 <p> 202 You can also put this shorttag :<br /><br />228 You can also put this shorttag in pages/posts:<br /><br /> 203 229 <code style="padding:5px;margin:10px;"> 204 230 [worldcurrencybox] 205 231 </code><br /><br /> 206 Or this HTML code :<br /><br />232 Or this HTML code anywhere else:<br /><br /> 207 233 <code style="padding:5px;margin:10px;"> 208 234 <div class="worldcurrency_selection_box_placeholder"></div> 209 235 </code><br /><br /> 210 wherever you want the selection box to be shown (or select the option above to show it automatically at the bottom of the post) 236 wherever you want the <b>currency selection box</b> to be shown (or select the option above to show it automatically at the bottom of the post)<br /> 237 <br /> 238 There is also a <b>Widget</b> (for the sidebar) wich shows the Currency Selection Box only if there are currencies on the page. 211 239 </div> 212 240 </div> -
worldcurrency/trunk/worldcurrency.php
r512117 r512360 4 4 Plugin URI: http://www.cometicucinoilweb.it/blog/en/worldcurrency-plugin-for-wordpress/ 5 5 Description: Recognises users by IP address and shows them converted values in their local currency, you can write post/pages in multiple currencies. 6 Version: 1. 86 Version: 1.9 7 7 Date: 29th February 2012 8 8 Author: Daniele Tieghi … … 58 58 $dt_wc_options = get_option('$dt_wc_options'); 59 59 60 if ($force || !isset($dt_wc_options['plugin_link'])) $dt_wc_options['plugin_link'] = 'true'; 61 if ($force || !isset($dt_wc_options['yahoo_link'])) $dt_wc_options['yahoo_link'] = 'true'; 62 if ($force || !isset($dt_wc_options['cache_rates'])) $dt_wc_options['cache_rates'] = null; 63 if ($force || !isset($dt_wc_options['cache_time'])) $dt_wc_options['cache_time'] = 0; 64 if ($force || !isset($dt_wc_options['historic_rates'])) $dt_wc_options['historic_rates'] = 'false'; 65 if ($force || !isset($dt_wc_options['hide_if_same'])) $dt_wc_options['hide_if_same'] = 'true'; 66 if ($force || !isset($dt_wc_options['output_format'])) $dt_wc_options['output_format'] = '(~%to_value%%to_symbol% %to_code%)'; 67 if ($force || !isset($dt_wc_options['bottom_select'])) $dt_wc_options['bottom_select'] = 'true'; 68 if ($force || !isset($dt_wc_options['include_jquery'])) $dt_wc_options['include_jquery'] = 'true'; 69 if ($force || !isset($dt_wc_options['jquery_no_conflict'])) $dt_wc_options['jquery_no_conflict'] = 'false'; 70 if ($force || !isset($dt_wc_options['ajax_over_ssl'])) $dt_wc_options['ajax_over_ssl'] = 'false'; 71 if ($force || !isset($dt_wc_options['plugin_priority'])) $dt_wc_options['plugin_priority'] = 10; 72 if ($force || !isset($dt_wc_options['additional_css'])) $dt_wc_options['additional_css'] = <<<EOT 60 if ($force || !isset($dt_wc_options['plugin_link'])) $dt_wc_options['plugin_link'] = 'true'; 61 if ($force || !isset($dt_wc_options['yahoo_link'])) $dt_wc_options['yahoo_link'] = 'true'; 62 if ($force || !isset($dt_wc_options['cache_rates'])) $dt_wc_options['cache_rates'] = null; 63 if ($force || !isset($dt_wc_options['cache_time'])) $dt_wc_options['cache_time'] = 0; 64 if ($force || !isset($dt_wc_options['historic_rates'])) $dt_wc_options['historic_rates'] = 'false'; 65 if ($force || !isset($dt_wc_options['hide_if_same'])) $dt_wc_options['hide_if_same'] = 'true'; 66 if ($force || !isset($dt_wc_options['output_format'])) $dt_wc_options['output_format'] = '(~%to_value%%to_symbol% %to_code%)'; 67 if ($force || !isset($dt_wc_options['thousands_separator'])) $dt_wc_options['thousands_separator'] = '.'; 68 if ($force || !isset($dt_wc_options['decimal_separator'])) $dt_wc_options['decimal_separator'] = ','; 69 if ($force || !isset($dt_wc_options['output_format'])) $dt_wc_options['output_format'] = '(~%to_value%%to_symbol% %to_code%)'; 70 if ($force || !isset($dt_wc_options['bottom_select'])) $dt_wc_options['bottom_select'] = 'true'; 71 if ($force || !isset($dt_wc_options['include_jquery'])) $dt_wc_options['include_jquery'] = 'true'; 72 if ($force || !isset($dt_wc_options['jquery_no_conflict'])) $dt_wc_options['jquery_no_conflict'] = 'false'; 73 if ($force || !isset($dt_wc_options['ajax_over_ssl'])) $dt_wc_options['ajax_over_ssl'] = 'false'; 74 if ($force || !isset($dt_wc_options['plugin_priority'])) $dt_wc_options['plugin_priority'] = 10; 75 if ($force || !isset($dt_wc_options['additional_css'])) $dt_wc_options['additional_css'] = <<<EOT 73 76 .worldcurrency { 74 77 color: #888; … … 374 377 } 375 378 379 // Get the separators format 380 $thousands_separator = isset($dt_wc_options['thousands_separator']) ? $dt_wc_options['thousands_separator'] : '.'; 381 $decimals_separator = isset($dt_wc_options['decimal_separator']) ? $dt_wc_options['decimal_separator'] : ','; 382 383 376 384 // Load the quotes obtained 377 385 $YahooFinance->loadSerializedQuotes($serializedQuotes); … … 393 401 // Round the numbers 394 402 $exchange_rate = number_format($exchange_rate,2,',','.'); 395 $from_value = $from_value > 100 ? number_format($from_value,0, ',','.') : number_format($from_value, 2,',','.');396 $to_value = $to_value > 100 ? number_format($to_value,0, ',','.') : number_format($to_value, 2,',','.');403 $from_value = $from_value > 100 ? number_format($from_value,0,$decimals_separator,$thousands_separator) : number_format($from_value, 2,$decimals_separator,$thousands_separator); 404 $to_value = $to_value > 100 ? number_format($to_value,0,$decimals_separator,$thousands_separator) : number_format($to_value, 2,$decimals_separator,$thousands_separator); 397 405 398 406 // Do not show conversions to the same currency
Note: See TracChangeset
for help on using the changeset viewer.