/**
  * Metod 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);
     }
     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};
             }
         }
         $description = implode('<br/>', $fullTitle);
         $description = trim(preg_replace('/\\s+/is', ' ', $description));
         if (!empty($description)) {
             $description = preg_replace('/<(\\/?)a([^>]*)>/is', '[$1a$2]', $description);
             $description = '<span>' . $description . '</span>';
         }
     } else {
         $description = '';
     }
     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 ($this->params->checkValue('show-title', 'disable')) {
         $title = '';
     }
     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 = '';
     }
     $rel = $this->params->serialize();
     $tap = '';
     if (empty($link)) {
         $link = '';
     } else {
         if ($this->params->checkValue('disable-expand', 'Yes')) {
             //onclick only if MagicThumb disabled
             $link = ' onclick="document.location.href=\'' . $link . '\'"';
             $tap = "<script>\$mjs('MagicZoomPlusImage{$id}').je1('touchstart', onMagicTap); \$mjs('MagicZoomPlusImage{$id}').je1('touchend', onMagicTap);</script>";
         } else {
             $rel .= 'link:' . $link . ';';
             $link = '';
         }
     }
     if (!empty($group)) {
         $rel .= 'group:' . $group . ';';
     }
     if (isset($advanced_option)) {
         $rel .= $advanced_option . ';';
     }
     if (isset($hotspots) && $hotspots) {
         $rel .= 'hotspots:' . $hotspots;
     }
     if (!empty($rel)) {
         $rel = 'rel="' . $rel . '"';
     }
     return "<a{$link} class=\"MagicZoomPlus\"{$title} id=\"MagicZoomPlusImage{$id}\" href=\"{$img}\" {$rel}><img itemprop=\"image\"{$width}{$height} src=\"{$thumb}\" alt=\"{$alt}\" />{$description}</a>{$message}{$tap}";
 }
 /**
  * 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}";
 }