Lucia's Linky Love) once or publish a post before this works properly. Until you do, everything will be marked "nofollow".
Author: Lucia Liljegren
Version: 0.3 (Added number count toggles.)
Author URI: http://money.bigbucksblogger.com
*/
/*
*Copyright (c) 2007 Lucia Liljegren
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
add_action('admin_menu', 'luciaLinkyLove_admin_menu');
add_filter('get_comment_author_link', 'adjust_nofollow_author',11);
add_filter('comment_text', 'adjust_nofollow_text',11);
add_action('loop_end', 'addLuciaLinkyLoveLink');
add_action('publish_post', 'updateLuciaLinkyLoveDate');
// ************ ************
function updateLuciaLinkyLoveDate() {
$lastposts = get_posts('numberposts=1');
foreach($lastposts as $post) {
setup_postdata($post);
the_title();
$lastLinkyLoveDate=$post->post_date;
//echo('
lastLinkyLoveDate= '.$lastLinkyLoveDate);
update_option('lastLinkyLoveDate',$lastLinkyLoveDate);
}
}
// ************ ************
function addLuciaLinkyLoveLink($text='') {
// called at loop end.
global $single, $feed, $post;
$commentPolicyPage= get_option('commentPolicyPage');
if(!$feed && $single ){
if( $commentPolicyPage==2 || ($commentPolicyPage==1 && ($post->post_date < $old_Post )) ){
echo("
Comments protected by Lucia's Linky Love.");}
}// feed
return $text;
}
// ************ ************
function luciaLinkyLove_admin_menu() {
add_options_page(
__('LuciaLinkyLove Options'),
__('Lucia_LinkyLove'), 5, basename(__FILE__),'set_LuciaLinkyLove_options_page');
}
// ************ ************
function set_LuciaLinkyLove_options_page(){
$text="Your current settings are shown below.";
if($_POST['LuciaLinkyLove']=='Submit'){
$authorMatchNumber= min(max(floor($_POST['authorMatchNumber']),3),10);
$commentMatchNumber= max(floor($_POST['theCommentMatchNumber']),-1);
if(-1<$commentMatchNumber){$commentMatchNumber=max($commentMatchNumber,3);}
$commentPolicyPage= $_POST['commentPolicyPage'];
$maxCharactersInName= max($_POST['maxCharactersInName'],15);
$adminNameExclude= $_POST['adminNameExclude'];
$luciaLinkyDays= max($_POST['luciaLinkyDays'],0);
$showCommentNumber= $_POST['showCommentNumber'];
echo('
You requested these settings:
commentMatchNumber= '.$commentMatchNumber.' | authorMatchNumber='.$authorMatchNumber.' | commentPolicyPage='.$commentPolicyPage.' | maxCharactersInName='.$maxCharactersInName.' | adminNameExclude='.$adminNameExclude.' | days to delay '.$luciaLinkyDays.'| Show comments count '.$showCommentNumber.'