Version Description
- Added: Now you can search the history
- Added: Choose if you wan't to load/show more than just 5 rows from the history
Download this release
Release Info
Developer | eskapism |
Plugin | Simple History |
Version | 0.4 |
Comparing to | |
See all releases |
Code changes from version 0.3.10 to 0.4
- index.php +69 -20
- readme.txt +11 -3
- scripts.js +16 -5
- styles.css +3 -0
- trunk/index.php +0 -1220
- trunk/languages/simple-history-zh_CN.mo +0 -0
- trunk/languages/simple-history-zh_CN.po +0 -144
- trunk/languages/simple-history.pot +0 -145
- trunk/readme.txt +0 -142
- trunk/screenshot-1.png +0 -0
- trunk/screenshot-2.png +0 -0
- trunk/screenshot-3.png +0 -0
- trunk/scripts.js +0 -84
- trunk/styles.css +0 -148
index.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Simple History
|
4 |
Plugin URI: http://eskapism.se/code-playground/simple-history/
|
5 |
-
Description: Get a log of the changes made by users in WordPress.
|
6 |
-
Version: 0.
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
@@ -25,7 +25,7 @@ License: GPL2
|
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
28 |
-
define( "SIMPLE_HISTORY_VERSION", "0.
|
29 |
define( "SIMPLE_HISTORY_NAME", "Simple History");
|
30 |
define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
31 |
|
@@ -48,12 +48,18 @@ function simple_history_ajax() {
|
|
48 |
if (isset($_POST["page"])) {
|
49 |
$page = (int) $_POST["page"];
|
50 |
}
|
|
|
|
|
|
|
|
|
51 |
|
52 |
$args = array(
|
53 |
"is_ajax" => true,
|
54 |
"filter_type" => $type,
|
55 |
"filter_user" => $user,
|
56 |
-
"page" => $page
|
|
|
|
|
57 |
);
|
58 |
simple_history_print_history($args);
|
59 |
exit;
|
@@ -794,6 +800,14 @@ function simple_history_print_nav() {
|
|
794 |
$str_users = str_replace("| </li></ul>", "</li></ul>", $str_users);
|
795 |
echo $str_users;
|
796 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
797 |
|
798 |
|
799 |
}
|
@@ -809,10 +823,11 @@ function simple_history_get_items_array($args) {
|
|
809 |
"items" => 5,
|
810 |
"filter_type" => "",
|
811 |
"filter_user" => "",
|
812 |
-
"is_ajax" => false
|
|
|
813 |
);
|
814 |
$args = wp_parse_args( $args, $defaults );
|
815 |
-
|
816 |
$simple_history_type_to_show = $args["filter_type"];
|
817 |
$simple_history_user_to_show = $args["filter_user"];
|
818 |
|
@@ -847,6 +862,8 @@ function simple_history_get_items_array($args) {
|
|
847 |
$loopNum = 0;
|
848 |
$real_loop_num = -1;
|
849 |
|
|
|
|
|
850 |
$arr_events = array();
|
851 |
if ($rows) {
|
852 |
$prev_row = null;
|
@@ -866,33 +883,56 @@ function simple_history_get_items_array($args) {
|
|
866 |
$arr_events[$prev_row->id]->occasions[] = $one_row;
|
867 |
} else {
|
868 |
|
869 |
-
|
870 |
|
871 |
#echo "<br>real_loop_num: $real_loop_num";
|
872 |
#echo "<br>loop_num: $loopNum";
|
873 |
|
874 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
875 |
#echo "<br>CONTINUE";
|
876 |
continue;
|
877 |
}
|
878 |
|
879 |
-
|
|
|
880 |
#echo "<br>BREAK";
|
881 |
break;
|
882 |
}
|
883 |
|
884 |
// new event, not as previous one
|
885 |
-
|
886 |
-
$
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
|
|
892 |
}
|
893 |
}
|
|
|
894 |
}
|
|
|
895 |
return $arr_events;
|
|
|
896 |
}
|
897 |
|
898 |
// output the log
|
@@ -901,6 +941,8 @@ function simple_history_print_history($args = null) {
|
|
901 |
|
902 |
$arr_events = simple_history_get_items_array($args);
|
903 |
|
|
|
|
|
904 |
$defaults = array(
|
905 |
"page" => 0,
|
906 |
"items" => 5,
|
@@ -1017,6 +1059,7 @@ function simple_history_print_history($args = null) {
|
|
1017 |
} else {
|
1018 |
#$title = esc_html($post->post_title);
|
1019 |
$title = get_the_title($post->ID);
|
|
|
1020 |
$edit_link = get_edit_post_link($object_id, 'display');
|
1021 |
$post_out .= " <a href='$edit_link'>";
|
1022 |
$post_out .= "<span class='simple-history-title'>{$title}</span>";
|
@@ -1188,15 +1231,22 @@ function simple_history_print_history($args = null) {
|
|
1188 |
|
1189 |
if (!$args["is_ajax"]) {
|
1190 |
// if not ajax, print the divs and stuff we need
|
1191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1192 |
$loading = __("Loading...", 'simple-history');
|
1193 |
$no_more_found = __("No more history items found.", 'simple-history');
|
1194 |
$view_rss = __("Simple History RSS feed", 'simple-history');
|
1195 |
$view_rss_link = simple_history_get_rss_address();
|
1196 |
-
|
1197 |
echo "</ol>
|
1198 |
</div>
|
1199 |
-
<p id='simple-history-load-more'
|
1200 |
<p class='hidden' id='simple-history-load-more-loading'>$loading</p>
|
1201 |
<p class='hidden' id='simple-history-no-more-items'>$no_more_found</p>
|
1202 |
<p id='simple-history-rss-feed-dashboard'><a title='$view_rss' href='$view_rss_link'>$view_rss</a></p>
|
@@ -1216,4 +1266,3 @@ function simple_history_print_history($args = null) {
|
|
1216 |
}
|
1217 |
}
|
1218 |
|
1219 |
-
?>
|
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.4
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
27 |
|
28 |
+
define( "SIMPLE_HISTORY_VERSION", "0.4");
|
29 |
define( "SIMPLE_HISTORY_NAME", "Simple History");
|
30 |
define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
31 |
|
48 |
if (isset($_POST["page"])) {
|
49 |
$page = (int) $_POST["page"];
|
50 |
}
|
51 |
+
|
52 |
+
$items = (int) (isset($_POST["items"])) ? $_POST["items"] : 5;
|
53 |
+
|
54 |
+
$search = (isset($_POST["search"])) ? $_POST["search"] : "";
|
55 |
|
56 |
$args = array(
|
57 |
"is_ajax" => true,
|
58 |
"filter_type" => $type,
|
59 |
"filter_user" => $user,
|
60 |
+
"page" => $page,
|
61 |
+
"items" => $items,
|
62 |
+
"search" => $search
|
63 |
);
|
64 |
simple_history_print_history($args);
|
65 |
exit;
|
800 |
$str_users = str_replace("| </li></ul>", "</li></ul>", $str_users);
|
801 |
echo $str_users;
|
802 |
}
|
803 |
+
|
804 |
+
// search
|
805 |
+
$str_search = __("Search", 'simple-history');
|
806 |
+
$search = "<p class='simple-history-filter simple-history-filter-search'>
|
807 |
+
<input type='text' />
|
808 |
+
<input type='button' value='$str_search' />
|
809 |
+
</p>";
|
810 |
+
echo $search;
|
811 |
|
812 |
|
813 |
}
|
823 |
"items" => 5,
|
824 |
"filter_type" => "",
|
825 |
"filter_user" => "",
|
826 |
+
"is_ajax" => false,
|
827 |
+
"search" => ""
|
828 |
);
|
829 |
$args = wp_parse_args( $args, $defaults );
|
830 |
+
// echo "<pre>";print_r($args);echo "</pre>";
|
831 |
$simple_history_type_to_show = $args["filter_type"];
|
832 |
$simple_history_user_to_show = $args["filter_user"];
|
833 |
|
862 |
$loopNum = 0;
|
863 |
$real_loop_num = -1;
|
864 |
|
865 |
+
$search = strtolower($args["search"]);
|
866 |
+
|
867 |
$arr_events = array();
|
868 |
if ($rows) {
|
869 |
$prev_row = null;
|
883 |
$arr_events[$prev_row->id]->occasions[] = $one_row;
|
884 |
} else {
|
885 |
|
886 |
+
|
887 |
|
888 |
#echo "<br>real_loop_num: $real_loop_num";
|
889 |
#echo "<br>loop_num: $loopNum";
|
890 |
|
891 |
+
// check if we have a search. of so, only add if there is a match
|
892 |
+
$do_add = FALSE;
|
893 |
+
if ($search) {
|
894 |
+
// echo "<br>object_name: $object_name";
|
895 |
+
$object_name_lower = strtolower($one_row->object_name);
|
896 |
+
// echo "<br>search: $search";
|
897 |
+
// echo "<br>object_name: $object_name";
|
898 |
+
if (strpos($object_name_lower, $search) !== FALSE) {
|
899 |
+
$do_add = TRUE;
|
900 |
+
}
|
901 |
+
} else {
|
902 |
+
$do_add = TRUE;
|
903 |
+
}
|
904 |
+
|
905 |
+
if ($do_add) {
|
906 |
+
$real_loop_num++;
|
907 |
+
}
|
908 |
+
|
909 |
+
if ($do_add && $args["page"] > 0 && ($args["page"] * $args["items"] > $real_loop_num)) {
|
910 |
#echo "<br>CONTINUE";
|
911 |
continue;
|
912 |
}
|
913 |
|
914 |
+
// don't fetch more than we need
|
915 |
+
if ($do_add && $loopNum >= $args["items"]) {
|
916 |
#echo "<br>BREAK";
|
917 |
break;
|
918 |
}
|
919 |
|
920 |
// new event, not as previous one
|
921 |
+
|
922 |
+
if ($do_add) {
|
923 |
+
$arr_events[$one_row->id] = $one_row;
|
924 |
+
$arr_events[$one_row->id]->occasions = array();
|
925 |
+
$loopNum++;
|
926 |
+
$prev_row = $one_row;
|
927 |
+
}
|
928 |
+
|
929 |
}
|
930 |
}
|
931 |
+
//echo "<pre>";print_r($arr_events);echo "</pre>";
|
932 |
}
|
933 |
+
|
934 |
return $arr_events;
|
935 |
+
|
936 |
}
|
937 |
|
938 |
// output the log
|
941 |
|
942 |
$arr_events = simple_history_get_items_array($args);
|
943 |
|
944 |
+
// echo "<pre>";print_r($arr_events);echo "</pre>";
|
945 |
+
|
946 |
$defaults = array(
|
947 |
"page" => 0,
|
948 |
"items" => 5,
|
1059 |
} else {
|
1060 |
#$title = esc_html($post->post_title);
|
1061 |
$title = get_the_title($post->ID);
|
1062 |
+
$title = esc_html($title);
|
1063 |
$edit_link = get_edit_post_link($object_id, 'display');
|
1064 |
$post_out .= " <a href='$edit_link'>";
|
1065 |
$post_out .= "<span class='simple-history-title'>{$title}</span>";
|
1231 |
|
1232 |
if (!$args["is_ajax"]) {
|
1233 |
// if not ajax, print the divs and stuff we need
|
1234 |
+
//$show_more = sprintf(__("Show %d more", 'simple-history'), $args["items"]);
|
1235 |
+
$show_more = "<select>";
|
1236 |
+
$show_more .= sprintf("<option value='5'>%s</option>", __("Show 5 more", 'simple-history') );
|
1237 |
+
$show_more .= sprintf("<option value='15'>%s</option>", __("Show 15 more", 'simple-history') );
|
1238 |
+
$show_more .= sprintf("<option value='50'>%s</option>", __("Show 50 more", 'simple-history') );
|
1239 |
+
$show_more .= sprintf("<option value='100'>%s</option>", __("Show 100 more", 'simple-history') );
|
1240 |
+
$show_more .= "</select>";
|
1241 |
+
//$show_more = sprintf(__("Show %s more", 'simple-history'), $show_more);
|
1242 |
$loading = __("Loading...", 'simple-history');
|
1243 |
$no_more_found = __("No more history items found.", 'simple-history');
|
1244 |
$view_rss = __("Simple History RSS feed", 'simple-history');
|
1245 |
$view_rss_link = simple_history_get_rss_address();
|
1246 |
+
$str_show = __("Show", 'simple-history');
|
1247 |
echo "</ol>
|
1248 |
</div>
|
1249 |
+
<p id='simple-history-load-more'>$show_more<input type='button' value='$str_show' /></p>
|
1250 |
<p class='hidden' id='simple-history-load-more-loading'>$loading</p>
|
1251 |
<p class='hidden' id='simple-history-no-more-items'>$no_more_found</p>
|
1252 |
<p id='simple-history-rss-feed-dashboard'><a title='$view_rss' href='$view_rss_link'>$view_rss</a></p>
|
1266 |
}
|
1267 |
}
|
1268 |
|
|
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: 2.9.2
|
6 |
Tested up to: 3.0
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
|
10 |
|
@@ -12,13 +12,14 @@ View changes made by users within WordPress. See who created a page, uploaded an
|
|
12 |
|
13 |
Simple History shows recent changes made within WordPress, directly on your dashboard or on a separate page.
|
14 |
|
15 |
-
|
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 |
|
21 |
-
|
22 |
via your favorite RSS reader on your phone, on your iPad, or on your computer.
|
23 |
|
24 |
It’s a plugin that is good to have on websites where several people are
|
@@ -76,6 +77,13 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= 0.3.10 =
|
80 |
- Added chinese translation
|
81 |
- Fixed a variable notice
|
4 |
Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
|
5 |
Requires at least: 2.9.2
|
6 |
Tested up to: 3.0
|
7 |
+
Stable tag: 0.4
|
8 |
|
9 |
View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
|
10 |
|
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
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 0.4 =
|
81 |
+
- Added: Now you can search the history
|
82 |
+
- Added: Choose if you wan't to load/show more than just 5 rows from the history
|
83 |
+
|
84 |
+
= 0.3.11 =
|
85 |
+
- Fixed: titles are now escaped
|
86 |
+
|
87 |
= 0.3.10 =
|
88 |
- Added chinese translation
|
89 |
- Fixed a variable notice
|
scripts.js
CHANGED
@@ -3,7 +3,8 @@
|
|
3 |
* load history items via ajax
|
4 |
*/
|
5 |
var simple_history_current_page = 0;
|
6 |
-
jQuery(".simple-history-filter a").live("click", function() {
|
|
|
7 |
$t = jQuery(this);
|
8 |
$t.closest("ul").find("li").removeClass("selected");
|
9 |
$t.closest("li").addClass("selected");
|
@@ -18,11 +19,14 @@ jQuery(".simple-history-filter a").live("click", function() {
|
|
18 |
$ol.fadeOut("fast");
|
19 |
jQuery("#simple-history-no-more-items").hide();
|
20 |
|
|
|
|
|
21 |
simple_history_current_page = 0;
|
22 |
var data = {
|
23 |
"action": "simple_history_ajax",
|
24 |
-
"type": jQuery(".simple-history-filter-type li.selected a").text(),
|
25 |
-
"user": jQuery(".simple-history-filter-user li.selected a").text()
|
|
|
26 |
};
|
27 |
jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
|
28 |
if (data == "simpleHistoryNoMoreItems") {
|
@@ -40,17 +44,24 @@ jQuery(".simple-history-filter a").live("click", function() {
|
|
40 |
return false;
|
41 |
});
|
42 |
|
43 |
-
jQuery("#simple-history-load-more a").live("click", function() {
|
|
|
44 |
simple_history_current_page++;
|
45 |
|
|
|
|
|
46 |
jQuery("#simple-history-load-more,#simple-history-load-more-loading").toggle();
|
47 |
|
|
|
|
|
48 |
$ol = jQuery("ol.simple-history:last");
|
49 |
var data = {
|
50 |
"action": "simple_history_ajax",
|
51 |
"type": jQuery(".simple-history-filter-type li.selected a").text(),
|
52 |
"user": jQuery(".simple-history-filter-user li.selected a").text(),
|
53 |
-
"page": simple_history_current_page
|
|
|
|
|
54 |
};
|
55 |
jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
|
56 |
|
3 |
* load history items via ajax
|
4 |
*/
|
5 |
var simple_history_current_page = 0;
|
6 |
+
jQuery(".simple-history-filter a, .simple-history-filter input[type='button']").live("click", function() {
|
7 |
+
|
8 |
$t = jQuery(this);
|
9 |
$t.closest("ul").find("li").removeClass("selected");
|
10 |
$t.closest("li").addClass("selected");
|
19 |
$ol.fadeOut("fast");
|
20 |
jQuery("#simple-history-no-more-items").hide();
|
21 |
|
22 |
+
var search = jQuery("p.simple-history-filter-search input[type='text']").val();
|
23 |
+
|
24 |
simple_history_current_page = 0;
|
25 |
var data = {
|
26 |
"action": "simple_history_ajax",
|
27 |
+
"type": jQuery("ul.simple-history-filter-type li.selected a").text(),
|
28 |
+
"user": jQuery("ul.simple-history-filter-user li.selected a").text(),
|
29 |
+
"search": search
|
30 |
};
|
31 |
jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
|
32 |
if (data == "simpleHistoryNoMoreItems") {
|
44 |
return false;
|
45 |
});
|
46 |
|
47 |
+
jQuery("#simple-history-load-more a, #simple-history-load-more input[type='button']").live("click", function() {
|
48 |
+
|
49 |
simple_history_current_page++;
|
50 |
|
51 |
+
var num_to_get = jQuery(this).prev("select").find(":selected").val();
|
52 |
+
|
53 |
jQuery("#simple-history-load-more,#simple-history-load-more-loading").toggle();
|
54 |
|
55 |
+
var search = jQuery("p.simple-history-filter-search input[type='text']").val();
|
56 |
+
|
57 |
$ol = jQuery("ol.simple-history:last");
|
58 |
var data = {
|
59 |
"action": "simple_history_ajax",
|
60 |
"type": jQuery(".simple-history-filter-type li.selected a").text(),
|
61 |
"user": jQuery(".simple-history-filter-user li.selected a").text(),
|
62 |
+
"page": simple_history_current_page,
|
63 |
+
"items": num_to_get,
|
64 |
+
"search": search
|
65 |
};
|
66 |
jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
|
67 |
|
styles.css
CHANGED
@@ -146,3 +146,6 @@ ul.simple-history-occasions li {
|
|
146 |
.simple-history-settings-page-updated p {
|
147 |
margin: 0.5em !important;
|
148 |
}
|
|
|
|
|
|
146 |
.simple-history-settings-page-updated p {
|
147 |
margin: 0.5em !important;
|
148 |
}
|
149 |
+
.simple-history-filter-search input[type=button] {
|
150 |
+
cursor: pointer;
|
151 |
+
}
|
trunk/index.php
DELETED
@@ -1,1220 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Simple History
|
4 |
-
Plugin URI: http://eskapism.se/code-playground/simple-history/
|
5 |
-
Description: Get a log of the changes made by users in WordPress.
|
6 |
-
Version: 0.3.11
|
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 |
-
define( "SIMPLE_HISTORY_VERSION", "0.3.11");
|
29 |
-
define( "SIMPLE_HISTORY_NAME", "Simple History");
|
30 |
-
define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
31 |
-
|
32 |
-
add_action( 'admin_head', "simple_history_admin_head" );
|
33 |
-
add_action( 'admin_init', 'simple_history_admin_init' ); // start listening to changes
|
34 |
-
add_action( 'init', 'simple_history_init' ); // start listening to changes
|
35 |
-
add_action( 'admin_menu', 'simple_history_admin_menu' );
|
36 |
-
add_action( 'wp_dashboard_setup', 'simple_history_wp_dashboard_setup' );
|
37 |
-
add_action( 'wp_ajax_simple_history_ajax', 'simple_history_ajax' );
|
38 |
-
|
39 |
-
function simple_history_ajax() {
|
40 |
-
|
41 |
-
$type = $_POST["type"];
|
42 |
-
if ($type == "All types") { $type = ""; }
|
43 |
-
|
44 |
-
$user = $_POST["user"];
|
45 |
-
if ($user == "By all users") { $user = ""; }
|
46 |
-
|
47 |
-
$page = 0;
|
48 |
-
if (isset($_POST["page"])) {
|
49 |
-
$page = (int) $_POST["page"];
|
50 |
-
}
|
51 |
-
|
52 |
-
$args = array(
|
53 |
-
"is_ajax" => true,
|
54 |
-
"filter_type" => $type,
|
55 |
-
"filter_user" => $user,
|
56 |
-
"page" => $page
|
57 |
-
);
|
58 |
-
simple_history_print_history($args);
|
59 |
-
exit;
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
function simple_history_admin_menu() {
|
64 |
-
|
65 |
-
#define( "SIMPLE_HISTORY_PAGE_FILE", menu_page_url("simple_history_page", false)); // no need yet
|
66 |
-
|
67 |
-
// show as page?
|
68 |
-
if (simple_history_setting_show_as_page()) {
|
69 |
-
add_dashboard_page(SIMPLE_HISTORY_NAME, SIMPLE_HISTORY_NAME, "edit_pages", "simple_history_page", "simple_history_management_page");
|
70 |
-
}
|
71 |
-
|
72 |
-
}
|
73 |
-
|
74 |
-
|
75 |
-
function simple_history_wp_dashboard_setup() {
|
76 |
-
if (simple_history_setting_show_on_dashboard()) {
|
77 |
-
if (current_user_can("edit_pages")) {
|
78 |
-
wp_add_dashboard_widget("simple_history_dashboard_widget", SIMPLE_HISTORY_NAME, "simple_history_dashboard");
|
79 |
-
}
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
function simple_history_dashboard() {
|
84 |
-
simple_history_purge_db();
|
85 |
-
simple_history_print_nav();
|
86 |
-
simple_history_print_history();
|
87 |
-
}
|
88 |
-
|
89 |
-
function simple_history_admin_head() {
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
-
function simple_history_init() {
|
94 |
-
|
95 |
-
// users and stuff
|
96 |
-
add_action("wp_login", "simple_history_wp_login");
|
97 |
-
add_action("wp_logout", "simple_history_wp_logout");
|
98 |
-
add_action("delete_user", "simple_history_delete_user");
|
99 |
-
add_action("user_register", "simple_history_user_register");
|
100 |
-
add_action("profile_update", "simple_history_profile_update");
|
101 |
-
|
102 |
-
// options
|
103 |
-
#add_action("updated_option", "simple_history_updated_option", 10, 3);
|
104 |
-
#add_action("updated_option", "simple_history_updated_option2", 10, 2);
|
105 |
-
#add_action("updated_option", "simple_history_updated_option3", 10, 1);
|
106 |
-
#add_action("update_option", "simple_history_update_option", 10, 3);
|
107 |
-
|
108 |
-
// plugin
|
109 |
-
add_action("activated_plugin", "simple_history_activated_plugin");
|
110 |
-
add_action("deactivated_plugin", "simple_history_deactivated_plugin");
|
111 |
-
|
112 |
-
// check for RSS
|
113 |
-
// don't know if this is the right way to do this, but it seems to work!
|
114 |
-
if (isset($_GET["simple_history_get_rss"])) {
|
115 |
-
|
116 |
-
$rss_secret_option = get_option("simple_history_rss_secret");
|
117 |
-
$rss_secret_get = $_GET["rss_secret"];
|
118 |
-
|
119 |
-
echo '<?xml version="1.0"?>';
|
120 |
-
$self_link = simple_history_get_rss_address();
|
121 |
-
|
122 |
-
if ($rss_secret_option == $rss_secret_get) {
|
123 |
-
?>
|
124 |
-
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
125 |
-
<channel>
|
126 |
-
<title><?php printf(__("Simple History for %s", 'simple-history'), get_bloginfo("name")) ?></title>
|
127 |
-
<description><?php printf(__("WordPress History for %s", 'simple-history'), get_bloginfo("name")) ?></description>
|
128 |
-
<link><?php echo get_bloginfo("siteurl") ?></link>
|
129 |
-
<atom:link href="<?php echo $self_link; ?>" rel="self" type="application/rss+xml" />
|
130 |
-
<?php
|
131 |
-
$arr_items = simple_history_get_items_array("items=10");
|
132 |
-
foreach ($arr_items as $one_item) {
|
133 |
-
$object_type = ucwords($one_item->object_type);
|
134 |
-
$object_name = esc_html($one_item->object_name);
|
135 |
-
$user = get_user_by("id", $one_item->user_id);
|
136 |
-
$user_nicename = esc_html($user->user_nicename);
|
137 |
-
$description = "";
|
138 |
-
if ($user_nicename) {
|
139 |
-
$description .= sprintf(__("By %s", 'simple-history'), $user_nicename);
|
140 |
-
$description .= "<br />";
|
141 |
-
}
|
142 |
-
if ($one_item->occasions) {
|
143 |
-
$description .= sprintf(__("%d occasions", 'simple-history'), sizeof($one_item->occasions));
|
144 |
-
$description .= "<br />";
|
145 |
-
}
|
146 |
-
|
147 |
-
$item_title = "$object_type \"{$object_name}\" {$one_item->action}";
|
148 |
-
$item_title = html_entity_decode($item_title, ENT_COMPAT, "UTF-8");
|
149 |
-
$item_guid = get_bloginfo("siteurl") . "?simple-history-guid=" . $one_item->id;
|
150 |
-
?>
|
151 |
-
<item>
|
152 |
-
<title><![CDATA[<?php echo $item_title; ?>]]></title>
|
153 |
-
<description><![CDATA[<?php echo $description ?>]]></description>
|
154 |
-
<pubDate><?php echo date("D, d M Y H:i:s", strtotime($one_item->date)) ?> GMT</pubDate>
|
155 |
-
<guid isPermaLink="false"><?php echo $item_guid ?></guid>
|
156 |
-
</item>
|
157 |
-
<?php
|
158 |
-
}
|
159 |
-
?>
|
160 |
-
</channel>
|
161 |
-
</rss>
|
162 |
-
<?php
|
163 |
-
} else {
|
164 |
-
// not ok rss secret
|
165 |
-
?>
|
166 |
-
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
167 |
-
<channel>
|
168 |
-
<title><?php printf(__("Simple History for %s", 'simple-history'), get_bloginfo("name")) ?></title>
|
169 |
-
<description><?php printf(__("WordPress History for %s", 'simple-history'), get_bloginfo("name")) ?></description>
|
170 |
-
<link><?php echo get_bloginfo("siteurl") ?></link>
|
171 |
-
<atom:link href="<?php echo $self_link; ?>" rel="self" type="application/rss+xml" />
|
172 |
-
<item>
|
173 |
-
<title><?php _e("Wrong RSS secret", 'simple-history')?></title>
|
174 |
-
<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>
|
175 |
-
<pubDate><?php echo date("D, d M Y H:i:s", time()) ?> GMT</pubDate>
|
176 |
-
<guid><?php echo get_bloginfo("siteurl") . "?simple-history-guid=wrong-secret" ?></guid>
|
177 |
-
</item>
|
178 |
-
</channel>
|
179 |
-
</rss>
|
180 |
-
<?php
|
181 |
-
|
182 |
-
}
|
183 |
-
exit;
|
184 |
-
}
|
185 |
-
|
186 |
-
}
|
187 |
-
|
188 |
-
|
189 |
-
function simple_history_admin_init() {
|
190 |
-
|
191 |
-
load_plugin_textdomain('simple-history', false, "/simple-history/languages");
|
192 |
-
|
193 |
-
// posts
|
194 |
-
add_action("save_post", "simple_history_save_post");
|
195 |
-
add_action("transition_post_status", "simple_history_transition_post_status", 10, 3);
|
196 |
-
add_action("delete_post", "simple_history_delete_post");
|
197 |
-
|
198 |
-
// attachments/media
|
199 |
-
add_action("add_attachment", "simple_history_add_attachment");
|
200 |
-
add_action("edit_attachment", "simple_history_edit_attachment");
|
201 |
-
add_action("delete_attachment", "simple_history_delete_attachment");
|
202 |
-
|
203 |
-
add_action("edit_comment", "simple_history_edit_comment");
|
204 |
-
add_action("delete_comment", "simple_history_delete_comment");
|
205 |
-
add_action("wp_set_comment_status", "simple_history_set_comment_status", 10, 2);
|
206 |
-
/*
|
207 |
-
edit_comment
|
208 |
-
Runs after a comment is updated/edited in the database. Action function arguments: comment ID.
|
209 |
-
|
210 |
-
delete_comment
|
211 |
-
Runs just before a comment is deleted. Action function arguments: comment ID.
|
212 |
-
|
213 |
-
wp_set_comment_status
|
214 |
-
Runs when the status of a comment changes. Action function arguments: comment ID, status string indicating the new status ("delete", "approve", "spam", "hold").
|
215 |
-
*/
|
216 |
-
// comments
|
217 |
-
|
218 |
-
add_settings_section("simple_history_settings_general", SIMPLE_HISTORY_NAME, "simple_history_settings_page", "general");
|
219 |
-
add_settings_field("simple_history_settings_field_1", "Show Simple History", "simple_history_settings_field", "general", "simple_history_settings_general");
|
220 |
-
add_settings_field("simple_history_settings_field_2", "RSS feed", "simple_history_settings_field_rss", "general", "simple_history_settings_general");
|
221 |
-
register_setting("general", "simple_history_show_on_dashboard");
|
222 |
-
register_setting("general", "simple_history_show_as_page");
|
223 |
-
|
224 |
-
wp_enqueue_style( "simple_history_styles", SIMPLE_HISTORY_URL . "styles.css", false, SIMPLE_HISTORY_VERSION );
|
225 |
-
|
226 |
-
wp_enqueue_script("simple_history", SIMPLE_HISTORY_URL . "scripts.js", array("jquery"), SIMPLE_HISTORY_VERSION);
|
227 |
-
|
228 |
-
}
|
229 |
-
function simple_history_settings_page() {
|
230 |
-
// never remove this function, it must exist.
|
231 |
-
echo "<div id='simple-history-settings-page'></div>";
|
232 |
-
}
|
233 |
-
|
234 |
-
function simple_history_setting_show_on_dashboard() {
|
235 |
-
return (bool) get_option("simple_history_show_on_dashboard", 1);
|
236 |
-
}
|
237 |
-
function simple_history_setting_show_as_page() {
|
238 |
-
return (bool) get_option("simple_history_show_as_page", 1);
|
239 |
-
}
|
240 |
-
|
241 |
-
|
242 |
-
function simple_history_settings_field() {
|
243 |
-
$show_on_dashboard = simple_history_setting_show_on_dashboard();
|
244 |
-
$show_as_page = simple_history_setting_show_as_page();
|
245 |
-
?>
|
246 |
-
|
247 |
-
<input <?php echo $show_on_dashboard ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_on_dashboard" id="simple_history_show_on_dashboard" />
|
248 |
-
<label for="simple_history_show_on_dashboard"><?php _e("on the dashboard", 'simple-history') ?></label>
|
249 |
-
|
250 |
-
<br />
|
251 |
-
|
252 |
-
<input <?php echo $show_as_page ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_as_page" id="simple_history_show_as_page" />
|
253 |
-
<label for="simple_history_show_as_page"><?php _e("as a page under the tools menu", 'simple-history') ?></label>
|
254 |
-
|
255 |
-
<?php
|
256 |
-
#$version = get_option("simple_history_version", "0.3.8");
|
257 |
-
#echo "<br><br>version: $version";
|
258 |
-
#update_option("simple_history_rss_secret", $rss_secret);
|
259 |
-
}
|
260 |
-
|
261 |
-
function simple_history_get_rss_address() {
|
262 |
-
$rss_secret = get_option("simple_history_rss_secret");
|
263 |
-
$rss_address = add_query_arg(array("simple_history_get_rss" => "1", "rss_secret" => $rss_secret), get_bloginfo("url") . "/");
|
264 |
-
$rss_address = htmlspecialchars($rss_address, ENT_COMPAT, "UTF-8");
|
265 |
-
return $rss_address;
|
266 |
-
}
|
267 |
-
|
268 |
-
function simple_history_update_rss_secret() {
|
269 |
-
$rss_secret = "";
|
270 |
-
for ($i=0; $i<20; $i++) {
|
271 |
-
$rss_secret .= chr(rand(97,122));
|
272 |
-
}
|
273 |
-
update_option("simple_history_rss_secret", $rss_secret);
|
274 |
-
return $rss_secret;
|
275 |
-
}
|
276 |
-
|
277 |
-
function simple_history_settings_field_rss() {
|
278 |
-
?>
|
279 |
-
<?php
|
280 |
-
$create_new_secret = false;
|
281 |
-
/*
|
282 |
-
// eeek! why was this here?
|
283 |
-
if ($rss_secret == false) {
|
284 |
-
$create_new_secret = true;
|
285 |
-
}
|
286 |
-
*/
|
287 |
-
if (isset($_GET["simple_history_rss_update_secret"]) && $_GET["simple_history_rss_update_secret"]) {
|
288 |
-
$create_new_secret = true;
|
289 |
-
echo "<div class='simple-history-settings-page-updated'><p>";
|
290 |
-
_e("Created new secret RSS adress", 'simple-history');
|
291 |
-
echo "</p></div>";
|
292 |
-
}
|
293 |
-
|
294 |
-
if ($create_new_secret) {
|
295 |
-
simple_history_update_rss_secret();
|
296 |
-
}
|
297 |
-
|
298 |
-
$rss_address = simple_history_get_rss_address();
|
299 |
-
echo "<code><a href='$rss_address'>$rss_address</a></code>";
|
300 |
-
echo "<br />";
|
301 |
-
_e("This is a secret RSS feed for Simple History. Only share the link with people you trust", 'simple-history');
|
302 |
-
echo "<br />";
|
303 |
-
$update_link = add_query_arg("simple_history_rss_update_secret", "1");
|
304 |
-
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);
|
305 |
-
}
|
306 |
-
|
307 |
-
// @todo: move all add-related stuff to own file? there are so many of them.. kinda confusing, ey.
|
308 |
-
|
309 |
-
function simple_history_activated_plugin($plugin_name) {
|
310 |
-
$plugin_name = urlencode($plugin_name);
|
311 |
-
simple_history_add("action=activated&object_type=plugin&object_name=$plugin_name");
|
312 |
-
}
|
313 |
-
function simple_history_deactivated_plugin($plugin_name) {
|
314 |
-
$plugin_name = urlencode($plugin_name);
|
315 |
-
simple_history_add("action=deactivated&object_type=plugin&object_name=$plugin_name");
|
316 |
-
}
|
317 |
-
|
318 |
-
function simple_history_edit_comment($comment_id) {
|
319 |
-
|
320 |
-
$comment_data = get_commentdata($comment_id, 0, true);
|
321 |
-
$comment_post_ID = $comment_data["comment_post_ID"];
|
322 |
-
$post = get_post($comment_post_ID);
|
323 |
-
$post_title = get_the_title($comment_post_ID);
|
324 |
-
$excerpt = get_comment_excerpt($comment_id);
|
325 |
-
$author = get_comment_author($comment_id);
|
326 |
-
|
327 |
-
$str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
|
328 |
-
$str = urlencode($str);
|
329 |
-
|
330 |
-
simple_history_add("action=edited&object_type=comment&object_name=$str&object_id=$comment_id");
|
331 |
-
}
|
332 |
-
|
333 |
-
function simple_history_delete_comment($comment_id) {
|
334 |
-
|
335 |
-
$comment_data = get_commentdata($comment_id, 0, true);
|
336 |
-
$comment_post_ID = $comment_data["comment_post_ID"];
|
337 |
-
$post = get_post($comment_post_ID);
|
338 |
-
$post_title = get_the_title($comment_post_ID);
|
339 |
-
$excerpt = get_comment_excerpt($comment_id);
|
340 |
-
$author = get_comment_author($comment_id);
|
341 |
-
|
342 |
-
$str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
|
343 |
-
$str = urlencode($str);
|
344 |
-
|
345 |
-
simple_history_add("action=deleted&object_type=comment&object_name=$str&object_id=$comment_id");
|
346 |
-
}
|
347 |
-
|
348 |
-
function simple_history_set_comment_status($comment_id, $new_status) {
|
349 |
-
#echo "<br>new status: $new_status<br>"; // 0
|
350 |
-
// $new_status hold (unapproved), approve, spam, trash
|
351 |
-
$comment_data = get_commentdata($comment_id, 0, true);
|
352 |
-
$comment_post_ID = $comment_data["comment_post_ID"];
|
353 |
-
$post = get_post($comment_post_ID);
|
354 |
-
$post_title = get_the_title($comment_post_ID);
|
355 |
-
$excerpt = get_comment_excerpt($comment_id);
|
356 |
-
$author = get_comment_author($comment_id);
|
357 |
-
|
358 |
-
$action = "";
|
359 |
-
if ("approve" == $new_status) {
|
360 |
-
$action = "approved";
|
361 |
-
} elseif ("hold" == $new_status) {
|
362 |
-
$action = "unapproved";
|
363 |
-
} elseif ("spam" == $new_status) {
|
364 |
-
$action = "marked as spam";
|
365 |
-
} elseif ("trash" == $new_status) {
|
366 |
-
$action = "trashed";
|
367 |
-
} elseif ("0" == $new_status) {
|
368 |
-
$action = "untrashed";
|
369 |
-
}
|
370 |
-
|
371 |
-
$action = urlencode($action);
|
372 |
-
|
373 |
-
$str = sprintf( "$excerpt [" . __('From %1$s on %2$s') . "]", $author, $post_title );
|
374 |
-
$str = urlencode($str);
|
375 |
-
|
376 |
-
simple_history_add("action=$action&object_type=comment&object_name=$str&object_id=$comment_id");
|
377 |
-
}
|
378 |
-
|
379 |
-
function simple_history_update_option($option, $oldval, $newval) {
|
380 |
-
/*
|
381 |
-
echo "<br><br>simple_history_update_option()";
|
382 |
-
echo "<br>Updated option $option";
|
383 |
-
echo "<br>oldval: ";
|
384 |
-
bonny_d($oldval);
|
385 |
-
echo "<br>newval:";
|
386 |
-
bonny_d($newval);
|
387 |
-
*/
|
388 |
-
|
389 |
-
if ($option == "active_plugins") {
|
390 |
-
|
391 |
-
$debug = "\n";
|
392 |
-
$debug .= "\nsimple_history_update_option()";
|
393 |
-
$debug .= "\noption: $option";
|
394 |
-
$debug .= "\noldval: " . print_r($oldval, true);
|
395 |
-
$debug .= "\nnewval: " . print_r($newval, true);
|
396 |
-
|
397 |
-
// Returns an array containing all the entries from array1 that are not present in any of the other arrays.
|
398 |
-
// alltså:
|
399 |
-
// om newval är array1 och innehåller en rad så är den tillagd
|
400 |
-
// om oldval är array1 och innhåller en rad så är den bortagen
|
401 |
-
$diff_added = array_diff((array) $newval, (array) $oldval);
|
402 |
-
$diff_removed = array_diff((array) $oldval, (array) $newval);
|
403 |
-
$debug .= "\ndiff_added: " . print_r($diff_added, true);
|
404 |
-
$debug .= "\ndiff_removed: " . print_r($diff_removed, true);
|
405 |
-
#b_fd($debug);
|
406 |
-
}
|
407 |
-
}
|
408 |
-
|
409 |
-
function simple_history_updated_option($option, $oldval, $newval) {
|
410 |
-
/*
|
411 |
-
echo "<br><br>simple_history_updated_option()";
|
412 |
-
echo "<br>Updated option $option";
|
413 |
-
echo "<br>oldval: ";
|
414 |
-
bonny_d($oldval);
|
415 |
-
echo "<br>newval:";
|
416 |
-
bonny_d($newval);
|
417 |
-
*/
|
418 |
-
|
419 |
-
}
|
420 |
-
|
421 |
-
// debug to file
|
422 |
-
// short for "bonny_file_debug" :)
|
423 |
-
function b_fd($str) {
|
424 |
-
$file = "/Users/bonny/Dropbox/localhost/wordpress3/wp-content/plugins/simple-history/debug.txt";
|
425 |
-
#$f = fopen($file, "+a");
|
426 |
-
file_put_contents($file, $str, FILE_APPEND);
|
427 |
-
}
|
428 |
-
|
429 |
-
/*
|
430 |
-
function simple_history_updated_option2($option, $oldval) {
|
431 |
-
echo "<br><br>xxx_simple_history_updated_option2";
|
432 |
-
bonny_d($option);
|
433 |
-
bonny_d($oldval);
|
434 |
-
}
|
435 |
-
function simple_history_updated_option3($option) {
|
436 |
-
echo "<br><br>xxx_simple_history_updated_option3";
|
437 |
-
echo "<br>option: $option";
|
438 |
-
}
|
439 |
-
*/
|
440 |
-
|
441 |
-
|
442 |
-
function simple_history_add_attachment($attachment_id) {
|
443 |
-
$post = get_post($attachment_id);
|
444 |
-
$post_title = urlencode(get_the_title($post->ID));
|
445 |
-
simple_history_add("action=added&object_type=attachment&object_id=$attachment_id&object_name=$post_title");
|
446 |
-
}
|
447 |
-
function simple_history_edit_attachment($attachment_id) {
|
448 |
-
// is this only being called if the title of the attachment is changed?!
|
449 |
-
$post = get_post($attachment_id);
|
450 |
-
$post_title = urlencode(get_the_title($post->ID));
|
451 |
-
simple_history_add("action=updated&object_type=attachment&object_id=$attachment_id&object_name=$post_title");
|
452 |
-
}
|
453 |
-
function simple_history_delete_attachment($attachment_id) {
|
454 |
-
$post = get_post($attachment_id);
|
455 |
-
$post_title = urlencode(get_the_title($post->ID));
|
456 |
-
simple_history_add("action=deleted&object_type=attachment&object_id=$attachment_id&object_name=$post_title");
|
457 |
-
}
|
458 |
-
|
459 |
-
// user is updated
|
460 |
-
function simple_history_profile_update($user_id) {
|
461 |
-
$user = get_user_by("id", $user_id);
|
462 |
-
$user_nicename = urlencode($user->user_nicename);
|
463 |
-
simple_history_add("action=updated&object_type=user&object_id=$user_id&object_name=$user_nicename");
|
464 |
-
}
|
465 |
-
|
466 |
-
// user is created
|
467 |
-
function simple_history_user_register($user_id) {
|
468 |
-
$user = get_user_by("id", $user_id);
|
469 |
-
$user_nicename = urlencode($user->user_nicename);
|
470 |
-
simple_history_add("action=created&object_type=user&object_id=$user_id&object_name=$user_nicename");
|
471 |
-
}
|
472 |
-
|
473 |
-
// user is deleted
|
474 |
-
function simple_history_delete_user($user_id) {
|
475 |
-
$user = get_user_by("id", $user_id);
|
476 |
-
$user_nicename = urlencode($user->user_nicename);
|
477 |
-
simple_history_add("action=deleted&object_type=user&object_id=$user_id&object_name=$user_nicename");
|
478 |
-
}
|
479 |
-
|
480 |
-
// user logs in
|
481 |
-
function simple_history_wp_login($user) {
|
482 |
-
$current_user = wp_get_current_user();
|
483 |
-
$user = get_user_by("login", $user);
|
484 |
-
$user_nicename = urlencode($user->user_nicename);
|
485 |
-
// if user id = null then it's because we are logged out and then no one is acutally loggin in.. like a.. ghost-user!
|
486 |
-
if ($current_user->ID == 0) {
|
487 |
-
$user_id = $user->ID;
|
488 |
-
} else {
|
489 |
-
$user_id = $current_user->ID;
|
490 |
-
}
|
491 |
-
simple_history_add("action=logged_in&object_type=user&object_id=".$user->ID."&user_id=$user_id&object_name=$user_nicename");
|
492 |
-
}
|
493 |
-
// user logs out
|
494 |
-
function simple_history_wp_logout() {
|
495 |
-
$current_user = wp_get_current_user();
|
496 |
-
$current_user_id = $current_user->ID;
|
497 |
-
$user_nicename = urlencode($current_user->user_nicename);
|
498 |
-
simple_history_add("action=logged_out&object_type=user&object_id=$current_user_id&object_name=$user_nicename");
|
499 |
-
}
|
500 |
-
|
501 |
-
function simple_history_delete_post($post_id) {
|
502 |
-
if (wp_is_post_revision($post_id) == false) {
|
503 |
-
$post = get_post($post_id);
|
504 |
-
if ($post->post_status != "auto-draft" && $post->post_status != "inherit") {
|
505 |
-
$post_title = urlencode(get_the_title($post->ID));
|
506 |
-
simple_history_add("action=deleted&object_type=post&object_subtype=" . $post->post_type . "&object_id=$post_id&object_name=$post_title");
|
507 |
-
}
|
508 |
-
}
|
509 |
-
}
|
510 |
-
|
511 |
-
function simple_history_save_post($post_id) {
|
512 |
-
|
513 |
-
if (wp_is_post_revision($post_id) == false) {
|
514 |
-
// not a revision
|
515 |
-
// it should also not be of type auto draft
|
516 |
-
$post = get_post($post_id);
|
517 |
-
if ($post->post_status != "auto-draft") {
|
518 |
-
// bonny_d($post);
|
519 |
-
#echo "save";
|
520 |
-
// [post_title] => neu
|
521 |
-
// [post_type] => page
|
522 |
-
}
|
523 |
-
|
524 |
-
}
|
525 |
-
}
|
526 |
-
|
527 |
-
// post has changed status
|
528 |
-
function simple_history_transition_post_status($new_status, $old_status, $post) {
|
529 |
-
|
530 |
-
#echo "<br>From $old_status to $new_status";
|
531 |
-
|
532 |
-
// From new to auto-draft <- ignore
|
533 |
-
// From new to inherit <- ignore
|
534 |
-
// From auto-draft to draft <- page/post created
|
535 |
-
// From draft to draft
|
536 |
-
// From draft to pending
|
537 |
-
// From pending to publish
|
538 |
-
# From pending to trash
|
539 |
-
// if not from & to = same, then user has changed something
|
540 |
-
//bonny_d($post); // regular post object
|
541 |
-
if ($old_status == "auto-draft" && ($new_status != "auto-draft" && $new_status != "inherit")) {
|
542 |
-
// page created
|
543 |
-
$action = "created";
|
544 |
-
} elseif ($new_status == "auto-draft" || ($old_status == "new" && $new_status == "inherit")) {
|
545 |
-
// page...eh.. just leave it.
|
546 |
-
return;
|
547 |
-
} elseif ($new_status == "trash") {
|
548 |
-
$action = "deleted";
|
549 |
-
} else {
|
550 |
-
// page updated. i guess.
|
551 |
-
$action = "updated";
|
552 |
-
}
|
553 |
-
$object_type = "post";
|
554 |
-
$object_subtype = $post->post_type;
|
555 |
-
if ($object_subtype == "revision") {
|
556 |
-
// don't log revisions
|
557 |
-
return;
|
558 |
-
}
|
559 |
-
|
560 |
-
if (wp_is_post_revision($post->ID) === false) {
|
561 |
-
// ok, no revision
|
562 |
-
$object_id = $post->ID;
|
563 |
-
} else {
|
564 |
-
return;
|
565 |
-
}
|
566 |
-
|
567 |
-
$post_title = get_the_title($post->ID);
|
568 |
-
$post_title = urlencode($post_title);
|
569 |
-
|
570 |
-
simple_history_add("action=$action&object_type=$object_type&object_subtype=$object_subtype&object_id=$object_id&object_name=$post_title");
|
571 |
-
}
|
572 |
-
|
573 |
-
|
574 |
-
/**
|
575 |
-
* add event to history table
|
576 |
-
*/
|
577 |
-
function simple_history_add($args) {
|
578 |
-
|
579 |
-
$defaults = array(
|
580 |
-
"action" => null,
|
581 |
-
"object_type" => null,
|
582 |
-
"object_subtype" => null,
|
583 |
-
"object_id" => null,
|
584 |
-
"object_name" => null,
|
585 |
-
"user_id" => null,
|
586 |
-
);
|
587 |
-
|
588 |
-
$args = wp_parse_args( $args, $defaults );
|
589 |
-
|
590 |
-
$action = $args["action"];
|
591 |
-
$object_type = $args["object_type"];
|
592 |
-
$object_subtype = $args["object_subtype"];
|
593 |
-
$object_id = $args["object_id"];
|
594 |
-
$object_name = mysql_real_escape_string($args["object_name"]);
|
595 |
-
$user_id = $args["user_id"];
|
596 |
-
|
597 |
-
global $wpdb;
|
598 |
-
$tableprefix = $wpdb->prefix;
|
599 |
-
if ($user_id) {
|
600 |
-
$current_user_id = $user_id;
|
601 |
-
} else {
|
602 |
-
$current_user = wp_get_current_user();
|
603 |
-
$current_user_id = (int) $current_user->ID;
|
604 |
-
}
|
605 |
-
|
606 |
-
// date, store at utc or local time
|
607 |
-
// anything is better than now() anyway!
|
608 |
-
// WP seems to use the local time, so I will go with that too I think
|
609 |
-
// GMT/UTC-time is: date_i18n($timezone_format, false, 'gmt'));
|
610 |
-
// local time is: date_i18n($timezone_format));
|
611 |
-
$localtime = current_time("mysql");
|
612 |
-
$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'";
|
613 |
-
$wpdb->query($sql);
|
614 |
-
}
|
615 |
-
|
616 |
-
|
617 |
-
function simple_history_purge_db() {
|
618 |
-
global $wpdb;
|
619 |
-
$tableprefix = $wpdb->prefix;
|
620 |
-
$sql = "DELETE FROM {$tableprefix}simple_history WHERE DATE_ADD(date, INTERVAL 60 DAY) < now()";
|
621 |
-
$wpdb->query($sql);
|
622 |
-
}
|
623 |
-
|
624 |
-
function simple_history_management_page() {
|
625 |
-
|
626 |
-
simple_history_purge_db();
|
627 |
-
|
628 |
-
?>
|
629 |
-
|
630 |
-
<div class="wrap">
|
631 |
-
<h2><?php echo SIMPLE_HISTORY_NAME ?></h2>
|
632 |
-
<?php
|
633 |
-
simple_history_print_nav();
|
634 |
-
simple_history_print_history();
|
635 |
-
?>
|
636 |
-
</div>
|
637 |
-
|
638 |
-
<?php
|
639 |
-
|
640 |
-
}
|
641 |
-
|
642 |
-
if (!function_exists("bonny_d")) {
|
643 |
-
function bonny_d($var) {
|
644 |
-
echo "<pre>";
|
645 |
-
print_r($var);
|
646 |
-
echo "</pre>";
|
647 |
-
}
|
648 |
-
}
|
649 |
-
|
650 |
-
// when activating plugin: create tables
|
651 |
-
// __FILE__ doesnt work for me because of soft linkes directories
|
652 |
-
register_activation_hook( WP_PLUGIN_DIR . "/simple-history/index.php" , 'simple_history_install' );
|
653 |
-
function simple_history_install() {
|
654 |
-
|
655 |
-
global $wpdb;
|
656 |
-
|
657 |
-
$table_name = $wpdb->prefix . "simple_history";
|
658 |
-
#if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
|
659 |
-
|
660 |
-
$sql = "CREATE TABLE " . $table_name . " (
|
661 |
-
id int(10) NOT NULL AUTO_INCREMENT,
|
662 |
-
date datetime NOT NULL,
|
663 |
-
action varchar(255) NOT NULL,
|
664 |
-
object_type varchar(255) NOT NULL,
|
665 |
-
object_subtype VARCHAR(255) NOT NULL,
|
666 |
-
user_id int(10) NOT NULL,
|
667 |
-
object_id int(10) NOT NULL,
|
668 |
-
object_name varchar(255) NOT NULL,
|
669 |
-
PRIMARY KEY (id)
|
670 |
-
);";
|
671 |
-
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
672 |
-
dbDelta($sql);
|
673 |
-
|
674 |
-
// add ourself as a history item.
|
675 |
-
$plugin_name = urlencode(SIMPLE_HISTORY_NAME);
|
676 |
-
|
677 |
-
#}
|
678 |
-
|
679 |
-
simple_history_add("action=activated&object_type=plugin&object_name=$plugin_name");
|
680 |
-
|
681 |
-
// also generate a rss secret, if it does not exist
|
682 |
-
if (!get_option("simple_history_rss_secret")) {
|
683 |
-
simple_history_update_rss_secret();
|
684 |
-
}
|
685 |
-
|
686 |
-
update_option("simple_history_version", SIMPLE_HISTORY_VERSION);
|
687 |
-
|
688 |
-
}
|
689 |
-
|
690 |
-
function simple_history_print_nav() {
|
691 |
-
|
692 |
-
global $wpdb;
|
693 |
-
$tableprefix = $wpdb->prefix;
|
694 |
-
|
695 |
-
// fetch all types that are in the log
|
696 |
-
if (isset($_GET["simple_history_type_to_show"])) {
|
697 |
-
$simple_history_type_to_show = $_GET["simple_history_type_to_show"];
|
698 |
-
} else {
|
699 |
-
$simple_history_type_to_show = "";
|
700 |
-
}
|
701 |
-
$sql = "SELECT DISTINCT object_type, object_subtype FROM {$tableprefix}simple_history ORDER BY object_type, object_subtype";
|
702 |
-
$arr_types = $wpdb->get_results($sql);
|
703 |
-
#echo "<p>View:</p>";
|
704 |
-
$str_types = "";
|
705 |
-
$str_types .= "<ul class='simple-history-filter simple-history-filter-type'>";
|
706 |
-
$css = "";
|
707 |
-
if (empty($simple_history_type_to_show)) {
|
708 |
-
$css = "class='selected'";
|
709 |
-
}
|
710 |
-
|
711 |
-
// add_query_arg(
|
712 |
-
$link = esc_html(add_query_arg("simple_history_type_to_show", ""));
|
713 |
-
#echo "<li>Filter by type: </li>";
|
714 |
-
$str_types .= "<li $css><a href='$link'>All types</a> | </li>";
|
715 |
-
foreach ($arr_types as $one_type) {
|
716 |
-
$css = "";
|
717 |
-
if ($one_type->object_subtype && $simple_history_type_to_show == ($one_type->object_type."/".$one_type->object_subtype)) {
|
718 |
-
$css = "class='selected'";
|
719 |
-
} elseif (!$one_type->object_subtype && $simple_history_type_to_show == $one_type->object_type) {
|
720 |
-
$css = "class='selected'";
|
721 |
-
}
|
722 |
-
$str_types .= "<li $css>";
|
723 |
-
$arg = "";
|
724 |
-
if ($one_type->object_subtype) {
|
725 |
-
$arg = $one_type->object_type."/".$one_type->object_subtype;
|
726 |
-
} else {
|
727 |
-
$arg = $one_type->object_type;
|
728 |
-
}
|
729 |
-
$link = esc_html(add_query_arg("simple_history_type_to_show", $arg));
|
730 |
-
$str_types .= "<a href='$link'>";
|
731 |
-
$str_types .= $one_type->object_type;
|
732 |
-
if ($one_type->object_subtype) {
|
733 |
-
$str_types .= "/".$one_type->object_subtype;
|
734 |
-
}
|
735 |
-
$str_types .= "</a> | ";
|
736 |
-
$str_types .= "</li>";
|
737 |
-
}
|
738 |
-
$str_types .= "</ul>";
|
739 |
-
$str_types = str_replace("| </li></ul>", "</li></ul>", $str_types);
|
740 |
-
if (!empty($arr_types)) {
|
741 |
-
echo $str_types;
|
742 |
-
}
|
743 |
-
|
744 |
-
// fetch all users that are in the log
|
745 |
-
$sql = "SELECT DISTINCT user_id FROM {$tableprefix}simple_history WHERE user_id <> 0";
|
746 |
-
$arr_users_regular = $wpdb->get_results($sql);
|
747 |
-
foreach ($arr_users_regular as $one_user) {
|
748 |
-
$arr_users[$one_user->user_id] = array("user_id" => $one_user->user_id);
|
749 |
-
}
|
750 |
-
if (!empty($arr_users)) {
|
751 |
-
foreach ($arr_users as $user_id => $one_user) {
|
752 |
-
$user = get_user_by("id", $user_id);
|
753 |
-
if ($user) {
|
754 |
-
$arr_users[$user_id]["user_login"] = $user->user_login;
|
755 |
-
$arr_users[$user_id]["user_nicename"] = $user->user_nicename;
|
756 |
-
if (isset($user->first_name)) {
|
757 |
-
$arr_users[$user_id]["first_name"] = $user->first_name;
|
758 |
-
}
|
759 |
-
if (isset($user->last_name)) {
|
760 |
-
$arr_users[$user_id]["last_name"] = $user->last_name;
|
761 |
-
}
|
762 |
-
}
|
763 |
-
}
|
764 |
-
}
|
765 |
-
|
766 |
-
if ($arr_users) {
|
767 |
-
if (isset($_GET["simple_history_user_to_show"])) {
|
768 |
-
$simple_history_user_to_show = $_GET["simple_history_user_to_show"];
|
769 |
-
} else {
|
770 |
-
$simple_history_user_to_show = "";
|
771 |
-
}
|
772 |
-
$str_users = "";
|
773 |
-
$str_users .= "<ul class='simple-history-filter simple-history-filter-user'>";
|
774 |
-
$css = "";
|
775 |
-
if (empty($simple_history_user_to_show)) {
|
776 |
-
$css = " class='selected' ";
|
777 |
-
}
|
778 |
-
$link = esc_html(add_query_arg("simple_history_user_to_show", ""));
|
779 |
-
#echo "<li>Filter by user: </li>";
|
780 |
-
$str_users .= "<li $css><a href='$link'>" . __("By all users", 'simple-history') ."</a> | </li>";
|
781 |
-
foreach ($arr_users as $user_id => $user_info) {
|
782 |
-
$link = esc_html(add_query_arg("simple_history_user_to_show", $user_id));
|
783 |
-
$css = "";
|
784 |
-
if ($user_id == $simple_history_user_to_show) {
|
785 |
-
$css = " class='selected' ";
|
786 |
-
}
|
787 |
-
$str_users .= "<li $css>";
|
788 |
-
$str_users .= "<a href='$link'>";
|
789 |
-
$str_users .= $user_info["user_nicename"];
|
790 |
-
$str_users .= "</a> | ";
|
791 |
-
$str_users .= "</li>";
|
792 |
-
}
|
793 |
-
$str_users .= "</ul>";
|
794 |
-
$str_users = str_replace("| </li></ul>", "</li></ul>", $str_users);
|
795 |
-
echo $str_users;
|
796 |
-
}
|
797 |
-
|
798 |
-
|
799 |
-
}
|
800 |
-
|
801 |
-
|
802 |
-
// return an array with all events and occasions
|
803 |
-
function simple_history_get_items_array($args) {
|
804 |
-
|
805 |
-
global $wpdb;
|
806 |
-
|
807 |
-
$defaults = array(
|
808 |
-
"page" => 0,
|
809 |
-
"items" => 5,
|
810 |
-
"filter_type" => "",
|
811 |
-
"filter_user" => "",
|
812 |
-
"is_ajax" => false
|
813 |
-
);
|
814 |
-
$args = wp_parse_args( $args, $defaults );
|
815 |
-
|
816 |
-
$simple_history_type_to_show = $args["filter_type"];
|
817 |
-
$simple_history_user_to_show = $args["filter_user"];
|
818 |
-
|
819 |
-
$where = " WHERE 1=1 ";
|
820 |
-
if ($simple_history_type_to_show) {
|
821 |
-
$filter_type = "";
|
822 |
-
$filter_subtype = "";
|
823 |
-
if (strpos($simple_history_type_to_show, "/") !== false) {
|
824 |
-
// split it up
|
825 |
-
$arr_args = explode("/", $simple_history_type_to_show);
|
826 |
-
$filter_type = $arr_args[0];
|
827 |
-
$filter_subtype = $arr_args[1];
|
828 |
-
} else {
|
829 |
-
$filter_type = $simple_history_type_to_show;
|
830 |
-
}
|
831 |
-
$where .= " AND object_type = '$filter_type' ";
|
832 |
-
$where .= " AND object_subtype = '$filter_subtype' ";
|
833 |
-
}
|
834 |
-
if ($simple_history_user_to_show) {
|
835 |
-
$userinfo = get_user_by("slug", $simple_history_user_to_show);
|
836 |
-
$where .= " AND user_id = '" . $userinfo->ID . "'";
|
837 |
-
}
|
838 |
-
|
839 |
-
$tableprefix = $wpdb->prefix;
|
840 |
-
$limit_page = $args["page"] * $args["items"];
|
841 |
-
$limit_items = $args["items"];
|
842 |
-
$sql_limit = " LIMIT $limit_page, $args[items]";
|
843 |
-
|
844 |
-
$sql = "SELECT * FROM {$tableprefix}simple_history $where ORDER BY date DESC ";
|
845 |
-
$rows = $wpdb->get_results($sql);
|
846 |
-
|
847 |
-
$loopNum = 0;
|
848 |
-
$real_loop_num = -1;
|
849 |
-
|
850 |
-
$arr_events = array();
|
851 |
-
if ($rows) {
|
852 |
-
$prev_row = null;
|
853 |
-
foreach ($rows as $one_row) {
|
854 |
-
if (
|
855 |
-
$prev_row
|
856 |
-
&& $one_row->action == $prev_row->action
|
857 |
-
&& $one_row->object_type == $prev_row->object_type
|
858 |
-
&& $one_row->object_type == $prev_row->object_type
|
859 |
-
&& $one_row->object_subtype == $prev_row->object_subtype
|
860 |
-
&& $one_row->user_id == $prev_row->user_id
|
861 |
-
&& $one_row->object_id == $prev_row->object_id
|
862 |
-
&& $one_row->object_name == $prev_row->object_name
|
863 |
-
) {
|
864 |
-
// this event is like the previous event, but only with a different date
|
865 |
-
// so add it to the last element in arr_events
|
866 |
-
$arr_events[$prev_row->id]->occasions[] = $one_row;
|
867 |
-
} else {
|
868 |
-
|
869 |
-
$real_loop_num++;
|
870 |
-
|
871 |
-
#echo "<br>real_loop_num: $real_loop_num";
|
872 |
-
#echo "<br>loop_num: $loopNum";
|
873 |
-
|
874 |
-
if ($args["page"] > 0 && ($args["page"] * $args["items"] > $real_loop_num)) {
|
875 |
-
#echo "<br>CONTINUE";
|
876 |
-
continue;
|
877 |
-
}
|
878 |
-
|
879 |
-
if ($loopNum >= $args["items"]) {
|
880 |
-
#echo "<br>BREAK";
|
881 |
-
break;
|
882 |
-
}
|
883 |
-
|
884 |
-
// new event, not as previous one
|
885 |
-
#echo "<br><br>adding one";
|
886 |
-
$arr_events[$one_row->id] = $one_row;
|
887 |
-
$arr_events[$one_row->id]->occasions = array();
|
888 |
-
|
889 |
-
$prev_row = $one_row;
|
890 |
-
|
891 |
-
$loopNum++;
|
892 |
-
}
|
893 |
-
}
|
894 |
-
}
|
895 |
-
return $arr_events;
|
896 |
-
}
|
897 |
-
|
898 |
-
// output the log
|
899 |
-
// take filtrering into consideration
|
900 |
-
function simple_history_print_history($args = null) {
|
901 |
-
|
902 |
-
$arr_events = simple_history_get_items_array($args);
|
903 |
-
|
904 |
-
$defaults = array(
|
905 |
-
"page" => 0,
|
906 |
-
"items" => 5,
|
907 |
-
"filter_type" => "",
|
908 |
-
"filter_user" => "",
|
909 |
-
"is_ajax" => false
|
910 |
-
);
|
911 |
-
|
912 |
-
$args = wp_parse_args( $args, $defaults );
|
913 |
-
|
914 |
-
if ($arr_events) {
|
915 |
-
if (!$args["is_ajax"]) {
|
916 |
-
// if not ajax, print the div
|
917 |
-
echo "<div id='simple-history-ol-wrapper'><ol class='simple-history'>";
|
918 |
-
}
|
919 |
-
|
920 |
-
$loopNum = 0;
|
921 |
-
$real_loop_num = -1;
|
922 |
-
foreach ($arr_events as $one_row) {
|
923 |
-
|
924 |
-
$real_loop_num++;
|
925 |
-
|
926 |
-
#if ($args["page"] > 0 && ($args["page"] * $args["items"] > $real_loop_num)) {
|
927 |
-
# continue;
|
928 |
-
#}
|
929 |
-
|
930 |
-
#if ($loopNum >= $args["items"]) {
|
931 |
-
# break;
|
932 |
-
#}
|
933 |
-
/*
|
934 |
-
stdClass Object
|
935 |
-
(
|
936 |
-
[id] => 94
|
937 |
-
[date] => 2010-07-03 21:08:43
|
938 |
-
[action] => update
|
939 |
-
[object_type] => post
|
940 |
-
[object_subtype] => page
|
941 |
-
[user_id] => 1
|
942 |
-
[object_id] => 732
|
943 |
-
[occasions] => array
|
944 |
-
)
|
945 |
-
*/
|
946 |
-
#bonny_d($one_row);
|
947 |
-
|
948 |
-
$object_type = $one_row->object_type;
|
949 |
-
$object_subtype = $one_row->object_subtype;
|
950 |
-
$object_id = $one_row->object_id;
|
951 |
-
$object_name = $one_row->object_name;
|
952 |
-
$user_id = $one_row->user_id;
|
953 |
-
$action = $one_row->action;
|
954 |
-
$occasions = $one_row->occasions;
|
955 |
-
$num_occasions = sizeof($occasions);
|
956 |
-
|
957 |
-
$css = "";
|
958 |
-
if ("attachment" == $object_type) {
|
959 |
-
if (wp_get_attachment_image_src($object_id, array(50,50), true)) {
|
960 |
-
// yep, it's an attachment and it has an icon/thumbnail
|
961 |
-
$css .= ' simple-history-has-attachment-thumnbail ';
|
962 |
-
}
|
963 |
-
}
|
964 |
-
if ("user" == $object_type) {
|
965 |
-
$css .= ' simple-history-has-attachment-thumnbail ';
|
966 |
-
}
|
967 |
-
|
968 |
-
if ($num_occasions > 0) {
|
969 |
-
$css .= ' simple-history-has-occasions ';
|
970 |
-
}
|
971 |
-
|
972 |
-
echo "<li class='$css'>";
|
973 |
-
|
974 |
-
echo "<div class='first'>";
|
975 |
-
|
976 |
-
// who performed the action
|
977 |
-
$who = "";
|
978 |
-
$user = get_user_by("id", $user_id);
|
979 |
-
|
980 |
-
$who .= "<span class='who'>";
|
981 |
-
if ($user) {
|
982 |
-
// http://localhost/wordpress3/wp-admin/user-edit.php?user_id=6
|
983 |
-
$user_link = "user-edit.php?user_id={$user->ID}";
|
984 |
-
$who .= "<a href='$user_link'>";
|
985 |
-
$who .= $user->user_nicename;
|
986 |
-
$who .= "</a>";
|
987 |
-
if (isset($user->first_name) && isset($user->last_name)) {
|
988 |
-
if ($user->first_name || $user->last_name) {
|
989 |
-
$who .= " (";
|
990 |
-
if ($user->first_name && $user->last_name) {
|
991 |
-
$who .= $user->first_name . " " . $user->last_name;
|
992 |
-
} else {
|
993 |
-
$who .= $user->first_name . $user->last_name; // just one of them, no space necessary
|
994 |
-
}
|
995 |
-
$who .= ")";
|
996 |
-
}
|
997 |
-
}
|
998 |
-
} else {
|
999 |
-
$who .= "<" . __("Unknown or deleted user", 'simple-history') .">";
|
1000 |
-
}
|
1001 |
-
$who .= "</span>";
|
1002 |
-
|
1003 |
-
// what and object
|
1004 |
-
if ("post" == $object_type) {
|
1005 |
-
|
1006 |
-
$post_out = "";
|
1007 |
-
$post_out .= $object_subtype;
|
1008 |
-
$post = get_post($object_id);
|
1009 |
-
if (null == $post) {
|
1010 |
-
// post does not exist, probably deleted
|
1011 |
-
// check if object_name exists
|
1012 |
-
if ($object_name) {
|
1013 |
-
$post_out .= " <span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span>";
|
1014 |
-
} else {
|
1015 |
-
$post_out .= " <span class='simple-history-title'><unknown name></span>";
|
1016 |
-
}
|
1017 |
-
} else {
|
1018 |
-
#$title = esc_html($post->post_title);
|
1019 |
-
$title = get_the_title($post->ID);
|
1020 |
-
$title = esc_html($title);
|
1021 |
-
$edit_link = get_edit_post_link($object_id, 'display');
|
1022 |
-
$post_out .= " <a href='$edit_link'>";
|
1023 |
-
$post_out .= "<span class='simple-history-title'>{$title}</span>";
|
1024 |
-
$post_out .= "</a>";
|
1025 |
-
}
|
1026 |
-
if ("created" == $action) {
|
1027 |
-
$post_out .= " " . __("created", 'simple-history') . " ";
|
1028 |
-
} elseif ("updated" == $action) {
|
1029 |
-
$post_out .= " " . __("updated", 'simple-history') . " ";
|
1030 |
-
} elseif ("deleted" == $action) {
|
1031 |
-
$post_out .= " " . __("deleted", 'simple-history') . " ";
|
1032 |
-
} else {
|
1033 |
-
$post_out .= " $action";
|
1034 |
-
}
|
1035 |
-
|
1036 |
-
$post_out = ucfirst($post_out);
|
1037 |
-
echo $post_out;
|
1038 |
-
|
1039 |
-
|
1040 |
-
} elseif ("attachment" == $object_type) {
|
1041 |
-
|
1042 |
-
$attachment_out = "";
|
1043 |
-
$attachment_out .= "attachment ";
|
1044 |
-
$post = get_post($object_id);
|
1045 |
-
|
1046 |
-
if ($post) {
|
1047 |
-
$title = esc_html(get_the_title($post->ID));
|
1048 |
-
$edit_link = get_edit_post_link($object_id, 'display');
|
1049 |
-
$attachment_image_src = wp_get_attachment_image_src($object_id, array(50,50), true);
|
1050 |
-
$attachment_image = "";
|
1051 |
-
if ($attachment_image_src) {
|
1052 |
-
$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>";
|
1053 |
-
}
|
1054 |
-
$attachment_out .= $attachment_image;
|
1055 |
-
$attachment_out .= " <a href='$edit_link'>";
|
1056 |
-
$attachment_out .= "<span class='simple-history-title'>{$title}</span>";
|
1057 |
-
$attachment_out .= "</a>";
|
1058 |
-
|
1059 |
-
} else {
|
1060 |
-
if ($object_name) {
|
1061 |
-
$attachment_out .= "<span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span>";
|
1062 |
-
} else {
|
1063 |
-
$attachment_out .= " <span class='simple-history-title'><deleted></span>";
|
1064 |
-
}
|
1065 |
-
}
|
1066 |
-
|
1067 |
-
if ("added" == $action) {
|
1068 |
-
$attachment_out .= " added ";
|
1069 |
-
} elseif ("updated" == $action) {
|
1070 |
-
$attachment_out .= " updated ";
|
1071 |
-
} elseif ("deleted" == $action) {
|
1072 |
-
$attachment_out .= " deleted ";
|
1073 |
-
} else {
|
1074 |
-
$attachment_out .= " $action ";
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
$attachment_out = ucfirst($attachment_out);
|
1078 |
-
echo $attachment_out;
|
1079 |
-
|
1080 |
-
} elseif ("user" == $object_type) {
|
1081 |
-
$user_out = "";
|
1082 |
-
$user_out .= "user";
|
1083 |
-
$user = get_user_by("id", $object_id);
|
1084 |
-
if ($user) {
|
1085 |
-
$user_link = "user-edit.php?user_id={$user->ID}";
|
1086 |
-
$user_out .= "<span class='simple-history-title'>";
|
1087 |
-
$user_out .= " <a href='$user_link'>";
|
1088 |
-
$user_out .= $user->user_nicename;
|
1089 |
-
$user_out .= "</a>";
|
1090 |
-
if (isset($user->first_name) && isset($user->last_name)) {
|
1091 |
-
if ($user->first_name || $user->last_name) {
|
1092 |
-
$user_out .= " (";
|
1093 |
-
if ($user->first_name && $user->last_name) {
|
1094 |
-
$user_out .= $user->first_name . " " . $user->last_name;
|
1095 |
-
} else {
|
1096 |
-
$user_out .= $user->first_name . $user->last_name; // just one of them, no space necessary
|
1097 |
-
}
|
1098 |
-
$user_out .= ")";
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
$user_out .= "</span>";
|
1102 |
-
} else {
|
1103 |
-
// most likely deleted user
|
1104 |
-
$user_link = "";
|
1105 |
-
$user_out .= " \"$object_name\"";
|
1106 |
-
}
|
1107 |
-
|
1108 |
-
$user_avatar = get_avatar($user->user_email, "50");
|
1109 |
-
if ($user_link) {
|
1110 |
-
$user_out .= "<a class='simple-history-attachment-thumbnail' href='$user_link'>$user_avatar</a>";
|
1111 |
-
} else {
|
1112 |
-
$user_out .= "<span class='simple-history-attachment-thumbnail' href='$user_link'>$user_avatar</span>";
|
1113 |
-
}
|
1114 |
-
|
1115 |
-
if ("created" == $action) {
|
1116 |
-
$user_out .= " " . __("added", 'simple-history') . " ";
|
1117 |
-
} elseif ("updated" == $action) {
|
1118 |
-
$user_out .= " " . __("updated", 'simple-history') . " " ;
|
1119 |
-
} elseif ("deleted" == $action) {
|
1120 |
-
$user_out .= " " . __("deleted", 'simple-history') . " ";
|
1121 |
-
} elseif ("logged_in" == $action) {
|
1122 |
-
$user_out .= " " . __("logged in", 'simple-history') . " ";
|
1123 |
-
} elseif ("logged_out" == $action) {
|
1124 |
-
$user_out .= " " . __("logged out", 'simple-history') . " ";
|
1125 |
-
} else {
|
1126 |
-
$user_out .= " $action";
|
1127 |
-
}
|
1128 |
-
|
1129 |
-
$user_out = ucfirst($user_out);
|
1130 |
-
echo $user_out;
|
1131 |
-
|
1132 |
-
} elseif ("comment" == $object_type) {
|
1133 |
-
|
1134 |
-
$comment_link = get_edit_comment_link($object_id);
|
1135 |
-
echo ucwords($object_type) . " $object_subtype <a href='$comment_link'><span class='simple-history-title'>$object_name\"</span></a> $action";
|
1136 |
-
|
1137 |
-
} else {
|
1138 |
-
|
1139 |
-
// unknown/general type
|
1140 |
-
echo ucwords($object_type) . " $object_subtype <span class='simple-history-title'>\"$object_name\"</span> $action";
|
1141 |
-
|
1142 |
-
}
|
1143 |
-
echo "</div>";
|
1144 |
-
|
1145 |
-
echo "<div class='second'>";
|
1146 |
-
// when
|
1147 |
-
$date_i18n_date = date_i18n(get_option('date_format'), strtotime($one_row->date), $gmt=false);
|
1148 |
-
$date_i18n_time = date_i18n(get_option('time_format'), strtotime($one_row->date), $gmt=false);
|
1149 |
-
echo "By $who, ";
|
1150 |
-
$now = strtotime(current_time("mysql"));
|
1151 |
-
$diff_str = sprintf( __('%s ago'), human_time_diff(strtotime($one_row->date), $now) );
|
1152 |
-
echo "<span class='when'>".$diff_str."</span>";
|
1153 |
-
echo "<span class='when_detail'>$date_i18n_date at $date_i18n_time</span>";
|
1154 |
-
echo "</div>";
|
1155 |
-
|
1156 |
-
// occasions
|
1157 |
-
if ($num_occasions > 0) {
|
1158 |
-
echo "<div class='third'>";
|
1159 |
-
if ($num_occasions == 1) {
|
1160 |
-
$one_occasion = __("+ 1 occasion", 'simple-history');
|
1161 |
-
echo "<a class='simple-history-occasion-show' href='#'>$one_occasion</a>";
|
1162 |
-
} else {
|
1163 |
-
$many_occasion = sprintf(__("+ %d occasions", 'simple-history'), $num_occasions);
|
1164 |
-
echo "<a class='simple-history-occasion-show' href='#'>$many_occasion</a>";
|
1165 |
-
}
|
1166 |
-
echo "<ul class='simple-history-occasions hidden'>";
|
1167 |
-
foreach ($occasions as $one_occasion) {
|
1168 |
-
echo "<li>";
|
1169 |
-
$date_i18n_date = date_i18n(get_option('date_format'), strtotime($one_occasion->date), $gmt=false);
|
1170 |
-
$date_i18n_time = date_i18n(get_option('time_format'), strtotime($one_occasion->date), $gmt=false);
|
1171 |
-
echo sprintf( __('%s ago (%s at %s)', "simple-history"), human_time_diff(strtotime($one_occasion->date), $now), $date_i18n_date, $date_i18n_time );
|
1172 |
-
|
1173 |
-
echo "</li>";
|
1174 |
-
}
|
1175 |
-
echo "</ul>";
|
1176 |
-
echo "</div>";
|
1177 |
-
}
|
1178 |
-
|
1179 |
-
|
1180 |
-
echo "</li>";
|
1181 |
-
|
1182 |
-
$loopNum++;
|
1183 |
-
}
|
1184 |
-
|
1185 |
-
// if $loopNum == 0 no items where found for this page
|
1186 |
-
if ($loopNum == 0) {
|
1187 |
-
echo "simpleHistoryNoMoreItems";
|
1188 |
-
}
|
1189 |
-
|
1190 |
-
if (!$args["is_ajax"]) {
|
1191 |
-
// if not ajax, print the divs and stuff we need
|
1192 |
-
$show_more = sprintf(__("Show %d more", 'simple-history'), $args["items"]);
|
1193 |
-
$loading = __("Loading...", 'simple-history');
|
1194 |
-
$no_more_found = __("No more history items found.", 'simple-history');
|
1195 |
-
$view_rss = __("Simple History RSS feed", 'simple-history');
|
1196 |
-
$view_rss_link = simple_history_get_rss_address();
|
1197 |
-
|
1198 |
-
echo "</ol>
|
1199 |
-
</div>
|
1200 |
-
<p id='simple-history-load-more'><a href='#'>$show_more</a></p>
|
1201 |
-
<p class='hidden' id='simple-history-load-more-loading'>$loading</p>
|
1202 |
-
<p class='hidden' id='simple-history-no-more-items'>$no_more_found</p>
|
1203 |
-
<p id='simple-history-rss-feed-dashboard'><a title='$view_rss' href='$view_rss_link'>$view_rss</a></p>
|
1204 |
-
<p id='simple-history-rss-feed-page'><a title='$view_rss' href='$view_rss_link'><span></span>$view_rss</a></p>
|
1205 |
-
";
|
1206 |
-
}
|
1207 |
-
} else {
|
1208 |
-
if ($args["is_ajax"]) {
|
1209 |
-
echo "simpleHistoryNoMoreItems";
|
1210 |
-
} else {
|
1211 |
-
$no_found = __("No history items found.", 'simple-history');
|
1212 |
-
$please_note = __("Please note that Simple History only records things that happen after this plugin have been installed.", 'simple-history');
|
1213 |
-
echo "<p>$no_found</p>";
|
1214 |
-
echo "<p>$please_note</p>";
|
1215 |
-
}
|
1216 |
-
|
1217 |
-
}
|
1218 |
-
}
|
1219 |
-
|
1220 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/languages/simple-history-zh_CN.mo
DELETED
Binary file
|
trunk/languages/simple-history-zh_CN.po
DELETED
@@ -1,144 +0,0 @@
|
|
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
DELETED
@@ -1,145 +0,0 @@
|
|
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 |
-
#, fuzzy
|
7 |
-
msgid ""
|
8 |
-
msgstr ""
|
9 |
-
"Project-Id-Version: \n"
|
10 |
-
"Report-Msgid-Bugs-To: http://wordpress.org/tag/simple-history\n"
|
11 |
-
"POT-Creation-Date: 2010-09-19 18:24+0000\n"
|
12 |
-
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
13 |
-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
-
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
-
"MIME-Version: 1.0\n"
|
16 |
-
"Content-Type: text/plain; charset=utf-8\n"
|
17 |
-
"Content-Transfer-Encoding: 8bit\n"
|
18 |
-
|
19 |
-
#: index.php:126 index.php:168
|
20 |
-
#, php-format
|
21 |
-
msgid "Simple History for %s"
|
22 |
-
msgstr ""
|
23 |
-
|
24 |
-
#: index.php:127 index.php:169
|
25 |
-
#, php-format
|
26 |
-
msgid "WordPress History for %s"
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: index.php:139
|
30 |
-
#, php-format
|
31 |
-
msgid "By %s"
|
32 |
-
msgstr ""
|
33 |
-
|
34 |
-
#: index.php:143
|
35 |
-
#, php-format
|
36 |
-
msgid "%d occasions"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: index.php:173
|
40 |
-
msgid "Wrong RSS secret"
|
41 |
-
msgstr ""
|
42 |
-
|
43 |
-
#: index.php:174
|
44 |
-
msgid ""
|
45 |
-
"Your RSS secret for Simple History RSS feed is wrong. Please see WordPress "
|
46 |
-
"settings for current link to the RSS feed."
|
47 |
-
msgstr ""
|
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 ""
|
60 |
-
|
61 |
-
#: index.php:294
|
62 |
-
msgid ""
|
63 |
-
"This is a secret RSS feed for Simple History. Only share the link with "
|
64 |
-
"people you trust"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: index.php:297
|
68 |
-
#, php-format
|
69 |
-
msgid ""
|
70 |
-
"You can <a href='%s'>generate a new address</a> for the RSS feed. This is "
|
71 |
-
"useful if you think that the address has fallen into the wrong hands."
|
72 |
-
msgstr ""
|
73 |
-
|
74 |
-
#: index.php:320 index.php:335 index.php:366
|
75 |
-
#, php-format
|
76 |
-
msgid "From %1$s on %2$s"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: index.php:811
|
80 |
-
msgid "By all users"
|
81 |
-
msgstr ""
|
82 |
-
|
83 |
-
#: index.php:1031
|
84 |
-
msgid "Unknown or deleted user"
|
85 |
-
msgstr ""
|
86 |
-
|
87 |
-
#: index.php:1058
|
88 |
-
msgid "created"
|
89 |
-
msgstr ""
|
90 |
-
|
91 |
-
#: index.php:1060 index.php:1153
|
92 |
-
msgid "updated"
|
93 |
-
msgstr ""
|
94 |
-
|
95 |
-
#: index.php:1062 index.php:1155
|
96 |
-
msgid "deleted"
|
97 |
-
msgstr ""
|
98 |
-
|
99 |
-
#: index.php:1151
|
100 |
-
msgid "added"
|
101 |
-
msgstr ""
|
102 |
-
|
103 |
-
#: index.php:1157
|
104 |
-
msgid "logged in"
|
105 |
-
msgstr ""
|
106 |
-
|
107 |
-
#: index.php:1159
|
108 |
-
msgid "logged out"
|
109 |
-
msgstr ""
|
110 |
-
|
111 |
-
#: index.php:1193
|
112 |
-
msgid "+ 1 occasion"
|
113 |
-
msgstr ""
|
114 |
-
|
115 |
-
#: index.php:1196
|
116 |
-
#, php-format
|
117 |
-
msgid "+ %d occasions"
|
118 |
-
msgstr ""
|
119 |
-
|
120 |
-
#: index.php:1225
|
121 |
-
#, php-format
|
122 |
-
msgid "Show %d more"
|
123 |
-
msgstr ""
|
124 |
-
|
125 |
-
#: index.php:1226
|
126 |
-
msgid "Loading..."
|
127 |
-
msgstr ""
|
128 |
-
|
129 |
-
#: index.php:1227
|
130 |
-
msgid "No more history items found."
|
131 |
-
msgstr ""
|
132 |
-
|
133 |
-
#: index.php:1228
|
134 |
-
msgid "Simple History RSS feed"
|
135 |
-
msgstr ""
|
136 |
-
|
137 |
-
#: index.php:1244
|
138 |
-
msgid "No history items found."
|
139 |
-
msgstr ""
|
140 |
-
|
141 |
-
#: index.php:1245
|
142 |
-
msgid ""
|
143 |
-
"Please note that Simple History only records things that happen after this "
|
144 |
-
"plugin have been installed."
|
145 |
-
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/readme.txt
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
=== Plugin Name ===
|
2 |
-
Contributors: eskapism, MarsApril
|
3 |
-
Donate link: http://eskapism.se/sida/donate/
|
4 |
-
Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
|
5 |
-
Requires at least: 2.9.2
|
6 |
-
Tested up to: 3.0
|
7 |
-
Stable tag: 0.3.11
|
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 |
-
Users of the system can
|
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 |
-
|
21 |
-
All **changes are also available as a RSS feed** so you can keep track of the changes made
|
22 |
-
via your favorite RSS reader on your phone, on your iPad, or on your computer.
|
23 |
-
|
24 |
-
It’s a plugin that is good to have on websites where several people are
|
25 |
-
involved in editing the content.
|
26 |
-
|
27 |
-
#### Example scenarios
|
28 |
-
|
29 |
-
Keep track of what other people are doing:
|
30 |
-
_"Has someone done anything today? Ah, Sarah uploaded
|
31 |
-
the new press release and created an article for it. Great! Now I don't have to do that."_
|
32 |
-
|
33 |
-
Or for debug purposes:
|
34 |
-
_"The site feels very slow since yesterday. Has anyone done anything special? ... Ah, Steven activated 'naughy-plugin-x',
|
35 |
-
that must be it."_
|
36 |
-
|
37 |
-
#### See it in action
|
38 |
-
See the plugin in action with this short screencast:
|
39 |
-
[youtube http://www.youtube.com/watch?v=4cu4kooJBzs]
|
40 |
-
|
41 |
-
#### Add your own events to simple history
|
42 |
-
If you are a plugin developer and would like to add your own things/events to Simple History
|
43 |
-
you can do that by calling the function simple_history_add like this:
|
44 |
-
`<?php
|
45 |
-
# will return “Plugin your_plugin_name Edited”
|
46 |
-
simple_history_add("action=edited&object_type=plugin&object_name=your_plugin_name");
|
47 |
-
?>`
|
48 |
-
|
49 |
-
`<?php simple_history_add("action=repaired&object_type=starship&object_name=USS Enterprise"); ?>`
|
50 |
-
|
51 |
-
#### Donation and more plugins
|
52 |
-
* If you like this plugin don't forget to [donate to support further development](http://eskapism.se/sida/donate/).
|
53 |
-
* More [WordPress CMS plugins](http://wordpress.org/extend/plugins/profile/eskapism) by the same author.
|
54 |
-
|
55 |
-
== Installation ==
|
56 |
-
|
57 |
-
1. Upload the folder "simple-history" to "/wp-content/plugins/"
|
58 |
-
1. Activate the plugin through the "Plugins" menu in WordPress
|
59 |
-
1. Done!
|
60 |
-
|
61 |
-
Now Simple History will be visible both on the dashboard and in the menu under pages.
|
62 |
-
|
63 |
-
== Feedback ==
|
64 |
-
Like the plugin? Dislike it? Got bugs or feature request?
|
65 |
-
Great! Contact me at par.thernstrom@gmail.com or at twitter.com/eskapism and hopefully
|
66 |
-
I can do something about it.
|
67 |
-
|
68 |
-
== Screenshots ==
|
69 |
-
|
70 |
-
1. Simple History as it looks on your (well, mine anyway..) dashboard.
|
71 |
-
|
72 |
-
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
|
73 |
-
to only use the secret RSS feed to keep track of the changes on you web site/WordPress installation.
|
74 |
-
|
75 |
-
3. The RSS feed with changes, as shown in Firefox.
|
76 |
-
|
77 |
-
== Changelog ==
|
78 |
-
|
79 |
-
= 0.3.11 =
|
80 |
-
- Fixed: titles are now escaped
|
81 |
-
|
82 |
-
= 0.3.10 =
|
83 |
-
- Added chinese translation
|
84 |
-
- Fixed a variable notice
|
85 |
-
- More visible ok-message after setting a new RSS secret
|
86 |
-
|
87 |
-
= 0.3.9 =
|
88 |
-
- Attachment names were urlencoded and looked wierd. Now they're not.
|
89 |
-
- Started to store plugin version number
|
90 |
-
|
91 |
-
= 0.3.8 =
|
92 |
-
- Added chinese translation
|
93 |
-
- Uses WordPress own human_time_diff() instead of own version
|
94 |
-
- Fix for time zones
|
95 |
-
|
96 |
-
= 0.3.7 =
|
97 |
-
- 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.
|
98 |
-
|
99 |
-
= 0.3.6 =
|
100 |
-
- 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!
|
101 |
-
- Added POT-file
|
102 |
-
|
103 |
-
= 0.3.5 =
|
104 |
-
- using get_the_title instead of fetching the title directly from the post object. should make plugins like qtranslate work a bit better.
|
105 |
-
- preparing for translation by using __() and _e() functions. POT-file will be available shortly.
|
106 |
-
- Could get cryptic "simpleHistoryNoMoreItems"-text when loading a type with no items.
|
107 |
-
|
108 |
-
= 0.3.4 =
|
109 |
-
- RSS-feed is now valid, and should work at more places (could be broken because of html entities and stuff)
|
110 |
-
|
111 |
-
= 0.3.3 =
|
112 |
-
- Moved JavaScript to own file
|
113 |
-
- 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)
|
114 |
-
|
115 |
-
= 0.3.2 =
|
116 |
-
- fixed some php notice messages + some other small things I don't remember..
|
117 |
-
|
118 |
-
= 0.3.1 =
|
119 |
-
- forgot to escape html for posts
|
120 |
-
- reduced memory usage... I think/hope...
|
121 |
-
- changes internal verbs for actions. some old history items may look a bit weird.
|
122 |
-
- added RSS feed for recent changes - keep track of changes via your favorite RSS-reader
|
123 |
-
|
124 |
-
= 0.3 =
|
125 |
-
- page is now added under dashboard (was previously under tools). just feel better.
|
126 |
-
- mouse over on date now display detailed date a bit faster
|
127 |
-
- layout fixes to make it cooler, better, faster, stronger
|
128 |
-
- 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!
|
129 |
-
- the name of deleted items now show up, instead of "Unknown name" or similar
|
130 |
-
- added support for plugins (who activated/deactivated what plugin)
|
131 |
-
- support for third party history items. Use like this:
|
132 |
-
simple_history_add("action=repaired&object_type=starship&object_name=USS Enterprise");
|
133 |
-
this would result in somehting like this:
|
134 |
-
Starship "USS Enterprise" repaired
|
135 |
-
by admin (John Doe), just now
|
136 |
-
- capability edit_pages needed to show history. Is this an appropriate capability do you think?
|
137 |
-
|
138 |
-
= 0.2 =
|
139 |
-
* Compatible with 2.9.2
|
140 |
-
|
141 |
-
= 0.1 =
|
142 |
-
* First public version. It works!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/screenshot-1.png
DELETED
Binary file
|
trunk/screenshot-2.png
DELETED
Binary file
|
trunk/screenshot-3.png
DELETED
Binary file
|
trunk/scripts.js
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
|
2 |
-
/**
|
3 |
-
* load history items via ajax
|
4 |
-
*/
|
5 |
-
var simple_history_current_page = 0;
|
6 |
-
jQuery(".simple-history-filter a").live("click", function() {
|
7 |
-
$t = jQuery(this);
|
8 |
-
$t.closest("ul").find("li").removeClass("selected");
|
9 |
-
$t.closest("li").addClass("selected");
|
10 |
-
$ol = jQuery("ol.simple-history");
|
11 |
-
|
12 |
-
jQuery(".simple-history-added-by-ajax").remove();
|
13 |
-
|
14 |
-
var $wrapper = jQuery("#simple-history-ol-wrapper");
|
15 |
-
$wrapper.height($wrapper.height()); // so dashboard widget does not collapse when loading new items
|
16 |
-
|
17 |
-
jQuery("#simple-history-load-more").hide("fast");
|
18 |
-
$ol.fadeOut("fast");
|
19 |
-
jQuery("#simple-history-no-more-items").hide();
|
20 |
-
|
21 |
-
simple_history_current_page = 0;
|
22 |
-
var data = {
|
23 |
-
"action": "simple_history_ajax",
|
24 |
-
"type": jQuery(".simple-history-filter-type li.selected a").text(),
|
25 |
-
"user": jQuery(".simple-history-filter-user li.selected a").text()
|
26 |
-
};
|
27 |
-
jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
|
28 |
-
if (data == "simpleHistoryNoMoreItems") {
|
29 |
-
jQuery("#simple-history-load-more,#simple-history-load-more-loading").hide();
|
30 |
-
jQuery("#simple-history-no-more-items").show();
|
31 |
-
jQuery("#simple-history-ol-wrapper").height("auto");
|
32 |
-
} else {
|
33 |
-
$ol.html(data);
|
34 |
-
$ol.fadeIn("fast");
|
35 |
-
$wrapper.height("auto");
|
36 |
-
jQuery("#simple-history-load-more").fadeIn("fast");
|
37 |
-
}
|
38 |
-
});
|
39 |
-
|
40 |
-
return false;
|
41 |
-
});
|
42 |
-
|
43 |
-
jQuery("#simple-history-load-more a").live("click", function() {
|
44 |
-
simple_history_current_page++;
|
45 |
-
|
46 |
-
jQuery("#simple-history-load-more,#simple-history-load-more-loading").toggle();
|
47 |
-
|
48 |
-
$ol = jQuery("ol.simple-history:last");
|
49 |
-
var data = {
|
50 |
-
"action": "simple_history_ajax",
|
51 |
-
"type": jQuery(".simple-history-filter-type li.selected a").text(),
|
52 |
-
"user": jQuery(".simple-history-filter-user li.selected a").text(),
|
53 |
-
"page": simple_history_current_page
|
54 |
-
};
|
55 |
-
jQuery.post(ajaxurl, data, function(data, textStatus, XMLHttpRequest){
|
56 |
-
|
57 |
-
// if data = simpleHistoryNoMoreItems then no more items found, so hide load-more-link
|
58 |
-
if (data == "simpleHistoryNoMoreItems") {
|
59 |
-
jQuery("#simple-history-load-more,#simple-history-load-more-loading").hide();
|
60 |
-
jQuery("#simple-history-no-more-items").show();
|
61 |
-
} else {
|
62 |
-
var $new_elm = jQuery("<ol class='simple-history simple-history-added-by-ajax'>" + data + "</ol>");
|
63 |
-
$new_elm.hide();
|
64 |
-
$ol.after($new_elm);
|
65 |
-
$new_elm.show("slow");
|
66 |
-
jQuery("#simple-history-load-more,#simple-history-load-more-loading").toggle();
|
67 |
-
}
|
68 |
-
});
|
69 |
-
return false;
|
70 |
-
});
|
71 |
-
|
72 |
-
jQuery("ol.simple-history .when").live("mouseover", function() {
|
73 |
-
jQuery(this).closest("li").find(".when_detail").fadeIn("fast");
|
74 |
-
});
|
75 |
-
jQuery("ol.simple-history .when").live("mouseout", function() {
|
76 |
-
jQuery(this).closest("li").find(".when_detail").fadeOut("fast");
|
77 |
-
});
|
78 |
-
|
79 |
-
// show occasions
|
80 |
-
jQuery("a.simple-history-occasion-show").live("click", function() {
|
81 |
-
jQuery(this).closest("li").find("ul.simple-history-occasions").toggle("fast");
|
82 |
-
return false;
|
83 |
-
});
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/styles.css
DELETED
@@ -1,148 +0,0 @@
|
|
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 li.selected a {
|
10 |
-
font-weight: bold;
|
11 |
-
text-decoration: none;
|
12 |
-
color: black;
|
13 |
-
}
|
14 |
-
|
15 |
-
ol.simple-history {
|
16 |
-
list-style-type: none;
|
17 |
-
margin: 0;
|
18 |
-
padding: 0;
|
19 |
-
}
|
20 |
-
ol.simple-history li {
|
21 |
-
margin-bottom: 1.5em;
|
22 |
-
margin-top: 1.5em;
|
23 |
-
/*
|
24 |
-
xpadding-bottom: 1em;
|
25 |
-
xborder-bottom: 1px solid #eee;
|
26 |
-
*/
|
27 |
-
position: relative;
|
28 |
-
line-height: 1.5;
|
29 |
-
}
|
30 |
-
ol.simple-history .first {
|
31 |
-
font-size: 13px;
|
32 |
-
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif;
|
33 |
-
margin: 0 0 0.2em;
|
34 |
-
/* margin-left: 60px; */
|
35 |
-
}
|
36 |
-
|
37 |
-
ol.simple-history .second {
|
38 |
-
color: #999;
|
39 |
-
/* margin-left: 60px; */
|
40 |
-
}
|
41 |
-
|
42 |
-
ol.simple-history .when {
|
43 |
-
color: #999;
|
44 |
-
cursor: help;
|
45 |
-
border-bottom: 1px dotted #bbb;
|
46 |
-
}
|
47 |
-
ol.simple-history .when_detail {
|
48 |
-
/* margin-left: .5em; */
|
49 |
-
display: none;
|
50 |
-
position: relative;
|
51 |
-
top: 1.75em;
|
52 |
-
left: -2em;
|
53 |
-
padding: .5ex;
|
54 |
-
background-color: #fffdb5;
|
55 |
-
border: 1px solid #eee;
|
56 |
-
color: black;
|
57 |
-
}
|
58 |
-
|
59 |
-
.simple-history-attachment-thumbnail {
|
60 |
-
position: absolute;
|
61 |
-
left: 0;
|
62 |
-
top: 0;
|
63 |
-
}
|
64 |
-
.simple-history-title {
|
65 |
-
font-weight: bold;
|
66 |
-
}
|
67 |
-
|
68 |
-
li.simple-history-has-attachment-thumnbail {
|
69 |
-
min-height: 50px;
|
70 |
-
}
|
71 |
-
ol.simple-history .simple-history-has-attachment-thumnbail .first,
|
72 |
-
ol.simple-history .simple-history-has-attachment-thumnbail .second,
|
73 |
-
ol.simple-history .simple-history-has-attachment-thumnbail .third
|
74 |
-
{
|
75 |
-
margin-left: 60px;
|
76 |
-
}
|
77 |
-
|
78 |
-
.simple-history-discrete {
|
79 |
-
font-size: 11px;
|
80 |
-
color: #999;
|
81 |
-
}
|
82 |
-
|
83 |
-
.simple-history-added-by-ajax {
|
84 |
-
border-top: 1px solid #ddd;
|
85 |
-
}
|
86 |
-
|
87 |
-
ul.simple-history-occasions {
|
88 |
-
margin: 0;
|
89 |
-
padding: 0;
|
90 |
-
list-style-type: none;
|
91 |
-
color: #999999;
|
92 |
-
}
|
93 |
-
ul.simple-history-occasions li {
|
94 |
-
margin: 0;
|
95 |
-
padding: 0;
|
96 |
-
}
|
97 |
-
|
98 |
-
#simple-history-no-more-items {
|
99 |
-
padding: .5em;
|
100 |
-
background-color: #FFFFE0;
|
101 |
-
border: 1px solid #E6DB55;
|
102 |
-
font-weight: bold;
|
103 |
-
}
|
104 |
-
|
105 |
-
#simple-history-rss-feed-dashboard {
|
106 |
-
display: none;
|
107 |
-
}
|
108 |
-
|
109 |
-
#simple_history_dashboard_widget #simple-history-rss-feed-dashboard {
|
110 |
-
position: absolute;
|
111 |
-
bottom: 0;
|
112 |
-
right: 0;
|
113 |
-
margin: 0;
|
114 |
-
display: block;
|
115 |
-
}
|
116 |
-
#simple-history-rss-feed-dashboard a,
|
117 |
-
#simple-history-rss-feed-page span
|
118 |
-
{
|
119 |
-
background: transparent url(http://jquery-ui.googlecode.com/svn/trunk/themes/base/images/ui-icons_888888_256x240.png) no-repeat -17px -176px;
|
120 |
-
display: block;
|
121 |
-
width: 16px;
|
122 |
-
height: 16px;
|
123 |
-
text-indent: -99999px;
|
124 |
-
}
|
125 |
-
|
126 |
-
#simple_history_dashboard_widget #simple-history-rss-feed-page {
|
127 |
-
display: none;
|
128 |
-
}
|
129 |
-
#simple-history-rss-feed-page {
|
130 |
-
display: block;
|
131 |
-
padding-top: 10px;
|
132 |
-
border-top: 1px solid #ccc;
|
133 |
-
}
|
134 |
-
#simple-history-rss-feed-page span {
|
135 |
-
float: left;
|
136 |
-
}
|
137 |
-
#simple-history-rss-feed-page a {
|
138 |
-
}
|
139 |
-
|
140 |
-
.simple-history-settings-page-updated {
|
141 |
-
font-weight: bold;
|
142 |
-
margin: 5px 0 15px;
|
143 |
-
background-color: #FFFFE0;
|
144 |
-
border: 1px solid #E6DB55;
|
145 |
-
}
|
146 |
-
.simple-history-settings-page-updated p {
|
147 |
-
margin: 0.5em !important;
|
148 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|