Simple History - Version 1.0.4

Version Description

  • You may want to clear the history database after this update because the items in the log will have mixed translate/untranslated status and it may look/work a bit strange.
  • Added: Option to clear the database of log items.
  • Changed: No longer stored translated history items in the log. This makes the history work even if/when you switch langauge of WordPress.
  • Fixed: if for example a post was editied several times and during these edits it changed name, it would end up at different occasions. Now it's correctly stored as one event with several occasions.
  • Some more items are translateable
Download this release

Release Info

Developer eskapism
Plugin Icon 128x128 Simple History
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

Files changed (4) hide show
  1. index.php +168 -102
  2. languages/simple-history.pot +125 -148
  3. readme.txt +8 -1
  4. scripts.js +8 -4
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log/history/audit log/version history of the changes made by users in WordPress.
6
- Version: 1.0.3
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -27,7 +27,7 @@ License: GPL2
27
 
28
  load_plugin_textdomain('simple-history', false, "/simple-history/languages");
29
 
30
- define( "SIMPLE_HISTORY_VERSION", "1.0.3");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
33
 
@@ -55,6 +55,26 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
55
  $this->view_history_capability = "edit_pages";
56
  $this->view_history_capability = apply_filters("simple_history_view_history_capability", $this->view_history_capability);
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
  function plugin_action_links($actions, $b, $c, $d) {
@@ -127,7 +147,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
127
 
128
  // WordPress Core updated
129
  function action_core_updated($wp_version) {
130
- simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('WordPress Core', 'simple-history') . "&object_id=wordpress_core&object_name=".sprintf(__('WordPress %1$s', 'simple-history'), $wp_version));
131
  }
132
 
133
  function filter_option_page_capability($capability) {
@@ -185,7 +205,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
185
  $wpdb->query($sql);
186
 
187
  // Store this upgrade in ourself :)
188
- simple_history_add("action=" . __( 'upgraded it\'s database', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=" . SIMPLE_HISTORY_NAME);
189
 
190
  #echo "done upgrading database";
191
 
@@ -227,9 +247,10 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
227
 
228
  add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug");
229
 
230
- add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"), "simple_history_settings_field", "simple_history_settings_menu_slug", "simple_history_settings_section");
231
- add_settings_field("simple_history_settings_field_2", __("RSS feed", "simple-history"), "simple_history_settings_field_rss", "simple_history_settings_menu_slug", "simple_history_settings_section");
232
- add_settings_field("simple_history_settings_field_3", __("Donate", "simple-history"), "simple_history_settings_field_donate", "simple_history_settings_menu_slug", "simple_history_settings_section");
 
233
 
234
  register_setting("simple_history_settings_group", "simple_history_show_on_dashboard");
235
  register_setting("simple_history_settings_group", "simple_history_show_as_page");
@@ -334,8 +355,8 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
334
 
335
  function ajax() {
336
 
337
- $type = $_POST["type"];
338
- if ($type == __( "All types", 'simple-history' )) { $type = ""; }
339
 
340
  $user = $_POST["user"];
341
  if ($user == __( "By all users", 'simple-history' )) { $user = ""; }
@@ -354,9 +375,11 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
354
 
355
  $search = (isset($_POST["search"])) ? $_POST["search"] : "";
356
 
 
 
357
  $args = array(
358
  "is_ajax" => true,
359
- "filter_type" => $type,
360
  "filter_user" => $user,
361
  "page" => $page,
362
  "items" => $items,
@@ -369,6 +392,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
369
  "error" => "",
370
  "items_li" => "",
371
  "filtered_items_total_count" => 0,
 
372
  "filtered_items_total_pages" => 0
373
  );
374
 
@@ -384,6 +408,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
384
  $args["items"] = "all";
385
  $all_items = simple_history_get_items_array($args);
386
  $arr_json["filtered_items_total_count"] = sizeof($all_items);
 
387
  $arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / simple_history::$pager_size);
388
  }
389
 
@@ -434,6 +459,36 @@ function simple_history_settings_field() {
434
  <?php
435
  }
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  function simple_history_settings_field_donate() {
438
  ?>
439
  <p>
@@ -471,12 +526,6 @@ function simple_history_settings_field_rss() {
471
  ?>
472
  <?php
473
  $create_new_secret = false;
474
- /*
475
- // eeek! why was this here?
476
- if ($rss_secret == false) {
477
- $create_new_secret = true;
478
- }
479
- */
480
  if (isset($_GET["simple_history_rss_update_secret"]) && $_GET["simple_history_rss_update_secret"]) {
481
  $create_new_secret = true;
482
  echo "<div class='simple-history-settings-page-updated'><p>";
@@ -494,18 +543,18 @@ function simple_history_settings_field_rss() {
494
  _e("This is a secret RSS feed for Simple History. Only share the link with people you trust", 'simple-history');
495
  echo "<br />";
496
  $update_link = add_query_arg("simple_history_rss_update_secret", "1");
497
- printf(__("You can <a href='%s#simple-history-settings-page'>generate a new address</a> for the RSS feed. This is useful if you think that the address has fallen into the wrong hands.", 'simple-history'), $update_link);
498
  }
499
 
500
  // @todo: move all add-related stuff to own file? there are so many of them.. kinda confusing, ey.
501
 
502
  function simple_history_activated_plugin($plugin_name) {
503
  $plugin_name = urlencode($plugin_name);
504
- simple_history_add("action=" . __( 'activated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name");
505
  }
506
  function simple_history_deactivated_plugin($plugin_name) {
507
  $plugin_name = urlencode($plugin_name);
508
- simple_history_add("action=" . __( 'deactivated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name");
509
  }
510
 
511
  function simple_history_edit_comment($comment_id) {
@@ -520,7 +569,7 @@ function simple_history_edit_comment($comment_id) {
520
  $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
521
  $str = urlencode($str);
522
 
523
- simple_history_add("action=" . __( 'edited', 'simple-history' ) . "&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id");
524
 
525
  }
526
 
@@ -536,7 +585,7 @@ function simple_history_delete_comment($comment_id) {
536
  $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
537
  $str = urlencode($str);
538
 
539
- simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id");
540
 
541
  }
542
 
@@ -552,15 +601,15 @@ function simple_history_set_comment_status($comment_id, $new_status) {
552
 
553
  $action = "";
554
  if ("approve" == $new_status) {
555
- $action = __( 'approved', 'simple-history' );
556
  } elseif ("hold" == $new_status) {
557
- $action = __( 'unapproved', 'simple-history' );
558
  } elseif ("spam" == $new_status) {
559
- $action = __( 'marked as spam', 'simple-history' );
560
  } elseif ("trash" == $new_status) {
561
- $action = __( 'trashed', 'simple-history' );
562
  } elseif ("0" == $new_status) {
563
- $action = __( 'untrashed', 'simple-history' );
564
  }
565
 
566
  $action = urlencode($action);
@@ -568,7 +617,7 @@ function simple_history_set_comment_status($comment_id, $new_status) {
568
  $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
569
  $str = urlencode($str);
570
 
571
- simple_history_add("action=$action&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id");
572
 
573
  }
574
 
@@ -618,30 +667,29 @@ function simple_history_updated_option3($option) {
618
  }
619
  */
620
 
621
-
622
  function simple_history_add_attachment($attachment_id) {
623
  $post = get_post($attachment_id);
624
  $post_title = urlencode(get_the_title($post->ID));
625
- simple_history_add("action=" . __( 'added', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title");
626
 
627
  }
628
  function simple_history_edit_attachment($attachment_id) {
629
  // is this only being called if the title of the attachment is changed?!
630
  $post = get_post($attachment_id);
631
  $post_title = urlencode(get_the_title($post->ID));
632
- simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title");
633
  }
634
  function simple_history_delete_attachment($attachment_id) {
635
  $post = get_post($attachment_id);
636
  $post_title = urlencode(get_the_title($post->ID));
637
- simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title");
638
  }
639
 
640
  // user is updated
641
  function simple_history_profile_update($user_id) {
642
  $user = get_user_by("id", $user_id);
643
  $user_nicename = urlencode($user->user_nicename);
644
- simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') . "&object_id=$user_id&object_name=$user_nicename");
645
  }
646
 
647
  // user is created
@@ -655,7 +703,7 @@ function simple_history_user_register($user_id) {
655
  function simple_history_delete_user($user_id) {
656
  $user = get_user_by("id", $user_id);
657
  $user_nicename = urlencode($user->user_nicename);
658
- simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') . "&object_id=$user_id&object_name=$user_nicename");
659
  }
660
 
661
  // user logs in
@@ -669,14 +717,14 @@ function simple_history_wp_login($user) {
669
  } else {
670
  $user_id = $current_user->ID;
671
  }
672
- simple_history_add("action=" . __( 'logged in', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') ."&object_id=".$user->ID."&user_id=$user_id&object_name=$user_nicename");
673
  }
674
  // user logs out
675
  function simple_history_wp_logout() {
676
  $current_user = wp_get_current_user();
677
  $current_user_id = $current_user->ID;
678
  $user_nicename = urlencode($current_user->user_nicename);
679
- simple_history_add("action=" . __( 'logged out', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') ."&object_id=$current_user_id&object_name=$user_nicename");
680
  }
681
 
682
  function simple_history_delete_post($post_id) {
@@ -684,7 +732,7 @@ function simple_history_delete_post($post_id) {
684
  $post = get_post($post_id);
685
  if ($post->post_status != "auto-draft" && $post->post_status != "inherit") {
686
  $post_title = urlencode(get_the_title($post->ID));
687
- simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Post') ."&object_subtype=" . $post->post_type . "&object_id=$post_id&object_name=$post_title");
688
  }
689
  }
690
  }
@@ -721,22 +769,23 @@ function simple_history_transition_post_status($new_status, $old_status, $post)
721
  //bonny_d($post); // regular post object
722
  if ($old_status == "auto-draft" && ($new_status != "auto-draft" && $new_status != "inherit")) {
723
  // page created
724
- $action = __( "created", 'simple-history' );
725
  } elseif ($new_status == "auto-draft" || ($old_status == "new" && $new_status == "inherit")) {
726
  // page...eh.. just leave it.
727
  return;
728
  } elseif ($new_status == "trash") {
729
- $action = __( "deleted", 'simple-history' );
730
  } else {
731
  // page updated. i guess.
732
- $action = __( "updated", 'simple-history' );
733
  }
734
  $object_type = "post";
735
  $object_subtype = $post->post_type;
736
 
737
  // Attempt to auto-translate post types*/
738
- $object_type = __( ucfirst ( $object_type ) );
739
- $object_subtype = __( ucfirst ( $object_subtype ) );
 
740
 
741
  if ($object_subtype == "revision") {
742
  // don't log revisions
@@ -886,7 +935,7 @@ function simple_history_install() {
886
 
887
  #}
888
 
889
- simple_history_add("action=" . __( 'activated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name");
890
 
891
  // also generate a rss secret, if it does not exist
892
  if (!get_option("simple_history_rss_secret")) {
@@ -910,7 +959,7 @@ function simple_history_print_nav() {
910
  }
911
  $sql = "SELECT DISTINCT object_type, object_subtype FROM {$tableprefix}simple_history ORDER BY object_type, object_subtype";
912
  $arr_types = $wpdb->get_results($sql);
913
- #echo "<p>View:</p>";
914
  $str_types = "";
915
  $str_types .= "<ul class='simple-history-filter simple-history-filter-type'>";
916
  $css = "";
@@ -918,10 +967,9 @@ function simple_history_print_nav() {
918
  $css = "class='selected'";
919
  }
920
 
921
- // add_query_arg(
922
  $link = esc_html(add_query_arg("simple_history_type_to_show", ""));
923
  $str_types_desc = __("All types", 'simple-history');
924
- $str_types .= "<li $css><a href='$link'>" . esc_html($str_types_desc) . "</a> | </li>";
925
  foreach ($arr_types as $one_type) {
926
  $css = "";
927
  if ($one_type->object_subtype && $simple_history_type_to_show == ($one_type->object_type."/".$one_type->object_subtype)) {
@@ -929,7 +977,7 @@ function simple_history_print_nav() {
929
  } elseif (!$one_type->object_subtype && $simple_history_type_to_show == $one_type->object_type) {
930
  $css = "class='selected'";
931
  }
932
- $str_types .= "<li $css>";
933
  $arg = "";
934
  if ($one_type->object_subtype) {
935
  $arg = $one_type->object_type."/".$one_type->object_subtype;
@@ -938,12 +986,35 @@ function simple_history_print_nav() {
938
  }
939
  $link = esc_html(add_query_arg("simple_history_type_to_show", $arg));
940
  $str_types .= "<a href='$link'>";
941
- $str_types .= esc_html(__($one_type->object_type));
942
- if ($one_type->object_subtype) {
943
- $str_types .= "/". esc_html(__($one_type->object_subtype));
 
 
 
 
 
 
 
 
 
 
 
944
  }
 
 
 
 
 
 
945
  $str_types .= "</a> | ";
946
  $str_types .= "</li>";
 
 
 
 
 
 
947
  }
948
  $str_types .= "</ul>";
949
  $str_types = str_replace("| </li></ul>", "</li></ul>", $str_types);
@@ -973,7 +1044,7 @@ function simple_history_print_nav() {
973
  }
974
  }
975
 
976
- if ($arr_users) {
977
  if (isset($_GET["simple_history_user_to_show"])) {
978
  $simple_history_user_to_show = $_GET["simple_history_user_to_show"];
979
  } else {
@@ -1038,7 +1109,7 @@ function simple_history_get_pagination() {
1038
  </div>
1039
  </div>
1040
  ',
1041
- sprintf( __('<span>%1$d</span> items', "simple-history"), $items_count),
1042
  $page_current,
1043
  $pages_count,
1044
  ($pages_count == 1) ? "disabled" : "",
@@ -1086,8 +1157,12 @@ function simple_history_get_items_array($args = "") {
1086
  } else {
1087
  $filter_type = $simple_history_type_to_show;
1088
  }
1089
- $where .= " AND lower(object_type) = '".strtolower($filter_type)."' ";
1090
- $where .= " AND lower(object_subtype) = '".strtolower($filter_subtype)."' ";
 
 
 
 
1091
  }
1092
  if ($simple_history_user_to_show) {
1093
 
@@ -1102,7 +1177,8 @@ function simple_history_get_items_array($args = "") {
1102
  $tableprefix = $wpdb->prefix;
1103
 
1104
  $sql = "SELECT * FROM {$tableprefix}simple_history $where ORDER BY date DESC, id DESC ";
1105
-
 
1106
  $rows = $wpdb->get_results($sql);
1107
 
1108
  $loopNum = 0;
@@ -1114,6 +1190,11 @@ function simple_history_get_items_array($args = "") {
1114
  if ($rows) {
1115
  $prev_row = null;
1116
  foreach ($rows as $one_row) {
 
 
 
 
 
1117
  if (
1118
  $prev_row
1119
  && $one_row->action == $prev_row->action
@@ -1121,12 +1202,17 @@ function simple_history_get_items_array($args = "") {
1121
  && $one_row->object_type == $prev_row->object_type
1122
  && $one_row->object_subtype == $prev_row->object_subtype
1123
  && $one_row->user_id == $prev_row->user_id
1124
- && $one_row->object_id == $prev_row->object_id
1125
- && $one_row->object_name == $prev_row->object_name
 
 
 
1126
  ) {
 
1127
  // this event is like the previous event, but only with a different date
1128
  // so add it to the last element in arr_events
1129
  $arr_events[$prev_row->id]->occasions[] = $one_row;
 
1130
  } else {
1131
 
1132
  #echo "<br>real_loop_num: $real_loop_num";
@@ -1181,13 +1267,26 @@ function simple_history_get_items_array($args = "") {
1181
  // */
1182
  //
1183
  //$offset = $args["num_added"]; // old way when we appended
 
 
 
 
 
 
 
 
 
 
 
 
 
1184
  if (is_numeric($args["items"]) && $args["items"] > 0) {
1185
  #sf_d($args);
1186
  $offset = ($args["page"] * $args["items"]);
1187
  #echo "offset: $offset";
1188
  $arr_events = array_splice($arr_events, $offset, $args["items"]);
1189
  }
1190
-
1191
  return $arr_events;
1192
 
1193
  }
@@ -1197,7 +1296,7 @@ function simple_history_get_items_array($args = "") {
1197
  function simple_history_print_history($args = null) {
1198
 
1199
  $arr_events = simple_history_get_items_array($args);
1200
-
1201
  $defaults = array(
1202
  "page" => 0,
1203
  "items" => 5,
@@ -1282,23 +1381,12 @@ function simple_history_print_history($args = null) {
1282
  $who .= "&lt;" . __("Unknown or deleted user", 'simple-history') ."&gt;";
1283
  }
1284
  $who .= "</span>";
1285
- // &rarr;
1286
-
1287
- /*
1288
- sf_d($one_row);
1289
- [object_type] => Post
1290
- [object_subtype] => Page
1291
- somewhere/somewhow object_type turned from being lowercase to being capitalized
1292
- unsure if it's me or wp
1293
- ah: after some digging it seems to have with translation to do, we changed to upperase
1294
- to support translation.
1295
- */
1296
 
1297
  // what and object
1298
  if ("post" == $object_type_lcase) {
1299
 
1300
  $post_out = "";
1301
- $post_out .= $object_subtype;
1302
  $post = get_post($object_id);
1303
 
1304
  if (null == $post) {
@@ -1318,17 +1406,8 @@ function simple_history_print_history($args = null) {
1318
  $post_out .= "<span class='simple-history-title'>{$title}</span>";
1319
  $post_out .= "</a>";
1320
  }
1321
- /*
1322
- if ("created" == $action) {
1323
- $post_out .= " " . __("created", 'simple-history') . " ";
1324
- } elseif ("updated" == $action) {
1325
- $post_out .= " " . __("updated", 'simple-history') . " ";
1326
- } elseif ("deleted" == $action) {
1327
- $post_out .= " " . __("deleted", 'simple-history') . " ";
1328
- } else {
1329
- */
1330
- $post_out .= " " . esc_html($action);
1331
- //}
1332
 
1333
  $post_out = ucfirst($post_out);
1334
  $output .= $post_out;
@@ -1362,12 +1441,13 @@ function simple_history_print_history($args = null) {
1362
  }
1363
  }
1364
 
1365
- $attachment_out .= " $action ";
1366
 
1367
  $attachment_out = ucfirst($attachment_out);
1368
  $output .= $attachment_out;
1369
 
1370
  } elseif ("user" == $object_type_lcase) {
 
1371
  $user_out = "";
1372
  $user_out .= __("user", 'simple-history');
1373
  $user = get_user_by("id", $object_id);
@@ -1402,21 +1482,7 @@ function simple_history_print_history($args = null) {
1402
  $user_out .= "<span class='simple-history-attachment-thumbnail' href='$user_link'>$user_avatar</span>";
1403
  }
1404
 
1405
- /*
1406
- if ("created" == $action) {
1407
- $user_out .= " " . __("added", 'simple-history') . " ";
1408
- } elseif ("updated" == $action) {
1409
- $user_out .= " " . __("updated", 'simple-history') . " " ;
1410
- } elseif ("deleted" == $action) {
1411
- $user_out .= " " . __("deleted", 'simple-history') . " ";
1412
- } elseif ("logged_in" == $action) {
1413
- $user_out .= " " . __("logged in", 'simple-history') . " ";
1414
- } elseif ("logged_out" == $action) {
1415
- $user_out .= " " . __("logged out", 'simple-history') . " ";
1416
- } else {
1417
- */
1418
- $user_out .= " " . esc_html($action);
1419
- //}
1420
 
1421
  $user_out = ucfirst($user_out);
1422
  $output .= $user_out;
@@ -1424,7 +1490,7 @@ function simple_history_print_history($args = null) {
1424
  } elseif ("comment" == $object_type_lcase) {
1425
 
1426
  $comment_link = get_edit_comment_link($object_id);
1427
- $output .= esc_html(ucwords($object_type)) . " " . esc_html($object_subtype) . " <a href='$comment_link'><span class='simple-history-title'>" . esc_html($object_name) . "\"</span></a> " . esc_html($action);
1428
 
1429
  } else {
1430
 
@@ -1447,7 +1513,7 @@ function simple_history_print_history($args = null) {
1447
  default:
1448
  $unknown_action = $unknown_action; // dah!
1449
  }
1450
- $output .= esc_html(ucwords($object_type)) . " " . esc_html($object_subtype) . " <span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span> " . esc_html($unknown_action);
1451
 
1452
  }
1453
  $output .= "</div>";
@@ -1510,7 +1576,7 @@ function simple_history_print_history($args = null) {
1510
 
1511
  $loading = __("Loading...", 'simple-history');
1512
  $loading = "<img src='".site_url("wp-admin/images/loading.gif")."' width=16 height=16>" . $loading;
1513
- $no_found = __("No matchin items found.", 'simple-history');
1514
  $view_rss = __("RSS feed", 'simple-history');
1515
  $view_rss_link = simple_history_get_rss_address();
1516
  $str_show = __("Show", 'simple-history');
@@ -1557,7 +1623,7 @@ function simple_history_add_update_option_page($capability = NULL, $option_page
1557
  $option_page_name = "";
1558
  if (isset($arr_options_names[$option_page])) {
1559
  $option_page_name = $arr_options_names[$option_page];
1560
- simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name");
1561
  }
1562
 
1563
  return $capability;
@@ -1569,7 +1635,7 @@ function simple_history_add_update_option_page_permalinks($action, $result) {
1569
  if ("update-permalink" == $action) {
1570
  $option_page_name = __("Permalink Settings");
1571
  $option_page = "permalink";
1572
- simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name");
1573
  }
1574
 
1575
  }
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log/history/audit log/version history of the changes made by users in WordPress.
6
+ Version: 1.0.4
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
27
 
28
  load_plugin_textdomain('simple-history', false, "/simple-history/languages");
29
 
30
+ define( "SIMPLE_HISTORY_VERSION", "1.0.4");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
33
 
55
  $this->view_history_capability = "edit_pages";
56
  $this->view_history_capability = apply_filters("simple_history_view_history_capability", $this->view_history_capability);
57
 
58
+ $this->add_types_for_translation();
59
+ }
60
+
61
+ /**
62
+ * Some post types etc are added as variables from the log, so to catch these for translation I just add them as dummy stuff here.
63
+ * There is probably a better way to do this, but this should work anyway
64
+ */
65
+ function add_types_for_translation() {
66
+ $dummy = __("approved", "simple-history");
67
+ $dummy = __("unapproved", "simple-history");
68
+ $dummy = __("marked as spam", "simple-history");
69
+ $dummy = __("trashed", "simple-history");
70
+ $dummy = __("untrashed", "simple-history");
71
+ $dummy = __("created", "simple-history");
72
+ $dummy = __("deleted", "simple-history");
73
+ $dummy = __("updated", "simple-history");
74
+ $dummy = __("nav_menu_item", "simple-history");
75
+ $dummy = __("attachment", "simple-history");
76
+ $dummy = __("user", "simple-history");
77
+ $dummy = __("settings page", "simple-history");
78
  }
79
 
80
  function plugin_action_links($actions, $b, $c, $d) {
147
 
148
  // WordPress Core updated
149
  function action_core_updated($wp_version) {
150
+ simple_history_add("action=updated&object_type=wordpress_core&object_id=wordpress_core&object_name=".sprintf(__('WordPress %1$s', 'simple-history'), $wp_version));
151
  }
152
 
153
  function filter_option_page_capability($capability) {
205
  $wpdb->query($sql);
206
 
207
  // Store this upgrade in ourself :)
208
+ simple_history_add("action=" . 'upgraded it\'s database' . "&object_type=plugin&object_name=" . SIMPLE_HISTORY_NAME);
209
 
210
  #echo "done upgrading database";
211
 
247
 
248
  add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug");
249
 
250
+ add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"), "simple_history_settings_field", "simple_history_settings_menu_slug", "simple_history_settings_section");
251
+ add_settings_field("simple_history_settings_field_2", __("RSS feed", "simple-history"), "simple_history_settings_field_rss", "simple_history_settings_menu_slug", "simple_history_settings_section");
252
+ add_settings_field("simple_history_settings_field_4", __("Clear log", "simple-history"), "simple_history_settings_field_clear_log", "simple_history_settings_menu_slug", "simple_history_settings_section");
253
+ add_settings_field("simple_history_settings_field_3", __("Donate", "simple-history"), "simple_history_settings_field_donate", "simple_history_settings_menu_slug", "simple_history_settings_section");
254
 
255
  register_setting("simple_history_settings_group", "simple_history_show_on_dashboard");
256
  register_setting("simple_history_settings_group", "simple_history_show_as_page");
355
 
356
  function ajax() {
357
 
358
+ $type = isset($_POST["type"]) ? $_POST["type"] : "";
359
+ $subtype = isset($_POST["subtype"]) ? $_POST["subtype"] : "";
360
 
361
  $user = $_POST["user"];
362
  if ($user == __( "By all users", 'simple-history' )) { $user = ""; }
375
 
376
  $search = (isset($_POST["search"])) ? $_POST["search"] : "";
377
 
378
+ $filter_type = $type . "/" . $subtype;
379
+
380
  $args = array(
381
  "is_ajax" => true,
382
+ "filter_type" => $filter_type,
383
  "filter_user" => $user,
384
  "page" => $page,
385
  "items" => $items,
392
  "error" => "",
393
  "items_li" => "",
394
  "filtered_items_total_count" => 0,
395
+ "filtered_items_total_count_string" => "",
396
  "filtered_items_total_pages" => 0
397
  );
398
 
408
  $args["items"] = "all";
409
  $all_items = simple_history_get_items_array($args);
410
  $arr_json["filtered_items_total_count"] = sizeof($all_items);
411
+ $arr_json["filtered_items_total_count_string"] = sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items));
412
  $arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / simple_history::$pager_size);
413
  }
414
 
459
  <?php
460
  }
461
 
462
+ /**
463
+ * Settings section to clear database
464
+ */
465
+ function simple_history_settings_field_clear_log() {
466
+
467
+ $clear_log = false;
468
+
469
+ if (isset($_GET["simple_history_clear_log"]) && $_GET["simple_history_clear_log"]) {
470
+ $clear_log = true;
471
+ echo "<div class='simple-history-settings-page-updated'><p>";
472
+ _e("Cleared database", 'simple-history');
473
+ echo "</p></div>";
474
+ }
475
+
476
+ if ($clear_log) {
477
+ simple_history_clear_log();
478
+ }
479
+
480
+ _e("Items in the database are automatically removed after 60 days.", 'simple-history');
481
+ $update_link = add_query_arg("simple_history_clear_log", "1");
482
+ printf(' <a href="%2$s">%1$s</a>', __('Clear it now.', 'simple-history'), $update_link);
483
+ }
484
+
485
+ function simple_history_clear_log() {
486
+ global $wpdb;
487
+ $tableprefix = $wpdb->prefix;
488
+ $sql = "DELETE FROM {$tableprefix}simple_history";
489
+ $wpdb->query($sql);
490
+ }
491
+
492
  function simple_history_settings_field_donate() {
493
  ?>
494
  <p>
526
  ?>
527
  <?php
528
  $create_new_secret = false;
 
 
 
 
 
 
529
  if (isset($_GET["simple_history_rss_update_secret"]) && $_GET["simple_history_rss_update_secret"]) {
530
  $create_new_secret = true;
531
  echo "<div class='simple-history-settings-page-updated'><p>";
543
  _e("This is a secret RSS feed for Simple History. Only share the link with people you trust", 'simple-history');
544
  echo "<br />";
545
  $update_link = add_query_arg("simple_history_rss_update_secret", "1");
546
+ printf(__("You can <a href='%s'>generate a new address</a> for the RSS feed. This is useful if you think that the address has fallen into the wrong hands.", 'simple-history'), $update_link);
547
  }
548
 
549
  // @todo: move all add-related stuff to own file? there are so many of them.. kinda confusing, ey.
550
 
551
  function simple_history_activated_plugin($plugin_name) {
552
  $plugin_name = urlencode($plugin_name);
553
+ simple_history_add("action=activated&object_type=plugin&object_name=$plugin_name");
554
  }
555
  function simple_history_deactivated_plugin($plugin_name) {
556
  $plugin_name = urlencode($plugin_name);
557
+ simple_history_add("action=deactivated&object_type=plugin&object_name=$plugin_name");
558
  }
559
 
560
  function simple_history_edit_comment($comment_id) {
569
  $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
570
  $str = urlencode($str);
571
 
572
+ simple_history_add("action=edited&object_type=comment&object_name=$str&object_id=$comment_id");
573
 
574
  }
575
 
585
  $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
586
  $str = urlencode($str);
587
 
588
+ simple_history_add("action=deleted&object_type=comment&object_name=$str&object_id=$comment_id");
589
 
590
  }
591
 
601
 
602
  $action = "";
603
  if ("approve" == $new_status) {
604
+ $action = 'approved';
605
  } elseif ("hold" == $new_status) {
606
+ $action = 'unapproved';
607
  } elseif ("spam" == $new_status) {
608
+ $action = 'marked as spam';
609
  } elseif ("trash" == $new_status) {
610
+ $action = 'trashed';
611
  } elseif ("0" == $new_status) {
612
+ $action = 'untrashed';
613
  }
614
 
615
  $action = urlencode($action);
617
  $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
618
  $str = urlencode($str);
619
 
620
+ simple_history_add("action=$action&object_type=comment&object_name=$str&object_id=$comment_id");
621
 
622
  }
623
 
667
  }
668
  */
669
 
 
670
  function simple_history_add_attachment($attachment_id) {
671
  $post = get_post($attachment_id);
672
  $post_title = urlencode(get_the_title($post->ID));
673
+ simple_history_add("action=added&object_type=attachment&object_id=$attachment_id&object_name=$post_title");
674
 
675
  }
676
  function simple_history_edit_attachment($attachment_id) {
677
  // is this only being called if the title of the attachment is changed?!
678
  $post = get_post($attachment_id);
679
  $post_title = urlencode(get_the_title($post->ID));
680
+ simple_history_add("action=updated&object_type=attachment&object_id=$attachment_id&object_name=$post_title");
681
  }
682
  function simple_history_delete_attachment($attachment_id) {
683
  $post = get_post($attachment_id);
684
  $post_title = urlencode(get_the_title($post->ID));
685
+ simple_history_add("action=deleted&object_type=attachment&object_id=$attachment_id&object_name=$post_title");
686
  }
687
 
688
  // user is updated
689
  function simple_history_profile_update($user_id) {
690
  $user = get_user_by("id", $user_id);
691
  $user_nicename = urlencode($user->user_nicename);
692
+ simple_history_add("action=updated&object_type=user&object_id=$user_id&object_name=$user_nicename");
693
  }
694
 
695
  // user is created
703
  function simple_history_delete_user($user_id) {
704
  $user = get_user_by("id", $user_id);
705
  $user_nicename = urlencode($user->user_nicename);
706
+ simple_history_add("action=deleted&object_type=user&object_id=$user_id&object_name=$user_nicename");
707
  }
708
 
709
  // user logs in
717
  } else {
718
  $user_id = $current_user->ID;
719
  }
720
+ simple_history_add("action=logged in&object_type=user&object_id=".$user->ID."&user_id=$user_id&object_name=$user_nicename");
721
  }
722
  // user logs out
723
  function simple_history_wp_logout() {
724
  $current_user = wp_get_current_user();
725
  $current_user_id = $current_user->ID;
726
  $user_nicename = urlencode($current_user->user_nicename);
727
+ simple_history_add("action=logged out&object_type=user&object_id=$current_user_id&object_name=$user_nicename");
728
  }
729
 
730
  function simple_history_delete_post($post_id) {
732
  $post = get_post($post_id);
733
  if ($post->post_status != "auto-draft" && $post->post_status != "inherit") {
734
  $post_title = urlencode(get_the_title($post->ID));
735
+ simple_history_add("action=deleted&object_type=post&object_subtype=" . $post->post_type . "&object_id=$post_id&object_name=$post_title");
736
  }
737
  }
738
  }
769
  //bonny_d($post); // regular post object
770
  if ($old_status == "auto-draft" && ($new_status != "auto-draft" && $new_status != "inherit")) {
771
  // page created
772
+ $action = "created";
773
  } elseif ($new_status == "auto-draft" || ($old_status == "new" && $new_status == "inherit")) {
774
  // page...eh.. just leave it.
775
  return;
776
  } elseif ($new_status == "trash") {
777
+ $action = "deleted";
778
  } else {
779
  // page updated. i guess.
780
+ $action = "updated";
781
  }
782
  $object_type = "post";
783
  $object_subtype = $post->post_type;
784
 
785
  // Attempt to auto-translate post types*/
786
+ // no, no longer, do it at presentation instead
787
+ #$object_type = __( ucfirst ( $object_type ) );
788
+ #$object_subtype = __( ucfirst ( $object_subtype ) );
789
 
790
  if ($object_subtype == "revision") {
791
  // don't log revisions
935
 
936
  #}
937
 
938
+ simple_history_add("action=activated&object_type=plugin&object_name=$plugin_name");
939
 
940
  // also generate a rss secret, if it does not exist
941
  if (!get_option("simple_history_rss_secret")) {
959
  }
960
  $sql = "SELECT DISTINCT object_type, object_subtype FROM {$tableprefix}simple_history ORDER BY object_type, object_subtype";
961
  $arr_types = $wpdb->get_results($sql);
962
+
963
  $str_types = "";
964
  $str_types .= "<ul class='simple-history-filter simple-history-filter-type'>";
965
  $css = "";
967
  $css = "class='selected'";
968
  }
969
 
 
970
  $link = esc_html(add_query_arg("simple_history_type_to_show", ""));
971
  $str_types_desc = __("All types", 'simple-history');
972
+ $str_types .= "<li $css><a data-simple-history-filter-type='' href='$link'>" . esc_html($str_types_desc) . "</a> | </li>";
973
  foreach ($arr_types as $one_type) {
974
  $css = "";
975
  if ($one_type->object_subtype && $simple_history_type_to_show == ($one_type->object_type."/".$one_type->object_subtype)) {
977
  } elseif (!$one_type->object_subtype && $simple_history_type_to_show == $one_type->object_type) {
978
  $css = "class='selected'";
979
  }
980
+ $str_types .= sprintf('<li %1$s data-simple-history-filter-type="%2$s" data-simple-history-filter-subtype="%3$s" >', $css, $one_type->object_type, $one_type->object_subtype);
981
  $arg = "";
982
  if ($one_type->object_subtype) {
983
  $arg = $one_type->object_type."/".$one_type->object_subtype;
986
  }
987
  $link = esc_html(add_query_arg("simple_history_type_to_show", $arg));
988
  $str_types .= "<a href='$link'>";
989
+
990
+ // Some built in types we translate with built in translation, the others we use simple history for
991
+ $arr_built_in_types_with_translation = array("page", "post");
992
+ $object_type_translated = "";
993
+ $object_subtype_translated = "";
994
+ if ( in_array($one_type->object_type, $arr_built_in_types_with_translation) ) {
995
+ $object_type_translated = esc_html__(ucfirst($one_type->object_type));
996
+ } else {
997
+ $object_type_translated = esc_html__(ucfirst($one_type->object_type), "simple-history");
998
+ }
999
+ if (in_array($one_type->object_subtype, $arr_built_in_types_with_translation) ) {
1000
+ $object_subtype_translated = esc_html__(ucfirst($one_type->object_subtype));
1001
+ } else {
1002
+ $object_subtype_translated = esc_html__(ucfirst($one_type->object_subtype), "simple-history");
1003
  }
1004
+
1005
+ $str_types .= $object_type_translated;
1006
+ if ($object_subtype_translated && $object_subtype_translated != $object_type_translated) {
1007
+ $str_types .= "/". $object_subtype_translated;
1008
+ }
1009
+
1010
  $str_types .= "</a> | ";
1011
  $str_types .= "</li>";
1012
+
1013
+ // debug
1014
+ #$str_types .= " type: " . $one_type->object_type;
1015
+ #$str_types .= " type: " . ucfirst($one_type->object_type);
1016
+ #$str_types .= " subtype: " . $one_type->object_subtype. " ";
1017
+
1018
  }
1019
  $str_types .= "</ul>";
1020
  $str_types = str_replace("| </li></ul>", "</li></ul>", $str_types);
1044
  }
1045
  }
1046
 
1047
+ if (isset($arr_users) && $arr_users) {
1048
  if (isset($_GET["simple_history_user_to_show"])) {
1049
  $simple_history_user_to_show = $_GET["simple_history_user_to_show"];
1050
  } else {
1109
  </div>
1110
  </div>
1111
  ',
1112
+ sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items)),
1113
  $page_current,
1114
  $pages_count,
1115
  ($pages_count == 1) ? "disabled" : "",
1157
  } else {
1158
  $filter_type = $simple_history_type_to_show;
1159
  }
1160
+ if ($filter_type) {
1161
+ $where .= " AND lower(object_type) = '" . $wpdb->escape(strtolower($filter_type)) . "' ";
1162
+ }
1163
+ if ($filter_subtype) {
1164
+ $where .= " AND lower(object_subtype) = '" . $wpdb->escape(strtolower($filter_subtype)) . "' ";
1165
+ }
1166
  }
1167
  if ($simple_history_user_to_show) {
1168
 
1177
  $tableprefix = $wpdb->prefix;
1178
 
1179
  $sql = "SELECT * FROM {$tableprefix}simple_history $where ORDER BY date DESC, id DESC ";
1180
+ #sf_d($args);
1181
+ #echo "\n$sql\n";
1182
  $rows = $wpdb->get_results($sql);
1183
 
1184
  $loopNum = 0;
1190
  if ($rows) {
1191
  $prev_row = null;
1192
  foreach ($rows as $one_row) {
1193
+
1194
+ // check if this event is same as prev event
1195
+ // todo: how to do with object_name vs object id?
1196
+ // if object_id is same as prev, but object_name differ, then it's the same object but with a new name
1197
+ // we store it as same and use occations to output the name etc of
1198
  if (
1199
  $prev_row
1200
  && $one_row->action == $prev_row->action
1202
  && $one_row->object_type == $prev_row->object_type
1203
  && $one_row->object_subtype == $prev_row->object_subtype
1204
  && $one_row->user_id == $prev_row->user_id
1205
+ && (
1206
+ (!empty($one_row->object_id) && !empty($prev_row->object_id))
1207
+ && ($one_row->object_id == $prev_row->object_id)
1208
+ || ($one_row->object_name == $prev_row->object_name)
1209
+ )
1210
  ) {
1211
+
1212
  // this event is like the previous event, but only with a different date
1213
  // so add it to the last element in arr_events
1214
  $arr_events[$prev_row->id]->occasions[] = $one_row;
1215
+
1216
  } else {
1217
 
1218
  #echo "<br>real_loop_num: $real_loop_num";
1267
  // */
1268
  //
1269
  //$offset = $args["num_added"]; // old way when we appended
1270
+ /*
1271
+ <pre class='sf_box_debug'>Array
1272
+ (
1273
+ [page] =&gt; 1
1274
+ [items] =&gt; 5
1275
+ [filter_type] =&gt; /
1276
+ [filter_user] =&gt;
1277
+ [is_ajax] =&gt; 1
1278
+ [search] =&gt;
1279
+ [num_added] =&gt; 5
1280
+ )
1281
+ */
1282
+
1283
  if (is_numeric($args["items"]) && $args["items"] > 0) {
1284
  #sf_d($args);
1285
  $offset = ($args["page"] * $args["items"]);
1286
  #echo "offset: $offset";
1287
  $arr_events = array_splice($arr_events, $offset, $args["items"]);
1288
  }
1289
+
1290
  return $arr_events;
1291
 
1292
  }
1296
  function simple_history_print_history($args = null) {
1297
 
1298
  $arr_events = simple_history_get_items_array($args);
1299
+ #sf_d($args);sf_d($arr_events);
1300
  $defaults = array(
1301
  "page" => 0,
1302
  "items" => 5,
1381
  $who .= "&lt;" . __("Unknown or deleted user", 'simple-history') ."&gt;";
1382
  }
1383
  $who .= "</span>";
 
 
 
 
 
 
 
 
 
 
 
1384
 
1385
  // what and object
1386
  if ("post" == $object_type_lcase) {
1387
 
1388
  $post_out = "";
1389
+ $post_out .= esc_html__(ucfirst($object_subtype));
1390
  $post = get_post($object_id);
1391
 
1392
  if (null == $post) {
1406
  $post_out .= "<span class='simple-history-title'>{$title}</span>";
1407
  $post_out .= "</a>";
1408
  }
1409
+
1410
+ $post_out .= " " . esc_html__($action, "simple-history");
 
 
 
 
 
 
 
 
 
1411
 
1412
  $post_out = ucfirst($post_out);
1413
  $output .= $post_out;
1441
  }
1442
  }
1443
 
1444
+ $attachment_out .= " " . esc_html__($action, "simple-history") . " ";
1445
 
1446
  $attachment_out = ucfirst($attachment_out);
1447
  $output .= $attachment_out;
1448
 
1449
  } elseif ("user" == $object_type_lcase) {
1450
+
1451
  $user_out = "";
1452
  $user_out .= __("user", 'simple-history');
1453
  $user = get_user_by("id", $object_id);
1482
  $user_out .= "<span class='simple-history-attachment-thumbnail' href='$user_link'>$user_avatar</span>";
1483
  }
1484
 
1485
+ $user_out .= " " . esc_html__($action, "simple-history");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1486
 
1487
  $user_out = ucfirst($user_out);
1488
  $output .= $user_out;
1490
  } elseif ("comment" == $object_type_lcase) {
1491
 
1492
  $comment_link = get_edit_comment_link($object_id);
1493
+ $output .= ucwords(esc_html__(ucfirst($object_type), "simple-history")) . " " . esc_html($object_subtype) . " <a href='$comment_link'><span class='simple-history-title'>" . esc_html($object_name) . "\"</span></a> " . esc_html__($action, "simple-history");
1494
 
1495
  } else {
1496
 
1513
  default:
1514
  $unknown_action = $unknown_action; // dah!
1515
  }
1516
+ $output .= ucwords(esc_html__($object_type, "simple-history")) . " " . ucwords(esc_html__($object_subtype, "simple-history")) . " <span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span> " . esc_html($unknown_action);
1517
 
1518
  }
1519
  $output .= "</div>";
1576
 
1577
  $loading = __("Loading...", 'simple-history');
1578
  $loading = "<img src='".site_url("wp-admin/images/loading.gif")."' width=16 height=16>" . $loading;
1579
+ $no_found = __("No matching items found.", 'simple-history');
1580
  $view_rss = __("RSS feed", 'simple-history');
1581
  $view_rss_link = simple_history_get_rss_address();
1582
  $str_show = __("Show", 'simple-history');
1623
  $option_page_name = "";
1624
  if (isset($arr_options_names[$option_page])) {
1625
  $option_page_name = $arr_options_names[$option_page];
1626
+ simple_history_add("action=modified&object_type=settings page&object_id=$option_page&object_name=$option_page_name");
1627
  }
1628
 
1629
  return $capability;
1635
  if ("update-permalink" == $action) {
1636
  $option_page_name = __("Permalink Settings");
1637
  $option_page = "permalink";
1638
+ simple_history_add("action=modified&object_type=settings page&object_id=$option_page&object_name=$option_page_name");
1639
  }
1640
 
1641
  }
languages/simple-history.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-history\n"
7
- "POT-Creation-Date: 2012-09-23 11:21:09+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,89 +12,139 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: index.php:67 index.php:208 index.php:827
16
- msgid "History"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  msgstr ""
18
 
19
- #: index.php:120 index.php:630 index.php:642 index.php:730
20
  msgid "updated"
21
  msgstr ""
22
 
23
- #: index.php:120
24
- msgid "WordPress Core"
25
  msgstr ""
26
 
27
- #: index.php:120
28
- msgid "WordPress %1$s"
29
  msgstr ""
30
 
31
- #: index.php:133 index.php:222
32
- msgid "Donate"
33
  msgstr ""
34
 
35
- #: index.php:178
36
- msgid "upgraded it's database"
37
  msgstr ""
38
 
39
- #: index.php:178 index.php:494 index.php:498 index.php:887
40
- msgid "Plugin"
41
  msgstr ""
42
 
43
- #: index.php:194 index.php:215
 
 
 
 
 
 
 
 
44
  msgid "Simple History Settings"
45
  msgstr ""
46
 
47
- #: index.php:220
48
  msgid "Show Simple History"
49
  msgstr ""
50
 
51
- #: index.php:221 index.php:1512
52
  msgid "RSS feed"
53
  msgstr ""
54
 
55
- #: index.php:262 index.php:305
 
 
 
 
56
  msgid "History for %s"
57
  msgstr ""
58
 
59
- #: index.php:263 index.php:306
60
  msgid "WordPress History for %s"
61
  msgstr ""
62
 
63
- #: index.php:275
64
  msgid "By %s"
65
  msgstr ""
66
 
67
- #: index.php:279
68
  msgid "%d occasions"
69
  msgstr ""
70
 
71
- #: index.php:310
72
  msgid "Wrong RSS secret"
73
  msgstr ""
74
 
75
- #: index.php:311
76
  msgid ""
77
  "Your RSS secret for Simple History RSS feed is wrong. Please see WordPress "
78
  "settings for current link to the RSS feed."
79
  msgstr ""
80
 
81
- #: index.php:328 index.php:921
82
- msgid "All types"
83
- msgstr ""
84
-
85
- #: index.php:331 index.php:987
86
  msgid "By all users"
87
  msgstr ""
88
 
89
- #: index.php:417
 
 
 
 
 
 
90
  msgid "on the dashboard"
91
  msgstr ""
92
 
93
- #: index.php:422
94
  msgid "as a page under the dashboard menu"
95
  msgstr ""
96
 
97
- #: index.php:431
 
 
 
 
 
 
 
 
 
 
 
 
98
  msgid ""
99
  "\n"
100
  "\t\t\tPlease\n"
@@ -106,233 +156,160 @@ msgid ""
106
  "\t\t\t"
107
  msgstr ""
108
 
109
- #: index.php:473
110
  msgid "Created new secret RSS adress"
111
  msgstr ""
112
 
113
- #: index.php:484
114
  msgid ""
115
  "This is a secret RSS feed for Simple History. Only share the link with "
116
  "people you trust"
117
  msgstr ""
118
 
119
- #: index.php:487
120
  msgid ""
121
- "You can <a href='%s#simple-history-settings-page'>generate a new address</a> "
122
- "for the RSS feed. This is useful if you think that the address has fallen "
123
- "into the wrong hands."
124
- msgstr ""
125
-
126
- #: index.php:494 index.php:887 index.php:1434
127
- msgid "activated"
128
- msgstr ""
129
-
130
- #: index.php:498 index.php:1437
131
- msgid "deactivated"
132
  msgstr ""
133
 
134
- #: index.php:510 index.php:526 index.php:558
135
  msgid "From %1$s on %2$s"
136
  msgstr ""
137
 
138
- #: index.php:513
139
- msgid "edited"
140
- msgstr ""
141
-
142
- #: index.php:513 index.php:529 index.php:561
143
- msgid "Comment"
144
- msgstr ""
145
-
146
- #: index.php:529 index.php:635 index.php:656 index.php:685 index.php:727
147
- msgid "deleted"
148
- msgstr ""
149
-
150
- #: index.php:545
151
- msgid "approved"
152
- msgstr ""
153
-
154
- #: index.php:547
155
- msgid "unapproved"
156
- msgstr ""
157
-
158
- #: index.php:549
159
- msgid "marked as spam"
160
- msgstr ""
161
-
162
- #: index.php:551
163
- msgid "trashed"
164
- msgstr ""
165
-
166
- #: index.php:553
167
- msgid "untrashed"
168
- msgstr ""
169
-
170
- #: index.php:623
171
- msgid "added"
172
- msgstr ""
173
-
174
- #: index.php:623 index.php:630 index.php:635
175
- msgid "Attachment"
176
- msgstr ""
177
-
178
- #: index.php:642 index.php:656 index.php:670 index.php:677
179
- msgid "User"
180
- msgstr ""
181
-
182
- #: index.php:670
183
- msgid "logged in"
184
- msgstr ""
185
-
186
- #: index.php:677
187
- msgid "logged out"
188
- msgstr ""
189
-
190
- #: index.php:685
191
- msgid "Post"
192
- msgstr ""
193
-
194
- #: index.php:722
195
- msgid "created"
196
  msgstr ""
197
 
198
- #: index.php:1006
199
  msgid "Search"
200
  msgstr ""
201
 
202
- #: index.php:1043
203
  msgid "Go to the first page"
204
  msgstr ""
205
 
206
- #: index.php:1044
207
  msgid "Go to the previous page"
208
  msgstr ""
209
 
210
- #: index.php:1045
211
  msgid "Current page"
212
  msgstr ""
213
 
214
- #: index.php:1046
215
  msgid "of"
216
  msgstr ""
217
 
218
- #: index.php:1047
219
  msgid "Go to the next page"
220
  msgstr ""
221
 
222
- #: index.php:1048
223
  msgid "Go to the last page"
224
  msgstr ""
225
 
226
- #: index.php:1280
227
  msgid "Unknown or deleted user"
228
  msgstr ""
229
 
230
- #: index.php:1338
231
- msgid "attachment"
232
  msgstr ""
233
 
234
- #: index.php:1370
235
- msgid "user"
236
  msgstr ""
237
 
238
- #: index.php:1440
239
  msgid "enabled"
240
  msgstr ""
241
 
242
- #: index.php:1443
243
  msgid "disabled"
244
  msgstr ""
245
 
246
- #: index.php:1458
247
  msgid "<span class=\"when\">%1$s ago</span> by %2$s"
248
  msgstr ""
249
 
250
- #: index.php:1460
251
  msgid "%s at %s"
252
  msgstr ""
253
 
254
- #: index.php:1467
255
  msgid "+ 1 occasion"
256
  msgstr ""
257
 
258
- #: index.php:1470
259
  msgid "+ %d occasions"
260
  msgstr ""
261
 
262
- #: index.php:1478
263
  msgid "%s ago (%s at %s)"
264
  msgstr ""
265
 
266
- #: index.php:1503
267
  msgid "Show 5 more"
268
  msgstr ""
269
 
270
- #: index.php:1504
271
  msgid "Show 15 more"
272
  msgstr ""
273
 
274
- #: index.php:1505
275
  msgid "Show 50 more"
276
  msgstr ""
277
 
278
- #: index.php:1506
279
  msgid "Show 100 more"
280
  msgstr ""
281
 
282
- #: index.php:1509
283
  msgid "Loading..."
284
  msgstr ""
285
 
286
- #: index.php:1511
287
- msgid "No matchin items found."
288
  msgstr ""
289
 
290
- #: index.php:1514
291
  msgid "Show"
292
  msgstr ""
293
 
294
- #: index.php:1533
295
  msgid "No history items found."
296
  msgstr ""
297
 
298
- #: index.php:1534
299
  msgid ""
300
  "Please note that Simple History only records things that happen after this "
301
  "plugin have been installed."
302
  msgstr ""
303
 
304
- #: index.php:1546
305
  msgid "General Settings"
306
  msgstr ""
307
 
308
- #: index.php:1547
309
  msgid "Writing Settings"
310
  msgstr ""
311
 
312
- #: index.php:1548
313
  msgid "Reading Settings"
314
  msgstr ""
315
 
316
- #: index.php:1549
317
  msgid "Discussion Settings"
318
  msgstr ""
319
 
320
- #: index.php:1550
321
  msgid "Media Settings"
322
  msgstr ""
323
 
324
- #: index.php:1551
325
  msgid "Privacy Settings"
326
  msgstr ""
327
 
328
- #: index.php:1557 index.php:1569
329
- msgid "modified"
330
- msgstr ""
331
-
332
- #: index.php:1557 index.php:1569
333
- msgid "Settings page"
334
- msgstr ""
335
-
336
- #: index.php:1567
337
  msgid "Permalink Settings"
338
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-history\n"
7
+ "POT-Creation-Date: 2012-09-29 16:38:52+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: index.php:66
16
+ msgid "approved"
17
+ msgstr ""
18
+
19
+ #: index.php:67
20
+ msgid "unapproved"
21
+ msgstr ""
22
+
23
+ #: index.php:68
24
+ msgid "marked as spam"
25
+ msgstr ""
26
+
27
+ #: index.php:69
28
+ msgid "trashed"
29
+ msgstr ""
30
+
31
+ #: index.php:70
32
+ msgid "untrashed"
33
+ msgstr ""
34
+
35
+ #: index.php:71
36
+ msgid "created"
37
+ msgstr ""
38
+
39
+ #: index.php:72
40
+ msgid "deleted"
41
  msgstr ""
42
 
43
+ #: index.php:73
44
  msgid "updated"
45
  msgstr ""
46
 
47
+ #: index.php:74
48
+ msgid "nav_menu_item"
49
  msgstr ""
50
 
51
+ #: index.php:75 index.php:1419
52
+ msgid "attachment"
53
  msgstr ""
54
 
55
+ #: index.php:76 index.php:1452
56
+ msgid "user"
57
  msgstr ""
58
 
59
+ #: index.php:77
60
+ msgid "settings page"
61
  msgstr ""
62
 
63
+ #: index.php:90 index.php:238 index.php:878
64
+ msgid "History"
65
  msgstr ""
66
 
67
+ #: index.php:150
68
+ msgid "WordPress %1$s"
69
+ msgstr ""
70
+
71
+ #: index.php:163 index.php:253
72
+ msgid "Donate"
73
+ msgstr ""
74
+
75
+ #: index.php:224 index.php:245
76
  msgid "Simple History Settings"
77
  msgstr ""
78
 
79
+ #: index.php:250
80
  msgid "Show Simple History"
81
  msgstr ""
82
 
83
+ #: index.php:251 index.php:1580
84
  msgid "RSS feed"
85
  msgstr ""
86
 
87
+ #: index.php:252
88
+ msgid "Clear log"
89
+ msgstr ""
90
+
91
+ #: index.php:293 index.php:336
92
  msgid "History for %s"
93
  msgstr ""
94
 
95
+ #: index.php:294 index.php:337
96
  msgid "WordPress History for %s"
97
  msgstr ""
98
 
99
+ #: index.php:306
100
  msgid "By %s"
101
  msgstr ""
102
 
103
+ #: index.php:310
104
  msgid "%d occasions"
105
  msgstr ""
106
 
107
+ #: index.php:341
108
  msgid "Wrong RSS secret"
109
  msgstr ""
110
 
111
+ #: index.php:342
112
  msgid ""
113
  "Your RSS secret for Simple History RSS feed is wrong. Please see WordPress "
114
  "settings for current link to the RSS feed."
115
  msgstr ""
116
 
117
+ #: index.php:362 index.php:1060
 
 
 
 
118
  msgid "By all users"
119
  msgstr ""
120
 
121
+ #: index.php:411 index.php:1112
122
+ msgid "One item"
123
+ msgid_plural "%1$d items"
124
+ msgstr[0] ""
125
+ msgstr[1] ""
126
+
127
+ #: index.php:452
128
  msgid "on the dashboard"
129
  msgstr ""
130
 
131
+ #: index.php:457
132
  msgid "as a page under the dashboard menu"
133
  msgstr ""
134
 
135
+ #: index.php:472
136
+ msgid "Cleared database"
137
+ msgstr ""
138
+
139
+ #: index.php:480
140
+ msgid "Items in the database are automatically removed after 60 days."
141
+ msgstr ""
142
+
143
+ #: index.php:482
144
+ msgid "Clear it now."
145
+ msgstr ""
146
+
147
+ #: index.php:496
148
  msgid ""
149
  "\n"
150
  "\t\t\tPlease\n"
156
  "\t\t\t"
157
  msgstr ""
158
 
159
+ #: index.php:532
160
  msgid "Created new secret RSS adress"
161
  msgstr ""
162
 
163
+ #: index.php:543
164
  msgid ""
165
  "This is a secret RSS feed for Simple History. Only share the link with "
166
  "people you trust"
167
  msgstr ""
168
 
169
+ #: index.php:546
170
  msgid ""
171
+ "You can <a href='%s'>generate a new address</a> for the RSS feed. This is "
172
+ "useful if you think that the address has fallen into the wrong hands."
 
 
 
 
 
 
 
 
 
173
  msgstr ""
174
 
175
+ #: index.php:569 index.php:585 index.php:617
176
  msgid "From %1$s on %2$s"
177
  msgstr ""
178
 
179
+ #: index.php:971
180
+ msgid "All types"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  msgstr ""
182
 
183
+ #: index.php:1079
184
  msgid "Search"
185
  msgstr ""
186
 
187
+ #: index.php:1116
188
  msgid "Go to the first page"
189
  msgstr ""
190
 
191
+ #: index.php:1117
192
  msgid "Go to the previous page"
193
  msgstr ""
194
 
195
+ #: index.php:1118
196
  msgid "Current page"
197
  msgstr ""
198
 
199
+ #: index.php:1119
200
  msgid "of"
201
  msgstr ""
202
 
203
+ #: index.php:1120
204
  msgid "Go to the next page"
205
  msgstr ""
206
 
207
+ #: index.php:1121
208
  msgid "Go to the last page"
209
  msgstr ""
210
 
211
+ #: index.php:1381
212
  msgid "Unknown or deleted user"
213
  msgstr ""
214
 
215
+ #: index.php:1502
216
+ msgid "activated"
217
  msgstr ""
218
 
219
+ #: index.php:1505
220
+ msgid "deactivated"
221
  msgstr ""
222
 
223
+ #: index.php:1508
224
  msgid "enabled"
225
  msgstr ""
226
 
227
+ #: index.php:1511
228
  msgid "disabled"
229
  msgstr ""
230
 
231
+ #: index.php:1526
232
  msgid "<span class=\"when\">%1$s ago</span> by %2$s"
233
  msgstr ""
234
 
235
+ #: index.php:1528
236
  msgid "%s at %s"
237
  msgstr ""
238
 
239
+ #: index.php:1535
240
  msgid "+ 1 occasion"
241
  msgstr ""
242
 
243
+ #: index.php:1538
244
  msgid "+ %d occasions"
245
  msgstr ""
246
 
247
+ #: index.php:1546
248
  msgid "%s ago (%s at %s)"
249
  msgstr ""
250
 
251
+ #: index.php:1571
252
  msgid "Show 5 more"
253
  msgstr ""
254
 
255
+ #: index.php:1572
256
  msgid "Show 15 more"
257
  msgstr ""
258
 
259
+ #: index.php:1573
260
  msgid "Show 50 more"
261
  msgstr ""
262
 
263
+ #: index.php:1574
264
  msgid "Show 100 more"
265
  msgstr ""
266
 
267
+ #: index.php:1577
268
  msgid "Loading..."
269
  msgstr ""
270
 
271
+ #: index.php:1579
272
+ msgid "No matching items found."
273
  msgstr ""
274
 
275
+ #: index.php:1582
276
  msgid "Show"
277
  msgstr ""
278
 
279
+ #: index.php:1601
280
  msgid "No history items found."
281
  msgstr ""
282
 
283
+ #: index.php:1602
284
  msgid ""
285
  "Please note that Simple History only records things that happen after this "
286
  "plugin have been installed."
287
  msgstr ""
288
 
289
+ #: index.php:1615
290
  msgid "General Settings"
291
  msgstr ""
292
 
293
+ #: index.php:1616
294
  msgid "Writing Settings"
295
  msgstr ""
296
 
297
+ #: index.php:1617
298
  msgid "Reading Settings"
299
  msgstr ""
300
 
301
+ #: index.php:1618
302
  msgid "Discussion Settings"
303
  msgstr ""
304
 
305
+ #: index.php:1619
306
  msgid "Media Settings"
307
  msgstr ""
308
 
309
+ #: index.php:1620
310
  msgid "Privacy Settings"
311
  msgstr ""
312
 
313
+ #: index.php:1636
 
 
 
 
 
 
 
 
314
  msgid "Permalink Settings"
315
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
5
  Requires at least: 3.0
6
  Tested up to: 3.4.2
7
- Stable tag: 1.0.3
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -92,6 +92,13 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
92
 
93
  == Changelog ==
94
 
 
 
 
 
 
 
 
95
  = 1.0.3 =
96
  - Updated German translation
97
  - Some translation fixes
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
5
  Requires at least: 3.0
6
  Tested up to: 3.4.2
7
+ Stable tag: 1.0.4
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
92
 
93
  == Changelog ==
94
 
95
+ = 1.0.4 =
96
+ - You may want to clear the history database after this update because the items in the log will have mixed translate/untranslated status and it may look/work a bit strange.
97
+ - Added: Option to clear the database of log items.
98
+ - Changed: No longer stored translated history items in the log. This makes the history work even if/when you switch langauge of WordPress.
99
+ - Fixed: if for example a post was editied several times and during these edits it changed name, it would end up at different occasions. Now it's correctly stored as one event with several occasions.
100
+ - Some more items are translateable
101
+
102
  = 1.0.3 =
103
  - Updated German translation
104
  - Some translation fixes
scripts.js CHANGED
@@ -37,7 +37,7 @@ jQuery(".simple-history-filter a, .simple-history-filter input[type='button'], .
37
  $prev_page = $tablenav.find(".prev-page"),
38
  $first_page = $tablenav.find(".first-page"),
39
  $last_page = $tablenav.find(".last-page"),
40
- $displaying_num = $tablenav.find(".displaying-num span");
41
 
42
  e.preventDefault();
43
 
@@ -86,9 +86,13 @@ jQuery(".simple-history-filter a, .simple-history-filter input[type='button'], .
86
  // update current page
87
  $current_page.val(simple_history_current_page+1);
88
 
 
 
 
89
  var data = {
90
  "action": "simple_history_ajax",
91
- "type": jQuery("ul.simple-history-filter-type li.selected a").text(),
 
92
  "user": jQuery("ul.simple-history-filter-user li.selected a").text(),
93
  "search": search,
94
  "num_added": num_added,
@@ -107,9 +111,9 @@ jQuery(".simple-history-filter a, .simple-history-filter input[type='button'], .
107
  $tablenav.hide();
108
 
109
  } else {
110
-
111
  // update number of existing items and total pages
112
- $displaying_num.html(data.filtered_items_total_count);
113
  $total_pages.text(data.filtered_items_total_pages);
114
 
115
  $tablenav.show();
37
  $prev_page = $tablenav.find(".prev-page"),
38
  $first_page = $tablenav.find(".first-page"),
39
  $last_page = $tablenav.find(".last-page"),
40
+ $displaying_num = $tablenav.find(".displaying-num");
41
 
42
  e.preventDefault();
43
 
86
  // update current page
87
  $current_page.val(simple_history_current_page+1);
88
 
89
+ var type = jQuery("ul.simple-history-filter-type li.selected").data("simple-history-filter-type");
90
+ var subtype = jQuery("ul.simple-history-filter-type li.selected").data("simple-history-filter-subtype");
91
+
92
  var data = {
93
  "action": "simple_history_ajax",
94
+ "type": type,
95
+ "subtype" : subtype,
96
  "user": jQuery("ul.simple-history-filter-user li.selected a").text(),
97
  "search": search,
98
  "num_added": num_added,
111
  $tablenav.hide();
112
 
113
  } else {
114
+
115
  // update number of existing items and total pages
116
+ $displaying_num.html(data.filtered_items_total_count_string);
117
  $total_pages.text(data.filtered_items_total_pages);
118
 
119
  $tablenav.show();