PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 3.1.1
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v3.1.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
← All changes | admin/index.php +119 -122 4.1.03.1.1 View file →
@@ -1,6 +1,5 @@
1 1 <?php
2 -
3 2 /**
4 3 * Welcome screen.
5 4 */
6 5
@@ -5,65 +4,58 @@
5 4 */
6 5
7 6 // Exit if accessed directly.
8 7 if (!defined('ABSPATH')) {
9 - exit;
8 + exit;
10 9 }
11 10
12 11 if (!class_exists('Blockspare_Admin_Dashboard')) {
13 - class Blockspare_Admin_Dashboard
14 - {
15 - public function __construct()
12 + class Blockspare_Admin_Dashboard
16 13 {
17 - add_action('admin_menu', array($this, 'add_dashboard_page'));
14 + function __construct()
15 + {
16 + add_action('admin_menu', array($this, 'add_dashboard_page'));
18 17
19 - add_action('admin_enqueue_scripts', array($this, 'enqueue_dashboard_script'));
18 + add_action('admin_enqueue_scripts', array($this, 'enqueue_dashboard_script'));
20 19
21 - add_action('admin_init', array($this, 'redirect_to_blockspare_page'));
20 + add_action('admin_init', array($this, 'redirect_to_blockspare_page'));
21 +
22 + //add_action( 'init', array($this,'blockspare_load_api_files'));
22 23
23 - //add_action( 'init', array($this,'blockspare_load_api_files'));
24 + add_filter( 'plugin_row_meta', [ $this, 'plugin_row_meta' ], 10, 2 );
25 +
26 + add_filter( 'plugin_action_links_' . BLOCKSPARE_PLUGIN_BASE, [ $this, 'plugin_action_links' ] );
27 + }
24 28
25 - add_filter('plugin_row_meta', [$this, 'plugin_row_meta'], 10, 2);
29 + public function plugin_action_links( $links ) {
30 + $settings_link = sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'admin.php?page=blockspare' ), esc_html__( 'Design Library', 'blockspare' ) );
31 +
32 + array_unshift( $links, $settings_link );
33 +
34 + $links['bspro'] = sprintf( '<a href="%1$s" target="_blank" class="blockspare-pro-link">%2$s</a>', 'https://www.blockspare.com/pricing/', esc_html__( 'Get Blockspare Pro', 'blockspare' ) );
35 +
36 + return $links;
37 + }
38 + public function plugin_row_meta( $plugin_meta, $plugin_file ) {
39 + if ( BLOCKSPARE_PLUGIN_BASE === $plugin_file ) {
40 + $row_meta = [
41 + 'starter' => '<a href="https://www.blockspare.com/starter-templates/" aria-label="' . esc_attr( esc_html__( 'View Blockspare Starter Templates', 'blockspare' ) ) . '" target="_blank">' . esc_html__( 'Demos', 'blockspare' ) . '</a>',
42 + 'docs' => '<a href="https://www.blockspare.com/docs/" aria-label="' . esc_attr( esc_html__( 'View Blockspare Documentation', 'blockspare' ) ) . '" target="_blank">' . esc_html__( 'Docs', 'blockspare' ) . '</a>',
43 + 'video' => '<a href="https://afthemes.com/all-themes-plan/" aria-label="' . esc_attr( esc_html__( 'Access All Themes and Plugins', 'blockspare' ) ) . '" target="_blank">' . esc_html__( 'All Themes & Plugins', 'blockspare' ) . '</a>',
44 + 'support' => '<a href="https://afthemes.com/supports/" aria-label="' . esc_attr( esc_html__( 'Need help for Blockspare?', 'blockspare' ) ) . '" target="_blank">' . esc_html__( 'Need Help?', 'blockspare' ) . '</a>',
45 + ];
26 46
27 - add_filter('plugin_action_links_' . BLOCKSPARE_PLUGIN_BASE, [$this, 'plugin_action_links']);
47 + $plugin_meta = array_merge( $plugin_meta, $row_meta );
48 + }
28 49
29 - include_once BLOCKSPARE_PLUGIN_DIR . 'admin/notice-setup.php';
30 - include_once BLOCKSPARE_PLUGIN_DIR . 'admin/notice-theme.php';
31 - include_once BLOCKSPARE_PLUGIN_DIR . 'admin/notice-upgrade.php';
32 - include_once BLOCKSPARE_PLUGIN_DIR . 'admin/notice-review.php';
33 - }
50 + return $plugin_meta;
51 + }
34 52
35 - public function plugin_action_links($links)
36 - {
37 - $settings_link = sprintf('<a href="%1$s">%2$s</a>', admin_url('admin.php?page=blockspare'), esc_html__('Templates Library', 'blockspare'));
53 + public function add_dashboard_page()
54 + {
38 55
39 - array_unshift($links, $settings_link);
40 -
41 - $links['bspro'] = sprintf('<a href="%1$s" target="_blank" class="blockspare-pro-link">%2$s</a>', 'https://www.blockspare.com/', esc_html__('Get Blockspare Pro', 'blockspare'));
42 -
43 - return $links;
44 - }
45 - public function plugin_row_meta($plugin_meta, $plugin_file)
46 - {
47 - if (BLOCKSPARE_PLUGIN_BASE === $plugin_file) {
48 - $row_meta = [
49 - 'starter' => '<a href="https://www.blockspare.com/starter-templates/" aria-label="' . esc_attr(esc_html__('View Blockspare Templates Library', 'blockspare')) . '" target="_blank">' . esc_html__('Demos', 'blockspare') . '</a>',
50 - 'docs' => '<a href="https://www.blockspare.com/docs/" aria-label="' . esc_attr(esc_html__('View Blockspare Documentation', 'blockspare')) . '" target="_blank">' . esc_html__('Docs', 'blockspare') . '</a>',
51 - 'video' => '<a href="https://afthemes.com/all-themes-plan/" aria-label="' . esc_attr(esc_html__('Access All Themes and Plugins', 'blockspare')) . '" target="_blank">' . esc_html__('All Themes & Plugins', 'blockspare') . '</a>',
52 - 'support' => '<a href="https://afthemes.com/supports/" aria-label="' . esc_attr(esc_html__('Need help for Blockspare?', 'blockspare')) . '" target="_blank">' . esc_html__('Need Help?', 'blockspare') . '</a>',
53 - ];
54 -
55 - $plugin_meta = array_merge($plugin_meta, $row_meta);
56 - }
57 -
58 - return $plugin_meta;
59 - }
60 -
61 - public function add_dashboard_page()
62 - {
63 -
64 - // @see images/blockspare-icon.svg
65 - $svg = <<< SVG
56 + // @see images/blockspare-icon.svg
57 + $svg = <<< SVG
66 58 <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"
67 59 viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve">
68 60 <g>
69 61 <g>
@@ -70,9 +62,9 @@
70 62 <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"/>
71 63 <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 "/>
72 64 </g>
73 65 <g>
74 - <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
66 + <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
75 67 29.2,19.7 26,18.4 26,3.1 "/>
76 68 <polygon id="XMLID_1_" class="st1" points="17,38.4 19.9,40 38.4,30.7 35.3,29 "/>
77 69 </g>
78 70 </g>
@@ -78,92 +70,97 @@
78 70 </g>
79 71 </svg>
80 72 SVG;
81 73
82 - add_menu_page(
83 - __('Blockspare', 'blockspare'), // Page Title.
84 - __('Blockspare', 'blockspare'), // Menu Title.
85 - 'edit_posts', // Capability.
86 - 'blockspare', // Menu slug.
87 - array($this, 'blockspare_admin_dashboard'), // Action.
88 - 'data:image/svg+xml;base64,' . base64_encode($svg), // Blockspare icon.
89 - 25
90 - );
74 + add_menu_page(
75 + __('Blockspare', 'blockspare'), // Page Title.
76 + __('Blockspare', 'blockspare'), // Menu Title.
77 + 'edit_posts', // Capability.
78 + 'blockspare', // Menu slug.
79 + array($this, 'blockspare_admin_dashboard'), // Action.
80 + 'data:image/svg+xml;base64,' . base64_encode($svg) // Blockspare icon.
81 + );
91 82
92 - // Our getting started page.
93 - add_submenu_page(
94 - 'blockspare', // Parent slug.
95 - __('Starter Templates', 'blockspare'), // Page title.
96 - __('Starter Templates', 'blockspare'), // Menu title.
97 - 'manage_options', // Capability.
98 - 'blockspare', // Menu slug.
99 - array($this, 'blockspare_admin_dashboard'), // Callback function.
100 - 1 // Position
101 - );
83 +
84 + // Our getting started page.
85 + add_submenu_page(
86 + 'blockspare', // Parent slug.
87 + __('Design Library', 'blockspare'), // Page title.
88 + __('Design Library', 'blockspare'), // Menu title.
89 + 'manage_options', // Capability.
90 + 'blockspare', // Menu slug.
91 + array($this, 'blockspare_admin_dashboard'), // Callback function.
92 + 1 // Position
93 + );
102 94
103 - add_submenu_page(
104 - 'blockspare', // Parent slug.
105 - __('Saved Templates', 'blockspare'), // Page title.
106 - __('Saved Templates', 'blockspare'), // Menu title.
107 - 'manage_options', // Capability.
108 - 'edit.php?post_type=bs_templates', // Menu slug.
95 + add_submenu_page(
96 + 'blockspare', // Parent slug.
97 + __('My Templates', 'blockspare'), // Page title.
98 + __('My Templates', 'blockspare'), // Menu title.
99 + 'manage_options', // Capability.
100 + 'edit.php?post_type=bs_templates', // Menu slug.
109 101
110 - );
111 - }
102 + );
103 + }
112 104
113 - public function enqueue_dashboard_script($hook)
114 - {
115 - wp_enqueue_style('blockspare-admin', BLOCKSPARE_PLUGIN_URL . 'admin/assets/css/style.css', '', '');
116 - wp_enqueue_script('blockspare_dashboard_js', BLOCKSPARE_PLUGIN_URL . 'dist/block_admin_dashboard.js', array('react', 'react-dom', 'wp-components', 'wp-element', 'wp-api-fetch', 'wp-polyfill'), '1.0');
117 - wp_enqueue_style('blockspare-admin-css', BLOCKSPARE_PLUGIN_URL . 'dist/dashboard_css.css');
118 - $blockspare_dashboard_logo = BLOCKSPARE_PLUGIN_URL . 'admin/assets/images/blockspare-logo.png';
119 - wp_localize_script(
120 - 'blockspare_dashboard_js',
121 - 'blockspare_dashboard',
122 - array(
123 105
124 - 'logo' => $blockspare_dashboard_logo,
125 - "imagePath" => "https://raw.githubusercontent.com/afthemes/blockspare-demo-data/master/blocks/new/",
126 - "static_img" => BLOCKSPARE_PLUGIN_URL,
127 - 'newPageUrl' => admin_url('post-new.php?post_type=page&blockspare_create_block'),
128 - 'adminPath' => admin_url('post-new.php?post_type=page&blockspare_show_intro=true'),
129 - 'pluginVesion' => BLOCKSPARE_VERSION,
106 + public function enqueue_dashboard_script($hook)
107 + {
108 + wp_enqueue_style('blockspare-admin', BLOCKSPARE_PLUGIN_URL .'admin/assets/css/style.css','','');
109 + wp_enqueue_script( 'blockspare_dashboard_js', BLOCKSPARE_PLUGIN_URL. 'dist/block_admin_dashboard.js', array('react', 'react-dom', 'wp-components', 'wp-element', 'wp-api-fetch', 'wp-polyfill'), '1.0' );
110 + wp_enqueue_style('blockspare-admin-css',BLOCKSPARE_PLUGIN_URL.'dist/style-block_admin_dashboard.css');
111 + $blockspare_dashboard_logo = BLOCKSPARE_PLUGIN_URL . 'admin/assets/images/blockspare-logo.png';
112 + wp_localize_script(
113 + 'blockspare_dashboard_js',
114 + 'blockspare_dashboard',
115 + array(
116 +
117 + 'logo'=>$blockspare_dashboard_logo,
118 + "imagePath"=> "https://templatespare.com/wp-content/uploads/blockspare-demo-data/blocks/",
119 + "static_img"=>BLOCKSPARE_PLUGIN_URL,
120 + 'newPageUrl'=>admin_url('post-new.php?post_type=page&blockspare_create_block'),
121 + 'adminPath'=>admin_url('post-new.php?post_type=page&blockspare_show_intro=true'),
122 + 'pluginVesion'=>BLOCKSPARE_VERSION
123 +
124 +
125 + )
126 + );
127 + }
130 128
131 - )
132 - );
133 - }
129 + public function blockspare_admin_dashboard()
130 + {
131 + ?>
132 + <div id="bs-dashboard"></div>
133 +
134 + <?php
135 + }
134 136
135 - public function blockspare_admin_dashboard()
136 - {
137 -?>
138 - <div id="bs-dashboard"></div>
137 + /**
138 + * Adds a marker to remember to redirect after activation.
139 + * Redirecting right away will not work.
140 + */
141 + public static function start_redirect_to_blockspare_page()
142 + {
143 + update_option('blockspare_redirect_to_welcome', '1');
144 + }
139 145
140 -<?php
146 + /**
147 + * Redirect to the welcome screen if our marker exists.
148 + */
149 + public function redirect_to_blockspare_page()
150 + {
151 + if (get_option('blockspare_redirect_to_welcome')) {
152 + delete_option('blockspare_redirect_to_welcome');
153 + wp_redirect(esc_url(admin_url('admin.php?page=blockspare')));
154 + die();
155 + }
156 + }
157 +
158 +
159 +
141 160 }
142 161
143 - /**
144 - * Adds a marker to remember to redirect after activation.
145 - * Redirecting right away will not work.
146 - */
147 - public static function start_redirect_to_blockspare_page()
148 - {
149 - update_option('blockspare_redirect_to_welcome', '1');
150 - }
151 -
152 - /**
153 - * Redirect to the welcome screen if our marker exists.
154 - */
155 - public function redirect_to_blockspare_page()
156 - {
157 - if (get_option('blockspare_redirect_to_welcome')) {
158 - delete_option('blockspare_redirect_to_welcome');
159 - wp_redirect(esc_url(admin_url('admin.php?page=blockspare')));
160 - die();
161 - }
162 - }
163 - }
164 -
165 - new Blockspare_Admin_Dashboard();
162 + new Blockspare_Admin_Dashboard();
166 163 }
167 164
168 165 // Redirect to the welcome screen.
169 -register_activation_hook(BLOCKSPARE_BASE_FILE, array('Blockspare_Admin_Dashboard', 'start_redirect_to_blockspare_page'));
166 +register_activation_hook(BLOCKSPARE_BASE_FILE, array('Blockspare_Admin_Dashboard', 'start_redirect_to_blockspare_page'));