Version Description
(January 2015) =
- Fixed: Deleted attachments did not get translations.
- Fixed: A notice when showing details for a deleted attachment.
Download this release
Release Info
Developer | eskapism |
Plugin | Simple History |
Version | 2.0.12 |
Comparing to | |
See all releases |
Code changes from version 2.0.11 to 2.0.12
- SimpleHistory.php +1 -1
- index.php +1 -1
- loggers/SimpleMediaLogger.php +47 -30
- readme.txt +6 -1
SimpleHistory.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
class SimpleHistory {
|
7 |
|
8 |
const NAME = "Simple History";
|
9 |
-
const VERSION = "2.0.
|
10 |
|
11 |
/**
|
12 |
* Capability required to view the history log
|
6 |
class SimpleHistory {
|
7 |
|
8 |
const NAME = "Simple History";
|
9 |
+
const VERSION = "2.0.12";
|
10 |
|
11 |
/**
|
12 |
* Capability required to view the history log
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Simple History
|
4 |
Plugin URI: http://simple-history.com
|
5 |
Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
|
6 |
-
Version: 2.0.
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://simple-history.com/
|
9 |
License: GPL2
|
3 |
Plugin Name: Simple History
|
4 |
Plugin URI: http://simple-history.com
|
5 |
Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
|
6 |
+
Version: 2.0.12
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://simple-history.com/
|
9 |
License: GPL2
|
loggers/SimpleMediaLogger.php
CHANGED
@@ -10,12 +10,12 @@ class SimpleMediaLogger extends SimpleLogger
|
|
10 |
|
11 |
/**
|
12 |
* Get array with information about this logger
|
13 |
-
*
|
14 |
* @return array
|
15 |
*/
|
16 |
function getInfo() {
|
17 |
|
18 |
-
$arr_info = array(
|
19 |
"name" => "Media/Attachments Logger",
|
20 |
"description" => "Logs media uploads and edits",
|
21 |
"capability" => "edit_pages",
|
@@ -30,24 +30,24 @@ class SimpleMediaLogger extends SimpleLogger
|
|
30 |
"options" => array(
|
31 |
_x("Added media", "Media logger: search", "simple-history") => array(
|
32 |
"attachment_created"
|
33 |
-
),
|
34 |
_x("Updated media", "Media logger: search", "simple-history") => array(
|
35 |
"attachment_updated"
|
36 |
-
),
|
37 |
_x("Deleted media", "Media logger: search", "simple-history") => array(
|
38 |
"attachment_deleted"
|
39 |
-
),
|
40 |
)
|
41 |
) // end search array
|
42 |
) // end labels
|
43 |
);
|
44 |
-
|
45 |
return $arr_info;
|
46 |
|
47 |
}
|
48 |
|
49 |
public function loaded() {
|
50 |
-
|
51 |
add_action("admin_init", array($this, "on_admin_init"));
|
52 |
|
53 |
}
|
@@ -64,7 +64,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
64 |
* Modify plain output to inlcude link to post
|
65 |
*/
|
66 |
public function getLogRowPlainTextOutput($row) {
|
67 |
-
|
68 |
$message = $row->message;
|
69 |
$context = $row->context;
|
70 |
$message_key = $context["_message_key"];
|
@@ -72,7 +72,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
72 |
$attachment_id = $context["attachment_id"];
|
73 |
$attachment_post = get_post( $attachment_id );
|
74 |
$attachment_is_available = is_a($attachment_post, "WP_Post");
|
75 |
-
|
76 |
// Only link to attachment if it is still available
|
77 |
if ( $attachment_is_available ) {
|
78 |
|
@@ -83,16 +83,23 @@ class SimpleMediaLogger extends SimpleLogger
|
|
83 |
} else if ( "attachment_created" == $message_key ) {
|
84 |
|
85 |
$message = __('Uploaded {post_type} <a href="{edit_link}">"{attachment_title}"</a>', "simple-history");
|
86 |
-
|
87 |
}
|
88 |
|
89 |
-
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
$context["attachment_filename"] = esc_html( $context["attachment_filename"] );
|
93 |
-
$context["edit_link"] = get_edit_post_link( $attachment_id );
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
}
|
98 |
|
@@ -105,12 +112,16 @@ class SimpleMediaLogger extends SimpleLogger
|
|
105 |
$message_key = $context["_message_key"];
|
106 |
$output = "";
|
107 |
|
|
|
|
|
|
|
|
|
108 |
if ( "attachment_updated" == $message_key ) {
|
109 |
-
|
110 |
// Attachment is changed = don't show thumbs and all
|
111 |
|
112 |
} else if ( "attachment_deleted" == $message_key ) {
|
113 |
-
|
114 |
// Attachment is deleted = don't show thumbs and all
|
115 |
|
116 |
} else if ( "attachment_created" == $message_key ) {
|
@@ -148,7 +159,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
148 |
$context["full_image_width"] = $full_image_width;
|
149 |
$context["full_image_height"] = $full_image_height;
|
150 |
$context["attachment_thumb"] = sprintf('<div class="SimpleHistoryLogitemThumbnail"><img src="%1$s"></div>', $thumb_src[0] );
|
151 |
-
|
152 |
}
|
153 |
|
154 |
} else if ($is_audio) {
|
@@ -164,22 +175,28 @@ class SimpleMediaLogger extends SimpleLogger
|
|
164 |
} else {
|
165 |
|
166 |
// use wordpress icon for other media types
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
}
|
170 |
-
|
171 |
$context["attachment_size_format"] = size_format( $row->context["attachment_filesize"] );
|
172 |
$context["attachment_filetype_extension"] = strtoupper( $filetype["ext"] );
|
173 |
|
174 |
if ( ! empty( $context["attachment_thumb"] ) ) {
|
175 |
-
|
176 |
-
if ($is_image) {
|
177 |
$message .= "<a href='".$edit_link."'>";
|
178 |
}
|
179 |
-
|
180 |
$message .= __('{attachment_thumb}', 'simple-history');
|
181 |
-
|
182 |
-
if ($is_image) {
|
183 |
$message .= "</a>";
|
184 |
}
|
185 |
|
@@ -216,7 +233,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
216 |
if ( file_exists( $file ) ) {
|
217 |
$file_size = filesize( $file );
|
218 |
}
|
219 |
-
|
220 |
$this->infoMessage(
|
221 |
'attachment_created',
|
222 |
array(
|
@@ -230,7 +247,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
230 |
);
|
231 |
|
232 |
}
|
233 |
-
|
234 |
/**
|
235 |
* An attachmet is changed
|
236 |
* is this only being called if the title of the attachment is changed?!
|
@@ -238,7 +255,7 @@ class SimpleMediaLogger extends SimpleLogger
|
|
238 |
* @param int $attachment_id
|
239 |
*/
|
240 |
function on_edit_attachment($attachment_id) {
|
241 |
-
|
242 |
$attachment_post = get_post( $attachment_id );
|
243 |
$filename = esc_html( wp_basename( $attachment_post->guid ) );
|
244 |
$mime = get_post_mime_type( $attachment_post );
|
@@ -257,11 +274,11 @@ class SimpleMediaLogger extends SimpleLogger
|
|
257 |
|
258 |
}
|
259 |
|
260 |
-
/**
|
261 |
* Called when an attachment is deleted
|
262 |
*/
|
263 |
function on_delete_attachment($attachment_id) {
|
264 |
-
|
265 |
$attachment_post = get_post( $attachment_id );
|
266 |
$filename = esc_html( wp_basename( $attachment_post->guid ) );
|
267 |
$mime = get_post_mime_type( $attachment_post );
|
10 |
|
11 |
/**
|
12 |
* Get array with information about this logger
|
13 |
+
*
|
14 |
* @return array
|
15 |
*/
|
16 |
function getInfo() {
|
17 |
|
18 |
+
$arr_info = array(
|
19 |
"name" => "Media/Attachments Logger",
|
20 |
"description" => "Logs media uploads and edits",
|
21 |
"capability" => "edit_pages",
|
30 |
"options" => array(
|
31 |
_x("Added media", "Media logger: search", "simple-history") => array(
|
32 |
"attachment_created"
|
33 |
+
),
|
34 |
_x("Updated media", "Media logger: search", "simple-history") => array(
|
35 |
"attachment_updated"
|
36 |
+
),
|
37 |
_x("Deleted media", "Media logger: search", "simple-history") => array(
|
38 |
"attachment_deleted"
|
39 |
+
),
|
40 |
)
|
41 |
) // end search array
|
42 |
) // end labels
|
43 |
);
|
44 |
+
|
45 |
return $arr_info;
|
46 |
|
47 |
}
|
48 |
|
49 |
public function loaded() {
|
50 |
+
|
51 |
add_action("admin_init", array($this, "on_admin_init"));
|
52 |
|
53 |
}
|
64 |
* Modify plain output to inlcude link to post
|
65 |
*/
|
66 |
public function getLogRowPlainTextOutput($row) {
|
67 |
+
|
68 |
$message = $row->message;
|
69 |
$context = $row->context;
|
70 |
$message_key = $context["_message_key"];
|
72 |
$attachment_id = $context["attachment_id"];
|
73 |
$attachment_post = get_post( $attachment_id );
|
74 |
$attachment_is_available = is_a($attachment_post, "WP_Post");
|
75 |
+
|
76 |
// Only link to attachment if it is still available
|
77 |
if ( $attachment_is_available ) {
|
78 |
|
83 |
} else if ( "attachment_created" == $message_key ) {
|
84 |
|
85 |
$message = __('Uploaded {post_type} <a href="{edit_link}">"{attachment_title}"</a>', "simple-history");
|
86 |
+
|
87 |
}
|
88 |
|
89 |
+
$context["post_type"] = esc_html( $context["post_type"] );
|
90 |
+
$context["attachment_filename"] = esc_html( $context["attachment_filename"] );
|
91 |
+
$context["edit_link"] = get_edit_post_link( $attachment_id );
|
92 |
|
93 |
+
$message = $this->interpolate($message, $context);
|
|
|
|
|
94 |
|
95 |
+
} else {
|
96 |
+
|
97 |
+
// Attachment post is not available, attachment has probably been deleted
|
98 |
+
$message = parent::getLogRowPlainTextOutput( $row );
|
99 |
+
|
100 |
+
}
|
101 |
+
|
102 |
+
return $message;
|
103 |
|
104 |
}
|
105 |
|
112 |
$message_key = $context["_message_key"];
|
113 |
$output = "";
|
114 |
|
115 |
+
$attachment_id = $context["attachment_id"];
|
116 |
+
$attachment_post = get_post( $attachment_id );
|
117 |
+
$attachment_is_available = is_a($attachment_post, "WP_Post");
|
118 |
+
|
119 |
if ( "attachment_updated" == $message_key ) {
|
120 |
+
|
121 |
// Attachment is changed = don't show thumbs and all
|
122 |
|
123 |
} else if ( "attachment_deleted" == $message_key ) {
|
124 |
+
|
125 |
// Attachment is deleted = don't show thumbs and all
|
126 |
|
127 |
} else if ( "attachment_created" == $message_key ) {
|
159 |
$context["full_image_width"] = $full_image_width;
|
160 |
$context["full_image_height"] = $full_image_height;
|
161 |
$context["attachment_thumb"] = sprintf('<div class="SimpleHistoryLogitemThumbnail"><img src="%1$s"></div>', $thumb_src[0] );
|
162 |
+
|
163 |
}
|
164 |
|
165 |
} else if ($is_audio) {
|
175 |
} else {
|
176 |
|
177 |
// use wordpress icon for other media types
|
178 |
+
if ( $attachment_is_available ) {
|
179 |
+
$context["attachment_thumb"] = wp_get_attachment_image( $attachment_id, null, true );
|
180 |
+
}
|
181 |
+
/*else {
|
182 |
+
// Add icon for deleted media?
|
183 |
+
$context["attachment_thumb"] = "thumb";
|
184 |
+
}*/
|
185 |
|
186 |
}
|
187 |
+
|
188 |
$context["attachment_size_format"] = size_format( $row->context["attachment_filesize"] );
|
189 |
$context["attachment_filetype_extension"] = strtoupper( $filetype["ext"] );
|
190 |
|
191 |
if ( ! empty( $context["attachment_thumb"] ) ) {
|
192 |
+
|
193 |
+
if ( $is_image ) {
|
194 |
$message .= "<a href='".$edit_link."'>";
|
195 |
}
|
196 |
+
|
197 |
$message .= __('{attachment_thumb}', 'simple-history');
|
198 |
+
|
199 |
+
if ( $is_image ) {
|
200 |
$message .= "</a>";
|
201 |
}
|
202 |
|
233 |
if ( file_exists( $file ) ) {
|
234 |
$file_size = filesize( $file );
|
235 |
}
|
236 |
+
|
237 |
$this->infoMessage(
|
238 |
'attachment_created',
|
239 |
array(
|
247 |
);
|
248 |
|
249 |
}
|
250 |
+
|
251 |
/**
|
252 |
* An attachmet is changed
|
253 |
* is this only being called if the title of the attachment is changed?!
|
255 |
* @param int $attachment_id
|
256 |
*/
|
257 |
function on_edit_attachment($attachment_id) {
|
258 |
+
|
259 |
$attachment_post = get_post( $attachment_id );
|
260 |
$filename = esc_html( wp_basename( $attachment_post->guid ) );
|
261 |
$mime = get_post_mime_type( $attachment_post );
|
274 |
|
275 |
}
|
276 |
|
277 |
+
/**
|
278 |
* Called when an attachment is deleted
|
279 |
*/
|
280 |
function on_delete_attachment($attachment_id) {
|
281 |
+
|
282 |
$attachment_post = get_post( $attachment_id );
|
283 |
$filename = esc_html( wp_basename( $attachment_post->guid ) );
|
284 |
$mime = get_post_mime_type( $attachment_post );
|
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, syslog, feed, activity, stream
|
5 |
Requires at least: 3.6.0
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 2.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 |
|
@@ -108,6 +108,11 @@ initiated by a specific user.
|
|
108 |
|
109 |
== Changelog ==
|
110 |
|
|
|
|
|
|
|
|
|
|
|
111 |
= 2.0.11 (January 2015) =
|
112 |
|
113 |
- Fixed: Comments where not logged correctly.
|
4 |
Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin, syslog, feed, activity, stream
|
5 |
Requires at least: 3.6.0
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 2.0.12
|
8 |
|
9 |
View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
|
10 |
|
108 |
|
109 |
== Changelog ==
|
110 |
|
111 |
+
= 2.0.12 (January 2015) =
|
112 |
+
|
113 |
+
- Fixed: Deleted attachments did not get translations.
|
114 |
+
- Fixed: A notice when showing details for a deleted attachment.
|
115 |
+
|
116 |
= 2.0.11 (January 2015) =
|
117 |
|
118 |
- Fixed: Comments where not logged correctly.
|