/** * Box with latest plugins from Extendd.com for sidebar */ function sidebar_feed($args) { $defaults = array('items' => 6, 'feed' => 'https://frosty.media/feed/?post_type=plugin&plugin_tag=custom-login-extension'); $args = wp_parse_args($args, $defaults); $rss_items = CL_Common::fetch_rss_items($args['items'], $args['feed']); $content = '<ul>'; if (!$rss_items) { $content .= '<li>' . __('Error fetching feed', $this->settings['domain']) . '</li>'; } else { foreach ($rss_items as $item) { $url = preg_replace('/#.*/', '', esc_url($item->get_permalink(), null, 'display')); $content .= '<li>'; $content .= '<a href="' . $url . '?utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=newsite&utm_campaign=' . $this->settings['prefix'] . '_settings-api" target="_blank">' . esc_html($item->get_title()) . '</a>'; $content .= '</li>'; } } $content .= '</ul>'; $this->postbox('custom-login-extensions', sprintf(__('Custom Login Extensions %s', $this->settings['domain']), '<small class="dashicons dashicons-external"></small>'), $content); }
/** * Dashboard widget */ public function widget() { // FEED $rss_items = $this->get_feed(1, 'https://frosty.media/feed/'); $content = '<div class="rss-widget">'; $content .= '<ul>'; if (!$rss_items) { $content .= '<li>' . __('Error fetching feed', CUSTOM_LOGIN_DIRNAME) . '</li>'; } else { $count = 1; foreach ($rss_items as $key => $item) { $feed_url = preg_replace('/#.*/', '', esc_url($item->get_permalink(), null, 'display')); $content .= '<li>'; $content .= '<a class="rsswidget" href="' . add_query_arg(array('utm_medium' => 'wpadmin_dashboard', 'utm_term' => 'newsitem', 'utm_campaign' => CUSTOM_LOGIN_DIRNAME), $feed_url) . '">' . esc_html($item->get_title()) . '</a>'; $content .= $count === 1 ? ' <span class="rss-date">' . $item->get_date(get_option('date_format')) . '</span>' : ''; $content .= $count === 1 ? '<div class="rssSummary">' . strip_tags(wp_trim_words($item->get_description(), 28)) . '</div>' : ''; $content .= '</li>'; $count++; } } $content .= '</ul>'; $content .= '</div>'; // Plugins $rss_items = CL_Common::fetch_rss_items(3, 'https://frosty.media/feed/?post_type=plugin&plugin_tag=custom-login-extension'); $content .= '<div class="rss-widget">'; $content .= '<ul>'; //$content .= '<li><strong>' . __( 'Custom Login Extensions:', CUSTOM_LOGIN_DIRNAME ) . '</strong></li>'; if (!$rss_items) { $content .= '<li>' . __('Error fetching feed', CUSTOM_LOGIN_DIRNAME) . '</li>'; } else { foreach ($rss_items as $item) { $url = preg_replace('/#.*/', '', esc_url($item->get_permalink(), null, 'display')); $content .= '<li>'; $content .= '<a class="rsswidget" href="' . add_query_arg(array('utm_medium' => 'wpadmin_dashboard', 'utm_term' => 'newsitem', 'utm_campaign' => CUSTOM_LOGIN_DIRNAME), $url) . '">' . esc_html($item->get_title()) . '</a>'; # $content .= '<div class="rssSummary">' . strip_tags( wp_trim_words( $item->get_description(), 10 ) ) . '</div>'; $content .= '</li>'; } } $content .= '</ul>'; $content .= '</div>'; $content .= '<div class="rss-widget">'; $content .= '<ul class="social">'; $content .= '<li>'; $content .= '<a href="https://www.facebook.com/FrostyMediaWP"><span class="dashicons dashicons-facebook"></span>/FrostyMediaWP</a> | '; $content .= '<a href="https://twitter.com/Frosty_Media"><span class="dashicons dashicons-twitter"></span>/Frosty_Media</a> | '; $content .= '<a href="https://twitter.com/TheFrosty"><span class="dashicons dashicons-twitter"></span>/TheFrosty</a>'; $content .= '</li>'; $content .= '</ul>'; $content .= '</div>'; echo $content; }
private function get_feed($count = 1, $feed = self::FEED_URL) { return CL_Common::fetch_rss_items($count, $feed); }