Changeset 2961271
- Timestamp:
- 08/31/2023 03:41:03 PM (2 years ago)
- Location:
- wp-pocket-urls
- Files:
-
- 27 added
- 5 edited
-
tags/1.0.2 (added)
-
tags/1.0.2/README.txt (added)
-
tags/1.0.2/assets (added)
-
tags/1.0.2/assets/css (added)
-
tags/1.0.2/assets/css/wp-pocketurl.css (added)
-
tags/1.0.2/assets/js (added)
-
tags/1.0.2/assets/js/copy.js (added)
-
tags/1.0.2/assets/js/wp-pocketurl.js (added)
-
tags/1.0.2/assets/views (added)
-
tags/1.0.2/assets/views/clicks_details.php (added)
-
tags/1.0.2/assets/views/link-options.php (added)
-
tags/1.0.2/assets/views/other.php (added)
-
tags/1.0.2/assets/views/reports.php (added)
-
tags/1.0.2/assets/views/settings.php (added)
-
tags/1.0.2/assets/views/single-wp_pocketurl_link.php (added)
-
tags/1.0.2/classes (added)
-
tags/1.0.2/classes/class-add-tax.php (added)
-
tags/1.0.2/classes/class-wp-pocketurl-admin.php (added)
-
tags/1.0.2/classes/class-wp-pocketurl-clicks.php (added)
-
tags/1.0.2/classes/class-wp-pocketurl-reports.php (added)
-
tags/1.0.2/classes/class-wp-pocketurl.php (added)
-
tags/1.0.2/languages (added)
-
tags/1.0.2/languages/wp-pocketurl.pot (added)
-
tags/1.0.2/res (added)
-
tags/1.0.2/res/diacritics.php (added)
-
tags/1.0.2/uninstall.php (added)
-
tags/1.0.2/wp-pocketurl.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/assets/views/reports.php (modified) (1 diff)
-
trunk/classes/class-wp-pocketurl-admin.php (modified) (2 diffs)
-
trunk/classes/class-wp-pocketurl-reports.php (modified) (5 diffs)
-
trunk/wp-pocketurl.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-pocket-urls/trunk/README.txt
r2807068 r2961271 4 4 Tags: : affiliate link, link shortener, short link, short url, hide affiliate link, link cloak, cloak links, affiliate links, pretty link, redirect link, forward link, shorturl, hoplink, shortlink, tinyurl, url shrinking, 301 redirect, 307 redirect, 302 redirect, affiliate link management, affiliate link manager, affiliate link redirect, affiliate links, link cloak, link cloaking, link redirect, manage affiliate links, click counting, visitor information, link masking, link cloacking, link cloacker, url cloacker 5 5 Requires at least: 4.0.0 6 Tested up to: 6. 16 Tested up to: 6.2 7 7 Stable tag: trunk 8 8 Requires PHP: 5.2.4 … … 96 96 = 1.0.0 = 97 97 Initial release. 98 = 1.0.1 =99 Fixed reported bugs. -
wp-pocket-urls/trunk/assets/views/reports.php
r2359978 r2961271 114 114 <!--end gchart--> 115 115 <div class="total-clicks"> 116 <h4><?php echo esc_html__('Total:', 'wp_pocketurl');?> <?php echo $total_clicks; ?> <?php echo esc_html__('clicks', 'wp_pocketurl');?></h4>116 <h4><?php echo esc_html__('Total:', 'wp_pocketurl');?> <?php echo esc_html($total_clicks); ?> <?php echo esc_html__('clicks', 'wp_pocketurl');?></h4> 117 117 </div> 118 118 <div id="chart_container" style="width:800px;"></div> -
wp-pocket-urls/trunk/classes/class-wp-pocketurl-admin.php
r2361962 r2961271 213 213 // change wp pocketurl link post slug if the option changed 214 214 public function wp_pocketurl_link_slug_change($new_value,$old_value ){ 215 if($new_value !== $old_value ){ 215 if($new_value !== $old_value ) 216 { 217 $registered = FALSE; 216 218 //check if the old value is empty 217 219 if(empty($old_value)) $old_value = 'go'; … … 222 224 // that replaces 'go' with 'option value' and give it a higher 223 225 // priority than the existing rule. 224 foreach($current_rules as $key => $val) { 225 if(strpos($key, $old_value ) !== false) { 226 add_rewrite_rule(str_ireplace($old_value, $new_value, $key), $val, 'top'); 226 if(is_array($current_rules)) 227 { 228 foreach($current_rules as $key => $val) { 229 if(strpos($key, $old_value ) !== false) { 230 $registered = TRUE; 231 add_rewrite_rule(str_ireplace($old_value, $new_value, $key), $val, 'top'); 232 } 227 233 } 228 234 } 229 235 } 230 flush_rewrite_rules(); 236 if($registered) 237 { 238 flush_rewrite_rules(); 239 } 231 240 } 232 241 return $new_value; -
wp-pocket-urls/trunk/classes/class-wp-pocketurl-reports.php
r2359978 r2961271 20 20 foreach ($links as $key => $link) { 21 21 $lselected = ($clink == $link->ID) ? 'selected' :''; 22 $output[] ="<option value=' {$link->ID}' {$lselected}>{$link->post_title}</option>";22 $output[] ="<option value='" . esc_attr($link->ID) . "' " . esc_attr($lselected) . ">" . esc_attr($link->post_title) . "</option>"; 23 23 } 24 24 $output[]='</select></label>'; … … 30 30 foreach ($months as $key => $month) { 31 31 $mselected = ($cmonth == $month) ? 'selected' :''; 32 $output[] = '<option value="'. $month.'" '.$mselected.'>'.$month.'</option>';32 $output[] = '<option value="'.esc_attr($month).'" '.esc_attr($mselected).'>'.esc_attr($month).'</option>'; 33 33 } 34 34 $output[]='</select></label>'; … … 41 41 foreach ($terms as $key => $term) { 42 42 $cselected = ($cat == $term->term_id) ? 'selected' :''; 43 $output[] = '<option value="'. $term->term_id.'" '.$cselected.'>'.$term->name.'</option>';43 $output[] = '<option value="'.esc_attr($term->term_id).'" '.esc_attr($cselected).'>'.esc_attr($term->name).'</option>'; 44 44 } 45 45 $output[]='</select></label>'; … … 52 52 foreach ($countries as $key => $country) { 53 53 $coselected = ($ccountry == $country->code) ? 'selected' :''; 54 $output[] = '<option value="'. $country->code.'" '.$coselected.'>'.$country->name.'</option>';54 $output[] = '<option value="'.esc_attr($country->code).'" '.esc_attr($coselected).'>'.esc_attr($country->name).'</option>'; 55 55 } 56 56 $output[]='</select></label>'; 57 57 $output[]='<input type="submit" class="button button-primary" value="'.__('Update').'" />'; 58 58 59 echo implode( $output);59 echo implode('',$output); 60 60 } 61 61 /* … … 151 151 * get clicks count grouped by date 152 152 */ 153 public function wp_pocketurl_get_clicks_report($cmonth=null, $cat=null, $country=null,$link ){153 public function wp_pocketurl_get_clicks_report($cmonth=null, $cat=null, $country=null,$link=null ){ 154 154 global $wpdb;$and=0; 155 155 $sql = "SELECT count(1) as clicks, DATE(click_date) as date FROM {$wpdb->wp_pocketurl_clicks_table}"; -
wp-pocket-urls/trunk/wp-pocketurl.php
r2393200 r2961271 4 4 Plugin URI: https://www.coderevolution.ro/wp-pocketurl 5 5 Description: WP Pocket URLs gives you the ability to shorten your affiliate links and keep track of clicks for each link. 6 Version: 1.0. 16 Version: 1.0.2 7 7 Author: CodeRevolution 8 8 Author URI: https://www.coderevolution.ro … … 78 78 function wp_poketurl_isExternal($href, $base) 79 79 { 80 if(empty($href) || empty($base)) 81 { 82 return 1; 83 } 80 84 $components = parse_url($href); 81 85 $comp_base = parse_url($base); 82 86 if(!isset($components['host']) || !isset($comp_base['host'])) 83 87 { 88 if(stristr($href, $base) !== false) 89 { 90 return 0; 91 } 84 92 return 1; 85 93 } … … 151 159 ini_set('max_execution_time', $timeout); 152 160 ini_set('ignore_user_abort', 1); 153 ignore_user_abort(true); 154 set_time_limit($timeout); 161 if(function_exists('ignore_user_abort')) 162 { 163 ignore_user_abort(true); 164 } 165 if(function_exists('set_time_limit')) 166 { 167 set_time_limit($timeout); 168 } 155 169 156 170 $content = $post->post_content; … … 200 214 $url_str = str_replace(array('/', '-', '_', ':'), ' ', $url_str); 201 215 $keyword_class = new WP_poketurl_keywords(); 202 if ( ! function_exists( 'get_page_by_title' ) )203 {204 include_once( ABSPATH . 'wp-includes/post.php' );205 }206 216 $query_words = $keyword_class->keywords($url_str, 1); 207 217 $feed_id = sanitize_title($query_words); 208 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)218 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 209 219 { 210 220 $query_words = $keyword_class->keywords($url_str, 2); 211 221 $feed_id = sanitize_title($query_words); 212 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)222 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 213 223 { 214 224 $query_words = $keyword_class->keywords($url_str, 3); 215 225 $feed_id = sanitize_title($query_words); 216 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)226 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 217 227 { 218 228 $query_words = $keyword_class->keywords($url_str, 4); 219 229 $feed_id = sanitize_title($query_words); 220 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)230 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 221 231 { 222 232 $query_words = $keyword_class->keywords($url_str, 5); 223 233 $feed_id = sanitize_title($query_words); 224 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)234 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 225 235 { 226 236 $query_words = $keyword_class->keywords($url_str, 6); 227 237 $feed_id = sanitize_title($query_words); 228 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)238 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 229 239 { 230 240 $query_words = $keyword_class->keywords($url_str, 7); 231 241 $feed_id = sanitize_title($query_words); 232 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)242 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 233 243 { 234 244 $query_words = $keyword_class->keywords($url_str, 8); 235 245 $feed_id = sanitize_title($query_words); 236 if ( get_page_by_title($feed_id, OBJECT, 'wp_pocketurl_link') !== NULL)246 if (wp_pocketurl_get_page_by_title(html_entity_decode($feed_id), OBJECT, 'wp_pocketurl_link') !== NULL) 237 247 { 238 248 $feed_id .= '-' . uniqid(); … … 250 260 $post_id = wp_insert_post($my_post, true); 251 261 if (!is_wp_error($post_id)) { 252 $cusOption = '0'; 253 $linkRedirection = get_option('wp_pocketurl_link_redirection', '301'); 254 update_post_meta($post_id,'wp_pocketurl_link', $href); 255 update_post_meta($post_id,'wp_pocketurl_link_custom_options', $cusOption); 256 update_post_meta($post_id,'wp_pocketurl_link_redirection', $linkRedirection); 257 $new_link = get_permalink($post_id); 258 $content = str_replace($href, $new_link, $content); 259 $need_update = true; 262 if($post_id === 0) 263 { 264 wp_pocketurl_log_to_file('Error occurred while inserting new redirect rule!'); 265 } 266 else 267 { 268 $cusOption = '0'; 269 $linkRedirection = get_option('wp_pocketurl_link_redirection', '301'); 270 update_post_meta($post_id,'wp_pocketurl_link', $href); 271 update_post_meta($post_id,'wp_pocketurl_link_custom_options', $cusOption); 272 update_post_meta($post_id,'wp_pocketurl_link_redirection', $linkRedirection); 273 $new_link = get_permalink($post_id); 274 $content = str_replace($href, $new_link, $content); 275 $need_update = true; 276 } 260 277 } 261 278 else … … 274 291 $args['ID'] = $post->ID; 275 292 $args['post_content'] = $content; 293 remove_filter('content_save_pre', 'wp_filter_post_kses'); 294 remove_filter('content_filtered_save_pre', 'wp_filter_post_kses'); 295 remove_filter('title_save_pre', 'wp_filter_kses'); 276 296 $post_updated = wp_update_post($args); 297 add_filter('content_save_pre', 'wp_filter_post_kses'); 298 add_filter('content_filtered_save_pre', 'wp_filter_post_kses'); 299 add_filter('title_save_pre', 'wp_filter_kses'); 277 300 if (is_wp_error($post_updated)) { 278 301 $errors = $post_updated->get_error_messages(); … … 284 307 } 285 308 } 309 function wp_pocketurl_get_page_by_title($title, $ret_type, $post_type) 310 { 311 $xposts = get_posts( 312 array( 313 'post_type' => $post_type, 314 'title' => $title, 315 'post_status' => 'all', 316 'numberposts' => 1, 317 'update_post_term_cache' => false, 318 'update_post_meta_cache' => false, 319 'orderby' => 'post_date ID', 320 'order' => 'ASC', 321 ) 322 ); 323 if ( ! empty( $xposts ) ) { 324 $zap = $xposts[0]; 325 } else { 326 $zap = null; 327 } 328 return $zap; 329 } 286 330 function wp_pocketurl_log_to_file($str) 287 331 {
Note: See TracChangeset
for help on using the changeset viewer.