WordPress.org

Plugin Directory

Changeset 538807


Ignore:
Timestamp:
05/02/12 07:10:23 (2 years ago)
Author:
wet
Message:

wet_bmicalc: New option 'infohref'. Requires WP 2.8+ now.

Location:
body-mass-index-calculator-widget/trunk
Files:
1 deleted
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • body-mass-index-calculator-widget/trunk/readme.txt

    r487642 r538807  
    11=== Body Mass Index (BMI) Calculator Widget === 
    22Contributors: wet 
    3 Tags: badge, widget, widgets, plugin, plugins, sidebar, health, nutrition, fitness, obesity, ernährung, diät, abnehmen, gesundheit, übergewicht, bmi, body mass index, shortcode 
    4 Requires at least: 2.3 
    5 Tested up to: 3.3.1 
     3Tags: widget, widgets, plugin, plugins, sidebar, health, nutrition, fitness, obesity, abnehmen, gesundheit, bmi, body mass index, shortcode 
     4Requires at least: 2.8 
     5Tested up to: 3.4 
    66Stable tag: trunk 
    77 
     
    5050== Changelog == 
    5151 
     52= 1.6.0 = 
     53 
     541. Compatibility check with WordPress 3.4 
     551. Enhanced configurability 
     56 
    5257= 1.5.0 = 
    5358 
    54 1. Improved German translation by [Nic Bastelt](http://nicbastelt.com/). 
    55 2. Compatibility check with WordPress 3.1. 
    56  
    57 == Developer Notes == 
    58  
    59 Interested in developing your own widgets? Read [All You Ever Wanted to Ask about Programming WordPress Widgets But Were Afraid to Ask](http://talkpress.de/artikel/wordpress-widget-programmieren) at my development blog (in German/auf Deutsch). 
     591. Improved German translation by [Nic Bastelt](http://nicbastelt.com/) 
     601. Compatibility check with WordPress 3.1 
  • body-mass-index-calculator-widget/trunk/wet_bmicalc-en_US.po

    r487627 r538807  
    1 # wet_bmicalc WordPess Widget. 
    2 # Copyright (C) 2008 Robert Wetzlmayr 
    3 # This file is distributed under the same license as the wet_bmicalc package. 
     1# SOME DESCRIPTIVE TITLE. 
     2# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 
     3# This file is distributed under the same license as the PACKAGE package. 
     4# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 
    45# 
    56msgid "" 
    67msgstr "" 
    7 "Project-Id-Version: wet_bmicalc\n" 
     8"Project-Id-Version: PACKAGE VERSION\n" 
    89"Report-Msgid-Bugs-To: http://wordpress.org/tag/body-mass-index-calculator-widget\n" 
    9 "POT-Creation-Date: 2008-05-09 14:16+0000\n" 
    10 "PO-Revision-Date: 2012-01-10 17:23+0100\n" 
     10"POT-Creation-Date: 2012-05-02 08:52+0200\n" 
     11"PO-Revision-Date: 2012-05-02 08:55+0100\n" 
    1112"Last-Translator: \n" 
    12 "Language-Team:  <r.wetzlmayr@gmail.com>\n" 
     13"Language-Team: LANGUAGE <LL@li.org>\n" 
    1314"MIME-Version: 1.0\n" 
    1415"Content-Type: text/plain; charset=UTF-8\n" 
    1516"Content-Transfer-Encoding: 8bit\n" 
    16 "X-Poedit-Language: English\n" 
    17 "X-Poedit-SourceCharset: utf-8\n" 
    1817 
     18#: wet_bmicalc.php:22 
     19#: wet_bmicalc.php:30 
     20msgid "Body Mass Index" 
     21msgstr "" 
     22 
     23#: wet_bmicalc.php:25 
     24msgid "Allows the user to calculate the Body Mass Index (BMI) from body weight and height." 
     25msgstr "" 
     26 
     27#: wet_bmicalc.php:43 
     28msgid "Calculate Your Body Mass Index" 
     29msgstr "" 
     30 
     31#: wet_bmicalc.php:44 
     32msgid "Calculate" 
     33msgstr "" 
     34 
     35#: wet_bmicalc.php:57 
     36msgid "Title:" 
     37msgstr "" 
     38 
     39#: wet_bmicalc.php:59 
     40msgid "Button Text:" 
     41msgstr "" 
     42 
     43#: wet_bmicalc.php:61 
     44msgid "Use BMI Table at:" 
     45msgstr "" 
     46 
     47#: wet_bmicalc.php:77 
     48msgid "Height in cm:" 
     49msgstr "" 
     50 
     51#: wet_bmicalc.php:78 
     52msgid "Weight in kg:" 
     53msgstr "" 
     54 
     55#: wet_bmicalc.php:79 
     56msgid "Your <acronym title=\"Body Mass Index\">BMI</acronym> is" 
     57msgstr "" 
     58 
     59#: wet_bmicalc.php:82 
     60msgid "Check your Body Mass Index&nbsp;&raquo;" 
     61msgstr "" 
     62 
     63#: wet_bmicalc.php:85 
    1964msgid "." 
    20 msgstr "." 
     65msgstr "" 
    2166 
    22 msgid "Height in cm:" 
    23 msgstr "Height in cm:" 
     67#: wet_bmicalc.php:114 
     68msgid "This Widget requires Javascript" 
     69msgstr "" 
    2470 
    25 msgid "Weight in kg:" 
    26 msgstr "Weight in kg:" 
    27  
    28 msgid "Your <acronym title=\"Body Mass Index\">BMI</acronym> is" 
    29 msgstr "Your <acronym title=\"Body Mass Index\">BMI</acronym> is" 
    30  
    31 msgid "Check your Body Mass Index&nbsp;&raquo;" 
    32 msgstr "Check your Body Mass Index&nbsp;&raquo;" 
    33  
    34 msgid "This Widget requires Javascript" 
    35 msgstr "This Widget requires Javascript" 
    36  
    37 msgid "Calculate Your Body Mass Index" 
    38 msgstr "Calculate Your Body Mass Index" 
    39  
    40 msgid "Calculate" 
    41 msgstr "Calculate" 
    42  
    43 msgid "Title:" 
    44 msgstr "Title:" 
    45  
    46 msgid "Button Text:" 
    47 msgstr "Button Text:" 
    48  
    49 msgid "Body Mass Index" 
    50 msgstr "Body Mass Index" 
    51  
    52 msgid "Allows the user to calculate the Body Mass Index (BMI) from body weight and height." 
    53 msgstr "Allows the user to calculate the Body Mass Index (BMI) from body weight and height." 
    54  
  • body-mass-index-calculator-widget/trunk/wet_bmicalc-xx_XX.pot

    r487627 r538807  
     1msgid "" 
     2msgstr "" 
     3"POT-Creation-Date: 2012-05-02 08:52+0200\n" 
     4"MIME-Version: 1.0\n" 
     5"Content-Type: text/plain; charset=CHARSET\n" 
     6"Content-Transfer-Encoding: 8bit\n" 
    17"Project-Id-Version: wet_bmicalc\n" 
    28"Report-Msgid-Bugs-To: http://wordpress.org/tag/body-mass-index-calculator-widget\n" 
    3 "POT-Creation-Date: 2008-05-09 14:16+0000\n" 
    4 "PO-Revision-Date: 2008-05-09 16:17+0100\n" 
    59"Last-Translator: Robert Wetzlmayr <kontakt@wetzlmayr.at>\n" 
    610"Language-Team: \n" 
    7 "MIME-Version: 1.0\n" 
    8 "Content-Type: text/plain; charset=utf-8\n" 
    9 "Content-Transfer-Encoding: 8bit\n" 
    10 "X-Poedit-SourceCharset: utf-8\n" 
    1111 
     12#: wet_bmicalc.php:22 wet_bmicalc.php:30 
     13msgid "Body Mass Index" 
     14msgstr "" 
     15 
     16#: wet_bmicalc.php:25 
     17msgid "" 
     18"Allows the user to calculate the Body Mass Index (BMI) from body weight and " 
     19"height." 
     20msgstr "" 
     21 
     22#: wet_bmicalc.php:43 
     23msgid "Calculate Your Body Mass Index" 
     24msgstr "" 
     25 
     26#: wet_bmicalc.php:44 
     27msgid "Calculate" 
     28msgstr "" 
     29 
     30#: wet_bmicalc.php:57 
     31msgid "Title:" 
     32msgstr "" 
     33 
     34#: wet_bmicalc.php:59 
     35msgid "Button Text:" 
     36msgstr "" 
     37 
     38#: wet_bmicalc.php:61 
     39msgid "Use BMI Table at:" 
     40msgstr "" 
     41 
     42#: wet_bmicalc.php:77 
     43msgid "Height in cm:" 
     44msgstr "" 
     45 
     46#: wet_bmicalc.php:78 
     47msgid "Weight in kg:" 
     48msgstr "" 
     49 
     50#: wet_bmicalc.php:79 
     51msgid "Your <acronym title=\"Body Mass Index\">BMI</acronym> is" 
     52msgstr "" 
     53 
     54#: wet_bmicalc.php:82 
     55msgid "Check your Body Mass Index&nbsp;&raquo;" 
     56msgstr "" 
     57 
     58#: wet_bmicalc.php:85 
    1259msgid "." 
    1360msgstr "" 
    1461 
    15 msgid "Height in cm:" 
    16 msgstr "" 
    17  
    18 msgid "Weight in kg:" 
    19 msgstr "" 
    20  
    21 msgid "Your <acronym title=\"Body Mass Index\">BMI</acronym> is" 
    22 msgstr "" 
    23  
    24 msgid "Check your Body Mass Index&nbsp;&raquo;" 
    25 msgstr "" 
    26  
     62#: wet_bmicalc.php:114 
    2763msgid "This Widget requires Javascript" 
    2864msgstr "" 
    29  
    30 msgid "Calculate Your Body Mass Index" 
    31 msgstr "" 
    32  
    33 msgid "Calculate" 
    34 msgstr "" 
    35  
    36 msgid "Title:" 
    37 msgstr "" 
    38  
    39 msgid "Button Text:" 
    40 msgstr "" 
    41  
    42 msgid "Body Mass Index" 
    43 msgstr "" 
    44  
    45 msgid "Allows the user to calculate the Body Mass Index (BMI) from body weight and height." 
    46 msgstr "" 
  • body-mass-index-calculator-widget/trunk/wet_bmicalc.php

    r487644 r538807  
    1313 
    1414    function init() { 
    15         // check for the required WP functions, die silently for pre-2.2 WP. 
    16         if (!function_exists('wp_register_sidebar_widget')) 
    17             return; 
     15        // check for the required WP functions, die silently for pre-2.8 WP. 
     16        if (!function_exists('esc_js')) return; 
    1817 
    1918        // load all l10n string upon entry 
     
    3029        // let WP know of this widget's controller entry 
    3130        wp_register_widget_control('wet_bmicalc', __('Body Mass Index', 'wet_bmicalc'), array('wet_bmicalc', 'control'), 
    32             array('width' => 300) 
     31            array('width' => 400) 
    3332        ); 
    3433 
     
    4039    // back end options dialogue 
    4140    function control() { 
    42         $options = get_option('wet_bmicalc'); 
    43         if (!is_array($options)) 
    44             $options = array('title'=>__('Calculate Your Body Mass Index', 'wet_bmicalc'), 'buttontext'=>__('Calculate', 'wet_bmicalc')); 
     41        $options = shortcode_atts( 
     42            array( 
     43                'title'     =>  __('Calculate Your Body Mass Index', 'wet_bmicalc'), 
     44                'buttontext'=>  __('Calculate', 'wet_bmicalc'), 
     45                'infohref'  =>  'http://abnehmtipps.at/body-mass-index/' 
     46            ), 
     47            get_option('wet_bmicalc') 
     48        ); 
    4549        if ($_POST['wet_bmicalc-submit']) { 
    4650            $options['title'] = strip_tags(stripslashes($_POST['wet_bmicalc-title'])); 
    4751            $options['buttontext'] = strip_tags(stripslashes($_POST['wet_bmicalc-buttontext'])); 
     52            $options['infohref'] = $_POST['wet_bmicalc-infohref']; 
    4853            update_option('wet_bmicalc', $options); 
    4954        } 
    50         $title = htmlspecialchars($options['title'], ENT_QUOTES); 
    51         $buttontext = htmlspecialchars($options['buttontext'], ENT_QUOTES); 
    5255 
    53         echo '<p style="text-align:right;"><label for="wet_bmicalc-title">' . __('Title:') . 
    54         ' <input style="width: 200px;" id="wet_bmicalc-title" name="wet_bmicalc-title" type="text" value="'.$title.'" /></label></p>'; 
    55         echo '<p style="text-align:right;"><label for="wet_bmicalc-buttontext">' .  __('Button Text:', 'widgets') . 
    56         ' <input style="width: 200px;" id="wet_bmicalc-buttontext" name="wet_bmicalc-buttontext" type="text" value="'.$buttontext.'" /></label></p>'; 
    57         echo '<input type="hidden" id="wet_bmicalc-submit" name="wet_bmicalc-submit" value="1" />'; 
     56        echo 
     57        '<p style="text-align:right;"><label for="wet_bmicalc-title">' . __('Title:') . 
     58        ' <input style="width: 200px;" id="wet_bmicalc-title" name="wet_bmicalc-title" type="text" value="' .esc_html($options['title']). '" /></label></p>' . 
     59        '<p style="text-align:right;"><label for="wet_bmicalc-buttontext">' .  __('Button Text:', 'wet_bmicalc') . 
     60        ' <input style="width: 200px;" id="wet_bmicalc-buttontext" name="wet_bmicalc-buttontext" type="text" value="' .esc_html($options['buttontext']). '" /></label></p>' . 
     61        '<p style="text-align:right;"><label for="wet_bmicalc-infohref">' .  __('Use BMI Table at:', 'wet_bmicalc') . 
     62        ' <input style="width: 200px;" id="wet_bmicalc-infohref" name="wet_bmicalc-infohref" type="text" value="' .esc_url($options['infohref']). '" /></label></p>'. 
     63        '<input type="hidden" id="wet_bmicalc-submit" name="wet_bmicalc-submit" value="1" />'; 
    5864    } 
    5965 
    6066    function view($is_widget, $args=array()) { 
    61         if($is_widget) extract($args); 
     67        if ($is_widget) extract($args); 
    6268 
    6369        // get widget options 
    6470        $options = get_option('wet_bmicalc'); 
    65         $title = $options['title']; 
    66         $buttontext = $options['buttontext']; 
     71        $options['title'] = esc_html($options['title']); 
     72        $options['buttontext'] = esc_html($options['buttontext']); 
     73        $options['infohref'] = esc_url($options['infohref']); 
     74        extract(array_map('esc_js', $options)); 
    6775 
    68         // l10n strings 
     76        // l10n strings 
    6977        $lbl_height =  __('Height in cm:', 'wet_bmicalc'); 
    7078        $lbl_weight = __('Weight in kg:', 'wet_bmicalc'); 
    7179        $answer = __('Your <acronym title="Body Mass Index">BMI</acronym> is', 'wet_bmicalc'); 
    72         $bmi_table = '<a id="wet_bmicalc_jump" href="http://abnehmtipps.at/body-mass-index/">'.__('Check your Body Mass Index&nbsp;&raquo;', 'wet_bmicalc').'</a>'; 
     80        $bmi_table = empty($options['infohref']) ? 
     81            '' : 
     82            '<p><a id="wet_bmicalc_jump" href="'.$infohref.'">'.__('Check your Body Mass Index&nbsp;&raquo;', 'wet_bmicalc').'</a></p>'; 
    7383 
    7484        // all calculation is done by the client, trying to compensate for common errors like mixing meters with centimeters. 
     
    8494                var pane = document.getElementById('wet_bmicalc_pane'); 
    8595                var jump = document.getElementById('wet_bmicalc_jump'); 
    86                 var h = jump ? theform.wet_bmicalc_height.value : '0'; 
     96                var h = theform.wet_bmicalc_height.value; 
    8797                h = h.replace(/{$bs}{$point}/, "."); 
    8898                if ( h > 100 ) h = h / 100; 
     
    116126    <p>{$answer} <strong id='wet_bmicalc_bmi'></strong>.</p> 
    117127    </div> 
    118     <p>{$bmi_table}</p> 
     128    {$bmi_table} 
    119129    <p><input type='submit' value='{$buttontext}' onclick='wet_bmicalc(); return false;' /></p> 
    120130</form> 
     
    134144} 
    135145 
    136 if(function_exists('add_action')) { 
     146if (function_exists('add_action')) { 
    137147    add_action('widgets_init', array('wet_bmicalc', 'init')); 
    138148} else { 
Note: See TracChangeset for help on using the changeset viewer.