function init($args = array()) { $qh = new QuoteHelper($this->site_id, $this->page_id); if ($this->params['quote_divider']) { $qh->set_quote_divider($this->params['quote_divider']); } if ($this->params['cache_lifespan'] > 0) { $qh->set_cache_lifespan($this->params['cache_lifespan']); } if ($this->params['page_category_mode']) { $qh->set_page_category_mode($this->params['page_category_mode']); } $qh->init(); // javascript refresh mode currently forces display to a single quote $num_to_display = $this->params['enable_javascript_refresh'] ? 1 : $this->params['num_to_display']; $this->quotes =& $qh->get_quotes($num_to_display, $this->params['rand_flag']); $this->init_head_items(); }
$qh->set_site_id($request['site_id']); } if (isset($request['page_id'])) { $qh->set_page_id($request['page_id']); } if (isset($request['cache_lifespan'])) { $qh->set_cache_lifespan($request['cache_lifespan']); } if (isset($request['page_category_mode'])) { $qh->set_page_category_mode($request['page_category_mode']); } if (isset($request['viewed_quote_ids'])) { $qh->set_unavailable_quote_ids($request['viewed_quote_ids']); } // this should be able to support quotes when not in random mode as well probably $qh->init(); $quote =& $qh->get_random_quote(); if (!empty($quote)) { $prefer_short_quotes = isset($request['prefer_short_quotes']) ? $request['prefer_short_quotes'] : false; $short_description = $prefer_short_quotes ? $quote->get_value('description') : ''; $quote_id = $quote->id(); $quote_text = $short_description ? $short_description : $quote->get_value('content'); $quote_author = $quote->get_value('author') ? $quote->get_value('author') : ''; $quote_divider = $quote->get_value('quote_divider') ? $quote->get_value('quote_divider') : ''; } // if we have a quote id and quote text then return the xml chunk if (!empty($quote_id) && !empty($quote_text)) { header('Content-type: text/xml'); echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<quote>' . "\n"; echo '<id>' . $quote_id . '</id>' . "\n";