Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/lib/txplib_publish.php - 777 lines - 23174 bytes - Source - Print

Description: Tools for page routing and handling article data.

Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 21 functions

filterFrontPage()
populateArticleData()
article_format_info()
article_column_map()
getNeighbour()
getNextPrev()
lastMod()
parse()
maybe_tag()
processTags()
bombShelter()
ckEx()
ckCat()
ckExID()
lookupByTitle()
lookupByTitleSection()
lookupByIDSection()
lookupByID()
lookupByDateTitle()
chopUrl()
filterAtts()

Functions

Functions that are not part of a class:

filterFrontPage()  line: 31
Build a query qualifier to remove non-frontpage articles from the result set.

return: string An SQL qualifier for a query's 'WHERE' part
populateArticleData($rs line: 62
Populates the current article data.

Fills members of $thisarticle global from a database row.

Keeps all article tag-related values in one place, in order to do easy
bugfixing and ease the addition of new article tags.

param: array $rs An article as an assocative array
article_format_info($rs line: 100
Formats article info and populates the current article data.

Fills members of $thisarticle global from a database row.

Basically just converts an article's date values to UNIX timestamps.
Convenience for those who prefer doing conversion in application end instead
of in the SQL statement.

param: array $rs An article as an assocative array
article_column_map()  line: 124
Maps 'textpattern' table's columns to article data values.

This function returns an array of 'data-value' => 'column' pairs.

return: array
getNeighbour($threshold, $s, $type, $atts = array()  line: 167
Find an adjacent article relative to a provided threshold level.

return: array|bool An array populated with article data, or 'false' in case of no matches
param: scalar $threshold      The value to compare against
param: string $s              Optional section restriction
param: string $type           Lesser or greater neighbour? Either '<' (previous) or '>' (next)
param: array  $atts           Attribute of article at threshold
param: string $threshold_type 'cooked': Use $threshold as SQL clause; 'raw': Use $threshold as an escapable scalar
getNextPrev($id = 0, $threshold = null, $s = '')  line: 272
Find next and previous articles relative to a provided threshold level.

return: array An array populated with article data
param: int    $id        The "pivot" article's id; use zero (0) to indicate $thisarticle
param: scalar $threshold The value to compare against if $id != 0
param: string $s         Optional section restriction if $id != 0
lastMod()  line: 343
Gets the site last modification date.

return: string
parse($thing, $condition = null)  line: 357
Parse a string and replace any Textpattern tags with their actual value.

return: string               The parsed string
param: string    $thing     The raw string
param: null|bool $condition Process true/false part
maybe_tag($tag line: 469
Guesstimate whether a given function name may be a valid tag handler.

return: bool FALSE if the function name is not a valid tag handler
param: string $tag function name
processTags($tag, $atts, $thing = null)  line: 489
Parse a tag for attributes and hand over to the tag handler function.

return: string Parsed tag result
param: string      $tag   The tag name
param: string      $atts  The attribute string
param: string|null $thing The tag's content in case of container tags
bombShelter()  line: 534
Protection from those who'd bomb the site by GET.

Origin of the infamous 'Nice try' message and an even more useful '503'
HTTP status.
ckEx($table, $val, $debug = false)  line: 552
Checks a named item's existence in a database table.

The given database table is prefixed with 'txp_'. As such this function can
only be used with core database tables.

return: bool|string The item's name, or FALSE when it doesn't exist
param: string $table The database table name
param: string $val   The name to look for
param: bool   $debug Dump the query
ckCat($type, $val, $debug = false)  line: 575
Checks if the given category exists.

return: bool|string The category's name, or FALSE when it doesn't exist
param: string $type  The category type, either 'article', 'file', 'link', 'image'
param: string $val   The category name to look for
param: bool   $debug Dump the query
ckExID($val, $debug = false)  line: 596
Lookup an article by ID.

This function takes an article's ID, and checks if it's been published. If it
has, returns the section and the ID as an array. FALSE otherwise.

return: array|bool Array of ID and section on success, FALSE otherwise
param: int  $val   The article ID
param: bool $debug Dump the query
lookupByTitle($val, $debug = false)  line: 618
Lookup an article by URL title.

This function takes an article's URL title, and checks if the article has
been published. If it has, returns the section and the ID as an array.
FALSE otherwise.

return: array|bool Array of ID and section on success, FALSE otherwise
param: string $val   The URL title
param: bool   $debug Dump the query
lookupByTitleSection($val, $section, $debug = false)  line: 641
Lookup a published article by URL title and section.

This function takes an article's URL title, and checks if the article has
been published. If it has, returns the section and the ID as an array.
FALSE otherwise.

return: array|bool Array of ID and section on success, FALSE otherwise
param: string $val     The URL title
param: string $section The section name
param: bool   $debug   Dump the query
lookupByIDSection($id, $section, $debug = false)  line: 665
Lookup live article by ID and section.

return: array|bool
param: int    $id      Article ID
param: string $section Section name
param: bool   $debug
lookupByID($id, $debug = false)  line: 680
Lookup live article by ID.

return: array|bool
param: int  $id    Article ID
param: bool $debug
lookupByDateTitle($when, $title, $debug = false)  line: 694
Lookup live article by date and URL title.

return: array|bool
param: string $when  date wildcard
param: string $title URL title
param: bool   $debug
chopUrl($req line: 709
Chops a request string into URL-decoded path parts.

return: array
param: string $req Request string
filterAtts($atts = null)  line: 739
Save and retrieve the individual article's attributes plus article list
attributes for next/prev tags.

return: array
param: array $atts

title

Body