Version Description
- Debug notices fix
Download this release
Release Info
Developer | satollo |
Plugin | Head, Footer and Post Injections |
Version | 3.0.4 |
Comparing to | |
See all releases |
Code changes from version 3.0.2 to 3.0.4
- options.php +2 -2
- plugin.php +12 -81
- readme.txt +12 -1
options.php
CHANGED
@@ -31,7 +31,7 @@ function hefo_field_checkbox($name, $label = '', $tips = '', $attrs = '') {
|
|
31 |
function hefo_base_checkbox($name, $label = '') {
|
32 |
global $options;
|
33 |
echo '<label>';
|
34 |
-
echo '<input type="checkbox"
|
35 |
(isset($options[$name]) ? 'checked' : '') . '>';
|
36 |
echo $label;
|
37 |
echo '</label>';
|
@@ -117,7 +117,7 @@ function hefo_field_textarea_cm($name, $label = '', $tips = '', $attrs = '') {
|
|
117 |
echo '</td>';
|
118 |
}
|
119 |
|
120 |
-
function hefo_base_textarea_cm($name, $type = '') {
|
121 |
global $options;
|
122 |
|
123 |
if (!empty($type))
|
31 |
function hefo_base_checkbox($name, $label = '') {
|
32 |
global $options;
|
33 |
echo '<label>';
|
34 |
+
echo '<input type="checkbox" name="options[' . $name . ']" value="1" ' .
|
35 |
(isset($options[$name]) ? 'checked' : '') . '>';
|
36 |
echo $label;
|
37 |
echo '</label>';
|
117 |
echo '</td>';
|
118 |
}
|
119 |
|
120 |
+
function hefo_base_textarea_cm($name, $type = '', $tips = '') {
|
121 |
global $options;
|
122 |
|
123 |
if (!empty($type))
|
plugin.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Head, Footer and Post Injections
|
5 |
Plugin URI: http://www.satollo.net/plugins/header-footer
|
6 |
Description: Header and Footer lets to add html/javascript code to the head and footer and posts of your blog. Some examples are provided on the <a href="http://www.satollo.net/plugins/header-footer">official page</a>.
|
7 |
-
Version: 3.0.
|
8 |
Author: Stefano Lissa
|
9 |
Author URI: http://www.satollo.net
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
@@ -101,23 +101,6 @@ function hefo_callback($buffer) {
|
|
101 |
return substr($buffer, 0, $x) . "\n" . $hefo_body_block . substr($buffer, $x);
|
102 |
}
|
103 |
|
104 |
-
/*
|
105 |
-
add_filter('script_loader_tag', 'hefo_script_loader_tag', 90, 3);
|
106 |
-
|
107 |
-
function hefo_script_loader_tag($tag, $handle, $src) {
|
108 |
-
global $hefo_options;
|
109 |
-
if (isset($hefo_options['script_handle_debug'])) {
|
110 |
-
echo "<!-- script handle: $handle -->\n";
|
111 |
-
}
|
112 |
-
if (isset($hefo_options['script_async_handles']) && is_array($hefo_options['script_async_handles'])) {
|
113 |
-
if (array_search($handle, $hefo_options['script_async_handles']) !== false) {
|
114 |
-
$tag = str_replace('<script', '<script async', $tag);
|
115 |
-
}
|
116 |
-
}
|
117 |
-
return $tag;
|
118 |
-
}
|
119 |
-
*/
|
120 |
-
|
121 |
add_action('wp_head', 'hefo_wp_head_pre', 1);
|
122 |
|
123 |
function hefo_wp_head_pre() {
|
@@ -158,66 +141,6 @@ function hefo_wp_head_pre() {
|
|
158 |
if (is_search() && isset($hefo_options['seo_search_noindex'])) {
|
159 |
echo '<meta name="robots" content="noindex">';
|
160 |
}
|
161 |
-
|
162 |
-
/*
|
163 |
-
if (isset($hefo_options['og_enabled'])) {
|
164 |
-
if (is_home()) {
|
165 |
-
if (empty($hefo_options['og_type_home']))
|
166 |
-
$hefo_options['og_type_home'] = $hefo_options['og_type'];
|
167 |
-
if (!empty($hefo_options['og_type_home']))
|
168 |
-
echo '<meta property="og:type" content="' . $hefo_options['og_type_home'] . '" />';
|
169 |
-
}
|
170 |
-
else {
|
171 |
-
if (!empty($hefo_options['og_type']))
|
172 |
-
echo '<meta property="og:type" content="' . $hefo_options['og_type'] . '" />';
|
173 |
-
}
|
174 |
-
|
175 |
-
if (!empty($hefo_options['fb_app_id'])) {
|
176 |
-
echo '<meta property="fb:app_id" content="' . $hefo_options['fb_app_id'] . '" />';
|
177 |
-
}
|
178 |
-
|
179 |
-
if (!empty($hefo_options['fb_admins'])) {
|
180 |
-
echo '<meta property="fb:admins" content="' . $hefo_options['fb_admins'] . '" />';
|
181 |
-
}
|
182 |
-
|
183 |
-
// Add it as higer as possible, Facebook reads only the first part of a page
|
184 |
-
|
185 |
-
if (isset($hefo_options['og_image'])) {
|
186 |
-
if (is_single() || is_page()) {
|
187 |
-
$xid = $wp_query->get_queried_object_id();
|
188 |
-
if (function_exists('bbp_get_topic_forum_id')) {
|
189 |
-
$object = $wp_query->get_queried_object();
|
190 |
-
if ($object != null && $object->post_type == 'topic') {
|
191 |
-
$xid = bbp_get_topic_forum_id($xid);
|
192 |
-
}
|
193 |
-
}
|
194 |
-
$xtid = function_exists('get_post_thumbnail_id') ? get_post_thumbnail_id($xid) : false;
|
195 |
-
if ($xtid) {
|
196 |
-
$ximage = wp_get_attachment_url($xtid);
|
197 |
-
echo '<meta property="og:image" content="' . $ximage . '" />';
|
198 |
-
} else {
|
199 |
-
$xattachments = get_children(array('post_parent' => $xid, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order'));
|
200 |
-
if (!empty($xattachments)) {
|
201 |
-
foreach ($xattachments as $id => $attachment) {
|
202 |
-
$ximage = wp_get_attachment_url($id);
|
203 |
-
echo '<meta property="og:image" content="' . $ximage . '" />';
|
204 |
-
break;
|
205 |
-
}
|
206 |
-
} else {
|
207 |
-
if (!empty($hefo_options['og_image_default'])) {
|
208 |
-
echo '<meta property="og:image" content="' . $hefo_options['og_image_default'] . '" />';
|
209 |
-
}
|
210 |
-
}
|
211 |
-
}
|
212 |
-
} else {
|
213 |
-
if (!empty($hefo_options['og_image_default'])) {
|
214 |
-
echo '<meta property="og:image" content="' . $hefo_options['og_image_default'] . '" />';
|
215 |
-
}
|
216 |
-
}
|
217 |
-
}
|
218 |
-
|
219 |
-
}
|
220 |
-
*/
|
221 |
}
|
222 |
|
223 |
add_action('wp_head', 'hefo_wp_head_post', 11);
|
@@ -444,12 +367,15 @@ function hefo_the_content($content) {
|
|
444 |
}
|
445 |
|
446 |
function hefo_insert_before(&$content, $what, $marker, $starting_from = 0) {
|
|
|
|
|
|
|
|
|
447 |
if (empty($marker)) {
|
448 |
$marker = ' ';
|
449 |
}
|
450 |
$x = strpos($content, $marker, $starting_from);
|
451 |
if ($x !== false) {
|
452 |
-
//$ad = '<div style="clear: both; margin: 10px 0">' . $ad . '</div><div style="clear: both"></div>';
|
453 |
$content = substr_replace($content, $what, $x, 0);
|
454 |
return true;
|
455 |
}
|
@@ -457,9 +383,14 @@ function hefo_insert_before(&$content, $what, $marker, $starting_from = 0) {
|
|
457 |
}
|
458 |
|
459 |
function hefo_insert_after(&$content, $what, $marker, $starting_from = 0) {
|
|
|
|
|
|
|
|
|
460 |
if (empty($marker)) {
|
461 |
$marker = ' ';
|
462 |
}
|
|
|
463 |
$x = strpos($content, $marker, $starting_from);
|
464 |
if ($x !== false) {
|
465 |
$content = substr_replace($content, $what, $x + strlen($marker), 0);
|
@@ -522,9 +453,9 @@ function hefo_replace($buffer) {
|
|
522 |
|
523 |
// Pinterest
|
524 |
$pinterest_url = 'http://www.pinterest.com/pin/create/button/?url=' . $permalink;
|
525 |
-
$image_id = function_exists('get_post_thumbnail_id') ? get_post_thumbnail_id($
|
526 |
if ($image_id) {
|
527 |
-
$image = wp_get_attachment_image_src($image_id,
|
528 |
$pinterest_url .= '&media=' . urlencode($image[0]);
|
529 |
}
|
530 |
$pinterest_url .= '&description=' . $title;
|
4 |
Plugin Name: Head, Footer and Post Injections
|
5 |
Plugin URI: http://www.satollo.net/plugins/header-footer
|
6 |
Description: Header and Footer lets to add html/javascript code to the head and footer and posts of your blog. Some examples are provided on the <a href="http://www.satollo.net/plugins/header-footer">official page</a>.
|
7 |
+
Version: 3.0.4
|
8 |
Author: Stefano Lissa
|
9 |
Author URI: http://www.satollo.net
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
101 |
return substr($buffer, 0, $x) . "\n" . $hefo_body_block . substr($buffer, $x);
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
add_action('wp_head', 'hefo_wp_head_pre', 1);
|
105 |
|
106 |
function hefo_wp_head_pre() {
|
141 |
if (is_search() && isset($hefo_options['seo_search_noindex'])) {
|
142 |
echo '<meta name="robots" content="noindex">';
|
143 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
}
|
145 |
|
146 |
add_action('wp_head', 'hefo_wp_head_post', 11);
|
367 |
}
|
368 |
|
369 |
function hefo_insert_before(&$content, $what, $marker, $starting_from = 0) {
|
370 |
+
if (strlen($content) < $starting_from) {
|
371 |
+
return false;
|
372 |
+
}
|
373 |
+
|
374 |
if (empty($marker)) {
|
375 |
$marker = ' ';
|
376 |
}
|
377 |
$x = strpos($content, $marker, $starting_from);
|
378 |
if ($x !== false) {
|
|
|
379 |
$content = substr_replace($content, $what, $x, 0);
|
380 |
return true;
|
381 |
}
|
383 |
}
|
384 |
|
385 |
function hefo_insert_after(&$content, $what, $marker, $starting_from = 0) {
|
386 |
+
if (strlen($content) < $starting_from) {
|
387 |
+
return false;
|
388 |
+
}
|
389 |
+
|
390 |
if (empty($marker)) {
|
391 |
$marker = ' ';
|
392 |
}
|
393 |
+
|
394 |
$x = strpos($content, $marker, $starting_from);
|
395 |
if ($x !== false) {
|
396 |
$content = substr_replace($content, $what, $x + strlen($marker), 0);
|
453 |
|
454 |
// Pinterest
|
455 |
$pinterest_url = 'http://www.pinterest.com/pin/create/button/?url=' . $permalink;
|
456 |
+
$image_id = function_exists('get_post_thumbnail_id') ? get_post_thumbnail_id($post->ID) : false;
|
457 |
if ($image_id) {
|
458 |
+
$image = wp_get_attachment_image_src($image_id, 'full');
|
459 |
$pinterest_url .= '&media=' . urlencode($image[0]);
|
460 |
}
|
461 |
$pinterest_url .= '&description=' . $title;
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Tags: header, footer, blog, page, single, post, head, tracking, facebook, og meta tag, open graph, ads, adsense, injections, analytics, amp
|
3 |
Requires at least: 3.0
|
4 |
Tested up to: 4.7.2
|
5 |
-
Stable tag: 3.0.
|
6 |
Donate link: http://www.satollo.net/donations
|
7 |
Contributors: satollo
|
8 |
|
@@ -91,6 +91,17 @@ FAQs are answered on [Header and Footer](http://www.satollo.net/plugins/header-f
|
|
91 |
|
92 |
== Changelog ==
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
= 3.0.2 =
|
95 |
|
96 |
* Version error (grrr)
|
2 |
Tags: header, footer, blog, page, single, post, head, tracking, facebook, og meta tag, open graph, ads, adsense, injections, analytics, amp
|
3 |
Requires at least: 3.0
|
4 |
Tested up to: 4.7.2
|
5 |
+
Stable tag: 3.0.4
|
6 |
Donate link: http://www.satollo.net/donations
|
7 |
Contributors: satollo
|
8 |
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 3.0.4 =
|
95 |
+
|
96 |
+
* Debug notices fix
|
97 |
+
|
98 |
+
= 3.0.3 =
|
99 |
+
|
100 |
+
* Check on content length for injections "skipping" N characters
|
101 |
+
* Removed obsolete code
|
102 |
+
* Removed script handlers debugger
|
103 |
+
* Fixed notice on $post_id
|
104 |
+
|
105 |
= 3.0.2 =
|
106 |
|
107 |
* Version error (grrr)
|