public static function wiki2xhtmlTag($url, $content) { $url = substr($url, 4); if (strpos($content, 'tag:') === 0) { $content = substr($content, 4); } $tag_url = html::stripHostURL($GLOBALS['core']->blog->url . $GLOBALS['core']->url->getBase('tag')); $res['url'] = $tag_url . '/' . rawurlencode(dcMeta::sanitizeMetaID($url)); $res['content'] = $content; return $res; }
public function process($do) { if ($do == 'ok') { $this->status = true; return; } if (empty($_POST['feed_url'])) { return; } $this->feed_url = $_POST['feed_url']; $feed = feedReader::quickParse($this->feed_url); if ($feed === false) { throw new Exception(__('Cannot retrieve feed URL.')); } if (count($feed->items) == 0) { throw new Exception(__('No items in feed.')); } if ($this->core->plugins->moduleExists('metadata')) { $meta = new dcMeta($this->core); } $cur = $this->core->con->openCursor($this->core->prefix . 'post'); $this->core->con->begin(); foreach ($feed->items as $item) { $cur->clean(); $cur->user_id = $this->core->auth->userID(); $cur->post_content = $item->content ? $item->content : $item->description; $cur->post_title = $item->title ? $item->title : text::cutString(html::clean($cur->post_content), 60); $cur->post_format = 'xhtml'; $cur->post_status = -2; $cur->post_dt = strftime('%Y-%m-%d %H:%M:%S', $item->TS); try { $post_id = $this->core->blog->addPost($cur); } catch (Exception $e) { $this->core->con->rollback(); throw $e; } if (isset($meta)) { foreach ($item->subject as $subject) { $meta->setPostMeta($post_id, 'tag', dcMeta::sanitizeMetaID($subject)); } } } $this->core->con->commit(); http::redirect($this->getURL() . '&do=ok'); }
# Licensed under the GPL version 2.0 license. # See LICENSE file or # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html # # -- END LICENSE BLOCK ------------------------------------ if (!defined('DC_CONTEXT_ADMIN')) { return; } $tag = !empty($_REQUEST['tag']) ? $_REQUEST['tag'] : ''; $this_url = $p_url . '&m=tag_posts&tag=' . rawurlencode($tag); $meta = new dcMeta($core); $page = !empty($_GET['page']) ? $_GET['page'] : 1; $nb_per_page = 30; # Rename a meta if (!empty($_POST['new_meta_id'])) { $new_id = dcMeta::sanitizeMetaID($_POST['new_meta_id']); try { if ($meta->updateMeta($tag, $new_id, 'tag')) { http::redirect($p_url . '&m=tag_posts&tag=' . $new_id . '&renamed=1'); } } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Delete a tag if (!empty($_POST['delete']) && $core->auth->check('publish,contentadmin', $core->blog->id)) { try { $meta->delMeta($tag, 'tag'); http::redirect($p_url . '&m=tags&del=1'); } catch (Exception $e) { $core->error->add($e->getMessage());