pings_open

Definition:
function pings_open( $post_id = NULL ) {}

Whether the current post is open for pings.

Parameters

  • int $post_id: An optional post ID to check instead of the current post.

Return values

returns:True if pings are accepted

Defined filters

  • pings_open
    apply_filters( 'pings_open', $open, $post_id )

Source code

function pings_open( $post_id = NULL ) {



	$_post = get_post($post_id);



	$open = ( 'open' == $_post->ping_status );

	return apply_filters( 'pings_open', $open, $post_id );

}

2509

pingback

Definition:
function pingback($content, $post_ID) {}

Pings back the links found in a post.

Parameters

  • string $content: Post content to check for links.
  • int $post_ID: Post ID.

Defined filters

  • pingback_useragent
    apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom)

Defined actions

  • pre_ping
    do_action_ref_array('pre_ping', array(&$post_links, &$pung));

Source code

function pingback($content, $post_ID) {

	global $wp_version;

	include_once(ABSPATH . WPINC . '/class-IXR.php');

	include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php');



	// original code by Mort (http://mort.mine.nu:8080)

	$post_links = array();



	$pung = get_pung($post_ID);



	// Variables

	$ltrs = '\w';

	$gunk = '/#~:.?+=&%@!\-';

	$punc = '.:?\-';

	$any = $ltrs . $gunk . $punc;



	// Step 1

	// Parsing the post, external links (if any) are stored in the $post_links array

	// This regexp comes straight from phpfreaks.com

	// http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php

	preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp);



	// Step 2.

	// Walking thru the links array

	// first we get rid of links pointing to sites, not to specific files

	// Example:

	// http://dummy-weblog.org

	// http://dummy-weblog.org/

	// http://dummy-weblog.org/post.php

	// We don't wanna ping first and second types, even if they have a valid <link/>



	foreach ( (array) $post_links_temp[0] as $link_test ) :

		if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself

				&& !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.

			if ( $test = @parse_url($link_test) ) {

				if ( isset($test['query']) )

					$post_links[] = $link_test;

				elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) )

					$post_links[] = $link_test;

			}

		endif;

	endforeach;



	do_action_ref_array('pre_ping', array(&$post_links, &$pung));



	foreach ( (array) $post_links as $pagelinkedto ) {

		$pingback_server_url = discover_pingback_server_uri( $pagelinkedto );



		if ( $pingback_server_url ) {

			@ set_time_limit( 60 );

			 // Now, the RPC call

			$pagelinkedfrom = get_permalink($post_ID);



			// using a timeout of 3 seconds should be enough to cover slow servers

			$client = new WP_HTTP_IXR_Client($pingback_server_url);

			$client->timeout = 3;

			$client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom);

			// when set to true, this outputs debug messages by itself

			$client->debug = false;



			if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) // Already registered

				add_ping( $post_ID, $pagelinkedto );

		}

	}

}

2507

permalink_single_rss

Definition:
function permalink_single_rss($deprecated = '') {}

Print the permalink to the RSS feed.

Parameters

  • string $deprecated

Source code

function permalink_single_rss($deprecated = '') {

	_deprecated_function( __FUNCTION__, '2.3', 'the_permalink_rss()' );

	the_permalink_rss();

}

2505

permalink_link

Definition:
function permalink_link() {}

Print the permalink of the current post in the loop.

Source code

function permalink_link() {

	_deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' );

	the_permalink();

}

2503

permalink_anchor

Definition:
function permalink_anchor($mode = 'id') {}

Display permalink anchor for current post.
The permalink mode title will use the post title for the ‘a’ element ‘id’ attribute. The id mode uses ‘post-‘ with the post ID for the ‘id’ attribute.

Parameters

  • string $mode: Permalink mode can be either ‘title’, ‘id’, or default, which is ‘id’.

Source code

function permalink_anchor($mode = 'id') {

	global $post;

	switch ( strtolower($mode) ) {

		case 'title':

			$title = sanitize_title($post->post_title) . '-' . $post->ID;

			echo '<a id="'.$title.'"></a>';

			break;

		case 'id':

		default:

			echo '<a id="post-' . $post->ID . '"></a>';

			break;

	}

}

2501