Orphans - Version 2.7.2

Version Description

  • 2018-02-13 =

  • Added html entities handling.

  • Added WooCommerce short description, which use they own filter.

  • Fixed problem with orphan directly after orphan.

  • Refactored input data.

  • Updated WordPress Options Class to version 2.6.4.

Download this release

Release Info

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

Code changes from version 2.7.1 to 2.7.2

languages/sierotki.pot CHANGED
@@ -1,14 +1,14 @@
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-09-08 21:14: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: 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"
@@ -180,59 +180,59 @@ msgstr ""
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
 
1
+ # Copyright (C) 2018 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: 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"
11
+ "PO-Revision-Date: 2018-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"
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
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: iworks
3
  Donate link: http://iworks.pl/donate/sierotki.php
4
  Tags: sierotka, sierotki, spójniki, twarda spacja
5
- Requires at least: 4.3
6
- Tested up to: 4.9
7
- Stable tag: 2.7.1
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
@@ -97,7 +97,15 @@ function my_orphans_capability($capability) {
97
 
98
  == Changelog ==
99
 
100
- = 2.7.1 - 2017-09-08 =
 
 
 
 
 
 
 
 
101
 
102
  * Fixed a problem with array handling, when document contains scripts or styles.
103
 
2
  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.9.4
7
+ Stable tag: 2.7.2
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
97
 
98
  == Changelog ==
99
 
100
+ = 2.7.2 - 2018-02-13 =
101
+
102
+ * Added html entities handling.
103
+ * Added WooCommerce short description, which use they own filter.
104
+ * Fixed problem with orphan directly after orphan.
105
+ * Refactored input data.
106
+ * Updated [WordPress Options Class](https://github.com/iworks/wordpress-options-class) to version 2.6.4.
107
+
108
+ = 2.7.1 - 2017-12-22 =
109
 
110
  * Fixed a problem with array handling, when document contains scripts or styles.
111
 
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.1
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.2
9
  Author URI: http://iworks.pl/
10
  */
11
 
vendor/iworks/options/assets/scripts/common.js CHANGED
@@ -4,11 +4,11 @@ jQuery(function(){
4
  * Switch button
5
  */
6
  if ( jQuery.fn.switchButton ) {
7
- jQuery('.iworks_options .switch-button').each(function() {
8
  var options = {
9
  checked: jQuery(this).checked,
10
- on_label: switch_button.labels.on_label,
11
- off_label: switch_button.labels.off_label
12
  };
13
  jQuery(this).switchButton(options);
14
  });
4
  * Switch button
5
  */
6
  if ( jQuery.fn.switchButton ) {
7
+ jQuery('.iworks_options .switch-button, .iworks-options-switch-button').each(function() {
8
  var options = {
9
  checked: jQuery(this).checked,
10
+ on_label: jQuery(this).data('on_label') || switch_button.labels.on_label,
11
+ off_label: jQuery(this).data('off_label') || switch_button.labels.off_label
12
  };
13
  jQuery(this).switchButton(options);
14
  });
vendor/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.6.2
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-2017 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
@@ -48,7 +48,7 @@ class iworks_options {
48
  * basic setup
49
  */
50
  $this->notices = array();
51
- $this->version = '2.6.2';
52
  $this->option_group = 'index';
53
  $this->option_function_name = null;
54
  $this->option_prefix = null;
@@ -78,7 +78,7 @@ class iworks_options {
78
  $pages = array();
79
  $pages['index'] = $data;
80
  if ( isset( $data['pages'] ) ) {
81
- $pages += $data['pages'];
82
  }
83
  foreach ( $pages as $key => $data ) {
84
  $keys_to_sanitize = array( 'menu', 'parent' );
@@ -96,6 +96,9 @@ class iworks_options {
96
  if ( isset( $data['show_page_callback'] ) && is_callable( $data['show_page_callback'] ) ) {
97
  $callback = $data['show_page_callback'];
98
  }
 
 
 
99
  /**
100
  * add submenu
101
  */
@@ -103,8 +106,8 @@ class iworks_options {
103
  $data['parent'],
104
  $data['page_title'],
105
  isset( $data['menu_title'] )? $data['menu_title']:$data['page_title'],
106
- apply_filters( 'iworks_options_capagility', 'manage_options', 'settings' ),
107
- $this->get_option_name( $key ),
108
  $callback
109
  );
110
  add_action( 'load-'.$this->pagehooks[ $key ], array( $this, 'load_page' ) );
@@ -196,7 +199,6 @@ class iworks_options {
196
  echo '<div class="below-h2 error"><p><strong>'.__( 'An error occurred while getting the configuration.', 'sierotki' ).'</strong></p></div>';
197
  return;
198
  }
199
-
200
  /**
201
  * proceder
202
  */
@@ -371,13 +373,11 @@ class iworks_options {
371
  }
372
  $html_element_name = $option_name? $this->option_prefix.$option_name:'';
373
  $filter_name = $html_element_name? $option_group.'_'.$html_element_name : null;
374
-
375
  /**
376
  * classes
377
  */
378
  $classes = isset( $option['classes'] )? $option['classes'] : ( isset( $option['class'] )? explode( ' ', $option['class'] ) : array() );
379
  $classes[] = sprintf( 'option-%s', $option['type'] );
380
-
381
  /**
382
  * build
383
  */
@@ -401,7 +401,6 @@ class iworks_options {
401
  if ( isset( $option['use_name_as_id'] ) && $option['use_name_as_id'] ) {
402
  $args['id'] = sprintf( ' id="%s"', $html_element_name );
403
  }
404
-
405
  $content .= sprintf(
406
  '<input type="%s" name="%s" value="%s" class="%s" %s /> %s',
407
  $option['type'],
@@ -553,12 +552,17 @@ class iworks_options {
553
  $name_sufix = '[]';
554
  }
555
  }
 
 
 
 
 
 
556
  $option_value = $this->get_option( $option_name, $option_group );
557
  if ( isset( $option['extra_options'] ) && is_callable( $option['extra_options'] ) ) {
558
  $option['options'] = array_merge( $option['options'], $option['extra_options']() );
559
  }
560
  $option['options'] = apply_filters( $filter_name.'_data', $option['options'], $option_name, $option_value );
561
-
562
  $select = apply_filters( $filter_name.'_content', null, $option['options'], $html_element_name, $option_name, $option_value );
563
  $select = apply_filters( 'iworks_options_'.$option_name.'_content', null, $option['options'], $html_element_name, $option_name, $option_value );
564
  if ( empty( $select ) ) {
@@ -578,7 +582,6 @@ class iworks_options {
578
  } else {
579
  $selected = ($option_value == $key or ( empty( $option_value ) and isset( $option['default'] ) and $key == $option['default'] ) );
580
  }
581
-
582
  $select .= sprintf(
583
  '<option %s value="%s" %s %s >%s</option>',
584
  $disabled? 'class="disabled"':'',
@@ -607,7 +610,7 @@ class iworks_options {
607
  $value = ( ! $value && isset( $option['default'] ))? $option['default']:$value;
608
  $args = array(
609
  'rows' => isset( $option['rows'] )? $option['rows']:3,
610
- 'class' => implode( ' ', $option['classes'] ),
611
  );
612
  $content .= $this->textarea( $html_element_name, $value, $args );
613
  break;
@@ -762,12 +765,10 @@ class iworks_options {
762
  if ( $options['show_submit_button'] ) {
763
  $content .= get_submit_button( __( 'Save Changes' ), 'primary', 'submit_button' );
764
  }
765
-
766
  /**
767
  * iworks-options wrapper
768
  */
769
  $content = sprintf( '<div class="iworks-options">%s</div>', $content );
770
-
771
  /* print ? */
772
  if ( $echo ) {
773
  echo $content;
@@ -926,7 +927,6 @@ class iworks_options {
926
  /**
927
  * admin_notices
928
  */
929
-
930
  public function admin_notices() {
931
  if ( empty( $this->notices ) ) {
932
  return;
@@ -939,7 +939,6 @@ class iworks_options {
939
  /**
940
  * options: add, get, update
941
  */
942
-
943
  public function add_option( $option_name, $option_value, $autoload = true ) {
944
  $autoload = $autoload? 'yes':'no';
945
  add_option( $this->option_prefix.$option_name, $option_value, null, $autoload );
@@ -964,15 +963,29 @@ class iworks_options {
964
  $value = $this->get_option( $option['name'] );
965
  if ( array_key_exists( 'sanitize_callback', $option ) && is_callable( $option['sanitize_callback'] ) ) {
966
  $value = call_user_func( $option['sanitize_callback'], $value );
967
-
968
  }
969
  $data[ $option['name'] ] = $value;
970
  }
971
  return $data;
972
  }
973
 
974
- public function get_option_name( $name ) {
975
- return sprintf( '%s%s', $this->option_prefix, $name );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
976
  }
977
 
978
  public function update_option( $option_name, $option_value ) {
@@ -990,7 +1003,6 @@ class iworks_options {
990
  /**
991
  * update taxonomy options
992
  */
993
-
994
  public function update_taxonomy_options( $option_group, $term_id ) {
995
  $this->option_group = $option_group;
996
  $options = $this->get_option_array();
@@ -1014,7 +1026,6 @@ class iworks_options {
1014
  $option['name']
1015
  );
1016
  $value = array_key_exists( $this->get_option_name( $option_name ), $_POST )? $_POST[ $this->get_option_name( $option_name ) ]:false;
1017
-
1018
  if ( array_key_exists( 'sanitize_callback', $option ) && is_callable( $option['sanitize_callback'] ) ) {
1019
  $value = call_user_func( $option['sanitize_callback'], $value );
1020
  }
@@ -1029,7 +1040,6 @@ class iworks_options {
1029
  /**
1030
  * helpers
1031
  */
1032
-
1033
  public function select_page_helper( $name, $show_option_none = false, $post_type = 'page' ) {
1034
  $args = array(
1035
  'echo' => false,
@@ -1069,7 +1079,6 @@ class iworks_options {
1069
  }
1070
 
1071
  public function show_page( $check_option_name = true, $url = 'options.php' ) {
1072
-
1073
  $options = array();
1074
  $option_name = 'index';
1075
  if ( $check_option_name ) {
@@ -1238,9 +1247,22 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1238
  */
1239
  public function get_field_by_type( $type, $name, $value = '', $args = array() ) {
1240
  if ( method_exists( $this, $type ) ) {
 
1241
  if ( ! isset( $args['class'] ) ) {
1242
- $args['class'] = array( 'large-text' );
 
 
 
 
 
 
 
 
 
 
 
1243
  }
 
1244
  return $this->$type( $name, $value, $args );
1245
  }
1246
  return sprintf( 'wrong type: %s', esc_html( $type ) );
@@ -1278,9 +1300,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1278
  if ( empty( $options ) && ! empty( $value ) ) {
1279
  $options[ $value['value'] ] = $value['label'];
1280
  }
1281
-
1282
  $value_to_check = isset( $value['value'] ) ? $value['value'] : false;
1283
-
1284
  $content = sprintf(
1285
  '<select type="%s" name="%s" %s >',
1286
  esc_attr( $type ),
@@ -1326,10 +1346,47 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1326
  );
1327
  }
1328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1329
  private function text( $name, $value = '', $args = array() ) {
1330
  return $this->input( $name, $value, $args, __FUNCTION__ );
1331
  }
1332
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1333
  private function date( $name, $value = '', $args = array() ) {
1334
  if ( ! isset( $args['class'] ) ) {
1335
  $args['class'] = array();
@@ -1383,7 +1440,7 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1383
  esc_attr( $option_value ),
1384
  checked( $option_value, $value, false ),
1385
  esc_attr( $id ),
1386
- esc_html( $input['label'] )
1387
  );
1388
  if ( isset( $input['description'] ) ) {
1389
  $radio .= sprintf(
@@ -1456,7 +1513,6 @@ postboxes.add_postbox_toggles('<?php echo $this->pagehooks[ $option_name ]; ?>')
1456
  */
1457
  public function hex2rgb( $hex ) {
1458
  $hex = str_replace( '#', '', $hex );
1459
-
1460
  if ( strlen( $hex ) == 3 ) {
1461
  $r = hexdec( substr( $hex,0,1 ).substr( $hex,0,1 ) );
1462
  $g = hexdec( substr( $hex,1,1 ).substr( $hex,1,1 ) );
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
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ Copyright 2011-2018 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
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;
78
  $pages = array();
79
  $pages['index'] = $data;
80
  if ( isset( $data['pages'] ) ) {
81
+ $pages = $data['pages'] + $pages;
82
  }
83
  foreach ( $pages as $key => $data ) {
84
  $keys_to_sanitize = array( 'menu', 'parent' );
96
  if ( isset( $data['show_page_callback'] ) && is_callable( $data['show_page_callback'] ) ) {
97
  $callback = $data['show_page_callback'];
98
  }
99
+ if ( isset( $data['set_callback_to_null'] ) && $data['set_callback_to_null'] ) {
100
+ $callback = null;
101
+ }
102
  /**
103
  * add submenu
104
  */
106
  $data['parent'],
107
  $data['page_title'],
108
  isset( $data['menu_title'] )? $data['menu_title']:$data['page_title'],
109
+ apply_filters( 'iworks_options_capability', 'manage_options', 'settings' ),
110
+ isset( $data['menu_slug'] )? $data['menu_slug']: $this->get_option_name( $key ),
111
  $callback
112
  );
113
  add_action( 'load-'.$this->pagehooks[ $key ], array( $this, 'load_page' ) );
199
  echo '<div class="below-h2 error"><p><strong>'.__( 'An error occurred while getting the configuration.', 'sierotki' ).'</strong></p></div>';
200
  return;
201
  }
 
202
  /**
203
  * proceder
204
  */
373
  }
374
  $html_element_name = $option_name? $this->option_prefix.$option_name:'';
375
  $filter_name = $html_element_name? $option_group.'_'.$html_element_name : null;
 
376
  /**
377
  * classes
378
  */
379
  $classes = isset( $option['classes'] )? $option['classes'] : ( isset( $option['class'] )? explode( ' ', $option['class'] ) : array() );
380
  $classes[] = sprintf( 'option-%s', $option['type'] );
 
381
  /**
382
  * build
383
  */
401
  if ( isset( $option['use_name_as_id'] ) && $option['use_name_as_id'] ) {
402
  $args['id'] = sprintf( ' id="%s"', $html_element_name );
403
  }
 
404
  $content .= sprintf(
405
  '<input type="%s" name="%s" value="%s" class="%s" %s /> %s',
406
  $option['type'],
552
  $name_sufix = '[]';
553
  }
554
  }
555
+ /**
556
+ * Sanitize options.
557
+ */
558
+ if ( ! isset( $option['options'] ) || ! is_array( $option['options'] ) ) {
559
+ $option['options'] = array();
560
+ }
561
  $option_value = $this->get_option( $option_name, $option_group );
562
  if ( isset( $option['extra_options'] ) && is_callable( $option['extra_options'] ) ) {
563
  $option['options'] = array_merge( $option['options'], $option['extra_options']() );
564
  }
565
  $option['options'] = apply_filters( $filter_name.'_data', $option['options'], $option_name, $option_value );
 
566
  $select = apply_filters( $filter_name.'_content', null, $option['options'], $html_element_name, $option_name, $option_value );
567
  $select = apply_filters( 'iworks_options_'.$option_name.'_content', null, $option['options'], $html_element_name, $option_name, $option_value );
568
  if ( empty( $select ) ) {
582
  } else {
583
  $selected = ($option_value == $key or ( empty( $option_value ) and isset( $option['default'] ) and $key == $option['default'] ) );
584
  }
 
585
  $select .= sprintf(
586
  '<option %s value="%s" %s %s >%s</option>',
587
  $disabled? 'class="disabled"':'',
610
  $value = ( ! $value && isset( $option['default'] ))? $option['default']:$value;
611
  $args = array(
612
  'rows' => isset( $option['rows'] )? $option['rows']:3,
613
+ 'class' => isset( $option['classes'] )? implode( ' ', $option['classes'] ):'',
614
  );
615
  $content .= $this->textarea( $html_element_name, $value, $args );
616
  break;
765
  if ( $options['show_submit_button'] ) {
766
  $content .= get_submit_button( __( 'Save Changes' ), 'primary', 'submit_button' );
767
  }
 
768
  /**
769
  * iworks-options wrapper
770
  */
771
  $content = sprintf( '<div class="iworks-options">%s</div>', $content );
 
772
  /* print ? */
773
  if ( $echo ) {
774
  echo $content;
927
  /**
928
  * admin_notices
929
  */
 
930
  public function admin_notices() {
931
  if ( empty( $this->notices ) ) {
932
  return;
939
  /**
940
  * options: add, get, update
941
  */
 
942
  public function add_option( $option_name, $option_value, $autoload = true ) {
943
  $autoload = $autoload? 'yes':'no';
944
  add_option( $this->option_prefix.$option_name, $option_value, null, $autoload );
963
  $value = $this->get_option( $option['name'] );
964
  if ( array_key_exists( 'sanitize_callback', $option ) && is_callable( $option['sanitize_callback'] ) ) {
965
  $value = call_user_func( $option['sanitize_callback'], $value );
 
966
  }
967
  $data[ $option['name'] ] = $value;
968
  }
969
  return $data;
970
  }
971
 
972
+ /**
973
+ * Get option name by adding prefix.
974
+ *
975
+ * @since 1.0
976
+ * @since 2.6.4 Added `hidden` argument.
977
+ *
978
+ * @param string $name Name of option.
979
+ * @param boolean $hidden If this hidden value.
980
+ *
981
+ * @return string $option_name
982
+ */
983
+ public function get_option_name( $name, $hidden = false ) {
984
+ $option_name = sprintf( '%s%s', $this->option_prefix, $name );
985
+ if ( $hidden ) {
986
+ $option_name = sprintf( '_%s', $option_name );
987
+ }
988
+ return $option_name;
989
  }
990
 
991
  public function update_option( $option_name, $option_value ) {
1003
  /**
1004
  * update taxonomy options
1005
  */
 
1006
  public function update_taxonomy_options( $option_group, $term_id ) {
1007
  $this->option_group = $option_group;
1008
  $options = $this->get_option_array();
1026
  $option['name']
1027
  );
1028
  $value = array_key_exists( $this->get_option_name( $option_name ), $_POST )? $_POST[ $this->get_option_name( $option_name ) ]:false;
 
1029
  if ( array_key_exists( 'sanitize_callback', $option ) && is_callable( $option['sanitize_callback'] ) ) {
1030
  $value = call_user_func( $option['sanitize_callback'], $value );
1031
  }
1040
  /**
1041
  * helpers
1042
  */
 
1043
  public function select_page_helper( $name, $show_option_none = false, $post_type = 'page' ) {
1044
  $args = array(
1045
  'echo' => false,
1079
  }
1080
 
1081
  public function show_page( $check_option_name = true, $url = 'options.php' ) {
 
1082
  $options = array();
1083
  $option_name = 'index';
1084
  if ( $check_option_name ) {
1247
  */
1248
  public function get_field_by_type( $type, $name, $value = '', $args = array() ) {
1249
  if ( method_exists( $this, $type ) ) {
1250
+ wp_enqueue_style( __CLASS__ );
1251
  if ( ! isset( $args['class'] ) ) {
1252
+ switch ( $type ) {
1253
+ case 'switch_button':
1254
+ wp_enqueue_script( __CLASS__ );
1255
+ wp_enqueue_style( 'switch_button' );
1256
+ break;
1257
+ case 'checkbox':
1258
+ case 'radio':
1259
+ break;
1260
+ default:
1261
+ $args['class'] = array( 'large-text' );
1262
+ break;
1263
+ }
1264
  }
1265
+ $args['class'][] = sprintf( 'iworks-options-%s', preg_replace( '/_/', '-', esc_attr( $type ) ) );
1266
  return $this->$type( $name, $value, $args );
1267
  }
1268
  return sprintf( 'wrong type: %s', esc_html( $type ) );
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 ),
1346
  );
1347
  }
1348
 
1349
+ /**
1350
+ * Checkbox HTML element
1351
+ *
1352
+ * @since 2.6.4
1353
+ */
1354
+ private function checkbox( $name, $value = '', $args = array() ) {
1355
+ if ( ! empty( $value ) ) {
1356
+ $args['checked'] = 'checked';
1357
+ }
1358
+ return $this->input( $name, $value, $args, __FUNCTION__ );
1359
+ }
1360
+
1361
+ /**
1362
+ * Switch button element (based on checkbox field).
1363
+ *
1364
+ * @since 2.6.4
1365
+ */
1366
+ private function switch_button( $name, $value = '', $args = array() ) {
1367
+ return $this->checkbox( $name, $value, $args );
1368
+ }
1369
+
1370
  private function text( $name, $value = '', $args = array() ) {
1371
  return $this->input( $name, $value, $args, __FUNCTION__ );
1372
  }
1373
 
1374
+ private function number( $name, $value = '', $args = array() ) {
1375
+ return $this->input( $name, $value, $args, __FUNCTION__ );
1376
+ }
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__ );
1384
+ }
1385
+
1386
+ private function hidden( $name, $value = '', $args = array() ) {
1387
+ return $this->input( $name, $value, $args, __FUNCTION__ );
1388
+ }
1389
+
1390
  private function date( $name, $value = '', $args = array() ) {
1391
  if ( ! isset( $args['class'] ) ) {
1392
  $args['class'] = array();
1440
  esc_attr( $option_value ),
1441
  checked( $option_value, $value, false ),
1442
  esc_attr( $id ),
1443
+ esc_html( is_string( $input )? $input:$input['label'] )
1444
  );
1445
  if ( isset( $input['description'] ) ) {
1446
  $radio .= sprintf(
1513
  */
1514
  public function hex2rgb( $hex ) {
1515
  $hex = str_replace( '#', '', $hex );
 
1516
  if ( strlen( $hex ) == 3 ) {
1517
  $r = hexdec( substr( $hex,0,1 ).substr( $hex,0,1 ) );
1518
  $g = hexdec( substr( $hex,1,1 ).substr( $hex,1,1 ) );
vendor/iworks/orphan.php CHANGED
@@ -25,6 +25,11 @@ class iworks_orphan
25
  private $settings;
26
  private $plugin_file;
27
 
 
 
 
 
 
28
  /**
29
  * Filter post meta.
30
  *
@@ -125,130 +130,13 @@ class iworks_orphan
125
  }
126
  }
127
 
128
- $terms = array(
129
- 'al.',
130
- 'albo',
131
- 'ale',
132
- 'ależ',
133
- 'b.',
134
- 'bez',
135
- 'bm.',
136
- 'bp',
137
- 'br.',
138
- 'by',
139
- 'bym',
140
- 'byś',
141
- 'bł.',
142
- 'cyt.',
143
- 'cz.',
144
- 'czy',
145
- 'czyt.',
146
- 'dn.',
147
- 'do',
148
- 'doc.',
149
- 'dr',
150
- 'ds.',
151
- 'dyr.',
152
- 'dz.',
153
- 'fot.',
154
- 'gdy',
155
- 'gdyby',
156
- 'gdybym',
157
- 'gdybyś',
158
- 'gdyż',
159
- 'godz.',
160
- 'im.',
161
- 'inż.',
162
- 'jw.',
163
- 'kol.',
164
- 'komu',
165
- 'ks.',
166
- 'która',
167
- 'którego',
168
- 'której',
169
- 'któremu',
170
- 'który',
171
- 'których',
172
- 'którym',
173
- 'którzy',
174
- 'lecz',
175
- 'lic.',
176
- 'm.in.',
177
- 'max',
178
- 'mgr',
179
- 'min',
180
- 'moich',
181
- 'moje',
182
- 'mojego',
183
- 'mojej',
184
- 'mojemu',
185
- 'mych',
186
- 'mój',
187
- 'na',
188
- 'nad',
189
- 'nie',
190
- 'niech',
191
- 'np.',
192
- 'nr',
193
- 'nr.',
194
- 'nrach',
195
- 'nrami',
196
- 'nrem',
197
- 'nrom',
198
- 'nrowi',
199
- 'nru',
200
- 'nry',
201
- 'nrze',
202
- 'nrze',
203
- 'nrów',
204
- 'nt.',
205
- 'nw.',
206
- 'od',
207
- 'oraz',
208
- 'os.',
209
- 'p.',
210
- 'pl.',
211
- 'pn.',
212
- 'po',
213
- 'pod',
214
- 'pot.',
215
- 'prof.',
216
- 'przed',
217
- 'przez',
218
- 'pt.',
219
- 'pw.',
220
- 'pw.',
221
- 'tak',
222
- 'tamtej',
223
- 'tamto',
224
- 'tej',
225
- 'tel.',
226
- 'tj.',
227
- 'to',
228
- 'twoich',
229
- 'twoje',
230
- 'twojego',
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.',
243
- 'św.',
244
- 'że',
245
- 'żeby',
246
- 'żebyś',
247
- );
248
 
 
 
 
249
  preg_match_all( '@(<(script|style)[^>]*>.*?(</(script|style)>))@is', $content, $matches );
250
  $exceptions = array();
251
-
252
  if ( ! empty( $matches ) && ! empty( $matches[0] ) ) {
253
  $salt = 'kQc6T9fn5GhEzTM3Sxn7b9TWMV4PO0mOCV06Da7AQJzSJqxYR4z3qBlsW9rtFsWK';
254
  foreach ( $matches[0] as $one ) {
@@ -259,21 +147,20 @@ class iworks_orphan
259
  }
260
  }
261
 
262
- $own_orphans = trim( get_option( 'iworks_orphan_own_orphans', '' ), ' \t,' );
263
- if ( $own_orphans ) {
264
- $own_orphans = preg_replace( '/\,\+/', ',', $own_orphans );
265
- $terms = array_merge( $terms, preg_split( '/,[ \t]*/', strtolower( $own_orphans ) ) );
266
- }
267
- $terms = apply_filters( 'iworks_orphan_therms', $terms );
268
  /**
269
  * base therms replace
270
  */
271
  $re = '/^([aiouwz]|'.preg_replace( '/\./', '\.', implode( '|', $terms ) ).') +/i';
 
272
  $content = preg_replace( $re, '$1$2&nbsp;', $content );
273
  /**
274
  * single letters
275
  */
276
- $re = '/([ >\(]+)([aiouwz]|'.preg_replace( '/\./', '\.', implode( '|', $terms ) ).') +/i';
 
 
 
 
277
  $content = preg_replace( $re, '$1$2&nbsp;', $content );
278
  /**
279
  * single letter after previous orphan
@@ -350,6 +237,12 @@ class iworks_orphan
350
  }
351
  if ( is_integer( $value ) && 1 == $value ) {
352
  add_filter( $filter, array( $this, 'replace' ) );
 
 
 
 
 
 
353
  }
354
  }
355
 
@@ -426,11 +319,11 @@ class iworks_orphan
426
  * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
427
  */
428
  public function add_donate_link( $plugin_meta, $plugin_file ) {
429
-
430
  if ( $plugin_file == $this->plugin_file ) {
431
  $plugin_meta[] = '<a href="http://iworks.pl/donate/sierotki.php">' . __( 'Donate', 'sierotki' ) . '</a>';
432
  }
433
-
434
  return $plugin_meta;
435
  }
436
 
@@ -477,4 +370,165 @@ class iworks_orphan
477
  }
478
  return $check;
479
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  }
25
  private $settings;
26
  private $plugin_file;
27
 
28
+ /**
29
+ * terms cache
30
+ */
31
+ private $terms = array();
32
+
33
  /**
34
  * Filter post meta.
35
  *
130
  }
131
  }
132
 
133
+ $terms = $this->_terms();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
+ /**
136
+ * Avoid to replace inside script or styles tags
137
+ */
138
  preg_match_all( '@(<(script|style)[^>]*>.*?(</(script|style)>))@is', $content, $matches );
139
  $exceptions = array();
 
140
  if ( ! empty( $matches ) && ! empty( $matches[0] ) ) {
141
  $salt = 'kQc6T9fn5GhEzTM3Sxn7b9TWMV4PO0mOCV06Da7AQJzSJqxYR4z3qBlsW9rtFsWK';
142
  foreach ( $matches[0] as $one ) {
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
158
  */
159
+ $re = '/([ >\(]+|&nbsp;)([aiouwz]|'.preg_replace( '/\./', '\.', implode( '|', $terms ) ).') +/i';
160
+ /**
161
+ * double call to handle orphan after orphan after orphan
162
+ */
163
+ $content = preg_replace( $re, '$1$2&nbsp;', $content );
164
  $content = preg_replace( $re, '$1$2&nbsp;', $content );
165
  /**
166
  * single letter after previous orphan
237
  }
238
  if ( is_integer( $value ) && 1 == $value ) {
239
  add_filter( $filter, array( $this, 'replace' ) );
240
+ /**
241
+ * WooCommerce exception: short descripton
242
+ */
243
+ if ( 'the_excerpt' === $filter ) {
244
+ add_filter( 'woocommerce_short_description', array( $this, 'replace' ) );
245
+ }
246
  }
247
  }
248
 
319
  * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
320
  */
321
  public function add_donate_link( $plugin_meta, $plugin_file ) {
322
+ /* start:free */
323
  if ( $plugin_file == $this->plugin_file ) {
324
  $plugin_meta[] = '<a href="http://iworks.pl/donate/sierotki.php">' . __( 'Donate', 'sierotki' ) . '</a>';
325
  }
326
+ /* end:free */
327
  return $plugin_meta;
328
  }
329
 
370
  }
371
  return $check;
372
  }
373
+
374
+ /**
375
+ * get terms array
376
+ *
377
+ * @since 2.7.1
378
+ *
379
+ * @return $terms array Array of terms to replace.
380
+ */
381
+ private function _terms() {
382
+ if ( ! empty( $this->terms ) ) {
383
+ return $this->terms;
384
+ }
385
+ $terms = array(
386
+ 'al.',
387
+ 'albo',
388
+ 'ale',
389
+ 'ależ',
390
+ 'b.',
391
+ 'bez',
392
+ 'bm.',
393
+ 'bp',
394
+ 'br.',
395
+ 'by',
396
+ 'bym',
397
+ 'byś',
398
+ 'bł.',
399
+ 'cyt.',
400
+ 'cz.',
401
+ 'czy',
402
+ 'czyt.',
403
+ 'dn.',
404
+ 'do',
405
+ 'doc.',
406
+ 'dr',
407
+ 'ds.',
408
+ 'dyr.',
409
+ 'dz.',
410
+ 'fot.',
411
+ 'gdy',
412
+ 'gdyby',
413
+ 'gdybym',
414
+ 'gdybyś',
415
+ 'gdyż',
416
+ 'godz.',
417
+ 'im.',
418
+ 'inż.',
419
+ 'jw.',
420
+ 'kol.',
421
+ 'komu',
422
+ 'ks.',
423
+ 'która',
424
+ 'którego',
425
+ 'której',
426
+ 'któremu',
427
+ 'który',
428
+ 'których',
429
+ 'którym',
430
+ 'którzy',
431
+ 'lecz',
432
+ 'lic.',
433
+ 'm.in.',
434
+ 'max',
435
+ 'mgr',
436
+ 'min',
437
+ 'moich',
438
+ 'moje',
439
+ 'mojego',
440
+ 'mojej',
441
+ 'mojemu',
442
+ 'mych',
443
+ 'mój',
444
+ 'na',
445
+ 'nad',
446
+ 'nie',
447
+ 'niech',
448
+ 'np.',
449
+ 'nr',
450
+ 'nr.',
451
+ 'nrach',
452
+ 'nrami',
453
+ 'nrem',
454
+ 'nrom',
455
+ 'nrowi',
456
+ 'nru',
457
+ 'nry',
458
+ 'nrze',
459
+ 'nrze',
460
+ 'nrów',
461
+ 'nt.',
462
+ 'nw.',
463
+ 'od',
464
+ 'oraz',
465
+ 'os.',
466
+ 'p.',
467
+ 'pl.',
468
+ 'pn.',
469
+ 'po',
470
+ 'pod',
471
+ 'pot.',
472
+ 'prof.',
473
+ 'przed',
474
+ 'przez',
475
+ 'pt.',
476
+ 'pw.',
477
+ 'pw.',
478
+ 'tak',
479
+ 'tamtej',
480
+ 'tamto',
481
+ 'tej',
482
+ 'tel.',
483
+ 'tj.',
484
+ 'to',
485
+ 'twoich',
486
+ 'twoje',
487
+ 'twojego',
488
+ 'twojej',
489
+ 'twych',
490
+ 'twój',
491
+ 'tylko',
492
+ 'ul.',
493
+ 'we',
494
+ 'wg',
495
+ 'woj.',
496
+ 'więc',
497
+ 'za',
498
+ 'ze',
499
+ 'śp.',
500
+ 'św.',
501
+ 'że',
502
+ 'żeby',
503
+ 'żebyś',
504
+ '—',
505
+ );
506
+ /**
507
+ * get own orphans
508
+ */
509
+ $own_orphans = trim( get_option( 'iworks_orphan_own_orphans', '' ), ' \t,' );
510
+ if ( $own_orphans ) {
511
+ $own_orphans = preg_replace( '/\,\+/', ',', $own_orphans );
512
+ $terms = array_merge( $terms, preg_split( '/,[ \t]*/', strtolower( $own_orphans ) ) );
513
+ }
514
+ $terms = apply_filters( 'iworks_orphan_therms', $terms );
515
+ /**
516
+ * remove duplicates
517
+ */
518
+ $terms = array_unique( $terms );
519
+ /**
520
+ * decode
521
+ */
522
+ $a = array();
523
+ foreach ( $terms as $t ) {
524
+ $a[] = html_entity_decode( $t );
525
+ }
526
+ $terms = $a;
527
+ /**
528
+ * remove empty elements
529
+ */
530
+ $terms = array_filter( $terms );
531
+ $this->terms = $terms;
532
+ return $this->terms;
533
+ }
534
  }