Stream - Version 3.2.2

Version Description

  • September 13, 2017 =

  • Fix: Prevent fatal error when attempting to store an Object in the database.

Download this release

Release Info

Developer lukecarbis
Plugin Icon 128x128 Stream
Version 3.2.2
Comparing to
See all releases

Code changes from version 3.2.1 to 3.2.2

classes/class-admin.php CHANGED
@@ -698,8 +698,8 @@ class Admin {
698
  $this->list_table->prepare_items();
699
  ?>
700
  <div class="wrap">
701
- <h1><?php echo esc_html( get_admin_page_title() ) ?></h1>
702
- <?php $this->list_table->display() ?>
703
  </div>
704
  <?php
705
  }
@@ -719,29 +719,29 @@ class Admin {
719
  wp_enqueue_script( 'wp-stream-settings', $this->plugin->locations['url'] . 'ui/js/settings.js', array( 'jquery' ), $this->plugin->get_version(), true );
720
  ?>
721
  <div class="wrap">
722
- <h1><?php echo esc_html( get_admin_page_title() ) ?></h1>
723
 
724
  <?php if ( ! empty( $page_description ) ) : ?>
725
- <p><?php echo esc_html( $page_description ) ?></p>
726
  <?php endif; ?>
727
 
728
- <?php settings_errors() ?>
729
 
730
  <?php if ( count( $sections ) > 1 ) : ?>
731
  <h2 class="nav-tab-wrapper">
732
  <?php $i = 0 ?>
733
  <?php foreach ( $sections as $section => $data ) : ?>
734
  <?php $i ++ ?>
735
- <?php $is_active = ( ( 1 === $i && ! $active_tab ) || $active_tab === $section ) ?>
736
- <a href="<?php echo esc_url( add_query_arg( 'tab', $section ) ) ?>" class="nav-tab<?php if ( $is_active ) { echo esc_attr( ' nav-tab-active' ); } ?>">
737
- <?php echo esc_html( $data['title'] ) ?>
738
  </a>
739
  <?php endforeach; ?>
740
  </h2>
741
  <?php endif; ?>
742
 
743
  <div class="nav-tab-content" id="tab-content-settings">
744
- <form method="post" action="<?php echo esc_attr( $form_action ) ?>" enctype="multipart/form-data">
745
  <div class="settings-sections">
746
  <?php
747
  $i = 0;
@@ -757,7 +757,7 @@ class Admin {
757
  }
758
  ?>
759
  </div>
760
- <?php submit_button() ?>
761
  </form>
762
  </div>
763
  </div>
698
  $this->list_table->prepare_items();
699
  ?>
700
  <div class="wrap">
701
+ <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
702
+ <?php $this->list_table->display(); ?>
703
  </div>
704
  <?php
705
  }
719
  wp_enqueue_script( 'wp-stream-settings', $this->plugin->locations['url'] . 'ui/js/settings.js', array( 'jquery' ), $this->plugin->get_version(), true );
720
  ?>
721
  <div class="wrap">
722
+ <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
723
 
724
  <?php if ( ! empty( $page_description ) ) : ?>
725
+ <p><?php echo esc_html( $page_description ); ?></p>
726
  <?php endif; ?>
727
 
728
+ <?php settings_errors(); ?>
729
 
730
  <?php if ( count( $sections ) > 1 ) : ?>
731
  <h2 class="nav-tab-wrapper">
732
  <?php $i = 0 ?>
733
  <?php foreach ( $sections as $section => $data ) : ?>
734
  <?php $i ++ ?>
735
+ <?php $is_active = ( ( 1 === $i && ! $active_tab ) || $active_tab === $section ); ?>
736
+ <a href="<?php echo esc_url( add_query_arg( 'tab', $section ) ); ?>" class="nav-tab<?php if ( $is_active ) { echo esc_attr( ' nav-tab-active' ); } ?>">
737
+ <?php echo esc_html( $data['title'] ); ?>
738
  </a>
739
  <?php endforeach; ?>
740
  </h2>
741
  <?php endif; ?>
742
 
743
  <div class="nav-tab-content" id="tab-content-settings">
744
+ <form method="post" action="<?php echo esc_attr( $form_action ); ?>" enctype="multipart/form-data">
745
  <div class="settings-sections">
746
  <?php
747
  $i = 0;
757
  }
758
  ?>
759
  </div>
760
+ <?php submit_button(); ?>
761
  </form>
762
  </div>
763
  </div>
classes/class-alerts.php CHANGED
@@ -569,12 +569,12 @@ class Alerts {
569
  <div id="minor-publishing">
570
  <div id="misc-publishing-actions">
571
  <div class="misc-pub-section misc-pub-post-status">
572
- <label for="wp_stream_alert_status"><?php esc_html_e( 'Status', 'stream' ) ?></label>
573
  <select name='wp_stream_alert_status' id='wp_stream_alert_status'>
574
  <option<?php selected( $post_status, 'wp_stream_enabled' ); ?>
575
- value='wp_stream_enabled'><?php esc_html_e( 'Enabled', 'stream' ) ?></option>
576
  <option<?php selected( $post_status, 'wp_stream_disabled' ); ?>
577
- value='wp_stream_disabled'><?php esc_html_e( 'Disabled', 'stream' ) ?></option>
578
  </select>
579
  </div>
580
  </div>
@@ -616,11 +616,11 @@ class Alerts {
616
  <div id="misc-publishing-actions">
617
  <div class="misc-pub-section misc-pub-post-status">
618
  <label for="wp_stream_alert_status">
619
- <span class="title"><?php esc_html_e( 'Status:', 'stream' ) ?></span>
620
  <span class="input-text-wrap">
621
  <select name='wp_stream_alert_status' id='wp_stream_alert_status'>
622
- <option selected value='wp_stream_enabled'><?php esc_html_e( 'Enabled', 'stream' ) ?></option>
623
- <option value='wp_stream_disabled'><?php esc_html_e( 'Disabled', 'stream' ) ?></option>
624
  </select>
625
  </span>
626
  </label>
569
  <div id="minor-publishing">
570
  <div id="misc-publishing-actions">
571
  <div class="misc-pub-section misc-pub-post-status">
572
+ <label for="wp_stream_alert_status"><?php esc_html_e( 'Status', 'stream' ); ?></label>
573
  <select name='wp_stream_alert_status' id='wp_stream_alert_status'>
574
  <option<?php selected( $post_status, 'wp_stream_enabled' ); ?>
575
+ value='wp_stream_enabled'><?php esc_html_e( 'Enabled', 'stream' ); ?></option>
576
  <option<?php selected( $post_status, 'wp_stream_disabled' ); ?>
577
+ value='wp_stream_disabled'><?php esc_html_e( 'Disabled', 'stream' ); ?></option>
578
  </select>
579
  </div>
580
  </div>
616
  <div id="misc-publishing-actions">
617
  <div class="misc-pub-section misc-pub-post-status">
618
  <label for="wp_stream_alert_status">
619
+ <span class="title"><?php esc_html_e( 'Status:', 'stream' ); ?></span>
620
  <span class="input-text-wrap">
621
  <select name='wp_stream_alert_status' id='wp_stream_alert_status'>
622
+ <option selected value='wp_stream_enabled'><?php esc_html_e( 'Enabled', 'stream' ); ?></option>
623
+ <option value='wp_stream_disabled'><?php esc_html_e( 'Disabled', 'stream' ); ?></option>
624
  </select>
625
  </span>
626
  </label>
classes/class-install.php CHANGED
@@ -289,13 +289,13 @@ class Install {
289
  public function prompt_update() {
290
  ?>
291
  <div class="error">
292
- <form method="post" action="<?php echo esc_url( remove_query_arg( 'wp_stream_update' ) ) ?>">
293
- <?php wp_nonce_field( 'wp_stream_update_db' ) ?>
294
  <input type="hidden" name="wp_stream_update" value="update_and_continue"/>
295
- <p><strong><?php esc_html_e( 'Stream Database Update Required', 'stream' ) ?></strong></p>
296
- <p><?php esc_html_e( 'Stream has updated! Before we send you on your way, we need to update your database to the newest version.', 'stream' ) ?></p>
297
- <p><?php esc_html_e( 'This process could take a little while, so please be patient.', 'stream' ) ?></p>
298
- <?php submit_button( esc_html__( 'Update Database', 'stream' ), 'primary', 'stream-update-db-submit' ) ?>
299
  </form>
300
  </div>
301
  <?php
@@ -313,10 +313,10 @@ class Install {
313
  $this->update_db_option();
314
  ?>
315
  <div class="updated">
316
- <form method="post" action="<?php echo esc_url( remove_query_arg( 'wp_stream_update' ) ) ?>" style="display:inline;">
317
- <p><strong><?php esc_html_e( 'Update Complete', 'stream' ) ?></strong></p>
318
  <p><?php printf( esc_html__( 'Your Stream database has been successfully updated from %1$s to %2$s!', 'stream' ), esc_html( $this->db_version ), esc_html( $this->plugin->get_version() ) ); ?></p>
319
- <?php submit_button( esc_html__( 'Continue', 'stream' ), 'secondary', false ) ?>
320
  </form>
321
  </div>
322
  <?php
289
  public function prompt_update() {
290
  ?>
291
  <div class="error">
292
+ <form method="post" action="<?php echo esc_url( remove_query_arg( 'wp_stream_update' ) ); ?>">
293
+ <?php wp_nonce_field( 'wp_stream_update_db' ); ?>
294
  <input type="hidden" name="wp_stream_update" value="update_and_continue"/>
295
+ <p><strong><?php esc_html_e( 'Stream Database Update Required', 'stream' ); ?></strong></p>
296
+ <p><?php esc_html_e( 'Stream has updated! Before we send you on your way, we need to update your database to the newest version.', 'stream' ); ?></p>
297
+ <p><?php esc_html_e( 'This process could take a little while, so please be patient.', 'stream' ); ?></p>
298
+ <?php submit_button( esc_html__( 'Update Database', 'stream' ), 'primary', 'stream-update-db-submit' ); ?>
299
  </form>
300
  </div>
301
  <?php
313
  $this->update_db_option();
314
  ?>
315
  <div class="updated">
316
+ <form method="post" action="<?php echo esc_url( remove_query_arg( 'wp_stream_update' ) ); ?>" style="display:inline;">
317
+ <p><strong><?php esc_html_e( 'Update Complete', 'stream' ); ?></strong></p>
318
  <p><?php printf( esc_html__( 'Your Stream database has been successfully updated from %1$s to %2$s!', 'stream' ), esc_html( $this->db_version ), esc_html( $this->plugin->get_version() ) ); ?></p>
319
+ <?php submit_button( esc_html__( 'Continue', 'stream' ), 'secondary', false ); ?>
320
  </form>
321
  </div>
322
  <?php
classes/class-list-table.php CHANGED
@@ -62,7 +62,7 @@ class List_Table extends \WP_List_Table {
62
  function no_items() {
63
  ?>
64
  <div class="stream-list-table-no-items">
65
- <p><?php esc_html_e( 'Sorry, no activity records were found.', 'stream' ) ?></p>
66
  </div>
67
  <?php
68
  }
@@ -772,9 +772,9 @@ class List_Table extends \WP_List_Table {
772
  ?>
773
  <div class="date-interval">
774
 
775
- <select class="field-predefined hide-if-no-js chosen-select" name="date_predefined" data-placeholder="<?php esc_attr_e( 'All Time', 'stream' ) ?>">
776
  <option></option>
777
- <option value="custom" <?php selected( 'custom' === $date_predefined ); ?>><?php esc_attr_e( 'Custom', 'stream' ) ?></option>
778
  <?php
779
  foreach ( $items as $key => $interval ) {
780
  $end = isset( $interval['end'] ) ? $interval['end']->format( 'Y/m/d' ) : null;
@@ -794,13 +794,13 @@ class List_Table extends \WP_List_Table {
794
  <div class="date-inputs">
795
  <div class="box">
796
  <i class="date-remove dashicons"></i>
797
- <input type="text" name="date_from" class="date-picker field-from" placeholder="<?php esc_attr_e( 'Start Date', 'stream' ) ?>" value="<?php echo esc_attr( $date_from ) ?>" />
798
  </div>
799
  <span class="connector dashicons"></span>
800
 
801
  <div class="box">
802
  <i class="date-remove dashicons"></i>
803
- <input type="text" name="date_to" class="date-picker field-to" placeholder="<?php esc_attr_e( 'End Date', 'stream' ) ?>" value="<?php echo esc_attr( $date_to ) ?>" />
804
  </div>
805
  </div>
806
 
@@ -952,18 +952,18 @@ class List_Table extends \WP_List_Table {
952
  ob_start();
953
  ?>
954
  <fieldset>
955
- <h5><?php esc_html_e( 'Live updates', 'stream' ) ?></h5>
956
 
957
  <div>
958
- <input type="hidden" name="stream_live_update_nonce" id="stream_live_update_nonce" value="<?php echo esc_attr( $nonce ) ?>" />
959
  </div>
960
  <div>
961
- <input type="hidden" name="enable_live_update_user" id="enable_live_update_user" value="<?php echo absint( $user_id ) ?>" />
962
  </div>
963
  <div class="metabox-prefs stream-live-update-checkbox">
964
  <label for="enable_live_update">
965
- <input type="checkbox" value="on" name="enable_live_update" id="enable_live_update" data-heartbeat="<?php echo esc_attr( $heartbeat ) ?>" <?php checked( $option, 'on' ) ?> />
966
- <?php esc_html_e( 'Enabled', 'stream' ) ?><span class="spinner"></span>
967
  </label>
968
  </div>
969
  </fieldset>
62
  function no_items() {
63
  ?>
64
  <div class="stream-list-table-no-items">
65
+ <p><?php esc_html_e( 'Sorry, no activity records were found.', 'stream' ); ?></p>
66
  </div>
67
  <?php
68
  }
772
  ?>
773
  <div class="date-interval">
774
 
775
+ <select class="field-predefined hide-if-no-js chosen-select" name="date_predefined" data-placeholder="<?php esc_attr_e( 'All Time', 'stream' ); ?>">
776
  <option></option>
777
+ <option value="custom" <?php selected( 'custom' === $date_predefined ); ?>><?php esc_attr_e( 'Custom', 'stream' ); ?></option>
778
  <?php
779
  foreach ( $items as $key => $interval ) {
780
  $end = isset( $interval['end'] ) ? $interval['end']->format( 'Y/m/d' ) : null;
794
  <div class="date-inputs">
795
  <div class="box">
796
  <i class="date-remove dashicons"></i>
797
+ <input type="text" name="date_from" class="date-picker field-from" placeholder="<?php esc_attr_e( 'Start Date', 'stream' ); ?>" value="<?php echo esc_attr( $date_from ); ?>" />
798
  </div>
799
  <span class="connector dashicons"></span>
800
 
801
  <div class="box">
802
  <i class="date-remove dashicons"></i>
803
+ <input type="text" name="date_to" class="date-picker field-to" placeholder="<?php esc_attr_e( 'End Date', 'stream' ); ?>" value="<?php echo esc_attr( $date_to ); ?>" />
804
  </div>
805
  </div>
806
 
952
  ob_start();
953
  ?>
954
  <fieldset>
955
+ <h5><?php esc_html_e( 'Live updates', 'stream' ); ?></h5>
956
 
957
  <div>
958
+ <input type="hidden" name="stream_live_update_nonce" id="stream_live_update_nonce" value="<?php echo esc_attr( $nonce ); ?>" />
959
  </div>
960
  <div>
961
+ <input type="hidden" name="enable_live_update_user" id="enable_live_update_user" value="<?php echo absint( $user_id ); ?>" />
962
  </div>
963
  <div class="metabox-prefs stream-live-update-checkbox">
964
  <label for="enable_live_update">
965
+ <input type="checkbox" value="on" name="enable_live_update" id="enable_live_update" data-heartbeat="<?php echo esc_attr( $heartbeat ); ?>" <?php checked( $option, 'on' ); ?> />
966
+ <?php esc_html_e( 'Enabled', 'stream' ); ?><span class="spinner"></span>
967
  </label>
968
  </div>
969
  </fieldset>
classes/class-plugin.php CHANGED
@@ -7,7 +7,7 @@ class Plugin {
7
  *
8
  * @const string
9
  */
10
- const VERSION = '3.2.1';
11
 
12
  /**
13
  * WP-CLI command
7
  *
8
  * @const string
9
  */
10
+ const VERSION = '3.2.2';
11
 
12
  /**
13
  * WP-CLI command
connectors/class-connector-settings.php CHANGED
@@ -708,9 +708,8 @@ class Connector_Settings extends Connector {
708
  'option' => $option,
709
  'option_key' => $field_key,
710
  'context' => ( false !== $key_context ? $key_context : $context ),
711
- // Prevent fatal error when saving option as array
712
- 'old_value' => isset( $old_value[ $field_key ] ) ? (string) $old_value[ $field_key ] : null,
713
- 'value' => isset( $value[ $field_key ] ) ? (string) $value[ $field_key ] : null,
714
  );
715
  }
716
  }
@@ -719,8 +718,8 @@ class Connector_Settings extends Connector {
719
  'label' => $this->get_field_label( $option ),
720
  'option' => $option,
721
  'context' => $context,
722
- 'old_value' => (string) $old_value,
723
- 'value' => (string) $value,
724
  );
725
  }
726
 
@@ -746,10 +745,10 @@ class Connector_Settings extends Connector {
746
  (function ($) {
747
  $(function () {
748
  var hashPrefix = <?php echo wp_stream_json_encode( self::HIGHLIGHT_FIELD_URL_HASH_PREFIX ) // xss ok ?>,
749
- hashFieldName = "",
750
- fieldNames = [],
751
- $select2Choices = {},
752
- $field = {};
753
 
754
  if (location.hash.substr(1, hashPrefix.length) === hashPrefix) {
755
  hashFieldName = location.hash.substr(hashPrefix.length + 1);
@@ -821,4 +820,20 @@ class Connector_Settings extends Connector {
821
  _deprecated_function( __FUNCTION__, '3.0.6', 'is_option_group' );
822
  return $this->is_option_group( $value );
823
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  }
708
  'option' => $option,
709
  'option_key' => $field_key,
710
  'context' => ( false !== $key_context ? $key_context : $context ),
711
+ 'old_value' => isset( $old_value[ $field_key ] ) ? $this->sanitize_value( $old_value[ $field_key ] ) : null,
712
+ 'value' => isset( $value[ $field_key ] ) ? $this->sanitize_value( $value[ $field_key ] ) : null,
 
713
  );
714
  }
715
  }
718
  'label' => $this->get_field_label( $option ),
719
  'option' => $option,
720
  'context' => $context,
721
+ 'old_value' => $this->sanitize_value( $old_value ),
722
+ 'value' => $this->sanitize_value( $value ),
723
  );
724
  }
725
 
745
  (function ($) {
746
  $(function () {
747
  var hashPrefix = <?php echo wp_stream_json_encode( self::HIGHLIGHT_FIELD_URL_HASH_PREFIX ) // xss ok ?>,
748
+ hashFieldName = "",
749
+ fieldNames = [],
750
+ $select2Choices = {},
751
+ $field = {};
752
 
753
  if (location.hash.substr(1, hashPrefix.length) === hashPrefix) {
754
  hashFieldName = location.hash.substr(hashPrefix.length + 1);
820
  _deprecated_function( __FUNCTION__, '3.0.6', 'is_option_group' );
821
  return $this->is_option_group( $value );
822
  }
823
+
824
+ /**
825
+ * Sanitize values, so that we don't store complex data, such as arrays or objects
826
+ *
827
+ * @param mixed $value
828
+ * @return string
829
+ */
830
+ public function sanitize_value( $value ) {
831
+ if ( is_array( $value ) ) {
832
+ return '';
833
+ } elseif ( is_object( $value ) && ! in_array( '__toString', get_class_methods( $value ) ) ) {
834
+ return '';
835
+ }
836
+
837
+ return strval( $value );
838
+ }
839
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: lukecarbis, fjarrett, stream, xwp
3
  Tags: wp stream, stream, activity, logs, track
4
  Requires at least: 3.9
5
  Tested up to: 4.8.1
6
- Stable tag: 3.2.1
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -79,6 +79,10 @@ Thank you for wanting to make Stream better for everyone!
79
 
80
  == Changelog ==
81
 
 
 
 
 
82
  = 3.2.1 - September 8, 2017 =
83
 
84
  * New: Support for the ACF Options page. ([#931](https://github.com/xwp/stream/pull/931))
3
  Tags: wp stream, stream, activity, logs, track
4
  Requires at least: 3.9
5
  Tested up to: 4.8.1
6
+ Stable tag: 3.2.2
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
79
 
80
  == Changelog ==
81
 
82
+ = 3.2.2 - September 13, 2017 =
83
+
84
+ * Fix: Prevent fatal error when attempting to store an Object in the database.
85
+
86
  = 3.2.1 - September 8, 2017 =
87
 
88
  * New: Support for the ACF Options page. ([#931](https://github.com/xwp/stream/pull/931))
stream.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Stream
4
  * Plugin URI: https://wp-stream.com/
5
  * Description: Stream tracks logged-in user activity so you can monitor every change made on your WordPress site in beautifully organized detail. All activity is organized by context, action and IP address for easy filtering. Developers can extend Stream with custom connectors to log any kind of action.
6
- * Version: 3.2.1
7
  * Author: XWP
8
  * Author URI: https://xwp.co/
9
  * License: GPLv2+
3
  * Plugin Name: Stream
4
  * Plugin URI: https://wp-stream.com/
5
  * Description: Stream tracks logged-in user activity so you can monitor every change made on your WordPress site in beautifully organized detail. All activity is organized by context, action and IP address for easy filtering. Developers can extend Stream with custom connectors to log any kind of action.
6
+ * Version: 3.2.2
7
  * Author: XWP
8
  * Author URI: https://xwp.co/
9
  * License: GPLv2+