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


PHP Blog::savePost方法代码示例

本文整理汇总了PHP中Blog::savePost方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::savePost方法的具体用法?PHP Blog::savePost怎么用?PHP Blog::savePost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blog的用法示例。


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

示例1: auto_import

function auto_import()
{
    $Blog = new Blog();
    if ($_GET['import'] == urldecode($Blog->getSettingsData("autoimporterpass")) && $Blog->getSettingsData("autoimporter") == 'Y') {
        ini_set("memory_limit", "350M");
        define('MAGPIE_CACHE_DIR', GSCACHEPATH . 'magpierss/');
        require_once BLOGPLUGINFOLDER . 'inc/magpierss/rss_fetch.inc';
        $rss_feed_file = getXML(BLOGRSSFILE);
        foreach ($rss_feed_file->rssfeed as $the_fed) {
            $rss_uri = $the_fed->feed;
            $rss_category = $the_fed->category;
            $rss = fetch_rss($rss_uri);
            $items = array_slice($rss->items, 0);
            foreach ($items as $item) {
                $post_data['title'] = $item['title'];
                $post_data['slug'] = '';
                $post_data['date'] = $item['pubdate'];
                $post_data['private'] = '';
                $post_data['tags'] = '';
                $post_data['category'] = $rss_category;
                if ($Blog->getSettingsData('rssinclude') == 'Y') {
                    if (!empty($item['content']['encoded'])) {
                        $post_data['content'] = htmlentities($item['content']['encoded'], ENT_QUOTES, 'iso-8859-1');
                    } else {
                        $post_data['content'] = htmlentities($item['summary'], ENT_QUOTES, 'iso-8859-1') . '<p class="blog_auto_import_readmore"><a href="' . $item['link'] . '" target="_blank">' . i18n_r(BLOGFILE . '/READ_FULL_ARTICLE') . '</a></p>';
                    }
                } else {
                    $post_data['content'] = htmlentities($item['summary'], ENT_QUOTES, 'iso-8859-1') . '<p class="blog_auto_import_readmore"><a href="' . $item['link'] . '" target="_blank">' . i18n_r(BLOGFILE . '/READ_FULL_ARTICLE') . '</a></p>';
                }
                $post_data['excerpt'] = $Blog->create_excerpt($item['summary'], 0, $Blog->getSettingsData("excerptlength"));
                $post_data['thumbnail'] = auto_import_thumbnail($item);
                $post_data['current_slug'] = '';
                $post_data['author'] = htmlentities('<a href="' . $rss_uri . '">RSS Feed</a>', ENT_QUOTES, 'iso-8859-1');
                $Blog->savePost($post_data, true);
                echo '<p class="blog_rss_post_added">' . i18n_r(BLOGFILE . '/ADDED') . ': ' . $post_data['title'] . '</p>';
            }
        }
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:39,代码来源:rssAutoImporter.php

示例2: savePost

function savePost()
{
    $Blog = new Blog();
    $xmlNodes = $Blog->getXMLnodes(true);
    if (isset($_POST['post-title'])) {
        foreach ($xmlNodes as $key => $value) {
            if (!isset($_POST["post-" . $key])) {
                $post_value = '';
            } else {
                $post_value = $_POST["post-" . $key];
            }
            $post_data[$key] = $post_value;
        }
        $savePost = $Blog->savePost($post_data);
        $generateRSS = $Blog->generateRSSFeed();
        if ($savePost != false) {
            echo '<div class="updated">' . i18n_r(BLOGFILE . '/POST_ADDED') . '</div>';
        } else {
            echo '<div class="error">' . i18n_r(BLOGFILE . '/POST_ERROR') . '</div>';
        }
    } else {
        echo '<div class="error">' . i18n_r(BLOGFILE . '/BLOG_CREATE_EDIT_NO_TITLE');
        echo ' <a href="javascript:history.go(-1)">' . i18n_r(BLOGFILE . '/BLOG_RETURN_TO_PREVIOUS_PAGE') . '</a>';
        echo '</div>';
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:26,代码来源:adminFunctions.php

示例3: auto_import

/** 
* RSS Feed Auto Importer
* Auto imports RSS feeds. Can be launched by a cron job 
* 
* @return void
*/
function auto_import()
{
    $Blog = new Blog();
    if ($_GET['import'] == urldecode($Blog->getSettingsData("autoimporterpass")) && $Blog->getSettingsData("autoimporter") == 'Y') {
        ini_set("memory_limit", "350M");
        require_once BLOGPLUGINFOLDER . 'inc/magpierss/rss_fetch.inc';
        $rss_feed_file = getXML(BLOGRSSFILE);
        foreach ($rss_feed_file->rssfeed as $the_fed) {
            $rss_uri = $the_fed->feed;
            $rss_category = $the_fed->category;
            $rss = fetch_rss($rss_uri);
            $items = array_slice($rss->items, 0);
            foreach ($items as $item) {
                $post_data['title'] = $item['title'];
                $post_data['slug'] = '';
                $post_data['date'] = $item['pubdate'];
                $post_data['private'] = '';
                $post_data['tags'] = '';
                $post_data['category'] = $rss_category;
                $post_data['content'] = $item['summary'] . '<p class="blog_auto_import_readmore"><a href="' . $item['link'] . '" target="_blank">' . i18n_r(BLOGFILE . '/READ_FULL_ARTICLE') . '</a></p>';
                $post_data['excerpt'] = '';
                $post_data['thumbnail'] = '';
                $post_data['current_slug'] = '';
                $Blog->savePost($post_data, true);
            }
        }
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:34,代码来源:frontEndFunctions.php


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