示例#1
0
文件: Rule.php 项目: nsimon/gnip-php
 /**
  * Returns an XML data stream of the current rule
  *
  * @access    public
  * @param     void
  * @return    XMLElement    Requested rule XML data
  */
 public function toXML()
 {
     $xml = new GnipSimpleXMLElement("<rule/>");
     $xml->addAttribute("type", $this->type);
     $xml->addAttribute("value", $this->value);
     return trim($xml->asXML());
 }
示例#2
0
 /**
  * Converts the publisher to properly formatted XML.
  * 
  * @return XML formatted publisher data
  */
 function toXML()
 {
     $xml = new GnipSimpleXMLElement("<publisher/>");
     $xml->addAttribute('name', $this->name);
     $child = $xml->addChild("supportedRuleTypes");
     foreach ($this->supported_rule_types as $rule_type) {
         $child->addChild('type', $rule_type->type);
     }
     return trim($xml->asXML());
 }
示例#3
0
 /**
  * Returns, as an XML data stream, current values of class data items.
  *
  * @access    public
  * @param     void
  * @return    XMLElement    Requested publisher XML data
  */
 function toXML()
 {
     $xml = new GnipSimpleXMLElement("<activity/>");
     $xml->addAttribute("at", $this->at->format(DATE_ATOM));
     $xml->addAttribute("action", $this->action);
     $xml->addAttribute("actor", $this->actor);
     $xml->addOptionalAttribute("regarding", $this->regarding);
     $xml->addOptionalAttribute("source", $this->source);
     $xml->addOptionalAttribute("tags", implode(",", $this->tags));
     $xml->addOptionalAttribute("to", $this->to);
     $xml->addOptionalAttribute("url", $this->url);
     return trim($xml->asXML());
 }
示例#4
0
 /**
  * Returns an XML data stream of the current filter
  *
  * @access    public
  * @param     void
  * @return    XMLElement    Requested publisher XML data
  */
 public function toXML()
 {
     $xml = new GnipSimpleXMLElement("<filter/>");
     $xml->addAttribute("name", $this->name);
     $xml->addAttribute("fullData", $this->fullData);
     $xml->addOptionalChild("postUrl", $this->postUrl);
     $xml->addOptionalChild("jid", $this->jid);
     foreach ($this->rules as $rule) {
         $rule_node = $xml->addChild("rule");
         $rule_node->addAttribute("type", $rule->type);
         $rule_node->addAttribute("value", $rule->value);
     }
     return trim($xml->asXML());
 }
示例#5
0
 /**
  * Converts the filter to properly formatted XML.
  * 
  * @return XML formatted filter data
  */
 public function toXML()
 {
     $xml = new GnipSimpleXMLElement("<filter/>");
     $xml->addAttribute('name', $this->name);
     $xml->addAttribute('fullData', $this->fullData);
     $xml->addOptionalChild('postURL', $this->postURL);
     foreach ($this->rules as $rule) {
         $rule_node = $xml->addChild('rule', $rule->value);
         $rule_node->addAttribute('type', $rule->type);
     }
     return trim($xml->asXML());
 }
示例#6
0
 /**
  * Converts the rule types to properly formatted XML.
  * 
  * @return XML formatted rule type data
  */
 public function toXML()
 {
     $xml = new GnipSimpleXMLElement("<type/>");
     $xml[0] = $this->type;
     return trim($xml->asXML());
 }
示例#7
0
 /**
  * Returns an XML data stream of the current publisher
  *
  * @access    public
  * @param     void
  * @return    XMLElement    Requested publisher XML data
  */
 function toXML()
 {
     $xml = new GnipSimpleXMLElement("<publisher/>");
     $xml->addAttribute("name", $this->name);
     return trim($xml->asXML());
 }