Browse Source

Ignore /dist, fix CS errors.

pull/3/head
Ned Zimmerman 7 years ago
parent
commit
6db4caba61
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 2
      .gitignore
  2. 24
      app/widgets/linkbutton.php
  3. 26
      app/widgets/pagebutton.php
  4. 5
      resources/functions.php

2
.gitignore vendored

@ -1,7 +1,7 @@
# Include your project-specific ignores in this file
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files
.cache-loader
bower_components
dist
node_modules
npm-debug.log
yarn-error.log

24
app/widgets/linkbutton.php

@ -29,7 +29,11 @@ class LinkButton extends \WP_Widget
{
echo $args['before_widget'];
if (! empty($instance['url']) && ! empty($instance['title'])) {
printf('<a class="button" href="%1$s">%2$s</a>', $instance['url'], apply_filters('widget_title', $instance['title']));
printf(
'<a class="button" href="%1$s">%2$s</a>',
$instance['url'],
apply_filters('widget_title', $instance['title'])
);
}
echo $args['after_widget'];
}
@ -45,10 +49,20 @@ class LinkButton extends \WP_Widget
{
$title = ! empty($instance['title']) ? $instance['title'] : '';
$url = ! empty($instance['url']) ? $instance['url'] : ''; ?>
<p><label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'aldine'); ?></label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>"></p>
<p><label for="<?php echo esc_attr($this->get_field_id('url')); ?>"><?php esc_attr_e('URL:', 'aldine'); ?></label>
<input class="widefat code" id="<?php echo esc_attr($this->get_field_id('url')); ?>" name="<?php echo esc_attr($this->get_field_name('url')); ?>" type="text" value="<?php echo esc_attr($url); ?>"></p>
<p><label for="<?= esc_attr($this->get_field_id('title')); ?>"><?php _e('Title:', 'aldine'); ?></label>
<input
class="widefat"
id="<?= esc_attr($this->get_field_id('title')); ?>"
name="<?= esc_attr($this->get_field_name('title')); ?>"
type="text"
value="<?= esc_attr($title); ?>"></p>
<p><label for="<?= esc_attr($this->get_field_id('url')); ?>"><?php _e('URL:', 'aldine'); ?></label>
<input
class="widefat code"
id="<?= esc_attr($this->get_field_id('url')); ?>"
name="<?= esc_attr($this->get_field_name('url')); ?>"
type="text"
value="<?= esc_attr($url); ?>"></p>
<?php
}

26
app/widgets/pagebutton.php

@ -32,7 +32,11 @@ class PageButton extends \WP_Widget
if (empty($instance['title'])) {
$instance['title'] = get_the_title($instance['page_id']);
}
printf('<a class="button" href="%1$s">%2$s</a>', get_permalink($instance['page_id']), apply_filters('widget_title', $instance['title']));
printf(
'<a class="button" href="%1$s">%2$s</a>',
get_permalink($instance['page_id']),
apply_filters('widget_title', $instance['title'])
);
}
echo $args['after_widget'];
}
@ -48,14 +52,24 @@ class PageButton extends \WP_Widget
{
$title = ! empty($instance['title']) ? $instance['title'] : '';
$url = ! empty($instance['page_id']) ? $instance['page_id'] : ''; ?>
<p><label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_attr_e('Title:', 'aldine'); ?></label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>"></p>
<p><label for="<?php echo esc_attr($this->get_field_id('page_id')); ?>"><?php esc_attr_e('Page:', 'aldine'); ?></label>
<select id="<?php echo esc_attr($this->get_field_id('page_id')); ?>" name="<?php echo esc_attr($this->get_field_name('page_id')); ?>">
<p><label for="<?= esc_attr($this->get_field_id('title')); ?>"><?php _e('Title:', 'aldine'); ?></label>
<input
class="widefat"
id="<?= esc_attr($this->get_field_id('title')); ?>"
name="<?= esc_attr($this->get_field_name('title')); ?>"
type="text"
value="<?= esc_attr($title); ?>"></p>
<p><label for="<?= esc_attr($this->get_field_id('page_id')); ?>"><?php _e('Page:', 'aldine'); ?></label>
<select
id="<?= esc_attr($this->get_field_id('page_id')); ?>"
name="<?= esc_attr($this->get_field_name('page_id')); ?>">
<option value="" <?php selected($instance['page_id'], ''); ?>> -- </a>
<?php $pages = get_pages();
foreach ($pages as $page) { ?>
<option value="<?= $page->ID; ?>" <?php selected(@$instance['page_id'], $page->ID); ?>><?= $page->post_title; ?></option>
<option value="<?= $page->ID; ?>"
<?php selected(@$instance['page_id'], $page->ID); ?>>
<?= $page->post_title; ?>
</option>
<?php } ?>
</select></p>
<?php

5
resources/functions.php

@ -31,7 +31,10 @@ if (version_compare('7', phpversion(), '>=')) {
* Ensure compatible version of WordPress is used
*/
if (version_compare('4.7.0', get_bloginfo('version'), '>=')) {
$sage_error(__('You must be using WordPress 4.7.0 or greater.', 'aldine'), __('Invalid WordPress version', 'aldine'));
$sage_error(
__('You must be using WordPress 4.7.0 or greater.', 'aldine'),
__('Invalid WordPress version', 'aldine')
);
}
/**

Loading…
Cancel
Save