Version Description
Release Date: July 31st, 2018
- New feature: Preflight test to see if server time zone matches cron time.
- Bug fix: argv variables missing, Enabled register_argc_argv within cron command.
- Bug fix: Failed crons now write to log.
Download this release
Release Info
Developer | boldgrid |
Plugin | Total Upkeep – WordPress Backup Plugin plus Restore & Migrate by BoldGrid |
Version | 1.6.5 |
Comparing to | |
See all releases |
Code changes from version 1.6.4 to 1.6.5
- admin/class-boldgrid-backup-admin-backup-dir.php +13 -0
- admin/class-boldgrid-backup-admin-core.php +34 -0
- admin/class-boldgrid-backup-admin-cron-log.php +256 -0
- admin/class-boldgrid-backup-admin-cron-test.php +246 -0
- admin/class-boldgrid-backup-admin-cron.php +94 -6
- admin/class-boldgrid-backup-admin-test.php +32 -0
- admin/class-boldgrid-backup-admin-time.php +13 -0
- admin/css/boldgrid-backup-admin-test.css +1 -0
- admin/partials/boldgrid-backup-admin-settings.php +1 -1
- admin/partials/boldgrid-backup-admin-test.php +52 -5
- admin/partials/boldgrid-backup-admin-tools.php +5 -0
- boldgrid-backup-cron.php +15 -4
- boldgrid-backup.php +1 -1
- cron/class-boldgrid-backup-cron-helper.php +31 -0
- cron/cron-test.php +59 -0
- includes/class-boldgrid-backup.php +4 -0
- readme.txt +10 -2
- vendor/autoload.php +1 -1
- vendor/boldgrid/library/.editorconfig +12 -0
- vendor/boldgrid/library/README.md +13 -1
- vendor/boldgrid/library/src/Library/Api/Call.php +4 -2
- vendor/boldgrid/library/src/Library/Asset.php +42 -0
- vendor/boldgrid/library/src/Library/Configs.php +11 -0
- vendor/boldgrid/library/src/Library/Key.php +27 -15
- vendor/boldgrid/library/src/Library/License.php +38 -5
- vendor/boldgrid/library/src/Library/Menu/External.php +120 -0
- vendor/boldgrid/library/src/Library/Menu/Render.php +35 -0
- vendor/boldgrid/library/src/Library/Menu/Reseller.php +144 -0
- vendor/boldgrid/library/src/Library/Notice/ClaimPremiumKey.php +0 -196
- vendor/boldgrid/library/src/Library/Notice/KeyPrompt.php +29 -1
- vendor/boldgrid/library/src/Library/Page/Connect.php +140 -0
- vendor/boldgrid/library/src/Library/Reseller.php +63 -63
- vendor/boldgrid/library/src/Library/Start.php +29 -2
- vendor/boldgrid/library/src/Library/Views/ClaimPremiumKey.php +0 -19
- vendor/boldgrid/library/src/Library/Views/Connect.php +6 -0
- vendor/boldgrid/library/src/Library/Views/Envato.php +11 -0
- vendor/boldgrid/library/src/Library/Views/EnvatoFreeKey.php +13 -0
- vendor/boldgrid/library/src/Library/Views/KeyPrompt.php +50 -25
- vendor/boldgrid/library/src/assets/css/admin.css +132 -0
- vendor/boldgrid/library/src/assets/css/api-notice.css +81 -0
- vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.eot +0 -0
- vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.svg +13 -0
- vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.ttf +0 -0
- vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.woff +0 -0
- vendor/boldgrid/library/src/assets/fonts/boldgrid.eot +0 -0
- vendor/boldgrid/library/src/assets/fonts/boldgrid.svg +13 -0
- vendor/boldgrid/library/src/assets/fonts/boldgrid.ttf +0 -0
- vendor/boldgrid/library/src/assets/fonts/boldgrid.woff +0 -0
- vendor/boldgrid/library/src/assets/js/api-notice.js +41 -17
- vendor/boldgrid/library/src/assets/js/connect.js +43 -0
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +3 -3
- vendor/composer/installed.json +6 -6
admin/class-boldgrid-backup-admin-backup-dir.php
CHANGED
@@ -66,6 +66,19 @@ class Boldgrid_Backup_Admin_Backup_Dir {
|
|
66 |
$this->core = $core;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
/**
|
70 |
* Create our backup directory and necessary files.
|
71 |
*
|
66 |
$this->core = $core;
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* Determine if exec can write to our backup directory.
|
71 |
+
*
|
72 |
+
* @since 1.6.5
|
73 |
+
*
|
74 |
+
* @return bool
|
75 |
+
*/
|
76 |
+
public function can_exec_write() {
|
77 |
+
$backup_dir = $this->get();
|
78 |
+
|
79 |
+
return $this->core->test->can_exec_write( $backup_dir );
|
80 |
+
}
|
81 |
+
|
82 |
/**
|
83 |
* Create our backup directory and necessary files.
|
84 |
*
|
admin/class-boldgrid-backup-admin-core.php
CHANGED
@@ -200,6 +200,24 @@ class Boldgrid_Backup_Admin_Core {
|
|
200 |
*/
|
201 |
public $cron;
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
/**
|
204 |
* The admin xhprof class object.
|
205 |
*
|
@@ -589,6 +607,10 @@ class Boldgrid_Backup_Admin_Core {
|
|
589 |
|
590 |
$this->time = new Boldgrid_Backup_Admin_Time( $this );
|
591 |
|
|
|
|
|
|
|
|
|
592 |
// Ensure there is a backup identifier.
|
593 |
$this->get_backup_identifier();
|
594 |
|
@@ -2519,6 +2541,18 @@ class Boldgrid_Backup_Admin_Core {
|
|
2519 |
|
2520 |
$disk_space = $this->test->get_disk_space();
|
2521 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2522 |
// Get our crons and ready them for display.
|
2523 |
$our_crons = $this->cron->get_our_crons();
|
2524 |
foreach ( $our_crons as &$cron ) {
|
200 |
*/
|
201 |
public $cron;
|
202 |
|
203 |
+
/**
|
204 |
+
* Cron log class.
|
205 |
+
*
|
206 |
+
* @since 1.6.5
|
207 |
+
* @access public
|
208 |
+
* @var Boldgrid_Backup_Admin_Cron_Log
|
209 |
+
*/
|
210 |
+
public $cron_log;
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Cron test class.
|
214 |
+
*
|
215 |
+
* @since 1.6.5
|
216 |
+
* @access public
|
217 |
+
* @var Boldgrid_Backup_Admin_Cron_Test
|
218 |
+
*/
|
219 |
+
public $cron_test;
|
220 |
+
|
221 |
/**
|
222 |
* The admin xhprof class object.
|
223 |
*
|
607 |
|
608 |
$this->time = new Boldgrid_Backup_Admin_Time( $this );
|
609 |
|
610 |
+
$this->cron_test = new Boldgrid_Backup_Admin_Cron_Test( $this );
|
611 |
+
|
612 |
+
$this->cron_log = new Boldgrid_Backup_Admin_Cron_Log( $this );
|
613 |
+
|
614 |
// Ensure there is a backup identifier.
|
615 |
$this->get_backup_identifier();
|
616 |
|
2541 |
|
2542 |
$disk_space = $this->test->get_disk_space();
|
2543 |
|
2544 |
+
/*
|
2545 |
+
* Cron time zone testing.
|
2546 |
+
*
|
2547 |
+
* This set of code may modify cron jobs. Be sure to run before we get the cron jobs below
|
2548 |
+
* so that we give the user accurate info about which cron jobs are set.
|
2549 |
+
*/
|
2550 |
+
if ( ! empty( $_POST['cron_timezone_test'] ) && check_admin_referer( 'cron_timezone_test' ) ) { // Input var okay.
|
2551 |
+
$this->cron_test->setup();
|
2552 |
+
} elseif ( ! $this->cron_test->is_running() ) {
|
2553 |
+
$this->cron_test->clean_up();
|
2554 |
+
}
|
2555 |
+
|
2556 |
// Get our crons and ready them for display.
|
2557 |
$our_crons = $this->cron->get_our_crons();
|
2558 |
foreach ( $our_crons as &$cron ) {
|
admin/class-boldgrid-backup-admin-cron-log.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File: class-boldgrid-backup-admin-cron-log.php
|
4 |
+
*
|
5 |
+
* @link https://www.boldgrid.com
|
6 |
+
* @since 1.6.5
|
7 |
+
*
|
8 |
+
* @package Boldgrid_Backup
|
9 |
+
* @subpackage Boldgrid_Backup/admin
|
10 |
+
* @copyright BoldGrid
|
11 |
+
* @version $Id$
|
12 |
+
* @author BoldGrid <support@boldgrid.com>
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class: Boldgrid_Backup_Admin_Cron_Log
|
17 |
+
*
|
18 |
+
* @since 1.6.5
|
19 |
+
*/
|
20 |
+
class Boldgrid_Backup_Admin_Cron_Log {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* The core class object.
|
24 |
+
*
|
25 |
+
* @since 1.6.5
|
26 |
+
* @access private
|
27 |
+
* @var Boldgrid_Backup_Admin_Core
|
28 |
+
*/
|
29 |
+
private $core;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* The full path to the log file.
|
33 |
+
*
|
34 |
+
* @since 1.6.5
|
35 |
+
* @access private
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
private $log_path;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* The name of our log file.
|
42 |
+
*
|
43 |
+
* @since 1.6.5
|
44 |
+
* @access static
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
public static $log_name = 'boldgrid-backup-cron.log';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Constructor.
|
51 |
+
*
|
52 |
+
* @since 1.6.5
|
53 |
+
*
|
54 |
+
* @param Boldgrid_Backup_Admin_Core $core Core class object.
|
55 |
+
*/
|
56 |
+
public function __construct( $core ) {
|
57 |
+
$this->core = $core;
|
58 |
+
|
59 |
+
$this->log_path = trailingslashit( BOLDGRID_BACKUP_PATH ) . self::$log_name;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Add an entry to the log.
|
64 |
+
*
|
65 |
+
* This is a static method accessed outside of the scope of WordPress (boldgrid-backup-cron.php).
|
66 |
+
* Therefore, we do not have access to any WordPress specific functions.
|
67 |
+
*
|
68 |
+
* @since 1.6.5
|
69 |
+
*
|
70 |
+
* @param string $message A message to add to the log.
|
71 |
+
*/
|
72 |
+
public static function add_log( $message ) {
|
73 |
+
$file = dirname( __DIR__ ) . '/' . self::$log_name;
|
74 |
+
$data = array();
|
75 |
+
|
76 |
+
// Get data already in the file.
|
77 |
+
if ( file_exists( $file ) && is_readable( $file ) ) {
|
78 |
+
$current_contents = file_get_contents( $file ); // phpcs:ignore
|
79 |
+
$data = empty( $current_contents ) ? array() : json_decode( $current_contents, true );
|
80 |
+
}
|
81 |
+
|
82 |
+
$data[] = array(
|
83 |
+
'time' => time(),
|
84 |
+
'message' => $message,
|
85 |
+
'read' => false,
|
86 |
+
);
|
87 |
+
|
88 |
+
// Only keep the last 10 entries.
|
89 |
+
$data = array_slice( $data, -10, 10 );
|
90 |
+
|
91 |
+
file_put_contents( $file, json_encode( $data ) ); // phpcs:ignore
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Display an admin notice to the user informing them of new cron notices.
|
96 |
+
*
|
97 |
+
* @since 1.6.5
|
98 |
+
*/
|
99 |
+
public function admin_notice() {
|
100 |
+
if ( ! current_user_can( 'update_plugins' ) || ! $this->has_unread() || $this->on_log_page() ) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
$message = sprintf(
|
105 |
+
wp_kses(
|
106 |
+
/* translators: %1$s is the URL to view the cron log. */
|
107 |
+
__( 'Your latest <strong>BoldGrid Backup</strong> <em>scheduled backup</em> may not have finished successfully. For more info, please <a href="%1$s">click here</a> to see your latest <em>cron notices</em>.', 'boldgrid-backup' ),
|
108 |
+
array(
|
109 |
+
'a' => array(
|
110 |
+
'href' => array(),
|
111 |
+
),
|
112 |
+
'em' => array(),
|
113 |
+
'strong' => array(),
|
114 |
+
)
|
115 |
+
), esc_url( 'admin.php?page=boldgrid-backup-tools§ion=section_cron_log' )
|
116 |
+
);
|
117 |
+
|
118 |
+
$this->core->notice->boldgrid_backup_notice( $message );
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Get our log.
|
123 |
+
*
|
124 |
+
* @since 1.6.5
|
125 |
+
*
|
126 |
+
* @return array An array of log entries.
|
127 |
+
*/
|
128 |
+
public function get_log() {
|
129 |
+
$log = array();
|
130 |
+
|
131 |
+
if ( ! $this->core->wp_filesystem->exists( $this->log_path ) || ! $this->core->wp_filesystem->is_readable( $this->log_path ) ) {
|
132 |
+
return $log;
|
133 |
+
}
|
134 |
+
|
135 |
+
$contents = $this->core->wp_filesystem->get_contents( $this->log_path );
|
136 |
+
return json_decode( $contents, true );
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Generate and return the markup displaying our log entries.
|
141 |
+
*
|
142 |
+
* @since 1.6.5
|
143 |
+
*/
|
144 |
+
public function get_markup() {
|
145 |
+
|
146 |
+
// If we're getting the markup, the user is looking at it. Mark it as read.
|
147 |
+
$this->set_as_read();
|
148 |
+
|
149 |
+
$log = $this->get_log();
|
150 |
+
|
151 |
+
$markup = '<h2>' . __( 'Latest Cron Notices', 'boldgrid-backup' ) . '</h2>
|
152 |
+
<p>' . __( 'If a scheduled backup cron fails, an error message will be logged to the <em>cron notices</em> log file. You can view those log entries below:', 'boldgrid-backup' ) . '</p>';
|
153 |
+
|
154 |
+
if ( empty( $log ) ) {
|
155 |
+
$markup .= '<p><em>' . __( 'No entries in the log.', 'boldgrid-backup' ) . '</em></p>';
|
156 |
+
} else {
|
157 |
+
$markup .= '<table class="wp-list-table widefat fixed striped">
|
158 |
+
<thead>
|
159 |
+
<tr>
|
160 |
+
<th style="width:150px;">' . __( 'Time', 'boldgrid-backup' ) . '</th>
|
161 |
+
<th>' . __( 'Message', 'boldgrid-backup' ) . '</th>
|
162 |
+
</tr>
|
163 |
+
</thead>';
|
164 |
+
|
165 |
+
foreach ( $log as $item ) {
|
166 |
+
$this->core->time->init( $item['time'] );
|
167 |
+
$time = $this->core->time->get_span();
|
168 |
+
$message = esc_html( $item['message'] );
|
169 |
+
|
170 |
+
$markup .= sprintf( '<tr><th>%1$s</th><td>%2$s</td></tr>', $time, $message );
|
171 |
+
}
|
172 |
+
|
173 |
+
$markup .= '</table>';
|
174 |
+
}
|
175 |
+
|
176 |
+
return $markup;
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Whether or not there are unread messages.
|
181 |
+
*
|
182 |
+
* @since 1.6.5
|
183 |
+
*
|
184 |
+
* @return bool
|
185 |
+
*/
|
186 |
+
public function has_unread() {
|
187 |
+
$log = $this->get_log();
|
188 |
+
|
189 |
+
if ( empty( $log ) ) {
|
190 |
+
return false;
|
191 |
+
}
|
192 |
+
|
193 |
+
foreach ( $log as $item ) {
|
194 |
+
if ( empty( $item['read'] ) ) {
|
195 |
+
return true;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
return false;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Whether or not we are on the logs page.
|
204 |
+
*
|
205 |
+
* Specifically, if the user clicked "click here" to be taken to
|
206 |
+
* admin.php?page=boldgrid-backup-tools§ion=section_cron_log
|
207 |
+
*
|
208 |
+
* @since 1.6.5
|
209 |
+
*
|
210 |
+
* @return bool
|
211 |
+
*/
|
212 |
+
public function on_log_page() {
|
213 |
+
global $pagenow;
|
214 |
+
|
215 |
+
$on_login_page = 'admin.php' === $pagenow;
|
216 |
+
|
217 |
+
$params = array(
|
218 |
+
array(
|
219 |
+
'key' => 'page',
|
220 |
+
'value' => 'boldgrid-backup-tools',
|
221 |
+
),
|
222 |
+
array(
|
223 |
+
'key' => 'section',
|
224 |
+
'value' => 'section_cron_log',
|
225 |
+
),
|
226 |
+
);
|
227 |
+
|
228 |
+
foreach ( $params as $param ) {
|
229 |
+
if ( empty( $_GET[ $param['key'] ] ) || $param['value'] !== $_GET[ $param['key'] ] ) { // phpcs:ignore
|
230 |
+
$on_login_page = false;
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
return $on_login_page;
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Set the log as being read.
|
239 |
+
*
|
240 |
+
* @since 1.6.5
|
241 |
+
*
|
242 |
+
* @return bool Whether or not the log file was updated successfully.
|
243 |
+
*/
|
244 |
+
public function set_as_read() {
|
245 |
+
$log = $this->get_log();
|
246 |
+
if ( empty( $log ) ) {
|
247 |
+
return true;
|
248 |
+
}
|
249 |
+
|
250 |
+
foreach ( $log as &$item ) {
|
251 |
+
$item['read'] = true;
|
252 |
+
}
|
253 |
+
|
254 |
+
return $this->core->wp_filesystem->put_contents( $this->log_path, wp_json_encode( $log ) );
|
255 |
+
}
|
256 |
+
}
|
admin/class-boldgrid-backup-admin-cron-test.php
ADDED
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File: class-boldgrid-backup-admin-cron-test.php
|
4 |
+
*
|
5 |
+
* @link https://www.boldgrid.com
|
6 |
+
* @since 1.6.5
|
7 |
+
*
|
8 |
+
* @package Boldgrid_Backup
|
9 |
+
* @subpackage Boldgrid_Backup/admin
|
10 |
+
* @copyright BoldGrid
|
11 |
+
* @version $Id$
|
12 |
+
* @author BoldGrid <support@boldgrid.com>
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class: Boldgrid_Backup_Admin_Cron_Test
|
17 |
+
*
|
18 |
+
* @since 1.6.5
|
19 |
+
*/
|
20 |
+
class Boldgrid_Backup_Admin_Cron_Test {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* The core class object.
|
24 |
+
*
|
25 |
+
* @since 1.6.5
|
26 |
+
* @access private
|
27 |
+
* @var Boldgrid_Backup_Admin_Core
|
28 |
+
*/
|
29 |
+
private $core;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Path to config file.
|
33 |
+
*
|
34 |
+
* @since 1.6.5
|
35 |
+
* @access private
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
private $cron_config_path;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Path to php file, which is ran via cron.
|
42 |
+
*
|
43 |
+
* @since 1.6.5
|
44 |
+
* @access private
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
private $cron_path;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Path to results.
|
51 |
+
*
|
52 |
+
* @since 1.6.5
|
53 |
+
* @access private
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
private $cron_result_path;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Constructor.
|
60 |
+
*
|
61 |
+
* @since 1.6.5
|
62 |
+
*
|
63 |
+
* @param Boldgrid_Backup_Admin_Core $core Core class object.
|
64 |
+
*/
|
65 |
+
public function __construct( $core ) {
|
66 |
+
$this->core = $core;
|
67 |
+
|
68 |
+
$this->cron_path = BOLDGRID_BACKUP_PATH . '/cron/cron-test.php';
|
69 |
+
$this->cron_config_path = BOLDGRID_BACKUP_PATH . '/cron/cron-test.config';
|
70 |
+
$this->cron_result_path = BOLDGRID_BACKUP_PATH . '/cron/cron-test.result';
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Clean up the test.
|
75 |
+
*
|
76 |
+
* Delete the config file and remove the cron entries.
|
77 |
+
*
|
78 |
+
* @since 1.6.5
|
79 |
+
*/
|
80 |
+
public function clean_up() {
|
81 |
+
wp_delete_file( $this->cron_config_path );
|
82 |
+
$this->core->cron->entry_delete_contains( $this->cron_path );
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Generate the markup used on the prefligh check page.
|
87 |
+
*
|
88 |
+
* Ensure markup generated by this method are compatible with $allowed_tags configured in
|
89 |
+
* admin/partials/boldgrid-backup-admin-test.php.
|
90 |
+
*
|
91 |
+
* @since 1.6.5
|
92 |
+
*
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
public function get_preflight_markup() {
|
96 |
+
$server_offset = $this->core->time->get_server_offset();
|
97 |
+
$cron_offset = $this->get_offset();
|
98 |
+
$offset_match = (int) $server_offset === (int) $cron_offset;
|
99 |
+
$markup = '';
|
100 |
+
|
101 |
+
$run_test = '<p>
|
102 |
+
<form method="post" action="admin.php?page=boldgrid-backup-test">
|
103 |
+
<input type="hidden" name="cron_timezone_test" value="1" />
|
104 |
+
<input type="submit" value="%1$s" class="button" style="vertical-align:baseline;" /> (' . __( 'Test may take up to 25 minutes to complete', 'boldgrid-backup' ) . ')
|
105 |
+
' . wp_nonce_field( 'cron_timezone_test', '_wpnonce', true, false ) . '
|
106 |
+
</form>
|
107 |
+
</p>';
|
108 |
+
|
109 |
+
$no = sprintf(
|
110 |
+
'<span class="warning">%1$s</span><br />%2$s',
|
111 |
+
__( 'No', 'boldgrid-backup' ),
|
112 |
+
__( 'Please contact your server administrator for assistance with troubleshooting.' )
|
113 |
+
);
|
114 |
+
|
115 |
+
if ( $this->is_running() ) {
|
116 |
+
$markup .= '<p><span class="spinner inline"></span>' . __( 'This test is in progress, and may take up to 25 minutes to complete. Refresh this page for an update.', 'boldgrid-backup' ) . '</p>';
|
117 |
+
} elseif ( false === $cron_offset ) {
|
118 |
+
$markup .= sprintf( $run_test, esc_attr( __( 'Run test', 'boldgrid-backup' ) ) );
|
119 |
+
} else {
|
120 |
+
$match_markup = ( $offset_match ? __( 'Yes', 'boldgrid-backup' ) : $no );
|
121 |
+
$markup = $match_markup . $markup;
|
122 |
+
|
123 |
+
$markup .= '<p>' . __( 'Server offset', 'boldgrid-backup' ) . ': ' . $server_offset . '<br />';
|
124 |
+
$markup .= __( 'Cron offset' ) . ': ' . $cron_offset . '</p>';
|
125 |
+
|
126 |
+
$markup .= sprintf( $run_test, esc_attr( __( 'Run test again', 'boldgrid-backup' ) ) );
|
127 |
+
}
|
128 |
+
|
129 |
+
// Help info, displayed by clicking the help icon.
|
130 |
+
$markup .= '<p class="help" data-id="cron-time-zone">' . __( 'Cron should run in the same time zone as your server. For example, if your server timezone is EST, setting a cron to run at 5am should run it at 5am EST. This test runs a series of cron jobs to determine which timezone is used by Cron.', 'boldgrid-backup' ) . '</p>';
|
131 |
+
|
132 |
+
return $markup;
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Get the cron offset.
|
137 |
+
*
|
138 |
+
* This looks in the cron-test.result file for the data.
|
139 |
+
*
|
140 |
+
* @since 1.6.5
|
141 |
+
*
|
142 |
+
* @return mixed
|
143 |
+
*/
|
144 |
+
public function get_offset() {
|
145 |
+
$result = $this->core->wp_filesystem->get_contents( $this->cron_result_path );
|
146 |
+
if ( ! $result ) {
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
|
150 |
+
$result = json_decode( $result, true );
|
151 |
+
|
152 |
+
return isset( $result['offset'] ) ? $result['offset'] : false;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Whether or not the test is currently running.
|
157 |
+
*
|
158 |
+
* @since 1.6.5
|
159 |
+
*
|
160 |
+
* @return bool
|
161 |
+
*/
|
162 |
+
public function is_running() {
|
163 |
+
$config_file_exists = $this->core->wp_filesystem->exists( $this->cron_config_path );
|
164 |
+
|
165 |
+
$matching_crons = $this->core->cron->entry_search( $this->cron_path );
|
166 |
+
|
167 |
+
return false === $this->get_offset() && $config_file_exists && ! empty( $matching_crons );
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Setup the tests.
|
172 |
+
*
|
173 |
+
* HERE'S THE PROBLEM:
|
174 |
+
* Cron is supposed to run using the server's timezone. In one scenario, the crons were not running
|
175 |
+
* when we expected them to. Further troubleshooting found that the server was set to PDT and the
|
176 |
+
* Crons were running at EDT times. So, our 5am PDT cron was actually running at 5am EDT. It took
|
177 |
+
* a while to figure this out, so this test was built.
|
178 |
+
*
|
179 |
+
* HERE'S HOW THIS TEST WORKS:
|
180 |
+
* We get the current UTC time. Let's say it's 3:15 pm. We then setup the following crons:
|
181 |
+
*
|
182 |
+
* # 3:18 pm (UTC)
|
183 |
+
* # 4:19 pm (UTC+1)
|
184 |
+
* # 5:20 pm (UTC+2)
|
185 |
+
*
|
186 |
+
* We don't know when each of these crons will actually run, but they're basically 1 hour and
|
187 |
+
* 1 minute apart. When the first of these crons actually does run, the script it triggers (cron-test.php)
|
188 |
+
* will look at the current MINUTE. Using the example above, if the minute is 19, then we know cron
|
189 |
+
* is running on UTC+1 time. If the minute is 20, then we know we're running at UTC+2.
|
190 |
+
*
|
191 |
+
* The array of times to offsets (like 4:19 pm = UTC+1) is stored in the cron-test.config file.
|
192 |
+
*
|
193 |
+
* @since 1.6.5
|
194 |
+
*/
|
195 |
+
public function setup() {
|
196 |
+
|
197 |
+
// Delete the log, the config file, and all existing crons.
|
198 |
+
$this->clean_up();
|
199 |
+
wp_delete_file( $this->cron_result_path );
|
200 |
+
|
201 |
+
$time_data = array();
|
202 |
+
$unix_time = time();
|
203 |
+
$minutes_ahead = 3;
|
204 |
+
// When looping through offsets, begin at the user's offset so test completes faster.
|
205 |
+
$server_offset = (int) $this->core->time->get_server_offset();
|
206 |
+
|
207 |
+
/*
|
208 |
+
* Add our cron jobs.
|
209 |
+
*
|
210 |
+
* Currently, we are only doing hour increments. A few 30 & 45 minute offsets exist, but this
|
211 |
+
* test is really for edge cases, and those 30/45 offsets are edge cases too. We'll get to those
|
212 |
+
* later.
|
213 |
+
*
|
214 |
+
* @see https://www.timeanddate.com/time/time-zones-interesting.html
|
215 |
+
*/
|
216 |
+
for ( $x = 1; $x <= 25; $x++ ) {
|
217 |
+
$cron_time = $unix_time + ( $server_offset * 60 * 60 ) + ( $minutes_ahead * 60 );
|
218 |
+
|
219 |
+
$time_data[] = array(
|
220 |
+
'time' => $cron_time,
|
221 |
+
'offset' => $server_offset,
|
222 |
+
);
|
223 |
+
|
224 |
+
// Add our cron. Use (int) to make sure our minutes do not have leading zero's.
|
225 |
+
$cron_command = (int) date( 'i', $cron_time ) . ' ' . date( 'G * * *', $cron_time ) . ' php -d register_argc_argv=1 -qf ' . $this->cron_path . ' > /dev/null 2>&1';
|
226 |
+
$all_crons_added = $this->core->cron->update_cron( $cron_command );
|
227 |
+
|
228 |
+
if ( ! $all_crons_added ) {
|
229 |
+
break;
|
230 |
+
}
|
231 |
+
|
232 |
+
$minutes_ahead++;
|
233 |
+
// Server offset must be between -12 and 12.
|
234 |
+
$server_offset++;
|
235 |
+
$server_offset = $server_offset > 12 ? -12 : $server_offset;
|
236 |
+
}
|
237 |
+
|
238 |
+
if ( $all_crons_added ) {
|
239 |
+
$this->core->wp_filesystem->put_contents( $this->cron_config_path, wp_json_encode( $time_data ) );
|
240 |
+
} else {
|
241 |
+
$error = __( 'Failed to setup Cron time zone test.', 'boldgrid-backup' );
|
242 |
+
$this->core->notice->boldgrid_backup_notice( $error );
|
243 |
+
$this->clean_up();
|
244 |
+
}
|
245 |
+
}
|
246 |
+
}
|
admin/class-boldgrid-backup-admin-cron.php
CHANGED
@@ -37,6 +37,20 @@ class Boldgrid_Backup_Admin_Cron {
|
|
37 |
*/
|
38 |
public $run_jobs = 'cron/run-jobs.php';
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* A cron secret used to validate unauthenticated crontab jobs.
|
42 |
*
|
@@ -132,7 +146,7 @@ class Boldgrid_Backup_Admin_Cron {
|
|
132 |
// Build cron job line in crontab format.
|
133 |
$entry = $date->format( 'i G' ) . ' * * ';
|
134 |
|
135 |
-
$entry .= $days_scheduled_list . '
|
136 |
'/boldgrid-backup-cron.php" mode=backup siteurl=' . get_site_url() . ' id=' .
|
137 |
$this->core->get_backup_identifier() . ' secret=' . $this->get_cron_secret();
|
138 |
|
@@ -244,7 +258,7 @@ class Boldgrid_Backup_Admin_Cron {
|
|
244 |
}
|
245 |
|
246 |
// Build cron job line in crontab format.
|
247 |
-
$entry = date( $minute . ' ' . $hour, $deadline ) . ' * * ' . date( 'w' ) . '
|
248 |
dirname( dirname( __FILE__ ) ) . '/boldgrid-backup-cron.php" mode=restore siteurl=' .
|
249 |
get_site_url() . ' id=' . $this->core->get_backup_identifier() . ' secret=' .
|
250 |
$this->get_cron_secret() . ' archive_key=' . $archive_key .
|
@@ -329,12 +343,13 @@ class Boldgrid_Backup_Admin_Cron {
|
|
329 |
*/
|
330 |
public function schedule_jobs() {
|
331 |
$entry = sprintf(
|
332 |
-
'*/5 * * * *
|
333 |
dirname( dirname( __FILE__ ) ),
|
334 |
$this->run_jobs,
|
335 |
get_site_url(),
|
336 |
$this->core->get_backup_identifier(),
|
337 |
-
$this->get_cron_secret()
|
|
|
338 |
);
|
339 |
|
340 |
return $this->update_cron( $entry );
|
@@ -560,6 +575,27 @@ class Boldgrid_Backup_Admin_Cron {
|
|
560 |
return $this->write_crontab( $all_entries ) && ! $this->entry_exists( $entry );
|
561 |
}
|
562 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
/**
|
564 |
* Determine if an entry exists in the crontab.
|
565 |
*
|
@@ -571,9 +607,38 @@ class Boldgrid_Backup_Admin_Cron {
|
|
571 |
public function entry_exists( $entry ) {
|
572 |
$all_entries = $this->get_all();
|
573 |
|
|
|
|
|
|
|
|
|
574 |
return false !== array_search( $entry, $all_entries, true );
|
575 |
}
|
576 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
/**
|
578 |
* Get all entries in cron.
|
579 |
*
|
@@ -593,8 +658,31 @@ class Boldgrid_Backup_Admin_Cron {
|
|
593 |
return false;
|
594 |
}
|
595 |
|
596 |
-
|
597 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
|
599 |
if ( ! $success ) {
|
600 |
return false;
|
37 |
*/
|
38 |
public $run_jobs = 'cron/run-jobs.php';
|
39 |
|
40 |
+
/**
|
41 |
+
* Cron command.
|
42 |
+
*
|
43 |
+
* This is the base of most of our cron commands.
|
44 |
+
*
|
45 |
+
* The following was added as of 1.6.5 for those hosts that have register_argc_argv disabled:
|
46 |
+
* -d register_argc_argv="1"
|
47 |
+
*
|
48 |
+
* @since 1.6.5
|
49 |
+
* @access private
|
50 |
+
* @var string
|
51 |
+
*/
|
52 |
+
private $cron_command = 'php -d register_argc_argv="1" -qf';
|
53 |
+
|
54 |
/**
|
55 |
* A cron secret used to validate unauthenticated crontab jobs.
|
56 |
*
|
146 |
// Build cron job line in crontab format.
|
147 |
$entry = $date->format( 'i G' ) . ' * * ';
|
148 |
|
149 |
+
$entry .= $days_scheduled_list . ' ' . $this->cron_command . ' "' . dirname( dirname( __FILE__ ) ) .
|
150 |
'/boldgrid-backup-cron.php" mode=backup siteurl=' . get_site_url() . ' id=' .
|
151 |
$this->core->get_backup_identifier() . ' secret=' . $this->get_cron_secret();
|
152 |
|
258 |
}
|
259 |
|
260 |
// Build cron job line in crontab format.
|
261 |
+
$entry = date( $minute . ' ' . $hour, $deadline ) . ' * * ' . date( 'w' ) . ' ' . $this->cron_command . ' "' .
|
262 |
dirname( dirname( __FILE__ ) ) . '/boldgrid-backup-cron.php" mode=restore siteurl=' .
|
263 |
get_site_url() . ' id=' . $this->core->get_backup_identifier() . ' secret=' .
|
264 |
$this->get_cron_secret() . ' archive_key=' . $archive_key .
|
343 |
*/
|
344 |
public function schedule_jobs() {
|
345 |
$entry = sprintf(
|
346 |
+
'*/5 * * * * %6$s "%1$s/%2$s" siteurl=%3$s id=%4$s secret=%5$s > /dev/null 2>&1',
|
347 |
dirname( dirname( __FILE__ ) ),
|
348 |
$this->run_jobs,
|
349 |
get_site_url(),
|
350 |
$this->core->get_backup_identifier(),
|
351 |
+
$this->get_cron_secret(),
|
352 |
+
$this->cron_command
|
353 |
);
|
354 |
|
355 |
return $this->update_cron( $entry );
|
575 |
return $this->write_crontab( $all_entries ) && ! $this->entry_exists( $entry );
|
576 |
}
|
577 |
|
578 |
+
/**
|
579 |
+
* Delete all cron entries that contain a string.
|
580 |
+
*
|
581 |
+
* @since 1.6.5
|
582 |
+
*
|
583 |
+
* @param string $string The string to look for.
|
584 |
+
*/
|
585 |
+
public function entry_delete_contains( $string ) {
|
586 |
+
$all_entries = $this->get_all();
|
587 |
+
|
588 |
+
if ( ! is_array( $all_entries ) ) {
|
589 |
+
return;
|
590 |
+
}
|
591 |
+
|
592 |
+
foreach ( $all_entries as $entry ) {
|
593 |
+
if ( false !== strpos( $entry, $string ) ) {
|
594 |
+
$this->entry_delete( $entry );
|
595 |
+
}
|
596 |
+
}
|
597 |
+
}
|
598 |
+
|
599 |
/**
|
600 |
* Determine if an entry exists in the crontab.
|
601 |
*
|
607 |
public function entry_exists( $entry ) {
|
608 |
$all_entries = $this->get_all();
|
609 |
|
610 |
+
if ( empty( $all_entries ) ) {
|
611 |
+
return false;
|
612 |
+
}
|
613 |
+
|
614 |
return false !== array_search( $entry, $all_entries, true );
|
615 |
}
|
616 |
|
617 |
+
/**
|
618 |
+
* Search for cron entries that contain a specfic string.
|
619 |
+
*
|
620 |
+
* @since 1.6.5
|
621 |
+
*
|
622 |
+
* @param string $search String to search for.
|
623 |
+
* @return array An array of matches.
|
624 |
+
*/
|
625 |
+
public function entry_search( $search ) {
|
626 |
+
$matches = array();
|
627 |
+
$entries = $this->get_all();
|
628 |
+
|
629 |
+
if ( empty( $entries ) ) {
|
630 |
+
return $matches;
|
631 |
+
}
|
632 |
+
|
633 |
+
foreach ( $entries as $entry ) {
|
634 |
+
if ( false !== strpos( $entry, $search ) ) {
|
635 |
+
$matches[] = $entry;
|
636 |
+
}
|
637 |
+
}
|
638 |
+
|
639 |
+
return $matches;
|
640 |
+
}
|
641 |
+
|
642 |
/**
|
643 |
* Get all entries in cron.
|
644 |
*
|
658 |
return false;
|
659 |
}
|
660 |
|
661 |
+
/*
|
662 |
+
* Attempt to read the crontab.
|
663 |
+
*
|
664 |
+
* Historically, we just read the output of "crontab -l". In certain scenarious, this does
|
665 |
+
* not return the full output of the command. Another solution would be to output that command
|
666 |
+
* to a file, and then read the file.
|
667 |
+
*
|
668 |
+
* As of 1.6.5, we'll first try the latter option.
|
669 |
+
*/
|
670 |
+
if ( $this->core->backup_dir->can_exec_write() ) {
|
671 |
+
$crontab_file_path = $this->core->backup_dir->get_path_to( 'crontab' );
|
672 |
+
|
673 |
+
// Write crontab to temp file.
|
674 |
+
$command = sprintf( 'crontab -l > %1$s', $crontab_file_path );
|
675 |
+
$this->core->execute_command( $command, null, $success );
|
676 |
+
|
677 |
+
// Read the crontab from temp file.
|
678 |
+
$crontab = $this->core->wp_filesystem->get_contents( $crontab_file_path );
|
679 |
+
$success = false !== $crontab;
|
680 |
+
|
681 |
+
$this->core->wp_filesystem->delete( $crontab_file_path );
|
682 |
+
} else {
|
683 |
+
$command = 'crontab -l';
|
684 |
+
$crontab = $this->core->execute_command( $command, null, $success );
|
685 |
+
}
|
686 |
|
687 |
if ( ! $success ) {
|
688 |
return false;
|
admin/class-boldgrid-backup-admin-test.php
CHANGED
@@ -135,6 +135,38 @@ class Boldgrid_Backup_Admin_Test {
|
|
135 |
$this->core = $core;
|
136 |
}
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
/**
|
139 |
* Wrapper for wp_filesystem exists.
|
140 |
*
|
135 |
$this->core = $core;
|
136 |
}
|
137 |
|
138 |
+
/**
|
139 |
+
* Find out if we can write a file with exec, and then modify it with wp_filesystem.
|
140 |
+
*
|
141 |
+
* @since 1.6.5
|
142 |
+
*
|
143 |
+
* @param string $dir The directory to test.
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
+
public function can_exec_write( $dir ) {
|
147 |
+
if ( empty( $dir ) ) {
|
148 |
+
return false;
|
149 |
+
}
|
150 |
+
|
151 |
+
$file = trailingslashit( $dir ) . 'safe-to-delete.txt';
|
152 |
+
$txt = 'This file is safe to delete.';
|
153 |
+
|
154 |
+
// Write the file with an exec method.
|
155 |
+
$command = sprintf( 'echo "%1$s" > %2$s', $txt, $file );
|
156 |
+
$this->core->execute_command( $command, array(), $success );
|
157 |
+
if ( ! $success ) {
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
|
161 |
+
// Read the file with wp_filesystem.
|
162 |
+
if ( trim( $this->core->wp_filesystem->get_contents( $file ) ) !== $txt ) {
|
163 |
+
return false;
|
164 |
+
}
|
165 |
+
|
166 |
+
// Delete the file with wp_filesystem.
|
167 |
+
return $this->core->wp_filesystem->delete( $file );
|
168 |
+
}
|
169 |
+
|
170 |
/**
|
171 |
* Wrapper for wp_filesystem exists.
|
172 |
*
|
admin/class-boldgrid-backup-admin-time.php
CHANGED
@@ -74,6 +74,19 @@ class Boldgrid_Backup_Admin_Time {
|
|
74 |
$this->core = $core;
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
/**
|
78 |
* Get a server's UTC offset.
|
79 |
*
|
74 |
$this->core = $core;
|
75 |
}
|
76 |
|
77 |
+
/**
|
78 |
+
* Get the server's current date.
|
79 |
+
*
|
80 |
+
* @since 1.6.5
|
81 |
+
*
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
public function get_server_date() {
|
85 |
+
$date = $this->core->execute_command( 'date' );
|
86 |
+
|
87 |
+
return ! $date ? __( 'Unknown', 'boldgrid-backup' ) : $date;
|
88 |
+
}
|
89 |
+
|
90 |
/**
|
91 |
* Get a server's UTC offset.
|
92 |
*
|
admin/css/boldgrid-backup-admin-test.css
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
|
9 |
.functionality-test-section table tr td {
|
10 |
padding: 5px 10px;
|
|
|
11 |
}
|
12 |
|
13 |
.functionality-test-section table tr td h2 {
|
8 |
|
9 |
.functionality-test-section table tr td {
|
10 |
padding: 5px 10px;
|
11 |
+
vertical-align: top;
|
12 |
}
|
13 |
|
14 |
.functionality-test-section table tr td h2 {
|
admin/partials/boldgrid-backup-admin-settings.php
CHANGED
@@ -135,7 +135,7 @@ wp_nonce_field( 'boldgrid_backup_settings' );
|
|
135 |
printf(
|
136 |
wp_kses(
|
137 |
// translators: 1: URL address.
|
138 |
-
|
139 |
'The BoldGrid Backup and Restore system allows you to upgrade your themes and plugins without being afraid it will do something you cannot easily undo. We perform a <a href="%s">Preflight Check</a> to see if the needed support is available on your web hosting account.',
|
140 |
'boldgrid-backup'
|
141 |
),
|
135 |
printf(
|
136 |
wp_kses(
|
137 |
// translators: 1: URL address.
|
138 |
+
__(
|
139 |
'The BoldGrid Backup and Restore system allows you to upgrade your themes and plugins without being afraid it will do something you cannot easily undo. We perform a <a href="%s">Preflight Check</a> to see if the needed support is available on your web hosting account.',
|
140 |
'boldgrid-backup'
|
141 |
),
|
admin/partials/boldgrid-backup-admin-test.php
CHANGED
@@ -40,13 +40,46 @@ $warning_span = '<span class="warning">%1$s</span><br />%2$s';
|
|
40 |
$success_span = '<span class="success">%1$s</span>';
|
41 |
|
42 |
$allowed_tags = array(
|
43 |
-
'span'
|
44 |
-
'class'
|
45 |
'error',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
),
|
|
|
47 |
),
|
48 |
-
'
|
49 |
-
'pre' => array(),
|
50 |
);
|
51 |
|
52 |
$backup_dir_perms = $this->test->extensive_dir_test( $backup_directory );
|
@@ -106,6 +139,10 @@ $tests = array(
|
|
106 |
'k' => __( 'Server time zone:', 'boldgrid-backup' ),
|
107 |
'v' => $timezone,
|
108 |
),
|
|
|
|
|
|
|
|
|
109 |
);
|
110 |
|
111 |
$tests[] = array(
|
@@ -255,11 +292,21 @@ $tests[] = array(
|
|
255 |
'v' => true === $cli_support['can_remote_get'] ? $lang['yes'] : sprintf( $error_span, $lang['no'], '' ),
|
256 |
);
|
257 |
|
|
|
|
|
|
|
|
|
|
|
258 |
$tests[] = array(
|
259 |
'k' => __( 'Cron jobs:', 'boldgrid-backup' ),
|
260 |
'v' => '<pre>' . implode( '<br /><br />', $our_crons ) . '</pre>',
|
261 |
);
|
262 |
|
|
|
|
|
|
|
|
|
|
|
263 |
$tests[] = array(
|
264 |
'k' => __( 'WP Cron enabled?', 'boldgrid-backup' ),
|
265 |
'v' => ( $this->test->wp_cron_enabled() ? 'Yes' : 'No' ),
|
@@ -369,7 +416,7 @@ foreach ( $tests as $test ) {
|
|
369 |
} elseif ( isset( $test['k'] ) ) {
|
370 |
$table .= sprintf(
|
371 |
'<tr><td>%1$s</td><td><em>%2$s</em></td></tr>',
|
372 |
-
|
373 |
wp_kses( $test['v'], $allowed_tags )
|
374 |
);
|
375 |
} else {
|
40 |
$success_span = '<span class="success">%1$s</span>';
|
41 |
|
42 |
$allowed_tags = array(
|
43 |
+
'span' => array(
|
44 |
+
'class' => array(
|
45 |
'error',
|
46 |
+
'dashicons',
|
47 |
+
'dashicons-editor-help',
|
48 |
+
'spinner',
|
49 |
+
'inline',
|
50 |
+
),
|
51 |
+
'data-id' => array(
|
52 |
+
'cron-time-zone',
|
53 |
+
),
|
54 |
+
),
|
55 |
+
'br' => array(),
|
56 |
+
'p' => array(
|
57 |
+
'class' => array(
|
58 |
+
'help',
|
59 |
+
),
|
60 |
+
'data-id' => array(
|
61 |
+
'cron-time-zone',
|
62 |
+
),
|
63 |
+
),
|
64 |
+
'pre' => array(),
|
65 |
+
'form' => array(
|
66 |
+
'method' => array(),
|
67 |
+
'action' => array(
|
68 |
+
'admin.php?page=boldgrid-backup-test',
|
69 |
+
),
|
70 |
+
),
|
71 |
+
'input' => array(
|
72 |
+
'type' => array(),
|
73 |
+
'name' => array(
|
74 |
+
'cron_timezone_test',
|
75 |
+
),
|
76 |
+
'value' => array(),
|
77 |
+
'class' => array(
|
78 |
+
'button',
|
79 |
),
|
80 |
+
'style' => array(),
|
81 |
),
|
82 |
+
'strong' => array(),
|
|
|
83 |
);
|
84 |
|
85 |
$backup_dir_perms = $this->test->extensive_dir_test( $backup_directory );
|
139 |
'k' => __( 'Server time zone:', 'boldgrid-backup' ),
|
140 |
'v' => $timezone,
|
141 |
),
|
142 |
+
array(
|
143 |
+
'k' => __( 'Server date:', 'boldgrid-backup' ),
|
144 |
+
'v' => $this->time->get_server_date(),
|
145 |
+
),
|
146 |
);
|
147 |
|
148 |
$tests[] = array(
|
292 |
'v' => true === $cli_support['can_remote_get'] ? $lang['yes'] : sprintf( $error_span, $lang['no'], '' ),
|
293 |
);
|
294 |
|
295 |
+
$tests[] = array(
|
296 |
+
'k' => __( 'Cron time zone matches server time zone? <span class="dashicons dashicons-editor-help" data-id="cron-time-zone"></span>', 'boldgrid-backup' ),
|
297 |
+
'v' => $this->cron_test->get_preflight_markup(),
|
298 |
+
);
|
299 |
+
|
300 |
$tests[] = array(
|
301 |
'k' => __( 'Cron jobs:', 'boldgrid-backup' ),
|
302 |
'v' => '<pre>' . implode( '<br /><br />', $our_crons ) . '</pre>',
|
303 |
);
|
304 |
|
305 |
+
$tests[] = array(
|
306 |
+
'k' => __( 'Method used to read cron:', 'boldgrid-backup' ),
|
307 |
+
'v' => $this->backup_dir->can_exec_write() ? __( 'Crontab output to file.', 'boldgrid-backup' ) : __( 'Crontab read via exec function.', 'boldgrid-backup' ),
|
308 |
+
);
|
309 |
+
|
310 |
$tests[] = array(
|
311 |
'k' => __( 'WP Cron enabled?', 'boldgrid-backup' ),
|
312 |
'v' => ( $this->test->wp_cron_enabled() ? 'Yes' : 'No' ),
|
416 |
} elseif ( isset( $test['k'] ) ) {
|
417 |
$table .= sprintf(
|
418 |
'<tr><td>%1$s</td><td><em>%2$s</em></td></tr>',
|
419 |
+
wp_kses( $test['k'], $allowed_tags ),
|
420 |
wp_kses( $test['v'], $allowed_tags )
|
421 |
);
|
422 |
} else {
|
admin/partials/boldgrid-backup-admin-tools.php
CHANGED
@@ -23,6 +23,11 @@ $sections = array(
|
|
23 |
'title' => __( 'Local & Remote', 'boldgrid-backup' ),
|
24 |
'content' => include BOLDGRID_BACKUP_PATH . '/admin/partials/tools/local-remote.php',
|
25 |
),
|
|
|
|
|
|
|
|
|
|
|
26 |
),
|
27 |
);
|
28 |
|
23 |
'title' => __( 'Local & Remote', 'boldgrid-backup' ),
|
24 |
'content' => include BOLDGRID_BACKUP_PATH . '/admin/partials/tools/local-remote.php',
|
25 |
),
|
26 |
+
array(
|
27 |
+
'id' => 'section_cron_log',
|
28 |
+
'title' => __( 'Cron Log', 'boldgrid-backup' ),
|
29 |
+
'content' => $this->core->cron_log->get_markup(),
|
30 |
+
),
|
31 |
),
|
32 |
);
|
33 |
|
boldgrid-backup-cron.php
CHANGED
@@ -15,9 +15,15 @@
|
|
15 |
|
16 |
// phpcs:disable WordPress.VIP
|
17 |
|
|
|
|
|
|
|
|
|
18 |
// Abort if not being ran from the command line.
|
19 |
-
if ( !
|
20 |
-
|
|
|
|
|
21 |
}
|
22 |
|
23 |
// Initialize $input and $error.
|
@@ -45,6 +51,7 @@ foreach ( $required_arguments as $required_argument ) {
|
|
45 |
}
|
46 |
|
47 |
if ( $error ) {
|
|
|
48 |
die( $error ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
49 |
}
|
50 |
|
@@ -55,7 +62,9 @@ $valid_modes = array(
|
|
55 |
);
|
56 |
|
57 |
if ( ! in_array( $input['mode'], $valid_modes, true ) ) {
|
58 |
-
|
|
|
|
|
59 |
}
|
60 |
|
61 |
// Make an ajax call to run jobs, and report status.
|
@@ -70,7 +79,9 @@ $result = $url_helper->call_url( $url );
|
|
70 |
if ( false !== $result ) {
|
71 |
$message = $result;
|
72 |
} else {
|
73 |
-
$
|
|
|
|
|
74 |
}
|
75 |
|
76 |
die( $message ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
15 |
|
16 |
// phpcs:disable WordPress.VIP
|
17 |
|
18 |
+
require dirname( __FILE__ ) . '/admin/class-boldgrid-backup-admin-cron-log.php';
|
19 |
+
require dirname( __FILE__ ) . '/cron/class-boldgrid-backup-cron-helper.php';
|
20 |
+
$cron_helper = new Boldgrid_Backup_Cron_Helper();
|
21 |
+
|
22 |
// Abort if not being ran from the command line.
|
23 |
+
if ( ! $cron_helper->is_cli() ) {
|
24 |
+
$error = 'Error: No parameters were passed. A "siteurl", "mode", and "id" are required.';
|
25 |
+
Boldgrid_Backup_Admin_Cron_Log::add_log( $error );
|
26 |
+
die( $error . "\n" ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
27 |
}
|
28 |
|
29 |
// Initialize $input and $error.
|
51 |
}
|
52 |
|
53 |
if ( $error ) {
|
54 |
+
Boldgrid_Backup_Admin_Cron_Log::add_log( $error );
|
55 |
die( $error ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
56 |
}
|
57 |
|
62 |
);
|
63 |
|
64 |
if ( ! in_array( $input['mode'], $valid_modes, true ) ) {
|
65 |
+
$error = 'Error: Invalid mode "' . $input['mode'] . '".';
|
66 |
+
Boldgrid_Backup_Admin_Cron_Log::add_log( $error );
|
67 |
+
die( $error ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
68 |
}
|
69 |
|
70 |
// Make an ajax call to run jobs, and report status.
|
79 |
if ( false !== $result ) {
|
80 |
$message = $result;
|
81 |
} else {
|
82 |
+
$error = 'Error: Could not reach admin-ajax.php address';
|
83 |
+
Boldgrid_Backup_Admin_Cron_Log::add_log( $error );
|
84 |
+
$message = $error . ': "' . $url . '".';
|
85 |
}
|
86 |
|
87 |
die( $message ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
boldgrid-backup.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: BoldGrid Backup
|
17 |
* Plugin URI: https://www.boldgrid.com/boldgrid-backup/
|
18 |
* Description: BoldGrid Backup provides WordPress backup and restoration with update protection.
|
19 |
-
* Version: 1.6.
|
20 |
* Author: BoldGrid
|
21 |
* Author URI: https://www.boldgrid.com/
|
22 |
* License: GPL-2.0+
|
16 |
* Plugin Name: BoldGrid Backup
|
17 |
* Plugin URI: https://www.boldgrid.com/boldgrid-backup/
|
18 |
* Description: BoldGrid Backup provides WordPress backup and restoration with update protection.
|
19 |
+
* Version: 1.6.5
|
20 |
* Author: BoldGrid
|
21 |
* Author URI: https://www.boldgrid.com/
|
22 |
* License: GPL-2.0+
|
cron/class-boldgrid-backup-cron-helper.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File: class-boldgrid-backup-cron-helper.php
|
4 |
+
*
|
5 |
+
* @link https://www.boldgrid.com
|
6 |
+
* @since 1.6.5
|
7 |
+
*
|
8 |
+
* @package Boldgrid_Backup
|
9 |
+
* @copyright BoldGrid
|
10 |
+
* @version $Id$
|
11 |
+
* @author BoldGrid <support@boldgrid.com>
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class: Boldgrid_Backup_Cron_Helper
|
16 |
+
*
|
17 |
+
* @since 1.6.5
|
18 |
+
*/
|
19 |
+
class Boldgrid_Backup_Cron_Helper {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Determine if we are in the cli.
|
23 |
+
*
|
24 |
+
* @since 1.6.5
|
25 |
+
*
|
26 |
+
* @return bool
|
27 |
+
*/
|
28 |
+
public function is_cli() {
|
29 |
+
return isset( $_SERVER['argv'], $_SERVER['argc'] ) || $_SERVER['argc']; // phpcs:ignore
|
30 |
+
}
|
31 |
+
}
|
cron/cron-test.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* File: cron-test.php
|
4 |
+
*
|
5 |
+
* For a full description of what this test is doing and why, please see
|
6 |
+
* Boldgrid_Backup_Admin_Cron_Test::setup()
|
7 |
+
*
|
8 |
+
* @link https://www.boldgrid.com
|
9 |
+
* @since 1.6.5
|
10 |
+
*
|
11 |
+
* @package Boldgrid_Backup
|
12 |
+
* @subpackage Boldgrid_Backup/admin
|
13 |
+
* @copyright BoldGrid
|
14 |
+
* @version $Id$
|
15 |
+
* @author BoldGrid <support@boldgrid.com>
|
16 |
+
*/
|
17 |
+
|
18 |
+
// Require the cron helper class.
|
19 |
+
require dirname( __FILE__ ) . '/class-boldgrid-backup-cron-helper.php';
|
20 |
+
$cron_helper = new Boldgrid_Backup_Cron_Helper();
|
21 |
+
|
22 |
+
// Abort if not being ran from the command line.
|
23 |
+
if ( ! $cron_helper->is_cli() ) {
|
24 |
+
die();
|
25 |
+
}
|
26 |
+
|
27 |
+
$minute = date( 'i', time() );
|
28 |
+
$config = __DIR__ . '/cron-test.config';
|
29 |
+
$result = __DIR__ . '/cron-test.result';
|
30 |
+
|
31 |
+
if ( file_exists( $result ) ) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
$configs = json_decode( file_get_contents( $config ), true ); // phpcs:ignore
|
36 |
+
if ( empty( $configs ) ) {
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
/*
|
41 |
+
* Try to find a match in the configs.
|
42 |
+
*
|
43 |
+
* Loop through all of the configs. If the current minute matches the minute of one of our configs,
|
44 |
+
* log the results.
|
45 |
+
*/
|
46 |
+
foreach ( $configs as $config ) {
|
47 |
+
$config_minute = date( 'i', $config['time'] );
|
48 |
+
|
49 |
+
if ( $minute === $config_minute ) {
|
50 |
+
$results = array(
|
51 |
+
'offset' => $config['offset'],
|
52 |
+
);
|
53 |
+
|
54 |
+
file_put_contents( $result, json_encode( $results ) ); // phpcs:ignore
|
55 |
+
|
56 |
+
die();
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
includes/class-boldgrid-backup.php
CHANGED
@@ -133,6 +133,8 @@ class Boldgrid_Backup {
|
|
133 |
* The class responsible for the cron functionality in the admin area.
|
134 |
*/
|
135 |
require_once BOLDGRID_BACKUP_PATH . '/admin/class-boldgrid-backup-admin-cron.php';
|
|
|
|
|
136 |
|
137 |
/**
|
138 |
* The class responsible for the core backup functionality in the admin area.
|
@@ -393,6 +395,8 @@ class Boldgrid_Backup {
|
|
393 |
$this->loader->add_action( 'wp_ajax_nopriv_boldgrid_backup_run_jobs', $plugin_admin_core->jobs, 'run' );
|
394 |
$this->loader->add_action( 'wp_ajax_nopriv_boldgrid_backup_run_backup', $plugin_admin_core->cron, 'backup' );
|
395 |
$this->loader->add_action( 'wp_ajax_nopriv_boldgrid_backup_run_restore', $plugin_admin_core->cron, 'restore' );
|
|
|
|
|
396 |
}
|
397 |
|
398 |
/**
|
133 |
* The class responsible for the cron functionality in the admin area.
|
134 |
*/
|
135 |
require_once BOLDGRID_BACKUP_PATH . '/admin/class-boldgrid-backup-admin-cron.php';
|
136 |
+
require_once BOLDGRID_BACKUP_PATH . '/admin/class-boldgrid-backup-admin-cron-test.php';
|
137 |
+
require_once BOLDGRID_BACKUP_PATH . '/admin/class-boldgrid-backup-admin-cron-log.php';
|
138 |
|
139 |
/**
|
140 |
* The class responsible for the core backup functionality in the admin area.
|
395 |
$this->loader->add_action( 'wp_ajax_nopriv_boldgrid_backup_run_jobs', $plugin_admin_core->jobs, 'run' );
|
396 |
$this->loader->add_action( 'wp_ajax_nopriv_boldgrid_backup_run_backup', $plugin_admin_core->cron, 'backup' );
|
397 |
$this->loader->add_action( 'wp_ajax_nopriv_boldgrid_backup_run_restore', $plugin_admin_core->cron, 'restore' );
|
398 |
+
|
399 |
+
$this->loader->add_action( 'admin_notices', $plugin_admin_core->cron_log, 'admin_notice' );
|
400 |
}
|
401 |
|
402 |
/**
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: boldgrid, joemoto, imh_brad, rramo012, timph, bgnicolepaschen
|
3 |
Tags: boldgrid, backup, restore, migrate, migration
|
4 |
Requires at least: 4.4
|
5 |
-
Tested up to: 4.9.
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -28,6 +28,14 @@ WordPress backup and restoration with update protection.
|
|
28 |
|
29 |
== Changelog ==
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
= 1.6.4 =
|
32 |
|
33 |
Release Date: July 17th, 2018
|
2 |
Contributors: boldgrid, joemoto, imh_brad, rramo012, timph, bgnicolepaschen
|
3 |
Tags: boldgrid, backup, restore, migrate, migration
|
4 |
Requires at least: 4.4
|
5 |
+
Tested up to: 4.9.8
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 1.6.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
28 |
|
29 |
== Changelog ==
|
30 |
|
31 |
+
= 1.6.5 =
|
32 |
+
|
33 |
+
Release Date: July 31st, 2018
|
34 |
+
|
35 |
+
* New feature: Preflight test to see if server time zone matches cron time.
|
36 |
+
* Bug fix: argv variables missing, Enabled register_argc_argv within cron command.
|
37 |
+
* Bug fix: Failed crons now write to log.
|
38 |
+
|
39 |
= 1.6.4 =
|
40 |
|
41 |
Release Date: July 17th, 2018
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit4e27a2f292eee7f82164be02fc946e09::getLoader();
|
vendor/boldgrid/library/.editorconfig
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
root = true
|
2 |
+
|
3 |
+
[*]
|
4 |
+
indent_style = tab
|
5 |
+
indent_size = 4
|
6 |
+
end_of_line = lf
|
7 |
+
charset = utf-8
|
8 |
+
trim_trailing_whitespace = true
|
9 |
+
insert_final_newline = true
|
10 |
+
|
11 |
+
[*.md]
|
12 |
+
trim_trailing_whitespace = false
|
vendor/boldgrid/library/README.md
CHANGED
@@ -11,7 +11,19 @@ composer require boldgrid/library
|
|
11 |
|
12 |
## Changelog ##
|
13 |
|
14 |
-
### 2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
* Update: JIRA BGINSP-23 Updated "boldgrid_available" transient lifetime and checking. Also fixed fatal error when API has an error response.
|
16 |
|
17 |
### 2.3.5 ###
|
11 |
|
12 |
## Changelog ##
|
13 |
|
14 |
+
### 2.4.2 ###
|
15 |
+
* Bug fix: Show timeout message when saving key times out.
|
16 |
+
* Bug fix: Misc bug fuxes.
|
17 |
+
|
18 |
+
### 2.4.1 ###
|
19 |
+
* Fix: Display issue with key entry prompt HTML.
|
20 |
+
|
21 |
+
### 2.4.0 ###
|
22 |
+
* Feature: JIRA BGTHEME-361 BoldGrid Connect Page.
|
23 |
+
* Feature: JIRA BGTHEME-361 Admin Bar Menus.
|
24 |
+
* Update: JIRA WPB-3922 Updated license API to v2.
|
25 |
+
|
26 |
+
### 2.3.6 ###
|
27 |
* Update: JIRA BGINSP-23 Updated "boldgrid_available" transient lifetime and checking. Also fixed fatal error when API has an error response.
|
28 |
|
29 |
### 2.3.5 ###
|
vendor/boldgrid/library/src/Library/Api/Call.php
CHANGED
@@ -120,7 +120,6 @@ class Call {
|
|
120 |
* @return array $args The args class property.
|
121 |
*/
|
122 |
protected function setArgs( $args ) {
|
123 |
-
|
124 |
// Check for an API key being stored.
|
125 |
if ( $this->getKey() ) {
|
126 |
$args = wp_parse_args( $args, array( 'key' => $this->getKey() ) );
|
@@ -131,7 +130,10 @@ class Call {
|
|
131 |
$args = wp_parse_args( $args, array( 'site_hash' => $this->getSiteHash() ) );
|
132 |
}
|
133 |
|
134 |
-
return $this->args = array(
|
|
|
|
|
|
|
135 |
}
|
136 |
|
137 |
/**
|
120 |
* @return array $args The args class property.
|
121 |
*/
|
122 |
protected function setArgs( $args ) {
|
|
|
123 |
// Check for an API key being stored.
|
124 |
if ( $this->getKey() ) {
|
125 |
$args = wp_parse_args( $args, array( 'key' => $this->getKey() ) );
|
130 |
$args = wp_parse_args( $args, array( 'site_hash' => $this->getSiteHash() ) );
|
131 |
}
|
132 |
|
133 |
+
return $this->args = array(
|
134 |
+
'timeout' => 15, // Default timeout is 5 seconds, change to 15.
|
135 |
+
'body' => $args
|
136 |
+
);
|
137 |
}
|
138 |
|
139 |
/**
|
vendor/boldgrid/library/src/Library/Asset.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Manage javascript, css, and images. Front end assets.
|
4 |
+
*
|
5 |
+
* @package Boldgrid\Library
|
6 |
+
* @subpackage \Library\Library\Asset
|
7 |
+
*
|
8 |
+
* @version 2.4.0
|
9 |
+
* @author BoldGrid <wpb@boldgrid.com>
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Boldgrid\Library\Library;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Manage javascript, css, and images. Front end assets.
|
16 |
+
*
|
17 |
+
* @since 2.4.0.
|
18 |
+
*/
|
19 |
+
class Asset {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Add all filters for this class.
|
23 |
+
*
|
24 |
+
* @since 2.4.0
|
25 |
+
*/
|
26 |
+
public function __construct() {
|
27 |
+
Filter::add( $this );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Add styles for all admin pages.
|
32 |
+
*
|
33 |
+
* @since 2.4.0
|
34 |
+
*
|
35 |
+
* @hook admin_enqueue_scripts
|
36 |
+
*/
|
37 |
+
public function addStyles() {
|
38 |
+
wp_enqueue_style( 'bglib-admin',
|
39 |
+
Configs::get( 'libraryUrl' ) . 'src/assets/css/admin.css' );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
?>
|
vendor/boldgrid/library/src/Library/Configs.php
CHANGED
@@ -92,4 +92,15 @@ class Configs {
|
|
92 |
|
93 |
return $configs;
|
94 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
92 |
|
93 |
return $configs;
|
94 |
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Set a new configuration item
|
98 |
+
*
|
99 |
+
* @since 2.4.0
|
100 |
+
*
|
101 |
+
* @param string $key Name of new item.
|
102 |
+
*/
|
103 |
+
public static function setItem( $key, $value ) {
|
104 |
+
self::$configs[ $key ] = $value;
|
105 |
+
}
|
106 |
}
|
vendor/boldgrid/library/src/Library/Key.php
CHANGED
@@ -48,6 +48,15 @@ class Key {
|
|
48 |
*/
|
49 |
protected $releaseChannel;
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
/**
|
52 |
* Initialize class and set class properties.
|
53 |
*
|
@@ -59,8 +68,7 @@ class Key {
|
|
59 |
$this->releaseChannel = $releaseChannel;
|
60 |
$this->setValid();
|
61 |
$this->setLicense();
|
62 |
-
$this->setNotice();
|
63 |
-
$this->addNotices();
|
64 |
}
|
65 |
|
66 |
/**
|
@@ -85,6 +93,17 @@ class Key {
|
|
85 |
return $this->license;
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
/**
|
89 |
* Set $valid class property.
|
90 |
*
|
@@ -136,14 +155,18 @@ class Key {
|
|
136 |
*
|
137 |
* @since 1.0.0
|
138 |
*/
|
139 |
-
public function setNotice() {
|
|
|
|
|
|
|
|
|
140 |
// If we already have transient data saying the API is not available.
|
141 |
if ( 0 === get_site_transient( 'boldgrid_available' ) ) {
|
142 |
return new Notice( 'ConnectionIssue' );
|
143 |
}
|
144 |
|
145 |
// If we don't have a key stored, or this is not a valid response when calling.
|
146 |
-
if ( ! Configs::get( 'key' ) || ! self::$valid ) {
|
147 |
return new Notice( 'keyPrompt', $this );
|
148 |
}
|
149 |
}
|
@@ -288,15 +311,4 @@ class Key {
|
|
288 |
// Return back the transient data object.
|
289 |
return $data;
|
290 |
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Add additional admin notices.
|
294 |
-
*
|
295 |
-
* @since 2.1.0
|
296 |
-
*
|
297 |
-
* @see \Boldgrid\Library\Library\Notice()
|
298 |
-
*/
|
299 |
-
public function addNotices() {
|
300 |
-
$claimPremiumKey = new Notice( 'ClaimPremiumKey', $this );
|
301 |
-
}
|
302 |
}
|
48 |
*/
|
49 |
protected $releaseChannel;
|
50 |
|
51 |
+
/**
|
52 |
+
* @access protected
|
53 |
+
*
|
54 |
+
* @since 2.4.0
|
55 |
+
*
|
56 |
+
* @var \Boldgrid\Library\Library\Notice
|
57 |
+
*/
|
58 |
+
protected $notice;
|
59 |
+
|
60 |
/**
|
61 |
* Initialize class and set class properties.
|
62 |
*
|
68 |
$this->releaseChannel = $releaseChannel;
|
69 |
$this->setValid();
|
70 |
$this->setLicense();
|
71 |
+
$this->notice = $this->setNotice();
|
|
|
72 |
}
|
73 |
|
74 |
/**
|
93 |
return $this->license;
|
94 |
}
|
95 |
|
96 |
+
/**
|
97 |
+
* Get the currently set notice.
|
98 |
+
*
|
99 |
+
* @since 2.4.0
|
100 |
+
*
|
101 |
+
* @return \Boldgrid\Library\Library\Notice Notice set.
|
102 |
+
*/
|
103 |
+
public function getNotice() {
|
104 |
+
return $this->notice;
|
105 |
+
}
|
106 |
+
|
107 |
/**
|
108 |
* Set $valid class property.
|
109 |
*
|
155 |
*
|
156 |
* @since 1.0.0
|
157 |
*/
|
158 |
+
public function setNotice( $forceDisplay = false ) {
|
159 |
+
if ( $this->notice ) {
|
160 |
+
return $this->notice;
|
161 |
+
}
|
162 |
+
|
163 |
// If we already have transient data saying the API is not available.
|
164 |
if ( 0 === get_site_transient( 'boldgrid_available' ) ) {
|
165 |
return new Notice( 'ConnectionIssue' );
|
166 |
}
|
167 |
|
168 |
// If we don't have a key stored, or this is not a valid response when calling.
|
169 |
+
if ( ! Configs::get( 'key' ) || ! self::$valid || $forceDisplay ) {
|
170 |
return new Notice( 'keyPrompt', $this );
|
171 |
}
|
172 |
}
|
311 |
// Return back the transient data object.
|
312 |
return $data;
|
313 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
}
|
vendor/boldgrid/library/src/Library/License.php
CHANGED
@@ -22,7 +22,6 @@ use Boldgrid\Library\Library;
|
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class License {
|
25 |
-
|
26 |
/**
|
27 |
* @access private
|
28 |
*
|
@@ -40,6 +39,15 @@ class License {
|
|
40 |
$licenseString,
|
41 |
$data;
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* Initialize class and set class properties.
|
45 |
*
|
@@ -134,7 +142,8 @@ class License {
|
|
134 |
private function setLicense() {
|
135 |
if ( ! get_option( 'boldgrid_api_key' ) ) {
|
136 |
$license = 'Missing Connect Key';
|
137 |
-
} else if ( ! $license = $this->getTransient() ) {
|
|
|
138 |
$license = $this->getRemoteLicense();
|
139 |
}
|
140 |
|
@@ -187,7 +196,7 @@ class License {
|
|
187 |
$license->cipher,
|
188 |
$license->key,
|
189 |
0,
|
190 |
-
|
191 |
)
|
192 |
);
|
193 |
}
|
@@ -240,12 +249,16 @@ class License {
|
|
240 |
/**
|
241 |
* Get the latest license data from the API server.
|
242 |
*
|
|
|
|
|
243 |
* @since 1.0.0
|
244 |
*
|
245 |
* @return mixed $response The remote license data object or error string.
|
246 |
*/
|
247 |
private function getRemoteLicense() {
|
248 |
-
$call = new Api\Call( Configs::get( 'api' ) . '/api/plugin/getLicense'
|
|
|
|
|
249 |
if ( ! $response = $call->getError() ) {
|
250 |
$response = $call->getResponse()->result->data;
|
251 |
}
|
@@ -260,7 +273,7 @@ class License {
|
|
260 |
*
|
261 |
* @return string $key The key class property.
|
262 |
*/
|
263 |
-
|
264 |
return $this->key;
|
265 |
}
|
266 |
|
@@ -346,6 +359,7 @@ class License {
|
|
346 |
*/
|
347 |
public function initLicense() {
|
348 |
$this->license = $this->setLicense();
|
|
|
349 |
if ( is_object( $this->getLicense() ) ) {
|
350 |
$this->data = $this->setData();
|
351 |
$this->setTransient( $this->getData() );
|
@@ -370,4 +384,23 @@ class License {
|
|
370 |
|
371 |
return $isPremium;
|
372 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
}
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
class License {
|
|
|
25 |
/**
|
26 |
* @access private
|
27 |
*
|
39 |
$licenseString,
|
40 |
$data;
|
41 |
|
42 |
+
/**
|
43 |
+
* API version number.
|
44 |
+
*
|
45 |
+
* @since 2.4.0
|
46 |
+
*
|
47 |
+
* @var int
|
48 |
+
*/
|
49 |
+
private $apiVersion = 2;
|
50 |
+
|
51 |
/**
|
52 |
* Initialize class and set class properties.
|
53 |
*
|
142 |
private function setLicense() {
|
143 |
if ( ! get_option( 'boldgrid_api_key' ) ) {
|
144 |
$license = 'Missing Connect Key';
|
145 |
+
} else if ( ! ( $license = $this->getTransient() ) || ! $this->isVersionValid( $license ) ) {
|
146 |
+
delete_site_transient( $this->getKey() );
|
147 |
$license = $this->getRemoteLicense();
|
148 |
}
|
149 |
|
196 |
$license->cipher,
|
197 |
$license->key,
|
198 |
0,
|
199 |
+
urldecode( $license->iv )
|
200 |
)
|
201 |
);
|
202 |
}
|
249 |
/**
|
250 |
* Get the latest license data from the API server.
|
251 |
*
|
252 |
+
* The current API version is 2.
|
253 |
+
*
|
254 |
* @since 1.0.0
|
255 |
*
|
256 |
* @return mixed $response The remote license data object or error string.
|
257 |
*/
|
258 |
private function getRemoteLicense() {
|
259 |
+
$call = new Api\Call( Configs::get( 'api' ) . '/api/plugin/getLicense?v=' .
|
260 |
+
$this->apiVersion );
|
261 |
+
|
262 |
if ( ! $response = $call->getError() ) {
|
263 |
$response = $call->getResponse()->result->data;
|
264 |
}
|
273 |
*
|
274 |
* @return string $key The key class property.
|
275 |
*/
|
276 |
+
public function getKey() {
|
277 |
return $this->key;
|
278 |
}
|
279 |
|
359 |
*/
|
360 |
public function initLicense() {
|
361 |
$this->license = $this->setLicense();
|
362 |
+
|
363 |
if ( is_object( $this->getLicense() ) ) {
|
364 |
$this->data = $this->setData();
|
365 |
$this->setTransient( $this->getData() );
|
384 |
|
385 |
return $isPremium;
|
386 |
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* Check if the license version and encoding is correct.
|
390 |
+
*
|
391 |
+
* The license data is valid (for the API version) if the "version" and "iv" properties are set,
|
392 |
+
* the decoded initialization vector (iv) is 16 characters in length, and the "version" is
|
393 |
+
* $this->apiVersion.
|
394 |
+
*
|
395 |
+
* @since 2.4.0
|
396 |
+
*
|
397 |
+
* @param Object $license Current license data.
|
398 |
+
*
|
399 |
+
* @return bool
|
400 |
+
*/
|
401 |
+
public function isVersionValid( $license ) {
|
402 |
+
return ( ! empty( $license->version ) && ! empty( $license->iv ) &&
|
403 |
+
16 === strlen( urldecode( $license->iv ) ) &&
|
404 |
+
$this->apiVersion === $license->version );
|
405 |
+
}
|
406 |
}
|
vendor/boldgrid/library/src/Library/Menu/External.php
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Create the BoldGrid Menu in the upper left of the admin screen.
|
4 |
+
*
|
5 |
+
* @package Boldgrid\Library
|
6 |
+
* @subpackage \Library\Menu
|
7 |
+
*
|
8 |
+
* @version 2.4.0
|
9 |
+
* @author BoldGrid <wpb@boldgrid.com>
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Boldgrid\Library\Library\Menu;
|
13 |
+
|
14 |
+
use Boldgrid\Library\Library\Filter;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Create the BoldGrid Menu in the upper left of the admin screen.
|
18 |
+
*
|
19 |
+
* @since 2.4.0
|
20 |
+
*/
|
21 |
+
class External {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add Filters.
|
25 |
+
*
|
26 |
+
* @since 2.4.0
|
27 |
+
*/
|
28 |
+
public function __construct() {
|
29 |
+
Filter::add( $this );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Add Menu item configurations.
|
34 |
+
*
|
35 |
+
* @hook: admin_bar_menu
|
36 |
+
*
|
37 |
+
* @since 2.4.0
|
38 |
+
*
|
39 |
+
* @param WP_Admin_Bar $wpAdminBar Admin Bar.
|
40 |
+
*/
|
41 |
+
public function addMenu( $wpAdminBar ) {
|
42 |
+
Render::adminBarNode( $wpAdminBar, $this->getMenuItems() );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get the menu items for this location.
|
47 |
+
*
|
48 |
+
* @since 2.4.0
|
49 |
+
*
|
50 |
+
* @return array Menu Items.
|
51 |
+
*/
|
52 |
+
protected function getMenuItems() {
|
53 |
+
return array(
|
54 |
+
'topLevel' => array(
|
55 |
+
'id' => 'boldgrid-adminbar-icon',
|
56 |
+
'title' => '<span aria-hidden="true" class="boldgrid-icon ab-icon"></span>',
|
57 |
+
'href' => 'https://www.boldgrid.com/',
|
58 |
+
'meta' => array(
|
59 |
+
'class' => 'boldgrid-node-icon',
|
60 |
+
),
|
61 |
+
),
|
62 |
+
'items' => array(
|
63 |
+
array(
|
64 |
+
'id' => 'boldgrid-site-url',
|
65 |
+
'parent' => 'boldgrid-adminbar-icon',
|
66 |
+
'title' => __( 'BoldGrid.com', 'boldgrid-inspirations' ),
|
67 |
+
'href' => 'https://www.boldgrid.com/',
|
68 |
+
'meta' => array(
|
69 |
+
'class' => 'boldgrid-dropdown',
|
70 |
+
'target' => '_blank',
|
71 |
+
'title' => 'BoldGrid.com',
|
72 |
+
),
|
73 |
+
),
|
74 |
+
array(
|
75 |
+
'id' => 'boldgrid-site-documentation',
|
76 |
+
'parent' => 'boldgrid-adminbar-icon',
|
77 |
+
'title' => __( 'Documentation', 'boldgrid-inspirations' ),
|
78 |
+
'href' => 'https://www.boldgrid.com/docs',
|
79 |
+
'meta' => array(
|
80 |
+
'class' => 'boldgrid-dropdown',
|
81 |
+
'target' => '_blank',
|
82 |
+
'title' => 'Documentation',
|
83 |
+
),
|
84 |
+
),
|
85 |
+
array(
|
86 |
+
'id' => 'boldgrid-central-url',
|
87 |
+
'parent' => 'boldgrid-adminbar-icon',
|
88 |
+
'title' => __( 'BoldGrid Central', 'boldgrid-inspirations' ),
|
89 |
+
'href' => 'https://www.boldgrid.com/central',
|
90 |
+
'meta' => array(
|
91 |
+
'class' => 'boldgrid-dropdown',
|
92 |
+
'target' => '_blank',
|
93 |
+
'title' => 'BoldGrid Central',
|
94 |
+
),
|
95 |
+
),
|
96 |
+
array(
|
97 |
+
'id' => 'boldgrid-connect-url',
|
98 |
+
'parent' => 'boldgrid-adminbar-icon',
|
99 |
+
'title' => __( 'BoldGrid Connect', 'boldgrid-inspirations' ),
|
100 |
+
'href' => get_admin_url( null, 'options-general.php?page=boldgrid-connect.php' ),
|
101 |
+
'meta' => array(
|
102 |
+
'class' => 'boldgrid-dropdown',
|
103 |
+
'title' => 'BoldGrid Connect',
|
104 |
+
),
|
105 |
+
),
|
106 |
+
array(
|
107 |
+
'id' => 'boldgrid-feedback-url',
|
108 |
+
'parent' => 'boldgrid-adminbar-icon',
|
109 |
+
'title' => __( 'Feedback', 'boldgrid-inspirations' ),
|
110 |
+
'href' => 'https://www.boldgrid.com/feedback',
|
111 |
+
'meta' => array(
|
112 |
+
'class' => 'boldgrid-dropdown',
|
113 |
+
'target' => '_blank',
|
114 |
+
'title' => 'Feedback',
|
115 |
+
),
|
116 |
+
),
|
117 |
+
),
|
118 |
+
);
|
119 |
+
}
|
120 |
+
}
|
vendor/boldgrid/library/src/Library/Menu/Render.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Create the BoldGrid Menu in the upper left of the admin screen.
|
4 |
+
*
|
5 |
+
* @package Boldgrid\Library
|
6 |
+
* @subpackage \Library\Menu
|
7 |
+
*
|
8 |
+
* @version 2.4.0
|
9 |
+
* @author BoldGrid <wpb@boldgrid.com>
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Boldgrid\Library\Library\Menu;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Create the BoldGrid Menu in the upper left of the admin screen.
|
16 |
+
*
|
17 |
+
* @since 2.4.0
|
18 |
+
*/
|
19 |
+
class Render {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Given a configuration of menu items to be added on
|
23 |
+
*
|
24 |
+
* @since 2.4.0
|
25 |
+
*
|
26 |
+
* @param WP_Admin_Bar $wpAdminBar Admin Bar.
|
27 |
+
* @param array $configs Configurations for the menu.
|
28 |
+
*/
|
29 |
+
public static function adminBarNode( $wpAdminBar, $configs ) {
|
30 |
+
$wpAdminBar->add_node( $configs['topLevel'] );
|
31 |
+
foreach ( $configs['items'] as $item ) {
|
32 |
+
$wpAdminBar->add_menu( $item );
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
vendor/boldgrid/library/src/Library/Menu/Reseller.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Create the reseller menu in the upper left admin section.
|
4 |
+
*
|
5 |
+
* @package Boldgrid\Library
|
6 |
+
* @subpackage \Library\Menu
|
7 |
+
*
|
8 |
+
* @version 2.4.0
|
9 |
+
* @author BoldGrid <wpb@boldgrid.com>
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Boldgrid\Library\Library\Menu;
|
13 |
+
|
14 |
+
use Boldgrid\Library\Library\Filter;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Create the reseller menu in the upper left admin section.
|
18 |
+
*
|
19 |
+
* @since 2.4.0
|
20 |
+
*/
|
21 |
+
class Reseller {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Reseller DB option.
|
25 |
+
*
|
26 |
+
* @since 2.4.0
|
27 |
+
*
|
28 |
+
* @var array boldgrid_reseller option.
|
29 |
+
*/
|
30 |
+
protected $resellerOption;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Add Filters.
|
34 |
+
*
|
35 |
+
* @since 2.4.0
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
+
$this->resellerOption = get_option( 'boldgrid_reseller' );
|
39 |
+
|
40 |
+
if ( ! empty( $this->resellerOption['reseller_identifier'] ) ) {
|
41 |
+
Filter::add( $this );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get the reseller data.
|
47 |
+
*
|
48 |
+
* @since 2.4.0
|
49 |
+
*
|
50 |
+
* @return array Reseller information.
|
51 |
+
*/
|
52 |
+
public function getData() {
|
53 |
+
$data = $this->resellerOption;
|
54 |
+
|
55 |
+
$data['reseller_identifier'] = ! empty( $data['reseller_identifier'] ) ?
|
56 |
+
strtolower( $data['reseller_identifier'] ) : null;
|
57 |
+
|
58 |
+
$data['reseller_website_url'] = ! empty( $data['reseller_website_url'] ) ?
|
59 |
+
esc_url( $data['reseller_website_url'] ) : 'https://www.boldgrid.com/';
|
60 |
+
|
61 |
+
$data['reseller_title'] = ! empty( $data['reseller_title'] ) ?
|
62 |
+
esc_html__( $data['reseller_title'] ) : esc_html__( 'BoldGrid.com' );
|
63 |
+
|
64 |
+
$data['reseller_support_url'] = ! empty( $data['reseller_support_url'] ) ?
|
65 |
+
esc_url( $data['reseller_support_url'] ) : 'https://www.boldgrid.com/documentation';
|
66 |
+
|
67 |
+
$data['reseller_amp_url'] = ! empty( $data['reseller_amp_url'] ) ?
|
68 |
+
esc_url( $data['reseller_amp_url'] ) : 'https://www.boldgrid.com/central';
|
69 |
+
|
70 |
+
return $data;
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Add Menu item configurations.
|
75 |
+
*
|
76 |
+
* @hook: admin_bar_menu
|
77 |
+
* @priority: 15
|
78 |
+
*
|
79 |
+
* @since 2.4.0
|
80 |
+
*
|
81 |
+
* @param WP_Admin_Bar $wpAdminBar Admin Bar.
|
82 |
+
*/
|
83 |
+
public function addMenu( $wpAdminBar ) {
|
84 |
+
Render::adminBarNode( $wpAdminBar, $this->getMenuItems() );
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Get the menu items for this location.
|
89 |
+
*
|
90 |
+
* @since 2.4.0
|
91 |
+
*
|
92 |
+
* @return array Menu Items.
|
93 |
+
*/
|
94 |
+
protected function getMenuItems() {
|
95 |
+
$data = $this->getData();
|
96 |
+
|
97 |
+
return array(
|
98 |
+
'topLevel' => array(
|
99 |
+
'id' => 'reseller-adminbar-icon',
|
100 |
+
'title' => '<span aria-hidden="true" class="' . $data['reseller_identifier'] .
|
101 |
+
'-icon ab-icon"></span>',
|
102 |
+
'href' => $data['reseller_website_url'],
|
103 |
+
'meta' => array(
|
104 |
+
'class' => 'reseller-node-icon',
|
105 |
+
),
|
106 |
+
),
|
107 |
+
'items' => array(
|
108 |
+
array(
|
109 |
+
'id' => 'reseller-site-url',
|
110 |
+
'parent' => 'reseller-adminbar-icon',
|
111 |
+
'title' => $data['reseller_title'],
|
112 |
+
'href' => $data['reseller_website_url'],
|
113 |
+
'meta' => array(
|
114 |
+
'class' => 'reseller-dropdown',
|
115 |
+
'target' => '_blank',
|
116 |
+
'title' => $data['reseller_title'],
|
117 |
+
),
|
118 |
+
),
|
119 |
+
array(
|
120 |
+
'id' => 'reseller-support-center',
|
121 |
+
'parent' => 'reseller-adminbar-icon',
|
122 |
+
'title' => esc_html__( 'Support Center' ),
|
123 |
+
'href' => $data['reseller_support_url'],
|
124 |
+
'meta' => array(
|
125 |
+
'class' => 'reseller-dropdown',
|
126 |
+
'target' => '_blank',
|
127 |
+
'title' => __( 'Support Center' ),
|
128 |
+
),
|
129 |
+
),
|
130 |
+
array(
|
131 |
+
'id' => 'reseller-amp-login',
|
132 |
+
'parent' => 'reseller-adminbar-icon',
|
133 |
+
'title' => esc_html__( 'AMP Login' ),
|
134 |
+
'href' => $data['reseller_amp_url'],
|
135 |
+
'meta' => array(
|
136 |
+
'class' => 'reseller-dropdown',
|
137 |
+
'target' => '_blank',
|
138 |
+
'title' => __( 'Account Management' ),
|
139 |
+
),
|
140 |
+
),
|
141 |
+
),
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
vendor/boldgrid/library/src/Library/Notice/ClaimPremiumKey.php
DELETED
@@ -1,196 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* File: ClaimPremiumKey.php
|
4 |
-
*
|
5 |
-
* The notice for Envato customers that have purchased the BoldGrid Prime theme.
|
6 |
-
* They are eligible to receive a free Premium Connect Key.
|
7 |
-
*
|
8 |
-
* @package Boldgrid\Library
|
9 |
-
*
|
10 |
-
* @version 2.1.0
|
11 |
-
* @author BoldGrid <wpb@boldgrid.com>
|
12 |
-
*/
|
13 |
-
|
14 |
-
namespace Boldgrid\Library\Library\Notice;
|
15 |
-
|
16 |
-
use Boldgrid\Library\Library;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* BoldGrid Library Claim Premium Key Notice.
|
20 |
-
*
|
21 |
-
* This class is responsible for adding the Claim Premium Key notice logic to a user's WordPress
|
22 |
-
* admin pages.
|
23 |
-
*
|
24 |
-
* @since 2.1.0
|
25 |
-
*/
|
26 |
-
class ClaimPremiumKey {
|
27 |
-
/**
|
28 |
-
* Bool indicating whether or not this key prompt has been dismissed by the current user.
|
29 |
-
*
|
30 |
-
* @since 2.1.0
|
31 |
-
*
|
32 |
-
* @var mixed Null if not set, otherwise bool.
|
33 |
-
*/
|
34 |
-
public static $isDismissed = null;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Bool indicating whether or not we are currently showing the notice.
|
38 |
-
*
|
39 |
-
* @since 2.1.0
|
40 |
-
*
|
41 |
-
* @var bool
|
42 |
-
*/
|
43 |
-
public static $isDisplayed = false;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @access private
|
47 |
-
*
|
48 |
-
* @var object $key Key class object.
|
49 |
-
* @var string $userNoticeKey When dismissing this prompt, this is the identifier for the
|
50 |
-
* user notice.
|
51 |
-
*/
|
52 |
-
private
|
53 |
-
$key,
|
54 |
-
$userNoticeKey;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Initialize class and set class properties.
|
58 |
-
*
|
59 |
-
* This class is automatically instantiated through the following events:
|
60 |
-
* #. Boldgrid\Library\Util\Load->__construct
|
61 |
-
* #. Boldgrid\Library\Library\Start->__construct
|
62 |
-
* #. Boldgrid\Library\Library\Key->__construct
|
63 |
-
* #. Boldgrid\Library\Library\Notice->__construct
|
64 |
-
* #. Boldgrid\Library\Library\Notice\ClaimPremiumKey->__construct
|
65 |
-
*
|
66 |
-
* This is important to note because if you ever wanted to instantiate
|
67 |
-
* another KeyPrompt class, you should know it's probably already been done
|
68 |
-
* so.
|
69 |
-
*
|
70 |
-
* Some of the class properties (such as isDismissed and isDisplayed) are
|
71 |
-
* static and easily retrievable via filters.
|
72 |
-
*
|
73 |
-
* @since 2.1.0
|
74 |
-
*
|
75 |
-
* @param \Boldgrid\Library\Library\Key Key object.
|
76 |
-
*/
|
77 |
-
public function __construct( Library\Key $key ) {
|
78 |
-
$this->key = $key;
|
79 |
-
$this->userNoticeKey = 'bg-claim-premium';
|
80 |
-
Library\Filter::add( $this );
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Displays the notice.
|
85 |
-
*
|
86 |
-
* Enabled if the filter "Boldgrid\Library\Library\Notice\ClaimPremiumKey_enable" is true.
|
87 |
-
*
|
88 |
-
* Does not display the notice if the user dismissed it, has a Connect Key,
|
89 |
-
* or a filter says not to.
|
90 |
-
*
|
91 |
-
* @since 2.1.0
|
92 |
-
*
|
93 |
-
* @see \Boldgrid\Library\Library\Notice::isDismissed()
|
94 |
-
* @see \Boldgrid\Library\Library\Configs::get()
|
95 |
-
*
|
96 |
-
* @hook: admin_notices
|
97 |
-
*/
|
98 |
-
public function displayNotice() {
|
99 |
-
/**
|
100 |
-
* Check if the Envato notice to claim a Premium Connect Key should be enabled.
|
101 |
-
*
|
102 |
-
* A theme can add this filter and return true, which will enable this notice.
|
103 |
-
*
|
104 |
-
* @since 2.1.0
|
105 |
-
*/
|
106 |
-
$enabled = apply_filters(
|
107 |
-
'Boldgrid\Library\Library\Notice\ClaimPremiumKey_enable',
|
108 |
-
false
|
109 |
-
);
|
110 |
-
|
111 |
-
// If a Connect Key is not saved, then skip this notice; it will be in the key prompt.
|
112 |
-
$hasConnectKey = (bool) Library\Configs::get( 'key' );
|
113 |
-
|
114 |
-
if ( $enabled && $hasConnectKey ) {
|
115 |
-
$hasEnvatoPrime = false;
|
116 |
-
|
117 |
-
// If user has dismissed the notice, then do not display the notice.
|
118 |
-
$display = ! Library\Notice::isDismissed( $this->userNoticeKey );
|
119 |
-
|
120 |
-
// Do not display if user has an Envato-connected Prime theme.
|
121 |
-
$licenseData = $this->key->getLicense();
|
122 |
-
|
123 |
-
if ( $licenseData ) {
|
124 |
-
$hasEnvatoPrime = $licenseData->isPremium( 'envato-prime' );
|
125 |
-
}
|
126 |
-
|
127 |
-
if ( $hasEnvatoPrime ) {
|
128 |
-
$display = false;
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Check of there are any overrides for displaying this notice.
|
133 |
-
*
|
134 |
-
* @since 2.1.0
|
135 |
-
*/
|
136 |
-
$display = apply_filters(
|
137 |
-
'Boldgrid\Library\Library\Notice\ClaimPremiumKey_display',
|
138 |
-
$display
|
139 |
-
);
|
140 |
-
|
141 |
-
if ( $display ) {
|
142 |
-
include dirname( __DIR__ ) . '/Views/ClaimPremiumKey.php';
|
143 |
-
|
144 |
-
self::$isDisplayed = true;
|
145 |
-
}
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Key input handling.
|
151 |
-
*
|
152 |
-
* @since 1.0.0
|
153 |
-
*
|
154 |
-
* @hook: wp_ajax_addKey
|
155 |
-
*/
|
156 |
-
public function addKey() {
|
157 |
-
$key = $this->validate();
|
158 |
-
$data = $this->key->callCheckVersion( array( 'key' => $key ) );
|
159 |
-
$msg = $this->getMessages();
|
160 |
-
|
161 |
-
if ( is_object( $data ) ) {
|
162 |
-
$this->key->save( $data, $key );
|
163 |
-
wp_send_json_success( array( 'message' => $msg->success ) );
|
164 |
-
} else {
|
165 |
-
wp_send_json_error( array( 'message' => $msg->error ) );
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Get static class property isDismissed.
|
171 |
-
*
|
172 |
-
* @since 2.0.1
|
173 |
-
*
|
174 |
-
* @see \Boldgrid\Library\Library\Notice::isDismissed()
|
175 |
-
*
|
176 |
-
* @hook: Boldgrid\Library\Notice\ClaimPremiumKey\getIsDismissed
|
177 |
-
*/
|
178 |
-
public function getIsDismissed() {
|
179 |
-
if( is_null( self::$isDismissed ) ) {
|
180 |
-
self::$isDismissed = Library\Notice::isDismissed( $this->userNoticeKey );
|
181 |
-
}
|
182 |
-
|
183 |
-
return self::$isDismissed;
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Get static class property isDisplayed.
|
188 |
-
*
|
189 |
-
* @since 2.0.1
|
190 |
-
*
|
191 |
-
* @hook: Boldgrid\Library\Notice\KeyPrompt\getIsDisplayed
|
192 |
-
*/
|
193 |
-
public function getIsDisplayed() {
|
194 |
-
return self::$isDisplayed;
|
195 |
-
}
|
196 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/boldgrid/library/src/Library/Notice/KeyPrompt.php
CHANGED
@@ -12,6 +12,7 @@
|
|
12 |
namespace Boldgrid\Library\Library\Notice;
|
13 |
|
14 |
use Boldgrid\Library\Library;
|
|
|
15 |
|
16 |
/**
|
17 |
* BoldGrid Library Key Prompt Notice.
|
@@ -94,6 +95,7 @@ class KeyPrompt {
|
|
94 |
$msg->success = esc_html__( 'Your api key has been saved successfully.', 'boldgrid-inspirations' );
|
95 |
$msg->error = sprintf( esc_html__( 'Your API key appears to be invalid!%sPlease try to enter your BoldGrid Connect Key again.', 'boldgrid-inspirations' ), '<br />' );
|
96 |
$msg->nonce = esc_html__( 'Security violation! An invalid nonce was detected.', 'boldgrid-inspirations' );
|
|
|
97 |
|
98 |
return $this->messages = $msg;
|
99 |
}
|
@@ -116,6 +118,26 @@ class KeyPrompt {
|
|
116 |
);
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
/**
|
120 |
* Displays the notice.
|
121 |
*
|
@@ -164,6 +186,11 @@ class KeyPrompt {
|
|
164 |
* @hook: wp_ajax_addKey
|
165 |
*/
|
166 |
public function addKey() {
|
|
|
|
|
|
|
|
|
|
|
167 |
$key = $this->validate();
|
168 |
$data = $this->key->callCheckVersion( array( 'key' => $key ) );
|
169 |
$msg = $this->getMessages();
|
@@ -172,7 +199,8 @@ class KeyPrompt {
|
|
172 |
$this->key->save( $data, $key );
|
173 |
wp_send_json_success( array( 'message' => $msg->success ) );
|
174 |
} else {
|
175 |
-
|
|
|
176 |
}
|
177 |
}
|
178 |
|
12 |
namespace Boldgrid\Library\Library\Notice;
|
13 |
|
14 |
use Boldgrid\Library\Library;
|
15 |
+
use Boldgrid\Library\Library\Configs;
|
16 |
|
17 |
/**
|
18 |
* BoldGrid Library Key Prompt Notice.
|
95 |
$msg->success = esc_html__( 'Your api key has been saved successfully.', 'boldgrid-inspirations' );
|
96 |
$msg->error = sprintf( esc_html__( 'Your API key appears to be invalid!%sPlease try to enter your BoldGrid Connect Key again.', 'boldgrid-inspirations' ), '<br />' );
|
97 |
$msg->nonce = esc_html__( 'Security violation! An invalid nonce was detected.', 'boldgrid-inspirations' );
|
98 |
+
$msg->timeout = esc_html__( 'Connection timed out. Please try again.', 'boldgrid-inspirations' );
|
99 |
|
100 |
return $this->messages = $msg;
|
101 |
}
|
118 |
);
|
119 |
}
|
120 |
|
121 |
+
/**
|
122 |
+
* Get the current state of the BoldGrid Connect Key.
|
123 |
+
*
|
124 |
+
* @since 1.0.0
|
125 |
+
*
|
126 |
+
* @return string State, what to display when the prompt loads.
|
127 |
+
*/
|
128 |
+
public static function getState() {
|
129 |
+
$state = 'no-key-added';
|
130 |
+
$license = Configs::get( 'start' )->getKey()->getLicense();
|
131 |
+
|
132 |
+
if ( $license ) {
|
133 |
+
$isPremium = $license->isPremium( 'boldgrid-inspirations' );
|
134 |
+
$license = $isPremium ? 'premium' : 'basic';
|
135 |
+
$state = $license . '-key-active';
|
136 |
+
}
|
137 |
+
|
138 |
+
return $state;
|
139 |
+
}
|
140 |
+
|
141 |
/**
|
142 |
* Displays the notice.
|
143 |
*
|
186 |
* @hook: wp_ajax_addKey
|
187 |
*/
|
188 |
public function addKey() {
|
189 |
+
|
190 |
+
//When adding Keys, delete the transient to make sure we get new license info.
|
191 |
+
delete_site_transient( 'bg_license_data' );
|
192 |
+
delete_site_transient( 'boldgrid_api_data' );
|
193 |
+
|
194 |
$key = $this->validate();
|
195 |
$data = $this->key->callCheckVersion( array( 'key' => $key ) );
|
196 |
$msg = $this->getMessages();
|
199 |
$this->key->save( $data, $key );
|
200 |
wp_send_json_success( array( 'message' => $msg->success ) );
|
201 |
} else {
|
202 |
+
$is_timeout = false !== strpos( $data, 'cURL error 28:' );
|
203 |
+
wp_send_json_error( array( 'message' => $is_timeout ? $msg->timeout : $msg->error ) );
|
204 |
}
|
205 |
}
|
206 |
|
vendor/boldgrid/library/src/Library/Page/Connect.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BoldGrid Library Connect Page Class.
|
4 |
+
*
|
5 |
+
* @package Boldgrid\Library
|
6 |
+
* @subpackage \Library\Library\Page
|
7 |
+
*
|
8 |
+
* @version 2.4.0
|
9 |
+
* @author BoldGrid <wpb@boldgrid.com>
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Boldgrid\Library\Library\Page;
|
13 |
+
|
14 |
+
use Boldgrid\Library\Library\Filter;
|
15 |
+
use Boldgrid\Library\Library\Configs;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* BoldGrid Library Connect Page Class.
|
19 |
+
*
|
20 |
+
* Create the BoldGrid Connect Page.
|
21 |
+
*
|
22 |
+
* @since 2.4.0.
|
23 |
+
*/
|
24 |
+
class Connect {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Add all filters for this class.
|
28 |
+
*
|
29 |
+
* @since 2.4.0
|
30 |
+
*/
|
31 |
+
public function __construct() {
|
32 |
+
Filter::add( $this );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Run any needed methods on the Connect Page load.
|
37 |
+
*
|
38 |
+
* @since 2.4.0
|
39 |
+
*
|
40 |
+
* @hook current_screen
|
41 |
+
*/
|
42 |
+
public function onLoad( $screen ) {
|
43 |
+
if ( $this->isConnectScreen( $screen ) ) {
|
44 |
+
self::setupNotice();
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* If we are performing an ajax call, setup the notice.
|
50 |
+
*
|
51 |
+
* Standard ajax handler is bound when the notice is created. Notice is not
|
52 |
+
* created during ajax call.
|
53 |
+
*
|
54 |
+
* @since 2.4.0
|
55 |
+
*
|
56 |
+
* @hook admin_init
|
57 |
+
*/
|
58 |
+
public function ajax() {
|
59 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
60 |
+
if ( ! empty( $_POST['action'] ) && 'addKey' === sanitize_text_field( $_POST['action'] ) ) {
|
61 |
+
self::setupNotice();
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Setup the connect key notice.
|
68 |
+
*
|
69 |
+
* @since 2.4.0
|
70 |
+
*/
|
71 |
+
public static function setupNotice() {
|
72 |
+
Configs::get( 'start' )->setupKeyConnections();
|
73 |
+
Configs::get( 'start' )->getKey()->setNotice( true );
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Check if the current screen is the connect screen.
|
78 |
+
*
|
79 |
+
* @since 2.4.0
|
80 |
+
*
|
81 |
+
* @param object $screen Current Screen.
|
82 |
+
* @return boolean Is the screen the connect screen?
|
83 |
+
*/
|
84 |
+
public function isConnectScreen( $screen ) {
|
85 |
+
$base = ! empty( $screen->base ) ? $screen->base : null;
|
86 |
+
return 'settings_page_boldgrid-connect' === $base;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Fiter the show prompt display to true.
|
91 |
+
*
|
92 |
+
* @since 2.4.0
|
93 |
+
*
|
94 |
+
* @hook Boldgrid\Library\Library\Notice\KeyPrompt_display
|
95 |
+
*/
|
96 |
+
public function showPrompt( $shouldDisplay ) {
|
97 |
+
return $this->isConnectScreen( get_current_screen() ) ? true : $shouldDisplay;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Enqueue Scripts needed for this page.
|
102 |
+
*
|
103 |
+
* @since 2.4.0
|
104 |
+
*
|
105 |
+
* @hook admin_enqueue_scripts
|
106 |
+
*/
|
107 |
+
public function addScripts() {
|
108 |
+
if ( $this->isConnectScreen( get_current_screen() ) ) {
|
109 |
+
wp_enqueue_script( 'boldgrid-library-connect',
|
110 |
+
Configs::get( 'libraryUrl' ) . 'src/assets/js/connect.js' );
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Add additional scripts to Connect page.
|
114 |
+
*
|
115 |
+
* @since 2.4.0
|
116 |
+
*/
|
117 |
+
do_action( 'Boldgrid\Library\Library\Page\Connect\addScripts' );
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Create the BoldGird Connect Page.
|
123 |
+
*
|
124 |
+
* @since 2.4.0
|
125 |
+
*
|
126 |
+
* @hook admin_menu
|
127 |
+
*/
|
128 |
+
public function addPage() {
|
129 |
+
add_submenu_page(
|
130 |
+
'options-general.php',
|
131 |
+
__( 'BoldGrid Connect' ),
|
132 |
+
__( 'BoldGrid Connect' ),
|
133 |
+
'manage_options',
|
134 |
+
'boldgrid-connect.php',
|
135 |
+
function () {
|
136 |
+
include __DIR__ . '/../Views/Connect.php';
|
137 |
+
}
|
138 |
+
);
|
139 |
+
}
|
140 |
+
}
|
vendor/boldgrid/library/src/Library/Reseller.php
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* BoldGrid Library Reseller Class
|
4 |
-
*
|
5 |
-
* @package Boldgrid\Library
|
6 |
-
* @subpackage \Library
|
7 |
-
*
|
8 |
-
* @version 1.1
|
9 |
-
* @author BoldGrid <wpb@boldgrid.com>
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Boldgrid\Library\Library;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* BoldGrid Library Reseller Class.
|
16 |
-
*
|
17 |
-
* @since 1.1
|
18 |
-
*/
|
19 |
-
class Reseller {
|
20 |
-
|
21 |
-
/**
|
22 |
-
* BoldGrid Central url.
|
23 |
-
*
|
24 |
-
* @since 1.1
|
25 |
-
*
|
26 |
-
* @var string
|
27 |
-
*/
|
28 |
-
public $centralUrl = 'https://www.boldgrid.com/central';
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Reseller data.
|
32 |
-
*
|
33 |
-
* @since 1.1
|
34 |
-
*
|
35 |
-
* @var array
|
36 |
-
*/
|
37 |
-
public $data = array();
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Constructor.
|
41 |
-
*
|
42 |
-
* @since 1.1
|
43 |
-
*/
|
44 |
-
public function __construct() {
|
45 |
-
$this->setData();
|
46 |
-
Filter::add( $this );
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Set data.
|
51 |
-
*
|
52 |
-
* @since 1.1
|
53 |
-
*
|
54 |
-
* @hook: update_option_boldgrid_reseller
|
55 |
-
*/
|
56 |
-
public function setData() {
|
57 |
-
$defaults = array(
|
58 |
-
'reseller_coin_url' => $this->centralUrl,
|
59 |
-
);
|
60 |
-
|
61 |
-
$this->data = array_merge( $defaults, get_option( 'boldgrid_reseller', array() ) );
|
62 |
-
}
|
63 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BoldGrid Library Reseller Class
|
4 |
+
*
|
5 |
+
* @package Boldgrid\Library
|
6 |
+
* @subpackage \Library
|
7 |
+
*
|
8 |
+
* @version 1.1
|
9 |
+
* @author BoldGrid <wpb@boldgrid.com>
|
10 |
+
*/
|
11 |
+
|
12 |
+
namespace Boldgrid\Library\Library;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* BoldGrid Library Reseller Class.
|
16 |
+
*
|
17 |
+
* @since 1.1
|
18 |
+
*/
|
19 |
+
class Reseller {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* BoldGrid Central url.
|
23 |
+
*
|
24 |
+
* @since 1.1
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $centralUrl = 'https://www.boldgrid.com/central';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Reseller data.
|
32 |
+
*
|
33 |
+
* @since 1.1
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
public $data = array();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Constructor.
|
41 |
+
*
|
42 |
+
* @since 1.1
|
43 |
+
*/
|
44 |
+
public function __construct() {
|
45 |
+
$this->setData();
|
46 |
+
Filter::add( $this );
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Set data.
|
51 |
+
*
|
52 |
+
* @since 1.1
|
53 |
+
*
|
54 |
+
* @hook: update_option_boldgrid_reseller
|
55 |
+
*/
|
56 |
+
public function setData() {
|
57 |
+
$defaults = array(
|
58 |
+
'reseller_coin_url' => $this->centralUrl,
|
59 |
+
);
|
60 |
+
|
61 |
+
$this->data = array_merge( $defaults, get_option( 'boldgrid_reseller', array() ) );
|
62 |
+
}
|
63 |
+
}
|
vendor/boldgrid/library/src/Library/Start.php
CHANGED
@@ -39,7 +39,6 @@ class Start {
|
|
39 |
*
|
40 |
* @uses \Boldgrid\Library\Library\Configs()
|
41 |
* @uses \Boldgrid\Library\Library\ReleaseChannel()
|
42 |
-
* @uses \Boldgrid\Library\Library\Key()
|
43 |
* @uses \Boldgrid\Library\Plugin\Installer()
|
44 |
* @uses \Boldgrid\Library\Library\Start::getReleaseChannel()
|
45 |
*
|
@@ -50,14 +49,26 @@ class Start {
|
|
50 |
|
51 |
$this->configs = new Configs( $configs );
|
52 |
$this->releaseChannel = new ReleaseChannel;
|
|
|
53 |
|
54 |
if ( Configs::get( 'keyValidate' ) ) {
|
55 |
-
$this->
|
56 |
}
|
57 |
|
58 |
add_action( 'admin_init' , array( $this, 'loadPluginInstaller' ) );
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
/**
|
62 |
* Get releaseChannel class property.
|
63 |
*
|
@@ -69,6 +80,17 @@ class Start {
|
|
69 |
return $this->releaseChannel;
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
/**
|
73 |
* Initialization.
|
74 |
*
|
@@ -86,6 +108,11 @@ class Start {
|
|
86 |
|
87 |
$pluginChecker = new \Boldgrid\Library\Library\Plugin\Checker();
|
88 |
$pluginChecker->run();
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
/**
|
39 |
*
|
40 |
* @uses \Boldgrid\Library\Library\Configs()
|
41 |
* @uses \Boldgrid\Library\Library\ReleaseChannel()
|
|
|
42 |
* @uses \Boldgrid\Library\Plugin\Installer()
|
43 |
* @uses \Boldgrid\Library\Library\Start::getReleaseChannel()
|
44 |
*
|
49 |
|
50 |
$this->configs = new Configs( $configs );
|
51 |
$this->releaseChannel = new ReleaseChannel;
|
52 |
+
Configs::setItem( 'start', $this );
|
53 |
|
54 |
if ( Configs::get( 'keyValidate' ) ) {
|
55 |
+
$this->setupKeyConnections();
|
56 |
}
|
57 |
|
58 |
add_action( 'admin_init' , array( $this, 'loadPluginInstaller' ) );
|
59 |
}
|
60 |
|
61 |
+
/**
|
62 |
+
* Setup the connect key prompts & validation.
|
63 |
+
*
|
64 |
+
* @since 2.4.0
|
65 |
+
*
|
66 |
+
* @uses \Boldgrid\Library\Library\Key()
|
67 |
+
*/
|
68 |
+
public function setupKeyConnections() {
|
69 |
+
$this->key = $this->key ?: new Key( $this->releaseChannel );
|
70 |
+
}
|
71 |
+
|
72 |
/**
|
73 |
* Get releaseChannel class property.
|
74 |
*
|
80 |
return $this->releaseChannel;
|
81 |
}
|
82 |
|
83 |
+
/**
|
84 |
+
* Get key class property.
|
85 |
+
*
|
86 |
+
* @since 1.0.0
|
87 |
+
*
|
88 |
+
* @return object $key Library\Key object.
|
89 |
+
*/
|
90 |
+
public function getKey() {
|
91 |
+
return $this->key;
|
92 |
+
}
|
93 |
+
|
94 |
/**
|
95 |
* Initialization.
|
96 |
*
|
108 |
|
109 |
$pluginChecker = new \Boldgrid\Library\Library\Plugin\Checker();
|
110 |
$pluginChecker->run();
|
111 |
+
|
112 |
+
Configs::setItem( 'menu-external', new Menu\External() );
|
113 |
+
Configs::setItem( 'menu-reseller', new Menu\Reseller() );
|
114 |
+
Configs::setItem( 'page-connect', new Page\Connect() );
|
115 |
+
Configs::setItem( 'assets', new Asset() );
|
116 |
}
|
117 |
|
118 |
/**
|
vendor/boldgrid/library/src/Library/Views/ClaimPremiumKey.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<div id="boldgrid_claim_premium_notice"
|
2 |
-
class="boldgrid-notice library notice notice-warning is-dismissible"
|
3 |
-
data-notice-id="bg-claim-premium">
|
4 |
-
<p>
|
5 |
-
<?php
|
6 |
-
printf(
|
7 |
-
esc_html__(
|
8 |
-
'Thank you for your Envato Market purchase.%sPlease visit %sBoldGrid Central%s to link your accounts and claim your Premium Connect Key.',
|
9 |
-
'boldgrid-inspirations'
|
10 |
-
),
|
11 |
-
'<br />',
|
12 |
-
'<a target="_blank" href="https://www.boldgrid.com/central/code/envato">',
|
13 |
-
'</a>'
|
14 |
-
);
|
15 |
-
|
16 |
-
wp_nonce_field( 'boldgrid_set_key', 'set_key_auth' );
|
17 |
-
?>
|
18 |
-
</p>
|
19 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/boldgrid/library/src/Library/Views/Connect.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
<h1>BoldGrid Connect</h1>
|
3 |
+
<div class="card connect-key-management">
|
4 |
+
<div class="connect-key-prompt"></div>
|
5 |
+
</div>
|
6 |
+
</div>
|
vendor/boldgrid/library/src/Library/Views/Envato.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="envato-claim-message"><p>
|
2 |
+
<?php printf(
|
3 |
+
esc_html__(
|
4 |
+
'Thank you for your Envato Market purchase.%sPlease visit %sBoldGrid Central%s to link your accounts and claim your Premium Connect Key.',
|
5 |
+
'boldgrid-inspirations'
|
6 |
+
),
|
7 |
+
'</p><p>',
|
8 |
+
'<a target="_blank" href="https://www.boldgrid.com/central/code/envato">',
|
9 |
+
'</a>'
|
10 |
+
); ?>
|
11 |
+
</p></div>
|
vendor/boldgrid/library/src/Library/Views/EnvatoFreeKey.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- User has free key entered and should claim their free key -->
|
2 |
+
<div class="envato-claim-message">
|
3 |
+
<p>
|
4 |
+
<?php _e( 'Thank you for your Envato Market purchase. You currently have a Free Connect Key entered,
|
5 |
+
but your Envato purchase entitles you to a Premium Connect Key.' ) ?>
|
6 |
+
</p>
|
7 |
+
<p>
|
8 |
+
<?php printf( __( 'Please visit %sBoldGrid Central%s
|
9 |
+
to link your accounts and claim your Premium Connect Key.' ),
|
10 |
+
'<a target="_blank" href="https://www.boldgrid.com/central/code/envato">',
|
11 |
+
'</a>' ) ?>
|
12 |
+
</p>
|
13 |
+
</div>
|
vendor/boldgrid/library/src/Library/Views/KeyPrompt.php
CHANGED
@@ -1,6 +1,38 @@
|
|
1 |
<div id="container_boldgrid_api_key_notice"
|
2 |
class="boldgrid-notice library error notice is-dismissible"
|
3 |
-
data-notice-id="bg-key-prompt"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
<div class="api-notice">
|
5 |
<h2 class="dashicons-before dashicons-admin-network">
|
6 |
<?php esc_html_e( 'Enter Your BoldGrid Connect Key', 'boldgrid-inspirations' ); ?>
|
@@ -11,8 +43,8 @@
|
|
11 |
<form id="boldgrid-api-form" autocomplete="off">
|
12 |
<?php wp_nonce_field( 'boldgrid_set_key', 'set_key_auth' ); ?>
|
13 |
<div class="tos-box">
|
14 |
-
<input id="tos-box" type="checkbox" value="0">
|
15 |
-
<?php printf( esc_html__( 'I agree to the %sTerms of Use and Privacy Policy%s.', 'boldgrid-inspirations' ), '<a href="https://www.boldgrid.com/software-privacy-policy/" target="_blank">', '</a>' );
|
16 |
</div>
|
17 |
<br />
|
18 |
<input type="text" id="boldgrid_api_key" maxlength="37" placeholder="XXXXXXXX - XXXXXXXX - XXXXXXXX - XXXXXXXX" autocomplete="off" />
|
@@ -23,30 +55,23 @@
|
|
23 |
<div id="boldgrid-api-loading" class="boldgrid-wp-spin"></div>
|
24 |
</span>
|
25 |
</form>
|
26 |
-
<br />
|
27 |
-
<?php
|
28 |
-
// Display either the Envato message or the default signup message.
|
29 |
-
if ( $enableClaimMessage ) {
|
30 |
-
printf(
|
31 |
-
esc_html__(
|
32 |
-
'Thank you for your Envato Market purchase.%sPlease visit %sBoldGrid Central%s to link your accounts and claim your Premium Connect Key.',
|
33 |
-
'boldgrid-inspirations'
|
34 |
-
),
|
35 |
-
'<br />',
|
36 |
-
'<a target="_blank" href="https://www.boldgrid.com/central/code/envato">',
|
37 |
-
'</a>'
|
38 |
-
);
|
39 |
-
} else {
|
40 |
-
?>
|
41 |
-
<a href="#" class="boldgridApiKeyLink">
|
42 |
<?php
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
</div>
|
|
|
|
|
|
|
|
|
50 |
<div class="new-api-key hidden">
|
51 |
<h2 class="dashicons-before dashicons-admin-network">
|
52 |
<?php esc_html_e( 'Request a BoldGrid Connect Key', 'boldgrid-inspirations' ); ?>
|
1 |
<div id="container_boldgrid_api_key_notice"
|
2 |
class="boldgrid-notice library error notice is-dismissible"
|
3 |
+
data-notice-id="bg-key-prompt"
|
4 |
+
data-notice-state="<?php echo \Boldgrid\Library\Library\Notice\KeyPrompt::getState() ?>"
|
5 |
+
>
|
6 |
+
<div class="premium-key-active key-entry-message">
|
7 |
+
<h2 class="dashicons-before dashicons-admin-network">
|
8 |
+
<?php esc_html_e( 'Premium BoldGrid Connect Key', 'boldgrid-inspirations' )?></h2>
|
9 |
+
<p>
|
10 |
+
<?php esc_html_e( 'Awesome! You have Premium Connect Key saved on this site.' ) ?>
|
11 |
+
</p>
|
12 |
+
<p>
|
13 |
+
<?php printf( esc_html__( 'Make sure you\'re getting the most out of your premium subscription by installing our other %sBoldGrid plugins%s. As a Premium user, you also have unlimited access to %sCloud WordPress%s where you can create new WordPress sites for free. If you need any help, our support team is eager to serve!', 'boldgrid-inspirations' ),
|
14 |
+
'<a href="https://www.boldgrid.com/wordpress-plugins/" target="_blank">', '</a>',
|
15 |
+
'<a href="https://www.boldgrid.com/central/get-it-now" target="_blank">', '</a>'
|
16 |
+
) ?>
|
17 |
+
</p>
|
18 |
+
<p class='change-key'><a href="#" data-action="change-connect-key"><?php _e( 'Click here to change your Connect Key' ) ?></a></p>
|
19 |
+
</div>
|
20 |
+
<div class="basic-key-active key-entry-message">
|
21 |
+
<h2 class="dashicons-before dashicons-admin-network">
|
22 |
+
<?php esc_html_e( 'Free BoldGrid Connect Key', 'boldgrid-inspirations' )?></h2>
|
23 |
+
|
24 |
+
<?php if ( ! $enableClaimMessage ) { ?>
|
25 |
+
<p>
|
26 |
+
<?php esc_html_e( 'Thank you for adding your Connect Key. Try upgrading to a Premium subscription for full access to BoldGrid!', 'boldgrid-inspirations' ); ?>
|
27 |
+
</p>
|
28 |
+
<p><a target="_blank" href="https://www.boldgrid.com/connect-keys?source=library-prompt"
|
29 |
+
class="button button-primary"><?php _e( 'Upgrade' ) ?></a>
|
30 |
+
</p>
|
31 |
+
<?php } else {
|
32 |
+
include __DIR__ . '/EnvatoFreeKey.php';
|
33 |
+
} ?>
|
34 |
+
<p class='change-key'><a href="#" data-action="change-connect-key"><?php _e( 'Click here to change your Connect Key' ) ?></a></p>
|
35 |
+
</div>
|
36 |
<div class="api-notice">
|
37 |
<h2 class="dashicons-before dashicons-admin-network">
|
38 |
<?php esc_html_e( 'Enter Your BoldGrid Connect Key', 'boldgrid-inspirations' ); ?>
|
43 |
<form id="boldgrid-api-form" autocomplete="off">
|
44 |
<?php wp_nonce_field( 'boldgrid_set_key', 'set_key_auth' ); ?>
|
45 |
<div class="tos-box">
|
46 |
+
<label><input id="tos-box" type="checkbox" value="0">
|
47 |
+
<?php printf( esc_html__( 'I agree to the %sTerms of Use and Privacy Policy%s.', 'boldgrid-inspirations' ), '<a href="https://www.boldgrid.com/software-privacy-policy/" target="_blank">', '</a>' ); ?></label>
|
48 |
</div>
|
49 |
<br />
|
50 |
<input type="text" id="boldgrid_api_key" maxlength="37" placeholder="XXXXXXXX - XXXXXXXX - XXXXXXXX - XXXXXXXX" autocomplete="off" />
|
55 |
<div id="boldgrid-api-loading" class="boldgrid-wp-spin"></div>
|
56 |
</span>
|
57 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
<?php
|
59 |
+
if ( $enableClaimMessage ) {
|
60 |
+
include __DIR__ . '/Envato.php';
|
61 |
+
} else {
|
62 |
+
// Display either the Envato message or the default signup message.
|
63 |
+
?>
|
64 |
+
<p><a href="#" class="boldgridApiKeyLink">
|
65 |
+
<?php
|
66 |
+
esc_html_e( 'Don\'t have a Connect Key yet or lost your Key?', 'boldgrid-inspirations' );
|
67 |
+
?>
|
68 |
+
</a></p>
|
69 |
+
<?php } ?>
|
70 |
</div>
|
71 |
+
<?php
|
72 |
+
// Display either the Envato message or the default signup message.
|
73 |
+
|
74 |
+
?>
|
75 |
<div class="new-api-key hidden">
|
76 |
<h2 class="dashicons-before dashicons-admin-network">
|
77 |
<?php esc_html_e( 'Request a BoldGrid Connect Key', 'boldgrid-inspirations' ); ?>
|
vendor/boldgrid/library/src/assets/css/admin.css
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/** BoldGrid Connect Page Start **/
|
2 |
+
.settings_page_boldgrid-connect #container_boldgrid_api_key_notice {
|
3 |
+
background: transparent;
|
4 |
+
box-shadow: none;
|
5 |
+
border-left: 0;
|
6 |
+
width: auto;
|
7 |
+
}
|
8 |
+
|
9 |
+
.settings_page_boldgrid-connect #container_boldgrid_api_key_notice .dismiss-notification,
|
10 |
+
.settings_page_boldgrid-connect #container_boldgrid_api_key_notice .notice-dismiss {
|
11 |
+
display: none;
|
12 |
+
}
|
13 |
+
.settings_page_boldgrid-connect .connect-key-management {
|
14 |
+
max-width: 590px;
|
15 |
+
}
|
16 |
+
/** BoldGrid Connect Page End **/
|
17 |
+
|
18 |
+
/** Admin Bar Icons **/
|
19 |
+
@font-face {
|
20 |
+
font-family: 'boldgrid';
|
21 |
+
src: url('../fonts/boldgrid.eot?-k3w47');
|
22 |
+
src: url('../fonts/boldgrid.eot?#iefix-k3w47')
|
23 |
+
format('embedded-opentype'), url('../fonts/boldgrid.woff?-k3w47')
|
24 |
+
format('woff'), url('../fonts/boldgrid.ttf?-k3w47') format('truetype'),
|
25 |
+
url('../fonts/boldgrid.svg?-k3w47#boldgrid') format('svg');
|
26 |
+
font-weight: normal;
|
27 |
+
font-style: normal;
|
28 |
+
}
|
29 |
+
|
30 |
+
@font-face {
|
31 |
+
font-family: 'bg-admin-icons';
|
32 |
+
src: url('../fonts/bg-admin-icons.eot?11633397');
|
33 |
+
src: url('../fonts/bg-admin-icons.eot?11633397#iefix')
|
34 |
+
format('embedded-opentype'),
|
35 |
+
url('../fonts/bg-admin-icons.woff?11633397') format('woff'),
|
36 |
+
url('../fonts/bg-admin-icons.ttf?11633397') format('truetype'),
|
37 |
+
url('../fonts/bg-admin-icons.svg?11633397#bg-admin-icons')
|
38 |
+
format('svg');
|
39 |
+
font-weight: normal;
|
40 |
+
font-style: normal;
|
41 |
+
}
|
42 |
+
|
43 |
+
#toplevel_page_boldgrid-transactions .wp-menu-image::before,
|
44 |
+
#toplevel_page_boldgrid-inspirations .wp-menu-image:not(.dashicons-lightbulb)::before {
|
45 |
+
content: "\e801";
|
46 |
+
font-family: "bg-admin-icons";
|
47 |
+
font-style: normal;
|
48 |
+
font-weight: normal;
|
49 |
+
font-size: 19px;
|
50 |
+
speak: none;
|
51 |
+
display: inline-block;
|
52 |
+
text-decoration: inherit;
|
53 |
+
width: 1em;
|
54 |
+
margin-right: .2em;
|
55 |
+
text-align: center;
|
56 |
+
/* opacity: .8; */
|
57 |
+
/* For safety - reset parent styles, that can break glyph codes*/
|
58 |
+
font-variant: normal;
|
59 |
+
text-transform: none;
|
60 |
+
/* fix buttons height, for twitter bootstrap */
|
61 |
+
line-height: 1em;
|
62 |
+
/* Animation center compensation - margins should be symmetric */
|
63 |
+
/* remove if not needed */
|
64 |
+
margin-left: .2em;
|
65 |
+
/* You can be more comfortable with increased icons size */
|
66 |
+
/* font-size: 120%; */
|
67 |
+
/* Font smoothing. That was taken from TWBS */
|
68 |
+
-webkit-font-smoothing: antialiased;
|
69 |
+
-moz-osx-font-smoothing: grayscale;
|
70 |
+
}
|
71 |
+
|
72 |
+
.toplevel_page_boldgrid-inspirations #step-2 .theme-browser .theme .theme-screenshot {
|
73 |
+
overflow: visible;
|
74 |
+
}
|
75 |
+
|
76 |
+
.toplevel_page_boldgrid-inspirations #step-2 .theme-browser .theme .theme-name {
|
77 |
+
position: relative;
|
78 |
+
}
|
79 |
+
|
80 |
+
.theme-install-php .theme-browser .theme .theme-screenshot img,
|
81 |
+
.toplevel_page_boldgrid-inspirations #step-2 .theme-browser .theme .theme-screenshot img {
|
82 |
+
transition: opacity 0s;
|
83 |
+
}
|
84 |
+
|
85 |
+
.theme-install-php .theme-browser .theme .theme-name,
|
86 |
+
.toplevel_page_boldgrid-inspirations #step-2 .theme-browser .theme .theme-name {
|
87 |
+
background-color: #FAFAFA;
|
88 |
+
}
|
89 |
+
|
90 |
+
#toplevel_page_boldgrid-transactions .wp-menu-image::before {
|
91 |
+
content: "\e800";
|
92 |
+
}
|
93 |
+
|
94 |
+
.whh-icon:before {
|
95 |
+
content: "\e601";
|
96 |
+
font-family: 'boldgrid';
|
97 |
+
speak: none;
|
98 |
+
font-size: large;
|
99 |
+
font-style: normal;
|
100 |
+
font-weight: normal;
|
101 |
+
font-variant: normal;
|
102 |
+
text-transform: none;
|
103 |
+
-webkit-font-smoothing: antialiased;
|
104 |
+
-moz-osx-font-smoothing: grayscale;
|
105 |
+
}
|
106 |
+
|
107 |
+
.imh-icon:before {
|
108 |
+
content: "\e602";
|
109 |
+
font-family: 'boldgrid';
|
110 |
+
speak: none;
|
111 |
+
font-size: large;
|
112 |
+
font-style: normal;
|
113 |
+
font-weight: normal;
|
114 |
+
font-variant: normal;
|
115 |
+
text-transform: none;
|
116 |
+
-webkit-font-smoothing: antialiased;
|
117 |
+
-moz-osx-font-smoothing: grayscale;
|
118 |
+
}
|
119 |
+
|
120 |
+
.boldgrid-icon:before {
|
121 |
+
content: "\e600";
|
122 |
+
font-family: 'boldgrid';
|
123 |
+
speak: none;
|
124 |
+
font-size: large;
|
125 |
+
font-style: normal;
|
126 |
+
font-weight: normal;
|
127 |
+
font-variant: normal;
|
128 |
+
text-transform: none;
|
129 |
+
-webkit-font-smoothing: antialiased;
|
130 |
+
-moz-osx-font-smoothing: grayscale;
|
131 |
+
}
|
132 |
+
/** Admin Bar Icons **/
|
vendor/boldgrid/library/src/assets/css/api-notice.css
CHANGED
@@ -17,6 +17,87 @@
|
|
17 |
#requestKeyForm label {
|
18 |
display: block;
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
#boldgrid_api_key_notice_message,
|
21 |
.tos-box,
|
22 |
.key-request-content,
|
17 |
#requestKeyForm label {
|
18 |
display: block;
|
19 |
}
|
20 |
+
|
21 |
+
#container_boldgrid_api_key_notice .envato-claim-message,
|
22 |
+
#container_boldgrid_api_key_notice .key-entry-message p {
|
23 |
+
padding-left: 70px;
|
24 |
+
font-size: 14px;
|
25 |
+
}
|
26 |
+
|
27 |
+
#container_boldgrid_api_key_notice .change-key,
|
28 |
+
#container_boldgrid_api_key_notice .envato-claim-message {
|
29 |
+
margin-top: 20px;
|
30 |
+
}
|
31 |
+
|
32 |
+
#container_boldgrid_api_key_notice:not([data-notice-state="no-key-added"]) .api-notice,
|
33 |
+
#container_boldgrid_api_key_notice .premium-key-active,
|
34 |
+
#container_boldgrid_api_key_notice .basic-key-active {
|
35 |
+
display: none;
|
36 |
+
}
|
37 |
+
|
38 |
+
#container_boldgrid_api_key_notice .basic-key-active .button {
|
39 |
+
margin: 10px 0;
|
40 |
+
}
|
41 |
+
|
42 |
+
#container_boldgrid_api_key_notice[data-notice-state="premium-key-active"] .premium-key-active,
|
43 |
+
#container_boldgrid_api_key_notice[data-notice-state="basic-key-active"] .basic-key-active {
|
44 |
+
display: block;
|
45 |
+
}
|
46 |
+
#container_boldgrid_api_key_notice .boldgridApiKeyLink {
|
47 |
+
margin-top: 10px;
|
48 |
+
display: inline-block;
|
49 |
+
}
|
50 |
+
#container_boldgrid_api_key_notice[data-notice-state="basic-key-active"] .envato-claim-message {
|
51 |
+
padding-left: 0;
|
52 |
+
margin-bottom: 10px;
|
53 |
+
}
|
54 |
+
#container_boldgrid_api_key_notice.success-add-key .tos-box,
|
55 |
+
#container_boldgrid_api_key_notice.success-add-key .envato-claim-message {
|
56 |
+
display: none;
|
57 |
+
}
|
58 |
+
|
59 |
+
#container_boldgrid_api_key_notice.success-add-key .dashicons-admin-network::before {
|
60 |
+
animation-name: tada;
|
61 |
+
animation-duration: 1.5s;
|
62 |
+
}
|
63 |
+
|
64 |
+
#container_boldgrid_api_key_notice.success-add-key .boldgridApiKeyLink {
|
65 |
+
display: none;
|
66 |
+
}
|
67 |
+
|
68 |
+
@keyframes tada {
|
69 |
+
from {
|
70 |
+
-webkit-transform: scale3d(1, 1, 1);
|
71 |
+
transform: scale3d(1, 1, 1);
|
72 |
+
}
|
73 |
+
|
74 |
+
10%,
|
75 |
+
20% {
|
76 |
+
-webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
|
77 |
+
transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg);
|
78 |
+
}
|
79 |
+
|
80 |
+
30%,
|
81 |
+
50%,
|
82 |
+
70%,
|
83 |
+
90% {
|
84 |
+
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
|
85 |
+
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
|
86 |
+
}
|
87 |
+
|
88 |
+
40%,
|
89 |
+
60%,
|
90 |
+
80% {
|
91 |
+
-webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
|
92 |
+
transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
|
93 |
+
}
|
94 |
+
|
95 |
+
to {
|
96 |
+
-webkit-transform: scale3d(1, 1, 1);
|
97 |
+
transform: scale3d(1, 1, 1);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
#boldgrid_api_key_notice_message,
|
102 |
.tos-box,
|
103 |
.key-request-content,
|
vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.eot
ADDED
Binary file
|
vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.svg
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Copyright (C) 2015 by original authors @ fontello.com</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="bg-admin-icons" horiz-adv-x="1000" >
|
7 |
+
<font-face font-family="bg-admin-icons" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
8 |
+
<missing-glyph horiz-adv-x="1000" />
|
9 |
+
<glyph glyph-name="bg-gridcoin-icon" unicode="" d="m503 850c-278 0-503-225-503-503s225-502 503-502 502 225 502 502-230 503-502 503z m282-319c0-11-10-26-21-26-10 0-31 15-31 26v52h-471v-471h471v262h-105c-10 0-26 10-26 21 0 10 11 31 26 31h105c31 0 52-31 52-52v-262c0-37-21-53-52-53h-471c-26 0-53 27-53 53v471c0 31 11 52 53 52h471c47 0 52-5 52-52v-52z m-445-210h246c11 0 21-10 21-21v-120c0-11-10-21-21-21h-246c-10 0-21 10-21 21v120c-5 11 6 21 21 21z m-26 79v125c0 11 11 21 21 21h152c10 0 21-10 21-21v-125c0-11-11-21-21-21h-152c-10 0-21 10-21 21z" horiz-adv-x="1000" />
|
10 |
+
<glyph glyph-name="bg-logo-icon" unicode="" d="m947 587c32 0 53 21 53 53v36c0 95-79 174-174 174h-668c-105 0-158-53-158-158v-684c0-90 68-158 158-158h684c90 0 158 68 158 158v300c0 95-79 174-174 174h-142c-31 0-52-21-52-53 0-32 21-53 52-53h174c21 0 37-15 37-36v-353c0-21-16-37-37-37h-716c-21 5-37 21-37 42v716c0 21 16 37 37 37h721c16 0 32-16 32-37v-68c0-32 21-53 52-53z m-321-526h-358c-31 0-57 26-57 57v153c0 26 26 53 57 53h364c31 0 58-27 58-58v-153c-6-26-32-52-64-52z m-158 315h-200c-31 0-57 27-57 58v148c0 31 26 58 57 58h206c26 0 52-27 52-58v-153c0-26-26-53-58-53z" horiz-adv-x="1000" />
|
11 |
+
</font>
|
12 |
+
</defs>
|
13 |
+
</svg>
|
vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.ttf
ADDED
Binary file
|
vendor/boldgrid/library/src/assets/fonts/bg-admin-icons.woff
ADDED
Binary file
|
vendor/boldgrid/library/src/assets/fonts/boldgrid.eot
ADDED
Binary file
|
vendor/boldgrid/library/src/assets/fonts/boldgrid.svg
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" standalone="no"?>
|
2 |
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
3 |
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4 |
+
<metadata>Generated by IcoMoon</metadata>
|
5 |
+
<defs>
|
6 |
+
<font id="icomoon" horiz-adv-x="1024">
|
7 |
+
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
8 |
+
<missing-glyph horiz-adv-x="1024" />
|
9 |
+
<glyph unicode=" " d="" horiz-adv-x="512" />
|
10 |
+
<glyph unicode="" d="M524.8 524.8c0-19.2-12.8-32-32-32h-220.8c-19.2 0-32 16-32 32v179.2c0 19.2 12.8 32 32 32h220.8c19.2 0 32-16 32-32v-179.2zM665.6 192c0-19.2-22.4-32-48-32h-329.6c-28.8 0-48 16-48 32v179.2c0 19.2 22.4 32 48 32h329.6c28.8 0 48-16 48-32v-179.2zM832 902.4c83.2 0 131.2-57.6 128-140.8 0-25.6-6.4-48-35.2-44.8-25.6 0-35.2 19.2-32 41.6 3.2 57.6-32 76.8-83.2 76.8-198.4 0-396.8 0-595.2 0-67.2 0-83.2-19.2-83.2-86.4 0-201.6 0-400 0-601.6 0-73.6 16-86.4 86.4-86.4 195.2 0 393.6 0 588.8 0 67.2 0 83.2 16 83.2 83.2 0 92.8 0 182.4 0 272 0 57.6-19.2 76.8-76.8 76.8-35.2 0-73.6 0-108.8 0-19.2 0-35.2 9.6-38.4 32 0 25.6 16 35.2 38.4 35.2 48 0 99.2 3.2 147.2-3.2 57.6-3.2 102.4-54.4 102.4-112 3.2-112 3.2-227.2 0-339.2 0-70.4-51.2-118.4-121.6-118.4-108.8 0-217.6 0-326.4 0-105.6 0-211.2 0-316.8 0-80 0-131.2 48-131.2 131.2 0 217.6 0 435.2 0 649.6 0 80 48 131.2 124.8 131.2z" />
|
11 |
+
<glyph unicode="" d="M814.933 162.133c-25.6 0-51.2 4.267-76.8 17.067-68.267-51.2-145.067-81.067-226.133-81.067-25.6 0-51.2 4.267-76.8 8.533-46.933-46.933-106.667-68.267-170.667-68.267-68.267 0-123.733 25.6-174.933 72.533s-72.533 106.667-72.533 174.933c0 42.667 12.8 85.333 34.133 123.733s51.2 68.267 89.6 89.6c4.267 64 25.6 119.467 55.467 170.667 38.4 51.2 81.067 89.6 136.533 119.467s115.2 46.933 174.933 46.933c93.867 0 170.667-29.867 243.2-89.6 68.267-59.733 110.933-136.533 123.733-226.133 38.4-12.8 68.267-34.133 89.6-68.267s34.133-68.267 34.133-106.667c0-51.2-17.067-93.867-55.467-132.267s-76.8-51.2-128-51.2zM512 772.267c-76.8 0-140.8-25.6-196.267-72.533-59.733-46.933-93.867-106.667-106.667-179.2 17.067 4.267 38.4 8.533 55.467 8.533 68.267 0 123.733-25.6 174.933-72.533s72.533-106.667 72.533-174.933c0-42.667-8.533-81.067-29.867-119.467 12.8 0 21.333 0 29.867 0 64 0 123.733 17.067 174.933 55.467-34.133 34.133-51.2 76.8-51.2 128s17.067 93.867 51.2 128 76.8 55.467 128 55.467c-12.8 72.533-51.2 128-106.667 174.933-59.733 46.933-123.733 68.267-196.267 68.267zM605.867 554.667c-17.067-17.067-38.4-25.6-64-25.6s-46.933 8.533-64 25.6c-17.067 17.067-25.6 38.4-25.6 64s8.533 46.933 25.6 64c17.067 17.067 38.4 25.6 64 25.6s46.933-8.533 64-25.6c17.067-17.067 25.6-38.4 25.6-64 0-21.333-8.533-46.933-25.6-64z" />
|
12 |
+
<glyph unicode="" d="M315.733 622.933l1668.267 4.267-34.133-174.933zM64 601.6l1868.8-204.8-34.133-149.333z" horiz-adv-x="2048" />
|
13 |
+
</font></defs></svg>
|
vendor/boldgrid/library/src/assets/fonts/boldgrid.ttf
ADDED
Binary file
|
vendor/boldgrid/library/src/assets/fonts/boldgrid.woff
ADDED
Binary file
|
vendor/boldgrid/library/src/assets/js/api-notice.js
CHANGED
@@ -9,8 +9,8 @@ BOLDGRID.LIBRARY.Api = function( $ ) {
|
|
9 |
* Set key if parameter is set.
|
10 |
*/
|
11 |
$( function() {
|
12 |
-
var $activateKey = self.GetURLParameter( 'activateKey' )
|
13 |
-
|
14 |
|
15 |
if ( $activateKey ) {
|
16 |
document.getElementById( 'boldgrid_api_key' ).value = $activateKey;
|
@@ -134,8 +134,22 @@ BOLDGRID.LIBRARY.Api = function( $ ) {
|
|
134 |
// show the loading graphic.
|
135 |
$( '#boldgrid-api-loading', notice ).show();
|
136 |
});
|
|
|
|
|
137 |
});
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
/**
|
140 |
* Get parameter from URL
|
141 |
*
|
@@ -180,7 +194,7 @@ BOLDGRID.LIBRARY.Api = function( $ ) {
|
|
180 |
* Set the API key.
|
181 |
*/
|
182 |
this.set = function( key ) {
|
183 |
-
var data, nonce, wpHttpReferer;
|
184 |
// Get the wpnonce and referer values.
|
185 |
nonce = $( '#set_key_auth', notice ).val();
|
186 |
wpHttpReferer = $( '[name="_wp_http_referer"]', notice ).val();
|
@@ -191,40 +205,50 @@ BOLDGRID.LIBRARY.Api = function( $ ) {
|
|
191 |
'_wp_http_referer' : wpHttpReferer,
|
192 |
};
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
$.post( ajaxurl, data, function( response ) {
|
195 |
// Declare variables.
|
196 |
-
var
|
197 |
-
notice = $( '#container_boldgrid_api_key_notice' );
|
198 |
|
199 |
// If the key was saved successfully.
|
200 |
if ( response.success ) {
|
201 |
// Change the notice from red to green.
|
202 |
-
|
|
|
203 |
|
204 |
// Initiate tracking iframe.
|
205 |
self.trackActivation();
|
206 |
|
207 |
-
$( '#boldgrid_api_key_notice_message',
|
208 |
-
.html( response.data.message + ' <a onClick="window.location.reload(true)" style="cursor:pointer;"> Dismiss Notification</a>' );
|
209 |
|
210 |
// Remove the loading graphic since success.
|
211 |
-
$( '#boldgrid-api-loading',
|
212 |
|
213 |
// Finally hide the input elements as we do not need them anymore.
|
214 |
-
$( '#boldgrid_api_key',
|
215 |
|
216 |
// Reload page after 3 seconds.
|
217 |
setTimeout( function() {
|
218 |
window.location.reload();
|
219 |
-
},
|
220 |
} else {
|
221 |
-
|
222 |
-
$( '#submit_api_key', notice ).show();
|
223 |
-
$( '#boldgrid_api_key_notice_message', notice )
|
224 |
-
.html( response.data.message )
|
225 |
-
.addClass( 'error-color' );
|
226 |
}
|
227 |
-
})
|
|
|
|
|
228 |
};
|
229 |
};
|
230 |
|
9 |
* Set key if parameter is set.
|
10 |
*/
|
11 |
$( function() {
|
12 |
+
var $activateKey = self.GetURLParameter( 'activateKey' );
|
13 |
+
notice = $( '#container_boldgrid_api_key_notice' );
|
14 |
|
15 |
if ( $activateKey ) {
|
16 |
document.getElementById( 'boldgrid_api_key' ).value = $activateKey;
|
134 |
// show the loading graphic.
|
135 |
$( '#boldgrid-api-loading', notice ).show();
|
136 |
});
|
137 |
+
|
138 |
+
self._setupChangeKey();
|
139 |
});
|
140 |
|
141 |
+
/**
|
142 |
+
* When a user clicks on change connect key, change the presentation to key input.
|
143 |
+
*
|
144 |
+
* @since 2.4.0
|
145 |
+
*/
|
146 |
+
this._setupChangeKey = function() {
|
147 |
+
notice.find( 'a[data-action="change-connect-key"]' ).on( 'click', function ( e ) {
|
148 |
+
e.preventDefault();
|
149 |
+
notice.attr( 'data-notice-state', 'no-key-added' );
|
150 |
+
} );
|
151 |
+
};
|
152 |
+
|
153 |
/**
|
154 |
* Get parameter from URL
|
155 |
*
|
194 |
* Set the API key.
|
195 |
*/
|
196 |
this.set = function( key ) {
|
197 |
+
var data, nonce, wpHttpReferer, $noticeContainer;
|
198 |
// Get the wpnonce and referer values.
|
199 |
nonce = $( '#set_key_auth', notice ).val();
|
200 |
wpHttpReferer = $( '[name="_wp_http_referer"]', notice ).val();
|
205 |
'_wp_http_referer' : wpHttpReferer,
|
206 |
};
|
207 |
|
208 |
+
$noticeContainer = $( '#container_boldgrid_api_key_notice' );
|
209 |
+
|
210 |
+
var fail = function ( message ) {
|
211 |
+
message = message || 'An unexpected error occured. Please try again later.';
|
212 |
+
|
213 |
+
$( '#boldgrid-api-loading', $noticeContainer ).hide();
|
214 |
+
$( '#submit_api_key', $noticeContainer ).show();
|
215 |
+
$( '#boldgrid_api_key_notice_message', $noticeContainer )
|
216 |
+
.html( message )
|
217 |
+
.addClass( 'error-color' );
|
218 |
+
};
|
219 |
+
|
220 |
$.post( ajaxurl, data, function( response ) {
|
221 |
// Declare variables.
|
222 |
+
var message;
|
|
|
223 |
|
224 |
// If the key was saved successfully.
|
225 |
if ( response.success ) {
|
226 |
// Change the notice from red to green.
|
227 |
+
$noticeContainer.toggleClass( 'error' ).toggleClass( 'updated' );
|
228 |
+
$noticeContainer.addClass( 'success-add-key' );
|
229 |
|
230 |
// Initiate tracking iframe.
|
231 |
self.trackActivation();
|
232 |
|
233 |
+
$( '#boldgrid_api_key_notice_message', $noticeContainer )
|
234 |
+
.html( response.data.message + ' <a class="dismiss-notification" onClick="window.location.reload(true)" style="cursor:pointer;"> Dismiss Notification</a>' );
|
235 |
|
236 |
// Remove the loading graphic since success.
|
237 |
+
$( '#boldgrid-api-loading', $noticeContainer ).fadeOut();
|
238 |
|
239 |
// Finally hide the input elements as we do not need them anymore.
|
240 |
+
$( '#boldgrid_api_key', $noticeContainer ).fadeOut();
|
241 |
|
242 |
// Reload page after 3 seconds.
|
243 |
setTimeout( function() {
|
244 |
window.location.reload();
|
245 |
+
}, 2000 );
|
246 |
} else {
|
247 |
+
fail( response.data ? response.data.message : null );
|
|
|
|
|
|
|
|
|
248 |
}
|
249 |
+
} ).fail( function() {
|
250 |
+
fail();
|
251 |
+
} );
|
252 |
};
|
253 |
};
|
254 |
|
vendor/boldgrid/library/src/assets/js/connect.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* global ajaxurl,jQuery */
|
2 |
+
|
3 |
+
var BOLDGRID = BOLDGRID || {};
|
4 |
+
BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {};
|
5 |
+
|
6 |
+
( function ( $ ) {
|
7 |
+
BOLDGRID.LIBRARY.Connect = {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor.
|
11 |
+
*
|
12 |
+
* @since 2.4.0
|
13 |
+
*/
|
14 |
+
init: function () {
|
15 |
+
$( self._onLoad );
|
16 |
+
},
|
17 |
+
|
18 |
+
/**
|
19 |
+
* On DOM load.
|
20 |
+
*
|
21 |
+
* @since 2.4.0
|
22 |
+
*/
|
23 |
+
_onLoad: function() {
|
24 |
+
self._repositionNotice();
|
25 |
+
},
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Reposition the notice into the correct location.
|
29 |
+
*
|
30 |
+
* @since 2.4.0
|
31 |
+
*/
|
32 |
+
_repositionNotice: function() {
|
33 |
+
var $connectKeySection = $( '.connect-key-prompt' );
|
34 |
+
|
35 |
+
setTimeout( function () {
|
36 |
+
$connectKeySection.after( $( '#container_boldgrid_api_key_notice' ) );
|
37 |
+
} );
|
38 |
+
}
|
39 |
+
};
|
40 |
+
|
41 |
+
var self = BOLDGRID.LIBRARY.Connect;
|
42 |
+
BOLDGRID.LIBRARY.Connect.init();
|
43 |
+
} )( jQuery );
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit2d055860d5c15ffa34614718a8387474
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit2d055860d5c15ffa34614718a8387474
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit4e27a2f292eee7f82164be02fc946e09
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit4e27a2f292eee7f82164be02fc946e09', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit4e27a2f292eee7f82164be02fc946e09', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit4e27a2f292eee7f82164be02fc946e09::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit4e27a2f292eee7f82164be02fc946e09::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire4e27a2f292eee7f82164be02fc946e09($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire4e27a2f292eee7f82164be02fc946e09($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'f15d016d70663d5e96ccd2b863511eb8' => __DIR__ . '/..' . '/cbschuld/browser.php/lib/Browser.php',
|
@@ -44,8 +44,8 @@ class ComposerStaticInit2d055860d5c15ffa34614718a8387474
|
|
44 |
public static function getInitializer(ClassLoader $loader)
|
45 |
{
|
46 |
return \Closure::bind(function () use ($loader) {
|
47 |
-
$loader->prefixLengthsPsr4 =
|
48 |
-
$loader->prefixDirsPsr4 =
|
49 |
|
50 |
}, null, ClassLoader::class);
|
51 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit4e27a2f292eee7f82164be02fc946e09
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'f15d016d70663d5e96ccd2b863511eb8' => __DIR__ . '/..' . '/cbschuld/browser.php/lib/Browser.php',
|
44 |
public static function getInitializer(ClassLoader $loader)
|
45 |
{
|
46 |
return \Closure::bind(function () use ($loader) {
|
47 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit4e27a2f292eee7f82164be02fc946e09::$prefixLengthsPsr4;
|
48 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit4e27a2f292eee7f82164be02fc946e09::$prefixDirsPsr4;
|
49 |
|
50 |
}, null, ClassLoader::class);
|
51 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
[
|
2 |
{
|
3 |
"name": "boldgrid/library",
|
4 |
-
"version": "2.
|
5 |
-
"version_normalized": "2.
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/BoldGrid/library.git",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/BoldGrid/library/zipball/
|
14 |
-
"reference": "
|
15 |
"shasum": ""
|
16 |
},
|
17 |
-
"time": "2018-
|
18 |
"type": "library",
|
19 |
"installation-source": "dist",
|
20 |
"autoload": {
|
1 |
[
|
2 |
{
|
3 |
"name": "boldgrid/library",
|
4 |
+
"version": "2.4.2",
|
5 |
+
"version_normalized": "2.4.2.0",
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/BoldGrid/library.git",
|
9 |
+
"reference": "b07aeca037ad91a1f99af6cd618d91610089157e"
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/BoldGrid/library/zipball/b07aeca037ad91a1f99af6cd618d91610089157e",
|
14 |
+
"reference": "b07aeca037ad91a1f99af6cd618d91610089157e",
|
15 |
"shasum": ""
|
16 |
},
|
17 |
+
"time": "2018-07-31T14:17:15+00:00",
|
18 |
"type": "library",
|
19 |
"installation-source": "dist",
|
20 |
"autoload": {
|