function getAddonsTemplate($imgPath = '') { if ($this->params->checkValue('loading-animation', 'Yes')) { return '<img style="display:none;" class="MagicZoomLoading" src="' . $imgPath . '/' . $this->params->getValue("loading-image") . '" alt="' . $this->params->getValue("loading-text") . '"/>'; } else { return ''; } }
/** * Metod to get Magic360 HTML * * @param array $data Magic360Flash Data * @param array $params Additional params * * @return string */ function getMainTemplate($data, $params = array()) { $id = ''; $width = ''; $height = ''; $html = array(); extract($params); // check for width/height if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } // check ID if (empty($id)) { $id = ''; } else { $id = ' id="' . addslashes($id) . '"'; } $images = array(); // set of small images $largeImages = array(); // set of large images $first = reset($data); $src = ' src="' . $first['medium'] . '"'; // add items foreach ($data as $item) { //NOTE: if there are spaces in the filename $images[] = str_replace(' ', '%20', $item['medium']); $largeImages[] = str_replace(' ', '%20', $item['img']); } $rel = $this->params->serialize(); $rel .= 'rows:' . floor(count($data) / $this->params->getValue('columns')) . ';'; $rel .= 'images:' . implode(' ', $images) . ';'; if ($this->params->checkValue('magnify', 'Yes') || $this->params->checkValue('fullscreen', 'Yes')) { $rel .= 'large-images:' . implode(' ', $largeImages) . ';'; } $rel = ' data-magic360-options="' . $rel . '"'; $html[] = '<a' . $id . ' class="Magic360" href="#"' . $rel . '>'; $html[] = '<img itemprop="image"' . $src . $width . $height . ' />'; $html[] = '</a>'; // check message if ($this->params->checkValue('show-message', 'Yes')) { // add message $html[] = '<div class="MagicToolboxMessage">' . $this->params->getValue('message') . '</div>'; } // return HTML string return implode('', $html); }
/** * Method to get main image HTML * * @param array $params Params * * @return string */ function getMainTemplate($params) { $img = ''; $thumb = ''; $id = ''; $alt = ''; $title = ''; $width = ''; $height = ''; $link = ''; extract($params); if (empty($img)) { return false; } if (empty($thumb)) { $thumb = $img; } if (empty($id)) { $id = md5($img); } if (!empty($title)) { $title = htmlspecialchars(htmlspecialchars_decode($title, ENT_QUOTES)); if (empty($alt)) { $alt = $title; } else { $alt = htmlspecialchars(htmlspecialchars_decode($alt, ENT_QUOTES)); } $title = " title=\"{$title}\""; } else { $title = ''; if (empty($alt)) { $alt = ''; } else { $alt = htmlspecialchars(htmlspecialchars_decode($alt, ENT_QUOTES)); } } if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } if ($this->params->checkValue('show-message', 'Yes')) { $message = '<div class="MagicToolboxMessage">' . $this->params->getValue('message') . '</div>'; } else { $message = ''; } if (empty($link)) { $link = ''; } else { $link = " data-link=\"{$link}\""; } $options = $this->params->serialize(); if (!empty($options)) { $options = " data-options=\"{$options}\""; } return "<a id=\"MagicZoomImage{$id}\" class=\"MagicZoom\" href=\"{$img}\"{$link}{$title}{$options}><img itemprop=\"image\" src=\"{$thumb}\" alt=\"{$alt}\"{$width}{$height} /></a>{$message}"; }
/** * Metod to get MagicScroll HTML * * @param array $itemsData MagicScroll data * @param array $params Additional params * * @return string */ function getMainTemplate($itemsData, $params = array()) { $id = ''; $width = ''; $height = ''; $html = array(); extract($params); if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } if (empty($id)) { $id = ''; } else { // add personal options //NOTICE: what is it for? $html[] = $this->getOptionsTemplate($id); $id = ' id="' . addslashes($id) . '"'; } // add div with tool className $additionalClasses = array('default' => '', 'with-borders' => 'msborder'); $additionalClass = $additionalClasses[$this->params->getValue('scroll-style')]; if (!empty($additionalClass)) { $additionalClass = ' ' . $additionalClass; } $html[] = '<div' . $id . ' class="MagicScroll' . $additionalClass . '"' . $width . $height . '>'; // add items foreach ($itemsData as $item) { $img = ''; $thumb = ''; $link = ''; $target = ''; $alt = ''; $title = ''; $description = ''; $width = ''; $height = ''; extract($item); // check big image if (empty($img)) { $img = ''; } //NOTE: remove this? if (isset($medium)) { $thumb = $medium; } // check thumbnail if (!empty($img) || empty($thumb)) { $thumb = $img; } // check item link if (empty($link)) { $link = ''; } else { // check target if (empty($target)) { $target = ''; } else { $target = ' target="' . $target . '"'; } $link = $target . ' href="' . addslashes($link) . '"'; } // check item alt tag if (empty($alt)) { $alt = ''; } else { $alt = htmlspecialchars(htmlspecialchars_decode($alt, ENT_QUOTES)); } // check title if (empty($title)) { $title = ''; } else { $title = htmlspecialchars(htmlspecialchars_decode($title, ENT_QUOTES)); if (empty($alt)) { $alt = $title; } if ($this->params->checkValue('show-image-title', 'No')) { $title = ''; } } // check description if (empty($description)) { $description = ''; } else { //$description = preg_replace("/<(\/?)a([^>]*)>/is", "[$1a$2]", $description); $description = "<span>{$description}</span>"; } if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } // add item $html[] = "<a{$link}><img{$width}{$height} src=\"{$thumb}\" alt=\"{$alt}\" />{$title}{$description}</a>"; } // close core div $html[] = '</div>'; // create HTML string $html = implode('', $html); // return result return $html; }
/** * Method to get MagicScroll HTML * * @param array $itemsData MagicScroll data * @param array $params Additional params * * @return string */ function getMainTemplate($itemsData, $params = array()) { $id = ''; $width = ''; $height = ''; $html = array(); extract($params); if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } //NOTE: get personal options $options = $this->params->serialize(); if (empty($id)) { $id = ''; } else { // add personal options $id = ' id="' . addslashes($id) . '"'; } // add div with tool className $additionalClasses = $this->params->getValue('scroll-extra-styles'); if (empty($additionalClasses)) { $additionalClasses = ''; } else { $additionalClasses = ' ' . $additionalClasses; } if (empty($options)) { $options = ''; } else { $options = ' data-options="' . $options . '"'; } $html[] = '<div' . $id . ' class="MagicScroll' . $additionalClasses . '"' . $width . $height . $options . '>'; // add items foreach ($itemsData as $item) { $img = ''; $thumb = ''; $link = ''; $target = ''; $alt = ''; $title = ''; $description = ''; $width = ''; $height = ''; $medium = ''; extract($item); // check big image if (empty($img)) { $img = ''; } //NOTE: remove this? if (!empty($medium)) { $thumb = $medium; } // check thumbnail if (!empty($img) || empty($thumb)) { $thumb = $img; } // check item link if (empty($link)) { $link = ''; } else { // check target if (empty($target)) { $target = ''; } else { $target = ' target="' . $target . '"'; } $link = $target . ' href="' . addslashes($link) . '"'; } // check item alt tag if (empty($alt)) { $alt = ''; } else { $alt = htmlspecialchars(htmlspecialchars_decode($alt, ENT_QUOTES)); } // check title if (empty($title)) { $title = ''; } else { $title = htmlspecialchars(htmlspecialchars_decode($title, ENT_QUOTES)); if (empty($alt)) { $alt = $title; } if ($this->params->checkValue('show-image-title', 'No')) { $title = ''; } } // check description if (!empty($description) && $this->params->checkValue('show-image-title', 'Yes')) { //$description = preg_replace("/<(\/?)a([^>]*)>/is", "[$1a$2]", $description); //NOTICE: span or div? //NOTICE: scroll takes the first child after image and place it in span.mcs-caption if (empty($title)) { $title = "<span class=\"mcs-description\">{$description}</span>"; } else { //NOTE: to wrap title in span for show with description $title = "<span>{$title}<br /><span class=\"mcs-description\">{$description}</span></span>"; } } if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } // add item $html[] = "<a{$link}><img{$width}{$height} src=\"{$thumb}\" alt=\"{$alt}\" />{$title}</a>"; } // close core div $html[] = '</div>'; // create HTML string $html = implode('', $html); // return result return $html; }
/** * Method to get main image HTML * * @param array $params Params * * @return string */ function getMainTemplate($params) { $img = ''; $thumb = ''; $id = ''; $alt = ''; $title = ''; $description = ''; $width = ''; $height = ''; $link = ''; $group = ''; extract($params); if (empty($img)) { return false; } if (empty($thumb)) { $thumb = $img; } if (empty($id)) { $id = md5($img); } $this->id = $id; if (empty($alt)) { if (empty($title)) { $title = ''; $alt = ''; } else { $alt = htmlspecialchars(htmlspecialchars_decode($title, ENT_QUOTES)); } } else { if (empty($title)) { $title = ''; } $alt = htmlspecialchars(htmlspecialchars_decode($alt, ENT_QUOTES)); } if (empty($description)) { $description = ''; } if ($this->params->checkValue('show-caption', 'Yes')) { $captionSource = $this->params->getValue('caption-source'); $captionSource = strtolower(trim($captionSource)); if ($captionSource == 'all' || $captionSource == 'both') { $captionSource = $this->params->getValues('caption-source'); } else { $captionSource = explode(',', $captionSource); } $fullTitle = array(); foreach ($captionSource as $caption) { $caption = trim($caption); $caption = lcfirst(implode(explode(' ', ucwords($caption)))); if ($caption == 'all' || $caption == 'both' || !isset(${$caption}) || empty(${$caption})) { continue; } if ($caption == 'title') { $fullTitle[] = '<b>' . ${$caption} . '</b>'; } else { $fullTitle[] = ${$caption}; } } $title = implode('<br/>', $fullTitle); $title = trim(preg_replace('/\\s+/is', ' ', $title)); if (!empty($title)) { $title = preg_replace('/<(\\/?)a([^>]*)>/is', '[$1a$2]', $title); $title = '<span>' . $title . '</span>'; } } else { $title = ''; } if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } if ($this->params->checkValue('show-message', 'Yes') && $this->showMessageEnable) { $message = '<div class="MagicToolboxMessage">' . $this->params->getValue('message') . '</div>'; } else { $message = ''; } $rel = $this->params->serialize(); if (!empty($link)) { $rel .= 'link:' . $link . ';'; } if (!empty($group)) { $rel .= 'group:' . $group . ';'; } if (!empty($rel)) { $rel = 'rel="' . $rel . '"'; } return "<a class=\"MagicThumb\" id=\"MagicThumbImage{$id}\" href=\"{$img}\" {$rel}><img itemprop=\"image\"{$width}{$height} src=\"{$thumb}\" alt=\"{$alt}\" />{$title}</a>{$message}"; }
/** * Metod to get MagicSlideshow HTML * * @param array $data MagicSlideshow items data * @param array $params Additional params * * @return string */ function getMainTemplate($data, $params = array()) { $id = ''; $width = ''; $height = ''; $html = array(); extract($params); if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } if (empty($id)) { $id = ''; } else { $html[] = $this->getOptionsTemplate($id); $id = ' id="' . addslashes($id) . '"'; } $html[] = '<div' . $id . ' class="MagicSlideshow"' . $width . $height . '>'; foreach ($data as $item) { $img = ''; //main image $thumb = ''; //thumbnail image $fullscreen = ''; //image shown in Full Screen $link = ''; $target = ''; $alt = ''; $title = ''; $description = ''; $width = ''; $height = ''; extract($item); if (empty($link)) { $link = ''; } else { //NOTICE: use 'links' option ? if (empty($target)) { $target = ''; } else { $target = ' target="' . $target . '"'; } $link = $target . ' href="' . addslashes($link) . '"'; } if (empty($alt)) { $alt = ''; } else { $alt = htmlspecialchars(htmlspecialchars_decode($alt, ENT_QUOTES)); } if (empty($title)) { $caption = $title = ''; } else { $caption = $title; $title = htmlspecialchars(htmlspecialchars_decode($title, ENT_QUOTES)); if (empty($alt)) { $alt = $title; } $title = " title=\"{$title}\""; } if (empty($description)) { $description = ''; } else { $description = preg_replace("/<(\\/?)a([^>]*)>/is", "[\$1a\$2]", $description); $description = "<span>{$description}</span>"; } if (empty($width)) { $width = ''; } else { $width = " width=\"{$width}\""; } if (empty($height)) { $height = ''; } else { $height = " height=\"{$height}\""; } if (empty($img)) { if (empty($caption)) { $html[] = "<div>{$description}</div>"; } else { $html[] = "<div><div data-mss-caption>{$caption}</div><div data-mss-thumbnail>{$description}</div></div>"; } } else { if (empty($thumb)) { $thumb = $img; } if (empty($fullscreen)) { $fullscreen = $img; } $img = $this->params->checkValue('preload', 'No') ? ' src="' . $img . '"' : ' data-image="' . $img . '"'; $thumb = ' data-thumb-image="' . $thumb . '"'; $fullscreen = ' data-fullscreen-image="' . $fullscreen . '"'; $html[] = "<a{$link}><img{$width}{$height}{$img}{$thumb}{$fullscreen}{$title} alt=\"{$alt}\" />{$description}</a>"; } } $html[] = '</div>'; if ($this->params->checkValue('show-message', 'Yes')) { $html[] = '<div class="MagicToolboxMessage">' . $this->params->getValue('message') . '</div>'; } return implode('', $html); }