Version Description
- Added: option to set number of items to show, per page. Default i 5 history log items.
Download this release
Release Info
Developer | eskapism |
Plugin | Simple History |
Version | 1.0.6 |
Comparing to | |
See all releases |
Code changes from version 1.0.5 to 1.0.6
- index.php +52 -17
- readme.txt +4 -1
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Simple History
|
4 |
Plugin URI: http://eskapism.se/code-playground/simple-history/
|
5 |
Description: Get a log/history/audit log/version history of the changes made by users in WordPress.
|
6 |
-
Version: 1.0.
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
@@ -27,7 +27,7 @@ License: GPL2
|
|
27 |
|
28 |
load_plugin_textdomain('simple-history', false, "/simple-history/languages");
|
29 |
|
30 |
-
define( "SIMPLE_HISTORY_VERSION", "1.0.
|
31 |
define( "SIMPLE_HISTORY_NAME", "Simple History");
|
32 |
define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
33 |
|
@@ -38,9 +38,8 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
|
38 |
|
39 |
var
|
40 |
$plugin_foldername_and_filename,
|
41 |
-
$view_history_capability
|
42 |
-
|
43 |
-
static $pager_size = 5;
|
44 |
|
45 |
function __construct() {
|
46 |
|
@@ -58,6 +57,11 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
|
58 |
$this->add_types_for_translation();
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
61 |
/**
|
62 |
* Some post types etc are added as variables from the log, so to catch these for translation I just add them as dummy stuff here.
|
63 |
* There is probably a better way to do this, but this should work anyway
|
@@ -251,13 +255,15 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
|
251 |
|
252 |
add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug");
|
253 |
|
254 |
-
add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"), "simple_history_settings_field",
|
255 |
-
add_settings_field("
|
256 |
-
add_settings_field("
|
257 |
-
add_settings_field("
|
|
|
258 |
|
259 |
register_setting("simple_history_settings_group", "simple_history_show_on_dashboard");
|
260 |
register_setting("simple_history_settings_group", "simple_history_show_as_page");
|
|
|
261 |
|
262 |
}
|
263 |
|
@@ -359,6 +365,8 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
|
359 |
|
360 |
function ajax() {
|
361 |
|
|
|
|
|
362 |
$type = isset($_POST["type"]) ? $_POST["type"] : "";
|
363 |
$subtype = isset($_POST["subtype"]) ? $_POST["subtype"] : "";
|
364 |
|
@@ -372,10 +380,10 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
|
372 |
}
|
373 |
|
374 |
// number of items to get
|
375 |
-
$items = (int) (isset($_POST["items"])) ? $_POST["items"] :
|
376 |
|
377 |
// number of prev added items = number of items to skip before starting to add $items num of new items
|
378 |
-
$num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] :
|
379 |
|
380 |
$search = (isset($_POST["search"])) ? $_POST["search"] : "";
|
381 |
|
@@ -413,7 +421,7 @@ define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
|
413 |
$all_items = simple_history_get_items_array($args);
|
414 |
$arr_json["filtered_items_total_count"] = sizeof($all_items);
|
415 |
$arr_json["filtered_items_total_count_string"] = sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items));
|
416 |
-
$arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / simple_history
|
417 |
}
|
418 |
|
419 |
header("Content-type: application/json");
|
@@ -447,6 +455,28 @@ function simple_history_setting_show_as_page() {
|
|
447 |
|
448 |
}
|
449 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
function simple_history_settings_field() {
|
451 |
$show_on_dashboard = simple_history_setting_show_on_dashboard();
|
452 |
$show_as_page = simple_history_setting_show_as_page();
|
@@ -874,6 +904,8 @@ function simple_history_dashboard() {
|
|
874 |
// own page under dashboard
|
875 |
function simple_history_management_page() {
|
876 |
|
|
|
|
|
877 |
simple_history_purge_db();
|
878 |
|
879 |
?>
|
@@ -882,7 +914,7 @@ function simple_history_management_page() {
|
|
882 |
<h2><?php echo __("History", 'simple-history') ?></h2>
|
883 |
<?php
|
884 |
simple_history_print_nav(array("from_page=1"));
|
885 |
-
echo simple_history_print_history(array("items" =>
|
886 |
echo simple_history_get_pagination();
|
887 |
?>
|
888 |
</div>
|
@@ -1094,9 +1126,10 @@ function simple_history_print_nav() {
|
|
1094 |
function simple_history_get_pagination() {
|
1095 |
|
1096 |
// pagination
|
|
|
1097 |
$all_items = simple_history_get_items_array("items=all");
|
1098 |
$items_count = sizeof($all_items);
|
1099 |
-
$pages_count = ceil($items_count
|
1100 |
$page_current = 1;
|
1101 |
|
1102 |
$out = sprintf('
|
@@ -1133,11 +1166,11 @@ function simple_history_get_pagination() {
|
|
1133 |
// return an array with all events and occasions
|
1134 |
function simple_history_get_items_array($args = "") {
|
1135 |
|
1136 |
-
global $wpdb;
|
1137 |
|
1138 |
$defaults = array(
|
1139 |
"page" => 0,
|
1140 |
-
"items" =>
|
1141 |
"filter_type" => "",
|
1142 |
"filter_user" => "",
|
1143 |
"is_ajax" => false,
|
@@ -1299,11 +1332,13 @@ function simple_history_get_items_array($args = "") {
|
|
1299 |
// taking filtrering into consideration
|
1300 |
function simple_history_print_history($args = null) {
|
1301 |
|
|
|
|
|
1302 |
$arr_events = simple_history_get_items_array($args);
|
1303 |
#sf_d($args);sf_d($arr_events);
|
1304 |
$defaults = array(
|
1305 |
"page" => 0,
|
1306 |
-
"items" =>
|
1307 |
"filter_type" => "",
|
1308 |
"filter_user" => "",
|
1309 |
"is_ajax" => false
|
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: 1.0.6
|
7 |
Author: Pär Thernström
|
8 |
Author URI: http://eskapism.se/
|
9 |
License: GPL2
|
27 |
|
28 |
load_plugin_textdomain('simple-history', false, "/simple-history/languages");
|
29 |
|
30 |
+
define( "SIMPLE_HISTORY_VERSION", "1.0.6");
|
31 |
define( "SIMPLE_HISTORY_NAME", "Simple History");
|
32 |
define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
|
33 |
|
38 |
|
39 |
var
|
40 |
$plugin_foldername_and_filename,
|
41 |
+
$view_history_capability
|
42 |
+
;
|
|
|
43 |
|
44 |
function __construct() {
|
45 |
|
57 |
$this->add_types_for_translation();
|
58 |
}
|
59 |
|
60 |
+
function get_pager_size() {
|
61 |
+
$pager_size = get_option("simple_history_pager_size", 5);
|
62 |
+
return $pager_size;
|
63 |
+
}
|
64 |
+
|
65 |
/**
|
66 |
* Some post types etc are added as variables from the log, so to catch these for translation I just add them as dummy stuff here.
|
67 |
* There is probably a better way to do this, but this should work anyway
|
255 |
|
256 |
add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug");
|
257 |
|
258 |
+
add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"), "simple_history_settings_field", "simple_history_settings_menu_slug", "simple_history_settings_section");
|
259 |
+
add_settings_field("simple_history_settings_field_5", __("Number of items per page", "simple-history"), "simple_history_settings_field_number_of_items", "simple_history_settings_menu_slug", "simple_history_settings_section");
|
260 |
+
add_settings_field("simple_history_settings_field_2", __("RSS feed", "simple-history"), "simple_history_settings_field_rss", "simple_history_settings_menu_slug", "simple_history_settings_section");
|
261 |
+
add_settings_field("simple_history_settings_field_4", __("Clear log", "simple-history"), "simple_history_settings_field_clear_log", "simple_history_settings_menu_slug", "simple_history_settings_section");
|
262 |
+
add_settings_field("simple_history_settings_field_3", __("Donate", "simple-history"), "simple_history_settings_field_donate", "simple_history_settings_menu_slug", "simple_history_settings_section");
|
263 |
|
264 |
register_setting("simple_history_settings_group", "simple_history_show_on_dashboard");
|
265 |
register_setting("simple_history_settings_group", "simple_history_show_as_page");
|
266 |
+
register_setting("simple_history_settings_group", "simple_history_pager_size");
|
267 |
|
268 |
}
|
269 |
|
365 |
|
366 |
function ajax() {
|
367 |
|
368 |
+
global $simple_history;
|
369 |
+
|
370 |
$type = isset($_POST["type"]) ? $_POST["type"] : "";
|
371 |
$subtype = isset($_POST["subtype"]) ? $_POST["subtype"] : "";
|
372 |
|
380 |
}
|
381 |
|
382 |
// number of items to get
|
383 |
+
$items = (int) (isset($_POST["items"])) ? $_POST["items"] : $simple_history->get_pager_size();
|
384 |
|
385 |
// number of prev added items = number of items to skip before starting to add $items num of new items
|
386 |
+
$num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] : $simple_history->get_pager_size();
|
387 |
|
388 |
$search = (isset($_POST["search"])) ? $_POST["search"] : "";
|
389 |
|
421 |
$all_items = simple_history_get_items_array($args);
|
422 |
$arr_json["filtered_items_total_count"] = sizeof($all_items);
|
423 |
$arr_json["filtered_items_total_count_string"] = sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items));
|
424 |
+
$arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / $simple_history->get_pager_size());
|
425 |
}
|
426 |
|
427 |
header("Content-type: application/json");
|
455 |
|
456 |
}
|
457 |
|
458 |
+
function simple_history_settings_field_number_of_items() {
|
459 |
+
|
460 |
+
global $simple_history;
|
461 |
+
$current_pager_size = $simple_history->get_pager_size();
|
462 |
+
|
463 |
+
?>
|
464 |
+
<select name="simple_history_pager_size">
|
465 |
+
<option <?php echo $current_pager_size == 5 ? "selected" : "" ?> value="5">5</option>
|
466 |
+
<option <?php echo $current_pager_size == 10 ? "selected" : "" ?> value="10">10</option>
|
467 |
+
<option <?php echo $current_pager_size == 15 ? "selected" : "" ?> value="15">15</option>
|
468 |
+
<option <?php echo $current_pager_size == 20 ? "selected" : "" ?> value="20">20</option>
|
469 |
+
<option <?php echo $current_pager_size == 25 ? "selected" : "" ?> value="25">25</option>
|
470 |
+
<option <?php echo $current_pager_size == 30 ? "selected" : "" ?> value="30">30</option>
|
471 |
+
<option <?php echo $current_pager_size == 40 ? "selected" : "" ?> value="40">40</option>
|
472 |
+
<option <?php echo $current_pager_size == 50 ? "selected" : "" ?> value="50">50</option>
|
473 |
+
<option <?php echo $current_pager_size == 75 ? "selected" : "" ?> value="75">75</option>
|
474 |
+
<option <?php echo $current_pager_size == 100 ? "selected" : "" ?> value="100">100</option>
|
475 |
+
</select>
|
476 |
+
<?
|
477 |
+
|
478 |
+
}
|
479 |
+
|
480 |
function simple_history_settings_field() {
|
481 |
$show_on_dashboard = simple_history_setting_show_on_dashboard();
|
482 |
$show_as_page = simple_history_setting_show_as_page();
|
904 |
// own page under dashboard
|
905 |
function simple_history_management_page() {
|
906 |
|
907 |
+
global $simple_history;
|
908 |
+
|
909 |
simple_history_purge_db();
|
910 |
|
911 |
?>
|
914 |
<h2><?php echo __("History", 'simple-history') ?></h2>
|
915 |
<?php
|
916 |
simple_history_print_nav(array("from_page=1"));
|
917 |
+
echo simple_history_print_history(array("items" => $simple_history->get_pager_size(), "from_page" => "1"));
|
918 |
echo simple_history_get_pagination();
|
919 |
?>
|
920 |
</div>
|
1126 |
function simple_history_get_pagination() {
|
1127 |
|
1128 |
// pagination
|
1129 |
+
global $simple_history;
|
1130 |
$all_items = simple_history_get_items_array("items=all");
|
1131 |
$items_count = sizeof($all_items);
|
1132 |
+
$pages_count = ceil($items_count/$simple_history->get_pager_size());
|
1133 |
$page_current = 1;
|
1134 |
|
1135 |
$out = sprintf('
|
1166 |
// return an array with all events and occasions
|
1167 |
function simple_history_get_items_array($args = "") {
|
1168 |
|
1169 |
+
global $wpdb, $simple_history;
|
1170 |
|
1171 |
$defaults = array(
|
1172 |
"page" => 0,
|
1173 |
+
"items" => $simple_history->get_pager_size(),
|
1174 |
"filter_type" => "",
|
1175 |
"filter_user" => "",
|
1176 |
"is_ajax" => false,
|
1332 |
// taking filtrering into consideration
|
1333 |
function simple_history_print_history($args = null) {
|
1334 |
|
1335 |
+
global $simple_history;
|
1336 |
+
|
1337 |
$arr_events = simple_history_get_items_array($args);
|
1338 |
#sf_d($args);sf_d($arr_events);
|
1339 |
$defaults = array(
|
1340 |
"page" => 0,
|
1341 |
+
"items" => $simple_history->get_pager_size(),
|
1342 |
"filter_type" => "",
|
1343 |
"filter_user" => "",
|
1344 |
"is_ajax" => false
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
|
|
4 |
Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.4.2
|
7 |
-
Stable tag: 1.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 |
|
@@ -92,6 +92,9 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
|
|
92 |
|
93 |
== Changelog ==
|
94 |
|
|
|
|
|
|
|
95 |
= 1.0.5 =
|
96 |
- Fixed: some translation issues, including updated POT-file for translators.
|
97 |
|
4 |
Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.4.2
|
7 |
+
Stable tag: 1.0.6
|
8 |
|
9 |
View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
|
10 |
|
92 |
|
93 |
== Changelog ==
|
94 |
|
95 |
+
= 1.0.6 =
|
96 |
+
- Added: option to set number of items to show, per page. Default i 5 history log items.
|
97 |
+
|
98 |
= 1.0.5 =
|
99 |
- Fixed: some translation issues, including updated POT-file for translators.
|
100 |
|