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


PHP Blog::listPosts方法代码示例

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


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

示例1: show_posts_admin

/** 
* Shows blog posts in admin panel
* 
* @return void
*/
function show_posts_admin()
{
    $Blog = new Blog();
    $all_posts = $Blog->listPosts(true, true);
    if ($all_posts == false) {
        echo '<strong>' . i18n_r(BLOGFILE . '/NO_POSTS') . '. <a href="load.php?id=blog&create_post">' . i18n_r(BLOGFILE . '/CLICK_TO_CREATE') . '</a>';
    } else {
        ?>
		<table class="edittable highlight paginate">
			<tr>
				<th><?php 
        i18n(BLOGFILE . '/PAGE_TITLE');
        ?>
</th>
				<th style="text-align:right;" ><?php 
        i18n(BLOGFILE . '/DATE');
        ?>
</th>
				<th></th>
			</tr>
		<?php 
        foreach ($all_posts as $post_name) {
            $post = $Blog->getPostData($post_name['filename']);
            ?>
				<tr>
					<td class="blog_post_title"><a title="Edit Page: Agents" href="load.php?id=blog&edit_post=<?php 
            echo $post->slug;
            ?>
" ><?php 
            echo $post->title;
            ?>
</a></td>
					<td style="text-align:right;"><span><?php 
            echo $post->date;
            ?>
</span></td>
					<td class="delete" ><a class="delconfirm" href="load.php?id=blog&delete_post=<?php 
            echo $post->slug;
            ?>
" title="Delete Post: <?php 
            echo $post->title;
            ?>
" >X</a></td>
				</tr>
			<?php 
        }
        echo '</table>';
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:54,代码来源:adminFunctions.php

示例2: show_posts_page

function show_posts_page($index = 0)
{
    global $blogSettings;
    // Declare GLOBAL variables
    $Blog = new Blog();
    // Create a new instance of the Blog class
    $posts = $Blog->listPosts(true, true);
    // Get the list of posts.
    if (!empty($posts)) {
        // If we have posts to display...
        $pages = array_chunk($posts, intval($blogSettings["postperpage"]), TRUE);
        // Split posts onto multiple pages
        if (is_numeric($index) && $index >= 0 && $index < sizeof($pages)) {
            // What page should we show?
            $posts = $pages[$index];
            // Show specified page number
        } else {
            // Page index not given or 0
            $posts = array();
            // Show first page
        }
        $count = 0;
        // Create a counter for X
        $lastPostOfPage = false;
        // We're not on the last post of the page yet
        foreach ($posts as $file) {
            // For each post on the page...
            $count++;
            // Increment the counter
            show_blog_post($file['filename'], true);
            // Show the blog post
            if ($count == sizeof($posts) && sizeof($posts) > 0) {
                // Is this the last post on the page?
                $lastPostOfPage = true;
                // Yes, it is.
            }
            if (sizeof($pages) > 1) {
                // If there is more than one page...
                $maxPageIndex = sizeof($pages) - 1;
                // Total number of pages
                show_blog_navigation($index, $maxPageIndex, $count, $lastPostOfPage);
                // Show the pagination
                if ($count == $blogSettings["postperpage"]) {
                    // If we are on the last post,
                    $count = 0;
                    // Reset the counter for the next page
                }
            }
        }
    } else {
        // We have no posts to display. Let the user know.
        echo '<p>' . i18n(BLOGFILE . '/NO_POSTS') . '</p>';
    }
}
开发者ID:Luigi-,项目名称:gs-blog,代码行数:54,代码来源:frontEndFunctions.php

示例3: fetchURL

        }
    }
    // fetch JSON and return it
    private function fetchURL($url)
    {
        $oCurl = curl_init();
        curl_setopt($oCurl, CURLOPT_URL, $url);
        curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($oCurl, CURLOPT_HEADER, 0);
        $json = curl_exec($oCurl);
        curl_close($oCurl);
        return $json;
    }
    // list posts (pageToken reflects the page you want; null = first page, otherwise some token)
    public function listPosts($blogID = null, $pageToken = null)
    {
        $localURL = $this->createURL($blogID, $pageToken);
        $localReturn = $this->fetchURL($localURL);
        return $localReturn;
    }
}
if (!isset($_REQUEST['pageToken'])) {
    $_REQUEST['pageToken'] = '';
}
if (!isset($_REQUEST['blogID'])) {
    $_REQUEST['blogID'] = '';
}
$oBlog = new Blog();
echo $oBlog->listPosts($_REQUEST['blogID'], $_REQUEST['pageToken']);
开发者ID:jiggy1com,项目名称:cbs-interactive,代码行数:30,代码来源:blog.php

示例4: blog_admin_controller

function blog_admin_controller()
{
    $Blog = new Blog();
    getBlogUserPermissions();
    global $blogUserPermissions, $SITEURL;
    if (!isset($_GET['update'])) {
        $update = blog_version_check();
        if ($update[0] == 'current') {
            $ucolor = '#308000';
        } elseif ($update[0] == 'update') {
            $ucolor = '#FFA500';
        } elseif ($update[0] == 'beta') {
            $ucolor = '#2B5CB3';
        } else {
            $ucolor = '#D94136';
        }
    } else {
        $ucolor = '#777777';
    }
    if (isset($_GET['edit_post']) && $blogUserPermissions['blogeditpost'] == true) {
        editPost($_GET['edit_post']);
    } elseif (isset($_GET['create_post']) && $blogUserPermissions['blogcreatepost'] == true) {
        editPost();
    } elseif (isset($_GET['categories']) && $blogUserPermissions['blogcategories'] == true) {
        if (isset($_GET['edit_category'])) {
            $add_category = $Blog->saveCategory($_POST['new_category']);
            if ($add_category == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/CATEGORY_ADDED') . '</div>';
            } else {
                echo '<div class="error">' . i18n_r(BLOGFILE . '/CATEGORY_ERROR') . '</div>';
            }
        }
        if (isset($_GET['delete_category'])) {
            $Blog->deleteCategory($_GET['delete_category']);
        }
        #edit_categories
        $category_file = getXML(BLOGCATEGORYFILE);
        require_once 'html/category-management.php';
    } elseif (isset($_GET['auto_importer']) && $blogUserPermissions['blogrssimporter'] == true) {
        if (isset($_POST['post-rss'])) {
            $post_data = array();
            $post_data['name'] = $_POST['post-rss'];
            $post_data['category'] = $_POST['post-category'];
            $add_feed = $Blog->saveRSS($post_data);
            if ($add_feed == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/FEED_ADDED') . '</div>';
            } else {
                echo '<div class="error">' . i18n_r(BLOGFILE . '/FEED_ERROR') . '</div>';
            }
        } elseif (isset($_GET['delete_rss'])) {
            $delete_feed = $Blog->deleteRSS($_GET['delete_rss']);
            if ($delete_feed == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/FEED_DELETED') . '</div>';
            } else {
                echo '<div class="error">' . i18n_r(BLOGFILE . '/FEED_DELETE_ERROR') . '</div>';
            }
        }
        #edit_rss
        $rss_file = getXML(BLOGRSSFILE);
        require_once 'html/feed-management.php';
    } elseif (isset($_GET['settings']) && $blogUserPermissions['blogsettings'] == true) {
        show_settings_admin();
    } elseif (isset($_GET['update']) && $blogUserPermissions['blogsettings'] == true) {
        show_update_admin();
    } elseif (isset($_GET['help']) && $blogUserPermissions['bloghelp'] == true) {
        require_once 'html/help-admin.php';
    } elseif (isset($_GET['custom_fields']) && $blogUserPermissions['blogcustomfields'] == true) {
        $CustomFields = new customFields();
        if (isset($_POST['save_custom_fields'])) {
            $saveCustomFields = $CustomFields->saveCustomFields();
            if ($saveCustomFields) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/EDIT_OK') . '</div>';
            }
        }
        show_custom_fields();
    } else {
        if (isset($_GET['save_post'])) {
            savePost();
        } elseif (isset($_GET['delete_post']) && $blogUserPermissions['blogdeletepost'] == true) {
            $post_id = urldecode($_GET['delete_post']);
            $delete_post = $Blog->deletePost($post_id);
            if ($delete_post == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/POST_DELETED') . '</div>';
            } else {
                echo '<div class="error">' . i18n(BLOGFILE . '/FEED_DELETE_ERROR') . '</div>';
            }
        }
        #show_posts_admin
        $all_posts = $Blog->listPosts(true, true);
        // Get a list of all the posts in the blog
        require_once 'html/posts-admin.php';
        // Bring in the HTML to show this section
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:94,代码来源:adminFunctions.php

示例5: show_posts_page

function show_posts_page($index = 0)
{
    global $blogSettings;
    $Blog = new Blog();
    $posts = $Blog->listPosts(true, true);
    if ($blogSettings["allpostsadtop"] == 'Y') {
        ?>
		<div class="blog_all_posts_ad">
			<?php 
        echo $blogSettings["addata"];
        ?>
		</div>
		<?php 
    }
    if (!empty($posts)) {
        $pages = array_chunk($posts, intval($blogSettings["postperpage"]), TRUE);
        if (is_numeric($index) && $index >= 0 && $index < sizeof($pages)) {
            $posts = $pages[$index];
        } else {
            $posts = array();
        }
        $count = 0;
        $lastPostOfPage = false;
        foreach ($posts as $file) {
            $count++;
            show_blog_post($file['filename'], true);
            if ($count == sizeof($posts) && sizeof($posts) > 0) {
                $lastPostOfPage = true;
            }
            if (sizeof($pages) > 1) {
                // We know here that we have more than one page.
                $maxPageIndex = sizeof($pages) - 1;
                show_blog_navigation($index, $maxPageIndex, $count, $lastPostOfPage);
                if ($count == $blogSettings["postperpage"]) {
                    $count = 0;
                }
            }
        }
    } else {
        echo '<p>' . i18n(BLOGFILE . '/NO_POSTS') . '</p>';
    }
    if ($blogSettings["allpostsadbottom"] == 'Y') {
        ?>
		<div class="blog_all_posts_ad">
			<?php 
        echo $blogSettings["addata"];
        ?>
		</div>
		<?php 
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:51,代码来源:frontEndFunctions.php


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