Documentation

MCI_Footnotes_Template

Handles each Template file for the Plugin Frontend (e.g. Settings Dashboard, Public pages, ...).

Loads a template file, replaces all Placeholders and returns the replaced file content.

Tags
author

Stefan Herndler

since
1.5.0

Table of Contents

C_STR_DASHBOARD  = "dashboard"
Directory name for dashboard templates.
C_STR_PUBLIC  = "public"
Directory name for public templates.
$plugin_directory  : string
Plugin Directory
$a_str_OriginalContent  : string
Contains the content of the template after initialize.
$a_str_ReplacedContent  : string
Contains the content of the template after initialize with replaced place holders.
__construct()  : mixed
Class Constructor. Reads and loads the template file without replace any placeholder.
get_template()  : mixed
Get the template
getContent()  : string
Returns the content of the template file with replaced placeholders.
process_template()  : void
Process template file
reload()  : mixed
Reloads the original content of the template file.
replace()  : bool
Replace all placeholders specified in array.

Constants

C_STR_DASHBOARD

Directory name for dashboard templates.

public string C_STR_DASHBOARD = "dashboard"
Tags
author

Stefan Herndler

since
1.5.0

C_STR_PUBLIC

Directory name for public templates.

public string C_STR_PUBLIC = "public"
Tags
author

Stefan Herndler

since
1.5.0

Properties

$plugin_directory

Plugin Directory

public string $plugin_directory
Tags
author

Patrizia Lutz @misfist

since
2.4.0d3

$a_str_OriginalContent

Contains the content of the template after initialize.

private string $a_str_OriginalContent = ""
Tags
author

Stefan Herndler

since
1.5.0

$a_str_ReplacedContent

Contains the content of the template after initialize with replaced place holders.

private string $a_str_ReplacedContent = ""
Tags
author

Stefan Herndler

since
1.5.0

Methods

__construct()

Class Constructor. Reads and loads the template file without replace any placeholder.

public __construct(string $p_str_FileType, string $p_str_FileName[, string $p_str_Extension = "html" ]) : mixed
Parameters
$p_str_FileType : string

Template file type (take a look on the Class constants).

$p_str_FileName : string

Template file name inside the Template directory without the file extension.

$p_str_Extension : string = "html"

Optional Template file extension (default: html)

Tags
author

Stefan Herndler

since
1.5.0
since
2.2.6

support for custom templates 2020-12-19T0606+0100

since
2.4.0

look for custom template in the active theme first, thanks to @misfist

link
https://wordpress.org/support/topic/template-override-filter/
link
https://wordpress.org/support/topic/template-override-filter/#post-13846598
Return values
mixed

get_template()

Get the template

public get_template(string $p_str_FileType, string $p_str_FileName[, string $p_str_Extension = "html" ]) : mixed
Parameters
$p_str_FileType : string
$p_str_FileName : string
$p_str_Extension : string = "html"
Tags
author

Patrizia Lutz @misfist

since
2.4.0d3
Return values
mixed

false | template path

getContent()

Returns the content of the template file with replaced placeholders.

public getContent() : string
Tags
author

Stefan Herndler

since
1.5.0
Return values
string

Template content with replaced placeholders.

process_template()

Process template file

public process_template(string $template) : void
Parameters
$template : string
Tags
author

Patrizia Lutz @misfist

since
2.4.0d3
since
2.0.3

replace tab with a space

since
2.0.3

replace 2 spaces with 1

since
2.0.4

collapse multiple spaces

since
2.2.6

delete a space before a closing pointy bracket

since
2.5.4

collapse HTML comments and PHP/JS docblocks (only)

Return values
void

reload()

Reloads the original content of the template file.

public reload() : mixed
Tags
author

Stefan Herndler

since
1.5.0
Return values
mixed

replace()

Replace all placeholders specified in array.

public replace(array<string|int, mixed> $p_arr_Placeholders) : bool
Parameters
$p_arr_Placeholders : array<string|int, mixed>

Placeholders (key = placeholder, value = value).

Tags
author

Stefan Herndler

since
1.5.0
Return values
bool

True on Success, False if Placeholders invalid.

Search results