Google Fonts for WordPress - Version 1.1.2

Version Description

Release Date - April 10 2018

  • Add feedback request
Download this release

Release Info

Developer DannyCooper
Plugin Icon 128x128 Google Fonts for WordPress
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

class-olympus-google-fonts.php CHANGED
@@ -36,6 +36,9 @@ class Olympus_Google_Fonts {
36
  require plugin_dir_path( __FILE__ ) . 'includes/customizer/settings.php';
37
  require plugin_dir_path( __FILE__ ) . 'includes/customizer/output-css.php';
38
 
 
 
 
39
  }
40
 
41
  /**
36
  require plugin_dir_path( __FILE__ ) . 'includes/customizer/settings.php';
37
  require plugin_dir_path( __FILE__ ) . 'includes/customizer/output-css.php';
38
 
39
+ // Feedback request class.
40
+ require plugin_dir_path( __FILE__ ) . 'includes/class-ogf-feedback.php';
41
+
42
  }
43
 
44
  /**
includes/class-ogf-feedback.php ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin review class.
4
+ * Prompts users to give a review of the plugin on WordPress.org after a period of usage.
5
+ *
6
+ * Heavily based on code by Rhys Wynne
7
+ * https://winwar.co.uk/2014/10/ask-wordpress-plugin-reviews-week/
8
+ *
9
+ * @package olympus-google-fonts
10
+ * @copyright Copyright (c) 2017, Danny Cooper
11
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
12
+ */
13
+
14
+ if ( ! class_exists( 'OGF_Feedback' ) ) :
15
+ /**
16
+ * The feedback.
17
+ */
18
+ class OGF_Feedback {
19
+ /**
20
+ * Slug.
21
+ *
22
+ * @var string $slug
23
+ */
24
+ private $slug;
25
+ /**
26
+ * Name.
27
+ *
28
+ * @var string $name
29
+ */
30
+ private $name;
31
+ /**
32
+ * Time limit.
33
+ *
34
+ * @var string $time_limit
35
+ */
36
+ private $time_limit;
37
+ /**
38
+ * No Bug Option.
39
+ *
40
+ * @var string $nobug_option
41
+ */
42
+ public $nobug_option;
43
+ /**
44
+ * Activation Date Option.
45
+ *
46
+ * @var string $date_option
47
+ */
48
+ public $date_option;
49
+ /**
50
+ * Class constructor.
51
+ *
52
+ * @param string $args Arguments.
53
+ */
54
+ public function __construct( $args ) {
55
+ $this->slug = $args['slug'];
56
+ $this->name = $args['name'];
57
+ $this->date_option = $this->slug . '_activation_date';
58
+ $this->nobug_option = $this->slug . '_no_bug';
59
+ if ( isset( $args['time_limit'] ) ) {
60
+ $this->time_limit = $args['time_limit'];
61
+ } else {
62
+ $this->time_limit = WEEK_IN_SECONDS;
63
+ }
64
+ // Add actions.
65
+ add_action( 'admin_init', array( $this, 'check_installation_date' ) );
66
+ add_action( 'admin_init', array( $this, 'set_no_bug' ), 5 );
67
+ }
68
+ /**
69
+ * Seconds to words.
70
+ *
71
+ * @param string $seconds Seconds in time.
72
+ */
73
+ public function seconds_to_words( $seconds ) {
74
+ // Get the years.
75
+ $years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100;
76
+ if ( $years > 1 ) {
77
+ /* translators: Number of years */
78
+ return sprintf( __( '%s years', 'olympus-google-fonts' ), $years );
79
+ } elseif ( $years > 0 ) {
80
+ return __( 'a year', 'olympus-google-fonts' );
81
+ }
82
+ // Get the weeks.
83
+ $weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52;
84
+ if ( $weeks > 1 ) {
85
+ /* translators: Number of weeks */
86
+ return sprintf( __( '%s weeks', 'olympus-google-fonts' ), $weeks );
87
+ } elseif ( $weeks > 0 ) {
88
+ return __( 'a week', 'olympus-google-fonts' );
89
+ }
90
+ // Get the days.
91
+ $days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7;
92
+ if ( $days > 1 ) {
93
+ /* translators: Number of days */
94
+ return sprintf( __( '%s days', 'olympus-google-fonts' ), $days );
95
+ } elseif ( $days > 0 ) {
96
+ return __( 'a day', 'olympus-google-fonts' );
97
+ }
98
+ // Get the hours.
99
+ $hours = ( intval( $seconds ) / HOUR_IN_SECONDS ) % 24;
100
+ if ( $hours > 1 ) {
101
+ /* translators: Number of hours */
102
+ return sprintf( __( '%s hours', 'olympus-google-fonts' ), $hours );
103
+ } elseif ( $hours > 0 ) {
104
+ return __( 'an hour', 'olympus-google-fonts' );
105
+ }
106
+ // Get the minutes.
107
+ $minutes = ( intval( $seconds ) / MINUTE_IN_SECONDS ) % 60;
108
+ if ( $minutes > 1 ) {
109
+ /* translators: Number of minutes */
110
+ return sprintf( __( '%s minutes', 'olympus-google-fonts' ), $minutes );
111
+ } elseif ( $minutes > 0 ) {
112
+ return __( 'a minute', 'olympus-google-fonts' );
113
+ }
114
+ // Get the seconds.
115
+ $seconds = intval( $seconds ) % 60;
116
+ if ( $seconds > 1 ) {
117
+ /* translators: Number of seconds */
118
+ return sprintf( __( '%s seconds', 'olympus-google-fonts' ), $seconds );
119
+ } elseif ( $seconds > 0 ) {
120
+ return __( 'a second', 'olympus-google-fonts' );
121
+ }
122
+ }
123
+ /**
124
+ * Check date on admin initiation and add to admin notice if it was more than the time limit.
125
+ */
126
+ public function check_installation_date() {
127
+ if ( ! get_site_option( $this->nobug_option ) || false === get_site_option( $this->nobug_option ) ) {
128
+ add_site_option( $this->date_option, time() );
129
+ // Retrieve the activation date.
130
+ $install_date = get_site_option( $this->date_option );
131
+ // If difference between install date and now is greater than time limit, then display notice.
132
+ if ( ( time() - $install_date ) > $this->time_limit ) {
133
+ add_action( 'admin_notices', array( $this, 'display_admin_notice' ) );
134
+ }
135
+ }
136
+ }
137
+ /**
138
+ * Display the admin notice.
139
+ */
140
+ public function display_admin_notice() {
141
+
142
+ $no_bug_url = wp_nonce_url( admin_url( '?' . $this->nobug_option . '=true' ), 'ogf-feedback-nounce' );
143
+ $time = $this->seconds_to_words( time() - get_site_option( $this->date_option ) );
144
+ ?>
145
+
146
+ <style>
147
+ .notice.ogf-notice {
148
+ border-left-color: #008ec2 !important;
149
+ padding: 20px;
150
+ }
151
+ .rtl .notice.ogf-notice {
152
+ border-right-color: #008ec2 !important;
153
+ }
154
+ .notice.notice.ogf-notice .ogf-notice-inner {
155
+ display: table;
156
+ width: 100%;
157
+ }
158
+ .notice.ogf-notice .ogf-notice-inner .ogf-notice-icon,
159
+ .notice.ogf-notice .ogf-notice-inner .ogf-notice-content,
160
+ .notice.ogf-notice .ogf-notice-inner .ogf-install-now {
161
+ display: table-cell;
162
+ vertical-align: middle;
163
+ }
164
+ .notice.ogf-notice .ogf-notice-icon {
165
+ color: #509ed2;
166
+ font-size: 50px;
167
+ width: 60px;
168
+ }
169
+ .notice.ogf-notice .ogf-notice-icon img {
170
+ width: 64px;
171
+ }
172
+ .notice.ogf-notice .ogf-notice-content {
173
+ padding: 0 40px 0 20px;
174
+ }
175
+ .notice.ogf-notice p {
176
+ padding: 0;
177
+ margin: 0;
178
+ max-width: 640px;
179
+ }
180
+ .notice.ogf-notice h3 {
181
+ margin: 0 0 5px;
182
+ }
183
+ .notice.ogf-notice .ogf-install-now {
184
+ text-align: center;
185
+ }
186
+ .notice.ogf-notice .ogf-install-now .ogf-install-button {
187
+ padding: 6px 50px;
188
+ height: auto;
189
+ line-height: 20px;
190
+ }
191
+ .notice.ogf-notice a.no-thanks {
192
+ display: block;
193
+ margin-top: 10px;
194
+ color: #72777c;
195
+ text-decoration: none;
196
+ }
197
+ .notice.ogf-notice a.no-thanks:hover {
198
+ color: #444;
199
+ }
200
+ @media (max-width: 767px) {
201
+ .notice.notice.ogf-notice .ogf-notice-inner {
202
+ display: block;
203
+ }
204
+ .notice.ogf-notice {
205
+ padding: 20px !important;
206
+ }
207
+ .notice.ogf-noticee .ogf-notice-inner {
208
+ display: block;
209
+ }
210
+ .notice.ogf-notice .ogf-notice-inner .ogf-notice-content {
211
+ display: block;
212
+ padding: 0;
213
+ }
214
+ .notice.ogf-notice .ogf-notice-inner .ogf-notice-icon {
215
+ display: none;
216
+ }
217
+ .notice.ogf-notice .ogf-notice-inner .ogf-install-now {
218
+ margin-top: 20px;
219
+ display: block;
220
+ text-align: left;
221
+ }
222
+ .notice.ogf-notice .ogf-notice-inner .no-thanks {
223
+ display: inline-block;
224
+ margin-left: 15px;
225
+ }
226
+ }
227
+ </style>
228
+ <div class="notice updated ogf-notice">
229
+ <div class="ogf-notice-inner">
230
+ <div class="ogf-notice-icon">
231
+ <img src="https://ps.w.org/olympus-google-fonts/assets/icon-256x256.jpg" alt="<?php echo esc_attr__( 'Olympus Google Fonts WordPress Plugin', 'olympus-google-fonts' ); ?>" />
232
+ </div>
233
+ <div class="ogf-notice-content">
234
+ <h3><?php echo esc_html__( 'Are you enjoying using Google Fonts?', 'olympus-google-fonts' ); ?></h3>
235
+ <p>
236
+ <?php
237
+ /* translators: 1. Name, 2. Time */
238
+ printf( __( 'You have been using <strong>%1$s</strong> for %2$s now! Could you please do me a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'olympus-google-fonts' ), esc_html( $this->name ), esc_html( $time ) );
239
+ ?>
240
+ </p>
241
+ </div>
242
+ <div class="ogf-install-now">
243
+ <?php printf( '<a href="%1$s" class="button button-primary ogf-install-button" target="_blank">%2$s</a>', esc_url( 'https://wordpress.org/support/view/plugin-reviews/olympus-google-fonts#new-post' ), esc_html__( 'Leave a Review', 'olympus-google-fonts' ) ); ?>
244
+ <a href="<?php echo esc_url( $no_bug_url ); ?>" class="no-thanks"><?php echo esc_html__( 'No thanks / I already have', 'olympus-google-fonts' ); ?></a>
245
+ </div>
246
+ </div>
247
+ </div>
248
+ <?php
249
+ }
250
+ /**
251
+ * Set the plugin to no longer bug users if user asks not to be.
252
+ */
253
+ public function set_no_bug() {
254
+ // Bail out if not on correct page.
255
+ if ( ! isset( $_GET['_wpnonce'] ) || ( ! wp_verify_nonce( $_GET['_wpnonce'], 'ogf-feedback-nounce' ) || ! is_admin() || ! isset( $_GET[ $this->nobug_option ] ) || ! current_user_can( 'manage_options' ) ) ) {
256
+ return;
257
+ }
258
+ add_site_option( $this->nobug_option, true );
259
+ }
260
+ }
261
+ endif;
262
+
263
+ /*
264
+ * Instantiate the OGF_Feedback class.
265
+ */
266
+ new OGF_Feedback(
267
+ array(
268
+ 'slug' => 'ogf',
269
+ 'name' => __( 'Google Fonts for WordPress', 'olympus-google-fonts' ),
270
+ 'time_limit' => WEEK_IN_SECONDS,
271
+ )
272
+ );
olympus-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: Google Fonts for WordPress
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The simplest Google Fonts plugin for WordPress. Add Google Fonts functionality to your WordPress website in minutes without any coding.
8
- * Version: 1.1.1
9
  * Author: Danny Cooper
10
  * Author URI: https://olympusthemes.com/
11
  * Text Domain: olympus-google-fonts
5
  * Plugin Name: Google Fonts for WordPress
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The simplest Google Fonts plugin for WordPress. Add Google Fonts functionality to your WordPress website in minutes without any coding.
8
+ * Version: 1.1.2
9
  * Author: Danny Cooper
10
  * Author URI: https://olympusthemes.com/
11
  * Text Domain: olympus-google-fonts
readme.txt CHANGED
@@ -19,6 +19,19 @@ Once you've found a combination you love, you can press save and make the change
19
 
20
  The full Google Fonts library can be found here - [Google Fonts](https://fonts.google.com)
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  The Google Fonts for WordPress plugin will work with all WordPress themes and has been specifically tested with the following:
23
 
24
  * All OlympusThemes
@@ -58,6 +71,11 @@ We are 99.99% certain it will, if it doesn't and you have tried the 'Force Style
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
61
  = 1.1.1 =
62
  *Release Date - Feb 3 2018*
63
 
19
 
20
  The full Google Fonts library can be found here - [Google Fonts](https://fonts.google.com)
21
 
22
+ = Plugin Features =
23
+
24
+ * **Live Customizer Preview:** Choose and preview fonts in real time using the WordPress Customizer.
25
+ * **Over 840+ Google Fonts** to choose from.
26
+ * Works with any WordPress Theme. No coding required.
27
+ * Easy One-Click Updates.
28
+ * Translation Ready.
29
+ * SSL and HTTPS compatible.
30
+ * Efficient Font Loading using a single request.
31
+ * **SEO-Friendly** (Search Engine Optimization).
32
+ * Tested with **PHP7**
33
+
34
+
35
  The Google Fonts for WordPress plugin will work with all WordPress themes and has been specifically tested with the following:
36
 
37
  * All OlympusThemes
71
 
72
  == Changelog ==
73
 
74
+ = 1.1.2 =
75
+ *Release Date - April 10 2018*
76
+
77
+ * Add feedback request
78
+
79
  = 1.1.1 =
80
  *Release Date - Feb 3 2018*
81