@sociallane/elements 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/views/setup-widget-catalog-frontend.php +3 -1
- package/admin/views/setup-widget-catalog.php +5 -1
- package/elements/button/button.php +16 -7
- package/includes/class-widget-manager.php +1 -1
- package/package.json +1 -1
- package/packages/core/includes/helpers.php +32 -22
- package/packages/widgets/footer-brand/data/view.php +3 -12
- package/packages/widgets/hero-overlay/templates/wrapper.php +1 -1
- package/packages/widgets/hero-overlay-single/templates/wrapper.php +1 -1
- package/packages/widgets/hero-overlay-slider/templates/wrapper.php +1 -1
- package/packages/widgets/widget-filter/templates/wrapper.php +7 -7
- package/sociallane-elements.php +6 -0
- package/widgets/footer-brand/data/view.php +3 -12
- package/widgets/hero-overlay/templates/wrapper.php +1 -1
|
@@ -202,7 +202,9 @@ npm run build</code></pre>
|
|
|
202
202
|
</summary>
|
|
203
203
|
<div class="p-5 pt-0 border-t border-neutral-200 dark:border-neutral-700">
|
|
204
204
|
<p class="mb-2"><?php esc_html_e( 'When widgets.json exists at the plugin root, the plugin runs in package mode: only widget components are loaded. The onboarding wizard, SocialLane settings page, widget preview pages, and this setup guide are not available on that installation.', 'sociallane-elements' ); ?></p>
|
|
205
|
-
<p class="mb-2"><?php esc_html_e( 'To
|
|
205
|
+
<p class="mb-2"><?php esc_html_e( 'To use full admin without removing widgets.json, add this to wp-config.php:', 'sociallane-elements' ); ?></p>
|
|
206
|
+
<pre class="bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-600 rounded-lg p-4 text-sm overflow-x-auto text-neutral-800 dark:text-neutral-200 mb-2"><code>define( 'SOCIALLANE_ELEMENTS_FULL_ADMIN', true );</code></pre>
|
|
207
|
+
<p class="mb-2"><?php esc_html_e( 'Alternatively, remove or rename widgets.json; the plugin will then use the Widget Manager and show all admin features.', 'sociallane-elements' ); ?></p>
|
|
206
208
|
</div>
|
|
207
209
|
</details>
|
|
208
210
|
</section>
|
|
@@ -121,7 +121,11 @@ npm run build</code></pre>
|
|
|
121
121
|
<?php esc_html_e( 'When widgets.json exists at the plugin root, the plugin runs in package mode: only widget components are loaded. The onboarding wizard, SocialLane settings page, widget preview pages, and this setup guide are not available on that installation.', 'sociallane-elements' ); ?>
|
|
122
122
|
</p>
|
|
123
123
|
<p class="text-neutral-600 mb-2">
|
|
124
|
-
<?php esc_html_e( 'To
|
|
124
|
+
<?php esc_html_e( 'To use full admin without removing widgets.json, add to wp-config.php:', 'sociallane-elements' ); ?>
|
|
125
|
+
<code class="bg-neutral-100 px-1 rounded text-sm block mt-1">define( 'SOCIALLANE_ELEMENTS_FULL_ADMIN', true );</code>
|
|
126
|
+
</p>
|
|
127
|
+
<p class="text-neutral-600 mb-2">
|
|
128
|
+
<?php esc_html_e( 'Alternatively, remove or rename widgets.json; the plugin will then use the Widget Manager and show all admin features.', 'sociallane-elements' ); ?>
|
|
125
129
|
</p>
|
|
126
130
|
</section>
|
|
127
131
|
|
|
@@ -147,14 +147,23 @@ class Button extends Widget_Base {
|
|
|
147
147
|
];
|
|
148
148
|
|
|
149
149
|
$attrs = [];
|
|
150
|
-
if (
|
|
151
|
-
$attrs
|
|
152
|
-
|
|
150
|
+
if ( function_exists( 'sociallane_build_link_attrs' ) ) {
|
|
151
|
+
$button['attrs'] = sociallane_build_link_attrs( $url_data );
|
|
152
|
+
} else {
|
|
153
|
+
$rel_tokens = [];
|
|
154
|
+
if ( ! empty( $url_data['is_external'] ) ) {
|
|
155
|
+
$attrs[] = 'target="_blank"';
|
|
156
|
+
$rel_tokens[] = 'noopener';
|
|
157
|
+
$rel_tokens[] = 'noreferrer';
|
|
158
|
+
}
|
|
159
|
+
if ( ! empty( $url_data['nofollow'] ) ) {
|
|
160
|
+
$rel_tokens[] = 'nofollow';
|
|
161
|
+
}
|
|
162
|
+
if ( ! empty( $rel_tokens ) ) {
|
|
163
|
+
$attrs[] = 'rel="' . esc_attr( implode( ' ', array_values( array_unique( $rel_tokens ) ) ) ) . '"';
|
|
164
|
+
}
|
|
165
|
+
$button['attrs'] = implode( ' ', $attrs );
|
|
153
166
|
}
|
|
154
|
-
if ( ! empty( $url_data['nofollow'] ) ) {
|
|
155
|
-
$attrs[] = 'rel="nofollow"';
|
|
156
|
-
}
|
|
157
|
-
$button['attrs'] = implode( ' ', $attrs );
|
|
158
167
|
|
|
159
168
|
include __DIR__ . '/templates/render.php';
|
|
160
169
|
}
|
|
@@ -592,7 +592,7 @@ class Widget_Manager {
|
|
|
592
592
|
'navigation' => 'navigation',
|
|
593
593
|
'footers' => 'footer',
|
|
594
594
|
'logos' => 'logo-grid-centered',
|
|
595
|
-
'dashboards' => 'posts
|
|
595
|
+
'dashboards' => 'grid-posts',
|
|
596
596
|
];
|
|
597
597
|
$category = $widget['category'] ?? '';
|
|
598
598
|
$fallback_slug = $category_fallbacks[ $category ] ?? '';
|
package/package.json
CHANGED
|
@@ -52,6 +52,35 @@ function sociallane_prepare_image_data( array $image_settings, array $options =
|
|
|
52
52
|
return $image;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Build safe target/rel HTML attributes from Elementor URL control data.
|
|
57
|
+
*
|
|
58
|
+
* Ensures rel is emitted once (e.g. rel="noopener noreferrer nofollow")
|
|
59
|
+
* when both external and nofollow are enabled.
|
|
60
|
+
*
|
|
61
|
+
* @param array $url_settings Elementor URL control: url, is_external, nofollow
|
|
62
|
+
* @return string HTML attributes string
|
|
63
|
+
*/
|
|
64
|
+
function sociallane_build_link_attrs( array $url_settings ): string {
|
|
65
|
+
$url_settings = is_array( $url_settings ) ? $url_settings : [];
|
|
66
|
+
$attrs = [];
|
|
67
|
+
$rel_tokens = [];
|
|
68
|
+
|
|
69
|
+
if ( ! empty( $url_settings['is_external'] ) ) {
|
|
70
|
+
$attrs[] = 'target="_blank"';
|
|
71
|
+
$rel_tokens[] = 'noopener';
|
|
72
|
+
$rel_tokens[] = 'noreferrer';
|
|
73
|
+
}
|
|
74
|
+
if ( ! empty( $url_settings['nofollow'] ) ) {
|
|
75
|
+
$rel_tokens[] = 'nofollow';
|
|
76
|
+
}
|
|
77
|
+
if ( ! empty( $rel_tokens ) ) {
|
|
78
|
+
$attrs[] = 'rel="' . esc_attr( implode( ' ', array_values( array_unique( $rel_tokens ) ) ) ) . '"';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return implode( ' ', $attrs );
|
|
82
|
+
}
|
|
83
|
+
|
|
55
84
|
/**
|
|
56
85
|
* Prepare button data for the button element.
|
|
57
86
|
*
|
|
@@ -83,24 +112,14 @@ function sociallane_prepare_button_data( string $text, array $url, array $option
|
|
|
83
112
|
$extra_class = $options['class'] ?? '';
|
|
84
113
|
|
|
85
114
|
$href = esc_url( $url['url'] ?? '#' );
|
|
86
|
-
$
|
|
87
|
-
$nofollow = ! empty( $url['nofollow'] );
|
|
88
|
-
|
|
89
|
-
$attrs = [];
|
|
90
|
-
if ( $is_external ) {
|
|
91
|
-
$attrs[] = 'target="_blank"';
|
|
92
|
-
$attrs[] = 'rel="noopener noreferrer"';
|
|
93
|
-
}
|
|
94
|
-
if ( $nofollow ) {
|
|
95
|
-
$attrs[] = 'rel="nofollow"';
|
|
96
|
-
}
|
|
115
|
+
$attrs = sociallane_build_link_attrs( $url );
|
|
97
116
|
|
|
98
117
|
$data = [
|
|
99
118
|
'text' => esc_html( $text ),
|
|
100
119
|
'url' => $href,
|
|
101
120
|
'variant' => $variant,
|
|
102
121
|
'size' => $size,
|
|
103
|
-
'attrs' =>
|
|
122
|
+
'attrs' => $attrs,
|
|
104
123
|
];
|
|
105
124
|
|
|
106
125
|
if ( $color !== 'default' ) {
|
|
@@ -269,19 +288,10 @@ function sociallane_stagger_attrs( array $anim ): string {
|
|
|
269
288
|
function sociallane_prepare_link_attrs( array $url_settings ): array {
|
|
270
289
|
$url_settings = is_array( $url_settings ) ? $url_settings : [];
|
|
271
290
|
$href = esc_url( $url_settings['url'] ?? '#' );
|
|
272
|
-
$attrs = [];
|
|
273
|
-
|
|
274
|
-
if ( ! empty( $url_settings['is_external'] ) ) {
|
|
275
|
-
$attrs[] = 'target="_blank"';
|
|
276
|
-
$attrs[] = 'rel="noopener noreferrer"';
|
|
277
|
-
}
|
|
278
|
-
if ( ! empty( $url_settings['nofollow'] ) ) {
|
|
279
|
-
$attrs[] = 'rel="nofollow"';
|
|
280
|
-
}
|
|
281
291
|
|
|
282
292
|
return [
|
|
283
293
|
'url' => $href,
|
|
284
|
-
'attrs' =>
|
|
294
|
+
'attrs' => sociallane_build_link_attrs( $url_settings ),
|
|
285
295
|
];
|
|
286
296
|
}
|
|
287
297
|
|
|
@@ -55,24 +55,15 @@ function prepare_footer_brand_view( array $settings, string $widget_id ): array
|
|
|
55
55
|
$social_links = [];
|
|
56
56
|
if ( $show_social ) {
|
|
57
57
|
foreach ( $settings['social_links'] ?? [] as $item ) {
|
|
58
|
-
$
|
|
59
|
-
$href = esc_url( $url_data['url'] ?? '#' );
|
|
60
|
-
$attrs = [];
|
|
61
|
-
if ( ! empty( $url_data['is_external'] ) ) {
|
|
62
|
-
$attrs[] = 'target="_blank"';
|
|
63
|
-
$attrs[] = 'rel="noopener noreferrer"';
|
|
64
|
-
}
|
|
65
|
-
if ( ! empty( $url_data['nofollow'] ) ) {
|
|
66
|
-
$attrs[] = 'rel="nofollow"';
|
|
67
|
-
}
|
|
58
|
+
$link = sociallane_prepare_link_attrs( $item['url'] ?? [] );
|
|
68
59
|
$aria_label = trim( $item['aria_label'] ?? '' );
|
|
69
60
|
if ( $aria_label === '' ) {
|
|
70
61
|
$aria_label = __( 'Link', 'sociallane-elements' );
|
|
71
62
|
}
|
|
72
63
|
$social_links[] = [
|
|
73
64
|
'icon' => $item['icon'] ?? null,
|
|
74
|
-
'href' => $
|
|
75
|
-
'attrs' =>
|
|
65
|
+
'href' => $link['url'],
|
|
66
|
+
'attrs' => $link['attrs'],
|
|
76
67
|
'aria_label' => esc_attr( $aria_label ),
|
|
77
68
|
];
|
|
78
69
|
}
|
|
@@ -144,7 +144,7 @@ foreach ( $slides as $s ) {
|
|
|
144
144
|
</div>
|
|
145
145
|
<?php if ( ! empty( $view['anchor_button'] ) ) : ?>
|
|
146
146
|
<a
|
|
147
|
-
href="<?php echo $view['anchor_button']['url']; ?>"
|
|
147
|
+
href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
|
|
148
148
|
class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
|
|
149
149
|
aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
|
|
150
150
|
>
|
|
@@ -144,7 +144,7 @@ foreach ( $slides as $s ) {
|
|
|
144
144
|
</div>
|
|
145
145
|
<?php if ( ! empty( $view['anchor_button'] ) ) : ?>
|
|
146
146
|
<a
|
|
147
|
-
href="<?php echo $view['anchor_button']['url']; ?>"
|
|
147
|
+
href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
|
|
148
148
|
class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
|
|
149
149
|
aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
|
|
150
150
|
>
|
|
@@ -144,7 +144,7 @@ foreach ( $slides as $s ) {
|
|
|
144
144
|
</div>
|
|
145
145
|
<?php if ( ! empty( $view['anchor_button'] ) ) : ?>
|
|
146
146
|
<a
|
|
147
|
-
href="<?php echo $view['anchor_button']['url']; ?>"
|
|
147
|
+
href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
|
|
148
148
|
class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
|
|
149
149
|
aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
|
|
150
150
|
>
|
|
@@ -131,13 +131,13 @@ $filter_inactive_classes = ! empty( $classes['filter_inactive'] ) ? explode( ' '
|
|
|
131
131
|
|
|
132
132
|
if (search) {
|
|
133
133
|
search.addEventListener('input', function() {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
var q = this.value.toLowerCase().trim();
|
|
135
|
+
cards.forEach(function(c) {
|
|
136
|
+
var show = !q || (c.getAttribute('data-display') || '').toLowerCase().indexOf(q) !== -1 ||
|
|
137
|
+
(c.getAttribute('data-widget-name') || '').toLowerCase().indexOf(q) !== -1 ||
|
|
138
|
+
(c.getAttribute('data-category') || '').toLowerCase().indexOf(q) !== -1;
|
|
139
|
+
c.style.display = show ? '' : 'none';
|
|
140
|
+
});
|
|
141
141
|
updateCount();
|
|
142
142
|
});
|
|
143
143
|
}
|
package/sociallane-elements.php
CHANGED
|
@@ -47,9 +47,15 @@ function sociallane_elements_admin_notice(): void {
|
|
|
47
47
|
* Whether the plugin is in package mode (widgets.json exists).
|
|
48
48
|
* In package mode, only widget components are available; no admin UI, previews, or management.
|
|
49
49
|
*
|
|
50
|
+
* To keep widgets.json but use full admin (settings, previews, onboarding), add to wp-config.php:
|
|
51
|
+
* define( 'SOCIALLANE_ELEMENTS_FULL_ADMIN', true );
|
|
52
|
+
*
|
|
50
53
|
* @return bool
|
|
51
54
|
*/
|
|
52
55
|
function sociallane_is_package_mode(): bool {
|
|
56
|
+
if ( defined( 'SOCIALLANE_ELEMENTS_FULL_ADMIN' ) && SOCIALLANE_ELEMENTS_FULL_ADMIN ) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
53
59
|
return file_exists( SOCIALLANE_ELEMENTS_PATH . 'widgets.json' );
|
|
54
60
|
}
|
|
55
61
|
|
|
@@ -64,24 +64,15 @@ function prepare_footer_brand_view( array $settings, string $widget_id ): array
|
|
|
64
64
|
$social_links = [];
|
|
65
65
|
if ( $show_social ) {
|
|
66
66
|
foreach ( $settings['social_links'] ?? [] as $item ) {
|
|
67
|
-
$
|
|
68
|
-
$href = esc_url( $url_data['url'] ?? '#' );
|
|
69
|
-
$attrs = [];
|
|
70
|
-
if ( ! empty( $url_data['is_external'] ) ) {
|
|
71
|
-
$attrs[] = 'target="_blank"';
|
|
72
|
-
$attrs[] = 'rel="noopener noreferrer"';
|
|
73
|
-
}
|
|
74
|
-
if ( ! empty( $url_data['nofollow'] ) ) {
|
|
75
|
-
$attrs[] = 'rel="nofollow"';
|
|
76
|
-
}
|
|
67
|
+
$link = sociallane_prepare_link_attrs( $item['url'] ?? [] );
|
|
77
68
|
$aria_label = trim( $item['aria_label'] ?? '' );
|
|
78
69
|
if ( $aria_label === '' ) {
|
|
79
70
|
$aria_label = __( 'Link', 'sociallane-elements' );
|
|
80
71
|
}
|
|
81
72
|
$social_links[] = [
|
|
82
73
|
'icon' => $item['icon'] ?? null,
|
|
83
|
-
'href' => $
|
|
84
|
-
'attrs' =>
|
|
74
|
+
'href' => $link['url'],
|
|
75
|
+
'attrs' => $link['attrs'],
|
|
85
76
|
'aria_label' => esc_attr( $aria_label ),
|
|
86
77
|
];
|
|
87
78
|
}
|
|
@@ -144,7 +144,7 @@ foreach ( $slides as $s ) {
|
|
|
144
144
|
</div>
|
|
145
145
|
<?php if ( ! empty( $view['anchor_button'] ) ) : ?>
|
|
146
146
|
<a
|
|
147
|
-
href="<?php echo $view['anchor_button']['url']; ?>"
|
|
147
|
+
href="<?php echo esc_url( $view['anchor_button']['url'] ); ?>"
|
|
148
148
|
class="<?php echo esc_attr( $view['classes']['anchor_btn'] ?? '' ); ?>"
|
|
149
149
|
aria-label="<?php echo esc_attr( $view['anchor_button']['text'] ); ?>"
|
|
150
150
|
>
|