Code cleanup

This commit is contained in:
Scott Walkinshaw
2011-07-31 16:44:13 -06:00
parent 1014ddb0f7
commit 35d3c15d39
5 changed files with 77 additions and 74 deletions

View File

@@ -9,16 +9,14 @@ class roots_vcard extends WP_Widget {
function widget($args, $instance) {
extract($args);
$title = $instance['title'];
$street_address = $instance['street_address'];
$locality = $instance['locality'];
$region = $instance['region'];
$postal_code = $instance['postal_code'];
$tel = $instance['tel'];
$email = $instance['email'];
?>
<?php echo $before_widget; ?>
<?php if ($title) echo $before_title, $title, $after_title; ?>
extract($instance);
echo $before_widget;
if ($title) {
echo $before_title, $title, $after_title;
}
?>
<p class="vcard">
<a class="fn org url" href="<?php echo home_url('/'); ?>"><?php bloginfo('name'); ?></a><br>
<span class="adr">
@@ -31,9 +29,8 @@ class roots_vcard extends WP_Widget {
<a class="email" href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a>
</p>
<?php echo $after_widget; ?>
<?php echo $after_widget;
<?php
}
function update($new_instance, $old_instance) {
@@ -41,41 +38,34 @@ class roots_vcard extends WP_Widget {
}
function form($instance) {
if (isset($instance['title'])) { $title = esc_attr($instance['title']); } else { $title = ''; }
if (isset($instance['street_address'])) { $street_address = esc_attr($instance['street_address']); } else { $street_address = ''; }
if (isset($instance['locality'])) { $locality = esc_attr($instance['locality']); } else { $locality = ''; }
if (isset($instance['region'])) { $region = esc_attr($instance['region']); } else { $region = ''; }
if (isset($instance['postal_code'])) { $postal_code = esc_attr($instance['postal_code']); } else { $postal_code = ''; }
if (isset($instance['tel'])) { $tel = esc_attr($instance['tel']); } else { $tel = ''; }
if (isset($instance['email'])) { $email = esc_attr($instance['email']); } else { $email = ''; }
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (optional):', 'roots'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" />
<input type="text" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('street_address'); ?>"><?php _e('Street Address:', 'roots'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('street_address'); ?>" value="<?php echo $street_address; ?>" class="widefat" id="<?php echo $this->get_field_id('street_address'); ?>" />
<input type="text" name="<?php echo $this->get_field_name('street_address'); ?>" value="<?php echo esc_attr($instance['street_address']); ?>" class="widefat" id="<?php echo $this->get_field_id('street_address'); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('locality'); ?>"><?php _e('City/Locality:', 'roots'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('locality'); ?>" value="<?php echo $locality; ?>" class="widefat" id="<?php echo $this->get_field_id('locality'); ?>" />
<input type="text" name="<?php echo $this->get_field_name('locality'); ?>" value="<?php echo esc_attr($instance['locality']); ?>" class="widefat" id="<?php echo $this->get_field_id('locality'); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('region'); ?>"><?php _e('State/Region:', 'roots'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('region'); ?>" value="<?php echo $region; ?>" class="widefat" id="<?php echo $this->get_field_id('region'); ?>" />
<input type="text" name="<?php echo $this->get_field_name('region'); ?>" value="<?php echo esc_attr($instance['region']); ?>" class="widefat" id="<?php echo $this->get_field_id('region'); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('postal_code'); ?>"><?php _e('Zipcode/Postal Code:', 'roots'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('postal_code'); ?>" value="<?php echo $postal_code; ?>" class="widefat" id="<?php echo $this->get_field_id('postal_code'); ?>" />
<input type="text" name="<?php echo $this->get_field_name('postal_code'); ?>" value="<?php echo esc_attr($instance['postal_code']); ?>" class="widefat" id="<?php echo $this->get_field_id('postal_code'); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('tel'); ?>"><?php _e('Telephone:', 'roots'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('tel'); ?>" value="<?php echo $tel; ?>" class="widefat" id="<?php echo $this->get_field_id('tel'); ?>" />
<input type="text" name="<?php echo $this->get_field_name('tel'); ?>" value="<?php echo esc_attr($instance['tel']); ?>" class="widefat" id="<?php echo $this->get_field_id('tel'); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('email'); ?>"><?php _e('Email:', 'roots'); ?></label>
<input type="text" name="<?php echo $this->get_field_name('email'); ?>" value="<?php echo $email; ?>" class="widefat" id="<?php echo $this->get_field_id('email'); ?>" />
<input type="text" name="<?php echo $this->get_field_name('email'); ?>" value="<?php echo esc_attr($instance['email']); ?>" class="widefat" id="<?php echo $this->get_field_id('email'); ?>" />
</p>
<?php
}