00001 <?php 00002 /*************************************************************************** 00003 * Copyright (C) 2010 by Alexandr S. Krotov * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Lesser General Public License as * 00007 * published by the Free Software Foundation; either version 3 of the * 00008 * License, or (at your option) any later version. * 00009 * * 00010 ***************************************************************************/ 00011 00016 final class YandexRssFeedFormat extends FeedFormat 00017 { 00018 const YANDEX_NAMESPACE_URI = 'http://news.yandex.ru'; 00019 const YANDEX_NAMESPACE_PREFIX = 'yandex'; 00020 00024 public static function me() 00025 { 00026 return Singleton::getInstance(__CLASS__); 00027 } 00028 00032 public function getChannelWorker() 00033 { 00034 return RssChannelWorker::me(); 00035 } 00036 00040 public function getItemWorker() 00041 { 00042 return YandexRssItemWorker::me(); 00043 } 00044 00045 public function isAcceptable(SimpleXMLElement $xmlFeed) 00046 { 00047 return ( 00048 ($xmlFeed->getName() == 'rss') 00049 && (isset($xmlFeed['version'])) 00050 && ($xmlFeed['version'] == RssFeedFormat::VERSION) 00051 && array_key_exists( 00052 self::YANDEX_NAMESPACE_PREFIX, 00053 $xmlFeed->getDocNamespaces(true) 00054 ) 00055 ); 00056 } 00057 } 00058 ?>