From: Steve Sutton Date: Fri, 7 Jul 2017 20:41:13 +0000 (-0400) Subject: Fix https http urls X-Git-Tag: v1.0.5^2~3 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=7195f4ee6d04d98dcfe9c1388164493cf5071f73;p=WP-Plugins%2Fglm-wp-importer.git Fix https http urls Fix for site that may have url's with https --- diff --git a/controllers/ToolboxImport.php b/controllers/ToolboxImport.php index 26b57da..dee1fa9 100644 --- a/controllers/ToolboxImport.php +++ b/controllers/ToolboxImport.php @@ -532,7 +532,7 @@ echo '

Fetching Pages

'; $this->_post = get_option(GLM_WP_IMPORT_POST_OPTION, array()); // grab all pages and build the post array - $start = filter_var($_REQUEST['start'], FILTER_VALIDATE_INT); + $start = isset( $_REQUEST['start'] ) ? filter_var( $_REQUEST['start'], FILTER_VALIDATE_INT ) : 0; $pages = $this->_fetchAllPages(); $numPagesImported = count($pages); @@ -540,12 +540,12 @@ if ($page['parent']) { } - if ( $page['title'] ) { + if ( isset( $page['title'] ) && $page['title'] ) { $pageName = $page['title']; - } else if ( $page['navigation_name'] ) { + } else if ( isset( $page['navigation_name'] ) && $page['navigation_name'] ) { $pageName = $page['navigation_name']; } else { - $pageName = $page['category']; + $pageName = isset( $page['category'] ) ? $page['category'] : ''; } // if you don't find the parent page id then use the default given or 0 $parent = isset($this->_post[$page['parent']]) @@ -1157,18 +1157,17 @@ global $wpdb; $this->_connect(); echo '

Replace IS0 url\'s

'; - $searchUrl = 'http://is0.gaslightmedia.com'; // find all pages with links to site pages $sql = " SELECT * FROM {$wpdb->prefix}posts - WHERE post_content LIKE '%{$searchUrl}%' + WHERE post_content LIKE '%http://is0.gaslightmedia.com%' OR post_content LIKE '%https://is0.gaslightmedia.com%' AND post_type = 'page'"; echo '
'.$sql.'
'; $results = $wpdb->get_results($sql, OBJECT); if (count($results) > 0) { //echo '
' . print_r($results, true) . '
'; - $pattern = ';(http://is0.gaslightmedia.com/[^"]+);si'; + $pattern = ';(https?://is0.gaslightmedia.com/[^"]+);si'; foreach ($results as $post) { $content = $post->post_content; preg_match_all($pattern, $post->post_content, $matches);