Plugin Directory

Changeset 508782


Ignore:
Timestamp:
02/22/2012 11:18:15 AM (14 years ago)
Author:
WhiteCubes
Message:

Added jQuery.noconflict() option

Location:
worldcurrency/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • worldcurrency/trunk/readme.txt

    r508115 r508782  
    55Requires at least: 2.8.0
    66Tested up to: 3.3.1
    7 Stable tag: 1.5
     7Stable tag: 1.6
    88
    99Recognises users by IP address and shows them converted values in their local currency, you can write post/pages in multiple currencies.
     
    8686== Changelog ==
    8787
     88= 1.6 (22th February 2012) =
     89* Added option to use a jQuery.noconflict to increase compatibility with other themes/plugins
     90
    8891= 1.5 (21th February 2012) =
    8992* Hides the widget if no currency on page/post
  • worldcurrency/trunk/worldcurrency-admin.php

    r507825 r508782  
    1515        if (isset($_POST['dt_wc_options_submit']) && check_admin_referer('worldcurrency_admin_page_submit')) {
    1616
    17             $dt_wc_options['historic_rates']    = isset($_POST['historic_rates']) ? 'true' : 'false';
    18             $dt_wc_options['hide_if_same']      = isset($_POST['hide_if_same']) ? 'true' : 'false';
    19             $dt_wc_options['plugin_link']       = isset($_POST['plugin_link']) ? 'true' : 'false';
    20             $dt_wc_options['yahoo_link']        = isset($_POST['yahoo_link']) ? 'true' : 'false';
    21             $dt_wc_options['plugin_priority']   = absint($_POST['plugin_priority']);
    22             $dt_wc_options['output_format']     = $_POST['output_format'];
    23             $dt_wc_options['additional_css']    = $_POST['additional_css'];
    24             $dt_wc_options['bottom_select']     = isset($_POST['bottom_select']) ? 'true' : 'false';
    25             $dt_wc_options['include_jquery']    = isset($_POST['include_jquery']) ? 'true' : 'false';
     17            $dt_wc_options['historic_rates']        = isset($_POST['historic_rates']) ? 'true' : 'false';
     18            $dt_wc_options['hide_if_same']          = isset($_POST['hide_if_same']) ? 'true' : 'false';
     19            $dt_wc_options['plugin_link']           = isset($_POST['plugin_link']) ? 'true' : 'false';
     20            $dt_wc_options['yahoo_link']            = isset($_POST['yahoo_link']) ? 'true' : 'false';
     21            $dt_wc_options['plugin_priority']       = absint($_POST['plugin_priority']);
     22            $dt_wc_options['output_format']         = $_POST['output_format'];
     23            $dt_wc_options['additional_css']        = $_POST['additional_css'];
     24            $dt_wc_options['bottom_select']         = isset($_POST['bottom_select']) ? 'true' : 'false';
     25            $dt_wc_options['include_jquery']        = isset($_POST['include_jquery']) ? 'true' : 'false';
     26            $dt_wc_options['jquery_no_conflict']    = isset($_POST['jquery_no_conflict']) ? 'true' : 'false';
    2627           
    2728            update_option('dt_wc_options', $dt_wc_options);
     
    123124                        </p>
    124125                       
    125                        
    126126                        <p>
    127127                            <h4>
     
    130130                            </h4>
    131131                            This plugin uses and includes jQuery, if you already have jQuery included in your blog pages (by theme or other plugins), you may want to disable this.
     132                        </p>
     133                       
     134                        <p>
     135                            <h4>
     136                                jQuery no conflict:
     137                                <input type="checkbox" name="jquery_no_conflict" id="jquery_no_conflict" <?php if ($dt_wc_options['jquery_no_conflict']=='true') {echo 'checked="checked"';}?> />
     138                            </h4>
     139                            Uses "jQuery" instead of "$" for calling jQuery functions. Usefull also if you have a noconflict version of jQuery included by other themes/plugins
    132140                        </p>
    133141                       
  • worldcurrency/trunk/worldcurrency.php

    r508115 r508782  
    44Plugin URI: http://www.cometicucinoilweb.it/blog/en/worldcurrency-plugin-for-wordpress/
    55Description: 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.5
     6Version: 1.6
    77Date: 21th February 2012
    88Author: Daniele Tieghi
     
    6262            if ($force || !isset($dt_wc_options['bottom_select']))      $dt_wc_options['bottom_select'] = 'true';
    6363            if ($force || !isset($dt_wc_options['include_jquery']))     $dt_wc_options['include_jquery'] = 'true';
     64            if ($force || !isset($dt_wc_options['jquery_no_conflict']))     $dt_wc_options['jquery_no_conflict'] = 'false';
    6465            if ($force || !isset($dt_wc_options['plugin_priority']))    $dt_wc_options['plugin_priority'] = 10;
    6566            if ($force || !isset($dt_wc_options['additional_css']))     $dt_wc_options['additional_css'] = <<<EOT
     
    9394            $dt_wc_options = get_option('dt_wc_options');
    9495           
     96            $jQuerySymbol = $dt_wc_options['jquery_no_conflict'] == 'true' ? 'jQuery' : '$';
     97           
    9598            // Include the script only if necessary
    9699            if (strpos($post->post_content, 'worldcurrency') !== false) {
     
    108111                <script type="text/javascript">
    109112                <!--
     113
     114                    <?php if ($dt_wc_options['jquery_no_conflict'] == 'true'): ?>
     115                        jQuery.noConflict();
     116                    <?php endif; ?>
    110117   
    111118                    dt_worldCurrency_update = function(userCurrency) {
    112119                        // For each worldcurrency <span> get the value
    113                         $('.worldcurrency').each(function() {
    114        
    115                             var theSpan = $(this);
    116                             $.ajax({
     120                        <?php echo $jQuerySymbol; ?>('.worldcurrency').each(function() {
     121       
     122                            var theSpan = <?php echo $jQuerySymbol; ?>(this);
     123                            <?php echo $jQuerySymbol; ?>.ajax({
    117124                                url: '<?php echo wp_nonce_url(plugins_url(dirname(plugin_basename(__FILE__))).'/_getexchangerate.php', 'worldcurrency_safe'); ?>',
    118125                                dataType: 'html',
     
    129136
    130137                        // For each Currency selection box, chose the right value
    131                         $('.worldcurrency_select').val(userCurrency);
     138                        <?php echo $jQuerySymbol; ?>('.worldcurrency_select').val(userCurrency);
    132139                       
    133140                    }
    134141   
    135142                    // When the page is loaded
    136                     $(document).ready(function() {
     143                    <?php echo $jQuerySymbol; ?>(document).ready(function() {
    137144
    138145                        // Register already rendere currency selection boxes
    139                         $('.worldcurrency_select').change(function() {
    140                             dt_worldCurrency_update($(this).attr('value'));
     146                        <?php echo $jQuerySymbol; ?>('.worldcurrency_select').change(function() {
     147                            dt_worldCurrency_update(<?php echo $jQuerySymbol; ?>(this).attr('value'));
    141148                        });
    142149
    143150                        // Render Currency selection boxes
    144                         $('.worldcurrency_selection_box_placeholder').each(function() {
    145        
    146                             var theDiv = $(this);
    147                             $.ajax({
     151                        <?php echo $jQuerySymbol; ?>('.worldcurrency_selection_box_placeholder').each(function() {
     152       
     153                            var theDiv = <?php echo $jQuerySymbol; ?>(this);
     154                            <?php echo $jQuerySymbol; ?>.ajax({
    148155                                url: '<?php echo wp_nonce_url(plugins_url(dirname(plugin_basename(__FILE__))).'/_getcurrencyselectionbox.php', 'worldcurrency_safe'); ?>',
    149156                                dataType: 'html',
     
    158165                                    // On change update currency
    159166                                    theSelect.change(function() {
    160                                         dt_worldCurrency_update($(this).attr('value'));
     167                                        dt_worldCurrency_update(<?php echo $jQuerySymbol; ?>(this).attr('value'));
    161168                                    });
    162169                                },
Note: See TracChangeset for help on using the changeset viewer.