Simple History - Version 0.8

Version Description

  • Added: now also logs when a user saves any of the built in settings page (general, writing, reading, discussion, media, privacy, and permalinks. What more things do you want to see in the history? Let me know in the support forum.
  • Added: gravatar of user performing action is always shown
  • Fixed: history items that was posts/pages/custom post types now get linked again
  • Fixed: search is triggered on enter (no need to press search button) + search searches object type and object subtype (before it just searched object name)
  • Fixed: showing/loading of new history items was kinda broken. Hopefully fixed and working better than ever now.
  • Plus: even more WordPress-ish looking!
  • Also added donate-links. Tried to keep them discrete. Anyway: please donate if you use this plugin regularly.
Download this release

Release Info

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

Code changes from version 0.7.2 to 0.8

Files changed (5) hide show
  1. index.php +201 -84
  2. readme.txt +11 -2
  3. scripts.js +41 -18
  4. styles.css +74 -33
  5. uninstall.php +9 -0
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: 0.7.2
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", "0.7.2");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
33
 
@@ -36,6 +36,8 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
36
  */
37
  class simple_history {
38
 
 
 
39
  function __construct() {
40
 
41
  add_action( 'admin_init', array($this, 'admin_init') ); // start listening to changes
@@ -44,11 +46,12 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
44
  add_action( 'wp_dashboard_setup', array($this, 'wp_dashboard_setup') );
45
  add_action( 'wp_ajax_simple_history_ajax', array($this, 'ajax') );
46
  add_filter( 'plugin_action_links_simple-history/index.php', array($this, "plugin_action_links"), 10, 4);
 
 
47
 
48
  }
49
 
50
  function plugin_action_links($actions, $b, $c, $d) {
51
- // http://playground.ep/wordpress/wp-admin/options-general.php?page=simple_history_settings_menu_slug
52
  $settings_page_url = menu_page_url("simple_history_settings_menu_slug", 0);
53
  $actions[] = "<a href='$settings_page_url'>Settings</a>";
54
  return $actions;
@@ -81,13 +84,57 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
81
  add_action("edit_comment", "simple_history_edit_comment");
82
  add_action("delete_comment", "simple_history_delete_comment");
83
  add_action("wp_set_comment_status", "simple_history_set_comment_status", 10, 2);
84
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  $this->check_upgrade_stuff();
 
86
 
87
  wp_enqueue_style( "simple_history_styles", SIMPLE_HISTORY_URL . "styles.css", false, SIMPLE_HISTORY_VERSION );
88
  wp_enqueue_script("simple_history", SIMPLE_HISTORY_URL . "scripts.js", array("jquery"), SIMPLE_HISTORY_VERSION);
89
 
90
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  // check some things regarding update
93
  function check_upgrade_stuff() {
@@ -170,6 +217,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
170
 
171
  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");
172
  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");
 
173
 
174
  register_setting("simple_history_settings_group", "simple_history_show_on_dashboard");
175
  register_setting("simple_history_settings_group", "simple_history_show_as_page");
@@ -280,12 +328,17 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
280
  $user = $_POST["user"];
281
  if ($user == __( "By all users", 'simple-history' )) { $user = ""; }
282
 
 
283
  $page = 0;
284
  if (isset($_POST["page"])) {
285
  $page = (int) $_POST["page"];
286
  }
287
 
 
288
  $items = (int) (isset($_POST["items"])) ? $_POST["items"] : 5;
 
 
 
289
 
290
  $search = (isset($_POST["search"])) ? $_POST["search"] : "";
291
 
@@ -295,6 +348,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
295
  "filter_user" => $user,
296
  "page" => $page,
297
  "items" => $items,
 
298
  "search" => $search
299
  );
300
  simple_history_print_history($args);
@@ -337,20 +391,34 @@ function simple_history_settings_field() {
337
  $show_as_page = simple_history_setting_show_as_page();
338
  ?>
339
 
340
- <input <?php echo $show_on_dashboard ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_on_dashboard" id="simple_history_show_on_dashboard" />
341
  <label for="simple_history_show_on_dashboard"><?php _e("on the dashboard", 'simple-history') ?></label>
342
 
343
  <br />
344
 
345
- <input <?php echo $show_as_page ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_as_page" id="simple_history_show_as_page" />
346
  <label for="simple_history_show_as_page"><?php _e("as a page under the dashboard menu", 'simple-history') ?></label>
347
 
348
  <?php
349
- #$version = get_option("simple_history_version", "0.3.8");
350
- #echo "<br><br>version: $version";
351
- #update_option("simple_history_rss_secret", $rss_secret);
352
  }
353
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  function simple_history_get_rss_address() {
355
  $rss_secret = get_option("simple_history_rss_secret");
356
  $rss_address = add_query_arg(array("simple_history_get_rss" => "1", "rss_secret" => $rss_secret), get_bloginfo("url") . "/");
@@ -473,14 +541,6 @@ function simple_history_set_comment_status($comment_id, $new_status) {
473
  }
474
 
475
  function simple_history_update_option($option, $oldval, $newval) {
476
- /*
477
- echo "<br><br>simple_history_update_option()";
478
- echo "<br>Updated option $option";
479
- echo "<br>oldval: ";
480
- bonny_d($oldval);
481
- echo "<br>newval:";
482
- bonny_d($newval);
483
- */
484
 
485
  if ($option == "active_plugins") {
486
 
@@ -585,14 +645,14 @@ function simple_history_wp_login($user) {
585
  } else {
586
  $user_id = $current_user->ID;
587
  }
588
- 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");
589
  }
590
  // user logs out
591
  function simple_history_wp_logout() {
592
  $current_user = wp_get_current_user();
593
  $current_user_id = $current_user->ID;
594
  $user_nicename = urlencode($current_user->user_nicename);
595
- simple_history_add("action=" . __( 'logged_out', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') ."&object_id=$current_user_id&object_name=$user_nicename");
596
  }
597
 
598
  function simple_history_delete_post($post_id) {
@@ -735,8 +795,8 @@ function simple_history_management_page() {
735
  <div class="wrap">
736
  <h2><?php echo __("History", 'simple-history') ?></h2>
737
  <?php
738
- simple_history_print_nav();
739
- simple_history_print_history();
740
  ?>
741
  </div>
742
 
@@ -914,7 +974,7 @@ function simple_history_print_nav() {
914
  $str_search = __("Search", 'simple-history');
915
  $search = "<p class='simple-history-filter simple-history-filter-search'>
916
  <input type='text' />
917
- <input type='button' value='$str_search' />
918
  </p>";
919
  echo $search;
920
 
@@ -933,13 +993,14 @@ function simple_history_get_items_array($args) {
933
  "filter_type" => "",
934
  "filter_user" => "",
935
  "is_ajax" => false,
936
- "search" => ""
 
937
  );
938
  $args = wp_parse_args( $args, $defaults );
939
- // echo "<pre>";print_r($args);echo "</pre>";
940
  $simple_history_type_to_show = $args["filter_type"];
941
  $simple_history_user_to_show = $args["filter_user"];
942
-
943
  $where = " WHERE 1=1 ";
944
  if ($simple_history_type_to_show) {
945
  $filter_type = "";
@@ -952,10 +1013,11 @@ function simple_history_get_items_array($args) {
952
  } else {
953
  $filter_type = $simple_history_type_to_show;
954
  }
955
- $where .= " AND object_type = '$filter_type' ";
956
- $where .= " AND object_subtype = '$filter_subtype' ";
957
  }
958
  if ($simple_history_user_to_show) {
 
959
  $userinfo = get_user_by("slug", $simple_history_user_to_show);
960
 
961
  if (isset($userinfo->ID)) {
@@ -965,11 +1027,9 @@ function simple_history_get_items_array($args) {
965
  }
966
 
967
  $tableprefix = $wpdb->prefix;
968
- $limit_page = $args["page"] * $args["items"];
969
- $limit_items = $args["items"];
970
- $sql_limit = " LIMIT $limit_page, $args[items]";
971
 
972
- $sql = "SELECT * FROM {$tableprefix}simple_history $where ORDER BY date DESC ";
 
973
  $rows = $wpdb->get_results($sql);
974
 
975
  $loopNum = 0;
@@ -1002,11 +1062,16 @@ function simple_history_get_items_array($args) {
1002
  // check if we have a search. of so, only add if there is a match
1003
  $do_add = FALSE;
1004
  if ($search) {
1005
- // echo "<br>object_name: $object_name";
1006
- $object_name_lower = strtolower($one_row->object_name);
1007
- // echo "<br>search: $search";
1008
- // echo "<br>object_name: $object_name";
1009
- if (strpos($object_name_lower, $search) !== FALSE) {
 
 
 
 
 
1010
  $do_add = TRUE;
1011
  }
1012
  } else {
@@ -1016,20 +1081,8 @@ function simple_history_get_items_array($args) {
1016
  if ($do_add) {
1017
  $real_loop_num++;
1018
  }
1019
-
1020
- if ($do_add && $args["page"] > 0 && ($args["page"] * $args["items"] > $real_loop_num)) {
1021
- #echo "<br>CONTINUE";
1022
- continue;
1023
- }
1024
-
1025
- // don't fetch more than we need
1026
- if ($do_add && $loopNum >= $args["items"]) {
1027
- #echo "<br>BREAK";
1028
- break;
1029
- }
1030
-
1031
- // new event, not as previous one
1032
-
1033
  if ($do_add) {
1034
  $arr_events[$one_row->id] = $one_row;
1035
  $arr_events[$one_row->id]->occasions = array();
@@ -1039,8 +1092,19 @@ function simple_history_get_items_array($args) {
1039
 
1040
  }
1041
  }
1042
- //echo "<pre>";print_r($arr_events);echo "</pre>";
1043
  }
 
 
 
 
 
 
 
 
 
 
 
1044
 
1045
  return $arr_events;
1046
 
@@ -1052,8 +1116,6 @@ function simple_history_print_history($args = null) {
1052
 
1053
  $arr_events = simple_history_get_items_array($args);
1054
 
1055
- // echo "<pre>";print_r($arr_events);echo "</pre>";
1056
-
1057
  $defaults = array(
1058
  "page" => 0,
1059
  "items" => 5,
@@ -1067,16 +1129,17 @@ function simple_history_print_history($args = null) {
1067
  if ($arr_events) {
1068
  if (!$args["is_ajax"]) {
1069
  // if not ajax, print the div
1070
- echo "<div id='simple-history-ol-wrapper'><ol class='simple-history'>";
1071
  }
1072
 
1073
  $loopNum = 0;
1074
  $real_loop_num = -1;
1075
  foreach ($arr_events as $one_row) {
1076
-
1077
  $real_loop_num++;
1078
 
1079
  $object_type = $one_row->object_type;
 
1080
  $object_subtype = $one_row->object_subtype;
1081
  $object_id = $one_row->object_id;
1082
  $object_name = $one_row->object_name;
@@ -1086,13 +1149,13 @@ function simple_history_print_history($args = null) {
1086
  $num_occasions = sizeof($occasions);
1087
 
1088
  $css = "";
1089
- if ("attachment" == $object_type) {
1090
  if (wp_get_attachment_image_src($object_id, array(50,50), true)) {
1091
  // yep, it's an attachment and it has an icon/thumbnail
1092
  $css .= ' simple-history-has-attachment-thumnbail ';
1093
  }
1094
  }
1095
- if ("user" == $object_type) {
1096
  $css .= ' simple-history-has-attachment-thumnbail ';
1097
  }
1098
 
@@ -1106,16 +1169,23 @@ function simple_history_print_history($args = null) {
1106
 
1107
  // who performed the action
1108
  $who = "";
1109
- $user = get_user_by("id", $user_id);
1110
 
1111
- $who .= "<span class='who'>";
1112
  if ($user) {
1113
- // http://localhost/wordpress3/wp-admin/user-edit.php?user_id=6
1114
  $user_link = "user-edit.php?user_id={$user->ID}";
1115
- $who .= "<a href='$user_link'>";
1116
- $who .= $user->user_nicename;
1117
- $who .= "</a>";
1118
- if (isset($user->first_name) && isset($user->last_name)) {
 
 
 
 
 
 
 
 
1119
  if ($user->first_name || $user->last_name) {
1120
  $who .= " (";
1121
  if ($user->first_name && $user->last_name) {
@@ -1130,13 +1200,25 @@ function simple_history_print_history($args = null) {
1130
  $who .= "&lt;" . __("Unknown or deleted user", 'simple-history') ."&gt;";
1131
  }
1132
  $who .= "</span>";
1133
-
 
 
 
 
 
 
 
 
 
 
 
1134
  // what and object
1135
- if ("post" == $object_type) {
1136
 
1137
  $post_out = "";
1138
  $post_out .= $object_subtype;
1139
  $post = get_post($object_id);
 
1140
  if (null == $post) {
1141
  // post does not exist, probably deleted
1142
  // check if object_name exists
@@ -1170,7 +1252,7 @@ function simple_history_print_history($args = null) {
1170
  echo $post_out;
1171
 
1172
 
1173
- } elseif ("attachment" == $object_type) {
1174
 
1175
  $attachment_out = "";
1176
  $attachment_out .= __("attachment", 'simple-history') . " ";
@@ -1203,7 +1285,7 @@ function simple_history_print_history($args = null) {
1203
  $attachment_out = ucfirst($attachment_out);
1204
  echo $attachment_out;
1205
 
1206
- } elseif ("user" == $object_type) {
1207
  $user_out = "";
1208
  $user_out .= __("user", 'simple-history');
1209
  $user = get_user_by("id", $object_id);
@@ -1257,7 +1339,7 @@ function simple_history_print_history($args = null) {
1257
  $user_out = ucfirst($user_out);
1258
  echo $user_out;
1259
 
1260
- } elseif ("comment" == $object_type) {
1261
 
1262
  $comment_link = get_edit_comment_link($object_id);
1263
  echo 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);
@@ -1292,10 +1374,9 @@ function simple_history_print_history($args = null) {
1292
  // when
1293
  $date_i18n_date = date_i18n(get_option('date_format'), strtotime($one_row->date), $gmt=false);
1294
  $date_i18n_time = date_i18n(get_option('time_format'), strtotime($one_row->date), $gmt=false);
1295
- echo sprintf(__("By %s", 'simple-history'), $who) . " &rarr; ";
1296
  $now = strtotime(current_time("mysql"));
1297
- $diff_str = sprintf( __('%s ago'), human_time_diff(strtotime($one_row->date), $now) );
1298
- echo "<span class='when'>".$diff_str."</span>";
1299
  echo "<span class='when_detail'>".sprintf(__('%s at %s', 'simple-history'), $date_i18n_date, $date_i18n_time)."</span>";
1300
  echo "</div>";
1301
 
@@ -1326,6 +1407,8 @@ function simple_history_print_history($args = null) {
1326
  echo "</li>";
1327
 
1328
  $loopNum++;
 
 
1329
  }
1330
 
1331
  // if $loopNum == 0 no items where found for this page
@@ -1334,30 +1417,33 @@ function simple_history_print_history($args = null) {
1334
  }
1335
 
1336
  if (!$args["is_ajax"]) {
 
1337
  // if not ajax, print the divs and stuff we need
1338
- //$show_more = sprintf(__("Show %d more", 'simple-history'), $args["items"]);
1339
  $show_more = "<select>";
1340
- $show_more .= sprintf("<option value='5'>%s</option>", __("Show 5 more", 'simple-history') );
1341
- $show_more .= sprintf("<option value='15'>%s</option>", __("Show 15 more", 'simple-history') );
1342
- $show_more .= sprintf("<option value='50'>%s</option>", __("Show 50 more", 'simple-history') );
1343
- $show_more .= sprintf("<option value='100'>%s</option>", __("Show 100 more", 'simple-history') );
1344
  $show_more .= "</select>";
1345
- //$show_more = sprintf(__("Show %s more", 'simple-history'), $show_more);
1346
  $loading = __("Loading...", 'simple-history');
 
1347
  $no_more_found = __("No more history items found.", 'simple-history');
1348
  $view_rss = __("RSS feed", 'simple-history');
1349
  $view_rss_link = simple_history_get_rss_address();
1350
  $str_show = __("Show", 'simple-history');
1351
  echo "</ol>
1352
  </div>
1353
- <p id='simple-history-load-more'>$show_more<input type='button' value='$str_show' /></p>
1354
- <p class='hidden' id='simple-history-load-more-loading'>$loading</p>
1355
- <p class='hidden' id='simple-history-no-more-items'>$no_more_found</p>
1356
- <p id='simple-history-rss-feed-dashboard'><a title='$view_rss' href='$view_rss_link'>$view_rss</a></p>
1357
- <p id='simple-history-rss-feed-page'><a title='$view_rss' href='$view_rss_link'><span></span>$view_rss</a></p>
1358
  ";
1359
  }
 
1360
  } else {
 
1361
  if ($args["is_ajax"]) {
1362
  echo "simpleHistoryNoMoreItems";
1363
  } else {
@@ -1366,7 +1452,38 @@ function simple_history_print_history($args = null) {
1366
  echo "<p>$no_found</p>";
1367
  echo "<p>$please_note</p>";
1368
  }
1369
-
1370
  }
1371
  }
1372
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 0.8
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", "0.8");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
33
 
36
  */
37
  class simple_history {
38
 
39
+ var $plugin_foldername_and_filename;
40
+
41
  function __construct() {
42
 
43
  add_action( 'admin_init', array($this, 'admin_init') ); // start listening to changes
46
  add_action( 'wp_dashboard_setup', array($this, 'wp_dashboard_setup') );
47
  add_action( 'wp_ajax_simple_history_ajax', array($this, 'ajax') );
48
  add_filter( 'plugin_action_links_simple-history/index.php', array($this, "plugin_action_links"), 10, 4);
49
+
50
+ $this->plugin_foldername_and_filename = basename(dirname(__FILE__)) . "/" . basename(__FILE__);
51
 
52
  }
53
 
54
  function plugin_action_links($actions, $b, $c, $d) {
 
55
  $settings_page_url = menu_page_url("simple_history_settings_menu_slug", 0);
56
  $actions[] = "<a href='$settings_page_url'>Settings</a>";
57
  return $actions;
84
  add_action("edit_comment", "simple_history_edit_comment");
85
  add_action("delete_comment", "simple_history_delete_comment");
86
  add_action("wp_set_comment_status", "simple_history_set_comment_status", 10, 2);
87
+
88
+ // settings (all built in except permalinks)
89
+ $arr_option_pages = array("general", "writing", "reading", "discussion", "media", "privacy");
90
+ foreach ($arr_option_pages as $one_option_page_name) {
91
+ $new_func = create_function('$capability', '
92
+ simple_history_add_update_option_page($capability, "'.$one_option_page_name.'");
93
+ ');
94
+ add_filter("option_page_capability_{$one_option_page_name}", $new_func);
95
+ }
96
+
97
+ // settings page for permalinks
98
+ add_action('check_admin_referer', "simple_history_add_update_option_page_permalinks", 10, 2);
99
+
100
+ // core update = wordpress updates
101
+ add_action( '_core_updated_successfully', array($this, "action_core_updated") );
102
+
103
+ // add donate link to plugin list page
104
+ add_action("plugin_row_meta", array($this, "action_plugin_row_meta"), 10, 2);
105
+
106
+ // check if database needs upgrade
107
  $this->check_upgrade_stuff();
108
+
109
 
110
  wp_enqueue_style( "simple_history_styles", SIMPLE_HISTORY_URL . "styles.css", false, SIMPLE_HISTORY_VERSION );
111
  wp_enqueue_script("simple_history", SIMPLE_HISTORY_URL . "scripts.js", array("jquery"), SIMPLE_HISTORY_VERSION);
112
 
113
  }
114
+
115
+ // WordPress Core updated
116
+ function action_core_updated($wp_version) {
117
+ 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));
118
+ }
119
+
120
+ function filter_option_page_capability($capability) {
121
+ // sf_d($capability); manage_options
122
+ return $capability;
123
+ }
124
+
125
+ // Add link to donate page. Note to self: does not work on dev install because of dir being trunk and not "simple-history"
126
+ function action_plugin_row_meta($links, $file) {
127
+
128
+ #if ($file == $this->plugin_foldername_and_filename) {
129
+ return array_merge(
130
+ $links,
131
+ array( sprintf( '<a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=pluginpage&utm_campaign=simplehistory">%1$s</a>', __('Donate', "simple-history") ) )
132
+ );
133
+ #}
134
+ return $links;
135
+
136
+ }
137
+
138
 
139
  // check some things regarding update
140
  function check_upgrade_stuff() {
217
 
218
  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");
219
  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");
220
+ 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");
221
 
222
  register_setting("simple_history_settings_group", "simple_history_show_on_dashboard");
223
  register_setting("simple_history_settings_group", "simple_history_show_as_page");
328
  $user = $_POST["user"];
329
  if ($user == __( "By all users", 'simple-history' )) { $user = ""; }
330
 
331
+ // the page we are at. deprecated because I kinda did it all wrong :/
332
  $page = 0;
333
  if (isset($_POST["page"])) {
334
  $page = (int) $_POST["page"];
335
  }
336
 
337
+ // number of items to get
338
  $items = (int) (isset($_POST["items"])) ? $_POST["items"] : 5;
339
+
340
+ // number of prev added items = number of items to skip before starting to add $items num of new items
341
+ $num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] : 5;
342
 
343
  $search = (isset($_POST["search"])) ? $_POST["search"] : "";
344
 
348
  "filter_user" => $user,
349
  "page" => $page,
350
  "items" => $items,
351
+ "num_added" => $num_added,
352
  "search" => $search
353
  );
354
  simple_history_print_history($args);
391
  $show_as_page = simple_history_setting_show_as_page();
392
  ?>
393
 
394
+ <input <?php echo $show_on_dashboard ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_on_dashboard" id="simple_history_show_on_dashboard" class="simple_history_show_on_dashboard" />
395
  <label for="simple_history_show_on_dashboard"><?php _e("on the dashboard", 'simple-history') ?></label>
396
 
397
  <br />
398
 
399
+ <input <?php echo $show_as_page ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_as_page" id="simple_history_show_as_page" class="simple_history_show_as_page" />
400
  <label for="simple_history_show_as_page"><?php _e("as a page under the dashboard menu", 'simple-history') ?></label>
401
 
402
  <?php
 
 
 
403
  }
404
 
405
+ function simple_history_settings_field_donate() {
406
+ ?>
407
+ <p>
408
+ <?php
409
+ _e('
410
+ Please
411
+ <a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=settingpage&utm_campaign=simplehistory">
412
+ donate
413
+ </a> to support the development of this plugin and to keep it free.
414
+ Thanks!
415
+ ', "simple-history")
416
+ ?>
417
+ </p>
418
+ <?php
419
+ }
420
+
421
+
422
  function simple_history_get_rss_address() {
423
  $rss_secret = get_option("simple_history_rss_secret");
424
  $rss_address = add_query_arg(array("simple_history_get_rss" => "1", "rss_secret" => $rss_secret), get_bloginfo("url") . "/");
541
  }
542
 
543
  function simple_history_update_option($option, $oldval, $newval) {
 
 
 
 
 
 
 
 
544
 
545
  if ($option == "active_plugins") {
546
 
645
  } else {
646
  $user_id = $current_user->ID;
647
  }
648
+ 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");
649
  }
650
  // user logs out
651
  function simple_history_wp_logout() {
652
  $current_user = wp_get_current_user();
653
  $current_user_id = $current_user->ID;
654
  $user_nicename = urlencode($current_user->user_nicename);
655
+ simple_history_add("action=" . __( 'logged out', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') ."&object_id=$current_user_id&object_name=$user_nicename");
656
  }
657
 
658
  function simple_history_delete_post($post_id) {
795
  <div class="wrap">
796
  <h2><?php echo __("History", 'simple-history') ?></h2>
797
  <?php
798
+ simple_history_print_nav(array("from_page=1"));
799
+ simple_history_print_history(array("items" => 5, "from_page" => "1"));
800
  ?>
801
  </div>
802
 
974
  $str_search = __("Search", 'simple-history');
975
  $search = "<p class='simple-history-filter simple-history-filter-search'>
976
  <input type='text' />
977
+ <input type='button' value='$str_search' class='button' />
978
  </p>";
979
  echo $search;
980
 
993
  "filter_type" => "",
994
  "filter_user" => "",
995
  "is_ajax" => false,
996
+ "search" => "",
997
+ "num_added" => 0
998
  );
999
  $args = wp_parse_args( $args, $defaults );
1000
+
1001
  $simple_history_type_to_show = $args["filter_type"];
1002
  $simple_history_user_to_show = $args["filter_user"];
1003
+
1004
  $where = " WHERE 1=1 ";
1005
  if ($simple_history_type_to_show) {
1006
  $filter_type = "";
1013
  } else {
1014
  $filter_type = $simple_history_type_to_show;
1015
  }
1016
+ $where .= " AND lower(object_type) = '".strtolower($filter_type)."' ";
1017
+ $where .= " AND lower(object_subtype) = '".strtolower($filter_subtype)."' ";
1018
  }
1019
  if ($simple_history_user_to_show) {
1020
+
1021
  $userinfo = get_user_by("slug", $simple_history_user_to_show);
1022
 
1023
  if (isset($userinfo->ID)) {
1027
  }
1028
 
1029
  $tableprefix = $wpdb->prefix;
 
 
 
1030
 
1031
+ $sql = "SELECT * FROM {$tableprefix}simple_history $where ORDER BY date DESC, id DESC ";
1032
+
1033
  $rows = $wpdb->get_results($sql);
1034
 
1035
  $loopNum = 0;
1062
  // check if we have a search. of so, only add if there is a match
1063
  $do_add = FALSE;
1064
  if ($search) {
1065
+ /* echo "<br>search: $search";
1066
+ echo "<br>object_name_lower: $object_name_lower";
1067
+ echo "<br>objecttype: " . $one_row->object_type;
1068
+ echo "<br>object_subtype: " . $one_row->object_subtype;
1069
+ // */
1070
+ if (strpos(strtolower($one_row->object_name), $search) !== FALSE) {
1071
+ $do_add = TRUE;
1072
+ } else if (strpos(strtolower($one_row->object_type), $search) !== FALSE) {
1073
+ $do_add = TRUE;
1074
+ } else if (strpos(strtolower($one_row->object_subtype), $search) !== FALSE) {
1075
  $do_add = TRUE;
1076
  }
1077
  } else {
1081
  if ($do_add) {
1082
  $real_loop_num++;
1083
  }
1084
+
1085
+ // new event, not as previous one
 
 
 
 
 
 
 
 
 
 
 
 
1086
  if ($do_add) {
1087
  $arr_events[$one_row->id] = $one_row;
1088
  $arr_events[$one_row->id]->occasions = array();
1092
 
1093
  }
1094
  }
1095
+
1096
  }
1097
+
1098
+ // arr_events is now all events
1099
+ // but we only want some of them
1100
+ // limit by using
1101
+ // num_added = number of prev added items
1102
+ // items = number of items to get
1103
+ /*sf_d($args["num_added"]);
1104
+ sf_d($args["items"]);
1105
+ sf_d($arr_events);
1106
+ // */
1107
+ $arr_events = array_splice($arr_events, $args["num_added"], $args["items"]);
1108
 
1109
  return $arr_events;
1110
 
1116
 
1117
  $arr_events = simple_history_get_items_array($args);
1118
 
 
 
1119
  $defaults = array(
1120
  "page" => 0,
1121
  "items" => 5,
1129
  if ($arr_events) {
1130
  if (!$args["is_ajax"]) {
1131
  // if not ajax, print the div
1132
+ echo "<div class='simple-history-ol-wrapper'><ol class='simple-history'>";
1133
  }
1134
 
1135
  $loopNum = 0;
1136
  $real_loop_num = -1;
1137
  foreach ($arr_events as $one_row) {
1138
+
1139
  $real_loop_num++;
1140
 
1141
  $object_type = $one_row->object_type;
1142
+ $object_type_lcase = strtolower($object_type);
1143
  $object_subtype = $one_row->object_subtype;
1144
  $object_id = $one_row->object_id;
1145
  $object_name = $one_row->object_name;
1149
  $num_occasions = sizeof($occasions);
1150
 
1151
  $css = "";
1152
+ if ("attachment" == $object_type_lcase) {
1153
  if (wp_get_attachment_image_src($object_id, array(50,50), true)) {
1154
  // yep, it's an attachment and it has an icon/thumbnail
1155
  $css .= ' simple-history-has-attachment-thumnbail ';
1156
  }
1157
  }
1158
+ if ("user" == $object_type_lcase) {
1159
  $css .= ' simple-history-has-attachment-thumnbail ';
1160
  }
1161
 
1169
 
1170
  // who performed the action
1171
  $who = "";
1172
+ $user = get_user_by("id", $user_id); // false if user does not exist
1173
 
 
1174
  if ($user) {
1175
+ $user_avatar = get_avatar($user->user_email, "32");
1176
  $user_link = "user-edit.php?user_id={$user->ID}";
1177
+ $who_avatar = sprintf('<a class="simple-history-who-avatar" href="%2$s">%1$s</a>', $user_avatar, $user_link);
1178
+ } else {
1179
+ $user_avatar = get_avatar("", "32");
1180
+ $who_avatar = sprintf('<span class="simple-history-who-avatar">%1$s</span>', $user_avatar);
1181
+ }
1182
+ echo $who_avatar;
1183
+
1184
+ // section with info about the user who did something
1185
+ $who .= "<span class='who'>";
1186
+ if ($user) {
1187
+ $who .= sprintf('<a href="%2$s">%1$s</a>', $user->user_nicename, $user_link);
1188
+ if (isset($user->first_name) || isset($user->last_name)) {
1189
  if ($user->first_name || $user->last_name) {
1190
  $who .= " (";
1191
  if ($user->first_name && $user->last_name) {
1200
  $who .= "&lt;" . __("Unknown or deleted user", 'simple-history') ."&gt;";
1201
  }
1202
  $who .= "</span>";
1203
+ // &rarr;
1204
+
1205
+ /*
1206
+ sf_d($one_row);
1207
+ [object_type] => Post
1208
+ [object_subtype] => Page
1209
+ somewhere/somewhow object_type turned from being lowercase to being capitalized
1210
+ unsure if it's me or wp
1211
+ ah: after some digging it seems to have with translation to do, we changed to upperase
1212
+ to support translation.
1213
+ */
1214
+
1215
  // what and object
1216
+ if ("post" == $object_type_lcase) {
1217
 
1218
  $post_out = "";
1219
  $post_out .= $object_subtype;
1220
  $post = get_post($object_id);
1221
+
1222
  if (null == $post) {
1223
  // post does not exist, probably deleted
1224
  // check if object_name exists
1252
  echo $post_out;
1253
 
1254
 
1255
+ } elseif ("attachment" == $object_type_lcase) {
1256
 
1257
  $attachment_out = "";
1258
  $attachment_out .= __("attachment", 'simple-history') . " ";
1285
  $attachment_out = ucfirst($attachment_out);
1286
  echo $attachment_out;
1287
 
1288
+ } elseif ("user" == $object_type_lcase) {
1289
  $user_out = "";
1290
  $user_out .= __("user", 'simple-history');
1291
  $user = get_user_by("id", $object_id);
1339
  $user_out = ucfirst($user_out);
1340
  echo $user_out;
1341
 
1342
+ } elseif ("comment" == $object_type_lcase) {
1343
 
1344
  $comment_link = get_edit_comment_link($object_id);
1345
  echo 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);
1374
  // when
1375
  $date_i18n_date = date_i18n(get_option('date_format'), strtotime($one_row->date), $gmt=false);
1376
  $date_i18n_time = date_i18n(get_option('time_format'), strtotime($one_row->date), $gmt=false);
 
1377
  $now = strtotime(current_time("mysql"));
1378
+ $diff_str = sprintf( __('<span class="when">%1$s ago</span> by %2$s'), human_time_diff(strtotime($one_row->date), $now), $who );
1379
+ echo $diff_str;
1380
  echo "<span class='when_detail'>".sprintf(__('%s at %s', 'simple-history'), $date_i18n_date, $date_i18n_time)."</span>";
1381
  echo "</div>";
1382
 
1407
  echo "</li>";
1408
 
1409
  $loopNum++;
1410
+
1411
+
1412
  }
1413
 
1414
  // if $loopNum == 0 no items where found for this page
1417
  }
1418
 
1419
  if (!$args["is_ajax"]) {
1420
+
1421
  // if not ajax, print the divs and stuff we need
 
1422
  $show_more = "<select>";
1423
+ $show_more .= sprintf('<option value=5 %2$s>%1$s</option>', __("Show 5 more", 'simple-history'), ($args["items"] == 5 ? " selected " : "") );
1424
+ $show_more .= sprintf('<option value=15 %2$s>%1$s</option>', __("Show 15 more", 'simple-history'), ($args["items"] == 15 ? " selected " : "") );
1425
+ $show_more .= sprintf('<option value=50 %2$s>%1$s</option>', __("Show 50 more", 'simple-history'), ($args["items"] == 50 ? " selected " : "") );
1426
+ $show_more .= sprintf('<option value=100 %2$s>%1$s</option>', __("Show 100 more", 'simple-history'), ($args["items"] == 100 ? " selected " : "") );
1427
  $show_more .= "</select>";
1428
+
1429
  $loading = __("Loading...", 'simple-history');
1430
+ $loading = "<img src='".site_url("wp-admin/images/loading.gif")."' width=16 height=16>" . $loading;
1431
  $no_more_found = __("No more history items found.", 'simple-history');
1432
  $view_rss = __("RSS feed", 'simple-history');
1433
  $view_rss_link = simple_history_get_rss_address();
1434
  $str_show = __("Show", 'simple-history');
1435
  echo "</ol>
1436
  </div>
1437
+ <p class='simple-history-load-more'>$show_more<input type='button' value='$str_show' class='button' /></p>
1438
+ <p class='hidden simple-history-load-more-loading'>$loading</p>
1439
+ <p class='hidden simple-history-no-more-items'>$no_more_found</p>
1440
+ <p class='simple-history-rss-feed-dashboard'><a title='$view_rss' href='$view_rss_link'>$view_rss</a></p>
1441
+ <p class='simple-history-rss-feed-page'><a title='$view_rss' href='$view_rss_link'><span></span>$view_rss</a></p>
1442
  ";
1443
  }
1444
+
1445
  } else {
1446
+
1447
  if ($args["is_ajax"]) {
1448
  echo "simpleHistoryNoMoreItems";
1449
  } else {
1452
  echo "<p>$no_found</p>";
1453
  echo "<p>$please_note</p>";
1454
  }
1455
+
1456
  }
1457
  }
1458
 
1459
+ // called when saving an options page
1460
+ function simple_history_add_update_option_page($capability = NULL, $option_page = NULL) {
1461
+
1462
+ $arr_options_names = array(
1463
+ "general" => __("General Settings"),
1464
+ "writing" => __("Writing Settings"),
1465
+ "reading" => __("Reading Settings"),
1466
+ "discussion" => __("Discussion Settings"),
1467
+ "media" => __("Media Settings"),
1468
+ "privacy" => __("Privacy Settings")
1469
+ );
1470
+
1471
+ $option_page_name = "";
1472
+ if (isset($arr_options_names[$option_page])) {
1473
+ $option_page_name = $arr_options_names[$option_page];
1474
+ simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name");
1475
+ }
1476
+
1477
+ }
1478
+
1479
+ // called when updating permalinks
1480
+ function simple_history_add_update_option_page_permalinks($action, $result) {
1481
+
1482
+ if ("update-permalink" == $action) {
1483
+ $option_page_name = __("Permalink Settings");
1484
+ $option_page = "permalink";
1485
+ simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name");
1486
+ }
1487
+
1488
+ }
1489
+
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === Plugin Name ===
2
  Contributors: eskapism, MarsApril
3
  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: 0.7.2
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -85,6 +85,15 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
 
 
 
88
  = 0.7.2 =
89
  - Default settings should be to show on page, missed that one. Sorry!
90
 
1
+ === Simple History ===
2
  Contributors: eskapism, MarsApril
3
  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: 0.8
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
85
 
86
  == Changelog ==
87
 
88
+ = 0.8 =
89
+ - Added: now also logs when a user saves any of the built in settings page (general, writing, reading, discussion, media, privacy, and permalinks. What more things do you want to see in the history? Let me know in the [support forum](http://wordpress.org/support/plugin/simple-history).
90
+ - Added: gravatar of user performing action is always shown
91
+ - Fixed: history items that was posts/pages/custom post types now get linked again
92
+ - Fixed: search is triggered on enter (no need to press search button) + search searches object type and object subtype (before it just searched object name)
93
+ - Fixed: showing/loading of new history items was kinda broken. Hopefully fixed and working better than ever now.
94
+ - Plus: even more WordPress-ish looking!
95
+ - Also added donate-links. Tried to keep them discrete. Anyway: please [donate](http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=changelog&utm_campaign=simplehistory) if you use this plugin regularly.
96
+
97
  = 0.7.2 =
98
  - Default settings should be to show on page, missed that one. Sorry!
99
 
scripts.js CHANGED
@@ -3,6 +3,16 @@
3
  * load history items via ajax
4
  */
5
  var simple_history_current_page = 0;
 
 
 
 
 
 
 
 
 
 
6
  jQuery(".simple-history-filter a, .simple-history-filter input[type='button']").live("click", function() {
7
 
8
  $t = jQuery(this);
@@ -12,12 +22,12 @@ jQuery(".simple-history-filter a, .simple-history-filter input[type='button']").
12
 
13
  jQuery(".simple-history-added-by-ajax").remove();
14
 
15
- var $wrapper = jQuery("#simple-history-ol-wrapper");
16
  $wrapper.height($wrapper.height()); // so dashboard widget does not collapse when loading new items
17
 
18
- jQuery("#simple-history-load-more").hide("fast");
19
  $ol.fadeOut("fast");
20
- jQuery("#simple-history-no-more-items").hide();
21
 
22
  var search = jQuery("p.simple-history-filter-search input[type='text']").val();
23
 
@@ -26,31 +36,39 @@ jQuery(".simple-history-filter a, .simple-history-filter input[type='button']").
26
  "action": "simple_history_ajax",
27
  "type": jQuery("ul.simple-history-filter-type li.selected a").text(),
28
  "user": jQuery("ul.simple-history-filter-user li.selected a").text(),
29
- "search": search
 
30
  };
31
  jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
32
  if (data == "simpleHistoryNoMoreItems") {
33
- jQuery("#simple-history-load-more,#simple-history-load-more-loading").hide();
34
- jQuery("#simple-history-no-more-items").show();
35
- jQuery("#simple-history-ol-wrapper").height("auto");
36
  } else {
37
  $ol.html(data);
38
  $ol.fadeIn("fast");
39
  $wrapper.height("auto");
40
- jQuery("#simple-history-load-more").fadeIn("fast");
41
  }
42
  });
43
 
44
  return false;
45
  });
46
 
47
- jQuery("#simple-history-load-more a, #simple-history-load-more input[type='button']").live("click", function() {
 
 
 
48
 
49
  simple_history_current_page++;
50
 
 
51
  var num_to_get = jQuery(this).prev("select").find(":selected").val();
 
 
 
52
 
53
- jQuery("#simple-history-load-more,#simple-history-load-more-loading").toggle();
54
 
55
  var search = jQuery("p.simple-history-filter-search input[type='text']").val();
56
 
@@ -61,21 +79,27 @@ jQuery("#simple-history-load-more a, #simple-history-load-more input[type='butto
61
  "user": jQuery(".simple-history-filter-user li.selected a").text(),
62
  "page": simple_history_current_page,
63
  "items": num_to_get,
 
64
  "search": search
65
  };
66
  jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
67
 
68
  // if data = simpleHistoryNoMoreItems then no more items found, so hide load-more-link
69
  if (data == "simpleHistoryNoMoreItems") {
70
- jQuery("#simple-history-load-more,#simple-history-load-more-loading").hide();
71
- jQuery("#simple-history-no-more-items").show();
72
  } else {
73
- var $new_elm = jQuery("<ol class='simple-history simple-history-added-by-ajax'>" + data + "</ol>");
74
- $new_elm.hide();
75
- $ol.after($new_elm);
76
- $new_elm.show("slow");
77
- jQuery("#simple-history-load-more,#simple-history-load-more-loading").toggle();
 
 
 
 
78
  }
 
79
  });
80
  return false;
81
  });
@@ -92,4 +116,3 @@ jQuery("a.simple-history-occasion-show").live("click", function() {
92
  jQuery(this).closest("li").find("ul.simple-history-occasions").toggle("fast");
93
  return false;
94
  });
95
-
3
  * load history items via ajax
4
  */
5
  var simple_history_current_page = 0;
6
+
7
+ // search on enter
8
+ jQuery(document).on("keyup", ".simple-history-filter-search input[type='text']", function(e) {
9
+ // Key is enter
10
+ if (e.keyCode == 13) {
11
+ console.log("do search");
12
+ jQuery(".simple-history-filter input[type='button']").trigger("click");
13
+ }
14
+ });
15
+
16
  jQuery(".simple-history-filter a, .simple-history-filter input[type='button']").live("click", function() {
17
 
18
  $t = jQuery(this);
22
 
23
  jQuery(".simple-history-added-by-ajax").remove();
24
 
25
+ var $wrapper = jQuery(".simple-history-ol-wrapper");
26
  $wrapper.height($wrapper.height()); // so dashboard widget does not collapse when loading new items
27
 
28
+ jQuery(".simple-history-load-more").hide("fast");
29
  $ol.fadeOut("fast");
30
+ jQuery(".simple-history-no-more-items").hide();
31
 
32
  var search = jQuery("p.simple-history-filter-search input[type='text']").val();
33
 
36
  "action": "simple_history_ajax",
37
  "type": jQuery("ul.simple-history-filter-type li.selected a").text(),
38
  "user": jQuery("ul.simple-history-filter-user li.selected a").text(),
39
+ "search": search,
40
+ "num_added": 0
41
  };
42
  jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
43
  if (data == "simpleHistoryNoMoreItems") {
44
+ jQuery(".simple-history-load-more,.simple-history-load-more-loading").hide();
45
+ jQuery(".simple-history-no-more-items").show();
46
+ jQuery(".simple-history-ol-wrapper").height("auto");
47
  } else {
48
  $ol.html(data);
49
  $ol.fadeIn("fast");
50
  $wrapper.height("auto");
51
+ jQuery(".simple-history-load-more").fadeIn("fast");
52
  }
53
  });
54
 
55
  return false;
56
  });
57
 
58
+ /**
59
+ * Click on load more = load more items via AJAX
60
+ */
61
+ jQuery(".simple-history-load-more a, .simple-history-load-more input[type='button']").live("click", function() {
62
 
63
  simple_history_current_page++;
64
 
65
+ // the number of new history items to get
66
  var num_to_get = jQuery(this).prev("select").find(":selected").val();
67
+
68
+ // the number of added li-items = the number of added history items
69
+ var num_added = jQuery("ol.simple-history > li").length;
70
 
71
+ jQuery(".simple-history-load-more,.simple-history-load-more-loading").toggle();
72
 
73
  var search = jQuery("p.simple-history-filter-search input[type='text']").val();
74
 
79
  "user": jQuery(".simple-history-filter-user li.selected a").text(),
80
  "page": simple_history_current_page,
81
  "items": num_to_get,
82
+ "num_added": num_added,
83
  "search": search
84
  };
85
  jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
86
 
87
  // if data = simpleHistoryNoMoreItems then no more items found, so hide load-more-link
88
  if (data == "simpleHistoryNoMoreItems") {
89
+ jQuery(".simple-history-load-more,.simple-history-load-more-loading").hide();
90
+ jQuery(".simple-history-no-more-items").show();
91
  } else {
92
+ //var $new_elm = jQuery("<ol class='simple-history simple-history-added-by-ajax'>" + data + "</ol>");
93
+ var $new_lis = jQuery(data);
94
+ $new_lis.hide();
95
+ $ol.append($new_lis);
96
+ $new_lis.fadeIn("slow");
97
+ //$new_elm.hide();
98
+ //$ol.after($new_elm);
99
+ //$new_elm.show("slow");
100
+ jQuery(".simple-history-load-more,.simple-history-load-more-loading").toggle();
101
  }
102
+
103
  });
104
  return false;
105
  });
116
  jQuery(this).closest("li").find("ul.simple-history-occasions").toggle("fast");
117
  return false;
118
  });
 
styles.css CHANGED
@@ -6,7 +6,10 @@
6
  .simple-history-filter li {
7
  display: inline;
8
  }
9
- .simple-history-filter li.selected a {
 
 
 
10
  font-weight: bold;
11
  text-decoration: none;
12
  color: black;
@@ -16,27 +19,64 @@ ol.simple-history {
16
  list-style-type: none;
17
  margin: 0 -10px;
18
  padding: 0;
 
 
 
 
19
  }
20
  ol.simple-history > li {
21
  margin: 0;
22
  padding: 10px 10px;
23
  position: relative;
24
- line-height: 1.5;
25
- border-top: 1px solid #DFDFDF;
 
 
 
 
26
  }
27
  ol.simple-history > li:nth-child(odd) {
28
- background-color: #FCFCFC;
29
  }
30
  ol.simple-history .first {
31
  font-size: 13px;
32
  font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
33
- margin: 0 0 0.2em;
34
- /* margin-left: 60px; */
 
 
 
 
 
 
 
35
  }
36
 
37
  ol.simple-history .second {
38
  color: #999;
39
- /* margin-left: 60px; */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  ol.simple-history .when {
@@ -45,7 +85,6 @@ ol.simple-history .when {
45
  border-bottom: 1px dotted #bbb;
46
  }
47
  ol.simple-history .when_detail {
48
- /* margin-left: .5em; */
49
  display: none;
50
  position: relative;
51
  top: 1.75em;
@@ -54,27 +93,19 @@ ol.simple-history .when_detail {
54
  background-color: #fffdb5;
55
  border: 1px solid #eee;
56
  color: black;
 
57
  }
58
 
59
  .simple-history-attachment-thumbnail {
60
  position: absolute;
61
- left: 0;
62
- top: 0;
 
63
  }
64
  .simple-history-title {
65
  font-weight: bold;
66
  }
67
 
68
- li.simple-history-has-attachment-thumnbail {
69
- min-height: 50px;
70
- }
71
- ol.simple-history .simple-history-has-attachment-thumnbail .first,
72
- ol.simple-history .simple-history-has-attachment-thumnbail .second,
73
- ol.simple-history .simple-history-has-attachment-thumnbail .third
74
- {
75
- margin-left: 60px;
76
- }
77
-
78
  .simple-history-discrete {
79
  font-size: 11px;
80
  color: #999;
@@ -85,7 +116,7 @@ ol.simple-history .simple-history-has-attachment-thumnbail .third
85
  }
86
 
87
  ul.simple-history-occasions {
88
- margin: 0;
89
  padding: 0;
90
  list-style-type: none;
91
  color: #999999;
@@ -93,49 +124,59 @@ ul.simple-history-occasions {
93
  ul.simple-history-occasions li {
94
  margin: 0;
95
  padding: 0;
 
96
  }
97
 
98
- #simple-history-no-more-items {
 
 
 
 
 
 
 
 
 
 
99
  padding: .5em;
100
  background-color: #FFFFE0;
101
  border: 1px solid #E6DB55;
102
  font-weight: bold;
103
  }
104
 
105
- #simple-history-rss-feed-dashboard {
106
  display: none;
107
  }
108
 
109
- #simple_history_dashboard_widget #simple-history-rss-feed-dashboard {
110
  position: absolute;
111
- bottom: 0;
112
- right: 0;
113
  margin: 0;
114
  display: block;
115
  }
116
- #simple-history-rss-feed-dashboard a,
117
- #simple-history-rss-feed-page span
118
  {
119
  background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_888888_256x240.png) no-repeat -17px -176px;
120
  display: block;
121
  width: 16px;
122
  height: 16px;
123
  text-indent: -99999px;
 
124
  }
125
 
126
- #simple_history_dashboard_widget #simple-history-rss-feed-page {
127
  display: none;
128
  }
129
- #simple-history-rss-feed-page {
130
  display: block;
131
  padding-top: 10px;
132
  border-top: 1px solid #ccc;
133
  }
134
- #simple-history-rss-feed-page span {
135
  float: left;
136
  }
137
- #simple-history-rss-feed-page a {
138
- }
139
 
140
  .simple-history-settings-page-updated {
141
  font-weight: bold;
6
  .simple-history-filter li {
7
  display: inline;
8
  }
9
+ .simple-history-filter a {
10
+ text-decoration: none;
11
+ }
12
+ .simple-history-filter .selected a {
13
  font-weight: bold;
14
  text-decoration: none;
15
  color: black;
19
  list-style-type: none;
20
  margin: 0 -10px;
21
  padding: 0;
22
+ border-top: 1px solid #DFDFDF;
23
+ }
24
+ ol.simple-history a {
25
+ text-decoration: none;
26
  }
27
  ol.simple-history > li {
28
  margin: 0;
29
  padding: 10px 10px;
30
  position: relative;
31
+ line-height: 1;
32
+ border-top: 1px solid white;
33
+ border-bottom: 1px solid #DFDFDF;
34
+ background-color: #FCFCFC;
35
+ min-height: 32px;
36
+ padding-left: 52px;
37
  }
38
  ol.simple-history > li:nth-child(odd) {
39
+ background-color: #F9F9F9;
40
  }
41
  ol.simple-history .first {
42
  font-size: 13px;
43
  font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
44
+ margin: 0 0 0.5em;
45
+ }
46
+
47
+ /* reverse background color order on wiget page so the light one is topmost */
48
+ #simple_history_dashboard_widget ol.simple-history > li {
49
+ background-color: #F9F9F9;
50
+ }
51
+ #simple_history_dashboard_widget ol.simple-history > li:nth-child(odd) {
52
+ background-color: #FCFCFC;
53
  }
54
 
55
  ol.simple-history .second {
56
  color: #999;
57
+ }
58
+
59
+ ol.simple-history .third {
60
+ margin-top: .5em;
61
+ }
62
+ ol.simple-history .third ul {
63
+ margin-top: .5em;
64
+ }
65
+
66
+ li.simple-history-has-attachment-thumnbail {
67
+ /*min-height: 50px;*/
68
+ }
69
+ ol.simple-history .simple-history-has-attachment-thumnbail .first,
70
+ ol.simple-history .simple-history-has-attachment-thumnbail .second,
71
+ ol.simple-history .simple-history-has-attachment-thumnbail .third
72
+ {
73
+ /*margin-left: 60px;*/
74
+ }
75
+
76
+ .simple-history-who-avatar {
77
+ position: absolute;
78
+ top: 10px;
79
+ left: 10px;
80
  }
81
 
82
  ol.simple-history .when {
85
  border-bottom: 1px dotted #bbb;
86
  }
87
  ol.simple-history .when_detail {
 
88
  display: none;
89
  position: relative;
90
  top: 1.75em;
93
  background-color: #fffdb5;
94
  border: 1px solid #eee;
95
  color: black;
96
+ z-index: 1;
97
  }
98
 
99
  .simple-history-attachment-thumbnail {
100
  position: absolute;
101
+ left: 10px;
102
+ top: 10px;
103
+ display: none;;
104
  }
105
  .simple-history-title {
106
  font-weight: bold;
107
  }
108
 
 
 
 
 
 
 
 
 
 
 
109
  .simple-history-discrete {
110
  font-size: 11px;
111
  color: #999;
116
  }
117
 
118
  ul.simple-history-occasions {
119
+ margin: 0 0 0 1em;
120
  padding: 0;
121
  list-style-type: none;
122
  color: #999999;
124
  ul.simple-history-occasions li {
125
  margin: 0;
126
  padding: 0;
127
+ line-height: 1.5;
128
  }
129
 
130
+ .simple-history-load-more-loading {
131
+ height: 26px;
132
+ line-height: 26px;
133
+ }
134
+ .simple-history-load-more-loading img {
135
+ display: inline-block;
136
+ position: relative;
137
+ top: 3px;
138
+ margin-right: .5em;
139
+ }
140
+ .simple-history-no-more-items {
141
  padding: .5em;
142
  background-color: #FFFFE0;
143
  border: 1px solid #E6DB55;
144
  font-weight: bold;
145
  }
146
 
147
+ .simple-history-rss-feed-dashboard {
148
  display: none;
149
  }
150
 
151
+ #simple_history_dashboard_widget .simple-history-rss-feed-dashboard {
152
  position: absolute;
153
+ bottom: 6px;
154
+ right: 5px;
155
  margin: 0;
156
  display: block;
157
  }
158
+ .simple-history-rss-feed-dashboard a,
159
+ .simple-history-rss-feed-page span
160
  {
161
  background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_888888_256x240.png) no-repeat -17px -176px;
162
  display: block;
163
  width: 16px;
164
  height: 16px;
165
  text-indent: -99999px;
166
+ direction: ltr;
167
  }
168
 
169
+ #simple_history_dashboard_widget .simple-history-rss-feed-page {
170
  display: none;
171
  }
172
+ .simple-history-rss-feed-page {
173
  display: block;
174
  padding-top: 10px;
175
  border-top: 1px solid #ccc;
176
  }
177
+ .simple-history-rss-feed-page span {
178
  float: left;
179
  }
 
 
180
 
181
  .simple-history-settings-page-updated {
182
  font-weight: bold;
uninstall.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File that is run during plugin uninstall (not just de-activate)
4
+ */
5
+
6
+ //if uninstall not called from WordPress exit
7
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
8
+ exit ();
9
+