Code Duplication    Length = 27-27 lines in 2 locations

classes/fields/link.php 1 location

@@ 471-497 (lines=27) @@
468
     *
469
     * @return string
470
     */
471
    public function strip_html ( $value, $options = null ) {
472
        if ( is_array( $value ) )
473
            $value = @implode( ' ', $value );
474
475
        $value = trim( $value );
476
477
        if ( empty( $value ) )
478
            return $value;
479
480
        $options = (array) $options;
481
482
        if ( 1 == pods_var( self::$type . '_allow_html', $options, 0, null, true ) ) {
483
            $allowed_html_tags = '';
484
485
            if ( 0 < strlen( pods_var( self::$type . '_allowed_html_tags', $options ) ) ) {
486
                $allowed_html_tags = explode( ' ', trim( pods_var( self::$type . '_allowed_html_tags', $options ) ) );
487
                $allowed_html_tags = '<' . implode( '><', $allowed_html_tags ) . '>';
488
            }
489
490
            if ( !empty( $allowed_html_tags ) && '<>' != $allowed_html_tags )
491
                $value = strip_tags( $value, $allowed_html_tags );
492
        }
493
        else
494
            $value = strip_tags( $value );
495
496
        return $value;
497
    }
498
499
}
500

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