コード例 #1
0
ファイル: frontEndFunctions.php プロジェクト: Luigi-/gs-blog
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
}
コード例 #2
0
ファイル: blog.php プロジェクト: hatasu/appdroid
/** 
* 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
}