Skip to content

Commit

Permalink
Added Yeken json lookup. Tweaked Readmes. Minified main JS / CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
alicolville committed Nov 28, 2015
1 parent f53ad94 commit ed70356
Show file tree
Hide file tree
Showing 11 changed files with 331 additions and 535 deletions.
75 changes: 59 additions & 16 deletions css/ws-ls.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
font-size: 1.0em;
margin-bottom: 5px;
}
/* MAKE BELOW OPTIONAL */
.ws_ls_title
{
margin-top: 0px !important;
Expand All @@ -23,46 +22,47 @@
.we-ls-datepicker, .ws-ls-select
{
width:98% !important;
padding-left: 5px 0px 0px 0px !important;
border: solid 1px #c1c1c1;
transition: box-shadow 0.3s, border 0.3s;
padding: 0px 0px 0px 5px;
}
.we-ls-weight-form input[type=number].focus, .we-ls-weight-form input[type=text].focus, .we-ls-weight-form select.focus,
.we-ls-datepicker.focus, .ws-ls-select.focus, #ws-ls-tabs .wlt-user-preferences input, #ws-ls-tabs .wlt-user-preferences select {
.we-ls-datepicker.focus, .ws-ls-select.focus, .ws-ls-user-pref-form input, .ws-ls-user-pref-form select, .ws-ls-user-delete-all select {
border: solid 1px #707070;
box-shadow: 0 0 5px 1px #969696;
box-sizing: content-box !important;
}
.we-ls-weight-form input[type=number], .we-ls-weight-form input[type=text], .we-ls-weight-form select, .we-ls-weight-form .we-ls-datepicker,
.we-ls-weight-form .ws-ls-select, #ws-ls-tabs .wlt-user-preferences input, #ws-ls-tabs .wlt-user-preferences select
.we-ls-weight-form .ws-ls-select, .ws-ls-user-pref-form input, .ws-ls-user-pref-form select, .ws-ls-user-delete-all select
{
height: 30px;
}
#ws-ls-tabs input[type=number], #ws-ls-tabs input[type=text], #ws-ls-tabs select, #ws-ls-tabs .we-ls-datepicker, #ws-ls-tabs .ws-ls-select,
#ws-ls-tabs .wlt-user-preferences input, #ws-ls-tabs .wlt-user-preferences select
.we-ls-weight-form input[type=number], .we-ls-weight-form input[type=text], .we-ls-weight-form select, .we-ls-weight-form .we-ls-datepicker, .we-ls-weight-form .ws-ls-select,
.ws-ls-user-pref-form input, .ws-ls-user-pref-form select, .ws-ls-user-delete-all select
{
height: 30px;
padding:5px;

}
#ws-ls-tabs .wlt-user-preferences select
.ws-ls-user-pref-form select, .ws-ls-user-delete-all select
{
width:100%;
margin-bottom: 20px;
}
#ws-ls-tabs .wlt-user-preferences label
.ws-ls-user-pref-form form
{
margin-bottom: 20px;
margin-bottom: 20px;
}
#ws-ls-tabs textarea
.we-ls-weight-form textarea
{
padding:5px;
}
.we-ls-weight-form .ws-ls-error-summary
.ws-ls-error-summary
{
width: 100%;
padding-left: 30px;
color: red;
display:none;
}
.we-ls-weight-form .ws-ls-error-summary ul
.ws-ls-error-summary ul
{
width: 100%;
padding: 0px;
Expand All @@ -73,7 +73,50 @@
color: red;
font-weight: bold;
}
.ws-ls-user-pref-form
.ws-ls-notice
{
color: red;
font-weight: bold;
}
.ws-ls-success
{
color: green;
}

.dataTables_filter input
{
width: 100px;
padding:0px;
}
.dataTables_length
{
margin: 10px
}
.dataTables_filter
{
margin: 10px
}

.ws-ls-table-options img
{
width: 15px;
height: 15px;
}
.ws-ls-advanced-data-table
{
table-layout: auto !important;
}
.ws-ls-advanced-data-table th
{
padding: 1px 1px 1px 3px !important;
}
.ws-ls-hide
{
display: none !important;
}
.ws-ls-notice-of-refresh
{
width: 100%;
text-align: center;
margin-bottom:3px;
font-size:0.8em;
}
123 changes: 1 addition & 122 deletions css/ws-ls.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/caching.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function ws_ls_get_cache($key) {

}

function ws_ls_set_cache($key, $data) {
function ws_ls_set_cache($key, $data, $time_to_expire = WE_LS_CACHE_TIME) {

if(WE_LS_CACHE_ENABLED) {
$key = ws_ls_generate_cache_key($key);
Expand Down
24 changes: 20 additions & 4 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,26 @@ function ws_ls_remove_non_numeric($text)
}
return $text;
}

//TODO: REMOVE!
function ws_ls_debug($text)
function ws_ls_get_data_from_yeken()
{
file_put_contents ('c:\ali_dev.txt', $text . PHP_EOL, FILE_APPEND);
// Look up date from Yeken.uk
$cache = ws_ls_get_cache(WE_LS_CACHE_KEY_YEKEN_JSON);

// Return cache if found!
if ($cache) {
return $cache;
}
$response = wp_remote_get(WE_LS_DATA_URL);

if( is_array($response) ) {
if (200 == $response['response']['code'] && !empty($response['body'])) {
$data = json_decode($response['body']);
ws_ls_set_cache(WE_LS_CACHE_KEY_YEKEN_JSON, $data, 3 * HOUR_IN_SECONDS);
return $data;
}
}

return false;
}

?>
4 changes: 3 additions & 1 deletion includes/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
define('WE_LS_TITLE', 'Weight Loss Tracker');
define('WE_LS_SLUG', 'weight-loss-tracker');
define('WE_LS_TABLENAME', 'WS_LS_DATA');
define('WE_LS_DATA_URL', 'https://yeken.uk/wlt/plugin-info.json');
define('WE_LS_TARGETS_TABLENAME', 'WS_LS_DATA_TARGETS');
define('WE_LS_USER_PREFERENCES_TABLENAME', 'WS_LS_DATA_USER_PREFERENCES');
define('WE_LS_CACHE_ENABLED', true);
Expand All @@ -42,9 +43,10 @@
define('WE_LS_CACHE_KEY_START_WEIGHT', 'start-weight-index');
define('WE_LS_CACHE_KEY_WEIGHT_EXTREME', 'weight-extreme-');
define('WE_LS_CACHE_KEY_USER_PREFERENCE', 'user-preference');
define('WE_LS_CACHE_KEY_YEKEN_JSON', 'yeken-json-lookup');
define('WE_LS_CACHE_ADMIN_USER_DATA', 'admin-user-data');
define('WE_LS_TABLE_MAX_WEEK_FILTERS', 100);
define('WS_LS_PRO_PRICE', 20.00);
define('WS_LS_PRO_PRICE', 25.00);
define('WE_LS_USE_MINIFIED_SCRIPTS', true);
// -----------------------------------------------------------------------------------
// Allow user's to override the default admin settings?
Expand Down
Loading

0 comments on commit ed70356

Please sign in to comment.