function userProfileImageField($user) { ?> <h3><?php _e("User Image", "YoPress"); ?> </h3> <table class="form-table"> <tr> <th><label for="image"><?php _e("YoPress Image", "YoPress"); ?> </label></th> <td> <?php $imageUrl = esc_attr(get_the_author_meta('image', $user->ID)); if ($imageUrl) { echo "<img src='" . $imageUrl . "' width='50' height='50' /><br/>"; } $uploader = new YoPressUploader(); $uploader->uploadForm(array('name' => 'image', 'id' => 'image', 'value' => esc_attr(get_the_author_meta('image', $user->ID)), 'class' => 'user-upload-image')); ?> </td> </tr> </table> <?php }
public function __construct() { parent::__construct(); if (!self::$instanceId) { self::$instanceId = 1; } else { self::$instanceId++; } $this->id = self::$instanceId; }
private function renderUploader($name, $options, $raw) { $value = $this->model->fieldValue($name, $options['default']); $htmlOptions = $this->makeHtmlOptions($options); $uploader = new YoPressUploader(); if (!$raw) { echo '<tr valign="top"> <th> <label for="' . $options['id'] . '">' . $options['label'] . '</label> </th> <td>'; } $uploader->uploadForm(array('name' => $this->model->fieldName($name), 'value' => $value, 'id' => $options['id'])); if (!$raw) { echo '</td></tr>'; } }