/** * Prepare ACF input for embedding * * @param type var Description * @return string $output HTML string */ protected function create_output() { // Get iframe HTML $iframe = $this->set_video_attributes(); $el = 'div'; if ($this->context === 'gallery') { $this->classes[] = 'gallery__item'; $this->classes[] = 'orbit-slide'; $el = 'li'; } // Open element. $this->output_tag_open($el); $this->output .= '<div class="gallery__video-wrapper">'; $this->output .= $iframe; // Set caption if available. if (!empty($this->input['video_caption'])) { $this->set_video_caption(); } // Add caption if set. if (is_object($this->caption)) { $this->output .= $this->caption->embed(); } // Close wrapper. $this->output .= '</div>'; // Close element. $this->output_tag_close($el); }
/** * testEmbed method * * @access public * @return void */ public function testEmbed() { // TEST BASIC JS EMBED $result = $this->Wufoo->embed('test-form', $this->testLoginData); $expected = array(array('script' => array('type' => 'text/javascript')), $this->cDataStart, $this->cDataEnd, '/script', array('script' => array('type' => 'text/javascript')), $this->cDataStart, 'preg:/var a[0-9]+ \\= new WufooForm\\(\\);[\\n\\r]*/', 'preg:/a[0-9]+\\.initialize\\(\\{[\\n\\r]*/', 'preg:/[\\s]*\'userName\'\\:\'fishbowl\'\\,[\\n\\r]*/', 'preg:/[\\s]*\'formHash\'\\:\'test-form\'\\,[\\n\\r]*/', 'preg:/[\\s]*\'autoResize\'\\:1\\,[\\n\\r]*/', 'preg:/[\\s]*\'height\'\\:\'590\'\\}\\);[\\n\\r]*/', 'preg:/a[0-9]+\\.display\\(\\);[\\n\\r]*/', $this->cDataEnd, '/script'); $this->assertTags($result, $expected); // TEST JS EMBED WITH OPTIONS $this->Wufoo->__options = null; $result = $this->Wufoo->embed('test-form', array_merge($this->testLoginData, array('height' => 300, 'autoResize' => 0)), array('encoding' => 'utf-8')); $expected = array(array('script' => array('type' => 'text/javascript', 'encoding' => 'utf-8')), $this->cDataStart, $this->cDataEnd, '/script', array('script' => array('type' => 'text/javascript', 'encoding' => 'utf-8')), $this->cDataStart, 'preg:/var a[0-9]+ \\= new WufooForm\\(\\);[\\n\\r]*/', 'preg:/a[0-9]+\\.initialize\\(\\{[\\n\\r]*/', 'preg:/[\\s]*\'userName\'\\:\'fishbowl\'\\,[\\n\\r]*/', 'preg:/[\\s]*\'formHash\'\\:\'test-form\'\\,[\\n\\r]*/', 'preg:/[\\s]*\'autoResize\'\\:0\\,[\\n\\r]*/', 'preg:/[\\s]*\'height\'\\:\'300\'\\}\\);[\\n\\r]*/', 'preg:/a[0-9]+\\.display\\(\\);[\\n\\r]*/', $this->cDataEnd, '/script'); $this->assertTags($result, $expected); }
/** * Set image properties by using input and modifiers. * * @since 0.1.0 * * @return string $embed HTML string of caption to be added. **/ protected function build_image_caption() { $embed = $this->caption->embed(); if (!empty($embed)) { return $embed; } }
/** * Executes the specified link and embeds the response in the current instance entity. * * @param \Gedcomx\Links\Link $link * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @throws Exception\GedcomxApplicationException */ protected function embed(Link $link, StateTransitionOption $option = null) { if ($link->getHref() != null) { $this->lastEmbeddedRequest = $this->createRequestForEmbeddedResource('GET', $link); $this->lastEmbeddedResponse = $this->passOptionsTo('invoke', array($this->lastEmbeddedRequest), func_get_args()); if ($this->lastEmbeddedResponse->getStatusCode() == 200) { $json = json_decode($this->lastEmbeddedResponse->getBody(), true); $entityClass = get_class($this->entity); $this->entity->embed(new $entityClass($json)); } else { if (floor($this->lastEmbeddedResponse->getStatusCode() / 100) == 5) { throw new GedcomxApplicationException(sprintf("Unable to load embedded resources: server says \"%s\" at %s.", $this->lastEmbeddedResponse . getClientResponseStatus() . getReasonPhrase(), $this->lastEmbeddedRequest . getURI()), $this->lastEmbeddedResponse); } else { //todo: log a warning? throw an error? } } } }
/** * Overwrite initial output value for Grid blocks * * @since 0.1.0 * @access protected * * @TODO create single addition script. **/ protected function create_output() { // If a grid is created inside a story, make this into an figure class. if (is_single() || is_page()) { $el = 'figure'; } if (class_exists('Exchange_Leaflet_Map')) { $map_shortcode = $this->prepare_map_attributes(); if ('dots' === $this->input['map_style']) { $this->set_map_markers(); } elseif ('network' === $this->input['map_style']) { $this->set_map_collaborations(); } $this->set_caption(); $this->output_tag_open($el); $this->output .= apply_filters('the_content', $map_shortcode); // Add individual marker script elements. if ($this->has_markers) { $markers = $this->map_markers; foreach ($markers as $marker) { $this->output .= apply_filters('the_content', $marker); } } elseif ($this->has_network) { $collaborations = $this->collaboration_data; foreach ($collaborations as $collaboration) { $this->output .= apply_filters('the_content', $collaboration); } } // Add caption. if ($this->has_caption) { $this->output .= $this->caption->embed(); } // Close map element. $this->output_tag_close($el); } else { $this->output_tag_open($el); $this->output .= '<span>Normally, we would see a map here!</span>'; $this->output_tag_close($el); } }
/** * Get e-mail addresses from an array, string or unlimited number of arguments and send the e-mail * * Friendly name portions (e.g. Leo <*****@*****.**>) are allowed. * @param mixed * @return boolean */ public function sendTo() { $arrRecipients = $this->compileRecipients(func_get_args()); if (!count($arrRecipients)) { return false; } $this->objMessage->setTo($arrRecipients); $this->objMessage->setCharset($this->strCharset); $this->objMessage->setPriority($this->intPriority); // Default subject if (empty($this->strSubject)) { $this->strSubject = 'No subject'; } $this->objMessage->setSubject($this->strSubject); // HTML e-mail if (!empty($this->strHtml)) { // Embed images if ($this->blnEmbedImages) { if (!strlen($this->strImageDir)) { $this->strImageDir = TL_ROOT . '/'; } $arrMatches = array(); preg_match_all('/src="([^"]+\\.(jpe?g|png|gif|bmp|tiff?|swf))"/Ui', $this->strHtml, $arrMatches); $strBase = Environment::getInstance()->base; // Check for internal images foreach (array_unique($arrMatches[1]) as $url) { // Try to remove the base URL $src = str_replace($strBase, '', $url); // Embed the image if the URL is now relative if (!preg_match('@^https?://@', $src) && file_exists($this->strImageDir . $src)) { $cid = $this->objMessage->embed(Swift_EmbeddedFile::fromPath($this->strImageDir . $src)); $this->strHtml = str_replace('src="' . $url . '"', 'src="' . $cid . '"', $this->strHtml); } } } $this->objMessage->setBody($this->strHtml, 'text/html'); } // Text content if (!empty($this->strText)) { if (!empty($this->strHtml)) { $this->objMessage->addPart($this->strText, 'text/plain'); } else { $this->objMessage->setBody($this->strText, 'text/plain'); } } // Add the administrator e-mail as default sender if ($this->strSender == '') { list($this->strSenderName, $this->strSender) = $this->splitFriendlyName($GLOBALS['TL_CONFIG']['adminEmail']); } // Sender if ($this->strSenderName != '') { $this->objMessage->setFrom(array($this->strSender => $this->strSenderName)); } else { $this->objMessage->setFrom($this->strSender); } // Send e-mail $intSent = self::$objMailer->send($this->objMessage, $this->arrFailures); // Log failures if (!empty($this->arrFailures)) { log_message('E-mail address rejected: ' . implode(', ', $this->arrFailures), $this->strLogFile); } // Return if no e-mails have been sent if ($intSent < 1) { return false; } // Add log entry $strMessage = 'An e-mail has been sent to ' . implode(', ', array_keys($this->objMessage->getTo())); if (count($this->objMessage->getCc()) > 0) { $strMessage .= ', CC to ' . implode(', ', array_keys($this->objMessage->getCc())); } if (count($this->objMessage->getBcc()) > 0) { $strMessage .= ', BCC to ' . implode(', ', array_keys($this->objMessage->getBcc())); } log_message($strMessage, $this->strLogFile); return true; }
/** * Publish galkert * * @param string $context * @return void * @TODO add filter instead of hardcoding the Orbit references */ public function publish_gallery($context = '') { // Add foundation orbit gallery element. $context_class = $context . ' orbit-container'; $output = ''; $items = count($this->gallery); if ($this->has_video) { $items++; } if ($items > 1) { $output .= '<button class="orbit-previous gallery__navigation gallery__navigation--prev"><svg class="hide-for-sr" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 67.274742 99.65184"><path d="M13.3 0h1.3c0 .3.8 0 .8.7h1.2c0 .8 1.6.4 1.7 1.2h2.5c.2 1.4 2.8 1 3.2 2.3 1.3-.3.8 1 2 .8.3.6 1 .8 1.7 1 0 .5.5 1 1 1s.4.6.5 1c.4 0 .4 0 .4.4 1-.2.8.7 2 .4.2.4.5.7 1.2.7 0 .4.5.3.8.4 0 .3.2.4.4.4.6.2.7.7 1.3.8.2.3.5.3.8.4h.5s.3 1.3 1.5 1c.5.8 1.3 1.3 2.5 1.5 0 .5.5.4.8.5 0 .4.2.4.4.4 0 .3.5.2 1 .3-.2.4 0 .4.3.4.7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4-1.2-1-1-.4-2-1-2.5-2-1 .3-.8-.8-1.6-.8-.6-.3-.7-.8-1.3-1-.2-.3-1-.2-1-1-.6 0-.7-.5-1.3-.6v-2c0-.4-.5-.3-.8-.4 0-.5 0-.8-.5-1 0-.3 0-.6-.5-.7-.3 0-.3 0-.4-.4-1-.4-1-2-2-2 .2-2-1-2.7-1.8-3.8.2-1 .5-1.7 1-2.5v-5c.2.2.3 0 .3-.3-.2-1 1-.8 1.3-1.2.2-.6.6-1 1.2-1.3 0-.7 0-1-.5-1.3.2-.3.5-.7.4-1.2 1 0 .6-1.6 1.2-2 2.3 0 5 .3 4.5-2.5 1.7-.4 1.3 1.2 3 .8v-1z" fill="#ffbc00" fill-rule="evenodd"/><image src="' . get_template_directory_uri() . '/assets/images/png/T_arrows_Single_WEB.png" xlink:href=""></svg><span class="show-for-sr">Previous Image</span></button>' . PHP_EOL . '<button class="orbit-next gallery__navigation gallery__navigation--next"><svg class="hide-for-sr" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 67.274742 99.65184"><path d="M13.3 0h1.3c0 .3.8 0 .8.7h1.2c0 .8 1.6.4 1.7 1.2h2.5c.2 1.4 2.8 1 3.2 2.3 1.3-.3.8 1 2 .8.3.6 1 .8 1.7 1 0 .5.5 1 1 1s.4.6.5 1c.4 0 .4 0 .4.4 1-.2.8.7 2 .4.2.4.5.7 1.2.7 0 .4.5.3.8.4 0 .3.2.4.4.4.6.2.7.7 1.3.8.2.3.5.3.8.4h.5s.3 1.3 1.5 1c.5.8 1.3 1.3 2.5 1.5 0 .5.5.4.8.5 0 .4.2.4.4.4 0 .3.5.2 1 .3-.2.4 0 .4.3.4.7.6 2 .6 2.4 1.7.7.6 2 .6 2.4 1.6 1 .5 1.6 1.2 3 1.3.4 1.3 1.7 1.7 2.7 2.5.2.8 1.5.3 1.4 1.2.4.3 1 .7 1 1.3 1.3 0 1.3 1 2.5.8.2 1 1.2 1 1.3 1.8.3.2.7.4.8.8.6 0 .8 0 1 .5.5 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 .2-2-1-2.7-1.8-3.8.2-1 .5-1.7 1-2.5v-5c.2.2.3 0 .3-.3-.2-1 1-.8 1.3-1.2.2-.6.6-1 1.2-1.3 0-.7 0-1-.5-1.3.2-.3.5-.7.4-1.2 1 0 .6-1.6 1.2-2 2.3 0 5 .3 4.5-2.5 1.7-.4 1.3 1.2 3 .8v-1z" fill="#ffbc00" fill-rule="evenodd"/><image src="' . get_template_directory_uri() . '/assets/images/png/T_arrows_Single_WEB.png" xlink:href=""></svg><span class="show-for-sr">Next Image</span></button>'; } if ($this->has_gallery) { $output .= '<ul class="gallery--' . $context_class . '">'; foreach ($this->gallery as $img) { $img_string = $img->embed('gallery'); $output .= $img_string; } if ($this->has_video) { $output .= $this->video->embed('gallery'); } $output .= '</ul>'; } echo $output; }