PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 1.2.2
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v1.2.2
4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 2.6.1 All 38 releases
blockspare / src / admin / index.php

index.php in BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites 1.2.2, at src/admin/index.php

278 lines 14.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Welcome screen.
4 */
5
6 // Exit if accessed directly.
7 if (!defined('ABSPATH')) {
8 exit;
9 }
10
11 if (!class_exists('Blockspare_Admin_Dashboard')) {
12 class Blockspare_Admin_Dashboard
13 {
14 function __construct()
15 {
16 add_action('admin_menu', array($this, 'add_dashboard_page'));
17
18 add_action('admin_enqueue_scripts', array($this, 'enqueue_dashboard_script'));
19
20 add_action('admin_init', array($this, 'redirect_to_blockspare_page'));
21 }
22
23 public function add_dashboard_page()
24 {
25
26 // @see images/blockspare-icon.svg
27 $svg = <<< SVG
28 <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
29 viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve">
30 <g>
31 <g>
32 <path class="st0" d="M1.6,9.2v21.4l18.3-9.2L20.2,0L1.6,9.2z M16.9,19.8L4.9,26V10.9l12-6.1V19.8z"/>
33 <polygon id="XMLID_3_" class="st1" points="19.9,21.4 16.9,23 26,27.7 13.8,33.8 4.9,29 1.6,30.7 13.9,36.9 32.4,27.7 "/>
34 </g>
35 <g>
36 <polygon id="XMLID_2_" class="st0" points="23,1.5 23,19.8 32.4,24.6 32.4,9.4 35.3,10.9 35.3,29 38.4,30.7 38.4,9.2 29.4,4.8
37 29.2,19.7 26,18.4 26,3.1 "/>
38 <polygon id="XMLID_1_" class="st1" points="17,38.4 19.9,40 38.4,30.7 35.3,29 "/>
39 </g>
40 </g>
41 </svg>
42 SVG;
43
44 add_menu_page(
45 __('Blockspare', 'blockspare'), // Page Title.
46 __('Blockspare', 'blockspare'), // Menu Title.
47 'edit_posts', // Capability.
48 'blockspare', // Menu slug.
49 array($this, 'blockspare_admin_dashboard'), // Action.
50 'data:image/svg+xml;base64,' . base64_encode($svg) // Blockspare icon.
51 );
52
53 // Our getting started page.
54 add_submenu_page(
55 'blockspare', // Parent slug.
56 __( 'Getting Started', 'blockspare' ), // Page title.
57 __( 'Getting Started', 'blockspare' ), // Menu title.
58 'manage_options', // Capability.
59 'blockspare', // Menu slug.
60 array( $this, 'blockspare_admin_dashboard' ), // Callback function.
61 1 // Position
62 );
63 }
64
65 public function enqueue_dashboard_script($hook)
66 {
67 }
68
69 public function blockspare_admin_dashboard()
70 {
71 ?>
72 <div class="wrap blockspare-wrap">
73 <header class="blockspare-header">
74 <img src="<?php echo esc_url(plugins_url('assets/blockspare-logo.png', __FILE__)) ?>"
75 alt="<?php esc_attr_e('Blockspare', 'blockspare') ?>" />
76 <h1>
77 <?php _e('Blockspare', 'blockspare') ?>
78 </h1>
79 <h2><?php _e('Beautiful Page Building Blocks for WordPress', 'blockspare') ?></h2>
80
81 <div class="blockspare-separator">
82 <svg class="blockspare-separator-double-wave" preserveAspectRatio="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1946 175">
83 <path class="st0" d="M-.5 27.7v146.8h1946V10.7s-170.6 20.4-265 57.2c0 0-374.1 116.7-794.2 24.7 0 0-414.1-100.9-673.1-92-.1 0-102.9 5.2-213.7 27.1z"></path>
84 <path class="st1" d="M1945.5 69.9s-425.5-100-888 20.5c0 0-342.6 63.3-611.4 43.8 0 0-224.9-40.3-446.6-84.4V174h1946V69.9z"></path>
85 <path d="M-.5 88s425.5-100 888 20.5c0 0 342.6 63.3 611.4 43.8 0 0 224.9-20.2 446.6-64.3v87H-.5V88z"></path>
86 </svg>
87 </div>
88 </header>
89 <section class="blockspare-main-container">
90 <article class="blockspare-intro blockspare-section">
91
92 <div class="blockspare-intro-col blockspare-intro-desc">
93 <div class="blockspare-common-header-wrapper">
94 <span class="blockspare-subtitle"><?php _e('Amazing Blocks', 'blockspare') ?></span>
95 <h2><?php _e('Envision Amazing Layouts with Blockspare', 'blockspare') ?></h2>
96 </div>
97
98 <p><?php _e('Now you have Blockspare for your WordPress editor', 'blockspare') ?></p>
99 <ol>
100 <li>
101 <?php _e('Create a new page', 'blockspare') ?>
102 </li>
103 <li>
104 <?php _e('Click on the <span class="plus-btn-svg"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="#222"><path d="M10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6z"></path></svg></span> button to add a block', 'blockspare') ?>
105 </li>
106 <li>
107 <?php _e('Expand Blockspare panel!', 'blockspare') ?>
108 </li>
109 <li>
110 <?php _e('Select to add and customize a block!', 'blockspare') ?>
111 </li>
112 </ol>
113
114 <a href="<?php echo esc_url(admin_url('post-new.php?post_type=page&blockspare_show_intro=true')) ?>"
115 class="blockspare-button"
116 title="<?php esc_attr_e('Try it on New Page', 'blockspare') ?>"><?php _e('Try it on New Page', 'blockspare') ?></a>
117 </p>
118 </div>
119 <div class="blockspare-intro-col blockspare-intro-img">
120 <p><img src="<?php echo esc_url(plugins_url('assets/blockspare-adding-blocks.gif', __FILE__)) ?>"
121 alt="<?php esc_attr_e('Adding Blockspare', 'blockspare') ?>" class="blockspare-gif"/></p>
122 <p>
123 </div>
124 </article>
125 </section>
126 <section class="blockspare-body-container">
127 <div class="blockspare-body">
128
129 <article class="blockspare-section blockspare-block-intro">
130
131 <div class="blockspare-common-header-wrapper">
132 <span class="blockspare-subtitle"><?php _e('Enhanced set of Blocks', 'blockspare') ?></span>
133 <h3><?php _e('Start Creating Page using Enhanced set of Blocks in Minutes!', 'blockspare') ?></h3>
134 </div>
135
136 <p><?php _e('We design an elegant series of WordPress blocks to help you create the website you always wanted with ease.', 'blockspare') ?>
137 </p>
138 <!-- We put all the block controls here. -->
139 <div class="blockspare-available-blocks-wrapper">
140 <?php
141 $blockspare_blocks = blockspare_blocks_list();
142 if (isset($blockspare_blocks) && !empty($blockspare_blocks)):
143 foreach ($blockspare_blocks as $block):
144 $blocks_name = $block['name'];
145 $icon_url = plugins_url("assets/" .$block['slug'] . "-image.png", __FILE__);
146 $demo_url = 'https://blockspare.com/block/'.$block['slug'];
147
148 ?>
149 <a class="blockspare-explore-btn" href="<?php echo esc_url($demo_url) ?>" target="_blank">
150 <div class="blockspare-available-blocks">
151
152 <img src="<?php echo esc_attr($icon_url); ?>" alt="<?php echo esc_attr($blocks_name) ?>">
153 <h4>
154 <?php echo esc_attr($blocks_name) ?>
155 </h4>
156
157
158
159 </div>
160 </a>
161 <?php
162 endforeach;
163 endif;
164
165 ?>
166 </div>
167 <div class="blocksparea-all-blocks-button"><a href="https://blockspare.com/" class="blockspare-button"
168 target="_blank"
169 title="<?php esc_attr_e('Explore All Blocks', 'blockspare') ?>"><?php _e('Explore All Blocks', 'blockspare') ?></a>
170 </div>
171 </article>
172 <aside class="blockspare-backward-compatibility-control-wrapper"></aside>
173 <?php if (BLOCKSPARE_SHOW_PRO_NOTICES): ?>
174 <aside class="blockspare-pro-control-wrapper"></aside>
175 <?php endif; ?>
176 </div>
177 <div class="blockspare-side">
178
179 <div class="blockspare-side-sticky">
180 <?php
181 $blockspare_pro = false;
182 if ($blockspare_pro == false ) : ?>
183 <aside class="blockspare-section blockspare-premium-section">
184 <h3><?php _e('Blockspare Pro', 'blockspare') ?></h3>
185 <p><?php _e('Want to use Blockspare Pro to build an awesome site with more options and controls?', 'blockspare') ?></p>
186 <ul class="blockspare-premium-features">
187 <li><?php _e('30+ Custom WordPress Blocks', 'blockspare') ?></li>
188 <li><?php _e('110+ Pre-designed Blocks Layouts', 'blockspare') ?></li>
189 <li><?php _e('Gradients Color Effects', 'blockspare') ?></li>
190 <li><?php _e('Additional Block Options', 'blockspare') ?></li>
191 <li><?php _e('Rearrangeable Inner Blocks', 'blockspare') ?></li>
192 <li><?php _e('Image Masking Colors Effects and Filters ', 'blockspare') ?></li>
193 <li><?php _e('All Premium Effects', 'blockspare') ?></li>
194 <li><?php _e('Customer Email Support', 'blockspare') ?></li>
195 <li><?php _e('Regular Updates & Premium Support', 'blockspare') ?></li>
196 </ul>
197 </p>
198 <p>
199 <a href="<?php echo esc_url(admin_url( '/admin.php?page=blockspare-pricing' )); ?>" class="blockspare-button"
200 title="<?php esc_attr_e('Get Blockspare Pro', 'blockspare') ?>"><?php esc_attr_e('Get Blockspare Pro', 'blockspare') ?></a>
201 </p>
202
203 </aside>
204 <?php endif; ?>
205
206 <aside class="blockspare-section">
207 <h3><?php _e('Knowledge Base', 'blockspare') ?></h3>
208 <ul class="blockspare-list blockspare-knowledge-base">
209 <li>
210 <h4 class="blockspare-sub-headings">
211 <a href="https://blockspare.com/docs/"><?php esc_html_e('Documentations', 'blockspare') ?> </a>
212 </h4>
213 <p><?php esc_html_e('Do you have any difficulties regarding plugin setup and uses? Please visit Documentations page.', 'blockspare') ?></p>
214 </li>
215 <li>
216 <h4 class="blockspare-sub-headings">
217 <a href="https://blockspare.com/block/"><?php esc_html_e('Demos', 'blockspare') ?> </a>
218 </h4>
219 <p><?php esc_html_e('We have also designed and displayed multiple type of layouts with Blockspare. For more details please visit our site.', 'blockspare') ?></p>
220 </li>
221 <li>
222 <h4 class="blockspare-sub-headings">
223 <a href="https://blockspare.com/support/"><?php esc_html_e('Support', 'blockspare') ?> </a>
224 </h4>
225 <p><?php esc_html_e('You directly come upon to our support guys with your valuable queries.', 'blockspare') ?></p>
226 </li>
227 <li>
228 <h4 class="blockspare-sub-headings">
229 <a href="https://wordpress.org/support/plugin/blockspare/"><?php esc_html_e('WordPress Support Forum', 'blockspare') ?> </a>
230 </h4>
231 <p><?php esc_html_e('You can also go to our .org forum for any kind of support enquiries.', 'blockspare') ?></p>
232 </li>
233 <li>
234 <h4 class="blockspare-sub-headings">
235 <a href="https://blockspare.com/blog/"><?php esc_html_e('Latest Blog', 'blockspare') ?> </a>
236 </h4>
237 <p><?php esc_html_e('Get latest articles about WordPress.', 'blockspare') ?></p>
238 </li>
239 </ul>
240
241 </p>
242 </aside>
243 </div>
244
245 </div>
246 </section>
247 </div>
248 <?php
249 }
250
251 /**
252 * Adds a marker to remember to redirect after activation.
253 * Redirecting right away will not work.
254 */
255 public static function start_redirect_to_blockspare_page()
256 {
257 update_option('blockspare_redirect_to_welcome', '1');
258 }
259
260 /**
261 * Redirect to the welcome screen if our marker exists.
262 */
263 public function redirect_to_blockspare_page()
264 {
265 if (get_option('blockspare_redirect_to_welcome')) {
266 delete_option('blockspare_redirect_to_welcome');
267 wp_redirect(esc_url(admin_url('admin.php?page=blockspare')));
268 die();
269 }
270 }
271 }
272
273 new Blockspare_Admin_Dashboard();
274 }
275
276 // Redirect to the welcome screen.
277 register_activation_hook(BLOCKSPARE_BASE_FILE, array('Blockspare_Admin_Dashboard', 'start_redirect_to_blockspare_page'));
278