Orphans - Version 2.9.2

Version Description

  • 2022-01-20 =
  • Updated iWorks Options to 2.7.3.
  • Updated iWorks Rate to 2.0.6.
Download this release

Release Info

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

Code changes from version 2.9.1 to 2.9.2

includes/iworks/class-iworks-orphan.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Copyright 2011-2021 Marcin Pietrzak (marcin@iworks.pl)
4
 
5
  this program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License, version 2, as
1
  <?php
2
  /*
3
+ Copyright 2011-2022 Marcin Pietrzak (marcin@iworks.pl)
4
 
5
  this program is free software; you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License, version 2, as
includes/iworks/options/options.php CHANGED
@@ -3,13 +3,13 @@
3
  Class Name: iWorks Options
4
  Class URI: http://iworks.pl/
5
  Description: Option class to manage options.
6
- Version: 2.7.1
7
  Author: Marcin Pietrzak
8
  Author URI: http://iworks.pl/
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- Copyright 2011-2021 Marcin Pietrzak (marcin@iworks.pl)
13
 
14
  this program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
@@ -51,12 +51,26 @@ class iworks_options {
51
 
52
  public $notices;
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  public function __construct() {
55
  /**
56
  * basic setup
57
  */
58
  $this->notices = array();
59
- $this->version = '2.7.1';
60
  $this->option_group = 'index';
61
  $this->option_function_name = null;
62
  $this->option_prefix = null;
@@ -461,12 +475,13 @@ class iworks_options {
461
  $id = sprintf( ' id="%s"', $html_element_name );
462
  }
463
  $content .= sprintf(
464
- '<input type="%s" name="%s" value="%s" class="%s"%s /> %s',
465
  $option['type'],
466
  $html_element_name,
467
  $this->get_option( $option_name, $option_group ),
468
  esc_attr( implode( ' ', $classes ) ),
469
  $id,
 
470
  isset( $option['label'] ) ? $option['label'] : ''
471
  );
472
  break;
@@ -768,7 +783,7 @@ class iworks_options {
768
  if ( isset( $option['label'] ) && $option['label'] ) {
769
  $content .= '<br />';
770
  }
771
- $content .= sprintf( '<span class="description">%s</span>', $option['description'] );
772
  }
773
  $content .= '</td>';
774
  $content .= '</tr>';
@@ -854,7 +869,6 @@ class iworks_options {
854
  /**
855
  * register setting
856
  */
857
-
858
  $args = array();
859
  if ( isset( $option['sanitize_callback'] ) ) {
860
  $args['sanitize_callback'] = $option['sanitize_callback'];
@@ -878,10 +892,7 @@ class iworks_options {
878
  }
879
 
880
  public function options_init() {
881
- $options = array();
882
- if ( is_callable( $this->option_function_name ) ) {
883
- $options = call_user_func( $this->option_function_name );
884
- }
885
  /**
886
  * add last_used_tab field
887
  */
@@ -906,7 +917,11 @@ class iworks_options {
906
  if ( isset( $data['options'] ) && is_array( $data['options'] ) ) {
907
  $this->register_setting( $data['options'], $key );
908
  } elseif ( 'options' == $key ) {
909
- $this->register_setting( $data, 'theme' );
 
 
 
 
910
  }
911
  }
912
  }
@@ -1253,7 +1268,6 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1253
  wp_enqueue_script( 'common' );
1254
  wp_enqueue_script( 'wp-lists' );
1255
  wp_enqueue_script( 'postbox' );
1256
-
1257
  foreach ( $this->options[ $option_name ]['metaboxes'] as $id => $data ) {
1258
  add_meta_box(
1259
  $id,
@@ -1824,4 +1838,15 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1824
  }
1825
  return in_array( $screen->id, $this->pagehooks );
1826
  }
 
 
 
 
 
 
 
 
 
 
 
1827
  }
3
  Class Name: iWorks Options
4
  Class URI: http://iworks.pl/
5
  Description: Option class to manage options.
6
+ Version: 2.7.3
7
  Author: Marcin Pietrzak
8
  Author URI: http://iworks.pl/
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ Copyright 2011-2022 Marcin Pietrzak (marcin@iworks.pl)
13
 
14
  this program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
51
 
52
  public $notices;
53
 
54
+ /**
55
+ * self file
56
+ *
57
+ * @since 2.7.3
58
+ */
59
+ private $__file__ = __FILE__;
60
+
61
+ /**
62
+ * call from plugin
63
+ *
64
+ * @since 2.7.3
65
+ */
66
+ private $plugin = '-not-set-';
67
+
68
  public function __construct() {
69
  /**
70
  * basic setup
71
  */
72
  $this->notices = array();
73
+ $this->version = '2.7.3';
74
  $this->option_group = 'index';
75
  $this->option_function_name = null;
76
  $this->option_prefix = null;
475
  $id = sprintf( ' id="%s"', $html_element_name );
476
  }
477
  $content .= sprintf(
478
+ '<input type="%s" name="%s" value="%s" class="%s"%s%s /> %s',
479
  $option['type'],
480
  $html_element_name,
481
  $this->get_option( $option_name, $option_group ),
482
  esc_attr( implode( ' ', $classes ) ),
483
  $id,
484
+ isset( $option['maxlength'] ) ? sprintf( ' maxlength="%d"', $option['maxlength'] ) : '',
485
  isset( $option['label'] ) ? $option['label'] : ''
486
  );
487
  break;
783
  if ( isset( $option['label'] ) && $option['label'] ) {
784
  $content .= '<br />';
785
  }
786
+ $content .= sprintf( '<p class="description">%s</p>', $option['description'] );
787
  }
788
  $content .= '</td>';
789
  $content .= '</tr>';
869
  /**
870
  * register setting
871
  */
 
872
  $args = array();
873
  if ( isset( $option['sanitize_callback'] ) ) {
874
  $args['sanitize_callback'] = $option['sanitize_callback'];
892
  }
893
 
894
  public function options_init() {
895
+ $options = $this->get_option_array();
 
 
 
896
  /**
897
  * add last_used_tab field
898
  */
917
  if ( isset( $data['options'] ) && is_array( $data['options'] ) ) {
918
  $this->register_setting( $data['options'], $key );
919
  } elseif ( 'options' == $key ) {
920
+ $key = $this->mode;
921
+ if ( ! empty( $this->option_group ) ) {
922
+ $key = $this->option_group;
923
+ }
924
+ $this->register_setting( $data, $key );
925
  }
926
  }
927
  }
1268
  wp_enqueue_script( 'common' );
1269
  wp_enqueue_script( 'wp-lists' );
1270
  wp_enqueue_script( 'postbox' );
 
1271
  foreach ( $this->options[ $option_name ]['metaboxes'] as $id => $data ) {
1272
  add_meta_box(
1273
  $id,
1838
  }
1839
  return in_array( $screen->id, $this->pagehooks );
1840
  }
1841
+
1842
+ /**
1843
+ * Set plugin value
1844
+ *
1845
+ * @since 2.7.3
1846
+ *
1847
+ * @param string $plugin Plugin file.
1848
+ */
1849
+ public function set_plugin( $plugin ) {
1850
+ $this->plugin = $plugin;
1851
+ }
1852
  }
includes/iworks/rate/rate.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * iWorks_Rate - Dashboard Notification module.
4
  *
5
- * @version 2.0.4
6
  * @author iworks (Marcin Pietrzak)
7
  *
8
  */
@@ -15,7 +15,7 @@ if ( ! class_exists( 'iworks_rate' ) ) {
15
  * @since 1.0.1
16
  * @var string
17
  */
18
- private $version = '2.0.4';
19
 
20
  /**
21
  * $wpdb->options field name.
@@ -103,7 +103,14 @@ if ( ! class_exists( 'iworks_rate' ) ) {
103
  * @param array $actions An array of the plugin's metadata, including the version, author, author URI, and plugin URI.
104
  */
105
  public function add_donate_link( $actions, $plugin_file, $plugin_data, $context ) {
106
- $settings_page_url = esc_url( apply_filters( 'iworks_rate_settings_page_url_' . $plugin_data['slug'], null ) );
 
 
 
 
 
 
 
107
  if ( ! empty( $settings_page_url ) ) {
108
  $actions['settings'] = sprintf(
109
  '<a href="%s">%s</a>',
@@ -113,7 +120,7 @@ if ( ! class_exists( 'iworks_rate' ) ) {
113
  }
114
  $actions['donate'] = sprintf(
115
  '<a href="https://ko-fi.com/iworks?utm_source=%s&utm_medium=plugin-links" target="_blank">%s</a>',
116
- $plugin_data['slug'],
117
  __( 'Provide us a coffee', 'sierotki' )
118
  );
119
  return $actions;
@@ -157,6 +164,13 @@ if ( ! class_exists( 'iworks_rate' ) ) {
157
  'slug' => $slug,
158
  );
159
  $this->plugins[ $plugin_id ] = $data;
 
 
 
 
 
 
 
160
  /*
161
  * When the plugin is registered the first time we store some infos
162
  * in the persistent module-data that help us later to find out
@@ -172,7 +186,27 @@ if ( ! class_exists( 'iworks_rate' ) ) {
172
  ),
173
  $data
174
  );
175
- // Finally save the details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  $this->store_data();
177
  }
178
  }
2
  /**
3
  * iWorks_Rate - Dashboard Notification module.
4
  *
5
+ * @version 2.0.6
6
  * @author iworks (Marcin Pietrzak)
7
  *
8
  */
15
  * @since 1.0.1
16
  * @var string
17
  */
18
+ private $version = '2.0.6';
19
 
20
  /**
21
  * $wpdb->options field name.
103
  * @param array $actions An array of the plugin's metadata, including the version, author, author URI, and plugin URI.
104
  */
105
  public function add_donate_link( $actions, $plugin_file, $plugin_data, $context ) {
106
+ $slug = 'iworks';
107
+ if (
108
+ isset( $this->plugins[ $plugin_file ] )
109
+ && isset( $this->plugins[ $plugin_file ]['slug'] )
110
+ ) {
111
+ $slug = $this->plugins[ $plugin_file ]['slug'];
112
+ }
113
+ $settings_page_url = esc_url( apply_filters( 'iworks_rate_settings_page_url_' . $slug, null ) );
114
  if ( ! empty( $settings_page_url ) ) {
115
  $actions['settings'] = sprintf(
116
  '<a href="%s">%s</a>',
120
  }
121
  $actions['donate'] = sprintf(
122
  '<a href="https://ko-fi.com/iworks?utm_source=%s&utm_medium=plugin-links" target="_blank">%s</a>',
123
+ $slug,
124
  __( 'Provide us a coffee', 'sierotki' )
125
  );
126
  return $actions;
164
  'slug' => $slug,
165
  );
166
  $this->plugins[ $plugin_id ] = $data;
167
+ /**
168
+ * check for option update
169
+ *
170
+ * @since 2.0.6
171
+ *
172
+ */
173
+ $update = false;
174
  /*
175
  * When the plugin is registered the first time we store some infos
176
  * in the persistent module-data that help us later to find out
186
  ),
187
  $data
188
  );
189
+ $update = true;
190
+ }
191
+ /**
192
+ * check slug & mark for update if needed
193
+ *
194
+ * @since 2.0.6
195
+ */
196
+ if ( $this->stored[ $plugin_id ]['slug'] !== $slug ) {
197
+ $this->stored[ $plugin_id ]['slug'] = $slug;
198
+ $update = true;
199
+ }
200
+ /**
201
+ * check title - can be diferent due language
202
+ *
203
+ * @since 2.0.6
204
+ */
205
+ $this->stored[ $plugin_id ]['title'] = $title;
206
+ /**
207
+ * Finally save the details if it is needed
208
+ */
209
+ if ( $update ) {
210
  $this->store_data();
211
  }
212
  }
languages/sierotki.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2021 Marcin Pietrzak
2
  # This file is distributed under the same license as the Orphans package.
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Orphans PLUGIN_VERSION\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sierotki\n"
7
- "POT-Creation-Date: 2021-12-15 10:26:41+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.3\n"
@@ -209,7 +209,7 @@ msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
209
  msgstr ""
210
 
211
  #: includes/iworks/class-iworks-orphan.php:404
212
- #: includes/iworks/rate/rate.php:111
213
  msgid "Settings"
214
  msgstr ""
215
 
@@ -249,47 +249,47 @@ msgstr ""
249
  msgid "Enabled the substitution of orphans in WYSIWYG fields."
250
  msgstr ""
251
 
252
- #: includes/iworks/options/options.php:237
253
  msgid "An error occurred while getting the configuration."
254
  msgstr ""
255
 
256
- #: includes/iworks/options/options.php:734
257
  msgid "Upload image"
258
  msgstr ""
259
 
260
- #: includes/iworks/options/options.php:740
261
  msgid "Delete image"
262
  msgstr ""
263
 
264
- #: includes/iworks/options/options.php:826
265
  msgid "Save Changes"
266
  msgstr ""
267
 
268
- #: includes/iworks/options/options.php:1631
269
  msgid "Country"
270
  msgstr ""
271
 
272
- #: includes/iworks/options/options.php:1632
273
  msgid "City"
274
  msgstr ""
275
 
276
- #: includes/iworks/options/options.php:1633
277
  msgid "Street"
278
  msgstr ""
279
 
280
- #: includes/iworks/options/options.php:1634
281
  msgid "ZIP code"
282
  msgstr ""
283
 
284
- #: includes/iworks/options/options.php:1785
285
  msgid "OFF"
286
  msgstr ""
287
 
288
- #: includes/iworks/options/options.php:1786
289
  msgid "ON"
290
  msgstr ""
291
 
292
- #: includes/iworks/rate/rate.php:117
293
  #: includes/iworks/rate/templates/thanks.php:28
294
  msgid "Provide us a coffee"
295
  msgstr ""
@@ -387,12 +387,12 @@ msgctxt "link to support forum on WordPress.org"
387
  msgid "https://wordpress.org/support/plugin/sierotki/"
388
  msgstr ""
389
 
390
- #: includes/iworks/rate/rate.php:365
391
  msgctxt "plugins home"
392
  msgid "https://wordpress.org/plugins/%s"
393
  msgstr ""
394
 
395
- #: includes/iworks/rate/rate.php:371
396
  msgctxt "plugins support home"
397
  msgid "https://wordpress.org/support/plugin/%s"
398
  msgstr ""
1
+ # Copyright (C) 2022 Marcin Pietrzak
2
  # This file is distributed under the same license as the Orphans package.
3
  msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Orphans PLUGIN_VERSION\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sierotki\n"
7
+ "POT-Creation-Date: 2022-01-19 16:12:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2022-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.3\n"
209
  msgstr ""
210
 
211
  #: includes/iworks/class-iworks-orphan.php:404
212
+ #: includes/iworks/rate/rate.php:118
213
  msgid "Settings"
214
  msgstr ""
215
 
249
  msgid "Enabled the substitution of orphans in WYSIWYG fields."
250
  msgstr ""
251
 
252
+ #: includes/iworks/options/options.php:251
253
  msgid "An error occurred while getting the configuration."
254
  msgstr ""
255
 
256
+ #: includes/iworks/options/options.php:749
257
  msgid "Upload image"
258
  msgstr ""
259
 
260
+ #: includes/iworks/options/options.php:755
261
  msgid "Delete image"
262
  msgstr ""
263
 
264
+ #: includes/iworks/options/options.php:841
265
  msgid "Save Changes"
266
  msgstr ""
267
 
268
+ #: includes/iworks/options/options.php:1645
269
  msgid "Country"
270
  msgstr ""
271
 
272
+ #: includes/iworks/options/options.php:1646
273
  msgid "City"
274
  msgstr ""
275
 
276
+ #: includes/iworks/options/options.php:1647
277
  msgid "Street"
278
  msgstr ""
279
 
280
+ #: includes/iworks/options/options.php:1648
281
  msgid "ZIP code"
282
  msgstr ""
283
 
284
+ #: includes/iworks/options/options.php:1799
285
  msgid "OFF"
286
  msgstr ""
287
 
288
+ #: includes/iworks/options/options.php:1800
289
  msgid "ON"
290
  msgstr ""
291
 
292
+ #: includes/iworks/rate/rate.php:124
293
  #: includes/iworks/rate/templates/thanks.php:28
294
  msgid "Provide us a coffee"
295
  msgstr ""
387
  msgid "https://wordpress.org/support/plugin/sierotki/"
388
  msgstr ""
389
 
390
+ #: includes/iworks/rate/rate.php:399
391
  msgctxt "plugins home"
392
  msgid "https://wordpress.org/plugins/%s"
393
  msgstr ""
394
 
395
+ #: includes/iworks/rate/rate.php:405
396
  msgctxt "plugins support home"
397
  msgid "https://wordpress.org/support/plugin/%s"
398
  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.1
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
@@ -126,6 +126,10 @@ function remove_iworks_orphan_terms( $terms ) {
126
 
127
  == Changelog ==
128
 
 
 
 
 
129
  = 2.9.1 - 2021-12-09 =
130
  * Added integration with "Advanced Custom Fields" for fields types: "text", "textarea", "WYSIWYG". Props for [Kamil Lipiński](https://profiles.wordpress.org/create24/) for the tests.
131
 
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.2
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
126
 
127
  == Changelog ==
128
 
129
+ = 2.9.2 - 2022-01-20 =
130
+ * Updated iWorks Options to 2.7.3.
131
+ * Updated iWorks Rate to 2.0.6.
132
+
133
  = 2.9.1 - 2021-12-09 =
134
  * Added integration with "Advanced Custom Fields" for fields types: "text", "textarea", "WYSIWYG". Props for [Kamil Lipiński](https://profiles.wordpress.org/create24/) for the tests.
135
 
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.1
9
  Author URI: http://iworks.pl/
10
  */
11
 
@@ -37,11 +37,14 @@ register_deactivation_hook( __FILE__, 'iworks_orphan_deactivate' );
37
  *
38
  */
39
  function get_orphan_options() {
40
- $options = new iworks_options();
41
- $options->set_option_function_name( 'orphang_indicator_options' );
42
- $options->set_option_prefix( 'iworks_orphan_' );
43
- $options->init();
44
- return $options;
 
 
 
45
  }
46
 
47
  /**
@@ -51,8 +54,8 @@ function get_orphan_options() {
51
  *
52
  */
53
  function iworks_orphan_activate() {
54
- $options = get_orphan_options();
55
- $options->activate();
56
  iworks_orphan_change_options_autoload_status( 'yes' );
57
  }
58
 
@@ -79,7 +82,7 @@ function iworks_orphan_change_options_autoload_status( $status ) {
79
  if ( ! preg_match( '/^(yes|no)$/', $status ) ) {
80
  return;
81
  }
82
- $options_keys = array(
83
  'comment_text',
84
  'initialized',
85
  'numbers',
@@ -91,7 +94,7 @@ function iworks_orphan_change_options_autoload_status( $status ) {
91
  'woocommerce_short_description',
92
  );
93
  global $wpdb;
94
- foreach ( $options_keys as $key ) {
95
  $wpdb->update(
96
  $wpdb->options,
97
  array(
5
  Text Domain: sierotki
6
  Description: Implement Polish grammar rules with orphans.
7
  Author: Marcin Pietrzak
8
+ Version: 2.9.2
9
  Author URI: http://iworks.pl/
10
  */
11
 
37
  *
38
  */
39
  function get_orphan_options() {
40
+ $iworks_orphan_options = new iworks_options();
41
+ $iworks_orphan_options->set_option_function_name( 'orphang_indicator_options' );
42
+ $iworks_orphan_options->set_option_prefix( 'iworks_orphan_' );
43
+ if ( method_exists( $iworks_orphan_options, 'set_plugin' ) ) {
44
+ $iworks_orphan_options->set_plugin( basename( __FILE__ ) );
45
+ }
46
+ $iworks_orphan_options->init();
47
+ return $iworks_orphan_options;
48
  }
49
 
50
  /**
54
  *
55
  */
56
  function iworks_orphan_activate() {
57
+ $iworks_orphan_options = get_orphan_options();
58
+ $iworks_orphan_options->activate();
59
  iworks_orphan_change_options_autoload_status( 'yes' );
60
  }
61
 
82
  if ( ! preg_match( '/^(yes|no)$/', $status ) ) {
83
  return;
84
  }
85
+ $iworks_orphan_options_keys = array(
86
  'comment_text',
87
  'initialized',
88
  'numbers',
94
  'woocommerce_short_description',
95
  );
96
  global $wpdb;
97
+ foreach ( $iworks_orphan_options_keys as $key ) {
98
  $wpdb->update(
99
  $wpdb->options,
100
  array(