Code Duplication    Length = 27-27 lines in 2 locations

classes/fields/text.php 1 location

@@ 270-296 (lines=27) @@
267
     *
268
     * @return string
269
     */
270
    public function strip_html ( $value, $options = null ) {
271
        if ( is_array( $value ) )
272
            $value = @implode( ' ', $value );
273
274
        $value = trim( $value );
275
276
        if ( empty( $value ) )
277
            return $value;
278
279
        $options = (array) $options;
280
281
        if ( 1 == pods_var( self::$type . '_allow_html', $options, 0, null, true ) ) {
282
            $allowed_html_tags = '';
283
284
            if ( 0 < strlen( pods_var( self::$type . '_allowed_html_tags', $options ) ) ) {
285
                $allowed_html_tags = explode( ' ', trim( pods_var( self::$type . '_allowed_html_tags', $options ) ) );
286
                $allowed_html_tags = '<' . implode( '><', $allowed_html_tags ) . '>';
287
            }
288
289
            if ( !empty( $allowed_html_tags ) && '<>' != $allowed_html_tags )
290
                $value = strip_tags( $value, $allowed_html_tags );
291
        }
292
        else
293
            $value = strip_tags( $value );
294
295
        return $value;
296
    }
297
}
298

classes/fields/website.php 1 location

@@ 403-429 (lines=27) @@
400
	 *
401
	 * @since 2.7
402
	 */
403
	public function strip_html ( $value, $options = null ) {
404
		if ( is_array( $value ) )
405
			$value = @implode( ' ', $value );
406
407
		$value = trim( $value );
408
409
		if ( empty( $value ) )
410
			return $value;
411
412
		$options = (array) $options;
413
414
		if ( 1 == pods_var( self::$type . '_allow_html', $options, 0, null, true ) ) {
415
			$allowed_html_tags = '';
416
417
			if ( 0 < strlen( pods_var( self::$type . '_allowed_html_tags', $options ) ) ) {
418
				$allowed_html_tags = explode( ' ', trim( pods_var( self::$type . '_allowed_html_tags', $options ) ) );
419
				$allowed_html_tags = '<' . implode( '><', $allowed_html_tags ) . '>';
420
			}
421
422
			if ( !empty( $allowed_html_tags ) && '<>' != $allowed_html_tags )
423
				$value = strip_tags( $value, $allowed_html_tags );
424
		}
425
		else
426
			$value = strip_tags( $value );
427
428
		return $value;
429
	}
430
431
	/**
432
	 * Validate an target attribute with the options