* @revision 04 * @license http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons Attribution-Share Alike 3.0 Germany * @homepage http://oss.tiggerswelt.net/oscar/ * @copyright Copyright © 2009 tiggersWelt.net */ require_once ("oscar/snac.php"); require_once ("oscar/snac/feedbag/item.php"); /** * Generic Handler for SNACs which carry OSCAR_Items * * @class SNAC_Feedbag_Items */ class Oscar_SNAC_Feedbag_Items extends Oscar_SNAC { /* All items on this SNAC */ public $Items; /* Some customized Data for generate () */ protected $Prefix = ""; protected $Suffix = ""; // {{{ parse /** * Peek items from our data * * @param int $maxItems (optional) * * @access public * @return void */ public function parse ($maxItems = null) { // Reset Item-Storage $this->Items = array (); if ($maxItems === null) $maxItems = strlen ($this->Data); // Parse Items while ((count ($this->Items) < $maxItems) && is_object ($Item = Oscar_SNAC_Feedbag_Item::peek ($this->Data))) $this->Items [] = $Item; } // }}} // {{{ generate /** * Convert this SNAC to a string * * @access public * @return string */ public function generate () { // Prefix customized data $this->Data = $this->Prefix; // Append all items on this SNAC foreach ($this->Items as $Item) $this->Data .= $Item->generate (); // Append customized data $this->Data .= $this->Suffix; // Inherit to our parent return parent::generate (); } // }}} } ?>