Пример #1
0
 function afonews_dashboard_widget_function()
 {
     ap_news_style();
     ap_news_script();
     echo '<div id="ap_news_feed">' . _('Click on <strong>Load News</strong> for news feed.') . '</div>';
     if (isset($_SESSION['ap_news'])) {
         echo '<script type="text/javascript">ap_load_news();</script>';
     }
 }
    function afonews_dashboard_widget_function()
    {
        ap_news_style();
        if (!isset($_SESSION['ap_news'])) {
            $news = file_get_contents('http://www.aviplugins.com/api/news.php');
            $_SESSION['ap_news'] = $news;
        } else {
            $news = $_SESSION['ap_news'];
        }
        $news = json_decode($news);
        if (is_array($news)) {
            echo '<ul class="ap-news">';
            foreach ($news as $key => $value) {
                echo '<li>
				<h4>' . $value->title . '</h4>
				<span>' . $value->date . '</span>
				<p>' . html_entity_decode($value->desc) . '</p>
				</li>';
            }
            echo '</ul>';
        }
    }