Footer Putter - Version 1.15

Version Description

Added 6 new footer layouts to organize the copyright, contact and footer menu sections

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.15
Comparing to
See all releases

Code changes from version 1.14.1 to 1.15

classes/class-admin.php CHANGED
@@ -5,18 +5,41 @@ abstract class Footer_Putter_Admin {
5
  protected $parent_slug;
6
  protected $slug;
7
  protected $screen_id;
8
- private $tooltips;
 
 
 
 
9
  private $tips = array();
10
- private $messages = array();
11
-
12
- function __construct($version, $path, $parent_slug, $slug = '') {
13
- $this->version = $version;
14
- $this->path = $path;
15
- $this->parent_slug = $parent_slug;
16
- $this->slug = empty($slug) ? $this->parent_slug : ( $this->parent_slug.'-'.$slug );
17
- $this->tooltips = new Footer_Putter_Tooltip($this->tips);
 
 
 
 
 
 
 
 
 
18
  $this->init();
 
19
  }
 
 
 
 
 
 
 
 
 
20
 
21
  abstract function init() ;
22
 
@@ -50,6 +73,10 @@ abstract class Footer_Putter_Admin {
50
  return admin_url('admin.php?page='.$this->get_slug());
51
  }
52
 
 
 
 
 
53
  function get_code($code='') {
54
  $format = empty($code) ? '%1$s' : '%1$s-%2$s';
55
  return sprintf($format, $this->get_parent_slug(), $code);
@@ -82,8 +109,8 @@ abstract class Footer_Putter_Admin {
82
  }
83
 
84
  function set_tooltips($tips) {
85
- $this->tips = $tips;
86
- $this->tooltips = new Footer_Putter_Tooltip($this->tips);
87
  $this->add_tooltip_support();
88
  }
89
 
@@ -94,31 +121,40 @@ abstract class Footer_Putter_Admin {
94
  }
95
 
96
  function register_tooltip_styles() {
97
- Footer_Putter_Utils::register_tooltip_styles();
98
  }
99
 
100
  function enqueue_tooltip_styles() {
101
- Footer_Putter_Utils::enqueue_tooltip_styles();
102
  }
103
 
104
  function register_admin_styles() {
105
  wp_register_style($this->get_code('admin'), plugins_url('styles/admin.css',dirname(__FILE__)), array(),$this->get_version());
106
  }
107
 
108
- function enqueue_admin_styles() {
109
- wp_enqueue_style($this->get_code('admin'));
110
- }
 
 
 
 
 
 
 
111
 
112
  function enqueue_color_picker_styles() {
113
  wp_enqueue_style('wp-color-picker');
114
  }
115
 
116
  function enqueue_color_picker_scripts() {
 
117
  wp_enqueue_script('wp-color-picker');
118
  add_action('admin_print_footer_scripts', array($this, 'enable_color_picker'));
119
  }
120
 
121
  function enqueue_metabox_scripts() {
 
122
  wp_enqueue_style($this->get_code('tabs'), plugins_url('styles/tabs.css',dirname(__FILE__)), array(),$this->get_version());
123
  wp_enqueue_script($this->get_code('tabs'), plugins_url('scripts/jquery.tabs.js',dirname(__FILE__)), array(),$this->get_version());
124
  }
@@ -130,6 +166,10 @@ abstract class Footer_Putter_Admin {
130
  add_action('admin_footer-'.$this->get_screen_id(), array($this, 'toggle_postboxes'));
131
  }
132
 
 
 
 
 
133
  function add_meta_box($code, $title, $callback_func, $callback_params = null, $context = 'normal', $priority = 'core', $post_type = false ) {
134
  if (empty($post_type)) $post_type = $this->get_screen_id();
135
  add_meta_box($this->get_code($code), __($title), array($this, $callback_func), $post_type, $context, $priority, $callback_params);
@@ -138,7 +178,14 @@ abstract class Footer_Putter_Admin {
138
  function form_field($id, $name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
139
  if (!$label) $label = $id;
140
  $label_args = (is_array($args) && array_key_exists('label_args', $args)) ? $args['label_args'] : false;
141
- return Footer_Putter_Utils::form_field($id, $name, $this->tooltips->tip($label, $label_args), $value, $type, $options, $args, $wrap);
 
 
 
 
 
 
 
142
  }
143
 
144
  function meta_form_field($meta, $key, $type, $options=array(), $args=array()) {
@@ -150,46 +197,52 @@ abstract class Footer_Putter_Admin {
150
  return $this->form_field($fld, $fld, false, $value, $type, $options, $args, $wrap);
151
  }
152
 
153
- function print_form_field($fld, $value, $type, $options = array(), $args = array(), $wrap = false) {
154
- print $this->form_field($fld, $fld, false, $value, $type, $options, $args, $wrap);
155
- }
156
-
157
  function fetch_text_field($fld, $value, $args = array()) {
158
  return $this->fetch_form_field($fld, $value, 'text', array(), $args);
159
  }
160
 
161
- function print_text_field($fld, $value, $args = array()) {
162
- $this->print_form_field($fld, $value, 'text', array(), $args);
163
- }
 
 
 
 
 
164
 
165
- function get_meta_form_data($metakey, $prefix, $values ) {
166
  $content = array();
167
- if (($post_id = Footer_Putter_Utils::get_post_id())
168
- && ($meta = Footer_Putter_Utils::get_meta($post_id, $metakey)))
169
- $values = Footer_Putter_Utils::validate_options($values, $meta);
170
  foreach ($values as $key => $val) {
171
  $content[$key] = array();
172
  $content[$key]['value'] = $val;
173
  $content[$key]['id'] = $prefix.$key;
174
  $content[$key]['name'] = $metakey. '[' . $key . ']';
175
  }
176
- return $content;
 
 
 
 
 
 
 
177
  }
178
-
179
- function get_newsfeeds() {
180
- return apply_filters('footer_putter_newsfeeds', array( FOOTER_PUTTER_NEWS));
181
  }
182
-
183
- function news_panel($post,$metabox){
184
- Footer_Putter_Feed_Widget::display_feeds($this->get_newsfeeds());
185
- }
186
-
187
- function get_nonces($referer) {
188
- return wp_nonce_field($referer, '_wpnonce', true, false).
189
- wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false, false ).
190
- wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false, false);
191
  }
192
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  function submit_button($button_text='Save Changes', $name = 'options_update') {
194
  return sprintf('<p class="save"><input type="submit" name="%1$s" value="%2$s" class="button-primary" /></p>', $name, $button_text);
195
  }
@@ -202,21 +255,54 @@ abstract class Footer_Putter_Admin {
202
  $updates = false;
203
  foreach ($page_options as $option) {
204
  $option = trim($option);
205
- $val = array_key_exists($option, $_POST) ? trim(stripslashes($_POST[$option])) : '';
206
  if ($trim_option_prefix) $option = substr($option,$trim_option_prefix); //remove prefix
207
  $options[$option] = $val;
208
  } //end for
209
  $saved = call_user_func( array($options_class, 'save_options'), $options) ;
210
  if ($saved)
211
- $this->add_admin_notice($settings_name, 'settings saved successfully.');
212
  else
213
- $this->add_admin_notice($settings_name, 'settings have not been changed.', true);
214
  } else {
215
  $this->add_admin_notice($settings_name, 'settings not found', true);
216
  }
217
  return $saved;
218
  }
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  function fetch_message() {
221
  if (isset($_REQUEST['message']) && ! empty($_REQUEST['message'])) {
222
  $message = urldecode($_REQUEST['message']);
@@ -237,14 +323,17 @@ abstract class Footer_Putter_Admin {
237
  return $columns;
238
  }
239
 
240
- function admin_heading($title = '', $icon_class = '') {
241
  if (empty($title)) $title = sprintf('%1$s %2$s', ucwords(str_replace('-',' ',$this->slug)), $this->get_version());
242
- if (empty($icon_class)) $icon_class = FOOTER_PUTTER_ICON;
243
- $icon = sprintf('<i class="%1$s"></i>', 'dashicons-'==substr($icon_class,0,10) ? ('dashicons '.$icon_class) : $icon_class) ;
244
- return sprintf('<h2 class="title">%2$s%1$s</h2>', $title, $icon);
245
  }
246
 
247
- function print_admin_form_start($title, $referer = false, $keys = false, $enctype = false, $with_sidebar = false, $preamble = false) {
 
 
 
 
 
248
  $this_url = $_SERVER['REQUEST_URI'];
249
  $enctype = $enctype ? 'enctype="multipart/form-data" ' : '';
250
  $nonces = $referer ? $this->get_nonces($referer) : '';
@@ -253,9 +342,8 @@ abstract class Footer_Putter_Admin {
253
  $keys = is_array($keys) ? implode(',', $keys) : $keys;
254
  $page_options = sprintf('<input type="hidden" name="page_options" value="%1$s" />', $keys);
255
  }
256
- $class = $with_sidebar ? ' columns-2' : '';
257
- printf('<div class="wrap">%1$s<form id="diy_options" method="post" %2$saction="%3$s"><p>%4$s%5$s</p><div id="poststuff"><div id="post-body" class="metabox-holder%6$s"><div id="post-body-content">%7$s',
258
- $title, $enctype, $this_url, $page_options, $nonces, $class, $preamble ? $preamble : '');
259
  }
260
 
261
  function print_admin_form_with_sidebar_middle() {
@@ -263,38 +351,77 @@ abstract class Footer_Putter_Admin {
263
  }
264
 
265
  function print_admin_form_end() {
266
- print '</div></div><br class="clear"/></div></form></div>';
 
 
 
 
267
  }
268
 
269
  function print_admin_form_with_sidebar($title, $referer = false, $keys = false, $enctype = false, $preamble = false) {
270
- $this->print_admin_form_start ($title, $referer, $keys, $enctype, true, $preamble);
 
271
  do_meta_boxes($this->get_screen_id(), 'normal', null);
272
  if ($keys) print $this->submit_button();
 
273
  do_meta_boxes($this->get_screen_id(), 'advanced', null);
274
  $this->print_admin_form_with_sidebar_middle();
275
  do_meta_boxes($this->get_screen_id(), 'side', null);
276
- $this->print_admin_form_end();
277
  }
278
 
279
  function print_admin_form ($title, $referer = false, $keys = false, $enctype = false, $preamble = false) {
280
- $this->print_admin_form_start ($title, $referer, $keys, $enctype, false, $preamble);
 
281
  do_meta_boxes($this->get_screen_id(), 'normal', null);
282
  if ($keys) print $this->submit_button();
283
- do_meta_boxes($this->get_screen_id(), 'advanced', null);
284
  $this->print_admin_form_end();
 
 
 
 
 
 
285
  }
286
 
287
-
288
- function display_metabox($tabs) {
 
 
 
 
 
 
 
 
289
  $labels = $contents = '';
290
- $t=0;
291
- $tab = isset($_REQUEST['tabselect']) ? $_REQUEST['tabselect'] : 'tab1';
292
  foreach ($tabs as $label => $content) {
293
  $t++;
294
  $labels .= sprintf('<li class="tab tab%1$s"><a href="#">%2$s</a></li>', $t, $label);
295
  $contents .= sprintf('<div class="tab%1$s"><div class="tab-content">%2$s</div></div>', $t, $content);
296
  }
297
- printf('<div class="footer-putter-metabox"><ul class="footer-putter-metabox-tabs">%1$s</ul><div class="metabox-content">%2$s</div><input type="hidden" id="tabselect" name="tabselect" value="%3$s" /></div>', $labels, $contents, $tab);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
299
 
300
  function toggle_postboxes() {
@@ -312,13 +439,32 @@ SCRIPT;
312
  }
313
 
314
  function enable_color_picker() {
 
 
 
 
 
 
 
 
315
  print <<< SCRIPT
316
- <script type="text/javascript">
317
- //<![CDATA[
318
- jQuery(document).ready( function($) {
319
- $('.color-picker').wpColorPicker();
320
- });
321
- //]]>
 
 
 
 
 
 
 
 
 
 
 
322
  </script>
323
  SCRIPT;
324
  }
5
  protected $parent_slug;
6
  protected $slug;
7
  protected $screen_id;
8
+ protected $plugin;
9
+ protected $utils;
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;
18
+
19
+ function __construct($plugin, $slug = '') {
20
+ $this->plugin = $plugin;
21
+ $this->icon = $this->plugin->get_icon();
22
+ $this->options = $this->plugin->get_options();
23
+ $this->tooltips = $this->plugin->get_tooltips();
24
+ $this->utils = $this->plugin->get_utils();
25
+ $this->version = $this->plugin->get_version();
26
+ $this->path = $this->plugin->get_path();
27
+ $this->parent_slug = $this->plugin->get_slug();
28
+ $this->slug = empty($slug) ? $this->parent_slug : ( $this->parent_slug.'-'.$slug );
29
+ $this->metabox_class = $this->prefix_class('metabox');
30
+ $this->metabox_tab = $this->prefix_action('tab');
31
  $this->init();
32
+ add_action('wp_ajax_'. $this->metabox_tab, array($this,'save_tab'));
33
  }
34
+
35
+ function news_panel($post,$metabox){
36
+ $this->plugin->get_news()->display_feeds($this->plugin->get_newsfeeds());
37
+ }
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() ;
45
 
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);
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
 
121
  }
122
 
123
  function register_tooltip_styles() {
124
+ $this->utils->register_tooltip_styles();
125
  }
126
 
127
  function enqueue_tooltip_styles() {
128
+ $this->utils->enqueue_tooltip_styles();
129
  }
130
 
131
  function register_admin_styles() {
132
  wp_register_style($this->get_code('admin'), plugins_url('styles/admin.css',dirname(__FILE__)), array(),$this->get_version());
133
  }
134
 
135
+ function enqueue_admin() {
136
+ $this->enqueue_admin_styles();
137
+ $this->enqueue_metabox_scripts();
138
+ $this->enqueue_postbox_scripts();
139
+ $this->enqueue_news_scripts();
140
+ }
141
+
142
+ function enqueue_admin_styles() {
143
+ wp_enqueue_style($this->get_code('admin'));
144
+ }
145
 
146
  function enqueue_color_picker_styles() {
147
  wp_enqueue_style('wp-color-picker');
148
  }
149
 
150
  function enqueue_color_picker_scripts() {
151
+ wp_enqueue_script('underscore');
152
  wp_enqueue_script('wp-color-picker');
153
  add_action('admin_print_footer_scripts', array($this, 'enable_color_picker'));
154
  }
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
  }
166
  add_action('admin_footer-'.$this->get_screen_id(), array($this, 'toggle_postboxes'));
167
  }
168
 
169
+ function enqueue_news_scripts() {
170
+ $this->plugin->get_news()->enqueue_scripts();
171
+ }
172
+
173
  function add_meta_box($code, $title, $callback_func, $callback_params = null, $context = 'normal', $priority = 'core', $post_type = false ) {
174
  if (empty($post_type)) $post_type = $this->get_screen_id();
175
  add_meta_box($this->get_code($code), __($title), array($this, $callback_func), $post_type, $context, $priority, $callback_params);
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
 
191
  function meta_form_field($meta, $key, $type, $options=array(), $args=array()) {
197
  return $this->form_field($fld, $fld, false, $value, $type, $options, $args, $wrap);
198
  }
199
 
 
 
 
 
200
  function fetch_text_field($fld, $value, $args = array()) {
201
  return $this->fetch_form_field($fld, $value, 'text', array(), $args);
202
  }
203
 
204
+ function get_meta_form_data($metakey, $prefix, $values = '' ) {
205
+ $content = false;
206
+ $meta = false;
207
+ if (($post_id = $this->utils->get_post_id())
208
+ && ($meta = $this->utils->get_post_meta($post_id, $metakey))
209
+ && is_array($values)
210
+ && is_array($meta))
211
+ $values = $this->options->validate_options($values, $meta);
212
 
213
+ if (is_array($values)) {
214
  $content = array();
 
 
 
215
  foreach ($values as $key => $val) {
216
  $content[$key] = array();
217
  $content[$key]['value'] = $val;
218
  $content[$key]['id'] = $prefix.$key;
219
  $content[$key]['name'] = $metakey. '[' . $key . ']';
220
  }
221
+ } else {
222
+ if (is_string($values)) {
223
+ $key ='';
224
+ $content = array();
225
+ $content[$key] = array();
226
+ $content[$key]['value'] = $meta;
227
+ $content[$key]['id'] = $prefix;
228
+ $content[$key]['name'] = $metakey;
229
  }
 
 
 
230
  }
231
+ return $content;
 
 
 
 
 
 
 
 
232
  }
233
 
234
+ function prefix_action($action, $prefix ='') {
235
+ if (empty($prefix)) $prefix = $this->utils->get_prefix();
236
+ if ('_' == substr($prefix,0,1)) $prefix = substr($prefix,1);
237
+ return strtolower( $prefix.$action);
238
+ }
239
+
240
+ function prefix_class($class, $prefix ='') {
241
+ if (empty($prefix)) $prefix = $this->utils->get_prefix();
242
+ if ('_' == substr($prefix,0,1)) $prefix = substr($prefix,1);
243
+ return strtolower( str_replace('_', '-', $prefix).$class);
244
+ }
245
+
246
  function submit_button($button_text='Save Changes', $name = 'options_update') {
247
  return sprintf('<p class="save"><input type="submit" name="%1$s" value="%2$s" class="button-primary" /></p>', $name, $button_text);
248
  }
255
  $updates = false;
256
  foreach ($page_options as $option) {
257
  $option = trim($option);
258
+ $val = array_key_exists($option, $_POST) ? (is_array($_POST[$option]) ? $_POST[$option] : trim(stripslashes($_POST[$option]))) : '';
259
  if ($trim_option_prefix) $option = substr($option,$trim_option_prefix); //remove prefix
260
  $options[$option] = $val;
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
  }
272
 
273
+ function save_postmeta($post_id, $enabler, $metakey, $defaults = array()) {
274
+ if (array_key_exists($enabler, $_POST)) {
275
+ if (isset($_POST[$metakey])) {
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) {
291
+ $key = $this->utils->get_toggle_post_meta_key($action, $option);
292
+ return $this->toggle_checkbox($key, $this->utils->get_post_meta_value($post_id, $key), $action=='disable' ? 'Disable' : 'Enable', $option, $label_format);
293
+ }
294
+
295
+ function visibility_checkbox($post_id, $action, $option, $label_format) {
296
+ $key = $this->utils->get_toggle_post_meta_key($action, $option);
297
+ return $this->toggle_checkbox($key, $this->utils->get_post_meta_value($post_id, $key), $action=='hide' ? 'Do not show' : 'Show', $option, $label_format);
298
+ }
299
+
300
+ function toggle_checkbox($key, $value, $action, $option, $label_format) {
301
+ $checked = $value ?'checked="checked" ':'';
302
+ $label = __(sprintf($label_format, $action, ucwords(str_replace('_',' ', $option))));
303
+ return sprintf('<label><input class="valinp" type="checkbox" name="%1$s" id="%1$s" %2$svalue="1" />%3$s</label><br/>', $key, $checked, $label);
304
+ }
305
+
306
  function fetch_message() {
307
  if (isset($_REQUEST['message']) && ! empty($_REQUEST['message'])) {
308
  $message = urldecode($_REQUEST['message']);
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));
 
 
329
  }
330
 
331
+ function print_admin_page_start($title, $with_sidebar = false) {
332
+ $class = $with_sidebar ? ' columns-2' : '';
333
+ printf('<div class="wrap">%1$s<div id="poststuff"><div id="post-body" class="metabox-holder%2$s"><div id="post-body-content">', $title, $class);
334
+ }
335
+
336
+ function print_admin_form_start($referer = false, $keys = false, $enctype = false, $preamble = false) {
337
  $this_url = $_SERVER['REQUEST_URI'];
338
  $enctype = $enctype ? 'enctype="multipart/form-data" ' : '';
339
  $nonces = $referer ? $this->get_nonces($referer) : '';
342
  $keys = is_array($keys) ? implode(',', $keys) : $keys;
343
  $page_options = sprintf('<input type="hidden" name="page_options" value="%1$s" />', $keys);
344
  }
345
+ printf('%1$s<form id="diy_options" method="post" %2$saction="%3$s"><div>%4$s%5$s</div>',
346
+ $preamble ? $preamble : '', $enctype, $this_url, $page_options, $nonces);
 
347
  }
348
 
349
  function print_admin_form_with_sidebar_middle() {
351
  }
352
 
353
  function print_admin_form_end() {
354
+ print '</form>';
355
+ }
356
+
357
+ function print_admin_page_end() {
358
+ print '</div></div><br class="clear"/></div></div>';
359
  }
360
 
361
  function print_admin_form_with_sidebar($title, $referer = false, $keys = false, $enctype = false, $preamble = false) {
362
+ $this->print_admin_page_start ($title, true);
363
+ $this->print_admin_form_start ($referer, $keys, $enctype, $preamble);
364
  do_meta_boxes($this->get_screen_id(), 'normal', null);
365
  if ($keys) print $this->submit_button();
366
+ $this->print_admin_form_end();
367
  do_meta_boxes($this->get_screen_id(), 'advanced', null);
368
  $this->print_admin_form_with_sidebar_middle();
369
  do_meta_boxes($this->get_screen_id(), 'side', null);
370
+ $this->print_admin_page_end();
371
  }
372
 
373
  function print_admin_form ($title, $referer = false, $keys = false, $enctype = false, $preamble = false) {
374
+ $this->print_admin_page_start ($title);
375
+ $this->print_admin_form_start ($referer, $keys, $enctype, $preamble);
376
  do_meta_boxes($this->get_screen_id(), 'normal', null);
377
  if ($keys) print $this->submit_button();
 
378
  $this->print_admin_form_end();
379
+ do_meta_boxes($this->get_screen_id(), 'advanced', null);
380
+ $this->print_admin_page_end();
381
+ }
382
+
383
+ function is_metabox_active($post_type, $context) {
384
+ return ('advanced' === $context ) && $this->plugin->is_post_type_enabled($post_type) ;
385
  }
386
 
387
+ function tabbed_metabox($container_id, $tabs, $n=0) {
388
+ if (!$tabs || (is_array($tabs) && (count($tabs) == 0))) return;
389
+ $tabselect = sprintf('tabselect%1$s', $n);
390
+ if (isset($_REQUEST[$tabselect]))
391
+ $tab = $_REQUEST[$tabselect];
392
+ else {
393
+ $tab = get_user_option($this->metabox_tab.'_'.$container_id ) ;
394
+ if (!$tab) $tab = 'tab1' ;
395
+ }
396
+ $t=0;
397
  $labels = $contents = '';
 
 
398
  foreach ($tabs as $label => $content) {
399
  $t++;
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
+
407
+ function get_action_nonce($action) {
408
+ return wp_nonce_field($action, $action.'nonce', false, false );
409
+ }
410
+
411
+ function get_nonces($referer) {
412
+ return wp_nonce_field($referer, '_wpnonce', true, false).
413
+ wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false, false ).
414
+ wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false, false);
415
+ }
416
+
417
+ function save_tab() {
418
+ check_ajax_referer( $this->metabox_tab, 'tabnonce');
419
+ $tabselect = isset( $_POST['tabselect'] ) ? $_POST['tabselect'] : 'tab0';
420
+ $box = isset( $_POST['box'] ) ? $_POST['box'] : '';
421
+ if ( $box != sanitize_key( $box ) ) wp_die( 0 );
422
+ if ( ! $user = wp_get_current_user() ) wp_die( -1 );
423
+ if ( $tabselect ) update_user_option($user->ID, $this->metabox_tab.'_'.$box, $tabselect, true);
424
+ wp_die( 1 );
425
  }
426
 
427
  function toggle_postboxes() {
439
  }
440
 
441
  function enable_color_picker() {
442
+ if ($this->is_metabox)
443
+ $this->enable_color_picker_metabox();
444
+ else
445
+ $this->enable_color_picker_widgets();
446
+ }
447
+
448
+ function enable_color_picker_metabox() {
449
+ $target = sprintf('.%1$s .color-picker', $this->metabox_class);
450
  print <<< SCRIPT
451
+ <script>
452
+ ( function( $ ){
453
+ $( document ).ready( function() { $( '{$target}' ).wpColorPicker(); });
454
+ }( jQuery ) );
455
+ </script>
456
+ SCRIPT;
457
+ }
458
+
459
+ function enable_color_picker_widgets() {
460
+ print <<< SCRIPT
461
+ <script>
462
+ ( function( $ ){
463
+ function initColorPickerWidget( widget ) { widget.find( '.color-picker' ).wpColorPicker( { change: _.throttle( function() { $(this).trigger( 'change' );}, 3000 ) }); }
464
+ function colorPickerWidgetUpdate( event, widget ) { initColorPickerWidget( widget ); }
465
+ $( document ).on( 'widget-added widget-updated', colorPickerWidgetUpdate );
466
+ $( document ).ready( function() { $( '#widgets-right .widget:has(.color-picker)' ).each( function () { initColorPickerWidget( $( this ) );} ); } );
467
+ }( jQuery ) );
468
  </script>
469
  SCRIPT;
470
  }
classes/class-credits-admin.php CHANGED
@@ -29,8 +29,10 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
29
  'terms_contact' => array('heading' => 'Add Terms Contact?', 'tip' => 'Add a section to the end of the Terms page with contact and legal information'),
30
  'hide_wordpress' => array('heading' => 'Hide WordPress link?', 'tip' => 'Hide link to WordPress.org'),
31
  );
 
32
 
33
  function init() {
 
34
  add_action('admin_menu',array($this, 'admin_menu'));
35
  }
36
 
@@ -41,30 +43,56 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
41
  }
42
 
43
  function page_content() {
44
- $title = $this->admin_heading('Footer Credits',FOOTER_PUTTER_ICON);
45
- $this->print_admin_form_with_sidebar($title, __CLASS__, $this->get_keys());
46
  }
47
 
48
  function load_page() {
49
  if (isset($_POST['options_update'])) $this->save_credits();
 
50
  $this->add_meta_box('introduction', 'Introduction' , 'intro_panel');
51
- $this->add_meta_box('credits', 'Footer Settings' , 'credits_panel', array ('options' => Footer_Credits_Options::get_options()));
52
  $this->add_meta_box('example', 'Footer Preview', 'preview_panel', null, 'advanced');
53
  $this->add_meta_box('news', 'DIY Webmastery News', 'news_panel', null, 'side');
54
- $this->set_tooltips($this->tips);
55
  add_action('admin_enqueue_scripts', array($this, 'enqueue_credits_styles'));
56
- add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
57
- add_action('admin_enqueue_scripts',array($this, 'enqueue_metabox_scripts'));
58
- add_action('admin_enqueue_scripts',array($this, 'enqueue_postbox_scripts'));
59
  }
60
 
61
  function enqueue_credits_styles() {
62
  wp_enqueue_style($this->get_code(), plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),$this->get_version());
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  function credits_panel($post,$metabox) {
66
  $options = $metabox['args']['options'];
67
- $this->display_metabox( array(
68
  'Owner' => $this->owner_panel($options['terms']),
69
  'Contact' => $this->contact_panel($options['terms']),
70
  'Legal' => $this->legal_panel($options['terms']),
@@ -73,20 +101,11 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
73
  ));
74
  }
75
 
76
- function intro_panel() {
77
- printf('<p>%1$s</p>', __('The following information is used in the Footer Copyright Widget and optionally at the end of the Privacy Statement and Terms and Conditions pages.'));
78
- }
79
-
80
- function preview_panel() {
81
- printf('<p><i>%1$s</i></p><hr/>%2$s', __('Note: Preview is purely illustrative. Actual footer layout on the site will vary based on footer widget settings.'), Footer_Credits::footer(array('nav_menu' => 'Footer Menu')));
82
- }
83
-
84
-
85
  function owner_panel($terms) {
86
  $s = $this->fetch_text_field('owner', $terms['owner'], array('size' =>30)) .
87
  $this->fetch_text_field('country', $terms['country'], array('size' => 30)) .
88
  $this->fetch_form_field('address', $terms['address'], 'textarea', array(), array('cols' => 30, 'rows' => 5));
89
- if (Footer_Credits::is_html5()) {
90
  return $s .
91
  '<p>Leave the above address field blank and fill in the various parts of the organization address below if you want to be able to use HTML5 microdata.</p>'.
92
  '<h4>Organization Address</h4>'.
@@ -125,7 +144,7 @@ class Footer_Credits_Admin extends Footer_Putter_Admin{
125
  }
126
 
127
  function advanced_panel($options) {
128
- $url = 'http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks';
129
  $before = <<< ADVANCED_PANEL
130
  <p>You can place the Copyright and Trademark widgets in any existing widget area. However, if your theme does not have a suitably located widget area in the footer then you can create one by specifying the hook
131
  where the Widget Area will be located.</p>
@@ -133,44 +152,28 @@ where the Widget Area will be located.</p>
133
  <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,<i>twentythirteen_credits</i> or <i>twentyfourteen_credits</i>. If you using a Genesis child theme and the theme does not have a suitable widget area then use
134
  the hook <i>genesis_footer</i> or maybe <i>genesis_after</i>. See what looks best. Click for <a href="{$url}">suggestions of which hook to use for common WordPress themes</a>.</p>
135
  ADVANCED_PANEL;
136
- $f = $this->fetch_text_field('footer_hook', $options['footer_hook'], array('size' => 30)) .
137
  $this->fetch_form_field('footer_remove', $options['footer_remove'], 'checkbox');
138
  $after = <<< REMOVE_PANEL
139
  <p>If your WordPress theme supplies a filter hook rather than an action hook where it generates the footer, and you want to suppress the theme footer,
140
  then specify the hook below. For example, entering <i>genesis_footer_output</i> will suppress the standard Genesis child theme footer.</p>
141
  REMOVE_PANEL;
142
- $hook = $this->fetch_text_field('footer_filter_hook', $options['footer_filter_hook'], array('size' => 30));
143
  if (($theme = wp_get_theme()) && (strpos(strtolower($theme->get('Name')), 'twenty') !== FALSE))
144
  $hook .= $this->fetch_form_field('hide_wordpress', $options['hide_wordpress'], 'checkbox');
145
  return $before . $f . $after . $hook;
146
  }
147
 
148
- function save_credits() {
149
- check_admin_referer(__CLASS__);
150
- $page_options = explode(',', stripslashes($_POST['page_options']));
151
- if ($page_options) {
152
- $options = Footer_Credits_Options::get_options();
153
- foreach ($page_options as $option) {
154
- $val = array_key_exists($option, $_POST) ? trim(stripslashes($_POST[$option])) : '';
155
- if (Footer_Credits_Options::is_terms_key($option))
156
- $options['terms'][$option] = $val;
157
- else switch($option) {
158
- case 'footer_remove' : $options[$option] = !empty($val); break;
159
- case 'footer_hook':
160
- case 'footer_filter_hook': $options[$option] = preg_replace('/\W/','',$val); break;
161
- default: $options[$option] = trim($val);
162
- }
163
- } //end for ;
164
- $saved = Footer_Credits_Options::save_options($options) ;
165
- $message = $saved ? 'updated successfully' : 'have not been updated';
166
- $is_error = false;
167
- } else {
168
- $message= 'not found!';
169
- $is_error = true;
170
- }
171
 
172
- $this->add_admin_notice('Footer Settings ', $message, $is_error);
173
- return $saved;
 
174
  }
175
 
 
 
 
 
 
 
176
  }
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
 
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
 
61
  function enqueue_credits_styles() {
62
  wp_enqueue_style($this->get_code(), plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),$this->get_version());
63
  }
64
 
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']),
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>'.
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>
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
+
178
+
179
  }
classes/class-credits-options.php DELETED
@@ -1,161 +0,0 @@
1
- <?php
2
- class Footer_Credits_Options {
3
-
4
- const OPTIONS_NAME = 'footer_credits_options';
5
-
6
- protected static $options = null;
7
-
8
- protected static $defaults = array(
9
- 'terms' => array(
10
- 'site' => '',
11
- 'owner' => '',
12
- 'address' => '',
13
- 'street_address' => '',
14
- 'locality' => '',
15
- 'region' => '',
16
- 'postal_code' => '',
17
- 'country' => '',
18
- 'latitude' => '',
19
- 'longitude' => '',
20
- 'map' => '',
21
- 'email' => '',
22
- 'telephone' => '',
23
- 'copyright' => '',
24
- 'copyright_start_year' => '',
25
- 'copyright_preamble' => '',
26
- 'courts' => '',
27
- 'updated' => '',
28
- 'privacy_contact' => '',
29
- 'terms_contact' => ''),
30
- 'nav_menu' => 0,
31
- 'center' => true,
32
- 'two_lines' => true,
33
- 'separator' => '&nbsp;&middot;&nbsp;',
34
- 'item_separator' => '&nbsp;',
35
- 'section_separator' => '<br/>',
36
- 'show_copyright' => true,
37
- 'show_telephone' => true,
38
- 'show_email' => false,
39
- 'show_address' => true,
40
- 'show_return' => true,
41
- 'return_text' => 'Return To Top',
42
- 'return_class' => '',
43
- 'footer_class' => '',
44
- 'footer_hook' => '',
45
- 'footer_remove' => true,
46
- 'footer_filter_hook' => '',
47
- 'visibility' => '' ,
48
- 'use_microdata' => false,
49
- 'hide_wordpress' => false
50
- );
51
-
52
- public static function init() {
53
- self::theme_specific_defaults();
54
- self::$options = new Footer_Putter_DIY_Options(self::OPTIONS_NAME, self::$defaults);
55
- }
56
-
57
- public static function get_defaults() {
58
- return self::$defaults;
59
- }
60
-
61
- public static function is_terms_key($key) {
62
- return array_key_exists($key, self::$defaults['terms']);
63
- }
64
-
65
- public static function get_option($option_name) {
66
- $options = self::get_options();
67
- if ($option_name && $options && array_key_exists($option_name,$options))
68
- return $options[$option_name];
69
- else
70
- return false;
71
- }
72
-
73
- public static function get_options() {
74
- return self::$options->get_options();
75
- }
76
-
77
- public static function save_options($new_options) {
78
- $new_options['terms'] = self::sanitize_terms($new_options['terms']);
79
- return self::$options->save_options( $new_options) ;
80
- }
81
-
82
- private static function sanitize_terms($new_terms) {
83
- $new_terms = wp_parse_args($new_terms, self::$defaults['terms']); //ensure terms are complete
84
- $new_terms['site'] = self::get_default_site();
85
- $new_terms['copyright'] = self::get_copyright($new_terms['copyright_start_year']); //generate copyright
86
- return $new_terms;
87
- }
88
-
89
- private static function get_default_site() {
90
- $domain = strtolower(parse_url(site_url(),PHP_URL_HOST));
91
- $p = strpos($domain,'www.') ;
92
- if (($p !== FALSE) && ($p == 0)) $domain = substr($domain,4);
93
- return $domain;
94
- }
95
-
96
- public static function get_copyright($startyear='') {
97
- $thisyear = date("Y");
98
- $format = (empty( $startyear) || ($startyear==$thisyear)) ? '%1$s %3$s' : '%1$s %2$s-%3$s';
99
- return sprintf($format, self::get_term('copyright_preamble'), $startyear, $thisyear);
100
- }
101
-
102
- public static function get_terms() {
103
- return self::get_option('terms');
104
- }
105
-
106
- public static function get_term($term_name) {
107
- $options = self::get_options();
108
- $terms = is_array($options) && array_key_exists('terms',$options) ? $options['terms'] : false;
109
- if ($term_name && $terms && array_key_exists($term_name,$terms) && $terms[$term_name])
110
- return $terms[$term_name];
111
- else
112
- return self::get_default_term($term_name);
113
- }
114
-
115
- private static function get_default_term($key) {
116
- $default='';
117
- switch ($key) {
118
- case 'owner' : $default = self::get_term('site'); break;
119
- case 'copyright' : $default = self::get_copyright(self::get_term('copyright_start_year')); break;
120
- case 'copyright_start_year': $default = date('Y'); break;
121
- case 'copyright_preamble': $default = 'Copyright &copy;'; break;
122
- case 'country' : $default = 'The United States'; break;
123
- case 'courts' : $default = ucwords(sprintf('the courts of %1$s',self::get_term('country'))); break;
124
- case 'email' : $default = 'privacy@'.strtolower(self::get_term('site')); break;
125
- case 'site' : $default = self::get_default_site(); break;
126
- case 'updated' : $default = date('d M Y'); break;
127
- default: $default=''; //default is blank for others
128
- }
129
- return $default;
130
- }
131
-
132
- private static function theme_specific_defaults() {
133
- switch (basename( TEMPLATEPATH ) ) {
134
- case 'twentyten':
135
- self::$defaults['footer_hook'] = 'twentyten_credits'; break;
136
- case 'twentyeleven':
137
- self::$defaults['footer_hook'] = 'twentyeleven_credits'; break;
138
- case 'twentytwelve':
139
- self::$defaults['footer_hook'] = 'twentytwelve_credits'; break;
140
- case 'twentythirteen':
141
- self::$defaults['footer_hook'] = 'twentythirteen_credits'; break;
142
- case 'twentyfourteen':
143
- self::$defaults['footer_hook'] = 'twentyfourteen_credits'; break;
144
- case 'delicate':
145
- self::$defaults['footer_hook'] = 'get_footer'; break;
146
- case 'genesis':
147
- self::$defaults['footer_hook'] = 'genesis_footer';
148
- self::$defaults['footer_filter_hook'] = 'genesis_footer_output';
149
- break;
150
- case 'graphene':
151
- self::$defaults['footer_hook'] = 'graphene_footer'; break;
152
- case 'pagelines':
153
- self::$defaults['footer_hook'] = 'pagelines_leaf'; break;
154
- default:
155
- self::$defaults['footer_hook'] = 'wp_footer';
156
- self::$defaults['footer_remove'] = false;
157
- break;
158
- }
159
- }
160
-
161
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class-credits-widgets.php CHANGED
@@ -1,8 +1,7 @@
1
  <?php
2
- class Footer_Putter_Copyright_Widget extends WP_Widget {
3
 
4
- private $instance;
5
- private $tooltips;
6
  private $defaults = array(
7
  'nav_menu' => 0, 'center' => true, 'two_lines' => true,
8
  'show_copyright' => true, 'show_address' => true, 'show_telephone' => true, 'show_email' => false,
@@ -11,7 +10,7 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
11
  private $tips = array(
12
  'nav_menu' => array('heading' => 'Footer Menu', 'tip' => 'Choose the menu to display in the footer'),
13
  'center' => array('heading' => 'Center Menu', 'tip' => 'Center the footer horizontally'),
14
- 'two_lines' => array('heading' => 'Spread Over Two Lines', 'tip' => 'Place the menu and copyright on one line and the contact details on the other'),
15
  'show_copyright' => array('heading' => 'Show Copyright', 'tip' => 'Show copyright holder an year range'),
16
  'show_address' => array('heading' => 'Show Address', 'tip' => 'Show contact address'),
17
  'show_telephone' => array('heading' => 'Show Telephone Number', 'tip' => 'Show telephone number(s)'),
@@ -34,14 +33,15 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
34
  function __construct() {
35
  $widget_ops = array( 'description' => __( "A widget displaying menu links, copyright and company details" ) );
36
  parent::__construct('footer_copyright', __('Footer Copyright Widget'), $widget_ops);
 
37
  }
38
 
39
  function widget( $args, $instance ) {
40
  extract( $args );
41
  $instance = wp_parse_args( (array) $instance, $this->defaults );
42
- if (Footer_Putter_Utils::hide_widget($instance['visibility'])) return; //check visibility requirements
43
 
44
- if ($footer = Footer_Credits::footer($instance))
45
  printf ('%1$s%2$s%3$s', $before_widget, $footer, $after_widget);
46
  }
47
 
@@ -54,7 +54,7 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
54
  $instance['show_address'] = !empty($new_instance['show_address']) ? 1 : 0;
55
  $instance['use_microdata'] = !empty($new_instance['use_microdata']);
56
  $instance['center'] = !empty($new_instance['center']) ? 1 : 0;
57
- $instance['two_lines'] = !empty($new_instance['two_lines']) ? 1 : 0;
58
  $instance['show_return'] = !empty($new_instance['show_return']) ? 1 : 0;
59
  $instance['return_class'] = trim($new_instance['return_class']);
60
  $instance['footer_class'] = trim($new_instance['footer_class']);
@@ -63,6 +63,7 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
63
  }
64
 
65
  function form( $instance ) {
 
66
  $menu_terms = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
67
  if ( !$menu_terms ) {
68
  echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.' ), admin_url('nav-menus.php') ) .'</p>';
@@ -71,22 +72,17 @@ class Footer_Putter_Copyright_Widget extends WP_Widget {
71
  $menus = array();
72
  $menus[0] = 'No menu';
73
  foreach ( $menu_terms as $term ) $menus[ $term->term_id ] = $term->name;
74
-
75
- $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
76
- $this->tooltips = new Footer_Putter_Tooltip($this->get_tips());
77
- print '<div class="diy-wrap">';
78
  $this->print_form_field('nav_menu', 'select', $menus);
79
- print ('<hr/><h4>Options</h4>');
80
-
81
  $this->print_form_field('center', 'checkbox');
82
- $this->print_form_field('two_lines', 'checkbox');
83
  $this->print_form_field('show_copyright', 'checkbox');
84
  $this->print_form_field('show_address', 'checkbox');
85
  $this->print_form_field('show_telephone', 'checkbox');
86
  $this->print_form_field('show_email', 'checkbox');
87
  $this->print_form_field('show_return', 'checkbox');
88
- if (Footer_Putter_Utils::is_html5()) $this->print_form_field('use_microdata', 'checkbox');
89
-
90
  print <<< CUSTOM_CLASSES
91
  <hr/><h4>Custom Classes</h4>
92
  <p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
@@ -97,13 +93,8 @@ CUSTOM_CLASSES;
97
  $this->print_form_field('return_class', 'text', array(), array('size' => 10));
98
  $this->print_form_field('footer_class', 'text', array(), array('size' => 10));
99
  print ('<hr/><h4>Widget Presence</h4>');
100
- $this->print_form_field('visibility', 'radio', Footer_Putter_Utils::get_visibility_options(), array('separator' => '<br />'));
101
  print '</div>';
102
- }
103
-
104
- function print_form_field($fld, $type, $options = array(), $args = array()) {
105
- $value = array_key_exists($fld,$this->instance) ? $this->instance[$fld] : false;
106
- print Footer_Putter_Utils::form_field(
107
- $this->get_field_id($fld), $this->get_field_name($fld), $this->tooltips->tip($fld), $value, $type, $options, $args, 'br');
108
- }
109
  }
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,
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)'),
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
 
54
  $instance['show_address'] = !empty($new_instance['show_address']) ? 1 : 0;
55
  $instance['use_microdata'] = !empty($new_instance['use_microdata']);
56
  $instance['center'] = !empty($new_instance['center']) ? 1 : 0;
57
+ $instance['layout'] = $new_instance['layout'];
58
  $instance['show_return'] = !empty($new_instance['show_return']) ? 1 : 0;
59
  $instance['return_class'] = trim($new_instance['return_class']);
60
  $instance['footer_class'] = trim($new_instance['footer_class']);
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>';
72
  $menus = array();
73
  $menus[0] = 'No menu';
74
  foreach ( $menu_terms as $term ) $menus[ $term->term_id ] = $term->name;
75
+ print '<div class="diy-wrap">';
 
 
 
76
  $this->print_form_field('nav_menu', 'select', $menus);
77
+ print ('<hr/><h4>Options</h4>');
 
78
  $this->print_form_field('center', 'checkbox');
 
79
  $this->print_form_field('show_copyright', 'checkbox');
80
  $this->print_form_field('show_address', 'checkbox');
81
  $this->print_form_field('show_telephone', 'checkbox');
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>
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
  }
classes/class-credits.php CHANGED
@@ -1,133 +1,263 @@
1
  <?php
2
-
3
  class Footer_Credits {
4
 
5
- const CODE = 'footer-credits'; //shortcode prefix
 
6
  const SIDEBAR_ID = 'last-footer';
7
 
8
- public static function init() {
9
- add_action('widgets_init',array(__CLASS__,'register'),20);
10
- add_filter( 'wp_nav_menu_items', array(__CLASS__, 'fix_home_link'), 10, 2 );
11
- if (!is_admin()) add_action('wp',array(__CLASS__,'prepare'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
13
 
14
- public static function register() {
15
- self::register_sidebars();
16
- self::register_widgets();
17
  }
18
 
19
- private static function register_sidebars() {
20
- if (Footer_Credits_Options::get_option('footer_hook')) {
21
- $tag = self::is_html5() ? 'section' : 'div';
22
  register_sidebar( array(
23
  'id' => self::SIDEBAR_ID,
24
- 'name' => __( 'Credibility Footer', __CLASS__ ),
25
- 'description' => __( 'Custom footer section for copyright, trademarks, etc', __CLASS__),
26
  'before_widget' => '<'.$tag.' id="%1$s" class="widget %2$s"><div class="widget-wrap">',
27
  'after_widget' => '</div></'.$tag.'>'
28
  ) );
29
  }
30
  }
31
 
32
- private static function register_widgets() {
33
  if (class_exists('Footer_Putter_Copyright_Widget')) register_widget('Footer_Putter_Copyright_Widget');
34
  if (class_exists('Footer_Putter_Trademark_Widget')) register_widget('Footer_Putter_Trademark_Widget');
35
  }
36
-
37
- public static function is_html5() {
38
- return Footer_Putter_Utils::is_html5();
39
- }
40
 
41
- public static function prepare() {
42
- add_shortcode(self::CODE, array(__CLASS__, 'footer' ) );
43
- add_shortcode(self::CODE.'-contact', array(__CLASS__, 'contact' ) );
44
- add_shortcode(self::CODE.'-copyright', array(__CLASS__, 'copyright' ) );
45
- add_shortcode(self::CODE.'-menu', array(__CLASS__, 'footer_menu' ) );
 
46
  add_filter('widget_text', 'do_shortcode', 11);
47
- add_action('wp_enqueue_scripts',array(__CLASS__, 'enqueue_styles' ));
48
 
49
- $options = Footer_Credits_Options::get_options();
50
 
51
  //insert custom footer at specified hook
52
- if ($footer_hook = $options['footer_hook']) {
53
- if ($options['footer_remove']) {
54
- remove_all_actions( $footer_hook);
55
- if ($footer_hook =='wp_footer') {
56
- add_action( 'wp_footer', 'wp_print_footer_scripts', 20); //put back the footer scripts
57
- add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); //put back the admin bar
58
- }
59
- }
60
- add_action( $footer_hook, array(__CLASS__, 'custom_footer'));
61
  }
62
 
63
  //suppress footer output
64
- if ($ffs = $options['footer_filter_hook'])
65
- add_filter($ffs, array(__CLASS__, 'no_footer'),100);
66
 
67
- if (is_page('privacy') && Footer_Credits_Options::get_term('privacy_contact'))
68
- add_filter('the_content', array(__CLASS__, 'add_privacy_footer'),9 );
69
 
70
- if (is_page('terms') && Footer_Credits_Options::get_term('terms_contact'))
71
- add_filter('the_content', array(__CLASS__, 'add_terms_footer'),9 );
72
 
73
  if (is_page('terms') || is_page('privacy') || is_page('affiliates') || is_page('disclaimer'))
74
- add_filter('the_content', array(__CLASS__, 'terms_filter') );
75
 
76
  }
77
 
78
- public static function enqueue_styles() {
79
- wp_enqueue_style('footer-credits', plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(), FOOTER_PUTTER_VERSION);
 
 
 
 
 
 
 
 
80
  }
81
 
82
- public static function register_admin_styles() {
83
- wp_register_style('footer-credits-admin', plugins_url('styles/admin.css',dirname(__FILE__)), array(), FOOTER_PUTTER_VERSION);
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
- public static function enqueue_admin_styles() {
87
- wp_enqueue_style('footer-credits-admin');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
- public static function return_to_top( $text, $class) {
91
- 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);
92
  }
93
 
94
- private static function contact_info($params) {
95
  $org ='';
96
- if ($address = self::contact_address($params['show_address'], $params['use_microdata'], $params['separator'], $params['section_separator'])) $org .= $address;
97
- if ($telephone = self::contact_telephone($params['show_telephone'], $params['use_microdata'], $params['item_separator'])) $org .= $telephone;
98
- if ($email = self::contact_email($params['show_email'], $params['use_microdata'], $params['item_separator'])) $org .= $email;
99
- $format = '<span' . ($params['use_microdata'] ? ' itemscope="itemscope" itemtype="http://schema.org/Organization"' : '') . '>%1$s</span>';
100
- return sprintf($format, $org);
101
  }
102
 
103
- private static function contact_telephone($show_telephone, $microdata, $prefix) {
104
- if ($show_telephone && ($telephone = Footer_Credits_Options::get_term('telephone')))
105
  if ($microdata)
106
- return sprintf('%1$s<span itemprop="telephone" class="telephone">%2$s</span>', $prefix, $telephone) ;
107
  else
108
- return sprintf('%1$s<span class="telephone">%2$s</span>', $prefix, $telephone) ;
109
  else
110
  return '';
111
  }
112
 
113
- private static function contact_email($show_email, $microdata, $prefix) {
114
- if ($show_email && ($email = Footer_Credits_Options::get_term('email')))
115
- return apply_filters ( 'footer_putter_contact_email',
116
- sprintf('%1$s<a href="mailto:%2$s" class="email"%3$s>%2$s</a>', $prefix, $email, $microdata ? ' itemprop="email"' : '') );
117
  else
118
  return '';
119
  }
120
 
121
- private static function contact_address($show_address, $microdata, $separator, $prefix) {
122
  if ($show_address)
123
  if ($microdata) {
124
- return self::org_location($separator, $prefix);
125
- } elseif ($address = Footer_Credits_Options::get_term('address'))
126
- return sprintf('%1$s<span class="address">%2$s%3$s</span>', $prefix, self::format_address($address, $separator), Footer_Credits_Options::get_term('country'));
127
  return '';
128
  }
129
 
130
- private static function format_address ($address, $separator) {
131
  $s='';
132
  $addlines = explode(',', trim($address));
133
  foreach ($addlines as $a) {
@@ -137,28 +267,28 @@ class Footer_Credits {
137
  return $s;
138
  }
139
 
140
- private static function org_location($separator, $prefix) {
141
  $location = '';
142
- if ($loc_address = self::location_address( $separator)) $location .= $loc_address;
143
- if ($loc_geo = self::location_geo()) $location .= $loc_geo;
144
- if ($loc_map = self::location_map()) $location .= $loc_map;
145
  if ($location)
146
- return sprintf('%1$s<span itemprop="location" itemscope="itemscope" itemtype="http://schema.org/Place">%2$s</span>', $prefix, $location) ;
147
  else
148
  return '';
149
  }
150
 
151
- private static function location_address($separator) {
152
  $address = '';
153
- if ( $street_address = Footer_Credits_Options::get_term('street_address'))
154
- $address .= sprintf('<span itemprop="streetAddress">%1$s</span>', self::format_address($street_address, $separator)) ;
155
- if ( $locality = Footer_Credits_Options::get_term('locality'))
156
- $address .= sprintf('<span itemprop="addressLocality">%1$s</span>', self::format_address($locality, $separator)) ;
157
- if ( $region = Footer_Credits_Options::get_term('region'))
158
- $address .= sprintf('<span itemprop="addressRegion">%1$s</span>', self::format_address($region, $separator)) ;
159
- if ( $postal_code = Footer_Credits_Options::get_term('postal_code'))
160
- $address .= sprintf('<span itemprop="postalCode">%1$s</span>', self::format_address($postal_code, $separator)) ;
161
- if ( $country = Footer_Credits_Options::get_term('country'))
162
  $address .= sprintf('<span itemprop="addressCountry">%1$s</span>', $country) ;
163
 
164
  if ($address)
@@ -167,84 +297,93 @@ class Footer_Credits {
167
  return '';
168
  }
169
 
170
- private static function location_geo() {
171
  $geo = '';
172
- if ( $latitude = Footer_Credits_Options::get_term('latitude')) $geo .= sprintf('<meta itemprop="latitude" content="%1$s" />', $latitude) ;
173
- if ( $longitude = Footer_Credits_Options::get_term('longitude')) $geo .= sprintf('<meta itemprop="longitude" content="%1$s" />', $longitude) ;
174
  return $geo ? sprintf('<span itemprop="geo" itemscope="itemscope" itemtype="http://schema.org/GeoCoordinates">%1$s</span>', $geo) : '';
175
  }
176
 
177
- private static function location_map() {
178
- if ( $map = Footer_Credits_Options::get_term('map'))
179
  return sprintf('<a rel="nofollow external" target="_blank" class="map" itemprop="map" href="%1$s">%2$s</a>', $map, __('Map')) ;
180
  else
181
  return '';
182
  }
183
 
184
- public static function copyright_owner($params){
185
  return sprintf('<span class="copyright">%1$s %2$s</span>',
186
- Footer_Credits_Options::get_copyright($params['copyright_start_year']), $params['owner']);
187
  }
188
 
189
- public static function contact($atts = array()) {
190
- $all_defaults = Footer_Credits_Options::get_defaults();
191
  $defaults = array();
192
- $defaults['show_telephone'] = $all_defaults['show_telephone'];
193
- $defaults['show_email'] = $all_defaults['show_email'];
194
- $defaults['show_address'] = $all_defaults['show_address'];
195
- $defaults['use_microdata'] = $all_defaults['use_microdata'];
196
- $defaults['separator'] = $all_defaults['separator'];
197
- $defaults['item_separator'] = $all_defaults['item_separator'];
198
- $defaults['section_separator'] = $all_defaults['section_separator'];
199
- $defaults['footer_class'] = self::CODE;
200
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
201
- return sprintf ('<span class="%1$s">%2$s</span>', $params['footer_class'], self::contact_info($params));
202
  }
203
 
204
- public static function copyright($atts = array()){
205
  $defaults = array();
206
- $defaults['owner'] = Footer_Credits_Options::get_term('owner');
207
- $defaults['copyright_start_year'] = Footer_Credits_Options::get_term('copyright_start_year');
208
- $defaults['footer_class'] = self::CODE;
209
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
210
- return sprintf ('<span class="%1$s">%2$s</span>', $params['footer_class'], self::copyright_owner($params));
211
  }
212
 
213
- public static function footer_menu($atts = array()) {
214
  $defaults = array('menu' => 'Footer Menu', 'echo' => false, 'container' => false, 'footer_class' => self::CODE);
 
215
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
216
- return sprintf ('<span class="%1$s">%2$s</span>', $params['footer_class'], wp_nav_menu($params));
217
  }
218
 
219
- public static function footer($atts = array()) {
220
- $params = shortcode_atts( Footer_Credits_Options::get_options(), $atts ); //apply plugin defaults
221
 
222
  if ($params['center']) {
223
- if (! $params['two_lines']) $params['section_separator'] = $params['item_separator'];
224
- $params['return_class'] .= ' return-center';
225
- $params['footer_class'] .= ' footer-center';
226
  $clear = '';
227
  } else {
228
- if (! $params['two_lines']) $params['item_separator'] = $params['section_separator'] ;
229
- $params['return_class'] .= ' return-left';
230
- $params['footer_class'] .= ' footer-right';
231
  $clear = '<div class="clear"></div>';
232
  }
233
- $format = '<div id="%1$s" class="%2$s">%3$s%4$s%5$s</div>%6$s';
 
 
234
  return (empty($params['show_return']) ? '' :
235
- self::return_to_top($params['return_text'], $params['return_class'])) .
236
  sprintf($format,
 
 
 
237
  self::CODE,
238
- $params['footer_class'],
239
- (empty($params['nav_menu']) ? '' : self::footer_menu(array('menu' => $params['nav_menu']))),
240
- (empty($params['show_copyright']) ? '' : sprintf('%1$s%2$s', $params['item_separator'], self::copyright_owner(Footer_Credits_Options::get_terms()))),
241
- self::contact_info($params),
242
  $clear
243
  );
244
  }
245
 
246
- public static function terms_filter($content) {
247
- if ($terms = Footer_Credits_Options::get_terms()) {
 
 
 
 
 
 
 
 
 
 
248
  $from = array();
249
  $to = array();
250
  foreach ($terms as $term => $value) {
@@ -256,10 +395,10 @@ class Footer_Credits {
256
  return $content;
257
  }
258
 
259
- public static function custom_footer() {
260
  if ( is_active_sidebar( self::SIDEBAR_ID) ) {
261
- $class = 'custom-footer'. (Footer_Credits_Options::get_option('hide_wordpress') ? ' hide-wordpress' :'');
262
- if (self::is_html5()) {
263
  printf('<footer class="%1$s" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter">', $class);
264
  dynamic_sidebar( self::SIDEBAR_ID );
265
  echo '</footer><!-- end .custom-footer -->';
@@ -271,39 +410,48 @@ class Footer_Credits {
271
  }
272
  }
273
 
274
- public static function no_footer($content) { return ''; }
275
 
276
- public static function add_privacy_footer($content) {
277
- $terms = Footer_Credits_Options::get_terms();
278
- $email = $terms['email'];
 
 
279
  $contact = <<< PRIVACY
280
  <h2>How to Contact Us</h2>
281
- <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 {$terms['owner']} Privacy Office, {$terms['address']} {$terms['country']}. </p>
282
  PRIVACY;
283
  return (strpos($content,'%%') == FALSE) ? ($content . $contact) : $content;
284
  }
285
 
286
- public static function add_terms_footer($content) {
287
- $terms = Footer_Credits_Options::get_terms();
 
 
 
 
 
 
 
288
  $disputes = <<< DISPUTES
289
  <h2>Dispute Resolution</h2>
290
- <p>These terms, and any dispute arising from the use of this site, will be governed by {$terms['courts']} without regard to its conflicts of laws provisions.</p>
291
  DISPUTES;
292
- $feedback = <<< FEEDBACK
293
  <h2>Feedback And Information</h2>
294
- <p>Any feedback you provide at this site shall be deemed to be non-confidential. {$terms['owner']} shall be free to use such information on an unrestricted basis.</p>
295
  <p>The terms and conditions for this web site are subject to change without notice.<p>
296
- <p>{$terms['copyright']} {$terms['owner']} All rights reserved.<br/> {$terms['owner']}, {$terms['address']} {$terms['country']}</p>
297
- <p>Updated by The {$terms['owner']} Legal Team on {$terms['updated']}</p>
298
- FEEDBACK;
299
  if (strpos($content,'%%') == FALSE) {
300
- $content .= $terms['courts'] ? $disputes : '';
301
- $content .= $terms['address'] ? $feedback : '';
302
  }
303
  return $content ;
304
  }
305
 
306
- public static function fix_home_link( $content, $args) {
307
  $class = is_front_page()? ' class="current_page_item"' : '';
308
  $home_linktexts = array('Home','<span>Home</span>');
309
  foreach ($home_linktexts as $home_linktext) {
@@ -314,5 +462,47 @@ FEEDBACK;
314
  return $content;
315
  }
316
 
317
- }
 
 
 
 
318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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' => '',
13
+ 'street_address' => '',
14
+ 'locality' => '',
15
+ 'region' => '',
16
+ 'postal_code' => '',
17
+ 'country' => '',
18
+ 'latitude' => '',
19
+ 'longitude' => '',
20
+ 'map' => '',
21
+ 'email' => '',
22
+ 'telephone' => '',
23
+ 'copyright' => '',
24
+ 'copyright_start_year' => '',
25
+ 'copyright_preamble' => '',
26
+ 'courts' => '',
27
+ 'updated' => '',
28
+ 'privacy_contact' => '',
29
+ 'terms_contact' => ''),
30
+ 'nav_menu' => 0,
31
+ 'center' => true,
32
+ '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'))
136
+ add_filter('the_content', array($this, 'terms_filter') );
137
 
138
  }
139
 
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
204
+ }
205
+ return $default;
206
+ }
207
+
208
+ private function get_default_site() {
209
+ $domain = strtolower(parse_url(site_url(),PHP_URL_HOST));
210
+ $p = strpos($domain,'www.') ;
211
+ if (($p !== FALSE) && ($p == 0)) $domain = substr($domain,4);
212
+ return $domain;
213
+ }
214
+
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
239
+ return sprintf('<span class="telephone">%1$s</span>', $telephone) ;
240
  else
241
  return '';
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 '';
249
  }
250
 
251
+ private function contact_address($show_address, $microdata, $separator) {
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
 
260
+ private function format_address ($address, $separator) {
261
  $s='';
262
  $addlines = explode(',', trim($address));
263
  foreach ($addlines as $a) {
267
  return $s;
268
  }
269
 
270
+ private function org_location($separator) {
271
  $location = '';
272
+ if ($loc_address = $this->location_address( $separator)) $location .= $loc_address;
273
+ if ($loc_geo = $this->location_geo()) $location .= $loc_geo;
274
+ if ($loc_map = $this->location_map()) $location .= $loc_map;
275
  if ($location)
276
+ return sprintf('<span itemprop="location" itemscope="itemscope" itemtype="http://schema.org/Place">%1$s</span>', $location) ;
277
  else
278
  return '';
279
  }
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)
297
  return '';
298
  }
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 '';
312
  }
313
 
314
+ public function copyright_owner($params){
315
  return sprintf('<span class="copyright">%1$s %2$s</span>',
316
+ $this->get_copyright($params['copyright_start_year']), $params['owner']);
317
  }
318
 
319
+ public function contact($atts = array()) {
 
320
  $defaults = array();
321
+ $defaults['show_telephone'] = $this->defaults['show_telephone'];
322
+ $defaults['show_email'] = $this->defaults['show_email'];
323
+ $defaults['show_address'] = $this->defaults['show_address'];
324
+ $defaults['use_microdata'] = $this->defaults['use_microdata'];
325
+ $defaults['separator'] = $this->defaults['separator'];
326
+ $defaults['footer_class'] = '';
 
 
327
  $params = shortcode_atts( $defaults, $atts ); //apply plugin defaults
328
+ return $this->contact_info($params);
329
  }
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
  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 -->';
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>
423
  PRIVACY;
424
  return (strpos($content,'%%') == FALSE) ? ($content . $contact) : $content;
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>
439
  DISPUTES;
440
+ $terms = <<< TERMS
441
  <h2>Feedback And Information</h2>
442
+ <p>Any feedback you provide at this site shall be deemed to be non-confidential. {$owner} shall be free to use such information on an unrestricted basis.</p>
443
  <p>The terms and conditions for this web site are subject to change without notice.<p>
444
+ <p>{$copyright} {$owner} All rights reserved.<br/> {$owner}, {$address} {$country}</p>
445
+ <p>Updated by The {$owner} Legal Team on {$updated}</p>
446
+ TERMS;
447
  if (strpos($content,'%%') == FALSE) {
448
+ $content .= $courts ? $disputes : '';
449
+ $content .= $address ? $terms : '';
450
  }
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) {
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
+ }
classes/class-dashboard.php CHANGED
@@ -4,37 +4,36 @@ class Footer_Putter_Dashboard extends Footer_Putter_Admin {
4
  function init() {
5
  add_action('admin_menu', array($this, 'admin_menu'));
6
  add_action('load-widgets.php', array($this, 'add_tooltip_support'));
7
- add_action('admin_enqueue_scripts', array($this ,'register_tooltip_styles'));
8
- add_action('admin_enqueue_scripts', array($this ,'register_admin_styles'));
9
  add_filter('plugin_action_links',array($this, 'plugin_action_links'), 10, 2 );
10
  }
11
 
12
  function admin_menu() {
13
- $intro = sprintf('Intro (v%1$s)', $this->get_version());
14
- $this->screen_id = add_menu_page(FOOTER_PUTTER_FRIENDLY_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'manage_options',
15
- $this->get_slug(), array($this,'page_content'), FOOTER_PUTTER_ICON );
16
- add_submenu_page($this->get_slug(), FOOTER_PUTTER_FRIENDLY_NAME, $intro, 'manage_options', $this->get_slug(), array($this,'page_content') );
17
- add_action('load-'.$this->get_screen_id(), array($this, 'load_page'));
 
 
18
  }
19
 
20
  function page_content() {
21
- $title = $this->admin_heading('Footer Putter v'. $this->get_version(), FOOTER_PUTTER_ICON);
22
- $this->print_admin_form_with_sidebar($title, __CLASS__);
23
  }
24
 
25
  function load_page() {
26
  $this->add_tooltip_support();
27
- add_action('admin_enqueue_scripts', array($this, 'register_admin_styles'));
28
- add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
29
- add_action('admin_enqueue_scripts', array($this, 'enqueue_metabox_scripts'));
30
- add_action('admin_enqueue_scripts', array($this, 'enqueue_postbox_scripts'));
31
  $this->add_meta_box('intro', 'Introduction', 'intro_panel');
32
  $this->add_meta_box('details','Details', 'footer_panel');
33
- $this->add_meta_box('news', 'DIY Webmastery News', 'news_panel', null, 'side');
 
34
  }
35
 
36
- function footer_panel() {
37
- $this->display_metabox( array(
38
  'Widgets' => $this->widgets_panel(),
39
  'Instructions' => $this->instructions_panel(),
40
  'Footer Hook' => $this->hooks_panel(),
@@ -43,8 +42,8 @@ class Footer_Putter_Dashboard extends Footer_Putter_Admin {
43
  }
44
 
45
 
46
- function intro_panel() {
47
- $plugin = FOOTER_PUTTER_FRIENDLY_NAME;
48
  print <<< INTRO_PANEL
49
  <p>{$plugin} allows you to put a footer to your site that adds credibility to your site, with BOTH visitors and search engines.</p>
50
  <p>Google is looking for some indicators that the site is about a real business.</p>
@@ -73,10 +72,10 @@ WIDGETS_PANEL;
73
  }
74
 
75
  function instructions_panel() {
76
- $plugin = FOOTER_PUTTER_FRIENDLY_NAME;
77
  $widgets_url = admin_url('widgets.php');
78
- $credits_url = Footer_Putter_Plugin::get_link_url('credits');
79
- $trademarks_url = Footer_Putter_Plugin::get_link_url('trademarks');
80
  return <<< INSTRUCTIONS_PANEL
81
  <h4>Create Standard Pages And Footer Menu</h4>
82
  <ol>
@@ -113,8 +112,8 @@ INSTRUCTIONS_PANEL;
113
  }
114
 
115
  function hooks_panel() {
116
- $home_url = FOOTER_PUTTER_HOME_URL;
117
- $plugin = FOOTER_PUTTER_FRIENDLY_NAME;
118
  return <<< HOOKS_PANEL
119
  <p>The footer hook is only required if your theme does not already have a footer widget area into which you can drag the two widgets.</p>
120
  <p>For some themes, the footer hook is left blank, for others use a WordPress hook such as <i>get_footer</i> or <i>wp_footer</i>,
@@ -124,13 +123,13 @@ HOOKS_PANEL;
124
  }
125
 
126
  function links_panel() {
127
- $home = FOOTER_PUTTER_HOME_URL;
128
  return <<< LINKS_PANEL
129
  <ul>
130
- <li><a rel="external" href="{$home}">Footer Putter Plugin Home</a></li>
131
- <li><a rel="external" href="http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks/">Themes and Recommended Footer Hooks</a></li>
132
- <li><a rel="external" href="http://www.diywebmastery.com/4098/how-to-add-a-different-footer-on-landing-pages/">How To Use A Different Footer On Landing Pages</a></li>
133
- <li><a rel="external" href="http://www.diywebmastery.com/4109/using-html5-microdata-footer/">Using HTML5 Microdata for better SEO and Local Search</a></li>
134
  </ul>
135
  LINKS_PANEL;
136
  }
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(),
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>
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>
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>,
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
  }
classes/{class-feed-widget.php → class-news.php} RENAMED
@@ -1,37 +1,54 @@
1
  <?php
2
- if (!class_exists('Footer_Putter_Feed_Widget')) {
3
- class Footer_Putter_Feed_Widget extends WP_Widget_RSS {
4
-
5
- function __construct() {
6
- $widget_ops = array( 'description' => __('Displays Featured image in place of title in any RSS or Atom feed.') );
7
- $control_ops = array( 'width' => 400, 'height' => 200 );
8
- parent::__construct( 'footer-putter-feed', __('Footer Putter Feed'), $widget_ops, $control_ops );
 
 
 
 
 
 
9
  }
10
 
11
- function widget($args, $instance) {
12
-
13
- if ( isset($instance['error']) && $instance['error'] )
14
- return;
15
-
16
- $title = $instance['title'];
17
- $desc = '';
18
- $link = '';
19
-
20
- /** This filter is documented in wp-includes/default-widgets.php */
21
- $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
22
-
23
- echo $args['before_widget'];
24
-
25
- if ( $title ) {
26
- echo $args['before_title'] . $title . $args['after_title'];
 
 
27
  }
 
28
 
29
- self::rss_output($instance );
30
-
31
- echo $args['after_widget'];
 
 
 
 
 
 
 
 
32
  }
33
 
34
- static function rss_output( $instance ) {
35
 
36
  $url = ! empty( $instance['url'] ) ? $instance['url'] : '';
37
 
@@ -52,7 +69,7 @@ if (!class_exists('Footer_Putter_Feed_Widget')) {
52
  return;
53
  }
54
 
55
- $default_args = array( 'show_featured' => 0, 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0 );
56
 
57
  if (($parsed_url = parse_url($url))
58
  && ($query = isset($parsed_url['query']) ? $parsed_url['query'] : '')) {
@@ -70,9 +87,9 @@ if (!class_exists('Footer_Putter_Feed_Widget')) {
70
  $show_date = (int) $args['show_date'];
71
 
72
  if ( !$rss->get_item_quantity() ) {
73
- echo '<div>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</div>';
74
- return;
75
  }
 
76
 
77
  foreach ( $rss->get_items( 0, $items ) as $item ) {
78
  $link = $item->get_link();
@@ -126,32 +143,14 @@ if (!class_exists('Footer_Putter_Feed_Widget')) {
126
  }
127
  }
128
 
129
- if ( $link == '' )
130
- $format = '<span>%3$s</span>%4$s%6$s';
131
- elseif ( $show_summary )
132
- $format = '<span><a class="rsswidget" href="%1$s"%2$s>%3$s</a></span>%4$s%5$s%6$s';
133
- else
134
- $format = '<span><a class="rsswidget" href="%1$s"%2$s>%3$s</a></span>%4$s%6$s';
135
-
136
- printf('<span class="diy-image-feed-widget-item">'.$format.'</span>', $link, $link_title, $title, $date, $summary, $author );
137
  }
138
 
139
  if ( ! is_wp_error($rss) )
140
  $rss->__destruct();
141
  unset($rss);
 
142
  }
143
 
144
- static function display_feeds($feeds = false) {
145
- if (false == $feeds) $feeds = array(FOOTER_PUTTER_NEWS);
146
- if (is_array($feeds) && (count($feeds) > 0)) {
147
- echo '<div class="diy-image-feed-widget">';
148
- foreach( $feeds as $url ) {
149
- $args = array('url' => $url, 'show_summary' => true, 'show_featured' => true);
150
- self::rss_output( $args );
151
- }
152
- echo "</div>";
153
- }
154
- }
155
-
156
- }
157
  }
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';
14
+ add_action( 'wp_ajax_'.$this->script_var, array($this, 'get_feeds_ajax') );
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' ),
22
+ 'ajaxnonce' => wp_create_nonce( $this->script_var.'_nonce' ),
23
+ 'ajaxaction' => $this->script_var,
24
+ 'ajaxresults' => '.'.$this->results
25
+ )
26
+ );
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++ ) {
33
+ wp_localize_script( $this->handle, $this->script_var.$index, array( 'feedurl' => $feeds[$index]) );
34
+ }
35
  }
36
+ }
37
 
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 ) {
52
 
53
  $url = ! empty( $instance['url'] ) ? $instance['url'] : '';
54
 
69
  return;
70
  }
71
 
72
+ $default_args = array( 'show_featured' => 0, 'show_summary' => 0, 'show_author' => 0, 'show_date' => 0, 'items' => 0 );
73
 
74
  if (($parsed_url = parse_url($url))
75
  && ($query = isset($parsed_url['query']) ? $parsed_url['query'] : '')) {
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
 
94
  foreach ( $rss->get_items( 0, $items ) as $item ) {
95
  $link = $item->get_link();
143
  }
144
  }
145
 
146
+ if ($link) $title = sprintf('<a target="_blank" class="rsswidget" href="%1$s"%2$s>%3$s</a>', $link, $link_title, $title);
147
+ $results .= sprintf('<div class="%5$s-item"><div>%1$s</div>%2$s%3$s%4$s</div>', $title, $date, $summary, $author, $this->results );
 
 
 
 
 
 
148
  }
149
 
150
  if ( ! is_wp_error($rss) )
151
  $rss->__destruct();
152
  unset($rss);
153
+ return $results;
154
  }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
classes/{class-diy-options.php → class-options.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- class Footer_Putter_DIY_Options {
3
 
4
  protected $option_name;
5
  protected $options = array();
@@ -13,9 +13,11 @@ class Footer_Putter_DIY_Options {
13
  }
14
 
15
  function add_defaults($more = array()) {
16
- $this->defaults = array_merge($this->defaults, (array)$more);
17
- $this->options = array(); //clear cache
18
- }
 
 
19
 
20
  function get_defaults() {
21
  return $this->defaults;
@@ -44,9 +46,12 @@ class Footer_Putter_DIY_Options {
44
  function get_option($option_name, $cache = true) {
45
  $options = $this->get_options($cache);
46
  if ($option_name && $options && array_key_exists($option_name,$options))
 
 
 
47
  return $options[$option_name];
48
  else
49
- return false;
50
  }
51
 
52
  function save_options($new_options) {
@@ -59,29 +64,31 @@ class Footer_Putter_DIY_Options {
59
  }
60
 
61
  function validate_options($defaults, $options ) {
62
- if (is_array($options) && is_array($defaults) )
 
63
  return shortcode_atts($defaults, $options);
64
  else
 
 
65
  return false;
66
  }
67
 
68
  function upgrade_options() {
 
69
  $new_options = array();
70
  $defaults = $this->get_defaults();
71
- $options = get_option($this->get_option_name());
72
 
73
- if (is_array($options)) {
74
- /* Remove old options and set defaults for new options */
75
  foreach ($defaults as $key => $subdefaults)
76
- if (array_key_exists($key, $options))
77
- if (is_array($options[$key]) && is_array($subdefaults))
78
- $new_options[$key] = shortcode_atts($subdefaults, $options[$key]);
79
  else
80
- $new_options[$key] = $options[$key];
81
  } else {
82
  $new_options = $defaults;
83
  }
84
  $this->save_options($new_options);
85
  }
86
-
87
  }
1
  <?php
2
+ class Footer_Putter_Options {
3
 
4
  protected $option_name;
5
  protected $options = array();
13
  }
14
 
15
  function add_defaults($more = array()) {
16
+ if ($more) {
17
+ $this->defaults = array_merge($this->defaults, (array)$more);
18
+ $this->options = array(); //clear cache
19
+ }
20
+ }
21
 
22
  function get_defaults() {
23
  return $this->defaults;
46
  function get_option($option_name, $cache = true) {
47
  $options = $this->get_options($cache);
48
  if ($option_name && $options && array_key_exists($option_name,$options))
49
+ if (($defaults = $this->get_default($option_name)) && is_array($defaults) && is_array($options[$option_name]))
50
+ return $this->validate_options($defaults, $options[$option_name]);
51
+ else
52
  return $options[$option_name];
53
  else
54
+ return $this->get_default($option_name);
55
  }
56
 
57
  function save_options($new_options) {
64
  }
65
 
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;
74
  }
75
 
76
  function upgrade_options() {
77
+ /* Remove old options and set defaults for new options */
78
  $new_options = array();
79
  $defaults = $this->get_defaults();
80
+ $old_options = get_option($this->get_option_name());
81
 
82
+ if (is_array($old_options)) {
 
83
  foreach ($defaults as $key => $subdefaults)
84
+ if (array_key_exists($key, $old_options))
85
+ if (is_array($old_options[$key]) && is_array($subdefaults))
86
+ $new_options[$key] = shortcode_atts($subdefaults, $old_options[$key]);
87
  else
88
+ $new_options[$key] = $old_options[$key];
89
  } else {
90
  $new_options = $defaults;
91
  }
92
  $this->save_options($new_options);
93
  }
 
94
  }
classes/class-plugin.php CHANGED
@@ -1,41 +1,133 @@
1
  <?php
2
  class Footer_Putter_Plugin {
3
 
4
- protected static $links = array();
5
 
6
- public static function get_link_url($key) {
7
- if (array_key_exists($key, self::$links))
8
- return self::$links[$key];
9
- else
10
- return ('#');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
 
 
 
 
12
 
13
- public static function init() {
 
 
 
14
  $dir = dirname(__FILE__) . '/';
15
  require_once($dir . 'class-utils.php');
16
- require_once($dir . 'class-diy-options.php');
17
- require_once($dir . 'class-credits-options.php');
 
18
  require_once($dir . 'class-credits.php');
19
  require_once($dir . 'class-credits-widgets.php');
20
  require_once($dir . 'class-trademarks-widgets.php');
21
- Footer_Credits_Options::init();
22
- Footer_Credits::init();
 
 
23
  }
24
 
25
- public static function admin_init() {
26
  $dir = dirname(__FILE__) . '/';
27
  require_once($dir . 'class-tooltip.php');
28
  require_once($dir . 'class-admin.php');
29
- require_once($dir . 'class-feed-widget.php');
30
- require_once($dir . 'class-dashboard.php');
31
  require_once($dir . 'class-credits-admin.php');
32
  require_once($dir . 'class-trademarks-admin.php');
33
- $intro = new Footer_Putter_Dashboard(FOOTER_PUTTER_VERSION, FOOTER_PUTTER_PATH, FOOTER_PUTTER_PLUGIN_NAME);
34
- self::$links['intro'] = $intro->get_url();
35
- $credits = new Footer_Credits_Admin(FOOTER_PUTTER_VERSION, FOOTER_PUTTER_PATH, FOOTER_PUTTER_PLUGIN_NAME,'credits');
36
- self::$links['credits'] = $credits->get_url();
37
- $trademarks = new Footer_Trademarks_Admin(FOOTER_PUTTER_VERSION, FOOTER_PUTTER_PATH, FOOTER_PUTTER_PLUGIN_NAME,'trademarks');
38
- self::$links['trademarks'] = $trademarks->get_url();
 
39
  }
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
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
  }
34
+
35
+ protected function __construct() {}
36
+
37
+ private function __clone() {}
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;
76
+ }
77
+
78
+ public function get_home(){
79
+ return $this->home;
80
+ }
81
+
82
+ public function get_icon(){
83
+ return $this->icon;
84
+ }
85
+
86
+ public function get_name(){
87
+ return $this->name;
88
+ }
89
+
90
+ public function get_news(){
91
+ return $this->news;
92
+ }
93
+
94
+ public function get_newsfeeds(){
95
+ return $this->newsfeeds;
96
+ }
97
+
98
+ public function get_options(){
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
+ }
110
+
111
+ public function get_tooltips(){
112
+ return $this->tooltips;
113
+ }
114
+
115
+ public function get_utils(){
116
+ return $this->utils;
117
+ }
118
+
119
+ public function get_version(){
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
  }
classes/class-tooltip.php CHANGED
@@ -6,8 +6,12 @@ class Footer_Putter_Tooltip {
6
  private $labels = array();
7
  private $tabindex;
8
 
9
- function __construct($labels) {
10
- $this->labels = is_array($labels) ? $labels : array();
 
 
 
 
11
  $this->tabindex = 100;
12
  }
13
 
6
  private $labels = array();
7
  private $tabindex;
8
 
9
+ function __construct($labels=array()) {
10
+ $this->init($labels);
11
+ }
12
+
13
+ function init($labels) {
14
+ $this->labels += is_array($labels) ? $labels : array();
15
  $this->tabindex = 100;
16
  }
17
 
classes/class-trademarks-admin.php CHANGED
@@ -13,29 +13,22 @@ class Footer_Trademarks_Admin extends Footer_Putter_Admin{
13
  }
14
 
15
  public function page_content() {
16
- $title = $this->admin_heading('Footer Trademarks', FOOTER_PUTTER_ICON);
17
- $this->print_admin_form_with_sidebar($title, __CLASS__);
18
  }
19
 
20
  public function load_page() {
21
  $this->add_tooltip_support();
22
- add_action ('admin_enqueue_scripts',array($this, 'enqueue_admin_styles'));
23
- add_action ('admin_enqueue_scripts',array($this, 'enqueue_metabox_scripts'));
24
- add_action ('admin_enqueue_scripts',array($this, 'enqueue_postbox_scripts'));
25
  $this->add_meta_box('intro', 'Instructions', 'intro_panel');
26
  $this->add_meta_box('trademarks', 'Trademarks', 'trademarks_panel');
27
- $this->add_meta_box('news', 'DIY Webmastery News', 'news_panel',null, 'side');
28
  }
29
 
30
- function trademarks_panel() {
31
- $this->display_metabox( array(
32
- 'Tips' => $this->tips_panel(),
33
- 'Screenshots' => $this->screenshots_panel()
34
- ));
35
- }
36
 
37
-
38
- public function intro_panel() {
39
  $linkcat = admin_url('edit-tags.php?taxonomy=link_category');
40
  $addlink = admin_url('link-add.php');
41
  $widgets = admin_url('widgets.php');
@@ -53,10 +46,10 @@ INTRO;
53
 
54
  public function tips_panel() {
55
  return <<< TIPS
56
- <h4>Image File Size</h4>
57
  <p>The plugin uses each trademark image "as is" so you need to provide trademark images that are suitably sized. </p>
58
  <p>For a consistent layout make sure all images are the same height. A typical height will be of the order of 50px to 100px depending on how prominently you want them to feature.</p>
59
- <h4>Image File Type</h4>
60
  <p>If your trademark images are JPG files on a white background, and your footer has a white background then using JPGs will be fine. Otherwise your footer look better if you use PNG files that have a transparent background</p>
61
  TIPS;
62
  }
@@ -71,10 +64,6 @@ TIPS;
71
  <h4>Add A Link</h4>
72
  <p><img class="dashed-border" src="{$img2}" alt="Screenshot of adding a trademark link " /></p>
73
  SCREENSHOTS;
74
- }
75
-
76
- function news_panel($post,$metabox){
77
- Footer_Putter_Feed_Widget::display_feeds();
78
  }
79
 
80
  }
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');
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
  }
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
  }
classes/class-trademarks-widgets.php CHANGED
@@ -1,29 +1,19 @@
1
  <?php
2
 
3
- class Footer_Putter_Trademark_Widget extends WP_Widget {
4
 
5
- private $instance;
6
- private $tooltips;
7
 
8
  private $tips = array(
9
  'title' => array('heading' => 'Title', 'tip' => 'Widget Title'),
10
  'category' => array('heading' => 'Category', 'tip' => 'Select Link Category for Your Trademarks'),
11
  'limit' => array('heading' => '# of links', 'tip' => 'Number of trademarks to show'),
12
  'orderby' => array('heading' => 'Order By', 'tip' => 'Sort by name, rating, ID or random'),
13
- 'nofollow' => array('heading' => 'Make Links Nofollow', 'tip' => 'Mark the links with rel=nofollow'),
14
  'visibility' => array('heading' => 'Show or Hide', 'tip' => 'Determine on which pages the footer widget is displayed'),
15
  );
16
 
17
  private $defaults = array( 'title' => '',
18
  'category' => false, 'limit' => '', 'orderby' => 'name', 'nofollow' => false, 'visibility' => '');
19
-
20
- function get_tips() {
21
- return $this->tips;
22
- }
23
-
24
- function get_defaults() {
25
- return $this->defaults;
26
- }
27
 
28
  function __construct() {
29
  add_filter('pre_option_link_manager_enabled', '__return_true' );
@@ -54,7 +44,7 @@ class Footer_Putter_Trademark_Widget extends WP_Widget {
54
  function widget( $args, $instance ) {
55
  extract($args, EXTR_SKIP);
56
  $instance = wp_parse_args( (array) $instance, $this->defaults );
57
- if (Footer_Putter_Utils::hide_widget($instance['visibility'])) return; //check visibility requirements
58
 
59
  $title = apply_filters('widget_title', $instance['title'] );
60
  $category = isset($instance['category']) ? $instance['category'] : false;
@@ -99,9 +89,8 @@ class Footer_Putter_Trademark_Widget extends WP_Widget {
99
  }
100
 
101
  function form( $instance ) {
102
- $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
103
- $this->tooltips = new Footer_Putter_Tooltip($this->get_tips());
104
- print '<div class="diy-wrap">';
105
  $links = array();
106
  $link_cats = get_terms( 'link_category' );
107
  foreach ( $link_cats as $link_cat ) {
@@ -117,16 +106,11 @@ class Footer_Putter_Trademark_Widget extends WP_Widget {
117
  'rand' => __( 'Random')
118
  ));
119
  $this->print_form_field('limit', 'text', array(), array('size' => 3 ,'maxlength' => 3));
120
- $this->print_form_field('nofollow', 'checkbox');
121
- print ('<hr/><h4>Widget Presence</h4>');
122
- $this->print_form_field('visibility', 'radio',
123
- Footer_Putter_Utils::get_visibility_options(), array('separator' => '<br />'));
124
- print '</div>';
125
  }
126
 
127
- function print_form_field ($fld, $type, $options = array(), $args = array()) {
128
- $value = array_key_exists($fld,$this->instance) ? $this->instance[$fld] : false;
129
- print Footer_Putter_Utils::form_field(
130
- $this->get_field_id($fld), $this->get_field_name($fld), $this->tooltips->tip($fld), $value, $type, $options, $args,'br');
131
- }
132
  }
1
  <?php
2
 
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' );
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;
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' );
96
  foreach ( $link_cats as $link_cat ) {
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
 
 
 
 
 
 
116
  }
classes/class-utils.php CHANGED
@@ -1,15 +1,56 @@
1
  <?php
2
  class Footer_Putter_Utils {
3
 
4
- static protected $is_html5 = null;
 
5
 
6
- static function is_html5() {
7
- if (self::$is_html5 == null)
8
- self::$is_html5 = function_exists('current_theme_supports') && current_theme_supports('html5');
9
- return self::$is_html5;
 
 
 
 
 
 
 
10
  }
11
 
12
- static function get_post_id() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  global $post;
14
 
15
  if (is_object($post)
@@ -20,7 +61,172 @@ class Footer_Putter_Utils {
20
  return false;
21
  }
22
 
23
- static function post_has_shortcode($shortcode, $attribute = false) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  global $wp_query;
25
  if (isset($wp_query)
26
  && isset($wp_query->post)
@@ -35,17 +241,23 @@ class Footer_Putter_Utils {
35
  return false;
36
  }
37
 
38
- static function get_meta ($post_id, $key) {
39
- if ($post_id && $key
40
- && ($meta = get_post_meta($post_id, $key, true))
41
- && ($options = (is_serialized($meta) ? @unserialize($meta) : $meta))
42
- && (is_array($options) || is_string($options)))
43
- return $options;
44
- else
45
- return false;
46
- }
 
 
 
 
 
 
47
 
48
- static function json_encode($params) {
49
  //fix numerics and booleans
50
  $pat = '/(\")([0-9]+)(\")/';
51
  $rep = '\\2';
@@ -53,14 +265,18 @@ class Footer_Putter_Utils {
53
  preg_replace($pat, $rep, json_encode($params)));
54
  }
55
 
56
- static function is_mobile_device() {
 
 
 
57
  return preg_match("/wap.|.wap/i", $_SERVER["HTTP_ACCEPT"])
58
- || preg_match("/iphone|ipad/i", $_SERVER["HTTP_USER_AGENT"]);
 
59
  }
60
 
61
- static function is_landing_page($page_template='') {
62
  if (empty($page_template)
63
- && ($post_id = self::get_post_id()))
64
  $page_template = get_post_meta($post_id,'_wp_page_template',TRUE);
65
 
66
  if (empty($page_template)) return false;
@@ -69,50 +285,51 @@ class Footer_Putter_Utils {
69
  return in_array($page_template, $landing_pages );
70
  }
71
 
72
- static function hide_widget($visibility ) {
73
- $hide = false;
74
- $is_landing = self::is_landing_page();
75
- switch ($visibility) {
76
- case 'hide_landing' : $hide = $is_landing; break; //hide only on landing pages
77
- case 'show_landing' : $hide = ! $is_landing; break; //hide except on landing pages
78
- }
79
- return $hide;
80
- }
81
-
82
- static function get_visibility_options(){
83
- return array(
84
- '' => 'Show on all pages',
85
- 'hide_landing' => 'Hide on landing pages',
86
- 'show_landing' => 'Show only on landing pages');
87
  }
88
 
89
- static function selector($fld_id, $fld_name, $value, $options, $multiple = false) {
 
 
 
 
 
90
  $input = '';
91
  if (is_array($options)) {
92
  foreach ($options as $optkey => $optlabel)
93
  $input .= sprintf('<option%1$s value="%2$s">%3$s</option>',
94
- selected($optkey, $value, false), $optkey, $optlabel);
 
95
  } else {
96
  $input = $options;
97
  }
98
- return sprintf('<select id="%1$s" name="%2$s"%4$s>%3$s</select>', $fld_id, $fld_name, $input, $multiple ? ' multiple':'');
99
  }
100
 
101
- static function form_field($fld_id, $fld_name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
102
  if ($args) extract($args);
103
  $input = '';
104
  $label = sprintf('<label class="diy-label" for="%1$s">%2$s</label>', $fld_id, __($label));
105
  switch ($type) {
106
- case 'text':
107
  case 'password':
108
- $input .= sprintf('<input type="%9$s" id="%1$s" name="%2$s" value="%3$s" %4$s%5$s%6$s%7$s /> %8$s',
109
- $fld_id, $fld_name, $value,
 
110
  isset($readonly) ? (' readonly="'.$readonly.'"') : '',
111
  isset($size) ? (' size="'.$size.'"') : '',
112
  isset($maxlength) ? (' maxlength="'.$maxlength.'"') : '',
113
  isset($class) ? (' class="'.$class.'"') : '',
114
- isset($suffix) ? $suffix : '',
115
- $type);
 
 
116
  break;
117
  case 'file':
118
  $input .= sprintf('<input type="file" id="%1$s" name="%2$s" value="%3$s" %4$s%5$s%6$s accept="image/*" />',
@@ -127,7 +344,7 @@ class Footer_Putter_Utils {
127
  isset($readonly) ? (' readonly="'.$readonly.'"') : '',
128
  isset($rows) ? (' rows="'.$rows.'"') : '',
129
  isset($cols) ? (' cols="'.$cols.'"') : '',
130
- isset($class) ? (' class="'.$class.'"') : '', $value);
131
  break;
132
  case 'checkbox':
133
  if (is_array($options) && (count($options) > 0)) {
@@ -167,7 +384,12 @@ class Footer_Putter_Utils {
167
  }
168
  break;
169
  case 'select':
170
- $input = self::selector($fld_id, $fld_name, $value, $options, isset($multiple));
 
 
 
 
 
171
  break;
172
  case 'hidden': return sprintf('<input type="hidden" name="%1$s" value="%2$s" />', $fld_name, $value);
173
  default: $input = $value;
@@ -177,18 +399,64 @@ class Footer_Putter_Utils {
177
  case 'tr': $format = '<tr class="diy-row"><th scope="row">%1$s</th><td>%2$s</td></tr>'; break;
178
  case 'br': $format = 'checkbox'==$type ? '%2$s%1$s<br/>' : '%1$s%2$s<br/>'; break;
179
  default: $format = strpos($input,'fieldset') !== FALSE ?
180
- '<div class="wrapfieldset">%1$s%2$s</div>' : ('<'.$wrap.'>%1$s%2$s</'.$wrap.'>');
181
  }
182
  return sprintf($format, $label, $input);
183
  }
184
-
185
- static function register_tooltip_styles() {
186
- wp_register_style('diy-tooltip', plugins_url('styles/tooltip.css',dirname(__FILE__)), array(), null);
187
- }
188
 
189
- static function enqueue_tooltip_styles() {
190
- wp_enqueue_style('diy-tooltip');
191
- wp_enqueue_style('dashicons');
 
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }
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'); }
10
+ function get_post_meta_key() { return $this->get_metakey('post_meta'); }
11
+ function get_term_meta_key() { return $this->get_metakey('term_meta'); }
12
+ function get_user_meta_key() { return $this->get_metakey('user_meta'); }
13
+
14
+ function is_html5() {
15
+ if ($this->is_html5 == null)
16
+ $this->is_html5 = function_exists('current_theme_supports') && current_theme_supports('html5');
17
+ return $this->is_html5;
18
  }
19
 
20
+ function is_yoast_installed() {
21
+ return defined('WPSEO_VERSION');
22
+ }
23
+
24
+ function is_seo_framework_installed() {
25
+ return defined('THE_SEO_FRAMEWORK_VERSION');
26
+ }
27
+
28
+ function get_current_term() {
29
+ if (is_tax() || is_category() || is_tag()) {
30
+ if (is_category())
31
+ $term = get_term_by('slug',get_query_var('category_name'),'category') ;
32
+ elseif (is_tag())
33
+ $term = get_term_by('slug',get_query_var('tag'),'post_tag') ;
34
+ else {
35
+ if ($obj = get_queried_object())
36
+ $term = get_term_by('slug', $obj->slug, $obj->taxonomy) ;
37
+ else
38
+ $term = false;
39
+ }
40
+ } else {
41
+ $term = false;
42
+ }
43
+ return $term;
44
+ }
45
+
46
+ function get_term_id() {
47
+ if (is_archive() && ($term = $this->get_current_term()))
48
+ return $term->term_id;
49
+ else
50
+ return false;
51
+ }
52
+
53
+ function get_post_id() {
54
  global $post;
55
 
56
  if (is_object($post)
61
  return false;
62
  }
63
 
64
+ function get_meta($type, $id, $key = false, $result= false) {
65
+ switch ($type) {
66
+ case 'home': return $this->get_home_meta($key, $result); break;
67
+ case 'term': return $this->get_term_meta($id, $key, $result); break;
68
+ case 'user': return $this->get_user_meta($id, $key, $result); break;
69
+ case 'post':
70
+ default: return $this->get_post_meta($id, $key, $result); break;
71
+ }
72
+ return $result;
73
+ }
74
+
75
+ function update_meta( $type = 'post', $id = false, $metakey, $vals, $defaults = false) {
76
+ if (!$defaults) $defaults = array();
77
+ if (is_array($vals)) {
78
+ foreach ($vals as $k => $v) if (!is_array($v)) $vals[$k] = stripslashes(trim($v));
79
+ $vals = @serialize(wp_parse_args($vals, $defaults));
80
+ } else {
81
+ $vals = stripslashes(trim($vals));
82
+ }
83
+ switch ($type) {
84
+ case 'home': return $this->update_home_meta( $metakey, $vals ); break;
85
+ case 'term': return $this->update_term_meta( $id, $metakey, $vals ); break;
86
+ case 'user': return $this->update_user_meta( $id, $metakey, $vals ); break;
87
+ case 'post':
88
+ default: return $this->update_post_meta( $id, $metakey, $vals ); break;
89
+ }
90
+ }
91
+
92
+ function delete_meta( $type = 'post', $id = false, $metakey) {
93
+ switch ($type) {
94
+ case 'home': return $this->delete_home_meta( $metakey ); break;
95
+ case 'term': return $this->delete_term_meta( $id, $metakey ); break;
96
+ case 'user': return $this->delete_user_meta( $id, $metakey); break;
97
+ case 'post':
98
+ default: return $this->delete_post_meta( $id, $metakey ); break;
99
+ }
100
+ }
101
+
102
+ function get_home_meta( $key = false, $result = array() ) {
103
+ if ($meta = get_option($this->get_home_meta_key()))
104
+ if ($key && ($key != $this->get_home_meta_key()))
105
+ return isset($meta[$key]) ? (is_serialized($meta[$key]) ? @unserialize($meta[$key]) : $meta[$key]) : $result;
106
+ else
107
+ return $meta;
108
+ else
109
+ return $result;
110
+ }
111
+
112
+ function update_home_meta( $key, $vals) {
113
+ $meta = $this->get_home_meta();
114
+ if ($key && ($key != $this->get_home_meta_key()))
115
+ $meta[$key] = $vals;
116
+ else
117
+ $meta = $vals;
118
+ update_option($this->get_home_meta_key(), $meta);
119
+ }
120
+
121
+
122
+ function delete_home_meta( $key) {
123
+ delete_option($this->get_home_meta_key());
124
+ }
125
+
126
+
127
+ function get_post_meta ($post_id, $key= false, $result = false) {
128
+ if (!$post_id) $post_id = $this->get_post_id();
129
+ if (!$key) $key = $this->get_post_meta_key();
130
+ if ($post_id && $key
131
+ && ($meta = get_post_meta($post_id, $key, true))
132
+ && ($options = (is_serialized($meta) ? @unserialize($meta) : $meta))
133
+ && (is_array($options) || is_string($options)))
134
+ return $options;
135
+ else
136
+ return $result;
137
+ }
138
+
139
+ function get_post_meta_value($post_id, $key) {
140
+ return get_post_meta($post_id, $key, true);
141
+ }
142
+
143
+ function update_post_meta( $post_id, $key = false, $values = false) {
144
+ if (!$post_id) $post_id = $this->get_post_id();
145
+ if (!$key) $key = $this->get_post_meta_key();
146
+ return update_post_meta( $post_id, $key, $values);
147
+ }
148
+
149
+
150
+ function delete_post_meta ($post_id, $key= false) {
151
+ if (!$post_id) $post_id = $this->get_post_id();
152
+ if (!$key) $key = $this->get_post_meta_key();
153
+ if ($post_id && $key)
154
+ return delete_post_meta($post_id, $key);
155
+ else
156
+ return false;
157
+ }
158
+
159
+
160
+ function get_term_meta( $term_id, $key= false, $result = false ) {
161
+ if (!$term_id) $term_id = $this->get_term_id();
162
+ if (function_exists('get_term_meta')) {
163
+ if (!$key) $key = $this->get_term_meta_key();
164
+ if ($vals = get_term_meta( $term_id, $key, true)) return maybe_unserialize($vals);
165
+ } else {
166
+ $meta = get_option($this->get_term_meta_key());
167
+ if (!$meta) return $result;
168
+ if ($key && ($key != $this->get_term_meta_key()) ) {
169
+ if (isset($meta[$term_id][$key])) return $meta[$term_id][$key];
170
+ } else {
171
+ if (isset($meta[$term_id])) return $meta[$term_id];
172
+ }
173
+ }
174
+ return $result;
175
+ }
176
+
177
+ function update_term_meta( $term_id, $key = false, $values = false) {
178
+ $default_metakey = $this->get_term_meta_key();
179
+ if (function_exists('update_term_meta')) {
180
+ if (!$key) $key = $default_metakey;
181
+ return update_term_meta( $term_id, $key, $values);
182
+ } else {
183
+ $meta = get_option($default_metakey);
184
+ if (!$meta) $meta = array();
185
+ if ($key && ($key != $default_metakey))
186
+ $meta[$term_id][$key] = $values;
187
+ else
188
+ $meta[$term_id] = $values;
189
+ update_option($default_metakey, $meta);
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;
197
+ return delete_term_meta( $term_id, $key);
198
+ } else {
199
+ delete_option($default_metakey);
200
+ }
201
+ }
202
+
203
+ function get_user_meta ($user_id, $key= false, $result = false) {
204
+ if (!$key) $key = $this->get_user_meta_key();
205
+ if ($user_id && $key
206
+ && ($meta = get_user_meta($user_id, $key, true))
207
+ && ($options = (is_serialized($meta) ? @unserialize($meta) : $meta))
208
+ && (is_array($options) || is_string($options)))
209
+ return $options;
210
+ else
211
+ return $result;
212
+ }
213
+
214
+ function update_user_meta( $user_id, $key = false, $values = false) {
215
+ if (!$key) $key = $this->get_user_meta_key();
216
+ return update_user_meta( $user_id, $key, $values);
217
+ }
218
+
219
+
220
+ function delete_user_meta( $user_id, $key = false) {
221
+ if (!$key) $key = $this->get_user_meta_key();
222
+ return delete_user_meta( $user_id, $key);
223
+ }
224
+
225
+ function get_toggle_post_meta_key($action, $item) {
226
+ return sprintf('%1$s%2$s_%3$s', $this->prefix, $action, $item );
227
+ }
228
+
229
+ function post_has_shortcode($shortcode, $attribute = false) {
230
  global $wp_query;
231
  if (isset($wp_query)
232
  && isset($wp_query->post)
241
  return false;
242
  }
243
 
244
+ function overrides($defaults, $atts) {
245
+ $overrides = array();
246
+ foreach ($defaults as $key => $value)
247
+ if (isset($atts[$key]) && ($atts[$key] || ($atts[$key] === false)))
248
+ $overrides[$key] = $atts[$key];
249
+ else
250
+ $overrides[$key] = $value;
251
+ return $overrides;
252
+ }
253
+
254
+ function clean_css_classes($classes) {
255
+ $classes = str_replace(array('{', '}', '[', ']', '(', ')'), '', $classes);
256
+ $classes = str_replace(array(',', ';', ':'), ' ', $classes);
257
+ return trim($classes);
258
+ }
259
 
260
+ function json_encode($params) {
261
  //fix numerics and booleans
262
  $pat = '/(\")([0-9]+)(\")/';
263
  $rep = '\\2';
265
  preg_replace($pat, $rep, json_encode($params)));
266
  }
267
 
268
+ function is_mobile_device() {
269
+ if (function_exists('wp_is_mobile'))
270
+ return wp_is_mobile();
271
+ else
272
  return preg_match("/wap.|.wap/i", $_SERVER["HTTP_ACCEPT"])
273
+ || preg_match("/iphone|ipad/i", $_SERVER["HTTP_USER_AGENT"])
274
+ || preg_match("/android/i", $_SERVER["HTTP_USER_AGENT"]);
275
  }
276
 
277
+ function is_landing_page($page_template='') {
278
  if (empty($page_template)
279
+ && ($post_id = $this->get_post_id()))
280
  $page_template = get_post_meta($post_id,'_wp_page_template',TRUE);
281
 
282
  if (empty($page_template)) return false;
285
  return in_array($page_template, $landing_pages );
286
  }
287
 
288
+ function read_more_link($link_text='Read More', $class='', $spacer = '') {
289
+ $classes = empty($class) ? '' : (' ' . $class);
290
+ return sprintf('%1$s<a class="more-link%2$s" href="%3$s">%4$s</a>', $spacer, $classes, get_permalink(), $link_text);
291
+ }
292
+
293
+ function register_tooltip_styles() {
294
+ wp_register_style('diy-tooltip', plugins_url('styles/tooltip.css',dirname(__FILE__)), array(), null);
 
 
 
 
 
 
 
 
295
  }
296
 
297
+ function enqueue_tooltip_styles() {
298
+ wp_enqueue_style('diy-tooltip');
299
+ wp_enqueue_style('dashicons');
300
+ }
301
+
302
+ function selector($fld_id, $fld_name, $value, $options, $multiple = false) {
303
  $input = '';
304
  if (is_array($options)) {
305
  foreach ($options as $optkey => $optlabel)
306
  $input .= sprintf('<option%1$s value="%2$s">%3$s</option>',
307
+ $multiple ? selected(in_array($optkey, (array)$value), true, false)
308
+ : selected($optkey, $value, false), $optkey, $optlabel);
309
  } else {
310
  $input = $options;
311
  }
312
+ return sprintf('<select id="%1$s" name="%2$s"%4$s>%3$s</select>', $fld_id, $fld_name . ($multiple?'[]':''), $input, $multiple ? ' multiple="multiple"':'');
313
  }
314
 
315
+ function form_field($fld_id, $fld_name, $label, $value, $type, $options = array(), $args = array(), $wrap = false) {
316
  if ($args) extract($args);
317
  $input = '';
318
  $label = sprintf('<label class="diy-label" for="%1$s">%2$s</label>', $fld_id, __($label));
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.'"') : '',
327
  isset($maxlength) ? (' maxlength="'.$maxlength.'"') : '',
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;
334
  case 'file':
335
  $input .= sprintf('<input type="file" id="%1$s" name="%2$s" value="%3$s" %4$s%5$s%6$s accept="image/*" />',
344
  isset($readonly) ? (' readonly="'.$readonly.'"') : '',
345
  isset($rows) ? (' rows="'.$rows.'"') : '',
346
  isset($cols) ? (' cols="'.$cols.'"') : '',
347
+ isset($class) ? (' class="'.$class.'"') : '', stripslashes($value));
348
  break;
349
  case 'checkbox':
350
  if (is_array($options) && (count($options) > 0)) {
384
  }
385
  break;
386
  case 'select':
387
+ $input = $this->selector($fld_id, $fld_name, $value, $options, isset($multiple));
388
+ break;
389
+ case 'page':
390
+ $args = array( 'id' => $fld_name, 'name' => $fld_name, 'selected' => $value, 'echo' => false, 'depth' => 0, 'option_none_value' => 0);
391
+ if (isset($show_option_none)) $args['show_option_none'] = $show_option_none;
392
+ $input = wp_dropdown_pages($args);
393
  break;
394
  case 'hidden': return sprintf('<input type="hidden" name="%1$s" value="%2$s" />', $fld_name, $value);
395
  default: $input = $value;
399
  case 'tr': $format = '<tr class="diy-row"><th scope="row">%1$s</th><td>%2$s</td></tr>'; break;
400
  case 'br': $format = 'checkbox'==$type ? '%2$s%1$s<br/>' : '%1$s%2$s<br/>'; break;
401
  default: $format = strpos($input,'fieldset') !== FALSE ?
402
+ '<div class="diy-row wrapfieldset">%1$s%2$s</div>' : ('<'.$wrap.' class="diy-row">%1$s%2$s</'.$wrap.'>');
403
  }
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));
410
+ }
411
  }
412
 
413
+ function prepare_error($result) {
414
+ if (is_object($result) && is_wp_error( $result )) {
415
+ $error_message = $result->get_error_message();
416
+ $error_code = $result->get_error_code();
417
+ $error_data = $result->get_error_data();
418
+ $message = sprintf('%1$s; Code:%2$s; Data: %3$s', $error_message, $error_code, print_r($error_data, true));
419
+ }
420
+ else if (is_array($result) || is_object($result)) {
421
+ $message = print_r($result, true);
422
+ } else {
423
+ $message = $result;
424
+ }
425
+ return $message;
426
+ }
427
+
428
+
429
+ function is_error_log() {
430
+ return defined('WP_DEBUG') && (WP_DEBUG === true);
431
+ }
432
+
433
+ function error_log($message) {
434
+ error_log($message);
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");';
441
+ $this->print_script(sprintf($wrap, $css));
442
+ }
443
+
444
+ function print_immediate_script($script) {
445
+ $this->print_script($script, false);
446
+ }
447
+
448
+ function print_script($script, $ready = true) {
449
+ $ready_begin = $ready ? 'jQuery(document).ready( function($) {' : '';
450
+ $ready_end = $ready ? '});' : '';
451
+ print <<< SCRIPT
452
+ <script type="text/javascript">
453
+ //<![CDATA[
454
+ {$ready_begin}
455
+ {$script}
456
+ {$ready_end}
457
+ //]]>
458
+ </script>
459
+ SCRIPT;
460
+ }
461
+
462
  }
classes/class-widget.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!class_exists('Footer_Putter_Widget')) {
3
+ abstract class Footer_Putter_Widget extends WP_Widget {
4
+
5
+ const ALLOWED_TAGS = '<a>,<img>,<span>,<i>,<em>,<br>';
6
+
7
+ protected $plugin;
8
+ protected $utils;
9
+ protected $instance;
10
+ protected $key;
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();
21
+ $this->utils = $this->plugin->get_utils();
22
+ parent::__construct($id_base, $name, $widget_options, $control_options);
23
+ }
24
+
25
+ function get_version() {
26
+ return $this->plugin->get_version();
27
+ }
28
+
29
+ function get_defaults() {
30
+ return $this->defaults;
31
+ }
32
+
33
+ function set_defaults($defaults) {
34
+ if (is_array($defaults) && (count($defaults) > 0))
35
+ $this->defaults = array_merge($this->defaults, $defaults);
36
+ }
37
+
38
+ public function override_args($args, &$instance) {
39
+ $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
40
+ $title = isset($instance['html_title']) ? $instance['html_title'] : '';
41
+ $instance = $this->instance;
42
+ $class = isset($instance['class']) ? $instance['class'] : '';
43
+ if ( ! empty( $class ) ) $args['before_widget'] = str_replace('"widget ', '"widget '.$class.' ', $args['before_widget']);
44
+ if ( ! empty( $title ) ) $args['before_widget'] .= sprintf('%1$s%2$s%3$s', $args['before_title'], $title, $args['after_title']);
45
+ return $args;
46
+ }
47
+
48
+ function get_active_instances() {
49
+ $active = array();
50
+ if ($instances = $this->get_settings())
51
+ foreach ($instances as $key => $instance)
52
+ if (is_array($instance)
53
+ && (count($instance) > 0)
54
+ && is_active_widget( false, $this->id_base.'-'.$key, $this->id_base, true )) {
55
+ $inst = clone $this;
56
+ $inst->key = $key;
57
+ $inst->widget_id = $this->id_base.'-'.$key;
58
+ $inst->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
59
+ $active[] = $inst;
60
+ }
61
+ return $active;
62
+ }
63
+
64
+ function is_widget_instance_active() {
65
+ if ($instances = $this->get_settings())
66
+ foreach ($instances as $key => $instance)
67
+ if (is_array($instance)
68
+ && (count($instance) > 0)
69
+ && is_active_widget( false, $this->id_base.'-'.$key, $this->id_base, true )) {
70
+ $this->key = $key;
71
+ $this->widget_id = $this->id_base.'-'.$this->key;
72
+ $this->instance = wp_parse_args( (array) $instance, $this->get_defaults() );
73
+ return true;
74
+ }
75
+ return false;
76
+ }
77
+
78
+ public function update_instance($new_instance, $old_instance) {
79
+ $instance = wp_parse_args( (array) $old_instance, $this->get_defaults() );
80
+ $instance['title'] = strip_tags($new_instance['title']);
81
+ $instance['html_title'] = strip_tags( $new_instance['html_title'], self::ALLOWED_TAGS );
82
+ $instance['class'] = strip_tags( $new_instance['class'] );
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 ));
94
+ print ('<hr />');
95
+ }
96
+
97
+ public function print_form_field($fld, $type, $options = array(), $args = array()) {
98
+ print $this->utils->form_field(
99
+ $this->get_field_id($fld), $this->get_field_name($fld),
100
+ $this->tooltips->tip($fld),
101
+ isset($this->instance[$fld]) ? $this->instance[$fld] : false,
102
+ $type, $options, $args);
103
+ }
104
+
105
+ function print_text_field($fld, $value, $args = array()) {
106
+ $this->print_form_field($fld, $value, 'text', array(), $args);
107
+ }
108
+
109
+ function taxonomy_options ($fld) {
110
+ $selected = array_key_exists($fld, $this->instance) ? (array) $this->instance[$fld] : array();
111
+ $s = sprintf('<option value="">%1$s</option>', __('All Taxonomies and Terms', WPMAGIQ_DOMAIN ));
112
+ $taxonomies = get_taxonomies( array('public' => true ), 'objects');
113
+ foreach ( $taxonomies as $taxonomy ) {
114
+ if ($taxonomy->name !== 'nav_menu') {
115
+ $query_label = $taxonomy->name;
116
+ $s .= sprintf('optgroup label="%1$s">', esc_attr( $taxonomy->labels->name ));
117
+ $s .= sprintf('<option style="margin-left: 5px; padding-right:10px;" %1$s value="%2$s">%3$s</option>',
118
+ selected( in_array($query_label , $selected), true, false),
119
+ $query_label, $taxonomy->labels->all_items) ;
120
+ $terms = get_terms( $taxonomy->name, 'orderby=name&hide_empty=1');
121
+ foreach ( $terms as $term )
122
+ $s .= sprintf('<option %1$s value="%2$s">%3$s</option>',
123
+ selected(in_array($query_label. ',' . $term->slug, $selected), true, false),
124
+ $query_label. ',' . $term->slug, '-' . esc_attr( $term->name )) ;
125
+ $s .= '</optgroup>';
126
+ }
127
+ }
128
+ return $s;
129
+ }
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 ) {
139
+ $hide = false;
140
+ $is_landing = $this->utils->is_landing_page();
141
+ switch ($visibility) {
142
+ case 'hide_landing' : $hide = $is_landing; break; //hide only on landing pages
143
+ case 'show_landing' : $hide = ! $is_landing; break; //hide except on landing pages
144
+ }
145
+ return $hide;
146
+ }
147
+
148
+ }
149
+ }
main.php CHANGED
@@ -1,23 +1,23 @@
1
  <?php
2
  /*
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.14.1
7
  * Author: Russell Jamieson
8
- * Author URI: http://www.diywebmastery.com/about/
9
- * License: GPLv2+
10
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
12
- define('FOOTER_PUTTER_VERSION','1.14.1');
13
- define('FOOTER_PUTTER_FRIENDLY_NAME', 'Footer Putter') ;
14
- define('FOOTER_PUTTER_DOMAIN', 'FOOTER_PUTTER_DOMAIN') ;
15
- define('FOOTER_PUTTER_PATH', plugin_basename(__FILE__)) ;
16
- define('FOOTER_PUTTER_PLUGIN_NAME', plugin_basename(dirname(__FILE__))) ;
17
- define('FOOTER_PUTTER_HOME_URL','http://www.diywebmastery.com/plugins/footer-putter/');
18
  define('FOOTER_PUTTER_ICON','dashicons-arrow-down-alt');
19
- define('FOOTER_PUTTER_NEWS', 'http://www.diywebmastery.com/tags/newsfeed/feed/?images=1&featured_only=1');
 
 
 
 
20
  require_once(dirname(__FILE__) . '/classes/class-plugin.php');
21
- add_action ('init', array('Footer_Putter_Plugin', 'init'), 0);
22
- if (is_admin()) add_action ('init', array('Footer_Putter_Plugin', 'admin_init'), 0);
23
- ?>
1
  <?php
2
  /*
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();
 
 
readme.txt CHANGED
@@ -3,8 +3,9 @@ Contributors: powerblogservice, diywebmastery
3
  Donate link: http://www.diywebmastery.com/donate/
4
  Tags: footer, copyright, trademark
5
  Requires at least: 3.1
6
- Tested up to: 4.3
7
- Stable tag: 1.14.1
 
8
  License: GPLv2+
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -48,33 +49,20 @@ Put a footer on your site that boosts your credibility with both search engines
48
 
49
  == Changelog ==
50
 
51
- = 1.14.1 = Fix module name error
52
 
53
- = 1.14 = Support for email address encoding
54
-
55
- = 1.13 =
56
-
57
- * Checked for WordPress 4.3 compatibility
58
- * Updated to use dismissible Admin Notices for messages
59
- * Now uses tabbed metaboxes
60
- * Added option to hide Powered By WordPress on the TwentySomething themes
61
- * Re-enabled Admin Toolbar if all actions were removed on the wp_footer hook
62
-
63
- = 1.12 = Updated for WordPress 4.1, bug fix to privacy page terms, and added useful links and DIYWebmastery news feed sections in the sidebar
64
-
65
-
66
- For full version history please see http://www.diywebmastery.com/plugins/footer-putter/footer-putter-version-history/
67
 
68
  == Upgrade Notice ==
69
 
70
- = 1.14.1 =
71
- * Mandatory - Fix module name error
72
 
73
  == Links ==
74
 
75
  Here are some of the useful Footer Putter WordPress Plugin links
76
 
77
- * Footer Putter Plugin: http://www.diywebmastery.com/plugins/footer-putter/
78
- * Compatible Themes and Hooks: http://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks
79
- * How To Use A Different Footer On Landing Pages: http://www.diywebmastery.com/4098/how-to-add-a-different-footer-on-landing-pages
80
- * Using HTML5 Microdata for better SEO and Local Search: http://www.diywebmastery.com/4109/using-html5-microdata-footer
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
 
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
 
63
  Here are some of the useful Footer Putter WordPress Plugin links
64
 
65
+ * Footer Putter Plugin: https://www.diywebmastery.com/plugins/footer-putter/
66
+ * Compatible Themes and Hooks: https://www.diywebmastery.com/footer-credits-compatible-themes-and-hooks
67
+ * How To Use A Different Footer On Landing Pages: https://www.diywebmastery.com/4098/how-to-add-a-different-footer-on-landing-pages
68
+ * Using HTML5 Microdata for better SEO and Local Search: https://www.diywebmastery.com/4109/using-html5-microdata-footer
scripts/jquery.news.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function footer_putter_news_ajax(url) {
2
+ var data = { action: footer_putter_news.ajaxaction, security: footer_putter_news.ajaxnonce, url: url };
3
+ jQuery.post( footer_putter_news.ajaxurl, data, function( response ) {
4
+ var ele = jQuery(footer_putter_news.ajaxresults);
5
+ if( response.success )
6
+ ele.append( response.data );
7
+ /* else if ( response.data.error )
8
+ ele.append( response.data.error );
9
+ */
10
+ });
11
+ }
12
+
13
+ jQuery(document).ready(function($) {
14
+ if (typeof footer_putter_news0 != 'undefined') footer_putter_news_ajax(footer_putter_news0.feedurl );
15
+ if (typeof footer_putter_news1 != 'undefined') footer_putter_news_ajax(footer_putter_news1.feedurl );
16
+ if (typeof footer_putter_news2 != 'undefined') footer_putter_news_ajax(footer_putter_news2.feedurl );
17
+ });
scripts/jquery.tabs.js CHANGED
@@ -2,23 +2,30 @@ jQuery(document).ready ( function () {
2
  if(jQuery('.footer-putter-metabox').length > 0) {
3
  jQuery('.footer-putter-metabox li.tab a').each(function(i) {
4
  var thisMetabox = jQuery(this).closest('.footer-putter-metabox');
5
- var tabs = thisMetabox.find('.footer-putter-metabox-tabs');
6
- var content = thisMetabox.find('.metabox-content');
7
  var thisTab = jQuery(this).parent().attr('class').replace(/tab /, '');
8
- var selectedTab = thisMetabox.find('#tabselect');
9
  if ( thisTab == selectedTab.val() ) {
10
  jQuery(this).addClass('active');
11
- content.children('div.'+thisTab).addClass('active');
12
  } else {
13
- content.children('div.' + thisTab).hide();
14
  }
15
- jQuery(this).click(function(){
16
- content.children('div').hide();
17
  content.children('div.active').removeClass('active');
18
  tabs.find('li a.active').removeClass('active');
19
- selectedTab.val(thisTab);
20
  tabs.find('li.'+thisTab+' a').addClass('active');
21
  content.children('div.'+thisTab).addClass('active').show();
 
 
 
 
 
 
 
22
  return false;
23
  });
24
  tabs.show();
2
  if(jQuery('.footer-putter-metabox').length > 0) {
3
  jQuery('.footer-putter-metabox li.tab a').each(function(i) {
4
  var thisMetabox = jQuery(this).closest('.footer-putter-metabox');
5
+ var tabs = thisMetabox.find('.metabox-tabs');
6
+ var content = thisMetabox.find('.metabox-content');
7
  var thisTab = jQuery(this).parent().attr('class').replace(/tab /, '');
8
+ var selectedTab = thisMetabox.find('.tabselect');
9
  if ( thisTab == selectedTab.val() ) {
10
  jQuery(this).addClass('active');
11
+ content.children('div.'+thisTab).addClass('active');
12
  } else {
13
+ content.children('div.' + thisTab).hide();
14
  }
15
+ jQuery(this).click(function(){
16
+ content.children('div').hide();
17
  content.children('div.active').removeClass('active');
18
  tabs.find('li a.active').removeClass('active');
19
+ selectedTab.val(thisTab);
20
  tabs.find('li.'+thisTab+' a').addClass('active');
21
  content.children('div.'+thisTab).addClass('active').show();
22
+ boxes = jQuery('.postbox, .termbox');
23
+ jQuery.post(ajaxurl, {
24
+ action: 'genesis_club_tab',
25
+ box: tabs.closest(boxes).attr('id'),
26
+ tabselect: thisTab,
27
+ tabnonce: jQuery('#genesisclubtabnonce').val()
28
+ });
29
  return false;
30
  });
31
  tabs.show();
styles/admin.css CHANGED
@@ -1,4 +1,8 @@
1
- h2.title i { padding-right: 0.25em; vertical-align: top; font-size: 1.2em;}
2
- img.dashed-border { padding: 10px; border: 1px dashed silver; max-width: 100%; }
3
  p.bigger { font-size: larger; font-weight: bold; }
4
- #footer-putter-intro { padding-right: 180px; background: url(../images/logo.png) right 40px no-repeat;}
 
 
 
 
1
+ h2.title i { padding-right: 0.5em; font-size: 1.25em; }
2
+ p.save { width: 97%; text-align: right; }
3
  p.bigger { font-size: larger; font-weight: bold; }
4
+ img.dashed-border { padding: 10px; border: 1px dashed silver; max-width: 100%; }
5
+ .diy-image-feed-widget-item { display: inline-block; vertical-align:top; padding: 10px; }
6
+ .diy-image-feed-widget-item span img { max-height : 240px; width: auto }
7
+ .postbox-container .diy-image-feed-widget { text-align: center; }
8
+ #footer-putter-intro { padding-right: 200px;background: url(../images/logo.png) right bottom no-repeat, linear-gradient(to bottom, #FCFCFC,#EEEEEE); }
styles/footer-credits.css CHANGED
@@ -1,26 +1,30 @@
1
- #footer .footer-center, #footer .return-center, .footer-center, .return-center { text-align: center; padding: 10px 0px; border:none;}
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; }
4
- #footer #footer-credits ul, #footer #footer-credits ul li, #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 #footer-credits ul li:before, #footer-credits ul li:before {
7
- content : '\B7'; }
8
- #footer #footer-credits ul li:first-child:before, #footer-credits ul li:first-child:before {
9
- content : ''; }
10
- #footer #footer-credits ul li a, #footer-credits ul li a {
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, #footer-credits a.email:hover, #footer-credits a.map:hover {
13
- text-decoration: underline; }
14
- #footer-credits span.copyright, #footer-credits span.telephone, #footer-credits span.address,
15
- #footer-credits a.email, #footer-credits a.map {
16
  font-weight: normal; letter-spacing : normal; text-transform: none; margin: 0 10px; vertical-align: middle;
17
  background: none; 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; border: 0 !important;}
@@ -30,6 +34,11 @@
30
  { margin: 0 !important; padding: 0 !important; width: 100% !important; float:none !important; }
31
  .site-info .custom-footer { margin: 0 !important; border: 0 !important; padding : 0!important; width: 100% !important;}
32
 
33
- .custom-footer.hide-wordpress + a[href='https://wordpress.org/'], .custom-footer.hide-wordpress + a[href='http://wordpress.org/'] {
 
 
 
 
 
34
  display: none;
35
  }
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;}
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
  }
styles/tabs.css CHANGED
@@ -1,44 +1,48 @@
1
- /*tabbed metabox */
2
-
3
- ul.footer-putter-metabox-tabs { display: inline-block; margin:0 0 -4px; padding: 0; color: #000000;}
4
- ul.footer-putter-metabox-tabs li {list-style: none; display: inline; font-size: 11px; }
5
- ul.footer-putter-metabox-tabs li.tab a {
6
- text-decoration: none;
7
- border-top: 1px #AAAAAA solid;
8
- border-left: 1px #AAAAAA solid;
9
- border-right: 1px #AAAAAA solid;
10
- }
11
- ul.footer-putter-metabox-tabs li.tab a.active {
12
- color: #000000;
13
- background-color: #CCCCCC;
14
- border-bottom: none;
15
- }
16
- ul.footer-putter-metabox-tabs li.link a:hover { text-decoration: underline; }
17
- ul.footer-putter-metabox-tabs li.tab.hidden { display: none; background-color: gray}
18
- ul.footer-putter-metabox-tabs li.tab a.has_error { background-color: red; color: white; }
19
- ul.footer-putter-metabox-tabs li a:focus { outline: none; box-shadow:none; }
20
- ul.footer-putter-metabox-tabs li.tab a { display: block; float: left; margin-right: 4px; padding: 5px 12px;
21
  font-weight: bold; text-decoration: none; zoom: 1; outline: none;
22
  border-radius: 2px 2px 0 0; -webkit-border-radius: 2px 2px 0 0; -moz-border-radius: 2px 2px 0 0;
23
- background-color: #E8E8E8; color: #A8A8A8 ;
24
  }
25
 
 
 
 
 
 
 
 
26
 
27
- ul.footer-putter-metabox-tabs li.tab a:hover {
28
- color: #000000;
29
  }
 
30
  .footer-putter-metabox .metabox-content {
31
- background: url(images/icon-32.png) right bottom no-repeat, linear-gradient(to bottom, #CCCCCC,#EEEEEE);
32
  min-height: 60px;
33
  padding-bottom:50px;
34
- border: 1px #AAAAAA solid;
35
  }
36
 
37
  .footer-putter-metabox div.tab-content {
38
  padding: 10px 15px;
39
- opacity: 90%;
40
  }
41
 
42
- .footer-putter-metabox .form-table th, .footer-putter-metabox .form-table td {
 
43
  padding: 5px;
44
- }
 
 
 
 
 
 
1
+ .footer-putter-metabox .metabox-tabs { display: inline-block; margin:0 0 -6px; padding: 0; color: #000000;}
2
+ .footer-putter-metabox .metabox-tabs li {list-style: none; display: inline; font-size: 11px; }
3
+ .footer-putter-metabox .metabox-tabs li.link { margin-left: 4px; }
4
+ .footer-putter-metabox .metabox-tabs li.link a { text-decoration: none; }
5
+ .footer-putter-metabox .metabox-tabs li.link a:hover { text-decoration: underline; }
6
+ .footer-putter-metabox .metabox-tabs li.tab.hidden { display: none; background-color: gray}
7
+ .footer-putter-metabox .metabox-tabs li.tab a.has_error { background-color: red; color: white; }
8
+ .footer-putter-metabox .metabox-tabs li a:focus { outline: none; box-shadow:none; }
9
+ .footer-putter-metabox .metabox-tabs li.tab a {
10
+ display: block; float: left; margin-right: 4px; padding: 5px 12px;
 
 
 
 
 
 
 
 
 
 
11
  font-weight: bold; text-decoration: none; zoom: 1; outline: none;
12
  border-radius: 2px 2px 0 0; -webkit-border-radius: 2px 2px 0 0; -moz-border-radius: 2px 2px 0 0;
 
13
  }
14
 
15
+ .footer-putter-metabox .metabox-tabs li a.active {
16
+ color: #0096dd;
17
+ background-color: #FCFCFC;
18
+ border-top: 1px solid silver;
19
+ border-left: 1px solid silver;
20
+ border-right: 1px solid silver;
21
+ }
22
 
23
+ .footer-putter-metabox .metabox-tabs li.tab a:hover {
24
+ color: #1166EE;
25
  }
26
+
27
  .footer-putter-metabox .metabox-content {
28
+ background: url(images/icon-32.png) right bottom no-repeat, linear-gradient(to bottom, #FCFCFC,#EEEEEE);
29
  min-height: 60px;
30
  padding-bottom:50px;
31
+ border: 1px solid silver;
32
  }
33
 
34
  .footer-putter-metabox div.tab-content {
35
  padding: 10px 15px;
36
+ opacity: 0.9;
37
  }
38
 
39
+ .footer-putter-metabox .form-table th,
40
+ .footer-putter-metabox .form-table td {
41
  padding: 5px;
42
+ }
43
+
44
+ @media only screen and (max-width: 640px) {
45
+ .footer-putter-metabox .metabox-tabs li a {
46
+ font-size: smaller;
47
+ }
48
+ }
styles/tooltip.css CHANGED
@@ -1,7 +1,7 @@
1
  .diy-tooltip {position: relative; cursor: help; display: inline-block; text-decoration: none; color: #222; outline: none; }
2
  .diy-tooltip span.tip { visibility: hidden; position: absolute; bottom: 30px; left: 50%;
3
  z-index: 999; width: 230px;margin-left: -17px; padding: 10px;border: 2px solid #ccc;
4
- opacity: .9;background-color: #ddd;
5
  background-image: -webkit-linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,0));
6
  background-image: -moz-linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,0));
7
  background-image: -ms-linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,0));
@@ -20,18 +20,21 @@ 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: 5px; }
24
  .diy-fieldset label { min-width: 70px; margin: 3px 15px 3px 5px; vertical-align:middle; }
25
  .diy-fieldset input { margin: 3px 0; }
 
26
  .diy-fieldset li { display: inline; }
27
  .diy-checkbox { margin-left: 3px;}
28
- .diy-label { min-width: 160px; margin-right: 10px; vertical-align: top; display: inline-block;}
29
- .widgets-holder-wrap .diy-label { min-width: 150px; }
30
- .widgets-holder-wrap .diy-wrap .diy-label { min-width: 100px; }
31
- .widgets-holder-wrap .diy-fieldset label { min-width: 30px; }
32
- .wrapfieldset label { padding-top: 10px; }
33
  .diy-wrap { margin: 10px 0; }
34
- .diy-wrap div label {padding-top:5px; }
35
  .diy-wrap h4 { margin: 10px 0;}
36
  .diy-wrap p { margin: 5px 0 0; }
37
  tr.diy-row th, tr.diy-row td { margin: 0; padding: 5px;}
 
 
 
 
 
 
 
1
  .diy-tooltip {position: relative; cursor: help; display: inline-block; text-decoration: none; color: #222; outline: none; }
2
  .diy-tooltip span.tip { visibility: hidden; position: absolute; bottom: 30px; left: 50%;
3
  z-index: 999; width: 230px;margin-left: -17px; padding: 10px;border: 2px solid #ccc;
4
+ opacity: .95;background-color: #ddd;
5
  background-image: -webkit-linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,0));
6
  background-image: -moz-linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,0));
7
  background-image: -ms-linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,0));
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; }