Orphans - Version 2.7.9

Version Description

  • 2021-06-23 =
  • Renamed directory vendor into includes.
  • Updated iWorks Rate to 2.0.1.
Download this release

Release Info

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

Code changes from version 2.7.8 to 2.7.9

etc/options.php CHANGED
@@ -179,15 +179,15 @@ function orphang_indicator_options() {
179
  ),
180
  ),
181
  'metaboxes' => array(
182
- 'loved_this_plugin' => array(
183
- 'title' => __( 'Loved this Plugin?', 'sierotki' ),
184
- 'callback' => 'iworks_orphan_options_loved_this_plugin',
185
  'context' => 'side',
186
  'priority' => 'core',
187
  ),
188
- 'need_assistance' => array(
189
- 'title' => __( 'Need Assistance?', 'sierotki' ),
190
- 'callback' => 'iworks_orphans_options_need_assistance',
191
  'context' => 'side',
192
  'priority' => 'core',
193
  ),
@@ -197,7 +197,11 @@ function orphang_indicator_options() {
197
  }
198
 
199
  function iworks_orphan_options_loved_this_plugin( $iworks_orphan ) {
200
-
 
 
 
 
201
  ?>
202
  <p><?php _e( 'Below are some links to help spread this plugin to other users', 'sierotki' ); ?></p>
203
  <ul>
@@ -228,9 +232,14 @@ function iworks_orphan_post_types() {
228
  }
229
 
230
  function iworks_orphans_options_need_assistance( $iworks_orphans ) {
 
 
 
 
 
231
 
232
  ?>
233
- <p><?php _e( 'Problems? The links bellow can be very helpful to you', 'sierotki' ); ?></p>
234
  <ul>
235
  <li><a href="<?php _ex( 'https://wordpress.org/support/plugin/sierotki/', 'link to support forum on WordPress.org', 'sierotki' ); ?>"><?php _e( 'WordPress Help Forum', 'sierotki' ); ?></a></li>
236
  </ul>
179
  ),
180
  ),
181
  'metaboxes' => array(
182
+ 'assistance' => array(
183
+ 'title' => __( 'We are waiting for your message', 'sierotki' ),
184
+ 'callback' => 'iworks_orphans_options_need_assistance',
185
  'context' => 'side',
186
  'priority' => 'core',
187
  ),
188
+ 'love' => array(
189
+ 'title' => __( 'I love what I do!', 'sierotki' ),
190
+ 'callback' => 'iworks_orphan_options_loved_this_plugin',
191
  'context' => 'side',
192
  'priority' => 'core',
193
  ),
197
  }
198
 
199
  function iworks_orphan_options_loved_this_plugin( $iworks_orphan ) {
200
+ $content = apply_filters( 'iworks_rate_love', '', 'sierotki' );
201
+ if ( ! empty( $content ) ) {
202
+ echo $content;
203
+ return;
204
+ }
205
  ?>
206
  <p><?php _e( 'Below are some links to help spread this plugin to other users', 'sierotki' ); ?></p>
207
  <ul>
232
  }
233
 
234
  function iworks_orphans_options_need_assistance( $iworks_orphans ) {
235
+ $content = apply_filters( 'iworks_rate_assistance', '', 'sierotki' );
236
+ if ( ! empty( $content ) ) {
237
+ echo $content;
238
+ return;
239
+ }
240
 
241
  ?>
242
+ <p><?php _e( 'We are waiting for your message', 'sierotki' ); ?></p>
243
  <ul>
244
  <li><a href="<?php _ex( 'https://wordpress.org/support/plugin/sierotki/', 'link to support forum on WordPress.org', 'sierotki' ); ?>"><?php _e( 'WordPress Help Forum', 'sierotki' ); ?></a></li>
245
  </ul>
{vendor → includes}/iworks/options/assets/scripts/common.js RENAMED
File without changes
{vendor → includes}/iworks/options/assets/scripts/jquery.switch_button.js RENAMED
File without changes
{vendor → includes}/iworks/options/assets/scripts/select2.min.js RENAMED
File without changes
{vendor → includes}/iworks/options/assets/styles/jquery-ui.min.css RENAMED
File without changes
{vendor → includes}/iworks/options/assets/styles/jquery.switch_button.css RENAMED
File without changes
{vendor → includes}/iworks/options/assets/styles/options-admin.css RENAMED
File without changes
{vendor → includes}/iworks/options/assets/styles/select2.min.css RENAMED
File without changes
{vendor → includes}/iworks/options/options.php RENAMED
File without changes
{vendor → includes}/iworks/orphan.php RENAMED
@@ -60,6 +60,10 @@ class iworks_orphan {
60
  * filters
61
  */
62
  add_filter( 'orphan_replace', array( $this, 'orphan_replace_filter' ) );
 
 
 
 
63
  }
64
 
65
  /**
@@ -284,10 +288,8 @@ class iworks_orphan {
284
  */
285
  public function admin_init() {
286
  $this->options->options_init();
287
- /** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */
288
- add_filter( 'plugin_row_meta', array( $this, 'add_donate_link' ), 10, 2 );
289
- /** This filter is documented in wp-admin/includes/class-wp-plugins-list-table.php */
290
- add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
291
  }
292
 
293
  /**
@@ -375,19 +377,11 @@ class iworks_orphan {
375
  * @since 2.6.8
376
  *
377
  * @param array $actions An array of plugin action links.
378
- * @param string $plugin_file Path to the plugin file relative to the plugins directory.
379
  */
380
- public function add_settings_link( $actions, $plugin_file ) {
381
- if ( is_multisite() ) {
382
- return $actions;
383
- }
384
- if ( $plugin_file == $this->plugin_file ) {
385
- $page = $this->options->get_pagehook();
386
- $url = add_query_arg( 'page', $page, admin_url( 'themes.php' ) );
387
- $url = sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html__( 'Settings', 'sierotki' ) );
388
- $settings = array( $url );
389
- $actions = array_merge( $settings, $actions );
390
- }
391
  return $actions;
392
  }
393
 
@@ -396,18 +390,11 @@ class iworks_orphan {
396
  *
397
  * @since 2.6.8
398
  *
399
- * @param array $plugin_meta An array of the plugin's metadata,
400
- * including the version, author,
401
- * author URI, and plugin URI.
402
- * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
403
  */
404
- public function add_donate_link( $plugin_meta, $plugin_file ) {
405
- /* start:free */
406
- if ( $plugin_file == $this->plugin_file ) {
407
- $plugin_meta[] = '<a href="http://iworks.pl/donate/sierotki.php">' . __( 'Donate', 'sierotki' ) . '</a>';
408
- }
409
- /* end:free */
410
- return $plugin_meta;
411
  }
412
 
413
  /**
@@ -634,4 +621,22 @@ class iworks_orphan {
634
  return $this->unconditional_replacement( $content );
635
  }
636
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637
  }
60
  * filters
61
  */
62
  add_filter( 'orphan_replace', array( $this, 'orphan_replace_filter' ) );
63
+ /**
64
+ * iWorks Rate Class
65
+ */
66
+ add_filter( 'iworks_rate_notice_logo_style', array( $this, 'filter_plugin_logo' ), 10, 2 );
67
  }
68
 
69
  /**
288
  */
289
  public function admin_init() {
290
  $this->options->options_init();
291
+ add_filter( 'plugin_action_links_' . $this->plugin_file, array( $this, 'add_settings_link' ) );
292
+ add_filter( 'plugin_action_links_' . $this->plugin_file, array( $this, 'add_donate_link' ) );
 
 
293
  }
294
 
295
  /**
377
  * @since 2.6.8
378
  *
379
  * @param array $actions An array of plugin action links.
 
380
  */
381
+ public function add_settings_link( $actions ) {
382
+ $page = $this->options->get_pagehook();
383
+ $url = add_query_arg( 'page', $page, admin_url( 'themes.php' ) );
384
+ $actions[] = sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html__( 'Settings', 'sierotki' ) );
 
 
 
 
 
 
 
385
  return $actions;
386
  }
387
 
390
  *
391
  * @since 2.6.8
392
  *
393
+ * @param array $actions An array of the plugin's metadata, including the version, author, author URI, and plugin URI.
 
 
 
394
  */
395
+ public function add_donate_link( $actions ) {
396
+ $actions[] = '<a href="https://ko-fi.com/iworks?utm_source=sierotki&utm_medium=plugin-links">' . __( 'Donate', 'sierotki' ) . '</a>';
397
+ return $actions;
 
 
 
 
398
  }
399
 
400
  /**
621
  return $this->unconditional_replacement( $content );
622
  }
623
 
624
+ /**
625
+ * Plugin logo for rate messages
626
+ *
627
+ * @since 2.7.9
628
+ *
629
+ * @param string $logo Logo, can be empty.
630
+ * @param object $plugin Plugin basic data.
631
+ */
632
+ public function filter_plugin_logo( $logo, $plugin ) {
633
+ if ( is_object( $plugin ) ) {
634
+ $plugin = (array) $plugin;
635
+ }
636
+ if ( 'sierotki' === $plugin['slug'] ) {
637
+ return plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . '/assets/images/logo.png';
638
+ }
639
+ return $logo;
640
+ }
641
+
642
  }
includes/iworks/rate/admin.css ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .iworks-rate {
2
+ font-family: "Exo 2", sans-serif;
3
+ padding: 20px 30px; }
4
+ .iworks-rate h4 {
5
+ margin: 10px 0 0;
6
+ padding: 4px 38px 4px 0;
7
+ font-size: 16px;
8
+ font-weight: 500;
9
+ line-height: 1.618;
10
+ --logo: attr(data-logo); }
11
+ .iworks-rate h4 strong {
12
+ font-weight: 900; }
13
+ .iworks-rate p {
14
+ font-size: 14px;
15
+ max-width: 800px;
16
+ line-height: 1.618;
17
+ margin: 0 0 10px;
18
+ padding: 4px 0; }
19
+ .iworks-rate.has-logo h4 {
20
+ display: flex;
21
+ align-items: center; }
22
+
23
+ .iworks-rate-logo {
24
+ display: block;
25
+ width: 3em;
26
+ height: 3em;
27
+ margin-right: .3em;
28
+ content: "";
29
+ background-color: transparent;
30
+ background-repeat: no-repeat;
31
+ background-position: 50%;
32
+ background-size: contain; }
33
+
34
+ .iworks-rate-buttons {
35
+ margin-top: -10px;
36
+ padding: 10px 2px;
37
+ overflow: hidden; }
38
+ .iworks-rate-buttons .iworks-rate-button {
39
+ float: left;
40
+ margin: 20px 20px 0 0; }
41
+
42
+ .iworks-rate-button {
43
+ margin: 20px auto;
44
+ position: relative;
45
+ display: inline-block;
46
+ min-width: 180px;
47
+ padding: 9px 30px;
48
+ font-weight: 500;
49
+ font-size: 14px;
50
+ line-height: 1.618;
51
+ text-align: center;
52
+ text-decoration: none;
53
+ background-color: #fff;
54
+ opacity: 1;
55
+ box-sizing: border-box;
56
+ box-shadow: none;
57
+ outline: none;
58
+ border: 1px solid transparent;
59
+ transition: color 0.3s !important;
60
+ z-index: 10;
61
+ cursor: pointer; }
62
+ .iworks-rate-button--green {
63
+ border-color: #46b450;
64
+ color: #46b450; }
65
+ .iworks-rate-button--green:after {
66
+ background-color: #46b450; }
67
+ .iworks-rate-button--green:focus {
68
+ color: #46b450;
69
+ box-shadow: 0 0 0 1px #46b450, 0 0 2px 1px rgba(79, 148, 212, 0.8);
70
+ outline: 1px solid transparent; }
71
+ .iworks-rate-button--green:hover {
72
+ color: #fff;
73
+ background-color: #46b450; }
74
+ .iworks-rate-button--blue {
75
+ border-color: #0073aa;
76
+ color: #0073aa; }
77
+ .iworks-rate-button--blue:after {
78
+ background-color: #0073aa; }
79
+ .iworks-rate-button--blue:focus {
80
+ box-shadow: 0 0 0 1px #0073aa, 0 0 2px 1px rgba(79, 148, 212, 0.8);
81
+ color: #0073aa;
82
+ outline: 1px solid transparent; }
83
+ .iworks-rate-button--blue:hover {
84
+ color: #fff;
85
+ background-color: #0073aa; }
86
+ .iworks-rate-button:before {
87
+ float: left;
88
+ margin-right: 10px;
89
+ font-family: dashicons;
90
+ font-size: 20px;
91
+ line-height: 1.1; }
92
+ .iworks-rate-button:after {
93
+ content: "";
94
+ position: absolute;
95
+ top: 0;
96
+ left: 0;
97
+ width: 0;
98
+ bottom: 0;
99
+ transition: all ease .3s;
100
+ z-index: -1; }
101
+ .iworks-rate-button:hover:after {
102
+ width: 100%; }
103
+
104
+ .iworks-rate-center {
105
+ text-align: center; }
106
+
107
+ /*# sourceMappingURL=admin.css.map */
includes/iworks/rate/admin.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(
2
+ function() {
3
+ var $parent = jQuery('.notice-iworks-rate');
4
+ jQuery('.iworks-rate-button, .notice-dismiss', $parent).on('click', function(e) {
5
+ var data = {
6
+ action: 'iworks_rate_button',
7
+ plugin_id: $parent.data('id'),
8
+ button: jQuery(this).data('action')
9
+ };
10
+ if ('get-help' === jQuery(this).data('action')) {
11
+ return true;
12
+ }
13
+ jQuery.post(
14
+ $parent.data('ajax-url'),
15
+ data,
16
+ function(response) {
17
+ $parent.detach();
18
+ }
19
+ );
20
+ return true;
21
+ });
22
+ }
23
+ );
includes/iworks/rate/admin.scss ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $au: 1.618;
2
+
3
+
4
+ $color_blue: #0073aa;
5
+ $color_green: #46b450;
6
+ $color_white: #fff;
7
+
8
+ .iworks-rate {
9
+ font-family: "Exo 2", sans-serif;
10
+ padding: 20px 30px;
11
+ h4 {
12
+ margin: 10px 0 0;
13
+ padding: 4px 38px 4px 0;
14
+ font: {
15
+ size: 16px;
16
+ weight: 500;
17
+ }
18
+ strong {
19
+ font-weight: 900;
20
+ }
21
+ line-height: $au;
22
+ --logo: attr(data-logo);
23
+ }
24
+ p {
25
+ font-size: 14px;
26
+ max-width: 800px;
27
+ line-height: $au;
28
+ margin: 0 0 10px;
29
+ padding: 4px 0;
30
+ }
31
+ &.has-logo {
32
+ h4 {
33
+ display: flex;
34
+ align-items: center;
35
+ }
36
+ }
37
+ }
38
+
39
+ .iworks-rate-logo {
40
+ display: block;
41
+ width: 3em;
42
+ height: 3em;
43
+ margin-right: .3em;
44
+ content: "";
45
+ background: {
46
+ color: transparent;
47
+ repeat: no-repeat;
48
+ position: 50%;
49
+ size: contain;
50
+ }
51
+ }
52
+
53
+ .iworks-rate-buttons {
54
+ margin-top: -10px;
55
+ padding: 10px 2px;
56
+ overflow: hidden;
57
+ .iworks-rate-button {
58
+ float: left;
59
+ margin: 20px 20px 0 0;
60
+ }
61
+ }
62
+
63
+ .iworks-rate-button {
64
+ margin: 20px auto;
65
+ position: relative;
66
+ display: inline-block;
67
+ min-width: 180px;
68
+ padding: 9px 30px;
69
+ font: {
70
+ weight: 500;
71
+ size: 14px;
72
+ }
73
+ line-height: $au;
74
+ text: {
75
+ align: center;
76
+ decoration: none;
77
+ }
78
+ background-color: $color_white;
79
+ opacity: 1;
80
+ box-sizing: border-box;
81
+ box-shadow: none;
82
+ outline: none;
83
+ border: 1px solid transparent;
84
+ transition: color .3s!important;
85
+ z-index: 10;
86
+ cursor: pointer;
87
+ &--green {
88
+ border-color: $color_green;
89
+ color: $color_green;
90
+ &:after {
91
+ background-color: $color_green;
92
+ }
93
+ &:focus {
94
+ color: $color_green;
95
+ box-shadow: 0 0 0 1px $color_green,0 0 2px 1px rgba(79,148,212,.8);
96
+ outline: 1px solid transparent
97
+ }
98
+ &:hover {
99
+ color: $color_white;
100
+ background-color: $color_green;
101
+ }
102
+ }
103
+ &--blue {
104
+ border-color: $color_blue;
105
+ color: $color_blue;
106
+ &:after {
107
+ background-color: $color_blue;
108
+ }
109
+ &:focus {
110
+ box-shadow: 0 0 0 1px $color_blue,0 0 2px 1px rgba(79,148,212,.8);
111
+ color: $color_blue;
112
+ outline: 1px solid transparent
113
+ }
114
+ &:hover {
115
+ color: $color_white;
116
+ background-color: $color_blue;
117
+ }
118
+ }
119
+ &:before{
120
+ float: left;
121
+ margin-right: 10px;
122
+ font-family: dashicons;
123
+ font-size: 20px;
124
+ line-height: 1.1;
125
+ }
126
+ &:after {
127
+ content: "";
128
+ position: absolute;
129
+ top: 0;
130
+ left: 0;
131
+ width: 0;
132
+ bottom: 0;
133
+ transition: all ease .3s;
134
+ z-index: -1;
135
+ }
136
+ &:hover {
137
+ &:after {
138
+ width: 100%;
139
+ }
140
+ }
141
+ }
142
+
143
+ .iworks-rate-center {
144
+ text-align: center;
145
+ }
146
+
{vendor → includes}/iworks/rate/iworks-logo.svg RENAMED
File without changes
includes/iworks/rate/rate.php ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * iWorks_Rate - Dashboard Notification module.
4
+ *
5
+ * @version 2.0.1
6
+ * @author iworks (Marcin Pietrzak)
7
+ *
8
+ */
9
+ if ( ! class_exists( 'iworks_rate' ) ) {
10
+ class iworks_rate {
11
+
12
+ /**
13
+ * This class version.
14
+ *
15
+ * @since 1.0.1
16
+ * @var string
17
+ */
18
+ private $version = '2.0.0';
19
+
20
+ /**
21
+ * $wpdb->options field name.
22
+ *
23
+ * @since 1.0.0
24
+ * @var string
25
+ */
26
+ protected $option_name = 'iworks_rates';
27
+
28
+ /**
29
+ * List of all registered plugins.
30
+ *
31
+ * @since 1.0.0
32
+ * @var array
33
+ */
34
+ protected $plugins = array();
35
+
36
+ /**
37
+ * Module options that are stored in database.
38
+ * Timestamps are stored here.
39
+ *
40
+ * Note that this option is stored in site-meta for multisite installs.
41
+ *
42
+ * @since 1.0.0
43
+ * @var array
44
+ */
45
+ protected $stored = array();
46
+
47
+ /**
48
+ * Initializes and returns the singleton instance.
49
+ *
50
+ * @since 1.0.0
51
+ */
52
+ static public function instance() {
53
+ static $Inst = null;
54
+ if ( null === $Inst ) {
55
+ $Inst = new iworks_rate();
56
+ }
57
+ return $Inst;
58
+ }
59
+
60
+ /**
61
+ * Set up the iworks_rate module. Private singleton constructor.
62
+ *
63
+ * @since 1.0.0
64
+ */
65
+ private function __construct() {
66
+ /**
67
+ * settings
68
+ */
69
+ $this->stored = wp_parse_args(
70
+ get_site_option( $this->option_name, false, false ),
71
+ array()
72
+ );
73
+ /**
74
+ * actions
75
+ */
76
+ add_action( 'load-index.php', array( $this, 'load' ) );
77
+ add_action( 'iworks-register-plugin', array( $this, 'register' ), 5, 3 );
78
+ add_action( 'wp_ajax_iworks_rate_button', array( $this, 'ajax_button' ) );
79
+ /**
80
+ * own hooks
81
+ */
82
+ add_filter( 'iworks_rate_assistance', array( $this, 'filter_get_assistance_widget' ), 10, 2 );
83
+ add_filter( 'iworks_rate_love', array( $this, 'filter_get_love_widget' ), 10, 2 );
84
+ }
85
+
86
+ public function load() {
87
+ $plugin_id = $this->choose_plugin();
88
+ if ( empty( $plugin_id ) ) {
89
+ return;
90
+ }
91
+ $this->plugin_id = $plugin_id;
92
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
93
+ add_action( 'admin_notices', array( $this, 'show' ) );
94
+ }
95
+
96
+ /**
97
+ * Save persistent module-data to the WP database.
98
+ *
99
+ * @since 1.0.0
100
+ */
101
+ protected function store_data() {
102
+ update_site_option( $this->option_name, $this->stored );
103
+ }
104
+
105
+ /**
106
+ * Action handler for 'iworks-register-plugin'
107
+ * Register an active plugin.
108
+ *
109
+ * @since 1.0.0
110
+ * @param string $plugin_id WordPress plugin-ID (see: plugin_basename).
111
+ * @param string $title Plugin name for display.
112
+ * @param string $slug the plugin slug on wp.org
113
+ */
114
+ public function register( $plugin_id, $title, $slug ) {
115
+ // Ignore incorrectly registered plugins to avoid errors later.
116
+ if ( empty( $plugin_id ) || empty( $title ) || empty( $slug ) ) {
117
+ return;
118
+ }
119
+ $data = array(
120
+ 'title' => $title,
121
+ 'slug' => $slug,
122
+ );
123
+ $this->plugins[ $plugin_id ] = $data;
124
+ /*
125
+ * When the plugin is registered the first time we store some infos
126
+ * in the persistent module-data that help us later to find out
127
+ * if/which message should be displayed.
128
+ */
129
+ if ( empty( $this->stored[ $plugin_id ] ) ) {
130
+ $this->stored[ $plugin_id ] = wp_parse_args(
131
+ array(
132
+ 'registered' => time(),
133
+ 'show_at' => time() + rand( 7, 14 ) * DAY_IN_SECONDS,
134
+ 'rated' => 0,
135
+ 'hide' => 0,
136
+ ),
137
+ $data
138
+ );
139
+ // Finally save the details.
140
+ $this->store_data();
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Ajax handler called when the user chooses the CTA button.
146
+ *
147
+ * @since 1.0.0
148
+ */
149
+ public function ajax_button() {
150
+ $plugin_id = filter_input( INPUT_POST, 'plugin_id', FILTER_SANITIZE_STRING );
151
+ if ( empty( $plugin_id ) ) {
152
+ wp_send_json_error();
153
+ }
154
+ if ( ! isset( $this->plugins[ $plugin_id ] ) ) {
155
+ wp_send_json_error();
156
+ }
157
+ switch ( filter_input( INPUT_POST, 'button', FILTER_SANITIZE_STRING ) ) {
158
+ case '':
159
+ case 'add-review':
160
+ $this->add_weeks( $plugin_id );
161
+ wp_send_json_success();
162
+ case 'hide':
163
+ $this->add_weeks( $plugin_id );
164
+ $this->hide( $plugin_id );
165
+ wp_send_json_success();
166
+ case 'donate':
167
+ $this->add_months( $plugin_id );
168
+ wp_send_json_success();
169
+ }
170
+ wp_send_json_success();
171
+ }
172
+
173
+ public function hide( $plugin_id ) {
174
+ if ( ! isset( $this->stored[ $plugin_id ] ) ) {
175
+ return;
176
+ }
177
+ $this->stored[ $plugin_id ]['rated'] = time();
178
+ $this->store_data();
179
+ }
180
+
181
+ private function add_weeks( $plugin_id ) {
182
+ if ( ! isset( $this->stored[ $plugin_id ] ) ) {
183
+ return;
184
+ }
185
+ $this->stored[ $plugin_id ]['show_at'] = time() + rand( 2, 3 ) * WEEK_IN_SECONDS + rand( 0, 3 ) * DAY_IN_SECONDS;
186
+ $this->store_data();
187
+ }
188
+
189
+ private function add_months( $plugin_id ) {
190
+ if ( ! isset( $this->stored[ $plugin_id ] ) ) {
191
+ return;
192
+ }
193
+ $this->stored[ $plugin_id ]['show_at'] = time() + rand( 10, 15 ) * WEEK_IN_SECONDS + rand( 0, 7 ) * DAY_IN_SECONDS;
194
+ $this->store_data();
195
+ }
196
+
197
+ /**
198
+ * Ajax handler called when the user chooses the dismiss button.
199
+ *
200
+ * @since 1.0.0
201
+ */
202
+ public function dismiss() {
203
+ $plugin = $this->get_plugin_from_post();
204
+ if ( is_wp_error( $plugin ) ) {
205
+ wp_send_json_error();
206
+ }
207
+ wp_send_json_success();
208
+ }
209
+
210
+ /**
211
+ * Action handler for 'load-index.php'
212
+ * Set-up the Dashboard notification.
213
+ *
214
+ * @since 1.0.0
215
+ */
216
+ public function enqueue() {
217
+ wp_enqueue_style(
218
+ __CLASS__,
219
+ plugin_dir_url( __FILE__ ) . 'admin.css',
220
+ array(),
221
+ $this->version
222
+ );
223
+ wp_enqueue_script(
224
+ __CLASS__,
225
+ plugin_dir_url( __FILE__ ) . 'admin.js',
226
+ array(),
227
+ $this->version,
228
+ true
229
+ );
230
+ }
231
+
232
+ /**
233
+ * Action handler for 'admin_notices'
234
+ * Display the Dashboard notification.
235
+ *
236
+ * @since 1.0.0
237
+ */
238
+ public function show() {
239
+ $this->render_message( $this->plugin_id );
240
+ }
241
+
242
+ /**
243
+ * Check to see if there is a pending message to display and returns
244
+ * the message details if there is.
245
+ *
246
+ * Note that this function is only called on the main Dashboard screen
247
+ * and only when logged in as super-admin.
248
+ *
249
+ * @since 1.0.0
250
+ * @return object|false
251
+ * string $plugin WordPress plugin ID?
252
+ */
253
+ protected function choose_plugin() {
254
+ if ( wp_is_mobile() ) {
255
+ return false;
256
+ }
257
+ /**
258
+ * list
259
+ */
260
+ $choosen = array();
261
+ /**
262
+ * change time by filter
263
+ */
264
+ $now = apply_filters( 'iworks_rate_set_custom_time', time() );
265
+ foreach ( $this->stored as $plugin_id => $item ) {
266
+ if ( ! isset( $this->plugins[ $plugin_id ] ) ) {
267
+ if ( isset( $this->stored[ $plugin_id ] ) ) {
268
+ unset( $this->stored[ $plugin_id ] );
269
+ $this->store_data();
270
+ }
271
+ continue;
272
+ }
273
+ if ( intval( $item['show_at'] ) > $now ) {
274
+ continue;
275
+ }
276
+ $choosen[] = $plugin_id;
277
+ }
278
+ if ( empty( $choosen ) ) {
279
+ return false;
280
+ }
281
+ return $choosen[ array_rand( $choosen ) ];
282
+ }
283
+
284
+ /**
285
+ * Renders the actual Notification message.
286
+ *
287
+ * @since 1.0.0
288
+ */
289
+ protected function render_message( $plugin_id ) {
290
+ $file = $this->get_file( 'thanks' );
291
+ $plugin = $this->get_plugin_data_by_plugin_id( $plugin_id );
292
+ load_template( $file, true, $plugin );
293
+ }
294
+
295
+ /**
296
+ * @since 2.0.1
297
+ */
298
+ private function get_file( $file, $group = '' ) {
299
+ return sprintf(
300
+ '%s/templates/%s%s%s.php',
301
+ dirname( __FILE__ ),
302
+ $group,
303
+ '' === $group ? '' : '/',
304
+ sanitize_title( $file )
305
+ );
306
+ }
307
+
308
+ /**
309
+ * @since 2.0.1
310
+ */
311
+ private function get_plugin_data_by_plugin_id( $plugin_id ) {
312
+ $plugin = wp_parse_args(
313
+ $this->plugins[ $plugin_id ],
314
+ $this->stored[ $plugin_id ]
315
+ );
316
+ $plugin['plugin_id'] = $plugin_id;
317
+ $plugin['logo'] = apply_filters( 'iworks_rate_notice_logo_style', '', $plugin );
318
+ $plugin['ajax_url'] = admin_url( 'admin-ajax.php' );
319
+ $plugin['classes'] = array(
320
+ 'iworks-rate',
321
+ 'iworks-rate-' . $plugin['slug'],
322
+ 'iworks-rate-notice',
323
+ );
324
+ if ( ! empty( $plugin['logo'] ) ) {
325
+ $plugin['classes'][] = 'has-logo';
326
+ }
327
+ $plugin['url'] = esc_url(
328
+ sprintf(
329
+ _x( 'https://wordpress.org/plugins/%s/', 'plugins home', 'sierotki' ),
330
+ $plugin['slug']
331
+ )
332
+ );
333
+ $plugin['support_url'] = esc_url(
334
+ sprintf(
335
+ _x( 'https://wordpress.org/support/plugin/%s/', 'plugins support home', 'sierotki' ),
336
+ $plugin['slug']
337
+ )
338
+ );
339
+ return $plugin;
340
+ }
341
+
342
+ /**
343
+ * @since 2.0.1
344
+ */
345
+ private function get_plugin_id_by_slug( $slug ) {
346
+ foreach ( $this->stored as $plugin_id => $plugin ) {
347
+ if ( $slug === $plugin['slug'] ) {
348
+ return $plugin_id;
349
+ }
350
+ }
351
+ return new WP_Error();
352
+ }
353
+
354
+ /**
355
+ * @since 2.0.1
356
+ */
357
+ public function filter_get_assistance_widget( $content, $slug ) {
358
+ $plugin_id = $this->get_plugin_id_by_slug( $slug );
359
+ if ( is_wp_error( $plugin_id ) ) {
360
+ return $content;
361
+ }
362
+ $this->enqueue();
363
+ $plugin = $this->get_plugin_data_by_plugin_id( $plugin_id );
364
+ $file = $this->get_file( 'support', 'widgets' );
365
+ ob_start();
366
+ load_template( $file, true, $plugin );
367
+ $content = ob_get_contents();
368
+ ob_end_clean();
369
+ return $content;
370
+ }
371
+
372
+ /**
373
+ * @since 2.0.1
374
+ */
375
+ public function filter_get_love_widget( $content, $slug ) {
376
+ $plugin_id = $this->get_plugin_id_by_slug( $slug );
377
+ if ( is_wp_error( $plugin_id ) ) {
378
+ return $content;
379
+ }
380
+ $this->enqueue();
381
+ $plugin = $this->get_plugin_data_by_plugin_id( $plugin_id );
382
+ $file = $this->get_file( 'donate', 'widgets' );
383
+ ob_start();
384
+ load_template( $file, true, $plugin );
385
+ $content = ob_get_contents();
386
+ ob_end_clean();
387
+ return $content;
388
+ }
389
+ }
390
+
391
+ // Initialize the module.
392
+ iworks_rate::instance();
393
+ }
includes/iworks/rate/templates/thanks.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Notice displayed in admin panel.
4
+ */
5
+ ?>
6
+ <div class="notice notice-success is-dismissible notice-iworks-rate"
7
+ data-slug="<?php echo esc_attr( $args['slug'] ); ?>"
8
+ data-id="<?php echo esc_attr( $args['plugin_id'] ); ?>"
9
+ data-ajax-url="<?php echo esc_url( $args['ajax_url'] ); ?>"
10
+ >
11
+ <div class="<?php echo esc_attr( implode( ' ', $args['classes'] ) ); ?>">
12
+ <h4>
13
+ <?php
14
+ if ( ! empty( $args['logo'] ) ) {
15
+ printf( '<span class="iworks-rate-logo" style="background-image:url(%s)"></span>', esc_url( $args['logo'] ) ); }
16
+ ?>
17
+ <span><?php printf( esc_html( __( 'Thank you for using our plugin %s!', 'sierotki' ) ), sprintf( '<strong>%s</strong>', $args['title'] ) ); ?></span></h4>
18
+ <?php
19
+ /* translators: %1$s: open anchor tag, %2$s: close anchor tag */
20
+ $content = __( 'Please let us know what you think about our plugin. It is important that we can develop this tool. Thank you for all the ratings, reviews and donates. If you have a technical problem, please before you add a review %1$scheck our FAQ%2$s or contact us if you did not find help there. We will try to help you!', 'sierotki' );
21
+ echo wpautop( wp_kses_post( sprintf( $content, sprintf( '<a href="%s#faq" target="_blank">', $args['url'] ), '</a>' ) ) );
22
+ ?>
23
+ <div class="iworks-rate-buttons">
24
+ <a data-action="get-help" href="<?php echo $args['support_url']; ?>/#new-post" target="_blank" class="iworks-rate-button iworks-rate-button--green" ><?php echo esc_html( __( 'Get help', 'sierotki' ) ); ?></a>
25
+ <?php if ( intval( $args['rated'] ) === 0 ) { ?>
26
+ <a data-action="add-review" href="<?php echo $args['support_url']; ?>reviews/?rate=5#new-post" target="_blank" class="iworks-rate-button iworks-rate-button--green" ><?php echo esc_html( __( 'Add review', 'sierotki' ) ); ?></a>
27
+ <?php } ?>
28
+ <a data-action="donate" href="https://ko-fi.com/iworks/?utm_source=<?php echo $args['slug']; ?>&utm_medium=notice-thanks" target="_blank" class="iworks-rate-button iworks-rate-button--green dashicons-heart" ><?php echo esc_html( __( 'Provide us a coffee', 'sierotki' ) ); ?></a>
29
+ <?php if ( intval( $args['rated'] ) === 0 ) { ?>
30
+ <button type="button" data-action="hide" class="iworks-rate-button iworks-rate-button--blue" ><?php echo esc_html( __( 'I added review, do not show again', 'sierotki' ) ); ?></button>
31
+ <?php } ?>
32
+ </div>
33
+ </div>
34
+ </div>
includes/iworks/rate/templates/widgets/donate.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <p><?php echo wp_kses_post( __( 'However, working on plugins and technical support requires many hours of work. If you want to appreciate it, you can provide me a coffee.', 'sierotki' ) ); ?></p>
2
+ <p><?php echo wp_kses_post( __( 'If every plugin user did it, I could devote myself fully to working on this plugin. Thanks everyone!', 'sierotki' ) ); ?></p>
3
+ <p class="iworks-rate-center"><a href="https://ko-fi.com/iworks/?utm_source=<?php echo $args['slug']; ?>&utm_medium=widget-donate" target="_blank" class="iworks-rate-button iworks-rate-button--blue dashicons-heart"><?php echo esc_html( __( 'Provide me a coffee', 'sierotki' ) ); ?></a></p>
4
+
includes/iworks/rate/templates/widgets/support.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ <?php
3
+ echo wp_kses_post(
4
+ __( 'Do you have a technical problem? Please contact us. We will be happy to help you. Or maybe you have an idea for a new feature? Please let us know about it by filling the support form. We will try to add it!', 'sierotki' )
5
+ );
6
+ ?>
7
+ </p>
8
+ <p>
9
+ <?php
10
+ echo wp_kses_post(
11
+ sprintf(
12
+ /* translators: %1$s: open anchor tag, %2$s: close anchor tag, %3$s: open anchor tag, %4$s: close anchor tag */
13
+ __( 'Please %1$scheck our FAQ%2$s before adding a thread with technical problem. If you do not find help there, %3$scheck support forum%4$s for similar problems.', 'sierotki' ),
14
+ '<a href="' . $args['url'] . '#faq" target="_blank">',
15
+ '</a>',
16
+ '<a href="' . $args['support_url'] . '" target="_blank">',
17
+ '</a>'
18
+ )
19
+ );
20
+ ?>
21
+ </p>
22
+ <p class="iworks-rate-center">
23
+ <a href="<?php echo $args['support_url']; ?>#new-post" target="_blank" class="iworks-rate-button iworks-rate-button--blue" ><?php echo esc_html( __( 'Get help', 'sierotki' ) ); ?></a>
24
+ </p>
25
+ <p>
26
+ <?php
27
+ echo wp_kses_post(
28
+ __( 'Do you like our plugin? Could you rate him? Please let us know what you think about our plugin. It is important that we can develop this tool. Thank you for all the ratings, reviews and donates.', 'sierotki' )
29
+ );
30
+ ?>
31
+ </p>
32
+ <p class="iworks-rate-center">
33
+ <a href="<?php echo add_query_arg( 'rate', '5', $args['support_url'] . 'reviews/' ); ?>#new-post" target="_blank" class="iworks-rate-button iworks-rate-button--blue" ><?php echo esc_html( __( 'Add review', 'sierotki' ) ); ?></a>
34
+ </p>
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: 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"
@@ -152,132 +152,171 @@ msgstr ""
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:237
184
  msgid "An error occurred while getting the configuration."
185
  msgstr ""
186
 
187
- #: vendor/iworks/options/options.php:734
188
  msgid "Upload image"
189
  msgstr ""
190
 
191
- #: vendor/iworks/options/options.php:740
192
  msgid "Delete image"
193
  msgstr ""
194
 
195
- #: vendor/iworks/options/options.php:808
196
  msgid "Save Changes"
197
  msgstr ""
198
 
199
- #: vendor/iworks/options/options.php:1598
200
  msgid "Country"
201
  msgstr ""
202
 
203
- #: vendor/iworks/options/options.php:1599
204
  msgid "City"
205
  msgstr ""
206
 
207
- #: vendor/iworks/options/options.php:1600
208
  msgid "Street"
209
  msgstr ""
210
 
211
- #: vendor/iworks/options/options.php:1601
212
  msgid "ZIP code"
213
  msgstr ""
214
 
215
- #: vendor/iworks/options/options.php:1754
216
  msgid "OFF"
217
  msgstr ""
218
 
219
- #: vendor/iworks/options/options.php:1755
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
 
255
- #: vendor/iworks/rate/rate.php:373
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  msgid ""
257
- "Hey %1$s, you've been using %2$s for a while now, and we hope you're happy "
258
- "with it."
259
  msgstr ""
260
 
261
- #: vendor/iworks/rate/rate.php:373
262
  msgid ""
263
- "We've spent countless hours developing this free plugin for you, and we "
264
- "would really appreciate it if you dropped us a quick rating!"
265
  msgstr ""
266
 
267
- #: vendor/iworks/rate/rate.php:388
268
- msgid "Thanks :)"
269
  msgstr ""
270
 
271
- #: vendor/iworks/rate/rate.php:391
272
- msgid "Rate %s"
 
 
 
273
  msgstr ""
274
 
275
- #: vendor/iworks/rate/rate.php:396
276
- msgid "Saving"
 
 
 
 
 
277
  msgstr ""
278
 
279
- #: vendor/iworks/rate/rate.php:397
280
- msgid "No thanks"
 
 
 
281
  msgstr ""
282
 
283
  #. Plugin URI of the plugin/theme
@@ -296,12 +335,22 @@ msgstr ""
296
  msgid "http://iworks.pl/"
297
  msgstr ""
298
 
299
- #: etc/options.php:205
300
  msgctxt "plugin home page on WordPress.org"
301
  msgid "https://wordpress.org/plugins/sierotki/"
302
  msgstr ""
303
 
304
- #: etc/options.php:235
305
  msgctxt "link to support forum on WordPress.org"
306
  msgid "https://wordpress.org/support/plugin/sierotki/"
 
 
 
 
 
 
 
 
 
 
307
  msgstr ""
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-06-23 20:30:07+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
152
  msgid "Use a comma to separate custom fields name."
153
  msgstr ""
154
 
155
+ #: etc/options.php:183 etc/options.php:242
156
+ msgid "We are waiting for your message"
157
  msgstr ""
158
 
159
  #: etc/options.php:189
160
+ msgid "I love what I do!"
161
  msgstr ""
162
 
163
+ #: etc/options.php:206
164
  msgid "Below are some links to help spread this plugin to other users"
165
  msgstr ""
166
 
167
+ #: etc/options.php:208
168
  msgid "Give it a five stars on WordPress.org"
169
  msgstr ""
170
 
171
+ #: etc/options.php:209
172
  msgid "Link to it so others can easily find it"
173
  msgstr ""
174
 
175
+ #: etc/options.php:244
 
 
 
 
176
  msgid "WordPress Help Forum"
177
  msgstr ""
178
 
179
+ #: includes/iworks/options/options.php:237
180
  msgid "An error occurred while getting the configuration."
181
  msgstr ""
182
 
183
+ #: includes/iworks/options/options.php:734
184
  msgid "Upload image"
185
  msgstr ""
186
 
187
+ #: includes/iworks/options/options.php:740
188
  msgid "Delete image"
189
  msgstr ""
190
 
191
+ #: includes/iworks/options/options.php:808
192
  msgid "Save Changes"
193
  msgstr ""
194
 
195
+ #: includes/iworks/options/options.php:1598
196
  msgid "Country"
197
  msgstr ""
198
 
199
+ #: includes/iworks/options/options.php:1599
200
  msgid "City"
201
  msgstr ""
202
 
203
+ #: includes/iworks/options/options.php:1600
204
  msgid "Street"
205
  msgstr ""
206
 
207
+ #: includes/iworks/options/options.php:1601
208
  msgid "ZIP code"
209
  msgstr ""
210
 
211
+ #: includes/iworks/options/options.php:1754
212
  msgid "OFF"
213
  msgstr ""
214
 
215
+ #: includes/iworks/options/options.php:1755
216
  msgid "ON"
217
  msgstr ""
218
 
219
+ #: includes/iworks/orphan.php:272
220
  msgid "Plugin fix some Polish gramary rules with orphans."
221
  msgstr ""
222
 
223
+ #: includes/iworks/orphan.php:279
224
  msgid "For more information:"
225
  msgstr ""
226
 
227
+ #: includes/iworks/orphan.php:280
228
  msgid ""
229
  "<a href=\"http://wordpress.org/extend/plugins/sierotki/\" "
230
  "target=\"_blank\">Plugin Homepage</a>"
231
  msgstr ""
232
 
233
+ #: includes/iworks/orphan.php:281
234
  msgid ""
235
  "<a href=\"http://wordpress.org/support/plugin/sierotki/\" "
236
  "target=\"_blank\">Support Forums</a>"
237
  msgstr ""
238
 
239
+ #: includes/iworks/orphan.php:282
240
  msgid "<a href=\"http://iworks.pl/en/\" target=\"_blank\">break the web</a>"
241
  msgstr ""
242
 
243
+ #: includes/iworks/orphan.php:384
244
  msgid "Settings"
245
  msgstr ""
246
 
247
+ #: includes/iworks/orphan.php:396
248
  msgid "Donate"
249
  msgstr ""
250
 
251
+ #: includes/iworks/rate/templates/thanks.php:17
252
+ msgid "Thank you for using our plugin %s!"
253
+ msgstr ""
254
+
255
+ #: includes/iworks/rate/templates/thanks.php:20
256
+ #. translators: %1$s: open anchor tag, %2$s: close anchor tag
257
+ msgid ""
258
+ "Please let us know what you think about our plugin. It is important that we "
259
+ "can develop this tool. Thank you for all the ratings, reviews and donates. "
260
+ "If you have a technical problem, please before you add a review %1$scheck "
261
+ "our FAQ%2$s or contact us if you did not find help there. We will try to "
262
+ "help you!"
263
+ msgstr ""
264
+
265
+ #: includes/iworks/rate/templates/thanks.php:24
266
+ #: includes/iworks/rate/templates/widgets/support.php:23
267
+ msgid "Get help"
268
+ msgstr ""
269
+
270
+ #: includes/iworks/rate/templates/thanks.php:26
271
+ #: includes/iworks/rate/templates/widgets/support.php:33
272
+ msgid "Add review"
273
+ msgstr ""
274
+
275
+ #: includes/iworks/rate/templates/thanks.php:28
276
+ msgid "Provide us a coffee"
277
+ msgstr ""
278
+
279
+ #: includes/iworks/rate/templates/thanks.php:30
280
+ msgid "I added review, do not show again"
281
+ msgstr ""
282
+
283
+ #: includes/iworks/rate/templates/widgets/donate.php:1
284
  msgid ""
285
+ "However, working on plugins and technical support requires many hours of "
286
+ "work. If you want to appreciate it, you can provide me a coffee."
287
  msgstr ""
288
 
289
+ #: includes/iworks/rate/templates/widgets/donate.php:2
290
  msgid ""
291
+ "If every plugin user did it, I could devote myself fully to working on this "
292
+ "plugin. Thanks everyone!"
293
  msgstr ""
294
 
295
+ #: includes/iworks/rate/templates/widgets/donate.php:3
296
+ msgid "Provide me a coffee"
297
  msgstr ""
298
 
299
+ #: includes/iworks/rate/templates/widgets/support.php:4
300
+ msgid ""
301
+ "Do you have a technical problem? Please contact us. We will be happy to "
302
+ "help you. Or maybe you have an idea for a new feature? Please let us know "
303
+ "about it by filling the support form. We will try to add it!"
304
  msgstr ""
305
 
306
+ #: includes/iworks/rate/templates/widgets/support.php:13
307
+ #. translators: %1$s: open anchor tag, %2$s: close anchor tag, %3$s: open
308
+ #. anchor tag, %4$s: close anchor tag
309
+ msgid ""
310
+ "Please %1$scheck our FAQ%2$s before adding a thread with technical problem. "
311
+ "If you do not find help there, %3$scheck support forum%4$s for similar "
312
+ "problems."
313
  msgstr ""
314
 
315
+ #: includes/iworks/rate/templates/widgets/support.php:28
316
+ msgid ""
317
+ "Do you like our plugin? Could you rate him? Please let us know what you "
318
+ "think about our plugin. It is important that we can develop this tool. "
319
+ "Thank you for all the ratings, reviews and donates."
320
  msgstr ""
321
 
322
  #. Plugin URI of the plugin/theme
335
  msgid "http://iworks.pl/"
336
  msgstr ""
337
 
338
+ #: etc/options.php:209
339
  msgctxt "plugin home page on WordPress.org"
340
  msgid "https://wordpress.org/plugins/sierotki/"
341
  msgstr ""
342
 
343
+ #: etc/options.php:244
344
  msgctxt "link to support forum on WordPress.org"
345
  msgid "https://wordpress.org/support/plugin/sierotki/"
346
+ msgstr ""
347
+
348
+ #: includes/iworks/rate/rate.php:329
349
+ msgctxt "plugins home"
350
+ msgid "https://wordpress.org/plugins/%s/"
351
+ msgstr ""
352
+
353
+ #: includes/iworks/rate/rate.php:335
354
+ msgctxt "plugins support home"
355
+ msgid "https://wordpress.org/support/plugin/%s/"
356
  msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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,6 +109,10 @@ remove_filter( 'orphan_skip_replacement', '__return_true' );
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/).
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.8
7
+ Stable tag: 2.7.9
8
 
9
  Plugin supports some of the grammatical rules of the Polish language.
10
 
109
 
110
  == Changelog ==
111
 
112
+ = 2.7.9 - 2021-06-23 =
113
+ * Renamed directory `vendor` into `includes`.
114
+ * Updated iWorks Rate to 2.0.1.
115
+
116
  = 2.7.8 - 2021-01-13 =
117
  * Added `orphan_replace` filter to add ability to force replacements on any string.
118
  * Turned off content filters for admin area - it could mess with another plugins. Props for [Zbyszek Zalewski](https://profiles.wordpress.org/zalzy/).
sierotki.php CHANGED
@@ -5,24 +5,24 @@ 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.8
9
  Author URI: http://iworks.pl/
10
  */
11
 
12
- include_once dirname( __FILE__ ).'/etc/options.php';
13
 
14
 
15
- $vendor = dirname( __FILE__ ).'/vendor';
16
 
17
- require_once $vendor . '/iworks/orphan.php';
18
  if ( ! class_exists( 'iworks_rate' ) ) {
19
- include_once $vendor . '/iworks/rate/rate.php';
20
  }
21
  /**
22
  * since 2.6.8
23
  */
24
  if ( ! class_exists( 'iworks_options' ) ) {
25
- include_once $vendor.'/iworks/options/options.php';
26
  }
27
 
28
  new iworks_orphan();
5
  Text Domain: sierotki
6
  Description: Implement Polish grammar rules with orphans.
7
  Author: Marcin Pietrzak
8
+ Version: 2.7.9
9
  Author URI: http://iworks.pl/
10
  */
11
 
12
+ include_once dirname( __FILE__ ) . '/etc/options.php';
13
 
14
 
15
+ $includes = dirname( __FILE__ ) . '/includes';
16
 
17
+ require_once $includes . '/iworks/orphan.php';
18
  if ( ! class_exists( 'iworks_rate' ) ) {
19
+ include_once $includes . '/iworks/rate/rate.php';
20
  }
21
  /**
22
  * since 2.6.8
23
  */
24
  if ( ! class_exists( 'iworks_options' ) ) {
25
+ include_once $includes . '/iworks/options/options.php';
26
  }
27
 
28
  new iworks_orphan();
vendor/iworks/rate/admin.css DELETED
@@ -1,163 +0,0 @@
1
- /* ****************************************************************************
2
- * NOTIFICATION STYLES
3
- *
4
- * The styles are identical with the WPMUDEV dashboard CSS (section 22)
5
- * Any changes made here should also be made to the dashboard CSS!
6
- */
7
-
8
- .wrap .iworks-notice.notice {
9
- padding: 0;
10
- margin: 5px 0 10px;
11
- border: 1px solid #E5E5E5;
12
- background: #FFF;
13
- overflow: hidden;
14
- -webkit-border-radius: 6px;
15
- border-radius: 6px;
16
- -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.05);
17
- box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.05);
18
- position: relative;
19
- z-index: 1;
20
- min-height: 80px;
21
- display: table; /* The magic ingredient! */
22
- font: 13px "Open Sans", sans-serif;
23
- }
24
- .wrap .iworks-notice.notice.loading:before {
25
- content: attr(data-message);
26
- position: absolute;
27
- left: 0;
28
- right: 0;
29
- top: 0;
30
- bottom: 0;
31
- background-color: rgba(255, 255, 255, 0.7);
32
- z-index: 5;
33
- text-align: center;
34
- line-height: 80px;
35
- font-size: 22px;
36
- font-weight: bold;
37
- }
38
- .iworks-notice > div {
39
- display: table-cell; /* The magic ingredient! */
40
- vertical-align: middle;
41
- cursor: default;
42
- }
43
- .iworks-notice.notice.loading > div {
44
- -webkit-filter: blur(2px);
45
- -moz-filter: blur(2px);
46
- -o-filter: blur(2px);
47
- -ms-filter: blur(2px);
48
- filter: blur(2px);
49
- }
50
- .iworks-notice-logo {
51
- background: #ddd url(iworks-logo.svg) no-repeat 50% 50%;
52
- background-size: 80%;
53
- }
54
- .iworks-notice-logo span {
55
- display: block;
56
- width: 80px;
57
- }
58
- .iworks-notice-message {
59
- width: 100%;
60
- padding: 10px 20px;
61
- color: #444;
62
- }
63
- .iworks-notice-message strong {
64
- color: #000;
65
- }
66
- .iworks-notice-cta {
67
- border-left: 1px solid #E5E5E5;
68
- background: #F8F8F8;
69
- padding: 0 30px;
70
- position: relative;
71
- white-space: nowrap;
72
- }
73
- .wp-core-ui .iworks-notice-cta button,
74
- .wp-core-ui .iworks-notice-cta .button-primary:active {
75
- vertical-align: middle;
76
- }
77
- .wp-core-ui .iworks-notice-cta input[type="email"] {
78
- vertical-align: middle;
79
- line-height: 20px;
80
- margin: 0;
81
- min-width: 50px;
82
- max-width: 320px;
83
- text-align: center;
84
- padding-left: 0;
85
- padding-right: 0;
86
- }
87
- .iworks-notice-dismiss {
88
- background: transparent;
89
- border: 0;
90
- cursor: pointer;
91
- color: #BBB;
92
- }
93
- .iworks-notice-dismiss:hover {
94
- color: #666;
95
- }
96
-
97
- @media only all and (max-width: 1200px) {
98
- .iworks-notice-dismiss {
99
- display: block;
100
- margin: 0 auto;
101
- line-height: 18px;
102
- padding-top: 8px;
103
- padding-bottom: 2px;
104
- }
105
- }
106
-
107
- @media only all and (max-width: 1000px) {
108
- .wrap .iworks-notice.notice {
109
- display: block;
110
- font-size: 13px;
111
- }
112
- .iworks-notice > .iworks-notice-logo {
113
- float: left;
114
- display: inline-block;
115
- height: 80px;
116
- margin: 10px;
117
- border-radius: 4px;
118
- }
119
- .iworks-notice > .iworks-notice-message {
120
- width: auto;
121
- display: block;
122
- padding: 10px;
123
- min-height: 80px;
124
- }
125
- .iworks-notice > .iworks-notice-cta {
126
- display: block;
127
- border-top: 1px solid #E5E5E5;
128
- border-left: 0;
129
- text-align: center;
130
- white-space: normal;
131
- line-height: 30px;
132
- padding: 10px 20px;
133
- }
134
- .wp-core-ui .iworks-notice > .iworks-notice-cta > input[type="email"],
135
- .iworks-notice > .iworks-notice-cta > button {
136
- font-size: 14px;
137
- }
138
- .iworks-notice > .iworks-notice-cta > .iworks-notice-dismiss {
139
- display: inline-block;
140
- float: none;
141
- line-height: 26px;
142
- padding-top: 0;
143
- padding-bottom: 0;
144
- font-size: 13px;
145
- }
146
- }
147
-
148
- @media only all and (max-width: 500px) {
149
- .wp-core-ui .iworks-notice > .iworks-notice-cta > input[type="email"],
150
- .iworks-notice > .iworks-notice-cta > button {
151
- display: block;
152
- width: 100% !important;
153
- max-width: none;
154
- margin-bottom: 4px;
155
- font-size: 16px;
156
- height: 34px;
157
- }
158
- .iworks-notice > .iworks-notice-cta > .iworks-notice-dismiss {
159
- margin-top: 5px;
160
- font-size: 14px;
161
- height: 23px;
162
- }
163
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/iworks/rate/admin.js DELETED
@@ -1,71 +0,0 @@
1
- jQuery(
2
- function() {
3
- var el_notice = jQuery( ".iworks-notice" ),
4
- plugin_id = el_notice.find( "input[name=plugin_id]" ).val(),
5
- slug = el_notice.find( "input[name=slug]" ).val(),
6
- btn_act = el_notice.find( ".iworks-notice-act" ),
7
- btn_dismiss = el_notice.find( ".iworks-notice-dismiss" )
8
- ajax_data = {};
9
-
10
- ajax_data.plugin_id = plugin_id;
11
-
12
- // Display the notice after the page was loaded.
13
- function initialize() {
14
- el_notice.fadeIn( 500 );
15
- }
16
-
17
- // Hide the notice after a CTA button was clicked
18
- function remove_notice() {
19
- el_notice.fadeTo(
20
- 100 ,
21
- 0,
22
- function() {
23
- el_notice.slideUp(
24
- 100,
25
- function() {
26
- el_notice.remove();
27
- }
28
- );
29
- }
30
- );
31
- }
32
-
33
- // Notify WordPress about the users choice and close the message.
34
- function notify_wordpress( action, message ) {
35
- el_notice.attr( "data-message", message );
36
- el_notice.addClass( "loading" );
37
-
38
- ajax_data.action = action;
39
- jQuery.post(
40
- window.ajaxurl,
41
- ajax_data,
42
- remove_notice
43
- );
44
- }
45
-
46
- // Handle click on the primary CTA button.
47
- // Either open the wp.org page or submit the email address.
48
- btn_act.click(
49
- function( ev ) {
50
- ev.preventDefault();
51
- var url = 'https://wordpress.org/support/plugin/' + slug + '/reviews/?rate=5#new-post';
52
- var link = jQuery( '<a href="' + url + '" target="_blank">Rate</a>' );
53
- link.appendTo( "body" );
54
- link[0].click();
55
- link.remove();
56
- notify_wordpress( "iworks_act", btn_act.data( "msg" ) );
57
- }
58
- );
59
-
60
- // Dismiss the notice without any action.
61
- btn_dismiss.click(
62
- function( ev ) {
63
- ev.preventDefault();
64
-
65
- notify_wordpress( "iworks_dismiss", btn_dismiss.data( "msg" ) );
66
- }
67
- );
68
-
69
- window.setTimeout( initialize, 500 );
70
- }
71
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/iworks/rate/rate.php DELETED
@@ -1,419 +0,0 @@
1
- <?php
2
- /**
3
- * iWorks_Rate - Dashboard Notification module.
4
- *
5
- * @version 1.0.1
6
- * @author iworks (Marcin Pietrzak)
7
- * @author Incsub (Philipp Stracker)
8
- *
9
- * Based on:
10
- *
11
- * WPMUDEV iworks - Free Dashboard Notification module.
12
- * Used by wordpress.org hosted plugins.
13
- *
14
- */
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
- *
29
- * @since 1.0.0
30
- * @var string
31
- */
32
- protected $option_name = 'iworks_rate';
33
-
34
- /**
35
- * List of all registered plugins.
36
- *
37
- * @since 1.0.0
38
- * @var array
39
- */
40
- protected $plugins = array();
41
-
42
- /**
43
- * Module options that are stored in database.
44
- * Timestamps are stored here.
45
- *
46
- * Note that this option is stored in site-meta for multisite installs.
47
- *
48
- * @since 1.0.0
49
- * @var array
50
- */
51
- protected $stored = array();
52
-
53
- /**
54
- * Initializes and returns the singleton instance.
55
- *
56
- * @since 1.0.0
57
- */
58
- static public function instance() {
59
- static $Inst = null;
60
-
61
- if ( null === $Inst ) {
62
- $Inst = new iworks_rate();
63
- }
64
-
65
- return $Inst;
66
- }
67
-
68
- /**
69
- * Set up the iworks_rate module. Private singleton constructor.
70
- *
71
- * @since 1.0.0
72
- */
73
- private function __construct() {
74
- $this->read_stored_data();
75
-
76
- $this->add_action( 'iworks-register-plugin', 5 );
77
- $this->add_action( 'load-index.php' );
78
-
79
- $this->add_action( 'wp_ajax_iworks_act' );
80
- $this->add_action( 'wp_ajax_iworks_dismiss' );
81
- }
82
-
83
- /**
84
- * Load persistent module-data from the WP Database.
85
- *
86
- * @since 1.0.0
87
- */
88
- protected function read_stored_data() {
89
- $data = get_site_option( $this->option_name, false, false );
90
-
91
- if ( ! is_array( $data ) ) {
92
- $data = array();
93
- }
94
-
95
- // A list of all plugins with timestamp of first registration.
96
- if ( ! isset( $data['plugins'] ) || ! is_array( $data['plugins'] ) ) {
97
- $data['plugins'] = array();
98
- }
99
-
100
- // A list with pending messages and earliest timestamp for display.
101
- if ( ! isset( $data['queue'] ) || ! is_array( $data['queue'] ) ) {
102
- $data['queue'] = array();
103
- }
104
-
105
- // A list with all messages that were handles already.
106
- if ( ! isset( $data['done'] ) || ! is_array( $data['done'] ) ) {
107
- $data['done'] = array();
108
- }
109
-
110
- $this->stored = $data;
111
- }
112
-
113
- /**
114
- * Save persistent module-data to the WP database.
115
- *
116
- * @since 1.0.0
117
- */
118
- protected function store_data() {
119
- update_site_option( $this->option_name, $this->stored );
120
- }
121
-
122
- /**
123
- * Action handler for 'iworks-register-plugin'
124
- * Register an active plugin.
125
- *
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 ) ) {
134
- return; }
135
- if ( empty( $title ) ) {
136
- return; }
137
- if ( empty( $slug ) ) {
138
- return; }
139
-
140
- $this->plugins[ $plugin_id ] = (object) array(
141
- 'id' => $plugin_id,
142
- 'title' => $title,
143
- 'slug' => $slug,
144
- );
145
-
146
- /*
147
- * When the plugin is registered the first time we store some infos
148
- * in the persistent module-data that help us later to find out
149
- * if/which message should be displayed.
150
- */
151
- if ( empty( $this->stored['plugins'][ $plugin_id ] ) ) {
152
- // First register the plugin permanently.
153
- $this->stored['plugins'][ $plugin_id ] = time();
154
-
155
- $hash = md5( $plugin_id . '-rate' );
156
- $this->stored['queue'][ $hash ] = array(
157
- 'plugin' => $plugin_id,
158
- 'show_at' => time() + 7 * DAY_IN_SECONDS,
159
- );
160
-
161
- // Finally save the details.
162
- $this->store_data();
163
- }
164
- }
165
-
166
- /**
167
- * Ajax handler called when the user chooses the CTA button.
168
- *
169
- * @since 1.0.0
170
- */
171
- public function wp_ajax_iworks_act() {
172
- $plugin = $_POST['plugin_id'];
173
- $this->mark_as_done( $plugin, 'ok' );
174
- wp_send_json_success();
175
- }
176
-
177
- /**
178
- * Ajax handler called when the user chooses the dismiss button.
179
- *
180
- * @since 1.0.0
181
- */
182
- public function wp_ajax_iworks_dismiss() {
183
- $plugin = $_POST['plugin_id'];
184
- $this->mark_as_done( $plugin, 'ignore' );
185
- wp_send_json_success();
186
- }
187
-
188
- /**
189
- * Action handler for 'load-index.php'
190
- * Set-up the Dashboard notification.
191
- *
192
- * @since 1.0.0
193
- */
194
- public function load_index_php() {
195
- if ( is_super_admin() ) {
196
- $this->add_action( 'all_admin_notices' );
197
- wp_enqueue_style(
198
- __CLASS__,
199
- plugin_dir_url( __FILE__ ) . 'admin.css',
200
- array(),
201
- $this->version
202
- );
203
- wp_enqueue_script(
204
- __CLASS__,
205
- plugin_dir_url( __FILE__ ) . 'admin.js',
206
- array(),
207
- $this->version,
208
- true
209
- );
210
- }
211
- }
212
-
213
- /**
214
- * Action handler for 'admin_notices'
215
- * Display the Dashboard notification.
216
- *
217
- * @since 1.0.0
218
- */
219
- public function all_admin_notices() {
220
- $info = $this->choose_message();
221
- if ( ! $info ) {
222
- return; }
223
-
224
- $this->render_message( $info );
225
- }
226
-
227
- /**
228
- * Check to see if there is a pending message to display and returns
229
- * the message details if there is.
230
- *
231
- * Note that this function is only called on the main Dashboard screen
232
- * and only when logged in as super-admin.
233
- *
234
- * @since 1.0.0
235
- * @return object|false
236
- * string $plugin WordPress plugin ID?
237
- */
238
- protected function choose_message() {
239
- $obj = false;
240
- $chosen = false;
241
- $earliest = false;
242
-
243
- $now = time();
244
-
245
- // The "current" time can be changed via $_GET to test the module.
246
- if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! empty( $_GET['time'] ) ) {
247
- $custom_time = $_GET['time'];
248
- if ( ' ' == $custom_time[0] ) {
249
- $custom_time[0] = '+'; }
250
- if ( $custom_time ) {
251
- $now = strtotime( $custom_time ); }
252
- if ( ! $now ) {
253
- $now = time(); }
254
- }
255
-
256
- $tomorrow = $now + DAY_IN_SECONDS;
257
-
258
- foreach ( $this->stored['queue'] as $hash => $item ) {
259
- $show_at = intval( $item['show_at'] );
260
- $is_sticky = ! empty( $item['sticky'] );
261
-
262
- if ( ! isset( $this->plugins[ $item['plugin'] ] ) ) {
263
- // Deactivated plugin before the message was displayed.
264
- continue;
265
- }
266
- $plugin = $this->plugins[ $item['plugin'] ];
267
-
268
- $can_display = true;
269
- if ( wp_is_mobile() ) {
270
- $can_display = false;
271
- }
272
- if ( $now < $show_at ) {
273
- // Do not display messages that are not due yet.
274
- $can_display = false;
275
- }
276
-
277
- if ( ! $can_display ) {
278
- continue; }
279
-
280
- if ( $is_sticky ) {
281
- // If sticky item is present then choose it!
282
- $chosen = $hash;
283
- break;
284
- } elseif ( ! $earliest || $earliest < $show_at ) {
285
- $earliest = $show_at;
286
- $chosen = $hash;
287
- // Don't use `break` because a sticky item might follow...
288
- // Find the item with the earliest schedule.
289
- }
290
- }
291
-
292
- if ( $chosen ) {
293
- // Make the chosen item sticky.
294
- $this->stored['queue'][ $chosen ]['sticky'] = true;
295
-
296
- // Re-schedule other messages that are due today.
297
- foreach ( $this->stored['queue'] as $hash => $item ) {
298
- $show_at = intval( $item['show_at'] );
299
-
300
- if ( empty( $item['sticky'] ) && $tomorrow > $show_at ) {
301
- $this->stored['queue'][ $hash ]['show_at'] = $tomorrow;
302
- }
303
- }
304
-
305
- // Save the changes.
306
- $this->store_data();
307
-
308
- $obj = (object) $this->stored['queue'][ $chosen ];
309
- }
310
-
311
- return $obj;
312
- }
313
-
314
- /**
315
- * Moves a message from the queue to the done list.
316
- *
317
- * @since 1.0.0
318
- * @param string $plugin Plugin ID.
319
- * @param string $state [ok|ignore] Button clicked.
320
- */
321
- protected function mark_as_done( $plugin, $state ) {
322
- $done_item = false;
323
-
324
- foreach ( $this->stored['queue'] as $hash => $item ) {
325
- unset( $this->stored['queue'][ $hash ]['sticky'] );
326
-
327
- if ( $item['plugin'] == $plugin ) {
328
- $done_item = $item;
329
- unset( $this->stored['queue'][ $hash ] );
330
- }
331
- }
332
-
333
- if ( $done_item ) {
334
- $done_item['state'] = $state;
335
- $done_item['hash'] = $hash;
336
- $done_item['handled_at'] = time();
337
- unset( $done_item['sticky'] );
338
-
339
- $this->stored['done'][] = $done_item;
340
- $this->store_data();
341
- }
342
- }
343
-
344
- /**
345
- * Renders the actual Notification message.
346
- *
347
- * @since 1.0.0
348
- */
349
- protected function render_message( $info ) {
350
- $plugin = $this->plugins[ $info->plugin ];
351
- do_action( 'iworks_rate_css' );
352
- ?>
353
- <div class="notice iworks-notice iworks-notice-rate iworks-notice-<?php echo esc_attr( dirname( $info->plugin ) ); ?>" style="display:none">
354
- <input type="hidden" name="plugin_id" value="<?php echo esc_attr( $info->plugin ); ?>" />
355
- <input type="hidden" name="slug" value="<?php echo esc_attr( $plugin->slug ); ?>" />
356
- <?php
357
- $this->render_rate_message( $plugin );
358
- ?>
359
- </div>
360
- <?php
361
- }
362
-
363
- /**
364
- * Output the contents of the rate-this-plugin message.
365
- * No return value. The code is directly output.
366
- *
367
- * @since 1.0.0
368
- */
369
- protected function render_rate_message( $plugin ) {
370
- $user = wp_get_current_user();
371
- $user_name = $user->display_name;
372
-
373
- $msg = __( "Hey %1\$s, you've been using %2\$s for a while now, and we hope you're happy with it.", 'sierotki' ) . '<br />' . __( "We've spent countless hours developing this free plugin for you, and we would really appreciate it if you dropped us a quick rating!", 'sierotki' );
374
- $msg = apply_filters( 'iworks-rating-message-' . $plugin->id, $msg );
375
-
376
- ?>
377
- <div class="iworks-notice-logo"><span></span></div>
378
- <div class="iworks-notice-message">
379
- <?php
380
- printf(
381
- $msg,
382
- '<strong>' . $user_name . '</strong>',
383
- '<strong>' . $plugin->title . '</strong>'
384
- );
385
- ?>
386
- </div>
387
- <div class="iworks-notice-cta">
388
- <button class="iworks-notice-act button-primary" data-msg="<?php _e( 'Thanks :)', 'sierotki' ); ?>">
389
- <?php
390
- printf(
391
- __( 'Rate %s', 'sierotki' ),
392
- esc_html( $plugin->title )
393
- );
394
- ?>
395
- </button>
396
- <button class="iworks-notice-dismiss" data-msg="<?php _e( 'Saving', 'sierotki' ); ?>">
397
- <?php _e( 'No thanks', 'sierotki' ); ?>
398
- </button>
399
- </div>
400
- <?php
401
- }
402
-
403
- /**
404
- * Registers a new action handler. The callback function has the same
405
- * name as the action hook.
406
- *
407
- * @since 1.0.0
408
- */
409
- protected function add_action( $hook, $params = 1 ) {
410
- $method_name = strtolower( $hook );
411
- $method_name = preg_replace( '/[^a-z0-9]/', '_', $method_name );
412
- $handler = array( $this, $method_name );
413
- add_action( $hook, $handler, 5, $params );
414
- }
415
- }
416
-
417
- // Initialize the module.
418
- iworks_rate::instance();
419
- }