Skip to content

Commit

Permalink
Simplify pretty_heading, subheading_text
Browse files Browse the repository at this point in the history
  • Loading branch information
michaliskambi committed Oct 29, 2024
1 parent 89f3b38 commit 1136738
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 32 deletions.
20 changes: 4 additions & 16 deletions htdocs/castle-engine-website-base/kambi_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,11 @@
/* functions ======================================================= */

/* Return HTML heading (<h1>).
Given $heading_text, $version_number, $subheading_text will be sanitized for HTML display
(so you cannot use there HTML tags).
You may supply $version_number, this is intended for pages
that document functionality of some program.
You may supply $subheading_text, this will be printed in newline
and with smaller font below heading text. */
function pretty_heading($heading_text, $version_number = NULL, $subheading_text = '')
Given $heading_text will be sanitized for HTML display
(so you cannot use there HTML tags). */
function pretty_heading($heading_text)
{
$result = '<h1>' . htmlspecialchars($heading_text);
if (!is_null($version_number))
$result .= ' <span class="label label-default version_number">' . htmlspecialchars($version_number) . '</span>';
if (!empty($subheading_text))
$result .= '<br><small>' . htmlspecialchars($subheading_text) . '</small>';
$result .= '</h1>';

$result = '<h1>' . htmlspecialchars($heading_text) .'</h1>';
return $result;
}

Expand Down
6 changes: 1 addition & 5 deletions htdocs/castle_engine_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1027,9 +1027,6 @@ function echo_header_bonus ()
name of image to be used as Facebook share image (og:image);
relative to in images/original_size/ , unless it's an absolute URL,
with a protocol like http[s] etc.)
- 'subheading_text' (string,
will be shown in page content, within pretty_heading.
Only relevant when page is part of some book.)
*/
function castle_header($a_page_title, array $parameters = array())
{
Expand Down Expand Up @@ -1087,8 +1084,7 @@ function castle_header($a_page_title, array $parameters = array())
// output extra header HTML, in case we're part of book
if ($castle_current_book != NULL) {
echo book_bar($castle_current_book);
$subheading_text = isset($parameters['subheading_text']) ? $parameters['subheading_text'] : '';
echo pretty_heading($a_page_title_without_book, NULL, $subheading_text);
echo pretty_heading($a_page_title_without_book);
}
}

Expand Down
3 changes: 1 addition & 2 deletions htdocs/castle_script.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ function func($name, $title)
}
?>

<?php echo pretty_heading('CastleScript language', NULL,
'Language for expressions and (simple) scripts in Castle Game Engine'); ?>
<?php echo pretty_heading('CastleScript language'); ?>

<?php
$toc = new TableOfContents(
Expand Down
4 changes: 1 addition & 3 deletions htdocs/creating_data_intro.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
require_once 'castle_engine_functions.php';
castle_header('Creating Game Data', array(
'subheading_text' => 'for games using Castle Game Engine'
));
castle_header('Creating Game Data');
?>

<p>This guide discusses various aspects of preparing game data for use
Expand Down
4 changes: 1 addition & 3 deletions htdocs/creating_data_xml.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
require_once 'castle_engine_functions.php';
castle_header('XML files describing game data', array(
'subheading_text' => '(level.xml, resource.xml and others)'
));
castle_header('XML files describing game data (level.xml, resource.xml and others)');
?>

<p>In this documentation we show a sample of XML files useful to define
Expand Down
5 changes: 3 additions & 2 deletions htdocs/engine_doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
));
?>

<?php echo pretty_heading('Castle Game Engine internals', NULL,
'(Outdated) Overview of the Castle Game Engine and VRML 1.0'); ?>
<?php echo pretty_heading('Castle Game Engine internals'); ?>

<p>Most of this documentation was originally written as my master's thesis,
passed in September 2006. Although I was occasionally updating and adding content
to this document later.</p>

<p><b>This is an outdated overview of the Castle Game Engine and VRML 1.0.</b>

<p><b>Warning: This document isn't a good introduction to the Castle Game Engine (anymore)!</b>

<ul>
Expand Down
2 changes: 1 addition & 1 deletion htdocs/mountains_of_fire.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_once 'castle_engine_functions.php';
castle_header("Mountains Of Fire");

echo pretty_heading('Mountains Of Fire', VERSION_MOUNTAINS_OF_FIRE);
echo pretty_heading('Mountains Of Fire');
echo castle_thumbs(array(
array('filename' => 'mountains_of_fire_screen_0.png', 'titlealt' => 'Mountains Of Fire - game screen 1'),
array('filename' => 'mountains_of_fire_screen_1.png', 'titlealt' => 'Mountains Of Fire - game screen 2'),
Expand Down

0 comments on commit 1136738

Please sign in to comment.