Orphans - Version 2.9.8

Version Description

  • 2022-02-05 =
  • Improved checking is plugin "Advanced Custom Fields" - removed usage of class_exists function.
  • Moved load_plugin_textdomain() function to allow load i18n even plugin is not active.
Download this release

Release Info

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

Code changes from version 2.9.7 to 2.9.8

etc/options.php CHANGED
@@ -214,9 +214,74 @@ function orphang_indicator_options() {
214
  ),
215
  ),
216
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  return $options;
218
  }
219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  function iworks_orphan_options_loved_this_plugin( $iworks_orphan ) {
221
  $content = apply_filters( 'iworks_rate_love', '', 'sierotki' );
222
  if ( ! empty( $content ) ) {
214
  ),
215
  ),
216
  );
217
+ $integrations = iworks_orphan_options_check_available_integrations();
218
+ if ( empty( $integrations ) ) {
219
+ return $options;
220
+ }
221
+ $options['index']['options'][] = array(
222
+ 'type' => 'heading',
223
+ 'label' => __( 'Integrations', 'sierotki' ),
224
+ );
225
+ if ( in_array( 'acf.php', $integrations ) ) {
226
+ $options['index']['options'][] = array(
227
+ 'type' => 'subheading',
228
+ 'label' => __( 'Advanced Custom Fields', 'sierotki' ),
229
+ );
230
+ $options['index']['options'][] = array(
231
+ 'name' => 'acf_text',
232
+ 'type' => 'checkbox',
233
+ 'th' => __( 'Text', 'sierotki' ),
234
+ 'description' => __( 'Enabled the substitution of orphans in text fields.', 'sierotki' ),
235
+ 'sanitize_callback' => 'absint',
236
+ 'default' => 0,
237
+ 'classes' => array( 'switch-button' ),
238
+ );
239
+ $options['index']['options'][] = array(
240
+ 'name' => 'acf_textarea',
241
+ 'type' => 'checkbox',
242
+ 'th' => __( 'Textarea', 'sierotki' ),
243
+ 'description' => __( 'Enabled the substitution of orphans in textarea fields. (Include WYSIWYG).', 'sierotki' ),
244
+ 'sanitize_callback' => 'absint',
245
+ 'default' => 0,
246
+ 'classes' => array( 'switch-button' ),
247
+ );
248
+ $options['index']['options'][] = array(
249
+ 'name' => 'acf_wysiwyg',
250
+ 'type' => 'checkbox',
251
+ 'th' => __( 'WYSIWYG', 'sierotki' ),
252
+ 'description' => __( 'Enabled the substitution of orphans in WYSIWYG fields.', 'sierotki' ),
253
+ 'sanitize_callback' => 'absint',
254
+ 'default' => 0,
255
+ 'classes' => array( 'switch-button' ),
256
+ );
257
+ }
258
  return $options;
259
  }
260
 
261
+ /**
262
+ * check available integrations
263
+ *
264
+ * @since 2.9.8
265
+ */
266
+ function iworks_orphan_options_check_available_integrations() {
267
+ $integrations = array();
268
+ $plugins = get_option( 'active_plugins' );
269
+ if ( empty( $plugins ) ) {
270
+ return $integrations;
271
+ }
272
+ /**
273
+ * check ACF plugin
274
+ *
275
+ * @since 2.9.7
276
+ */
277
+ foreach ( $plugins as $plugin ) {
278
+ if ( preg_match( '/acf\.php$/', $plugin ) ) {
279
+ $integrations[] = basename( $plugin );
280
+ }
281
+ }
282
+ return $integrations;
283
+ }
284
+
285
  function iworks_orphan_options_loved_this_plugin( $iworks_orphan ) {
286
  $content = apply_filters( 'iworks_rate_love', '', 'sierotki' );
287
  if ( ! empty( $content ) ) {
includes/iworks/class-iworks-orphan.php CHANGED
@@ -43,13 +43,6 @@ class iworks_orphan {
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,39 +57,21 @@ class iworks_orphan {
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
  */
76
  add_action( 'init', array( $this, 'init' ) );
77
  add_action( 'admin_init', array( $this, 'admin_init' ) );
78
- add_action( 'iworks_rate_css', array( $this, 'iworks_rate_css' ) );
79
- add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
80
  /**
81
  * filters
82
  */
83
  add_filter( 'orphan_replace', array( $this, 'orphan_replace_filter' ) );
84
- add_filter( 'orphang_indicator_options', array( $this, 'add_integrations' ) );
85
  /**
86
  * iWorks Rate Class
87
  */
88
  add_filter( 'iworks_rate_notice_logo_style', array( $this, 'filter_plugin_logo' ), 10, 2 );
89
  }
90
 
91
- /**
92
- * Load Translation
93
- *
94
- * @since 2.7.3
95
- */
96
- public function load_translation() {
97
- load_plugin_textdomain( 'sierotki', false, dirname( $this->plugin_file ) . '/languages' );
98
- }
99
-
100
  /**
101
  * base replacement function
102
  */
@@ -363,7 +338,9 @@ class iworks_orphan {
363
  if ( is_admin() ) {
364
  return;
365
  }
366
- $this->settings = $this->options->get_all_options();
 
 
367
  /**
368
  * Filter allowed filters.
369
  *
@@ -465,18 +442,6 @@ class iworks_orphan {
465
  }
466
  }
467
 
468
- /**
469
- * Change logo for "rate" message.
470
- *
471
- * @since 2.6.6
472
- */
473
- public function iworks_rate_css() {
474
- $logo = plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'assets/images/logo.png';
475
- echo '<style type="text/css">';
476
- printf( '.iworks-notice-sierotki .iworks-notice-logo{background-color:#fed696;background-image:url(%s);}', esc_url( $logo ) );
477
- echo '</style>';
478
- }
479
-
480
  /**
481
  * Is key turned on?
482
  *
@@ -657,52 +622,5 @@ class iworks_orphan {
657
  return $logo;
658
  }
659
 
660
- private function add_integration_header( $options ) {
661
- $label = __( 'Integrations', 'sierotki' );
662
- $options['index']['options'][] = array(
663
- 'type' => 'heading',
664
- 'label' => $label,
665
- );
666
- return $options;
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
-
708
  }
 
43
  */
44
  private $meta_keys = null;
45
 
 
 
 
 
 
 
 
46
  public function __construct() {
47
  /**
48
  * basic settings
57
  * plugin ID
58
  */
59
  $this->plugin_file = plugin_basename( $file );
 
 
 
 
 
 
60
  /**
61
  * actions
62
  */
63
  add_action( 'init', array( $this, 'init' ) );
64
  add_action( 'admin_init', array( $this, 'admin_init' ) );
 
 
65
  /**
66
  * filters
67
  */
68
  add_filter( 'orphan_replace', array( $this, 'orphan_replace_filter' ) );
 
69
  /**
70
  * iWorks Rate Class
71
  */
72
  add_filter( 'iworks_rate_notice_logo_style', array( $this, 'filter_plugin_logo' ), 10, 2 );
73
  }
74
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * base replacement function
77
  */
338
  if ( is_admin() ) {
339
  return;
340
  }
341
+ if ( empty( $this->settings ) ) {
342
+ $this->settings = $this->options->get_all_options();
343
+ }
344
  /**
345
  * Filter allowed filters.
346
  *
442
  }
443
  }
444
 
 
 
 
 
 
 
 
 
 
 
 
 
445
  /**
446
  * Is key turned on?
447
  *
622
  return $logo;
623
  }
624
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625
  }
626
+
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-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"
@@ -168,7 +168,7 @@ msgstr ""
168
  msgid "Use a comma to separate custom fields name."
169
  msgstr ""
170
 
171
- #: etc/options.php:204 etc/options.php:263
172
  msgid "We are waiting for your message"
173
  msgstr ""
174
 
@@ -176,81 +176,81 @@ msgstr ""
176
  msgid "I love what I do!"
177
  msgstr ""
178
 
179
- #: etc/options.php:227
180
- msgid "Below are some links to help spread this plugin to other users"
181
  msgstr ""
182
 
183
- #: etc/options.php:229
184
- msgid "Give it a five stars on WordPress.org"
185
  msgstr ""
186
 
187
- #: etc/options.php:230
188
- msgid "Link to it so others can easily find it"
189
  msgstr ""
190
 
191
- #: etc/options.php:265
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
 
256
  #: includes/iworks/options/options.php:251
@@ -382,12 +382,12 @@ msgstr ""
382
  msgid "http://iworks.pl/"
383
  msgstr ""
384
 
385
- #: etc/options.php:230
386
  msgctxt "plugin home page on WordPress.org"
387
  msgid "https://wordpress.org/plugins/sierotki/"
388
  msgstr ""
389
 
390
- #: etc/options.php:265
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-02-05 10:43:05+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
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
 
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:309
228
+ msgid "Plugin fix some Polish gramary rules with orphans."
229
  msgstr ""
230
 
231
+ #: includes/iworks/class-iworks-orphan.php:316
232
+ msgid "For more information:"
233
  msgstr ""
234
 
235
+ #: includes/iworks/class-iworks-orphan.php:317
236
+ msgid ""
237
+ "<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
238
+ "target=\"_blank\">Plugin Homepage</a>"
239
  msgstr ""
240
 
241
+ #: includes/iworks/class-iworks-orphan.php:318
242
+ msgid ""
243
+ "<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
244
+ "target=\"_blank\">Support Forums</a>"
245
  msgstr ""
246
 
247
+ #: includes/iworks/class-iworks-orphan.php:319
248
+ msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
249
  msgstr ""
250
 
251
+ #: includes/iworks/class-iworks-orphan.php:466
252
+ #: includes/iworks/rate/rate.php:118
253
+ msgid "Settings"
254
  msgstr ""
255
 
256
  #: includes/iworks/options/options.php:251
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 ""
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.7
8
 
9
 
10
 
@@ -128,6 +128,10 @@ function remove_iworks_orphan_terms( $terms ) {
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.
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.8
8
 
9
 
10
 
128
 
129
  == Changelog ==
130
 
131
+ = 2.9.8 - 2022-02-05 =
132
+ * Improved checking is plugin "Advanced Custom Fields" - removed usage of `class_exists` function.
133
+ * Moved `load_plugin_textdomain()` function to allow load i18n even plugin is not active.
134
+
135
  = 2.9.7 - 2022-02-05 =
136
  * Improved checking is plugin "Advanced Custom Fields" to avoid multiple calling function `class_exists`. Props for [Piotr](https://wordpress.org/support/users/leardre/).
137
  * Remove duplicates from "terms to replace" list and sort this list.
sierotki.php CHANGED
@@ -5,12 +5,13 @@ 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.7
9
  Author URI: http://iworks.pl/
10
  */
11
 
12
  include_once dirname( __FILE__ ) . '/etc/options.php';
13
 
 
14
 
15
  $includes = dirname( __FILE__ ) . '/includes';
16
 
5
  Text Domain: sierotki
6
  Description: Implement Polish grammar rules with orphans.
7
  Author: Marcin Pietrzak
8
+ Version: 2.9.8
9
  Author URI: http://iworks.pl/
10
  */
11
 
12
  include_once dirname( __FILE__ ) . '/etc/options.php';
13
 
14
+ load_plugin_textdomain( 'sierotki', false, dirname( __FILE__ ) . '/languages' );
15
 
16
  $includes = dirname( __FILE__ ) . '/includes';
17