Simple History - Version 0.8.1

Version Description

  • Fixed some annoying errors that slipt through testing.
Download this release

Release Info

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

Code changes from version 0.8 to 0.8.1

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.8
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.8");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
33
 
@@ -89,7 +89,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
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
  }
@@ -118,19 +118,18 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
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
  }
@@ -1474,6 +1473,7 @@ function simple_history_add_update_option_page($capability = NULL, $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
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.1
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.1");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
33
 
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
+ return 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
  }
118
  }
119
 
120
  function filter_option_page_capability($capability) {
 
121
  return $capability;
122
  }
123
 
124
  // Add link to donate page. Note to self: does not work on dev install because of dir being trunk and not "simple-history"
125
  function action_plugin_row_meta($links, $file) {
126
 
127
+ if ($file == $this->plugin_foldername_and_filename) {
128
  return array_merge(
129
  $links,
130
  array( sprintf( '<a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=pluginpage&utm_campaign=simplehistory">%1$s</a>', __('Donate', "simple-history") ) )
131
  );
132
+ }
133
  return $links;
134
 
135
  }
1473
  simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name");
1474
  }
1475
 
1476
+ return $capability;
1477
  }
1478
 
1479
  // called when updating permalinks
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: 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,6 +85,9 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
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
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.1
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.1 =
89
+ - Fixed some annoying errors that slipt through testing.
90
+
91
  = 0.8 =
92
  - 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).
93
  - Added: gravatar of user performing action is always shown
trunk/index.php ADDED
@@ -0,0 +1,1489 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
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.1
7
+ Author: Pär Thernström
8
+ Author URI: http://eskapism.se/
9
+ License: GPL2
10
+ */
11
+
12
+ /* Copyright 2010 Pär Thernström (email: par.thernstrom@gmail.com)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+ load_plugin_textdomain('simple-history', false, "/simple-history/languages");
29
+
30
+ define( "SIMPLE_HISTORY_VERSION", "0.8.1");
31
+ define( "SIMPLE_HISTORY_NAME", "Simple History");
32
+ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
33
+
34
+ /**
35
+ * Let's begin on a class, since they rule so much more than functions.
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
44
+ add_action( 'init', array($this, 'init') ); // start listening to changes
45
+ add_action( 'admin_menu', array($this, 'admin_menu') );
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;
58
+
59
+ }
60
+
61
+ function wp_dashboard_setup() {
62
+ if (simple_history_setting_show_on_dashboard()) {
63
+ if (current_user_can("edit_pages")) {
64
+ wp_add_dashboard_widget("simple_history_dashboard_widget", __("History", 'simple-history'), "simple_history_dashboard");
65
+ }
66
+ }
67
+ }
68
+
69
+ // stuff that happens in the admin
70
+ // "admin_init is triggered before any other hook when a user access the admin area"
71
+ function admin_init() {
72
+
73
+ // posts
74
+ add_action("save_post", "simple_history_save_post");
75
+ add_action("transition_post_status", "simple_history_transition_post_status", 10, 3);
76
+ add_action("delete_post", "simple_history_delete_post");
77
+
78
+ // attachments/media
79
+ add_action("add_attachment", "simple_history_add_attachment");
80
+ add_action("edit_attachment", "simple_history_edit_attachment");
81
+ add_action("delete_attachment", "simple_history_delete_attachment");
82
+
83
+ // comments
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
+ return 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
+ return $capability;
122
+ }
123
+
124
+ // Add link to donate page. Note to self: does not work on dev install because of dir being trunk and not "simple-history"
125
+ function action_plugin_row_meta($links, $file) {
126
+
127
+ if ($file == $this->plugin_foldername_and_filename) {
128
+ return array_merge(
129
+ $links,
130
+ array( sprintf( '<a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=pluginpage&utm_campaign=simplehistory">%1$s</a>', __('Donate', "simple-history") ) )
131
+ );
132
+ }
133
+ return $links;
134
+
135
+ }
136
+
137
+
138
+ // check some things regarding update
139
+ function check_upgrade_stuff() {
140
+
141
+ global $wpdb;
142
+
143
+ $db_version = get_option("simple_history_db_version");
144
+ // $db_version = FALSE;
145
+
146
+ if ($db_version === FALSE) {
147
+ // db fix has never been run
148
+ // user is on version 0.4 or earlier
149
+ // = database is not using utf-8
150
+ // so fix that
151
+ $table_name = $wpdb->prefix . "simple_history";
152
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
153
+ #echo "begin upgrading database";
154
+ // We change the varchar size to add one num just to force update of encoding. dbdelta didn't see it otherwise.
155
+ $sql = "CREATE TABLE " . $table_name . " (
156
+ id int(10) NOT NULL AUTO_INCREMENT,
157
+ date datetime NOT NULL,
158
+ action VARCHAR(256) NOT NULL COLLATE utf8_general_ci,
159
+ object_type VARCHAR(256) NOT NULL COLLATE utf8_general_ci,
160
+ object_subtype VARCHAR(256) NOT NULL COLLATE utf8_general_ci,
161
+ user_id int(10) NOT NULL,
162
+ object_id int(10) NOT NULL,
163
+ object_name VARCHAR(256) NOT NULL COLLATE utf8_general_ci,
164
+ PRIMARY KEY (id)
165
+ ) CHARACTER SET=utf8;";
166
+
167
+ // Upgrade db / fix utf for varchars
168
+ dbDelta($sql);
169
+
170
+ // Fix UTF-8 for table
171
+ $sql = sprintf('alter table %1$s charset=utf8;', $table_name);
172
+ $wpdb->query($sql);
173
+
174
+ // Store this upgrade in ourself :)
175
+ simple_history_add("action=" . __( 'upgraded it\'s database', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=" . SIMPLE_HISTORY_NAME);
176
+
177
+ #echo "done upgrading database";
178
+
179
+ update_option("simple_history_db_version", 1);
180
+ } else {
181
+ // echo "db up to date";
182
+ }
183
+
184
+ }
185
+
186
+ function settings_page() {
187
+
188
+ ?>
189
+ <div class="wrap">
190
+ <form method="post" action="options.php">
191
+ <h2><?php _e("Simple History Settings", "simple-history") ?></h2>
192
+ <?php do_settings_sections("simple_history_settings_menu_slug"); ?>
193
+ <?php settings_fields("simple_history_settings_group"); ?>
194
+ <?php submit_button(); ?>
195
+ </form>
196
+ </div>
197
+ <?php
198
+
199
+ }
200
+
201
+ function admin_menu() {
202
+
203
+ // show as page?
204
+ if (simple_history_setting_show_as_page()) {
205
+ add_dashboard_page(SIMPLE_HISTORY_NAME, __("History", 'simple-history'), "edit_pages", "simple_history_page", "simple_history_management_page");
206
+ }
207
+
208
+ // add page for settings
209
+ $show_settings_page = TRUE;
210
+ $show_settings_page = apply_filters("simple_history_show_settings_page", $show_settings_page);
211
+ if ($show_settings_page) {
212
+ add_options_page(__('Simple History Settings', "simple-history"), SIMPLE_HISTORY_NAME, 'edit_pages', "simple_history_settings_menu_slug", array($this, 'settings_page'));
213
+ }
214
+
215
+ add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug");
216
+
217
+ 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");
218
+ 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");
219
+ 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");
220
+
221
+ register_setting("simple_history_settings_group", "simple_history_show_on_dashboard");
222
+ register_setting("simple_history_settings_group", "simple_history_show_as_page");
223
+
224
+ }
225
+
226
+ function init() {
227
+
228
+ // users and stuff
229
+ add_action("wp_login", "simple_history_wp_login");
230
+ add_action("wp_logout", "simple_history_wp_logout");
231
+ add_action("delete_user", "simple_history_delete_user");
232
+ add_action("user_register", "simple_history_user_register");
233
+ add_action("profile_update", "simple_history_profile_update");
234
+
235
+ // options
236
+ #add_action("updated_option", "simple_history_updated_option", 10, 3);
237
+ #add_action("updated_option", "simple_history_updated_option2", 10, 2);
238
+ #add_action("updated_option", "simple_history_updated_option3", 10, 1);
239
+ #add_action("update_option", "simple_history_update_option", 10, 3);
240
+
241
+ // plugin
242
+ add_action("activated_plugin", "simple_history_activated_plugin");
243
+ add_action("deactivated_plugin", "simple_history_deactivated_plugin");
244
+
245
+ // check for RSS
246
+ // don't know if this is the right way to do this, but it seems to work!
247
+ if (isset($_GET["simple_history_get_rss"])) {
248
+
249
+ $rss_secret_option = get_option("simple_history_rss_secret");
250
+ $rss_secret_get = $_GET["rss_secret"];
251
+
252
+ echo '<?xml version="1.0"?>';
253
+ $self_link = simple_history_get_rss_address();
254
+
255
+ if ($rss_secret_option == $rss_secret_get) {
256
+ ?>
257
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
258
+ <channel>
259
+ <title><?php printf(__("History for %s", 'simple-history'), get_bloginfo("name")) ?></title>
260
+ <description><?php printf(__("WordPress History for %s", 'simple-history'), get_bloginfo("name")) ?></description>
261
+ <link><?php echo get_bloginfo("url") ?></link>
262
+ <atom:link href="<?php echo $self_link; ?>" rel="self" type="application/rss+xml" />
263
+ <?php
264
+ $arr_items = simple_history_get_items_array("items=10");
265
+ foreach ($arr_items as $one_item) {
266
+ $object_type = ucwords($one_item->object_type);
267
+ $object_name = esc_html($one_item->object_name);
268
+ $user = get_user_by("id", $one_item->user_id);
269
+ $user_nicename = esc_html(@$user->user_nicename);
270
+ $description = "";
271
+ if ($user_nicename) {
272
+ $description .= sprintf(__("By %s", 'simple-history'), $user_nicename);
273
+ $description .= "<br />";
274
+ }
275
+ if ($one_item->occasions) {
276
+ $description .= sprintf(__("%d occasions", 'simple-history'), sizeof($one_item->occasions));
277
+ $description .= "<br />";
278
+ }
279
+
280
+ $item_title = esc_html($object_type) . " \"" . esc_html($object_name) . "\" {$one_item->action}";
281
+ $item_title = html_entity_decode($item_title, ENT_COMPAT, "UTF-8");
282
+ $item_guid = get_bloginfo("siteurl") . "?simple-history-guid=" . $one_item->id;
283
+ ?>
284
+ <item>
285
+ <title><![CDATA[<?php echo $item_title; ?>]]></title>
286
+ <description><![CDATA[<?php echo $description ?>]]></description>
287
+ <author><?php echo $user_nicename ?></author>
288
+ <pubDate><?php echo date("D, d M Y H:i:s", strtotime($one_item->date)) ?> GMT</pubDate>
289
+ <guid isPermaLink="false"><?php echo $item_guid ?></guid>
290
+ </item>
291
+ <?php
292
+ }
293
+ ?>
294
+ </channel>
295
+ </rss>
296
+ <?php
297
+ } else {
298
+ // not ok rss secret
299
+ ?>
300
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
301
+ <channel>
302
+ <title><?php printf(__("History for %s", 'simple-history'), get_bloginfo("name")) ?></title>
303
+ <description><?php printf(__("WordPress History for %s", 'simple-history'), get_bloginfo("name")) ?></description>
304
+ <link><?php echo get_bloginfo("siteurl") ?></link>
305
+ <atom:link href="<?php echo $self_link; ?>" rel="self" type="application/rss+xml" />
306
+ <item>
307
+ <title><?php _e("Wrong RSS secret", 'simple-history')?></title>
308
+ <description><?php _e("Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed.", 'simple-history')?></description>
309
+ <pubDate><?php echo date("D, d M Y H:i:s", time()) ?> GMT</pubDate>
310
+ <guid><?php echo get_bloginfo("siteurl") . "?simple-history-guid=wrong-secret" ?></guid>
311
+ </item>
312
+ </channel>
313
+ </rss>
314
+ <?php
315
+
316
+ }
317
+ exit;
318
+ }
319
+
320
+ }
321
+
322
+ function ajax() {
323
+
324
+ $type = $_POST["type"];
325
+ if ($type == __( "All types", 'simple-history' )) { $type = ""; }
326
+
327
+ $user = $_POST["user"];
328
+ if ($user == __( "By all users", 'simple-history' )) { $user = ""; }
329
+
330
+ // the page we are at. deprecated because I kinda did it all wrong :/
331
+ $page = 0;
332
+ if (isset($_POST["page"])) {
333
+ $page = (int) $_POST["page"];
334
+ }
335
+
336
+ // number of items to get
337
+ $items = (int) (isset($_POST["items"])) ? $_POST["items"] : 5;
338
+
339
+ // number of prev added items = number of items to skip before starting to add $items num of new items
340
+ $num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] : 5;
341
+
342
+ $search = (isset($_POST["search"])) ? $_POST["search"] : "";
343
+
344
+ $args = array(
345
+ "is_ajax" => true,
346
+ "filter_type" => $type,
347
+ "filter_user" => $user,
348
+ "page" => $page,
349
+ "items" => $items,
350
+ "num_added" => $num_added,
351
+ "search" => $search
352
+ );
353
+ simple_history_print_history($args);
354
+ exit;
355
+
356
+ }
357
+
358
+ } // class
359
+
360
+ // Boot up
361
+ $simple_history = new simple_history;
362
+
363
+
364
+ function simple_history_dashboard() {
365
+ simple_history_purge_db();
366
+ simple_history_print_nav();
367
+ simple_history_print_history();
368
+ }
369
+
370
+ function simple_history_settings_page() {
371
+ // never remove this function, it must exist.
372
+ // echo "Please choose options for simple history ...";
373
+ }
374
+
375
+ // get settings if plugin should be visible on dasboard. default in no since 0.7
376
+ function simple_history_setting_show_on_dashboard() {
377
+ $show_on_dashboard = get_option("simple_history_show_on_dashboard", 0);
378
+ $show_on_dashboard = apply_filters("simple_history_show_on_dashboard", $show_on_dashboard);
379
+ return (bool) $show_on_dashboard;
380
+ }
381
+ function simple_history_setting_show_as_page() {
382
+ $setting = get_option("simple_history_show_as_page", 1);
383
+ $setting = apply_filters("simple_history_show_as_page", $setting);
384
+ return (bool) $setting;
385
+
386
+ }
387
+
388
+ function simple_history_settings_field() {
389
+ $show_on_dashboard = simple_history_setting_show_on_dashboard();
390
+ $show_as_page = simple_history_setting_show_as_page();
391
+ ?>
392
+
393
+ <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" />
394
+ <label for="simple_history_show_on_dashboard"><?php _e("on the dashboard", 'simple-history') ?></label>
395
+
396
+ <br />
397
+
398
+ <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" />
399
+ <label for="simple_history_show_as_page"><?php _e("as a page under the dashboard menu", 'simple-history') ?></label>
400
+
401
+ <?php
402
+ }
403
+
404
+ function simple_history_settings_field_donate() {
405
+ ?>
406
+ <p>
407
+ <?php
408
+ _e('
409
+ Please
410
+ <a href="http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=settingpage&utm_campaign=simplehistory">
411
+ donate
412
+ </a> to support the development of this plugin and to keep it free.
413
+ Thanks!
414
+ ', "simple-history")
415
+ ?>
416
+ </p>
417
+ <?php
418
+ }
419
+
420
+
421
+ function simple_history_get_rss_address() {
422
+ $rss_secret = get_option("simple_history_rss_secret");
423
+ $rss_address = add_query_arg(array("simple_history_get_rss" => "1", "rss_secret" => $rss_secret), get_bloginfo("url") . "/");
424
+ $rss_address = htmlspecialchars($rss_address, ENT_COMPAT, "UTF-8");
425
+ return $rss_address;
426
+ }
427
+
428
+ function simple_history_update_rss_secret() {
429
+ $rss_secret = "";
430
+ for ($i=0; $i<20; $i++) {
431
+ $rss_secret .= chr(rand(97,122));
432
+ }
433
+ update_option("simple_history_rss_secret", $rss_secret);
434
+ return $rss_secret;
435
+ }
436
+
437
+ function simple_history_settings_field_rss() {
438
+ ?>
439
+ <?php
440
+ $create_new_secret = false;
441
+ /*
442
+ // eeek! why was this here?
443
+ if ($rss_secret == false) {
444
+ $create_new_secret = true;
445
+ }
446
+ */
447
+ if (isset($_GET["simple_history_rss_update_secret"]) && $_GET["simple_history_rss_update_secret"]) {
448
+ $create_new_secret = true;
449
+ echo "<div class='simple-history-settings-page-updated'><p>";
450
+ _e("Created new secret RSS adress", 'simple-history');
451
+ echo "</p></div>";
452
+ }
453
+
454
+ if ($create_new_secret) {
455
+ simple_history_update_rss_secret();
456
+ }
457
+
458
+ $rss_address = simple_history_get_rss_address();
459
+ echo "<code><a href='$rss_address'>$rss_address</a></code>";
460
+ echo "<br />";
461
+ _e("This is a secret RSS feed for Simple History. Only share the link with people you trust", 'simple-history');
462
+ echo "<br />";
463
+ $update_link = add_query_arg("simple_history_rss_update_secret", "1");
464
+ 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);
465
+ }
466
+
467
+ // @todo: move all add-related stuff to own file? there are so many of them.. kinda confusing, ey.
468
+
469
+ function simple_history_activated_plugin($plugin_name) {
470
+ $plugin_name = urlencode($plugin_name);
471
+ simple_history_add("action=" . __( 'activated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name");
472
+ }
473
+ function simple_history_deactivated_plugin($plugin_name) {
474
+ $plugin_name = urlencode($plugin_name);
475
+ simple_history_add("action=" . __( 'deactivated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name");
476
+ }
477
+
478
+ function simple_history_edit_comment($comment_id) {
479
+
480
+ $comment_data = get_commentdata($comment_id, 0, true);
481
+ $comment_post_ID = $comment_data["comment_post_ID"];
482
+ $post = get_post($comment_post_ID);
483
+ $post_title = get_the_title($comment_post_ID);
484
+ $excerpt = get_comment_excerpt($comment_id);
485
+ $author = get_comment_author($comment_id);
486
+
487
+ $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
488
+ $str = urlencode($str);
489
+
490
+ simple_history_add("action=" . __( 'edited', 'simple-history' ) . "&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id");
491
+
492
+ }
493
+
494
+ function simple_history_delete_comment($comment_id) {
495
+
496
+ $comment_data = get_commentdata($comment_id, 0, true);
497
+ $comment_post_ID = $comment_data["comment_post_ID"];
498
+ $post = get_post($comment_post_ID);
499
+ $post_title = get_the_title($comment_post_ID);
500
+ $excerpt = get_comment_excerpt($comment_id);
501
+ $author = get_comment_author($comment_id);
502
+
503
+ $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
504
+ $str = urlencode($str);
505
+
506
+ simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id");
507
+
508
+ }
509
+
510
+ function simple_history_set_comment_status($comment_id, $new_status) {
511
+ #echo "<br>new status: $new_status<br>"; // 0
512
+ // $new_status hold (unapproved), approve, spam, trash
513
+ $comment_data = get_commentdata($comment_id, 0, true);
514
+ $comment_post_ID = $comment_data["comment_post_ID"];
515
+ $post = get_post($comment_post_ID);
516
+ $post_title = get_the_title($comment_post_ID);
517
+ $excerpt = get_comment_excerpt($comment_id);
518
+ $author = get_comment_author($comment_id);
519
+
520
+ $action = "";
521
+ if ("approve" == $new_status) {
522
+ $action = __( 'approved', 'simple-history' );
523
+ } elseif ("hold" == $new_status) {
524
+ $action = __( 'unapproved', 'simple-history' );
525
+ } elseif ("spam" == $new_status) {
526
+ $action = __( 'marked as spam', 'simple-history' );
527
+ } elseif ("trash" == $new_status) {
528
+ $action = __( 'trashed', 'simple-history' );
529
+ } elseif ("0" == $new_status) {
530
+ $action = __( 'untrashed', 'simple-history' );
531
+ }
532
+
533
+ $action = urlencode($action);
534
+
535
+ $str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
536
+ $str = urlencode($str);
537
+
538
+ simple_history_add("action=$action&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id");
539
+
540
+ }
541
+
542
+ function simple_history_update_option($option, $oldval, $newval) {
543
+
544
+ if ($option == "active_plugins") {
545
+
546
+ $debug = "\n";
547
+ $debug .= "\nsimple_history_update_option()";
548
+ $debug .= "\noption: $option";
549
+ $debug .= "\noldval: " . print_r($oldval, true);
550
+ $debug .= "\nnewval: " . print_r($newval, true);
551
+
552
+ // Returns an array containing all the entries from array1 that are not present in any of the other arrays.
553
+ // alltså:
554
+ // om newval är array1 och innehåller en rad så är den tillagd
555
+ // om oldval är array1 och innhåller en rad så är den bortagen
556
+ $diff_added = array_diff((array) $newval, (array) $oldval);
557
+ $diff_removed = array_diff((array) $oldval, (array) $newval);
558
+ $debug .= "\ndiff_added: " . print_r($diff_added, true);
559
+ $debug .= "\ndiff_removed: " . print_r($diff_removed, true);
560
+ #b_fd($debug);
561
+ }
562
+ }
563
+
564
+ function simple_history_updated_option($option, $oldval, $newval) {
565
+ /*
566
+ echo "<br><br>simple_history_updated_option()";
567
+ echo "<br>Updated option $option";
568
+ echo "<br>oldval: ";
569
+ bonny_d($oldval);
570
+ echo "<br>newval:";
571
+ bonny_d($newval);
572
+ */
573
+
574
+ }
575
+
576
+ // debug to file
577
+ // short for "bonny_file_debug" :)
578
+ function b_fd($str) {
579
+ $file = "/Users/bonny/Dropbox/localhost/wordpress3/wp-content/plugins/simple-history/debug.txt";
580
+ #$f = fopen($file, "+a");
581
+ file_put_contents($file, $str, FILE_APPEND);
582
+ }
583
+
584
+ /*
585
+ function simple_history_updated_option2($option, $oldval) {
586
+ echo "<br><br>xxx_simple_history_updated_option2";
587
+ bonny_d($option);
588
+ bonny_d($oldval);
589
+ }
590
+ function simple_history_updated_option3($option) {
591
+ echo "<br><br>xxx_simple_history_updated_option3";
592
+ echo "<br>option: $option";
593
+ }
594
+ */
595
+
596
+
597
+ function simple_history_add_attachment($attachment_id) {
598
+ $post = get_post($attachment_id);
599
+ $post_title = urlencode(get_the_title($post->ID));
600
+ simple_history_add("action=" . __( 'added', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title");
601
+
602
+ }
603
+ function simple_history_edit_attachment($attachment_id) {
604
+ // is this only being called if the title of the attachment is changed?!
605
+ $post = get_post($attachment_id);
606
+ $post_title = urlencode(get_the_title($post->ID));
607
+ simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title");
608
+ }
609
+ function simple_history_delete_attachment($attachment_id) {
610
+ $post = get_post($attachment_id);
611
+ $post_title = urlencode(get_the_title($post->ID));
612
+ simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title");
613
+ }
614
+
615
+ // user is updated
616
+ function simple_history_profile_update($user_id) {
617
+ $user = get_user_by("id", $user_id);
618
+ $user_nicename = urlencode($user->user_nicename);
619
+ simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') . "&object_id=$user_id&object_name=$user_nicename");
620
+ }
621
+
622
+ // user is created
623
+ function simple_history_user_register($user_id) {
624
+ $user = get_user_by("id", $user_id);
625
+ $user_nicename = urlencode($user->user_nicename);
626
+ simple_history_add("action=created&object_type=user&object_id=$user_id&object_name=$user_nicename");
627
+ }
628
+
629
+ // user is deleted
630
+ function simple_history_delete_user($user_id) {
631
+ $user = get_user_by("id", $user_id);
632
+ $user_nicename = urlencode($user->user_nicename);
633
+ simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') . "&object_id=$user_id&object_name=$user_nicename");
634
+ }
635
+
636
+ // user logs in
637
+ function simple_history_wp_login($user) {
638
+ $current_user = wp_get_current_user();
639
+ $user = get_user_by("login", $user);
640
+ $user_nicename = urlencode($user->user_nicename);
641
+ // if user id = null then it's because we are logged out and then no one is acutally loggin in.. like a.. ghost-user!
642
+ if ($current_user->ID == 0) {
643
+ $user_id = $user->ID;
644
+ } else {
645
+ $user_id = $current_user->ID;
646
+ }
647
+ 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");
648
+ }
649
+ // user logs out
650
+ function simple_history_wp_logout() {
651
+ $current_user = wp_get_current_user();
652
+ $current_user_id = $current_user->ID;
653
+ $user_nicename = urlencode($current_user->user_nicename);
654
+ simple_history_add("action=" . __( 'logged out', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') ."&object_id=$current_user_id&object_name=$user_nicename");
655
+ }
656
+
657
+ function simple_history_delete_post($post_id) {
658
+ if (wp_is_post_revision($post_id) == false) {
659
+ $post = get_post($post_id);
660
+ if ($post->post_status != "auto-draft" && $post->post_status != "inherit") {
661
+ $post_title = urlencode(get_the_title($post->ID));
662
+ simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Post') ."&object_subtype=" . $post->post_type . "&object_id=$post_id&object_name=$post_title");
663
+ }
664
+ }
665
+ }
666
+
667
+ function simple_history_save_post($post_id) {
668
+
669
+ if (wp_is_post_revision($post_id) == false) {
670
+ // not a revision
671
+ // it should also not be of type auto draft
672
+ $post = get_post($post_id);
673
+ if ($post->post_status != "auto-draft") {
674
+ // bonny_d($post);
675
+ #echo "save";
676
+ // [post_title] => neu
677
+ // [post_type] => page
678
+ }
679
+
680
+ }
681
+ }
682
+
683
+ // post has changed status
684
+ function simple_history_transition_post_status($new_status, $old_status, $post) {
685
+
686
+ #echo "<br>From $old_status to $new_status";
687
+
688
+ // From new to auto-draft <- ignore
689
+ // From new to inherit <- ignore
690
+ // From auto-draft to draft <- page/post created
691
+ // From draft to draft
692
+ // From draft to pending
693
+ // From pending to publish
694
+ # From pending to trash
695
+ // if not from & to = same, then user has changed something
696
+ //bonny_d($post); // regular post object
697
+ if ($old_status == "auto-draft" && ($new_status != "auto-draft" && $new_status != "inherit")) {
698
+ // page created
699
+ $action = __( "created", 'simple-history' );
700
+ } elseif ($new_status == "auto-draft" || ($old_status == "new" && $new_status == "inherit")) {
701
+ // page...eh.. just leave it.
702
+ return;
703
+ } elseif ($new_status == "trash") {
704
+ $action = __( "deleted", 'simple-history' );
705
+ } else {
706
+ // page updated. i guess.
707
+ $action = __( "updated", 'simple-history' );
708
+ }
709
+ $object_type = "post";
710
+ $object_subtype = $post->post_type;
711
+
712
+ // Attempt to auto-translate post types*/
713
+ $object_type = __( ucfirst ( $object_type ) );
714
+ $object_subtype = __( ucfirst ( $object_subtype ) );
715
+
716
+ if ($object_subtype == "revision") {
717
+ // don't log revisions
718
+ return;
719
+ }
720
+
721
+ if (wp_is_post_revision($post->ID) === false) {
722
+ // ok, no revision
723
+ $object_id = $post->ID;
724
+ } else {
725
+ return;
726
+ }
727
+
728
+ $post_title = get_the_title($post->ID);
729
+ $post_title = urlencode($post_title);
730
+
731
+ simple_history_add("action=$action&object_type=$object_type&object_subtype=$object_subtype&object_id=$object_id&object_name=$post_title");
732
+ }
733
+
734
+
735
+ /**
736
+ * add event to history table
737
+ */
738
+ function simple_history_add($args) {
739
+
740
+ $defaults = array(
741
+ "action" => null,
742
+ "object_type" => null,
743
+ "object_subtype" => null,
744
+ "object_id" => null,
745
+ "object_name" => null,
746
+ "user_id" => null,
747
+ );
748
+
749
+ $args = wp_parse_args( $args, $defaults );
750
+
751
+ $action = mysql_real_escape_string($args["action"]);
752
+ $object_type = $args["object_type"];
753
+ $object_subtype = $args["object_subtype"];
754
+ $object_id = $args["object_id"];
755
+ $object_name = mysql_real_escape_string($args["object_name"]);
756
+ $user_id = $args["user_id"];
757
+
758
+ global $wpdb;
759
+ $tableprefix = $wpdb->prefix;
760
+ if ($user_id) {
761
+ $current_user_id = $user_id;
762
+ } else {
763
+ $current_user = wp_get_current_user();
764
+ $current_user_id = (int) $current_user->ID;
765
+ }
766
+
767
+ // date, store at utc or local time
768
+ // anything is better than now() anyway!
769
+ // WP seems to use the local time, so I will go with that too I think
770
+ // GMT/UTC-time is: date_i18n($timezone_format, false, 'gmt'));
771
+ // local time is: date_i18n($timezone_format));
772
+ $localtime = current_time("mysql");
773
+ $sql = "INSERT INTO {$tableprefix}simple_history SET date = '$localtime', action = '$action', object_type = '$object_type', object_subtype = '$object_subtype', user_id = '$current_user_id', object_id = '$object_id', object_name = '$object_name'";
774
+ $wpdb->query($sql);
775
+ }
776
+
777
+ /**
778
+ * Removes old entries from the db
779
+ * @todo: let user set value, if any
780
+ */
781
+ function simple_history_purge_db() {
782
+ global $wpdb;
783
+ $tableprefix = $wpdb->prefix;
784
+ $sql = "DELETE FROM {$tableprefix}simple_history WHERE DATE_ADD(date, INTERVAL 60 DAY) < now()";
785
+ $wpdb->query($sql);
786
+ }
787
+
788
+ function simple_history_management_page() {
789
+
790
+ simple_history_purge_db();
791
+
792
+ ?>
793
+
794
+ <div class="wrap">
795
+ <h2><?php echo __("History", 'simple-history') ?></h2>
796
+ <?php
797
+ simple_history_print_nav(array("from_page=1"));
798
+ simple_history_print_history(array("items" => 5, "from_page" => "1"));
799
+ ?>
800
+ </div>
801
+
802
+ <?php
803
+
804
+ }
805
+
806
+ if (!function_exists("bonny_d")) {
807
+ function bonny_d($var) {
808
+ echo "<pre>";
809
+ print_r($var);
810
+ echo "</pre>";
811
+ }
812
+ }
813
+
814
+ // when activating plugin: create tables
815
+ // __FILE__ doesnt work for me because of soft linkes directories
816
+ register_activation_hook( WP_PLUGIN_DIR . "/simple-history/index.php" , 'simple_history_install' );
817
+
818
+ /*
819
+ The theory behind the right way to do this. The proper way to handle an upgrade path is to only
820
+ run an upgrade procedure when you need to. Ideally, you would store a “version” in your
821
+ plugin’s database option, and then a version in the code. If they do not match, you
822
+ would fire your upgrade procedure, and then set the database option to equal the version in
823
+ the code. This is how many plugins handle upgrades, and this is how core works as well.
824
+ */
825
+
826
+ // when installing plugin: create table
827
+ function simple_history_install() {
828
+
829
+ global $wpdb;
830
+
831
+ $table_name = $wpdb->prefix . "simple_history";
832
+ #if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
833
+
834
+ $sql = "CREATE TABLE " . $table_name . " (
835
+ id int(10) NOT NULL AUTO_INCREMENT,
836
+ date datetime NOT NULL,
837
+ action varchar(255) NOT NULL COLLATE utf8_general_ci,
838
+ object_type varchar(255) NOT NULL COLLATE utf8_general_ci,
839
+ object_subtype VARCHAR(255) NOT NULL COLLATE utf8_general_ci,
840
+ user_id int(10) NOT NULL,
841
+ object_id int(10) NOT NULL,
842
+ object_name varchar(255) NOT NULL COLLATE utf8_general_ci,
843
+ PRIMARY KEY (id)
844
+ ) CHARACTER SET=utf8;";
845
+
846
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
847
+ dbDelta($sql);
848
+
849
+ // add ourself as a history item.
850
+ $plugin_name = urlencode(SIMPLE_HISTORY_NAME);
851
+
852
+ #}
853
+
854
+ simple_history_add("action=" . __( 'activated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name");
855
+
856
+ // also generate a rss secret, if it does not exist
857
+ if (!get_option("simple_history_rss_secret")) {
858
+ simple_history_update_rss_secret();
859
+ }
860
+
861
+ update_option("simple_history_version", SIMPLE_HISTORY_VERSION);
862
+
863
+ }
864
+
865
+ function simple_history_print_nav() {
866
+
867
+ global $wpdb;
868
+ $tableprefix = $wpdb->prefix;
869
+
870
+ // fetch all types that are in the log
871
+ if (isset($_GET["simple_history_type_to_show"])) {
872
+ $simple_history_type_to_show = $_GET["simple_history_type_to_show"];
873
+ } else {
874
+ $simple_history_type_to_show = "";
875
+ }
876
+ $sql = "SELECT DISTINCT object_type, object_subtype FROM {$tableprefix}simple_history ORDER BY object_type, object_subtype";
877
+ $arr_types = $wpdb->get_results($sql);
878
+ #echo "<p>View:</p>";
879
+ $str_types = "";
880
+ $str_types .= "<ul class='simple-history-filter simple-history-filter-type'>";
881
+ $css = "";
882
+ if (empty($simple_history_type_to_show)) {
883
+ $css = "class='selected'";
884
+ }
885
+
886
+ // add_query_arg(
887
+ $link = esc_html(add_query_arg("simple_history_type_to_show", ""));
888
+ $str_types_desc = __("All types", 'simple-history');
889
+ $str_types .= "<li $css><a href='$link'>" . esc_html($str_types_desc) . "</a> | </li>";
890
+ foreach ($arr_types as $one_type) {
891
+ $css = "";
892
+ if ($one_type->object_subtype && $simple_history_type_to_show == ($one_type->object_type."/".$one_type->object_subtype)) {
893
+ $css = "class='selected'";
894
+ } elseif (!$one_type->object_subtype && $simple_history_type_to_show == $one_type->object_type) {
895
+ $css = "class='selected'";
896
+ }
897
+ $str_types .= "<li $css>";
898
+ $arg = "";
899
+ if ($one_type->object_subtype) {
900
+ $arg = $one_type->object_type."/".$one_type->object_subtype;
901
+ } else {
902
+ $arg = $one_type->object_type;
903
+ }
904
+ $link = esc_html(add_query_arg("simple_history_type_to_show", $arg));
905
+ $str_types .= "<a href='$link'>";
906
+ $str_types .= esc_html($one_type->object_type);
907
+ if ($one_type->object_subtype) {
908
+ $str_types .= "/". esc_html($one_type->object_subtype);
909
+ }
910
+ $str_types .= "</a> | ";
911
+ $str_types .= "</li>";
912
+ }
913
+ $str_types .= "</ul>";
914
+ $str_types = str_replace("| </li></ul>", "</li></ul>", $str_types);
915
+ if (!empty($arr_types)) {
916
+ echo $str_types;
917
+ }
918
+
919
+ // fetch all users that are in the log
920
+ $sql = "SELECT DISTINCT user_id FROM {$tableprefix}simple_history WHERE user_id <> 0";
921
+ $arr_users_regular = $wpdb->get_results($sql);
922
+ foreach ($arr_users_regular as $one_user) {
923
+ $arr_users[$one_user->user_id] = array("user_id" => $one_user->user_id);
924
+ }
925
+ if (!empty($arr_users)) {
926
+ foreach ($arr_users as $user_id => $one_user) {
927
+ $user = get_user_by("id", $user_id);
928
+ if ($user) {
929
+ $arr_users[$user_id]["user_login"] = $user->user_login;
930
+ $arr_users[$user_id]["user_nicename"] = $user->user_nicename;
931
+ if (isset($user->first_name)) {
932
+ $arr_users[$user_id]["first_name"] = $user->first_name;
933
+ }
934
+ if (isset($user->last_name)) {
935
+ $arr_users[$user_id]["last_name"] = $user->last_name;
936
+ }
937
+ }
938
+ }
939
+ }
940
+
941
+ if ($arr_users) {
942
+ if (isset($_GET["simple_history_user_to_show"])) {
943
+ $simple_history_user_to_show = $_GET["simple_history_user_to_show"];
944
+ } else {
945
+ $simple_history_user_to_show = "";
946
+ }
947
+ $str_users = "";
948
+ $str_users .= "<ul class='simple-history-filter simple-history-filter-user'>";
949
+ $css = "";
950
+ if (empty($simple_history_user_to_show)) {
951
+ $css = " class='selected' ";
952
+ }
953
+ $link = esc_html(add_query_arg("simple_history_user_to_show", ""));
954
+ $str_users .= "<li $css><a href='$link'>" . __("By all users", 'simple-history') ."</a> | </li>";
955
+ foreach ($arr_users as $user_id => $user_info) {
956
+ $link = esc_html(add_query_arg("simple_history_user_to_show", $user_id));
957
+ $css = "";
958
+ if ($user_id == $simple_history_user_to_show) {
959
+ $css = " class='selected' ";
960
+ }
961
+ $str_users .= "<li $css>";
962
+ $str_users .= "<a href='$link'>";
963
+ $str_users .= $user_info["user_nicename"];
964
+ $str_users .= "</a> | ";
965
+ $str_users .= "</li>";
966
+ }
967
+ $str_users .= "</ul>";
968
+ $str_users = str_replace("| </li></ul>", "</li></ul>", $str_users);
969
+ echo $str_users;
970
+ }
971
+
972
+ // search
973
+ $str_search = __("Search", 'simple-history');
974
+ $search = "<p class='simple-history-filter simple-history-filter-search'>
975
+ <input type='text' />
976
+ <input type='button' value='$str_search' class='button' />
977
+ </p>";
978
+ echo $search;
979
+
980
+
981
+ }
982
+
983
+
984
+ // return an array with all events and occasions
985
+ function simple_history_get_items_array($args) {
986
+
987
+ global $wpdb;
988
+
989
+ $defaults = array(
990
+ "page" => 0,
991
+ "items" => 5,
992
+ "filter_type" => "",
993
+ "filter_user" => "",
994
+ "is_ajax" => false,
995
+ "search" => "",
996
+ "num_added" => 0
997
+ );
998
+ $args = wp_parse_args( $args, $defaults );
999
+
1000
+ $simple_history_type_to_show = $args["filter_type"];
1001
+ $simple_history_user_to_show = $args["filter_user"];
1002
+
1003
+ $where = " WHERE 1=1 ";
1004
+ if ($simple_history_type_to_show) {
1005
+ $filter_type = "";
1006
+ $filter_subtype = "";
1007
+ if (strpos($simple_history_type_to_show, "/") !== false) {
1008
+ // split it up
1009
+ $arr_args = explode("/", $simple_history_type_to_show);
1010
+ $filter_type = $arr_args[0];
1011
+ $filter_subtype = $arr_args[1];
1012
+ } else {
1013
+ $filter_type = $simple_history_type_to_show;
1014
+ }
1015
+ $where .= " AND lower(object_type) = '".strtolower($filter_type)."' ";
1016
+ $where .= " AND lower(object_subtype) = '".strtolower($filter_subtype)."' ";
1017
+ }
1018
+ if ($simple_history_user_to_show) {
1019
+
1020
+ $userinfo = get_user_by("slug", $simple_history_user_to_show);
1021
+
1022
+ if (isset($userinfo->ID)) {
1023
+ $where .= " AND user_id = '" . $userinfo->ID . "'";
1024
+ }
1025
+
1026
+ }
1027
+
1028
+ $tableprefix = $wpdb->prefix;
1029
+
1030
+ $sql = "SELECT * FROM {$tableprefix}simple_history $where ORDER BY date DESC, id DESC ";
1031
+
1032
+ $rows = $wpdb->get_results($sql);
1033
+
1034
+ $loopNum = 0;
1035
+ $real_loop_num = -1;
1036
+
1037
+ $search = strtolower($args["search"]);
1038
+
1039
+ $arr_events = array();
1040
+ if ($rows) {
1041
+ $prev_row = null;
1042
+ foreach ($rows as $one_row) {
1043
+ if (
1044
+ $prev_row
1045
+ && $one_row->action == $prev_row->action
1046
+ && $one_row->object_type == $prev_row->object_type
1047
+ && $one_row->object_type == $prev_row->object_type
1048
+ && $one_row->object_subtype == $prev_row->object_subtype
1049
+ && $one_row->user_id == $prev_row->user_id
1050
+ && $one_row->object_id == $prev_row->object_id
1051
+ && $one_row->object_name == $prev_row->object_name
1052
+ ) {
1053
+ // this event is like the previous event, but only with a different date
1054
+ // so add it to the last element in arr_events
1055
+ $arr_events[$prev_row->id]->occasions[] = $one_row;
1056
+ } else {
1057
+
1058
+ #echo "<br>real_loop_num: $real_loop_num";
1059
+ #echo "<br>loop_num: $loopNum";
1060
+
1061
+ // check if we have a search. of so, only add if there is a match
1062
+ $do_add = FALSE;
1063
+ if ($search) {
1064
+ /* echo "<br>search: $search";
1065
+ echo "<br>object_name_lower: $object_name_lower";
1066
+ echo "<br>objecttype: " . $one_row->object_type;
1067
+ echo "<br>object_subtype: " . $one_row->object_subtype;
1068
+ // */
1069
+ if (strpos(strtolower($one_row->object_name), $search) !== FALSE) {
1070
+ $do_add = TRUE;
1071
+ } else if (strpos(strtolower($one_row->object_type), $search) !== FALSE) {
1072
+ $do_add = TRUE;
1073
+ } else if (strpos(strtolower($one_row->object_subtype), $search) !== FALSE) {
1074
+ $do_add = TRUE;
1075
+ }
1076
+ } else {
1077
+ $do_add = TRUE;
1078
+ }
1079
+
1080
+ if ($do_add) {
1081
+ $real_loop_num++;
1082
+ }
1083
+
1084
+ // new event, not as previous one
1085
+ if ($do_add) {
1086
+ $arr_events[$one_row->id] = $one_row;
1087
+ $arr_events[$one_row->id]->occasions = array();
1088
+ $loopNum++;
1089
+ $prev_row = $one_row;
1090
+ }
1091
+
1092
+ }
1093
+ }
1094
+
1095
+ }
1096
+
1097
+ // arr_events is now all events
1098
+ // but we only want some of them
1099
+ // limit by using
1100
+ // num_added = number of prev added items
1101
+ // items = number of items to get
1102
+ /*sf_d($args["num_added"]);
1103
+ sf_d($args["items"]);
1104
+ sf_d($arr_events);
1105
+ // */
1106
+ $arr_events = array_splice($arr_events, $args["num_added"], $args["items"]);
1107
+
1108
+ return $arr_events;
1109
+
1110
+ }
1111
+
1112
+ // output the log
1113
+ // take filtrering into consideration
1114
+ function simple_history_print_history($args = null) {
1115
+
1116
+ $arr_events = simple_history_get_items_array($args);
1117
+
1118
+ $defaults = array(
1119
+ "page" => 0,
1120
+ "items" => 5,
1121
+ "filter_type" => "",
1122
+ "filter_user" => "",
1123
+ "is_ajax" => false
1124
+ );
1125
+
1126
+ $args = wp_parse_args( $args, $defaults );
1127
+
1128
+ if ($arr_events) {
1129
+ if (!$args["is_ajax"]) {
1130
+ // if not ajax, print the div
1131
+ echo "<div class='simple-history-ol-wrapper'><ol class='simple-history'>";
1132
+ }
1133
+
1134
+ $loopNum = 0;
1135
+ $real_loop_num = -1;
1136
+ foreach ($arr_events as $one_row) {
1137
+
1138
+ $real_loop_num++;
1139
+
1140
+ $object_type = $one_row->object_type;
1141
+ $object_type_lcase = strtolower($object_type);
1142
+ $object_subtype = $one_row->object_subtype;
1143
+ $object_id = $one_row->object_id;
1144
+ $object_name = $one_row->object_name;
1145
+ $user_id = $one_row->user_id;
1146
+ $action = $one_row->action;
1147
+ $occasions = $one_row->occasions;
1148
+ $num_occasions = sizeof($occasions);
1149
+
1150
+ $css = "";
1151
+ if ("attachment" == $object_type_lcase) {
1152
+ if (wp_get_attachment_image_src($object_id, array(50,50), true)) {
1153
+ // yep, it's an attachment and it has an icon/thumbnail
1154
+ $css .= ' simple-history-has-attachment-thumnbail ';
1155
+ }
1156
+ }
1157
+ if ("user" == $object_type_lcase) {
1158
+ $css .= ' simple-history-has-attachment-thumnbail ';
1159
+ }
1160
+
1161
+ if ($num_occasions > 0) {
1162
+ $css .= ' simple-history-has-occasions ';
1163
+ }
1164
+
1165
+ echo "<li class='$css'>";
1166
+
1167
+ echo "<div class='first'>";
1168
+
1169
+ // who performed the action
1170
+ $who = "";
1171
+ $user = get_user_by("id", $user_id); // false if user does not exist
1172
+
1173
+ if ($user) {
1174
+ $user_avatar = get_avatar($user->user_email, "32");
1175
+ $user_link = "user-edit.php?user_id={$user->ID}";
1176
+ $who_avatar = sprintf('<a class="simple-history-who-avatar" href="%2$s">%1$s</a>', $user_avatar, $user_link);
1177
+ } else {
1178
+ $user_avatar = get_avatar("", "32");
1179
+ $who_avatar = sprintf('<span class="simple-history-who-avatar">%1$s</span>', $user_avatar);
1180
+ }
1181
+ echo $who_avatar;
1182
+
1183
+ // section with info about the user who did something
1184
+ $who .= "<span class='who'>";
1185
+ if ($user) {
1186
+ $who .= sprintf('<a href="%2$s">%1$s</a>', $user->user_nicename, $user_link);
1187
+ if (isset($user->first_name) || isset($user->last_name)) {
1188
+ if ($user->first_name || $user->last_name) {
1189
+ $who .= " (";
1190
+ if ($user->first_name && $user->last_name) {
1191
+ $who .= esc_html($user->first_name) . " " . esc_html($user->last_name);
1192
+ } else {
1193
+ $who .= esc_html($user->first_name) . esc_html($user->last_name); // just one of them, no space necessary
1194
+ }
1195
+ $who .= ")";
1196
+ }
1197
+ }
1198
+ } else {
1199
+ $who .= "&lt;" . __("Unknown or deleted user", 'simple-history') ."&gt;";
1200
+ }
1201
+ $who .= "</span>";
1202
+ // &rarr;
1203
+
1204
+ /*
1205
+ sf_d($one_row);
1206
+ [object_type] => Post
1207
+ [object_subtype] => Page
1208
+ somewhere/somewhow object_type turned from being lowercase to being capitalized
1209
+ unsure if it's me or wp
1210
+ ah: after some digging it seems to have with translation to do, we changed to upperase
1211
+ to support translation.
1212
+ */
1213
+
1214
+ // what and object
1215
+ if ("post" == $object_type_lcase) {
1216
+
1217
+ $post_out = "";
1218
+ $post_out .= $object_subtype;
1219
+ $post = get_post($object_id);
1220
+
1221
+ if (null == $post) {
1222
+ // post does not exist, probably deleted
1223
+ // check if object_name exists
1224
+ if ($object_name) {
1225
+ $post_out .= " <span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span>";
1226
+ } else {
1227
+ $post_out .= " <span class='simple-history-title'>&lt;unknown name&gt;</span>";
1228
+ }
1229
+ } else {
1230
+ #$title = esc_html($post->post_title);
1231
+ $title = get_the_title($post->ID);
1232
+ $title = esc_html($title);
1233
+ $edit_link = get_edit_post_link($object_id, 'display');
1234
+ $post_out .= " <a href='$edit_link'>";
1235
+ $post_out .= "<span class='simple-history-title'>{$title}</span>";
1236
+ $post_out .= "</a>";
1237
+ }
1238
+ /*
1239
+ if ("created" == $action) {
1240
+ $post_out .= " " . __("created", 'simple-history') . " ";
1241
+ } elseif ("updated" == $action) {
1242
+ $post_out .= " " . __("updated", 'simple-history') . " ";
1243
+ } elseif ("deleted" == $action) {
1244
+ $post_out .= " " . __("deleted", 'simple-history') . " ";
1245
+ } else {
1246
+ */
1247
+ $post_out .= " " . esc_html($action);
1248
+ //}
1249
+
1250
+ $post_out = ucfirst($post_out);
1251
+ echo $post_out;
1252
+
1253
+
1254
+ } elseif ("attachment" == $object_type_lcase) {
1255
+
1256
+ $attachment_out = "";
1257
+ $attachment_out .= __("attachment", 'simple-history') . " ";
1258
+
1259
+ $post = get_post($object_id);
1260
+
1261
+ if ($post) {
1262
+ $title = esc_html(get_the_title($post->ID));
1263
+ $edit_link = get_edit_post_link($object_id, 'display');
1264
+ $attachment_image_src = wp_get_attachment_image_src($object_id, array(50,50), true);
1265
+ $attachment_image = "";
1266
+ if ($attachment_image_src) {
1267
+ $attachment_image = "<a class='simple-history-attachment-thumbnail' href='$edit_link'><img src='{$attachment_image_src[0]}' alt='Attachment icon' width='{$attachment_image_src[1]}' height='{$attachment_image_src[2]}' /></a>";
1268
+ }
1269
+ $attachment_out .= $attachment_image;
1270
+ $attachment_out .= " <a href='$edit_link'>";
1271
+ $attachment_out .= "<span class='simple-history-title'>{$title}</span>";
1272
+ $attachment_out .= "</a>";
1273
+
1274
+ } else {
1275
+ if ($object_name) {
1276
+ $attachment_out .= "<span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span>";
1277
+ } else {
1278
+ $attachment_out .= " <span class='simple-history-title'>&lt;deleted&gt;</span>";
1279
+ }
1280
+ }
1281
+
1282
+ $attachment_out .= " $action ";
1283
+
1284
+ $attachment_out = ucfirst($attachment_out);
1285
+ echo $attachment_out;
1286
+
1287
+ } elseif ("user" == $object_type_lcase) {
1288
+ $user_out = "";
1289
+ $user_out .= __("user", 'simple-history');
1290
+ $user = get_user_by("id", $object_id);
1291
+ if ($user) {
1292
+ $user_link = "user-edit.php?user_id={$user->ID}";
1293
+ $user_out .= "<span class='simple-history-title'>";
1294
+ $user_out .= " <a href='$user_link'>";
1295
+ $user_out .= $user->user_nicename;
1296
+ $user_out .= "</a>";
1297
+ if (isset($user->first_name) && isset($user->last_name)) {
1298
+ if ($user->first_name || $user->last_name) {
1299
+ $user_out .= " (";
1300
+ if ($user->first_name && $user->last_name) {
1301
+ $user_out .= esc_html($user->first_name) . " " . esc_html($user->last_name);
1302
+ } else {
1303
+ $user_out .= esc_html($user->first_name) . esc_html($user->last_name); // just one of them, no space necessary
1304
+ }
1305
+ $user_out .= ")";
1306
+ }
1307
+ }
1308
+ $user_out .= "</span>";
1309
+ } else {
1310
+ // most likely deleted user
1311
+ $user_link = "";
1312
+ $user_out .= " \"" . esc_html($object_name) . "\"";
1313
+ }
1314
+
1315
+ $user_avatar = get_avatar($user->user_email, "50");
1316
+ if ($user_link) {
1317
+ $user_out .= "<a class='simple-history-attachment-thumbnail' href='$user_link'>$user_avatar</a>";
1318
+ } else {
1319
+ $user_out .= "<span class='simple-history-attachment-thumbnail' href='$user_link'>$user_avatar</span>";
1320
+ }
1321
+
1322
+ /*
1323
+ if ("created" == $action) {
1324
+ $user_out .= " " . __("added", 'simple-history') . " ";
1325
+ } elseif ("updated" == $action) {
1326
+ $user_out .= " " . __("updated", 'simple-history') . " " ;
1327
+ } elseif ("deleted" == $action) {
1328
+ $user_out .= " " . __("deleted", 'simple-history') . " ";
1329
+ } elseif ("logged_in" == $action) {
1330
+ $user_out .= " " . __("logged in", 'simple-history') . " ";
1331
+ } elseif ("logged_out" == $action) {
1332
+ $user_out .= " " . __("logged out", 'simple-history') . " ";
1333
+ } else {
1334
+ */
1335
+ $user_out .= " " . esc_html($action);
1336
+ //}
1337
+
1338
+ $user_out = ucfirst($user_out);
1339
+ echo $user_out;
1340
+
1341
+ } elseif ("comment" == $object_type_lcase) {
1342
+
1343
+ $comment_link = get_edit_comment_link($object_id);
1344
+ 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);
1345
+
1346
+ } else {
1347
+
1348
+ // unknown/general type
1349
+ // translate the common types
1350
+ $unknown_action = $action;
1351
+ switch ($unknown_action) {
1352
+ case "activated":
1353
+ $unknown_action = __("activated", 'simple-history');
1354
+ break;
1355
+ case "deactivated":
1356
+ $unknown_action = __("deactivated", 'simple-history');
1357
+ break;
1358
+ case "enabled":
1359
+ $unknown_action = __("enabled", 'simple-history');
1360
+ break;
1361
+ case "disabled":
1362
+ $unknown_action = __("disabled", 'simple-history');
1363
+ break;
1364
+ default:
1365
+ $unknown_action = $unknown_action; // dah!
1366
+ }
1367
+ echo esc_html(ucwords($object_type)) . " " . esc_html($object_subtype) . " <span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span> " . esc_html($unknown_action);
1368
+
1369
+ }
1370
+ echo "</div>";
1371
+
1372
+ echo "<div class='second'>";
1373
+ // when
1374
+ $date_i18n_date = date_i18n(get_option('date_format'), strtotime($one_row->date), $gmt=false);
1375
+ $date_i18n_time = date_i18n(get_option('time_format'), strtotime($one_row->date), $gmt=false);
1376
+ $now = strtotime(current_time("mysql"));
1377
+ $diff_str = sprintf( __('<span class="when">%1$s ago</span> by %2$s'), human_time_diff(strtotime($one_row->date), $now), $who );
1378
+ echo $diff_str;
1379
+ echo "<span class='when_detail'>".sprintf(__('%s at %s', 'simple-history'), $date_i18n_date, $date_i18n_time)."</span>";
1380
+ echo "</div>";
1381
+
1382
+ // occasions
1383
+ if ($num_occasions > 0) {
1384
+ echo "<div class='third'>";
1385
+ if ($num_occasions == 1) {
1386
+ $one_occasion = __("+ 1 occasion", 'simple-history');
1387
+ echo "<a class='simple-history-occasion-show' href='#'>$one_occasion</a>";
1388
+ } else {
1389
+ $many_occasion = sprintf(__("+ %d occasions", 'simple-history'), $num_occasions);
1390
+ echo "<a class='simple-history-occasion-show' href='#'>$many_occasion</a>";
1391
+ }
1392
+ echo "<ul class='simple-history-occasions hidden'>";
1393
+ foreach ($occasions as $one_occasion) {
1394
+ echo "<li>";
1395
+ $date_i18n_date = date_i18n(get_option('date_format'), strtotime($one_occasion->date), $gmt=false);
1396
+ $date_i18n_time = date_i18n(get_option('time_format'), strtotime($one_occasion->date), $gmt=false);
1397
+ echo sprintf( __('%s ago (%s at %s)', "simple-history"), human_time_diff(strtotime($one_occasion->date), $now), $date_i18n_date, $date_i18n_time );
1398
+
1399
+ echo "</li>";
1400
+ }
1401
+ echo "</ul>";
1402
+ echo "</div>";
1403
+ }
1404
+
1405
+
1406
+ echo "</li>";
1407
+
1408
+ $loopNum++;
1409
+
1410
+
1411
+ }
1412
+
1413
+ // if $loopNum == 0 no items where found for this page
1414
+ if ($loopNum == 0) {
1415
+ echo "simpleHistoryNoMoreItems";
1416
+ }
1417
+
1418
+ if (!$args["is_ajax"]) {
1419
+
1420
+ // if not ajax, print the divs and stuff we need
1421
+ $show_more = "<select>";
1422
+ $show_more .= sprintf('<option value=5 %2$s>%1$s</option>', __("Show 5 more", 'simple-history'), ($args["items"] == 5 ? " selected " : "") );
1423
+ $show_more .= sprintf('<option value=15 %2$s>%1$s</option>', __("Show 15 more", 'simple-history'), ($args["items"] == 15 ? " selected " : "") );
1424
+ $show_more .= sprintf('<option value=50 %2$s>%1$s</option>', __("Show 50 more", 'simple-history'), ($args["items"] == 50 ? " selected " : "") );
1425
+ $show_more .= sprintf('<option value=100 %2$s>%1$s</option>', __("Show 100 more", 'simple-history'), ($args["items"] == 100 ? " selected " : "") );
1426
+ $show_more .= "</select>";
1427
+
1428
+ $loading = __("Loading...", 'simple-history');
1429
+ $loading = "<img src='".site_url("wp-admin/images/loading.gif")."' width=16 height=16>" . $loading;
1430
+ $no_more_found = __("No more history items found.", 'simple-history');
1431
+ $view_rss = __("RSS feed", 'simple-history');
1432
+ $view_rss_link = simple_history_get_rss_address();
1433
+ $str_show = __("Show", 'simple-history');
1434
+ echo "</ol>
1435
+ </div>
1436
+ <p class='simple-history-load-more'>$show_more<input type='button' value='$str_show' class='button' /></p>
1437
+ <p class='hidden simple-history-load-more-loading'>$loading</p>
1438
+ <p class='hidden simple-history-no-more-items'>$no_more_found</p>
1439
+ <p class='simple-history-rss-feed-dashboard'><a title='$view_rss' href='$view_rss_link'>$view_rss</a></p>
1440
+ <p class='simple-history-rss-feed-page'><a title='$view_rss' href='$view_rss_link'><span></span>$view_rss</a></p>
1441
+ ";
1442
+ }
1443
+
1444
+ } else {
1445
+
1446
+ if ($args["is_ajax"]) {
1447
+ echo "simpleHistoryNoMoreItems";
1448
+ } else {
1449
+ $no_found = __("No history items found.", 'simple-history');
1450
+ $please_note = __("Please note that Simple History only records things that happen after this plugin have been installed.", 'simple-history');
1451
+ echo "<p>$no_found</p>";
1452
+ echo "<p>$please_note</p>";
1453
+ }
1454
+
1455
+ }
1456
+ }
1457
+
1458
+ // called when saving an options page
1459
+ function simple_history_add_update_option_page($capability = NULL, $option_page = NULL) {
1460
+
1461
+ $arr_options_names = array(
1462
+ "general" => __("General Settings"),
1463
+ "writing" => __("Writing Settings"),
1464
+ "reading" => __("Reading Settings"),
1465
+ "discussion" => __("Discussion Settings"),
1466
+ "media" => __("Media Settings"),
1467
+ "privacy" => __("Privacy Settings")
1468
+ );
1469
+
1470
+ $option_page_name = "";
1471
+ if (isset($arr_options_names[$option_page])) {
1472
+ $option_page_name = $arr_options_names[$option_page];
1473
+ simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name");
1474
+ }
1475
+
1476
+ return $capability;
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
+
trunk/languages/simple-history-de_DE.mo ADDED
Binary file
trunk/languages/simple-history-de_DE.po ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of the WordPress plugin by .
2
+ # Copyright (C) 2010
3
+ # This file is distributed under the same license as the package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: Simple History 0.4\n"
9
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-history\n"
10
+ "POT-Creation-Date: 2010-09-19 18:24+0000\n"
11
+ "PO-Revision-Date: 2012-02-22 14:15+0100\n"
12
+ "Last-Translator: Ralph Stenzel <ralph@klein-aber-fein.de>\n"
13
+ "Language-Team: Ralph Stenzel <ralph@klein-aber-fein.de>\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Poedit-Language: German\n"
18
+ "X-Poedit-Country: GERMANY\n"
19
+ "X-Poedit-SourceCharset: utf-8\n"
20
+
21
+ #: index.php:126
22
+ #: index.php:168
23
+ #, php-format
24
+ msgid "Simple History for %s"
25
+ msgstr "Simple History für %s"
26
+
27
+ #: index.php:127
28
+ #: index.php:169
29
+ #, php-format
30
+ msgid "WordPress History for %s"
31
+ msgstr "WordPress History für %s"
32
+
33
+ #: index.php:139
34
+ #, php-format
35
+ msgid "By %s"
36
+ msgstr "Von %s"
37
+
38
+ #: index.php:143
39
+ #, php-format
40
+ msgid "%d occasions"
41
+ msgstr "%d Fälle"
42
+
43
+ #: index.php:173
44
+ msgid "Wrong RSS secret"
45
+ msgstr "Falsche RSS-Geheimadresse"
46
+
47
+ #: index.php:174
48
+ msgid "Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed."
49
+ msgstr "Ihre RSS-Geheimadresse für den Simple History RSS-Feed ist falsch. Bitte überprüfen Sie die WordPress-Einstellungen hinsichtlich des momentanen Links zum RSS-Feed."
50
+
51
+ #: index.php:247
52
+ msgid "on the dashboard"
53
+ msgstr "auf dem Armaturenbrett (Dashboard)"
54
+
55
+ #: index.php:252
56
+ msgid "as a page under the tools menu"
57
+ msgstr "als eine Seite im Werkzeuge-Menü"
58
+
59
+ #: index.php:283
60
+ msgid "Created new secret RSS adress"
61
+ msgstr "Neue geheime RSS-Adresse erstellt"
62
+
63
+ #: index.php:294
64
+ msgid "This is a secret RSS feed for Simple History. Only share the link with people you trust"
65
+ msgstr "Dies ist ein vertraulicher RSS-Feed für Simple History. Teilen Sie das Link nur mit Leuten Ihres Vertrauens!"
66
+
67
+ #: index.php:297
68
+ #, php-format
69
+ msgid "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."
70
+ msgstr "Sie können für den RSS-Feed <a href='%s'>eine neue Adresse erstellen</a> lassen. Dies ist hilfreich wenn Sie den Verdacht haben, daß die bisherige Adresse in falsche Hände gekommen sein könnte."
71
+
72
+ #: index.php:320
73
+ #: index.php:335
74
+ #: index.php:366
75
+ #, php-format
76
+ msgid "From %1$s on %2$s"
77
+ msgstr "Von %1$s am %2$s"
78
+
79
+ #: index.php:811
80
+ msgid "By all users"
81
+ msgstr "Von allen Benutzern"
82
+
83
+ #: index.php:1031
84
+ msgid "Unknown or deleted user"
85
+ msgstr "Unbekannter oder gelöschter Benutzer"
86
+
87
+ #: index.php:1058
88
+ msgid "created"
89
+ msgstr "erzeugt"
90
+
91
+ #: index.php:1060
92
+ #: index.php:1153
93
+ msgid "updated"
94
+ msgstr "aktualisiert"
95
+
96
+ #: index.php:1062
97
+ #: index.php:1155
98
+ msgid "deleted"
99
+ msgstr "gelöscht"
100
+
101
+ #: index.php:1151
102
+ msgid "added"
103
+ msgstr "hinzugefügt"
104
+
105
+ #: index.php:1157
106
+ msgid "logged in"
107
+ msgstr "angemeldet"
108
+
109
+ #: index.php:1159
110
+ msgid "logged out"
111
+ msgstr "abgemeldet"
112
+
113
+ #: index.php:1193
114
+ msgid "+ 1 occasion"
115
+ msgstr "+ 1 Fall"
116
+
117
+ #: index.php:1196
118
+ #, php-format
119
+ msgid "+ %d occasions"
120
+ msgstr "+ %d Fälle"
121
+
122
+ #: index.php:1225
123
+ #, php-format
124
+ msgid "Show %d more"
125
+ msgstr "Zeige %d weitere"
126
+
127
+ #: index.php:1226
128
+ msgid "Loading..."
129
+ msgstr "Lade..."
130
+
131
+ #: index.php:1227
132
+ msgid "No more history items found."
133
+ msgstr "Keine weiteren Vorfälle gefunden."
134
+
135
+ #: index.php:1228
136
+ msgid "Simple History RSS feed"
137
+ msgstr "Simple History RSS-Feed"
138
+
139
+ #: index.php:1244
140
+ msgid "No history items found."
141
+ msgstr "Keine Vorfälle gefunden."
142
+
143
+ #: index.php:1245
144
+ msgid "Please note that Simple History only records things that happen after this plugin have been installed."
145
+ msgstr "Bitte beachten Sie, daß Simple History nur Vorfälle aufzeichnet, die nach der Installation des Plugins passiert sind."
146
+
trunk/languages/simple-history-sv_SE.mo ADDED
Binary file
trunk/languages/simple-history-sv_SE.po ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Simple History\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-02-07 13:48+0100\n"
6
+ "PO-Revision-Date: 2012-02-09 13:50+0100\n"
7
+ "Last-Translator: Jocke Gustin <jocke.gustin@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: Swedish\n"
14
+ "X-Poedit-Country: SWEDEN\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
+ "X-Poedit-Basepath: .\n"
18
+ "X-Poedit-Bookmarks: \n"
19
+ "X-Poedit-SearchPath-0: ..\n"
20
+ "X-Textdomain-Support: yes"
21
+
22
+ #: index.php:132
23
+ #: index.php:174
24
+ #: index_orig.php:132
25
+ #: index_orig.php:174
26
+ #, php-format
27
+ #@ simple-history
28
+ msgid "Simple History for %s"
29
+ msgstr "Historik för %s"
30
+
31
+ #: index.php:133
32
+ #: index.php:175
33
+ #: index_orig.php:133
34
+ #: index_orig.php:175
35
+ #, php-format
36
+ #@ simple-history
37
+ msgid "WordPress History for %s"
38
+ msgstr "WordPress historik för %s"
39
+
40
+ #: index.php:145
41
+ #: index.php:1201
42
+ #: index_orig.php:145
43
+ #, php-format
44
+ #@ simple-history
45
+ msgid "By %s"
46
+ msgstr "Av %s"
47
+
48
+ #: index.php:149
49
+ #: index_orig.php:149
50
+ #, php-format
51
+ #@ simple-history
52
+ msgid "%d occasions"
53
+ msgstr "%d tillfällen"
54
+
55
+ #: index.php:179
56
+ #: index_orig.php:179
57
+ #@ simple-history
58
+ msgid "Wrong RSS secret"
59
+ msgstr "Fel RSS lösenord"
60
+
61
+ #: index.php:180
62
+ #: index_orig.php:180
63
+ #@ simple-history
64
+ msgid "Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed."
65
+ msgstr "Ditt RSS lösenord är fel. Vänligen gå till WordPress inställningsmeny för en länk till RSS-feed."
66
+
67
+ #: index.php:254
68
+ #: index_orig.php:254
69
+ #@ simple-history
70
+ msgid "on the dashboard"
71
+ msgstr "på adminpanelen"
72
+
73
+ #: index.php:259
74
+ #: index_orig.php:259
75
+ #@ simple-history
76
+ msgid "as a page under the tools menu"
77
+ msgstr "som en sida under verktygsmenyn"
78
+
79
+ #: index.php:296
80
+ #: index_orig.php:296
81
+ #@ simple-history
82
+ msgid "Created new secret RSS adress"
83
+ msgstr "Skapade en ny hemlig RSS address"
84
+
85
+ #: index.php:307
86
+ #: index_orig.php:307
87
+ #@ simple-history
88
+ msgid "This is a secret RSS feed for Simple History. Only share the link with people you trust"
89
+ msgstr "Detta är en hemlig RSS feed för \"Webbplatshistorik\". Dela den bara med personer du litar på."
90
+
91
+ #: index.php:310
92
+ #: index_orig.php:310
93
+ #, fuzzy, php-format, php-format, php-format, php-format, php-format, php-format, php-format, php-format
94
+ #@ simple-history
95
+ msgid "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."
96
+ msgstr "Du kan <a href='%s'>generera en ny adress</a> för din hemliga RSS feed. Detta är användbart ifall du tror att adressen kommit i fel händer."
97
+
98
+ #: index.php:333
99
+ #: index.php:348
100
+ #: index.php:379
101
+ #: index_orig.php:333
102
+ #: index_orig.php:348
103
+ #: index_orig.php:379
104
+ #, php-format
105
+ #@ default
106
+ msgid "From %1$s on %2$s"
107
+ msgstr "Från %1$s klockan %2$s"
108
+
109
+ #: index.php:45
110
+ #: index.php:792
111
+ #: index_orig.php:786
112
+ #@ simple-history
113
+ msgid "By all users"
114
+ msgstr "Av alla användare"
115
+
116
+ #: index.php:811
117
+ #: index_orig.php:805
118
+ #@ simple-history
119
+ msgid "Search"
120
+ msgstr "Sök"
121
+
122
+ #: index.php:1051
123
+ #: index_orig.php:1041
124
+ #@ simple-history
125
+ msgid "Unknown or deleted user"
126
+ msgstr "Okänd eller borttagen användare"
127
+
128
+ #: index.php:476
129
+ #: index.php:549
130
+ #: index_orig.php:1069
131
+ #@ simple-history
132
+ msgid "created"
133
+ msgstr "skapades"
134
+
135
+ #: index.php:457
136
+ #: index.php:469
137
+ #: index.php:557
138
+ #: index_orig.php:1071
139
+ #: index_orig.php:1160
140
+ #@ simple-history
141
+ msgid "updated"
142
+ msgstr "uppdaterades"
143
+
144
+ #: index.php:351
145
+ #: index.php:462
146
+ #: index.php:483
147
+ #: index.php:512
148
+ #: index.php:554
149
+ #: index_orig.php:1073
150
+ #: index_orig.php:1162
151
+ #@ simple-history
152
+ msgid "deleted"
153
+ msgstr "kastades i papperskorgen"
154
+
155
+ #: index.php:451
156
+ #: index_orig.php:1158
157
+ #@ simple-history
158
+ msgid "added"
159
+ msgstr "lades till"
160
+
161
+ #: index_orig.php:1164
162
+ #@ simple-history
163
+ msgid "logged in"
164
+ msgstr "loggade in"
165
+
166
+ #: index_orig.php:1166
167
+ #@ simple-history
168
+ msgid "logged out"
169
+ msgstr "loggade ut"
170
+
171
+ #: index.php:1203
172
+ #: index_orig.php:1193
173
+ #, php-format
174
+ #@ default
175
+ msgid "%s ago"
176
+ msgstr "%s sedan"
177
+
178
+ #: index.php:1212
179
+ #: index_orig.php:1202
180
+ #@ simple-history
181
+ msgid "+ 1 occasion"
182
+ msgstr "+1 tillfälle"
183
+
184
+ #: index.php:1215
185
+ #: index_orig.php:1205
186
+ #, php-format
187
+ #@ simple-history
188
+ msgid "+ %d occasions"
189
+ msgstr "+ %d tillfällen"
190
+
191
+ #: index.php:1223
192
+ #: index_orig.php:1213
193
+ #, php-format
194
+ #@ simple-history
195
+ msgid "%s ago (%s at %s)"
196
+ msgstr "%s sedan (%s den %s)"
197
+
198
+ #: index.php:1246
199
+ #: index_orig.php:1236
200
+ #, fuzzy
201
+ #@ simple-history
202
+ msgid "Show 5 more"
203
+ msgstr "Visa 5 till"
204
+
205
+ #: index.php:1247
206
+ #: index_orig.php:1237
207
+ #, fuzzy
208
+ #@ simple-history
209
+ msgid "Show 15 more"
210
+ msgstr "Visa 15 till"
211
+
212
+ #: index.php:1248
213
+ #: index_orig.php:1238
214
+ #, fuzzy
215
+ #@ simple-history
216
+ msgid "Show 50 more"
217
+ msgstr "Visa 50 till"
218
+
219
+ #: index.php:1249
220
+ #: index_orig.php:1239
221
+ #, fuzzy
222
+ #@ simple-history
223
+ msgid "Show 100 more"
224
+ msgstr "Visa 100 till"
225
+
226
+ #: index.php:1252
227
+ #: index_orig.php:1242
228
+ #@ simple-history
229
+ msgid "Loading..."
230
+ msgstr "Laddar..."
231
+
232
+ #: index.php:1253
233
+ #: index_orig.php:1243
234
+ #@ simple-history
235
+ msgid "No more history items found."
236
+ msgstr "Ingen historik hittad."
237
+
238
+ #: index.php:1254
239
+ #: index_orig.php:1244
240
+ #@ simple-history
241
+ msgid "Simple History RSS feed"
242
+ msgstr "Webbplatshistorik RSS feed"
243
+
244
+ #: index.php:1256
245
+ #: index_orig.php:1246
246
+ #@ simple-history
247
+ msgid "Show"
248
+ msgstr "Visa"
249
+
250
+ #: index.php:1270
251
+ #: index_orig.php:1260
252
+ #@ simple-history
253
+ msgid "No history items found."
254
+ msgstr "Inga händelser hittade."
255
+
256
+ #: index.php:1271
257
+ #: index_orig.php:1261
258
+ #@ simple-history
259
+ msgid "Please note that Simple History only records things that happen after this plugin have been installed."
260
+ msgstr "Vänligen notera att \"Webbplatshistorik\" enbart visar händelser efter detta plugin aktiverats."
261
+
262
+ #: index.php:1095
263
+ #@ simple-history
264
+ msgid "attachment"
265
+ msgstr "bilaga"
266
+
267
+ #: index.php:1134
268
+ #@ simple-history
269
+ msgid "user"
270
+ msgstr "användare"
271
+
272
+ #: index.php:29
273
+ #@ simple-history
274
+ msgid "Simple History"
275
+ msgstr "Webbplatshistorik"
276
+
277
+ #: index.php:317
278
+ #: index.php:321
279
+ #: index.php:691
280
+ #@ default
281
+ msgid "Plugin"
282
+ msgstr ""
283
+
284
+ #: index.php:336
285
+ #: index.php:351
286
+ #: index.php:382
287
+ #@ default
288
+ msgid "Comment"
289
+ msgstr ""
290
+
291
+ #: index.php:451
292
+ #: index.php:457
293
+ #: index.php:462
294
+ #@ simple-history
295
+ msgid "Attachment"
296
+ msgstr "Filuppladdning"
297
+
298
+ #: index.php:469
299
+ #: index.php:476
300
+ #: index.php:483
301
+ #: index.php:497
302
+ #: index.php:504
303
+ #@ simple-history
304
+ msgid "User"
305
+ msgstr "Användare"
306
+
307
+ #: index.php:512
308
+ #@ default
309
+ msgid "Post"
310
+ msgstr ""
311
+
312
+ #: index.php:42
313
+ #: index.php:726
314
+ #@ simple-history
315
+ msgid "All types"
316
+ msgstr "All historik"
317
+
318
+ #: index.php:317
319
+ #: index.php:691
320
+ #@ simple-history
321
+ msgid "activated"
322
+ msgstr "aktiverades"
323
+
324
+ #: index.php:321
325
+ #@ simple-history
326
+ msgid "deactivated"
327
+ msgstr "inaktiverades"
328
+
329
+ #: index.php:336
330
+ #@ simple-history
331
+ msgid "edited"
332
+ msgstr "redigerade"
333
+
334
+ #: index.php:366
335
+ #@ simple-history
336
+ msgid "approved"
337
+ msgstr "godkände"
338
+
339
+ #: index.php:368
340
+ #@ simple-history
341
+ msgid "unapproved"
342
+ msgstr "nekade"
343
+
344
+ #: index.php:370
345
+ #@ simple-history
346
+ msgid "marked as spam"
347
+ msgstr "markerade som skräppost"
348
+
349
+ #: index.php:372
350
+ #@ simple-history
351
+ msgid "trashed"
352
+ msgstr "slängde"
353
+
354
+ #: index.php:374
355
+ #@ simple-history
356
+ msgid "untrashed"
357
+ msgstr "återställde"
358
+
359
+ #: index.php:497
360
+ #@ simple-history
361
+ msgid "logged_in"
362
+ msgstr "loggade in"
363
+
364
+ #: index.php:504
365
+ #@ simple-history
366
+ msgid "logged_out"
367
+ msgstr "loggade ut"
368
+
369
+ #: index.php:1205
370
+ #, php-format
371
+ #@ simple-history
372
+ msgid "%s at %s"
373
+ msgstr "%s klockan %s"
374
+
trunk/languages/simple-history-zh_CN.mo ADDED
Binary file
trunk/languages/simple-history-zh_CN.po ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: LERIO\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-12-07 14:45+0800\n"
6
+ "PO-Revision-Date: 2010-12-07 14:49+0800\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: LERIO <LERIO@QQ.COM>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "X-Poedit-Language: Chinese\n"
15
+ "X-Poedit-Country: CHINA\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: index.php:126
20
+ #: index.php:168
21
+ #, php-format
22
+ msgid "Simple History for %s"
23
+ msgstr "简易历史 %s"
24
+
25
+ #: index.php:127
26
+ #: index.php:169
27
+ #, php-format
28
+ msgid "WordPress History for %s"
29
+ msgstr "WordPress 简易历史 %s"
30
+
31
+ #: index.php:139
32
+ #, php-format
33
+ msgid "By %s"
34
+ msgstr "由 %s"
35
+
36
+ #: index.php:143
37
+ #, php-format
38
+ msgid "%d occasions"
39
+ msgstr "%d 事件"
40
+
41
+ #: index.php:173
42
+ msgid "Wrong RSS secret"
43
+ msgstr "错误的私隐 RSS"
44
+
45
+ #: index.php:174
46
+ msgid "Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed."
47
+ msgstr "您的简易历史 RSS 私密订阅是错误的。请参阅 WordPress 中的 RSS 订阅链接设置。"
48
+
49
+ #: index.php:247
50
+ msgid "on the dashboard"
51
+ msgstr "显示在控制面版上"
52
+
53
+ #: index.php:252
54
+ msgid "as a page under the tools menu"
55
+ msgstr "显示在右侧功能栏上"
56
+
57
+ #: index.php:283
58
+ msgid "Created new secret RSS adress"
59
+ msgstr "建立新的 RSS 私密地址"
60
+
61
+ #: index.php:294
62
+ msgid "This is a secret RSS feed for Simple History. Only share the link with people you trust"
63
+ msgstr "这是简单历史的私密订阅。只能与你信任的人分享的链接"
64
+
65
+ #: index.php:297
66
+ #, php-format
67
+ msgid "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."
68
+ msgstr "你可以为 RSS 订阅 <a href='%s'>建立一个新的地址</a>。这是非常有用的,如果你认为地址已经泄漏。"
69
+
70
+ #: index.php:320
71
+ #: index.php:335
72
+ #: index.php:366
73
+ #, php-format
74
+ msgid "From %1$s on %2$s"
75
+ msgstr "从 %1$s 开始到 %2$s"
76
+
77
+ #: index.php:816
78
+ msgid "By all users"
79
+ msgstr "所有用户"
80
+
81
+ #: index.php:1036
82
+ msgid "Unknown or deleted user"
83
+ msgstr "未知或已删除用户"
84
+
85
+ #: index.php:1063
86
+ msgid "created"
87
+ msgstr "创建"
88
+
89
+ #: index.php:1065
90
+ #: index.php:1158
91
+ msgid "updated"
92
+ msgstr "更新"
93
+
94
+ #: index.php:1067
95
+ #: index.php:1160
96
+ msgid "deleted"
97
+ msgstr "删除"
98
+
99
+ #: index.php:1156
100
+ msgid "added"
101
+ msgstr "添加"
102
+
103
+ #: index.php:1162
104
+ msgid "logged in"
105
+ msgstr "登录"
106
+
107
+ #: index.php:1164
108
+ msgid "logged out"
109
+ msgstr "登出"
110
+
111
+ #: index.php:1198
112
+ msgid "+ 1 occasion"
113
+ msgstr "+ 1次"
114
+
115
+ #: index.php:1201
116
+ #, php-format
117
+ msgid "+ %d occasions"
118
+ msgstr "+ %d 次"
119
+
120
+ #: index.php:1230
121
+ #, php-format
122
+ msgid "Show %d more"
123
+ msgstr "显示 %d 个更多"
124
+
125
+ #: index.php:1231
126
+ msgid "Loading..."
127
+ msgstr "载入中..."
128
+
129
+ #: index.php:1232
130
+ msgid "No more history items found."
131
+ msgstr "没有找到更多的历史项目。"
132
+
133
+ #: index.php:1233
134
+ msgid "Simple History RSS feed"
135
+ msgstr "简易历史 RSS 订阅"
136
+
137
+ #: index.php:1249
138
+ msgid "No history items found."
139
+ msgstr "没有找到历史项目。"
140
+
141
+ #: index.php:1250
142
+ msgid "Please note that Simple History only records things that happen after this plugin have been installed."
143
+ msgstr "请注意,简单的历史只能记录插件安装后发生的事情。"
144
+
trunk/languages/simple-history.pot ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2012
2
+ # This file is distributed under the same license as the package.
3
+ 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-11 06:08:27+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: index.php:52 index.php:144 index.php:698
16
+ msgid "History"
17
+ msgstr ""
18
+
19
+ #: index.php:127
20
+ msgid "upgraded it's database"
21
+ msgstr ""
22
+
23
+ #: index.php:127 index.php:369 index.php:373 index.php:757
24
+ msgid "Plugin"
25
+ msgstr ""
26
+
27
+ #: index.php:182 index.php:225
28
+ msgid "History for %s"
29
+ msgstr ""
30
+
31
+ #: index.php:183 index.php:226
32
+ msgid "WordPress History for %s"
33
+ msgstr ""
34
+
35
+ #: index.php:195 index.php:1257
36
+ msgid "By %s"
37
+ msgstr ""
38
+
39
+ #: index.php:199
40
+ msgid "%d occasions"
41
+ msgstr ""
42
+
43
+ #: index.php:230
44
+ msgid "Wrong RSS secret"
45
+ msgstr ""
46
+
47
+ #: index.php:231
48
+ msgid ""
49
+ "Your RSS secret for Simple History RSS feed is wrong. Please see WordPress "
50
+ "settings for current link to the RSS feed."
51
+ msgstr ""
52
+
53
+ #: index.php:248 index.php:791
54
+ msgid "All types"
55
+ msgstr ""
56
+
57
+ #: index.php:251 index.php:857
58
+ msgid "By all users"
59
+ msgstr ""
60
+
61
+ #: index.php:306
62
+ msgid "on the dashboard"
63
+ msgstr ""
64
+
65
+ #: index.php:311
66
+ msgid "as a page under the tools menu"
67
+ msgstr ""
68
+
69
+ #: index.php:348
70
+ msgid "Created new secret RSS adress"
71
+ msgstr ""
72
+
73
+ #: index.php:359
74
+ msgid ""
75
+ "This is a secret RSS feed for Simple History. Only share the link with "
76
+ "people you trust"
77
+ msgstr ""
78
+
79
+ #: index.php:362
80
+ msgid ""
81
+ "You can <a href='%s#simple-history-settings-page'>generate a new address</a> "
82
+ "for the RSS feed. This is useful if you think that the address has fallen "
83
+ "into the wrong hands."
84
+ msgstr ""
85
+
86
+ #: index.php:369 index.php:757 index.php:1234
87
+ msgid "activated"
88
+ msgstr ""
89
+
90
+ #: index.php:373 index.php:1237
91
+ msgid "deactivated"
92
+ msgstr ""
93
+
94
+ #: index.php:385 index.php:401 index.php:433
95
+ msgid "From %1$s on %2$s"
96
+ msgstr ""
97
+
98
+ #: index.php:388
99
+ msgid "edited"
100
+ msgstr ""
101
+
102
+ #: index.php:388 index.php:404 index.php:436
103
+ msgid "Comment"
104
+ msgstr ""
105
+
106
+ #: index.php:404 index.php:518 index.php:539 index.php:568 index.php:610
107
+ msgid "deleted"
108
+ msgstr ""
109
+
110
+ #: index.php:420
111
+ msgid "approved"
112
+ msgstr ""
113
+
114
+ #: index.php:422
115
+ msgid "unapproved"
116
+ msgstr ""
117
+
118
+ #: index.php:424
119
+ msgid "marked as spam"
120
+ msgstr ""
121
+
122
+ #: index.php:426
123
+ msgid "trashed"
124
+ msgstr ""
125
+
126
+ #: index.php:428
127
+ msgid "untrashed"
128
+ msgstr ""
129
+
130
+ #: index.php:506
131
+ msgid "added"
132
+ msgstr ""
133
+
134
+ #: index.php:506 index.php:513 index.php:518
135
+ msgid "Attachment"
136
+ msgstr ""
137
+
138
+ #: index.php:513 index.php:525 index.php:613
139
+ msgid "updated"
140
+ msgstr ""
141
+
142
+ #: index.php:525 index.php:539 index.php:553 index.php:560
143
+ msgid "User"
144
+ msgstr ""
145
+
146
+ #: index.php:553
147
+ msgid "logged_in"
148
+ msgstr ""
149
+
150
+ #: index.php:560
151
+ msgid "logged_out"
152
+ msgstr ""
153
+
154
+ #: index.php:568
155
+ msgid "Post"
156
+ msgstr ""
157
+
158
+ #: index.php:605
159
+ msgid "created"
160
+ msgstr ""
161
+
162
+ #: index.php:876
163
+ msgid "Search"
164
+ msgstr ""
165
+
166
+ #: index.php:1092
167
+ msgid "Unknown or deleted user"
168
+ msgstr ""
169
+
170
+ #: index.php:1138
171
+ msgid "attachment"
172
+ msgstr ""
173
+
174
+ #: index.php:1170
175
+ msgid "user"
176
+ msgstr ""
177
+
178
+ #: index.php:1240
179
+ msgid "enabled"
180
+ msgstr ""
181
+
182
+ #: index.php:1243
183
+ msgid "disabled"
184
+ msgstr ""
185
+
186
+ #: index.php:1259
187
+ msgid "%s ago"
188
+ msgstr ""
189
+
190
+ #: index.php:1261
191
+ msgid "%s at %s"
192
+ msgstr ""
193
+
194
+ #: index.php:1268
195
+ msgid "+ 1 occasion"
196
+ msgstr ""
197
+
198
+ #: index.php:1271
199
+ msgid "+ %d occasions"
200
+ msgstr ""
201
+
202
+ #: index.php:1279
203
+ msgid "%s ago (%s at %s)"
204
+ msgstr ""
205
+
206
+ #: index.php:1302
207
+ msgid "Show 5 more"
208
+ msgstr ""
209
+
210
+ #: index.php:1303
211
+ msgid "Show 15 more"
212
+ msgstr ""
213
+
214
+ #: index.php:1304
215
+ msgid "Show 50 more"
216
+ msgstr ""
217
+
218
+ #: index.php:1305
219
+ msgid "Show 100 more"
220
+ msgstr ""
221
+
222
+ #: index.php:1308
223
+ msgid "Loading..."
224
+ msgstr ""
225
+
226
+ #: index.php:1309
227
+ msgid "No more history items found."
228
+ msgstr ""
229
+
230
+ #: index.php:1310
231
+ msgid "RSS feed"
232
+ msgstr ""
233
+
234
+ #: index.php:1312
235
+ msgid "Show"
236
+ msgstr ""
237
+
238
+ #: index.php:1326
239
+ msgid "No history items found."
240
+ msgstr ""
241
+
242
+ #: index.php:1327
243
+ msgid ""
244
+ "Please note that Simple History only records things that happen after this "
245
+ "plugin have been installed."
246
+ msgstr ""
trunk/readme.txt ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.1
8
+
9
+ View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
+
11
+ == Description ==
12
+
13
+ Simple History shows recent changes made within WordPress, directly on your dashboard or on a separate page.
14
+
15
+ The plugin works as a log/history/audit log/version history of all (most, anyway) events that occur in WordPress. For example:
16
+
17
+ * see what articles have been created, modified or deleted
18
+ * see what attachments have been uploaded, modified or deleted
19
+ * see what plugins that have been activated or deactivated
20
+ * search through the history/log to find the change/post/article you are looking for
21
+
22
+ There is also a **RSS feed of changes** available, so you can keep track of the changes made
23
+ via your favorite RSS reader on your phone, on your iPad, or on your computer.
24
+
25
+ It’s a plugin that is good to have on websites where several people are
26
+ involved in editing the content.
27
+
28
+ #### Example scenarios
29
+
30
+ Keep track of what other people are doing:
31
+ _"Has someone done anything today? Ah, Sarah uploaded
32
+ the new press release and created an article for it. Great! Now I don't have to do that."_
33
+
34
+ Or for debug purposes:
35
+ _"The site feels very slow since yesterday. Has anyone done anything special? ... Ah, Steven activated 'naughy-plugin-x',
36
+ that must be it."_
37
+
38
+ #### See it in action
39
+ See the plugin in action with this short screencast:
40
+ [youtube http://www.youtube.com/watch?v=4cu4kooJBzs]
41
+
42
+ #### Add your own events to simple history
43
+ If you are a plugin developer and would like to add your own things/events to Simple History
44
+ you can do that by calling the function simple_history_add like this:
45
+ `<?php
46
+ # will return “Plugin your_plugin_name Edited”
47
+ simple_history_add("action=edited&object_type=plugin&object_name=your_plugin_name");
48
+ ?>`
49
+
50
+ `<?php simple_history_add("action=repaired&object_type=starship&object_name=USS Enterprise"); ?>`
51
+
52
+ #### Translations/Languages
53
+
54
+ This plugin is available in the following languages:
55
+
56
+ * English
57
+ * German
58
+ * Simplified Chinese
59
+
60
+ #### Donation and more plugins
61
+ * If you like this plugin don't forget to [donate to support further development](http://eskapism.se/sida/donate/).
62
+ * More [WordPress CMS plugins](http://wordpress.org/extend/plugins/profile/eskapism) by the same author.
63
+
64
+ == Installation ==
65
+
66
+ 1. Upload the folder "simple-history" to "/wp-content/plugins/"
67
+ 1. Activate the plugin through the "Plugins" menu in WordPress
68
+ 1. Done!
69
+
70
+ Now Simple History will be visible both on the dashboard and in the menu under pages.
71
+
72
+ == Feedback ==
73
+ Like the plugin? Dislike it? Got bugs or feature request?
74
+ Great! Contact me at par.thernstrom@gmail.com or at twitter.com/eskapism and hopefully
75
+ I can do something about it.
76
+
77
+ == Screenshots ==
78
+
79
+ 1. Simple History as it looks on your (well, mine anyway..) dashboard.
80
+
81
+ 2. Simple History settings. Choose to show the plugin on your dashboard, or as a separately page. Or both. Or none, since you can choose
82
+ to only use the secret RSS feed to keep track of the changes on you web site/WordPress installation.
83
+
84
+ 3. The RSS feed with changes, as shown in Firefox.
85
+
86
+ == Changelog ==
87
+
88
+ = 0.8.1 =
89
+ - Fixed some annoying errors that slipt through testing.
90
+
91
+ = 0.8 =
92
+ - 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).
93
+ - Added: gravatar of user performing action is always shown
94
+ - Fixed: history items that was posts/pages/custom post types now get linked again
95
+ - 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)
96
+ - Fixed: showing/loading of new history items was kinda broken. Hopefully fixed and working better than ever now.
97
+ - Plus: even more WordPress-ish looking!
98
+ - 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.
99
+
100
+ = 0.7.2 =
101
+ - Default settings should be to show on page, missed that one. Sorry!
102
+
103
+ = 0.7.1 =
104
+ - Fixed a PHP shorttag
105
+
106
+ = 0.7 =
107
+ - Do not show on dashboard by default to avoid clutter. Can be enabled in settings.
108
+ - Add link to settings from plugin list
109
+ - Settings are now available as it's own page under Settings -> Simple Fields. It was previosly on the General settings page and some people had difficulties finding it there.
110
+ - Added filters: simple_history_show_settings_page, simple_history_show_on_dashboard, simple_history_show_as_page
111
+
112
+ = 0.6 =
113
+ - Changed widget name to just "History" instead of "Simple History". Keep it simple. Previous name implied there also was an "Advanced History" somewhere.
114
+ - Made the widget look a bit WordPress-ish by borrwing some of the looks from the comments widget.
115
+ - Fix for database that didn't use UTF-8 (sorry international users!)
116
+ - Some security fixes
117
+ - Updated POT-file
118
+
119
+ = 0.5 =
120
+ - Added author to RSS
121
+ - Added german translation, thanks http://www.fuerther-freiheit.info/
122
+ - Added swedish translation, thanks http://jockegustin.se
123
+ - Better support for translation
124
+
125
+ = 0.4 =
126
+ - Added: Now you can search the history
127
+ - Added: Choose if you wan't to load/show more than just 5 rows from the history
128
+
129
+ = 0.3.11 =
130
+ - Fixed: titles are now escaped
131
+
132
+ = 0.3.10 =
133
+ - Added chinese translation
134
+ - Fixed a variable notice
135
+ - More visible ok-message after setting a new RSS secret
136
+
137
+ = 0.3.9 =
138
+ - Attachment names were urlencoded and looked wierd. Now they're not.
139
+ - Started to store plugin version number
140
+
141
+ = 0.3.8 =
142
+ - Added chinese translation
143
+ - Uses WordPress own human_time_diff() instead of own version
144
+ - Fix for time zones
145
+
146
+ = 0.3.7 =
147
+ - Directly after installation of Simple History you could view the history RSS feed without using any secret. Now a secret is automatically set during installation.
148
+
149
+ = 0.3.6 =
150
+ - Made the RSS-feature a bit easier to find: added a RSS-icon to the dashboard window - it's very discrete, you can find it at the bottom right corner. On the Simple History page it's a bit more clear, at the bottom, with text and all. Enjoy!
151
+ - Added POT-file
152
+
153
+ = 0.3.5 =
154
+ - using get_the_title instead of fetching the title directly from the post object. should make plugins like qtranslate work a bit better.
155
+ - preparing for translation by using __() and _e() functions. POT-file will be available shortly.
156
+ - Could get cryptic "simpleHistoryNoMoreItems"-text when loading a type with no items.
157
+
158
+ = 0.3.4 =
159
+ - RSS-feed is now valid, and should work at more places (could be broken because of html entities and stuff)
160
+
161
+ = 0.3.3 =
162
+ - Moved JavaScript to own file
163
+ - Added comments to the history, so now you can see who approved a comment (or unapproved, or marked as spam, or moved to trash, or restored from the trash)
164
+
165
+ = 0.3.2 =
166
+ - fixed some php notice messages + some other small things I don't remember..
167
+
168
+ = 0.3.1 =
169
+ - forgot to escape html for posts
170
+ - reduced memory usage... I think/hope...
171
+ - changes internal verbs for actions. some old history items may look a bit weird.
172
+ - added RSS feed for recent changes - keep track of changes via your favorite RSS-reader
173
+
174
+ = 0.3 =
175
+ - page is now added under dashboard (was previously under tools). just feel better.
176
+ - mouse over on date now display detailed date a bit faster
177
+ - layout fixes to make it cooler, better, faster, stronger
178
+ - multiple events of same type, performed on the same object, by the same user, are now grouped together. This way 30 edits on the same page does not end up with 30 rows in Simple History. Much better overview!
179
+ - the name of deleted items now show up, instead of "Unknown name" or similar
180
+ - added support for plugins (who activated/deactivated what plugin)
181
+ - support for third party history items. Use like this:
182
+ simple_history_add("action=repaired&object_type=starship&object_name=USS Enterprise");
183
+ this would result in somehting like this:
184
+ Starship "USS Enterprise" repaired
185
+ by admin (John Doe), just now
186
+ - capability edit_pages needed to show history. Is this an appropriate capability do you think?
187
+
188
+ = 0.2 =
189
+ * Compatible with 2.9.2
190
+
191
+ = 0.1 =
192
+ * First public version. It works!
trunk/screenshot-1.png ADDED
Binary file
trunk/screenshot-2.png ADDED
Binary file
trunk/screenshot-3.png ADDED
Binary file
trunk/scripts.js ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /**
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);
19
+ $t.closest("ul").find("li").removeClass("selected");
20
+ $t.closest("li").addClass("selected");
21
+ $ol = jQuery("ol.simple-history");
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
+
34
+ simple_history_current_page = 0;
35
+ var data = {
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
+
75
+ $ol = jQuery("ol.simple-history:last");
76
+ var data = {
77
+ "action": "simple_history_ajax",
78
+ "type": jQuery(".simple-history-filter-type li.selected a").text(),
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
+ });
106
+
107
+ jQuery("ol.simple-history .when").live("mouseover", function() {
108
+ jQuery(this).closest("li").find(".when_detail").fadeIn("fast");
109
+ });
110
+ jQuery("ol.simple-history .when").live("mouseout", function() {
111
+ jQuery(this).closest("li").find(".when_detail").fadeOut("fast");
112
+ });
113
+
114
+ // show occasions
115
+ jQuery("a.simple-history-occasion-show").live("click", function() {
116
+ jQuery(this).closest("li").find("ul.simple-history-occasions").toggle("fast");
117
+ return false;
118
+ });
trunk/styles.css ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .simple-history-filter {
3
+ margin-bottom: .5em;
4
+ margin-top: .5em;
5
+ }
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;
16
+ }
17
+
18
+ ol.simple-history {
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 {
83
+ color: #999;
84
+ cursor: help;
85
+ border-bottom: 1px dotted #bbb;
86
+ }
87
+ ol.simple-history .when_detail {
88
+ display: none;
89
+ position: relative;
90
+ top: 1.75em;
91
+ left: -2em;
92
+ padding: .5ex;
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;
112
+ }
113
+
114
+ .simple-history-added-by-ajax {
115
+ border-top: 1px solid #ddd;
116
+ }
117
+
118
+ ul.simple-history-occasions {
119
+ margin: 0 0 0 1em;
120
+ padding: 0;
121
+ list-style-type: none;
122
+ color: #999999;
123
+ }
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;
183
+ margin: 5px 0 15px;
184
+ background-color: #FFFFE0;
185
+ border: 1px solid #E6DB55;
186
+ }
187
+ .simple-history-settings-page-updated p {
188
+ margin: 0.5em !important;
189
+ }
190
+ .simple-history-filter-search input[type=button] {
191
+ cursor: pointer;
192
+ }
trunk/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
+