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


PHP get_postdata函数代码示例

本文整理汇总了PHP中get_postdata函数的典型用法代码示例。如果您正苦于以下问题:PHP get_postdata函数的具体用法?PHP get_postdata怎么用?PHP get_postdata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: mt_getpost

function mt_getpost($params)
{
    // ($postid, $user, $pass)
    $xpostid = $params->getParam(0);
    $xuser = $params->getParam(1);
    $xpass = $params->getParam(2);
    $post_ID = $xpostid->scalarval();
    $username = $xuser->scalarval();
    $password = $xpass->scalarval();
    // Check login
    if (user_pass_ok(addslashes($username), $password)) {
        $postdata = get_postdata($post_ID);
        if ($postdata['Date'] != '') {
            // why were we converting to GMT here? spec doesn't call for that.
            //$post_date = mysql2date('U', $postdata['Date']);
            //$post_date = gmdate('Ymd', $post_date).'T'.gmdate('H:i:s', $post_date);
            $post_date = strtotime($postdata['Date']);
            $post_date = date('Ymd', $post_date) . 'T' . date('H:i:s', $post_date);
            $catids = wp_get_post_cats('1', $post_ID);
            logIO('O', 'Category No:' . count($catids));
            foreach ($catids as $catid) {
                $catname = get_cat_name($catid);
                logIO('O', 'Category:' . $catname);
                $catnameenc = new xmlrpcval(mb_conv($catname, 'UTF-8', $GLOBALS['blog_charset']));
                $catlist[] = $catnameenc;
            }
            $post = get_extended($postdata['Content']);
            $allow_comments = 'open' == $postdata['comment_status'] ? 1 : 0;
            $allow_pings = 'open' == $postdata['ping_status'] ? 1 : 0;
            $resp = array('link' => new xmlrpcval(post_permalink($post_ID)), 'title' => new xmlrpcval(mb_conv($postdata['Title'], 'UTF-8', $GLOBALS['blog_charset'])), 'description' => new xmlrpcval(mb_conv($post['main'], 'UTF-8', $GLOBALS['blog_charset'])), 'dateCreated' => new xmlrpcval($post_date, 'dateTime.iso8601'), 'userid' => new xmlrpcval($postdata['Author_ID']), 'postid' => new xmlrpcval($postdata['ID']), 'content' => new xmlrpcval(mb_conv($postdata['Content'], 'UTF-8', $GLOBALS['blog_charset'])), 'permalink' => new xmlrpcval(post_permalink($post_ID)), 'categories' => new xmlrpcval($catlist, 'array'), 'mt_keywords' => new xmlrpcval("{$catids[0]}"), 'mt_excerpt' => new xmlrpcval(mb_conv($postdata['Excerpt'], 'UTF-8', $GLOBALS['blog_charset'])), 'mt_allow_comments' => new xmlrpcval($allow_comments, 'int'), 'mt_allow_pings' => new xmlrpcval($allow_pings, 'int'), 'mt_convert_breaks' => new xmlrpcval('true'), 'mt_text_more' => new xmlrpcval(mb_conv($post['extended'], 'UTF-8', $GLOBALS['blog_charset'])));
            $resp = new xmlrpcval($resp, 'struct');
            return new xmlrpcresp($resp);
        } else {
            return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, "No such post #{$post_ID}");
        }
    } else {
        return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:39,代码来源:xmlrpc.php

示例2: single_post_title

function single_post_title($prefix = '', $display = 1)
{
    global $p;
    if (intval($p)) {
        $post_data = get_postdata($p);
        $title = $post_data['Title'];
        $title = apply_filters('single_post_title', $title);
        if ($display) {
            echo $prefix . strip_tags(stripslashes($title));
        } else {
            return strip_tags(stripslashes($title));
        }
    }
}
开发者ID:ericandrewlewis,项目名称:b2,代码行数:14,代码来源:b2template.functions.php

示例3: kf_get_posts_by_hits

function kf_get_posts_by_hits($period, $limit, $echo = true)
{
    global $wpdb;
    $period = (int) $period > 0 ? $period : 7;
    $limit = (int) $limit > 0 ? $limit : 5;
    $sql = "SELECT wp_users.user_nicename, count(mr.post_ID) as totHits, p.post_content, p.comment_count, p.ID, p.guid, DATE_FORMAT(p.post_date, '%d-%m-%Y') as post_date, p.post_title \n\t\t\t\tfrom {$wpdb->posts} p \n\t\t\t\t\tJOIN {$wpdb->prefix}kf_most_read mr on mr.post_ID = p.ID\n\t\t\t\t\tJOIN wp_users ON p.post_author = wp_users.ID\n\t\t\t\twhere mr.hit_ts >= '" . (time() - 86400 * $period) . "'\n\t\t\t\tGROUP BY mr.post_ID order by totHits desc, ID ASC \n\t\t\t\tLIMIT {$limit}";
    if (KF_MR_DEBUG_MODE) {
        var_dump($sql);
    }
    $posts = $wpdb->get_results($sql);
    if ($echo) {
        if (!empty($posts)) {
            foreach ($posts as $p) {
                $post = get_postdata($p->ID);
                echo '<li><a href="' . get_permalink($post['ID']) . '" title="' . $post['Title'] . '">' . $post['Title'] . '</a></li>' . chr(13);
            }
        }
        return;
    } else {
        return $posts;
    }
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:22,代码来源:kf_most_read.php

示例4: sockxp

function sockxp($host, $path, $prox, $wanted)
{
    $hope = !empty($prox) ? $prox : $host . ':80';
    preg_match("/^(\\S*):([0-9]+){1,5}/", $hope, $hosta);
    $hosh = $hosta[1];
    $hosp = $hosta[2];
    $recv = '';
    $meth = $_SERVER['REQUEST_METHOD'];
    if (empty($hosh) || empty($hosp)) {
        exit(1);
    }
    if (!($sock = fsockopen($hosh, $hosp))) {
        exit(1);
    }
    $dat = $meth . " http://" . $host;
    if ($meth === "POST") {
        $dat .= "/" . str_replace("administration//", "", $wanted);
    } else {
        $dat .= $path . $wanted;
    }
    $dat .= " HTTP/1.1\r\n";
    $dat .= "Host: {$host}\r\n";
    $dat .= "Connection: Close\r\n";
    if ($meth === "POST") {
        $postdata = get_postdata();
        $dat .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $dat .= "Content-Length: " . strlen($postdata) . "\r\n\r\n";
        $dat .= $postdata . "\r\n\r\n";
    } else {
        $dat .= "\r\n";
    }
    fputs($sock, $dat);
    while (!feof($sock)) {
        $recv .= fgets($sock);
    }
    fclose($sock);
    return html_replace($recv);
}
开发者ID:SuperQcheng,项目名称:exploit-database,代码行数:38,代码来源:3016.php

示例5: tdomf_notify_poster_rejected

function tdomf_notify_poster_rejected($post_id)
{
    global $wpdb;
    if (wp_is_post_revision($post_id)) {
        tdomf_log_message_extra("tdomf_notify_poster_rejected: post {$post_id} is a revision -- do nothing.");
        return $post_id;
    }
    $email = get_post_meta($post_id, TDOMF_KEY_NOTIFY_EMAIL, true);
    tdomf_log_message_extra("tdomf_notify_poster_rejected: {$email}");
    delete_post_meta($post_id, TDOMF_KEY_NOTIFY_EMAIL);
    if (get_post_meta($post_id, TDOMF_KEY_SPAM, true)) {
        tdomf_log_message_extra("tdomf_notify_poster_rejected: post {$post_id} is spam -- do nothing.");
        return $post_id;
    }
    if (tdomf_check_email_address($email)) {
        tdomf_log_message("Attempting to send notification email to {$email} for rejected post {$post_id}!");
        $postdata = get_postdata($post_id);
        $title = $postdata['Title'];
        $form_id = get_post_meta($post_id, TDOMF_KEY_FORM_ID, true);
        if ($form_id == false || !tdomf_form_exists($form_id)) {
            $form_id = tdomf_get_first_form_id();
        }
        $subject = tdomf_widget_notify_get_message($form_id, 'rejected_subject', true, $post_id);
        $notify_message = tdomf_widget_notify_get_message($form_id, 'rejected', true, $post_id);
        // Use custom from field
        //
        if (tdomf_get_option_form(TDOMF_OPTION_FROM_EMAIL, $form_id)) {
            // We can modify the "from" field by using the "header" option at the end!
            //
            $headers = "MIME-Version: 1.0\n" . "From: " . tdomf_get_option_form(TDOMF_OPTION_FROM_EMAIL, $form_id) . "\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
            return @wp_mail($email, $subject, $notify_message, $headers);
        } else {
            return @wp_mail($email, $subject, $notify_message);
        }
    }
    return $post_id;
}
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:37,代码来源:tdomf-notify.php

示例6: single_post_title

function single_post_title($prefix = '', $display = true) {
    global $wpdb;
		$p = get_query_var('p');
		$name = get_query_var('name');
    if (intval($p) || '' != $name) {
        if (!$p) {
            $p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'");
        }
        $post_data = get_postdata($p);
        $title = $post_data['Title'];
        $title = apply_filters('single_post_title', $title);
        if ($display) {
            echo $prefix.strip_tags($title);
        } else {
            return strip_tags($title);
        }
    }
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:18,代码来源:template-functions-general.php

示例7: wp_refcheck

     break;
 case 'deletecomment':
     $standalone = 1;
     require_once './admin-header.php';
     wp_refcheck("/wp-admin");
     if ($user_level == 0) {
         die('Cheatin&#8217; uh?');
     }
     $comment = $HTTP_GET_VARS['comment'];
     $p = $HTTP_GET_VARS['p'];
     if (isset($HTTP_GET_VARS['noredir'])) {
         $noredir = true;
     } else {
         $noredir = false;
     }
     $postdata = get_postdata($p) or die('Oops, no post with this ID. <a href="edit.php">Go back</a>!');
     $commentdata = get_commentdata($comment, 1, true) or die('Oops, no comment with this ID. <a href="post.php">Go back</a>!');
     $authordata = get_userdata($postdata['Author_ID']);
     if ($user_level < $authordata->user_level) {
         die('You don&#8217;t have the right to delete <strong>' . $authordata->user_nickname . '</strong>&#8217;s post comments. <a href="post.php">Go back</a>!');
     }
     wp_set_comment_status($comment, "delete");
     if ($_SERVER['HTTP_REFERER'] != "" && false == $noredir) {
         header('Location: ' . $_SERVER['HTTP_REFERER']);
     } else {
         header('Location: ' . $siteurl . '/wp-admin/edit.php?p=' . $p . '&c=1#comments');
     }
     break;
 case 'unapprovecomment':
     $standalone = 1;
     require_once './admin-header.php';
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:post.php

示例8: sleep

     if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
         sleep($sleep_after_edit);
     }
     rss_update($blog_ID);
     //	pingWeblogs($blog_ID);
     $location = "Location: b2edit.php";
     header($location);
     break;
 case "delete":
     $standalone = 1;
     require_once "./b2header.php";
     if ($user_level == 0) {
         die("Cheatin' uh ?");
     }
     $post = $HTTP_GET_VARS['post'];
     $postdata = get_postdata($post) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
     $authordata = get_userdata($postdata["Author_ID"]);
     if ($user_level < $authordata[13]) {
         die("You don't have the right to delete <b>" . $authordata[1] . "</b>'s posts.");
     }
     $query = "DELETE FROM {$tableposts} WHERE ID={$post}";
     $result = mysql_query($query) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
     if (!$result) {
         die("Error in deleting... contact the <a href=\"mailto:{$admin_email}\">webmaster</a>...");
     }
     $query = "DELETE FROM {$tablecomments} WHERE comment_post_ID={$post}";
     $result = mysql_query($query) or die("Oops, no comment associated to that post. <a href=\"b2edit.php\">Go back</a> !");
     if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
         sleep($sleep_after_edit);
     }
     rss_update($blog_ID);
开发者ID:ericandrewlewis,项目名称:b2,代码行数:31,代码来源:b2edit.php

示例9: intval

         }
     }
     if ($comment_num > $start + $CommentPerPage) {
         $echostring .= $ackeychar[9] . '<a href="' . $myurl . '?view=comprev&start=' . ($start + $CommentPerPage) . '&num=' . $num . '&p=' . $p . $ses_param . '" accesskey="9">次の' . $CommentPerPage . '件のコメント &gt;</a><br/>';
     }
     if (0 <= $start - $CommentPerPage) {
         $echostring .= $ackeychar[7] . '<a href="' . $myurl . '?view=comprev&start=' . ($start - $CommentPerPage) . '&num=' . $num . '&p=' . $p . $ses_param . '" accesskey="9">前の' . $CommentPerPage . '件のコメント &gt;</a><br/>';
     }
     $echostring .= '<hr />';
     $echostring .= $ackeychar[0] . '<a href="' . $myurl . '?view=content&num=' . $num . '&p=' . $p . '&start=0' . $ses_param . '" accesskey="0">記事へ戻る</a><br/>';
     break;
 case "comment":
     $num = intval($_REQUEST["num"]);
     $p = intval($_REQUEST["p"]);
     //コメント投稿
     $postdata = get_postdata($p);
     $tmp = substr($postdata['Date'], 5, 2) . '/' . substr($postdata['Date'], 8, 2) . substr($postdata['Date'], 10, 6);
     $echostring .= '<b>' . $postdata['Title'] . '(' . $tmp . ')へのコメント投稿</b>';
     $echostring .= '<hr />';
     if ('open' == $postdata['comment_status']) {
         $echostring .= '<form action="' . $siteurl . '/wp-ktai-comments-post.php" method="post">';
         $echostring .= '名前<br />';
         $echostring .= '<input type="text" name="author" value="" size="40" /><br />';
         $echostring .= 'メールアドレス<br />';
         $echostring .= '<input type="text" name="email" value="" size="40" /><br />';
         $echostring .= 'Webサイトアドレス<br />';
         $echostring .= '<input type="text" name="url" value="" size="40" /><br />';
         $echostring .= 'コメント<br />';
         $echostring .= '<textarea cols="30" rows="4" name="comment"></textarea><br />';
         $echostring .= '<input type="submit" name="submit" value="送信" /><br />';
         $echostring .= '<input type="hidden" name="comment_post_ID" value="' . $postdata['ID'] . '" />';
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:wp-ktai.php

示例10: single_post_title

 function single_post_title($prefix = '', $echo = true)
 {
     $title = '';
     if (!empty($GLOBALS['p']) && intval($GLOBALS['p']) || !empty($GLOBALS['name']) && $GLOBALS['name'] != '') {
         if (empty($GLOBALS['p'])) {
             $criteria = new CriteriaCompo(new Criteria('post_name', $GLOBALS['name']));
             if (!empty($GLOBALS['year'])) {
                 $criteria->add(new Criteria('YEAR(post_date)', $GLOBALS['year']));
             }
             if (!empty($GLOBALS['monthnum'])) {
                 $criteria->add(new Criteria('MONTH(post_date)', $GLOBALS['monthnum']));
             }
             if (!empty($GLOBALS['day'])) {
                 $criteria->add(new Criteria('DAYOFMONTH(post_date)', $GLOBALS['day']));
             }
             $postHandler =& wp_handler('Post');
             $postObjects =& $postHandler->getObjects($criteria);
             $GLOBALS['p'] = $postObjects[0]->getVar('ID');
         }
         $post_data = get_postdata($GLOBALS['p']);
         $title = strip_tags($post_data['Title']);
         if (trim($title) == "") {
             $title = _WP_POST_NOTITLE;
         }
         $title = apply_filters('single_post_title', $title);
     }
     if (!empty($title)) {
         $title = $prefix . $title;
     }
     return _echo($title, $echo);
 }
开发者ID:nobunobuta,项目名称:xoops_mod_WordPress,代码行数:31,代码来源:template-functions-general.php

示例11: get_postdata_num

function get_postdata_num($num)
{
    global $tableposts, $wpdb;
    $post = $wpdb->get_row("SELECT ID " . "FROM {$tableposts} WHERE " . "post_status = 'publish' " . "ORDER BY post_date DESC " . "LIMIT {$num},1");
    return get_postdata($post->ID);
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:6,代码来源:wp-ktai.php

示例12: get_postdata

	break;

case 'deletecomment':

	check_admin_referer();

	$comment = $_GET['comment'];
	$p = $_GET['p'];
	if (isset($_GET['noredir'])) {
		$noredir = true;
	} else {
		$noredir = false;
	}

	$postdata = get_postdata($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
	$commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));

	if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_ID'])) {
		die('You are not allowed to edit comments on this post.');
	}

	wp_set_comment_status($comment, "delete");
	do_action('delete_comment', $comment);

	if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) {
		header('Location: ' . $_SERVER['HTTP_REFERER']);
	} else {
		header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:29,代码来源:post.php

示例13: addslashes

     $comment_author_email = $email;
     $comment_author_url = $url;
     $author = addslashes($author);
     $query = "INSERT INTO {$tablecomments} VALUES ('0','{$comment_post_ID}','{$author}','{$email}','{$url}','{$user_ip}','{$now}','{$comment}','0')";
     $result = mysql_query($query);
     if (!$result) {
         die("There is an error with the database, it can't store your comment...<br>Contact the <a href=\"mailto:{$admin_email}\">webmaster</a>");
     } else {
         if ($comments_notify) {
             $notify_message = "New trackback on your post #{$comment_post_ID}.\r\n\r\n";
             $notify_message .= "website: {$comment_author} (IP: {$user_ip} , {$user_domain})\r\n";
             $notify_message .= "url    : {$comment_author_url}\r\n";
             $notify_message .= "excerpt: \n" . stripslashes($original_comment) . "\r\n\r\n";
             $notify_message .= "You can see all trackbacks on this post there: \r\n";
             $notify_message .= "{$siteurl}/{$blogfilename}?p={$comment_post_ID}&tb=1\r\n\r\n";
             $postdata = get_postdata($comment_post_ID);
             $authordata = get_userdata($postdata["Author_ID"]);
             $recipient = $authordata["user_email"];
             $subject = "trackback on post #{$comment_post_ID} \"" . $postdata["Title"] . "\"";
             @mail($recipient, $subject, $notify_message, "From: b2@" . $HTTP_SERVER_VARS['SERVER_NAME'] . "\r\n" . "X-Mailer: b2 {$b2_version} - PHP/" . phpversion());
         }
         trackback_response(0);
     }
 }
 /* elseif (empty($HTTP_GET_VARS['__mode'])) {
 
 	header('Content-type: application/xml');
 	echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">\n<response>\n<error>1</error>\n";
 	echo "<message>Tell me a lie. \nOr just a __mode or url parameter ?</message>\n";
 	echo "</response>";
 
开发者ID:ericandrewlewis,项目名称:b2,代码行数:30,代码来源:b2trackback.php

示例14: redirect_header

     case 'edit':
         $location = $siteurl . '/wp-admin/edit.php?p=' . $p . '&c=1#comments';
         break;
     case 'edit-comments':
         $location = $siteurl . '/wp-admin/edit-comments.php';
         break;
     case 'moderation':
         $location = $siteurl . '/wp-admin/moderation.php';
         break;
     default:
         $location = $siteurl . '/wp-admin/';
 }
 if (!$xoopsWPTicket->check()) {
     redirect_header($location, 3, $xoopsWPTicket->getErrors());
 }
 if (!($postdata = get_postdata($p))) {
     redirect_header($location, 5, _LANG_P_OOPS_IDCOM);
 }
 if (!($commentdata = get_commentdata($comment, 1, true))) {
     redirect_header($location, 5, _LANG_P_OOPS_IDPOS);
     exit;
 }
 $authordata = get_userdata($postdata['Author_ID']);
 if ($user_level < $authordata->user_level) {
     redirect_header($location, 5, _LANG_P_DATARIGHT_DELETE . ' by <strong>[' . $authordata->user_nickname . ']</strong>');
     exit;
 }
 wp_set_comment_status($comment, "delete");
 do_action('delete_comment', $comment);
 header('Location: ' . $location);
 break;
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:31,代码来源:post.php

示例15: get_embed_post

 public static function get_embed_post()
 {
     global $embed_post, $post, $wp_query;
     if ($embed_post) {
         return $embed_post;
     }
     if (!rgempty("gform_embed_post")) {
         $post_id = absint(rgpost("gform_embed_post"));
         $embed_post = get_postdata($post_id);
     } else {
         if ($wp_query->is_in_loop) {
             $embed_post = $post;
         } else {
             $embed_post = array();
         }
     }
 }
开发者ID:ipman3,项目名称:Mediassociates-wp,代码行数:17,代码来源:common.php


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