Version Description
Updated for WordPress 4.1, bug fix to privacy page terms, and added useful links and DIYWebmastery news feed sections in the sidebar
Download this release
Release Info
Developer | powerblogservice |
Plugin | Footer Putter |
Version | 1.12 |
Comparing to | |
See all releases |
Code changes from version 1.11 to 1.12
- classes/class-admin.php +6 -5
- classes/class-credits-admin.php +9 -1
- classes/{class-options.php → class-credits-options.php} +30 -30
- classes/{class-footer-widgets.php → class-credits-widgets.php} +0 -129
- classes/{class-footer.php → class-credits.php} +3 -3
- classes/class-dashboard.php +32 -11
- classes/class-feed-widget.php +157 -0
- classes/class-plugin.php +7 -5
- classes/class-tooltip.php +3 -3
- classes/class-trademarks-admin.php +10 -3
- classes/class-trademarks-widgets.php +130 -0
- classes/class-utils.php +1 -1
- main.php +3 -3
- readme.txt +6 -4
classes/class-admin.php
CHANGED
@@ -157,8 +157,8 @@ SCRIPT;
|
|
157 |
|
158 |
function admin_heading($title = '', $icon_class = '') {
|
159 |
if (empty($title)) $title = sprintf('%1$s %2$s', ucwords(str_replace('-',' ',$this->slug)), $this->get_version());
|
160 |
-
$icon = empty($icon_class) ? '' : sprintf('<i class="%1$s"></i>',
|
161 |
-
'dashicons-'==substr($icon_class,0,10) ?
|
162 |
return sprintf('<h2 class="title">%2$s%1$s</h2>', $title, $icon);
|
163 |
}
|
164 |
|
@@ -171,12 +171,13 @@ SCRIPT;
|
|
171 |
ADMIN_START;
|
172 |
}
|
173 |
|
174 |
-
function print_admin_form_with_sidebar_middle() {
|
175 |
$this_url = $_SERVER['REQUEST_URI'];
|
|
|
176 |
print <<< ADMIN_MIDDLE
|
177 |
</div>
|
178 |
<div id="post-body" class="has-sidebar"><div id="post-body-content" class="has-sidebar-content diy-wrap">
|
179 |
-
<form id="diy_options" method="post" action="{$this_url}">
|
180 |
ADMIN_MIDDLE;
|
181 |
}
|
182 |
|
@@ -271,5 +272,5 @@ ADMIN_END;
|
|
271 |
abstract function page_content();
|
272 |
|
273 |
abstract function load_page();
|
274 |
-
|
275 |
}
|
157 |
|
158 |
function admin_heading($title = '', $icon_class = '') {
|
159 |
if (empty($title)) $title = sprintf('%1$s %2$s', ucwords(str_replace('-',' ',$this->slug)), $this->get_version());
|
160 |
+
$icon = empty($icon_class) ? '' : sprintf('<i class="%1$s"></i>',
|
161 |
+
'dashicons-'==substr($icon_class,0,10) ? ('dashicons '.$icon_class) : $icon_class) ;
|
162 |
return sprintf('<h2 class="title">%2$s%1$s</h2>', $title, $icon);
|
163 |
}
|
164 |
|
171 |
ADMIN_START;
|
172 |
}
|
173 |
|
174 |
+
function print_admin_form_with_sidebar_middle($enctype = false) {
|
175 |
$this_url = $_SERVER['REQUEST_URI'];
|
176 |
+
$enctype = $enctype ? 'enctype="multipart/form-data" ' : '';
|
177 |
print <<< ADMIN_MIDDLE
|
178 |
</div>
|
179 |
<div id="post-body" class="has-sidebar"><div id="post-body-content" class="has-sidebar-content diy-wrap">
|
180 |
+
<form id="diy_options" method="post" {$enctype}action="{$this_url}">
|
181 |
ADMIN_MIDDLE;
|
182 |
}
|
183 |
|
272 |
abstract function page_content();
|
273 |
|
274 |
abstract function load_page();
|
275 |
+
|
276 |
}
|
classes/class-credits-admin.php
CHANGED
@@ -41,7 +41,9 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
|
|
41 |
|
42 |
function page_content() {
|
43 |
$title = $this->admin_heading('Footer Credits',FOOTER_PUTTER_ICON);
|
44 |
-
$this->
|
|
|
|
|
45 |
do_meta_boxes($this->get_screen_id(), 'normal', null);
|
46 |
$this->print_admin_form_end(__CLASS__, $this->get_keys());
|
47 |
}
|
@@ -57,6 +59,8 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
|
|
57 |
$this->add_meta_box('return', 'Return To Top' , 'return_panel', $callback_params);
|
58 |
$this->add_meta_box('example', 'Preview Footer Content' , 'preview_panel', $callback_params);
|
59 |
$this->add_meta_box('advanced', 'Advanced' , 'advanced_panel', $callback_params);
|
|
|
|
|
60 |
$this->set_tooltips($this->tips);
|
61 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_credits_styles'));
|
62 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
|
@@ -67,6 +71,10 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
|
|
67 |
wp_enqueue_style($this->get_code(), plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),$this->get_version());
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
70 |
function intro_panel($post,$metabox) {
|
71 |
$message = $metabox['args']['message'];
|
72 |
print <<< INTRO_PANEL
|
41 |
|
42 |
function page_content() {
|
43 |
$title = $this->admin_heading('Footer Credits',FOOTER_PUTTER_ICON);
|
44 |
+
$this->print_admin_form_with_sidebar_start($title);
|
45 |
+
do_meta_boxes($this->get_screen_id(), 'side', null);
|
46 |
+
$this->print_admin_form_with_sidebar_middle();
|
47 |
do_meta_boxes($this->get_screen_id(), 'normal', null);
|
48 |
$this->print_admin_form_end(__CLASS__, $this->get_keys());
|
49 |
}
|
59 |
$this->add_meta_box('return', 'Return To Top' , 'return_panel', $callback_params);
|
60 |
$this->add_meta_box('example', 'Preview Footer Content' , 'preview_panel', $callback_params);
|
61 |
$this->add_meta_box('advanced', 'Advanced' , 'advanced_panel', $callback_params);
|
62 |
+
$this->add_meta_box('news', 'DIY Webmastery News', 'news_panel',$callback_params, 'side');
|
63 |
+
|
64 |
$this->set_tooltips($this->tips);
|
65 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_credits_styles'));
|
66 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
|
71 |
wp_enqueue_style($this->get_code(), plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),$this->get_version());
|
72 |
}
|
73 |
|
74 |
+
function news_panel($post,$metabox){
|
75 |
+
Footer_Putter_Feed_Widget::display_feeds();
|
76 |
+
}
|
77 |
+
|
78 |
function intro_panel($post,$metabox) {
|
79 |
$message = $metabox['args']['message'];
|
80 |
print <<< INTRO_PANEL
|
classes/{class-options.php → class-credits-options.php}
RENAMED
@@ -7,26 +7,26 @@ class Footer_Credits_Options {
|
|
7 |
|
8 |
protected static $defaults = array(
|
9 |
'terms' => array(
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
'nav_menu' => 0,
|
31 |
'center' => true,
|
32 |
'two_lines' => true,
|
@@ -45,7 +45,7 @@ class Footer_Credits_Options {
|
|
45 |
'footer_remove' => true,
|
46 |
'footer_filter_hook' => '',
|
47 |
'visibility' => '' ,
|
48 |
-
|
49 |
);
|
50 |
|
51 |
public static function init() {
|
@@ -114,18 +114,18 @@ class Footer_Credits_Options {
|
|
114 |
private static function get_default_term($key) {
|
115 |
$default='';
|
116 |
switch ($key) {
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
case 'copyright_preamble': $default = 'Copyright ©'; break;
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
default: $default=''; //default is blank for others
|
127 |
}
|
128 |
-
|
129 |
}
|
130 |
|
131 |
private static function theme_specific_defaults() {
|
7 |
|
8 |
protected static $defaults = array(
|
9 |
'terms' => array(
|
10 |
+
'site' => '',
|
11 |
+
'owner' => '',
|
12 |
+
'address' => '',
|
13 |
+
'street_address' => '',
|
14 |
+
'locality' => '',
|
15 |
+
'region' => '',
|
16 |
+
'postal_code' => '',
|
17 |
+
'country' => '',
|
18 |
+
'latitude' => '',
|
19 |
+
'longitude' => '',
|
20 |
+
'map' => '',
|
21 |
+
'email' => '',
|
22 |
+
'telephone' => '',
|
23 |
+
'copyright' => '',
|
24 |
+
'copyright_start_year' => '',
|
25 |
+
'copyright_preamble' => '',
|
26 |
+
'courts' => '',
|
27 |
+
'updated' => '',
|
28 |
+
'privacy_contact' => '',
|
29 |
+
'terms_contact' => ''),
|
30 |
'nav_menu' => 0,
|
31 |
'center' => true,
|
32 |
'two_lines' => true,
|
45 |
'footer_remove' => true,
|
46 |
'footer_filter_hook' => '',
|
47 |
'visibility' => '' ,
|
48 |
+
'use_microdata' => false
|
49 |
);
|
50 |
|
51 |
public static function init() {
|
114 |
private static function get_default_term($key) {
|
115 |
$default='';
|
116 |
switch ($key) {
|
117 |
+
case 'owner' : $default = self::get_term('site'); break;
|
118 |
+
case 'copyright' : $default = self::get_copyright(self::get_term('copyright_start_year')); break;
|
119 |
+
case 'copyright_start_year': $default = date('Y'); break;
|
120 |
case 'copyright_preamble': $default = 'Copyright ©'; break;
|
121 |
+
case 'country' : $default = 'The United States'; break;
|
122 |
+
case 'courts' : $default = ucwords(sprintf('the courts of %1$s',self::get_term('country'))); break;
|
123 |
+
case 'email' : $default = 'privacy@'.strtolower(self::get_term('site')); break;
|
124 |
+
case 'site' : $default = self::get_default_site(); break;
|
125 |
+
case 'updated' : $default = date('d M Y'); break;
|
126 |
default: $default=''; //default is blank for others
|
127 |
}
|
128 |
+
return $default;
|
129 |
}
|
130 |
|
131 |
private static function theme_specific_defaults() {
|
classes/{class-footer-widgets.php → class-credits-widgets.php}
RENAMED
@@ -103,132 +103,3 @@ CUSTOM_CLASSES;
|
|
103 |
$this->get_field_id($fld), $this->get_field_name($fld), $this->tooltips->tip($fld), $value, $type, $options, $args, 'br');
|
104 |
}
|
105 |
}
|
106 |
-
|
107 |
-
class Footer_Putter_Trademark_Widget extends WP_Widget {
|
108 |
-
|
109 |
-
private $instance;
|
110 |
-
private $tooltips;
|
111 |
-
|
112 |
-
private $tips = array(
|
113 |
-
'title' => array('heading' => 'Title', 'tip' => 'Widget Title'),
|
114 |
-
'category' => array('heading' => 'Category', 'tip' => 'Select Link Category for Your Trademarks'),
|
115 |
-
'limit' => array('heading' => 'Number of links', 'tip' => 'Number of trademarks to show'),
|
116 |
-
'orderby' => array('heading' => 'Order By', 'tip' => 'Sort by name, rating, ID or random'),
|
117 |
-
'nofollow' => array('heading' => 'Make Links Nofollow', 'tip' => 'Mark the links with rel=nofollow'),
|
118 |
-
'visibility' => array('heading' => 'Widget Visibility', 'tip' => 'Determine on which pages the footer widget is displayed'),
|
119 |
-
);
|
120 |
-
|
121 |
-
private $defaults = array( 'title' => '',
|
122 |
-
'category' => false, 'limit' => '', 'orderby' => 'name', 'nofollow' => false, 'visibility' => '');
|
123 |
-
|
124 |
-
function get_tips() {
|
125 |
-
return $this->tips;
|
126 |
-
}
|
127 |
-
|
128 |
-
function get_defaults() {
|
129 |
-
return $this->defaults;
|
130 |
-
}
|
131 |
-
|
132 |
-
function __construct() {
|
133 |
-
add_filter('pre_option_link_manager_enabled', '__return_true' );
|
134 |
-
$widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks') );
|
135 |
-
parent::__construct('footer_trademarks', __('Trademarks Widget'), $widget_ops);
|
136 |
-
}
|
137 |
-
|
138 |
-
function nofollow_links( $content) {
|
139 |
-
return preg_replace_callback( '/<a([^>]*)>(.*?)<\/a[^>]*>/is', array( &$this, 'nofollow_link' ), $content ) ;
|
140 |
-
}
|
141 |
-
|
142 |
-
function nofollow_link($matches) { //make link nofollow
|
143 |
-
$attrs = shortcode_parse_atts( stripslashes ($matches[ 1 ]) );
|
144 |
-
$atts='';
|
145 |
-
$rel = ' rel="nofollow"';
|
146 |
-
foreach ( $attrs AS $key => $value ) {
|
147 |
-
$key = strtolower($key);
|
148 |
-
$nofollow = '';
|
149 |
-
if ('rel' == $key) {
|
150 |
-
$rel = '';
|
151 |
-
if (strpos($value, 'follow') === FALSE) $nofollow = ' nofollow';
|
152 |
-
}
|
153 |
-
$atts .= sprintf(' %1$s="%2$s%3$s"', $key, $value, $nofollow);
|
154 |
-
}
|
155 |
-
return sprintf('<a%1$s%2$s>%3$s</a>', $rel, $atts, $matches[ 2 ]);
|
156 |
-
}
|
157 |
-
|
158 |
-
function widget( $args, $instance ) {
|
159 |
-
extract($args, EXTR_SKIP);
|
160 |
-
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
161 |
-
if (Footer_Putter_Utils::hide_widget($instance['visibility'])) return; //check visibility requirements
|
162 |
-
|
163 |
-
$title = apply_filters('widget_title', $instance['title'] );
|
164 |
-
$category = isset($instance['category']) ? $instance['category'] : false;
|
165 |
-
$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
|
166 |
-
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
|
167 |
-
$limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
|
168 |
-
$nofollow = isset( $instance['nofollow'] ) && $instance['nofollow'];
|
169 |
-
|
170 |
-
$links = wp_list_bookmarks(apply_filters('widget_links_args', array(
|
171 |
-
'echo' => 0,
|
172 |
-
'title_before' => $before_title, 'title_after' => $after_title,
|
173 |
-
'title_li' => '', 'categorize' => false,
|
174 |
-
'before' => '', 'after' => '',
|
175 |
-
'category_before' => '', 'category_after' => '',
|
176 |
-
'show_images' => true, 'show_description' => false,
|
177 |
-
'show_name' => false, 'show_rating' => false,
|
178 |
-
'category' => $category, 'class' => 'trademark widget',
|
179 |
-
'orderby' => $orderby, 'order' => $order,
|
180 |
-
'limit' => $limit,
|
181 |
-
)));
|
182 |
-
echo $before_widget;
|
183 |
-
if ($title) echo $before_title . $title . $after_title;
|
184 |
-
if ($nofollow)
|
185 |
-
echo $this->nofollow_links($links);
|
186 |
-
else
|
187 |
-
echo $links;
|
188 |
-
echo $after_widget;
|
189 |
-
}
|
190 |
-
|
191 |
-
function update( $new_instance, $old_instance ) {
|
192 |
-
$new_instance = (array) $new_instance;
|
193 |
-
$instance = wp_parse_args( (array) $old_instance, $this->defaults );
|
194 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
195 |
-
$instance['orderby'] = 'name';
|
196 |
-
if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
|
197 |
-
$instance['orderby'] = $new_instance['orderby'];
|
198 |
-
$instance['category'] = intval( $new_instance['category'] );
|
199 |
-
$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : '';
|
200 |
-
$instance['nofollow'] = !empty($new_instance['nofollow']);
|
201 |
-
$instance['visibility'] = trim($new_instance['visibility']);
|
202 |
-
return $instance;
|
203 |
-
}
|
204 |
-
|
205 |
-
function form( $instance ) {
|
206 |
-
$this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
|
207 |
-
$this->tooltips = new Footer_Putter_Tooltip($this->get_tips());
|
208 |
-
|
209 |
-
$links = array();
|
210 |
-
$link_cats = get_terms( 'link_category' );
|
211 |
-
foreach ( $link_cats as $link_cat ) {
|
212 |
-
$id = intval($link_cat->term_id);
|
213 |
-
$links[$id] = $link_cat->name;
|
214 |
-
}
|
215 |
-
$this->print_form_field('title', 'text', array(), array('size' => 10));
|
216 |
-
$this->print_form_field('category', 'select', $links);
|
217 |
-
$this->print_form_field('orderby', 'select', array(
|
218 |
-
'name' => __( 'Link title'),
|
219 |
-
'rating' => __( 'Link rating'),
|
220 |
-
'id' => __( 'Link ID'),
|
221 |
-
'rand' => __( 'Random')
|
222 |
-
));
|
223 |
-
$this->print_form_field('limit', 'text', array(), array('size' => 3 ,'maxlength' => 3));
|
224 |
-
$this->print_form_field('nofollow', 'checkbox');
|
225 |
-
$this->print_form_field('visibility', 'radio',
|
226 |
-
Footer_Putter_Utils::get_visibility_options(), array('separator' => '<br />'));
|
227 |
-
}
|
228 |
-
|
229 |
-
function print_form_field ($fld, $type, $options = array(), $args = array()) {
|
230 |
-
$value = array_key_exists($fld,$this->instance) ? $this->instance[$fld] : false;
|
231 |
-
print Footer_Putter_Utils::form_field(
|
232 |
-
$this->get_field_id($fld), $this->get_field_name($fld), $this->tooltips->tip($fld), $value, $type, $options, $args,'br');
|
233 |
-
}
|
234 |
-
}
|
103 |
$this->get_field_id($fld), $this->get_field_name($fld), $this->tooltips->tip($fld), $value, $type, $options, $args, 'br');
|
104 |
}
|
105 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/{class-footer.php → class-credits.php}
RENAMED
@@ -282,16 +282,16 @@ PRIVACY;
|
|
282 |
<h2>Dispute Resolution</h2>
|
283 |
<p>These terms, and any dispute arising from the use of this site, will be governed by {$terms['courts']} without regard to its conflicts of laws provisions.</p>
|
284 |
DISPUTES;
|
285 |
-
$
|
286 |
<h2>Feedback And Information</h2>
|
287 |
<p>Any feedback you provide at this site shall be deemed to be non-confidential. {$terms['owner']} shall be free to use such information on an unrestricted basis.</p>
|
288 |
<p>The terms and conditions for this web site are subject to change without notice.<p>
|
289 |
<p>{$terms['copyright']} {$terms['owner']} All rights reserved.<br/> {$terms['owner']}, {$terms['address']} {$terms['country']}</p>
|
290 |
<p>Updated by The {$terms['owner']} Legal Team on {$terms['updated']}</p>
|
291 |
-
|
292 |
if (strpos($content,'%%') == FALSE) {
|
293 |
$content .= $terms['courts'] ? $disputes : '';
|
294 |
-
$content .= $terms['address'] ? $
|
295 |
}
|
296 |
return $content ;
|
297 |
}
|
282 |
<h2>Dispute Resolution</h2>
|
283 |
<p>These terms, and any dispute arising from the use of this site, will be governed by {$terms['courts']} without regard to its conflicts of laws provisions.</p>
|
284 |
DISPUTES;
|
285 |
+
$feedback = <<< FEEDBACK
|
286 |
<h2>Feedback And Information</h2>
|
287 |
<p>Any feedback you provide at this site shall be deemed to be non-confidential. {$terms['owner']} shall be free to use such information on an unrestricted basis.</p>
|
288 |
<p>The terms and conditions for this web site are subject to change without notice.<p>
|
289 |
<p>{$terms['copyright']} {$terms['owner']} All rights reserved.<br/> {$terms['owner']}, {$terms['address']} {$terms['country']}</p>
|
290 |
<p>Updated by The {$terms['owner']} Legal Team on {$terms['updated']}</p>
|
291 |
+
FEEDBACK;
|
292 |
if (strpos($content,'%%') == FALSE) {
|
293 |
$content .= $terms['courts'] ? $disputes : '';
|
294 |
+
$content .= $terms['address'] ? $feedback : '';
|
295 |
}
|
296 |
return $content ;
|
297 |
}
|
classes/class-dashboard.php
CHANGED
@@ -4,35 +4,39 @@ class Footer_Putter_Dashboard extends Footer_Putter_Admin {
|
|
4 |
function init() {
|
5 |
add_action('admin_menu', array($this, 'admin_menu'));
|
6 |
add_action('load-widgets.php', array($this, 'add_tooltip_support'));
|
7 |
-
|
8 |
-
|
9 |
add_filter('plugin_action_links',array($this, 'plugin_action_links'), 10, 2 );
|
10 |
}
|
11 |
|
12 |
function admin_menu() {
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
}
|
19 |
|
20 |
function page_content() {
|
21 |
$title = $this->admin_heading('Footer Putter', FOOTER_PUTTER_ICON);
|
22 |
-
$this->
|
|
|
|
|
23 |
do_meta_boxes($this->get_screen_id(), 'normal', null);
|
24 |
$this->print_admin_form_end(__CLASS__);
|
25 |
}
|
26 |
|
27 |
function load_page() {
|
28 |
$this->add_tooltip_support();
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
$this->add_meta_box('intro', 'Introduction', 'intro_panel');
|
33 |
$this->add_meta_box('widgets','Widgets', 'widgets_panel');
|
34 |
$this->add_meta_box('instructions', 'Instructions', 'instructions_panel');
|
35 |
$this->add_meta_box('hooks', 'Footer Hook', 'hooks_panel');
|
|
|
|
|
36 |
}
|
37 |
|
38 |
function intro_panel() {
|
@@ -115,4 +119,21 @@ or use a theme-specific hook such as <i>twentyten_credits</i>, <i>twentyeleven_c
|
|
115 |
<p>Check out the <a href="{$home_url}">{$plugin} page</a> for more information about the plugin.</p>
|
116 |
HOOKS_PANEL;
|
117 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
4 |
function init() {
|
5 |
add_action('admin_menu', array($this, 'admin_menu'));
|
6 |
add_action('load-widgets.php', array($this, 'add_tooltip_support'));
|
7 |
+
add_action('admin_enqueue_scripts', array($this ,'register_tooltip_styles'));
|
8 |
+
add_action('admin_enqueue_scripts', array($this ,'register_admin_styles'));
|
9 |
add_filter('plugin_action_links',array($this, 'plugin_action_links'), 10, 2 );
|
10 |
}
|
11 |
|
12 |
function admin_menu() {
|
13 |
+
$intro = sprintf('Intro (v%1$s)', $this->get_version());
|
14 |
+
$this->screen_id = add_menu_page(FOOTER_PUTTER_FRIENDLY_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'manage_options',
|
15 |
+
$this->get_slug(), array($this,'page_content'), FOOTER_PUTTER_ICON );
|
16 |
+
add_submenu_page($this->get_slug(), FOOTER_PUTTER_FRIENDLY_NAME, $intro, 'manage_options', $this->get_slug(), array($this,'page_content') );
|
17 |
+
add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
|
18 |
}
|
19 |
|
20 |
function page_content() {
|
21 |
$title = $this->admin_heading('Footer Putter', FOOTER_PUTTER_ICON);
|
22 |
+
$this->print_admin_form_with_sidebar_start($title);
|
23 |
+
do_meta_boxes($this->get_screen_id(), 'side', null);
|
24 |
+
$this->print_admin_form_with_sidebar_middle();
|
25 |
do_meta_boxes($this->get_screen_id(), 'normal', null);
|
26 |
$this->print_admin_form_end(__CLASS__);
|
27 |
}
|
28 |
|
29 |
function load_page() {
|
30 |
$this->add_tooltip_support();
|
31 |
+
add_action('admin_enqueue_scripts', array($this, 'register_admin_styles'));
|
32 |
+
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
|
33 |
+
add_action('admin_enqueue_scripts', array($this, 'enqueue_postbox_scripts'));
|
34 |
$this->add_meta_box('intro', 'Introduction', 'intro_panel');
|
35 |
$this->add_meta_box('widgets','Widgets', 'widgets_panel');
|
36 |
$this->add_meta_box('instructions', 'Instructions', 'instructions_panel');
|
37 |
$this->add_meta_box('hooks', 'Footer Hook', 'hooks_panel');
|
38 |
+
$this->add_meta_box('links', 'Useful Links', 'links_panel', null, 'side');
|
39 |
+
$this->add_meta_box('news', 'DIY Webmastery News', 'news_panel', null, 'side');
|
40 |
}
|
41 |
|
42 |
function intro_panel() {
|
119 |
<p>Check out the <a href="{$home_url}">{$plugin} page</a> for more information about the plugin.</p>
|
120 |
HOOKS_PANEL;
|
121 |
}
|
122 |
+
|
123 |
+
function links_panel() {
|
124 |
+
$home = FOOTER_PUTTER_HOME_URL;
|
125 |
+
print <<< LINKS_PANEL
|
126 |
+
<ul>
|
127 |
+
<li><a rel="external" href="{$home}">Footer Putter Plugin Home</a></li>
|
128 |
+
<li><a rel="external" href="http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks/">Themes and Recommended Footer Hooks</a></li>
|
129 |
+
<li><a rel="external" href="http://www.diywebmastery.com/4098/how-to-add-a-different-footer-on-landing-pages/">How To Use A Different Footer On Landing Pages</a></li>
|
130 |
+
<li><a rel="external" href="http://www.diywebmastery.com/4109/using-html5-microdata-footer/">Using HTML5 Microdata for better SEO and Local Search</a></li>
|
131 |
+
</ul>
|
132 |
+
LINKS_PANEL;
|
133 |
+
}
|
134 |
+
|
135 |
+
function news_panel($post,$metabox){
|
136 |
+
Footer_Putter_Feed_Widget::display_feeds();
|
137 |
+
}
|
138 |
+
|
139 |
}
|
classes/class-feed-widget.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!class_exists('Footer_Putter_Feed_Widget')) {
|
3 |
+
class Footer_Putter_Feed_Widget extends WP_Widget_RSS {
|
4 |
+
|
5 |
+
function __construct() {
|
6 |
+
$widget_ops = array( 'description' => __('Displays Featured image in place of title in any RSS or Atom feed.') );
|
7 |
+
$control_ops = array( 'width' => 400, 'height' => 200 );
|
8 |
+
parent::__construct( 'genesis-club-feed', __('Genesis Club Feed'), $widget_ops, $control_ops );
|
9 |
+
}
|
10 |
+
|
11 |
+
function widget($args, $instance) {
|
12 |
+
|
13 |
+
if ( isset($instance['error']) && $instance['error'] )
|
14 |
+
return;
|
15 |
+
|
16 |
+
$title = $instance['title'];
|
17 |
+
$desc = '';
|
18 |
+
$link = '';
|
19 |
+
|
20 |
+
/** This filter is documented in wp-includes/default-widgets.php */
|
21 |
+
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
22 |
+
|
23 |
+
echo $args['before_widget'];
|
24 |
+
|
25 |
+
if ( $title ) {
|
26 |
+
echo $args['before_title'] . $title . $args['after_title'];
|
27 |
+
}
|
28 |
+
|
29 |
+
self::rss_output($instance );
|
30 |
+
|
31 |
+
echo $args['after_widget'];
|
32 |
+
}
|
33 |
+
|
34 |
+
static function rss_output( $instance ) {
|
35 |
+
|
36 |
+
$url = ! empty( $instance['url'] ) ? $instance['url'] : '';
|
37 |
+
|
38 |
+
while ( stristr($url, 'http') != $url )
|
39 |
+
$url = substr($url, 1);
|
40 |
+
|
41 |
+
if ( empty($url) )
|
42 |
+
return;
|
43 |
+
|
44 |
+
if ( in_array( untrailingslashit( $url ), array( site_url(), home_url() ) ) )
|
45 |
+
return;
|
46 |
+
|
47 |
+
$rss = fetch_feed($url);
|
48 |
+
|
49 |
+
if ( is_wp_error($rss) ) {
|
50 |
+
if ( is_admin() || current_user_can('manage_options') )
|
51 |
+
echo '<div>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</div>';
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
|
55 |
+
$default_args = array( 'show_featured' => 0, 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0 );
|
56 |
+
|
57 |
+
if (($parsed_url = parse_url($url))
|
58 |
+
&& ($query = isset($parsed_url['query']) ? $parsed_url['query'] : '')) {
|
59 |
+
$instance = wp_parse_args($query, $default_args);
|
60 |
+
}
|
61 |
+
|
62 |
+
$args = wp_parse_args( $instance, $default_args );
|
63 |
+
|
64 |
+
$items = (int) $args['items'];
|
65 |
+
if ( $items < 1 || 20 < $items ) $items = 10;
|
66 |
+
|
67 |
+
$show_featured = (int) $args['show_featured'];
|
68 |
+
$show_summary = (int) $args['show_summary'];
|
69 |
+
$show_author = (int) $args['show_author'];
|
70 |
+
$show_date = (int) $args['show_date'];
|
71 |
+
|
72 |
+
if ( !$rss->get_item_quantity() ) {
|
73 |
+
echo '<div>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</div>';
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
foreach ( $rss->get_items( 0, $items ) as $item ) {
|
78 |
+
$link = $item->get_link();
|
79 |
+
while ( stristr( $link, 'http' ) != $link ) {
|
80 |
+
$link = substr( $link, 1 );
|
81 |
+
}
|
82 |
+
$link = esc_url( strip_tags( $link ) );
|
83 |
+
$title = esc_html( trim( strip_tags( $item->get_title() ) ) );
|
84 |
+
$link_title = '';
|
85 |
+
$desc = @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) );
|
86 |
+
|
87 |
+
if (substr($desc,0,5) == '<img ') { //use image in place of title if supplied
|
88 |
+
$end_image = strpos($desc,'>');
|
89 |
+
$link_title = sprintf(' title="%1$s"', $title);
|
90 |
+
$title = substr($desc,0, $end_image+1);
|
91 |
+
$desc = substr($desc, $end_image+1);
|
92 |
+
} else {
|
93 |
+
if ($show_featured)
|
94 |
+
continue; //skip items with missing featured images
|
95 |
+
}
|
96 |
+
|
97 |
+
$desc = esc_attr( wp_trim_words( $desc, 55, ' […]' ) );
|
98 |
+
|
99 |
+
$summary = '';
|
100 |
+
if ( $show_summary ) {
|
101 |
+
$summary = $desc;
|
102 |
+
|
103 |
+
// Change existing [...] to […].
|
104 |
+
if ( '[...]' == substr( $summary, -5 ) ) {
|
105 |
+
$summary = substr( $summary, 0, -5 ) . '[…]';
|
106 |
+
}
|
107 |
+
|
108 |
+
$summary = '<div class="rssSummary">' . esc_html( $summary ) . '</div>';
|
109 |
+
}
|
110 |
+
|
111 |
+
$date = '';
|
112 |
+
if ( $show_date ) {
|
113 |
+
$date = $item->get_date( 'U' );
|
114 |
+
|
115 |
+
if ( $date ) {
|
116 |
+
$date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
$author = '';
|
121 |
+
if ( $show_author ) {
|
122 |
+
$author = $item->get_author();
|
123 |
+
if ( is_object($author) ) {
|
124 |
+
$author = $author->get_name();
|
125 |
+
$author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( $link == '' )
|
130 |
+
$format = '<span>%3$s</span>%4$s%6$s';
|
131 |
+
elseif ( $show_summary )
|
132 |
+
$format = '<span><a class="rsswidget" href="%1$s"%2$s>%3$s</a></span>%4$s%5$s%6$s';
|
133 |
+
else
|
134 |
+
$format = '<span><a class="rsswidget" href="%1$s"%2$s>%3$s</a></span>%4$s%6$s';
|
135 |
+
|
136 |
+
printf('<span class="diy-image-feed-widget-item">'.$format.'</span>', $link, $link_title, $title, $date, $summary, $author );
|
137 |
+
}
|
138 |
+
|
139 |
+
if ( ! is_wp_error($rss) )
|
140 |
+
$rss->__destruct();
|
141 |
+
unset($rss);
|
142 |
+
}
|
143 |
+
|
144 |
+
static function display_feeds($feeds = false) {
|
145 |
+
if (false == $feeds) $feeds = array(FOOTER_PUTTER_NEWS);
|
146 |
+
if (is_array($feeds) && (count($feeds) > 0)) {
|
147 |
+
echo '<div class="diy-image-feed-widget">';
|
148 |
+
foreach( $feeds as $url ) {
|
149 |
+
$args = array('url' => $url, 'show_summary' => true, 'show_featured' => true);
|
150 |
+
self::rss_output( $args );
|
151 |
+
}
|
152 |
+
echo "</div>";
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
}
|
157 |
+
}
|
classes/class-plugin.php
CHANGED
@@ -12,11 +12,12 @@ class Footer_Putter_Plugin {
|
|
12 |
|
13 |
public static function init() {
|
14 |
$dir = dirname(__FILE__) . '/';
|
15 |
-
require_once($dir . 'class-diy-options.php');
|
16 |
-
require_once($dir . 'class-options.php');
|
17 |
require_once($dir . 'class-utils.php');
|
18 |
-
require_once($dir . 'class-
|
19 |
-
require_once($dir . 'class-
|
|
|
|
|
|
|
20 |
Footer_Credits_Options::init();
|
21 |
Footer_Credits::init();
|
22 |
}
|
@@ -25,7 +26,8 @@ class Footer_Putter_Plugin {
|
|
25 |
$dir = dirname(__FILE__) . '/';
|
26 |
require_once($dir . 'class-tooltip.php');
|
27 |
require_once($dir . 'class-admin.php');
|
28 |
-
require_once($dir . 'class-
|
|
|
29 |
require_once($dir . 'class-credits-admin.php');
|
30 |
require_once($dir . 'class-trademarks-admin.php');
|
31 |
$intro = new Footer_Putter_Dashboard(FOOTER_PUTTER_VERSION, FOOTER_PUTTER_PATH, FOOTER_PUTTER_PLUGIN_NAME);
|
12 |
|
13 |
public static function init() {
|
14 |
$dir = dirname(__FILE__) . '/';
|
|
|
|
|
15 |
require_once($dir . 'class-utils.php');
|
16 |
+
require_once($dir . 'class-diy-options.php');
|
17 |
+
require_once($dir . 'class-credits-options.php');
|
18 |
+
require_once($dir . 'class-credits.php');
|
19 |
+
require_once($dir . 'class-credits-widgets.php');
|
20 |
+
require_once($dir . 'class-trademarks-widgets.php');
|
21 |
Footer_Credits_Options::init();
|
22 |
Footer_Credits::init();
|
23 |
}
|
26 |
$dir = dirname(__FILE__) . '/';
|
27 |
require_once($dir . 'class-tooltip.php');
|
28 |
require_once($dir . 'class-admin.php');
|
29 |
+
require_once($dir . 'class-feed-widget.php');
|
30 |
+
require_once($dir . 'class-dashboard.php');
|
31 |
require_once($dir . 'class-credits-admin.php');
|
32 |
require_once($dir . 'class-trademarks-admin.php');
|
33 |
$intro = new Footer_Putter_Dashboard(FOOTER_PUTTER_VERSION, FOOTER_PUTTER_PATH, FOOTER_PUTTER_PLUGIN_NAME);
|
classes/class-tooltip.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
class Footer_Putter_Tooltip {
|
3 |
|
4 |
-
|
5 |
|
6 |
private $labels = array();
|
7 |
private $tabindex;
|
@@ -28,12 +28,12 @@ class Footer_Putter_Tooltip {
|
|
28 |
function tip($label,$args=false) {
|
29 |
$heading = $this->heading($label, $args);
|
30 |
return $heading ? sprintf('<a href="#" class="diy-tooltip" tabindex="%3$s">%1$s<span class="tip">%2$s</span></a>',
|
31 |
-
$heading, $this->text($label, $args), $this->tabindex++) :
|
32 |
}
|
33 |
|
34 |
function apply_args($content, $args = false) {
|
35 |
if ($args && (strpos($content, '$s') !== FALSE)) {
|
36 |
-
if (is_array($args))
|
37 |
switch (count($args)) {
|
38 |
case 4: $content = sprintf($content, $args[0], $args[1], $args[2], $args[3]);
|
39 |
case 3: $content = sprintf($content, $args[0], $args[1], $args[2]);
|
1 |
<?php
|
2 |
class Footer_Putter_Tooltip {
|
3 |
|
4 |
+
const HELP = '<span class="dashicons dashicons-editor-help"></span>';
|
5 |
|
6 |
private $labels = array();
|
7 |
private $tabindex;
|
28 |
function tip($label,$args=false) {
|
29 |
$heading = $this->heading($label, $args);
|
30 |
return $heading ? sprintf('<a href="#" class="diy-tooltip" tabindex="%3$s">%1$s<span class="tip">%2$s</span></a>',
|
31 |
+
$heading, $this->text($label, $args), $this->tabindex++) : ucfirst($label);
|
32 |
}
|
33 |
|
34 |
function apply_args($content, $args = false) {
|
35 |
if ($args && (strpos($content, '$s') !== FALSE)) {
|
36 |
+
if (is_array($args))
|
37 |
switch (count($args)) {
|
38 |
case 4: $content = sprintf($content, $args[0], $args[1], $args[2], $args[3]);
|
39 |
case 3: $content = sprintf($content, $args[0], $args[1], $args[2]);
|
classes/class-trademarks-admin.php
CHANGED
@@ -14,7 +14,9 @@ class Footer_Trademarks_Admin extends Footer_Putter_Admin{
|
|
14 |
|
15 |
public function page_content() {
|
16 |
$title = $this->admin_heading('Footer Trademarks', FOOTER_PUTTER_ICON);
|
17 |
-
$this->
|
|
|
|
|
18 |
do_meta_boxes($this->get_screen_id(), 'normal', null);
|
19 |
$this->print_admin_form_end(__CLASS__);
|
20 |
}
|
@@ -26,6 +28,7 @@ class Footer_Trademarks_Admin extends Footer_Putter_Admin{
|
|
26 |
$this->add_meta_box('intro', 'Instructions', 'intro_panel');
|
27 |
$this->add_meta_box('tips', 'Tips', 'tips_panel');
|
28 |
$this->add_meta_box('screenshots','Screenshots', 'screenshots_panel');
|
|
|
29 |
}
|
30 |
|
31 |
public function intro_panel() {
|
@@ -36,11 +39,11 @@ class Footer_Trademarks_Admin extends Footer_Putter_Admin{
|
|
36 |
<p class="attention">There are no settings on this page.</p>
|
37 |
<p class="attention">However, links are provided to where you set up trademarks or other symbols you want to appear in the footer.</p>
|
38 |
|
39 |
-
<p class="bigger">Firstly go to the <a href="{$linkcat}">Link Categories</a> and set up a link category called <i>
|
40 |
<p class="bigger">Next go to the <a href="{$addlink}">Add Link</a> and add a link for each trademark
|
41 |
specifying the Image URL, and optionally the link URL and of course adding each link to your chosen link category.
|
42 |
<p class="bigger">Finally go to the <a href="{$widgets}">Appearance | Widgets</a> and drag a trademark widget into the custom footer widget
|
43 |
-
area and select <i>
|
44 |
INTRO;
|
45 |
}
|
46 |
|
@@ -66,4 +69,8 @@ TIPS;
|
|
66 |
SCREENSHOTS;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
69 |
}
|
14 |
|
15 |
public function page_content() {
|
16 |
$title = $this->admin_heading('Footer Trademarks', FOOTER_PUTTER_ICON);
|
17 |
+
$this->print_admin_form_with_sidebar_start($title);
|
18 |
+
do_meta_boxes($this->get_screen_id(), 'side', null);
|
19 |
+
$this->print_admin_form_with_sidebar_middle();
|
20 |
do_meta_boxes($this->get_screen_id(), 'normal', null);
|
21 |
$this->print_admin_form_end(__CLASS__);
|
22 |
}
|
28 |
$this->add_meta_box('intro', 'Instructions', 'intro_panel');
|
29 |
$this->add_meta_box('tips', 'Tips', 'tips_panel');
|
30 |
$this->add_meta_box('screenshots','Screenshots', 'screenshots_panel');
|
31 |
+
$this->add_meta_box('news', 'DIY Webmastery News', 'news_panel',null, 'side');
|
32 |
}
|
33 |
|
34 |
public function intro_panel() {
|
39 |
<p class="attention">There are no settings on this page.</p>
|
40 |
<p class="attention">However, links are provided to where you set up trademarks or other symbols you want to appear in the footer.</p>
|
41 |
|
42 |
+
<p class="bigger">Firstly go to the <a href="{$linkcat}">Link Categories</a> and set up a link category called <i>Trust Marks</i> or something similar.</p>
|
43 |
<p class="bigger">Next go to the <a href="{$addlink}">Add Link</a> and add a link for each trademark
|
44 |
specifying the Image URL, and optionally the link URL and of course adding each link to your chosen link category.
|
45 |
<p class="bigger">Finally go to the <a href="{$widgets}">Appearance | Widgets</a> and drag a trademark widget into the custom footer widget
|
46 |
+
area and select <i>Trust Marks</i> as the link category.</p>
|
47 |
INTRO;
|
48 |
}
|
49 |
|
69 |
SCREENSHOTS;
|
70 |
}
|
71 |
|
72 |
+
function news_panel($post,$metabox){
|
73 |
+
Footer_Putter_Feed_Widget::display_feeds();
|
74 |
+
}
|
75 |
+
|
76 |
}
|
classes/class-trademarks-widgets.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Footer_Putter_Trademark_Widget extends WP_Widget {
|
4 |
+
|
5 |
+
private $instance;
|
6 |
+
private $tooltips;
|
7 |
+
|
8 |
+
private $tips = array(
|
9 |
+
'title' => array('heading' => 'Title', 'tip' => 'Widget Title'),
|
10 |
+
'category' => array('heading' => 'Category', 'tip' => 'Select Link Category for Your Trademarks'),
|
11 |
+
'limit' => array('heading' => 'Number of links', 'tip' => 'Number of trademarks to show'),
|
12 |
+
'orderby' => array('heading' => 'Order By', 'tip' => 'Sort by name, rating, ID or random'),
|
13 |
+
'nofollow' => array('heading' => 'Make Links Nofollow', 'tip' => 'Mark the links with rel=nofollow'),
|
14 |
+
'visibility' => array('heading' => 'Widget Visibility', 'tip' => 'Determine on which pages the footer widget is displayed'),
|
15 |
+
);
|
16 |
+
|
17 |
+
private $defaults = array( 'title' => '',
|
18 |
+
'category' => false, 'limit' => '', 'orderby' => 'name', 'nofollow' => false, 'visibility' => '');
|
19 |
+
|
20 |
+
function get_tips() {
|
21 |
+
return $this->tips;
|
22 |
+
}
|
23 |
+
|
24 |
+
function get_defaults() {
|
25 |
+
return $this->defaults;
|
26 |
+
}
|
27 |
+
|
28 |
+
function __construct() {
|
29 |
+
add_filter('pre_option_link_manager_enabled', '__return_true' );
|
30 |
+
$widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks') );
|
31 |
+
parent::__construct('footer_trademarks', __('Trademarks Widget'), $widget_ops);
|
32 |
+
}
|
33 |
+
|
34 |
+
function nofollow_links( $content) {
|
35 |
+
return preg_replace_callback( '/<a([^>]*)>(.*?)<\/a[^>]*>/is', array( &$this, 'nofollow_link' ), $content ) ;
|
36 |
+
}
|
37 |
+
|
38 |
+
function nofollow_link($matches) { //make link nofollow
|
39 |
+
$attrs = shortcode_parse_atts( stripslashes ($matches[ 1 ]) );
|
40 |
+
$atts='';
|
41 |
+
$rel = ' rel="nofollow"';
|
42 |
+
foreach ( $attrs AS $key => $value ) {
|
43 |
+
$key = strtolower($key);
|
44 |
+
$nofollow = '';
|
45 |
+
if ('rel' == $key) {
|
46 |
+
$rel = '';
|
47 |
+
if (strpos($value, 'follow') === FALSE) $nofollow = ' nofollow';
|
48 |
+
}
|
49 |
+
$atts .= sprintf(' %1$s="%2$s%3$s"', $key, $value, $nofollow);
|
50 |
+
}
|
51 |
+
return sprintf('<a%1$s%2$s>%3$s</a>', $rel, $atts, $matches[ 2 ]);
|
52 |
+
}
|
53 |
+
|
54 |
+
function widget( $args, $instance ) {
|
55 |
+
extract($args, EXTR_SKIP);
|
56 |
+
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
57 |
+
if (Footer_Putter_Utils::hide_widget($instance['visibility'])) return; //check visibility requirements
|
58 |
+
|
59 |
+
$title = apply_filters('widget_title', $instance['title'] );
|
60 |
+
$category = isset($instance['category']) ? $instance['category'] : false;
|
61 |
+
$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
|
62 |
+
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
|
63 |
+
$limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
|
64 |
+
$nofollow = isset( $instance['nofollow'] ) && $instance['nofollow'];
|
65 |
+
|
66 |
+
$links = wp_list_bookmarks(apply_filters('widget_links_args', array(
|
67 |
+
'echo' => 0,
|
68 |
+
'title_before' => $before_title, 'title_after' => $after_title,
|
69 |
+
'title_li' => '', 'categorize' => false,
|
70 |
+
'before' => '', 'after' => '',
|
71 |
+
'category_before' => '', 'category_after' => '',
|
72 |
+
'show_images' => true, 'show_description' => false,
|
73 |
+
'show_name' => false, 'show_rating' => false,
|
74 |
+
'category' => $category, 'class' => 'trademark widget',
|
75 |
+
'orderby' => $orderby, 'order' => $order,
|
76 |
+
'limit' => $limit,
|
77 |
+
)));
|
78 |
+
echo $before_widget;
|
79 |
+
if ($title) echo $before_title . $title . $after_title;
|
80 |
+
if ($nofollow)
|
81 |
+
echo $this->nofollow_links($links);
|
82 |
+
else
|
83 |
+
echo $links;
|
84 |
+
echo $after_widget;
|
85 |
+
}
|
86 |
+
|
87 |
+
function update( $new_instance, $old_instance ) {
|
88 |
+
$new_instance = (array) $new_instance;
|
89 |
+
$instance = wp_parse_args( (array) $old_instance, $this->defaults );
|
90 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
91 |
+
$instance['orderby'] = 'name';
|
92 |
+
if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
|
93 |
+
$instance['orderby'] = $new_instance['orderby'];
|
94 |
+
$instance['category'] = intval( $new_instance['category'] );
|
95 |
+
$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : '';
|
96 |
+
$instance['nofollow'] = !empty($new_instance['nofollow']);
|
97 |
+
$instance['visibility'] = trim($new_instance['visibility']);
|
98 |
+
return $instance;
|
99 |
+
}
|
100 |
+
|
101 |
+
function form( $instance ) {
|
102 |
+
$this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
|
103 |
+
$this->tooltips = new Footer_Putter_Tooltip($this->get_tips());
|
104 |
+
|
105 |
+
$links = array();
|
106 |
+
$link_cats = get_terms( 'link_category' );
|
107 |
+
foreach ( $link_cats as $link_cat ) {
|
108 |
+
$id = intval($link_cat->term_id);
|
109 |
+
$links[$id] = $link_cat->name;
|
110 |
+
}
|
111 |
+
$this->print_form_field('title', 'text', array(), array('size' => 10));
|
112 |
+
$this->print_form_field('category', 'select', $links);
|
113 |
+
$this->print_form_field('orderby', 'select', array(
|
114 |
+
'name' => __( 'Link title'),
|
115 |
+
'rating' => __( 'Link rating'),
|
116 |
+
'id' => __( 'Link ID'),
|
117 |
+
'rand' => __( 'Random')
|
118 |
+
));
|
119 |
+
$this->print_form_field('limit', 'text', array(), array('size' => 3 ,'maxlength' => 3));
|
120 |
+
$this->print_form_field('nofollow', 'checkbox');
|
121 |
+
$this->print_form_field('visibility', 'radio',
|
122 |
+
Footer_Putter_Utils::get_visibility_options(), array('separator' => '<br />'));
|
123 |
+
}
|
124 |
+
|
125 |
+
function print_form_field ($fld, $type, $options = array(), $args = array()) {
|
126 |
+
$value = array_key_exists($fld,$this->instance) ? $this->instance[$fld] : false;
|
127 |
+
print Footer_Putter_Utils::form_field(
|
128 |
+
$this->get_field_id($fld), $this->get_field_name($fld), $this->tooltips->tip($fld), $value, $type, $options, $args,'br');
|
129 |
+
}
|
130 |
+
}
|
classes/class-utils.php
CHANGED
@@ -45,7 +45,7 @@ class Footer_Putter_Utils {
|
|
45 |
&& ($options = @unserialize($meta))
|
46 |
&& is_array($options))
|
47 |
return $options;
|
48 |
-
else
|
49 |
return false;
|
50 |
}
|
51 |
|
45 |
&& ($options = @unserialize($meta))
|
46 |
&& is_array($options))
|
47 |
return $options;
|
48 |
+
else
|
49 |
return false;
|
50 |
}
|
51 |
|
main.php
CHANGED
@@ -3,20 +3,20 @@
|
|
3 |
* Plugin Name: Footer Putter
|
4 |
* Plugin URI: http://www.diywebmastery.com/plugins/footer-putter/
|
5 |
* Description: Put a footer on your site that boosts your credibility with both search engines and human visitors.
|
6 |
-
* Version: 1.
|
7 |
* Author: Russell Jamieson
|
8 |
* Author URI: http://www.diywebmastery.com/about/
|
9 |
* License: GPLv2+
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
-
define('FOOTER_PUTTER_VERSION','1.
|
13 |
define('FOOTER_PUTTER_FRIENDLY_NAME', 'Footer Putter') ;
|
14 |
define('FOOTER_PUTTER_DOMAIN', 'FOOTER_PUTTER_DOMAIN') ;
|
15 |
define('FOOTER_PUTTER_PATH', plugin_basename(__FILE__)) ;
|
16 |
define('FOOTER_PUTTER_PLUGIN_NAME', plugin_basename(dirname(__FILE__))) ;
|
17 |
define('FOOTER_PUTTER_HOME_URL','http://www.diywebmastery.com/plugins/footer-putter/');
|
18 |
define('FOOTER_PUTTER_ICON','dashicons-arrow-down-alt');
|
19 |
-
|
20 |
require_once(dirname(__FILE__) . '/classes/class-plugin.php');
|
21 |
add_action ('init', array('Footer_Putter_Plugin', 'init'), 0);
|
22 |
if (is_admin()) add_action ('init', array('Footer_Putter_Plugin', 'admin_init'), 0);
|
3 |
* Plugin Name: Footer Putter
|
4 |
* Plugin URI: http://www.diywebmastery.com/plugins/footer-putter/
|
5 |
* Description: Put a footer on your site that boosts your credibility with both search engines and human visitors.
|
6 |
+
* Version: 1.12
|
7 |
* Author: Russell Jamieson
|
8 |
* Author URI: http://www.diywebmastery.com/about/
|
9 |
* License: GPLv2+
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
+
define('FOOTER_PUTTER_VERSION','1.12');
|
13 |
define('FOOTER_PUTTER_FRIENDLY_NAME', 'Footer Putter') ;
|
14 |
define('FOOTER_PUTTER_DOMAIN', 'FOOTER_PUTTER_DOMAIN') ;
|
15 |
define('FOOTER_PUTTER_PATH', plugin_basename(__FILE__)) ;
|
16 |
define('FOOTER_PUTTER_PLUGIN_NAME', plugin_basename(dirname(__FILE__))) ;
|
17 |
define('FOOTER_PUTTER_HOME_URL','http://www.diywebmastery.com/plugins/footer-putter/');
|
18 |
define('FOOTER_PUTTER_ICON','dashicons-arrow-down-alt');
|
19 |
+
define('FOOTER_PUTTER_NEWS', 'http://www.diywebmastery.com/tags/newsfeed/feed/?images=&featured_only');
|
20 |
require_once(dirname(__FILE__) . '/classes/class-plugin.php');
|
21 |
add_action ('init', array('Footer_Putter_Plugin', 'init'), 0);
|
22 |
if (is_admin()) add_action ('init', array('Footer_Putter_Plugin', 'admin_init'), 0);
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: powerblogservice, diywebmastery
|
|
3 |
Donate link: http://www.diywebmastery.com/donate/
|
4 |
Tags: footer, copyright, trademark
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -48,6 +48,8 @@ Put a footer on your site that boosts your credibility with both search engines
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
51 |
= 1.11 = Add option to set Copyright Text
|
52 |
|
53 |
= 1.10 = Updated tooltips to use dash-icons font
|
@@ -58,8 +60,8 @@ For full version history please see http://www.diywebmastery.com/plugins/footer-
|
|
58 |
|
59 |
== Upgrade Notice ==
|
60 |
|
61 |
-
= 1.
|
62 |
-
* Optional -
|
63 |
|
64 |
== Links ==
|
65 |
|
3 |
Donate link: http://www.diywebmastery.com/donate/
|
4 |
Tags: footer, copyright, trademark
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.1
|
7 |
+
Stable tag: 1.12
|
8 |
License: GPLv2+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.12 = Updated for WordPress 4.1, bug fix to privacy page terms, and added useful links and DIYWebmastery news feed sections in the sidebar
|
52 |
+
|
53 |
= 1.11 = Add option to set Copyright Text
|
54 |
|
55 |
= 1.10 = Updated tooltips to use dash-icons font
|
60 |
|
61 |
== Upgrade Notice ==
|
62 |
|
63 |
+
= 1.12 =
|
64 |
+
* Optional - Update for WordPress 4.1 , admin improvements
|
65 |
|
66 |
== Links ==
|
67 |
|