]> git.mjollnir.org Git - s9y.git/commitdiff
accept multiple categories
authorgarvinhicking <garvinhicking>
Thu, 16 Mar 2006 16:15:50 +0000 (16:15 +0000)
committergarvinhicking <garvinhicking>
Thu, 16 Mar 2006 16:15:50 +0000 (16:15 +0000)
include/admin/importers/movabletype.inc.php

index b33c9185c584f8f6ac0f0a256ef2181dc9d1ccea..7acfc4d3831f07f2cff250f676e7cc531eafabdf 100644 (file)
@@ -101,7 +101,7 @@ class Serendipity_Import_MovableType extends Serendipity_Import {
                     // Post mediam, add 12 hours.
                     $match[4] = $match[4] + 12;
                 }
-                
+
                 $ts = mktime($match[4], $match[5], $match[6], $match[1], $match[2], $match[3]);
                 $this->debug('Matched string date format: ' . $ts);
             }
@@ -110,7 +110,7 @@ class Serendipity_Import_MovableType extends Serendipity_Import {
         if ($ts <= 1) {
             $ts = time();
         }
-        
+
         return $ts;
     }
 
@@ -176,24 +176,28 @@ class Serendipity_Import_MovableType extends Serendipity_Import {
 
                 case 'PRIMARY CATEGORY':
                 case 'CATEGORY':
-                      $cat_found = false;
-                      if ( is_array($this->categories) ) {
-                          for ( $y=0 ; $y<sizeof($this->categories) ; $y++ ) {
-                              if ( $this->categories[$y]['category_name'] == $data ) {
-                                  $cat_found = true;
-                                  break;
-                              }
-                          }
-                          if ( $cat_found){
-                              if (!in_array($this->categories[$y]['categoryid'], $entry['categories']) ) {
-                                  //$entries[$n]['categories'][] = $categories[$y]['categoryid'];
-                                  $entry['categories'][] = $this->categories[$y]['categoryid'];
-                              }
-                          }else {
-                              $tasks[] = sprintf(CREATE_CATEGORY, htmlspecialchars($data));
-                          }
-                      }
-                      break;
+                    $categories = explode("\0", $data);
+                    foreach($categories AS $data) {
+                        $data = trim($data);
+                        $cat_found  = false;
+                        if (is_array($this->categories)) {
+                            for ( $y=0 ; $y<sizeof($this->categories) ; $y++ ) {
+                                if ( $this->categories[$y]['category_name'] == $data ) {
+                                    $cat_found = true;
+                                    break;
+                                }
+                            }
+                            if ($cat_found) {
+                                if (!in_array($this->categories[$y]['categoryid'], $entry['categories']) ) {
+                                    //$entries[$n]['categories'][] = $categories[$y]['categoryid'];
+                                    $entry['categories'][] = $this->categories[$y]['categoryid'];
+                                }
+                            } else {
+                                $tasks[] = sprintf(CREATE_CATEGORY, htmlspecialchars($data));
+                            }
+                        }
+                    }
+                    break;
             }
         }
         $entry['props'] = $entryprops;
@@ -399,7 +403,11 @@ class Serendipity_Import_MovableType extends Serendipity_Import {
                         $comment[$c_el] = $content;
                     } else {
                         $this->debug("Appending to entry: $line");
-                        $entry[$c_el]   = $content;
+                        if (isset($entry[$c_el])) {
+                            $entry[$c_el] .= "\0" . $content;
+                        } else {
+                            $entry[$c_el]   = $content;
+                        }
                     }
                 }
             } elseif ($is_comment || $is_trackback) {
@@ -419,7 +427,7 @@ class Serendipity_Import_MovableType extends Serendipity_Import {
                     $entry['authorid'] = $serendipity['authorid'];
                     $entry['author']   = $serendipity['realname'];
                 }
-                
+
                 if (!isset($entry['isdraft'])) {
                     $entry['isdraft'] = 'false';
                 }