Plugin Directory

Changeset 1418979


Ignore:
Timestamp:
05/17/2016 05:46:46 PM (10 years ago)
Author:
ericjuden
Message:

Updated code to better adhere to WordPress coding standards.

Location:
style-stripper/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • style-stripper/trunk/readme.txt

    r1234393 r1418979  
    33Tags: remove, delete, styles, inline styles, multisite
    44Requires at least: 3.0
    5 Tested up to: 4.3
     5Tested up to: 4.5.2
    66Stable tag: trunk
    77
     
    1717
    1818== Changelog ==
     19= 1.0.1 =
     20* Updated code to better adhere to WordPress coding standards.
     21
    1922= 1.0 =
    2023* Initial release
  • style-stripper/trunk/style-stripper.php

    r553997 r1418979  
    55Description: Removes all inline style tags from the content of posts/pages/custom post types.
    66Author: ericjuden
    7 Version: 1.0
     7Version: 1.0.1
    88Author URI: http://ericjuden.com
    99Network: true
     
    1111
    1212class Style_Stripper {
    13     function __construct(){
    14         add_action('add_meta_boxes', array(&$this, 'show_filtered_content'), 1, 2);
    15         add_filter('the_content', array(&$this, 'filter_content'));
     13    function __construct() {
     14        add_action( 'add_meta_boxes' , array( $this, 'show_filtered_content' ) , 1 , 2 );
     15        add_filter( 'the_content' , array( $this, 'filter_content' ) );
    1616    }
    1717   
    18     function clean_content($content){   
     18    function clean_content( $content ) {
    1919        // Search $content for style='' and style="" and remove
    20         $patterns = array('/(<[^>]+) style=".*?"/i', "/(<[^>]+) style='.*?'/i");
    21         $content = preg_replace($patterns, '$1', $content);
     20        $patterns = array( '/(<[^>]+) style=".*?"/i' , "/(<[^>]+) style='.*?'/i" );
     21        $content = preg_replace( $patterns , '$1' , $content );
    2222       
    23         return apply_filters('style_stripper_strip_styles', $content);
     23        return apply_filters( 'style_stripper_strip_styles' , $content );
    2424    }
    2525   
    26     function filter_content($content){
    27         $content = $this->clean_content($content);
     26    function filter_content( $content ) {
     27        $content = $this->clean_content( $content );
    2828        return $content;
    2929    }
    3030   
    31     function show_filtered_content($post_type, $post){
    32         $post->post_content = $this->clean_content($post->post_content);
     31    function show_filtered_content( $post_type , $post ) {
     32        $post->post_content = $this->clean_content( $post->post_content );
    3333    }
    3434}
Note: See TracChangeset for help on using the changeset viewer.