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


PHP wxr_tag_description函数代码示例

本文整理汇总了PHP中wxr_tag_description函数的典型用法代码示例。如果您正苦于以下问题:PHP wxr_tag_description函数的具体用法?PHP wxr_tag_description怎么用?PHP wxr_tag_description使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wxr_tag_description函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: export_wp


//.........这里部分代码省略.........
<?php 
            wxr_authors_list();
            ?>

<?php 
            foreach ($cats as $c) {
                ?>
	<wp:category><wp:term_id><?php 
                echo $c->term_id;
                ?>
</wp:term_id><wp:category_nicename><?php 
                echo $c->slug;
                ?>
</wp:category_nicename><wp:category_parent><?php 
                echo $c->parent ? $cats[$c->parent]->slug : '';
                ?>
</wp:category_parent><?php 
                wxr_cat_name($c);
                wxr_category_description($c);
                ?>
</wp:category>
<?php 
            }
            foreach ($tags as $t) {
                ?>
	<wp:tag><wp:term_id><?php 
                echo $t->term_id;
                ?>
</wp:term_id><wp:tag_slug><?php 
                echo $t->slug;
                ?>
</wp:tag_slug><?php 
                wxr_tag_name($t);
                wxr_tag_description($t);
                ?>
</wp:tag>
<?php 
            }
            foreach ($terms as $t) {
                ?>
	<wp:term><wp:term_id><?php 
                echo $t->term_id;
                ?>
</wp:term_id><wp:term_taxonomy><?php 
                echo $t->taxonomy;
                ?>
</wp:term_taxonomy><wp:term_slug><?php 
                echo $t->slug;
                ?>
</wp:term_slug><wp:term_parent><?php 
                echo $t->parent ? $terms[$t->parent]->slug : '';
                ?>
</wp:term_parent><?php 
                wxr_term_name($t);
                wxr_term_description($t);
                ?>
</wp:term>
<?php 
            }
            if ('all' == $args['post_type']) {
                wxr_nav_menu_terms();
            }
            ?>

	<?php 
            do_action('rss2_head');
开发者ID:rmccue,项目名称:wp-cli,代码行数:67,代码来源:export.php

示例2: export_wp

function export_wp($author = '')
{
    global $wpdb, $post_ids, $post;
    do_action('export_wp');
    $filename = 'wordpress.' . date('Y-m-d') . '.xml';
    header('Content-Description: File Transfer');
    header("Content-Disposition: attachment; filename={$filename}");
    header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    $where = '';
    if ($author and $author != 'all') {
        $author_id = (int) $author;
        $where = $wpdb->prepare(" WHERE post_author = %d ", $author_id);
    }
    // grab a snapshot of post IDs, just in case it changes during the export
    $post_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} {$where} ORDER BY post_date_gmt ASC");
    $categories = (array) get_categories('get=all');
    $tags = (array) get_tags('get=all');
    function wxr_missing_parents($categories)
    {
        if (!is_array($categories) || empty($categories)) {
            return array();
        }
        foreach ($categories as $category) {
            $parents[$category->term_id] = $category->parent;
        }
        $parents = array_unique(array_diff($parents, array_keys($parents)));
        if ($zero = array_search('0', $parents)) {
            unset($parents[$zero]);
        }
        return $parents;
    }
    while ($parents = wxr_missing_parents($categories)) {
        $found_parents = get_categories("include=" . join(', ', $parents));
        if (is_array($found_parents) && count($found_parents)) {
            $categories = array_merge($categories, $found_parents);
        } else {
            break;
        }
    }
    // Put them in order to be inserted with no child going before its parent
    $pass = 0;
    $passes = 1000 + count($categories);
    while (($cat = array_shift($categories)) && ++$pass < $passes) {
        if ($cat->parent == 0 || isset($cats[$cat->parent])) {
            $cats[$cat->term_id] = $cat;
        } else {
            $categories[] = $cat;
        }
    }
    unset($categories);
    function wxr_cdata($str)
    {
        if (seems_utf8($str) == false) {
            $str = utf8_encode($str);
        }
        // $str = ent2ncr(wp_specialchars($str));
        $str = "<![CDATA[{$str}" . (substr($str, -1) == ']' ? ' ' : '') . "]]>";
        return $str;
    }
    function wxr_site_url()
    {
        global $current_site;
        // mu: the base url
        if (isset($current_site->domain)) {
            return 'http://' . $current_site->domain . $current_site->path;
        } else {
            return get_bloginfo_rss('url');
        }
    }
    function wxr_cat_name($c)
    {
        if (empty($c->name)) {
            return;
        }
        echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
    }
    function wxr_category_description($c)
    {
        if (empty($c->description)) {
            return;
        }
        echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
    }
    function wxr_tag_name($t)
    {
        if (empty($t->name)) {
            return;
        }
        echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
    }
    function wxr_tag_description($t)
    {
        if (empty($t->description)) {
            return;
        }
        echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
    }
    function wxr_post_taxonomy()
    {
        $categories = get_the_category();
//.........这里部分代码省略.........
开发者ID:nurpax,项目名称:saastafi,代码行数:101,代码来源:export.php

示例3: export_wp


//.........这里部分代码省略.........
     *
     * @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>';
    }
    /**
     * Output a tag_name XML tag from a given tag object
     *
     * @since 2.3.0
     *
     * @param object $tag Tag Object
     */
    function wxr_tag_name($tag)
    {
        if (empty($tag->name)) {
            return;
        }
        echo '<wp:tag_name>' . wxr_cdata($tag->name) . '</wp:tag_name>';
    }
    /**
     * Output a tag_description XML tag from a given tag object
     *
     * @since 2.3.0
     *
     * @param object $tag Tag Object
     */
    function wxr_tag_description($tag)
    {
        if (empty($tag->description)) {
            return;
        }
        echo '<wp:tag_description>' . wxr_cdata($tag->description) . '</wp:tag_description>';
    }
    /**
     * Output a term_name XML tag from a given term object
     *
     * @since 2.9.0
     *
     * @param object $term Term Object
     */
    function wxr_term_name($term)
    {
        if (empty($term->name)) {
            return;
        }
        echo '<wp:term_name>' . wxr_cdata($term->name) . '</wp:term_name>';
    }
    /**
     * 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;
        }
开发者ID:AndyMarkle,项目名称:rocket,代码行数:67,代码来源:export.php

示例4: dsq_export_wp


//.........这里部分代码省略.........
     *
     * @since unknown
     *
     * @param object $c Category Object
     */
    function wxr_category_description($c)
    {
        if (empty($c->description)) {
            return;
        }
        echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Tag Object
     */
    function wxr_tag_name($t)
    {
        if (empty($t->name)) {
            return;
        }
        echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Tag Object
     */
    function wxr_tag_description($t)
    {
        if (empty($t->description)) {
            return;
        }
        echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     */
    function wxr_post_taxonomy()
    {
        $categories = get_the_category();
        $tags = get_the_tags();
        $the_list = '';
        $filter = 'rss';
        if (!empty($categories)) {
            foreach ((array) $categories as $category) {
                $cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
                // for backwards compatibility
                $the_list .= "\n\t\t<category><![CDATA[{$cat_name}]]></category>\n";
                // forwards compatibility: use a unique identifier for each cat to avoid clashes
                // http://trac.wordpress.org/ticket/5447
                $the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[{$cat_name}]]></category>\n";
            }
        }
        if (!empty($tags)) {
            foreach ((array) $tags as $tag) {
                $tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
                $the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[{$tag_name}]]></category>\n";
                // forwards compatibility as above
开发者ID:Three20,项目名称:Backend,代码行数:67,代码来源:export.php

示例5: uncode_export_wp


//.........这里部分代码省略.........
     *
     * @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>';
    }
    /**
     * Output a tag_name XML tag from a given tag object
     *
     * @since 2.3.0
     *
     * @param object $tag Tag Object
     */
    function wxr_tag_name($tag)
    {
        if (empty($tag->name)) {
            return;
        }
        echo '<wp:tag_name>' . wxr_cdata($tag->name) . '</wp:tag_name>';
    }
    /**
     * Output a tag_description XML tag from a given tag object
     *
     * @since 2.3.0
     *
     * @param object $tag Tag Object
     */
    function wxr_tag_description($tag)
    {
        if (empty($tag->description)) {
            return;
        }
        echo '<wp:tag_description>' . wxr_cdata($tag->description) . '</wp:tag_description>';
    }
    /**
     * Output a term_name XML tag from a given term object
     *
     * @since 2.9.0
     *
     * @param object $term Term Object
     */
    function wxr_term_name($term)
    {
        if (empty($term->name)) {
            return;
        }
        echo '<wp:term_name>' . wxr_cdata($term->name) . '</wp:term_name>';
    }
    /**
     * 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;
        }
开发者ID:b0123498765,项目名称:fithealthyandwealthy,代码行数:67,代码来源:uncode_export_template.php

示例6: export_wp


//.........这里部分代码省略.........
     *
     * @since unknown
     *
     * @param object $c Category Object
     */
    function wxr_category_description($c)
    {
        if (empty($c->description)) {
            return;
        }
        echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Tag Object
     */
    function wxr_tag_name($t)
    {
        if (empty($t->name)) {
            return;
        }
        echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Tag Object
     */
    function wxr_tag_description($t)
    {
        if (empty($t->description)) {
            return;
        }
        echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Term Object
     */
    function wxr_term_name($t)
    {
        if (empty($t->name)) {
            return;
        }
        echo '<wp:term_name>' . wxr_cdata($t->name) . '</wp:term_name>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Term Object
     */
    function wxr_term_description($t)
    {
        if (empty($t->description)) {
            return;
        }
开发者ID:google-code-backups,项目名称:pumpmyvote,代码行数:67,代码来源:export.php

示例7: export_wp


//.........这里部分代码省略.........
     *
     * @since unknown
     *
     * @param object $c Category Object
     */
    function wxr_category_description($c)
    {
        if (empty($c->description)) {
            return;
        }
        echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Tag Object
     */
    function wxr_tag_name($t)
    {
        if (empty($t->name)) {
            return;
        }
        echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Tag Object
     */
    function wxr_tag_description($t)
    {
        if (empty($t->description)) {
            return;
        }
        echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Term Object
     */
    function wxr_term_name($t)
    {
        if (empty($t->name)) {
            return;
        }
        echo '<wp:term_name>' . wxr_cdata($t->name) . '</wp:term_name>';
    }
    /**
     * {@internal Missing Short Description}}
     *
     * @since unknown
     *
     * @param object $t Term Object
     */
    function wxr_term_description($t)
    {
        if (empty($t->description)) {
            return;
        }
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:67,代码来源:export.php

示例8: export_wp

    private function export_wp($args = array())
    {
        global $wpdb, $post;
        /**
         * Wrap given string in XML CDATA tag.
         *
         * @since 2.1.0
         *
         * @param string $str String to wrap in XML CDATA tag.
         */
        function wxr_cdata($str)
        {
            if (seems_utf8($str) == false) {
                $str = utf8_encode($str);
            }
            // $str = ent2ncr(esc_html($str));
            $str = '<![CDATA[' . str_replace(']]>', ']]]]><![CDATA[>', $str) . ']]>';
            return $str;
        }
        /**
         * Return the URL of the site
         *
         * @since 2.5.0
         *
         * @return string Site URL.
         */
        function wxr_site_url()
        {
            // ms: the base url
            if (is_multisite()) {
                return network_home_url();
            } else {
                return get_bloginfo_rss('url');
            }
        }
        /**
         * Output a cat_name XML tag from a given category object
         *
         * @since 2.1.0
         *
         * @param object $category Category Object
         */
        function wxr_cat_name($category)
        {
            if (empty($category->name)) {
                return;
            }
            echo '<wp:cat_name>' . wxr_cdata($category->name) . '</wp:cat_name>';
        }
        /**
         * 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>';
        }
        /**
         * Output a tag_name XML tag from a given tag object
         *
         * @since 2.3.0
         *
         * @param object $tag Tag Object
         */
        function wxr_tag_name($tag)
        {
            if (empty($tag->name)) {
                return;
            }
            echo '<wp:tag_name>' . wxr_cdata($tag->name) . '</wp:tag_name>';
        }
        /**
         * Output a tag_description XML tag from a given tag object
         *
         * @since 2.3.0
         *
         * @param object $tag Tag Object
         */
        function wxr_tag_description($tag)
        {
            if (empty($tag->description)) {
                return;
            }
            echo '<wp:tag_description>' . wxr_cdata($tag->description) . '</wp:tag_description>';
        }
        /**
         * Output a term_name XML tag from a given term object
         *
         * @since 2.9.0
         *
         * @param object $term Term Object
         */
        function wxr_term_name($term)
        {
//.........这里部分代码省略.........
开发者ID:netaustin,项目名称:WordPress-CLI-Exporter,代码行数:101,代码来源:cli-exporter.php


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