Plugin Directory

Changeset 2131384


Ignore:
Timestamp:
07/31/2019 11:59:20 AM (7 years ago)
Author:
MMDeveloper
Message:

Fix issues with debug=true

Location:
wp-seo-redirect-301
Files:
17 added
4 edited

Legend:

Unmodified
Added
Removed
  • wp-seo-redirect-301/trunk/lib/tom-m8te.php

    r1326125 r2131384  
    7575    function get_current_url() {
    7676      $pageURL = 'http';
    77       if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     77      if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    7878      $pageURL .= "://";
    7979      if ($_SERVER["SERVER_PORT"] != "80") {
     
    121121      if ($index == -1) {
    122122        if (isset($_POST[$name])) {
    123           return TomM8::fix_http_quotes($_POST[$name]);
     123          return $this->fix_http_quotes($_POST[$name]);
    124124        } else if (isset($_GET[$name])) {
    125           return TomM8::fix_http_quotes($_GET[$name]);
     125          return $this->fix_http_quotes($_GET[$name]);
    126126        } else if (isset($_POST[$name."_0"])) {
    127127            $i = 0;
     
    134134              $i++;
    135135            } 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);
    138138        } else {
    139139          return "";
     
    142142        $name = str_replace("[]", "", $name);
    143143        if (isset($_POST[$name][$index])) {
    144           return TomM8::fix_http_quotes($_POST[$name][$index]);
     144          return $this->fix_http_quotes($_POST[$name][$index]);
    145145        } else if (isset($_GET[$name][$index])) {
    146           return TomM8::fix_http_quotes($_GET[$name][$index]);
     146          return $this->fix_http_quotes($_GET[$name][$index]);
    147147        } else if (isset($_POST[$name."_0"][$index])) {
    148148            $i = 0;
     
    155155              $i++;
    156156            } 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);
    159159        } else {
    160160          return "";
     
    224224            wp_update_attachment_metadata( $attach_id,  $attach_data );
    225225            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);
    227227            // echo $filedest;
    228228          }
     
    370370        $extra_where = array();
    371371        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"));
    374374            foreach ($filters as $filter) {
    375               if (TomM8::get_query_string_value("filter_".$filter) != "") {
     375              if ($this->get_query_string_value("filter_".$filter) != "") {
    376376                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)."%'"); 
    378378                }
    379379              }
     
    393393        }
    394394
    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);
    396396       
    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));
    398398
    399399        echo("<div class=\"postbox\" style=\"display: block; \"><div class=\"inside\">");
     
    410410                foreach($filter_arrays as $filter_array) {
    411411                  foreach($filter_array as $key => $value) {
    412                     if (TomM8::get_query_string_value("filter_".$key) != "") {
     412                    if ($this->get_query_string_value("filter_".$key) != "") {
    413413                      if (isset($_POST["action"]) && $_POST["action"] == "Reset") {
    414414                        $_POST["filter_".$key] = "";
    415415                      }
    416                       $params_filter .= "&filter_".$key."=".TomM8::get_query_string_value("filter_".$key);
     416                      $params_filter .= "&filter_".$key."=".$this->get_query_string_value("filter_".$key);
    417417                    }
    418418                    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"]);
    420420                  }
    421421                }
     
    431431        }
    432432        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"); } ?>
    434434            <table class="data">
    435435              <thead>
     
    445445                        <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); ?>'>
    446446                      <?php } ?>
    447                       <?php echo(TomM8::titlize_str($field_name)); ?>
     447                      <?php echo($this->titlize_str($field_name)); ?>
    448448                      <?php if ($sortable_columns) {
    449449                        if ($_GET[$table_name."_order_by"] == $field_name) {
     
    468468                      <td class='<?php echo(esc_html(strtolower(str_replace("_", "-", $field_name)))); ?>'>
    469469                        <?php
    470                           if (TomM8::is_valid_datetime($result->$field_name)) {
     470                          if ($this->is_valid_datetime($result->$field_name)) {
    471471                            echo(date($date_format, strtotime($result->$field_name )));
    472472                          } else {
     
    489489              </tbody>
    490490            </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"); } ?>
    492492        <?php } else {
    493493
     
    511511      $total_number_pages = intval($total_count / $limit_clause);
    512512        $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");
    515515        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);
    518518          }
    519519        }
     
    552552        echo("Fields Array, can only accept an array of field names.");
    553553      } 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);
    555555        echo("<dl>");
    556556        foreach($fields_array as $field) {
     
    623623
    624624        if (preg_match("/date | date|^date$/i", $validation)) {
    625           if (!TomM8::is_valid_datetime($value)) {
     625          if (!$this->is_valid_datetime($value)) {
    626626            if (!preg_match("/must be a date/", $_SESSION[$error_session_name])) {
    627627              $_SESSION[$error_session_name] .= " must be a date. ";
     
    632632
    633633        if (preg_match("/email | email|^email$/i", $validation)) {
    634           if (!TomM8::is_valid_email($value)) {
     634          if (!$this->is_valid_email($value)) {
    635635            if (!preg_match("/must be a valid email address/", $_SESSION[$error_session_name])) {
    636636              $_SESSION[$error_session_name] .= " must be a valid email address. ";
     
    641641
    642642        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)) {
    644644            if (!preg_match("/must have valid email addressess, separated by commas/", $_SESSION[$error_session_name])) {
    645645              $_SESSION[$error_session_name] .= " must have valid email addressess, separated by commas. ";
     
    657657      $validate_form = true;
    658658      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))) {
    660660          $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) {
    663663              $validate_form = false;
    664664            }
     
    668668          if (preg_match("/required/i", $value) && isset($_POST[$key."_0"])) {
    669669
    670             if (is_array(TomM8::get_query_string_value($key."_0"))) {
     670            if (is_array($this->get_query_string_value($key."_0"))) {
    671671              // For checkbox fields.
    672672              $index = 0;
     
    683683                } while (isset($_POST[$key."_".$i][$index]));
    684684               
    685                 if (TomM8::validate_value($value, $data, $key."_".$index."_error") == false) {
     685                if ($this->validate_value($value, $data, $key."_".$index."_error") == false) {
    686686                  echo $index;
    687687                  $validate_form = false;
     
    700700                $i++;
    701701              } 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) {
    703703                $validate_form = false;
    704704              }
    705705            }
    706706          } 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) {
    708708              $validate_form = false;
    709709            }
     
    742742        if (count($_POST) > 0) {
    743743          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);
    745745          } else {
    746             $field_value = TomM8::get_query_string_value($field_name);
     746            $field_value = $this->get_query_string_value($field_name);
    747747          }
    748748        }
     
    751751        if ($instance == null || count($_POST) > 0) {
    752752          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);
    754754          } else {
    755             $field_value = TomM8::get_query_string_value($field_name);
     755            $field_value = $this->get_query_string_value($field_name);
    756756          }
    757757        }
     
    844844            echo("<li><input type='hidden' name='".$field_name."_".$i.$field_checkbox_array."' value='' />");
    845845
    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);
    847847            $field_value = str_replace("&amp;", "&", htmlentities(htmlentities($field_value, ENT_NOQUOTES), ENT_QUOTES));
    848848            $checked_value = "";
     
    881881    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) {
    882882
    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);
    884884    }
    885885
  • wp-seo-redirect-301/trunk/readme.txt

    r1454418 r2131384  
    33Tags: seo, redirect, 301, slug
    44Requires at least: 3.0.1
    5 Tested up to: 4.5.3
    6 Stable tag: 2.2.2
     5Tested up to: 5.2.2
     6Stable tag: 2.2.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2424== Installation ==
    2525
    26 1) Install WordPress 4.5.3 or higher
     261) Install WordPress 5.2.2 or higher
    2727
    28282) Download the latest from:
     
    4343== Changelog ==
    4444
     45= 2.2.3 =
     46
     47* Fix issue with debug=true.
     48
    4549= 2.2.2 =
    4650
     
    182186== Upgrade notice ==
    183187
     188= 2.2.3 =
     189
     190* Fix issue with debug=true.
     191
    184192= 2.2.2 =
    185193
  • wp-seo-redirect-301/trunk/seo_redirect_301s.php

    r1454418 r2131384  
    44Plugin URI: http://wordpress.org/extend/plugins/wp-seo-redirect-301/
    55Description: Records urls and if a pages url changes, system redirects old url to the updated url.
    6 Version: 2.2.2
     6Version: 2.2.3
    77Author: Tom Skroza
    88License: GPL2
     
    5959// Save history of slugs/permalinks for the saved page and child pages.
    6060function seo_redirect_save_current_slug( $postid ) {
     61  $abcTom = new TomM8();
    6162 
    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);
    6364  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 )));
    6869    }
    6970
    7071    $child_pages = get_posts( array('post_type' => 'page','post_parent' => $my_post->ID,'orderby' => 'menu_order'));
    7172    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 )));
    7475      }
    7576    }
     
    8182function seo_redirect_curl_page_url() {
    8283 $pageURL = 'http';
    83  if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     84 if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    8485 $pageURL .= "://";
    8586 $pageURL .= $_SERVER["SERVER_NAME"].preg_replace("/\/$/", "", $_SERVER["REQUEST_URI"]);
     
    9091// Check if page exists.
    9192function seo_redirect_slt_theme_filter_404() { 
    92  
     93  $abcTom = new TomM8();
    9394  // Check if url has a query string.
    9495  if (!preg_match("/\?/", seo_redirect_curl_page_url())) {
     
    103104
    104105      $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());
    106107      $page_slug = preg_replace("/\?(.+)*$/", "", $page_slug);
    107108      $args=array(
     
    129130
    130131        // 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."/'");
    132133        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."'");
    134135        }
    135136
    136137        if ($row != null) {
    137138          // 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);
    139140          // 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)) {
    141142            // The url isn't current, so redirect.
    142143            $transfer_query_string = "";
     
    177178}
    178179function seo_redirect_admin_page_widget_box() {
    179  
     180  $abcTom = new TomM8();
    180181  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"]."'");
    182183    // Check if slug history record exists
    183184    if ($record) {
     
    202203/* Prints the box content */
    203204function seo_redirect_inner_custom_box( $post ) {
    204 
     205  $abcTom = new TomM8();
    205206  // Use nonce for verification
    206207  wp_nonce_field( plugin_basename( __FILE__ ), 'seo_redirect_noncename' ); 
    207208 
    208   $my_redirects = TomM8::get_results("slug_history", "*", "post_id=".$post->ID);
     209  $my_redirects = $abcTom->get_results("slug_history", "*", "post_id=".$post->ID);
    209210  ?>
    210211  <p>
     
    269270
    270271  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));
    272274  }
    273275
     
    291293 */
    292294function seo_redirect_301_do_this_daily() {
    293 
     295  $abcTom = new TomM8();
    294296  if (defined("DISABLE_301_SITEMAP") && DISABLE_301_SITEMAP) {
    295297    // Do nothing.
    296298  } else {
    297     $my_redirects = TomM8::get_results("slug_history", "*", "");
     299    $my_redirects = $abcTom->get_results("slug_history", "*", "");
    298300    $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'>";
    299301      foreach ($my_redirects as $redirect) {
     
    310312      }
    311313    $content .= "</urlset>";
    312     TomM8::write_to_file($content, ABSPATH."/301-sitemap.xml");   
     314    $abcTom->write_to_file($content, ABSPATH."/301-sitemap.xml");   
    313315  }
    314316 
  • wp-seo-redirect-301/trunk/seo_redirect_list.php

    r1327092 r2131384  
    99  admin_url("admin.php?page=wp-seo-redirect-301/seo_redirect_list.php", 200);
    1010}
    11 $my_redirects = TomM8::get_results("slug_history", "*", "");
     11
     12$abcTom = new TomM8();
     13$my_redirects = $abcTom->get_results("slug_history", "*", "");
    1214
    1315wp_enqueue_script('jquery');
     
    5456</div>
    5557
    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.