Вход Регистрация
Файл: system/controllers/admin/actions/load_icms_news.php
Строк: 38
<?php

class actionAdminLoadIcmsNews extends cmsAction {

    private 
$news_link = array(
        
'icms'       => 'https://instantcms.ru/rss/content/2/feed.rss',
        
'icms_blogs' => 'https://instantcms.ru/rss/blogs/all/feed.rss',
        
'icms_docs'  => 'https://docs.instantcms.ru/feed.php'
    
);

    private 
$news_count 10;

    public function 
run($target){

        if (!
$this->request->isAjax()) { cmsCore::error404(); }

        if (!
$target || !in_array($targetarray_keys($this->news_link))) { cmsCore::error404(); }

        
cmsCore::loadLib('lastrss.class');

        
$rss = new lastRSS;

        
$rss->cache_dir   cmsConfig::get('cache_path');
        
$rss->cache_time  3600;
        
$rss->stripHTML   true;
        
$rss->cp          'UTF-8';
        
$rss->items_limit $this->news_count;

        
$items = array();

        
$res $rss->get($this->news_link[$target]);

        if(!empty(
$res['items'])){
            foreach (
$res['items'] as $item) {

                
$item['target_title'] = empty($res['title']) ?
                    (empty(
$res['image_title']) ? '' $res['image_title']) :
                    
$res['title'];

                
$item['target_description'] = empty($res['description']) ?
                    (empty(
$res['image_description']) ? '' $res['image_description']) :
                    
$res['description'];

                
$items[] = $item;

            }
        }

        if(!
$items){ $this->halt(LANG_NO_ITEMS); }

        
$this->cms_template->renderPlain('index_news_data', array(
            
'items' => $items
        
));

    }

}
Онлайн: 2
Реклама