Code Duplication    Length = 27-27 lines in 2 locations

classes/fields/text.php 1 location

@@ 279-305 (lines=27) @@
276
     *
277
     * @return string
278
     */
279
    public function strip_html ( $value, $options = null ) {
280
        if ( is_array( $value ) )
281
            $value = @implode( ' ', $value );
282
283
        $value = trim( $value );
284
285
        if ( empty( $value ) )
286
            return $value;
287
288
        $options = (array) $options;
289
290
        if ( 1 == pods_var( self::$type . '_allow_html', $options, 0, null, true ) ) {
291
            $allowed_html_tags = '';
292
293
            if ( 0 < strlen( pods_var( self::$type . '_allowed_html_tags', $options ) ) ) {
294
                $allowed_html_tags = explode( ' ', trim( pods_var( self::$type . '_allowed_html_tags', $options ) ) );
295
                $allowed_html_tags = '<' . implode( '><', $allowed_html_tags ) . '>';
296
            }
297
298
            if ( !empty( $allowed_html_tags ) && '<>' != $allowed_html_tags )
299
                $value = strip_tags( $value, $allowed_html_tags );
300
        }
301
        else
302
            $value = strip_tags( $value );
303
304
        return $value;
305
    }
306
}
307

classes/fields/website.php 1 location

@@ 419-445 (lines=27) @@
416
	 *
417
	 * @since 2.7
418
	 */
419
	public function strip_html ( $value, $options = null ) {
420
		if ( is_array( $value ) )
421
			$value = @implode( ' ', $value );
422
423
		$value = trim( $value );
424
425
		if ( empty( $value ) )
426
			return $value;
427
428
		$options = (array) $options;
429
430
		if ( 1 == pods_var( self::$type . '_allow_html', $options, 0, null, true ) ) {
431
			$allowed_html_tags = '';
432
433
			if ( 0 < strlen( pods_var( self::$type . '_allowed_html_tags', $options ) ) ) {
434
				$allowed_html_tags = explode( ' ', trim( pods_var( self::$type . '_allowed_html_tags', $options ) ) );
435
				$allowed_html_tags = '<' . implode( '><', $allowed_html_tags ) . '>';
436
			}
437
438
			if ( !empty( $allowed_html_tags ) && '<>' != $allowed_html_tags )
439
				$value = strip_tags( $value, $allowed_html_tags );
440
		}
441
		else
442
			$value = strip_tags( $value );
443
444
		return $value;
445
	}
446
447
	/**
448
	 * Validate an target attribute with the options