Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • DashboardAdmin
  • DashboardPlugin
  • SiteInfo
  • WebylonNews
 1 <?php
 2 
 3 class WebylonNews extends DashboardPlugin {
 4     static $position = "left";
 5     static $sort = 1;
 6     static $title = "Webylon News";
 7     static $icon = "dashboard/images/22/feed.png";
 8 
 9     /**
10      * @var $rss_url = sets the url of the RSS feed
11      */
12     static $rss_url = 'http://webylon.ru/stuff/rss.php?v=3.1';
13 
14     /**
15      * Uses SimplePie to pull in the news feed from $rss_url variable, process and cast it, then output it to a DataObjectSet
16      * 
17      * @return DataObjectSet 
18      */
19     function LatestSSNews() {
20         $sp23 = Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/simplepie.php');
21         $sp24 = Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/simplepie.inc');
22 
23         if(file_exists($sp23))
24             include_once $sp23;
25         elseif(file_exists($sp24))
26             include_once $sp24;
27         
28         $output = new DataObjectSet();
29         
30         $feed = new SimplePie(self::$rss_url, TEMP_FOLDER);
31         $feed->init();
32         if($items = $feed->get_items(0, 2)) {
33             foreach($items as $item) {
34                 
35                 // Cast the Date
36                 $date = new Date('Date');
37                 $date->setValue($item->get_date());
38 
39                 // Cast the Title
40                 $title = new Text('Title');
41                 $title->setValue($item->get_title());
42                 
43                 // Cast the description and strip
44                 $desc = new HTMLText('Description');
45 //              $desc->setValue(strip_tags($item->get_description()));
46                 $desc->setValue($item->get_description());
47 
48                 $output->push(new ArrayData(array(
49                     'Title'         => $title,
50                     'Date'          => $date,
51                     'Link'          => $item->get_link(),
52                     'Description'   => $desc
53                 )));
54             }
55             return $output;
56         }
57     }  
58 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0