WordPress.org

Plugin Directory

Changeset 512224


Ignore:
Timestamp:
02/29/12 10:02:13 (2 years ago)
Author:
BrianLayman
Message:

Minor documentation cleanup

Location:
word-filter-plus/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • word-filter-plus/trunk/csv-manip.php

    r512208 r512224  
    55 * @package word-filter-plus 
    66 *  
    7  * Copyright 2012 - GNU 2 
     7 * Copyright 2012 - eHermits, Inc. LTD - GNU 2 
    88 *  
    99 */ 
    1010  
    11 if (  !class_exists(  'csv_manip'  )  ) { 
     11if ( !class_exists(  'csv_manip'  )  ) { 
    1212    class csv_manip { 
    1313        function csv_manip(){ 
    1414            $this->__construct(); 
    15         } 
     15        } // end csv_manip 
    1616     
    1717        function __construct(){ 
    18         } 
     18        } // end __construct 
    1919         
    2020        private function _valToCsvHelper( $val, $separator, $trimFunction ) { 
     
    4242            } 
    4343            return $val; 
    44         } 
     44        } // end _valToCsvHelper 
    4545 
    4646        private function _define_newline() { 
     
    5454            } 
    5555            return $unewline; 
    56         } 
     56        } // end _define_newline 
    5757 
    5858        private function _get_browser_type() { 
     
    7373     
    7474            return $USER_BROWSER_AGENT; 
    75         } 
     75        } // end _get_browser_type 
    7676 
    7777        private function _get_mime_type() { 
     
    8282                : 'application/octet-stream'; 
    8383            return $mime_type; 
    84         } 
     84        } // end _get_mime_type 
    8585 
    8686        public function arrayToCsvString( $array, $separator=';', $trim='both', $removeEmptyLines=TRUE ) { 
     
    125125                return join( $separator, $ret ); 
    126126            } 
    127         } 
     127        } // end arrayToCsvString 
    128128         
    129129        public function csv2table( $src_file, $table_name, $column_array, $start_row = 1, $truncate = 0 ) { 
     
    183183             
    184184            return $errorMsg; 
    185         } 
     185        } // end csv2table 
    186186 
    187187        public function createcsv( $table, $sep = ";", $fields) { 
     
    217217            echo $csv; 
    218218            die(); 
    219         } 
    220     } // class csv_manip 
    221 } 
     219        } // end createcsv 
     220    }  // end class csv_manip 
     221} // end !class_exists 
  • word-filter-plus/trunk/readme.txt

    r512208 r512224  
    1 === Word Replacer === 
     1=== Word Filter Plus === 
    22Contributors: BrianLayman 
    33Donate link: https://www.thecodecave.com 
     
    77Stable tag: 1.0 
    88 
    9 Filter your posts, pages, excerpts, titles and comments to update or clean the content of your sites. 
     9Update or clean the contents of your site, by filtering or replacing words and phrases in your posts, pages, excerpts, titles and comments. 
    1010 
    1111== Description == 
     
    53531. Upload  to the `/wp-content/plugins/` directory. Or Directly upload from your Plugin management page. 
    54542. Activate the plugin through the 'Plugins' menu in WordPress 
    55 3. Go to Tools menu and you will see Word Replacer sub menu.  
     553. Go to Tools menu and you will see Word Filter Plus sub menu.  
    5656 
    5757== Frequently Asked Questions == 
    58 None Yet. 
     58None. Yet.  
     59 
     60But if you do have questions, please ask them on the WordPress.org forum for this plugin: http://wordpress.org/tags/word-filter-plus?forum_id=10 
    5961 
    6062== Screenshots == 
  • word-filter-plus/trunk/wfp-settings.php

    r512208 r512224  
    55 * @package word-filter-plus 
    66 *  
    7  * Copyright 2012 - GNU 2 
     7 * Copyright 2012 - eHermits, Inc. LTD - GNU 2 
    88 *  
    99 */ 
     
    2828        function wfp_settings( $owner ){ 
    2929            $this->__construct( $owner ); 
    30         } 
     30        } // end wfp_settings 
    3131 
    3232        function __construct( $owner ){ 
     
    6464            $this->csvManip = new csv_manip( $this ); 
    6565 
    66         } 
     66        } // end __construct 
    6767 
    6868        function script(){ 
     
    117117            <?php 
    118118            } 
    119         } /* end script */ 
     119        } // end script 
    120120 
    121121        function help_tab2( $help ) { 
     
    156156            } 
    157157            return $help; 
    158         } /* end help_tab2 */ 
     158        } // end help_tab2 
    159159 
    160160        function help_tab4( $help ) { 
     
    173173            } 
    174174            return $help; 
    175         } /* end help_tab4 */ 
     175        } // end help_tab4 
    176176 
    177177        function save_replacement_data() { 
     
    243243                $message = '<div id="message" class="updated fade"><p><strong>Please add a field first.</strong></p></div>'; 
    244244            } 
    245             delete_transient( 'word_filter_plus_replacements' ); /*update transient each time update data*/ 
     245            delete_transient( 'word_filter_plus_replacements' ); 
    246246            return $message; 
    247         } 
     247        } // end save_replacement_data 
    248248 
    249249        function import_csv() { 
     
    255255            $truncate = intval( $_POST[ 'empty_first' ] ); 
    256256            $message = $this->csvManip->csv2table( $_FILES[ 'file' ][ 'tmp_name' ], $this->parent->plugin_table_name, $this->parent->field_names, $startrow, $truncate ); 
    257             delete_transient( 'word_filter_plus_replacements' ); /* Update transient each time update data */ 
     257            delete_transient( 'word_filter_plus_replacements' ); 
    258258            return $message; 
    259         } 
     259        } // end import_csv 
    260260 
    261261        function export_csv() { 
     
    265265            } 
    266266            return $this->csvManip->createcsv( $this->parent->plugin_table_name, ",", $this->parent->field_names ); 
    267         } /* export_csv */ 
     267        } // export_csv 
    268268 
    269269        function process_post_tab2(){ 
     
    273273            } 
    274274            echo $message; 
    275         } /* end process_post_tab2 */ 
     275        } // end process_post_tab2 
    276276 
    277277        function process_post_tab3(){ 
     
    290290            } 
    291291            echo $message; 
    292         } /* end process_post_tab3 */ 
     292        } // end process_post_tab3 
    293293 
    294294        function process_post_tab4(){ 
     
    302302                echo $message; 
    303303            } 
    304         } /* end process_post_tab4 */ 
     304        } // end process_post_tab4 
    305305 
    306306        function wfp_do_settings_section($page, $sectionID) { 
     
    321321                echo '</table>'; 
    322322            } 
    323         } 
     323        } // end wfp_do_settings_section 
    324324 
    325325        function register_settings() { 
     
    339339            register_setting( 'wfp-group-tab3', WFP_OPTION_BATCH_SLEEP, 'intval' ); 
    340340            add_settings_field( 'wfp-tab3-wfp-batch-sleep', 'Pause length between posts?', array( $this, 'display_batch_sleep' ), $this->parent->plugin_slug, WFP_PLUGIN_TAB3_SLUG ); 
    341         } 
     341        } // end  
    342342 
    343343        function settings_page_init() { 
    344344            $settings_page = add_management_page( $this->parent->plugin_name, $this->parent->plugin_name, 'manage_options', $this->parent->plugin_slug, array( $this, 'wfp_settings_page') ); 
    345         } 
     345        } // end register_settings 
    346346 
    347347        function wfp_admin_tabs( $current = WFP_TAB1_SLUG ) {  
     
    368368            } 
    369369            echo '</h2>'; 
    370         } 
     370        } // end wfp_admin_tabs 
    371371 
    372372        function wfp_settings_page() { 
     
    405405            </div> 
    406406            <?php 
    407         } 
     407        } // end wfp_settings_page 
    408408 
    409409        function display_section1_text() { 
     
    412412            echo '<p></p>'; 
    413413            echo '<p>This plugin can be used passively (it changes text as it is displayed) or actively (it changes the contents of the database as the information is saved).  It can also can be used do batch cleanup, replacing the content of existing posts.</p>'; 
    414         } 
     414        } // end display_section1_text 
    415415 
    416416        function display_section3_text() { 
    417417            echo '<p>This plugin has the ablity to process all of the existing content on your site and perform the replacements.  This can be a very time consuming process. A large site might have tens of thousands of posts. If not done strategically, an intensive search and replace could bring the entire webserver to a screeching halt. This plugin is written in a way that this can be avoided.</p>'; 
    418418            echo '<p>WordPress Filter Plus takes advantage of the ablity of WordPress to schedule tasks so that the process of cleaning up your content can be done over an extended period of time. Use the options below to specify the rate at which your site is updated.</p>'; 
    419         } 
     419        } // end display_section3_text 
    420420 
    421421        function display_wfp_mode() { 
     
    424424            echo '<input type="radio" name="' . WFP_OPTION_MODE . '" value="' . WFP_MODE_PASSIVE . '" ' . checked( WFP_MODE_PASSIVE, $optionValue, false ) . '/> Passive <small>(Change content as it is displayed. Slight performance cost.</small><br />'; 
    425425            echo '<input type="radio" name="' . WFP_OPTION_MODE . '" value="' . WFP_MODE_ACTIVE . '" ' . checked( WFP_MODE_ACTIVE, $optionValue, false ) . '/> Active<small>(Change content as it is saved. Alters content.)</small><br />'; 
    426         } 
     426        } // end display_wfp_mode 
    427427 
    428428        function display_batch_schedule() { 
     
    432432            echo '<input type="radio" name="' . WFP_OPTION_BATCH_SCHEDULE . '" value="' . WFP_SCHEDULE_THIRTY . '" ' . checked( WFP_SCHEDULE_THIRTY, $optionValue, false ) . '/> Every 30 Minutes <small></small><br />'; 
    433433            echo '<input type="radio" name="' . WFP_OPTION_BATCH_SCHEDULE . '" value="' . WFP_SCHEDULE_SIXTY . '" ' . checked( WFP_SCHEDULE_SIXTY, $optionValue, false ) . '/> Every 60 Minutes <small></small><br />'; 
    434         } 
     434        } // end display_batch_schedule 
    435435 
    436436        function display_batch_size() { 
     
    441441            echo "Start with a smaller number if in doubt.<br/>"; 
    442442            echo "<input id='wfp-tab3-wfp-batch-size' name='" . WFP_OPTION_BATCH_SIZE . "' size='6' type='text' value='{$optionVal}' />"; 
    443         } 
     443        } // end display_batch_size 
    444444 
    445445        function display_batch_sleep() { 
     
    447447            echo "How many milliseconds between each posts item is checked? This gives a server time to respond. Use small numbers. 120 is just over 1/10 of a second, but would still add 2 minutes to a 1000 post batch.<br/>"; 
    448448            echo "<input id='wfp-tab3-wfp-batch-sleep' name='" . WFP_OPTION_BATCH_SLEEP . "'. size='6' type='text' value='{$optionVal}' />"; 
    449         } 
     449        } // end display_batch_sleep 
    450450 
    451451        function display_tab1() { 
     
    491491</div> 
    492492            <?php 
    493         }                            
     493        } // end display_tab1 
    494494 
    495495        function display_tab2() { 
     
    589589            </div> 
    590590            <?php 
    591         } 
     591        } // end display_tab2 
    592592 
    593593        function display_tab3() { 
     
    676676                } 
    677677            } 
    678         } 
     678        } // end display_tab3 
    679679 
    680680        function display_tab4() { 
     
    713713            </div> 
    714714            <?php 
    715         } 
    716     } /* class wfp_settings */ 
     715        } // end display_tab4 
     716    } // class wfp_settings 
    717717     
    718 } 
     718} // end !class_exists 
  • word-filter-plus/trunk/word-filter-plus.php

    r512208 r512224  
    22/* 
    33Plugin Name: Word Filter Plus 
    4 Plugin URI: http://TheCodeCave.com 
    5 Description: Replace word in post, page, title or comment. Now with RegEx supports. 
     4Plugin URI: http://wordpress.org/extend/plugins/word-filter-plus/ 
     5Description: Filter or replace words or phrases in posts, pages, excerpts, titles and/or comments. 
    66Author: Brian C. Layman 
    77Version: 1.0 
     
    137137        public function replacement_list() { 
    138138            global $wpdb; 
    139             /* now use Transients API to reduce db load :D */ 
    140             if ( false === ( $word_filter_plus_replacements = get_transient( 'word_filter_plus_replacements' ) ) ) { 
     139            if ( !$word_filter_plus_replacements = get_transient( 'word_filter_plus_replacements' ) ) { 
    141140                /* It wasn't there, so regenerate the data and save the transient*/ 
    142141                $word_filter_plus_replacements = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $this->plugin_table_name . " ORDER BY id" ), ARRAY_A ) ; 
     
    144143            } 
    145144            return $word_filter_plus_replacements; 
    146         } /* end replacement_list */ 
     145        } // end replacement_list 
    147146         
    148147        public function _specialchar( $string ) { 
    149148            return htmlspecialchars( stripcslashes( $string ) ); 
    150         } 
     149        } // end _specialchar 
    151150         
    152151        public function valid_modes( $input ) { 
    153152            if ( !( in_array( $input, array( WFP_MODE_OFF, WFP_MODE_PASSIVE, WFP_MODE_ACTIVE ) ) ) ) return WFP_MODE_OFF; 
    154153            return $input; 
    155         } 
     154        } // end valid_modes 
    156155 
    157156        public function valid_schedules( $input ) { 
    158157            if ( !( in_array( $input, array( WFP_SCHEDULE_FIVE, WFP_SCHEDULE_FIFTEEN, WFP_SCHEDULE_THIRTY, WFP_SCHEDULE_SIXTY ) ) ) ) return WFP_SCHEDULE_SIXTY; 
    159158            return $input; 
    160         } 
     159        } // end valid_schedules 
    161160 
    162161        static function installed_version() { 
     
    186185                update_option( WFP_OPTION_VER, $this->plugin_version ); 
    187186            } 
    188         } /* end installed_version */ 
     187        } // end installed_version 
    189188         
    190189        private function do_replacement( $original='', $replacement='', $case_insensitive='', $partial_match='', $use_regex='', $string='' ) { 
     
    193192            $original = ( $use_regex == 'yes' ) ? $original : preg_quote( $original ); 
    194193            return preg_replace( "/$b$original$b/$i", $replacement, $string ); 
    195         } /* end do_replacement */ 
     194        } // end do_replacement 
    196195         
    197196        function filter_content( $content, $force = false ) { 
     
    212211            } 
    213212            return $content; 
    214         } /* end filter_content **/ 
     213        } // end filter_content  
    215214         
    216215        function filter_comment( $content ) { 
     
    229228            } 
    230229            return $content; 
    231         } /* end filter_comment */ 
     230        } // end filter_comment 
    232231         
    233232        function filter_title( $content, $force = false  ) { 
     
    246245            } 
    247246            return $content; 
    248         } /* end filter_title */ 
     247        } // end filter_title 
    249248     
    250249        function settings_link( $links ) { 
     
    252251            array_unshift( $links, $settings_link ); 
    253252            return $links; 
    254         }  /* end settings_link */ 
     253        }  // end settings_link 
    255254         
    256255        function schedule_batch( $event ){       
     
    267266                if ( WFP_DEBUG ) error_log("Still NOT scheduled: $scheduledInterval, $event"); 
    268267            } 
    269  
    270         } 
     268        } // end schedule_batch 
    271269 
    272270        function cancel_batch( $event ){ 
     
    282280                delete_option( WFP_OPTION_ITERATION ); 
    283281            } 
    284         } 
     282        } // end cancel_batch 
    285283     
    286284        function add_cron_schedule( $schedules ) { 
     
    301299          
    302300            return $schedules; 
    303         } 
     301        } // end add_cron_schedule 
    304302 
    305303        function process_wfpPostEvent() { 
     
    405403            if ( WFP_DEBUG ) error_log( "Batch Done. Exiting" ); 
    406404            delete_transient( 'batch_running' ); 
    407         } 
     405        } // end process_wfpPostEvent 
    408406 
    409407        function process_wfpCommentEvent() { 
     
    497495            if ( WFP_DEBUG ) error_log("Batch Done. Exiting"); 
    498496            delete_transient( 'batch_running' ); 
    499         } 
    500     } /* end class */ 
    501 } /* if !classexists */ 
     497        } // end process_wfpCommentEvent 
     498    } // class WordFilter 
     499} // end if !class_exists 
    502500 
    503501if ( class_exists( 'WordFilter' ) ) { 
    504502    $WordFilter = new WordFilter(); 
    505 } 
     503} // end if class_exists 
Note: See TracChangeset for help on using the changeset viewer.