zeroise

Definition:
function zeroise($number, $threshold) {}

Add leading zeros when necessary.
If you set the threshold to ‘4’ and the number is ’10’, then you will get back ‘0010’. If you set the threshold to ‘4’ and the number is ‘5000’, then you will get back ‘5000’.

Parameters

  • mixed $number: Number to append zeros to if not greater than threshold.
  • int $threshold: Digit places number needs to be to not have zeros added.

Return values

returns:Adds leading zeros to number if needed.

Source code

function zeroise($number, $threshold) {

	return sprintf('%0'.$threshold.'s', $number);

}

4289

xmlrpc_removepostdata

Definition:
function xmlrpc_removepostdata( $content ) {}

XMLRPC XML content without title and category elements.

Parameters

  • string $content: XMLRPC XML Request content

Return values

returns:XMLRPC XML Request content without title and category elements.

Source code

function xmlrpc_removepostdata( $content ) {

	$content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );

	$content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );

	$content = trim( $content );

	return $content;

}

4287

xmlrpc_getposttitle

Definition:
function xmlrpc_getposttitle( $content ) {}

Retrieve post title from XMLRPC XML.
If the title element is not part of the XML, then the default post title from the $post_default_title will be used instead.

Parameters

  • string $content: XMLRPC XML Request content

Return values

returns:Post title

Source code

function xmlrpc_getposttitle( $content ) {

	global $post_default_title;

	if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {

		$post_title = $matchtitle[1];

	} else {

		$post_title = $post_default_title;

	}

	return $post_title;

}

4285

xmlrpc_getpostcategory

Definition:
function xmlrpc_getpostcategory( $content ) {}

Retrieve the post category or categories from XMLRPC XML.
If the category element is not found, then the default post category will be used. The return type then would be what $post_default_category. If the category is found, then it will always be an array.

Parameters

  • string $content: XMLRPC XML Request content

Return values

returns:List of categories or category name.

Source code

function xmlrpc_getpostcategory( $content ) {

	global $post_default_category;

	if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {

		$post_category = trim( $matchcat[1], ',' );

		$post_category = explode( ',', $post_category );

	} else {

		$post_category = $post_default_category;

	}

	return $post_category;

}

4283

xfn_check

Definition:
function xfn_check( $class, $value = '', $deprecated = '' ) {}

Display checked checkboxes attribute for xfn microformat options.

Parameters

  • string $class
  • string $value
  • mixed $deprecated: Never used.

Source code

function xfn_check( $class, $value = '', $deprecated = '' ) {

	global $link;



	if ( !empty( $deprecated ) )

		_deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented



	$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';

	$rels = preg_split('/\s+/', $link_rel);



	if ('' != $value && in_array($value, $rels) ) {

		echo ' checked="checked"';

	}



	if ('' == $value) {

		if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';

		if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';

		if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';

		if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';

	}

}

4281