Version Description
- New: Code editors now use CodeMirror for syntax highlighting.
Download this release
Release Info
Developer | peterwilsoncc |
Plugin | Insert Headers and Footers |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.6 to 1.5.0
- ihaf.php +120 -85
- languages/insert-headers-and-footers.pot +1 -1
- readme.txt +6 -3
- views/dashboard-notices.php +8 -7
- views/settings.php +55 -55
- views/sidebar.php +21 -21
ihaf.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Insert Headers and Footers
|
4 |
* Plugin URI: http://www.wpbeginner.com/
|
5 |
-
* Version: 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
|
@@ -13,18 +13,18 @@
|
|
13 |
|
14 |
/* Copyright 2019 WPBeginner
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
*/
|
29 |
|
30 |
/**
|
@@ -35,55 +35,57 @@ class InsertHeadersAndFooters {
|
|
35 |
* Constructor
|
36 |
*/
|
37 |
public function __construct() {
|
|
|
38 |
|
39 |
// Plugin Details
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
// Hooks
|
50 |
add_action( 'admin_init', array( &$this, 'registerSettings' ) );
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
54 |
|
55 |
-
|
56 |
-
|
57 |
add_action( 'wp_footer', array( &$this, 'frontendFooter' ) );
|
58 |
if ( $this->body_open_supported ) {
|
59 |
add_action( 'wp_body_open', array( &$this, 'frontendBody' ), 1 );
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
/**
|
89 |
* Register Settings
|
@@ -95,56 +97,89 @@ class InsertHeadersAndFooters {
|
|
95 |
}
|
96 |
|
97 |
/**
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
}
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
// only admin user can access this page
|
110 |
-
if ( !current_user_can( 'administrator' ) ) {
|
111 |
echo '<p>' . __( 'Sorry, you are not allowed to access this page.', 'insert-headers-and-footers' ) . '</p>';
|
112 |
return;
|
113 |
}
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
if ( !isset( $_REQUEST[$this->plugin->name.'_nonce'] ) ) {
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
// $_REQUEST has already been slashed by wp_magic_quotes in wp-settings
|
127 |
// so do nothing before saving
|
128 |
-
|
129 |
-
|
130 |
update_option( 'ihaf_insert_body', isset( $_REQUEST['ihaf_insert_body'] ) ? $_REQUEST['ihaf_insert_body'] : '' );
|
131 |
update_option( $this->plugin->db_welcome_dismissed_key, 1 );
|
132 |
$this->message = __( 'Settings Saved.', 'insert-headers-and-footers' );
|
133 |
}
|
134 |
-
|
135 |
|
136 |
-
|
137 |
-
|
138 |
'ihaf_insert_header' => esc_html( wp_unslash( get_option( 'ihaf_insert_header' ) ) ),
|
139 |
'ihaf_insert_footer' => esc_html( wp_unslash( get_option( 'ihaf_insert_footer' ) ) ),
|
140 |
-
'ihaf_insert_body'
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
* Loads plugin textdomain
|
149 |
*/
|
150 |
function loadLanguageFiles() {
|
@@ -190,17 +225,17 @@ class InsertHeadersAndFooters {
|
|
190 |
}
|
191 |
|
192 |
// provide the opportunity to Ignore IHAF - footer only via filters
|
193 |
-
if ( 'ihaf_insert_footer'
|
194 |
return;
|
195 |
}
|
196 |
|
197 |
// provide the opportunity to Ignore IHAF - header only via filters
|
198 |
-
if ( 'ihaf_insert_header'
|
199 |
return;
|
200 |
}
|
201 |
|
202 |
// provide the opportunity to Ignore IHAF - below opening body only via filters
|
203 |
-
if ( 'ihaf_insert_body'
|
204 |
return;
|
205 |
}
|
206 |
|
@@ -209,7 +244,7 @@ class InsertHeadersAndFooters {
|
|
209 |
if ( empty( $meta ) ) {
|
210 |
return;
|
211 |
}
|
212 |
-
if ( trim( $meta )
|
213 |
return;
|
214 |
}
|
215 |
|
@@ -218,4 +253,4 @@ class InsertHeadersAndFooters {
|
|
218 |
}
|
219 |
}
|
220 |
|
221 |
-
$ihaf = new InsertHeadersAndFooters();
|
2 |
/**
|
3 |
* Plugin Name: Insert Headers and Footers
|
4 |
* Plugin URI: http://www.wpbeginner.com/
|
5 |
+
* Version: 1.5.0
|
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
|
13 |
|
14 |
/* Copyright 2019 WPBeginner
|
15 |
|
16 |
+
This program is free software; you can redistribute it and/or modify
|
17 |
+
it under the terms of the GNU General Public License, version 2, as
|
18 |
+
published by the Free Software Foundation.
|
19 |
|
20 |
+
This program is distributed in the hope that it will be useful,
|
21 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
+
GNU General Public License for more details.
|
24 |
|
25 |
+
You should have received a copy of the GNU General Public License
|
26 |
+
along with this program; if not, write to the Free Software
|
27 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
*/
|
29 |
|
30 |
/**
|
35 |
* Constructor
|
36 |
*/
|
37 |
public function __construct() {
|
38 |
+
$file_data = get_file_data( __FILE__, array( 'Version' => 'Version' ) );
|
39 |
|
40 |
// Plugin Details
|
41 |
+
$this->plugin = new stdClass;
|
42 |
+
$this->plugin->name = 'insert-headers-and-footers'; // Plugin Folder
|
43 |
+
$this->plugin->displayName = 'Insert Headers and Footers'; // Plugin Name
|
44 |
+
$this->plugin->version = $file_data['Version'];
|
45 |
+
$this->plugin->folder = plugin_dir_path( __FILE__ );
|
46 |
+
$this->plugin->url = plugin_dir_url( __FILE__ );
|
47 |
+
$this->plugin->db_welcome_dismissed_key = $this->plugin->name . '_welcome_dismissed_key';
|
48 |
+
$this->body_open_supported = function_exists( 'wp_body_open' ) && version_compare( get_bloginfo( 'version' ), '5.2', '>=' );
|
49 |
|
50 |
// Hooks
|
51 |
add_action( 'admin_init', array( &$this, 'registerSettings' ) );
|
52 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'initCodeMirror' ) );
|
53 |
+
add_action( 'admin_menu', array( &$this, 'adminPanelsAndMetaBoxes' ) );
|
54 |
+
add_action( 'admin_notices', array( &$this, 'dashboardNotices' ) );
|
55 |
+
add_action( 'wp_ajax_' . $this->plugin->name . '_dismiss_dashboard_notices', array( &$this, 'dismissDashboardNotices' ) );
|
56 |
|
57 |
+
// Frontend Hooks
|
58 |
+
add_action( 'wp_head', array( &$this, 'frontendHeader' ) );
|
59 |
add_action( 'wp_footer', array( &$this, 'frontendFooter' ) );
|
60 |
if ( $this->body_open_supported ) {
|
61 |
add_action( 'wp_body_open', array( &$this, 'frontendBody' ), 1 );
|
62 |
}
|
63 |
}
|
64 |
|
65 |
+
/**
|
66 |
+
* Show relevant notices for the plugin
|
67 |
+
*/
|
68 |
+
function dashboardNotices() {
|
69 |
+
global $pagenow;
|
70 |
+
|
71 |
+
if ( ! get_option( $this->plugin->db_welcome_dismissed_key ) ) {
|
72 |
+
if ( ! ( 'options-general.php' === $pagenow && isset( $_GET['page'] ) && 'insert-headers-and-footers' === $_GET['page'] ) ) {
|
73 |
+
$setting_page = admin_url( 'options-general.php?page=' . $this->plugin->name );
|
74 |
+
// load the notices view
|
75 |
+
include_once( $this->plugin->folder . '/views/dashboard-notices.php' );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Dismiss the welcome notice for the plugin
|
82 |
+
*/
|
83 |
+
function dismissDashboardNotices() {
|
84 |
+
check_ajax_referer( $this->plugin->name . '-nonce', 'nonce' );
|
85 |
+
// user has dismissed the welcome notice
|
86 |
+
update_option( $this->plugin->db_welcome_dismissed_key, 1 );
|
87 |
+
exit;
|
88 |
+
}
|
89 |
|
90 |
/**
|
91 |
* Register Settings
|
97 |
}
|
98 |
|
99 |
/**
|
100 |
+
* Register the plugin settings panel
|
101 |
+
*/
|
102 |
+
function adminPanelsAndMetaBoxes() {
|
103 |
+
add_submenu_page( 'options-general.php', $this->plugin->displayName, $this->plugin->displayName, 'manage_options', $this->plugin->name, array( &$this, 'adminPanel' ) );
|
104 |
}
|
105 |
|
106 |
+
/**
|
107 |
+
* Output the Administration Panel
|
108 |
+
* Save POSTed data from the Administration Panel into a WordPress option
|
109 |
+
*/
|
110 |
+
function adminPanel() {
|
111 |
// only admin user can access this page
|
112 |
+
if ( ! current_user_can( 'administrator' ) ) {
|
113 |
echo '<p>' . __( 'Sorry, you are not allowed to access this page.', 'insert-headers-and-footers' ) . '</p>';
|
114 |
return;
|
115 |
}
|
116 |
|
117 |
+
// Save Settings
|
118 |
+
if ( isset( $_REQUEST['submit'] ) ) {
|
119 |
+
// Check nonce
|
120 |
+
if ( ! isset( $_REQUEST[ $this->plugin->name . '_nonce' ] ) ) {
|
121 |
+
// Missing nonce
|
122 |
+
$this->errorMessage = __( 'nonce field is missing. Settings NOT saved.', 'insert-headers-and-footers' );
|
123 |
+
} elseif ( ! wp_verify_nonce( $_REQUEST[ $this->plugin->name . '_nonce' ], $this->plugin->name ) ) {
|
124 |
+
// Invalid nonce
|
125 |
+
$this->errorMessage = __( 'Invalid nonce specified. Settings NOT saved.', 'insert-headers-and-footers' );
|
126 |
+
} else {
|
127 |
+
// Save
|
128 |
// $_REQUEST has already been slashed by wp_magic_quotes in wp-settings
|
129 |
// so do nothing before saving
|
130 |
+
update_option( 'ihaf_insert_header', $_REQUEST['ihaf_insert_header'] );
|
131 |
+
update_option( 'ihaf_insert_footer', $_REQUEST['ihaf_insert_footer'] );
|
132 |
update_option( 'ihaf_insert_body', isset( $_REQUEST['ihaf_insert_body'] ) ? $_REQUEST['ihaf_insert_body'] : '' );
|
133 |
update_option( $this->plugin->db_welcome_dismissed_key, 1 );
|
134 |
$this->message = __( 'Settings Saved.', 'insert-headers-and-footers' );
|
135 |
}
|
136 |
+
}
|
137 |
|
138 |
+
// Get latest settings
|
139 |
+
$this->settings = array(
|
140 |
'ihaf_insert_header' => esc_html( wp_unslash( get_option( 'ihaf_insert_header' ) ) ),
|
141 |
'ihaf_insert_footer' => esc_html( wp_unslash( get_option( 'ihaf_insert_footer' ) ) ),
|
142 |
+
'ihaf_insert_body' => esc_html( wp_unslash( get_option( 'ihaf_insert_body' ) ) ),
|
143 |
+
);
|
144 |
+
|
145 |
+
// Load Settings Form
|
146 |
+
include_once( $this->plugin->folder . '/views/settings.php' );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Enqueue and initialize CodeMirror for the form fields.
|
151 |
+
*/
|
152 |
+
function initCodeMirror() {
|
153 |
+
// Make sure that we don't fatal error on WP versions before 4.9.
|
154 |
+
if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
|
155 |
+
return;
|
156 |
+
}
|
157 |
+
|
158 |
+
global $pagenow;
|
159 |
|
160 |
+
if ( ! ( 'options-general.php' === $pagenow && isset( $_GET['page'] ) && 'insert-headers-and-footers' === $_GET['page'] ) ) {
|
161 |
+
return;
|
162 |
+
}
|
163 |
|
164 |
+
// Enqueue code editor and settings for manipulating HTML.
|
165 |
+
$settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
|
166 |
+
|
167 |
+
// Bail if user disabled CodeMirror.
|
168 |
+
if ( false === $settings ) {
|
169 |
+
return;
|
170 |
+
}
|
171 |
+
|
172 |
+
// Custom styles for the form fields.
|
173 |
+
$styles = '.CodeMirror{ border: 1px solid #ccd0d4; }';
|
174 |
+
|
175 |
+
wp_add_inline_style( 'code-editor', $styles );
|
176 |
+
|
177 |
+
wp_add_inline_script( 'code-editor', sprintf( 'jQuery( function() { wp.codeEditor.initialize( "ihaf_insert_header", %s ); } );', wp_json_encode( $settings ) ) );
|
178 |
+
wp_add_inline_script( 'code-editor', sprintf( 'jQuery( function() { wp.codeEditor.initialize( "ihaf_insert_body", %s ); } );', wp_json_encode( $settings ) ) );
|
179 |
+
wp_add_inline_script( 'code-editor', sprintf( 'jQuery( function() { wp.codeEditor.initialize( "ihaf_insert_footer", %s ); } );', wp_json_encode( $settings ) ) );
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
* Loads plugin textdomain
|
184 |
*/
|
185 |
function loadLanguageFiles() {
|
225 |
}
|
226 |
|
227 |
// provide the opportunity to Ignore IHAF - footer only via filters
|
228 |
+
if ( 'ihaf_insert_footer' === $setting && apply_filters( 'disable_ihaf_footer', false ) ) {
|
229 |
return;
|
230 |
}
|
231 |
|
232 |
// provide the opportunity to Ignore IHAF - header only via filters
|
233 |
+
if ( 'ihaf_insert_header' === $setting && apply_filters( 'disable_ihaf_header', false ) ) {
|
234 |
return;
|
235 |
}
|
236 |
|
237 |
// provide the opportunity to Ignore IHAF - below opening body only via filters
|
238 |
+
if ( 'ihaf_insert_body' === $setting && apply_filters( 'disable_ihaf_body', false ) ) {
|
239 |
return;
|
240 |
}
|
241 |
|
244 |
if ( empty( $meta ) ) {
|
245 |
return;
|
246 |
}
|
247 |
+
if ( trim( $meta ) === '' ) {
|
248 |
return;
|
249 |
}
|
250 |
|
253 |
}
|
254 |
}
|
255 |
|
256 |
+
$ihaf = new InsertHeadersAndFooters();
|
languages/insert-headers-and-footers.pot
CHANGED
@@ -163,4 +163,4 @@ msgstr ""
|
|
163 |
|
164 |
#: views/sidebar.php:96
|
165 |
msgid "Get the best WordPress Coming Soon Page plugin"
|
166 |
-
msgstr ""
|
163 |
|
164 |
#: views/sidebar.php:96
|
165 |
msgid "Get the best WordPress Coming Soon Page plugin"
|
166 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: WPbeginner, smub, deb255
|
3 |
Tags: code, content, css, facebook pixel, footer, footer code, footer scripts, footers, google analytics, head, header, header code, header scripts, headers, insert, insert code, insert scripts, js, meta, meta tags, scripts, wpmu
|
4 |
Requires at least: 3.6
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 5.2
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -86,6 +86,9 @@ Syed Balkhi
|
|
86 |
|
87 |
== Changelog ==
|
88 |
|
|
|
|
|
|
|
89 |
= 1.4.6 =
|
90 |
* Tested compatibility with WordPress 5.4.2
|
91 |
|
@@ -131,7 +134,7 @@ Syed Balkhi
|
|
131 |
* cleaned up code
|
132 |
|
133 |
= 1.1 =
|
134 |
-
* fixed
|
135 |
|
136 |
= 1.0 =
|
137 |
* Initial version
|
2 |
Contributors: WPbeginner, smub, deb255
|
3 |
Tags: code, content, css, facebook pixel, footer, footer code, footer scripts, footers, google analytics, head, header, header code, header scripts, headers, insert, insert code, insert scripts, js, meta, meta tags, scripts, wpmu
|
4 |
Requires at least: 3.6
|
5 |
+
Tested up to: 5.6
|
6 |
Requires PHP: 5.2
|
7 |
+
Stable tag: 1.5.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
86 |
|
87 |
== Changelog ==
|
88 |
|
89 |
+
= 1.5.0 =
|
90 |
+
* New: Code editors now use CodeMirror for syntax highlighting.
|
91 |
+
|
92 |
= 1.4.6 =
|
93 |
* Tested compatibility with WordPress 5.4.2
|
94 |
|
134 |
* cleaned up code
|
135 |
|
136 |
= 1.1 =
|
137 |
+
* fixed unnecessary CSS loading
|
138 |
|
139 |
= 1.0 =
|
140 |
* Initial version
|
views/dashboard-notices.php
CHANGED
@@ -5,12 +5,13 @@
|
|
5 |
?>
|
6 |
<div class="notice notice-success is-dismissible <?php echo $this->plugin->name; ?>-notice-welcome">
|
7 |
<p>
|
8 |
-
<?php
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
14 |
<a href="<?php echo $setting_page; ?>"><?php esc_html_e( 'Click here', 'insert-headers-and-footers' ); ?></a> <?php esc_html_e( 'to configure the plugin.', 'insert-headers-and-footers' ); ?>
|
15 |
</p>
|
16 |
</div>
|
@@ -25,4 +26,4 @@
|
|
25 |
$('.<?php echo $this->plugin->name; ?>-notice-welcome').remove();
|
26 |
});
|
27 |
});
|
28 |
-
</script>
|
5 |
?>
|
6 |
<div class="notice notice-success is-dismissible <?php echo $this->plugin->name; ?>-notice-welcome">
|
7 |
<p>
|
8 |
+
<?php
|
9 |
+
printf(
|
10 |
+
/* translators: %s: Name of this plugin */
|
11 |
+
__( 'Thank you for installing %1$s!', 'insert-headers-and-footers' ),
|
12 |
+
$this->plugin->displayName
|
13 |
+
);
|
14 |
+
?>
|
15 |
<a href="<?php echo $setting_page; ?>"><?php esc_html_e( 'Click here', 'insert-headers-and-footers' ); ?></a> <?php esc_html_e( 'to configure the plugin.', 'insert-headers-and-footers' ); ?>
|
16 |
</p>
|
17 |
</div>
|
26 |
$('.<?php echo $this->plugin->name; ?>-notice-welcome').remove();
|
27 |
});
|
28 |
});
|
29 |
+
</script>
|
views/settings.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
<div class="wrap">
|
2 |
-
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
<div id="normal-sortables" class="meta-box-sortables ui-sortable">
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
<?php
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
?>
|
37 |
-
|
38 |
<?php if ( $this->body_open_supported ) : ?>
|
39 |
<p>
|
40 |
<label for="ihaf_insert_body"><strong><?php esc_html_e( 'Scripts in Body', 'insert-headers-and-footers' ); ?></strong></label>
|
41 |
<textarea name="ihaf_insert_body" id="ihaf_insert_body" class="widefat" rows="8" style="font-family:Courier New;"><?php echo $this->settings['ihaf_insert_body']; ?></textarea>
|
42 |
<?php
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
?>
|
49 |
</p>
|
50 |
<?php endif; ?>
|
@@ -52,31 +52,31 @@
|
|
52 |
<label for="ihaf_insert_footer"><strong><?php esc_html_e( 'Scripts in Footer', 'insert-headers-and-footers' ); ?></strong></label>
|
53 |
<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>
|
54 |
<?php
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
?>
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
<input name="submit" type="submit" name="Submit" class="button button-primary" value="<?php esc_attr_e( 'Save', 'insert-headers-and-footers' ); ?>" />
|
65 |
</p>
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
</div>
|
71 |
<!-- /normal-sortables -->
|
72 |
-
|
73 |
-
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
</div>
|
82 |
</div>
|
1 |
<div class="wrap">
|
2 |
+
<h2><?php echo $this->plugin->displayName; ?> » <?php esc_html_e( 'Settings', 'insert-headers-and-footers' ); ?></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 esc_html_e( 'Settings', 'insert-headers-and-footers' ); ?></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 esc_html_e( 'Scripts in Header', 'insert-headers-and-footers' ); ?></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
|
31 |
+
printf(
|
32 |
+
/* translators: %s: The `<head>` tag */
|
33 |
+
esc_html__( 'These scripts will be printed in the %s section.', 'insert-headers-and-footers' ),
|
34 |
+
'<code><head></code>'
|
35 |
+
);
|
36 |
?>
|
37 |
+
</p>
|
38 |
<?php if ( $this->body_open_supported ) : ?>
|
39 |
<p>
|
40 |
<label for="ihaf_insert_body"><strong><?php esc_html_e( 'Scripts in Body', 'insert-headers-and-footers' ); ?></strong></label>
|
41 |
<textarea name="ihaf_insert_body" id="ihaf_insert_body" class="widefat" rows="8" style="font-family:Courier New;"><?php echo $this->settings['ihaf_insert_body']; ?></textarea>
|
42 |
<?php
|
43 |
+
printf(
|
44 |
+
/* translators: %s: The `<head>` tag */
|
45 |
+
esc_html__( 'These scripts will be printed just below the opening %s tag.', 'insert-headers-and-footers' ),
|
46 |
+
'<code><body></code>'
|
47 |
+
);
|
48 |
?>
|
49 |
</p>
|
50 |
<?php endif; ?>
|
52 |
<label for="ihaf_insert_footer"><strong><?php esc_html_e( 'Scripts in Footer', 'insert-headers-and-footers' ); ?></strong></label>
|
53 |
<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>
|
54 |
<?php
|
55 |
+
printf(
|
56 |
+
/* translators: %s: The `</body>` tag */
|
57 |
+
esc_html__( 'These scripts will be printed above the closing %s tag.', 'insert-headers-and-footers' ),
|
58 |
+
'<code></body></code>'
|
59 |
+
);
|
60 |
?>
|
61 |
+
</p>
|
62 |
+
<?php wp_nonce_field( $this->plugin->name, $this->plugin->name . '_nonce' ); ?>
|
63 |
+
<p>
|
64 |
<input name="submit" type="submit" name="Submit" class="button button-primary" value="<?php esc_attr_e( 'Save', 'insert-headers-and-footers' ); ?>" />
|
65 |
</p>
|
66 |
+
</form>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<!-- /postbox -->
|
70 |
</div>
|
71 |
<!-- /normal-sortables -->
|
72 |
+
</div>
|
73 |
+
<!-- /post-body-content -->
|
74 |
|
75 |
+
<!-- Sidebar -->
|
76 |
+
<div id="postbox-container-1" class="postbox-container">
|
77 |
+
<?php require_once( $this->plugin->folder . '/views/sidebar.php' ); ?>
|
78 |
+
</div>
|
79 |
+
<!-- /postbox-container -->
|
80 |
+
</div>
|
81 |
</div>
|
82 |
</div>
|
views/sidebar.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<!-- Improve Your Site -->
|
7 |
<div class="postbox">
|
8 |
<h3 class="hndle">
|
9 |
-
<span><?php esc_html_e('Improve Your Site', 'insert-headers-and-footers'); ?></span>
|
10 |
</h3>
|
11 |
|
12 |
<div class="inside">
|
@@ -14,33 +14,33 @@
|
|
14 |
<?php
|
15 |
printf(
|
16 |
/* translators: %s: Link to WPBeginner blog */
|
17 |
-
esc_html__('Want to take your site to the next level? Check out our daily free WordPress tutorials on %s.', 'insert-headers-and-footers'),
|
18 |
sprintf(
|
19 |
'<a href="http://www.wpbeginner.com/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">%s</a>',
|
20 |
-
esc_html__('WPBeginner blog', 'insert-headers-and-footers')
|
21 |
)
|
22 |
);
|
23 |
?>
|
24 |
</p>
|
25 |
|
26 |
<p>
|
27 |
-
<?php esc_html_e('Some of our popular guides:', 'insert-headers-and-footers'); ?>
|
28 |
</p>
|
29 |
|
30 |
<ul>
|
31 |
<li>
|
32 |
<a href="http://www.wpbeginner.com/wordpress-performance-speed/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">
|
33 |
-
<?php esc_html_e('Speed Up WordPress', 'insert-headers-and-footers'); ?>
|
34 |
</a>
|
35 |
</li>
|
36 |
<li>
|
37 |
<a href="http://www.wpbeginner.com/wordpress-security/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">
|
38 |
-
<?php esc_html_e('Improve WordPress Security', 'insert-headers-and-footers'); ?>
|
39 |
</a>
|
40 |
</li>
|
41 |
<li>
|
42 |
<a href="http://www.wpbeginner.com/wordpress-seo/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">
|
43 |
-
<?php esc_html_e('Boost Your WordPress SEO', 'insert-headers-and-footers'); ?>
|
44 |
</a>
|
45 |
</li>
|
46 |
</ul>
|
@@ -51,19 +51,19 @@
|
|
51 |
<!-- Donate -->
|
52 |
<div class="postbox">
|
53 |
<h3 class="hndle">
|
54 |
-
<span><?php esc_html_e('Our WordPress Plugins', 'insert-headers-and-footers'); ?></span>
|
55 |
</h3>
|
56 |
<div class="inside">
|
57 |
<p>
|
58 |
-
<?php esc_html_e('Like this plugin? Check out our other WordPress plugins:', 'insert-headers-and-footers'); ?>
|
59 |
</p>
|
60 |
<p>
|
61 |
<?php
|
62 |
printf(
|
63 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
64 |
-
esc_url('https://wordpress.org/plugins/wpforms-lite/'),
|
65 |
-
esc_html__('WPForms', 'insert-headers-and-footers'),
|
66 |
-
esc_html__('Drag & Drop WordPress Form Builder', 'insert-headers-and-footers')
|
67 |
);
|
68 |
?>
|
69 |
</p>
|
@@ -71,9 +71,9 @@
|
|
71 |
<?php
|
72 |
printf(
|
73 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
74 |
-
esc_url('https://wordpress.org/plugins/google-analytics-for-wordpress/'),
|
75 |
-
esc_html__('MonsterInsights', 'insert-headers-and-footers'),
|
76 |
-
esc_html__('Google Analytics Made Easy for WordPress', 'insert-headers-and-footers')
|
77 |
);
|
78 |
?>
|
79 |
</p>
|
@@ -81,9 +81,9 @@
|
|
81 |
<?php
|
82 |
printf(
|
83 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
84 |
-
esc_url('http://optinmonster.com/'),
|
85 |
-
esc_html__('OptinMonster', 'insert-headers-and-footers'),
|
86 |
-
esc_html__('Best WordPress Lead Generation Plugin', 'insert-headers-and-footers')
|
87 |
);
|
88 |
?>
|
89 |
</p>
|
@@ -91,9 +91,9 @@
|
|
91 |
<?php
|
92 |
printf(
|
93 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
94 |
-
esc_url('https://www.seedprod.com/'),
|
95 |
-
esc_html__('SeedProd', 'insert-headers-and-footers'),
|
96 |
-
esc_html__('Get the best WordPress Coming Soon Page plugin', 'insert-headers-and-footers')
|
97 |
);
|
98 |
?>
|
99 |
</p>
|
6 |
<!-- Improve Your Site -->
|
7 |
<div class="postbox">
|
8 |
<h3 class="hndle">
|
9 |
+
<span><?php esc_html_e( 'Improve Your Site', 'insert-headers-and-footers' ); ?></span>
|
10 |
</h3>
|
11 |
|
12 |
<div class="inside">
|
14 |
<?php
|
15 |
printf(
|
16 |
/* translators: %s: Link to WPBeginner blog */
|
17 |
+
esc_html__( 'Want to take your site to the next level? Check out our daily free WordPress tutorials on %s.', 'insert-headers-and-footers' ),
|
18 |
sprintf(
|
19 |
'<a href="http://www.wpbeginner.com/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">%s</a>',
|
20 |
+
esc_html__( 'WPBeginner blog', 'insert-headers-and-footers' )
|
21 |
)
|
22 |
);
|
23 |
?>
|
24 |
</p>
|
25 |
|
26 |
<p>
|
27 |
+
<?php esc_html_e( 'Some of our popular guides:', 'insert-headers-and-footers' ); ?>
|
28 |
</p>
|
29 |
|
30 |
<ul>
|
31 |
<li>
|
32 |
<a href="http://www.wpbeginner.com/wordpress-performance-speed/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">
|
33 |
+
<?php esc_html_e( 'Speed Up WordPress', 'insert-headers-and-footers' ); ?>
|
34 |
</a>
|
35 |
</li>
|
36 |
<li>
|
37 |
<a href="http://www.wpbeginner.com/wordpress-security/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">
|
38 |
+
<?php esc_html_e( 'Improve WordPress Security', 'insert-headers-and-footers' ); ?>
|
39 |
</a>
|
40 |
</li>
|
41 |
<li>
|
42 |
<a href="http://www.wpbeginner.com/wordpress-seo/?utm_source=wpadmin&utm_campaign=freeplugins" target="_blank">
|
43 |
+
<?php esc_html_e( 'Boost Your WordPress SEO', 'insert-headers-and-footers' ); ?>
|
44 |
</a>
|
45 |
</li>
|
46 |
</ul>
|
51 |
<!-- Donate -->
|
52 |
<div class="postbox">
|
53 |
<h3 class="hndle">
|
54 |
+
<span><?php esc_html_e( 'Our WordPress Plugins', 'insert-headers-and-footers' ); ?></span>
|
55 |
</h3>
|
56 |
<div class="inside">
|
57 |
<p>
|
58 |
+
<?php esc_html_e( 'Like this plugin? Check out our other WordPress plugins:', 'insert-headers-and-footers' ); ?>
|
59 |
</p>
|
60 |
<p>
|
61 |
<?php
|
62 |
printf(
|
63 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
64 |
+
esc_url( 'https://wordpress.org/plugins/wpforms-lite/' ),
|
65 |
+
esc_html__( 'WPForms', 'insert-headers-and-footers' ),
|
66 |
+
esc_html__( 'Drag & Drop WordPress Form Builder', 'insert-headers-and-footers' )
|
67 |
);
|
68 |
?>
|
69 |
</p>
|
71 |
<?php
|
72 |
printf(
|
73 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
74 |
+
esc_url( 'https://wordpress.org/plugins/google-analytics-for-wordpress/' ),
|
75 |
+
esc_html__( 'MonsterInsights', 'insert-headers-and-footers' ),
|
76 |
+
esc_html__( 'Google Analytics Made Easy for WordPress', 'insert-headers-and-footers' )
|
77 |
);
|
78 |
?>
|
79 |
</p>
|
81 |
<?php
|
82 |
printf(
|
83 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
84 |
+
esc_url( 'http://optinmonster.com/' ),
|
85 |
+
esc_html__( 'OptinMonster', 'insert-headers-and-footers' ),
|
86 |
+
esc_html__( 'Best WordPress Lead Generation Plugin', 'insert-headers-and-footers' )
|
87 |
);
|
88 |
?>
|
89 |
</p>
|
91 |
<?php
|
92 |
printf(
|
93 |
'<a href="%1$s" target="_blank">%2$s</a> - %3$s',
|
94 |
+
esc_url( 'https://www.seedprod.com/' ),
|
95 |
+
esc_html__( 'SeedProd', 'insert-headers-and-footers' ),
|
96 |
+
esc_html__( 'Get the best WordPress Coming Soon Page plugin', 'insert-headers-and-footers' )
|
97 |
);
|
98 |
?>
|
99 |
</p>
|