'."\n"; $beforeAll['ul'] = ''."\n"; $afterAll['br'] = ''; $type = 'table'; $cols = 1; if (!empty($parameter->displaytype)) { $type = $parameter->displaytype; } if ($type == 'none') { return implode('', $elements); } if (!empty($parameter->cols)) { $cols = $parameter->cols; } $string = $beforeAll[$type]; $a = 0; $numrow = 1; foreach ($elements as $oneElement) { if ($a == $cols) { $string .= $afterBlock[$type]; $a = 0; } if ($a == 0) { $string .= str_replace('{rownum}', $numrow, $beforeBlock[$type]); $numrow++; } $string .= str_replace('{numcol}', $a + 1, $beforeOne[$type]).$oneElement.$afterOne[$type]; $a++; } while ($cols > $a) { $string .= str_replace('{numcol}', $a + 1, $beforeOne[$type]).$afterOne[$type]; $a++; } $string .= $afterBlock[$type]; $string .= $afterAll[$type]; $equalwidth = intval(100 / $cols).'%'; $string = str_replace(['{equalwidth}'], [$equalwidth], $string); return $string; } public function formatString(&$replaceme, $mytag) { if (!empty($mytag->part)) { $parts = explode(' ', $replaceme); if ($mytag->part == 'last') { $replaceme = count($parts) > 1 ? end($parts) : ''; } else { if (is_numeric($mytag->part) && count($parts) >= $mytag->part) { $replaceme = $parts[$mytag->part - 1]; } else { $replaceme = reset($parts); } } } if (!empty($mytag->type)) { if (empty($mytag->format)) { $mytag->format = acym_translation('ACYM_DATE_FORMAT_LC3'); } if ($mytag->type == 'date') { $replaceme = acym_getDate(acym_getTime($replaceme), $mytag->format); } elseif ($mytag->type == 'time') { $replaceme = acym_getDate($replaceme, $mytag->format); } elseif ($mytag->type == 'diff') { try { $date = $replaceme; if (is_numeric($date)) { $date = acym_getDate($replaceme, '%Y-%m-%d %H:%M:%S'); } $dateObj = new DateTime($date); $nowObj = new DateTime(); $diff = $dateObj->diff($nowObj); $replaceme = $diff->format($mytag->format); } catch (Exception $e) { $replaceme = 'Error using the "diff" parameter in your tag. Please make sure the DateTime() and diff() functions are available on your server.'; } } } if (!empty($mytag->lower) || !empty($mytag->lowercase)) { $replaceme = function_exists('mb_strtolower') ? mb_strtolower($replaceme, 'UTF-8') : strtolower($replaceme); } if (!empty($mytag->upper) || !empty($mytag->uppercase)) { $replaceme = function_exists('mb_strtoupper') ? mb_strtoupper($replaceme, 'UTF-8') : strtoupper($replaceme); } if (!empty($mytag->ucwords)) { $replaceme = ucwords($replaceme); } if (!empty($mytag->ucfirst)) { $replaceme = ucfirst($replaceme); } if (isset($mytag->rtrim)) { $replaceme = empty($mytag->rtrim) ? rtrim($replaceme) : rtrim($replaceme, $mytag->rtrim); } if (!empty($mytag->urlencode)) { $replaceme = urlencode($replaceme); } if (!empty($mytag->substr)) { $args = explode(',', $mytag->substr); if (isset($args[1])) { $replaceme = substr($replaceme, intval($args[0]), intval($args[1])); } else { $replaceme = substr($replaceme, intval($args[0])); } } if (!empty($mytag->maxheight) || !empty($mytag->maxwidth)) { $imageHelper = acym_get('helper.image'); $imageHelper->maxHeight = empty($mytag->maxheight) ? 999 : $mytag->maxheight; $imageHelper->maxWidth = empty($mytag->maxwidth) ? 999 : $mytag->maxwidth; $replaceme = $imageHelper->resizePictures($replaceme); } } public function replaceVideos(&$text) { $text = preg_replace('#\[embed=videolink][^}]*youtube[^=]*=([^"/}]*)[^}]*}\[/embed]#i', '', $text); $text = preg_replace('#]*youtube\.com/embed/([^"/]*)[^>]*>[^>]*#i', '', $text); $text = preg_replace('#{JoooidContent[^}]*youtube[^}]*id"[^"]*"([^}"]*)"[^}]*}#i', '', $text); $text = preg_replace('#]*src="[^"]*youtube[^"]*embed/([^"?]*)(\?[^"]*)?"[^>]*>[^<]*#Uis', '', $text); $text = preg_replace('#{youtube}[^{]+v=([^{&]+)(&[^{]*)?{/youtube}#Uis', '', $text); $text = preg_replace('#{vimeo}(https://vimeo.com/[^{]+){/vimeo}#Uis', '', $text); $text = preg_replace('#{vimeo}([^{]+){/vimeo}#Uis', '', $text); if (preg_match_all('#]*src="[^"]*vimeo[^"]*/(\d+)([&/\?][^"]*)?"[^>]*>[^<]*#Uis', $text, $matches)) { foreach ($matches[1] as $key => $match) { $hash = acym_fileGetContent('http://vimeo.com/api/v2/video/'.$match.'.php'); $hash = @unserialize($hash); if (empty($hash)) continue; if (strpos($matches[0][$key], ' width="') !== false) { $extension = substr($hash[0]['thumbnail_large'], strrpos($hash[0]['thumbnail_large'], '.')); preg_match('#width="([^"]*)"#Uis', $matches[0][$key], $width); $replace = strpos($hash[0]['thumbnail_large'], '_') === false ? '.' : '_'; $hash[0]['thumbnail_large'] = substr($hash[0]['thumbnail_large'], 0, strrpos($hash[0]['thumbnail_large'], $replace)).'_'.$width[1].$extension; } $thumbnail = 'https://i.vimeocdn.com/filter/overlay?src='.urlencode($hash[0]['thumbnail_large']).'&src='.urlencode('http://f.vimeocdn.com/p/images/crawler_play.png'); $text = str_replace($matches[0][$key], '', $text); } } $text = preg_replace('#\[embed=videolink][^}]*video":"([^"]*)[^}]*}\[/embed]#i', '', $text); $text = preg_replace('#]*src="([^"]*)"[^>]*>[^>]*#i', '', $text); } private function _convertbase64pictures(&$html) { if (!preg_match_all('#]*src=("data:image/([^;]{1,5});base64[^"]*")([^>]*)>#Uis', $html, $resultspictures)) { return; } $dest = ACYM_MEDIA.'resized'.DS; acym_createDir($dest); foreach ($resultspictures[2] as $i => $extension) { $pictname = md5($resultspictures[1][$i]).'.'.$extension; $picturl = ACYM_LIVE.ACYM_MEDIA_FOLDER.'/resized/'.$pictname; $pictPath = $dest.$pictname; $pictCode = trim($resultspictures[1][$i], '"'); if (file_exists($pictPath)) { $html = str_replace($pictCode, $picturl, $html); continue; } $getfunction = ''; switch ($extension) { case 'gif': $getfunction = 'ImageCreateFromGIF'; break; case 'jpg': case 'jpeg': $getfunction = 'ImageCreateFromJPEG'; break; case 'png': $getfunction = 'ImageCreateFromPNG'; break; } if (empty($getfunction) || !function_exists($getfunction)) { continue; } $img = $getfunction($pictCode); if (in_array($extension, ['gif', 'png'])) { imagealphablending($img, false); imagesavealpha($img, false); } ob_start(); switch ($extension) { case 'gif': $status = imagegif($img); break; case 'jpg': case 'jpeg': $status = imagejpeg($img, null, 100); break; case 'png': $status = imagepng($img, null, 1); break; } $imageContent = ob_get_clean(); $status = $status && acym_writeFile($pictPath, $imageContent); if (!$status) { continue; } $html = str_replace($pictCode, $picturl, $html); } } public function cleanHtml(&$html) { $this->_convertbase64pictures($html); $pregreplace = []; $pregreplace['#"]*>([^<]*]*>[ \n\s]*]*>[ \n\s]*]*>[ \n\s]*)*).)*>[ \n\s]*(]*>)?[ \n\s]*]*>[ \n\s]*(]*>)?[ \n\s]*).)*< */ *script *>#Uis"] = ''; $pregreplace["#< *iframe(?:(?!< */ *iframe *>).)*< */ *iframe *>#Uis"] = ''; $pregreplace['#(

]*>)#i', $html, $results)) { return; } static $replace = []; foreach ($results[0] as $num => $oneResult) { if (isset($replace[$oneResult])) { continue; } if (strpos($oneResult, 'width=') || strpos($oneResult, 'height=')) { continue; } if (preg_match('#[^a-z_\-]width *:([0-9 ]{1,8})#i', $oneResult, $res) || preg_match('#[^a-z_\-]height *:([0-9 ]{1,8})#i', $oneResult, $res)) { continue; } if (!preg_match('#src="([^"]*)"#i', $oneResult, $url)) { continue; } $imageUrl = $url[1]; $replace[$oneResult] = $oneResult; $base = str_replace(['http://www.', 'https://www.', 'http://', 'https://'], '', ACYM_LIVE); $replacements = ['https://www.'.$base, 'http://www.'.$base, 'https://'.$base, 'http://'.$base]; $localpict = false; foreach ($replacements as $oneReplacement) { if (strpos($imageUrl, $oneReplacement) === false) { continue; } $imageUrl = str_replace([$oneReplacement, '/'], [ACYM_ROOT, DS], urldecode($imageUrl)); $localpict = true; break; } if (!$localpict) { continue; } $dim = @getimagesize($imageUrl); if (!$dim) { continue; } if (empty($dim[0]) || empty($dim[1])) { continue; } $replace[$oneResult] = str_replace('mailerHelper)) { $this->mailerHelper = acym_get('helper.mailer'); } $textreplace = []; foreach ($tags as $i => $replacement) { if (isset($textreplace[$i])) { continue; } $textreplace[$i] = $this->mailerHelper->textVersion($replacement, true); } } else { $textreplace = $tags; } foreach ($variables as $var) { if (empty($email->$var)) { continue; } $email->$var = $this->replaceDText($email->$var, in_array($var, $htmlVars) ? $tags : $textreplace); } } public function replaceDText($text, $replacement) { if (is_array($text)) { foreach ($text as $i => &$oneCell) { if (empty($oneCell)) { continue; } $oneCell = $this->replaceDText($oneCell, $replacement); } } elseif (is_string($text) && !empty($text)) { foreach ($replacement as $code => $value) { $text = preg_replace('#]+'.preg_quote($code, '#').'.+[^<]*#Uis', $value, $text); $text = str_replace($code, $value, $text); } } return $text; } public function extractTags($email, $tagfamily) { $results = []; $match = '#(?:{|%7B)'.$tagfamily.'(?:%3A|\\:)(.*)(?:}|%7D)#Ui'; $variables = ['subject', 'body', 'From', 'FromName', 'ReplyTo', 'ReplyName', 'bcc', 'cc', 'fromname', 'fromemail', 'replyname', 'replyemail', 'params']; $found = false; foreach ($variables as $var) { if (empty($email->$var)) { continue; } if (is_array($email->$var)) { foreach ($email->$var as $i => $arrayField) { if (empty($arrayField)) { continue; } if (is_array($arrayField)) { foreach ($arrayField as $a => $oneval) { $found = preg_match_all($match, $oneval, $results[$var.$i.'-'.$a]) || $found; if (empty($results[$var.$i.'-'.$a][0])) { unset($results[$var.$i.'-'.$a]); } } } else { $found = preg_match_all($match, $arrayField, $results[$var.$i]) || $found; if (empty($results[$var.$i][0])) { unset($results[$var.$i]); } } } } else { $found = preg_match_all($match, $email->$var, $results[$var]) || $found; if (empty($results[$var][0])) { unset($results[$var]); } } } if (!$found) { return []; } $tags = []; foreach ($results as $var => $allresults) { foreach ($allresults[0] as $i => $oneTag) { if (isset($tags[$oneTag])) { continue; } $tags[$oneTag] = $this->extractTag($allresults[1][$i]); } } return $tags; } public function extractTag($oneTag) { $arguments = explode('|', strip_tags(urldecode($oneTag))); $tag = new stdClass(); $tag->id = $arguments[0]; $tag->default = ''; for ($i = 1, $a = count($arguments) ; $i < $a ; $i++) { $args = explode(':', $arguments[$i]); $arg0 = trim($args[0]); if (empty($arg0)) { continue; } if (isset($args[1])) { $tag->$arg0 = $args[1]; if (isset($args[2])) { $tag->{$args[0]} .= ':'.$args[2]; } } else { $tag->$arg0 = true; } } return $tag; } public function wrapText($text, $tag) { $this->wraped = false; if (!empty($tag->wrap)) { $tag->wrap = intval($tag->wrap); } if (empty($tag->wrap)) { return $text; } $allowedTags = []; $allowedTags[] = 'b'; $allowedTags[] = 'strong'; $allowedTags[] = 'i'; $allowedTags[] = 'em'; $allowedTags[] = 'a'; $aloneAllowedTags = []; $aloneAllowedTags[] = 'br'; $aloneAllowedTags[] = 'img'; $newText = preg_replace('/]*>/i', '
', $text); $newText = preg_replace('/]*>/i', '
', $newText); $newText = strip_tags($newText, '<'.implode('><', array_merge($allowedTags, $aloneAllowedTags)).'>'); $newText = preg_replace('/^(\s|\n|(]*>))+/i', '', trim($newText)); $newText = preg_replace('/(\s|\n|(]*>))+$/i', '', trim($newText)); $newText = str_replace(['<', '>'], ['<', '>'], $newText); $numChar = strlen($newText); $numCharStrip = strlen(strip_tags($newText)); if ($numCharStrip <= $tag->wrap) { return $newText; } $this->wraped = true; $open = []; $write = true; $countStripChar = 0; for ($i = 0 ; $i < $numChar ; $i++) { if ($newText[$i] == '<') { foreach ($allowedTags as $oneAllowedTag) { if ($numChar >= ($i + strlen($oneAllowedTag) + 1) && substr($newText, $i, strlen($oneAllowedTag) + 1) == '<'.$oneAllowedTag && (in_array($newText[$i + strlen($oneAllowedTag) + 1], [' ', '>']))) { $write = false; $open[] = ''; } if ($numChar >= ($i + strlen($oneAllowedTag) + 2) && substr($newText, $i, strlen($oneAllowedTag) + 2) == '') { array_pop($open); } } } foreach ($aloneAllowedTags as $oneAllowedTag) { if ($numChar >= ($i + strlen($oneAllowedTag) + 1) && substr($newText, $i, strlen($oneAllowedTag) + 1) == '<'.$oneAllowedTag && (in_array($newText[$i + strlen($oneAllowedTag) + 1], [' ', '/', '>']))) { $write = false; } } } if ($write) { $countStripChar++; } if ($newText[$i] == ">") { $write = true; } if ($newText[$i] == " " && $countStripChar >= $tag->wrap && $write) { $newText = substr($newText, 0, $i).'...'; $open = array_reverse($open); $newText = $newText.implode('', $open); break; } } $newText = preg_replace('/^(\s|\n|(]*>))+/i', '', trim($newText)); $newText = preg_replace('/(\s|\n|(]*>))+$/i', '', trim($newText)); return $newText; } public function getStandardDisplay($format) { if (empty($format->tag->format)) $format->tag->format = 'TOP_LEFT'; if (!in_array($format->tag->format, ['TOP_LEFT', 'TOP_RIGHT', 'TITLE_IMG', 'TITLE_IMG_RIGHT', 'CENTER_IMG', 'TOP_IMG', 'COL_LEFT', 'COL_RIGHT'])) { return 'Wrong format supplied: '.$format->tag->format; } $invertValues = ['TOP_LEFT' => 'TOP_RIGHT', 'TITLE_IMG' => 'TITLE_IMG_RIGHT', 'COL_LEFT' => 'COL_RIGHT', 'TOP_RIGHT' => 'TOP_LEFT', 'TITLE_IMG_RIGHT' => 'TITLE_IMG', 'COL_RIGHT' => 'COL_LEFT']; if (!empty($format->tag->invert) && !empty($invertValues[$format->tag->format])) { $format->tag->format = $invertValues[$format->tag->format]; } $image = ''; if (!empty($format->imagePath)) { $style = ''; if (in_array($format->tag->format, ['TOP_LEFT', 'TITLE_IMG'])) { $style = 'left; margin-right'; } elseif (in_array($format->tag->format, ['TOP_RIGHT', 'TITLE_IMG_RIGHT'])) { $style = 'right; margin-left'; } if (!empty($style)) $style = ' style="float:'.$style.': 7px; margin-bottom: 7px;"'; $image = ''; } $result = ''; if ($format->tag->format == 'TITLE_IMG' || $format->tag->format == 'TITLE_IMG_RIGHT') { $format->title = $image.$format->title; $image = ''; } if (!empty($format->link) && !empty($image)) { $image = ''.$image.''; } if ($format->tag->format == 'TOP_IMG' && !empty($image)) { $result = $image; $image = ''; } if (in_array($format->tag->format, ['COL_LEFT', 'COL_RIGHT'])) { if (empty($image)) { $format->tag->format = 'TOP_LEFT'; } else { $result = '
'; if ($format->tag->format == 'COL_LEFT') { $result .= $image.''; } } } if (!empty($format->title)) { if (!empty($format->link)) { $format->title = 'tag->type) && $format->tag->type == 'title' ? ' class="acym_title"' : '').' href="'.$format->link.'" target="_blank" name="'.$this->name.'-'.$format->tag->id.'">'.$format->title.''; } if (empty($format->tag->type) || $format->tag->type != 'title') { $format->title = '

'.$format->title.'

'; } $result .= $format->title; } if (!empty($format->afterTitle)) $result .= $format->afterTitle; if (!empty($format->description)) { $format->description = $this->wrapText($format->description, $format->tag); } $rowText = '
'; $endRow = '

'; if (in_array($format->tag->format, ['TOP_LEFT', 'TOP_RIGHT', 'TITLE_IMG', 'TITLE_IMG_RIGHT', 'TOP_IMG'])) { if (!empty($image) || !empty($format->description)) { $result .= $rowText.$image.$format->description.$endRow; } } elseif ($format->tag->format == 'CENTER_IMG') { if (!empty($image)) { $result .= '
'.$image.$endRow; } if (!empty($format->description)) { $result .= $rowText.$format->description.$endRow; } } elseif (in_array($format->tag->format, ['COL_LEFT', 'COL_RIGHT'])) { if (!empty($format->description)) { $result .= $rowText.$format->description.$endRow; } if ($format->tag->format == 'COL_RIGHT') { $result .= '
'.$image; } $result .= '
'; } if (!empty($format->customFields)) { $result .= ''; if (empty($format->cols)) $format->cols = 1; $i = 0; foreach ($format->customFields as $oneField) { if ($i != 0 && $i % $format->cols == 0) $result .= ''; $result .= ''; $i++; } while ($i % $format->cols != 0) { $result .= ''; $i++; } $result .= '
'; } else { $result .= 'label">'.$oneField[1].''; } $result .= $oneField[0].'
'; } if (!empty($format->afterArticle)) { $result .= $format->afterArticle; } return $result; } public function managePicts($tag, $result) { if (!isset($tag->pict)) { return $result; } $imageHelper = acym_get('helper.image'); if ($tag->pict === 'resized') { $imageHelper->maxHeight = empty($tag->maxheight) ? 150 : $tag->maxheight; $imageHelper->maxWidth = empty($tag->maxwidth) ? 150 : $tag->maxwidth; if ($imageHelper->available()) { $result = $imageHelper->resizePictures($result); } elseif (acym_isAdmin()) { acym_enqueueMessage($imageHelper->error, 'notice'); } } elseif ($tag->pict == '0') { $result = $imageHelper->removePictures($result); } return $result; } public function getFormatOption($plugin, $default = 'TOP_LEFT', $singleElement = true, $function = 'updateTag') { $contentformat = ['TOP_LEFT' => '-208', 'TOP_RIGHT' => '-260', 'TITLE_IMG' => '0', 'TITLE_IMG_RIGHT' => '-52', 'CENTER_IMG' => '-104', 'TOP_IMG' => '-156', 'COL_LEFT' => '-312', 'COL_RIGHT' => '-364']; $name = $singleElement ? 'contentformat' : 'contentformatauto'; $result = ''; $result .= ''; $result .= '

'; ob_start(); ?> '; foreach ($options as $option) { $output .= '
'; if ($option['type'] == 'boolean') { $output .= acym_boolean($option['name'].$suffix, $option['default'], $option['name'].$suffix, array('onclick' => $updateFunction.'();')); $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'input[name="'.$option['name'].$suffix.'"]:checked\').val();'; } if ($option['type'] == 'radio') { $radioOptions = []; foreach ($option['options'] as $value => $title) { $radioOptions[] = acym_selectOption($value, acym_translation($title)); } $output .= acym_radio($radioOptions, $option['name'].$suffix, $option['default'], $option['name'].$suffix, array('onclick' => $updateFunction.'();')); $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'input[name="'.$option['name'].$suffix.'"]:checked\').val();'; } if ($option['type'] == 'checkbox') { $output .= '
'; foreach ($option['options'] as $value => $title) { $output .= '
'; } $output .= '
'; if (empty($option['separator'])) $option['separator'] = ','; $jsOptionsMerge[] = 'var _checked'.$option['name'].$suffix.' = []; jQuery("input:checkbox[name='.$option['name'].$suffix.']:checked").each(function(){ _checked'.$option['name'].$suffix.'.push(jQuery(this).val()); }); if(_checked'.$option['name'].$suffix.'.length) otherinfo += "| '.$option['name'].':" + _checked'.$option['name'].$suffix.'.join("'.$option['separator'].'");'; } if ($option['type'] == 'select') { $selectOptions = []; foreach ($option['options'] as $value => $title) { $selectOptions[] = acym_selectOption($value, acym_translation($title)); } $default = empty($option['default']) ? null : $option['default']; $output .= acym_select($selectOptions, $option['name'].$suffix, $default, 'onchange="'.$updateFunction.'();" id="'.$option['name'].$suffix.'"'); if ($option['name'] == 'order') { $dirs = [ 'desc' => acym_translation('ACYM_DESC'), 'asc' => acym_translation('ACYM_ASC'), ]; $default = empty($option['defaultdir']) ? null : $option['defaultdir']; $output .= ' '.acym_select($dirs, 'orderdir', $default, 'onchange="'.$updateFunction.'();" style="width: 120px;"'); $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'[name="'.$option['name'].$suffix.'"]\').val() + "," + jQuery(\'[name="orderdir"]\').val();'; } else { $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'[name="'.$option['name'].$suffix.'"]\').val();'; } } if ($option['type'] == 'multiselect') { $selectOptions = []; foreach ($option['options'] as $value => $title) { $selectOptions[] = acym_selectOption($value, acym_translation($title)); } $output .= acym_selectMultiple($selectOptions, $option['name'].$suffix, [], ['onchange' => $updateFunction.'();', 'id' => $option['name'].$suffix]); $jsOptionsMerge[] = ' var theMultiSelect = document.querySelector(\'[name="'.$option['name'].$suffix.'[]"]\'); var selectedOptions = []; for(var i = 0 ; i < theMultiSelect.length ; i++){ if(theMultiSelect[i].selected){ selectedOptions.push(theMultiSelect[i].value); } } otherinfo += "| '.$option['name'].':" + selectedOptions.join(",");'; } if ($option['type'] == 'text') { $class = empty($option['class']) ? 'acym_plugin_text_field' : $option['class']; $output .= ''; $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'input[name="'.$option['name'].$suffix.'"]\').val();'; } if ($option['type'] == 'number') { $min = empty($option['min']) ? '' : ' min="'.$option['min'].'"'; $max = empty($option['max']) ? '' : ' max="'.$option['max'].'"'; $class = empty($option['class']) ? 'acym_plugin_text_field' : $option['class']; $output .= ''; $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'input[name="'.$option['name'].$suffix.'"]\').val();'; } if ($option['type'] == 'intextfield') { $output .= acym_translation_sprintf($option['text'], ''); $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'input[name="'.$option['name'].$suffix.'"]\').val();'; } if ($option['type'] == 'pictures') { $valImages = []; $valImages[] = acym_selectOption("1", acym_translation('ACYM_YES')); $valImages[] = acym_selectOption("resized", acym_translation('ACYM_RESIZED')); $valImages[] = acym_selectOption("0", acym_translation('ACYM_NO')); $output .= acym_radio($valImages, 'pict'.$suffix, 'resized', 'pict'.$suffix, ['onclick' => $updateFunction.'();']).'
'.acym_translation('ACYM_WIDTH').' x '.acym_translation('ACYM_HEIGHT').' '; $jsOptionsMerge[] = ' var _pictVal'.$suffix.' = jQuery(\'input[name="pict'.$suffix.'"]:checked\').val(); otherinfo += "| pict:" + _pictVal'.$suffix.'; if(_pictVal'.$suffix.' == "resized"){ jQuery("#pictsize'.$suffix.'").show(); otherinfo += "| maxwidth:" + jQuery(\'input[name="pictwidth'.$suffix.'"]\').val(); otherinfo += "| maxheight:" + jQuery(\'input[name="pictheight'.$suffix.'"]\').val(); }else{ jQuery("#pictsize'.$suffix.'").hide(); }'; } if ($option['type'] == 'date') { $output .= ''; $jsOptionsMerge[] = 'otherinfo += "| '.$option['name'].':" + jQuery(\'input[name="'.$option['name'].$suffix.'"]\').val();'; } if ($option['type'] == 'custom') { $output .= $option['output']; $jsOptionsMerge[] = $option['js']; } $output .= '
'; } $output .= ''; $output .= ' '; return $output; } public function translateItem(&$item, &$tag, $referenceTable, $referenceId = 0) { if (empty($tag->lang) || (!file_exists(ACYM_ROOT.'components'.DS.'com_falang') && !file_exists(ACYM_ROOT.'components'.DS.'com_joomfish'))) return; $langid = intval(substr($tag->lang, strpos($tag->lang, ',') + 1)); if (empty($langid)) return; if (empty($referenceId)) $referenceId = $tag->id; $table = file_exists(ACYM_ROOT.'components'.DS.'com_falang') ? '`#__falang_content`' : '`#__jf_content`'; $query = 'SELECT `reference_field`, `value` FROM '.$table.' WHERE `published` = 1 AND `reference_table` = '.acym_escapeDB($referenceTable).' AND `language_id` = '.intval($langid).' AND `reference_id` = '.intval($referenceId); $translations = acym_loadObjectList($query); if (empty($translations)) return; foreach ($translations as $oneTranslation) { if (empty($oneTranslation->value)) continue; $translatedfield = $oneTranslation->reference_field; $item->$translatedfield = $oneTranslation->value; } } }