Changeset 2131384
- Timestamp:
- 07/31/2019 11:59:20 AM (7 years ago)
- Location:
- wp-seo-redirect-301
- Files:
-
- 17 added
- 4 edited
-
tags/2.2.3 (added)
-
tags/2.2.3/README.md (added)
-
tags/2.2.3/css (added)
-
tags/2.2.3/css/style.css (added)
-
tags/2.2.3/images (added)
-
tags/2.2.3/images/edit.png (added)
-
tags/2.2.3/images/facebook.jpg (added)
-
tags/2.2.3/images/progress.gif (added)
-
tags/2.2.3/images/rate-me.png (added)
-
tags/2.2.3/images/resortable.jpg (added)
-
tags/2.2.3/images/trash.png (added)
-
tags/2.2.3/images/twitter.jpg (added)
-
tags/2.2.3/lib (added)
-
tags/2.2.3/lib/tom-m8te.php (added)
-
tags/2.2.3/readme.txt (added)
-
tags/2.2.3/seo_redirect_301s.php (added)
-
tags/2.2.3/seo_redirect_list.php (added)
-
trunk/lib/tom-m8te.php (modified) (26 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/seo_redirect_301s.php (modified) (11 diffs)
-
trunk/seo_redirect_list.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-seo-redirect-301/trunk/lib/tom-m8te.php
r1326125 r2131384 75 75 function get_current_url() { 76 76 $pageURL = 'http'; 77 if ( $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}77 if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";} 78 78 $pageURL .= "://"; 79 79 if ($_SERVER["SERVER_PORT"] != "80") { … … 121 121 if ($index == -1) { 122 122 if (isset($_POST[$name])) { 123 return TomM8::fix_http_quotes($_POST[$name]);123 return $this->fix_http_quotes($_POST[$name]); 124 124 } else if (isset($_GET[$name])) { 125 return TomM8::fix_http_quotes($_GET[$name]);125 return $this->fix_http_quotes($_GET[$name]); 126 126 } else if (isset($_POST[$name."_0"])) { 127 127 $i = 0; … … 134 134 $i++; 135 135 } while (isset($_POST[$name."_".$i])); 136 $_POST[$name] = TomM8::fix_http_quotes($data);137 return TomM8::fix_http_quotes($data);136 $_POST[$name] = $this->fix_http_quotes($data); 137 return $this->fix_http_quotes($data); 138 138 } else { 139 139 return ""; … … 142 142 $name = str_replace("[]", "", $name); 143 143 if (isset($_POST[$name][$index])) { 144 return TomM8::fix_http_quotes($_POST[$name][$index]);144 return $this->fix_http_quotes($_POST[$name][$index]); 145 145 } else if (isset($_GET[$name][$index])) { 146 return TomM8::fix_http_quotes($_GET[$name][$index]);146 return $this->fix_http_quotes($_GET[$name][$index]); 147 147 } else if (isset($_POST[$name."_0"][$index])) { 148 148 $i = 0; … … 155 155 $i++; 156 156 } while (isset($_POST[$name."_".$i][$index])); 157 $_POST[$name][$index] = TomM8::fix_http_quotes($data);158 return TomM8::fix_http_quotes($data);157 $_POST[$name][$index] = $this->fix_http_quotes($data); 158 return $this->fix_http_quotes($data); 159 159 } else { 160 160 return ""; … … 224 224 wp_update_attachment_metadata( $attach_id, $attach_data ); 225 225 preg_match("/\/wp-content(.+)$/", $filedest, $matches, PREG_OFFSET_CAPTURE); 226 TomM8::update_record_by_id("posts", array("guid" => get_option("siteurl").$matches[0][0]), "ID", $attach_id);226 $this->update_record_by_id("posts", array("guid" => get_option("siteurl").$matches[0][0]), "ID", $attach_id); 227 227 // echo $filedest; 228 228 } … … 370 370 $extra_where = array(); 371 371 if (count($filter_arrays) > 0) { 372 if ( TomM8::get_query_string_value($table_name."_filters") != "") {373 $filters = explode(",", TomM8::get_query_string_value($table_name."_filters"));372 if ($this->get_query_string_value($table_name."_filters") != "") { 373 $filters = explode(",", $this->get_query_string_value($table_name."_filters")); 374 374 foreach ($filters as $filter) { 375 if ( TomM8::get_query_string_value("filter_".$filter) != "") {375 if ($this->get_query_string_value("filter_".$filter) != "") { 376 376 if (!(isset($_POST["action"]) && $_POST["action"] == "Reset")) { 377 array_push($extra_where, $filter." LIKE '%". TomM8::get_query_string_value("filter_".$filter)."%'");377 array_push($extra_where, $filter." LIKE '%".$this->get_query_string_value("filter_".$filter)."%'"); 378 378 } 379 379 } … … 393 393 } 394 394 395 $results = TomM8::get_results($table_name, $fields_array, $where_clause, $order_array, $limit_clause.$offset_clause);395 $results = $this->get_results($table_name, $fields_array, $where_clause, $order_array, $limit_clause.$offset_clause); 396 396 397 $total_count = count( TomM8::get_results($table_name, $fields_array, $where_clause));397 $total_count = count($this->get_results($table_name, $fields_array, $where_clause)); 398 398 399 399 echo("<div class=\"postbox\" style=\"display: block; \"><div class=\"inside\">"); … … 410 410 foreach($filter_arrays as $filter_array) { 411 411 foreach($filter_array as $key => $value) { 412 if ( TomM8::get_query_string_value("filter_".$key) != "") {412 if ($this->get_query_string_value("filter_".$key) != "") { 413 413 if (isset($_POST["action"]) && $_POST["action"] == "Reset") { 414 414 $_POST["filter_".$key] = ""; 415 415 } 416 $params_filter .= "&filter_".$key."=". TomM8::get_query_string_value("filter_".$key);416 $params_filter .= "&filter_".$key."=".$this->get_query_string_value("filter_".$key); 417 417 } 418 418 array_push($filters, $key); 419 TomM8::add_form_field(null, $value["type"], titlize_str($key), "filter_".$key, "filter_".$key, array(), "p", array(), $value["value_options"]);419 $this->add_form_field(null, $value["type"], titlize_str($key), "filter_".$key, "filter_".$key, array(), "p", array(), $value["value_options"]); 420 420 } 421 421 } … … 431 431 } 432 432 if (count($results) > 0) { 433 if ($paginate_table) { TomM8::generate_datatable_pagination($table_name, $total_count, $limit_clause, $page_no, $page_name, $order_direction, "top"); } ?>433 if ($paginate_table) { $this->generate_datatable_pagination($table_name, $total_count, $limit_clause, $page_no, $page_name, $order_direction, "top"); } ?> 434 434 <table class="data"> 435 435 <thead> … … 445 445 <a href='<?php echo($page_name); ?>&<?php echo($table_name); ?>_order_by=<?php echo($field_name); ?>&<?php echo($table_name); ?>_order_direction=<?php echo($change_order_direction); ?>&<?php echo($table_name."_page"); ?>=<?php echo($page_no); ?>&<?php echo($table_name); ?>_filters=<?php echo(implode(",", $filters)); echo($params_filter); ?>'> 446 446 <?php } ?> 447 <?php echo( TomM8::titlize_str($field_name)); ?>447 <?php echo($this->titlize_str($field_name)); ?> 448 448 <?php if ($sortable_columns) { 449 449 if ($_GET[$table_name."_order_by"] == $field_name) { … … 468 468 <td class='<?php echo(esc_html(strtolower(str_replace("_", "-", $field_name)))); ?>'> 469 469 <?php 470 if ( TomM8::is_valid_datetime($result->$field_name)) {470 if ($this->is_valid_datetime($result->$field_name)) { 471 471 echo(date($date_format, strtotime($result->$field_name ))); 472 472 } else { … … 489 489 </tbody> 490 490 </table> 491 <?php if ($paginate_table) { TomM8::generate_datatable_pagination($table_name, $total_count, $limit_clause, $page_no, $page_name, $order_direction, "bottom"); } ?>491 <?php if ($paginate_table) { $this->generate_datatable_pagination($table_name, $total_count, $limit_clause, $page_no, $page_name, $order_direction, "bottom"); } ?> 492 492 <?php } else { 493 493 … … 511 511 $total_number_pages = intval($total_count / $limit_clause); 512 512 $params_filter = ""; 513 $filters = explode(",", TomM8::get_query_string_value($table_name."_filters"));514 $params_filter .= "&".$table_name."_filters=". TomM8::get_query_string_value($table_name."_filters");513 $filters = explode(",", $this->get_query_string_value($table_name."_filters")); 514 $params_filter .= "&".$table_name."_filters=".$this->get_query_string_value($table_name."_filters"); 515 515 foreach ($filters as $filter) { 516 if ( TomM8::get_query_string_value("filter_".$filter) != "") {517 $params_filter .= "&filter_".$filter."=". TomM8::get_query_string_value("filter_".$filter);516 if ($this->get_query_string_value("filter_".$filter) != "") { 517 $params_filter .= "&filter_".$filter."=".$this->get_query_string_value("filter_".$filter); 518 518 } 519 519 } … … 552 552 echo("Fields Array, can only accept an array of field names."); 553 553 } else { 554 $result = TomM8::get_row_by_id($table_name, $fields_array, $id_column_name, $id);554 $result = $this->get_row_by_id($table_name, $fields_array, $id_column_name, $id); 555 555 echo("<dl>"); 556 556 foreach($fields_array as $field) { … … 623 623 624 624 if (preg_match("/date | date|^date$/i", $validation)) { 625 if (! TomM8::is_valid_datetime($value)) {625 if (!$this->is_valid_datetime($value)) { 626 626 if (!preg_match("/must be a date/", $_SESSION[$error_session_name])) { 627 627 $_SESSION[$error_session_name] .= " must be a date. "; … … 632 632 633 633 if (preg_match("/email | email|^email$/i", $validation)) { 634 if (! TomM8::is_valid_email($value)) {634 if (!$this->is_valid_email($value)) { 635 635 if (!preg_match("/must be a valid email address/", $_SESSION[$error_session_name])) { 636 636 $_SESSION[$error_session_name] .= " must be a valid email address. "; … … 641 641 642 642 if (preg_match("/multi-emails | multi-emails|^multi-emails$/i", $validation)) { 643 if (! TomM8::is_valid_emails($value)) {643 if (!$this->is_valid_emails($value)) { 644 644 if (!preg_match("/must have valid email addressess, separated by commas/", $_SESSION[$error_session_name])) { 645 645 $_SESSION[$error_session_name] .= " must have valid email addressess, separated by commas. "; … … 657 657 $validate_form = true; 658 658 foreach ($validations_array as $key => $value) { 659 if (is_array( TomM8::get_query_string_value($key))) {659 if (is_array($this->get_query_string_value($key))) { 660 660 $index = 0; 661 foreach ( TomM8::get_query_string_value($key) as $sub_value) {662 if ( TomM8::validate_value($value, $sub_value, $key."_".$index."_error") == false) {661 foreach ($this->get_query_string_value($key) as $sub_value) { 662 if ($this->validate_value($value, $sub_value, $key."_".$index."_error") == false) { 663 663 $validate_form = false; 664 664 } … … 668 668 if (preg_match("/required/i", $value) && isset($_POST[$key."_0"])) { 669 669 670 if (is_array( TomM8::get_query_string_value($key."_0"))) {670 if (is_array($this->get_query_string_value($key."_0"))) { 671 671 // For checkbox fields. 672 672 $index = 0; … … 683 683 } while (isset($_POST[$key."_".$i][$index])); 684 684 685 if ( TomM8::validate_value($value, $data, $key."_".$index."_error") == false) {685 if ($this->validate_value($value, $data, $key."_".$index."_error") == false) { 686 686 echo $index; 687 687 $validate_form = false; … … 700 700 $i++; 701 701 } while (isset($_POST[$key."_".$i])); 702 if ( TomM8::validate_value($value, $data, $key."_error") == false) {702 if ($this->validate_value($value, $data, $key."_error") == false) { 703 703 $validate_form = false; 704 704 } 705 705 } 706 706 } else { 707 if ( TomM8::validate_value($value, TomM8::get_query_string_value($key), $key."_error") == false) {707 if ($this->validate_value($value, $this->get_query_string_value($key), $key."_error") == false) { 708 708 $validate_form = false; 709 709 } … … 742 742 if (count($_POST) > 0) { 743 743 if ($field_index >= 0) { 744 $field_value = TomM8::get_query_string_value($field_name, $field_index);744 $field_value = $this->get_query_string_value($field_name, $field_index); 745 745 } else { 746 $field_value = TomM8::get_query_string_value($field_name);746 $field_value = $this->get_query_string_value($field_name); 747 747 } 748 748 } … … 751 751 if ($instance == null || count($_POST) > 0) { 752 752 if ($field_index >= 0) { 753 $field_value = TomM8::get_query_string_value($field_name, $field_index);753 $field_value = $this->get_query_string_value($field_name, $field_index); 754 754 } else { 755 $field_value = TomM8::get_query_string_value($field_name);755 $field_value = $this->get_query_string_value($field_name); 756 756 } 757 757 } … … 844 844 echo("<li><input type='hidden' name='".$field_name."_".$i.$field_checkbox_array."' value='' />"); 845 845 846 $field_value = TomM8::get_query_string_value($field_name."_".$i, $field_index);846 $field_value = $this->get_query_string_value($field_name."_".$i, $field_index); 847 847 $field_value = str_replace("&", "&", htmlentities(htmlentities($field_value, ENT_NOQUOTES), ENT_QUOTES)); 848 848 $checked_value = ""; … … 881 881 function add_option_form_field($field_type, $field_label, $field_id, $option_name, $field_attributes = array(), $container_element, $container_attributes = array(), $value_options = array(), $field_index = -1) { 882 882 883 TomM8::add_form_field(null, $field_type, $field_label, $field_id, "tomm8te_admin_option::".$option_name, $field_attributes, $container_element, $container_attributes, $value_options, $field_index);883 $this->add_form_field(null, $field_type, $field_label, $field_id, "tomm8te_admin_option::".$option_name, $field_attributes, $container_element, $container_attributes, $value_options, $field_index); 884 884 } 885 885 -
wp-seo-redirect-301/trunk/readme.txt
r1454418 r2131384 3 3 Tags: seo, redirect, 301, slug 4 4 Requires at least: 3.0.1 5 Tested up to: 4.5.36 Stable tag: 2.2. 25 Tested up to: 5.2.2 6 Stable tag: 2.2.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 == Installation == 25 25 26 1) Install WordPress 4.5.3or higher26 1) Install WordPress 5.2.2 or higher 27 27 28 28 2) Download the latest from: … … 43 43 == Changelog == 44 44 45 = 2.2.3 = 46 47 * Fix issue with debug=true. 48 45 49 = 2.2.2 = 46 50 … … 182 186 == Upgrade notice == 183 187 188 = 2.2.3 = 189 190 * Fix issue with debug=true. 191 184 192 = 2.2.2 = 185 193 -
wp-seo-redirect-301/trunk/seo_redirect_301s.php
r1454418 r2131384 4 4 Plugin URI: http://wordpress.org/extend/plugins/wp-seo-redirect-301/ 5 5 Description: Records urls and if a pages url changes, system redirects old url to the updated url. 6 Version: 2.2. 26 Version: 2.2.3 7 7 Author: Tom Skroza 8 8 License: GPL2 … … 59 59 // Save history of slugs/permalinks for the saved page and child pages. 60 60 function seo_redirect_save_current_slug( $postid ) { 61 $abcTom = new TomM8(); 61 62 62 $my_revision = TomM8::get_row("posts", "*", "post_type='revision' AND ID=".$postid);63 $my_revision = $abcTom->get_row("posts", "*", "post_type='revision' AND ID=".$postid); 63 64 if ($my_revision != null) { 64 $my_post = TomM8::get_row("posts", "*", "post_type IN ('page', 'post') AND ID=".$my_revision->post_parent);65 66 if ( TomM8::get_row("slug_history", "*", "post_id='".$my_post->ID."' AND url='".get_permalink( $my_post->ID )."'") == null) {67 TomM8::insert_record("slug_history", array( 'post_id' => $my_post->ID, 'url' => get_permalink( $my_post->ID )));65 $my_post = $abcTom->get_row("posts", "*", "post_type IN ('page', 'post') AND ID=".$my_revision->post_parent); 66 67 if ($abcTom->get_row("slug_history", "*", "post_id='".$my_post->ID."' AND url='".get_permalink( $my_post->ID )."'") == null) { 68 $abcTom->insert_record("slug_history", array( 'post_id' => $my_post->ID, 'url' => get_permalink( $my_post->ID ))); 68 69 } 69 70 70 71 $child_pages = get_posts( array('post_type' => 'page','post_parent' => $my_post->ID,'orderby' => 'menu_order')); 71 72 foreach ($child_pages as $child_page) { 72 if ( TomM8::get_row("slug_history", "*", "post_id='".$child_page->ID."' AND url='".get_permalink( $child_page->ID )."'") == null) {73 TomM8::insert_record("slug_history", array( 'post_id' => $child_page->ID, 'url' => get_permalink( $child_page->ID )));73 if ($abcTom->get_row("slug_history", "*", "post_id='".$child_page->ID."' AND url='".get_permalink( $child_page->ID )."'") == null) { 74 $abcTom->insert_record("slug_history", array( 'post_id' => $child_page->ID, 'url' => get_permalink( $child_page->ID ))); 74 75 } 75 76 } … … 81 82 function seo_redirect_curl_page_url() { 82 83 $pageURL = 'http'; 83 if ( $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}84 if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";} 84 85 $pageURL .= "://"; 85 86 $pageURL .= $_SERVER["SERVER_NAME"].preg_replace("/\/$/", "", $_SERVER["REQUEST_URI"]); … … 90 91 // Check if page exists. 91 92 function seo_redirect_slt_theme_filter_404() { 92 93 $abcTom = new TomM8(); 93 94 // Check if url has a query string. 94 95 if (!preg_match("/\?/", seo_redirect_curl_page_url())) { … … 103 104 104 105 $post_template_name = ""; 105 $page_slug = str_replace(get_option("siteurl"), "", TomM8::get_current_url());106 $page_slug = str_replace(get_option("siteurl"), "", $abcTom->get_current_url()); 106 107 $page_slug = preg_replace("/\?(.+)*$/", "", $page_slug); 107 108 $args=array( … … 129 130 130 131 // Try to find record of a page with the current url (with no query string). 131 $row = TomM8::get_row("slug_history", "*", "post_id <> 0 AND url='".$seo_redirect_curl_page_url."/'");132 $row = $abcTom->get_row("slug_history", "*", "post_id <> 0 AND url='".$seo_redirect_curl_page_url."/'"); 132 133 if ($row->post_id == "") { 133 $row = TomM8::get_row("slug_history", "*", "post_id <> 0 AND url='".$seo_redirect_curl_page_url."'");134 $row = $abcTom->get_row("slug_history", "*", "post_id <> 0 AND url='".$seo_redirect_curl_page_url."'"); 134 135 } 135 136 136 137 if ($row != null) { 137 138 // Record found, find id of old url, now use id to find current slug/permalink. 138 $post_row = TomM8::get_row("posts", "*", "ID=".$row->post_id);139 $post_row = $abcTom->get_row("posts", "*", "ID=".$row->post_id); 139 140 // Test to see if url is still the current url. 140 if (str_replace(":443", "", TomM8::get_current_url()) != get_permalink($row->post_id)) {141 if (str_replace(":443", "", $abcTom->get_current_url()) != get_permalink($row->post_id)) { 141 142 // The url isn't current, so redirect. 142 143 $transfer_query_string = ""; … … 177 178 } 178 179 function seo_redirect_admin_page_widget_box() { 179 180 $abcTom = new TomM8(); 180 181 if (isset($_GET["delete_url"]) && isset($_GET["post"])) { 181 $record = TomM8::get_row("slug_history", array("post_id", "url"), "post_id=".$_GET["post"]."&url='".$_GET["delete_url"]."'");182 $record = $abcTom->get_row("slug_history", array("post_id", "url"), "post_id=".$_GET["post"]."&url='".$_GET["delete_url"]."'"); 182 183 // Check if slug history record exists 183 184 if ($record) { … … 202 203 /* Prints the box content */ 203 204 function seo_redirect_inner_custom_box( $post ) { 204 205 $abcTom = new TomM8(); 205 206 // Use nonce for verification 206 207 wp_nonce_field( plugin_basename( __FILE__ ), 'seo_redirect_noncename' ); 207 208 208 $my_redirects = TomM8::get_results("slug_history", "*", "post_id=".$post->ID);209 $my_redirects = $abcTom->get_results("slug_history", "*", "post_id=".$post->ID); 209 210 ?> 210 211 <p> … … 269 270 270 271 if ($_POST['seo_redirect_url'] != "") { 271 TomM8::insert_record("slug_history", array("post_id" => $post_ID, "url" => $redirect_url)); 272 $abcTom = new TomM8(); 273 $abcTom->insert_record("slug_history", array("post_id" => $post_ID, "url" => $redirect_url)); 272 274 } 273 275 … … 291 293 */ 292 294 function seo_redirect_301_do_this_daily() { 293 295 $abcTom = new TomM8(); 294 296 if (defined("DISABLE_301_SITEMAP") && DISABLE_301_SITEMAP) { 295 297 // Do nothing. 296 298 } else { 297 $my_redirects = TomM8::get_results("slug_history", "*", "");299 $my_redirects = $abcTom->get_results("slug_history", "*", ""); 298 300 $content = "<?xml version='1.0' encoding='UTF-8'?><urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'>"; 299 301 foreach ($my_redirects as $redirect) { … … 310 312 } 311 313 $content .= "</urlset>"; 312 TomM8::write_to_file($content, ABSPATH."/301-sitemap.xml");314 $abcTom->write_to_file($content, ABSPATH."/301-sitemap.xml"); 313 315 } 314 316 -
wp-seo-redirect-301/trunk/seo_redirect_list.php
r1327092 r2131384 9 9 admin_url("admin.php?page=wp-seo-redirect-301/seo_redirect_list.php", 200); 10 10 } 11 $my_redirects = TomM8::get_results("slug_history", "*", ""); 11 12 $abcTom = new TomM8(); 13 $my_redirects = $abcTom->get_results("slug_history", "*", ""); 12 14 13 15 wp_enqueue_script('jquery'); … … 54 56 </div> 55 57 56 <?php TomM8::add_social_share_links("http://wordpress.org/extend/plugins/wp-seo-redirect-301"); ?>58 <?php $abcTom->add_social_share_links("http://wordpress.org/extend/plugins/wp-seo-redirect-301"); ?>
Note: See TracChangeset
for help on using the changeset viewer.