From b4fc71f6aab140877729a7f0d3a9ce26eaec9c71 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 17 Aug 2015 14:33:20 -0400 Subject: [PATCH] finals on the western up testing --- controllers/Import.php | 46 ++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/controllers/Import.php b/controllers/Import.php index 18abce9..a9833c8 100644 --- a/controllers/Import.php +++ b/controllers/Import.php @@ -669,6 +669,7 @@ { global $wpdb; $currentPostArray = get_option(GLM_WP_IMPORT_POST_OPTION, array()); + echo '
' . print_r($currentPostArray, true) . '
'; $this->_connect(); echo '

Replace page url\'s

'; $searchUrl = $this->_options['site_url']; @@ -692,11 +693,9 @@ foreach ($matches[0] as $match) { // find the page id for matched url if (preg_match(';-([0-9]+)/$;', $match, $found)) { - if ($found) { - echo '
' . print_r($found, true) . '
'; - $toolboxPageName = $this->_getPageTitleById($found[1]); - echo '
' . print_r($toolboxPageName, true) . '
'; - $wpPost = get_page_by_title($toolboxPageName); + echo '
' . print_r($found, true) . '
'; + if ($found && $currentPostArray[$found[1]]) { + $wpPost = get_page($currentPostArray[$found[1]]); $replaceUrl = get_permalink($wpPost->ID); echo '
' . print_r($replaceUrl, true) . '
'; $content = str_replace($match, $replaceUrl, $content); @@ -952,8 +951,10 @@ echo '
'.htmlspecialchars($isMatch[1][$index]).'
'; //echo '
'.htmlspecialchars(basename($isMatch[1][$index])).'
'; //echo '
'.print_r(pathinfo($isMatch[1][$index]), true).'
'; - $fileName = basename($isMatch[1][$index]); + $fileInfo = pathinfo($isMatch[1][$index]); + $fileName = $fileInfo['filename']; echo '
File Name: ' . print_r($fileName, true)  . '
'; + echo '
File Name: ' . print_r($fileInfo, true)  . '
'; $fileTitle = $isMatch[2][$index]; echo '
File Title: ' . print_r($fileTitle, true)  . '
'; $key = $this->_getAttachmentByName($fileName); @@ -1277,19 +1278,6 @@ switch($step) { case 0: $this->_greet(); - //$this->_post = array( - //49 => 5546, - //50 => 5547, - //51 => 5548, - //52 => 5549, - //210 => 5550, - //388 => 5551, - //562 => 5552, - //563 => 5553 - //); - //$this->_storePost(); - //$this->_readOptions(); - //echo '

CkImages

'; echo '

Begin Import

'; $currentPostArray = get_option(GLM_WP_IMPORT_POST_OPTION, array()); echo '
' . print_r($currentPostArray, true) . '
'; @@ -1317,24 +1305,20 @@ break; case 2: echo '

Done

'; - echo '

Step Three (Updating Image Ref)

'; - //echo '

Part 3

'; - break; - case 'z': echo '

Now processing the images from old database tables

'; $this->_images = array(); $this->_storeImages(); $this->_files = array(); $this->_storeFiles(); - $this->_getCkImages(); - $this->_getToolboxFiles(); - $this->_getParagraphImages(); - //$this->_replaceSrc(); - //$this->_replaceKeywords(); - //$this->replaceIsoUrls(); - echo '

Done

'; + if ($this->_options['toolbox_page_table'] == 'pages') { + $this->_getCkImages(); + $this->_getToolboxFiles(); + $this->_getParagraphImages(); + echo '

Done

'; + } else { + echo '

No import from images

'; + } echo '

Step Three (Updating Image Ref)

'; - //echo '

Part 3

'; break; case 3: echo '

Phase Three

'; -- 2.17.1