本文整理汇总了PHP中get_to_ping函数的典型用法代码示例。如果您正苦于以下问题:PHP get_to_ping函数的具体用法?PHP get_to_ping怎么用?PHP get_to_ping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_to_ping函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_returns_to_ping_sites_from_post_object
public function test_returns_to_ping_sites_from_post_object()
{
$post_id = self::factory()->post->create(array('to_ping' => 'http://www.example.com
http://www.otherexample.com'));
$post = get_post($post_id);
$this->assertSame(array('http://www.example.com', 'http://www.otherexample.com'), get_to_ping($post));
}
示例2: do_trackbacks
function do_trackbacks($post_id) {
global $wpdb;
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $post_id");
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
if ( empty($to_ping) ) {
$wpdb->query("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = '$post_id'");
return;
}
if (empty($post->post_excerpt))
$excerpt = apply_filters('the_content', $post->post_content);
else
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
$excerpt = str_replace(']]>', ']]>', $excerpt);
$excerpt = strip_tags($excerpt);
if ( function_exists('mb_strcut') ) // For international trackbacks
$excerpt = mb_strcut($excerpt, 0, 252, get_settings('blog_charset')) . '...';
else
$excerpt = substr($excerpt, 0, 252) . '...';
$post_title = apply_filters('the_title', $post->post_title);
$post_title = strip_tags($post_title);
if ($to_ping) : foreach ($to_ping as $tb_ping) :
$tb_ping = trim($tb_ping);
if ( !in_array($tb_ping, $pinged) ) {
trackback($tb_ping, $post_title, $excerpt, $post_id);
$pinged[] = $tb_ping;
} else {
$wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'");
}
endforeach; endif;
}
示例3: do_trackbacks
/**
* Perform trackbacks.
*
* @since 1.5.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $post_id Post ID to do trackbacks on.
*/
function do_trackbacks($post_id)
{
global $wpdb;
$post = get_post($post_id);
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
if (empty($to_ping)) {
$wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id));
return;
}
if (empty($post->post_excerpt)) {
/** This filter is documented in wp-includes/post-template.php */
$excerpt = apply_filters('the_content', $post->post_content, $post->ID);
} else {
/** This filter is documented in wp-includes/post-template.php */
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
}
$excerpt = str_replace(']]>', ']]>', $excerpt);
$excerpt = wp_html_excerpt($excerpt, 252, '…');
/** This filter is documented in wp-includes/post-template.php */
$post_title = apply_filters('the_title', $post->post_title, $post->ID);
$post_title = strip_tags($post_title);
if ($to_ping) {
foreach ((array) $to_ping as $tb_ping) {
$tb_ping = trim($tb_ping);
if (!in_array($tb_ping, $pinged)) {
trackback($tb_ping, $post_title, $excerpt, $post_id);
$pinged[] = $tb_ping;
} else {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $tb_ping, $post_id));
}
}
}
}
示例4: do_trackbacks
/**
* Perform trackbacks.
*
* @since 1.5.0
* @uses $wpdb
*
* @param int $post_id Post ID to do trackbacks on.
*/
function do_trackbacks($post_id)
{
global $wpdb;
$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->posts} WHERE ID = %d", $post_id));
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
if (empty($to_ping)) {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = '' WHERE ID = %d", $post_id));
return;
}
if (empty($post->post_excerpt)) {
$excerpt = apply_filters('the_content', $post->post_content);
} else {
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
}
$excerpt = str_replace(']]>', ']]>', $excerpt);
$excerpt = wp_html_excerpt($excerpt, 252) . '...';
$post_title = apply_filters('the_title', $post->post_title);
$post_title = strip_tags($post_title);
if ($to_ping) {
foreach ((array) $to_ping as $tb_ping) {
$tb_ping = trim($tb_ping);
if (!in_array($tb_ping, $pinged)) {
trackback($tb_ping, $post_title, $excerpt, $post_id);
$pinged[] = $tb_ping;
} else {
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, '{$tb_ping}', '')) WHERE ID = %d", $post_id));
}
}
}
}
示例5: do_trackbacks
function do_trackbacks($post_id)
{
global $wpdb;
$post = $wpdb->get_row("SELECT * FROM {$wpdb->posts} WHERE ID = {$post_id}");
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
if (empty($to_ping)) {
$wpdb->query("UPDATE {$wpdb->posts} SET to_ping = '' WHERE ID = '{$post_id}'");
return;
}
if (empty($post->post_excerpt)) {
$excerpt = apply_filters('the_content', $post->post_content);
} else {
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
}
$excerpt = str_replace(']]>', ']]>', $excerpt);
$excerpt = strip_tags($excerpt);
if (function_exists('mb_strcut')) {
// For international trackbacks
$excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...';
} else {
$excerpt = substr($excerpt, 0, 252) . '...';
}
$post_title = apply_filters('the_title', $post->post_title);
$post_title = strip_tags($post_title);
if ($to_ping) {
foreach ((array) $to_ping as $tb_ping) {
$tb_ping = trim($tb_ping);
if (!in_array($tb_ping, $pinged)) {
trackback($tb_ping, $post_title, $excerpt, $post_id);
$pinged[] = $tb_ping;
} else {
$wpdb->query("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, '{$tb_ping}', '')) WHERE ID = '{$post_id}'");
}
}
}
}
示例6: do_trackbacks
function do_trackbacks($post_id)
{
global $wpdb;
$post = $wpdb->get_row("SELECT * FROM {$wpdb->posts} WHERE ID = {$post_id}");
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
if (empty($to_ping)) {
return;
}
if (empty($post->post_excerpt)) {
$excerpt = apply_filters('the_content', $post->post_content);
} else {
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
}
$excerpt = str_replace(']]>', ']]>', $excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 252) . '...';
$post_title = apply_filters('the_title', $post->post_title);
$post_title = strip_tags($post_title);
if ($to_ping) {
foreach ($to_ping as $tb_ping) {
$tb_ping = trim($tb_ping);
if (!in_array($tb_ping, $pinged)) {
trackback($tb_ping, $post_title, $excerpt, $post_id);
}
}
}
}
示例7: do_trackbacks
function do_trackbacks($post_id) {
global $wpdb;
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $post_id");
$to_ping = get_to_ping($post_id);
$pinged = get_pung($post_id);
if (empty($post->post_excerpt))
$excerpt = apply_filters('the_content', $post->post_content);
else
$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
$excerpt = str_replace(']]>', ']]>', $excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, 252) . '...';
$post_title = apply_filters('the_title', $post->post_title);
$post_title = strip_tags($post_title);
if ($to_ping) : foreach ($to_ping as $tb_ping) :
$tb_ping = trim($tb_ping);
if ( !in_array($tb_ping, $pinged) )
trackback($tb_ping, $post_title, $excerpt, $post_id);
endforeach; endif;
}