Source Code For censored.php

Turn Line Numbers Off
  1. <?php
  2. /*
  3. Plugin Name: Censored Comment
  4. Version: 0.1
  5. Plugin URI: http://jfoucher.info/2004/10/06/censored-comment-wordpress-plugin/
  6. Description: Writes a text that shows that a comment has been censored
  7. Author: Jonathan Foucher
  8. Author URI: http://jfoucher.info
  9. This plugin supports Automatic Update : http://wiki.wordpress.org/AutomaticUpdate
  10. Update: http://jfoucher.info/plugin-update.php?p=34
  11. Copyright (c) 2004
  12. Released under the GPL license
  13. http://www.gnu.org/licenses/gpl.txt
  14.     This program is distributed in the hope that it will be useful,
  15.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.     GNU General Public License for more details.
  18.     You should have received a copy of the GNU General Public License
  19.     along with this program; if not, write to the Free Software
  20.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  21. */
  22. /************************************
  23. ** TO TAKE ADVANTAGE OF UPDATE **
  24. ** DETECTION, PLEASE CONSIDER **
  25.  ** MAKING THE FOLLOWING ADDITION **
  26.   ** TO YOUR WORDPRESS INSTALL **
  27.   ** **
  28.    *************************************
  29.     OPEN FOR EDITING : wp-admin/plugins.php
  30.     FIND
  31.             if ( preg_match("|Version:(.*)|i", $plugin_data, $version) )
  32.                     $version = $version1?;
  33.                 else
  34.                     $version ='';
  35.     ADD THE FOLLOWING CODE AFTERWARDS
  36.                 // BEGIN PLUGIN UPDATE ADD-ON
  37.     if ( preg_match("|Update:(.*)|i", $plugin_data, $update) )
  38.     {
  39.       $update = $update[1];
  40.       $update = trim($update);
  41.         if ($u = @file("$update")) {
  42.           $u = implode('',$u);
  43.           $u = trim($u);
  44.           $v = trim($version);
  45.           if($u != $v){
  46.             $updatelink = '<a href="';
  47.             $updatelink .= $plugin_uri[1];
  48.             $updatelink .= '">';
  49.             $updatelink .= '<em><strong>Update Available:</strong> (';
  50.             $updatelink .= $u;
  51.             $updatelink .= ')</em></a>';
  52.             $description[1] .= '<br />';
  53.             $description[1] .= $updatelink;
  54.                       }
  55.           else
  56.           {
  57.           $updatelink = '';
  58.           }
  59.         
  60.         }
  61.         else{
  62.           $updatelink = '';
  63.         }
  64.     }
  65.     else
  66.     {  $update ='';}
  67.     //END PLUGIN UPDATE ADD-ON
  68.              */
  69. /**********************
  70. Please define the text you would to display above an edited comment
  71. ************************/
  72. $censor_text="<p>This post has been censored</p>";
  73. /**********************
  74. Stop editing
  75. ************************/
  76. function censor($comment_ID) {
  77. global $content,$comment,$tablecomments,$wpdb,$censor_text;
  78. if (!$censor_text$censor_text="<p>This post has been censored</p>";
  79. if (!eregi($censor_text,$content)){
  80. $content=$censor_text."\n".$content;
  81. }
  82.     $result $wpdb->query("UPDATE $tablecomments SET comment_content = '$content' WHERE comment_ID = '$comment_ID'");
  83.   
  84. }
  85. add_filter('edit_comment''censor');
  86. ?>