PluginProbe
Stream – Activity Log & Audit Trail / 3.6.1
Stream – Activity Log & Audit Trail v3.6.1
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 | classes/class-connector.php +10 -28 4.2.23.6.1 View file →
@@ -109,9 +109,9 @@
109 109 * Looks for a class method with the convention: "callback_{action name}"
110 110 */
111 111 public function callback() {
112 112 $action = current_filter();
113 - $callback = array( $this, 'callback_' . preg_replace( '/[^a-z0-9_]/', '_', $action ) );
113 + $callback = array( $this, 'callback_' . preg_replace( '/[^a-z0-9_\-]/', '_', $action ) );
114 114
115 115 // For the sake of testing, trigger an action with the name of the callback.
116 116 if ( defined( 'WP_STREAM_TESTS' ) && WP_STREAM_TESTS ) {
117 117 /**
@@ -145,14 +145,14 @@
145 145
146 146 /**
147 147 * Log handler
148 148 *
149 - * @param string $message sprintf-ready error message string.
150 - * @param array $args sprintf (and extra) arguments to use.
151 - * @param int|null $object_id Target object id (if any).
152 - * @param string $context Context of the event.
153 - * @param string $action Action of the event.
154 - * @param int $user_id User responsible for the event.
149 + * @param string $message sprintf-ready error message string.
150 + * @param array $args sprintf (and extra) arguments to use.
151 + * @param int $object_id Target object id.
152 + * @param string $context Context of the event.
153 + * @param string $action Action of the event.
154 + * @param int $user_id User responsible for the event.
155 155 *
156 156 * @return bool
157 157 */
158 158 public function log( $message, $args, $object_id, $context, $action, $user_id = null ) {
@@ -157,16 +157,8 @@
157 157 */
158 158 public function log( $message, $args, $object_id, $context, $action, $user_id = null ) {
159 159 $connector = $this->name;
160 160
161 - /**
162 - * Override the data logged. Returning false to this filter will stop the data from being logged.
163 - * Examples of this filter in use can be found in some of the custom connectors.
164 - *
165 - * @see Connector_ACF::log_override()
166 - *
167 - * @return array|false An array of the data to be logged or false if it should not be logged.
168 - */
169 161 $data = apply_filters(
170 162 'wp_stream_log_data',
171 163 compact( 'connector', 'message', 'args', 'object_id', 'context', 'action', 'user_id' )
172 164 );
@@ -236,9 +228,9 @@
236 228
237 229 $diff = array_udiff_assoc(
238 230 $old_value,
239 231 $new_value,
240 - function ( $value1, $value2 ) {
232 + function( $value1, $value2 ) {
241 233 // Compare potentially complex nested arrays.
242 234 return wp_json_encode( $value1 ) !== wp_json_encode( $value2 );
243 235 }
244 236 );
@@ -254,9 +246,9 @@
254 246
255 247 // Remove numeric indexes.
256 248 $result = array_filter(
257 249 $result,
258 - function ( $value ) {
250 + function( $value ) {
259 251 // @codingStandardsIgnoreStart
260 252 // check if is not valid number (is_int, is_numeric and ctype_digit are not enough)
261 253 return (string) (int) $value !== (string) $value;
262 254 // @codingStandardsIgnoreEnd
@@ -279,9 +271,9 @@
279 271 } elseif ( $deep ) { // Changed, find what changed, only if we're allowed to explore a new level.
280 272 if ( is_array( $old_value[ $key ] ) && is_array( $new_value[ $key ] ) ) {
281 273 $inner = array();
282 274 $parent = $key;
283 - --$deep;
275 + $deep--;
284 276 $changed = $this->get_changed_keys( $old_value[ $key ], $new_value[ $key ], $deep );
285 277 foreach ( $changed as $child => $change ) {
286 278 $inner[ $parent . '::' . $child ] = $change;
287 279 }
@@ -300,16 +292,6 @@
300 292 * @return bool
301 293 */
302 294 public function is_dependency_satisfied() {
303 295 return true;
304 - }
305 -
306 - /**
307 - * Escape % characters in a string to avoid Uncaught ValueErrors in $this->log().
308 - *
309 - * @param string $value The string value to be escaped.
310 - * @return string The escaped string.
311 - */
312 - public function escape_percentages( $value ) {
313 - return str_replace( '%', '%%', $value );
314 296 }
315 297 }