PluginProbe
Stream – Activity Log & Audit Trail / 3.4.2
Stream – Activity Log & Audit Trail v3.4.2
4.4.0 4.3.0 4.2.2 4.2.1 trunk 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1 3.1.1 3.10.0 3.2.0 3.2.1 3.2.2 3.2.3 All 50 releases
← All changes | includes/functions.php +41 -5 3.0.03.4.2 View file →
@@ -1,6 +1,5 @@
1 1 <?php
2 -
3 2 /**
4 3 * Gets a specific external variable by name and optionally filters it.
5 4 *
6 5 * This is a polyfill function intended to be used in place of PHP's
@@ -36,9 +35,9 @@
36 35 /**
37 36 * Converts a time into an ISO 8601 extended formatted string.
38 37 *
39 38 * @param int|bool $time Seconds since unix epoc
40 - * @param int $offset Hour offset
39 + * @param int $offset Hour offset
41 40 *
42 41 * @return string an ISO 8601 extended formatted time
43 42 */
44 43 function wp_stream_get_iso_8601_extended_date( $time = false, $offset = 0 ) {
@@ -65,10 +64,10 @@
65 64 /**
66 65 * Encode to JSON in a way that is also backwards compatible
67 66 *
68 67 * @param mixed $data
69 - * @param int $options (optional)
70 - * @param int $depth (optional)
68 + * @param int $options (optional)
69 + * @param int $depth (optional)
71 70 *
72 71 * @return string
73 72 */
74 73 function wp_stream_json_encode( $data, $options = 0, $depth = 512 ) {
@@ -87,8 +86,28 @@
87 86 return $json;
88 87 }
89 88
90 89 /**
90 + * Return an array of sites for a network in a way that is also backwards compatible
91 + *
92 + * @param string|array $args
93 + *
94 + * @return array
95 + */
96 +function wp_stream_get_sites( $args = array() ) {
97 + if ( function_exists( 'get_sites' ) ) {
98 + $sites = get_sites( $args );
99 + } else {
100 + $sites = array();
101 + foreach ( wp_get_sites( $args ) as $site ) { // @codingStandardsIgnoreLine Specifically for old version of WP first, in order to provide backward compatibility
102 + $sites[] = WP_Site::get_instance( $site['blog_id'] );
103 + }
104 + }
105 +
106 + return $sites;
107 +}
108 +
109 +/**
91 110 * Check if Stream is running on WordPress.com VIP
92 111 *
93 112 * @return bool
94 113 */
@@ -96,11 +115,28 @@
96 115 return function_exists( 'wpcom_vip_load_plugin' );
97 116 }
98 117
99 118 /**
100 - * True if native WP Cron is enabled, otherwise false
119 + * Check if the default front-end WP Cron is enabled. It doesn't
120 + * mean that the Cron is disabled in general.
101 121 *
102 122 * @return bool
103 123 */
104 124 function wp_stream_is_cron_enabled() {
105 125 return ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) ? false : true;
126 +}
127 +
128 +/**
129 + * Get the asset min suffix if defined.
130 + *
131 + * @return string
132 + */
133 +function wp_stream_min_suffix() {
134 + $min = '';
135 + $is_script_debugging = ! defined( 'SCRIPT_DEBUG' ) || false === SCRIPT_DEBUG;
136 +
137 + if ( apply_filters( 'wp_stream_load_min_assets', $is_script_debugging ) ) {
138 + $min = 'min.';
139 + }
140 +
141 + return $min;
106 142 }