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


PHP Feed::create方法代码示例

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


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

示例1: test_create

 /**
  * @test
  *
  * @dataProvider provider_create
  *
  * @covers feed::create
  *
  * @param string  $info     info to pass
  * @param integer $items    items to add
  * @param integer $matcher  output
  */
 public function test_create($info, $items, $enviroment, $matcher_item, $matchers_image)
 {
     $this->setEnvironment($enviroment);
     $this->assertTag($matcher_item, Feed::create($info, $items), '', FALSE);
     foreach ($matchers_image as $matcher_image) {
         $this->assertTag($matcher_image, Feed::create($info, $items), '', FALSE);
     }
 }
开发者ID:ortodesign,项目名称:cms,代码行数:19,代码来源:feedtest.php

示例2: action_index

 public function action_index()
 {
     $pages = ORM::factory('page')->find_all();
     $info = array('title' => 'RSS подписка на страницы');
     $all = array();
     foreach ($pages as $page) {
         array_push($all, array('title' => $page->pagename, 'description' => $page->content, 'pubDate' => $page->date, 'link' => '/page'));
     }
     $feed = Feed::create($info, $all);
     $this->response->body($feed);
 }
开发者ID:raku,项目名称:front-cms,代码行数:11,代码来源:rss.php

示例3: action_feed

 public function action_feed()
 {
     $info = array('title' => __($this->metadata->title), 'pubDate' => date('r'), 'description' => $this->metadata->description, 'language' => I18n::lang(), 'ttl' => 60);
     $news = ORM::factory('Publication')->where('published', '=', 1)->order_by('date', 'desc')->limit(40)->find_all();
     $items = array();
     foreach ($news as $item) {
         $items[] = array('title' => $item->title, 'description' => strip_tags($item->desc), 'image' => isset($item->picture->file_path) && $item->picture->file_path ? URL::media($item->picture->file_path, TRUE) : '', 'content' => strip_tags($item->text), 'link' => Url::site('publications/view/' . $item->id, true), 'pubDate' => date('r', strtotime($item->date)));
     }
     header('Content-Type: text/xml; charset=utf-8');
     $xml = Feed::create($info, $items, 'UTF-8');
     echo $xml;
     die;
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:13,代码来源:Rss.php

示例4: action_blog

 public function action_blog()
 {
     $this->auto_render = FALSE;
     $info = array('title' => 'RSS Blog ' . Core::config('general.site_name'), 'pubDate' => date("D, d M Y H:i:s T"), 'description' => __('Latest post published'), 'generator' => 'Open Classifieds');
     $items = array();
     $posts = new Model_Post();
     $posts = $posts->where('status', '=', 1)->order_by('created', 'desc')->limit(Core::config('general.feed_elements'))->cached()->find_all();
     foreach ($posts as $post) {
         $url = Route::url('blog', array('seotitle' => $post->seotitle));
         $items[] = array('title' => preg_replace('/&(?!\\w+;)/', '&', $post->title), 'link' => $url, 'pubDate' => Date::mysql2unix($post->created), 'description' => Text::removebbcode(preg_replace('/&(?!\\w+;)/', '&', $post->description)));
     }
     $xml = Feed::create($info, $items);
     $this->response->headers('Content-type', 'text/xml');
     $this->response->body($xml);
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:15,代码来源:feed.php

示例5: action_talk

 public function action_talk()
 {
     $this->response->headers('Content-Type', 'application/rss+xml; charset=UTF-8');
     $talks = ORM::factory('Talk')->where('deleted', '=', 0)->limit(15)->order_by('created', 'DESC')->find_all();
     $feed = array();
     if ((bool) $talks->count()) {
         foreach ($talks as $talk) {
             $description = $talk->content();
             $description = strip_tags($description);
             $description = str_replace(array("\r\n", "\n"), ' ', $description);
             $description = substr($description, 0, 200);
             $feed[] = array('title' => $talk->title, 'pubDate' => $talk->created, 'link' => $talk->url(), 'description' => $description, 'guid' => $talk->url());
         }
     }
     echo Feed::create(array('title' => 'Talk about Morning Pages', 'link' => 'talk', 'description' => 'New talks on Morning Pages'), $feed);
 }
开发者ID:artbypravesh,项目名称:morningpages,代码行数:16,代码来源:Rss.php

示例6: action_index

 public function action_index()
 {
     // Load items
     $content = Request::factory('articles/all.json');
     $content->get = array('articles' => 1, 'limit' => $this->_config['feed_length']);
     $content = $content->execute();
     if ($content->status !== 200 or $content->headers['Content-Type'] !== 'application/json') {
         $this->response->status = 500;
         $this->response->body = '<h1>Internal server error</h1>';
         return;
     }
     $content = json_decode($content->body);
     $content = $this->_format_feed_array($content);
     $info = array('title' => $this->_config['blog_name'], 'link' => Url::site(), 'description' => $this->_config['description'], 'language' => $this->_config['language'], 'copyright' => $this->_config['copyright'], 'pubDate' => $this->_pub_date, 'lastBuildDate' => $this->_last_build);
     $this->response->headers['Content-Type'] = 'application/rss+xml';
     $this->response->body = Feed::create($info, $content);
 }
开发者ID:samsoir,项目名称:def.reyssi.net-legacy,代码行数:17,代码来源:feed.php

示例7: action_index

 function action_index()
 {
     $newsportal = ORM::factory('newsportal')->where('active', '=', 1)->order_by('date', 'DESC');
     $newsservice = ORM::factory('newsservice')->where('active', '=', 1)->order_by('date_create', 'DESC');
     $news_world = ORM::factory('newsworld')->where('active', '=', 1)->order_by('date', 'DESC');
     $info = array('title' => 'Новости', 'language' => 'ru', 'description' => 'Новости от ' . date('d.m.Y H:i'), 'pubDate' => time());
     $items = array();
     foreach ($newsportal->find_all() as $news) {
         $items[] = array('title' => $news->title, 'url' => URL::base() . 'news/association/' . $news->id, 'guid' => URL::base() . 'news/association/' . $news->id, 'description' => strip_tags(htmlspecialchars($news->text)), 'pubDate' => $news->date);
     }
     foreach ($newsservice->find_all() as $news) {
         $items[] = array('title' => $news->service->name . ': ' . $news->title, 'url' => URL::base() . 'news/' . $news->id, 'guid' => URL::base() . 'news/' . $news->id, 'description' => strip_tags(htmlspecialchars($news->text)), 'pubDate' => $news->date_create);
     }
     foreach ($news_world->find_all() as $news) {
         $items[] = array('title' => $news->title, 'url' => URL::base() . 'news/world/' . $news->id, 'guid' => URL::base() . 'news/world/' . $news->id, 'description' => strip_tags(htmlspecialchars($news->text)), 'pubDate' => $news->date);
     }
     $this->response->headers('Content-type', 'text/xml');
     echo Feed::create($info, $items, 'rss', 'utf-8');
 }
开发者ID:Alexander711,项目名称:naav1,代码行数:19,代码来源:rss.php

示例8: action_forum

 public function action_forum()
 {
     $this->auto_render = FALSE;
     $info = array('title' => 'RSS Forum ' . Core::config('general.site_name'), 'pubDate' => date("r"), 'description' => __('Latest post published'), 'generator' => 'Open Classifieds');
     $items = array();
     $topics = new Model_Topic();
     if (Model_Forum::current()->loaded()) {
         $topics->where('id_forum', '=', Model_Forum::current()->id_forum);
     } else {
         $topics->where('id_forum', '!=', NULL);
     }
     //any forum
     $topics = $topics->where('status', '=', Model_Topic::STATUS_ACTIVE)->where('id_post_parent', 'IS', NULL)->order_by('created', 'desc')->limit(Core::config('advertisement.feed_elements'))->cached()->find_all();
     foreach ($topics as $topic) {
         $url = Route::url('forum-topic', array('seotitle' => $topic->seotitle, 'forum' => $topic->forum->seoname));
         $items[] = array('title' => htmlspecialchars($topic->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($topic->created), 'description' => htmlspecialchars(Text::removebbcode($topic->description), ENT_QUOTES), 'guid' => $url);
     }
     $xml = Feed::create($info, $items);
     $this->response->headers('Content-type', 'text/xml');
     $this->response->body($xml);
 }
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:21,代码来源:feed.php

示例9: render

 public function render($resource)
 {
     $limit = filter_var(Arr::get($_GET, 'limit', 30), FILTER_SANITIZE_NUMBER_INT);
     $offset = filter_var(Arr::get($_GET, 'offset', 0), FILTER_SANITIZE_NUMBER_INT);
     $prefixSource = clone $resource;
     $xml = array();
     if ($resource instanceof ORM) {
         $items = $resource->limit($limit)->offset($offset)->find_all();
         $allItems = $prefixSource->find_all();
         $count = $allItems->count();
     } else {
         $items = $resource;
         $count = count($items);
     }
     $offset = $offset > 0 ? $offset - 1 : 0;
     $limit = $limit > 0 && $limit < $count ? $limit : $count;
     $numUsed = 0;
     for ($i = $offset; $i < $count && $numUsed < $limit; ++$i) {
         $numUsed++;
         $item = $items[$i];
         $xml[] = $item instanceof ORM ? $this->scrub($item->as_array()) : $this->scrub($item);
     }
     echo Feed::create(array('title' => 'Kids MyShot Image Feed', 'amount' => $numUsed), $xml);
 }
开发者ID:natgeo,项目名称:kids-myshot,代码行数:24,代码来源:xml.php

示例10: feed_controller

function feed_controller()
{
    global $mysqli, $redis, $session, $route, $feed_settings;
    $result = false;
    require_once "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    if ($route->format == 'html') {
        if ($route->action == "list" && $session['write']) {
            $result = view("Modules/feed/Views/feedlist_view.php", array());
        } else {
            if ($route->action == "api" && $session['write']) {
                $result = view("Modules/feed/Views/feedapi_view.php", array());
            }
        }
    } else {
        if ($route->format == 'json') {
            // Public actions available on public feeds.
            if ($route->action == "list") {
                if ($session['read']) {
                    if (!isset($_GET['userid']) || isset($_GET['userid']) && $_GET['userid'] == $session['userid']) {
                        $result = $feed->get_user_feeds($session['userid']);
                    } else {
                        if (isset($_GET['userid']) && $_GET['userid'] != $session['userid']) {
                            $result = $feed->get_user_public_feeds(get('userid'));
                        }
                    }
                } else {
                    if (isset($_GET['userid'])) {
                        $result = $feed->get_user_public_feeds(get('userid'));
                    }
                }
            } elseif ($route->action == "create" && $session['write']) {
                $result = $feed->create($session['userid'], get('tag'), get('name'), get('datatype'), get('engine'), json_decode(get('options')));
            } elseif ($route->action == "updatesize" && $session['write']) {
                $result = $feed->update_user_feeds_size($session['userid']);
            } elseif ($route->action == "buffersize" && $session['write']) {
                $result = $feed->get_buffer_size();
                // To "fetch" multiple feed values in a single request
                // http://emoncms.org/feed/fetch.json?ids=123,567,890
            } elseif ($route->action == "fetch" && $session['read']) {
                $feedids = (array) explode(",", get('ids'));
                for ($i = 0; $i < count($feedids); $i++) {
                    $feedid = (int) $feedids[$i];
                    if ($feed->exist($feedid)) {
                        // if the feed exists
                        $result[$i] = $feed->get_value($feedid);
                        // null is a valid response
                    } else {
                        $result[$i] = false;
                    }
                    // false means feed not found
                }
            } else {
                $feedid = (int) get('id');
                // Actions that operate on a single existing feed that all use the feedid to select:
                // First we load the meta data for the feed that we want
                if ($feed->exist($feedid)) {
                    $f = $feed->get($feedid);
                    // if public or belongs to user
                    if ($f['public'] || $session['userid'] > 0 && $f['userid'] == $session['userid'] && $session['read']) {
                        if ($route->action == "timevalue") {
                            $result = $feed->get_timevalue($feedid);
                        } else {
                            if ($route->action == 'data') {
                                $skipmissing = 1;
                                $limitinterval = 1;
                                if (isset($_GET['skipmissing']) && $_GET['skipmissing'] == 0) {
                                    $skipmissing = 0;
                                }
                                if (isset($_GET['limitinterval']) && $_GET['limitinterval'] == 0) {
                                    $limitinterval = 0;
                                }
                                $result = $feed->get_data($feedid, get('start'), get('end'), get('interval'), $skipmissing, $limitinterval);
                            } else {
                                if ($route->action == "value") {
                                    $result = $feed->get_value($feedid);
                                } else {
                                    if ($route->action == "get") {
                                        $result = $feed->get_field($feedid, get('field'));
                                    } else {
                                        if ($route->action == "aget") {
                                            $result = $feed->get($feedid);
                                        } else {
                                            if ($route->action == 'histogram') {
                                                $result = $feed->histogram_get_power_vs_kwh($feedid, get('start'), get('end'));
                                            } else {
                                                if ($route->action == 'kwhatpower') {
                                                    $result = $feed->histogram_get_kwhd_atpower($feedid, get('min'), get('max'));
                                                } else {
                                                    if ($route->action == 'kwhatpowers') {
                                                        $result = $feed->histogram_get_kwhd_atpowers($feedid, get('points'));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:ashokbasnet,项目名称:emoncms,代码行数:101,代码来源:feed_controller.php

示例11: or

 }
 require_once 'constant.php';
 require_once 'MysqlEntity.class.php';
 class_exists('Update') or (require_once 'Update.class.php');
 Update::ExecutePatch(true);
 require_once 'Feed.class.php';
 require_once 'Event.class.php';
 require_once 'User.class.php';
 require_once 'Folder.class.php';
 require_once 'Configuration.class.php';
 $cryptographicSalt = User::generateSalt();
 $synchronisationCode = substr(sha1(rand(0, 30) . time() . rand(0, 30)), 0, 10);
 $root = substr($_['root'], strlen($_['root']) - 1) == '/' ? $_['root'] : $_['root'] . '/';
 // DOSSIERS À CONSERVER TELS QUELS, SI DÉJÀ EXISTANTS
 $feedManager = new Feed();
 $feedManager->create();
 $eventManager = new Event();
 $eventManager->create();
 // COMPTE ADMINISTRATEUR, RÀZ SI NÉCESSAIRE
 $userManager = new User();
 if ($userManager->tableExists()) {
     // Suppose qu'il n'y a qu'un seul utilisateur
     $userManager->truncate();
 }
 $userManager->create();
 $admin = new User();
 $admin->setLogin($_['login']);
 $admin->setPassword($_['password'], $cryptographicSalt);
 $admin->save();
 $_SESSION['currentUser'] = serialize($admin);
 // DOSSIERS DE FLUX, RECRÉE LE DOSSIER GÉNÉRAL SI NÉCESSAIRE
开发者ID:Chouchen,项目名称:Leed,代码行数:31,代码来源:install.php

示例12: create_feeds

 private function create_feeds($userid, $node, &$feedArray)
 {
     global $feed_settings;
     require_once "Modules/feed/feed_model.php";
     $feed = new Feed($this->mysqli, $this->redis, $feed_settings);
     foreach ($feedArray as $f) {
         // Create each feed
         $name = $f->name;
         if (property_exists($f, "tag")) {
             $tag = $f->tag;
         } else {
             $tag = $node;
         }
         $datatype = constant($f->type);
         // DataType::
         $engine = constant($f->engine);
         // Engine::
         if (property_exists($f, "interval")) {
             $options_in[] = array();
             $options_in['interval'] = $f->interval;
         } else {
             $options_in = null;
         }
         $this->log->info("create_feeds() userid={$userid} tag={$tag} name={$name} datatype={$datatype} engine={$engine}");
         $result = $feed->create($userid, $tag, $name, $datatype, $engine, $options_in);
         if ($result["success"] !== true) {
             return $result;
         }
         $f->feedId = $result["feedid"];
         // Assign the created feed id to the feeds array
     }
     return $result;
 }
开发者ID:alj56,项目名称:emoncms,代码行数:33,代码来源:device_model.php

示例13: after

 /**
  * Create feed
  *
  * @uses  Feed::create
  */
 public function after()
 {
     parent::after();
     if (isset($this->_items['title'])) {
         unset($this->_items['title']);
     }
     echo $this->_feed->create($this->_info, $this->_items);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:13,代码来源:template.php

示例14: feed_controller

function feed_controller()
{
    global $mysqli, $redis, $session, $route, $feed_settings;
    $result = false;
    include "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    if ($route->format == 'html') {
        if ($route->action == "list" && $session['write']) {
            $result = view("Modules/feed/Views/feedlist_view.php", array());
        }
        if ($route->action == "api" && $session['write']) {
            $result = view("Modules/feed/Views/feedapi_view.php", array());
        }
    }
    if ($route->format == 'json') {
        // Public actions available on public feeds.
        if ($route->action == "list") {
            if (!isset($_GET['userid']) && $session['read']) {
                $result = $feed->get_user_feeds($session['userid']);
            }
            if (isset($_GET['userid']) && $session['read'] && $_GET['userid'] == $session['userid']) {
                $result = $feed->get_user_feeds($session['userid']);
            }
            if (isset($_GET['userid']) && $session['read'] && $_GET['userid'] != $session['userid']) {
                $result = $feed->get_user_public_feeds(get('userid'));
            }
            if (isset($_GET['userid']) && !$session['read']) {
                $result = $feed->get_user_public_feeds(get('userid'));
            }
        } elseif ($route->action == "getid" && $session['read']) {
            $result = $feed->get_id($session['userid'], get('name'));
        } elseif ($route->action == "create" && $session['write']) {
            $result = $feed->create($session['userid'], get('name'), get('datatype'), get('engine'), json_decode(get('options')));
        } elseif ($route->action == "updatesize" && $session['write']) {
            $result = $feed->update_user_feeds_size($session['userid']);
            // To "fetch" multiple feed values in a single request
            // http://emoncms.org/feed/fetch.json?ids=123,567,890
        } elseif ($route->action == "fetch" && $session['read']) {
            $feedids = (array) explode(",", get('ids'));
            for ($i = 0; $i < count($feedids); $i++) {
                $feedid = (int) $feedids[$i];
                if ($feed->exist($feedid)) {
                    $result[$i] = (double) $feed->get_value($feedid);
                } else {
                    $result[$i] = "";
                }
            }
        } else {
            $feedid = (int) get('id');
            // Actions that operate on a single existing feed that all use the feedid to select:
            // First we load the meta data for the feed that we want
            if ($feed->exist($feedid)) {
                $f = $feed->get($feedid);
                // if public or belongs to user
                if ($f['public'] || $session['userid'] > 0 && $f['userid'] == $session['userid'] && $session['read']) {
                    if ($route->action == "value") {
                        $result = $feed->get_value($feedid);
                    }
                    if ($route->action == "timevalue") {
                        $result = $feed->get_timevalue_seconds($feedid);
                    }
                    if ($route->action == "get") {
                        $result = $feed->get_field($feedid, get('field'));
                    }
                    // '/[^\w\s-]/'
                    if ($route->action == "aget") {
                        $result = $feed->get($feedid);
                    }
                    if ($route->action == 'histogram') {
                        $result = $feed->histogram_get_power_vs_kwh($feedid, get('start'), get('end'));
                    }
                    if ($route->action == 'kwhatpower') {
                        $result = $feed->histogram_get_kwhd_atpower($feedid, get('min'), get('max'));
                    }
                    if ($route->action == 'kwhatpowers') {
                        $result = $feed->histogram_get_kwhd_atpowers($feedid, get('points'));
                    }
                    if ($route->action == 'data') {
                        $result = $feed->get_data($feedid, get('start'), get('end'), get('dp'));
                    }
                    if ($route->action == 'average') {
                        $result = $feed->get_average($feedid, get('start'), get('end'), get('interval'));
                    }
                    if ($route->action == 'history') {
                        $result = $feed->get_history($feedid, get('start'), get('end'), get('interval'));
                    }
                }
                // write session required
                if (isset($session['write']) && $session['write'] && $session['userid'] > 0 && $f['userid'] == $session['userid']) {
                    // Storage engine agnostic
                    if ($route->action == 'set') {
                        $result = $feed->set_feed_fields($feedid, get('fields'));
                    }
                    if ($route->action == "insert") {
                        $result = $feed->insert_data($feedid, time(), get("time"), get("value"));
                    }
                    if ($route->action == "update") {
                        $result = $feed->update_data($feedid, time(), get("time"), get('value'));
                    }
                    if ($route->action == "delete") {
//.........这里部分代码省略.........
开发者ID:barriquello,项目名称:simon,代码行数:101,代码来源:feed_controller.php

示例15: action_profile

 public function action_profile()
 {
     $this->auto_render = FALSE;
     $xml = 'FALSE';
     $seoname = $this->request->param('seoname', NULL);
     if ($seoname !== NULL) {
         $user = new Model_User();
         $user->where('seoname', '=', $seoname)->where('status', '=', Model_User::STATUS_ACTIVE)->limit(1)->cached()->find();
         if ($user->loaded()) {
             $info = array('title' => 'RSS ' . htmlspecialchars($user->name, ENT_QUOTES), 'pubDate' => date("r"), 'description' => htmlspecialchars($user->name . ' - ' . $user->description, ENT_QUOTES), 'generator' => 'Yclas', 'link' => Route::url('profile', array('seoname' => $seoname)));
             $items = array();
             //last ads, you can modify this value at: advertisement.feed_elements
             $ads = new Model_Ad();
             $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where('id_user', '=', $user->id_user)->order_by('published', 'desc')->limit(Core::config('advertisement.feed_elements'));
             $ads = $ads->cached()->find_all();
             foreach ($ads as $a) {
                 $url = Route::url('ad', array('category' => $a->category->seoname, 'seotitle' => $a->seotitle));
                 $item = array('title' => htmlspecialchars($a->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($a->published), 'description' => htmlspecialchars(Text::removebbcode($a->description), ENT_QUOTES), 'guid' => $url);
                 if ($a->get_first_image() !== NULL) {
                     $item['description'] = '<img src="' . $a->get_first_image() . '" />' . $item['description'];
                 }
                 $items[] = $item;
             }
             $xml = Feed::create($info, $items);
         }
     }
     $this->response->headers('Content-type', 'text/xml');
     $this->response->body($xml);
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:29,代码来源:feed.php


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