$object_label = $response["data"]["config"][0]["elements"][1]["value"]; $functional_description = $response["data"]["config"][0]["elements"][2]["value"]; // Removes inline styles function stripStyles($content) { /* From: https://github.com/PebbleRoad/shortcode-parser-for-gather-content/blob/master/parse.php */ /* Remove inline style */ $text = preg_replace('/(<[^>]*) style=("[^"]+"|\'[^\']+\')([^>]*>)/i', '$1$3', $content); /* Replace ” to " */ $text = preg_replace('/\\”/i', '"', $text); $text = preg_replace('/\\’/i', "'", $text); $text = preg_replace('/ /i', "'", $text); return $text; } $object_title = stripStyles($object_title); $object_label = stripStyles($object_label); // Deliver them! if (!empty($object_title)) { print '<h1 id="objectheading">' . $object_title . '</h1>'; } if (!empty($object_label)) { print '<div id="objlabel">'; print $object_label; print '</div>'; } if (!empty($functional_description)) { print '<div id="funcdesc">'; print $functional_description; print '</div>'; } }
function __construct($body, $mimeType) { $this->attachmentId = $body->getAttachmentId(); $this->data = $mimeType == "text/html" ? stripStyles($body->getData()) : $body->getData(); $this->size = $body->getSize(); }