The WB classes and function libraries are stored in the folder framework/. The most important ones are summarised in the list below. Intented class names indicate that the class is extended from it´s parent . Such classes inherit all functions and properties of it´s parents and extends them by own function. The list below provides the most important classes and function libraries.

Class: class.wb.php

This class contains the core functions of WebsiteBaker. It is automatically loaded before any front- or backend page will be displayed. The class contains functions to obtain and filter data passed over via GET, POST or SESSION. This is the place where the $_SESSION variables introduced in the previous chapter are defined. Further on the class contains functions to check the access permissions of the current user.

Class: class.frontend.php

This class is extended from class.wb.php. Here you can find all functions required to display a page in the frontend. Whenever a user types the URL https://domain.com or http://domwin.com/pages/xx.php in the browser, the file https://domain.com/index.php will be invoked. This file includes the class.frontend.php and invokes the functions contained in it. The schematic order of function calls is highlighted in the flowchart below.

Flowchart frontend

 

Flowchart of classes/functions invoked while displaying a page on the frontend

 

Class: class.admin.php

This class is extended from class.wb.php. It is included before any page of the WB backend will be displayed. This class checks the permissions of the current loged in user and displays the areas of the WB backend the user is allowed to see. Users not loged in will automatically be redirected to the login page.

Class: class.login.php

This class is extended from class.admin.php. It is invoked by https://domain.com/login/index.php or class.admin.php (if the user is not loged in). This class contains all functions required within the login process such as: verifying user inputs with database information, counting login trials, registering users, setting user informations ...

Class: class.database.php

This file contains the two classes database und mysql. The class database contains functions to connect to the WB database, to execute databse queries and to close the database connection. The class mysqli contains useful functions which can be used in own modules. The most important functions contained in the class mysql are listed below.

  • query($statement): to execute a databse query
  • numRows(): returns the number of entries (rows) of a query
  • fetchRow: returns all data sets (columns) of a certain entry (row)
  • get_one: returns the value stored in the first data set (column) of the first entry (row)

Class: class.wbmailer.php

This class was introduced with WB 2.6.5 and is extended from the class PHPMailer contained in /include/phpmailer. PHPMailer is an external Open Source Project which provides functions to send out emails. This class is also used in other projects like Joomla.

The class class.wbmailer.php reads the WB configuration settings and provides default values for language, charset (e.g. utf8), sender name, sender mail address (FROM:) and page break (default is after 80 characters).

Class: class.order.php

This class contains functions to update the database entries if pages are moved (up/downs) via the WB backend. The contained functions are not that important for module developers.

Function library: frontend.functions.php

This library contains useful functions which can be used in own modules or the index.php file of the template. The most interesting functions are listed below.

  • page_menu(): replaced by show_menu2; only use for WB < 2.6
  • show_menu2(): replacement for page_menu provides more freedom to style the menu output
  • page_content(): displays the content of a specific block (default:= 1)
  • show_breadcrumbs(): displays a breadcrumb link to the actual displayed page
  • page_title(): displays the title of the current page
  • page_description(): displays the page description of the current page (META tags)
  • page_keywords(): displays the keywords of the current page (META tags)
  • page_header(): displays the header defined in the backend: Settings
  • page_footer(): displays the footer as defined in the backend: Settings
  • register_frontend_modfiles(): adds the optitonal module files: frontend.css & frontend.js into the <head> section of the template. This allows to create modules which create valid (X)HTML output.

Function library: functions.php

This library contains functions for the file handling. The functions can be used within own modules. The most interesting functions are summarised below.

  • rm_full_dir(): removes a directory with all files and subfolder
  • directory_list(): returns a array with all subdirectories based on a starting directory
  • chmod_directory_contents: allows the recursive change of files and subfolders permissions
  • file_list(): returns a array with all files and subdirectories based on a starting directory (possible to exclude files from beeing listed)
  • get_home_folders(): returns array with all home folders below /media
  • make_dir(): creates a new directory
  • change_mode(): changes permissions of files and folders
  • is_parent(): checks if current page is a parent
  • level_count(): returns menue depths of the actual page
  • root_parent(): returns PAGE_ID of the root parent
  • get_page_title(): returns the page title of the actual page
  • get_menu_title(): returns the menu title of the actual page
  • get_parent_titles(): returns array with all parent titles of actual page
  • get_parent_ids(): returns array with all parent PAGE_IDs of the actual page
  • get_page_trail(): returns the page trail as stored in the database

Note:
Check the functions available in functions.php before you start programing own routines. Maybe there is already a function which solves your needs.