Ejemplo n.º 1
0
 private static function preparePresence($jaxl, $to, $from, $child, $type, $id, $ns)
 {
     $xml = '<presence';
     if ($type) {
         $xml .= ' type="' . $type . '"';
     }
     if ($from) {
         $xml .= ' from="' . $from . '"';
     }
     if ($to) {
         $xml .= ' to="' . htmlspecialchars($to) . '"';
     }
     if ($id) {
         $xml .= ' id="' . $id . '"';
     }
     $xml .= '>';
     if ($child) {
         if (isset($child['show'])) {
             $xml .= '<show>' . $child['show'] . '</show>';
         }
         if (isset($child['status'])) {
             $xml .= '<status>' . JAXLUtil::xmlentities($child['status']) . '</status>';
         }
         if (isset($child['priority'])) {
             $xml .= '<priority>' . $child['priority'] . '</priority>';
         }
         if (isset($child['payload'])) {
             $xml .= $child['payload'];
         }
     }
     $xml .= '</presence>';
     return $xml;
 }