Stream - Version 3.9.1

Version Description

  • August 23, 2022 =

  • Fix: PHP 8 compatibility for widget connector #1294, props @ParhamG

  • Development: Mark as tested with the latest version 6.0 of WordPress.

  • Development: Update development dependencies.

Download this release

Release Info

Developer kasparsd
Plugin Icon 128x128 Stream
Version 3.9.1
Comparing to
See all releases

Code changes from version 3.9.0 to 3.9.1

alerts/js/alert-type-highlight.min.js CHANGED
@@ -1 +1 @@
1
- var streamAlertTypeHighlight=function(i){var e={ajaxUrl:"",removeAction:"",security:""};return"undefined"!=typeof _streamAlertTypeHighlightExports&&i.extend(e,_streamAlertTypeHighlightExports),e.init=function(){i(document).ready(function(){i('.alert-highlight .action-link[href="#"]').each(function(){var r=i(this);r.click(function(t){t.preventDefault(),t=(t=r.parents(".alert-highlight").attr("class").match(/record\-id\-[\w-]*\b/))[0].replace("record-id-",""),t={action:e.removeAction,security:e.security,recordId:t},i.post(e.ajaxUrl,t,function(t){!0===t.success&&function(){var t=r.parents(".alert-highlight"),e=i(".striped > tbody > :nth-child( odd )");t.is(e)?t.animate({backgroundColor:"#f9f9f9"},300,function(){t.removeClass("alert-highlight")}):t.animate({backgroundColor:""},300,function(){t.removeClass("alert-highlight")});r.remove()}()})})})})},e}(jQuery);
1
+ var streamAlertTypeHighlight=function(i){var e={ajaxUrl:"",removeAction:"",security:""};return"undefined"!=typeof _streamAlertTypeHighlightExports&&i.extend(e,_streamAlertTypeHighlightExports),e.init=function(){i(document).ready(function(){i('.alert-highlight .action-link[href="#"]').each(function(){var r=i(this);r.click(function(t){t.preventDefault(),t=(t=r.parents(".alert-highlight").attr("class").match(/record\-id\-[\w-]*\b/))[0].replace("record-id-",""),t={action:e.removeAction,security:e.security,recordId:t},i.post(e.ajaxUrl,t,function(t){var e;!0===t.success&&(e=r.parents(".alert-highlight"),t=i(".striped > tbody > :nth-child( odd )"),e.is(t)?e.animate({backgroundColor:"#f9f9f9"},300,function(){e.removeClass("alert-highlight")}):e.animate({backgroundColor:""},300,function(){e.removeClass("alert-highlight")}),r.remove())})})})})},e}(jQuery);
classes/class-plugin.php CHANGED
@@ -18,7 +18,7 @@ class Plugin {
18
  *
19
  * @const string
20
  */
21
- const VERSION = '3.9.0';
22
 
23
  /**
24
  * WP-CLI command
18
  *
19
  * @const string
20
  */
21
+ const VERSION = '3.9.1';
22
 
23
  /**
24
  * WP-CLI command
composer.json CHANGED
@@ -14,15 +14,15 @@
14
  "composer/installers": "~1.0"
15
  },
16
  "require-dev": {
17
- "automattic/vipwpcs": "^2.0.0",
18
  "humanmade/mercator": "^1.0",
19
- "johnpbloch/wordpress": "^5.8",
20
- "php-coveralls/php-coveralls": "^2.1",
21
  "phpcompatibility/php-compatibility": "^9.3",
22
  "phpunit/phpunit": "^5.7",
23
- "wp-cli/wp-cli-bundle": "^2.5",
24
  "wp-coding-standards/wpcs": "^2.3",
25
- "wp-phpunit/wp-phpunit": "^5.4",
26
  "wpackagist-plugin/advanced-custom-fields": "5.8.12",
27
  "wpackagist-plugin/easy-digital-downloads": "2.9.23",
28
  "wpackagist-plugin/jetpack": "10.0",
14
  "composer/installers": "~1.0"
15
  },
16
  "require-dev": {
17
+ "automattic/vipwpcs": "^2.3",
18
  "humanmade/mercator": "^1.0",
19
+ "johnpbloch/wordpress": "^6.0",
20
+ "php-coveralls/php-coveralls": "^2.5",
21
  "phpcompatibility/php-compatibility": "^9.3",
22
  "phpunit/phpunit": "^5.7",
23
+ "wp-cli/wp-cli-bundle": "^2.6",
24
  "wp-coding-standards/wpcs": "^2.3",
25
+ "wp-phpunit/wp-phpunit": "^6.0",
26
  "wpackagist-plugin/advanced-custom-fields": "5.8.12",
27
  "wpackagist-plugin/easy-digital-downloads": "2.9.23",
28
  "wpackagist-plugin/jetpack": "10.0",
connectors/class-connector-widgets.php CHANGED
@@ -297,8 +297,8 @@ class Connector_Widgets extends Connector {
297
  * @return void
298
  */
299
  protected function handle_widget_removal( $old, $new ) {
300
- $all_old_widget_ids = array_unique( call_user_func_array( 'array_merge', $old ) );
301
- $all_new_widget_ids = array_unique( call_user_func_array( 'array_merge', $new ) );
302
  // @todo In the customizer, moving widgets to other sidebars is problematic because each sidebar is registered as a separate setting; so we need to make sure that all $_POST['customized'] are applied?
303
  // @todo The widget option is getting updated before the sidebars_widgets are updated, so we need to hook into the option update to try to cache any deletions for future lookup
304
 
@@ -357,8 +357,8 @@ class Connector_Widgets extends Connector {
357
  * @return void
358
  */
359
  protected function handle_widget_addition( $old, $new ) {
360
- $all_old_widget_ids = array_unique( call_user_func_array( 'array_merge', $old ) );
361
- $all_new_widget_ids = array_unique( call_user_func_array( 'array_merge', $new ) );
362
  $added_widget_ids = array_diff( $all_new_widget_ids, $all_old_widget_ids );
363
 
364
  foreach ( $added_widget_ids as $widget_id ) {
297
  * @return void
298
  */
299
  protected function handle_widget_removal( $old, $new ) {
300
+ $all_old_widget_ids = array_unique( call_user_func_array( 'array_merge', array_values( $old ) ) );
301
+ $all_new_widget_ids = array_unique( call_user_func_array( 'array_merge', array_values( $new ) ) );
302
  // @todo In the customizer, moving widgets to other sidebars is problematic because each sidebar is registered as a separate setting; so we need to make sure that all $_POST['customized'] are applied?
303
  // @todo The widget option is getting updated before the sidebars_widgets are updated, so we need to hook into the option update to try to cache any deletions for future lookup
304
 
357
  * @return void
358
  */
359
  protected function handle_widget_addition( $old, $new ) {
360
+ $all_old_widget_ids = array_unique( call_user_func_array( 'array_merge', array_values( $old ) ) );
361
+ $all_new_widget_ids = array_unique( call_user_func_array( 'array_merge', array_values( $new ) ) );
362
  $added_widget_ids = array_diff( $all_new_widget_ids, $all_old_widget_ids );
363
 
364
  foreach ( $added_widget_ids as $widget_id ) {
contributing.md CHANGED
@@ -16,7 +16,7 @@ Included is a local development environment built with [Docker](https://www.dock
16
 
17
  We suggest using the [Homebrew package manager](https://brew.sh) on macOS to install the dependencies:
18
 
19
- brew install node composer
20
  brew cask install virtualbox vagrant
21
 
22
  For setups with local Docker environment you don't need Vagrant and VirtualBox.
16
 
17
  We suggest using the [Homebrew package manager](https://brew.sh) on macOS to install the dependencies:
18
 
19
+ brew install node@16 composer
20
  brew cask install virtualbox vagrant
21
 
22
  For setups with local Docker environment you don't need Vagrant and VirtualBox.
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: xwp
3
  Tags: wp stream, stream, activity, logs, track
4
  Requires at least: 4.5
5
- Tested up to: 5.9
6
- Stable tag: 3.9.0
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -98,6 +98,12 @@ Track changes to posts when using the block editor.
98
 
99
  == Changelog ==
100
 
 
 
 
 
 
 
101
  = 3.9.0 - March 8, 2022 =
102
 
103
  - Fix: Track changes to posts when using the block editor by making the Posts connector to run on both frontend and backend requests since block editor changes happen over the REST API [#1264](https://github.com/xwp/stream/pull/1264), props [@coreymckrill](https://github.com/coreymckrill).
2
  Contributors: xwp
3
  Tags: wp stream, stream, activity, logs, track
4
  Requires at least: 4.5
5
+ Tested up to: 6.0
6
+ Stable tag: 3.9.1
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
98
 
99
  == Changelog ==
100
 
101
+ = 3.9.1 - August 23, 2022 =
102
+
103
+ - Fix: PHP 8 compatibility for widget connector [#1294](https://github.com/xwp/stream/pull/1355), props [@ParhamG](https://github.com/ParhamG)
104
+ - Development: Mark as tested with the latest version 6.0 of WordPress.
105
+ - Development: Update development dependencies.
106
+
107
  = 3.9.0 - March 8, 2022 =
108
 
109
  - Fix: Track changes to posts when using the block editor by making the Posts connector to run on both frontend and backend requests since block editor changes happen over the REST API [#1264](https://github.com/xwp/stream/pull/1264), props [@coreymckrill](https://github.com/coreymckrill).
stream.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Stream
4
  * Plugin URI: https://xwp.co/work/stream/
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.9.0
7
  * Author: XWP
8
  * Author URI: https://xwp.co
9
  * License: GPLv2+
3
  * Plugin Name: Stream
4
  * Plugin URI: https://xwp.co/work/stream/
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.9.1
7
  * Author: XWP
8
  * Author URI: https://xwp.co
9
  * License: GPLv2+
ui/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(p){"en"===wp_stream.locale&&void 0!==p.timeago&&(p.timeago.settings.strings.seconds="seconds",p.timeago.settings.strings.minute="a minute",p.timeago.settings.strings.hour="an hour",p.timeago.settings.strings.hours="%d hours",p.timeago.settings.strings.month="a month",p.timeago.settings.strings.year="a year"),p("li.toplevel_page_wp_stream ul li.wp-first-item.current").parent().parent().find(".update-plugins").remove(),p(".toplevel_page_wp_stream :input.chosen-select").each(function(e,t){function a(e){var t=p("<span>"),a=p(e.element),i="";return"- "===e.text.substring(0,2)&&(e.text=e.text.substring(2)),void 0!==e.id&&"string"==typeof e.id&&(0===e.id.indexOf("group-")?t.addClass("parent"):a.hasClass("level-2")&&t.addClass("child")),void 0!==e.icon?i=e.icon:void 0!==a&&""!==a.data("icon")&&(i=a.data("icon")),i&&t.html('<img src="'+i+'" class="wp-stream-select2-icon">'),t.append(e.text),t}function i(e){return"- "===e.text.substring(0,2)&&(e.text=e.text.substring(2)),e.text}var n={},n=0<p(t).find("option").not(":selected").not(":empty").length?{minimumResultsForSearch:10,templateResult:a,templateSelection:i,allowClear:!0,width:"165px"}:{minimumInputLength:3,allowClear:!0,width:"165px",ajax:{url:ajaxurl,delay:500,dataType:"json",quietMillis:100,data:function(e){return{action:"wp_stream_filters",nonce:p("#stream_filters_user_search_nonce").val(),filter:p(t).attr("name"),q:e.term}},processResults:function(e){var a=[];return p.each(e,function(e,t){a.push({id:t.id,text:t.label})}),{results:a}}},templateResult:a,templateSelection:i};p(t).select2(n)});var e=p.streamGetQueryVars(),t=p('.toplevel_page_wp_stream select.chosen-select[name="context"]');void 0!==e.context&&""!==e.context||void 0===e.connector||(t.val("group-"+e.connector),t.trigger("change")),p("input[type=submit]","#record-filter-form").click(function(){p("input[type=submit]",p(this).parents("form")).removeAttr("clicked"),p(this).attr("clicked","true")}),p("#record-filter-form").submit(function(){var e=p('.toplevel_page_wp_stream :input.chosen-select[name="context"]'),t=e.find("option:selected"),a=e.parent().find(".record-filter-connector"),i=t.data("group"),n=t.prop("class"),e=p(".recordactions select");"true"!==p("#record-actions-submit").attr("clicked")&&e.val(""),a.val(i),"level-1"===n&&t.val("")}),p(window).on("load",function(){p('.toplevel_page_wp_stream input[type="search"]').off("mousedown")}),p("body").on("click","#wp_stream_advanced_delete_all_records, #wp_stream_network_advanced_delete_all_records",function(e){window.confirm(wp_stream.i18n.confirm_purge)||e.preventDefault()}),p("body").on("click","#wp_stream_advanced_reset_site_settings, #wp_stream_network_advanced_reset_site_settings",function(e){window.confirm(wp_stream.i18n.confirm_defaults)||e.preventDefault()}),p("body").on("click","#wp_stream_uninstall",function(e){window.confirm(wp_stream.i18n.confirm_uninstall)||e.preventDefault()});var i=p(".wp_stream_screen .nav-tab-wrapper"),n=p(".wp_stream_screen .nav-tab-content table.form-table"),e=i.find(".nav-tab-active"),t=0<e.length?i.find("a").index(e):0,e=window.location.hash.match(/^#(\d+)$/),t=null!==e?e[1]:t;i.on("click","a",function(){var e,t=i.find("a").index(p(this)),a=window.location.hash.match(/^#(\d+)$/);return n.hide().eq(t).show(),i.find("a").removeClass("nav-tab-active").filter(p(this)).addClass("nav-tab-active"),""!==window.location.hash&&null===a||(window.location.hash=t),e=t,0!==(a=p('input[name="option_page"][value^="wp_stream"]').closest("form")).length&&(t=a.attr("action"),a.prop("action",t.replace(/(^[^#]*).*$/,"$1#"+e))),!1}),i.children().eq(t).trigger("click"),p(document).ready(function(){function t(){var e=!0;p('div.metabox-prefs [name="date-hide"]').is(":checked")&&(e=!1),p("div.alignleft.actions div.select2-container").each(function(){if(!p(this).is(":hidden"))return e=!1}),e?(p("input#record-query-submit").hide(),p("span.filter_info").show()):(p("input#record-query-submit").show(),p("span.filter_info").hide())}p("#enable_live_update").click(function(){var e,t=p("#stream_live_update_nonce").val(),a=p("#enable_live_update_user").val(),i="unchecked";p("#enable_live_update").is(":checked")&&(i="checked"),e=p("#enable_live_update").data("heartbeat"),p.ajax({type:"POST",url:ajaxurl,data:{action:"stream_enable_live_update",nonce:t,user:a,checked:i,heartbeat:e},dataType:"json",beforeSend:function(){p(".stream-live-update-checkbox .spinner").show().css({display:"inline-block"})},success:function(e){p(".stream-live-update-checkbox .spinner").hide(),!1===e.success&&(p("#enable_live_update").prop("checked",!1),e.data&&window.alert(e.data))}})}),p('div.metabox-prefs [name="date-hide"]').is(":checked")?p("div.date-interval").show():p("div.date-interval").hide(),p("div.actions select.chosen-select").each(function(){var e=p(this).prop("name");p('div.metabox-prefs [name="'+e+'-hide"]').is(":checked")?p(this).prev(".select2-container").show():p(this).prev(".select2-container").hide()}),t(),p('div.metabox-prefs [type="checkbox"]').click(function(){var e=p(this).prop("id");"date-hide"===e?p(this).is(":checked")?p("div.date-interval").show():p("div.date-interval").hide():(e=e.replace("-hide",""),p(this).is(":checked")?p('[name="'+e+'"]').prev(".select2-container").show():p('[name="'+e+'"]').prev(".select2-container").hide()),t()}),p("#ui-datepicker-div").addClass("stream-datepicker")}),p("table.wp-list-table").on("updated",function(){p(this).find("time.relative-time").each(function(e,t){t=p(t);t.removeClass("relative-time"),p('<strong><time datetime="'+t.attr("datetime")+'" class="timeago"/></time></strong><br/>').prependTo(t.parent().parent()).find("time.timeago").timeago()})}).trigger("updated");var a={init:function(e){this.wrapper=e,this.save_interval(this.wrapper.find(".button-primary"),this.wrapper),this.$=this.wrapper.each(function(e,t){var a,i=p(t),n=i.find(".date-inputs"),r=i.find(".field-from"),s=i.find(".field-to"),o=s.prev(".date-remove"),c=r.prev(".date-remove"),d=i.children(".field-predefined"),l=p("").add(s).add(r);jQuery.datepicker&&(a=parseFloat(wp_stream.gmt_offset)-(new Date).getTimezoneOffset()/60*-1,t=new Date,i=new Date(t.getTime()+60*a*60*1e3),a=0,t.getDate()===i.getDate()&&t.getMonth()===i.getMonth()||(a=t.getTime()<i.getTime()?"+1d":"-1d"),l.datepicker({dateFormat:"yy/mm/dd",minDate:null,maxDate:a,defaultDate:i,beforeShow:function(){p(this).prop("disabled",!0)},onClose:function(){p(this).prop("disabled",!1)}}),l.datepicker("widget").addClass("stream-datepicker")),d.select2({allowClear:!0}),""!==r.val()&&c.show(),""!==s.val()&&o.show(),d.on({change:function(){var e=p(this).val(),t=d.find('[value="'+e+'"]'),a=t.data("to"),t=t.data("from");if("custom"===e)return n.show(),!1;n.hide(),l.datepicker("hide"),r.val(t).trigger("change",[!0]),s.val(a).trigger("change",[!0]),jQuery.datepicker&&l.datepicker("widget").is(":visible")&&l.datepicker("refresh").datepicker("hide")},"select2-removed":function(){d.val("").trigger("change")},check_options:function(){var e;(""!==s.val()&&""!==r.val()?0!==(e=d.find("option").filter('[data-to="'+s.val()+'"]').filter('[data-from="'+r.val()+'"]')).length?d.val(e.attr("value")):d.val("custom"):""===s.val()&&""===r.val()?d.val(""):d.val("custom")).trigger("change",[!0])}}),r.on("change",function(){return""!==r.val()?(c.show(),s.datepicker("option","minDate",r.val())):c.hide(),!0!==arguments[arguments.length-1]&&void d.trigger("check_options")}),s.on("change",function(){return""!==s.val()?(o.show(),r.datepicker("option","maxDate",s.val())):o.hide(),!0!==arguments[arguments.length-1]&&void d.trigger("check_options")}),d.trigger("change"),p("").add(c).add(o).on("click",function(){p(this).next("input").val("").trigger("change")})})},save_interval:function(e){var t=this.wrapper;e.click(function(){var e={key:t.find("select.field-predefined").find(":selected").val(),start:t.find(".date-inputs .field-from").val(),end:t.find(".date-inputs .field-to").val()};p(this).attr("href",p(this).attr("href")+"&"+p.param(e))})}};p(document).ready(function(){a.init(p(".date-interval")),p('select[name="context"] .level-1').each(function(){var e=!0;p(this).nextUntil(".level-1").each(function(){if(p(this).is(":not(:disabled)"))return e=!1}),!0===e&&p(this).prop("disabled",!0)})})}),jQuery.extend({streamGetQueryVars:function(e){return(e||document.location.search).replace(/(^\?)/,"").split("&").map(function(e){return this[(e=e.split("="))[0]]=e[1],this}.bind({}))[0]}});
1
+ jQuery(function(p){"en"===wp_stream.locale&&void 0!==p.timeago&&(p.timeago.settings.strings.seconds="seconds",p.timeago.settings.strings.minute="a minute",p.timeago.settings.strings.hour="an hour",p.timeago.settings.strings.hours="%d hours",p.timeago.settings.strings.month="a month",p.timeago.settings.strings.year="a year"),p("li.toplevel_page_wp_stream ul li.wp-first-item.current").parent().parent().find(".update-plugins").remove(),p(".toplevel_page_wp_stream :input.chosen-select").each(function(e,t){function a(e){var t=p("<span>"),a=p(e.element),i="";return"- "===e.text.substring(0,2)&&(e.text=e.text.substring(2)),void 0!==e.id&&"string"==typeof e.id&&(0===e.id.indexOf("group-")?t.addClass("parent"):a.hasClass("level-2")&&t.addClass("child")),void 0!==e.icon?i=e.icon:void 0!==a&&""!==a.data("icon")&&(i=a.data("icon")),i&&t.html('<img src="'+i+'" class="wp-stream-select2-icon">'),t.append(e.text),t}function i(e){return"- "===e.text.substring(0,2)&&(e.text=e.text.substring(2)),e.text}var n={},n=0<p(t).find("option").not(":selected").not(":empty").length?{minimumResultsForSearch:10,templateResult:a,templateSelection:i,allowClear:!0,width:"165px"}:{minimumInputLength:3,allowClear:!0,width:"165px",ajax:{url:ajaxurl,delay:500,dataType:"json",quietMillis:100,data:function(e){return{action:"wp_stream_filters",nonce:p("#stream_filters_user_search_nonce").val(),filter:p(t).attr("name"),q:e.term}},processResults:function(e){var a=[];return p.each(e,function(e,t){a.push({id:t.id,text:t.label})}),{results:a}}},templateResult:a,templateSelection:i};p(t).select2(n)});var e=p.streamGetQueryVars(),t=p('.toplevel_page_wp_stream select.chosen-select[name="context"]'),i=(void 0!==e.context&&""!==e.context||void 0===e.connector||(t.val("group-"+e.connector),t.trigger("change")),p("input[type=submit]","#record-filter-form").click(function(){p("input[type=submit]",p(this).parents("form")).removeAttr("clicked"),p(this).attr("clicked","true")}),p("#record-filter-form").submit(function(){var e=p('.toplevel_page_wp_stream :input.chosen-select[name="context"]'),t=e.find("option:selected"),e=e.parent().find(".record-filter-connector"),a=t.data("group"),i=t.prop("class"),n=p(".recordactions select");"true"!==p("#record-actions-submit").attr("clicked")&&n.val(""),e.val(a),"level-1"===i&&t.val("")}),p(window).on("load",function(){p('.toplevel_page_wp_stream input[type="search"]').off("mousedown")}),p("body").on("click","#wp_stream_advanced_delete_all_records, #wp_stream_network_advanced_delete_all_records",function(e){window.confirm(wp_stream.i18n.confirm_purge)||e.preventDefault()}),p("body").on("click","#wp_stream_advanced_reset_site_settings, #wp_stream_network_advanced_reset_site_settings",function(e){window.confirm(wp_stream.i18n.confirm_defaults)||e.preventDefault()}),p("body").on("click","#wp_stream_uninstall",function(e){window.confirm(wp_stream.i18n.confirm_uninstall)||e.preventDefault()}),p(".wp_stream_screen .nav-tab-wrapper")),n=p(".wp_stream_screen .nav-tab-content table.form-table"),e=i.find(".nav-tab-active"),t=0<e.length?i.find("a").index(e):0,e=window.location.hash.match(/^#(\d+)$/),e=null!==e?e[1]:t,a=(i.on("click","a",function(){var e,t=i.find("a").index(p(this)),a=window.location.hash.match(/^#(\d+)$/);return n.hide().eq(t).show(),i.find("a").removeClass("nav-tab-active").filter(p(this)).addClass("nav-tab-active"),""!==window.location.hash&&null===a||(window.location.hash=t),a=t,0!==(t=p('input[name="option_page"][value^="wp_stream"]').closest("form")).length&&(e=t.attr("action"),t.prop("action",e.replace(/(^[^#]*).*$/,"$1#"+a))),!1}),i.children().eq(e).trigger("click"),p(document).ready(function(){function t(){var e=!0;p('div.metabox-prefs [name="date-hide"]').is(":checked")&&(e=!1),p("div.alignleft.actions div.select2-container").each(function(){if(!p(this).is(":hidden"))return e=!1}),e?(p("input#record-query-submit").hide(),p("span.filter_info").show()):(p("input#record-query-submit").show(),p("span.filter_info").hide())}p("#enable_live_update").click(function(){var e,t=p("#stream_live_update_nonce").val(),a=p("#enable_live_update_user").val(),i="unchecked";p("#enable_live_update").is(":checked")&&(i="checked"),e=p("#enable_live_update").data("heartbeat"),p.ajax({type:"POST",url:ajaxurl,data:{action:"stream_enable_live_update",nonce:t,user:a,checked:i,heartbeat:e},dataType:"json",beforeSend:function(){p(".stream-live-update-checkbox .spinner").show().css({display:"inline-block"})},success:function(e){p(".stream-live-update-checkbox .spinner").hide(),!1===e.success&&(p("#enable_live_update").prop("checked",!1),e.data&&window.alert(e.data))}})}),p('div.metabox-prefs [name="date-hide"]').is(":checked")?p("div.date-interval").show():p("div.date-interval").hide(),p("div.actions select.chosen-select").each(function(){var e=p(this).prop("name");p('div.metabox-prefs [name="'+e+'-hide"]').is(":checked")?p(this).prev(".select2-container").show():p(this).prev(".select2-container").hide()}),t(),p('div.metabox-prefs [type="checkbox"]').click(function(){var e=p(this).prop("id");"date-hide"===e?p(this).is(":checked")?p("div.date-interval").show():p("div.date-interval").hide():(e=e.replace("-hide",""),p(this).is(":checked")?p('[name="'+e+'"]').prev(".select2-container").show():p('[name="'+e+'"]').prev(".select2-container").hide()),t()}),p("#ui-datepicker-div").addClass("stream-datepicker")}),p("table.wp-list-table").on("updated",function(){p(this).find("time.relative-time").each(function(e,t){t=p(t);t.removeClass("relative-time"),p('<strong><time datetime="'+t.attr("datetime")+'" class="timeago"/></time></strong><br/>').prependTo(t.parent().parent()).find("time.timeago").timeago()})}).trigger("updated"),{init:function(e){this.wrapper=e,this.save_interval(this.wrapper.find(".button-primary"),this.wrapper),this.$=this.wrapper.each(function(e,t){var a,i,t=p(t),n=t.find(".date-inputs"),r=t.find(".field-from"),s=t.find(".field-to"),o=s.prev(".date-remove"),c=r.prev(".date-remove"),d=t.children(".field-predefined"),l=p("").add(s).add(r);jQuery.datepicker&&(t=parseFloat(wp_stream.gmt_offset)-(new Date).getTimezoneOffset()/60*-1,a=new Date,t=new Date(a.getTime()+60*t*60*1e3),i=0,a.getDate()===t.getDate()&&a.getMonth()===t.getMonth()||(i=a.getTime()<t.getTime()?"+1d":"-1d"),l.datepicker({dateFormat:"yy/mm/dd",minDate:null,maxDate:i,defaultDate:t,beforeShow:function(){p(this).prop("disabled",!0)},onClose:function(){p(this).prop("disabled",!1)}}),l.datepicker("widget").addClass("stream-datepicker")),d.select2({allowClear:!0}),""!==r.val()&&c.show(),""!==s.val()&&o.show(),d.on({change:function(){var e=p(this).val(),t=d.find('[value="'+e+'"]'),a=t.data("to"),t=t.data("from");if("custom"===e)return n.show(),!1;n.hide(),l.datepicker("hide"),r.val(t).trigger("change",[!0]),s.val(a).trigger("change",[!0]),jQuery.datepicker&&l.datepicker("widget").is(":visible")&&l.datepicker("refresh").datepicker("hide")},"select2-removed":function(){d.val("").trigger("change")},check_options:function(){var e;(""!==s.val()&&""!==r.val()?0!==(e=d.find("option").filter('[data-to="'+s.val()+'"]').filter('[data-from="'+r.val()+'"]')).length?d.val(e.attr("value")):d.val("custom"):""===s.val()&&""===r.val()?d.val(""):d.val("custom")).trigger("change",[!0])}}),r.on("change",function(){if(""!==r.val()?(c.show(),s.datepicker("option","minDate",r.val())):c.hide(),!0===arguments[arguments.length-1])return!1;d.trigger("check_options")}),s.on("change",function(){if(""!==s.val()?(o.show(),r.datepicker("option","maxDate",s.val())):o.hide(),!0===arguments[arguments.length-1])return!1;d.trigger("check_options")}),d.trigger("change"),p("").add(c).add(o).on("click",function(){p(this).next("input").val("").trigger("change")})})},save_interval:function(e){var t=this.wrapper;e.click(function(){var e={key:t.find("select.field-predefined").find(":selected").val(),start:t.find(".date-inputs .field-from").val(),end:t.find(".date-inputs .field-to").val()};p(this).attr("href",p(this).attr("href")+"&"+p.param(e))})}});p(document).ready(function(){a.init(p(".date-interval")),p('select[name="context"] .level-1').each(function(){var e=!0;p(this).nextUntil(".level-1").each(function(){if(p(this).is(":not(:disabled)"))return e=!1}),!0===e&&p(this).prop("disabled",!0)})})}),jQuery.extend({streamGetQueryVars:function(e){return(e||document.location.search).replace(/(^\?)/,"").split("&").map(function(e){return this[(e=e.split("="))[0]]=e[1],this}.bind({}))[0]}});
ui/js/alerts.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(s){"use strict";function l(t){(t=s(t)).find(".select2-select.connector_or_context").each(function(t,e){s(e).select2({allowClear:!0,placeholder:streamAlerts.anyContext,templateResult:function(t){return void 0===t.id?t.text:-1===t.id.indexOf("-")?s('<span class="parent">'+t.text+"</span>"):s('<span class="child">'+t.text+"</span>")},matcher:function(t,e){var n=s.extend(!0,{},e);if(null===t.term||""===s.trim(t.term))return n;var a=t.term.toLowerCase();if(n.id=n.id.replace("blogs","sites"),0<=n.id.toLowerCase().indexOf(a))return n;if(n.children){for(var i=n.children.length-1;0<=i;i--)-1===n.children[i].id.toLowerCase().indexOf(a)&&n.children.splice(i,1);if(0<n.children.length)return n}return null}}).change(function(){var t=s(this).val();t&&(t=t.split("-"),s(this).siblings(".connector").val(t[0]),s(this).siblings(".context").val(t[1]))});var n=[s(e).siblings(".connector").val(),s(e).siblings(".context").val()];""===n[1]&&n.splice(1,1),s(e).val(n.join("-")).trigger("change")}),t.find("select.select2-select:not(.connector_or_context)").each(function(){var t=s(this).attr("id").split("_"),t=t[t.length-1].charAt(0).toUpperCase()+t[t.length-1].slice(1);s(this).select2({allowClear:!0,placeholder:streamAlerts.any+" "+t})})}function i(t){var e={action:"load_alerts_settings",alert_type:t},t=s("#wp_stream_alert_type").closest("tr").attr("id");e.post_id=t.split("-")[1],s.post(window.ajaxurl,e,function(t){var e=s("#wp_stream_alert_type_form");"none"!==s("#wp_stream_alert_type").val()?(e.html(t.data.html),e.show()):e.hide()})}var o,c,t=s("#wp_stream_alert_type");s("#the-list").on("change","#wp_stream_trigger_connector_or_context",function(){var t;"wp_stream_trigger_connector_or_context"===s(this).attr("id")&&((t=s(this).val())&&0<t.indexOf("-")&&(t=t.split("-")[0]),e(t))});var e=function(t){var r=s("#wp_stream_trigger_action");r.empty(),r.prop("disabled",!0);var e=s("<option/>",{value:"",text:""});r.append(e),s.post(window.ajaxurl,{action:"get_actions",connector:t},function(t){var e,n=t.success,a=t.data;if(n){for(var i in a)a.hasOwnProperty(i)&&(e=a[i],e=s("<option/>",{value:i,text:e}),r.append(e));r.prop("disabled",!1),s(document).trigger("alert-actions-updated")}})};t.change(function(){i(s(this).val())}),s("#wpbody-content").on("click","a.page-title-action",function(t){t.preventDefault(),s("#add-new-alert").remove(),0<s(".inline-edit-wp_stream_alerts").length&&s(".inline-edit-wp_stream_alerts .inline-edit-save button.button-secondary.cancel").trigger("click");var a;s.post(window.ajaxurl,{action:"get_new_alert_triggers_notifications"},function(t){var e,n;!0===t.success&&(a=t.data.html,s("tbody#the-list").prepend('<tr id="add-new-alert" class="inline-edit-row inline-edit-row-page inline-edit-page quick-edit-row quick-edit-row-page inline-edit-page inline-editor" style=""><td colspan="4" class="colspanchange">'+a+'<p class="submit inline-edit-save"> <button type="button" class="button-secondary cancel alignleft">Cancel</button> <input type="hidden" id="_inline_edit" name="_inline_edit" value="3550d271fe"> <button type="button" class="button-primary save alignright">Save</button> <span class="spinner"></span><span class="error" style="display:none"></span> <br class="clear"></p></td></tr>'),e=s("#add-new-alert"),n=e.css("background-color"),e.css("background-color","#C1E1B9"),setTimeout(function(){e.css("background-color",n)},250),s("#wp_stream_alert_type").change(function(){i(s(this).val())}),e.on("click",".button-secondary.cancel",function(){s("#add-new-alert").remove()}),e.on("click",".button-primary.save",r),l("#add-new-alert"))})});var n,r=function(t){t.preventDefault(),s("#add-new-alert").find("p.submit.inline-edit-save span.spinner").css("visibility","visible");var e={action:"save_new_alert",wp_stream_alerts_nonce:s("#wp_stream_alerts_nonce").val(),wp_stream_trigger_author:s("#wp_stream_trigger_author").val(),wp_stream_trigger_context:s("#wp_stream_trigger_connector_or_context").val(),wp_stream_trigger_action:s("#wp_stream_trigger_action").val(),wp_stream_alert_type:s("#wp_stream_alert_type").val(),wp_stream_alert_status:s("#wp_stream_alert_status").val()};s("#wp_stream_alert_type_form").find(":input").each(function(){var t=s(this).attr("id");s(this).val()&&(e[t]=s(this).val())}),s.post(window.ajaxurl,e,function(t){!0===t.success&&(s("#add-new-alert").find("p.submit.inline-edit-save span.spinner").css("visibility","hidden"),location.reload())})},p=inlineEditPost.edit;inlineEditPost.edit=function(t){p.apply(this,arguments);var e,n,a,i,r=0;0<(r="object"==typeof t?parseInt(this.getId(t),10):r)&&(c=s("#edit-"+r),a=(e=(o=s("#post-"+r)).find('input[name="wp_stream_trigger_connector"]').val())+"-"+(n=o.find('input[name="wp_stream_trigger_context"]').val()),i=o.find('input[name="wp_stream_trigger_action"]').val(),t=o.find('input[name="wp_stream_alert_status"]').val(),c.find('input[name="wp_stream_trigger_connector"]').attr("value",e),c.find('input[name="wp_stream_trigger_context"]').attr("value",n),c.find('select[name="wp_stream_trigger_connector_or_context"] option[value="'+a+'"]').attr("selected","selected"),s(document).one("alert-actions-updated",function(){c.find('input[name="wp_stream_trigger_action"]').attr("value",i),c.find('select[name="wp_stream_trigger_action"] option[value="'+i+'"]').attr("selected","selected").trigger("change")}),c.find('select[name="wp_stream_alert_status"] option[value="'+t+'"]').attr("selected","selected"),l("#edit-"+r),s("#wp_stream_alert_type_form").hide(),r=o.find('input[name="wp_stream_alert_type"]').val(),c.find('select[name="wp_stream_alert_type"] option[value="'+r+'"]').attr("selected","selected").trigger("change"))},!window.location.hash||(n=s(window.location.hash)).length&&(t=n.offset().top-s("#wpadminbar").height(),s("html, body").animate({scrollTop:t},1e3),n.find(".row-actions a.editinline").trigger("click"))});
1
+ jQuery(function(s){"use strict";function l(t){(t=s(t)).find(".select2-select.connector_or_context").each(function(t,e){s(e).select2({allowClear:!0,placeholder:streamAlerts.anyContext,templateResult:function(t){return void 0===t.id?t.text:-1===t.id.indexOf("-")?s('<span class="parent">'+t.text+"</span>"):s('<span class="child">'+t.text+"</span>")},matcher:function(t,e){var n=s.extend(!0,{},e);if(null===t.term||""===s.trim(t.term))return n;var a=t.term.toLowerCase();if(n.id=n.id.replace("blogs","sites"),0<=n.id.toLowerCase().indexOf(a))return n;if(n.children){for(var i=n.children.length-1;0<=i;i--)-1===n.children[i].id.toLowerCase().indexOf(a)&&n.children.splice(i,1);if(0<n.children.length)return n}return null}}).change(function(){var t=s(this).val();t&&(t=t.split("-"),s(this).siblings(".connector").val(t[0]),s(this).siblings(".context").val(t[1]))});var n=[s(e).siblings(".connector").val(),s(e).siblings(".context").val()];""===n[1]&&n.splice(1,1),s(e).val(n.join("-")).trigger("change")}),t.find("select.select2-select:not(.connector_or_context)").each(function(){var t=s(this).attr("id").split("_"),t=t[t.length-1].charAt(0).toUpperCase()+t[t.length-1].slice(1);s(this).select2({allowClear:!0,placeholder:streamAlerts.any+" "+t})})}function i(t){var t={action:"load_alerts_settings",alert_type:t},e=s("#wp_stream_alert_type").closest("tr").attr("id");t.post_id=e.split("-")[1],s.post(window.ajaxurl,t,function(t){var e=s("#wp_stream_alert_type_form");"none"===s("#wp_stream_alert_type").val()?e.hide():(e.html(t.data.html),e.show())})}var o,c,t,e=s("#wp_stream_alert_type"),n=(s("#the-list").on("change","#wp_stream_trigger_connector_or_context",function(){var t;"wp_stream_trigger_connector_or_context"===s(this).attr("id")&&((t=s(this).val())&&0<t.indexOf("-")&&(t=t.split("-")[0]),n(t))}),function(t){var r=s("#wp_stream_trigger_action"),e=(r.empty(),r.prop("disabled",!0),s("<option/>",{value:"",text:""}));r.append(e),s.post(window.ajaxurl,{action:"get_actions",connector:t},function(t){var e,n=t.success,a=t.data;if(n){for(var i in a)a.hasOwnProperty(i)&&(e=a[i],i=s("<option/>",{value:i,text:e}),r.append(i));r.prop("disabled",!1),s(document).trigger("alert-actions-updated")}})}),r=(e.change(function(){i(s(this).val())}),s("#wpbody-content").on("click","a.page-title-action",function(t){t.preventDefault(),s("#add-new-alert").remove(),0<s(".inline-edit-wp_stream_alerts").length&&s(".inline-edit-wp_stream_alerts .inline-edit-save button.button-secondary.cancel").trigger("click");var a;s.post(window.ajaxurl,{action:"get_new_alert_triggers_notifications"},function(t){var e,n;!0===t.success&&(a=t.data.html,s("tbody#the-list").prepend('<tr id="add-new-alert" class="inline-edit-row inline-edit-row-page inline-edit-page quick-edit-row quick-edit-row-page inline-edit-page inline-editor" style=""><td colspan="4" class="colspanchange">'+a+'<p class="submit inline-edit-save"> <button type="button" class="button-secondary cancel alignleft">Cancel</button> <input type="hidden" id="_inline_edit" name="_inline_edit" value="3550d271fe"> <button type="button" class="button-primary save alignright">Save</button> <span class="spinner"></span><span class="error" style="display:none"></span> <br class="clear"></p></td></tr>'),e=s("#add-new-alert"),n=e.css("background-color"),e.css("background-color","#C1E1B9"),setTimeout(function(){e.css("background-color",n)},250),s("#wp_stream_alert_type").change(function(){i(s(this).val())}),e.on("click",".button-secondary.cancel",function(){s("#add-new-alert").remove()}),e.on("click",".button-primary.save",r),l("#add-new-alert"))})}),function(t){t.preventDefault(),s("#add-new-alert").find("p.submit.inline-edit-save span.spinner").css("visibility","visible");var e={action:"save_new_alert",wp_stream_alerts_nonce:s("#wp_stream_alerts_nonce").val(),wp_stream_trigger_author:s("#wp_stream_trigger_author").val(),wp_stream_trigger_context:s("#wp_stream_trigger_connector_or_context").val(),wp_stream_trigger_action:s("#wp_stream_trigger_action").val(),wp_stream_alert_type:s("#wp_stream_alert_type").val(),wp_stream_alert_status:s("#wp_stream_alert_status").val()};s("#wp_stream_alert_type_form").find(":input").each(function(){var t=s(this).attr("id");s(this).val()&&(e[t]=s(this).val())}),s.post(window.ajaxurl,e,function(t){!0===t.success&&(s("#add-new-alert").find("p.submit.inline-edit-save span.spinner").css("visibility","hidden"),location.reload())})}),p=inlineEditPost.edit;inlineEditPost.edit=function(t){p.apply(this,arguments);var e,n,a,i,r=0;0<(r="object"==typeof t?parseInt(this.getId(t),10):r)&&(c=s("#edit-"+r),n=(t=(o=s("#post-"+r)).find('input[name="wp_stream_trigger_connector"]').val())+"-"+(e=o.find('input[name="wp_stream_trigger_context"]').val()),a=o.find('input[name="wp_stream_trigger_action"]').val(),i=o.find('input[name="wp_stream_alert_status"]').val(),c.find('input[name="wp_stream_trigger_connector"]').attr("value",t),c.find('input[name="wp_stream_trigger_context"]').attr("value",e),c.find('select[name="wp_stream_trigger_connector_or_context"] option[value="'+n+'"]').attr("selected","selected"),s(document).one("alert-actions-updated",function(){c.find('input[name="wp_stream_trigger_action"]').attr("value",a),c.find('select[name="wp_stream_trigger_action"] option[value="'+a+'"]').attr("selected","selected").trigger("change")}),c.find('select[name="wp_stream_alert_status"] option[value="'+i+'"]').attr("selected","selected"),l("#edit-"+r),s("#wp_stream_alert_type_form").hide(),t=o.find('input[name="wp_stream_alert_type"]').val(),c.find('select[name="wp_stream_alert_type"] option[value="'+t+'"]').attr("selected","selected").trigger("change"))},window.location.hash&&(e=s(window.location.hash)).length&&(t=e.offset().top-s("#wpadminbar").height(),s("html, body").animate({scrollTop:t},1e3),e.find(".row-actions a.editinline").trigger("click"))});
ui/js/exclude.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(r){function t(e){var s;r("select.select2-select.connector_or_context",e).each(function(e,t){r(t).select2({allowClear:!0,templateResult:function(e){return void 0===e.id?e.text:-1===e.id.indexOf("-")?r('<span class="parent">'+e.text+"</span>"):r('<span class="child">'+e.text+"</span>")},matcher:function(e,t){var s=r.extend(!0,{},t);if(null===e.term||""===r.trim(e.term))return s;var n=e.term.toLowerCase();if(s.id=s.id.replace("blogs","sites"),0<=s.id.toLowerCase().indexOf(n))return s;if(s.children){for(var i=s.children.length-1;0<=i;i--)-1===s.children[i].id.toLowerCase().indexOf(n)&&s.children.splice(i,1);if(0<s.children.length)return s}return null}}).on("change",function(){var e=r(this).closest("tr"),t=r(this).val();!function(e,t){var l=r(".select2-select.action",e),c=l.val();l.empty(),l.prop("disabled",!0);e=r("<option/>",{value:"",text:""});l.append(e);t={action:"get_actions",connector:t};r.post(window.ajaxurl,t,function(e){var t,s=e.success,n=e.data;if(s){for(var i in n)n.hasOwnProperty(i)&&(t=n[i],t=r("<option/>",{value:i,text:t}),l.append(t));l.val(c),l.prop("disabled",!1),r(document).trigger("alert-actions-updated")}})}(e,t=t&&0<t.indexOf("-")?t.split("-")[0]:t)})}),r("select.select2-select.action",e).each(function(e,t){r(t).select2({allowClear:!0})}),r("select.select2-select.author_or_role",e).each(function(e,t){(s=r(t)).select2({ajax:{type:"POST",url:ajaxurl,dataType:"json",quietMillis:500,data:function(e,t){return{find:e,limit:10,pager:t,action:"stream_get_users",nonce:s.data("nonce")}},processResults:function(e){var t={results:[{text:"",id:""},{text:"Roles",children:[]},{text:"Users",children:[]}]};if(!0!==e.success||void 0===e.data||!0!==e.data.status)return t;if(void 0===e.data.users||void 0===e.data.roles)return t;var s=[];return r.each(e.data.roles,function(e,t){s.push({id:e,text:t})}),t.results[1].children=s,t.results[2].children=e.data.users,t}},templateResult:function(e){var t=r("<div>").text(e.text);return void 0!==e.icon&&e.icon&&(t.prepend(r('<img src="'+e.icon+'" class="wp-stream-select2-icon">')),t.attr("title",e.tooltip)),void 0!==e.tooltip?t.attr("title",e.tooltip):void 0!==e.user_count&&t.attr("title",e.user_count),t},templateSelection:function(e){var t=r("<div>").text(e.text);return r.isNumeric(e.id)&&e.text.indexOf("icon-users")<0&&t.append(r('<i class="icon16 icon-users"></i>')),t},allowClear:!0,placeholder:s.data("placeholder")}).on("change",function(){var e=r(this).select2("data");r(this).data("selected-id",e.id),r(this).data("selected-text",e.text)})}),r("select.select2-select.ip_address",e).each(function(e,t){var s=r(t),n="";s.select2({ajax:{type:"POST",url:ajaxurl,dataType:"json",quietMillis:500,data:function(e){return n=e.term,{find:e,limit:10,action:"stream_get_ips",nonce:s.data("nonce")}},processResults:function(e){var s={results:[]},t=[];return!0===e.success&&void 0!==e.data&&r.each(e.data,function(e,t){s.results.push({id:t,text:t})}),void 0===n||null===(t=n.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/))||(t.shift(),4<=(t=r.grep(t,function(e){var t=parseInt(e,10);return t<=255&&t.toString()===e})).length&&s.results.push({id:n,text:n})),s}},allowClear:!1,multiple:!0,maximumSelectionSize:1,placeholder:s.data("placeholder"),tags:!0})}).on("change",function(){r(this).prev(".select2-container").find("input.select2-input").blur()}),r("ul.select2-choices, ul.select2-choices li, input.select2-input",".stream-exclude-list tr:not(.hidden) .ip_address").on("mousedown click focus",function(){var e=r(this).closest(".select2-container"),t=e.find("input.select2-input");if(1<=e.select2("data").length)return t.blur(),!1}),r(".exclude_rules_remove_rule_row",e).on("click",function(e){r(this).closest("tr").remove(),i(),n(),e.preventDefault()})}var e=r(".stream-exclude-list tbody tr:not(.hidden)"),s=r(".stream-exclude-list tr.helper");function n(){var e=r("table.stream-exclude-list tbody tr:not( .hidden ) input.cb-select:checked"),t=r("#exclude_rules_remove_rules");0===e.length?t.prop("disabled",!0):t.prop("disabled",!1)}function i(){var e=r("table.stream-exclude-list tbody tr:not( .hidden )"),t=r("table.stream-exclude-list tbody tr.no-items"),s=r(".check-column.manage-column input.cb-select"),n=r("#exclude_rules_remove_rules");0===e.length?(t.show(),s.prop("disabled",!0),n.prop("disabled",!0)):(t.hide(),s.prop("disabled",!1)),wp_stream_regenerate_alt_rows(e)}t(e),r("select.select2-select.author_or_role",e).each(function(){var e=r("<option selected>"+r(this).data("selected-text")+"</option>").val(r(this).data("selected-id"));r(this).append(e).trigger("change")}),r("select.select2-select.connector_or_context",e).each(function(){var e=[r(this).siblings(".connector").val(),r(this).siblings(".context").val()];""===e[1]&&e.splice(1,1),r(this).val(e.join("-")).trigger("change")}),r("#exclude_rules_new_rule").on("click",function(){var e=s.clone();e.removeAttr("class"),e.insertBefore(s),t(e),i(),n()}),r("#exclude_rules_remove_rules").on("click",function(){var e=r("table.stream-exclude-list"),t=r("tbody input.cb-select:checked",e).closest("tr");2<=r("tbody tr",e).length-t.length?t.remove():(r(":input",t).val(""),r(t).not(":first").remove(),r(".select2-select",t).select2("val","")),e.find("input.cb-select").prop("checked",!1),i(),n()}),r(".stream-exclude-list").closest("form").submit(function(){r(".stream-exclude-list tbody tr.hidden",this).each(function(){r(this).find(":input").removeAttr("name")}),r(".stream-exclude-list tbody tr:not(.hidden) select.select2-select.connector_or_context",this).each(function(){var e=r(this).val().split("-");r(this).siblings(".connector").val(e[0]),r(this).siblings(".context").val(e.slice(1).join("-")),r(this).removeAttr("name")}),r(".stream-exclude-list tbody tr:not(.hidden) select.select2-select.ip_address",this).each(function(){var e=r("option:selected",this).first();e.length||r(this).append('<option selected="selected"></option>'),r("option:selected:not(:first)",this).each(function(){e.attr("value",e.attr("value")+","+r(this).attr("value")),r(this).removeAttr("selected")})})}),r(".stream-exclude-list").closest("td").prev("th").hide(),r("table.stream-exclude-list").on("click","input.cb-select",function(){n()}),r(document).ready(function(){i(),n()})});
1
+ jQuery(function(r){function t(e){var s;r("select.select2-select.connector_or_context",e).each(function(e,t){r(t).select2({allowClear:!0,templateResult:function(e){return void 0===e.id?e.text:-1===e.id.indexOf("-")?r('<span class="parent">'+e.text+"</span>"):r('<span class="child">'+e.text+"</span>")},matcher:function(e,t){var s=r.extend(!0,{},t);if(null===e.term||""===r.trim(e.term))return s;var n=e.term.toLowerCase();if(s.id=s.id.replace("blogs","sites"),0<=s.id.toLowerCase().indexOf(n))return s;if(s.children){for(var i=s.children.length-1;0<=i;i--)-1===s.children[i].id.toLowerCase().indexOf(n)&&s.children.splice(i,1);if(0<s.children.length)return s}return null}}).on("change",function(){var l,c,e=r(this).closest("tr"),t=r(this).val();t&&0<t.indexOf("-")&&(t=t.split("-")[0]),t=t,l=r(".select2-select.action",e=e),c=l.val(),l.empty(),l.prop("disabled",!0),e=r("<option/>",{value:"",text:""}),l.append(e),e={action:"get_actions",connector:t},r.post(window.ajaxurl,e,function(e){var t,s=e.success,n=e.data;if(s){for(var i in n)n.hasOwnProperty(i)&&(t=n[i],i=r("<option/>",{value:i,text:t}),l.append(i));l.val(c),l.prop("disabled",!1),r(document).trigger("alert-actions-updated")}})})}),r("select.select2-select.action",e).each(function(e,t){r(t).select2({allowClear:!0})}),r("select.select2-select.author_or_role",e).each(function(e,t){(s=r(t)).select2({ajax:{type:"POST",url:ajaxurl,dataType:"json",quietMillis:500,data:function(e,t){return{find:e,limit:10,pager:t,action:"stream_get_users",nonce:s.data("nonce")}},processResults:function(e){var t={results:[{text:"",id:""},{text:"Roles",children:[]},{text:"Users",children:[]}]};if(!0!==e.success||void 0===e.data||!0!==e.data.status)return t;if(void 0===e.data.users||void 0===e.data.roles)return t;var s=[];return r.each(e.data.roles,function(e,t){s.push({id:e,text:t})}),t.results[1].children=s,t.results[2].children=e.data.users,t}},templateResult:function(e){var t=r("<div>").text(e.text);return void 0!==e.icon&&e.icon&&(t.prepend(r('<img src="'+e.icon+'" class="wp-stream-select2-icon">')),t.attr("title",e.tooltip)),void 0!==e.tooltip?t.attr("title",e.tooltip):void 0!==e.user_count&&t.attr("title",e.user_count),t},templateSelection:function(e){var t=r("<div>").text(e.text);return r.isNumeric(e.id)&&e.text.indexOf("icon-users")<0&&t.append(r('<i class="icon16 icon-users"></i>')),t},allowClear:!0,placeholder:s.data("placeholder")}).on("change",function(){var e=r(this).select2("data");r(this).data("selected-id",e.id),r(this).data("selected-text",e.text)})}),r("select.select2-select.ip_address",e).each(function(e,t){var s=r(t),n="";s.select2({ajax:{type:"POST",url:ajaxurl,dataType:"json",quietMillis:500,data:function(e){return n=e.term,{find:e,limit:10,action:"stream_get_ips",nonce:s.data("nonce")}},processResults:function(e){var s={results:[]},t=[];return!0===e.success&&void 0!==e.data&&r.each(e.data,function(e,t){s.results.push({id:t,text:t})}),void 0===n||null!==(t=n.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/))&&(t.shift(),4<=(t=r.grep(t,function(e){var t=parseInt(e,10);return t<=255&&t.toString()===e})).length&&s.results.push({id:n,text:n})),s}},allowClear:!1,multiple:!0,maximumSelectionSize:1,placeholder:s.data("placeholder"),tags:!0})}).on("change",function(){r(this).prev(".select2-container").find("input.select2-input").blur()}),r("ul.select2-choices, ul.select2-choices li, input.select2-input",".stream-exclude-list tr:not(.hidden) .ip_address").on("mousedown click focus",function(){var e=r(this).closest(".select2-container"),t=e.find("input.select2-input");if(1<=e.select2("data").length)return t.blur(),!1}),r(".exclude_rules_remove_rule_row",e).on("click",function(e){r(this).closest("tr").remove(),i(),n(),e.preventDefault()})}var e=r(".stream-exclude-list tbody tr:not(.hidden)"),s=r(".stream-exclude-list tr.helper");function n(){var e=r("table.stream-exclude-list tbody tr:not( .hidden ) input.cb-select:checked"),t=r("#exclude_rules_remove_rules");0===e.length?t.prop("disabled",!0):t.prop("disabled",!1)}function i(){var e=r("table.stream-exclude-list tbody tr:not( .hidden )"),t=r("table.stream-exclude-list tbody tr.no-items"),s=r(".check-column.manage-column input.cb-select"),n=r("#exclude_rules_remove_rules");0===e.length?(t.show(),s.prop("disabled",!0),n.prop("disabled",!0)):(t.hide(),s.prop("disabled",!1)),wp_stream_regenerate_alt_rows(e)}t(e),r("select.select2-select.author_or_role",e).each(function(){var e=r("<option selected>"+r(this).data("selected-text")+"</option>").val(r(this).data("selected-id"));r(this).append(e).trigger("change")}),r("select.select2-select.connector_or_context",e).each(function(){var e=[r(this).siblings(".connector").val(),r(this).siblings(".context").val()];""===e[1]&&e.splice(1,1),r(this).val(e.join("-")).trigger("change")}),r("#exclude_rules_new_rule").on("click",function(){var e=s.clone();e.removeAttr("class"),e.insertBefore(s),t(e),i(),n()}),r("#exclude_rules_remove_rules").on("click",function(){var e=r("table.stream-exclude-list"),t=r("tbody input.cb-select:checked",e).closest("tr");2<=r("tbody tr",e).length-t.length?t.remove():(r(":input",t).val(""),r(t).not(":first").remove(),r(".select2-select",t).select2("val","")),e.find("input.cb-select").prop("checked",!1),i(),n()}),r(".stream-exclude-list").closest("form").submit(function(){r(".stream-exclude-list tbody tr.hidden",this).each(function(){r(this).find(":input").removeAttr("name")}),r(".stream-exclude-list tbody tr:not(.hidden) select.select2-select.connector_or_context",this).each(function(){var e=r(this).val().split("-");r(this).siblings(".connector").val(e[0]),r(this).siblings(".context").val(e.slice(1).join("-")),r(this).removeAttr("name")}),r(".stream-exclude-list tbody tr:not(.hidden) select.select2-select.ip_address",this).each(function(){var e=r("option:selected",this).first();e.length||r(this).append('<option selected="selected"></option>'),r("option:selected:not(:first)",this).each(function(){e.attr("value",e.attr("value")+","+r(this).attr("value")),r(this).removeAttr("selected")})})}),r(".stream-exclude-list").closest("td").prev("th").hide(),r("table.stream-exclude-list").on("click","input.cb-select",function(){n()}),r(document).ready(function(){i(),n()})});
ui/js/live-updates.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(p){p(document).ready(function(){var l;"toplevel_page_wp_stream"===wp_stream_live_updates.current_screen&&"1"===wp_stream_live_updates.current_page&&"asc"!==wp_stream_live_updates.current_order&&(1<parseInt(wp_stream_live_updates.current_query_count,10)||(l=".toplevel_page_wp_stream #the-list",wp.heartbeat.interval("fast"),p(document).on("heartbeat-send.stream",function(e,t){t["wp-stream-heartbeat"]="live-update";var a=p(l+" tr:first .column-date time"),r=1;0!==a.length&&(r=""===a.attr("datetime")?1:a.attr("datetime")),t["wp-stream-heartbeat-last-time"]=r,t["wp-stream-heartbeat-query"]=wp_stream_live_updates.current_query}),p(document).on("heartbeat-tick.stream",function(e,t){var a,r,s,n;t["wp-stream-heartbeat"]&&0!==t["wp-stream-heartbeat"].length&&(a=p("#edit_stream_per_page").val(),n=p(l+" tr"),(r=p(t["wp-stream-heartbeat"])).addClass("new-row"),s=n.first().hasClass("alternate"),1!==r.length||s?(s=0!=r.length%2||s?"odd":"even",r.filter(":nth-child("+s+")").addClass("alternate")):r.addClass("alternate"),p(l).prepend(r),p(".metabox-prefs input").each(function(){var e;!0!==p(this).prop("checked")&&(e=p(this).val(),p("td.column-"+e).hide())}),(n=a-(r.length+n.length))<0&&p(l+" tr").slice(n).remove(),p(l+" tr.no-items").remove(),(n=t.total_items_i18n||"")&&(p(".displaying-num").text(n),p(".total-pages").text(t.total_pages_i18n),p(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",t.total_pages===p(".current-page").val()),p(".tablenav-pages .last-page").attr("href",t.last_page_link)),p(l).parent().trigger("updated"),wp_stream_regenerate_alt_rows(p(l+" tr")),setTimeout(function(){p(".new-row").addClass("fadeout"),setTimeout(function(){p(l+" tr").removeClass("new-row fadeout")},500)},3e3))})))})});
1
+ jQuery(function(p){p(document).ready(function(){var l;"toplevel_page_wp_stream"!==wp_stream_live_updates.current_screen||"1"!==wp_stream_live_updates.current_page||"asc"===wp_stream_live_updates.current_order||1<parseInt(wp_stream_live_updates.current_query_count,10)||(l=".toplevel_page_wp_stream #the-list",wp.heartbeat.interval("fast"),p(document).on("heartbeat-send.stream",function(e,t){t["wp-stream-heartbeat"]="live-update";var a=p(l+" tr:first .column-date time"),r=1;0!==a.length&&(r=""===a.attr("datetime")?1:a.attr("datetime")),t["wp-stream-heartbeat-last-time"]=r,t["wp-stream-heartbeat-query"]=wp_stream_live_updates.current_query}),p(document).on("heartbeat-tick.stream",function(e,t){var a,r,s,n;t["wp-stream-heartbeat"]&&0!==t["wp-stream-heartbeat"].length&&(n=p("#edit_stream_per_page").val(),a=p(l+" tr"),(r=p(t["wp-stream-heartbeat"])).addClass("new-row"),s=a.first().hasClass("alternate"),1!==r.length||s?(s=0!=r.length%2||s?"odd":"even",r.filter(":nth-child("+s+")").addClass("alternate")):r.addClass("alternate"),p(l).prepend(r),p(".metabox-prefs input").each(function(){var e;!0!==p(this).prop("checked")&&(e=p(this).val(),p("td.column-"+e).hide())}),(s=n-(r.length+a.length))<0&&p(l+" tr").slice(s).remove(),p(l+" tr.no-items").remove(),(n=t.total_items_i18n||"")&&(p(".displaying-num").text(n),p(".total-pages").text(t.total_pages_i18n),p(".tablenav-pages").find(".next-page, .last-page").toggleClass("disabled",t.total_pages===p(".current-page").val()),p(".tablenav-pages .last-page").attr("href",t.last_page_link)),p(l).parent().trigger("updated"),wp_stream_regenerate_alt_rows(p(l+" tr")),setTimeout(function(){p(".new-row").addClass("fadeout"),setTimeout(function(){p(l+" tr").removeClass("new-row fadeout")},500)},3e3))}))})});
ui/js/settings.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){var e="wp_stream_network"===t('input[name="option_page"]').val()?"_network_affix":"",a=t("#wp_stream"+e+"\\[general_keep_records_indefinitely\\]"),n=t("#wp_stream"+e+"_general_records_ttl"),i=n.closest("tr");function o(){a.is(":checked")?(i.addClass("hidden"),n.addClass("hidden")):(i.removeClass("hidden"),n.removeClass("hidden"))}a.on("change",function(){o()}),o(),t("#wp_stream_general_reset_site_settings").click(function(e){confirm(wp_stream.i18n.confirm_defaults)||e.preventDefault()});var r=t(".nav-tab-wrapper"),s=t(".nav-tab-content table.form-table"),l=r.find(".nav-tab-active"),e=0<l.length?r.find("a").index(l):0,l=window.location.hash.match(/^#(\d+)$/),e=null!==l?l[1]:e;r.on("click","a",function(){var e,a=r.find("a").index(t(this)),n=window.location.hash.match(/^#(\d+)$/);return s.hide().eq(a).show(),r.find("a").removeClass("nav-tab-active").filter(t(this)).addClass("nav-tab-active"),""!==window.location.hash&&null===n||(window.location.hash=a),e=a,0!==(n=t('input[name="option_page"][value^="wp_stream"]').closest("form")).length&&(a=n.attr("action"),n.prop("action",a.replace(/(^[^#]*).*$/,"$1#"+e))),!1}),r.children().eq(e).trigger("click")});
1
+ jQuery(function(t){var e="wp_stream_network"===t('input[name="option_page"]').val()?"_network_affix":"",a=t("#wp_stream"+e+"\\[general_keep_records_indefinitely\\]"),n=t("#wp_stream"+e+"_general_records_ttl"),i=n.closest("tr");function o(){a.is(":checked")?(i.addClass("hidden"),n.addClass("hidden")):(i.removeClass("hidden"),n.removeClass("hidden"))}a.on("change",function(){o()}),o(),t("#wp_stream_general_reset_site_settings").click(function(e){confirm(wp_stream.i18n.confirm_defaults)||e.preventDefault()});var r=t(".nav-tab-wrapper"),s=t(".nav-tab-content table.form-table"),e=r.find(".nav-tab-active"),e=0<e.length?r.find("a").index(e):0,l=window.location.hash.match(/^#(\d+)$/),l=null!==l?l[1]:e;r.on("click","a",function(){var e,a=r.find("a").index(t(this)),n=window.location.hash.match(/^#(\d+)$/);return s.hide().eq(a).show(),r.find("a").removeClass("nav-tab-active").filter(t(this)).addClass("nav-tab-active"),""!==window.location.hash&&null===n||(window.location.hash=a),n=a,0!==(a=t('input[name="option_page"][value^="wp_stream"]').closest("form")).length&&(e=a.attr("action"),a.prop("action",e.replace(/(^[^#]*).*$/,"$1#"+n))),!1}),r.children().eq(l).trigger("click")});