Orphans - Version 3.0.1

Version Description

  • 2022-07-18 =
  • Added tag attributes replacement protection. Props for krzyc.
Download this release

Release Info

Developer iworks
Plugin Icon 128x128 Orphans
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

etc/options.php CHANGED
@@ -180,6 +180,19 @@ function orphang_indicator_options() {
180
  'sanitize_callback' => 'absint',
181
  'classes' => array( 'switch-button' ),
182
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  array(
184
  'name' => 'own_orphans',
185
  'th' => __( 'User definied orphans', 'sierotki' ),
180
  'sanitize_callback' => 'absint',
181
  'classes' => array( 'switch-button' ),
182
  ),
183
+ array(
184
+ 'name' => 'attributes',
185
+ 'th' => __( 'Protect tag attributes', 'sierotki' ),
186
+ 'type' => 'checkbox',
187
+ 'description' => __(
188
+ 'Allow to ignore spaces in "class", "style" and "data-*
189
+ attributes.',
190
+ 'sierotki'
191
+ ),
192
+ 'sanitize_callback' => 'absint',
193
+ 'classes' => array( 'switch-button' ),
194
+ 'default' => 1,
195
+ ),
196
  array(
197
  'name' => 'own_orphans',
198
  'th' => __( 'User definied orphans', 'sierotki' ),
includes/iworks/class-iworks-orphan.php CHANGED
@@ -48,7 +48,7 @@ class iworks_orphan {
48
  *
49
  * @since 3.0.0
50
  */
51
- private $version = '3.0.0';
52
 
53
  public function __construct() {
54
  /**
@@ -209,6 +209,29 @@ class iworks_orphan {
209
  if ( ! is_string( $content ) || empty( $content ) ) {
210
  return $content;
211
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  /**
213
  * Avoid to replace inside script or styles tags
214
  */
@@ -294,6 +317,14 @@ class iworks_orphan {
294
  $content = preg_replace( $re, $one, $content );
295
  }
296
  }
 
 
 
 
 
 
 
 
297
  /**
298
  * return
299
  */
48
  *
49
  * @since 3.0.0
50
  */
51
+ private $version = '3.0.1';
52
 
53
  public function __construct() {
54
  /**
209
  if ( ! is_string( $content ) || empty( $content ) ) {
210
  return $content;
211
  }
212
+ /**
213
+ * Avoid to replace attributes
214
+ */
215
+ $attributes = array();
216
+ if ( $this->options->get_option( 'attributes' ) ) {
217
+ preg_match_all( '/(style|class|data-[a-z\-]+)="[^"]+"/', $content, $matches );
218
+ if ( ! empty( $matches ) ) {
219
+ $salt = 'Sae9ieCheyieph3ug7si4yeiBoog0fae4yae6biexaimie0ied7quienae3yeepo';
220
+ foreach ( $matches[0] as $value ) {
221
+ if ( empty( $value ) ) {
222
+ continue;
223
+ }
224
+ if ( preg_match( '/ /', $value ) ) {
225
+ $attributes[ $value ] = md5( $salt . $value );
226
+ }
227
+ }
228
+ if ( ! empty( $attributes ) ) {
229
+ foreach ( $attributes as $part => $to_change ) {
230
+ $content = str_replace( $part, $to_change, $content );
231
+ }
232
+ }
233
+ }
234
+ }
235
  /**
236
  * Avoid to replace inside script or styles tags
237
  */
317
  $content = preg_replace( $re, $one, $content );
318
  }
319
  }
320
+ /**
321
+ * revert replaced attributes
322
+ */
323
+ if ( ! empty( $attributes ) ) {
324
+ foreach ( $attributes as $to_change => $part ) {
325
+ $content = str_replace( $part, $to_change, $content );
326
+ }
327
+ }
328
  /**
329
  * return
330
  */
languages/sierotki.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Orphans PLUGIN_VERSION\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sierotki-dev\n"
7
- "POT-Creation-Date: 2022-04-21 05:38:08+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -153,78 +153,88 @@ msgid "Allow to keep together phone number or strings with space between numbers
153
  msgstr ""
154
 
155
  #: etc/options.php:185
156
- msgid "User definied orphans"
157
  msgstr ""
158
 
159
  #: etc/options.php:187
 
 
 
 
 
 
 
 
 
 
160
  msgid "Use a comma to separate orphans."
161
  msgstr ""
162
 
163
- #: etc/options.php:194
164
  msgid "Entries custom fields"
165
  msgstr ""
166
 
167
- #: etc/options.php:196
168
  msgid "Use a comma to separate custom fields name."
169
  msgstr ""
170
 
171
- #: etc/options.php:204 etc/options.php:328
172
  msgid "We are waiting for your message"
173
  msgstr ""
174
 
175
- #: etc/options.php:210
176
  msgid "I love what I do!"
177
  msgstr ""
178
 
179
- #: etc/options.php:223
180
  msgid "Integrations"
181
  msgstr ""
182
 
183
- #: etc/options.php:228
184
  msgid "Advanced Custom Fields"
185
  msgstr ""
186
 
187
- #: etc/options.php:233
188
  msgid "Text"
189
  msgstr ""
190
 
191
- #: etc/options.php:234
192
  msgid "Enabled the substitution of orphans in text fields."
193
  msgstr ""
194
 
195
- #: etc/options.php:242
196
  msgid "Textarea"
197
  msgstr ""
198
 
199
- #: etc/options.php:243
200
  msgid "Enabled the substitution of orphans in textarea fields. (Include WYSIWYG)."
201
  msgstr ""
202
 
203
- #: etc/options.php:251
204
  msgid "WYSIWYG"
205
  msgstr ""
206
 
207
- #: etc/options.php:252
208
  msgid "Enabled the substitution of orphans in WYSIWYG fields."
209
  msgstr ""
210
 
211
- #: etc/options.php:292
212
  msgid "Below are some links to help spread this plugin to other users"
213
  msgstr ""
214
 
215
- #: etc/options.php:294
216
  msgid "Give it a five stars on WordPress.org"
217
  msgstr ""
218
 
219
- #: etc/options.php:295
220
  msgid "Link to it so others can easily find it"
221
  msgstr ""
222
 
223
- #: etc/options.php:330
224
  msgid "WordPress Help Forum"
225
  msgstr ""
226
 
227
- #: includes/iworks/class-iworks-orphan.php:447
228
  #: includes/iworks/rate/rate.php:124
229
  msgid "Settings"
230
  msgstr ""
@@ -382,12 +392,12 @@ msgstr ""
382
  msgid "http://iworks.pl/"
383
  msgstr ""
384
 
385
- #: etc/options.php:295
386
  msgctxt "plugin home page on WordPress.org"
387
  msgid "https://wordpress.org/plugins/sierotki/"
388
  msgstr ""
389
 
390
- #: etc/options.php:330
391
  msgctxt "link to support forum on WordPress.org"
392
  msgid "https://wordpress.org/support/plugin/sierotki/"
393
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: Orphans PLUGIN_VERSION\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sierotki-dev\n"
7
+ "POT-Creation-Date: 2022-07-18 06:34:52+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
153
  msgstr ""
154
 
155
  #: etc/options.php:185
156
+ msgid "Protect tag attributes"
157
  msgstr ""
158
 
159
  #: etc/options.php:187
160
+ msgid ""
161
+ "Allow to ignore spaces in \"class\", \"style\" and \"data-*\n"
162
+ " attributes."
163
+ msgstr ""
164
+
165
+ #: etc/options.php:198
166
+ msgid "User definied orphans"
167
+ msgstr ""
168
+
169
+ #: etc/options.php:200
170
  msgid "Use a comma to separate orphans."
171
  msgstr ""
172
 
173
+ #: etc/options.php:207
174
  msgid "Entries custom fields"
175
  msgstr ""
176
 
177
+ #: etc/options.php:209
178
  msgid "Use a comma to separate custom fields name."
179
  msgstr ""
180
 
181
+ #: etc/options.php:217 etc/options.php:341
182
  msgid "We are waiting for your message"
183
  msgstr ""
184
 
185
+ #: etc/options.php:223
186
  msgid "I love what I do!"
187
  msgstr ""
188
 
189
+ #: etc/options.php:236
190
  msgid "Integrations"
191
  msgstr ""
192
 
193
+ #: etc/options.php:241
194
  msgid "Advanced Custom Fields"
195
  msgstr ""
196
 
197
+ #: etc/options.php:246
198
  msgid "Text"
199
  msgstr ""
200
 
201
+ #: etc/options.php:247
202
  msgid "Enabled the substitution of orphans in text fields."
203
  msgstr ""
204
 
205
+ #: etc/options.php:255
206
  msgid "Textarea"
207
  msgstr ""
208
 
209
+ #: etc/options.php:256
210
  msgid "Enabled the substitution of orphans in textarea fields. (Include WYSIWYG)."
211
  msgstr ""
212
 
213
+ #: etc/options.php:264
214
  msgid "WYSIWYG"
215
  msgstr ""
216
 
217
+ #: etc/options.php:265
218
  msgid "Enabled the substitution of orphans in WYSIWYG fields."
219
  msgstr ""
220
 
221
+ #: etc/options.php:305
222
  msgid "Below are some links to help spread this plugin to other users"
223
  msgstr ""
224
 
225
+ #: etc/options.php:307
226
  msgid "Give it a five stars on WordPress.org"
227
  msgstr ""
228
 
229
+ #: etc/options.php:308
230
  msgid "Link to it so others can easily find it"
231
  msgstr ""
232
 
233
+ #: etc/options.php:343
234
  msgid "WordPress Help Forum"
235
  msgstr ""
236
 
237
+ #: includes/iworks/class-iworks-orphan.php:478
238
  #: includes/iworks/rate/rate.php:124
239
  msgid "Settings"
240
  msgstr ""
392
  msgid "http://iworks.pl/"
393
  msgstr ""
394
 
395
+ #: etc/options.php:308
396
  msgctxt "plugin home page on WordPress.org"
397
  msgid "https://wordpress.org/plugins/sierotki/"
398
  msgstr ""
399
 
400
+ #: etc/options.php:343
401
  msgctxt "link to support forum on WordPress.org"
402
  msgid "https://wordpress.org/support/plugin/sierotki/"
403
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://ko-fi.com/iworks?utm_source=sierotki&utm_medium=readme-dona
4
  Tags: sierotka, sierotki, spójniki, twarda spacja
5
  Requires at least: 4.6
6
  Tested up to: 6.0
7
- Stable tag: 3.0.0
8
 
9
 
10
 
@@ -128,6 +128,9 @@ function remove_iworks_orphan_terms( $terms ) {
128
 
129
  == Changelog ==
130
 
 
 
 
131
  = 3.0.0 - 2022-04-21 =
132
  * Added Transients API to avoid multiple read from `terms.txt` file.
133
  * Removed unused method `add_help_tab()`.
4
  Tags: sierotka, sierotki, spójniki, twarda spacja
5
  Requires at least: 4.6
6
  Tested up to: 6.0
7
+ Stable tag: 3.0.1
8
 
9
 
10
 
128
 
129
  == Changelog ==
130
 
131
+ = 3.0.1 - 2022-07-18 =
132
+ * Added tag attributes replacement protection. Props for [krzyc](https://wordpress.org/support/users/krzyc/).
133
+
134
  = 3.0.0 - 2022-04-21 =
135
  * Added Transients API to avoid multiple read from `terms.txt` file.
136
  * Removed unused method `add_help_tab()`.
sierotki.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://iworks.pl/2011/02/16/sierotki/
5
  Text Domain: sierotki
6
  Description: Implement Polish grammar rules with orphans.
7
  Author: Marcin Pietrzak
8
- Version: 3.0.0
9
  Author URI: http://iworks.pl/
10
  */
11
 
5
  Text Domain: sierotki
6
  Description: Implement Polish grammar rules with orphans.
7
  Author: Marcin Pietrzak
8
+ Version: 3.0.1
9
  Author URI: http://iworks.pl/
10
  */
11