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


PHP WP_Widget::get_field_name方法代码示例

本文整理汇总了PHP中WP_Widget::get_field_name方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Widget::get_field_name方法的具体用法?PHP WP_Widget::get_field_name怎么用?PHP WP_Widget::get_field_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Widget的用法示例。


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

示例1: widget_form

    /**
     * @param array $settings
     * @param WP_Widget $widget
     */
    public function widget_form($settings, WP_Widget $widget)
    {
        $forms = mc4wp_get_forms();
        ?>
		<p>
			<label for="<?php 
        echo $widget->get_field_id('form_id');
        ?>
"><?php 
        _e('Form:', 'mailchimp-for-wp');
        ?>
</label>
			<select class="widefat" name="<?php 
        echo $widget->get_field_name('form_id');
        ?>
" id="<?php 
        echo $widget->get_field_id('form_id');
        ?>
">
				<option value="0" disabled <?php 
        selected($settings['form_id'], 0);
        ?>
><?php 
        _e('Select the form to show', 'mailchimp-for-wp');
        ?>
</option>
				<?php 
        foreach ($forms as $f) {
            ?>
					<option value="<?php 
            echo esc_attr($f->ID);
            ?>
" <?php 
            selected($settings['form_id'], $f->ID);
            ?>
><?php 
            echo esc_html($f->name);
            ?>
</option>
				<?php 
        }
        ?>
			</select>
		</p>

		<?php 
        if (empty($forms)) {
            ?>
			<p class="help"><?php 
            printf(__('You don\'t have any sign-up forms. <a href="%s">Would you like to create one now?</a>', 'mailchimp-for-wp'), mc4wp_get_add_form_url());
            ?>
</p>
		<?php 
        }
    }
开发者ID:siggisdairy,项目名称:siggis-web,代码行数:59,代码来源:class-widget-enhancements.php

示例2: form

 public function form($instance)
 {
     $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('form_id'), parent::get_field_name('form_id'));
 }
开发者ID:AlexanderBogdan,项目名称:poliplast,代码行数:4,代码来源:CFMControllerWidget.php

示例3:

 /**
  * @see WP_Widget::get_field_name()
  */
 function test_wp_widget_get_field_name()
 {
     $widget = new WP_Widget('foo', 'Foo');
     $widget->_set(2);
     $this->assertEquals('widget-foo[2][title]', $widget->get_field_name('title'));
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:9,代码来源:widgets.php

示例4: form

 public function form($instance)
 {
     $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('type'), parent::get_field_name('type'), parent::get_field_id('show_name'), parent::get_field_name('show_name'), parent::get_field_id('open_option'), parent::get_field_name('open_option'), parent::get_field_id('count'), parent::get_field_name('count'), parent::get_field_id('width'), parent::get_field_name('width'), parent::get_field_id('height'), parent::get_field_name('height'), parent::get_field_id('background_transparent'), parent::get_field_name('background_transparent'), parent::get_field_id('background_color'), parent::get_field_name('background_color'), parent::get_field_id('text_color'), parent::get_field_name('text_color'), parent::get_field_id('theme_id'), parent::get_field_name('theme_id'));
 }
开发者ID:RA2WP,项目名称:RA2WP,代码行数:4,代码来源:BWGControllerWidgetTags.php

示例5: sgwindow_echo_input_textarea

/**
 * Output textarea field
 *
 * @since SG Window 1.0.0
 *
 * @param WP_Widget $object widget object.
 * @param string $name widget option name.
 * @param array $instance Array of widget options.
 * @param string $title Title
*/
function sgwindow_echo_input_textarea($object, $name, $instance, $title, $rows = 10, $cols = 30)
{
    ?>
	<p>
		<label for="<?php 
    echo esc_attr($object->get_field_id($name));
    ?>
"><?php 
    echo esc_html($title);
    ?>
</label>
		<br>
		<textarea name="<?php 
    echo esc_attr($object->get_field_name($name));
    ?>
" rows="<?php 
    echo $rows;
    ?>
" id="<?php 
    echo esc_attr($object->get_field_id($name));
    ?>
"><?php 
    echo esc_textarea($instance[$name]);
    ?>
</textarea>		
	</p>
	<?php 
}
开发者ID:a-i-ko93,项目名称:ipl-foodblog,代码行数:38,代码来源:widget-functions.php

示例6: form

 public function form($instance)
 {
     $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('gallery_id'), parent::get_field_name('gallery_id'), parent::get_field_id('width'), parent::get_field_name('width'), parent::get_field_id('height'), parent::get_field_name('height'), parent::get_field_id('effect'), parent::get_field_name('effect'), parent::get_field_id('interval'), parent::get_field_name('interval'), parent::get_field_id('shuffle'), parent::get_field_name('shuffle'), parent::get_field_id('theme_id'), parent::get_field_name('theme_id'));
 }
开发者ID:marleexoxo,项目名称:FWC,代码行数:4,代码来源:BWGControllerWidgetSlideshow.php

示例7:

 function get_field_name($varname)
 {
     // replace all x[y] by x][y
     $varname = str_replace(']', '', $varname);
     $varname = str_replace('[', '][', $varname);
     return parent::get_field_name($varname);
 }
开发者ID:minorbug,项目名称:wp-author-avatars,代码行数:7,代码来源:AuthorAvatarsWidget.class.php

示例8: form

 public function form($instance)
 {
     $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('type'), parent::get_field_name('type'), parent::get_field_id('show'), parent::get_field_name('show'), parent::get_field_id('gallery_id'), parent::get_field_name('gallery_id'), parent::get_field_id('album_id'), parent::get_field_name('album_id'), parent::get_field_id('count'), parent::get_field_name('count'), parent::get_field_id('width'), parent::get_field_name('width'), parent::get_field_id('height'), parent::get_field_name('height'), parent::get_field_id('theme_id'), parent::get_field_name('theme_id'));
 }
开发者ID:nirav90,项目名称:gharena,代码行数:4,代码来源:BWGControllerWidget.php

示例9: display_fields

    /**
     * Display legacy fields in the widget edit form.
     *
     * @since 4.0.0
     *
     * @param array     $instance The widget instance settings.
     * @param WP_Widget $widget   Widget instance.
     */
    public function display_fields($instance, $widget)
    {
        if (is_simple_image_widget_legacy() || !empty($instance['image'])) {
            ?>
			<div class="simple-image-widget-legacy-fields">
				<?php 
            if (!is_simple_image_widget_legacy()) {
                ?>
					<p>
						<em><?php 
                _e('These fields are here to maintain your data from an earlier version.', 'simple-image-widget');
                ?>
</em>
					</p>
					<p>
						<em><?php 
                _e('Select an image, then clear these values, and they will disappear when you save the widget.', 'simple-image-widget');
                ?>
</em>
					</p>
				<?php 
            }
            ?>

				<p>
					<label for="<?php 
            echo esc_attr($widget->get_field_id('image'));
            ?>
"><?php 
            _e('Image URL:', 'simple-image-widget');
            ?>
</label>
					<input type="text" name="<?php 
            echo esc_attr($widget->get_field_name('image'));
            ?>
" id="<?php 
            echo esc_attr($widget->get_field_id('image'));
            ?>
" value="<?php 
            echo esc_url($instance['image']);
            ?>
" class="widefat">
				</p>
				<p>
					<label for="<?php 
            echo esc_attr($widget->get_field_id('alt'));
            ?>
"><?php 
            _e('Alternate Text:', 'simple-image-widget');
            ?>
</label>
					<input type="text" name="<?php 
            echo esc_attr($widget->get_field_name('alt'));
            ?>
" id="<?php 
            echo esc_attr($widget->get_field_id('alt'));
            ?>
" value="<?php 
            echo esc_attr($instance['alt']);
            ?>
" class="widefat">
				</p>
			</div>
			<?php 
        }
    }
开发者ID:KimcoBlogSC,项目名称:Blog,代码行数:74,代码来源:class-simple-image-widget-legacy.php

示例10: in_widget_form

    /**
     * Add a color setting to all widgets
     *
     * @param \WP_Widget $widget
     * @param null       $return
     * @param array      $instance
     */
    public function in_widget_form(&$widget, &$return, $instance)
    {
        $border_color = isset($instance['border-color']) ? $instance['border-color'] : self::COLOR_DEFAULT;
        ?>
			<p>
				<label for="<?php 
        echo $widget->get_field_id('border-color');
        ?>
">
					<?php 
        _e('Border color (Used in the footer)', 'yoastcom');
        ?>
				</label>
				<select id="<?php 
        echo $widget->get_field_id('border-color');
        ?>
" name="<?php 
        echo $widget->get_field_name('border-color');
        ?>
" class="widefat">
					<option value="<?php 
        echo esc_attr(self::COLOR_PURPLE);
        ?>
"<?php 
        selected(self::COLOR_PURPLE, $border_color);
        ?>
>
						<?php 
        _e('Purple', 'yoastcom');
        ?>
					</option>
					<option value="<?php 
        echo esc_attr(self::COLOR_BLUE);
        ?>
"<?php 
        selected(self::COLOR_BLUE, $border_color);
        ?>
>
						<?php 
        _e('Blue', 'yoastcom');
        ?>
					</option>
					<option value="<?php 
        echo esc_attr(self::COLOR_GREEN);
        ?>
"<?php 
        selected(self::COLOR_GREEN, $border_color);
        ?>
>
						<?php 
        _e('Green', 'yoastcom');
        ?>
					</option>
					<option value="<?php 
        echo esc_attr(self::COLOR_PINK);
        ?>
"<?php 
        selected(self::COLOR_PINK, $border_color);
        ?>
>
						<?php 
        _e('Pink', 'yoastcom');
        ?>
					</option>
					<option value="<?php 
        echo esc_attr(self::COLOR_ORANGE);
        ?>
"<?php 
        selected(self::COLOR_ORANGE, $border_color);
        ?>
>
						<?php 
        _e('Orange', 'yoastcom');
        ?>
					</option>
				</select>
			</p>
		<?php 
        $return = null;
    }
开发者ID:apsolut,项目名称:Yoast-theme-public,代码行数:87,代码来源:class-widget-color-setting.php

示例11:

 /**
  * @see WP_Widget::get_field_name()
  * @dataProvider data_wp_widget_get_field_name
  *
  */
 function test_wp_widget_get_field_name($expected, $value_to_test)
 {
     $widget = new WP_Widget('foo', 'Foo');
     $widget->_set(2);
     $this->assertEquals($expected, $widget->get_field_name($value_to_test));
 }
开发者ID:rclilly,项目名称:wordpress-develop,代码行数:11,代码来源:widgets.php

示例12: form

    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, $this->map_param_default_array);
        //print_r($instance);
        if (!empty($this->map_array['params'])) {
            foreach ($this->map_array['params'] as $param) {
                switch ($param['type']) {
                    case 'textarea_html':
                        //print_r($param);
                        ?>
                        <p>
                            <label for="<?php 
                        echo $this->WP_Widget_this->get_field_id($param['param_name']);
                        ?>
"><?php 
                        echo $param['heading'];
                        ?>
</label>

                            <textarea  class="widefat" name="<?php 
                        echo $this->WP_Widget_this->get_field_name($param['param_name']);
                        ?>
" id="<?php 
                        echo $this->WP_Widget_this->get_field_id($param['param_name']);
                        ?>
" cols="30" rows="10"><?php 
                        echo esc_textarea($instance[$param['param_name']]);
                        ?>
</textarea>


                            <div class="td-wpa-info">
                                <?php 
                        echo $param['description'];
                        ?>
                            </div>

                        </p>
                        <?php 
                        break;
                    case 'textfield':
                        // we have to change custom_title to custom-title to have "-title" at the end. That's what
                        // WordPress uses to put the title of the widget on post @see widgets.js
                        // suggested at: http://forum.tagdiv.com/topic/please-add-block-title-to-backend-widget-title/#post-58087
                        if ($param['param_name'] == 'custom_title') {
                            $field_id = $this->WP_Widget_this->get_field_id('custom-title');
                        } else {
                            $field_id = $this->WP_Widget_this->get_field_id($param['param_name']);
                        }
                        ?>
                        <p>
                            <label for="<?php 
                        echo $this->WP_Widget_this->get_field_id($param['param_name']);
                        ?>
"><?php 
                        echo $param['heading'];
                        ?>
</label>
                            <input class="widefat" id="<?php 
                        echo $field_id;
                        ?>
"
                                   name="<?php 
                        echo $this->WP_Widget_this->get_field_name($param['param_name']);
                        ?>
" type="text"
                                   value="<?php 
                        echo $instance[$param['param_name']];
                        ?>
" />

                            <div class="td-wpa-info">
                                <?php 
                        echo $param['description'];
                        ?>
                            </div>

                        </p>
                        <?php 
                        break;
                    case 'dropdown':
                        ?>
                        <p>
                            <label for="<?php 
                        echo $this->WP_Widget_this->get_field_id($param['param_name']);
                        ?>
"><?php 
                        echo $param['heading'];
                        ?>
</label>
                            <select name="<?php 
                        echo $this->WP_Widget_this->get_field_name($param['param_name']);
                        ?>
" id="<?php 
                        echo $this->WP_Widget_this->get_field_id($param['param_name']);
                        ?>
" class="widefat">
                                <?php 
                        foreach ($param['value'] as $param_name => $param_value) {
                            ?>
//.........这里部分代码省略.........
开发者ID:weerapat,项目名称:wp-daily,代码行数:101,代码来源:td_widget_builder.php

示例13: form

 public function form($instance)
 {
     $this->view->form($instance, parent::get_field_id('title'), parent::get_field_name('title'), parent::get_field_id('feed_id'), parent::get_field_name('feed_id'), parent::get_field_id('img_number'), parent::get_field_name('img_number'), parent::get_field_id('show_likes_comments'), parent::get_field_name('show_likes_comments'), parent::get_field_id('number_of_columns'), parent::get_field_name('number_of_columns'));
 }
开发者ID:julianomoreira,项目名称:euescolhivoce,代码行数:4,代码来源:WDIControllerWidget.php

示例14: form

 /**
  * form function must be expanded by the plugin to display plugin widget info to screen
  *
  * @ignore - WP_Widget::form must be public
  *
  * @since 1.0
  *
  * @param array $instance Required - Data to be displayed on the form
  *
  * @return none
  */
 public function form($instance)
 {
     $widget_fields = get_option($this->options->get_value('widget-fields-option-name'));
     $defaults = new TSP_Easy_Dev_Data($widget_fields);
     if (!empty($instance)) {
         $defaults->set_values($instance);
     } else {
         $defaults->decode_values();
     }
     //endelse
     $fields = $defaults->get_values(true);
     foreach ($fields as $key => $value) {
         // since there are multiple widgets on a page it is important
         // to make sure the id and name are unique to this particular
         // instance of the plugin so add a unique id and name
         // by using the get_field_id and get_field_name from the parent
         // Widget class
         $fields[$key]['id'] = parent::get_field_id($key);
         $fields[$key]['name'] = parent::get_field_name($key);
     }
     //end foreach
     $this->display_form($fields);
 }
开发者ID:sharrondenice,项目名称:tsp-easy-dev,代码行数:34,代码来源:TSP_Easy_Dev_Widget.class.php


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