Changeset 14612
- Timestamp:
- 2007/06/14 00:09:08 (17 years ago)
- Location:
- branches/dev/html/test/adachi/LLReader
- Files:
-
- 73 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dev/html/test/adachi/LLReader/LLReader.php
r14611 r14612 1 1 <?php 2 2 require_once('LLReader/Util.php'); 3 require_once('LLReader/Feed.php');4 3 //require_once('LLReader/Constant.php'); 5 4 … … 8 7 private $plugins; 9 8 private $feeds; 10 9 11 10 public function __construct($config){ 12 $this->config = $config; 11 $this->config = $config; 12 $this->plugins = array(); 13 $this->feeds = array(); 13 14 } 14 15 15 16 public function run () { 16 17 $this->load_plugins(); 17 18 18 19 $phases = array( 19 20 'Subscription', … … 30 31 } 31 32 } 32 33 33 34 private function load_plugins () { 34 35 foreach ($this->config['plugins'] as $name => $config) { … … 36 37 $include = preg_replace('/_/', '/', $class) . '.php'; 37 38 $ret = include_once($include); 38 39 39 40 $err = 0; 40 41 41 42 if ($ret) { 42 43 if ( preg_match("/^(.+?)_/", $name, $matches) ) { … … 51 52 } 52 53 else { 53 $this->log('[ERR] ' . $class . " not found");54 $this->log('[ERR] ' . $class . ' not found'); 54 55 $err++; 55 56 } 56 57 } 57 58 58 59 if ($err) { 59 $this->log('[Die] ' . 'function load_plugins()'); 60 exit(); 60 $this->_die('function load_plugins()'); 61 61 } 62 62 } 63 63 64 64 public function log ($msg) { 65 65 LLReader_Util::log($msg); 66 66 } 67 67 68 68 public function p ($var) { 69 69 LLReader_Util::p($var); 70 70 } 71 71 72 public function _die ($msg) { 73 $this->log('[DIE] ' . $msg); 74 exit(); 75 } 76 72 77 private function get_plugins ($phase) { 73 78 if ( empty($this->plugins[$phase]) ) { 74 79 return array(); 75 80 } 76 81 return $this->plugins[$phase]; 77 82 } 78 83 79 84 public function get_feeds () { 80 85 return $this->feeds; 81 86 } 87 88 public function add_feed ($feed) { 89 $this->feeds[] = $feed; 90 } 82 91 } 83 92 ?> -
branches/dev/html/test/adachi/LLReader/LLReader/Feed.php
r14611 r14612 4 4 5 5 class LLReader_Feed extends XML_Feed_Parser { 6 6 public static function entries2feed ($entries, $feed = null, $feed_info = array()) { 7 $xml = ''; 8 return new LLReader_Feed($xml); 9 } 7 10 } 8 11 -
branches/dev/html/test/adachi/LLReader/LLReader/Plugin/Subscription/Simple.php
r14611 r14612 2 2 3 3 require_once('LLReader/Plugin.php'); 4 require_once('LLReader/Feed.php'); 4 5 5 6 class LLReader_Plugin_Subscription_Simple extends LLReader_Plugin { 6 function execute ($llr) {7 public function execute ($llr) { 7 8 $config = $this->get_config(); 8 $llr->p($config); 9 $urls = array(); 10 11 if ( is_array($config['urls']) ) { 12 $urls = $config['urls']; 13 } 14 else { 15 $urls = array($config['urls']); 16 } 17 18 foreach ( $urls as $url ) { 19 $xml = file_get_contents($url); 20 21 try { 22 $feed = new LLReader_Feed($xml); 23 $llr->add_feed($feed); 24 } 25 catch ( XML_Feed_Parser_Exception $e ) { 26 $llr->log('[Warning] Feed invalid: ' . $e->getMessage()); 27 } 28 } 9 29 } 10 30 } -
branches/dev/html/test/adachi/LLReader/pless_release.php
r14611 r14612 1 1 <?php 2 2 3 ini_set('include_path', ini_get('include_path') . ';./;./Lib'); 3 $_ps = PATH_SEPARATOR; 4 $_include_path = ini_get('include_path') . $_ps . './' . $_ps . './Lib'; 5 6 ini_set('include_path', $_include_path); 4 7 5 8 require_once('LLReader.php'); … … 8 11 'plugins' => array( 9 12 'Subscription_Simple' => array( 10 'urls' => array( 11 '', 12 '' 13 ), 14 )/*, 15 'Publish_Mail'=> array( 16 'to' => array( 17 '', 18 '', 19 ), 20 'from' => '' 21 )*/ 13 'urls' => array('http://feeds.feedburner.jp/cnet/rss') 14 ), 15 'Filter_SearchEntry2Feed' => array( 16 'regex' => '/¥é¥¤¥Ö¥É¥¢/i' 17 ), 22 18 ) 23 19 );
Note: See TracChangeset
for help on using the changeset viewer.