Shortlinks by Pretty Links – Best WordPress Link Tracking Plugin - Version 1.4.53

Version Description

  • Added the ability to change the pretty link tracking mode to simple, normal and extended
  • Fixed numerous debug issues
  • Fixed memory_limit issue in pretty link
  • Fixed pretty bar issue affecting pro users
Download this release

Release Info

Developer supercleanse
Plugin Icon 128x128 Shortlinks by Pretty Links – Best WordPress Link Tracking Plugin
Version 1.4.53
Comparing to
See all releases

Code changes from version 1.4.52 to 1.4.53

classes/models/PrliClick.php CHANGED
@@ -183,6 +183,7 @@ class PrliClick
183
  {
184
  global $wpdb, $prli_link;
185
 
 
186
  $query = "SELECT DATE(cl.created_at) as cldate,COUNT(*) as clcount FROM ".$this->table_name." cl WHERE cl.created_at BETWEEN '".date("Y-n-j",$start_timestamp)." 00:00:00' AND '".date("Y-n-j",$end_timestamp)." 23:59:59'".$search_where.$this->get_exclude_where_clause( ' AND' );
187
 
188
  if($link_id != "all")
183
  {
184
  global $wpdb, $prli_link;
185
 
186
+ $search_where = '';
187
  $query = "SELECT DATE(cl.created_at) as cldate,COUNT(*) as clcount FROM ".$this->table_name." cl WHERE cl.created_at BETWEEN '".date("Y-n-j",$start_timestamp)." 00:00:00' AND '".date("Y-n-j",$end_timestamp)." 23:59:59'".$search_where.$this->get_exclude_where_clause( ' AND' );
188
 
189
  if($link_id != "all")
classes/models/PrliLink.php CHANGED
@@ -74,13 +74,13 @@ class PrliLink
74
  ' WHERE id=%d';
75
 
76
  $query = $wpdb->prepare( $query_str,
77
- $values['url'],
78
- $values['slug'],
79
- $values['name'],
80
- $values['param_forwarding'],
81
- $values['param_struct'],
82
- $values['redirect_type'],
83
- $values['description'],
84
  (int)isset($values['track_me']),
85
  (int)isset($values['nofollow']),
86
  (isset($values['group_id'])?(int)$values['group_id']:'NULL'),
@@ -123,38 +123,70 @@ class PrliLink
123
 
124
  function getOneFromSlug( $slug, $return_type = OBJECT, $include_stats = false )
125
  {
126
- global $wpdb, $prli_click;
127
  if($include_stats)
128
- $query = 'SELECT li.*, ' .
129
- '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
 
 
 
130
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
131
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
132
  'WHERE cl.link_id = li.id ' .
133
- 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques ' .
134
- "FROM {$this->table_name} li " .
135
- 'WHERE slug=%s';
 
 
 
 
 
 
 
 
 
136
  else
137
  $query = "SELECT * FROM {$this->table_name} WHERE slug=%s";
138
 
139
  $query = $wpdb->prepare($query, $slug);
140
- return $wpdb->get_row($query, $return_type);
 
 
 
 
 
 
 
 
141
  }
142
 
143
  function getOne( $id, $return_type = OBJECT, $include_stats = false )
144
  {
145
- global $wpdb, $prli_click;
146
  if( !isset($id) or empty($id) )
147
  return false;
148
 
149
  if($include_stats)
150
- $query = 'SELECT li.*, ' .
151
- '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
 
 
 
152
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
153
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
154
  'WHERE cl.link_id = li.id ' .
155
- 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques ' .
156
- 'FROM ' . $this->table_name . ' li ' .
157
- 'WHERE id=%d';
 
 
 
 
 
 
 
 
 
158
  else
159
  $query = "SELECT * FROM {$this->table_name} WHERE id=%d";
160
 
@@ -191,7 +223,7 @@ class PrliLink
191
  return $pretty_link;
192
  }
193
 
194
- function &is_pretty_link($url, $check_domain=true)
195
  {
196
  global $prli_blogurl;
197
 
@@ -211,7 +243,7 @@ class PrliLink
211
  if(preg_match($match_str, $uri, $match_val))
212
  {
213
  // Match longest slug -- this is the most common
214
- $params = $match_val[3];
215
  if( $pretty_link_found =& $this->is_pretty_link_slug( $match_val[2] ) )
216
  return compact('pretty_link_found','pretty_link_params');
217
 
@@ -227,7 +259,7 @@ class PrliLink
227
  {
228
  $new_match_str ="#^{$subdir_str}({$struct})({$matched_link})(.*?)?$#";
229
 
230
- $params = $match_val[3];
231
  if( $pretty_link_found =& $this->is_pretty_link_slug( $match_val[2] ) )
232
  return compact('pretty_link_found','pretty_link_params');
233
 
@@ -240,7 +272,7 @@ class PrliLink
240
  return false;
241
  }
242
 
243
- function &is_pretty_link_slug($slug)
244
  {
245
  return $this->getOneFromSlug( urldecode($slug) );
246
  }
@@ -255,23 +287,37 @@ class PrliLink
255
 
256
  function getAll($where = '', $order_by = '', $return_type = OBJECT, $include_stats = false)
257
  {
258
- global $wpdb, $prli_click, $prli_group, $prli_utils;
259
 
260
  if($include_stats)
261
- $query = 'SELECT li.*, ' .
262
- '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
 
 
 
263
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
264
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
265
  'WHERE cl.link_id = li.id ' .
266
- 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques, ' .
267
- 'gr.name as group_name ' .
 
 
 
 
 
 
 
 
268
  'FROM '. $this->table_name . ' li ' .
269
  'LEFT OUTER JOIN ' . $prli_group->table_name . ' gr ON li.group_id=gr.id' .
270
  $prli_utils->prepend_and_or_where(' WHERE', $where) . $order_by;
 
271
  else
 
272
  $query = "SELECT li.*, gr.name as group_name FROM {$this->table_name} li " .
273
  'LEFT OUTER JOIN ' . $prli_group->table_name . ' gr ON li.group_id=gr.id' .
274
  $prli_utils->prepend_and_or_where(' WHERE', $where) . $order_by;
 
275
 
276
  return $wpdb->get_results($query, $return_type);
277
  }
@@ -291,16 +337,26 @@ class PrliLink
291
 
292
  function getPage($current_p,$p_size, $where = "", $order_by = '', $return_type = OBJECT)
293
  {
294
- global $wpdb, $prli_click, $prli_utils, $prli_group;
295
  $end_index = $current_p * $p_size;
296
  $start_index = $end_index - $p_size;
297
- $query = 'SELECT li.*, ' .
298
- '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
 
 
299
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
300
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
301
  'WHERE cl.link_id = li.id ' .
302
- 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques, ' .
303
- 'gr.name as group_name ' .
 
 
 
 
 
 
 
 
304
  'FROM ' . $this->table_name . ' li ' .
305
  'LEFT OUTER JOIN ' . $prli_group->table_name . ' gr ON li.group_id=gr.id' .
306
  $prli_utils->prepend_and_or_where(' WHERE', $where) . $order_by . ' ' .
74
  ' WHERE id=%d';
75
 
76
  $query = $wpdb->prepare( $query_str,
77
+ isset($values['url'])?$values['url']:'',
78
+ isset($values['slug'])?$values['slug']:'',
79
+ isset($values['name'])?$values['name']:'',
80
+ isset($values['param_forwarding'])?$values['param_forwarding']:'',
81
+ isset($values['param_struct'])?$values['param_struct']:'',
82
+ isset($values['redirect_type'])?$values['redirect_type']:'',
83
+ isset($values['description'])?$values['description']:'',
84
  (int)isset($values['track_me']),
85
  (int)isset($values['nofollow']),
86
  (isset($values['group_id'])?(int)$values['group_id']:'NULL'),
123
 
124
  function getOneFromSlug( $slug, $return_type = OBJECT, $include_stats = false )
125
  {
126
+ global $wpdb, $prli_click, $prli_options, $prli_link_meta;
127
  if($include_stats)
128
+ {
129
+ $query = 'SELECT li.*, ';
130
+ if($prli_options->extended_tracking != 'count')
131
+ {
132
+ $query .= '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
133
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
134
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
135
  'WHERE cl.link_id = li.id ' .
136
+ 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques ';
137
+ }
138
+ else
139
+ {
140
+ $query .= '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
141
+ 'WHERE lm.meta_key="static-clicks" AND lm.link_id=li.id LIMIT 1) as clicks, ' .
142
+ '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
143
+ 'WHERE lm.meta_key="static-uniques" AND lm.link_id=li.id LIMIT 1) as uniques ';
144
+ }
145
+ $query .= "FROM {$this->table_name} li " .
146
+ 'WHERE slug=%s';
147
+ }
148
  else
149
  $query = "SELECT * FROM {$this->table_name} WHERE slug=%s";
150
 
151
  $query = $wpdb->prepare($query, $slug);
152
+ $link = $wpdb->get_row($query, $return_type);
153
+
154
+ if( $include_stats and $link and $prli_options->extended_tracking == 'count' )
155
+ {
156
+ $link->clicks = $prli_link_meta->get_link_meta($link->id,'static-clicks',true);
157
+ $link->uniques = $prli_link_meta->get_link_meta($link->id,'static-uniques',true);
158
+ }
159
+
160
+ return $link;
161
  }
162
 
163
  function getOne( $id, $return_type = OBJECT, $include_stats = false )
164
  {
165
+ global $wpdb, $prli_click, $prli_link_meta, $prli_options;
166
  if( !isset($id) or empty($id) )
167
  return false;
168
 
169
  if($include_stats)
170
+ {
171
+ $query = 'SELECT li.*, ';
172
+ if($prli_options->extended_tracking != 'count')
173
+ {
174
+ $query .= '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
175
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
176
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
177
  'WHERE cl.link_id = li.id ' .
178
+ 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques ';
179
+ }
180
+ else
181
+ {
182
+ $query .= '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
183
+ 'WHERE lm.meta_key="static-clicks" AND lm.link_id=li.id LIMIT 1) as clicks, ' .
184
+ '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
185
+ 'WHERE lm.meta_key="static-uniques" AND lm.link_id=li.id LIMIT 1) as uniques ';
186
+ }
187
+ $query .= 'FROM ' . $this->table_name . ' li ' .
188
+ 'WHERE id=%d';
189
+ }
190
  else
191
  $query = "SELECT * FROM {$this->table_name} WHERE id=%d";
192
 
223
  return $pretty_link;
224
  }
225
 
226
+ function is_pretty_link($url, $check_domain=true)
227
  {
228
  global $prli_blogurl;
229
 
243
  if(preg_match($match_str, $uri, $match_val))
244
  {
245
  // Match longest slug -- this is the most common
246
+ $params = (isset($match_val[3])?$match_val[3]:'');
247
  if( $pretty_link_found =& $this->is_pretty_link_slug( $match_val[2] ) )
248
  return compact('pretty_link_found','pretty_link_params');
249
 
259
  {
260
  $new_match_str ="#^{$subdir_str}({$struct})({$matched_link})(.*?)?$#";
261
 
262
+ $params = (isset($match_val[3])?$match_val:'');
263
  if( $pretty_link_found =& $this->is_pretty_link_slug( $match_val[2] ) )
264
  return compact('pretty_link_found','pretty_link_params');
265
 
272
  return false;
273
  }
274
 
275
+ function is_pretty_link_slug($slug)
276
  {
277
  return $this->getOneFromSlug( urldecode($slug) );
278
  }
287
 
288
  function getAll($where = '', $order_by = '', $return_type = OBJECT, $include_stats = false)
289
  {
290
+ global $wpdb, $prli_click, $prli_group, $prli_link_meta, $prli_options, $prli_utils;
291
 
292
  if($include_stats)
293
+ {
294
+ $query = 'SELECT li.*, ';
295
+ if($prli_options->extended_tracking != 'count')
296
+ {
297
+ $query .= '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
298
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
299
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
300
  'WHERE cl.link_id = li.id ' .
301
+ 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques, ';
302
+ }
303
+ else
304
+ {
305
+ $query .= '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
306
+ 'WHERE lm.meta_key="static-clicks" AND lm.link_id=li.id LIMIT 1) as clicks, ' .
307
+ '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
308
+ 'WHERE lm.meta_key="static-uniques" AND lm.link_id=li.id LIMIT 1) as uniques, ';
309
+ }
310
+ $query .= 'gr.name as group_name ' .
311
  'FROM '. $this->table_name . ' li ' .
312
  'LEFT OUTER JOIN ' . $prli_group->table_name . ' gr ON li.group_id=gr.id' .
313
  $prli_utils->prepend_and_or_where(' WHERE', $where) . $order_by;
314
+ }
315
  else
316
+ {
317
  $query = "SELECT li.*, gr.name as group_name FROM {$this->table_name} li " .
318
  'LEFT OUTER JOIN ' . $prli_group->table_name . ' gr ON li.group_id=gr.id' .
319
  $prli_utils->prepend_and_or_where(' WHERE', $where) . $order_by;
320
+ }
321
 
322
  return $wpdb->get_results($query, $return_type);
323
  }
337
 
338
  function getPage($current_p,$p_size, $where = "", $order_by = '', $return_type = OBJECT)
339
  {
340
+ global $wpdb, $prli_click, $prli_utils, $prli_group, $prli_link_meta, $prli_options;
341
  $end_index = $current_p * $p_size;
342
  $start_index = $end_index - $p_size;
343
+ $query = 'SELECT li.*, ';
344
+ if($prli_options->extended_tracking != 'count')
345
+ {
346
+ $query .= '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
347
  'WHERE cl.link_id = li.id' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as clicks, ' .
348
  '(SELECT COUNT(*) FROM ' . $prli_click->table_name . ' cl ' .
349
  'WHERE cl.link_id = li.id ' .
350
+ 'AND cl.first_click <> 0' . $prli_click->get_exclude_where_clause( ' AND' ) . ') as uniques, ';
351
+ }
352
+ else
353
+ {
354
+ $query .= '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
355
+ 'WHERE lm.meta_key="static-clicks" AND lm.link_id=li.id LIMIT 1) as clicks, ' .
356
+ '(SELECT lm.meta_value FROM ' . $prli_link_meta->table_name . ' lm ' .
357
+ 'WHERE lm.meta_key="static-uniques" AND lm.link_id=li.id LIMIT 1) as uniques, ';
358
+ }
359
+ $query .= 'gr.name as group_name ' .
360
  'FROM ' . $this->table_name . ' li ' .
361
  'LEFT OUTER JOIN ' . $prli_group->table_name . ' gr ON li.group_id=gr.id' .
362
  $prli_utils->prepend_and_or_where(' WHERE', $where) . $order_by . ' ' .
classes/models/PrliOptions.php CHANGED
@@ -4,6 +4,7 @@ class PrliOptions
4
  var $prli_exclude_ips;
5
  var $whitelist_ips;
6
  var $filter_robots;
 
7
  var $prettybar_image_url;
8
  var $prettybar_background_image_url;
9
  var $prettybar_color;
@@ -266,6 +267,9 @@ class PrliOptions
266
 
267
  if(!isset($this->filter_robots))
268
  $this->filter_robots = 0;
 
 
 
269
  }
270
  }
271
  ?>
4
  var $prli_exclude_ips;
5
  var $whitelist_ips;
6
  var $filter_robots;
7
+ var $extended_tracking;
8
  var $prettybar_image_url;
9
  var $prettybar_background_image_url;
10
  var $prettybar_color;
267
 
268
  if(!isset($this->filter_robots))
269
  $this->filter_robots = 0;
270
+
271
+ if(!isset($this->extended_tracking))
272
+ $this->extended_tracking = 'normal';
273
  }
274
  }
275
  ?>
classes/models/PrliUtils.php CHANGED
@@ -205,7 +205,7 @@ class PrliUtils
205
  // This is where the magic happens!
206
  function track_link($slug,$values)
207
  {
208
- global $wpdb, $prli_click, $prli_link, $prli_update;
209
 
210
  $query = "SELECT * FROM ".$prli_link->table_name." WHERE slug='$slug' LIMIT 1";
211
  $pretty_link = $wpdb->get_row($query);
@@ -216,57 +216,87 @@ class PrliUtils
216
  {
217
  $first_click = 0;
218
 
219
- $click_ip = $_SERVER['REMOTE_ADDR'];
220
- $click_referer = $_SERVER['HTTP_REFERER'];
221
- $click_host = gethostbyaddr($click_ip);
222
-
223
- $click_uri = $_SERVER['REQUEST_URI'];
224
- $click_user_agent = $_SERVER['HTTP_USER_AGENT'];
225
- $click_browser = $this->php_get_browser();
226
-
227
  //Set Cookie if it doesn't exist
228
  $cookie_name = 'prli_click_' . $pretty_link->id;
 
229
  //Used for unique click tracking
230
  $cookie_expire_time = time()+60*60*24*30; // Expire in 30 days
231
-
232
- $visitor_cookie = 'prli_visitor';
233
- //Used for visitor activity
234
- $visitor_cookie_expire_time = time()+60*60*24*365; // Expire in 1 year
235
-
236
 
237
- if($_COOKIE[$cookie_name] == null)
238
  {
239
  setcookie($cookie_name,$slug,$cookie_expire_time,'/');
240
  $first_click = 1;
241
  }
242
 
243
- // Retrieve / Generate visitor id
244
- if($_COOKIE[$visitor_cookie] == null)
245
  {
246
- $visitor_uid = $prli_click->generateUniqueVisitorId();
247
- setcookie($visitor_cookie,$visitor_uid,$visitor_cookie_expire_time,'/');
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  }
249
  else
250
- $visitor_uid = $_COOKIE[$visitor_cookie];
251
-
252
- //Record Click in DB
253
- $insert_str = "INSERT INTO {$prli_click->table_name} (link_id,vuid,ip,browser,btype,bversion,os,referer,uri,host,first_click,robot,created_at) VALUES (%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d,%d,NOW())";
254
- $insert = $wpdb->prepare($insert_str, $pretty_link->id,
255
- $visitor_uid,
256
- $click_ip,
257
- $click_user_agent,
258
- $click_browser['browser'],
259
- $click_browser['version'],
260
- $click_browser['platform'],
261
- $click_referer,
262
- $click_uri,
263
- $click_host,
264
- $first_click,
265
- $this->this_is_a_robot($click_user_agent,$click_browser));
266
-
267
- $results = $wpdb->query( $insert );
268
 
269
- do_action('prli_record_click',array('link_id' => $pretty_link->id, 'click_id' => $wpdb->insert_id, 'url' => $pretty_link_url));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
271
 
272
  // Reformat Parameters
@@ -309,7 +339,7 @@ class PrliUtils
309
  header('Location: '.$pretty_link_url.$param_string);
310
  }
311
  else
312
- do_action('prli_issue_cloaked_redirect', $pretty_link->redirect_type, $pretty_link_url, $param_string);
313
  }
314
  }
315
 
@@ -1028,7 +1058,7 @@ class PrliUtils
1028
 
1029
  function is_robot(&$click,&$browsecap,$header='')
1030
  {
1031
- global $prli_utils, $prli_click;
1032
  $ua_string = trim(urldecode($click->browser));
1033
  $btype = trim($click->btype);
1034
 
@@ -1036,8 +1066,11 @@ class PrliUtils
1036
  if(empty($ua_string))
1037
  return 1;
1038
 
1039
- // If the Browser type was unidentifiable then it's most likely a bot
1040
- if(empty($btype))
 
 
 
1041
  return 1;
1042
 
1043
  // Some bots actually say they're bots right up front let's get rid of them asap
@@ -1114,7 +1147,7 @@ class PrliUtils
1114
  {
1115
  if( isset($post_id) and !empty($post_id) and
1116
  $post_id and is_numeric($post_id) )
1117
- return delete_post_meta($post_id, $key, $meta_value);
1118
  else
1119
  return false;
1120
  }
205
  // This is where the magic happens!
206
  function track_link($slug,$values)
207
  {
208
+ global $wpdb, $prli_click, $prli_options, $prli_link, $prli_update;
209
 
210
  $query = "SELECT * FROM ".$prli_link->table_name." WHERE slug='$slug' LIMIT 1";
211
  $pretty_link = $wpdb->get_row($query);
216
  {
217
  $first_click = 0;
218
 
219
+ $click_ip = isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:'';
220
+ $click_referer = isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'';
221
+ $click_uri = isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'';
222
+ $click_user_agent = isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:'';
223
+
 
 
 
224
  //Set Cookie if it doesn't exist
225
  $cookie_name = 'prli_click_' . $pretty_link->id;
226
+
227
  //Used for unique click tracking
228
  $cookie_expire_time = time()+60*60*24*30; // Expire in 30 days
 
 
 
 
 
229
 
230
+ if(!isset($_COOKIE[$cookie_name]))
231
  {
232
  setcookie($cookie_name,$slug,$cookie_expire_time,'/');
233
  $first_click = 1;
234
  }
235
 
236
+ if(isset($prli_options->extended_tracking) and $prli_options->extended_tracking == 'extended')
 
237
  {
238
+ $click_browser = $this->php_get_browser();
239
+ $click_host = gethostbyaddr($click_ip);
240
+
241
+ $visitor_cookie = 'prli_visitor';
242
+ //Used for visitor activity
243
+ $visitor_cookie_expire_time = time()+60*60*24*365; // Expire in 1 year
244
+
245
+ // Retrieve / Generate visitor id
246
+ if($_COOKIE[$visitor_cookie] == null)
247
+ {
248
+ $visitor_uid = $prli_click->generateUniqueVisitorId();
249
+ setcookie($visitor_cookie,$visitor_uid,$visitor_cookie_expire_time,'/');
250
+ }
251
+ else
252
+ $visitor_uid = $_COOKIE[$visitor_cookie];
253
  }
254
  else
255
+ {
256
+ $click_browser = array( 'browser' => '', 'version' => '', 'platform' => '', 'crawler' => '' );
257
+ $click_host = '';
258
+ $visitor_uid = '';
259
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
260
 
261
+ if($prli_options->extended_tracking != 'count')
262
+ {
263
+ //Record Click in DB
264
+ $insert_str = "INSERT INTO {$prli_click->table_name} (link_id,vuid,ip,browser,btype,bversion,os,referer,uri,host,first_click,robot,created_at) VALUES (%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%d,%d,NOW())";
265
+ $insert = $wpdb->prepare($insert_str, $pretty_link->id,
266
+ $visitor_uid,
267
+ $click_ip,
268
+ $click_user_agent,
269
+ $click_browser['browser'],
270
+ $click_browser['version'],
271
+ $click_browser['platform'],
272
+ $click_referer,
273
+ $click_uri,
274
+ $click_host,
275
+ $first_click,
276
+ $this->this_is_a_robot($click_user_agent,$click_browser));
277
+
278
+ $results = $wpdb->query( $insert );
279
+
280
+ do_action('prli_record_click',array('link_id' => $pretty_link->id, 'click_id' => $wpdb->insert_id, 'url' => $pretty_link_url));
281
+ }
282
+ else
283
+ {
284
+ global $prli_link_meta;
285
+ $exclude_ips = explode(",", $prli_options->prli_exclude_ips);
286
+ if(!in_array($click_ip, $exclude_ips) and !$this->this_is_a_robot($click_user_agent,$click_browser))
287
+ {
288
+ $clicks = $prli_link_meta->get_link_meta($pretty_link->id, 'static-clicks', true);
289
+ $clicks = (empty($clicks) or $clicks === false)?0:$clicks;
290
+ $prli_link_meta->update_link_meta($pretty_link->id, 'static-clicks', $clicks+1);
291
+
292
+ if($first_click)
293
+ {
294
+ $uniques = $prli_link_meta->get_link_meta($pretty_link->id, 'static-uniques', true);
295
+ $uniques = (empty($uniques) or $uniques === false)?0:$uniques;
296
+ $prli_link_meta->update_link_meta($pretty_link->id, 'static-uniques', $uniques+1);
297
+ }
298
+ }
299
+ }
300
  }
301
 
302
  // Reformat Parameters
339
  header('Location: '.$pretty_link_url.$param_string);
340
  }
341
  else
342
+ do_action('prli_issue_cloaked_redirect', $pretty_link->redirect_type, $pretty_link, $pretty_link_url, $param_string);
343
  }
344
  }
345
 
1058
 
1059
  function is_robot(&$click,&$browsecap,$header='')
1060
  {
1061
+ global $prli_utils, $prli_click, $prli_options;
1062
  $ua_string = trim(urldecode($click->browser));
1063
  $btype = trim($click->btype);
1064
 
1066
  if(empty($ua_string))
1067
  return 1;
1068
 
1069
+ // If we're doing extended tracking and the Browser type
1070
+ // was unidentifiable then it's most likely a bot
1071
+ if( isset($prli_options->extended_tracking) and
1072
+ $prli_options->extended_tracking == 'extended' and
1073
+ empty($btype) )
1074
  return 1;
1075
 
1076
  // Some bots actually say they're bots right up front let's get rid of them asap
1147
  {
1148
  if( isset($post_id) and !empty($post_id) and
1149
  $post_id and is_numeric($post_id) )
1150
+ return delete_post_meta($post_id, $key);
1151
  else
1152
  return false;
1153
  }
classes/views/prli-clicks/list.php CHANGED
@@ -74,20 +74,26 @@
74
  <table class="widefat post fixed" cellspacing="0">
75
  <thead>
76
  <tr>
 
77
  <th class="manage-column" width="5%"><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=btype<?php echo (($sort_str == 'btype' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Browser<?php echo (($sort_str == 'btype')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
78
  </th>
 
79
  <th class="manage-column" width="12%">
80
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=ip<?php echo (($sort_str == 'ip' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">IP<?php echo (($sort_str == 'ip')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
81
  </th>
 
82
  <th class="manage-column" width="12%">
83
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=vuid<?php echo (($sort_str == 'vuid' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Visitor<?php echo (($sort_str == 'vuid')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
84
  </th>
 
85
  <th class="manage-column" width="13%">
86
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=created_at<?php echo (($sort_str == 'created_at' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Timestamp<?php echo ((empty($sort_str) or $sort_str == 'created_at')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.((empty($sort_str) or $sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
87
  </th>
 
88
  <th class="manage-column" width="16%">
89
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=host<?php echo (($sort_str == 'host' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Host<?php echo (($sort_str == 'host')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
90
  </th>
 
91
  <th class="manage-column" width="16%">
92
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=uri<?php echo (($sort_str == 'uri' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">URI<?php echo (($sort_str == 'uri')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
93
  </th>
@@ -115,11 +121,17 @@
115
  {
116
  ?>
117
  <tr>
 
118
  <td><img src="http://d14715w921jdje.cloudfront.net/browser/<?php echo prli_browser_image($click->btype); ?>" alt="<?php echo $click->btype . " v" . $click->bversion; ?>" title="<?php echo $click->btype . " v" . $click->bversion; ?>"/>&nbsp;<img src="http://d14715w921jdje.cloudfront.net/os/<?php echo prli_os_image($click->os); ?>" alt="<?php echo $click->os; ?>" title="<?php echo $click->os; ?>"/></td>
 
119
  <td><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php&ip=<?php echo $click->ip; ?>" title="View All Activity for IP Address: <?php echo $click->ip; ?>"><?php echo $click->ip; ?> (<?php echo $click->ip_count; ?>)</a></td>
 
120
  <td><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php&vuid=<?php echo $click->vuid; ?>" title="View All Activity for Visitor: <?php echo $click->vuid; ?>"><?php echo $click->vuid; ?><?php echo (($click->vuid != null)?" ($click->vuid_count)":''); ?></a></td>
 
121
  <td><?php echo $click->created_at; ?></td>
 
122
  <td><?php echo $click->host; ?></td>
 
123
  <td><?php echo $click->uri; ?></td>
124
  <td><?php echo $click->referer; ?></td>
125
  <td><a href="?page=<?php print PRLI_PLUGIN_NAME; ?>/prli-clicks.php&l=<?php echo $click->link_id; ?>" title="View clicks for <?php echo stripslashes($click->link_name); ?>"><?php echo stripslashes($click->link_name); ?></a></td>
@@ -130,11 +142,17 @@
130
  ?>
131
  <tfoot>
132
  <tr>
 
133
  <th class="manage-column">Browser</th>
 
134
  <th class="manage-column">IP</th>
 
135
  <th class="manage-column">Visitor</th>
 
136
  <th class="manage-column">Timestamp</th>
 
137
  <th class="manage-column">Host</th>
 
138
  <th class="manage-column">URI</th>
139
  <th class="manage-column">Referrer</th>
140
  <th class="manage-column">Link</th>
74
  <table class="widefat post fixed" cellspacing="0">
75
  <thead>
76
  <tr>
77
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
78
  <th class="manage-column" width="5%"><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=btype<?php echo (($sort_str == 'btype' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Browser<?php echo (($sort_str == 'btype')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
79
  </th>
80
+ <?php } ?>
81
  <th class="manage-column" width="12%">
82
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=ip<?php echo (($sort_str == 'ip' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">IP<?php echo (($sort_str == 'ip')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
83
  </th>
84
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
85
  <th class="manage-column" width="12%">
86
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=vuid<?php echo (($sort_str == 'vuid' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Visitor<?php echo (($sort_str == 'vuid')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
87
  </th>
88
+ <?php } ?>
89
  <th class="manage-column" width="13%">
90
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=created_at<?php echo (($sort_str == 'created_at' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Timestamp<?php echo ((empty($sort_str) or $sort_str == 'created_at')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.((empty($sort_str) or $sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
91
  </th>
92
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
93
  <th class="manage-column" width="16%">
94
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=host<?php echo (($sort_str == 'host' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">Host<?php echo (($sort_str == 'host')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
95
  </th>
96
+ <?php } ?>
97
  <th class="manage-column" width="16%">
98
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php<?php echo $sort_params; ?>&sort=uri<?php echo (($sort_str == 'uri' and $sdir_str == 'asc')?'&sdir=desc':''); ?>">URI<?php echo (($sort_str == 'uri')?'&nbsp;&nbsp;&nbsp;<img src="'.PRLI_URL.'/images/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png').'"/>':'') ?></a>
99
  </th>
121
  {
122
  ?>
123
  <tr>
124
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
125
  <td><img src="http://d14715w921jdje.cloudfront.net/browser/<?php echo prli_browser_image($click->btype); ?>" alt="<?php echo $click->btype . " v" . $click->bversion; ?>" title="<?php echo $click->btype . " v" . $click->bversion; ?>"/>&nbsp;<img src="http://d14715w921jdje.cloudfront.net/os/<?php echo prli_os_image($click->os); ?>" alt="<?php echo $click->os; ?>" title="<?php echo $click->os; ?>"/></td>
126
+ <?php } ?>
127
  <td><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php&ip=<?php echo $click->ip; ?>" title="View All Activity for IP Address: <?php echo $click->ip; ?>"><?php echo $click->ip; ?> (<?php echo $click->ip_count; ?>)</a></td>
128
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
129
  <td><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php&vuid=<?php echo $click->vuid; ?>" title="View All Activity for Visitor: <?php echo $click->vuid; ?>"><?php echo $click->vuid; ?><?php echo (($click->vuid != null)?" ($click->vuid_count)":''); ?></a></td>
130
+ <?php } ?>
131
  <td><?php echo $click->created_at; ?></td>
132
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
133
  <td><?php echo $click->host; ?></td>
134
+ <?php } ?>
135
  <td><?php echo $click->uri; ?></td>
136
  <td><?php echo $click->referer; ?></td>
137
  <td><a href="?page=<?php print PRLI_PLUGIN_NAME; ?>/prli-clicks.php&l=<?php echo $click->link_id; ?>" title="View clicks for <?php echo stripslashes($click->link_name); ?>"><?php echo stripslashes($click->link_name); ?></a></td>
142
  ?>
143
  <tfoot>
144
  <tr>
145
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
146
  <th class="manage-column">Browser</th>
147
+ <?php } ?>
148
  <th class="manage-column">IP</th>
149
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
150
  <th class="manage-column">Visitor</th>
151
+ <?php } ?>
152
  <th class="manage-column">Timestamp</th>
153
+ <?php if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking == "extended" ) { ?>
154
  <th class="manage-column">Host</th>
155
+ <?php } ?>
156
  <th class="manage-column">URI</th>
157
  <th class="manage-column">Referrer</th>
158
  <th class="manage-column">Link</th>
classes/views/prli-links/list.php CHANGED
@@ -135,7 +135,7 @@
135
  <div class="link_actions">
136
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&action=edit&id=<?php echo $link->id; ?>" title="Edit <?php echo $link->slug; ?>">Edit</a>&nbsp;|
137
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&action=destroy&id=<?php echo $link->id; ?>" onclick="return confirm('Are you sure you want to delete your <?php echo $link->name; ?> Pretty Link? This will delete the Pretty Link and all of the statistical data about it in your database.');" title="Delete <?php echo $link->slug; ?>">Delete</a>
138
- <?php if( $link->track_me ) { ?>
139
  |&nbsp;<a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&action=reset&id=<?php echo $link->id; ?>" onclick="return confirm('Are you sure you want to reset your <?php echo $link->name; ?> Pretty Link? This will delete all of the statistical data about this Pretty Link in your database.');" title="Reset <?php echo $link->name; ?>">Reset</a>&nbsp;|
140
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php&l=<?php echo $link->id; ?>" title="View clicks for <?php echo $link->slug; ?>">Hits</a>
141
  <?php do_action('prli-link-action',$link->id); ?>
@@ -151,7 +151,13 @@
151
  </div>
152
  </td>
153
  <?php do_action('prli_link_column_row',$link->id); ?>
154
- <td><?php echo (($link->track_me)?"<a href=\"?page=".PRLI_PLUGIN_NAME."/prli-clicks.php&l=$link->id\" title=\"View clicks for $link->slug\">$link->clicks/$link->uniques</a>":"<img src=\"".PRLI_URL."/images/not_tracking.png\" title=\"This link isn't being tracked\"/>"); ?></td>
 
 
 
 
 
 
155
  <td><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&group=<?php echo $link->group_id; ?>"><?php echo $link->group_name; ?></a></td>
156
  <td><?php echo $link->created_at; ?></td>
157
  </td>
135
  <div class="link_actions">
136
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&action=edit&id=<?php echo $link->id; ?>" title="Edit <?php echo $link->slug; ?>">Edit</a>&nbsp;|
137
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&action=destroy&id=<?php echo $link->id; ?>" onclick="return confirm('Are you sure you want to delete your <?php echo $link->name; ?> Pretty Link? This will delete the Pretty Link and all of the statistical data about it in your database.');" title="Delete <?php echo $link->slug; ?>">Delete</a>
138
+ <?php if( $link->track_me and $prli_options->extended_tracking!='count' ) { ?>
139
  |&nbsp;<a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&action=reset&id=<?php echo $link->id; ?>" onclick="return confirm('Are you sure you want to reset your <?php echo $link->name; ?> Pretty Link? This will delete all of the statistical data about this Pretty Link in your database.');" title="Reset <?php echo $link->name; ?>">Reset</a>&nbsp;|
140
  <a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-clicks.php&l=<?php echo $link->id; ?>" title="View clicks for <?php echo $link->slug; ?>">Hits</a>
141
  <?php do_action('prli-link-action',$link->id); ?>
151
  </div>
152
  </td>
153
  <?php do_action('prli_link_column_row',$link->id); ?>
154
+ <td>
155
+ <?php if($prli_options->extended_tracking!='count')
156
+ echo (($link->track_me)?"<a href=\"?page=".PRLI_PLUGIN_NAME."/prli-clicks.php&l=$link->id\" title=\"View clicks for $link->slug\">" . (empty($link->clicks)?0:$link->clicks) . "/" . (empty($link->uniques)?0:$link->uniques) . "</a>":"<img src=\"".PRLI_URL."/images/not_tracking.png\" title=\"This link isn't being tracked\"/>");
157
+ else
158
+ echo (($link->track_me)?(empty($link->clicks)?0:$link->clicks) . "/" . (empty($link->uniques)?0:$link->uniques):"<img src=\"".PRLI_URL."/images/not_tracking.png\" title=\"This link isn't being tracked\"/>");
159
+ ?>
160
+ </td>
161
  <td><a href="?page=<?php echo PRLI_PLUGIN_NAME; ?>/prli-links.php&group=<?php echo $link->group_id; ?>"><?php echo $link->group_name; ?></a></td>
162
  <td><?php echo $link->created_at; ?></td>
163
  </td>
classes/views/prli-options/form.php CHANGED
@@ -68,10 +68,28 @@ if(!$permalink_structure or empty($permalink_structure))
68
  </table>
69
  </td>
70
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  </table>
72
 
73
  <p class="submit">
74
- <input type="submit" name="Submit" value="<?php _e('Update Options', $prli_domain ) ?>" />
75
  </p>
76
 
77
 
68
  </table>
69
  </td>
70
  </tr>
71
+ <tr>
72
+ <td colspan="2">
73
+ <h4><?php _e('Tracking Style:'); ?></h4><span class="description"><code><?php _e('Note: Changing your tracking style can affect the accuracy of your existing statistics.'); ?></code></span>
74
+ <div id="option-pane">
75
+ <ul style="list-style-type: none;" class="pane">
76
+ <li>
77
+ <input type="radio" name="<?php echo $extended_tracking; ?>" value="normal"<?php echo (($prli_options->extended_tracking == 'normal')?' checked="checked"':''); ?>/>&nbsp;<?php _e('Normal Tracking'); ?>
78
+ </li>
79
+ <li>
80
+ <input type="radio" name="<?php echo $extended_tracking; ?>" value="extended"<?php echo (($prli_options->extended_tracking == 'extended')?' checked="checked"':''); ?>/>&nbsp;<?php _e('Extended Tracking (more stats / slower performance)'); ?>
81
+ </li>
82
+ <li>
83
+ <input type="radio" name="<?php echo $extended_tracking; ?>" value="count"<?php echo (($prli_options->extended_tracking == 'count')?' checked="checked"':''); ?>/>&nbsp;<?php _e('Simple Click Count Tracking (less stats / faster performance)'); ?>
84
+ </li>
85
+ </ul>
86
+ </div>
87
+ </td>
88
+ </tr>
89
  </table>
90
 
91
  <p class="submit">
92
+ <input type="submit" name="Submit" value="<?php _e('Update Options') ?>" />
93
  </p>
94
 
95
 
classes/views/shared/errors.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- if( $errors != null and count($errors) > 0 )
3
  {
4
  ?>
5
  <div class="error">
1
  <?php
2
+ if( isset($errors) and count($errors) > 0 )
3
  {
4
  ?>
5
  <div class="error">
pretty-link.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Pretty Link (Lite Version)
4
  Plugin URI: http://blairwilliams.com/pretty-link
5
  Description: Shrink, track and share any URL on the Internet from your WordPress website!
6
- Version: 1.4.52
7
  Author: Caseproof
8
  Author URI: http://caseproof.com
9
  Copyright: 2009-2010, Caseproof, LLC
3
  Plugin Name: Pretty Link (Lite Version)
4
  Plugin URI: http://blairwilliams.com/pretty-link
5
  Description: Shrink, track and share any URL on the Internet from your WordPress website!
6
+ Version: 1.4.53
7
  Author: Caseproof
8
  Author URI: http://caseproof.com
9
  Copyright: 2009-2010, Caseproof, LLC
prli-clicks.php CHANGED
@@ -7,7 +7,7 @@ require_once(PRLI_PATH . '/prli-image-lookups.php');
7
  $controller_file = basename(__FILE__);
8
  $max_rows_per_file = 5000;
9
 
10
- if($_GET['action'] == null and $_POST['action'] == null)
11
  {
12
  $page_params = '';
13
 
@@ -96,7 +96,7 @@ if($_GET['action'] == null and $_POST['action'] == null)
96
 
97
  require_once 'classes/views/prli-clicks/list.php';
98
  }
99
- else if($_GET['action'] == 'csv' or $_POST['action'] == 'csv')
100
  {
101
  $param_string = '';
102
  $where_clause = '';
@@ -174,7 +174,7 @@ else if($_GET['action'] == 'csv' or $_POST['action'] == 'csv')
174
 
175
  require_once 'classes/views/prli-clicks/csv_download.php';
176
  }
177
- else if($_GET['action'] == 'download_csv_hit_report' or $_POST['action'] == 'download_csv_hit_report')
178
  {
179
  if(isset($_GET['l']))
180
  {
@@ -224,7 +224,7 @@ else if($_GET['action'] == 'download_csv_hit_report' or $_POST['action'] == 'dow
224
  $clicks = $prli_click->getAll($where_clause,'',false,$hlimit);
225
  require_once 'classes/views/prli-clicks/csv.php';
226
  }
227
- else if($_GET['action'] == 'download_csv_origin_report' or $_POST['action'] == 'download_csv_origin_report')
228
  {
229
  if(isset($_GET['l']))
230
  {
@@ -360,6 +360,7 @@ function prli_get_click_sort_vars($params,$where_clause = '')
360
  {
361
  $count_where_clause = '';
362
  $page_params = '';
 
363
 
364
  // These will have to work with both get and post
365
  $sort_str = $params['sort'];
7
  $controller_file = basename(__FILE__);
8
  $max_rows_per_file = 5000;
9
 
10
+ if(!isset($_REQUEST['action']))
11
  {
12
  $page_params = '';
13
 
96
 
97
  require_once 'classes/views/prli-clicks/list.php';
98
  }
99
+ else if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'csv')
100
  {
101
  $param_string = '';
102
  $where_clause = '';
174
 
175
  require_once 'classes/views/prli-clicks/csv_download.php';
176
  }
177
+ else if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'download_csv_hit_report')
178
  {
179
  if(isset($_GET['l']))
180
  {
224
  $clicks = $prli_click->getAll($where_clause,'',false,$hlimit);
225
  require_once 'classes/views/prli-clicks/csv.php';
226
  }
227
+ else if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'download_csv_origin_report')
228
  {
229
  if(isset($_GET['l']))
230
  {
360
  {
361
  $count_where_clause = '';
362
  $page_params = '';
363
+ $order_by = '';
364
 
365
  // These will have to work with both get and post
366
  $sort_str = $params['sort'];
prli-config.php CHANGED
@@ -57,20 +57,20 @@ function setup_new_vars($groups)
57
  global $prli_link, $prli_options;
58
 
59
  $values = array();
60
- $values['url'] = (($_POST['url'] != null)?$_POST['url']:'');
61
- $values['slug'] = (($_POST['slug'] != null)?$_POST['slug']:$prli_link->generateValidSlug());
62
- $values['name'] = htmlspecialchars((($_POST['name'] != null)?stripslashes($_POST['name']):''));
63
- $values['description'] = htmlspecialchars((($_POST['description'] != null)?stripslashes($_POST['description']):''));
64
 
65
- $values['track_me'] = (((isset($_POST['track_me']) and $_POST['track_me'] == 'on') or (!isset($_POST['track_me']) and $prli_options->link_track_me == '1'))?'checked="true"':'');
66
- $values['nofollow'] = (((isset($_POST['nofollow']) and $_POST['nofollow'] == 'on') or (!isset($_POST['nofollow']) and $prli_options->link_nofollow == '1'))?'checked="true"':'');
67
 
68
  $values['redirect_type'] = array();
69
- $values['redirect_type']['307'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == '307') or (!isset($_POST['redirect_type']) and $prli_options->link_redirect_type == '307'))?'selected="selected"':'');
70
- $values['redirect_type']['301'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == '301') or (!isset($_POST['redirect_type']) and $prli_options->link_redirect_type == '301'))?'selected="selected"':'');
71
- $values['redirect_type']['prettybar'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == 'prettybar') or (!isset($_POST['redirect_type']) and $prli_options->link_redirect_type == 'prettybar'))?'selected="selected"':'');
72
- $values['redirect_type']['cloak'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == 'cloak') or (!isset($_POST['redirect_type']) and $prli_options->link_redirect_type == 'cloak'))?'selected="selected"':'');
73
- $values['redirect_type']['pixel'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == 'pixel') or (!isset($_POST['redirect_type']) and $prli_options->link_redirect_type == 'pixel'))?'selected="selected"':'');
74
 
75
  $values['groups'] = array();
76
 
@@ -79,15 +79,15 @@ function setup_new_vars($groups)
79
  foreach($groups as $group)
80
  {
81
  $values['groups'][] = array( 'id' => $group->id,
82
- 'value' => (($_POST['group_id'] == $group->id)?' selected="true"':''),
83
  'name' => $group->name );
84
  }
85
  }
86
 
87
  $values['param_forwarding'] = array();
88
- $values['param_forwarding']['off'] = (((isset($_POST['param_forwarding']) and $_POST['param_forwarding'] == 'off') or !isset($_POST['param_forwarding']))?'checked="true"':'');
89
- $values['param_forwarding']['on'] = ((isset($_POST['param_forwarding']) and $_POST['param_forwarding'] == 'on')?'checked="true"':'');
90
- $values['param_forwarding']['custom'] = ((isset($_POST['param_forwarding']) and $_POST['param_forwarding'] == 'custom')?'checked="true"':'');
91
 
92
  return $values;
93
  }
@@ -97,33 +97,33 @@ function setup_edit_vars($groups,$record)
97
  global $prli_link;
98
 
99
  $values = array();
100
- $values['url'] = (($_POST['url'] != null and $record == null)?$_POST['url']:$record->url);
101
- $values['slug'] = (($_POST['slug'] != null and $record == null)?$_POST['slug']:$record->slug);
102
- $values['name'] = htmlspecialchars(stripslashes((($_POST['name'] != null and $record == null)?$_POST['name']:$record->name)));
103
- $values['description'] = htmlspecialchars(stripslashes((($_POST['description'] != null and $record == null)?$_POST['description']:$record->description)));
104
- $values['track_me'] = ((($_POST['track_me'] or $record->track_me) and ($_POST['track_me'] == 'on' or $record->track_me == 1))?'checked="true"':'');
105
- $values['nofollow'] = ((($_POST['nofollow'] or $record->nofollow) and ($_POST['nofollow'] == 'on' or $record->nofollow == 1))?'checked="true"':'');
106
 
107
  $values['groups'] = array();
108
  foreach($groups as $group)
109
  {
110
  $values['groups'][] = array( 'id' => $group->id,
111
- 'value' => ((($_POST['group_id'] == $group->id) or ($record->group_id == $group->id))?' selected="true"':''),
112
  'name' => $group->name );
113
  }
114
 
115
  $values['param_forwarding'] = array();
116
- $values['param_forwarding']['off'] = ((!isset($_POST['param_forwarding']) or $record->param_forwarding == 'off')?'checked="true"':'');
117
- $values['param_forwarding']['on'] = (((isset($_POST['param_forwarding']) and $_POST['param_forwarding'] == 'on') or (isset($record->param_forwarding) and $record->param_forwarding == 'on'))?'checked="true"':'');
118
- $values['param_forwarding']['custom'] = (((isset($_POST['param_forwarding']) and $_POST['param_forwarding'] == 'custom') or (isset($record->param_forwarding) and $record->param_forwarding == 'custom'))?'checked="true"':'');
119
- $values['param_struct'] = (($_POST['param_struct'] != null and $record == null)?$_POST['param_struct']:$record->param_struct);
120
 
121
  $values['redirect_type'] = array();
122
- $values['redirect_type']['307'] = ((!isset($_POST['redirect_type']) or (isset($_POST['redirect_type']) and $_POST['redirect_type'] == '307') or (isset($record->redirect_type) and $record->redirect_type == '307'))?' selected="selected"':'');
123
- $values['redirect_type']['301'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == '301') or (isset($record->redirect_type) and $record->redirect_type == '301'))?' selected="selected"':'');
124
- $values['redirect_type']['prettybar'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == 'prettybar') or (isset($record->redirect_type) and $record->redirect_type == 'prettybar'))?' selected="selected"':'');
125
- $values['redirect_type']['cloak'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == 'cloak') or (isset($record->redirect_type) and $record->redirect_type == 'cloak'))?' selected="selected"':'');
126
- $values['redirect_type']['pixel'] = (((isset($_POST['redirect_type']) and $_POST['redirect_type'] == 'pixel') or (isset($record->redirect_type) and $record->redirect_type == 'pixel'))?' selected="selected"':'');
127
 
128
  return $values;
129
  }
57
  global $prli_link, $prli_options;
58
 
59
  $values = array();
60
+ $values['url'] = (isset($_REQUEST['url'])?$_REQUEST['url']:'');
61
+ $values['slug'] = (isset($_REQUEST['slug'])?$_REQUEST['slug']:$prli_link->generateValidSlug());
62
+ $values['name'] = htmlspecialchars((isset($_REQUEST['name'])?stripslashes($_REQUEST['name']):''));
63
+ $values['description'] = htmlspecialchars((isset($_REQUEST['description'])?stripslashes($_REQUEST['description']):''));
64
 
65
+ $values['track_me'] = (((isset($_REQUEST['track_me']) and $_REQUEST['track_me'] == 'on') or (!isset($_REQUEST['track_me']) and $prli_options->link_track_me == '1'))?'checked="true"':'');
66
+ $values['nofollow'] = (((isset($_REQUEST['nofollow']) and $_REQUEST['nofollow'] == 'on') or (!isset($_REQUEST['nofollow']) and $prli_options->link_nofollow == '1'))?'checked="true"':'');
67
 
68
  $values['redirect_type'] = array();
69
+ $values['redirect_type']['307'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == '307') or (!isset($_REQUEST['redirect_type']) and $prli_options->link_redirect_type == '307'))?'selected="selected"':'');
70
+ $values['redirect_type']['301'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == '301') or (!isset($_REQUEST['redirect_type']) and $prli_options->link_redirect_type == '301'))?'selected="selected"':'');
71
+ $values['redirect_type']['prettybar'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == 'prettybar') or (!isset($_REQUEST['redirect_type']) and $prli_options->link_redirect_type == 'prettybar'))?'selected="selected"':'');
72
+ $values['redirect_type']['cloak'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == 'cloak') or (!isset($_REQUEST['redirect_type']) and $prli_options->link_redirect_type == 'cloak'))?'selected="selected"':'');
73
+ $values['redirect_type']['pixel'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == 'pixel') or (!isset($_REQUEST['redirect_type']) and $prli_options->link_redirect_type == 'pixel'))?'selected="selected"':'');
74
 
75
  $values['groups'] = array();
76
 
79
  foreach($groups as $group)
80
  {
81
  $values['groups'][] = array( 'id' => $group->id,
82
+ 'value' => ((isset($_REQUEST['group_id']) and $_REQUEST['group_id'] == $group->id)?' selected="true"':''),
83
  'name' => $group->name );
84
  }
85
  }
86
 
87
  $values['param_forwarding'] = array();
88
+ $values['param_forwarding']['off'] = (((isset($_REQUEST['param_forwarding']) and $_REQUEST['param_forwarding'] == 'off') or !isset($_REQUEST['param_forwarding']))?'checked="true"':'');
89
+ $values['param_forwarding']['on'] = ((isset($_REQUEST['param_forwarding']) and $_REQUEST['param_forwarding'] == 'on')?'checked="true"':'');
90
+ $values['param_forwarding']['custom'] = ((isset($_REQUEST['param_forwarding']) and $_REQUEST['param_forwarding'] == 'custom')?'checked="true"':'');
91
 
92
  return $values;
93
  }
97
  global $prli_link;
98
 
99
  $values = array();
100
+ $values['url'] = ((isset($_REQUEST['url']) and $record == null)?$_REQUEST['url']:$record->url);
101
+ $values['slug'] = ((isset($_REQUEST['slug']) and $record == null)?$_REQUEST['slug']:$record->slug);
102
+ $values['name'] = htmlspecialchars(stripslashes(((isset($_REQUEST['name']) and $record == null)?$_REQUEST['name']:$record->name)));
103
+ $values['description'] = htmlspecialchars(stripslashes(((isset($_REQUEST['description']) and $record == null)?$_REQUEST['description']:$record->description)));
104
+ $values['track_me'] = (((isset($_REQUEST['track_me']) or $record->track_me) and ((isset($_REQUEST['track_me']) and $_REQUEST['track_me'] == 'on') or $record->track_me == 1))?'checked="true"':'');
105
+ $values['nofollow'] = (((isset($_REQUEST['nofollow']) or $record->nofollow) and ($_REQUEST['nofollow'] == 'on' or $record->nofollow == 1))?'checked="true"':'');
106
 
107
  $values['groups'] = array();
108
  foreach($groups as $group)
109
  {
110
  $values['groups'][] = array( 'id' => $group->id,
111
+ 'value' => ((isset($_REQUEST['group_id']) and (($_REQUEST['group_id'] == $group->id) or ($record->group_id == $group->id)))?' selected="true"':''),
112
  'name' => $group->name );
113
  }
114
 
115
  $values['param_forwarding'] = array();
116
+ $values['param_forwarding']['off'] = ((!isset($_REQUEST['param_forwarding']) or $record->param_forwarding == 'off')?'checked="true"':'');
117
+ $values['param_forwarding']['on'] = (((isset($_REQUEST['param_forwarding']) and $_REQUEST['param_forwarding'] == 'on') or (isset($record->param_forwarding) and $record->param_forwarding == 'on'))?'checked="true"':'');
118
+ $values['param_forwarding']['custom'] = (((isset($_REQUEST['param_forwarding']) and $_REQUEST['param_forwarding'] == 'custom') or (isset($record->param_forwarding) and $record->param_forwarding == 'custom'))?'checked="true"':'');
119
+ $values['param_struct'] = ((isset($_REQUEST['param_struct']) and $record == null)?$_REQUEST['param_struct']:$record->param_struct);
120
 
121
  $values['redirect_type'] = array();
122
+ $values['redirect_type']['307'] = ((!isset($_REQUEST['redirect_type']) or (isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == '307') or (isset($record->redirect_type) and $record->redirect_type == '307'))?' selected="selected"':'');
123
+ $values['redirect_type']['301'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == '301') or (isset($record->redirect_type) and $record->redirect_type == '301'))?' selected="selected"':'');
124
+ $values['redirect_type']['prettybar'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == 'prettybar') or (isset($record->redirect_type) and $record->redirect_type == 'prettybar'))?' selected="selected"':'');
125
+ $values['redirect_type']['cloak'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == 'cloak') or (isset($record->redirect_type) and $record->redirect_type == 'cloak'))?' selected="selected"':'');
126
+ $values['redirect_type']['pixel'] = (((isset($_REQUEST['redirect_type']) and $_REQUEST['redirect_type'] == 'pixel') or (isset($record->redirect_type) and $record->redirect_type == 'pixel'))?' selected="selected"':'');
127
 
128
  return $values;
129
  }
prli-main.php CHANGED
@@ -1,15 +1,26 @@
1
  <?php
 
 
 
 
 
 
2
  add_action('admin_menu', 'prli_menu');
3
 
4
  function prli_menu()
5
  {
6
- add_menu_page('Pretty Link', 'Pretty Link', 8, PRLI_PATH.'/prli-links.php','',PRLI_URL.'/images/pretty-link-small.png');
7
- add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Add New Link', 'Add New Link', 8, PRLI_PATH.'/prli-add-link.php');
8
- add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Groups', 'Groups', 8, PRLI_PATH.'/prli-groups.php');
9
- add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Hits', 'Hits', 8, PRLI_PATH.'/prli-clicks.php');
10
- add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Tools', 'Tools', 8, PRLI_PATH.'/prli-tools.php');
11
- add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Options', 'Options', 8, PRLI_PATH.'/prli-options.php');
12
- add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Pretty Link Pro', 'Pretty Link Pro', 8, PRLI_PATH.'/prli-pro-settings.php');
 
 
 
 
 
13
 
14
  add_action('admin_head-pretty-link/prli-clicks.php', 'prli_reports_admin_header');
15
  add_action('admin_head-pretty-link/prli-links.php', 'prli_links_admin_header');
@@ -85,7 +96,10 @@ function prli_redirect()
85
  $request_uri = preg_replace('#/$#','',urldecode($_SERVER['REQUEST_URI']));
86
 
87
  if( $link_info =& $prli_link->is_pretty_link($request_uri,false) )
88
- prli_link_redirect_from_slug( $link_info['pretty_link_found']->slug, $link_info['pretty_link_params'] );
 
 
 
89
  }
90
 
91
  // For use with the prli_redirect function
@@ -112,21 +126,21 @@ add_action('init', 'prli_redirect'); //Redirect
112
 
113
  function prli_route_scripts()
114
  {
115
- if( ( $_GET['action'] == 'prli_download_csv_hit_report' ) or ( PrliUtils::rewriting_on() and preg_match( "#^/prli_download_csv_hit_report#", $_SERVER['REQUEST_URI'] ) ) )
116
  {
117
  global $wpdb, $prli_click, $prli_group, $prli_link;
118
  $_GET['action'] = "download_csv_hit_report";
119
  require_once( PRLI_PATH . "/prli-clicks.php" );
120
  exit;
121
  }
122
- else if( ( $_GET['action'] == 'prli_download_csv_history_report') or ( PrliUtils::rewriting_on() and preg_match( "#^/prli_download_csv_history_report#", $_SERVER['REQUEST_URI'] ) ) )
123
  {
124
  global $wpdb, $prli_click, $prli_group, $prli_link;
125
  $_GET['action'] = "download_csv_history_report";
126
  require_once( PRLI_PATH . "/prli-clicks.php" );
127
  exit;
128
  }
129
- else if( ( $_GET['action'] == 'prli_download_csv_origin_report') or ( PrliUtils::rewriting_on() and preg_match( "#^/prli_download_csv_origin_report#", $_SERVER['REQUEST_URI'] ) ) )
130
  {
131
  global $wpdb, $prli_click, $prli_group, $prli_link;
132
  $_GET['action'] = "download_csv_origin_report";
1
  <?php
2
+
3
+ // Let's give pretty link plenty of room to work with
4
+ $mem = abs(intval(@ini_get('memory_limit')));
5
+ if( $mem and $mem < 128 )
6
+ @ini_set('memory_limit', '128M');
7
+
8
  add_action('admin_menu', 'prli_menu');
9
 
10
  function prli_menu()
11
  {
12
+ global $prli_options;
13
+
14
+ add_menu_page('Pretty Link', 'Pretty Link', 'administrator', PRLI_PATH.'/prli-links.php','',PRLI_URL.'/images/pretty-link-small.png');
15
+ add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Add New Link', 'Add New Link', 'administrator', PRLI_PATH.'/prli-add-link.php');
16
+ add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Groups', 'Groups', 'administrator', PRLI_PATH.'/prli-groups.php');
17
+
18
+ if( isset($prli_options->extended_tracking) and $prli_options->extended_tracking != "count" )
19
+ add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Hits', 'Hits', 'administrator', PRLI_PATH.'/prli-clicks.php');
20
+
21
+ add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Tools', 'Tools', 'administrator', PRLI_PATH.'/prli-tools.php');
22
+ add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Options', 'Options', 'administrator', PRLI_PATH.'/prli-options.php');
23
+ add_submenu_page(PRLI_PATH.'/prli-links.php', 'Pretty Link | Pretty Link Pro', 'Pretty Link Pro', 'administrator', PRLI_PATH.'/prli-pro-settings.php');
24
 
25
  add_action('admin_head-pretty-link/prli-clicks.php', 'prli_reports_admin_header');
26
  add_action('admin_head-pretty-link/prli-links.php', 'prli_links_admin_header');
96
  $request_uri = preg_replace('#/$#','',urldecode($_SERVER['REQUEST_URI']));
97
 
98
  if( $link_info =& $prli_link->is_pretty_link($request_uri,false) )
99
+ {
100
+ $params = (isset($link_info['pretty_link_params'])?$link_info['pretty_link_params']:'');
101
+ prli_link_redirect_from_slug( $link_info['pretty_link_found']->slug, $params );
102
+ }
103
  }
104
 
105
  // For use with the prli_redirect function
126
 
127
  function prli_route_scripts()
128
  {
129
+ if( ( isset($_GET['action']) and $_GET['action'] == 'prli_download_csv_hit_report' ) or ( PrliUtils::rewriting_on() and preg_match( "#^/prli_download_csv_hit_report#", $_SERVER['REQUEST_URI'] ) ) )
130
  {
131
  global $wpdb, $prli_click, $prli_group, $prli_link;
132
  $_GET['action'] = "download_csv_hit_report";
133
  require_once( PRLI_PATH . "/prli-clicks.php" );
134
  exit;
135
  }
136
+ else if( ( isset($_GET['action']) and $_GET['action'] == 'prli_download_csv_history_report') or ( PrliUtils::rewriting_on() and preg_match( "#^/prli_download_csv_history_report#", $_SERVER['REQUEST_URI'] ) ) )
137
  {
138
  global $wpdb, $prli_click, $prli_group, $prli_link;
139
  $_GET['action'] = "download_csv_history_report";
140
  require_once( PRLI_PATH . "/prli-clicks.php" );
141
  exit;
142
  }
143
+ else if( ( isset($_GET['action']) and $_GET['action'] == 'prli_download_csv_origin_report') or ( PrliUtils::rewriting_on() and preg_match( "#^/prli_download_csv_origin_report#", $_SERVER['REQUEST_URI'] ) ) )
144
  {
145
  global $wpdb, $prli_click, $prli_group, $prli_link;
146
  $_GET['action'] = "download_csv_origin_report";
prli-options.php CHANGED
@@ -8,6 +8,7 @@ $errors = array();
8
  $prli_exclude_ips = 'prli_exclude_ips';
9
  $whitelist_ips = 'prli_whitelist_ips';
10
  $filter_robots = 'prli_filter_robots';
 
11
 
12
  $link_track_me = 'prli_link_track_me';
13
  $link_prefix = 'prli_link_prefix';
@@ -19,7 +20,7 @@ $update_message = false;
19
 
20
  // See if the user has posted us some information
21
  // If they did, this hidden field will be set to 'Y'
22
- if( $_POST[ $hidden_field_name ] == 'Y' )
23
  {
24
  // Validate This
25
  if( !empty($_POST[ $prli_exclude_ips ]) and !preg_match( "#^[ \t]*((\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)|([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*))([ \t]*,[ \t]*((\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)|([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*)))*$#", $_POST[ $prli_exclude_ips ] ) )
@@ -34,6 +35,7 @@ if( $_POST[ $hidden_field_name ] == 'Y' )
34
  $prli_options->prli_exclude_ips = stripslashes($_POST[ $prli_exclude_ips ]);
35
  $prli_options->whitelist_ips = stripslashes($_POST[ $whitelist_ips ]);
36
  $prli_options->filter_robots = (int)isset($_POST[ $filter_robots ]);
 
37
  $prli_options->link_track_me = (int)isset($_POST[ $link_track_me ]);
38
  $prli_options->link_prefix = (int)isset($_POST[ $link_prefix ]);
39
  $prli_options->link_nofollow = (int)isset($_POST[ $link_nofollow ]);
@@ -53,13 +55,13 @@ if( $_POST[ $hidden_field_name ] == 'Y' )
53
  $update_message = __('Options saved.');
54
  }
55
  }
56
- else if($_GET['action'] == 'clear_all_clicks' or $_POST['action'] == 'clear_all_clicks')
57
  {
58
  $prli_click->clearAllClicks();
59
 
60
  $update_message = __('Hit Database was Cleared.');
61
  }
62
- else if($_GET['action'] == 'clear_30day_clicks' or $_POST['action'] == 'clear_30day_clicks')
63
  {
64
  $num_clicks = $prli_click->clear_clicks_by_age_in_days(30);
65
 
@@ -68,7 +70,7 @@ else if($_GET['action'] == 'clear_30day_clicks' or $_POST['action'] == 'clear_30
68
  else
69
  $update_message = __("No hits older than 30 days were found, so nothing was deleted" );
70
  }
71
- else if($_GET['action'] == 'clear_90day_clicks' or $_POST['action'] == 'clear_90day_clicks')
72
  {
73
  $num_clicks = $prli_click->clear_clicks_by_age_in_days(90);
74
 
8
  $prli_exclude_ips = 'prli_exclude_ips';
9
  $whitelist_ips = 'prli_whitelist_ips';
10
  $filter_robots = 'prli_filter_robots';
11
+ $extended_tracking = 'prli_extended_tracking';
12
 
13
  $link_track_me = 'prli_link_track_me';
14
  $link_prefix = 'prli_link_prefix';
20
 
21
  // See if the user has posted us some information
22
  // If they did, this hidden field will be set to 'Y'
23
+ if( isset($_REQUEST[ $hidden_field_name ]) and $_REQUEST[ $hidden_field_name ] == 'Y' )
24
  {
25
  // Validate This
26
  if( !empty($_POST[ $prli_exclude_ips ]) and !preg_match( "#^[ \t]*((\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)|([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*))([ \t]*,[ \t]*((\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)\.(\d{1,3}|\*)|([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*):([0-9a-fA-F]{1,4}|\*)))*$#", $_POST[ $prli_exclude_ips ] ) )
35
  $prli_options->prli_exclude_ips = stripslashes($_POST[ $prli_exclude_ips ]);
36
  $prli_options->whitelist_ips = stripslashes($_POST[ $whitelist_ips ]);
37
  $prli_options->filter_robots = (int)isset($_POST[ $filter_robots ]);
38
+ $prli_options->extended_tracking = stripslashes($_POST[ $extended_tracking ]);
39
  $prli_options->link_track_me = (int)isset($_POST[ $link_track_me ]);
40
  $prli_options->link_prefix = (int)isset($_POST[ $link_prefix ]);
41
  $prli_options->link_nofollow = (int)isset($_POST[ $link_nofollow ]);
55
  $update_message = __('Options saved.');
56
  }
57
  }
58
+ else if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'clear_all_clicks')
59
  {
60
  $prli_click->clearAllClicks();
61
 
62
  $update_message = __('Hit Database was Cleared.');
63
  }
64
+ else if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'clear_30day_clicks')
65
  {
66
  $num_clicks = $prli_click->clear_clicks_by_age_in_days(30);
67
 
70
  else
71
  $update_message = __("No hits older than 30 days were found, so nothing was deleted" );
72
  }
73
+ else if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'clear_90day_clicks')
74
  {
75
  $num_clicks = $prli_click->clear_clicks_by_age_in_days(90);
76
 
readme.txt CHANGED
@@ -4,27 +4,31 @@ Donate link: http://prettylinkpro.com
4
  Tags: links, link, url, urls, affiliate, affiliates, pretty, marketing, redirect, forward, plugin, twitter, tweet, rewrite, shorturl, hoplink, hop, shortlink, short, shorten, click, clicks, track, tracking, tiny, tinyurl, budurl, shrinking, domain, shrink, mask, masking, cloak, cloaking, slug, slugs, admin, administration, stats, statistics, stat, statistic, email, ajax, javascript, ui, csv, download, page, post, pages, posts, shortcode, seo, automation, widget, widgets, dashboard
5
  Requires at least: 2.9
6
  Tested up to: 3.0.1
7
- Stable tag: 1.4.52
8
 
9
  Shrink, track and share any URL on the Internet from your WordPress website. Create short links suitable for Twitter using your own domain name!
10
 
11
  == Description ==
12
 
13
- Shrink, track and share any URL on the Internet from your WordPress website. You can now shorten links using your own domain name (as opposed to using tinyurl.com, bit.ly, or any other link shrinking service)! In addition to creating clean links, Pretty Link tracks each hit on your URL and provides a full, detailed report of where the hit came from, the browser, os and host. Pretty Link is a killer plugin for people who want to clean up their affiliate links, track clicks from emails, their links on Twitter to come from their own domain, or generally increase the reach of their website by spreading these links on forums or comments on other blogs.
14
 
15
  = Upgrade to Pretty Link Pro =
16
 
17
- Pretty Link Pro is an upgrade to Pretty Link that adds the capability to automate your pretty link creation, auto-tweet them, replace keywords thoughout your blog and much more. You can learn more about it here:
18
 
19
  http://prettylinkpro.com
20
 
 
 
 
 
21
  = Examples =
22
 
23
  This is a link setup using Pretty Link that redirects to the Pretty Link Homepage where you can find more info about this Plugin:
24
 
25
  http://blairwilliams.com/pl
26
 
27
- Here's a named Pretty Link (I used the slug 'aweber') that does a 307 redirect to my affiliate link for aweber.com:
28
 
29
  http://blairwilliams.com/aweber
30
 
@@ -63,6 +67,12 @@ http://blairwilliams.com/w7a
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
66
  = 1.4.52 =
67
  * Fixed bugs related to the cloaking and pretty bar redirection changes
68
 
@@ -266,6 +276,9 @@ http://blairwilliams.com/w7a
266
  * Fixed some issues surrounding keyword content caching in Pro
267
 
268
  == Upgrade Notice ==
 
 
 
269
  = 1.4.52 =
270
  * Fixed bugs related to the cloaking and pretty bar redirection changes. This affected all Pretty Link users -- everyone should upgrade to this release.
271
 
4
  Tags: links, link, url, urls, affiliate, affiliates, pretty, marketing, redirect, forward, plugin, twitter, tweet, rewrite, shorturl, hoplink, hop, shortlink, short, shorten, click, clicks, track, tracking, tiny, tinyurl, budurl, shrinking, domain, shrink, mask, masking, cloak, cloaking, slug, slugs, admin, administration, stats, statistics, stat, statistic, email, ajax, javascript, ui, csv, download, page, post, pages, posts, shortcode, seo, automation, widget, widgets, dashboard
5
  Requires at least: 2.9
6
  Tested up to: 3.0.1
7
+ Stable tag: 1.4.53
8
 
9
  Shrink, track and share any URL on the Internet from your WordPress website. Create short links suitable for Twitter using your own domain name!
10
 
11
  == Description ==
12
 
13
+ Shrink, track and share any URL on the Internet from your WordPress website. Create short links suitable for Twitter using your own domain name!
14
 
15
  = Upgrade to Pretty Link Pro =
16
 
17
+ Pretty Link Pro is an upgrade to Pretty Link that adds the capability to automate your pretty link creation, cloak links, auto-tweet them, replace keywords thoughout your blog and much more. You can learn more about it here:
18
 
19
  http://prettylinkpro.com
20
 
21
+ = Detail =
22
+
23
+ Pretty Link enables you to shorten links using your own domain name (as opposed to using tinyurl.com, bit.ly, or any other link shrinking service)! In addition to creating clean links, Pretty Link tracks each hit on your URL and provides a full, detailed report of where the hit came from, the browser, os and host. Pretty Link is a killer plugin for people who want to clean up their affiliate links, track clicks from emails, their links on Twitter to come from their own domain, or generally increase the reach of their website by spreading these links on forums or comments on other blogs.
24
+
25
  = Examples =
26
 
27
  This is a link setup using Pretty Link that redirects to the Pretty Link Homepage where you can find more info about this Plugin:
28
 
29
  http://blairwilliams.com/pl
30
 
31
+ Here's a named Pretty Link (I used the slug 'aweber') that does a 307 redirect to my affiliate link for aweber.com:
32
 
33
  http://blairwilliams.com/aweber
34
 
67
 
68
  == Changelog ==
69
 
70
+ = 1.4.53 =
71
+ * Added the ability to change the pretty link tracking mode to simple, normal and extended
72
+ * Fixed numerous debug issues
73
+ * Fixed memory_limit issue in pretty link
74
+ * Fixed pretty bar issue affecting pro users
75
+
76
  = 1.4.52 =
77
  * Fixed bugs related to the cloaking and pretty bar redirection changes
78
 
276
  * Fixed some issues surrounding keyword content caching in Pro
277
 
278
  == Upgrade Notice ==
279
+ = 1.4.53 =
280
+ * Everyone should upgrade to this version. It fixes numerous bugs for all users -- including a memory_limit issue and some click tracking algorithm issues. In addition to the upgrade, users who have had performance issues with click tracking should also switch to simple click count tracking in "Pretty Link" -> "Options" -> "Reporting Options" ...
281
+
282
  = 1.4.52 =
283
  * Fixed bugs related to the cloaking and pretty bar redirection changes. This affected all Pretty Link users -- everyone should upgrade to this release.
284