image_attachment_fields_to_edit

Definition:
function image_attachment_fields_to_edit($form_fields, $post) {}

Parameters

  • unknown_type $form_fields
  • unknown_type $post

Source code

function image_attachment_fields_to_edit($form_fields, $post) {

	if ( substr($post->post_mime_type, 0, 5) == 'image' ) {

		$alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true);

		if ( empty($alt) )

			$alt = '';



		$form_fields['post_title']['required'] = true;



		$form_fields['image_alt'] = array(

			'value' => $alt,

			'label' => __('Alternate Text'),

			'helps' => __('Alt text for the image, e.g. “The Mona Lisa”')

		);



		$form_fields['align'] = array(

			'label' => __('Alignment'),

			'input' => 'html',

			'html'  => image_align_input_fields($post, get_option('image_default_align')),

		);



		$form_fields['image-size'] = image_size_input_fields( $post, get_option('image_default_size', 'medium') );



	} else {

		unset( $form_fields['image_alt'] );

	}

	return $form_fields;

}

1979

image_align_input_fields

Definition:
function image_align_input_fields( $post, $checked = '' ) {}

Retrieve HTML for the image alignment radio buttons with the specified one checked.

Parameters

  • unknown_type $post
  • unknown_type $checked

Source code

function image_align_input_fields( $post, $checked = '' ) {



	if ( empty($checked) )

		$checked = get_user_setting('align', 'none');



	$alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right'));

	if ( !array_key_exists( (string) $checked, $alignments ) )

		$checked = 'none';



	$out = array();

	foreach ( $alignments as $name => $label ) {

		$name = esc_attr($name);

		$out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".

1977

image_add_caption

Definition:
function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {}

Parameters

  • unknown_type $html
  • unknown_type $id
  • unknown_type $alt
  • unknown_type $title
  • unknown_type $align
  • unknown_type $url
  • unknown_type $size
  • $caption

Defined filters

  • disable_captions
    apply_filters( 'disable_captions', '' )
  • image_add_caption_shortcode
    apply_filters( 'image_add_caption_shortcode', $shcode, $html )

Source code

function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {



	if ( empty($caption) || apply_filters( 'disable_captions', '' ) )

		return $html;



	$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';



	if ( ! preg_match( '/width="([0-9]+)/', $html, $matches ) )

		return $html;



	$width = $matches[1];



	$caption = str_replace(	array( '>',    '<',    '"',      "'" ),

							array( '&gt;', '&lt;', '&quot;', ''' ),

							$caption

						  );



	$html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );

	if ( empty($align) )

		$align = 'none';



	$shcode = '' . $html . '';



	return apply_filters( 'image_add_caption_shortcode', $shcode, $html );

}

1975

iis7_supports_permalinks

Definition:
function iis7_supports_permalinks() {}

Check if IIS 7 supports pretty permalinks

Defined filters

  • iis7_supports_permalinks
    apply_filters('iis7_supports_permalinks', $supports_permalinks)

Source code

function iis7_supports_permalinks() {

	global $is_iis7;



	$supports_permalinks = false;

	if ( $is_iis7 ) {

		/* First we check if the DOMDocument class exists. If it does not exist,

		 * which is the case for PHP 4.X, then we cannot easily update the xml configuration file,

		 * hence we just bail out and tell user that pretty permalinks cannot be used.

		 * This is not a big issue because PHP 4.X is going to be depricated and for IIS it

		 * is recommended to use PHP 5.X NTS.

		 * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When

		 * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.

		 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs

		 * via ISAPI then pretty permalinks will not work.

		 */

		$supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );

	}



	return apply_filters('iis7_supports_permalinks', $supports_permalinks);

}

1973

iis7_save_url_rewrite_rules

Definition:
function iis7_save_url_rewrite_rules(){

Updates the IIS web.config file with the current rules if it is writable.
If the permalinks do not require rewrite rules then the rules are deleted from the web.config file.

Return values

returns:True if web.config was updated successfully

Source code

function iis7_save_url_rewrite_rules(){

	if ( is_multisite() )

		return;



	global $wp_rewrite;



	$home_path = get_home_path();

	$web_config_file = $home_path . 'web.config';



	// Using win_is_writable() instead of is_writable() because of a bug in Windows PHP

	if ( iis7_supports_permalinks() && ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) ) {

		$rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', '');

		if ( ! empty($rule) ) {

			return iis7_add_rewrite_rule($web_config_file, $rule);

		} else {

			return iis7_delete_rewrite_rule($web_config_file);

		}

	}

	return false;

}

1971