Insert Headers and Footers - Version 1.3.1

Version Description

  • Improved settings UI for WordPress 3.8+
  • Bumped minimum version requirement
Download this release

Release Info

Developer n7studios
Plugin Icon 128x128 Insert Headers and Footers
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3 to 1.3.1

_modules/dashboard/css/admin.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ #wpbeginner a { text-decoration: none; }
2
+ #wpbeginner a.rss { background: url(http://cdn.wpbeginner.com/pluginimages/feed.png) 0 50% no-repeat; padding: 0 15px 0 20px; }
3
+ #wpbeginner a.email { background: url(http://cdn.wpbeginner.com/pluginimages/email.gif) 0 50% no-repeat; padding: 0 15px 0 20px; }
4
+ #wpbeginner a.facebook { background: url(http://cdn.wpbeginner.com/pluginimages/facebook.png) 0 50% no-repeat; padding: 0 0 0 20px; }
_modules/dashboard/dashboard.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dashboard Widget
4
+ */
5
+ class WPBeginnerDashboardWidget {
6
+ /**
7
+ * Constructor
8
+ *
9
+ * @param object $plugin Plugin Object (name, displayName, version, folder, url)
10
+ */
11
+ function __construct($plugin) {
12
+ // Plugin Details
13
+ $this->dashboard = $plugin;
14
+ $this->dashboardURL = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
15
+
16
+ // Hooks
17
+ add_action('admin_enqueue_scripts', array(&$this, 'adminScriptsAndCSS'));
18
+ add_action('wp_dashboard_setup', array(&$this, 'dashboardWidget'));
19
+ add_action('wp_network_dashboard_setup', array(&$this, 'dashboardWidget'));
20
+ }
21
+
22
+ /**
23
+ * Register and enqueue dashboard CSS
24
+ */
25
+ function adminScriptsAndCSS() {
26
+ // CSS
27
+ // This will only enqueue once, despite this hook being called by up to several plugins,
28
+ // as we have set a single, distinct name
29
+ wp_enqueue_style('wpbeginner', $this->dashboardURL.'css/admin.css');
30
+ }
31
+
32
+ /**
33
+ * Adds a dashboard widget to output WPBeginner RSS
34
+ *
35
+ * Checks if another WPBeginner plugin has already created this widget - if so, doesn't duplicate it
36
+ */
37
+ function dashboardWidget() {
38
+ global $wp_meta_boxes;
39
+
40
+ if (isset($wp_meta_boxes['dashboard']['normal']['core']['wpbeginner'])) return; // Another plugin has already registered this widget
41
+ wp_add_dashboard_widget('wpbeginner', __('Latest from WPBeginner', $this->dashboard->name), array(&$this, 'outputDashboardWidget'));
42
+ }
43
+
44
+ /**
45
+ * Called by dashboardWidget(), includes dashboard.php to output the Dashboard Widget
46
+ */
47
+ function outputDashboardWidget() {
48
+ $result = wp_remote_get('http://wpbeginner.com/feed/');
49
+ if (!is_wp_error($result)) {
50
+ if ($result['response']['code'] == 200) {
51
+ $xml = simplexml_load_string($result['body']);
52
+ $rssPosts = $xml->channel;
53
+ }
54
+
55
+ include_once(WP_PLUGIN_DIR.'/'.$this->dashboard->name.'/_modules/dashboard/views/dashboard.php');
56
+ } else {
57
+ include_once(WP_PLUGIN_DIR.'/'.$this->dashboard->name.'/_modules/dashboard/views/dashboard-nodata.php');
58
+ }
59
+ }
60
+ }
61
+ ?>
_modules/dashboard/views/dashboard-nodata.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dashboard Widget (no RSS data available)
4
+ */
5
+ ?>
6
+ <div class="rss-widget">
7
+ <img src="<?php echo $this->dashboardURL; ?>images/logo.png" class="alignleft" style="margin: 0 10px 0 0;" />
8
+ <p><?php _e('Thanks for using our plugins - why not check out some of our other amazing Premium WordPress Plugins?'); ?></p>
9
+ <p><a href="http://www.wpcube.co.uk/?utm_source=wordpress&utm_medium=link&utm_content=dashboard&utm_campaign=general" target="_blank" class="button"><?php _e('Visit WP Cube'); ?></a></p>
10
+ </div>
_modules/dashboard/views/dashboard.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Dashboard RSS Feed Widget
4
+ */
5
+ ?>
6
+ <div class="rss-widget">
7
+ <img src="http://cdn.wpbeginner.com/pluginimages/wpbeginner.gif" class="alignright" />
8
+
9
+ <ul>
10
+ <?php
11
+ foreach ($rssPosts->item as $key=>$rssPost) {
12
+ ?>
13
+ <li>
14
+ <a href="<?php echo (string) $rssPost->link; ?>" target="_blank" class="rsswidget"><?php echo (string) $rssPost->title; ?></a>
15
+ <span class="rss-date"><?php echo date('F j, Y', strtotime($rssPost->pubDate)); ?></span>
16
+ </li>
17
+ <?php
18
+ }
19
+ ?>
20
+
21
+ <li>
22
+ <hr />
23
+ <a href="http://feeds2.feedburner.com/wpbeginner" class="rss" target="_blank"><?php _e('Subscribe with RSS', $this->dashboard->name); ?></a>
24
+ <a href="http://www.wpbeginner.com/wordpress-newsletter/" class="email" target="_blank"><?php _e('Subscribe by email', $this->dashboard->name); ?></a>
25
+ <a href="http://facebook.com/wpbeginner/" class="facebook" target="_blank"><?php _e('Join us on Facebook', $this->dashboard->name); ?></a>
26
+ </li>
27
+ </ul>
28
+ </div>
_modules/dashboard/views/sidebar-donate.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Donations Sidebar
4
+ */
5
+ ?>
6
+ <!-- Improve Your Site -->
7
+ <div class="postbox">
8
+ <h3 class="hndle">
9
+ <span><?php _e('Improve Your Site', $this->plugin->name); ?></span>
10
+ </h3>
11
+
12
+ <div class="inside">
13
+ <p>
14
+ <?php _e('Want to take your site to the next level? Look behind the scenes of WPBeginner to see what you can do!', $this->plugin->name); ?>
15
+ </p>
16
+
17
+ <a href="http://www.wpbeginner.com/blueprint/" class="button" target="_blank">
18
+ <?php _e('WPBeginner\'s Blueprint &raquo;', $this->plugin->name); ?>
19
+ </a>
20
+ </div>
21
+ </div>
22
+
23
+ <!-- Donate -->
24
+ <div class="postbox">
25
+ <h3 class="hndle">
26
+ <span><?php _e('Spread The Word', $this->plugin->name); ?></span>
27
+ </h3>
28
+
29
+ <div class="inside">
30
+ <p>
31
+ <?php _e('Want to help make this plugin even better? All donations are used to improve this plugin, so donate $10, $20 or $50 now!', $this->plugin->name); ?>
32
+ </p>
33
+ <p>
34
+ <a href="#" target="_blank">
35
+ <?php _e('Find out more.', $this->plugin->name); ?>
36
+ </a>
37
+ </p>
38
+ <p>
39
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=RK3BGVNS5L4ZW" target="_blank">
40
+ <img src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" alt="<?php _e('Donate to WPBeginner', $this->plugin->name); ?>">
41
+ </a>
42
+ </p>
43
+ </div>
44
+ </div>
ihaf.css DELETED
@@ -1,40 +0,0 @@
1
- @charset "utf-8";
2
- /* CSS Document */
3
-
4
- #ihaf-wrap .wrap {float: left; width: 100%;}
5
-
6
- .ihaf-labels {display: block; margin: 0 0 10px 0;}
7
-
8
- .footerlabel {margin-top: 25px;}
9
-
10
- .ihaf-wrap { margin: 40px 0 0 40px; float: left; width: 70%;}
11
-
12
- /* Sidebar */
13
-
14
- .ihaf-sidebar {float: left; width: 20%; min-width: 200px;}
15
-
16
- .ihaf-sidebar h2 { color: #00000; font-size: 16px;}
17
-
18
- .ihaf-improve-site {background: #CFC; padding: 10px 15px; border: 1px solid green; }
19
-
20
- .ihaf-improve-site a {text-decoration: none; background: #21759B; color: #EAF2FA; padding: 4px 10px; line-height: 15px; border-radius: 10px; font-weight: bold;}
21
-
22
- .ihaf-improve-site a:hover {color: #EAF2FA;}
23
-
24
- .ihaf-support {margin: 15px 0 0 0; border: 1px solid #CCC; padding: 10px 15px;}
25
-
26
- .ihaf-donate {background: #CFC; padding: 10px 15px; border: 1px solid green; margin: 15px 0 0 0;}
27
-
28
- .ihaf-donate a {display: block; text-indent: -9999px; background: url(images/donate.png) no-repeat; width: 150px; height: 50px;}
29
-
30
- .ihaf-wpb-recent {margin: 15px 0 0 0; border: 1px solid #CCC; padding: 10px 15px;}
31
-
32
- .ihaf-list {list-style-image: url(images/favicon.png); margin: 0 0 5px 20px;}
33
-
34
- .ihaf-wpb-recent .facebook {list-style-image: url(images/facebook.png); margin: 0 0 5px 20px;}
35
-
36
- .ihaf-wpb-recent .twitter {list-style-image: url(images/twitter.png); margin: 0 0 5px 20px;}
37
-
38
- .ihaf-wpb-recent .googleplus {list-style-image: url(images/googleplus.png); margin: 0 0 5px 20px;}
39
-
40
- .ihaf-wpb-recent .email {list-style-image: url(images/email.png); margin: 0 0 5px 20px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ihaf.php CHANGED
@@ -1,197 +1,160 @@
1
- <?php
2
- /*
3
- Plugin Name: Insert Headers and Footers
4
- Plugin URI: http://www.wpbeginner.com/
5
- Description: Allows you to insert code or text in the header or footer of your WordPress blog
6
- Version: 1.3
7
- Author: iamdpegg
8
- Author URI: http://www.wpbeginner.com/
9
- License: This software is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
- */
13
-
14
-
15
- if ( !class_exists( 'InsertHeadersAndFooters' ) ) {
16
-
17
- define('IHAFURL', plugins_url('', __FILE__));
18
- if (is_admin()) {
19
- wp_register_style('IHAFStyleSheet', IHAFURL . '/ihaf.css');
20
- wp_enqueue_style( 'IHAFStyleSheet');
21
- }
22
-
23
- class InsertHeadersAndFooters {
24
-
25
- function InsertHeadersAndFooters() {
26
-
27
- add_action( 'init', array( &$this, 'init' ) );
28
- add_action( 'admin_init', array( &$this, 'admin_init' ) );
29
- add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
30
- add_action( 'wp_head', array( &$this, 'wp_head' ) );
31
- add_action( 'wp_footer', array( &$this, 'wp_footer' ) );
32
-
33
- }
34
-
35
- function init() {
36
- load_plugin_textdomain( 'insert-headers-and-footers', false, dirname( plugin_basename ( __FILE__ ) ).'/lang' );
37
- }
38
-
39
- function admin_init() {
40
- register_setting( 'insert-headers-and-footers', 'ihaf_insert_header', 'trim' );
41
- register_setting( 'insert-headers-and-footers', 'ihaf_insert_footer', 'trim' );
42
- }
43
-
44
- function admin_menu() {
45
- add_submenu_page( 'options-general.php', 'Insert Headers and Footers', 'Insert Headers and Footers', 'manage_options', __FILE__, array( &$this, 'options_panel' ) );
46
- }
47
-
48
- function wp_head() {
49
- $meta = get_option( 'ihaf_insert_header', '' );
50
- if ( $meta != '' ) {
51
- echo $meta, "\n";
52
- }
53
- }
54
-
55
- function wp_footer() {
56
- if ( !is_admin() && !is_feed() && !is_robots() && !is_trackback() ) {
57
- $text = get_option( 'ihaf_insert_footer', '' );
58
- $text = convert_smilies( $text );
59
- $text = do_shortcode( $text );
60
-
61
- if ( $text != '' ) {
62
- echo $text, "\n";
63
- }
64
- }
65
- }
66
-
67
- function fetch_rss_items( $num, $feed ) {
68
- include_once( ABSPATH . WPINC . '/feed.php' );
69
- $rss = fetch_feed( $feed );
70
-
71
- // Bail if feed doesn't work
72
- if ( !$rss || is_wp_error( $rss ) )
73
- return false;
74
-
75
- $rss_items = $rss->get_items( 0, $rss->get_item_quantity( $num ) );
76
-
77
- // If the feed was erroneous
78
- if ( !$rss_items ) {
79
- $md5 = md5( $feed );
80
- delete_transient( 'feed_' . $md5 );
81
- delete_transient( 'feed_mod_' . $md5 );
82
- $rss = fetch_feed( $feed );
83
- $rss_items = $rss->get_items( 0, $rss->get_item_quantity( $num ) );
84
- }
85
-
86
- return $rss_items;
87
- }
88
-
89
-
90
- function options_panel() { ?>
91
- <div id="ihaf-wrap">
92
- <div class="wrap">
93
- <?php screen_icon(); ?>
94
- <h2>Insert Headers and Footers - Options</h2>
95
- <div class="ihaf-wrap">
96
- <form name="dofollow" action="options.php" method="post">
97
- <?php settings_fields( 'insert-headers-and-footers' ); ?>
98
- <label class="ihaf-labels" for="ihaf_insert_header">Scripts in header:</label>
99
- <textarea rows="5" cols="57" id="insert_header" name="ihaf_insert_header"><?php echo esc_html( get_option( 'ihaf_insert_header' ) ); ?></textarea><br />
100
- These scripts will be printed to the <code>&lt;head&gt;</code> section.
101
- <label class="ihaf-labels footerlabel" for="ihaf_insert_footer">Scripts in footer:</label>
102
- <textarea rows="5" cols="57" id="ihaf_insert_footer" name="ihaf_insert_footer"><?php echo esc_html( get_option( 'ihaf_insert_footer' ) ); ?></textarea><br />
103
- These scripts will be printed to the <code>&lt;footer&gt;</code> section.
104
-
105
- <p class="submit">
106
- <input type="submit" name="Submit" value="Save settings" />
107
- </p>
108
-
109
- </form>
110
- </div>
111
-
112
- <div class="ihaf-sidebar">
113
- <div class="ihaf-improve-site">
114
- <h2>Improve Your Site!</h2>
115
- <p>Want to take your site to the next level? Look behind the scenes of WPBeginner to see what you can do!</p>
116
- <p><a href="http://www.wpbeginner.com/blueprint/" target="_blank">WPBeginner's Blueprint &raquo;</a></p>
117
- </div>
118
- <div class="ihaf-support">
119
- <h2>Need Support?</h2>
120
- <p>If you are having problems with this plugin, please talk about them in the</p>
121
- <p><a href="http://www.wpbeginner.com/contact/" target="_blank">Support Forums</a></p>
122
- </div>
123
- <div class="ihaf-donate">
124
- <h2>Spread the Word!</h2>
125
- <p>Want to help make this plugin even better? All donations are used to improve this plugin, so donate $10, $20 or $50 now!</p>
126
- <p><a href="http://www.wpbeginner.com/wpbeginner-needs-your-help/" target="_blank">Donate!</a></p>
127
- </div>
128
- <div class="ihaf-wpb-recent">
129
- <h2>Latest News From WPBeginner</h2>
130
- <?php
131
- $rss_items = $this->fetch_rss_items( 3, 'http://wpbeginner.com/feed/' );
132
- $content = '<ul>';
133
- if ( !$rss_items ) {
134
- $content .= '<li class="ihaf-list">No news items, feed might be broken...</li>';
135
- } else {
136
- foreach ( $rss_items as $item ) {
137
- $url = preg_replace( '/#.*/', '', esc_url( $item->get_permalink(), null, 'display' ) );
138
- $content .= '<li class="ihaf-list">';
139
- $content .= '<a href="' . $url . '#utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=newsitem&utm_campaign=ihaf">' . esc_html( $item->get_title() ) . '</a> ';
140
- $content .= '</li>';
141
- }}
142
- $content .= '<li class="facebook"><a href="https://www.facebook.com/wpbeginner" target="_blank">Like WPBeginner on Facebook</a></li>';
143
- $content .= '<li class="twitter"><a href="http://twitter.com/wpbeginner"target="_blank">Follow WPBeginner on Twitter</a></li>';
144
- $content .= '<li class="googleplus"><a href="https://plus.google.com/101634180904808003404/posts" target="_blank">Circle WPBeginner on Google+</a></li>';
145
- $content .= '<li class="email"><a href="http://wpbeginner.us1.list-manage.com/subscribe?u=549b83cc29ff23c36e5796c38&id=4c340fd3aa" target="_blank">Subscribe by email</a></li>';
146
- $content .= '</ul>';
147
- echo $content;
148
- ?>
149
- </div>
150
- </div>
151
- </div>
152
- </div>
153
- <?php
154
- }
155
- }
156
-
157
-
158
- add_action('wp_dashboard_setup', 'ihaf_dashboard_widgets');
159
-
160
- function ihaf_dashboard_widgets() {
161
- global $wp_meta_boxes;
162
- wp_add_dashboard_widget('wpbeginnerihafwidget', 'Latest from WPBeginner', 'ihaf_widget');
163
- }
164
-
165
- function ihaf_widget() {
166
- require_once(ABSPATH.WPINC.'/rss.php');
167
- if ( $rss = fetch_rss( 'http://wpbeginner.com/feed/' ) ) { ?>
168
- <div class="rss-widget">
169
- <a href="http://www.wpbeginner.com/" title="WPBeginner - Beginner's guide to WordPress"><img src="http://cdn.wpbeginner.com/pluginimages/wpbeginner.gif" class="alignright" alt="WPBeginner"/></a>
170
- <ul>
171
- <?php
172
- $rss->items = array_slice( $rss->items, 0, 5 );
173
- foreach ( (array) $rss->items as $item ) {
174
- echo '<li>';
175
- echo '<a class="rsswidget" href="'.clean_url( $item['link'], $protocolls=null, 'display' ).'">'. ($item['title']) .'</a> ';
176
- echo '<span class="rss-date">'. date('F j, Y', strtotime($item['pubdate'])) .'</span>';
177
- echo '</li>';
178
- }
179
- ?>
180
- </ul>
181
- <div style="border-top: 1px solid #ddd; padding-top: 10px; text-align:center;">
182
- <a href="http://feeds2.feedburner.com/wpbeginner"><img src="http://cdn.wpbeginner.com/pluginimages/feed.png" alt="Subscribe to our Blog" style="margin: 0 5px 0 0; vertical-align: top; line-height: 18px;"/> Subscribe with RSS</a>
183
- &nbsp; &nbsp; &nbsp;
184
- <a href="http://wpbeginner.us1.list-manage.com/subscribe?u=549b83cc29ff23c36e5796c38&id=4c340fd3aa"><img src="http://cdn.wpbeginner.com/pluginimages/email.gif" alt="Subscribe via Email"/> Subscribe by email</a>
185
- &nbsp; &nbsp; &nbsp;
186
- <a href="http://facebook.com/wpbeginner/"><img src="http://cdn.wpbeginner.com/pluginimages/facebook.png" alt="Join us on Facebook" style="margin: 0 5px 0 0; vertical-align: middle; line-height: 18px;" />Join us on Facebook</a>
187
- </div>
188
- </div>
189
- <?php }
190
-
191
- }
192
-
193
- $wp_insert_headers_and_footers = new InsertHeadersAndFooters();
194
-
195
- }
196
-
197
-
1
+ <?php
2
+ /**
3
+ * Plugin Name: Insert Headers and Footers
4
+ * Plugin URI: http://www.wpbeginner.com/
5
+ * Version: 1.3.1
6
+ * Author: WPBeginner
7
+ * Author URI: http://www.wpbeginner.com/
8
+ * Description: Allows you to insert code or text in the header or footer of your WordPress blog
9
+ * License: GPL2
10
+ */
11
+
12
+ /* Copyright 2014 WPBeginner
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License, version 2, as
16
+ published by the Free Software Foundation.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program; if not, write to the Free Software
25
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
+ */
27
+
28
+ /**
29
+ * Insert Post Ads Class
30
+ *
31
+ * @package WPBeginner
32
+ * @subpackage Insert Post Ads
33
+ * @author Tim Carr
34
+ * @version 1.3.1
35
+ * @copyright WPBeginner
36
+ */
37
+ class InsertHeadersAndFooters {
38
+ /**
39
+ * Constructor
40
+ */
41
+ public function __construct() {
42
+ // Plugin Details
43
+ $this->plugin = new stdClass;
44
+ $this->plugin->name = 'insert-headers-and-footers'; // Plugin Folder
45
+ $this->plugin->displayName = 'Insert Headers and Footers'; // Plugin Name
46
+ $this->plugin->version = '1.3.1';
47
+ $this->plugin->folder = WP_PLUGIN_DIR.'/'.$this->plugin->name; // Full Path to Plugin Folder
48
+ $this->plugin->url = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
49
+
50
+ // Dashboard Submodule
51
+ if (!class_exists('WPBeginnerDashboardWidget')) {
52
+ require_once($this->plugin->folder.'/_modules/dashboard/dashboard.php');
53
+ }
54
+ $this->dashboard = new WPBeginnerDashboardWidget($this->plugin);
55
+
56
+ // Hooks
57
+ add_action('admin_init', array(&$this, 'registerSettings'));
58
+ add_action('admin_menu', array(&$this, 'adminPanelsAndMetaBoxes'));
59
+
60
+ // Frontend Hooks
61
+ add_action('wp_head', array(&$this, 'frontendHeader'));
62
+ add_action('wp_footer', array(&$this, 'frontendFooter'));
63
+ }
64
+
65
+ /**
66
+ * Register Settings
67
+ */
68
+ function registerSettings() {
69
+ register_setting($this->plugin->name, 'ihaf_insert_header', 'trim');
70
+ register_setting($this->plugin->name, 'ihaf_insert_footer', 'trim');
71
+ }
72
+
73
+ /**
74
+ * Register the plugin settings panel
75
+ */
76
+ function adminPanelsAndMetaBoxes() {
77
+ add_submenu_page('options-general.php', $this->plugin->displayName, $this->plugin->displayName, 'manage_options', $this->plugin->name, array(&$this, 'adminPanel'));
78
+ }
79
+
80
+ /**
81
+ * Output the Administration Panel
82
+ * Save POSTed data from the Administration Panel into a WordPress option
83
+ */
84
+ function adminPanel() {
85
+ // Save Settings
86
+ if (isset($_POST['submit'])) {
87
+ // Check nonce
88
+ if (!isset($_POST[$this->plugin->name.'_nonce'])) {
89
+ // Missing nonce
90
+ $this->errorMessage = __('nonce field is missing. Settings NOT saved.', $this->plugin->name);
91
+ } elseif (!wp_verify_nonce($_POST[$this->plugin->name.'_nonce'], $this->plugin->name)) {
92
+ // Invalid nonce
93
+ $this->errorMessage = __('Invalid nonce specified. Settings NOT saved.', $this->plugin->name);
94
+ } else {
95
+ // Save
96
+ update_option('ihaf_insert_header', $_POST['ihaf_insert_header']);
97
+ update_option('ihaf_insert_footer', $_POST['ihaf_insert_footer']);
98
+ $this->message = __('Settings Saved.', $this->plugin->name);
99
+ }
100
+ }
101
+
102
+ // Get latest settings
103
+ $this->settings = array(
104
+ 'ihaf_insert_header' => stripslashes(get_option('ihaf_insert_header')),
105
+ 'ihaf_insert_footer' => stripslashes(get_option('ihaf_insert_footer')),
106
+ );
107
+
108
+ // Load Settings Form
109
+ include_once(WP_PLUGIN_DIR.'/'.$this->plugin->name.'/views/settings.php');
110
+ }
111
+
112
+ /**
113
+ * Loads plugin textdomain
114
+ */
115
+ function loadLanguageFiles() {
116
+ load_plugin_textdomain($this->plugin->name, false, $this->plugin->name.'/languages/');
117
+ }
118
+
119
+ /**
120
+ * Outputs script / CSS to the frontend header
121
+ */
122
+ function frontendHeader() {
123
+ $this->output('ihaf_insert_header');
124
+ }
125
+
126
+ /**
127
+ * Outputs script / CSS to the frontend footer
128
+ */
129
+ function frontendFooter() {
130
+ $this->output('ihaf_insert_footer');
131
+ }
132
+
133
+ /**
134
+ * Outputs the given setting, if conditions are met
135
+ *
136
+ * @param string $setting Setting Name
137
+ * @return output
138
+ */
139
+ function output($setting) {
140
+ // Ignore admin, feed, robots or trackbacks
141
+ if (is_admin() OR is_feed() OR is_robots() OR is_trackback()) {
142
+ return;
143
+ }
144
+
145
+ // Get meta
146
+ $meta = get_option($setting);
147
+ if (empty($meta)) {
148
+ return;
149
+ }
150
+ if (trim($meta) == '') {
151
+ return;
152
+ }
153
+
154
+ // Output
155
+ echo stripslashes($meta);
156
+ }
157
+ }
158
+
159
+ $ihaf = new InsertHeadersAndFooters();
160
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
images/donate.png DELETED
Binary file
images/email.png DELETED
Binary file
images/facebook.png DELETED
Binary file
images/favicon.png DELETED
Binary file
images/googleplus.png DELETED
Binary file
images/twitter.png DELETED
Binary file
readme.txt CHANGED
@@ -1,17 +1,16 @@
1
- === Plugin Name ===
2
- Contributors: iamdpegg, smub
3
- Tags: header, footer, headers, footers, content, wpmu, meta, meta tags
4
- Requires at least: 2.7
5
- Tested up to: 3.4.1
6
- Stable tag: 1.3
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
-
11
- This plugin allows you to add extra scripts to the header and footer of your blog by hooking into wp_head and wp_footer.
12
-
13
- == Description ==
14
-
15
  Insert Headers and Footers is a simple plugin that lets you add scripts like Google Analytics to your WordPress site without having to get your hands dirty in code. Moreover, the simple interface gives you one place where you can add all of you scripts rather than dealing with dozens of plugins.
16
 
17
  If you enjoy using this plugin and want to learn more about how to use WordPress then I would suggest visiting [WPBeginner](http://www.wpbeginner.com "WPBeginner"). It's one of the largest free WordPress resource sites in the world and has tons of [WordPress tutorials](http://www.wpbeginner.com/category/wp-tutorials/ "WordPress tutorials") that will explain everything you need to know about setting up and using WordPress.
@@ -24,21 +23,23 @@ Note for Beginners: Like all plugins available for download, Insert Headers And
24
 
25
  If you like using this plugin, then please leave us a good rating. If you have support questions just ask them here in the support forum.
26
 
27
- Lastly, if you like this plugin then follow WPBeginner on [Twitter](http://twitter.com/wpbeginner "Twitter"), [Facebook](http://facebook.com/wpbeginner "Facebook"), and [Google+](https://plus.google.com/101634180904808003404/ "Google+")
28
-
29
-
30
-
31
- == Installation ==
32
-
33
- 1. Upload `insert-headers-and-footers` directory to the `/wp-content/plugins/` directory
34
- 1. Activate the plugin through the 'Plugins' menu in WordPress
35
- 1. Configure plugin (go to the Settings/Insert Headers and Footers)
36
- 1. Enjoy :)
37
-
38
-
39
-
40
  == Changelog ==
41
 
 
 
 
 
42
  = 1.3 =
43
  * fixed readme file
44
 
@@ -46,10 +47,10 @@ Lastly, if you like this plugin then follow WPBeginner on [Twitter](http://twitt
46
  * cleaned up code
47
 
48
  = 1.1 =
49
- * fixed unecessary CSS loading
50
-
51
- = 1.0 =
52
- * Initial version
53
-
54
 
55
 
1
+ === Insert Headers and Footers ===
2
+ Contributors: WPbeginner, iamdpegg, smub, n7studios
3
+ Tags: header, footer, headers, footers, content, wpmu, meta, meta tags
4
+ Requires at least: 3.6
5
+ Tested up to: 3.9
6
+ Stable tag: trunk
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ This plugin allows you to add extra scripts to the header and footer of your blog by hooking into wp_head and wp_footer.
11
+
12
+ == Description ==
13
+
 
14
  Insert Headers and Footers is a simple plugin that lets you add scripts like Google Analytics to your WordPress site without having to get your hands dirty in code. Moreover, the simple interface gives you one place where you can add all of you scripts rather than dealing with dozens of plugins.
15
 
16
  If you enjoy using this plugin and want to learn more about how to use WordPress then I would suggest visiting [WPBeginner](http://www.wpbeginner.com "WPBeginner"). It's one of the largest free WordPress resource sites in the world and has tons of [WordPress tutorials](http://www.wpbeginner.com/category/wp-tutorials/ "WordPress tutorials") that will explain everything you need to know about setting up and using WordPress.
23
 
24
  If you like using this plugin, then please leave us a good rating. If you have support questions just ask them here in the support forum.
25
 
26
+ Lastly, if you like this plugin then follow WPBeginner on:
27
+ [Twitter](http://twitter.com/wpbeginner "Twitter")
28
+ [Facebook](http://facebook.com/wpbeginner "Facebook")
29
+ [Google+](https://plus.google.com/101634180904808003404/ "Google+")
30
+
31
+ == Installation ==
32
+
33
+ 1. Upload `insert-headers-and-footers` directory to the `/wp-content/plugins/` directory
34
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
35
+ 3. Configure plugin (go to the Settings/Insert Headers and Footers)
36
+
 
 
37
  == Changelog ==
38
 
39
+ = 1.3.1 =
40
+ * Improved settings UI for WordPress 3.8+
41
+ * Bumped minimum version requirement
42
+
43
  = 1.3 =
44
  * fixed readme file
45
 
47
  * cleaned up code
48
 
49
  = 1.1 =
50
+ * fixed unecessary CSS loading
51
+
52
+ = 1.0 =
53
+ * Initial version
54
+
55
 
56
 
views/settings.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php echo $this->plugin->displayName; ?> &raquo; <?php _e('Settings', $this->plugin->name); ?></h2>
3
+
4
+ <?php
5
+ if (isset($this->message)) {
6
+ ?>
7
+ <div class="updated fade"><p><?php echo $this->message; ?></p></div>
8
+ <?php
9
+ }
10
+ if (isset($this->errorMessage)) {
11
+ ?>
12
+ <div class="error fade"><p><?php echo $this->errorMessage; ?></p></div>
13
+ <?php
14
+ }
15
+ ?>
16
+
17
+ <div id="poststuff">
18
+ <div id="post-body" class="metabox-holder columns-2">
19
+ <!-- Content -->
20
+ <div id="post-body-content">
21
+ <div id="normal-sortables" class="meta-box-sortables ui-sortable">
22
+ <div class="postbox">
23
+ <h3 class="hndle"><?php _e('Settings', $this->plugin->name); ?></h3>
24
+
25
+ <div class="inside">
26
+ <form action="options-general.php?page=<?php echo $this->plugin->name; ?>" method="post">
27
+ <p>
28
+ <label for="ihaf_insert_header"><strong><?php _e('Scripts in Header', $this->plugin->name); ?></strong></label>
29
+ <textarea name="ihaf_insert_header" id="ihaf_insert_header" class="widefat" rows="8" style="font-family:Courier New;"><?php echo $this->settings['ihaf_insert_header']; ?></textarea>
30
+ <?php _e('These scripts will be printed in the <code>&lt;head&gt;</code> section.', $this->plugin->name); ?>
31
+ </p>
32
+ <p>
33
+ <label for="ihaf_insert_footer"><strong><?php _e('Scripts in Footer', $this->plugin->name); ?></strong></label>
34
+ <textarea name="ihaf_insert_footer" id="ihaf_insert_footer" class="widefat" rows="8" style="font-family:Courier New;"><?php echo $this->settings['ihaf_insert_footer']; ?></textarea>
35
+ <?php _e('These scripts will be printed above the <code>&lt;/body&gt;</code> tag.', $this->plugin->name); ?>
36
+ </p>
37
+ <?php wp_nonce_field($this->plugin->name, $this->plugin->name.'_nonce'); ?>
38
+ <p>
39
+ <input name="submit" type="submit" name="Submit" class="button button-primary" value="<?php _e('Save', $this->plugin->name); ?>" />
40
+ </p>
41
+ </form>
42
+ </div>
43
+ </div>
44
+ <!-- /postbox -->
45
+
46
+ <?php
47
+ // RSS Feed
48
+ if (isset($this->dashboard)) {
49
+ ?>
50
+ <div id="wpbeginner" class="postbox">
51
+ <h3 class="hndle"><?php _e('Latest from WPBeginner', $this->plugin->name); ?></h3>
52
+
53
+ <div class="inside">
54
+ <?php
55
+ $this->dashboard->outputDashboardWidget();
56
+ ?>
57
+ </div>
58
+ </div>
59
+ <!-- /postbox -->
60
+ <?php
61
+ }
62
+ ?>
63
+ </div>
64
+ <!-- /normal-sortables -->
65
+ </div>
66
+ <!-- /post-body-content -->
67
+
68
+ <!-- Sidebar -->
69
+ <div id="postbox-container-1" class="postbox-container">
70
+ <?php require_once($this->plugin->folder.'/_modules/dashboard/views/sidebar-donate.php'); ?>
71
+ </div>
72
+ <!-- /postbox-container -->
73
+ </div>
74
+ </div>
75
+ </div>