• All Elements
Packages
  • [Backend]
  • [Implementation]
  • [Implementation]-[Backend]
  • [Plugins]
[Implementation]-[Backend]


  • Package Elements
  • Class Hierarchy
Classes
  • DebugTools
  • GeneralFunctions
  • StatisticFunctions
  • XssFilter
Files
  • DebugTools.class.php
  • GeneralFunctions.class.php
  • StatisticFunctions.class.php
  • XssFilter.class.php

feindura - Docs

  • Back to feindura.org
  • Startpage
  • Feindura Class
Welcome
Documentation
CHANGELOG | LICENSE

Quick Menu
  • Class Overview
  • Properties | Descriptions
  • Methods | Descriptions

Properties
  • $adminConfig
  • $categoryConfig
  • $userConfig
  • $websiteConfig
  • $pagesMetaData
  • $storedPages
  • $FeinduraCLass
  • $isAdmin

Methods
  • __construct()
  • init()
  • getBrowserLanguages()
  • loadLanguageFile()
  • setVisitorTimzone()
  • isAdmin()
  • hasPermission()
  • addParameterToUrl()
  • URI2Path()
  • Path2URI()
  • getDirname()
  • getStoredPages()
  • addStoredPage()
  • removeStoredPage()
  • getPageCategory()
  • getParentPages()
  • getLocalized()
  • compareTags()
  • readPage()
  • deletePage()
  • savePage()
  • savePagesMetaData()
  • getPagesMetaDataOfCategory()
  • loadPages()
  • loadPagesStatistics()
  • isPublicCategory()
  • isPageContentArray()
  • getDateTimeValue()
  • formatDate()
  • dateDayBeforeAfter()
  • showPageDate()
  • getFlagSrc()
  • replaceLinks()
  • replaceSnippets()
  • createHref()
  • sortPages()
  • createBreadCrumbsArray()
  • addStylesheetsInBody()
  • cleanPluginPlaceholders()
  • cleanSpecialChars()
  • shortenString()
  • htmLawed()
  • getRealPath()
  • readFolder()
  • readFolderRecursive()
  • folderIsEmpty()
  • deleteFolder()
  • createStyleTags()
  • smartStripslashes()
  • jsonDecode()

Class GeneralFunctions File source: /library/classes/GeneralFunctions.class.php

Class Overview


		    
            
        
		

Description

Classname GeneralFunctions

Contains the basic functions for reading and saving pages

Note: this class will be used by the implementation classes AND the backend of the feindura-CMS.


Version
  • 1.5
    ChangeLog
    • 1.5 moved GeneralFunctions::dump() and GeneralFunctions::scriptBenchmark() to the DebugTools class
    • 1.4.1 add GeneralFunctions::dump()
    • 1.4 add GeneralFunctions::replaceSnippets()
    • 1.3.1 add schemes to htmlLawed
    • 1.3 rewrite of checkLanguageFiles(), now loadLanguageFile()
    • 1.2 changed class to static class
    • 1.19 add parseDefaultLanguage() to checkLanguageFiles()
    • 1.18 fixed checkLanguageFiles()
    • 1.17 add chmod to savePage()
    • 1.16 started documentation

Class located in /library/classes/GeneralFunctions.class.php [in line 46]
Property Summary
static array   $adminConfig   Contains the administrator-settings config array
static array   $categoryConfig   Contains the category-settings config array
static array   $userConfig   Contains the user config array
static array   $websiteConfig   Contains the website-settings config array
static array   $pagesMetaData   Contains the pagesMetaData array
static array   $storedPages   Stores page-content array's in this property if a page is loaded
static array   $FeinduraCLass   Keeps an instance of the Feindura class to be used in the GeneralFunctions::replaceSnippets() method.
static bool   $isAdmin   Stores the result of GeneralFunctions::isAdmin(), to speed it up.
Method Summary
static void   init()  

The real constructor of the static class, gets the settings.

Used Global Variables

static string|array   getBrowserLanguages()  

Checks for the browser language an create an array with all languages an q-values:

Array ( [de-de]

static array   loadLanguageFile()  

Loads a language file from a folder. The $currentLangCode parameter can contain a language code used to

static string|false   setVisitorTimzone()  

Try to get the visitors timezone by using javascript. It will create a redirect along with the visitors local

static bool   isAdmin()  

Check if the current user is an admin. If no users exist everyone is an admin.

Used Global

static bool   hasPermission()  

Check if the user has the permissions of the given $permission parameter.

static string   addParameterToUrl()  

Check if the current $_SERVER['REQUEST_URI'] variable end with ? or & and ads the $parameterString on

static string   URI2Path()  

Removes the URIEXTENSION from a given URI.

static string|false   Path2URI()  

Adds the URIEXTENSION to a given path.

static string   getDirname()  

Returns the dirname of a $dir parameter, by checking whether the last part of the path is a filename or a

static array   getStoredPages()  

Fetches the $storedPages

static array   addStoredPage()  

Adds a $pageContent array to the

static bool   removeStoredPage()  

Removes a $pageContent array from the

static int|false   getPageCategory()  

Return the category ID of a page.

static 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

static string   getLocalized()  

Gets the localized version of given $value parameter, which matches the

static bool   compareTags()  

Compares the given tags with the tags in the given $pageData array.

If the given

static array|FALSE   readPage()  

Loads the $pageContent array of a page.

Checks first whether the given page ID was already loaded and is

static bool   deletePage()  

Deletes a page and all depencies of it.

static bool   savePage()  

Save a page to it's flatfile.

Example of the saved $pageContent array:

static bool   savePagesMetaData()  

Save all pages meta data in an array, to faster access them. It also reloads them as properties in the

static array   getPagesMetaDataOfCategory()  

Filters the

static array   loadPages()  

Loads the $pageContent arrays from pages in a specific category(ies) or all categories.

Loads all $pageContent

static array   loadPagesStatistics()  

Loads the $pageStatistics arrays from pages in a specific category(ies) or all categories.

Loads all

static array|int|false   isPublicCategory()  

Checks whether the given category(ies) are public and returns the ID or an array with IDs of the public

static bool   isPageContentArray()  

Checks the given $page parameter is a valid $pageContent array.

static string   getDateTimeValue()  

formats the date passed into format required by 'datetime' attribute of <time> tag. If no intDate supplied,

static string   formatDate()  

Converst a given timestamp into the a specific format type.

static string|int   dateDayBeforeAfter()  

Replaces the given $date parameter with "yesterday", "today" or "tomorrow"

static string|false   showPageDate()  

Returns either a single page date or a date range formated, ready to display in an HTML page.

static string   getFlagSrc()  

Returns the right flag from the library/images/icons/flags folder. If no flag with the given

static string   createHref()  

Creates a href-attribute from the given $pageContent parameter, if the sessionId parameter is

static array   sortPages()  

Sort an array with $pageContent arrays by a given sort function. The following sort functions are

static array   createBreadCrumbsArray()  

Creates an array with $pageContent arrays in the order of the navigation.

static string|false   addStylesheetsInBody()  

Goes through a folder recursive and gets the css files. It then tries to add these as <link..> tags inside the

static string   cleanPluginPlaceholders()  

Removes the src attribute and adds back the draggable=true attribute.

static string   cleanSpecialChars()  

Removes all special chars from a string.

static string   shortenString()  

Shortens a string to its letter number (conciders htmlentities as multiple characters).

static string   htmLawed()  

Uses the htmLawed function but decodes first UTF-8 and after encodes again.

static string|false   getRealPath()  

Try to get the real path from a given absolute or relative path. If the path contains a filename it will ony return

static array|false   readFolder()  

Reads a folder and return it's subfolders and files.

Example of the returned array:

static array|false   readFolderRecursive()  

Reads a folder recursive and return it's subfolders and files, opens then also the subfolders and read them,

static bool   folderIsEmpty()  

Check if a folder is empty.

Used Constants

  • DOCUMENTROOT the absolut
static bool   deleteFolder()  

Deletes a directory and all files in it.

static string|array|false   createStyleTags()  

Goes through a folder recursive and creates a HTML <link> tag for every stylesheet-file

static string   smartStripslashes()  

Uses stripslashes depending on "magic_quotes_gpc" and "magic_quotes_sybase"

static array   jsonDecode()  

Decodes a JSON object in php, without using json_decode() so its PHP 5.1 compatible.

void   __construct()   Constructor is not callable, GeneralFunctions::init() is used instead.
string   replaceLinks()   Replaces all feindura links (e.g. "?feinduraPageID=3") inside the given $pageContentString parameter,...
string   replaceSnippets()   Replaces all feindura code snippets (e.g. "<img class="feinduraSnippet"...>) inside the given...
Properties
static array $adminConfig

Default value

Description

Contains the administrator-settings config array


Additional
  • see: GeneralFunctions()
  • access: public
Used By
  • GeneralFunctions::deletePage() - for the save path of the flatfiles
  • GeneralFunctions::savePage() - for the save path of the flatfiles
  • GeneralFunctions::formatDate() - to get the right date format, if no format is given
  • GeneralFunctions::createHref() - for the variable names which the $_GET variable will use for category and page, also for the websitePath
  • FeinduraBase::generateContent() - to check for frontend editing

static array $categoryConfig

Default value

Description

Contains the category-settings config array


Additional
  • see: GeneralFunctions()
  • access: public
Used By
  • GeneralFunctions::loadPages() - to get the sorting of the category
  • GeneralFunctions::loadPagesStatistics() - to get the sorting of the category
  • GeneralFunctions::isPublicCategory() - to check if a category is public
  • GeneralFunctions::showPageDate() - to check if in the category the page date is activated
  • GeneralFunctions::createHref() - for the category name if Pretty URLs are activated
  • GeneralFunctions::sortPages() - to find the right sort method for every category

static array $userConfig

Default value

Description

Contains the user config array


Additional
  • see: GeneralFunctions()
  • access: public

static array $websiteConfig

Default value

Description

Contains the website-settings config array


Additional
  • see: GeneralFunctions()
  • access: public

static array $pagesMetaData

Default value

Description

Contains the pagesMetaData array

This array contains all pages IDs and their category ID, as well as the localized titles

Example array:
Show Example

  1. <?php
  2. $pagesMetaData[3]['id']       = 3;
  3. $pagesMetaData[3]['category'] = 0;
  4. $pagesMetaData[3]['localized']['en']['title'] = 'Page One';
  5. $pagesMetaData[3]['localized']['de']['title'] = 'Seite eins';
  6.  
  7. $pagesMetaData[16]['id']       = 16;
  8. $pagesMetaData[16]['category'] = 1;
  9. $pagesMetaData[16]['localized']['en']['title'] = 'Another Page';
  10.  
  11. $pagesMetaData[2]['id']       = 2;
  12. $pagesMetaData[2]['category'] = 1;
  13. $pagesMetaData[2]['localized']['en']['title'] = 'Last Page';
  14. $pagesMetaData[2]['localized']['de']['title'] = 'Letzte Seite';
  15.  
  16. return $pagesMetaData;
  17. ?>


Additional
  • see: GeneralFunctions::init()
  • see: getCurrentPageId()
  • access: public
Used By
  • FeinduraBase::loadPagesMetaDataByType()
  • GeneralFunctions::savePagesMetaData()
  • GeneralFunctions::getPagesMetaDataOfCategory()
  • StatisticFunctions::getCurrentPageId() - to get all page titles, to get the right page ID, if the $_GET variable is not a ID but a page name
  • GeneralFunctions::getPageCategory() - to get the category of the page

static array $storedPages = null

Default value

null

Description

Stores page-content array's in this property if a page is loaded

If a page is loaded (included) it's page-content array will be stored in the this array.
If the page is later needed again it's page-content will be fetched from this property.
It should speed up the page loading process.


Additional
  • example: of the returned array
  • access: public
Used By
  • GeneralFunctions::getStoredPages() - the property to get
  • GeneralFunctions::addStoredPage() - the property to add the $pageContent array
  • GeneralFunctions::removeStoredPage() - the property to remove the $pageContent array

static array $FeinduraCLass = null

Default value

null

Description

Keeps an instance of the Feindura class to be used in the GeneralFunctions::replaceSnippets() method.


Additional
  • see: GeneralFunctions::replaceSnippets()
  • access: public
Used By
  • GeneralFunctions::replaceSnippets()

static bool $isAdmin = null

Default value

null

Description

Stores the result of GeneralFunctions::isAdmin(), to speed it up.


Additional
  • see: GeneralFunctions::isAdmin()
  • access: private

Methods
File source:
line 191
static void init ( )

Description

Type init

The real constructor of the static class, gets the settings.

Used Global Variables

  • $adminConfig the administrator-settings config (included in the general.include.php)
  • $categoryConfig the categories-settings config (included in the general.include.php)


Additional
  • access: public
Version
  • 1.1
    ChangeLog
    • 1.2 add $pagesMetaData
    • 1.0 initial release

File source:
line 232
static string|array getBrowserLanguages ( [string  = "en-GB"],
[bool  = true])

Parameters

string $standardLang the standard country code to return when no language code was get
Default "en-GB"
bool $simple if TRUE it only returns a string with a language code, if FALSE it returns an array with the language
Default true

Description

Name getBrowserLanguages()

Checks for the browser language an create an array with all languages an q-values:

Array ( [de-de] => 1 [de] => 0.8 [en-us] => 0.5 [en] => 0.3 )

If no match to the browser language is found it uses the $standardLang parameter for loading a languageFile or returning the country code.


Return Value
  • string|array - either a string with a language code, or a array in the format: array( [de-DE] => 1, [en] => 0.5 ), depending on the $simple parameter
Additional
  • link: http://www.dyeager.org/post/2008/10/getting-browser-default-language-php
  • access: public
Used By
  • GeneralFunctions::loadLanguageFile() - to get the right browser language

File source:
line 291
static array loadLanguageFile ( [string|false  = false],
[string  = '%lang%.php'],
[string|false  = false],
[bool  = 'en'])

Parameters

string|false $langPath (optional) a absolut path to look for a language file which fit the $filename parameter or FALSE to use the "feindura-cms/library/languages" folder
Default false
string $filename (optional) the structure of the filename, which should be loaded. the "%lang%" will be replaced with the country code like "%lang%.backend.php" -> "en.backend.php"
Default '%lang%.php'
string|false &$currentLangCode (optional) (Note: this variable will also be changed outside of this method) a variable with the current language code, if this is set it will be first try to load this language file, when it couldn't find any language file which fits the browsers language code.
Default false
bool $standardLang (optional) a standard language for use if no match was found
Default 'en'

Description

Name loadLanguageFile()

Loads a language file from a folder. The $currentLangCode parameter can contain a language code used to try to load a language file, if empty it uses the browsers language codes.

If no match to the browser language is found it uses the $standardLang parameter for loading a languageFile.

Used Constants

  • DOCUMENTROOT the absolut path of the webserver


Return Value
  • array - the loaded language file array or an empty array
Additional
  • access: public
Used By
  • FeinduraBase::loadFrontendLanguageFile() - to load the language files
  • Feindura::getLanguageFile() - to load the right language file
Uses
  • GeneralFunctions::getBrowserLanguages() - to get the right browser language
Version
  • 1.0.3
    ChangeLog
    . 1.0.3 complete rewrite!
    • 1.0.2 add parseDefaultLanguage()
    • 1.0.1 fixed language files check, uses now readFolder recursive
    • 1.0 initial release

File source:
line 346
static string|false setVisitorTimzone ( )

Description

Name setVisitorTimzone()

Try to get the visitors timezone by using javascript. It will create a redirect along with the visitors local timezone, which then get catched in the next run of this function and stored in the $_SESSION['feinduraSession']['timezone'] variable.


Return Value
  • string|false - FALSE if it could set the local timezone and the redirect script created the script to redirect.
Additional
  • see: Feindura::createMetaTags()
  • access: public
Version
  • 1.2
    ChangeLog
    • 1.2 changed "localTimezone" to "timezone"
    • 1.1 change timezone offsets to the current timezone offset
    • 1.0 initial release

File source:
line 408
static bool isAdmin ( )

Description

Name isAdmin()

Check if the current user is an admin. If no users exist everyone is an admin.

Used Global Variables

  • $userConfig the user-settings config (included in the general.include.php)


Return Value
  • bool - TRUE if the current user is an admin, or no admins exist, otherwise FALSE
Additional
  • access: public
Version
  • 1.3
    ChangeLog
    • 1.3 moved to GeneralFunctions
    • 1.2 returns now also TRUE when no user is admin
    • 1.1 changed user managament system, it now get the users from the user.config.php
    • 1.01 add immediately return true if no remote_user exists
    • 1.0 initial release

File source:
line 464
static bool hasPermission ( string ,
[string|int  = false],
[int|bool  = false])

Parameters

string $permission the array key of the permission to check
string|int $data (optional) some data which is required so some checks (like category or page IDs)
Default false
int|bool $userId (optional) a user id which should be used as the current user
Default false

Description

Name hasPermission()

Check if the user has the permissions of the given $permission parameter.


Return Value
  • bool - TRUE if the current user has the permission, FALSE if not
Additional
  • see: GeneralFunctions::isAdmin()
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 531
static string addParameterToUrl ( string|array ,
[string|array|false  = ''])

Parameters

string|array $key the key of the new parameter to add, if array, the value parameter must also be an array
string|array|false $value (optional) the value of the new parameter to add
Default ''

Description

Name addParameterToUrl()

Check if the current $_SERVER['REQUEST_URI'] variable end with ? or & and ads the $parameterString on the end.


Return Value
  • string - the new url with add parameter
Additional
  • access: public
Version
  • 2.1
    ChangeLog
    • 2.1 changed &amp; to &
    • 2.0 complete rewrite based on http://stackoverflow.com/questions/909193/is-there-a-php-library-that-handles-url-parameters-adding-removing-or-replacin
    • 1.0.1 moved to GeneralFunctions class
    • 1.0 initial release

File source:
line 566
static string URI2Path ( string )

Parameters

string $uri the URI to change

Description

Name URI2Path()

Removes the URIEXTENSION from a given URI.


Return Value
  • string - the changed URI
Additional
  • see: URIEXTENSION
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 587
static string|false Path2URI ( string )

Parameters

string $path the path to change

Description

Name Path2URI()

Adds the URIEXTENSION to a given path.


Return Value
  • string|false - the changed path or FALSE, when the path couldn't be converted
Additional
  • see: URIEXTENSION
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 619
static string getDirname ( string )

Parameters

string $dir the path to get the dirname from

Description

Name getDirname()

Returns the dirname of a $dir parameter, by checking whether the last part of the path is a filename or a dir.


Return Value
  • string - the changed path
Additional
  • access: public
Version
  • 2.0
    ChangeLog
    • 2.0 changed checking if ends with file, by using is_file()
    • 1.0.1 add always adding of a slash on the end
    • 1.0 initial release

File source:
line 657
static array getStoredPages ( )

Description

Name getStoredPages()

Fetches the $storedPages property.


Return Value
  • array - the $storedPages property
Additional
  • example: of the returned array
  • access: public
Used By
  • GeneralFunctions::readPage() - for getting the $storedPages property
  • GeneralFunctions::loadPages() - for getting the $storedPages property
  • GeneralFunctions::loadPagesStatistics() - for getting the $storedPages property
Uses
  • GeneralFunctions::$storedPages - the property to get
Version
  • 1.1
    ChangeLog
    • 1.1 removed the in session storage
    • 1.0 initial release

File source:
line 681
static array addStoredPage ( int )

Parameters

int $pageContent a $pageContent array which should be add to the $storedPages property

Description

Name addStoredPage()

Adds a $pageContent array to the $storedPages property.


Return Value
  • array - passes through the given $pageContent array
Additional
  • access: public
Used By
  • GeneralFunctions::readPage() - to store a new loaded $pageContent array in the $storedPages property
  • GeneralFunctions::deletePage() - to store the saved file agiain, and overwrite th old stored page
  • GeneralFunctions::savePage() - to store the saved file agiain, and overwrite th old stored page
Uses
  • GeneralFunctions::$storedPages - the property to add the $pageContent array
Version
  • 1.1
    ChangeLog
    • 1.1 removed the in session storage
    • 1.0.1 removed the $remove parameter
    • 1.0 initial release

File source:
line 709
static bool removeStoredPage ( int )

Parameters

int $id the ID of a page which should be removed from the $storedPages property

Description

Name removeStoredPage()

Removes a $pageContent array from the $storedPages property.


Return Value
  • bool - TRUE if a page with this ID exists and could be removed, otherwise FALSE
Additional
  • access: public
Uses
  • GeneralFunctions::$storedPages - the property to remove the $pageContent array
Version
  • 1.1
    ChangeLog
    • 1.1 removed the in session storage
    • 1.0 initial release

File source:
line 740
static int|false getPageCategory ( int )

Parameters

int $page a page ID from which to get the category ID

Description

Name getPageCategory()

Return the category ID of a page.


Return Value
  • int|false - the right category ID or FALSE if the page ID doesn't exists
Additional
  • access: public
Used By
  • FeinduraBase::loadPagesByType() - to get the category of the page
  • FeinduraBase::loadPagesMetaDataByType() - to get the category of the page
  • FeinduraBase::setCurrentCategoryId() - to get the right category ID of the startpage
  • FeinduraBase::generatePage() - to get the category of the page
  • FeinduraBase::getIdsFromString() - to get the category ID of the given page
  • Feindura::setStartPage() - to get the category of the page
  • Feindura::createHref() - to get the category of the page
  • Feindura::createLink() - to get the category of the page
  • Feindura::showTitle() - to get the category of the page
  • Feindura::showPage() - to get the category of the page
  • Feindura::hasPlugins() - to get the category of the page
  • Feindura::showPlugins() - to get the category of the page
  • startPageWarning() - to get the category of the start page
Uses
  • GeneralFunctions::$pagesMetaData - to get the category of the page
Version
  • 2.0
    ChangeLog
    • 2.0 uses now the $pagesMetaData array
    • 1.0 initial release

File source:
line 767
static array|false getParentPages ( int )

Parameters

int $categoryId a category ID

Description

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.


Return Value
  • array|false - an array with the parent pages in the order from the current category on, or FALSE if this category is not a subcategory
Additional
  • access: public
Used By
  • Feindura::createBreadCrumbsMenu() - to get the parent pages in an array
  • GeneralFunctions::createBreadCrumbsArray() - to get the parent pages in an array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 846
static string getLocalized ( array ,
string ,
[  = false],
[  = false],
bool|string )

Parameters

array $localizedArray an array with an ['localized'] array in the form of: array('de' => .. , 'en' => .. )
string $value the name of the value, which should be returned localized
bool|string $forceOrUseLanguage if TRUE the language will be forced to be loaded, even if it does not exist, if string it will be try this as the testing language code, instead of the $_SESSION['feinduraSession']['websiteLanguage'] var
Default false
$languageCode
Default false
$forceLanguage

Description

Name getLocalized()

Gets the localized version of given $value parameter, which matches the $_SESSION['feinduraSession']['websiteLanguage'] variable. If no matching localized version of this value exists, it returns the one matching the $websiteConfig['multiLanguageWebsite']['mainLanguage'] variable.


Return Value
  • string - the localized version of the $value parameter
Additional
  • access: public
Used By
  • Feindura::getLocalized() - to get the right localization
Version
  • 1.3
    ChangeLog
    • 1.3 add $forceLanguage again
    • 1.2 the $localizedArray is now an array with an localized array, e.g. to give the $categoryConfig directly
    • 1.1 changed $forceLanguage to $forceOrUseLanguage
    • 1.0 initial release

File source:
line 905
static bool compareTags ( array ,
array|string )

Parameters

array $pageData the $pageContent or $pageMetaData array of a page
array|string $tags an array or string with tags to compare

Description

Name compareTags()

Compares the given tags with the tags in the given $pageData array.

If the given $pageData array has one or more tags from the $tags parameter, it returns TRUE otherwise it FALSE.

Note: the tags will be compared case insensitive.


Return Value
  • bool - TRUE or FALSE if the $pageContent['localized'][...]['tags'] doesn't match with any of the given tags
Additional
  • see: Feindura::listPagesByTags()
  • see: Feindura::createMenuByTags()
  • access: public
Version
  • 1.2
    ChangeLog
    • 1.2 moved to GeneralFunctions
    • 1.1.1 go through all pages tags not only the english ones
    • 1.1 add localization
    • 1.0.1 fixed comparision, beacause i changed separarion of tags from whitespace to ,
    • 1.0 initial release

File source:
line 967
static array|FALSE readPage ( int|array ,
[int  = false],
[bool  = false])

Parameters

int|array $page a page ID or a $pageContent array (will then returned immediately)
int $category (optional) a category ID, if FALSE it will try to load this page from the non-category
Default false
bool $readPrevious (optional) if TRUE it will read the previous state of the page instead of the current page
Default false

Description

Name readPage()

Loads the $pageContent array of a page.

Checks first whether the given page ID was already loaded and is contained in the $storedPages property. If not the GeneralFunctions::readPage() public static function is called to include the $pagecontent array of the page and store it in the $storedPages property.

Example of the returned $pageContent array:
Show Example

  1. <?php
  2.  
  3. array(
  4.     "id"             => 2,
  5.     "category"       => 1,
  6.     "subCategory"    => false,
  7.     "public"         => true,
  8.     "sortOrder"      => 4,
  9.     "showInMenus"    => true,
  10.     "editLink"       => '',
  11.  
  12.     "lastSaveDate"   => 1282348800, // UNIX-Timestamp
  13.     "lastSaveAuthor" => 1, // ID of the user
  14.  
  15.     "pageDate"       => array(
  16.         "start"   => 1282342343,
  17.         "end"     => 1282353627
  18.       ),
  19.  
  20.     "plugins"      => array(
  21.           'imageGallery' => array(
  22.               'active'          => true,
  23.               'galleryPath'     => '/upload/gallery/',
  24.               'imageWidth'      => 800,
  25.               'imageHeight'     => null,
  26.               'thumbnailWidth'  => 160,
  27.               'thumbnailHeight' => null,
  28.               'tag'             => 'table',
  29.               'breakAfter'      => 3
  30.           ),
  31.           'pageRating' => array(
  32.               'active' => false,
  33.               'value'  => 0,
  34.               'votes'  => 0
  35.           ),
  36.  
  37.     "thumbnail"    => 'thumb_page1.jpg',
  38.  
  39.     "styleFile"    => '',
  40.     "styleId"      => '',
  41.     "styleClass"   => '',
  42.  
  43.     "localized"    => array(
  44.         "en" => array( 
  45.           "title"       => 'Example Page 1',
  46.           "description" => '',
  47.           "tags"        => 'fall',
  48.           "pageDate"    => array(
  49.               "before" => 'text before date',
  50.               "after"  => 'text after date'
  51.             ),
  52.           "content"     => '<p>Example Content of page 1</p>'
  53.         ),
  54.         "de" => array( 
  55.           "title"       => 'Beispiel Seite 1',
  56.           "description" => '',
  57.           "tags"        => 'herbst',
  58.           "pageDate"    => array(
  59.               "before" => 'Text davor',
  60.               "after"  => 'Text danach'
  61.             ),
  62.           "content"     => '<p>Beispiel Inhalt von Seite 1</p>'
  63.         )
  64.       )
  65.     )
  66.  
  67. ?>


Return Value
  • array|FALSE - the $pageContent array of the requested page or FALSE, if it couldn't open the file, or NULL when the file exists but couldnt be loaded properly
Additional
  • access: public
Used By
  • FeinduraBase::loadPagesByType() - to load a single page
  • FeinduraBase::generatePage() - to load the page if the $page parameter is an ID
  • Feindura::createMetaTags() - to load the page for the page title
  • GeneralFunctions::savePagesMetaData() - to read the pageContent array
  • GeneralFunctions::replaceLinks() - to load the page for createHref()
  • Search::createResultsArray() - to read the page for displaying the title and content
  • GeneralFunctions::loadPages() - to load the $pageContent array of the page
Uses
  • GeneralFunctions::getStoredPages() - for getting the $storedPages property
  • GeneralFunctions::addStoredPage() - to store a new loaded $pageContent array in the $storedPages property
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1069
static bool deletePage ( array|int ,
[int|false  = false],
[bool  = true])

Parameters

array|int $page an page id, or the $pageContent array of a page
int|false $catgory (optional) the pages category id, or false to let it determine automatically
Default false
bool $savePagesMetaData (optional) it FALSE it won't save the $pagesMetaData array
Default true

Description

Name deletePage()

Deletes a page and all depencies of it.


Return Value
  • bool - TRUE if the page was succesfull deleted, otherwise FALSE
Additional
  • access: public
Uses
  • GeneralFunctions::$adminConfig - for the save path of the flatfiles
  • GeneralFunctions::addStoredPage() - to store the saved file agiain, and overwrite th old stored page
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1146
static bool savePage ( array ,
[  = false],
[bool  = true],
bool )

Parameters

array $pageContent the $pageContent array of the page to save
bool $readPrevious (optional) if TRUE it will save the given $pageContent as a previous state of the page
Default false
bool $savePagesMetaData (optional) it FALSE it won't save the $pagesMetaData array
Default true
$savePrevious

Description

Name savePage()

Save a page to it's flatfile.

Example of the saved $pageContent array:
Show Example

  1. <?php
  2.  
  3. array(
  4.     "id"             => 2,
  5.     "category"       => 1,
  6.     "subCategory"    => false,
  7.     "public"         => true,
  8.     "sortOrder"      => 4,
  9.     "showInMenus"    => true,
  10.     "editLink"       => '',
  11.  
  12.     "lastSaveDate"   => 1282348800, // UNIX-Timestamp
  13.     "lastSaveAuthor" => 1, // ID of the user
  14.  
  15.     "pageDate"       => array(
  16.         "start"   => 1282342343,
  17.         "end"     => 1282353627
  18.       ),
  19.  
  20.     "plugins"      => array(
  21.           'imageGallery' => array(
  22.               'active'          => true,
  23.               'galleryPath'     => '/upload/gallery/',
  24.               'imageWidth'      => 800,
  25.               'imageHeight'     => null,
  26.               'thumbnailWidth'  => 160,
  27.               'thumbnailHeight' => null,
  28.               'tag'             => 'table',
  29.               'breakAfter'      => 3
  30.           ),
  31.           'pageRating' => array(
  32.               'active' => false,
  33.               'value'  => 0,
  34.               'votes'  => 0
  35.           ),
  36.  
  37.     "thumbnail"    => 'thumb_page1.jpg',
  38.  
  39.     "styleFile"    => '',
  40.     "styleId"      => '',
  41.     "styleClass"   => '',
  42.  
  43.     "localized"    => array(
  44.         "en" => array( 
  45.           "title"       => 'Example Page 1',
  46.           "description" => '',
  47.           "tags"        => 'fall',
  48.           "pageDate"    => array(
  49.               "before" => 'text before date',
  50.               "after"  => 'text after date'
  51.             ),
  52.           "content"     => '<p>Example Content of page 1</p>'
  53.         ),
  54.         "de" => array( 
  55.           "title"       => 'Beispiel Seite 1',
  56.           "description" => '',
  57.           "tags"        => 'herbst',
  58.           "pageDate"    => array(
  59.               "before" => 'Text davor',
  60.               "after"  => 'Text danach'
  61.             ),
  62.           "content"     => '<p>Beispiel Inhalt von Seite 1</p>'
  63.         )
  64.       )
  65.     )
  66.  
  67. ?>

Used Constants

  • "<?php\n" the php start tag
  • "\n?>" the php end tag


Return Value
  • bool - TRUE if the page was succesfull saved, otherwise FALSE
Additional
  • access: public
Uses
  • GeneralFunctions::$adminConfig - for the save path of the flatfiles
  • GeneralFunctions::addStoredPage() - to store the saved file agiain, and overwrite th old stored page
Version
  • 1.1
    ChangeLog
    • 1.1 add localization
    • 1.0.5 removed page statistics
    • 1.0.4 add XssFilter for every value
    • 1.0.3 creates now category folder automatically
    • 1.0.2 add preg_replace removing multiple slashes
    • 1.0.1 add chmod
    • 1.0 initial release

File source:
line 1294
static bool savePagesMetaData ( )

Description

Name savePagesMetaData()

Save all pages meta data in an array, to faster access them. It also reloads them as properties in the GeneralFunctions and StatisticsFunctions classes.

Example of the $pagesMetaData array:
Show Example

  1. <?php
  2. $pagesMetaData[3]['id']       = 3;
  3. $pagesMetaData[3]['category'] = 0;
  4. $pagesMetaData[3]['localized']['en']['title'] = 'Page One';
  5. $pagesMetaData[3]['localized']['de']['title'] = 'Seite eins';
  6.  
  7. $pagesMetaData[16]['id']       = 16;
  8. $pagesMetaData[16]['category'] = 1;
  9. $pagesMetaData[16]['localized']['en']['title'] = 'Another Page';
  10.  
  11. $pagesMetaData[2]['id']       = 2;
  12. $pagesMetaData[2]['category'] = 1;
  13. $pagesMetaData[2]['localized']['en']['title'] = 'Last Page';
  14. $pagesMetaData[2]['localized']['de']['title'] = 'Letzte Seite';
  15.  
  16. return $pagesMetaData;
  17. ?>


Return Value
  • bool - TRUE if the meta data was succesfull saved, otherwise FALSE
Additional
  • access: public
Used By
  • checkPagesMetaData()
Uses
  • GeneralFunctions::$pagesMetaData
  • GeneralFunctions::readFolderRecursive() - to get all pages from the "pages" folder
  • GeneralFunctions::readPage() - to read the pageContent array
Version
  • 1.2
    ChangeLog
    • 1.2 add file modified date
    • 1.1 add tags to the meta data, to speed up tag comparision
    • 1.0 initial release

File source:
line 1408
static array getPagesMetaDataOfCategory ( [bool|int|array  = false])

Parameters

bool|int|array $category (optional) a category ID, or an array with category IDs. TRUE to load all categories (including the non-category) or FALSE to load only the non-category pages
Default false

Description

Name getPagesMetaDataOfCategory()

Filters the GeneralFunctions::$pagesMetaData array and retruns only the pages which have a specific category.


Return Value
  • array - an array with the $pagesMetaData arrays of the pages in a specific category
Additional
  • example: example
  • access: public
Used By
  • FeinduraBase::getIdsFromString() - to load all pages in a category to find the right previous or next page and return it
Uses
  • GeneralFunctions::$pagesMetaData
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1466
static array loadPages ( [bool|int|array  = true])

Parameters

bool|int|array $category (optional) a category ID, or an array with category IDs. TRUE to load all categories (including the non-category) or FALSE to load only the non-category pages
Default true

Description

Name loadPages()

Loads the $pageContent arrays from pages in a specific category(ies) or all categories.

Loads all $pageContent arrays of a given category, by going through the $pagesMetaData array. It check first whether the current $pageContent array was not already loaded and is contained in the $storedPages property. If not the GeneralFunctions::readPage() public static function is called to include the $pagecontent array of the page and store it in the $storedPages property.

Note: after loading all $pageContent arrays of a category, the array with the containing $pageContent arrays will be sorted.

Example of the returned $pageContent arrays:
Show Example

  1. <?php
  2.  
  3. array(
  4.     0 => array(
  5.       "id"             => 2,
  6.       "category"       => 1,
  7.       "subCategory"    => 3,
  8.       "public"         => true,
  9.       "sortOrder"      => 4,
  10.       "lastSaveDate"   => 1282348800, // UNIX-Timestamp
  11.       "lastSaveAuthor" => 1, // ID of the user
  12.       "pageDate"       => array(
  13.           "date"   => '2010-12-31',
  14.         ),
  15.       "plugins"      => '',
  16.       "thumbnail"    => 'thumb_page2.jpg',
  17.       "styleFile"    => '',
  18.       "styleId"      => '',
  19.       "styleClass"   => '',
  20.       "localized"    => array(
  21.           "en" => array( 
  22.             "title"       => 'Example Page 2',
  23.             "description" => '',
  24.             "tags"        => 'winter summer',
  25.             "pageDate"    => array(
  26.                 "before" => 'text before date',
  27.                 "after"  => 'text after date'
  28.               ),
  29.             "content"     => '<p>Example Content</p>'
  30.           ),
  31.           "de" => array( 
  32.             "title"       => 'Beispiel Seite 2',
  33.             "description" => '',
  34.             "tags"        => 'Winter Sommer',
  35.             "pageDate"    => array(
  36.                 "before" => 'Text davor',
  37.                 "after"  => 'Text danach'
  38.               ),
  39.             "content"     => '<p>Beispiel Inhalt</p>'
  40.           )
  41.         )
  42.       ),
  43.     
  44.     1 => array(
  45.       "id"             => 2,
  46.       "category"       => 1,
  47.       "subCategory"    => false,
  48.       "public"         => true,
  49.       "sortOrder"      => 4,
  50.       "lastSaveDate"   => 1282348855, // UNIX-Timestamp
  51.       "lastSaveAuthor" => 2, // ID of the user
  52.       "pageDate"       => array(
  53.           "date"   => '2010-12-15',
  54.         ),
  55.       "plugins"      => '',
  56.       "thumbnail"    => 'thumb_page1.jpg',
  57.       "styleFile"    => '',
  58.       "styleId"      => '',
  59.       "styleClass"   => '',
  60.       "localized"    => array(
  61.           "en" => array( 
  62.             "title"       => 'Example Page 1',
  63.             "description" => '',
  64.             "tags"        => 'fall',
  65.             "pageDate"    => array(
  66.                 "before" => 'text before date',
  67.                 "after"  => 'text after date'
  68.               ),
  69.             "content"     => '<p>Example Content of page 1</p>'
  70.           ),
  71.           "de" => array( 
  72.             "title"       => 'Beispiel Seite 1',
  73.             "description" => '',
  74.             "tags"        => 'herbst',
  75.             "pageDate"    => array(
  76.                 "before" => 'Text davor',
  77.                 "after"  => 'Text danach'
  78.               ),
  79.             "content"     => '<p>Beispiel Inhalt von Seite 1</p>'
  80.           )
  81.       )
  82.       )
  83.  
  84.     ...
  85.   )
  86.  
  87. ?>


Return Value
  • array - an array with the $pageContent arrays of the requested pages
Additional
  • example: example
  • access: public
Used By
  • FeinduraBase::loadPagesByType() - to load pages
  • Search::searchPages() - to load the pages
Uses
  • GeneralFunctions::$categoryConfig - to get the sorting of the category
  • GeneralFunctions::getStoredPages() - for getting the $storedPages property
  • GeneralFunctions::readPage() - to load the $pageContent array of the page
Version
  • 1.1
    ChangeLog
    • 1.1 removed getStroredPageIds and use $pagesMetaData now
    • 1.0.1 add a simpler way of createing array with non category id in it
    • 1.0 initial release

File source:
line 1541
static array loadPagesStatistics ( [bool|int|array  = true])

Parameters

bool|int|array $category (optional) a category ID, or an array with category IDs. TRUE to load all categories (including the non-category) or FALSE to load only the non-category pages
Default true

Description

Name loadPagesStatistics()

Loads the $pageStatistics arrays from pages in a specific category(ies) or all categories.

Loads all $pageStatistics arrays of a given category, by going through the $pagesMetaData property and load the right "[pageID].statistics.php".

Note: after loading all $pageStatistics arrays of a category, the array with the containing $pageStatistics arrays will be sorted.

Example of the returned $pageStatistics arrays:
Show Example

  1. <?php
  2.  
  3. array(
  4.     0 => array(
  5.         "id" => 1,
  6.         "visitorCount" => 125,
  7.         "firstVisit" => 1282348800, // UNIX-Timestamp
  8.         "lastVisit" => 1282349800,
  9.         "visitTimeMin" =>  'a:2:{i:0;i:23;i:1;i:0;}', // serialized array
  10.         "visitTimeMax" =>  'a:1:{i:0;i:149;}',
  11.         "searchWords" =>    'a:3:{i:0;a:2:{s:4:"data";s:21:"keyword1";s:6:"number";i:2;}i:1;a:2:{s:4:"data";s:14:"keyword2";s:6:"number";i:1;}}'
  12.       ),
  13.     
  14.     1 => array(
  15.         "id" => 2,
  16.         "visitorCount" => 300,
  17.         "firstVisit" => 1003348800, // UNIX-Timestamp
  18.         "lastVisit" => 1122349800,
  19.         "visitTimeMin" =>  'a:2:{i:0;i:50;i:1;i:60;}', // serialized array
  20.         "visitTimeMax" =>  'a:1:{i:286;i:300;}',
  21.         "searchWords" =>    ''
  22.       )
  23.  
  24.     ...
  25.   )
  26.  
  27. ?>


Return Value
  • array - an array with the $pageStatistic arrays of the requested pages
Additional
  • access: public
Uses
  • GeneralFunctions::$categoryConfig - to get the sorting of the category
  • GeneralFunctions::getStoredPages() - for getting the $storedPages property
  • readPageStatistics() - to load the $pageStatistics array of the page
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1611
static array|int|false isPublicCategory ( int|array|bool )

Parameters

int|array|bool $ids the category or page ID(s), can be a number or an array with numbers, if TRUE then it check all categories

Description

Name isPublicCategory()

Checks whether the given category(ies) are public and returns the ID or an array with IDs of the public ones.

Note: This method can either return 0 for the non-category or false. Use "… === false" to check if a category is not public.


Return Value
  • array|int|false - an array with ID(s) or the ID of the public category(ies)
Additional
  • access: public
Used By
  • FeinduraBase::loadPagesByType() - to check if the category(ies) or page(s) category(ies) are public
  • FeinduraBase::loadPagesMetaDataByType() - to check if the category(ies) or page(s) category(ies) are public
  • FeinduraBase::generatePage() - to check whether the category is public
  • Feindura::createLink() - to check whether the category is public
  • Feindura::showTitle() - to check whether the category is public
  • Search::searchPages() - to check if the category is public
Uses
  • GeneralFunctions::$categoryConfig - to check if a category is public
Version
  • 1.0.1
    ChangeLog
    • 1.0.1 add non category to be public
    • 1.0 initial release

File source:
line 1667
static bool isPageContentArray ( int|array )

Parameters

int|array $page the variable to check

Description

Name isPageContentArray()

Checks the given $page parameter is a valid $pageContent array.


Additional
  • access: public
Used By
  • GeneralFunctions::sortPages() - to check if the given $pageContent arrays are valid
  • FeinduraBase::generatePage() - to check if the given array is a $pageContent array
  • FeinduraBase::shortenText() - check if the given $pageContent parameter is valid
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1694
static string getDateTimeValue ( [int  = null],
[bool  = true])

Parameters

int $intDate intDate integer optional
Default null
bool $onlyDate onlyDate whether or not the datetime attribute should contain only the date or add the time also
Default true

Description

Name getDateTimeValue()

formats the date passed into format required by 'datetime' attribute of <time> tag. If no intDate supplied, uses current date.


Return Value
  • string - time value in the format: 2009-09-04T16:31:24+02:00
Additional
  • link: http://petewilliams.info/blog/2010/09/generate-html5-time-tags-datetime-attribute-in-php/
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1728
static string formatDate ( int ,
[string  = 'DMY'],
string|false )

Parameters

int $timeStamp a UNIX-Timestamp
string|false $format (optional) the format type can be "DMY" to format into: "DD.MM.YYYY", "YMD" to format into: "YYYYY-MM-DD" or "MDY" to format into: "MM/DD/YYYYY", if FALSE it uses the format set in the administrator-settings config
Default 'DMY'
string $dateSize (optional) can be 'D', 'DM' or 'DMY', to display only days, days and month or a full day

Description

Name formatDate()

Converst a given timestamp into the a specific format type.


Return Value
  • string - the formated date or the unchanged $timestamp parameter
Additional
  • access: public
Used By
  • FeinduraBase::generatePage() - to format the page date for output
  • FeinduraBase::createTitle() - to format the title date for output
Uses
  • GeneralFunctions::$adminConfig - to get the right date format, if no format is given
Version
  • 1.1
    ChangeLog
    • 1.1 moved to GeneralFunctions
    • 1.01 changed from date conversion to timestamp
    • 1.0 initial release

File source:
line 1802
static string|int dateDayBeforeAfter ( int ,
[array|false  = false],
[string  = 'DMY'])

Parameters

int $timestamp the timestamp to check
array|false $langFile (optional) the languageFile which contains the ['DATE_TEXT_YESTERDAY'], ['DATE_TEXT_TODAY'] and ['DATE_TEXT_TOMORROW'] texts, if FALSE it loads the backend language-file
Default false
string $dateSize (optional) can be 'D', 'DM' or 'DMY', to display only days, days and month or a full day
Default 'DMY'

Description

Name dateDayBeforeAfter()

Replaces the given $date parameter with "yesterday", "today" or "tomorrow" if it is one day before or the same day or one day after today. It will also wrap the date(s) in a <time> tag.

Used Global Variables

  • $langFile the backend language-file array (included in the backend.include.php)


Return Value
  • string|int - a string with "yesterday", "today" or "tomorrow" or the unchanged timestamp
Additional
  • access: public
Used By
  • FeinduraBase::generatePage() - check if the page date is "yesterday" "today" or "tomorrow"
  • FeinduraBase::createTitle() - check if the title date is "yesterday" "today" or "tomorrow"
Version
  • 1.1
    ChangeLog
    • 1.1 moved to GeneralFunctions
    • 1.0 initial release

File source:
line 1852
static string|false showPageDate ( array ,
[bool  = true],
[array|false  = false])

Parameters

array $pageContent the $pageContent array of a page
bool $useText (optional) is TRUE it uses the names Today,Tomorrow, Yesterday these dates, if FALSE it always uses just dates.
Default true
array|false $langFile (optional) a language file to use, if FALSE it uses the global $langFile variable.
Default false

Description

Name showPageDate()

Returns either a single page date or a date range formated, ready to display in an HTML page.


Return Value
  • string|false - the formated page date(s) or false if they the page has no page date or its deactivated in the category
Additional
  • access: public
Used By
  • showPageToolTip() - to format the unix timstamp into the right date format
Uses
  • GeneralFunctions::$categoryConfig - to check if in the category the page date is activated
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1916
static string getFlagSrc ( string ,
[bool  = true])

Parameters

string $countryCode a country code like "en"
bool $backend (optional) if true it removes the feindura basePath
Default true

Description

Name getFlagSrc()

Returns the right flag from the library/images/icons/flags folder. If no flag with the given $countryCode parameter exists, it returns a generic flag (library/images/icons/flags/none.png).


Return Value
  • string - the URL of the flag, relative to the "feindura" folder
Additional
  • access: public
Version
  • 1.1
    ChangeLog
    • 1.1 moved to GeneralFunctions
    • 1.0 initial release

File source:
line 2096
static string createHref ( array ,
[string|false  = false],
[bool|string  = false],
[bool  = false])

Parameters

array $pageContent the $pageContent array of a page
string|false $sessionId (optional) the session ID string in the following format: "sessionName=sessionId"
Default false
bool|string $languageCode (optional) a language code to use when generating the link, if FALSE it uses the $_SESSION['feinduraSession']['websiteLanguage'] variable
Default false
bool $fullUrl (optional) if TRUE it add also the URL to the href path
Default false

Description

Name createHref()

Creates a href-attribute from the given $pageContent parameter, if the sessionId parameter is given it adds them on the end of the href string.


Return Value
  • string - the href string ready to use in a href attribute
Additional
  • see: Feindura::createHref()
  • access: public
Used By
  • Feindura::createHref() - call the right createHref functions in the GeneralFunctions class
  • GeneralFunctions::replaceLinks() - to create the hreaf of the link
Uses
  • GeneralFunctions::$adminConfig - for the variable names which the $_GET variable will use for category and page, also for the websitePath
  • GeneralFunctions::$categoryConfig - for the category name if Pretty URLs are activated
Version
  • 2.0
    ChangeLog
    • 2.0 add parent pages
    • 1.0.1 changed websitepath; getting dirname now
    • 1.0 initial release

File source:
line 2234
static array sortPages ( array ,
[string|false  = false])

Parameters

array $pageContentArrays the $pageContent array of a page
string|false $sortBy (optional) the name of the sort function to use, if FALSE it uses automatically the right sort-public static function for the category
Default false

Description

Name sortPages()

Sort an array with $pageContent arrays by a given sort function. The following sort functions are available by default and can be used for the $sortBy parameter:

  • "sortBySortOrder"
  • "sortAlphabetical"
  • "sortByStartDate"
  • "sortByEndDate"
  • "sortByCategory"
  • "sortByLastSaveDate"


Return Value
  • array - the sorted array with the $pageContent arrays
Additional
  • see: sort.public static functions.php
  • access: public
Used By
  • Feindura::createMenu() - to sort the $pageContent arrays by category
  • Feindura::listPages() - to sort the $pageContent arrays by category
  • Feindura::listPagesBySortFunction() - to sort the $pageContent arrays by category
Uses
  • GeneralFunctions::$categoryConfig - to find the right sort method for every category
  • GeneralFunctions::isPageContentArray() - to check if the given $pageContent arrays are valid
  • sortBySortOrder() - to sort the pages by sortorder
  • sortByStartDate() - to sort the pages by page date
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2324
static array createBreadCrumbsArray ( int ,
int )

Parameters

int $page a page ID
int $category a category ID

Description

Name createBreadCrumbsArray()

Creates an array with $pageContent arrays in the order of the navigation.


Return Value
  • array - the created breadcrumb navigation, or an empty array
Additional
  • example: $id parameter example
  • access: public
Uses
  • GeneralFunctions::getParentPages() - to get the parent pages in an array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2374
static string|false addStylesheetsInBody ( string )

Parameters

string $folder the path of the plugin folder to look for stylesheet files

Description

Name addStylesheetsInBody()

Goes through a folder recursive and gets the css files. It then tries to add these as <link..> tags inside the <head> tag, using javascript. If no javascript is activated it will just place the <link...> tags to the current position.


Return Value
  • string|false - the HTML <link> tags plus corresponding javascript or FALSE if no stylesheet-file was found
Additional
  • access: public
Uses
  • GeneralFunctions::createStyleTags() - to get the stylesheet <link..> tags
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2444
static string cleanPluginPlaceholders ( string )

Parameters

string $content a string with pluginPlaceholders

Description

Name cleanPluginPlaceholders()

Removes the src attribute and adds back the draggable=true attribute.


Return Value
  • string - the changed $content parameter
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2475
static string cleanSpecialChars ( string ,
[string  = ''])

Parameters

string $string the string to clear
string $replaceString (optional) the string which replaces all special chars found
Default ''

Description

Name cleanSpecialChars()

Removes all special chars from a string.


Return Value
  • string - the cleaned string
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2505
static string shortenString (  ,
int ,
string )

Parameters

string $title the title string to shorten
int $length the number of letters the string should have after
$string

Description

Name shortenString()

Shortens a string to its letter number (conciders htmlentities as multiple characters).


Return Value
  • string - the shortend title or the unchanged title, if shorten is not necessary
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2533
static string htmLawed ( string ,
[array  = false])

Parameters

string $string the data to check against htmlLawed
array $config (optional) if given it will be used as the config array fpr the htmLawed function
Default false

Description

Name htmLawed()

Uses the htmLawed function but decodes first UTF-8 and after encodes again.


Return Value
  • string - the checked html
Additional
  • access: public
Used By
  • FeinduraBase::generateContent()
Version
  • 1.1
    ChangeLog
    • 1.1 moved the admin settings check if htmlLawed is allow to were the method is called (removed it from here)
    • 1.0 initial release

File source:
line 2583
static string|false getRealPath ( string )

Parameters

string $path an absolute or relative path

Description

Name getRealPath()

Try to get the real path from a given absolute or relative path. If the path contains a filename it will ony return the folders in the path (strapping the filename).

Used Constants

  • DOCUMENTROOT the absolut path of the webserver


Return Value
  • string|false - the real path, including the DOCUMENTROOT or, FALSE
Additional
  • access: public
Version
  • 0.2
    ChangeLog
    • 0.2 add is_file check, to strap the filename
    • 0.1 initial release

File source:
line 2630
static array|false readFolder ( string )

Parameters

string $folder an absolute or relative path of an folder to read

Description

Name readFolder()

Reads a folder and return it's subfolders and files.

Example of the returned array:
Show Example

  1.  array(
  2.     "files" => array(
  3.                    0 => '/path/file1.php',
  4.                    1 => '/path/file2.php',
  5.                    ),
  6.     "folders" => array(
  7.                    0 => '/path/subfolder1',
  8.                    1 => '/path/subfolder2',
  9.                    2 => '/path/subfolder3'
  10.                    )
  11.     )

Used Constants

  • DOCUMENTROOT the absolut path of the webserver


Return Value
  • array|false - an array with the folder elements (without DOCUMENTROOT), FALSE if the folder not is a directory
Additional
  • access: public
Version
  • 1.01
    ChangeLog
    • 1.01 changed to scandir()
    • 1.0 initial release

File source:
line 2690
static array|false readFolderRecursive ( string )

Parameters

string $folder an absolute or relative path of an folder to read

Description

Name readFolderRecursive()

Reads a folder recursive and return it's subfolders and files, opens then also the subfolders and read them, etc.

Example of the returned array:
Show Example

  1.  array(
  2.     "files" => array(
  3.                    0 => '/path/file1.php',
  4.                    1 => '/path/subfolder1/file2.php',
  5.                    ),
  6.     "folders" => array(
  7.                    0 => '/path/subfolder1',
  8.                    1 => '/path/subfolder2/subsubfolder1',
  9.                    2 => '/path/subfolder2/subsubfolder2'
  10.                    )
  11.     )

Used Constants

  • DOCUMENTROOT the absolut path of the webserver


Return Value
  • array|false - an array with the folder elements (without DOCUMENTROOT), FALSE if the folder is not a directory
Additional
  • access: public
Used By
  • GeneralFunctions::savePagesMetaData() - to get all pages from the "pages" folder
  • GeneralFunctions::createStyleTags() - to read the folder
  • editFiles() - reads the $filesPath folder recursive and loads all file paths in an array
  • isWritableWarningRecursive() - to read all subfolders and files in a directory
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2760
static bool folderIsEmpty ( string )

Parameters

string $folder the absolute path of an folder to check

Description

Name folderIsEmpty()

Check if a folder is empty.

Used Constants

  • DOCUMENTROOT the absolut path of the webserver


Return Value
  • bool - TRUE if its empty, otherwise FALSE
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2784
static bool deleteFolder ( string )

Parameters

string $dir the absolute path to the directory which will be deleted

Description

Name deleteFolder()

Deletes a directory and all files in it.


Return Value
  • bool - TRUE if the directory was succesfull deleted, otherwise FALSE
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2850
static string|array|false createStyleTags ( string ,
[bool  = false],
bool )

Parameters

string $folder the absolute path of the folder to look for stylesheet files
bool $backend if TRUE is substract the $adminConfig['basePath'] from the stylesheet link
Default false
bool $returnHrefOnly if TRUE it will return an array with the paths of the style files

Description

Name createStyleTags()

Goes through a folder recursive and creates a HTML <link> tag for every stylesheet-file found.

Used Global Variables

  • $adminConfig the administrator-settings config (included in the general.include.php)


Return Value
  • string|array|false - the HTML <link> tags, FALSE if no stylesheet-file was found, or an array with style file paths
Additional
  • access: public
Used By
  • GeneralFunctions::addStylesheetsInBody() - to get the stylesheet <link..> tags
Uses
  • GeneralFunctions::readFolderRecursive() - to read the folder
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2889
static string smartStripslashes (  )

Parameters

$str

Description

Name smartStripslashes()

Uses stripslashes depending on "magic_quotes_gpc" and "magic_quotes_sybase"


Return Value
  • string - the stripslashed string
Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 2920
static array jsonDecode ( string )

Parameters

string $json a json encoded string

Description

Name jsonDecode()

Decodes a JSON object in php, without using json_decode() so its PHP 5.1 compatible.


Return Value
  • array - the decoded JSON data
Additional
  • link: Created by Dragos.U
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 169
void Constructor __construct ( )

Description

Type constructor

Constructor is not callable, GeneralFunctions::init() is used instead.


Additional
  • access: private
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1954
string replaceLinks ( string $pageContentString,
[bool|string $sessionId = false],
[bool|string $language = false],
[bool $fullUrl = false])

Parameters

string $pageContentString the page content string, to replace all feindura links, with real hrefs
bool|string $sessionId (optional) the session id which should be transported to the GeneralFunctions::createHref() method
Default false
bool|string $language (optional) the language code id which should be transported to the GeneralFunctions::createHref() method
Default false
bool $fullUrl (optional) if TRUE it replaces the links with full URLs (containing the domain)
Default false

Description

Name replaceLinks()

Replaces all feindura links (e.g. "?feinduraPageID=3") inside the given $pageContentString parameter, with real href links.


Return Value
  • string - the $pageContentString with replaced feindura links
Additional
  • see: FeinduraBase::generatePage()
  • access: public
Used By
  • FeinduraBase::generateContent()
Uses
  • GeneralFunctions::readPage() - to load the page for createHref()
  • GeneralFunctions::createHref() - to create the hreaf of the link
  • FeinduraBase::language
Version
  • 1.0
    ChangeLog
    • 1.0 initial release

File source:
line 1989
string replaceSnippets ( string $pageContentString,
int $pageId,
[bool $removeSnippets = false])

Parameters

string $pageContentString the page content string, to replace all feindura links, with real hrefs
int $pageId the current page ID to load the right plugins.
bool $removeSnippets (optional) will only remove the snippets placeholder from the $pageContentString
Default false

Description

Name replaceSnippets()

Replaces all feindura code snippets (e.g. "<img class="feinduraSnippet"...>) inside the given $pageContentString parameter, with either a code snippet or a plugin.


Return Value
  • string - the $pageContentString with replaced code snippets
Additional
  • see: FeinduraBase::generatePage()
  • see: saveFeeds()
  • access: public
Used By
  • FeinduraBase::generateContent()
Uses
  • GeneralFunctions::$FeinduraCLass
Version
  • 1.2
    ChangeLog
    • 1.2 improved the reg ex to be able to catch multiple plugins of the same type.
    • 1.1 add empty code snippet replacement
    • 1.0 initial release



The feindura API reference was generated from the comments in the feindura source code on Sat, 01 Dec 2012 21:56:06 +0000 by phpDocumentor 1.4.3
feindura - Flat File Content Management System, Copyright © Fabian Vogelsteller [frozeman.de]