Skip to content

Commit 343581b

Browse files
committed
Extendify partner detect improvements.
Signed-off-by: Kev Provance <[email protected]>
1 parent 89a4c09 commit 343581b

File tree

3 files changed

+241
-167
lines changed

3 files changed

+241
-167
lines changed

extendify-sdk/app/Welcome.php

Lines changed: 152 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -6,172 +6,172 @@
66
namespace Extendify\Library;
77

88
use function add_action;
9+
use function wp_sprintf;
10+
use Extendify\Library\App;
911
use function add_menu_page;
1012
use function wp_enqueue_style;
11-
use function wp_sprintf;
1213

1314
/**
1415
* This class handles the Welcome page on the admin panel.
1516
*/
1617
class Welcome
1718
{
1819

19-
/**
20-
* Adds various actions to set up the page
21-
*
22-
* @return void
23-
*/
24-
public function __construct()
25-
{
26-
if (isset($GLOBALS['extendify_sdk_partner']) && 'standalone' === $GLOBALS['extendify_sdk_partner']) {
27-
add_action( 'admin_menu', [ $this, 'addAdminMenu' ] );
20+
/**
21+
* Adds various actions to set up the page
22+
*
23+
* @return void
24+
*/
25+
public function __construct()
26+
{
27+
if (App::$standalone) {
28+
add_action('admin_menu', [ $this, 'addAdminMenu' ]);
2829

2930
$this->loadScripts();
3031
}
31-
}
32+
}
3233

33-
/**
34-
* Adds Extendify menu to admin panel.
35-
*
36-
* @return void
37-
*/
38-
public function addAdminMenu()
39-
{
40-
$raw = wp_remote_get( EXTENDIFY_URL . 'public/assets/extendify-logo.svg' );
41-
if (is_wp_error($raw)) {
42-
$svg = '';
43-
} else {
44-
$svg = wp_remote_retrieve_body($raw);
45-
}
34+
/**
35+
* Adds Extendify menu to admin panel.
36+
*
37+
* @return void
38+
*/
39+
public function addAdminMenu()
40+
{
41+
$raw = wp_remote_get(EXTENDIFY_URL . 'public/assets/extendify-logo.svg');
42+
if (is_wp_error($raw)) {
43+
$svg = '';
44+
} else {
45+
$svg = wp_remote_retrieve_body($raw);
46+
}
4647

47-
add_menu_page(
48-
'Extendify',
49-
'Extendify',
50-
App::$requiredCapability,
51-
'extendify',
52-
[
53-
$this,
54-
'createAdminPage',
55-
],
56-
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
57-
'data:image/svg+xml;base64,' . base64_encode( $svg )
58-
);
59-
}
48+
add_menu_page(
49+
'Extendify',
50+
'Extendify',
51+
App::$requiredCapability,
52+
'extendify',
53+
[
54+
$this,
55+
'createAdminPage',
56+
],
57+
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
58+
'data:image/svg+xml;base64,' . base64_encode($svg)
59+
);
60+
}
6061

61-
/**
62-
* Settings page output
63-
*
64-
* @since 1.0.0
65-
*
66-
* @return void
67-
*/
68-
public function createAdminPage()
69-
{
70-
?>
71-
<div class="extendify-outer-container">
72-
<div class="wrap welcome-container">
73-
<div class="welcome-header">
74-
<img alt="<?php esc_html_e( 'Extendify Banner', 'extendify' ); ?>" src="<?php echo esc_url( EXTENDIFY_URL . 'public/assets/welcome-banner.jpg' ); ?>">
75-
</div>
76-
<hr class="is-small"/>
77-
<div class="welcome-section">
78-
<h2 class="aligncenter">
79-
<?php esc_html_e( 'Welcome to Extendify', 'extendify' ); ?>
80-
</h2>
81-
<p class="aligncenter is-subheading">
82-
<?php esc_html_e( 'Extendify is a massive library of drop-in black patterns easily customized to your liking. Each pattern is meticulously designed to work with your existing WordPress theme.', 'extendify' ); ?>
83-
</p>
84-
</div>
85-
<hr/>
86-
<div class="welcome-section has-2-columns has-gutters is-wider-right">
87-
<div class="column is-edge-to-edge">
88-
<h3>
89-
<?php esc_html_e( '1. Open the Extendify Library', 'extendify' ); ?>
90-
</h3>
91-
<p>
92-
<?php esc_html_e( "When editing a page or post within the block editor, you'll see the Extendify library button within the editor's header", 'extendify' ); ?>
93-
</p>
94-
<p>
95-
<?php
96-
// translators: %1$s = URL.
97-
echo wp_sprintf( esc_html__( 'You may also add a new page with the library opened for you by %1$s.', 'extendify' ), '<a href="' . esc_url( admin_url( 'post-new.php?post_type=page&ext-open' ) ) . '">' . esc_html__( 'clicking here', 'extendify' ) . '</a>' );
98-
?>
99-
</p>
100-
</div>
101-
<div class="column welcome-image is-vertically-aligned-center is-edge-to-edge">
102-
<img src="<?php echo esc_url( EXTENDIFY_URL . 'public/assets/welcome-block-1.jpg' ); ?>" alt=""/>
103-
</div>
104-
</div>
105-
<div class="welcome-section has-2-columns has-gutters is-wider-left">
106-
<div class="column welcome-image is-vertically-aligned-center is-edge-to-edge">
107-
<img src="<?php echo esc_url( EXTENDIFY_URL . 'public/assets/welcome-block-2.jpg' ); ?>" alt=""/>
108-
</div>
109-
<div class="column is-edge-to-edge">
110-
<h3>
111-
<?php esc_html_e( '2. Choose a site industry', 'extendify' ); ?>
112-
</h3>
113-
<p>
114-
<?php esc_html_e( 'With the library open, you can set your site industry - or type - which will surface the perfect industry-specific patterns and full page layouts to drop onto your website.', 'extendify' ); ?>
115-
</p>
116-
<p>
117-
<?php esc_html_e( 'Extendify supports over sixty types with new industries added regularly.', 'extendify' ); ?>
118-
</p>
119-
</div>
120-
</div>
121-
<div class="welcome-section has-2-columns has-gutters is-wider-right">
122-
<div class="column is-edge-to-edge">
123-
<h3>
124-
<?php esc_html_e( '3. Browse Patterns & Layouts.', 'extendify' ); ?>
125-
</h3>
126-
<p>
127-
<?php esc_html_e( 'Search by industry, contents, and design attributes. Extendify has thousands of best-in-class block patterns. Find what you love and add it to the page - done!', 'extendify' ); ?>
128-
</p>
129-
<p>
130-
<?php esc_html_e( "You'll find beautiful high fidelity Gutenberg content to add to your pages in no time!", 'extendify' ); ?>
131-
</p>
132-
</div>
133-
<div class="column welcome-image is-vertically-aligned-center is-edge-to-edge">
134-
<img src="<?php echo esc_url( EXTENDIFY_URL . 'public/assets/welcome-block-3.jpg' ); ?>" alt=""/>
135-
</div>
136-
</div>
137-
<hr class="is-small"/>
138-
<div class="welcome-section">
139-
<h2 class="aligncenter">
140-
<?php esc_html_e( 'Upgrade to Extendify Pro', 'extendify' ); ?>
141-
</h2>
142-
<p class="aligncenter is-subheading">
143-
<?php esc_html_e( 'Do you want more patterns and layouts - without limits? Choose one of our plans and receive unlimited access to our complete library.', 'extendify' ); ?>
144-
</p>
145-
</div>
146-
<a href="https://extendify.com/pricing/?utm_source=welcome&amp;utm_medium=settings&amp;utm_campaign=get_started&amp;utm_campaign=get_started" class="button button-primary components-button">
147-
<?php echo esc_html__( 'View Pricing', 'extendify' ); ?></a>
148-
<hr/>
149-
</div>
150-
</div>
151-
<?php
152-
}
62+
/**
63+
* Settings page output
64+
*
65+
* @since 1.0.0
66+
*
67+
* @return void
68+
*/
69+
public function createAdminPage()
70+
{
71+
?>
72+
<div class="extendify-outer-container">
73+
<div class="wrap welcome-container">
74+
<div class="welcome-header">
75+
<img alt="<?php esc_html_e('Extendify Banner', 'extendify'); ?>" src="<?php echo esc_url(EXTENDIFY_URL . 'public/assets/welcome-banner.jpg'); ?>">
76+
</div>
77+
<hr class="is-small"/>
78+
<div class="welcome-section">
79+
<h2 class="aligncenter">
80+
<?php esc_html_e('Welcome to Extendify', 'extendify'); ?>
81+
</h2>
82+
<p class="aligncenter is-subheading">
83+
<?php esc_html_e('Extendify is a massive library of drop-in black patterns easily customized to your liking. Each pattern is meticulously designed to work with your existing WordPress theme.', 'extendify'); ?>
84+
</p>
85+
</div>
86+
<hr/>
87+
<div class="welcome-section has-2-columns has-gutters is-wider-right">
88+
<div class="column is-edge-to-edge">
89+
<h3>
90+
<?php esc_html_e('1. Open the Extendify Library', 'extendify'); ?>
91+
</h3>
92+
<p>
93+
<?php esc_html_e("When editing a page or post within the block editor, you'll see the Extendify library button within the editor's header", 'extendify'); ?>
94+
</p>
95+
<p>
96+
<?php
97+
// translators: %1$s = URL.
98+
echo wp_sprintf(esc_html__('You may also add a new page with the library opened for you by %1$s.', 'extendify'), '<a href="' . esc_url(admin_url('post-new.php?post_type=page&ext-open')) . '">' . esc_html__('clicking here', 'extendify') . '</a>'); ?>
99+
</p>
100+
</div>
101+
<div class="column welcome-image is-vertically-aligned-center is-edge-to-edge">
102+
<img src="<?php echo esc_url(EXTENDIFY_URL . 'public/assets/welcome-block-1.jpg'); ?>" alt=""/>
103+
</div>
104+
</div>
105+
<div class="welcome-section has-2-columns has-gutters is-wider-left">
106+
<div class="column welcome-image is-vertically-aligned-center is-edge-to-edge">
107+
<img src="<?php echo esc_url(EXTENDIFY_URL . 'public/assets/welcome-block-2.jpg'); ?>" alt=""/>
108+
</div>
109+
<div class="column is-edge-to-edge">
110+
<h3>
111+
<?php esc_html_e('2. Choose a site industry', 'extendify'); ?>
112+
</h3>
113+
<p>
114+
<?php esc_html_e('With the library open, you can set your site industry - or type - which will surface the perfect industry-specific patterns and full page layouts to drop onto your website.', 'extendify'); ?>
115+
</p>
116+
<p>
117+
<?php esc_html_e('Extendify supports over sixty types with new industries added regularly.', 'extendify'); ?>
118+
</p>
119+
</div>
120+
</div>
121+
<div class="welcome-section has-2-columns has-gutters is-wider-right">
122+
<div class="column is-edge-to-edge">
123+
<h3>
124+
<?php esc_html_e('3. Browse Patterns & Layouts.', 'extendify'); ?>
125+
</h3>
126+
<p>
127+
<?php esc_html_e('Search by industry, contents, and design attributes. Extendify has thousands of best-in-class block patterns. Find what you love and add it to the page - done!', 'extendify'); ?>
128+
</p>
129+
<p>
130+
<?php esc_html_e("You'll find beautiful high fidelity Gutenberg content to add to your pages in no time!", 'extendify'); ?>
131+
</p>
132+
</div>
133+
<div class="column welcome-image is-vertically-aligned-center is-edge-to-edge">
134+
<img src="<?php echo esc_url(EXTENDIFY_URL . 'public/assets/welcome-block-3.jpg'); ?>" alt=""/>
135+
</div>
136+
</div>
137+
<hr class="is-small"/>
138+
<div class="welcome-section">
139+
<h2 class="aligncenter">
140+
<?php esc_html_e('Upgrade to Extendify Pro', 'extendify'); ?>
141+
</h2>
142+
<p class="aligncenter is-subheading">
143+
<?php esc_html_e('Do you want more patterns and layouts - without limits? Choose one of our plans and receive unlimited access to our complete library.', 'extendify'); ?>
144+
</p>
145+
</div>
146+
<a href="https://extendify.com/pricing/?utm_source=welcome&amp;utm_medium=settings&amp;utm_campaign=get_started&amp;utm_campaign=get_started" class="button button-primary components-button">
147+
<?php echo esc_html__('View Pricing', 'extendify'); ?></a>
148+
<hr/>
149+
</div>
150+
</div>
151+
<?php
152+
}
153153

154-
/**
155-
* Adds scripts and styles to every page is enabled
156-
*
157-
* @return void
158-
*/
159-
public function loadScripts()
160-
{
161-
// No nonce for _GET.
162-
// phpcs:ignore WordPress.Security.NonceVerification
163-
if (isset($_GET['page'] ) && $_GET['page'] === 'extendify') {
164-
add_action(
165-
'admin_enqueue_scripts',
166-
function () {
167-
wp_enqueue_style(
168-
'extendify-welcome',
169-
EXTENDIFY_URL . 'public/admin-page/welcome.css',
170-
[],
171-
App::$version
172-
);
173-
}
174-
);
175-
}
176-
}
154+
/**
155+
* Adds scripts and styles to every page is enabled
156+
*
157+
* @return void
158+
*/
159+
public function loadScripts()
160+
{
161+
// No nonce for _GET.
162+
// phpcs:ignore WordPress.Security.NonceVerification
163+
if (isset($_GET['page']) && $_GET['page'] === 'extendify') {
164+
add_action(
165+
'admin_enqueue_scripts',
166+
function () {
167+
wp_enqueue_style(
168+
'extendify-welcome',
169+
EXTENDIFY_URL . 'public/admin-page/welcome.css',
170+
[],
171+
App::$version
172+
);
173+
}
174+
);
175+
}
176+
}
177177
}

extendify-sdk/bootstrap.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,46 @@
33
* Bootstrap the application
44
*/
55

6+
use Extendify\Library\App;
67
use Extendify\Library\Admin;
7-
use Extendify\Library\Frontend;
88
use Extendify\Library\Shared;
99
use Extendify\Library\Welcome;
10+
use Extendify\Library\Frontend;
1011

1112
if (!defined('ABSPATH')) {
12-
die('No direct access.');
13+
die('No direct access.');
1314
}
1415

1516
if (!defined('EXTENDIFY_PATH')) {
16-
define('EXTENDIFY_PATH', \plugin_dir_path(__FILE__));
17+
define('EXTENDIFY_PATH', \plugin_dir_path(__FILE__));
1718
}
1819

1920
if (!defined('EXTENDIFY_URL')) {
20-
define('EXTENDIFY_URL', \plugin_dir_url(__FILE__));
21+
define('EXTENDIFY_URL', \plugin_dir_url(__FILE__));
2122
}
2223

2324
if (!defined('EXTENDIFY_PLUGIN_BASENAME')) {
24-
define('EXTENDIFY_PLUGIN_BASENAME', \plugin_basename(__DIR__ . '/extendify.php'));
25+
define('EXTENDIFY_PLUGIN_BASENAME', \plugin_basename(__DIR__ . '/extendify.php'));
2526
}
2627

2728
if (is_readable(EXTENDIFY_PATH . 'vendor/autoload.php')) {
28-
require EXTENDIFY_PATH . 'vendor/autoload.php';
29+
require EXTENDIFY_PATH . 'vendor/autoload.php';
2930
}
3031

31-
$extendifyAdmin = new Admin();
32-
$extendifyFrontend = new Frontend();
33-
$extendifyShared = new Shared();
34-
$extendifyWelcome = new Welcome();
32+
new App();
33+
new Admin();
34+
new Frontend();
35+
new Shared();
36+
new Welcome();
3537

3638
require EXTENDIFY_PATH . 'routes/api.php';
3739
require EXTENDIFY_PATH . 'editorplus/EditorPlus.php';
3840

3941
\add_action(
40-
'init',
41-
function () {
42-
\load_plugin_textdomain('extendify', false, EXTENDIFY_PATH . 'languages');
43-
}
42+
'init',
43+
function () {
44+
\load_plugin_textdomain('extendify', false, EXTENDIFY_PATH . 'languages');
45+
}
4446
);
4547

4648
// To cover legacy conflicts.

0 commit comments

Comments
 (0)