本文整理汇总了PHP中getPosts函数的典型用法代码示例。如果您正苦于以下问题:PHP getPosts函数的具体用法?PHP getPosts怎么用?PHP getPosts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPosts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mc_allpost
function mc_allpost($param = array(), $order = 'post_date DESC', $group = '', $limit = '')
{
$CI =& get_instance();
$CI->load->helper('posts_helper');
$data = getPosts($param, $order, $group, $limit);
return $data;
}
示例2: getBlogPost
function getBlogPost($id)
{
include 'storage.php';
$posts = getPosts();
$output = '<h2>' . $posts[$id]['title'] . '</h2>' . $posts[$id]['body'];
return $output;
}
示例3: getBlogPostsList
function getBlogPostsList()
{
$posts = getPosts();
$output = '';
foreach ($posts as $post) {
$title = $post['title'];
$body = $post['body'];
$output .= "<li><h3>{$title}</h3>{$body}</li>";
}
return $output;
}
示例4: getBlogPostsList
function getBlogPostsList()
{
$posts = getPosts();
$output = '';
foreach ($posts as $key => $post) {
$title = $post['title'];
$body = $post['body'];
$href = "/blog/blog.php?post_id={$key}";
$output .= "<li><h3><a href='{$href}'>{$title}</a></h3>{$body}</li>";
}
return $output;
}
示例5: GetPosts
function GetPosts()
{
$messageFileCount = 0;
$rows = getPosts($this->SystemId);
$posts = array();
foreach ($rows as $row) {
array_push($posts, new Post($row));
if (++$messageFileCount >= DATA_ITEM_LOADS && $posts[count($posts) - 1]->Receiver == $posts[count($posts) - 1]->ReceiverOriginal) {
break;
}
}
return $posts;
}
示例6: GetPosts
function GetPosts()
{
$messageFileCount = 0;
$rows = getPosts($this->SystemId);
$posts = array();
foreach ($rows as $row) {
array_push($posts, new Post($row));
if (++$messageFileCount >= DATA_ITEM_LOADS) {
break;
}
}
return $posts;
}
示例7: confirmDelete
function confirmDelete($db, $url)
{
$p = getPosts($db, '', $url);
return <<<FORM
<form action="/post-hub-php/admin.php" method="post">
<fieldset>
<legend>Are You Sure?</legend>
<p>Are you sure you want to delete the post "{$p['title']}"?</p>
<input type="submit" name="submit" value="Yes" class="btn btn-default" />
<input type="submit" name="submit" value="No" class="btn btn-default" />
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="url" value="{$url}" />
</fieldset>
</form>
FORM;
}
示例8: getPosts
echo "display:none;";
}
?>
">
<?php
echo $settings;
?>
</div><!--
--></div>
</div><!--
--></div><!--
-->
<div class="posts">
<div id="posts-box">
<?php
echo getPosts($link, "SELECT * FROM `posts` WHERE `author`='" . $profile['username'] . "' AND `group`='0' AND `comment`='0' ORDER BY `id` DESC LIMIT 20", false, $user['username']);
?>
</div>
<div id="info-box" style="display:none;">
<h3><?php
echo $subscriptions;
?>
</h3>
<?php
$friends = explode(",", $profile['friends']);
foreach ($friends as $friend) {
if ($friend != "" && $friend != null) {
echo "<a href=\"u-{$friend}\"><img class=\"avatar\" src=\"" . getUserInfo($link, $friend)['avatar'] . "\" alt=\"{$friend}\" title=\"{$friend}\" /></a>";
}
}
?>
示例9: array
if (isset($_GET['logout']) || empty($_SESSION['login'])) {
$_SESSION = array();
session_destroy();
unset($_SESSION);
$user = NULL;
$callLogin = true;
}
/*
Posting a new message.
*/
if (isset($_POST['msg']) && Tools::isLogged()) {
$attachment = new Attachment(Tools::getURL($_POST['msg']));
// Trying to get information about an eventual url in text
$database->newMessage($user->getid(), $_POST['msg'], $attachment->getUrl());
// saving new message
$posts2 = getPosts($database, $user, $offset, $itemsPerPage);
// getting his posts
$posts = $posts2[0];
$numArticles = $posts2[1];
}
/*
Rendering the template with its variables
*/
if ($callLogin) {
Tools::callTwig('login.twig', array());
} else {
if (Tools::isLogged()) {
Tools::callTwig('index.twig', array('connected' => Tools::isLogged(), 'user' => $user, 'posts' => $posts, 'newsession' => $newsession, 'page' => $page, 'pagecount' => (int) ceil($numArticles / $itemsPerPage)));
}
}
/*
示例10: removePost
} else {
if ($decoded->function == 'removePost') {
removePost($decoded->post_id);
} else {
if ($decoded->function == 'removeTema') {
removeTema($decoded->tema_id);
}
}
}
}
}
}
} else {
$function = $_GET["function"];
if ($function == 'getPosts') {
getPosts();
} elseif ($function == 'getTemas') {
getTemas($_GET["todos"]);
}
}
/////// INSERT ////////
/**
* @description Crea un post, su relación con uno o varios temas y sus fotos
* @param $post
*/
function createPost($post)
{
validateRol(1);
$db = new MysqliDb();
$db->startTransaction();
$item_decoded = checkPosts(json_decode($post));
示例11: getPosts
</div>
</div>
</div>
<?php
}
?>
<div class="section-a">
<div class="grid">
<div class="row">
<div class="col-wd-12">
<div class="col">
<div id="postsbody">
<h1>Posts</h1>
<?php
// Call to a function that retrieves the user posts
$results = getPosts($_GET['id']);
foreach ($results as $attrs) {
echo "<p class='dateadded'> Date & Time Of Post: " . $attrs["P_Date"] . "</p>";
echo "<p class='content'>" . $attrs["P_Body"] . "</p>";
echo "<a id='" . $attrs["P_ID"] . "'>Like Post</a>";
echo "<hr>";
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
示例12: mysqli_connect
<?php
include '../incl/creds.php';
include '../incl/functions.php';
$link = mysqli_connect($sql_host, $sql_user, $sql_pass, $sql_db);
$post = mysqli_escape_string($link, $_POST['post']);
?>
<form action="post.php" method="POST">
<textarea name="post" id="postHere" style="border: 2px dashed #000000;"></textarea><br>
<input type="text" name="touser" value="" style="display:none;"/>
<input type="text" name="group" value="<?php
echo $tmp_group;
?>
" style="display:none;"/>
<input type="text" name="response" value="<?php
echo $post;
?>
" style="display:none;"/>
<input type="submit" id="submitHere" value="->" style="font-weight:bold;background-color:transparent;border:1px solid #000000;"/>
</form>
<?php
echo getPosts($link, "SELECT * FROM `posts` WHERE `comment`='{$post}' ORDER BY id ASC", true, $_POST['user']);
示例13: array
<label>
<input type="radio" name="frontpagepage" id="showpages" <?php
echo $fpPage;
?>
>
Halaman
</label>
</div>
<div id="pagescombo" <?php
echo $pageDisplay;
?>
>
<select name="pagefont" class="form-control">
<?php
$sPost = array('post_type' => 'page', 'post_status' => 'publish');
$post = getPosts($sPost, 'post_title ASC');
if ($post['jumlah'] > 0) {
foreach ($post['data'] as $rPost) {
?>
<option value="<?php
echo $rPost->post_id;
?>
"><?php
echo $rPost->post_title;
?>
</option>
<?php
}
}
?>
</select>
示例14: var_dump
var_dump($accessToken->getValue());
// The OAuth 2.0 client handler helps us manage access tokens
$oAuth2Client = $fb->getOAuth2Client();
// Get the access token metadata from /debug_token
$tokenMetadata = $oAuth2Client->debugToken($accessToken);
echo '<h3>Metadata</h3>';
var_dump($tokenMetadata);
// Validation (these will throw FacebookSDKException's when they fail)
$tokenMetadata->validateAppId(APP_ID);
// If you know the user ID this access token belongs to, you can validate it here
//$tokenMetadata->validateUserId('123');
$tokenMetadata->validateExpiration();
if (!$accessToken->isLongLived()) {
// Exchanges a short-lived access token for a long-lived one
try {
$accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
} catch (Facebook\Exceptions\FacebookSDKException $e) {
echo "<p>Error getting long-lived access token: " . $helper->getMessage() . "</p>\n\n";
exit;
}
echo '<h3>Long-lived</h3>';
var_dump($accessToken->getValue());
}
// Logged in!
$_SESSION['fb_access_token'] = (string) $accessToken;
// Sets the default fallback access token so we don't have to pass it to each request
$fb->setDefaultAccessToken((string) $accessToken);
getPosts($fb);
// User is logged in with a long-lived access token.
// You can redirect them to a members-only page.
//header(REDIRECT_MEMBERS_URL);
示例15: displayFastEdit
function displayFastEdit()
{
if ($_REQUEST['action'] == 'update') {
$posts = getPosts($_REQUEST['categories'], $_REQUEST['s'], $num);
$ids = array();
$content = trim(stripslashes($_REQUEST['content']));
$content_stripped = strip_tags($_POST['content']);
$updated = 0;
foreach ($posts as $post) {
$post_content = trim($post->post_content);
if (!$_REQUEST['location']) {
//at the start
//check if it is existent
$match = isMatchAtStart($post_content, $content, $newContent);
if (!$match && $_POST['actionType'] == 'insert') {
$post_content = $content . '<br /><br />' . $post_content;
$updated++;
} else {
if ($match && $_REQUEST['actionType'] == 'delete') {
$post_content = preg_replace('/<br *?\\/?><br *\\/?>(<\\/body><\\/html>)?$/i', '$1', $newContent);
$updated++;
} else {
$skipped++;
}
}
} else {
//at the end
//check if it is existent
$match = isMatch($post_content, $content, $newContent);
if (!$match && $_POST['actionType'] == 'insert') {
$post_content = $post_content . '<br /><br />' . $content;
$updated++;
} else {
if ($match && $_REQUEST['actionType'] == 'delete') {
$post_content = preg_replace('/<br *?\\/?><br *\\/?>(<\\/body><\\/html>)?$/i', '$1', $newContent);
$updated++;
} else {
$skipped++;
}
}
}
wp_update_post(array('ID' => $post->ID, 'post_content' => $post_content));
}
if ($_POST['actionType'] == 'insert') {
$message = 'Updated ' . $updated . ' posts';
if ($skipped > 0) {
$message .= ' and skipped ' . $skipped . ' posts because they have the text already';
}
} else {
$message = 'Updated ' . $updated . ' posts';
if ($skipped > 0) {
$message .= ' and skipped ' . $skipped . ' posts because they do not have the text';
}
}
$messages[] = $message . '.';
}
?>
<style>
#poststuff .inside {
margin: 0;
padding: 0;
}
</style>
<script>
jQuery(document).ready(function() {
jQuery('#post-search-keyword, #categories').change(function() {
jQuery.ajax({
url:ajaxurl,
data:{
action:'getResultNumber',
keyword:jQuery('#post-search-keyword').val(),
category:jQuery('#categories').val(),
},
success: function(data) {
jQuery('#postsCountBox').text('Matches: '+data+' posts');
}
});
});
});
</script>
<div class="wrap">
<form id="posts-filter" action="" method="post">
<input type="hidden" name="action" value="update" />
<h2><?php
echo __('Fast Edit Plugin');
?>
</h2>
<?php
if (!empty($messages)) {
echo '<div id="message" class="updated"><p>' . join(' ', $messages) . '</p></div>';
}
unset($messages);
?>
<div id="poststuff">
<div id="post-body" class="columns-2">
<?php
$args = array('show_option_all' => 'All Categories', 'show_option_none' => '', 'orderby' => 'ID', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => $_POST['category'], 'hierarchical' => 1, 'name' => 'categories', 'id' => 'categories', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'category', 'hide_if_empty' => false, 'walker' => '');
//.........这里部分代码省略.........