The basis feindura class for the implementation classes.
It's methods provide necessary functions for the feindura and the feinduraModules classes.
Child Class | Description |
---|---|
Feindura | The class for implementing feindura - Flat File Content Management System in a website. |
string | $sessionId | Contains the session-ID, if cookies are deactivated |
bool | $loggedIn | Is TRUE when the user is logged into the backend of feindura and visits the frontend website. |
array | $adminConfig | Contains the administrator-settings and the page-settings set in the CMS backend |
array | $websiteConfig | Contains the website-settings config set in the CMS backend |
array | $categoryConfig | Contains the categories-settings config set in the CMS backend |
array | $languageNames | An array with country codes and language names. |
array | $languageFile | Contains the frontend language-file array |
void | __construct() | The constructor of the class, sets all basic properties. First gets all settings config arrays and external... |
array|false | getParentPages() | Returns an array with the parent pages of given subcategory. If the given category ID is not a sub category of any... |
int|false | getCurrentPageId() | Returns the current page ID from the $_GET variable. Gets the current page ID from the $_GET variable. If... |
int|false | getCurrentCategoryId() | Returns the current category ID from the $_GET variable. Gets the current category ID from the $_GET variable.... |
array|false | loadPagesByType() | Load pages by ID-type and ID(s). If the $idType parameter start with "cat" it takes the given $ids... |
array|false | loadPagesMetaDataByType() | Filters the GeneralFunctions::$pagesMetaData by ID-type and ID(s). If the $idType parameter start with... |
array|false | loadPagesByDate() | Loads pages by ID-type and ID, which fit in the given time period parameters. Checks if the pages to load have a... |
int|false | setCurrentPageId() | Sets the current page ID from the $_GET variable to the Feindura::$page property. Gets the current page ID from... |
int|false | setCurrentCategoryId() | Sets the current category ID from the $_GET variable to the Feindura::$category property. Gets the current... |
string | loadFrontendLanguageFile() | Loads the frontend language file into the Feindura::$languageFile property. |
array | generateMenu() | Generates a menu from a given $links array. Note : It will add the Feindura::$linkActiveClass property as CSS... |
string | generateContent() | Generates the page content and adds the frontend editing when activated and logged in. Note: Activates the... |
array | generatePage() | This method uses the $showErrors, $titleLength and $thumbnailAlign properties. Generates a page. This method is... |
string | createTitle() | Generates a page title from a given $pageContent array by using the given parameters. Note: Activates the... |
array|false | createThumbnail() | Generates a thumbnail <img> tag from the given $pageContent array and returns an array with the ready to... |
string | createAttributes() | Generates a string with a given id, class and other attributes. Check whether the given parameters are strings or... |
array|false | checkPagesForTags() | Load the $pageContent array of pages, only if the page(s) have one or more tags from the given $tags parameter.... |
array|false | getIdsFromString() | Gets the right page and category IDs. If the $ids parameter is a an array it uses the first value as page ID and... |
int|false | getPropertyIdsByType() | If $ids parameter is FALSE it check the ID-type and returns then the Feindura::$page or Feindura::$category... |
mixed | getPropertyPage() | Returns the Feindura::$page property if the given $page parameter is a Boolean. |
int|true | getPropertyCategory() | Returns the Feindura::$category property if the given $category parameter is a Boolean. |
string | shortenText() | Shorten a text by to a given length. If the $endString parameter is set and a $pageContent array is given, it... |
string | shortenHtmlText() | Shorten a HTML text by to a given length. All HTML tags which are contained in the shortend text will be counted... |
Contains the session-ID, if cookies are deactivated
This session ID is then placed on the end of every link.
Is TRUE when the user is logged into the backend of feindura and visits the frontend website.
If TRUE, it will enable the the frontend editing feature.
Contains the administrator-settings and the page-settings set in the CMS backend
The file with the administrator-settings config array is situated at "feindura-CMS/config/admin.config.php".
This settings will be set to this property in the FeinduraBase constructor.
Example array:
Show Example
Contains the website-settings config set in the CMS backend
The file with the website-settings config array is situated at "feindura-CMS/config/website.config.php".
This settings will be set to this property in the FeinduraBase constructor.
Example array:
Show Example
Contains the categories-settings config set in the CMS backend
The file with the categories-settings config array is situated at "feindura-CMS/config/category.config.php".
This settings will be set to this property in the FeinduraBase constructor.
Example array:
Show Example
An array with country codes and language names.
Example array array( 'ae' => 'Avestan', 'af' => 'Afrikaans', 'de' => 'German', 'en' => 'English', ...
Contains the frontend language-file array
The frontend language file array contains texts for displaying page warnings or errors and additional texts like "more", etc.
The file is situated at "feindura-CMS/library/languages/de.frontend.php".
It will be included and set to this property in the FeinduraBase constructor.
string | $language |
(optional) A language code "de", "en", ... to load the right frontend language-file and it will be set to the Feindura::$language property Default false |
Type constructor
The constructor of the class, sets all basic properties.
First gets all settings config arrays and external classes.
Then Check if the visitor is a logged in user of the feindura backend and set the FeinduraBase::$loggedIn property. Then set the $_GET variable names from the administrator-settings config to the $varNames property.
Check if cookies are activated, otherwise store the session ID in the $sessionId property for use in links.
Get the the given $language parameter or try to find the browser language and load the frontend language-file and set it to the Feindura::$languageFile property.
Used Global Variables
int|string|bool | $categoryId |
(optional) a category ID, or a string with "previous","next","first","last" or "random". If FALSE it uses the Feindura::$category property. Default false |
Name getParentPages()
Returns an array with the parent pages of given subcategory. If the given category ID is not a sub category of any page, it will return an empty array.
Note: If the $categoryId parameter is FALSE or empty, it uses the current page (means the Feindura::$page property).
Name getCurrentPageId()
Alias getPageId()
Returns the current page ID from the $_GET variable.
Gets the current page ID from the $_GET variable. If $_GET is not a ID but a page name, it loads all pages in an array and look for the right page name and returns the ID. If no $_GET variable exists try to return the Feindura::$startPage property.
Used Global Variables
Name getCurrentCategoryId()
Alias getCategoryId()
Returns the current category ID from the $_GET variable.
Gets the current category ID from the $_GET variable. If $_GET is not a ID but a category name, it look in the FeinduraBase::$categoryConfig for the right category ID. If no $_GET variable exists it try to return the Feindura::$startPage property.
Used Global Variables
string | $idType |
the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" |
int|array|bool | $ids |
the category or page ID(s), can be a number or an array with numbers, if TRUE it loads all pages |
Name loadPagesByType()
Load pages by ID-type and ID(s).
If the $idType parameter start with "cat" it takes the given $ids parameter as category IDs.
If the $idType parameter start with "pag" it takes the given $ids parameter as page IDs.
While it is not important that whether the $idType parameter is written in plural or singular. The $ids parameter is automaticly checked whether its an array with IDs or a single ID.
Example of the returned $pageContent array: (Note This array will be wraped in another array, not shown here)
Show Example
string | $idType |
the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" |
int|array|bool | $ids |
the category or page ID(s), can be a number or an array with numbers, if TRUE it loads all pages |
Name loadPagesMetaDataByType()
Filters the GeneralFunctions::$pagesMetaData by ID-type and ID(s).
If the $idType parameter start with "cat" it takes the given $ids parameter as category IDs.
If the $idType parameter start with "pag" it takes the given $ids parameter as page IDs.
While it is not important that whether the $idType parameter is written in plural or singular. The $ids parameter is automaticly checked whether its an array with IDs or a single ID.
array|false loadPagesByDate ( |
[int|bool|string $from = true], [int|bool|string $to = true], string $idType, int|array|bool $ids, [bool $sortPages = false], [bool $reverseList = false]) |
string | $idType |
the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" Default true |
int|array|bool | $ids |
the category or page ID(s), can be a number or an array with numbers, if TRUE it loads all pages Default true |
int|bool|string | $from |
(optional) number of months in the past, if TRUE it show all pages in the past, if FALSE it loads only pages starting from the current date. Can also be a string with a date format (e.g. '2 weeks' or '27.06.2012'), for more details see: http://www.php.net/manual/en/datetime.formats.php |
int|bool|string | $to |
(optional) number of months in the future, if TRUE it show all pages in the future, if FALSE it loads only pages until the current date. Can also be a string with a date format (e.g. '10 days' or '27.06.2012'), for more details see: http://www.php.net/manual/de/datetime.formats.php |
bool | $sortPages |
(optional) if TRUE it sorts the pages like they are sorted in the backend, if FALSE it sorts the pages by date (If date range: by start date). Can also be a sort function e.g. "sortByEndDate". See GeneralFunctions::sortPages() for more. Default false |
bool | $reverseList |
(optional) if TRUE the pages sorting will be reversed Default false |
Name loadPagesByDate()
Loads pages by ID-type and ID, which fit in the given time period parameters.
Checks if the pages to load have a page date and the page date fit in the given $from and $to parameters. All time period parameters are compared against the current date.
The $from and $to parameters can also be a string with a (relative or specific) date, for more information see: http://www.php.net/manual/de/datetime.formats.php.
bool | $setStartPage |
(optional) If set to TRUE it also sets the Feindura::$startPage property Default false |
Name setCurrentPageId()
Alias setPageId()
Sets the current page ID from the $_GET variable to the Feindura::$page property.
Gets the current page ID from the $_GET variable (through getCurrentPageId) and set it to the Feindura::$page property. If the $setStartPage parameter is TRUE and the Feindura::$category is empty, the Feindura::$startPage property will also be set with the start page ID from the $websiteConfig.
bool | $setStartCategory |
(optional) If set to TRUE it also sets the $startCategory property Default false |
Name setCurrentCategoryId()
Alias setCategoryId()
Sets the current category ID from the $_GET variable to the Feindura::$category property.
Gets the current category ID from the $_GET variable (through getCurrentCategoryId) and set it to the Feindura::$category property. If the $setStartCategory parameter is TRUE the $startCategory property will also be set with the startpage ID from the $websiteConfig.
string | $language |
(optional) a given country code which will be used to try to load the language file Default false |
Name loadFrontendLanguageFile()
Loads the frontend language file into the Feindura::$languageFile property.
array | $links |
an array with links in the format |
int|bool | $menuTag |
(optional) the tag which is used to create the menu, can be an "ul", "ol", "array('table',<number until new row>)" or any other tag, if TRUE it uses "div" Default false |
Name generateMenu()
Generates a menu from a given $links array.
Note: It will add the Feindura::$linkActiveClass property as CSS class to the link, which is matching the current language.
string | $pageContentString |
the localized page content string of a page |
int|array | $pageId |
page ID |
Name generateContent()
Generates the page content and adds the frontend editing when activated and logged in.
Note: Activates the frontend editing (adds a div tag with feindura data).
array generatePage ( |
int|array $page, [bool $showErrors = true], [int|array|bool $shortenText = false], [bool|string $useHtml = true]) |
int|array | $page |
page ID or a $pageContent array |
bool | $showErrors |
(optional) says if errors like "The page you requested doesn't exist" will be displayed Default true |
int|array|bool | $shortenText |
(optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="%href%"'>read more</a>'). (the %href% will be replaced by the pages href) Default false |
bool|string | $useHtml |
(optional) displays the page content with or without HTML tags. It also accepts a string with allowed html tags. Default true |
Name generatePage()
This method uses the $showErrors, $titleLength and $thumbnailAlign properties.
Generates a page.
This method is called in descendant classes.
Generates a page by the given page ID. An array will be returned with all elements of the page, ready for displaying in a HTML-page.
In case the page doesn't exists or is not public and the $showErrors parameter is TRUE, an error will be placed in the ['content'] part of the returned array, otherwiese it returns an empty array.
Note: Activates the frontend editing (adds a span tag with feindura data).
Example of the returned array:
Show Example
string createTitle ( |
array $pageContent, [int $titleLength = false], [bool $titleAsLink = false], [bool $titleShowPageDate = false], [bool $titleShowCategory = false], [ $titlePageDateSeparator = false], [string $titleCategorySeparator = false], [bool $allowFrontendEditing = true]) |
array | $pageContent |
the $pageContent Array of a page |
int | $titleLength |
(optional) number of the maximal text length shown or FALSE to not shorten Default false |
bool | $titleAsLink |
(optional) if TRUE, it creates the title as link Default false |
bool | $titleShowPageDate |
(optional) if TRUE, it shows the page date before the title text Default false |
bool | $titleShowCategory |
(optional) if TRUE, it shows the category name before the title text, and uses the $titleShowCategory parameter string between both Default false |
string | $titleCategorySeparator |
(optional) string to seperate the category name and the title text, if the $titleShowCategory parameter is TRUE Default false |
bool | $allowFrontendEditing |
(optional) if TRUE it will allow frontendenditing, when it is activated and the user is logged in. If $titleAsLink is TRUE, frontend editing will be deactivated anyway. Default false |
$titlePageDateSeparator |
Default true |
Name createTitle()
Generates a page title from a given $pageContent array by using the given parameters.
Note: Activates the frontend editing (adds a span tag with feindura data).
array | $pageContent |
the $pageContent array of a page |
Name createThumbnail()
Generates a thumbnail <img> tag from the given $pageContent array and returns an array with the ready to display tag and the plain thumbnail path.
Note:: It will add the class "feinduraThumbnail" to the image.
Used Constants
string createAttributes ( |
string|number $id, string|number $class, string|number $attributes) |
string|number | $id |
a HTML id attribute value |
string|number | $class |
a HTML class attribute value |
string|number | $attributes |
one or more 'key="values"' attributes |
Name createAttributes()
Generates a string with a given id, class and other attributes.
Check whether the given parameters are strings or numbers and add them to a string with attributes.
Example return: 'id="exampleId" class="exampleClass" key="value"'
array|false checkPagesForTags ( |
string $idType, int|array|bool $ids, string|array $tags, [bool $loadPageContent = true]) |
string | $idType |
the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages" |
int|array|bool | $ids |
the category or page ID(s), can be a number or an array with numbers, if TRUE it checks all pages tags |
string|array | $tags |
an string (seperated by ",") or an array with tags to compare |
bool | $loadPageContent |
whether or not to return pageContent</var arrays or just the <var>$pagesMetaData arrays Default true |
Name checkPagesForTags()
Load the $pageContent array of pages, only if the page(s) have one or more tags from the given $tags parameter.
Note: the tags will be compared case insensitive.
int|string|array|bool | $ids |
a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". (See example) (can also be a $pageContent array) |
Name getIdsFromString()
Gets the right page and category IDs. If the $ids parameter is a an array it uses the first value as page ID and the second as category ID.
If the given $ids parameter is a string/array with "previous" or "next" it returns the previous or next page ID from the current Feindura::$page property/Feindura::$category property on. If the given $ids parameter is a string/array with "first" or "last" it returns the first or last page ID in that category from the current Feindura::$page property/Feindura::$category property on. If the string is "random" it returns a random page ID in the current category, if its an array like: array('random','random') it would return a random page ID from a random category.
Note: What is the first or last page/category depends on the sorting you have of the pages/categories in the feindura backend.
Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
Examples of possible $ids parameter.
Show Example
Example return value, where first value is the page ID and the second value is the category ID. array(2,1)
string | $idType |
the ID type can be "page", "pages" or "category", "categories" |
int|array|bool | $ids |
the category or page ID(s), if they are FALSE it returns the property ID, otherwise it passes the ID(s) through |
Name getPropertyIdsByType()
If $ids parameter is FALSE it check the ID-type and returns then the Feindura::$page or Feindura::$category property.
int|bool | $page |
(optional) a page id or a boolean Default false |
Name getPropertyPage()
Returns the Feindura::$page property if the given $page parameter is a Boolean.
int|bool | $category |
(optional) a category id or a boolean Default false |
Name getPropertyCategory()
Returns the Feindura::$category property if the given $category parameter is a Boolean.
string shortenText ( |
string $string, int|array $length, [array|false $pageContent = false], [string|false $endString = " ..."]) |
string | $string |
the string to shorten |
int|array | $length |
the number of maximal characters, or an array with a number for text length and the more string, or a bool, whether to add the more link or not. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') |
array|false | $pageContent |
(optional) the pageContent array of the page to create the "more" link to the page from Default false |
string|false | $endString |
(optional) a string which will be put after the last character and before the "more" link Default " ..." |
Name shortenText()
Shorten a text by to a given length.
If the $endString parameter is set and a $pageContent array is given, it adds the $endString parameter after the last character and a "more" link on the end of the shortened text.
string shortenHtmlText ( |
$input, int|array $length, [array|false $pageContent = false], [string|false $endString = ' ...'], string $string) |
string | $string |
the string to shorten |
int|array | $length |
the number of maximal characters, or an array with a number for text length and the more string, or a bool, whether to add the more link or not. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>') |
array|false | $pageContent |
(optional) the pageContent array of the page to create the "more" link to the page from Default false |
string|false | $endString |
(optional) a string which will be put after the last character and before the "more" link Default ' ...' |
$input |
|
Name shortenHtmlText()
Shorten a HTML text by to a given length.
All HTML tags which are contained in the shortend text will be counted and closed on the end.
If the $endString parameter is set and a $pageContent array is given, it adds the $endString parameter after the last character and a "more" link on the end of the shortened text.