Footer Putter - Version 1.17

Version Description

  • Internationalisation support
  • Update for WordPress 5.6 and PHP 7.4

For full version history please see https://www.diywebmastery.com/plugins/footer-putter/footer-putter-version-history/

=

Download this release

Release Info

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

Code changes from version 1.15 to 1.17

classes/class-admin.php CHANGED
@@ -10,8 +10,7 @@ abstract class Footer_Putter_Admin {
10
  protected $options;
11
  protected $icon;
12
  protected $tooltips;
13
- private $tips = array();
14
- private $messages = array();
15
  private $is_metabox = false;
16
  private $metabox_class;
17
  private $metabox_tab;
@@ -38,7 +37,7 @@ abstract class Footer_Putter_Admin {
38
 
39
  function make_icon($icon) {
40
  if (empty($icon)) $icon = $this->icon;
41
- return sprintf('<i class="%1$s"></i>', 'dashicons-'==substr($icon,0,10) ? ('dashicons '.$icon) : $icon) ;
42
  }
43
 
44
  abstract function init() ;
@@ -73,45 +72,33 @@ abstract class Footer_Putter_Admin {
73
  return admin_url('admin.php?page='.$this->get_slug());
74
  }
75
 
 
 
 
 
76
  function get_name() {
77
  return $this->plugin->get_name();
78
  }
79
 
80
  function get_code($code='') {
81
- $format = empty($code) ? '%1$s' : '%1$s-%2$s';
82
- return sprintf($format, $this->get_parent_slug(), $code);
83
  }
84
 
85
- function get_keys() {
86
- return array_keys($this->tips);
87
- }
88
-
89
  function get_tip($label) {
90
  return $this->tooltips->tip($label);
91
  }
92
 
93
- function print_admin_notices() {
94
- foreach ($this->messages as $message)
95
- print $message;
96
  }
97
 
98
- function add_admin_notice($subject, $message, $is_error = false) {
99
- $this->messages[] = sprintf('<div class="notice is-dismissible %1$s"><p>%2$s %3$s</p></div>', $is_error ? 'error' : 'updated', __($subject), __($message));
100
- add_action( 'admin_notices', array($this, 'print_admin_notices') );
101
- }
102
-
103
- function plugin_action_links ( $links, $file ) {
104
- if ( is_array($links) && ($this->get_path() == $file )) {
105
- $settings_link = '<a href="' .$this->get_url() . '">Settings</a>';
106
- array_unshift( $links, $settings_link );
107
- }
108
- return $links;
109
  }
110
 
111
- function set_tooltips($tips) {
112
- $this->tips = (array)$tips;
113
- $this->tooltips->init($this->tips);
114
- $this->add_tooltip_support();
115
  }
116
 
117
  function add_tooltip_support() {
@@ -155,8 +142,9 @@ abstract class Footer_Putter_Admin {
155
 
156
  function enqueue_metabox_scripts() {
157
  $this->is_metabox = true;
 
158
  wp_enqueue_style($this->get_code('tabs'), plugins_url('styles/tabs.css',dirname(__FILE__)), array(),$this->get_version());
159
- wp_enqueue_script($this->get_code('tabs'), plugins_url('scripts/jquery.tabs.js',dirname(__FILE__)), array(),$this->get_version());
160
  }
161
 
162
  function enqueue_postbox_scripts() {
@@ -175,16 +163,23 @@ abstract class Footer_Putter_Admin {
175
  add_meta_box($this->get_code($code), __($title), array($this, $callback_func), $post_type, $context, $priority, $callback_params);
176
  }
177
 
 
 
 
 
 
 
 
178
  function form_field($id, $name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
179
  if (!$label) $label = $id;
180
  $label_args = (is_array($args) && array_key_exists('label_args', $args)) ? $args['label_args'] : false;
181
  return $this->utils->form_field($id, $name, $this->tooltips->tip($label, $label_args), $value, $type, $options, $args, $wrap);
182
  }
183
 
184
- function grouped_form_field($data, $group, $fld, $type, $options = array(), $args = array(), $wrap='tr', $prefix='') {
185
  $id = $group.'_'.$fld;
186
  $name = $prefix.$group.'['.$fld.']';
187
- $value = isset($data[$fld]) ? $data[$fld] : '';
188
  return $this->form_field($id, $name, false, $value, $type, $options, $args, $wrap);
189
  }
190
 
@@ -261,11 +256,11 @@ abstract class Footer_Putter_Admin {
261
  } //end for
262
  $saved = call_user_func( array($options_class, 'save_options'), $options) ;
263
  if ($saved)
264
- $this->add_admin_notice($settings_name, ' saved successfully.');
265
  else
266
- $this->add_admin_notice($settings_name, ' have not been changed.', true);
267
  } else {
268
- $this->add_admin_notice($settings_name, 'settings not found', true);
269
  }
270
  return $saved;
271
  }
@@ -276,15 +271,21 @@ abstract class Footer_Putter_Admin {
276
  $val = $_POST[$metakey];
277
  if (is_array($val)) {
278
  foreach ($val as $k => $v) if (!is_array($v)) $val[$k] = stripslashes(trim($v));
279
- $val = @serialize($this->options->validate_options($defaults, $val ));
 
 
 
 
 
280
  } else {
281
- $val = stripslashes(trim($val));
282
  }
283
  } else {
284
- $val = false;
285
  }
286
- $this->utils->update_post_meta( $post_id, $metakey, $val );
287
  }
 
288
  }
289
 
290
  function disable_checkbox($post_id, $action, $option, $label_format) {
@@ -323,6 +324,23 @@ abstract class Footer_Putter_Admin {
323
  return $columns;
324
  }
325
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  function admin_heading($title = '', $icon = '') {
327
  if (empty($title)) $title = sprintf('%1$s %2$s', ucwords(str_replace('-',' ',$this->slug)), $this->get_version());
328
  return sprintf('<h2 class="title">%2$s<span>%1$s</span></h2>', $title, $this->make_icon($icon));
@@ -400,7 +418,7 @@ abstract class Footer_Putter_Admin {
400
  $labels .= sprintf('<li class="tab tab%1$s"><a href="#">%2$s</a></li>', $t, $label);
401
  $contents .= sprintf('<div class="tab%1$s"><div class="tab-content">%2$s</div></div>', $t, $content);
402
  }
403
- return sprintf('<div class="%1$s"><ul class="metabox-tabs">%2$s</ul><div class="metabox-content">%3$s</div><input type="hidden" class="tabselect" name="%4$s" value="%5$s" />%6$s</div>',
404
  $this->metabox_class, $labels, $contents, $tabselect, $tab, $this->get_action_nonce($this->metabox_tab));
405
  }
406
 
10
  protected $options;
11
  protected $icon;
12
  protected $tooltips;
13
+ private $notices = array();
 
14
  private $is_metabox = false;
15
  private $metabox_class;
16
  private $metabox_tab;
37
 
38
  function make_icon($icon) {
39
  if (empty($icon)) $icon = $this->icon;
40
+ return strpos($icon, '<svg') !== FALSE ? $icon : sprintf('<i class="%1$s"></i>', 'dashicons-'==substr($icon,0,10) ? ('dashicons '.$icon) : $icon) ;
41
  }
42
 
43
  abstract function init() ;
72
  return admin_url('admin.php?page='.$this->get_slug());
73
  }
74
 
75
+ function get_changelog() {
76
+ return $this->plugin->get_changelog();
77
+ }
78
+
79
  function get_name() {
80
  return $this->plugin->get_name();
81
  }
82
 
83
  function get_code($code='') {
84
+ return $this->utils->get_code($code);
 
85
  }
86
 
 
 
 
 
87
  function get_tip($label) {
88
  return $this->tooltips->tip($label);
89
  }
90
 
91
+ function message($message_id) {
92
+ return $this->plugin->get_message()->message($message_id);
 
93
  }
94
 
95
+ function init_tooltips($tips=array()) {
96
+ if(!empty($tips)) $this->add_tooltips($tips);
97
+ $this->add_tooltip_support();
 
 
 
 
 
 
 
 
98
  }
99
 
100
+ function add_tooltips($ids, $prefix='') { /* add more tips */
101
+ $this->tooltips->init($this->plugin->get_message()->build_tips($ids, $prefix));
 
 
102
  }
103
 
104
  function add_tooltip_support() {
142
 
143
  function enqueue_metabox_scripts() {
144
  $this->is_metabox = true;
145
+ wp_enqueue_style('diy-metabox', plugins_url('styles/metabox.css',dirname(__FILE__)), array(),$this->get_version());
146
  wp_enqueue_style($this->get_code('tabs'), plugins_url('styles/tabs.css',dirname(__FILE__)), array(),$this->get_version());
147
+ wp_enqueue_script($this->get_code('tabs'), plugins_url('scripts/jquery.tabs.js',dirname(__FILE__)), array('jquery'),$this->get_version());
148
  }
149
 
150
  function enqueue_postbox_scripts() {
163
  add_meta_box($this->get_code($code), __($title), array($this, $callback_func), $post_type, $context, $priority, $callback_params);
164
  }
165
 
166
+ function add_postmeta_box( $callback_func, $post_type = false, $context = 'advanced', $priority = 'default' ) {
167
+ if ($this->plugin->is_post_type_enabled($post_type)) {
168
+ $callback_params = array( '__block_editor_compatible_meta_box' => true);
169
+ add_meta_box($this->get_code('post-settings'), $this->get_name().' Post Settings', array($this, $callback_func), $post_type, $context, $priority, $callback_params);
170
+ }
171
+ }
172
+
173
  function form_field($id, $name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
174
  if (!$label) $label = $id;
175
  $label_args = (is_array($args) && array_key_exists('label_args', $args)) ? $args['label_args'] : false;
176
  return $this->utils->form_field($id, $name, $this->tooltips->tip($label, $label_args), $value, $type, $options, $args, $wrap);
177
  }
178
 
179
+ function grouped_form_field($data, $prefix, $group, $fld, $type, $options = array(), $args = array(), $wrap='tr') {
180
  $id = $group.'_'.$fld;
181
  $name = $prefix.$group.'['.$fld.']';
182
+ $value = isset($data[$fld]) ? (is_array($data[$fld]) ? $data[$fld] : stripslashes($data[$fld]) ) : '';
183
  return $this->form_field($id, $name, false, $value, $type, $options, $args, $wrap);
184
  }
185
 
256
  } //end for
257
  $saved = call_user_func( array($options_class, 'save_options'), $options) ;
258
  if ($saved)
259
+ $this->add_admin_notice($settings_name, $this->message('settings_saved') );
260
  else
261
+ $this->add_admin_notice($settings_name, $this->message('settings_unchanged'), true);
262
  } else {
263
+ $this->add_admin_notice($settings_name, $this->message('settings_not_found'), true);
264
  }
265
  return $saved;
266
  }
271
  $val = $_POST[$metakey];
272
  if (is_array($val)) {
273
  foreach ($val as $k => $v) if (!is_array($v)) $val[$k] = stripslashes(trim($v));
274
+ //Delete postmeta if empty array
275
+ if (!array_filter($val)) {
276
+ delete_post_meta( $post_id, $metakey);
277
+ return true;
278
+ }
279
+ $vals = @serialize($this->options->validate_options($defaults, $val ));
280
  } else {
281
+ $vals = stripslashes(trim(esc_attr($val)));
282
  }
283
  } else {
284
+ $vals = false;
285
  }
286
+ return $this->utils->update_post_meta( $post_id, $metakey, $vals );
287
  }
288
+ return false;
289
  }
290
 
291
  function disable_checkbox($post_id, $action, $option, $label_format) {
324
  return $columns;
325
  }
326
 
327
+ function print_admin_notices() {
328
+ foreach ($this->notices as $notice) print $notice;
329
+ }
330
+
331
+ function add_admin_notice($subject, $notice, $is_error = false) {
332
+ $this->notices[] = sprintf('<div class="notice is-dismissible %1$s"><p>%2$s %3$s</p></div>', $is_error ? 'error' : 'updated', $subject, $notice);
333
+ add_action( 'admin_notices', array($this, 'print_admin_notices') );
334
+ }
335
+
336
+ function plugin_action_links ( $links, $file ) {
337
+ if ( is_array($links) && ($this->get_path() == $file )) {
338
+ $settings_link = '<a href="' .$this->get_url() . '">Settings</a>';
339
+ array_unshift( $links, $settings_link );
340
+ }
341
+ return $links;
342
+ }
343
+
344
  function admin_heading($title = '', $icon = '') {
345
  if (empty($title)) $title = sprintf('%1$s %2$s', ucwords(str_replace('-',' ',$this->slug)), $this->get_version());
346
  return sprintf('<h2 class="title">%2$s<span>%1$s</span></h2>', $title, $this->make_icon($icon));
418
  $labels .= sprintf('<li class="tab tab%1$s"><a href="#">%2$s</a></li>', $t, $label);
419
  $contents .= sprintf('<div class="tab%1$s"><div class="tab-content">%2$s</div></div>', $t, $content);
420
  }
421
+ return sprintf('<div class="diy-metabox %1$s"><ul class="metabox-tabs">%2$s</ul><div class="metabox-content">%3$s</div><input type="hidden" class="tabselect" name="%4$s" value="%5$s" />%6$s</div>',
422
  $this->metabox_class, $labels, $contents, $tabselect, $tab, $this->get_action_nonce($this->metabox_tab));
423
  }
424
 
classes/class-credits-admin.php CHANGED
@@ -1,60 +1,30 @@
1
  <?php
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.'),
12
- 'country' => array('heading' => 'Country', 'tip' => 'Enter the country where the legal entity is domiciled.'),
13
- 'latitude' => array('heading' => 'Latitude', 'tip' => 'Enter the latitude of the organization&#39;s location - maybe be used by Google or local search.'),
14
- 'longitude' => array('heading' => 'Longitude', 'tip' => 'Enter the longitude of the organization&#39;s location - maybe be used by Google or local search.'),
15
- 'map' => array('heading' => 'Map URL', 'tip' => 'Enter the URL of a map that shows the organization&#39;s location.'),
16
- 'telephone' => array('heading' => 'Telephone Number', 'tip' => 'Enter a telephone number here if you want it to appear in the footer of the installed site.'),
17
- 'email' => array('heading' => 'Email Address', 'tip' => 'Enter the email address here if you want it to appear in the footer and in the privacy statement.'),
18
- 'courts' => array('heading' => 'Legal Jurisdiction' , 'tip' => 'The Courts that have jurisdiction over any legal disputes regarding this site. For example: <i>the state and federal courts in Santa Clara County, California</i>, or <i>the Law Courts of England and Wales</i>'),
19
- 'updated' => array('heading' => 'Last Updated' , 'tip' => 'This will be defaulted as today. For example, Oct 23rd, 2012'),
20
- 'copyright_preamble' => array('heading' => 'Copyright Text' , 'tip' => 'Something like:<br/> Copyright &copy; All Rights Reserved.'),
21
- 'copyright_start_year' => array('heading' => 'Copyright Start' , 'tip' => 'The start year of the business appears in the copyright statement in the footer and an on the Terms and Conditions page.'),
22
- 'return_text' => array('heading' => 'Link Text' , 'tip' => 'The text of the Return To Top link. For example, <i>Return To Top</i> or <i>Back To Top</i>.'),
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
  private $credits;
33
 
34
  function init() {
35
- $this->credits = $this->plugin->get_credits();
36
  add_action('admin_menu',array($this, 'admin_menu'));
37
  }
38
 
39
  function admin_menu() {
40
- $this->screen_id = add_submenu_page($this->get_parent_slug(), __('Footer Credits'), __('Footer Credits'), 'manage_options',
41
- $this->get_slug(), array($this,'page_content'));
42
  add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
43
  }
44
 
45
  function page_content() {
46
- $title = $this->admin_heading('Footer Credits');
47
- $this->print_admin_form($title, __CLASS__, $this->get_keys());
48
  }
49
 
50
  function load_page() {
51
  if (isset($_POST['options_update'])) $this->save_credits();
52
- $this->set_tooltips($this->tips);
53
- $this->add_meta_box('introduction', 'Introduction' , 'intro_panel');
54
- $this->add_meta_box('credits', 'Footer Settings' , 'credits_panel', array ('options' => $this->credits->get_options()));
55
- $this->add_meta_box('example', 'Footer Preview', 'preview_panel', null, 'advanced');
56
- $this->add_meta_box('news', 'DIY Webmastery News', 'news_panel', null, 'side');
57
- add_action('admin_enqueue_scripts', array($this, 'enqueue_credits_styles'));
58
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin'));
59
  }
60
 
@@ -65,62 +35,66 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
65
 
66
  function save_credits() {
67
  check_admin_referer(__CLASS__);
 
 
68
  $page_options = explode(',', stripslashes($_POST['page_options']));
69
  if ($page_options) {
70
  $options = $this->credits->get_options();
71
  foreach ($page_options as $option) {
72
  $val = array_key_exists($option, $_POST) ? trim(stripslashes($_POST[$option])) : '';
73
- if ($this->credits->is_terms_key($option))
74
- $options['terms'][$option] = $val;
75
- else switch($option) {
76
- case 'footer_remove' : $options[$option] = !empty($val); break;
77
- case 'footer_hook':
78
- case 'footer_filter_hook': $options[$option] = preg_replace('/\W-\//','',$val); break;
79
- default: $options[$option] = trim($val);
80
- }
81
  } //end for ;
82
- $saved = $this->credits->save_options($options) ;
83
- $message = $saved ? 'updated successfully' : 'have not been updated';
84
- $is_error = false;
 
 
 
 
85
  } else {
86
- $is_error = true;
87
- $message= 'not found!';
88
- }
89
- $this->add_admin_notice('Footer Settings ', $message, $is_error);
90
  return $saved;
91
  }
92
 
93
  function credits_panel($post,$metabox) {
94
- $options = $metabox['args']['options'];
95
- print $this->tabbed_metabox($metabox['id'], array(
96
- 'Owner' => $this->owner_panel($options['terms']),
97
- 'Contact' => $this->contact_panel($options['terms']),
98
- 'Legal' => $this->legal_panel($options['terms']),
99
- 'Return To Top' => $this->return_panel($options),
100
- 'Advanced' => $this->advanced_panel($options)
101
- ));
 
 
102
  }
103
 
 
104
  function owner_panel($terms) {
105
- $s = $this->fetch_text_field('owner', $terms['owner'], array('size' =>30)) .
106
- $this->fetch_text_field('country', $terms['country'], array('size' => 30)) .
107
- $this->fetch_form_field('address', $terms['address'], 'textarea', array(), array('cols' => 30, 'rows' => 5));
108
- if ($this->utils->is_html5()) {
109
- return $s .
110
- '<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>'.
111
- '<h4>Organization Address</h4>'.
 
 
112
  $this->fetch_text_field('street_address', $terms['street_address'], array('size' => 30)) .
113
  $this->fetch_text_field('locality', $terms['locality'], array('size' => 30)) .
114
  $this->fetch_text_field('region', $terms['region'], array('size' => 30)) .
115
- $this->fetch_text_field('postal_code', $terms['postal_code'], array('size' => 12)) .
116
- '<h4>Geographical Co-ordinates</h4>'.
117
- '<p>The geographical co-ordinates are optional and are visible only to the search engines.</p>' .
 
 
 
 
 
118
  $this->fetch_text_field('latitude', $terms['latitude'], array('size' => 12)) .
119
  $this->fetch_text_field('longitude', $terms['longitude'], array('size' => 12)) .
120
  $this->fetch_text_field('map', $terms['map'], array('size' =>30));
121
- } else {
122
- return $s;
123
- }
124
  }
125
 
126
  function contact_panel($terms) {
@@ -139,39 +113,8 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
139
  $this->fetch_text_field('copyright_start_year', $terms['copyright_start_year'], array('size' => 5));
140
  }
141
 
142
- function return_panel($options) {
143
- return $this->fetch_text_field('return_text', $options['return_text'], array('size' => 20));
144
- }
145
-
146
- function advanced_panel($options) {
147
- $url = 'https://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks';
148
- $before = <<< ADVANCED_PANEL
149
- <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
150
- where the Widget Area will be located.</p>
151
- <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>,
152
- <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
153
- 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>
154
- ADVANCED_PANEL;
155
- $f = $this->fetch_text_field('footer_hook', $options['footer_hook'], array('size' => 50)) .
156
- $this->fetch_form_field('footer_remove', $options['footer_remove'], 'checkbox');
157
- $after = <<< REMOVE_PANEL
158
- <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,
159
- then specify the hook below. For example, entering <i>genesis_footer_output</i> will suppress the standard Genesis child theme footer.</p>
160
- REMOVE_PANEL;
161
- $hook = $this->fetch_text_field('footer_filter_hook', $options['footer_filter_hook'], array('size' => 50));
162
- if (($theme = wp_get_theme()) && (strpos(strtolower($theme->get('Name')), 'twenty') !== FALSE))
163
- $hook .= $this->fetch_form_field('hide_wordpress', $options['hide_wordpress'], 'checkbox');
164
- return $before . $f . $after . $hook;
165
- }
166
-
167
-
168
- function preview_panel() {
169
- 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.'),
170
- $this->credits->footer(array('nav_menu' => 'Footer Menu')));
171
- }
172
-
173
  function intro_panel() {
174
- 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.'));
175
  }
176
 
177
 
1
  <?php
2
+ class Footer_Putter_Credits_Admin extends Footer_Putter_Admin{
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  private $credits;
5
 
6
  function init() {
7
+ $this->credits = $this->plugin->get_module('credits');
8
  add_action('admin_menu',array($this, 'admin_menu'));
9
  }
10
 
11
  function admin_menu() {
12
+ $plugin_name = $this->get_name();
13
+ $this->screen_id = add_submenu_page($this->get_parent_slug(), $plugin_name .' Credits', $this->message('menu_credits'), 'manage_options', $this->get_slug(), array($this,'page_content'));
14
  add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
15
  }
16
 
17
  function page_content() {
18
+ $title = $this->admin_heading(sprintf('%1$s (v%2$s)', $this->get_name(), $this->get_version()));
19
+ $this->print_admin_form($title, __CLASS__, $this->credits->get_keys());
20
  }
21
 
22
  function load_page() {
23
  if (isset($_POST['options_update'])) $this->save_credits();
24
+ $this->init_tooltips();
25
+ $this->add_meta_box('introduction', $this->message('section_credits_intro_title') , 'intro_panel');
26
+ $this->add_meta_box('credits', $this->message('section_credits_settings_title') , 'credits_panel', array ('options' => $this->credits->get_options()));
27
+ $this->add_meta_box('news', $this->message('plugin_news'), 'news_panel', null, 'advanced'); add_action('admin_enqueue_scripts', array($this, 'enqueue_credits_styles'));
 
 
28
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin'));
29
  }
30
 
35
 
36
  function save_credits() {
37
  check_admin_referer(__CLASS__);
38
+ $settings = $this->message('settings_name');
39
+ $saved = false;
40
  $page_options = explode(',', stripslashes($_POST['page_options']));
41
  if ($page_options) {
42
  $options = $this->credits->get_options();
43
  foreach ($page_options as $option) {
44
  $val = array_key_exists($option, $_POST) ? trim(stripslashes($_POST[$option])) : '';
45
+ $options[$option] = $val;
 
 
 
 
 
 
 
46
  } //end for ;
47
+ $saved = $this->credits->save_options($options) ;
48
+ if ($saved) {
49
+ $updated = true;
50
+ $this->add_admin_notice($settings, $this->message('settings_saved'));
51
+ } else {
52
+ $this->add_admin_notice($settings, $this->message('settings_unchanged'), true);
53
+ }
54
  } else {
55
+ $this->add_admin_notice($settings, $this->message('settings_not_found'), true);
56
+ }
 
 
57
  return $saved;
58
  }
59
 
60
  function credits_panel($post,$metabox) {
61
+ $this->add_tooltips($this->credits->get_keys());
62
+ $options = $metabox['args']['options'];
63
+ $tabs = array(
64
+ $this->message('tab_owner') => $this->owner_panel($options),
65
+ $this->message('tab_address') => $this->address_panel($options));
66
+ if ($this->utils->is_html5()) $tabs += array($this->message('tab_geo') => $this->geo_panel($options));
67
+ $tabs += array(
68
+ $this->message('tab_contact') => $this->contact_panel($options),
69
+ $this->message('tab_legal') => $this->legal_panel($options));
70
+ print $this->tabbed_metabox($metabox['id'], $tabs);
71
  }
72
 
73
+
74
  function owner_panel($terms) {
75
+ return $this->fetch_text_field('owner', $terms['owner'], array('size' =>30)) .
76
+ $this->fetch_text_field('country', $terms['country'], array('size' => 30)) ;
77
+ }
78
+
79
+ function address_panel($terms) {
80
+ $s = $this->fetch_form_field('address', $terms['address'], 'textarea', array(), array('cols' => 30, 'rows' => 5));
81
+ if ($this->utils->is_html5()) {
82
+ return $s .
83
+ $this->message('address_instructions').
84
  $this->fetch_text_field('street_address', $terms['street_address'], array('size' => 30)) .
85
  $this->fetch_text_field('locality', $terms['locality'], array('size' => 30)) .
86
  $this->fetch_text_field('region', $terms['region'], array('size' => 30)) .
87
+ $this->fetch_text_field('postal_code', $terms['postal_code'], array('size' => 12)) ;
88
+ } else {
89
+ return $s;
90
+ }
91
+ }
92
+
93
+ function geo_panel($terms) {
94
+ return $this->message('geo_instructions').
95
  $this->fetch_text_field('latitude', $terms['latitude'], array('size' => 12)) .
96
  $this->fetch_text_field('longitude', $terms['longitude'], array('size' => 12)) .
97
  $this->fetch_text_field('map', $terms['map'], array('size' =>30));
 
 
 
98
  }
99
 
100
  function contact_panel($terms) {
113
  $this->fetch_text_field('copyright_start_year', $terms['copyright_start_year'], array('size' => 5));
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  function intro_panel() {
117
+ printf('<p>%1$s</p>', $this->message('intro_instructions'));
118
  }
119
 
120
 
classes/class-credits-widgets.php CHANGED
@@ -1,52 +1,27 @@
1
  <?php
2
  class Footer_Putter_Copyright_Widget extends Footer_Putter_Widget {
3
 
4
- private $credits;
5
- private $defaults = array(
6
- 'nav_menu' => 0, 'center' => true, 'two_lines' => true,
7
- 'show_copyright' => true, 'show_address' => true, 'show_telephone' => true, 'show_email' => false,
8
- 'show_return' => true, 'return_class' => '', 'footer_class' => '', 'visibility' => '');
9
-
10
- private $tips = array(
11
- 'nav_menu' => array('heading' => 'Footer Menu', 'tip' => 'Choose the menu to display in the footer'),
12
- 'center' => array('heading' => 'Center Menu', 'tip' => 'Center the footer horizontally'),
13
- 'layout' => array('heading' => 'Layout', 'tip' => 'Choose order and layout in which menu, copyright and contact are placed, + means same line, | means new line'),
14
- 'show_copyright' => array('heading' => 'Show Copyright', 'tip' => 'Show copyright holder an year range'),
15
- 'show_address' => array('heading' => 'Show Address', 'tip' => 'Show contact address'),
16
- 'show_telephone' => array('heading' => 'Show Telephone Number', 'tip' => 'Show telephone number(s)'),
17
- 'show_email' => array('heading' => 'Show Email Address', 'tip' => 'Show email'),
18
- 'use_microdata' => array('heading' => 'Use HTML5 Microdata', 'tip' => 'Express organization, contact and any geo-coordinates using HTML5 microdata'),
19
- 'show_return' => array('heading' => 'Show Return To Top Links', 'tip' => 'Show link to return to the top of the page'),
20
- 'return_class' => array('heading' => 'Return To Top', 'tip' => 'Add custom classes to apply to the return to top links'),
21
- 'footer_class' => array('heading' => 'Footer Credits', 'tip' => 'Add custom classes to apply to the footer menu, copyright and contact information'),
22
- 'visibility' => array('heading' => 'Show or Hide', 'tip' => 'Determine on which pages the footer widget is displayed'),
23
- );
24
-
25
- function get_tips() {
26
- return $this->tips;
27
- }
28
-
29
- function get_defaults() {
30
- return $this->defaults;
31
- }
32
 
33
  function __construct() {
34
- $widget_ops = array( 'description' => __( "A widget displaying menu links, copyright and company details" ) );
35
- parent::__construct('footer_copyright', __('Footer Copyright Widget'), $widget_ops);
36
- $this->credits = $this->plugin->get_credits();
 
37
  }
38
 
39
  function widget( $args, $instance ) {
40
- extract( $args );
41
- $instance = wp_parse_args( (array) $instance, $this->defaults );
42
  if ($this->hide_widget($instance['visibility'])) return; //check visibility requirements
 
 
43
 
44
- if ($footer = $this->credits->footer($instance))
45
  printf ('%1$s%2$s%3$s', $before_widget, $footer, $after_widget);
46
  }
47
 
48
  function update( $new_instance, $old_instance ) {
49
- $instance = wp_parse_args( (array) $old_instance, $this->defaults );
50
  $instance['nav_menu'] = !empty($new_instance['nav_menu']) ? $new_instance['nav_menu'] : 0;
51
  $instance['show_copyright'] = !empty($new_instance['show_copyright']) ? 1 : 0;
52
  $instance['show_telephone'] = !empty($new_instance['show_telephone']) ? 1 : 0;
@@ -63,7 +38,7 @@ class Footer_Putter_Copyright_Widget extends Footer_Putter_Widget {
63
  }
64
 
65
  function form( $instance ) {
66
- $this->form_init ($instance, $this->tips);
67
  $menu_terms = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
68
  if ( !$menu_terms ) {
69
  echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.' ), admin_url('nav-menus.php') ) .'</p>';
@@ -82,19 +57,24 @@ class Footer_Putter_Copyright_Widget extends Footer_Putter_Widget {
82
  $this->print_form_field('show_email', 'checkbox');
83
  $this->print_form_field('show_return', 'checkbox');
84
  if ($this->utils->is_html5()) $this->print_form_field('use_microdata', 'checkbox');
85
- $this->print_form_field('layout', 'select', $this->credits->get_layouts());
86
- print <<< CUSTOM_CLASSES
87
- <hr/><h4>Custom Classes</h4>
88
- <p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
89
- <p>For your convenience we have defined 3 color classes <i>dark</i>, <i>light</i> and <i>white</i>, and 2 size classes,
90
- <i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes.</p>
91
- CUSTOM_CLASSES;
92
-
93
  $this->print_form_field('return_class', 'text', array(), array('size' => 10));
94
  $this->print_form_field('footer_class', 'text', array(), array('size' => 10));
95
- print ('<hr/><h4>Widget Presence</h4>');
96
  $this->print_form_field('visibility', 'radio', $this->get_visibility_options(), array('separator' => '<br />'));
97
  print '</div>';
98
  }
99
-
 
 
 
 
 
 
 
 
 
 
100
  }
1
  <?php
2
  class Footer_Putter_Copyright_Widget extends Footer_Putter_Widget {
3
 
4
+ private $footer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  function __construct() {
7
+ $widget_name = $this->message('copyright_widget_name');
8
+ $widget_ops = array( 'description' => $this->message('copyright_widget_description') );
9
+ parent::__construct('footer_copyright', $widget_name, $widget_ops);
10
+ $this->footer = $this->plugin->get_module('footer');
11
  }
12
 
13
  function widget( $args, $instance ) {
14
+ $instance = wp_parse_args( (array) $instance, $this->footer->get_widget_defaults() );
 
15
  if ($this->hide_widget($instance['visibility'])) return; //check visibility requirements
16
+ $args = $this->override_args($args, $instance) ;
17
+ extract( $args );
18
 
19
+ if ($footer = $this->footer->footer($instance))
20
  printf ('%1$s%2$s%3$s', $before_widget, $footer, $after_widget);
21
  }
22
 
23
  function update( $new_instance, $old_instance ) {
24
+ $instance = $this->update_instance( $new_instance, $old_instance );
25
  $instance['nav_menu'] = !empty($new_instance['nav_menu']) ? $new_instance['nav_menu'] : 0;
26
  $instance['show_copyright'] = !empty($new_instance['show_copyright']) ? 1 : 0;
27
  $instance['show_telephone'] = !empty($new_instance['show_telephone']) ? 1 : 0;
38
  }
39
 
40
  function form( $instance ) {
41
+ $this->form_init ($instance);
42
  $menu_terms = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
43
  if ( !$menu_terms ) {
44
  echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.' ), admin_url('nav-menus.php') ) .'</p>';
57
  $this->print_form_field('show_email', 'checkbox');
58
  $this->print_form_field('show_return', 'checkbox');
59
  if ($this->utils->is_html5()) $this->print_form_field('use_microdata', 'checkbox');
60
+ $this->print_form_field('layout', 'select', $this->get_layout_options());
61
+ printf('<hr/><h4>%1$s</h4>', $this->message('custom_classes_heading'));
62
+ print $this->message('custom_classes_instructions');
 
 
 
 
 
63
  $this->print_form_field('return_class', 'text', array(), array('size' => 10));
64
  $this->print_form_field('footer_class', 'text', array(), array('size' => 10));
65
+ printf ('<hr/><h4>%1$s</h4>', $this->message('widget_presence_heading') );
66
  $this->print_form_field('visibility', 'radio', $this->get_visibility_options(), array('separator' => '<br />'));
67
  print '</div>';
68
  }
69
+
70
+
71
+ private function get_layout_options() {
72
+ $options = array();
73
+ $layouts = $this->footer->get_layouts();
74
+ foreach ($layouts as $layout) {
75
+ $id = 'layout_'. str_replace('-','_', $layout);
76
+ $options[$layout] = $this->message($id);
77
+ }
78
+ return $options;
79
+ }
80
  }
classes/class-credits.php CHANGED
@@ -1,12 +1,11 @@
1
  <?php
2
- class Footer_Credits {
3
 
4
- const CODE = 'footer-credits'; //element prefix
5
- const OPTIONS_NAME = 'footer_credits_options';
6
  const SIDEBAR_ID = 'last-footer';
7
 
8
  protected $defaults = array(
9
- 'terms' => array(
10
  'site' => '',
11
  'owner' => '',
12
  'address' => '',
@@ -26,110 +25,35 @@ class Footer_Credits {
26
  'courts' => '',
27
  'updated' => '',
28
  'privacy_contact' => '',
29
- 'terms_contact' => ''),
30
- 'nav_menu' => 0,
31
- 'center' => true,
32
- 'layout' => false,
33
- 'separator' => '&nbsp;&middot;&nbsp;',
34
- 'show_copyright' => true,
35
- 'show_telephone' => true,
36
- 'show_email' => false,
37
- 'show_address' => true,
38
- 'show_return' => true,
39
- 'return_text' => 'Return To Top',
40
- 'return_class' => '',
41
- 'footer_class' => '',
42
- 'footer_hook' => '',
43
- 'footer_remove' => true,
44
- 'footer_filter_hook' => '',
45
- 'visibility' => '' ,
46
- 'use_microdata' => false,
47
- 'hide_wordpress' => false
48
  );
49
 
50
- private $layouts = array(
51
- 'single' => 'Single line: Menu + copyright + contact',
52
- 'single-alt' => 'Single line: Menu + contact + copyright',
53
- 'contact-below' => '2 lines: Menu + copyright | Contact',
54
- 'copyright-below' => '2 lines: Menu + contact | Copyright',
55
- 'menu-above' => '2 lines: Menu | Copyright + contact',
56
- 'menu-above-alt' => '2 lines: Menu | Contact + copyright',
57
- 'stacked' => '3 lines : Menu | Copyright | Contact',
58
- 'stacked-alt' => '3 lines : Menu | Contact | Copyright');
59
-
60
- protected $is_landing = false;
61
- private $plugin;
62
- private $utils;
63
- private $options;
64
-
65
- function __construct(){
66
- $this->plugin = Footer_Putter_Plugin::get_instance();
67
- $this->utils = $this->plugin->get_utils();
68
- $this->init();
69
  }
70
 
71
  public function init() {
72
- $defaults = $this->theme_specific_defaults($this->defaults);
73
- $this->options = new Footer_Putter_Options(self::OPTIONS_NAME, $defaults);
74
- add_action('widgets_init',array($this,'register'),20);
75
- add_filter( 'wp_nav_menu_items', array($this, 'fix_home_link'), 10, 2 );
76
  if (!is_admin()) add_action('wp',array($this,'prepare'));
77
  }
78
-
79
- function register() {
80
- $this->register_sidebars();
81
- $this->register_widgets();
82
- }
83
-
84
- private function register_sidebars() {
85
- if ($this->get_option('footer_hook')) {
86
- $tag = $this->is_html5() ? 'section' : 'div';
87
- register_sidebar( array(
88
- 'id' => self::SIDEBAR_ID,
89
- 'name' => __( 'Credibility Footer' ),
90
- 'description' => __( 'Custom footer section for copyright, trademarks, etc.'),
91
- 'before_widget' => '<'.$tag.' id="%1$s" class="widget %2$s"><div class="widget-wrap">',
92
- 'after_widget' => '</div></'.$tag.'>'
93
- ) );
94
- }
95
- }
96
-
97
- private function register_widgets() {
98
- if (class_exists('Footer_Putter_Copyright_Widget')) register_widget('Footer_Putter_Copyright_Widget');
99
- if (class_exists('Footer_Putter_Trademark_Widget')) register_widget('Footer_Putter_Trademark_Widget');
100
- }
101
 
102
  function prepare() {
103
- add_shortcode(self::CODE, array($this, 'footer' ) );
104
  add_shortcode(self::CODE.'-contact', array($this, 'contact' ) );
105
  add_shortcode(self::CODE.'-copyright', array($this, 'copyright' ) );
106
  add_shortcode(self::CODE.'-menu', array($this, 'footer_menu' ) );
107
- add_shortcode(self::CODE.'-return', array($this, 'footer_return' ) );
108
  add_filter('widget_text', 'do_shortcode', 11);
109
  add_action('wp_enqueue_scripts',array($this, 'enqueue_styles' ));
110
 
111
- $this->is_landing = $this->utils->is_landing_page();
112
-
113
- //insert custom footer at specified hook
114
- if ($footer_hook = $this->get_option('footer_hook')) {
115
- if ($this->get_option('footer_remove')) {
116
- remove_all_actions( $footer_hook);
117
- if ($footer_hook =='wp_footer') {
118
- add_action( 'wp_footer', 'wp_print_footer_scripts', 20); //put back the footer scripts
119
- add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); //put back the admin bar
120
- }
121
- }
122
- add_action( $footer_hook, array($this, 'custom_footer'));
123
- }
124
-
125
- //suppress footer output
126
- if ($ffs = $this->get_option('footer_filter_hook'))
127
- add_filter($ffs, array($this, 'no_footer'),100);
128
-
129
- if (is_page('privacy') && $this->get_term('privacy_contact'))
130
  add_filter('the_content', array($this, 'add_privacy_footer'),9 );
131
 
132
- if (is_page('terms') && $this->get_term('terms_contact'))
133
  add_filter('the_content', array($this, 'add_terms_footer'),9 );
134
 
135
  if (is_page('terms') || is_page('privacy') || is_page('affiliates') || is_page('disclaimer'))
@@ -140,64 +64,34 @@ class Footer_Credits {
140
  function enqueue_styles() {
141
  wp_enqueue_style('footer-credits', plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(), $this->plugin->get_version());
142
  }
143
-
144
- function get_option($option_name) {
145
- $options = $this->get_options();
146
- if ($option_name && $options && array_key_exists($option_name,$options))
147
- return $options[$option_name];
148
- else
149
- return false;
150
- }
151
-
152
- function get_options() {
153
- return $this->options->get_options();
154
- }
155
 
156
  function save_options($new_options) {
157
- $new_options['terms'] = $this->sanitize_terms($new_options['terms']);
158
- return $this->options->save_options( $new_options) ;
159
  }
160
 
161
- function get_layouts() { return $this->layouts; }
162
 
163
  function is_html5() {
164
  return $this->utils->is_html5();
165
  }
166
 
167
  private function sanitize_terms($new_terms) {
168
- $new_terms = wp_parse_args($new_terms, $this->defaults['terms']); //ensure terms are complete
169
  $new_terms['site'] = $this->get_default_site();
170
  $new_terms['copyright'] = $this->get_copyright($new_terms['copyright_start_year']); //generate copyright
171
  return $new_terms;
172
  }
173
-
174
- public function is_terms_key($key) {
175
- return array_key_exists($key, $this->defaults['terms']);
176
- }
177
-
178
- public function get_terms() {
179
- return $this->get_option('terms');
180
- }
181
-
182
- public function get_term($term_name) {
183
- $options = $this->get_options();
184
- $terms = is_array($options) && array_key_exists('terms',$options) ? $options['terms'] : false;
185
- if ($term_name && $terms && array_key_exists($term_name,$terms) && $terms[$term_name])
186
- return $terms[$term_name];
187
- else
188
- return $this->get_default_term($term_name);
189
- }
190
 
191
  private function get_default_term($key) {
192
  $default='';
193
  switch ($key) {
194
- case 'owner' : $default = $this->get_term('site'); break;
195
- case 'copyright' : $default = $this->get_copyright($this->get_term('copyright_start_year')); break;
196
  case 'copyright_start_year': $default = date('Y'); break;
197
  case 'copyright_preamble': $default = 'Copyright &copy;'; break;
198
  case 'country' : $default = 'The United States'; break;
199
- case 'courts' : $default = ucwords(sprintf('the courts of %1$s',$this->get_term('country'))); break;
200
- case 'email' : $default = 'privacy@'.strtolower($this->get_term('site')); break;
201
  case 'site' : $default = $this->get_default_site(); break;
202
  case 'updated' : $default = date('d M Y'); break;
203
  default: $default=''; //default is blank for others
@@ -215,24 +109,24 @@ class Footer_Credits {
215
  public function get_copyright($startyear=''){
216
  $thisyear = date("Y");
217
  $format = (empty( $startyear) || ($startyear==$thisyear)) ? '%1$s %3$s' : '%1$s %2$s-%3$s';
218
- return sprintf($format, $this->get_term('copyright_preamble'), $startyear, $thisyear);
219
  }
220
 
221
  public function return_to_top( $text, $class) {
222
- return sprintf( '<div class="footer-return %1$s"><a rel="nofollow" href="#" onclick="window.scrollTo(0,0); return false;" >%2$s</a></div>', trim($class), $text);
223
  }
224
 
225
- private function contact_info($params) {
226
  $org ='';
227
  if ($address = $this->contact_address($params['show_address'], $params['use_microdata'], $params['separator'])) $org .= $address;
228
  if ($telephone = $this->contact_telephone($params['show_telephone'], $params['use_microdata'])) $org .= $telephone;
229
  if ($email = $this->contact_email($params['show_email'], $params['use_microdata'])) $org .= $email;
230
- $format = '<div class="footer-credits-contact %1$s" ' . ($params['use_microdata'] ? ' itemscope="itemscope" itemtype="http://schema.org/Organization"' : '') . '>%2$s</div>';
231
  return sprintf($format, $params['footer_class'], $org);
232
  }
233
 
234
  private function contact_telephone($show_telephone, $microdata ) {
235
- if ($show_telephone && ($telephone = $this->get_term('telephone')))
236
  if ($microdata)
237
  return sprintf('<span itemprop="telephone" class="telephone">%1$s</span>', $telephone) ;
238
  else
@@ -242,7 +136,7 @@ class Footer_Credits {
242
  }
243
 
244
  private function contact_email($show_email, $microdata) {
245
- if ($show_email && ($email = $this->get_term('email')))
246
  return sprintf('<a href="mailto:%1$s" class="email"%2$s>%1$s</a>', $email, $microdata ? ' itemprop="email"' : '') ;
247
  else
248
  return '';
@@ -252,8 +146,8 @@ class Footer_Credits {
252
  if ($show_address)
253
  if ($microdata) {
254
  return $this->org_location($separator);
255
- } elseif ($address = $this->get_term('address'))
256
- return sprintf('<span class="address">%1$s%2$s</span>', $this->format_address($address, $separator), $this->get_term('country'));
257
  return '';
258
  }
259
 
@@ -280,15 +174,15 @@ class Footer_Credits {
280
 
281
  private function location_address($separator) {
282
  $address = '';
283
- if ( $street_address = $this->get_term('street_address'))
284
  $address .= sprintf('<span itemprop="streetAddress">%1$s</span>', $this->format_address($street_address, $separator)) ;
285
- if ( $locality = $this->get_term('locality'))
286
  $address .= sprintf('<span itemprop="addressLocality">%1$s</span>', $this->format_address($locality, $separator)) ;
287
- if ( $region = $this->get_term('region'))
288
  $address .= sprintf('<span itemprop="addressRegion">%1$s</span>', $this->format_address($region, $separator)) ;
289
- if ( $postal_code = $this->get_term('postal_code'))
290
  $address .= sprintf('<span itemprop="postalCode">%1$s</span>', $this->format_address($postal_code, $separator)) ;
291
- if ( $country = $this->get_term('country'))
292
  $address .= sprintf('<span itemprop="addressCountry">%1$s</span>', $country) ;
293
 
294
  if ($address)
@@ -299,13 +193,13 @@ class Footer_Credits {
299
 
300
  private function location_geo() {
301
  $geo = '';
302
- if ( $latitude = $this->get_term('latitude')) $geo .= sprintf('<meta itemprop="latitude" content="%1$s" />', $latitude) ;
303
- if ( $longitude = $this->get_term('longitude')) $geo .= sprintf('<meta itemprop="longitude" content="%1$s" />', $longitude) ;
304
  return $geo ? sprintf('<span itemprop="geo" itemscope="itemscope" itemtype="http://schema.org/GeoCoordinates">%1$s</span>', $geo) : '';
305
  }
306
 
307
  private function location_map() {
308
- if ( $map = $this->get_term('map'))
309
  return sprintf('<a rel="nofollow external" target="_blank" class="map" itemprop="map" href="%1$s">%2$s</a>', $map, __('Map')) ;
310
  else
311
  return '';
@@ -330,60 +224,23 @@ class Footer_Credits {
330
 
331
  public function copyright($atts = array()){
332
  $defaults = array();
333
- $defaults['owner'] = $this->get_term('owner');
334
- $defaults['copyright_start_year'] = $this->get_term('copyright_start_year');
335
  $defaults['footer_class'] = '';
336
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
337
- return sprintf('<div class="footer-credits-copyright %1$s">%2$s</div>', $params['footer_class'], $this->copyright_owner($params));
338
  }
339
 
340
  public function footer_menu($atts = array()) {
341
- $defaults = array('menu' => 'Footer Menu', 'echo' => false, 'container' => false, 'footer_class' => self::CODE);
342
  if (isset($atts['nav_menu'])) $atts['menu'] = $atts['nav_menu'];
343
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
344
- return sprintf ('<div class="footer-credits-menu %1$s">%2$s</div>', $params['footer_class'], wp_nav_menu($params));
345
- }
346
-
347
- public function footer($atts = array()) {
348
- $params = shortcode_atts( $this->get_options(), $atts ); //apply plugin defaults
349
-
350
- if ($params['center']) {
351
- $return_class = 'return-center';
352
- $footer_class = 'footer-center';
353
- $clear = '';
354
- } else {
355
- $return_class = ' return-left';
356
- $footer_class = ' footer-right';
357
- $clear = '<div class="clear"></div>';
358
- }
359
- $layout = isset($atts['layout']) ? $atts['layout'] : 'single';
360
-
361
- $format = '<div class="%4$s %5$s %6$s">'.$this->get_footer_content_order($layout).'</div>%7$s';
362
- return (empty($params['show_return']) ? '' :
363
- $this->return_to_top($params['return_text'], $return_class. ' ' . $params['return_class'])) .
364
- sprintf($format,
365
- (empty($params['nav_menu']) ? '' : $this->footer_menu($params)),
366
- (empty($params['show_copyright']) ? '' : $this->copyright($params)),
367
- $this->contact_info($params),
368
- self::CODE,
369
- $footer_class,
370
- $layout,
371
- $clear
372
- );
373
  }
374
 
375
- private function get_footer_content_order($layout) {
376
- switch ($layout) {
377
- case 'single-alt':
378
- case 'copyright-below':
379
- case 'menu-above-alt':
380
- case 'stacked-alt': return '%1$s%3$s%2$s';
381
- }
382
- return '%1$s%2$s%3$s';
383
- }
384
 
385
  public function terms_filter($content) {
386
- if ($terms = $this->get_terms()) {
387
  $from = array();
388
  $to = array();
389
  foreach ($terms as $term => $value) {
@@ -395,28 +252,14 @@ class Footer_Credits {
395
  return $content;
396
  }
397
 
398
- public function custom_footer() {
399
- if ( is_active_sidebar( self::SIDEBAR_ID) ) {
400
- $class = 'custom-footer'. ($this->get_option('hide_wordpress') ? ' hide-wordpress' :'');
401
- if ($this->is_html5()) {
402
- printf('<footer class="%1$s" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter">', $class);
403
- dynamic_sidebar( self::SIDEBAR_ID );
404
- echo '</footer><!-- end .custom-footer -->';
405
- } else {
406
- printf('<div class="%1$s">', $class);
407
- dynamic_sidebar( self::SIDEBAR_ID );
408
- echo '</div><!-- end .custom-footer -->';
409
- }
410
- }
411
- }
412
 
413
  public function no_footer($content) { return ''; }
414
 
415
  public function add_privacy_footer($content) {
416
- $email = $this->get_term('email');
417
- $address = $this->get_term('address');
418
- $country = $this->get_term('country');
419
- $owner = $this->get_term('owner');
420
  $contact = <<< PRIVACY
421
  <h2>How to Contact Us</h2>
422
  <p>Questions about this statement or about our handling of your information may be sent by email to <a href="mailto:{$email}">{$email}</a>, or by post to {$owner} Privacy Office, {$address} {$country}. </p>
@@ -425,14 +268,14 @@ PRIVACY;
425
  }
426
 
427
  public function add_terms_footer($content) {
428
- $email = $this->get_term('email');
429
- $address = $this->get_term('address');
430
- $country = $this->get_term('country');
431
- $courts = $this->get_term('courts');
432
- $owner = $this->get_term('owner');
433
- $copyright = $this->get_term('copyright');
434
- $updated = $this->get_term('updated');
435
- $terms_contact = $this->get_term('terms_contact');
436
  $disputes = <<< DISPUTES
437
  <h2>Dispute Resolution</h2>
438
  <p>These terms, and any dispute arising from the use of this site, will be governed by {$courts} without regard to its conflicts of laws provisions.</p>
@@ -451,58 +294,6 @@ TERMS;
451
  return $content ;
452
  }
453
 
454
- function fix_home_link( $content, $args) {
455
- $class = is_front_page()? ' class="current_page_item"' : '';
456
- $home_linktexts = array('Home','<span>Home</span>');
457
- foreach ($home_linktexts as $home_linktext) {
458
- $home_link = sprintf('<a>%1$s</a>',$home_linktext);
459
- if (strpos($content, $home_link) !== FALSE)
460
- $content = str_replace ($home_link,sprintf('<a href="%1$s"%2$s>%3$s</a>',home_url(),$class,$home_linktext),$content);
461
- }
462
- return $content;
463
- }
464
 
465
- function footer_return($atts = array()) {
466
- $defaults = array('return_text' => $this->defaults['return_text'], 'return_class' => $this->defaults['return_class']);
467
- $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
468
- return $this->return_to_top($params['return_text'], $params['return_class']);
469
- }
470
 
471
- function theme_specific_defaults($defaults) {
472
- switch (basename( TEMPLATEPATH ) ) {
473
- case 'twentyten':
474
- $defaults['footer_hook'] = 'twentyten_credits'; break;
475
- case 'twentyeleven':
476
- $defaults['footer_hook'] = 'twentyeleven_credits'; break;
477
- case 'twentytwelve':
478
- $defaults['footer_hook'] = 'twentytwelve_credits'; break;
479
- case 'twentythirteen':
480
- $defaults['footer_hook'] = 'twentythirteen_credits'; break;
481
- case 'twentyfourteen':
482
- $defaults['footer_hook'] = 'twentyfourteen_credits'; break;
483
- case 'twentyfifteen':
484
- $defaults['footer_hook'] = 'twentyfifteen_credits'; break;
485
- case 'twentysixteen':
486
- $defaults['footer_hook'] = 'twentysixteen_credits'; break;
487
- case 'twentyseventeen':
488
- $defaults['footer_hook'] = 'get_template_part_template-parts/footer/site'; break;
489
- case 'generatepress':
490
- $defaults['footer_hook'] = 'generate_credits'; break;
491
- case 'delicate':
492
- $defaults['footer_hook'] = 'get_footer'; break;
493
- case 'genesis':
494
- $defaults['footer_hook'] = 'genesis_footer';
495
- $defaults['footer_filter_hook'] = 'genesis_footer_output';
496
- break;
497
- case 'graphene':
498
- $defaults['footer_hook'] = 'graphene_footer'; break;
499
- case 'pagelines':
500
- $defaults['footer_hook'] = 'pagelines_leaf'; break;
501
- default:
502
- $defaults['footer_hook'] = 'wp_footer';
503
- $defaults['footer_remove'] = false;
504
- break;
505
- }
506
- return $defaults;
507
- }
508
  }
1
  <?php
2
+ class Footer_Putter_Credits extends Footer_Putter_Module {
3
 
4
+ const CSS_CLASS = 'footer-putter-credits';
5
+ const CODE = 'footer-credits'; //shortcode prefix
6
  const SIDEBAR_ID = 'last-footer';
7
 
8
  protected $defaults = array(
 
9
  'site' => '',
10
  'owner' => '',
11
  'address' => '',
25
  'courts' => '',
26
  'updated' => '',
27
  'privacy_contact' => '',
28
+ 'terms_contact' => ''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  );
30
 
31
+
32
+
33
+ function get_defaults() {
34
+ return $this->defaults;
35
+ }
36
+
37
+ function get_options_name() {
38
+ return 'terms';
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
41
  public function init() {
 
 
 
 
42
  if (!is_admin()) add_action('wp',array($this,'prepare'));
43
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  function prepare() {
 
46
  add_shortcode(self::CODE.'-contact', array($this, 'contact' ) );
47
  add_shortcode(self::CODE.'-copyright', array($this, 'copyright' ) );
48
  add_shortcode(self::CODE.'-menu', array($this, 'footer_menu' ) );
49
+
50
  add_filter('widget_text', 'do_shortcode', 11);
51
  add_action('wp_enqueue_scripts',array($this, 'enqueue_styles' ));
52
 
53
+ if (is_page('privacy') && $this->get_option('privacy_contact'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  add_filter('the_content', array($this, 'add_privacy_footer'),9 );
55
 
56
+ if (is_page('terms') && $this->get_option('terms_contact'))
57
  add_filter('the_content', array($this, 'add_terms_footer'),9 );
58
 
59
  if (is_page('terms') || is_page('privacy') || is_page('affiliates') || is_page('disclaimer'))
64
  function enqueue_styles() {
65
  wp_enqueue_style('footer-credits', plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(), $this->plugin->get_version());
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  function save_options($new_options) {
69
+ $new_options = $this->sanitize_terms($new_options);
70
+ return parent::save_options( $new_options) ;
71
  }
72
 
 
73
 
74
  function is_html5() {
75
  return $this->utils->is_html5();
76
  }
77
 
78
  private function sanitize_terms($new_terms) {
79
+ $new_terms = wp_parse_args($new_terms, $this->defaults); //ensure terms are complete
80
  $new_terms['site'] = $this->get_default_site();
81
  $new_terms['copyright'] = $this->get_copyright($new_terms['copyright_start_year']); //generate copyright
82
  return $new_terms;
83
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  private function get_default_term($key) {
86
  $default='';
87
  switch ($key) {
88
+ case 'owner' : $default = $this->get_option('site'); break;
89
+ case 'copyright' : $default = $this->get_copyright($this->get_option('copyright_start_year')); break;
90
  case 'copyright_start_year': $default = date('Y'); break;
91
  case 'copyright_preamble': $default = 'Copyright &copy;'; break;
92
  case 'country' : $default = 'The United States'; break;
93
+ case 'courts' : $default = ucwords(sprintf('the courts of %1$s',$this->get_option('country'))); break;
94
+ case 'email' : $default = 'privacy@'.strtolower($this->get_option('site')); break;
95
  case 'site' : $default = $this->get_default_site(); break;
96
  case 'updated' : $default = date('d M Y'); break;
97
  default: $default=''; //default is blank for others
109
  public function get_copyright($startyear=''){
110
  $thisyear = date("Y");
111
  $format = (empty( $startyear) || ($startyear==$thisyear)) ? '%1$s %3$s' : '%1$s %2$s-%3$s';
112
+ return sprintf($format, $this->get_option('copyright_preamble'), $startyear, $thisyear);
113
  }
114
 
115
  public function return_to_top( $text, $class) {
116
+ return sprintf( '<div class="footer-return %1$s"><span>%2$s</span></div>', trim($class), $text);
117
  }
118
 
119
+ public function contact_info($params) {
120
  $org ='';
121
  if ($address = $this->contact_address($params['show_address'], $params['use_microdata'], $params['separator'])) $org .= $address;
122
  if ($telephone = $this->contact_telephone($params['show_telephone'], $params['use_microdata'])) $org .= $telephone;
123
  if ($email = $this->contact_email($params['show_email'], $params['use_microdata'])) $org .= $email;
124
+ $format = '<div class="footer-putter-contact %1$s" ' . ($params['use_microdata'] ? ' itemscope="itemscope" itemtype="http://schema.org/Organization"' : '') . '>%2$s</div>';
125
  return sprintf($format, $params['footer_class'], $org);
126
  }
127
 
128
  private function contact_telephone($show_telephone, $microdata ) {
129
+ if ($show_telephone && ($telephone = $this->get_option('telephone')))
130
  if ($microdata)
131
  return sprintf('<span itemprop="telephone" class="telephone">%1$s</span>', $telephone) ;
132
  else
136
  }
137
 
138
  private function contact_email($show_email, $microdata) {
139
+ if ($show_email && ($email = $this->get_option('email')))
140
  return sprintf('<a href="mailto:%1$s" class="email"%2$s>%1$s</a>', $email, $microdata ? ' itemprop="email"' : '') ;
141
  else
142
  return '';
146
  if ($show_address)
147
  if ($microdata) {
148
  return $this->org_location($separator);
149
+ } elseif ($address = $this->get_option('address'))
150
+ return sprintf('<span class="address">%1$s%2$s</span>', $this->format_address($address, $separator), $this->get_option('country'));
151
  return '';
152
  }
153
 
174
 
175
  private function location_address($separator) {
176
  $address = '';
177
+ if ( $street_address = $this->get_option('street_address'))
178
  $address .= sprintf('<span itemprop="streetAddress">%1$s</span>', $this->format_address($street_address, $separator)) ;
179
+ if ( $locality = $this->get_option('locality'))
180
  $address .= sprintf('<span itemprop="addressLocality">%1$s</span>', $this->format_address($locality, $separator)) ;
181
+ if ( $region = $this->get_option('region'))
182
  $address .= sprintf('<span itemprop="addressRegion">%1$s</span>', $this->format_address($region, $separator)) ;
183
+ if ( $postal_code = $this->get_option('postal_code'))
184
  $address .= sprintf('<span itemprop="postalCode">%1$s</span>', $this->format_address($postal_code, $separator)) ;
185
+ if ( $country = $this->get_option('country'))
186
  $address .= sprintf('<span itemprop="addressCountry">%1$s</span>', $country) ;
187
 
188
  if ($address)
193
 
194
  private function location_geo() {
195
  $geo = '';
196
+ if ( $latitude = $this->get_option('latitude')) $geo .= sprintf('<meta itemprop="latitude" content="%1$s" />', $latitude) ;
197
+ if ( $longitude = $this->get_option('longitude')) $geo .= sprintf('<meta itemprop="longitude" content="%1$s" />', $longitude) ;
198
  return $geo ? sprintf('<span itemprop="geo" itemscope="itemscope" itemtype="http://schema.org/GeoCoordinates">%1$s</span>', $geo) : '';
199
  }
200
 
201
  private function location_map() {
202
+ if ( $map = $this->get_option('map'))
203
  return sprintf('<a rel="nofollow external" target="_blank" class="map" itemprop="map" href="%1$s">%2$s</a>', $map, __('Map')) ;
204
  else
205
  return '';
224
 
225
  public function copyright($atts = array()){
226
  $defaults = array();
227
+ $defaults['owner'] = $this->get_option('owner');
228
+ $defaults['copyright_start_year'] = $this->get_option('copyright_start_year');
229
  $defaults['footer_class'] = '';
230
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
231
+ return sprintf('<div class="footer-putter-copyright %1$s">%2$s</div>', $params['footer_class'], $this->copyright_owner($params));
232
  }
233
 
234
  public function footer_menu($atts = array()) {
235
+ $defaults = array('menu' => 'Footer Menu', 'echo' => false, 'container' => false, 'footer_class' => self::CSS_CLASS);
236
  if (isset($atts['nav_menu'])) $atts['menu'] = $atts['nav_menu'];
237
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
238
+ return sprintf ('<div class="footer-putter-menu><nav %1$s">%2$s</nav></div>', $params['footer_class'], wp_nav_menu($params));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  }
240
 
 
 
 
 
 
 
 
 
 
241
 
242
  public function terms_filter($content) {
243
+ if ($terms = $this->get_options()) {
244
  $from = array();
245
  $to = array();
246
  foreach ($terms as $term => $value) {
252
  return $content;
253
  }
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
  public function no_footer($content) { return ''; }
257
 
258
  public function add_privacy_footer($content) {
259
+ $email = $this->get_option('email');
260
+ $address = $this->get_option('address');
261
+ $country = $this->get_option('country');
262
+ $owner = $this->get_option('owner');
263
  $contact = <<< PRIVACY
264
  <h2>How to Contact Us</h2>
265
  <p>Questions about this statement or about our handling of your information may be sent by email to <a href="mailto:{$email}">{$email}</a>, or by post to {$owner} Privacy Office, {$address} {$country}. </p>
268
  }
269
 
270
  public function add_terms_footer($content) {
271
+ $email = $this->get_option('email');
272
+ $address = $this->get_option('address');
273
+ $country = $this->get_option('country');
274
+ $courts = $this->get_option('courts');
275
+ $owner = $this->get_option('owner');
276
+ $copyright = $this->get_option('copyright');
277
+ $updated = $this->get_option('updated');
278
+ $terms_contact = $this->get_option('terms_contact');
279
  $disputes = <<< DISPUTES
280
  <h2>Dispute Resolution</h2>
281
  <p>These terms, and any dispute arising from the use of this site, will be governed by {$courts} without regard to its conflicts of laws provisions.</p>
294
  return $content ;
295
  }
296
 
 
 
 
 
 
 
 
 
 
 
297
 
 
 
 
 
 
298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  }
classes/class-dashboard.php CHANGED
@@ -1,137 +1,90 @@
1
  <?php
2
  class Footer_Putter_Dashboard extends Footer_Putter_Admin {
 
3
 
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($this->get_name(), $this->get_name(), 'manage_options',
15
- $this->get_slug(), array($this,'page_content'), $this->icon );
16
- add_submenu_page($this->get_slug(), $this->get_name(), $intro, 'manage_options', $this->get_slug(), array($this,'page_content') );
17
- add_action('admin_enqueue_scripts', array($this, 'register_admin_styles'));
18
- add_action('admin_enqueue_scripts', array($this, 'register_tooltip_styles'));
19
  add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
20
  }
21
 
22
  function page_content() {
23
- $title = $this->admin_heading('Footer Putter v'. $this->get_version());
24
- $this->print_admin_form($title, __CLASS__, $this->get_keys());
25
  }
26
 
27
  function load_page() {
28
- $this->add_tooltip_support();
29
- $this->add_meta_box('intro', 'Introduction', 'intro_panel');
30
- $this->add_meta_box('details','Details', 'footer_panel');
31
- $this->add_meta_box('news', $this->get_name().' '.__('News'), 'news_panel', null, 'advanced');
32
- add_action('admin_enqueue_scripts', array($this, 'enqueue_admin'));
33
  }
34
 
35
- function footer_panel($post,$metabox) {
36
- print $this->tabbed_metabox($metabox['id'], array(
37
- 'Widgets' => $this->widgets_panel(),
38
- 'Instructions' => $this->instructions_panel(),
39
- 'Footer Hook' => $this->hooks_panel(),
40
- 'Useful Links' => $this->links_panel()
41
- ));
42
  }
43
 
44
-
45
- function intro_panel($post,$metabox) {
46
- $plugin = $this->get_name();
47
- print <<< INTRO_PANEL
48
- <p>{$plugin} allows you to put a footer to your site that adds credibility to your site, with BOTH visitors and search engines.</p>
49
- <p>Google is looking for some indicators that the site is about a real business.</p>
50
- <ol>
51
- <li>The name of the business or site owner</li>
52
- <li>A copyright notice that is up to date</li>
53
- <li>A telephone number</li>
54
- <li>A postal address</li>
55
- <li>Links to Privacy Policy and Terms of Use pages</p>
56
- </ol>
57
 
58
- <p>Human visitors may pay some credence to this information but will likely be more motivated by trade marks, trust marks and service marks.</p>
59
- INTRO_PANEL;
60
  }
 
 
 
 
 
 
 
 
 
 
61
 
 
 
 
 
 
 
 
 
 
 
62
  function widgets_panel() {
63
- return <<< WIDGETS_PANEL
64
- <p>The plugins define two widgets:
65
- <ol>
66
- <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>
67
- <li>a <b>Trademarks Widget</b> that displays a line of trademarks that you have previously set up as "Links".
68
- </ol></p>
69
- <p>Typically you will drag both widgets into the Custom Footer Widget Area.</p>
70
- <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>
71
- WIDGETS_PANEL;
72
- }
73
 
74
- function instructions_panel() {
75
- $plugin = $this->get_name();
76
- $widgets_url = admin_url('widgets.php');
77
- $credits_url = $this->plugin->get_link_url('credits');
78
- $trademarks_url = $this->plugin->get_link_url('trademarks');
79
- return <<< INSTRUCTIONS_PANEL
80
- <h4>Create Standard Pages And Footer Menu</h4>
81
- <ol>
82
- <li>Create a <i>Privacy Policy</i> page with the slug/permalink <em>privacy</em>, choose a page template with no sidebar.</li>
83
- <li>Create a <i>Terms of Use</i> page with the slug/permalink <em>terms</em>, choose a page template with no sidebar.</li>
84
- <li>Create a <i>Contact</i> page with a contact form.</li>
85
- <li>Create an <i>About</i> page, with information either about the site or about its owner.</li>
86
- <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>
87
- <li>Create a WordPress menu called <i>Footer Menu</i> and add the above pages to the footer menu.</li>
88
- </ol>
89
- <h4>Update Business Information</h4>
90
- <ol>
91
- <li>Go to <a href="{$credits_url}">Footer Credits</a> and update the Site Owner details, contact and legal information.</li>
92
- <li>Optionally include contact details such as telephone and email. You may also want to add Geographical co-ordinates for your office location for the purposes of local search.</li>
93
- </ol>
94
- <h4>Create Trademark Links</h4>
95
- <ol>
96
- <li>Go to <a href="{$trademarks_url}"><i>Footer Trademarks</i></a> and follow the instructions:</li>
97
- <li>Create a link category with a name such as <i>Trademarks</i></li>
98
- <li>Add a link for each of your trademarks and put each in the <i>Trademarks</i> link category</li>
99
- <li>For each link specify the link URL and the image URL</li>
100
- </ol>
101
- <h4>Set Up Footer Widgets</h4>
102
- <ol>
103
- <li>Go to <a href="{$widgets_url}"><i>Appearance > Widgets</i></a></li>
104
- <li>Drag a <i>Footer Copyright Widget</i> and a <i>Footer Trademarks widget</i> into a suitable footer Widget Area</li>
105
- <li>For the <i>Footer Trademarks</i> widget and choose your link category, e.g. <i>Trademarks</i>, and select a sort order</li>
106
- <li>For the <i>Footer Copyright</i> widget, select the <i>Footer Menu</i> and choose what copyright and contact information you want to you display</li>
107
- <li>Review the footer of the site. You can use the widget to change font sizes and colors using pre-defined classes such as <i>tiny</i>, <i>small</i>, <i>dark</i>, <i>light</i> or <i>white</i> or add your own custom classes</li>
108
- <li>You can also choose to suppress the widgets on special pages such as landing pages.</li>
109
- <li>If the footer is not in the right location you can use the <i>Footer Hook</i> feature described below to add a new widget area called <i>Credibility Footer</i> where you can locate the footer widgets.</li>
110
- </ol>
111
- INSTRUCTIONS_PANEL;
112
  }
113
 
114
  function hooks_panel() {
115
- $home_url = $this->plugin->get_home();
116
- $plugin = $this->get_name();
117
- return <<< HOOKS_PANEL
118
- <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>
119
- <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>,
120
- 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>
121
- <p>Check out the <a href="{$home_url}">{$plugin} page</a> for more information about the plugin.</p>
122
- HOOKS_PANEL;
123
  }
124
 
125
  function links_panel() {
126
- $home = $this->plugin->get_home();
127
- return <<< LINKS_PANEL
128
- <ul>
129
- <li><a rel="external" target="_blank" href="{$home}">Footer Putter Plugin Home</a></li>
130
- <li><a rel="external" target="_blank" href="https://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks/">Themes and Recommended Footer Hooks</a></li>
131
- <li><a rel="external" target="_blank" href="https://www.diywebmastery.com/4098/how-to-add-a-different-footer-on-landing-pages/">How To Use A Different Footer On Landing Pages</a></li>
132
- <li><a rel="external" target="_blank" href="https://www.diywebmastery.com/4109/using-html5-microdata-footer/">Using HTML5 Microdata for better SEO and Local Search</a></li>
133
- </ul>
134
- LINKS_PANEL;
135
  }
136
 
137
  }
1
  <?php
2
  class Footer_Putter_Dashboard extends Footer_Putter_Admin {
3
+ private $settings = array();
4
 
5
  function init() {
6
  add_action('admin_menu', array($this, 'admin_menu'));
7
+ add_filter('plugin_action_links',array($this, 'plugin_action_links'), 10, 2 );
8
  add_action('admin_enqueue_scripts', array($this ,'register_tooltip_styles'));
9
  add_action('admin_enqueue_scripts', array($this ,'register_admin_styles'));
10
+ add_action('load-widgets.php', array($this, 'add_tooltip_support'));
11
  }
12
 
13
  function admin_menu() {
14
+ $this->screen_id = add_menu_page($this->get_name(), $this->get_name(), 'manage_options',
15
+ $this->get_slug(), array($this,'page_content'), $this->icon);
16
+ $intro = $this->message('menu_dashboard');
17
+ add_submenu_page($this->plugin->get_slug(), $this->get_name(), $intro, 'manage_options', $this->get_slug(), array($this, 'page_content') );
 
 
18
  add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
19
  }
20
 
21
  function page_content() {
22
+ $title = $this->admin_heading(sprintf('%1$s (v%2$s)', $this->get_name(), $this->get_version()));
23
+ $this->print_admin_form($title, __CLASS__);
24
  }
25
 
26
  function load_page() {
27
+ $this->init_tooltips();
28
+ add_action ('admin_enqueue_scripts',array($this, 'enqueue_admin'));
29
+ $this->add_meta_box('overview', $this->message('section_overview_title'), 'overview_panel');
30
+ $this->add_meta_box('details',$this->message('section_details_title'), 'details_panel');
31
+ $this->add_meta_box('news', $this->message('plugin_news'), 'news_panel', null, 'advanced');
32
  }
33
 
34
+ function overview_panel($post, $metabox) {
35
+ print $this->tabbed_metabox($metabox['id'], array (
36
+ $this->message('tab_intro') => $this->intro_panel(),
37
+ $this->message('tab_features') => $this->features_panel(),
38
+ $this->message('tab_version') => $this->version_panel(),
39
+ $this->message('tab_help') => $this->help_panel(),
40
+ ));
41
  }
42
 
43
+ function intro_panel() {
44
+ return sprintf('<p>%1$s</p>', $this->message('plugin_description'));
45
+ }
 
 
 
 
 
 
 
 
 
 
46
 
47
+ function features_panel() {
48
+ return $this->message('plugin_features');
49
  }
50
+
51
+ function version_panel() {
52
+ return sprintf('<p>%1$s %2$s</p>',
53
+ sprintf($this->message('plugin_version'), $this->get_name(), $this->get_version()),
54
+ sprintf($this->message('plugin_changelog'),$this->plugin->get_changelog()) );
55
+ }
56
+
57
+ function help_panel() {
58
+ return sprintf($this->message('plugin_help'), $this->plugin->get_home());
59
+ }
60
 
61
+
62
+ function details_panel($post,$metabox) {
63
+ print $this->tabbed_metabox($metabox['id'], array(
64
+ $this->message('tab_widgets') => $this->widgets_panel(),
65
+ $this->message('tab_instructions') => $this->instructions_panel(),
66
+ $this->message('tab_hooks') => $this->hooks_panel(),
67
+ $this->message('tab_links') => $this->links_panel()
68
+ ));
69
+ }
70
+
71
  function widgets_panel() {
72
+ return $this->message('help_widgets');
73
+ }
 
 
 
 
 
 
 
 
74
 
75
+ function instructions_panel() {;
76
+ return $this->message('help_pages').
77
+ sprintf($this->message('help_update_business_information'), $this->plugin->get_module('credits', true)->get_url()) .
78
+ sprintf($this->message('help_create_trademark_links'), $this->plugin->get_module('trademarks', true)->get_url()) .
79
+ sprintf($this->message('help_setup_footer_widgets'), admin_url('widgets.php'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
  function hooks_panel() {
83
+ return $this->message('help_hooks');
 
 
 
 
 
 
 
84
  }
85
 
86
  function links_panel() {
87
+ return sprintf($this->message('help_links'),$this->plugin->get_home() ) ;
 
 
 
 
 
 
 
 
88
  }
89
 
90
  }
classes/class-footer-admin.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Footer_Putter_Footer_Admin extends Footer_Putter_Admin{
3
+
4
+ private $footer;
5
+
6
+ function init() {
7
+ $this->footer = $this->plugin->get_module('footer');
8
+ add_action('admin_menu',array($this, 'admin_menu'));
9
+ }
10
+
11
+ function admin_menu() {
12
+ $plugin_name = $this->get_name();
13
+ $this->screen_id = add_submenu_page($this->get_parent_slug(), $plugin_name .' Footer', 'Footer', 'manage_options', $this->get_slug(), array($this,'page_content'));
14
+ add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
15
+ }
16
+
17
+ function page_content() {
18
+ $title = $this->admin_heading(sprintf('%1$s (v%2$s)', $this->get_name(), $this->get_version()));
19
+ $this->print_admin_form($title, __CLASS__, $this->footer->get_keys());
20
+ }
21
+
22
+ function load_page() {
23
+ if (isset($_POST['options_update'])) $this->save_footer();
24
+ $this->init_tooltips();
25
+ $this->add_meta_box('introduction', $this->message('section_footer_intro_title') , 'intro_panel');
26
+ $this->add_meta_box('footer', $this->message('section_footer_settings_title') , 'footer_panel', array ('options' => $this->options->get_options()));
27
+ $this->add_meta_box('example', $this->message('section_footer_preview_title'), 'preview_panel', null, 'advanced');
28
+ $this->add_meta_box('news', $this->message('plugin_news'), 'news_panel', null, 'advanced');
29
+ add_action('admin_enqueue_scripts', array($this, 'enqueue_footer_styles'));
30
+ add_action('admin_enqueue_scripts', array($this, 'enqueue_admin'));
31
+ }
32
+
33
+ function enqueue_footer_styles() {
34
+ wp_enqueue_style($this->get_code(), plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),$this->get_version());
35
+ }
36
+
37
+
38
+ function save_footer() {
39
+ check_admin_referer(__CLASS__);
40
+ $settings = $this->message('settings_name');
41
+ $saved = false;
42
+ $page_options = explode(',', stripslashes($_POST['page_options']));
43
+ if ($page_options) {
44
+ $options = $this->options->get_options();
45
+ foreach ($page_options as $option) {
46
+ $val = array_key_exists($option, $_POST) ? trim(stripslashes($_POST[$option])) : '';
47
+ switch ($option) {
48
+ case 'footer_remove' : $options[$option] = !empty($val); break;
49
+ case 'footer_hook':
50
+ case 'footer_filter_hook': $options[$option] = preg_replace('/\W-\//','',$val); break;
51
+ default: $options[$option] = trim($val);
52
+ }
53
+ } //end for ;
54
+ $saved = $this->footer->save_options($options) ;
55
+ if ($saved) {
56
+ $updated = true;
57
+ $this->add_admin_notice($settings, $this->message('settings_saved'));
58
+ } else {
59
+ $this->add_admin_notice($settings, $this->message('settings_unchanged'), true);
60
+ }
61
+ } else {
62
+ $this->add_admin_notice($settings, $this->message('settings_not_found'), true);
63
+ }
64
+ return $saved;
65
+ }
66
+
67
+ function footer_panel($post,$metabox) {
68
+ $this->add_tooltips($this->footer->get_keys());
69
+ $options = $metabox['args']['options'];
70
+ print $this->tabbed_metabox($metabox['id'], array(
71
+ $this->message('tab_return') => $this->return_panel($options),
72
+ $this->message('tab_advanced') => $this->advanced_panel($options)
73
+ ));
74
+ }
75
+
76
+ function return_panel($options) {
77
+ return $this->fetch_text_field('return_text', $options['return_text'], array('size' => 20));
78
+ }
79
+
80
+ function advanced_panel($options) {
81
+ $url = 'https://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks/';
82
+ $twenty_something = ($theme = wp_get_theme()) && (strpos(strtolower($theme->get('Name')), 'twenty') !== FALSE);
83
+ return sprintf($this->message('advanced_instructions'), $url) .
84
+ $this->fetch_text_field('footer_hook', $options['footer_hook'], array('size' => 50)) .
85
+ $this->fetch_form_field('footer_remove', $options['footer_remove'], 'checkbox') .
86
+ sprintf('<p>%1$s</p>', $this->message('remove_instructions')) .
87
+ $this->fetch_text_field('footer_filter_hook', $options['footer_filter_hook'], array('size' => 50)).
88
+ ($twenty_something ? $this->fetch_form_field('hide_wordpress', $options['hide_wordpress'], 'checkbox') : '');
89
+ }
90
+
91
+
92
+ function preview_panel() {
93
+ printf ('<p><i>%1$s</i></p><hr/>%2$s',
94
+ $this->message('preview_instructions'),
95
+ $this->footer->footer(array('nav_menu' => 'Footer Menu')));
96
+ }
97
+
98
+ function intro_panel() {
99
+ printf('<p>%1$s</p>', $this->message('intro_advanced_instructions'));
100
+ }
101
+
102
+ }
classes/class-footer.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Footer_Putter_Footer extends Footer_Putter_Module {
3
+
4
+ const CSS_CLASS = 'footer-putter-credits';
5
+ const CODE = 'footer-credits'; //shortcode prefix
6
+ const SIDEBAR_ID = 'last-footer';
7
+
8
+ protected $defaults = array(
9
+ 'return_text' => 'Return To Top',
10
+ 'footer_hook' => '',
11
+ 'footer_remove' => true,
12
+ 'footer_filter_hook' => ''
13
+ );
14
+
15
+ protected $widget_defaults = array(
16
+ 'nav_menu' => 0,
17
+ 'center' => true,
18
+ 'layout' => false,
19
+ 'separator' => '&nbsp;&middot;&nbsp;',
20
+ 'show_copyright' => true,
21
+ 'show_telephone' => true,
22
+ 'show_email' => false,
23
+ 'show_address' => true,
24
+ 'show_return' => true,
25
+ 'return_text' => 'Return To Top',
26
+ 'return_class' => '',
27
+ 'footer_class' => '',
28
+ 'footer_hook' => '',
29
+ 'footer_remove' => true,
30
+ 'footer_filter_hook' => '',
31
+ 'visibility' => '' ,
32
+ 'use_microdata' => false,
33
+ 'hide_wordpress' => false
34
+ );
35
+
36
+
37
+ private $layouts = array(
38
+ 'single', 'single-alt', 'contact-below', 'copyright-below',
39
+ 'menu-above', 'menu-above-alt', 'stacked', 'stacked-alt');
40
+
41
+ private $credits;
42
+
43
+ protected $is_landing = false;
44
+
45
+ function get_defaults() {
46
+ return $this->theme_specific_defaults($this->defaults);
47
+ }
48
+
49
+ function get_options_name() {
50
+ return ''; //push all the options to the top level
51
+ }
52
+
53
+ function get_widget_defaults() {
54
+ return $this->widget_defaults;
55
+ }
56
+
57
+ public function init() {
58
+ $this->credits = $this->plugin->get_module('credits');
59
+ add_action('widgets_init',array($this,'register'),20);
60
+ add_filter( 'wp_nav_menu_items', array($this, 'fix_home_link'), 10, 2 );
61
+ if (!is_admin()) add_action('wp',array($this,'prepare'));
62
+ }
63
+
64
+ function register() {
65
+ $this->register_sidebars();
66
+ $this->register_widgets();
67
+ }
68
+
69
+ private function register_sidebars() {
70
+ if ($this->options->get_option('footer_hook')) {
71
+ $tag = 'div';
72
+ register_sidebar( array(
73
+ 'id' => self::SIDEBAR_ID,
74
+ 'name' => __( 'Credibility Footer' ),
75
+ 'description' => __( 'Custom footer section for copyright, trademarks, etc.'),
76
+ 'before_widget' => '<'.$tag.' id="%1$s" class="widget %2$s"><div class="wrap">',
77
+ 'after_widget' => '</div></'.$tag.'>'
78
+ ) );
79
+ }
80
+ }
81
+
82
+ private function register_widgets() {
83
+ if (class_exists('Footer_Putter_Copyright_Widget')) register_widget('Footer_Putter_Copyright_Widget');
84
+ if (class_exists('Footer_Putter_Trademark_Widget')) register_widget('Footer_Putter_Trademark_Widget');
85
+ }
86
+
87
+ function prepare() {
88
+ add_shortcode(self::CODE, array($this, 'footer' ) );
89
+ add_shortcode(self::CODE.'-return', array($this, 'footer_return' ) );
90
+ add_filter('widget_text', 'do_shortcode', 11);
91
+ add_action('wp_enqueue_scripts',array($this, 'enqueue_styles' ));
92
+
93
+ $this->is_landing = $this->utils->is_landing_page();
94
+
95
+ //insert custom footer at specified hook
96
+ if ($footer_hook = $this->options->get_option('footer_hook')) {
97
+ if ($this->options->get_option('footer_remove')) {
98
+ remove_all_actions( $footer_hook);
99
+ if ($footer_hook =='wp_footer') {
100
+ add_action( 'wp_footer', 'wp_print_footer_scripts', 20); //put back the footer scripts
101
+ add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); //put back the admin bar
102
+ }
103
+ }
104
+ add_action( $footer_hook, array($this, 'custom_footer'));
105
+ }
106
+
107
+ //suppress footer output
108
+ if ($ffs = $this->options->get_option('footer_filter_hook'))
109
+ add_filter($ffs, array($this, 'no_footer'),100);
110
+ }
111
+
112
+ function enqueue_styles() {
113
+ wp_enqueue_style('footer-credits', plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(), $this->plugin->get_version());
114
+ }
115
+
116
+ function get_layouts() { return $this->layouts; }
117
+
118
+ function is_html5() {
119
+ return $this->utils->is_html5();
120
+ }
121
+
122
+ public function return_to_top( $text, $class) {
123
+ return sprintf( '<div class="footer-return %1$s"><span>%2$s</span></div>', trim($class), $text);
124
+ }
125
+
126
+ public function footer($atts = array()) {
127
+ $params = shortcode_atts( $this->widget_defaults, $atts ); //apply plugin defaults
128
+
129
+ if ($params['center']) {
130
+ $return_class = 'return-center';
131
+ $footer_class = 'footer-center';
132
+ $clear = '';
133
+ } else {
134
+ $return_class = ' return-left';
135
+ $footer_class = ' footer-right';
136
+ $clear = '<div class="clear"></div>';
137
+ }
138
+ $layout = isset($atts['layout']) ? $atts['layout'] : 'single';
139
+
140
+ $format = '<div class="%4$s %5$s %6$s">'.$this->get_footer_content_order($layout).'</div>%7$s';
141
+ return (empty($params['show_return']) ? '' :
142
+ $this->return_to_top($params['return_text'], $return_class. ' ' . $params['return_class'])) .
143
+ sprintf($format,
144
+ (empty($params['nav_menu']) ? '' : $this->credits->footer_menu($params)),
145
+ (empty($params['show_copyright']) ? '' : $this->credits->copyright($params)),
146
+ $this->credits->contact_info($params),
147
+ self::CSS_CLASS,
148
+ $footer_class,
149
+ $layout,
150
+ $clear
151
+ );
152
+ }
153
+
154
+ private function get_footer_content_order($layout) {
155
+ switch ($layout) {
156
+ case 'single-alt':
157
+ case 'copyright-below':
158
+ case 'menu-above-alt':
159
+ case 'stacked-alt': return '%1$s%3$s%2$s';
160
+ }
161
+ return '%1$s%2$s%3$s';
162
+ }
163
+
164
+ public function custom_footer() {
165
+ if ( is_active_sidebar( self::SIDEBAR_ID) ) {
166
+ $class = 'custom-footer'. ($this->get_option('hide_wordpress') ? ' hide-wordpress' :'');
167
+ if ($this->is_html5()) {
168
+ printf('<footer class="%1$s" itemscope="itemscope" itemtype="http://schema.org/WPFooter">', $class);
169
+ dynamic_sidebar( self::SIDEBAR_ID );
170
+ echo '</footer><!-- end .custom-footer -->';
171
+ } else {
172
+ printf('<div class="%1$s">', $class);
173
+ dynamic_sidebar( self::SIDEBAR_ID );
174
+ echo '</div><!-- end .custom-footer -->';
175
+ }
176
+ }
177
+ }
178
+
179
+ public function no_footer($content) { return ''; }
180
+
181
+
182
+ function fix_home_link( $content, $args) {
183
+ $class = is_front_page()? ' class="current_page_item"' : '';
184
+ $home_linktexts = array('Home','<span>Home</span>');
185
+ foreach ($home_linktexts as $home_linktext) {
186
+ $home_link = sprintf('<a>%1$s</a>',$home_linktext);
187
+ if (strpos($content, $home_link) !== FALSE)
188
+ $content = str_replace ($home_link,sprintf('<a href="%1$s"%2$s>%3$s</a>',home_url(),$class,$home_linktext),$content);
189
+ }
190
+ return $content;
191
+ }
192
+
193
+ function footer_return($atts = array()) {
194
+ $defaults = array('return_text' => $this->defaults['return_text'], 'return_class' => $this->defaults['return_class']);
195
+ $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
196
+ return $this->return_to_top($params['return_text'], $params['return_class']);
197
+ }
198
+
199
+ function theme_specific_defaults($defaults) {
200
+ switch (basename( TEMPLATEPATH ) ) {
201
+ case 'twentyten':
202
+ $defaults['footer_hook'] = 'twentyten_credits'; break;
203
+ case 'twentyeleven':
204
+ $defaults['footer_hook'] = 'twentyeleven_credits'; break;
205
+ case 'twentytwelve':
206
+ $defaults['footer_hook'] = 'twentytwelve_credits'; break;
207
+ case 'twentythirteen':
208
+ $defaults['footer_hook'] = 'twentythirteen_credits'; break;
209
+ case 'twentyfourteen':
210
+ $defaults['footer_hook'] = 'twentyfourteen_credits'; break;
211
+ case 'twentyfifteen':
212
+ $defaults['footer_hook'] = 'twentyfifteen_credits'; break;
213
+ case 'twentysixteen':
214
+ $defaults['footer_hook'] = 'twentysixteen_credits'; break;
215
+ case 'twentyseventeen':
216
+ $defaults['footer_hook'] = 'get_template_part_template-parts/footer/site'; break;
217
+ case 'generatepress':
218
+ $defaults['footer_hook'] = 'generate_credits'; break;
219
+ case 'delicate':
220
+ $defaults['footer_hook'] = 'get_footer'; break;
221
+ case 'genesis':
222
+ $defaults['footer_hook'] = 'genesis_footer';
223
+ $defaults['footer_filter_hook'] = 'genesis_footer_output';
224
+ break;
225
+ case 'graphene':
226
+ $defaults['footer_hook'] = 'graphene_footer'; break;
227
+ case 'pagelines':
228
+ $defaults['footer_hook'] = 'pagelines_leaf'; break;
229
+ default:
230
+ $defaults['footer_hook'] = 'wp_footer';
231
+ $defaults['footer_remove'] = false;
232
+ break;
233
+ }
234
+ return $defaults;
235
+ }
236
+ }
classes/class-message.php ADDED
@@ -0,0 +1,815 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Footer_Putter_Message {
3
+
4
+ function __construct() {}
5
+
6
+ function build_tips($ids, $prefix='') {
7
+ $prefix = $prefix ? ($prefix."_") : '';
8
+ $tips = array();
9
+ foreach ($ids as $id) $tips[$prefix.$id] = array('heading' => $this->message($prefix.$id.'_heading'), 'tip' => $this->message($prefix.$id.'_tip'));
10
+ return $tips;
11
+ }
12
+
13
+ function message($message_id) {
14
+ $message ='';
15
+ switch ($message_id) {
16
+
17
+ /* Plugin info */
18
+
19
+ case 'plugin_changelog':
20
+ $message = __('See the <a href="%1$s" rel="external" target="_blank">changelog</a> for the full plugin history.',
21
+ 'footer-putter'); break;
22
+
23
+ case 'plugin_description':
24
+ $message = __("
25
+ <p>Footer Putter allows you to put a footer to your site that adds credibility to your site, with BOTH visitors and search engines.</p>
26
+ <p>Google is looking for some indicators that the site is about a real business.</p>
27
+ <ol>
28
+ <li>The name of the business or site owner</li>
29
+ <li>A copyright notice that is up to date</li>
30
+ <li>A telephone number</li>
31
+ <li>A postal address</li>
32
+ <li>Links to Privacy Policy and Terms of Use pages</p>
33
+ </ol>
34
+ <p>Human visitors may pay some credence to this information but will likely be more motivated by trade marks, trust marks and service marks.</p>
35
+ ",
36
+ 'footer-putter'); break;
37
+
38
+ case 'plugin_features':
39
+ $message = __("
40
+ <p>Plugin features:
41
+ <ol>
42
+ <li>configurable copyright widget with optional contact details and footer menu;</li>
43
+ <li>configurable trademarks widget;</li>
44
+ <li>hide footer widgets or show different versions of the footer widgets on landing pages;</li>
45
+ <li>maintain site ownership details in one place;</li>
46
+ <li>include site ownership details automatically on privacy and terms and conditions pages</li>
47
+ </ol>
48
+ </p>
49
+ ",
50
+ 'footer-putter'); break;
51
+
52
+ case 'plugin_help':
53
+ $message = __('For help and tutorials visit the <a href="%1$s" rel="external" target="_blank">Footer Putter plugin home page</a>.',
54
+ 'footer-putter'); break;
55
+
56
+ case 'plugin_news':
57
+ $message = __('Footer Putter News',
58
+ 'footer-putter'); break;
59
+
60
+ case 'plugin_settings':
61
+ $message = __('plugin settings',
62
+ 'footer-putter'); break;
63
+
64
+ case 'plugin_version':
65
+ $message = __('This version of %1$s is %2$s.',
66
+ 'footer-putter'); break;
67
+
68
+ /* end plugin info */
69
+
70
+ /* errors */
71
+
72
+ case 'feed_empty':
73
+ $message = __( 'The news feed is empty right now.' ,
74
+ 'footer-putter'); break;
75
+
76
+ case 'feed_error':
77
+ $message = __( 'Newsfeed error' ,
78
+ 'footer-putter'); break;
79
+
80
+ case 'feed_missing':
81
+ $message = __( 'Feed URL not supplied.',
82
+ 'footer-putter'); break;
83
+
84
+ case 'feed_failure':
85
+ $message = __( 'Could not retrieve feed %s' ,
86
+ 'footer-putter'); break;
87
+
88
+ /* END errors */
89
+
90
+ /* Menu Items */
91
+
92
+ case 'menu_dashboard':
93
+ $message = __('Dashboard',
94
+ 'footer-putter'); break;
95
+
96
+ case 'menu_credits':
97
+ $message = __('Credits',
98
+ 'footer-putter'); break;
99
+
100
+ case 'menu_footer':
101
+ $message = __('Footer',
102
+ 'footer-putter'); break;
103
+
104
+ case 'menu_trademarks':
105
+ $message = __('Trademarks',
106
+ 'footer-putter'); break;
107
+
108
+ /* END Menu Items */
109
+
110
+ /* Section titles */
111
+
112
+ case 'section_overview_title':
113
+ $message = __('Overview',
114
+ 'footer-putter'); break;
115
+
116
+ case 'section_details_title':
117
+ $message = __('Details',
118
+ 'footer-putter'); break;
119
+
120
+ case 'section_credits_intro_title':
121
+ $message = __('Credits Introduction',
122
+ 'footer-putter'); break;
123
+
124
+ case 'section_credits_settings_title':
125
+ $message = __('Credits Settings',
126
+ 'footer-putter'); break;
127
+
128
+ case 'section_trademarks_intro_title':
129
+ $message = __('Trademarks Introduction',
130
+ 'footer-putter'); break;
131
+
132
+ case 'section_trademarks_instructions_title':
133
+ $message = __('Trademarks Instructions',
134
+ 'footer-putter'); break;
135
+
136
+ case 'section_footer_intro_title':
137
+ $message = __('Footer Introduction',
138
+ 'footer-putter'); break;
139
+
140
+ case 'section_footer_settings_title':
141
+ $message = __('Footer Settings',
142
+ 'footer-putter'); break;
143
+
144
+ case 'section_footer_preview_title':
145
+ $message = __('Footer Preview',
146
+ 'footer-putter'); break;
147
+
148
+ /* END SECTION TITLES */
149
+
150
+ /* Settings */
151
+
152
+ case 'settings_not_found':
153
+ $message = __('settings have not been found.',
154
+ 'footer-putter'); break;
155
+
156
+ case 'settings_saved':
157
+ $message = __('settings saved successfully.',
158
+ 'footer-putter'); break;
159
+
160
+ case 'settings_unchanged':
161
+ $message = __('settings have not been changed.',
162
+ 'footer-putter'); break;
163
+
164
+ /* END Settings */
165
+
166
+ /* tabs */
167
+
168
+ case 'tab_advanced':
169
+ $message = __('Advanced',
170
+ 'footer-putter'); break;
171
+
172
+ case 'tab_contact':
173
+ $message = __('Contact',
174
+ 'footer-putter'); break;
175
+
176
+ case 'tab_features':
177
+ $message = __('Features',
178
+ 'footer-putter'); break;
179
+
180
+ case 'tab_help':
181
+ $message = __('Help',
182
+ 'footer-putter'); break;
183
+
184
+ case 'tab_hooks':
185
+ $message = __('Footer Hooks',
186
+ 'footer-putter'); break;
187
+
188
+ case 'tab_instructions':
189
+ $message = __('Instructions',
190
+ 'footer-putter'); break;
191
+
192
+ case 'tab_intro':
193
+ $message = __('Intro',
194
+ 'footer-putter'); break;
195
+
196
+ case 'tab_address':
197
+ $message = __('Address',
198
+ 'footer-putter'); break;
199
+
200
+ case 'tab_geo':
201
+ $message = __('Geolocation',
202
+ 'footer-putter'); break;
203
+
204
+ case 'tab_legal':
205
+ $message = __('Legal',
206
+ 'footer-putter'); break;
207
+
208
+ case 'tab_links':
209
+ $message = __('Useful Links',
210
+ 'footer-putter'); break;
211
+
212
+ case 'tab_owner':
213
+ $message = __('Owner',
214
+ 'footer-putter'); break;
215
+
216
+ case 'tab_return':
217
+ $message = __('Retun To Top',
218
+ 'footer-putter'); break;
219
+
220
+ case 'tab_trademarks_instructions':
221
+ $message = __('Instructions',
222
+ 'footer-putter'); break;
223
+
224
+ case 'tab_trademarks_tips':
225
+ $message = __('Tips',
226
+ 'footer-putter'); break;
227
+
228
+ case 'tab_trademarks_screenshots':
229
+ $message = __('Screenshots',
230
+ 'footer-putter'); break;
231
+
232
+ case 'tab_version':
233
+ $message = __('Version',
234
+ 'footer-putter'); break;
235
+
236
+ case 'tab_widgets':
237
+ $message = __('Widgets',
238
+ 'footer-putter'); break;
239
+
240
+ /* END TABS */
241
+
242
+ /* TOOLTIPS */
243
+ case 'address_heading':
244
+ $message = __('Full Address',
245
+ 'footer-putter'); break;
246
+ case 'address_tip':
247
+ $message = __('Enter the full address that you want to appear in the footer and the privacy and terms pages.',
248
+ 'footer-putter'); break;
249
+
250
+ case 'country_heading':
251
+ $message = __('Country',
252
+ 'footer-putter'); break;
253
+ case 'country_tip':
254
+ $message = __('Enter the country where the legal entity is domiciled.',
255
+ 'footer-putter'); break;
256
+
257
+ case 'copyright_preamble_heading':
258
+ $message = __('Copyright Text',
259
+ 'footer-putter'); break;
260
+ case 'copyright_preamble_tip':
261
+ $message = __('Something like:<br/> Copyright &copy; All Rights Reserved.',
262
+ 'footer-putter'); break;
263
+
264
+ case 'copyright_start_year_heading':
265
+ $message = __('Copyright Start',
266
+ 'footer-putter'); break;
267
+ case 'copyright_start_year_tip':
268
+ $message = __('The start year of the business appears in the copyright statement in the footer and an on the Terms and Conditions page.',
269
+ 'footer-putter'); break;
270
+
271
+ case 'courts_heading':
272
+ $message = __('Legal Jurisdiction',
273
+ 'footer-putter'); break;
274
+ case 'courts_tip':
275
+ $message = __('The Courts that have jurisdiction over any legal disputes regarding this site. For example: <i>the state and federal courts in Santa Clara County, California</i>, or <i>the Law Courts of England and Wales</i>.',
276
+ 'footer-putter'); break;
277
+
278
+ case 'email_heading':
279
+ $message = __('Email Address',
280
+ 'footer-putter'); break;
281
+ case 'email_tip':
282
+ $message = __('Enter the email address here if you want it to appear in the footer and in the privacy statement.',
283
+ 'footer-putter'); break;
284
+
285
+ case 'footer_class_heading':
286
+ $message = __('Footer Class',
287
+ 'footer-putter'); break;
288
+ case 'footer_class_tip':
289
+ $message = __('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.',
290
+ 'footer-putter'); break;
291
+
292
+ case 'footer_filter_hook_heading':
293
+ $message = __('Footer Filter Hook',
294
+ 'footer-putter'); break;
295
+ case 'footer_filter_hook_tip':
296
+ $message = __('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.',
297
+ 'footer-putter'); break;
298
+
299
+ case 'footer_hook_heading':
300
+ $message = __('Footer Action Hook',
301
+ 'footer-putter'); break;
302
+ case 'footer_hook_tip':
303
+ $message = __('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.',
304
+ 'footer-putter'); break;
305
+
306
+ case 'footer_remove_heading':
307
+ $message = __('Remove All Actions',
308
+ 'footer-putter'); break;
309
+ case 'footer_remove_tip':
310
+ $message = __('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.',
311
+ 'footer-putter'); break;
312
+
313
+ case 'hide_wordpress_heading':
314
+ $message = __('Hide WordPress Link',
315
+ 'footer-putter'); break;
316
+ case 'hide_wordpress_tip':
317
+ $message = __('Hide link to WordPress.org',
318
+ 'footer-putter'); break;
319
+
320
+ case 'latitude_heading':
321
+ $message = __('Latitude',
322
+ 'footer-putter'); break;
323
+ case 'latitude_tip':
324
+ $message = __('Enter the latitude of the organization&#39;s location - maybe be used by Google or local search.',
325
+ 'footer-putter'); break;
326
+
327
+ case 'locality_heading':
328
+ $message = __('Locality (City)',
329
+ 'footer-putter'); break;
330
+ case 'locality_tip':
331
+ $message = __('Enter the town or city.',
332
+ 'footer-putter'); break;
333
+
334
+ case 'longitude_heading':
335
+ $message = __('Longitude',
336
+ 'footer-putter'); break;
337
+ case 'longitude_tip':
338
+ $message = __('Enter the longitude of the organization&#39;s location - maybe be used by Google or local search.',
339
+ 'footer-putter'); break;
340
+
341
+ case 'map_heading':
342
+ $message = __('Locality (City)',
343
+ 'footer-putter'); break;
344
+ case 'map_tip':
345
+ $message = __('Enter the URL of a map that shows the organization&#39;s location',
346
+ 'footer-putter'); break;
347
+
348
+ case 'microdata_heading':
349
+ $message = __('Use Microdata',
350
+ 'footer-putter'); break;
351
+ case 'microdata_tip':
352
+ $message = __('Mark up the organization details with HTML5 microdata.',
353
+ 'footer-putter'); break;
354
+
355
+ case 'owner_heading':
356
+ $message = __('Owner/Business Name',
357
+ 'footer-putter'); break;
358
+ case 'owner_tip':
359
+ $message = __('Enter the name of the legal entity that owns and operates the site.',
360
+ 'footer-putter'); break;
361
+
362
+ case 'postal_code_heading':
363
+ $message = __('Postal Code (Zipcode)',
364
+ 'footer-putter'); break;
365
+ case 'postal_code_tip':
366
+ $message = __('Enter the postal code.',
367
+ 'footer-putter'); break;
368
+
369
+ case 'privacy_contact_heading':
370
+ $message = __('Add Privacy Contact',
371
+ 'footer-putter'); break;
372
+ case 'privacy_contact_tip':
373
+ $message = __('Add a section to the end of the Privacy page with contact and legal information.',
374
+ 'footer-putter'); break;
375
+
376
+ case 'region_heading':
377
+ $message = __('State (Region)',
378
+ 'footer-putter'); break;
379
+ case 'region_tip':
380
+ $message = __('Enter the state, province, region or county.',
381
+ 'footer-putter'); break;
382
+
383
+ case 'return_class_heading':
384
+ $message = __('Return To Top Class',
385
+ 'footer-putter'); break;
386
+ case 'return_class_tip':
387
+ $message = __('Add any custom class you want to apply to the Return To Top link.',
388
+ 'footer-putter'); break;
389
+
390
+ case 'return_text_heading':
391
+ $message = __('Link Text',
392
+ 'footer-putter'); break;
393
+ case 'return_text_tip':
394
+ $message = __('The text of the Return To Top link. For example, <i>Return To Top</i> or <i>Back To Top</i>.',
395
+ 'footer-putter'); break;
396
+
397
+ case 'street_address_heading':
398
+ $message = __('Street Address',
399
+ 'footer-putter'); break;
400
+ case 'street_address_tip':
401
+ $message = __('Enter the first line of the address that you want to appear in the footer and the privacy and terms pages.',
402
+ 'footer-putter'); break;
403
+
404
+ case 'telephone_heading':
405
+ $message = __('Telephone Number',
406
+ 'footer-putter'); break;
407
+ case 'telephone_tip':
408
+ $message = __('Enter a telephone number here if you want it to appear in the footer of the installed site.',
409
+ 'footer-putter'); break;
410
+
411
+ case 'terms_contact_heading':
412
+ $message = __('Add Terms Contact',
413
+ 'footer-putter'); break;
414
+ case 'terms_contact_tip':
415
+ $message = __('Add a section to the end of the Terms page with contact and legal information.',
416
+ 'footer-putter'); break;
417
+
418
+ case 'updated_heading':
419
+ $message = __('Last Updated',
420
+ 'footer-putter'); break;
421
+ case 'updated_tip':
422
+ $message = __('This will be defaulted as today. For example, June 30th, 2020.',
423
+ 'footer-putter'); break;
424
+
425
+ case 'html_title_heading':
426
+ $message = __('Widget Title',
427
+ 'footer-putter'); break;
428
+ case 'html_title_tip':
429
+ $message = __('Enhanced widget title can contain some HTML such as links, spans and breaks.',
430
+ 'footer-putter'); break;
431
+
432
+ case 'class_heading':
433
+ $message = __('Widget Class',
434
+ 'footer-putter'); break;
435
+ case 'class_tip':
436
+ $message = __('Class to place on widget instance to make CSS customization easier.',
437
+ 'footer-putter'); break;
438
+
439
+ case 'nav_menu_heading':
440
+ $message = __('Footer Menu',
441
+ 'footer-putter'); break;
442
+ case 'nav_menu_tip':
443
+ $message = __('Choose the menu to display in the footer.',
444
+ 'footer-putter'); break;
445
+
446
+ case 'center_heading':
447
+ $message = __('Center Menu',
448
+ 'footer-putter'); break;
449
+ case 'center_tip':
450
+ $message = __('Center the footer horizontally.',
451
+ 'footer-putter'); break;
452
+
453
+ case 'layout_heading':
454
+ $message = __('Layout',
455
+ 'footer-putter'); break;
456
+ case 'layout_tip':
457
+ $message = __('Choose order and layout in which menu, copyright and contact are placed, + means same line, | means new line.',
458
+ 'footer-putter'); break;
459
+
460
+ case 'show_copyright_heading':
461
+ $message = __('Show Copyright',
462
+ 'footer-putter'); break;
463
+ case 'show_copyright_tip':
464
+ $message = __('Show copyright holder an year range.',
465
+ 'footer-putter'); break;
466
+
467
+ case 'show_address_heading':
468
+ $message = __('Show Address',
469
+ 'footer-putter'); break;
470
+ case 'show_address_tip':
471
+ $message = __('Show contact address.',
472
+ 'footer-putter'); break;
473
+
474
+ case 'show_telephone_heading':
475
+ $message = __('Show Telephone Number',
476
+ 'footer-putter'); break;
477
+ case 'show_telephone_tip':
478
+ $message = __('Show telephone number(s).',
479
+ 'footer-putter'); break;
480
+
481
+ case 'show_email_heading':
482
+ $message = __('Show Email Address',
483
+ 'footer-putter'); break;
484
+ case 'show_email_tip':
485
+ $message = __('Show email.',
486
+ 'footer-putter'); break;
487
+
488
+ case 'use_microdata_heading':
489
+ $message = __('Use HTML5 Microdata',
490
+ 'footer-putter'); break;
491
+ case 'use_microdata_tip':
492
+ $message = __('Express organization, contact and any geo-coordinates using HTML5 microdata.',
493
+ 'footer-putter'); break;
494
+
495
+ case 'show_return_heading':
496
+ $message = __('Show Return To Top Links',
497
+ 'footer-putter'); break;
498
+ case 'show_return_tip':
499
+ $message = __('Show link to return to the top of the page.',
500
+ 'footer-putter'); break;
501
+
502
+ case 'return_class_heading':
503
+ $message = __('Return To Top',
504
+ 'footer-putter'); break;
505
+ case 'return_class_tip':
506
+ $message = __('Add custom classes to apply to the return to top links.',
507
+ 'footer-putter'); break;
508
+
509
+ case 'footer_class_heading':
510
+ $message = __('Footer Credits',
511
+ 'footer-putter'); break;
512
+ case 'footer_class_tip':
513
+ $message = __('Add custom classes to apply to the footer menu, copyright and contact information.',
514
+ 'footer-putter'); break;
515
+
516
+ case 'visibility_heading':
517
+ $message = __('Show or Hide',
518
+ 'footer-putter'); break;
519
+ case 'visibility_tip':
520
+ $message = __('Determine on which pages the footer widget is displayed.',
521
+ 'footer-putter'); break;
522
+
523
+ case 'title_heading':
524
+ $message = __('Label',
525
+ 'footer-putter'); break;
526
+ case 'title_tip':
527
+ $message = __('Label appears only in the Widget Dashboard to make widget identification easier.',
528
+ 'footer-putter'); break;
529
+
530
+ case 'category_heading':
531
+ $message = __('Category',
532
+ 'footer-putter'); break;
533
+ case 'category_tip':
534
+ $message = __('Select Link Category for Your Trademarks.',
535
+ 'footer-putter'); break;
536
+
537
+ case 'limit_heading':
538
+ $message = __('# of links',
539
+ 'footer-putter'); break;
540
+ case 'limit_tip':
541
+ $message = __('Number of trademarks to show.',
542
+ 'footer-putter'); break;
543
+
544
+ case 'orderby_heading':
545
+ $message = __('Order By',
546
+ 'footer-putter'); break;
547
+ case 'orderby_tip':
548
+ $message = __('Sort by name, rating, ID or random.',
549
+ 'footer-putter'); break;
550
+
551
+ case 'nofollow_heading':
552
+ $message = __('Rel=nofollow',
553
+ 'footer-putter'); break;
554
+ case 'nofollow_tip':
555
+ $message = __('Mark the links with rel=nofollow.',
556
+ 'footer-putter'); break;
557
+
558
+ /* END tooltips */
559
+
560
+ /* WIDGETS */
561
+
562
+ case 'copyright_widget_name':
563
+ $message = __('Footer Copyright Widget',
564
+ 'footer-putter'); break;
565
+
566
+ case 'copyright_widget_description':
567
+ $message = __('A widget displaying menu links, copyright and company details',
568
+ 'footer-putter'); break;
569
+
570
+ case 'trademarks_widget_name':
571
+ $message = __('Trademarks Widget',
572
+ 'footer-putter'); break;
573
+
574
+ case 'trademarks_widget_description':
575
+ $message = __('Trademarks, Service Marks and Kitemarks',
576
+ 'footer-putter'); break;
577
+
578
+ case 'layout_single':
579
+ $message = __('Single line: Menu + copyright + contact',
580
+ 'footer-putter'); break;
581
+
582
+ case 'layout_single_alt':
583
+ $message = __('Single line: Menu + contact + copyright',
584
+ 'footer-putter'); break;
585
+
586
+ case 'layout_contact_below':
587
+ $message = __('2 lines: Menu + copyright | Contact',
588
+ 'footer-putter'); break;
589
+
590
+ case 'layout_copyright_below':
591
+ $message = __('2 lines: Menu + contact | Copyright',
592
+ 'footer-putter'); break;
593
+
594
+ case 'layout_menu_above':
595
+ $message = __('2 lines: Menu | Copyright + contact',
596
+ 'footer-putter'); break;
597
+
598
+ case 'layout_menu_above_alt':
599
+ $message = __('2 lines: Menu | Contact + copyright',
600
+ 'footer-putter'); break;
601
+
602
+ case 'layout_stacked':
603
+ $message = __('3 lines : Menu | Copyright | Contactt',
604
+ 'footer-putter'); break;
605
+
606
+ case 'layout_stacked_alt':
607
+ $message = __('3 lines : Menu | Contact | Copyright',
608
+ 'footer-putter'); break;
609
+
610
+ case 'orderby_link_title':
611
+ $message = __('Link title',
612
+ 'footer-putter'); break;
613
+
614
+ case 'orderby_link_rating':
615
+ $message = __('Link rating',
616
+ 'footer-putter'); break;
617
+
618
+ case 'orderby_link_id':
619
+ $message = __('Link ID',
620
+ 'footer-putter'); break;
621
+
622
+ case 'orderby_random':
623
+ $message = __('Random',
624
+ 'footer-putter'); break;
625
+
626
+
627
+ case 'visibility_all':
628
+ $message = __('Show on all pages',
629
+ 'footer-putter'); break;
630
+
631
+
632
+ case 'visibility_hide_landing':
633
+ $message = __('Hide on landing pages',
634
+ 'footer-putter'); break;
635
+
636
+ case 'visibility_show_landing':
637
+ $message = __('Show only on landing pages',
638
+ 'footer-putter'); break;
639
+
640
+ /* END WIDGETS */
641
+
642
+
643
+ /* MISC */
644
+
645
+ case 'address_instructions':
646
+ $message = __('<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>',
647
+ 'footer-putter'); break;
648
+
649
+ case 'advanced_instructions':
650
+ $message = __('<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 where the Widget Area will be located.</p>
651
+ <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>,
652
+ <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,<i>twentythirteen_credits</i>, <i>twentyfourteen_credits</i>, etc. If you using a Genesis child theme and the theme does not have a suitable widget area then use
653
+ the hook <i>genesis_footer</i> or maybe <i>genesis_after</i>. See what looks best. Click for <a href="%1$s">suggestions of which hook to use for common WordPress themes</a>.</p>',
654
+ 'footer-putter'); break;
655
+
656
+ case 'widget_presence_heading':
657
+ $message = __('Widget Presence',
658
+ 'footer-putter'); break;
659
+
660
+ case 'custom_classes_heading':
661
+ $message = __('Custom Classes',
662
+ 'footer-putter'); break;
663
+
664
+ case 'custom_classes_instructions':
665
+ $message = __('<p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p><p>For your convenience we have defined 3 color classes <i>dark</i>, <i>light</i> and <i>white</i>, and 2 size classes,
666
+ <i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes.</p>',
667
+ 'footer-putter'); break;
668
+
669
+ case 'geo_instructions':
670
+ $message = __('<p>The geographical co-ordinates are optional and are visible only to the search engines.</p>',
671
+ 'footer-putter'); break;
672
+
673
+ case 'intro_advanced_instructions':
674
+ $message = __('The following information is concerned with the static footer content and its WordPress hooks which govern its precise location.',
675
+ 'footer-putter'); break;
676
+
677
+ case 'intro_instructions':
678
+ $message = __('The following information is used in the Footer Copyright Widget and optionally at the end of the Privacy Statement and Terms and Conditions pages.',
679
+ 'footer-putter'); break;
680
+
681
+ case 'preview_instructions':
682
+ $message = __('Note: The preview below is purely illustrative. Actual footer layout on the site will vary based on footer widget settings.',
683
+ 'footer-putter'); break;
684
+
685
+ case 'remove_instructions':
686
+ $message = __('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, then specify the hook below. For example, entering <i>genesis_footer_output</i> will suppress the standard Genesis child theme footer.',
687
+ 'footer-putter'); break;
688
+
689
+
690
+ case 'trademarks_intro':
691
+ $message = __('
692
+ <p class="attention">There are no settings on this page.</p>
693
+ <p class="attention">However, links are provided to where you set up trademarks or other symbols you want to appear in the footer.</p>
694
+
695
+ <p class="bigger">Firstly go to the <a href="%1$s">Link Categories</a> and set up a link category called <i>Trust Marks</i> or something similar.</p>
696
+ <p class="bigger">Next go to the <a href="%2$s">Add Link</a> and add a link for each trademark
697
+ specifying the Image URL, and optionally the link URL and of course adding each link to your chosen link category.
698
+ <p class="bigger">Finally go to the <a href="%3$s">Appearance | Widgets</a> and drag a trademark widget into the custom footer widget
699
+ area and select <i>Trust Marks</i> as the link category.</p> ',
700
+ 'footer-putter'); break;
701
+
702
+ case 'trademarks_tips':
703
+ $message = __('
704
+ <h3>Image File Size</h3>
705
+ <p>The plugin uses each trademark image "as is" so you need to provide trademark images that are suitably sized. </p>
706
+ <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>
707
+ <h3>Image File Type</h3>
708
+ <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>
709
+ ',
710
+ 'footer-putter'); break;
711
+
712
+ case 'trademarks_screenshots':
713
+ $message = __('
714
+ <p>Below are annotated screenshots of creating the link category and adding a link .
715
+ <h4>Add A Link Category</h4>
716
+ <p><img class="dashed-border" src="%1$s" alt="Screenshot of adding a trademark link category" /></p>
717
+ <h4>Add A Link</h4>
718
+ <p><img class="dashed-border" src="%1$s" alt="Screenshot of adding a trademark link " /></p>
719
+ ',
720
+ 'footer-putter'); break;
721
+
722
+ /* END MISC */
723
+
724
+ /* HELP */
725
+ case 'help_create_trademark_links':
726
+ $message = __('
727
+ <h4>Create Trademark Links</h4>
728
+ <ol>
729
+ <li>Go to <a href="%1$s"><i>Footer Trademarks</i></a> and follow the instructions:</li>
730
+ <li>Create a link category with a name such as <i>Trademarks</i></li>
731
+ <li>Add a link for each of your trademarks and put each in the <i>Trademarks</i> link category</li>
732
+ <li>For each link specify the link URL and the image URL</li>
733
+ </ol>
734
+ ',
735
+ 'footer-putter'); break;
736
+
737
+ case 'help_hooks':
738
+ $message = __("
739
+ <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>
740
+ <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>,
741
+ 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>
742
+ ",
743
+ 'footer-putter'); break;
744
+
745
+ case 'help_links':
746
+ $message = __('
747
+ <ul>
748
+ <li><a rel="external" target="_blank" href="%1$s">Footer Putter Plugin Home</a></li>
749
+ <li><a rel="external" target="_blank" href="https://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks/">Themes and Recommended Footer Hooks</a></li>
750
+ <li><a rel="external" target="_blank" href="https://www.diywebmastery.com/4098/how-to-add-a-different-footer-on-landing-pages/">How To Use A Different Footer On Landing Pages</a></li>
751
+ <li><a rel="external" target="_blank" href="https://www.diywebmastery.com/4109/using-html5-microdata-footer/">Using HTML5 Microdata for better SEO and Local Search</a></li>
752
+ </ul>
753
+ ',
754
+ 'footer-putter'); break;
755
+
756
+ case 'help_pages':
757
+ $message = __('
758
+ <h4>Create Standard Pages And Footer Menu</h4>
759
+ <ol>
760
+ <li>Create a <i>Privacy Policy</i> page with the slug/permalink <em>privacy</em>, choose a page template with no sidebar.</li>
761
+ <li>Create a <i>Terms of Use</i> page with the slug/permalink <em>terms</em>, choose a page template with no sidebar.</li>
762
+ <li>Create a <i>Contact</i> page with a contact form.</li>
763
+ <li>Create an <i>About</i> page, with information either about the site or about its owner.</li>
764
+ <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>
765
+ <li>Create a WordPress menu called <i>Footer Menu</i> and add the above pages to the footer menu.</li>
766
+ </ol>
767
+ ',
768
+ 'footer-putter'); break;
769
+
770
+ case 'help_setup_footer_widgets':
771
+ $message = __('
772
+ <h4>Set Up Footer Widgets</h4>
773
+ <ol>
774
+ <li>Go to <a href="%1$s"><i>Appearance > Widgets</i></a></li>
775
+ <li>Drag a <i>Footer Copyright Widget</i> and a <i>Footer Trademarks widget</i> into a suitable footer Widget Area</li>
776
+ <li>For the <i>Footer Trademarks</i> widget and choose your link category, e.g. <i>Trademarks</i>, and select a sort order</li>
777
+ <li>For the <i>Footer Copyright</i> widget, select the <i>Footer Menu</i> and choose what copyright and contact information you want to you display</li>
778
+ <li>Review the footer of the site. You can use the widget to change font sizes and colors using pre-defined classes such as <i>tiny</i>, <i>small</i>, <i>dark</i>, <i>light</i> or <i>white</i> or add your own custom classes</li>
779
+ <li>You can also choose to suppress the widgets on special pages such as landing pages.</li>
780
+ <li>If the footer is not in the right location you can use the <i>Footer Hook</i> feature described below to add a new widget area called <i>Credibility Footer</i> where you can locate the footer widgets.</li>
781
+ </ol>
782
+ ',
783
+ 'footer-putter'); break;
784
+
785
+ case 'help_update_business_information':
786
+ $message = __('
787
+ <h4>Update Business Information</h4>
788
+ <ol>
789
+ <li>Go to <a href="%1$s">Footer Credits</a> and update the Site Owner details, contact and legal information.</li>
790
+ <li>Optionally include contact details such as telephone and email. You may also want to add Geographical co-ordinates for your office location for the purposes of local search.</li>
791
+ </ol>
792
+ ',
793
+ 'footer-putter'); break;
794
+
795
+ case 'help_widgets':
796
+ $message = __('
797
+ <p>The plugin defines two widgets:
798
+ <ol>
799
+ <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>
800
+ <li>a <b>Trademarks Widget</b> that displays a line of trademarks that you have previously set up as links.
801
+ </ol></p>
802
+ <p>Typically you will drag both widgets into the Custom Footer Widget Area.</p>
803
+ <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>
804
+ ',
805
+ 'footer-putter'); break;
806
+
807
+ /* END HELP */
808
+
809
+
810
+
811
+ }
812
+ return $message;
813
+ }
814
+
815
+ }
classes/class-module.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ abstract class Footer_Putter_Module {
3
+
4
+ protected $plugin;
5
+ protected $utils;
6
+ protected $options;
7
+ private $options_name;
8
+
9
+ abstract function get_options_name();
10
+ abstract function get_defaults();
11
+ abstract function init();
12
+
13
+ function __construct() {
14
+ $this->plugin = Footer_Putter_Plugin::get_instance();
15
+ $this->utils = $this->plugin->get_utils();
16
+ $this->options = $this->plugin->get_options();
17
+ $this->options_name = $this->get_options_name();
18
+ if ($this->options_name)
19
+ $this->options->add_defaults( array($this->options_name => $this->get_defaults()) ) ;
20
+ else
21
+ $this->options->add_defaults( $this->get_defaults() ) ;
22
+ $this->init();
23
+ }
24
+
25
+ function get_keys() {
26
+ return array_keys( $this->get_defaults());
27
+ }
28
+
29
+ function get_option($option_name, $cache = true) {
30
+ $options = $this->get_options($cache);
31
+ if ($option_name && $options && array_key_exists($option_name,$options))
32
+ return $options[$option_name];
33
+ else
34
+ return false;
35
+ }
36
+
37
+ function get_options($cache = true) {
38
+ return $this->options->get_option($this->get_options_name(), $cache);
39
+ }
40
+
41
+ function save_options($options) {
42
+ // var_dump($options); exit;
43
+ if ($options_name = $this->get_options_name()) $options = array($options_name => $options); //just update module options
44
+ return $this->options->save_options($options) ;
45
+ }
46
+
47
+ function get_version() {
48
+ return $this->plugin->get_version();
49
+ }
50
+
51
+ }
classes/class-news.php CHANGED
@@ -1,13 +1,14 @@
1
  <?php
2
- class Footer_Putter_News {
3
 
4
- private $version;
5
  private $script_var;
6
  private $handle;
7
  private $results;
8
 
9
- function __construct($version) {
10
- $this->version = $version;
 
 
11
  $this->script_var = strtolower(__CLASS__);
12
  $this->handle = str_replace('_', '-', $this->script_var);
13
  $this->results = $this->handle . '-feed';
@@ -15,7 +16,7 @@
15
  }
16
 
17
  function enqueue_scripts() {
18
- wp_enqueue_script($this->handle, plugins_url('scripts/jquery.news.js', dirname(__FILE__)), array('jquery'), $this->version, true);
19
  wp_localize_script($this->handle, $this->script_var,
20
  array(
21
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
@@ -27,6 +28,7 @@
27
  }
28
 
29
  function display_feeds($feeds = array()) {
 
30
  if (is_array($feeds) && (count($feeds) > 0)) {
31
  printf ('<div class="%1$s"></div>', $this->results);
32
  for($index=0; $index < count($feeds); $index++ ) {
@@ -38,14 +40,14 @@
38
  function get_feeds_ajax() {
39
  check_ajax_referer( $this->script_var.'_nonce', 'security' );
40
  $url = isset($_POST['url']) ? $_POST['url'] : '';
41
- if (empty($url)) wp_send_json_error( array( 'error' => __( 'Feed URL not supplied.' ) ) );
42
 
43
  $instance = array('url' => $url, 'show_summary' => false, 'show_featured' => true);
44
  $feed = $this->get_rss_feed_instance($instance);
45
  if( isset( $feed ) )
46
  wp_send_json_success( $feed );
47
  else
48
- wp_send_json_error( array( 'error' => __( 'Could not retrieve feed '.$url ) ) );
49
  }
50
 
51
  function get_rss_feed_instance( $instance ) {
@@ -65,7 +67,7 @@
65
 
66
  if ( is_wp_error($rss) ) {
67
  if ( is_admin() || current_user_can('manage_options') )
68
- echo '<div>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</div>';
69
  return;
70
  }
71
 
@@ -87,7 +89,7 @@
87
  $show_date = (int) $args['show_date'];
88
 
89
  if ( !$rss->get_item_quantity() ) {
90
- return '<div>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</div>';
91
  }
92
  $results = '';
93
 
@@ -152,5 +154,4 @@
152
  unset($rss);
153
  return $results;
154
  }
155
-
156
  }
1
  <?php
2
+ class Footer_Putter_News extends Footer_Putter_Module {
3
 
 
4
  private $script_var;
5
  private $handle;
6
  private $results;
7
 
8
+ function get_options_name() { return '';}
9
+ function get_defaults(){ return array();}
10
+
11
+ function init() {
12
  $this->script_var = strtolower(__CLASS__);
13
  $this->handle = str_replace('_', '-', $this->script_var);
14
  $this->results = $this->handle . '-feed';
16
  }
17
 
18
  function enqueue_scripts() {
19
+ wp_enqueue_script($this->handle, plugins_url('scripts/jquery.news.js', dirname(__FILE__)), array('jquery'), $this->get_version(), true);
20
  wp_localize_script($this->handle, $this->script_var,
21
  array(
22
  'ajaxurl' => admin_url( 'admin-ajax.php' ),
28
  }
29
 
30
  function display_feeds($feeds = array()) {
31
+ $feeds = apply_filters($this->script_var, $feeds);
32
  if (is_array($feeds) && (count($feeds) > 0)) {
33
  printf ('<div class="%1$s"></div>', $this->results);
34
  for($index=0; $index < count($feeds); $index++ ) {
40
  function get_feeds_ajax() {
41
  check_ajax_referer( $this->script_var.'_nonce', 'security' );
42
  $url = isset($_POST['url']) ? $_POST['url'] : '';
43
+ if (empty($url)) wp_send_json_error( array( 'error' => $this->get_message( 'feed_missing' ) ) );
44
 
45
  $instance = array('url' => $url, 'show_summary' => false, 'show_featured' => true);
46
  $feed = $this->get_rss_feed_instance($instance);
47
  if( isset( $feed ) )
48
  wp_send_json_success( $feed );
49
  else
50
+ wp_send_json_error( array( 'error' => sprintf($this->get_message('feed_failure'), $url ) ) );
51
  }
52
 
53
  function get_rss_feed_instance( $instance ) {
67
 
68
  if ( is_wp_error($rss) ) {
69
  if ( is_admin() || current_user_can('manage_options') )
70
+ echo '<div>' . sprintf( __('<strong>%1$s</strong>: %2$s'), $this->get_message('feed_error') , $rss->get_error_message() ) . '</div>';
71
  return;
72
  }
73
 
89
  $show_date = (int) $args['show_date'];
90
 
91
  if ( !$rss->get_item_quantity() ) {
92
+ return '<div>' .$this->message('feed_empty') . '</div>';
93
  }
94
  $results = '';
95
 
154
  unset($rss);
155
  return $results;
156
  }
 
157
  }
classes/class-options.php CHANGED
@@ -19,6 +19,10 @@ class Footer_Putter_Options {
19
  }
20
  }
21
 
 
 
 
 
22
  function get_defaults() {
23
  return $this->defaults;
24
  }
@@ -66,8 +70,8 @@ class Footer_Putter_Options {
66
  function validate_options($defaults, $options ) {
67
  if (is_array($defaults) )
68
  if (is_array($options))
69
- return shortcode_atts($defaults, $options);
70
- else
71
  return $defaults;
72
  else
73
  return false;
19
  }
20
  }
21
 
22
+ function get_keys() {
23
+ return array_keys($this->defaults);
24
+ }
25
+
26
  function get_defaults() {
27
  return $this->defaults;
28
  }
70
  function validate_options($defaults, $options ) {
71
  if (is_array($defaults) )
72
  if (is_array($options))
73
+ return shortcode_atts($defaults, $options);
74
+ else
75
  return $defaults;
76
  else
77
  return false;
classes/class-plugin.php CHANGED
@@ -1,33 +1,64 @@
1
  <?php
2
  class Footer_Putter_Plugin {
3
-
4
-
5
- const OPTIONS_NAME = 'footer_putter_options';
6
  private $help = FOOTER_PUTTER_HELP;
7
  private $home = FOOTER_PUTTER_HOME;
8
  private $icon = FOOTER_PUTTER_ICON;
9
  private $name = FOOTER_PUTTER_NAME;
10
- private $newsfeeds = array(DIYWEBMASTERY_NEWS);
11
  private $path = FOOTER_PUTTER_PATH;
12
  private $slug = FOOTER_PUTTER_SLUG;
13
  private $version = FOOTER_PUTTER_VERSION;
 
 
 
 
 
 
 
 
14
  private $news;
15
  private $options;
16
  private $tooltips;
17
  private $utils;
18
- private $defaults = array();
19
- private $links = array();
20
- private $credits;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  static function get_instance() {
23
  static $instance = null;
24
  if (null === $instance) {
25
- // $instance = new static(); //use self instead of static to support 5.2 - not the same but okay as the plugin class is not extended
26
  $instance = new self();
27
  register_activation_hook($instance->path, array($instance, 'activate'));
28
  add_action('init', array($instance, 'init'),0);
29
- if (is_admin()) add_action('init', array($instance, 'admin_init'),0);
30
-
31
  }
32
  return $instance;
33
  }
@@ -38,38 +69,9 @@ class Footer_Putter_Plugin {
38
 
39
  private function __wakeup() {}
40
 
41
-
42
- function init() {
43
- $dir = dirname(__FILE__) . '/';
44
- require_once($dir . 'class-utils.php');
45
- require_once($dir . 'class-tooltip.php');
46
- require_once($dir . 'class-options.php');
47
- require_once($dir . 'class-widget.php');
48
- require_once($dir . 'class-credits.php');
49
- require_once($dir . 'class-credits-widgets.php');
50
- require_once($dir . 'class-trademarks-widgets.php');
51
- $this->utils = new Footer_Putter_Utils();
52
- $this->tooltips = new Footer_Putter_Tooltip();
53
- $this->options = new Footer_Putter_Options( self::OPTIONS_NAME, $this->defaults);
54
- $this->credits = new Footer_Credits();
55
  }
56
-
57
- function admin_init() {
58
- $dir = dirname(__FILE__) . '/';
59
- require_once($dir . 'class-tooltip.php');
60
- require_once($dir . 'class-admin.php');
61
- require_once($dir . 'class-news.php');
62
- require_once($dir . 'class-dashboard.php');
63
- require_once($dir . 'class-credits-admin.php');
64
- require_once($dir . 'class-trademarks-admin.php');
65
- $this->news = new Footer_Putter_News($this->version);
66
- $intro = new Footer_Putter_Dashboard($this);
67
- $this->links['intro'] = $intro->get_url();
68
- $credits = new Footer_Credits_Admin($this, 'credits');
69
- $this->links['credits'] = $credits->get_url();
70
- $trademarks = new Footer_Trademarks_Admin($this, 'trademarks');
71
- $this->links['trademarks'] = $trademarks->get_url();
72
- }
73
 
74
  public function get_help(){
75
  return $this->help;
@@ -83,6 +85,14 @@ class Footer_Putter_Plugin {
83
  return $this->icon;
84
  }
85
 
 
 
 
 
 
 
 
 
86
  public function get_name(){
87
  return $this->name;
88
  }
@@ -99,11 +109,14 @@ class Footer_Putter_Plugin {
99
  return $this->options;
100
  }
101
 
102
-
103
  public function get_path(){
104
  return $this->path;
105
  }
106
 
 
 
 
 
107
  public function get_slug(){
108
  return $this->slug;
109
  }
@@ -120,14 +133,56 @@ class Footer_Putter_Plugin {
120
  return $this->version;
121
  }
122
 
123
- function get_link_url($key) {
124
- if (array_key_exists($key, $this->links))
125
- return $this->links[$key];
126
- else
127
- return ('#');
 
 
 
 
 
 
128
  }
129
 
130
- function get_credits() {
131
- return $this->credits;
132
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
1
  <?php
2
  class Footer_Putter_Plugin {
3
+ private $changelog = FOOTER_PUTTER_CHANGELOG;
 
 
4
  private $help = FOOTER_PUTTER_HELP;
5
  private $home = FOOTER_PUTTER_HOME;
6
  private $icon = FOOTER_PUTTER_ICON;
7
  private $name = FOOTER_PUTTER_NAME;
8
+ private $newsfeeds = array(FOOTER_PUTTER_NEWS);
9
  private $path = FOOTER_PUTTER_PATH;
10
  private $slug = FOOTER_PUTTER_SLUG;
11
  private $version = FOOTER_PUTTER_VERSION;
12
+ private $modules = array(
13
+ 'credits' => array('class'=> 'Footer_Putter_Credits','heading' => 'Credits', 'tip' => 'Footer Putter Credits.'),
14
+ 'trademarks' => array('class'=> 'Footer_Putter_Trademarks','heading' => 'Trademarks', 'tip' => 'Footer Putter Trademarks.'),
15
+ 'footer' => array('class'=> 'Footer_Putter_Footer','heading' => 'Footer', 'tip' => 'Footer Putter Footer.'),
16
+ );
17
+
18
+ private $defaults = array();
19
+ private $message;
20
  private $news;
21
  private $options;
22
  private $tooltips;
23
  private $utils;
24
+
25
+ private $admin_modules = array();
26
+ private $public_modules = array();
27
+
28
+ public function init() {
29
+ $d = dirname(__FILE__) . '/';
30
+ require_once($d . 'class-options.php');
31
+ require_once($d . 'class-utils.php');
32
+ require_once($d . 'class-tooltip.php');
33
+ require_once($d . 'class-message.php');
34
+ require_once($d . 'class-module.php');
35
+ $this->options = new Footer_Putter_Options( 'footer_credits_options', $this->defaults);
36
+ $this->utils = new Footer_Putter_Utils();
37
+ $this->tooltips = new Footer_Putter_Tooltip();
38
+ $this->message = new Footer_Putter_Message();
39
+ require_once ($d . 'class-widget.php');
40
+ foreach ($this->modules as $module => $details) $this->init_module($module);
41
+ if (is_admin())
42
+ $this->admin_init();
43
+ }
44
+
45
+ public function admin_init() {
46
+ $d = dirname(__FILE__) . '/';
47
+ require_once($d . 'class-news.php');
48
+ require_once($d . 'class-admin.php');
49
+ $this->news = new Footer_Putter_News($this->version);
50
+ require_once ($d . 'class-dashboard.php');
51
+ new Footer_Putter_Dashboard($this);
52
+ foreach ($this->modules as $module => $details) $this->init_module($module, true);
53
+
54
+ }
55
 
56
  static function get_instance() {
57
  static $instance = null;
58
  if (null === $instance) {
 
59
  $instance = new self();
60
  register_activation_hook($instance->path, array($instance, 'activate'));
61
  add_action('init', array($instance, 'init'),0);
 
 
62
  }
63
  return $instance;
64
  }
69
 
70
  private function __wakeup() {}
71
 
72
+ public function get_changelog(){
73
+ return $this->changelog;
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  public function get_help(){
77
  return $this->help;
85
  return $this->icon;
86
  }
87
 
88
+ public function get_message(){
89
+ return $this->message;
90
+ }
91
+
92
+ public function get_modules(){
93
+ return $this->modules;
94
+ }
95
+
96
  public function get_name(){
97
  return $this->name;
98
  }
109
  return $this->options;
110
  }
111
 
 
112
  public function get_path(){
113
  return $this->path;
114
  }
115
 
116
+ public function get_prefix(){
117
+ return sprintf('_%1$s_', $this->slug);
118
+ }
119
+
120
  public function get_slug(){
121
  return $this->slug;
122
  }
133
  return $this->version;
134
  }
135
 
136
+ public function activate() { //called on plugin activation
137
+ $this->set_activation_key();
138
+ }
139
+
140
+ private function deactivate($path ='') {
141
+ if (empty($path)) $path = $this->path;
142
+ if (is_plugin_active($path)) deactivate_plugins( $path );
143
+ }
144
+
145
+ private function get_activation_key() {
146
+ return get_option($this->activation_key_name());
147
  }
148
 
149
+ private function set_activation_key() {
150
+ return update_option($this->activation_key_name(), true);
151
+ }
152
+
153
+ private function unset_activation_key() {
154
+ return delete_option($this->activation_key_name(), true);
155
+ }
156
+
157
+ private function activation_key_name() {
158
+ return strtolower(__CLASS__) . '_activation';
159
+ }
160
+
161
+ public function get_module($module, $is_admin = false) {
162
+ $modules = $is_admin ? $this->admin_modules: $this->public_modules;
163
+ return array_key_exists($module, $modules) ? $modules[$module] : false;
164
+ }
165
+
166
+ private function init_module($module, $admin=false) {
167
+ if (array_key_exists($module, $this->modules)
168
+ && ($class = $this->modules[$module]['class'])) {
169
+ $prefix = dirname(__FILE__) .'/class-'. $module;
170
+ if ($admin) {
171
+ $class = $class .'_Admin';
172
+ $file = $prefix . '-admin.php';
173
+ if (!class_exists($class) && file_exists($file)) {
174
+ require_once($file);
175
+ $this->admin_modules[$module] = new $class($this, $module);
176
+ }
177
+ } else {
178
+ $file = $prefix . '.php';
179
+ if (!class_exists($class) && file_exists($file)) {
180
+ require_once($file);
181
+ $this->public_modules[$module] = new $class();
182
+ }
183
+ $file = $prefix . '-widgets.php';
184
+ if (file_exists($file)) require_once($file);
185
+ }
186
+ }
187
+ }
188
  }
classes/class-tooltip.php CHANGED
@@ -15,8 +15,12 @@ class Footer_Putter_Tooltip {
15
  $this->tabindex = 100;
16
  }
17
 
 
 
 
 
18
  function heading($label, $args=false) {
19
- $heading = array_key_exists($label,$this->labels) ? (__($this->labels[$label]['heading']).self::HELP) : '';
20
  return $args ? $this->apply_args ($heading, $args) : $heading;
21
  }
22
 
@@ -49,5 +53,4 @@ class Footer_Putter_Tooltip {
49
  }
50
  return $content;
51
  }
52
-
53
  }
15
  $this->tabindex = 100;
16
  }
17
 
18
+ function get_keys() {
19
+ return array_keys($this->labels);
20
+ }
21
+
22
  function heading($label, $args=false) {
23
+ $heading = array_key_exists($label,$this->labels) ? ($this->labels[$label]['heading'].self::HELP) : '';
24
  return $args ? $this->apply_args ($heading, $args) : $heading;
25
  }
26
 
53
  }
54
  return $content;
55
  }
 
56
  }
classes/class-trademarks-admin.php CHANGED
@@ -1,69 +1,52 @@
1
  <?php
2
 
3
- class Footer_Trademarks_Admin extends Footer_Putter_Admin{
4
 
5
  public function init() {
6
  add_action('admin_menu',array($this, 'admin_menu'));
7
  }
8
 
9
  public function admin_menu() {
10
- $this->screen_id = add_submenu_page($this->get_parent_slug(), __('Footer Trademarks'), __('Footer Trademarks'), 'manage_options',
 
11
  $this->get_slug(), array($this,'page_content'));
12
  add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
13
  }
14
 
15
  public function page_content() {
16
  $title = $this->admin_heading('Footer Trademarks');
17
- $this->print_admin_form($title, __CLASS__, $this->get_keys());
18
  }
19
 
20
  public function load_page() {
21
  $this->add_tooltip_support();
22
- $this->add_meta_box('intro', 'Instructions', 'intro_panel');
23
- $this->add_meta_box('trademarks', 'Trademarks', 'trademarks_panel');
24
  add_action ('admin_enqueue_scripts',array($this, 'enqueue_admin'));
25
- }
26
 
27
  function trademarks_panel($post, $metabox) {
28
- print $this->tabbed_metabox( $metabox['id'], array( 'Tips' => $this->tips_panel(), 'Screenshots' => $this->screenshots_panel()));
 
 
 
29
  }
30
 
31
- function intro_panel() {
32
  $linkcat = admin_url('edit-tags.php?taxonomy=link_category');
33
  $addlink = admin_url('link-add.php');
34
  $widgets = admin_url('widgets.php');
35
- print <<< INTRO
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>Trust Marks</i> or something similar.</p>
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>Trust Marks</i> as the link category.</p>
44
- INTRO;
45
  }
46
 
47
- public function tips_panel() {
48
- return <<< TIPS
49
- <h3>Image File Size</h3>
50
- <p>The plugin uses each trademark image "as is" so you need to provide trademark images that are suitably sized. </p>
51
- <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>
52
- <h3>Image File Type</h3>
53
- <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>
54
- TIPS;
55
  }
56
 
57
- public function screenshots_panel() {
58
  $img1 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
59
  $img2 = plugins_url('images/add-link.jpg',dirname(__FILE__));
60
- return <<< SCREENSHOTS
61
- <p>Below are annotated screenshots of creating the link category and adding a link .
62
- <h4>Add A Link Category</h4>
63
- <p><img class="dashed-border" src="{$img1}" alt="Screenshot of adding a trademark link category" /></p>
64
- <h4>Add A Link</h4>
65
- <p><img class="dashed-border" src="{$img2}" alt="Screenshot of adding a trademark link " /></p>
66
- SCREENSHOTS;
67
  }
68
 
69
  }
1
  <?php
2
 
3
+ class Footer_Putter_Trademarks_Admin extends Footer_Putter_Admin{
4
 
5
  public function init() {
6
  add_action('admin_menu',array($this, 'admin_menu'));
7
  }
8
 
9
  public function admin_menu() {
10
+ $plugin_name = $this->get_name();
11
+ $this->screen_id = add_submenu_page($this->get_parent_slug(), $plugin_name .' Trademarks', $this->message('menu_trademarks'), 'manage_options',
12
  $this->get_slug(), array($this,'page_content'));
13
  add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
14
  }
15
 
16
  public function page_content() {
17
  $title = $this->admin_heading('Footer Trademarks');
18
+ $this->print_admin_form($title, __CLASS__);
19
  }
20
 
21
  public function load_page() {
22
  $this->add_tooltip_support();
23
+ $this->add_meta_box('trademarks', $this->message('section_trademarks_instructions_title'), 'trademarks_panel');
24
+ $this->add_meta_box('news', $this->message('plugin_news'), 'news_panel', null, 'advanced');
25
  add_action ('admin_enqueue_scripts',array($this, 'enqueue_admin'));
26
+ }
27
 
28
  function trademarks_panel($post, $metabox) {
29
+ print $this->tabbed_metabox( $metabox['id'], array(
30
+ $this->message('tab_trademarks_instructions') => $this->instructions_panel(),
31
+ $this->message('tab_trademarks_tips') => $this->tips_panel(),
32
+ $this->message('tab_trademarks_screenshots') => $this->screenshots_panel()));
33
  }
34
 
35
+ function instructions_panel() {
36
  $linkcat = admin_url('edit-tags.php?taxonomy=link_category');
37
  $addlink = admin_url('link-add.php');
38
  $widgets = admin_url('widgets.php');
39
+ return sprintf($this->message('trademarks_intro'), $linkcat, $addlink, $widgets);
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
+ function tips_panel() {
43
+ return $this->message('trademarks_tips');
 
 
 
 
 
 
44
  }
45
 
46
+ function screenshots_panel() {
47
  $img1 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
48
  $img2 = plugins_url('images/add-link.jpg',dirname(__FILE__));
49
+ return sprintf($this->message('trademarks_screenshots'), $img1, $img2);
 
 
 
 
 
 
50
  }
51
 
52
  }
classes/class-trademarks-widgets.php CHANGED
@@ -3,24 +3,24 @@
3
  class Footer_Putter_Trademark_Widget extends Footer_Putter_Widget {
4
 
5
 
6
- private $tips = array(
7
- 'title' => array('heading' => 'Title', 'tip' => 'Widget Title'),
8
- 'category' => array('heading' => 'Category', 'tip' => 'Select Link Category for Your Trademarks'),
9
- 'limit' => array('heading' => '# of links', 'tip' => 'Number of trademarks to show'),
10
- 'orderby' => array('heading' => 'Order By', 'tip' => 'Sort by name, rating, ID or random'),
11
- 'nofollow' => array('heading' => 'Rel=nofollow', 'tip' => 'Mark the links with rel=nofollow'),
12
- 'visibility' => array('heading' => 'Show or Hide', 'tip' => 'Determine on which pages the footer widget is displayed'),
13
- );
14
-
15
- private $defaults = array( 'title' => '',
16
  'category' => false, 'limit' => '', 'orderby' => 'name', 'nofollow' => false, 'visibility' => '');
17
 
18
  function __construct() {
19
  add_filter('pre_option_link_manager_enabled', '__return_true' );
20
- $widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks') );
21
- parent::__construct('footer_trademarks', __('Trademarks Widget'), $widget_ops);
 
22
  }
23
 
 
 
 
 
 
 
 
 
24
  function nofollow_links( $content) {
25
  return preg_replace_callback( '/<a([^>]*)>(.*?)<\/a[^>]*>/is', array( &$this, 'nofollow_link' ), $content ) ;
26
  }
@@ -42,17 +42,16 @@ class Footer_Putter_Trademark_Widget extends Footer_Putter_Widget {
42
  }
43
 
44
  function widget( $args, $instance ) {
45
- extract($args, EXTR_SKIP);
46
  $instance = wp_parse_args( (array) $instance, $this->defaults );
47
  if ($this->hide_widget($instance['visibility'])) return; //check visibility requirements
48
 
49
- $title = apply_filters('widget_title', $instance['title'] );
50
- $category = isset($instance['category']) ? $instance['category'] : false;
51
  $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
52
  $order = $orderby == 'rating' ? 'DESC' : 'ASC';
53
  $limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
54
  $nofollow = isset( $instance['nofollow'] ) && $instance['nofollow'];
55
-
56
  $links = wp_list_bookmarks(apply_filters('widget_links_args', array(
57
  'echo' => 0,
58
  'title_before' => $before_title, 'title_after' => $after_title,
@@ -66,7 +65,6 @@ class Footer_Putter_Trademark_Widget extends Footer_Putter_Widget {
66
  'limit' => $limit,
67
  )));
68
  echo $before_widget;
69
- if ($title) echo $before_title . $title . $after_title;
70
  if ($nofollow)
71
  echo $this->nofollow_links($links);
72
  else
@@ -75,9 +73,7 @@ class Footer_Putter_Trademark_Widget extends Footer_Putter_Widget {
75
  }
76
 
77
  function update( $new_instance, $old_instance ) {
78
- $new_instance = (array) $new_instance;
79
- $instance = wp_parse_args( (array) $old_instance, $this->defaults );
80
- $instance['title'] = strip_tags( $new_instance['title'] );
81
  $instance['orderby'] = 'name';
82
  if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
83
  $instance['orderby'] = $new_instance['orderby'];
@@ -89,7 +85,7 @@ class Footer_Putter_Trademark_Widget extends Footer_Putter_Widget {
89
  }
90
 
91
  function form( $instance ) {
92
- $this->form_init ($instance, $this->tips);
93
  print '<div class="diy-wrap">';
94
  $links = array();
95
  $link_cats = get_terms( 'link_category' );
@@ -97,19 +93,12 @@ class Footer_Putter_Trademark_Widget extends Footer_Putter_Widget {
97
  $id = intval($link_cat->term_id);
98
  $links[$id] = $link_cat->name;
99
  }
100
- $this->print_form_field('title', 'text', array(), array('size' => 10));
101
  $this->print_form_field('category', 'select', $links);
102
- $this->print_form_field('orderby', 'select', array(
103
- 'name' => __( 'Link title'),
104
- 'rating' => __( 'Link rating'),
105
- 'id' => __( 'Link ID'),
106
- 'rand' => __( 'Random')
107
- ));
108
  $this->print_form_field('limit', 'text', array(), array('size' => 3 ,'maxlength' => 3));
109
  $this->print_form_field('nofollow', 'select', array( '1' => 'NoFollow Links', '' => 'Follow Links',));
110
- print ('<hr/><h4>Widget Presence</h4>');
111
- $this->print_form_field('visibility', 'radio',
112
- $this->get_visibility_options(), array('separator' => '<br />'));
113
  print '</div>';
114
  }
115
 
3
  class Footer_Putter_Trademark_Widget extends Footer_Putter_Widget {
4
 
5
 
6
+ private $defaults = array(
 
 
 
 
 
 
 
 
 
7
  'category' => false, 'limit' => '', 'orderby' => 'name', 'nofollow' => false, 'visibility' => '');
8
 
9
  function __construct() {
10
  add_filter('pre_option_link_manager_enabled', '__return_true' );
11
+ $widget_name = $this->message('trademarks_widget_name');
12
+ $widget_ops = array( 'description' => $this->message('trademarks_widget_description') );
13
+ parent::__construct('footer_trademarks', $widget_name, $widget_ops);
14
  }
15
 
16
+ function orderby_options() {
17
+ return array(
18
+ 'name' => $this->message( 'orderby_link_title'),
19
+ 'rating' => $this->message( 'orderby_link_rating'),
20
+ 'id' => $this->message( 'orderby_link_id'),
21
+ 'rand' => $this->message( 'orderby_random'));
22
+ }
23
+
24
  function nofollow_links( $content) {
25
  return preg_replace_callback( '/<a([^>]*)>(.*?)<\/a[^>]*>/is', array( &$this, 'nofollow_link' ), $content ) ;
26
  }
42
  }
43
 
44
  function widget( $args, $instance ) {
 
45
  $instance = wp_parse_args( (array) $instance, $this->defaults );
46
  if ($this->hide_widget($instance['visibility'])) return; //check visibility requirements
47
 
48
+ $args = $this->override_args($args, $instance) ;
49
+ $category = isset($instance['category']) ? $instance['category'] : false;
50
  $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
51
  $order = $orderby == 'rating' ? 'DESC' : 'ASC';
52
  $limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
53
  $nofollow = isset( $instance['nofollow'] ) && $instance['nofollow'];
54
+ extract($args, EXTR_SKIP);
55
  $links = wp_list_bookmarks(apply_filters('widget_links_args', array(
56
  'echo' => 0,
57
  'title_before' => $before_title, 'title_after' => $after_title,
65
  'limit' => $limit,
66
  )));
67
  echo $before_widget;
 
68
  if ($nofollow)
69
  echo $this->nofollow_links($links);
70
  else
73
  }
74
 
75
  function update( $new_instance, $old_instance ) {
76
+ $instance = $this->update_instance( $new_instance, $old_instance );
 
 
77
  $instance['orderby'] = 'name';
78
  if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
79
  $instance['orderby'] = $new_instance['orderby'];
85
  }
86
 
87
  function form( $instance ) {
88
+ $this->form_init ($instance);
89
  print '<div class="diy-wrap">';
90
  $links = array();
91
  $link_cats = get_terms( 'link_category' );
93
  $id = intval($link_cat->term_id);
94
  $links[$id] = $link_cat->name;
95
  }
 
96
  $this->print_form_field('category', 'select', $links);
97
+ $this->print_form_field('orderby', 'select', $this->orderby_options());
 
 
 
 
 
98
  $this->print_form_field('limit', 'text', array(), array('size' => 3 ,'maxlength' => 3));
99
  $this->print_form_field('nofollow', 'select', array( '1' => 'NoFollow Links', '' => 'Follow Links',));
100
+ printf ('<hr/><h4>%1$s</h4>', $this->message('widget_presence_heading') );
101
+ $this->print_form_field('visibility', 'radio', $this->get_visibility_options(), array('separator' => '<br />'));
 
102
  print '</div>';
103
  }
104
 
classes/class-utils.php CHANGED
@@ -1,9 +1,20 @@
1
  <?php
2
  class Footer_Putter_Utils {
3
 
4
- protected $prefix = '_footer_putter_';
 
5
  protected $is_html5 = null;
6
 
 
 
 
 
 
 
 
 
 
 
7
  function get_prefix() { return $this->prefix;}
8
  function get_metakey($fld) { return $this->prefix . $fld;}
9
  function get_home_meta_key() { return $this->get_metakey('home_meta'); }
@@ -52,7 +63,6 @@ class Footer_Putter_Utils {
52
 
53
  function get_post_id() {
54
  global $post;
55
-
56
  if (is_object($post)
57
  && property_exists($post, 'ID')
58
  && ($post_id = $post->ID))
@@ -190,7 +200,7 @@ class Footer_Putter_Utils {
190
  }
191
  }
192
 
193
- function deleteterm_meta( $term_id, $key = false) {
194
  $default_metakey = $this->get_term_meta_key();
195
  if (function_exists('delete_term_meta')) {
196
  if (!$key) $key = $default_metakey;
@@ -319,8 +329,10 @@ class Footer_Putter_Utils {
319
  switch ($type) {
320
  case 'number':
321
  case 'password':
 
322
  case 'text':
323
- $input .= sprintf('<input type="%1$s" id="%2$s" name="%3$s" value="%4$s" %5$s%6$s%7$s%8$s%9$s%10$s%11$s /> %12$s',
 
324
  $type, $fld_id, $fld_name, $value,
325
  isset($readonly) ? (' readonly="'.$readonly.'"') : '',
326
  isset($size) ? (' size="'.$size.'"') : '',
@@ -328,6 +340,7 @@ class Footer_Putter_Utils {
328
  isset($class) ? (' class="'.$class.'"') : '',
329
  isset($min) ? (' min="'.$min.'"') : '',
330
  isset($max) ? (' max="'.$max.'"') : '',
 
331
  isset($pattern) ? (' pattern="'.$pattern.'"') : '',
332
  isset($suffix) ? $suffix : '');
333
  break;
@@ -352,11 +365,11 @@ class Footer_Putter_Utils {
352
  $input .= sprintf('<legend class="screen-reader-text"><span>%1$s</span></legend>', $legend);
353
  if (!isset($separator)) $separator = '';
354
  foreach ($options as $optkey => $optlabel)
355
- $input .= sprintf('<input type="checkbox" id="%1$s" name="%2$s[]" %3$s value="%4$s" /><label for="%1$s">%5$s</label>%6$s',
356
  $fld_id, $fld_name, str_replace('\'','"',checked($optkey, $value, false)), $optkey, $optlabel, $separator);
357
  $input = sprintf('<fieldset class="diy-fieldset">%1$s</fieldset>',$input);
358
  } else {
359
- $input .= sprintf('<input type="checkbox" class="checkbox" id="%1$s" name="%2$s" %3$svalue="1" class="diy-checkbox" />',
360
  $fld_id, $fld_name, checked($value, '1', false));
361
  }
362
  break;
@@ -367,11 +380,54 @@ class Footer_Putter_Utils {
367
  if (isset($legend))
368
  $input .= sprintf('<legend class="screen-reader-text"><span>%1$s</span></legend>', $legend);
369
  foreach ($options as $optkey => $optlabel)
370
- $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>',
371
  $fld_id, $fld_name, in_array($optkey, $values) ? 'checked="checked"' : '', $optkey, $optlabel);
372
  $input = sprintf('<fieldset class="diy-fieldset%2$s"><ul>%1$s</ul></fieldset>',$input, isset($class) ? (' '.$class) : '');
373
 
374
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  case 'radio':
376
  if (is_array($options) && (count($options) > 0)) {
377
  if (isset($legend))
@@ -404,6 +460,50 @@ class Footer_Putter_Utils {
404
  return sprintf($format, $label, $input);
405
  }
406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  function log($result) {
408
  if ($this->is_error_log()) {
409
  $this->error_log($this->prepare_error($result));
@@ -435,6 +535,36 @@ class Footer_Putter_Utils {
435
  }
436
 
437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
  function late_inline_styles($css) {
439
  if (empty($css)) return;
440
  $wrap = '$("<style type=\"text/css\">%1$s</style>").appendTo("head");';
@@ -456,6 +586,83 @@ class Footer_Putter_Utils {
456
  {$ready_end}
457
  //]]>
458
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  SCRIPT;
460
  }
461
 
1
  <?php
2
  class Footer_Putter_Utils {
3
 
4
+ protected $slug = 'footer_putter';
5
+ protected $prefix = '';
6
  protected $is_html5 = null;
7
 
8
+ function __construct($slug='') {
9
+ if (!empty($slug)) $this->slug = $slug;
10
+ $this->prefix = sprintf('_%1$s_', $this->slug);
11
+ }
12
+
13
+ function get_code($code='') {
14
+ $format = empty($code) ? '%1$s' : '%1$s-%2$s';
15
+ return sprintf($format, $this->slug, $code);
16
+ }
17
+
18
  function get_prefix() { return $this->prefix;}
19
  function get_metakey($fld) { return $this->prefix . $fld;}
20
  function get_home_meta_key() { return $this->get_metakey('home_meta'); }
63
 
64
  function get_post_id() {
65
  global $post;
 
66
  if (is_object($post)
67
  && property_exists($post, 'ID')
68
  && ($post_id = $post->ID))
200
  }
201
  }
202
 
203
+ function delete_term_meta( $term_id, $key = false) {
204
  $default_metakey = $this->get_term_meta_key();
205
  if (function_exists('delete_term_meta')) {
206
  if (!$key) $key = $default_metakey;
329
  switch ($type) {
330
  case 'number':
331
  case 'password':
332
+ case 'range':
333
  case 'text':
334
+ case 'url':
335
+ $input .= sprintf('<input type="%1$s" id="%2$s" name="%3$s" value="%4$s" %5$s%6$s%7$s%8$s%9$s%10$s%11$s%12$s /> %13$s',
336
  $type, $fld_id, $fld_name, $value,
337
  isset($readonly) ? (' readonly="'.$readonly.'"') : '',
338
  isset($size) ? (' size="'.$size.'"') : '',
340
  isset($class) ? (' class="'.$class.'"') : '',
341
  isset($min) ? (' min="'.$min.'"') : '',
342
  isset($max) ? (' max="'.$max.'"') : '',
343
+ isset($step) ? (' step="'.$step.'"') : '',
344
  isset($pattern) ? (' pattern="'.$pattern.'"') : '',
345
  isset($suffix) ? $suffix : '');
346
  break;
365
  $input .= sprintf('<legend class="screen-reader-text"><span>%1$s</span></legend>', $legend);
366
  if (!isset($separator)) $separator = '';
367
  foreach ($options as $optkey => $optlabel)
368
+ $input .= sprintf('<input type="checkbox" class="diy-checkbox" id="%1$s" name="%2$s[]" %3$s value="%4$s" /><label for="%1$s">%5$s</label>%6$s',
369
  $fld_id, $fld_name, str_replace('\'','"',checked($optkey, $value, false)), $optkey, $optlabel, $separator);
370
  $input = sprintf('<fieldset class="diy-fieldset">%1$s</fieldset>',$input);
371
  } else {
372
+ $input .= sprintf('<input type="checkbox" class="diy-checkbox" id="%1$s" name="%2$s" %3$svalue="1" class="diy-checkbox" />',
373
  $fld_id, $fld_name, checked($value, '1', false));
374
  }
375
  break;
380
  if (isset($legend))
381
  $input .= sprintf('<legend class="screen-reader-text"><span>%1$s</span></legend>', $legend);
382
  foreach ($options as $optkey => $optlabel)
383
+ $input .= sprintf('<li><input type="checkbox" class="diy-checkbox" id="%1$s" name="%2$s[]" %3$s value="%4$s" /><label for="%1$s">%5$s</label></li>',
384
  $fld_id, $fld_name, in_array($optkey, $values) ? 'checked="checked"' : '', $optkey, $optlabel);
385
  $input = sprintf('<fieldset class="diy-fieldset%2$s"><ul>%1$s</ul></fieldset>',$input, isset($class) ? (' '.$class) : '');
386
 
387
  break;
388
+
389
+ case 'keypairs':
390
+ $keypairs = (array) $value;
391
+ $i=0;
392
+ $lines = array();
393
+ $spares = isset($args['spares']) ? $args['spares'] : 0;
394
+ if (isset($legend))
395
+ $input .= sprintf('<legend class="screen-reader-text"><span>%1$s</span></legend>', $legend);
396
+ foreach ($keypairs as $key => $value){
397
+ $i++;
398
+ $lines[] =
399
+ sprintf('<div class="diy-keypair"><input type="text" id="%1$s" name="%2$s" value="%3$s" %4$s%5$s%6$s /> ',
400
+ $fld_id.'key'.$i, sprintf('%1$s[key][%2$s]', $fld_name, $i), $key,
401
+ isset($size) ? (' size="'.$size.'"') : '',
402
+ isset($maxlength) ? (' maxlength="'.$maxlength.'"') : '',
403
+ isset($pattern) ? (' pattern="'.$pattern.'"') : '') .
404
+ sprintf('<textarea id="%1$s" name="%2$s"%3$s%4$s%5$s>%6$s</textarea></div>',
405
+ $fld_id.'val'.$i, sprintf('%1$s[val][%2$s]', $fld_name, $i),
406
+ isset($rows) ? (' rows="'.$rows.'"') : '',
407
+ isset($cols) ? (' cols="'.$cols.'"') : '',
408
+ isset($class) ? (' class="'.$class.'"') : '', stripslashes($value));
409
+
410
+ }
411
+ for ($j = 1; $j <= $spares; $j++) {
412
+ $r = $i+$j;
413
+ $lines[] =
414
+ sprintf('<div class="diy-keypair"><input id="%1$s" name="%2$s" value="%3$s" %4$s%5$s%6$s%7$s/> ',
415
+ $fld_id.'key'.($r), sprintf('%1$s[key][%2$s]', $fld_name, $r), '',
416
+ isset($size) ? (' size="'.$size.'"') : '',
417
+ isset($maxlength) ? (' maxlength="'.$maxlength.'"') : '',
418
+ isset($placeholder) ? (' placeholder="'.$placeholder.'"') : '',
419
+ isset($pattern) ? (' pattern="'.$pattern.'"') : '') .
420
+ sprintf('<textarea id="%1$s" name="%2$s"%3$s%4$s%5$s>%6$s</textarea></div>',
421
+ $fld_id.'value'.($r), sprintf('%1$s[val][%2$s]', $fld_name, $r),
422
+ isset($rows) ? (' rows="'.$rows.'"') : '',
423
+ isset($cols) ? (' cols="'.$cols.'"') : '',
424
+ isset($class) ? (' class="'.$class.'"') : '','');
425
+ }
426
+
427
+ $input = sprintf('<fieldset class="diy-fieldset%2$s">%1$s</fieldset>',implode('',$lines), isset($class) ? (' '.$class) : '');
428
+
429
+ break;
430
+
431
  case 'radio':
432
  if (is_array($options) && (count($options) > 0)) {
433
  if (isset($legend))
460
  return sprintf($format, $label, $input);
461
  }
462
 
463
+ function sanitize_post_keypairs($lexicon) {
464
+ if (isset($_POST[$lexicon]['key']) && isset($_POST[$lexicon]['val']) ) {
465
+ foreach ( $_POST[$lexicon]['key'] as $i => $key ){
466
+ if ( empty($key) ){
467
+ unset( $_POST[$lexicon]['val'][$i] );
468
+ } else {
469
+ $_POST[$lexicon][$key] = $_POST[$lexicon]['val'][$i];
470
+ }
471
+ }
472
+ unset($_POST[$lexicon]['key']);
473
+ unset($_POST[$lexicon]['val']);
474
+ }
475
+ }
476
+
477
+ function get_image_sizes() {
478
+ global $_wp_additional_image_sizes;
479
+ $sizes = array();
480
+ foreach ( get_intermediate_image_sizes() as $_size ) {
481
+ if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
482
+ $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
483
+ $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
484
+ $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
485
+ } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
486
+ $sizes[ $_size ] = array(
487
+ 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
488
+ 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
489
+ 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
490
+ );
491
+ }
492
+ }
493
+ return $sizes;
494
+ }
495
+
496
+
497
+ function get_image_size( $size ) {
498
+ $sizes = $this->get_image_sizes();
499
+
500
+ if ( isset( $sizes[ $size ] ) ) {
501
+ return $sizes[ $size ];
502
+ }
503
+
504
+ return false;
505
+ }
506
+
507
  function log($result) {
508
  if ($this->is_error_log()) {
509
  $this->error_log($this->prepare_error($result));
535
  }
536
 
537
 
538
+ function is_gutenberg_page() {
539
+ return function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ;
540
+ }
541
+
542
+ function truncate_last_space($text, $max_chars ) {
543
+ if ( ! $max_chars ) return '';
544
+ $text = trim( $text );
545
+ if ( mb_strlen( $text ) > $max_chars ) {
546
+ $text = mb_substr( $text, 0, $max_chars + 1 );
547
+ $text_trim = trim( mb_substr( $text, 0, mb_strrpos( $text, ' ' ) ) );
548
+ $text = empty( $text_trim ) ? $text : $text_trim;
549
+ }
550
+ return $text;
551
+ }
552
+
553
+
554
+ function maybe_enqueue_tooltip_styles() {
555
+ if ( class_exists('FLBuilderModel')
556
+ && is_callable(array('FLBuilderModel', 'is_builder_active'))
557
+ && FLBuilderModel::is_builder_active() ) {
558
+ add_action('wp_enqueue_scripts', array($this, 'register_tooltip_styles'));
559
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_tooltip_styles'));
560
+ }
561
+ }
562
+
563
+ function print_styles($css){
564
+ if (empty($css)) return false;
565
+ printf('<style type="text/css">%1$s</style>', $css);
566
+ }
567
+
568
  function late_inline_styles($css) {
569
  if (empty($css)) return;
570
  $wrap = '$("<style type=\"text/css\">%1$s</style>").appendTo("head");';
586
  {$ready_end}
587
  //]]>
588
  </script>
589
+
590
+ SCRIPT;
591
+ }
592
+
593
+
594
+ function print_late_stylesheet($url) {
595
+ print <<< STYLES
596
+
597
+ <script>
598
+ //<![CDATA[
599
+ (function(d) {
600
+ var wf = d.createElement('link'), s = d.scripts[0];
601
+ wf.href = '{$url}';
602
+ wf.rel = 'stylesheet';
603
+ s.parentNode.insertBefore(wf, s);
604
+ })(document);
605
+ //]]>
606
+ </script>
607
+
608
+ STYLES;
609
+ }
610
+
611
+ function print_async_script($url, $config='') {
612
+ print <<< SCRIPT
613
+
614
+ <script>
615
+ //<![CDATA[
616
+ {$config}
617
+ (function(d) {
618
+ var wf = d.createElement('script'), s = d.scripts[0];
619
+ wf.src = '{$url}';
620
+ wf.async = true;
621
+ s.parentNode.insertBefore(wf, s);
622
+ })(document);
623
+ //]]>
624
+ </script>
625
+
626
+ SCRIPT;
627
+ }
628
+
629
+ function print_async_script_with_callback($url, $callback='') {
630
+ print <<< SCRIPT
631
+
632
+ <script>
633
+ //<![CDATA[
634
+ (function(d) {
635
+ var wf = d.createElement('script'), s = d.scripts[0], loaded = false;
636
+ wf.src = '{$url}';
637
+ wf.async = true;
638
+ wf.onreadystatechange = wf.onload = function() {
639
+ if (!loaded) {
640
+ {$callback}
641
+ }
642
+ loaded = true;
643
+ };
644
+ s.parentNode.insertBefore(wf, s);
645
+ })(document);
646
+ //]]>
647
+ </script>
648
+
649
+ SCRIPT;
650
+ }
651
+
652
+ function print_final_async_script($url) {
653
+ print <<< SCRIPT
654
+ <script>
655
+ //<![CDATA[
656
+ (function(d) {
657
+ var s = d.createElement('script');
658
+ s.src = '{$url}';
659
+ s.async = true;
660
+ s.defer = true;
661
+ d.body.appendChild(s);
662
+ })(document);
663
+ //]]>
664
+ </script>
665
+
666
  SCRIPT;
667
  }
668
 
classes/class-widget.php CHANGED
@@ -11,10 +11,6 @@ if (!class_exists('Footer_Putter_Widget')) {
11
  protected $widget_id;
12
  private $tooltips;
13
  private $defaults = array('title' => '', 'html_title' => '', 'class' => '');
14
- private $tips = array('title' => array('heading' => 'Label', 'tip' => 'Label appears only in the Widget Dashboard to make widget identification easier'),
15
- 'html_title' => array('heading' => 'Widget Title', 'tip' => 'Enhanced widget title can contain some HTML such as links, spans and breaks'),
16
- 'class' => array('heading' => 'Widget Class', 'tip' => 'Class to place on widget instance to make CSS customization easier')
17
- );
18
 
19
  function __construct( $id_base, $name, $widget_options = array(), $control_options = array()) {
20
  $this->plugin = Footer_Putter_Plugin::get_instance();
@@ -22,6 +18,11 @@ if (!class_exists('Footer_Putter_Widget')) {
22
  parent::__construct($id_base, $name, $widget_options, $control_options);
23
  }
24
 
 
 
 
 
 
25
  function get_version() {
26
  return $this->plugin->get_version();
27
  }
@@ -83,11 +84,10 @@ if (!class_exists('Footer_Putter_Widget')) {
83
  return $instance;
84
  }
85
 
86
- function form_init( $instance, $tips = false, $html_title = true) {
87
- if (is_array($tips) && (count($tips) > 0)) $this->tips = array_merge($this->tips, $tips);
88
- $this->tooltips = new Footer_Putter_Tooltip($this->tips);
89
  $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
90
- print('<h4>Title</h4>');
 
91
  $this->print_form_field('title', 'text', array(), array('size' => 20));
92
  if ($html_title) $this->print_form_field('html_title', 'textarea', array(), array( 'class' => 'widefat' ));
93
  $this->print_form_field('class', 'text', array(), array( 'size' => 20 ));
@@ -130,9 +130,9 @@ if (!class_exists('Footer_Putter_Widget')) {
130
 
131
  function get_visibility_options(){
132
  return array(
133
- '' => 'Show on all pages',
134
- 'hide_landing' => 'Hide on landing pages',
135
- 'show_landing' => 'Show only on landing pages');
136
  }
137
 
138
  function hide_widget($visibility ) {
11
  protected $widget_id;
12
  private $tooltips;
13
  private $defaults = array('title' => '', 'html_title' => '', 'class' => '');
 
 
 
 
14
 
15
  function __construct( $id_base, $name, $widget_options = array(), $control_options = array()) {
16
  $this->plugin = Footer_Putter_Plugin::get_instance();
18
  parent::__construct($id_base, $name, $widget_options, $control_options);
19
  }
20
 
21
+ function message($id) {
22
+ if(empty($this->plugin)) $this->plugin = Footer_Putter_Plugin::get_instance();
23
+ return $this->plugin->get_message()->message($id);
24
+ }
25
+
26
  function get_version() {
27
  return $this->plugin->get_version();
28
  }
84
  return $instance;
85
  }
86
 
87
+ function form_init( $instance, $html_title = true) {
 
 
88
  $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
89
+ $this->tooltips = new Footer_Putter_Tooltip($this->plugin->get_message()->build_tips(array_keys($this->instance)));
90
+ sprintf('<h4>%1$s</h4>', $this->message('title'));
91
  $this->print_form_field('title', 'text', array(), array('size' => 20));
92
  if ($html_title) $this->print_form_field('html_title', 'textarea', array(), array( 'class' => 'widefat' ));
93
  $this->print_form_field('class', 'text', array(), array( 'size' => 20 ));
130
 
131
  function get_visibility_options(){
132
  return array(
133
+ '' => $this->message('visibility_all'),
134
+ 'hide_landing' => $this->message('visibility_hide_landing'),
135
+ 'show_landing' => $this->message('visibility_show_landing'));
136
  }
137
 
138
  function hide_widget($visibility ) {
main.php CHANGED
@@ -3,21 +3,23 @@
3
  * Plugin Name: Footer Putter
4
  * Plugin URI: https://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.15
7
  * Author: Russell Jamieson
8
  * Author URI: https://www.diywebmastery.com/about/
 
9
  * License: GPLv3
10
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
  */
12
- define('FOOTER_PUTTER_VERSION','1.15');
 
13
  define('FOOTER_PUTTER_NAME', 'Footer Putter') ;
14
- define('FOOTER_PUTTER_SLUG', plugin_basename(dirname(__FILE__))) ;
15
- define('FOOTER_PUTTER_PATH', FOOTER_PUTTER_SLUG.'/main.php');
16
- define('FOOTER_PUTTER_ICON','dashicons-arrow-down-alt');
17
- define('FOOTER_PUTTER_DOMAIN', 'FOOTER_PUTTER_DOMAIN') ;
 
18
  define('FOOTER_PUTTER_HOME','https://www.diywebmastery.com/plugins/footer-putter/');
19
- define('FOOTER_PUTTER_HELP','https://www.diywebmastery.com/help/');
20
-
21
- if (!defined('DIYWEBMASTERY_NEWS')) define('DIYWEBMASTERY_NEWS', 'https://www.diywebmastery.com/tags/newsfeed/feed/?images=1&featured_only=1');
22
  require_once(dirname(__FILE__) . '/classes/class-plugin.php');
23
  Footer_Putter_Plugin::get_instance();
3
  * Plugin Name: Footer Putter
4
  * Plugin URI: https://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.17
7
  * Author: Russell Jamieson
8
  * Author URI: https://www.diywebmastery.com/about/
9
+ * Text Domain: footer-putter
10
  * License: GPLv3
11
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
12
  */
13
+ if ( ! defined( 'ABSPATH' ) ) { exit; }
14
+ define('FOOTER_PUTTER_VERSION','1.17');
15
  define('FOOTER_PUTTER_NAME', 'Footer Putter') ;
16
+ define('FOOTER_PUTTER_SLUG', 'footer-putter');
17
+ define('FOOTER_PUTTER_PATH', plugin_basename(__FILE__));
18
+ define('FOOTER_PUTTER_PLUGIN_URL', plugins_url(FOOTER_PUTTER_SLUG));
19
+ define('FOOTER_PUTTER_CHANGELOG',' https://www.diywebmastery.com/plugins/footer-putter/footer-putter-version-history/');
20
+ define('FOOTER_PUTTER_HELP','https://www.diywebmastery.com/plugins/footer-putter/footer-putter-help/');
21
  define('FOOTER_PUTTER_HOME','https://www.diywebmastery.com/plugins/footer-putter/');
22
+ define('FOOTER_PUTTER_ICON','dashicons-arrow-down-alt');
23
+ define('FOOTER_PUTTER_NEWS', 'https://www.diywebmastery.com/tags/newsfeed/feed/?images=1&featured_only=1');
 
24
  require_once(dirname(__FILE__) . '/classes/class-plugin.php');
25
  Footer_Putter_Plugin::get_instance();
readme.txt CHANGED
@@ -1,18 +1,18 @@
1
  === Footer Putter ===
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.9.8
7
- Requires PHP: 5.3.6
8
- Stable tag: 1.15
9
  License: GPLv2+
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
  Put a footer on your site that boosts your credibility with both search engines and human visitors.
13
 
14
  == Description ==
15
- * Footer Putter can create two widgets: a Footer Copyright Widget and a Trademarks Widget
16
  * Include your site accreditations to demonstrate that your business meets the required standards for your industry
17
  * Create a footer that gives your site the credibility that it belongs to a real business
18
  * Include a footer menu with links to Contact, Privacy and Terms and Conditions Pages
@@ -29,6 +29,7 @@ Put a footer on your site that boosts your credibility with both search engines
29
  * Option to use HTML5 microdata for Organization in accordance with Google recommendations
30
  * Option to apply rel=nofollow automatically to footer trademark links
31
  * Option to hide Powered By WordPress on TwentySomething themes
 
32
 
33
  == Installation ==
34
 
@@ -49,14 +50,17 @@ Put a footer on your site that boosts your credibility with both search engines
49
 
50
  == Changelog ==
51
 
52
- = 1.15 = Added 6 new footer layouts to organize the copyright, contact and footer menu sections
 
 
 
53
 
54
  For full version history please see https://www.diywebmastery.com/plugins/footer-putter/footer-putter-version-history/
55
 
56
  == Upgrade Notice ==
57
 
58
- = 1.15 =
59
- * Optional - Added 6 new footer layouts to orgamize the copyright, contact and footer menu sections
60
 
61
  == Links ==
62
 
1
  === Footer Putter ===
2
  Contributors: powerblogservice, diywebmastery
3
+ Donate link: https://www.diywebmastery.com/donate/
4
  Tags: footer, copyright, trademark
5
  Requires at least: 3.1
6
+ Tested up to: 5.6.1
7
+ Requires PHP: 5.6
8
+ Stable tag: 1.17
9
  License: GPLv2+
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
  Put a footer on your site that boosts your credibility with both search engines and human visitors.
13
 
14
  == Description ==
15
+ * Footer Putter can create two widgets: a Footer Putter Copyright Widget and a Footer Putter Trademarks Widget
16
  * Include your site accreditations to demonstrate that your business meets the required standards for your industry
17
  * Create a footer that gives your site the credibility that it belongs to a real business
18
  * Include a footer menu with links to Contact, Privacy and Terms and Conditions Pages
29
  * Option to use HTML5 microdata for Organization in accordance with Google recommendations
30
  * Option to apply rel=nofollow automatically to footer trademark links
31
  * Option to hide Powered By WordPress on TwentySomething themes
32
+ * Supports various arrangements of footer menu, copyright and contact details over 1, 2 or 3 lines.
33
 
34
  == Installation ==
35
 
50
 
51
  == Changelog ==
52
 
53
+ = 1.17 =
54
+
55
+ * Internationalisation support
56
+ * Update for WordPress 5.6 and PHP 7.4
57
 
58
  For full version history please see https://www.diywebmastery.com/plugins/footer-putter/footer-putter-version-history/
59
 
60
  == Upgrade Notice ==
61
 
62
+ = 1.17 =
63
+ * Optional - Internationalisation support and updates for WordPress 5.6 and PHP 7.4
64
 
65
  == Links ==
66
 
scripts/jquery.return.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function($) {
2
+ if ($('.footer-return').length ) {
3
+ $(window).scroll(function(){
4
+ if ($(window).scrollTop() > 640) {
5
+ $('.footer-return').show('slow');
6
+ } else {
7
+ s$('.footer-return').hide('slow');
8
+ }
9
+ });
10
+
11
+ $('.footer-return').click(function(){
12
+ sp('html, body').animate({scrollTop : 0},1000);
13
+ });
14
+ }
15
+ });
styles/footer-credits.css CHANGED
@@ -1,44 +1,47 @@
1
  .footer-center, .return-center { text-align: center; padding: 10px 0px; }
2
  .return-left { margin-left: 10px; float: left; width : 20%; }
3
  .footer-right { float: right; text-align: right; width: 70%; margin-bottom: 10px; }
4
- .footer-credits ul, .footer-credits ul li {
5
- display : inline-block; list-style-type: none; background: none; border: 0; margin: 0px; padding: 0; vertical-align: middle; }
6
- .footer-credits ul li:before { content : "\B7"; }
7
- .footer-credits ul li:first-child:before { content : ""; }
8
- .footer-credits ul li a {
9
  text-decoration: none; color: inherit; font-weight: normal; letter-spacing : normal; text-transform: none; border:none; margin:0 10px; }
10
- .footer-credits ul li a:hover, .footer-credits a.email:hover, .footer-credits a.map:hover { text-decoration: underline;}
11
- .footer-credits span.copyright, .footer-credits span.telephone, .footer-credits span.address, .footer-credits a.email, .footer-credits a.map {
12
  font-weight: normal; letter-spacing : normal; text-transform: none; margin: 0 10px; vertical-align: middle;
13
  background: none; border : none; float: none; display: inline; color: inherit; text-decoration: none; }
14
  .footer-right span.copyright, .footer-right span.address, .footer-right span.telephone, .footer-right span.email { display: block;}
15
 
16
- .footer-credits .dark, .footer-credits .dark li, .footer-credits .dark a, .footer-return.dark a, .footer-return.dark a:visited { color : #222222; }
17
- .footer-credits .light, .footer-credits .light li, .footer-credits .light a, .footer-return.light a, .footer-return.light a:visited { color : #DDDDDD; }
18
- .footer-credits .white, .footer-credits .white li, .footer-credits .white a, .footer-return.white a, .footer-return.white a:visited { color : white; }
19
- .footer-credits .small, .footer-credits .small ul li a, .footer-return.small a { font-size : small; }
20
- .footer-credits .tiny, .footer-credits .tiny ul li a, .footer-return.tiny a { font-size : x-small; }
21
 
22
- .footer-credits > div { display: inline-block; }
23
- .footer-credits.stacked > div, .footer-credits.stacked-alt > div,
24
- .menu-above .footer-credits-menu, .menu-above-alt .footer-credits-menu,
25
- .contact-below .footer-credits-contact, .copyright-below .footer-credits-copyright {
 
 
 
 
 
26
  display: block;
27
  }
28
 
29
  .widget_footer_trademarks { text-align: center; margin: 10px 0;}
30
- .widget_footer_trademarks a { margin: 10px; border: 0 !important;}
31
  .widget_footer_trademarks img { border: 0 !important; }
32
 
33
  .widget_footer_copyright, .widget_footer_trademarks
34
  { margin: 0 !important; padding: 0 !important; width: 100% !important; float:none !important; }
35
  .site-info .custom-footer { margin: 0 !important; border: 0 !important; padding : 0!important; width: 100% !important;}
36
 
37
- .custom-footer.hide-wordpress + .site-title,
38
- .custom-footer.hide-wordpress + .site-title + a[href='http://wordpress.org/'],
39
- .custom-footer.hide-wordpress + .site-title + a[href='https://wordpress.org/'],
40
- .custom-footer.hide-wordpress + .site-info a[href='https://wordpress.org/'],
41
- .custom-footer.hide-wordpress + a[href='https://wordpress.org/'],
42
- .custom-footer.hide-wordpress + a[href='http://wordpress.org/'] {
43
- display: none;
44
- }
1
  .footer-center, .return-center { text-align: center; padding: 10px 0px; }
2
  .return-left { margin-left: 10px; float: left; width : 20%; }
3
  .footer-right { float: right; text-align: right; width: 70%; margin-bottom: 10px; }
4
+ .footer-putter-credits ul, .footer-putter-credits ul li {
5
+ display : inline-block; list-style-type: none; background: none; border: 0; margin: 0px; padding: 0; vertical-align: middle; height:auto; }
6
+ .footer-putter-credits ul li:before { content : "\B7"; }
7
+ .footer-putter-credits ul li:first-child:before { content : ""; }
8
+ .footer-putter-credits ul li a {
9
  text-decoration: none; color: inherit; font-weight: normal; letter-spacing : normal; text-transform: none; border:none; margin:0 10px; }
10
+ .footer-putter-credits ul li a:hover, .footer-putter-credits a.email:hover, .footer-putter-credits a.map:hover { text-decoration: underline;}
11
+ .footer-putter-credits span.copyright, .footer-putter-credits span.telephone, .footer-putter-credits span.address, .footer-putter-credits a.email, .footer-putter-credits a.map {
12
  font-weight: normal; letter-spacing : normal; text-transform: none; margin: 0 10px; vertical-align: middle;
13
  background: none; border : none; float: none; display: inline; color: inherit; text-decoration: none; }
14
  .footer-right span.copyright, .footer-right span.address, .footer-right span.telephone, .footer-right span.email { display: block;}
15
 
16
+ .footer-putter-credits .dark, .footer-putter-credits .dark li, .footer-putter-credits .dark a, .footer-return.dark span { color : #222222; }
17
+ .footer-putter-credits .light, .footer-putter-credits .light li, .footer-putter-credits .light a, .footer-return.light span { color : #DDDDDD; }
18
+ .footer-putter-credits .white, .footer-putter-credits .white li, .footer-putter-credits .white a, .footer-return.white span { color : white; }
19
+ .footer-putter-credits .small, .footer-putter-credits .small ul li a, .footer-return.small span { font-size : small; }
20
+ .footer-putter-credits .tiny, .footer-putter-credits .tiny ul li a, .footer-return.tiny span { font-size : x-small; }
21
 
22
+ .footer-return span { cursor: pointer;}
23
+ .footer-return span:hover { text-decoration: underline; }
24
+
25
+ .footer-putter-menu .menu, .footer-putter-menu .menu li {width: auto!important;}
26
+
27
+ .footer-putter-credits > div { display: inline-block; }
28
+ .footer-putter-credits.stacked > div, .footer-putter-credits.stacked-alt > div,
29
+ .menu-above .footer-putter-menu, .menu-above-alt .footer-putter-menu,
30
+ .contact-below .footer-putter-contact, .copyright-below .footer-putter-copyright {
31
  display: block;
32
  }
33
 
34
  .widget_footer_trademarks { text-align: center; margin: 10px 0;}
35
+ .widget_footer_trademarks a { margin: 10px; border: 0 !important; display:inline-block!important; }
36
  .widget_footer_trademarks img { border: 0 !important; }
37
 
38
  .widget_footer_copyright, .widget_footer_trademarks
39
  { margin: 0 !important; padding: 0 !important; width: 100% !important; float:none !important; }
40
  .site-info .custom-footer { margin: 0 !important; border: 0 !important; padding : 0!important; width: 100% !important;}
41
 
42
+ .custom-footer.hide-wordpress + .site-title,
43
+ .custom-footer.hide-wordpress + .site-title + a[href*="wordpress.org"],
44
+ .custom-footer.hide-wordpress + .site-info a[href*="wordpress.org"],
45
+ .custom-footer.hide-wordpress + a[href*="wordpress.org"] {
46
+ display: none;
47
+ }
 
 
styles/tooltip.css CHANGED
@@ -20,21 +20,43 @@ content: ""; position: absolute; z-index: 1000; bottom: -7px; left: 50%;margin-l
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: 0 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 ul, .wrapfieldset .diy-fieldset ul { margin: 0; }
27
- .diy-fieldset li { display: inline; }
28
- .diy-checkbox { margin-left: 3px;}
29
  .diy-label { min-width: 160px; margin: 2px 10px 0 0; vertical-align: top; display: inline-block;}
30
  .diy-wrap { margin: 10px 0; }
31
  .diy-wrap h4 { margin: 10px 0;}
32
  .diy-wrap p { margin: 5px 0 0; }
33
- tr.diy-row th, tr.diy-row td { margin: 0; padding: 5px;}
34
- div.diy-row { margin-bottom: 5px; padding: 0px;}
35
- .diy-row input, .diy-row textarea { margin-top: 0; max-width: 99%;}
36
- .diy-row .wp-picker-container {display: inline-block;}
 
 
 
 
 
 
 
 
37
  .widgets-holder-wrap .diy-wrap .diy-row .diy-label { margin-top: 5px;}
38
  .widgets-holder-wrap .diy-label { min-width: 150px; }
39
  .widgets-holder-wrap .diy-wrap .diy-label { min-width: 100px;}
40
- .widgets-holder-wrap .diy-fieldset label { min-width: 30px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ div.diy-row { margin-bottom: 5px; padding: 0px;}
24
+ tr.diy-row th, tr.diy-row td { margin: 0; padding: 5px;}
25
+ .diy-row .diy-checkbox { margin-left: 1px;}
26
+ .diy-row > input, .diy-row > textarea {margin-left: 0; margin-top: 0; max-width: 99%;}
27
+ .diy-row .wp-picker-container {display: inline-block;}
 
28
  .diy-label { min-width: 160px; margin: 2px 10px 0 0; vertical-align: top; display: inline-block;}
29
  .diy-wrap { margin: 10px 0; }
30
  .diy-wrap h4 { margin: 10px 0;}
31
  .diy-wrap p { margin: 5px 0 0; }
32
+ .diy-fieldset {display: inline-block; margin: 0 5px; }
33
+ .diy-fieldset label { min-width: 70px; margin: 3px 15px 3px 5px; vertical-align:middle; }
34
+ .diy-fieldset input, .diy-fieldset textarea { margin: 3px 0; padding-top:0;vertical-align: top;}
35
+ .diy-row > input[type="radio"] { margin-left: 15px;}
36
+ .diy-row > input[type="radio"]:first-of-type { margin-left: 0;}
37
+ .diy-fieldset li { display: inline; }
38
+ .diy-fieldset.single li { display: block; }
39
+ .diy-fieldset.incols li { display:list-item;}
40
+ .diy-fieldset ul, .wrapfieldset .diy-fieldset ul { margin: 0; }
41
+ .wrapfieldset > label {display: block; margin-bottom: 10px;}
42
+ .wrapfieldset > .diy-fieldset {display: block; width:100%;}
43
+ .wrapfieldset .diy-fieldset ul {display: block; width:100%;}
44
  .widgets-holder-wrap .diy-wrap .diy-row .diy-label { margin-top: 5px;}
45
  .widgets-holder-wrap .diy-label { min-width: 150px; }
46
  .widgets-holder-wrap .diy-wrap .diy-label { min-width: 100px;}
47
+ .widgets-holder-wrap .diy-fieldset label { min-width: 30px; }
48
+ .diy-keypair {width:95%; -webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;}
49
+ .diy-keypair textarea{width:100%;}
50
+ @media only screen and (min-width: 480px) {
51
+ .diy-fieldset.incols ul{ column-count: 2; -webkit-column-count: 2; -moz-column-count: 3; }
52
+ }
53
+ @media only screen and (min-width: 640px) {
54
+ .diy-fieldset.incols ul{ column-count: 3; -webkit-column-count: 3; -moz-column-count: 3; }
55
+ .diy-keypair input {width:35%;}
56
+ .diy-keypair textarea{width:60%;}
57
+ }
58
+ @media only screen and (min-width: 960px) {
59
+ .diy-fieldset.incols ul{ column-count: 5; -webkit-column-count: 5; -moz-column-count: 5; }
60
+ .diy-keypair input {width:25%;}
61
+ .diy-keypair textarea{width:70%;}
62
+ }