Skip to content

Commit

Permalink
Release 1.5.0 (#85)
Browse files Browse the repository at this point in the history
* Implemented support to disabled widget on front page (#82)
* Fixed typo
* Implemented new option for disableAutoStartPublishedPosts (#84)
* Fixed undefined index notice.
* Updated german translation.
* Updated version information for 1.5.0
  • Loading branch information
Patrick Hausmann authored Jan 26, 2017
1 parent 2524edb commit f06dcd3
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 70 deletions.
Binary file modified lang/post-worktime-logger-de_DE.mo
Binary file not shown.
55 changes: 32 additions & 23 deletions lang/post-worktime-logger-de_DE.po
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
msgid ""
msgstr ""
"Project-Id-Version: Post Worktime Logger v1.4.0\n"
"Project-Id-Version: Post Worktime Logger v1.4.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2016-11-03 10:54:17+0000\n"
"PO-Revision-Date: 2017-01-26 18:29:47+0000\n"
"Last-Translator: admin <admin@localhost.de>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -65,28 +65,28 @@ msgstr "Arbeitszeit"
msgid "A widget in the frontend to display the admin worktime widget for logged in users or the worktime for the current post for not logged in users."
msgstr "Ein Widget welches im Frontend das Admin Arbeitszeiten Widget für eingeloggte Benutzer zur Verfügung stellt oder die gesamte Arbeitszeit für den jeweiligen Artikel für nicht eingeloggte Nutzer."

#: widget.php:92
#: widget.php:94
#@ post-worktime-logger
msgid "Title:"
msgstr "Titel:"

#: widget.php:96
#: widget.php:98
#@ post-worktime-logger
msgid "Display widget for not logged in users"
msgstr "Zeige Widget auch nicht eingeloggten Nutzern"

#: widget.php:105
#: widget.php:107
#@ post-worktime-logger
msgid "Pre text:"
msgstr "Vor dem Text:"

#: widget.php:107
#: widget.php:112
#: widget.php:109
#: widget.php:114
#@ post-worktime-logger
msgid "This will only appear if 'Display widget for not logged in users' is enabled."
msgstr "Dies erscheint nur, wenn 'Zeige Widget auch nicht eingeloggten Nutzern' aktiviert ist."

#: widget.php:110
#: widget.php:112
#@ post-worktime-logger
msgid "After text:"
msgstr "Nach dem Text:"
Expand Down Expand Up @@ -114,14 +114,13 @@ msgid "You do not have sufficient permissions to access this page."
msgstr "Sie verfügen nicht über die notwendigen Berechtigungen um auf diese Seite zuzugreifen."

#: settings.php:79
#: settings.php:133
#: settings.php:252
#: settings.php:134
#: settings.php:260
#@ post-worktime-logger
msgid "Statistics"
msgstr "Statistiken"

#: settings.php:134
#: settings.php:140
#: settings.php:135
#, php-format
#@ post-worktime-logger
msgid "Top %s posts (worktime)"
Expand Down Expand Up @@ -163,60 +162,70 @@ msgstr "Allgemein"
msgid "Enable control buttons"
msgstr "Aktiviere Steuer-Buttons"

#: settings.php:244
#: settings.php:252
#@ post-worktime-logger
msgid "Inactivity Timeout"
msgstr "Zeitunterbrechung durch Inaktivität"

#: settings.php:321
#: settings.php:335
#@ post-worktime-logger
msgid "This will allow you to pause, resume and reset the worktime."
msgstr "Erlaubt Ihnen das pausieren, fortfahren und zurücksetzen der Arbeitszeit."

#: settings.php:358
#: settings.php:391
#@ post-worktime-logger
msgid "This option allows you to specify a certain number of minutes that can pass without activity before the timer pauses."
msgstr "Erlaubt Ihnen die maximale Zeit der Abwesenheit in Minuten anzugeben, bis der Timer pausiert."

#: settings.php:136
#: settings.php:137
#, php-format
#@ post-worktime-logger
msgid "Total worktime on posts: %d minutes"
msgstr "Gesamte Arbeitszeit für Artikel: %d Minuten"

#: settings.php:138
#: settings.php:139
#, php-format
#@ post-worktime-logger
msgid "Total worktime on posts: %d hours, %d minutes"
msgstr "Gesamte Arbeitszeit für Artikel: %d Stunden, %d Minuten"

#: settings.php:236
#: settings.php:244
#@ post-worktime-logger
msgid "Disable Auto Start"
msgstr "Deaktiviere Autostart"

#: settings.php:259
#: settings.php:267
#@ post-worktime-logger
msgid "number of posts"
msgstr "Anzahl der Artikel"

#: settings.php:339
#: settings.php:353
#@ post-worktime-logger
msgid "Activate this to prevent the time from starting automatically on post editing."
msgstr "Aktiviere dies, um das automatische Starten des Timers bei der Bearbeitung von Artikeln zu verhindern. "

#: settings.php:376
#: settings.php:409
#@ post-worktime-logger
msgid "Specify this amount of posts to be displayed on the statistics page top worktime chart"
msgstr "Definiere die Anzahl der Artikel, die auf der Statistik-Seite dargestellt werden sollen. "

#: widget.php:100
#: widget.php:102
#@ post-worktime-logger
msgid "Disable frontend time tracking"
msgstr "Deaktiviere das Aufzeichnen der Arbeitszeit im Frontend"

#: widget.php:102
#: widget.php:104
#@ post-worktime-logger
msgid "This will only affect logged in users."
msgstr "Dies betrifft nur eingeloggte Nutzer."

#: settings.php:236
#@ post-worktime-logger
msgid "Disable auto start for published posts"
msgstr "Deaktiviere Autostart für bereits veröffentlichte Artikel"

#: settings.php:372
#@ post-worktime-logger
msgid "Activate this to prevent the time from starting automatically on post editing for publsihed posts."
msgstr "Aktiviere dies, um das automatische Starten des Timers bei der Bearbeitung von bereits veröffentlichten Artikeln zu verhindern."

31 changes: 24 additions & 7 deletions post-worktime-logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Plugin Name: Post Worktime Logger
Plugin URI: https://wordpress.org/plugins/post-worktime-logger/
Description: A plugin to track the worktime for each post.
Version: 1.4.1
Version: 1.5.0
Author: Patrick Hausmann
Author URI: https://profiles.wordpress.org/filme-blog/
License: GPLv3
Expand Down Expand Up @@ -241,6 +241,23 @@ function isControlBoxEnabled()
else return false;
}

/**
* Checks if we should disable the auto start timer, depending on the options and the state of our post.
*/
function isAutoStartDisabled()
{
global $pwlOptions;
if (!empty( $pwlOptions['disableAutoStart']))
{
return true;
}
else if (!empty( $pwlOptions['disableAutoStartPublishedPosts']) && get_post_status() == "publish")
{
return true;
}
else return false;
}

//Register post meta box
add_action( 'add_meta_boxes', 'pwlAddMetaBoxSummary');

Expand Down Expand Up @@ -276,11 +293,11 @@ function isControlBoxEnabled()
{
wp_enqueue_script(PWL_NAME, plugins_url( "resources/js/post-worktime-logger.js", __FILE__ ));

wp_localize_script( PWL_NAME, 'pwl', array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'inactivityTimeout' => ( ! empty( $pwlOptions['inactivityTimeout'] ) ) ? esc_html( $pwlOptions['inactivityTimeout'] ) : '5',
'disableAutoStart' => ( ! empty( $pwlOptions['disableAutoStart'] ) ) ? esc_html( $pwlOptions['disableAutoStart'] ) : '0',
) );
wp_localize_script( PWL_NAME, 'pwl', array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'inactivityTimeout' => ( ! empty( $pwlOptions['inactivityTimeout'] ) ) ? esc_html( $pwlOptions['inactivityTimeout'] ) : '5',
'disableAutoStart' => ( isAutoStartDisabled() ) ? 'on' : '0',
) );
}
});

Expand All @@ -294,7 +311,7 @@ function isControlBoxEnabled()
wp_localize_script( PWL_NAME, 'pwl', array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'inactivityTimeout' => ( ! empty( $pwlOptions['inactivityTimeout'] ) ) ? esc_html( $pwlOptions['inactivityTimeout'] ) : '5',
'disableAutoStart' => ( ! empty( $pwlOptions['disableAutoStart'] ) ) ? esc_html( $pwlOptions['disableAutoStart'] ) : '0',
'disableAutoStart' => ( isAutoStartDisabled() ) ? 'on' : '0',
) );
}
});
Expand Down
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ You can donate to this project via

## Changelog

### 1.5.0
* Implemented option to prevent the timer from auto start for published posts.
* Disable the widget on a static front page.

### 1.4.1
* Fixed duplicated heading

Expand All @@ -105,7 +109,7 @@ You can donate to this project via
### 1.3.0
* Implemented an own page for Post Worktime Logger.
* Implemented an options page with some nice options and a reset button.
* Implemented a statistics page to show the top 25 posts (worktime.
* Implemented a statistics page to show the top 25 posts (worktime).
* Improved documentation of the plugin.

###1.2.2
Expand Down
13 changes: 10 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
=== Post Worktime Logger===
Contributors: filme-blog
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=28WZAXQDXYZ5A
Tags: worktime, work, clock, time, time-tracking, tracking, Zeiterfassung, worktime logger, post work time, working time
Tags: worktime, work, clock, time, time-tracking, tracking, Zeiterfassung, worktime logger, post work time, working time, Stunden, Uhr, Timer
Requires at least: 2.3.1
Tested up to: 4.6
Stable tag: 1.4.1
Stable tag: 1.5.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl.html

Expand Down Expand Up @@ -46,6 +46,13 @@ You can donate to this project via PayPal by visiting this page: https://www.pay

== Changelog ==

= 1.5.0 =
* Implemented option to prevent the timer from auto start for published posts.
* Disable the widget on a static front page.

= 1.4.1 =
* Fixed duplicated heading

= 1.4.0 =
* Implemented a checkbox in the settings to prevent the timer from autostart.
* Improved code and translation engine.
Expand All @@ -62,7 +69,7 @@ You can donate to this project via PayPal by visiting this page: https://www.pay
= 1.3.0 =
* Implemented an own page for Post Worktime Logger.
* Implemented an options page with some nice options and a reset button.
* Implemented a statistics page to show the top 25 posts (worktime.
* Implemented a statistics page to show the top 25 posts (worktime).
* Improved documentation of the plugin.

= 1.2.3 =
Expand Down
40 changes: 37 additions & 3 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ function createAdminStatisticsPage()
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}

$numOfPosts = $this->options['numberOfPosts'];
$numOfPosts = 25;
if ( !empty($this->options['numberOfPosts'])) $numOfPosts = $this->options['numberOfPosts'];

$args = array(
'posts_per_page' => $numOfPosts,
Expand Down Expand Up @@ -229,6 +230,14 @@ public function pageInit()
'post-worktime-logger-settings',
'general'
);

add_settings_field(
'disableAutoStartPublishedPosts',
__('Disable auto start for published posts', self::PWL_TEXT_DOMAIN),
array( $this, 'disableAutoStartPublishesPostsCallback'),
'post-worktime-logger-settings',
'general'
);

add_settings_field(
'disableAutoStart',
Expand Down Expand Up @@ -282,6 +291,12 @@ public function sanitize($_input)
$disableAutoStart = sanitize_text_field( wp_unslash( $_input['disableAutoStart'] ) );
$newInput['disableAutoStart'] = $disableAutoStart;
}

if( isset( $_input['disableAutoStartPublishedPosts'] ) )
{
$disableAutoStartPublishedPosts = sanitize_text_field( wp_unslash( $_input['disableAutoStartPublishedPosts'] ) );
$newInput['disableAutoStartPublishedPosts'] = $disableAutoStartPublishedPosts;
}

if( isset( $_input['inactivityTimeout'] ) )
{
Expand All @@ -305,8 +320,8 @@ public function sanitize($_input)
}

/**
* Get the settings option array and print one of its values
*/
* Get the settings option array and print one of its values
*/
public function enableControlButtonsCallback()
{
if (isset($this->options['enableControlButtons']))
Expand Down Expand Up @@ -339,7 +354,26 @@ public function disableAutoStartCallback()
</p>
<?php
}

/**
* Get the settings option array and print one of its values
*/
public function disableAutoStartPublishesPostsCallback()
{
if (isset($this->options['disableAutoStartPublishedPosts']))
{
$disableAutoStartPublishedPosts = $this->options['disableAutoStartPublishedPosts'];
}
else $disableAutoStartPublishedPosts = null;

?>
<input type="checkbox" id="disableAutoStartPublishedPosts" name="post-worktime-logger-options[disableAutoStartPublishedPosts]" <?php checked($disableAutoStartPublishedPosts, 'on' ); ?> />
<p class="description">
<?php esc_html_e( "Activate this to prevent the time from starting automatically on post editing for publsihed posts.", "post-worktime-logger" ); ?>
</p>
<?php
}

/**
* Display the HTML for the minutes of inactivity option.
*/
Expand Down
Loading

0 comments on commit f06dcd3

Please sign in to comment.