CommentLuv - Version 2.5.4

Version Description

Download this release

Release Info

Developer teamplaylotto
Plugin Icon 128x128 CommentLuv
Version 2.5.4
Comparing to
See all releases

Code changes from version 2.5.3 to 2.5.4

Files changed (4) hide show
  1. commentluv.php +11 -10
  2. include/tip.php +20 -91
  3. js/commentluv.js +6 -4
  4. readme.txt +1 -1
commentluv.php CHANGED
@@ -2,7 +2,7 @@
2
  Plugin Name: commentluv
3
  Plugin URI: http://www.commentluv.com/download/ajax-commentluv-installation/
4
  Description: Plugin to show a link to the last post from the commenters blog in their comment. Just activate and it's ready. Will parse a feed from most sites that have a feed location specified in its head html. See the <a href="options-general.php?page=commentluv">Settings Page</a> for styling and text output options.
5
- Version: 2.5.3
6
  Author: Andy Bailey
7
  Author URI: http://www.fiddyp.co.uk/
8
 
@@ -10,6 +10,9 @@ Author URI: http://www.fiddyp.co.uk/
10
  You can now edit the options from the dashboard
11
  *********************************************************************
12
  updates:
 
 
 
13
  2.5.3 - fix for clicktracking off. needs quotes around the 1 too! prettied up default styling for abbr em and fixed an error with click tracking not adding member id by moving the click function to inline with commentluv.js
14
  2.5.2 - 4 oct 08 - oh dear silly me, forgot to enclose an ==TRUE with quotes. (line 302) heart info box now can be switched off. thanks Ute from http://www.utes-dezines.de for you feedback.
15
  2.5.1 - fix for pesky IE and Chrome
@@ -172,8 +175,8 @@ function commentluv_setup()
172
  function commentluv_activation(){
173
  // set version for future releases if they need to change a value
174
  $version=get_option('cl_version');
175
- if($version<253){
176
- update_option('cl_version','253');
177
  }
178
  }
179
 
@@ -228,7 +231,7 @@ function show_cl_options() {
228
  commentluv_alter_whitelist_options("");
229
  // Add a new submenu under Options:
230
  add_options_page('CommentLuv', 'CommentLuv', 8, 'commentluv', 'cl_options_page');
231
- add_option('cl_comment_text','[name]&#180;s last blog post..[lastpost]');
232
  add_option('cl_default_on','TRUE');
233
  add_option('cl_heart_tip','TRUE');
234
  add_option('cl_style','border:1px solid #ffffff; background-color: #eeeeee; display:block; padding:4px;');
@@ -246,7 +249,7 @@ function show_cl_options() {
246
  add_option('cl_badge_pos','');
247
  add_option('cl_prepend','');
248
  commentluv_activation();
249
- add_option('cl_version','253');
250
  add_option('cl_select_text','choose a different post to show');
251
  }
252
 
@@ -276,7 +279,7 @@ function cl_style_script(){
276
  $comment_selector= (get_option('cl_textarea_type')=="name")? "\"textarea[name='$cl_comment_id']\"" : "'#$cl_comment_id'";
277
  $author_selector= (get_option('cl_author_type')=="name")? "\"input[name='$cl_author_id']\"" : "'#$cl_author_id'";
278
  $url_selector= (get_option('cl_url_type')=="name")? "\"input[name='$cl_site_id']\"" : "'#$cl_site_id'";
279
-
280
  $cl_comment_text=get_option('cl_comment_text');
281
  $cl_default_on=get_option('cl_default_on');
282
  $cl_badge=get_option('cl_badge');
@@ -296,12 +299,9 @@ function cl_style_script(){
296
 
297
  // start the javascript output
298
  if(is_single()) {
299
- echo '<!-- Styling and script added by commentluv 2.5.3 http://www.commentluv.com -->';
300
  echo '<style type="text/css">abbr em{'.get_option('cl_style').'} #lastposts { width: 300px; } </style>';
301
  echo "\n<script type=\"text/javascript\" src=\"".WP_PLUGIN_URL."/commentluv/js/commentluv.js\"></script>";
302
- //if(get_option('cl_click_track')=="on"){
303
- //echo "\n<script type=\"text/javascript\" src=\"".WP_PLUGIN_URL."/commentluv/js/processclick.js\"></script>\n";
304
- //}
305
  if(get_option('cl_heart_tip')=="TRUE"){
306
  echo "<link rel=\"stylesheet\" href=\"".WP_PLUGIN_URL."/commentluv/include/tipstyle.css\" type=\"text/css\" />\n";
307
  echo "<script type=\"text/javascript\"><!--//--><![CDATA[//><!--\n";
@@ -350,6 +350,7 @@ function cl_style_script(){
350
  echo "cl_settings[13]=\"admin\";\n";
351
  }
352
  echo "cl_settings[14]=\"$cl_member_id\";\n";
 
353
  echo "commentluv(cl_settings);\n";
354
 
355
  echo "//--><!]]></script>";
2
  Plugin Name: commentluv
3
  Plugin URI: http://www.commentluv.com/download/ajax-commentluv-installation/
4
  Description: Plugin to show a link to the last post from the commenters blog in their comment. Just activate and it's ready. Will parse a feed from most sites that have a feed location specified in its head html. See the <a href="options-general.php?page=commentluv">Settings Page</a> for styling and text output options.
5
+ Version: 2.5.4
6
  Author: Andy Bailey
7
  Author URI: http://www.fiddyp.co.uk/
8
 
10
  You can now edit the options from the dashboard
11
  *********************************************************************
12
  updates:
13
+ 2.5.4 - 6 oct 08 - changed included tip.php so it has curl too. added version number to url for easier remote file functions. and changed commentluv.js to prevent
14
+ double firing of cl_dostuff (Marco Luthe from http://www.saphod.net/ (is a geek!))
15
+ changed tip.php so it can work with curl or iframe so everyone can use it. thanks espen from http://www.espeniversen.com/ for testing
16
  2.5.3 - fix for clicktracking off. needs quotes around the 1 too! prettied up default styling for abbr em and fixed an error with click tracking not adding member id by moving the click function to inline with commentluv.js
17
  2.5.2 - 4 oct 08 - oh dear silly me, forgot to enclose an ==TRUE with quotes. (line 302) heart info box now can be switched off. thanks Ute from http://www.utes-dezines.de for you feedback.
18
  2.5.1 - fix for pesky IE and Chrome
175
  function commentluv_activation(){
176
  // set version for future releases if they need to change a value
177
  $version=get_option('cl_version');
178
+ if($version<254){
179
+ update_option('cl_version','254');
180
  }
181
  }
182
 
231
  commentluv_alter_whitelist_options("");
232
  // Add a new submenu under Options:
233
  add_options_page('CommentLuv', 'CommentLuv', 8, 'commentluv', 'cl_options_page');
234
+ add_option('cl_comment_text','[name]&#8217;s last blog post..[lastpost]');
235
  add_option('cl_default_on','TRUE');
236
  add_option('cl_heart_tip','TRUE');
237
  add_option('cl_style','border:1px solid #ffffff; background-color: #eeeeee; display:block; padding:4px;');
249
  add_option('cl_badge_pos','');
250
  add_option('cl_prepend','');
251
  commentluv_activation();
252
+ add_option('cl_version','254');
253
  add_option('cl_select_text','choose a different post to show');
254
  }
255
 
279
  $comment_selector= (get_option('cl_textarea_type')=="name")? "\"textarea[name='$cl_comment_id']\"" : "'#$cl_comment_id'";
280
  $author_selector= (get_option('cl_author_type')=="name")? "\"input[name='$cl_author_id']\"" : "'#$cl_author_id'";
281
  $url_selector= (get_option('cl_url_type')=="name")? "\"input[name='$cl_site_id']\"" : "'#$cl_site_id'";
282
+ $cl_version=get_option('cl_version');
283
  $cl_comment_text=get_option('cl_comment_text');
284
  $cl_default_on=get_option('cl_default_on');
285
  $cl_badge=get_option('cl_badge');
299
 
300
  // start the javascript output
301
  if(is_single()) {
302
+ echo '<!-- Styling and script added by commentluv 2.5.4 http://www.commentluv.com -->';
303
  echo '<style type="text/css">abbr em{'.get_option('cl_style').'} #lastposts { width: 300px; } </style>';
304
  echo "\n<script type=\"text/javascript\" src=\"".WP_PLUGIN_URL."/commentluv/js/commentluv.js\"></script>";
 
 
 
305
  if(get_option('cl_heart_tip')=="TRUE"){
306
  echo "<link rel=\"stylesheet\" href=\"".WP_PLUGIN_URL."/commentluv/include/tipstyle.css\" type=\"text/css\" />\n";
307
  echo "<script type=\"text/javascript\"><!--//--><![CDATA[//><!--\n";
350
  echo "cl_settings[13]=\"admin\";\n";
351
  }
352
  echo "cl_settings[14]=\"$cl_member_id\";\n";
353
+ echo "cl_settings[15]=\"$cl_version\";\n";
354
  echo "commentluv(cl_settings);\n";
355
 
356
  echo "//--><!]]></script>";
include/tip.php CHANGED
@@ -1,98 +1,27 @@
1
  <?php
2
  // include file for comemntluv to display tooltip for heart icon
3
- class ReadFile{
 
 
 
 
 
 
 
 
 
 
4
 
5
- var $targetFile;
6
- var $error;
7
- var $errorText;
8
- var $data;
9
- var $timeout;
10
-
11
- function ReadFile($targetFile){
12
- //INITIALIZE
13
- $this->targetFile=$targetFile;
14
- $this->error=false;
15
- $this->timeout=10; //TIMEOUT IN SECONDS
16
-
17
- if(!empty($this->targetFile)){
18
- $this->downloadContents();
19
- }
20
- else{
21
- $this->errorText="Filename not specififed in class constuctor";
22
- $this->error=true;
23
- }
24
- }
25
-
26
- function getFileContents(){
27
- if(!$this->hasError()){
28
- return $this->data;
29
- }
30
- return false;
31
- }
32
-
33
- function hasError(){
34
- if($this->error){
35
- return true;
36
- }
37
- return false;
38
- }
39
-
40
- function getError(){
41
- return $this->errorText;
42
- }
43
-
44
- function downloadContents(){
45
- $data=NULL;
46
- //CHECK TO SEE IF WE ARE USING PHP 4.3+
47
- if(function_exists('file_get_contents')){
48
- $this->data=$this->openWithFileGetContents();
49
- }
50
- else{
51
- $this->data=$this->openWithFOpen();
52
- }
53
- }
54
-
55
- function openWithFileGetContents(){
56
- $data=NULL;
57
- //SET TIMEOUT (PHP 4.3+ ONLY)
58
- ini_set('default_socket_timeout', $this->timeout);
59
- //RETRIEVE FILE
60
- if(!$data=@file_get_contents($this->targetFile)){
61
- $this->errorText='file_get_contents of ' . $this->targetFile . ' failed.';
62
- $this->error=true;
63
- }
64
- return $data;
65
- }
66
-
67
- function openWithFOpen(){
68
- $data=NULL;
69
- //RETRIEVE FILE
70
- if($dataFile = @fopen($this->targetFile, "r" )){
71
- while (!feof($dataFile)) {
72
- $data.= fgets($dataFile, 4096);
73
  }
74
- fclose($dataFile);
75
- }
76
- else{
77
- $this->errorText='fopen of ' . $this->targetFile . ' failed.';
78
- $this->error=true;
79
  }
80
- return $data;
81
- }
82
- }
83
-
84
- $url="http://www.commentluv.com/commentluvinc/clplus_tooltip.php?url=".$_GET['url'];
85
- $myReadAccess=new ReadFile($url);
86
-
87
- if(!$data=$myReadAccess->getFileContents()){
88
-
89
- //ERROR, DISPLAY ERROR MESSAGE
90
- echo "Error: " . $myReadAccess->getError();
91
- }
92
- else{
93
-
94
- //SUCCESS, DISPLAY FILE CONTENTS
95
- echo $data;
96
- }
97
 
 
98
  ?>
1
  <?php
2
  // include file for comemntluv to display tooltip for heart icon
3
+ // 6 Oct 08 - added another function for curl if fopen and filegetcontents fail
4
+ // 9 oct 08 - added last resort iframe html if fopen, file_get_contents and cURL fail
5
+ if(function_exists("curl_init")){
6
+ //setup curl values
7
+ $url=$_GET['url'];
8
+ $curl=curl_init();
9
+ curl_setopt($curl,CURLOPT_URL,"http://www.commentluv.com/commentluvinc/clplus_tooltip.php?url=".$url);
10
+ curl_setopt($curl,CURLOPT_HEADER,0);
11
+ curl_setopt($curl,CURLOPT_RETURNTRANSFER,TRUE);
12
+ curl_setopt($curl,CURLOPT_TIMEOUT,7);
13
+ $content=curl_exec($curl);
14
 
15
+ if(!curl_error($curl)){
16
+ $data=$content;
17
+ curl_close($curl);
18
+ } else {
19
+ // can't do curl so echo out iframe html
20
+ $data="<iframe frameborder=0 width=\"360\" height=\"400\" src=\"http://www.commentluv.com/commentluvinc/clplus_tooltip.php?url=".$_GET['url']."\"></iframe>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
+ } else {
23
+ $data="<iframe frameborder=0 width=\"360\" height=\"400\" src=\"http://www.commentluv.com/commentluvinc/clplus_tooltip.php?url=".$_GET['url']."\"></iframe>";
 
 
 
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ echo $data;
27
  ?>
js/commentluv.js CHANGED
@@ -1,7 +1,7 @@
1
  function commentluv(cl_settings){
2
  jQuery(document).ready(function() {
3
  parentformname = jQuery(cl_settings[3]).parents("form").attr("id");
4
- if(!cl_settings[0]){
5
  cl_settings[0]=parentformname;
6
  }
7
  var cl_badge=cl_settings[7];
@@ -11,6 +11,7 @@ function commentluv(cl_settings){
11
  jQuery('#lastposts').hide();
12
  if(cl_settings[10]=="1"){
13
  var cl_member_id=cl_settings[14];
 
14
  jQuery('abbr em a').click(function(){
15
  var url=jQuery(this).attr('href');
16
  var thelinkobj=jQuery(this);
@@ -34,9 +35,10 @@ function commentluv(cl_settings){
34
  jQuery('#cl_post').val('<a href="' + url + '">' + title + '</a>');
35
  });
36
  jQuery(cl_settings[2]).change(function(){
37
- if(jQuery('#luv').is(":checked")){
38
  jQuery('#lastposts').empty();
39
- jQuery(cl_settings[3]).bind('focus',cl_dostuff(cl_settings));
 
40
  }
41
  });
42
  jQuery('#luv').click(function(){
@@ -60,7 +62,7 @@ function commentluv(cl_settings){
60
  if(!check || !jQuery('#luv').is(":checked") || cl_settings[13]) { return }
61
  var xyz=jQuery(cl_settings[2]).val();
62
  var name=jQuery(cl_settings[1]).val();
63
- var url="http://www.commentluv.com/commentluvinc/ajaxcl821.php?url="+xyz+"&callback=?";
64
  jQuery.getJSON(url,function(data){
65
  jQuery.each(data.links, function(i,item){
66
  jQuery('#lastposts').append('<option value="'+data.links[i].url+'">'+data.links[i].title+'</option>');
1
  function commentluv(cl_settings){
2
  jQuery(document).ready(function() {
3
  parentformname = jQuery(cl_settings[3]).parents("form").attr("id");
4
+ if(cl_settings[0]==""){
5
  cl_settings[0]=parentformname;
6
  }
7
  var cl_badge=cl_settings[7];
11
  jQuery('#lastposts').hide();
12
  if(cl_settings[10]=="1"){
13
  var cl_member_id=cl_settings[14];
14
+ var cl_version=cl_settings[15];
15
  jQuery('abbr em a').click(function(){
16
  var url=jQuery(this).attr('href');
17
  var thelinkobj=jQuery(this);
35
  jQuery('#cl_post').val('<a href="' + url + '">' + title + '</a>');
36
  });
37
  jQuery(cl_settings[2]).change(function(){
38
+ if(jQuery('#luv').is(":checked") && jQuery('#cl_post').val()!=""){
39
  jQuery('#lastposts').empty();
40
+ cl_dostuff(cl_settings);
41
+ //jQuery(cl_settings[3]).bind('focus',cl_dostuff(cl_settings));
42
  }
43
  });
44
  jQuery('#luv').click(function(){
62
  if(!check || !jQuery('#luv').is(":checked") || cl_settings[13]) { return }
63
  var xyz=jQuery(cl_settings[2]).val();
64
  var name=jQuery(cl_settings[1]).val();
65
+ var url="http://www.commentluv.com/commentluvinc/ajaxcl8254.php?url="+xyz+"&version=" + cl_version +"&callback=?";
66
  jQuery.getJSON(url,function(data){
67
  jQuery.each(data.links, function(i,item){
68
  jQuery('#lastposts').append('<option value="'+data.links[i].url+'">'+data.links[i].title+'</option>');
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Andy Bailey
3
  Tags: comments, linkluv
4
  Requires at least: 2.5
5
  Tested up to: 2.6.2
6
- Stable tag: 2.5.3
7
 
8
  Appends a titled link using AJAX to the authors last blog post on their comment giving back some luv to the people that join your discussion. Compatible with logged on users and Wordpress MU. Visit CommentLuv.com for detailed instructions on features.
9
 
3
  Tags: comments, linkluv
4
  Requires at least: 2.5
5
  Tested up to: 2.6.2
6
+ Stable tag: 2.5.4
7
 
8
  Appends a titled link using AJAX to the authors last blog post on their comment giving back some luv to the people that join your discussion. Compatible with logged on users and Wordpress MU. Visit CommentLuv.com for detailed instructions on features.
9