PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 2.7.1
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v2.7.1
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 / admin / index.php

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

320 lines 15.0 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 add_action( 'init', array($this,'blockspare_load_api_files'));
23 }
24
25 public function add_dashboard_page()
26 {
27
28 // @see images/blockspare-icon.svg
29 $svg = <<< SVG
30 <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"
31 viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve">
32 <g>
33 <g>
34 <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"/>
35 <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 "/>
36 </g>
37 <g>
38 <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
39 29.2,19.7 26,18.4 26,3.1 "/>
40 <polygon id="XMLID_1_" class="st1" points="17,38.4 19.9,40 38.4,30.7 35.3,29 "/>
41 </g>
42 </g>
43 </svg>
44 SVG;
45
46 add_menu_page(
47 __('Blockspare', 'blockspare'), // Page Title.
48 __('Blockspare', 'blockspare'), // Menu Title.
49 'edit_posts', // Capability.
50 'blockspare', // Menu slug.
51 array($this, 'blockspare_admin_dashboard'), // Action.
52 'data:image/svg+xml;base64,' . base64_encode($svg) // Blockspare icon.
53 );
54
55 // Our getting started page.
56 add_submenu_page(
57 'blockspare', // Parent slug.
58 __( 'Getting Started', 'blockspare' ), // Page title.
59 __( 'Getting Started', 'blockspare' ), // Menu title.
60 'manage_options', // Capability.
61 'blockspare', // Menu slug.
62 array( $this, 'blockspare_admin_dashboard' ), // Callback function.
63 1 // Position
64 );
65 }
66
67
68 public function enqueue_dashboard_script($hook)
69 {
70 wp_enqueue_style('blockspare-admin', BLOCKSPARE_PLUGIN_URL .'admin/assets/css/style.css','','');
71 wp_enqueue_script( 'blockspare_dashboard_js', BLOCKSPARE_PLUGIN_URL. 'dist/block_admin_dashboard.js', array('react', 'react-dom', 'wp-element', 'wp-api-fetch', 'wp-polyfill'), '1.0' );
72 wp_enqueue_style('blockspare-admin-css',BLOCKSPARE_PLUGIN_URL.'dist/style-block_admin_dashboard.css');
73 $blockspare_dashboard_logo = BLOCKSPARE_PLUGIN_URL . 'admin/assets/images/blockspare-logo.png';
74 wp_localize_script(
75 'blockspare_dashboard_js',
76 'blockspare_dashboard',
77 array(
78
79 'logo'=>$blockspare_dashboard_logo,
80 "imagePath"=> "https://templatespare.com/wp-content/uploads/blockspare/blocks/",
81 "static_img"=>BLOCKSPARE_PLUGIN_URL,
82 'adminPath'=>admin_url('post-new.php?post_type=page&blockspare_show_intro=true')
83
84 )
85 );
86 }
87
88 public function blockspare_admin_dashboard()
89 {
90 ?>
91 <div id="bs-dashboard"></div>
92 <?php /*
93 <div class="wrap blockspare-wrap">
94
95 <header class="blockspare-header">
96 <img src="<?php echo esc_url(plugins_url('assets/blockspare-logo.png', __FILE__)) ?>"
97 alt="<?php esc_attr_e('Blockspare', 'blockspare') ?>" />
98
99 <h1><?php _e('Blockspare', 'blockspare') ?></h1>
100 <h2><?php _e('Beautiful Page Building Blocks for WordPress', 'blockspare') ?></h2>
101
102 <div class="blockspare-separator">
103 <svg class="blockspare-separator-double-wave" preserveAspectRatio="none" aria-hidden="true"
104 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1946 175">
105 <path class="st0"
106 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">
107 </path>
108 <path class="st1"
109 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">
110 </path>
111 <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">
112 </path>
113 </svg>
114 </div>
115 </header>
116 <section class="blockspare-main-container">
117 <article class="blockspare-intro blockspare-section">
118
119 <div class="blockspare-intro-col blockspare-intro-desc">
120 <div class="blockspare-common-header-wrapper">
121 <span class="blockspare-subtitle"><?php _e('Amazing Blocks', 'blockspare') ?></span>
122 <h2><?php _e('Envision Amazing Layouts with Blockspare', 'blockspare') ?></h2>
123 </div>
124
125 <p><?php _e('Now you have Blockspare for your WordPress editor', 'blockspare') ?></p>
126 <ol>
127 <li>
128 <?php _e('Create a new page', 'blockspare') ?>
129 </li>
130 <li>
131 <?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') ?>
132 </li>
133 <li>
134 <?php _e('Expand Blockspare panel!', 'blockspare') ?>
135 </li>
136 <li>
137 <?php _e('Select to add and customize a block!', 'blockspare') ?>
138 </li>
139 </ol>
140
141 <a href="<?php echo esc_url(admin_url('post-new.php?post_type=page&blockspare_show_intro=true')) ?>"
142 class="blockspare-button"
143 title="<?php esc_attr_e('Try it on New Page', 'blockspare') ?>"><?php _e('Try it on New Page', 'blockspare') ?></a>
144 </p>
145 </div>
146 <div class="blockspare-intro-col blockspare-intro-img">
147 <p><img src="<?php echo esc_url(plugins_url('assets/blockspare-adding-blocks.gif', __FILE__)) ?>"
148 alt="<?php esc_attr_e('Adding Blockspare', 'blockspare') ?>" class="blockspare-gif" /></p>
149 <p>
150 </div>
151 </article>
152 </section>
153 <section class="blockspare-body-container">
154 <div class="blockspare-body">
155
156 <article class="blockspare-section blockspare-block-intro">
157
158 <div class="blockspare-common-header-wrapper">
159 <span class="blockspare-subtitle"><?php _e('Enhanced set of Blocks', 'blockspare') ?></span>
160 <h3><?php _e('Start Creating Page using Enhanced set of Blocks in Minutes!', 'blockspare') ?></h3>
161 </div>
162
163 <p><?php _e('We design an elegant series of WordPress blocks to help you create the website you always wanted with ease.', 'blockspare') ?>
164 </p>
165 <!-- We put all the block controls here. -->
166 <div class="blockspare-available-blocks-wrapper">
167 <?php
168 $blockspare_blocks = blockspare_admin_blocks_list();
169 if (isset($blockspare_blocks) && !empty($blockspare_blocks)):
170 foreach ($blockspare_blocks as $block):
171 $blocks_name = $block['name'];
172 $icon_url = plugins_url("assets/" .$block['slug'] . "-image.png", __FILE__);
173 $demo_url = 'https://blockspare.com/block/'.$block['slug'];
174
175 ?>
176 <a class="blockspare-explore-btn" href="<?php echo esc_url($demo_url) ?>" target="_blank">
177 <div class="blockspare-available-blocks">
178
179 <img src="<?php echo esc_attr($icon_url); ?>" alt="<?php echo esc_attr($blocks_name) ?>">
180 <h4>
181 <?php echo esc_attr($blocks_name) ?>
182 </h4>
183
184
185
186 </div>
187 </a>
188 <?php
189 endforeach;
190 endif;
191
192 ?>
193 </div>
194 <div class="blocksparea-all-blocks-button"><a href="https://blockspare.com/" class="blockspare-button"
195 target="_blank"
196 title="<?php esc_attr_e('Explore All Blocks', 'blockspare') ?>"><?php _e('Explore All Blocks', 'blockspare') ?></a>
197 </div>
198 </article>
199 <aside class="blockspare-backward-compatibility-control-wrapper"></aside>
200 <?php if (BLOCKSPARE_SHOW_PRO_NOTICES): ?>
201 <aside class="blockspare-pro-control-wrapper"></aside>
202 <?php endif; ?>
203 </div>
204 <div class="blockspare-side">
205
206 <div class="blockspare-side-sticky">
207 <?php
208 $blockspare_pro = true;
209 if ($blockspare_pro == false ) : ?>
210 <aside class="blockspare-section blockspare-premium-section">
211 <h3><?php _e('Blockspare Pro', 'blockspare') ?></h3>
212 <p><?php _e('Want to use Blockspare to build an awesome site with more options and controls? Upgrade to Pro and get:', 'blockspare') ?>
213 </p>
214 <ul class="blockspare-premium-features">
215 <li><?php _e('30+ Custom WordPress Blocks', 'blockspare') ?></li>
216 <li><?php _e('110+ Pre-designed Blocks Layouts', 'blockspare') ?></li>
217 <li><?php _e('Gradient Colors Effects', 'blockspare') ?></li>
218 <li><?php _e('Additional Block Options', 'blockspare') ?></li>
219 <li><?php _e('Rearrangeable Inner Blocks', 'blockspare') ?></li>
220 <li><?php _e('Image Masking Colors Effects and Filters ', 'blockspare') ?></li>
221 <li><?php _e('All Premium Effects', 'blockspare') ?></li>
222 <li><?php _e('Customer Email Support', 'blockspare') ?></li>
223 <li><?php _e('Regular Updates & Premium Support', 'blockspare') ?></li>
224 </ul>
225 </p>
226 <p>
227 <a href="https://blockspare.com/" class="blockspare-button"
228 title="<?php esc_attr_e('Get Blockspare Pro', 'blockspare') ?>"><?php esc_attr_e('Get Blockspare Pro', 'blockspare') ?></a>
229 </p>
230
231 </aside>
232 <?php endif; ?>
233
234 <aside class="blockspare-section">
235 <h3><?php _e('Knowledge Base', 'blockspare') ?></h3>
236 <ul class="blockspare-list blockspare-knowledge-base">
237 <li>
238 <h4 class="blockspare-sub-headings">
239 <a href="https://blockspare.com/docs/"><?php esc_html_e('Documentations', 'blockspare') ?>
240 →</a>
241 </h4>
242 <p><?php esc_html_e('Do you have any difficulties regarding plugin setup and uses? Please visit Documentations page.', 'blockspare') ?>
243 </p>
244 </li>
245 <li>
246 <h4 class="blockspare-sub-headings">
247 <a href="https://blockspare.com/block/"><?php esc_html_e('Demos', 'blockspare') ?> →</a>
248 </h4>
249 <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') ?>
250 </p>
251 </li>
252 <li>
253 <h4 class="blockspare-sub-headings">
254 <a href="https://afthemes.com/supports/"><?php esc_html_e('Support', 'blockspare') ?>
255 →</a>
256 </h4>
257 <p><?php esc_html_e('You directly come upon to our support guys with your valuable queries.', 'blockspare') ?>
258 </p>
259 </li>
260 <li>
261 <h4 class="blockspare-sub-headings">
262 <a href="https://wordpress.org/plugins/blockspare/"><?php esc_html_e('WordPress Support Forum', 'blockspare') ?>
263 →</a>
264 </h4>
265 <p><?php esc_html_e('You can also go to our .org forum for any kind of support enquiries.', 'blockspare') ?>
266 </p>
267 </li>
268 <li>
269 <h4 class="blockspare-sub-headings">
270 <a href="https://blockspare.com/blog/"><?php esc_html_e('Latest Blog', 'blockspare') ?>
271 →</a>
272 </h4>
273 <p><?php esc_html_e('Get latest articles about WordPress.', 'blockspare') ?></p>
274 </li>
275 </ul>
276
277 </p>
278 </aside>
279 </div>
280
281 </div>
282 </section>
283 </div>
284 <?php */?>
285 <?php
286 }
287
288 /**
289 * Adds a marker to remember to redirect after activation.
290 * Redirecting right away will not work.
291 */
292 public static function start_redirect_to_blockspare_page()
293 {
294 update_option('blockspare_redirect_to_welcome', '1');
295 }
296
297 /**
298 * Redirect to the welcome screen if our marker exists.
299 */
300 public function redirect_to_blockspare_page()
301 {
302 if (get_option('blockspare_redirect_to_welcome')) {
303 delete_option('blockspare_redirect_to_welcome');
304 wp_redirect(esc_url(admin_url('admin.php?page=blockspare')));
305 die();
306 }
307 }
308 public function blockspare_load_api_files(){
309 require_once BLOCKSPARE_PLUGIN_DIR. '/admin/rest-request.php';
310 }
311
312
313
314 }
315
316 new Blockspare_Admin_Dashboard();
317 }
318
319 // Redirect to the welcome screen.
320 register_activation_hook(BLOCKSPARE_BASE_FILE, array('Blockspare_Admin_Dashboard', 'start_redirect_to_blockspare_page'));