Version Description
Added title to Footer Trademarks Widget, improved control over widgets on landing pages with a filter hook, improved online documentation, refactored code in accordance with current WordPress coding standards.
Download this release
Release Info
Developer | powerblogservice |
Plugin | Footer Putter |
Version | 1.9 |
Comparing to | |
See all releases |
Code changes from version 1.8 to 1.9
- classes/{admin.php → class-admin.php} +36 -34
- classes/{footer-credits-admin.php → class-credits-admin.php} +26 -36
- classes/class-footer-widgets.php +189 -0
- classes/{footer-credits.php → class-footer.php} +40 -113
- classes/class-plugin.php +47 -0
- classes/{tooltip.php → class-tooltip.php} +4 -6
- classes/{footer-trademarks-admin.php → class-trademarks-admin.php} +14 -21
- classes/footer-trademarks.php +0 -101
- classes/plugin.php +0 -24
- main.php +8 -3
- readme.txt +7 -6
classes/{admin.php → class-admin.php}
RENAMED
@@ -1,29 +1,19 @@
|
|
1 |
<?php
|
2 |
-
class
|
3 |
const CODE = 'footer-putter';
|
4 |
-
const DOMAIN = 'FooterPutter';
|
5 |
|
6 |
-
private static $path = FOOTER_PUTTER_PATH;
|
7 |
-
private static $slug;
|
8 |
private static $screen_id;
|
9 |
-
|
10 |
-
private static function get_slug(){
|
11 |
-
return self::$slug;
|
12 |
-
}
|
13 |
|
14 |
private static function get_screen_id(){
|
15 |
return self::$screen_id;
|
16 |
}
|
17 |
|
18 |
-
static function init(
|
19 |
-
self::$slug = $root;
|
20 |
-
add_filter('pre_option_link_manager_enabled', '__return_true' );
|
21 |
-
add_filter('plugin_action_links',array(__CLASS__, 'plugin_action_links'), 10, 2 );
|
22 |
add_action('admin_menu',array(__CLASS__, 'admin_menu'));
|
23 |
add_action('admin_print_styles',array(__CLASS__, 'style_icon'));
|
24 |
}
|
25 |
|
26 |
-
|
27 |
print <<< STYLES
|
28 |
<style type="text/css">
|
29 |
#adminmenu .menu-icon-generic.toplevel_page_footer-putter div.wp-menu-image:before { content: '\\f346'; }
|
@@ -31,26 +21,21 @@ class FooterPutterAdmin {
|
|
31 |
STYLES;
|
32 |
}
|
33 |
|
34 |
-
static function plugin_action_links( $links, $file ) {
|
35 |
-
if ( is_array($links) && (self::$path == $file )) {
|
36 |
-
$settings_link = '<a href="' . admin_url( 'admin.php?page='.FOOTER_PUTTER_PLUGIN_NAME) . '">Settings</a>';
|
37 |
-
array_unshift( $links, $settings_link );
|
38 |
-
}
|
39 |
-
return $links;
|
40 |
-
}
|
41 |
-
|
42 |
static function admin_menu() {
|
|
|
43 |
self::$screen_id = add_menu_page(FOOTER_PUTTER_FRIENDLY_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'manage_options',
|
44 |
-
|
45 |
-
add_submenu_page(
|
46 |
}
|
47 |
|
48 |
static function settings_panel() {
|
49 |
-
$footer_url = FooterCreditsAdmin::get_url();
|
50 |
$home_url = FOOTER_PUTTER_HOME_URL;
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
54 |
$logo = plugins_url('images/logo.png', dirname(__FILE__));
|
55 |
print <<< ADMIN_PANEL
|
56 |
<div class="wrap">
|
@@ -79,6 +64,7 @@ The plugins define two widgets:
|
|
79 |
<p>Typically you will drag both widgets into the Custom Footer Widget Area.</p>
|
80 |
|
81 |
<h2>Instructions For Building A Footer</h2>
|
|
|
82 |
<ol>
|
83 |
<li>Create a <i>Privacy Policy</i> page with the slug/permalink <em>privacy</em>, choose a page template with no sidebar.</li>
|
84 |
<li>Create a <i>Terms of Use</i> page with the slug/permalink <em>terms</em>, choose a page template with no sidebar.</li>
|
@@ -86,22 +72,38 @@ The plugins define two widgets:
|
|
86 |
<li>Create an <i>About</i> page, with information either about the site or about its owner.</li>
|
87 |
<li>If the site is selling an information product you may want to create a <i>Disclaimer</i> page, regarding any claims about the product performance.</li>
|
88 |
<li>Create a WordPress menu called <i>Footer Menu</i> with the above pages.</li>
|
89 |
-
|
90 |
-
<
|
91 |
-
<
|
92 |
-
<li>
|
93 |
-
<li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
</ol>
|
95 |
|
96 |
<h3>Footer Hook</h3>
|
97 |
<p>The footer hook is only required if your theme does not already have a footer widget area into which you can drag the two widgets.</p>
|
98 |
<p>For some themes, the footer hook is left blank, for others use a WordPress hook such as <i>get_footer</i> or <i>wp_footer</i>,
|
99 |
or use a theme-specific hook such as <i>twentyten_credits</i>, <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,
|
100 |
-
<i>twentythirteen_credits</i>, <i>
|
101 |
|
102 |
<h3>Getting Help</h3>
|
103 |
<p>Check out the <a href="{$home_url}">Footer Putter Plugin page</a> for more information about the plugin.</p>
|
104 |
ADMIN_PANEL;
|
105 |
}
|
106 |
}
|
107 |
-
?>
|
1 |
<?php
|
2 |
+
class Footer_Putter_Admin {
|
3 |
const CODE = 'footer-putter';
|
|
|
4 |
|
|
|
|
|
5 |
private static $screen_id;
|
|
|
|
|
|
|
|
|
6 |
|
7 |
private static function get_screen_id(){
|
8 |
return self::$screen_id;
|
9 |
}
|
10 |
|
11 |
+
static function init() {
|
|
|
|
|
|
|
12 |
add_action('admin_menu',array(__CLASS__, 'admin_menu'));
|
13 |
add_action('admin_print_styles',array(__CLASS__, 'style_icon'));
|
14 |
}
|
15 |
|
16 |
+
static function style_icon() {
|
17 |
print <<< STYLES
|
18 |
<style type="text/css">
|
19 |
#adminmenu .menu-icon-generic.toplevel_page_footer-putter div.wp-menu-image:before { content: '\\f346'; }
|
21 |
STYLES;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
static function admin_menu() {
|
25 |
+
$intro = sprintf('Intro (v%1$s)', Footer_Credits_Plugin::get_version());
|
26 |
self::$screen_id = add_menu_page(FOOTER_PUTTER_FRIENDLY_NAME, FOOTER_PUTTER_FRIENDLY_NAME, 'manage_options',
|
27 |
+
Footer_Credits_Plugin::get_slug(), array(__CLASS__,'settings_panel') );
|
28 |
+
add_submenu_page(Footer_Credits_Plugin::get_slug(), FOOTER_PUTTER_FRIENDLY_NAME, $intro, 'manage_options', Footer_Credits_Plugin::get_slug(), array(__CLASS__,'settings_panel') );
|
29 |
}
|
30 |
|
31 |
static function settings_panel() {
|
|
|
32 |
$home_url = FOOTER_PUTTER_HOME_URL;
|
33 |
+
$plugin = FOOTER_PUTTER_FRIENDLY_NAME;
|
34 |
+
$version = FOOTER_PUTTER_VERSION;
|
35 |
+
$widgets_url = admin_url('widgets.php');
|
36 |
+
$credits_url = Footer_Credits_Admin::get_url();
|
37 |
+
$trademarks_url = Footer_Trademarks_Admin::get_url();
|
38 |
+
$screenshot = plugins_url('screenshot-1.jpg',dirname(__FILE__));
|
39 |
$logo = plugins_url('images/logo.png', dirname(__FILE__));
|
40 |
print <<< ADMIN_PANEL
|
41 |
<div class="wrap">
|
64 |
<p>Typically you will drag both widgets into the Custom Footer Widget Area.</p>
|
65 |
|
66 |
<h2>Instructions For Building A Footer</h2>
|
67 |
+
<h3>Create Standard Pages And Footer Menu</h3>
|
68 |
<ol>
|
69 |
<li>Create a <i>Privacy Policy</i> page with the slug/permalink <em>privacy</em>, choose a page template with no sidebar.</li>
|
70 |
<li>Create a <i>Terms of Use</i> page with the slug/permalink <em>terms</em>, choose a page template with no sidebar.</li>
|
72 |
<li>Create an <i>About</i> page, with information either about the site or about its owner.</li>
|
73 |
<li>If the site is selling an information product you may want to create a <i>Disclaimer</i> page, regarding any claims about the product performance.</li>
|
74 |
<li>Create a WordPress menu called <i>Footer Menu</i> with the above pages.</li>
|
75 |
+
</ol>
|
76 |
+
<h3>Update Business Information</h3>
|
77 |
+
<ol>
|
78 |
+
<li>Go to <a href="{$credits_url}">Footer Credits</a> and update the Site Owner details, contact and legal information.</li>
|
79 |
+
<li>Optionally include contact details such as telephone and email. You may also want to add Geographical co-ordinates for your office location for the purposes of local search.</li>
|
80 |
+
</ol>
|
81 |
+
<h3>Create Trademark Links</h3>
|
82 |
+
<ol>
|
83 |
+
<li>Go to <a href="{$trademarks_url}"><i>Footer Trademarks</i></a> and follow the instructions:</li>
|
84 |
+
<li>Create a link category with a name such as <i>Trademarks</i></li>
|
85 |
+
<li>Add a link for each of your trademarks and put each in the <i>Trademarks</i> link category</li>
|
86 |
+
<li>For each link specify the link URL and the image URL</li>
|
87 |
+
</ol>
|
88 |
+
<h3>Set Up Footer Widgets</h3>
|
89 |
+
<ol>
|
90 |
+
<li>Go to <a href="{$widgets_url}"><i>Appearance > Widgets</i></a></li>
|
91 |
+
<li>Drag a <i>Footer Copyright Widget</i> and a <i>Footer Trademarks widget</i> into a suitable footer Widget Area</li>
|
92 |
+
<li>For the <i>Footer Trademarks</i> widget and choose your link category, e.g. <i>Trademarks</i>, and select a sort order</li>
|
93 |
+
<li>For the <i>Footer Copyright</i> widget, select the <i>Footer Menu</i> and choose what copyright and contact information you want to you display</li>
|
94 |
+
<li>Review the footer of the site. You can use the widget to change font sizes and colors using pre-defined classes such as <i>tiny</i>, <i>small</i>, <i>dark</i>, <i>light</i> or <i>white</i> or add your own custom classes</li>
|
95 |
+
<li>You can also choose to suppress the widgets on special pages such as landing pages.</li>
|
96 |
+
<li>If the footer is not in the right location you can use the <i>Footer Hook</i> feature described below to add a new widget area called <i>Credibility Footer</i> where you can locate the footer widgets.</li>
|
97 |
</ol>
|
98 |
|
99 |
<h3>Footer Hook</h3>
|
100 |
<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>
|
101 |
<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>,
|
102 |
or use a theme-specific hook such as <i>twentyten_credits</i>, <i>twentyeleven_credits</i>, <i>twentytwelve_credits</i>,
|
103 |
+
<i>twentythirteen_credits</i>, <i>genesis_footer</i>, <i>pagelines_leaf</i>, etc.</p>
|
104 |
|
105 |
<h3>Getting Help</h3>
|
106 |
<p>Check out the <a href="{$home_url}">Footer Putter Plugin page</a> for more information about the plugin.</p>
|
107 |
ADMIN_PANEL;
|
108 |
}
|
109 |
}
|
|
classes/{footer-credits-admin.php → class-credits-admin.php}
RENAMED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
3 |
const CODE = 'footer-credits'; //prefix ID of CSS elements
|
4 |
-
const FOOTER = '
|
5 |
-
const SLUG = '
|
6 |
-
private static $version;
|
7 |
-
private static $parenthook;
|
8 |
private static $slug;
|
9 |
private static $screen_id;
|
10 |
private static $keys;
|
@@ -31,25 +31,15 @@ class FooterCreditsAdmin {
|
|
31 |
'footer_hook' => array('heading' => 'Footer Action Hook' , 'tip' => 'The hook where the footer widget area is added to the page. This field is only required if the theme does not already provide a suitable widget area where the footer widgets can be added.'),
|
32 |
'footer_remove' => array('heading' => 'Remove Existing Actions?' , 'tip' => 'Click the checkbox to remove any other actions at the above footer hook. This may stop you getting two footers; one created by your theme and another created by this plugin. For some themes you will check this option as you will typically want to replace the theme footer by the plugin footer.'),
|
33 |
'footer_filter_hook' => array('heading' => 'Footer Filter Hook' , 'tip' => 'If you want to kill off the footer created by your theme, and your theme allows you to filter the content of the footer, then enter the hook where the theme filters the footer. This may stop you getting two footers; one created by your theme and another created by this plugin.'),
|
34 |
-
'privacy_contact' => array('heading' => 'Add Privacy Contact?', 'tip' => 'Add a section to the end of the
|
35 |
-
'terms_contact' => array('heading' => 'Add Terms Contact?', 'tip' => 'Add a section to the end of the Terms
|
36 |
);
|
37 |
private static $tooltips;
|
38 |
|
39 |
-
public static function init(
|
40 |
-
self::$
|
41 |
-
self::$parenthook = $parent;
|
42 |
-
self::$slug = self::$parenthook . '-' . self::SLUG;
|
43 |
add_action('admin_menu',array(__CLASS__, 'admin_menu'));
|
44 |
}
|
45 |
-
|
46 |
-
private static function get_parenthook(){
|
47 |
-
return self::$parenthook;
|
48 |
-
}
|
49 |
-
|
50 |
-
private static function get_version(){
|
51 |
-
return self::$version;
|
52 |
-
}
|
53 |
|
54 |
public static function get_slug(){
|
55 |
return self::$slug;
|
@@ -75,7 +65,7 @@ class FooterCreditsAdmin {
|
|
75 |
}
|
76 |
|
77 |
public static function admin_menu() {
|
78 |
-
self::$screen_id =
|
79 |
self::get_slug(), array(__CLASS__,'settings_panel'));
|
80 |
add_action('load-'.self::get_screen_id(), array(__CLASS__, 'load_page'));
|
81 |
}
|
@@ -83,25 +73,25 @@ class FooterCreditsAdmin {
|
|
83 |
|
84 |
public static function load_page() {
|
85 |
$message = isset($_POST['options_update']) ? self::save() : '';
|
86 |
-
$options =
|
87 |
$callback_params = array ('options' => $options, 'message' => $message);
|
88 |
add_meta_box(self::CODE.'-intro', __('Introduction'), array(__CLASS__, 'intro_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
89 |
add_meta_box(self::CODE.'-owner', __('Site Owner Details'), array(__CLASS__, 'owner_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
90 |
add_meta_box(self::CODE.'-contact', __('Contact Details'), array(__CLASS__, 'contact_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
91 |
add_meta_box(self::CODE.'-legal', __('Legal Details'), array(__CLASS__, 'legal_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
92 |
add_meta_box(self::CODE.'-return', __('Return To Top'), array(__CLASS__, 'return_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
93 |
-
add_meta_box(self::CODE.'-example', __('Preview Footer'), array(__CLASS__, 'preview_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
94 |
add_meta_box(self::CODE.'-advanced', __('Advanced'), array(__CLASS__, 'advanced_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
95 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_styles'));
|
96 |
add_action('admin_enqueue_scripts',array(__CLASS__, 'enqueue_scripts'));
|
97 |
self::$keys = array_keys(self::$tips);
|
98 |
-
self::$tooltips = new
|
99 |
}
|
100 |
|
101 |
public static function enqueue_styles() {
|
102 |
-
wp_enqueue_style(self::CODE, plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),
|
103 |
-
wp_enqueue_style(self::CODE.'-admin', plugins_url('styles/admin.css',dirname(__FILE__)), array(),
|
104 |
-
wp_enqueue_style(self::CODE.'-tooltip', plugins_url('styles/tooltip.css',dirname(__FILE__)), array(),
|
105 |
}
|
106 |
|
107 |
public static function enqueue_scripts() {
|
@@ -115,10 +105,10 @@ class FooterCreditsAdmin {
|
|
115 |
check_admin_referer(__CLASS__);
|
116 |
$page_options = explode(',', stripslashes($_POST['page_options']));
|
117 |
if ($page_options) {
|
118 |
-
$options =
|
119 |
foreach ($page_options as $option) {
|
120 |
$val = array_key_exists($option, $_POST) ? trim(stripslashes($_POST[$option])) : '';
|
121 |
-
if (
|
122 |
$options['terms'][$option] = $val;
|
123 |
else switch($option) {
|
124 |
case 'footer_remove' : $options[$option] = !empty($val); break;
|
@@ -128,7 +118,7 @@ class FooterCreditsAdmin {
|
|
128 |
}
|
129 |
} //end for
|
130 |
$class='updated fade';
|
131 |
-
$saved =
|
132 |
if ($saved) {
|
133 |
$message = 'Footer Settings saved.';
|
134 |
} else
|
@@ -137,7 +127,7 @@ class FooterCreditsAdmin {
|
|
137 |
$class='error';
|
138 |
$message= 'Footer Settings not found!';
|
139 |
}
|
140 |
-
return sprintf('<div id="message" class="%1$s "><p>%2$s</p></div>',$class, __($message
|
141 |
}
|
142 |
|
143 |
public static function toggle_postboxes() {
|
@@ -181,14 +171,14 @@ INTRO_PANEL;
|
|
181 |
<label>{$tip2}</label><input type="text" name="country" size="30" value="{$terms['country']}" /><br/>
|
182 |
<label>{$tip3}</label><input type="text" name="address" size="80" value="{$terms['address']}" /><br/>
|
183 |
OWNER_PANEL;
|
184 |
-
if (
|
185 |
<p>Leave the above address field blank and fill in the various parts of the organization address below if you want to use HTML5 microdata.</p>
|
186 |
<h4>Organization Address</h4>
|
187 |
<label>{$tip4}</label><input type="text" name="street_address" size="30" value="{$terms['street_address']}" /><br/>
|
188 |
<label>{$tip5}</label><input type="text" name="locality" size="30" value="{$terms['locality']}" /><br/>
|
189 |
<label>{$tip6}</label><input type="text" name="region" size="30" value="{$terms['region']}" /><br/>
|
190 |
<label>{$tip7}</label><input type="text" name="postal_code" size="12" value="{$terms['postal_code']}" /><br/>
|
191 |
-
<h4>
|
192 |
<p>The geographical co-ordinates are optional and are visible only to the search engines.</p>
|
193 |
<label>{$tip8}</label><input type="text" name="latitude" size="12" value="{$terms['latitude']}" /><br/>
|
194 |
<label>{$tip9}</label><input type="text" name="longitude" size="12" value="{$terms['longitude']}" /><br/>
|
@@ -234,7 +224,7 @@ RETURN_PANEL;
|
|
234 |
|
235 |
public static function preview_panel($post,$metabox){
|
236 |
$options = $metabox['args']['options'];
|
237 |
-
echo
|
238 |
}
|
239 |
|
240 |
public static function advanced_panel($post,$metabox){
|
@@ -261,11 +251,11 @@ ADVANCED_PANEL;
|
|
261 |
public static function settings_panel() {
|
262 |
$this_url = $_SERVER['REQUEST_URI'];
|
263 |
$keys = implode(',',self::get_keys());
|
264 |
-
$title = sprintf('<h2>%1$s</h2>', __('Footer Credits Settings'));
|
265 |
|
266 |
?>
|
267 |
<div class="wrap">
|
268 |
-
<?php
|
269 |
<div id="poststuff" class="metabox-holder">
|
270 |
<div id="post-body" class="with-tooltips">
|
271 |
<div id="post-body-content">
|
@@ -286,5 +276,5 @@ ADVANCED_PANEL;
|
|
286 |
</div>
|
287 |
<?php
|
288 |
}
|
|
|
289 |
}
|
290 |
-
?>
|
1 |
<?php
|
2 |
+
|
3 |
+
if (!class_exists('Footer_Credits_Admin')) {
|
4 |
+
class Footer_Credits_Admin {
|
5 |
const CODE = 'footer-credits'; //prefix ID of CSS elements
|
6 |
+
const FOOTER = 'Footer_Credits'; //class that builds footer
|
7 |
+
const SLUG = 'credits';
|
|
|
|
|
8 |
private static $slug;
|
9 |
private static $screen_id;
|
10 |
private static $keys;
|
31 |
'footer_hook' => array('heading' => 'Footer Action Hook' , 'tip' => 'The hook where the footer widget area is added to the page. This field is only required if the theme does not already provide a suitable widget area where the footer widgets can be added.'),
|
32 |
'footer_remove' => array('heading' => 'Remove Existing Actions?' , 'tip' => 'Click the checkbox to remove any other actions at the above footer hook. This may stop you getting two footers; one created by your theme and another created by this plugin. For some themes you will check this option as you will typically want to replace the theme footer by the plugin footer.'),
|
33 |
'footer_filter_hook' => array('heading' => 'Footer Filter Hook' , 'tip' => 'If you want to kill off the footer created by your theme, and your theme allows you to filter the content of the footer, then enter the hook where the theme filters the footer. This may stop you getting two footers; one created by your theme and another created by this plugin.'),
|
34 |
+
'privacy_contact' => array('heading' => 'Add Privacy Contact?', 'tip' => 'Add a section to the end of the Privacy page with contact information'),
|
35 |
+
'terms_contact' => array('heading' => 'Add Terms Contact?', 'tip' => 'Add a section to the end of the Terms page with contact and legal information'),
|
36 |
);
|
37 |
private static $tooltips;
|
38 |
|
39 |
+
public static function init() {
|
40 |
+
self::$slug = Footer_Credits_Plugin::get_slug() . '-' . self::SLUG;
|
|
|
|
|
41 |
add_action('admin_menu',array(__CLASS__, 'admin_menu'));
|
42 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
public static function get_slug(){
|
45 |
return self::$slug;
|
65 |
}
|
66 |
|
67 |
public static function admin_menu() {
|
68 |
+
self::$screen_id = add_submenu_page(Footer_Credits_Plugin::get_slug(), __('Footer Credits'), __('Footer Credits'), 'manage_options',
|
69 |
self::get_slug(), array(__CLASS__,'settings_panel'));
|
70 |
add_action('load-'.self::get_screen_id(), array(__CLASS__, 'load_page'));
|
71 |
}
|
73 |
|
74 |
public static function load_page() {
|
75 |
$message = isset($_POST['options_update']) ? self::save() : '';
|
76 |
+
$options = Footer_Credits::get_options();
|
77 |
$callback_params = array ('options' => $options, 'message' => $message);
|
78 |
add_meta_box(self::CODE.'-intro', __('Introduction'), array(__CLASS__, 'intro_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
79 |
add_meta_box(self::CODE.'-owner', __('Site Owner Details'), array(__CLASS__, 'owner_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
80 |
add_meta_box(self::CODE.'-contact', __('Contact Details'), array(__CLASS__, 'contact_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
81 |
add_meta_box(self::CODE.'-legal', __('Legal Details'), array(__CLASS__, 'legal_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
82 |
add_meta_box(self::CODE.'-return', __('Return To Top'), array(__CLASS__, 'return_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
83 |
+
add_meta_box(self::CODE.'-example', __('Preview Footer Content'), array(__CLASS__, 'preview_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
84 |
add_meta_box(self::CODE.'-advanced', __('Advanced'), array(__CLASS__, 'advanced_panel'), self::get_screen_id(), 'normal', 'core', $callback_params);
|
85 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_styles'));
|
86 |
add_action('admin_enqueue_scripts',array(__CLASS__, 'enqueue_scripts'));
|
87 |
self::$keys = array_keys(self::$tips);
|
88 |
+
self::$tooltips = new DIY_Tooltip(self::$tips);
|
89 |
}
|
90 |
|
91 |
public static function enqueue_styles() {
|
92 |
+
wp_enqueue_style(self::CODE, plugins_url('styles/footer-credits.css', dirname(__FILE__)), array(),Footer_Credits_Plugin::get_version());
|
93 |
+
wp_enqueue_style(self::CODE.'-admin', plugins_url('styles/admin.css',dirname(__FILE__)), array(),Footer_Credits_Plugin::get_version());
|
94 |
+
wp_enqueue_style(self::CODE.'-tooltip', plugins_url('styles/tooltip.css',dirname(__FILE__)), array(),Footer_Credits_Plugin::get_version());
|
95 |
}
|
96 |
|
97 |
public static function enqueue_scripts() {
|
105 |
check_admin_referer(__CLASS__);
|
106 |
$page_options = explode(',', stripslashes($_POST['page_options']));
|
107 |
if ($page_options) {
|
108 |
+
$options = Footer_Credits::get_options();
|
109 |
foreach ($page_options as $option) {
|
110 |
$val = array_key_exists($option, $_POST) ? trim(stripslashes($_POST[$option])) : '';
|
111 |
+
if (Footer_Credits::is_terms_key($option))
|
112 |
$options['terms'][$option] = $val;
|
113 |
else switch($option) {
|
114 |
case 'footer_remove' : $options[$option] = !empty($val); break;
|
118 |
}
|
119 |
} //end for
|
120 |
$class='updated fade';
|
121 |
+
$saved = Footer_Credits::save($options) ;
|
122 |
if ($saved) {
|
123 |
$message = 'Footer Settings saved.';
|
124 |
} else
|
127 |
$class='error';
|
128 |
$message= 'Footer Settings not found!';
|
129 |
}
|
130 |
+
return sprintf('<div id="message" class="%1$s "><p>%2$s</p></div>',$class, __($message));
|
131 |
}
|
132 |
|
133 |
public static function toggle_postboxes() {
|
171 |
<label>{$tip2}</label><input type="text" name="country" size="30" value="{$terms['country']}" /><br/>
|
172 |
<label>{$tip3}</label><input type="text" name="address" size="80" value="{$terms['address']}" /><br/>
|
173 |
OWNER_PANEL;
|
174 |
+
if (Footer_Credits::is_html5()) print <<< ADDRESS_DATA
|
175 |
<p>Leave the above address field blank and fill in the various parts of the organization address below if you want to use HTML5 microdata.</p>
|
176 |
<h4>Organization Address</h4>
|
177 |
<label>{$tip4}</label><input type="text" name="street_address" size="30" value="{$terms['street_address']}" /><br/>
|
178 |
<label>{$tip5}</label><input type="text" name="locality" size="30" value="{$terms['locality']}" /><br/>
|
179 |
<label>{$tip6}</label><input type="text" name="region" size="30" value="{$terms['region']}" /><br/>
|
180 |
<label>{$tip7}</label><input type="text" name="postal_code" size="12" value="{$terms['postal_code']}" /><br/>
|
181 |
+
<h4>Geographical Co-ordinates</h4>
|
182 |
<p>The geographical co-ordinates are optional and are visible only to the search engines.</p>
|
183 |
<label>{$tip8}</label><input type="text" name="latitude" size="12" value="{$terms['latitude']}" /><br/>
|
184 |
<label>{$tip9}</label><input type="text" name="longitude" size="12" value="{$terms['longitude']}" /><br/>
|
224 |
|
225 |
public static function preview_panel($post,$metabox){
|
226 |
$options = $metabox['args']['options'];
|
227 |
+
echo Footer_Credits::footer(array('nav_menu' => 'Footer Menu'));
|
228 |
}
|
229 |
|
230 |
public static function advanced_panel($post,$metabox){
|
251 |
public static function settings_panel() {
|
252 |
$this_url = $_SERVER['REQUEST_URI'];
|
253 |
$keys = implode(',',self::get_keys());
|
254 |
+
$title = sprintf('<h2 class="title">%1$s</h2>', __('Footer Credits Settings'));
|
255 |
|
256 |
?>
|
257 |
<div class="wrap">
|
258 |
+
<?php echo $title; ?>
|
259 |
<div id="poststuff" class="metabox-holder">
|
260 |
<div id="post-body" class="with-tooltips">
|
261 |
<div id="post-body-content">
|
276 |
</div>
|
277 |
<?php
|
278 |
}
|
279 |
+
}
|
280 |
}
|
|
classes/class-footer-widgets.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!class_exists('Footer_Credits_Copyright_Widget')) {
|
4 |
+
class Footer_Credits_Copyright_Widget extends WP_Widget {
|
5 |
+
|
6 |
+
const DOMAIN = 'Footer_Credits';
|
7 |
+
|
8 |
+
private $defaults = array(
|
9 |
+
'nav_menu' => 0, 'center' => true, 'two_lines' => true,
|
10 |
+
'show_copyright' => true, 'show_address' => true, 'show_telephone' => true, 'show_email' => false,
|
11 |
+
'show_return' => true, 'return_class' => '', 'footer_class' => '', 'visibility' => '');
|
12 |
+
|
13 |
+
function __construct() {
|
14 |
+
$widget_ops = array( 'description' => __( "A widget displaying menu links, copyright and company details" ) );
|
15 |
+
parent::__construct('footer_copyright', __('Footer Copyright Widget'), $widget_ops);
|
16 |
+
}
|
17 |
+
|
18 |
+
function widget( $args, $instance ) {
|
19 |
+
extract( $args );
|
20 |
+
if (Footer_Credits::hide_widget($instance)) return; //check visibility requirements
|
21 |
+
|
22 |
+
if ($footer = Footer_Credits::footer($instance))
|
23 |
+
printf ('%1$s%2$s%3$s', $before_widget, $footer, $after_widget);
|
24 |
+
}
|
25 |
+
|
26 |
+
function update( $new_instance, $old_instance ) {
|
27 |
+
$instance = $old_instance;
|
28 |
+
$instance['nav_menu'] = !empty($new_instance['nav_menu']) ? $new_instance['nav_menu'] : 0;
|
29 |
+
$instance['show_copyright'] = !empty($new_instance['show_copyright']) ? 1 : 0;
|
30 |
+
$instance['show_telephone'] = !empty($new_instance['show_telephone']) ? 1 : 0;
|
31 |
+
$instance['show_email'] = !empty($new_instance['show_email']) ? 1 : 0;
|
32 |
+
$instance['show_address'] = !empty($new_instance['show_address']) ? 1 : 0;
|
33 |
+
$instance['use_microdata'] = !empty($new_instance['use_microdata']);
|
34 |
+
$instance['center'] = !empty($new_instance['center']) ? 1 : 0;
|
35 |
+
$instance['two_lines'] = !empty($new_instance['two_lines']) ? 1 : 0;
|
36 |
+
$instance['show_return'] = !empty($new_instance['show_return']) ? 1 : 0;
|
37 |
+
$instance['return_class'] = trim($new_instance['return_class']);
|
38 |
+
$instance['footer_class'] = trim($new_instance['footer_class']);
|
39 |
+
$instance['visibility'] = trim($new_instance['visibility']);
|
40 |
+
return $instance;
|
41 |
+
}
|
42 |
+
|
43 |
+
function form( $instance ) {
|
44 |
+
$menu_terms = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
|
45 |
+
if ( !$menu_terms ) {
|
46 |
+
echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.', FOOTER_PUTTER_DOMAIN ), admin_url('nav-menus.php') ) .'</p>';
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
$menus = array();
|
50 |
+
$menus[0] = 'Do not show a menu';
|
51 |
+
foreach ( $menu_terms as $term ) $menus[ $term->term_id ] = $term->name;
|
52 |
+
|
53 |
+
$instance = wp_parse_args( (array) $instance, $this->defaults);
|
54 |
+
$this->print_form_field($instance, 'nav_menu', 'Select Footer Menu', 'select', $menus);
|
55 |
+
$this->print_form_field($instance, 'center', 'Center Menu', 'checkbox');
|
56 |
+
$this->print_form_field($instance, 'two_lines', 'Spread Over Two Lines', 'checkbox');
|
57 |
+
$this->print_form_field($instance, 'show_copyright', 'Show Copyright', 'checkbox');
|
58 |
+
$this->print_form_field($instance, 'show_address', 'Show Address', 'checkbox');
|
59 |
+
$this->print_form_field($instance, 'show_telephone', 'Show Telephone number', 'checkbox');
|
60 |
+
$this->print_form_field($instance, 'show_email', 'Show Email Address', 'checkbox');
|
61 |
+
$this->print_form_field($instance, 'show_return', 'Show Return To Top Links', 'checkbox');
|
62 |
+
if (Footer_Credits::is_html5()) $this->print_form_field($instance, 'use_microdata', 'Use HTML5 Microdata', 'checkbox');
|
63 |
+
|
64 |
+
print <<< CUSTOM_CLASSES
|
65 |
+
<h4>Custom Classes (Optional)</h4>
|
66 |
+
<p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
|
67 |
+
<p>For your convenience we have defined 3 color classes <i>dark</i>, <i>light</i> and <i>white</i>, and 2 size classes,
|
68 |
+
<i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes.</p>
|
69 |
+
CUSTOM_CLASSES;
|
70 |
+
|
71 |
+
$this->print_form_field($instance, 'return_class', 'Return To Top', 'text', array(), array('size' => 10));
|
72 |
+
$this->print_form_field($instance, 'footer_class', 'Footer Credits', 'text', array(), array('size' => 10));
|
73 |
+
$this->print_form_field($instance, 'visibility', '<h4>Widget Visibility</h4>', 'radio',
|
74 |
+
Footer_Credits::get_visibility_options(), array('separator' => '<br/>'));
|
75 |
+
}
|
76 |
+
|
77 |
+
function print_form_field($instance, $fld, $label, $type, $options = array(), $args = array()) {
|
78 |
+
$value = array_key_exists($fld,$instance) ? $instance[$fld] : false;
|
79 |
+
print Footer_Credits::form_field(
|
80 |
+
$this->get_field_id($fld), $this->get_field_name($fld), $label, $value, $type, $options, $args);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
if (!class_exists('Footer_Credits_Trademark_Widget')) {
|
86 |
+
class Footer_Credits_Trademark_Widget extends WP_Widget {
|
87 |
+
|
88 |
+
private $defaults = array( 'title' => '',
|
89 |
+
'category' => false, 'orderby' => 'name', 'limit' => '', 'visibility' => '', 'nofollow' => false);
|
90 |
+
|
91 |
+
function __construct() {
|
92 |
+
$widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks', FOOTER_PUTTER_DOMAIN) );
|
93 |
+
parent::__construct('footer_trademarks', __('Footer Trademarks Widget', FOOTER_PUTTER_DOMAIN), $widget_ops);
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
function nofollow_links( $content) {
|
98 |
+
return preg_replace_callback( '/<a([^>]*)>(.*?)<\/a[^>]*>/is', array( &$this, 'nofollow_link' ), $content ) ;
|
99 |
+
}
|
100 |
+
|
101 |
+
function nofollow_link($matches) { //make link nofollow
|
102 |
+
$attrs = shortcode_parse_atts( stripslashes ($matches[ 1 ]) );
|
103 |
+
$atts='';
|
104 |
+
$rel = ' rel="nofollow"';
|
105 |
+
foreach ( $attrs AS $key => $value ) {
|
106 |
+
$key = strtolower($key);
|
107 |
+
$nofollow = '';
|
108 |
+
if ('rel' == $key) {
|
109 |
+
$rel = '';
|
110 |
+
if (strpos($value, 'follow') === FALSE) $nofollow = ' nofollow';
|
111 |
+
}
|
112 |
+
$atts .= sprintf(' %1$s="%2$s%3$s"', $key, $value, $nofollow);
|
113 |
+
}
|
114 |
+
return sprintf('<a%1$s%2$s>%3$s</a>', $rel, $atts, $matches[ 2 ]);
|
115 |
+
}
|
116 |
+
|
117 |
+
function widget( $args, $instance ) {
|
118 |
+
extract($args, EXTR_SKIP);
|
119 |
+
if (Footer_Credits::hide_widget($instance)) return; //check visibility requirements
|
120 |
+
$title = apply_filters('widget_title', $instance['title'] );
|
121 |
+
$category = isset($instance['category']) ? $instance['category'] : false;
|
122 |
+
$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
|
123 |
+
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
|
124 |
+
$limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
|
125 |
+
$nofollow = isset( $instance['nofollow'] ) && $instance['nofollow'];
|
126 |
+
|
127 |
+
$links = wp_list_bookmarks(apply_filters('widget_links_args', array(
|
128 |
+
'echo' => 0,
|
129 |
+
'title_before' => $before_title, 'title_after' => $after_title,
|
130 |
+
'title_li' => '', 'categorize' => false,
|
131 |
+
'before' => '', 'after' => '',
|
132 |
+
'category_before' => '', 'category_after' => '',
|
133 |
+
'show_images' => true, 'show_description' => false,
|
134 |
+
'show_name' => false, 'show_rating' => false,
|
135 |
+
'category' => $category, 'class' => 'trademark widget',
|
136 |
+
'orderby' => $orderby, 'order' => $order,
|
137 |
+
'limit' => $limit,
|
138 |
+
)));
|
139 |
+
echo $before_widget;
|
140 |
+
if ($title) echo $before_title . $title . $after_title;
|
141 |
+
if ($nofollow)
|
142 |
+
echo $this->nofollow_links($links);
|
143 |
+
else
|
144 |
+
echo $links;
|
145 |
+
echo $after_widget;
|
146 |
+
}
|
147 |
+
|
148 |
+
function update( $new_instance, $old_instance ) {
|
149 |
+
$new_instance = (array) $new_instance;
|
150 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
151 |
+
$instance['orderby'] = 'name';
|
152 |
+
if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
|
153 |
+
$instance['orderby'] = $new_instance['orderby'];
|
154 |
+
$instance['category'] = intval( $new_instance['category'] );
|
155 |
+
$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : '';
|
156 |
+
$instance['nofollow'] = !empty($new_instance['nofollow']);
|
157 |
+
$instance['visibility'] = trim($new_instance['visibility']);
|
158 |
+
return $instance;
|
159 |
+
}
|
160 |
+
|
161 |
+
function form( $instance ) {
|
162 |
+
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
163 |
+
$links = array();
|
164 |
+
$link_cats = get_terms( 'link_category' );
|
165 |
+
foreach ( $link_cats as $link_cat ) {
|
166 |
+
$id = intval($link_cat->term_id);
|
167 |
+
$links[$id] = $link_cat->name;
|
168 |
+
}
|
169 |
+
$this->print_form_field($instance, 'title', 'Title: ', 'text');
|
170 |
+
$this->print_form_field($instance, 'category', 'Select Link Category for Your Trademarks', 'select', $links);
|
171 |
+
$this->print_form_field($instance, 'orderby', 'Sort by', 'select', array(
|
172 |
+
'name' => __( 'Link title'),
|
173 |
+
'rating' => __( 'Link rating'),
|
174 |
+
'id' => __( 'Link ID'),
|
175 |
+
'rand' => __( 'Random')
|
176 |
+
));
|
177 |
+
$this->print_form_field($instance, 'limit', 'Number of links to show', 'text', array(), array('size' => 3 ,'maxlength' => 3));
|
178 |
+
$this->print_form_field($instance, 'nofollow', ' NoFollow links', 'checkbox');
|
179 |
+
$this->print_form_field($instance, 'visibility', '<h4>Widget Visibility</h4>', 'radio',
|
180 |
+
Footer_Credits::get_visibility_options(), array('separator' => '<br/>'));
|
181 |
+
}
|
182 |
+
|
183 |
+
function print_form_field($instance, $fld, $label, $type, $options = array(), $args = array()) {
|
184 |
+
$value = array_key_exists($fld,$instance) ? $instance[$fld] : false;
|
185 |
+
print Footer_Credits::form_field(
|
186 |
+
$this->get_field_id($fld), $this->get_field_name($fld), $label, $value, $type, $options, $args);
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
classes/{footer-credits.php → class-footer.php}
RENAMED
@@ -1,13 +1,14 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
3 |
const CODE = 'footer-credits'; //element prefix
|
4 |
const OPTIONS_NAME = 'footer_credits_options';
|
5 |
const SIDEBAR_ID = 'last-footer';
|
6 |
-
|
7 |
-
private static $version;
|
8 |
-
|
9 |
protected static $is_html5 = false;
|
10 |
protected static $is_landing = false;
|
|
|
|
|
11 |
protected static $options = array();
|
12 |
protected static $defaults = array(
|
13 |
'terms' => array(
|
@@ -49,16 +50,11 @@ class FooterCredits {
|
|
49 |
'use_microdata' => false
|
50 |
);
|
51 |
|
52 |
-
private static function get_version(){
|
53 |
-
return self::$version;
|
54 |
-
}
|
55 |
-
|
56 |
public static function is_html5(){
|
57 |
return self::$is_html5;
|
58 |
}
|
59 |
|
60 |
public static function init() {
|
61 |
-
self::$version = self::VERSION;
|
62 |
self::$is_html5 = function_exists('current_theme_supports') && current_theme_supports('html5');
|
63 |
self::theme_specific_defaults();
|
64 |
add_action('widgets_init',array(__CLASS__,'register'),20);
|
@@ -71,6 +67,24 @@ class FooterCredits {
|
|
71 |
self::register_widgets();
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
public static function prepare() {
|
75 |
add_shortcode(self::CODE.'-copyright', array(__CLASS__, 'copyright_owner' ) );
|
76 |
add_shortcode(self::CODE.'-menu', array(__CLASS__, 'footer_menu' ) );
|
@@ -78,8 +92,8 @@ class FooterCredits {
|
|
78 |
add_filter('widget_text', 'do_shortcode', 11);
|
79 |
add_action('wp_enqueue_scripts',array(__CLASS__, 'enqueue_styles' ));
|
80 |
|
81 |
-
self::$is_landing =
|
82 |
-
|
83 |
//insert custom footer at specified hook
|
84 |
if ($footer_hook = self::get_option('footer_hook')) {
|
85 |
if (self::get_option('footer_remove')) remove_all_actions( $footer_hook);
|
@@ -100,27 +114,9 @@ class FooterCredits {
|
|
100 |
add_filter('the_content', array(__CLASS__, 'terms_filter') );
|
101 |
|
102 |
}
|
103 |
-
|
104 |
-
private static function register_sidebars() {
|
105 |
-
if (self::get_option('footer_hook')) {
|
106 |
-
$tag = self::is_html5() ? 'section' : 'div';
|
107 |
-
register_sidebar( array(
|
108 |
-
'id' => self::SIDEBAR_ID,
|
109 |
-
'name' => __( 'Credibility Footer', __CLASS__ ),
|
110 |
-
'description' => __( 'Custom footer section for copyright, trademarks, etc', __CLASS__),
|
111 |
-
'before_widget' => '<'.$tag.' id="%1$s" class="widget %2$s"><div class="widget-wrap">',
|
112 |
-
'after_widget' => '</div></'.$tag.'>'
|
113 |
-
) );
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
private static function register_widgets() {
|
118 |
-
register_widget( 'Footer_Putter_Copyright_Widget' );
|
119 |
-
register_widget( 'Footer_Putter_TradeMark_Widget' );
|
120 |
-
}
|
121 |
-
|
122 |
public static function enqueue_styles() {
|
123 |
-
wp_enqueue_style(__CLASS__, plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(),
|
124 |
}
|
125 |
|
126 |
public static function fix_home_link( $content, $args) {
|
@@ -516,86 +512,17 @@ TERMS;
|
|
516 |
selected($optkey, $value, false), $optkey, $optlabel);
|
517 |
return sprintf('<select id="%1$s" name="%2$s">%3$s</select>', $fld_id, $fld_name, $input);
|
518 |
}
|
519 |
-
|
520 |
-
}
|
521 |
-
|
522 |
-
class Footer_Putter_Copyright_Widget extends WP_Widget {
|
523 |
-
|
524 |
-
const DOMAIN = 'FooterCredits';
|
525 |
-
|
526 |
-
private $defaults = array(
|
527 |
-
'nav_menu' => 0, 'center' => true, 'two_lines' => true,
|
528 |
-
'show_copyright' => true, 'show_address' => true, 'show_telephone' => true, 'show_email' => false,
|
529 |
-
'show_return' => true, 'return_class' => '', 'footer_class' => '', 'visibility' => '');
|
530 |
-
|
531 |
-
function __construct() {
|
532 |
-
$widget_ops = array( 'description' => __( "A widget displaying menu links, copyright and company details" ) );
|
533 |
-
parent::__construct('footer_copyright', __('Footer Copyright Widget'), $widget_ops);
|
534 |
-
}
|
535 |
|
536 |
-
function
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
$instance['show_email'] = !empty($new_instance['show_email']) ? 1 : 0;
|
550 |
-
$instance['show_address'] = !empty($new_instance['show_address']) ? 1 : 0;
|
551 |
-
$instance['use_microdata'] = !empty($new_instance['use_microdata']);
|
552 |
-
$instance['center'] = !empty($new_instance['center']) ? 1 : 0;
|
553 |
-
$instance['two_lines'] = !empty($new_instance['two_lines']) ? 1 : 0;
|
554 |
-
$instance['show_return'] = !empty($new_instance['show_return']) ? 1 : 0;
|
555 |
-
$instance['return_class'] = trim($new_instance['return_class']);
|
556 |
-
$instance['footer_class'] = trim($new_instance['footer_class']);
|
557 |
-
$instance['visibility'] = trim($new_instance['visibility']);
|
558 |
-
return $instance;
|
559 |
-
}
|
560 |
-
|
561 |
-
function form( $instance ) {
|
562 |
-
$menu_terms = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
|
563 |
-
if ( !$menu_terms ) {
|
564 |
-
echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.', GENESIS_CLUB_DOMAIN ), admin_url('nav-menus.php') ) .'</p>';
|
565 |
-
return;
|
566 |
-
}
|
567 |
-
$menus = array();
|
568 |
-
$menus[0] = 'Do not show a menu';
|
569 |
-
foreach ( $menu_terms as $term ) $menus[ $term->term_id ] = $term->name;
|
570 |
-
|
571 |
-
$instance = wp_parse_args( (array) $instance, $this->defaults);
|
572 |
-
$this->print_form_field($instance, 'nav_menu', 'Select Footer Menu', 'select', $menus);
|
573 |
-
$this->print_form_field($instance, 'center', 'Center Menu', 'checkbox');
|
574 |
-
$this->print_form_field($instance, 'two_lines', 'Spread Over Two Lines', 'checkbox');
|
575 |
-
$this->print_form_field($instance, 'show_copyright', 'Show Copyright', 'checkbox');
|
576 |
-
$this->print_form_field($instance, 'show_address', 'Show Address', 'checkbox');
|
577 |
-
$this->print_form_field($instance, 'show_telephone', 'Show Telephone number', 'checkbox');
|
578 |
-
$this->print_form_field($instance, 'show_email', 'Show Email Address', 'checkbox');
|
579 |
-
$this->print_form_field($instance, 'show_return', 'Show Return To Top Links', 'checkbox');
|
580 |
-
if (FooterCredits::is_html5()) $this->print_form_field($instance, 'use_microdata', 'Use HTML5 Microdata', 'checkbox');
|
581 |
-
|
582 |
-
print <<< CUSTOM_CLASSES
|
583 |
-
<h4>Custom Classes (Optional)</h4>
|
584 |
-
<p>Add any custom CSS classes you want apply to the footer section content to change the font color and size.</p>
|
585 |
-
<p>For your convenience we have defined 3 color classes <i>dark</i>, <i>light</i> and <i>white</i>, and 2 size classes,
|
586 |
-
<i>small</i> and <i>tiny</i>. Feel free to use these alongside your own custom CSS classes.</p>
|
587 |
-
CUSTOM_CLASSES;
|
588 |
-
|
589 |
-
$this->print_form_field($instance, 'return_class', 'Return To Top', 'text', array(), array('size' => 10));
|
590 |
-
$this->print_form_field($instance, 'footer_class', 'Footer Credits', 'text', array(), array('size' => 10));
|
591 |
-
$this->print_form_field($instance, 'visibility', '<h4>Widget Visibility</h4>', 'radio',
|
592 |
-
FooterCredits::get_visibility_options(), array('separator' => '<br/>'));
|
593 |
-
}
|
594 |
-
|
595 |
-
function print_form_field($instance, $fld, $label, $type, $options = array(), $args = array()) {
|
596 |
-
$value = array_key_exists($fld,$instance) ? $instance[$fld] : false;
|
597 |
-
print FooterCredits::form_field(
|
598 |
-
$this->get_field_id($fld), $this->get_field_name($fld), $label, $value, $type, $options, $args);
|
599 |
-
}
|
600 |
-
|
601 |
-
}
|
1 |
<?php
|
2 |
+
if (!class_exists('Footer_Credits')) {
|
3 |
+
class Footer_Credits {
|
4 |
const CODE = 'footer-credits'; //element prefix
|
5 |
const OPTIONS_NAME = 'footer_credits_options';
|
6 |
const SIDEBAR_ID = 'last-footer';
|
7 |
+
|
|
|
|
|
8 |
protected static $is_html5 = false;
|
9 |
protected static $is_landing = false;
|
10 |
+
protected static $landing_page_templates = array('page_landing.php');
|
11 |
+
|
12 |
protected static $options = array();
|
13 |
protected static $defaults = array(
|
14 |
'terms' => array(
|
50 |
'use_microdata' => false
|
51 |
);
|
52 |
|
|
|
|
|
|
|
|
|
53 |
public static function is_html5(){
|
54 |
return self::$is_html5;
|
55 |
}
|
56 |
|
57 |
public static function init() {
|
|
|
58 |
self::$is_html5 = function_exists('current_theme_supports') && current_theme_supports('html5');
|
59 |
self::theme_specific_defaults();
|
60 |
add_action('widgets_init',array(__CLASS__,'register'),20);
|
67 |
self::register_widgets();
|
68 |
}
|
69 |
|
70 |
+
private static function register_sidebars() {
|
71 |
+
if (self::get_option('footer_hook')) {
|
72 |
+
$tag = self::is_html5() ? 'section' : 'div';
|
73 |
+
register_sidebar( array(
|
74 |
+
'id' => self::SIDEBAR_ID,
|
75 |
+
'name' => __( 'Credibility Footer', __CLASS__ ),
|
76 |
+
'description' => __( 'Custom footer section for copyright, trademarks, etc', __CLASS__),
|
77 |
+
'before_widget' => '<'.$tag.' id="%1$s" class="widget %2$s"><div class="widget-wrap">',
|
78 |
+
'after_widget' => '</div></'.$tag.'>'
|
79 |
+
) );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
private static function register_widgets() {
|
84 |
+
register_widget( 'Footer_Credits_Copyright_Widget' );
|
85 |
+
register_widget( 'Footer_Credits_Trademark_Widget' );
|
86 |
+
}
|
87 |
+
|
88 |
public static function prepare() {
|
89 |
add_shortcode(self::CODE.'-copyright', array(__CLASS__, 'copyright_owner' ) );
|
90 |
add_shortcode(self::CODE.'-menu', array(__CLASS__, 'footer_menu' ) );
|
92 |
add_filter('widget_text', 'do_shortcode', 11);
|
93 |
add_action('wp_enqueue_scripts',array(__CLASS__, 'enqueue_styles' ));
|
94 |
|
95 |
+
self::$is_landing = self::is_landing_page(); //is this a landing page
|
96 |
+
|
97 |
//insert custom footer at specified hook
|
98 |
if ($footer_hook = self::get_option('footer_hook')) {
|
99 |
if (self::get_option('footer_remove')) remove_all_actions( $footer_hook);
|
114 |
add_filter('the_content', array(__CLASS__, 'terms_filter') );
|
115 |
|
116 |
}
|
117 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
public static function enqueue_styles() {
|
119 |
+
wp_enqueue_style(__CLASS__, plugins_url('styles/footer-credits.css',dirname(__FILE__)), array(), Footer_Credits_Plugin::get_version());
|
120 |
}
|
121 |
|
122 |
public static function fix_home_link( $content, $args) {
|
512 |
selected($optkey, $value, false), $optkey, $optlabel);
|
513 |
return sprintf('<select id="%1$s" name="%2$s">%3$s</select>', $fld_id, $fld_name, $input);
|
514 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
|
516 |
+
public static function is_landing_page() {
|
517 |
+
if (is_page()) {
|
518 |
+
global $post;
|
519 |
+
$page_template_file = get_post_meta($post->ID,'_wp_page_template',true);
|
520 |
+
// you can add your own landing page templates to the array using the filter
|
521 |
+
$landing_page_templates = (array) apply_filters('footer_putter_landing_page_templates', self::$landing_page_templates);
|
522 |
+
return in_array($page_template_file, $landing_page_templates );
|
523 |
+
} else {
|
524 |
+
return false;
|
525 |
+
}
|
526 |
+
}
|
527 |
+
}
|
528 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/class-plugin.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Footer_Credits_Plugin {
|
3 |
+
|
4 |
+
private static $path = FOOTER_PUTTER_PATH;
|
5 |
+
private static $slug = FOOTER_PUTTER_PLUGIN_NAME;
|
6 |
+
private static $version = FOOTER_PUTTER_VERSION;
|
7 |
+
|
8 |
+
public static function get_path(){
|
9 |
+
return self::$path;
|
10 |
+
}
|
11 |
+
|
12 |
+
public static function get_slug(){
|
13 |
+
return self::$slug;
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function get_version(){
|
17 |
+
return self::$version;
|
18 |
+
}
|
19 |
+
|
20 |
+
public static function init() {
|
21 |
+
$dir = dirname(__FILE__) . '/';
|
22 |
+
require_once($dir . 'class-footer.php');
|
23 |
+
require_once($dir . 'class-footer-widgets.php');
|
24 |
+
Footer_Credits::init();
|
25 |
+
}
|
26 |
+
|
27 |
+
public static function admin_init() {
|
28 |
+
$dir = dirname(__FILE__) . '/';
|
29 |
+
require_once($dir . 'class-tooltip.php');
|
30 |
+
require_once($dir . 'class-admin.php');
|
31 |
+
require_once($dir . 'class-credits-admin.php');
|
32 |
+
require_once($dir . 'class-trademarks-admin.php');
|
33 |
+
Footer_Putter_Admin::init();
|
34 |
+
Footer_Credits_Admin::init();
|
35 |
+
Footer_Trademarks_Admin::init();
|
36 |
+
add_filter('pre_option_link_manager_enabled', '__return_true' );
|
37 |
+
add_filter('plugin_action_links',array(__CLASS__, 'plugin_action_links'), 10, 2 );
|
38 |
+
}
|
39 |
+
|
40 |
+
static function plugin_action_links( $links, $file ) {
|
41 |
+
if ( is_array($links) && (self::get_path() == $file )) {
|
42 |
+
$settings_link = '<a href="' . admin_url( 'admin.php?page='.self::get_slug()) . '">Settings</a>';
|
43 |
+
array_unshift( $links, $settings_link );
|
44 |
+
}
|
45 |
+
return $links;
|
46 |
+
}
|
47 |
+
}
|
classes/{tooltip.php → class-tooltip.php}
RENAMED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
-
if (!class_exists('
|
3 |
-
class
|
4 |
-
const DOMAIN = 'diytooltip';
|
5 |
private $labels = array();
|
6 |
private $tabindex;
|
7 |
function __construct($labels) {
|
@@ -10,11 +9,11 @@ if (!class_exists('DIYTooltip')) {
|
|
10 |
}
|
11 |
|
12 |
function heading($label) {
|
13 |
-
return array_key_exists($label,$this->labels) ? __($this->labels[$label]['heading']
|
14 |
}
|
15 |
|
16 |
function text($label) {
|
17 |
-
return array_key_exists($label,$this->labels) ? __($this->labels[$label]['tip']
|
18 |
}
|
19 |
|
20 |
function label($label, $text_only=false) {
|
@@ -28,4 +27,3 @@ if (!class_exists('DIYTooltip')) {
|
|
28 |
}
|
29 |
}
|
30 |
}
|
31 |
-
?>
|
1 |
<?php
|
2 |
+
if (!class_exists('DIY_Tooltip')) {
|
3 |
+
class DIY_Tooltip {
|
|
|
4 |
private $labels = array();
|
5 |
private $tabindex;
|
6 |
function __construct($labels) {
|
9 |
}
|
10 |
|
11 |
function heading($label) {
|
12 |
+
return array_key_exists($label,$this->labels) ? __($this->labels[$label]['heading']) : '';
|
13 |
}
|
14 |
|
15 |
function text($label) {
|
16 |
+
return array_key_exists($label,$this->labels) ? __($this->labels[$label]['tip']) : '';
|
17 |
}
|
18 |
|
19 |
function label($label, $text_only=false) {
|
27 |
}
|
28 |
}
|
29 |
}
|
|
classes/{footer-trademarks-admin.php → class-trademarks-admin.php}
RENAMED
@@ -1,33 +1,25 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
3 |
const CODE = 'footer-putter'; //prefix ID of CSS elements
|
4 |
const SLUG = 'trademarks';
|
5 |
const FIELDNAME = 'not_on_404';
|
6 |
|
7 |
-
private static $version;
|
8 |
-
private static $parenthook;
|
9 |
private static $slug;
|
10 |
private static $screen_id;
|
11 |
|
12 |
-
public static function init(
|
13 |
-
|
14 |
-
self::$parenthook = $parent;
|
15 |
-
self::$slug = self::$parenthook . '-' . self::SLUG;
|
16 |
-
self::$screen_id = self::$parenthook.'_page_' . self::$slug;
|
17 |
add_action('admin_menu',array(__CLASS__, 'admin_menu'));
|
18 |
}
|
19 |
|
20 |
-
private static function get_version(){
|
21 |
-
return self::$version;
|
22 |
-
}
|
23 |
-
|
24 |
-
private static function get_parenthook(){
|
25 |
-
return self::$parenthook;
|
26 |
-
}
|
27 |
-
|
28 |
public static function get_slug(){
|
29 |
return self::$slug;
|
30 |
}
|
|
|
|
|
|
|
|
|
31 |
|
32 |
private static function get_screen_id(){
|
33 |
return self::$screen_id;
|
@@ -41,8 +33,9 @@ class FooterTrademarksAdmin {
|
|
41 |
}
|
42 |
|
43 |
public static function admin_menu() {
|
44 |
-
add_submenu_page(
|
45 |
self::get_slug(), array(__CLASS__,'settings_panel'));
|
|
|
46 |
add_action('load-'.self::get_screen_id(), array(__CLASS__, 'load_page'));
|
47 |
}
|
48 |
|
@@ -51,12 +44,12 @@ class FooterTrademarksAdmin {
|
|
51 |
}
|
52 |
|
53 |
public static function enqueue_styles() {
|
54 |
-
wp_enqueue_style(self::CODE.'-admin', plugins_url('styles/admin.css', dirname(__FILE__)), array(),
|
55 |
}
|
56 |
|
57 |
public static function settings_panel() {
|
58 |
$this_url = $_SERVER['REQUEST_URI'];
|
59 |
-
$title = sprintf('<h2>%1$s</h2>', __('Footer Trademarks'));
|
60 |
$screenshot2 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
|
61 |
$screenshot3 = plugins_url('images/add-link.jpg',dirname(__FILE__));
|
62 |
$linkcat = admin_url('edit-tags.php?taxonomy=link_category');
|
@@ -64,7 +57,7 @@ class FooterTrademarksAdmin {
|
|
64 |
$widgets = admin_url('widgets.php');
|
65 |
?>
|
66 |
<div class="wrap">
|
67 |
-
<?php
|
68 |
<div id="poststuff" class="metabox-holder"><div id="post-body"><div id="post-body-content">
|
69 |
<p class="notice">There are no settings on this page.</p>
|
70 |
<p class="notice">However, links are provided to where you set up trademarks or other symbols you want to appear in the footer.</p>
|
@@ -89,5 +82,5 @@ area and select <i>Trademarks</i> as the link category.</p>
|
|
89 |
</div></div><br class="clear"/></div></div>
|
90 |
<?php
|
91 |
}
|
|
|
92 |
}
|
93 |
-
?>
|
1 |
<?php
|
2 |
+
if (!class_exists('Footer_Trademarks_Admin')) {
|
3 |
+
class Footer_Trademarks_Admin {
|
4 |
const CODE = 'footer-putter'; //prefix ID of CSS elements
|
5 |
const SLUG = 'trademarks';
|
6 |
const FIELDNAME = 'not_on_404';
|
7 |
|
|
|
|
|
8 |
private static $slug;
|
9 |
private static $screen_id;
|
10 |
|
11 |
+
public static function init() {
|
12 |
+
self::$slug = Footer_Credits_Plugin::get_slug() . '-' . self::SLUG;
|
|
|
|
|
|
|
13 |
add_action('admin_menu',array(__CLASS__, 'admin_menu'));
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public static function get_slug(){
|
17 |
return self::$slug;
|
18 |
}
|
19 |
+
|
20 |
+
public static function get_url() {
|
21 |
+
return admin_url('admin.php?page='.self::get_slug());
|
22 |
+
}
|
23 |
|
24 |
private static function get_screen_id(){
|
25 |
return self::$screen_id;
|
33 |
}
|
34 |
|
35 |
public static function admin_menu() {
|
36 |
+
add_submenu_page(Footer_Credits_Plugin::get_slug(), __('Footer Trademarks'), __('Footer Trademarks'), 'manage_options',
|
37 |
self::get_slug(), array(__CLASS__,'settings_panel'));
|
38 |
+
self::$screen_id = Footer_Credits_Plugin::get_slug().'_page_' . self::$slug;
|
39 |
add_action('load-'.self::get_screen_id(), array(__CLASS__, 'load_page'));
|
40 |
}
|
41 |
|
44 |
}
|
45 |
|
46 |
public static function enqueue_styles() {
|
47 |
+
wp_enqueue_style(self::CODE.'-admin', plugins_url('styles/admin.css', dirname(__FILE__)), array(), Footer_Credits_Plugin::get_version());
|
48 |
}
|
49 |
|
50 |
public static function settings_panel() {
|
51 |
$this_url = $_SERVER['REQUEST_URI'];
|
52 |
+
$title = sprintf('<h2 class="title">%1$s</h2>', __('Footer Trademarks'));
|
53 |
$screenshot2 = plugins_url('images/add-link-category.jpg',dirname(__FILE__));
|
54 |
$screenshot3 = plugins_url('images/add-link.jpg',dirname(__FILE__));
|
55 |
$linkcat = admin_url('edit-tags.php?taxonomy=link_category');
|
57 |
$widgets = admin_url('widgets.php');
|
58 |
?>
|
59 |
<div class="wrap">
|
60 |
+
<?php echo $title; ?>
|
61 |
<div id="poststuff" class="metabox-holder"><div id="post-body"><div id="post-body-content">
|
62 |
<p class="notice">There are no settings on this page.</p>
|
63 |
<p class="notice">However, links are provided to where you set up trademarks or other symbols you want to appear in the footer.</p>
|
82 |
</div></div><br class="clear"/></div></div>
|
83 |
<?php
|
84 |
}
|
85 |
+
}
|
86 |
}
|
|
classes/footer-trademarks.php
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Footer_Putter_TradeMark_Widget extends WP_Widget {
|
3 |
-
|
4 |
-
private $defaults = array(
|
5 |
-
'category' => false, 'orderby' => 'name', 'limit' => '', 'visibility' => '', 'nofollow' => false);
|
6 |
-
|
7 |
-
function __construct() {
|
8 |
-
$widget_ops = array('description' => __( 'Trademarks, Service Marks and Kitemarks', GENESIS_CLUB_DOMAIN) );
|
9 |
-
parent::__construct('footer_trademarks', __('TradeMarks Widget', GENESIS_CLUB_DOMAIN), $widget_ops);
|
10 |
-
}
|
11 |
-
|
12 |
-
|
13 |
-
function nofollow_links( $content) {
|
14 |
-
return preg_replace_callback( '/<a([^>]*)>(.*?)<\/a[^>]*>/is', array( &$this, 'nofollow_link' ), $content ) ;
|
15 |
-
}
|
16 |
-
|
17 |
-
function nofollow_link($matches) { //make link nofollow
|
18 |
-
$attrs = shortcode_parse_atts( stripslashes ($matches[ 1 ]) );
|
19 |
-
$atts='';
|
20 |
-
$rel = ' rel="nofollow"';
|
21 |
-
foreach ( $attrs AS $key => $value ) {
|
22 |
-
$key = strtolower($key);
|
23 |
-
$nofollow = '';
|
24 |
-
if ('rel' == $key) {
|
25 |
-
$rel = '';
|
26 |
-
if (strpos($value, 'follow') === FALSE) $nofollow = ' nofollow';
|
27 |
-
}
|
28 |
-
$atts .= sprintf(' %1$s="%2$s%3$s"', $key, $value, $nofollow);
|
29 |
-
}
|
30 |
-
return sprintf('<a%1$s%2$s>%3$s</a>', $rel, $atts, $matches[ 2 ]);
|
31 |
-
}
|
32 |
-
|
33 |
-
function widget( $args, $instance ) {
|
34 |
-
extract($args, EXTR_SKIP);
|
35 |
-
if (FooterCredits::hide_widget($instance)) return; //check visibility requirements
|
36 |
-
|
37 |
-
$category = isset($instance['category']) ? $instance['category'] : false;
|
38 |
-
$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
|
39 |
-
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
|
40 |
-
$limit = (isset( $instance['limit'] ) && $instance['limit']) ? $instance['limit'] : -1;
|
41 |
-
$nofollow = isset( $instance['nofollow'] ) && $instance['nofollow'];
|
42 |
-
|
43 |
-
$links = wp_list_bookmarks(apply_filters('widget_links_args', array(
|
44 |
-
'echo' => 0,
|
45 |
-
'title_before' => $before_title, 'title_after' => $after_title,
|
46 |
-
'title_li' => '', 'categorize' => false,
|
47 |
-
'before' => '', 'after' => '',
|
48 |
-
'category_before' => '', 'category_after' => '',
|
49 |
-
'show_images' => true, 'show_description' => false,
|
50 |
-
'show_name' => false, 'show_rating' => false,
|
51 |
-
'category' => $category, 'class' => 'trademark widget',
|
52 |
-
'orderby' => $orderby, 'order' => $order,
|
53 |
-
'limit' => $limit,
|
54 |
-
)));
|
55 |
-
echo $before_widget;
|
56 |
-
if ($nofollow)
|
57 |
-
echo $this->nofollow_links($links);
|
58 |
-
else
|
59 |
-
echo $links;
|
60 |
-
echo $after_widget;
|
61 |
-
}
|
62 |
-
|
63 |
-
function update( $new_instance, $old_instance ) {
|
64 |
-
$new_instance = (array) $new_instance;
|
65 |
-
$instance['orderby'] = 'name';
|
66 |
-
if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
|
67 |
-
$instance['orderby'] = $new_instance['orderby'];
|
68 |
-
$instance['category'] = intval( $new_instance['category'] );
|
69 |
-
$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : '';
|
70 |
-
$instance['nofollow'] = !empty($new_instance['nofollow']);
|
71 |
-
$instance['visibility'] = trim($new_instance['visibility']);
|
72 |
-
return $instance;
|
73 |
-
}
|
74 |
-
|
75 |
-
function form( $instance ) {
|
76 |
-
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
77 |
-
$links = array();
|
78 |
-
$link_cats = get_terms( 'link_category' );
|
79 |
-
foreach ( $link_cats as $link_cat ) {
|
80 |
-
$id = intval($link_cat->term_id);
|
81 |
-
$links[$id] = $link_cat->name;
|
82 |
-
}
|
83 |
-
$this->print_form_field($instance, 'category', 'Select Link Category for Your Trademarks', 'select', $links);
|
84 |
-
$this->print_form_field($instance, 'orderby', 'Sort by', 'select', array(
|
85 |
-
'name' => __( 'Link title'),
|
86 |
-
'rating' => __( 'Link rating'),
|
87 |
-
'id' => __( 'Link ID'),
|
88 |
-
'rand' => __( 'Random')
|
89 |
-
));
|
90 |
-
$this->print_form_field($instance, 'limit', 'Number of links to show', 'text', array(), array('size' => 3 ,'maxlength' => 3));
|
91 |
-
$this->print_form_field($instance, 'nofollow', ' NoFollow links', 'checkbox');
|
92 |
-
$this->print_form_field($instance, 'visibility', '<h4>Widget Visibility</h4>', 'radio',
|
93 |
-
FooterCredits::get_visibility_options(), array('separator' => '<br/>'));
|
94 |
-
}
|
95 |
-
|
96 |
-
function print_form_field($instance, $fld, $label, $type, $options = array(), $args = array()) {
|
97 |
-
$value = array_key_exists($fld,$instance) ? $instance[$fld] : false;
|
98 |
-
print FooterCredits::form_field(
|
99 |
-
$this->get_field_id($fld), $this->get_field_name($fld), $label, $value, $type, $options, $args);
|
100 |
-
}
|
101 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/plugin.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class FooterCreditsPlugin {
|
3 |
-
|
4 |
-
public static function init() {
|
5 |
-
$dir = dirname(__FILE__) . '/';
|
6 |
-
require_once($dir . 'footer-credits.php');
|
7 |
-
require_once($dir . 'footer-trademarks.php');
|
8 |
-
FooterCredits::init();
|
9 |
-
}
|
10 |
-
|
11 |
-
public static function admin_init() {
|
12 |
-
$dir = dirname(__FILE__) . '/';
|
13 |
-
require_once($dir . 'tooltip.php');
|
14 |
-
require_once($dir . 'admin.php');
|
15 |
-
require_once($dir . 'footer-credits-admin.php');
|
16 |
-
require_once($dir . 'footer-trademarks-admin.php');
|
17 |
-
FooterPutterAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
|
18 |
-
FooterCreditsAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
|
19 |
-
FooterTrademarksAdmin::init(FOOTER_PUTTER_PLUGIN_NAME);
|
20 |
-
}
|
21 |
-
}
|
22 |
-
add_action ('init', array('FooterCreditsPlugin', 'init'), 0);
|
23 |
-
if (is_admin()) add_action ('init', array('FooterCreditsPlugin', 'admin_init'), 0);
|
24 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main.php
CHANGED
@@ -3,15 +3,20 @@
|
|
3 |
* Plugin Name: Footer Putter
|
4 |
* Plugin URI: http://www.diywebmastery.com/plugins/footer-putter/
|
5 |
* Description: Put a footer on your site that boosts your credibility with both search engines and human visitors.
|
6 |
-
* Version: 1.
|
7 |
* Author: Russell Jamieson
|
8 |
* Author URI: http://www.diywebmastery.com/about/
|
9 |
* License: GPLv2+
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
*/
|
12 |
-
define('FOOTER_PUTTER_VERSION','1.
|
13 |
define('FOOTER_PUTTER_FRIENDLY_NAME', 'Footer Putter') ;
|
|
|
|
|
14 |
define('FOOTER_PUTTER_PLUGIN_NAME', plugin_basename(dirname(__FILE__))) ;
|
15 |
define('FOOTER_PUTTER_HOME_URL','http://www.diywebmastery.com/plugins/footer-putter/');
|
16 |
-
|
|
|
|
|
|
|
17 |
?>
|
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.9
|
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.9');
|
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 |
+
|
19 |
+
require_once(dirname(__FILE__) . '/classes/class-plugin.php');
|
20 |
+
add_action ('init', array('Footer_Credits_Plugin', 'init'), 0);
|
21 |
+
if (is_admin()) add_action ('init', array('Footer_Credits_Plugin', 'admin_init'), 0);
|
22 |
?>
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: powerblogservice, diywebmastery
|
|
3 |
Donate link: http://www.diywebmastery.com/donate/
|
4 |
Tags: footer, copyright, trademark
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -23,7 +23,7 @@ Put a footer on your site that boosts your credibility with both search engines
|
|
23 |
* The Footer hook setting allows you to add the footer in just the right place on themes that do not have suitable widget areas
|
24 |
* Predefined classes tiny, small, light, dark and white make it easy to change footer size and color if required.
|
25 |
* Can append company contact information to Privacy and Terms and Conditions pages.
|
26 |
-
* Added widget visibility control: show always, do not show on landing pages, only show on landing pages.
|
27 |
* Automatic HTML5 support
|
28 |
* Option to use HTML5 microdata for Organization in accordance with Google recommendations
|
29 |
* Option to apply rel=nofollow automatically to footer trademark links
|
@@ -48,7 +48,8 @@ Put a footer on your site that boosts your credibility with both search engines
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
-
= 1.
|
|
|
52 |
= 1.7.1 = Fix bug when loaded under AJAX
|
53 |
= 1.7 = Made email address a mailto link. Added pre-defined classes, tiny and small, to make it easy to use a smaller font size in the footer on pages such as landing pages. Added widget visibility setting to make it easy to either hide or show the footer widgets on landing pages. Replaced the plugin icon image in admin menu with a dashicons font character. Automatically uses HTML5 if theme supports HTML5 - no manual setting required.
|
54 |
= 1.6 = Add option to include email address in the copyright footer widget, remove the automatic adding of rel=nofollow in footer links, and add optional sub-footer sections to the privacy and terms pages
|
@@ -62,8 +63,8 @@ Put a footer on your site that boosts your credibility with both search engines
|
|
62 |
|
63 |
== Upgrade Notice ==
|
64 |
|
65 |
-
= 1.
|
66 |
-
* Optional -
|
67 |
|
68 |
== Links ==
|
69 |
|
3 |
Donate link: http://www.diywebmastery.com/donate/
|
4 |
Tags: footer, copyright, trademark
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.9.1
|
7 |
+
Stable tag: 1.9
|
8 |
License: GPLv2+
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
23 |
* The Footer hook setting allows you to add the footer in just the right place on themes that do not have suitable widget areas
|
24 |
* Predefined classes tiny, small, light, dark and white make it easy to change footer size and color if required.
|
25 |
* Can append company contact information to Privacy and Terms and Conditions pages.
|
26 |
+
* Added widget visibility control: "show always", "do not show on landing pages", "only show on landing pages".
|
27 |
* Automatic HTML5 support
|
28 |
* Option to use HTML5 microdata for Organization in accordance with Google recommendations
|
29 |
* Option to apply rel=nofollow automatically to footer trademark links
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.9 = Added title to Footer Trademarks Widget, improved control over widgets on landing pages with a filter hook, improved online documentation, refactored code in accordance with current WordPress coding standards.
|
52 |
+
= 1.8 = Added options to use HTML5 microdata and location geo-coordinates for the business location and to apply rel=nofollow to footer trademark links
|
53 |
= 1.7.1 = Fix bug when loaded under AJAX
|
54 |
= 1.7 = Made email address a mailto link. Added pre-defined classes, tiny and small, to make it easy to use a smaller font size in the footer on pages such as landing pages. Added widget visibility setting to make it easy to either hide or show the footer widgets on landing pages. Replaced the plugin icon image in admin menu with a dashicons font character. Automatically uses HTML5 if theme supports HTML5 - no manual setting required.
|
55 |
= 1.6 = Add option to include email address in the copyright footer widget, remove the automatic adding of rel=nofollow in footer links, and add optional sub-footer sections to the privacy and terms pages
|
63 |
|
64 |
== Upgrade Notice ==
|
65 |
|
66 |
+
= 1.9 =
|
67 |
+
* Optional - Added title to Footer Trademarks Widget, improved control over use on landing pages and better documentation
|
68 |
|
69 |
== Links ==
|
70 |
|