diff --git a/system/modules/x-editors/mawExtendedInsertTags.php b/system/modules/x-editors/mawExtendedInsertTags.php index 646b34e..8daff3c 100644 --- a/system/modules/x-editors/mawExtendedInsertTags.php +++ b/system/modules/x-editors/mawExtendedInsertTags.php @@ -5,7 +5,7 @@ * * @copyright MEN AT WORK 2014 * @package extendedEditors - * @license GNU/LGPL + * @license GNU/LGPL * @filesource */ @@ -15,92 +15,77 @@ * @copyright MEN AT WORK 2014 * @package Frontend */ -class mawExtendedInsertTags extends Controller +class mawExtendedInsertTags { - public function mawReplaceInsertTags($strTag) { $arrSplit = explode('::', $strTag); // Replace tag - switch (strtolower($arrSplit[0])) - { + switch (strtolower($arrSplit[0])) { case 'http': case 'cache_http': case 'https': case 'cache_https': - if (isset($arrSplit[1])) - { + if (isset($arrSplit[1])) { $strReturn = ''; - if (isset($arrSplit[3])) - { + if (isset($arrSplit[3])) { $strReturn .= $arrSplit[3]; - } - elseif (isset($arrSplit[2])) - { + } elseif (isset($arrSplit[2])) { $strReturn .= ($arrSplit[2] == 'blank') ? $arrSplit[1] : $arrSplit[2]; - } - else - { + } else { $strReturn .= $arrSplit[1]; } $strReturn .= ''; + return $strReturn; - } - else - { + } else { return false; } - break; case 'anchor': - return ''.$arrSplit[2].''; - break; + return '' . $arrSplit[2] . ''; + case 'anchor_open': - return ''; - break; + return ''; + case 'anchor_close': return ''; - break; + case 'comments': return $this->countComments($arrSplit[1], $arrSplit[2]); - break; + case 'download': $objFile = \FilesModel::findByUuid($arrSplit[1]); + return '' . $arrSplit[2] . ''; - break; } - return false; } protected function countComments($strParentTable, $intParentId) { - if (empty($strParentTable) || empty($intParentId)) - { + if (empty($strParentTable) || empty($intParentId)) { return false; } - + $objResult = \Database::getInstance() - ->prepare('SELECT COUNT(*) as mycount FROM tl_comments WHERE source=? AND parent=?') - ->execute($strParentTable, $intParentId); - + ->prepare('SELECT COUNT(*) as mycount FROM tl_comments WHERE source=? AND parent=?') + ->execute($strParentTable, $intParentId); + return $objResult->mycount; } public function mawReplaceLanguageTags($strTag) { - if ($strTag == 'actlang') - { + if ($strTag == 'actlang') { return $GLOBALS['TL_LANGUAGE']; - } - else - { + } else { return false; } } -} \ No newline at end of file +}