Orphans - Version 2.7.3

Version Description

  • 2018-03-15 =

  • Fixed problem with $post object. Props for adpawl

  • Fixed space after a number, but before a word. Props for M. Hawranek.

  • Fixed too early translation load, it causes sometimes missing translation.

  • Updated WordPress Options Class to version 2.6.5.

Download this release

Release Info

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

Code changes from version 2.7.2 to 2.7.3

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\n"
7
- "POT-Creation-Date: 2018-02-13 10:38:50+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -180,59 +180,59 @@ msgstr ""
180
  msgid "WordPress Help Forum"
181
  msgstr ""
182
 
183
- #: vendor/iworks/options/options.php:199
184
  msgid "An error occurred while getting the configuration."
185
  msgstr ""
186
 
187
- #: vendor/iworks/options/options.php:692
188
  msgid "Upload image"
189
  msgstr ""
190
 
191
- #: vendor/iworks/options/options.php:698
192
  msgid "Delete image"
193
  msgstr ""
194
 
195
- #: vendor/iworks/options/options.php:766
196
  msgid "Save Changes"
197
  msgstr ""
198
 
199
- #: vendor/iworks/options/options.php:1603
200
  msgid "OFF"
201
  msgstr ""
202
 
203
- #: vendor/iworks/options/options.php:1604
204
  msgid "ON"
205
  msgstr ""
206
 
207
- #: vendor/iworks/orphan.php:200
208
  msgid "Plugin fix some Polish gramary rules with orphans."
209
  msgstr ""
210
 
211
- #: vendor/iworks/orphan.php:206
212
  msgid "For more information:"
213
  msgstr ""
214
 
215
- #: vendor/iworks/orphan.php:207
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:208
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:209
228
  msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
229
  msgstr ""
230
 
231
- #: vendor/iworks/orphan.php:304
232
  msgid "Settings"
233
  msgstr ""
234
 
235
- #: vendor/iworks/orphan.php:324
236
  msgid "Donate"
237
  msgstr ""
238
 
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: 2018-03-15 16:08:58+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
180
  msgid "WordPress Help Forum"
181
  msgstr ""
182
 
183
+ #: vendor/iworks/options/options.php:219
184
  msgid "An error occurred while getting the configuration."
185
  msgstr ""
186
 
187
+ #: vendor/iworks/options/options.php:712
188
  msgid "Upload image"
189
  msgstr ""
190
 
191
+ #: vendor/iworks/options/options.php:718
192
  msgid "Delete image"
193
  msgstr ""
194
 
195
+ #: vendor/iworks/options/options.php:786
196
  msgid "Save Changes"
197
  msgstr ""
198
 
199
+ #: vendor/iworks/options/options.php:1647
200
  msgid "OFF"
201
  msgstr ""
202
 
203
+ #: vendor/iworks/options/options.php:1648
204
  msgid "ON"
205
  msgstr ""
206
 
207
+ #: vendor/iworks/orphan.php:190
208
  msgid "Plugin fix some Polish gramary rules with orphans."
209
  msgstr ""
210
 
211
+ #: vendor/iworks/orphan.php:196
212
  msgid "For more information:"
213
  msgstr ""
214
 
215
+ #: vendor/iworks/orphan.php:197
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:198
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:199
228
  msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
229
  msgstr ""
230
 
231
+ #: vendor/iworks/orphan.php:289
232
  msgid "Settings"
233
  msgstr ""
234
 
235
+ #: vendor/iworks/orphan.php:309
236
  msgid "Donate"
237
  msgstr ""
238
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.9.4
7
- Stable tag: 2.7.2
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
@@ -97,6 +97,13 @@ function my_orphans_capability($capability) {
97
 
98
  == Changelog ==
99
 
 
 
 
 
 
 
 
100
  = 2.7.2 - 2018-02-13 =
101
 
102
  * Added html entities handling.
4
  Tags: sierotka, sierotki, spójniki, twarda spacja
5
  Requires at least: 3.6
6
  Tested up to: 4.9.4
7
+ Stable tag: 2.7.3
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
97
 
98
  == Changelog ==
99
 
100
+ = 2.7.3 - 2018-03-15 =
101
+
102
+ * Fixed problem with $post object. Props for [adpawl](https://wordpress.org/support/users/adpawl/)
103
+ * Fixed space after a number, but before a word. Props for M. Hawranek.
104
+ * Fixed too early translation load, it causes sometimes missing translation.
105
+ * Updated [WordPress Options Class](https://github.com/iworks/wordpress-options-class) to version 2.6.5.
106
+
107
  = 2.7.2 - 2018-02-13 =
108
 
109
  * Added html entities handling.
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.7.2
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.3
9
  Author URI: http://iworks.pl/
10
  */
11
 
vendor/iworks/options/options.php CHANGED
@@ -3,7 +3,7 @@
3
  Class Name: iWorks Options
4
  Class URI: http://iworks.pl/
5
  Description: Option class to manage options.
6
- Version: 2.6.4
7
  Author: Marcin Pietrzak
8
  Author URI: http://iworks.pl/
9
  License: GPLv2 or later
@@ -35,12 +35,19 @@ if ( class_exists( 'iworks_options' ) ) {
35
  }
36
 
37
  class iworks_options {
 
38
  private $option_function_name;
39
  private $option_group;
40
  private $option_prefix;
41
  private $version;
42
  private $pagehooks = array();
43
  private $scripts_enqueued = array();
 
 
 
 
 
 
44
  public $notices;
45
 
46
  public function __construct() {
@@ -48,7 +55,7 @@ class iworks_options {
48
  * basic setup
49
  */
50
  $this->notices = array();
51
- $this->version = '2.6.4';
52
  $this->option_group = 'index';
53
  $this->option_function_name = null;
54
  $this->option_prefix = null;
@@ -70,6 +77,19 @@ class iworks_options {
70
  $this->get_option_array();
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  public function admin_menu() {
74
  $data = $this->get_option_array();
75
  if ( ! isset( $this->options ) ) {
@@ -1279,6 +1299,9 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1279
  return $atts;
1280
  }
1281
 
 
 
 
1282
  private function select( $name, $value = '', $args = array(), $type = 'text' ) {
1283
  /**
1284
  * default value
@@ -1300,7 +1323,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1300
  if ( empty( $options ) && ! empty( $value ) ) {
1301
  $options[ $value['value'] ] = $value['label'];
1302
  }
1303
- $value_to_check = isset( $value['value'] ) ? $value['value'] : false;
1304
  $content = sprintf(
1305
  '<select type="%s" name="%s" %s >',
1306
  esc_attr( $type ),
@@ -1337,12 +1360,28 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1337
  $args['autocomplete'] = 'off';
1338
  }
1339
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1340
  return sprintf(
1341
- '<input type="%s" name="%s" value="%s" %s />',
 
1342
  esc_attr( $type ),
1343
  esc_attr( $name ),
1344
  esc_attr( $value ),
1345
- $this->build_field_attributes( $args )
 
1346
  );
1347
  }
1348
 
@@ -1377,7 +1416,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1377
 
1378
  private function button( $name, $value = '', $args = array() ) {
1379
  return $this->input( $name, $value, $args, __FUNCTION__ );
1380
- }
1381
 
1382
  private function submit( $name, $value = '', $args = array() ) {
1383
  return $this->input( $name, $value, $args, __FUNCTION__ );
@@ -1530,7 +1569,12 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1530
  $files = $this->get_files();
1531
  foreach ( $files as $data ) {
1532
  $file = sprintf( 'assets/%s/%s', $data['style']? 'styles':'scripts', $data['file'] );
1533
- $file = plugins_url( $file, __FILE__ );
 
 
 
 
 
1534
  $version = isset( $data['version'] )? $data['version'] : $this->version;
1535
  $deps = isset( $data['deps'] )? $data['deps'] : array();
1536
  $in_footer = isset( $data['in_footer'] )? $data['in_footer'] : true;
3
  Class Name: iWorks Options
4
  Class URI: http://iworks.pl/
5
  Description: Option class to manage options.
6
+ Version: 2.6.5
7
  Author: Marcin Pietrzak
8
  Author URI: http://iworks.pl/
9
  License: GPLv2 or later
35
  }
36
 
37
  class iworks_options {
38
+
39
  private $option_function_name;
40
  private $option_group;
41
  private $option_prefix;
42
  private $version;
43
  private $pagehooks = array();
44
  private $scripts_enqueued = array();
45
+ /**
46
+ * Controll class mode.
47
+ * @since 2.6.5
48
+ */
49
+ private $mode = 'plugin';
50
+
51
  public $notices;
52
 
53
  public function __construct() {
55
  * basic setup
56
  */
57
  $this->notices = array();
58
+ $this->version = '2.6.5';
59
  $this->option_group = 'index';
60
  $this->option_function_name = null;
61
  $this->option_prefix = null;
77
  $this->get_option_array();
78
  }
79
 
80
+ /**
81
+ * Set option class mode.
82
+ *
83
+ * @since 2.6.5
84
+ *
85
+ * @param string $mode Working mode, possible values "plugin", "theme".
86
+ */
87
+ public function set_mode( $mode ) {
88
+ if ( preg_match( '/^(plugin|theme)$/', $mode ) ) {
89
+ $this->mode = $mode;
90
+ }
91
+ }
92
+
93
  public function admin_menu() {
94
  $data = $this->get_option_array();
95
  if ( ! isset( $this->options ) ) {
1299
  return $atts;
1300
  }
1301
 
1302
+ /**
1303
+ * Print HTML select
1304
+ */
1305
  private function select( $name, $value = '', $args = array(), $type = 'text' ) {
1306
  /**
1307
  * default value
1323
  if ( empty( $options ) && ! empty( $value ) ) {
1324
  $options[ $value['value'] ] = $value['label'];
1325
  }
1326
+ $value_to_check = is_array( $value ) && isset( $value['value'] ) ? $value['value'] : $value;
1327
  $content = sprintf(
1328
  '<select type="%s" name="%s" %s >',
1329
  esc_attr( $type ),
1360
  $args['autocomplete'] = 'off';
1361
  }
1362
  }
1363
+ /**
1364
+ * before & after
1365
+ */
1366
+ $keys = array( 'before', 'after' );
1367
+ foreach ( $keys as $key ) {
1368
+ $$key = '';
1369
+ if ( isset( $args[ $key ] ) ) {
1370
+ $$key = $args[ $key ];
1371
+ unset( $args[ $key ] );
1372
+ }
1373
+ }
1374
+ /**
1375
+ * produce
1376
+ */
1377
  return sprintf(
1378
+ '%s<input type="%s" name="%s" value="%s" %s />%s',
1379
+ $before,
1380
  esc_attr( $type ),
1381
  esc_attr( $name ),
1382
  esc_attr( $value ),
1383
+ $this->build_field_attributes( $args ),
1384
+ $after
1385
  );
1386
  }
1387
 
1416
 
1417
  private function button( $name, $value = '', $args = array() ) {
1418
  return $this->input( $name, $value, $args, __FUNCTION__ );
1419
+ }
1420
 
1421
  private function submit( $name, $value = '', $args = array() ) {
1422
  return $this->input( $name, $value, $args, __FUNCTION__ );
1569
  $files = $this->get_files();
1570
  foreach ( $files as $data ) {
1571
  $file = sprintf( 'assets/%s/%s', $data['style']? 'styles':'scripts', $data['file'] );
1572
+ if ( 'theme' == $this->mode ) {
1573
+ $url = str_replace( get_template_directory(), '', dirname( __FILE__ ) );
1574
+ $file = get_template_directory_uri().$url.'/'.$file;
1575
+ } else {
1576
+ $file = plugins_url( $file, __FILE__ );
1577
+ }
1578
  $version = isset( $data['version'] )? $data['version'] : $this->version;
1579
  $deps = isset( $data['deps'] )? $data['deps'] : array();
1580
  $in_footer = isset( $data['in_footer'] )? $data['in_footer'] : true;
vendor/iworks/orphan.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
 
4
- Copyright 2011-2017 Marcin Pietrzak (marcin@iworks.pl)
5
 
6
  this program is free software; you can redistribute it and/or modify
7
  it under the terms of the GNU General Public License, version 2, as
@@ -43,23 +43,26 @@ class iworks_orphan
43
  * plugin ID
44
  */
45
  $this->plugin_file = plugin_basename( $file );
46
-
47
- /**
48
- * l10n
49
- */
50
- load_plugin_textdomain( 'sierotki', false, dirname( $this->plugin_file ).'/languages' );
51
-
52
  /**
53
  * options
54
  */
55
  $this->options = get_orphan_options();
56
-
57
  /**
58
  * actions
59
  */
60
  add_action( 'init', array( $this, 'init' ) );
61
  add_action( 'admin_init', array( $this, 'admin_init' ) );
62
  add_action( 'iworks_rate_css', array( $this, 'iworks_rate_css' ) );
 
 
 
 
 
 
 
 
 
 
63
  }
64
 
65
  public function replace( $content ) {
@@ -80,13 +83,12 @@ class iworks_orphan
80
  */
81
  $entry_related_filters = array( 'the_title', 'the_excerpt', 'the_content' );
82
  $current_filter = current_filter();
83
-
84
  if ( in_array( $current_filter, $entry_related_filters ) ) {
85
  if ( empty( $this->settings['post_type'] ) || ! is_array( $this->settings['post_type'] ) ) {
86
  return $content;
87
  }
88
  global $post;
89
- if ( ! in_array( $post->post_type, $this->settings['post_type'] ) ) {
90
  return $content;
91
  }
92
  }
@@ -102,17 +104,15 @@ class iworks_orphan
102
  return $content;
103
  }
104
  }
105
-
106
  /**
107
  * Keep numbers together - this is independed of current language
108
  */
109
  $numbers = $this->is_on( 'numbers' );
110
  if ( $numbers ) {
111
- while ( preg_match( '/(\d) (\d)/', $content ) ) {
112
- $content = preg_replace( '/(\d) (\d)/', '$1&nbsp;$2', $content );
113
  }
114
  }
115
-
116
  /**
117
  * Allow to ignore language.
118
  *
@@ -129,9 +129,7 @@ class iworks_orphan
129
  return $content;
130
  }
131
  }
132
-
133
  $terms = $this->_terms();
134
-
135
  /**
136
  * Avoid to replace inside script or styles tags
137
  */
@@ -146,12 +144,10 @@ class iworks_orphan
146
  $content = preg_replace( $re, $key, $content );
147
  }
148
  }
149
-
150
  /**
151
  * base therms replace
152
  */
153
  $re = '/^([aiouwz]|'.preg_replace( '/\./', '\.', implode( '|', $terms ) ).') +/i';
154
-
155
  $content = preg_replace( $re, '$1$2&nbsp;', $content );
156
  /**
157
  * single letters
@@ -167,11 +163,6 @@ class iworks_orphan
167
  */
168
  $re = '/(&nbsp;)([aiouwz]) +/i';
169
  $content = preg_replace( $re, '$1$2&nbsp;', $content );
170
- /**
171
- * polish year after number
172
- */
173
- $content = preg_replace( '/(\d+) (r\.)/', '$1&nbsp;$2', $content );
174
-
175
  /**
176
  * bring back styles & scripts
177
  */
@@ -181,7 +172,6 @@ class iworks_orphan
181
  $content = preg_replace( $re, $one, $content );
182
  }
183
  }
184
-
185
  /**
186
  * return
187
  */
@@ -208,7 +198,6 @@ class iworks_orphan
208
  '<p>' . __( '<a href="http://wordpress.org/support/plugin/sierotki/" target="_blank">Support Forums</a>', 'sierotki' ) . '</p>' .
209
  '<p>' . __( '<a href="http://iworks.pl/en/" target="_blank">break the web</a>', 'sierotki' ) . '</p>'
210
  );
211
-
212
  }
213
 
214
  public function admin_init() {
@@ -245,7 +234,6 @@ class iworks_orphan
245
  }
246
  }
247
  }
248
-
249
  /**
250
  * taxonomies
251
  */
@@ -258,9 +246,7 @@ class iworks_orphan
258
  add_filter( 'single_tag_title', array( $this, 'replace' ) );
259
  }
260
  }
261
-
262
  add_filter( 'iworks_orphan_replace', array( $this, 'replace' ) );
263
-
264
  /**
265
  * Filter post meta.
266
  *
@@ -281,7 +267,6 @@ class iworks_orphan
281
  echo '</style>';
282
  }
283
 
284
-
285
  private function is_on( $key ) {
286
  return isset( $this->settings[ $key ] ) && 1 === $this->settings[ $key ];
287
  }
1
  <?php
2
  /*
3
 
4
+ Copyright 2011-2018 Marcin Pietrzak (marcin@iworks.pl)
5
 
6
  this program is free software; you can redistribute it and/or modify
7
  it under the terms of the GNU General Public License, version 2, as
43
  * plugin ID
44
  */
45
  $this->plugin_file = plugin_basename( $file );
 
 
 
 
 
 
46
  /**
47
  * options
48
  */
49
  $this->options = get_orphan_options();
 
50
  /**
51
  * actions
52
  */
53
  add_action( 'init', array( $this, 'init' ) );
54
  add_action( 'admin_init', array( $this, 'admin_init' ) );
55
  add_action( 'iworks_rate_css', array( $this, 'iworks_rate_css' ) );
56
+ add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
57
+ }
58
+
59
+ /**
60
+ * Load Translation
61
+ *
62
+ * @since 2.7.3
63
+ */
64
+ public function load_translation() {
65
+ load_plugin_textdomain( 'sierotki', false, dirname( $this->plugin_file ).'/languages' );
66
  }
67
 
68
  public function replace( $content ) {
83
  */
84
  $entry_related_filters = array( 'the_title', 'the_excerpt', 'the_content' );
85
  $current_filter = current_filter();
 
86
  if ( in_array( $current_filter, $entry_related_filters ) ) {
87
  if ( empty( $this->settings['post_type'] ) || ! is_array( $this->settings['post_type'] ) ) {
88
  return $content;
89
  }
90
  global $post;
91
+ if ( is_a( $post, 'WP_Post' ) && ! in_array( $post->post_type, $this->settings['post_type'] ) ) {
92
  return $content;
93
  }
94
  }
104
  return $content;
105
  }
106
  }
 
107
  /**
108
  * Keep numbers together - this is independed of current language
109
  */
110
  $numbers = $this->is_on( 'numbers' );
111
  if ( $numbers ) {
112
+ while ( preg_match( '/(\d+) ([\da-z]+)/i', $content, $matches ) ) {
113
+ $content = preg_replace( '/(\d+) ([\da-z]+)/i', '$1&nbsp;$2', $content );
114
  }
115
  }
 
116
  /**
117
  * Allow to ignore language.
118
  *
129
  return $content;
130
  }
131
  }
 
132
  $terms = $this->_terms();
 
133
  /**
134
  * Avoid to replace inside script or styles tags
135
  */
144
  $content = preg_replace( $re, $key, $content );
145
  }
146
  }
 
147
  /**
148
  * base therms replace
149
  */
150
  $re = '/^([aiouwz]|'.preg_replace( '/\./', '\.', implode( '|', $terms ) ).') +/i';
 
151
  $content = preg_replace( $re, '$1$2&nbsp;', $content );
152
  /**
153
  * single letters
163
  */
164
  $re = '/(&nbsp;)([aiouwz]) +/i';
165
  $content = preg_replace( $re, '$1$2&nbsp;', $content );
 
 
 
 
 
166
  /**
167
  * bring back styles & scripts
168
  */
172
  $content = preg_replace( $re, $one, $content );
173
  }
174
  }
 
175
  /**
176
  * return
177
  */
198
  '<p>' . __( '<a href="http://wordpress.org/support/plugin/sierotki/" target="_blank">Support Forums</a>', 'sierotki' ) . '</p>' .
199
  '<p>' . __( '<a href="http://iworks.pl/en/" target="_blank">break the web</a>', 'sierotki' ) . '</p>'
200
  );
 
201
  }
202
 
203
  public function admin_init() {
234
  }
235
  }
236
  }
 
237
  /**
238
  * taxonomies
239
  */
246
  add_filter( 'single_tag_title', array( $this, 'replace' ) );
247
  }
248
  }
 
249
  add_filter( 'iworks_orphan_replace', array( $this, 'replace' ) );
 
250
  /**
251
  * Filter post meta.
252
  *
267
  echo '</style>';
268
  }
269
 
 
270
  private function is_on( $key ) {
271
  return isset( $this->settings[ $key ] ) && 1 === $this->settings[ $key ];
272
  }