- Timestamp:
- 11/17/13 20:25:53 (12 years ago)
- Branch:
- 2.6
- Children:
- 2567:6c11245cbf04, 2568:61c67a7d17fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/importExport/inc/class.dc.import.feed.php
r1559 r2566 16 16 protected $status = false; 17 17 protected $feed_url = ''; 18 18 19 19 public function setInfo() 20 20 { … … 23 23 $this->description = __('Add a feed content to the blog.'); 24 24 } 25 25 26 26 public function process($do) 27 27 { … … 30 30 return; 31 31 } 32 32 33 33 if (empty($_POST['feed_url'])) { 34 34 return; 35 35 } 36 36 37 37 $this->feed_url = $_POST['feed_url']; 38 38 39 39 $feed = feedReader::quickParse($this->feed_url); 40 40 if ($feed === false) { … … 44 44 throw new Exception(__('No items in feed.')); 45 45 } 46 46 47 47 $cur = $this->core->con->openCursor($this->core->prefix.'post'); 48 48 $this->core->con->begin(); … … 56 56 $cur->post_status = -2; 57 57 $cur->post_dt = strftime('%Y-%m-%d %H:%M:%S',$item->TS); 58 58 59 59 try { 60 60 $post_id = $this->core->blog->addPost($cur); … … 63 63 throw $e; 64 64 } 65 65 66 66 foreach ($item->subject as $subject) { 67 67 $this->core->meta->setPostMeta($post_id,'tag',dcMeta::sanitizeMetaID($subject)); 68 68 } 69 69 } 70 70 71 71 $this->core->con->commit(); 72 72 http::redirect($this->getURL().'&do=ok'); 73 73 74 74 } 75 75 76 76 public function gui() 77 77 { … … 79 79 dcPage::success(__('Content successfully imported.')); 80 80 } 81 81 82 82 echo 83 83 '<form action="'.$this->getURL(true).'" method="post">'. 84 84 '<p>'.sprintf(__('Add a feed content to the current blog: <strong>%s</strong>.'),html::escapeHTML($this->core->blog->name)).'</p>'. 85 85 86 86 '<p><label for="feed_url">'.__('Feed URL:').'</label>'. 87 87 form::field('feed_url',50,300,html::escapeHTML($this->feed_url)).'</p>'. 88 88 89 89 '<p>'. 90 90 $this->core->formNonce(). 91 91 form::hidden(array('do'),1). 92 92 '<input type="submit" value="'.__('Import').'" /></p>'. 93 93 94 94 '</form>'; 95 95 } 96 96 } 97 ?>
Note: See TracChangeset
for help on using the changeset viewer.