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

@@ 386-412 (lines=27) @@
383
	 *
384
	 * @since 2.7
385
	 */
386
	public function strip_html ( $value, $options = null ) {
387
		if ( is_array( $value ) )
388
			$value = @implode( ' ', $value );
389
390
		$value = trim( $value );
391
392
		if ( empty( $value ) )
393
			return $value;
394
395
		$options = (array) $options;
396
397
		if ( 1 == pods_var( self::$type . '_allow_html', $options, 0, null, true ) ) {
398
			$allowed_html_tags = '';
399
400
			if ( 0 < strlen( pods_var( self::$type . '_allowed_html_tags', $options ) ) ) {
401
				$allowed_html_tags = explode( ' ', trim( pods_var( self::$type . '_allowed_html_tags', $options ) ) );
402
				$allowed_html_tags = '<' . implode( '><', $allowed_html_tags ) . '>';
403
			}
404
405
			if ( !empty( $allowed_html_tags ) && '<>' != $allowed_html_tags )
406
				$value = strip_tags( $value, $allowed_html_tags );
407
		}
408
		else
409
			$value = strip_tags( $value );
410
411
		return $value;
412
	}
413
414
	/**
415
	 * Validate an target attribute with the options