From: Steve Sutton Date: Mon, 11 Sep 2017 16:59:17 +0000 (-0400) Subject: Update the upload process X-Git-Tag: v1.0.6^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=edf5d2637d976cdbfcfeb3811868ce2854f45f9f;p=WP-Plugins%2Fglm-wp-importer.git Update the upload process Redo the pattern for searching for url with the files. --- diff --git a/controllers/ToolboxImport.php b/controllers/ToolboxImport.php index 38937ff..695f599 100644 --- a/controllers/ToolboxImport.php +++ b/controllers/ToolboxImport.php @@ -926,7 +926,7 @@ global $wpdb; $currentPostArray = get_option(GLM_WP_IMPORT_POST_OPTION, array()); $files = get_option(GLM_WP_IMPORT_FILES_OPTION, array()); - echo '
' . print_r($files, true) . '
'; + //echo '
' . print_r($files, true) . '
'; //$images = get_option(GLM_WP_IMPORT_IMAGES_OPTION, array()); //$media = array_merge($images, $files); //echo '
' . print_r($media, true) . '
'; @@ -941,10 +941,11 @@ foreach ($results as $post) { $content = $post->post_content; echo '
'; - $urlPattern = '%]*)" ?[^>]*>([^>]+)%s'; + $urlPattern = '%$urlPattern: ' . htmlspecialchars( $urlPattern ) . ''; if (preg_match_all($urlPattern, $content, $isMatch)) { $isMatchCount = count($isMatch[0]); - echo '

Matches is0 ' . $isMatchCount . '

'; + echo '

Matches file url ' . $isMatchCount . '

'; for ($index = 0; $index < $isMatchCount; ++$index) { echo '
'.htmlspecialchars($isMatch[1][$index]).'
'; //echo '
'.htmlspecialchars(basename($isMatch[1][$index])).'
'; @@ -952,16 +953,14 @@ $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)  . '
'; + echo '
File Info: ' . print_r($fileInfo, true)  . '
'; $key = $this->_getAttachmentByName($fileName); echo '
Key: ' . print_r($key, true)  . '
'; // check on format of filename - if (!$key && ($fileName && $fileTitle)) { + if (!$key && ($fileName)) { $key = $this->_handleMediaFile( $fileInfo['basename'], - $fileTitle, + $fileName, '', $post->ID, $this->_options['toolbox_files_url'] . '/'