Writer.php in Zircon Profile 8.0
File
vendor/zendframework/zend-feed/src/Writer/Writer.php
View source
<?php
namespace Zend\Feed\Writer;
class Writer {
const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#';
const NAMESPACE_ATOM_10 = 'http://www.w3.org/2005/Atom';
const NAMESPACE_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
const NAMESPACE_RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/';
const NAMESPACE_RSS_10 = 'http://purl.org/rss/1.0/';
const TYPE_ANY = 'any';
const TYPE_ATOM_03 = 'atom-03';
const TYPE_ATOM_10 = 'atom-10';
const TYPE_ATOM_ANY = 'atom';
const TYPE_RSS_090 = 'rss-090';
const TYPE_RSS_091 = 'rss-091';
const TYPE_RSS_091_NETSCAPE = 'rss-091n';
const TYPE_RSS_091_USERLAND = 'rss-091u';
const TYPE_RSS_092 = 'rss-092';
const TYPE_RSS_093 = 'rss-093';
const TYPE_RSS_094 = 'rss-094';
const TYPE_RSS_10 = 'rss-10';
const TYPE_RSS_20 = 'rss-20';
const TYPE_RSS_ANY = 'rss';
protected static $extensionManager = null;
protected static $extensions = [
'entry' => [],
'feed' => [],
'entryRenderer' => [],
'feedRenderer' => [],
];
public static function setExtensionManager(ExtensionManagerInterface $extensionManager) {
static::$extensionManager = $extensionManager;
}
public static function getExtensionManager() {
if (!isset(static::$extensionManager)) {
static::setExtensionManager(new ExtensionManager());
}
return static::$extensionManager;
}
public static function registerExtension($name) {
$feedName = $name . '\\Feed';
$entryName = $name . '\\Entry';
$feedRendererName = $name . '\\Renderer\\Feed';
$entryRendererName = $name . '\\Renderer\\Entry';
$manager = static::getExtensionManager();
if (static::isRegistered($name)) {
if ($manager
->has($feedName) || $manager
->has($entryName) || $manager
->has($feedRendererName) || $manager
->has($entryRendererName)) {
return;
}
}
if (!$manager
->has($feedName) && !$manager
->has($entryName) && !$manager
->has($feedRendererName) && !$manager
->has($entryRendererName)) {
throw new Exception\RuntimeException('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.');
}
if ($manager
->has($feedName)) {
static::$extensions['feed'][] = $feedName;
}
if ($manager
->has($entryName)) {
static::$extensions['entry'][] = $entryName;
}
if ($manager
->has($feedRendererName)) {
static::$extensions['feedRenderer'][] = $feedRendererName;
}
if ($manager
->has($entryRendererName)) {
static::$extensions['entryRenderer'][] = $entryRendererName;
}
}
public static function isRegistered($extensionName) {
$feedName = $extensionName . '\\Feed';
$entryName = $extensionName . '\\Entry';
$feedRendererName = $extensionName . '\\Renderer\\Feed';
$entryRendererName = $extensionName . '\\Renderer\\Entry';
if (in_array($feedName, static::$extensions['feed']) || in_array($entryName, static::$extensions['entry']) || in_array($feedRendererName, static::$extensions['feedRenderer']) || in_array($entryRendererName, static::$extensions['entryRenderer'])) {
return true;
}
return false;
}
public static function getExtensions() {
return static::$extensions;
}
public static function reset() {
static::$extensionManager = null;
static::$extensions = [
'entry' => [],
'feed' => [],
'entryRenderer' => [],
'feedRenderer' => [],
];
}
public static function registerCoreExtensions() {
static::registerExtension('DublinCore');
static::registerExtension('Content');
static::registerExtension('Atom');
static::registerExtension('Slash');
static::registerExtension('WellFormedWeb');
static::registerExtension('Threading');
static::registerExtension('ITunes');
}
public static function lcfirst($str) {
$str[0] = strtolower($str[0]);
return $str;
}
}