{
global $wpdb;
$currentPostArray = get_option(GLM_WP_IMPORT_POST_OPTION, array());
+ echo '<pre>' . print_r($currentPostArray, true) . '</pre>';
$this->_connect();
echo '<p>Replace page url\'s</p>';
$searchUrl = $this->_options['site_url'];
foreach ($matches[0] as $match) {
// find the page id for matched url
if (preg_match(';-([0-9]+)/$;', $match, $found)) {
- if ($found) {
- echo '<pre>' . print_r($found, true) . '</pre>';
- $toolboxPageName = $this->_getPageTitleById($found[1]);
- echo '<pre>' . print_r($toolboxPageName, true) . '</pre>';
- $wpPost = get_page_by_title($toolboxPageName);
+ echo '<pre>' . print_r($found, true) . '</pre>';
+ if ($found && $currentPostArray[$found[1]]) {
+ $wpPost = get_page($currentPostArray[$found[1]]);
$replaceUrl = get_permalink($wpPost->ID);
echo '<pre>' . print_r($replaceUrl, true) . '</pre>';
$content = str_replace($match, $replaceUrl, $content);
echo '<pre>'.htmlspecialchars($isMatch[1][$index]).'</pre>';
//echo '<pre>'.htmlspecialchars(basename($isMatch[1][$index])).'</pre>';
//echo '<pre>'.print_r(pathinfo($isMatch[1][$index]), true).'</pre>';
- $fileName = basename($isMatch[1][$index]);
+ $fileInfo = pathinfo($isMatch[1][$index]);
+ $fileName = $fileInfo['filename'];
echo '<pre>File Name: ' . print_r($fileName, true) . '</pre>';
+ echo '<pre>File Name: ' . print_r($fileInfo, true) . '</pre>';
$fileTitle = $isMatch[2][$index];
echo '<pre>File Title: ' . print_r($fileTitle, true) . '</pre>';
$key = $this->_getAttachmentByName($fileName);
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 '<p><a href="admin.php?import=toolbox&step=5&start=0">CkImages</a></p>';
echo '<p><a href="admin.php?import=toolbox&step=1">Begin Import</a></p>';
$currentPostArray = get_option(GLM_WP_IMPORT_POST_OPTION, array());
echo '<pre>' . print_r($currentPostArray, true) . '</pre>';
break;
case 2:
echo '<p>Done</p>';
- echo '<p><a href="admin.php?import=toolbox&step=3">Step Three (Updating Image Ref)</a></p>';
- //echo '<p><a href="admin.php?import=toolbox&step=3">Part 3</a></p>';
- break;
- case 'z':
echo '<p>Now processing the images from old database tables</p>';
$this->_images = array();
$this->_storeImages();
$this->_files = array();
$this->_storeFiles();
- $this->_getCkImages();
- $this->_getToolboxFiles();
- $this->_getParagraphImages();
- //$this->_replaceSrc();
- //$this->_replaceKeywords();
- //$this->replaceIsoUrls();
- echo '<p>Done</p>';
+ if ($this->_options['toolbox_page_table'] == 'pages') {
+ $this->_getCkImages();
+ $this->_getToolboxFiles();
+ $this->_getParagraphImages();
+ echo '<p>Done</p>';
+ } else {
+ echo '<p>No import from images</p>';
+ }
echo '<p><a href="admin.php?import=toolbox&step=3">Step Three (Updating Image Ref)</a></p>';
- //echo '<p><a href="admin.php?import=toolbox&step=3">Part 3</a></p>';
break;
case 3:
echo '<p>Phase Three</p>';