Changeset 1877 for trunk


Ignore:
Timestamp:
02/15/2011 12:11:22 PM (15 months ago)
Author:
Xiping.Wang
Message:

[trunk] upgrade wordpress to 3.0.5

Location:
trunk/blogs
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/blogs/readme.html

    r1874 r1877  
    99<h1 id="logo"> 
    1010        <a href="http://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" width="250" height="68" /></a> 
    11         <br /> Version 3.0.4 
     11        <br /> Version 3.0.5 
    1212</h1> 
    1313<p style="text-align: center">Semantic Personal Publishing Platform</p> 
     
    103103 
    104104<h1>Copyright</h1> 
    105 <p>WordPress is released under the <abbr title="GNU Public License">GPL</abbr> (see <a href="license.txt">license.txt</a>).</p> 
     105<p>WordPress is free software, and is released under the terms of the <abbr title="GNU General Public License">GPL</abbr> version 2 or (at your option) any later version. See <a href="license.txt">license.txt</a>.</p> 
    106106 
    107107 
  • trunk/blogs/wp-admin/async-upload.php

    r1874 r1877  
    3131// just fetch the detail form for that attachment 
    3232if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) { 
     33        $post = get_post( $id ); 
     34        if ( 'attachment' != $post->post_type ) 
     35                wp_die( __( 'Unknown post type.' ) ); 
     36        $post_type_object = get_post_type_object( 'attachment' ); 
     37        if ( ! current_user_can( $post_type_object->cap->edit_post, $id ) ) 
     38                wp_die( __( 'You are not allowed to edit this item.' ) ); 
     39 
    3340        if ( 2 == $_REQUEST['fetch'] ) { 
    3441                add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); 
  • trunk/blogs/wp-admin/includes/post.php

    r1874 r1877  
    690690 
    691691        $meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) ); 
     692        if ( empty($meta) ) 
     693                return false; 
    692694        if ( is_serialized_string( $meta->meta_value ) ) 
    693695                $meta->meta_value = maybe_unserialize( $meta->meta_value ); 
  • trunk/blogs/wp-admin/includes/template.php

    r1874 r1877  
    11861186                return; 
    11871187 
    1188         $title = esc_attr( get_the_title( $post->ID ) ); 
     1188        $title = htmlspecialchars( trim( $post->post_title ), ENT_QUOTES ); 
    11891189 
    11901190        echo ' 
     
    11931193        <div class="post_name">' . apply_filters('editable_slug', $post->post_name) . '</div> 
    11941194        <div class="post_author">' . $post->post_author . '</div> 
    1195         <div class="comment_status">' . $post->comment_status . '</div> 
    1196         <div class="ping_status">' . $post->ping_status . '</div> 
    1197         <div class="_status">' . $post->post_status . '</div> 
     1195        <div class="comment_status">' . esc_html( $post->comment_status ) . '</div> 
     1196        <div class="ping_status">' . esc_html( $post->ping_status ) . '</div> 
     1197        <div class="_status">' . esc_html( $post->post_status ) . '</div> 
    11981198        <div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div> 
    11991199        <div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div> 
  • trunk/blogs/wp-admin/includes/update-core.php

    r1874 r1877  
    275275        $required_php_version = '4.3'; 
    276276        $required_mysql_version = '4.1.2'; 
    277         $wp_version = '3.0.4'; 
     277        $wp_version = '3.0.5'; 
    278278        $php_compat     = version_compare( $php_version, $required_php_version, '>=' ); 
    279279        $mysql_compat   = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); 
  • trunk/blogs/wp-admin/js/post.dev.js

    r1874 r1877  
    3737 
    3838        quickClicks : function(el) { 
    39                 var thetags = $('.the-tags', el), tagchecklist = $('.tagchecklist', el), current_tags; 
     39                var thetags = $('.the-tags', el), 
     40                        tagchecklist = $('.tagchecklist', el), 
     41                        id = $(el).attr('id'), 
     42                        current_tags, disabled; 
    4043 
    4144                if ( !thetags.length ) 
    4245                        return; 
    4346 
    44                 var disabled = thetags.attr('disabled'); 
     47                disabled = thetags.attr('disabled'); 
    4548 
    4649                current_tags = thetags.val().split(','); 
     
    4851 
    4952                $.each( current_tags, function( key, val ) { 
    50                         var txt, button_id, id = $(el).attr('id'); 
    51  
    52                         val = $.trim(val); 
    53                         if ( !val.match(/^\s+$/) && '' != val ) { 
    54                                 button_id = id + '-check-num-' + key; 
    55                                 if ( disabled ) 
    56                                         txt = '<span>' + val + '</span> '; 
    57                                 else 
    58                                         txt = '<span><a id="' + button_id + '" class="ntdelbutton">X</a>&nbsp;' + val + '</span> '; 
    59                                 tagchecklist.append(txt); 
    60                                 if ( ! disabled ) 
    61                                         $( '#' + button_id ).click( function(){ tagBox.parseTags(this); }); 
    62                         } 
     53                        var span, xbutton; 
     54 
     55                        val = $.trim( val ); 
     56 
     57                        if ( ! val ) 
     58                                return; 
     59 
     60                        // Create a new span, and ensure the text is properly escaped. 
     61                        span = $('<span />').text( val ); 
     62 
     63                        // If tags editing isn't disabled, create the X button. 
     64                        if ( ! disabled ) { 
     65                                xbutton = $( '<a id="' + id + '-check-num-' + key + '" class="ntdelbutton">X</a>' ); 
     66                                xbutton.click( function(){ tagBox.parseTags(this); }); 
     67                                span.prepend('&nbsp;').prepend( xbutton ); 
     68                        } 
     69 
     70                        // Append the span to the tag list. 
     71                        tagchecklist.append( span ); 
    6372                }); 
    6473        }, 
  • trunk/blogs/wp-admin/js/post.js

    r1874 r1877  
    1 var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(b){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:b,cookie:encodeURIComponent(document.cookie)},function(c){if(c=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(c)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();e("#new"+g).focus();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,p,h,r,o="page"==pagenow||"page-new"==pagenow,q=e("#post_status"),i=e("option[value=publish]",q),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);p=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){r=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){r=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{r=postL10n.publishOnPast;if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(p.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(r+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){q.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",q).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();q.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(q.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",q).text());if(e("option:selected",q).val()=="private"||e("option:selected",q).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",q).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})}); 
     1var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var g=a(".the-tags",d),e=a(".tagchecklist",d),f=a(d).attr("id"),b,c;if(!g.length){return}c=g.attr("disabled");b=g.val().split(",");e.empty();a.each(b,function(i,k){var j,h;k=a.trim(k);if(!k){return}j=a("<span />").text(k);if(!c){h=a('<a id="'+f+"-check-num-"+i+'" class="ntdelbutton">X</a>');h.click(function(){tagBox.parseTags(this)});j.prepend("&nbsp;").prepend(h)}e.append(j)})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(b){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:b,cookie:encodeURIComponent(document.cookie)},function(c){if(c=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(c)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();e("#new"+g).focus();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,p,h,r,o="page"==pagenow||"page-new"==pagenow,q=e("#post_status"),i=e("option[value=publish]",q),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);p=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){r=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){r=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{r=postL10n.publishOnPast;if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(p.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(r+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){q.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",q).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();q.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(q.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",q).text());if(e("option:selected",q).val()=="private"||e("option:selected",q).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",q).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})}); 
  • trunk/blogs/wp-content/plugins/akismet/admin.php

    r1874 r1877  
    88     
    99    // all admin functions are disabled in old versions 
    10     if ( !function_exists('is_multisite') && version_compare( $wp_version, '3.0', '<' ) ) { 
     10    if ( version_compare( $wp_version, '3.0', '<' ) ) { 
    1111         
    1212        function akismet_version_warning() { 
    1313            echo " 
    14             <div id='akismet-warning' class='updated fade'><p><strong>".sprintf(__('Akismet %s requires WordPress 3.0 or higher.'), AKISMET_VERSION) ."</strong> ".sprintf(__('Please <a href="%s">upgrade WordPress</a> to a current version, or <a href="%s">downgrade to version 2.4 of the Akismet plugin</a>.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). "</p></div> 
     14            <div id='akismet-warning' class='updated fade'><p><strong>".sprintf(__('Akismet %s required WordPress 3.0 or higher.'), AKISMET_VERSION) ."</strong> ".sprintf(__('Please <a href="%s">upgrade WordPress</a> to a current version, or <a href="%s">downgrade to version 2.4 of the Akismet plugin</a>.'), 'http://codex.wordpress.org/Upgrading_WordPress', 'http://wordpress.org/extend/plugins/akismet/download/'). "</p></div> 
    1515            "; 
    1616        } 
     
    2525        $hook = 'dashboard_page_akismet-stats-display'; 
    2626    add_action('admin_head-'.$hook, 'akismet_stats_script'); 
    27     add_meta_box('akismet-status', __('Comment History'), 'akismet_comment_status_meta_box', 'comment', 'normal'); 
    28         wp_register_style('akismet.css', AKISMET_PLUGIN_URL . 'akismet.css'); 
    29         wp_enqueue_style('akismet.css'); 
    30         wp_register_script('akismet.js', AKISMET_PLUGIN_URL . 'akismet.js', array('jquery')); 
    31         wp_enqueue_script('akismet.js'); 
     27    add_meta_box('akismet-status', __('Akismet Status'), 'akismet_comment_status_meta_box', 'comment', 'normal'); 
    3228} 
    3329add_action('admin_init', 'akismet_admin_init'); 
     
    3935        if ( function_exists('add_submenu_page') ) 
    4036                add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf'); 
    41 } 
    42  
    43 function akismet_plugin_action_links( $links, $file ) { 
    44         if ( $file == plugin_basename( dirname(__FILE__).'/akismet.php' ) ) { 
    45                 $links[] = '<a href="plugins.php?page=akismet-key-config">'.__('Settings').'</a>'; 
    46         } 
    47  
    48         return $links; 
    49 } 
    50  
    51 add_filter( 'plugin_action_links', 'akismet_plugin_action_links', 10, 2 ); 
     37 
     38} 
    5239 
    5340function akismet_conf() { 
     
    6047                check_admin_referer( $akismet_nonce ); 
    6148                $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] ); 
    62                 $home_url = parse_url( get_bloginfo('url') ); 
    6349 
    6450                if ( empty($key) ) { 
     
    6652                        $ms[] = 'new_key_empty'; 
    6753                        delete_option('wordpress_api_key'); 
    68                 } elseif ( empty($home_url['host']) ) { 
    69                         $key_status = 'empty'; 
    70                         $ms[] = 'bad_home_url'; 
    7154                } else { 
    7255                        $key_status = akismet_verify_key( $key ); 
     
    8669                else 
    8770                        update_option( 'akismet_discard_month', 'false' ); 
    88  
    89                 if ( isset( $_POST['akismet_show_user_comments_approved'] ) ) 
    90                         update_option( 'akismet_show_user_comments_approved', 'true' ); 
    91                 else 
    92                         update_option( 'akismet_show_user_comments_approved', 'false' ); 
    93  
    9471        } elseif ( isset($_POST['check']) ) { 
    9572                akismet_get_server_connectivity(0); 
     
    12198        $messages = array( 
    12299                'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')), 
    123                 'new_key_valid' => array('color' => '4AB915', 'text' => __('Your key has been verified. Happy blogging!')), 
    124                 'new_key_invalid' => array('color' => '888', 'text' => __('The key you entered is invalid. Please double-check it.')), 
    125                 'new_key_failed' => array('color' => '888', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')), 
    126                 'no_connection' => array('color' => '888', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')), 
     100                'new_key_valid' => array('color' => '2d2', 'text' => __('Your key has been verified. Happy blogging!')), 
     101                'new_key_invalid' => array('color' => 'd22', 'text' => __('The key you entered is invalid. Please double-check it.')), 
     102                'new_key_failed' => array('color' => 'd22', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')), 
     103                'no_connection' => array('color' => 'd22', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')), 
    127104                'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (<a href="%s" style="color:#fff">Get your key.</a>)'), 'http://akismet.com/get/')), 
    128                 'key_valid' => array('color' => '4AB915', 'text' => __('This key is valid.')), 
    129                 'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.')), 
    130                 'bad_home_url' => array('color' => '888', 'text' => sprintf( __('Your WordPress home URL %s is invalid.  Please fix the <a href="%s">home option</a>.'), esc_html( get_bloginfo('url') ), admin_url('options.php#home') ) ), 
    131         ); 
     105                'key_valid' => array('color' => '2d2', 'text' => __('This key is valid.')), 
     106                'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.'))); 
    132107?> 
    133108<?php if ( !empty($_POST['submit'] ) ) : ?> 
     
    136111<div class="wrap"> 
    137112<h2><?php _e('Akismet Configuration'); ?></h2> 
    138 <?php if (isset($_GET['message']) && $_GET['message'] == 'success') { ?> 
    139         <div class="updated below-h2" id="message"><p><?php _e( '<strong>Sign up success!</strong> Please check your email for your Akismet API Key and enter it below.' ); ?></p></div> 
    140 <?php } ?> 
    141113<div class="narrow"> 
    142114<form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; "> 
     
    155127<?php } ?> 
    156128<?php akismet_nonce_field($akismet_nonce) ?> 
    157 <p><label><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php if ( get_option('akismet_discard_month') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Auto-delete spam submitted on posts more than a month old.'); ?></label></p> 
    158 <p><label><input name="akismet_show_user_comments_approved" id="akismet_show_user_comments_approved" value="true" type="checkbox" <?php if ( get_option('akismet_show_user_comments_approved') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Show the number of comments you\'ve approved beside each comment author.'); ?></label></p> 
     129<p><label><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php if ( get_option('akismet_discard_month') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Automatically discard spam comments on posts older than a month.'); ?></label></p> 
    159130        <p class="submit"><input type="submit" name="submit" value="<?php _e('Update options &raquo;'); ?>" /></p> 
    160131</form> 
     
    166137        if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) { 
    167138                ?> 
    168                         <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.'); ?></p> 
     139                        <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.'); ?></p> 
    169140                        <p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p> 
    170141                <?php 
     
    180151                        // all connections fail 
    181152                        } elseif ( $fail_count > 0 ) { ?> 
    182                                 <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p> 
     153                                <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p> 
    183154                                <p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p> 
    184155                        <?php 
    185156                        // all connections work 
    186157                        } else { ?> 
    187                                 <p style="padding: .5em; background-color: #4AB915; color: #fff; font-weight:bold;"><?php  _e('All Akismet servers are available.'); ?></p> 
     158                                <p style="padding: .5em; background-color: #2d2; color: #fff; font-weight:bold;"><?php  _e('All Akismet servers are available.'); ?></p> 
    188159                                <p><?php _e('Akismet is working correctly.  All servers are accessible.'); ?></p> 
    189160                        <?php 
     
    191162                } else { 
    192163                        ?> 
    193                                 <p style="padding: .5em; background-color: #888; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p> 
     164                                <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p> 
    194165                                <p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p> 
    195166                        <?php 
     
    205176                asort($servers); 
    206177                foreach ( $servers as $ip => $status ) { 
    207                         $color = ( $status ? '#4AB915' : '#888'); 
     178                        $color = ( $status ? '#2d2' : '#d22'); 
    208179        ?> 
    209180                <tr> 
    210181                <td><?php echo htmlspecialchars($ip); ?></td> 
    211                 <td style="padding: 0 .5em; font-weight:bold; color: #fff; background-color: <?php echo $color; ?>"><?php echo ($status ? __('Accessible') : __('Re-trying') ); ?></td> 
     182                <td style="padding: 0 .5em; font-weight:bold; color: #fff; background-color: <?php echo $color; ?>"><?php echo ($status ? __('No problems') : __('Obstructed') ); ?></td> 
    212183                 
    213184        <?php 
     
    219190        <p><?php if ( get_option('akismet_connectivity_time') ) echo sprintf( __('Last checked %s ago.'), human_time_diff( get_option('akismet_connectivity_time') ) ); ?></p> 
    220191        <p class="submit"><input type="submit" name="check" value="<?php _e('Check network status &raquo;'); ?>" /></p> 
    221         <p><?php printf( __('<a href="%s" target="_blank">Click here</a> to confirm that <a href="%s" target="_blank">Akismet.com is up</a>.'), 'http://status.automattic.com/9931/136079/Akismet-API', 'http://status.automattic.com/9931/136079/Akismet-API' ); ?></p> 
    222192</form> 
    223193 
     
    255225function akismet_stats_display() { 
    256226        global $akismet_api_host, $akismet_api_port, $wpcom_api_key; 
    257         $blog = urlencode( get_bloginfo('url') ); 
     227        $blog = urlencode( get_option('home') ); 
    258228 
    259229        $url = 'http://'; 
     
    276246                return; 
    277247        $path = plugin_basename(__FILE__); 
    278         echo '<h3>' . _x( 'Spam', 'comments' ) . '</h3>'; 
     248        echo '<h3>'.__('Spam').'</h3>'; 
    279249        global $submenu; 
    280250        if ( isset( $submenu['edit-comments.php'] ) ) 
     
    282252        else 
    283253                $link = 'edit.php'; 
    284         echo '<p>'.sprintf( _n( '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', '<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.', $count ), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'</p>'; 
     254        echo '<p>'.sprintf(__('<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.'), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'</p>'; 
    285255} 
    286256add_action('activity_box_end', 'akismet_stats'); 
     
    296266                add_action('admin_notices', 'akismet_warning'); 
    297267                return; 
    298         } elseif ( ( empty($_SERVER['SCRIPT_FILENAME']) || basename($_SERVER['SCRIPT_FILENAME']) == 'edit-comments.php' ) &&  wp_next_scheduled('akismet_schedule_cron_recheck') ) { 
     268        } elseif ( get_option('akismet_connectivity_time') && empty($_POST) && is_admin() && !akismet_server_connectivity_ok() ) { 
    299269                function akismet_warning() { 
    300                         global $wpdb; 
    301                                 $waiting = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) ); 
    302                                 $next_check = human_time_diff( wp_next_scheduled('akismet_schedule_cron_recheck') ); 
    303                                 if ( $waiting > 0 ) 
    304                                         echo " 
    305                         <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet has detected a problem.')."</strong> ".sprintf(_n('A server or network problem prevented Akismet from checking %d comment. It has been temporarily held for moderation and will be automatically re-checked in %s.', 'A server or network problem prevented Akismet from checking %d comments. They have been temporarily held for moderation and will be automatically re-checked in %s.', $waiting), number_format_i18n( $waiting ), $next_check)."</p></div> 
     270                        echo " 
     271                        <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet has detected a problem.')."</strong> ".sprintf(__('A server or network problem is preventing Akismet from working correctly.  <a href="%1$s">Click here for more information</a> about how to fix the problem.'), "plugins.php?page=akismet-key-config")."</p></div> 
    306272                        "; 
    307273                } 
     
    314280 
    315281function akismet_comment_row_action( $a, $comment ) { 
    316  
    317         // failsafe for old WP versions 
    318         if ( !function_exists('add_comment_meta') ) 
    319                 return $a; 
    320  
     282         
     283         
    321284        $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true ); 
    322285        $user_result = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true); 
    323         $comment_status = wp_get_comment_status( $comment->comment_ID ); 
    324286        $desc = null; 
    325287        if ( !$user_result || $user_result == $akismet_result ) { 
    326288                // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same 
    327                 if ( $akismet_result == 'true' && $comment_status != 'spam' && $comment_status != 'trash' ) 
    328                         $desc = __( 'Flagged as spam by Akismet' ); 
    329                 elseif ( $akismet_result == 'false' && $comment_status == 'spam' ) 
    330                         $desc = __( 'Cleared by Akismet' ); 
     289                if ( $akismet_result == 'true' ) 
     290                        $desc = 'Flagged as spam by Akismet'; 
     291                elseif ( $akismet_result == 'false' ) 
     292                        $desc = 'Cleared by Akismet'; 
    331293        } else { 
    332294                $who = get_comment_meta( $comment->comment_ID, 'akismet_user', true ); 
     
    336298                        $desc = sprintf( __('Un-spammed by %s'), $who ); 
    337299        } 
    338  
    339         // add a History item to the hover links, just after Edit 
    340         if ( $akismet_result ) { 
    341                 $b = array(); 
    342                 foreach ( $a as $k => $item ) { 
    343                         $b[ $k ] = $item; 
    344                         if ( $k == 'edit' ) 
    345                                 $b['history'] = '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="'. esc_attr__( 'View comment history' ) . '"> '. __('History') . '</a>'; 
    346                 } 
    347                  
    348                 $a = $b; 
    349         } 
    350                  
     300         
    351301        if ( $desc ) 
    352                 echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' ) . '">'.htmlspecialchars($desc).'</a></span>'; 
    353                  
    354         if ( apply_filters( 'akismet_show_user_comments_approved', get_option('akismet_show_user_comments_approved') ) == 'true' ) { 
    355                 $comment_count = akimset_get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url ); 
    356                 echo '<span class="akismet-user-comment-count" commentid="'.$comment->comment_ID.'" style="display:none;"><br><span class="akismet-user-comment-counts">'.sprintf( _n( '%s approved', '%s approved', $comment_count ), intval($comment_count) ).'</span></span>'; 
    357         } 
     302                echo '<span style="background: #EEE; border: 1px solid #E4E4E4; margin-top: 3px; color: #999; padding: 1px 8px 2px 8px; -moz-border-radius:6px; border-radius:6px; -webkit-border-radius:6px; float: right; line-height: 1.2em;"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' ) . '">'.htmlspecialchars($desc).'</a></span>'; 
    358303         
    359304        return $a; 
     
    361306 
    362307add_filter( 'comment_row_actions', 'akismet_comment_row_action', 10, 2 ); 
     308 
    363309 
    364310function akismet_comment_status_meta_box($comment) { 
     
    409355// END FIXME 
    410356 
    411 // call out URLS in comments 
    412 function akismet_text_add_link_callback( $m ) { 
    413          
    414                 // bare link? 
    415         if ( $m[4] == $m[2] ) 
    416                 return '<a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a>'; 
    417         else 
    418                 return '<span title="'.$m[2].'" class="comment-link"><a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a></span>'; 
    419 } 
    420  
    421 function akismet_text_add_link_class( $comment_text ) { 
    422  
    423         return preg_replace_callback( '#<a ([^>]*)href="([^"]+)"([^>]*)>(.*?)</a>#i', 'akismet_text_add_link_callback', $comment_text ); 
    424 } 
    425  
    426 add_filter('comment_text', 'akismet_text_add_link_class'); 
    427  
    428  
    429357// WP 2.5+ 
    430358function akismet_rightnow() { 
     
    449377        if ( $count = get_option('akismet_spam_count') ) { 
    450378                $intro = sprintf( $plural_func( 
    451                         '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already. ', 
    452                         '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comments already. ', 
     379                        '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already,', 
     380                        '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comments already,', 
    453381                        $count 
    454382                ), 'http://akismet.com/', number_format_i18n( $count ) ); 
    455383        } else { 
    456                 $intro = sprintf( __('<a href="%1$s">Akismet</a> blocks spam from getting to your blog. '), 'http://akismet.com/' ); 
     384                $intro = sprintf( __('<a href="%1$s">Akismet</a> blocks spam from getting to your blog,'), 'http://akismet.com/' ); 
    457385        } 
    458386 
    459387        if ( $queue_count = akismet_spam_count() ) { 
    460388                $queue_text = sprintf( $plural_func( 
    461                         'There\'s <a href="%2$s">%1$s comment</a> in your spam queue right now.', 
    462                         'There are <a href="%2$s">%1$s comments</a> in your spam queue right now.', 
     389                        'and there\'s <a href="%2$s">%1$s comment</a> in your spam queue right now.', 
     390                        'and there are <a href="%2$s">%1$s comments</a> in your spam queue right now.', 
    463391                        $queue_count 
    464392                ), number_format_i18n( $queue_count ), $esc_url($link) ); 
    465393        } else { 
    466                 $queue_text = sprintf( __( "There's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), $esc_url($link) ); 
    467         } 
    468  
    469         $text = $intro . '<br />' . $queue_text; 
     394                $queue_text = sprintf( __( " but there's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), $esc_url($link) ); 
     395        } 
     396 
     397        // _c was deprecated in WP 2.9.0 
     398        if ( function_exists( '_x' ) ) 
     399                $text = sprintf( _x( '%1$s%2$s', 'akismet_rightnow' ), $intro, $queue_text ); 
     400        else  
     401                $text = sprintf( _c( '%1$s%2$s|akismet_rightnow' ), $intro, $queue_text ); 
     402 
    470403        echo "<p class='akismet-right-now'>$text</p>\n"; 
    471404} 
     
    493426        if ( !$comment ) // it was deleted 
    494427                return; 
    495                  
    496         // use the original version stored in comment_meta if available  
    497         $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true); 
    498         if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) ) { 
    499                 $comment = (object) array_merge( (array)$comment, $as_submitted ); 
    500         } 
    501          
    502         $comment->blog = get_bloginfo('url'); 
     428        $comment->blog = get_option('home'); 
    503429        $comment->blog_lang = get_locale(); 
    504430        $comment->blog_charset = get_option('blog_charset'); 
    505431        $comment->permalink = get_permalink($comment->comment_post_ID); 
    506         $comment->reporter_ip = $_SERVER['REMOTE_ADDR']; 
    507432        if ( is_object($current_user) ) { 
    508433            $comment->reporter = $current_user->user_login; 
     
    516441                $comment->user_role = akismet_get_user_roles($comment->user_ID); 
    517442 
    518         if ( akismet_test_mode() ) 
    519                 $comment->is_test = 'true'; 
    520  
    521443        $query_string = ''; 
    522444        foreach ( $comment as $key => $data ) 
     
    525447        $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-ham", $akismet_api_port); 
    526448        if ( $comment->reporter ) { 
    527                 akismet_update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam'), $comment->reporter ), 'report-ham' ); 
     449                akismet_update_comment_history( $comment_id, sprintf( __('%s un-spammed this comment'), $comment->reporter ), 'report-ham' ); 
    528450                update_comment_meta( $comment_id, 'akismet_user_result', 'false' ); 
    529451                update_comment_meta( $comment_id, 'akismet_user', $comment->reporter ); 
     452        } else { 
     453                akismet_update_comment_history( $comment_id, 'A plugin un-spammed this comment', 'report-ham' ); 
    530454        } 
    531455         
     
    542466        if ( 'spam' != $comment->comment_approved ) 
    543467                return; 
    544          
    545         // use the original version stored in comment_meta if available  
    546         $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true); 
    547         if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) ) { 
    548                 $comment = (object) array_merge( (array)$comment, $as_submitted ); 
    549         } 
    550          
    551         $comment->blog = get_bloginfo('url'); 
     468        $comment->blog = get_option('home'); 
    552469        $comment->blog_lang = get_locale(); 
    553470        $comment->blog_charset = get_option('blog_charset'); 
    554471        $comment->permalink = get_permalink($comment->comment_post_ID); 
    555         $comment->reporter_ip = $_SERVER['REMOTE_ADDR']; 
    556472        if ( is_object($current_user) ) { 
    557473            $comment->reporter = $current_user->user_login; 
     
    562478 
    563479        $comment->user_role = ''; 
    564         if ( isset( $comment->user_ID ) ) 
     480        if ( !isset( $comment->user_id ) ) 
    565481                $comment->user_role = akismet_get_user_roles($comment->user_ID); 
    566  
    567         if ( akismet_test_mode() ) 
    568                 $comment->is_test = 'true'; 
    569482 
    570483        $query_string = ''; 
     
    574487        $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-spam", $akismet_api_port); 
    575488        if ( $comment->reporter ) { 
    576                 akismet_update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam'), $comment->reporter ), 'report-spam' ); 
     489                akismet_update_comment_history( $comment_id, sprintf( __('%s spammed this comment'), $comment->reporter ), 'report-spam' ); 
    577490                update_comment_meta( $comment_id, 'akismet_user_result', 'true' ); 
    578491                update_comment_meta( $comment_id, 'akismet_user', $comment->reporter ); 
    579         } 
     492        } else 
     493                akismet_update_comment_history( $comment_id, 'A plugin spammed this comment', 'report-ham' ); 
    580494        do_action('akismet_submit_spam_comment', $comment_id, $response[1]); 
    581495} 
     
    586500                return; 
    587501                 
    588         if ( !is_admin() ) 
    589                 return; 
    590                  
    591         if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) && !current_user_can( 'moderate_comments' ) ) 
    592                 return; 
    593  
    594         if ( defined('WP_IMPORTING') && WP_IMPORTING == true ) 
    595                 return; 
    596                  
    597         global $current_user; 
    598         $reporter = ''; 
    599         if ( is_object( $current_user ) ) 
    600                 $reporter = $current_user->user_login; 
    601          
    602         // Assumption alert: 
    603         // We want to submit comments to Akismet only when a moderator explicitly spams or approves it - not if the status 
    604         // is changed automatically by another plugin.  Unfortunately WordPress doesn't provide an unambiguous way to 
    605         // determine why the transition_comment_status action was triggered.  And there are several different ways by which 
    606         // to spam and unspam comments: bulk actions, ajax, links in moderation emails, the dashboard, and perhaps others. 
    607         // We'll assume that this is an explicit user action if POST or GET has an 'action' key. 
    608         if ( isset($_POST['action']) || isset($_GET['action']) ) { 
    609                 if ( $new_status == 'spam' && ( $old_status == 'approved' || $old_status == 'unapproved' || !$old_status ) ) { 
    610                                 return akismet_submit_spam_comment( $comment->comment_ID ); 
    611                 } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) { 
    612                                 return akismet_submit_nonspam_comment( $comment->comment_ID ); 
    613                 } 
    614         } 
    615          
    616         if ( !get_comment_meta( $comment->comment_ID, 'akismet_rechecking' ) ) 
    617                 akismet_update_comment_history( $comment->comment_ID, sprintf( __('%s changed the comment status to %s'), $reporter, $new_status ), 'status-' . $new_status ); 
     502        if ( $new_status == 'spam' ) { 
     503                akismet_submit_spam_comment( $comment->comment_ID ); 
     504        } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) { 
     505                akismet_submit_nonspam_comment( $comment->comment_ID ); 
     506        } 
    618507} 
    619508 
     
    658547                $c['user_agent'] = $c['comment_agent']; 
    659548                $c['referrer']   = ''; 
    660                 $c['blog']       = get_bloginfo('url'); 
     549                $c['blog']       = get_option('home'); 
    661550                $c['blog_lang']  = get_locale(); 
    662551                $c['blog_charset'] = get_option('blog_charset'); 
     
    666555                if ( isset( $c['user_ID'] ) ) 
    667556                        $c['user_role']  = akismet_get_user_roles($c['user_ID']); 
    668  
    669                 if ( akismet_test_mode() ) 
    670                         $c['is_test'] = 'true'; 
    671557 
    672558                $id = (int) $c['comment_ID']; 
     
    697583 
    698584add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue'); 
    699  
    700 // Check connectivity between the WordPress blog and Akismet's servers. 
    701 // Returns an associative array of server IP addresses, where the key is the IP address, and value is true (available) or false (unable to connect). 
    702 function akismet_check_server_connectivity() { 
    703         global $akismet_api_host, $akismet_api_port, $wpcom_api_key; 
    704          
    705         $test_host = 'rest.akismet.com'; 
    706          
    707         // Some web hosts may disable one or both functions 
    708         if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) 
    709                 return array(); 
    710          
    711         $ips = gethostbynamel($test_host); 
    712         if ( !$ips || !is_array($ips) || !count($ips) ) 
    713                 return array(); 
    714                  
    715         $servers = array(); 
    716         foreach ( $ips as $ip ) { 
    717                 $response = akismet_verify_key( akismet_get_key(), $ip ); 
    718                 // even if the key is invalid, at least we know we have connectivity 
    719                 if ( $response == 'valid' || $response == 'invalid' ) 
    720                         $servers[$ip] = true; 
    721                 else 
    722                         $servers[$ip] = false; 
    723         } 
    724  
    725         return $servers; 
    726 } 
    727  
    728 // Check the server connectivity and store the results in an option. 
    729 // Cached results will be used if not older than the specified timeout in seconds; use $cache_timeout = 0 to force an update. 
    730 // Returns the same associative array as akismet_check_server_connectivity() 
    731 function akismet_get_server_connectivity( $cache_timeout = 86400 ) { 
    732         $servers = get_option('akismet_available_servers'); 
    733         if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false ) 
    734                 return $servers; 
    735          
    736         // There's a race condition here but the effect is harmless. 
    737         $servers = akismet_check_server_connectivity(); 
    738         update_option('akismet_available_servers', $servers); 
    739         update_option('akismet_connectivity_time', time()); 
    740         return $servers; 
    741 } 
    742  
    743 // Returns true if server connectivity was OK at the last check, false if there was a problem that needs to be fixed. 
    744 function akismet_server_connectivity_ok() { 
    745         // skip the check on WPMU because the status page is hidden 
    746         global $wpcom_api_key; 
    747         if ( $wpcom_api_key ) 
    748                 return true; 
    749         $servers = akismet_get_server_connectivity(); 
    750         return !( empty($servers) || !count($servers) || count( array_filter($servers) ) < count($servers) ); 
    751 } 
    752  
  • trunk/blogs/wp-content/plugins/akismet/akismet.php

    r1874 r1877  
    66Plugin Name: Akismet 
    77Plugin URI: http://akismet.com/ 
    8 Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and track-back spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/?return=true">Sign up for an Akismet API key</a>, and 3) Go to your <a href="plugins.php?page=akismet-key-config">Akismet configuration</a> page, and save your API key. 
    9 Version: 2.5.1 
     8Description: Akismet checks your comments against the Akismet web service to see if they look like spam or not. You need an <a href="http://akismet.com/get/">API key</a> to use it. You can review the spam it catches under "Comments." To show off your Akismet stats just put <code>&lt;?php akismet_counter(); ?&gt;</code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>. 
     9Version: 2.4.0 
    1010Author: Automattic 
    1111Author URI: http://automattic.com/wordpress-plugins/ 
     
    1414 
    1515/* 
    16 This program is free software; you can redistribute it and/or 
    17 modify it under the terms of the GNU General Public License 
    18 as published by the Free Software Foundation; either version 2 
    19 of the License, or (at your option) any later version. 
    20  
    21 This program is distributed in the hope that it will be useful, 
    22 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    24 GNU General Public License for more details. 
    25  
    26 You should have received a copy of the GNU General Public License 
    27 along with this program; if not, write to the Free Software 
    28 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
     16This program is free software; you can redistribute it and/or modify  
     17it under the terms of the GNU General Public License as published by  
     18the Free Software Foundation; version 2 of the License. 
     19 
     20This program is distributed in the hope that it will be useful,  
     21but WITHOUT ANY WARRANTY; without even the implied warranty of  
     22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
     23GNU General Public License for more details.  
     24 
     25You should have received a copy of the GNU General Public License  
     26along with this program; if not, write to the Free Software  
     27Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA  
    2928*/ 
    3029 
    31 define('AKISMET_VERSION', '2.5.0'); 
    32 define('AKISMET_PLUGIN_URL', plugin_dir_url( __FILE__ )); 
     30define('AKISMET_VERSION', '2.4.0'); 
    3331 
    3432/** If you hardcode a WP.com API key here, all key config screens will be hidden */ 
     
    4442} 
    4543 
    46 if ( isset($wp_db_version) && $wp_db_version <= 9872 ) 
    47         include_once dirname( __FILE__ ) . '/legacy.php'; 
    48  
    49 include_once dirname( __FILE__ ) . '/widget.php'; 
    50  
    51 if ( is_admin() ) 
    52         require_once dirname( __FILE__ ) . '/admin.php'; 
     44if ( $wp_db_version <= 9872 ) 
     45        include_once( dirname(__FILE__) . '/legacy.php' ); 
    5346 
    5447function akismet_init() { 
     
    6154 
    6255        $akismet_api_port = 80; 
     56        add_action('admin_menu', 'akismet_config_page'); 
     57        add_action('admin_menu', 'akismet_stats_page'); 
     58        akismet_admin_warnings(); 
    6359} 
    6460add_action('init', 'akismet_init'); 
     61 
     62function akismet_admin_init() { 
     63        if ( function_exists( 'get_plugin_page_hook' ) ) 
     64                $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' ); 
     65        else 
     66                $hook = 'dashboard_page_akismet-stats-display'; 
     67        add_action('admin_head-'.$hook, 'akismet_stats_script'); 
     68} 
     69add_action('admin_init', 'akismet_admin_init'); 
     70 
     71if ( !function_exists('wp_nonce_field') ) { 
     72        function akismet_nonce_field($action = -1) { return; } 
     73        $akismet_nonce = -1; 
     74} else { 
     75        function akismet_nonce_field($action = -1) { return wp_nonce_field($action); } 
     76        $akismet_nonce = 'akismet-update-key'; 
     77} 
     78 
     79if ( !function_exists('number_format_i18n') ) { 
     80        function number_format_i18n( $number, $decimals = null ) { return number_format( $number, $decimals ); } 
     81} 
     82 
     83function akismet_config_page() { 
     84        if ( function_exists('add_submenu_page') ) 
     85                add_submenu_page('plugins.php', __('Akismet Configuration'), __('Akismet Configuration'), 'manage_options', 'akismet-key-config', 'akismet_conf'); 
     86 
     87} 
     88 
     89function akismet_conf() { 
     90        global $akismet_nonce, $wpcom_api_key; 
     91 
     92        if ( isset($_POST['submit']) ) { 
     93                if ( function_exists('current_user_can') && !current_user_can('manage_options') ) 
     94                        die(__('Cheatin&#8217; uh?')); 
     95 
     96                check_admin_referer( $akismet_nonce ); 
     97                $key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] ); 
     98 
     99                if ( empty($key) ) { 
     100                        $key_status = 'empty'; 
     101                        $ms[] = 'new_key_empty'; 
     102                        delete_option('wordpress_api_key'); 
     103                } else { 
     104                        $key_status = akismet_verify_key( $key ); 
     105                } 
     106 
     107                if ( $key_status == 'valid' ) { 
     108                        update_option('wordpress_api_key', $key); 
     109                        $ms[] = 'new_key_valid'; 
     110                } else if ( $key_status == 'invalid' ) { 
     111                        $ms[] = 'new_key_invalid'; 
     112                } else if ( $key_status == 'failed' ) { 
     113                        $ms[] = 'new_key_failed'; 
     114                } 
     115 
     116                if ( isset( $_POST['akismet_discard_month'] ) ) 
     117                        update_option( 'akismet_discard_month', 'true' ); 
     118                else 
     119                        update_option( 'akismet_discard_month', 'false' ); 
     120        } elseif ( isset($_POST['check']) ) { 
     121                akismet_get_server_connectivity(0); 
     122        } 
     123 
     124        if ( empty( $key_status) ||  $key_status != 'valid' ) { 
     125                $key = get_option('wordpress_api_key'); 
     126                if ( empty( $key ) ) { 
     127                        if ( empty( $key_status ) || $key_status != 'failed' ) { 
     128                                if ( akismet_verify_key( '1234567890ab' ) == 'failed' ) 
     129                                        $ms[] = 'no_connection'; 
     130                                else 
     131                                        $ms[] = 'key_empty'; 
     132                        } 
     133                        $key_status = 'empty'; 
     134                } else { 
     135                        $key_status = akismet_verify_key( $key ); 
     136                } 
     137                if ( $key_status == 'valid' ) { 
     138                        $ms[] = 'key_valid'; 
     139                } else if ( $key_status == 'invalid' ) { 
     140                        delete_option('wordpress_api_key'); 
     141                        $ms[] = 'key_empty'; 
     142                } else if ( !empty($key) && $key_status == 'failed' ) { 
     143                        $ms[] = 'key_failed'; 
     144                } 
     145        } 
     146 
     147        $messages = array( 
     148                'new_key_empty' => array('color' => 'aa0', 'text' => __('Your key has been cleared.')), 
     149                'new_key_valid' => array('color' => '2d2', 'text' => __('Your key has been verified. Happy blogging!')), 
     150                'new_key_invalid' => array('color' => 'd22', 'text' => __('The key you entered is invalid. Please double-check it.')), 
     151                'new_key_failed' => array('color' => 'd22', 'text' => __('The key you entered could not be verified because a connection to akismet.com could not be established. Please check your server configuration.')), 
     152                'no_connection' => array('color' => 'd22', 'text' => __('There was a problem connecting to the Akismet server. Please check your server configuration.')), 
     153                'key_empty' => array('color' => 'aa0', 'text' => sprintf(__('Please enter an API key. (<a href="%s" style="color:#fff">Get your key.</a>)'), 'http://akismet.com/get/')), 
     154                'key_valid' => array('color' => '2d2', 'text' => __('This key is valid.')), 
     155                'key_failed' => array('color' => 'aa0', 'text' => __('The key below was previously validated but a connection to akismet.com can not be established at this time. Please check your server configuration.'))); 
     156?> 
     157<?php if ( !empty($_POST['submit'] ) ) : ?> 
     158<div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div> 
     159<?php endif; ?> 
     160<div class="wrap"> 
     161<h2><?php _e('Akismet Configuration'); ?></h2> 
     162<div class="narrow"> 
     163<form action="" method="post" id="akismet-conf" style="margin: auto; width: 400px; "> 
     164<?php if ( !$wpcom_api_key ) { ?> 
     165        <p><?php printf(__('For many people, <a href="%1$s">Akismet</a> will greatly reduce or even completely eliminate the comment and trackback spam you get on your site. If one does happen to get through, simply mark it as "spam" on the moderation screen and Akismet will learn from the mistakes. If you don\'t have an API key yet, you can get one at <a href="%2$s">Akismet.com</a>.'), 'http://akismet.com/', 'http://akismet.com/get/'); ?></p> 
     166 
     167<h3><label for="key"><?php _e('Akismet API Key'); ?></label></h3> 
     168<?php foreach ( $ms as $m ) : ?> 
     169        <p style="padding: .5em; background-color: #<?php echo $messages[$m]['color']; ?>; color: #fff; font-weight: bold;"><?php echo $messages[$m]['text']; ?></p> 
     170<?php endforeach; ?> 
     171<p><input id="key" name="key" type="text" size="15" maxlength="12" value="<?php echo get_option('wordpress_api_key'); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php _e('<a href="http://akismet.com/get/">What is this?</a>'); ?>)</p> 
     172<?php if ( isset( $invalid_key) && $invalid_key ) { ?> 
     173<h3><?php _e('Why might my key be invalid?'); ?></h3> 
     174<p><?php _e('This can mean one of two things, either you copied the key wrong or that the plugin is unable to reach the Akismet servers, which is most often caused by an issue with your web host around firewalls or similar.'); ?></p> 
     175<?php } ?> 
     176<?php } ?> 
     177<?php akismet_nonce_field($akismet_nonce) ?> 
     178<p><label><input name="akismet_discard_month" id="akismet_discard_month" value="true" type="checkbox" <?php if ( get_option('akismet_discard_month') == 'true' ) echo ' checked="checked" '; ?> /> <?php _e('Automatically discard spam comments on posts older than a month.'); ?></label></p> 
     179        <p class="submit"><input type="submit" name="submit" value="<?php _e('Update options &raquo;'); ?>" /></p> 
     180</form> 
     181 
     182<form action="" method="post" id="akismet-connectivity" style="margin: auto; width: 400px; "> 
     183 
     184<h3><?php _e('Server Connectivity'); ?></h3> 
     185<?php 
     186        if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) { 
     187                ?> 
     188                        <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.'); ?></p> 
     189                        <p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet\'s system requirements</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p> 
     190                <?php 
     191        } else { 
     192                $servers = akismet_get_server_connectivity(); 
     193                $fail_count = count($servers) - count( array_filter($servers) ); 
     194                if ( is_array($servers) && count($servers) > 0 ) { 
     195                        // some connections work, some fail 
     196                        if ( $fail_count > 0 && $fail_count < count($servers) ) { ?> 
     197                                <p style="padding: .5em; background-color: #aa0; color: #fff; font-weight:bold;"><?php _e('Unable to reach some Akismet servers.'); ?></p> 
     198                                <p><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to Akismet.com.  Akismet is working but this may cause problems during times of network congestion.  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p> 
     199                        <?php 
     200                        // all connections fail 
     201                        } elseif ( $fail_count > 0 ) { ?> 
     202                                <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to reach any Akismet servers.'); ?></p> 
     203                                <p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p> 
     204                        <?php 
     205                        // all connections work 
     206                        } else { ?> 
     207                                <p style="padding: .5em; background-color: #2d2; color: #fff; font-weight:bold;"><?php  _e('All Akismet servers are available.'); ?></p> 
     208                                <p><?php _e('Akismet is working correctly.  All servers are accessible.'); ?></p> 
     209                        <?php 
     210                        } 
     211                } else { 
     212                        ?> 
     213                                <p style="padding: .5em; background-color: #d22; color: #fff; font-weight:bold;"><?php _e('Unable to find Akismet servers.'); ?></p> 
     214                                <p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to Akismet.com.  <strong>Akismet cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet and firewalls</a>.'), 'http://blog.akismet.com/akismet-hosting-faq/'); ?></p> 
     215                        <?php 
     216                } 
     217        } 
     218         
     219        if ( !empty($servers) ) { 
     220?> 
     221<table style="width: 100%;"> 
     222<thead><th><?php _e('Akismet server'); ?></th><th><?php _e('Network Status'); ?></th></thead> 
     223<tbody> 
     224<?php 
     225                asort($servers); 
     226                foreach ( $servers as $ip => $status ) { 
     227                        $color = ( $status ? '#2d2' : '#d22'); 
     228        ?> 
     229                <tr> 
     230                <td><?php echo htmlspecialchars($ip); ?></td> 
     231                <td style="padding: 0 .5em; font-weight:bold; color: #fff; background-color: <?php echo $color; ?>"><?php echo ($status ? __('No problems') : __('Obstructed') ); ?></td> 
     232                 
     233        <?php 
     234                } 
     235        } 
     236?> 
     237</tbody> 
     238</table> 
     239        <p><?php if ( get_option('akismet_connectivity_time') ) echo sprintf( __('Last checked %s ago.'), human_time_diff( get_option('akismet_connectivity_time') ) ); ?></p> 
     240        <p class="submit"><input type="submit" name="check" value="<?php _e('Check network status &raquo;'); ?>" /></p> 
     241</form> 
     242 
     243</div> 
     244</div> 
     245<?php 
     246} 
     247 
     248function akismet_stats_page() { 
     249        if ( function_exists('add_submenu_page') ) 
     250                add_submenu_page('index.php', __('Akismet Stats'), __('Akismet Stats'), 'manage_options', 'akismet-stats-display', 'akismet_stats_display'); 
     251 
     252} 
     253 
     254function akismet_stats_script() { 
     255        ?> 
     256<script type="text/javascript"> 
     257function resizeIframe() { 
     258    var height = document.documentElement.clientHeight; 
     259    height -= document.getElementById('akismet-stats-frame').offsetTop; 
     260    height += 100; // magic padding 
     261     
     262    document.getElementById('akismet-stats-frame').style.height = height +"px"; 
     263     
     264}; 
     265function resizeIframeInit() { 
     266        document.getElementById('akismet-stats-frame').onload = resizeIframe; 
     267        window.onresize = resizeIframe; 
     268} 
     269addLoadEvent(resizeIframeInit); 
     270</script><?php 
     271} 
     272 
     273 
     274function akismet_stats_display() { 
     275        global $akismet_api_host, $akismet_api_port, $wpcom_api_key; 
     276        $blog = urlencode( get_option('home') ); 
     277        $url = "http://".akismet_get_key().".web.akismet.com/1.0/user-stats.php?blog={$blog}"; 
     278        ?> 
     279        <div class="wrap"> 
     280        <iframe src="<?php echo $url; ?>" width="100%" height="100%" frameborder="0" id="akismet-stats-frame"></iframe> 
     281        </div> 
     282        <?php 
     283} 
     284 
     285function akismet_stats() { 
     286        if ( !function_exists('did_action') || did_action( 'rightnow_end' ) ) // We already displayed this info in the "Right Now" section 
     287                return; 
     288        if ( !$count = get_option('akismet_spam_count') ) 
     289                return; 
     290        $path = plugin_basename(__FILE__); 
     291        echo '<h3>'.__('Spam').'</h3>'; 
     292        global $submenu; 
     293        if ( isset( $submenu['edit-comments.php'] ) ) 
     294                $link = 'edit-comments.php'; 
     295        else 
     296                $link = 'edit.php'; 
     297        echo '<p>'.sprintf(__('<a href="%1$s">Akismet</a> has protected your site from <a href="%2$s">%3$s spam comments</a>.'), 'http://akismet.com/', clean_url("$link?page=akismet-admin"), number_format_i18n($count) ).'</p>'; 
     298} 
     299add_action('activity_box_end', 'akismet_stats'); 
    65300 
    66301function akismet_get_key() { 
     
    82317} 
    83318 
    84 // if we're in debug or test modes, use a reduced service level so as not to polute training or stats data 
    85 function akismet_test_mode() { 
    86         if ( defined('AKISMET_TEST_MODE') && AKISMET_TEST_MODE ) 
     319// Check connectivity between the WordPress blog and Akismet's servers. 
     320// Returns an associative array of server IP addresses, where the key is the IP address, and value is true (available) or false (unable to connect). 
     321function akismet_check_server_connectivity() { 
     322        global $akismet_api_host, $akismet_api_port, $wpcom_api_key; 
     323         
     324        $test_host = 'rest.akismet.com'; 
     325         
     326        // Some web hosts may disable one or both functions 
     327        if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) 
     328                return array(); 
     329         
     330        $ips = gethostbynamel($test_host); 
     331        if ( !$ips || !is_array($ips) || !count($ips) ) 
     332                return array(); 
     333                 
     334        $servers = array(); 
     335        foreach ( $ips as $ip ) { 
     336                $response = akismet_verify_key( akismet_get_key(), $ip ); 
     337                // even if the key is invalid, at least we know we have connectivity 
     338                if ( $response == 'valid' || $response == 'invalid' ) 
     339                        $servers[$ip] = true; 
     340                else 
     341                        $servers[$ip] = false; 
     342        } 
     343 
     344        return $servers; 
     345} 
     346 
     347// Check the server connectivity and store the results in an option. 
     348// Cached results will be used if not older than the specified timeout in seconds; use $cache_timeout = 0 to force an update. 
     349// Returns the same associative array as akismet_check_server_connectivity() 
     350function akismet_get_server_connectivity( $cache_timeout = 86400 ) { 
     351        $servers = get_option('akismet_available_servers'); 
     352        if ( (time() - get_option('akismet_connectivity_time') < $cache_timeout) && $servers !== false ) 
     353                return $servers; 
     354         
     355        // There's a race condition here but the effect is harmless. 
     356        $servers = akismet_check_server_connectivity(); 
     357        update_option('akismet_available_servers', $servers); 
     358        update_option('akismet_connectivity_time', time()); 
     359        return $servers; 
     360} 
     361 
     362// Returns true if server connectivity was OK at the last check, false if there was a problem that needs to be fixed. 
     363function akismet_server_connectivity_ok() { 
     364        // skip the check on WPMU because the status page is hidden 
     365        global $wpcom_api_key; 
     366        if ( $wpcom_api_key ) 
    87367                return true; 
    88         return false; 
     368        $servers = akismet_get_server_connectivity(); 
     369        return !( empty($servers) || !count($servers) || count( array_filter($servers) ) < count($servers) ); 
     370} 
     371 
     372function akismet_admin_warnings() { 
     373        global $wpcom_api_key; 
     374        if ( !get_option('wordpress_api_key') && !$wpcom_api_key && !isset($_POST['submit']) ) { 
     375                function akismet_warning() { 
     376                        echo " 
     377                        <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet is almost ready.')."</strong> ".sprintf(__('You must <a href="%1$s">enter your Akismet API key</a> for it to work.'), "plugins.php?page=akismet-key-config")."</p></div> 
     378                        "; 
     379                } 
     380                add_action('admin_notices', 'akismet_warning'); 
     381                return; 
     382        } elseif ( get_option('akismet_connectivity_time') && empty($_POST) && is_admin() && !akismet_server_connectivity_ok() ) { 
     383                function akismet_warning() { 
     384                        echo " 
     385                        <div id='akismet-warning' class='updated fade'><p><strong>".__('Akismet has detected a problem.')."</strong> ".sprintf(__('A server or network problem is preventing Akismet from working correctly.  <a href="%1$s">Click here for more information</a> about how to fix the problem.'), "plugins.php?page=akismet-key-config")."</p></div> 
     386                        "; 
     387                } 
     388                add_action('admin_notices', 'akismet_warning'); 
     389                return; 
     390        } 
     391} 
     392 
     393function akismet_get_host($host) { 
     394        // if all servers are accessible, just return the host name. 
     395        // if not, return an IP that was known to be accessible at the last check. 
     396        if ( akismet_server_connectivity_ok() ) { 
     397                return $host; 
     398        } else { 
     399                $ips = akismet_get_server_connectivity(); 
     400                // a firewall may be blocking access to some Akismet IPs 
     401                if ( count($ips) > 0 && count(array_filter($ips)) < count($ips) ) { 
     402                        // use DNS to get current IPs, but exclude any known to be unreachable 
     403                        $dns = (array)gethostbynamel( rtrim($host, '.') . '.' ); 
     404                        $dns = array_filter($dns); 
     405                        foreach ( $dns as $ip ) { 
     406                                if ( array_key_exists( $ip, $ips ) && empty( $ips[$ip] ) ) 
     407                                        unset($dns[$ip]); 
     408                        } 
     409                        // return a random IP from those available 
     410                        if ( count($dns) ) 
     411                                return $dns[ array_rand($dns) ]; 
     412                         
     413                } 
     414        } 
     415        // if all else fails try the host name 
     416        return $host; 
    89417} 
    90418 
     
    108436function akismet_http_post($request, $host, $path, $port = 80, $ip=null) { 
    109437        global $wp_version; 
    110  
    111         $akismet_ua = "WordPress/{$wp_version} | "; 
    112         $akismet_ua .= 'Akismet/' . constant( 'AKISMET_VERSION' ); 
    113  
    114         $content_length = strlen( $request ); 
    115  
     438         
     439        $akismet_version = constant('AKISMET_VERSION'); 
     440 
     441        $http_request  = "POST $path HTTP/1.0\r\n"; 
     442        $http_request .= "Host: $host\r\n"; 
     443        $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n"; 
     444        $http_request .= "Content-Length: " . strlen($request) . "\r\n"; 
     445        $http_request .= "User-Agent: WordPress/$wp_version | Akismet/$akismet_version\r\n"; 
     446        $http_request .= "\r\n"; 
     447        $http_request .= $request; 
     448         
    116449        $http_host = $host; 
    117         // use a specific IP if provided 
    118         // needed by akismet_check_server_connectivity() 
    119         if ( $ip && long2ip( ip2long( $ip ) ) ) { 
     450        // use a specific IP if provided - needed by akismet_check_server_connectivity() 
     451        if ( $ip && long2ip(ip2long($ip)) ) { 
    120452                $http_host = $ip; 
    121453        } else { 
    122                 $http_host = $host; 
    123         } 
    124          
    125         // use the WP HTTP class if it is available 
    126         if ( function_exists( 'wp_remote_post' ) ) { 
    127                 $http_args = array( 
    128                         'body'                  => $request, 
    129                         'headers'               => array( 
    130                                 'Content-Type'  => 'application/x-www-form-urlencoded; ' . 
    131                                                                         'charset=' . get_option( 'blog_charset' ), 
    132                                 'Host'                  => $host, 
    133                                 'User-Agent'    => $akismet_ua 
    134                         ), 
    135                         'httpversion'   => '1.0' 
    136                 ); 
    137                 $akismet_url = "http://{$http_host}{$path}"; 
    138                 $response = wp_remote_post( $akismet_url, $http_args ); 
    139                 if ( is_wp_error( $response ) ) 
    140                         return ''; 
    141  
    142                 return array( $response['headers'], $response['body'] ); 
    143         } else { 
    144                 $http_request  = "POST $path HTTP/1.0\r\n"; 
    145                 $http_request .= "Host: $host\r\n"; 
    146                 $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n"; 
    147                 $http_request .= "Content-Length: {$content_length}\r\n"; 
    148                 $http_request .= "User-Agent: {$akismet_ua}\r\n"; 
    149                 $http_request .= "\r\n"; 
    150                 $http_request .= $request; 
    151                  
    152                 $response = ''; 
    153                 if( false != ( $fs = @fsockopen( $http_host, $port, $errno, $errstr, 10 ) ) ) { 
    154                         fwrite( $fs, $http_request ); 
    155  
    156                         while ( !feof( $fs ) ) 
    157                                 $response .= fgets( $fs, 1160 ); // One TCP-IP packet 
    158                         fclose( $fs ); 
    159                         $response = explode( "\r\n\r\n", $response, 2 ); 
    160                 } 
    161                 return $response; 
    162         } 
     454                $http_host = akismet_get_host($host); 
     455        } 
     456 
     457        $response = ''; 
     458        if( false != ( $fs = @fsockopen($http_host, $port, $errno, $errstr, 10) ) ) { 
     459                fwrite($fs, $http_request); 
     460 
     461                while ( !feof($fs) ) 
     462                        $response .= fgets($fs, 1160); // One TCP-IP packet 
     463                fclose($fs); 
     464                $response = explode("\r\n\r\n", $response, 2); 
     465        } 
     466        return $response; 
    163467} 
    164468 
     
    168472        if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) 
    169473                update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); 
    170         // this is a one-shot deal 
    171         remove_filter( 'pre_comment_approved', 'akismet_result_spam' ); 
    172474        return 'spam'; 
    173475} 
    174476 
    175 function akismet_result_hold( $approved ) { 
    176         // once only 
    177         remove_filter( 'pre_comment_approved', 'akismet_result_hold' ); 
    178         return '0'; 
    179 } 
    180  
    181 // how many approved comments does this author have? 
    182 function akimset_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) { 
    183         global $wpdb; 
    184          
    185         if ( !empty($user_id) ) 
    186                 return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE user_id = %d AND comment_approved = 1", $user_id ) ); 
    187                  
    188         if ( !empty($comment_author_email) ) 
    189                 return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_author_email = %s AND comment_author = %s AND comment_author_url = %s AND comment_approved = 1", $comment_author_email, $comment_author, $comment_author_url ) ); 
    190                  
    191         return 0; 
    192 } 
    193  
    194 function akismet_microtime() { 
    195         $mtime = explode( ' ', microtime() ); 
    196         return $mtime[1] + $mtime[0]; 
    197 } 
    198  
    199 // log an event for a given comment, storing it in comment_meta 
    200 function akismet_update_comment_history( $comment_id, $message, $event=null ) { 
    201         global $current_user; 
    202  
    203         // failsafe for old WP versions 
    204         if ( !function_exists('add_comment_meta') ) 
    205                 return false; 
    206          
    207         $user = ''; 
    208         if ( is_object($current_user) && isset($current_user->user_login) ) 
    209                 $user = $current_user->user_login; 
    210  
    211         $event = array( 
    212                 'time' => akismet_microtime(), 
    213                 'message' => $message, 
    214                 'event' => $event, 
    215                 'user' => $user, 
    216         ); 
    217  
    218         // $unique = false so as to allow multiple values per comment 
    219         $r = add_comment_meta( $comment_id, 'akismet_history', $event, false ); 
    220 } 
    221  
    222 // get the full comment history for a given comment, as an array in reverse chronological order 
    223 function akismet_get_comment_history( $comment_id ) { 
    224          
    225         // failsafe for old WP versions 
    226         if ( !function_exists('add_comment_meta') ) 
    227                 return false; 
    228  
    229         $history = get_comment_meta( $comment_id, 'akismet_history', false ); 
    230         usort( $history, 'akismet_cmp_time' ); 
    231         return $history; 
    232 } 
    233  
    234 function akismet_cmp_time( $a, $b ) { 
    235         return $a['time'] > $b['time'] ? -1 : 1; 
    236 } 
    237  
    238 // this fires on wp_insert_comment.  we can't update comment_meta when akismet_auto_check_comment() runs 
    239 // because we don't know the comment ID at that point. 
    240 function akismet_auto_check_update_meta( $id, $comment ) { 
    241         global $akismet_last_comment; 
    242  
    243         // failsafe for old WP versions 
    244         if ( !function_exists('add_comment_meta') ) 
    245                 return false; 
    246  
    247         // wp_insert_comment() might be called in other contexts, so make sure this is the same comment 
    248         // as was checked by akismet_auto_check_comment 
    249         if ( is_object($comment) && !empty($akismet_last_comment) && is_array($akismet_last_comment) ) { 
    250                 if ( intval($akismet_last_comment['comment_post_ID']) == intval($comment->comment_post_ID) 
    251                         && $akismet_last_comment['comment_author'] == $comment->comment_author 
    252                         && $akismet_last_comment['comment_author_email'] == $comment->comment_author_email ) { 
    253                                 // normal result: true or false 
    254                                 if ( $akismet_last_comment['akismet_result'] == 'true' ) { 
    255                                         update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' ); 
    256                                         akismet_update_comment_history( $comment->comment_ID, __('Akismet caught this comment as spam'), 'check-spam' ); 
    257                                         if ( $comment->comment_approved != 'spam' ) 
    258                                                 akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed'.$comment->comment_approved ); 
    259                                 } elseif ( $akismet_last_comment['akismet_result'] == 'false' ) { 
    260                                         update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' ); 
    261                                         akismet_update_comment_history( $comment->comment_ID, __('Akismet cleared this comment'), 'check-ham' ); 
    262                                         if ( $comment->comment_approved == 'spam' ) { 
    263                                                 if ( wp_blacklist_check($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent) ) 
    264                                                         akismet_update_comment_history( $comment->comment_ID, __('Comment was caught by wp_blacklist_check'), 'wp-blacklisted' ); 
    265                                                 else 
    266                                                         akismet_update_comment_history( $comment->comment_ID, sprintf( __('Comment status was changed to %s'), $comment->comment_approved), 'status-changed-'.$comment->comment_approved ); 
    267                                         } 
    268                                 // abnormal result: error 
    269                                 } else { 
    270                                         update_comment_meta( $comment->comment_ID, 'akismet_error', time() ); 
    271                                         akismet_update_comment_history( $comment->comment_ID, sprintf( __('Akismet was unable to check this comment (response: %s), will automatically retry again later.'), $akismet_last_comment['akismet_result']), 'check-error' ); 
    272                                 } 
    273                                  
    274                                 // record the complete original data as submitted for checking 
    275                                 if ( isset($akismet_last_comment['comment_as_submitted']) ) 
    276                                         update_comment_meta( $comment->comment_ID, 'akismet_as_submitted', $akismet_last_comment['comment_as_submitted'] ); 
    277                 } 
    278         } 
    279 } 
    280  
    281 add_action( 'wp_insert_comment', 'akismet_auto_check_update_meta', 10, 2 ); 
    282  
    283  
    284477function akismet_auto_check_comment( $commentdata ) { 
    285         global $akismet_api_host, $akismet_api_port, $akismet_last_comment; 
     478        global $akismet_api_host, $akismet_api_port; 
    286479 
    287480        $comment = $commentdata; 
     
    296489        $comment['user_role'] = akismet_get_user_roles($comment['user_ID']); 
    297490 
    298         $akismet_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); 
    299         $comment['akismet_comment_nonce'] = 'inactive'; 
    300         if ( $akismet_nonce_option == 'true' || $akismet_nonce_option == '' ) { 
    301                 $comment['akismet_comment_nonce'] = 'failed'; 
    302                 if ( isset( $_POST['akismet_comment_nonce'] ) && wp_verify_nonce( $_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'] ) ) 
    303                         $comment['akismet_comment_nonce'] = 'passed'; 
    304  
    305                 // comment reply in wp-admin 
    306                 if ( isset( $_POST['_ajax_nonce-replyto-comment'] ) && check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ) ) 
    307                         $comment['akismet_comment_nonce'] = 'passed'; 
    308  
    309         } 
    310  
    311         if ( akismet_test_mode() ) 
    312                 $comment['is_test'] = 'true'; 
    313                  
    314         foreach ($_POST as $key => $value ) { 
    315                 if ( is_string($value) ) 
    316                         $comment["POST_{$key}"] = $value; 
    317         } 
    318  
    319491        $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); 
    320492 
    321         foreach ( $_SERVER as $key => $value ) { 
     493        foreach ( $_SERVER as $key => $value ) 
    322494                if ( !in_array( $key, $ignore ) && is_string($value) ) 
    323495                        $comment["$key"] = $value; 
    324496                else 
    325497                        $comment["$key"] = ''; 
    326         } 
    327498 
    328499        $query_string = ''; 
    329500        foreach ( $comment as $key => $data ) 
    330501                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; 
    331                  
    332         $commentdata['comment_as_submitted'] = $comment; 
    333502 
    334503        $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); 
     
    349518                        if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) 
    350519                                update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); 
    351                         wp_redirect( $_SERVER['HTTP_REFERER'] ); 
    352                         die(); 
    353                 } 
    354         } 
    355          
    356         // if the response is neither true nor false, hold the comment for moderation and schedule a recheck 
    357         if ( 'true' != $response[1] && 'false' != $response[1] ) { 
    358                 add_filter('pre_comment_approved', 'akismet_result_hold'); 
    359                 wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); 
     520                        die; 
     521                } 
    360522        } 
    361523         
     
    368530                akismet_delete_old(); 
    369531        } 
    370         $akismet_last_comment = $commentdata; 
    371532        return $commentdata; 
    372533} 
    373  
    374 add_action('preprocess_comment', 'akismet_auto_check_comment', 1); 
    375534 
    376535function akismet_delete_old() { 
     
    380539        if ( empty( $comment_ids ) ) 
    381540                return; 
    382                  
    383         $comma_comment_ids = implode( ', ', array_map('intval', $comment_ids) ); 
    384541 
    385542        do_action( 'delete_comment', $comment_ids ); 
    386         $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_id IN ( $comma_comment_ids )"); 
    387         $wpdb->query("DELETE FROM $wpdb->commentmeta WHERE comment_id IN ( $comma_comment_ids )"); 
    388         clean_comment_cache( $comment_ids ); 
     543        $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_id IN ( " . implode( ', ', $comment_ids ) . " )"); 
    389544        $n = mt_rand(1, 5000); 
    390545        if ( apply_filters('akismet_optimize_table', ($n == 11)) ) // lucky number 
     
    395550add_action('akismet_scheduled_delete', 'akismet_delete_old'); 
    396551 
    397 function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) { 
    398     global $wpdb, $akismet_api_host, $akismet_api_port; 
    399  
    400     $id = (int) $id; 
    401     $c = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID = '$id'", ARRAY_A ); 
    402     if ( !$c ) 
    403         return; 
    404  
    405     $c['user_ip']    = $c['comment_author_IP']; 
    406     $c['user_agent'] = $c['comment_agent']; 
    407     $c['referrer']   = ''; 
    408     $c['blog']       = get_option('home'); 
    409     $c['blog_lang']  = get_locale(); 
    410     $c['blog_charset'] = get_option('blog_charset'); 
    411     $c['permalink']  = get_permalink($c['comment_post_ID']); 
    412     $id = $c['comment_ID']; 
    413         if ( akismet_test_mode() ) 
    414                 $c['is_test'] = 'true'; 
    415         $c['recheck_reason'] = $recheck_reason; 
    416  
    417     $query_string = ''; 
    418     foreach ( $c as $key => $data ) 
    419     $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; 
    420  
    421     $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); 
    422     return $response[1]; 
    423 } 
    424  
    425 function akismet_cron_recheck() { 
     552function akismet_submit_nonspam_comment ( $comment_id ) { 
     553        global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site; 
     554        $comment_id = (int) $comment_id; 
     555 
     556        $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'"); 
     557        if ( !$comment ) // it was deleted 
     558                return; 
     559        $comment->blog = get_option('home'); 
     560        $comment->blog_lang = get_locale(); 
     561        $comment->blog_charset = get_option('blog_charset'); 
     562        $comment->permalink = get_permalink($comment->comment_post_ID); 
     563        if ( is_object($current_user) ) { 
     564            $comment->reporter = $current_user->user_login; 
     565        } 
     566        if ( is_object($current_site) ) { 
     567                $comment->site_domain = $current_site->domain; 
     568        } 
     569 
     570        $comment->user_role = ''; 
     571        if ( isset( $comment->user_ID ) ) 
     572                $comment->user_role = akismet_get_user_roles($comment->user_ID); 
     573 
     574        $query_string = ''; 
     575        foreach ( $comment as $key => $data ) 
     576                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; 
     577 
     578        $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-ham", $akismet_api_port); 
     579        do_action('akismet_submit_nonspam_comment', $comment_id, $response[1]); 
     580} 
     581 
     582function akismet_submit_spam_comment ( $comment_id ) { 
     583        global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site; 
     584        $comment_id = (int) $comment_id; 
     585 
     586        $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'"); 
     587        if ( !$comment ) // it was deleted 
     588                return; 
     589        if ( 'spam' != $comment->comment_approved ) 
     590                return; 
     591        $comment->blog = get_option('home'); 
     592        $comment->blog_lang = get_locale(); 
     593        $comment->blog_charset = get_option('blog_charset'); 
     594        $comment->permalink = get_permalink($comment->comment_post_ID); 
     595        if ( is_object($current_user) ) { 
     596            $comment->reporter = $current_user->user_login; 
     597        } 
     598        if ( is_object($current_site) ) { 
     599                $comment->site_domain = $current_site->domain; 
     600        } 
     601 
     602        $comment->user_role = ''; 
     603        if ( !isset( $comment->user_id ) ) 
     604                $comment->user_role = akismet_get_user_roles($comment->user_ID); 
     605 
     606        $query_string = ''; 
     607        foreach ( $comment as $key => $data ) 
     608                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; 
     609 
     610        $response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-spam", $akismet_api_port); 
     611        do_action('akismet_submit_spam_comment', $comment_id, $response[1]); 
     612} 
     613 
     614add_action('preprocess_comment', 'akismet_auto_check_comment', 1); 
     615 
     616// For old versions of WP only 
     617function akismet_set_comment_status( $comment_id, $status ) { 
     618        if ( $status == 'spam' ) { 
     619                akismet_submit_spam_comment( $comment_id ); 
     620        } elseif ( $status == 'approve' ) { 
     621                akismet_submit_nonspam_comment( $comment_id ); 
     622        } 
     623} 
     624 
     625// For WP 2.7+ 
     626function akismet_transition_comment_status( $new_status, $old_status, $comment ) { 
     627        if ( $new_status == $old_status ) 
     628                return; 
     629 
     630        if ( $new_status == 'spam' ) { 
     631                akismet_submit_spam_comment( $comment->comment_ID ); 
     632        } elseif ( $old_status == 'spam' && ( $new_status == 'approved' || $new_status == 'unapproved' ) ) { 
     633                akismet_submit_nonspam_comment( $comment->comment_ID ); 
     634        } 
     635} 
     636 
     637function akismet_spamtoham( $comment ) { akismet_submit_nonspam_comment( $comment->comment_ID ); } 
     638 
     639if ( function_exists( 'wp_transition_comment_status' ) ) { 
     640        add_action( 'transition_comment_status', 'akismet_transition_comment_status', 10, 3 ); 
     641} else { 
     642        add_action('wp_set_comment_status', 'akismet_set_comment_status', 10, 2); 
     643        add_action('edit_comment', 'akismet_submit_spam_comment'); 
     644        add_filter( 'comment_spam_to_approved', 'akismet_spamtoham' ); 
     645        add_filter( 'comment_spam_to_unapproved', 'akismet_spamtoham' ); 
     646} 
     647// Total spam in queue 
     648// get_option( 'akismet_spam_count' ) is the total caught ever 
     649function akismet_spam_count( $type = false ) { 
    426650        global $wpdb; 
    427651 
    428         delete_option('akismet_available_servers'); 
    429  
    430         $comment_errors = $wpdb->get_col( " 
    431                 SELECT comment_id 
    432                 FROM {$wpdb->prefix}commentmeta 
    433                 WHERE meta_key = 'akismet_error' 
    434                 LIMIT 100 
    435         " ); 
    436          
    437         foreach ( (array) $comment_errors as $comment_id ) { 
    438                 // if the comment no longer exists, remove the meta entry from the queue to avoid getting stuck 
    439                 if ( !get_comment( $comment_id ) ) { 
    440                         delete_comment_meta( $comment_id, 'akismet_error' ); 
    441                         continue; 
    442                 } 
    443                  
    444                 add_comment_meta( $comment_id, 'akismet_rechecking', true ); 
    445                 $status = akismet_check_db_comment( $comment_id, 'retry' ); 
    446  
    447                 $msg = ''; 
    448                 if ( $status == 'true' ) { 
    449                         $msg = __( 'Akismet caught this comment as spam during an automatic retry.' ); 
    450                 } elseif ( $status == 'false' ) { 
    451                         $msg = __( 'Akismet cleared this comment during an automatic retry.' ); 
    452                 } 
    453                  
    454                 // If we got back a legit response then update the comment history 
    455                 // other wise just bail now and try again later.  No point in 
    456                 // re-trying all the comments once we hit one failure. 
    457                 if ( !empty( $msg ) ) { 
    458                         delete_comment_meta( $comment_id, 'akismet_error' ); 
    459                         akismet_update_comment_history( $comment_id, $msg, 'cron-retry' ); 
    460                         update_comment_meta( $comment_id, 'akismet_result', $status ); 
    461                         // make sure the comment status is still pending.  if it isn't, that means the user has already moved it elsewhere. 
    462                         $comment = get_comment( $comment_id ); 
    463                         if ( $comment && 'unapproved' == wp_get_comment_status( $comment_id ) ) { 
    464                                 if ( $status == 'true' ) { 
    465                                         wp_spam_comment( $comment_id ); 
    466                                 } elseif ( $status == 'false' ) { 
    467                                         // comment is good, but it's still in the pending queue.  depending on the moderation settings 
    468                                         // we may need to change it to approved. 
    469                                         if ( check_comment($comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent, $comment->comment_type) ) 
    470                                                 wp_set_comment_status( $comment_id, 1 ); 
    471                                 } 
     652        if ( !$type ) { // total 
     653                $count = wp_cache_get( 'akismet_spam_count', 'widget' ); 
     654                if ( false === $count ) { 
     655                        if ( function_exists('wp_count_comments') ) { 
     656                                $count = wp_count_comments(); 
     657                                $count = $count->spam; 
     658                        } else { 
     659                                $count = (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'"); 
    472660                        } 
    473                 } else { 
    474                         delete_comment_meta( $comment_id, 'akismet_rechecking' ); 
    475                         wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); 
    476                         return; 
    477                 } 
    478         } 
    479          
    480         $remaining = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->commentmeta WHERE meta_key = 'akismet_error'" ) ); 
    481         if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { 
    482                 wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); 
    483         } 
    484 } 
    485 add_action( 'akismet_schedule_cron_recheck', 'akismet_cron_recheck' ); 
    486  
    487 function akismet_add_comment_nonce( $post_id ) { 
    488         echo '<p style="display: none;">'; 
    489         wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', FALSE ); 
    490         echo '</p>'; 
    491 } 
    492  
    493 $akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) ); 
    494  
    495 if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' ) 
    496         add_action( 'comment_form', 'akismet_add_comment_nonce' ); 
     661                        wp_cache_set( 'akismet_spam_count', $count, 'widget', 3600 ); 
     662                } 
     663                return $count; 
     664        } elseif ( 'comments' == $type || 'comment' == $type ) { // comments 
     665                $type = ''; 
     666        } else { // pingback, trackback, ... 
     667                $type  = $wpdb->escape( $type ); 
     668        } 
     669 
     670        return (int) $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam' AND comment_type='$type'"); 
     671} 
     672 
     673 
     674// WP 2.5+ 
     675function akismet_rightnow() { 
     676        global $submenu, $wp_db_version; 
     677 
     678        // clean_url was deprecated in WP 3.0 
     679        $esc_url = 'clean_url'; 
     680        if ( function_exists( 'esc_url' ) ) 
     681                $esc_url = 'esc_url'; 
     682 
     683        if ( 8645 < $wp_db_version  ) // 2.7 
     684                $link = 'edit-comments.php?comment_status=spam'; 
     685        elseif ( isset( $submenu['edit-comments.php'] ) ) 
     686                $link = 'edit-comments.php?page=akismet-admin'; 
     687        else 
     688                $link = 'edit.php?page=akismet-admin'; 
     689 
     690        if ( $count = get_option('akismet_spam_count') ) { 
     691                $intro = sprintf( __ngettext( 
     692                        '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comment already,', 
     693                        '<a href="%1$s">Akismet</a> has protected your site from %2$s spam comments already,', 
     694                        $count 
     695                ), 'http://akismet.com/', number_format_i18n( $count ) ); 
     696        } else { 
     697                $intro = sprintf( __('<a href="%1$s">Akismet</a> blocks spam from getting to your blog,'), 'http://akismet.com/' ); 
     698        } 
     699 
     700        if ( $queue_count = akismet_spam_count() ) { 
     701                $queue_text = sprintf( __ngettext( 
     702                        'and there\'s <a href="%2$s">%1$s comment</a> in your spam queue right now.', 
     703                        'and there are <a href="%2$s">%1$s comments</a> in your spam queue right now.', 
     704                        $queue_count 
     705                ), number_format_i18n( $queue_count ), clean_url($link) ); 
     706        } else { 
     707                $queue_text = sprintf( __( "but there's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), $esc_url($link) ); 
     708        } 
     709 
     710        // _c was deprecated in WP 2.9.0 
     711        if ( function_exists( '_x' ) ) 
     712                $text = sprintf( _x( '%1$s %2$s', 'akismet_rightnow' ), $intro, $queue_text ); 
     713        else  
     714                $text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text ); 
     715 
     716        echo "<p class='akismet-right-now'>$text</p>\n"; 
     717} 
     718         
     719add_action('rightnow_end', 'akismet_rightnow'); 
     720 
     721 
     722// For WP >= 2.5 
     723function akismet_check_for_spam_button($comment_status) { 
     724        if ( 'approved' == $comment_status ) 
     725                return; 
     726        if ( function_exists('plugins_url') ) 
     727                $link = 'admin.php?action=akismet_recheck_queue'; 
     728        else 
     729                $link = 'edit-comments.php?page=akismet-admin&amp;recheckqueue=true&amp;noheader=true'; 
     730        echo "</div><div class='alignleft'><a class='button-secondary checkforspam' href='$link'>" . __('Check for Spam') . "</a>"; 
     731} 
     732add_action('manage_comments_nav', 'akismet_check_for_spam_button'); 
     733 
     734function akismet_recheck_queue() { 
     735        global $wpdb, $akismet_api_host, $akismet_api_port; 
     736 
     737        if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) 
     738                return; 
     739 
     740        $moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0'", ARRAY_A ); 
     741        foreach ( (array) $moderation as $c ) { 
     742                $c['user_ip']    = $c['comment_author_IP']; 
     743                $c['user_agent'] = $c['comment_agent']; 
     744                $c['referrer']   = ''; 
     745                $c['blog']       = get_option('home'); 
     746                $c['blog_lang']  = get_locale(); 
     747                $c['blog_charset'] = get_option('blog_charset'); 
     748                $c['permalink']  = get_permalink($c['comment_post_ID']); 
     749 
     750                $c['user_role'] = ''; 
     751                if ( isset( $c['user_ID'] ) ) 
     752                        $c['user_role']  = akismet_get_user_roles($c['user_ID']); 
     753 
     754                $id = (int) $c['comment_ID']; 
     755 
     756                $query_string = ''; 
     757                foreach ( $c as $key => $data ) 
     758                $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; 
     759 
     760                $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); 
     761                if ( 'true' == $response[1] ) { 
     762                        if ( function_exists('wp_set_comment_status') ) 
     763                                wp_set_comment_status($id, 'spam'); 
     764                        else 
     765                                $wpdb->query("UPDATE $wpdb->comments SET comment_approved = 'spam' WHERE comment_ID = $id"); 
     766 
     767                } 
     768        } 
     769        wp_redirect( $_SERVER['HTTP_REFERER'] ); 
     770        exit; 
     771} 
     772 
     773add_action('admin_action_akismet_recheck_queue', 'akismet_recheck_queue'); 
     774 
     775function akismet_check_db_comment( $id ) { 
     776        global $wpdb, $akismet_api_host, $akismet_api_port; 
     777 
     778        $id = (int) $id; 
     779        $c = $wpdb->get_row( "SELECT * FROM $wpdb->comments WHERE comment_ID = '$id'", ARRAY_A ); 
     780        if ( !$c ) 
     781                return; 
     782 
     783        $c['user_ip']    = $c['comment_author_IP']; 
     784        $c['user_agent'] = $c['comment_agent']; 
     785        $c['referrer']   = ''; 
     786        $c['blog']       = get_option('home'); 
     787        $c['blog_lang']  = get_locale(); 
     788        $c['blog_charset'] = get_option('blog_charset'); 
     789        $c['permalink']  = get_permalink($c['comment_post_ID']); 
     790        $id = $c['comment_ID']; 
     791 
     792        $query_string = ''; 
     793        foreach ( $c as $key => $data ) 
     794        $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; 
     795 
     796        $response = akismet_http_post($query_string, $akismet_api_host, '/1.1/comment-check', $akismet_api_port); 
     797        return $response[1]; 
     798} 
     799 
     800// Widget stuff 
     801function widget_akismet_register() { 
     802        if ( function_exists('register_sidebar_widget') ) : 
     803        function widget_akismet($args) { 
     804                extract($args); 
     805                $options = get_option('widget_akismet'); 
     806                $count = number_format_i18n(get_option('akismet_spam_count')); 
     807                ?> 
     808                        <?php echo $before_widget; ?> 
     809                                <?php echo $before_title . $options['title'] . $after_title; ?> 
     810                                <div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><?php printf( __( '%1$s %2$sspam comments%3$s %4$sblocked by%5$s<br />%6$sAkismet%7$s' ), '<span id="akismet1"><span id="akismetcount">' . $count . '</span>', '<span id="akismetsc">', '</span></span>', '<span id="akismet2"><span id="akismetbb">', '</span>', '<span id="akismeta">', '</span></span>' ); ?></a></div></div> 
     811                        <?php echo $after_widget; ?> 
     812        <?php 
     813        } 
     814 
     815        function widget_akismet_style() { 
     816                $plugin_dir = '/wp-content/plugins'; 
     817                if ( defined( 'PLUGINDIR' ) ) 
     818                        $plugin_dir = '/' . PLUGINDIR; 
     819 
     820                ?> 
     821<style type="text/css"> 
     822#aka,#aka:link,#aka:hover,#aka:visited,#aka:active{color:#fff;text-decoration:none} 
     823#aka:hover{border:none;text-decoration:none} 
     824#aka:hover #akismet1{display:none} 
     825#aka:hover #akismet2,#akismet1{display:block} 
     826#akismet2{display:none;padding-top:2px} 
     827#akismeta{font-size:16px;font-weight:bold;line-height:18px;text-decoration:none} 
     828#akismetcount{display:block;font:15px Verdana,Arial,Sans-Serif;font-weight:bold;text-decoration:none} 
     829#akismetwrap #akismetstats{background:url(<?php echo get_option('siteurl'), $plugin_dir; ?>/akismet/akismet.gif) no-repeat top left;border:none;color:#fff;font:11px 'Trebuchet MS','Myriad Pro',sans-serif;height:40px;line-height:100%;overflow:hidden;padding:8px 0 0;text-align:center;width:120px} 
     830</style> 
     831                <?php 
     832        } 
     833 
     834        function widget_akismet_control() { 
     835                $options = $newoptions = get_option('widget_akismet'); 
     836                if ( isset( $_POST['akismet-submit'] ) && $_POST["akismet-submit"] ) { 
     837                        $newoptions['title'] = strip_tags(stripslashes($_POST["akismet-title"])); 
     838                        if ( empty($newoptions['title']) ) $newoptions['title'] = __('Spam Blocked'); 
     839                } 
     840                if ( $options != $newoptions ) { 
     841                        $options = $newoptions; 
     842                        update_option('widget_akismet', $options); 
     843                } 
     844                $title = htmlspecialchars($options['title'], ENT_QUOTES); 
     845        ?> 
     846                                <p><label for="akismet-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="akismet-title" name="akismet-title" type="text" value="<?php echo $title; ?>" /></label></p> 
     847                                <input type="hidden" id="akismet-submit" name="akismet-submit" value="1" /> 
     848        <?php 
     849        } 
     850 
     851        if ( function_exists( 'wp_register_sidebar_widget' ) ) { 
     852                wp_register_sidebar_widget( 'akismet', 'Akismet', 'widget_akismet', null, 'akismet'); 
     853                wp_register_widget_control( 'akismet', 'Akismet', 'widget_akismet_control', null, 75, 'akismet'); 
     854        } else { 
     855                register_sidebar_widget('Akismet', 'widget_akismet', null, 'akismet'); 
     856                register_widget_control('Akismet', 'widget_akismet_control', null, 75, 'akismet'); 
     857        } 
     858        if ( is_active_widget('widget_akismet') ) 
     859                add_action('wp_head', 'widget_akismet_style'); 
     860        endif; 
     861} 
     862 
     863add_action('init', 'widget_akismet_register'); 
     864 
     865// Counter for non-widget users 
     866function akismet_counter() { 
     867        $plugin_dir = '/wp-content/plugins'; 
     868        if ( defined( 'PLUGINDIR' ) ) 
     869                $plugin_dir = '/' . PLUGINDIR; 
     870 
     871?> 
     872<style type="text/css"> 
     873#akismetwrap #aka,#aka:link,#aka:hover,#aka:visited,#aka:active{color:#fff;text-decoration:none} 
     874#aka:hover{border:none;text-decoration:none} 
     875#aka:hover #akismet1{display:none} 
     876#aka:hover #akismet2,#akismet1{display:block} 
     877#akismet2{display:none;padding-top:2px} 
     878#akismeta{font-size:16px;font-weight:bold;line-height:18px;text-decoration:none} 
     879#akismetcount{display:block;font:15px Verdana,Arial,Sans-Serif;font-weight:bold;text-decoration:none} 
     880#akismetwrap #akismetstats{background:url(<?php echo get_option('siteurl'), $plugin_dir; ?>/akismet/akismet.gif) no-repeat top left;border:none;color:#fff;font:11px 'Trebuchet MS','Myriad Pro',sans-serif;height:40px;line-height:100%;overflow:hidden;padding:8px 0 0;text-align:center;width:120px} 
     881</style> 
     882<?php 
     883$count = number_format_i18n(get_option('akismet_spam_count')); 
     884?> 
     885<div id="akismetwrap"><div id="akismetstats"><a id="aka" href="http://akismet.com" title=""><div id="akismet1"><span id="akismetcount"><?php echo $count; ?></span> <span id="akismetsc"><?php _e('spam comments') ?></span></div> <div id="akismet2"><span id="akismetbb"><?php _e('blocked by') ?></span><br /><span id="akismeta">Akismet</span></div></a></div></div> 
     886<?php 
     887} 
     888 
     889?> 
  • trunk/blogs/wp-content/plugins/akismet/readme.txt

    r1874 r1877  
    11=== Akismet === 
    2 Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, automattic 
     2Contributors: matt, ryan, andy, mdawaffe, tellyworth, automattic 
    33Tags: akismet, comments, spam 
    4 Requires at least: 3.0 
    5 Tested up to: 3.1 
    6 Stable tag: 2.5.1 
     4Requires at least: 2.0 
     5Tested up to: 3.0 
     6Stable tag: 2.4.0 
    77License: GPLv2 
    88 
     
    1414review the spam it catches under your blog's "Comments" admin screen. 
    1515 
    16 Major new features in Akismet 2.5 include: 
     16Want to show off how much spam Akismet has caught for you? Just put `<?php akismet_counter(); ?>` in your template. 
    1717 
    18 * A comment status history, so you can easily see which comments were caught or cleared by Akismet, and which were spammed or unspammed by a moderator 
    19 * Links are highlighted in the comment body, to reveal hidden or misleading links 
    20 * If your web host is unable to reach Akismet's servers, the plugin will automatically retry when your connection is back up 
    21 * Moderators can see the number of approved comments for each user 
    22 * Spam and Unspam reports now include more information, to help improve accuracy 
     18See also: [WP Stats plugin](http://wordpress.org/extend/plugins/stats/). 
    2319 
    24 PS: You'll need an [Akismet.com API key](http://akismet.com/get/) to use it.  Keys are free for personal blogs, with paid subscriptions available for businesses and commercial sites. 
     20PS: You'll need an [Akismet.com API key](http://akismet.com/get/) to use it. 
    2521 
    2622== Installation == 
     
    3127 
    3228== Changelog == 
    33  
    34 = 2.5.1 = 
    35  
    36 * Fix a bug that caused the "Auto delete" option to fail to discard comments correctly 
    37 * Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce 
    38 * Fixed padding bug in "author" column of posts screen 
    39 * Added margin-top to "cleared by ..." badges on dashboard 
    40 * Fix possible error when calling akismet_cron_recheck() 
    41 * Fix more PHP warnings 
    42 * Clean up XHTML warnings for comment nonce 
    43 * Fix for possible condition where scheduled comment re-checks could get stuck 
    44 * Clean up the comment meta details after deleting a comment 
    45 * Only show the status badge if the comment status has been changed by someone/something other than Akismet 
    46 * Show a 'History' link in the row-actions 
    47 * Translation fixes 
    48 * Reduced font-size on author name 
    49 * Moved "flagged by..." notification to top right corner of comment container and removed heavy styling 
    50 * Hid "flagged by..." notification while on dashboard 
    51  
    52 = 2.5.0 = 
    53  
    54 * Track comment actions under 'Akismet Status' on the edit comment screen 
    55 * Fix a few remaining deprecated function calls ( props Mike Glendinning )  
    56 * Use HTTPS for the stats IFRAME when wp-admin is using HTTPS 
    57 * Use the WordPress HTTP class if available 
    58 * Move the admin UI code to a separate file, only loaded when needed 
    59 * Add cron retry feature, to replace the old connectivity check 
    60 * Display Akismet status badge beside each comment 
    61 * Record history for each comment, and display it on the edit page 
    62 * Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham 
    63 * Highlight links in comment content 
    64 * New option, "Show the number of comments you've approved beside each comment author." 
    65 * New option, "Use a nonce on the comment form." 
    6629 
    6730= 2.4.0 = 
  • trunk/blogs/wp-content/themes/twentyten/languages/twentyten.pot

    r1874 r1877  
    1 # Translation of the WordPress theme Twenty Ten 1.1 by the WordPress team. 
    2 # Copyright (C) 2010 the WordPress team 
     1# Copyright (C) 2010 Twenty Ten 
    32# This file is distributed under the same license as the Twenty Ten package. 
    4 # FIRST AUTHOR <EMAIL@ADDRESS>, 2010. 
    5 # 
    6 #, fuzzy 
    73msgid "" 
    84msgstr "" 
    95"Project-Id-Version: Twenty Ten 1.1\n" 
    106"Report-Msgid-Bugs-To: http://wordpress.org/tag/twentyten\n" 
    11 "POT-Creation-Date: 2010-07-14 16:21+0000\n" 
     7"POT-Creation-Date: 2011-01-01 21:26:51+00:00\n" 
     8"MIME-Version: 1.0\n" 
     9"Content-Type: text/plain; charset=UTF-8\n" 
     10"Content-Transfer-Encoding: 8bit\n" 
    1211"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n" 
    1312"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
    1413"Language-Team: LANGUAGE <LL@li.org>\n" 
    15 "MIME-Version: 1.0\n" 
    16 "Content-Type: text/plain; charset=utf-8\n" 
    17 "Content-Transfer-Encoding: 8bit\n" 
    18 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 
    19  
    20 #: 404.php:16 loop.php:33 
    21 msgid "Not Found" 
    22 msgstr "" 
    23  
    24 #: 404.php:18 
    25 msgid "" 
    26 "Apologies, but the page you requested could not be found. Perhaps searching " 
    27 "will help." 
    28 msgstr "" 
    29  
    30 #: archive.php:33 
    31 #, php-format 
    32 msgid "Daily Archives: <span>%s</span>" 
    33 msgstr "" 
    34  
    35 #: archive.php:35 
    36 #, php-format 
    37 msgid "Monthly Archives: <span>%s</span>" 
    38 msgstr "" 
    39  
    40 #: archive.php:37 
    41 #, php-format 
    42 msgid "Yearly Archives: <span>%s</span>" 
    43 msgstr "" 
    44  
    45 #: archive.php:39 
    46 msgid "Blog Archives" 
    47 msgstr "" 
    48  
    49 #: attachment.php:18 
    50 #, php-format 
    51 msgid "Return to %s" 
    52 msgstr "" 
    53  
    54 #. translators: %s - title of parent post 
    55 #: attachment.php:20 
    56 #, php-format 
    57 msgid "<span class=\"meta-nav\">&larr;</span> %s" 
    58 msgstr "" 
    59  
    60 #: attachment.php:29 
    61 #, php-format 
    62 msgid "<span class=\"%1$s\">By</span> %2$s" 
    63 msgstr "" 
    64  
    65 #: attachment.php:33 functions.php:451 
    66 #, php-format 
    67 msgid "View all posts by %s" 
    68 msgstr "" 
    69  
    70 #: attachment.php:40 
    71 #, php-format 
    72 msgid "<span class=\"%1$s\">Published</span> %2$s" 
    73 msgstr "" 
    74  
    75 #: attachment.php:50 
    76 #, php-format 
    77 msgid "Full size is %s pixels" 
    78 msgstr "" 
    79  
    80 #: attachment.php:53 
    81 msgid "Link to full-size image" 
    82 msgstr "" 
    83  
    84 #: attachment.php:60 attachment.php:107 loop.php:95 loop.php:118 loop.php:160 
    85 #: onecolumn-page.php:27 page.php:32 single.php:53 
    86 msgid "Edit" 
    87 msgstr "" 
    88  
    89 #: attachment.php:100 functions.php:241 loop.php:110 loop.php:138 
    90 msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>" 
    91 msgstr "" 
    92  
    93 #: attachment.php:101 loop.php:139 onecolumn-page.php:26 page.php:31 
    94 #: single.php:31 
    95 msgid "Pages:" 
    96 msgstr "" 
    97  
    98 #: author.php:27 
    99 #, php-format 
    100 msgid "Author Archives: %s" 
    101 msgstr "" 
    102  
    103 #: author.php:37 single.php:40 
    104 #, php-format 
    105 msgid "About %s" 
     14 
     15#. #-#-#-#-#  twentyten.pot (Twenty Ten 1.1)  #-#-#-#-# 
     16#. Theme URI of the plugin/theme 
     17#: footer.php:33 
     18msgid "http://wordpress.org/" 
     19msgstr "" 
     20 
     21#: footer.php:34 
     22msgid "Semantic Personal Publishing Platform" 
     23msgstr "" 
     24 
     25#: footer.php:35 
     26msgid "Proudly powered by %s." 
    10627msgstr "" 
    10728 
    10829#: category.php:16 
    109 #, php-format 
    11030msgid "Category Archives: %s" 
    11131msgstr "" 
    11232 
     33#: sidebar.php:27 
     34msgid "Archives" 
     35msgstr "" 
     36 
     37#: sidebar.php:34 
     38msgid "Meta" 
     39msgstr "" 
     40 
     41#: tag.php:16 
     42msgid "Tag Archives: %s" 
     43msgstr "" 
     44 
    11345#: comments.php:18 
    11446msgid "" 
     
    11749 
    11850#: comments.php:35 
    119 #, php-format 
    12051msgid "One Response to %2$s" 
    12152msgid_plural "%1$s Responses to %2$s" 
     
    13566msgstr "" 
    13667 
    137 #. #-#-#-#-#  twentyten.pot (Twenty Ten 1.1)  #-#-#-#-# 
    138 #. Theme URI of the plugin/theme 
    139 #: footer.php:33 
    140 msgid "http://wordpress.org/" 
    141 msgstr "" 
    142  
    143 #: footer.php:34 
    144 msgid "Semantic Personal Publishing Platform" 
    145 msgstr "" 
    146  
    147 #: footer.php:35 
    148 #, php-format 
    149 msgid "Proudly powered by %s." 
    150 msgstr "" 
    151  
    152 #: functions.php:97 
    153 msgid "Primary Navigation" 
    154 msgstr "" 
    155  
    156 #. translators: header image description 
    157 #: functions.php:133 
    158 msgid "Berries" 
    159 msgstr "" 
    160  
    161 #. translators: header image description 
    162 #: functions.php:139 
    163 msgid "Cherry Blossoms" 
    164 msgstr "" 
    165  
    166 #. translators: header image description 
    167 #: functions.php:145 
    168 msgid "Concave" 
    169 msgstr "" 
    170  
    171 #. translators: header image description 
    172 #: functions.php:151 
    173 msgid "Fern" 
    174 msgstr "" 
    175  
    176 #. translators: header image description 
    177 #: functions.php:157 
    178 msgid "Forest Floor" 
    179 msgstr "" 
    180  
    181 #. translators: header image description 
    182 #: functions.php:163 
    183 msgid "Inkwell" 
    184 msgstr "" 
    185  
    186 #. translators: header image description 
    187 #: functions.php:169 
    188 msgid "Path" 
    189 msgstr "" 
    190  
    191 #. translators: header image description 
    192 #: functions.php:175 
    193 msgid "Sunset" 
    194 msgstr "" 
    195  
    196 #: functions.php:308 
    197 #, php-format 
    198 msgid "%s <span class=\"says\">says:</span>" 
    199 msgstr "" 
    200  
    201 #: functions.php:311 
    202 msgid "Your comment is awaiting moderation." 
    203 msgstr "" 
    204  
    205 #. translators: 1: date, 2: time 
    206 #: functions.php:318 
    207 #, php-format 
    208 msgid "%1$s at %2$s" 
    209 msgstr "" 
    210  
    211 #: functions.php:318 functions.php:335 
    212 msgid "(Edit)" 
    213 msgstr "" 
    214  
    215 #: functions.php:335 
    216 msgid "Pingback:" 
    217 msgstr "" 
    218  
    219 #: functions.php:354 
    220 msgid "Primary Widget Area" 
    221 msgstr "" 
    222  
    223 #: functions.php:356 
    224 msgid "The primary widget area" 
    225 msgstr "" 
    226  
    227 #: functions.php:365 
    228 msgid "Secondary Widget Area" 
    229 msgstr "" 
    230  
    231 #: functions.php:367 
    232 msgid "The secondary widget area" 
    233 msgstr "" 
    234  
    235 #: functions.php:376 
    236 msgid "First Footer Widget Area" 
    237 msgstr "" 
    238  
    239 #: functions.php:378 
    240 msgid "The first footer widget area" 
    241 msgstr "" 
    242  
    243 #: functions.php:387 
    244 msgid "Second Footer Widget Area" 
    245 msgstr "" 
    246  
    247 #: functions.php:389 
    248 msgid "The second footer widget area" 
    249 msgstr "" 
    250  
    251 #: functions.php:398 
    252 msgid "Third Footer Widget Area" 
    253 msgstr "" 
    254  
    255 #: functions.php:400 
    256 msgid "The third footer widget area" 
    257 msgstr "" 
    258  
    259 #: functions.php:409 
    260 msgid "Fourth Footer Widget Area" 
    261 msgstr "" 
    262  
    263 #: functions.php:411 
    264 msgid "The fourth footer widget area" 
    265 msgstr "" 
    266  
    267 #: functions.php:442 
    268 #, php-format 
    269 msgid "" 
    270 "<span class=\"%1$s\">Posted on</span> %2$s <span class=\"meta-sep\">by</" 
    271 "span> %3$s" 
    272 msgstr "" 
    273  
    274 #: functions.php:468 
    275 #, php-format 
    276 msgid "" 
    277 "This entry was posted in %1$s and tagged %2$s. Bookmark the <a href=\"%3$s\" " 
    278 "title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>." 
    279 msgstr "" 
    280  
    281 #: functions.php:470 
    282 #, php-format 
    283 msgid "" 
    284 "This entry was posted in %1$s. Bookmark the <a href=\"%3$s\" title=" 
    285 "\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>." 
    286 msgstr "" 
    287  
    288 #: functions.php:472 
    289 #, php-format 
    290 msgid "" 
    291 "Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark" 
    292 "\">permalink</a>." 
    293 msgstr "" 
    294  
    295 #: header.php:33 
    296 #, php-format 
    297 msgid "Page %s" 
    298 msgstr "" 
    299  
    300 #: header.php:83 
    301 msgid "Skip to content" 
     68#: 404.php:16 loop.php:33 
     69msgid "Not Found" 
     70msgstr "" 
     71 
     72#: 404.php:18 
     73msgid "" 
     74"Apologies, but the page you requested could not be found. Perhaps searching " 
     75"will help." 
    30276msgstr "" 
    30377 
     
    32296 
    32397#: loop.php:62 loop.php:83 loop.php:126 
    324 #, php-format 
    32598msgid "Permalink to %s" 
    32699msgstr "" 
    327100 
    328101#: loop.php:82 
    329 #, php-format 
    330102msgid "This gallery contains <a %1$s>%2$s photos</a>." 
    331103msgstr "" 
     
    349121#: loop.php:94 loop.php:117 loop.php:159 
    350122msgid "% Comments" 
     123msgstr "" 
     124 
     125#: loop.php:95 loop.php:118 loop.php:160 page.php:32 attachment.php:60 
     126#: attachment.php:107 onecolumn-page.php:27 single.php:53 
     127msgid "Edit" 
    351128msgstr "" 
    352129 
     
    356133msgstr "" 
    357134 
     135#: loop.php:110 loop.php:138 functions.php:241 attachment.php:100 
     136msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>" 
     137msgstr "" 
     138 
     139#: loop.php:139 page.php:31 attachment.php:101 onecolumn-page.php:26 
     140#: single.php:31 
     141msgid "Pages:" 
     142msgstr "" 
     143 
    358144#: loop.php:146 
    359 #, php-format 
    360145msgid "<span class=\"%1$s\">Posted in</span> %2$s" 
    361146msgstr "" 
    362147 
    363148#: loop.php:155 
    364 #, php-format 
    365149msgid "<span class=\"%1$s\">Tagged</span> %2$s" 
    366150msgstr "" 
    367151 
     152#: functions.php:97 
     153msgid "Primary Navigation" 
     154msgstr "" 
     155 
     156#: functions.php:133 
     157msgid "Berries" 
     158msgstr "" 
     159 
     160#: functions.php:139 
     161msgid "Cherry Blossoms" 
     162msgstr "" 
     163 
     164#: functions.php:145 
     165msgid "Concave" 
     166msgstr "" 
     167 
     168#: functions.php:151 
     169msgid "Fern" 
     170msgstr "" 
     171 
     172#: functions.php:157 
     173msgid "Forest Floor" 
     174msgstr "" 
     175 
     176#: functions.php:163 
     177msgid "Inkwell" 
     178msgstr "" 
     179 
     180#: functions.php:169 
     181msgid "Path" 
     182msgstr "" 
     183 
     184#: functions.php:175 
     185msgid "Sunset" 
     186msgstr "" 
     187 
     188#: functions.php:308 
     189msgid "%s <span class=\"says\">says:</span>" 
     190msgstr "" 
     191 
     192#: functions.php:311 
     193msgid "Your comment is awaiting moderation." 
     194msgstr "" 
     195 
     196#: functions.php:318 
     197msgid "%1$s at %2$s" 
     198msgstr "" 
     199 
     200#: functions.php:318 functions.php:335 
     201msgid "(Edit)" 
     202msgstr "" 
     203 
     204#: functions.php:335 
     205msgid "Pingback:" 
     206msgstr "" 
     207 
     208#: functions.php:354 
     209msgid "Primary Widget Area" 
     210msgstr "" 
     211 
     212#: functions.php:356 
     213msgid "The primary widget area" 
     214msgstr "" 
     215 
     216#: functions.php:365 
     217msgid "Secondary Widget Area" 
     218msgstr "" 
     219 
     220#: functions.php:367 
     221msgid "The secondary widget area" 
     222msgstr "" 
     223 
     224#: functions.php:376 
     225msgid "First Footer Widget Area" 
     226msgstr "" 
     227 
     228#: functions.php:378 
     229msgid "The first footer widget area" 
     230msgstr "" 
     231 
     232#: functions.php:387 
     233msgid "Second Footer Widget Area" 
     234msgstr "" 
     235 
     236#: functions.php:389 
     237msgid "The second footer widget area" 
     238msgstr "" 
     239 
     240#: functions.php:398 
     241msgid "Third Footer Widget Area" 
     242msgstr "" 
     243 
     244#: functions.php:400 
     245msgid "The third footer widget area" 
     246msgstr "" 
     247 
     248#: functions.php:409 
     249msgid "Fourth Footer Widget Area" 
     250msgstr "" 
     251 
     252#: functions.php:411 
     253msgid "The fourth footer widget area" 
     254msgstr "" 
     255 
     256#: functions.php:442 
     257msgid "" 
     258"<span class=\"%1$s\">Posted on</span> %2$s <span class=\"meta-sep\">by</" 
     259"span> %3$s" 
     260msgstr "" 
     261 
     262#: functions.php:451 attachment.php:33 
     263msgid "View all posts by %s" 
     264msgstr "" 
     265 
     266#: functions.php:468 
     267msgid "" 
     268"This entry was posted in %1$s and tagged %2$s. Bookmark the <a href=\"%3$s\" " 
     269"title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>." 
     270msgstr "" 
     271 
     272#: functions.php:470 
     273msgid "" 
     274"This entry was posted in %1$s. Bookmark the <a href=\"%3$s\" title=" 
     275"\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>." 
     276msgstr "" 
     277 
     278#: functions.php:472 
     279msgid "" 
     280"Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark" 
     281"\">permalink</a>." 
     282msgstr "" 
     283 
     284#: header.php:33 
     285msgid "Page %s" 
     286msgstr "" 
     287 
     288#: header.php:83 
     289msgid "Skip to content" 
     290msgstr "" 
     291 
     292#: author.php:27 
     293msgid "Author Archives: %s" 
     294msgstr "" 
     295 
     296#: author.php:37 single.php:40 
     297msgid "About %s" 
     298msgstr "" 
     299 
     300#: attachment.php:18 
     301msgid "Return to %s" 
     302msgstr "" 
     303 
     304#: attachment.php:20 
     305msgid "<span class=\"meta-nav\">&larr;</span> %s" 
     306msgstr "" 
     307 
     308#: attachment.php:29 
     309msgid "<span class=\"%1$s\">By</span> %2$s" 
     310msgstr "" 
     311 
     312#: attachment.php:40 
     313msgid "<span class=\"%1$s\">Published</span> %2$s" 
     314msgstr "" 
     315 
     316#: attachment.php:50 
     317msgid "Full size is %s pixels" 
     318msgstr "" 
     319 
     320#: attachment.php:53 
     321msgid "Link to full-size image" 
     322msgstr "" 
     323 
    368324#: search.php:16 
    369 #, php-format 
    370325msgid "Search Results for: %s" 
    371326msgstr "" 
     
    381336msgstr "" 
    382337 
    383 #: sidebar.php:27 
    384 msgid "Archives" 
    385 msgstr "" 
    386  
    387 #: sidebar.php:34 
    388 msgid "Meta" 
     338#: archive.php:33 
     339msgid "Daily Archives: <span>%s</span>" 
     340msgstr "" 
     341 
     342#: archive.php:35 
     343msgid "Monthly Archives: <span>%s</span>" 
     344msgstr "" 
     345 
     346#: archive.php:37 
     347msgid "Yearly Archives: <span>%s</span>" 
     348msgstr "" 
     349 
     350#: archive.php:39 
     351msgid "Blog Archives" 
    389352msgstr "" 
    390353 
     
    400363 
    401364#: single.php:44 
    402 #, php-format 
    403365msgid "View all posts by %s <span class=\"meta-nav\">&rarr;</span>" 
    404 msgstr "" 
    405  
    406 #: tag.php:16 
    407 #, php-format 
    408 msgid "Tag Archives: %s" 
    409366msgstr "" 
    410367 
  • trunk/blogs/wp-includes/default-filters.php

    r1874 r1877  
    3232} 
    3333 
    34 // Kses only for textarea saves displays 
    35 foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) { 
     34// Kses only for textarea admin displays 
     35foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description', 'comment_text' ) as $filter ) { 
    3636        add_filter( $filter, 'wp_kses_data' ); 
    3737} 
     
    7373foreach ( array( 'pre_post_type' ) as $filter ) { 
    7474        add_filter( $filter, 'sanitize_user' ); 
     75} 
     76foreach ( array( 'pre_post_status', 'pre_post_comment_status', 'pre_post_ping_status' ) as $filter ) { 
     77        add_filter( $filter, 'sanitize_key' ); 
    7578} 
    7679 
  • trunk/blogs/wp-includes/kses.php

    r1874 r1877  
    11<?php 
    22/** 
    3  * HTML/XHTML filter that only allows some elements and attributes 
     3 * kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes 
     4 * Copyright (C) 2002, 2003, 2005  Ulf Harnhammar 
     5 * 
     6 * This program is free software and open source software; you can redistribute 
     7 * it and/or modify it under the terms of the GNU General Public License as 
     8 * published by the Free Software Foundation; either version 2 of the License, 
     9 * or (at your option) any later version. 
     10 * 
     11 * This program is distributed in the hope that it will be useful, but WITHOUT 
     12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
     13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
     14 * more details. 
     15 * 
     16 * You should have received a copy of the GNU General Public License along 
     17 * with this program; if not, write to the Free Software Foundation, Inc., 
     18 * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  or visit 
     19 * http://www.gnu.org/licenses/gpl.html 
     20 *  
     21 * [kses strips evil scripts!] 
    422 * 
    523 * Added wp_ prefix to avoid conflicts with existing kses users 
     
    725 * @version 0.2.2 
    826 * @copyright (C) 2002, 2003, 2005 
    9  * @author Ulf Harnhammar <metaur@users.sourceforge.net> 
     27 * @author Ulf Harnhammar <http://advogato.org/person/metaur/> 
    1028 * 
    1129 * @package External 
    1230 * @subpackage KSES 
    13  * 
    14  * @internal 
    15  * *** CONTACT INFORMATION *** 
    16  * E-mail:      metaur at users dot sourceforge dot net 
    17  * Web page:    http://sourceforge.net/projects/kses 
    18  * Paper mail:  Ulf Harnhammar 
    19  *              Ymergatan 17 C 
    20  *              753 25  Uppsala 
    21  *              SWEDEN 
    22  * 
    23  * [kses strips evil scripts!] 
    2431 */ 
    2532 
  • trunk/blogs/wp-includes/pluggable.php

    r1874 r1877  
    826826        $referer = strtolower(wp_get_referer()); 
    827827        $result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false; 
    828         if ( !$result && !(-1 == $action && strpos($referer, $adminurl) !== false) ) { 
     828        if ( !$result && !(-1 == $action && strpos($referer, $adminurl) === 0) ) { 
    829829                wp_nonce_ays($action); 
    830830                die(); 
  • trunk/blogs/wp-includes/script-loader.php

    r1874 r1877  
    276276                $scripts->add_data( 'postbox', 'group', 1 ); 
    277277 
    278                 $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20100526' ); 
     278                $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110203' ); 
    279279                $scripts->add_data( 'post', 'group', 1 ); 
    280280                $scripts->localize( 'post', 'postL10n', array( 
  • trunk/blogs/wp-includes/version.php

    r1874 r1877  
    11<?php 
    2 /** 
    3  * This holds the version number in a separate file so we can bump it without cluttering the SVN 
    4  */ 
     2/* 
     3WordPress - Web publishing software 
     4 
     5This program is free software; you can redistribute it and/or 
     6modify it under the terms of the GNU General Public License 
     7as published by the Free Software Foundation; either version 2 
     8of the License, or (at your option) any later version. 
     9 
     10This program is distributed in the hope that it will be useful, 
     11but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13GNU General Public License for more details. 
     14 
     15You should have received a copy of the GNU General Public License 
     16along with this program; if not, write to the Free Software 
     17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
     18*/ 
    519 
    620/** 
     
    923 * @global string $wp_version 
    1024 */ 
    11 $wp_version = '3.0.4'; 
     25$wp_version = '3.0.5'; 
    1226 
    1327/** 
Note: See TracChangeset for help on using the changeset viewer.