Skip to content

Commit

Permalink
Various tweaks and tidy ups!
Browse files Browse the repository at this point in the history
  • Loading branch information
alicolville committed Nov 23, 2015
1 parent df2dde8 commit 94371d7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 32 deletions.
2 changes: 0 additions & 2 deletions includes/caching.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ function ws_ls_delete_cache_for_given_user($user_id = false)
$user_id = get_current_user_id();
}

ws_ls_delete_cache($cache_key);

$sql = "Delete FROM $wpdb->options
WHERE option_name LIKE '%transient_" . WE_LS_SLUG . $user_id ."%'";

Expand Down
2 changes: 1 addition & 1 deletion includes/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function ws_ls_get_start_weight($user_id)
}
// No cache? hit the DB
else {
echo $sql;

global $wpdb;
$table_name = $wpdb->prefix . WE_LS_TABLENAME;
$sql = $wpdb->prepare('SELECT weight_weight FROM ' . $table_name . ' where weight_user_id = %d order by weight_date asc limit 0, 1', $user_id);
Expand Down
10 changes: 1 addition & 9 deletions includes/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,7 @@
if (get_option('ws-ls-line-fill-colour')) {
$globals['WE_LS_WEIGHT_FILL_COLOUR'] = get_option('ws-ls-line-fill-colour');
}
// -----------------------------------------------------------------------------------
// Override plugin settings with user preferences (if enabled!)
// -----------------------------------------------------------------------------------
// add_filter('ws-ls-user-perferences', )
//
// if(WE_LS_ALLOW_USER_PREFERENCES) {
// $temp = ws_ls_get_user_preferences();
// // var_Dump($temp);wp_die();
// }

// -----------------------------------------------------------------------------------
// Loop through array and set defines!
// -----------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions pages/page.help.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function ws_ls_help_page() {
<div class="meta-box-sortables ui-sortable">

<div class="postbox">
<h3 class="hndle"><span><?php echo __( WE_LS_TITLE . ' Instructions', WE_LS_SLUG); ?> </span></h3>
<h3 class="hndle"><span><?php echo __( WE_LS_TITLE . ' Help', WE_LS_SLUG); ?> </span></h3>
<div style="padding: 0px 15px 0px 15px">
<p><?php echo __( 'Place the tag [weight-loss-tracker] on a given page and the user is presented with a form to enter a date, weight and notes for that entry. When the person saves their entry the data table and graph is refreshed.', WE_LS_SLUG ); ?></p>
<p><?php echo __( 'Not ready for Beta', WE_LS_SLUG ); ?></p>
</div>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions pages/page.pro.advertise.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ function ws_ls_advertise_pro() {
</h3>

<div class="inside">
<p><?php echo __('Get Weight Loss Tracker Pro for', WE_LS_SLUG) . ' &pound;' . WS_LS_PRO_PRICE . __(' and have the following features listed below.', WE_LS_SLUG); ?> <?php echo __('In case you need, your <strong>Site Hash</strong>', WE_LS_SLUG); ?>: <?php echo ws_ls_generate_site_hash(); ?></p>
<center>
<p><?php echo __('Get Weight Loss Tracker Pro for', WE_LS_SLUG) . ' &pound;' . WS_LS_PRO_PRICE . __(' and have the following features listed below.', WE_LS_SLUG); ?> </p>
<center>
<h3><?php echo __('In case you need, your <strong>Site Hash</strong> is', WE_LS_SLUG); ?>: <?php echo ws_ls_generate_site_hash(); ?></h3>
<a href="#" style="width:60%;font-size:15px;text-align:center;" target="_blank" class="button-primary"><?php echo __('Upgrade now for', WE_LS_SLUG); ?> &pound;<?php echo WS_LS_PRO_PRICE; ?></a>
</center>
</div>
Expand Down Expand Up @@ -73,6 +74,7 @@ function ws_ls_advertise_pro() {

if ($valid_license) {
$display_form = false;
ws_ls_delete_all_cache();
}
}

Expand Down
18 changes: 9 additions & 9 deletions pages/page.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function ws_ls_settings_page() {
<option value="yes" <?php selected( get_option('ws-ls-allow-advanced-tables'), 'yes' ); ?>><?php echo __('Yes', WE_LS_SLUG)?></option>
<option value="no" <?php selected( get_option('ws-ls-allow-advanced-tables'), 'no' ); ?>><?php echo __('No', WE_LS_SLUG)?></option>
</select>
<p><?php echo __("User's weight history is presented in tables that allow sorting, paging, editing and deleting.", WE_LS_SLUG)?></p>
<p><?php echo __("User's weight history is presented in responsive tables that allow sorting, paging, editing and deleting. Weight Index (i.e. percentage lost / gained to be displayed.)", WE_LS_SLUG)?></p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -194,8 +194,8 @@ function ws_ls_settings_page() {
<p><?php echo __('If enabled, lines between points on a line graph will be curved', WE_LS_SLUG); ?></p>
</td>
</tr>
<tr>
<th scope="row" class="<?php echo $disable_if_not_pro_class; ?>"><?php echo __( 'Display gridlines?', WE_LS_SLUG ); ?></th>
<tr class="<?php echo $disable_if_not_pro_class; ?>" >
<th scope="row"><?php echo __( 'Display gridlines?', WE_LS_SLUG ); ?></th>
<td>
<select id="ws-ls-grid-lines" name="ws-ls-grid-lines">
<option value="yes" <?php selected( get_option('ws-ls-grid-lines'), 'yes' ); ?>><?php echo __('Yes', WE_LS_SLUG)?></option>
Expand All @@ -205,7 +205,7 @@ function ws_ls_settings_page() {
<p><?php echo __('If enabled, gridlines will be displayed on the Graph canvas.', WE_LS_SLUG); ?></p>
</td>
</tr>
<tr>
<tr class="<?php echo $disable_if_not_pro_class; ?>">
<th scope="row"><?php echo __( 'Display points on graph?', WE_LS_SLUG ); ?></th>
<td>
<select id="ws-ls-allow-points" name="ws-ls-allow-points">
Expand All @@ -216,8 +216,8 @@ function ws_ls_settings_page() {
<p><?php echo __('If enabled, "Allows points and labels to be displayed on graph.', WE_LS_SLUG); ?></p>
</td>
</tr>
<tr>
<th scope="row" class="<?php echo $disable_if_not_pro_class; ?>"><?php echo __( 'Maximum points per graph', WE_LS_SLUG ); ?></th>
<tr class="<?php echo $disable_if_not_pro_class; ?>">
<th scope="row"><?php echo __( 'Maximum points per graph', WE_LS_SLUG ); ?></th>
<td>
<?php $chart_options = array(5,10,25,50,100,200); ?>
<select id="ws-ls-max-points" name="ws-ls-max-points">
Expand All @@ -228,8 +228,8 @@ function ws_ls_settings_page() {
</select>
<p><?php echo __('If enabled, "Allows points and labels to be displayed on graph.', WE_LS_SLUG); ?></p>
</td>
</tr>
<tr>
</tr >
<tr class="<?php echo $disable_if_not_pro_class; ?>">
<th scope="row" class="<?php echo $disable_if_not_pro_class; ?>"><?php echo __( 'Point thickness (Line only)', WE_LS_SLUG ); ?></th>
<td>
<?php $chart_options = array(1,2,3,4,5,6,7,8,9,10); ?>
Expand All @@ -239,7 +239,7 @@ function ws_ls_settings_page() {
<?php endforeach; ?>

</select>
<p><?php echo __('If enabled, "Allows points and labels to be displayed on graph.', WE_LS_SLUG); ?></p>
<p><?php echo __('Specifies the point thickness on a line chart.', WE_LS_SLUG); ?></p>
</td>
</tr>
<tr>
Expand Down
2 changes: 0 additions & 2 deletions pro-features/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ function ws_ls_user_data($filters = false)
$number_of_results = ws_ls_sql_count($sql);
$sql .= $wpdb->prepare(' LIMIT %d, %d', $filters['start'], $filters['limit']);

// var_dump($sql);

$rows = $wpdb->get_results( $sql );

// If data found in DB then save to cache and return
Expand Down
2 changes: 0 additions & 2 deletions pro-features/user-data-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ function ws_ls_user_data_callback()
$filters['search'] = $search['value'];
}

//var_dump($_GET, $filters);

echo ws_ls_load_json($draw_id, $filters);

wp_die();
Expand Down
6 changes: 3 additions & 3 deletions pro-features/widget-chart.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function widget( $args, $instance ) {

$weight_data = ws_ls_get_weights($chart_arguments['user-id'], $chart_arguments['max-data-points'], -1, 'desc');

$chart_arguments['height'] = false;
$chart_arguments['height'] = false;

if ($weight_data) {
echo $args['before_widget'];
Expand Down Expand Up @@ -83,8 +83,8 @@ public function form( $instance ) {
foreach($this->field_values as $key => $default) {
$field_values[$key] = !empty($instance[$key]) ? $instance[$key] : $default;
}
// var_dump($instance,$field_values);
?>

?>
<p>Display a chart and / or form for the current user. The widget will be hidden if the user is <strong>not logged in</strong>.</p>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title', WE_LS_SLUG); ?></label>
Expand Down

0 comments on commit 94371d7

Please sign in to comment.