Footer Putter - Version 1.7

Version Description

Made email address a mailto link. Added pre-defined classes, tiny and small, to make it easy to use a smaller font size in the footer on pages such as landing pages. Added widget visibility setting to make it easy to either hide or show the footer widgets on landing pages. Replaced the plugin icon image in admin menu with a dashicons font character. Automatically uses HTML5 if theme supports HTML5 - no manual setting required.

Download this release

Release Info

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

Code changes from version 1.6 to 1.7

classes/admin.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
  class FooterPutterAdmin {
3
- const CLASSNAME = 'FooterPutterAdmin'; //this class
4
  const CODE = 'footer-putter';
5
  const DOMAIN = 'FooterPutter';
6
 
@@ -19,8 +18,17 @@ class FooterPutterAdmin {
19
  static function init($root) {
20
  self::$slug = $root;
21
  add_filter('pre_option_link_manager_enabled', '__return_true' );
22
- add_filter('plugin_action_links',array(self::CLASSNAME, 'plugin_action_links'), 10, 2 );
23
- add_action('admin_menu',array(self::CLASSNAME, 'admin_menu'));
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
  static function plugin_action_links( $links, $file ) {
@@ -33,8 +41,8 @@ class FooterPutterAdmin {
33
 
34
  static function admin_menu() {
35
  self::$screen_id = add_menu_page(FOOTER_PUTTER_FRIENDLY_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'manage_options',
36
- self::get_slug(), array(self::CLASSNAME,'settings_panel'),plugins_url('images/icon-16.png',dirname(__FILE__)) );
37
- add_submenu_page(FOOTER_PUTTER_PLUGIN_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'Intro', 'manage_options', FOOTER_PUTTER_PLUGIN_NAME,array(self::CLASSNAME,'settings_panel') );
38
  }
39
 
40
  static function settings_panel() {
@@ -89,7 +97,7 @@ The plugins define two widgets:
89
  <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>
90
  <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>,
91
  or use a theme-specific hook such as <i>twentyten_credits</i>, <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,
92
- <i>twentythirteen_credits</i>, <i>genesis_footer</i>, <i>pagelines_leaf</i>, etc</p>
93
 
94
  <h3>Getting Help</h3>
95
  <p>Check out the <a href="{$home_url}">Footer Putter Plugin page</a> for more information about the plugin.</p>
1
  <?php
2
  class FooterPutterAdmin {
 
3
  const CODE = 'footer-putter';
4
  const DOMAIN = 'FooterPutter';
5
 
18
  static function init($root) {
19
  self::$slug = $root;
20
  add_filter('pre_option_link_manager_enabled', '__return_true' );
21
+ add_filter('plugin_action_links',array(__CLASS__, 'plugin_action_links'), 10, 2 );
22
+ add_action('admin_menu',array(__CLASS__, 'admin_menu'));
23
+ add_action('admin_print_styles',array(__CLASS__, 'style_icon'));
24
+ }
25
+
26
+ public static function style_icon() {
27
+ print <<< STYLES
28
+ <style type="text/css">
29
+ #adminmenu .menu-icon-generic.toplevel_page_footer-putter div.wp-menu-image:before { content: '\\f346'; }
30
+ </style>
31
+ STYLES;
32
  }
33
 
34
  static function plugin_action_links( $links, $file ) {
41
 
42
  static function admin_menu() {
43
  self::$screen_id = add_menu_page(FOOTER_PUTTER_FRIENDLY_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'manage_options',
44
+ self::get_slug(), array(__CLASS__,'settings_panel') );
45
+ add_submenu_page(FOOTER_PUTTER_PLUGIN_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'Intro', 'manage_options', FOOTER_PUTTER_PLUGIN_NAME,array(__CLASS__,'settings_panel') );
46
  }
47
 
48
  static function settings_panel() {
97
  <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>
98
  <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>,
99
  or use a theme-specific hook such as <i>twentyten_credits</i>, <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,
100
+ <i>twentythirteen_credits</i>, <i>twentyfourteen_credits</i>, <i>genesis_footer</i>, <i>pagelines_leaf</i>, etc</p>
101
 
102
  <h3>Getting Help</h3>
103
  <p>Check out the <a href="{$home_url}">Footer Putter Plugin page</a> for more information about the plugin.</p>
classes/footer-credits-admin.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  class FooterCreditsAdmin {
3
- const CLASSNAME = 'FooterCreditsAdmin'; //this class
4
  const CODE = 'footer-credits'; //prefix ID of CSS elements
5
- const DOMAIN = 'FooterCredits'; //text domain for translation
6
  const FOOTER = 'FooterCredits'; //class that builds footer
7
  const SLUG = 'footer';
8
  private static $version;
@@ -25,7 +23,6 @@ class FooterCreditsAdmin {
25
  'footer_hook' => array('heading' => 'Footer Action Hook' , 'tip' => 'The hook where the footer widget area is added to the page. This field is only required if the theme does not already provide a suitable widget area where the footer widgets can be added.'),
26
  'footer_remove' => array('heading' => 'Remove Existing Actions?' , 'tip' => 'Click the checkbox to remove any other actions at the above footer hook. This may stop you getting two footers; one created by your theme and another created by this plugin. For some themes you will check this option as you will typically want to replace the theme footer by the plugin footer.'),
27
  'footer_filter_hook' => array('heading' => 'Footer Filter Hook' , 'tip' => 'If you want to kill off the footer created by your theme, and your theme allows you to filter the content of the footer, then enter the hook where the theme filters the footer. This may stop you getting two footers; one created by your theme and another created by this plugin.'),
28
- 'enable_html5' => array('heading' => 'Enable HTML5' , 'tip' => 'Use the HTML5 &lt;footer&gt; element for the custom footer widget area.'),
29
  'privacy_contact' => array('heading' => 'Add Privacy Contact?', 'tip' => 'Add a section to the end of the privacy statement with contact information'),
30
  'terms_contact' => array('heading' => 'Add Terms Contact?', 'tip' => 'Add a section to the end of the Terms and Conditions page with contact and legal information'),
31
  );
@@ -35,7 +32,7 @@ class FooterCreditsAdmin {
35
  self::$version = FooterCredits::VERSION;
36
  self::$parenthook = $parent;
37
  self::$slug = self::$parenthook . '-' . self::SLUG;
38
- add_action('admin_menu',array(self::CLASSNAME, 'admin_menu'));
39
  }
40
 
41
  private static function get_parenthook(){
@@ -58,10 +55,10 @@ class FooterCreditsAdmin {
58
  return self::$keys;
59
  }
60
 
61
- public static function get_url($id='', $noheader = false) {
62
- return admin_url('admin.php?page='.self::get_slug().(empty($id) ? '' : ('&amp;id='.$id)).(empty($noheader) ? '' : '&amp;noheader=true'));
63
  }
64
-
65
  public static function enable_screen($show_screen,$screen) {
66
  if ($screen->id == self::get_screen_id())
67
  return true;
@@ -71,8 +68,8 @@ class FooterCreditsAdmin {
71
 
72
  public static function admin_menu() {
73
  self::$screen_id = add_submenu_page(self::get_parenthook(), __('Footer Credits'), __('Footer Credits'), 'manage_options',
74
- self::get_slug(), array(self::CLASSNAME,'settings_panel'));
75
- add_action('load-'.self::get_screen_id(), array(self::CLASSNAME, 'load_page'));
76
  }
77
 
78
 
@@ -80,15 +77,15 @@ class FooterCreditsAdmin {
80
  $message = isset($_POST['options_update']) ? self::save() : '';
81
  $options = call_user_func(array(self::FOOTER, 'get_options'));
82
  $callback_params = array ('options' => $options, 'message' => $message);
83
- add_meta_box(self::CODE.'-intro', __('Introduction',self::DOMAIN), array(self::CLASSNAME, 'intro_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
84
- add_meta_box(self::CODE.'-owner', __('Site Owner Details',self::DOMAIN), array(self::CLASSNAME, 'owner_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
85
- add_meta_box(self::CODE.'-contact', __('Contact Details',self::DOMAIN), array(self::CLASSNAME, 'contact_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
86
- add_meta_box(self::CODE.'-legal', __('Legal Details',self::DOMAIN), array(self::CLASSNAME, 'legal_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
87
- add_meta_box(self::CODE.'-return', __('Return To Top',self::DOMAIN), array(self::CLASSNAME, 'return_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
88
- add_meta_box(self::CODE.'-example', __('Preview Footer',self::DOMAIN), array(self::CLASSNAME, 'preview_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
89
- add_meta_box(self::CODE.'-advanced', __('Advanced',self::DOMAIN), array(self::CLASSNAME, 'advanced_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
90
- add_action('admin_enqueue_scripts', array(self::CLASSNAME, 'enqueue_styles'));
91
- add_action('admin_enqueue_scripts',array(self::CLASSNAME, 'enqueue_scripts'));
92
  self::$keys = array_keys(self::$tips);
93
  self::$tooltips = new DIYTooltip(self::$tips);
94
  }
@@ -103,11 +100,11 @@ class FooterCreditsAdmin {
103
  wp_enqueue_script('common');
104
  wp_enqueue_script('wp-lists');
105
  wp_enqueue_script('postbox');
106
- add_action('admin_footer-'.self::get_screen_id(), array(self::CLASSNAME, 'toggle_postboxes'));
107
  }
108
 
109
  public static function save() {
110
- check_admin_referer(self::CLASSNAME);
111
  $page_options = explode(',', stripslashes($_POST['page_options']));
112
  if ($page_options) {
113
  $options = call_user_func(array(self::FOOTER, 'get_options'));
@@ -154,7 +151,7 @@ SCRIPT;
154
  public static function intro_panel($post,$metabox){
155
  $message = $metabox['args']['message'];
156
  print <<< INTRO_PANEL
157
- <p>The following information is in the Footer Copyright Widget and if this is a <a target="_blank" href="http://www.wpwhoosh.com">whooshed site</a> on the Privacy Statement and Terms and Conditions pages.</p>
158
  {$message}
159
  INTRO_PANEL;
160
  }
@@ -217,42 +214,39 @@ RETURN_PANEL;
217
  $tip1 = self::$tooltips->tip('footer_hook');
218
  $tip2 = self::$tooltips->tip('footer_remove');
219
  $tip3 = self::$tooltips->tip('footer_filter_hook');
220
- $tip4 = self::$tooltips->tip('enable_html5');
221
  $url = 'http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks';
222
  $footer_remove = $options['footer_remove'] ? 'checked="checked" ' : '';
223
- $enable_html5 = $options['enable_html5'] ? 'checked="checked" ' : '';
224
  print <<< ADVANCED_PANEL
225
  <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
226
  where the Widget Area will be located.</p>
227
  <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>,
228
- <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i> or <i>twentythirteen_credits</i>. If you using a Genesis child theme and the theme does not have a suitable widget area then use
229
  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>
230
  <label>{$tip1}</label><input type="text" name="footer_hook" size="30" value="{$options['footer_hook']}" /><br/>
231
  <label>{$tip2}</label><input type="checkbox" name="footer_remove" {$footer_remove}value="1" /><br/>
232
  <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,
233
  then specify the hook below. For example, entering <i>genesis_footer_output</i> will suppress the standard Genesis child theme footer.</p>
234
  <label>{$tip3}</label><input type="text" name="footer_filter_hook" size="30" value="{$options['footer_filter_hook']}" /><br/>
235
- <label>{$tip4}</label><input type="checkbox" name="enable_html5" {$enable_html5}value="1" /><br/>
236
  ADVANCED_PANEL;
237
  }
238
 
239
  public static function settings_panel() {
240
  $this_url = $_SERVER['REQUEST_URI'];
241
  $keys = implode(',',self::get_keys());
242
- $title = sprintf('<h2>%1$s</h2>', __('Footer Credits Settings', self::DOMAIN));
243
 
244
  ?>
245
  <div class="wrap">
246
  <?php screen_icon(); echo $title; ?>
247
  <div id="poststuff" class="metabox-holder">
248
- <div id="post-body">
249
  <div id="post-body-content">
250
  <form id="footer_options" method="post" action="<?php echo $this_url; ?>">
251
  <?php do_meta_boxes(self::get_screen_id(), 'normal', null); ?>
252
  <p class="submit">
253
  <input type="submit" class="button-primary" name="options_update" value="Save Changes" />
254
  <input type="hidden" name="page_options" value="<?php echo $keys; ?>" />
255
- <?php wp_nonce_field(self::CLASSNAME); ?>
256
  <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
257
  <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
258
  </p>
1
  <?php
2
  class FooterCreditsAdmin {
 
3
  const CODE = 'footer-credits'; //prefix ID of CSS elements
 
4
  const FOOTER = 'FooterCredits'; //class that builds footer
5
  const SLUG = 'footer';
6
  private static $version;
23
  '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.'),
24
  'footer_remove' => array('heading' => 'Remove Existing Actions?' , 'tip' => 'Click the checkbox to remove any other actions at the above footer hook. This may stop you getting two footers; one created by your theme and another created by this plugin. For some themes you will check this option as you will typically want to replace the theme footer by the plugin footer.'),
25
  '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.'),
 
26
  'privacy_contact' => array('heading' => 'Add Privacy Contact?', 'tip' => 'Add a section to the end of the privacy statement with contact information'),
27
  'terms_contact' => array('heading' => 'Add Terms Contact?', 'tip' => 'Add a section to the end of the Terms and Conditions page with contact and legal information'),
28
  );
32
  self::$version = FooterCredits::VERSION;
33
  self::$parenthook = $parent;
34
  self::$slug = self::$parenthook . '-' . self::SLUG;
35
+ add_action('admin_menu',array(__CLASS__, 'admin_menu'));
36
  }
37
 
38
  private static function get_parenthook(){
55
  return self::$keys;
56
  }
57
 
58
+ public static function get_url() {
59
+ return admin_url('admin.php?page='.self::get_slug());
60
  }
61
+
62
  public static function enable_screen($show_screen,$screen) {
63
  if ($screen->id == self::get_screen_id())
64
  return true;
68
 
69
  public static function admin_menu() {
70
  self::$screen_id = add_submenu_page(self::get_parenthook(), __('Footer Credits'), __('Footer Credits'), 'manage_options',
71
+ self::get_slug(), array(__CLASS__,'settings_panel'));
72
+ add_action('load-'.self::get_screen_id(), array(__CLASS__, 'load_page'));
73
  }
74
 
75
 
77
  $message = isset($_POST['options_update']) ? self::save() : '';
78
  $options = call_user_func(array(self::FOOTER, 'get_options'));
79
  $callback_params = array ('options' => $options, 'message' => $message);
80
+ add_meta_box(self::CODE.'-intro', __('Introduction'), array(__CLASS__, 'intro_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
81
+ add_meta_box(self::CODE.'-owner', __('Site Owner Details'), array(__CLASS__, 'owner_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
82
+ add_meta_box(self::CODE.'-contact', __('Contact Details'), array(__CLASS__, 'contact_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
83
+ add_meta_box(self::CODE.'-legal', __('Legal Details'), array(__CLASS__, 'legal_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
84
+ add_meta_box(self::CODE.'-return', __('Return To Top'), array(__CLASS__, 'return_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
85
+ add_meta_box(self::CODE.'-example', __('Preview Footer'), array(__CLASS__, 'preview_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
86
+ add_meta_box(self::CODE.'-advanced', __('Advanced'), array(__CLASS__, 'advanced_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
87
+ add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_styles'));
88
+ add_action('admin_enqueue_scripts',array(__CLASS__, 'enqueue_scripts'));
89
  self::$keys = array_keys(self::$tips);
90
  self::$tooltips = new DIYTooltip(self::$tips);
91
  }
100
  wp_enqueue_script('common');
101
  wp_enqueue_script('wp-lists');
102
  wp_enqueue_script('postbox');
103
+ add_action('admin_footer-'.self::get_screen_id(), array(__CLASS__, 'toggle_postboxes'));
104
  }
105
 
106
  public static function save() {
107
+ check_admin_referer(__CLASS__);
108
  $page_options = explode(',', stripslashes($_POST['page_options']));
109
  if ($page_options) {
110
  $options = call_user_func(array(self::FOOTER, 'get_options'));
151
  public static function intro_panel($post,$metabox){
152
  $message = $metabox['args']['message'];
153
  print <<< INTRO_PANEL
154
+ <p>The following information is used in the Footer Copyright Widget and optionally at the end of the Privacy Statement and Terms and Conditions pages.</p>
155
  {$message}
156
  INTRO_PANEL;
157
  }
214
  $tip1 = self::$tooltips->tip('footer_hook');
215
  $tip2 = self::$tooltips->tip('footer_remove');
216
  $tip3 = self::$tooltips->tip('footer_filter_hook');
 
217
  $url = 'http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks';
218
  $footer_remove = $options['footer_remove'] ? 'checked="checked" ' : '';
 
219
  print <<< ADVANCED_PANEL
220
  <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
221
  where the Widget Area will be located.</p>
222
  <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>,
223
+ <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
224
  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>
225
  <label>{$tip1}</label><input type="text" name="footer_hook" size="30" value="{$options['footer_hook']}" /><br/>
226
  <label>{$tip2}</label><input type="checkbox" name="footer_remove" {$footer_remove}value="1" /><br/>
227
  <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,
228
  then specify the hook below. For example, entering <i>genesis_footer_output</i> will suppress the standard Genesis child theme footer.</p>
229
  <label>{$tip3}</label><input type="text" name="footer_filter_hook" size="30" value="{$options['footer_filter_hook']}" /><br/>
 
230
  ADVANCED_PANEL;
231
  }
232
 
233
  public static function settings_panel() {
234
  $this_url = $_SERVER['REQUEST_URI'];
235
  $keys = implode(',',self::get_keys());
236
+ $title = sprintf('<h2>%1$s</h2>', __('Footer Credits Settings'));
237
 
238
  ?>
239
  <div class="wrap">
240
  <?php screen_icon(); echo $title; ?>
241
  <div id="poststuff" class="metabox-holder">
242
+ <div id="post-body" class="with-tooltips">
243
  <div id="post-body-content">
244
  <form id="footer_options" method="post" action="<?php echo $this_url; ?>">
245
  <?php do_meta_boxes(self::get_screen_id(), 'normal', null); ?>
246
  <p class="submit">
247
  <input type="submit" class="button-primary" name="options_update" value="Save Changes" />
248
  <input type="hidden" name="page_options" value="<?php echo $keys; ?>" />
249
+ <?php wp_nonce_field(__CLASS__); ?>
250
  <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
251
  <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
252
  </p>
classes/footer-credits.php CHANGED
@@ -1,14 +1,15 @@
1
  <?php
2
  class FooterCredits {
3
- const CLASSNAME = 'FooterCredits'; //name of class - must be same as line above - hard code for performance
4
- const DOMAIN = 'FooterCredits'; //text domain for translation
5
  const CODE = 'footer-credits'; //element prefix
6
  const OPTIONS_NAME = 'footer_credits_options';
7
  const SIDEBAR_ID = 'last-footer';
8
- const VERSION = '1.5';
9
  private static $version;
10
- protected static $options = array();
11
- protected static $defaults = array(
 
 
 
12
  'terms' => array(
13
  'site' => '',
14
  'owner' => '',
@@ -37,81 +38,80 @@ class FooterCredits {
37
  'footer_hook' => '',
38
  'footer_remove' => true,
39
  'footer_filter_hook' => '',
40
- 'enable_html5' => false
41
  );
42
-
43
  private static function get_version(){
44
  return self::$version;
45
  }
46
 
47
- static function init() {
48
  self::$version = self::VERSION;
 
49
  self::theme_specific_defaults();
50
- add_action('widgets_init',array(self::CLASSNAME,'register'),20);
51
- add_filter( 'wp_nav_menu_items', array(self::CLASSNAME, 'fix_home_link'), 10, 2 );
52
- if (!is_admin()) add_action('wp',array(self::CLASSNAME,'prepare'));
53
  }
54
 
55
- static function register() {
56
  self::register_sidebars();
57
  self::register_widgets();
58
  }
59
 
60
- static function prepare() {
61
- if (!is_admin()) {
62
- add_shortcode(self::CODE.'-copyright', array(self::CLASSNAME, 'copyright_owner' ) );
63
- add_shortcode(self::CODE.'-menu', array(self::CLASSNAME, 'footer_menu' ) );
64
- add_shortcode(self::CODE, array(self::CLASSNAME, 'footer' ) );
 
65
 
66
- add_filter('widget_text', 'do_shortcode', 11);
67
-
68
- add_action('wp_enqueue_scripts',array(self::CLASSNAME, 'add_styles' ));
69
 
70
- //insert custom footer at specified hook
71
- if ($footer_hook = self::get_option('footer_hook')) {
72
- if (self::get_option('footer_remove')) remove_all_actions( $footer_hook);
73
- add_action( $footer_hook, array(self::CLASSNAME, 'custom_footer'));
74
- }
75
 
76
- //suppress footer output
77
- if ($ffs = self::get_option('footer_filter_hook'))
78
- add_filter($ffs, array(self::CLASSNAME, 'no_footer'),100);
79
 
80
- if (is_page('privacy') && self::get_term('privacy_contact'))
81
- add_filter('the_content', array(self::CLASSNAME, 'add_privacy_footer'),9 );
82
 
83
- if (is_page('terms') && self::get_term('terms_contact'))
84
- add_filter('the_content', array(self::CLASSNAME, 'add_terms_footer'),9 );
85
 
86
- if (is_page('terms') || is_page('privacy') || is_page('affiliates') || is_page('disclaimer'))
87
- add_filter('the_content', array(self::CLASSNAME, 'terms_filter') );
88
- }
89
  }
90
-
91
- static function register_sidebars() {
92
  if (self::get_option('footer_hook')) {
93
- $tag = self::get_option('enable_html5') ? 'section' : 'div';
94
  register_sidebar( array(
95
  'id' => self::SIDEBAR_ID,
96
- 'name' => __( 'Credibility Footer', self::CLASSNAME ),
97
- 'description' => __( 'Custom footer section for copyright, trademarks, etc', self::CLASSNAME),
98
  'before_widget' => '<'.$tag.' id="%1$s" class="widget %2$s"><div class="widget-wrap">',
99
  'after_widget' => '</div></'.$tag.'>'
100
  ) );
101
  }
102
  }
103
 
104
- static function register_widgets() {
105
  register_widget( 'Footer_Putter_Copyright_Widget' );
106
  register_widget( 'Footer_Putter_TradeMark_Widget' );
107
  }
108
 
109
-
110
- static function add_styles() {
111
- wp_enqueue_style(self::CLASSNAME, plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(), self::get_version());
112
  }
113
 
114
- static function fix_home_link( $content, $args) {
115
  $class = is_front_page()? ' class="current_page_item"' : '';
116
  $home_linktexts = array('Home','<span>Home</span>');
117
  foreach ($home_linktexts as $home_linktext) {
@@ -122,14 +122,14 @@ class FooterCredits {
122
  return $content;
123
  }
124
 
125
- static function sanitize_terms($new_terms) {
126
  $new_terms = wp_parse_args($new_terms, self::$defaults['terms']); //ensure terms are complete
127
  $new_terms['site'] = self::get_default_site();
128
  $new_terms['copyright'] = self::get_copyright($new_terms['copyright_start_year']); //generate copyright
129
  return $new_terms;
130
  }
131
 
132
- static function save($new_options) {
133
  $options = self::get_options(false);
134
  $new_options = wp_parse_args( $new_options, $options);
135
  $new_options['terms'] = self::sanitize_terms($new_options['terms']);
@@ -138,7 +138,7 @@ class FooterCredits {
138
  return $updated;
139
  }
140
 
141
- static function get_options ($cache = true) {
142
  if ($cache && (count(self::$options) > 0)) return self::$options;
143
 
144
  $the_options = array();
@@ -151,7 +151,7 @@ class FooterCredits {
151
  return self::$options;
152
  }
153
 
154
- static function get_option($option_name) {
155
  $options = self::get_options();
156
  if ($option_name && $options && array_key_exists($option_name,$options))
157
  return $options[$option_name];
@@ -159,11 +159,11 @@ class FooterCredits {
159
  return false;
160
  }
161
 
162
- static function get_terms() {
163
  return self::get_option('terms');
164
  }
165
 
166
- static function get_term($term_name) {
167
  $options = self::get_options();
168
  $terms = is_array($options) && array_key_exists('terms',$options) ? $options['terms'] : false;
169
  if ($term_name && $terms && array_key_exists($term_name,$terms) && $terms[$term_name])
@@ -172,7 +172,7 @@ class FooterCredits {
172
  return self::get_default_term($term_name);
173
  }
174
 
175
- static function get_default_term($key) {
176
  $default='';
177
  switch ($key) {
178
  case 'owner' : $default = self::get_term('site'); break;
@@ -188,20 +188,20 @@ class FooterCredits {
188
  return $default;
189
  }
190
 
191
- static function get_default_site() {
192
  $domain = strtolower(parse_url(site_url(),PHP_URL_HOST));
193
  $p = strpos($domain,'www.') ;
194
  if (($p !== FALSE) && ($p == 0)) $domain = substr($domain,4);
195
  return $domain;
196
  }
197
 
198
- static function get_copyright($startyear){
199
  $thisyear = date("Y");
200
  if(empty( $startyear)) $startyear = $thisyear;
201
  return sprintf('Copyright &copy; %1$s%2$s', $startyear, $thisyear == $startyear ? '' : ("-".$thisyear));
202
  }
203
 
204
- static function copyright_owner($attr){
205
  $defaults['owner'] = self::get_term('owner');
206
  $defaults['copyright_start_year'] = self::get_term('copyright_start_year');
207
  $params = shortcode_atts( $defaults, $attr ); //apply plugin defaults
@@ -209,7 +209,7 @@ class FooterCredits {
209
  self::get_copyright($params['copyright_start_year']), $params['owner']);
210
  }
211
 
212
- static function format_address ($address, $separator) {
213
  $s='';
214
  $addlines = explode(',', trim($address));
215
  foreach ($addlines as $a) {
@@ -219,17 +219,17 @@ class FooterCredits {
219
  return $s;
220
  }
221
 
222
- static function footer_menu($menu) {
223
  return wp_nav_menu(array('menu' => $menu, 'echo' => false, 'container' => false));
224
  }
225
 
226
- static function return_to_top( $text, $class) {
227
- return sprintf( '<div class="%1$s"><a rel="nofollow" href="#" onclick="window.scrollTo(0,0); return false;" >%2$s</a></div>', trim($class), $text);
228
  }
229
 
230
-
231
- static function footer($atts = array()) {
232
  $params = shortcode_atts( self::get_options(), $atts ); //apply plugin defaults
 
233
  if ($params['center']) {
234
  $section_separator = '&nbsp;';
235
  $item_separator = $params['two_lines'] ? '<br/>' : $params['separator'];
@@ -256,12 +256,12 @@ class FooterCredits {
256
  (empty($params['show_copyright']) ? '' : sprintf('%1$s%2$s', $section_separator, $copyright)),
257
  ((empty($address) || empty($params['show_address'])) ? '' : sprintf('%1$s<span class="address">%2$s%3$s</span>', $item_separator, self::format_address($address, $params['separator']), self::get_term('country')) ),
258
  ((empty($telephone) || empty($params['show_telephone'])) ? '' : sprintf('%1$s<span class="telephone">%2$s</span>', $section_separator, $telephone) ),
259
- ((empty($email) || empty($params['show_email'])) ? '' : sprintf('%1$s<span class="email">%2$s</span>', $section_separator, $email) ),
260
  $clear
261
  );
262
  }
263
 
264
- static function terms_filter($content) {
265
  if ($terms = self::get_terms()) {
266
  $from = array();
267
  $to = array();
@@ -274,9 +274,9 @@ class FooterCredits {
274
  return $content;
275
  }
276
 
277
- static function custom_footer() {
278
  if ( is_active_sidebar( self::SIDEBAR_ID) ) {
279
- if (self::get_option('enable_html5')) {
280
  echo '<footer class="custom-footer" role="contentinfo" itemscope="" itemtype="http://schema.org/WPFooter">';
281
  dynamic_sidebar( self::SIDEBAR_ID );
282
  echo '</footer><!-- end .custom-footer -->';
@@ -288,13 +288,13 @@ class FooterCredits {
288
  }
289
  }
290
 
291
- static function no_footer($content) { return ''; }
292
 
293
- static function is_terms_key($key) {
294
  return array_key_exists($key, self::$defaults['terms']);
295
  }
296
 
297
- static function theme_specific_defaults() {
298
  switch (basename( TEMPLATEPATH ) ) {
299
  case 'twentyten':
300
  self::$defaults['footer_hook'] = 'twentyten_credits'; break;
@@ -304,12 +304,13 @@ class FooterCredits {
304
  self::$defaults['footer_hook'] = 'twentytwelve_credits'; break;
305
  case 'twentythirteen':
306
  self::$defaults['footer_hook'] = 'twentythirteen_credits'; break;
 
 
307
  case 'delicate':
308
  self::$defaults['footer_hook'] = 'get_footer'; break;
309
  case 'genesis':
310
  self::$defaults['footer_hook'] = 'genesis_footer';
311
  self::$defaults['footer_filter_hook'] = 'genesis_footer_output';
312
- self::$defaults['enable_html5'] = function_exists('genesis_html5') && genesis_html5();
313
  break;
314
  case 'graphene':
315
  self::$defaults['footer_hook'] = 'graphene_footer'; break;
@@ -322,7 +323,7 @@ class FooterCredits {
322
  }
323
  }
324
 
325
- static function add_privacy_footer($content) {
326
  $email = self::get_term('email');
327
  $address = self::get_term('address');
328
  $country = self::get_term('country');
@@ -334,7 +335,7 @@ PRIVACY;
334
  return (strpos($content,'%%') == FALSE) ? ($content . $contact) : $content;
335
  }
336
 
337
- static function add_terms_footer($content) {
338
  $email = self::get_term('email');
339
  $address = self::get_term('address');
340
  $country = self::get_term('country');
@@ -361,12 +362,85 @@ TERMS;
361
  return $content ;
362
  }
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  }
365
 
366
  class Footer_Putter_Copyright_Widget extends WP_Widget {
367
 
368
  const DOMAIN = 'FooterCredits';
369
 
 
 
 
 
 
370
  function __construct() {
371
  $widget_ops = array( 'description' => __( "A widget displaying menu links, copyright and company details" ) );
372
  parent::__construct('footer_copyright', __('Footer Copyright Widget'), $widget_ops);
@@ -374,10 +448,10 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
374
 
375
  function widget( $args, $instance ) {
376
  extract( $args );
377
- $footer_args=array();
378
- echo $before_widget;
379
- echo FooterCredits::footer($instance);
380
- echo $after_widget;
381
  }
382
 
383
  function update( $new_instance, $old_instance ) {
@@ -392,63 +466,47 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
392
  $instance['show_return'] = !empty($new_instance['show_return']) ? 1 : 0;
393
  $instance['return_class'] = trim($new_instance['return_class']);
394
  $instance['footer_class'] = trim($new_instance['footer_class']);
 
395
  return $instance;
396
  }
397
 
398
  function form( $instance ) {
399
- $menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
400
- if ( !$menus ) {
401
- echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.', self::DOMAIN ), admin_url('nav-menus.php') ) .'</p>';
402
  return;
403
  }
404
- $instance = wp_parse_args( (array) $instance,
405
- array( 'nav_menu' => 0, 'center' => true, 'two_lines' => true, 'show_copyright' => true, 'show_address' => true, 'show_telephone' => true, 'show_return' => true ) );
406
- $nav_menu = isset( $instance['nav_menu'] ) ? (int) $instance['nav_menu'] : 0;
407
- $center = isset( $instance['center'] ) ? (bool) $instance['center'] : false;
408
- $two_lines = isset( $instance['two_lines'] ) ? (bool) $instance['two_lines'] : false;
409
- $show_copyright = isset( $instance['show_copyright'] ) ? (bool) $instance['show_copyright'] : false;
410
- $show_address = isset( $instance['show_address'] ) ? (bool) $instance['show_address'] : false;
411
- $show_email = isset( $instance['show_email'] ) ? (bool) $instance['show_email'] : false;
412
- $show_telephone = isset( $instance['show_telephone'] ) ? (bool) $instance['show_telephone'] : false;
413
- $show_return = isset( $instance['show_return'] ) ? (bool) $instance['show_return'] : false;
414
- $return_class = isset( $instance['return_class'] ) ? $instance['return_class'] : '';
415
- $footer_class = isset( $instance['footer_class'] ) ? $instance['footer_class'] : '';
416
- ?>
417
- <p>
418
- <label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Footer Menu:', self::DOMAIN ); ?></label>
419
- <select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
420
- <?php
421
- $selected = empty($nav_menu) ? ' selected="selected"' : '';
422
- echo ('<option'.$selected.' value="0">Do not show a menu</option>');
423
- foreach ( $menus as $menu ) {
424
- $selected = $nav_menu == $menu->term_id ? ' selected="selected"' : '';
425
- echo '<option'. $selected .' value="'. $menu->term_id .'">'. $menu->name .'</option>';
426
- }
427
- ?>
428
- </select>
429
- </p>
430
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('center', self::DOMAIN ); ?>" name="<?php echo $this->get_field_name('center'); ?>"<?php checked( $center ); ?> />
431
- <label for="<?php echo $this->get_field_id('center'); ?>"><?php _e( 'Center Menu',self::DOMAIN ); ?></label><br/>
432
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('two_lines', self::DOMAIN ); ?>" name="<?php echo $this->get_field_name('two_lines'); ?>"<?php checked( $two_lines ); ?> />
433
- <label for="<?php echo $this->get_field_id('two_lines'); ?>"><?php _e( 'Spread Over Two Lines',self::DOMAIN ); ?></label><br/>
434
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_copyright', self::DOMAIN ); ?>" name="<?php echo $this->get_field_name('show_copyright'); ?>"<?php checked( $show_copyright ); ?> />
435
- <label for="<?php echo $this->get_field_id('show_copyright'); ?>"><?php _e( 'Show Copyright' ); ?></label><br />
436
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_address', self::DOMAIN ); ?>" name="<?php echo $this->get_field_name('show_address'); ?>"<?php checked( $show_address ); ?> />
437
- <label for="<?php echo $this->get_field_id('show_address'); ?>"><?php _e( 'Show Address', self::DOMAIN ); ?></label><br />
438
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_telephone', self::DOMAIN ); ?>" name="<?php echo $this->get_field_name('show_telephone'); ?>"<?php checked( $show_telephone ); ?> />
439
- <label for="<?php echo $this->get_field_id('show_telephone'); ?>"><?php _e( 'Show Telephone number', self::DOMAIN ); ?></label><br />
440
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_email', self::DOMAIN ); ?>" name="<?php echo $this->get_field_name('show_email'); ?>"<?php checked( $show_email ); ?> />
441
- <label for="<?php echo $this->get_field_id('show_email'); ?>"><?php _e( 'Show Email Address', self::DOMAIN ); ?></label><br />
442
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_return', self::DOMAIN ); ?>" name="<?php echo $this->get_field_name('show_return'); ?>"<?php checked( $show_return ); ?> />
443
- <label for="<?php echo $this->get_field_id('show_return'); ?>"><?php _e( 'Show Return To Top Link' ); ?></label><br />
444
- <h4>Custom Classes (Optional)</h4>
445
- <p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
446
- <p>For your convenience we have defined 3 classes <i>dark</i>, <i>light</i> and <i>white</i> but feel free
447
- to define and use your own custom CSS classes.</p>
448
- <label for="<?php echo $this->get_field_id('return_class'); ?>"><?php _e( 'Return To Top:', self::DOMAIN ); ?></label>
449
- <input id="<?php echo $this->get_field_id('return_class'); ?>" name="<?php echo $this->get_field_name('return_class'); ?>" type="text" value="<?php echo $return_class; ?>" size="10" /><br/>
450
- <label for="<?php echo $this->get_field_id('footer_class'); ?>"><?php _e( 'Footer Credits:', self::DOMAIN ); ?></label>
451
- <input id="<?php echo $this->get_field_id('footer_class'); ?>" name="<?php echo $this->get_field_name('footer_class'); ?>" type="text" value="<?php echo $footer_class; ?>" size="10" />
452
- <?php
453
  }
 
454
  }
1
  <?php
2
  class FooterCredits {
 
 
3
  const CODE = 'footer-credits'; //element prefix
4
  const OPTIONS_NAME = 'footer_credits_options';
5
  const SIDEBAR_ID = 'last-footer';
6
+ const VERSION = '1.7';
7
  private static $version;
8
+
9
+ protected static $is_html5 = false;
10
+ protected static $is_landing = false;
11
+ protected static $options = array();
12
+ protected static $defaults = array(
13
  'terms' => array(
14
  'site' => '',
15
  'owner' => '',
38
  'footer_hook' => '',
39
  'footer_remove' => true,
40
  'footer_filter_hook' => '',
41
+ 'visibility' => ''
42
  );
43
+
44
  private static function get_version(){
45
  return self::$version;
46
  }
47
 
48
+ public static function init() {
49
  self::$version = self::VERSION;
50
+ self::$is_html5 = function_exists('current_theme_supports') && current_theme_supports('html5');
51
  self::theme_specific_defaults();
52
+ add_action('widgets_init',array(__CLASS__,'register'),20);
53
+ add_filter( 'wp_nav_menu_items', array(__CLASS__, 'fix_home_link'), 10, 2 );
54
+ if (!is_admin()) add_action('wp',array(__CLASS__,'prepare'));
55
  }
56
 
57
+ public static function register() {
58
  self::register_sidebars();
59
  self::register_widgets();
60
  }
61
 
62
+ public static function prepare() {
63
+ add_shortcode(self::CODE.'-copyright', array(__CLASS__, 'copyright_owner' ) );
64
+ add_shortcode(self::CODE.'-menu', array(__CLASS__, 'footer_menu' ) );
65
+ add_shortcode(self::CODE, array(__CLASS__, 'footer' ) );
66
+ add_filter('widget_text', 'do_shortcode', 11);
67
+ add_action('wp_enqueue_scripts',array(__CLASS__, 'enqueue_styles' ));
68
 
69
+ self::$is_landing = is_page_template('page_landing.php');
 
 
70
 
71
+ //insert custom footer at specified hook
72
+ if ($footer_hook = self::get_option('footer_hook')) {
73
+ if (self::get_option('footer_remove')) remove_all_actions( $footer_hook);
74
+ add_action( $footer_hook, array(__CLASS__, 'custom_footer'));
75
+ }
76
 
77
+ //suppress footer output
78
+ if ($ffs = self::get_option('footer_filter_hook'))
79
+ add_filter($ffs, array(__CLASS__, 'no_footer'),100);
80
 
81
+ if (is_page('privacy') && self::get_term('privacy_contact'))
82
+ add_filter('the_content', array(__CLASS__, 'add_privacy_footer'),9 );
83
 
84
+ if (is_page('terms') && self::get_term('terms_contact'))
85
+ add_filter('the_content', array(__CLASS__, 'add_terms_footer'),9 );
86
 
87
+ if (is_page('terms') || is_page('privacy') || is_page('affiliates') || is_page('disclaimer'))
88
+ add_filter('the_content', array(__CLASS__, 'terms_filter') );
89
+
90
  }
91
+
92
+ private static function register_sidebars() {
93
  if (self::get_option('footer_hook')) {
94
+ $tag = self::$is_html5 ? 'section' : 'div';
95
  register_sidebar( array(
96
  'id' => self::SIDEBAR_ID,
97
+ 'name' => __( 'Credibility Footer', __CLASS__ ),
98
+ 'description' => __( 'Custom footer section for copyright, trademarks, etc', __CLASS__),
99
  'before_widget' => '<'.$tag.' id="%1$s" class="widget %2$s"><div class="widget-wrap">',
100
  'after_widget' => '</div></'.$tag.'>'
101
  ) );
102
  }
103
  }
104
 
105
+ private static function register_widgets() {
106
  register_widget( 'Footer_Putter_Copyright_Widget' );
107
  register_widget( 'Footer_Putter_TradeMark_Widget' );
108
  }
109
 
110
+ public static function enqueue_styles() {
111
+ wp_enqueue_style(__CLASS__, plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(), self::get_version());
 
112
  }
113
 
114
+ public static function fix_home_link( $content, $args) {
115
  $class = is_front_page()? ' class="current_page_item"' : '';
116
  $home_linktexts = array('Home','<span>Home</span>');
117
  foreach ($home_linktexts as $home_linktext) {
122
  return $content;
123
  }
124
 
125
+ private static function sanitize_terms($new_terms) {
126
  $new_terms = wp_parse_args($new_terms, self::$defaults['terms']); //ensure terms are complete
127
  $new_terms['site'] = self::get_default_site();
128
  $new_terms['copyright'] = self::get_copyright($new_terms['copyright_start_year']); //generate copyright
129
  return $new_terms;
130
  }
131
 
132
+ public static function save($new_options) {
133
  $options = self::get_options(false);
134
  $new_options = wp_parse_args( $new_options, $options);
135
  $new_options['terms'] = self::sanitize_terms($new_options['terms']);
138
  return $updated;
139
  }
140
 
141
+ public static function get_options ($cache = true) {
142
  if ($cache && (count(self::$options) > 0)) return self::$options;
143
 
144
  $the_options = array();
151
  return self::$options;
152
  }
153
 
154
+ public static function get_option($option_name) {
155
  $options = self::get_options();
156
  if ($option_name && $options && array_key_exists($option_name,$options))
157
  return $options[$option_name];
159
  return false;
160
  }
161
 
162
+ private static function get_terms() {
163
  return self::get_option('terms');
164
  }
165
 
166
+ private static function get_term($term_name) {
167
  $options = self::get_options();
168
  $terms = is_array($options) && array_key_exists('terms',$options) ? $options['terms'] : false;
169
  if ($term_name && $terms && array_key_exists($term_name,$terms) && $terms[$term_name])
172
  return self::get_default_term($term_name);
173
  }
174
 
175
+ private static function get_default_term($key) {
176
  $default='';
177
  switch ($key) {
178
  case 'owner' : $default = self::get_term('site'); break;
188
  return $default;
189
  }
190
 
191
+ private static function get_default_site() {
192
  $domain = strtolower(parse_url(site_url(),PHP_URL_HOST));
193
  $p = strpos($domain,'www.') ;
194
  if (($p !== FALSE) && ($p == 0)) $domain = substr($domain,4);
195
  return $domain;
196
  }
197
 
198
+ public static function get_copyright($startyear){
199
  $thisyear = date("Y");
200
  if(empty( $startyear)) $startyear = $thisyear;
201
  return sprintf('Copyright &copy; %1$s%2$s', $startyear, $thisyear == $startyear ? '' : ("-".$thisyear));
202
  }
203
 
204
+ public static function copyright_owner($attr){
205
  $defaults['owner'] = self::get_term('owner');
206
  $defaults['copyright_start_year'] = self::get_term('copyright_start_year');
207
  $params = shortcode_atts( $defaults, $attr ); //apply plugin defaults
209
  self::get_copyright($params['copyright_start_year']), $params['owner']);
210
  }
211
 
212
+ private static function format_address ($address, $separator) {
213
  $s='';
214
  $addlines = explode(',', trim($address));
215
  foreach ($addlines as $a) {
219
  return $s;
220
  }
221
 
222
+ public static function footer_menu($menu) {
223
  return wp_nav_menu(array('menu' => $menu, 'echo' => false, 'container' => false));
224
  }
225
 
226
+ public static function return_to_top( $text, $class) {
227
+ return sprintf( '<div id="footer-return" class="%1$s"><a rel="nofollow" href="#" onclick="window.scrollTo(0,0); return false;" >%2$s</a></div>', trim($class), $text);
228
  }
229
 
230
+ public static function footer($atts = array()) {
 
231
  $params = shortcode_atts( self::get_options(), $atts ); //apply plugin defaults
232
+
233
  if ($params['center']) {
234
  $section_separator = '&nbsp;';
235
  $item_separator = $params['two_lines'] ? '<br/>' : $params['separator'];
256
  (empty($params['show_copyright']) ? '' : sprintf('%1$s%2$s', $section_separator, $copyright)),
257
  ((empty($address) || empty($params['show_address'])) ? '' : sprintf('%1$s<span class="address">%2$s%3$s</span>', $item_separator, self::format_address($address, $params['separator']), self::get_term('country')) ),
258
  ((empty($telephone) || empty($params['show_telephone'])) ? '' : sprintf('%1$s<span class="telephone">%2$s</span>', $section_separator, $telephone) ),
259
+ ((empty($email) || empty($params['show_email'])) ? '' : sprintf('%1$s<span class="email"><a href="mailto:%2$s">%2$s</a></span>', $section_separator, $email) ),
260
  $clear
261
  );
262
  }
263
 
264
+ public static function terms_filter($content) {
265
  if ($terms = self::get_terms()) {
266
  $from = array();
267
  $to = array();
274
  return $content;
275
  }
276
 
277
+ public static function custom_footer() {
278
  if ( is_active_sidebar( self::SIDEBAR_ID) ) {
279
+ if (self::$is_html5) {
280
  echo '<footer class="custom-footer" role="contentinfo" itemscope="" itemtype="http://schema.org/WPFooter">';
281
  dynamic_sidebar( self::SIDEBAR_ID );
282
  echo '</footer><!-- end .custom-footer -->';
288
  }
289
  }
290
 
291
+ public static function no_footer($content) { return ''; }
292
 
293
+ public static function is_terms_key($key) {
294
  return array_key_exists($key, self::$defaults['terms']);
295
  }
296
 
297
+ private static function theme_specific_defaults() {
298
  switch (basename( TEMPLATEPATH ) ) {
299
  case 'twentyten':
300
  self::$defaults['footer_hook'] = 'twentyten_credits'; break;
304
  self::$defaults['footer_hook'] = 'twentytwelve_credits'; break;
305
  case 'twentythirteen':
306
  self::$defaults['footer_hook'] = 'twentythirteen_credits'; break;
307
+ case 'twentyfourteen':
308
+ self::$defaults['footer_hook'] = 'twentyfourteen_credits'; break;
309
  case 'delicate':
310
  self::$defaults['footer_hook'] = 'get_footer'; break;
311
  case 'genesis':
312
  self::$defaults['footer_hook'] = 'genesis_footer';
313
  self::$defaults['footer_filter_hook'] = 'genesis_footer_output';
 
314
  break;
315
  case 'graphene':
316
  self::$defaults['footer_hook'] = 'graphene_footer'; break;
323
  }
324
  }
325
 
326
+ public static function add_privacy_footer($content) {
327
  $email = self::get_term('email');
328
  $address = self::get_term('address');
329
  $country = self::get_term('country');
335
  return (strpos($content,'%%') == FALSE) ? ($content . $contact) : $content;
336
  }
337
 
338
+ public static function add_terms_footer($content) {
339
  $email = self::get_term('email');
340
  $address = self::get_term('address');
341
  $country = self::get_term('country');
362
  return $content ;
363
  }
364
 
365
+ public static function hide_widget($instance) {
366
+ $hide = false;
367
+ if (array_key_exists('visibility',$instance))
368
+ switch ($instance['visibility']) {
369
+ case 'hide_landing' : $hide = self::$is_landing; break; //hide only on landing pages
370
+ case 'show_landing' : $hide = ! self::$is_landing; break; //hide except on landing pages
371
+ }
372
+ return $hide;
373
+ }
374
+
375
+ public static function get_visibility_options(){
376
+ return array(
377
+ '' => 'Show on all pages',
378
+ 'hide_landing' => 'Hide on landing pages',
379
+ 'show_landing' => 'Show only on landing pages');
380
+ }
381
+
382
+ public static function form_field($fld_id, $fld_name, $label, $value, $type, $options = array(), $args = array()) {
383
+ if ($args) extract($args);
384
+ $input = '';
385
+ $label = sprintf('<label for="%1$s">%2$s</label>', $fld_id, __($label));
386
+ switch ($type) {
387
+ case 'text':
388
+ $input .= sprintf('<input type="text" id="%1$s" name="%2$s" value="%3$s" %4$s %5$s %6$s/> %7$s',
389
+ $fld_id, $fld_name, $value,
390
+ isset($size) ? ('size="'.$size.'"') : '', isset($maxlength) ? ('maxlength="'.$maxlength.'"') : '',
391
+ isset($class) ? ('class="'.$class.'"') : '', isset($suffix) ? $suffix : '');
392
+ return sprintf('<p>%1$s: %2$s</p>', $label, $input);
393
+ break;
394
+ case 'textarea':
395
+ $input .= sprintf('<textarea id="%1$s" name="%2$s"%3$s%4$s%5$s>%6$s</textarea>',
396
+ $fld_id, $fld_name,
397
+ isset($rows) ? (' rows="'.$rows.'"') : '', isset($cols) ? (' cols="'.$cols.'"') : '',
398
+ isset($class) ? (' class="'.$class.'"') : '', $value);
399
+ return sprintf('<p>%1$s: %2$s</p>', $label, $input);
400
+ break;
401
+ case 'checkbox':
402
+ $input .= sprintf('<input type="checkbox" class="checkbox" id="%1$s" name="%2$s" %3$svalue="1"/>',
403
+ $fld_id, $fld_name, checked($value, '1', false));
404
+ return sprintf('%1$s%2$s<br/>', $input, $label);
405
+ break;
406
+ case 'radio':
407
+ $sep = (is_array($args) && array_key_exists('separator', $args)) ? $args['separator'] : '&nbsp;&nbsp;';
408
+ if (is_array($options))
409
+ foreach ($options as $optkey => $optlabel)
410
+ $input .= sprintf('<input type="radio" id="%1$s" name="%2$s" %3$s value="%4$s" />&nbsp;%5$s%6$s',
411
+ $fld_id, $fld_name, checked($optkey, $value, false), $optkey, $optlabel, $sep);
412
+ return sprintf('<p>%1$s%2$s</p>', $label, $input);
413
+ break;
414
+ case 'select':
415
+ if (is_array($options))
416
+ foreach ($options as $optkey => $optlabel)
417
+ $input .= sprintf('<option%1$s value="%2$s">%3$s</option>',
418
+ selected($optkey, $value, false), $optkey, $optlabel);
419
+ return sprintf('<p>%1$s: %2$s</p>', $label, self::selector($fld_id, $fld_name, $value, $options));
420
+ break;
421
+ }
422
+ }
423
+
424
+ private static function selector($fld_id, $fld_name, $value, $options) {
425
+ $input = '';
426
+ if (is_array($options))
427
+ foreach ($options as $optkey => $optlabel)
428
+ $input .= sprintf('<option%1$s value="%2$s">%3$s</option>',
429
+ selected($optkey, $value, false), $optkey, $optlabel);
430
+ return sprintf('<select id="%1$s" name="%2$s">%3$s</select>', $fld_id, $fld_name, $input);
431
+ }
432
+
433
  }
434
 
435
  class Footer_Putter_Copyright_Widget extends WP_Widget {
436
 
437
  const DOMAIN = 'FooterCredits';
438
 
439
+ private $defaults = array(
440
+ 'nav_menu' => 0, 'center' => true, 'two_lines' => true,
441
+ 'show_copyright' => true, 'show_address' => true, 'show_telephone' => true, 'show_email' => false,
442
+ 'show_return' => true, 'return_class' => '', 'footer_class' => '', 'visibility' => '');
443
+
444
  function __construct() {
445
  $widget_ops = array( 'description' => __( "A widget displaying menu links, copyright and company details" ) );
446
  parent::__construct('footer_copyright', __('Footer Copyright Widget'), $widget_ops);
448
 
449
  function widget( $args, $instance ) {
450
  extract( $args );
451
+ if (FooterCredits::hide_widget($instance)) return; //check visibility requirements
452
+
453
+ if ($footer = FooterCredits::footer($instance))
454
+ printf ('%1$s%2$s%3$s', $before_widget, $footer, $after_widget);
455
  }
456
 
457
  function update( $new_instance, $old_instance ) {
466
  $instance['show_return'] = !empty($new_instance['show_return']) ? 1 : 0;
467
  $instance['return_class'] = trim($new_instance['return_class']);
468
  $instance['footer_class'] = trim($new_instance['footer_class']);
469
+ $instance['visibility'] = trim($new_instance['visibility']);
470
  return $instance;
471
  }
472
 
473
  function form( $instance ) {
474
+ $menu_terms = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
475
+ if ( !$menu_terms ) {
476
+ echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.', GENESIS_CLUB_DOMAIN ), admin_url('nav-menus.php') ) .'</p>';
477
  return;
478
  }
479
+ $menus = array();
480
+ $menus[0] = 'Do not show a menu';
481
+ foreach ( $menu_terms as $term ) $menus[ $term->term_id ] = $term->name;
482
+
483
+ $instance = wp_parse_args( (array) $instance, $this->defaults);
484
+ $this->print_form_field($instance, 'nav_menu', 'Select Footer Menu', 'select', $menus);
485
+ $this->print_form_field($instance, 'center', 'Center Menu', 'checkbox');
486
+ $this->print_form_field($instance, 'two_lines', 'Spread Over Two Lines', 'checkbox');
487
+ $this->print_form_field($instance, 'show_copyright', 'Show Copyright', 'checkbox');
488
+ $this->print_form_field($instance, 'show_address', 'Show Address', 'checkbox');
489
+ $this->print_form_field($instance, 'show_telephone', 'Show Telephone number', 'checkbox');
490
+ $this->print_form_field($instance, 'show_email', 'Show Email Address', 'checkbox');
491
+ $this->print_form_field($instance, 'show_return', 'Show Return To Top Links', 'checkbox');
492
+
493
+ print <<< CUSTOM_CLASSES
494
+ <h4>Custom Classes (Optional)</h4>
495
+ <p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
496
+ <p>For your convenience we have defined 3 color classes <i>dark</i>, <i>light</i> and <i>white</i>, and 2 size classes,
497
+ <i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes.</p>
498
+ CUSTOM_CLASSES;
499
+
500
+ $this->print_form_field($instance, 'return_class', 'Return To Top', 'text', array(), array('size' => 10));
501
+ $this->print_form_field($instance, 'footer_class', 'Footer Credits', 'text', array(), array('size' => 10));
502
+ $this->print_form_field($instance, 'visibility', '<h4>Widget Visibility</h4>', 'radio',
503
+ FooterCredits::get_visibility_options(), array('separator' => '<br/>'));
504
+ }
505
+
506
+ function print_form_field($instance, $fld, $label, $type, $options = array(), $args = array()) {
507
+ $value = array_key_exists($fld,$instance) ? $instance[$fld] : false;
508
+ print FooterCredits::form_field(
509
+ $this->get_field_id($fld), $this->get_field_name($fld), $label, $value, $type, $options, $args);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  }
511
+
512
  }
classes/footer-trademarks-admin.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  class FooterTrademarksAdmin {
3
- const CLASSNAME = 'FooterTrademarksAdmin'; //this class
4
  const CODE = 'footer-putter'; //prefix ID of CSS elements
5
- const DOMAIN = 'FooterPutter'; //text domain for translation
6
  const SLUG = 'trademarks';
7
  const FIELDNAME = 'not_on_404';
8
 
@@ -16,7 +14,7 @@ class FooterTrademarksAdmin {
16
  self::$parenthook = $parent;
17
  self::$slug = self::$parenthook . '-' . self::SLUG;
18
  self::$screen_id = self::$parenthook.'_page_' . self::$slug;
19
- add_action('admin_menu',array(self::CLASSNAME, 'admin_menu'));
20
  }
21
 
22
  private static function get_version(){
@@ -44,12 +42,12 @@ class FooterTrademarksAdmin {
44
 
45
  public static function admin_menu() {
46
  add_submenu_page(self::get_parenthook(), __('Trademarks'), __('Trademarks'), 'manage_options',
47
- self::get_slug(), array(self::CLASSNAME,'settings_panel'));
48
- add_action('load-'.self::get_screen_id(), array(self::CLASSNAME, 'load_page'));
49
  }
50
 
51
  public static function load_page() {
52
- add_action ('admin_enqueue_scripts',array(self::CLASSNAME, 'enqueue_styles'));
53
  }
54
 
55
  public static function enqueue_styles() {
@@ -58,7 +56,7 @@ class FooterTrademarksAdmin {
58
 
59
  public static function settings_panel() {
60
  $this_url = $_SERVER['REQUEST_URI'];
61
- $title = sprintf('<h2>%1$s</h2>', __('Footer Trademarks', self::DOMAIN));
62
  $screenshot2 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
63
  $screenshot3 = plugins_url('images/add-link.jpg',dirname(__FILE__));
64
  $linkcat = admin_url('edit-tags.php?taxonomy=link_category');
@@ -83,7 +81,7 @@ area and select <i>Trademarks</i> as the link category.</p>
83
  <p><img src="<?php echo $screenshot3;?>" alt="Screenshot of adding a trademark link " /></p>
84
  <form id="misc_options" method="post" action="<?php echo $this_url; ?>">
85
  <p>
86
- <?php wp_nonce_field(self::CLASSNAME); ?>
87
  <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
88
  <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
89
  </p>
1
  <?php
2
  class FooterTrademarksAdmin {
 
3
  const CODE = 'footer-putter'; //prefix ID of CSS elements
 
4
  const SLUG = 'trademarks';
5
  const FIELDNAME = 'not_on_404';
6
 
14
  self::$parenthook = $parent;
15
  self::$slug = self::$parenthook . '-' . self::SLUG;
16
  self::$screen_id = self::$parenthook.'_page_' . self::$slug;
17
+ add_action('admin_menu',array(__CLASS__, 'admin_menu'));
18
  }
19
 
20
  private static function get_version(){
42
 
43
  public static function admin_menu() {
44
  add_submenu_page(self::get_parenthook(), __('Trademarks'), __('Trademarks'), 'manage_options',
45
+ self::get_slug(), array(__CLASS__,'settings_panel'));
46
+ add_action('load-'.self::get_screen_id(), array(__CLASS__, 'load_page'));
47
  }
48
 
49
  public static function load_page() {
50
+ add_action ('admin_enqueue_scripts',array(__CLASS__, 'enqueue_styles'));
51
  }
52
 
53
  public static function enqueue_styles() {
56
 
57
  public static function settings_panel() {
58
  $this_url = $_SERVER['REQUEST_URI'];
59
+ $title = sprintf('<h2>%1$s</h2>', __('Footer Trademarks'));
60
  $screenshot2 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
61
  $screenshot3 = plugins_url('images/add-link.jpg',dirname(__FILE__));
62
  $linkcat = admin_url('edit-tags.php?taxonomy=link_category');
81
  <p><img src="<?php echo $screenshot3;?>" alt="Screenshot of adding a trademark link " /></p>
82
  <form id="misc_options" method="post" action="<?php echo $this_url; ?>">
83
  <p>
84
+ <?php wp_nonce_field(__CLASS__); ?>
85
  <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
86
  <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
87
  </p>
classes/footer-trademarks.php CHANGED
@@ -1,19 +1,22 @@
1
  <?php
2
  class Footer_Putter_TradeMark_Widget extends WP_Widget {
3
- const DOMAIN = 'FooterPutter';
 
 
4
 
5
  function __construct() {
6
- $widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks', self::DOMAIN) );
7
- parent::__construct('footer_trademarks', __('TradeMarks Widget', self::DOMAIN), $widget_ops);
8
  }
9
 
10
  function widget( $args, $instance ) {
11
  extract($args, EXTR_SKIP);
 
12
 
13
  $category = isset($instance['category']) ? $instance['category'] : false;
14
  $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
15
  $order = $orderby == 'rating' ? 'DESC' : 'ASC';
16
- $limit = isset( $instance['limit'] ) ? $instance['limit'] : -1;
17
 
18
  $links = wp_list_bookmarks(apply_filters('widget_links_args', array(
19
  'echo' => 0,
@@ -38,40 +41,35 @@ class Footer_Putter_TradeMark_Widget extends WP_Widget {
38
  $instance['orderby'] = 'name';
39
  if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
40
  $instance['orderby'] = $new_instance['orderby'];
41
-
42
  $instance['category'] = intval( $new_instance['category'] );
43
- $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;
44
-
45
  return $instance;
46
  }
47
 
48
  function form( $instance ) {
49
- $instance = wp_parse_args( (array) $instance, array( 'category' => false, 'orderby' => 'name', 'limit' => -1 ) );
 
50
  $link_cats = get_terms( 'link_category' );
51
- if ( ! $limit = intval( $instance['limit'] ) ) { $limit = -1; } ?>
52
- <p>
53
- <label for="<?php echo $this->get_field_id('category'); ?>"><?php _e( 'Select Link Category for Your Trademarks:', self::DOMAIN ); ?></label>
54
- <select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>">
55
- <?php
56
  foreach ( $link_cats as $link_cat ) {
57
- echo '<option value="' . intval($link_cat->term_id) . '"'
58
- . ( $link_cat->term_id == $instance['category'] ? ' selected="selected"' : '' )
59
- . '>' . $link_cat->name . "</option>\n";
60
  }
61
- ?>
62
- </select>
63
- <label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e( 'Sort by:', self::DOMAIN ); ?></label>
64
- <select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
65
- <option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php _e( 'Link title', self::DOMAIN); ?></option>
66
- <option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php _e( 'Link rating', self::DOMAIN ); ?></option>
67
- <option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php _e( 'Link ID', self::DOMAIN ); ?></option>
68
- <option value="rand"<?php selected( $instance['orderby'], 'rand' ); ?>><?php _e( 'Random', self::DOMAIN ); ?></option>
69
- </select>
70
- </p>
71
- <p>
72
- <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e( 'Number of links to show:', self::DOMAIN ); ?></label>
73
- <input id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" />
74
- </p>
75
- <?php
 
76
  }
77
  }
1
  <?php
2
  class Footer_Putter_TradeMark_Widget extends WP_Widget {
3
+
4
+ private $defaults = array(
5
+ 'category' => false, 'orderby' => 'name', 'limit' => '', 'visibility' => '');
6
 
7
  function __construct() {
8
+ $widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks', GENESIS_CLUB_DOMAIN) );
9
+ parent::__construct('footer_trademarks', __('TradeMarks Widget', GENESIS_CLUB_DOMAIN), $widget_ops);
10
  }
11
 
12
  function widget( $args, $instance ) {
13
  extract($args, EXTR_SKIP);
14
+ if (FooterCredits::hide_widget($instance)) return; //check visibility requirements
15
 
16
  $category = isset($instance['category']) ? $instance['category'] : false;
17
  $orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
18
  $order = $orderby == 'rating' ? 'DESC' : 'ASC';
19
+ $limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
20
 
21
  $links = wp_list_bookmarks(apply_filters('widget_links_args', array(
22
  'echo' => 0,
41
  $instance['orderby'] = 'name';
42
  if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
43
  $instance['orderby'] = $new_instance['orderby'];
 
44
  $instance['category'] = intval( $new_instance['category'] );
45
+ $instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : '';
46
+ $instance['visibility'] = trim($new_instance['visibility']);
47
  return $instance;
48
  }
49
 
50
  function form( $instance ) {
51
+ $instance = wp_parse_args( (array) $instance, $this->defaults );
52
+ $links = array();
53
  $link_cats = get_terms( 'link_category' );
 
 
 
 
 
54
  foreach ( $link_cats as $link_cat ) {
55
+ $id = intval($link_cat->term_id);
56
+ $links[$id] = $link_cat->name;
 
57
  }
58
+ $this->print_form_field($instance, 'category', 'Select Link Category for Your Trademarks', 'select', $links);
59
+ $this->print_form_field($instance, 'orderby', 'Sort by', 'select', array(
60
+ 'name' => __( 'Link title', GENESIS_CLUB_DOMAIN),
61
+ 'rating' => __( 'Link rating', GENESIS_CLUB_DOMAIN),
62
+ 'id' => __( 'Link ID', GENESIS_CLUB_DOMAIN),
63
+ 'rand' => __( 'Random', GENESIS_CLUB_DOMAIN)
64
+ ));
65
+ $this->print_form_field($instance, 'limit', 'Number of links to show', 'text', array(), array('size' => 3 ,'maxlength' => 3));
66
+ $this->print_form_field($instance, 'visibility', '<h4>Widget Visibility</h4>', 'radio',
67
+ FooterCredits::get_visibility_options(), array('separator' => '<br/>'));
68
+ }
69
+
70
+ function print_form_field($instance, $fld, $label, $type, $options = array(), $args = array()) {
71
+ $value = array_key_exists($fld,$instance) ? $instance[$fld] : false;
72
+ print FooterCredits::form_field(
73
+ $this->get_field_id($fld), $this->get_field_name($fld), $label, $value, $type, $options, $args);
74
  }
75
  }
classes/plugin.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $dir = dirname(__FILE__) . '/';
3
+ require_once($dir . 'footer-credits.php');
4
+ require_once($dir . 'footer-trademarks.php');
5
+ if (is_admin()) {
6
+ require_once($dir . 'tooltip.php');
7
+ require_once($dir . 'admin.php');
8
+ require_once($dir . 'footer-credits-admin.php');
9
+ require_once($dir . 'footer-trademarks-admin.php');
10
+ }
11
+
12
+ class FooterCreditsPlugin {
13
+
14
+ public static function init() {
15
+ FooterCredits::init();
16
+ if (is_admin()) {
17
+ FooterPutterAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
18
+ FooterCreditsAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
19
+ FooterTrademarksAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
20
+ }
21
+ }
22
+
23
+ }
24
+ ?>
main.php CHANGED
@@ -3,36 +3,16 @@
3
  * Plugin Name: Footer Putter
4
  * Plugin URI: http://www.diywebmastery.com/plugins/footer-putter/
5
  * Description: Put a footer on your site that boosts your credibility with both search engines and human visitors.
6
- * Version: 1.6
7
  * Author: Russell Jamieson
8
  * Author URI: http://www.diywebmastery.com/about/
9
  * License: GPLv2+
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
12
- define('FOOTER_PUTTER_VERSION','1.6');
13
  define('FOOTER_PUTTER_FRIENDLY_NAME', 'Footer Putter') ;
14
  define('FOOTER_PUTTER_PLUGIN_NAME', plugin_basename(dirname(__FILE__))) ;
15
  define('FOOTER_PUTTER_HOME_URL','http://www.diywebmastery.com/plugins/footer-putter/');
16
- $dir = dirname(__FILE__) . '/classes/';
17
- require_once($dir . 'footer-credits.php');
18
- require_once($dir . 'footer-trademarks.php');
19
-
20
- add_action ('init', 'footer_putter_init',0); //run before widget init
21
- if (is_admin()) {
22
- require_once($dir . 'tooltip.php');
23
- require_once($dir . 'admin.php');
24
- require_once($dir . 'footer-credits-admin.php');
25
- require_once($dir . 'footer-trademarks-admin.php');
26
- add_action ('init', 'footer_putter_admin_init',0); //run before widget init
27
- }
28
-
29
- function footer_putter_init() {
30
- FooterCredits::init();
31
- }
32
-
33
- function footer_putter_admin_init() {
34
- FooterPutterAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
35
- FooterCreditsAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
36
- FooterTrademarksAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
37
- }
38
  ?>
3
  * Plugin Name: Footer Putter
4
  * Plugin URI: http://www.diywebmastery.com/plugins/footer-putter/
5
  * Description: Put a footer on your site that boosts your credibility with both search engines and human visitors.
6
+ * Version: 1.7
7
  * Author: Russell Jamieson
8
  * Author URI: http://www.diywebmastery.com/about/
9
  * License: GPLv2+
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
12
+ define('FOOTER_PUTTER_VERSION','1.7');
13
  define('FOOTER_PUTTER_FRIENDLY_NAME', 'Footer Putter') ;
14
  define('FOOTER_PUTTER_PLUGIN_NAME', plugin_basename(dirname(__FILE__))) ;
15
  define('FOOTER_PUTTER_HOME_URL','http://www.diywebmastery.com/plugins/footer-putter/');
16
+ require_once(dirname(__FILE__) . '/classes/plugin.php');
17
+ add_action ('init', array('FooterCreditsPlugin', 'init'),0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: powerblogservice, diywebmastery
3
  Donate link: http://www.diywebmastery.com/donate/
4
  Tags: footer, copyright, trademark
5
  Requires at least: 3.0
6
- Tested up to: 3.7
7
- Stable tag: 1.6
8
  License: GPLv2+
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -18,9 +18,13 @@ Put a footer on your site that boosts your credibility with both search engines
18
  * Include a copyright statement that updates automatically when the year changes - an out of date copyright is a negative signal for Google
19
  * Include a telephone number to prove you are a real business
20
  * Include a postal address to prove you are a real business
 
21
  * Supports both a single line centred footer and a multi-line right aligned footer
22
  * The Footer hook setting allows you to add the footer in just the right place on themes that do not have suitable widget areas
23
- * HTML5 support
 
 
 
24
 
25
  == Installation ==
26
 
@@ -42,6 +46,7 @@ Put a footer on your site that boosts your credibility with both search engines
42
 
43
  == Changelog ==
44
 
 
45
  = 1.6 = Add option to include email address in the copyright footer widget, remove the automatic adding of rel=nofollow in footer links, and add optional sub-footer sections to the privacy and terms pages
46
  = 1.5 = Use Javascript for Return To Top link to make it work on HTML5 sites, and strengthen CSS to ensure footer copyright and trademark widgets are full width
47
  = 1.4.1 = Reinstate support for PHP 5.2
@@ -53,8 +58,8 @@ Put a footer on your site that boosts your credibility with both search engines
53
 
54
  == Upgrade Notice ==
55
 
56
- = 1.6 =
57
- * Optional - Add option to include email address in the copyright footer widget
58
 
59
  == Links ==
60
 
3
  Donate link: http://www.diywebmastery.com/donate/
4
  Tags: footer, copyright, trademark
5
  Requires at least: 3.0
6
+ Tested up to: 3.8
7
+ Stable tag: 1.7
8
  License: GPLv2+
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
18
  * Include a copyright statement that updates automatically when the year changes - an out of date copyright is a negative signal for Google
19
  * Include a telephone number to prove you are a real business
20
  * Include a postal address to prove you are a real business
21
+ * Include a email address to prove you are a real business
22
  * Supports both a single line centred footer and a multi-line right aligned footer
23
  * The Footer hook setting allows you to add the footer in just the right place on themes that do not have suitable widget areas
24
+ * Predefined classes tiny, small, light, dark and white make it easy to change footer size and color if required.
25
+ * Added widget visibility control: show always, don�t show on landing pages, only show on landing pages.
26
+ * Automatic HTML5 support
27
+ * Can append company contact information to Privacy and Terms and Conditions pages.
28
 
29
  == Installation ==
30
 
46
 
47
  == Changelog ==
48
 
49
+ = 1.7 = Made email address a mailto link. Added pre-defined classes, tiny and small, to make it easy to use a smaller font size in the footer on pages such as landing pages. Added widget visibility setting to make it easy to either hide or show the footer widgets on landing pages. Replaced the plugin icon image in admin menu with a dashicons font character. Automatically uses HTML5 if theme supports HTML5 - no manual setting required.
50
  = 1.6 = Add option to include email address in the copyright footer widget, remove the automatic adding of rel=nofollow in footer links, and add optional sub-footer sections to the privacy and terms pages
51
  = 1.5 = Use Javascript for Return To Top link to make it work on HTML5 sites, and strengthen CSS to ensure footer copyright and trademark widgets are full width
52
  = 1.4.1 = Reinstate support for PHP 5.2
58
 
59
  == Upgrade Notice ==
60
 
61
+ = 1.7 =
62
+ * Optional - Additional predefined footer classes and mailto link.
63
 
64
  == Links ==
65
 
styles/admin.css CHANGED
@@ -6,5 +6,6 @@ div.icon32 { background-image : url(../images/icon-32.png); background-repeat: n
6
  #poststuff div#message { margin-left: 10px; display: inline; padding: 10px; }
7
  #poststuff div#message div.updated { margin-left: 30px; padding: 8px; display: inline; }
8
  #poststuff label { display: inline-block; min-width: 150px; margin-right: 10px;}
9
- .trademark { vertical-align: top; border: 1px dashed whitesmoke; }
10
- .trademark:hover { cursor: move; }
 
6
  #poststuff div#message { margin-left: 10px; display: inline; padding: 10px; }
7
  #poststuff div#message div.updated { margin-left: 30px; padding: 8px; display: inline; }
8
  #poststuff label { display: inline-block; min-width: 150px; margin-right: 10px;}
9
+ p.notice { font-size: 1.6em; font-weight: bold; }
10
+ p.important { font-size: 1.2em; color: red; }
11
+ img.dashed-border { padding: 10px; border: 1px dashed silver; max-width: 100%; }
styles/footer-credits.css CHANGED
@@ -1,14 +1,3 @@
1
- .widget_footer_copyright, .widget_footer_trademarks
2
- { margin: 0 !important; padding: 0 !important; width: 100% !important; float:none !important; }
3
- .widget_footer_trademarks { text-align: center; }
4
- .widget_footer_trademarks a { margin: 10px; }
5
- .widget_footer_trademarks img { border: 0 !important; }
6
-
7
- .site-info .custom-footer { margin: 0 !important; border: 0 !important; padding : 0!important; width: 100% !important;}
8
- #footer-credits.dark, #footer-credits.dark a, .dark a , .dark a:visited { color : #222222; }
9
- #footer-credits.light, #footer-credits.light a, .light a, .light a:visited { color : #DDDDDD; }
10
- #footer-credits.white, #footer-credits.white a, .white a, .white a:visited { color : white; }
11
-
12
  #footer .footer-center, #footer .return-center, .footer-center, .return-center { text-align: center; margin: 10px 0px; }
13
  #footer .return-left, .return-left { float: left; width : 20%; }
14
  #footer .footer-right, .footer-right { float: right; text-align: right; width: 70%; margin-bottom: 10px; }
@@ -22,6 +11,21 @@
22
  text-decoration: none; color: inherit; font-weight: normal; letter-spacing : normal; text-transform: none; margin:0 10px; }
23
  #footer #footer-credits ul li a:hover, #footer-credits ul li a:hover {
24
  text-decoration: underline; }
25
- #footer-credits span.copyright, #footer-credits span.telephone, #footer-credits span.address {
 
26
  font-weight: normal; letter-spacing : normal; text-transform: none; margin: 0 10px; vertical-align: middle;
27
- background: inherit; border : none; float: none; display: inline; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  #footer .footer-center, #footer .return-center, .footer-center, .return-center { text-align: center; margin: 10px 0px; }
2
  #footer .return-left, .return-left { float: left; width : 20%; }
3
  #footer .footer-right, .footer-right { float: right; text-align: right; width: 70%; margin-bottom: 10px; }
11
  text-decoration: none; color: inherit; font-weight: normal; letter-spacing : normal; text-transform: none; margin:0 10px; }
12
  #footer #footer-credits ul li a:hover, #footer-credits ul li a:hover {
13
  text-decoration: underline; }
14
+ #footer-credits span.copyright, #footer-credits span.telephone, #footer-credits span.address,
15
+ #footer-credits span.email, #footer-credits span.email a {
16
  font-weight: normal; letter-spacing : normal; text-transform: none; margin: 0 10px; vertical-align: middle;
17
+ background: inherit; border : none; float: none; display: inline; color: inherit; text-decoration: none; }
18
+
19
+ #footer-credits.dark, #footer-credits.dark li, #footer-credits.dark a, #footer-return.dark a , #footer-return.dark a:visited { color : #222222; }
20
+ #footer-credits.light, #footer-credits.light li, #footer-credits.light a, #footer-return.light a, #footer-return.light a:visited { color : #DDDDDD; }
21
+ #footer-credits.white, #footer-credits.white li, #footer-credits.white a, #footer-return.white a, #footer-return.white a:visited { color : white; }
22
+ #footer-credits.small, #footer-credits.small ul li a, #footer-return.small a { font-size : small; }
23
+ #footer-credits.tiny, #footer-credits.tiny ul li a, #footer-return.tiny a { font-size : x-small; }
24
+
25
+ .widget_footer_trademarks { text-align: center; margin: 10px 0;}
26
+ .widget_footer_trademarks a { margin: 10px; }
27
+ .widget_footer_trademarks img { border: 0 !important; }
28
+
29
+ .widget_footer_copyright, .widget_footer_trademarks
30
+ { margin: 0 !important; padding: 0 !important; width: 100% !important; float:none !important; }
31
+ .site-info .custom-footer { margin: 0 !important; border: 0 !important; padding : 0!important; width: 100% !important;}
styles/tooltip.css CHANGED
@@ -18,4 +18,5 @@ text-shadow: 0 1px 0 rgba(255,255,255,.4);
18
  .diytooltip span:before, .diytooltip span:after {
19
  content: ""; position: absolute; z-index: 1000; bottom: -7px; left: 50%;margin-left: 8px;
20
  border-top: 8px solid #ddd;border-left: 8px solid transparent;border-right: 8px solid transparent;border-bottom: 0; }
21
- .diytooltip span:before {border-top-color: #ccc;bottom: -8px;}
 
18
  .diytooltip span:before, .diytooltip span:after {
19
  content: ""; position: absolute; z-index: 1000; bottom: -7px; left: 50%;margin-left: 8px;
20
  border-top: 8px solid #ddd;border-left: 8px solid transparent;border-right: 8px solid transparent;border-bottom: 0; }
21
+ .diytooltip span:before {border-top-color: #ccc;bottom: -8px;}
22
+ #poststuff label { display: inline-block; vertical-align: top; min-width: 180px; margin-right: 10px;}