PHP Class SyndicatedPost, feedwordpress

Afficher le fichier Open project: radgeek/feedwordpress Class Usage Examples

Méthodes publiques

Свойство Type Description
$_base * var SyndicatedPost::$uri_attrs
$_freshness
$_hashes * SyndicatedPost::updated()
$_wp_id
$_wp_post
$entry MagpieRSS representation
$feed
$feed_terms
$feedmeta
$item
$link SimplePie_Item representation
$named
$post
$preset_terms
$strip_attrs * function SyndicatedPost::resolve_relative_uris ()
$uri_attrs ##################################
$xmlns

Méthodes publiques

Méthode Description
__construct ( array $item, SyndicatedLink &$source ) SyndicatedPost constructor: Given a feed item and the source from which it was taken, prepare a post that can be inserted into the WordPress database on request, or updated in place if it has already been syndicated.
add_rss_meta ( string $new_status, string $old_status, object $post ) SyndicatedPost::add_rss_meta: adds interesting meta-data to each entry using the space for custom keys. The set of keys and values to add is specified by the keys and values of $post['meta']. This is used to store anything that the WordPress user might want to access from a template concerning the post's original source that isn't provided for by standard WP meta-data (i.e., any interesting data about the syndicated post other than author, title, timestamp, categories, and guid). It's also used to hook into WordPress's support for enclosures.
add_terms ( string $new_status, string $old_status, object $post ) SyndicatedPost::add_terms() -- if FeedWordPress is processing an automatic update, that generally means that wp_insert_post() is being called under the user credentials of whoever is viewing the blog at the time -- which usually means no user at all. But wp_insert_post() checks current_user_can() before assigning any of the terms in a post's tax_input structure -- which is unfortunate, since current_user_can() always returns FALSE when there is no current user logged in. Meaning that automatic updates get no terms assigned.
author ( ) * SyndicatedPost::guid()
author_id ( string $unfamiliar_author = 'create' ) : null | integer SyndicatedPost::author_id (): get the ID for an author name from the feed. Create the author if necessary.
category_ids ( array $cats, string $unfamiliar_category = 'create', array | null $taxonomies = NULL, $params = [] ) : array category_ids: look up (and create) category ids from a list of categories
comment_feed ( )
comment_link ( )
content ( $params = [] ) * SyndicatedPost::title ()
created ( $params = [] )
db_sanitize_post ( $out ) * SyndicatedPost::db_sanitize_post_check_encoding ()
db_sanitize_post_check_encoding ( $out )
enclosures ( string $type = '/.*/' ) : array SyndicatedPost::enclosures: returns an array with any enclosures that may be attached to this syndicated item.
excerpt ( ) * SyndicatedPost::content()
filtered ( ) : boolean SyndicatedPost::filtered: check whether or not this post has been screened out by a registered filter.
fix_post_modified_ts ( string $new_status, string $old_status, object $post ) SyndicatedPost::fix_post_modified_ts() -- We would like to set post_modified and post_modified_gmt to reflect the value of or equivalent elements on the feed. Unfortunately, wp_insert_post() refuses to acknowledge explicitly-set post_modified fields and overwrites them, either with the post_date (if new) or the current timestamp (if updated).
fix_revision_meta ( integer $revision_id ) SyndicatedPost::fix_revision_meta() - Ensures that we get the meta data (authorship, guid, etc.) that we want when storing revisions of a syndicated post.
fresh_content_is_update ( ) * SyndicatedPost::this_revision_is_current ()
fresh_storage_diagnostic ( ) * SyndicatedPost::fresh_content_is_update ()
fresh_storage_hook ( ) * SyndicatedPost::fresh_storage_diagnostic()
freshness ( $format = 'number' ) : integer SyndicatedPost::freshness: check whether post is a new post to be inserted, a previously syndicated post that needs to be updated to match the latest revision, or a previously syndicated post that is still up-to-date.
get_categories ( $params = [] ) * SyndicatedPost::get_feed_channel_elements()
get_feed_channel_elements ( ) * SyndicatedPost::get_feed_root_element()
get_feed_root_element ( ) * SyndicatedPost::query()
get_terms_from_feeds ( ) : array SyndicatedPost::get_terms_from_feeds(): Return an array of terms to associate with the incoming post based on the contents of the subscribed feed (atom:category and rss:category elements, dc:subject elements, tags embedded using microformats in the post content, etc.)
get_terms_from_settings ( ) : array SyndicatedPost::get_terms_from_settings(): Return an array of terms to associate with the incoming post based on the Categories, Tags, and other terms associated with each new post by the user's settings (global and feed-specific).
guid ( ) * SyndicatedPost::normalize_guid()
has_fresh_content ( ) * SyndicatedPost::freshness ()
inline_tags ( ) : array SyndicatedPost::inline_tags: Return a list of all the tags embedded in post content using the a[@rel="tag"] microformat.
insert_new ( ) * function SyndicatedPost::insert_post ()
insert_post ( $update = false, $freshness = 2 ) * function SyndicatedPost::store ()
isTaggedAs ( string $tag ) : boolean SyndicatedPost::isTaggedAs: Test whether a feed item is tagged / categorized with a given string. Case and leading and trailing whitespace are ignored.
normalize_guid ( $guid )
normalize_guid_prefix ( ) * SyndicatedPost::update_hash()
normalize_post ( boolean $new = true ) : array SyndicatedPost::normalize_post()
permalink ( ) * SyndicatedPost::excerpt()
published ( $params = [], $default = NULL ) * SyndicatedPost::created()
query ( string $path ) SyndicatedPost::query uses an XPath-like syntax to query arbitrary elements within the syndicated item.
resolve_relative_uris ( $content, $obj ) * function SyndicatedPost::resolve_single_relative_uri()
resolve_single_relative_uri ( $refs )
sanitize_content ( $content, $obj )
source ( $what = NULL ) * SyndicatedPost::enclosures()
store ( )
stored_hashes ( $id = NULL )
strip_attribute_from_tag ( $refs )
substitution_function ( $name ) #####################################
this_revision_is_current ( $freshness = NULL )
this_revision_needs_original_post ( $freshness = NULL ) * SyndicatedPost::has_fresh_content ()
title ( $params = [] )
update_existing ( ) * SyndicatedPost::insert_new()
update_hash ( $hashed = true )
updated ( $params = [], $default ) * SyndicatedPost::published()
validate_post_id ( array $dbpost, $is_update, mixed $ns ) SyndicatedPost::validate_post_id()
wp_id ( ) #################################################

Method Details

__construct() public méthode

SyndicatedPost constructor: Given a feed item and the source from which it was taken, prepare a post that can be inserted into the WordPress database on request, or updated in place if it has already been syndicated.
public __construct ( array $item, SyndicatedLink &$source )
$item array The item syndicated from the feed.
$source SyndicatedLink The feed it was syndicated from.

add_rss_meta() public méthode

SyndicatedPost::add_rss_meta: adds interesting meta-data to each entry using the space for custom keys. The set of keys and values to add is specified by the keys and values of $post['meta']. This is used to store anything that the WordPress user might want to access from a template concerning the post's original source that isn't provided for by standard WP meta-data (i.e., any interesting data about the syndicated post other than author, title, timestamp, categories, and guid). It's also used to hook into WordPress's support for enclosures.
public add_rss_meta ( string $new_status, string $old_status, object $post )
$new_status string Unused action parameter.
$old_status string Unused action parameter.
$post object The database record for the post just inserted.

add_terms() public méthode

So, wp_insert_post() is not going to do the term assignments for us. If you want something done right....
public add_terms ( string $new_status, string $old_status, object $post )
$new_status string Unused action parameter.
$old_status string Unused action parameter.
$post object The database record for the post just inserted.

author() public méthode

* SyndicatedPost::guid()
public author ( )

author_id() public méthode

SyndicatedPost::author_id (): get the ID for an author name from the feed. Create the author if necessary.
public author_id ( string $unfamiliar_author = 'create' ) : null | integer
$unfamiliar_author string
Résultat null | integer The numeric ID of the author to attribute the post to NULL if the post should be filtered out.

category_ids() public méthode

category_ids: look up (and create) category ids from a list of categories
public category_ids ( array $cats, string $unfamiliar_category = 'create', array | null $taxonomies = NULL, $params = [] ) : array
$cats array
$unfamiliar_category string
$taxonomies array | null
Résultat array

comment_feed() public méthode

public comment_feed ( )

content() public méthode

* SyndicatedPost::title ()
public content ( $params = [] )

created() public méthode

public created ( $params = [] )

db_sanitize_post() public méthode

* SyndicatedPost::db_sanitize_post_check_encoding ()
public db_sanitize_post ( $out )

db_sanitize_post_check_encoding() public méthode

enclosures() public méthode

SyndicatedPost::enclosures: returns an array with any enclosures that may be attached to this syndicated item.
public enclosures ( string $type = '/.*/' ) : array
$type string If you only want enclosures that match a certain MIME type or group of MIME types, you can limit the enclosures that will be returned to only those with a MIME type which matches this regular expression.
Résultat array

excerpt() public méthode

* SyndicatedPost::content()
public excerpt ( )

filtered() public méthode

SyndicatedPost::filtered: check whether or not this post has been screened out by a registered filter.
public filtered ( ) : boolean
Résultat boolean TRUE iff post has been filtered out by a previous filter

fix_post_modified_ts() public méthode

So, wp_insert_post() is not going to do the last-modified assignments for us. If you want something done right....
public fix_post_modified_ts ( string $new_status, string $old_status, object $post )
$new_status string Unused action parameter.
$old_status string Unused action parameter.
$post object The database record for the post just inserted.

fix_revision_meta() public méthode

In their infinite wisdom, the WordPress coders seem to have made it completely impossible for a plugin that uses wp_insert_post() to set certain meta-data (such as the author) when you store an old revision of an updated post. Instead, it uses the WordPress defaults (= cur. active user ID if the process is running with a user logged in, or = #0 if there is no user logged in). This results in bogus authorship data for revisions that are syndicated from off the feed, unless we use a ridiculous kludge like this to end-run the munging of meta-data by _wp_put_post_revision.
public fix_revision_meta ( integer $revision_id )
$revision_id integer The revision ID to fix up meta-data

fresh_content_is_update() public méthode

* SyndicatedPost::this_revision_is_current ()

fresh_storage_diagnostic() public méthode

* SyndicatedPost::fresh_content_is_update ()

fresh_storage_hook() public méthode

* SyndicatedPost::fresh_storage_diagnostic()
public fresh_storage_hook ( )

freshness() public méthode

SyndicatedPost::freshness: check whether post is a new post to be inserted, a previously syndicated post that needs to be updated to match the latest revision, or a previously syndicated post that is still up-to-date.
public freshness ( $format = 'number' ) : integer
Résultat integer A status code representing the freshness of the post -1 = post already syndicated; has a revision that needs to be stored, but not updated to 0 = post already syndicated; no update needed 1 = post already syndicated, but needs to be updated to latest 2 = post has not yet been syndicated; needs to be created

get_categories() public méthode

* SyndicatedPost::get_feed_channel_elements()
public get_categories ( $params = [] )

get_feed_channel_elements() public méthode

* SyndicatedPost::get_feed_root_element()

get_feed_root_element() public méthode

* SyndicatedPost::query()

get_terms_from_feeds() public méthode

SyndicatedPost::get_terms_from_feeds(): Return an array of terms to associate with the incoming post based on the contents of the subscribed feed (atom:category and rss:category elements, dc:subject elements, tags embedded using microformats in the post content, etc.)
Since: 2016.0331
public get_terms_from_feeds ( ) : array
Résultat array of lists, each element has the taxonomy for a key ('category', 'post_tag', etc.), and a list of alphanumeric term names

get_terms_from_settings() public méthode

SyndicatedPost::get_terms_from_settings(): Return an array of terms to associate with the incoming post based on the Categories, Tags, and other terms associated with each new post by the user's settings (global and feed-specific).
Since: 2016.0331
public get_terms_from_settings ( ) : array
Résultat array of lists, each element has the taxonomy for a key ('category', 'post_tag', etc.), and a list of term codes (either alphanumeric names, or ID numbers encoded in a format that SyndicatedLink::category_ids() can understand) within that taxonomy

guid() public méthode

* SyndicatedPost::normalize_guid()
public guid ( )

has_fresh_content() public méthode

* SyndicatedPost::freshness ()
public has_fresh_content ( )

inline_tags() public méthode

SyndicatedPost::inline_tags: Return a list of all the tags embedded in post content using the a[@rel="tag"] microformat.
Since: 2010.0630
public inline_tags ( ) : array
Résultat array of string values containing the name of each tag

insert_new() public méthode

* function SyndicatedPost::insert_post ()
public insert_new ( )

insert_post() public méthode

* function SyndicatedPost::store ()
public insert_post ( $update = false, $freshness = 2 )

isTaggedAs() public méthode

SyndicatedPost::isTaggedAs: Test whether a feed item is tagged / categorized with a given string. Case and leading and trailing whitespace are ignored.
public isTaggedAs ( string $tag ) : boolean
$tag string Tag to check for
Résultat boolean Whether or not at least one of the categories / tags on $this->item is set to $tag (modulo case and leading and trailing whitespace)

normalize_guid() static public méthode

static public normalize_guid ( $guid )

normalize_guid_prefix() static public méthode

* SyndicatedPost::update_hash()
static public normalize_guid_prefix ( )

normalize_post() public méthode

SyndicatedPost::normalize_post()
public normalize_post ( boolean $new = true ) : array
$new boolean If true, this post is to be inserted anew. If false, it is an update of an existing post.
Résultat array A normalized representation of the post ready to be inserted into the database or sent to the WordPress API functions

published() public méthode

* SyndicatedPost::created()
public published ( $params = [], $default = NULL )

query() public méthode

SyndicatedPost::query uses an XPath-like syntax to query arbitrary elements within the syndicated item.
public query ( string $path )
$path string

resolve_relative_uris() static public méthode

* function SyndicatedPost::resolve_single_relative_uri()
static public resolve_relative_uris ( $content, $obj )

resolve_single_relative_uri() public méthode

public resolve_single_relative_uri ( $refs )

sanitize_content() static public méthode

static public sanitize_content ( $content, $obj )

source() public méthode

* SyndicatedPost::enclosures()
public source ( $what = NULL )

store() public méthode

public store ( )

stored_hashes() public méthode

public stored_hashes ( $id = NULL )

strip_attribute_from_tag() public méthode

public strip_attribute_from_tag ( $refs )

substitution_function() public méthode

#####################################
public substitution_function ( $name )

this_revision_is_current() public méthode

public this_revision_is_current ( $freshness = NULL )

this_revision_needs_original_post() public méthode

* SyndicatedPost::has_fresh_content ()
public this_revision_needs_original_post ( $freshness = NULL )

title() public méthode

public title ( $params = [] )

update_existing() public méthode

* SyndicatedPost::insert_new()
public update_existing ( )

update_hash() public méthode

public update_hash ( $hashed = true )

updated() public méthode

* SyndicatedPost::published()
public updated ( $params = [], $default )

validate_post_id() public méthode

SyndicatedPost::validate_post_id()
public validate_post_id ( array $dbpost, $is_update, mixed $ns )
$dbpost array An array representing the post we attempted to insert or update
$ns mixed A string or array representing the namespace (class, method) whence this method was called.

wp_id() public méthode

#################################################
public wp_id ( )

Property Details

$_base public_oe property

* var SyndicatedPost::$uri_attrs
public $_base

$_freshness public_oe property

public $_freshness

$_hashes public_oe property

* SyndicatedPost::updated()
public $_hashes

$_wp_id public_oe property

public $_wp_id

$_wp_post public_oe property

public $_wp_post

$entry public_oe property

MagpieRSS representation
public $entry

$feed public_oe property

public $feed

$feed_terms public_oe property

public $feed_terms

$feedmeta public_oe property

public $feedmeta

$item public_oe property

public $item

$named public_oe property

public $named

$post public_oe property

public $post

$preset_terms public_oe property

public $preset_terms

$strip_attrs public_oe property

* function SyndicatedPost::resolve_relative_uris ()
public $strip_attrs

$uri_attrs public_oe property

##################################
public $uri_attrs

$xmlns public_oe property

public $xmlns