当前位置: 首页>>代码示例>>PHP>>正文


PHP image_size_input_fields函数代码示例

本文整理汇总了PHP中image_size_input_fields函数的典型用法代码示例。如果您正苦于以下问题:PHP image_size_input_fields函数的具体用法?PHP image_size_input_fields怎么用?PHP image_size_input_fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了image_size_input_fields函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pixlr_link_input_fields

function pixlr_link_input_fields($form_fields, $post, $url_type = '')
{
    if (substr($post->post_mime_type, 0, 5) == 'image') {
        $pixlr_link = wp_get_attachment_url($post->ID);
        $pixlr_file = get_attachment_link($post->ID);
        $url = '';
        if ($url_type == 'file') {
            $url = $pixlr_link;
        } elseif ($url_type == 'post') {
            $url = $pixlr_file;
        }
        $form_fields = array('post_title' => array('label' => __('Title'), 'value' => $edit_post->post_title), 'post_excerpt' => array('label' => __('Caption'), 'value' => $edit_post->post_excerpt), 'post_content' => array('label' => __('Description'), 'value' => $edit_post->post_content, 'input' => 'textarea'), 'url' => array('label' => __('Your Links are Now Pixlr'), 'input' => 'html', 'html' => "\n\t\t\t\t\t<input type='text' class='urlfield'  name='attachments[{$post->ID}][url]' value='" . esc_attr($url) . "' /><br />\n\t\t\t\t\t\t\t<button type='button' class='button urlnone' title=''>" . __('None') . "</button>\n<!--\t\t\t\t\t\t\t<button type='button' class='button urlfile' title='" . esc_attr($pixlr_file) . "'>" . __('Post URL') . "</button> -->\n\t\t\t\t\t\t\t<button type='button' class='button urlpost' title='" . esc_attr($pixlr_link) . "'>" . __('File URL') . "</button>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t", 'helps' => __('Enter a link URL or click above for presets.')), 'menu_order' => array('label' => __('Order'), 'value' => $edit_post->menu_order), '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'));
    }
    return $form_fields;
}
开发者ID:brettu,项目名称:wp_vandalism_plugin,代码行数:16,代码来源:wp_vandalism_plugin.php

示例2: get_attachment_fields_to_edit

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.5.0
 *
 * @param object $post
 * @param array $errors
 * @return array
 */
function get_attachment_fields_to_edit($post, $errors = null)
{
    if (is_int($post)) {
        $post = get_post($post);
    }
    if (is_array($post)) {
        $post = new WP_Post((object) $post);
    }
    $image_url = wp_get_attachment_url($post->ID);
    $edit_post = sanitize_post($post, 'edit');
    $form_fields = array('post_title' => array('label' => __('Title'), 'value' => $edit_post->post_title), 'image_alt' => array(), 'post_excerpt' => array('label' => __('Caption'), 'input' => 'html', 'html' => wp_caption_input_textarea($edit_post)), 'post_content' => array('label' => __('Description'), 'value' => $edit_post->post_content, 'input' => 'textarea'), 'url' => array('label' => __('Link URL'), 'input' => 'html', 'html' => image_link_input_fields($post, get_option('image_default_link_type')), 'helps' => __('Enter a link URL or click above for presets.')), 'menu_order' => array('label' => __('Order'), 'value' => $edit_post->menu_order), 'image_url' => array('label' => __('File URL'), 'input' => 'html', 'html' => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[{$post->ID}][url]' value='" . esc_attr($image_url) . "' /><br />", 'value' => wp_get_attachment_url($post->ID), 'helps' => __('Location of the uploaded file.')));
    foreach (get_attachment_taxonomies($post) as $taxonomy) {
        $t = (array) get_taxonomy($taxonomy);
        if (!$t['public'] || !$t['show_ui']) {
            continue;
        }
        if (empty($t['label'])) {
            $t['label'] = $taxonomy;
        }
        if (empty($t['args'])) {
            $t['args'] = array();
        }
        $terms = get_object_term_cache($post->ID, $taxonomy);
        if (false === $terms) {
            $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
        }
        $values = array();
        foreach ($terms as $term) {
            $values[] = $term->slug;
        }
        $t['value'] = join(', ', $values);
        $form_fields[$taxonomy] = $t;
    }
    // Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
    // The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
    $form_fields = array_merge_recursive($form_fields, (array) $errors);
    // This was formerly in image_attachment_fields_to_edit().
    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' => __('Alternative Text'), 'helps' => __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;'));
        $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']);
    }
    /**
     * Filter the attachment fields to edit.
     *
     * @since 2.5.0
     *
     * @param array   $form_fields An array of attachment form fields.
     * @param WP_Post $post        The WP_Post attachment object.
     */
    $form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
    return $form_fields;
}
开发者ID:HaraShun,项目名称:WordPress,代码行数:69,代码来源:media.php

示例3: image_attachment_fields_to_edit

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $form_fields
 * @param unknown_type $post
 * @return unknown
 */
function image_attachment_fields_to_edit($form_fields, $post)
{
    if (substr($post->post_mime_type, 0, 5) == 'image') {
        $form_fields['post_title']['required'] = true;
        $file = wp_get_attachment_url($post->ID);
        $form_fields['image_url']['value'] = $file;
        $form_fields['post_excerpt']['label'] = __('Caption');
        $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
        $form_fields['post_content']['label'] = __('Description');
        $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'));
    }
    return $form_fields;
}
开发者ID:Alenjandro,项目名称:data-my-share,代码行数:23,代码来源:media.php

示例4: image_attachment_fields_to_edit

/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $form_fields
 * @param unknown_type $post
 * @return unknown
 */
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. &#8220;The Mona Lisa&#8221;')
		);

		$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;
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:36,代码来源:media.php

示例5: rli_set_default_image_size

function rli_set_default_image_size($form_fields, $post)
{
    $referer = strpos(wp_get_referer(), 'rli_slide_select_settings');
    if ($referer != '') {
        $form_fields['image-size'] = image_size_input_fields($post, 'full');
        // called in wp-admin/includes/media.php
    }
    return $form_fields;
}
开发者ID:rocketlift,项目名称:rli-slideshow,代码行数:9,代码来源:rli-slideshow.php

示例6: rv_image_attachment_fields_to_edit

function rv_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['attachment_link'] = array('input' => 'html', 'html' => "<input type='text' class='text attachment_link' readonly='readonly' name='attachment_link' value='" . esc_attr($post->ID) . "' /><br />", 'label' => __('Attachment ID'), 'helps' => __('Attachment ID for upload reference'));
        $form_fields['image_alt'] = array('value' => $alt, 'label' => __('Alternate text'), 'helps' => __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;'));
        $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;
}
开发者ID:roelven,项目名称:handigekasten,代码行数:17,代码来源:functions.php


注:本文中的image_size_input_fields函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。