当前位置: 首页>>代码示例>>PHP>>正文


PHP wxr_cdata函数代码示例

本文整理汇总了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>';
}
开发者ID:scotto77,项目名称:advanced-custom-fields-wpcli,代码行数:14,代码来源:helpers.php

示例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;
 }
开发者ID:shimion,项目名称:stlucks,代码行数:15,代码来源:TF_EXPORT.php

示例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>';
 }
开发者ID:julianbonilla,项目名称:three20.info,代码行数:7,代码来源:export.php

示例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 
    }
}
开发者ID:enlacee,项目名称:anb.platicom.com.pe,代码行数:31,代码来源:lpr-export-functions.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;
开发者ID:rmccue,项目名称:wp-cli,代码行数:67,代码来源:export.php

示例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";
     }
 }
开发者ID:AndyMarkle,项目名称:rocket,代码行数:17,代码来源:export.php

示例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>';
 }
开发者ID:nurpax,项目名称:saastafi,代码行数:7,代码来源:export.php

示例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;
    }
开发者ID:akumanu,项目名称:wordpress-gk,代码行数:38,代码来源:model-table.php

示例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";
    }
}
开发者ID:arfianadam,项目名称:arfianadam.com,代码行数:25,代码来源:export.php

示例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) {
开发者ID:enlacee,项目名称:anb.platicom.com.pe,代码行数:31,代码来源:lpr-export.php

示例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>';
	}
开发者ID:plusinterativa,项目名称:clientes,代码行数:13,代码来源:export-categories.php

示例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>
开发者ID:enlacee,项目名称:anb.platicom.com.pe,代码行数:31,代码来源:lpr-export-item.php

示例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 
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:67,代码来源:wpefi-admin.php


注:本文中的wxr_cdata函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。