本文整理汇总了PHP中wxr_cdata函数的典型用法代码示例。如果您正苦于以下问题:PHP wxr_cdata函数的具体用法?PHP wxr_cdata怎么用?PHP wxr_cdata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxr_cdata函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wxr_term_description
/**
* Output a term_description XML tag from a given term object
*
* @since 2.9.0
*
* @param object $term Term Object
*/
function wxr_term_description($term)
{
if (empty($term->description)) {
return;
}
echo '<wp:term_description>' . wxr_cdata($term->description) . '</wp:term_description>';
}
示例2: option_item
function option_item($name, $value)
{
$this->item = '';
// if ( is_array($value) ) $value = tfuse_pk($value); // Do not export as urlencoded
if (is_array($value)) {
$value = serialize($value);
}
$value = wxr_cdata($value);
// export as <![CDATA[ ... ]]>
$this->item .= '<item>' . PHP_EOL;
$this->item .= '<name>' . $name . '</name>' . PHP_EOL;
$this->item .= '<value>' . $value . '</value>' . PHP_EOL;
$this->item .= '</item>' . PHP_EOL . PHP_EOL;
return $this->item;
}
示例3: wxr_category_description
function wxr_category_description($c)
{
if (empty($c->category_description)) {
return;
}
echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
}
示例4: lpr_export_attachment
function lpr_export_attachment($post)
{
if (has_post_thumbnail($post->ID)) {
$attachment_id = get_post_thumbnail_id($post->ID);
$attachment = wp_get_attachment_image_src($attachment_id, 'full');
$url = $attachment[0];
if ($data = @file_get_contents($url)) {
$data = base64_encode($data);
} else {
$data = $url;
}
$parts = explode('.', basename($url));
array_pop($parts);
$filename = join('.', $parts);
?>
<wp:attachment id="<?php
echo $attachment_id;
?>
" mime_type="<?php
echo get_post_mime_type($attachment_id);
?>
" filename="<?php
echo $filename;
?>
"><?php
echo wxr_cdata($data);
?>
</wp:attachment>
<?php
}
}
示例5: export_wp
//.........这里部分代码省略.........
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = 'WHERE ID IN (' . join(',', $next_posts) . ')';
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
// Begin Loop
foreach ($posts as $post) {
$progress->tick();
setup_postdata($post);
$is_sticky = is_sticky($post->ID) ? 1 : 0;
?>
<item>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo get_the_author_meta('login');
?>
</dc:creator>
<guid isPermaLink="false"><?php
esc_url(the_guid());
?>
</guid>
<description></description>
<content:encoded><?php
echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
?>
</excerpt:encoded>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
echo $post->post_date;
?>
</wp:post_date>
<wp:post_date_gmt><?php
echo $post->post_date_gmt;
?>
</wp:post_date_gmt>
<wp:comment_status><?php
echo $post->comment_status;
?>
</wp:comment_status>
<wp:ping_status><?php
echo $post->ping_status;
?>
</wp:ping_status>
<wp:post_name><?php
echo $post->post_name;
?>
</wp:post_name>
<wp:status><?php
echo $post->post_status;
示例6: wxr_post_taxonomy
/**
* Output list of taxonomy terms, in XML tag format, associated with a post
*
* @since 2.3.0
*/
function wxr_post_taxonomy()
{
$post = get_post();
$taxonomies = get_object_taxonomies($post->post_type);
if (empty($taxonomies)) {
return;
}
$terms = wp_get_object_terms($post->ID, $taxonomies);
foreach ((array) $terms as $term) {
echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata($term->name) . "</category>\n";
}
}
示例7: wxr_tag_description
function wxr_tag_description($t)
{
if (empty($t->description)) {
return;
}
echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
}
示例8: add_table_id_to_wp_export
/**
* Add the table IDs for an exported post (table) to the WP WXR export file.
*
* The table IDs for a table are exported in a faked post meta field.
* As there's no action for adding extra data to the WXR export file, we hijack the `wxr_export_skip_postmeta` filter hook.
*
* @since 1.5.0
*
* @param bool $skip Whether to skip the current post meta. Default false.
* @param string $meta_key Current meta key.
* @param stdClass $meta Current meta object.
*/
public function add_table_id_to_wp_export($skip, $meta_key, $meta)
{
// Bail if the exporter doesn't process a TablePress table right now.
if ($this->table_options_field_name !== $meta_key) {
return $skip;
}
// Find all table IDs that map to the post ID of the table that is currently being exported.
$table_post = $this->tables->get('table_post');
$table_ids = array_keys($table_post, (int) $meta->post_id, true);
// Bail if no table IDs are mapped to this post ID.
if (empty($table_ids)) {
return $skip;
}
// Pretend that there is a `_tablepress_export_table_id` post meta field with the list of table IDs.
$key = '_tablepress_export_table_id';
$value = wxr_cdata(implode(',', $table_ids));
// Hijack the filter and print extra XML code for our faked post meta field.
echo <<<WXR
\t\t<wp:postmeta>
\t\t\t<wp:meta_key>{$key}</wp:meta_key>
\t\t\t<wp:meta_value>{$value}</wp:meta_value>
\t\t</wp:postmeta>
WXR;
return $skip;
}
示例9: wxr_authors_list
/**
* Output list of authors with posts
*
* @since 3.1.0
*/
function wxr_authors_list()
{
global $wpdb;
$authors = array();
$results = $wpdb->get_results("SELECT DISTINCT post_author FROM {$wpdb->posts}");
foreach ((array) $results as $result) {
$authors[] = get_userdata($result->post_author);
}
$authors = array_filter($authors);
foreach ($authors as $author) {
echo "\t<wp:author>";
echo '<wp:author_id>' . $author->ID . '</wp:author_id>';
echo '<wp:author_login>' . $author->user_login . '</wp:author_login>';
echo '<wp:author_email>' . $author->user_email . '</wp:author_email>';
echo '<wp:author_display_name>' . wxr_cdata($author->display_name) . '</wp:author_display_name>';
echo '<wp:author_first_name>' . wxr_cdata($author->user_firstname) . '</wp:author_first_name>';
echo '<wp:author_last_name>' . wxr_cdata($author->user_lastname) . '</wp:author_last_name>';
echo "</wp:author>\n";
}
}
示例10: foreach
// endforeachh
}
if ($_lpr_course_author_ids) {
foreach ((array) $_lpr_course_author_ids as $result) {
$authors[] = get_userdata($result);
}
$authors = array_filter($authors);
foreach ($authors as $author) {
ob_start();
echo "\t<wp:author>";
echo '<wp:author_id>' . $author->ID . '</wp:author_id>';
echo '<wp:author_login>' . $author->user_login . '</wp:author_login>';
echo '<wp:author_email>' . $author->user_email . '</wp:author_email>';
echo '<wp:author_display_name>' . wxr_cdata($author->display_name) . '</wp:author_display_name>';
echo '<wp:author_first_name>' . wxr_cdata($author->user_firstname) . '</wp:author_first_name>';
echo '<wp:author_last_name>' . wxr_cdata($author->user_lastname) . '</wp:author_last_name>';
echo "</wp:author>\n";
$_lpr_course_authors[] = ob_get_clean();
}
}
if ($_lpr_course_authors) {
echo "\n<!-- START: Authors -->";
echo "\n" . join("\n", $_lpr_course_authors);
echo "\n<!-- END: Authors -->";
}
if ($_lpr_courses) {
echo "\n<!-- START: Courses -->";
echo "\n" . join("\n", $_lpr_courses);
echo "\n<!-- END: Courses -->";
}
if ($_lpr_course_lesson_quiz) {
示例11: wxr_category_description
/**
* Output a category_description XML tag from a given category object
*
* @since 2.1.0
*
* @param object $category Category Object
*/
function wxr_category_description( $category ) {
if ( empty( $category->description ) )
return;
echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>';
}
示例12: wxr_cdata
*
* Returning a truthy value to the filter will skip the current meta
* object from being exported.
*
* @since 4.0.0
*
* @param bool $skip Whether to skip the current comment meta. Default false.
* @param string $meta_key Current meta key.
* @param object $meta Current meta object.
*/
if (apply_filters('wxr_export_skip_commentmeta', false, $meta->meta_key, $meta)) {
continue;
}
?>
<wp:commentmeta>
<wp:meta_key><?php
echo $meta->meta_key;
?>
</wp:meta_key>
<wp:meta_value><?php
echo wxr_cdata($meta->meta_value);
?>
</wp:meta_value>
</wp:commentmeta><?php
}
?>
</wp:comment><?php
}
echo "\n";
?>
</item>
示例13: handle_export
//.........这里部分代码省略.........
?>
</wp:base_blog_url>
<?php
if ($post_ids) {
global $wp_query;
$wp_query->in_the_loop = true;
// Fake being in the loop.
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_posts = array_splice($post_ids, 0, 20)) {
$where = 'WHERE ID IN (' . join(',', $next_posts) . ')';
$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where}");
// Begin Loop
foreach ($posts as $post) {
setup_postdata($post);
$is_sticky = is_sticky($post->ID) ? 1 : 0;
?>
<item>
<?php
/** This filter is documented in wp-includes/feed.php */
?>
<title><?php
echo apply_filters('the_title_rss', $post->post_title);
?>
</title>
<link><?php
the_permalink_rss();
?>
</link>
<pubDate><?php
echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
?>
</pubDate>
<dc:creator><?php
echo wxr_cdata(get_the_author_meta('login'));
?>
</dc:creator>
<guid isPermaLink="false"><?php
the_guid();
?>
</guid>
<description></description>
<content:encoded><?php
echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
?>
</content:encoded>
<excerpt:encoded><?php
echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
?>
</excerpt:encoded>
<wp:post_id><?php
echo $post->ID;
?>
</wp:post_id>
<wp:post_date><?php
echo $post->post_date;
?>
</wp:post_date>
<wp:post_date_gmt><?php
echo $post->post_date_gmt;
?>
</wp:post_date_gmt>
<wp:comment_status><?php
echo $post->comment_status;
?>
</wp:comment_status>
<wp:ping_status><?php