requireServiceFile() public static method

Require a service file (according to the “cascade”)
public static requireServiceFile ( string $service ) : boolean
$service string Service
return boolean
Exemplo n.º 1
0
<?php

defined('PUBWICH') or die('No direct access allowed.');
/**
 * @classname Pinboard
 * @description Fetch Pinboard bookmarks
 * @version 1.0 (20110115)
 * @author Rémi Prévost (exomel.com)
 * @methods None
 */
Pubwich::requireServiceFile('RSS');
class Pinboard extends RSS
{
    public function __construct($config)
    {
        $config['link'] = 'http://pinboard.in/u:' . $config['username'] . '/';
        $config['url'] = sprintf('http://feeds.pinboard.in/rss/secret:%s/u:%s/', $config['secret'], $config['username']);
        parent::__construct($config);
        $this->setItemTemplate('<li><a href="{{{link}}}">{{{title}}}</a></li>' . "\n");
    }
    // This is RSS 1.0 (RDF), not RSS 2.0…
    public function getData()
    {
        $data = parent::getParentData();
        return $data->item;
    }
}
Exemplo n.º 2
0
<?php

defined('PUBWICH') or die('No direct access allowed.');
/**
 * Delicious Service
 *
 * Fetch Delicious bookmarks.
 *
 * @version 1.1 (20090929)
 * @author Rémi Prévost (exomel.com)
 * @author Michael Haschke, http://michael.haschke.biz/
 * @methods None
 */
Pubwich::requireServiceFile('Feed');
class Delicious extends Feed
{
    public function __construct($config)
    {
        $config['link'] = 'http://delicious.com/' . $config['username'] . '/';
        $config['url'] = sprintf('http://feeds.delicious.com/v2/rss/%s?count=%s', $config['username'], $config['total']);
        parent::__construct($config);
        $this->setItemTemplate('<li>
                <a href="{{{link}}}">{{{title}}}</a>
                ({{{date}}})
                {{#category}}
                    <em><a href="{{{service_link}}}{{{category}}}">{{{category}}}</a></em>
                {{/category}}
             </li>' . "\n");
    }
    /**
     * @return array
Exemplo n.º 3
0
<?php

defined('PUBWICH') or die('No direct access allowed.');
/**
 * @classname GitHub
 * @description Fetch GitHub user public activity feed
 * @version 1.0 (20100107)
 * @author Rémi Prévost (exomel.com)
 * @methods None
 */
Pubwich::requireServiceFile('Atom');
class Github extends Atom
{
    /**
     * @constructor
     */
    public function __construct($config)
    {
        $config['url'] = sprintf('http://github.com/%s.atom', $config['username']);
        $config['link'] = 'http://github.com/' . $config['username'] . '/';
        parent::__construct($config);
        $this->setItemTemplate('<li class="clearfix"><a href="{%link%}">{%title%}</a></li>' . "\n");
    }
    /**
     * @return array
     */
    public function populateItemTemplate(&$item)
    {
        return parent::populateItemTemplate($item) + array();
    }
}