optionslib->get_option('version_dialog_header'); ?>
optionslib) ? $this->optionslib->get_option('version_dialog') : 'release_notes'; if ($versionDialogMode == 'custom_text' || $versionDialogMode == 'both') { ?>
optionslib) ? $this->optionslib->get_option('version_dialog_text') : null; if ($versionDialogText !== null) { $versionDialogTextWithLinks = preg_replace('/(https?:\/\/[^\s<]+)/', '$1', $versionDialogText); echo nl2br($versionDialogTextWithLinks); } else { echo 'No Version Dialog text set. Go to the Admin Menu and set one.'; } ?>
[ 'header' => 'User-Agent: Cloudlog - Amateur Radio Logbook' ] ]; $context = stream_context_create($options); $response = file_get_contents($url, false, $context); if ($response !== false) { $data = json_decode($response, true); $current_version = $this->optionslib->get_option('version'); if ($data !== null && !empty($data)) { $firstRelease = null; foreach ($data as $singledata) { if ($singledata['tag_name'] == $current_version) { $firstRelease = $singledata; break; } } if ($firstRelease !== null) { $releaseBody = isset($firstRelease['body']) ? $firstRelease['body'] : 'No release information available'; $releaseName = isset($firstRelease['name']) ? $firstRelease['name'] : 'No version name information available'; echo "

v" . $releaseName . "

"; // Convert markdown to HTML using PHP $htmlContent = $releaseBody; // Escape HTML first to prevent issues $htmlContent = htmlspecialchars($htmlContent); // Convert headers $htmlContent = preg_replace('/^## (.+)$/m', '

$1

', $htmlContent); $htmlContent = preg_replace('/^# (.+)$/m', '

$1

', $htmlContent); // Convert bullet points to list items // First, find all bullet point sections and convert them to proper lists $htmlContent = preg_replace_callback( '/(?:^[ ]*\* .+(?:\r?\n|$))+/m', function($matches) { $listContent = $matches[0]; // Convert each bullet point to
  • , removing any trailing newlines $listContent = preg_replace('/^[ ]*\* (.+?)(?:\r?\n|$)/m', '
  • $1
  • ', $listContent); // Wrap in
      tags return '
        ' . trim($listContent) . '
      '; }, $htmlContent ); // Convert links (markdown style) $htmlContent = preg_replace('/\[([^\]]+)\]\(([^)]+)\)/', '$1', $htmlContent); // Convert plain URLs to links $htmlContent = preg_replace('/(https?:\/\/[^\s<]+)/', '$1', $htmlContent); // Convert GitHub usernames (@username) to profile links $htmlContent = preg_replace('/@([a-zA-Z0-9_-]+)/', '@$1', $htmlContent); // Convert bold text $htmlContent = preg_replace('/\*\*([^*]+)\*\*/', '$1', $htmlContent); // Convert line breaks to
      tags $htmlContent = nl2br($htmlContent); // Clean up: remove
      tags that appear right before or after list tags $htmlContent = preg_replace('/\s*(<\/?ul>)/', '$1', $htmlContent); $htmlContent = preg_replace('/(<\/?ul>)\s*/', '$1', $htmlContent); $htmlContent = preg_replace('/\s*(<\/?li>)/', '$1', $htmlContent); $htmlContent = preg_replace('/(<\/?li>)\s*/', '$1', $htmlContent); echo "
      " . $htmlContent . "
      "; } else { echo '

      v' . $current_version . '

      '; echo '

      No release information found for this version on GitHub.

      '; } } else { echo 'Error decoding JSON data or received empty response.'; } } else { echo 'Error retrieving data from the GitHub API.'; } ?>