Simple History - Version 0.3.4

Version Description

  • RSS-feed is now valid, and should work at more places (could be broken because of html entities and stuff)
Download this release

Release Info

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

Code changes from version 0.3.3 to 0.3.4

Files changed (3) hide show
  1. index.php +47 -35
  2. readme.txt +3 -0
  3. screenshot-2.png +0 -0
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log of the changes made by users in WordPress.
6
- Version: 0.3.3
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.3.3");
29
  define( "SIMPLE_HISTORY_NAME", "Simple History");
30
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
31
 
@@ -142,52 +142,63 @@ function simple_history_init() {
142
 
143
  $rss_secret_option = get_option("simple_history_rss_secret");
144
  $rss_secret_get = $_GET["rss_secret"];
 
 
 
 
145
  if ($rss_secret_option == $rss_secret_get) {
146
- echo '<?xml version="1.0"?>';
147
- ?>
148
- <rss version="2.0">
149
- <channel>
150
- <title>Simple History for <?php echo get_bloginfo("name") ?></title>
151
- <link><?php get_bloginfo("link") ?></link>
152
- <?php
153
- $arr_items = simple_history_get_items_array("items=10");
154
- foreach ($arr_items as $one_item) {
155
- $object_type = ucwords($one_item->object_type);
156
- $object_name = esc_html($one_item->object_name);
157
- $user = get_user_by("id", $one_item->user_id);
158
- $user_nicename = esc_html($user->user_nicename);
159
- $description = "";
160
- if ($user_nicename) {
161
- $description .= "By $user_nicename<br />";
162
- }
163
- if ($one_item->occasions) {
164
- $description .= sizeof($one_item->occasions) . " occasions<br />";
165
- }
166
-
167
- ?>
168
- <item>
169
- <title><?php echo "$object_type \"{$object_name}\" {$one_item->action}" ?></title>
170
- <description><![CDATA[<?php echo $description ?>]]></description>
171
- <pubDate><?php echo date("D, d M Y H:i:s", $one_item->date_unix) ?> GMT</pubDate>
172
- </item>
173
- <?php
174
- }
175
  ?>
176
- </channel>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  </rss>
178
  <?php
179
  } else {
180
  // not ok rss secret
181
- echo '<?xml version="1.0"?>';
182
  ?>
183
- <rss version="2.0">
184
  <channel>
185
  <title>Simple History for <?php echo get_bloginfo("name") ?></title>
186
- <link><?php get_bloginfo("link") ?></link>
 
 
187
  <item>
188
  <title>Wrong RSS secret</title>
189
  <description>Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed.</description>
190
  <pubDate><?php echo date("D, d M Y H:i:s", time()) ?> GMT</pubDate>
 
191
  </item>
192
  </channel>
193
  </rss>
@@ -269,6 +280,7 @@ function simple_history_settings_field() {
269
  function simple_history_get_rss_address() {
270
  $rss_secret = get_option("simple_history_rss_secret");
271
  $rss_address = add_query_arg(array("simple_history_get_rss" => "1", "rss_secret" => $rss_secret), get_bloginfo("url") . "/");
 
272
  return $rss_address;
273
  }
274
 
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.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.3.4");
29
  define( "SIMPLE_HISTORY_NAME", "Simple History");
30
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
31
 
142
 
143
  $rss_secret_option = get_option("simple_history_rss_secret");
144
  $rss_secret_get = $_GET["rss_secret"];
145
+
146
+ echo '<?xml version="1.0"?>';
147
+ $self_link = simple_history_get_rss_address();
148
+
149
  if ($rss_secret_option == $rss_secret_get) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  ?>
151
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
152
+ <channel>
153
+ <title>Simple History for <?php echo get_bloginfo("name") ?></title>
154
+ <description>WordPress History for <?php echo get_bloginfo("name") ?></description>
155
+ <link><?php echo get_bloginfo("siteurl") ?></link>
156
+ <atom:link href="<?php echo $self_link; ?>" rel="self" type="application/rss+xml" />
157
+ <?php
158
+ $arr_items = simple_history_get_items_array("items=10");
159
+ foreach ($arr_items as $one_item) {
160
+ $object_type = ucwords($one_item->object_type);
161
+ $object_name = esc_html($one_item->object_name);
162
+ $user = get_user_by("id", $one_item->user_id);
163
+ $user_nicename = esc_html($user->user_nicename);
164
+ $description = "";
165
+ if ($user_nicename) {
166
+ $description .= "By $user_nicename<br />";
167
+ }
168
+ if ($one_item->occasions) {
169
+ $description .= sizeof($one_item->occasions) . " occasions<br />";
170
+ }
171
+
172
+ $item_title = "$object_type \"{$object_name}\" {$one_item->action}";
173
+ $item_title = html_entity_decode($item_title, ENT_COMPAT, "UTF-8");
174
+ $item_guid = get_bloginfo("siteurl") . "?simple-history-guid=" . $one_item->id;
175
+ ?>
176
+ <item>
177
+ <title><![CDATA[<?php echo $item_title; ?>]]></title>
178
+ <description><![CDATA[<?php echo $description ?>]]></description>
179
+ <pubDate><?php echo date("D, d M Y H:i:s", $one_item->date_unix) ?> GMT</pubDate>
180
+ <guid isPermaLink="false"><?php echo $item_guid ?></guid>
181
+ </item>
182
+ <?php
183
+ }
184
+ ?>
185
+ </channel>
186
  </rss>
187
  <?php
188
  } else {
189
  // not ok rss secret
 
190
  ?>
191
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
192
  <channel>
193
  <title>Simple History for <?php echo get_bloginfo("name") ?></title>
194
+ <description>WordPress History for <?php echo get_bloginfo("name") ?></description>
195
+ <link><?php echo get_bloginfo("siteurl") ?></link>
196
+ <atom:link href="<?php echo $self_link; ?>" rel="self" type="application/rss+xml" />
197
  <item>
198
  <title>Wrong RSS secret</title>
199
  <description>Your RSS secret for Simple History RSS feed is wrong. Please see WordPress settings for current link to the RSS feed.</description>
200
  <pubDate><?php echo date("D, d M Y H:i:s", time()) ?> GMT</pubDate>
201
+ <guid><?php echo get_bloginfo("siteurl") . "?simple-history-guid=wrong-secret" ?></guid>
202
  </item>
203
  </channel>
204
  </rss>
280
  function simple_history_get_rss_address() {
281
  $rss_secret = get_option("simple_history_rss_secret");
282
  $rss_address = add_query_arg(array("simple_history_get_rss" => "1", "rss_secret" => $rss_secret), get_bloginfo("url") . "/");
283
+ $rss_address = htmlspecialchars($rss_address, ENT_COMPAT, "UTF-8");
284
  return $rss_address;
285
  }
286
 
readme.txt CHANGED
@@ -64,6 +64,9 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
64
 
65
  == Changelog ==
66
 
 
 
 
67
  = 0.3.3 =
68
  - Moved JavaScript to own file
69
  - 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)
64
 
65
  == Changelog ==
66
 
67
+ = 0.3.4 =
68
+ - RSS-feed is now valid, and should work at more places (could be broken because of html entities and stuff)
69
+
70
  = 0.3.3 =
71
  - Moved JavaScript to own file
72
  - 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)
screenshot-2.png CHANGED
Binary file