' . $urlStart . '' . '' . $urlFolders . '' . '' . $transformation . '' . '' . $urlEnd . ''; } /** * @param $html * * @return string */ function getFormattedHtml($html) { return '' . htmlspecialchars($html) . ''; } /** * @param $code * * @param bool $keepSpaces * * @return bool|mixed|string */ function getColoredPhp($code, $keepSpaces = true) { $phpStr = [ '<?php', '<?php ', '<?php ', ]; $result = highlight_string(''); $result = removeDoubleSpaces($result); } $result = str_replace($phpStr, '', $result); if ($keepSpaces) { return '
' . $result . '
'; } return $result; } /** * Find the position of the Xth occurrence of a substring in a string * * @param $haystack * @param $needle * @param int $number integer > 0 * * @return int|false */ function strPosX($haystack, $needle, $number) { if ($number == 1) { return strpos($haystack, $needle); } if ($number > 1) { return strpos($haystack, $needle, strPosX($haystack, $needle, $number - 1) + strlen($needle)); } return false; } /** * @param $str * * @return mixed */ function removeDoubleSpaces($str) { while (strpos($str, '  ') !== false) { $str = str_replace('  ', ' ', $str); } return $str; } /** * @param $title * @param $description * * @return string */ function getPageStart($title, $description) { return ' ' . $title . '
'; } function getPageEnd() { return '
'; } function getNavLinks($navLinks, $currentNavLink) { $result = ''; return $result; } function getNavBar($navLinks, $currentNavLink) { return ' '; } function getContent($title, $groups, $htmlContent) { return '

' . $title . '

' . $htmlContent . '
' . groupsToString($groups) . '
'; } function getSideBar($groups) { return ' '; } function getSideBarGroups($groups) { $result = ''; foreach ($groups as $group) { $name = $group['name']; $icon = $group['iconClass']; //fas fa-camera //fas fa-video $result .= '
' . $name . '
' . getSideBarSubGroups($group['items']); } return $result; } /** * @param $subGroups * * @return string */ function getSideBarSubGroups($subGroups) { $result = ''; foreach ($subGroups as $subGroup) { $name = $subGroup['name']; $trimmedName = getTrimmedStr($name); $result .= '
' . $name . '
'; } return $result; } function getPageScripts($tabs = ['php', 'url']) { $result = ' '; return $result; } function groupsToString($groups) { $result = ''; foreach ($groups as $group) { $result .= groupToString($group); } return $result; } /** * @param $group * * @return string */ function groupToString($group) { $result = ''; foreach ($group['items'] as $subGroup) { $result .= subGroupToString($subGroup); } return $result; } /** * @param $str * * @return string|string[]|null */ function getTrimmedStr($str) { return preg_replace('/\s+/', '', (preg_replace('/[^A-Za-z0-9 ]/', '', $str))); } /** * @param $subGroup * * @return string */ function subGroupToString($subGroup) { $trimmedName = getTrimmedStr($subGroup['name']); $result = '
'; foreach ($subGroup['items'] as $sample) { $result .= $sample; } $result .= '
'; return $result; } /** * @return string */ function getSampleTabs() { $result = '
'; return $result; }