Remove Footer Credit - Version 1.0.10

Version Description

  • 03.08.2021 = Fixes: PHP error Fixes: replace string with html entities and without
Download this release

Release Info

Developer giucu91
Plugin Icon 128x128 Remove Footer Credit
Version 1.0.10
Comparing to
See all releases

Code changes from version 1.0.9 to 1.0.10

Files changed (3) hide show
  1. readme.txt +6 -2
  2. remove-footer-credit.php +22 -11
  3. sections/settings.php +2 -2
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: wpchill, silkalns
3
  Tags: footer, credit, change, modify, replace, remove, link, HTML, text, remove footer credit
4
  Requires at least: 5.2
5
- Tested up to: 5.7
6
- Stable tag: 1.0.9
7
  Requires PHP: 5.6
8
  License: GPLv3 or later
9
 
@@ -32,6 +32,10 @@ This plugin has very minimal options to keep things simple and easier to use. Yo
32
 
33
  == Changelog ==
34
 
 
 
 
 
35
  = 1.0.9 - 16.07.2021 =
36
  Fixes: Adding replace string at bottom of the site.
37
 
2
  Contributors: wpchill, silkalns
3
  Tags: footer, credit, change, modify, replace, remove, link, HTML, text, remove footer credit
4
  Requires at least: 5.2
5
+ Tested up to: 5.8
6
+ Stable tag: 1.0.10
7
  Requires PHP: 5.6
8
  License: GPLv3 or later
9
 
32
 
33
  == Changelog ==
34
 
35
+ = 1.0.10 - 03.08.2021 =
36
+ Fixes: PHP error
37
+ Fixes: replace string with html entities and without
38
+
39
  = 1.0.9 - 16.07.2021 =
40
  Fixes: Adding replace string at bottom of the site.
41
 
remove-footer-credit.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Remove Footer Credit
4
  * Description: A simple plugin to remove footer credits
5
- * Version: 1.0.9
6
  * Author: WPChill
7
  * Author URI: https://wpchill.com
8
  * Requires: 5.2 or higher
@@ -51,7 +51,7 @@ class RFC_Plugin {
51
  private $tabs;
52
  private $options;
53
  private $assets_path;
54
-
55
  function __construct() {
56
 
57
  $this->tabs = array(
@@ -68,8 +68,14 @@ class RFC_Plugin {
68
  'path' => 'plugin-info.php',
69
  ),
70
  );
71
-
 
 
 
 
 
72
  $this->options = get_option( 'jabrfc_text' );
 
73
  $this->assets_path = plugin_dir_url( __FILE__ ) . 'assets/';
74
 
75
  $this->public_hooks();
@@ -115,7 +121,7 @@ class RFC_Plugin {
115
 
116
  public function jabrfc_the_content( $content ) {
117
  global $post;
118
- $data = get_option( 'jabrfc_text' );
119
  if ( $data['willLinkback'] == 'yes' && is_singular() && $data['linkbackPostId'] == $post->ID ) {
120
  $content = $content . esc_html__('Get WordPress help, plugins, themes and tips at ','remove-footer-credit'). '<a href="https://www.machothemes.com?utm_source=remove-footer-credit&utm_medium=front&utm_campaign=credit-link">'. esc_html__('MachoThemes.com','remove-footer-credit').'</a>';
121
  }
@@ -206,15 +212,19 @@ function jabrfc_ob_call( $buffer ) { // $buffer contains entire page
206
 
207
  $data = get_option( 'jabrfc_text' );
208
 
209
- if ( is_array( $data['find']) ) {
210
- $i = 0;
211
- foreach ( $data['find'] as &$value ) {
 
 
 
 
 
212
 
213
- $value = html_entity_decode( jabrfc_kses( $value ) );
214
- $replace = html_entity_decode( jabrfc_kses( $data['replace'][ $i ] ) );
 
215
 
216
- $buffer = str_replace( $value, ( array_key_exists( $i, $data['replace'] ) ? $replace : '' ), $buffer );
217
- $i ++;
218
  }
219
  }
220
  return $buffer;
@@ -222,6 +232,7 @@ function jabrfc_ob_call( $buffer ) { // $buffer contains entire page
222
 
223
  function jabrfc_kses( $string ){
224
  $allowed_protocols = wp_allowed_protocols();
 
225
 
226
  $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
227
  $string = wp_kses_normalize_entities( $string );
2
  /**
3
  * Plugin Name: Remove Footer Credit
4
  * Description: A simple plugin to remove footer credits
5
+ * Version: 1.0.10
6
  * Author: WPChill
7
  * Author URI: https://wpchill.com
8
  * Requires: 5.2 or higher
51
  private $tabs;
52
  private $options;
53
  private $assets_path;
54
+
55
  function __construct() {
56
 
57
  $this->tabs = array(
68
  'path' => 'plugin-info.php',
69
  ),
70
  );
71
+ $options_defaults = array(
72
+ 'replace' => array(),
73
+ 'willLinkback' => 'no',
74
+ 'linkbackPostId' => 'no',
75
+ 'find' => array(),
76
+ );
77
  $this->options = get_option( 'jabrfc_text' );
78
+ $this->options = wp_parse_args( $this->options, $options_defaults );
79
  $this->assets_path = plugin_dir_url( __FILE__ ) . 'assets/';
80
 
81
  $this->public_hooks();
121
 
122
  public function jabrfc_the_content( $content ) {
123
  global $post;
124
+ $data = $this->options;
125
  if ( $data['willLinkback'] == 'yes' && is_singular() && $data['linkbackPostId'] == $post->ID ) {
126
  $content = $content . esc_html__('Get WordPress help, plugins, themes and tips at ','remove-footer-credit'). '<a href="https://www.machothemes.com?utm_source=remove-footer-credit&utm_medium=front&utm_campaign=credit-link">'. esc_html__('MachoThemes.com','remove-footer-credit').'</a>';
127
  }
212
 
213
  $data = get_option( 'jabrfc_text' );
214
 
215
+ if ( is_array( $data['find'] ) ) {
216
+ foreach ( $data['find'] as $i => $value ) {
217
+
218
+ $value = jabrfc_kses( $value );
219
+ $replace = '';
220
+ if ( isset( $data['replace'][ $i ] ) ) {
221
+ $replace = html_entity_decode( jabrfc_kses( $data['replace'][ $i ] ) );
222
+ }
223
 
224
+ // try to replace wihtout html_entity_decode.
225
+ $buffer = str_replace( $value, $replace, $buffer );
226
+ $buffer = str_replace( html_entity_decode( $value ), $replace, $buffer );
227
 
 
 
228
  }
229
  }
230
  return $buffer;
232
 
233
  function jabrfc_kses( $string ){
234
  $allowed_protocols = wp_allowed_protocols();
235
+ $allowed_html = wp_kses_allowed_html( 'post' );
236
 
237
  $string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
238
  $string = wp_kses_normalize_entities( $string );
sections/settings.php CHANGED
@@ -1,11 +1,11 @@
1
  <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" class="settings-form">
2
-
3
  <?php $replace = ""; if ($this->options['replace']) $replace = implode("\n",$this->options['replace']); ?>
4
  <?php $willLinkback = "no"; if ($this->options['willLinkback']) $willLinkback = $this->options['willLinkback']; ?>
5
  <?php $linkbackPostId = ""; if ($this->options['linkbackPostId']) $linkbackPostId = $this->options['linkbackPostId']; ?>
6
 
7
  <h3><?php echo esc_html__('Step 1: Enter text/HTML to remove (one per line)','remove-footer-credit'); ?></h3>
8
- <p><textarea name="find" id="find" class="small-text code" rows="6" style="width: 100%;"><?php if ($this->options['find']) echo html_entity_decode(implode("\n",$this->options['find'])); ?></textarea></p>
9
  <h3><?php echo esc_html__('Step 2: Enter your own footer credit (one per line)','remove-footer-credit'); ?></h3>
10
  <?php wp_editor( $replace, 'replace', $settings = array('quicktags' => true, 'wpautop' => false,'editor_height' => '100', 'teeny' => false) ); ?>
11
  <h3><?php echo esc_html__('Step 3: Please support my work and spread the word (optional)','remove-footer-credit'); ?></h3>
1
  <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" class="settings-form">
2
+
3
  <?php $replace = ""; if ($this->options['replace']) $replace = implode("\n",$this->options['replace']); ?>
4
  <?php $willLinkback = "no"; if ($this->options['willLinkback']) $willLinkback = $this->options['willLinkback']; ?>
5
  <?php $linkbackPostId = ""; if ($this->options['linkbackPostId']) $linkbackPostId = $this->options['linkbackPostId']; ?>
6
 
7
  <h3><?php echo esc_html__('Step 1: Enter text/HTML to remove (one per line)','remove-footer-credit'); ?></h3>
8
+ <p><textarea name="find" id="find" class="small-text code" rows="6" style="width: 100%;"><?php if ($this->options['find']) echo htmlentities(implode("\n",$this->options['find'])); ?></textarea></p>
9
  <h3><?php echo esc_html__('Step 2: Enter your own footer credit (one per line)','remove-footer-credit'); ?></h3>
10
  <?php wp_editor( $replace, 'replace', $settings = array('quicktags' => true, 'wpautop' => false,'editor_height' => '100', 'teeny' => false) ); ?>
11
  <h3><?php echo esc_html__('Step 3: Please support my work and spread the word (optional)','remove-footer-credit'); ?></h3>