function draw() { $dash = new PageLinesDashboard(); // PageLines Plus $args = array('title' => __('Available Plus Extensions', 'pagelines'), 'data' => PageLines_RSS::get_dash_rss(array('feed' => 'http://api.pagelines.com/rss/plus.php', 'items' => 50)), 'icon' => PL_ADMIN_ICONS . '/plusbtn.png', 'excerpt-trim' => false, 'format' => 'plus-extensions'); $view = $this->get_welcome_billboard(); $view .= $dash->wrap_dashboard_pane('tips', $args); return $view; }
/** * Store RSS worker * * @package PageLines Framework * @since 2.2 */ static function get_dash_rss($args = array()) { $defaults = array('feed' => 'http://api.pagelines.com/rss/rss2.php', 'items' => 3, 'community' => false); $args = wp_parse_args($args, $defaults); $out = array(); self::$items = $args['items']; self::$feed_url = $args['feed']; $rss = fetch_feed(self::$feed_url); if (is_wp_error($rss)) { $out[] = array('title' => 'RSS Error', 'test' => $rss->get_error_message()); unset($rss); return $out; } if (!$rss->get_item_quantity()) { $out[] = array('title' => 'RSS', 'test' => 'Apparently, there is nothing new yet!'); $rss->__destruct(); unset($rss); return $out; } $items = self::$items; foreach ($rss->get_items(0, $items) as $item) { if ($enclosure = $item->get_enclosure()) { $image = $enclosure->get_link(); } else { $image = false; } $link = ''; $content = ''; $date = $item->get_date(); $link = esc_url($item->get_link()); $title = $item->get_title(); $content = $item->get_content(); if ($args['community']) { $d = self::com_url($item->get_description()); $link = $d[0]; $content = $d[1]; } $out[] = array('title' => $title, 'text' => $content, 'link' => $link, 'img' => $image); } $rss->__destruct(); unset($rss); return $out; }
function draw() { // Updates Dashboard $dashboards = ''; $updates = $this->get_updates(); $args = array('title' => __('Your Available Updates', 'pagelines'), 'data' => $updates, 'icon' => PL_ADMIN_ICONS . '/download.png', 'excerpt-trim' => 0); if (!EXTEND_NETWORK) { $dashboards = $this->dashboard_pane('updates', $args); } // PageLines Blog Dashboard $args = array('title' => __('News from the PageLines Blog', 'pagelines'), 'data' => PageLines_RSS::get_dash_rss(array('feed' => 'http://www.pagelines.com/feed/')), 'classes' => 'news-dash pl-dash-half pl-dash-space', 'icon' => PL_ADMIN_ICONS . '/welcome.png', 'footer' => sprintf('Visit <a href="%s">PageLines Blog</a>', 'http://www.pagelines.com/blog')); $dashboards .= $this->dashboard_pane('news', $args); // Latest from the Community $args = array('title' => __('From the Community', 'pagelines'), 'data' => PageLines_RSS::get_dash_rss(array('feed' => 'http://www.pagelines.com/type/link/feed/', 'community' => true)), 'classes' => 'news-dash pl-dash-half', 'icon' => PL_ADMIN_ICONS . '/users.png', 'footer' => sprintf('<a href="%s">Submit</a> a community article', 'mailto:hello@pagelines.com')); $dashboards .= $this->dashboard_pane('community', $args); // PageLines Store Latest Dash $args = array('title' => __('Updates on PageLines Store', 'pagelines'), 'data' => PageLines_RSS::get_dash_rss(), 'classes' => 'news-dash pl-dash-half pl-dash-space', 'icon' => PL_ADMIN_ICONS . '/store.png', 'footer' => sprintf('Visit <a href="%s">PageLines Store</a>', 'http://www.pagelines.com/store/')); $dashboards .= $this->dashboard_pane('store', $args); // PageLines Plus $args = array('title' => __('Latest Extensions', 'pagelines'), 'data' => PageLines_RSS::get_dash_rss(array('feed' => 'http://api.pagelines.com/rss/plus.php')), 'classes' => 'news-dash pl-dash-half', 'icon' => PL_ADMIN_ICONS . '/plusbtn.png', 'footer' => sprintf('Visit <a href="%s">Plus Overview</a>', 'http://www.pagelines.com/plus/')); $dashboards .= $this->dashboard_pane('extensions', $args); return $this->dashboard_wrap($dashboards); }