Simple History - Version 2.0.17

Version Description

(January 2015) =

  • Added: messages added using for example SimpleLogger()->info( __("My log message") ) that have translations now auto translated the message back to english before storing the message (together with the text domain). Then upon retrieval it uses the english message + the text domain to translate the message to the currently selected language. This makes it easier to make multilingual log entries. (Yeah, I know its hard to understand what the heck this does, but it's something good and cool, trust me!)
  • Added: A sidebar with text contents on the history page.
  • Changed: Search now shows only the search box by default, with a link to show all search options.
  • Fixed: Search is now available at the dashboard again. Hooray!
  • Fixed: Old entries were not cleared automatically. Now it correctly removes old events, so your database will not risk growing to large.
  • Fixed: Quick stats could show two messages sometimes.
  • Fixed: When headers like HTTP_X_FORWARDED_FOR exists all valid IPs in that header is now stored.
  • Fixed: Plugin updates via third party software like InfiniteWP should now correctly show the version number of the previos version.
  • Updated: German translation updated.
  • Notice: Do you read these messages? Then you must love this plugin! Come on then, go and give it a nice review.
Download this release

Release Info

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

Code changes from version 2.0.16 to 2.0.17

SimpleHistory.php CHANGED
@@ -6,7 +6,7 @@
6
  class SimpleHistory {
7
 
8
  const NAME = "Simple History";
9
- const VERSION = "2.0.16";
10
 
11
  /**
12
  * Capability required to view the history log
@@ -41,6 +41,13 @@ class SimpleHistory {
41
  */
42
  private $doFilterGettext_currentLogger = null;
43
 
 
 
 
 
 
 
 
44
  /**
45
  * All registered settings tabs
46
  */
@@ -58,60 +65,126 @@ class SimpleHistory {
58
  function __construct() {
59
 
60
  /**
61
- * Fires before Simple History does it's init stuff
62
- *
63
- * @since 2.0
64
- *
65
- * @param SimpleHistory $SimpleHistory This class.
66
- */
67
- do_action( "simple_history/before_init", $this );
68
 
69
  $this->setupVariables();
70
 
71
  // Actions and filters, ordered by order specified in codex: http://codex.wordpress.org/Plugin_API/Action_Reference
72
- add_action( 'plugins_loaded', array($this, 'load_plugin_textdomain') );
73
- add_action( 'plugins_loaded', array($this, 'add_default_settings_tabs') );
74
- add_action( 'plugins_loaded', array($this, 'loadLoggers') );
75
- add_action( 'plugins_loaded', array($this, 'loadDropins') );
76
 
77
  // Run before loading of loggers and before menu items are added
78
- add_action( 'plugins_loaded', array($this, 'check_for_upgrade'), 5 );
79
 
80
- add_action( 'admin_menu', array($this, 'add_admin_pages') );
81
- add_action( 'admin_menu', array($this, 'add_settings') );
82
 
83
- add_action( 'admin_footer', array( $this, "add_js_templates" ) );
 
84
 
85
- add_action( 'wp_dashboard_setup', array($this, 'add_dashboard_widget') );
86
 
87
- add_action( 'admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
88
 
89
- add_action( 'admin_head', array( $this, "onAdminHead" ) );
90
- add_action( 'admin_footer', array( $this, "onAdminFooter" ) );
 
 
91
 
92
  // Filters and actions not called during regular boot
93
  add_filter("gettext", array($this, 'filter_gettext'), 20, 3);
94
  add_filter("gettext_with_context", array($this, 'filter_gettext_with_context'), 20, 4);
95
 
96
- add_action( 'simple_history/history_page/before_gui', array( $this, "output_quick_stats" ) );
97
- add_action( 'simple_history/dashboard/before_gui', array( $this, "output_quick_stats" ) );
98
 
99
- add_action( 'wp_ajax_simple_history_ajax', array($this, 'ajax') );
100
- add_action( 'wp_ajax_simple_history_api', array($this, 'api') );
101
 
102
- add_filter( 'plugin_action_links_simple-history/index.php', array($this, 'plugin_action_links'), 10, 4);
103
 
104
  /**
105
- * Fires after Simple History has done it's init stuff
106
- *
107
- * @since 2.0
108
- *
109
- * @param SimpleHistory $SimpleHistory This class.
110
- */
111
- do_action( "simple_history/after_init", $this );
112
 
113
- #add_action("init", array($this, "testlog_old"));
 
 
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  }
117
 
@@ -119,9 +192,9 @@ class SimpleHistory {
119
 
120
  # Log that an email has been sent
121
  simple_history_add(array(
122
- "object_type" => "Email",
123
- "object_name" => "Hi there",
124
- "action" => "was sent"
125
  ));
126
 
127
  # Will show “Plugin your_plugin_name Edited” in the history log
@@ -132,20 +205,19 @@ class SimpleHistory {
132
 
133
  # Log with some extra details about the email
134
  simple_history_add(array(
135
- "object_type" => "Email",
136
- "object_name" => "Hi there",
137
- "action" => "was sent",
138
- "description" => "The database query to generate the email took .3 seconds. This is email number 4 that is sent to this user"
139
  ));
140
 
141
-
142
  }
143
 
144
  public function onAdminHead() {
145
 
146
- if ( $this->is_on_our_own_pages() ) {
147
 
148
- do_action( "simple_history/admin_head", $this );
149
 
150
  }
151
 
@@ -153,9 +225,9 @@ class SimpleHistory {
153
 
154
  public function onAdminFooter() {
155
 
156
- if ( $this->is_on_our_own_pages() ) {
157
 
158
- do_action( "simple_history/admin_footer", $this );
159
 
160
  }
161
 
@@ -166,7 +238,7 @@ class SimpleHistory {
166
  */
167
  public function add_js_templates($hook) {
168
 
169
- if ( $this->is_on_our_own_pages() ) {
170
 
171
  ?>
172
 
@@ -174,7 +246,7 @@ class SimpleHistory {
174
 
175
  <div class="SimpleHistory__waitingForFirstLoad">
176
  <img src="<?php echo admin_url("/images/spinner.gif");?>" alt="" width="20" height="20">
177
- <?php echo _x("Loading history...", "Message visible while waiting for log to load from server the first time", "simple-history") ?>
178
  </div>
179
 
180
  <div class="SimpleHistoryLogitemsWrap">
@@ -211,7 +283,7 @@ class SimpleHistory {
211
  href="#">‹</a>
212
  <span class="SimpleHistoryPaginationInput">
213
  <input class="SimpleHistoryPaginationCurrentPage" title="{{ data.strings.currentPage }}" type="text" name="paged" value="{{ data.api_args.paged }}" size="4">
214
- <?php _x("of", "page n of n", "simple-history") ?>
215
  <span class="total-pages">{{ data.pages_count }}</span>
216
  </span>
217
  <a
@@ -248,8 +320,8 @@ class SimpleHistory {
248
  <?php
249
 
250
  // Call plugins so they can add their js
251
- foreach ( $this->instantiatedLoggers as $one_logger ) {
252
- if( method_exists($one_logger["instance"], "adminJS" ) ) {
253
  $one_logger["instance"]->adminJS();
254
  }
255
  }
@@ -277,23 +349,22 @@ class SimpleHistory {
277
  unset($args["action"]);
278
 
279
  // Type = overview | ...
280
- $type = isset( $_GET["type"] ) ? $_GET["type"] : null;
281
 
282
- if ( empty( $args ) || ! $type ) {
283
 
284
- wp_send_json_error( array(
285
- _x("Not enough args specified", "API: not enought arguments passed", "simple-history")
286
- ) );
287
 
288
  }
289
 
290
  if (isset($args["id"])) {
291
  $args["post__in"] = array(
292
- $args["id"]
293
  );
294
  }
295
 
296
-
297
  $data = array();
298
 
299
  switch ($type) {
@@ -309,7 +380,7 @@ class SimpleHistory {
309
  $data["api_args"] = $args;
310
 
311
  // Output can be array or HMTL
312
- if ( isset( $args["format"] ) && "html" === $args["format"] ) {
313
 
314
  $data["log_rows_raw"] = array();
315
 
@@ -320,7 +391,7 @@ class SimpleHistory {
320
  $args["type"] = "single";
321
  }
322
 
323
- $data["log_rows"][$key] = $this->getLogRowHTMLOutput( $oneLogRow, $args);
324
 
325
  }
326
 
@@ -331,13 +402,12 @@ class SimpleHistory {
331
 
332
  break;
333
 
334
-
335
  default:
336
  $data[] = "Nah.";
337
 
338
  }
339
 
340
- wp_send_json_success( $data );
341
 
342
  }
343
 
@@ -346,9 +416,9 @@ class SimpleHistory {
346
  * to the untranslated text too, because that's the version we want to store
347
  * in the database.
348
  */
349
- public function filter_gettext( $translated_text, $untranslated_text, $domain ) {
350
 
351
- if ( isset( $this->doFilterGettext ) && $this->doFilterGettext ) {
352
 
353
  $this->doFilterGettext_currentLogger->messages[] = array(
354
  "untranslated_text" => $untranslated_text,
@@ -366,9 +436,9 @@ class SimpleHistory {
366
  /**
367
  * Store messages with context
368
  */
369
- public function filter_gettext_with_context( $translated_text, $untranslated_text, $context, $domain ) {
370
 
371
- if ( isset( $this->doFilterGettext ) && $this->doFilterGettext ) {
372
 
373
  $this->doFilterGettext_currentLogger->messages[] = array(
374
  "untranslated_text" => $untranslated_text,
@@ -397,8 +467,8 @@ class SimpleHistory {
397
  // The "plugin_locale" filter is also used in load_plugin_textdomain()
398
  $locale = apply_filters('plugin_locale', get_locale(), $domain);
399
 
400
- load_textdomain($domain, WP_LANG_DIR.'/simple-history/'.$domain.'-'.$locale.'.mo');
401
- load_plugin_textdomain($domain, FALSE, dirname( $this->plugin_basename ).'/languages/');
402
 
403
  }
404
 
@@ -432,28 +502,28 @@ class SimpleHistory {
432
  array(
433
  "slug" => "settings",
434
  "name" => __("Settings", "simple-history"),
435
- "function" => array($this, "settings_output_general")
436
  ),
437
 
438
  );
439
 
440
- if ( defined("SIMPLE_HISTORY_DEV") && SIMPLE_HISTORY_DEV ) {
441
 
442
  $arr_dev_tabs = array(
443
  array(
444
  "slug" => "log",
445
  "name" => __("Log (debug)", "simple-history"),
446
- "function" => array($this, "settings_output_log")
447
  ),
448
  array(
449
  "slug" => "styles-example",
450
  "name" => __("Styles example (debug)", "simple-history"),
451
- "function" => array($this, "settings_output_styles_example")
452
- )
453
 
454
  );
455
 
456
- $this->arr_settings_tabs = array_merge( $this->arr_settings_tabs, $arr_dev_tabs );
457
 
458
  }
459
 
@@ -476,10 +546,10 @@ class SimpleHistory {
476
  */
477
  $loggersDir = apply_filters("simple_history/loggers_dir", $loggersDir);
478
 
479
- $loggersFiles = glob( $loggersDir . "*.php");
480
 
481
  // SimpleLogger.php must be loaded first since the other loggers extend it
482
- require_once($loggersDir . "SimpleLogger.php");
483
 
484
  /**
485
  * Filter the array with absolute paths to files as returned by glob function.
@@ -493,15 +563,15 @@ class SimpleHistory {
493
  $loggersFiles = apply_filters("simple_history/loggers_files", $loggersFiles);
494
 
495
  $arrLoggersToInstantiate = array();
496
- foreach ( $loggersFiles as $oneLoggerFile) {
497
 
498
- if ( basename($oneLoggerFile) == "SimpleLogger.php" ) {
499
 
500
  // SimpleLogger is already loaded
501
 
502
  } else {
503
 
504
- include_once($oneLoggerFile);
505
 
506
  }
507
 
@@ -518,15 +588,15 @@ class SimpleHistory {
518
  */
519
  $arrLoggersToInstantiate = apply_filters("simple_history/loggers_to_instantiate", $arrLoggersToInstantiate);
520
  // Instantiate each logger
521
- foreach ($arrLoggersToInstantiate as $oneLoggerName ) {
522
 
523
- if ( ! class_exists($oneLoggerName) ) {
524
  continue;
525
  }
526
 
527
  $loggerInstance = new $oneLoggerName($this);
528
 
529
- if ( ! is_subclass_of($loggerInstance, "SimpleLogger") && ! is_a($loggerInstance, "SimpleLogger") ) {
530
  continue;
531
  }
532
 
@@ -545,31 +615,31 @@ class SimpleHistory {
545
  // LoggerInfo contains all messages, both translated an not, by key.
546
  // Add messages to the loggerInstance
547
  $loopNum = 0;
548
- foreach ( $loggerInfo["messages"] as $message_key => $message ) {
549
 
550
- $loggerInstance->messages[ $message_key ] = $loggerInstance->messages[ $loopNum ];
551
  $loopNum++;
552
 
553
  }
554
 
555
  // Remove index keys, only keeping slug keys
556
  if (is_array($loggerInstance->messages)) {
557
- foreach ( $loggerInstance->messages as $key => $val ) {
558
- if ( is_int($key) ) {
559
- unset( $loggerInstance->messages[$key] );
560
  }
561
  }
562
  }
563
 
564
  // Add logger to array of loggers
565
- $this->instantiatedLoggers[ $loggerInstance->slug ] = array(
566
  "name" => $loggerInfo["name"],
567
- "instance" => $loggerInstance
568
  );
569
 
570
  }
571
 
572
- do_action( "simple_history/loggers_loaded" );
573
 
574
  #sf_d($this->instantiatedLoggers);exit;
575
 
@@ -592,7 +662,7 @@ class SimpleHistory {
592
  */
593
  $dropinsDir = apply_filters("simple_history/dropins_dir", $dropinsDir);
594
 
595
- $dropinsFiles = glob( $dropinsDir . "*.php");
596
 
597
  /**
598
  * Filter the array with absolute paths to files as returned by glob function.
@@ -607,7 +677,7 @@ class SimpleHistory {
607
 
608
  $arrDropinsToInstantiate = array();
609
 
610
- foreach ( $dropinsFiles as $oneDropinFile ) {
611
 
612
  // path/path/simplehistory/dropins/SimpleHistoryDonateDropin.php => SimpleHistoryDonateDropin
613
  $oneDropinFileBasename = basename($oneDropinFile, ".php");
@@ -621,13 +691,13 @@ class SimpleHistory {
621
  *
622
  * @param bool if to load the dropin. return false to not load it.
623
  */
624
- $load_dropin = apply_filters( "simple_history/dropin/load_dropin_{$oneDropinFileBasename}", true );
625
 
626
- if ( ! $load_dropin ) {
627
  continue;
628
  }
629
 
630
- include_once($oneDropinFile);
631
 
632
  $arrDropinsToInstantiate[] = $oneDropinFileBasename;
633
 
@@ -643,15 +713,15 @@ class SimpleHistory {
643
  $arrDropinsToInstantiate = apply_filters("simple_history/dropins_to_instantiate", $arrDropinsToInstantiate);
644
 
645
  // Instantiate each dropin
646
- foreach ($arrDropinsToInstantiate as $oneDropinName ) {
647
 
648
- if ( ! class_exists( $oneDropinName ) ) {
649
  continue;
650
  }
651
 
652
  $this->instantiatedDropins[$oneDropinName] = array(
653
  "name" => $oneDropinName,
654
- "instance" => new $oneDropinName( $this )
655
  );
656
  }
657
 
@@ -680,14 +750,13 @@ class SimpleHistory {
680
 
681
  }
682
 
683
-
684
  /**
685
  * Show a link to our settings page on the Plugins -> Installed Plugins screen
686
  */
687
  function plugin_action_links($actions, $b, $c, $d) {
688
 
689
  // Only add link if user has the right to view the settings page
690
- if ( ! current_user_can($this->view_settings_capability) ) {
691
  return $actions;
692
  }
693
 
@@ -706,7 +775,7 @@ class SimpleHistory {
706
  */
707
  function add_dashboard_widget() {
708
 
709
- if ( $this->setting_show_on_dashboard() && current_user_can($this->view_history_capability) ) {
710
 
711
  wp_add_dashboard_widget("simple_history_dashboard_widget", __("Simple History", 'simple-history'), array($this, "dashboard_widget_output"));
712
 
@@ -729,11 +798,11 @@ class SimpleHistory {
729
  */
730
  $pager_size = apply_filters("simple_history/dashboard_pager_size", $pager_size);
731
 
732
- do_action( "simple_history/dashboard/before_gui", $this );
733
 
734
  ?>
735
  <div class="SimpleHistoryGui"
736
- data-pager-size='<?php echo $pager_size ?>'
737
  ></div>
738
  <?php
739
 
@@ -743,19 +812,19 @@ class SimpleHistory {
743
 
744
  $current_screen = get_current_screen();
745
 
746
- if ( $current_screen && $current_screen->base == "settings_page_" . SimpleHistory::SETTINGS_MENU_SLUG ) {
747
 
748
  return true;
749
 
750
- } else if ( $current_screen && $current_screen->base == "dashboard_page_simple_history_page" ) {
751
 
752
  return true;
753
 
754
- } else if ( ($hook == "settings_page_" . SimpleHistory::SETTINGS_MENU_SLUG) || ($this->setting_show_on_dashboard() && $hook == "index.php") || ($this->setting_show_as_page() && $hook == "dashboard_page_simple_history_page")) {
755
 
756
  return true;
757
 
758
- } else if ( $current_screen && $current_screen->base == "dashboard" && $this->setting_show_on_dashboard() ) {
759
 
760
  return true;
761
 
@@ -771,12 +840,12 @@ class SimpleHistory {
771
  */
772
  function enqueue_admin_scripts($hook) {
773
 
774
- if ( $this->is_on_our_own_pages() ) {
775
 
776
  add_thickbox();
777
 
778
  $plugin_url = plugin_dir_url(__FILE__);
779
- wp_enqueue_style( "simple_history_styles", $plugin_url . "css/styles.css", false, SimpleHistory::VERSION );
780
  wp_enqueue_script("simple_history_script", $plugin_url . "js/scripts.js", array("jquery", "backbone", "wp-util"), SimpleHistory::VERSION, true);
781
 
782
  wp_enqueue_script("select2", $plugin_url . "/js/select2/select2.min.js", array("jquery"));
@@ -793,24 +862,24 @@ class SimpleHistory {
793
  'currentPage' => __("Current page", 'simple-history'),
794
  ),
795
  "loadLogAPIError" => __("Oups, the log could not be loaded right now.", 'simple-history'),
796
- "logNoHits" => __("Your search did not match any history events.", "simple-history")
797
  ));
798
 
799
  // Call plugins adminCSS-method, so they can add their CSS
800
- foreach ( $this->instantiatedLoggers as $one_logger ) {
801
- if ( method_exists($one_logger["instance"], "adminCSS" ) ) {
802
  $one_logger["instance"]->adminCSS();
803
  }
804
  }
805
 
806
  /**
807
- * Fires when the admin scripts have been enqueued.
808
- * Only fires on any of the pages where Simple History is used
809
- *
810
- * @since 2.0
811
- *
812
- * @param SimpleHistory $SimpleHistory This class.
813
- */
814
  do_action("simple_history/enqueue_admin_scripts", $this);
815
 
816
  }
@@ -838,26 +907,26 @@ class SimpleHistory {
838
  // is a version of Simple History < 0.4
839
  // or it's a first install
840
  // Fix database not using UTF-8
841
- if ( false === $db_version ) {
842
 
843
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
844
 
845
  // Table creation, used to be in register_activation_hook
846
  /*
847
  $sql = "CREATE TABLE " . $table_name . " (
848
- id int(10) NOT NULL AUTO_INCREMENT,
849
- date datetime NOT NULL,
850
- action varchar(255) NOT NULL COLLATE utf8_general_ci,
851
- object_type varchar(255) NOT NULL COLLATE utf8_general_ci,
852
- object_subtype VARCHAR(255) NOT NULL COLLATE utf8_general_ci,
853
- user_id int(10) NOT NULL,
854
- object_id int(10) NOT NULL,
855
- object_name varchar(255) NOT NULL COLLATE utf8_general_ci,
856
- action_description longtext,
857
- PRIMARY KEY (id)
858
  ) CHARACTER SET=utf8;";
859
  dbDelta($sql);
860
- */
861
 
862
  // We change the varchar size to add one num just to force update of encoding. dbdelta didn't see it otherwise.
863
  // This table is missing action_description, but we add that later on
@@ -883,28 +952,19 @@ class SimpleHistory {
883
  $db_version_prev = $db_version;
884
  $db_version = 1;
885
 
886
- /*SimpleLogger()->debug(
887
- "Simple History updated its database from version {from_version} to {to_version}",
888
- array(
889
- "from_version" => $db_version_prev,
890
- "to_version" => $db_version
891
- )
892
- );*/
893
-
894
  update_option("simple_history_db_version", $db_version);
895
 
896
  // We are not 100% sure that this is a first install,
897
  // but it is at least a very old version that is being updated
898
  $first_install = true;
899
 
900
- } // done pre db ver 1 things
901
-
902
 
903
  // If db version is 1 then upgrade to 2
904
  // Version 2 added the action_description column
905
- if ( 1 == intval($db_version) ) {
906
 
907
- // Add column for action description in non-translateable free text
908
  $sql = "ALTER TABLE {$table_name} ADD COLUMN action_description longtext";
909
  $wpdb->query($sql);
910
 
@@ -920,20 +980,20 @@ class SimpleHistory {
920
  $arr_options = array(
921
  array(
922
  "name" => "simple_history_show_as_page",
923
- "default_value" => 1
924
  ),
925
  array(
926
  "name" => "simple_history_show_on_dashboard",
927
- "default_value" => 1
928
- )
929
  );
930
 
931
  foreach ($arr_options as $one_option) {
932
 
933
- if ( false === ($option_value = get_option( $one_option["name"] ) ) ) {
934
 
935
  // Value is not set in db, so set it to a default
936
- update_option( $one_option["name"], $one_option["default_value"] );
937
 
938
  }
939
  }
@@ -945,9 +1005,9 @@ class SimpleHistory {
945
  *
946
  * @since 2.0
947
  */
948
- if ( 2 == intval($db_version) ) {
949
 
950
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
951
 
952
  // Update old table
953
  $sql = "
@@ -1004,13 +1064,13 @@ class SimpleHistory {
1004
  $table_name
1005
  );
1006
 
1007
- $wpdb->query( $sql );
1008
 
1009
  // Say welcome, however loggers are not added this early so we need to
1010
  // use a filter to load it later
1011
- add_action("simple_history/loggers_loaded", array( $this, "addWelcomeLogMessage" ));
1012
 
1013
- } // db version 2 » 3
1014
 
1015
  /**
1016
  * If db version = 3
@@ -1020,9 +1080,9 @@ class SimpleHistory {
1020
  *
1021
  * @since 2.0
1022
  */
1023
- if ( 3 == intval($db_version) ) {
1024
 
1025
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
1026
 
1027
  $sql = sprintf('
1028
  ALTER TABLE %1$s
@@ -1035,17 +1095,16 @@ class SimpleHistory {
1035
  ',
1036
  $table_name
1037
  );
1038
- $wpdb->query( $sql );
1039
 
1040
  $db_version_prev = $db_version;
1041
  $db_version = 4;
1042
 
1043
  update_option("simple_history_db_version", $db_version);
1044
 
1045
- } // end db version 3 » 4
1046
-
1047
 
1048
- } // end check_for_upgrade
1049
 
1050
  /**
1051
  * Greet users to version 2!
@@ -1056,7 +1115,7 @@ class SimpleHistory {
1056
  "Welcome to Simple History 2! Hope you will enjoy this plugin.
1057
  Found bugs? Got great ideas? Send them to the plugin developer at par.thernstrom@gmail.com.",
1058
  array(
1059
- "_initiator" => SimpleLoggerLogInitiators::WORDPRESS
1060
  )
1061
  );
1062
 
@@ -1087,50 +1146,50 @@ class SimpleHistory {
1087
 
1088
  <h2 class="SimpleHistoryPageHeadline">
1089
  <div class="dashicons dashicons-backup SimpleHistoryPageHeadline__icon"></div>
1090
- <?php _e("Simple History Settings", "simple-history") ?>
1091
  </h2>
1092
 
1093
  <?php
1094
- $active_tab = isset( $_GET["selected-tab"] ) ? $_GET["selected-tab"] : "settings";
1095
- $settings_base_url = menu_page_url(SimpleHistory::SETTINGS_MENU_SLUG, 0);
1096
- ?>
1097
 
1098
  <h3 class="nav-tab-wrapper">
1099
  <?php
1100
- foreach ( $arr_settings_tabs as $one_tab ) {
1101
 
1102
- $tab_slug = $one_tab["slug"];
1103
 
1104
- printf(
1105
- '<a href="%3$s" class="nav-tab %4$s">%1$s</a>',
1106
- $one_tab["name"], // 1
1107
- $tab_slug, // 2
1108
- add_query_arg("selected-tab", $tab_slug, $settings_base_url), // 3
1109
- $active_tab == $tab_slug ? "nav-tab-active" : "" // 4
1110
- );
1111
 
1112
- }
1113
- ?>
1114
  </h3>
1115
 
1116
  <?php
1117
 
1118
- // Output contents for selected tab
1119
- $arr_active_tab = wp_filter_object_list( $arr_settings_tabs, array("slug" => $active_tab));
1120
- $arr_active_tab = current($arr_active_tab);
1121
 
1122
- // We must have found an active tab and it must have a callable function
1123
- if ( ! $arr_active_tab || ! is_callable( $arr_active_tab["function"] ) ) {
1124
- wp_die( __("No valid callback found", "simple-history") );
1125
- }
1126
 
1127
- $args = array(
1128
- "arr_active_tab" => $arr_active_tab
1129
- );
1130
 
1131
- call_user_func_array( $arr_active_tab["function"], $args );
1132
 
1133
- ?>
1134
 
1135
  </div>
1136
  <?php
@@ -1139,23 +1198,22 @@ class SimpleHistory {
1139
 
1140
  public function settings_output_log() {
1141
 
1142
- include( __DIR__ . "/templates/settings-log.php" );
1143
 
1144
  }
1145
 
1146
  public function settings_output_general() {
1147
 
1148
- include( __DIR__ . "/templates/settings-general.php" );
1149
 
1150
  }
1151
 
1152
  public function settings_output_styles_example() {
1153
 
1154
- include( __DIR__ . "/templates/settings-style-example.php" );
1155
 
1156
  }
1157
 
1158
-
1159
  /**
1160
  * Content for section intro. Leave it be, even if empty.
1161
  * Called from add_sections_setting.
@@ -1164,22 +1222,21 @@ class SimpleHistory {
1164
 
1165
  }
1166
 
1167
-
1168
  /**
1169
  * Add pages (history page and settings page)
1170
  */
1171
  function add_admin_pages() {
1172
 
1173
  // Add a history page as a sub-page below the Dashboard menu item
1174
- if ( $this->setting_show_as_page() ) {
1175
 
1176
  add_dashboard_page(
1177
- SimpleHistory::NAME,
1178
- _x("Simple History", 'dashboard menu name', 'simple-history'),
1179
- $this->view_history_capability,
1180
- "simple_history_page",
1181
- array($this, "history_page_output")
1182
- );
1183
 
1184
  }
1185
 
@@ -1190,12 +1247,12 @@ class SimpleHistory {
1190
  if ($show_settings_page) {
1191
 
1192
  add_options_page(
1193
- __('Simple History Settings', "simple-history"),
1194
- SimpleHistory::NAME,
1195
- $this->view_settings_capability,
1196
- SimpleHistory::SETTINGS_MENU_SLUG,
1197
- array($this, 'settings_page_output')
1198
- );
1199
 
1200
  }
1201
 
@@ -1208,15 +1265,15 @@ class SimpleHistory {
1208
  function add_settings() {
1209
 
1210
  // Clear the log if clear button was clicked in settings
1211
- if ( isset( $_GET["simple_history_clear_log_nonce"] ) && wp_verify_nonce( $_GET["simple_history_clear_log_nonce"], 'simple_history_clear_log')) {
1212
 
1213
  $this->clear_log();
1214
  $msg = __("Cleared database", 'simple-history');
1215
- add_settings_error( "simple_history_rss_feed_regenerate_secret", "simple_history_rss_feed_regenerate_secret", $msg, "updated" );
1216
  set_transient('settings_errors', get_settings_errors(), 30);
1217
 
1218
- $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() );
1219
- wp_redirect( $goback );
1220
  exit;
1221
 
1222
  }
@@ -1228,7 +1285,7 @@ class SimpleHistory {
1228
  $settings_section_general_id,
1229
  "", // No title __("General", "simple-history"),
1230
  array($this, "settings_section_output"),
1231
- SimpleHistory::SETTINGS_MENU_SLUG // same slug as for options menu page
1232
  );
1233
 
1234
  // Settings for the general settings section
@@ -1271,7 +1328,6 @@ class SimpleHistory {
1271
 
1272
  }
1273
 
1274
-
1275
  /**
1276
  * Output for page with the history
1277
  */
@@ -1300,38 +1356,38 @@ class SimpleHistory {
1300
 
1301
  <h2 class="SimpleHistoryPageHeadline">
1302
  <div class="dashicons dashicons-backup SimpleHistoryPageHeadline__icon"></div>
1303
- <?php echo _x("Simple History", 'history page headline', 'simple-history') ?>
1304
  </h2>
1305
 
1306
  <?php
1307
- /**
1308
- * Fires before the gui div
1309
- *
1310
- * @since 2.0
1311
- *
1312
- * @param SimpleHistory $SimpleHistory This class.
1313
- */
1314
- do_action( "simple_history/history_page/before_gui", $this );
1315
- ?>
1316
 
1317
  <div class="SimpleHistoryGuiWrap">
1318
 
1319
  <div class="SimpleHistoryGui"
1320
- data-pager-size='<?php echo $pager_size ?>'
1321
  ></div>
1322
 
1323
  <?php
1324
 
1325
- /**
1326
- * Fires after the gui div
1327
- *
1328
- * @since 2.0
1329
- *
1330
- * @param SimpleHistory $SimpleHistory This class.
1331
- */
1332
- do_action( "simple_history/history_page/after_gui", $this );
1333
 
1334
- ?>
1335
 
1336
  </div>
1337
 
@@ -1378,16 +1434,16 @@ class SimpleHistory {
1378
 
1379
  ?>
1380
  <select name="simple_history_pager_size">
1381
- <option <?php echo $current_pager_size == 5 ? "selected" : "" ?> value="5">5</option>
1382
- <option <?php echo $current_pager_size == 10 ? "selected" : "" ?> value="10">10</option>
1383
- <option <?php echo $current_pager_size == 15 ? "selected" : "" ?> value="15">15</option>
1384
- <option <?php echo $current_pager_size == 20 ? "selected" : "" ?> value="20">20</option>
1385
- <option <?php echo $current_pager_size == 25 ? "selected" : "" ?> value="25">25</option>
1386
- <option <?php echo $current_pager_size == 30 ? "selected" : "" ?> value="30">30</option>
1387
- <option <?php echo $current_pager_size == 40 ? "selected" : "" ?> value="40">40</option>
1388
- <option <?php echo $current_pager_size == 50 ? "selected" : "" ?> value="50">50</option>
1389
- <option <?php echo $current_pager_size == 75 ? "selected" : "" ?> value="75">75</option>
1390
- <option <?php echo $current_pager_size == 100 ? "selected" : "" ?> value="100">100</option>
1391
  </select>
1392
  <?php
1393
 
@@ -1402,16 +1458,16 @@ class SimpleHistory {
1402
  $show_as_page = $this->setting_show_as_page();
1403
  ?>
1404
 
1405
- <input <?php echo $show_on_dashboard ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_on_dashboard" id="simple_history_show_on_dashboard" class="simple_history_show_on_dashboard" />
1406
- <label for="simple_history_show_on_dashboard"><?php _e("on the dashboard", 'simple-history') ?></label>
1407
 
1408
  <br />
1409
 
1410
- <input <?php echo $show_as_page ? "checked='checked'" : "" ?> type="checkbox" value="1" name="simple_history_show_as_page" id="simple_history_show_as_page" class="simple_history_show_as_page" />
1411
- <label for="simple_history_show_as_page"><?php _e("as a page under the dashboard menu", 'simple-history') ?></label>
1412
 
1413
  <?php
1414
- }
1415
 
1416
  /**
1417
  * Settings section to clear database
@@ -1419,14 +1475,14 @@ class SimpleHistory {
1419
  function settings_field_clear_log() {
1420
 
1421
  $clear_link = add_query_arg("", "");
1422
- $clear_link = wp_nonce_url( $clear_link, "simple_history_clear_log", "simple_history_clear_log_nonce" );
1423
  $clear_days = $this->get_clear_history_interval();
1424
 
1425
  echo "<p>";
1426
- if ( $clear_days > 0 ) {
1427
- echo sprintf( __('Items in the database are automatically removed after %1$s days.', "simple-history"), $clear_days);
1428
  } else {
1429
- _e( 'Items in the database are kept forever.', 'simple-history');
1430
  }
1431
  echo "</p>";
1432
 
@@ -1458,27 +1514,69 @@ class SimpleHistory {
1458
  global $wpdb;
1459
 
1460
  $tableprefix = $wpdb->prefix;
 
1461
  $simple_history_table = SimpleHistory::DBTABLE;
1462
  $simple_history_context_table = SimpleHistory::DBTABLE_CONTEXTS;
1463
 
 
 
 
 
1464
  $sql = "DELETE FROM {$tableprefix}{$simple_history_table}";
1465
  $wpdb->query($sql);
1466
 
1467
  $sql = "DELETE FROM {$tableprefix}{$simple_history_context_table}";
1468
  $wpdb->query($sql);
1469
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1470
  }
1471
 
1472
  /**
1473
  * Removes old entries from the db
1474
- * @TODO this function does not remove old entries from context table
1475
  */
1476
  function purge_db() {
1477
 
 
 
1478
  $do_purge_history = true;
 
1479
  $do_purge_history = apply_filters("simple_history_allow_db_purge", $do_purge_history);
1480
  $do_purge_history = apply_filters("simple_history/allow_db_purge", $do_purge_history);
1481
- if ( ! $do_purge_history ) {
 
1482
  return;
1483
  }
1484
 
@@ -1490,12 +1588,48 @@ class SimpleHistory {
1490
  }
1491
 
1492
  global $wpdb;
1493
- $tableprefix = $wpdb->prefix;
1494
- $simple_history_table = SimpleHistory::DBTABLE;
1495
 
1496
- $sql = "DELETE FROM {$tableprefix}{$simple_history_table} WHERE DATE_ADD(date, INTERVAL $days DAY) < now()";
 
1497
 
1498
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1499
 
1500
  }
1501
 
@@ -1511,20 +1645,20 @@ class SimpleHistory {
1511
 
1512
  $row_logger = $row->logger;
1513
  $logger = null;
1514
- $row->context = isset( $row->context ) && is_array( $row->context ) ? $row->context : array();
1515
 
1516
- if ( ! isset( $row->context["_message_key"] ) ) {
1517
  $row->context["_message_key"] = null;
1518
  }
1519
 
1520
  // Fallback to SimpleLogger if no logger exists for row
1521
- if ( ! isset( $this->instantiatedLoggers[$row_logger] ) ) {
1522
  $row_logger = "SimpleLogger";
1523
  }
1524
 
1525
- $logger = $this->instantiatedLoggers[ $row_logger ]["instance"];
1526
 
1527
- return $logger->getLogRowPlainTextOutput( $row );
1528
 
1529
  }
1530
 
@@ -1543,16 +1677,16 @@ class SimpleHistory {
1543
 
1544
  $row_logger = $row->logger;
1545
  $logger = null;
1546
- $row->context = isset( $row->context ) && is_array( $row->context ) ? $row->context : array();
1547
 
1548
  // Fallback to SimpleLogger if no logger exists for row
1549
- if ( ! isset( $this->instantiatedLoggers[$row_logger] ) ) {
1550
  $row_logger = "SimpleLogger";
1551
  }
1552
 
1553
  $logger = $this->instantiatedLoggers[$row_logger]["instance"];
1554
 
1555
- return $logger->getLogRowHeaderOutput( $row );
1556
 
1557
  }
1558
 
@@ -1566,16 +1700,16 @@ class SimpleHistory {
1566
 
1567
  $row_logger = $row->logger;
1568
  $logger = null;
1569
- $row->context = isset( $row->context ) && is_array( $row->context ) ? $row->context : array();
1570
 
1571
  // Fallback to SimpleLogger if no logger exists for row
1572
- if ( ! isset( $this->instantiatedLoggers[$row_logger] ) ) {
1573
  $row_logger = "SimpleLogger";
1574
  }
1575
 
1576
  $logger = $this->instantiatedLoggers[$row_logger]["instance"];
1577
 
1578
- return $logger->getLogRowSenderImageOutput( $row );
1579
 
1580
  }
1581
 
@@ -1583,16 +1717,16 @@ class SimpleHistory {
1583
 
1584
  $row_logger = $row->logger;
1585
  $logger = null;
1586
- $row->context = isset( $row->context ) && is_array( $row->context ) ? $row->context : array();
1587
 
1588
  // Fallback to SimpleLogger if no logger exists for row
1589
- if ( ! isset( $this->instantiatedLoggers[$row_logger] ) ) {
1590
  $row_logger = "SimpleLogger";
1591
  }
1592
 
1593
  $logger = $this->instantiatedLoggers[$row_logger]["instance"];
1594
 
1595
- return $logger->getLogRowDetailsOutput( $row );
1596
 
1597
  }
1598
 
@@ -1604,7 +1738,7 @@ class SimpleHistory {
1604
  */
1605
  public static function json_encode($value) {
1606
 
1607
- return version_compare(PHP_VERSION, '5.4.0') >=0 ? json_encode($value, JSON_PRETTY_PRINT) : json_encode($value);
1608
 
1609
  }
1610
 
@@ -1613,8 +1747,8 @@ class SimpleHistory {
1613
  * @param string $haystack
1614
  * @param string $needle
1615
  */
1616
- public static function ends_with( $haystack, $needle ) {
1617
- return $needle === substr( $haystack, -strlen( $needle ) );
1618
  }
1619
 
1620
  /**
@@ -1626,17 +1760,17 @@ class SimpleHistory {
1626
  public function getLogRowHTMLOutput($oneLogRow, $args) {
1627
 
1628
  $defaults = array(
1629
- "type" => "overview" // or "single" to include more stuff
1630
  );
1631
 
1632
- $args = wp_parse_args( $args, $defaults );
1633
 
1634
  $header_html = $this->getLogRowHeaderOutput($oneLogRow);
1635
  $plain_text_html = $this->getLogRowPlainTextOutput($oneLogRow);
1636
  $sender_image_html = $this->getLogRowSenderImageOutput($oneLogRow);
1637
 
1638
  // Details = for example thumbnail of media
1639
- $details_html = trim( $this->getLogRowDetailsOutput($oneLogRow) );
1640
  if ($details_html) {
1641
 
1642
  $details_html = sprintf(
@@ -1680,14 +1814,14 @@ class SimpleHistory {
1680
  }
1681
 
1682
  $data_attrs = "";
1683
- $data_attrs .= sprintf(' data-row-id="%1$d" ', $oneLogRow->id );
1684
- $data_attrs .= sprintf(' data-occasions-count="%1$d" ', $occasions_count );
1685
- $data_attrs .= sprintf(' data-occasions-id="%1$s" ', $oneLogRow->occasionsID );
1686
- $data_attrs .= sprintf(' data-ip-address="%1$s" ', esc_attr( $oneLogRow->context["_server_remote_addr"] ) );
1687
 
1688
  // If type is single then include more details
1689
  $more_details_html = "";
1690
- if ( $args["type"] == "single" ) {
1691
 
1692
  $more_details_html .= sprintf('<h2 class="SimpleHistoryLogitem__moreDetailsHeadline">%1$s</h2>', __("Context data", "simple-history"));
1693
  $more_details_html .= "<p>" . __("This is potentially useful meta data that a logger has saved.", "simple-history") . "</p>";
@@ -1704,7 +1838,7 @@ class SimpleHistory {
1704
  foreach ($oneLogRow as $rowKey => $rowVal) {
1705
 
1706
  // skip arrays and objects and such
1707
- if ( is_array( $rowVal ) || is_object( $rowVal ) ) {
1708
  continue;
1709
  }
1710
 
@@ -1713,8 +1847,8 @@ class SimpleHistory {
1713
  <td>%1$s</td>
1714
  <td>%2$s</td>
1715
  </tr>',
1716
- esc_html( $rowKey ),
1717
- esc_html( $rowVal )
1718
  );
1719
 
1720
  }
@@ -1726,8 +1860,8 @@ class SimpleHistory {
1726
  <td>%1$s</td>
1727
  <td>%2$s</td>
1728
  </tr>',
1729
- esc_html( $contextKey ),
1730
- esc_html( $contextVal )
1731
  );
1732
 
1733
  }
@@ -1745,10 +1879,10 @@ class SimpleHistory {
1745
  $classes = array(
1746
  "SimpleHistoryLogitem",
1747
  "SimpleHistoryLogitem--loglevel-{$oneLogRow->level}",
1748
- "SimpleHistoryLogitem--logger-{$oneLogRow->logger}"
1749
  );
1750
 
1751
- if ( isset( $oneLogRow->initiator ) && ! empty( $oneLogRow->initiator ) ) {
1752
  $classes[] = "SimpleHistoryLogitem--initiator-" . esc_attr($oneLogRow->initiator);
1753
  }
1754
 
@@ -1762,12 +1896,12 @@ class SimpleHistory {
1762
  $plain_text_html .= $log_level_tag_html;
1763
 
1764
  /**
1765
- * Filter to modify classes added to item li element
1766
- *
1767
- * @since 2.0.7
1768
- *
1769
- * @param $classes Array with classes
1770
- */
1771
  $classes = apply_filters("simple_history/logrowhtmloutput/classes", $classes);
1772
 
1773
  // Generate the HTML output for a row
@@ -1850,7 +1984,7 @@ class SimpleHistory {
1850
  break;
1851
 
1852
  case "info":
1853
- $str_translated = _x("info", "Log level in gui", "simple-history");
1854
  break;
1855
 
1856
  case "debug":
@@ -1907,13 +2041,13 @@ class SimpleHistory {
1907
 
1908
  public function getInstantiatedLoggerBySlug($slug = "") {
1909
 
1910
- if (empty( $slug )) {
1911
  return false;
1912
  }
1913
 
1914
  foreach ($this->getInstantiatedLoggers() as $one_logger) {
1915
 
1916
- if ( $slug == $one_logger["instance"]->slug ) {
1917
  return $one_logger["instance"];
1918
  }
1919
 
@@ -1935,7 +2069,7 @@ class SimpleHistory {
1935
 
1936
  $arr_loggers_user_can_view = array();
1937
 
1938
- if ( ! is_numeric($user_id) ) {
1939
  $user_id = get_current_user_id();
1940
  }
1941
 
@@ -1945,27 +2079,27 @@ class SimpleHistory {
1945
  $logger_capability = $one_logger["instance"]->getCapability();
1946
 
1947
  //$arr_loggers_user_can_view = apply_filters("simple_history/loggers_user_can_read", $user_id, $arr_loggers_user_can_view);
1948
- $user_can_read_logger = user_can( $user_id, $logger_capability );
1949
  $user_can_read_logger = apply_filters("simple_history/loggers_user_can_read/can_read_single_logger", $user_can_read_logger, $one_logger["instance"], $user_id);
1950
 
1951
- if ( $user_can_read_logger ) {
1952
  $arr_loggers_user_can_view[] = $one_logger;
1953
  }
1954
 
1955
  }
1956
 
1957
  /**
1958
- * Fires before Simple History does it's init stuff
1959
- *
1960
- * @since 2.0
1961
- *
1962
- * @param array $arr_loggers_user_can_view Array with loggers that user $user_id can read
1963
- * @param int user_id ID of user to check read capability for
1964
- */
1965
  $arr_loggers_user_can_view = apply_filters("simple_history/loggers_user_can_read", $arr_loggers_user_can_view, $user_id);
1966
 
1967
  // just return array with slugs in parenthesis suitable for sql-where
1968
- if ( "sql" == $format ) {
1969
 
1970
  $str_return = "(";
1971
 
@@ -1985,7 +2119,6 @@ class SimpleHistory {
1985
 
1986
  }
1987
 
1988
-
1989
  return $arr_loggers_user_can_view;
1990
 
1991
  }
@@ -2002,64 +2135,75 @@ class SimpleHistory {
2002
  * @param string $default URL to a default image to use if no avatar is available
2003
  * @param string $alt Alternative text to use in image tag. Defaults to blank
2004
  * @return string <img> tag for the user's avatar
2005
- */
2006
- function get_avatar( $email, $size = '96', $default = '', $alt = false ) {
2007
 
2008
- if ( false === $alt)
2009
  $safe_alt = '';
2010
- else
2011
- $safe_alt = esc_attr( $alt );
 
2012
 
2013
- if ( !is_numeric($size) )
2014
  $size = '96';
 
2015
 
2016
- if ( empty($default) ) {
2017
  $avatar_default = get_option('avatar_default');
2018
- if ( empty($avatar_default) )
2019
  $default = 'mystery';
2020
- else
2021
  $default = $avatar_default;
 
 
2022
  }
2023
 
2024
- if ( !empty($email) )
2025
- $email_hash = md5( strtolower( trim( $email ) ) );
 
2026
 
2027
- if ( is_ssl() ) {
2028
  $host = 'https://secure.gravatar.com';
2029
  } else {
2030
- if ( !empty($email) )
2031
- $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash[0] ) % 2 ) );
2032
- else
2033
  $host = 'http://0.gravatar.com';
 
 
2034
  }
2035
 
2036
- if ( 'mystery' == $default )
2037
- $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
2038
- elseif ( 'blank' == $default )
2039
- $default = $email ? 'blank' : includes_url( 'images/blank.gif' );
2040
- elseif ( !empty($email) && 'gravatar_default' == $default )
 
 
2041
  $default = '';
2042
- elseif ( 'gravatar_default' == $default )
2043
  $default = "$host/avatar/?s={$size}";
2044
- elseif ( empty($email) )
2045
  $default = "$host/avatar/?d=$default&amp;s={$size}";
2046
- elseif ( strpos($default, 'http://') === 0 )
2047
- $default = add_query_arg( 's', $size, $default );
 
2048
 
2049
- if ( !empty($email) ) {
2050
  $out = "$host/avatar/";
2051
  $out .= $email_hash;
2052
- $out .= '?s='.$size;
2053
- $out .= '&amp;d=' . urlencode( $default );
2054
 
2055
  $rating = get_option('avatar_rating');
2056
- if ( !empty( $rating ) )
2057
  $out .= "&amp;r={$rating}";
 
2058
 
2059
- $out = str_replace( '&#038;', '&amp;', esc_url( $out ) );
2060
  $avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
2061
  } else {
2062
- $out = esc_url( $default );
2063
  $avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
2064
  }
2065
 
@@ -2078,9 +2222,11 @@ class SimpleHistory {
2078
  $logQuery = new SimpleHistoryLogQuery();
2079
  $logResults = $logQuery->query(array(
2080
  "posts_per_page" => 1,
2081
- "date_from" => strtotime("today")
2082
  ));
2083
 
 
 
2084
  // Get sql query for where to read only loggers current user is allowed to read/view
2085
  $sql_loggers_in = $this->getLoggersThatUserCanRead(get_current_user_id(), "sql");
2086
 
@@ -2104,7 +2250,7 @@ class SimpleHistory {
2104
  );
2105
 
2106
  $results_users_today = $wpdb->get_results($sql_users_today);
2107
- $count_users_today = sizeof( $results_users_today );
2108
 
2109
  // Get number of other sources (not wp_user)
2110
  $sql_other_sources_where = sprintf(
@@ -2137,7 +2283,7 @@ class SimpleHistory {
2137
  // sf_d($sql_other_sources, '$sql_other_sources');
2138
 
2139
  $results_other_sources_today = $wpdb->get_results($sql_other_sources);
2140
- $count_other_sources = sizeof( $results_other_sources_today );
2141
 
2142
  #sf_d($logResults, '$logResults');
2143
  #sf_d($results_users_today, '$sql_users_today');
@@ -2148,118 +2294,125 @@ class SimpleHistory {
2148
  <p>
2149
  <?php
2150
 
2151
- $msg_tmpl = "";
2152
 
2153
- // No results today at all
2154
- if ( $logResults["total_row_count"] == 0 ) {
2155
 
2156
- $msg_tmpl = __("No events today so far.", "simple-history");
2157
 
2158
- } else {
2159
 
2160
- /*
2161
- Type of results
2162
- x1 event today from 1 user.
2163
- x1 event today from 1 source.
2164
- x2 events today from 2 users.
2165
- x2 events today from 1 user and 1 other source.
2166
- x3 events today from 2 users and 1 other source.
2167
- x3 events today from 1 user and 2 other sources.
2168
- x4 events today from 2 users and 2 other sources.
2169
- */
2170
-
2171
- // A single event existed and was from a user
2172
- // 1 event today from 1 user.
2173
- if ( $logResults["total_row_count"] == 1 && $count_users_today ) {
2174
- $msg_tmpl .= __('One event today from one user.', "simple-history");
2175
- }
2176
 
2177
- // A single event existed and was from another source
2178
- // 1 event today from 1 source.
2179
- if ( $logResults["total_row_count"] == 1 && ! $count_users_today ) {
2180
- $msg_tmpl .= __('One event today from one source.', "simple-history");
2181
- }
2182
 
2183
- // Multiple events from only users
2184
- // 2 events today from 2 users.
2185
- if ( $logResults["total_row_count"] && $count_users_today == $logResults["total_row_count"] ) {
2186
- $msg_tmpl .= __('%1$d events today from %2$d users.', "simple-history");
2187
- }
2188
 
2189
- // Multiple events from 1 single user and 1 single other source
2190
- // 2 events today from 1 user and 1 other source.
2191
- if ( $logResults["total_row_count"] && 1 == $count_users_today && 1 == $count_other_sources ) {
2192
- $msg_tmpl .= __('%1$d events today from one user and one other source.', "simple-history");
2193
- }
2194
 
2195
- // Multiple events from multple users but from only 1 single other source
2196
- // 3 events today from 2 users and 1 other source.
2197
- if ( $logResults["total_row_count"] > 1 && $count_users_today > 1 && $count_other_sources == 1 ) {
2198
- $msg_tmpl .= __('%1$d events today from one user and one other source.', "simple-history");
2199
- }
2200
 
2201
- // Multiple events from 1 user but from multiple other source
2202
- // 3 events today from 1 user and 2 other sources.
2203
- if ( $logResults["total_row_count"] > 1 && 1 == $count_users_today && $count_other_sources > 1 ) {
2204
- $msg_tmpl .= __('%1$d events today from one user and %3$d other sources.', "simple-history");
2205
- }
2206
 
2207
- // Multiple events from multiple user and from multiple other sources
2208
- // 4 events today from 2 users and 2 other sources.
2209
- if ( $logResults["total_row_count"] && 1 == $count_users_today && $count_other_sources > 1 ) {
2210
- $msg_tmpl .= __('%1$s events today from %2$d users and %3$d other sources.', "simple-history");
2211
- }
2212
 
2213
- }
 
 
 
 
 
 
 
 
 
 
2214
 
2215
- /*
2216
- if ( $logResults["total_row_count"] == 0 ) {
2217
 
2218
- $msg_tmpl = __("No events today so far.", "simple-history");
 
2219
 
2220
- } elseif ( $logResults["total_row_count"] == 1 ) {
2221
 
2222
- $msg_tmpl = __('%1$d event today from one user.', "simple-history");
2223
 
2224
- } elseif ( $logResults["total_row_count"] > 0 && sizeof( $results_users_today ) > 1 ) {
2225
 
2226
- $msg_tmpl = __('%1$d events today from %2$d users.', "simple-history");
2227
 
2228
- } elseif ( $logResults["total_row_count"] > 0 && sizeof( $results_users_today ) == 1 ) {
2229
 
2230
- $msg_tmpl = __('%1$d events today from one user.', "simple-history");
2231
 
2232
- }
2233
- */
 
 
2234
 
2235
- // only show stats if we have something to output
2236
- if ( $msg_tmpl ) {
2237
 
2238
- printf(
2239
- $msg_tmpl,
2240
- $logResults["total_row_count"], // 1
2241
- $count_users_today, // 2
2242
- $count_other_sources // 3
2243
- );
2244
 
2245
- // Space between texts
2246
- /*
2247
- echo " ";
2248
 
2249
- // http://playground-root.ep/wp-admin/options-general.php?page=simple_history_settings_menu_slug&selected-tab=stats
2250
- printf(
2251
- '<a href="%1$s">View more stats</a>.',
2252
- add_query_arg("selected-tab", "stats", menu_page_url(SimpleHistory::SETTINGS_MENU_SLUG, 0))
2253
- );
2254
- */
2255
 
2256
- }
2257
 
2258
- ?>
2259
  </p>
2260
  </div>
2261
  <?php
2262
 
2263
  }
2264
 
2265
- } // class
6
  class SimpleHistory {
7
 
8
  const NAME = "Simple History";
9
+ const VERSION = "2.0.17";
10
 
11
  /**
12
  * Capability required to view the history log
41
  */
42
  private $doFilterGettext_currentLogger = null;
43
 
44
+ /**
45
+ * Used to store latest translations used by __()
46
+ * Required to automagically determine orginal text and text domain
47
+ * for calls like this `SimpleLogger()->log( __("My translated message") );`
48
+ */
49
+ public $gettextLatestTranslations = array();
50
+
51
  /**
52
  * All registered settings tabs
53
  */
65
  function __construct() {
66
 
67
  /**
68
+ * Fires before Simple History does it's init stuff
69
+ *
70
+ * @since 2.0
71
+ *
72
+ * @param SimpleHistory $SimpleHistory This class.
73
+ */
74
+ do_action("simple_history/before_init", $this);
75
 
76
  $this->setupVariables();
77
 
78
  // Actions and filters, ordered by order specified in codex: http://codex.wordpress.org/Plugin_API/Action_Reference
79
+ add_action('plugins_loaded', array($this, 'load_plugin_textdomain'));
80
+ add_action('plugins_loaded', array($this, 'add_default_settings_tabs'));
81
+ add_action('plugins_loaded', array($this, 'loadLoggers'));
82
+ add_action('plugins_loaded', array($this, 'loadDropins'));
83
 
84
  // Run before loading of loggers and before menu items are added
85
+ add_action('plugins_loaded', array($this, 'check_for_upgrade'), 5);
86
 
87
+ add_action('plugins_loaded', array($this, 'setup_cron'));
 
88
 
89
+ add_action('admin_menu', array($this, 'add_admin_pages'));
90
+ add_action('admin_menu', array($this, 'add_settings'));
91
 
92
+ add_action('admin_footer', array($this, "add_js_templates"));
93
 
94
+ add_action('wp_dashboard_setup', array($this, 'add_dashboard_widget'));
95
 
96
+ add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
97
+
98
+ add_action('admin_head', array($this, "onAdminHead"));
99
+ add_action('admin_footer', array($this, "onAdminFooter"));
100
 
101
  // Filters and actions not called during regular boot
102
  add_filter("gettext", array($this, 'filter_gettext'), 20, 3);
103
  add_filter("gettext_with_context", array($this, 'filter_gettext_with_context'), 20, 4);
104
 
105
+ add_action('simple_history/history_page/before_gui', array($this, "output_quick_stats"));
106
+ add_action('simple_history/dashboard/before_gui', array($this, "output_quick_stats"));
107
 
108
+ //add_action('wp_ajax_simple_history_ajax', array($this, 'ajax'));
109
+ add_action('wp_ajax_simple_history_api', array($this, 'api'));
110
 
111
+ add_filter('plugin_action_links_simple-history/index.php', array($this, 'plugin_action_links'), 10, 4);
112
 
113
  /**
114
+ * Fires after Simple History has done it's init stuff
115
+ *
116
+ * @since 2.0
117
+ *
118
+ * @param SimpleHistory $SimpleHistory This class.
119
+ */
120
+ do_action("simple_history/after_init", $this);
121
 
122
+ // test to translate automagically during logging
123
+ /*
124
+ add_action("init", function () {
125
 
126
+ if (defined('DOING_AJAX') && DOING_AJAX) {
127
+ return;
128
+ }
129
+
130
+ if (!isset($_GET["sh-test"])) {
131
+ return;
132
+ }
133
+
134
+ SimpleLogger()->debug( "This is a message with no translation" );
135
+ SimpleLogger()->debug( __("Plugin"), array( "comment" => "This message is 'Plugin' and should contain text domain 'default' since it's a translation that comes with WordPress" ) );
136
+ SimpleLogger()->debug( __("Enter title of new page", "cms-tree-page-view"), array("comment" => "A translation used in CMS Tree Page View"));
137
+
138
+ });
139
+ */
140
+
141
+ add_filter('gettext', array( $this, "filter_gettext_storeLatestTranslations" ), 10, 3 );
142
+
143
+ }
144
+
145
+ function filter_gettext_storeLatestTranslations($translation, $text, $domain) {
146
+
147
+ $array_max_size = 5;
148
+
149
+ // Keep a listing of the n latest translation
150
+ // when SimpleLogger->log() is called from anywhere we can then search for the
151
+ // translated string among our n latest things and find it there, if it's translated
152
+ //global $sh_latest_translations;
153
+ $sh_latest_translations = $this->gettextLatestTranslations;
154
+
155
+ $sh_latest_translations[$translation] = array(
156
+ "translation" => $translation,
157
+ "text" => $text,
158
+ "domain" => $domain,
159
+ );
160
+
161
+ $arr_length = sizeof($sh_latest_translations);
162
+ if ($arr_length > $array_max_size) {
163
+ $sh_latest_translations = array_slice($sh_latest_translations, $arr_length - $array_max_size);
164
+ }
165
+
166
+ $this->gettextLatestTranslations = $sh_latest_translations;
167
+
168
+ return $translation;
169
+
170
+ }
171
+
172
+ function setup_cron() {
173
+
174
+ add_filter("simple_history/maybe_purge_db", array( $this, "maybe_purge_db") );
175
+
176
+ if ( ! wp_next_scheduled('simple_history/maybe_purge_db') ) {
177
+ wp_schedule_event(time(), 'daily', 'simple_history/maybe_purge_db');
178
+ #error_log("not scheduled, so do schedule");
179
+ } else {
180
+ #error_log("is scheduled");
181
+ }
182
+
183
+ // Remove old schedule (only author dev sites should have it)
184
+ $old_next_scheduled = wp_next_scheduled('simple_history/purge_db');
185
+ if ( $old_next_scheduled ) {
186
+ wp_unschedule_event($old_next_scheduled, 'simple_history/purge_db');
187
+ }
188
 
189
  }
190
 
192
 
193
  # Log that an email has been sent
194
  simple_history_add(array(
195
+ "object_type" => "Email",
196
+ "object_name" => "Hi there",
197
+ "action" => "was sent",
198
  ));
199
 
200
  # Will show “Plugin your_plugin_name Edited” in the history log
205
 
206
  # Log with some extra details about the email
207
  simple_history_add(array(
208
+ "object_type" => "Email",
209
+ "object_name" => "Hi there",
210
+ "action" => "was sent",
211
+ "description" => "The database query to generate the email took .3 seconds. This is email number 4 that is sent to this user",
212
  ));
213
 
 
214
  }
215
 
216
  public function onAdminHead() {
217
 
218
+ if ($this->is_on_our_own_pages()) {
219
 
220
+ do_action("simple_history/admin_head", $this);
221
 
222
  }
223
 
225
 
226
  public function onAdminFooter() {
227
 
228
+ if ($this->is_on_our_own_pages()) {
229
 
230
+ do_action("simple_history/admin_footer", $this);
231
 
232
  }
233
 
238
  */
239
  public function add_js_templates($hook) {
240
 
241
+ if ($this->is_on_our_own_pages()) {
242
 
243
  ?>
244
 
246
 
247
  <div class="SimpleHistory__waitingForFirstLoad">
248
  <img src="<?php echo admin_url("/images/spinner.gif");?>" alt="" width="20" height="20">
249
+ <?php echo _x("Loading history...", "Message visible while waiting for log to load from server the first time", "simple-history")?>
250
  </div>
251
 
252
  <div class="SimpleHistoryLogitemsWrap">
283
  href="#">‹</a>
284
  <span class="SimpleHistoryPaginationInput">
285
  <input class="SimpleHistoryPaginationCurrentPage" title="{{ data.strings.currentPage }}" type="text" name="paged" value="{{ data.api_args.paged }}" size="4">
286
+ <?php _x("of", "page n of n", "simple-history")?>
287
  <span class="total-pages">{{ data.pages_count }}</span>
288
  </span>
289
  <a
320
  <?php
321
 
322
  // Call plugins so they can add their js
323
+ foreach ($this->instantiatedLoggers as $one_logger) {
324
+ if (method_exists($one_logger["instance"], "adminJS")) {
325
  $one_logger["instance"]->adminJS();
326
  }
327
  }
349
  unset($args["action"]);
350
 
351
  // Type = overview | ...
352
+ $type = isset($_GET["type"]) ? $_GET["type"] : null;
353
 
354
+ if (empty($args) || !$type) {
355
 
356
+ wp_send_json_error(array(
357
+ _x("Not enough args specified", "API: not enought arguments passed", "simple-history"),
358
+ ));
359
 
360
  }
361
 
362
  if (isset($args["id"])) {
363
  $args["post__in"] = array(
364
+ $args["id"],
365
  );
366
  }
367
 
 
368
  $data = array();
369
 
370
  switch ($type) {
380
  $data["api_args"] = $args;
381
 
382
  // Output can be array or HMTL
383
+ if (isset($args["format"]) && "html" === $args["format"]) {
384
 
385
  $data["log_rows_raw"] = array();
386
 
391
  $args["type"] = "single";
392
  }
393
 
394
+ $data["log_rows"][$key] = $this->getLogRowHTMLOutput($oneLogRow, $args);
395
 
396
  }
397
 
402
 
403
  break;
404
 
 
405
  default:
406
  $data[] = "Nah.";
407
 
408
  }
409
 
410
+ wp_send_json_success($data);
411
 
412
  }
413
 
416
  * to the untranslated text too, because that's the version we want to store
417
  * in the database.
418
  */
419
+ public function filter_gettext($translated_text, $untranslated_text, $domain) {
420
 
421
+ if (isset($this->doFilterGettext) && $this->doFilterGettext) {
422
 
423
  $this->doFilterGettext_currentLogger->messages[] = array(
424
  "untranslated_text" => $untranslated_text,
436
  /**
437
  * Store messages with context
438
  */
439
+ public function filter_gettext_with_context($translated_text, $untranslated_text, $context, $domain) {
440
 
441
+ if (isset($this->doFilterGettext) && $this->doFilterGettext) {
442
 
443
  $this->doFilterGettext_currentLogger->messages[] = array(
444
  "untranslated_text" => $untranslated_text,
467
  // The "plugin_locale" filter is also used in load_plugin_textdomain()
468
  $locale = apply_filters('plugin_locale', get_locale(), $domain);
469
 
470
+ load_textdomain($domain, WP_LANG_DIR . '/simple-history/' . $domain . '-' . $locale . '.mo');
471
+ load_plugin_textdomain($domain, FALSE, dirname($this->plugin_basename) . '/languages/');
472
 
473
  }
474
 
502
  array(
503
  "slug" => "settings",
504
  "name" => __("Settings", "simple-history"),
505
+ "function" => array($this, "settings_output_general"),
506
  ),
507
 
508
  );
509
 
510
+ if (defined("SIMPLE_HISTORY_DEV") && SIMPLE_HISTORY_DEV) {
511
 
512
  $arr_dev_tabs = array(
513
  array(
514
  "slug" => "log",
515
  "name" => __("Log (debug)", "simple-history"),
516
+ "function" => array($this, "settings_output_log"),
517
  ),
518
  array(
519
  "slug" => "styles-example",
520
  "name" => __("Styles example (debug)", "simple-history"),
521
+ "function" => array($this, "settings_output_styles_example"),
522
+ ),
523
 
524
  );
525
 
526
+ $this->arr_settings_tabs = array_merge($this->arr_settings_tabs, $arr_dev_tabs);
527
 
528
  }
529
 
546
  */
547
  $loggersDir = apply_filters("simple_history/loggers_dir", $loggersDir);
548
 
549
+ $loggersFiles = glob($loggersDir . "*.php");
550
 
551
  // SimpleLogger.php must be loaded first since the other loggers extend it
552
+ require_once $loggersDir . "SimpleLogger.php";
553
 
554
  /**
555
  * Filter the array with absolute paths to files as returned by glob function.
563
  $loggersFiles = apply_filters("simple_history/loggers_files", $loggersFiles);
564
 
565
  $arrLoggersToInstantiate = array();
566
+ foreach ($loggersFiles as $oneLoggerFile) {
567
 
568
+ if (basename($oneLoggerFile) == "SimpleLogger.php") {
569
 
570
  // SimpleLogger is already loaded
571
 
572
  } else {
573
 
574
+ include_once $oneLoggerFile;
575
 
576
  }
577
 
588
  */
589
  $arrLoggersToInstantiate = apply_filters("simple_history/loggers_to_instantiate", $arrLoggersToInstantiate);
590
  // Instantiate each logger
591
+ foreach ($arrLoggersToInstantiate as $oneLoggerName) {
592
 
593
+ if (!class_exists($oneLoggerName)) {
594
  continue;
595
  }
596
 
597
  $loggerInstance = new $oneLoggerName($this);
598
 
599
+ if (!is_subclass_of($loggerInstance, "SimpleLogger") && !is_a($loggerInstance, "SimpleLogger")) {
600
  continue;
601
  }
602
 
615
  // LoggerInfo contains all messages, both translated an not, by key.
616
  // Add messages to the loggerInstance
617
  $loopNum = 0;
618
+ foreach ($loggerInfo["messages"] as $message_key => $message) {
619
 
620
+ $loggerInstance->messages[$message_key] = $loggerInstance->messages[$loopNum];
621
  $loopNum++;
622
 
623
  }
624
 
625
  // Remove index keys, only keeping slug keys
626
  if (is_array($loggerInstance->messages)) {
627
+ foreach ($loggerInstance->messages as $key => $val) {
628
+ if (is_int($key)) {
629
+ unset($loggerInstance->messages[$key]);
630
  }
631
  }
632
  }
633
 
634
  // Add logger to array of loggers
635
+ $this->instantiatedLoggers[$loggerInstance->slug] = array(
636
  "name" => $loggerInfo["name"],
637
+ "instance" => $loggerInstance,
638
  );
639
 
640
  }
641
 
642
+ do_action("simple_history/loggers_loaded");
643
 
644
  #sf_d($this->instantiatedLoggers);exit;
645
 
662
  */
663
  $dropinsDir = apply_filters("simple_history/dropins_dir", $dropinsDir);
664
 
665
+ $dropinsFiles = glob($dropinsDir . "*.php");
666
 
667
  /**
668
  * Filter the array with absolute paths to files as returned by glob function.
677
 
678
  $arrDropinsToInstantiate = array();
679
 
680
+ foreach ($dropinsFiles as $oneDropinFile) {
681
 
682
  // path/path/simplehistory/dropins/SimpleHistoryDonateDropin.php => SimpleHistoryDonateDropin
683
  $oneDropinFileBasename = basename($oneDropinFile, ".php");
691
  *
692
  * @param bool if to load the dropin. return false to not load it.
693
  */
694
+ $load_dropin = apply_filters("simple_history/dropin/load_dropin_{$oneDropinFileBasename}", true);
695
 
696
+ if (!$load_dropin) {
697
  continue;
698
  }
699
 
700
+ include_once $oneDropinFile;
701
 
702
  $arrDropinsToInstantiate[] = $oneDropinFileBasename;
703
 
713
  $arrDropinsToInstantiate = apply_filters("simple_history/dropins_to_instantiate", $arrDropinsToInstantiate);
714
 
715
  // Instantiate each dropin
716
+ foreach ($arrDropinsToInstantiate as $oneDropinName) {
717
 
718
+ if (!class_exists($oneDropinName)) {
719
  continue;
720
  }
721
 
722
  $this->instantiatedDropins[$oneDropinName] = array(
723
  "name" => $oneDropinName,
724
+ "instance" => new $oneDropinName($this),
725
  );
726
  }
727
 
750
 
751
  }
752
 
 
753
  /**
754
  * Show a link to our settings page on the Plugins -> Installed Plugins screen
755
  */
756
  function plugin_action_links($actions, $b, $c, $d) {
757
 
758
  // Only add link if user has the right to view the settings page
759
+ if (!current_user_can($this->view_settings_capability)) {
760
  return $actions;
761
  }
762
 
775
  */
776
  function add_dashboard_widget() {
777
 
778
+ if ($this->setting_show_on_dashboard() && current_user_can($this->view_history_capability)) {
779
 
780
  wp_add_dashboard_widget("simple_history_dashboard_widget", __("Simple History", 'simple-history'), array($this, "dashboard_widget_output"));
781
 
798
  */
799
  $pager_size = apply_filters("simple_history/dashboard_pager_size", $pager_size);
800
 
801
+ do_action("simple_history/dashboard/before_gui", $this);
802
 
803
  ?>
804
  <div class="SimpleHistoryGui"
805
+ data-pager-size='<?php echo $pager_size?>'
806
  ></div>
807
  <?php
808
 
812
 
813
  $current_screen = get_current_screen();
814
 
815
+ if ($current_screen && $current_screen->base == "settings_page_" . SimpleHistory::SETTINGS_MENU_SLUG) {
816
 
817
  return true;
818
 
819
+ } else if ($current_screen && $current_screen->base == "dashboard_page_simple_history_page") {
820
 
821
  return true;
822
 
823
+ } else if (($hook == "settings_page_" . SimpleHistory::SETTINGS_MENU_SLUG) || ($this->setting_show_on_dashboard() && $hook == "index.php") || ($this->setting_show_as_page() && $hook == "dashboard_page_simple_history_page")) {
824
 
825
  return true;
826
 
827
+ } else if ($current_screen && $current_screen->base == "dashboard" && $this->setting_show_on_dashboard()) {
828
 
829
  return true;
830
 
840
  */
841
  function enqueue_admin_scripts($hook) {
842
 
843
+ if ($this->is_on_our_own_pages()) {
844
 
845
  add_thickbox();
846
 
847
  $plugin_url = plugin_dir_url(__FILE__);
848
+ wp_enqueue_style("simple_history_styles", $plugin_url . "css/styles.css", false, SimpleHistory::VERSION);
849
  wp_enqueue_script("simple_history_script", $plugin_url . "js/scripts.js", array("jquery", "backbone", "wp-util"), SimpleHistory::VERSION, true);
850
 
851
  wp_enqueue_script("select2", $plugin_url . "/js/select2/select2.min.js", array("jquery"));
862
  'currentPage' => __("Current page", 'simple-history'),
863
  ),
864
  "loadLogAPIError" => __("Oups, the log could not be loaded right now.", 'simple-history'),
865
+ "logNoHits" => __("Your search did not match any history events.", "simple-history"),
866
  ));
867
 
868
  // Call plugins adminCSS-method, so they can add their CSS
869
+ foreach ($this->instantiatedLoggers as $one_logger) {
870
+ if (method_exists($one_logger["instance"], "adminCSS")) {
871
  $one_logger["instance"]->adminCSS();
872
  }
873
  }
874
 
875
  /**
876
+ * Fires when the admin scripts have been enqueued.
877
+ * Only fires on any of the pages where Simple History is used
878
+ *
879
+ * @since 2.0
880
+ *
881
+ * @param SimpleHistory $SimpleHistory This class.
882
+ */
883
  do_action("simple_history/enqueue_admin_scripts", $this);
884
 
885
  }
907
  // is a version of Simple History < 0.4
908
  // or it's a first install
909
  // Fix database not using UTF-8
910
+ if (false === $db_version) {
911
 
912
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
913
 
914
  // Table creation, used to be in register_activation_hook
915
  /*
916
  $sql = "CREATE TABLE " . $table_name . " (
917
+ id int(10) NOT NULL AUTO_INCREMENT,
918
+ date datetime NOT NULL,
919
+ action varchar(255) NOT NULL COLLATE utf8_general_ci,
920
+ object_type varchar(255) NOT NULL COLLATE utf8_general_ci,
921
+ object_subtype VARCHAR(255) NOT NULL COLLATE utf8_general_ci,
922
+ user_id int(10) NOT NULL,
923
+ object_id int(10) NOT NULL,
924
+ object_name varchar(255) NOT NULL COLLATE utf8_general_ci,
925
+ action_description longtext,
926
+ PRIMARY KEY (id)
927
  ) CHARACTER SET=utf8;";
928
  dbDelta($sql);
929
+ */
930
 
931
  // We change the varchar size to add one num just to force update of encoding. dbdelta didn't see it otherwise.
932
  // This table is missing action_description, but we add that later on
952
  $db_version_prev = $db_version;
953
  $db_version = 1;
954
 
 
 
 
 
 
 
 
 
955
  update_option("simple_history_db_version", $db_version);
956
 
957
  // We are not 100% sure that this is a first install,
958
  // but it is at least a very old version that is being updated
959
  $first_install = true;
960
 
961
+ }// done pre db ver 1 things
 
962
 
963
  // If db version is 1 then upgrade to 2
964
  // Version 2 added the action_description column
965
+ if (1 == intval($db_version)) {
966
 
967
+ // Add column for action description in non-translatable free text
968
  $sql = "ALTER TABLE {$table_name} ADD COLUMN action_description longtext";
969
  $wpdb->query($sql);
970
 
980
  $arr_options = array(
981
  array(
982
  "name" => "simple_history_show_as_page",
983
+ "default_value" => 1,
984
  ),
985
  array(
986
  "name" => "simple_history_show_on_dashboard",
987
+ "default_value" => 1,
988
+ ),
989
  );
990
 
991
  foreach ($arr_options as $one_option) {
992
 
993
+ if (false === ($option_value = get_option($one_option["name"]))) {
994
 
995
  // Value is not set in db, so set it to a default
996
+ update_option($one_option["name"], $one_option["default_value"]);
997
 
998
  }
999
  }
1005
  *
1006
  * @since 2.0
1007
  */
1008
+ if (2 == intval($db_version)) {
1009
 
1010
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
1011
 
1012
  // Update old table
1013
  $sql = "
1064
  $table_name
1065
  );
1066
 
1067
+ $wpdb->query($sql);
1068
 
1069
  // Say welcome, however loggers are not added this early so we need to
1070
  // use a filter to load it later
1071
+ add_action("simple_history/loggers_loaded", array($this, "addWelcomeLogMessage"));
1072
 
1073
+ }// db version 2 » 3
1074
 
1075
  /**
1076
  * If db version = 3
1080
  *
1081
  * @since 2.0
1082
  */
1083
+ if (3 == intval($db_version)) {
1084
 
1085
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
1086
 
1087
  $sql = sprintf('
1088
  ALTER TABLE %1$s
1095
  ',
1096
  $table_name
1097
  );
1098
+ $wpdb->query($sql);
1099
 
1100
  $db_version_prev = $db_version;
1101
  $db_version = 4;
1102
 
1103
  update_option("simple_history_db_version", $db_version);
1104
 
1105
+ }// end db version 3 » 4
 
1106
 
1107
+ }// end check_for_upgrade
1108
 
1109
  /**
1110
  * Greet users to version 2!
1115
  "Welcome to Simple History 2! Hope you will enjoy this plugin.
1116
  Found bugs? Got great ideas? Send them to the plugin developer at par.thernstrom@gmail.com.",
1117
  array(
1118
+ "_initiator" => SimpleLoggerLogInitiators::WORDPRESS,
1119
  )
1120
  );
1121
 
1146
 
1147
  <h2 class="SimpleHistoryPageHeadline">
1148
  <div class="dashicons dashicons-backup SimpleHistoryPageHeadline__icon"></div>
1149
+ <?php _e("Simple History Settings", "simple-history")?>
1150
  </h2>
1151
 
1152
  <?php
1153
+ $active_tab = isset($_GET["selected-tab"]) ? $_GET["selected-tab"] : "settings";
1154
+ $settings_base_url = menu_page_url(SimpleHistory::SETTINGS_MENU_SLUG, 0);
1155
+ ?>
1156
 
1157
  <h3 class="nav-tab-wrapper">
1158
  <?php
1159
+ foreach ($arr_settings_tabs as $one_tab) {
1160
 
1161
+ $tab_slug = $one_tab["slug"];
1162
 
1163
+ printf(
1164
+ '<a href="%3$s" class="nav-tab %4$s">%1$s</a>',
1165
+ $one_tab["name"], // 1
1166
+ $tab_slug, // 2
1167
+ add_query_arg("selected-tab", $tab_slug, $settings_base_url), // 3
1168
+ $active_tab == $tab_slug ? "nav-tab-active" : ""// 4
1169
+ );
1170
 
1171
+ }
1172
+ ?>
1173
  </h3>
1174
 
1175
  <?php
1176
 
1177
+ // Output contents for selected tab
1178
+ $arr_active_tab = wp_filter_object_list($arr_settings_tabs, array("slug" => $active_tab));
1179
+ $arr_active_tab = current($arr_active_tab);
1180
 
1181
+ // We must have found an active tab and it must have a callable function
1182
+ if (!$arr_active_tab || !is_callable($arr_active_tab["function"])) {
1183
+ wp_die(__("No valid callback found", "simple-history"));
1184
+ }
1185
 
1186
+ $args = array(
1187
+ "arr_active_tab" => $arr_active_tab,
1188
+ );
1189
 
1190
+ call_user_func_array($arr_active_tab["function"], $args);
1191
 
1192
+ ?>
1193
 
1194
  </div>
1195
  <?php
1198
 
1199
  public function settings_output_log() {
1200
 
1201
+ include __DIR__ . "/templates/settings-log.php";
1202
 
1203
  }
1204
 
1205
  public function settings_output_general() {
1206
 
1207
+ include __DIR__ . "/templates/settings-general.php";
1208
 
1209
  }
1210
 
1211
  public function settings_output_styles_example() {
1212
 
1213
+ include __DIR__ . "/templates/settings-style-example.php";
1214
 
1215
  }
1216
 
 
1217
  /**
1218
  * Content for section intro. Leave it be, even if empty.
1219
  * Called from add_sections_setting.
1222
 
1223
  }
1224
 
 
1225
  /**
1226
  * Add pages (history page and settings page)
1227
  */
1228
  function add_admin_pages() {
1229
 
1230
  // Add a history page as a sub-page below the Dashboard menu item
1231
+ if ($this->setting_show_as_page()) {
1232
 
1233
  add_dashboard_page(
1234
+ SimpleHistory::NAME,
1235
+ _x("Simple History", 'dashboard menu name', 'simple-history'),
1236
+ $this->view_history_capability,
1237
+ "simple_history_page",
1238
+ array($this, "history_page_output")
1239
+ );
1240
 
1241
  }
1242
 
1247
  if ($show_settings_page) {
1248
 
1249
  add_options_page(
1250
+ __('Simple History Settings', "simple-history"),
1251
+ SimpleHistory::NAME,
1252
+ $this->view_settings_capability,
1253
+ SimpleHistory::SETTINGS_MENU_SLUG,
1254
+ array($this, 'settings_page_output')
1255
+ );
1256
 
1257
  }
1258
 
1265
  function add_settings() {
1266
 
1267
  // Clear the log if clear button was clicked in settings
1268
+ if (isset($_GET["simple_history_clear_log_nonce"]) && wp_verify_nonce($_GET["simple_history_clear_log_nonce"], 'simple_history_clear_log')) {
1269
 
1270
  $this->clear_log();
1271
  $msg = __("Cleared database", 'simple-history');
1272
+ add_settings_error("simple_history_rss_feed_regenerate_secret", "simple_history_rss_feed_regenerate_secret", $msg, "updated");
1273
  set_transient('settings_errors', get_settings_errors(), 30);
1274
 
1275
+ $goback = add_query_arg('settings-updated', 'true', wp_get_referer());
1276
+ wp_redirect($goback);
1277
  exit;
1278
 
1279
  }
1285
  $settings_section_general_id,
1286
  "", // No title __("General", "simple-history"),
1287
  array($this, "settings_section_output"),
1288
+ SimpleHistory::SETTINGS_MENU_SLUG// same slug as for options menu page
1289
  );
1290
 
1291
  // Settings for the general settings section
1328
 
1329
  }
1330
 
 
1331
  /**
1332
  * Output for page with the history
1333
  */
1356
 
1357
  <h2 class="SimpleHistoryPageHeadline">
1358
  <div class="dashicons dashicons-backup SimpleHistoryPageHeadline__icon"></div>
1359
+ <?php echo _x("Simple History", 'history page headline', 'simple-history')?>
1360
  </h2>
1361
 
1362
  <?php
1363
+ /**
1364
+ * Fires before the gui div
1365
+ *
1366
+ * @since 2.0
1367
+ *
1368
+ * @param SimpleHistory $SimpleHistory This class.
1369
+ */
1370
+ do_action("simple_history/history_page/before_gui", $this);
1371
+ ?>
1372
 
1373
  <div class="SimpleHistoryGuiWrap">
1374
 
1375
  <div class="SimpleHistoryGui"
1376
+ data-pager-size='<?php echo $pager_size?>'
1377
  ></div>
1378
 
1379
  <?php
1380
 
1381
+ /**
1382
+ * Fires after the gui div
1383
+ *
1384
+ * @since 2.0
1385
+ *
1386
+ * @param SimpleHistory $SimpleHistory This class.
1387
+ */
1388
+ do_action("simple_history/history_page/after_gui", $this);
1389
 
1390
+ ?>
1391
 
1392
  </div>
1393
 
1434
 
1435
  ?>
1436
  <select name="simple_history_pager_size">
1437
+ <option <?php echo $current_pager_size == 5 ? "selected" : ""?> value="5">5</option>
1438
+ <option <?php echo $current_pager_size == 10 ? "selected" : ""?> value="10">10</option>
1439
+ <option <?php echo $current_pager_size == 15 ? "selected" : ""?> value="15">15</option>
1440
+ <option <?php echo $current_pager_size == 20 ? "selected" : ""?> value="20">20</option>
1441
+ <option <?php echo $current_pager_size == 25 ? "selected" : ""?> value="25">25</option>
1442
+ <option <?php echo $current_pager_size == 30 ? "selected" : ""?> value="30">30</option>
1443
+ <option <?php echo $current_pager_size == 40 ? "selected" : ""?> value="40">40</option>
1444
+ <option <?php echo $current_pager_size == 50 ? "selected" : ""?> value="50">50</option>
1445
+ <option <?php echo $current_pager_size == 75 ? "selected" : ""?> value="75">75</option>
1446
+ <option <?php echo $current_pager_size == 100 ? "selected" : ""?> value="100">100</option>
1447
  </select>
1448
  <?php
1449
 
1458
  $show_as_page = $this->setting_show_as_page();
1459
  ?>
1460
 
1461
+ <input <?php echo $show_on_dashboard ? "checked='checked'" : ""?> type="checkbox" value="1" name="simple_history_show_on_dashboard" id="simple_history_show_on_dashboard" class="simple_history_show_on_dashboard" />
1462
+ <label for="simple_history_show_on_dashboard"><?php _e("on the dashboard", 'simple-history')?></label>
1463
 
1464
  <br />
1465
 
1466
+ <input <?php echo $show_as_page ? "checked='checked'" : ""?> type="checkbox" value="1" name="simple_history_show_as_page" id="simple_history_show_as_page" class="simple_history_show_as_page" />
1467
+ <label for="simple_history_show_as_page"><?php _e("as a page under the dashboard menu", 'simple-history')?></label>
1468
 
1469
  <?php
1470
+ }
1471
 
1472
  /**
1473
  * Settings section to clear database
1475
  function settings_field_clear_log() {
1476
 
1477
  $clear_link = add_query_arg("", "");
1478
+ $clear_link = wp_nonce_url($clear_link, "simple_history_clear_log", "simple_history_clear_log_nonce");
1479
  $clear_days = $this->get_clear_history_interval();
1480
 
1481
  echo "<p>";
1482
+ if ($clear_days > 0) {
1483
+ echo sprintf(__('Items in the database are automatically removed after %1$s days.', "simple-history"), $clear_days);
1484
  } else {
1485
+ _e('Items in the database are kept forever.', 'simple-history');
1486
  }
1487
  echo "</p>";
1488
 
1514
  global $wpdb;
1515
 
1516
  $tableprefix = $wpdb->prefix;
1517
+
1518
  $simple_history_table = SimpleHistory::DBTABLE;
1519
  $simple_history_context_table = SimpleHistory::DBTABLE_CONTEXTS;
1520
 
1521
+ // Get number of rows before delete
1522
+ $sql_num_rows = "SELECT count(id) AS num_rows FROM {$tableprefix}{$simple_history_table}";
1523
+ $num_rows = $wpdb->get_var($sql_num_rows, 0);
1524
+
1525
  $sql = "DELETE FROM {$tableprefix}{$simple_history_table}";
1526
  $wpdb->query($sql);
1527
 
1528
  $sql = "DELETE FROM {$tableprefix}{$simple_history_context_table}";
1529
  $wpdb->query($sql);
1530
 
1531
+ // Zero state sucks
1532
+ SimpleLogger()->info(
1533
+ __("The log for Simple History was cleared ({num_rows} rows were removed).", "simple-history"),
1534
+ array(
1535
+ "num_rows" => $num_rows,
1536
+ )
1537
+ );
1538
+
1539
+ }
1540
+
1541
+ /**
1542
+ * Runs the purge_db() method sometimes
1543
+ * We don't want to call it each time because it performs SQL queries
1544
+ *
1545
+ * @since 2.0.17
1546
+ */
1547
+ function maybe_purge_db() {
1548
+
1549
+ /*if ( ! is_admin() ) {
1550
+ return;
1551
+ }*/
1552
+
1553
+ // How often should we try to do this?
1554
+ // Once a day = a bit tiresome
1555
+ // Let's go with sundays; purge the log on sundays
1556
+
1557
+ // day of week, 1 = mon, 7 = sun
1558
+ $day_of_week = date('N');
1559
+ if ( 7 === (int) $day_of_week ) {
1560
+
1561
+ $this->purge_db();
1562
+
1563
+ }
1564
+
1565
  }
1566
 
1567
  /**
1568
  * Removes old entries from the db
 
1569
  */
1570
  function purge_db() {
1571
 
1572
+ // SimpleLogger()->debug("Simple History is running purge_db()");
1573
+
1574
  $do_purge_history = true;
1575
+
1576
  $do_purge_history = apply_filters("simple_history_allow_db_purge", $do_purge_history);
1577
  $do_purge_history = apply_filters("simple_history/allow_db_purge", $do_purge_history);
1578
+
1579
+ if (!$do_purge_history) {
1580
  return;
1581
  }
1582
 
1588
  }
1589
 
1590
  global $wpdb;
 
 
1591
 
1592
+ $table_name = $wpdb->prefix . SimpleHistory::DBTABLE;
1593
+ $table_name_contexts = $wpdb->prefix . SimpleHistory::DBTABLE_CONTEXTS;
1594
 
1595
+ // Get id of rows to delete
1596
+ $sql = "SELECT id FROM {$table_name} WHERE DATE_ADD(date, INTERVAL $days DAY) < now()";
1597
+
1598
+ $ids_to_delete = $wpdb->get_col($sql);
1599
+
1600
+ if (empty($ids_to_delete)) {
1601
+ // Nothing to delete
1602
+ return;
1603
+ }
1604
+
1605
+ $sql_ids_in = implode(",", $ids_to_delete);
1606
+
1607
+ // Add number of deleted rows to total_rows option
1608
+ $prev_total_rows = (int) get_option("simple_history_total_rows", 0);
1609
+ $total_rows = $prev_total_rows + sizeof($ids_to_delete);
1610
+ update_option("simple_history_total_rows", $total_rows);
1611
+
1612
+ // Remove rows + contexts
1613
+ $sql_delete_history = "DELETE FROM {$table_name} WHERE id IN ($sql_ids_in)";
1614
+ $sql_delete_history_context = "DELETE FROM {$table_name_contexts} WHERE history_id IN ($sql_ids_in)";
1615
+
1616
+ $wpdb->query($sql_delete_history);
1617
+ $wpdb->query($sql_delete_history_context);
1618
+
1619
+ $message = _nx(
1620
+ "Simple History removed one event that were older than {days} days",
1621
+ "Simple History removed {num_rows} events that were older than {days} days",
1622
+ "Database is being cleared automagically",
1623
+ "simple-history"
1624
+ );
1625
+
1626
+ SimpleLogger()->info(
1627
+ $message,
1628
+ array(
1629
+ "days" => $days,
1630
+ "num_rows" => sizeof($ids_to_delete),
1631
+ )
1632
+ );
1633
 
1634
  }
1635
 
1645
 
1646
  $row_logger = $row->logger;
1647
  $logger = null;
1648
+ $row->context = isset($row->context) && is_array($row->context) ? $row->context : array();
1649
 
1650
+ if (!isset($row->context["_message_key"])) {
1651
  $row->context["_message_key"] = null;
1652
  }
1653
 
1654
  // Fallback to SimpleLogger if no logger exists for row
1655
+ if (!isset($this->instantiatedLoggers[$row_logger])) {
1656
  $row_logger = "SimpleLogger";
1657
  }
1658
 
1659
+ $logger = $this->instantiatedLoggers[$row_logger]["instance"];
1660
 
1661
+ return $logger->getLogRowPlainTextOutput($row);
1662
 
1663
  }
1664
 
1677
 
1678
  $row_logger = $row->logger;
1679
  $logger = null;
1680
+ $row->context = isset($row->context) && is_array($row->context) ? $row->context : array();
1681
 
1682
  // Fallback to SimpleLogger if no logger exists for row
1683
+ if (!isset($this->instantiatedLoggers[$row_logger])) {
1684
  $row_logger = "SimpleLogger";
1685
  }
1686
 
1687
  $logger = $this->instantiatedLoggers[$row_logger]["instance"];
1688
 
1689
+ return $logger->getLogRowHeaderOutput($row);
1690
 
1691
  }
1692
 
1700
 
1701
  $row_logger = $row->logger;
1702
  $logger = null;
1703
+ $row->context = isset($row->context) && is_array($row->context) ? $row->context : array();
1704
 
1705
  // Fallback to SimpleLogger if no logger exists for row
1706
+ if (!isset($this->instantiatedLoggers[$row_logger])) {
1707
  $row_logger = "SimpleLogger";
1708
  }
1709
 
1710
  $logger = $this->instantiatedLoggers[$row_logger]["instance"];
1711
 
1712
+ return $logger->getLogRowSenderImageOutput($row);
1713
 
1714
  }
1715
 
1717
 
1718
  $row_logger = $row->logger;
1719
  $logger = null;
1720
+ $row->context = isset($row->context) && is_array($row->context) ? $row->context : array();
1721
 
1722
  // Fallback to SimpleLogger if no logger exists for row
1723
+ if (!isset($this->instantiatedLoggers[$row_logger])) {
1724
  $row_logger = "SimpleLogger";
1725
  }
1726
 
1727
  $logger = $this->instantiatedLoggers[$row_logger]["instance"];
1728
 
1729
+ return $logger->getLogRowDetailsOutput($row);
1730
 
1731
  }
1732
 
1738
  */
1739
  public static function json_encode($value) {
1740
 
1741
+ return version_compare(PHP_VERSION, '5.4.0') >= 0 ? json_encode($value, JSON_PRETTY_PRINT) : json_encode($value);
1742
 
1743
  }
1744
 
1747
  * @param string $haystack
1748
  * @param string $needle
1749
  */
1750
+ public static function ends_with($haystack, $needle) {
1751
+ return $needle === substr($haystack, -strlen($needle));
1752
  }
1753
 
1754
  /**
1760
  public function getLogRowHTMLOutput($oneLogRow, $args) {
1761
 
1762
  $defaults = array(
1763
+ "type" => "overview", // or "single" to include more stuff
1764
  );
1765
 
1766
+ $args = wp_parse_args($args, $defaults);
1767
 
1768
  $header_html = $this->getLogRowHeaderOutput($oneLogRow);
1769
  $plain_text_html = $this->getLogRowPlainTextOutput($oneLogRow);
1770
  $sender_image_html = $this->getLogRowSenderImageOutput($oneLogRow);
1771
 
1772
  // Details = for example thumbnail of media
1773
+ $details_html = trim($this->getLogRowDetailsOutput($oneLogRow));
1774
  if ($details_html) {
1775
 
1776
  $details_html = sprintf(
1814
  }
1815
 
1816
  $data_attrs = "";
1817
+ $data_attrs .= sprintf(' data-row-id="%1$d" ', $oneLogRow->id);
1818
+ $data_attrs .= sprintf(' data-occasions-count="%1$d" ', $occasions_count);
1819
+ $data_attrs .= sprintf(' data-occasions-id="%1$s" ', $oneLogRow->occasionsID);
1820
+ $data_attrs .= sprintf(' data-ip-address="%1$s" ', esc_attr($oneLogRow->context["_server_remote_addr"]));
1821
 
1822
  // If type is single then include more details
1823
  $more_details_html = "";
1824
+ if ($args["type"] == "single") {
1825
 
1826
  $more_details_html .= sprintf('<h2 class="SimpleHistoryLogitem__moreDetailsHeadline">%1$s</h2>', __("Context data", "simple-history"));
1827
  $more_details_html .= "<p>" . __("This is potentially useful meta data that a logger has saved.", "simple-history") . "</p>";
1838
  foreach ($oneLogRow as $rowKey => $rowVal) {
1839
 
1840
  // skip arrays and objects and such
1841
+ if (is_array($rowVal) || is_object($rowVal)) {
1842
  continue;
1843
  }
1844
 
1847
  <td>%1$s</td>
1848
  <td>%2$s</td>
1849
  </tr>',
1850
+ esc_html($rowKey),
1851
+ esc_html($rowVal)
1852
  );
1853
 
1854
  }
1860
  <td>%1$s</td>
1861
  <td>%2$s</td>
1862
  </tr>',
1863
+ esc_html($contextKey),
1864
+ esc_html($contextVal)
1865
  );
1866
 
1867
  }
1879
  $classes = array(
1880
  "SimpleHistoryLogitem",
1881
  "SimpleHistoryLogitem--loglevel-{$oneLogRow->level}",
1882
+ "SimpleHistoryLogitem--logger-{$oneLogRow->logger}",
1883
  );
1884
 
1885
+ if (isset($oneLogRow->initiator) && !empty($oneLogRow->initiator)) {
1886
  $classes[] = "SimpleHistoryLogitem--initiator-" . esc_attr($oneLogRow->initiator);
1887
  }
1888
 
1896
  $plain_text_html .= $log_level_tag_html;
1897
 
1898
  /**
1899
+ * Filter to modify classes added to item li element
1900
+ *
1901
+ * @since 2.0.7
1902
+ *
1903
+ * @param $classes Array with classes
1904
+ */
1905
  $classes = apply_filters("simple_history/logrowhtmloutput/classes", $classes);
1906
 
1907
  // Generate the HTML output for a row
1984
  break;
1985
 
1986
  case "info":
1987
+ $str_translated = _x("info", "Log level in gui", "simple-history");
1988
  break;
1989
 
1990
  case "debug":
2041
 
2042
  public function getInstantiatedLoggerBySlug($slug = "") {
2043
 
2044
+ if (empty($slug)) {
2045
  return false;
2046
  }
2047
 
2048
  foreach ($this->getInstantiatedLoggers() as $one_logger) {
2049
 
2050
+ if ($slug == $one_logger["instance"]->slug) {
2051
  return $one_logger["instance"];
2052
  }
2053
 
2069
 
2070
  $arr_loggers_user_can_view = array();
2071
 
2072
+ if (!is_numeric($user_id)) {
2073
  $user_id = get_current_user_id();
2074
  }
2075
 
2079
  $logger_capability = $one_logger["instance"]->getCapability();
2080
 
2081
  //$arr_loggers_user_can_view = apply_filters("simple_history/loggers_user_can_read", $user_id, $arr_loggers_user_can_view);
2082
+ $user_can_read_logger = user_can($user_id, $logger_capability);
2083
  $user_can_read_logger = apply_filters("simple_history/loggers_user_can_read/can_read_single_logger", $user_can_read_logger, $one_logger["instance"], $user_id);
2084
 
2085
+ if ($user_can_read_logger) {
2086
  $arr_loggers_user_can_view[] = $one_logger;
2087
  }
2088
 
2089
  }
2090
 
2091
  /**
2092
+ * Fires before Simple History does it's init stuff
2093
+ *
2094
+ * @since 2.0
2095
+ *
2096
+ * @param array $arr_loggers_user_can_view Array with loggers that user $user_id can read
2097
+ * @param int user_id ID of user to check read capability for
2098
+ */
2099
  $arr_loggers_user_can_view = apply_filters("simple_history/loggers_user_can_read", $arr_loggers_user_can_view, $user_id);
2100
 
2101
  // just return array with slugs in parenthesis suitable for sql-where
2102
+ if ("sql" == $format) {
2103
 
2104
  $str_return = "(";
2105
 
2119
 
2120
  }
2121
 
 
2122
  return $arr_loggers_user_can_view;
2123
 
2124
  }
2135
  * @param string $default URL to a default image to use if no avatar is available
2136
  * @param string $alt Alternative text to use in image tag. Defaults to blank
2137
  * @return string <img> tag for the user's avatar
2138
+ */
2139
+ function get_avatar($email, $size = '96', $default = '', $alt = false) {
2140
 
2141
+ if (false === $alt) {
2142
  $safe_alt = '';
2143
+ } else {
2144
+ $safe_alt = esc_attr($alt);
2145
+ }
2146
 
2147
+ if (!is_numeric($size)) {
2148
  $size = '96';
2149
+ }
2150
 
2151
+ if (empty($default)) {
2152
  $avatar_default = get_option('avatar_default');
2153
+ if (empty($avatar_default)) {
2154
  $default = 'mystery';
2155
+ } else {
2156
  $default = $avatar_default;
2157
+ }
2158
+
2159
  }
2160
 
2161
+ if (!empty($email)) {
2162
+ $email_hash = md5(strtolower(trim($email)));
2163
+ }
2164
 
2165
+ if (is_ssl()) {
2166
  $host = 'https://secure.gravatar.com';
2167
  } else {
2168
+ if (!empty($email)) {
2169
+ $host = sprintf("http://%d.gravatar.com", (hexdec($email_hash[0]) % 2));
2170
+ } else {
2171
  $host = 'http://0.gravatar.com';
2172
+ }
2173
+
2174
  }
2175
 
2176
+ if ('mystery' == $default) {
2177
+ $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}";
2178
+ }
2179
+ // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
2180
+ elseif ('blank' == $default) {
2181
+ $default = $email ? 'blank' : includes_url('images/blank.gif');
2182
+ } elseif (!empty($email) && 'gravatar_default' == $default) {
2183
  $default = '';
2184
+ } elseif ('gravatar_default' == $default) {
2185
  $default = "$host/avatar/?s={$size}";
2186
+ } elseif (empty($email)) {
2187
  $default = "$host/avatar/?d=$default&amp;s={$size}";
2188
+ } elseif (strpos($default, 'http://') === 0) {
2189
+ $default = add_query_arg('s', $size, $default);
2190
+ }
2191
 
2192
+ if (!empty($email)) {
2193
  $out = "$host/avatar/";
2194
  $out .= $email_hash;
2195
+ $out .= '?s=' . $size;
2196
+ $out .= '&amp;d=' . urlencode($default);
2197
 
2198
  $rating = get_option('avatar_rating');
2199
+ if (!empty($rating)) {
2200
  $out .= "&amp;r={$rating}";
2201
+ }
2202
 
2203
+ $out = str_replace('&#038;', '&amp;', esc_url($out));
2204
  $avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
2205
  } else {
2206
+ $out = esc_url($default);
2207
  $avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
2208
  }
2209
 
2222
  $logQuery = new SimpleHistoryLogQuery();
2223
  $logResults = $logQuery->query(array(
2224
  "posts_per_page" => 1,
2225
+ "date_from" => strtotime("today"),
2226
  ));
2227
 
2228
+ $total_row_count = (int) $logResults["total_row_count"];
2229
+
2230
  // Get sql query for where to read only loggers current user is allowed to read/view
2231
  $sql_loggers_in = $this->getLoggersThatUserCanRead(get_current_user_id(), "sql");
2232
 
2250
  );
2251
 
2252
  $results_users_today = $wpdb->get_results($sql_users_today);
2253
+ $count_users_today = sizeof($results_users_today);
2254
 
2255
  // Get number of other sources (not wp_user)
2256
  $sql_other_sources_where = sprintf(
2283
  // sf_d($sql_other_sources, '$sql_other_sources');
2284
 
2285
  $results_other_sources_today = $wpdb->get_results($sql_other_sources);
2286
+ $count_other_sources = sizeof($results_other_sources_today);
2287
 
2288
  #sf_d($logResults, '$logResults');
2289
  #sf_d($results_users_today, '$sql_users_today');
2294
  <p>
2295
  <?php
2296
 
2297
+ $msg_tmpl = "";
2298
 
2299
+ // No results today at all
2300
+ if ($total_row_count == 0) {
2301
 
2302
+ $msg_tmpl = __("No events today so far.", "simple-history");
2303
 
2304
+ } else {
2305
 
2306
+ /*
2307
+ Type of results
2308
+ x1 event today from 1 user.
2309
+ x1 event today from 1 source.
2310
+ 3 events today from 1 user.
2311
+ x2 events today from 2 users.
2312
+ x2 events today from 1 user and 1 other source.
2313
+ x3 events today from 2 users and 1 other source.
2314
+ x3 events today from 1 user and 2 other sources.
2315
+ x4 events today from 2 users and 2 other sources.
2316
+ */
 
 
 
 
 
2317
 
2318
+ // A single event existed and was from a user
2319
+ // 1 event today from 1 user.
2320
+ if ($total_row_count == 1 && $count_users_today == 1) {
2321
+ $msg_tmpl .= __('One event today from one user.', "simple-history");
2322
+ }
2323
 
2324
+ // A single event existed and was from another source
2325
+ // 1 event today from 1 source.
2326
+ if ($total_row_count == 1 && !$count_users_today) {
2327
+ $msg_tmpl .= __('One event today from one source.', "simple-history");
2328
+ }
2329
 
2330
+ // Multiple events from a single user
2331
+ // 3 events today from one user.
2332
+ if ($total_row_count > 1 && $count_users_today == 1 && !$count_other_sources) {
2333
+ $msg_tmpl .= __('%1$d events today from one user.', "simple-history");
2334
+ }
2335
 
2336
+ // Multiple events from only users
2337
+ // 2 events today from 2 users.
2338
+ if ($total_row_count > 1 && $count_users_today == $total_row_count) {
2339
+ $msg_tmpl .= __('%1$d events today from %2$d users.', "simple-history");
2340
+ }
2341
 
2342
+ // Multiple events from 1 single user and 1 single other source
2343
+ // 2 events today from 1 user and 1 other source.
2344
+ if ($total_row_count && 1 == $count_users_today && 1 == $count_other_sources) {
2345
+ $msg_tmpl .= __('%1$d events today from one user and one other source.', "simple-history");
2346
+ }
2347
 
2348
+ // Multiple events from multple users but from only 1 single other source
2349
+ // 3 events today from 2 users and 1 other source.
2350
+ if ($total_row_count > 1 && $count_users_today > 1 && $count_other_sources == 1) {
2351
+ $msg_tmpl .= __('%1$d events today from one user and one other source.', "simple-history");
2352
+ }
2353
 
2354
+ // Multiple events from 1 user but from multiple other source
2355
+ // 3 events today from 1 user and 2 other sources.
2356
+ if ($total_row_count > 1 && 1 == $count_users_today && $count_other_sources > 1) {
2357
+ $msg_tmpl .= __('%1$d events today from one user and %3$d other sources.', "simple-history");
2358
+ }
2359
+
2360
+ // Multiple events from multiple user and from multiple other sources
2361
+ // 4 events today from 2 users and 2 other sources.
2362
+ if ($total_row_count > 1 && $count_users_today > 1 && $count_other_sources > 1) {
2363
+ $msg_tmpl .= __('%1$s events today from %2$d users and %3$d other sources.', "simple-history");
2364
+ }
2365
 
2366
+ }
 
2367
 
2368
+ /*
2369
+ if ( $logResults["total_row_count"] == 0 ) {
2370
 
2371
+ $msg_tmpl = __("No events today so far.", "simple-history");
2372
 
2373
+ } elseif ( $logResults["total_row_count"] == 1 ) {
2374
 
2375
+ $msg_tmpl = __('%1$d event today from one user.', "simple-history");
2376
 
2377
+ } elseif ( $logResults["total_row_count"] > 0 && sizeof( $results_users_today ) > 1 ) {
2378
 
2379
+ $msg_tmpl = __('%1$d events today from %2$d users.', "simple-history");
2380
 
2381
+ } elseif ( $logResults["total_row_count"] > 0 && sizeof( $results_users_today ) == 1 ) {
2382
 
2383
+ $msg_tmpl = __('%1$d events today from one user.', "simple-history");
2384
+
2385
+ }
2386
+ */
2387
 
2388
+ // only show stats if we have something to output
2389
+ if ($msg_tmpl) {
2390
 
2391
+ printf(
2392
+ $msg_tmpl,
2393
+ $logResults["total_row_count"], // 1
2394
+ $count_users_today, // 2
2395
+ $count_other_sources // 3
2396
+ );
2397
 
2398
+ // Space between texts
2399
+ /*
2400
+ echo " ";
2401
 
2402
+ // http://playground-root.ep/wp-admin/options-general.php?page=simple_history_settings_menu_slug&selected-tab=stats
2403
+ printf(
2404
+ '<a href="%1$s">View more stats</a>.',
2405
+ add_query_arg("selected-tab", "stats", menu_page_url(SimpleHistory::SETTINGS_MENU_SLUG, 0))
2406
+ );
2407
+ */
2408
 
2409
+ }
2410
 
2411
+ ?>
2412
  </p>
2413
  </div>
2414
  <?php
2415
 
2416
  }
2417
 
2418
+ }// class
css/styles.css CHANGED
@@ -11,7 +11,7 @@ The spinner that wp uses:;
11
  .SimpleHistory__cf:after { clear:both; }
12
  .SimpleHistory__cf { zoom:1; } /* For IE 6/7 (trigger hasLayout) */
13
 
14
- .SimpleHistoryGui,
15
  .SimpleHistoryGuiExample {
16
  position: relative;
17
  /* must have a height so "loading..." will be visible in dashboard */
@@ -37,7 +37,7 @@ The spinner that wp uses:;
37
  transition: opacity .1s ease-out;
38
  }
39
 
40
- /* on it's own page */
41
  /*.dashboard_page_simple_history_page .SimpleHistoryLogitemsWrap {*/
42
  .dashboard_page_simple_history_page .SimpleHistoryGuiWrap {
43
  /*float: left;*/
@@ -56,6 +56,8 @@ The spinner that wp uses:;
56
  float: left;background: tran
57
  }
58
 
 
 
59
  /*
60
  .SimpleHistoryGui:after {
61
  content: "\f206";
@@ -72,20 +74,6 @@ The spinner that wp uses:;
72
  }
73
  */
74
 
75
- .SimpleHistory__filters {
76
- float: right;
77
- width: 300px;
78
- margin-right: -340px;
79
- /* hide by default while log is loading */
80
- opacity: 0;
81
- transition: all .25s ease-out;
82
- }
83
-
84
- .SimpleHistory--isLoaded .SimpleHistory__filters {
85
- opacity: 1;
86
- }
87
-
88
-
89
  .SimpleHistoryLogitems {
90
  margin: 0;
91
  background: #fff;
@@ -103,7 +91,7 @@ The spinner that wp uses:;
103
 
104
  /**
105
  * Log items
106
- * There is always a 4px left border, just with differents colors
107
  */
108
  .SimpleHistoryLogitem {
109
  position: relative;
@@ -111,7 +99,7 @@ The spinner that wp uses:;
111
  margin: 0;
112
  padding: 20px 20px 20px 16px;
113
  /*border-bottom: 1px solid rgb(229, 229, 229);*/
114
-
115
  /* uncomment to show border with log color */
116
  /*border-left: 4px solid transparent;*/
117
 
@@ -307,7 +295,7 @@ Style different log levels.
307
 
308
  /* table with keys and values */
309
  /*.SimpleHistoryLogitem__keyValueTable {
310
-
311
  }*/
312
 
313
  .SimpleHistoryLogitem__keyValueTable th,
@@ -469,7 +457,7 @@ when occasions are added
469
 
470
 
471
  /*
472
- customizations for the dashboard
473
  i.e. the log is inside a .postbox element
474
  */
475
 
@@ -524,12 +512,19 @@ i.e. the log is inside a .postbox element
524
  margin-bottom: 0;
525
  }
526
 
527
- .postbox .SimpleHistoryLogitem__text,
528
- .postbox .SimpleHistoryLogitem__details,
529
  .postbox .SimpleHistoryLogitem__details p {
530
  line-height: 1.1;
531
  }
532
 
 
 
 
 
 
 
 
533
  /*
534
  .postbox .SimpleHistoryLogitem__details {
535
  display: none;
@@ -660,6 +655,7 @@ Modal window with detailss
660
  .folded .SimpleHistory-modal__content {
661
  left: 156px /* admin meny width is 160 px*/
662
  }
 
663
  @media only screen and (max-width: 900px) {
664
  .SimpleHistory-modal__content {
665
  left: 156px /* admin meny width is 160 px*/
@@ -821,3 +817,7 @@ Modal window with detailss
821
  display: block;
822
  }
823
 
 
 
 
 
11
  .SimpleHistory__cf:after { clear:both; }
12
  .SimpleHistory__cf { zoom:1; } /* For IE 6/7 (trigger hasLayout) */
13
 
14
+ .SimpleHistoryGui,
15
  .SimpleHistoryGuiExample {
16
  position: relative;
17
  /* must have a height so "loading..." will be visible in dashboard */
37
  transition: opacity .1s ease-out;
38
  }
39
 
40
+ /* on its own page */
41
  /*.dashboard_page_simple_history_page .SimpleHistoryLogitemsWrap {*/
42
  .dashboard_page_simple_history_page .SimpleHistoryGuiWrap {
43
  /*float: left;*/
56
  float: left;background: tran
57
  }
58
 
59
+
60
+
61
  /*
62
  .SimpleHistoryGui:after {
63
  content: "\f206";
74
  }
75
  */
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  .SimpleHistoryLogitems {
78
  margin: 0;
79
  background: #fff;
91
 
92
  /**
93
  * Log items
94
+ * There is always a 4px left border, just with differents colors
95
  */
96
  .SimpleHistoryLogitem {
97
  position: relative;
99
  margin: 0;
100
  padding: 20px 20px 20px 16px;
101
  /*border-bottom: 1px solid rgb(229, 229, 229);*/
102
+
103
  /* uncomment to show border with log color */
104
  /*border-left: 4px solid transparent;*/
105
 
295
 
296
  /* table with keys and values */
297
  /*.SimpleHistoryLogitem__keyValueTable {
298
+
299
  }*/
300
 
301
  .SimpleHistoryLogitem__keyValueTable th,
457
 
458
 
459
  /*
460
+ customizations for the dashboard
461
  i.e. the log is inside a .postbox element
462
  */
463
 
512
  margin-bottom: 0;
513
  }
514
 
515
+ .postbox .SimpleHistoryLogitem__text,
516
+ .postbox .SimpleHistoryLogitem__details,
517
  .postbox .SimpleHistoryLogitem__details p {
518
  line-height: 1.1;
519
  }
520
 
521
+ .postbox .SimpleHistoryPaginationLink,
522
+ .postbox .SimpleHistoryPaginationCurrentPage {
523
+ font-size: 13px;
524
+ line-height: 19px;
525
+ height: 24px;
526
+ }
527
+
528
  /*
529
  .postbox .SimpleHistoryLogitem__details {
530
  display: none;
655
  .folded .SimpleHistory-modal__content {
656
  left: 156px /* admin meny width is 160 px*/
657
  }
658
+
659
  @media only screen and (max-width: 900px) {
660
  .SimpleHistory-modal__content {
661
  left: 156px /* admin meny width is 160 px*/
817
  display: block;
818
  }
819
 
820
+ .postbox .SimpleHistory--hasNoHits .SimpleHistoryLogitems__noHits {
821
+ margin-left: 13px;
822
+ margin-right: 13px;
823
+ }
dropins/SimpleHistoryFilterDropin.css CHANGED
@@ -1,22 +1,32 @@
1
 
2
- .SimpleHistory__filters {
3
 
4
- float: right;
 
5
  width: 300px;
6
  margin-right: -340px;
7
-
8
  /* hide by default while log is loading */
9
- opacity: 0;
 
 
10
 
 
 
11
  }
12
 
13
  .SimpleHistory__filters__form select {
14
- width: 100%;
 
15
  }
16
 
17
  .SimpleHistory__filters__form input[type=text],
18
  .SimpleHistory__filters__form input[type=search] {
19
- width: 100%;
 
 
 
 
 
20
  }
21
 
22
  /**
@@ -41,3 +51,48 @@
41
  .SimpleHistory__filters__userfilter__gravatar {
42
  margin-right: 10px;
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
 
2
 
3
+ .SimpleHistory__filters {
4
+ /*float: right;
5
  width: 300px;
6
  margin-right: -340px;
7
+ */
8
  /* hide by default while log is loading */
9
+ opacity: .5;
10
+ transition: all .25s ease-out;
11
+ }
12
 
13
+ .SimpleHistory--isLoaded .SimpleHistory__filters {
14
+ opacity: 1;
15
  }
16
 
17
  .SimpleHistory__filters__form select {
18
+ /* width: 100%; */
19
+ width: 310px;
20
  }
21
 
22
  .SimpleHistory__filters__form input[type=text],
23
  .SimpleHistory__filters__form input[type=search] {
24
+ /* width: 100%; */
25
+ /* width: 310px; */
26
+ }
27
+
28
+ .SimpleHistory__filters__filter--date {
29
+ width: 310px;
30
  }
31
 
32
  /**
51
  .SimpleHistory__filters__userfilter__gravatar {
52
  margin-right: 10px;
53
  }
54
+
55
+ .SimpleHistoryFilterDropin-showMoreFilters {
56
+ border: 0;
57
+ background: none;
58
+ color: rgb(0, 116, 162);
59
+ cursor: pointer;
60
+ }
61
+
62
+ .SimpleHistoryFilterDropin-showMoreFilters:hover {
63
+ color: rgb(46, 162, 204);
64
+ }
65
+
66
+ /* more filters are hidden by default */
67
+ .SimpleHistory__filters__moreFilters {
68
+ display: none;
69
+ margin-bottom: 20px;
70
+ }
71
+
72
+ /* when showing more filters */
73
+ .SimpleHistory__filters.is-showingMoreFilters {
74
+
75
+ }
76
+
77
+ .SimpleHistory__filters.is-showingMoreFilters .SimpleHistoryFilterDropin-searchInput {
78
+ width: 310px;
79
+ }
80
+
81
+ .SimpleHistory__filters.is-showingMoreFilters .SimpleHistoryFilterDropin-showMoreFilters--first {
82
+ display: none;
83
+ }
84
+
85
+ .SimpleHistory__filters.is-showingMoreFilters .SimpleHistory__filters__moreFilters {
86
+ display: block;
87
+ }
88
+
89
+ .SimpleHistory__filters.is-showingMoreFilters .SimpleHistoryFilterDropin-doFilterButton--first {
90
+ display: none;
91
+ }
92
+
93
+
94
+ /* dashboard */
95
+ .postbox .SimpleHistory__filters {
96
+ margin-left: 13px;
97
+ margin-right: 13px;
98
+ }
dropins/SimpleHistoryFilterDropin.js CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- *
3
  */
4
 
5
  var SimpleHistoryFilterDropin = (function($) {
@@ -20,7 +20,9 @@ var SimpleHistoryFilterDropin = (function($) {
20
  $elms.filter_user = $elms.filter_container.find(".SimpleHistory__filters__filter--user");
21
  $elms.filter_button = $elms.filter_container.find(".js-SimpleHistoryFilterDropin-doFilter");
22
  $elms.filter_form = $elms.filter_container.find(".js-SimpleHistory__filters__form");
23
-
 
 
24
  enhanceSelects();
25
  addListeners();
26
 
@@ -29,13 +31,21 @@ var SimpleHistoryFilterDropin = (function($) {
29
  function addListeners() {
30
 
31
  $elms.filter_form.on("submit", onSubmitForm);
 
32
 
33
  }
34
 
35
- function onSubmitForm(e) {
36
 
 
 
 
 
 
 
 
37
  e.preventDefault();
38
-
39
  // form serialize
40
  // search=apa&loglevels=critical&loglevels=alert&loggers=SimpleMediaLogger&loggers=SimpleMenuLogger&user=1&months=2014-09 SimpleHistoryFilterDropin.js?ver=2.0:40
41
  var $search = $elms.filter_form.find("[name='search']");
@@ -47,12 +57,12 @@ var SimpleHistoryFilterDropin = (function($) {
47
  // If any of our search boxes are filled in we consider ourself to be in search mode
48
  isFilteringActive = false;
49
  activeFilters = {};
50
-
51
  if ( $.trim( $search.val() )) {
52
  isFilteringActive = true;
53
  activeFilters.search = $search.val();
54
  }
55
-
56
  if ( $loglevels.val() && $loglevels.val().length ) {
57
  isFilteringActive = true;
58
  activeFilters.loglevels = $loglevels.val();
@@ -99,7 +109,7 @@ var SimpleHistoryFilterDropin = (function($) {
99
  function modifyNewRowsNotifierApiArgs(e, apiArgs) {
100
 
101
  if (isFilteringActive) {
102
-
103
  apiArgs = _.extend(apiArgs, activeFilters);
104
 
105
  }
@@ -108,12 +118,12 @@ var SimpleHistoryFilterDropin = (function($) {
108
 
109
  function modifyFetchData(collection, url_data) {
110
 
111
- if (isFilteringActive) {
112
 
113
  url_data = _.extend(url_data, activeFilters);
114
 
115
  }
116
-
117
  }
118
 
119
  function enhanceSelects() {
@@ -147,7 +157,7 @@ var SimpleHistoryFilterDropin = (function($) {
147
  });
148
 
149
  $(".SimpleHistory__filters__filter--date").select2({
150
- width: "element"
151
  });
152
 
153
  $(".SimpleHistory__filters__filter--loglevel").select2({
@@ -159,7 +169,7 @@ var SimpleHistoryFilterDropin = (function($) {
159
  }
160
 
161
  function formatUsers(userdata) {
162
-
163
  var html = "";
164
  html += "<div class='SimpleHistory__filters__userfilter__gravatar'>";
165
  html += userdata.gravatar;
@@ -175,11 +185,11 @@ var SimpleHistoryFilterDropin = (function($) {
175
  }
176
 
177
  function formatLoglevel(loglevel) {
178
-
179
  var originalOption = loglevel.element;
180
  var $originalOption = $(originalOption);
181
  var color = $originalOption.data("color");
182
-
183
  var html = "<span style=\"border-radius: 50%; border: 1px solid rgba(0,0,0,.1); margin-right: 5px; width: .75em; height: .75em; line-height: 1; display: inline-block; background-color: " + $originalOption.data('color') + "; '\"></span>" + loglevel.text;
184
  return html;
185
 
@@ -197,4 +207,3 @@ SimpleHistoryFilterDropin.init();
197
  jQuery(document).ready(function() {
198
  SimpleHistoryFilterDropin.onDomReadyInit();
199
  });
200
-
1
  /**
2
+ *
3
  */
4
 
5
  var SimpleHistoryFilterDropin = (function($) {
20
  $elms.filter_user = $elms.filter_container.find(".SimpleHistory__filters__filter--user");
21
  $elms.filter_button = $elms.filter_container.find(".js-SimpleHistoryFilterDropin-doFilter");
22
  $elms.filter_form = $elms.filter_container.find(".js-SimpleHistory__filters__form");
23
+ $elms.show_more_filters_button = $elms.filter_container.find(".js-SimpleHistoryFilterDropin-showMoreFilters");
24
+ $elms.more_filters_container = $elms.filter_container.find(".js-SimpleHistory__filters__moreFilters");
25
+
26
  enhanceSelects();
27
  addListeners();
28
 
31
  function addListeners() {
32
 
33
  $elms.filter_form.on("submit", onSubmitForm);
34
+ $elms.show_more_filters_button.on("click", onClickMoreFilters);
35
 
36
  }
37
 
38
+ function onClickMoreFilters() {
39
 
40
+ //$elms.more_filters_container.toggleClass("is-visible");
41
+ $elms.filter_container.toggleClass("is-showingMoreFilters");
42
+
43
+ }
44
+
45
+ function onSubmitForm(e) {
46
+
47
  e.preventDefault();
48
+
49
  // form serialize
50
  // search=apa&loglevels=critical&loglevels=alert&loggers=SimpleMediaLogger&loggers=SimpleMenuLogger&user=1&months=2014-09 SimpleHistoryFilterDropin.js?ver=2.0:40
51
  var $search = $elms.filter_form.find("[name='search']");
57
  // If any of our search boxes are filled in we consider ourself to be in search mode
58
  isFilteringActive = false;
59
  activeFilters = {};
60
+
61
  if ( $.trim( $search.val() )) {
62
  isFilteringActive = true;
63
  activeFilters.search = $search.val();
64
  }
65
+
66
  if ( $loglevels.val() && $loglevels.val().length ) {
67
  isFilteringActive = true;
68
  activeFilters.loglevels = $loglevels.val();
109
  function modifyNewRowsNotifierApiArgs(e, apiArgs) {
110
 
111
  if (isFilteringActive) {
112
+
113
  apiArgs = _.extend(apiArgs, activeFilters);
114
 
115
  }
118
 
119
  function modifyFetchData(collection, url_data) {
120
 
121
+ if (isFilteringActive) {
122
 
123
  url_data = _.extend(url_data, activeFilters);
124
 
125
  }
126
+
127
  }
128
 
129
  function enhanceSelects() {
157
  });
158
 
159
  $(".SimpleHistory__filters__filter--date").select2({
160
+ //width: "element"
161
  });
162
 
163
  $(".SimpleHistory__filters__filter--loglevel").select2({
169
  }
170
 
171
  function formatUsers(userdata) {
172
+
173
  var html = "";
174
  html += "<div class='SimpleHistory__filters__userfilter__gravatar'>";
175
  html += userdata.gravatar;
185
  }
186
 
187
  function formatLoglevel(loglevel) {
188
+
189
  var originalOption = loglevel.element;
190
  var $originalOption = $(originalOption);
191
  var color = $originalOption.data("color");
192
+
193
  var html = "<span style=\"border-radius: 50%; border: 1px solid rgba(0,0,0,.1); margin-right: 5px; width: .75em; height: .75em; line-height: 1; display: inline-block; background-color: " + $originalOption.data('color') + "; '\"></span>" + loglevel.text;
194
  return html;
195
 
207
  jQuery(document).ready(function() {
208
  SimpleHistoryFilterDropin.onDomReadyInit();
209
  });
 
dropins/SimpleHistoryFilterDropin.php CHANGED
@@ -16,7 +16,8 @@ class SimpleHistoryFilterDropin {
16
  $this->sh = $sh;
17
 
18
  add_action("simple_history/enqueue_admin_scripts", array($this, "enqueue_admin_scripts"));
19
- add_action("simple_history/history_page/after_gui", array( $this, "gui_page_filters") );
 
20
  add_action("wp_ajax_simple_history_filters_search_user", array( $this, "ajax_simple_history_filters_search_user") );
21
 
22
  }
@@ -40,118 +41,133 @@ class SimpleHistoryFilterDropin {
40
 
41
  <form class="SimpleHistory__filters__form js-SimpleHistory__filters__form">
42
 
43
- <h3><?php _e("Filter history", "simple-history") ?></h3>
44
 
45
  <p>
46
- <input type="search" placeholder="<?php _e("Search", "simple-history"); ?>" name="search">
 
 
 
47
  </p>
48
 
49
- <p>
50
- <select name="loglevels" class="SimpleHistory__filters__filter SimpleHistory__filters__filter--loglevel" style="width: 300px" placeholder="<?php _e("All log levels", "simple-history") ?>" multiple>
51
- <option value="debug" data-color="#CEF6D8"><?php echo $this->sh->getLogLevelTranslated("Debug") ?></option>
52
- <option value="info" data-color="white"><?php echo $this->sh->getLogLevelTranslated("Info") ?></option>
53
- <option value="notice" data-color="rgb(219, 219, 183)"><?php echo $this->sh->getLogLevelTranslated("Notice") ?></option>
54
- <option value="warning" data-color="#F7D358"><?php echo $this->sh->getLogLevelTranslated("Warning") ?></option>
55
- <option value="error" data-color="#F79F81"><?php echo $this->sh->getLogLevelTranslated("Error") ?></option>
56
- <option value="critical" data-color="#FA5858"><?php echo $this->sh->getLogLevelTranslated("Critical") ?></option>
57
- <option value="alert" data-color="rgb(199, 69, 69)"><?php echo $this->sh->getLogLevelTranslated("Alert") ?></option>
58
- <option value="emergency" data-color="#DF0101"><?php echo $this->sh->getLogLevelTranslated("Emergency") ?></option>
59
- </select>
60
- </p>
61
-
62
- <p>
63
- <select name="messages" class="SimpleHistory__filters__filter SimpleHistory__filters__filter--logger" style="width: 300px"
64
- placeholder="<?php _e("All messages", "simple-history") ?>" multiple>
65
- <?php
66
- foreach ($loggers_user_can_read as $logger) {
67
-
68
- $logger_info = $logger["instance"]->getInfo();
69
- $logger_slug = $logger["instance"]->slug;
70
-
71
- // Get labels for logger
72
- if ( isset( $logger_info["labels"]["search"] ) ) {
73
-
74
- printf('<optgroup label="%1$s">', esc_attr( $logger_info["labels"]["search"]["label"] ) );
75
-
76
- // If all activity
77
- if ( ! empty( $logger_info["labels"]["search"]["label_all"] ) ) {
78
-
79
- $arr_all_search_messages = array();
80
- foreach ( $logger_info["labels"]["search"]["options"] as $option_key => $option_messages ) {
81
- $arr_all_search_messages = array_merge($arr_all_search_messages, $option_messages);
82
- }
 
 
 
 
 
 
 
 
83
 
84
- foreach ($arr_all_search_messages as $key => $val) {
85
- $arr_all_search_messages[ $key ] = $logger_slug . ":" . $val;
86
  }
87
 
88
- printf('<option value="%2$s">%1$s</option>', esc_attr( $logger_info["labels"]["search"]["label_all"] ), esc_attr( implode(",", $arr_all_search_messages) ));
 
89
 
90
- }
 
 
91
 
92
- // For each specific search option
93
- foreach ( $logger_info["labels"]["search"]["options"] as $option_key => $option_messages ) {
94
 
95
- foreach ($option_messages as $key => $val) {
96
- $option_messages[ $key ] = $logger_slug . ":" . $val;
97
  }
98
 
99
- $str_option_messages = implode(",", $option_messages);
100
- printf('<option value="%2$s">%1$s</option>', esc_attr( $option_key ), esc_attr( $str_option_messages ));
101
 
102
  }
103
 
104
- printf('</optgroup>');
105
-
106
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
- }
109
- ?>
110
- </select>
111
- </p>
112
 
113
- <p>
114
- <input type="text"
115
- name = "user"
116
- class="SimpleHistory__filters__filter SimpleHistory__filters__filter--user"
117
- style="width: 300px"
118
- placeholder="<?php _e("All users", "simple-history") ?>" />
119
- </p>
120
 
121
- <?php
122
- global $wpdb;
123
- $table_name = $wpdb->prefix . SimpleHistory::DBTABLE;
124
- $loggers_user_can_read_sql_in = $this->sh->getLoggersThatUserCanRead(null, "sql");
125
- $sql_dates = sprintf('
126
- SELECT DISTINCT ( date_format(DATE, "%%Y-%%m") ) AS yearMonth
127
- FROM %s
128
- WHERE logger IN %s
129
- ORDER BY yearMonth DESC
130
- ', $table_name, // 1
131
- $loggers_user_can_read_sql_in // 2
132
- );
133
-
134
- $result_months = $wpdb->get_results($sql_dates);
135
- ?>
136
- <p>
137
- <select class="SimpleHistory__filters__filter SimpleHistory__filters__filter--date"
138
- name="months"
139
- placeholder="<?php echo _e("All dates", "simple-history") ?>" multiple>
140
- <?php
141
- foreach ($result_months as $row) {
142
- printf(
143
- '<option value="%1$s">%2$s</option>',
144
- $row->yearMonth,
145
- date_i18n( "F Y", strtotime($row->yearMonth) )
146
- );
147
- }
148
- ?>
149
- </select>
150
- </p>
151
 
 
152
  <p>
153
- <button class="button js-SimpleHistoryFilterDropin-doFilter"><?php _e("Filter", "simple-history") ?></button>
154
  </p>
 
155
 
156
  </form>
157
 
16
  $this->sh = $sh;
17
 
18
  add_action("simple_history/enqueue_admin_scripts", array($this, "enqueue_admin_scripts"));
19
+ add_action("simple_history/history_page/before_gui", array( $this, "gui_page_filters") );
20
+ add_action("simple_history/dashboard/before_gui", array( $this, "gui_page_filters") );
21
  add_action("wp_ajax_simple_history_filters_search_user", array( $this, "ajax_simple_history_filters_search_user") );
22
 
23
  }
41
 
42
  <form class="SimpleHistory__filters__form js-SimpleHistory__filters__form">
43
 
44
+ <!-- <h3><?php _e("Filter history", "simple-history") ?></h3> -->
45
 
46
  <p>
47
+ <input type="search" class="SimpleHistoryFilterDropin-searchInput" placeholder="<?php _e("", "simple-history"); ?>" name="search">
48
+ <button class="button SimpleHistoryFilterDropin-doFilterButton SimpleHistoryFilterDropin-doFilterButton--first js-SimpleHistoryFilterDropin-doFilter"><?php _e("Search events", "simple-history") ?></button>
49
+ <!-- <br> -->
50
+ <button type="button" class="SimpleHistoryFilterDropin-showMoreFilters SimpleHistoryFilterDropin-showMoreFilters--first js-SimpleHistoryFilterDropin-showMoreFilters"><?php _ex("Show options", "Filter dropin: button to show more search options", "simple-history") ?></button>
51
  </p>
52
 
53
+ <div class="SimpleHistory__filters__moreFilters js-SimpleHistory__filters__moreFilters">
54
+
55
+ <p>
56
+ <select name="loglevels" class="SimpleHistory__filters__filter SimpleHistory__filters__filter--loglevel" style="width: 300px" placeholder="<?php _e("All log levels", "simple-history") ?>" multiple>
57
+ <option value="debug" data-color="#CEF6D8"><?php echo $this->sh->getLogLevelTranslated("Debug") ?></option>
58
+ <option value="info" data-color="white"><?php echo $this->sh->getLogLevelTranslated("Info") ?></option>
59
+ <option value="notice" data-color="rgb(219, 219, 183)"><?php echo $this->sh->getLogLevelTranslated("Notice") ?></option>
60
+ <option value="warning" data-color="#F7D358"><?php echo $this->sh->getLogLevelTranslated("Warning") ?></option>
61
+ <option value="error" data-color="#F79F81"><?php echo $this->sh->getLogLevelTranslated("Error") ?></option>
62
+ <option value="critical" data-color="#FA5858"><?php echo $this->sh->getLogLevelTranslated("Critical") ?></option>
63
+ <option value="alert" data-color="rgb(199, 69, 69)"><?php echo $this->sh->getLogLevelTranslated("Alert") ?></option>
64
+ <option value="emergency" data-color="#DF0101"><?php echo $this->sh->getLogLevelTranslated("Emergency") ?></option>
65
+ </select>
66
+ </p>
67
+
68
+ <p>
69
+ <select name="messages" class="SimpleHistory__filters__filter SimpleHistory__filters__filter--logger" style="width: 300px"
70
+ placeholder="<?php _e("All messages", "simple-history") ?>" multiple>
71
+ <?php
72
+ foreach ($loggers_user_can_read as $logger) {
73
+
74
+ $logger_info = $logger["instance"]->getInfo();
75
+ $logger_slug = $logger["instance"]->slug;
76
+
77
+ // Get labels for logger
78
+ if ( isset( $logger_info["labels"]["search"] ) ) {
79
+
80
+ printf('<optgroup label="%1$s">', esc_attr( $logger_info["labels"]["search"]["label"] ) );
81
+
82
+ // If all activity
83
+ if ( ! empty( $logger_info["labels"]["search"]["label_all"] ) ) {
84
+
85
+ $arr_all_search_messages = array();
86
+ foreach ( $logger_info["labels"]["search"]["options"] as $option_key => $option_messages ) {
87
+ $arr_all_search_messages = array_merge($arr_all_search_messages, $option_messages);
88
+ }
89
+
90
+ foreach ($arr_all_search_messages as $key => $val) {
91
+ $arr_all_search_messages[ $key ] = $logger_slug . ":" . $val;
92
+ }
93
+
94
+ printf('<option value="%2$s">%1$s</option>', esc_attr( $logger_info["labels"]["search"]["label_all"] ), esc_attr( implode(",", $arr_all_search_messages) ));
95
 
 
 
96
  }
97
 
98
+ // For each specific search option
99
+ foreach ( $logger_info["labels"]["search"]["options"] as $option_key => $option_messages ) {
100
 
101
+ foreach ($option_messages as $key => $val) {
102
+ $option_messages[ $key ] = $logger_slug . ":" . $val;
103
+ }
104
 
105
+ $str_option_messages = implode(",", $option_messages);
106
+ printf('<option value="%2$s">%1$s</option>', esc_attr( $option_key ), esc_attr( $str_option_messages ));
107
 
 
 
108
  }
109
 
110
+ printf('</optgroup>');
 
111
 
112
  }
113
 
 
 
114
  }
115
+ ?>
116
+ </select>
117
+ </p>
118
+
119
+ <p>
120
+ <input type="text"
121
+ name = "user"
122
+ class="SimpleHistory__filters__filter SimpleHistory__filters__filter--user"
123
+ style="width: 300px"
124
+ placeholder="<?php _e("All users", "simple-history") ?>" />
125
+ </p>
126
+
127
+ <?php
128
+ global $wpdb;
129
+ $table_name = $wpdb->prefix . SimpleHistory::DBTABLE;
130
+ $loggers_user_can_read_sql_in = $this->sh->getLoggersThatUserCanRead(null, "sql");
131
+ $sql_dates = sprintf('
132
+ SELECT DISTINCT ( date_format(DATE, "%%Y-%%m") ) AS yearMonth
133
+ FROM %s
134
+ WHERE logger IN %s
135
+ ORDER BY yearMonth DESC
136
+ ', $table_name, // 1
137
+ $loggers_user_can_read_sql_in // 2
138
+ );
139
+
140
+ $result_months = $wpdb->get_results($sql_dates);
141
+ ?>
142
+ <p>
143
+ <select class="SimpleHistory__filters__filter SimpleHistory__filters__filter--date"
144
+ name="months"
145
+ placeholder="<?php echo _e("All dates", "simple-history") ?>" multiple>
146
+ <?php
147
+ foreach ($result_months as $row) {
148
+ printf(
149
+ '<option value="%1$s">%2$s</option>',
150
+ $row->yearMonth,
151
+ date_i18n( "F Y", strtotime($row->yearMonth) )
152
+ );
153
+ }
154
+ ?>
155
+ </select>
156
+ </p>
157
 
158
+ <p>
159
+ <button class="button SimpleHistoryFilterDropin-doFilterButton SimpleHistoryFilterDropin-doFilterButton--second js-SimpleHistoryFilterDropin-doFilter"><?php _e("Search events", "simple-history") ?></button>
160
+ <button type="button" class="SimpleHistoryFilterDropin-showMoreFilters SimpleHistoryFilterDropin-showMoreFilters--second js-SimpleHistoryFilterDropin-showMoreFilters"><?php _ex("Hide options", "Filter dropin: button to hide more search options", "simple-history") ?></button>
161
+ </p>
162
 
 
 
 
 
 
 
 
163
 
164
+ </div><!-- // more filters -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
+ <!--
167
  <p>
168
+ <button class="button js-SimpleHistoryFilterDropin-doFilter"><?php _e("Search", "simple-history") ?></button>
169
  </p>
170
+ -->
171
 
172
  </form>
173
 
dropins/SimpleHistorySidebarDropin.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .SimpleHistory__pageSidebar {
3
+ float: right;
4
+ width: 300px;
5
+ margin-right: -340px;
6
+ }
7
+
8
+ .SimpleHistory__pageSidebar .inside {
9
+ margin-bottom: 0;
10
+ }
11
+
12
+ .SimpleHistory__pageSidebar .metabox-holder {
13
+ padding-top: 0 !important;
14
+ }
15
+
16
+ .SimpleHistory__pageSidebar .postbox .hndle {
17
+ cursor: auto;
18
+ }
dropins/SimpleHistorySidebarDropin.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Dropin Name: Sidebar
4
+ Drop Description: Outputs HTML and filters for a sidebar
5
+ Dropin URI: http://simple-history.com/
6
+ Author: Pär Thernström
7
+ */
8
+
9
+ class SimpleHistorySidebarDropin {
10
+
11
+ private $sh;
12
+
13
+ function __construct($sh) {
14
+
15
+ $this->sh = $sh;
16
+
17
+ add_action("simple_history/enqueue_admin_scripts", array($this, "enqueue_admin_scripts"));
18
+ add_action("simple_history/history_page/after_gui", array($this, "output_sidebar_html"));
19
+
20
+ // add_action("simple_history/dropin/sidebar/sidebar_html", array($this, "example_output"));
21
+
22
+ add_action("simple_history/dropin/sidebar/sidebar_html", array($this, "default_sidebar_contents"));
23
+
24
+ }
25
+
26
+ public function default_sidebar_contents() {
27
+
28
+ // Boxes that will appear randomly
29
+
30
+ // Box about GitHub
31
+ $headline = _x("Simple History is on GitHub", 'Sidebar box', 'simple-history');
32
+
33
+ $body = sprintf(
34
+ _x('You can star, fork, or report issues with this plugin over at the <a href="%1$s">GitHub page</a>.', 'Sidebar box', 'simple-history'),
35
+ 'https://github.com/bonny/WordPress-Simple-History'
36
+ );
37
+
38
+ $boxGithub = '
39
+ <div class="postbox">
40
+ <h3 class="hndle">'.$headline.'</h3>
41
+ <div class="inside">
42
+ <p>'.$body.'</p>
43
+ </div>
44
+ </div>
45
+ ';
46
+
47
+ // Box about donation
48
+ $headline = _x('Donate to support development', 'Sidebar box', 'simple-history');
49
+
50
+ $body = sprintf(
51
+ _x('If you like and use Simple History you should <a href="%1$s">donate to keep this plugin free</a>.', 'Sidebar box', 'simple-history'),
52
+ 'http://eskapism.se/sida/donate/'
53
+ );
54
+
55
+ $boxDonate = '
56
+ <div class="postbox">
57
+ <h3 class="hndle">'.$headline.'</h3>
58
+ <div class="inside">
59
+ <p>'.$body.'</p>
60
+ </div>
61
+ </div>
62
+ ';
63
+
64
+ // Box about review
65
+ $headline = _x('Review this plugin if you like it', 'Sidebar box', 'simple-history');
66
+
67
+ $body1 = sprintf(
68
+ _x('If you like Simple History then please <a href="%1$s">give it a nice review over at wordpress.org</a>.', 'Sidebar box', 'simple-history'),
69
+ 'https://wordpress.org/support/view/plugin-reviews/simple-history'
70
+ );
71
+
72
+ $body2 = _x('A good review will help new users find this plugin. And it will make the plugin author very happy :)', 'Sidebar box', 'simple-history');
73
+
74
+ $boxReview = '
75
+ <div class="postbox">
76
+ <h3 class="hndle">'.$headline.'</h3>
77
+ <div class="inside">
78
+ <p>'.$body1.'</p>
79
+ <p>'.$body2.'</p>
80
+ </div>
81
+ </div>
82
+ ';
83
+
84
+ // Box about tweeting and blogging
85
+ /*
86
+ $boxSocial = '
87
+ <div class="postbox">
88
+ <h3 class="hndle">Blog or tweet</h3>
89
+ <div class="inside">
90
+ <p>Yeah, how about that yo.</p>
91
+ </div>
92
+ </div>
93
+ ';
94
+ */
95
+
96
+ // Box about possible events missing
97
+ $boxMissingEvents = '
98
+ <div class="postbox">
99
+ <h3 class="hndle">Missing events?</h3>
100
+ <div class="inside">
101
+ <p>Do you think things are missing in the log? Let me know about it.</p>
102
+ </div>
103
+ </div>
104
+ ';
105
+ //echo $boxMissingEvents;
106
+
107
+ $arrBoxes = array(
108
+ "boxReview" => $boxReview,
109
+ "boxDonate" => $boxDonate,
110
+ "boxGithub" => $boxGithub,
111
+ );
112
+
113
+ /**
114
+ * Filter the default boxes to output in the sidebar
115
+ *
116
+ * @since 2.0.17
117
+ *
118
+ * @param array $arrBoxes array with boxes to output. Check the key to determine which box is which.
119
+ */
120
+ $arrBoxes = apply_filters("simple_history/SidebarDropin/default_sidebar_boxes", $arrBoxes);
121
+
122
+ //echo $arrBoxes[array_rand($arrBoxes)];
123
+ echo implode("", $arrBoxes); // show all
124
+
125
+ // Box to encourage people translate plugin
126
+ $current_locale = get_locale();
127
+ if ("en_US" != $current_locale) {
128
+
129
+ /** WordPress Translation Install API */
130
+ require_once ABSPATH . 'wp-admin/includes/translation-install.php';
131
+
132
+ $translations = wp_get_available_translations();
133
+
134
+ // This text does not need translation since is's only shown in English
135
+ $boxTranslationTmpl = '
136
+ <div class="postbox">
137
+ <h3 class="hndle">Translate Simple History to %1$s</h3>
138
+ <div class="inside">
139
+
140
+ <p>
141
+ It looks like Simple History is not yet translated to your language.
142
+ </p>
143
+
144
+ <p>
145
+ If you\'re interested in translating it please check out the <a href="https://developer.wordpress.org/plugins/internationalization/localization/">localization</a> part of the Plugin Handbook for info on how to translate plugins.
146
+ </p>
147
+
148
+ <p>
149
+ When you\'re done with your translation email it to me at <a href="mailto:par.thernstrom@gmail.com" rel="nofollow">par.thernstrom@gmail.com</a>
150
+ or <a href="https://github.com/bonny/WordPress-Simple-History/" rel="nofollow">add a pull request</a>.
151
+ </p>
152
+ </div>
153
+ </div>
154
+ ';
155
+
156
+ if (isset($translations[$current_locale])) {
157
+
158
+ // Check if an existing text string returns something else, and that current lang is not en
159
+ $teststring_translated = __("Just now", "simple-history");
160
+ $teststring_untranslated = "Just now";
161
+ if ($teststring_untranslated == $teststring_translated) {
162
+ // strings are the same, so plugin probably not translated
163
+ printf($boxTranslationTmpl, $translations[$current_locale]["english_name"]);
164
+ }
165
+
166
+ }
167
+ }
168
+
169
+ }
170
+
171
+ public function example_output() {
172
+ ?>
173
+ <div class="postbox">
174
+ <h3 class="hndle">Example title</h3>
175
+ <div class="inside">
176
+ <p>Example content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Inquit, dasne adolescenti veniam? Non laboro, inquit, de nomine. In quibus doctissimi illi veteres inesse quiddam caeleste et divinum putaverunt. Duo Reges: constructio interrete. Indicant pueri, in quibus ut in speculis natura cernitur. Quod ea non occurrentia fingunt, vincunt Aristonem; Quod quidem iam fit etiam in Academia. Aliter enim nosmet ipsos nosse non possumus.</p>
177
+ </div>
178
+ </div>
179
+ <?php
180
+ }
181
+
182
+ public function enqueue_admin_scripts() {
183
+
184
+ $file_url = plugin_dir_url(__FILE__);
185
+
186
+ wp_enqueue_style("simple_history_SidebarDropin", $file_url . "SimpleHistorySidebarDropin.css", null, SimpleHistory::VERSION);
187
+
188
+ }
189
+
190
+ /**
191
+ * Output the outline for the sidebar
192
+ * Plugins and dropins simple use the filters to output contents to the sidebar
193
+ * Example HTML code to generate meta box:
194
+ *
195
+ * <div class="postbox">
196
+ * <h3 class="hndle">Title</h3>
197
+ * <div class="inside">
198
+ * <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Inquit, dasne adolescenti veniam? Non laboro, inquit, de nomine. In quibus doctissimi illi veteres inesse quiddam caeleste et divinum putaverunt. Duo Reges: constructio interrete. Indicant pueri, in quibus ut in speculis natura cernitur. Quod ea non occurrentia fingunt, vincunt Aristonem; Quod quidem iam fit etiam in Academia. Aliter enim nosmet ipsos nosse non possumus.</p>
199
+ * </div>
200
+ * </div>
201
+ *
202
+ */
203
+ public function output_sidebar_html() {
204
+
205
+ ?>
206
+ <div class="SimpleHistory__pageSidebar">
207
+
208
+ <div class="metabox-holder">
209
+
210
+ <?php
211
+ /**
212
+ * Allows to output HTML in sidebar
213
+ *
214
+ * @since 2.0.16
215
+ */
216
+ do_action("simple_history/dropin/sidebar/sidebar_html");
217
+ ?>
218
+ </div>
219
+
220
+ </div>
221
+ <?php
222
+
223
+ }
224
+
225
+ }// end class
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.16
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.17
7
  Author: Pär Thernström
8
  Author URI: http://simple-history.com/
9
  License: GPL2
js/scripts.js CHANGED
@@ -7,15 +7,15 @@ var simple_history = (function($) {
7
  var debug = function(what) {
8
 
9
  if (typeof what == "object") {
10
-
11
  var newWhat = "";
12
-
13
  _.each(what, function(val, key) {
14
  newWhat += key + ": " + val + "\n";
15
  });
16
-
17
  what = newWhat;
18
-
19
  }
20
 
21
  $(".SimpleHistoryLogitems__debug").append("<br>" + what);
@@ -168,9 +168,9 @@ var simple_history = (function($) {
168
  var logRowID = this.attributes.logRow.data("rowId");
169
  var occasionsCount = this.attributes.logRow.data("occasionsCount");
170
  var occasionsID = this.attributes.logRow.data("occasionsId");
171
-
172
  this.attributes.logRow.addClass("SimpleHistoryLogitem--occasionsOpening");
173
-
174
  this.logRows = new OccasionsLogRowsCollection([], {
175
  logRow: this.attributes.logRow,
176
  logRowID: logRowID,
@@ -188,9 +188,9 @@ var simple_history = (function($) {
188
  },
189
 
190
  render: function() {
191
-
192
  var $html = $([]);
193
-
194
  this.logRows.each(function(model) {
195
  var $li = $(model.get("html"));
196
  $li.addClass("SimpleHistoryLogitem--occasion");
@@ -198,7 +198,7 @@ var simple_history = (function($) {
198
  });
199
 
200
  this.$el.html($html);
201
-
202
  this.attributes.logRow.removeClass("SimpleHistoryLogitem--occasionsOpening").addClass("SimpleHistoryLogitem--occasionsOpened");
203
 
204
  this.$el.addClass("haveOccasionsAdded");
@@ -226,7 +226,7 @@ var simple_history = (function($) {
226
 
227
  this.template = $("#tmpl-simple-history-logitems-modal").html();
228
  this.show();
229
-
230
  this.listenTo(this.model, "change", this.render);
231
 
232
  // also close on esc
@@ -247,14 +247,14 @@ var simple_history = (function($) {
247
  show: function() {
248
 
249
  var $modalEl = $(".SimpleHistory-modal");
250
-
251
  if (!$modalEl.length) {
252
  $modalEl = $(this.template);
253
  $modalEl.appendTo("body");
254
  }
255
 
256
  this.setElement($modalEl);
257
-
258
  var $modalContentEl = $modalEl.find(".SimpleHistory-modal__content");
259
  $modalContentEl.addClass("SimpleHistory-modal__content--enter");
260
 
@@ -265,13 +265,13 @@ var simple_history = (function($) {
265
  },
266
 
267
  close: function() {
268
-
269
  var $modalContentEl = this.$el.find(".SimpleHistory-modal__content");
270
  $modalContentEl.addClass("SimpleHistory-modal__content--leave");
271
-
272
  // Force repaint before adding active class
273
  var offsetHeight = $modalContentEl.get(0).offsetHeight;
274
-
275
  $modalContentEl.addClass("SimpleHistory-modal__content--leave-active");
276
  this.$el.addClass("SimpleHistory-modal__leave-active");
277
 
@@ -287,7 +287,7 @@ var simple_history = (function($) {
287
  },
288
 
289
  render: function() {
290
-
291
  var $modalContentInnerEl = this.$el.find(".SimpleHistory-modal__contentInner");
292
  var logRowLI = this.model.get("data").log_rows[0];
293
  $modalContentInnerEl.html(logRowLI);
@@ -297,9 +297,9 @@ var simple_history = (function($) {
297
  });
298
 
299
  var RowsView = Backbone.View.extend({
300
-
301
  initialize: function() {
302
-
303
  this.collection.on("reset", this.render, this);
304
  this.collection.on("reload", this.onReload, this);
305
  this.collection.on("reloadDone", this.onReloadDone, this);
@@ -328,7 +328,7 @@ var simple_history = (function($) {
328
  // Add message if no hits
329
  $mainViewElm.removeClass("SimpleHistory--hasNoHits");
330
  if (! this.collection.length ) {
331
-
332
  $mainViewElm.addClass("SimpleHistory--hasNoHits");
333
 
334
  var noHitsClass = "SimpleHistoryLogitems__noHits";
@@ -344,7 +344,7 @@ var simple_history = (function($) {
344
  ;
345
 
346
  } // add msg
347
-
348
  },
349
 
350
  events: {
@@ -365,7 +365,7 @@ var simple_history = (function($) {
365
  var $target = $(e.target);
366
  var $logRow = $target.closest(".SimpleHistoryLogitem");
367
  var logRowID = $logRow.data("rowId");
368
-
369
  Backbone.history.navigate("item/" + logRowID, { trigger: true });
370
 
371
  },
@@ -377,7 +377,7 @@ var simple_history = (function($) {
377
  var $target = $(e.target);
378
  var $logRow = $target.closest(".SimpleHistoryLogitem");
379
  var $occasionsElm = $("<li class='SimpleHistoryLogitem__occasionsItemsWrap'><ul class='SimpleHistoryLogitem__occasionsItems'/></li>");
380
-
381
  $logRow.after($occasionsElm);
382
 
383
  this.occasionsView = new OccasionsView({
@@ -395,7 +395,7 @@ var simple_history = (function($) {
395
  this.collection.each(function(model) {
396
  html += model.get("html");
397
  });
398
-
399
  this.$el.html( html );
400
 
401
  // Rendering of log rows items is done
@@ -408,7 +408,7 @@ var simple_history = (function($) {
408
  var PaginationView = Backbone.View.extend({
409
 
410
  initialize: function() {
411
-
412
  $(document).keydown({ view: this }, this.keyboardNav);
413
 
414
  this.collection.on("reset", this.render, this);
@@ -433,6 +433,12 @@ var simple_history = (function($) {
433
  return;
434
  }
435
 
 
 
 
 
 
 
436
  var paged;
437
 
438
  if (e.keyCode == 37) {
@@ -453,7 +459,7 @@ var simple_history = (function($) {
453
 
454
  // keycode 13 = enter
455
  if (e.keyCode == 13) {
456
-
457
  var $target = $(e.target);
458
  var paged = parseInt( $target.val() );
459
 
@@ -473,7 +479,7 @@ var simple_history = (function($) {
473
  },
474
 
475
  navigateArrow: function(e) {
476
-
477
  e.preventDefault();
478
  var $target = $(e.target);
479
 
@@ -507,7 +513,7 @@ var simple_history = (function($) {
507
  }
508
 
509
  this.fetchPage(paged);
510
-
511
  },
512
 
513
  /**
@@ -517,7 +523,7 @@ var simple_history = (function($) {
517
  fetchPage: function(paged) {
518
 
519
  $(document).trigger("SimpleHistory:logReloadStart");
520
-
521
  $("html").addClass("SimpleHistory-isLoadingPage");
522
 
523
  var url_data = {
@@ -546,7 +552,7 @@ var simple_history = (function($) {
546
  render: function() {
547
 
548
  var compiled = wp.template("simple-history-logitems-pagination");
549
-
550
  this.$el.html( compiled({
551
  min_id: this.collection.min_id,
552
  max_id: this.collection.max_id,
@@ -563,7 +569,7 @@ var simple_history = (function($) {
563
  });
564
 
565
  var MainView = Backbone.View.extend({
566
-
567
  el: ".SimpleHistoryGui",
568
 
569
  initialize: function() {
@@ -585,7 +591,7 @@ var simple_history = (function($) {
585
  this.logRowsCollection = new LogRowsCollection([], {
586
  mainView: this,
587
  });
588
-
589
  this.rowsView = new RowsView({
590
  el: this.$el.find(".SimpleHistoryLogitems"),
591
  collection: this.logRowsCollection
@@ -631,7 +637,7 @@ var simple_history = (function($) {
631
  },
632
 
633
  item: function(logRowID) {
634
-
635
  var detailsModel = new DetailsModel({
636
  id: logRowID
637
  });
@@ -655,9 +661,9 @@ var simple_history = (function($) {
655
  // Init MainView on domReady
656
  // This is to make sure dropins and plugins have been loaded
657
  $(document).ready(function() {
658
-
659
  mainView.manualInitialize();
660
-
661
  });
662
 
663
  return mainView;
@@ -665,7 +671,7 @@ var simple_history = (function($) {
665
  })(jQuery);
666
 
667
  jQuery(".js-SimpleHistory-Settings-ClearLog").on("click", function(e) {
668
-
669
  if (confirm(simple_history_script_vars.settingsConfirmClearLog)) {
670
  return;
671
  } else {
@@ -673,4 +679,3 @@ jQuery(".js-SimpleHistory-Settings-ClearLog").on("click", function(e) {
673
  }
674
 
675
  });
676
-
7
  var debug = function(what) {
8
 
9
  if (typeof what == "object") {
10
+
11
  var newWhat = "";
12
+
13
  _.each(what, function(val, key) {
14
  newWhat += key + ": " + val + "\n";
15
  });
16
+
17
  what = newWhat;
18
+
19
  }
20
 
21
  $(".SimpleHistoryLogitems__debug").append("<br>" + what);
168
  var logRowID = this.attributes.logRow.data("rowId");
169
  var occasionsCount = this.attributes.logRow.data("occasionsCount");
170
  var occasionsID = this.attributes.logRow.data("occasionsId");
171
+
172
  this.attributes.logRow.addClass("SimpleHistoryLogitem--occasionsOpening");
173
+
174
  this.logRows = new OccasionsLogRowsCollection([], {
175
  logRow: this.attributes.logRow,
176
  logRowID: logRowID,
188
  },
189
 
190
  render: function() {
191
+
192
  var $html = $([]);
193
+
194
  this.logRows.each(function(model) {
195
  var $li = $(model.get("html"));
196
  $li.addClass("SimpleHistoryLogitem--occasion");
198
  });
199
 
200
  this.$el.html($html);
201
+
202
  this.attributes.logRow.removeClass("SimpleHistoryLogitem--occasionsOpening").addClass("SimpleHistoryLogitem--occasionsOpened");
203
 
204
  this.$el.addClass("haveOccasionsAdded");
226
 
227
  this.template = $("#tmpl-simple-history-logitems-modal").html();
228
  this.show();
229
+
230
  this.listenTo(this.model, "change", this.render);
231
 
232
  // also close on esc
247
  show: function() {
248
 
249
  var $modalEl = $(".SimpleHistory-modal");
250
+
251
  if (!$modalEl.length) {
252
  $modalEl = $(this.template);
253
  $modalEl.appendTo("body");
254
  }
255
 
256
  this.setElement($modalEl);
257
+
258
  var $modalContentEl = $modalEl.find(".SimpleHistory-modal__content");
259
  $modalContentEl.addClass("SimpleHistory-modal__content--enter");
260
 
265
  },
266
 
267
  close: function() {
268
+
269
  var $modalContentEl = this.$el.find(".SimpleHistory-modal__content");
270
  $modalContentEl.addClass("SimpleHistory-modal__content--leave");
271
+
272
  // Force repaint before adding active class
273
  var offsetHeight = $modalContentEl.get(0).offsetHeight;
274
+
275
  $modalContentEl.addClass("SimpleHistory-modal__content--leave-active");
276
  this.$el.addClass("SimpleHistory-modal__leave-active");
277
 
287
  },
288
 
289
  render: function() {
290
+
291
  var $modalContentInnerEl = this.$el.find(".SimpleHistory-modal__contentInner");
292
  var logRowLI = this.model.get("data").log_rows[0];
293
  $modalContentInnerEl.html(logRowLI);
297
  });
298
 
299
  var RowsView = Backbone.View.extend({
300
+
301
  initialize: function() {
302
+
303
  this.collection.on("reset", this.render, this);
304
  this.collection.on("reload", this.onReload, this);
305
  this.collection.on("reloadDone", this.onReloadDone, this);
328
  // Add message if no hits
329
  $mainViewElm.removeClass("SimpleHistory--hasNoHits");
330
  if (! this.collection.length ) {
331
+
332
  $mainViewElm.addClass("SimpleHistory--hasNoHits");
333
 
334
  var noHitsClass = "SimpleHistoryLogitems__noHits";
344
  ;
345
 
346
  } // add msg
347
+
348
  },
349
 
350
  events: {
365
  var $target = $(e.target);
366
  var $logRow = $target.closest(".SimpleHistoryLogitem");
367
  var logRowID = $logRow.data("rowId");
368
+
369
  Backbone.history.navigate("item/" + logRowID, { trigger: true });
370
 
371
  },
377
  var $target = $(e.target);
378
  var $logRow = $target.closest(".SimpleHistoryLogitem");
379
  var $occasionsElm = $("<li class='SimpleHistoryLogitem__occasionsItemsWrap'><ul class='SimpleHistoryLogitem__occasionsItems'/></li>");
380
+
381
  $logRow.after($occasionsElm);
382
 
383
  this.occasionsView = new OccasionsView({
395
  this.collection.each(function(model) {
396
  html += model.get("html");
397
  });
398
+
399
  this.$el.html( html );
400
 
401
  // Rendering of log rows items is done
408
  var PaginationView = Backbone.View.extend({
409
 
410
  initialize: function() {
411
+
412
  $(document).keydown({ view: this }, this.keyboardNav);
413
 
414
  this.collection.on("reset", this.render, this);
433
  return;
434
  }
435
 
436
+ // Don't nav away if a text input (like the search box) is selected
437
+ var $target = $(e.target);
438
+ if ($target.is("input")) {
439
+ return;
440
+ }
441
+
442
  var paged;
443
 
444
  if (e.keyCode == 37) {
459
 
460
  // keycode 13 = enter
461
  if (e.keyCode == 13) {
462
+
463
  var $target = $(e.target);
464
  var paged = parseInt( $target.val() );
465
 
479
  },
480
 
481
  navigateArrow: function(e) {
482
+
483
  e.preventDefault();
484
  var $target = $(e.target);
485
 
513
  }
514
 
515
  this.fetchPage(paged);
516
+
517
  },
518
 
519
  /**
523
  fetchPage: function(paged) {
524
 
525
  $(document).trigger("SimpleHistory:logReloadStart");
526
+
527
  $("html").addClass("SimpleHistory-isLoadingPage");
528
 
529
  var url_data = {
552
  render: function() {
553
 
554
  var compiled = wp.template("simple-history-logitems-pagination");
555
+
556
  this.$el.html( compiled({
557
  min_id: this.collection.min_id,
558
  max_id: this.collection.max_id,
569
  });
570
 
571
  var MainView = Backbone.View.extend({
572
+
573
  el: ".SimpleHistoryGui",
574
 
575
  initialize: function() {
591
  this.logRowsCollection = new LogRowsCollection([], {
592
  mainView: this,
593
  });
594
+
595
  this.rowsView = new RowsView({
596
  el: this.$el.find(".SimpleHistoryLogitems"),
597
  collection: this.logRowsCollection
637
  },
638
 
639
  item: function(logRowID) {
640
+
641
  var detailsModel = new DetailsModel({
642
  id: logRowID
643
  });
661
  // Init MainView on domReady
662
  // This is to make sure dropins and plugins have been loaded
663
  $(document).ready(function() {
664
+
665
  mainView.manualInitialize();
666
+
667
  });
668
 
669
  return mainView;
671
  })(jQuery);
672
 
673
  jQuery(".js-SimpleHistory-Settings-ClearLog").on("click", function(e) {
674
+
675
  if (confirm(simple_history_script_vars.settingsConfirmClearLog)) {
676
  return;
677
  } else {
679
  }
680
 
681
  });
 
languages/simple-history-de_DE.mo CHANGED
Binary file
languages/simple-history-de_DE.po CHANGED
@@ -4,15 +4,15 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Simple History 2.0.3\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/Simple-History\n"
7
- "POT-Creation-Date: 2015-01-06 09:40:58+00:00\n"
8
- "PO-Revision-Date: 2015-01-06 17:25+0100\n"
9
  "Last-Translator: Ralph Stenzel <ralph@klein-aber-fein.de>\n"
10
  "Language-Team: Ralph Stenzel <ralph@klein-aber-fein.de>\n"
11
  "Language: de_DE\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
- "X-Generator: Poedit 1.7.1\n"
16
  "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
  "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
  "esc_html_x:1,2c\n"
@@ -115,42 +115,56 @@ msgstr "Einträge in der Datenbank werden auf ewig behalten."
115
  msgid "Clear log now"
116
  msgstr "Logbuch jetzt leeren"
117
 
118
- #: SimpleHistory.php:1658
119
- msgid "+%1$s more"
120
- msgstr "+%1$s mehr"
 
 
121
 
122
- #: SimpleHistory.php:1665
123
  msgid "Loading…"
124
  msgstr "Lade..."
125
 
126
- #: SimpleHistory.php:1672
127
  msgid "Showing %1$s more"
128
  msgstr "Zeige %1$s mehr"
129
 
130
- #: SimpleHistory.php:1691
131
  msgid "Context data"
132
  msgstr "Kontext-Daten"
133
 
134
- #: SimpleHistory.php:1692
135
  msgid "This is potentially useful meta data that a logger has saved."
136
  msgstr ""
137
  "Dies sind potentiell nützliche Meta-Daten, die ein Logger abgespeichert hat."
138
 
139
- #: SimpleHistory.php:2029
140
  msgid "No events today so far."
141
  msgstr "Heute sind noch keine Ereignisse aufgetreten."
142
 
143
- #: SimpleHistory.php:2033
144
- msgid "%1$d event today from one user."
145
- msgstr "%1$d Ereignis heute von einem Benutzer."
 
 
 
 
146
 
147
- #: SimpleHistory.php:2037
148
  msgid "%1$d events today from %2$d users."
149
  msgstr "%1$d Ereignisse heute von %2$d Benutzern."
150
 
151
- #: SimpleHistory.php:2041
152
- msgid "%1$d events today from one user."
153
- msgstr "%1$d Ereignisse heute von einem Benutzer."
 
 
 
 
 
 
 
 
154
 
155
  #: dropins/SimpleHistoryDonateDropin.php:36
156
  msgid "Donate"
@@ -168,6 +182,10 @@ msgstr ""
168
  msgid "Filter history"
169
  msgstr "Filter-Historie"
170
 
 
 
 
 
171
  #: dropins/SimpleHistoryFilterDropin.php:50
172
  msgid "All log levels"
173
  msgstr "Alle Logbuch-Ebenen"
@@ -266,7 +284,7 @@ msgstr "Test-Daten (Fehlersuche)"
266
  msgid "Stats"
267
  msgstr "Statistiken"
268
 
269
- #: index.php:55
270
  msgid ""
271
  "Simple History is a great plugin, but to use it your server must have at "
272
  "least PHP 5.3 installed (you have version %s)."
@@ -274,27 +292,27 @@ msgstr ""
274
  "Simple History ist ein großartiges Plugin, aber zu seiner Benutzung muß Dein "
275
  "Server mindestens PHP 5.3 installiert haben (Du hast Version %s)."
276
 
277
- #: loggers/SimpleCommentsLogger.php:694
278
  msgid "Spam"
279
  msgstr "Spam"
280
 
281
- #: loggers/SimpleCommentsLogger.php:696
282
  msgid "Approved"
283
  msgstr "genehmigt"
284
 
285
- #: loggers/SimpleCommentsLogger.php:698
286
  msgid "Pending"
287
  msgstr "schwebend"
288
 
289
- #: loggers/SimpleCommentsLogger.php:712
290
  msgid "Trackback"
291
  msgstr "Trackback"
292
 
293
- #: loggers/SimpleCommentsLogger.php:714
294
  msgid "Pingback"
295
  msgstr "Pingback"
296
 
297
- #: loggers/SimpleCommentsLogger.php:716
298
  msgid "Comment"
299
  msgstr "Kommentar"
300
 
@@ -324,11 +342,11 @@ msgstr "gelöschter Benutzer (hatte ID %1$s, E-Mail %2$s, Login %3$s)"
324
 
325
  #: loggers/SimpleLogger.php:220
326
  msgid "Anonymous web user"
327
- msgstr "anonymer Netz-Nutzer"
328
 
329
  #: loggers/SimpleLogger.php:228
330
  msgid "Anonymous user from %1$s"
331
- msgstr "anonymer Benutzer von %1$s"
332
 
333
  #: loggers/SimpleLogger.php:299
334
  msgid "Just now"
@@ -516,7 +534,7 @@ msgstr "hat sich angemeldet"
516
 
517
  #: loggers/SimpleUserLogger.php:26
518
  msgid "Unknown user logged in"
519
- msgstr "unbekannter Benutzer hat sich angemeldet"
520
 
521
  #: loggers/SimpleUserLogger.php:27
522
  msgid "Logged out"
@@ -657,6 +675,86 @@ msgctxt "history page headline"
657
  msgid "Simple History"
658
  msgstr "Simple History"
659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
  #: dropins/SimpleHistoryDonateDropin.php:51
661
  msgctxt "donate settings headline"
662
  msgid "Donate"
@@ -714,21 +812,21 @@ msgctxt "rss settings headline"
714
  msgid "RSS feed"
715
  msgstr "RSS-Feed"
716
 
717
- #: loggers/SimpleCommentsLogger.php:94
718
  msgctxt "A comment was added to the database by a non-logged in internet user"
719
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
720
  msgstr ""
721
  "hat einen Kommentar zu {comment_post_type} \"{comment_post_title}\" "
722
  "hinzugefügt"
723
 
724
- #: loggers/SimpleCommentsLogger.php:100
725
  msgctxt "A comment was added to the database by a logged in user"
726
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
727
  msgstr ""
728
  "hat einen Kommentar zu {comment_post_type} \"{comment_post_title}\" "
729
  "hinzugefügt"
730
 
731
- #: loggers/SimpleCommentsLogger.php:106
732
  msgctxt "A comment was approved"
733
  msgid ""
734
  "Approved a comment to \"{comment_post_title}\" by {comment_author} "
@@ -737,7 +835,7 @@ msgstr ""
737
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
738
  "({comment_author_email}) genehmigt"
739
 
740
- #: loggers/SimpleCommentsLogger.php:112
741
  msgctxt "A comment was was unapproved"
742
  msgid ""
743
  "Unapproved a comment to \"{comment_post_title}\" by {comment_author} "
@@ -746,14 +844,14 @@ msgstr ""
746
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
747
  "({comment_author_email}) verworfen"
748
 
749
- #: loggers/SimpleCommentsLogger.php:118
750
  msgctxt "A comment was marked as spam"
751
  msgid "Marked a comment to post \"{comment_post_title}\" as spam"
752
  msgstr ""
753
  "hat einen Kommentar zum Beitrag \"{comment_post_title}\" als Spam "
754
  "gekennzeichnet"
755
 
756
- #: loggers/SimpleCommentsLogger.php:124
757
  msgctxt "A comment was marked moved to the trash"
758
  msgid ""
759
  "Trashed a comment to \"{comment_post_title}\" by {comment_author} "
@@ -762,7 +860,7 @@ msgstr ""
762
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
763
  "({comment_author_email}) in den Papierkorb verschoben"
764
 
765
- #: loggers/SimpleCommentsLogger.php:130
766
  msgctxt "A comment was restored from the trash"
767
  msgid ""
768
  "Restored a comment to \"{comment_post_title}\" by {comment_author} "
@@ -771,7 +869,7 @@ msgstr ""
771
  "hat einen Kommentar zu \"{comment_post_title}\" von {comment_author} "
772
  "({comment_author_email}) aus dem Papierkorb wiederhergestellt"
773
 
774
- #: loggers/SimpleCommentsLogger.php:136
775
  msgctxt "A comment was deleted"
776
  msgid ""
777
  "Deleted a comment to \"{comment_post_title}\" by {comment_author} "
@@ -780,7 +878,7 @@ msgstr ""
780
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
781
  "({comment_author_email}) gelöscht"
782
 
783
- #: loggers/SimpleCommentsLogger.php:142
784
  msgctxt "A comment was edited"
785
  msgid ""
786
  "Edited a comment to \"{comment_post_title}\" by {comment_author} "
@@ -789,27 +887,27 @@ msgstr ""
789
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
790
  "({comment_author_email}) geändert"
791
 
792
- #: loggers/SimpleCommentsLogger.php:149
793
  msgctxt "A trackback was added to the database by a non-logged in internet user"
794
  msgid "Added a trackback to {comment_post_type} \"{comment_post_title}\""
795
  msgstr ""
796
  "hat einen Trackback zu {comment_post_type} \"{comment_post_title}\" "
797
  "hinzugefügt"
798
 
799
- #: loggers/SimpleCommentsLogger.php:204
800
  msgctxt "A trackback was added to the database by a non-logged in internet user"
801
  msgid "Added a pingback to {comment_post_type} \"{comment_post_title}\""
802
  msgstr ""
803
  "hat ein Pingback zu {comment_post_type} \"{comment_post_title}\" hinzugefügt"
804
 
805
- #: loggers/SimpleCommentsLogger.php:155
806
  msgctxt "A trackback was added to the database by a logged in user"
807
  msgid "Added a trackback to {comment_post_type} \"{comment_post_title}\""
808
  msgstr ""
809
  "hat einen Trackback zu {comment_post_type} \"{comment_post_title}\" "
810
  "hinzugefügt"
811
 
812
- #: loggers/SimpleCommentsLogger.php:161
813
  msgctxt "A trackback was approved"
814
  msgid ""
815
  "Approved a trackback to \"{comment_post_title}\" by {comment_author} "
@@ -818,7 +916,7 @@ msgstr ""
818
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
819
  "({comment_author_email}) genehmigt"
820
 
821
- #: loggers/SimpleCommentsLogger.php:167
822
  msgctxt "A trackback was was unapproved"
823
  msgid ""
824
  "Unapproved a trackback to \"{comment_post_title}\" by {comment_author} "
@@ -827,14 +925,14 @@ msgstr ""
827
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
828
  "({comment_author_email}) verworfen"
829
 
830
- #: loggers/SimpleCommentsLogger.php:173
831
  msgctxt "A trackback was marked as spam"
832
  msgid "Marked a trackback to post \"{comment_post_title}\" as spam"
833
  msgstr ""
834
  "hat einen Trackback zum Beitrag \"{comment_post_title}\" als Spam "
835
  "gekennzeichnet"
836
 
837
- #: loggers/SimpleCommentsLogger.php:179
838
  msgctxt "A trackback was marked moved to the trash"
839
  msgid ""
840
  "Trashed a trackback to \"{comment_post_title}\" by {comment_author} "
@@ -843,7 +941,7 @@ msgstr ""
843
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
844
  "({comment_author_email}) in den Papierkorb verschoben"
845
 
846
- #: loggers/SimpleCommentsLogger.php:185
847
  msgctxt "A trackback was restored from the trash"
848
  msgid ""
849
  "Restored a trackback to \"{comment_post_title}\" by {comment_author} "
@@ -852,7 +950,7 @@ msgstr ""
852
  "hat einen Trackback zu \"{comment_post_title}\" von {comment_author} "
853
  "({comment_author_email}) aus dem Papierkorb wiederhergestellt"
854
 
855
- #: loggers/SimpleCommentsLogger.php:191
856
  msgctxt "A trackback was deleted"
857
  msgid ""
858
  "Deleted a trackback to \"{comment_post_title}\" by {comment_author} "
@@ -861,7 +959,7 @@ msgstr ""
861
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
862
  "({comment_author_email}) gelöscht"
863
 
864
- #: loggers/SimpleCommentsLogger.php:197
865
  msgctxt "A trackback was edited"
866
  msgid ""
867
  "Edited a trackback to \"{comment_post_title}\" by {comment_author} "
@@ -870,13 +968,13 @@ msgstr ""
870
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
871
  "({comment_author_email}) geändert"
872
 
873
- #: loggers/SimpleCommentsLogger.php:210
874
  msgctxt "A pingback was added to the database by a logged in user"
875
  msgid "Added a pingback to {comment_post_type} \"{comment_post_title}\""
876
  msgstr ""
877
  "hat ein Pingback zu {comment_post_type} \"{comment_post_title}\" hinzugefügt"
878
 
879
- #: loggers/SimpleCommentsLogger.php:216
880
  msgctxt "A pingback was approved"
881
  msgid ""
882
  "Approved a pingback to \"{comment_post_title}\" by "
@@ -885,7 +983,7 @@ msgstr ""
885
  "hat ein Pingback zu \"{comment_post_title}\" by "
886
  "\"{comment_author}\"\" ({comment_author_email}) genehmigt"
887
 
888
- #: loggers/SimpleCommentsLogger.php:222
889
  msgctxt "A pingback was was unapproved"
890
  msgid ""
891
  "Unapproved a pingback to \"{comment_post_title}\" by "
@@ -894,13 +992,13 @@ msgstr ""
894
  "hat ein Pingback zu \"{comment_post_title}\" by "
895
  "\"{comment_author}\" ({comment_author_email}) verworfen"
896
 
897
- #: loggers/SimpleCommentsLogger.php:228
898
  msgctxt "A pingback was marked as spam"
899
  msgid "Marked a pingback to post \"{comment_post_title}\" as spam"
900
  msgstr ""
901
  "hat ein Pingback zum Beitrag \"{comment_post_title}\" als Spam gekennzeichnet"
902
 
903
- #: loggers/SimpleCommentsLogger.php:234
904
  msgctxt "A pingback was marked moved to the trash"
905
  msgid ""
906
  "Trashed a pingback to \"{comment_post_title}\" by {comment_author} "
@@ -909,7 +1007,7 @@ msgstr ""
909
  "hat ein Pingback zu \"{comment_post_title}\" by {comment_author} "
910
  "({comment_author_email}) in den Papierkorb verschoben"
911
 
912
- #: loggers/SimpleCommentsLogger.php:240
913
  msgctxt "A pingback was restored from the trash"
914
  msgid ""
915
  "Restored a pingback to \"{comment_post_title}\" by {comment_author} "
@@ -918,7 +1016,7 @@ msgstr ""
918
  "hat ein Pingback zu \"{comment_post_title}\" von {comment_author} "
919
  "({comment_author_email}) aus dem Papierkorb wiederhergestellt"
920
 
921
- #: loggers/SimpleCommentsLogger.php:246
922
  msgctxt "A pingback was deleted"
923
  msgid ""
924
  "Deleted a pingback to \"{comment_post_title}\" by {comment_author} "
@@ -927,7 +1025,7 @@ msgstr ""
927
  "hat ein Pingback zu \"{comment_post_title}\" by {comment_author} "
928
  "({comment_author_email}) gelöscht"
929
 
930
- #: loggers/SimpleCommentsLogger.php:252
931
  msgctxt "A pingback was edited"
932
  msgid ""
933
  "Edited a pingback to \"{comment_post_title}\" by {comment_author} "
@@ -936,85 +1034,85 @@ msgstr ""
936
  "hat ein Pingback zu \"{comment_post_title}\" by {comment_author} "
937
  "({comment_author_email}) geändert"
938
 
939
- #: loggers/SimpleCommentsLogger.php:263
940
  msgctxt "Comments logger: search"
941
  msgid "Comments"
942
  msgstr "Kommentare"
943
 
944
- #: loggers/SimpleCommentsLogger.php:264
945
  msgctxt "Comments logger: search"
946
  msgid "All comments activity"
947
  msgstr "Alle Kommentar-Aktivitäten"
948
 
949
- #: loggers/SimpleCommentsLogger.php:266
950
  msgctxt "Comments logger: search"
951
  msgid "Added comments"
952
  msgstr "hinzugefügte Kommentare"
953
 
954
- #: loggers/SimpleCommentsLogger.php:274
955
  msgctxt "Comments logger: search"
956
  msgid "Edited comments"
957
  msgstr "geänderte Kommentare"
958
 
959
- #: loggers/SimpleCommentsLogger.php:279
960
  msgctxt "Comments logger: search"
961
  msgid "Approved comments"
962
  msgstr "genehmigte Kommentare"
963
 
964
- #: loggers/SimpleCommentsLogger.php:284
965
  msgctxt "Comments logger: search"
966
  msgid "Held comments"
967
  msgstr "zurückgehaltene Kommentare"
968
 
969
- #: loggers/SimpleCommentsLogger.php:289
970
  msgctxt "Comments logger: search"
971
  msgid "Comments status changed to spam"
972
  msgstr "als Spam markierte Kommentare"
973
 
974
- #: loggers/SimpleCommentsLogger.php:294
975
  msgctxt "Comments logger: search"
976
  msgid "Trashed comments"
977
  msgstr "in den Papierkorb verschobene Kommentare "
978
 
979
- #: loggers/SimpleCommentsLogger.php:299
980
  msgctxt "Comments logger: search"
981
  msgid "Untrashed comments"
982
  msgstr "wiederhergestellte Kommentare"
983
 
984
- #: loggers/SimpleCommentsLogger.php:304
985
  msgctxt "Comments logger: search"
986
  msgid "Deleted comments"
987
  msgstr "gelöschte Kommentare"
988
 
989
- #: loggers/SimpleCommentsLogger.php:611 loggers/SimpleCommentsLogger.php:624
990
- #: loggers/SimpleCommentsLogger.php:638
991
  msgctxt "comments logger - detailed output comment status"
992
  msgid "Status"
993
  msgstr "Status"
994
 
995
- #: loggers/SimpleCommentsLogger.php:613 loggers/SimpleCommentsLogger.php:626
996
- #: loggers/SimpleCommentsLogger.php:640
997
  msgctxt "comments logger - detailed output author"
998
  msgid "Name"
999
  msgstr "Name"
1000
 
1001
- #: loggers/SimpleCommentsLogger.php:614 loggers/SimpleCommentsLogger.php:627
1002
- #: loggers/SimpleCommentsLogger.php:641
1003
  msgctxt "comments logger - detailed output email"
1004
  msgid "Email"
1005
  msgstr "E-Mail"
1006
 
1007
- #: loggers/SimpleCommentsLogger.php:615 loggers/SimpleCommentsLogger.php:628
1008
  msgctxt "comments logger - detailed output content"
1009
  msgid "Content"
1010
  msgstr "Inhalt"
1011
 
1012
- #: loggers/SimpleCommentsLogger.php:642
1013
  msgctxt "comments logger - detailed output content"
1014
  msgid "Comment"
1015
  msgstr "Kommentar"
1016
 
1017
- #: loggers/SimpleCommentsLogger.php:768
1018
  msgctxt "comments logger - edit comment"
1019
  msgid "View/Edit"
1020
  msgstr "Betrachte/Ändere"
@@ -1376,6 +1474,15 @@ msgctxt "stats: date in rows per day chart"
1376
  msgid "M j"
1377
  msgstr "M j"
1378
 
 
 
 
 
 
 
 
 
 
1379
  #~ msgid "History"
1380
  #~ msgstr "Historie"
1381
 
4
  msgstr ""
5
  "Project-Id-Version: Simple History 2.0.3\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/Simple-History\n"
7
+ "POT-Creation-Date: 2015-01-14 20:50:40+00:00\n"
8
+ "PO-Revision-Date: 2015-01-15 08:35+0100\n"
9
  "Last-Translator: Ralph Stenzel <ralph@klein-aber-fein.de>\n"
10
  "Language-Team: Ralph Stenzel <ralph@klein-aber-fein.de>\n"
11
  "Language: de_DE\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.7.3\n"
16
  "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
17
  "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
18
  "esc_html_x:1,2c\n"
115
  msgid "Clear log now"
116
  msgstr "Logbuch jetzt leeren"
117
 
118
+ #: SimpleHistory.php:1659
119
+ msgid "+%1$s similar event"
120
+ msgid_plural "+%1$s similar events"
121
+ msgstr[0] "+%1$s gleichartiges Ereignis"
122
+ msgstr[1] "+%1$s gleichartige Ereignisse"
123
 
124
+ #: SimpleHistory.php:1666
125
  msgid "Loading…"
126
  msgstr "Lade..."
127
 
128
+ #: SimpleHistory.php:1673
129
  msgid "Showing %1$s more"
130
  msgstr "Zeige %1$s mehr"
131
 
132
+ #: SimpleHistory.php:1692
133
  msgid "Context data"
134
  msgstr "Kontext-Daten"
135
 
136
+ #: SimpleHistory.php:1693
137
  msgid "This is potentially useful meta data that a logger has saved."
138
  msgstr ""
139
  "Dies sind potentiell nützliche Meta-Daten, die ein Logger abgespeichert hat."
140
 
141
+ #: SimpleHistory.php:2156
142
  msgid "No events today so far."
143
  msgstr "Heute sind noch keine Ereignisse aufgetreten."
144
 
145
+ #: SimpleHistory.php:2174
146
+ msgid "One event today from one user."
147
+ msgstr "Ein Ereignis heute von einem Benutzer."
148
+
149
+ #: SimpleHistory.php:2180
150
+ msgid "One event today from one source."
151
+ msgstr "Ein Ereignis heute aus einer Quelle."
152
 
153
+ #: SimpleHistory.php:2186
154
  msgid "%1$d events today from %2$d users."
155
  msgstr "%1$d Ereignisse heute von %2$d Benutzern."
156
 
157
+ #: SimpleHistory.php:2192 SimpleHistory.php:2198
158
+ msgid "%1$d events today from one user and one other source."
159
+ msgstr "%1$d Ereignisse heute von einem Benutzer und einer anderen Quelle."
160
+
161
+ #: SimpleHistory.php:2204
162
+ msgid "%1$d events today from one user and %3$d other sources."
163
+ msgstr "%1$d Ereignisse heute von einem Benutzer und %3$d anderen Quellen."
164
+
165
+ #: SimpleHistory.php:2210
166
+ msgid "%1$s events today from %2$d users and %3$d other sources."
167
+ msgstr "%1$s Ereignisse heute von %2$d Benutzern und %3$d anderen Quellen."
168
 
169
  #: dropins/SimpleHistoryDonateDropin.php:36
170
  msgid "Donate"
182
  msgid "Filter history"
183
  msgstr "Filter-Historie"
184
 
185
+ #: dropins/SimpleHistoryFilterDropin.php:46
186
+ msgid "Search"
187
+ msgstr "Suche"
188
+
189
  #: dropins/SimpleHistoryFilterDropin.php:50
190
  msgid "All log levels"
191
  msgstr "Alle Logbuch-Ebenen"
284
  msgid "Stats"
285
  msgstr "Statistiken"
286
 
287
+ #: index.php:59
288
  msgid ""
289
  "Simple History is a great plugin, but to use it your server must have at "
290
  "least PHP 5.3 installed (you have version %s)."
292
  "Simple History ist ein großartiges Plugin, aber zu seiner Benutzung muß Dein "
293
  "Server mindestens PHP 5.3 installiert haben (Du hast Version %s)."
294
 
295
+ #: loggers/SimpleCommentsLogger.php:695
296
  msgid "Spam"
297
  msgstr "Spam"
298
 
299
+ #: loggers/SimpleCommentsLogger.php:697
300
  msgid "Approved"
301
  msgstr "genehmigt"
302
 
303
+ #: loggers/SimpleCommentsLogger.php:699
304
  msgid "Pending"
305
  msgstr "schwebend"
306
 
307
+ #: loggers/SimpleCommentsLogger.php:713
308
  msgid "Trackback"
309
  msgstr "Trackback"
310
 
311
+ #: loggers/SimpleCommentsLogger.php:715
312
  msgid "Pingback"
313
  msgstr "Pingback"
314
 
315
+ #: loggers/SimpleCommentsLogger.php:717
316
  msgid "Comment"
317
  msgstr "Kommentar"
318
 
342
 
343
  #: loggers/SimpleLogger.php:220
344
  msgid "Anonymous web user"
345
+ msgstr "Anonymer Netz-Nutzer"
346
 
347
  #: loggers/SimpleLogger.php:228
348
  msgid "Anonymous user from %1$s"
349
+ msgstr "Anonymer Benutzer von %1$s"
350
 
351
  #: loggers/SimpleLogger.php:299
352
  msgid "Just now"
534
 
535
  #: loggers/SimpleUserLogger.php:26
536
  msgid "Unknown user logged in"
537
+ msgstr "Unbekannter Benutzer hat sich angemeldet"
538
 
539
  #: loggers/SimpleUserLogger.php:27
540
  msgid "Logged out"
675
  msgid "Simple History"
676
  msgstr "Simple History"
677
 
678
+ #: SimpleHistory.php:1829
679
+ msgctxt "Log level in gui"
680
+ msgid "emergency"
681
+ msgstr "Notfall"
682
+
683
+ #: SimpleHistory.php:1833
684
+ msgctxt "Log level in gui"
685
+ msgid "alert"
686
+ msgstr "Alarm"
687
+
688
+ #: SimpleHistory.php:1837
689
+ msgctxt "Log level in gui"
690
+ msgid "critical"
691
+ msgstr "Kritisch"
692
+
693
+ #: SimpleHistory.php:1841
694
+ msgctxt "Log level in gui"
695
+ msgid "error"
696
+ msgstr "Fehler"
697
+
698
+ #: SimpleHistory.php:1845
699
+ msgctxt "Log level in gui"
700
+ msgid "warning"
701
+ msgstr "Warnung"
702
+
703
+ #: SimpleHistory.php:1849
704
+ msgctxt "Log level in gui"
705
+ msgid "notice"
706
+ msgstr "Hinweis"
707
+
708
+ #: SimpleHistory.php:1853
709
+ msgctxt "Log level in gui"
710
+ msgid "info"
711
+ msgstr "Information"
712
+
713
+ #: SimpleHistory.php:1857
714
+ msgctxt "Log level in gui"
715
+ msgid "debug"
716
+ msgstr "Fehlersuche"
717
+
718
+ #: SimpleHistory.php:1862
719
+ msgctxt "Log level in gui"
720
+ msgid "Emergency"
721
+ msgstr "Notfall"
722
+
723
+ #: SimpleHistory.php:1866
724
+ msgctxt "Log level in gui"
725
+ msgid "Alert"
726
+ msgstr "Alarm"
727
+
728
+ #: SimpleHistory.php:1870
729
+ msgctxt "Log level in gui"
730
+ msgid "Critical"
731
+ msgstr "Kritisch"
732
+
733
+ #: SimpleHistory.php:1874
734
+ msgctxt "Log level in gui"
735
+ msgid "Error"
736
+ msgstr "Fehler"
737
+
738
+ #: SimpleHistory.php:1878
739
+ msgctxt "Log level in gui"
740
+ msgid "Warning"
741
+ msgstr "Warnung"
742
+
743
+ #: SimpleHistory.php:1882
744
+ msgctxt "Log level in gui"
745
+ msgid "Notice"
746
+ msgstr "Hinweis"
747
+
748
+ #: SimpleHistory.php:1886
749
+ msgctxt "Log level in gui"
750
+ msgid "Info"
751
+ msgstr "Information"
752
+
753
+ #: SimpleHistory.php:1890
754
+ msgctxt "Log level in gui"
755
+ msgid "Debug"
756
+ msgstr "Fehlersuche"
757
+
758
  #: dropins/SimpleHistoryDonateDropin.php:51
759
  msgctxt "donate settings headline"
760
  msgid "Donate"
812
  msgid "RSS feed"
813
  msgstr "RSS-Feed"
814
 
815
+ #: loggers/SimpleCommentsLogger.php:95
816
  msgctxt "A comment was added to the database by a non-logged in internet user"
817
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
818
  msgstr ""
819
  "hat einen Kommentar zu {comment_post_type} \"{comment_post_title}\" "
820
  "hinzugefügt"
821
 
822
+ #: loggers/SimpleCommentsLogger.php:101
823
  msgctxt "A comment was added to the database by a logged in user"
824
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
825
  msgstr ""
826
  "hat einen Kommentar zu {comment_post_type} \"{comment_post_title}\" "
827
  "hinzugefügt"
828
 
829
+ #: loggers/SimpleCommentsLogger.php:107
830
  msgctxt "A comment was approved"
831
  msgid ""
832
  "Approved a comment to \"{comment_post_title}\" by {comment_author} "
835
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
836
  "({comment_author_email}) genehmigt"
837
 
838
+ #: loggers/SimpleCommentsLogger.php:113
839
  msgctxt "A comment was was unapproved"
840
  msgid ""
841
  "Unapproved a comment to \"{comment_post_title}\" by {comment_author} "
844
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
845
  "({comment_author_email}) verworfen"
846
 
847
+ #: loggers/SimpleCommentsLogger.php:119
848
  msgctxt "A comment was marked as spam"
849
  msgid "Marked a comment to post \"{comment_post_title}\" as spam"
850
  msgstr ""
851
  "hat einen Kommentar zum Beitrag \"{comment_post_title}\" als Spam "
852
  "gekennzeichnet"
853
 
854
+ #: loggers/SimpleCommentsLogger.php:125
855
  msgctxt "A comment was marked moved to the trash"
856
  msgid ""
857
  "Trashed a comment to \"{comment_post_title}\" by {comment_author} "
860
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
861
  "({comment_author_email}) in den Papierkorb verschoben"
862
 
863
+ #: loggers/SimpleCommentsLogger.php:131
864
  msgctxt "A comment was restored from the trash"
865
  msgid ""
866
  "Restored a comment to \"{comment_post_title}\" by {comment_author} "
869
  "hat einen Kommentar zu \"{comment_post_title}\" von {comment_author} "
870
  "({comment_author_email}) aus dem Papierkorb wiederhergestellt"
871
 
872
+ #: loggers/SimpleCommentsLogger.php:137
873
  msgctxt "A comment was deleted"
874
  msgid ""
875
  "Deleted a comment to \"{comment_post_title}\" by {comment_author} "
878
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
879
  "({comment_author_email}) gelöscht"
880
 
881
+ #: loggers/SimpleCommentsLogger.php:143
882
  msgctxt "A comment was edited"
883
  msgid ""
884
  "Edited a comment to \"{comment_post_title}\" by {comment_author} "
887
  "hat einen Kommentar zu \"{comment_post_title}\" by {comment_author} "
888
  "({comment_author_email}) geändert"
889
 
890
+ #: loggers/SimpleCommentsLogger.php:150
891
  msgctxt "A trackback was added to the database by a non-logged in internet user"
892
  msgid "Added a trackback to {comment_post_type} \"{comment_post_title}\""
893
  msgstr ""
894
  "hat einen Trackback zu {comment_post_type} \"{comment_post_title}\" "
895
  "hinzugefügt"
896
 
897
+ #: loggers/SimpleCommentsLogger.php:205
898
  msgctxt "A trackback was added to the database by a non-logged in internet user"
899
  msgid "Added a pingback to {comment_post_type} \"{comment_post_title}\""
900
  msgstr ""
901
  "hat ein Pingback zu {comment_post_type} \"{comment_post_title}\" hinzugefügt"
902
 
903
+ #: loggers/SimpleCommentsLogger.php:156
904
  msgctxt "A trackback was added to the database by a logged in user"
905
  msgid "Added a trackback to {comment_post_type} \"{comment_post_title}\""
906
  msgstr ""
907
  "hat einen Trackback zu {comment_post_type} \"{comment_post_title}\" "
908
  "hinzugefügt"
909
 
910
+ #: loggers/SimpleCommentsLogger.php:162
911
  msgctxt "A trackback was approved"
912
  msgid ""
913
  "Approved a trackback to \"{comment_post_title}\" by {comment_author} "
916
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
917
  "({comment_author_email}) genehmigt"
918
 
919
+ #: loggers/SimpleCommentsLogger.php:168
920
  msgctxt "A trackback was was unapproved"
921
  msgid ""
922
  "Unapproved a trackback to \"{comment_post_title}\" by {comment_author} "
925
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
926
  "({comment_author_email}) verworfen"
927
 
928
+ #: loggers/SimpleCommentsLogger.php:174
929
  msgctxt "A trackback was marked as spam"
930
  msgid "Marked a trackback to post \"{comment_post_title}\" as spam"
931
  msgstr ""
932
  "hat einen Trackback zum Beitrag \"{comment_post_title}\" als Spam "
933
  "gekennzeichnet"
934
 
935
+ #: loggers/SimpleCommentsLogger.php:180
936
  msgctxt "A trackback was marked moved to the trash"
937
  msgid ""
938
  "Trashed a trackback to \"{comment_post_title}\" by {comment_author} "
941
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
942
  "({comment_author_email}) in den Papierkorb verschoben"
943
 
944
+ #: loggers/SimpleCommentsLogger.php:186
945
  msgctxt "A trackback was restored from the trash"
946
  msgid ""
947
  "Restored a trackback to \"{comment_post_title}\" by {comment_author} "
950
  "hat einen Trackback zu \"{comment_post_title}\" von {comment_author} "
951
  "({comment_author_email}) aus dem Papierkorb wiederhergestellt"
952
 
953
+ #: loggers/SimpleCommentsLogger.php:192
954
  msgctxt "A trackback was deleted"
955
  msgid ""
956
  "Deleted a trackback to \"{comment_post_title}\" by {comment_author} "
959
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
960
  "({comment_author_email}) gelöscht"
961
 
962
+ #: loggers/SimpleCommentsLogger.php:198
963
  msgctxt "A trackback was edited"
964
  msgid ""
965
  "Edited a trackback to \"{comment_post_title}\" by {comment_author} "
968
  "hat einen Trackback zu \"{comment_post_title}\" by {comment_author} "
969
  "({comment_author_email}) geändert"
970
 
971
+ #: loggers/SimpleCommentsLogger.php:211
972
  msgctxt "A pingback was added to the database by a logged in user"
973
  msgid "Added a pingback to {comment_post_type} \"{comment_post_title}\""
974
  msgstr ""
975
  "hat ein Pingback zu {comment_post_type} \"{comment_post_title}\" hinzugefügt"
976
 
977
+ #: loggers/SimpleCommentsLogger.php:217
978
  msgctxt "A pingback was approved"
979
  msgid ""
980
  "Approved a pingback to \"{comment_post_title}\" by "
983
  "hat ein Pingback zu \"{comment_post_title}\" by "
984
  "\"{comment_author}\"\" ({comment_author_email}) genehmigt"
985
 
986
+ #: loggers/SimpleCommentsLogger.php:223
987
  msgctxt "A pingback was was unapproved"
988
  msgid ""
989
  "Unapproved a pingback to \"{comment_post_title}\" by "
992
  "hat ein Pingback zu \"{comment_post_title}\" by "
993
  "\"{comment_author}\" ({comment_author_email}) verworfen"
994
 
995
+ #: loggers/SimpleCommentsLogger.php:229
996
  msgctxt "A pingback was marked as spam"
997
  msgid "Marked a pingback to post \"{comment_post_title}\" as spam"
998
  msgstr ""
999
  "hat ein Pingback zum Beitrag \"{comment_post_title}\" als Spam gekennzeichnet"
1000
 
1001
+ #: loggers/SimpleCommentsLogger.php:235
1002
  msgctxt "A pingback was marked moved to the trash"
1003
  msgid ""
1004
  "Trashed a pingback to \"{comment_post_title}\" by {comment_author} "
1007
  "hat ein Pingback zu \"{comment_post_title}\" by {comment_author} "
1008
  "({comment_author_email}) in den Papierkorb verschoben"
1009
 
1010
+ #: loggers/SimpleCommentsLogger.php:241
1011
  msgctxt "A pingback was restored from the trash"
1012
  msgid ""
1013
  "Restored a pingback to \"{comment_post_title}\" by {comment_author} "
1016
  "hat ein Pingback zu \"{comment_post_title}\" von {comment_author} "
1017
  "({comment_author_email}) aus dem Papierkorb wiederhergestellt"
1018
 
1019
+ #: loggers/SimpleCommentsLogger.php:247
1020
  msgctxt "A pingback was deleted"
1021
  msgid ""
1022
  "Deleted a pingback to \"{comment_post_title}\" by {comment_author} "
1025
  "hat ein Pingback zu \"{comment_post_title}\" by {comment_author} "
1026
  "({comment_author_email}) gelöscht"
1027
 
1028
+ #: loggers/SimpleCommentsLogger.php:253
1029
  msgctxt "A pingback was edited"
1030
  msgid ""
1031
  "Edited a pingback to \"{comment_post_title}\" by {comment_author} "
1034
  "hat ein Pingback zu \"{comment_post_title}\" by {comment_author} "
1035
  "({comment_author_email}) geändert"
1036
 
1037
+ #: loggers/SimpleCommentsLogger.php:264
1038
  msgctxt "Comments logger: search"
1039
  msgid "Comments"
1040
  msgstr "Kommentare"
1041
 
1042
+ #: loggers/SimpleCommentsLogger.php:265
1043
  msgctxt "Comments logger: search"
1044
  msgid "All comments activity"
1045
  msgstr "Alle Kommentar-Aktivitäten"
1046
 
1047
+ #: loggers/SimpleCommentsLogger.php:267
1048
  msgctxt "Comments logger: search"
1049
  msgid "Added comments"
1050
  msgstr "hinzugefügte Kommentare"
1051
 
1052
+ #: loggers/SimpleCommentsLogger.php:275
1053
  msgctxt "Comments logger: search"
1054
  msgid "Edited comments"
1055
  msgstr "geänderte Kommentare"
1056
 
1057
+ #: loggers/SimpleCommentsLogger.php:280
1058
  msgctxt "Comments logger: search"
1059
  msgid "Approved comments"
1060
  msgstr "genehmigte Kommentare"
1061
 
1062
+ #: loggers/SimpleCommentsLogger.php:285
1063
  msgctxt "Comments logger: search"
1064
  msgid "Held comments"
1065
  msgstr "zurückgehaltene Kommentare"
1066
 
1067
+ #: loggers/SimpleCommentsLogger.php:290
1068
  msgctxt "Comments logger: search"
1069
  msgid "Comments status changed to spam"
1070
  msgstr "als Spam markierte Kommentare"
1071
 
1072
+ #: loggers/SimpleCommentsLogger.php:295
1073
  msgctxt "Comments logger: search"
1074
  msgid "Trashed comments"
1075
  msgstr "in den Papierkorb verschobene Kommentare "
1076
 
1077
+ #: loggers/SimpleCommentsLogger.php:300
1078
  msgctxt "Comments logger: search"
1079
  msgid "Untrashed comments"
1080
  msgstr "wiederhergestellte Kommentare"
1081
 
1082
+ #: loggers/SimpleCommentsLogger.php:305
1083
  msgctxt "Comments logger: search"
1084
  msgid "Deleted comments"
1085
  msgstr "gelöschte Kommentare"
1086
 
1087
+ #: loggers/SimpleCommentsLogger.php:612 loggers/SimpleCommentsLogger.php:625
1088
+ #: loggers/SimpleCommentsLogger.php:639
1089
  msgctxt "comments logger - detailed output comment status"
1090
  msgid "Status"
1091
  msgstr "Status"
1092
 
1093
+ #: loggers/SimpleCommentsLogger.php:614 loggers/SimpleCommentsLogger.php:627
1094
+ #: loggers/SimpleCommentsLogger.php:641
1095
  msgctxt "comments logger - detailed output author"
1096
  msgid "Name"
1097
  msgstr "Name"
1098
 
1099
+ #: loggers/SimpleCommentsLogger.php:615 loggers/SimpleCommentsLogger.php:628
1100
+ #: loggers/SimpleCommentsLogger.php:642
1101
  msgctxt "comments logger - detailed output email"
1102
  msgid "Email"
1103
  msgstr "E-Mail"
1104
 
1105
+ #: loggers/SimpleCommentsLogger.php:616 loggers/SimpleCommentsLogger.php:629
1106
  msgctxt "comments logger - detailed output content"
1107
  msgid "Content"
1108
  msgstr "Inhalt"
1109
 
1110
+ #: loggers/SimpleCommentsLogger.php:643
1111
  msgctxt "comments logger - detailed output content"
1112
  msgid "Comment"
1113
  msgstr "Kommentar"
1114
 
1115
+ #: loggers/SimpleCommentsLogger.php:769
1116
  msgctxt "comments logger - edit comment"
1117
  msgid "View/Edit"
1118
  msgstr "Betrachte/Ändere"
1474
  msgid "M j"
1475
  msgstr "M j"
1476
 
1477
+ #~ msgid "+%1$s more"
1478
+ #~ msgstr "+%1$s mehr"
1479
+
1480
+ #~ msgid "%1$d event today from one user."
1481
+ #~ msgstr "%1$d Ereignis heute von einem Benutzer."
1482
+
1483
+ #~ msgid "%1$d events today from one user."
1484
+ #~ msgstr "%1$d Ereignisse heute von einem Benutzer."
1485
+
1486
  #~ msgid "History"
1487
  #~ msgstr "Historie"
1488
 
languages/simple-history-sv_SE.mo CHANGED
Binary file
languages/simple-history-sv_SE.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Simple History 2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/Simple-History\n"
7
- "POT-Creation-Date: 2015-01-11 15:18:18+00:00\n"
8
- "PO-Revision-Date: 2015-01-11 16:18+0100\n"
9
  "Last-Translator: Pär Thernström <par.thernstrom@gmail.com>\n"
10
  "Language-Team: \n"
11
  "Language: sv\n"
@@ -22,146 +22,150 @@ msgstr ""
22
  "X-Textdomain-Support: yes\n"
23
  "X-Poedit-SearchPath-0: .\n"
24
 
25
- #: SimpleHistory.php:434 SimpleHistory.php:696
26
  msgid "Settings"
27
  msgstr "Inställningar"
28
 
29
- #: SimpleHistory.php:445
30
  msgid "Log (debug)"
31
  msgstr "Logg (debug)"
32
 
33
- #: SimpleHistory.php:450
34
  msgid "Styles example (debug)"
35
  msgstr "Stilexempel (debug)"
36
 
37
  #. Plugin Name of the plugin/theme
38
- #: SimpleHistory.php:711
39
  msgid "Simple History"
40
  msgstr "Simple History"
41
 
42
- #: SimpleHistory.php:787
43
  msgid "Remove all log items?"
44
  msgstr "Ta bort alla händelser?"
45
 
46
- #: SimpleHistory.php:789
47
  msgid "Go to the first page"
48
  msgstr "Gå till första sidan"
49
 
50
- #: SimpleHistory.php:790
51
  msgid "Go to the previous page"
52
  msgstr "Gå till föregående sida"
53
 
54
- #: SimpleHistory.php:791
55
  msgid "Go to the next page"
56
  msgstr "Gå till nästa sida"
57
 
58
- #: SimpleHistory.php:792
59
  msgid "Go to the last page"
60
  msgstr "Gå till sista sidan"
61
 
62
- #: SimpleHistory.php:793
63
  msgid "Current page"
64
  msgstr "Aktuell sida"
65
 
66
- #: SimpleHistory.php:795
67
  msgid "Oups, the log could not be loaded right now."
68
  msgstr "Hoppsan, historiken kunde inte laddas just nu."
69
 
70
- #: SimpleHistory.php:796
71
  msgid "Your search did not match any history events."
72
  msgstr "Din sökning matchade inte några händelser i historiken."
73
 
74
- #: SimpleHistory.php:1090 SimpleHistory.php:1193
75
  msgid "Simple History Settings"
76
  msgstr "Inställningar för Simple History"
77
 
78
- #: SimpleHistory.php:1124
79
  msgid "No valid callback found"
80
  msgstr "Inget giltigt callback hittades."
81
 
82
- #: SimpleHistory.php:1214
83
  msgid "Cleared database"
84
  msgstr "Databasen rensades"
85
 
86
- #: SimpleHistory.php:1241
87
  msgid "Show history"
88
  msgstr "Visa historik"
89
 
90
- #: SimpleHistory.php:1254
91
  msgid "Number of items per page"
92
  msgstr "Antal händelser per sida"
93
 
94
- #: SimpleHistory.php:1266
95
  msgid "Clear log"
96
  msgstr "Rensa logg"
97
 
98
- #: SimpleHistory.php:1406
99
  msgid "on the dashboard"
100
  msgstr "i panelen"
101
 
102
- #: SimpleHistory.php:1411
103
  msgid "as a page under the dashboard menu"
104
  msgstr "som en sida under panel-menyn"
105
 
106
- #: SimpleHistory.php:1427
107
  msgid "Items in the database are automatically removed after %1$s days."
108
  msgstr "Händelser i databasen tas automatiskt bort efter %1$s dagar."
109
 
110
- #: SimpleHistory.php:1429
111
  msgid "Items in the database are kept forever."
112
  msgstr "Händelser i databasen lagras för evigt."
113
 
114
- #: SimpleHistory.php:1433
115
  msgid "Clear log now"
116
  msgstr "Rensa loggen nu"
117
 
118
- #: SimpleHistory.php:1659
119
  msgid "+%1$s similar event"
120
  msgid_plural "+%1$s similar events"
121
  msgstr[0] "+%1$s liknande händelse"
122
  msgstr[1] "+%1$s liknande händelser"
123
 
124
- #: SimpleHistory.php:1666
125
  msgid "Loading…"
126
  msgstr "Laddar historik..."
127
 
128
- #: SimpleHistory.php:1673
129
  msgid "Showing %1$s more"
130
  msgstr "+%1$s fler"
131
 
132
- #: SimpleHistory.php:1692
133
  msgid "Context data"
134
  msgstr "Kontextuell data"
135
 
136
- #: SimpleHistory.php:1693
137
  msgid "This is potentially useful meta data that a logger has saved."
138
  msgstr "Detta eventuellt användbar metadata som en logger har sparat."
139
 
140
- #: SimpleHistory.php:2156
141
  msgid "No events today so far."
142
  msgstr "Inga händelser idag ännu."
143
 
144
- #: SimpleHistory.php:2174
145
  msgid "One event today from one user."
146
  msgstr "En händelse idag från en användare."
147
 
148
- #: SimpleHistory.php:2180
149
  msgid "One event today from one source."
150
  msgstr "En händelse idag från en källa."
151
 
152
- #: SimpleHistory.php:2186
 
 
 
 
153
  msgid "%1$d events today from %2$d users."
154
  msgstr "%1$d händelser idag från %2$d användare."
155
 
156
- #: SimpleHistory.php:2192 SimpleHistory.php:2198
157
  msgid "%1$d events today from one user and one other source."
158
  msgstr "%1$d händelser idag från en användare och från en annan källa."
159
 
160
- #: SimpleHistory.php:2204
161
  msgid "%1$d events today from one user and %3$d other sources."
162
  msgstr "%1$d händelser idag från en användare och från %3$d andra källor."
163
 
164
- #: SimpleHistory.php:2210
165
  msgid "%1$s events today from %2$d users and %3$d other sources."
166
  msgstr "%1$s händelser idag från %2$d användare och %3$d andra källor."
167
 
@@ -177,33 +181,34 @@ msgstr ""
177
  "Om Simple History är användbar för dig så <a href=\"%1$s\">donera</a> eller "
178
  "<a href=\"%2$s\">köp mig något från min Amazon wish list</a>."
179
 
180
- #: dropins/SimpleHistoryFilterDropin.php:43
181
  msgid "Filter history"
182
  msgstr "Filtrera historik"
183
 
184
- #: dropins/SimpleHistoryFilterDropin.php:46
185
- msgid "Search"
186
- msgstr "Sök"
 
187
 
188
- #: dropins/SimpleHistoryFilterDropin.php:50
189
  msgid "All log levels"
190
  msgstr "Alla loggnivåer"
191
 
192
- #: dropins/SimpleHistoryFilterDropin.php:64
193
  msgid "All messages"
194
  msgstr "Alla meddelanden"
195
 
196
- #: dropins/SimpleHistoryFilterDropin.php:118
197
  msgid "All users"
198
  msgstr "Alla användare"
199
 
200
- #: dropins/SimpleHistoryFilterDropin.php:139
201
  msgid "All dates"
202
  msgstr "Alla datum"
203
 
204
- #: dropins/SimpleHistoryFilterDropin.php:153
205
- msgid "Filter"
206
- msgstr "Filtrera"
207
 
208
  #: dropins/SimpleHistoryNewRowsNotifier.php:80
209
  msgid "1 new row"
@@ -281,7 +286,11 @@ msgstr "Testdata (debug)"
281
  msgid "Stats"
282
  msgstr "Statistik"
283
 
284
- #: index.php:55
 
 
 
 
285
  msgid ""
286
  "Simple History is a great plugin, but to use it your server must have at "
287
  "least PHP 5.3 installed (you have version %s)."
@@ -346,10 +355,6 @@ msgstr "Anonym webbanvändare"
346
  msgid "Anonymous user from %1$s"
347
  msgstr "Anonym användare från %1$s"
348
 
349
- #: loggers/SimpleLogger.php:299
350
- msgid "Just now"
351
- msgstr "Just nu"
352
-
353
  #. translators: Date format for log row header, see http:php.net/date
354
  #: loggers/SimpleLogger.php:304
355
  msgid "M j, Y \\a\\t G:i"
@@ -635,108 +640,117 @@ msgstr "Pär Thernström"
635
  msgid "http://simple-history.com/"
636
  msgstr "http://simple-history.com"
637
 
638
- #: SimpleHistory.php:177
639
  msgctxt ""
640
  "Message visible while waiting for log to load from server the first time"
641
  msgid "Loading history..."
642
  msgstr "Laddar historik..."
643
 
644
- #: SimpleHistory.php:214
645
  msgctxt "page n of n"
646
  msgid "of"
647
  msgstr "av"
648
 
649
- #: SimpleHistory.php:285
650
  msgctxt "API: not enought arguments passed"
651
  msgid "Not enough args specified"
652
  msgstr "Inte tillräckligt med arguments specifierade"
653
 
654
- #: SimpleHistory.php:1178
655
  msgctxt "dashboard menu name"
656
  msgid "Simple History"
657
  msgstr "Simple History"
658
 
659
- #: SimpleHistory.php:1303
660
  msgctxt "history page headline"
661
  msgid "Simple History"
662
  msgstr "Simple History"
663
 
664
- #: SimpleHistory.php:1829
 
 
 
 
 
 
 
 
 
665
  msgctxt "Log level in gui"
666
  msgid "emergency"
667
  msgstr "kritiskt"
668
 
669
- #: SimpleHistory.php:1833
670
  msgctxt "Log level in gui"
671
  msgid "alert"
672
  msgstr "alert"
673
 
674
- #: SimpleHistory.php:1837
675
  msgctxt "Log level in gui"
676
  msgid "critical"
677
  msgstr "kritiskt"
678
 
679
- #: SimpleHistory.php:1841
680
  msgctxt "Log level in gui"
681
  msgid "error"
682
  msgstr "error"
683
 
684
- #: SimpleHistory.php:1845
685
  msgctxt "Log level in gui"
686
  msgid "warning"
687
  msgstr "warning"
688
 
689
- #: SimpleHistory.php:1849
690
  msgctxt "Log level in gui"
691
  msgid "notice"
692
  msgstr "notice"
693
 
694
- #: SimpleHistory.php:1853
695
  msgctxt "Log level in gui"
696
  msgid "info"
697
  msgstr "info"
698
 
699
- #: SimpleHistory.php:1857
700
  msgctxt "Log level in gui"
701
  msgid "debug"
702
  msgstr "debug"
703
 
704
- #: SimpleHistory.php:1862
705
  msgctxt "Log level in gui"
706
  msgid "Emergency"
707
  msgstr "Emergency"
708
 
709
- #: SimpleHistory.php:1866
710
  msgctxt "Log level in gui"
711
  msgid "Alert"
712
  msgstr "Alert"
713
 
714
- #: SimpleHistory.php:1870
715
  msgctxt "Log level in gui"
716
  msgid "Critical"
717
  msgstr "Critical"
718
 
719
- #: SimpleHistory.php:1874
720
  msgctxt "Log level in gui"
721
  msgid "Error"
722
  msgstr "Error"
723
 
724
- #: SimpleHistory.php:1878
725
  msgctxt "Log level in gui"
726
  msgid "Warning"
727
  msgstr "Warning"
728
 
729
- #: SimpleHistory.php:1882
730
  msgctxt "Log level in gui"
731
  msgid "Notice"
732
  msgstr "Notice"
733
 
734
- #: SimpleHistory.php:1886
735
  msgctxt "Log level in gui"
736
  msgid "Info"
737
  msgstr "Info"
738
 
739
- #: SimpleHistory.php:1890
740
  msgctxt "Log level in gui"
741
  msgid "Debug"
742
  msgstr "Debug"
@@ -746,6 +760,16 @@ msgctxt "donate settings headline"
746
  msgid "Donate"
747
  msgstr "Donera"
748
 
 
 
 
 
 
 
 
 
 
 
749
  #: dropins/SimpleHistoryIpInfoDropin.php:66
750
  msgctxt "IP Info Dropin"
751
  msgid "That IP address does not seem like a public one."
@@ -797,6 +821,57 @@ msgctxt "rss settings headline"
797
  msgid "RSS feed"
798
  msgstr "RSS-flöde"
799
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
800
  #: loggers/SimpleCommentsLogger.php:95
801
  msgctxt "A comment was added to the database by a non-logged in internet user"
802
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
@@ -1252,7 +1327,7 @@ msgstr ""
1252
  #: loggers/SimplePluginLogger.php:81
1253
  msgctxt "Plugin update failed"
1254
  msgid "Updated plugin \"{plugin_name}\""
1255
- msgstr "Uppdaterade plugin \"{plugin_name}\""
1256
 
1257
  #: loggers/SimplePluginLogger.php:87
1258
  msgctxt "Plugin file edited"
@@ -1270,7 +1345,7 @@ msgid ""
1270
  "Updated plugin \"{plugin_name}\" to {plugin_version} from "
1271
  "{plugin_prev_version}"
1272
  msgstr ""
1273
- "Uppdaterade plugin \"{plugin_name}\" till {plugin_version} från "
1274
  "{plugin_prev_version}"
1275
 
1276
  #: loggers/SimplePluginLogger.php:108
@@ -1448,6 +1523,9 @@ msgctxt "stats: date in rows per day chart"
1448
  msgid "M j"
1449
  msgstr "M j"
1450
 
 
 
 
1451
  #~ msgid "%1$d events today from one user and %3$d other source."
1452
  #~ msgstr "%1$d händelser idag från en användare och från en annan källa."
1453
 
4
  msgstr ""
5
  "Project-Id-Version: Simple History 2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/Simple-History\n"
7
+ "POT-Creation-Date: 2015-01-20 21:16:38+00:00\n"
8
+ "PO-Revision-Date: 2015-01-20 22:17+0100\n"
9
  "Last-Translator: Pär Thernström <par.thernstrom@gmail.com>\n"
10
  "Language-Team: \n"
11
  "Language: sv\n"
22
  "X-Textdomain-Support: yes\n"
23
  "X-Poedit-SearchPath-0: .\n"
24
 
25
+ #: SimpleHistory.php:447 SimpleHistory.php:709
26
  msgid "Settings"
27
  msgstr "Inställningar"
28
 
29
+ #: SimpleHistory.php:458
30
  msgid "Log (debug)"
31
  msgstr "Logg (debug)"
32
 
33
+ #: SimpleHistory.php:463
34
  msgid "Styles example (debug)"
35
  msgstr "Stilexempel (debug)"
36
 
37
  #. Plugin Name of the plugin/theme
38
+ #: SimpleHistory.php:724
39
  msgid "Simple History"
40
  msgstr "Simple History"
41
 
42
+ #: SimpleHistory.php:800
43
  msgid "Remove all log items?"
44
  msgstr "Ta bort alla händelser?"
45
 
46
+ #: SimpleHistory.php:802
47
  msgid "Go to the first page"
48
  msgstr "Gå till första sidan"
49
 
50
+ #: SimpleHistory.php:803
51
  msgid "Go to the previous page"
52
  msgstr "Gå till föregående sida"
53
 
54
+ #: SimpleHistory.php:804
55
  msgid "Go to the next page"
56
  msgstr "Gå till nästa sida"
57
 
58
+ #: SimpleHistory.php:805
59
  msgid "Go to the last page"
60
  msgstr "Gå till sista sidan"
61
 
62
+ #: SimpleHistory.php:806
63
  msgid "Current page"
64
  msgstr "Aktuell sida"
65
 
66
+ #: SimpleHistory.php:808
67
  msgid "Oups, the log could not be loaded right now."
68
  msgstr "Hoppsan, historiken kunde inte laddas just nu."
69
 
70
+ #: SimpleHistory.php:809
71
  msgid "Your search did not match any history events."
72
  msgstr "Din sökning matchade inte några händelser i historiken."
73
 
74
+ #: SimpleHistory.php:1103 SimpleHistory.php:1206
75
  msgid "Simple History Settings"
76
  msgstr "Inställningar för Simple History"
77
 
78
+ #: SimpleHistory.php:1137
79
  msgid "No valid callback found"
80
  msgstr "Inget giltigt callback hittades."
81
 
82
+ #: SimpleHistory.php:1227
83
  msgid "Cleared database"
84
  msgstr "Databasen rensades"
85
 
86
+ #: SimpleHistory.php:1254
87
  msgid "Show history"
88
  msgstr "Visa historik"
89
 
90
+ #: SimpleHistory.php:1267
91
  msgid "Number of items per page"
92
  msgstr "Antal händelser per sida"
93
 
94
+ #: SimpleHistory.php:1279
95
  msgid "Clear log"
96
  msgstr "Rensa logg"
97
 
98
+ #: SimpleHistory.php:1419
99
  msgid "on the dashboard"
100
  msgstr "i panelen"
101
 
102
+ #: SimpleHistory.php:1424
103
  msgid "as a page under the dashboard menu"
104
  msgstr "som en sida under panel-menyn"
105
 
106
+ #: SimpleHistory.php:1440
107
  msgid "Items in the database are automatically removed after %1$s days."
108
  msgstr "Händelser i databasen tas automatiskt bort efter %1$s dagar."
109
 
110
+ #: SimpleHistory.php:1442
111
  msgid "Items in the database are kept forever."
112
  msgstr "Händelser i databasen lagras för evigt."
113
 
114
+ #: SimpleHistory.php:1446
115
  msgid "Clear log now"
116
  msgstr "Rensa loggen nu"
117
 
118
+ #: SimpleHistory.php:1744
119
  msgid "+%1$s similar event"
120
  msgid_plural "+%1$s similar events"
121
  msgstr[0] "+%1$s liknande händelse"
122
  msgstr[1] "+%1$s liknande händelser"
123
 
124
+ #: SimpleHistory.php:1751
125
  msgid "Loading…"
126
  msgstr "Laddar historik..."
127
 
128
+ #: SimpleHistory.php:1758
129
  msgid "Showing %1$s more"
130
  msgstr "+%1$s fler"
131
 
132
+ #: SimpleHistory.php:1777
133
  msgid "Context data"
134
  msgstr "Kontextuell data"
135
 
136
+ #: SimpleHistory.php:1778
137
  msgid "This is potentially useful meta data that a logger has saved."
138
  msgstr "Detta eventuellt användbar metadata som en logger har sparat."
139
 
140
+ #: SimpleHistory.php:2243
141
  msgid "No events today so far."
142
  msgstr "Inga händelser idag ännu."
143
 
144
+ #: SimpleHistory.php:2262
145
  msgid "One event today from one user."
146
  msgstr "En händelse idag från en användare."
147
 
148
+ #: SimpleHistory.php:2268
149
  msgid "One event today from one source."
150
  msgstr "En händelse idag från en källa."
151
 
152
+ #: SimpleHistory.php:2274
153
+ msgid "%1$d events today from one user."
154
+ msgstr "%1$d händelser idag från en användare."
155
+
156
+ #: SimpleHistory.php:2280
157
  msgid "%1$d events today from %2$d users."
158
  msgstr "%1$d händelser idag från %2$d användare."
159
 
160
+ #: SimpleHistory.php:2286 SimpleHistory.php:2292
161
  msgid "%1$d events today from one user and one other source."
162
  msgstr "%1$d händelser idag från en användare och från en annan källa."
163
 
164
+ #: SimpleHistory.php:2298
165
  msgid "%1$d events today from one user and %3$d other sources."
166
  msgstr "%1$d händelser idag från en användare och från %3$d andra källor."
167
 
168
+ #: SimpleHistory.php:2304
169
  msgid "%1$s events today from %2$d users and %3$d other sources."
170
  msgstr "%1$s händelser idag från %2$d användare och %3$d andra källor."
171
 
181
  "Om Simple History är användbar för dig så <a href=\"%1$s\">donera</a> eller "
182
  "<a href=\"%2$s\">köp mig något från min Amazon wish list</a>."
183
 
184
+ #: dropins/SimpleHistoryFilterDropin.php:44
185
  msgid "Filter history"
186
  msgstr "Filtrera historik"
187
 
188
+ #: dropins/SimpleHistoryFilterDropin.php:48
189
+ #: dropins/SimpleHistoryFilterDropin.php:159
190
+ msgid "Search events"
191
+ msgstr "Sök händelser"
192
 
193
+ #: dropins/SimpleHistoryFilterDropin.php:56
194
  msgid "All log levels"
195
  msgstr "Alla loggnivåer"
196
 
197
+ #: dropins/SimpleHistoryFilterDropin.php:70
198
  msgid "All messages"
199
  msgstr "Alla meddelanden"
200
 
201
+ #: dropins/SimpleHistoryFilterDropin.php:124
202
  msgid "All users"
203
  msgstr "Alla användare"
204
 
205
+ #: dropins/SimpleHistoryFilterDropin.php:145
206
  msgid "All dates"
207
  msgstr "Alla datum"
208
 
209
+ #: dropins/SimpleHistoryFilterDropin.php:168
210
+ msgid "Search"
211
+ msgstr "Sök"
212
 
213
  #: dropins/SimpleHistoryNewRowsNotifier.php:80
214
  msgid "1 new row"
286
  msgid "Stats"
287
  msgstr "Statistik"
288
 
289
+ #: dropins/SimpleHistorySidebarDropin.php:159 loggers/SimpleLogger.php:299
290
+ msgid "Just now"
291
+ msgstr "Just nu"
292
+
293
+ #: index.php:59
294
  msgid ""
295
  "Simple History is a great plugin, but to use it your server must have at "
296
  "least PHP 5.3 installed (you have version %s)."
355
  msgid "Anonymous user from %1$s"
356
  msgstr "Anonym användare från %1$s"
357
 
 
 
 
 
358
  #. translators: Date format for log row header, see http:php.net/date
359
  #: loggers/SimpleLogger.php:304
360
  msgid "M j, Y \\a\\t G:i"
640
  msgid "http://simple-history.com/"
641
  msgstr "http://simple-history.com"
642
 
643
+ #: SimpleHistory.php:190
644
  msgctxt ""
645
  "Message visible while waiting for log to load from server the first time"
646
  msgid "Loading history..."
647
  msgstr "Laddar historik..."
648
 
649
+ #: SimpleHistory.php:227
650
  msgctxt "page n of n"
651
  msgid "of"
652
  msgstr "av"
653
 
654
+ #: SimpleHistory.php:298
655
  msgctxt "API: not enought arguments passed"
656
  msgid "Not enough args specified"
657
  msgstr "Inte tillräckligt med arguments specifierade"
658
 
659
+ #: SimpleHistory.php:1191
660
  msgctxt "dashboard menu name"
661
  msgid "Simple History"
662
  msgstr "Simple History"
663
 
664
+ #: SimpleHistory.php:1316
665
  msgctxt "history page headline"
666
  msgid "Simple History"
667
  msgstr "Simple History"
668
 
669
+ #: SimpleHistory.php:1570
670
+ msgctxt "simple-history"
671
+ msgid "Simple History removed one event that were older than {days} days"
672
+ msgid_plural ""
673
+ "Simple History removed {num_rows} events that were older than {days} days"
674
+ msgstr[0] "Simple History raderade en händelse som var äldre än {days} dagar."
675
+ msgstr[1] ""
676
+ "Simple History radera {num_rows} händelser som var äldre än {days} dagar"
677
+
678
+ #: SimpleHistory.php:1914
679
  msgctxt "Log level in gui"
680
  msgid "emergency"
681
  msgstr "kritiskt"
682
 
683
+ #: SimpleHistory.php:1918
684
  msgctxt "Log level in gui"
685
  msgid "alert"
686
  msgstr "alert"
687
 
688
+ #: SimpleHistory.php:1922
689
  msgctxt "Log level in gui"
690
  msgid "critical"
691
  msgstr "kritiskt"
692
 
693
+ #: SimpleHistory.php:1926
694
  msgctxt "Log level in gui"
695
  msgid "error"
696
  msgstr "error"
697
 
698
+ #: SimpleHistory.php:1930
699
  msgctxt "Log level in gui"
700
  msgid "warning"
701
  msgstr "warning"
702
 
703
+ #: SimpleHistory.php:1934
704
  msgctxt "Log level in gui"
705
  msgid "notice"
706
  msgstr "notice"
707
 
708
+ #: SimpleHistory.php:1938
709
  msgctxt "Log level in gui"
710
  msgid "info"
711
  msgstr "info"
712
 
713
+ #: SimpleHistory.php:1942
714
  msgctxt "Log level in gui"
715
  msgid "debug"
716
  msgstr "debug"
717
 
718
+ #: SimpleHistory.php:1947
719
  msgctxt "Log level in gui"
720
  msgid "Emergency"
721
  msgstr "Emergency"
722
 
723
+ #: SimpleHistory.php:1951
724
  msgctxt "Log level in gui"
725
  msgid "Alert"
726
  msgstr "Alert"
727
 
728
+ #: SimpleHistory.php:1955
729
  msgctxt "Log level in gui"
730
  msgid "Critical"
731
  msgstr "Critical"
732
 
733
+ #: SimpleHistory.php:1959
734
  msgctxt "Log level in gui"
735
  msgid "Error"
736
  msgstr "Error"
737
 
738
+ #: SimpleHistory.php:1963
739
  msgctxt "Log level in gui"
740
  msgid "Warning"
741
  msgstr "Warning"
742
 
743
+ #: SimpleHistory.php:1967
744
  msgctxt "Log level in gui"
745
  msgid "Notice"
746
  msgstr "Notice"
747
 
748
+ #: SimpleHistory.php:1971
749
  msgctxt "Log level in gui"
750
  msgid "Info"
751
  msgstr "Info"
752
 
753
+ #: SimpleHistory.php:1975
754
  msgctxt "Log level in gui"
755
  msgid "Debug"
756
  msgstr "Debug"
760
  msgid "Donate"
761
  msgstr "Donera"
762
 
763
+ #: dropins/SimpleHistoryFilterDropin.php:50
764
+ msgctxt "Filter dropin: button to show more search options"
765
+ msgid "Show options"
766
+ msgstr "Visa alternativ"
767
+
768
+ #: dropins/SimpleHistoryFilterDropin.php:160
769
+ msgctxt "Filter dropin: button to hide more search options"
770
+ msgid "Hide options"
771
+ msgstr "Göm alternativ"
772
+
773
  #: dropins/SimpleHistoryIpInfoDropin.php:66
774
  msgctxt "IP Info Dropin"
775
  msgid "That IP address does not seem like a public one."
821
  msgid "RSS feed"
822
  msgstr "RSS-flöde"
823
 
824
+ #: dropins/SimpleHistorySidebarDropin.php:31
825
+ msgctxt "Sidebar box"
826
+ msgid "Simple History is on GitHub"
827
+ msgstr "Simple History finns på GitHub"
828
+
829
+ #: dropins/SimpleHistorySidebarDropin.php:34
830
+ msgctxt "Sidebar box"
831
+ msgid ""
832
+ "You can star, fork, or report issues with this plugin over at the <a href="
833
+ "\"%1$s\">GitHub page</a>."
834
+ msgstr ""
835
+ "Du kan stjärnmärka, forka, eller rapportera problem med tillägget på dess "
836
+ "sida på <a href=\"%1$s\">GitHub</a>."
837
+
838
+ #: dropins/SimpleHistorySidebarDropin.php:48
839
+ msgctxt "Sidebar box"
840
+ msgid "Donate to support development"
841
+ msgstr "Donera för att stödja utvecklingen"
842
+
843
+ #: dropins/SimpleHistorySidebarDropin.php:51
844
+ msgctxt "Sidebar box"
845
+ msgid ""
846
+ "If you like and use Simple History you should <a href=\"%1$s\">donate to keep "
847
+ "this plugin free</a>."
848
+ msgstr ""
849
+ "Om du gillar och använder Simple History så <a href=\"%1$s\">donera så att "
850
+ "tillägget kan fortsätta vara gratis</a>."
851
+
852
+ #: dropins/SimpleHistorySidebarDropin.php:65
853
+ msgctxt "Sidebar box"
854
+ msgid "Review this plugin if you like it"
855
+ msgstr "Recensera tillägget om du gillar det"
856
+
857
+ #: dropins/SimpleHistorySidebarDropin.php:68
858
+ msgctxt "Sidebar box"
859
+ msgid ""
860
+ "If you like Simple History then please <a href=\"%1$s\">give it a nice review "
861
+ "over at wordpress.org</a>."
862
+ msgstr ""
863
+ "Om du gillar Simple History så <a href=\"%1$s\">ge gärna en positiv recension "
864
+ "på wordpress.org</a>."
865
+
866
+ #: dropins/SimpleHistorySidebarDropin.php:72
867
+ msgctxt "Sidebar box"
868
+ msgid ""
869
+ "A good review will help new users find this plugin. And it will make the "
870
+ "plugin author very happy :)"
871
+ msgstr ""
872
+ "En bra recension hjälper nya användare att hitta tillägget. Och det kommer "
873
+ "göra utvecklaren väldigt glad!"
874
+
875
  #: loggers/SimpleCommentsLogger.php:95
876
  msgctxt "A comment was added to the database by a non-logged in internet user"
877
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
1327
  #: loggers/SimplePluginLogger.php:81
1328
  msgctxt "Plugin update failed"
1329
  msgid "Updated plugin \"{plugin_name}\""
1330
+ msgstr "Uppdaterade tillägget \"{plugin_name}\""
1331
 
1332
  #: loggers/SimplePluginLogger.php:87
1333
  msgctxt "Plugin file edited"
1345
  "Updated plugin \"{plugin_name}\" to {plugin_version} from "
1346
  "{plugin_prev_version}"
1347
  msgstr ""
1348
+ "Uppdaterade tillägget \"{plugin_name}\" till {plugin_version} från "
1349
  "{plugin_prev_version}"
1350
 
1351
  #: loggers/SimplePluginLogger.php:108
1523
  msgid "M j"
1524
  msgstr "M j"
1525
 
1526
+ #~ msgid "Filter"
1527
+ #~ msgstr "Filtrera"
1528
+
1529
  #~ msgid "%1$d events today from one user and %3$d other source."
1530
  #~ msgstr "%1$d händelser idag från en användare och från en annan källa."
1531
 
languages/simple-history.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Simple History package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Simple History 2.0.15\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/Simple-History\n"
7
- "POT-Creation-Date: 2015-01-14 20:50:40+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,147 +24,151 @@ msgstr ""
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
- #: SimpleHistory.php:434 SimpleHistory.php:696
28
  msgid "Settings"
29
  msgstr ""
30
 
31
- #: SimpleHistory.php:445
32
  msgid "Log (debug)"
33
  msgstr ""
34
 
35
- #: SimpleHistory.php:450
36
  msgid "Styles example (debug)"
37
  msgstr ""
38
 
39
- #: SimpleHistory.php:711
40
- #. #-#-#-#-# Simple-History.pot (Simple History 2.0.15) #-#-#-#-#
41
  #. Plugin Name of the plugin/theme
42
  msgid "Simple History"
43
  msgstr ""
44
 
45
- #: SimpleHistory.php:787
46
  msgid "Remove all log items?"
47
  msgstr ""
48
 
49
- #: SimpleHistory.php:789
50
  msgid "Go to the first page"
51
  msgstr ""
52
 
53
- #: SimpleHistory.php:790
54
  msgid "Go to the previous page"
55
  msgstr ""
56
 
57
- #: SimpleHistory.php:791
58
  msgid "Go to the next page"
59
  msgstr ""
60
 
61
- #: SimpleHistory.php:792
62
  msgid "Go to the last page"
63
  msgstr ""
64
 
65
- #: SimpleHistory.php:793
66
  msgid "Current page"
67
  msgstr ""
68
 
69
- #: SimpleHistory.php:795
70
  msgid "Oups, the log could not be loaded right now."
71
  msgstr ""
72
 
73
- #: SimpleHistory.php:796
74
  msgid "Your search did not match any history events."
75
  msgstr ""
76
 
77
- #: SimpleHistory.php:1090 SimpleHistory.php:1193
78
  msgid "Simple History Settings"
79
  msgstr ""
80
 
81
- #: SimpleHistory.php:1124
82
  msgid "No valid callback found"
83
  msgstr ""
84
 
85
- #: SimpleHistory.php:1214
86
  msgid "Cleared database"
87
  msgstr ""
88
 
89
- #: SimpleHistory.php:1241
90
  msgid "Show history"
91
  msgstr ""
92
 
93
- #: SimpleHistory.php:1254
94
  msgid "Number of items per page"
95
  msgstr ""
96
 
97
- #: SimpleHistory.php:1266
98
  msgid "Clear log"
99
  msgstr ""
100
 
101
- #: SimpleHistory.php:1406
102
  msgid "on the dashboard"
103
  msgstr ""
104
 
105
- #: SimpleHistory.php:1411
106
  msgid "as a page under the dashboard menu"
107
  msgstr ""
108
 
109
- #: SimpleHistory.php:1427
110
  msgid "Items in the database are automatically removed after %1$s days."
111
  msgstr ""
112
 
113
- #: SimpleHistory.php:1429
114
  msgid "Items in the database are kept forever."
115
  msgstr ""
116
 
117
- #: SimpleHistory.php:1433
118
  msgid "Clear log now"
119
  msgstr ""
120
 
121
- #: SimpleHistory.php:1659
122
  msgid "+%1$s similar event"
123
  msgid_plural "+%1$s similar events"
124
  msgstr[0] ""
125
  msgstr[1] ""
126
 
127
- #: SimpleHistory.php:1666
128
  msgid "Loading…"
129
  msgstr ""
130
 
131
- #: SimpleHistory.php:1673
132
  msgid "Showing %1$s more"
133
  msgstr ""
134
 
135
- #: SimpleHistory.php:1692
136
  msgid "Context data"
137
  msgstr ""
138
 
139
- #: SimpleHistory.php:1693
140
  msgid "This is potentially useful meta data that a logger has saved."
141
  msgstr ""
142
 
143
- #: SimpleHistory.php:2156
144
  msgid "No events today so far."
145
  msgstr ""
146
 
147
- #: SimpleHistory.php:2174
148
  msgid "One event today from one user."
149
  msgstr ""
150
 
151
- #: SimpleHistory.php:2180
152
  msgid "One event today from one source."
153
  msgstr ""
154
 
155
- #: SimpleHistory.php:2186
 
 
 
 
156
  msgid "%1$d events today from %2$d users."
157
  msgstr ""
158
 
159
- #: SimpleHistory.php:2192 SimpleHistory.php:2198
160
  msgid "%1$d events today from one user and one other source."
161
  msgstr ""
162
 
163
- #: SimpleHistory.php:2204
164
  msgid "%1$d events today from one user and %3$d other sources."
165
  msgstr ""
166
 
167
- #: SimpleHistory.php:2210
168
  msgid "%1$s events today from %2$d users and %3$d other sources."
169
  msgstr ""
170
 
@@ -178,32 +182,33 @@ msgid ""
178
  "href=\"%2$s\">buy me something from my Amazon wish list</a>."
179
  msgstr ""
180
 
181
- #: dropins/SimpleHistoryFilterDropin.php:43
182
  msgid "Filter history"
183
  msgstr ""
184
 
185
- #: dropins/SimpleHistoryFilterDropin.php:46
186
- msgid "Search"
 
187
  msgstr ""
188
 
189
- #: dropins/SimpleHistoryFilterDropin.php:50
190
  msgid "All log levels"
191
  msgstr ""
192
 
193
- #: dropins/SimpleHistoryFilterDropin.php:64
194
  msgid "All messages"
195
  msgstr ""
196
 
197
- #: dropins/SimpleHistoryFilterDropin.php:118
198
  msgid "All users"
199
  msgstr ""
200
 
201
- #: dropins/SimpleHistoryFilterDropin.php:139
202
  msgid "All dates"
203
  msgstr ""
204
 
205
- #: dropins/SimpleHistoryFilterDropin.php:153
206
- msgid "Filter"
207
  msgstr ""
208
 
209
  #: dropins/SimpleHistoryNewRowsNotifier.php:80
@@ -275,6 +280,10 @@ msgstr ""
275
  msgid "Stats"
276
  msgstr ""
277
 
 
 
 
 
278
  #: index.php:59
279
  msgid ""
280
  "Simple History is a great plugin, but to use it your server must have at "
@@ -337,10 +346,6 @@ msgstr ""
337
  msgid "Anonymous user from %1$s"
338
  msgstr ""
339
 
340
- #: loggers/SimpleLogger.php:299
341
- msgid "Just now"
342
- msgstr ""
343
-
344
  #: loggers/SimpleLogger.php:304
345
  #. translators: Date format for log row header, see http:php.net/date
346
  msgid "M j, Y \\a\\t G:i"
@@ -608,107 +613,114 @@ msgstr ""
608
  msgid "http://simple-history.com/"
609
  msgstr ""
610
 
611
- #: SimpleHistory.php:177
612
  msgctxt "Message visible while waiting for log to load from server the first time"
613
  msgid "Loading history..."
614
  msgstr ""
615
 
616
- #: SimpleHistory.php:214
617
  msgctxt "page n of n"
618
  msgid "of"
619
  msgstr ""
620
 
621
- #: SimpleHistory.php:285
622
  msgctxt "API: not enought arguments passed"
623
  msgid "Not enough args specified"
624
  msgstr ""
625
 
626
- #: SimpleHistory.php:1178
627
  msgctxt "dashboard menu name"
628
  msgid "Simple History"
629
  msgstr ""
630
 
631
- #: SimpleHistory.php:1303
632
  msgctxt "history page headline"
633
  msgid "Simple History"
634
  msgstr ""
635
 
636
- #: SimpleHistory.php:1829
 
 
 
 
 
 
 
637
  msgctxt "Log level in gui"
638
  msgid "emergency"
639
  msgstr ""
640
 
641
- #: SimpleHistory.php:1833
642
  msgctxt "Log level in gui"
643
  msgid "alert"
644
  msgstr ""
645
 
646
- #: SimpleHistory.php:1837
647
  msgctxt "Log level in gui"
648
  msgid "critical"
649
  msgstr ""
650
 
651
- #: SimpleHistory.php:1841
652
  msgctxt "Log level in gui"
653
  msgid "error"
654
  msgstr ""
655
 
656
- #: SimpleHistory.php:1845
657
  msgctxt "Log level in gui"
658
  msgid "warning"
659
  msgstr ""
660
 
661
- #: SimpleHistory.php:1849
662
  msgctxt "Log level in gui"
663
  msgid "notice"
664
  msgstr ""
665
 
666
- #: SimpleHistory.php:1853
667
  msgctxt "Log level in gui"
668
  msgid "info"
669
  msgstr ""
670
 
671
- #: SimpleHistory.php:1857
672
  msgctxt "Log level in gui"
673
  msgid "debug"
674
  msgstr ""
675
 
676
- #: SimpleHistory.php:1862
677
  msgctxt "Log level in gui"
678
  msgid "Emergency"
679
  msgstr ""
680
 
681
- #: SimpleHistory.php:1866
682
  msgctxt "Log level in gui"
683
  msgid "Alert"
684
  msgstr ""
685
 
686
- #: SimpleHistory.php:1870
687
  msgctxt "Log level in gui"
688
  msgid "Critical"
689
  msgstr ""
690
 
691
- #: SimpleHistory.php:1874
692
  msgctxt "Log level in gui"
693
  msgid "Error"
694
  msgstr ""
695
 
696
- #: SimpleHistory.php:1878
697
  msgctxt "Log level in gui"
698
  msgid "Warning"
699
  msgstr ""
700
 
701
- #: SimpleHistory.php:1882
702
  msgctxt "Log level in gui"
703
  msgid "Notice"
704
  msgstr ""
705
 
706
- #: SimpleHistory.php:1886
707
  msgctxt "Log level in gui"
708
  msgid "Info"
709
  msgstr ""
710
 
711
- #: SimpleHistory.php:1890
712
  msgctxt "Log level in gui"
713
  msgid "Debug"
714
  msgstr ""
@@ -718,6 +730,16 @@ msgctxt "donate settings headline"
718
  msgid "Donate"
719
  msgstr ""
720
 
 
 
 
 
 
 
 
 
 
 
721
  #: dropins/SimpleHistoryIpInfoDropin.php:66
722
  msgctxt "IP Info Dropin"
723
  msgid "That IP address does not seem like a public one."
@@ -769,6 +791,49 @@ msgctxt "rss settings headline"
769
  msgid "RSS feed"
770
  msgstr ""
771
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
  #: loggers/SimpleCommentsLogger.php:95
773
  msgctxt "A comment was added to the database by a non-logged in internet user"
774
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
2
  # This file is distributed under the same license as the Simple History package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Simple History 2.0.16\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/Simple-History\n"
7
+ "POT-Creation-Date: 2015-01-20 21:16:38+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
+ #: SimpleHistory.php:447 SimpleHistory.php:709
28
  msgid "Settings"
29
  msgstr ""
30
 
31
+ #: SimpleHistory.php:458
32
  msgid "Log (debug)"
33
  msgstr ""
34
 
35
+ #: SimpleHistory.php:463
36
  msgid "Styles example (debug)"
37
  msgstr ""
38
 
39
+ #: SimpleHistory.php:724
40
+ #. #-#-#-#-# Simple-History.pot (Simple History 2.0.16) #-#-#-#-#
41
  #. Plugin Name of the plugin/theme
42
  msgid "Simple History"
43
  msgstr ""
44
 
45
+ #: SimpleHistory.php:800
46
  msgid "Remove all log items?"
47
  msgstr ""
48
 
49
+ #: SimpleHistory.php:802
50
  msgid "Go to the first page"
51
  msgstr ""
52
 
53
+ #: SimpleHistory.php:803
54
  msgid "Go to the previous page"
55
  msgstr ""
56
 
57
+ #: SimpleHistory.php:804
58
  msgid "Go to the next page"
59
  msgstr ""
60
 
61
+ #: SimpleHistory.php:805
62
  msgid "Go to the last page"
63
  msgstr ""
64
 
65
+ #: SimpleHistory.php:806
66
  msgid "Current page"
67
  msgstr ""
68
 
69
+ #: SimpleHistory.php:808
70
  msgid "Oups, the log could not be loaded right now."
71
  msgstr ""
72
 
73
+ #: SimpleHistory.php:809
74
  msgid "Your search did not match any history events."
75
  msgstr ""
76
 
77
+ #: SimpleHistory.php:1103 SimpleHistory.php:1206
78
  msgid "Simple History Settings"
79
  msgstr ""
80
 
81
+ #: SimpleHistory.php:1137
82
  msgid "No valid callback found"
83
  msgstr ""
84
 
85
+ #: SimpleHistory.php:1227
86
  msgid "Cleared database"
87
  msgstr ""
88
 
89
+ #: SimpleHistory.php:1254
90
  msgid "Show history"
91
  msgstr ""
92
 
93
+ #: SimpleHistory.php:1267
94
  msgid "Number of items per page"
95
  msgstr ""
96
 
97
+ #: SimpleHistory.php:1279
98
  msgid "Clear log"
99
  msgstr ""
100
 
101
+ #: SimpleHistory.php:1419
102
  msgid "on the dashboard"
103
  msgstr ""
104
 
105
+ #: SimpleHistory.php:1424
106
  msgid "as a page under the dashboard menu"
107
  msgstr ""
108
 
109
+ #: SimpleHistory.php:1440
110
  msgid "Items in the database are automatically removed after %1$s days."
111
  msgstr ""
112
 
113
+ #: SimpleHistory.php:1442
114
  msgid "Items in the database are kept forever."
115
  msgstr ""
116
 
117
+ #: SimpleHistory.php:1446
118
  msgid "Clear log now"
119
  msgstr ""
120
 
121
+ #: SimpleHistory.php:1744
122
  msgid "+%1$s similar event"
123
  msgid_plural "+%1$s similar events"
124
  msgstr[0] ""
125
  msgstr[1] ""
126
 
127
+ #: SimpleHistory.php:1751
128
  msgid "Loading…"
129
  msgstr ""
130
 
131
+ #: SimpleHistory.php:1758
132
  msgid "Showing %1$s more"
133
  msgstr ""
134
 
135
+ #: SimpleHistory.php:1777
136
  msgid "Context data"
137
  msgstr ""
138
 
139
+ #: SimpleHistory.php:1778
140
  msgid "This is potentially useful meta data that a logger has saved."
141
  msgstr ""
142
 
143
+ #: SimpleHistory.php:2243
144
  msgid "No events today so far."
145
  msgstr ""
146
 
147
+ #: SimpleHistory.php:2262
148
  msgid "One event today from one user."
149
  msgstr ""
150
 
151
+ #: SimpleHistory.php:2268
152
  msgid "One event today from one source."
153
  msgstr ""
154
 
155
+ #: SimpleHistory.php:2274
156
+ msgid "%1$d events today from one user."
157
+ msgstr ""
158
+
159
+ #: SimpleHistory.php:2280
160
  msgid "%1$d events today from %2$d users."
161
  msgstr ""
162
 
163
+ #: SimpleHistory.php:2286 SimpleHistory.php:2292
164
  msgid "%1$d events today from one user and one other source."
165
  msgstr ""
166
 
167
+ #: SimpleHistory.php:2298
168
  msgid "%1$d events today from one user and %3$d other sources."
169
  msgstr ""
170
 
171
+ #: SimpleHistory.php:2304
172
  msgid "%1$s events today from %2$d users and %3$d other sources."
173
  msgstr ""
174
 
182
  "href=\"%2$s\">buy me something from my Amazon wish list</a>."
183
  msgstr ""
184
 
185
+ #: dropins/SimpleHistoryFilterDropin.php:44
186
  msgid "Filter history"
187
  msgstr ""
188
 
189
+ #: dropins/SimpleHistoryFilterDropin.php:48
190
+ #: dropins/SimpleHistoryFilterDropin.php:159
191
+ msgid "Search events"
192
  msgstr ""
193
 
194
+ #: dropins/SimpleHistoryFilterDropin.php:56
195
  msgid "All log levels"
196
  msgstr ""
197
 
198
+ #: dropins/SimpleHistoryFilterDropin.php:70
199
  msgid "All messages"
200
  msgstr ""
201
 
202
+ #: dropins/SimpleHistoryFilterDropin.php:124
203
  msgid "All users"
204
  msgstr ""
205
 
206
+ #: dropins/SimpleHistoryFilterDropin.php:145
207
  msgid "All dates"
208
  msgstr ""
209
 
210
+ #: dropins/SimpleHistoryFilterDropin.php:168
211
+ msgid "Search"
212
  msgstr ""
213
 
214
  #: dropins/SimpleHistoryNewRowsNotifier.php:80
280
  msgid "Stats"
281
  msgstr ""
282
 
283
+ #: dropins/SimpleHistorySidebarDropin.php:159 loggers/SimpleLogger.php:299
284
+ msgid "Just now"
285
+ msgstr ""
286
+
287
  #: index.php:59
288
  msgid ""
289
  "Simple History is a great plugin, but to use it your server must have at "
346
  msgid "Anonymous user from %1$s"
347
  msgstr ""
348
 
 
 
 
 
349
  #: loggers/SimpleLogger.php:304
350
  #. translators: Date format for log row header, see http:php.net/date
351
  msgid "M j, Y \\a\\t G:i"
613
  msgid "http://simple-history.com/"
614
  msgstr ""
615
 
616
+ #: SimpleHistory.php:190
617
  msgctxt "Message visible while waiting for log to load from server the first time"
618
  msgid "Loading history..."
619
  msgstr ""
620
 
621
+ #: SimpleHistory.php:227
622
  msgctxt "page n of n"
623
  msgid "of"
624
  msgstr ""
625
 
626
+ #: SimpleHistory.php:298
627
  msgctxt "API: not enought arguments passed"
628
  msgid "Not enough args specified"
629
  msgstr ""
630
 
631
+ #: SimpleHistory.php:1191
632
  msgctxt "dashboard menu name"
633
  msgid "Simple History"
634
  msgstr ""
635
 
636
+ #: SimpleHistory.php:1316
637
  msgctxt "history page headline"
638
  msgid "Simple History"
639
  msgstr ""
640
 
641
+ #: SimpleHistory.php:1570
642
+ msgctxt "simple-history"
643
+ msgid "Simple History removed one event that were older than {days} days"
644
+ msgid_plural "Simple History removed {num_rows} events that were older than {days} days"
645
+ msgstr[0] ""
646
+ msgstr[1] ""
647
+
648
+ #: SimpleHistory.php:1914
649
  msgctxt "Log level in gui"
650
  msgid "emergency"
651
  msgstr ""
652
 
653
+ #: SimpleHistory.php:1918
654
  msgctxt "Log level in gui"
655
  msgid "alert"
656
  msgstr ""
657
 
658
+ #: SimpleHistory.php:1922
659
  msgctxt "Log level in gui"
660
  msgid "critical"
661
  msgstr ""
662
 
663
+ #: SimpleHistory.php:1926
664
  msgctxt "Log level in gui"
665
  msgid "error"
666
  msgstr ""
667
 
668
+ #: SimpleHistory.php:1930
669
  msgctxt "Log level in gui"
670
  msgid "warning"
671
  msgstr ""
672
 
673
+ #: SimpleHistory.php:1934
674
  msgctxt "Log level in gui"
675
  msgid "notice"
676
  msgstr ""
677
 
678
+ #: SimpleHistory.php:1938
679
  msgctxt "Log level in gui"
680
  msgid "info"
681
  msgstr ""
682
 
683
+ #: SimpleHistory.php:1942
684
  msgctxt "Log level in gui"
685
  msgid "debug"
686
  msgstr ""
687
 
688
+ #: SimpleHistory.php:1947
689
  msgctxt "Log level in gui"
690
  msgid "Emergency"
691
  msgstr ""
692
 
693
+ #: SimpleHistory.php:1951
694
  msgctxt "Log level in gui"
695
  msgid "Alert"
696
  msgstr ""
697
 
698
+ #: SimpleHistory.php:1955
699
  msgctxt "Log level in gui"
700
  msgid "Critical"
701
  msgstr ""
702
 
703
+ #: SimpleHistory.php:1959
704
  msgctxt "Log level in gui"
705
  msgid "Error"
706
  msgstr ""
707
 
708
+ #: SimpleHistory.php:1963
709
  msgctxt "Log level in gui"
710
  msgid "Warning"
711
  msgstr ""
712
 
713
+ #: SimpleHistory.php:1967
714
  msgctxt "Log level in gui"
715
  msgid "Notice"
716
  msgstr ""
717
 
718
+ #: SimpleHistory.php:1971
719
  msgctxt "Log level in gui"
720
  msgid "Info"
721
  msgstr ""
722
 
723
+ #: SimpleHistory.php:1975
724
  msgctxt "Log level in gui"
725
  msgid "Debug"
726
  msgstr ""
730
  msgid "Donate"
731
  msgstr ""
732
 
733
+ #: dropins/SimpleHistoryFilterDropin.php:50
734
+ msgctxt "Filter dropin: button to show more search options"
735
+ msgid "Show options"
736
+ msgstr ""
737
+
738
+ #: dropins/SimpleHistoryFilterDropin.php:160
739
+ msgctxt "Filter dropin: button to hide more search options"
740
+ msgid "Hide options"
741
+ msgstr ""
742
+
743
  #: dropins/SimpleHistoryIpInfoDropin.php:66
744
  msgctxt "IP Info Dropin"
745
  msgid "That IP address does not seem like a public one."
791
  msgid "RSS feed"
792
  msgstr ""
793
 
794
+ #: dropins/SimpleHistorySidebarDropin.php:31
795
+ msgctxt "Sidebar box"
796
+ msgid "Simple History is on GitHub"
797
+ msgstr ""
798
+
799
+ #: dropins/SimpleHistorySidebarDropin.php:34
800
+ msgctxt "Sidebar box"
801
+ msgid ""
802
+ "You can star, fork, or report issues with this plugin over at the <a "
803
+ "href=\"%1$s\">GitHub page</a>."
804
+ msgstr ""
805
+
806
+ #: dropins/SimpleHistorySidebarDropin.php:48
807
+ msgctxt "Sidebar box"
808
+ msgid "Donate to support development"
809
+ msgstr ""
810
+
811
+ #: dropins/SimpleHistorySidebarDropin.php:51
812
+ msgctxt "Sidebar box"
813
+ msgid ""
814
+ "If you like and use Simple History you should <a href=\"%1$s\">donate to "
815
+ "keep this plugin free</a>."
816
+ msgstr ""
817
+
818
+ #: dropins/SimpleHistorySidebarDropin.php:65
819
+ msgctxt "Sidebar box"
820
+ msgid "Review this plugin if you like it"
821
+ msgstr ""
822
+
823
+ #: dropins/SimpleHistorySidebarDropin.php:68
824
+ msgctxt "Sidebar box"
825
+ msgid ""
826
+ "If you like Simple History then please <a href=\"%1$s\">give it a nice "
827
+ "review over at wordpress.org</a>."
828
+ msgstr ""
829
+
830
+ #: dropins/SimpleHistorySidebarDropin.php:72
831
+ msgctxt "Sidebar box"
832
+ msgid ""
833
+ "A good review will help new users find this plugin. And it will make the "
834
+ "plugin author very happy :)"
835
+ msgstr ""
836
+
837
  #: loggers/SimpleCommentsLogger.php:95
838
  msgctxt "A comment was added to the database by a non-logged in internet user"
839
  msgid "Added a comment to {comment_post_type} \"{comment_post_title}\""
loggers/SimpleCommentsLogger.php CHANGED
@@ -515,16 +515,6 @@ class SimpleCommentsLogger extends SimpleLogger
515
 
516
  }
517
 
518
- // @TODO: group comments by comment_type comment | trackback | pingback
519
- // OR: different messages for different comment types?
520
- /*
521
- if ( isset( $comment_data["comment_type"] ) ) {
522
-
523
- $comment_type = $comment_data["comment_type"];
524
-
525
- }
526
- */
527
-
528
  $this->infoMessage(
529
  $message,
530
  $context
515
 
516
  }
517
 
 
 
 
 
 
 
 
 
 
 
518
  $this->infoMessage(
519
  $message,
520
  $context
loggers/SimpleLogger.php CHANGED
@@ -8,8 +8,7 @@
8
  *
9
  * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md PSR-3 specification
10
  */
11
- class SimpleLogger
12
- {
13
 
14
  /**
15
  * Unique slug for this logger
@@ -84,7 +83,7 @@ class SimpleLogger
84
  "messages" => array(
85
  // No pre-defined variants
86
  // when adding messages __() or _x() must be used
87
- )
88
 
89
  );
90
 
@@ -106,12 +105,11 @@ class SimpleLogger
106
  }
107
 
108
  /**
109
- * Interpolates context values into the message placeholders.
110
- */
111
- function interpolate($message, $context = array())
112
- {
113
 
114
- if ( ! is_array($context) ) {
115
  return $message;
116
  }
117
 
@@ -140,7 +138,7 @@ class SimpleLogger
140
  $initiator = $row->initiator;
141
  $context = $row->context;
142
 
143
- switch ( $initiator ) {
144
 
145
  case "wp":
146
  $initiator_html .= '<strong class="SimpleHistoryLogitem__inlineDivided">WordPress</strong> ';
@@ -149,47 +147,47 @@ class SimpleLogger
149
  // wp_user = wordpress uses, but user may have been deleted since log entry was added
150
  case "wp_user":
151
 
152
- $user_id = isset( $row->context["_user_id"] ) ? $row->context["_user_id"] : null;
153
 
154
- if ( $user_id > 0 && $user = get_user_by("id", $user_id) ) {
155
 
156
  // Sender is user and user still exists
157
- $is_current_user = ( $user_id == get_current_user_id() ) ? true : false;
158
 
159
  // get user role, as done in user-edit.php
160
- $user_roles = array_intersect( array_values( $user->roles ), array_keys( get_editable_roles() ) );
161
- $user_role = array_shift( $user_roles );
162
  $user_display_name = $user->display_name;
163
 
164
  $tmpl_initiator_html = '
165
  <strong class="SimpleHistoryLogitem__inlineDivided">%3$s</strong>
166
  <span class="SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__headerEmail">%2$s</span>
167
- ';
168
 
169
  // If user who logged this is the currently logged in user
170
  // we replace name and email with just "You"
171
  if ($is_current_user) {
172
  $tmpl_initiator_html = '
173
  <strong class="SimpleHistoryLogitem__inlineDivided">%5$s</strong>
174
- ';
175
  }
176
 
177
- /**
178
- * Filter the format for the user output
179
- *
180
- * @since 2.0
181
- *
182
- * @param string $format.
183
- */
184
  $$tmpl_initiator_html = apply_filters("simple_history/header_initiator_html_existing_user", $tmpl_initiator_html);
185
 
186
  $initiator_html .= sprintf(
187
  $tmpl_initiator_html,
188
- esc_html( $user->user_login ), // 1
189
- esc_html( $user->user_email ), // 2
190
- esc_html( $user_display_name ), // 3
191
- $user_role, // 4
192
- _x("You", "header output when initiator is the currently logged in user", "simple-history") // 5
193
  );
194
 
195
  } else if ($user_id > 0) {
@@ -202,11 +200,11 @@ class SimpleLogger
202
  // _user_email
203
  $initiator_html .= sprintf(
204
  '<strong class="SimpleHistoryLogitem__inlineDivided">' .
205
- __('Deleted user (had id %1$s, email %2$s, login %3$s)', "simple-history") .
206
- '</strong>',
207
- esc_html( $context["_user_id"] ),
208
- esc_html( $context["_user_email"] ),
209
- esc_html( $context["_user_login"] )
210
  );
211
 
212
  }
@@ -215,19 +213,19 @@ class SimpleLogger
215
 
216
  case "web_user":
217
 
218
- if ( empty( $context["_server_remote_addr"] ) ) {
219
 
220
  $initiator_html .= "<strong class='SimpleHistoryLogitem__inlineDivided'>" . __("Anonymous web user", "simple-history") . "</strong> ";
221
 
222
  } else {
223
 
224
- $iplookup_link = sprintf('https://ipinfo.io/%1$s', esc_attr( $context["_server_remote_addr"] ));
225
 
226
  $initiator_html .= "<strong class='SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__anonUserWithIp'>";
227
  $initiator_html .= sprintf(
228
- __('Anonymous user from %1$s', "simple-history"),
229
- "<a target='_blank' href={$iplookup_link} class='SimpleHistoryLogitem__anonUserWithIp__theIp'>" . esc_attr( $context["_server_remote_addr"] ) . "</a>"
230
- );
231
  $initiator_html .= "</strong> ";
232
 
233
  // $initiator_html .= "<strong>" . __("<br><br>Unknown user from {$context["_server_remote_addr"]}") . "</strong>";
@@ -249,21 +247,20 @@ class SimpleLogger
249
  break;
250
 
251
  default:
252
- $initiator_html .= "<strong class='SimpleHistoryLogitem__inlineDivided'>" . esc_html( $initiator ) . "</strong>";
253
 
254
  }
255
 
256
  /**
257
- * Filter generated html for the initiator row header html
258
- *
259
- * @since 2.0
260
- *
261
- * @param string $initiator_html
262
- * @param object $row Log row
263
- */
264
  $initiator_html = apply_filters("simple_history/row_header_initiator_output", $initiator_html, $row);
265
 
266
-
267
  // HTML for date
268
  // Date (should...) always exist
269
  // http://developers.whatwg.org/text-level-semantics.html#the-time-element
@@ -272,44 +269,44 @@ class SimpleLogger
272
  $date_datetime = new DateTime($row->date);
273
 
274
  /**
275
- * Filter how many seconds as most that can pass since an
276
- * event occured to show "nn minutes ago" (human diff time-format) instead of exact date
277
- *
278
- * @since 2.0
279
- *
280
- * @param int $time_ago_max_time Seconds
281
- */
282
  $time_ago_max_time = DAY_IN_SECONDS * 2;
283
  $time_ago_max_time = apply_filters("simple_history/header_time_ago_max_time", $time_ago_max_time);
284
 
285
  /**
286
- * Filter how many seconds as most that can pass since an
287
- * event occured to show "just now" instead of exact date
288
- *
289
- * @since 2.0
290
- *
291
- * @param int $time_ago_max_time Seconds
292
- */
293
  $time_ago_just_now_max_time = 30;
294
  $time_ago_just_now_max_time = apply_filters("simple_history/header_just_now_max_time", $time_ago_just_now_max_time);
295
 
296
- if ( time() - $date_datetime->getTimestamp() <= $time_ago_just_now_max_time ) {
297
 
298
  // show "just now" if event is very recent
299
  $str_when = __("Just now", "simple-history");
300
 
301
- } else if ( time() - $date_datetime->getTimestamp() > $time_ago_max_time ) {
302
 
303
  /* translators: Date format for log row header, see http://php.net/date */
304
- $datef = __( 'M j, Y \a\t G:i', "simple-history" );
305
- $str_when = date_i18n( $datef, $date_datetime->getTimestamp() );
306
 
307
  } else {
308
 
309
  // Show "nn minutes ago" when event is xx seconds ago or earlier
310
- $date_human_time_diff = human_time_diff( $date_datetime->getTimestamp(), time() );
311
  /* translators: 1: last modified date and time in human time diff-format */
312
- $str_when = sprintf( __( '%1$s ago', 'simple-history' ), $date_human_time_diff );
313
 
314
  }
315
 
@@ -330,10 +327,10 @@ class SimpleLogger
330
  // SimpleHistoryLogitem--loglevel-warning
331
  /*
332
  $level_html = sprintf(
333
- '<span class="SimpleHistoryLogitem--logleveltag SimpleHistoryLogitem--logleveltag-%1$s">%1$s</span>',
334
- $row->level
335
  );
336
- */
337
 
338
  // Glue together final result
339
  $template = '%1$s%2$s';
@@ -349,13 +346,13 @@ class SimpleLogger
349
  );
350
 
351
  /**
352
- * Filter generated html for the log row header
353
- *
354
- * @since 2.0
355
- *
356
- * @param string $html
357
- * @param object $row Log row
358
- */
359
  $html = apply_filters("simple_history/row_header_output", $html, $row);
360
 
361
  return $html;
@@ -386,17 +383,20 @@ class SimpleLogger
386
  // Message is translated here, but translation must be added in
387
  // plain text before
388
 
389
- if ( empty( $message_key ) ) {
390
 
391
- // Leave message alone
 
 
 
392
 
393
  } else {
394
 
395
- $message = $this->messages[ $message_key ]["translated_text"];
396
 
397
  }
398
 
399
- $html = $this->interpolate( $message, $row->context );
400
 
401
  // All messages are escaped by default.
402
  // If you need unescaped output override this method
@@ -404,13 +404,13 @@ class SimpleLogger
404
  $html = esc_html($html);
405
 
406
  /**
407
- * Filter generated output for plain text output
408
- *
409
- * @since 2.0
410
- *
411
- * @param string $html
412
- * @param object $row Log row
413
- */
414
  $html = apply_filters("simple_history/row_plain_text_output", $html, $row);
415
 
416
  return $html;
@@ -429,26 +429,26 @@ class SimpleLogger
429
 
430
  $initiator = $row->initiator;
431
 
432
- switch ( $initiator ) {
433
 
434
  // wp_user = wordpress uses, but user may have been deleted since log entry was added
435
  case "wp_user":
436
 
437
  $user_id = isset($row->context["_user_id"]) ? $row->context["_user_id"] : null;
438
 
439
- if ( $user_id > 0 && $user = get_user_by("id", $user_id) ) {
440
 
441
  // Sender was user
442
- $sender_image_html = $this->simpleHistory->get_avatar( $user->user_email, $sender_image_size );
443
 
444
  } else if ($user_id > 0) {
445
 
446
  // Sender was a user, but user is deleted now
447
- $sender_image_html = $this->simpleHistory->get_avatar( "", $sender_image_size );
448
 
449
  } else {
450
 
451
- $sender_image_html = $this->simpleHistory->get_avatar( "", $sender_image_size );
452
 
453
  }
454
 
@@ -456,13 +456,13 @@ class SimpleLogger
456
 
457
  }
458
  /**
459
- * Filter generated output for row image (sender image)
460
- *
461
- * @since 2.0
462
- *
463
- * @param string $sender_image_html
464
- * @param object $row Log row
465
- */
466
  $sender_image_html = apply_filters("simple_history/row_sender_image_output", $sender_image_html, $row);
467
 
468
  return $sender_image_html;
@@ -482,20 +482,19 @@ class SimpleLogger
482
  $html = "";
483
 
484
  /**
485
- * Filter generated output for details
486
- *
487
- * @since 2.0
488
- *
489
- * @param string $html
490
- * @param object $row Log row
491
- */
492
  $html = apply_filters("simple_history/row_details_output", $html, $row);
493
 
494
  return $html;
495
 
496
  }
497
 
498
-
499
  /**
500
  * System is unusable.
501
  *
@@ -503,8 +502,7 @@ class SimpleLogger
503
  * @param array $context
504
  * @return null
505
  */
506
- public static function emergency($message, array $context = array())
507
- {
508
 
509
  return $this->log(SimpleLoggerLogLevels::EMERGENCY, $message, $context);
510
 
@@ -517,21 +515,19 @@ class SimpleLogger
517
  * @param array $context
518
  * @return null
519
  */
520
- public function emergencyMessage($message, array $context = array())
521
- {
522
 
523
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
524
  return;
525
  }
526
 
527
  $context["_message_key"] = $message;
528
- $message = $this->messages[ $message ]["untranslated_text"];
529
 
530
  $this->log(SimpleLoggerLogLevels::EMERGENCY, $message, $context);
531
 
532
  }
533
 
534
-
535
  /**
536
  * Action must be taken immediately.
537
  *
@@ -539,8 +535,7 @@ class SimpleLogger
539
  * @param array $context
540
  * @return null
541
  */
542
- public static function alert($message, array $context = array())
543
- {
544
  return $this->log(SimpleLoggerLogLevels::ALERT, $message, $context);
545
 
546
  }
@@ -552,21 +547,19 @@ class SimpleLogger
552
  * @param array $context
553
  * @return null
554
  */
555
- public function alertMessage($message, array $context = array())
556
- {
557
 
558
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
559
  return;
560
  }
561
 
562
  $context["_message_key"] = $message;
563
- $message = $this->messages[ $message ]["untranslated_text"];
564
 
565
  $this->log(SimpleLoggerLogLevels::ALERT, $message, $context);
566
 
567
  }
568
 
569
-
570
  /**
571
  * Critical conditions.
572
  *
@@ -576,8 +569,7 @@ class SimpleLogger
576
  * @param array $context
577
  * @return null
578
  */
579
- public static function critical($message, array $context = array())
580
- {
581
 
582
  return $this->log(SimpleLoggerLogLevels::CRITICAL, $message, $context);
583
 
@@ -590,21 +582,19 @@ class SimpleLogger
590
  * @param array $context
591
  * @return null
592
  */
593
- public function criticalMessage($message, array $context = array())
594
- {
595
 
596
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
597
  return;
598
  }
599
 
600
  $context["_message_key"] = $message;
601
- $message = $this->messages[ $message ]["untranslated_text"];
602
 
603
  $this->log(SimpleLoggerLogLevels::CRITICAL, $message, $context);
604
 
605
  }
606
 
607
-
608
  /**
609
  * Runtime errors that do not require immediate action but should typically
610
  * be logged and monitored.
@@ -613,8 +603,7 @@ class SimpleLogger
613
  * @param array $context
614
  * @return null
615
  */
616
- public function error($message, array $context = array())
617
- {
618
 
619
  return $this->log(SimpleLoggerLogLevels::ERROR, $message, $context);
620
 
@@ -628,21 +617,19 @@ class SimpleLogger
628
  * @param array $context
629
  * @return null
630
  */
631
- public function errorMessage($message, array $context = array())
632
- {
633
 
634
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
635
  return;
636
  }
637
 
638
  $context["_message_key"] = $message;
639
- $message = $this->messages[ $message ]["untranslated_text"];
640
 
641
  $this->log(SimpleLoggerLogLevels::ERROR, $message, $context);
642
 
643
  }
644
 
645
-
646
  /**
647
  * Exceptional occurrences that are not errors.
648
  *
@@ -653,8 +640,7 @@ class SimpleLogger
653
  * @param array $context
654
  * @return null
655
  */
656
- public function warning($message, array $context = array())
657
- {
658
 
659
  return $this->log(SimpleLoggerLogLevels::WARNING, $message, $context);
660
 
@@ -667,21 +653,19 @@ class SimpleLogger
667
  * @param array $context
668
  * @return null
669
  */
670
- public function warningMessage($message, array $context = array())
671
- {
672
 
673
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
674
  return;
675
  }
676
 
677
  $context["_message_key"] = $message;
678
- $message = $this->messages[ $message ]["untranslated_text"];
679
 
680
  $this->log(SimpleLoggerLogLevels::WARNING, $message, $context);
681
 
682
  }
683
 
684
-
685
  /**
686
  * Normal but significant events.
687
  *
@@ -689,8 +673,7 @@ class SimpleLogger
689
  * @param array $context
690
  * @return null
691
  */
692
- public function notice($message, array $context = array())
693
- {
694
 
695
  return $this->log(SimpleLoggerLogLevels::NOTICE, $message, $context);
696
 
@@ -703,21 +686,19 @@ class SimpleLogger
703
  * @param array $context
704
  * @return null
705
  */
706
- public function noticeMessage($message, array $context = array())
707
- {
708
 
709
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
710
  return;
711
  }
712
 
713
  $context["_message_key"] = $message;
714
- $message = $this->messages[ $message ]["untranslated_text"];
715
 
716
  $this->log(SimpleLoggerLogLevels::NOTICE, $message, $context);
717
 
718
  }
719
 
720
-
721
  /**
722
  * Interesting events.
723
  *
@@ -727,8 +708,7 @@ class SimpleLogger
727
  * @param array $context
728
  * @return null
729
  */
730
- public function info($message, array $context = array())
731
- {
732
 
733
  return $this->log(SimpleLoggerLogLevels::INFO, $message, $context);
734
 
@@ -743,15 +723,14 @@ class SimpleLogger
743
  * @param array $context
744
  * @return null
745
  */
746
- public function infoMessage($message, array $context = array())
747
- {
748
 
749
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
750
  return;
751
  }
752
 
753
  $context["_message_key"] = $message;
754
- $message = $this->messages[ $message ]["untranslated_text"];
755
 
756
  $this->log(SimpleLoggerLogLevels::INFO, $message, $context);
757
 
@@ -764,8 +743,7 @@ class SimpleLogger
764
  * @param array $context
765
  * @return null
766
  */
767
- public function debug($message, array $context = array())
768
- {
769
 
770
  return $this->log(SimpleLoggerLogLevels::DEBUG, $message, $context);
771
 
@@ -778,15 +756,14 @@ class SimpleLogger
778
  * @param array $context
779
  * @return null
780
  */
781
- public function debugMessage($message, array $context = array())
782
- {
783
 
784
- if ( ! isset( $this->messages[ $message ]["untranslated_text"] ) ) {
785
  return;
786
  }
787
 
788
  $context["_message_key"] = $message;
789
- $message = $this->messages[ $message ]["untranslated_text"];
790
 
791
  $this->log(SimpleLoggerLogLevels::DEBUG, $message, $context);
792
 
@@ -800,20 +777,40 @@ class SimpleLogger
800
  * @param array $context
801
  * @return null
802
  */
803
- public function log($level, $message, array $context = array())
804
- {
805
 
806
  global $wpdb;
807
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
808
  /**
809
- * Filter arguments passed to log funtion
810
- *
811
- * @since 2.0
812
- *
813
- * @param string $level
814
- * @param string $message
815
- * @param array $context
816
- */
817
  apply_filters("simple_history/log_arguments", $level, $message, $context);
818
 
819
  /* Store date at utc or local time?
@@ -830,12 +827,12 @@ class SimpleLogger
830
  $db_table = $wpdb->prefix . SimpleHistory::DBTABLE;
831
 
832
  /**
833
- * Filter db table used for simple history events
834
- *
835
- * @since 2.0
836
- *
837
- * @param string $db_table
838
- */
839
  $db_table = apply_filters("simple_history/db_table", $db_table);
840
 
841
  $data = array(
@@ -847,23 +844,23 @@ class SimpleLogger
847
 
848
  // Allow date to be override
849
  // Date must be in format 'Y-m-d H:i:s'
850
- if ( isset( $context["_date"] ) ) {
851
  $data["date"] = $context["_date"];
852
  unset($context["_date"]);
853
  }
854
 
855
  // Add occasions id
856
  $occasions_id = null;
857
- if ( isset( $context["_occasionsID"] ) ) {
858
 
859
  // Minimize risk of similar loggers logging same messages and such and resulting in same occasions id
860
  // by always adding logger slug
861
  $occasions_data = array(
862
  "_occasionsID" => $context["_occasionsID"],
863
- "_loggerSlug" => $this->slug
864
  );
865
- $occasions_id = md5( json_encode($occasions_data) );
866
- unset( $context["_occasionsID"] );
867
 
868
  } else {
869
 
@@ -874,7 +871,7 @@ class SimpleLogger
874
  unset($occasions_data["date"]);
875
 
876
  //sf_d($occasions_data);exit;
877
- $occasions_id = md5( json_encode($occasions_data) );
878
 
879
  }
880
 
@@ -883,19 +880,19 @@ class SimpleLogger
883
  // Log event type, defaults to other if not set
884
  /*
885
  if ( isset( $context["_type"] ) ) {
886
- $data["type"] = $context["_type"];
887
- unset( $context["_type"] );
888
  } else {
889
- $data["type"] = SimpleLoggerLogTypes::OTHER;
890
  }
891
- */
892
 
893
  // Log initiator, defaults to current user if exists, or other if not user exist
894
- if ( isset( $context["_initiator"] ) ) {
895
 
896
  // Manually set in context
897
  $data["initiator"] = $context["_initiator"];
898
- unset( $context["_initiator"] );
899
 
900
  } else {
901
 
@@ -904,13 +901,13 @@ class SimpleLogger
904
  $data["initiator"] = SimpleLoggerLogInitiators::OTHER;
905
 
906
  // Check if user is responsible.
907
- if ( function_exists("wp_get_current_user") ) {
908
 
909
  $current_user = wp_get_current_user();
910
 
911
- if ( isset( $current_user->ID ) && $current_user->ID) {
912
 
913
- $data["initiator"] = SimpleLoggerLogInitiators::WP_USER;;
914
  $context["_user_id"] = $current_user->ID;
915
  $context["_user_login"] = $current_user->user_login;
916
  $context["_user_email"] = $current_user->user_email;
@@ -920,31 +917,31 @@ class SimpleLogger
920
  }
921
 
922
  // If cron then set WordPress as responsible
923
- if ( defined('DOING_CRON') && DOING_CRON ) {
924
 
925
  // Seems to be wp cron running and doing this
926
  $data["initiator"] = SimpleLoggerLogInitiators::WORDPRESS;
927
- $context["_wordpress_cron_running"] = true;
928
 
929
  }
930
 
931
  }
932
 
933
  /**
934
- * Filter data to be saved to db
935
- *
936
- * @since 2.0
937
- *
938
- * @param array $data
939
- */
940
  $data = apply_filters("simple_history/log_insert_data", $data);
941
 
942
  // Insert data into db
943
  // sf_d($db_table, '$db_table');exit;
944
- $result = $wpdb->insert( $db_table, $data );
945
 
946
  // Only save context if able to store row
947
- if ( false === $result ) {
948
 
949
  $history_inserted_id = null;
950
 
@@ -955,29 +952,29 @@ class SimpleLogger
955
  $db_table_contexts = $wpdb->prefix . SimpleHistory::DBTABLE_CONTEXTS;
956
 
957
  /**
958
- * Filter table name for contexts
959
- *
960
- * @since 2.0
961
- *
962
- * @param string $db_table_contexts
963
- */
964
  $db_table_contexts = apply_filters("simple_history/logger_db_table_contexts", $db_table_contexts);
965
 
966
- if ( ! is_array($context) ) {
967
  $context = array();
968
  }
969
 
970
  // Append user id to context, if not already added
971
- if ( ! isset( $context["_user_id"] ) ) {
972
 
973
  // wp_get_current_user is ont available early
974
  // http://codex.wordpress.org/Function_Reference/wp_get_current_user
975
  // https://core.trac.wordpress.org/ticket/14024
976
- if ( function_exists("wp_get_current_user") ) {
977
 
978
  $current_user = wp_get_current_user();
979
 
980
- if ( isset( $current_user->ID ) && $current_user->ID) {
981
  $context["_user_id"] = $current_user->ID;
982
  $context["_user_login"] = $current_user->user_login;
983
  $context["_user_email"] = $current_user->user_email;
@@ -989,35 +986,60 @@ class SimpleLogger
989
 
990
  // Add remote addr to context
991
  // Good to always have
992
- if ( ! isset( $context["_server_remote_addr"] ) ) {
 
 
993
 
994
  // If web server is behind a load balancer then the ip address will always be the same
995
- // apache_request_headers
996
  // See bug report: https://wordpress.org/support/topic/use-x-forwarded-for-http-header-when-logging-remote_addr?replies=1#post-6422981
997
- if ( function_exists("getallheaders") ) {
998
-
999
- $all_headers = getallheaders();
1000
- if ( ! empty( $all_headers["X-Forwarded-For"] ) ) {
1001
- $context["_server_remote_addr"] = $all_headers["X-Forwarded-For"];
1002
- }
1003
 
1004
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1005
 
1006
- // Still no remote addr? Then simply add remote addr
1007
- if ( empty( $context["_server_remote_addr"] ) ) {
1008
- $context["_server_remote_addr"] = $_SERVER["REMOTE_ADDR"];
1009
  }
1010
 
1011
  }
1012
 
1013
  // Append http referer
1014
  // Also good to always have!
1015
- if ( ! isset( $context["_server_http_referer"] ) && isset( $_SERVER["HTTP_REFERER"] ) ) {
1016
  $context["_server_http_referer"] = $_SERVER["HTTP_REFERER"];
1017
  }
1018
 
1019
  // Insert all context values into db
1020
- foreach ( $context as $key => $value ) {
1021
 
1022
  $data = array(
1023
  "history_id" => $history_inserted_id,
@@ -1025,7 +1047,7 @@ class SimpleLogger
1025
  "value" => $value,
1026
  );
1027
 
1028
- $result = $wpdb->insert( $db_table_contexts, $data );
1029
 
1030
  }
1031
 
@@ -1036,7 +1058,21 @@ class SimpleLogger
1036
  // Return $this so we can chain methods
1037
  return $this;
1038
 
1039
- } // log
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1040
 
1041
  /**
1042
  * Override this to add CSS in <head> for your logger.
@@ -1045,14 +1081,14 @@ class SimpleLogger
1045
  */
1046
  function adminCSS() {
1047
  /*
1048
- ?>
1049
- <style>
1050
- body {
1051
- border: 2px solid red;
1052
- }
1053
- </style>
1054
- <?php
1055
- */
1056
  }
1057
 
1058
  /**
@@ -1062,12 +1098,12 @@ class SimpleLogger
1062
  */
1063
  function adminJS() {
1064
  /*
1065
- ?>
1066
- <script>
1067
- console.log("This is outputed in the footer");
1068
- </script>
1069
- <?php
1070
- */
1071
  }
1072
 
1073
  }
@@ -1075,8 +1111,7 @@ class SimpleLogger
1075
  /**
1076
  * Describes log initiator, i.e. who caused to log event to happend
1077
  */
1078
- class SimpleLoggerLogInitiators
1079
- {
1080
 
1081
  // A wordpress user that at the log event created did exist in the wp database
1082
  // May have been deleted when the log is viewed
@@ -1094,7 +1129,6 @@ class SimpleLoggerLogInitiators
1094
  const OTHER = 'other';
1095
  }
1096
 
1097
-
1098
  /**
1099
  * Describes log event type
1100
  * Based on the CRUD-types
@@ -1102,8 +1136,7 @@ class SimpleLoggerLogInitiators
1102
  * More may be added later on if needed
1103
  * Note: not in use at the moment
1104
  */
1105
- class SimpleLoggerLogTypes
1106
- {
1107
  const CREATE = 'create';
1108
  const READ = 'read';
1109
  const UPDATE = 'update';
@@ -1114,8 +1147,7 @@ class SimpleLoggerLogTypes
1114
  /**
1115
  * Describes log levels
1116
  */
1117
- class SimpleLoggerLogLevels
1118
- {
1119
  const EMERGENCY = 'emergency';
1120
  const ALERT = 'alert';
1121
  const CRITICAL = 'critical';
8
  *
9
  * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md PSR-3 specification
10
  */
11
+ class SimpleLogger {
 
12
 
13
  /**
14
  * Unique slug for this logger
83
  "messages" => array(
84
  // No pre-defined variants
85
  // when adding messages __() or _x() must be used
86
+ ),
87
 
88
  );
89
 
105
  }
106
 
107
  /**
108
+ * Interpolates context values into the message placeholders.
109
+ */
110
+ function interpolate($message, $context = array()) {
 
111
 
112
+ if (!is_array($context)) {
113
  return $message;
114
  }
115
 
138
  $initiator = $row->initiator;
139
  $context = $row->context;
140
 
141
+ switch ($initiator) {
142
 
143
  case "wp":
144
  $initiator_html .= '<strong class="SimpleHistoryLogitem__inlineDivided">WordPress</strong> ';
147
  // wp_user = wordpress uses, but user may have been deleted since log entry was added
148
  case "wp_user":
149
 
150
+ $user_id = isset($row->context["_user_id"]) ? $row->context["_user_id"] : null;
151
 
152
+ if ($user_id > 0 && $user = get_user_by("id", $user_id)) {
153
 
154
  // Sender is user and user still exists
155
+ $is_current_user = ($user_id == get_current_user_id()) ? true : false;
156
 
157
  // get user role, as done in user-edit.php
158
+ $user_roles = array_intersect(array_values($user->roles), array_keys(get_editable_roles()));
159
+ $user_role = array_shift($user_roles);
160
  $user_display_name = $user->display_name;
161
 
162
  $tmpl_initiator_html = '
163
  <strong class="SimpleHistoryLogitem__inlineDivided">%3$s</strong>
164
  <span class="SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__headerEmail">%2$s</span>
165
+ ' ;
166
 
167
  // If user who logged this is the currently logged in user
168
  // we replace name and email with just "You"
169
  if ($is_current_user) {
170
  $tmpl_initiator_html = '
171
  <strong class="SimpleHistoryLogitem__inlineDivided">%5$s</strong>
172
+ ' ;
173
  }
174
 
175
+ /**
176
+ * Filter the format for the user output
177
+ *
178
+ * @since 2.0
179
+ *
180
+ * @param string $format.
181
+ */
182
  $$tmpl_initiator_html = apply_filters("simple_history/header_initiator_html_existing_user", $tmpl_initiator_html);
183
 
184
  $initiator_html .= sprintf(
185
  $tmpl_initiator_html,
186
+ esc_html($user->user_login), // 1
187
+ esc_html($user->user_email), // 2
188
+ esc_html($user_display_name), // 3
189
+ $user_role, // 4
190
+ _x("You", "header output when initiator is the currently logged in user", "simple-history") // 5
191
  );
192
 
193
  } else if ($user_id > 0) {
200
  // _user_email
201
  $initiator_html .= sprintf(
202
  '<strong class="SimpleHistoryLogitem__inlineDivided">' .
203
+ __('Deleted user (had id %1$s, email %2$s, login %3$s)', "simple-history") .
204
+ '</strong>',
205
+ esc_html($context["_user_id"]),
206
+ esc_html($context["_user_email"]),
207
+ esc_html($context["_user_login"])
208
  );
209
 
210
  }
213
 
214
  case "web_user":
215
 
216
+ if (empty($context["_server_remote_addr"])) {
217
 
218
  $initiator_html .= "<strong class='SimpleHistoryLogitem__inlineDivided'>" . __("Anonymous web user", "simple-history") . "</strong> ";
219
 
220
  } else {
221
 
222
+ $iplookup_link = sprintf('https://ipinfo.io/%1$s', esc_attr($context["_server_remote_addr"]));
223
 
224
  $initiator_html .= "<strong class='SimpleHistoryLogitem__inlineDivided SimpleHistoryLogitem__anonUserWithIp'>";
225
  $initiator_html .= sprintf(
226
+ __('Anonymous user from %1$s', "simple-history"),
227
+ "<a target='_blank' href={$iplookup_link} class='SimpleHistoryLogitem__anonUserWithIp__theIp'>" . esc_attr($context["_server_remote_addr"]) . "</a>"
228
+ );
229
  $initiator_html .= "</strong> ";
230
 
231
  // $initiator_html .= "<strong>" . __("<br><br>Unknown user from {$context["_server_remote_addr"]}") . "</strong>";
247
  break;
248
 
249
  default:
250
+ $initiator_html .= "<strong class='SimpleHistoryLogitem__inlineDivided'>" . esc_html($initiator) . "</strong>";
251
 
252
  }
253
 
254
  /**
255
+ * Filter generated html for the initiator row header html
256
+ *
257
+ * @since 2.0
258
+ *
259
+ * @param string $initiator_html
260
+ * @param object $row Log row
261
+ */
262
  $initiator_html = apply_filters("simple_history/row_header_initiator_output", $initiator_html, $row);
263
 
 
264
  // HTML for date
265
  // Date (should...) always exist
266
  // http://developers.whatwg.org/text-level-semantics.html#the-time-element
269
  $date_datetime = new DateTime($row->date);
270
 
271
  /**
272
+ * Filter how many seconds as most that can pass since an
273
+ * event occured to show "nn minutes ago" (human diff time-format) instead of exact date
274
+ *
275
+ * @since 2.0
276
+ *
277
+ * @param int $time_ago_max_time Seconds
278
+ */
279
  $time_ago_max_time = DAY_IN_SECONDS * 2;
280
  $time_ago_max_time = apply_filters("simple_history/header_time_ago_max_time", $time_ago_max_time);
281
 
282
  /**
283
+ * Filter how many seconds as most that can pass since an
284
+ * event occured to show "just now" instead of exact date
285
+ *
286
+ * @since 2.0
287
+ *
288
+ * @param int $time_ago_max_time Seconds
289
+ */
290
  $time_ago_just_now_max_time = 30;
291
  $time_ago_just_now_max_time = apply_filters("simple_history/header_just_now_max_time", $time_ago_just_now_max_time);
292
 
293
+ if (time() - $date_datetime->getTimestamp() <= $time_ago_just_now_max_time) {
294
 
295
  // show "just now" if event is very recent
296
  $str_when = __("Just now", "simple-history");
297
 
298
+ } else if (time() - $date_datetime->getTimestamp() > $time_ago_max_time) {
299
 
300
  /* translators: Date format for log row header, see http://php.net/date */
301
+ $datef = __('M j, Y \a\t G:i', "simple-history");
302
+ $str_when = date_i18n($datef, $date_datetime->getTimestamp());
303
 
304
  } else {
305
 
306
  // Show "nn minutes ago" when event is xx seconds ago or earlier
307
+ $date_human_time_diff = human_time_diff($date_datetime->getTimestamp(), time());
308
  /* translators: 1: last modified date and time in human time diff-format */
309
+ $str_when = sprintf(__('%1$s ago', 'simple-history'), $date_human_time_diff);
310
 
311
  }
312
 
327
  // SimpleHistoryLogitem--loglevel-warning
328
  /*
329
  $level_html = sprintf(
330
+ '<span class="SimpleHistoryLogitem--logleveltag SimpleHistoryLogitem--logleveltag-%1$s">%1$s</span>',
331
+ $row->level
332
  );
333
+ */
334
 
335
  // Glue together final result
336
  $template = '%1$s%2$s';
346
  );
347
 
348
  /**
349
+ * Filter generated html for the log row header
350
+ *
351
+ * @since 2.0
352
+ *
353
+ * @param string $html
354
+ * @param object $row Log row
355
+ */
356
  $html = apply_filters("simple_history/row_header_output", $html, $row);
357
 
358
  return $html;
383
  // Message is translated here, but translation must be added in
384
  // plain text before
385
 
386
+ if (empty( $message_key )) {
387
 
388
+ // Message key did not exist, so check if we should translate using textdomain
389
+ if ( ! empty( $row->context["_gettext_domain"] ) ) {
390
+ $message = __( $message, $row->context["_gettext_domain"] );
391
+ }
392
 
393
  } else {
394
 
395
+ $message = $this->messages[$message_key]["translated_text"];
396
 
397
  }
398
 
399
+ $html = $this->interpolate($message, $row->context);
400
 
401
  // All messages are escaped by default.
402
  // If you need unescaped output override this method
404
  $html = esc_html($html);
405
 
406
  /**
407
+ * Filter generated output for plain text output
408
+ *
409
+ * @since 2.0
410
+ *
411
+ * @param string $html
412
+ * @param object $row Log row
413
+ */
414
  $html = apply_filters("simple_history/row_plain_text_output", $html, $row);
415
 
416
  return $html;
429
 
430
  $initiator = $row->initiator;
431
 
432
+ switch ($initiator) {
433
 
434
  // wp_user = wordpress uses, but user may have been deleted since log entry was added
435
  case "wp_user":
436
 
437
  $user_id = isset($row->context["_user_id"]) ? $row->context["_user_id"] : null;
438
 
439
+ if ($user_id > 0 && $user = get_user_by("id", $user_id)) {
440
 
441
  // Sender was user
442
+ $sender_image_html = $this->simpleHistory->get_avatar($user->user_email, $sender_image_size);
443
 
444
  } else if ($user_id > 0) {
445
 
446
  // Sender was a user, but user is deleted now
447
+ $sender_image_html = $this->simpleHistory->get_avatar("", $sender_image_size);
448
 
449
  } else {
450
 
451
+ $sender_image_html = $this->simpleHistory->get_avatar("", $sender_image_size);
452
 
453
  }
454
 
456
 
457
  }
458
  /**
459
+ * Filter generated output for row image (sender image)
460
+ *
461
+ * @since 2.0
462
+ *
463
+ * @param string $sender_image_html
464
+ * @param object $row Log row
465
+ */
466
  $sender_image_html = apply_filters("simple_history/row_sender_image_output", $sender_image_html, $row);
467
 
468
  return $sender_image_html;
482
  $html = "";
483
 
484
  /**
485
+ * Filter generated output for details
486
+ *
487
+ * @since 2.0
488
+ *
489
+ * @param string $html
490
+ * @param object $row Log row
491
+ */
492
  $html = apply_filters("simple_history/row_details_output", $html, $row);
493
 
494
  return $html;
495
 
496
  }
497
 
 
498
  /**
499
  * System is unusable.
500
  *
502
  * @param array $context
503
  * @return null
504
  */
505
+ public static function emergency($message, array $context = array()) {
 
506
 
507
  return $this->log(SimpleLoggerLogLevels::EMERGENCY, $message, $context);
508
 
515
  * @param array $context
516
  * @return null
517
  */
518
+ public function emergencyMessage($message, array $context = array()) {
 
519
 
520
+ if (!isset($this->messages[$message]["untranslated_text"])) {
521
  return;
522
  }
523
 
524
  $context["_message_key"] = $message;
525
+ $message = $this->messages[$message]["untranslated_text"];
526
 
527
  $this->log(SimpleLoggerLogLevels::EMERGENCY, $message, $context);
528
 
529
  }
530
 
 
531
  /**
532
  * Action must be taken immediately.
533
  *
535
  * @param array $context
536
  * @return null
537
  */
538
+ public static function alert($message, array $context = array()) {
 
539
  return $this->log(SimpleLoggerLogLevels::ALERT, $message, $context);
540
 
541
  }
547
  * @param array $context
548
  * @return null
549
  */
550
+ public function alertMessage($message, array $context = array()) {
 
551
 
552
+ if (!isset($this->messages[$message]["untranslated_text"])) {
553
  return;
554
  }
555
 
556
  $context["_message_key"] = $message;
557
+ $message = $this->messages[$message]["untranslated_text"];
558
 
559
  $this->log(SimpleLoggerLogLevels::ALERT, $message, $context);
560
 
561
  }
562
 
 
563
  /**
564
  * Critical conditions.
565
  *
569
  * @param array $context
570
  * @return null
571
  */
572
+ public static function critical($message, array $context = array()) {
 
573
 
574
  return $this->log(SimpleLoggerLogLevels::CRITICAL, $message, $context);
575
 
582
  * @param array $context
583
  * @return null
584
  */
585
+ public function criticalMessage($message, array $context = array()) {
 
586
 
587
+ if (!isset($this->messages[$message]["untranslated_text"])) {
588
  return;
589
  }
590
 
591
  $context["_message_key"] = $message;
592
+ $message = $this->messages[$message]["untranslated_text"];
593
 
594
  $this->log(SimpleLoggerLogLevels::CRITICAL, $message, $context);
595
 
596
  }
597
 
 
598
  /**
599
  * Runtime errors that do not require immediate action but should typically
600
  * be logged and monitored.
603
  * @param array $context
604
  * @return null
605
  */
606
+ public function error($message, array $context = array()) {
 
607
 
608
  return $this->log(SimpleLoggerLogLevels::ERROR, $message, $context);
609
 
617
  * @param array $context
618
  * @return null
619
  */
620
+ public function errorMessage($message, array $context = array()) {
 
621
 
622
+ if (!isset($this->messages[$message]["untranslated_text"])) {
623
  return;
624
  }
625
 
626
  $context["_message_key"] = $message;
627
+ $message = $this->messages[$message]["untranslated_text"];
628
 
629
  $this->log(SimpleLoggerLogLevels::ERROR, $message, $context);
630
 
631
  }
632
 
 
633
  /**
634
  * Exceptional occurrences that are not errors.
635
  *
640
  * @param array $context
641
  * @return null
642
  */
643
+ public function warning($message, array $context = array()) {
 
644
 
645
  return $this->log(SimpleLoggerLogLevels::WARNING, $message, $context);
646
 
653
  * @param array $context
654
  * @return null
655
  */
656
+ public function warningMessage($message, array $context = array()) {
 
657
 
658
+ if (!isset($this->messages[$message]["untranslated_text"])) {
659
  return;
660
  }
661
 
662
  $context["_message_key"] = $message;
663
+ $message = $this->messages[$message]["untranslated_text"];
664
 
665
  $this->log(SimpleLoggerLogLevels::WARNING, $message, $context);
666
 
667
  }
668
 
 
669
  /**
670
  * Normal but significant events.
671
  *
673
  * @param array $context
674
  * @return null
675
  */
676
+ public function notice($message, array $context = array()) {
 
677
 
678
  return $this->log(SimpleLoggerLogLevels::NOTICE, $message, $context);
679
 
686
  * @param array $context
687
  * @return null
688
  */
689
+ public function noticeMessage($message, array $context = array()) {
 
690
 
691
+ if (!isset($this->messages[$message]["untranslated_text"])) {
692
  return;
693
  }
694
 
695
  $context["_message_key"] = $message;
696
+ $message = $this->messages[$message]["untranslated_text"];
697
 
698
  $this->log(SimpleLoggerLogLevels::NOTICE, $message, $context);
699
 
700
  }
701
 
 
702
  /**
703
  * Interesting events.
704
  *
708
  * @param array $context
709
  * @return null
710
  */
711
+ public function info($message, array $context = array()) {
 
712
 
713
  return $this->log(SimpleLoggerLogLevels::INFO, $message, $context);
714
 
723
  * @param array $context
724
  * @return null
725
  */
726
+ public function infoMessage($message, array $context = array()) {
 
727
 
728
+ if (!isset($this->messages[$message]["untranslated_text"])) {
729
  return;
730
  }
731
 
732
  $context["_message_key"] = $message;
733
+ $message = $this->messages[$message]["untranslated_text"];
734
 
735
  $this->log(SimpleLoggerLogLevels::INFO, $message, $context);
736
 
743
  * @param array $context
744
  * @return null
745
  */
746
+ public function debug($message, array $context = array()) {
 
747
 
748
  return $this->log(SimpleLoggerLogLevels::DEBUG, $message, $context);
749
 
756
  * @param array $context
757
  * @return null
758
  */
759
+ public function debugMessage($message, array $context = array()) {
 
760
 
761
+ if (!isset($this->messages[$message]["untranslated_text"])) {
762
  return;
763
  }
764
 
765
  $context["_message_key"] = $message;
766
+ $message = $this->messages[$message]["untranslated_text"];
767
 
768
  $this->log(SimpleLoggerLogLevels::DEBUG, $message, $context);
769
 
777
  * @param array $context
778
  * @return null
779
  */
780
+ public function log($level, $message, array $context = array()) {
 
781
 
782
  global $wpdb;
783
 
784
+ // Check if $message is a translated message, and if so then fetch original
785
+ $sh_latest_translations = $this->simpleHistory->gettextLatestTranslations;
786
+
787
+ if ( ! empty( $sh_latest_translations ) ) {
788
+
789
+ if ( isset( $sh_latest_translations[ $message ] ) ) {
790
+
791
+ // Translation of this phrase was found, so use original phrase instead of translated one
792
+
793
+ // Store textdomain since it's required to translate
794
+ $context["_gettext_domain"] = $sh_latest_translations[$message]["domain"];
795
+
796
+ // These are good to keep when debugging
797
+ // $context["_gettext_org_message"] = $sh_latest_translations[$message]["text"];
798
+ // $context["_gettext_translated_message"] = $sh_latest_translations[$message]["translation"];
799
+
800
+ $message = $sh_latest_translations[ $message ]["text"];
801
+ }
802
+
803
+ }
804
+
805
  /**
806
+ * Filter arguments passed to log funtion
807
+ *
808
+ * @since 2.0
809
+ *
810
+ * @param string $level
811
+ * @param string $message
812
+ * @param array $context
813
+ */
814
  apply_filters("simple_history/log_arguments", $level, $message, $context);
815
 
816
  /* Store date at utc or local time?
827
  $db_table = $wpdb->prefix . SimpleHistory::DBTABLE;
828
 
829
  /**
830
+ * Filter db table used for simple history events
831
+ *
832
+ * @since 2.0
833
+ *
834
+ * @param string $db_table
835
+ */
836
  $db_table = apply_filters("simple_history/db_table", $db_table);
837
 
838
  $data = array(
844
 
845
  // Allow date to be override
846
  // Date must be in format 'Y-m-d H:i:s'
847
+ if (isset($context["_date"])) {
848
  $data["date"] = $context["_date"];
849
  unset($context["_date"]);
850
  }
851
 
852
  // Add occasions id
853
  $occasions_id = null;
854
+ if (isset($context["_occasionsID"])) {
855
 
856
  // Minimize risk of similar loggers logging same messages and such and resulting in same occasions id
857
  // by always adding logger slug
858
  $occasions_data = array(
859
  "_occasionsID" => $context["_occasionsID"],
860
+ "_loggerSlug" => $this->slug,
861
  );
862
+ $occasions_id = md5(json_encode($occasions_data));
863
+ unset($context["_occasionsID"]);
864
 
865
  } else {
866
 
871
  unset($occasions_data["date"]);
872
 
873
  //sf_d($occasions_data);exit;
874
+ $occasions_id = md5(json_encode($occasions_data));
875
 
876
  }
877
 
880
  // Log event type, defaults to other if not set
881
  /*
882
  if ( isset( $context["_type"] ) ) {
883
+ $data["type"] = $context["_type"];
884
+ unset( $context["_type"] );
885
  } else {
886
+ $data["type"] = SimpleLoggerLogTypes::OTHER;
887
  }
888
+ */
889
 
890
  // Log initiator, defaults to current user if exists, or other if not user exist
891
+ if (isset($context["_initiator"])) {
892
 
893
  // Manually set in context
894
  $data["initiator"] = $context["_initiator"];
895
+ unset($context["_initiator"]);
896
 
897
  } else {
898
 
901
  $data["initiator"] = SimpleLoggerLogInitiators::OTHER;
902
 
903
  // Check if user is responsible.
904
+ if (function_exists("wp_get_current_user")) {
905
 
906
  $current_user = wp_get_current_user();
907
 
908
+ if (isset($current_user->ID) && $current_user->ID) {
909
 
910
+ $data["initiator"] = SimpleLoggerLogInitiators::WP_USER;
911
  $context["_user_id"] = $current_user->ID;
912
  $context["_user_login"] = $current_user->user_login;
913
  $context["_user_email"] = $current_user->user_email;
917
  }
918
 
919
  // If cron then set WordPress as responsible
920
+ if (defined('DOING_CRON') && DOING_CRON) {
921
 
922
  // Seems to be wp cron running and doing this
923
  $data["initiator"] = SimpleLoggerLogInitiators::WORDPRESS;
924
+ $context["_wp_cron_running"] = true;
925
 
926
  }
927
 
928
  }
929
 
930
  /**
931
+ * Filter data to be saved to db
932
+ *
933
+ * @since 2.0
934
+ *
935
+ * @param array $data
936
+ */
937
  $data = apply_filters("simple_history/log_insert_data", $data);
938
 
939
  // Insert data into db
940
  // sf_d($db_table, '$db_table');exit;
941
+ $result = $wpdb->insert($db_table, $data);
942
 
943
  // Only save context if able to store row
944
+ if (false === $result) {
945
 
946
  $history_inserted_id = null;
947
 
952
  $db_table_contexts = $wpdb->prefix . SimpleHistory::DBTABLE_CONTEXTS;
953
 
954
  /**
955
+ * Filter table name for contexts
956
+ *
957
+ * @since 2.0
958
+ *
959
+ * @param string $db_table_contexts
960
+ */
961
  $db_table_contexts = apply_filters("simple_history/logger_db_table_contexts", $db_table_contexts);
962
 
963
+ if (!is_array($context)) {
964
  $context = array();
965
  }
966
 
967
  // Append user id to context, if not already added
968
+ if (!isset($context["_user_id"])) {
969
 
970
  // wp_get_current_user is ont available early
971
  // http://codex.wordpress.org/Function_Reference/wp_get_current_user
972
  // https://core.trac.wordpress.org/ticket/14024
973
+ if (function_exists("wp_get_current_user")) {
974
 
975
  $current_user = wp_get_current_user();
976
 
977
+ if (isset($current_user->ID) && $current_user->ID) {
978
  $context["_user_id"] = $current_user->ID;
979
  $context["_user_login"] = $current_user->user_login;
980
  $context["_user_email"] = $current_user->user_email;
986
 
987
  // Add remote addr to context
988
  // Good to always have
989
+ if (!isset($context["_server_remote_addr"])) {
990
+
991
+ $context["_server_remote_addr"] = $_SERVER["REMOTE_ADDR"];
992
 
993
  // If web server is behind a load balancer then the ip address will always be the same
 
994
  // See bug report: https://wordpress.org/support/topic/use-x-forwarded-for-http-header-when-logging-remote_addr?replies=1#post-6422981
995
+ // Note that the x-forwarded-for header can contain multiple ips
996
+ // Also note that the header can be faked
997
+ // Ref: http://stackoverflow.com/questions/753645/how-do-i-get-the-correct-ip-from-http-x-forwarded-for-if-it-contains-multiple-ip
998
+ // Ref: http://blackbe.lt/advanced-method-to-obtain-the-client-ip-in-php/
 
 
999
 
1000
+ // Check for IP in lots of headers
1001
+ // Based on code found here:
1002
+ // http://blackbe.lt/advanced-method-to-obtain-the-client-ip-in-php/
1003
+ $ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED');
1004
+
1005
+ foreach ($ip_keys as $key) {
1006
+
1007
+ if (array_key_exists($key, $_SERVER) === true) {
1008
+
1009
+ // Loop through all IPs
1010
+ $ip_loop_num = 0;
1011
+ foreach (explode(',', $_SERVER[$key]) as $ip) {
1012
+
1013
+ // trim for safety measures
1014
+ $ip = trim($ip);
1015
+
1016
+ // attempt to validate IP
1017
+ if ($this->validate_ip($ip)) {
1018
+
1019
+ // valid, add to context, with loop index appended so we can store many IPs
1020
+ $key_lower = strtolower($key);
1021
+ $context["_server_{$key_lower}_{$ip_loop_num}"] = $ip;
1022
+
1023
+ }
1024
+
1025
+ $ip_loop_num++;
1026
+
1027
+ }
1028
+
1029
+ }
1030
 
 
 
 
1031
  }
1032
 
1033
  }
1034
 
1035
  // Append http referer
1036
  // Also good to always have!
1037
+ if (!isset($context["_server_http_referer"]) && isset($_SERVER["HTTP_REFERER"])) {
1038
  $context["_server_http_referer"] = $_SERVER["HTTP_REFERER"];
1039
  }
1040
 
1041
  // Insert all context values into db
1042
+ foreach ($context as $key => $value) {
1043
 
1044
  $data = array(
1045
  "history_id" => $history_inserted_id,
1047
  "value" => $value,
1048
  );
1049
 
1050
+ $result = $wpdb->insert($db_table_contexts, $data);
1051
 
1052
  }
1053
 
1058
  // Return $this so we can chain methods
1059
  return $this;
1060
 
1061
+ }// log
1062
+
1063
+ /**
1064
+ * Ensures an ip address is both a valid IP and does not fall within
1065
+ * a private network range.
1066
+ */
1067
+ function validate_ip($ip) {
1068
+
1069
+ if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4|FILTER_FLAG_NO_PRIV_RANGE|FILTER_FLAG_NO_RES_RANGE) === false) {
1070
+ return false;
1071
+ }
1072
+
1073
+ return true;
1074
+
1075
+ }
1076
 
1077
  /**
1078
  * Override this to add CSS in <head> for your logger.
1081
  */
1082
  function adminCSS() {
1083
  /*
1084
+ ?>
1085
+ <style>
1086
+ body {
1087
+ border: 2px solid red;
1088
+ }
1089
+ </style>
1090
+ <?php
1091
+ */
1092
  }
1093
 
1094
  /**
1098
  */
1099
  function adminJS() {
1100
  /*
1101
+ ?>
1102
+ <script>
1103
+ console.log("This is outputed in the footer");
1104
+ </script>
1105
+ <?php
1106
+ */
1107
  }
1108
 
1109
  }
1111
  /**
1112
  * Describes log initiator, i.e. who caused to log event to happend
1113
  */
1114
+ class SimpleLoggerLogInitiators {
 
1115
 
1116
  // A wordpress user that at the log event created did exist in the wp database
1117
  // May have been deleted when the log is viewed
1129
  const OTHER = 'other';
1130
  }
1131
 
 
1132
  /**
1133
  * Describes log event type
1134
  * Based on the CRUD-types
1136
  * More may be added later on if needed
1137
  * Note: not in use at the moment
1138
  */
1139
+ class SimpleLoggerLogTypes {
 
1140
  const CREATE = 'create';
1141
  const READ = 'read';
1142
  const UPDATE = 'update';
1147
  /**
1148
  * Describes log levels
1149
  */
1150
+ class SimpleLoggerLogLevels {
 
1151
  const EMERGENCY = 'emergency';
1152
  const ALERT = 'alert';
1153
  const CRITICAL = 'critical';
loggers/SimplePluginLogger.php CHANGED
@@ -147,7 +147,15 @@ class SimplePluginLogger extends SimpleLogger
147
 
148
  //do_action( 'current_screen', $current_screen );
149
  // The first hook where current screen is available
150
- add_action( 'current_screen', array( $this, "save_versions_before_update" ) );
 
 
 
 
 
 
 
 
151
  add_action( 'delete_site_transient_update_plugins', array( $this, "remove_saved_versions" ) );
152
 
153
  // Fires after a plugin has been activated.
@@ -160,7 +168,6 @@ class SimplePluginLogger extends SimpleLogger
160
  // this hook does not fire.
161
  add_action( 'deactivated_plugin', array( $this, "on_deactivated_plugin" ), 10, 2 );
162
 
163
-
164
  // Fires after the upgrades has done it's thing
165
  // Check hook extra for upgrader initiator
166
  //add_action( 'upgrader_post_install', array( $this, "on_upgrader_post_install" ), 10, 3 );
@@ -183,6 +190,16 @@ class SimplePluginLogger extends SimpleLogger
183
 
184
  }
185
 
 
 
 
 
 
 
 
 
 
 
186
  /**
187
  * Detect plugin being deleted
188
  * When WP is done deleting a plugin it sets a transient called plugins_delete_result:
@@ -252,7 +269,7 @@ class SimplePluginLogger extends SimpleLogger
252
  * Save all plugin information before a plugin is updated or removed.
253
  * This way we can know both the old (pre updated/removed) and the current version of the plugin
254
  */
255
- public function save_versions_before_update() {
256
 
257
  $current_screen = get_current_screen();
258
  $request_uri = $_SERVER["SCRIPT_NAME"];
@@ -286,6 +303,7 @@ class SimplePluginLogger extends SimpleLogger
286
  }
287
 
288
  }
 
289
 
290
  /**
291
  * when plugin updates are done wp_clean_plugins_cache() is called,
@@ -359,13 +377,24 @@ class SimplePluginLogger extends SimpleLogger
359
  }
360
 
361
  /**
362
- * Called when a single plugin is updated or installed
363
- * (not bulk)
364
  */
365
  function on_upgrader_process_complete( $plugin_upgrader_instance, $arr_data ) {
366
 
 
 
 
 
367
  /*
368
-
 
 
 
 
 
 
 
 
369
  # WordPress core update
370
 
371
  $arr_data:
147
 
148
  //do_action( 'current_screen', $current_screen );
149
  // The first hook where current screen is available
150
+ //add_action( 'current_screen', array( $this, "save_versions_before_update" ) );
151
+
152
+ /**
153
+ * At least the plugin bulk upgrades fires this action before upgrade
154
+ * We use it to fetch the current version of all plugins, before they are upgraded
155
+ */
156
+ add_filter( 'upgrader_pre_install', array( $this, "save_versions_before_update"), 10, 2);
157
+
158
+ // Clear our transient after an update is done
159
  add_action( 'delete_site_transient_update_plugins', array( $this, "remove_saved_versions" ) );
160
 
161
  // Fires after a plugin has been activated.
168
  // this hook does not fire.
169
  add_action( 'deactivated_plugin', array( $this, "on_deactivated_plugin" ), 10, 2 );
170
 
 
171
  // Fires after the upgrades has done it's thing
172
  // Check hook extra for upgrader initiator
173
  //add_action( 'upgrader_post_install', array( $this, "on_upgrader_post_install" ), 10, 3 );
190
 
191
  }
192
 
193
+ function save_versions_before_update2($bool, $hook_extra) {
194
+
195
+ $plugins = get_plugins();
196
+
197
+ update_option( $this->slug . "_plugin_info_before_update", SimpleHistory::json_encode( $plugins ) );
198
+
199
+ return $bool;
200
+
201
+ }
202
+
203
  /**
204
  * Detect plugin being deleted
205
  * When WP is done deleting a plugin it sets a transient called plugins_delete_result:
269
  * Save all plugin information before a plugin is updated or removed.
270
  * This way we can know both the old (pre updated/removed) and the current version of the plugin
271
  */
272
+ /*public function save_versions_before_update() {
273
 
274
  $current_screen = get_current_screen();
275
  $request_uri = $_SERVER["SCRIPT_NAME"];
303
  }
304
 
305
  }
306
+ */
307
 
308
  /**
309
  * when plugin updates are done wp_clean_plugins_cache() is called,
377
  }
378
 
379
  /**
380
+ * Called when plugins is updated or installed
 
381
  */
382
  function on_upgrader_process_complete( $plugin_upgrader_instance, $arr_data ) {
383
 
384
+ // Can't use get_plugins() here to get version of plugins updated from
385
+ // Tested that, and it will get the new version (and that's the correct answer I guess. but too bad for us..)
386
+ // $plugs = get_plugins();
387
+ // $context["_debug_get_plugins"] = SimpleHistory::json_encode( $plugs );
388
  /*
389
+
390
+ Try with these instead:
391
+ $current = get_site_transient( 'update_plugins' );
392
+ add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4);
393
+
394
+ */
395
+
396
+ /*
397
+
398
  # WordPress core update
399
 
400
  $arr_data:
loggers/SimpleUserLogger.php CHANGED
@@ -3,8 +3,7 @@
3
  /**
4
  * Logs changes to user logins (and logouts)
5
  */
6
- class SimpleUserLogger extends SimpleLogger
7
- {
8
 
9
  public $slug = __CLASS__;
10
 
@@ -33,7 +32,7 @@ class SimpleUserLogger extends SimpleLogger
33
  Text used in admin:
34
  Log Out of All Other Sessions
35
  Left your account logged in at a public computer? Lost your phone? This will log you out everywhere except your current browser
36
- */
37
  'user_session_destroy_others' => _x(
38
  'Logged out from all other sessions',
39
  'User destroys other login sessions for themself',
@@ -42,7 +41,7 @@ class SimpleUserLogger extends SimpleLogger
42
  /*
43
  Text used in admin:
44
  'Log %s out of all sessions' ), $profileuser->display_name );
45
- */
46
  'user_session_destroy_everywhere' => _x(
47
  'Logged out "{user_display_name}" from all sessions',
48
  'User destroys all login sessions for a user',
@@ -57,29 +56,29 @@ class SimpleUserLogger extends SimpleLogger
57
  "options" => array(
58
  _x("Successful user logins", "User logger: search", "simple-history") => array(
59
  "user_logged_in",
60
- "user_unknown_logged_in"
61
  ),
62
  _x("Failed user logins", "User logger: search", "simple-history") => array(
63
  'user_login_failed',
64
- 'user_unknown_login_failed'
65
  ),
66
- _x('User logouts', 'User logger: search', 'simple-history') => array(
67
- "user_logged_out"
68
  ),
69
- _x('Created users', 'User logger: search', 'simple-history') => array(
70
- "user_created"
71
  ),
72
  _x("User profile updates", "User logger: search", "simple-history") => array(
73
- "user_updated_profile"
 
 
 
74
  ),
75
- _x('User deletions', 'User logger: search', 'simple-history') => array(
76
- "user_deleted"
77
- )
78
 
79
- )
80
- ) // end search
81
 
82
- ) // end labels
83
 
84
  );
85
  #sf_d($arr_info);exit;
@@ -93,14 +92,14 @@ class SimpleUserLogger extends SimpleLogger
93
  public function loaded() {
94
 
95
  // Plain logins and logouts
96
- add_action("wp_login", array($this, "on_wp_login" ), 10, 3 );
97
- add_action("wp_logout", array($this, "on_wp_logout" ) );
98
 
99
  // Failed login attempt to username that exists
100
  add_action("wp_authenticate_user", array($this, "on_wp_authenticate_user"), 10, 2);
101
 
102
  // Failed to login to user that did not exist (perhaps brute force)
103
- add_filter( 'authenticate', array($this, "on_authenticate"), 10, 3);
104
 
105
  // User is changed
106
  add_action("profile_update", array($this, "on_profile_update"), 10, 2);
@@ -109,14 +108,13 @@ class SimpleUserLogger extends SimpleLogger
109
  add_action("user_register", array($this, "on_user_register"), 10, 2);
110
 
111
  // User is deleted
112
- add_action( 'delete_user', array($this, "on_delete_user"), 10, 2 );
113
 
114
  // User sessions is destroyed. AJAX call that we hook onto early.
115
  add_action("wp_ajax_destroy-sessions", array($this, "on_destroy_user_session"), 0);
116
 
117
  }
118
 
119
-
120
  /**
121
  * Called when user dessions are destroyed from admin
122
  * Can be called for current logged in user = destroy all other sessions
@@ -129,31 +127,31 @@ class SimpleUserLogger extends SimpleLogger
129
 
130
  /*
131
  Post params:
132
- nonce: a14df12195
133
- user_id: 1
134
- action: destroy-sessions
135
- */
136
 
137
- $user = get_userdata( (int) $_POST['user_id'] );
138
 
139
- if ( $user ) {
140
- if ( ! current_user_can( 'edit_user', $user->ID ) ) {
141
  $user = false;
142
- } elseif ( ! wp_verify_nonce( $_POST['nonce'], 'update-user_' . $user->ID ) ) {
143
  $user = false;
144
  }
145
  }
146
 
147
- if ( ! $user ) {
148
  // Could not log out user sessions. Please try again.
149
  return;
150
  }
151
 
152
- $sessions = WP_Session_Tokens::get_instance( $user->ID );
153
 
154
  $context = array();
155
 
156
- if ( $user->ID === get_current_user_id() ) {
157
 
158
  $this->infoMessage("user_session_destroy_others");
159
 
@@ -178,11 +176,11 @@ class SimpleUserLogger extends SimpleLogger
178
  */
179
  public function on_delete_user($user_id, $reassign) {
180
 
181
- $wp_user_to_delete = get_userdata( $user_id );
182
 
183
  // wp_user->roles (array) - the roles the user is part of.
184
  $role = null;
185
- if ( is_array( $wp_user_to_delete->roles ) && ! empty( $wp_user_to_delete->roles[0] ) ) {
186
  $role = $wp_user_to_delete->roles[0];
187
  }
188
 
@@ -210,20 +208,20 @@ class SimpleUserLogger extends SimpleLogger
210
  $output = parent::getLogRowPlainTextOutput($row);
211
  $current_user_id = get_current_user_id();
212
 
213
- if ( "user_updated_profile" == $context["_message_key"]) {
214
 
215
- $wp_user = get_user_by( "id", $context["edited_user_id"] );
216
 
217
  // If edited_user_id and _user_id is the same then a user edited their own profile
218
  // Note: it's not the same thing as the currently logged in user (but.. it can be!)
219
- if ( $context["edited_user_id"] === $context["_user_id"] ) {
220
 
221
  if ($wp_user) {
222
 
223
- $context["edit_profile_link"] = get_edit_user_link( $wp_user->ID );
224
 
225
  // User still exist, so link to their profile
226
- if ( $current_user_id === $context["_user_id"] ) {
227
 
228
  // User that is viewing the log is the same as the edited user
229
  $msg = __('Edited <a href="{edit_profile_link}">your profile</a>', "simple-history");
@@ -251,7 +249,7 @@ class SimpleUserLogger extends SimpleLogger
251
  // Edited user still exist, so link to their profile
252
  $context["edit_profile_link"] = get_edit_user_link($wp_user->ID);
253
  $msg = __('Edited the profile for user <a href="{edit_profile_link}">{edited_user_login} ({edited_user_email})</a>', "simple-history");
254
- $output = $this->interpolate( $msg, $context );
255
 
256
  } else {
257
 
@@ -261,12 +259,11 @@ class SimpleUserLogger extends SimpleLogger
261
 
262
  }
263
 
264
- } // if user_updated_profile
265
 
266
  return $output;
267
  }
268
 
269
-
270
  /**
271
  * User logs in
272
  *
@@ -277,12 +274,12 @@ class SimpleUserLogger extends SimpleLogger
277
 
278
  $context = array();
279
 
280
- if ( $user->ID ) {
281
 
282
  $context = array(
283
  "user_id" => $user->ID,
284
  "user_email" => $user->user_email,
285
- "user_login" => $user->user_login
286
  );
287
 
288
  // Override some data that is usually set automagically by Simple History
@@ -298,8 +295,23 @@ class SimpleUserLogger extends SimpleLogger
298
  } else {
299
 
300
  // when does this happen?
301
- $this->warningMessage("user_unknown_logged_in", $context );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
 
 
303
 
304
  }
305
 
@@ -320,10 +332,11 @@ class SimpleUserLogger extends SimpleLogger
320
  */
321
  function on_profile_update($user_id) {
322
 
323
- if ( ! $user_id || ! is_numeric($user_id))
324
  return;
 
325
 
326
- $wp_user_edited = get_userdata( $user_id );
327
 
328
  $context = array(
329
  "edited_user_id" => $wp_user_edited->ID,
@@ -341,14 +354,15 @@ class SimpleUserLogger extends SimpleLogger
341
  */
342
  function on_user_register($user_id) {
343
 
344
- if ( ! $user_id || ! is_numeric($user_id))
345
  return;
 
346
 
347
- $wp_user_added = get_userdata( $user_id );
348
 
349
  // wp_user->roles (array) - the roles the user is part of.
350
  $role = null;
351
- if ( is_array( $wp_user_added->roles ) && ! empty( $wp_user_added->roles[0] ) ) {
352
  $role = $wp_user_added->roles[0];
353
  }
354
 
@@ -373,7 +387,7 @@ class SimpleUserLogger extends SimpleLogger
373
  function on_wp_authenticate_user($user, $password) {
374
 
375
  // Only log failed attempts
376
- if ( ! wp_check_password($password, $user->user_pass, $user->ID) ) {
377
 
378
  // Overwrite some vars that Simple History set automagically
379
  $context = array(
@@ -386,7 +400,7 @@ class SimpleUserLogger extends SimpleLogger
386
  "login_user_login" => $user->user_login,
387
  "server_http_user_agent" => $_SERVER["HTTP_USER_AGENT"],
388
  //"_occasionsID" => __CLASS__ . '/' . __FUNCTION__ . "/failed_user_login/userid:{$user->ID}"
389
- "_occasionsID" => __CLASS__ . '/failed_user_login'
390
  );
391
 
392
  /**
@@ -411,20 +425,19 @@ class SimpleUserLogger extends SimpleLogger
411
 
412
  }
413
 
414
-
415
  /**
416
  * Attempt to login to user that does not exist
417
  */
418
  function on_authenticate($user, $username, $password) {
419
 
420
  // Don't log empty usernames
421
- if ( ! trim($username)) {
422
  return $user;
423
  }
424
 
425
  // If username is not a user in the system then this
426
  // is consideraded a failed login attempt
427
- $wp_user = get_user_by( "login", $username );
428
 
429
  if (false === $wp_user) {
430
 
@@ -438,7 +451,7 @@ class SimpleUserLogger extends SimpleLogger
438
  // Use same occasionsID as for failed login attempts to existing users,
439
  // because log can flood otherwise if hacker is rotating existing and non-existing usernames
440
  //"_occasionsID" => __CLASS__ . '/' . __FUNCTION__ . "/failed_user_login/userid:{$user->ID}"
441
- "_occasionsID" => __CLASS__ . '/failed_user_login'
442
  );
443
 
444
  /**
3
  /**
4
  * Logs changes to user logins (and logouts)
5
  */
6
+ class SimpleUserLogger extends SimpleLogger {
 
7
 
8
  public $slug = __CLASS__;
9
 
32
  Text used in admin:
33
  Log Out of All Other Sessions
34
  Left your account logged in at a public computer? Lost your phone? This will log you out everywhere except your current browser
35
+ */
36
  'user_session_destroy_others' => _x(
37
  'Logged out from all other sessions',
38
  'User destroys other login sessions for themself',
41
  /*
42
  Text used in admin:
43
  'Log %s out of all sessions' ), $profileuser->display_name );
44
+ */
45
  'user_session_destroy_everywhere' => _x(
46
  'Logged out "{user_display_name}" from all sessions',
47
  'User destroys all login sessions for a user',
56
  "options" => array(
57
  _x("Successful user logins", "User logger: search", "simple-history") => array(
58
  "user_logged_in",
59
+ "user_unknown_logged_in",
60
  ),
61
  _x("Failed user logins", "User logger: search", "simple-history") => array(
62
  'user_login_failed',
63
+ 'user_unknown_login_failed',
64
  ),
65
+ _x('User logouts', 'User logger: search', 'simple-history') => array(
66
+ "user_logged_out",
67
  ),
68
+ _x('Created users', 'User logger: search', 'simple-history') => array(
69
+ "user_created",
70
  ),
71
  _x("User profile updates", "User logger: search", "simple-history") => array(
72
+ "user_updated_profile",
73
+ ),
74
+ _x('User deletions', 'User logger: search', 'simple-history') => array(
75
+ "user_deleted",
76
  ),
 
 
 
77
 
78
+ ),
79
+ ), // end search
80
 
81
+ ), // end labels
82
 
83
  );
84
  #sf_d($arr_info);exit;
92
  public function loaded() {
93
 
94
  // Plain logins and logouts
95
+ add_action("wp_login", array($this, "on_wp_login"), 10, 3);
96
+ add_action("wp_logout", array($this, "on_wp_logout"));
97
 
98
  // Failed login attempt to username that exists
99
  add_action("wp_authenticate_user", array($this, "on_wp_authenticate_user"), 10, 2);
100
 
101
  // Failed to login to user that did not exist (perhaps brute force)
102
+ add_filter('authenticate', array($this, "on_authenticate"), 10, 3);
103
 
104
  // User is changed
105
  add_action("profile_update", array($this, "on_profile_update"), 10, 2);
108
  add_action("user_register", array($this, "on_user_register"), 10, 2);
109
 
110
  // User is deleted
111
+ add_action('delete_user', array($this, "on_delete_user"), 10, 2);
112
 
113
  // User sessions is destroyed. AJAX call that we hook onto early.
114
  add_action("wp_ajax_destroy-sessions", array($this, "on_destroy_user_session"), 0);
115
 
116
  }
117
 
 
118
  /**
119
  * Called when user dessions are destroyed from admin
120
  * Can be called for current logged in user = destroy all other sessions
127
 
128
  /*
129
  Post params:
130
+ nonce: a14df12195
131
+ user_id: 1
132
+ action: destroy-sessions
133
+ */
134
 
135
+ $user = get_userdata((int) $_POST['user_id']);
136
 
137
+ if ($user) {
138
+ if (!current_user_can('edit_user', $user->ID)) {
139
  $user = false;
140
+ } elseif (!wp_verify_nonce($_POST['nonce'], 'update-user_' . $user->ID)) {
141
  $user = false;
142
  }
143
  }
144
 
145
+ if (!$user) {
146
  // Could not log out user sessions. Please try again.
147
  return;
148
  }
149
 
150
+ $sessions = WP_Session_Tokens::get_instance($user->ID);
151
 
152
  $context = array();
153
 
154
+ if ($user->ID === get_current_user_id()) {
155
 
156
  $this->infoMessage("user_session_destroy_others");
157
 
176
  */
177
  public function on_delete_user($user_id, $reassign) {
178
 
179
+ $wp_user_to_delete = get_userdata($user_id);
180
 
181
  // wp_user->roles (array) - the roles the user is part of.
182
  $role = null;
183
+ if (is_array($wp_user_to_delete->roles) && !empty($wp_user_to_delete->roles[0])) {
184
  $role = $wp_user_to_delete->roles[0];
185
  }
186
 
208
  $output = parent::getLogRowPlainTextOutput($row);
209
  $current_user_id = get_current_user_id();
210
 
211
+ if ("user_updated_profile" == $context["_message_key"]) {
212
 
213
+ $wp_user = get_user_by("id", $context["edited_user_id"]);
214
 
215
  // If edited_user_id and _user_id is the same then a user edited their own profile
216
  // Note: it's not the same thing as the currently logged in user (but.. it can be!)
217
+ if ($context["edited_user_id"] === $context["_user_id"]) {
218
 
219
  if ($wp_user) {
220
 
221
+ $context["edit_profile_link"] = get_edit_user_link($wp_user->ID);
222
 
223
  // User still exist, so link to their profile
224
+ if ($current_user_id === $context["_user_id"]) {
225
 
226
  // User that is viewing the log is the same as the edited user
227
  $msg = __('Edited <a href="{edit_profile_link}">your profile</a>', "simple-history");
249
  // Edited user still exist, so link to their profile
250
  $context["edit_profile_link"] = get_edit_user_link($wp_user->ID);
251
  $msg = __('Edited the profile for user <a href="{edit_profile_link}">{edited_user_login} ({edited_user_email})</a>', "simple-history");
252
+ $output = $this->interpolate($msg, $context);
253
 
254
  } else {
255
 
259
 
260
  }
261
 
262
+ }// if user_updated_profile
263
 
264
  return $output;
265
  }
266
 
 
267
  /**
268
  * User logs in
269
  *
274
 
275
  $context = array();
276
 
277
+ if ($user->ID) {
278
 
279
  $context = array(
280
  "user_id" => $user->ID,
281
  "user_email" => $user->user_email,
282
+ "user_login" => $user->user_login,
283
  );
284
 
285
  // Override some data that is usually set automagically by Simple History
295
  } else {
296
 
297
  // when does this happen?
298
+ // Aha! I can happen when a plugin is logging in the user, for example the "WP-OAuth"-plugin:
299
+ // https://github.com/bonny/WordPress-Simple-History/issues/40
300
+
301
+ // @TODO: does this still count as a valid login?
302
+ // It should be valid right, because this action should not be called otherwise
303
+
304
+ // Some temp debug things
305
+ /*
306
+ $context["_debug_user_login"] = $user_login;
307
+ $context["_debug_user"] = simpleHistory::json_encode($user);
308
+ $context["_debug_server"] = simpleHistory::json_encode($_SERVER);
309
+ $context["_debug_get"] = simpleHistory::json_encode($_GET);
310
+ $context["_debug_get"] = simpleHistory::json_encode($_POST);
311
+ $context["_debug_cookies"] = simpleHistory::json_encode($_COOKIES);
312
+ */
313
 
314
+ $this->warningMessage("user_unknown_logged_in", $context);
315
 
316
  }
317
 
332
  */
333
  function on_profile_update($user_id) {
334
 
335
+ if (!$user_id || !is_numeric($user_id)) {
336
  return;
337
+ }
338
 
339
+ $wp_user_edited = get_userdata($user_id);
340
 
341
  $context = array(
342
  "edited_user_id" => $wp_user_edited->ID,
354
  */
355
  function on_user_register($user_id) {
356
 
357
+ if (!$user_id || !is_numeric($user_id)) {
358
  return;
359
+ }
360
 
361
+ $wp_user_added = get_userdata($user_id);
362
 
363
  // wp_user->roles (array) - the roles the user is part of.
364
  $role = null;
365
+ if (is_array($wp_user_added->roles) && !empty($wp_user_added->roles[0])) {
366
  $role = $wp_user_added->roles[0];
367
  }
368
 
387
  function on_wp_authenticate_user($user, $password) {
388
 
389
  // Only log failed attempts
390
+ if (!wp_check_password($password, $user->user_pass, $user->ID)) {
391
 
392
  // Overwrite some vars that Simple History set automagically
393
  $context = array(
400
  "login_user_login" => $user->user_login,
401
  "server_http_user_agent" => $_SERVER["HTTP_USER_AGENT"],
402
  //"_occasionsID" => __CLASS__ . '/' . __FUNCTION__ . "/failed_user_login/userid:{$user->ID}"
403
+ "_occasionsID" => __CLASS__ . '/failed_user_login',
404
  );
405
 
406
  /**
425
 
426
  }
427
 
 
428
  /**
429
  * Attempt to login to user that does not exist
430
  */
431
  function on_authenticate($user, $username, $password) {
432
 
433
  // Don't log empty usernames
434
+ if (!trim($username)) {
435
  return $user;
436
  }
437
 
438
  // If username is not a user in the system then this
439
  // is consideraded a failed login attempt
440
+ $wp_user = get_user_by("login", $username);
441
 
442
  if (false === $wp_user) {
443
 
451
  // Use same occasionsID as for failed login attempts to existing users,
452
  // because log can flood otherwise if hacker is rotating existing and non-existing usernames
453
  //"_occasionsID" => __CLASS__ . '/' . __FUNCTION__ . "/failed_user_login/userid:{$user->ID}"
454
+ "_occasionsID" => __CLASS__ . '/failed_user_login',
455
  );
456
 
457
  /**
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.16
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -83,7 +83,7 @@ So far Simple History is translated to:
83
  * Polish
84
  * Danish
85
 
86
- I'm looking for translations of Simple History in more languages! If you're interested please check out the [localization](https://developer.wordpress.org/plugins/internationalization/localization/) part of the Plugin Handbook for info on how to translate plugins. When you're done with your translation email it to me at par.thernstrom@gmail.com, or [add a pull request](https://github.com/bonny/WordPress-Simple-History/tree/v2).
87
 
88
  #### Contribute at GitHub
89
 
@@ -110,6 +110,19 @@ initiated by a specific user.
110
 
111
  == Changelog ==
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  = 2.0.16 (January 2015) =
114
 
115
  - Fixed: Use the [X-Forwarded-For header](http://en.wikipedia.org/wiki/X-Forwarded-For), if it is set, to determine remote IP address. Should now correctly store IP addresses for servers behind load balancers or for clients going through proxies. Fixes https://wordpress.org/support/topic/use-x-forwarded-for-http-header-when-logging-remote_addr.
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.17
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
83
  * Polish
84
  * Danish
85
 
86
+ I'm looking for translations of Simple History in more languages! If you're interested please check out the [localization](https://developer.wordpress.org/plugins/internationalization/localization/) part of the Plugin Handbook for info on how to translate plugins. When you're done with your translation email it to me at par.thernstrom@gmail.com, or [add a pull request](https://github.com/bonny/WordPress-Simple-History/).
87
 
88
  #### Contribute at GitHub
89
 
110
 
111
  == Changelog ==
112
 
113
+ = 2.0.17 (January 2015) =
114
+
115
+ - Added: messages added using for example `SimpleLogger()->info( __("My log message") )` that have translations now auto translated the message back to english before storing the message (together with the text domain). Then upon retrieval it uses the english message + the text domain to translate the message to the currently selected language. This makes it easier to make multilingual log entries. (Yeah, I know its hard to understand what the heck this does, but it's something good and cool, trust me!)
116
+ - Added: A sidebar with text contents on the history page.
117
+ - Changed: Search now shows only the search box by default, with a link to show all search options.
118
+ - Fixed: Search is now available at the dashboard again. Hooray!
119
+ - Fixed: Old entries were not cleared automatically. Now it correctly removes old events, so your database will not risk growing to large.
120
+ - Fixed: Quick stats could show two messages sometimes.
121
+ - Fixed: When headers like `HTTP_X_FORWARDED_FOR` exists all valid IPs in that header is now stored.
122
+ - Fixed: Plugin updates via third party software like [InfiniteWP](http://infinitewp.com/) should now correctly show the version number of the previos version.
123
+ - Updated: German translation updated.
124
+ - Notice: Do you read these messages? Then you must love this plugin! Come on then, [go and give it a nice review](https://wordpress.org/support/view/plugin-reviews/simple-history).
125
+
126
  = 2.0.16 (January 2015) =
127
 
128
  - Fixed: Use the [X-Forwarded-For header](http://en.wikipedia.org/wiki/X-Forwarded-For), if it is set, to determine remote IP address. Should now correctly store IP addresses for servers behind load balancers or for clients going through proxies. Fixes https://wordpress.org/support/topic/use-x-forwarded-for-http-header-when-logging-remote_addr.