WordPress.org

Plugin Directory

Changeset 522772


Ignore:
Timestamp:
03/23/12 19:11:35 (2 years ago)
Author:
neoxx
Message:

2.43

  • changed handling of contextual help for WordPress 3.3
  • implemented WordPress 3.3 Admin Bar add_node() function
  • adopted handling of default settings
  • external files are now registered in init-hook
Location:
timezonecalculator/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • timezonecalculator/trunk/readme.txt

    r436071 r522772  
    44Tags: time, date, timezone, calendar, world clock, clock, travel, widget, sidebar, dashboard, shortcode, multisite, multi-site, ajax, javascript, jquery, prototype, bar, admin bar 
    55Requires at least: 2.8 
    6 Tested up to: 3.3 
     6Tested up to: 3.4 
    77Stable tag: trunk 
    88 
     
    1818* fully optionpage-configurable 
    1919* easy to integrate (ships with multi/sidebar- and dashboard-widget functionality as well as integrated timezones search function) 
    20 * display clock in WordPress 3.1 Admin Bar 
     20* display clock in WordPress 3.1+ Admin Bar 
    2121* display clock in Admin Menu header 
    22 * possible to integrate in "Right Now" box on the dashboard or on the user's profile page 
    23 * Calculator section in tools-Menu with individual timezone-selection for every user 
     22* possible to integrate in "Right Now" box or to display as widget on the dashboard and on the user's profile page 
     23* Calculator section in Tools-Menu with individual timezone-selection for every user 
    2424* optional Ajax refresh (jQuery or Prototype) 
    2525* fully compatible with [https/SSL/TLS-sites](http://codex.wordpress.org/Administration_Over_SSL) 
     
    2492492. This picture presents the Preview Section of the TimeZoneCalculator Tab in the Admin Menu. 
    250250 
    251 3. This screenshot shows an example of the clock in the WordPress 3.1 Admin Bar. - The date/time and the display format can be customized. 
     2513. This screenshot shows an example of the clock in the WordPress 3.1+ Admin Bar. - The date/time and the display format can be customized. 
    252252 
    2532534. This image presents an example of the clock of the Admin Menu. - The date/time and the display format can be customized. 
     
    262262 
    263263== Changelog == 
     264 
     265= 2.43 = 
     266 
     267* changed handling of contextual help for WordPress 3.3 
     268* implemented WordPress 3.3 Admin Bar add_node() function 
     269* adopted handling of default settings 
     270* external files are now registered in init-hook 
    264271 
    265272= 2.42 = 
  • timezonecalculator/trunk/timezonecalculator.php

    r436071 r522772  
    66Description: Calculates, displays and automatically updates times and dates in different timezones with respect to daylight saving. 
    77Author: Dr. Bernhard Riedl 
    8 Version: 2.42 
     8Version: 2.43 
    99Author URI: http://www.bernhard.riedl.name/ 
    1010*/ 
    1111 
    1212/* 
    13 Copyright 2005-2011 Dr. Bernhard Riedl 
    14  
    15 Inspirations & Proof-Reading 2007-2011 
     13Copyright 2005-2012 Dr. Bernhard Riedl 
     14 
     15Inspirations & Proof-Reading 2007-2012 
    1616by Veronika Grascher 
    1717 
     
    275275        $this->set_plugin_url(); 
    276276        $this->retrieve_settings(); 
    277         $this->register_scripts(); 
    278         $this->register_styles(); 
    279277        $this->register_hooks(); 
    280278    } 
     
    284282    */ 
    285283 
    286     private function register_scripts() { 
     284    function register_scripts() { 
    287285 
    288286        /* 
     
    323321    */ 
    324322 
    325     private function register_styles() { 
     323    function register_styles() { 
    326324        wp_register_style('unobtrusive_date_picker_widget', $this->get_plugin_url().'js/datepicker/css/datepicker.css', array(), '5.4'); 
    327325    } 
     
    332330 
    333331    private function register_hooks() { 
     332 
     333        /* 
     334        register externals 
     335        */ 
     336 
     337        add_action('init', array(&$this, 'register_scripts')); 
     338        add_action('init', array(&$this, 'register_styles')); 
    334339 
    335340        /* 
     
    610615 
    611616            /* 
    612             for some strange reason, 
    613             WordPress doesn't like to 
    614             write to an empty option 
     617            we intentionally write 
     618            the fallbacks in the 
     619            database to activate 
     620            built-in caching 
     621            and repair a broken 
     622            settings-array 
    615623            */ 
    616624 
    617625            else { 
    618                 update_option($this->get_prefix(false), array()); 
     626                $defaults=$this->fallback_defaults; 
     627 
     628                unset($defaults['query_time']); 
     629                unset($defaults['query_timezone']); 
     630 
     631                update_option( 
     632                    $this->get_prefix(false), 
     633                    array( 
     634                        'defaults' => $defaults, 
     635                        'options' => $this->fallback_options 
     636                    ) 
     637                ); 
    619638            } 
    620639        } 
     
    664683 
    665684        if (isset($input['reset'])) { 
     685            $defaults=$this->fallback_defaults; 
     686 
     687            unset($defaults['query_time']); 
     688            unset($defaults['query_timezone']); 
     689 
    666690            return array( 
    667                 'defaults' => $this->fallback_defaults, 
     691                'defaults' => $defaults, 
    668692                'options' => $this->fallback_options 
    669693            ); 
     
    671695 
    672696        /* 
    673         check-fields are either 0 or 1 
     697        check-fields will be 
     698        converted to true/false 
    674699        */ 
    675700 
     
    690715 
    691716        foreach ($check_fields as $check_field) { 
    692             $input[$check_field] = (isset($input[$check_field]) && $input[$check_field] == 1 ? true : false); 
     717            $input[$check_field] = (isset($input[$check_field]) && $input[$check_field] == 1) ? true : false; 
    693718        } 
    694719 
     
    17621787 
    17631788    /* 
     1789    Calculator Page Help Tab 
     1790    */ 
     1791 
     1792    function calculator_page_help_tab() { 
     1793        $this->add_help_tab($this->calculator_page_help()); 
     1794    } 
     1795 
     1796    /* 
    17641797    Calculator World-Clock-Page 
    17651798    */ 
     
    17871820 
    17881821    /* 
     1822    Options Page Help Tab 
     1823    */ 
     1824 
     1825    function options_page_help_tab() { 
     1826        $this->add_help_tab($this->options_page_help()); 
     1827    } 
     1828 
     1829    /* 
    17891830    white list options 
    17901831    */ 
     
    18291870        add_action('admin_print_scripts-'.$options_page, array(&$this, 'settings_print_scripts')); 
    18301871        add_action('admin_head-'.$options_page, array(&$this, 'admin_styles')); 
    1831         add_contextual_help($options_page, $this->options_page_help()); 
     1872        add_action('load-'.$options_page, array(&$this, 'options_page_help_tab')); 
    18321873 
    18331874        /* 
     
    18411882        add_action('admin_print_styles-'.$calculator_page, array(&$this, 'calculator_print_styles')); 
    18421883        add_action('admin_head-'.$calculator_page, array(&$this, 'admin_styles')); 
    1843         add_contextual_help($calculator_page, $this->calculator_page_help()); 
     1884        add_action('load-'.$calculator_page, array(&$this, 'calculator_page_help_tab')); 
    18441885 
    18451886        /* 
     
    18591900 
    18601901    function head_meta() { 
    1861         echo("<meta name=\"".$this->get_nicename()."\" content=\"2.42\"/>\n"); 
     1902        echo("<meta name=\"".$this->get_nicename()."\" content=\"2.43\"/>\n"); 
    18621903    } 
    18631904 
     
    20382079            return false; 
    20392080 
    2040         $wp_admin_bar->add_menu( 
    2041             array( 
    2042                 'id' => $this->get_prefix(false), 
    2043                 'title' => $wordpress_clock_span, 
    2044                 'href' => $clock_href 
    2045             ) 
     2081        $admin_bar_params=array( 
     2082            'id' => $this->get_prefix(false), 
     2083            'title' => $wordpress_clock_span, 
     2084            'href' => $clock_href 
    20462085        ); 
     2086 
     2087        /* 
     2088        WordPress >= 3.3 
     2089        */ 
     2090 
     2091        global $wp_version; 
     2092 
     2093        if (version_compare($wp_version, '3.3', '>=')) 
     2094            $wp_admin_bar->add_node($admin_bar_params); 
     2095 
     2096        /* 
     2097        WordPress < 3.3 
     2098        */ 
     2099 
     2100        else 
     2101            $wp_admin_bar->add_menu($admin_bar_params); 
    20472102    } 
    20482103 
     
    29042959    private function do_settings_sections($section_key, $section_prefix) { 
    29052960        do_settings_sections($this->get_prefix().$section_prefix.'_'.$section_key); 
     2961    } 
     2962 
     2963    /* 
     2964    handles adding a help-tab 
     2965    */ 
     2966 
     2967    private function add_help_tab($help_text) { 
     2968        $current_screen=get_current_screen(); 
     2969 
     2970        /* 
     2971        WP >= 3.0 
     2972        */ 
     2973 
     2974        if (!method_exists($current_screen, 'add_help_tab')) 
     2975            add_contextual_help($current_screen, $help_text); 
     2976 
     2977        /* 
     2978        WP >= 3.3 
     2979        */ 
     2980 
     2981        else { 
     2982            $help_options=array( 
     2983                'id' => $this->get_prefix(), 
     2984                'title' => $this->get_nicename(), 
     2985                'content' => $help_text 
     2986            ); 
     2987 
     2988            $current_screen->add_help_tab($help_options); 
     2989        } 
    29062990    } 
    29072991 
     
    38263910            <li>Remember that on every refresh all timezone-information has to be retrieved from the server. Thus, an <em>Ajax Refresh Time</em> of one second is not practicable for the average server out there. In addition, every update causes bandwith usage for your readers and your server.</li> 
    38273911 
    3828             <li>Due to security reasons, the time for <abbr title="asynchronous JavaScript and XML">Ajax</abbr> updates will be limited by default. WordPress normally defines this time to be 24 hours. If you activate <em>Renew nonce to assure continous updates</em> you override this security feature but provide unlimited time for <abbr title="asynchronous JavaScript and XML">Ajax</abbr> updates of your timezones.</li> 
     3912            <li>Due to security reasons, the time for <abbr title="asynchronous JavaScript and XML">Ajax</abbr> updates will be limited by default. In your installation, the nonce-life-time is defined as <?php $nonce_life=apply_filters('nonce_life', 86400); echo(number_format((float) ($nonce_life/3600), 0).' hours ('.$nonce_life.' seconds)'); ?>. If you activate <em>Renew nonce to assure continous updates</em> you override this security feature (only for <?php echo($this->get_nicename()); ?>) but provide unlimited time for <abbr title="asynchronous JavaScript and XML">Ajax</abbr> updates of your timezones.</li> 
    38293913 
    38303914            <li>In the last option, <em>Ajax Refresh Library in Front-End</em>, you can choose whether to use <a target="_blank" href="http://jquery.com/">jQuery</a> or <a target="_blank" href="http://www.prototypejs.org/">Prototype</a> for the Ajax Refresh in your theme.</li> 
     
    40004084 
    40014085    function callback_calculator_intro() { ?> 
    4002         This section is meant to be your personal timezones calculator (e.g. for checking flight schedules or finding online friends in other timezones). - You can specify a certain timestamp, which will be displayed in the <?php echo($this->get_section_link($this->calculator_page_sections, 'selected_timezones', 'timezones')); ?> that you've chosen. 
     4086        This section is meant to be your personal timezones calculator (e.g. for checking flight schedules or determining the current time of your friends round the globe). - You can specify a certain timestamp, which will be displayed in the <?php echo($this->get_section_link($this->calculator_page_sections, 'selected_timezones', 'timezones')); ?> that you've chosen. 
    40034087        <?php if ($this->get_option('world_clock_tools_page') && current_user_can($this->get_option('world_clock_tools_page_capability'))) { ?><br /><br />You can also view the current time of your timezones<?php if ($this->get_option('use_ajax_refresh')) { ?>, which automatically updates,<?php } ?> on the <a href="tools.php?page=<?php echo($this->get_world_clock_tools_page()); ?>">world clock</a>.<?php } ?> 
    40044088    <?php } 
Note: See TracChangeset for help on using the changeset viewer.