Skip to content

Commit

Permalink
Merge pull request #84 from yekenuk/5.0.5
Browse files Browse the repository at this point in the history
5.0.5
  • Loading branch information
alicolville authored Aug 22, 2017
2 parents 30ea1fb + 5e9e20a commit dde9fbd
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 20 deletions.
2 changes: 1 addition & 1 deletion includes/converters.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function ws_ls_convert_kg_into_relevant_weight_String($kg, $comparison_value = f
return ws_ls_to_lb($kg) . __('lbs', WE_LS_SLUG);
break;
case 'kg':
return round($kg, 2) . __('Kg', WE_LS_SLUG);
return round($kg, 2) . __('kg', WE_LS_SLUG);
break;
default:
$weight = ws_ls_to_stone_pounds($kg);
Expand Down
4 changes: 2 additions & 2 deletions includes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function ws_ls_display_chart($weight_data, $options = false)
$chart_config['type'] = 'line';
}

$y_axis_unit = (ws_ls_get_config('WE_LS_IMPERIAL_WEIGHTS')) ? __('lbs', WE_LS_SLUG) : __('Kg', WE_LS_SLUG) ;
$y_axis_unit = (ws_ls_get_config('WE_LS_IMPERIAL_WEIGHTS')) ? __('lbs', WE_LS_SLUG) : __('kg', WE_LS_SLUG) ;
$y_axis_measurement_unit = ('inches' == ws_ls_get_config('WE_LS_MEASUREMENTS_UNIT')) ? __('Inches', WE_LS_SLUG) : __('CM', WE_LS_SLUG) ;

$point_size = (WE_LS_ALLOW_POINTS && WE_LS_CHART_POINT_SIZE > 0) ? WE_LS_CHART_POINT_SIZE : 0;
Expand Down Expand Up @@ -340,7 +340,7 @@ function ws_ls_display_weight_form($target_form = false, $class_name = false, $u
}
}
else {
$html_output .= '<input type="number" tabindex="' . ws_ls_get_next_tab_index() . '" step="any" min="1" name="we-ls-weight-kg" id="we-ls-weight-kg" value="' . ws_ls_get_existing_value($existing_data, 'kg') . '" placeholder="' . __('Weight', WE_LS_SLUG) . ' (' . __('Kg', WE_LS_SLUG) . ')" size="22" >';
$html_output .= '<input type="number" tabindex="' . ws_ls_get_next_tab_index() . '" step="any" min="1" name="we-ls-weight-kg" id="we-ls-weight-kg" value="' . ws_ls_get_existing_value($existing_data, 'kg') . '" placeholder="' . __('Weight', WE_LS_SLUG) . ' (' . __('kg', WE_LS_SLUG) . ')" size="22" >';
}

$html_output .= '</div>';
Expand Down
10 changes: 5 additions & 5 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ function ws_ls_weight_object($user_id, $kg, $pounds, $stones, $pounds_only, $not
$weight['graph_value'] = $data;
break;
case 'kg':
$weight['display'] = $weight['kg'] . __('Kg', WE_LS_SLUG);
$weight['display'] = $weight['kg'] . __('kg', WE_LS_SLUG);
$weight['graph_value'] = $weight['kg'];
break;
default:
$weight['display'] = $weight['stones'] . __('St', WE_LS_SLUG) . " " . $weight['pounds'] . __('lbs', WE_LS_SLUG);
$weight['display'] = $weight['stones'] . __('st', WE_LS_SLUG) . " " . $weight['pounds'] . __('lbs', WE_LS_SLUG);
$weight['graph_value'] = ($weight['stones'] * 14) + $weight['pounds'];
break;
}
Expand All @@ -83,10 +83,10 @@ function ws_ls_weight_object($user_id, $kg, $pounds, $stones, $pounds_only, $not
$weight['display-admin'] = $data . __('lbs', WE_LS_SLUG);
break;
case 'kg':
$weight['display-admin'] = $weight['kg'] . __('Kg', WE_LS_SLUG);
$weight['display-admin'] = $weight['kg'] . __('kg', WE_LS_SLUG);
break;
default:
$weight['display-admin'] = $weight['stones'] . __('St', WE_LS_SLUG) . " " . $weight['pounds'] . __('lbs', WE_LS_SLUG);
$weight['display-admin'] = $weight['stones'] . __('st', WE_LS_SLUG) . " " . $weight['pounds'] . __('lbs', WE_LS_SLUG);
break;
}

Expand Down Expand Up @@ -495,7 +495,7 @@ function ws_ls_format_stones_pound_for_comparison_display($weight) {
}

if ($show_stones) {
$text[] = $weight['stones'] . __('St', WE_LS_SLUG);
$text[] = $weight['stones'] . __('st', WE_LS_SLUG);
}

if (is_numeric($weight['pounds'])) {
Expand Down
13 changes: 12 additions & 1 deletion includes/shortcode-various.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,18 @@ function we_ls_format_weight_into_correct_string_format($weight, $comparison = f
if ($comparison) {
return ws_ls_format_stones_pound_for_comparison_display($weight_data);
} else {
return $weight_data["stones"] . __("st", WE_LS_SLUG) . " " . (($weight_data["pounds"] < 0) ? abs($weight_data["pounds"]) : $weight_data["pounds"]) . __("lbs", WE_LS_SLUG);

if($weight_data["pounds"] < 0) {
$weight_data["pounds"] = abs($weight_data["pounds"]);
}

// If Lbs is 14, then set to 0 and increment stones!
if(14 == $weight_data["pounds"]) {
$weight_data["pounds"] = 0;
$weight_data["stones"]++;
}

return $weight_data["stones"] . __("st", WE_LS_SLUG) . " " . $weight_data["pounds"] . __("lbs", WE_LS_SLUG);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pages/page.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function ws_ls_settings_page() {
<th scope="row"><?php echo __( 'Weight Units' , WE_LS_SLUG); ?></th>
<td>
<select id="ws-ls-units" name="ws-ls-units">
<option value="kg" <?php selected( get_option('ws-ls-units'), 'kg' ); ?>><?php echo __('Kg', WE_LS_SLUG); ?></option>
<option value="kg" <?php selected( get_option('ws-ls-units'), 'kg' ); ?>><?php echo __('kg', WE_LS_SLUG); ?></option>
<option value="stones_pounds" <?php selected( get_option('ws-ls-units'), 'stones_pounds' ); ?>><?php echo __('Stones & Pounds', WE_LS_SLUG); ?></option>
<option value="pounds_only" <?php selected( get_option('ws-ls-units'), 'pounds_only' ); ?>><?php echo __('Pounds', WE_LS_SLUG); ?></option>
</select>
Expand Down
8 changes: 4 additions & 4 deletions pro-features/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ function ws_ls_column_names() {
'user_id' => 'User ID',
'user_nicename' => 'Nicename',
'date-display' => 'Date',
'kg' => __('Kg', WE_LS_SLUG),
'only_pounds' => __('Lbs only', WE_LS_SLUG),
'stones' => __('Stones', WE_LS_SLUG),
'pounds' => __('Lbs', WE_LS_SLUG),
'kg' => __('kg', WE_LS_SLUG),
'only_pounds' => __('lbs only', WE_LS_SLUG),
'stones' => __('st', WE_LS_SLUG),
'pounds' => __('lbs', WE_LS_SLUG),
'difference_from_start_display' => __('Difference from start', WE_LS_SLUG),
'bmi' => 'BMI',
'bmi-readable' => 'BMI Label',
Expand Down
2 changes: 1 addition & 1 deletion pro-features/footable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ws_ls_data_table_placeholder($user_id = false, $max_entries = false, $s
data-small-width="<?php echo ($smaller_width) ? 'true' : 'false' ?>">
</table>
<?php if (WE_LS_MEASUREMENTS_ENABLED): ?>
<p><em>Measurements are in <?php echo ('inches' == ws_ls_get_config('WE_LS_MEASUREMENTS_UNIT')) ? __('Inches', WE_LS_SLUG) : __('CM', WE_LS_SLUG); ?>.</em></p>
<p><em>Measurements are in <?php echo ('inches' == ws_ls_get_config('WE_LS_MEASUREMENTS_UNIT')) ? __('Inches', WE_LS_SLUG) : __('cm', WE_LS_SLUG); ?>.</em></p>
<?php endif; ?>
<?php
}
Expand Down
2 changes: 1 addition & 1 deletion pro-features/shortcode-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function ws_ls_shortcode_stats_display_value($stats, $arguments) {
$stats['display-value'] .= ws_ls_format_stones_pound_for_comparison_display($weight);
break;
default:
$stats['display-value'] .= ws_ls_round_decimals($difference) . __('Kg', WE_LS_SLUG);
$stats['display-value'] .= ws_ls_round_decimals($difference) . __('kg', WE_LS_SLUG);
}

// Allow theme developer to override stats message
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: aliakro
Tags: weight, loss, lose, helper, bmi, body, mass, index, graph, track, stones, kg, table, data, plot, target, history, pounds, responsive, chart, measurements, cm, centimeters, inches, hip, waist, bicep, thigh
Requires at least: 4.4.0
Tested up to: 4.8
Stable tag: 5.0.4
Stable tag: 5.0.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Donate Link: https://www.paypal.me/yeken
Expand Down Expand Up @@ -160,6 +160,11 @@ Yes. In WordPress Admin goto Settings > Weight Loss Tracker and change the setti

== Changelog ==

= 5.0.5 =

* Improvement: Standardised unit display e.g. St is now consistently lowercase.
* Bug fix: Fixed issue where Stones / Pounds was displaying 14 pounds instead of incrementing stones.

= 5.0.4 =

* Bug fix: Fixed missing charts doe to clashes with other plugins. JS enqueue issue where other plugins were using Chart.js (myCred in this example) with the same enqueue slug.
Expand Down
6 changes: 3 additions & 3 deletions weight-loss-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Plugin Name: Weight Loss Tracker
* Description: Allow registered users of your website to track their weight and relevant body measurements. History can be displayed in both tables & charts.
* Version: 5.0.4
* Version: 5.0.5
* Author: YeKen
* Author URI: https://www.YeKen.uk
* License: GPL2
Expand All @@ -28,8 +28,8 @@
*/

define('WS_LS_ABSPATH', plugin_dir_path( __FILE__ ));
define('WE_LS_CURRENT_VERSION', '5.0.4');
define('WE_LS_DB_VERSION', '5.0.0');
define('WE_LS_CURRENT_VERSION', '5.0.5');
define('WE_LS_DB_VERSION', '5.0.5');

// -----------------------------------------------------------------------------------------
// AC: Activate / Deactivate / Uninstall Hooks
Expand Down

0 comments on commit dde9fbd

Please sign in to comment.