Version Description
Download this release
Release Info
Developer | teamplaylotto |
Plugin | CommentLuv |
Version | 2.7.4 |
Comparing to | |
See all releases |
Code changes from version 2.7 to 2.7.4
- commentluv.php +96 -72
- js/commentluv.js +31 -15
- readme.txt +55 -8
commentluv.php
CHANGED
@@ -2,12 +2,18 @@
|
|
2 |
Plugin Name: CommentLuv
|
3 |
Plugin URI: http://comluv.com/download/commentluv-wordpress/
|
4 |
Description: Plugin to show a link to the last post from the commenters blog by parsing the feed at their given URL when they leave a comment. Rewards your readers and encourage more comments.
|
5 |
-
Version: 2.7
|
6 |
Author: Andy Bailey
|
7 |
Author URI: http://fiddyp.comluv.com/
|
8 |
|
9 |
26 Apr 2009 - Start the new version using a class and updated localization (thanks Vladimir Prelovac for your great book on Wordpress Plugin Development!)
|
10 |
05 Jun 2009 - Finalized last functions and integrated API. big up to @wpmuguru for API coding!
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
// Avoid name collision
|
13 |
if ( !class_exists('commentluv') ) {
|
@@ -15,11 +21,11 @@ if ( !class_exists('commentluv') ) {
|
|
15 |
class commentluv
|
16 |
{
|
17 |
//localization domain
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
//initialize the plugin
|
25 |
function commentluv()
|
@@ -52,11 +58,8 @@ if ( !class_exists('commentluv') ) {
|
|
52 |
add_action('comment_post',array(&$this,'update_cl_status'), 2, 3); // call when comment gets posted
|
53 |
add_action('comment_form',array(&$this, 'add_fields')); // add hidden fields during comment form display time
|
54 |
add_filter('plugin_action_links', array(&$this,'commentluv_action'), -10, 2); // add a settings page link to the plugin description. use 2 for allowed vars
|
55 |
-
add_filter('comment_text', array(&$this,'do_shortcode')); // replace inserted data with hidden span on display time of comment
|
56 |
add_filter('pre_comment_content',array(&$this,'cl_post'),10); // extract extra fields data and insert data to end of comment
|
57 |
-
add_filter('get_comment_excerpt',array(&$this,'excerpt_tag_remove')); // remove the tags when get comment excerpt is used
|
58 |
-
add_filter('comment_excerpt',array(&$this,'excerpt_tag_remove')); // remove the tags when comment excerpt is used
|
59 |
-
|
60 |
}
|
61 |
|
62 |
// hook the options page
|
@@ -80,7 +83,7 @@ if ( !class_exists('commentluv') ) {
|
|
80 |
wp_enqueue_script('jquery');
|
81 |
global $wp_version;
|
82 |
// see if hoverintent library is already included (2.7 >)
|
83 |
-
if (version_compare($wp_version,"2.
|
84 |
wp_enqueue_script('hoverIntent','/'.PLUGINDIR.'/'.dirname( plugin_basename(__FILE__)).'/js/hoverIntent.js',array('jquery'));
|
85 |
} else {
|
86 |
wp_enqueue_script('hoverIntent','/'.WPINC.'/js/hoverIntent.js',array('jquery'));
|
@@ -231,7 +234,7 @@ if ( !class_exists('commentluv') ) {
|
|
231 |
$options = get_option($this->db_option);
|
232 |
// choose as image or as text
|
233 |
$badge_text = $options['badge'] == 'text'?'on':'';
|
234 |
-
$default_on = $options['default_on'] == 'on'?'checked':'';
|
235 |
// untick the box if user is admin
|
236 |
global $user_ID;
|
237 |
if( $user_ID ) {
|
@@ -241,9 +244,9 @@ if ( !class_exists('commentluv') ) {
|
|
241 |
}
|
242 |
$options['badge'] = $this->plugin_url . 'images/' . $options['badge'];
|
243 |
if($badge_text == ''){
|
244 |
-
$badge='<a href="http://comluv.com" target="
|
245 |
} else {
|
246 |
-
$badge
|
247 |
}
|
248 |
echo '<div id="commentluv">' . $options['prepend'] . '<input type="checkbox" id="doluv" name="doluv" ' .
|
249 |
$default_on . ' style="width:25px;"></input><span id="mylastpost" style="clear: both">' .
|
@@ -287,7 +290,7 @@ if ( !class_exists('commentluv') ) {
|
|
287 |
return $id;
|
288 |
}
|
289 |
|
290 |
-
// hook the pre_comment_content to add the link
|
291 |
function cl_post($commentdata){
|
292 |
if( isset($_POST['cl_post']) && $_POST['request_id'] !='' && is_numeric($_POST['choice_id']) && isset($_POST['cl_type']) ) {
|
293 |
// get values posted
|
@@ -298,8 +301,23 @@ if ( !class_exists('commentluv') ) {
|
|
298 |
$request_id = $_POST['request_id'];
|
299 |
$choice_id = $_POST['choice_id'];
|
300 |
$cl_type = $_POST['cl_type'];
|
301 |
-
//
|
302 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
304 |
return $commentdata;
|
305 |
}
|
@@ -311,87 +329,67 @@ if ( !class_exists('commentluv') ) {
|
|
311 |
$status = 'approve';
|
312 |
}
|
313 |
$comment = get_comment($cid);
|
314 |
-
if(strpos($comment->comment_content,"
|
315 |
// comment can be approved or deleted in the comluv db
|
316 |
$url = $this->api_url ."?type={$status}&url=";
|
317 |
-
// get the
|
318 |
$commentcontent = $comment->comment_content;
|
319 |
-
$start =
|
320 |
-
$
|
321 |
-
$
|
322 |
-
$
|
|
|
|
|
|
|
|
|
323 |
// construct url with added params for approving comment to comluv
|
324 |
-
$url.=$
|
325 |
// call the url ..
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
curl_setopt($curl,CURLOPT_URL,$url);
|
330 |
-
curl_setopt($curl,CURLOPT_HEADER,0);
|
331 |
-
curl_setopt($curl,CURLOPT_RETURNTRANSFER,TRUE);
|
332 |
-
curl_setopt($curl,CURLOPT_TIMEOUT,7);
|
333 |
-
$content=curl_exec($curl);
|
334 |
-
if(!curl_error($curl)){
|
335 |
-
$data=json_decode($content);
|
336 |
-
curl_close($curl);
|
337 |
-
if($data->status != 200){
|
338 |
-
// unsuccessful confirmation.
|
339 |
-
// have a tantrum here if you want.
|
340 |
-
}
|
341 |
-
}
|
342 |
-
} elseif(ini_get('allow_url_fopen')){
|
343 |
-
$result = @file_get_contents($url);
|
344 |
-
}
|
345 |
-
} // end if comment content contains a rq var
|
346 |
-
}
|
347 |
}
|
348 |
|
349 |
// use my own shortcode that was inserted at submission time and hide the params
|
350 |
function do_shortcode($commentcontent) {
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
// get bit that was added
|
353 |
$start = strpos($commentcontent,'[rq=');
|
354 |
$end = strpos($commentcontent,'[/rq]') + 5;
|
355 |
$params = substr($commentcontent,$start,$end-$start);
|
356 |
-
$luvlink = substr($commentcontent,$end);
|
357 |
-
// insert hidden span for params and chop off luvlink for now
|
358 |
-
$commentcontent = substr($commentcontent,0,$start) . '<span class="cl_hidden" style="display:none;">' . $params . '</span>';
|
359 |
-
// get name and site of comment author
|
360 |
-
$options = get_option($this->db_option);
|
361 |
global $comment;
|
362 |
$author_name = $comment->comment_author;
|
363 |
$author_url = $comment->comment_author_url;
|
364 |
// get array of params
|
365 |
-
$
|
366 |
// get and prepare the text specified by the user
|
367 |
$prepend_text = $options['comment_text'];
|
368 |
$search = array('[name]','[type]','[lastpost]');
|
369 |
-
$replace = array($author_name,$
|
370 |
-
$inserted =
|
371 |
-
|
372 |
-
$commentcontent
|
373 |
-
// do heart info
|
374 |
if($options['heart_tip'] == 'on'){
|
375 |
-
$commentcontent .= '<span class="heart_tip_box"><img class="heart_tip" alt="My ComLuv Profile" border=0 width="16" height="14" src="'. $this->plugin_url . 'images/littleheart.gif"/></span>';
|
376 |
}
|
377 |
$commentcontent .= '</span>';
|
378 |
}
|
379 |
return $commentcontent;
|
380 |
}
|
381 |
-
// hook the get_comment_excerpt filter to remove tags
|
382 |
-
function excerpt_tag_remove($theexcerpt){
|
383 |
-
if(strpos($theexcerpt,"[rq=")){
|
384 |
-
$start = strpos($theexcerpt,'[rq=');
|
385 |
-
if(strpos($theexcerpt,"[/rq]")) {
|
386 |
-
$end=strpos($theexcerpt,'[/rq]') + 5;
|
387 |
-
$params= substr($theexcerpt,$start,$end-$start);
|
388 |
-
$theexcerpt = str_replace($params,"",$theexcerpt);
|
389 |
-
} else {
|
390 |
-
$theexcerpt = substr($theexcerpt,0,$start) . '...';
|
391 |
-
}
|
392 |
-
}
|
393 |
-
return $theexcerpt;
|
394 |
-
}
|
395 |
|
396 |
// set up default values
|
397 |
function install()
|
@@ -412,6 +410,32 @@ if ( !class_exists('commentluv') ) {
|
|
412 |
// load translation
|
413 |
load_textdomain($this->plugin_domain, $mofile);
|
414 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
|
416 |
|
417 |
|
2 |
Plugin Name: CommentLuv
|
3 |
Plugin URI: http://comluv.com/download/commentluv-wordpress/
|
4 |
Description: Plugin to show a link to the last post from the commenters blog by parsing the feed at their given URL when they leave a comment. Rewards your readers and encourage more comments.
|
5 |
+
Version: 2.7.4
|
6 |
Author: Andy Bailey
|
7 |
Author URI: http://fiddyp.comluv.com/
|
8 |
|
9 |
26 Apr 2009 - Start the new version using a class and updated localization (thanks Vladimir Prelovac for your great book on Wordpress Plugin Development!)
|
10 |
05 Jun 2009 - Finalized last functions and integrated API. big up to @wpmuguru for API coding!
|
11 |
+
10 Jun 2009 - Fix for php4 hosting. changed "public" to "var" and check function exists for json_decode
|
12 |
+
11 Jun 2009 - Small bug in using text as badge fixed. Changed strpos to strrpos to find last tag code in text. priority 1 for comment_text
|
13 |
+
removed request id data from being inserted (too many complaints!) and adjusted the way comment status change is handled. approve is done at post submission and
|
14 |
+
delete is done at change status (with no request id sent)
|
15 |
+
12 Jun 2009 - small fixes for valid xhtml on images and checkbox . remove identifying .-= / =-. from inserted link on display time. happy birthday to me
|
16 |
+
|
17 |
*/
|
18 |
// Avoid name collision
|
19 |
if ( !class_exists('commentluv') ) {
|
21 |
class commentluv
|
22 |
{
|
23 |
//localization domain
|
24 |
+
var $plugin_domain = 'commentluv';
|
25 |
+
var $plugin_url;
|
26 |
+
var $db_option = 'commentluv_options';
|
27 |
+
var $cl_version = 274;
|
28 |
+
var $api_url;
|
29 |
|
30 |
//initialize the plugin
|
31 |
function commentluv()
|
58 |
add_action('comment_post',array(&$this,'update_cl_status'), 2, 3); // call when comment gets posted
|
59 |
add_action('comment_form',array(&$this, 'add_fields')); // add hidden fields during comment form display time
|
60 |
add_filter('plugin_action_links', array(&$this,'commentluv_action'), -10, 2); // add a settings page link to the plugin description. use 2 for allowed vars
|
61 |
+
add_filter('comment_text', array(&$this,'do_shortcode'),10); // replace inserted data with hidden span on display time of comment
|
62 |
add_filter('pre_comment_content',array(&$this,'cl_post'),10); // extract extra fields data and insert data to end of comment
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
// hook the options page
|
83 |
wp_enqueue_script('jquery');
|
84 |
global $wp_version;
|
85 |
// see if hoverintent library is already included (2.7 >)
|
86 |
+
if (version_compare($wp_version,"2.8","<")){
|
87 |
wp_enqueue_script('hoverIntent','/'.PLUGINDIR.'/'.dirname( plugin_basename(__FILE__)).'/js/hoverIntent.js',array('jquery'));
|
88 |
} else {
|
89 |
wp_enqueue_script('hoverIntent','/'.WPINC.'/js/hoverIntent.js',array('jquery'));
|
234 |
$options = get_option($this->db_option);
|
235 |
// choose as image or as text
|
236 |
$badge_text = $options['badge'] == 'text'?'on':'';
|
237 |
+
$default_on = $options['default_on'] == 'on'?'checked="checked"':'';
|
238 |
// untick the box if user is admin
|
239 |
global $user_ID;
|
240 |
if( $user_ID ) {
|
244 |
}
|
245 |
$options['badge'] = $this->plugin_url . 'images/' . $options['badge'];
|
246 |
if($badge_text == ''){
|
247 |
+
$badge='<a href="http://comluv.com" target="_blank"><img src="' . $options['badge'] . '" border=0 alt="' . $options['show_text'] .'" title="'.$options['show_text'].'"/></a>';
|
248 |
} else {
|
249 |
+
$badge='<a href="http://comluv.com" target="_blank">'.$options['show_text'].'</a>';
|
250 |
}
|
251 |
echo '<div id="commentluv">' . $options['prepend'] . '<input type="checkbox" id="doluv" name="doluv" ' .
|
252 |
$default_on . ' style="width:25px;"></input><span id="mylastpost" style="clear: both">' .
|
290 |
return $id;
|
291 |
}
|
292 |
|
293 |
+
// hook the pre_comment_content to add the link
|
294 |
function cl_post($commentdata){
|
295 |
if( isset($_POST['cl_post']) && $_POST['request_id'] !='' && is_numeric($_POST['choice_id']) && isset($_POST['cl_type']) ) {
|
296 |
// get values posted
|
301 |
$request_id = $_POST['request_id'];
|
302 |
$choice_id = $_POST['choice_id'];
|
303 |
$cl_type = $_POST['cl_type'];
|
304 |
+
// convert data to put into comment content
|
305 |
+
$options = get_option($this->db_option);
|
306 |
+
$prepend_text = $options['comment_text'];
|
307 |
+
$search = array('[name]','[type]','[lastpost]');
|
308 |
+
$replace = array($_POST["{$options['author_name']}"],$cl_type,$luvlink);
|
309 |
+
$inserted = str_replace($search,$replace,$prepend_text);
|
310 |
+
// insert identifying data and insert text/link to end of comment
|
311 |
+
$commentdata.= "\n.-= $inserted =-.";
|
312 |
+
// tell comluv that the comment was submitted
|
313 |
+
$luvlink = stripslashes($luvlink);
|
314 |
+
$thelinkstart = strpos($luvlink,'="');
|
315 |
+
$cutit = substr($luvlink,$thelinkstart+2);
|
316 |
+
$hrefend=strpos($cutit,'"');
|
317 |
+
$thelink = substr($cutit,0,$hrefend);
|
318 |
+
// got the url, construct url to tell comluv
|
319 |
+
$url = $this->api_url . "?type=approve&request_id=$request_id&post_id=$choice_id&url=$thelink";
|
320 |
+
$content = $this->call_comluv($url);
|
321 |
}
|
322 |
return $commentdata;
|
323 |
}
|
329 |
$status = 'approve';
|
330 |
}
|
331 |
$comment = get_comment($cid);
|
332 |
+
if(strpos($comment->comment_content,".-=")){
|
333 |
// comment can be approved or deleted in the comluv db
|
334 |
$url = $this->api_url ."?type={$status}&url=";
|
335 |
+
// get the link
|
336 |
$commentcontent = $comment->comment_content;
|
337 |
+
$start = strrpos($commentcontent,'.-=');
|
338 |
+
$thelink = substr($commentcontent,$start+4,strlen($commentcontent)-$start-5);
|
339 |
+
$hrefstart= strpos($thelink,'="');
|
340 |
+
$cutit = substr($thelink,$hrefstart+2);
|
341 |
+
$hrefend=strpos($cutit,'"');
|
342 |
+
$thelink=substr($cutit,0,$hrefend);
|
343 |
+
// get comment date
|
344 |
+
$date = $comment->comment_date_gmt;
|
345 |
// construct url with added params for approving comment to comluv
|
346 |
+
$url.=$thelink . "&comment_date=$date&version=" . $this->cl_version;
|
347 |
// call the url ..
|
348 |
+
$content = $this->call_comluv($url);
|
349 |
+
} // end if comment content contains a .-=
|
350 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
}
|
352 |
|
353 |
// use my own shortcode that was inserted at submission time and hide the params
|
354 |
function do_shortcode($commentcontent) {
|
355 |
+
$options = get_option($this->db_option);
|
356 |
+
if(strpos($commentcontent,".-=")){
|
357 |
+
// get bit that was added
|
358 |
+
$start = strrpos($commentcontent,'.-=');
|
359 |
+
$beforelinktext = substr($commentcontent,0,$start);
|
360 |
+
$thelinktext = substr($commentcontent,$start+3,-3);
|
361 |
+
$commentcontent = $beforelinktext.'<span class="cluv">'.$thelinktext;
|
362 |
+
// do heart info
|
363 |
+
if($options['heart_tip'] == 'on'){
|
364 |
+
$commentcontent .= '<span class="heart_tip_box"><img class="heart_tip" alt="My ComLuv Profile" border="0" width="16" height="14" src="'. $this->plugin_url . 'images/littleheart.gif"/></span>';
|
365 |
+
}
|
366 |
+
$commentcontent .= '</span>';
|
367 |
+
}
|
368 |
+
// remove old codes
|
369 |
+
if(strpos($commentcontent,"[rq=") && strpos($commentcontent,"[/rq]")){
|
370 |
// get bit that was added
|
371 |
$start = strpos($commentcontent,'[rq=');
|
372 |
$end = strpos($commentcontent,'[/rq]') + 5;
|
373 |
$params = substr($commentcontent,$start,$end-$start);
|
|
|
|
|
|
|
|
|
|
|
374 |
global $comment;
|
375 |
$author_name = $comment->comment_author;
|
376 |
$author_url = $comment->comment_author_url;
|
377 |
// get array of params
|
378 |
+
$params_arr = explode(",",substr($params,4,-6));
|
379 |
// get and prepare the text specified by the user
|
380 |
$prepend_text = $options['comment_text'];
|
381 |
$search = array('[name]','[type]','[lastpost]');
|
382 |
+
$replace = array($author_name,$params_arr[2],'');
|
383 |
+
$inserted = '<span class="cluv">';
|
384 |
+
$inserted .= str_replace($search,$replace,$prepend_text);
|
385 |
+
$commentcontent = str_replace($params,$inserted,$commentcontent);
|
|
|
386 |
if($options['heart_tip'] == 'on'){
|
387 |
+
$commentcontent .= '<span class="heart_tip_box"><img class="heart_tip" alt="My ComLuv Profile" border="0" width="16" height="14" src="'. $this->plugin_url . 'images/littleheart.gif"/></span>';
|
388 |
}
|
389 |
$commentcontent .= '</span>';
|
390 |
}
|
391 |
return $commentcontent;
|
392 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
// set up default values
|
395 |
function install()
|
410 |
// load translation
|
411 |
load_textdomain($this->plugin_domain, $mofile);
|
412 |
}
|
413 |
+
// call home to tell about comment submission or status
|
414 |
+
function call_comluv($url){
|
415 |
+
if(function_exists("curl_init")){
|
416 |
+
//setup curl values
|
417 |
+
$curl=curl_init();
|
418 |
+
curl_setopt($curl,CURLOPT_URL,$url);
|
419 |
+
curl_setopt($curl,CURLOPT_HEADER,0);
|
420 |
+
curl_setopt($curl,CURLOPT_RETURNTRANSFER,TRUE);
|
421 |
+
curl_setopt($curl,CURLOPT_TIMEOUT,7);
|
422 |
+
$content=curl_exec($curl);
|
423 |
+
if(!curl_error($curl)){
|
424 |
+
if(function_exists(json_decode)){
|
425 |
+
$data=json_decode($content);
|
426 |
+
if($data->status != 200){
|
427 |
+
// unsuccessful confirmation.
|
428 |
+
// have a tantrum here if you want.
|
429 |
+
}
|
430 |
+
}
|
431 |
+
curl_close($curl);
|
432 |
+
|
433 |
+
}
|
434 |
+
} elseif(ini_get('allow_url_fopen')){
|
435 |
+
$content = @file_get_contents($url);
|
436 |
+
}
|
437 |
+
return $content;
|
438 |
+
}
|
439 |
|
440 |
|
441 |
|
js/commentluv.js
CHANGED
@@ -37,18 +37,14 @@ jQuery.noConflict();
|
|
37 |
});
|
38 |
// set the event listener for the click action
|
39 |
$('.cluv a').click(function(){
|
40 |
-
|
41 |
-
// get request_id from within hidden span and url that was clicked
|
42 |
-
var str = $(this).parents("span").prev("span").text();
|
43 |
-
var params = str.substr(4).split(",");
|
44 |
var url=$(this).attr('href');
|
45 |
// set link to open in a new window
|
46 |
-
$(this).attr("target","_blank");
|
47 |
-
var addit= "?type=click&
|
48 |
var clurl=cl_settings['api_url'] + addit;
|
49 |
// call api, don't worry about returned data
|
50 |
$.getJSON(clurl);
|
51 |
-
return true;
|
52 |
});
|
53 |
// set the event listener for the click of the checkbox
|
54 |
$('#doluv').click(function(){
|
@@ -68,10 +64,10 @@ jQuery.noConflict();
|
|
68 |
});
|
69 |
// set hover event for heart tip
|
70 |
if(cl_settings['heart_tip'] == "on"){
|
71 |
-
$('.heart_tip_box').hoverIntent({over:heart_big,out:
|
72 |
}
|
73 |
function heart_big(){
|
74 |
-
$(
|
75 |
// find where to put left edge of info box (in case at right hand side of screen
|
76 |
//opera Netscape 6 Netscape 4x Mozilla
|
77 |
if (window.innerWidth || window.innerHeight){
|
@@ -83,19 +79,28 @@ jQuery.noConflict();
|
|
83 |
docwidth = document.body.clientWidth;
|
84 |
docheight = document.body.clientHeight;
|
85 |
}
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
88 |
if(xpos > (docwidth - 350)){
|
89 |
xpos = xpos - 320;
|
90 |
}
|
91 |
-
|
92 |
-
|
|
|
|
|
93 |
var link = $(linkspan).find("a:first").attr("href");
|
94 |
var url = cl_settings['api_url'] + "?type=info&url=" + link + '&version='+ cl_settings['cl_version'] + '&callback=?';
|
95 |
do_info(url);
|
96 |
}
|
97 |
function heart_small(){
|
98 |
-
$(
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
|
@@ -112,6 +117,17 @@ jQuery.noConflict();
|
|
112 |
}
|
113 |
return oLeft
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
function do_info(url){
|
117 |
$.getJSON(url,function(data){
|
@@ -161,7 +177,7 @@ jQuery.noConflict();
|
|
161 |
});
|
162 |
// disable focus event
|
163 |
$("textarea[name='" + cl_settings['comment'] + "']").unbind();
|
164 |
-
}
|
165 |
}
|
166 |
|
167 |
})(jQuery);
|
37 |
});
|
38 |
// set the event listener for the click action
|
39 |
$('.cluv a').click(function(){
|
|
|
|
|
|
|
|
|
40 |
var url=$(this).attr('href');
|
41 |
// set link to open in a new window
|
42 |
+
$(this).attr("target","_blank");
|
43 |
+
var addit= "?type=click&url=" + url + "&callback=?";
|
44 |
var clurl=cl_settings['api_url'] + addit;
|
45 |
// call api, don't worry about returned data
|
46 |
$.getJSON(clurl);
|
47 |
+
return true;
|
48 |
});
|
49 |
// set the event listener for the click of the checkbox
|
50 |
$('#doluv').click(function(){
|
64 |
});
|
65 |
// set hover event for heart tip
|
66 |
if(cl_settings['heart_tip'] == "on"){
|
67 |
+
$('.heart_tip_box').hoverIntent({over:heart_big,out: do_nowt,interval : 50,timeout: 50});
|
68 |
}
|
69 |
function heart_big(){
|
70 |
+
$("body").append('<span id="heart_tip_big" style="position:absolute; z-index: 101; background-color: pink; width: 62px;"><img src="' + cl_settings['images'] + 'loader.gif" alt="Loading" width="62" height="13" /></span>');
|
71 |
// find where to put left edge of info box (in case at right hand side of screen
|
72 |
//opera Netscape 6 Netscape 4x Mozilla
|
73 |
if (window.innerWidth || window.innerHeight){
|
79 |
docwidth = document.body.clientWidth;
|
80 |
docheight = document.body.clientHeight;
|
81 |
}
|
82 |
+
var hasarea = docwidth - getAbsoluteLeft(this);
|
83 |
+
if(hasarea > 350){
|
84 |
+
var xpos = getAbsoluteLeft(this);
|
85 |
+
} else {
|
86 |
+
var xpos = getAbsoluteLeft(this) - 300;
|
87 |
+
}
|
88 |
if(xpos > (docwidth - 350)){
|
89 |
xpos = xpos - 320;
|
90 |
}
|
91 |
+
var ypos = getAbsoluteTop(this);
|
92 |
+
$('#heart_tip_big').css({'left':xpos + "px", 'top' :ypos + "px" });
|
93 |
+
$('#heart_tip_big').hoverIntent({over:do_nowt,out: heart_small, interval : 50, timeout: 350});
|
94 |
+
var linkspan = $(this).parents(".cluv");
|
95 |
var link = $(linkspan).find("a:first").attr("href");
|
96 |
var url = cl_settings['api_url'] + "?type=info&url=" + link + '&version='+ cl_settings['cl_version'] + '&callback=?';
|
97 |
do_info(url);
|
98 |
}
|
99 |
function heart_small(){
|
100 |
+
$("body").find("#heart_tip_big").remove();
|
101 |
+
}
|
102 |
+
function do_nowt(){
|
103 |
+
return;
|
104 |
}
|
105 |
|
106 |
|
117 |
}
|
118 |
return oLeft
|
119 |
}
|
120 |
+
function getAbsoluteTop(objectId) {
|
121 |
+
// Get an object top position from the upper left viewport corner
|
122 |
+
o = objectId;
|
123 |
+
oTop = o.offsetTop // Get top position from the parent object
|
124 |
+
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
|
125 |
+
oParent = o.offsetParent // Get parent object reference
|
126 |
+
oTop += oParent.offsetTop // Add parent top position
|
127 |
+
o = oParent
|
128 |
+
}
|
129 |
+
return oTop
|
130 |
+
}
|
131 |
|
132 |
function do_info(url){
|
133 |
$.getJSON(url,function(data){
|
177 |
});
|
178 |
// disable focus event
|
179 |
$("textarea[name='" + cl_settings['comment'] + "']").unbind();
|
180 |
+
}
|
181 |
}
|
182 |
|
183 |
})(jQuery);
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== CommentLuv ===
|
2 |
-
Contributors:
|
3 |
Donate link:http://comluv.com/about/donate
|
4 |
Tags: commentluv, comments, last blog post, linkluv
|
5 |
Requires at least: 2.6.5
|
6 |
-
Tested up to: 2.
|
7 |
-
Stable tag: 2.7
|
8 |
|
9 |
Reward your readers by automatically placing a link to their last blog post at the end of their comment. Encourage a community and discover new posts.
|
10 |
|
@@ -14,19 +14,61 @@ This plugin will visit the site of the comment author while they type their comm
|
|
14 |
|
15 |
It has been found to increase comments and the community spirit for the thousands of blogs that have installed it. With a simple install you will immediately start to find new and interesting blog posts, tweets and diggs from your own blog and community.
|
16 |
|
17 |
-
The plugin requires WP or WPMU version of at least 2.
|
18 |
|
19 |
With a full support site where you can unlock great new features, start your own WP2.7 blog with CommentLuv already installed and set up, view your stats for comments made and received and much more.
|
20 |
|
21 |
You can visit http://comluv.com to find out more about this plugin.
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
== Installation ==
|
26 |
|
27 |
Wordpress : Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.
|
28 |
|
29 |
WordpressMu : Same as above
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
== Frequently Asked Questions ==
|
31 |
|
32 |
=Does this plugin add any database tables?=
|
@@ -35,11 +77,16 @@ No. The link and a small bit of associated data is appended to the comment conte
|
|
35 |
|
36 |
=Will this plugin work with Disqus/Intense Debate/js-kit?=
|
37 |
|
38 |
-
There will be
|
|
|
|
|
|
|
|
|
|
|
39 |
== Screenshots ==
|
40 |
1. settings page
|
41 |
|
42 |
2. in use
|
43 |
This plugin inserts fields to the comment form at run time. If you find there is no badge shown on the comment form after you first install it, please check your comments.php file for the command <?php do\_action('comment\_form', $post->ID); ?> before the </form> tag
|
44 |
|
45 |
-
For logged on users and administrators, be sure to check your profile and make sure there is a url entered.
|
1 |
=== CommentLuv ===
|
2 |
+
Contributors: @commentluv (concept & coding) @wpmuguru (api) @andrea_r (site design)
|
3 |
Donate link:http://comluv.com/about/donate
|
4 |
Tags: commentluv, comments, last blog post, linkluv
|
5 |
Requires at least: 2.6.5
|
6 |
+
Tested up to: 2.8
|
7 |
+
Stable tag: 2.7.4
|
8 |
|
9 |
Reward your readers by automatically placing a link to their last blog post at the end of their comment. Encourage a community and discover new posts.
|
10 |
|
14 |
|
15 |
It has been found to increase comments and the community spirit for the thousands of blogs that have installed it. With a simple install you will immediately start to find new and interesting blog posts, tweets and diggs from your own blog and community.
|
16 |
|
17 |
+
The plugin requires WP or WPMU version of at least 2.65 and will work with administrators and logged on users provided they have their homepage url set in their profile page in the dashboard of the site.
|
18 |
|
19 |
With a full support site where you can unlock great new features, start your own WP2.7 blog with CommentLuv already installed and set up, view your stats for comments made and received and much more.
|
20 |
|
21 |
You can visit http://comluv.com to find out more about this plugin.
|
22 |
|
23 |
+
== Details ==
|
24 |
+
|
25 |
+
CommentLuv functionality
|
26 |
+
* Works with Wordpress 2.65, 2.7.1 and 2.8
|
27 |
+
* Compatible with WPmu and logged on users
|
28 |
+
* Language support
|
29 |
+
* Communicates with remote API when comment is deleted or spammed
|
30 |
+
* Uses WP includes for jQuery and hoverIntent for improved compatibility with other plugins
|
31 |
+
* Auto configures to recognize comment form
|
32 |
+
|
33 |
== Installation ==
|
34 |
|
35 |
Wordpress : Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.
|
36 |
|
37 |
WordpressMu : Same as above
|
38 |
+
|
39 |
+
== Configuration ==
|
40 |
+
|
41 |
+
Display Options :
|
42 |
+
Enter the text you want displayed in the comment for the link that is added.
|
43 |
+
[name] -> replaced with comment author name
|
44 |
+
[type] -> replaced with blog, twitter or digg depending on what type of link the author chose to include.
|
45 |
+
[lastpot] -> replaced with the titled link.
|
46 |
+
|
47 |
+
Text displayed in the select box -> shows in the pull down box when a user has more than one post to choose from
|
48 |
+
|
49 |
+
CommentLuv on by default -> check this box to enable CommentLuv by default
|
50 |
+
|
51 |
+
Show heart on links -> Shows the heart icon next to links so users can find out more about the comment author
|
52 |
+
|
53 |
+
Use teamplate insert to show badge and checkbox -> check this box if you want to place the badge and pull down box in a particular place on your page by using the template code.
|
54 |
+
|
55 |
+
display badge -> choose from 4 different badges, choose no badge or use your own specified text
|
56 |
+
|
57 |
+
CommentLuv member area -> for future use
|
58 |
+
|
59 |
+
Technical Settings:
|
60 |
+
Authors name field name -> The name value of the field used on your comment form for the comment authors name
|
61 |
+
Email field name -> The name value of the field used on your comment form for the comment authors email
|
62 |
+
Authors URL field name -> The name value of the field used on your comment form for the comment authors site URL
|
63 |
+
Comments Text Area Name -> The name value of the field used on your comment form for the comment
|
64 |
+
|
65 |
+
update -> updates the settings
|
66 |
+
|
67 |
+
reset -> if you get in trouble, click this to reset to default settings
|
68 |
+
|
69 |
+
== Adding to your template ==
|
70 |
+
Use <php cl_show_badge(); ?> in your comments.php file where you want the badge and checkbox to be shown
|
71 |
+
|
72 |
== Frequently Asked Questions ==
|
73 |
|
74 |
=Does this plugin add any database tables?=
|
77 |
|
78 |
=Will this plugin work with Disqus/Intense Debate/js-kit?=
|
79 |
|
80 |
+
There will be versions in the future that will work with Disqus, JS-kit and Intense debate. There is also an API available for developers if they choose to write their own versions.
|
81 |
+
|
82 |
+
=I am having a problem getting it to work=
|
83 |
+
|
84 |
+
You can submit a support ticket at http://comluv.com
|
85 |
+
|
86 |
== Screenshots ==
|
87 |
1. settings page
|
88 |
|
89 |
2. in use
|
90 |
This plugin inserts fields to the comment form at run time. If you find there is no badge shown on the comment form after you first install it, please check your comments.php file for the command <?php do\_action('comment\_form', $post->ID); ?> before the </form> tag
|
91 |
|
92 |
+
For logged on users and administrators, be sure to check your profile on your own dashboard and make sure there is a url entered.
|