Head, Footer and Post Injections - Version 3.0.7

Version Description

  • Added the filter "hefo_php_exec" to let a third party to disable the PHP execution
Download this release

Release Info

Developer satollo
Plugin Icon wp plugin Head, Footer and Post Injections
Version 3.0.7
Comparing to
See all releases

Code changes from version 3.0.6 to 3.0.7

Files changed (3) hide show
  1. options.php +45 -39
  2. plugin.php +24 -13
  3. readme.txt +6 -2
options.php CHANGED
@@ -329,14 +329,14 @@ else {
329
  </p>
330
  </div>
331
  <?php } ?>
332
-
333
  <?php if (!isset($dismissed['newsletter'])) { ?>
334
  <div class="notice notice-success"><p>
335
  If you want to be informed of important updated of this plugin, you may want to subscribe to my (rare) newsletter<br>
336
  <form action="http://www.satollo.net/?na=s" target="_blank" method="post">
337
  <input type="hidden" value="header-footer" name="nr">
338
  <input type="hidden" value="2" name="nl[]">
339
- <input type="email" name="ne" value="<?php echo esc_attr(get_option('admin_email'))?>">
340
  <input type="submit" value="Subscribe">
341
  </form>
342
  <a class="hefo-dismiss" href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=newsletter&noheader=1') ?>">&times;</a>
@@ -346,7 +346,7 @@ else {
346
 
347
  <div style="padding: 15px; background-color: #fff; border: 1px solid #eee; font-size: 16px; line-height: 22px">
348
  Did this plugin save you lot of time and troubles?
349
- <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5PHGDGNHAYLJ8" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('header-footer')?>/images/donate.png"></a>
350
  To help children. Even <b>2$</b> help. <a href="http://www.satollo.net/donations" target="_blank">Please read more</a>. Thank you.
351
  <br>
352
  Are you profitably using this free plugin for your customers? One more reason to consider a
@@ -368,7 +368,13 @@ else {
368
 
369
 
370
  <p>
371
- <?php _e('PHP is allowed on textareas below.'); ?>
 
 
 
 
 
 
372
  </p>
373
 
374
  <form method="post" action="">
@@ -501,8 +507,8 @@ else {
501
  <!--<h3>Posts and pages</h3>-->
502
  <table class="form-table">
503
  <!--<tr valign="top"><?php hefo_field_checkbox('category', __('Enable injection on category pages', 'header-footer')); ?></tr>-->
504
- <tr valign="top"><?php //hefo_field_textarea('before', __('Code to be inserted before each post', 'header-footer'), '', 'rows="10"'); ?></tr>
505
- <tr valign="top"><?php //hefo_field_textarea('after', __('Code to be inserted after each post', 'header-footer'), '', 'rows="10"'); ?></tr>
506
  </table>
507
 
508
  <h3><?php _e('Injection on excerpts', 'header-footer'); ?></h3>
@@ -686,7 +692,7 @@ else {
686
  </div>
687
  </div>
688
  <div class="clearfix"></div>
689
-
690
  <h3>Footer</h3>
691
  <div class="row">
692
 
@@ -697,7 +703,7 @@ else {
697
  </div>
698
  </div>
699
  <div class="clearfix"></div>
700
-
701
  </div>
702
 
703
 
@@ -789,11 +795,11 @@ else {
789
  </p>
790
  <?php $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); ?>
791
  <?php foreach ($post_types as $post_type) { ?>
792
- <h3><?php echo esc_html($post_type->label) ?> (<?php echo esc_html($post_type->name) ?>)</h3>
793
- <table class="form-table">
794
- <tr><?php hefo_field_textarea($post_type->name . '_before', __('Before the content', 'header-footer'), '', 'rows="10"'); ?></tr>
795
- <tr><?php hefo_field_textarea($post_type->name . '_after', __('After the content', 'header-footer'), '', 'rows="10"'); ?></tr>
796
- </table>
797
  <?php } ?>
798
  </div>
799
  -->
@@ -811,33 +817,33 @@ else {
811
  </table>
812
 
813
  <?php /*
814
- <h3>Web performance</h3>
815
- <p>
816
- Some JavaScript can be marked to be loaded asynchronously, for example the comment-reply.js of WordPress.
817
- Not always asynchronous load work, for example jQuery cannot usually loaded in this way. Since WordPress does
818
- not support this feature natively, here you can force thise feature on specific scripts.<br>
819
- Usually you can add comment-reply, akismet-form, admin-bar.<br>
820
- You can read more on <a href="http://www.satollo.net/javascript-asyn-load-for-wordpress-enqueued-scripts" target="_blank">this article</a>
821
- and/or ask on my <a href="http://www.satollo.net/forums" target="_blank">forum area</a>.
822
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
823
 
824
- <table class="form-table">
825
-
826
- <tr valign="top">
827
- <th scope="row">
828
- Script handle debug
829
- </th>
830
- <?php hefo_field_checkbox_only('script_handle_debug', __('Activate in page debug info: see the source page to find the handles', 'header-footer')); ?>
831
-
832
- </tr>
833
- <tr valign="top">
834
- <?php
835
- hefo_field_textarea('script_async_handles', __('Script handles to load asynchronously', 'header-footer'), 'One per line', 'rows="10"');
836
- ?>
837
- </tr>
838
- </table>
839
- */ ?>
840
-
841
  <h3>Head meta links</h3>
842
  <p>
843
  WordPress automatically add some meta link on the head of the page, for example the RSS links, the previous and next
329
  </p>
330
  </div>
331
  <?php } ?>
332
+
333
  <?php if (!isset($dismissed['newsletter'])) { ?>
334
  <div class="notice notice-success"><p>
335
  If you want to be informed of important updated of this plugin, you may want to subscribe to my (rare) newsletter<br>
336
  <form action="http://www.satollo.net/?na=s" target="_blank" method="post">
337
  <input type="hidden" value="header-footer" name="nr">
338
  <input type="hidden" value="2" name="nl[]">
339
+ <input type="email" name="ne" value="<?php echo esc_attr(get_option('admin_email')) ?>">
340
  <input type="submit" value="Subscribe">
341
  </form>
342
  <a class="hefo-dismiss" href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=newsletter&noheader=1') ?>">&times;</a>
346
 
347
  <div style="padding: 15px; background-color: #fff; border: 1px solid #eee; font-size: 16px; line-height: 22px">
348
  Did this plugin save you lot of time and troubles?
349
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5PHGDGNHAYLJ8" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('header-footer') ?>/images/donate.png"></a>
350
  To help children. Even <b>2$</b> help. <a href="http://www.satollo.net/donations" target="_blank">Please read more</a>. Thank you.
351
  <br>
352
  Are you profitably using this free plugin for your customers? One more reason to consider a
368
 
369
 
370
  <p>
371
+ <?php
372
+ if (apply_filters('hefo_php_exec', true)) {
373
+ _e('PHP is allowed in your code.');
374
+ } else {
375
+ _e('PHP is NOT allowed in your code (disable by your theme or a plugin)');
376
+ }
377
+ ?>
378
  </p>
379
 
380
  <form method="post" action="">
507
  <!--<h3>Posts and pages</h3>-->
508
  <table class="form-table">
509
  <!--<tr valign="top"><?php hefo_field_checkbox('category', __('Enable injection on category pages', 'header-footer')); ?></tr>-->
510
+ <tr valign="top"><?php //hefo_field_textarea('before', __('Code to be inserted before each post', 'header-footer'), '', 'rows="10"'); ?></tr>
511
+ <tr valign="top"><?php //hefo_field_textarea('after', __('Code to be inserted after each post', 'header-footer'), '', 'rows="10"'); ?></tr>
512
  </table>
513
 
514
  <h3><?php _e('Injection on excerpts', 'header-footer'); ?></h3>
692
  </div>
693
  </div>
694
  <div class="clearfix"></div>
695
+
696
  <h3>Footer</h3>
697
  <div class="row">
698
 
703
  </div>
704
  </div>
705
  <div class="clearfix"></div>
706
+
707
  </div>
708
 
709
 
795
  </p>
796
  <?php $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); ?>
797
  <?php foreach ($post_types as $post_type) { ?>
798
+ <h3><?php echo esc_html($post_type->label) ?> (<?php echo esc_html($post_type->name) ?>)</h3>
799
+ <table class="form-table">
800
+ <tr><?php hefo_field_textarea($post_type->name . '_before', __('Before the content', 'header-footer'), '', 'rows="10"'); ?></tr>
801
+ <tr><?php hefo_field_textarea($post_type->name . '_after', __('After the content', 'header-footer'), '', 'rows="10"'); ?></tr>
802
+ </table>
803
  <?php } ?>
804
  </div>
805
  -->
817
  </table>
818
 
819
  <?php /*
820
+ <h3>Web performance</h3>
821
+ <p>
822
+ Some JavaScript can be marked to be loaded asynchronously, for example the comment-reply.js of WordPress.
823
+ Not always asynchronous load work, for example jQuery cannot usually loaded in this way. Since WordPress does
824
+ not support this feature natively, here you can force thise feature on specific scripts.<br>
825
+ Usually you can add comment-reply, akismet-form, admin-bar.<br>
826
+ You can read more on <a href="http://www.satollo.net/javascript-asyn-load-for-wordpress-enqueued-scripts" target="_blank">this article</a>
827
+ and/or ask on my <a href="http://www.satollo.net/forums" target="_blank">forum area</a>.
828
+ </p>
829
+
830
+ <table class="form-table">
831
+
832
+ <tr valign="top">
833
+ <th scope="row">
834
+ Script handle debug
835
+ </th>
836
+ <?php hefo_field_checkbox_only('script_handle_debug', __('Activate in page debug info: see the source page to find the handles', 'header-footer')); ?>
837
+
838
+ </tr>
839
+ <tr valign="top">
840
+ <?php
841
+ hefo_field_textarea('script_async_handles', __('Script handles to load asynchronously', 'header-footer'), 'One per line', 'rows="10"');
842
+ ?>
843
+ </tr>
844
+ </table>
845
+ */ ?>
846
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
847
  <h3>Head meta links</h3>
848
  <p>
849
  WordPress automatically add some meta link on the head of the page, for example the RSS links, the previous and next
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.6
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.
@@ -154,9 +154,13 @@ function hefo_wp_head_post() {
154
 
155
  $buffer .= hefo_replace($hefo_options['head']);
156
 
157
- ob_start();
158
- eval('?>' . $buffer);
159
- ob_end_flush();
 
 
 
 
160
  }
161
 
162
  add_action('amp_post_template_head', 'hefo_amp_post_template_head', 100);
@@ -176,6 +180,7 @@ function hefo_amp_post_template_css() {
176
  }
177
 
178
  add_action('amp_post_template_footer', 'hefo_amp_post_template_footer', 100);
 
179
  function hefo_amp_post_template_footer() {
180
  global $hefo_options;
181
  echo "\n";
@@ -196,9 +201,13 @@ function hefo_wp_footer() {
196
 
197
  $buffer = hefo_replace($buffer);
198
 
199
- ob_start();
200
- eval('?>' . $buffer);
201
- ob_end_flush();
 
 
 
 
202
  }
203
 
204
  // BBPRESS
@@ -379,7 +388,7 @@ function hefo_insert_before(&$content, $what, $marker, $starting_from = 0) {
379
  if (strlen($content) < $starting_from) {
380
  return false;
381
  }
382
-
383
  if (empty($marker)) {
384
  $marker = ' ';
385
  }
@@ -396,11 +405,11 @@ function hefo_insert_after(&$content, $what, $marker, $starting_from = 0) {
396
  if (strlen($content) < $starting_from) {
397
  return false;
398
  }
399
-
400
  if (empty($marker)) {
401
  $marker = ' ';
402
  }
403
-
404
  $x = strpos($content, $marker, $starting_from);
405
 
406
  if ($x !== false) {
@@ -484,8 +493,10 @@ function hefo_execute($buffer) {
484
  if (empty($buffer)) {
485
  return '';
486
  }
487
- ob_start();
488
- eval('?>' . $buffer);
489
- $buffer = ob_get_clean();
 
 
490
  return $buffer;
491
  }
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.7
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.
154
 
155
  $buffer .= hefo_replace($hefo_options['head']);
156
 
157
+ if (apply_filters('hefo_php_exec', true)) {
158
+ ob_start();
159
+ eval('?>' . $buffer);
160
+ ob_end_flush();
161
+ } else {
162
+ echo $buffer;
163
+ }
164
  }
165
 
166
  add_action('amp_post_template_head', 'hefo_amp_post_template_head', 100);
180
  }
181
 
182
  add_action('amp_post_template_footer', 'hefo_amp_post_template_footer', 100);
183
+
184
  function hefo_amp_post_template_footer() {
185
  global $hefo_options;
186
  echo "\n";
201
 
202
  $buffer = hefo_replace($buffer);
203
 
204
+ if (apply_filters('hefo_php_exec', true)) {
205
+ ob_start();
206
+ eval('?>' . $buffer);
207
+ ob_end_flush();
208
+ } else {
209
+ echo $buffer;
210
+ }
211
  }
212
 
213
  // BBPRESS
388
  if (strlen($content) < $starting_from) {
389
  return false;
390
  }
391
+
392
  if (empty($marker)) {
393
  $marker = ' ';
394
  }
405
  if (strlen($content) < $starting_from) {
406
  return false;
407
  }
408
+
409
  if (empty($marker)) {
410
  $marker = ' ';
411
  }
412
+
413
  $x = strpos($content, $marker, $starting_from);
414
 
415
  if ($x !== false) {
493
  if (empty($buffer)) {
494
  return '';
495
  }
496
+ if (apply_filters('hefo_php_exec', true)) {
497
+ ob_start();
498
+ eval('?>' . $buffer);
499
+ $buffer = ob_get_clean();
500
+ }
501
  return $buffer;
502
  }
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Head, Footer and Post Injections ===
2
  Tags: header, footer, blog, page, single, post, head, tracking, facebook, og meta tag, open graph, ads, adsense, injections, analytics, amp, pixel
3
  Requires at least: 3.0
4
- Tested up to: 4.7.2
5
- Stable tag: 3.0.6
6
  Donate link: http://www.satollo.net/donations
7
  Contributors: satollo
8
 
@@ -93,6 +93,10 @@ FAQs are answered on [Header and Footer](http://www.satollo.net/plugins/header-f
93
 
94
  == Changelog ==
95
 
 
 
 
 
96
  = 3.0.6 =
97
 
98
  * Moved the donate png inside the plugin
1
  === Head, Footer and Post Injections ===
2
  Tags: header, footer, blog, page, single, post, head, tracking, facebook, og meta tag, open graph, ads, adsense, injections, analytics, amp, pixel
3
  Requires at least: 3.0
4
+ Tested up to: 4.7.3
5
+ Stable tag: 3.0.7
6
  Donate link: http://www.satollo.net/donations
7
  Contributors: satollo
8
 
93
 
94
  == Changelog ==
95
 
96
+ = 3.0.7 =
97
+
98
+ * Added the filter "hefo_php_exec" to let a third party to disable the PHP execution
99
+
100
  = 3.0.6 =
101
 
102
  * Moved the donate png inside the plugin