Skip to content

Commit

Permalink
Czech translation, admin post order
Browse files Browse the repository at this point in the history
  • Loading branch information
webaware committed Nov 3, 2014
1 parent 13a159e commit 0679a98
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 12 deletions.
11 changes: 7 additions & 4 deletions includes/class.LogEmailsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'));

Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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);
}

/**
Expand Down
16 changes: 16 additions & 0 deletions includes/class.LogEmailsPostTypeLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Binary file added languages/log-emails-cs_CZ.mo
Binary file not shown.
7 changes: 2 additions & 5 deletions log-emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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';
Expand Down
12 changes: 11 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 ==
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion views/log-detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="wrap">

<h2><?php echo esc_html('Log Emails', 'log-emails'); ?></h2>
<h2><?php esc_html_e('Email Logs', 'log-emails'); ?></h2>

<nav class="log-emails-next-prev">
<?php if ($previous): ?>
Expand Down
2 changes: 1 addition & 1 deletion views/settings-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="wrap">
<?php screen_icon(); ?>
<h2>Log Emails</h2>
<h2><?php esc_html_e('Email Logs', 'log-emails'); ?></h2>

<form action="<?php echo admin_url('options.php'); ?>" method="POST">
<?php settings_fields('log-emails'); ?>
Expand Down

0 comments on commit 0679a98

Please sign in to comment.