Version Description
- 2021-01-13 =
- Added
orphan_replace
filter to add ability to force replacements on any string. - Turned off content filters for admin area - it could mess with another plugins. Props for Zbyszek Zalewski.
Download this release
Release Info
Developer | iworks |
Plugin | Orphans |
Version | 2.7.8 |
Comparing to | |
See all releases |
Code changes from version 2.7.7 to 2.7.8
- languages/sierotki.pot +10 -10
- readme.txt +7 -3
- sierotki.php +1 -1
- vendor/iworks/orphan.php +92 -30
languages/sierotki.pot
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
# Copyright (C)
|
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:
|
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:
|
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"
|
@@ -220,35 +220,35 @@ msgstr ""
|
|
220 |
msgid "ON"
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: vendor/iworks/orphan.php:
|
224 |
msgid "Plugin fix some Polish gramary rules with orphans."
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: vendor/iworks/orphan.php:
|
228 |
msgid "For more information:"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: vendor/iworks/orphan.php:
|
232 |
msgid ""
|
233 |
"<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
|
234 |
"target=\"_blank\">Plugin Homepage</a>"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: vendor/iworks/orphan.php:
|
238 |
msgid ""
|
239 |
"<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
|
240 |
"target=\"_blank\">Support Forums</a>"
|
241 |
msgstr ""
|
242 |
|
243 |
-
#: vendor/iworks/orphan.php:
|
244 |
msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: vendor/iworks/orphan.php:
|
248 |
msgid "Settings"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: vendor/iworks/orphan.php:
|
252 |
msgid "Donate"
|
253 |
msgstr ""
|
254 |
|
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-01-13 08:12:53+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"
|
220 |
msgid "ON"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: vendor/iworks/orphan.php:268
|
224 |
msgid "Plugin fix some Polish gramary rules with orphans."
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: vendor/iworks/orphan.php:275
|
228 |
msgid "For more information:"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: vendor/iworks/orphan.php:276
|
232 |
msgid ""
|
233 |
"<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
|
234 |
"target=\"_blank\">Plugin Homepage</a>"
|
235 |
msgstr ""
|
236 |
|
237 |
+
#: vendor/iworks/orphan.php:277
|
238 |
msgid ""
|
239 |
"<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
|
240 |
"target=\"_blank\">Support Forums</a>"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: vendor/iworks/orphan.php:278
|
244 |
msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: vendor/iworks/orphan.php:387
|
248 |
msgid "Settings"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: vendor/iworks/orphan.php:407
|
252 |
msgid "Donate"
|
253 |
msgstr ""
|
254 |
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: iworks
|
3 |
Donate link: https://ko-fi.com/iworks?utm_source=sierotki&utm_medium=readme-donate
|
4 |
Tags: sierotka, sierotki, spójniki, twarda spacja
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 2.7.
|
8 |
|
9 |
Plugin supports some of the grammatical rules of the Polish language.
|
10 |
|
@@ -109,6 +109,10 @@ remove_filter( 'orphan_skip_replacement', '__return_true' );
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
|
|
|
|
|
|
|
|
112 |
= 2.7.7 - 2020-06-20 =
|
113 |
* Added `orphan_skip_replacement` filter to force skip replacements. Check FAQ to know how to use it.
|
114 |
|
2 |
Contributors: iworks
|
3 |
Donate link: https://ko-fi.com/iworks?utm_source=sierotki&utm_medium=readme-donate
|
4 |
Tags: sierotka, sierotki, spójniki, twarda spacja
|
5 |
+
Requires at least: 4.6
|
6 |
+
Tested up to: 5.7
|
7 |
+
Stable tag: 2.7.8
|
8 |
|
9 |
Plugin supports some of the grammatical rules of the Polish language.
|
10 |
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 2.7.8 - 2021-01-13 =
|
113 |
+
* Added `orphan_replace` filter to add ability to force replacements on any string.
|
114 |
+
* Turned off content filters for admin area - it could mess with another plugins. Props for [Zbyszek Zalewski](https://profiles.wordpress.org/zalzy/).
|
115 |
+
|
116 |
= 2.7.7 - 2020-06-20 =
|
117 |
* Added `orphan_skip_replacement` filter to force skip replacements. Check FAQ to know how to use it.
|
118 |
|
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.
|
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.8
|
9 |
Author URI: http://iworks.pl/
|
10 |
*/
|
11 |
|
vendor/iworks/orphan.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright 2011-
|
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
|
@@ -37,15 +37,18 @@ class iworks_orphan {
|
|
37 |
private $meta_keys = null;
|
38 |
|
39 |
public function __construct() {
|
40 |
-
$file = dirname( dirname( dirname( __FILE__ ) ) ) . '/sierotki.php';
|
41 |
/**
|
42 |
-
*
|
43 |
*/
|
44 |
-
$
|
45 |
/**
|
46 |
* options
|
47 |
*/
|
48 |
$this->options = get_orphan_options();
|
|
|
|
|
|
|
|
|
49 |
/**
|
50 |
* actions
|
51 |
*/
|
@@ -53,6 +56,10 @@ class iworks_orphan {
|
|
53 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
54 |
add_action( 'iworks_rate_css', array( $this, 'iworks_rate_css' ) );
|
55 |
add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
|
58 |
/**
|
@@ -64,6 +71,9 @@ class iworks_orphan {
|
|
64 |
load_plugin_textdomain( 'sierotki', false, dirname( $this->plugin_file ) . '/languages' );
|
65 |
}
|
66 |
|
|
|
|
|
|
|
67 |
public function replace( $content ) {
|
68 |
/**
|
69 |
* Filter to allow skip replacement.
|
@@ -127,6 +137,45 @@ class iworks_orphan {
|
|
127 |
return $content;
|
128 |
}
|
129 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
/**
|
131 |
* Keep numbers together - this is independed of current language
|
132 |
*/
|
@@ -146,22 +195,6 @@ class iworks_orphan {
|
|
146 |
}
|
147 |
}
|
148 |
}
|
149 |
-
/**
|
150 |
-
* Allow to ignore language.
|
151 |
-
*
|
152 |
-
* @since 2.6.7
|
153 |
-
*/
|
154 |
-
$all_languages = $this->is_on( 'ignore_language' );
|
155 |
-
$apply_to_all_languages = apply_filters( 'iworks_orphan_apply_to_all_languages', $all_languages );
|
156 |
-
if ( ! $apply_to_all_languages ) {
|
157 |
-
/**
|
158 |
-
* apply other rules only for Polish language
|
159 |
-
*/
|
160 |
-
$locale = apply_filters( 'wpml_current_language', get_locale() );
|
161 |
-
if ( ! preg_match( '/^pl/', $locale ) ) {
|
162 |
-
return $content;
|
163 |
-
}
|
164 |
-
}
|
165 |
$terms = $this->_terms();
|
166 |
/**
|
167 |
* Avoid to replace inside script or styles tags
|
@@ -219,6 +252,9 @@ class iworks_orphan {
|
|
219 |
return $content;
|
220 |
}
|
221 |
|
|
|
|
|
|
|
222 |
public function add_help_tab() {
|
223 |
$screen = get_current_screen();
|
224 |
if ( $screen->id != $this->admin_page ) {
|
@@ -232,15 +268,15 @@ class iworks_orphan {
|
|
232 |
'content' => '<p>' . __( 'Plugin fix some Polish gramary rules with orphans.', 'sierotki' ) . '</p>',
|
233 |
)
|
234 |
);
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
}
|
245 |
|
246 |
/**
|
@@ -255,9 +291,15 @@ class iworks_orphan {
|
|
255 |
}
|
256 |
|
257 |
/**
|
258 |
-
*
|
259 |
*/
|
260 |
public function init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
$this->settings = $this->options->get_all_options();
|
262 |
$allowed_filters = array(
|
263 |
'the_title',
|
@@ -572,4 +614,24 @@ class iworks_orphan {
|
|
572 |
$this->terms = $terms;
|
573 |
return $this->terms;
|
574 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
}
|
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
|
37 |
private $meta_keys = null;
|
38 |
|
39 |
public function __construct() {
|
|
|
40 |
/**
|
41 |
+
* basic settings
|
42 |
*/
|
43 |
+
$file = dirname( dirname( dirname( __FILE__ ) ) ) . '/sierotki.php';
|
44 |
/**
|
45 |
* options
|
46 |
*/
|
47 |
$this->options = get_orphan_options();
|
48 |
+
/**
|
49 |
+
* plugin ID
|
50 |
+
*/
|
51 |
+
$this->plugin_file = plugin_basename( $file );
|
52 |
/**
|
53 |
* actions
|
54 |
*/
|
56 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
57 |
add_action( 'iworks_rate_css', array( $this, 'iworks_rate_css' ) );
|
58 |
add_action( 'plugins_loaded', array( $this, 'load_translation' ) );
|
59 |
+
/**
|
60 |
+
* filters
|
61 |
+
*/
|
62 |
+
add_filter( 'orphan_replace', array( $this, 'orphan_replace_filter' ) );
|
63 |
}
|
64 |
|
65 |
/**
|
71 |
load_plugin_textdomain( 'sierotki', false, dirname( $this->plugin_file ) . '/languages' );
|
72 |
}
|
73 |
|
74 |
+
/**
|
75 |
+
* base replacement function
|
76 |
+
*/
|
77 |
public function replace( $content ) {
|
78 |
/**
|
79 |
* Filter to allow skip replacement.
|
137 |
return $content;
|
138 |
}
|
139 |
}
|
140 |
+
/**
|
141 |
+
* Allow to ignore language.
|
142 |
+
*
|
143 |
+
* @since 2.6.7
|
144 |
+
*/
|
145 |
+
$all_languages = $this->is_on( 'ignore_language' );
|
146 |
+
$apply_to_all_languages = apply_filters( 'iworks_orphan_apply_to_all_languages', $all_languages );
|
147 |
+
if ( ! $apply_to_all_languages ) {
|
148 |
+
/**
|
149 |
+
* apply other rules only for Polish language
|
150 |
+
*/
|
151 |
+
$locale = apply_filters( 'wpml_current_language', get_locale() );
|
152 |
+
if ( ! preg_match( '/^pl/', $locale ) ) {
|
153 |
+
return $content;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
/**
|
157 |
+
* finally just replace!
|
158 |
+
*/
|
159 |
+
return $this->unconditional_replacement( $content );
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Unconditional replacement with super-base check is replacement even
|
164 |
+
* possible.
|
165 |
+
*
|
166 |
+
* @since 2.7.8
|
167 |
+
*
|
168 |
+
* @param string $content String to replace
|
169 |
+
*
|
170 |
+
* @return string $content
|
171 |
+
*/
|
172 |
+
private function unconditional_replacement( $content ) {
|
173 |
+
/**
|
174 |
+
* only super-base check
|
175 |
+
*/
|
176 |
+
if ( ! is_string( $content ) || empty( $content ) ) {
|
177 |
+
return $content;
|
178 |
+
}
|
179 |
/**
|
180 |
* Keep numbers together - this is independed of current language
|
181 |
*/
|
195 |
}
|
196 |
}
|
197 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
$terms = $this->_terms();
|
199 |
/**
|
200 |
* Avoid to replace inside script or styles tags
|
252 |
return $content;
|
253 |
}
|
254 |
|
255 |
+
/**
|
256 |
+
* Add Hlp tab on option page
|
257 |
+
*/
|
258 |
public function add_help_tab() {
|
259 |
$screen = get_current_screen();
|
260 |
if ( $screen->id != $this->admin_page ) {
|
268 |
'content' => '<p>' . __( 'Plugin fix some Polish gramary rules with orphans.', 'sierotki' ) . '</p>',
|
269 |
)
|
270 |
);
|
271 |
+
/**
|
272 |
+
* make sidebar help
|
273 |
+
*/
|
274 |
+
$screen->set_help_sidebar(
|
275 |
+
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
|
276 |
+
'<p>' . __( '<a href="http://wordpress.org/extend/plugins/sierotki/" target="_blank">Plugin Homepage</a>', 'sierotki' ) . '</p>' .
|
277 |
+
'<p>' . __( '<a href="http://wordpress.org/support/plugin/sierotki/" target="_blank">Support Forums</a>', 'sierotki' ) . '</p>' .
|
278 |
+
'<p>' . __( '<a href="http://iworks.pl/en/" target="_blank">break the web</a>', 'sierotki' ) . '</p>'
|
279 |
+
);
|
280 |
}
|
281 |
|
282 |
/**
|
291 |
}
|
292 |
|
293 |
/**
|
294 |
+
* Initialize, but not for admin
|
295 |
*/
|
296 |
public function init() {
|
297 |
+
/**
|
298 |
+
* Turn off all replacements for admin area - we do not need it!
|
299 |
+
*/
|
300 |
+
if ( is_admin() ) {
|
301 |
+
return;
|
302 |
+
}
|
303 |
$this->settings = $this->options->get_all_options();
|
304 |
$allowed_filters = array(
|
305 |
'the_title',
|
614 |
$this->terms = $terms;
|
615 |
return $this->terms;
|
616 |
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Filter to use Orphans on any string
|
620 |
+
*
|
621 |
+
* @since 2.7.8
|
622 |
+
*
|
623 |
+
* @param string $content String to replace
|
624 |
+
*
|
625 |
+
* @return string $content
|
626 |
+
*/
|
627 |
+
public function orphan_replace_filter( $content ) {
|
628 |
+
if ( ! is_string( $content ) ) {
|
629 |
+
return $content;
|
630 |
+
}
|
631 |
+
if ( empty( $content ) ) {
|
632 |
+
return $content;
|
633 |
+
}
|
634 |
+
return $this->unconditional_replacement( $content );
|
635 |
+
}
|
636 |
+
|
637 |
}
|