Code Duplication    Length = 7-9 lines in 3 locations

modules/widgets/eu-cookie-law.php 1 location

@@ 286-292 (lines=7) @@
283
		 *
284
		 * @return string $value if pass the check or first value from allowed values.
285
		 */
286
		function filter_value( $value, $allowed = array() ) {
287
			$allowed = (array) $allowed;
288
			if ( empty( $value ) || ( ! empty( $allowed ) && ! in_array( $value, $allowed ) ) ) {
289
				$value = $allowed[0];
290
			}
291
			return $value;
292
		}
293
	}
294
295
	// Register Jetpack_EU_Cookie_Law_Widget widget.

modules/widgets/facebook-likebox.php 1 location

@@ 284-292 (lines=9) @@
281
		return (int) $value;
282
	}
283
284
	function normalize_text_value( $value, $default = '', $allowed = array() ) {
285
		$allowed = (array) $allowed;
286
287
		if ( empty( $value ) || ( ! empty( $allowed ) && ! in_array( $value, $allowed ) ) ) {
288
			$value = $default;
289
		}
290
291
		return $value;
292
	}
293
294
	/**
295
	 * @deprecated

modules/widgets/googleplus-badge.php 1 location

@@ 319-327 (lines=9) @@
316
		return ( false !== strpos( $url, 'plus.google.com' ) ) ? true : false;
317
	}
318
319
	function filter_text( $value, $default = '', $allowed = array() ) {
320
		$allowed = (array) $allowed;
321
322
		if ( empty( $value ) || ( ! empty( $allowed ) && ! in_array( $value, $allowed ) ) ) {
323
			$value = $default;
324
		}
325
326
		return $value;
327
	}
328
}
329
330
// END