Footer Putter - Version 1.13

Version Description

  • Checked for WordPress 4.3 compatibility
  • Updated to use Admin Notices
  • Added option to hide Powered By WordPress on the TwentySomething themes
  • Re-enabled Admin Toolbar if all actions were removed on the wp_footer hook
Download this release

Release Info

Developer powerblogservice
Plugin Icon 128x128 Footer Putter
Version 1.13
Comparing to
See all releases

Code changes from version 1.12 to 1.13

classes/class-admin.php CHANGED
@@ -7,19 +7,25 @@ abstract class Footer_Putter_Admin {
7
  protected $screen_id;
8
  private $tooltips;
9
  private $tips = array();
 
10
 
11
  function __construct($version, $path, $parent_slug, $slug = '') {
12
  $this->version = $version;
13
  $this->path = $path;
14
  $this->parent_slug = $parent_slug;
15
- if (empty($slug))
16
- $this->slug = $this->parent_slug;
17
- else
18
- $this->slug = $this->parent_slug.'-'.$slug;
19
  $this->tooltips = new Footer_Putter_Tooltip($this->tips);
20
  $this->init();
21
  }
22
 
 
 
 
 
 
 
 
 
23
  function get_screen_id(){
24
  return $this->screen_id;
25
  }
@@ -57,6 +63,16 @@ abstract class Footer_Putter_Admin {
57
  return $this->tooltips->tip($label);
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
60
  function plugin_action_links ( $links, $file ) {
61
  if ( is_array($links) && ($this->get_path() == $file )) {
62
  $settings_link = '<a href="' .$this->get_url() . '">Settings</a>';
@@ -78,7 +94,11 @@ abstract class Footer_Putter_Admin {
78
  }
79
 
80
  function register_tooltip_styles() {
81
- wp_register_style('diy-tooltip', plugins_url('styles/tooltip.css',dirname(__FILE__)), array(), $this->get_version());
 
 
 
 
82
  }
83
 
84
  function register_admin_styles() {
@@ -89,11 +109,6 @@ abstract class Footer_Putter_Admin {
89
  wp_enqueue_style($this->get_code('admin'));
90
  }
91
 
92
- function enqueue_tooltip_styles() {
93
- wp_enqueue_style('diy-tooltip');
94
- wp_enqueue_style('dashicons');
95
- }
96
-
97
  function enqueue_color_picker_styles() {
98
  wp_enqueue_style('wp-color-picker');
99
  }
@@ -103,16 +118,9 @@ abstract class Footer_Putter_Admin {
103
  add_action('admin_print_footer_scripts', array($this, 'enable_color_picker'));
104
  }
105
 
106
- function enable_color_picker() {
107
- print <<< SCRIPT
108
- <script type="text/javascript">
109
- //<![CDATA[
110
- jQuery(document).ready( function($) {
111
- $('.color-picker').wpColorPicker();
112
- });
113
- //]]>
114
- </script>
115
- SCRIPT;
116
  }
117
 
118
  function enqueue_postbox_scripts() {
@@ -122,20 +130,6 @@ SCRIPT;
122
  add_action('admin_footer-'.$this->get_screen_id(), array($this, 'toggle_postboxes'));
123
  }
124
 
125
- function toggle_postboxes() {
126
- $hook = $this->get_screen_id();
127
- print <<< SCRIPT
128
- <script type="text/javascript">
129
- //<![CDATA[
130
- jQuery(document).ready( function($) {
131
- $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
132
- postboxes.add_postbox_toggles('{$hook}');
133
- });
134
- //]]>
135
- </script>
136
- SCRIPT;
137
- }
138
-
139
  function add_meta_box($code, $title, $callback_func, $callback_params = null, $context = 'normal', $priority = 'core', $post_type = false ) {
140
  if (empty($post_type)) $post_type = $this->get_screen_id();
141
  add_meta_box($this->get_code($code), __($title), array($this, $callback_func), $post_type, $context, $priority, $callback_params);
@@ -144,66 +138,50 @@ SCRIPT;
144
  function form_field($id, $name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
145
  if (!$label) $label = $id;
146
  $label_args = (is_array($args) && array_key_exists('label_args', $args)) ? $args['label_args'] : false;
147
- return Footer_Putter_Utils::form_field($id, $name, $this->tooltips->tip($label, $label_args), $value, $type, $options, $args, $wrap);
148
  }
149
 
150
- function print_form_field($fld, $value, $type, $options = array(), $args = array(), $wrap = false) {
151
- print $this->form_field($fld, $fld, false, $value, $type, $options, $args, $wrap);
 
152
  }
153
 
154
- function print_text_field($fld, $value, $args = array()) {
155
- $this->print_form_field($fld, $value, 'text', array(), $args);
156
  }
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
 
165
- function print_admin_form_with_sidebar_start($title) {
166
- print <<< ADMIN_START
167
- <div class="wrap">
168
- {$title}
169
- <div id="poststuff" class="metabox-holder has-right-sidebar">
170
- <div id="side-info-column" class="inner-sidebar">
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
 
184
- function print_admin_form_start($title, $enctype = false) {
185
- $this_url = $_SERVER['REQUEST_URI'];
186
- $enctype = $enctype ? 'enctype="multipart/form-data" ' : '';
187
- print <<< ADMIN_START
188
- <div class="wrap">
189
- {$title}
190
- <div id="poststuff" {$enctype}class="metabox-holder"><div id="post-body"><div id="post-body-content">
191
- <form id="diy_options" method="post" {$enctype}action="{$this_url}">
192
- ADMIN_START;
 
 
 
193
  }
194
 
195
- function print_admin_form_end($referer = false, $keys = false, $button_text = 'Save Changes') {
196
- $nonces = $referer ? $this->get_nonces($referer) : '';
197
- $page_options = $button = '';
198
- if ($keys) {
199
- $keys = is_array($keys) ? implode(',', $keys) : $keys;
200
- $page_options = sprintf('<input type="hidden" name="page_options" value="%1$s" />', $keys);
201
- $button = $this->submit_button($button_text);
202
  }
203
- print <<< ADMIN_END
204
- <p class="submit">{$button}{$page_options}{$nonces}</p>
205
- </form></div></div><br class="clear"/></div></div>
206
- ADMIN_END;
207
  }
208
 
209
  function get_nonces($referer) {
@@ -212,14 +190,13 @@ ADMIN_END;
212
  wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false, false);
213
  }
214
 
215
- function submit_button($button_text='Save Changes') {
216
- return sprintf('<input type="submit" name="options_update" value="%1$s" class="button-primary" />', $button_text);
217
  }
218
 
219
  function save_options($options_class, $settings_name, $trim_option_prefix = false) {
220
-
221
  $page_options = explode(",", stripslashes($_POST['page_options']));
222
-
223
  if (is_array($page_options)) {
224
  $options = call_user_func( array($options_class, 'get_options'));
225
  $updates = false;
@@ -230,30 +207,25 @@ ADMIN_END;
230
  $options[$option] = $val;
231
  } //end for
232
  $saved = call_user_func( array($options_class, 'save_options'), $options) ;
233
- if ($saved) {
234
- $class='updated fade';
235
- $message = 'settings saved successfully.';
 
236
  } else {
237
- $class='error fade';
238
- $message = 'settings have not been changed.';
239
  }
240
- } else {
241
- $class='error';
242
- $message= 'settings not found!';
243
- }
244
- return sprintf('<div id="message" class="%1$s"><p>%2$s %3$s</p></div>',
245
- $class, __($settings_name), __($message));
246
  }
247
 
248
  function fetch_message() {
249
- $message = '' ;
250
  if (isset($_REQUEST['message']) && ! empty($_REQUEST['message'])) {
251
  $message = urldecode($_REQUEST['message']);
252
  $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
253
- $style = strpos($message,'success') !== FALSE ? ' success' : (strpos($message,'fail') !== FALSE ? ' error' : '');
254
- $message = sprintf('<div class="updated %2$$">%1$s</div>',$message,$style);
 
255
  }
256
- return $message;
257
  }
258
 
259
  function screen_layout_columns($columns, $screen) {
@@ -265,12 +237,90 @@ ADMIN_END;
265
  return $columns;
266
  }
267
 
268
- abstract function init() ;
 
 
 
 
 
269
 
270
- abstract function admin_menu() ;
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
- abstract function page_content();
 
 
 
 
 
 
273
 
274
- abstract function load_page();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
 
276
  }
7
  protected $screen_id;
8
  private $tooltips;
9
  private $tips = array();
10
+ private $messages = array();
11
 
12
  function __construct($version, $path, $parent_slug, $slug = '') {
13
  $this->version = $version;
14
  $this->path = $path;
15
  $this->parent_slug = $parent_slug;
16
+ $this->slug = empty($slug) ? $this->parent_slug : ( $this->parent_slug.'-'.$slug );
 
 
 
17
  $this->tooltips = new Footer_Putter_Tooltip($this->tips);
18
  $this->init();
19
  }
20
 
21
+ abstract function init() ;
22
+
23
+ abstract function admin_menu() ;
24
+
25
+ abstract function page_content();
26
+
27
+ abstract function load_page();
28
+
29
  function get_screen_id(){
30
  return $this->screen_id;
31
  }
63
  return $this->tooltips->tip($label);
64
  }
65
 
66
+ function print_admin_notices() {
67
+ foreach ($this->messages as $message)
68
+ print $message;
69
+ }
70
+
71
+ function add_admin_notice($subject, $message, $is_error = false) {
72
+ $this->messages[] = sprintf('<div class="notice is-dismissible %1$s"><p>%2$s %3$s</p></div>', $is_error ? 'error' : 'updated', __($subject), __($message));
73
+ add_action( 'admin_notices', array($this, 'print_admin_notices') );
74
+ }
75
+
76
  function plugin_action_links ( $links, $file ) {
77
  if ( is_array($links) && ($this->get_path() == $file )) {
78
  $settings_link = '<a href="' .$this->get_url() . '">Settings</a>';
94
  }
95
 
96
  function register_tooltip_styles() {
97
+ Footer_Putter_Utils::register_tooltip_styles();
98
+ }
99
+
100
+ function enqueue_tooltip_styles() {
101
+ Footer_Putter_Utils::enqueue_tooltip_styles();
102
  }
103
 
104
  function register_admin_styles() {
109
  wp_enqueue_style($this->get_code('admin'));
110
  }
111
 
 
 
 
 
 
112
  function enqueue_color_picker_styles() {
113
  wp_enqueue_style('wp-color-picker');
114
  }
118
  add_action('admin_print_footer_scripts', array($this, 'enable_color_picker'));
119
  }
120
 
121
+ function enqueue_metabox_scripts() {
122
+ wp_enqueue_style($this->get_code('tabs'), plugins_url('styles/tabs.css',dirname(__FILE__)), array(),$this->get_version());
123
+ wp_enqueue_script($this->get_code('tabs'), plugins_url('scripts/jquery.tabs.js',dirname(__FILE__)), array(),$this->get_version());
 
 
 
 
 
 
 
124
  }
125
 
126
  function enqueue_postbox_scripts() {
130
  add_action('admin_footer-'.$this->get_screen_id(), array($this, 'toggle_postboxes'));
131
  }
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  function add_meta_box($code, $title, $callback_func, $callback_params = null, $context = 'normal', $priority = 'core', $post_type = false ) {
134
  if (empty($post_type)) $post_type = $this->get_screen_id();
135
  add_meta_box($this->get_code($code), __($title), array($this, $callback_func), $post_type, $context, $priority, $callback_params);
138
  function form_field($id, $name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
139
  if (!$label) $label = $id;
140
  $label_args = (is_array($args) && array_key_exists('label_args', $args)) ? $args['label_args'] : false;
141
+ return Genesis_Club_Utils::form_field($id, $name, $this->tooltips->tip($label, $label_args), $value, $type, $options, $args, $wrap);
142
  }
143
 
144
+ function meta_form_field($meta, $key, $type, $options=array(), $args=array()) {
145
+ return $this->form_field( $meta[$key]['id'], $meta[$key]['name'], false,
146
+ $meta[$key]['value'], $type, $options, $args);
147
  }
148
 
149
+ function fetch_form_field($fld, $value, $type, $options = array(), $args = array(), $wrap = false) {
150
+ return $this->form_field($fld, $fld, false, $value, $type, $options, $args, $wrap);
151
  }
152
 
153
+ function print_form_field($fld, $value, $type, $options = array(), $args = array(), $wrap = false) {
154
+ print $this->form_field($fld, $fld, false, $value, $type, $options, $args, $wrap);
 
 
 
155
  }
156
 
157
+ function fetch_text_field($fld, $value, $args = array()) {
158
+ return $this->fetch_form_field($fld, $value, 'text', array(), $args);
 
 
 
 
 
159
  }
160
 
161
+ function print_text_field($fld, $value, $args = array()) {
162
+ $this->print_form_field($fld, $value, 'text', array(), $args);
 
 
 
 
 
 
163
  }
164
 
165
+ function get_meta_form_data($metakey, $prefix, $values ) {
166
+ $content = array();
167
+ if (($post_id = Footer_Putter_Utils::get_post_id())
168
+ && ($meta = Footer_Putter_Utils::get_meta($post_id, $metakey)))
169
+ $values = Footer_Putter_Utils::validate_options($values, $meta);
170
+ foreach ($values as $key => $val) {
171
+ $content[$key] = array();
172
+ $content[$key]['value'] = $val;
173
+ $content[$key]['id'] = $prefix.$key;
174
+ $content[$key]['name'] = $metakey. '[' . $key . ']';
175
+ }
176
+ return $content;
177
  }
178
 
179
+ function get_newsfeeds() {
180
+ return apply_filters('footer_putter_newsfeeds', array( FOOTER_PUTTER_NEWS));
 
 
 
 
 
181
  }
182
+
183
+ function news_panel($post,$metabox){
184
+ Footer_Putter_Feed_Widget::display_feeds($this->get_newsfeeds());
 
185
  }
186
 
187
  function get_nonces($referer) {
190
  wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false, false);
191
  }
192
 
193
+ function submit_button($button_text='Save Changes', $name = 'options_update') {
194
+ return sprintf('<p class="save"><input type="submit" name="%1$s" value="%2$s" class="button-primary" /></p>', $name, $button_text);
195
  }
196
 
197
  function save_options($options_class, $settings_name, $trim_option_prefix = false) {
198
+ $saved = false;
199
  $page_options = explode(",", stripslashes($_POST['page_options']));
 
200
  if (is_array($page_options)) {
201
  $options = call_user_func( array($options_class, 'get_options'));
202
  $updates = false;
207
  $options[$option] = $val;
208
  } //end for
209
  $saved = call_user_func( array($options_class, 'save_options'), $options) ;
210
+ if ($saved)
211
+ $this->add_admin_notice($settings_name, 'settings saved successfully.');
212
+ else
213
+ $this->add_admin_notice($settings_name, 'settings have not been changed.', true);
214
  } else {
215
+ $this->add_admin_notice($settings_name, 'settings not found', true);
 
216
  }
217
+ return $saved;
 
 
 
 
 
218
  }
219
 
220
  function fetch_message() {
 
221
  if (isset($_REQUEST['message']) && ! empty($_REQUEST['message'])) {
222
  $message = urldecode($_REQUEST['message']);
223
  $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
224
+ $is_error = (strpos($message,'error') !== FALSE) || (strpos($message,'fail') !== FALSE);
225
+ $this->add_admin_notice('', $message, $is_error);
226
+ return $message;
227
  }
228
+ return false;
229
  }
230
 
231
  function screen_layout_columns($columns, $screen) {
237
  return $columns;
238
  }
239
 
240
+ function admin_heading($title = '', $icon_class = '') {
241
+ if (empty($title)) $title = sprintf('%1$s %2$s', ucwords(str_replace('-',' ',$this->slug)), $this->get_version());
242
+ if (empty($icon_class)) $icon_class = GENESIS_CLUB_ICON;
243
+ $icon = sprintf('<i class="%1$s"></i>', 'dashicons-'==substr($icon_class,0,10) ? ('dashicons '.$icon_class) : $icon_class) ;
244
+ return sprintf('<h2 class="title">%2$s%1$s</h2>', $title, $icon);
245
+ }
246
 
247
+ function print_admin_form_start($title, $referer = false, $keys = false, $enctype = false, $with_sidebar = false, $preamble = false) {
248
+ $this_url = $_SERVER['REQUEST_URI'];
249
+ $enctype = $enctype ? 'enctype="multipart/form-data" ' : '';
250
+ $nonces = $referer ? $this->get_nonces($referer) : '';
251
+ $page_options = '';
252
+ if ($keys) {
253
+ $keys = is_array($keys) ? implode(',', $keys) : $keys;
254
+ $page_options = sprintf('<input type="hidden" name="page_options" value="%1$s" />', $keys);
255
+ }
256
+ $class = $with_sidebar ? ' columns-2' : '';
257
+ printf('<div class="wrap">%1$s<form id="diy_options" method="post" %2$saction="%3$s"><p>%4$s%5$s</p><div id="poststuff"><div id="post-body" class="metabox-holder%6$s"><div id="post-body-content">%7$s',
258
+ $title, $enctype, $this_url, $page_options, $nonces, $class, $preamble ? $preamble : '');
259
+ }
260
 
261
+ function print_admin_form_with_sidebar_middle() {
262
+ print '</div><div id="postbox-container-1" class="postbox-container">';
263
+ }
264
+
265
+ function print_admin_form_end() {
266
+ print '</div></div><br class="clear"/></div></form></div>';
267
+ }
268
 
269
+ function print_admin_form_with_sidebar($title, $referer = false, $keys = false, $enctype = false, $preamble = false) {
270
+ $this->print_admin_form_start ($title, $referer, $keys, $enctype, true, $preamble);
271
+ do_meta_boxes($this->get_screen_id(), 'normal', null);
272
+ if ($keys) print $this->submit_button();
273
+ do_meta_boxes($this->get_screen_id(), 'advanced', null);
274
+ $this->print_admin_form_with_sidebar_middle();
275
+ do_meta_boxes($this->get_screen_id(), 'side', null);
276
+ $this->print_admin_form_end();
277
+ }
278
+
279
+ function print_admin_form ($title, $referer = false, $keys = false, $enctype = false, $preamble = false) {
280
+ $this->print_admin_form_start ($title, $referer, $keys, $enctype, false, $preamble);
281
+ do_meta_boxes($this->get_screen_id(), 'normal', null);
282
+ if ($keys) print $this->submit_button();
283
+ do_meta_boxes($this->get_screen_id(), 'advanced', null);
284
+ $this->print_admin_form_end();
285
+ }
286
+
287
+
288
+ function display_metabox($tabs) {
289
+ $labels = $contents = '';
290
+ $t=0;
291
+ $tab = isset($_REQUEST['tabselect']) ? $_REQUEST['tabselect'] : 'tab1';
292
+ foreach ($tabs as $label => $content) {
293
+ $t++;
294
+ $labels .= sprintf('<li class="tab tab%1$s"><a href="#">%2$s</a></li>', $t, $label);
295
+ $contents .= sprintf('<div class="tab%1$s"><div class="tab-content">%2$s</div></div>', $t, $content);
296
+ }
297
+ printf('<div class="footer-putter-metabox"><ul class="footer-putter-metabox-tabs">%1$s</ul><div class="metabox-content">%2$s</div><input type="hidden" id="tabselect" name="tabselect" value="%3$s" /></div>', $labels, $contents, $tab);
298
+ }
299
+
300
+ function toggle_postboxes() {
301
+ $hook = $this->get_screen_id();
302
+ print <<< SCRIPT
303
+ <script type="text/javascript">
304
+ //<![CDATA[
305
+ jQuery(document).ready( function($) {
306
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
307
+ postboxes.add_postbox_toggles('{$hook}');
308
+ });
309
+ //]]>
310
+ </script>
311
+ SCRIPT;
312
+ }
313
+
314
+ function enable_color_picker() {
315
+ print <<< SCRIPT
316
+ <script type="text/javascript">
317
+ //<![CDATA[
318
+ jQuery(document).ready( function($) {
319
+ $('.color-picker').wpColorPicker();
320
+ });
321
+ //]]>
322
+ </script>
323
+ SCRIPT;
324
+ }
325
 
326
  }
classes/class-credits-admin.php CHANGED
@@ -2,10 +2,10 @@
2
  class Footer_Credits_Admin extends Footer_Putter_Admin{
3
 
4
  private $tips = array(
5
- 'owner' => array('heading' => 'Owner or Business Name', 'tip' => 'Enter the name of the legal entity that owns and operates the site.'),
6
- 'microdata' => array('heading' => 'Use Microdata', 'tip' => 'Markup the organization details with HTML5 microdata.'),
7
  'address' => array('heading' => 'Full Address', 'tip' => 'Enter the full address that you want to appear in the footer and the privacy and terms pages.'),
8
- 'street_address' => array('heading' => 'Street Address', 'tip' => 'Enter the firat line of the address that you want to appear in the footer and the privacy and terms pages.'),
9
  'locality' => array('heading' => 'Locality (City)', 'tip' => 'Enter the town or city.'),
10
  'region' => array('heading' => 'State (Region)', 'tip' => 'Enter the state, province, region or county.'),
11
  'postal_code' => array('heading' => 'Postal Code', 'tip' => 'Enter the postal code.'),
@@ -23,10 +23,11 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
23
  'return_class' => array('heading' => 'Return To Top Class' , 'tip' => 'Add any custom class you want to apply to the Return To Top link.'),
24
  'footer_class' => array('heading' => 'Footer Class' , 'tip' => 'Add any custom class you want to apply to the footer. The plugin comes with a class <i>white</i> that marks the text in the footer white. This is useful where the footer background is a dark color.'),
25
  'footer_hook' => array('heading' => 'Footer Action Hook' , 'tip' => 'The hook where the footer widget area is added to the page. This field is only required if the theme does not already provide a suitable widget area where the footer widgets can be added.'),
26
- 'footer_remove' => array('heading' => 'Remove Existing Actions?' , 'tip' => 'Click the checkbox to remove any other actions at the above footer hook. This may stop you getting two footers; one created by your theme and another created by this plugin. For some themes you will check this option as you will typically want to replace the theme footer by the plugin footer.'),
27
  'footer_filter_hook' => array('heading' => 'Footer Filter Hook' , 'tip' => 'If you want to kill off the footer created by your theme, and your theme allows you to filter the content of the footer, then enter the hook where the theme filters the footer. This may stop you getting two footers; one created by your theme and another created by this plugin.'),
28
  'privacy_contact' => array('heading' => 'Add Privacy Contact?', 'tip' => 'Add a section to the end of the Privacy page with contact information'),
29
  'terms_contact' => array('heading' => 'Add Terms Contact?', 'tip' => 'Add a section to the end of the Terms page with contact and legal information'),
 
30
  );
31
 
32
  function init() {
@@ -41,29 +42,19 @@ 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->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
  }
50
 
51
  function load_page() {
52
- $message = isset($_POST['options_update']) ? $this->save_credits() : '';
53
- $options = Footer_Credits_Options::get_options();
54
- $callback_params = array ('options' => $options, 'message' => $message);
55
- $this->add_meta_box('introduction', 'Introduction' , 'intro_panel', $callback_params);
56
- $this->add_meta_box('owner', 'Site Owner Details' , 'owner_panel', $callback_params);
57
- $this->add_meta_box('contact', 'Contact Details' , 'contact_panel', $callback_params);
58
- $this->add_meta_box('legal', 'Legal Details' , 'legal_panel', $callback_params);
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'));
 
67
  add_action('admin_enqueue_scripts',array($this, 'enqueue_postbox_scripts'));
68
  }
69
 
@@ -71,81 +62,87 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
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
81
- <p>The following information is used in the Footer Copyright Widget and optionally at the end of the Privacy Statement and Terms and Conditions pages.</p>
82
- {$message}
83
- INTRO_PANEL;
84
  }
 
 
 
 
 
85
 
86
- function owner_panel($post,$metabox) {
87
- $terms = $metabox['args']['options']['terms'];
88
- $this->print_text_field('owner', $terms['owner'], array('size' =>30));
89
- $this->print_text_field('country', $terms['country'], array('size' => 30));
90
- $this->print_text_field('address', $terms['address'], array('size' => 80));
91
  if (Footer_Credits::is_html5()) {
92
- print('<p>Leave the above address field blank and fill in the various parts of the organization address below if you want to be able to use HTML5 microdata.</p>');
93
- print('<h4>Organization Address</h4>');
94
- $this->print_text_field('street_address', $terms['street_address'], array('size' => 30));
95
- $this->print_text_field('locality', $terms['locality'], array('size' => 30));
96
- $this->print_text_field('region', $terms['region'], array('size' => 30));
97
- $this->print_text_field('postal_code', $terms['postal_code'], array('size' => 12));
98
- print('<h4>Geographical Co-ordinates</h4>');
99
- print('<p>The geographical co-ordinates are optional and are visible only to the search engines.</p>');
100
- $this->print_text_field('latitude', $terms['latitude'], array('size' => 12));
101
- $this->print_text_field('longitude', $terms['longitude'], array('size' => 12));
102
- $this->print_text_field('map', $terms['map'], array('size' =>30));
 
 
 
103
  }
104
  }
105
 
106
- function contact_panel($post,$metabox) {
107
- $terms = $metabox['args']['options']['terms'];
108
- $this->print_text_field('email', $terms['email'], array('size' => 30));
109
- $this->print_text_field('telephone', $terms['telephone'], array('size' => 30));
110
- $this->print_form_field('privacy_contact', $terms['privacy_contact'], 'checkbox');
111
- $this->print_form_field('terms_contact', $terms['terms_contact'], 'checkbox');
112
  }
113
 
114
- function legal_panel($post,$metabox) {
115
- $terms = $metabox['args']['options']['terms'];
116
- $this->print_text_field('courts', $terms['courts'], array('size' => 80));
117
- $this->print_text_field('updated', $terms['updated'], array('size' => 30));
118
- $this->print_text_field('copyright_preamble', $terms['copyright_preamble'], array('size' => 30));
119
- $this->print_text_field('copyright_start_year', $terms['copyright_start_year'], array('size' => 5));
120
  }
121
 
122
- function return_panel($post,$metabox) {
123
- $options = $metabox['args']['options'];
124
- $this->print_text_field('return_text', $options['return_text'], array('size' => 20));
125
  }
126
 
127
- function preview_panel($post,$metabox) {
128
- $options = $metabox['args']['options'];
129
- echo Footer_Credits::footer(array('nav_menu' => 'Footer Menu'));
130
- }
131
-
132
- function advanced_panel($post,$metabox) {
133
- $options = $metabox['args']['options'];
134
  $url = 'http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks';
135
- print <<< ADVANCED_PANEL
136
  <p>You can place the Copyright and Trademark widgets in any existing widget area. However, if your theme does not have a suitably located widget area in the footer then you can create one by specifying the hook
137
  where the Widget Area will be located.</p>
138
  <p>You may use a standard WordPress hook like <i>get_footer</i> or <i>wp_footer</i> or choose a hook that is theme-specific such as <i>twentyten_credits</i>,
139
  <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,<i>twentythirteen_credits</i> or <i>twentyfourteen_credits</i>. If you using a Genesis child theme and the theme does not have a suitable widget area then use
140
  the hook <i>genesis_footer</i> or maybe <i>genesis_after</i>. See what looks best. Click for <a href="{$url}">suggestions of which hook to use for common WordPress themes</a>.</p>
141
  ADVANCED_PANEL;
142
- $this->print_text_field('footer_hook', $options['footer_hook'], array('size' => 30));
143
- $this->print_form_field('footer_remove', $options['footer_remove'], 'checkbox');
144
- print <<< REMOVE_PANEL
145
  <p>If your WordPress theme supplies a filter hook rather than an action hook where it generates the footer, and you want to suppress the theme footer,
146
  then specify the hook below. For example, entering <i>genesis_footer_output</i> will suppress the standard Genesis child theme footer.</p>
147
  REMOVE_PANEL;
148
- $this->print_text_field('footer_filter_hook', $options['footer_filter_hook'], array('size' => 30));
 
 
 
149
  }
150
 
151
  function save_credits() {
@@ -163,18 +160,17 @@ REMOVE_PANEL;
163
  case 'footer_filter_hook': $options[$option] = preg_replace('/\W/','',$val); break;
164
  default: $options[$option] = trim($val);
165
  }
166
- } //end for
167
- $class='updated fade';
168
- $saved = Footer_Credits_Options::save_options($options) ;
169
- if ($saved) {
170
- $message = 'Footer Settings saved.';
171
- } else
172
- $message = 'Footer Settings have not been changed.';
173
  } else {
174
- $class='error';
175
- $message= 'Footer Settings not found!';
176
  }
177
- return sprintf('<div id="message" class="%1$s "><p>%2$s</p></div>',$class, __($message));
 
 
178
  }
179
 
180
  }
2
  class Footer_Credits_Admin extends Footer_Putter_Admin{
3
 
4
  private $tips = array(
5
+ 'owner' => array('heading' => 'Owner/Business Name', 'tip' => 'Enter the name of the legal entity that owns and operates the site.'),
6
+ 'microdata' => array('heading' => 'Use Microdata', 'tip' => 'Markup the organization details with HTML5 microdata.'),
7
  'address' => array('heading' => 'Full Address', 'tip' => 'Enter the full address that you want to appear in the footer and the privacy and terms pages.'),
8
+ 'street_address' => array('heading' => 'Street Address', 'tip' => 'Enter the firat line of the address that you want to appear in the footer and the privacy and terms pages.'),
9
  'locality' => array('heading' => 'Locality (City)', 'tip' => 'Enter the town or city.'),
10
  'region' => array('heading' => 'State (Region)', 'tip' => 'Enter the state, province, region or county.'),
11
  'postal_code' => array('heading' => 'Postal Code', 'tip' => 'Enter the postal code.'),
23
  'return_class' => array('heading' => 'Return To Top Class' , 'tip' => 'Add any custom class you want to apply to the Return To Top link.'),
24
  'footer_class' => array('heading' => 'Footer Class' , 'tip' => 'Add any custom class you want to apply to the footer. The plugin comes with a class <i>white</i> that marks the text in the footer white. This is useful where the footer background is a dark color.'),
25
  'footer_hook' => array('heading' => 'Footer Action Hook' , 'tip' => 'The hook where the footer widget area is added to the page. This field is only required if the theme does not already provide a suitable widget area where the footer widgets can be added.'),
26
+ 'footer_remove' => array('heading' => 'Remove All Actions?' , 'tip' => 'Click the checkbox to remove any other actions at the above footer hook. This may stop you getting two footers; one created by your theme and another created by this plugin. For some themes you will check this option as you will typically want to replace the theme footer by the plugin footer.'),
27
  'footer_filter_hook' => array('heading' => 'Footer Filter Hook' , 'tip' => 'If you want to kill off the footer created by your theme, and your theme allows you to filter the content of the footer, then enter the hook where the theme filters the footer. This may stop you getting two footers; one created by your theme and another created by this plugin.'),
28
  'privacy_contact' => array('heading' => 'Add Privacy Contact?', 'tip' => 'Add a section to the end of the Privacy page with contact information'),
29
  'terms_contact' => array('heading' => 'Add Terms Contact?', 'tip' => 'Add a section to the end of the Terms page with contact and legal information'),
30
+ 'hide_wordpress' => array('heading' => 'Hide WordPress link?', 'tip' => 'Hide link to WordPress.org'),
31
  );
32
 
33
  function init() {
42
 
43
  function page_content() {
44
  $title = $this->admin_heading('Footer Credits',FOOTER_PUTTER_ICON);
45
+ $this->print_admin_form_with_sidebar($title, __CLASS__, $this->get_keys());
 
 
 
 
46
  }
47
 
48
  function load_page() {
49
+ if (isset($_POST['options_update'])) $this->save_credits();
50
+ $this->add_meta_box('introduction', 'Introduction' , 'intro_panel');
51
+ $this->add_meta_box('credits', 'Footer Settings' , 'credits_panel', array ('options' => Footer_Credits_Options::get_options()));
52
+ $this->add_meta_box('example', 'Footer Preview', 'preview_panel', null, 'advanced');
53
+ $this->add_meta_box('news', 'DIY Webmastery News', 'news_panel', null, 'side');
54
+ $this->set_tooltips($this->tips);
 
 
 
 
 
 
 
55
  add_action('admin_enqueue_scripts', array($this, 'enqueue_credits_styles'));
56
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
57
+ add_action('admin_enqueue_scripts',array($this, 'enqueue_metabox_scripts'));
58
  add_action('admin_enqueue_scripts',array($this, 'enqueue_postbox_scripts'));
59
  }
60
 
62
  wp_enqueue_style($this->get_code(), plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),$this->get_version());
63
  }
64
 
65
+ function credits_panel($post,$metabox) {
66
+ $options = $metabox['args']['options'];
67
+ $this->display_metabox( array(
68
+ 'Owner' => $this->owner_panel($options['terms']),
69
+ 'Contact' => $this->contact_panel($options['terms']),
70
+ 'Legal' => $this->legal_panel($options['terms']),
71
+ 'Return To Top' => $this->return_panel($options),
72
+ 'Advanced' => $this->advanced_panel($options)
73
+ ));
74
+ }
75
 
76
+ function intro_panel() {
77
+ printf('<p>%1$s</p>', __('The following information is used in the Footer Copyright Widget and optionally at the end of the Privacy Statement and Terms and Conditions pages.'));
 
 
 
 
78
  }
79
+
80
+ function preview_panel() {
81
+ printf('<p><i>%1$s</i></p><hr/>%2$s', __('Note: Preview is purely illustrative. Actual footer layout on the site will vary based on footer widget settings.'), Footer_Credits::footer(array('nav_menu' => 'Footer Menu')));
82
+ }
83
+
84
 
85
+ function owner_panel($terms) {
86
+ $s = $this->fetch_text_field('owner', $terms['owner'], array('size' =>30)) .
87
+ $this->fetch_text_field('country', $terms['country'], array('size' => 30)) .
88
+ $this->fetch_form_field('address', $terms['address'], 'textarea', array(), array('cols' => 30, 'rows' => 5));
 
89
  if (Footer_Credits::is_html5()) {
90
+ return $s .
91
+ '<p>Leave the above address field blank and fill in the various parts of the organization address below if you want to be able to use HTML5 microdata.</p>'.
92
+ '<h4>Organization Address</h4>'.
93
+ $this->fetch_text_field('street_address', $terms['street_address'], array('size' => 30)) .
94
+ $this->fetch_text_field('locality', $terms['locality'], array('size' => 30)) .
95
+ $this->fetch_text_field('region', $terms['region'], array('size' => 30)) .
96
+ $this->fetch_text_field('postal_code', $terms['postal_code'], array('size' => 12)) .
97
+ '<h4>Geographical Co-ordinates</h4>'.
98
+ '<p>The geographical co-ordinates are optional and are visible only to the search engines.</p>' .
99
+ $this->fetch_text_field('latitude', $terms['latitude'], array('size' => 12)) .
100
+ $this->fetch_text_field('longitude', $terms['longitude'], array('size' => 12)) .
101
+ $this->fetch_text_field('map', $terms['map'], array('size' =>30));
102
+ } else {
103
+ return $s;
104
  }
105
  }
106
 
107
+ function contact_panel($terms) {
108
+ return
109
+ $this->fetch_text_field('email', $terms['email'], array('size' => 30)) .
110
+ $this->fetch_text_field('telephone', $terms['telephone'], array('size' => 30)) .
111
+ $this->fetch_form_field('privacy_contact', $terms['privacy_contact'], 'checkbox') .
112
+ $this->fetch_form_field('terms_contact', $terms['terms_contact'], 'checkbox');
113
  }
114
 
115
+ function legal_panel($terms) {
116
+ return
117
+ $this->fetch_text_field('courts', $terms['courts'], array('size' => 80)) .
118
+ $this->fetch_text_field('updated', $terms['updated'], array('size' => 30)) .
119
+ $this->fetch_text_field('copyright_preamble', $terms['copyright_preamble'], array('size' => 30)) .
120
+ $this->fetch_text_field('copyright_start_year', $terms['copyright_start_year'], array('size' => 5));
121
  }
122
 
123
+ function return_panel($options) {
124
+ return $this->fetch_text_field('return_text', $options['return_text'], array('size' => 20));
 
125
  }
126
 
127
+ function advanced_panel($options) {
 
 
 
 
 
 
128
  $url = 'http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks';
129
+ $before = <<< ADVANCED_PANEL
130
  <p>You can place the Copyright and Trademark widgets in any existing widget area. However, if your theme does not have a suitably located widget area in the footer then you can create one by specifying the hook
131
  where the Widget Area will be located.</p>
132
  <p>You may use a standard WordPress hook like <i>get_footer</i> or <i>wp_footer</i> or choose a hook that is theme-specific such as <i>twentyten_credits</i>,
133
  <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,<i>twentythirteen_credits</i> or <i>twentyfourteen_credits</i>. If you using a Genesis child theme and the theme does not have a suitable widget area then use
134
  the hook <i>genesis_footer</i> or maybe <i>genesis_after</i>. See what looks best. Click for <a href="{$url}">suggestions of which hook to use for common WordPress themes</a>.</p>
135
  ADVANCED_PANEL;
136
+ $f = $this->fetch_text_field('footer_hook', $options['footer_hook'], array('size' => 30)) .
137
+ $this->fetch_form_field('footer_remove', $options['footer_remove'], 'checkbox');
138
+ $after = <<< REMOVE_PANEL
139
  <p>If your WordPress theme supplies a filter hook rather than an action hook where it generates the footer, and you want to suppress the theme footer,
140
  then specify the hook below. For example, entering <i>genesis_footer_output</i> will suppress the standard Genesis child theme footer.</p>
141
  REMOVE_PANEL;
142
+ $hook = $this->fetch_text_field('footer_filter_hook', $options['footer_filter_hook'], array('size' => 30));
143
+ if (($theme = wp_get_theme()) && (strpos(strtolower($theme->get('Name')), 'twenty') !== FALSE))
144
+ $hook .= $this->fetch_form_field('hide_wordpress', $options['hide_wordpress'], 'checkbox');
145
+ return $before . $f . $after . $hook;
146
  }
147
 
148
  function save_credits() {
160
  case 'footer_filter_hook': $options[$option] = preg_replace('/\W/','',$val); break;
161
  default: $options[$option] = trim($val);
162
  }
163
+ } //end for ;
164
+ $saved = Footer_Credits_Options::save_options($options) ;
165
+ $message = $saved ? 'updated successfully' : 'have not been updated';
166
+ $is_error = false;
 
 
 
167
  } else {
168
+ $message= 'not found!';
169
+ $is_error = true;
170
  }
171
+
172
+ $this->add_admin_notice('Footer Settings ', $message, $is_error);
173
+ return $saved;
174
  }
175
 
176
  }
classes/class-credits-options.php CHANGED
@@ -45,7 +45,8 @@ class Footer_Credits_Options {
45
  'footer_remove' => true,
46
  'footer_filter_hook' => '',
47
  'visibility' => '' ,
48
- 'use_microdata' => false
 
49
  );
50
 
51
  public static function init() {
45
  'footer_remove' => true,
46
  'footer_filter_hook' => '',
47
  'visibility' => '' ,
48
+ 'use_microdata' => false,
49
+ 'hide_wordpress' => false
50
  );
51
 
52
  public static function init() {
classes/class-credits-widgets.php CHANGED
@@ -20,7 +20,7 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
20
  'show_return' => array('heading' => 'Show Return To Top Links', 'tip' => 'Show link to return to the top of the page'),
21
  'return_class' => array('heading' => 'Return To Top', 'tip' => 'Add custom classes to apply to the return to top links'),
22
  'footer_class' => array('heading' => 'Footer Credits', 'tip' => 'Add custom classes to apply to the footer menu, copyright and contact information'),
23
- 'visibility' => array('heading' => 'Widget Visibility', 'tip' => 'Determine on which pages the footer widget is displayed'),
24
  );
25
 
26
  function get_tips() {
@@ -74,8 +74,10 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
74
 
75
  $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
76
  $this->tooltips = new Footer_Putter_Tooltip($this->get_tips());
77
-
78
  $this->print_form_field('nav_menu', 'select', $menus);
 
 
79
  $this->print_form_field('center', 'checkbox');
80
  $this->print_form_field('two_lines', 'checkbox');
81
  $this->print_form_field('show_copyright', 'checkbox');
@@ -86,7 +88,7 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
86
  if (Footer_Putter_Utils::is_html5()) $this->print_form_field('use_microdata', 'checkbox');
87
 
88
  print <<< CUSTOM_CLASSES
89
- <h4>Custom Classes (Optional)</h4>
90
  <p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
91
  <p>For your convenience we have defined 3 color classes <i>dark</i>, <i>light</i> and <i>white</i>, and 2 size classes,
92
  <i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes.</p>
@@ -94,7 +96,9 @@ CUSTOM_CLASSES;
94
 
95
  $this->print_form_field('return_class', 'text', array(), array('size' => 10));
96
  $this->print_form_field('footer_class', 'text', array(), array('size' => 10));
 
97
  $this->print_form_field('visibility', 'radio', Footer_Putter_Utils::get_visibility_options(), array('separator' => '<br />'));
 
98
  }
99
 
100
  function print_form_field($fld, $type, $options = array(), $args = array()) {
20
  'show_return' => array('heading' => 'Show Return To Top Links', 'tip' => 'Show link to return to the top of the page'),
21
  'return_class' => array('heading' => 'Return To Top', 'tip' => 'Add custom classes to apply to the return to top links'),
22
  'footer_class' => array('heading' => 'Footer Credits', 'tip' => 'Add custom classes to apply to the footer menu, copyright and contact information'),
23
+ 'visibility' => array('heading' => 'Show or Hide', 'tip' => 'Determine on which pages the footer widget is displayed'),
24
  );
25
 
26
  function get_tips() {
74
 
75
  $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
76
  $this->tooltips = new Footer_Putter_Tooltip($this->get_tips());
77
+ print '<div class="diy-wrap">';
78
  $this->print_form_field('nav_menu', 'select', $menus);
79
+ print ('<hr/><h4>Options</h4>');
80
+
81
  $this->print_form_field('center', 'checkbox');
82
  $this->print_form_field('two_lines', 'checkbox');
83
  $this->print_form_field('show_copyright', 'checkbox');
88
  if (Footer_Putter_Utils::is_html5()) $this->print_form_field('use_microdata', 'checkbox');
89
 
90
  print <<< CUSTOM_CLASSES
91
+ <hr/><h4>Custom Classes</h4>
92
  <p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
93
  <p>For your convenience we have defined 3 color classes <i>dark</i>, <i>light</i> and <i>white</i>, and 2 size classes,
94
  <i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes.</p>
96
 
97
  $this->print_form_field('return_class', 'text', array(), array('size' => 10));
98
  $this->print_form_field('footer_class', 'text', array(), array('size' => 10));
99
+ print ('<hr/><h4>Widget Presence</h4>');
100
  $this->print_form_field('visibility', 'radio', Footer_Putter_Utils::get_visibility_options(), array('separator' => '<br />'));
101
+ print '</div>';
102
  }
103
 
104
  function print_form_field($fld, $type, $options = array(), $args = array()) {
classes/class-credits.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class Footer_Credits {
4
 
5
- const CODE = 'footer-credits'; //element prefix
6
  const SIDEBAR_ID = 'last-footer';
7
 
8
  public static function init() {
@@ -50,7 +50,13 @@ class Footer_Credits {
50
 
51
  //insert custom footer at specified hook
52
  if ($footer_hook = $options['footer_hook']) {
53
- if ($options['footer_remove']) remove_all_actions( $footer_hook);
 
 
 
 
 
 
54
  add_action( $footer_hook, array(__CLASS__, 'custom_footer'));
55
  }
56
 
@@ -252,12 +258,13 @@ class Footer_Credits {
252
 
253
  public static function custom_footer() {
254
  if ( is_active_sidebar( self::SIDEBAR_ID) ) {
 
255
  if (self::is_html5()) {
256
- echo '<footer class="custom-footer" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter">';
257
  dynamic_sidebar( self::SIDEBAR_ID );
258
  echo '</footer><!-- end .custom-footer -->';
259
  } else {
260
- echo '<div class="custom-footer">';
261
  dynamic_sidebar( self::SIDEBAR_ID );
262
  echo '</div><!-- end .custom-footer -->';
263
  }
2
 
3
  class Footer_Credits {
4
 
5
+ const CODE = 'footer-credits'; //shortcode prefix
6
  const SIDEBAR_ID = 'last-footer';
7
 
8
  public static function init() {
50
 
51
  //insert custom footer at specified hook
52
  if ($footer_hook = $options['footer_hook']) {
53
+ if ($options['footer_remove']) {
54
+ remove_all_actions( $footer_hook);
55
+ if ($footer_hook =='wp_footer') {
56
+ add_action( 'wp_footer', 'wp_print_footer_scripts', 20); //put back the footer scripts
57
+ add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); //put back the admin bar
58
+ }
59
+ }
60
  add_action( $footer_hook, array(__CLASS__, 'custom_footer'));
61
  }
62
 
258
 
259
  public static function custom_footer() {
260
  if ( is_active_sidebar( self::SIDEBAR_ID) ) {
261
+ $class = 'custom-footer'. (Footer_Credits_Options::get_option('hide_wordpress') ? ' hide-wordpress' :'');
262
  if (self::is_html5()) {
263
+ printf('<footer class="%1$s" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter">', $class);
264
  dynamic_sidebar( self::SIDEBAR_ID );
265
  echo '</footer><!-- end .custom-footer -->';
266
  } else {
267
+ printf('<div class="%1$s">', $class);
268
  dynamic_sidebar( self::SIDEBAR_ID );
269
  echo '</div><!-- end .custom-footer -->';
270
  }
classes/class-dashboard.php CHANGED
@@ -18,26 +18,30 @@ class Footer_Putter_Dashboard extends Footer_Putter_Admin {
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() {
43
  $plugin = FOOTER_PUTTER_FRIENDLY_NAME;
@@ -57,13 +61,14 @@ INTRO_PANEL;
57
  }
58
 
59
  function widgets_panel() {
60
- print <<< WIDGETS_PANEL
61
  <p>The plugins define two widgets:
62
  <ol>
63
  <li>a <b>Footer Copyright Widget</b> that places a line at the foot of your site containing as many of the items listed above that you want to disclose.</li>
64
  <li>a <b>Trademarks Widget</b> that displays a line of trademarks that you have previously set up as "Links".
65
  </ol></p>
66
  <p>Typically you will drag both widgets into the Custom Footer Widget Area.</p>
 
67
  WIDGETS_PANEL;
68
  }
69
 
@@ -72,7 +77,7 @@ WIDGETS_PANEL;
72
  $widgets_url = admin_url('widgets.php');
73
  $credits_url = Footer_Putter_Plugin::get_link_url('credits');
74
  $trademarks_url = Footer_Putter_Plugin::get_link_url('trademarks');
75
- print <<< INSTRUCTIONS_PANEL
76
  <h4>Create Standard Pages And Footer Menu</h4>
77
  <ol>
78
  <li>Create a <i>Privacy Policy</i> page with the slug/permalink <em>privacy</em>, choose a page template with no sidebar.</li>
@@ -80,7 +85,7 @@ WIDGETS_PANEL;
80
  <li>Create a <i>Contact</i> page with a contact form.</li>
81
  <li>Create an <i>About</i> page, with information either about the site or about its owner.</li>
82
  <li>If the site is selling an information product you may want to create a <i>Disclaimer</i> page, regarding any claims about the product performance.</li>
83
- <li>Create a WordPress menu called <i>Footer Menu</i> with the above pages.</li>
84
  </ol>
85
  <h4>Update Business Information</h4>
86
  <ol>
@@ -110,19 +115,17 @@ INSTRUCTIONS_PANEL;
110
  function hooks_panel() {
111
  $home_url = FOOTER_PUTTER_HOME_URL;
112
  $plugin = FOOTER_PUTTER_FRIENDLY_NAME;
113
- print <<< HOOKS_PANEL
114
-
115
  <p>The footer hook is only required if your theme does not already have a footer widget area into which you can drag the two widgets.</p>
116
  <p>For some themes, the footer hook is left blank, for others use a WordPress hook such as <i>get_footer</i> or <i>wp_footer</i>,
117
- or use a theme-specific hook such as <i>twentyten_credits</i>, <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,
118
- <i>twentythirteen_credits</i>, <i>twentyfourteen_credits</i>, <i>genesis_footer</i>, <i>pagelines_leaf</i>, etc.</p>
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>
@@ -132,8 +135,4 @@ HOOKS_PANEL;
132
  LINKS_PANEL;
133
  }
134
 
135
- function news_panel($post,$metabox){
136
- Footer_Putter_Feed_Widget::display_feeds();
137
- }
138
-
139
  }
18
  }
19
 
20
  function page_content() {
21
+ $title = $this->admin_heading('Footer Putter v'. $this->get_version(), FOOTER_PUTTER_ICON);
22
+ $this->print_admin_form_with_sidebar($title, __CLASS__);
 
 
 
 
23
  }
24
 
25
  function load_page() {
26
  $this->add_tooltip_support();
27
  add_action('admin_enqueue_scripts', array($this, 'register_admin_styles'));
28
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
29
+ add_action('admin_enqueue_scripts', array($this, 'enqueue_metabox_scripts'));
30
  add_action('admin_enqueue_scripts', array($this, 'enqueue_postbox_scripts'));
31
  $this->add_meta_box('intro', 'Introduction', 'intro_panel');
32
+ $this->add_meta_box('details','Details', 'footer_panel');
 
 
 
33
  $this->add_meta_box('news', 'DIY Webmastery News', 'news_panel', null, 'side');
34
  }
35
+
36
+ function footer_panel() {
37
+ $this->display_metabox( array(
38
+ 'Widgets' => $this->widgets_panel(),
39
+ 'Instructions' => $this->instructions_panel(),
40
+ 'Footer Hook' => $this->hooks_panel(),
41
+ 'Useful Links' => $this->links_panel()
42
+ ));
43
+ }
44
+
45
 
46
  function intro_panel() {
47
  $plugin = FOOTER_PUTTER_FRIENDLY_NAME;
61
  }
62
 
63
  function widgets_panel() {
64
+ return <<< WIDGETS_PANEL
65
  <p>The plugins define two widgets:
66
  <ol>
67
  <li>a <b>Footer Copyright Widget</b> that places a line at the foot of your site containing as many of the items listed above that you want to disclose.</li>
68
  <li>a <b>Trademarks Widget</b> that displays a line of trademarks that you have previously set up as "Links".
69
  </ol></p>
70
  <p>Typically you will drag both widgets into the Custom Footer Widget Area.</p>
71
+ <p>The widgets have settings that allow you to control both the footer content and the layout, and also whether or not the widgets appear at all on landing pages.</p>
72
  WIDGETS_PANEL;
73
  }
74
 
77
  $widgets_url = admin_url('widgets.php');
78
  $credits_url = Footer_Putter_Plugin::get_link_url('credits');
79
  $trademarks_url = Footer_Putter_Plugin::get_link_url('trademarks');
80
+ return <<< INSTRUCTIONS_PANEL
81
  <h4>Create Standard Pages And Footer Menu</h4>
82
  <ol>
83
  <li>Create a <i>Privacy Policy</i> page with the slug/permalink <em>privacy</em>, choose a page template with no sidebar.</li>
85
  <li>Create a <i>Contact</i> page with a contact form.</li>
86
  <li>Create an <i>About</i> page, with information either about the site or about its owner.</li>
87
  <li>If the site is selling an information product you may want to create a <i>Disclaimer</i> page, regarding any claims about the product performance.</li>
88
+ <li>Create a WordPress menu called <i>Footer Menu</i> and add the above pages to the footer menu.</li>
89
  </ol>
90
  <h4>Update Business Information</h4>
91
  <ol>
115
  function hooks_panel() {
116
  $home_url = FOOTER_PUTTER_HOME_URL;
117
  $plugin = FOOTER_PUTTER_FRIENDLY_NAME;
118
+ return <<< HOOKS_PANEL
 
119
  <p>The footer hook is only required if your theme does not already have a footer widget area into which you can drag the two widgets.</p>
120
  <p>For some themes, the footer hook is left blank, for others use a WordPress hook such as <i>get_footer</i> or <i>wp_footer</i>,
121
+ or use a theme-specific hook such as <i>twentytfourteen_credits</i>, <i>twentyfifteen_credits</i>, <i>genesis_footer</i>, <i>pagelines_leaf</i>, etc.</p>
 
122
  <p>Check out the <a href="{$home_url}">{$plugin} page</a> for more information about the plugin.</p>
123
  HOOKS_PANEL;
124
  }
125
 
126
  function links_panel() {
127
  $home = FOOTER_PUTTER_HOME_URL;
128
+ return <<< LINKS_PANEL
129
  <ul>
130
  <li><a rel="external" href="{$home}">Footer Putter Plugin Home</a></li>
131
  <li><a rel="external" href="http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks/">Themes and Recommended Footer Hooks</a></li>
135
  LINKS_PANEL;
136
  }
137
 
 
 
 
 
138
  }
classes/class-feed-widget.php CHANGED
@@ -5,7 +5,7 @@ if (!class_exists('Footer_Putter_Feed_Widget')) {
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) {
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( 'footer-putter-feed', __('Footer Putter Feed'), $widget_ops, $control_ops );
9
  }
10
 
11
  function widget($args, $instance) {
classes/class-trademarks-admin.php CHANGED
@@ -14,23 +14,27 @@ 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->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
  }
23
 
24
  public function load_page() {
25
  $this->add_tooltip_support();
26
  add_action ('admin_enqueue_scripts',array($this, 'enqueue_admin_styles'));
 
27
  add_action ('admin_enqueue_scripts',array($this, 'enqueue_postbox_scripts'));
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() {
35
  $linkcat = admin_url('edit-tags.php?taxonomy=link_category');
36
  $addlink = admin_url('link-add.php');
@@ -48,24 +52,24 @@ INTRO;
48
  }
49
 
50
  public function tips_panel() {
51
- print <<< TIPS
52
  <h4>Image File Size</h4>
53
- <p>The plugin uses the images "as is" so you need to provide suitably sized images. </p>
54
- <p>For a consistent layout make sure all images are the same height. A typical height will be of the order of 50px to 100px depending on how prominantly you want them to feature.</p>
55
  <h4>Image File Type</h4>
56
- <p>If your image are JPGs files on a white background, and your footer has a white background then using JPGs will be fine. Otherwise your footer look better if you use PNG files on a transparent background</p>
57
  TIPS;
58
  }
59
 
60
  public function screenshots_panel() {
61
  $img1 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
62
  $img2 = plugins_url('images/add-link.jpg',dirname(__FILE__));
63
- print <<< SCREENSHOTS
64
  <p>Below are annotated screenshots of creating the link category and adding a link .
65
  <h4>Add A Link Category</h4>
66
- <p><img src="{$img1}" alt="Screenshot of adding a trademark link category" /></p>
67
  <h4>Add A Link</h4>
68
- <p><img src="{$img2}" alt="Screenshot of adding a trademark link " /></p>
69
  SCREENSHOTS;
70
  }
71
 
14
 
15
  public function page_content() {
16
  $title = $this->admin_heading('Footer Trademarks', FOOTER_PUTTER_ICON);
17
+ $this->print_admin_form_with_sidebar($title, __CLASS__);
 
 
 
 
18
  }
19
 
20
  public function load_page() {
21
  $this->add_tooltip_support();
22
  add_action ('admin_enqueue_scripts',array($this, 'enqueue_admin_styles'));
23
+ add_action ('admin_enqueue_scripts',array($this, 'enqueue_metabox_scripts'));
24
  add_action ('admin_enqueue_scripts',array($this, 'enqueue_postbox_scripts'));
25
  $this->add_meta_box('intro', 'Instructions', 'intro_panel');
26
+ $this->add_meta_box('trademarks', 'Trademarks', 'trademarks_panel');
 
27
  $this->add_meta_box('news', 'DIY Webmastery News', 'news_panel',null, 'side');
28
  }
29
 
30
+ function trademarks_panel() {
31
+ $this->display_metabox( array(
32
+ 'Tips' => $this->tips_panel(),
33
+ 'Screenshots' => $this->screenshots_panel()
34
+ ));
35
+ }
36
+
37
+
38
  public function intro_panel() {
39
  $linkcat = admin_url('edit-tags.php?taxonomy=link_category');
40
  $addlink = admin_url('link-add.php');
52
  }
53
 
54
  public function tips_panel() {
55
+ return <<< TIPS
56
  <h4>Image File Size</h4>
57
+ <p>The plugin uses each trademark image "as is" so you need to provide trademark images that are suitably sized. </p>
58
+ <p>For a consistent layout make sure all images are the same height. A typical height will be of the order of 50px to 100px depending on how prominently you want them to feature.</p>
59
  <h4>Image File Type</h4>
60
+ <p>If your trademark images are JPG files on a white background, and your footer has a white background then using JPGs will be fine. Otherwise your footer look better if you use PNG files that have a transparent background</p>
61
  TIPS;
62
  }
63
 
64
  public function screenshots_panel() {
65
  $img1 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
66
  $img2 = plugins_url('images/add-link.jpg',dirname(__FILE__));
67
+ return <<< SCREENSHOTS
68
  <p>Below are annotated screenshots of creating the link category and adding a link .
69
  <h4>Add A Link Category</h4>
70
+ <p><img class="dashed-border" src="{$img1}" alt="Screenshot of adding a trademark link category" /></p>
71
  <h4>Add A Link</h4>
72
+ <p><img class="dashed-border" src="{$img2}" alt="Screenshot of adding a trademark link " /></p>
73
  SCREENSHOTS;
74
  }
75
 
classes/class-trademarks-widgets.php CHANGED
@@ -8,10 +8,10 @@ class Footer_Putter_Trademark_Widget extends WP_Widget {
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' => '',
@@ -101,7 +101,7 @@ class Footer_Putter_Trademark_Widget extends WP_Widget {
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 ) {
@@ -118,8 +118,10 @@ class Footer_Putter_Trademark_Widget extends WP_Widget {
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()) {
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' => '# 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' => 'Show or Hide', 'tip' => 'Determine on which pages the footer widget is displayed'),
15
  );
16
 
17
  private $defaults = array( 'title' => '',
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
+ print '<div class="diy-wrap">';
105
  $links = array();
106
  $link_cats = get_terms( 'link_category' );
107
  foreach ( $link_cats as $link_cat ) {
118
  ));
119
  $this->print_form_field('limit', 'text', array(), array('size' => 3 ,'maxlength' => 3));
120
  $this->print_form_field('nofollow', 'checkbox');
121
+ print ('<hr/><h4>Widget Presence</h4>');
122
+ $this->print_form_field('visibility', 'radio',
123
  Footer_Putter_Utils::get_visibility_options(), array('separator' => '<br />'));
124
+ print '</div>';
125
  }
126
 
127
  function print_form_field ($fld, $type, $options = array(), $args = array()) {
classes/class-utils.php CHANGED
@@ -9,10 +9,6 @@ class Footer_Putter_Utils {
9
  return self::$is_html5;
10
  }
11
 
12
- static function is_genesis2() {
13
- return function_exists('genesis_html5') ;
14
- }
15
-
16
  static function get_post_id() {
17
  global $post;
18
 
@@ -42,8 +38,8 @@ class Footer_Putter_Utils {
42
  static function get_meta ($post_id, $key) {
43
  if ($post_id && $key
44
  && ($meta = get_post_meta($post_id, $key, true))
45
- && ($options = @unserialize($meta))
46
- && is_array($options))
47
  return $options;
48
  else
49
  return false;
@@ -90,7 +86,7 @@ class Footer_Putter_Utils {
90
  'show_landing' => 'Show only on landing pages');
91
  }
92
 
93
- static function selector($fld_id, $fld_name, $value, $options) {
94
  $input = '';
95
  if (is_array($options)) {
96
  foreach ($options as $optkey => $optlabel)
@@ -99,7 +95,7 @@ class Footer_Putter_Utils {
99
  } else {
100
  $input = $options;
101
  }
102
- return sprintf('<select id="%1$s" name="%2$s">%3$s</select>', $fld_id, $fld_name, $input);
103
  }
104
 
105
  static function form_field($fld_id, $fld_name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
@@ -143,10 +139,22 @@ class Footer_Putter_Utils {
143
  $fld_id, $fld_name, str_replace('\'','"',checked($optkey, $value, false)), $optkey, $optlabel, $separator);
144
  $input = sprintf('<fieldset class="diy-fieldset">%1$s</fieldset>',$input);
145
  } else {
146
- $input .= sprintf('<input type="checkbox" class="checkbox" id="%1$s" name="%2$s" %3$svalue="1"/>',
147
  $fld_id, $fld_name, checked($value, '1', false));
148
  }
149
  break;
 
 
 
 
 
 
 
 
 
 
 
 
150
  case 'radio':
151
  if (is_array($options) && (count($options) > 0)) {
152
  if (isset($legend))
@@ -159,7 +167,7 @@ class Footer_Putter_Utils {
159
  }
160
  break;
161
  case 'select':
162
- $input = self::selector($fld_id, $fld_name, $value, $options);
163
  break;
164
  case 'hidden': return sprintf('<input type="hidden" name="%1$s" value="%2$s" />', $fld_name, $value);
165
  default: $input = $value;
@@ -173,5 +181,14 @@ class Footer_Putter_Utils {
173
  }
174
  return sprintf($format, $label, $input);
175
  }
 
 
 
 
 
 
 
 
 
176
 
177
  }
9
  return self::$is_html5;
10
  }
11
 
 
 
 
 
12
  static function get_post_id() {
13
  global $post;
14
 
38
  static function get_meta ($post_id, $key) {
39
  if ($post_id && $key
40
  && ($meta = get_post_meta($post_id, $key, true))
41
+ && ($options = (is_serialized($meta) ? @unserialize($meta) : $meta))
42
+ && (is_array($options) || is_string($options)))
43
  return $options;
44
  else
45
  return false;
86
  'show_landing' => 'Show only on landing pages');
87
  }
88
 
89
+ static function selector($fld_id, $fld_name, $value, $options, $multiple = false) {
90
  $input = '';
91
  if (is_array($options)) {
92
  foreach ($options as $optkey => $optlabel)
95
  } else {
96
  $input = $options;
97
  }
98
+ return sprintf('<select id="%1$s" name="%2$s"%4$s>%3$s</select>', $fld_id, $fld_name, $input, $multiple ? ' multiple':'');
99
  }
100
 
101
  static function form_field($fld_id, $fld_name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
139
  $fld_id, $fld_name, str_replace('\'','"',checked($optkey, $value, false)), $optkey, $optlabel, $separator);
140
  $input = sprintf('<fieldset class="diy-fieldset">%1$s</fieldset>',$input);
141
  } else {
142
+ $input .= sprintf('<input type="checkbox" class="checkbox" id="%1$s" name="%2$s" %3$svalue="1" class="diy-checkbox" />',
143
  $fld_id, $fld_name, checked($value, '1', false));
144
  }
145
  break;
146
+
147
+ case 'checkboxes':
148
+ $values = (array) $value;
149
+ $options = (array) $options;
150
+ if (isset($legend))
151
+ $input .= sprintf('<legend class="screen-reader-text"><span>%1$s</span></legend>', $legend);
152
+ foreach ($options as $optkey => $optlabel)
153
+ $input .= sprintf('<li><input type="checkbox" id="%1$s" name="%2$s[]" %3$s value="%4$s" /><label for="%1$s">%5$s</label></li>',
154
+ $fld_id, $fld_name, in_array($optkey, $values) ? 'checked="checked"' : '', $optkey, $optlabel);
155
+ $input = sprintf('<fieldset class="diy-fieldset%2$s"><ul>%1$s</ul></fieldset>',$input, isset($class) ? (' '.$class) : '');
156
+
157
+ break;
158
  case 'radio':
159
  if (is_array($options) && (count($options) > 0)) {
160
  if (isset($legend))
167
  }
168
  break;
169
  case 'select':
170
+ $input = self::selector($fld_id, $fld_name, $value, $options, isset($multiple));
171
  break;
172
  case 'hidden': return sprintf('<input type="hidden" name="%1$s" value="%2$s" />', $fld_name, $value);
173
  default: $input = $value;
181
  }
182
  return sprintf($format, $label, $input);
183
  }
184
+
185
+ static function register_tooltip_styles() {
186
+ wp_register_style('diy-tooltip', plugins_url('styles/tooltip.css',dirname(__FILE__)), array(), null);
187
+ }
188
+
189
+ static function enqueue_tooltip_styles() {
190
+ wp_enqueue_style('diy-tooltip');
191
+ wp_enqueue_style('dashicons');
192
+ }
193
 
194
  }
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.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);
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.13
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');
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=1&featured_only=1');
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
@@ -2,9 +2,9 @@
2
  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.1
7
- Stable tag: 1.12
8
  License: GPLv2+
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -27,6 +27,7 @@ Put a footer on your site that boosts your credibility with both search engines
27
  * Automatic HTML5 support
28
  * Option to use HTML5 microdata for Organization in accordance with Google recommendations
29
  * Option to apply rel=nofollow automatically to footer trademark links
 
30
 
31
  == Installation ==
32
 
@@ -36,7 +37,6 @@ Put a footer on your site that boosts your credibility with both search engines
36
 
37
  * Why is a footer important? By creating an appropriate footer you can enhance the credibility of your site by informing visitors on how to contact you, asserting copyright over the site content, setting out the legal terms and conditions for using the site, and establishing the trade associations or other bodies that recognize the legitimacy of your business.
38
 
39
-
40
  == Screenshots ==
41
  1. Example of a footer with both a copyright widget and a trademark widget
42
  1. Setting up Footer Credits copyright and address details
@@ -48,20 +48,23 @@ Put a footer on your site that boosts your credibility with both search engines
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
56
 
57
- = 1.9 = Added title to Footer Trademarks Widget, improved control over widgets on landing pages with a filter hook, improved online documentation, refactored code in accordance with current WordPress coding standards.
58
 
59
  For full version history please see http://www.diywebmastery.com/plugins/footer-putter/footer-putter-version-history/
60
 
61
  == Upgrade Notice ==
62
 
63
- = 1.12 =
64
- * Optional - Update for WordPress 4.1 , admin improvements
65
 
66
  == Links ==
67
 
2
  Contributors: powerblogservice, diywebmastery
3
  Donate link: http://www.diywebmastery.com/donate/
4
  Tags: footer, copyright, trademark
5
+ Requires at least: 3.1
6
+ Tested up to: 4.3
7
+ Stable tag: 1.13
8
  License: GPLv2+
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
27
  * Automatic HTML5 support
28
  * Option to use HTML5 microdata for Organization in accordance with Google recommendations
29
  * Option to apply rel=nofollow automatically to footer trademark links
30
+ * Option to hide Powered By WordPress on TwentySomething themes
31
 
32
  == Installation ==
33
 
37
 
38
  * Why is a footer important? By creating an appropriate footer you can enhance the credibility of your site by informing visitors on how to contact you, asserting copyright over the site content, setting out the legal terms and conditions for using the site, and establishing the trade associations or other bodies that recognize the legitimacy of your business.
39
 
 
40
  == Screenshots ==
41
  1. Example of a footer with both a copyright widget and a trademark widget
42
  1. Setting up Footer Credits copyright and address details
48
 
49
  == Changelog ==
50
 
51
+ = 1.13 =
52
 
53
+ * Checked for WordPress 4.3 compatibility
54
+ * Updated to use Admin Notices
55
+ * Added option to hide Powered By WordPress on the TwentySomething themes
56
+ * Re-enabled Admin Toolbar if all actions were removed on the wp_footer hook
57
 
58
+ = 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
59
 
60
+ = 1.11 = Add option to set Copyright Text
61
 
62
  For full version history please see http://www.diywebmastery.com/plugins/footer-putter/footer-putter-version-history/
63
 
64
  == Upgrade Notice ==
65
 
66
+ = 1.13 =
67
+ * Optional - Updated for WordPress 4.3
68
 
69
  == Links ==
70
 
scripts/jquery.tabs.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready ( function () {
2
+ if(jQuery('.footer-putter-metabox').length > 0) {
3
+ jQuery('.footer-putter-metabox li.tab a').each(function(i) {
4
+ var thisMetabox = jQuery(this).closest('.footer-putter-metabox');
5
+ var tabs = thisMetabox.find('.footer-putter-metabox-tabs');
6
+ var content = thisMetabox.find('.metabox-content');
7
+ var thisTab = jQuery(this).parent().attr('class').replace(/tab /, '');
8
+ var selectedTab = thisMetabox.find('#tabselect');
9
+ if ( thisTab == selectedTab.val() ) {
10
+ jQuery(this).addClass('active');
11
+ content.children('div.'+thisTab).addClass('active');
12
+ } else {
13
+ content.children('div.' + thisTab).hide();
14
+ }
15
+ jQuery(this).click(function(){
16
+ content.children('div').hide();
17
+ content.children('div.active').removeClass('active');
18
+ tabs.find('li a.active').removeClass('active');
19
+ selectedTab.val(thisTab);
20
+ tabs.find('li.'+thisTab+' a').addClass('active');
21
+ content.children('div.'+thisTab).addClass('active').show();
22
+ return false;
23
+ });
24
+ tabs.show();
25
+ });
26
+ }
27
+ });
styles/admin.css CHANGED
@@ -1,4 +1,4 @@
1
  h2.title i { padding-right: 0.25em; vertical-align: top; font-size: 1.2em;}
2
  img.dashed-border { padding: 10px; border: 1px dashed silver; max-width: 100%; }
3
  p.bigger { font-size: larger; font-weight: bold; }
4
- #footer-putter-intro { padding-right: 180px; background: url(../images/logo.png) right 40px no-repeat;}
1
  h2.title i { padding-right: 0.25em; vertical-align: top; font-size: 1.2em;}
2
  img.dashed-border { padding: 10px; border: 1px dashed silver; max-width: 100%; }
3
  p.bigger { font-size: larger; font-weight: bold; }
4
+ #footer-putter-intro { padding-right: 180px; background: url(../images/logo.png) right 40px no-repeat;}
styles/footer-credits.css CHANGED
@@ -28,4 +28,8 @@
28
 
29
  .widget_footer_copyright, .widget_footer_trademarks
30
  { margin: 0 !important; padding: 0 !important; width: 100% !important; float:none !important; }
31
- .site-info .custom-footer { margin: 0 !important; border: 0 !important; padding : 0!important; width: 100% !important;}
 
 
 
 
28
 
29
  .widget_footer_copyright, .widget_footer_trademarks
30
  { margin: 0 !important; padding: 0 !important; width: 100% !important; float:none !important; }
31
+ .site-info .custom-footer { margin: 0 !important; border: 0 !important; padding : 0!important; width: 100% !important;}
32
+
33
+ .custom-footer.hide-wordpress + a[href='https://wordpress.org/'], .custom-footer.hide-wordpress + a[href='http://wordpress.org/'] {
34
+ display: none;
35
+ }
styles/images/icon-32.png ADDED
Binary file
styles/tabs.css ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*tabbed metabox */
2
+
3
+ ul.footer-putter-metabox-tabs { display: inline-block; margin:0 0 -4px; padding: 0; color: #000000;}
4
+ ul.footer-putter-metabox-tabs li {list-style: none; display: inline; font-size: 11px; }
5
+ ul.footer-putter-metabox-tabs li.tab a {
6
+ text-decoration: none;
7
+ border-top: 1px #AAAAAA solid;
8
+ border-left: 1px #AAAAAA solid;
9
+ border-right: 1px #AAAAAA solid;
10
+ }
11
+ ul.footer-putter-metabox-tabs li.tab a.active {
12
+ color: #000000;
13
+ background-color: #CCCCCC;
14
+ border-bottom: none;
15
+ }
16
+ ul.footer-putter-metabox-tabs li.link a:hover { text-decoration: underline; }
17
+ ul.footer-putter-metabox-tabs li.tab.hidden { display: none; background-color: gray}
18
+ ul.footer-putter-metabox-tabs li.tab a.has_error { background-color: red; color: white; }
19
+ ul.footer-putter-metabox-tabs li a:focus { outline: none; box-shadow:none; }
20
+ ul.footer-putter-metabox-tabs li.tab a { display: block; float: left; margin-right: 4px; padding: 5px 12px;
21
+ font-weight: bold; text-decoration: none; zoom: 1; outline: none;
22
+ border-radius: 2px 2px 0 0; -webkit-border-radius: 2px 2px 0 0; -moz-border-radius: 2px 2px 0 0;
23
+ background-color: #E8E8E8; color: #A8A8A8 ;
24
+ }
25
+
26
+
27
+ ul.footer-putter-metabox-tabs li.tab a:hover {
28
+ color: #000000;
29
+ }
30
+ .footer-putter-metabox .metabox-content {
31
+ background: url(images/icon-32.png) right bottom no-repeat, linear-gradient(to bottom, #CCCCCC,#EEEEEE);
32
+ min-height: 60px;
33
+ padding-bottom:50px;
34
+ border: 1px #AAAAAA solid;
35
+ }
36
+
37
+ .footer-putter-metabox div.tab-content {
38
+ padding: 10px 15px;
39
+ opacity: 90%;
40
+ }
41
+
42
+ .footer-putter-metabox .form-table th, .footer-putter-metabox .form-table td {
43
+ padding: 5px;
44
+ }
styles/tooltip.css CHANGED
@@ -19,15 +19,19 @@ text-shadow: 0 1px 0 rgba(255,255,255,.4);
19
  content: ""; position: absolute; z-index: 1000; bottom: -7px; left: 50%;margin-left: 8px;
20
  border-top: 8px solid #ddd;border-left: 8px solid transparent;border-right: 8px solid transparent;border-bottom: 0; }
21
  .diy-tooltip span.tip:before {border-top-color: #ccc;bottom: -8px;}
22
- .diy-tooltip .dashicons-editor-help { font-weight: lighter; font-size: 16px;}
23
- .diy-tooltip-metabox-content h4 { margin: 1em 0;}
24
- .diy-tooltip-metabox-content p { margin: 1em; }
25
- .widgets-holder-wrap .diy-wrap { margin: 10px 0; }
26
- .widgets-holder-wrap .diy-wrap p { margin: 5px 0 0; }
27
- .widgets-holder-wrap label { min-width: 110px; margin-right: 10px; vertical-align: top; display: inline-block;}
28
- .widgets-holder-wrap p label, .widgets-holder-wrap div.wrapfieldset label { min-width: 160px;}
29
- .widgets-holder-wrap fieldset {display: inline-block;}
30
- .widgets-holder-wrap fieldset label { min-width: 30px; margin-left: 5px; margin-right: 15px; }
31
- #poststuff label { min-width: 200px; margin-right: 10px; vertical-align: top; display: inline-block;}
32
- #poststuff fieldset {display: inline-block;}
33
- #poststuff fieldset label { min-width: 70px; margin-left: 5px; margin-right: 15px; }
 
 
 
 
19
  content: ""; position: absolute; z-index: 1000; bottom: -7px; left: 50%;margin-left: 8px;
20
  border-top: 8px solid #ddd;border-left: 8px solid transparent;border-right: 8px solid transparent;border-bottom: 0; }
21
  .diy-tooltip span.tip:before {border-top-color: #ccc;bottom: -8px;}
22
+ .diy-tooltip .dashicons-editor-help { font-weight: lighter; font-size: 16px; font-family: dashicons; }
23
+ .diy-fieldset {display: inline-block; margin: 5px; }
24
+ .diy-fieldset label { min-width: 70px; margin: 3px 15px 3px 5px; vertical-align:middle; }
25
+ .diy-fieldset input { margin: 3px 0; }
26
+ .diy-fieldset li { display: inline; }
27
+ .diy-checkbox { margin-left: 3px;}
28
+ .diy-label { min-width: 160px; margin-right: 10px; vertical-align: top; display: inline-block;}
29
+ .widgets-holder-wrap .diy-label { min-width: 150px; }
30
+ .widgets-holder-wrap .diy-wrap .diy-label { min-width: 100px; }
31
+ .widgets-holder-wrap .diy-fieldset label { min-width: 30px; }
32
+ .wrapfieldset label { padding-top: 10px; }
33
+ .diy-wrap { margin: 10px 0; }
34
+ .diy-wrap div label {padding-top:5px; }
35
+ .diy-wrap h4 { margin: 10px 0;}
36
+ .diy-wrap p { margin: 5px 0 0; }
37
+ tr.diy-row th, tr.diy-row td { margin: 0; padding: 5px;}