Skip to content

Commit 55dca6f

Browse files
committed
Update to 1.1.0
1 parent 48951bf commit 55dca6f

97 files changed

Lines changed: 1612 additions & 653 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/admin/admin.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,11 @@ body.toplevel_page_maxi-blocks-dashboard {
215215
transition: 0.3s;
216216
}
217217
.sign-up_button-wrap {
218-
display: flex;
219-
align-items: center;
220-
column-gap: 10px;
221-
margin-top: 24px;
218+
// display: flex;
219+
// align-items: center;
220+
// column-gap: 10px;
221+
// margin-top: 24px;
222+
margin-top: 40px;
222223
}
223224
.maxi-dashboard_main-content_accordion {
224225
max-width: 642px;
@@ -519,6 +520,10 @@ body.toplevel_page_maxi-blocks-dashboard {
519520
}
520521
}
521522
}
523+
524+
.maxi-dashboard-how-to-image {
525+
max-width: 700px;
526+
}
522527
}
523528

524529
@media only screen and (max-width: 1390px) {

core/admin/class-maxi-dashboard.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,13 @@ public function maxi_blocks_pro()
838838
// $content .= '<p>'.__('I want to join', self::$maxi_text_domain).'</p>';
839839
$content .= '<div class="sign-up_button-wrap">';
840840
$content .= '<a href="https://maxiblocks.com/go/pricing" target="_blank" class="sign-up_button">'.__('Sign up', self::$maxi_text_domain).'</a>';
841-
$content .= '<p>'.__('Already have an account? ', self::$maxi_text_domain);
842-
$content .= '<a href="https://maxiblocks.com/go/user-login" target="_blank">'.__('Sign in', self::$maxi_text_domain).'</a>';
841+
$content .= '<br/><br/><br/><p>'.__('Already have an account? ', self::$maxi_text_domain);
843842
$content .= '</p>';
843+
$content .= '<p>Sign in from the template library like this.</p>';
844+
$content .= '<p>Step 1. Launch template library from the page edit screen.</p>';
845+
$content .= '<img class="maxi-dashboard-how-to-image" src="'.esc_url(MAXI_PLUGIN_URL_PATH).'img/how-to-log-in-1.png"/>';
846+
$content .= '<p>Step 2. Add email and sign in.</p>';
847+
$content .= '<img class="maxi-dashboard-how-to-image" src="'.esc_url(MAXI_PLUGIN_URL_PATH).'img/how-to-log-in-2.png"/>';
844848
$content .= '</div>';
845849
$content .= '<ul class="not_loggedin-bottom-menu">';
846850
$content .= '<li><a href="https://maxiblocks.com/go/help-desk" target="_blank">'.__('help desk', self::$maxi_text_domain).'</a></li>';

core/class-maxi-api.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,13 @@ public function mb_register_routes()
243243
'permission_callback' => function () {
244244
return current_user_can('edit_posts');
245245
},
246+
'args' => [
247+
'data' => [
248+
'validate_callback' => function ($param) {
249+
return is_string($param);
250+
},
251+
],
252+
],
246253
]);
247254
}
248255

@@ -767,13 +774,17 @@ public function get_maxi_blocks_pro_status()
767774

768775
public function set_maxi_blocks_pro_status($data)
769776
{
770-
$dataString = json_encode($data);
777+
$dataString = $data['data'];
778+
$dataType = gettype($dataString);
779+
if(get_option('maxi_pro')) {
780+
$oldData = json_decode(get_option('maxi_pro'));
781+
782+
}
771783

772784
if($dataString) {
773785
update_option('maxi_pro', $dataString);
774786
return $dataString;
775787
}
776-
777788
return false;
778789
}
779790
}

core/class-maxi-style-cards.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
require_once MAXI_PLUGIN_DIR_PATH . 'core/utils/get-last-breakpoint-attribute.php';
3-
include MAXI_PLUGIN_DIR_PATH . 'core/defaults/sc_defaults.php';
3+
require_once MAXI_PLUGIN_DIR_PATH . 'core/defaults/sc_defaults.php';
44

55

66
class MaxiBlocks_StyleCards
@@ -47,6 +47,11 @@ public function enqueue_styles()
4747

4848
$styles = $this->get_style_card_styles();
4949

50+
// MVP: ensure no margin-bottom for button
51+
if (str_contains($styles, 'margin-bottom: var(--maxi-light-button-margin-bottom-general);')) {
52+
$styles = str_replace('margin-bottom: var(--maxi-light-button-margin-bottom-general);', '', $styles);
53+
}
54+
5055
// SC styles
5156
if ($styles) {
5257
wp_register_style('maxi-blocks-sc-styles', false);
@@ -78,7 +83,7 @@ public function get_style_card_variables()
7883
$style_card = $this->get_style_card_object_from_db();
7984

8085
if (!$style_card) {
81-
if($GLOBALS['default_sc_variables_string']) {
86+
if(isset($GLOBALS['default_sc_variables_string'])) {
8287
return $GLOBALS['default_sc_variables_string'];
8388
}
8489

@@ -103,7 +108,7 @@ public function get_style_card_variables()
103108
}
104109

105110
if (!$style || empty($style) || $style === ':root{--maxi-active-sc-color:0,0,0;}') { // ':root{--maxi-active-sc-color:0,0,0;}' is the default value
106-
if($GLOBALS['default_sc_variables_string']) {
111+
if(isset($GLOBALS['default_sc_variables_string'])) {
107112
return $GLOBALS['default_sc_variables_string'];
108113
}
109114

@@ -118,7 +123,7 @@ public function get_style_card_styles()
118123
$style_card = $this->get_style_card_object_from_db();
119124

120125
if (!$style_card) {
121-
if($GLOBALS['default_sc_styles_string']) {
126+
if(isset($GLOBALS['default_sc_styles_string'])) {
122127
return $GLOBALS['default_sc_styles_string'];
123128
}
124129

@@ -137,7 +142,7 @@ public function get_style_card_styles()
137142
!array_key_exists('_maxi_blocks_style_card_styles', $style_card) &&
138143
!array_key_exists('_maxi_blocks_style_card_styles_preview', $style_card)
139144
) {
140-
if($GLOBALS['default_sc_styles_string']) {
145+
if(isset($GLOBALS['default_sc_styles_string'])) {
141146
return $GLOBALS['default_sc_styles_string'];
142147
}
143148

@@ -157,7 +162,7 @@ public function get_style_card_styles()
157162
}
158163

159164
if (!$sc_variables || empty($sc_variables)) {
160-
if($GLOBALS['default_sc_styles_string']) {
165+
if(isset($GLOBALS['default_sc_styles_string'])) {
161166
return $GLOBALS['default_sc_styles_string'];
162167
}
163168

@@ -239,7 +244,7 @@ public static function get_maxi_blocks_style_card_fonts($block_style, $text_leve
239244
* Button case has an exception for font-family. If it's empty, it will use the
240245
* font-family of the paragraph text level.
241246
*/
242-
if ($text_level === 'button' && empty($font)) {
247+
if ($text_level === 'button' && (empty($font) || empty(str_replace('"', '', $font)) || str_contains($font, 'undefined'))) {
243248
$font = $style_card_values->p['font-family-general'];
244249
}
245250

core/class-maxi-styles.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ public function enqueue_styles()
128128
}
129129
}
130130

131+
public function get_template_name()
132+
{
133+
$template_name = wp_get_theme()->stylesheet ?? get_template();
134+
135+
return $template_name;
136+
}
137+
131138
public function get_template_parts($content)
132139
{
133140
if ($content && array_key_exists('template_parts', $content)) {
@@ -142,7 +149,7 @@ public function get_template_parts($content)
142149
* so it doesn't have template parts. In this case, we need to get default
143150
* template parts (header and footer).
144151
*/
145-
$theme_name = get_template();
152+
$theme_name = $this->get_template_name();
146153
return [
147154
$theme_name . '//header',
148155
$theme_name . '//footer',
@@ -172,7 +179,7 @@ public function apply_content($name, $content, $id)
172179
if ($fonts) {
173180
$this->enqueue_fonts($fonts, $name);
174181
}
175-
} elseif (get_template() === 'maxi-theme' && $is_template_part) {
182+
} elseif ($this->get_template_name() === 'maxi-theme' && $is_template_part) {
176183
do_action('maxi_enqueue_template_styles', $name, $id, $is_template);
177184
}
178185

@@ -204,7 +211,7 @@ public function get_id($is_template = false)
204211
}
205212

206213
$template_slug = get_page_template_slug();
207-
$template_id = get_template() . '//';
214+
$template_id = $this->get_template_name() . '//';
208215

209216
if ($template_slug != '' && $template_slug !== false) {
210217
$template_id .= $template_slug;
@@ -724,10 +731,10 @@ public function set_home_to_front_page($post_id, $post, $update)
724731
global $wpdb;
725732

726733
if (class_exists('MaxiBlocks_API')) {
727-
$home_id = get_template() . '//' . 'home';
734+
$home_id = $this->get_template_name() . '//' . 'home';
728735
$home_content = $this->get_content(true, $home_id);
729736

730-
$front_page_id = get_template() . '//' . 'front-page';
737+
$front_page_id = $this->get_template_name() . '//' . 'front-page';
731738

732739
$api = new MaxiBlocks_API();
733740

0 commit comments

Comments
 (0)