[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/include/ -> functions_entries.inc.php (sommaire)

(pas de description)

Poids: 1570 lignes (68 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 2 fichiers
 include/functions_calendars.inc.php
 include/functions_entries_admin.inc.php

Définit 22 fonctions

  serendipity_deleteCategory()
  serendipity_fetchCategoryRange()
  serendipity_getMultiCategoriesSQL()
  serendipity_fetchCategoryInfo()
  serendipity_fetchEntryCategories()
  serendipity_fetchEntries()
  serendipity_fetchEntryData()
  serendipity_fetchEntry()
  serendipity_fetchEntryProperties()
  serendipity_fetchCategories()
  serendipity_rebuildCategoryTree()
  serendipity_searchEntries()
  serendipity_printEntryFooter()
  serendipity_getTotalEntries()
  serendipity_printEntries()
  serendipity_purgeEntry()
  serendipity_updertEntry()
  serendipity_deleteEntry()
  serendipity_generateCategoryList()
  serendipity_updateEntryCategories()
  serendipity_printArchives()
  serendipity_getTotalCount()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

serendipity_deleteCategory($category_range, $admin_category)   X-Ref
Delete a category or range of categories

param: string  Holds the SQL string to pass to the 'BETWEEN' command. Like '1 5' would delete categories 1-5.
param: string  Holds the optional SQL string that contains an extra safety check so that only categories can be deleted if the user is an author of the category.
return: array   The DB result

serendipity_fetchCategoryRange($categoryid)   X-Ref
Fetch a SQL ID subset of the category tree

param: int     The Id of the parent category to fetch categorie childs from. (0: all)
return: array   An associative array of the left and right category next to the chosen one

serendipity_getMultiCategoriesSQL($cats, $invert = false)   X-Ref
Returns SQL code to use when fetching entries that are contained within multiple categories

param: string   A listing of category ids to check, separated by ";"
param: boolean  Toggle whether to include or exclude entries of this category
return: string   Returns the SQL code for selecting entries of the calculated categories

serendipity_fetchCategoryInfo($categoryid, $categoryname = '')   X-Ref
Return the category properties of a specific category

Either use the first or the second parameter to select a category by ID or name. It's not
meant to be used with both parameters specified.

param: int     The ID of the category to fetch
param: string  The Name of a category to fetch
return: array   Returns an array of category properties

serendipity_fetchEntryCategories($entryid)   X-Ref
Fetch a list of all category properties to a specific entry ID

param: int     The ID of the entry
return: array   The array of associated categories to that entry

serendipity_fetchEntries($range = null, $full = true, $limit = '', $fetchDrafts = false, $modified_since = false, $orderby = 'timestamp DESC', $filter_sql = '', $noCache = false, $noSticky = false, $select_key = null, $group_by = null, $returncode = 'array')   X-Ref
Fetch a list of entries

The most central and versatile function of Serendipity, allows you to fetch entries
depending on a LOT of options.
One of the parameters missing is a restriction by category. You need to do that by
setting the superglobal $serendipity['GET']['category'] to the category you want to fetch.
Separate multiple categories by ";".
Other "external" variables that affect this function are:
$serendipity['short_archives']      - Indicates if the short archive listing is wanted, without the full entry text
$serendipity['range']               - If $range is not used, the time restriction is fetched from this array, which holds a start timestamp and end timestamp.
$serendipity['GET']['category']     - The category ID to restrict fetching entries from (can be seperated by ";")
$serendipity['GET']['hide_category']- The category ID to NOT fetch entries from (can be seperated by ";")
$serendipity['GET']['viewAuthor']   - Only fetch entries by this author
$serendipity['GET']['page']         - The page number to show entries, for pagination

If you want to use any of these options, set the variable before calling serendipity_fetchEntries(). You can reset the variables to their original content after the function call, if you need to.

Several options perform different commands when different types are passed, like the $range
parameter which can either be a string or an array with START/END range.

param: mixed       Restricts fetching entries to a specific timespan. Behaves differently depending on the type:
param: boolean     Indicates if the full entry will be fetched (body+extended: TRUE), or only the body (FALSE).
param: string      Holds a "Y" or "X, Y" string that tells which entries to fetch. X is the first entry offset, Y is number of entries. If not set, the global fetchLimit will be applied (15 entries by default)
param: boolean     Indicates whether drafts should be fetched (TRUE) or not
param: int         Holds a unix timestamp to be used in conjunction with $range, to fetch all entries newer than this timestamp
param: string      Holds the SQL "ORDER BY" statement.
param: string      Can contain any SQL code to inject into the central SQL statement for fetching the entry
param: boolean     If set to TRUE, all entries will be fetched from scratch and any caching is ignored
param: boolean     If set to TRUE, all sticky entries will NOT be fetched.
param: string      Can contain a SQL statement on which keys to select. Plugins can also set this, pay attention!
param: string      Can contain a SQL statement on how to group the query. Plugins can also set this, pay attention!
param: string      If set to "array", the array of entries will be returned. "flat-array" will only return the articles without their entryproperties. "single" will only return a 1-dimensional array. "query" will only return the used SQL.
return: array       Holds the super-array of all entries with all additional information

serendipity_fetchEntryData(&$ret)   X-Ref
Fetch special entry data and attach it to a superarray of entries.

Fetches all additional information like plugins, extended properties, additional categories for each entry.

param: array       The array of entries where the output will be merged to (referenced)
return: null

serendipity_fetchEntry($key, $val, $full = true, $fetchDrafts = 'false')   X-Ref
Fetch a single entry by a specific condition

param: string      The column to compare $val against (like 'id')
param: string      The value of the colum $key to compare with (like '4711')
param: boolean     Indicates if the full entry will be fetched (body+extended: TRUE), or only the body (FALSE).
param: string      Indicates whether drafts should be fetched
return:

serendipity_fetchEntryProperties($id)   X-Ref
Fetches additional entry properties for a specific entry ID

param: int     The ID of the entry to fetch additonal data for
return: array   The array of given properties to an entry

serendipity_fetchCategories($authorid = null, $name = null, $order = null, $artifact_mode = 'write')   X-Ref
Fetch a list of available categories for an author

param: mixed   If set, the list of categories will be fetched according to the author id. If not set, all categories will be fetched. If set to "all", then all categories will be fetched.
param: string  Restrict the list to be returned to a specific category NAME.
param: string  The SQL query part for ORDER BY of the categories
param: string  The ACL artifact condition. If set to "write" only categories will be shown that the author can write to. If set to "read", only categories will be show that the author can read or write to.
return: array   Returns the array of categories

serendipity_rebuildCategoryTree($parent = 0, $left = 0)   X-Ref
Rebuild the Category Nested Set tree

param: int     The ID of the parent category to rebuild
param: int     The ID of the next left category
return: int     Returns the new ID

serendipity_searchEntries($term, $limit = '')   X-Ref
Searches the list of entries by a specific term

param: string      The searchterm (may contain wildcards)
param: int         Restrict the number of results [also uses $serendipity['GET']['page'] for pagination]
return: array       Returns the superarray of entries found

serendipity_printEntryFooter($suffix = '.html', $totalEntries = null)   X-Ref
Creates the Footer below the entries, with pagination options and parses it to Smarty

The list of total entries is calculated from the serendipity_getTotelEntries() function

param: string    suffix for URLs
param: int       Amount of total entries
return: null

serendipity_getTotalEntries()   X-Ref
Calculates the amount of available entries.

This function uses the SQL query portion of the central serendipity_fetchEntries() query
and modifies it with different GROUP statements to calculate the number of entries.

return: int      The number of total entries

serendipity_printEntries($entries, $extended = 0, $preview = false, $smarty_block = 'ENTRIES', $smarty_fetch = true, $use_hooks = true, $use_footer = true, $use_grouped_array = false)   X-Ref
Passes the list of fetched entries from serendipity_fetchEntries() on to the Smarty layer

This function contains all the core logic to group and prepare entries to be shown in your
$entries.tpl template. It groups them by date, so that you can easily loop on the set of
entries.
This function is not only used for printing all entries, but also for printing individual
entries.
Several central Event hooks are executed here for the whole page flow, like header+footer data.

param: array       The array of entries with all of its data
param: boolean     Toggle whether the extended portion of an entry is requested (via $serendipity['GET']['id'] single entry view)
param: boolean     Indicates if this is a preview
param: string      The name of the SMARTY block that this gets parsed into
param: boolean     Indicates whether the assigned smarty variables should be parsed
param: boolean     Indicates whether to apply footer/header event hooks
param: boolean     Indicates whether the pagination footer should be displayed
param: mixed       Indicates whether the input $entries array is already grouped in preparation for the smarty $entries output array [TRUE], or if it shall be grouped by date [FALSE] or if a plugin hook shall be executed to modify data ['plugin']. This setting can also be superseded by a 'entry_display' hook.
return:

serendipity_purgeEntry($id, $timestamp = null)   X-Ref
Deprecated: Delete some garbage when an entry was deleted, especially static pages

param: int     The deleted entry ID
param: int     A timestamp for the entry archive page
return: null

serendipity_updertEntry($entry)   X-Ref
Inserts a new entry into the database or updates an existing entry

Another central function, that parses, prepares and commits changes to an entry

param: array       The new/modified entry data.
return: mixed       Integer with new entry ID if successfull, a string or array if error(s).

serendipity_deleteEntry($id)   X-Ref
Delete an entry and everything that belongs to it (comments)

param: int     The Entry ID to delete
return: mixed   FALSE or NULL on error

serendipity_generateCategoryList($cats, $select = array(0)   X-Ref
Return HTML containing a list of categories

Prints a list of categories for use in forms, the sidebar, or whereever...

param: array  An array of categories, typically gathered by serendipity_fetchCategories()
param: array  An array which holds IDs which are meant to be selected within a HTML SELECT form field [used for recursion]
param: int    The type of category list (0: HTML span list, 1/2: <option>s, 3: HTML Div list, 4: CSV data) to return
param: int    The parent ID of a category [for recursion]
param: int    The current nesting level [for recursion]
param: string Tells the function, whether or not to display the XML button for each category.
param: string The character to use for blank indenting

serendipity_updateEntryCategories($postid, $categories)   X-Ref
Set category associations of a specific entry

param: int     The ID of the entry
param: array   An array of category IDs that this entry is associated to.
return: null

serendipity_printArchives()   X-Ref
Gather an archive listing of older entries and passes it to Smarty

The archives are created according to the current timestamp and show the current year.
$serendipity['GET']['category'] is honoured like in serendipity_fetchEntries()
$serendipity['GET']['viewAuthor'] is honoured like in serendipity_fetchEntries()

return: null

serendipity_getTotalCount($what)   X-Ref
Get total count for specific objects

param: string      The type of count to show: "entries", "trackbacks", "comments"
return: string      The number



Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics