addContent() public method

Add content to this element.
public addContent ( string | resource $content, string $mime_type = 'text/plain', array $params = [] ) : Horde_Push
$content string | resource The UTF-8 encoded content.
$mime_type string The MIME type of the content.
$params array Content specific parameters.
return Horde_Push This content element.
Esempio n. 1
0
 public function testFluidAddContent()
 {
     $push = new Horde_Push();
     $this->assertInstanceOf('Horde_Push', $push->addContent('CONTENT'));
 }
Esempio n. 2
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;
 }