WordPress.org

Plugin Directory

Changeset 545717


Ignore:
Timestamp:
05/18/12 10:58:08 (2 years ago)
Author:
nbachiyski
Message:

Extract empty tag removal in a static method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ice/trunk/class-ice-span-filter.php

    r545695 r545717  
    6868        } 
    6969 
    70         // Remove empty left over tags 
    71         while ( preg_match( '/<(p|div|span|li|blockquote|h[1-6])\b[^>]*>[ \r\n\t]*<\/\\1>/', $result, $matches ) ) { 
    72             $result = str_replace( $matches[0], '', $result ); 
    73         } 
     70        $result = self::remove_empty_tags( $result ); 
    7471 
    7572        return $result; 
     
    116113        return array(); 
    117114    } 
     115 
     116 
     117    static function remove_empty_tags( $html ) { 
     118        while ( preg_match( '/<(p|div|span|li|blockquote|h[1-6])\b[^>]*>[ \r\n\t]*<\/\\1>/', $html, $matches ) ) { 
     119            $html = str_replace( $matches[0], '', $html ); 
     120        } 
     121        return $html; 
     122    } 
    118123} 
Note: See TracChangeset for help on using the changeset viewer.