当前位置: 首页>>代码示例>>PHP>>正文


PHP RSSFeed::SetItem方法代码示例

本文整理汇总了PHP中RSSFeed::SetItem方法的典型用法代码示例。如果您正苦于以下问题:PHP RSSFeed::SetItem方法的具体用法?PHP RSSFeed::SetItem怎么用?PHP RSSFeed::SetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RSSFeed的用法示例。


在下文中一共展示了RSSFeed::SetItem方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 public function display($part = 'all')
 {
     switch ($part) {
         case 'page-menu-only':
             if (file_exists('theme/' . $this->get_config('es_theme') . '/page_menu.php')) {
                 $page_menu_file = 'theme/' . $this->get_config('es_theme') . '/page_menu.php';
             } else {
                 $page_menu_file = 'includes/layout/theme//page_menu.php';
             }
             ob_start();
             include $page_menu_file;
             $page_menu = ob_get_contents();
             ob_end_clean();
             echo $page_menu;
             break;
         case 'posts-only':
             echo '<div id="new-post"></div>';
             $this->get_posts();
             break;
         case 'topbar-only':
             ob_start();
             include 'includes/layout/topbar.php';
             $this->topbar = ob_get_contents();
             ob_end_clean();
             echo $this->topbar;
             break;
         case 'sidebar-only':
             if (file_exists('theme/' . $this->get_config('es_theme') . '/sidebar.php')) {
                 $sidebar_file = 'theme/' . $this->get_config('es_theme') . '/sidebar.php';
             } else {
                 $sidebar_file = 'includes/layout/theme/sidebar.php';
             }
             ob_start();
             include $sidebar_file;
             $sidebar = ob_get_contents();
             ob_end_clean();
             echo $sidebar;
             break;
         case 'first-load':
             if ($this->configFileExists()) {
                 ob_start();
                 include 'includes/layout/topbar.php';
                 $this->topbar = ob_get_contents();
                 ob_end_clean();
                 $script_uri = 'http://' . str_replace('www.', '', $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI'];
                 if (substr($script_uri, -1) != '/') {
                     $script_uri .= '/';
                 }
                 $editsee_request = str_replace(str_replace('www.', '', $this->get_config('es_main_url')), '', $script_uri);
                 if (substr($editsee_request, 0, 5) == 'feed/') {
                     include "includes/RSSFeed.class.php";
                     header("Content-type: text/xml; charset=UTF-8");
                     $myfeed = new RSSFeed();
                     $myfeed->SetChannel($this->get_config('es_main_url'), $this->get_config('es_title'), $this->get_config('es_description'), 'en-us', date(Y) . ' ' . $_SERVER['HTTP_HOST'], 'webmaster@' . $_SERVER['HTTP_HOST'], $this->get_config('es_title'));
                     $myfeed->SetImage('');
                     $query = $this->db->_query("select id,title,urltag,content,date_entered from " . $this->db->get_table_prefix() . "post \n\t\t\t\t\t\t\t\t\t\t\t\t\twhere type='post' and deleted='0' and (date_entered <= NOW())\n\t\t\t\t\t\t\t\t\t\t\t\t\torder by date_entered desc");
                     while ($post = $query->_fetch_assoc()) {
                         $post['content'] = strip_tags($post['content'], '<br/><br>');
                         if (strpos($post['content'], '!--full-post--!')) {
                             $post['content'] = substr($post['content'], 0, strpos($post['content'], '!--full-post--!'));
                             $add_dots = true;
                         } else {
                             if (strlen($post['content']) > 280) {
                                 $post['content'] = substr(substr($post['content'], 0, 280), 0, strrpos(substr($post['content'], 0, 280), ' '));
                                 $add_dots = true;
                             }
                         }
                         $post['content'] = htmlentities(stripslashes($post['content']));
                         if ($add_dots) {
                             $post['content'] .= ' [...]';
                         }
                         $myfeed->SetItem($this->get_config('es_main_url') . 'post/' . $post['id'], $this->get_config('es_main_url') . 'post/' . $post['urltag'], $post['title'], $post['date_entered'], $post['content']);
                     }
                     echo $myfeed->output();
                     exit;
                 }
                 $editsee_index = '';
                 if ($editsee_request == '' || $editsee_request == $this->get_config('es_postpage') . '/' || $editsee_request == 'index.php/') {
                     $post_start = 0;
                     $page_number = 1;
                     if ($this->get_config('es_homepage') == '!posts!' || $editsee_request == $this->get_config('es_postpage') . '/') {
                         $this->is_posts = true;
                     } else {
                         $editsee_request = $this->get_config('es_homepage') . '/';
                     }
                 }
                 if (substr($editsee_request, 0, 5) == 'page/') {
                     $page_number = substr(substr($editsee_request, 5), 0, strpos(substr($editsee_request, 5), '/'));
                     $post_start = ($page_number - 1) * $this->get_config('es_posts_per_page');
                     $this->is_posts = true;
                 }
                 if ($this->is_posts) {
                     ob_start();
                     $this->get_posts($post_start);
                     $editsee_index .= ob_get_contents();
                     ob_end_clean();
                 } else {
                     $query = $this->db->_query("select id,title from " . $this->db->get_table_prefix() . "post where urltag='" . substr($editsee_request, 0, -1) . "'");
                     if ($query->_num_rows() == 1) {
                         $this->is_page = true;
//.........这里部分代码省略.........
开发者ID:apexad,项目名称:editsee,代码行数:101,代码来源:editsee_App.class.php

示例2: date

$ts = time();
$first = mktime(0, 0, 1, date('n', $ts), date('j', $ts), date('Y', $ts));
$last = mktime(23, 59, 59, date('n', $ts), date('j', $ts), date('Y', $ts));
/*echo $first;
echo '<br>';
echo $last;
echo '<br>';
echo date('j', $ts)-1;
echo '<br>';
echo date('Y-m-d');
echo '<br>';
echo date('Y-m-d H:i s A', $first);
echo '<br>';
echo date('Y-m-d H:i s A');
echo '<br>';
echo date('Y-m-d H:i s A', $last);
//exit;*/
$myfeed = new RSSFeed();
$myfeed->SetChannel('http://www.v2nportal.com/mhealth/rss.rss', 'mHealth', '', 'en-us', 'VAS2Nets Technologies', 'VAS2Nets Technologies', 'VAS2Nets Technologies mHealth');
if (@$_REQUEST['feed_id']) {
    $category = strtoupper(urldecode($_REQUEST['feed_id']));
    $sql = "SELECT * from tip t join category c where c.id = t.category_id and UPPER(c.name) = '{$category}' and t.schedule_time  between  {$first} and {$last} order by t.id desc";
} else {
    $sql = "SELECT * from tip t join category c where c.id = t.category_id and t.schedule_time between  {$first} and {$last} order by t.id desc";
}
$feeds_array = R::getAll($sql);
//var_dump($feeds_array);
foreach ($feeds_array as $feed) {
    $myfeed->SetItem('http://www.v2nportal.com/mhealth/rss.php?feed_id=' . $feed['name'], 'mHealth', stripslashes($feed['gist']));
}
echo $myfeed->output();
开发者ID:hiroyalty,项目名称:mhealth,代码行数:31,代码来源:rss.php

示例3: date

$ts = time();
$first = mktime(0, 0, 1, date('n', $ts), date('j', $ts), date('Y', $ts));
$last = mktime(23, 59, 59, date('n', $ts), date('j', $ts), date('Y', $ts));
/*echo $first;
echo '<br>';
echo $last;
echo '<br>';
echo date('j', $ts)-1;
echo '<br>';
echo date('Y-m-d');
echo '<br>';
echo date('Y-m-d H:i s A', $first);
echo '<br>';
echo date('Y-m-d H:i s A');
echo '<br>';
echo date('Y-m-d H:i s A', $last);
//exit;*/
$myfeed = new RSSFeed();
$myfeed->SetChannel('http://www.v2nportal.com/mhealth/rss.rss', 'mHealth', 'Free Daily Health Tips Via RSS Feeds', 'en-us', 'VAS2Nets Technologies', 'VAS2Nets Technologies', 'VAS2Nets Technologies mHealth');
if (@$_REQUEST['feed_id']) {
    $category = strtoupper(urldecode($_REQUEST['feed_id']));
    $sql = "SELECT * from tip t join category c where c.id = t.category_id and UPPER(c.name) = '{$category}' and t.schedule_time  between  {$first} and {$last} order by t.id desc";
} else {
    $sql = "SELECT * from tip t join category c where c.id = t.category_id and t.schedule_time between  {$first} and {$last} order by t.id desc";
}
$feeds_array = R::getAll($sql);
//var_dump($feeds_array);
foreach ($feeds_array as $feed) {
    $myfeed->SetItem('http://www.v2nportal.com/mhealth/rss.php?feed_id=' . $feed['name'], date('Y-m-d', $feed['schedule_time']), stripslashes($feed['gist']));
}
echo $myfeed->output();
开发者ID:hiroyalty,项目名称:mhealth,代码行数:31,代码来源:rss1.php

示例4: getRSS


//.........这里部分代码省略.........
         $query->select('t.size');
     }
     if (preg_match('/{upload_date}/', $used_fields)) {
         $query->select('t.created_time');
     }
     if (preg_match('/{seeders}/', $used_fields)) {
         $query->select('t.seeders');
     }
     if (preg_match('/{leechers}/', $used_fields)) {
         $query->select('t.leechers');
     }
     if (preg_match('/{completed}/', $used_fields)) {
         $query->select('t.completed');
     }
     // Join on category table.
     if (preg_match('/{category}/', $used_fields) || $data->rss_type == 1) {
         $query->select('c.title AS category');
         $query->join('LEFT', '#__categories AS c on c.id = t.categoryID');
     }
     // Join on user table.
     if (preg_match('/{uploader}/', $used_fields)) {
         $query->select('u.username as user');
         $query->join('LEFT', '#__users AS u on u.id = r.created_user_id');
     }
     // Join on licenses table
     if (preg_match('/{license}/', $used_fields) || $data->rss_type == 2) {
         $query->select('l.shortname as license');
         $query->join('LEFT', '#__tracker_licenses AS l on l.id = t.licenseID');
     }
     $query->from('#__tracker_torrents AS t');
     // Show torrents with the selected categories
     if ($data->rss_type == 1) {
         $query->where('t.categoryID IN ( ' . $data->rss_type_items . ' )');
         // Or show torrents with the selected licenses
     } else {
         if ($data->rss_type == 2) {
             $query->where('t.licenseID IN ( ' . $data->rss_type_items . ' )');
         }
     }
     $query->order('t.fid DESC');
     // Limit the number of items we get from the DB
     $db->setQuery($query, 0, $data->item_count);
     $items = $db->loadObjectList();
     $feed = new RSSFeed();
     $feed->SetChannel(JURI::getInstance()->toString(), $data->channel_title, $data->channel_description, $lang->getTag(), '&#174;' . $config->getValue('config.sitename') . date("Y"), $data->user, $data->name);
     // RSS Name
     foreach ($items as $i => $item) {
         // Now we need to prepare the preg_replace items. It's an ugly code but didn't found a better one
         $source = array();
         $destination = array();
         if (preg_match('/{name}/', $used_fields)) {
             array_push($source, '/{name}/');
             array_push($destination, $item->name);
         }
         if (preg_match('/{description}/', $used_fields)) {
             array_push($source, '/{description}/');
             array_push($destination, $item->description);
         }
         if (preg_match('/{link}/', $used_fields)) {
             array_push($source, '/{link}/');
             array_push($destination, 'JRoute::_(JURI::base()."index.php?option=com_tracker&view=torrent&id=".$item->fid, true, -1)');
         }
         if (preg_match('/{size}/', $used_fields)) {
             array_push($source, '/{size}/');
             array_push($destination, $item->size);
         }
         if (preg_match('/{upload_date}/', $used_fields)) {
             array_push($source, '/{upload_date}/');
             array_push($destination, $item->created_time);
         }
         if (preg_match('/{seeders}/', $used_fields)) {
             array_push($source, '/{seeders}/');
             array_push($destination, $item->seeders);
         }
         if (preg_match('/{leechers}/', $used_fields)) {
             array_push($source, '/{leechers}/');
             array_push($destination, $item->leechers);
         }
         if (preg_match('/{completed}/', $used_fields)) {
             array_push($source, '/{completed}/');
             array_push($destination, $item->completed);
         }
         if (preg_match('/{category}/', $used_fields)) {
             array_push($source, '/{category}/');
             array_push($destination, $item->category);
         }
         if (preg_match('/{uploader}/', $used_fields)) {
             array_push($source, '/{uploader}/');
             array_push($destination, $item->user);
         }
         if (preg_match('/{license}/', $used_fields)) {
             array_push($source, '/{license}/');
             array_push($destination, $item->license);
         }
         $name = preg_replace($source, $destination, $data->item_title);
         $description = preg_replace($source, $destination, $data->item_description);
         $feed->SetItem(JRoute::_(JURI::base() . 'index.php?option=com_tracker&view=torrent&id=' . $item->fid, true, -1), $name, $description);
     }
     echo $feed->output();
 }
开发者ID:solderzzc,项目名称:com_tracker,代码行数:101,代码来源:tracker.php

示例5: get_tips

    $c = db_connect();
    $res = array();
    $s = oci_parse($c, $sql);
    if ($bind != null) {
        foreach ($bind as $key => $value) {
            oci_bind_by_name($s, ":" . $key, htmlentities($value, ENT_QUOTES));
        }
    }
    $res = oci_execute($s);
    return $res;
}
include_once 'lib/RSS.php';
$myfeed = new RSSFeed();
$myfeed->SetChannel('http://apps.v2nportal.com/services/marss/', 'mAgric Pest', '', 'en-us', 'VAS2Nets Technologies', 'VAS2Nets Technologies', 'VAS2Nets Technologies mAgric Pest');
$series = array('1' => '1121', '2' => '1141', '3' => '1161', '4' => '1101', '5' => '1081', '6' => '1181');
$id = $_REQUEST['cat'];
$cid = $series[$id];
if (!$cid) {
    exit;
}
$tip = get_tips($cid);
$myfeed->SetItem('http://www.v2nportal.com/marss/rss.php?feed_id=' . $tip->CATEGORY, 'mAgric', $tip->MESSAGE);
echo $myfeed->output();
function get_tips($id)
{
    $today = date('Y-m-d');
    $sql = "select * from alert where service_id = {$id} and to_char(schedule, 'yyyy-mm-dd')='{$today}'";
    $res = array_shift(db_query($sql));
    //var_dump($res); exit;
    return $res;
}
开发者ID:hiroyalty,项目名称:sdpsports,代码行数:31,代码来源:index.php

示例6: die

//    GNU Affero General Public License for more details.
//
//    You should have received a copy of the GNU Affero General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// -----------------------------------------------------------------
//
// Page: "RSS" - creates a RSS feed containing requirements changes for all users attached to the projects
include "rss.class.php";
session_start();
include "admin/inc/conn.php";
//include settings file
include "admin/inc/func.php";
//include functions file
include "ini/params.php";
//include configuration file
$query = "select * from users";
$rs = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($rs)) {
    //Rss
    $myfeed = new RSSFeed();
    $myfeed->SetChannel(PROJECT_URL . "/" . $row['u_id'] . ".rss", htmlspecialchars($row['u_name']) . "'s feed", "Feed contains last changes in requirements of my projects", "en-us", "", htmlspecialchars($row['u_name']), "Requirements changes");
    $query3 = "select r.*, p.p_name from requirements r, project_users pu, projects p where r.r_change_date>=DATE_SUB(CONCAT(CURDATE(), ' 00:00:00'), INTERVAL 1 DAY) and r.r_p_id=pu.pu_p_id and pu.pu_p_id=p.p_id and pu.pu_u_id=" . $row['u_id'];
    $rs3 = mysql_query($query3) or die(mysql_error());
    while ($row3 = mysql_fetch_array($rs3)) {
        $myfeed->SetItem(PROJECT_URL . "/index.php?inc=view_requirement&amp;r_id=" . $row3['r_id'], htmlspecialchars($row3['r_name']) . " (" . htmlspecialchars($row3['p_name']) . ")", strip_tags($row3['r_desc']));
    }
    $fp = fopen("RSS/" . $row['u_id'] . ".xml", "wb");
    fwrite($fp, $myfeed->output());
    fclose($fp);
}
开发者ID:teungri,项目名称:RequirementsApp,代码行数:31,代码来源:rss.php


注:本文中的RSSFeed::SetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。