Functions

Adds a news entry to the database, and send out the news to any RSS cloud listeners.

add_news(\SHORT_TEXT $title, \LONG_TEXT $news, \?ID_TEXT $author = null, \BINARY $validated = 1, \BINARY $allow_rating = 1, \SHORT_INTEGER $allow_comments = 1, \BINARY $allow_trackbacks = 1, \LONG_TEXT $notes = '', \LONG_TEXT $news_article = '', \?AUTO_LINK $main_news_category = null, \?array $news_categories = null, \?TIME $time = null, \?MEMBER $submitter = null, integer $views = 0, \?TIME $edit_date = null, \?AUTO_LINK $id = null, \URLPATH $image = '', \?SHORT_TEXT $meta_keywords = '', \?LONG_TEXT $meta_description = '') : \AUTO_LINK
package news

Parameters

$title

\SHORT_TEXT

The news title

$news

\LONG_TEXT

The news summary (or if not an article, the full news)

$author

\?ID_TEXT

The news author (possibly, a link to an existing author in the system, but does not need to be) (null: current username)

$validated

\BINARY

Whether the news has been validated

$allow_rating

\BINARY

Whether the news may be rated

$allow_comments

\SHORT_INTEGER

Whether comments are allowed (0=no, 1=yes, 2=review style)

$allow_trackbacks

\BINARY

Whether the news may have trackbacks

$notes

\LONG_TEXT

Notes for the news

$news_article

\LONG_TEXT

The news entry (blank means no entry)

$main_news_category

\?AUTO_LINK

The primary news category (null: personal)

$news_categories

\?array

The IDs of the news categories that this is in (null: none)

$time

\?TIME

The time of submission (null: now)

$submitter

\?MEMBER

The news submitter (null: current member)

$views

integer

The number of views the article has had

$edit_date

\?TIME

The edit date (null: never)

$id

\?AUTO_LINK

Force an ID (null: don't force an ID)

$image

\URLPATH

URL to the image for the news entry (blank: use cat image)

$meta_keywords

\?SHORT_TEXT

Meta keywords for this resource (null: do not edit) (blank: implicit)

$meta_description

\?LONG_TEXT

Meta description for this resource (null: do not edit) (blank: implicit)

Returns

\AUTO_LINKThe ID of the news just added

Add a news category of the specified details.

add_news_category(\SHORT_TEXT $title, \ID_TEXT $img, \LONG_TEXT $notes, \?MEMBER $owner = null, \?AUTO_LINK $id = null) : \AUTO_LINK
package news

Parameters

$title

\SHORT_TEXT

The news category title

$img

\ID_TEXT

The theme image ID of the picture to use for the news category

$notes

\LONG_TEXT

Notes for the news category

$owner

\?MEMBER

The owner (null: public)

$id

\?AUTO_LINK

Force an ID (null: don't force an ID)

Returns

\AUTO_LINKThe ID of our new news category

Top level function to (re)generate a news Sitemap (xml file, Google-style).

build_news_sitemap() 
package news

Get a nice formatted XHTML list of news.

create_selection_list_news(\?AUTO_LINK $it, \?MEMBER $only_owned = null, boolean $editable_filter = false, boolean $only_in_blog = false) : \Tempcode
package news

Parameters

$it

\?AUTO_LINK

The selected news entry (null: none)

$only_owned

\?MEMBER

Limit news to those submitted by this member (null: show all)

$editable_filter

boolean

Whether to only show for what may be edited by the current member

$only_in_blog

boolean

Whether to only show blog posts

Returns

\TempcodeThe list

Get a nice formatted XHTML list of news categories.

create_selection_list_news_categories(\?mixed $it = null, boolean $show_all_personal_categories = false, boolean $addable_filter = false, boolean $only_existing = false, \?boolean $only_blogs = null, boolean $prefer_not_blog_selected = false, \?TIME $updated_since = null) : \Tempcode
package news

Parameters

$it

\?mixed

The selected news category. Array or AUTO_LINK (null: personal)

$show_all_personal_categories

boolean

Whether to add all personal categories into the list (for things like the adminzone, where all categories must be shown, regardless of permissions)

$addable_filter

boolean

Whether to only show for what may be added to by the current member

$only_existing

boolean

Whether to limit to only existing cats (otherwise we dynamically add unstarted blogs)

$only_blogs

\?boolean

Whether to limit to only show blog categories (null: don't care, true: blogs only, false: no blogs)

$prefer_not_blog_selected

boolean

Whether to prefer to choose a non-blog category as the default

$updated_since

\?TIME

Time from which content must be updated (null: no limit).

Returns

\TempcodeThe Tempcode for the news category select list

Delete a news entry.

delete_news(\AUTO_LINK $id) 
package news

Parameters

$id

\AUTO_LINK

The ID of the news to edit

Delete a news category.

delete_news_category(\AUTO_LINK $id) 
package news

Parameters

$id

\AUTO_LINK

The news category to delete

Send out a notification of some new news.

dispatch_news_notification(\AUTO_LINK $id, \SHORT_TEXT $title, \AUTO_LINK $main_news_category) 
package news

Parameters

$id

\AUTO_LINK

The ID of the news

$title

\SHORT_TEXT

The title

$main_news_category

\AUTO_LINK

The main news category

Edit a news entry.

edit_news(\AUTO_LINK $id, \SHORT_TEXT $title, \LONG_TEXT $news, \ID_TEXT $author, \BINARY $validated, \BINARY $allow_rating, \SHORT_INTEGER $allow_comments, \BINARY $allow_trackbacks, \LONG_TEXT $notes, \LONG_TEXT $news_article, \AUTO_LINK $main_news_category, \?array $news_categories, \SHORT_TEXT $meta_keywords, \LONG_TEXT $meta_description, \?URLPATH $image, \?TIME $add_time = null, \?TIME $edit_time = null, \?integer $views = null, \?MEMBER $submitter = null, boolean $null_is_literal = false
package news

Parameters

$id

\AUTO_LINK

The ID of the news to edit

$title

\SHORT_TEXT

The news title

$news

\LONG_TEXT

The news summary (or if not an article, the full news)

$author

\ID_TEXT

The news author (possibly, a link to an existing author in the system, but does not need to be)

$validated

\BINARY

Whether the news has been validated

$allow_rating

\BINARY

Whether the news may be rated

$allow_comments

\SHORT_INTEGER

Whether comments are allowed (0=no, 1=yes, 2=review style)

$allow_trackbacks

\BINARY

Whether the news may have trackbacks

$notes

\LONG_TEXT

Notes for the news

$news_article

\LONG_TEXT

The news entry (blank means no entry)

$main_news_category

\AUTO_LINK

The primary news category (null: personal)

$news_categories

\?array

The IDs of the news categories that this is in (null: do not change)

$meta_keywords

\SHORT_TEXT

Meta keywords

$meta_description

\LONG_TEXT

Meta description

$image

\?URLPATH

URL to the image for the news entry (blank: use cat image) (null: don't delete existing)

$add_time

\?TIME

Add time (null: do not change)

$edit_time

\?TIME

Edit time (null: either means current time, or if $null_is_literal, means reset to to NULL)

$views

\?integer

Number of views (null: do not change)

$submitter

\?MEMBER

Submitter (null: do not change)

$null_is_literal

boolean

Determines whether some NULLs passed mean 'use a default' or literally mean 'set to NULL'

Edit a news category.

edit_news_category(\AUTO_LINK $id, \?SHORT_TEXT $title, \?SHORT_TEXT $img, \?LONG_TEXT $notes, \?MEMBER $owner) 
package news

Parameters

$id

\AUTO_LINK

The news category to edit

$title

\?SHORT_TEXT

The title (null: keep as-is)

$img

\?SHORT_TEXT

The image (null: keep as-is)

$notes

\?LONG_TEXT

The notes (null: keep as-is)

$owner

\?MEMBER

The owner (null: public)

Get data from wordpress DB.

import_foreign_news_html(string $html, boolean $force_linebreaks = false) : string
package news

Parameters

$html

string

HTML

$force_linebreaks

boolean

Whether to add in HTML line breaks from whitespace ones.

Returns

stringComcode

Import wordpress db Get UI fields for starting news import.

import_rss_fields(boolean $import_to_blog) : \Tempcode
package news

Parameters

$import_to_blog

boolean

Whether to import to blogs, by default

Returns

\TempcodeUI fields

Show a news entry box.

render_news_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, boolean $brief = false, \ID_TEXT $guid = '') : \Tempcode
package news

Parameters

$row

array

The news row

$zone

\ID_TEXT

The zone our news module is in

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$brief

boolean

Whether to use the brief styling

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe box

Get Tempcode for a news category 'feature box' for the given row

render_news_category_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, boolean $attach_to_url_filter = false, \?integer $blogs = null, \ID_TEXT $guid = '') : \Tempcode
package news

Parameters

$row

array

The database field row of it

$zone

\ID_TEXT

The zone to use

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$attach_to_url_filter

boolean

Whether to copy through any filter parameters in the URL, under the basis that they are associated with what this box is browsing

$blogs

\?integer

What to show (null: news and blogs, 0: news, 1: blogs)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeA box for it, linking to the full page

Send out a ping to configured services.

send_rss_ping(boolean $show_errors = true) : string
package news

Parameters

$show_errors

boolean

Whether to show errors

Returns

stringHTTP result output