| | 331 | |
|---|
| | 332 | $this->_register_feed_handlers(); |
|---|
| | 333 | } |
|---|
| | 334 | |
|---|
| | 335 | function _register_feed_handlers() |
|---|
| | 336 | { |
|---|
| | 337 | debug_push_class(__CLASS__, __FUNCTION__); |
|---|
| | 338 | debug_print_r('$this->_request_switch is now: ', $this->_request_switch); |
|---|
| | 339 | debug_add('Start'); |
|---|
| | 340 | foreach ($this->_request_switch as $handler_id => $switch_data) |
|---|
| | 341 | { |
|---|
| | 342 | debug_add("Checking id '{$handler_id}', it has handler class '{$switch_data['handler'][0]}'"); |
|---|
| | 343 | if ($switch_data['handler'][0] !== 'org_routamc_photostream_handler_list') |
|---|
| | 344 | { |
|---|
| | 345 | debug_add('Not interested, next!'); |
|---|
| | 346 | // We only care about the list views |
|---|
| | 347 | continue; |
|---|
| | 348 | } |
|---|
| | 349 | $new_id = "feed:{$handler_id}"; |
|---|
| | 350 | debug_add("Creating new switch with id '{$new_id}'"); |
|---|
| | 351 | // PHP5-TODO: Must be copy-by-value |
|---|
| | 352 | $new_switch = $switch_data; |
|---|
| | 353 | // switch handler to the feed dispatcher |
|---|
| | 354 | $new_switch['handler'] = array('org_routamc_photostream_handler_feed', 'dispatcher'); |
|---|
| | 355 | // add a variable arg to end of list for feed type |
|---|
| | 356 | if (!isset($new_switch['variable_args'])) |
|---|
| | 357 | { |
|---|
| | 358 | $new_switch['variable_args'] = 0; |
|---|
| | 359 | } |
|---|
| | 360 | $new_switch['variable_args']++; |
|---|
| | 361 | |
|---|
| | 362 | /* OTOH the variable_args increment server the same purpose and it's easier to just add rss.xml/atom.xml to the url... |
|---|
| | 363 | // Prepend /feed/ to list fixed args |
|---|
| | 364 | array_unshift($new_switch['fixed_args'], 'feed'); |
|---|
| | 365 | */ |
|---|
| | 366 | |
|---|
| | 367 | // Add the new switch |
|---|
| | 368 | debug_print_r("Setting \$this->_request_switch['{$new_id}'] to: ", $new_switch); |
|---|
| | 369 | $this->_request_switch[$new_id] = $new_switch; |
|---|
| | 370 | unset($new_id, $new_switch); |
|---|
| | 371 | } |
|---|
| | 372 | debug_add('Done.'); |
|---|
| | 373 | debug_print_r('$this->_request_switch is now: ', $this->_request_switch); |
|---|
| | 374 | debug_pop(); |
|---|