Orphans - Version 2.7.0

Version Description

  • 2017-06-29 =

  • Added custom fields - now you can easily add custom field name to the configuration.

  • Added words: 'albo', 'bez', 'czy', 'lecz', 'nie', 'niech', 'przez', 'tak', 'tylko', 'wic' base on Sierotka

Download this release

Release Info

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

Code changes from version 2.6.9 to 2.7.0

etc/options.php CHANGED
@@ -168,6 +168,15 @@ function orphang_indicator_options() {
168
  'classes' => array( 'large-text' ),
169
  'rows' => 10,
170
  ),
 
 
 
 
 
 
 
 
 
171
  ),
172
  'metaboxes' => array(
173
  'loved_this_plugin' => array(
168
  'classes' => array( 'large-text' ),
169
  'rows' => 10,
170
  ),
171
+ array(
172
+ 'name' => 'post_meta',
173
+ 'th' => __( 'Entries custom fields', 'sierotki' ),
174
+ 'type' => 'textarea',
175
+ 'description' => __( 'Use a comma to separate custom fields name.', 'sierotki' ),
176
+ 'sanitize_callback' => 'esc_html',
177
+ 'classes' => array( 'large-text' ),
178
+ 'rows' => 10,
179
+ ),
180
  ),
181
  'metaboxes' => array(
182
  'loved_this_plugin' => array(
languages/sierotki.pot ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2017 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: 2017-06-29 10:13: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"
11
+ "PO-Revision-Date: 2017-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"
15
+ "X-Poedit-KeywordsList: "
16
+ "__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
17
+ "attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
18
+ "Language: en\n"
19
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
+ "X-Poedit-Country: United States\n"
21
+ "X-Poedit-SourceCharset: UTF-8\n"
22
+ "X-Poedit-Basepath: ../\n"
23
+ "X-Poedit-SearchPath-0: .\n"
24
+ "X-Poedit-Bookmarks: \n"
25
+ "X-Textdomain-Support: yes\n"
26
+
27
+ #: etc/options.php:11
28
+ msgid "Orphans configuration"
29
+ msgstr ""
30
+
31
+ #. Plugin Name of the plugin/theme
32
+ msgid "Orphans"
33
+ msgstr ""
34
+
35
+ #: etc/options.php:19
36
+ msgid "Entries"
37
+ msgstr ""
38
+
39
+ #: etc/options.php:27
40
+ msgid "Post types"
41
+ msgstr ""
42
+
43
+ #: etc/options.php:34 etc/options.php:113
44
+ msgid "Title"
45
+ msgstr ""
46
+
47
+ #: etc/options.php:36
48
+ msgid "Enabled the substitution of orphans in the post_title."
49
+ msgstr ""
50
+
51
+ #: etc/options.php:43
52
+ msgid "Excerpt"
53
+ msgstr ""
54
+
55
+ #: etc/options.php:45
56
+ msgid "Enabled the substitution of orphans in the excerpt."
57
+ msgstr ""
58
+
59
+ #: etc/options.php:52
60
+ msgid "Content"
61
+ msgstr ""
62
+
63
+ #: etc/options.php:54
64
+ msgid "Enabled the substitution of orphans in the content."
65
+ msgstr ""
66
+
67
+ #: etc/options.php:62
68
+ msgid "Comments"
69
+ msgstr ""
70
+
71
+ #: etc/options.php:63
72
+ msgid "Enabled the substitution of orphans in the comments."
73
+ msgstr ""
74
+
75
+ #: etc/options.php:70
76
+ msgid "Widgets"
77
+ msgstr ""
78
+
79
+ #: etc/options.php:77
80
+ msgid "Widget title"
81
+ msgstr ""
82
+
83
+ #: etc/options.php:79
84
+ msgid "Enabled the substitution of orphans in the widget title."
85
+ msgstr ""
86
+
87
+ #: etc/options.php:89
88
+ msgid "Widget text"
89
+ msgstr ""
90
+
91
+ #: etc/options.php:91
92
+ msgid "Enabled the substitution of orphans in the widget text."
93
+ msgstr ""
94
+
95
+ #: etc/options.php:101 etc/options.php:106
96
+ msgid "Taxonomies"
97
+ msgstr ""
98
+
99
+ #: etc/options.php:115
100
+ msgid "Enabled the substitution of orphans in the taxonomy title."
101
+ msgstr ""
102
+
103
+ #: etc/options.php:122
104
+ msgid "Description"
105
+ msgstr ""
106
+
107
+ #: etc/options.php:124
108
+ msgid "Enabled the substitution of orphans in the taxonomy description."
109
+ msgstr ""
110
+
111
+ #: etc/options.php:131
112
+ msgid "Miscellaneous"
113
+ msgstr ""
114
+
115
+ #: etc/options.php:139
116
+ msgid "Author description"
117
+ msgstr ""
118
+
119
+ #: etc/options.php:140
120
+ msgid "Enabled the substitution of orphans in the author description."
121
+ msgstr ""
122
+
123
+ #: etc/options.php:147
124
+ msgid "Ignore language"
125
+ msgstr ""
126
+
127
+ #: etc/options.php:149
128
+ msgid "Allow to use plugin with another languages then Polish."
129
+ msgstr ""
130
+
131
+ #: etc/options.php:156
132
+ msgid "Keep numbers together"
133
+ msgstr ""
134
+
135
+ #: etc/options.php:158
136
+ msgid "Allow to keep together phone number or strings with space between numbers."
137
+ msgstr ""
138
+
139
+ #: etc/options.php:164
140
+ msgid "User definied orphans"
141
+ msgstr ""
142
+
143
+ #: etc/options.php:166
144
+ msgid "Use a comma to separate orphans."
145
+ msgstr ""
146
+
147
+ #: etc/options.php:173
148
+ msgid "Entries custom fields"
149
+ msgstr ""
150
+
151
+ #: etc/options.php:175
152
+ msgid "Use a comma to separate custom fields name."
153
+ msgstr ""
154
+
155
+ #: etc/options.php:183
156
+ msgid "Loved this Plugin?"
157
+ msgstr ""
158
+
159
+ #: etc/options.php:189
160
+ msgid "Need Assistance?"
161
+ msgstr ""
162
+
163
+ #: etc/options.php:202
164
+ msgid "Below are some links to help spread this plugin to other users"
165
+ msgstr ""
166
+
167
+ #: etc/options.php:204
168
+ msgid "Give it a five stars on WordPress.org"
169
+ msgstr ""
170
+
171
+ #: etc/options.php:205
172
+ msgid "Link to it so others can easily find it"
173
+ msgstr ""
174
+
175
+ #: etc/options.php:233
176
+ msgid "Problems? The links bellow can be very helpful to you"
177
+ msgstr ""
178
+
179
+ #: etc/options.php:235
180
+ msgid "WordPress Help Forum"
181
+ msgstr ""
182
+
183
+ #: vendor/iworks/options/options.php:196
184
+ msgid "An error occurred while getting the configuration."
185
+ msgstr ""
186
+
187
+ #: vendor/iworks/options/options.php:689
188
+ msgid "Upload image"
189
+ msgstr ""
190
+
191
+ #: vendor/iworks/options/options.php:695
192
+ msgid "Delete image"
193
+ msgstr ""
194
+
195
+ #: vendor/iworks/options/options.php:763
196
+ msgid "Save Changes"
197
+ msgstr ""
198
+
199
+ #: vendor/iworks/options/options.php:1547
200
+ msgid "OFF"
201
+ msgstr ""
202
+
203
+ #: vendor/iworks/options/options.php:1548
204
+ msgid "ON"
205
+ msgstr ""
206
+
207
+ #: vendor/iworks/orphan.php:313
208
+ msgid "Plugin fix some Polish gramary rules with orphans."
209
+ msgstr ""
210
+
211
+ #: vendor/iworks/orphan.php:319
212
+ msgid "For more information:"
213
+ msgstr ""
214
+
215
+ #: vendor/iworks/orphan.php:320
216
+ msgid ""
217
+ "<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
218
+ "target=\"_blank\">Plugin Homepage</a>"
219
+ msgstr ""
220
+
221
+ #: vendor/iworks/orphan.php:321
222
+ msgid ""
223
+ "<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
224
+ "target=\"_blank\">Support Forums</a>"
225
+ msgstr ""
226
+
227
+ #: vendor/iworks/orphan.php:322
228
+ msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
229
+ msgstr ""
230
+
231
+ #: vendor/iworks/orphan.php:411
232
+ msgid "Settings"
233
+ msgstr ""
234
+
235
+ #: vendor/iworks/orphan.php:431
236
+ msgid "Donate"
237
+ msgstr ""
238
+
239
+ #: vendor/iworks/rate/rate.php:365
240
+ msgid ""
241
+ "Hey %s, you've been using %s for a while now, and we hope you're happy with "
242
+ "it."
243
+ msgstr ""
244
+
245
+ #: vendor/iworks/rate/rate.php:365
246
+ msgid ""
247
+ "We've spent countless hours developing this free plugin for you, and we "
248
+ "would really appreciate it if you dropped us a quick rating!"
249
+ msgstr ""
250
+
251
+ #: vendor/iworks/rate/rate.php:380
252
+ msgid "Thanks :)"
253
+ msgstr ""
254
+
255
+ #: vendor/iworks/rate/rate.php:383
256
+ msgid "Rate %s"
257
+ msgstr ""
258
+
259
+ #: vendor/iworks/rate/rate.php:387
260
+ msgid "Saving"
261
+ msgstr ""
262
+
263
+ #: vendor/iworks/rate/rate.php:388
264
+ msgid "No thanks"
265
+ msgstr ""
266
+
267
+ #. Plugin URI of the plugin/theme
268
+ msgid "http://iworks.pl/2011/02/16/sierotki/"
269
+ msgstr ""
270
+
271
+ #. Description of the plugin/theme
272
+ msgid "Implement Polish grammar rules with orphans."
273
+ msgstr ""
274
+
275
+ #. Author of the plugin/theme
276
+ msgid "Marcin Pietrzak"
277
+ msgstr ""
278
+
279
+ #. Author URI of the plugin/theme
280
+ msgid "http://iworks.pl/"
281
+ msgstr ""
282
+
283
+ #: etc/options.php:205
284
+ msgctxt "plugin home page on WordPress.org"
285
+ msgid "https://wordpress.org/plugins/sierotki/"
286
+ msgstr ""
287
+
288
+ #: etc/options.php:235
289
+ msgctxt "link to support forum on WordPress.org"
290
+ msgid "https://wordpress.org/support/plugin/sierotki/"
291
+ msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: iworks
3
  Donate link: http://iworks.pl/donate/sierotki.php
4
  Tags: sierotka, sierotki, spójniki, twarda spacja
5
  Requires at least: 3.6
6
- Tested up to: 4.7.5
7
- Stable tag: 2.6.9
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
@@ -61,8 +61,10 @@ Plugin works when viewing the content and does not modify your content.
61
  Use this code:
62
 
63
  `
64
- $orphan = new iworks_orphan();
65
- echo $orphan->replace( get_post_meta($post_id, 'meta_key', true ) );
 
 
66
  `
67
 
68
  = How to use this plugin on any string? =
@@ -70,8 +72,10 @@ echo $orphan->replace( get_post_meta($post_id, 'meta_key', true ) );
70
  Use this code:
71
 
72
  `
73
- $orphan = new iworks_orphan();
74
- echo $orphan->replace( 'any_string' );
 
 
75
  `
76
 
77
  = How to change plugin capability? =
@@ -86,11 +90,18 @@ function my_orphans_capability($capability) {
86
  `
87
  == Screenshots ==
88
 
89
- 1. Orphan Options (Polish).
90
- 1. Orphan Options
 
 
91
 
92
  == Changelog ==
93
 
 
 
 
 
 
94
  = 2.6.9 - 2017-05-24 =
95
 
96
  * Fixed a problem with class declaration. Props for [gierand](https://wordpress.org/support/users/gierand/)
3
  Donate link: http://iworks.pl/donate/sierotki.php
4
  Tags: sierotka, sierotki, spójniki, twarda spacja
5
  Requires at least: 3.6
6
+ Tested up to: 4.8.0
7
+ Stable tag: 2.7.0
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
61
  Use this code:
62
 
63
  `
64
+ if ( class_exists( 'iworks_orphan' ) {
65
+ $orphan = new iworks_orphan();
66
+ echo $orphan->replace( get_post_meta($post_id, 'meta_key', true ) );
67
+ }
68
  `
69
 
70
  = How to use this plugin on any string? =
72
  Use this code:
73
 
74
  `
75
+ if ( class_exists( 'iworks_orphan' ) {
76
+ $orphan = new iworks_orphan();
77
+ echo $orphan->replace( 'any_string' );
78
+ }
79
  `
80
 
81
  = How to change plugin capability? =
90
  `
91
  == Screenshots ==
92
 
93
+ 1. Options for entries.
94
+ 1. Options for widgets.
95
+ 1. Options for taxonomies.
96
+ 1. Miscellaneous options.
97
 
98
  == Changelog ==
99
 
100
+ = 2.7.0 - 2017-06-29 =
101
+
102
+ * Added custom fields - now you can easily add custom field name to the configuration.
103
+ * Added words: 'albo', 'bez', 'czy', 'lecz', 'nie', 'niech', 'przez', 'tak', 'tylko', 'więc' base on [Sierotka](https://pl.wikipedia.org/wiki/Sierotka_(typografia))
104
+
105
  = 2.6.9 - 2017-05-24 =
106
 
107
  * Fixed a problem with class declaration. Props for [gierand](https://wordpress.org/support/users/gierand/)
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.6.9
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.7.0
9
  Author URI: http://iworks.pl/
10
  */
11
 
vendor/iworks/orphan.php CHANGED
@@ -25,6 +25,13 @@ class iworks_orphan
25
  private $settings;
26
  private $plugin_file;
27
 
 
 
 
 
 
 
 
28
  public function __construct() {
29
  $file = dirname( dirname( dirname( __FILE__ ) ) ).'/sierotki.php';
30
  /**
@@ -120,9 +127,11 @@ class iworks_orphan
120
 
121
  $terms = array(
122
  'al.',
 
123
  'ale',
124
  'ależ',
125
  'b.',
 
126
  'bm.',
127
  'bp',
128
  'br.',
@@ -132,6 +141,7 @@ class iworks_orphan
132
  'bł.',
133
  'cyt.',
134
  'cz.',
 
135
  'czyt.',
136
  'dn.',
137
  'do',
@@ -161,6 +171,7 @@ class iworks_orphan
161
  'których',
162
  'którym',
163
  'którzy',
 
164
  'lic.',
165
  'm.in.',
166
  'max',
@@ -175,6 +186,8 @@ class iworks_orphan
175
  'mój',
176
  'na',
177
  'nad',
 
 
178
  'np.',
179
  'nr',
180
  'nr.',
@@ -201,9 +214,11 @@ class iworks_orphan
201
  'pot.',
202
  'prof.',
203
  'przed',
 
204
  'pt.',
205
  'pw.',
206
  'pw.',
 
207
  'tamtej',
208
  'tamto',
209
  'tej',
@@ -216,10 +231,12 @@ class iworks_orphan
216
  'twojej',
217
  'twych',
218
  'twój',
 
219
  'ul.',
220
  'we',
221
  'wg',
222
  'woj.',
 
223
  'za',
224
  'ze',
225
  'śp.',
@@ -350,6 +367,13 @@ class iworks_orphan
350
  }
351
 
352
  add_filter( 'iworks_orphan_replace', array( $this, 'replace' ) );
 
 
 
 
 
 
 
353
  }
354
 
355
  /**
@@ -409,4 +433,48 @@ class iworks_orphan
409
 
410
  return $plugin_meta;
411
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  }
25
  private $settings;
26
  private $plugin_file;
27
 
28
+ /**
29
+ * Filter post meta.
30
+ *
31
+ * @since 2.7.0
32
+ */
33
+ private $meta_keys = null;
34
+
35
  public function __construct() {
36
  $file = dirname( dirname( dirname( __FILE__ ) ) ).'/sierotki.php';
37
  /**
127
 
128
  $terms = array(
129
  'al.',
130
+ 'albo',
131
  'ale',
132
  'ależ',
133
  'b.',
134
+ 'bez',
135
  'bm.',
136
  'bp',
137
  'br.',
141
  'bł.',
142
  'cyt.',
143
  'cz.',
144
+ 'czy',
145
  'czyt.',
146
  'dn.',
147
  'do',
171
  'których',
172
  'którym',
173
  'którzy',
174
+ 'lecz',
175
  'lic.',
176
  'm.in.',
177
  'max',
186
  'mój',
187
  'na',
188
  'nad',
189
+ 'nie',
190
+ 'niech',
191
  'np.',
192
  'nr',
193
  'nr.',
214
  'pot.',
215
  'prof.',
216
  'przed',
217
+ 'przez',
218
  'pt.',
219
  'pw.',
220
  'pw.',
221
+ 'tak',
222
  'tamtej',
223
  'tamto',
224
  'tej',
231
  'twojej',
232
  'twych',
233
  'twój',
234
+ 'tylko',
235
  'ul.',
236
  'we',
237
  'wg',
238
  'woj.',
239
+ 'więc',
240
  'za',
241
  'ze',
242
  'śp.',
367
  }
368
 
369
  add_filter( 'iworks_orphan_replace', array( $this, 'replace' ) );
370
+
371
+ /**
372
+ * Filter post meta.
373
+ *
374
+ * @since 2.7.0
375
+ */
376
+ add_filter( 'get_post_metadata', array( $this, 'filter_post_meta' ), 10, 4 );
377
  }
378
 
379
  /**
433
 
434
  return $plugin_meta;
435
  }
436
+
437
+ /**
438
+ * Replace orphans in custom fields.
439
+ *
440
+ * @since 2.7.0
441
+ *
442
+ * @param null|bool $check Whether to allow adding metadata for the given type.
443
+ * @param int $object_id Object ID.
444
+ * @param string $meta_key Meta key.
445
+ * @param mixed $meta_value Meta value. Must be serializable if non-scalar.
446
+ * @param bool $unique Whether the specified meta key should be unique
447
+ * for the object. Optional. Default false.
448
+ * @return null|bool|string $value Post meta value with orphans rules.
449
+ */
450
+ public function filter_post_meta( $check, $object_id, $meta_key, $unique ) {
451
+ if ( ! $unique ) {
452
+ return $check;
453
+ }
454
+ if ( false === $this->meta_keys ) {
455
+ return $check;
456
+ }
457
+ if ( null === $this->meta_keys ) {
458
+ $value = $this->options->get_option( 'post_meta' );
459
+ if ( empty( $value ) || ! is_string( $value ) ) {
460
+ return $check;
461
+ }
462
+ $value = explode( ',', trim( $value ) );
463
+ $this->meta_keys = array_map( 'trim', $value );
464
+ }
465
+ if ( empty( $this->meta_keys ) ) {
466
+ $this->meta_keys = false;
467
+ return $check;
468
+ }
469
+ if ( ! in_array( $meta_key, $this->meta_keys ) ) {
470
+ return $check;
471
+ }
472
+ remove_filter( 'get_post_metadata', array( $this, 'filter_post_meta' ), 10, 4 );
473
+ $value = get_post_meta( $object_id, $meta_key, true );
474
+ add_filter( 'get_post_metadata', array( $this, 'filter_post_meta' ), 10, 4 );
475
+ if ( ! empty( $value ) ) {
476
+ return $this->replace( $value );
477
+ }
478
+ return $check;
479
+ }
480
  }