Orphans - Version 2.6.7

Version Description

  • 2017-05-09 =

  • Allow to apply replacement to all languages by using filter `iworks_orphan_apply_to_all_languages' set on true.

  • Fixed rate module.

Download this release

Release Info

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

Code changes from version 2.6.6.1 to 2.6.7

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: 3.3
6
  Tested up to: 4.7.4
7
- Stable tag: 2.6.6.1
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
@@ -96,6 +96,11 @@ function my_orphans_capability($capability)
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
99
  = 2.6.6.1 - 2017-04-30 =
100
 
101
  * Fixed wrong regexp replacement.
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.5
6
  Tested up to: 4.7.4
7
+ Stable tag: 2.6.7
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
96
 
97
  == Changelog ==
98
 
99
+ = 2.6.7 - 2017-05-09 =
100
+
101
+ * Allow to apply replacement to all languages by using filter `iworks_orphan_apply_to_all_languages' set on true.
102
+ * Fixed rate module.
103
+
104
  = 2.6.6.1 - 2017-04-30 =
105
 
106
  * Fixed wrong regexp replacement.
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.6.1
9
  Author URI: http://iworks.pl/
10
  */
11
 
@@ -78,8 +78,7 @@ function iworks_orphan_change_options_autoload_status( $status ) {
78
  do_action(
79
  'iworks-register-plugin',
80
  plugin_basename( __FILE__ ),
81
- __('Orphans',
82
- 'sierotki' ),
83
- __( 'https://wordpress.org/plugins/sierotki/', 'sierotki' )
84
  );
85
 
5
  Text Domain: sierotki
6
  Description: Implement Polish grammar rules with orphans.
7
  Author: Marcin Pietrzak
8
+ Version: 2.6.7
9
  Author URI: http://iworks.pl/
10
  */
11
 
78
  do_action(
79
  'iworks-register-plugin',
80
  plugin_basename( __FILE__ ),
81
+ __( 'Orphans', 'sierotki' ),
82
+ 'sierotki'
 
83
  );
84
 
vendor/iworks/orphan.php CHANGED
@@ -108,11 +108,19 @@ class iworks_orphan
108
  }
109
 
110
  /**
111
- * apply other rules only for Polish language
 
 
112
  */
113
- $locale = apply_filters( 'wpml_current_language', get_locale() );
114
- if ( ! preg_match( '/^pl/', $locale ) ) {
115
- return $content;
 
 
 
 
 
 
116
  }
117
 
118
  $terms = array(
108
  }
109
 
110
  /**
111
+ * Allow to ignore language.
112
+ *
113
+ * @since 2.6.7
114
  */
115
+ $apply_to_all_languages = apply_filters( 'iworks_orphan_apply_to_all_languages', false );
116
+ if ( ! $apply_to_all_languages ) {
117
+ /**
118
+ * apply other rules only for Polish language
119
+ */
120
+ $locale = apply_filters( 'wpml_current_language', get_locale() );
121
+ if ( ! preg_match( '/^pl/', $locale ) ) {
122
+ return $content;
123
+ }
124
  }
125
 
126
  $terms = array(
vendor/iworks/rate/admin.js CHANGED
@@ -1,48 +1,16 @@
1
  jQuery(function() {
2
  var el_notice = jQuery( ".iworks-notice" ),
3
- type = el_notice.find( "input[name=type]" ).val(),
4
  plugin_id = el_notice.find( "input[name=plugin_id]" ).val(),
5
- url_wp = el_notice.find( "input[name=url_wp]" ).val(),
6
- drip_plugin = el_notice.find( "input[name=drip_plugin]" ).val(),
7
- inp_email = el_notice.find( "input[name=email]" )
8
  btn_act = el_notice.find( ".iworks-notice-act" ),
9
  btn_dismiss = el_notice.find( ".iworks-notice-dismiss" )
10
  ajax_data = {};
11
 
12
  ajax_data.plugin_id = plugin_id;
13
- ajax_data.type = type;
14
-
15
- function init_email() {
16
- if ( ! inp_email.length ) { return; }
17
-
18
- // Adjust the size of the email field to its contents.
19
- function adjust_email_size() {
20
- var width, tmp = jQuery( "<span></span>" );
21
-
22
- tmp.addClass( "input-field" ).text( inp_email.val() );
23
- tmp.appendTo( "body" );
24
- width = parseInt( tmp.width() );
25
- tmp.remove();
26
-
27
- inp_email.width( width + 34 );
28
- }
29
-
30
- function email_keycheck( ev ) {
31
- if ( 13 === ev.keyCode ) {
32
- btn_act.click();
33
- } else {
34
- adjust_email_size();
35
- }
36
- }
37
-
38
- inp_email.keyup( email_keycheck ).focus().select();
39
- adjust_email_size();
40
- }
41
 
42
  // Display the notice after the page was loaded.
43
  function initialize() {
44
  el_notice.fadeIn( 500 );
45
- init_email();
46
  }
47
 
48
  // Hide the notice after a CTA button was clicked
@@ -54,34 +22,6 @@ jQuery(function() {
54
  });
55
  }
56
 
57
- // Open a tab to rate the plugin.
58
- function act_rate() {
59
- var url = url_wp.replace( /\/plugins\//, "/support/view/plugin-reviews/" ) + "?rate=5#new-post",
60
- link = jQuery( '<a href="' + url + '" target="_blank">Rate</a>' );
61
-
62
- link.appendTo( "body" );
63
- link[0].click();
64
- link.remove();
65
- }
66
-
67
- // Submit the user to our email list.
68
- function act_email() {
69
- var email = inp_email.val();
70
-
71
- // First create a new subscriber.
72
- _dcq.push([
73
- "identify",
74
- { email: email }
75
- ]);
76
-
77
- // Then trigger the specified rule.
78
- _dcq.push([
79
- "track",
80
- "Free plugin email course",
81
- {"Plugin": drip_plugin}
82
- ]);
83
- }
84
-
85
  // Notify WordPress about the users choice and close the message.
86
  function notify_wordpress( action, message ) {
87
  el_notice.attr( "data-message", message );
@@ -99,12 +39,11 @@ jQuery(function() {
99
  // Either open the wp.org page or submit the email address.
100
  btn_act.click(function( ev ) {
101
  ev.preventDefault();
102
-
103
- switch ( type ) {
104
- case 'rate': act_rate(); break;
105
- case 'email': act_email(); break;
106
- }
107
-
108
  notify_wordpress( "iworks_act", btn_act.data( "msg" ) );
109
  });
110
 
@@ -118,14 +57,3 @@ jQuery(function() {
118
  window.setTimeout( initialize, 500 );
119
  });
120
 
121
- // Drip integration
122
- var _dcq = _dcq || [];
123
- var _dcs = _dcs || {};
124
-
125
- _dcs.account = '6994213';
126
- var dc = document.createElement( 'script' );
127
- dc.type = 'text/javascript'; dc.async = true;
128
- dc.src = '//tag.getdrip.com/6994213.js';
129
- var s = document.getElementsByTagName('script')[0];
130
- s.parentNode.insertBefore(dc, s);
131
- // End of drip integration
1
  jQuery(function() {
2
  var el_notice = jQuery( ".iworks-notice" ),
 
3
  plugin_id = el_notice.find( "input[name=plugin_id]" ).val(),
4
+ slug = el_notice.find( "input[name=slug]" ).val(),
 
 
5
  btn_act = el_notice.find( ".iworks-notice-act" ),
6
  btn_dismiss = el_notice.find( ".iworks-notice-dismiss" )
7
  ajax_data = {};
8
 
9
  ajax_data.plugin_id = plugin_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  // Display the notice after the page was loaded.
12
  function initialize() {
13
  el_notice.fadeIn( 500 );
 
14
  }
15
 
16
  // Hide the notice after a CTA button was clicked
22
  });
23
  }
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  // Notify WordPress about the users choice and close the message.
26
  function notify_wordpress( action, message ) {
27
  el_notice.attr( "data-message", message );
39
  // Either open the wp.org page or submit the email address.
40
  btn_act.click(function( ev ) {
41
  ev.preventDefault();
42
+ var url = 'https://wordpress.org/support/plugin/'+slug+'/reviews/?rate=5#new-post';
43
+ var link = jQuery( '<a href="' + url + '" target="_blank">Rate</a>' );
44
+ link.appendTo( "body" );
45
+ link[0].click();
46
+ link.remove();
 
47
  notify_wordpress( "iworks_act", btn_act.data( "msg" ) );
48
  });
49
 
57
  window.setTimeout( initialize, 500 );
58
  });
59
 
 
 
 
 
 
 
 
 
 
 
 
vendor/iworks/rate/rate.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * iWorks_Rate - Dashboard Notification module.
4
  *
5
- * @version 1.0.0
6
  * @author iworks (Marcin Pietrzak)
7
  * @author Incsub (Philipp Stracker)
8
  *
@@ -15,6 +15,14 @@
15
  if ( ! class_exists( 'iworks_rate' ) ) {
16
  class iworks_rate {
17
 
 
 
 
 
 
 
 
 
18
  /**
19
  * $wpdb->options field name.
20
  *
@@ -118,26 +126,18 @@ if ( ! class_exists( 'iworks_rate' ) ) {
118
  * @since 1.0.0
119
  * @param string $plugin_id WordPress plugin-ID (see: plugin_basename).
120
  * @param string $title Plugin name for display.
121
- * @param string $url_wp URL to the plugin on wp.org (domain not needed)
122
- * @param string $cta_email Title of the Email CTA button.
123
- * @param string $drip_plugin Optional. Plugin-param for the getdrip rule.
124
  */
125
- public function iworks_register_plugin( $plugin_id, $title, $url_wp, $cta_email = '', $drip_plugin = '' ) {
126
  // Ignore incorrectly registered plugins to avoid errors later.
127
  if ( empty( $plugin_id ) ) { return; }
128
  if ( empty( $title ) ) { return; }
129
- if ( empty( $url_wp ) ) { return; }
130
-
131
- if ( false === strpos( $url_wp, '://' ) ) {
132
- $url_wp = 'https://wordpress.org/' . trim( $url_wp, '/' );
133
- }
134
 
135
  $this->plugins[ $plugin_id ] = (object) array(
136
  'id' => $plugin_id,
137
  'title' => $title,
138
- 'url_wp' => $url_wp,
139
- 'cta_email' => $cta_email,
140
- 'drip_plugin' => $drip_plugin,
141
  );
142
 
143
  /*
@@ -149,18 +149,9 @@ if ( ! class_exists( 'iworks_rate' ) ) {
149
  // First register the plugin permanently.
150
  $this->stored['plugins'][ $plugin_id ] = time();
151
 
152
- // Second schedule the messages to display.
153
- $hash = md5( $plugin_id . '-email' );
154
- $this->stored['queue'][ $hash ] = array(
155
- 'plugin' => $plugin_id,
156
- 'type' => 'email',
157
- 'show_at' => time(), // Earliest time to display note.
158
- );
159
-
160
  $hash = md5( $plugin_id . '-rate' );
161
  $this->stored['queue'][ $hash ] = array(
162
  'plugin' => $plugin_id,
163
- 'type' => 'rate',
164
  'show_at' => time() + 7 * DAY_IN_SECONDS,
165
  );
166
 
@@ -176,12 +167,8 @@ if ( ! class_exists( 'iworks_rate' ) ) {
176
  */
177
  public function wp_ajax_iworks_act() {
178
  $plugin = $_POST['plugin_id'];
179
- $type = $_POST['type'];
180
-
181
- $this->mark_as_done( $plugin, $type, 'ok' );
182
-
183
- echo 1;
184
- exit;
185
  }
186
 
187
  /**
@@ -191,12 +178,8 @@ if ( ! class_exists( 'iworks_rate' ) ) {
191
  */
192
  public function wp_ajax_iworks_dismiss() {
193
  $plugin = $_POST['plugin_id'];
194
- $type = $_POST['type'];
195
-
196
- $this->mark_as_done( $plugin, $type, 'ignore' );
197
-
198
- echo 1;
199
- exit;
200
  }
201
 
202
  /**
@@ -208,6 +191,19 @@ if ( ! class_exists( 'iworks_rate' ) ) {
208
  public function load_index_php() {
209
  if ( is_super_admin() ) {
210
  $this->add_action( 'all_admin_notices' );
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  }
212
  }
213
 
@@ -233,7 +229,6 @@ if ( ! class_exists( 'iworks_rate' ) ) {
233
  *
234
  * @since 1.0.0
235
  * @return object|false
236
- * string $type [rate|email] Which message type?
237
  * string $plugin WordPress plugin ID?
238
  */
239
  protected function choose_message() {
@@ -265,16 +260,7 @@ if ( ! class_exists( 'iworks_rate' ) ) {
265
 
266
  $can_display = true;
267
  if ( wp_is_mobile() ) {
268
- // Do not display rating message on mobile devices.
269
- if ( 'rate' == $item['type'] ) {
270
- $can_display = false;
271
- }
272
- }
273
- if ( 'email' == $item['type'] ) {
274
- if ( ! $plugin->drip_plugin || ! $plugin->cta_email ) {
275
- // Do not display email message with missing email params.
276
- $can_display = false;
277
- }
278
  }
279
  if ( $now < $show_at ) {
280
  // Do not display messages that are not due yet.
@@ -322,16 +308,15 @@ if ( ! class_exists( 'iworks_rate' ) ) {
322
  *
323
  * @since 1.0.0
324
  * @param string $plugin Plugin ID.
325
- * @param string $type [rate|email] Message type.
326
  * @param string $state [ok|ignore] Button clicked.
327
  */
328
- protected function mark_as_done( $plugin, $type, $state ) {
329
  $done_item = false;
330
 
331
  foreach ( $this->stored['queue'] as $hash => $item ) {
332
  unset( $this->stored['queue'][ $hash ]['sticky'] );
333
 
334
- if ( $item['plugin'] == $plugin && $item['type'] == $type ) {
335
  $done_item = $item;
336
  unset( $this->stored['queue'][ $hash ] );
337
  }
@@ -355,22 +340,15 @@ if ( ! class_exists( 'iworks_rate' ) ) {
355
  */
356
  protected function render_message( $info ) {
357
  $plugin = $this->plugins[ $info->plugin ];
358
- $css_url = plugin_dir_url( __FILE__ ) . '/admin.css';
359
- $js_url = plugin_dir_url( __FILE__ ) . '/admin.js';
360
-
361
  do_action( 'iworks_rate_css' );
362
  ?>
363
- <link rel="stylesheet" type="text/css" href="<?php echo esc_url( $css_url ); ?>" />
364
- <div class="notice iworks-notice iworks-notice-<?php echo esc_attr( $info->type ); ?> iworks-notice-<?php echo esc_attr( dirname( $info->plugin ) ); ?>" style="display:none">
365
- <input type="hidden" name="type" value="<?php echo esc_attr( $info->type ); ?>" />
366
  <input type="hidden" name="plugin_id" value="<?php echo esc_attr( $info->plugin ); ?>" />
367
- <input type="hidden" name="url_wp" value="<?php echo esc_attr( $plugin->url_wp ); ?>" />
368
- <input type="hidden" name="drip_plugin" value="<?php echo esc_attr( $plugin->drip_plugin ); ?>" />
369
  <?php
370
  $this->render_rate_message( $plugin );
371
  ?>
372
  </div>
373
- <script src="<?php echo esc_url( $js_url ); ?>"></script>
374
  <?php
375
  }
376
 
2
  /**
3
  * iWorks_Rate - Dashboard Notification module.
4
  *
5
+ * @version 1.0.1
6
  * @author iworks (Marcin Pietrzak)
7
  * @author Incsub (Philipp Stracker)
8
  *
15
  if ( ! class_exists( 'iworks_rate' ) ) {
16
  class iworks_rate {
17
 
18
+ /**
19
+ * This class version.
20
+ *
21
+ * @since 1.0.1
22
+ * @var string
23
+ */
24
+ private $version = '1.0.1';
25
+
26
  /**
27
  * $wpdb->options field name.
28
  *
126
  * @since 1.0.0
127
  * @param string $plugin_id WordPress plugin-ID (see: plugin_basename).
128
  * @param string $title Plugin name for display.
129
+ * @param string $slug the plugin slug on wp.org
 
 
130
  */
131
+ public function iworks_register_plugin( $plugin_id, $title, $slug ) {
132
  // Ignore incorrectly registered plugins to avoid errors later.
133
  if ( empty( $plugin_id ) ) { return; }
134
  if ( empty( $title ) ) { return; }
135
+ if ( empty( $slug ) ) { return; }
 
 
 
 
136
 
137
  $this->plugins[ $plugin_id ] = (object) array(
138
  'id' => $plugin_id,
139
  'title' => $title,
140
+ 'slug' => $slug,
 
 
141
  );
142
 
143
  /*
149
  // First register the plugin permanently.
150
  $this->stored['plugins'][ $plugin_id ] = time();
151
 
 
 
 
 
 
 
 
 
152
  $hash = md5( $plugin_id . '-rate' );
153
  $this->stored['queue'][ $hash ] = array(
154
  'plugin' => $plugin_id,
 
155
  'show_at' => time() + 7 * DAY_IN_SECONDS,
156
  );
157
 
167
  */
168
  public function wp_ajax_iworks_act() {
169
  $plugin = $_POST['plugin_id'];
170
+ $this->mark_as_done( $plugin, 'ok' );
171
+ wp_send_json_success();
 
 
 
 
172
  }
173
 
174
  /**
178
  */
179
  public function wp_ajax_iworks_dismiss() {
180
  $plugin = $_POST['plugin_id'];
181
+ $this->mark_as_done( $plugin, 'ignore' );
182
+ wp_send_json_success();
 
 
 
 
183
  }
184
 
185
  /**
191
  public function load_index_php() {
192
  if ( is_super_admin() ) {
193
  $this->add_action( 'all_admin_notices' );
194
+ wp_enqueue_style(
195
+ __CLASS__,
196
+ plugin_dir_url( __FILE__ ) . 'admin.css',
197
+ array(),
198
+ $this->version
199
+ );
200
+ wp_enqueue_script(
201
+ __CLASS__,
202
+ plugin_dir_url( __FILE__ ) . 'admin.js',
203
+ array(),
204
+ $this->version,
205
+ true
206
+ );
207
  }
208
  }
209
 
229
  *
230
  * @since 1.0.0
231
  * @return object|false
 
232
  * string $plugin WordPress plugin ID?
233
  */
234
  protected function choose_message() {
260
 
261
  $can_display = true;
262
  if ( wp_is_mobile() ) {
263
+ $can_display = false;
 
 
 
 
 
 
 
 
 
264
  }
265
  if ( $now < $show_at ) {
266
  // Do not display messages that are not due yet.
308
  *
309
  * @since 1.0.0
310
  * @param string $plugin Plugin ID.
 
311
  * @param string $state [ok|ignore] Button clicked.
312
  */
313
+ protected function mark_as_done( $plugin, $state ) {
314
  $done_item = false;
315
 
316
  foreach ( $this->stored['queue'] as $hash => $item ) {
317
  unset( $this->stored['queue'][ $hash ]['sticky'] );
318
 
319
+ if ( $item['plugin'] == $plugin ) {
320
  $done_item = $item;
321
  unset( $this->stored['queue'][ $hash ] );
322
  }
340
  */
341
  protected function render_message( $info ) {
342
  $plugin = $this->plugins[ $info->plugin ];
 
 
 
343
  do_action( 'iworks_rate_css' );
344
  ?>
345
+ <div class="notice iworks-notice iworks-notice-rate iworks-notice-<?php echo esc_attr( dirname( $info->plugin ) ); ?>" style="display:none">
 
 
346
  <input type="hidden" name="plugin_id" value="<?php echo esc_attr( $info->plugin ); ?>" />
347
+ <input type="hidden" name="slug" value="<?php echo esc_attr( $plugin->slug ); ?>" />
 
348
  <?php
349
  $this->render_rate_message( $plugin );
350
  ?>
351
  </div>
 
352
  <?php
353
  }
354