From 0679a98cfd440906bef65b52c7df0c288640715d Mon Sep 17 00:00:00 2001 From: Ross McKay Date: Mon, 3 Nov 2014 19:54:05 +1100 Subject: [PATCH] Czech translation, admin post order --- includes/class.LogEmailsPlugin.php | 11 +++++++---- includes/class.LogEmailsPostTypeLog.php | 16 ++++++++++++++++ languages/log-emails-cs_CZ.mo | Bin 0 -> 2074 bytes log-emails.php | 7 ++----- readme.txt | 12 +++++++++++- views/log-detail.php | 2 +- views/settings-form.php | 2 +- 7 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 languages/log-emails-cs_CZ.mo diff --git a/includes/class.LogEmailsPlugin.php b/includes/class.LogEmailsPlugin.php index 388da77..3c4b5ae 100644 --- a/includes/class.LogEmailsPlugin.php +++ b/includes/class.LogEmailsPlugin.php @@ -7,6 +7,9 @@ class LogEmailsPlugin { protected $args = false; // arguments to wp_mail() function, recorded from filter wp_mail + // scheduled tasks + const TASK_PURGE = 'log_emails_purge'; + /** * static method for getting the instance of this singleton object * @return self @@ -31,7 +34,7 @@ public function __construct() { add_action('admin_init', array($this, 'registerSettings')); add_action('admin_menu', array($this, 'adminMenu')); add_filter('plugin_row_meta', array($this, 'addPluginDetailsLinks'), 10, 2); - add_action(LOG_EMAILS_TASK_PURGE, array($this, 'purge')); + add_action(self::TASK_PURGE, array($this, 'purge')); register_deactivation_hook(LOG_EMAILS_PLUGIN_FILE, array($this, 'deactivate')); @@ -57,8 +60,8 @@ public function loadTranslations() { */ public function init() { // make sure we have a schedule for purging old logs - if (!wp_next_scheduled(LOG_EMAILS_TASK_PURGE)) { - wp_schedule_event(time() + 10, 'daily', LOG_EMAILS_TASK_PURGE); + if (!wp_next_scheduled(self::TASK_PURGE)) { + wp_schedule_event(time() + 10, 'daily', self::TASK_PURGE); } } @@ -164,7 +167,7 @@ public function phpmailerInit($phpmailer) { */ public function deactivate() { // remove scheduled tasks - wp_clear_scheduled_hook(LOG_EMAILS_TASK_PURGE); + wp_clear_scheduled_hook(self::TASK_PURGE); } /** diff --git a/includes/class.LogEmailsPostTypeLog.php b/includes/class.LogEmailsPostTypeLog.php index 89f4086..90667c8 100644 --- a/includes/class.LogEmailsPostTypeLog.php +++ b/includes/class.LogEmailsPostTypeLog.php @@ -36,6 +36,7 @@ public function init() { if ($typenow == self::POST_TYPE) { add_filter('display_post_states', '__return_false'); add_filter('bulk_actions-edit-' . self::POST_TYPE, array($this, 'adminBulkActionsEdit')); + add_filter('parse_query', array($this, 'adminPostOrder')); add_filter('manage_' . self::POST_TYPE . '_posts_columns', array($this, 'adminManageColumns')); add_action('manage_' . self::POST_TYPE . '_posts_custom_column', array($this, 'adminManageCustomColumn'), 10, 2); add_filter('gettext', array($this, 'removePublished'), 10, 3); @@ -125,6 +126,21 @@ public function adminBulkActionsEdit($actions) { return $actions; } + /** + * change default order to ID descending, for better consistency when multiple logs land in the same second + * @param WP_Query $query + * @return WP_Query + */ + public function adminPostOrder($query) { + // only for admin queries for this post type, with no specified order + if ($query->is_admin && $query->get('post_type') == self::POST_TYPE && empty($query->query_vars['orderby'])) { + $query->set('orderby', 'ID'); + $query->set('order', 'DESC'); + } + + return $query; + } + /** * filter to add columns to post list * @param array $posts_columns diff --git a/languages/log-emails-cs_CZ.mo b/languages/log-emails-cs_CZ.mo new file mode 100644 index 0000000000000000000000000000000000000000..e14dd335ada85fe5e73ab57a0a840a69b5c185ca GIT binary patch literal 2074 zcmZ{kO>A355XWD^rPQ>1l<%)HAXKGk-P%bG!NDM!&#HA}C80tUm-X9i{Ob31pLW+y z?HebAR3s$Cp{h7ooH(T70=MSkM7{KYxPp4)f)Gd?-~tl=@pC??f+hR6Gdpi~=Kp4W z|5)ye0H5RdzJl+O18fDs-+TBX?0;ZC4L<)6V!%`2VQ>=6gXh30unKbAC*YIdm*DH* zZSYm_d+-JDH}EC!(8I_Hz5#Mv8RYXm1fK=l;7Rbt(EbkOJoiA3{{?&*Jd(@&BOu#z zAoo-U9|u1I-vmDcp8~%Hxz4*F*ZCuO5Iz11J_q}cgW36qAIbWCZOGH$QS843&VchE z*Kq^nx^9C{fcL;h!Jk0Z>1Xf|`1{cR7sxuY6GsL|!NXEm?I2@_#E#5WQXKB+s{OJi;z_Zpu(5wiWPC8$cCJB7++&nRkjK%;iYcGW zE$ujhEW#-*m8Fq6YZB};ws%_fYbx})<%~fhu185LAt^eJyrCw`nI&OSa!{M%D2aTK z7`zumXm#DQU^!mwcvF_xwA^54+X!?ksiO|OjQ`0Wq;YFC(ooM2UKX@&y4;Mx7^waC z=9Q-f6{q{}E@6E1>i&BxR%jPTKb%vK(8c(wSm@IQ<2l{xXLAx<8x7BGOY7HiUJ`SKeQlD@^XjaferxEzIiB zNC;7;$$I4TwYX(PT$nR9ab?ob9Hy&`Pf@n4jOa?GbduhsB9&=Gzf&2b6DLT&U728K z3C^*p{0D`3rIi)l*fPz>#@F}`oGqRy3D zYbZ5cxq0i_Ru9MQ`~fsMth!2fXltY2lbi*^z2_LNpxtT2O7?s0evd0{?-sGl z{q%d(G`Nw-x15Ns@K{_)E#d`M7arWIZQbmzUsFjKVRupD2OcGp&0G9nm2YIf7xO_5 zsX3TS;%cRcxd*ILej;p`Ze~FN+zV8{ewyl=w;C#;CjL$PcOXDZ+N}-KhEV@)tY&0t zwr=7+pxXYrYa${wi3wpZ7^zLDkPik|7n`jO{0RhsMpu{th>pv_Vsl-K5-%6p7_7Ud eZbdi3E#=G79mv2jSBCyQOX^At&M>Bfjeh|Mdroiw literal 0 HcmV?d00001 diff --git a/log-emails.php b/log-emails.php index b677b35..111bf2a 100644 --- a/log-emails.php +++ b/log-emails.php @@ -3,7 +3,7 @@ Plugin Name: Log Emails Plugin URI: http://shop.webaware.com.au/downloads/log-emails/ Description: Log emails to the database, to enable email problem analysis -Version: 1.0.3 +Version: 1.0.4 Author: WebAware Author URI: http://webaware.com.au/ Text Domain: log-emails @@ -31,10 +31,7 @@ define('LOG_EMAILS_PLUGIN_FILE', __FILE__); define('LOG_EMAILS_PLUGIN_ROOT', dirname(__FILE__) . '/'); define('LOG_EMAILS_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__)); - define('LOG_EMAILS_PLUGIN_VERSION', '1.0.3'); - - // scheduled tasks - define('LOG_EMAILS_TASK_PURGE', 'log_emails_purge'); + define('LOG_EMAILS_PLUGIN_VERSION', '1.0.4'); } require LOG_EMAILS_PLUGIN_ROOT . 'includes/class.LogEmailsPlugin.php'; diff --git a/readme.txt b/readme.txt index 99f2bb6..0a9cfe1 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Donate link: http://shop.webaware.com.au/downloads/log-emails/ Tags: email log, logging, logs, email Requires at least: 3.6.1 Tested up to: 4.0 -Stable tag: 1.0.3 +Stable tag: 1.0.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -21,6 +21,12 @@ Use this plugin with [Disable Emails](http://shop.webaware.com.au/downloads/disa Logs are automatically purged after a defined period, set through a settings page in the WordPress admin. Setting the period to 0 prevents logs from being purged. Deactivating the plugin purges all logs. += Translations = + +Many thanks to the generous efforts of our translators: + +* Czech (cs-CZ) -- ([Rudolf Klusal](http://www.klusik.cz/)) + If you'd like to help out by translating this plugin, please [sign up for an account and dig in](http://translate.webaware.com.au/projects/log-emails). == Installation == @@ -62,6 +68,10 @@ Things I'd like to add to the plugin: == Changelog == += 1.0.4 [2014-11-03] = +* fixed: default sort order is by ID descending, to avoid ordering errors when logs occur in the same second +* added: Czech translation (thanks, [Rudolf Klusal](http://www.klusik.cz/)!) + = 1.0.3 [2014-09-06] = * fixed: PHP warning on static call to non-static methods in class LogEmailsCache_WpSuperCache * fixed: fix WordPress 4.0 box shadow on return-to-list :focus diff --git a/views/log-detail.php b/views/log-detail.php index 0154667..394f470 100644 --- a/views/log-detail.php +++ b/views/log-detail.php @@ -4,7 +4,7 @@
-

+