The page you are looking at now is at this URL: http://pastoid.com/b2h
This paste was last updated on July 12, 2010 at 11:52 am.
<?php class TwitterComments extends Plugin { /** * Simple plugin configuration * @return FormUI The configuration form **/ public function configure() { $ui = new FormUI( 'twittercomments' ); $ui->append( 'checkbox', 'comments_require_id', 'comments_require_id', _t( 'Require Comment Author Info <b>(Uncheck to enable Twitter Comments)</b>', 'twittercomments' ) ); $ui->append( 'submit', 'save', _t( 'Save', 'twittercomments' ) ); return $ui; } /** * Remove fields, replace with twitter username * ... * @return the form **/ public function action_form_comment( $form, $context = 'public' ) { // only modify the form if the resulting one can be accepted successfully. if ( ! Options::get( 'comments_require_id' ) ) { $form->append( 'hidden', 'twitter_comment' )->value = true; // add the twitter username $form->append( 'text', 'twitter_username', 'null:null', _t( 'Twitter Username', 'twittercomments' ) )->add_validator( 'validate_required', _t( 'Twitter username is required', 'twittercomments' ) )->tabindex = 1; $form->move_before( $form->twitter_username, $form->cf_commenter ); // remove the existing fields $form->cf_commenter->remove(); $form->cf_email->remove(); $form->cf_url->remove(); } return $form; } /** * Populate the fields * ... * @return the form **/ public function action_comment_form_submit ( $form ) { if( $form->twitter_comment->value ) { $form->append( 'hidden', 'cf_commenter' )->value = $form->twitter_username->value; $form->append( 'hidden', 'cf_email' )->value = '@' . $form->twitter_username->value; $form->append( 'hidden', 'cf_url' )->value = 'http://twitter.com/' . $form->twitter_username->value; } return $form; } /** * Add commentinfo for twitter comments * * @param Comment The comment that will be processed before storing it in the database. * @return Comment The comment result to store. **/ function action_comment_insert_before ( Comment $comment ) { // This plugin ignores non-comments if ( $comment->type != Comment::COMMENT ) { return $comment; } if ( isset( $_POST[ sprintf( '%x', crc32( 'twitter_comment' ) )] ) ) { $comment->info->twittercomment = true; } return $comment; } function set_priorities() { return array( 'action_form_comment' => 10, ); } /** * Add update beacon support **/ public function action_update_check() { Update::add( $this->info->name, $this->info->guid, $this->info->version ); } } ?>
| Referring Domain | Hits |
|---|---|
| Unknown Referer | 127 |
| pastoid.com | 10 |
Tip: Use Pastoid to shorten URLs with this bookmarklet: Pastoid This