addTag() public méthode

Add a tag for this element.
public addTag ( string $tag ) : Horde_Push
$tag string The tag.
Résultat Horde_Push This content element.
Exemple #1
0
 /**
  * Generate a Horde_Push element based on the provided data.
  *
  * @param array $data The data to be pushed.
  *
  * @return Horde_Push The element to be pushed.
  */
 private function _createFromData($data)
 {
     if (!isset($data['summary'])) {
         throw new Horde_Push_Exception('Data is lacking a summary element!');
     }
     $push = new Horde_Push();
     $push->setSummary($data['summary']);
     if (isset($data['body'])) {
         if (htmlspecialchars($data['body']) != $data['body']) {
             $push->addContent($data['body'], 'text/html');
         } else {
             $push->addContent($data['body']);
         }
     }
     if (isset($data['tags'])) {
         foreach ($data['tags'] as $tag) {
             $push->addTag($tag);
         }
     }
     if (isset($data['references'])) {
         foreach ($data['references'] as $reference) {
             $push->addReference($reference);
         }
     }
     return $push;
 }