| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /* |
|---|
| 4 | Plugin Name: Test comment_text args param |
|---|
| 5 | Plugin URI: http://simonwheatley.co.uk/wordpress/tctap |
|---|
| 6 | Description: A quick plugin to test that the proposed comment_text filter <var>$args</var> parameter actually works. |
|---|
| 7 | Version: 0.1 |
|---|
| 8 | Author: Simon Wheatley |
|---|
| 9 | Author URI: http://simonwheatley.co.uk/wordpress/ |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | /* Copyright 2010 Simon Wheatley |
|---|
| 13 | |
|---|
| 14 | This program is free software; you can redistribute it and/or modify |
|---|
| 15 | it under the terms of the GNU General Public License as published by |
|---|
| 16 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 17 | (at your option) any later version. |
|---|
| 18 | |
|---|
| 19 | This program is distributed in the hope that it will be useful, |
|---|
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 22 | GNU General Public License for more details. |
|---|
| 23 | |
|---|
| 24 | You should have received a copy of the GNU General Public License |
|---|
| 25 | along with this program; if not, write to the Free Software |
|---|
| 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 27 | |
|---|
| 28 | */ |
|---|
| 29 | |
|---|
| 30 | /** |
|---|
| 31 | * Hooks the WP comment_text filter and adds on a print_r of the |
|---|
| 32 | * $args formatting options passed in to test the proposed new |
|---|
| 33 | * $args parameter. |
|---|
| 34 | * |
|---|
| 35 | * @param string $comment_text The HTML content of the comment |
|---|
| 36 | * @param array $args The array of formatting options, if it exists |
|---|
| 37 | * @return string The HTML comment content |
|---|
| 38 | **/ |
|---|
| 39 | function tctap_comment_text( $comment_text, $comment_ID, $args ) { |
|---|
| 40 | $args_printout = print_r( $args, true ); |
|---|
| 41 | $comment_text = "<hr /><pre>Comment ID: $comment_ID\n$args_printout</pre><hr />$comment_text"; |
|---|
| 42 | return $comment_text; |
|---|
| 43 | } |
|---|
| 44 | add_filter( 'comment_text', 'tctap_comment_text', null, 3 ); |
|---|
| 45 | |
|---|
| 46 | ?> |
|---|