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

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