Commit f17cfa0e authored by Rolf Forst's avatar Rolf Forst
Browse files

Add sortable column; add en_US language

parent 154fe13d
msgid ""
msgstr ""
"Project-Id-Version: RRZE Post Expiration\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-18 10:52+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: RRZE-Webteam <webmaster@rrze.fau.de>\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;_n:1,2;_nx:4c,1,2\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SourceCharset: UTF-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.7\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../rrze-post-expiration.php:80
#, php-format
msgid ""
"Ihre PHP-Version %s ist veraltet. Bitte aktualisieren Sie mindestens auf die "
"PHP-Version %s."
msgstr ""
"Your server is running PHP version %s. Please upgrade at least to PHP "
"version %s."
#: ../rrze-post-expiration.php:82
#, php-format
msgid ""
"Ihre Wordpress-Version %s ist veraltet. Bitte aktualisieren Sie mindestens "
"auf die Wordpress-Version %s."
msgstr ""
"Your Wordpress version is %s. Please upgrade at least to Wordpress version "
"%s."
#: ../rrze-post-expiration.php:92
msgid "Verfallsdatum"
msgstr "Expiration"
#: ../rrze-post-expiration.php:107
msgid "Keine"
msgstr "None"
#: ../rrze-post-expiration.php:110
msgid "Y/m/d g:i:s A"
msgstr "Y/m/d g:i:s A"
#: ../rrze-post-expiration.php:118
#, php-format
msgid "in %s"
msgstr "in %s"
#: ../rrze-post-expiration.php:121
#, php-format
msgid "%s ago"
msgstr "%s ago"
#: ../rrze-post-expiration.php:123
msgid "Y/m/d"
msgstr "Y/m/d"
#: ../rrze-post-expiration.php:127
msgid "abgelaufen"
msgstr "expired"
#: ../rrze-post-expiration.php:171
msgid "j. M Y @ H:i"
msgstr "M j, Y @ H:i"
#: ../rrze-post-expiration.php:173 ../rrze-post-expiration.php:344
msgid "Verfallsdatum <b>deaktiviert</b>"
msgstr "Expiration <b>disabled</b>"
#: ../rrze-post-expiration.php:179
#, php-format
msgid "Verfällt am: <b>%s</b>"
msgstr "Expires on: <b>%s</b>"
#: ../rrze-post-expiration.php:181
#, php-format
msgid "Abgelaufen am: <b>%s</b>"
msgstr "Expired on: <b>%s</b>"
#: ../rrze-post-expiration.php:191
msgid "Bearbeiten"
msgstr "Edit"
#: ../rrze-post-expiration.php:244
msgid "Verfallsdatum aktivieren"
msgstr "Enable expiration"
#: ../rrze-post-expiration.php:247
#, php-format
msgid "%1$s%2$s, %3$s @ %4$s : %5$s"
msgstr "%1$s%2$s, %3$s @ %4$s : %5$s"
#: ../rrze-post-expiration.php:267
msgid "OK"
msgstr "OK"
#: ../rrze-post-expiration.php:268
msgid "Abbrechen"
msgstr "Cancel"
#: ../rrze-post-expiration.php:325
msgid "Verfällt am:"
msgstr "Expires on:"
#: ../rrze-post-expiration.php:327
msgid "Abgelaufen am:"
msgstr "Expired on:"
#: ../rrze-post-expiration.php:397
msgid "Every Two Minutes"
msgstr "Every Two Minutes"
#~ msgid "Abgelaufen"
#~ msgstr "Expired"
......@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: RRZE Post Expiration\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-17 18:02+0100\n"
"POT-Creation-Date: 2016-03-18 10:56+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: RRZE-Webteam <webmaster@rrze.fau.de>\n"
......@@ -32,83 +32,83 @@ msgid ""
"auf die Wordpress-Version %s."
msgstr ""
#: ../rrze-post-expiration.php:102
#: ../rrze-post-expiration.php:92
msgid "Verfallsdatum"
msgstr ""
#: ../rrze-post-expiration.php:123
#: ../rrze-post-expiration.php:107
msgid "Keine"
msgstr ""
#: ../rrze-post-expiration.php:126
#: ../rrze-post-expiration.php:110
msgid "Y/m/d g:i:s A"
msgstr ""
#: ../rrze-post-expiration.php:134
#: ../rrze-post-expiration.php:118
#, php-format
msgid "in %s"
msgstr ""
#: ../rrze-post-expiration.php:137
#: ../rrze-post-expiration.php:121
#, php-format
msgid "%s ago"
msgstr ""
#: ../rrze-post-expiration.php:139
#: ../rrze-post-expiration.php:123
msgid "Y/m/d"
msgstr ""
#: ../rrze-post-expiration.php:143
msgid "Abgelaufen"
#: ../rrze-post-expiration.php:127
msgid "abgelaufen"
msgstr ""
#: ../rrze-post-expiration.php:156
msgid "M j, Y @ G:i"
#: ../rrze-post-expiration.php:171
msgid "j. M Y @ H:i"
msgstr ""
#: ../rrze-post-expiration.php:158 ../rrze-post-expiration.php:329
#: ../rrze-post-expiration.php:173 ../rrze-post-expiration.php:344
msgid "Verfallsdatum <b>deaktiviert</b>"
msgstr ""
#: ../rrze-post-expiration.php:165
#: ../rrze-post-expiration.php:179
#, php-format
msgid "Verfällt am: <b>%s</b>"
msgstr ""
#: ../rrze-post-expiration.php:167
#: ../rrze-post-expiration.php:181
#, php-format
msgid "Abgelaufen am: <b>%s</b>"
msgstr ""
#: ../rrze-post-expiration.php:177
msgid "Edit"
#: ../rrze-post-expiration.php:191
msgid "Bearbeiten"
msgstr ""
#: ../rrze-post-expiration.php:230
#: ../rrze-post-expiration.php:244
msgid "Verfallsdatum aktivieren"
msgstr ""
#: ../rrze-post-expiration.php:233
#: ../rrze-post-expiration.php:247
#, php-format
msgid "%1$s%2$s, %3$s @ %4$s : %5$s"
msgstr ""
#: ../rrze-post-expiration.php:252
#: ../rrze-post-expiration.php:267
msgid "OK"
msgstr ""
#: ../rrze-post-expiration.php:253
msgid "Cancel"
#: ../rrze-post-expiration.php:268
msgid "Abbrechen"
msgstr ""
#: ../rrze-post-expiration.php:310
#: ../rrze-post-expiration.php:325
msgid "Verfällt am:"
msgstr ""
#: ../rrze-post-expiration.php:312
#: ../rrze-post-expiration.php:327
msgid "Abgelaufen am:"
msgstr ""
#: ../rrze-post-expiration.php:392
#: ../rrze-post-expiration.php:397
msgid "Every Two Minutes"
msgstr ""
......@@ -2,7 +2,7 @@
/*
Plugin Name: RRZE Post Expiration
Plugin URI: https://gitlab.rrze.fau.de/rrze-webteam/rrze-post-expiration
Version: 1.0.0
Version: 1.1.0
Description: Verfallsdatum für Beiträge.
Author: RRZE-Webteam
License: GPLv2 or later
......@@ -51,8 +51,10 @@ class RRZE_Post_Expiration {
private function __construct() {
global $current_blog;
add_filter('manage_posts_columns', array(__CLASS__, 'expiration_date_column'));
add_action('manage_posts_custom_column', array(__CLASS__, 'expiration_date_custom_colum'), 10, 2);
add_filter('manage_post_posts_columns', array(__CLASS__, 'expiration_date_column'));
add_action('manage_post_posts_custom_column', array(__CLASS__, 'expiration_date_custom_column'), 10, 2);
add_filter('manage_edit-post_sortable_columns', array(__CLASS__, 'expiration_date_sortable_column'));
add_action('pre_get_posts', array(__CLASS__, 'expiration_date_orderby'));
add_action('post_submitbox_misc_actions', array(__CLASS__, 'exp_meta_box'));
......@@ -87,22 +89,16 @@ class RRZE_Post_Expiration {
}
public static function expiration_date_column($columns) {
global $post_type;
if ($post_type != 'post')
return $columns;
$columns['expiration_date'] = __('Verfallsdatum', 'rrze-post-expiration');
return $columns;
}
public static function expiration_date_custom_colum($column, $post_id) {
if ($column != 'expiration_date')
public static function expiration_date_custom_column($column, $post_id) {
if ($column != 'expiration_date') {
return;
}
$post = get_post($post_id);
if ($post->post_type != 'post')
return;
$expiration_date = get_post_meta($post->ID, 'expiration_date', true);
$expiration_date_gmt = get_post_meta($post->ID, 'expiration_date_gmt', true);
......@@ -118,30 +114,61 @@ class RRZE_Post_Expiration {
$time_diff = $time - time();
if ($time_diff > 0 && $time_diff < 24 * 60 * 60)
if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
$h_time = sprintf(__('in %s'), human_time_diff($time));
elseif ($time_diff < 0 && abs($time_diff) < 24 * 60 * 60)
} elseif ($time_diff < 0 && abs($time_diff) < 24 * 60 * 60) {
$h_time = sprintf(__('%s ago'), human_time_diff($time));
else
} else {
$h_time = mysql2date(__('Y/m/d'), $m_time);
}
echo '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
if ($time_diff < 0)
echo '<br/>', __('Abgelaufen', 'rrze-post-expiration');
if ($time_diff < 0) {
echo '<br/>', __('abgelaufen', 'rrze-post-expiration');
}
}
}
public static function expiration_date_sortable_column($columns) {
$columns['expiration_date'] = 'expiration_date';
return $columns;
}
public static function expiration_date_orderby($query) {
if (!is_admin()) {
return;
}
$orderby = $query->get('orderby');
if('expiration_date' == $orderby) {
$query->set('orderby', 'meta_value');
$query->set('meta_query', array(
'relation' => 'OR',
array(
'key' => 'expiration_date',
'compare' => 'NOT EXISTS'
),
array(
'key' => 'expiration_date',
'compare' => 'EXISTS'
),
)
);
}
}
public static function exp_meta_box() {
global $post, $post_type, $post_type_object;
if ($post_type != 'post')
if ($post_type != 'post') {
return;
}
$can_publish = current_user_can($post_type_object->cap->publish_posts);
if ($can_publish) :
$cur_time = strtotime(current_time('mysql'));
$datef = __('M j, Y @ H:i');
$datef = __('j. M Y @ H:i', 'rrze-post-expiration');
$date = date_i18n($datef, $cur_time);
$stamp = __('Verfallsdatum <b>deaktiviert</b>', 'rrze-post-expiration');
if (0 != $post->ID) {
......@@ -161,7 +188,7 @@ class RRZE_Post_Expiration {
<div class="misc-pub-section curtime misc-pub-section-last">
<span id="timestamp" class="exp_timestamp">
<?php printf($stamp, $date); ?></span>
<a href="#edit_exp_timestamp" class="edit-exp-timestamp hide-if-no-js" tabindex="4"><?php _e('Edit', 'rrze-post-expiration') ?></a>
<a href="#edit_exp_timestamp" class="edit-exp-timestamp hide-if-no-js" tabindex="4"><?php _e('Bearbeiten', 'rrze-post-expiration') ?></a>
<div id="exp_timestampdiv" class="hide-if-js">
<?php self::expire_time(); ?>
</div>
......@@ -222,10 +249,11 @@ class RRZE_Post_Expiration {
echo '</div><input type="hidden" id="exp_ss" name="exp_ss" value="' . $ss . '" />';
echo "\n\n";
if ($enabled)
if ($enabled) {
echo '<input type="hidden" id="exp_enabled" name="exp_enabled" value="1" />';
else
} else {
echo '<input type="hidden" id="exp_enabled" name="exp_enabled" value="0" />';
}
echo "\n\n";
foreach (array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit) {
......@@ -236,8 +264,8 @@ class RRZE_Post_Expiration {
?>
<p>
<a href="#edit_exp_timestamp" class="save-exp-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#edit_exp_timestamp" class="cancel-exp-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a>
<a href="#edit_exp_timestamp" class="save-exp-timestamp hide-if-no-js button"><?php _e('OK', 'rrze-post-expiration'); ?></a>
<a href="#edit_exp_timestamp" class="cancel-exp-timestamp hide-if-no-js"><?php _e('Abbrechen', 'rrze-post-expiration'); ?></a>
</p>
<?php
}
......@@ -328,8 +356,9 @@ class RRZE_Post_Expiration {
public static function update_post_expiration_date() {
global $current_blog, $post;
if (!$post || $post->post_type != 'post')
if (!$post || $post->post_type != 'post') {
return;
}
delete_post_meta($post->ID, 'expiration_date');
delete_post_meta($post->ID, 'expiration_date_gmt');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment