From 94371d70c91f1dc9334a5a99c2befff923325324 Mon Sep 17 00:00:00 2001 From: Al Yeken Date: Mon, 23 Nov 2015 19:42:12 +0000 Subject: [PATCH] Various tweaks and tidy ups! --- includes/caching.php | 2 -- includes/db.php | 2 +- includes/globals.php | 10 +--------- pages/page.help.php | 4 ++-- pages/page.pro.advertise.php | 6 ++++-- pages/page.settings.php | 18 +++++++++--------- pro-features/db.php | 2 -- pro-features/user-data-ajax.php | 2 -- pro-features/widget-chart.php | 6 +++--- 9 files changed, 20 insertions(+), 32 deletions(-) diff --git a/includes/caching.php b/includes/caching.php index 7d1c8fa6..00ef2c10 100644 --- a/includes/caching.php +++ b/includes/caching.php @@ -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 ."%'"; diff --git a/includes/db.php b/includes/db.php index bb662b40..5216e4e8 100644 --- a/includes/db.php +++ b/includes/db.php @@ -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); diff --git a/includes/globals.php b/includes/globals.php index 2cecef3f..e5938082 100644 --- a/includes/globals.php +++ b/includes/globals.php @@ -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! // ----------------------------------------------------------------------------------- diff --git a/pages/page.help.php b/pages/page.help.php index a0205d2e..1d43a532 100644 --- a/pages/page.help.php +++ b/pages/page.help.php @@ -18,9 +18,9 @@ function ws_ls_help_page() {
-

+

-

+

diff --git a/pages/page.pro.advertise.php b/pages/page.pro.advertise.php index 9e71decf..75aa9f7b 100644 --- a/pages/page.pro.advertise.php +++ b/pages/page.pro.advertise.php @@ -33,8 +33,9 @@ function ws_ls_advertise_pro() {
-

Site Hash', WE_LS_SLUG); ?>:

-
+

+
+

Site Hash is', WE_LS_SLUG); ?>:

£
@@ -73,6 +74,7 @@ function ws_ls_advertise_pro() { if ($valid_license) { $display_form = false; + ws_ls_delete_all_cache(); } } diff --git a/pages/page.settings.php b/pages/page.settings.php index 4bc6a009..649b9ae0 100644 --- a/pages/page.settings.php +++ b/pages/page.settings.php @@ -155,7 +155,7 @@ function ws_ls_settings_page() { -

+

@@ -194,8 +194,8 @@ function ws_ls_settings_page() {

- - + + @@ -216,8 +216,8 @@ function ws_ls_settings_page() {

- - + +

- - + + @@ -239,7 +239,7 @@ function ws_ls_settings_page() { -

+

diff --git a/pro-features/db.php b/pro-features/db.php index 2fbe4c7e..d50d3b2a 100644 --- a/pro-features/db.php +++ b/pro-features/db.php @@ -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 diff --git a/pro-features/user-data-ajax.php b/pro-features/user-data-ajax.php index 406e388a..d34d75eb 100644 --- a/pro-features/user-data-ajax.php +++ b/pro-features/user-data-ajax.php @@ -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(); diff --git a/pro-features/widget-chart.php b/pro-features/widget-chart.php index 65d0cdca..14b35167 100644 --- a/pro-features/widget-chart.php +++ b/pro-features/widget-chart.php @@ -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']; @@ -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); - ?> + + ?>

Display a chart and / or form for the current user. The widget will be hidden if the user is not logged in.