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>'; } } } }
function blog_display_posts() { global $content, $blogSettings, $data_index; // Declare GLOBAL variables $Blog = new Blog(); // Create a new instance of the Blog class $slug = base64_encode(return_page_slug()); // Determine the page we are on. $blogSettings = $Blog->getSettingsData(); // Get the blog's settings $blog_slug = base64_encode($blogSettings["blogurl"]); // What page should the blog show on? if ($slug == $blog_slug) { // If we are on the page that should be showing the blog... $content = ''; // Legacy support ob_start(); // Create a buffer to load everything into switch (true) { // Ok, so what are we going to do? case isset($_GET['post']) == true: // Display a post $post_file = BLOGPOSTSFOLDER . $_GET['post'] . '.xml'; // Get the post's XML file show_blog_post($post_file); // Show the post break; case isset($_POST['search_blog']) == true: // Search the blog search_posts($_POST['keyphrase']); // Search the blog with the given keyphrase break; case isset($_GET['archive']) == true: // View the archives $archive = $_GET['archive']; // @TODO: Redundant? Revision required... show_blog_archive($archive); // Show the requested archive break; case isset($_GET['tag']) == true: // Show specific post by tag $tag = $_GET['tag']; // @TODO: Redundant? Revision required... show_blog_tag($tag); // Show all posts that have the given tag break; case isset($_GET['category']) == true: // Show a category of posts $category = $_GET['category']; // @TODO: Redundant? Revision required... show_blog_category($category); // Show posts from the requested category break; case isset($_GET['import']): // RSS Auto-Importer auto_import(); // Let the RSS Auto-Importer do its thing break; default: // None of the above? show_all_blog_posts(); // Lets just show all the posts then break; } $content = ob_get_contents(); // Legacy support ob_end_clean(); // Output the buffer to the user. } return $content; // legacy support for non filter hook calls to this function }
/** * Include RSS Feed (Link goes is included in header of front end pages) * * @return void */ function includeRssFeed() { global $SITEURL; $locationOfFeed = $SITEURL . "rss.rss"; $blog = new Blog(); $blogTitle = htmlspecialchars($blog->getSettingsData("rsstitle")); echo '<link href="' . $locationOfFeed . '" rel="alternate" type="application/rss+xml" title="' . $blogTitle . '">'; }
function show_settings_admin() { # Init function global $SITEURL; // Declare required GLOBALS $Blog = new Blog(); // Bring in the Blog class # Build the array of setting to save to the blog_settings.xml file if (isset($_POST['blog_settings'])) { // The user has submitted an update. $blog_settings_array = array('blogurl' => !empty($_POST['blog_url']) ? $_POST['blog_url'] : $Blog->getSettingsData("blogurl"), 'template' => !empty($_POST['template']) ? $_POST['template'] : $Blog->getSettingsData("template"), 'excerptlength' => !empty($_POST['excerpt_length']) ? $_POST['excerpt_length'] : $Blog->getSettingsData("excerptlength"), 'postformat' => !empty($_POST['show_excerpt']) ? $_POST['show_excerpt'] : $Blog->getSettingsData("postformat"), 'postperpage' => !empty($_POST['posts_per_page']) ? $_POST['posts_per_page'] : $Blog->getSettingsData("postperpage"), 'recentposts' => !empty($_POST['recent_posts']) ? $_POST['recent_posts'] : $Blog->getSettingsData("recentposts"), 'prettyurls' => !empty($_POST['pretty_urls']) ? $_POST['pretty_urls'] : $Blog->getSettingsData("prettyurls"), 'autoimporter' => !empty($_POST['auto_importer']) ? $_POST['auto_importer'] : $Blog->getSettingsData("autoimporter"), 'autoimporterpass' => !empty($_POST['auto_importer_pass']) ? $_POST['auto_importer_pass'] : $Blog->getSettingsData("autoimporterpass"), 'rsstitle' => !empty($_POST['rss_title']) ? $_POST['rss_title'] : $Blog->getSettingsData("rsstitle"), 'rssinclude' => !empty($_POST['rss_include']) ? $_POST['rss_include'] : $Blog->getSettingsData("rssinclude"), 'rssdescription' => !empty($_POST['rss_description']) ? $_POST['rss_description'] : $Blog->getSettingsData("rssdescription"), 'rssfeedposts' => !empty($_POST['rss_feed_num_posts']) ? $_POST['rss_feed_num_posts'] : $Blog->getSettingsData("rssfeedposts"), 'archivepostcount' => !empty($_POST['display_archives_post_count']) ? $_POST['display_archives_post_count'] : $Blog->getSettingsData("archivespostcount")); # Attempt to save the settings array to file. if ($Blog->saveSettings($blog_settings_array)) { // Success: Notify the user. echo '<script>clearNotify();notifyOk(\'' . i18n_r(BLOGFILE . '/SETTINGS_SAVE_OK') . '\').popit().removeit();</script>'; } else { // Failed: Notify the user. echo '<script>clearNotify();notifyError(\'' . i18n_r(BLOGFILE . '/SETTINGS_SAVE_ERROR') . '\').popit().removeit();</script>'; } } # Include the HTML for the settings page we are trying to display. if ($_GET['settings'] == 'rss') { // RSS Auto-Importer settings require_once 'html/settings-rss.php'; } else { // The default main settings page require_once 'html/settings-main.php'; } }
function includeRssFeed() { global $SITEURL; // Declare GLOBAL variables $locationOfFeed = $SITEURL . "rss.rss"; // Define location of the RSS file. $blog = new Blog(); // Create instance of the BLOG class $blogTitle = htmlspecialchars($blog->getSettingsData("rsstitle")); // Get the RSS feed title echo '<link href="' . $locationOfFeed . '" rel="alternate" type="application/rss+xml" title="' . $blogTitle . '">'; // Echo out the <link> }
/** * Display Feed Burner Tool * * @return void */ function feedBurnerTool() { $Blog = new Blog(); ?> <a href="<?php echo $Blog->getSettingsData("feedburnerlink"); ?> " title="Subscribe to my feed" rel="alternate" type="application/rss+xml"><img src="http://www.feedburner.com/fb/images/pub/feed-icon32x32.png" alt="" style="border:0"/></a><a href="<?php echo $Blog->getSettingsData("feedburnerlink"); ?> " title="Subscribe to my feed" rel="alternate" type="application/rss+xml">Subscribe in a reader</a> <?php }
/** * Conditionals to display posts/search/archive/tags/category/importer on front end of website * * @return void */ function blog_display_posts() { global $content, $blogSettings; $Blog = new Blog(); $slug = base64_encode(return_page_slug()); $blogSettings = $Blog->getSettingsData(); $blog_slug = base64_encode($blogSettings["blogurl"]); if ($slug == $blog_slug) { $content = ''; ob_start(); if ($blogSettings["displaycss"] == 'Y') { echo "<style>\n"; echo $blogSettings["csscode"]; echo "\n</style>"; } switch (true) { case isset($_GET['post']) == true: $post_file = BLOGPOSTSFOLDER . $_GET['post'] . '.xml'; show_blog_post($post_file); break; case isset($_POST['search_blog']) == true: search_posts($_POST['keyphrase']); break; case isset($_GET['archive']) == true: $archive = $_GET['archive']; show_blog_archive($archive); break; case isset($_GET['tag']) == true: $tag = $_GET['tag']; show_blog_tag($tag); break; case isset($_GET['category']) == true: $category = $_GET['category']; show_blog_category($category); break; case isset($_GET['import']): auto_import(); break; default: show_all_blog_posts(); break; } $content = ob_get_contents(); ob_end_clean(); } return $content; // legacy support for non filter hook calls to this function }
/** * Display Plugin Help * * @return void */ function show_help_admin() { global $SITEURL; $Blog = new Blog(); ?> <h3> <?php i18n(BLOGFILE . '/PLUGIN_TITLE'); ?> <?php i18n(BLOGFILE . '/HELP'); ?> </h3> <h2 style="font-size:16px;"><?php i18n(BLOGFILE . '/FRONT_END_FUNCTIONS'); ?> </h2> <p> <label><?php i18n(BLOGFILE . '/HELP_CATEGORIES'); i18n(BLOGFILE . '/RSS_LOCATION'); ?> :</label> <?php highlight_string('<?php show_blog_categories(); ?>'); ?> </p> <p> <label><?php i18n(BLOGFILE . '/HELP_SEARCH'); ?> :</label> <?php highlight_string('<?php show_blog_search(); ?>'); ?> </p> <p> <label><?php i18n(BLOGFILE . '/HELP_ARCHIVES'); ?> :</label> <?php highlight_string('<?php show_blog_archives(); ?>'); ?> </p> <p> <label><?php i18n(BLOGFILE . '/HELP_RECENT'); ?> :</label> <?php highlight_string('<?php show_blog_recent_posts(); ?>'); ?> <br/><br/> <?php i18n(BLOGFILE . '/HELP_RECENT_2'); ?> : <br/> <?php highlight_string('<?php ($excerpt=false, $excerpt_length=null, $thumbnail=null, $read_more=null) ?>'); ?> <br/> <?php i18n(BLOGFILE . '/HELP_RECENT_3'); ?> :<br/> <?php highlight_string('<?php show_blog_recent_posts(true, null, true, true); ?>'); ?> <br/> </p> <p> <label><?php i18n(BLOGFILE . '/RSS_LOCATION'); ?> :</label> <a href="<?php echo $SITEURL . "rss.rss"; ?> " target="_blank"><?php echo $SITEURL . "rss.rss"; ?> </a> </p> <p> <label><?php i18n(BLOGFILE . '/DYNAMIC_RSS_LOCATION'); ?> :</label> <a href="<?php echo $SITEURL . "plugins/blog/rss.php"; ?> " target="_blank"><?php echo $SITEURL . "plugins/blog/rss.php"; ?> </a> </p> <h3><?php i18n(BLOGFILE . '/AUTO_IMPORTER_TITLE'); ?> </h3> <p> <?php i18n(BLOGFILE . '/AUTO_IMPORTER_DESC'); ?> <br/> <strong>lynx -dump <?php echo $SITEURL; ?> index.php?id=<?php echo $Blog->getSettingsData("blogurl"); ?> &import=<?php echo $Blog->getSettingsData("autoimporterpass"); ?> > /dev/null</strong> </p> <?php blog_page_help_html(); }