Class CalendarSolution

Description
Direct descendents
Class Description
CalendarSolution_Category The parent class for viewing and editing a Category
CalendarSolution_Detail The parent class for viewing and editing a specific event
CalendarSolution_FeaturedPage The parent class for viewing and editing a Featured Page
CalendarSolution_FrequentEvent The parent class for viewing and editing a Frequent Event
CalendarSolution_List The parent class for displaying collections of events
Class Constant Summary
Variable Summary
array $data
string $http_host
SQLSolution_General $sql
array $uri
bool $use_cache
Method Summary
CalendarSolution __construct ([string $dbms = CALENDAR_SOLUTION_DBMS])
string convert_windows_characters (string $in)
string escape_for_icalendar (string $text)
bool flush_cache ()
string format_date (string $in, string $format)
string get_credit ()
string get_css ()
mixed get_date_from_request (string $name)
string get_errors ()
string get_event_formatted_icalendar (array $event)
mixed get_int_array_from_request (string $name)
mixed get_int_from_request (string $name)
mixed get_string_from_request (string $name)
bool is_admin ()
void set_data_empty ()
void set_uri ()
Variables
CalendarSolution_Cache $cache (line 72)

The cache object

bool $cache_available = false (line 78)

Is caching available?

  • access: protected
string $csrf_token_name (line 85)

The name of the token used for protecting our admin forms against

Cross Site Request Forgeries

array $data = array() (line 91)

An associative array of the given item's data


Redefined in descendants as:
string $http_host (line 101)

The HTTP_HOST, set in __construct()

Defaults to $_SERVER['HTTP_HOST'] and falls back to CALENDAR_SOLUTION_HTTP_HOST if that's not set.

SQLSolution_General $sql (line 106)
array $uri (line 113)

Data from the REQUEST_URI broken into an associative array containing

the 'path' as a string and the 'query' broken into a sub-array

bool $use_cache (line 119)

Should the current request use caching?

  • access: protected
Methods
Constructor __construct (line 143)

Instantiates the database and cache classes then sets the $http_host property

CalendarSolution __construct ([string $dbms = CALENDAR_SOLUTION_DBMS])
  • string $dbms: optional override of the database extension setting in CALENDAR_SOLUTION_DBMS. Values can be "mysql", "mysqli", "pgsql", "sqlite", "sqlite3".

Redefined in descendants as:
convert_windows_characters (line 225)

Turns "fancy" windows-1252 character set characters into ASCII equivalents

  • return: the sanitized data
  • since: Method available since version 3.7
  • access: protected
string convert_windows_characters (string $in)
  • string $in: the data to be sanitize
escape_data_for_html (line 204)

Sanitizes the data in $this->data via htmlspecialchars()

void escape_data_for_html ()
escape_for_icalendar (line 290)

Sanitizes the input for iCalendar formats

The steps are:

  • Break hyperlinks down into anchor text and URI text
  • Strip HTML tags
  • Escape iCalendar special characters
  • Wrap text at 75 characters

string escape_for_icalendar (string $text)
  • string $text: the string to be escaped
flush_cache (line 313)

Flushes the system's cache

bool flush_cache ()
format_date (line 335)

Formats a date/time string

This route is necessary because of the need to provide portability across different database management systems.

string format_date (string $in, string $format)
  • string $in: the date to format
  • string $format: the format to use (for PHP's date() function). Use the DATE_FORMAT_* constants in this class or use a format of your choosing.
get_admin_navigation (line 346)

Generates the HTML needed to access administrative functions

  • return: the HTML with the admin links
  • access: public
string get_admin_navigation ()
get_credit (line 364)

Produces the HTML with a link to the Calendar Solution's home page

  • return: the HTML with the credit link
  • access: protected
string get_credit ()
get_css (line 374)

Provides the Cascading Style Sheet data, for use between <style> tags

  • return: the CSS
  • access: public
string get_css ()
get_date_from_request (line 392)

Looks for a date value in $_REQUEST[$name]

  • return: the date in YYYY-MM-DD format, NULL if the REQUEST element is not set, NULL if $_GET['remove_limit'] is set, or FALSE if the input is invalid
  • access: protected
  • usedby: CalendarSolution_List::set_to() - to determine the user's intention
  • usedby: CalendarSolution_List::set_from() - to determine the user's intention
mixed get_date_from_request (string $name)
  • string $name: the $_REQUEST array's key to examine
get_errors (line 414)

Produces an HTML list explaining the errors found by is_valid()

string get_errors ()
get_event_formatted_icalendar (line 439)

Formats event data for iCalendar output

string get_event_formatted_icalendar (array $event)
  • array $event: an associative array of a given event
get_int_array_from_request (line 558)

Extracts an integer or an array of integers in $_REQUEST[$name]

mixed get_int_array_from_request (string $name)
  • string $name: the $_REQUEST array's key to examine
get_int_from_request (line 534)

Looks for an integer value in $_REQUEST[$name]

mixed get_int_from_request (string $name)
  • string $name: the $_REQUEST array's key to examine
get_string_from_request (line 593)

Looks for a string value in $_REQUEST[$name]

  • return: the string, NULL if the REQUEST element is not set, NULL if $_GET['remove_limit'] is set, or FALSE if the input is invalid
  • access: protected
  • usedby: CalendarSolution_List::set_is_own_event() - to determine the user's intention
mixed get_string_from_request (string $name)
  • string $name: the $_REQUEST array's key to examine
is_admin (line 610)

Is the current view from the admin section or not?

  • access: public
bool is_admin ()
is_cache_available (line 626)

Is caching available?

  • access: public
bool is_cache_available ()
set_data_empty (line 638)

Populates $this->data with the requisite keys and sets values to NULL

  • access: public
  • uses: CalendarSolution::$fields - as the list of field names
  • uses: CalendarSolution::$data - to hold the data
void set_data_empty ()
set_data_from_post (line 665)

Populates $this->data with the information from $_POST

The following transformations also occur:

  • Missing keys are created and their values set to NULL.
  • Non-scalar entries get set to NULL (see below for exceptions).
  • Values are passed through trim().
  • Empty strings are converted to NULL.
Fields expected to be arrays (i.e. fields listed in "$fields_bitwise") have their array values passed through the process listed above.

  • access: public
  • uses: CalendarSolution::$fields_bitwise - to know which fields to handle differently
  • uses: CalendarSolution::$fields - as the list of field names
  • uses: CalendarSolution::$data - to hold the data
void set_data_from_post ()
set_uri (line 713)

Breaks up the REQUEST_URI into usable parts

void set_uri ()
validate_csrf_token (line 730)

Checks the Cross Site Request Forgery token to improve security

void validate_csrf_token ()
Class Constants
DATE_FORMAT_FULL = 'l, F jS, Y' (line 40)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_ICALENDAR = 'Ymd' (line 45)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_LONG = 'D, M jS' (line 41)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_MEDIUM = 'D, n/j' (line 43)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_NAME_NUMBER = 'l jS' (line 42)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_SHORT = 'n/j' (line 44)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_TIME_12AP = 'g:i\&\n\b\s\p\;a' (line 46)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_TIME_24 = 'H:i' (line 47)

Format for PHP's date() function, to be used by our format_date() method

DATE_FORMAT_TIME_ICALENDAR = 'Ymd\THis' (line 48)

Format for PHP's date() function, to be used by our format_date() method

LINK_TO_CALENDAR_URI = 4 (line 57)

ID numbers used by the "list_link_goes_to_id" field

LINK_TO_DETAIL_PAGE = 2 (line 55)

ID numbers used by the "list_link_goes_to_id" field

LINK_TO_FREQUENT_EVENT_URI = 3 (line 56)

ID numbers used by the "list_link_goes_to_id" field

LINK_TO_NONE = 1 (line 54)

ID numbers used by the "list_link_goes_to_id" field

STATUS_CANCELLED = 3 (line 65)

ID numbers used by the "status_id" field

STATUS_FULL = 2 (line 64)

ID numbers used by the "status_id" field

STATUS_OPEN = 1 (line 63)

ID numbers used by the "status_id" field

Documentation generated on Wed, 21 Mar 2012 14:16:41 -0400 by phpDocumentor 1.4.4