Orphans - Version 2.9.7

Version Description

  • 2022-02-05 =
  • Improved checking is plugin "Advanced Custom Fields" to avoid multiple calling function class_exists. Props for Piotr.
  • Remove duplicates from "terms to replace" list and sort this list.
Download this release

Release Info

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

Code changes from version 2.9.6 to 2.9.7

includes/iworks/class-iworks-orphan.php CHANGED
@@ -43,6 +43,13 @@ class iworks_orphan {
43
  */
44
  private $meta_keys = null;
45
 
 
 
 
 
 
 
 
46
  public function __construct() {
47
  /**
48
  * basic settings
@@ -57,6 +64,12 @@ class iworks_orphan {
57
  * plugin ID
58
  */
59
  $this->plugin_file = plugin_basename( $file );
 
 
 
 
 
 
60
  /**
61
  * actions
62
  */
@@ -255,7 +268,7 @@ class iworks_orphan {
255
  $terms = $this->_terms();
256
  $terms_terms = array_chunk( $terms, 10 );
257
  /**
258
- * avoid to replace tags contnt
259
  *
260
  * @since 2.9.4
261
  */
@@ -581,13 +594,23 @@ class iworks_orphan {
581
  */
582
  $a = array();
583
  foreach ( $terms as $t ) {
584
- $a[] = html_entity_decode( $t );
585
  }
586
  $terms = $a;
587
  /**
588
  * remove empty elements
589
  */
590
- $terms = array_filter( $terms );
 
 
 
 
 
 
 
 
 
 
591
  $this->terms = $terms;
592
  /**
593
  * filter it
@@ -644,45 +667,41 @@ class iworks_orphan {
644
  }
645
 
646
  public function add_integrations( $options ) {
647
- $added = false;
648
- if ( class_exists( 'ACF' ) ) {
649
- if ( ! $added ) {
650
- $options = $this->add_integration_header( $options );
651
- $added = true;
652
- $options['index']['options'][] = array(
653
- 'type' => 'subheading',
654
- 'label' => __( 'Advanced Custom Fields', 'sierotki' ),
655
- );
656
- $options['index']['options'][] = array(
657
- 'name' => 'acf_text',
658
- 'type' => 'checkbox',
659
- 'th' => __( 'Text', 'sierotki' ),
660
- 'description' => __( 'Enabled the substitution of orphans in text fields.', 'sierotki' ),
661
- 'sanitize_callback' => 'absint',
662
- 'default' => 0,
663
- 'classes' => array( 'switch-button' ),
664
- );
665
- $options['index']['options'][] = array(
666
- 'name' => 'acf_textarea',
667
- 'type' => 'checkbox',
668
- 'th' => __( 'Textarea', 'sierotki' ),
669
- 'description' => __( 'Enabled the substitution of orphans in textarea fields. (Include WYSIWYG).', 'sierotki' ),
670
- 'sanitize_callback' => 'absint',
671
- 'default' => 0,
672
- 'classes' => array( 'switch-button' ),
673
- );
674
- $options['index']['options'][] = array(
675
- 'name' => 'acf_wysiwyg',
676
- 'type' => 'checkbox',
677
- 'th' => __( 'WYSIWYG', 'sierotki' ),
678
- 'description' => __( 'Enabled the substitution of orphans in WYSIWYG fields.', 'sierotki' ),
679
- 'sanitize_callback' => 'absint',
680
- 'default' => 0,
681
- 'classes' => array( 'switch-button' ),
682
- );
683
- }
684
  }
685
-
686
  return $options;
687
  }
688
 
43
  */
44
  private $meta_keys = null;
45
 
46
+ /**
47
+ * check ACF plugin
48
+ *
49
+ * @since 2.9.7
50
+ */
51
+ private $is_acf_installed = false;
52
+
53
  public function __construct() {
54
  /**
55
  * basic settings
64
  * plugin ID
65
  */
66
  $this->plugin_file = plugin_basename( $file );
67
+ /**
68
+ * check ACF plugin
69
+ *
70
+ * @since 2.9.7
71
+ */
72
+ $this->is_acf_installed = class_exists( 'ACF' );
73
  /**
74
  * actions
75
  */
268
  $terms = $this->_terms();
269
  $terms_terms = array_chunk( $terms, 10 );
270
  /**
271
+ * avoid to replace tags content
272
  *
273
  * @since 2.9.4
274
  */
594
  */
595
  $a = array();
596
  foreach ( $terms as $t ) {
597
+ $a[] = strtolower( html_entity_decode( $t ) );
598
  }
599
  $terms = $a;
600
  /**
601
  * remove empty elements
602
  */
603
+ $terms = array_filter( $terms );
604
+ /**
605
+ * remove duplicates & sort
606
+ *
607
+ * @since 2.9.7
608
+ */
609
+ $terms = array_unique( $terms );
610
+ sort( $terms );
611
+ /**
612
+ * assign to class property
613
+ */
614
  $this->terms = $terms;
615
  /**
616
  * filter it
667
  }
668
 
669
  public function add_integrations( $options ) {
670
+ if ( $this->is_acf_installed ) {
671
+ $options = $this->add_integration_header( $options );
672
+ $added = true;
673
+ $options['index']['options'][] = array(
674
+ 'type' => 'subheading',
675
+ 'label' => __( 'Advanced Custom Fields', 'sierotki' ),
676
+ );
677
+ $options['index']['options'][] = array(
678
+ 'name' => 'acf_text',
679
+ 'type' => 'checkbox',
680
+ 'th' => __( 'Text', 'sierotki' ),
681
+ 'description' => __( 'Enabled the substitution of orphans in text fields.', 'sierotki' ),
682
+ 'sanitize_callback' => 'absint',
683
+ 'default' => 0,
684
+ 'classes' => array( 'switch-button' ),
685
+ );
686
+ $options['index']['options'][] = array(
687
+ 'name' => 'acf_textarea',
688
+ 'type' => 'checkbox',
689
+ 'th' => __( 'Textarea', 'sierotki' ),
690
+ 'description' => __( 'Enabled the substitution of orphans in textarea fields. (Include WYSIWYG).', 'sierotki' ),
691
+ 'sanitize_callback' => 'absint',
692
+ 'default' => 0,
693
+ 'classes' => array( 'switch-button' ),
694
+ );
695
+ $options['index']['options'][] = array(
696
+ 'name' => 'acf_wysiwyg',
697
+ 'type' => 'checkbox',
698
+ 'th' => __( 'WYSIWYG', 'sierotki' ),
699
+ 'description' => __( 'Enabled the substitution of orphans in WYSIWYG fields.', 'sierotki' ),
700
+ 'sanitize_callback' => 'absint',
701
+ 'default' => 0,
702
+ 'classes' => array( 'switch-button' ),
703
+ );
 
 
 
704
  }
 
705
  return $options;
706
  }
707
 
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-02-03 11:17:18+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -192,64 +192,64 @@ msgstr ""
192
  msgid "WordPress Help Forum"
193
  msgstr ""
194
 
195
- #: includes/iworks/class-iworks-orphan.php:321
196
  msgid "Plugin fix some Polish gramary rules with orphans."
197
  msgstr ""
198
 
199
- #: includes/iworks/class-iworks-orphan.php:328
200
  msgid "For more information:"
201
  msgstr ""
202
 
203
- #: includes/iworks/class-iworks-orphan.php:329
204
  msgid ""
205
  "<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
206
  "target=\"_blank\">Plugin Homepage</a>"
207
  msgstr ""
208
 
209
- #: includes/iworks/class-iworks-orphan.php:330
210
  msgid ""
211
  "<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
212
  "target=\"_blank\">Support Forums</a>"
213
  msgstr ""
214
 
215
- #: includes/iworks/class-iworks-orphan.php:331
216
  msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
217
  msgstr ""
218
 
219
- #: includes/iworks/class-iworks-orphan.php:488
220
  #: includes/iworks/rate/rate.php:118
221
  msgid "Settings"
222
  msgstr ""
223
 
224
- #: includes/iworks/class-iworks-orphan.php:638
225
  msgid "Integrations"
226
  msgstr ""
227
 
228
- #: includes/iworks/class-iworks-orphan.php:654
229
  msgid "Advanced Custom Fields"
230
  msgstr ""
231
 
232
- #: includes/iworks/class-iworks-orphan.php:659
233
  msgid "Text"
234
  msgstr ""
235
 
236
- #: includes/iworks/class-iworks-orphan.php:660
237
  msgid "Enabled the substitution of orphans in text fields."
238
  msgstr ""
239
 
240
- #: includes/iworks/class-iworks-orphan.php:668
241
  msgid "Textarea"
242
  msgstr ""
243
 
244
- #: includes/iworks/class-iworks-orphan.php:669
245
  msgid "Enabled the substitution of orphans in textarea fields. (Include WYSIWYG)."
246
  msgstr ""
247
 
248
- #: includes/iworks/class-iworks-orphan.php:677
249
  msgid "WYSIWYG"
250
  msgstr ""
251
 
252
- #: includes/iworks/class-iworks-orphan.php:678
253
  msgid "Enabled the substitution of orphans in WYSIWYG fields."
254
  msgstr ""
255
 
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-02-05 08:33:45+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
192
  msgid "WordPress Help Forum"
193
  msgstr ""
194
 
195
+ #: includes/iworks/class-iworks-orphan.php:334
196
  msgid "Plugin fix some Polish gramary rules with orphans."
197
  msgstr ""
198
 
199
+ #: includes/iworks/class-iworks-orphan.php:341
200
  msgid "For more information:"
201
  msgstr ""
202
 
203
+ #: includes/iworks/class-iworks-orphan.php:342
204
  msgid ""
205
  "<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
206
  "target=\"_blank\">Plugin Homepage</a>"
207
  msgstr ""
208
 
209
+ #: includes/iworks/class-iworks-orphan.php:343
210
  msgid ""
211
  "<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
212
  "target=\"_blank\">Support Forums</a>"
213
  msgstr ""
214
 
215
+ #: includes/iworks/class-iworks-orphan.php:344
216
  msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
217
  msgstr ""
218
 
219
+ #: includes/iworks/class-iworks-orphan.php:501
220
  #: includes/iworks/rate/rate.php:118
221
  msgid "Settings"
222
  msgstr ""
223
 
224
+ #: includes/iworks/class-iworks-orphan.php:661
225
  msgid "Integrations"
226
  msgstr ""
227
 
228
+ #: includes/iworks/class-iworks-orphan.php:675
229
  msgid "Advanced Custom Fields"
230
  msgstr ""
231
 
232
+ #: includes/iworks/class-iworks-orphan.php:680
233
  msgid "Text"
234
  msgstr ""
235
 
236
+ #: includes/iworks/class-iworks-orphan.php:681
237
  msgid "Enabled the substitution of orphans in text fields."
238
  msgstr ""
239
 
240
+ #: includes/iworks/class-iworks-orphan.php:689
241
  msgid "Textarea"
242
  msgstr ""
243
 
244
+ #: includes/iworks/class-iworks-orphan.php:690
245
  msgid "Enabled the substitution of orphans in textarea fields. (Include WYSIWYG)."
246
  msgstr ""
247
 
248
+ #: includes/iworks/class-iworks-orphan.php:698
249
  msgid "WYSIWYG"
250
  msgstr ""
251
 
252
+ #: includes/iworks/class-iworks-orphan.php:699
253
  msgid "Enabled the substitution of orphans in WYSIWYG fields."
254
  msgstr ""
255
 
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: 5.9
7
- Stable tag: 2.9.6
8
 
9
 
10
 
@@ -128,6 +128,10 @@ function remove_iworks_orphan_terms( $terms ) {
128
 
129
  == Changelog ==
130
 
 
 
 
 
131
  = 2.9.6 - 2022-02-03 =
132
  * Added check for missing second param in `the_title` filter. Props for [Zbyszek Zalewski](https://www.facebook.com/zbyszek.zalewski)
133
 
@@ -185,7 +189,6 @@ function remove_iworks_orphan_terms( $terms ) {
185
  * Turned off replacements in feeds.
186
  * Turned off replacements in REST API.
187
 
188
-
189
  = 2.7.5 - 2019-11-12 =
190
  * Fixed default values configuration.
191
  * Handled quotation mark before orphan.
4
  Tags: sierotka, sierotki, spójniki, twarda spacja
5
  Requires at least: 4.6
6
  Tested up to: 5.9
7
+ Stable tag: 2.9.7
8
 
9
 
10
 
128
 
129
  == Changelog ==
130
 
131
+ = 2.9.7 - 2022-02-05 =
132
+ * Improved checking is plugin "Advanced Custom Fields" to avoid multiple calling function `class_exists`. Props for [Piotr](https://wordpress.org/support/users/leardre/).
133
+ * Remove duplicates from "terms to replace" list and sort this list.
134
+
135
  = 2.9.6 - 2022-02-03 =
136
  * Added check for missing second param in `the_title` filter. Props for [Zbyszek Zalewski](https://www.facebook.com/zbyszek.zalewski)
137
 
189
  * Turned off replacements in feeds.
190
  * Turned off replacements in REST API.
191
 
 
192
  = 2.7.5 - 2019-11-12 =
193
  * Fixed default values configuration.
194
  * Handled quotation mark before orphan.
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: 2.9.6
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: 2.9.7
9
  Author URI: http://iworks.pl/
10
  */
11