Post and Page Builder by BoldGrid – Visual Drag and Drop Editor - Version 1.11.1

Version Description

Release Date: September 5th, 2019

  • Update: Update BoldGrid Library - Dashboard Updates.
Download this release

Release Info

Developer rramo012
Plugin Icon 128x128 Post and Page Builder by BoldGrid – Visual Drag and Drop Editor
Version 1.11.1
Comparing to
See all releases

Code changes from version 1.11.0 to 1.11.1

Files changed (30) hide show
  1. includes/class-boldgrid-editor-premium.php +81 -28
  2. includes/class-boldgrid-editor.php +3 -0
  3. post-and-page-builder.php +1 -1
  4. readme.txt +7 -1
  5. vendor/autoload.php +1 -1
  6. vendor/boldgrid/library/.travis.yml +2 -0
  7. vendor/boldgrid/library/README.md +15 -0
  8. vendor/boldgrid/library/src/Library/Configs.php +54 -0
  9. vendor/boldgrid/library/src/Library/Dashboard.php +37 -0
  10. vendor/boldgrid/library/src/Library/Dashboard/SortWidgets.php +189 -0
  11. vendor/boldgrid/library/src/Library/Key/PostNewKey.php +14 -6
  12. vendor/boldgrid/library/src/Library/License.php +1 -0
  13. vendor/boldgrid/library/src/Library/NewsWidget.php +226 -0
  14. vendor/boldgrid/library/src/Library/Notifications/DashboardWidget.php +211 -0
  15. vendor/boldgrid/library/src/Library/Plugin/Plugin.php +309 -2
  16. vendor/boldgrid/library/src/Library/Plugin/Plugins.php +47 -0
  17. vendor/boldgrid/library/src/Library/Rss.php +0 -137
  18. vendor/boldgrid/library/src/Library/Start.php +10 -3
  19. vendor/boldgrid/library/src/Library/Ui/Card.php +124 -0
  20. vendor/boldgrid/library/src/Library/Ui/Dashboard.php +55 -0
  21. vendor/boldgrid/library/src/Library/Ui/Feature.php +80 -0
  22. vendor/boldgrid/library/src/assets/css/admin.css +10 -0
  23. vendor/boldgrid/library/src/assets/css/dashboard.css +138 -0
  24. vendor/boldgrid/library/src/assets/css/news-widget.css +28 -0
  25. vendor/boldgrid/library/src/assets/css/ui.css +1 -1
  26. vendor/boldgrid/library/src/library.global.php +62 -6
  27. vendor/boldgrid/library/tests/bootstrap.php +1 -0
  28. vendor/composer/autoload_real.php +4 -4
  29. vendor/composer/autoload_static.php +3 -3
  30. vendor/composer/installed.json +12 -12
includes/class-boldgrid-editor-premium.php CHANGED
@@ -24,52 +24,50 @@ class Boldgrid_Editor_Premium {
24
  * Add Premium Hooks.
25
  *
26
  * @since 1.0.0
 
 
27
  */
28
  public function init() {
29
- // "Upgrade to premium" notices. Notice class instantiated to trigger required hooks.
 
 
 
 
 
 
 
 
 
30
  $notice_class = '\Boldgrid\Library\Library\Notice';
31
- if ( class_exists( $notice_class ) ) {
32
  new $notice_class( 'Static Notice' );
33
  add_action( 'admin_notices', [ $this, 'admin_notice_setup' ] );
34
  }
35
  }
36
 
37
  /**
38
- * Get the plugins premium url.
39
- *
40
- * @since 1.10.0
41
  *
42
- * @return string URL.
43
- */
44
- public function get_premium_url() {
45
- $url = 'https://www.boldgrid.com/central/plugins';
46
- if ( class_exists( '\Boldgrid\Library\Library\Plugin\Plugin' ) ) {
47
- $premium_plugin = new \Boldgrid\Library\Library\Plugin\Plugin( 'post-and-page-builder-premium' );
48
- $url = $premium_plugin->getDownloadUrl();
49
- }
50
-
51
- return $url;
52
- }
53
-
54
- /**
55
- * Display "setup" admin notices.
56
- *
57
- * This method is currently used to display admin notices to help guide the
58
  * user to getting a premium key and getting / activating the premium extension.
59
  *
60
- * @since 1.0.0
 
 
61
  */
62
- public function admin_notice_setup() {
 
 
63
  $config = Boldgrid_Editor_Service::get( 'config' );
64
 
65
  // If the premium plugin is installed and all is good, abort!
66
  if ( $config['premium']['is_premium_done'] ) {
67
- return;
68
  }
69
 
70
  // Check user role.
71
  if ( ! current_user_can( 'update_plugins' ) ) {
72
- return;
73
  }
74
 
75
  $notices = array(
@@ -81,9 +79,10 @@ class Boldgrid_Editor_Premium {
81
  __(
82
  'You have a <strong>Premium BoldGrid Connect Key</strong> and <strong>Post and Page Builder Premium</strong> installed. Please go to your <a href="%1$s">plugins page</a> and activate your premium extension!',
83
  'boldgrid-editor'
84
- ),
85
  admin_url( 'plugins.php' )
86
  ) . '</p>',
 
87
  ),
88
  array(
89
  'id' => 'BGPPB_upgrade_premium',
@@ -94,6 +93,7 @@ class Boldgrid_Editor_Premium {
94
  admin_url( 'options-general.php?page=boldgrid-connect.php' ),
95
  $config['urls']['premium_key'] . '?source=ppbp-installed'
96
  ) . '</p>',
 
97
  ),
98
  array(
99
  'id' => 'BGPPB_download_premium',
@@ -103,17 +103,70 @@ class Boldgrid_Editor_Premium {
103
  __(
104
  'Hello there! We see that you have a <strong>Premium BoldGrid Connect Key</strong> and you have the <strong>Post & Page Builder</strong> activated! Be sure to download the <a href="%1$s">Post and Page Builder Premium Extension</a> to gain access to more features!',
105
  'boldgrid-editor'
106
- ),
107
  $this->get_premium_url()
108
  ) . '</p>',
 
109
  ),
110
  );
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  foreach ( $notices as $notice ) {
113
  if ( $notice['show'] ) {
114
- \Boldgrid\Library\Library\Notice::show( $notice['message'], $notice['id'] );
115
  break;
116
  }
117
  }
118
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
24
  * Add Premium Hooks.
25
  *
26
  * @since 1.0.0
27
+ *
28
+ * @global string $pagenow
29
  */
30
  public function init() {
31
+ global $pagenow;
32
+
33
+ /*
34
+ * "Upgrade to premium" notices.
35
+ *
36
+ * Notice class instantiated to trigger required hooks.
37
+ *
38
+ * Do not show on the dashboard (index.php) as the notices will instead by placed in the
39
+ * "BoldGrid Notifications" widget.
40
+ */
41
  $notice_class = '\Boldgrid\Library\Library\Notice';
42
+ if ( 'index.php' !== $pagenow && class_exists( $notice_class ) ) {
43
  new $notice_class( 'Static Notice' );
44
  add_action( 'admin_notices', [ $this, 'admin_notice_setup' ] );
45
  }
46
  }
47
 
48
  /**
49
+ * Get "setup" admin notices.
 
 
50
  *
51
+ * This method is currently used to get the admin notices that help guide the
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  * user to getting a premium key and getting / activating the premium extension.
53
  *
54
+ * @since 1.11.1
55
+ *
56
+ * @return array
57
  */
58
+ public function get_admin_notices() {
59
+ $notices = array();
60
+
61
  $config = Boldgrid_Editor_Service::get( 'config' );
62
 
63
  // If the premium plugin is installed and all is good, abort!
64
  if ( $config['premium']['is_premium_done'] ) {
65
+ return $notices;
66
  }
67
 
68
  // Check user role.
69
  if ( ! current_user_can( 'update_plugins' ) ) {
70
+ return $notices;
71
  }
72
 
73
  $notices = array(
79
  __(
80
  'You have a <strong>Premium BoldGrid Connect Key</strong> and <strong>Post and Page Builder Premium</strong> installed. Please go to your <a href="%1$s">plugins page</a> and activate your premium extension!',
81
  'boldgrid-editor'
82
+ ),
83
  admin_url( 'plugins.php' )
84
  ) . '</p>',
85
+ 'class' => 'notice notice-warning',
86
  ),
87
  array(
88
  'id' => 'BGPPB_upgrade_premium',
93
  admin_url( 'options-general.php?page=boldgrid-connect.php' ),
94
  $config['urls']['premium_key'] . '?source=ppbp-installed'
95
  ) . '</p>',
96
+ 'class' => 'notice notice-warning',
97
  ),
98
  array(
99
  'id' => 'BGPPB_download_premium',
103
  __(
104
  'Hello there! We see that you have a <strong>Premium BoldGrid Connect Key</strong> and you have the <strong>Post & Page Builder</strong> activated! Be sure to download the <a href="%1$s">Post and Page Builder Premium Extension</a> to gain access to more features!',
105
  'boldgrid-editor'
106
+ ),
107
  $this->get_premium_url()
108
  ) . '</p>',
109
+ 'class' => 'notice notice-warning',
110
  ),
111
  );
112
 
113
+ return $notices;
114
+ }
115
+
116
+ /**
117
+ * Get the plugins premium url.
118
+ *
119
+ * @since 1.10.0
120
+ *
121
+ * @return string URL.
122
+ */
123
+ public function get_premium_url() {
124
+ $url = 'https://www.boldgrid.com/central/plugins';
125
+ if ( class_exists( '\Boldgrid\Library\Library\Plugin\Plugin' ) ) {
126
+ $premium_plugin = new \Boldgrid\Library\Library\Plugin\Plugin( 'post-and-page-builder-premium' );
127
+ $url = $premium_plugin->getDownloadUrl();
128
+ }
129
+
130
+ return $url;
131
+ }
132
+
133
+ /**
134
+ * Display "setup" admin notices.
135
+ *
136
+ * This method is currently used to display admin notices to help guide the
137
+ * user to getting a premium key and getting / activating the premium extension.
138
+ *
139
+ * @since 1.0.0
140
+ */
141
+ public function admin_notice_setup() {
142
+ $notices = $this->get_admin_notices();
143
+
144
  foreach ( $notices as $notice ) {
145
  if ( $notice['show'] ) {
146
+ \Boldgrid\Library\Library\Notice::show( $notice['message'], $notice['id'], $notice['class'] );
147
  break;
148
  }
149
  }
150
  }
151
+
152
+ /**
153
+ * Filter the P&PB feature within the "BoldGrid Notifications" card on the WordPress dashboard.
154
+ *
155
+ * @since 1.11.1
156
+ *
157
+ * @param \Boldgrid\Library\Library\Ui\Feature The feature object.
158
+ * @param \Boldgrid\Library\Library\Plugin\Plugin The plugin object.
159
+ * @return \Boldgrid\Library\Library\Ui\Feature
160
+ */
161
+ public function filter_feature( Boldgrid\Library\Library\Ui\Feature $feature, \Boldgrid\Library\Library\Plugin\Plugin $plugin ) {
162
+ $notices = $this->get_admin_notices();
163
+
164
+ foreach ( $notices as $notice ) {
165
+ if ( $notice['show'] ) {
166
+ $feature->content .= '<div class="' . $notice['class'] . ' inline">' . $notice['message'] . '</div>';
167
+ }
168
+ }
169
+
170
+ return $feature;
171
+ }
172
  }
includes/class-boldgrid-editor.php CHANGED
@@ -306,6 +306,9 @@ class Boldgrid_Editor {
306
 
307
  // Save a users selection for enabling draggable.
308
  add_action( 'wp_ajax_boldgrid_draggable_enabled', array( $boldgrid_editor_ajax, 'ajax_draggable_enabled' ) );
 
 
 
309
  }
310
 
311
  /**
306
 
307
  // Save a users selection for enabling draggable.
308
  add_action( 'wp_ajax_boldgrid_draggable_enabled', array( $boldgrid_editor_ajax, 'ajax_draggable_enabled' ) );
309
+
310
+ // Filter "BoldGrid Notifications" on the WordPress Dashboard.
311
+ add_filter( 'Boldgrid\Library\Notifications\DashboardWidget\getFeaturePlugin\post-and-page-builder', array( $boldgrid_editor_premium, 'filter_feature' ), 10, 2 );
312
  }
313
 
314
  /**
post-and-page-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Post and Page Builder
4
  * Plugin URI: https://www.boldgrid.com/boldgrid-editor/
5
  * Description: Customized drag and drop editing for posts and pages. The Post and Page Builder adds functionality to the existing TinyMCE Editor to give you easier control over your content.
6
- * Version: 1.11.0
7
  * Author: BoldGrid <support@boldgrid.com>
8
  * Author URI: https://www.boldgrid.com/
9
  * Text Domain: boldgrid-editor
3
  * Plugin Name: Post and Page Builder
4
  * Plugin URI: https://www.boldgrid.com/boldgrid-editor/
5
  * Description: Customized drag and drop editing for posts and pages. The Post and Page Builder adds functionality to the existing TinyMCE Editor to give you easier control over your content.
6
+ * Version: 1.11.1
7
  * Author: BoldGrid <support@boldgrid.com>
8
  * Author URI: https://www.boldgrid.com/
9
  * Text Domain: boldgrid-editor
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: boldgrid, page builder, drag and drop, tinymce, editor, landing page
4
  Requires at least: 4.7
5
  Tested up to: 5.2
6
  Requires PHP: 5.4
7
- Stable tag: 1.11.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -134,6 +134,12 @@ WordPress Editor.
134
 
135
  == Changelog ==
136
 
 
 
 
 
 
 
137
  = 1.11.0 =
138
 
139
  Release Date: August 22nd, 2019
4
  Requires at least: 4.7
5
  Tested up to: 5.2
6
  Requires PHP: 5.4
7
+ Stable tag: 1.11.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
134
 
135
  == Changelog ==
136
 
137
+ = 1.11.1 =
138
+
139
+ Release Date: September 5th, 2019
140
+
141
+ * Update: Update BoldGrid Library - Dashboard Updates.
142
+
143
  = 1.11.0 =
144
 
145
  Release Date: August 22nd, 2019
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitb48b9314034d9e74a66cd45ea4bb6286::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit54b1a8ac4b72f1d0df93795d5673078d::getLoader();
vendor/boldgrid/library/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
  language: php
2
 
 
 
3
  notifications:
4
  email:
5
  on_success: never
1
  language: php
2
 
3
+ dist: trusty
4
+
5
  notifications:
6
  email:
7
  on_success: never
vendor/boldgrid/library/README.md CHANGED
@@ -11,6 +11,21 @@ composer require boldgrid/library
11
 
12
  ## Changelog ##
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ### 2.9.2 ###
15
 
16
  Release date: August 1st, 2019
11
 
12
  ## Changelog ##
13
 
14
+ ### 2.10.1 ###
15
+
16
+ Release date: September 5th, 2019
17
+
18
+ * Update: Recommend W3 Total Cache in Plugins > Add New
19
+ * Update: Removing BoldGrid Staging from Plugins > Add New
20
+
21
+ ### 2.10.0 ###
22
+
23
+ Release date: August 29th, 2019
24
+
25
+ * New feature: Show BoldGrid News widget in the dashboard.
26
+ * New feature: Show BoldGrid Notifications widget in the dashboard.
27
+ * New feature: New dashboard pages, can be utilized by plugins.
28
+
29
  ### 2.9.2 ###
30
 
31
  Release date: August 1st, 2019
vendor/boldgrid/library/src/Library/Configs.php CHANGED
@@ -11,6 +11,8 @@
11
 
12
  namespace Boldgrid\Library\Library;
13
 
 
 
14
  /**
15
  * BoldGrid Library Configs Class.
16
  *
@@ -103,6 +105,58 @@ class Configs {
103
  return $configs;
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  /**
107
  * Set a new configuration item
108
  *
11
 
12
  namespace Boldgrid\Library\Library;
13
 
14
+ use Boldgrid\Library\Library\Plugin\Plugin;
15
+
16
  /**
17
  * BoldGrid Library Configs Class.
18
  *
105
  return $configs;
106
  }
107
 
108
+ /**
109
+ * Get the slug of the product that is loading the library.
110
+ *
111
+ * The configs include a "file" setting, which indicate which product is actually loading the
112
+ * library. If the file is "boldgrid-backup/boldgrid-backup.php" for example, this method will
113
+ * return "boldgrid-backup".
114
+ *
115
+ * @since 2.9.0
116
+ *
117
+ * @return string
118
+ */
119
+ public static function getFileSlug() {
120
+ $file = explode( '/', self::get('file') );
121
+
122
+ return $file[0];
123
+ }
124
+
125
+ /**
126
+ * Get plugins from our configs.
127
+ *
128
+ * @since 2.9.0
129
+ *
130
+ * @param array $filters An optional array of filters to help get a specific type of plugin.
131
+ * @return array
132
+ */
133
+ public static function getPlugins( $filters = array() ) {
134
+ $plugins = array();
135
+
136
+ foreach( self::get( 'plugins' ) as $plugin ) {
137
+ $slug = Plugin::getFileSlug( $plugin['file'] );
138
+
139
+ // If no filters, add the plugin. Else, only add the plugin if all filters match.
140
+ if ( empty( $filters ) ) {
141
+ $plugins[] = new Plugin( $slug );
142
+ } else {
143
+ $addPlugin = true;
144
+
145
+ foreach( $filters as $key => $value ) {
146
+ if ( ! isset( $plugin[ $key ] ) || $value !== $plugin[ $key ] ) {
147
+ $addPlugin = false;
148
+ }
149
+ }
150
+
151
+ if ( $addPlugin ) {
152
+ $plugins[] = new Plugin( $slug );
153
+ }
154
+ }
155
+ }
156
+
157
+ return $plugins;
158
+ }
159
+
160
  /**
161
  * Set a new configuration item
162
  *
vendor/boldgrid/library/src/Library/Dashboard.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library Dashboard Class
4
+ *
5
+ * @package Boldgrid\Library
6
+ * @subpackage \Library\License
7
+ *
8
+ * @version 2.9.0
9
+ * @author BoldGrid <wpb@boldgrid.com>
10
+ */
11
+
12
+ namespace Boldgrid\Library\Library;
13
+
14
+ /**
15
+ * BoldGrid Library Dashboard Class.
16
+ *
17
+ * This is a generic class used for managing the WordPress Dashboard.
18
+ *
19
+ * @since 2.9.0
20
+ */
21
+ class Dashboard {
22
+ /**
23
+ * Init.
24
+ *
25
+ * @since 2.9.0
26
+ */
27
+ public function init() {
28
+ /*
29
+ * Move BoldGrid Widgets to the top of the WordPress dashboard.
30
+ *
31
+ * This is not permanent. The user can move BoldGrid widgets elsewhere after the first load.
32
+ *
33
+ * sortWidgets class runs Filter::add($this) in __construct.
34
+ */
35
+ $sortWidgets = new Dashboard\SortWidgets();
36
+ }
37
+ }
vendor/boldgrid/library/src/Library/Dashboard/SortWidgets.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library Dashboard Sort Widgets Class
4
+ *
5
+ * @package Boldgrid\Library
6
+ * @subpackage \Library\License
7
+ *
8
+ * @version 2.9.0
9
+ * @author BoldGrid <wpb@boldgrid.com>
10
+ */
11
+
12
+ namespace Boldgrid\Library\Library\Dashboard;
13
+
14
+ use BoldGrid\Library\Library;
15
+
16
+ /**
17
+ * BoldGrid Library Dashboard Sort Widgets Class.
18
+ *
19
+ * @since 2.9.0
20
+ */
21
+ class SortWidgets {
22
+ /**
23
+ * Constructor.
24
+ *
25
+ * @since 2.9.0
26
+ */
27
+ public function __construct() {
28
+ Library\Filter::add( $this );
29
+ }
30
+
31
+ /**
32
+ * Get configs.
33
+ *
34
+ * Configs are stored in library.global.php. They're an array of widgets, along with which
35
+ * container and priorty they should go.
36
+ *
37
+ * @since 2.9.0
38
+ *
39
+ * @return array
40
+ */
41
+ public function getConfigs() {
42
+ return Library\Configs::get( 'dashboardWidgetOrder' );
43
+ }
44
+
45
+ /**
46
+ * Get a widget from the global $wp_meta_boxes.
47
+ *
48
+ * As we loop through the global $wp_meta_boxes, we keep track of where within it our widget is.
49
+ * That locaion info includes the container (normal, side, etc) and priority (high, core, etc).
50
+ *
51
+ * This method is primarily used to find a widget within the global array so we can remove it.
52
+ *
53
+ * @since 2.9.0
54
+ *
55
+ * @global array $wp_meta_boxes
56
+ *
57
+ * @param string $id The id of the widget to find.
58
+ * @return array
59
+ */
60
+ public function getWidget( $id ) {
61
+ $widget = array();
62
+
63
+ // Example structure of $wp_meta_boxes - https://pastebin.com/uYqDEZgm
64
+ global $wp_meta_boxes;
65
+
66
+ // We're only interested in dashboard widgets.
67
+ if ( empty( $wp_meta_boxes['dashboard'] ) ) {
68
+ return $widget;
69
+ }
70
+
71
+ // Complicated looping below because of $wp_meta_boxes structure. See example above.
72
+ foreach ( $wp_meta_boxes['dashboard'] as $container => $priorities ) {
73
+ foreach ( $priorities as $priority => $widgets ) {
74
+ foreach ( $widgets as $widget ) {
75
+ if ( $id === $widget['id'] ) {
76
+ $widget = array(
77
+ 'container' => $container,
78
+ 'priority' => $priority,
79
+ 'widget' => $widget,
80
+ );
81
+
82
+ break 3;
83
+ }
84
+ }
85
+ }
86
+ }
87
+
88
+ return $widget;
89
+ }
90
+
91
+ /**
92
+ * Sort the widgets as contained in the user's "meta-box-order_dashboard" meta.
93
+ *
94
+ * We are deleting our widgets, and then adding them back in.
95
+ *
96
+ * @since 2.9.0
97
+ */
98
+ public function sortCustomOrder() {
99
+ $userId = get_current_user_id();
100
+
101
+ $userWidgetOrder = get_user_meta( $userId, 'meta-box-order_dashboard', true );
102
+
103
+ $widgetConfigs = $this->getConfigs();
104
+
105
+ // First, delete all of our widgets.
106
+ foreach ( $userWidgetOrder as $container => $widgets ) {
107
+ $widgets = explode( ',', $widgets );
108
+
109
+ foreach ( array_keys( $widgetConfigs ) as $id ) {
110
+ if ( ( $key = array_search( $id, $widgets ) ) !== false ) {
111
+ unset( $widgets[ $key ] );
112
+ }
113
+ }
114
+
115
+ $userWidgetOrder[ $container ] = implode( ',', $widgets );
116
+ }
117
+
118
+ // Then, add them back in.
119
+ foreach ( $widgetConfigs as $id => $configs ) {
120
+ switch( empty( $userWidgetOrder[ $configs['container'] ] ) ) {
121
+ case true:
122
+ $userWidgetOrder[ $configs['container'] ] = $id;
123
+ break;
124
+ case false:
125
+ $userWidgetOrder[ $configs['container'] ] = $id . ',' . $userWidgetOrder[ $configs['container'] ];
126
+ break;
127
+ }
128
+ }
129
+ update_user_meta( $userId, 'meta-box-order_dashboard', $userWidgetOrder );
130
+ }
131
+
132
+ /**
133
+ * Sort the widgets as containted in the global $wp_meta_boxes.
134
+ *
135
+ * @since 2.9.0
136
+ */
137
+ public function sortGlobal() {
138
+ global $wp_meta_boxes;
139
+
140
+ foreach ( $this->getConfigs() as $id => $configs ) {
141
+ $widget = $this->getWidget( $id );
142
+
143
+ $invalidData = empty( $widget['container'] ) || empty( $widget['priority'] );
144
+ if ( $invalidData ) {
145
+ continue;
146
+ }
147
+
148
+ // First, remove the widget from where it is now.
149
+ unset( $wp_meta_boxes['dashboard'][$widget['container']][$widget['priority']][$id] );
150
+
151
+ // Then, add it to the correct location.
152
+ $wp_meta_boxes['dashboard'][ $configs['container'] ][ $configs['priority'] ] =
153
+ array( $id => $widget['widget'] ) +
154
+ $wp_meta_boxes['dashboard'][ $configs['container'] ][ $configs['priority'] ];
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Filter the display order of widgets on the dashboard.
160
+ *
161
+ * Primary objective is to place BoldGrid widgets at the top.
162
+ *
163
+ * If the user has a custom display order (IE they've dragged things around), we'll force our
164
+ * widgets to the top only once. This way, we can force our widgets to the top, but if they want
165
+ * to move them lower, they are free to do so.
166
+ *
167
+ * @priority 20
168
+ */
169
+ public function wp_dashboard_setup() {
170
+ $userId = get_current_user_id();
171
+
172
+ // Debug.
173
+ // delete_user_meta( $userId, 'meta-box-order_dashboard' );
174
+ // delete_user_meta( $userId, 'bglibDashboardOrder' );
175
+
176
+ // Whether the user has dragged widgets around on their dashboard and changed the order.
177
+ $userChangedOrder = get_user_meta( get_current_user_id(), 'meta-box-order_dashboard', true );
178
+ $userChangedOrder = ! empty( $userChangedOrder );
179
+
180
+ // Whether bglib has already changed the user's own custom dashboard widget order.
181
+ $hasChangedLibrary = get_user_meta( $userId, 'bglibDashboardOrder', true );
182
+ $hasChangedLibrary = ! empty( $hasChangedLibrary );
183
+
184
+ $userChangedOrder && ! $hasChangedLibrary ? $this->sortCustomOrder() : $this->sortGlobal();
185
+
186
+ // Flag that we have updated the user's dashboard widget sort order.
187
+ update_user_meta( $userId, 'bglibDashboardOrder', 1 );
188
+ }
189
+ }
vendor/boldgrid/library/src/Library/Key/PostNewKey.php CHANGED
@@ -80,21 +80,29 @@ class PostNewKey {
80
  *
81
  * @return string
82
  */
83
- public static function getCentralUrl() {
84
- /**
85
- * Allow the return url to be filtered.
86
  *
87
  * The return url is the url that BoldGrid Central will link the user to after they received
88
  * their new BoldGrid Connect Key.
89
  *
90
- * By default, we will link them to Dashboard > Settings > BoldGrid Connect. However,
91
- * with this filter plugins can change this url.
 
 
 
 
 
 
 
 
92
  *
93
  * @since 2.8.0
94
  *
95
  * @param string URL to the BoldGrid Connect settings page.
96
  */
97
- $returnUrl = apply_filters( 'Boldgrid\Library\Key\returnUrl', admin_url( 'options-general.php?page=boldgrid-connect.php' ) );
98
 
99
  $returnUrl = add_query_arg( 'nonce', wp_create_nonce( 'bglib-key-prompt' ), $returnUrl );
100
 
80
  *
81
  * @return string
82
  */
83
+ public static function getCentralUrl( $returnUrl = '' ) {
84
+ /*
85
+ * Configure our return url.
86
  *
87
  * The return url is the url that BoldGrid Central will link the user to after they received
88
  * their new BoldGrid Connect Key.
89
  *
90
+ * In the initial version of this method, the return url linked to
91
+ * Dashboard > Settings > BoldGrid Connect
92
+ * and we allowed the filter below to be used to change the url. As plugins began to use
93
+ * this method more, it's became easier to simply allow a return url to be passed in, rather
94
+ * than require the filter to be used.
95
+ */
96
+ $returnUrl = ! empty( $returnUrl ) ? $returnUrl : admin_url( 'options-general.php?page=boldgrid-connect.php' );
97
+
98
+ /**
99
+ * Allow the return url to be filtered.
100
  *
101
  * @since 2.8.0
102
  *
103
  * @param string URL to the BoldGrid Connect settings page.
104
  */
105
+ $returnUrl = apply_filters( 'Boldgrid\Library\Key\returnUrl', $returnUrl );
106
 
107
  $returnUrl = add_query_arg( 'nonce', wp_create_nonce( 'bglib-key-prompt' ), $returnUrl );
108
 
vendor/boldgrid/library/src/Library/License.php CHANGED
@@ -390,6 +390,7 @@ class License {
390
  *
391
  * @hook Boldgrid\Library\License\isPremium
392
  *
 
393
  * @return bool
394
  */
395
  public function isPremium( $product ) {
390
  *
391
  * @hook Boldgrid\Library\License\isPremium
392
  *
393
+ * @param string $product Such as "boldgrid-backup" or "post-and-page-builder".
394
  * @return bool
395
  */
396
  public function isPremium( $product ) {
vendor/boldgrid/library/src/Library/NewsWidget.php ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library News Widget Class
4
+ *
5
+ * @package Boldgrid\Library
6
+ * @subpackage \Library\License
7
+ *
8
+ * @version 2.9.0
9
+ * @author BoldGrid <wpb@boldgrid.com>
10
+ */
11
+
12
+ namespace Boldgrid\Library\Library;
13
+
14
+ /**
15
+ * BoldGrid Library News Widget Class.
16
+ *
17
+ * This class is responsible for rendering the "BoldGrid News" widget on the WordPress dashboard.
18
+ *
19
+ * @since 2.9.0
20
+ */
21
+ class NewsWidget {
22
+ /**
23
+ * An array of errors.
24
+ *
25
+ * @since 2.10.0
26
+ * @var array
27
+ */
28
+ public $errors = [];
29
+
30
+ /**
31
+ * Constructor.
32
+ *
33
+ * @since 2.9.0
34
+ */
35
+ public function __construct() {
36
+ Filter::add( $this );
37
+ }
38
+
39
+ /**
40
+ * Enqueue scripts.
41
+ *
42
+ * @since 2.9.0
43
+ *
44
+ * @param string $hook Hook.
45
+ */
46
+ public function admin_enqueue_scripts( $hook ) {
47
+ wp_register_style(
48
+ 'bglib-news-widget-css',
49
+ Configs::get( 'libraryUrl' ) . 'src/assets/css/news-widget.css'
50
+ );
51
+
52
+ switch( $hook ) {
53
+ case 'index.php':
54
+ wp_enqueue_style( 'bglib-news-widget-css' );
55
+ break;
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Display the inner contents of our news widgget.
61
+ *
62
+ * @since 2.9.0
63
+ */
64
+ public function display() {
65
+ // Get 2 posts.
66
+ $posts = $this->getPosts( 2 );
67
+
68
+ // If there are errors, abort.
69
+ if ( ! empty( $this->errors ) ) {
70
+ echo '<p>' . implode( $this->errors, '</p></p>' ) . '</p>';
71
+ return;
72
+ }
73
+
74
+ // If we have no news posts, abort.
75
+ if( empty( $posts ) ) {
76
+ echo '<p>' . esc_html__( 'There are no updates to show right now.', 'boldgrid-library' ) . '</p>';
77
+ return;
78
+ }
79
+
80
+ // Finally, display the posts.
81
+ echo '<ul>';
82
+ foreach ( $posts as $post ) {
83
+ // Get the url to the featured image.
84
+ $featuredImage = '';
85
+ if ( ! empty( $post->_embedded->{'wp:featuredmedia'}[0]->media_details->sizes->medium->source_url ) ) {
86
+ $featuredImage = $post->_embedded->{'wp:featuredmedia'}[0]->media_details->sizes->medium->source_url;
87
+ }
88
+
89
+ ?> <li title="<?php echo esc_attr( $post->excerpt->rendered ); ?>">
90
+ <?php if ( ! empty( $featuredImage ) ) {
91
+ echo '<img class="bglib-featured" src="' . esc_url( $featuredImage ) . '" />';
92
+ } ?>
93
+ <p class="bglib-date">
94
+ <?php echo date( 'M jS, Y', strtotime( $post->date ) ); ?>
95
+ </p>
96
+ <p class="bglib-title">
97
+ <a href='<?php echo $post->link; ?>' target='_blank'><?php echo $post->title->rendered; ?></a>
98
+ </p>
99
+ </li>
100
+ <?php
101
+ }
102
+ echo '</ul><div style="clear:both;"></div>';
103
+ }
104
+
105
+ /**
106
+ * Get the id of a tag.
107
+ *
108
+ * @since 2.9.0
109
+ *
110
+ * @param string $tag The tag name.
111
+ * @return int
112
+ */
113
+ public function getTagId( $tag ) {
114
+ $id = 0;
115
+
116
+ $request = wp_remote_get( 'https://www.boldgrid.com/wp-json/wp/v2/tags/?slug=' . $tag );
117
+
118
+ if( is_wp_error( $request ) ) {
119
+ return $id;
120
+ }
121
+
122
+ $body = wp_remote_retrieve_body( $request );
123
+ $body = json_decode( $body );
124
+
125
+ $id = ! empty( $body[0]->id ) ? $body[0]->id : $id;
126
+
127
+ return $id;
128
+ }
129
+
130
+ /**
131
+ * Get rss posts.
132
+ *
133
+ * @since 2.10.0
134
+ *
135
+ * @param string $limit The number of posts to return.
136
+ * @return array An array of posts.
137
+ */
138
+ public function getPosts( $limit ) {
139
+ // Get all posts tagged, "dashboard".
140
+ $request = wp_remote_get( $this->getRssUrl() );
141
+
142
+ // If we have an error, abort.
143
+ if( is_wp_error( $request ) ) {
144
+ if ( is_admin() || current_user_can( 'manage_options' ) ) {
145
+ $this->errors[] = sprintf(
146
+ // translators: An RSS error message.
147
+ __( '<strong>RSS Error</strong>: %s', 'boldgrid-inspirations' ),
148
+ esc_html__( $request->get_error_message() )
149
+ );
150
+ }
151
+
152
+ return;
153
+ }
154
+
155
+ // Get our "dashboard" posts.
156
+ $body = wp_remote_retrieve_body( $request );
157
+ $posts = json_decode( $body );
158
+
159
+ if ( $limit ) {
160
+ $posts = array_slice( $posts, 0, $limit );
161
+ }
162
+
163
+ return $posts;
164
+ }
165
+
166
+ /**
167
+ * Get the URL for our rss feed.
168
+ *
169
+ * @since 2.10.0
170
+ *
171
+ * @return string
172
+ */
173
+ public function getRssUrl() {
174
+ // Adding _embed includes the featured image urls, without the need to make another call.
175
+ $url = 'https://www.boldgrid.com/wp-json/wp/v2/posts/?_embed&tags=' . $this->getTagId( 'dashboard' );
176
+
177
+ $url .= '&key=' . Configs::get('key');
178
+
179
+ $plugins = [];
180
+ $bgPlugins = array_merge(
181
+ array_keys( Configs::get('pluginInstaller')['plugins'] ),
182
+ array_keys( Configs::get('pluginInstaller')['wporgPlugins'] )
183
+ );
184
+
185
+ // Get data for only BoldGrid plugins.
186
+ foreach ( get_plugins() as $slug => $info ) {
187
+ if ( preg_grep('~' . strtok($slug, '/') . '~', $bgPlugins) ) {
188
+ $plugins[] = [
189
+ 'slug' => $slug,
190
+ 'version' => $info['Version'],
191
+ 'active' => is_plugin_active( $slug ),
192
+ ];
193
+ }
194
+ }
195
+
196
+ $url .= '&data=' . rawurlencode( gzdeflate( wp_json_encode(
197
+ [
198
+ 'locale' => get_locale(),
199
+ 'plugins' => $plugins,
200
+ ]
201
+ ) ) );
202
+
203
+ return $url;
204
+ }
205
+
206
+ /**
207
+ * Add our news widget to the dashboard.
208
+ *
209
+ * Priority 5 given for backwards compatibility with BoldGrid Inspirations. If Inspirations is
210
+ * trying to add the news widget, this method will go first and take precedence.
211
+ *
212
+ * @since 2.9.0
213
+ *
214
+ * @priority 5
215
+ */
216
+ public function wp_dashboard_setup() {
217
+ wp_add_dashboard_widget(
218
+ 'boldgrid_news_widget',
219
+ esc_html__( 'BoldGrid News', 'boldgrid-library' ),
220
+ [
221
+ $this,
222
+ 'display',
223
+ ]
224
+ );
225
+ }
226
+ }
vendor/boldgrid/library/src/Library/Notifications/DashboardWidget.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library Notifications Dashboard Widget Class
4
+ *
5
+ * @package Boldgrid\Library
6
+ * @subpackage \Library\License
7
+ *
8
+ * @version 2.9.0
9
+ * @author BoldGrid <wpb@boldgrid.com>
10
+ */
11
+
12
+ namespace Boldgrid\Library\Library\Notifications;
13
+
14
+ use Boldgrid\Library\Library;
15
+
16
+ /**
17
+ * BoldGrid Library Notifications Dashboard Widget Class.
18
+ *
19
+ * This class is responsible for rendering the "BoldGrid Notifications" widget on the WordPress
20
+ * dashboard.
21
+ *
22
+ * @since 2.10.0
23
+ */
24
+ class DashboardWidget {
25
+ /**
26
+ * Initialize class and set class properties.
27
+ *
28
+ * @since 2.10.0
29
+ */
30
+ public function __construct() {
31
+ Library\Filter::add( $this );
32
+ }
33
+
34
+ /**
35
+ * Load scripts on the admin_enqueue_scripts hook.
36
+ *
37
+ * @since 2.10.0
38
+ */
39
+ public function admin_enqueue_scripts() {
40
+ Library\Ui\Dashboard::enqueueScripts();
41
+ }
42
+
43
+ /**
44
+ * Print the "BoldGrid Notifications" WordPress Dashboard widget.
45
+ *
46
+ * @since 2.10.0
47
+ */
48
+ public function printWidget() {
49
+ $card = new \Boldgrid\Library\Library\Ui\Card();
50
+
51
+ // Add all of our active plugins.
52
+ $activePlugins = Library\Plugin\Plugins::getActive();
53
+ foreach( $activePlugins as $plugin ) {
54
+ $card->features[] = $this->getFeaturePlugin( $plugin );
55
+ }
56
+
57
+ // Add a "feature" for free / premium.
58
+ $card->features[] = $this->getFeatureKey();
59
+
60
+ $card->printCard();
61
+ }
62
+
63
+ /**
64
+ * Get the "feature" for our BoldGrid Connect Key.
65
+ *
66
+ * @since 2.10.0
67
+ *
68
+ * @return \Boldgrid\Library\Library\Ui\Feature
69
+ */
70
+ public function getFeatureKey() {
71
+ $feature = new Library\Ui\Feature();
72
+
73
+ /*
74
+ * Get our license string: "None", "Free", "Premium".
75
+ *
76
+ * Be default, the license string is based on a single product's license. Instead of using
77
+ * this logic, below we are trying to figure out a key's license (and not a product's license).
78
+ *
79
+ * To get the license, we need to check if a particular product is premium. To do that, we
80
+ * will set our product to be the plugin that is loading the library.
81
+ */
82
+ $license = new Library\License();
83
+ $key = $license->getApiKey();
84
+ if ( empty( $key ) ) {
85
+ $licenseString = 'None';
86
+ } else {
87
+ $product = Library\Configs::getFileSlug();
88
+ // Call isPermium(), which sets the license string.
89
+ $license->isPremium( $product );
90
+ $licenseString = $license->getLicenseString();
91
+ }
92
+
93
+ $feature->title = esc_html__( 'BoldGrid Connect Key', 'boldgrid-backup' );
94
+
95
+ switch( $licenseString ) {
96
+ case 'None':
97
+ $feature->icon = '<span class="dashicons dashicons-admin-network"></span>';
98
+ $feature->content = '<div class="notice notice-warning inline">
99
+ <p>
100
+ <a href="' . admin_url( 'options-general.php?page=boldgrid-connect.php' ) . '">' .
101
+ esc_html__( 'Please install your Connect Key', 'boldgrid-library' ) .
102
+ '</a>
103
+ </p>
104
+ </div>';
105
+ break;
106
+ case 'Free':
107
+ $feature->icon = '<span class="dashicons dashicons-admin-network boldgrid-orange"></span>';
108
+ $feature->content = '<div class="notice notice-warning inline">
109
+ <p>
110
+ <a href="' . esc_url( Library\Configs::get( 'learnMore' ) ) . '">' .
111
+ esc_html__( 'Learn about the advanced features of a Premium Key.', 'boldgrid-library' ) .
112
+ '</a>
113
+ </p>
114
+ </div>';
115
+ break;
116
+ case 'Premium':
117
+ $feature->icon = '<span class="dashicons dashicons-admin-network boldgrid-orange"></span>';
118
+ $feature->content = esc_html__( 'Premium Connect Key Installed!', 'boldgrid-library' );
119
+ break;
120
+ }
121
+
122
+ return $feature;
123
+ }
124
+
125
+ /**
126
+ * Get the "feature" for a plugin.
127
+ *
128
+ * @since 2.10.0
129
+ *
130
+ * @param \Boldgrid\Library\Library\Plugin\Plugin A plugin object.
131
+ * @param \Boldgrid\Library\Library\Plugin\Plugin The plugin's parent plugin (optional).
132
+ * @return \Boldgrid\Library\Library\Ui\Feature A feature object.
133
+ */
134
+ public function getFeaturePlugin( Library\Plugin\Plugin $plugin, $parentPlugin = null ) {
135
+ $isParentPlugin = is_null( $parentPlugin );
136
+
137
+ // Get the markup for the plugin's icon.
138
+ $icons = $plugin->getIcons();
139
+ if ( empty( $icons ) ) {
140
+ $icon = '<span class="dashicons dashicons-admin-plugins"></span>';
141
+ } else {
142
+ $iconUrl = ! empty( $icons['1x'] ) ? $icons['1x'] : reset( $icons );
143
+ $icon = '<img src="' . esc_url( $iconUrl ) . '" />';
144
+ }
145
+
146
+ $feature = new Library\Ui\Feature();
147
+
148
+ $feature->title = $plugin->getData( 'Name' );
149
+
150
+ $feature->icon = $icon;
151
+
152
+ if ( $plugin->hasUpdate() ) {
153
+ $feature->content = '<div class="notice notice-warning inline"><p>' . wp_kses(
154
+ sprintf(
155
+ __( '%1$s is out of date. %2$sFix this%3$s.', 'boldgrid-backup' ),
156
+ $plugin->getData( 'Name' ),
157
+ '<a href="' . esc_url( admin_url( 'update-core.php' ) ) . '">',
158
+ '</a>'
159
+ ),
160
+ [ 'a' => [ 'href' => [] ] ]
161
+ ) . '</p></div>';
162
+ }
163
+
164
+ /**
165
+ * Allow items to be filtered.
166
+ *
167
+ * @since 2.10.0
168
+ *
169
+ * @param \Boldgrid\Library\Library\Ui\Feature The feature object.
170
+ * @param \Boldgrid\Library\Library\Plugin\Plugin The plugin object.
171
+ */
172
+ $feature = apply_filters( 'Boldgrid\Library\Notifications\DashboardWidget\getFeaturePlugin\\' . $plugin->getSlug(), $feature, $plugin );
173
+
174
+ /*
175
+ * If this plugin has child plugins (IE a premium plugin), then allow those children to add
176
+ * notices to the parent.
177
+ */
178
+ $childPlugins = $plugin->getChildPlugins();
179
+ foreach ( $childPlugins as $childPlugin ) {
180
+ if ( ! $childPlugin->getIsInstalled() ) {
181
+ continue;
182
+ }
183
+
184
+ $childFeature = $this->getFeaturePlugin( $childPlugin, $plugin );
185
+ $feature->content .= $childFeature->content;
186
+ }
187
+
188
+ // The parent plugin makes the final call, as in whether or not there are issues to report.
189
+ if ( $isParentPlugin && empty( $feature->content ) ) {
190
+ $feature->content = '<p>' . __( 'No issues to report!', 'boldgrid-library' ) . '</p>';
191
+ }
192
+
193
+ return $feature;
194
+ }
195
+
196
+
197
+ /**
198
+ * Setup our dashboard widget.
199
+ *
200
+ * @since 2.10.0
201
+ *
202
+ * @link https://codex.wordpress.org/Dashboard_Widgets_API
203
+ */
204
+ public function wp_dashboard_setup() {
205
+ wp_add_dashboard_widget(
206
+ 'boldgrid-notifications',
207
+ __( 'BoldGrid Notifications', 'boldgrid-library' ),
208
+ array( $this, 'printWidget' )
209
+ );
210
+ }
211
+ }
vendor/boldgrid/library/src/Library/Plugin/Plugin.php CHANGED
@@ -20,24 +20,160 @@ use Boldgrid\Library\Library\Configs;
20
  * @since 2.7.7
21
  */
22
  class Plugin {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  /**
25
  * Plugin slug.
26
  *
27
  * Examples: boldgrid-backup, boldgrid-backup-premium, etc.
28
  *
29
- * @var string
30
  * @since 2.7.7
 
31
  */
32
- private $slug;
33
 
34
  /**
35
  * Constructor.
36
  *
37
  * @since 2.7.7
 
 
38
  */
39
  public function __construct( $slug ) {
40
  $this->slug = $slug;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
 
43
  /**
@@ -45,6 +181,8 @@ class Plugin {
45
  *
46
  * @since 2.7.7
47
  *
 
 
48
  * @return string
49
  */
50
  public function getDownloadUrl() {
@@ -54,4 +192,173 @@ class Plugin {
54
 
55
  return $url;
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  }
20
  * @since 2.7.7
21
  */
22
  class Plugin {
23
+ /**
24
+ * An array of children plugins.
25
+ *
26
+ * Elements of this array are of this class, Plugin (recursion).
27
+ *
28
+ * @since 2.10.0
29
+ * @var array
30
+ * @access protected
31
+ */
32
+ protected $childPlugins = [];
33
+
34
+ /**
35
+ * Plugin file.
36
+ *
37
+ * For example: plugin/plugin.php
38
+ *
39
+ * @since 2.9.0
40
+ * @var string
41
+ * @access protected
42
+ */
43
+ protected $file;
44
+
45
+ /**
46
+ * Whether or not this plugin is installed.
47
+ *
48
+ * @since 2.10.0
49
+ * @var bool
50
+ * @access protected
51
+ */
52
+ protected $isInstalled;
53
+
54
+ /**
55
+ * Path to the plugin.
56
+ *
57
+ * For example, ABSPATH/wp-content/plugins/plugin/plugin.php.
58
+ *
59
+ * @since 2.10.0
60
+ */
61
+ protected $path;
62
+
63
+ /**
64
+ * Plugin data, as retrieved from get_plugin_data().
65
+ *
66
+ * @since 2.9.0
67
+ * @var array
68
+ * @access protected
69
+ */
70
+ protected $pluginData = [];
71
+
72
+ /**
73
+ * Update plugin data, as retrieved from 'update_plugins' site transient.
74
+ *
75
+ * @since 2.9.0
76
+ * @var array
77
+ * @access protected
78
+ */
79
+ protected $updatePlugins;
80
 
81
  /**
82
  * Plugin slug.
83
  *
84
  * Examples: boldgrid-backup, boldgrid-backup-premium, etc.
85
  *
86
+ * @var string
87
  * @since 2.7.7
88
+ * @access protected
89
  */
90
+ protected $slug;
91
 
92
  /**
93
  * Constructor.
94
  *
95
  * @since 2.7.7
96
+ *
97
+ * @param string $slug For example: "plugin" from plugin/plugin.php
98
  */
99
  public function __construct( $slug ) {
100
  $this->slug = $slug;
101
+
102
+ $this->setFile();
103
+
104
+ $this->setPath();
105
+
106
+ $this->setIsInstalled();
107
+
108
+ $this->setChildPlugins();
109
+ }
110
+
111
+ /**
112
+ * Get an array of the plugin's icons.
113
+ *
114
+ * @since 2.9.0
115
+ *
116
+ * @return array
117
+ */
118
+ public function getIcons() {
119
+ $updates = $this->getUpdatePlugins();
120
+
121
+ $icons = array();
122
+ $icons = ! empty( $updates->response[ $this->file ]->icons ) ? $updates->response[ $this->file ]->icons : $icons;
123
+ $icons = ! empty( $updates->no_update[ $this->file ]->icons ) ? $updates->no_update[ $this->file ]->icons : $icons;
124
+
125
+ return $icons;
126
+ }
127
+
128
+ /**
129
+ * Get the child plugins array.
130
+ *
131
+ * @since 2.10.0
132
+ *
133
+ * @return array
134
+ */
135
+ public function getChildPlugins() {
136
+ return $this->childPlugins;
137
+ }
138
+
139
+ /**
140
+ * Get config for this particular plugin.
141
+ *
142
+ * Within library.global.php, there is a config option called "plugins". This method loops through
143
+ * those plugins and returns the configs for this particular plugin.
144
+ *
145
+ * @since 2.10.0
146
+ *
147
+ * @return array
148
+ */
149
+ public function getConfig() {
150
+ $config = [];
151
+
152
+ $plugins = Configs::get( 'plugins' );
153
+
154
+ foreach ( $plugins as $plugin ) {
155
+ if ( $plugin['file'] === $this->file ) {
156
+ $config = $plugin;
157
+ }
158
+ }
159
+
160
+ return $config;
161
+ }
162
+
163
+ /**
164
+ * Get data via the get_plugin_data() function.
165
+ *
166
+ * If a $key is passed in, return that key, otherwise return all data.
167
+ *
168
+ * @since 2.9.0
169
+ *
170
+ * @param string $key The data key to return.
171
+ * @return mixed
172
+ */
173
+ public function getData( $key = null ) {
174
+ $data = $this->getPluginData();
175
+
176
+ return empty( $key ) ? $data : $data[ $key ];
177
  }
178
 
179
  /**
181
  *
182
  * @since 2.7.7
183
  *
184
+ * @todo This method only works for plugins hosted at the BoldGrid api server.
185
+ *
186
  * @return string
187
  */
188
  public function getDownloadUrl() {
192
 
193
  return $url;
194
  }
195
+
196
+ /**
197
+ * Get isInstalled.
198
+ *
199
+ * @since 2.10.0
200
+ *
201
+ * @return bool
202
+ */
203
+ public function getIsInstalled() {
204
+ return $this->isInstalled;
205
+ }
206
+
207
+ /**
208
+ * Get file.
209
+ *
210
+ * @since 2.9.0
211
+ *
212
+ * @return string
213
+ */
214
+ public function getFile() {
215
+ return $this->file;
216
+ }
217
+
218
+ /**
219
+ * Get a plugin's slug from its file.
220
+ *
221
+ * For example, if the plugin's file is:
222
+ * boldgrid-backup-premium/boldgrid-backup-premium.php
223
+ * The plugin's slug is:
224
+ * boldgrid-backup-premium
225
+ *
226
+ * @since 2.10.0
227
+ *
228
+ * @param string $file The plugin's file, as in plugin/plugin.php
229
+ * @return string
230
+ */
231
+ public static function getFileSlug( $file ) {
232
+ $slug = explode( '/', $file );
233
+
234
+ return $slug[0];
235
+ }
236
+
237
+ /**
238
+ * If a new version of a plugin is available, return the new version.
239
+ *
240
+ * @since 2.9.0
241
+ *
242
+ * @return string
243
+ */
244
+ public function getNewVersion() {
245
+ $updates = $this->getUpdatePlugins();
246
+
247
+ return ! empty( $updates->response[ $this->file ]->new_version ) ? $updates->response[ $this->file ]->new_version : '0';
248
+ }
249
+
250
+ /**
251
+ * Get plugin data.
252
+ *
253
+ * @since 2.9.0
254
+ *
255
+ * @return array
256
+ */
257
+ public function getPluginData() {
258
+ if ( empty( $this->pluginData ) && $this->isInstalled ) {
259
+ $this->pluginData = get_plugin_data( $this->path );
260
+ }
261
+
262
+ return $this->pluginData;
263
+ }
264
+
265
+ /**
266
+ * Get slug.
267
+ *
268
+ * @since 2.9.0
269
+ *
270
+ * @return string
271
+ */
272
+ public function getSlug() {
273
+ return $this->slug;
274
+ }
275
+
276
+ /**
277
+ * Set our child plugins.
278
+ *
279
+ * @since 2.10.0
280
+ */
281
+ public function setChildPlugins() {
282
+ $config = $this->getConfig();
283
+
284
+ if ( empty( $config['childPlugins'] ) ) {
285
+ return;
286
+ }
287
+
288
+ foreach ( $config['childPlugins'] as $file ) {
289
+ $slug = $this->getFileSlug( $file );
290
+
291
+ $this->childPlugins[] = new Plugin( $slug );
292
+ }
293
+ }
294
+
295
+ /**
296
+ * Set file.
297
+ *
298
+ * @since 2.9.0
299
+ *
300
+ * @param string $file A plugin's file.
301
+ */
302
+ public function setFile( $file = null ) {
303
+ $this->file = ! empty( $file ) ? $file : $this->slug . '/' . $this->slug . '.php';
304
+ }
305
+
306
+ /**
307
+ * Set whether or not the plugin is installed (different from activated).
308
+ *
309
+ * @since 2.10.0
310
+ */
311
+ public function setIsInstalled() {
312
+ $wp_filesystem = \Boldgrid\Library\Util\Version::getWpFilesystem();
313
+
314
+ $this->isInstalled = $wp_filesystem->exists( $this->path );
315
+ }
316
+
317
+ /**
318
+ * Set the plugin's path.
319
+ *
320
+ * @since 2.10.0
321
+ */
322
+ public function setPath() {
323
+ $this->path = ABSPATH . 'wp-content/plugins/' . $this->file;
324
+ }
325
+
326
+ /**
327
+ * Get updatePlugins data.
328
+ *
329
+ * @since 2.9.0
330
+ *
331
+ * @return object
332
+ */
333
+ public function getUpdatePlugins() {
334
+ if ( empty( $this->updatePlugins ) ) {
335
+ $this->updatePlugins = get_site_transient( 'update_plugins' );
336
+ }
337
+
338
+ return $this->updatePlugins;
339
+ }
340
+
341
+ /**
342
+ * Whether or not a plugin has an update available.
343
+ *
344
+ * @since 2.9.0
345
+ *
346
+ * @return bool
347
+ */
348
+ public function hasUpdate() {
349
+ $updates = $this->getUpdatePlugins();
350
+
351
+ return ! empty( $updates->response[ $this->file ] );
352
+ }
353
+
354
+ /**
355
+ * Whether or not this plugin is active.
356
+ *
357
+ * @since 2.9.0
358
+ *
359
+ * @return bool
360
+ */
361
+ public function isActive() {
362
+ return is_plugin_active( $this->file );
363
+ }
364
  }
vendor/boldgrid/library/src/Library/Plugin/Plugins.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library Plugin Plugins.
4
+ *
5
+ * @package Boldgrid\Plugin
6
+ *
7
+ * @since 2.10.0
8
+ * @author BoldGrid <wpb@boldgrid.com>
9
+ */
10
+
11
+ namespace Boldgrid\Library\Library\Plugin;
12
+
13
+ use Boldgrid\Library\Library\Configs;
14
+
15
+ /**
16
+ * Generic plugins class.
17
+ *
18
+ * Unlike the Plugin class, Plugins is a generic class for "plugins" related methods.
19
+ *
20
+ * @since 2.10.0
21
+ */
22
+ class Plugins {
23
+ /**
24
+ * Get our active plugins.
25
+ *
26
+ * @since 2.10.0
27
+ *
28
+ * @return array
29
+ */
30
+ public static function getActive() {
31
+ // Get an array of plugins that should be within the widget.
32
+ $plugins = Configs::getPlugins( array(
33
+ 'inNotificationsWidget' => true,
34
+ ) );
35
+
36
+ // Then filter that array of plugins to get our active plugins.
37
+ $activePlugins = array();
38
+ foreach( $plugins as $plugin ) {
39
+ if ( $plugin->isActive() ) {
40
+ $activePlugins[] = $plugin;
41
+ }
42
+ }
43
+ unset( $plugins );
44
+
45
+ return $activePlugins;
46
+ }
47
+ }
vendor/boldgrid/library/src/Library/Rss.php DELETED
@@ -1,137 +0,0 @@
1
- <?php
2
- /**
3
- * BoldGrid Library RSS Class
4
- *
5
- * @package Boldgrid\Library
6
- * @subpackage \Library
7
- *
8
- * @version 2.9.0
9
- * @author BoldGrid <support@boldgrid.com>
10
- */
11
-
12
- namespace Boldgrid\Library\Library;
13
-
14
- /**
15
- * BoldGrid Library RSS Class.
16
- *
17
- * This class is responsible for rendering the BOldGrid RSS feed on the WordPress Dashboard.
18
- *
19
- * @since 2.9.0
20
- */
21
- class Rss {
22
- /**
23
- * Initialize class and set class properties.
24
- *
25
- * @since 2.9.0
26
- */
27
- public function __construct() {
28
- Filter::add( $this );
29
- }
30
-
31
- /**
32
- * Add the widget to the WordPress dashboard.
33
- *
34
- * @since 2.0.0
35
- *
36
- * @hook: wp_dashboard_setup
37
- */
38
- public function add_dashboard_widget() {
39
- wp_add_dashboard_widget(
40
- 'render_widget',
41
- esc_html__( 'BoldGrid News', 'boldgrid-library' ),
42
- [
43
- $this,
44
- 'render_widget',
45
- ]
46
- );
47
- }
48
-
49
- /**
50
- * Render the RSS feed widget.
51
- *
52
- * @since 1.11.0
53
- */
54
- public function render_widget() {
55
- // Build the URL address. Include some info to get custom BoldGrid news.
56
- $url = Configs::get('rssUrl') . '?key=' . Configs::get('key');
57
- $plugins = [];
58
- $bgPlugins = array_merge(
59
- array_keys(Configs::get('pluginInstaller')['plugins']),
60
- array_keys(Configs::get('pluginInstaller')['wporgPlugins'])
61
- );
62
-
63
- // Get data for only BoldGrid plugins.
64
- foreach ( get_plugins() as $slug => $info ) {
65
- if ( preg_grep('~' . strtok($slug, '/') . '~', $bgPlugins) ) {
66
- $plugins[] = [
67
- 'slug' => $slug,
68
- 'version' => $info['Version'],
69
- 'active' => is_plugin_active( $slug ),
70
- ];
71
- }
72
- }
73
-
74
- $url .= '&data=' . rawurlencode( gzdeflate( wp_json_encode(
75
- [
76
- 'locale' => get_locale(),
77
- 'plugins' => $plugins,
78
- ]
79
- ) ) );
80
-
81
- // Get a SimplePie feed object from the specified feed source.
82
- $rss = fetch_feed( $url );
83
- $maxItems = 0;
84
-
85
- if ( ! is_wp_error( $rss ) ) {
86
- // Figure out how many total items there are, but limit it to 5.
87
- $maxItems = $rss->get_item_quantity( 3 );
88
-
89
- // Build an array of all the items, starting with element 0 (first element).
90
- $rssItems = $rss->get_items( 0, $maxItems );
91
- }
92
- ?>
93
- <ul>
94
- <?php
95
- if ( ! $maxItems ) {
96
- ?>
97
- <li><?php esc_html_e( 'There are no updates to show right now.', 'boldgrid-library' ); ?></li>
98
- <?php
99
- } else {
100
- $dateFormat = get_option( 'date_format' );
101
- $timeFormat = get_option( 'time_format' );
102
-
103
- foreach ( $rssItems as $item ) {
104
- ?>
105
- <div id="boldgrid_rss_widget"><li>
106
- <?php
107
- wp_kses(
108
- // Translators: 1: Anchored URL address, 2: Hover text, 3: Itmm title.
109
- printf(
110
- '<span class="rss-title">
111
- <a class="rsswidget" target="_blank" href="%1$s" target="_blank">%2$s</a>
112
- </span>
113
- <span class="rss-date">%3$s</span>
114
- <div class="rssSummary">%4$s</div>',
115
- esc_url( $item->get_permalink() ),
116
- esc_html( $item->get_title() ),
117
- esc_attr( $item->get_date( 'l, ' . $dateFormat . ' ' . $timeFormat ) ),
118
- esc_html( wp_html_excerpt( $item->get_content(), 250 ) . ' ...' )
119
- ),
120
- [
121
- 'a' => [
122
- 'href' => [],
123
- 'target' => [],
124
- 'title' => [],
125
- ],
126
- ]
127
- );
128
- ?>
129
- </li></div>
130
- <?php
131
- }
132
- }
133
- ?>
134
- </ul>
135
- <?php
136
- }
137
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/boldgrid/library/src/Library/Start.php CHANGED
@@ -121,6 +121,16 @@ class Start {
121
  // PostNewKey class runs Filter::add($this) in __construct.
122
  $postNewKey = new \Boldgrid\Library\Library\Key\PostNewKey();
123
 
 
 
 
 
 
 
 
 
 
 
124
  $pluginChecker = new \Boldgrid\Library\Library\Plugin\Checker();
125
  $pluginChecker->run();
126
 
@@ -129,9 +139,6 @@ class Start {
129
  Configs::setItem( 'page-connect', new Page\Connect() );
130
  Configs::setItem( 'assets', new Asset() );
131
  new Editor();
132
-
133
- // Instantiate the BoldGrid RSS feed widget for the WordPress Dashboard.
134
- new Rss();
135
  }
136
 
137
  /**
121
  // PostNewKey class runs Filter::add($this) in __construct.
122
  $postNewKey = new \Boldgrid\Library\Library\Key\PostNewKey();
123
 
124
+ // Dashboard's init method instantiates classes, which run Filter::add($this) in __construct.
125
+ $dashboard = new \Boldgrid\Library\Library\Dashboard();
126
+ $dashboard->init();
127
+
128
+ // WidgetNotifications class runs Filter::add($this) in __construct.
129
+ $dashboardWidget = new \Boldgrid\Library\Library\Notifications\DashboardWidget();
130
+
131
+ // NewsWidget class runs Filter::add($this) in __construct.
132
+ $newsWidget = new \Boldgrid\Library\Library\NewsWidget();
133
+
134
  $pluginChecker = new \Boldgrid\Library\Library\Plugin\Checker();
135
  $pluginChecker->run();
136
 
139
  Configs::setItem( 'page-connect', new Page\Connect() );
140
  Configs::setItem( 'assets', new Asset() );
141
  new Editor();
 
 
 
142
  }
143
 
144
  /**
vendor/boldgrid/library/src/Library/Ui/Card.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library Ui Card.
4
+ *
5
+ * @package Boldgrid\Library
6
+ *
7
+ * @version 2.10.0
8
+ * @author BoldGrid <wpb@boldgrid.com>
9
+ */
10
+
11
+ namespace Boldgrid\Library\Library\Ui;
12
+
13
+ /**
14
+ * BoldGrid Library Util Card Class.
15
+ *
16
+ * @since 2.10.0
17
+ */
18
+ class Card {
19
+ /**
20
+ * Footer.
21
+ *
22
+ * Generally where the content is going.
23
+ *
24
+ * @since 2.10.0
25
+ * @var string
26
+ */
27
+ public $footer;
28
+
29
+ /**
30
+ * Icon.
31
+ *
32
+ * Generally markup for a span, a dashicon.
33
+ *
34
+ * @since 2.10.0
35
+ * @var string
36
+ */
37
+ public $icon;
38
+
39
+ /**
40
+ * Features.
41
+ *
42
+ * An array of features.
43
+ *
44
+ * @since 2.10.0
45
+ * @var array
46
+ */
47
+ public $features;
48
+
49
+ /**
50
+ * Id.
51
+ *
52
+ * @since 2.10.0
53
+ * @var string
54
+ */
55
+ public $id;
56
+
57
+ /**
58
+ * Sub title.
59
+ *
60
+ * @since 2.10.0
61
+ * @var string
62
+ */
63
+ public $subTitle;
64
+
65
+ /**
66
+ * Title.
67
+ *
68
+ * @since 2.10.0
69
+ * @var string
70
+ */
71
+ public $title;
72
+
73
+ /**
74
+ * Print the card.
75
+ *
76
+ * @since 2.10.0
77
+ *
78
+ * @param bool $echo True to print the card, false to return the markup.
79
+ * @return mixed.
80
+ */
81
+ public function printCard( $echo = true ) {
82
+ // Before printing, initialize all of the features.
83
+ foreach ( $this->features as $feature ) {
84
+ $feature->init();
85
+ $this->footer .= $feature->printFeature( false );
86
+ }
87
+
88
+ // Create the opening tag.
89
+ $markup = '<div class="bglib-card" ';
90
+ if ( ! empty( $this->id ) ) {
91
+ $markup .= 'id="' . esc_attr( $this->id ) . '" ';
92
+ }
93
+ $markup .= '>';
94
+
95
+ if ( ! empty( $this->title ) ) {
96
+ $markup .= '<div class="bglib-card-title">';
97
+
98
+ $markup .= '<p>' . $this->title . '</p>';
99
+
100
+ if ( ! empty( $this->subTitle ) ) {
101
+ $markup .= '<div class="bglib-card-subtitle">' . esc_html( $this->subTitle ) . '</div>';
102
+ }
103
+
104
+ $markup .= '</div>';
105
+ }
106
+
107
+ if ( ! empty( $this->icon ) ) {
108
+ $markup .= '<div class="bglib-card-icon">' . $this->icon . '</div>';
109
+ }
110
+
111
+
112
+ if ( ! empty( $this->footer ) ) {
113
+ $markup .= '<div class="bglib-card-footer">' . $this->footer . '</div>';
114
+ }
115
+
116
+ $markup .= '</div>';
117
+
118
+ if ( $echo ) {
119
+ echo $markup;
120
+ } else {
121
+ return $markup;
122
+ }
123
+ }
124
+ }
vendor/boldgrid/library/src/Library/Ui/Dashboard.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library Ui Dashboard.
4
+ *
5
+ * @package Boldgrid\Library
6
+ *
7
+ * @version 2.10.0
8
+ * @author BoldGrid <wpb@boldgrid.com>
9
+ */
10
+
11
+ namespace Boldgrid\Library\Library\Ui;
12
+
13
+ use Boldgrid\Library\Library\Configs;
14
+
15
+ /**
16
+ * BoldGrid Library Dashboard Class.
17
+ *
18
+ * @since 2.10.0
19
+ */
20
+ class Dashboard {
21
+ /**
22
+ * Cards.
23
+ *
24
+ * @since 2.10.0
25
+ * @var array
26
+ */
27
+ public $cards = [];
28
+
29
+ /**
30
+ * Enqueue scripts.
31
+ *
32
+ * @since 2.10.0
33
+ */
34
+ public static function enqueueScripts() {
35
+ wp_enqueue_style( 'bglib-dashboard',
36
+ Configs::get( 'libraryUrl' ) . 'src/assets/css/dashboard.css'
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Print Cards.
42
+ *
43
+ * @since 2.10.0
44
+ */
45
+ public function printCards() {
46
+ echo '<div class="bglib-card-container">';
47
+
48
+ foreach ( $this->cards as $card ) {
49
+ $card->init();
50
+ $card->printCard();
51
+ }
52
+
53
+ echo '</div>';
54
+ }
55
+ }
vendor/boldgrid/library/src/Library/Ui/Feature.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * BoldGrid Library Ui Feature.
4
+ *
5
+ * @package Boldgrid\Library
6
+ *
7
+ * @version 2.10.0
8
+ * @author BoldGrid <wpb@boldgrid.com>
9
+ */
10
+
11
+ namespace Boldgrid\Library\Library\Ui;
12
+
13
+ /**
14
+ * BoldGrid Library Util Feature Class.
15
+ *
16
+ * @since 2.10.0
17
+ */
18
+ class Feature {
19
+ /**
20
+ * Feature icon.
21
+ *
22
+ * Generally, markup for a span, such as a dashicon.
23
+ *
24
+ * @since 2.10.0
25
+ * @var string
26
+ */
27
+ public $icon;
28
+
29
+ /**
30
+ * Feature title.
31
+ *
32
+ * @since 2.10.0
33
+ * @var string
34
+ */
35
+ public $title;
36
+
37
+ /**
38
+ * Feature content.
39
+ *
40
+ * @since 2.10.0
41
+ * @var string
42
+ */
43
+ public $content;
44
+
45
+ /**
46
+ * Init.
47
+ *
48
+ * Classes extended this class are expected to write their own init.
49
+ *
50
+ * @since 2.10.0
51
+ */
52
+ public function init() {
53
+ }
54
+
55
+ /**
56
+ * Print this feature.
57
+ *
58
+ * @since 2.10.0
59
+ *
60
+ * @param bool $echo Whether to echo the feature now, or return the markup.
61
+ * @retrun mixed
62
+ */
63
+ public function printFeature( $echo = true ) {
64
+ $markup = '<div class="bglib-feature">
65
+ <div class="bglib-feature-icon">
66
+ ' . $this->icon . '
67
+ </div>
68
+ <div class="bglib-feature-right">
69
+ <div class="bglib-feature-title">' . esc_html( $this->title ) . '</div>
70
+ <div class="bglib-feature-content">' . $this->content . '</div>
71
+ </div>
72
+ </div>';
73
+
74
+ if ( $echo ) {
75
+ echo $markup;
76
+ }
77
+
78
+ return $echo ? true : $markup;
79
+ }
80
+ }
vendor/boldgrid/library/src/assets/css/admin.css CHANGED
@@ -157,6 +157,16 @@ div .dashicons {
157
  }
158
 
159
 
 
 
 
 
 
 
 
 
 
 
160
  /*
161
  * #.# BoldGrid Orange
162
  *
157
  }
158
 
159
 
160
+ /*
161
+ * #.# Misc.
162
+ */
163
+
164
+ .boldgrid-font {
165
+ font-family: 'Josefin Sans';
166
+ letter-spacing: 0.1em;
167
+ }
168
+
169
+
170
  /*
171
  * #.# BoldGrid Orange
172
  *
vendor/boldgrid/library/src/assets/css/dashboard.css ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 1 Card Container.
3
+ */
4
+
5
+ .bglib-card-container {
6
+ display: grid;
7
+ grid-gap: 2em;
8
+ grid-template-columns: 1fr 1fr 1fr;
9
+ margin: 2em 0;
10
+ }
11
+
12
+
13
+ /**
14
+ * 1.1 Card Container media queries.
15
+ */
16
+
17
+ /* Left nav hides, admin bar gets big. */
18
+ @media screen and (max-width: 782px) {
19
+ .bglib-card-container {
20
+ grid-template-columns: 1fr;
21
+ }
22
+ }
23
+
24
+ @media screen and (min-width: 700px) and (max-width: 1199px) {
25
+ .bglib-card-container {
26
+ grid-template-columns: 1fr 1fr;
27
+ }
28
+ }
29
+
30
+
31
+ /**
32
+ * 2 Cards.
33
+ */
34
+ .bglib-card {
35
+ border: 1px solid #ddd;
36
+ background: #fff;
37
+ height: fit-content;
38
+ }
39
+
40
+ .bglib-card-title,
41
+ .bglib-card-footer {
42
+ padding: 10px 10px 15px 10px;
43
+ }
44
+
45
+ .bglib-card-title > p:first-child {
46
+ font-size: 1.3em;
47
+ margin: 0;
48
+ }
49
+
50
+ .bglib-card-subtitle {
51
+ font-size: .95em;
52
+ }
53
+
54
+ .bglib-card-icon {
55
+ padding: 20px 0;
56
+ text-align: center;
57
+ border-top: 3px solid #000;
58
+ border-bottom: 1px solid #ddd;
59
+ }
60
+
61
+ .bglib-card-icon .dashicons {
62
+ font-size: 60px;
63
+ width: 60px;
64
+ height: 60px;
65
+ }
66
+
67
+
68
+ /**
69
+ * 2.1 Cards within postbox.
70
+ *
71
+ * When cards are within a postbox, such as within a widget on the WordPress dashboard, adjust the style.
72
+ */
73
+
74
+ .postbox-container .bglib-card {
75
+ border: 0;
76
+ }
77
+
78
+ .postbox-container .bglib-card-footer {
79
+ padding: 0;
80
+ }
81
+
82
+
83
+ /**
84
+ * 3 Features
85
+ */
86
+ .bglib-card .bglib-feature {
87
+ display: grid;
88
+ grid-gap: 10px;
89
+ grid-template-columns: 40px 1fr;
90
+ }
91
+
92
+ .bglib-card-footer > .bglib-feature:not(:first-of-type) > div {
93
+ margin-top: 15px;
94
+ padding-top: 15px;
95
+ border-top: 1px solid #ddd;
96
+ }
97
+ .bglib-card-footer > .bglib-feature:not(:first-of-type) .bglib-feature-icon {
98
+ border-top-color: #fff;
99
+ }
100
+
101
+ .bglib-card .bglib-feature .dashicons,
102
+ .bglib-card .bglib-feature .boldgrid-icon:before {
103
+ font-size: 35px;
104
+ width: 35px;
105
+ height: 35px;
106
+ color: #aaa;
107
+ }
108
+
109
+ .bglib-card .bglib-feature img {
110
+ width: 35px;
111
+ }
112
+
113
+ .bglib-card .bglib-feature .bglib-feature-title {
114
+ font-size: 1.1em;
115
+ font-weight: 600;
116
+ }
117
+
118
+ .bglib-feature-content > p:first-of-type {
119
+ margin-top: .1em;
120
+ }
121
+
122
+ .bglib-feature-content > *:last-child {
123
+ margin-bottom: 0;
124
+ padding-bottom: 0;
125
+ }
126
+
127
+ .bglib-feature-content .notice {
128
+ background-color: #f8f8ff;
129
+ }
130
+
131
+ .bglib-feature-content .notice p {
132
+ margin: 0;
133
+ }
134
+
135
+ .bglib-feature-value {
136
+ padding-left: 15px;
137
+ color: #aaa;
138
+ }
vendor/boldgrid/library/src/assets/css/news-widget.css ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #boldgrid_news_widget li {
2
+ width: calc( 50% - 6px );
3
+ }
4
+
5
+ #boldgrid_news_widget li:nth-child(odd) {
6
+ float: left;
7
+ }
8
+
9
+ #boldgrid_news_widget li:nth-child(even) {
10
+ float: right;
11
+ }
12
+
13
+ #boldgrid_news_widget .bglib-featured {
14
+ width: 100%;
15
+ }
16
+
17
+ #boldgrid_news_widget .bglib-date {
18
+ color: #72777c;
19
+ font-size: .82em;
20
+ margin-top: 2px;
21
+ margin-bottom: 2px;
22
+ }
23
+
24
+ #boldgrid_news_widget .bglib-title {
25
+ /* Same font weight as "WordPress Events and News" titles. */
26
+ font-weight: 600;
27
+ margin-top: 0px;
28
+ }
vendor/boldgrid/library/src/assets/css/ui.css CHANGED
@@ -134,4 +134,4 @@
134
  #col-left {
135
  margin-bottom: 20px;
136
  }
137
- }
134
  #col-left {
135
  margin-bottom: 20px;
136
  }
137
+ }
vendor/boldgrid/library/src/library.global.php CHANGED
@@ -15,6 +15,9 @@ return array(
15
  // When the user needs a Connect Key, the "Get it now" button links here (filters get applied).
16
  'getNewKey' => 'https://www.boldgrid.com/central/account/new-key',
17
 
 
 
 
18
  // Enable key validation in library.
19
  'keyValidate' => true,
20
 
@@ -37,11 +40,6 @@ return array(
37
  'file' => 'boldgrid-inspirations/boldgrid-inspirations.php',
38
  'priority' => 20,
39
  ),
40
- 'boldgrid-staging' => array(
41
- 'key' => 'staging',
42
- 'file' => 'boldgrid-staging/boldgrid-staging.php',
43
- 'priority' => 60,
44
- ),
45
  'boldgrid-gallery' => array(
46
  'key' => 'gallery-wc-canvas',
47
  'file' => 'boldgrid-gallery/wc-gallery.php',
@@ -76,11 +74,69 @@ return array(
76
  'link' => '//wpforms.com/lite-upgrade/',
77
  'priority' => 80,
78
  ),
 
 
 
 
 
79
  ),
80
  ),
81
  'api_calls' => array(
82
  'get_theme_data' => '/api/open/get-theme-data',
83
  'get_asset' => '/api/open/get-asset',
84
  ),
85
- 'rssUrl' => 'https://www.boldgrid.com/tag/dashboard/feed/',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  );
15
  // When the user needs a Connect Key, the "Get it now" button links here (filters get applied).
16
  'getNewKey' => 'https://www.boldgrid.com/central/account/new-key',
17
 
18
+ // Click here for the benefits of a Premium Key.
19
+ 'learnMore' => 'https://www.boldgrid.com/connect-keys?source=library-prompt',
20
+
21
  // Enable key validation in library.
22
  'keyValidate' => true,
23
 
40
  'file' => 'boldgrid-inspirations/boldgrid-inspirations.php',
41
  'priority' => 20,
42
  ),
 
 
 
 
 
43
  'boldgrid-gallery' => array(
44
  'key' => 'gallery-wc-canvas',
45
  'file' => 'boldgrid-gallery/wc-gallery.php',
74
  'link' => '//wpforms.com/lite-upgrade/',
75
  'priority' => 80,
76
  ),
77
+ 'w3-total-cache' => array(
78
+ 'slug' => 'w3-total-cache',
79
+ 'link' => '//wordpress.org/plugins/w3-total-cache/',
80
+ 'priority' => 80,
81
+ ),
82
  ),
83
  ),
84
  'api_calls' => array(
85
  'get_theme_data' => '/api/open/get-theme-data',
86
  'get_asset' => '/api/open/get-asset',
87
  ),
88
+
89
+ /*
90
+ * A list of BoldGrid (and related) plugins.
91
+ *
92
+ * @since 2.10.0
93
+ *
94
+ * @todo Above, there are 2 additional arrays of plugins. They should all be combined into 1 and
95
+ * use attributes to indicated which group they belong to, such as:
96
+ * # inNotificationsWidget
97
+ * # isInstallable
98
+ * # isWpOrg
99
+ * We can then use Boldgrid\Library\Library\Configs( $filters ) to get our plugins, such as:
100
+ * Configs::getPlugins( array( 'inNotificationsWidget' => true ) )
101
+ */
102
+ 'plugins' => array(
103
+ array(
104
+ 'file' => 'boldgrid-inspirations/boldgrid-inspirations.php',
105
+ 'inNotificationsWidget' => true,
106
+ ),
107
+ array(
108
+ 'file' => 'boldgrid-backup/boldgrid-backup.php',
109
+ 'inNotificationsWidget' => true,
110
+ 'childPlugins' => [
111
+ 'boldgrid-backup-premium/boldgrid-backup-premium.php',
112
+ ],
113
+ ),
114
+ array(
115
+ 'file' => 'boldgrid-easy-seo/boldgrid-easy-seo.php',
116
+ 'inNotificationsWidget' => true,
117
+ ),
118
+ array(
119
+ 'file' => 'post-and-page-builder/post-and-page-builder.php',
120
+ 'inNotificationsWidget' => true,
121
+ 'childPlugins' => [
122
+ 'post-and-page-builder-premium/post-and-page-builder-premium.php',
123
+ ]
124
+ ),
125
+ ),
126
+
127
+ // An array of dashboard widgets that are placed at the top of the dashboard.
128
+ 'dashboardWidgetOrder' => array(
129
+ 'boldgrid-notifications' => array(
130
+ 'container' => 'normal',
131
+ 'priority' => 'core',
132
+ ),
133
+ 'boldgrid_feedback_widget' => array(
134
+ 'container' => 'side',
135
+ 'priority' => 'core',
136
+ ),
137
+ 'boldgrid_news_widget' => array(
138
+ 'container' => 'side',
139
+ 'priority' => 'core',
140
+ ),
141
+ ),
142
  );
vendor/boldgrid/library/tests/bootstrap.php CHANGED
@@ -18,6 +18,7 @@ require_once dirname( dirname( __FILE__ ) ) . '/src/Library/Plugin/Plugin.php';
18
  require_once dirname( dirname( __FILE__ ) ) . '/src/Library/RatingPrompt.php';
19
  require_once dirname( dirname( __FILE__ ) ) . '/src/Library/Activity.php';
20
  require_once dirname( dirname( __FILE__ ) ) . '/src/Util/Option.php';
 
21
 
22
  require $_tests_dir . '/includes/bootstrap.php';
23
 
18
  require_once dirname( dirname( __FILE__ ) ) . '/src/Library/RatingPrompt.php';
19
  require_once dirname( dirname( __FILE__ ) ) . '/src/Library/Activity.php';
20
  require_once dirname( dirname( __FILE__ ) ) . '/src/Util/Option.php';
21
+ require_once dirname( dirname( __FILE__ ) ) . '/src/Util/Version.php';
22
 
23
  require $_tests_dir . '/includes/bootstrap.php';
24
 
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitb48b9314034d9e74a66cd45ea4bb6286
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitb48b9314034d9e74a66cd45ea4bb6286
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitb48b9314034d9e74a66cd45ea4bb6286', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitb48b9314034d9e74a66cd45ea4bb6286', '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\ComposerStaticInitb48b9314034d9e74a66cd45ea4bb6286::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit54b1a8ac4b72f1d0df93795d5673078d
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit54b1a8ac4b72f1d0df93795d5673078d', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit54b1a8ac4b72f1d0df93795d5673078d', '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\ComposerStaticInit54b1a8ac4b72f1d0df93795d5673078d::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitb48b9314034d9e74a66cd45ea4bb6286
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
@@ -23,8 +23,8 @@ class ComposerStaticInitb48b9314034d9e74a66cd45ea4bb6286
23
  public static function getInitializer(ClassLoader $loader)
24
  {
25
  return \Closure::bind(function () use ($loader) {
26
- $loader->prefixLengthsPsr4 = ComposerStaticInitb48b9314034d9e74a66cd45ea4bb6286::$prefixLengthsPsr4;
27
- $loader->prefixDirsPsr4 = ComposerStaticInitb48b9314034d9e74a66cd45ea4bb6286::$prefixDirsPsr4;
28
 
29
  }, null, ClassLoader::class);
30
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit54b1a8ac4b72f1d0df93795d5673078d
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
23
  public static function getInitializer(ClassLoader $loader)
24
  {
25
  return \Closure::bind(function () use ($loader) {
26
+ $loader->prefixLengthsPsr4 = ComposerStaticInit54b1a8ac4b72f1d0df93795d5673078d::$prefixLengthsPsr4;
27
+ $loader->prefixDirsPsr4 = ComposerStaticInit54b1a8ac4b72f1d0df93795d5673078d::$prefixDirsPsr4;
28
 
29
  }, null, ClassLoader::class);
30
  }
vendor/composer/installed.json CHANGED
@@ -1,20 +1,20 @@
1
  [
2
  {
3
  "name": "boldgrid/library",
4
- "version": "2.9.2",
5
- "version_normalized": "2.9.2.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/BoldGrid/library.git",
9
- "reference": "1f703de85afb9e218af0781c5973510894325631"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/BoldGrid/library/zipball/1f703de85afb9e218af0781c5973510894325631",
14
- "reference": "1f703de85afb9e218af0781c5973510894325631",
15
  "shasum": ""
16
  },
17
- "time": "2019-08-01T18:27:41+00:00",
18
  "type": "library",
19
  "installation-source": "dist",
20
  "autoload": {
@@ -29,20 +29,20 @@
29
  "authors": [
30
  {
31
  "name": "Tim Elsass",
32
- "role": "Developer",
33
  "email": "dev@tim.ph",
34
- "homepage": "http://tim.ph"
 
35
  },
36
  {
37
  "name": "Rafael Ramos",
38
- "role": "Developer",
39
- "homepage": "http://rafael-ramos.com"
40
  },
41
  {
42
  "name": "Joe Cartonia",
43
- "role": "Developer",
44
  "email": "joec@boldgrid.com",
45
- "homepage": "https://twitter.com/joemotocss"
 
46
  },
47
  {
48
  "name": "bwmarkle",
1
  [
2
  {
3
  "name": "boldgrid/library",
4
+ "version": "2.10.1",
5
+ "version_normalized": "2.10.1.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/BoldGrid/library.git",
9
+ "reference": "0a21e6dfa33e15ae1c6fda29360486170e807dac"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/BoldGrid/library/zipball/0a21e6dfa33e15ae1c6fda29360486170e807dac",
14
+ "reference": "0a21e6dfa33e15ae1c6fda29360486170e807dac",
15
  "shasum": ""
16
  },
17
+ "time": "2019-09-05T14:44:58+00:00",
18
  "type": "library",
19
  "installation-source": "dist",
20
  "autoload": {
29
  "authors": [
30
  {
31
  "name": "Tim Elsass",
 
32
  "email": "dev@tim.ph",
33
+ "homepage": "http://tim.ph",
34
+ "role": "Developer"
35
  },
36
  {
37
  "name": "Rafael Ramos",
38
+ "homepage": "http://rafael-ramos.com",
39
+ "role": "Developer"
40
  },
41
  {
42
  "name": "Joe Cartonia",
 
43
  "email": "joec@boldgrid.com",
44
+ "homepage": "https://twitter.com/joemotocss",
45
+ "role": "Developer"
46
  },
47
  {
48
  "name": "bwmarkle",