| 1 |
<?php |
| 2 |
/** |
| 3 |
* Enhanced SliderBerg Admin Welcome Page with Improved Security |
| 4 |
* Security improvements while maintaining post/page content integrity |
| 5 |
*/ |
| 6 |
|
| 7 |
// Prevent direct access |
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
// Security: Define allowed actions to prevent arbitrary action execution |
| 13 |
define('SLIDERBERG_ALLOWED_ACTIONS', array( |
| 14 |
'sliderberg_create_post', |
| 15 |
'sliderberg_create_page' |
| 16 |
)); |
| 17 |
|
| 18 |
/** |
| 19 |
* Add admin menu with proper capability checks |
| 20 |
*/ |
| 21 |
function sliderberg_admin_menu() { |
| 22 |
// Security: Use appropriate capability based on functionality |
| 23 |
// For plugin management functions, require higher privileges |
| 24 |
$admin_capability = 'manage_options'; // For admin functions like plugin installation |
| 25 |
$editor_capability = 'edit_posts'; // For content creation functions |
| 26 |
|
| 27 |
// Only show admin menu to users who can at least edit posts |
| 28 |
if (!current_user_can($editor_capability)) { |
| 29 |
return; |
| 30 |
} |
| 31 |
|
| 32 |
add_menu_page( |
| 33 |
__('SliderBerg', 'sliderberg'), // Page title |
| 34 |
__('SliderBerg', 'sliderberg'), // Menu title |
| 35 |
$editor_capability, // Capability - allow editors access |
| 36 |
'sliderberg-welcome', // Menu slug |
| 37 |
'sliderberg_welcome_page', // Callback function |
| 38 |
SLIDERBERG_PLUGIN_URL . 'assets/images/logo-icon.svg', // Icon |
| 39 |
30 // Position |
| 40 |
); |
| 41 |
|
| 42 |
// Add submenu item for welcome page |
| 43 |
add_submenu_page( |
| 44 |
'sliderberg-welcome', // Parent slug |
| 45 |
__('Welcome', 'sliderberg'), // Page title |
| 46 |
__('Welcome', 'sliderberg'), // Menu title |
| 47 |
$editor_capability, // Capability |
| 48 |
'sliderberg-welcome', // Menu slug |
| 49 |
'sliderberg_welcome_page' // Callback function |
| 50 |
); |
| 51 |
} |
| 52 |
add_action('admin_menu', 'sliderberg_admin_menu'); |
| 53 |
|
| 54 |
/** |
| 55 |
* Enhanced security function to validate and sanitize action parameters |
| 56 |
*/ |
| 57 |
function sliderberg_validate_action_request($action) { |
| 58 |
// Security: Validate action is in allowed list |
| 59 |
if (!in_array($action, SLIDERBERG_ALLOWED_ACTIONS, true)) { |
| 60 |
return false; |
| 61 |
} |
| 62 |
|
| 63 |
// Security: Verify secure nonce |
| 64 |
if (!isset($_GET['_wpnonce']) || !sliderberg_verify_secure_nonce($_GET['_wpnonce'], $action)) { |
| 65 |
return false; |
| 66 |
} |
| 67 |
|
| 68 |
// Security: Check if user is logged in and not a bot |
| 69 |
if (!is_user_logged_in() || !current_user_can('edit_posts')) { |
| 70 |
return false; |
| 71 |
} |
| 72 |
|
| 73 |
// Security: Additional CSRF protection - check referer |
| 74 |
if (!wp_get_referer() || !wp_validate_redirect(wp_get_referer())) { |
| 75 |
// Allow if coming from admin area |
| 76 |
$referer = wp_get_referer(); |
| 77 |
if (!$referer || strpos($referer, admin_url()) !== 0) { |
| 78 |
return false; |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
return true; |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Enhanced function to handle post creation with additional security |
| 87 |
*/ |
| 88 |
function sliderberg_handle_create_post_action() { |
| 89 |
// Security: Check if this is our action |
| 90 |
if (!isset($_GET['action']) || $_GET['action'] !== 'sliderberg_create_post') { |
| 91 |
return; |
| 92 |
} |
| 93 |
|
| 94 |
// Security: Validate the request |
| 95 |
if (!sliderberg_validate_action_request('sliderberg_create_post')) { |
| 96 |
wp_die( |
| 97 |
__('Security check failed. Please try again.', 'sliderberg'), |
| 98 |
__('Security Error', 'sliderberg'), |
| 99 |
array('response' => 403) |
| 100 |
); |
| 101 |
} |
| 102 |
|
| 103 |
// Security: Double-check user permissions |
| 104 |
if (!current_user_can('edit_posts')) { |
| 105 |
wp_die( |
| 106 |
__('You do not have permission to create posts.', 'sliderberg'), |
| 107 |
__('Permission Error', 'sliderberg'), |
| 108 |
array('response' => 403) |
| 109 |
); |
| 110 |
} |
| 111 |
|
| 112 |
// IMPORTANT: Keep post content exactly as provided - DO NOT MODIFY |
| 113 |
$post_content = '<!-- wp:sliderberg/sliderberg {"type":"blocks","navigationPlacement":"outside","className":"wp-block-sliderberg-sliderberg alignfull"} --> |
| 114 |
<!-- wp:sliderberg/slide {"backgroundType":"color","backgroundColor":"#007cba","className":"wp-block-sliderberg-slide sliderberg-slide sliderberg-content-position-center-center has-007-cba-background-color has-background"} --> |
| 115 |
<!-- wp:heading {"textAlign":"center","textColor":"white"} --> |
| 116 |
<h2 class="wp-block-heading has-text-align-center has-white-color has-text-color">Welcome to Your First Slide</h2> |
| 117 |
<!-- /wp:heading --> |
| 118 |
|
| 119 |
<!-- wp:paragraph {"align":"center","textColor":"white"} --> |
| 120 |
<p class="has-text-align-center has-white-color has-text-color">Start customizing your slider by adding content, images, and more slides. Click on this slide to edit its background and content.</p> |
| 121 |
<!-- /wp:paragraph --> |
| 122 |
|
| 123 |
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} --> |
| 124 |
<div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"white","textColor":"black","style":{"border":{"radius":"25px"}}} --> |
| 125 |
<div class="wp-block-button"><a class="wp-block-button__link has-black-color has-white-background-color has-text-color has-background wp-element-button" style="border-radius:25px">Get Started</a></div> |
| 126 |
<!-- /wp:button --></div> |
| 127 |
<!-- /wp:buttons --> |
| 128 |
<!-- /wp:sliderberg/slide --> |
| 129 |
<!-- /wp:sliderberg/sliderberg -->'; |
| 130 |
|
| 131 |
// Security: Sanitize post title and prepare data |
| 132 |
$post_data = array( |
| 133 |
'post_title' => sanitize_text_field(__('New Post with SliderBerg', 'sliderberg')), |
| 134 |
'post_content' => $post_content, // Content kept exactly as provided |
| 135 |
'post_status' => 'draft', |
| 136 |
'post_type' => 'post', |
| 137 |
'post_author' => get_current_user_id(), |
| 138 |
'meta_input' => array( |
| 139 |
'_sliderberg_created' => current_time('mysql'), |
| 140 |
'_sliderberg_version' => SLIDERBERG_VERSION |
| 141 |
) |
| 142 |
); |
| 143 |
|
| 144 |
// Security: Use wp_insert_post with error handling |
| 145 |
$post_id = wp_insert_post($post_data, true); |
| 146 |
|
| 147 |
if (is_wp_error($post_id)) { |
| 148 |
error_log('SliderBerg: Failed to create post - ' . $post_id->get_error_message()); |
| 149 |
wp_die( |
| 150 |
__('Failed to create post. Please try again.', 'sliderberg'), |
| 151 |
__('Creation Error', 'sliderberg'), |
| 152 |
array('response' => 500) |
| 153 |
); |
| 154 |
} |
| 155 |
|
| 156 |
if ($post_id) { |
| 157 |
// Security: Sanitize redirect URL and validate |
| 158 |
$edit_url = admin_url('post.php?post=' . absint($post_id) . '&action=edit'); |
| 159 |
$edit_url = wp_validate_redirect($edit_url, admin_url()); |
| 160 |
|
| 161 |
// Security: Add success message and redirect |
| 162 |
wp_safe_redirect($edit_url); |
| 163 |
exit; |
| 164 |
} else { |
| 165 |
wp_die( |
| 166 |
__('Failed to create post. Please try again.', 'sliderberg'), |
| 167 |
__('Creation Error', 'sliderberg'), |
| 168 |
array('response' => 500) |
| 169 |
); |
| 170 |
} |
| 171 |
} |
| 172 |
add_action('admin_init', 'sliderberg_handle_create_post_action'); |
| 173 |
|
| 174 |
/** |
| 175 |
* Enhanced function to handle page creation with additional security |
| 176 |
*/ |
| 177 |
function sliderberg_handle_create_page_action() { |
| 178 |
// Security: Check if this is our action |
| 179 |
if (!isset($_GET['action']) || $_GET['action'] !== 'sliderberg_create_page') { |
| 180 |
return; |
| 181 |
} |
| 182 |
|
| 183 |
// Security: Validate the request |
| 184 |
if (!sliderberg_validate_action_request('sliderberg_create_page')) { |
| 185 |
wp_die( |
| 186 |
__('Security check failed. Please try again.', 'sliderberg'), |
| 187 |
__('Security Error', 'sliderberg'), |
| 188 |
array('response' => 403) |
| 189 |
); |
| 190 |
} |
| 191 |
|
| 192 |
// Security: Double-check user permissions |
| 193 |
if (!current_user_can('edit_pages')) { |
| 194 |
wp_die( |
| 195 |
__('You do not have permission to create pages.', 'sliderberg'), |
| 196 |
__('Permission Error', 'sliderberg'), |
| 197 |
array('response' => 403) |
| 198 |
); |
| 199 |
} |
| 200 |
|
| 201 |
// IMPORTANT: Keep page content exactly as provided - DO NOT MODIFY |
| 202 |
$page_content = '<!-- wp:sliderberg/sliderberg {"type":"blocks","navigationPlacement":"outside","className":"wp-block-sliderberg-sliderberg alignfull"} --> |
| 203 |
<!-- wp:sliderberg/slide {"backgroundType":"color","backgroundColor":"#28a745","minHeight":500,"className":"wp-block-sliderberg-slide sliderberg-slide sliderberg-content-position-center-center has-28-a-745-background-color has-background"} --> |
| 204 |
<!-- wp:heading {"textAlign":"center","level":1,"textColor":"white"} --> |
| 205 |
<h1 class="wp-block-heading has-text-align-center has-white-color has-text-color">Welcome to Your Landing Page</h1> |
| 206 |
<!-- /wp:heading --> |
| 207 |
|
| 208 |
<!-- wp:paragraph {"align":"center","textColor":"white","fontSize":"large"} --> |
| 209 |
<p class="has-text-align-center has-white-color has-text-color has-large-font-size">Create an amazing landing page with this slider. Add compelling content, beautiful images, and call-to-action buttons to engage your visitors.</p> |
| 210 |
<!-- /wp:paragraph --> |
| 211 |
|
| 212 |
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} --> |
| 213 |
<div class="wp-block-buttons"><!-- wp:button {"backgroundColor":"white","textColor":"black","style":{"border":{"radius":"30px"},"spacing":{"padding":{"left":"2rem","right":"2rem","top":"0.75rem","bottom":"0.75rem"}}}} --> |
| 214 |
<div class="wp-block-button"><a class="wp-block-button__link has-black-color has-white-background-color has-text-color has-background wp-element-button" style="border-radius:30px;padding-top:0.75rem;padding-right:2rem;padding-bottom:0.75rem;padding-left:2rem">Learn More</a></div> |
| 215 |
<!-- /wp:button --></div> |
| 216 |
<!-- /wp:buttons --> |
| 217 |
<!-- /wp:sliderberg/slide --> |
| 218 |
<!-- /wp:sliderberg/sliderberg -->'; |
| 219 |
|
| 220 |
// Security: Sanitize page title and prepare data |
| 221 |
$page_data = array( |
| 222 |
'post_title' => sanitize_text_field(__('New Landing Page with SliderBerg', 'sliderberg')), |
| 223 |
'post_content' => $page_content, // Content kept exactly as provided |
| 224 |
'post_status' => 'draft', |
| 225 |
'post_type' => 'page', |
| 226 |
'post_author' => get_current_user_id(), |
| 227 |
'meta_input' => array( |
| 228 |
'_sliderberg_created' => current_time('mysql'), |
| 229 |
'_sliderberg_version' => SLIDERBERG_VERSION |
| 230 |
) |
| 231 |
); |
| 232 |
|
| 233 |
// Security: Use wp_insert_post with error handling |
| 234 |
$page_id = wp_insert_post($page_data, true); |
| 235 |
|
| 236 |
if (is_wp_error($page_id)) { |
| 237 |
error_log('SliderBerg: Failed to create page - ' . $page_id->get_error_message()); |
| 238 |
wp_die( |
| 239 |
__('Failed to create page. Please try again.', 'sliderberg'), |
| 240 |
__('Creation Error', 'sliderberg'), |
| 241 |
array('response' => 500) |
| 242 |
); |
| 243 |
} |
| 244 |
|
| 245 |
if ($page_id) { |
| 246 |
// Security: Sanitize redirect URL and validate |
| 247 |
$edit_url = admin_url('post.php?post=' . absint($page_id) . '&action=edit'); |
| 248 |
$edit_url = wp_validate_redirect($edit_url, admin_url()); |
| 249 |
|
| 250 |
// Security: Add success message and redirect |
| 251 |
wp_safe_redirect($edit_url); |
| 252 |
exit; |
| 253 |
} else { |
| 254 |
wp_die( |
| 255 |
__('Failed to create page. Please try again.', 'sliderberg'), |
| 256 |
__('Creation Error', 'sliderberg'), |
| 257 |
array('response' => 500) |
| 258 |
); |
| 259 |
} |
| 260 |
} |
| 261 |
add_action('admin_init', 'sliderberg_handle_create_page_action'); |
| 262 |
|
| 263 |
/** |
| 264 |
* Enhanced admin styles enqueue with security checks |
| 265 |
*/ |
| 266 |
function sliderberg_admin_styles($hook) { |
| 267 |
// Security: Only load on our admin pages |
| 268 |
if (strpos($hook, 'sliderberg-welcome') !== false) { |
| 269 |
// Security: Verify user has access to this page |
| 270 |
if (!current_user_can('edit_posts')) { |
| 271 |
return; |
| 272 |
} |
| 273 |
|
| 274 |
wp_enqueue_style( |
| 275 |
'sliderberg-admin-welcome', |
| 276 |
SLIDERBERG_PLUGIN_URL . 'assets/css/admin-welcome.css', |
| 277 |
array(), |
| 278 |
SLIDERBERG_VERSION |
| 279 |
); |
| 280 |
|
| 281 |
wp_enqueue_script( |
| 282 |
'sliderberg-admin-welcome', |
| 283 |
SLIDERBERG_PLUGIN_URL . 'assets/js/admin-welcome.js', |
| 284 |
array('jquery'), |
| 285 |
SLIDERBERG_VERSION, |
| 286 |
true |
| 287 |
); |
| 288 |
} |
| 289 |
} |
| 290 |
add_action('admin_enqueue_scripts', 'sliderberg_admin_styles'); |
| 291 |
|
| 292 |
/** |
| 293 |
* Enhanced activation redirect with security checks |
| 294 |
*/ |
| 295 |
function sliderberg_activation_redirect() { |
| 296 |
// Security: Check activation redirect option and user permissions |
| 297 |
if (get_option('sliderberg_activation_redirect', false) && current_user_can('edit_posts')) { |
| 298 |
delete_option('sliderberg_activation_redirect'); |
| 299 |
|
| 300 |
// Security: Only redirect for single plugin activation, not bulk |
| 301 |
if (!isset($_GET['activate-multi'])) { |
| 302 |
$redirect_url = admin_url('admin.php?page=sliderberg-welcome'); |
| 303 |
wp_safe_redirect($redirect_url); |
| 304 |
exit; |
| 305 |
} |
| 306 |
} |
| 307 |
} |
| 308 |
add_action('admin_init', 'sliderberg_activation_redirect'); |
| 309 |
|
| 310 |
/** |
| 311 |
* Set activation redirect flag on plugin activation |
| 312 |
*/ |
| 313 |
function sliderberg_set_activation_redirect() { |
| 314 |
// Security: Only set flag if user can edit posts |
| 315 |
if (current_user_can('edit_posts')) { |
| 316 |
add_option('sliderberg_activation_redirect', true); |
| 317 |
} |
| 318 |
} |
| 319 |
// Use the main plugin file for activation hook |
| 320 |
register_activation_hook(dirname(__DIR__) . '/sliderberg.php', 'sliderberg_set_activation_redirect'); |
| 321 |
|
| 322 |
/** |
| 323 |
* Enhanced welcome page with security improvements |
| 324 |
*/ |
| 325 |
function sliderberg_welcome_page() { |
| 326 |
// Security: Final permission check |
| 327 |
if (!current_user_can('edit_posts')) { |
| 328 |
wp_die( |
| 329 |
__('You do not have permission to access this page.', 'sliderberg'), |
| 330 |
__('Permission Error', 'sliderberg'), |
| 331 |
array('response' => 403) |
| 332 |
); |
| 333 |
} |
| 334 |
|
| 335 |
// Security: Generate secure nonces with enhanced security |
| 336 |
$create_post_nonce = sliderberg_generate_secure_nonce('sliderberg_create_post'); |
| 337 |
$create_page_nonce = sliderberg_generate_secure_nonce('sliderberg_create_page'); |
| 338 |
|
| 339 |
// Security: Create properly escaped URLs |
| 340 |
$create_post_url = esc_url(admin_url('admin.php?page=sliderberg-welcome&action=sliderberg_create_post&_wpnonce=' . $create_post_nonce)); |
| 341 |
$create_page_url = esc_url(admin_url('admin.php?page=sliderberg-welcome&action=sliderberg_create_page&_wpnonce=' . $create_page_nonce)); |
| 342 |
?> |
| 343 |
<div class="sliderberg-welcome-wrap"> |
| 344 |
<div class="sliderberg-welcome-header"> |
| 345 |
<div class="sliderberg-welcome-header-content"> |
| 346 |
<div class="sliderberg-welcome-intro"> |
| 347 |
<h1><?php echo esc_html__('Welcome to SliderBerg!', 'sliderberg'); ?></h1> |
| 348 |
<p class="sliderberg-welcome-subtitle"> |
| 349 |
<?php echo esc_html__('Create beautiful, responsive sliders with ease using the WordPress block editor.', 'sliderberg'); ?> |
| 350 |
</p> |
| 351 |
</div> |
| 352 |
<div class="sliderberg-welcome-version"> |
| 353 |
<?php echo esc_html(sprintf(__('Version %s', 'sliderberg'), SLIDERBERG_VERSION)); ?> |
| 354 |
</div> |
| 355 |
</div> |
| 356 |
</div> |
| 357 |
|
| 358 |
<div class="sliderberg-welcome-content"> |
| 359 |
<div class="sliderberg-welcome-main"> |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
<!-- Getting Started Section --> |
| 364 |
<div class="sliderberg-welcome-section"> |
| 365 |
<div class="sliderberg-section-header"> |
| 366 |
<h2><?php echo esc_html__('📖 Getting Started Guide', 'sliderberg'); ?></h2> |
| 367 |
<p><?php echo esc_html__('Follow these simple steps to create your first slider', 'sliderberg'); ?></p> |
| 368 |
</div> |
| 369 |
|
| 370 |
<div class="sliderberg-steps-grid"> |
| 371 |
<div class="sliderberg-step"> |
| 372 |
<div class="sliderberg-step-number">1</div> |
| 373 |
<div class="sliderberg-step-content"> |
| 374 |
<h3><?php echo esc_html__('Add SliderBerg Block', 'sliderberg'); ?></h3> |
| 375 |
<p><?php echo esc_html__('In any post or page, click the + button and search for "SliderBerg" to add the block.', 'sliderberg'); ?></p> |
| 376 |
<div class="sliderberg-screenshot-placeholder"> |
| 377 |
<img src="<?php echo esc_url(SLIDERBERG_PLUGIN_URL); ?>assets/images/screenshots/step-1-add-block.png" alt="<?php echo esc_attr__('Add SliderBerg Block', 'sliderberg'); ?>" /> |
| 378 |
</div> |
| 379 |
</div> |
| 380 |
</div> |
| 381 |
|
| 382 |
<div class="sliderberg-step"> |
| 383 |
<div class="sliderberg-step-number">2</div> |
| 384 |
<div class="sliderberg-step-content"> |
| 385 |
<h3><?php echo esc_html__('Customize Your Slides', 'sliderberg'); ?></h3> |
| 386 |
<p><?php echo esc_html__('Add content, images, and customize the background. Each slide can contain any WordPress blocks.', 'sliderberg'); ?></p> |
| 387 |
<div class="sliderberg-screenshot-placeholder"> |
| 388 |
<img src="<?php echo esc_url(SLIDERBERG_PLUGIN_URL); ?>assets/images/screenshots/step-3-customize.png" alt="<?php echo esc_attr__('Customize Slides', 'sliderberg'); ?>" /> |
| 389 |
</div> |
| 390 |
</div> |
| 391 |
</div> |
| 392 |
|
| 393 |
<div class="sliderberg-step"> |
| 394 |
<div class="sliderberg-step-number">3</div> |
| 395 |
<div class="sliderberg-step-content"> |
| 396 |
<h3><?php echo esc_html__('Configure Settings', 'sliderberg'); ?></h3> |
| 397 |
<p><?php echo esc_html__('Use the block settings panel to customize transitions, autoplay, navigation, and more.', 'sliderberg'); ?></p> |
| 398 |
<div class="sliderberg-screenshot-placeholder"> |
| 399 |
<img src="<?php echo esc_url(SLIDERBERG_PLUGIN_URL); ?>assets/images/screenshots/step-4-settings.png" alt="<?php echo esc_attr__('Configure Settings', 'sliderberg'); ?>" /> |
| 400 |
</div> |
| 401 |
</div> |
| 402 |
</div> |
| 403 |
</div> |
| 404 |
</div> |
| 405 |
|
| 406 |
<!-- Quick Start Section --> |
| 407 |
<div class="sliderberg-welcome-section sliderberg-quick-start-section"> |
| 408 |
<div class="sliderberg-section-header"> |
| 409 |
<h2><?php echo esc_html__('🚀 Quick Start', 'sliderberg'); ?></h2> |
| 410 |
<p><?php echo esc_html__('Get started immediately with pre-configured sliders', 'sliderberg'); ?></p> |
| 411 |
</div> |
| 412 |
|
| 413 |
<div class="sliderberg-quick-actions"> |
| 414 |
<div class="sliderberg-quick-action"> |
| 415 |
<div class="sliderberg-quick-action-icon">📝</div> |
| 416 |
<h3><?php echo esc_html__('Create Post with Slider', 'sliderberg'); ?></h3> |
| 417 |
<p><?php echo esc_html__('Start a new blog post with a pre-configured SliderBerg block ready to customize.', 'sliderberg'); ?></p> |
| 418 |
<a href="<?php echo $create_post_url; ?>" class="sliderberg-action-button sliderberg-action-button-primary"> |
| 419 |
<?php echo esc_html__('Create Post with Slider', 'sliderberg'); ?> |
| 420 |
</a> |
| 421 |
</div> |
| 422 |
|
| 423 |
<div class="sliderberg-quick-action"> |
| 424 |
<div class="sliderberg-quick-action-icon">🏠</div> |
| 425 |
<h3><?php echo esc_html__('Create Landing Page', 'sliderberg'); ?></h3> |
| 426 |
<p><?php echo esc_html__('Create a stunning landing page with a hero slider to showcase your content.', 'sliderberg'); ?></p> |
| 427 |
<a href="<?php echo $create_page_url; ?>" class="sliderberg-action-button sliderberg-action-button-secondary"> |
| 428 |
<?php echo esc_html__('Create Landing Page', 'sliderberg'); ?> |
| 429 |
</a> |
| 430 |
</div> |
| 431 |
|
| 432 |
</div> |
| 433 |
</div> |
| 434 |
|
| 435 |
<!-- Features Section --> |
| 436 |
<div class="sliderberg-welcome-section"> |
| 437 |
<div class="sliderberg-section-header"> |
| 438 |
<h2><?php echo esc_html__('✨ Key Features', 'sliderberg'); ?></h2> |
| 439 |
<p><?php echo esc_html__('Everything you need to create stunning sliders', 'sliderberg'); ?></p> |
| 440 |
</div> |
| 441 |
|
| 442 |
<div class="sliderberg-features-grid"> |
| 443 |
<div class="sliderberg-feature"> |
| 444 |
<div class="sliderberg-feature-icon">🎨</div> |
| 445 |
<h4><?php echo esc_html__('Beautiful Transitions', 'sliderberg'); ?></h4> |
| 446 |
<p><?php echo esc_html__('Choose from slide, fade, or zoom effects with customizable duration and easing.', 'sliderberg'); ?></p> |
| 447 |
</div> |
| 448 |
|
| 449 |
<div class="sliderberg-feature"> |
| 450 |
<div class="sliderberg-feature-icon">📱</div> |
| 451 |
<h4><?php echo esc_html__('Mobile Responsive', 'sliderberg'); ?></h4> |
| 452 |
<p><?php echo esc_html__('Touch-enabled with swipe gestures. Looks perfect on all devices.', 'sliderberg'); ?></p> |
| 453 |
</div> |
| 454 |
|
| 455 |
<div class="sliderberg-feature"> |
| 456 |
<div class="sliderberg-feature-icon">⚡</div> |
| 457 |
<h4><?php echo esc_html__('Performance Optimized', 'sliderberg'); ?></h4> |
| 458 |
<p><?php echo esc_html__('Lightweight and fast. Built with modern web standards for smooth performance.', 'sliderberg'); ?></p> |
| 459 |
</div> |
| 460 |
|
| 461 |
<div class="sliderberg-feature"> |
| 462 |
<div class="sliderberg-feature-icon">♿</div> |
| 463 |
<h4><?php echo esc_html__('Accessibility Ready', 'sliderberg'); ?></h4> |
| 464 |
<p><?php echo esc_html__('Keyboard navigation, ARIA labels, and screen reader support built-in.', 'sliderberg'); ?></p> |
| 465 |
</div> |
| 466 |
|
| 467 |
<div class="sliderberg-feature"> |
| 468 |
<div class="sliderberg-feature-icon">🎯</div> |
| 469 |
<h4><?php echo esc_html__('Easy to Use', 'sliderberg'); ?></h4> |
| 470 |
<p><?php echo esc_html__('Intuitive block interface. No coding required. Works with any WordPress theme.', 'sliderberg'); ?></p> |
| 471 |
</div> |
| 472 |
|
| 473 |
<div class="sliderberg-feature"> |
| 474 |
<div class="sliderberg-feature-icon">🔧</div> |
| 475 |
<h4><?php echo esc_html__('Highly Customizable', 'sliderberg'); ?></h4> |
| 476 |
<p><?php echo esc_html__('Control every aspect: navigation style, autoplay, colors, and positioning.', 'sliderberg'); ?></p> |
| 477 |
</div> |
| 478 |
</div> |
| 479 |
</div> |
| 480 |
|
| 481 |
<!-- Tips Section --> |
| 482 |
<div class="sliderberg-welcome-section"> |
| 483 |
<div class="sliderberg-section-header"> |
| 484 |
<h2><?php echo esc_html__('💡 Pro Tips', 'sliderberg'); ?></h2> |
| 485 |
<p><?php echo esc_html__('Get the most out of SliderBerg with these helpful tips', 'sliderberg'); ?></p> |
| 486 |
</div> |
| 487 |
|
| 488 |
<div class="sliderberg-tips-grid"> |
| 489 |
<div class="sliderberg-tip"> |
| 490 |
<div class="sliderberg-tip-icon">🖼️</div> |
| 491 |
<div class="sliderberg-tip-content"> |
| 492 |
<h4><?php echo esc_html__('Image Optimization', 'sliderberg'); ?></h4> |
| 493 |
<p><?php echo esc_html__('Use optimized images (WebP format when possible) for faster loading times. Recommended size: 1920×1080px.', 'sliderberg'); ?></p> |
| 494 |
</div> |
| 495 |
</div> |
| 496 |
|
| 497 |
<div class="sliderberg-tip"> |
| 498 |
<div class="sliderberg-tip-icon">⏱️</div> |
| 499 |
<div class="sliderberg-tip-content"> |
| 500 |
<h4><?php echo esc_html__('Autoplay Best Practices', 'sliderberg'); ?></h4> |
| 501 |
<p><?php echo esc_html__('Keep autoplay speed between 3-7 seconds. Enable "Pause on Hover" for better user experience.', 'sliderberg'); ?></p> |
| 502 |
</div> |
| 503 |
</div> |
| 504 |
|
| 505 |
<div class="sliderberg-tip"> |
| 506 |
<div class="sliderberg-tip-icon">📐</div> |
| 507 |
<div class="sliderberg-tip-content"> |
| 508 |
<h4><?php echo esc_html__('Content Positioning', 'sliderberg'); ?></h4> |
| 509 |
<p><?php echo esc_html__('Use focal points for background images and experiment with different content positions for visual impact.', 'sliderberg'); ?></p> |
| 510 |
</div> |
| 511 |
</div> |
| 512 |
|
| 513 |
<div class="sliderberg-tip"> |
| 514 |
<div class="sliderberg-tip-icon">🎯</div> |
| 515 |
<div class="sliderberg-tip-content"> |
| 516 |
<h4><?php echo esc_html__('Call-to-Action', 'sliderberg'); ?></h4> |
| 517 |
<p><?php echo esc_html__('Add button blocks to your slides for clear calls-to-action. Use contrasting colors for better visibility.', 'sliderberg'); ?></p> |
| 518 |
</div> |
| 519 |
</div> |
| 520 |
</div> |
| 521 |
</div> |
| 522 |
</div> |
| 523 |
|
| 524 |
<!-- Sidebar --> |
| 525 |
<div class="sliderberg-welcome-sidebar"> |
| 526 |
|
| 527 |
<!-- PRO Upgrade / Pro Status --> |
| 528 |
<?php $sliderberg_is_pro = class_exists( 'SliderbergPro\Pro_Features' ); ?> |
| 529 |
<?php if ( $sliderberg_is_pro ) : ?> |
| 530 |
<div class="sliderberg-sidebar-section sliderberg-pro-section sliderberg-pro-active"> |
| 531 |
<div class="sliderberg-pro-active-badge">✓</div> |
| 532 |
<h3><?php echo esc_html__( "You're a Pro User!", 'sliderberg' ); ?></h3> |
| 533 |
<p><?php echo esc_html__( 'Thank you for supporting Sliderberg. All pro features are unlocked.', 'sliderberg' ); ?></p> |
| 534 |
<ul class="sliderberg-quick-links"> |
| 535 |
<li><a href="<?php echo esc_url( 'https://sliderberg.com/docs/' ); ?>" target="_blank" rel="noopener noreferrer" class="sliderberg-link"><?php echo esc_html__( 'Documentation', 'sliderberg' ); ?></a></li> |
| 536 |
<li><a href="<?php echo esc_url( 'https://sliderberg.com/contact/' ); ?>" target="_blank" rel="noopener noreferrer" class="sliderberg-link"><?php echo esc_html__( 'Priority Support', 'sliderberg' ); ?></a></li> |
| 537 |
<li><a href="<?php echo esc_url( 'https://wordpress.org/support/plugin/sliderberg/reviews/' ); ?>" target="_blank" rel="noopener noreferrer" class="sliderberg-link"><?php echo esc_html__( 'Leave a Review', 'sliderberg' ); ?></a></li> |
| 538 |
</ul> |
| 539 |
</div> |
| 540 |
<?php else : ?> |
| 541 |
<div class="sliderberg-sidebar-section sliderberg-pro-section"> |
| 542 |
<h3><?php echo esc_html__( 'Upgrade to Sliderberg PRO', 'sliderberg' ); ?></h3> |
| 543 |
<p><?php echo esc_html__( 'Unlock powerful transition effects, pagination styles, and more.', 'sliderberg' ); ?></p> |
| 544 |
<ul class="sliderberg-pro-features"> |
| 545 |
<li><?php echo esc_html__( '✦ Coverflow Effect', 'sliderberg' ); ?></li> |
| 546 |
<li><?php echo esc_html__( '✦ Flip Effect', 'sliderberg' ); ?></li> |
| 547 |
<li><?php echo esc_html__( '✦ Cube Effect', 'sliderberg' ); ?></li> |
| 548 |
<li><?php echo esc_html__( '✦ Parallax Effect', 'sliderberg' ); ?></li> |
| 549 |
<li><?php echo esc_html__( '✦ Fraction Pagination', 'sliderberg' ); ?></li> |
| 550 |
<li><?php echo esc_html__( '✦ Progress Bar Pagination', 'sliderberg' ); ?></li> |
| 551 |
<li><?php echo esc_html__( '✦ Vertical Slider', 'sliderberg' ); ?></li> |
| 552 |
</ul> |
| 553 |
<a href="https://sliderberg.com/pricing/" target="_blank" rel="noopener noreferrer" class="sliderberg-pro-button"> |
| 554 |
<?php echo esc_html__( 'Get Sliderberg PRO', 'sliderberg' ); ?> |
| 555 |
</a> |
| 556 |
</div> |
| 557 |
<?php endif; ?> |
| 558 |
|
| 559 |
<!-- Quick Links --> |
| 560 |
<div class="sliderberg-sidebar-section"> |
| 561 |
<h3><?php echo esc_html__('Quick Links', 'sliderberg'); ?></h3> |
| 562 |
<ul class="sliderberg-quick-links"> |
| 563 |
<li><a href="<?php echo esc_url(admin_url('post-new.php?post_type=page')); ?>" class="sliderberg-link"><?php echo esc_html__('Create New Page', 'sliderberg'); ?></a></li> |
| 564 |
<li><a href="<?php echo esc_url('https://sliderberg.com/docs/'); ?>" target="_blank" rel="noopener noreferrer" class="sliderberg-link"><?php echo esc_html__('Documentation', 'sliderberg'); ?></a></li> |
| 565 |
<li><a href="<?php echo esc_url('https://wordpress.org/support/plugin/sliderberg/'); ?>" target="_blank" rel="noopener noreferrer" class="sliderberg-link"><?php echo esc_html__('Get Support', 'sliderberg'); ?></a></li> |
| 566 |
<li><a href="<?php echo esc_url('https://wordpress.org/support/plugin/sliderberg/reviews/'); ?>" target="_blank" rel="noopener noreferrer" class="sliderberg-link"><?php echo esc_html__('Leave us a review', 'sliderberg'); ?></a></li> |
| 567 |
</ul> |
| 568 |
</div> |
| 569 |
<!-- Support --> |
| 570 |
<div class="sliderberg-sidebar-section"> |
| 571 |
<h3><?php echo esc_html__('Need Help?', 'sliderberg'); ?></h3> |
| 572 |
<p><?php echo esc_html__('We\'re here to help you succeed with SliderBerg.', 'sliderberg'); ?></p> |
| 573 |
<a href="<?php echo esc_url('https://wordpress.org/support/plugin/sliderberg/'); ?>" target="_blank" rel="noopener noreferrer" class="sliderberg-support-button"> |
| 574 |
<?php echo esc_html__('Contact Support', 'sliderberg'); ?> |
| 575 |
</a> |
| 576 |
</div> |
| 577 |
<?php if (current_user_can('install_plugins')) : ?> |
| 578 |
<!-- Other Plugins - Only show to users who can install plugins --> |
| 579 |
<div class="sliderberg-sidebar-section"> |
| 580 |
<h3><?php echo esc_html__('Our Other Plugins', 'sliderberg'); ?></h3> |
| 581 |
|
| 582 |
<div class="sliderberg-other-plugins"> |
| 583 |
<?php |
| 584 |
$plugins = array( |
| 585 |
'ultimate-blocks' => array( |
| 586 |
'name' => 'Ultimate Blocks', |
| 587 |
'slug' => 'ultimate-blocks', |
| 588 |
'description' => __('Enhance your Gutenberg editor with 25+ powerful blocks.', 'sliderberg') |
| 589 |
), |
| 590 |
'wp-table-builder' => array( |
| 591 |
'name' => 'WP Table Builder', |
| 592 |
'slug' => 'wp-table-builder', |
| 593 |
'description' => __('Create beautiful tables with an intuitive drag & drop interface.', 'sliderberg') |
| 594 |
), |
| 595 |
'tableberg' => array( |
| 596 |
'name' => 'Tableberg', |
| 597 |
'slug' => 'tableberg', |
| 598 |
'description' => __('Create and manage tables directly in the Gutenberg editor.', 'sliderberg') |
| 599 |
) |
| 600 |
); |
| 601 |
|
| 602 |
foreach ($plugins as $plugin) { |
| 603 |
$status = 'install'; |
| 604 |
$button_text = __('Install Now', 'sliderberg'); |
| 605 |
|
| 606 |
if (is_plugin_active($plugin['slug'] . '/' . $plugin['slug'] . '.php')) { |
| 607 |
$status = 'active'; |
| 608 |
$button_text = __('Active', 'sliderberg'); |
| 609 |
} elseif (file_exists(WP_PLUGIN_DIR . '/' . $plugin['slug'] . '/' . $plugin['slug'] . '.php')) { |
| 610 |
$status = 'inactive'; |
| 611 |
$button_text = __('Activate', 'sliderberg'); |
| 612 |
} |
| 613 |
?> |
| 614 |
<div class="sliderberg-plugin-card" data-plugin-slug="<?php echo esc_attr($plugin['slug']); ?>"> |
| 615 |
<h4><?php echo esc_html($plugin['name']); ?></h4> |
| 616 |
<p><?php echo esc_html($plugin['description']); ?></p> |
| 617 |
<?php if (current_user_can('install_plugins') || (current_user_can('activate_plugins') && $status === 'inactive')) : ?> |
| 618 |
<button class="sliderberg-plugin-button" |
| 619 |
data-plugin="<?php echo esc_attr($plugin['slug']); ?>" |
| 620 |
data-status="<?php echo esc_attr($status); ?>" |
| 621 |
data-nonce="<?php echo wp_create_nonce('sliderberg_plugin_action'); ?>" |
| 622 |
<?php echo ($status === 'active') ? 'disabled' : ''; ?>> |
| 623 |
<?php echo esc_html($button_text); ?> |
| 624 |
</button> |
| 625 |
<?php else : ?> |
| 626 |
<button class="sliderberg-plugin-button" disabled> |
| 627 |
<?php echo esc_html__('Insufficient permissions', 'sliderberg'); ?> |
| 628 |
</button> |
| 629 |
<?php endif; ?> |
| 630 |
</div> |
| 631 |
<?php |
| 632 |
} |
| 633 |
?> |
| 634 |
</div> |
| 635 |
</div> |
| 636 |
<?php endif; ?> |
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
</div> |
| 641 |
</div> |
| 642 |
|
| 643 |
<!-- Footer --> |
| 644 |
<div class="sliderberg-welcome-footer"> |
| 645 |
<p> |
| 646 |
<?php echo wp_kses( |
| 647 |
sprintf( |
| 648 |
__('Made with ❤️ by %s', 'sliderberg'), |
| 649 |
'<a href="' . esc_url('https://dotcamp.com') . '" target="_blank" rel="noopener noreferrer">DotCamp</a>' |
| 650 |
), |
| 651 |
array( |
| 652 |
'a' => array( |
| 653 |
'href' => array(), |
| 654 |
'target' => array(), |
| 655 |
'rel' => array() |
| 656 |
) |
| 657 |
) |
| 658 |
); ?> |
| 659 |
</p> |
| 660 |
</div> |
| 661 |
</div> |
| 662 |
<?php |
| 663 |
} |