本文整理汇总了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>';
}
}
}
}
示例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>';
}
}
示例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);
}
}
}
}