本文整理汇总了PHP中trackback_response函数的典型用法代码示例。如果您正苦于以下问题:PHP trackback_response函数的具体用法?PHP trackback_response怎么用?PHP trackback_response使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trackback_response函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtoupper
} else {
if ('auto' == $comment_moderation) {
$approved = 0;
} else {
// none
$approved = 1;
}
}
if ($charset == "") {
$charset = "auto";
} else {
$charset = strtoupper(trim($charset));
}
if (function_exists('mb_convert_encoding')) {
if ($charset == "auto") {
$charset = mb_detect_encoding($commnet . $author, $charset);
}
$comment = mb_convert_encoding($comment, $blog_charset, $charset);
$author = mb_convert_encoding($author, $blog_charset, $charset);
}
$result = $wpdb->query("INSERT INTO {$tablecomments} \n\t(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved)\n\tVALUES \n\t('{$comment_post_ID}', '{$author}', '{$email}', '{$tb_url}', '{$user_ip}', '{$now}', '{$comment}', '{$approved}')\n\t");
if (!$result) {
die("There is an error with the database, it can't store your comment...<br />Please contact the <a href='mailto:{$admin_email}'>webmaster</a>.");
} else {
$comment_ID = $wpdb->get_var('SELECT last_insert_id()');
if ($comments_notify) {
wp_notify_postauthor($comment_ID, 'trackback');
}
trackback_response(0);
}
}
示例2: array
// Trigger event, which may add a message of category "error":
$Plugins->trigger_event('BeforeTrackbackInsert', array('Comment' => &$Comment));
// Display errors:
if ($errstring = $Messages->get_string('Cannot insert trackback, please correct these errors:', '')) {
trackback_response(1, $errstring);
// tblue> Note: the spec at <http://www.sixapart.com/pronet/docs/trackback_spec>
// only shows error code 1 in the example response
// and we also only check for code 1 in TB answers.
}
// Record trackback into DB:
$Comment->dbinsert();
if ($Comment->ID == 0) {
// Exit silently! Wz don't want to give an easy tool to try and pass the filters.
trackback_response(0, 'ok');
}
/*
* ----------------------------
* New trackback notification:
* ----------------------------
*/
// TODO: dh> this should only send published feedback probably and should also use "outbound_notifications_mode"
// asimo> this handles moderators and general users as well and use "outbound_notifications_mode" in case of general users
// Moderators will get emails about every new trackback
// Subscribed user will only get emails about new published trackback
$Comment->handle_notifications(true);
// Trigger event: a Plugin should cleanup any temporary data here..
// fp>> WARNING: won't be called if trackback gets deleted by antispam
$Plugins->trigger_event('AfterTrackbackInsert', array('Comment' => &$Comment));
// fp>TODO: warn about moderation
trackback_response(0, 'ok');
示例3: trackback_response
if (empty($id) || empty($tb_title) || empty($tb_excerpt) || empty($tb_url) || empty($tb_blog_name)) {
trackback_response(1, 'At least one of the required fields is missing.');
}
include 'inc/plugins.php';
$xfclass = new XFieldsData();
$disabled = $xfclass->fetch($id, 'tbs_disabled');
if ($disabled == "yes") {
trackback_response(1, "Trackbacks have been disabled for this post");
}
$time = time();
$data = array('title' => $tb_title, 'excerpt' => $tb_excerpt, 'url' => $tb_url, 'blog_name' => $tb_blog_name, 'host' => $host);
$old_data = $xfclass->fetch($id, 'trackbacks');
$old_data[$time] = $data;
$xfclass->set($old_data, $id, 'trackbacks');
$xfclass->save();
trackback_response();
function trackback_response($error = 0, $error_message = '')
{
if ($error) {
echo '<?xml version="1.0" encoding="iso-8859-1"?' . ">\n";
echo "<response>\n";
echo "<error>1</error>\n";
echo "<message>{$error_message}</message>\n";
echo "</response>";
} else {
echo '<?xml version="1.0" encoding="iso-8859-1"?' . ">\n";
echo "<response>\n";
echo "<error>0</error>\n";
echo "</response>";
}
die;
示例4: trackback_response
$q = "insert into " . T_COMMENTS . "\n\t\t\tset \n\t\t\tpostid='{$tbpost}',\n\t\t\tparentid='{$replyto}',\n\t\t\tposttime='{$now}',\n\t\t\tpostername='{$blog_name}',\n\t\t\tposteremail='',\n\t\t\tposterwebsite='{$tb_url}',\n\t\t\tposternotify='0',\n\t\t\tpubemail='0',\n\t\t\tpubwebsite='1',\n\t\t\tip='{$remaddr}',\n\t\t\ttitle='{$title}',\n\t\t\tcommenttext='{$excerpt}',\n\t\t\ttype='trackback'";
$bBlog->_adb->Execute($q);
$insid = $bBlog->insert_id;
if ($insid < 1) {
trackback_response(1, "Error adding trackback : " . mysql_error());
} else {
// notify owner
include_once BBLOGROOT . 'inc/mail.php';
notify_owner("New trackback on your blog", "{$blog_name} ( {$tb_url} ) has sent a trackback to your post at " . $bBlog->_get_entry_permalink($tbpost) . "\n");
// update the commentcount.
// now I thought about having a seperate count for trackbacks and comments ( like b2 )
// , but trackbacks are really comments, so I decided against this.
$newnumcomments = $bBlog->get_var("SELECT count(*) as c FROM " . T_COMMENTS . " WHERE postid='{$tbpost}' and deleted='false' group by postid");
$bBlog->_adb->Execute("update " . T_POSTS . " set commentcount='{$newnumcomments}' where postid='{$tbpost}'");
$bBlog->modifiednow();
trackback_response(0, "");
}
}
// Send a trackback-ping.
function send_trackback($url, $title = "", $excerpt = "", $t)
{
//parse the target-url
$target = parse_url($t);
if ($target["query"] != "") {
$target["query"] = "?" . $target["query"];
}
//set the port
if (!is_numeric($target["port"])) {
$target["port"] = 80;
}
//connect to the remote-host
示例5: trackback_response
if ($error) {
echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
echo "<response>\n";
echo "<error>1</error>\n";
echo "<message>{$error_message}</message>\n";
echo "</response>";
die;
} else {
echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
echo "<response>\n";
echo "<error>0</error>\n";
echo "</response>";
}
}
$tb_url = $_POST['url'];
if (empty($_POST['title'])) {
$title = $_POST['url'];
} else {
$title = $_POST['title'];
}
$excerpt = $_POST['excerpt'];
if (!empty($tb_url)) {
$result = Content::add_trackbacks($_GET['cid'], $tb_url, $title, $excerpt);
if ($result == FALSE) {
trackback_response(1, 'We already have a ping from that URI for this post.');
} else {
trackback_response(0);
}
} else {
trackback_response(1, 'Url required');
}
示例6: send_response
/**
* Send response header with http status code and reason.
*
*/
public function send_response($hook, $code)
{
$code = (int) apply_filters(self::PLUGIN_SLUG . "-{$hook}-status", (int) $code);
$mesg = (string) apply_filters(self::PLUGIN_SLUG . "-{$hook}-reason", get_status_header_desc($code));
nocache_headers();
// nocache and response code
switch ((int) substr("{$code}", 0, 1)) {
case 2:
// 2xx Success
header('Refresh: 0; url=' . home_url(), TRUE, $code);
// @since 3.0
exit;
case 3:
// 3xx Redirection
wp_redirect('http://blackhole.webpagetest.org/', $code);
exit;
default:
// 4xx Client Error, 5xx Server Error
status_header($code);
// @since 2.0.0
if (function_exists('trackback_response')) {
trackback_response($code, $mesg);
} elseif (!defined('DOING_AJAX') && !defined('XMLRPC_REQUEST')) {
FALSE !== @(include STYLESHEETPATH . "/{$code}.php") or FALSE !== @(include TEMPLATEPATH . "/{$code}.php") or wp_die($mesg, '', array('response' => $code, 'back_link' => TRUE));
}
exit;
}
}