Changeset 659
- Timestamp:
- 2008-06-30 09:39:10 (3 months ago)
- Files:
-
- 1 modified
-
plugins/preapproved/trunk/preapproved.plugin.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugins/preapproved/trunk/preapproved.plugin.php
r655 r659 3 3 /* 4 4 * PreApproved Class 5 * 5 * 6 6 * This class allows us to auto-approve comments 7 7 * … … 35 35 if ( realpath( $file ) == __FILE__ ) { 36 36 EventLog::register_type( 'PreApproved' ); 37 if ( !(Options::get( 'preapproved__approved_count' ) ) ) {37 if ( !( Options::get( 'preapproved__approved_count' ) ) ) { 38 38 Options::set( 'preapproved__approved_count', 1 ); 39 39 } … … 53 53 public function filter_plugin_config($actions, $plugin_id) 54 54 { 55 if ( $plugin_id == $this->plugin_id()) {56 $actions[] = _t( 'Configure' );55 if ( $plugin_id == $this->plugin_id() ) { 56 $actions[]= _t( 'Configure' ); 57 57 } 58 58 return $actions; … … 62 62 { 63 63 if ( $plugin_id == $this->plugin_id() ) { 64 switch ( $action) {64 switch ( $action ) { 65 65 case _t( 'Configure' ): 66 66 $form= new FormUI( 'preapproved' ); … … 68 68 $form->approved_count->add_validator( array( $this, 'validate_integer' ) ); 69 69 $form->append( 'submit', 'save', _t( 'Save' ) ); 70 $form->set_option( 'success_message', _t( 'Configuration saved' ) ); 70 71 $form->out(); 71 72 break; … … 78 79 * This function is executed when the action "comment_insert_before" 79 80 * is invoked from a Comment object. 80 * The parent class, Plugin, handles registering the action 81 * and hook name using the name of the function to determine 81 * The parent class, Plugin, handles registering the action 82 * and hook name using the name of the function to determine 82 83 * where it will be applied. 83 84 * You can still register functions as hooks without using … … 90 91 // This plugin ignores non-comments 91 92 if( $comment->type == Comment::COMMENT ) { 92 if( Comments::get( array( 'email' => $comment->email, 'name' => $comment->name, 93 if( Comments::get( array( 'email' => $comment->email, 'name' => $comment->name, 93 94 'url' => $comment->url, 'status' => Comment::STATUS_APPROVED ) )->count >= Options::get( 'preapproved__approved_count' ) ) { 94 95 $comment->status = Comment::STATUS_APPROVED; … … 105 106 106 107 /* 107 * Add update beacon support 108 * Add update beacon support 108 109 */ 109 110 function action_update_check() 110 111 { 111 Update::add( 'PreApproved', '0fa22c74-a0d6-11dc-8314-0800200c9a66', $this->info->version ); 112 Update::add( 'PreApproved', '0fa22c74-a0d6-11dc-8314-0800200c9a66', $this->info->version ); 112 113 } 113 114
