WebPage
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
WebPageEnhanced Class Reference

This class provides methods in order to ease the production of a HTML5 Web page. More...

Inheritance diagram for WebPageEnhanced:
[legend]

Public Member Functions

 __construct (string $title="", string $lang="fr")
 Constructor. More...
 
 getHead ()
 Return the $head string. More...
 
 getBody ()
 Return the $body string. More...
 
 getTitle ()
 Return the $title string. More...
 
 getBodyScripts ()
 Return the $bodyScripts string. More...
 
 setLanguage (string $lang)
 Set the language in which the content is written. More...
 
 setTitle (string $title)
 Set the title of the Web page. More...
 
 setAuthor (string $authorName)
 Set the author of the Web page. More...
 
 setKeywords (string $keywordList)
 Attach a list of keywords to the Web page. More...
 
 setDescription (string $descriptionText)
 Add a short description to the Web page. More...
 
 appendToHead (string $content)
 Add content nested in the <head> element. More...
 
 appendCss (string $css)
 Add CSS code nested in the <head> element. More...
 
 appendCssUrl (string $url)
 Add the URL of an external CSS file. More...
 
 appendScriptToBody (string $rawText)
 Add raw text to $bodyScripts attribute. More...
 
 appendJs (string $js)
 Add JavaScript code. More...
 
 appendJsUrl (string $url)
 Add the URL of an external JavaScript file. More...
 
 appendContent (string $content)
 Add content nested in the <body> element. More...
 
 toHTML ()
 Generate the HTML5 code of the Web page as a string. More...
 

Static Public Member Functions

static getLastModification ()
 Get main script last modification date. More...
 
static escapeString (string $string)
 Protect WebPage content against special characters ("<", ">", ...). More...
 

Private Attributes

string $lang = ""
 Language in which the content is written. More...
 
string $title = ""
 Text nested in the <title> element (mandatory) More...
 
string $head = ""
 Content nested in the <head> element (mainly CSS code) More...
 
string $body = ""
 Content nested in the <body> element. More...
 
string $bodyScripts = ""
 Scripts inserted after the content nested in the <body> element, for performance purposes. More...
 

Detailed Description

This class provides methods in order to ease the production of a HTML5 Web page.

Author
Jérôme Cutrona (jerom.nosp@m.e.cu.nosp@m.trona.nosp@m.@uni.nosp@m.v-rei.nosp@m.ms.f.nosp@m.r)
Olivier Nocent (olivi.nosp@m.er.n.nosp@m.ocent.nosp@m.@uni.nosp@m.v-rei.nosp@m.ms.f.nosp@m.r)
Version
1.1

Constructor & Destructor Documentation

◆ __construct()

WebPageEnhanced::__construct ( string  $title = "",
string  $lang = "fr" 
)

Constructor.

Parameters
string$titlePage title (mandatory)
string$langLanguage global attribute

Reimplemented in MaterialWebPage.

Member Function Documentation

◆ appendContent()

WebPageEnhanced::appendContent ( string  $content)

Add content nested in the <body> element.

Parameters
string$contentContent to be added

◆ appendCss()

WebPageEnhanced::appendCss ( string  $css)

Add CSS code nested in the <head> element.

Parameters
string$cssCSS code to be added

◆ appendCssUrl()

WebPageEnhanced::appendCssUrl ( string  $url)

Add the URL of an external CSS file.

Parameters
string$urlCSS file URL

◆ appendJs()

WebPageEnhanced::appendJs ( string  $js)

Add JavaScript code.

Parameters
string$jsJavaScript code to be added

◆ appendJsUrl()

WebPageEnhanced::appendJsUrl ( string  $url)

Add the URL of an external JavaScript file.

Parameters
string$urlJavaScript file URL

◆ appendScriptToBody()

WebPageEnhanced::appendScriptToBody ( string  $rawText)

Add raw text to $bodyScripts attribute.

Parameters
string$rawTextraw text to be added

◆ appendToHead()

WebPageEnhanced::appendToHead ( string  $content)

Add content nested in the <head> element.

Parameters
string$contentContent to be added

◆ escapeString()

static WebPageEnhanced::escapeString ( string  $string)
static

Protect WebPage content against special characters ("<", ">", ...).

Parameters
string$stringLa chaîne à protéger
Returns
string La chaîne protégée
See also
https://www.php.net/manual/en/function.htmlspecialchars.php

◆ getBody()

WebPageEnhanced::getBody ( )

Return the $body string.

◆ getBodyScripts()

WebPageEnhanced::getBodyScripts ( )

Return the $bodyScripts string.

◆ getHead()

WebPageEnhanced::getHead ( )

Return the $head string.

◆ getLastModification()

static WebPageEnhanced::getLastModification ( )
static

◆ getTitle()

WebPageEnhanced::getTitle ( )

Return the $title string.

◆ setAuthor()

WebPageEnhanced::setAuthor ( string  $authorName)

Set the author of the Web page.

Parameters
string$authorNameAuthor's name

◆ setDescription()

WebPageEnhanced::setDescription ( string  $descriptionText)

Add a short description to the Web page.

Parameters
string$descriptionTextShort description text

◆ setKeywords()

WebPageEnhanced::setKeywords ( string  $keywordList)

Attach a list of keywords to the Web page.

Parameters
string$keywordListKeyword list

◆ setLanguage()

WebPageEnhanced::setLanguage ( string  $lang)

Set the language in which the content is written.

Parameters
string$langLanguage codename (en, fr, pt, ...)

◆ setTitle()

WebPageEnhanced::setTitle ( string  $title)

Set the title of the Web page.

Parameters
string$titleTitle

◆ toHTML()

WebPageEnhanced::toHTML ( )

Generate the HTML5 code of the Web page as a string.

Returns
string HTML5 code

Member Data Documentation

◆ $body

string WebPageEnhanced::$body = ""
private

Content nested in the <body> element.

◆ $bodyScripts

string WebPageEnhanced::$bodyScripts = ""
private

Scripts inserted after the content nested in the <body> element, for performance purposes.

◆ $head

string WebPageEnhanced::$head = ""
private

Content nested in the <head> element (mainly CSS code)

◆ $lang

string WebPageEnhanced::$lang = ""
private

Language in which the content is written.

◆ $title

string WebPageEnhanced::$title = ""
private

Text nested in the <title> element (mandatory)


The documentation for this class was generated from the following file: