setup-wizard
1 day ago
templates
1 day ago
admin-bar.php
2 months ago
admin-helper.php
1 day ago
admin-notices.php
1 day ago
beta-testers.php
2 months ago
duplicator.php
1 month ago
elements.php
3 weeks ago
feedback.php
1 month ago
keys.php
3 weeks ago
pa-rollback.php
2 months ago
admin-notices.php
711 lines
| 1 | <?php |
| 2 | /** |
| 3 | * PA Admin Notices. |
| 4 | */ |
| 5 | |
| 6 | namespace PremiumAddons\Admin\Includes; |
| 7 | |
| 8 | use PremiumAddons\Includes\Helper_Functions; |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit(); |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Class Admin_Notices |
| 16 | */ |
| 17 | class Admin_Notices { |
| 18 | |
| 19 | /** |
| 20 | * Premium Addons Stories |
| 21 | * |
| 22 | * @var stories |
| 23 | */ |
| 24 | private $stories = array(); |
| 25 | |
| 26 | /** |
| 27 | * Class object |
| 28 | * |
| 29 | * @var instance |
| 30 | */ |
| 31 | private static $instance = null; |
| 32 | |
| 33 | /** |
| 34 | * Elementor slug |
| 35 | * |
| 36 | * @var elementor |
| 37 | */ |
| 38 | private static $elementor = 'elementor'; |
| 39 | |
| 40 | /** |
| 41 | * PAPRO Slug |
| 42 | * |
| 43 | * @var papro |
| 44 | */ |
| 45 | private static $papro = 'premium-addons-pro'; |
| 46 | |
| 47 | /** |
| 48 | * Notices Keys |
| 49 | * |
| 50 | * @var notices |
| 51 | */ |
| 52 | private static $notices = null; |
| 53 | |
| 54 | /** |
| 55 | * Constructor for the class |
| 56 | */ |
| 57 | public function __construct() { |
| 58 | |
| 59 | add_action( 'admin_init', array( $this, 'init' ) ); |
| 60 | |
| 61 | add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
| 62 | |
| 63 | add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
| 64 | |
| 65 | add_action( 'wp_ajax_pa_reset_admin_notice', array( $this, 'reset_admin_notice' ) ); |
| 66 | |
| 67 | add_action( 'wp_ajax_pa_dismiss_admin_notice', array( $this, 'dismiss_admin_notice' ) ); |
| 68 | |
| 69 | self::$notices = array( |
| 70 | 'pa-review', |
| 71 | 'content-toggle-not', |
| 72 | ); |
| 73 | |
| 74 | if ( Helper_Functions::check_hide_notifications() ) { |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | add_action( 'wp_dashboard_setup', array( $this, 'show_story_widget' ), 111 ); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Init |
| 83 | * |
| 84 | * Init required functions |
| 85 | * |
| 86 | * The redirection happens on the first admin page after activation ( the plugins page ). |
| 87 | * |
| 88 | * @since 1.0.0 |
| 89 | * @access public |
| 90 | */ |
| 91 | public function init() { |
| 92 | |
| 93 | $this->handle_review_notice(); |
| 94 | |
| 95 | if ( Helper_Functions::check_elementor_version() && get_transient( 'pa_activation_redirect' ) ) { |
| 96 | |
| 97 | delete_transient( 'pa_activation_redirect' ); |
| 98 | |
| 99 | $redirect = add_query_arg( |
| 100 | array( |
| 101 | 'page' => 'pa-setup-wizard', // this mean it should've been added first. |
| 102 | ), |
| 103 | admin_url( 'admin.php' ) |
| 104 | ); |
| 105 | |
| 106 | wp_safe_redirect( $redirect ); |
| 107 | |
| 108 | exit; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Init notices check functions. |
| 114 | */ |
| 115 | public function admin_notices() { |
| 116 | |
| 117 | // Skip rendering notices during AJAX requests. |
| 118 | if ( wp_doing_ajax() ) { |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | $this->required_plugins_check(); |
| 123 | |
| 124 | // Make sure "Already did" was not clicked before. |
| 125 | $show_review = get_option( 'pa_review_notice' ); |
| 126 | if ( '1' !== $show_review ) { |
| 127 | |
| 128 | $cache_key = 'pa_review_notice'; |
| 129 | |
| 130 | $response = get_transient( $cache_key ); |
| 131 | |
| 132 | if ( false === $response ) { |
| 133 | $this->show_review_notice(); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | if ( Helper_Functions::check_hide_notifications() ) { |
| 138 | return; |
| 139 | } |
| 140 | |
| 141 | $this->get_content_toggle_notice(); |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Handle Review Notice |
| 146 | * |
| 147 | * Checks if review message is dismissed. |
| 148 | * |
| 149 | * @access public |
| 150 | * @return void |
| 151 | */ |
| 152 | public function handle_review_notice() { |
| 153 | |
| 154 | if ( ! isset( $_GET['pa_review'] ) ) { |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | $pa_review = sanitize_text_field( wp_unslash( $_GET['pa_review'] ) ); |
| 159 | |
| 160 | if ( 'opt_out' === $pa_review ) { |
| 161 | check_admin_referer( 'opt_out' ); |
| 162 | |
| 163 | update_option( 'pa_review_notice', '1' ); |
| 164 | } |
| 165 | |
| 166 | wp_safe_redirect( remove_query_arg( 'pa_review' ) ); |
| 167 | |
| 168 | exit; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Required plugin check |
| 173 | * |
| 174 | * Shows an admin notice when Elementor is missing. |
| 175 | * |
| 176 | * @since 1.0.0 |
| 177 | * @access public |
| 178 | */ |
| 179 | public function required_plugins_check() { |
| 180 | |
| 181 | // Early return if Elementor is already active. |
| 182 | if ( Helper_Functions::check_elementor_version() ) { |
| 183 | return; |
| 184 | } |
| 185 | |
| 186 | $elementor_path = sprintf( '%1$s/%1$s.php', self::$elementor ); |
| 187 | |
| 188 | $message = ''; |
| 189 | |
| 190 | if ( ! Helper_Functions::is_plugin_installed( $elementor_path ) ) { |
| 191 | |
| 192 | if ( ! Admin_Helper::check_user_can( 'install_plugins' ) ) { |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | $install_url = wp_nonce_url( self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', self::$elementor ) ), 'install-plugin_elementor' ); |
| 197 | |
| 198 | $message = sprintf( '<p>%s</p>', __( 'Premium Addons for Elementor is not working because you need to Install Elementor plugin.', 'premium-addons-for-elementor' ) ); |
| 199 | |
| 200 | $message .= sprintf( '<p><a href="%s" class="button-primary">%s</a></p>', $install_url, __( 'Install Now', 'premium-addons-for-elementor' ) ); |
| 201 | |
| 202 | } elseif ( Admin_Helper::check_user_can( 'activate_plugins' ) ) { |
| 203 | |
| 204 | $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $elementor_path . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $elementor_path ); |
| 205 | |
| 206 | $message = '<p>' . __( 'Premium Addons for Elementor is not working because you need to activate Elementor plugin.', 'premium-addons-for-elementor' ) . '</p>'; |
| 207 | |
| 208 | $message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $activation_url, __( 'Activate Now', 'premium-addons-for-elementor' ) ) . '</p>'; |
| 209 | } else { |
| 210 | return; |
| 211 | } |
| 212 | |
| 213 | if ( ! empty( $message ) ) { |
| 214 | $this->render_admin_notices( $message ); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Get Review Text |
| 220 | * |
| 221 | * Gets admin review notice HTML. |
| 222 | * |
| 223 | * @since 2.8.4 |
| 224 | * @access public |
| 225 | * |
| 226 | * @param string $review_url plugin page. |
| 227 | * @param string $optout_url redirect url. |
| 228 | */ |
| 229 | public function get_review_text( $review_url, $optout_url ) { |
| 230 | |
| 231 | $notice = sprintf( |
| 232 | '<p>' . __( 'Could we take just 2 minutes of your time? We\'d be incredibly grateful if you could give ', 'premium-addons-for-elementor' ) . |
| 233 | '<b>' . __( 'Premium Addons for Elementor', 'premium-addons-for-elementor' ) . '</b> a 5 Stars Rating on WordPress.org. Your support helps us continue creating even more amazing free features in the future!</p> |
| 234 | <div> |
| 235 | <a class="button pa-review-btn button-primary" href="%s" target="_blank"><span>' . __( 'Sure, leave a Review', 'premium-addons-for-elementor' ) . '</span></a> |
| 236 | <a class="button" href="%2$s"><span>' . __( 'I Already Did', 'premium-addons-for-elementor' ) . '</span></a> |
| 237 | <a class="button button-secondary pa-notice-reset"><span>' . __( 'Maybe Later', 'premium-addons-for-elementor' ) . '</span></a> |
| 238 | </div>', |
| 239 | $review_url, |
| 240 | $optout_url |
| 241 | ); |
| 242 | |
| 243 | return $notice; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Checks if review admin notice is dismissed |
| 248 | * |
| 249 | * @since 2.6.8 |
| 250 | * @return void |
| 251 | */ |
| 252 | public function show_review_notice() { |
| 253 | |
| 254 | $review_url = 'https://wordpress.org/support/plugin/premium-addons-for-elementor/reviews/#new-post'; |
| 255 | |
| 256 | $optout_url = wp_nonce_url( add_query_arg( 'pa_review', 'opt_out' ), 'opt_out' ); |
| 257 | ?> |
| 258 | |
| 259 | <div class="error pa-notice-wrap pa-review-notice" data-notice="pa-review"> |
| 260 | <div class="pa-img-wrap"> |
| 261 | <img src="<?php echo esc_url( PREMIUM_ADDONS_URL . 'admin/images/pa-logo-symbol.png' ); ?>"> |
| 262 | </div> |
| 263 | <div class="pa-text-wrap"> |
| 264 | <?php echo wp_kses_post( $this->get_review_text( $review_url, $optout_url ) ); ?> |
| 265 | </div> |
| 266 | <div class="pa-notice-close"> |
| 267 | <a href="<?php echo esc_url( $optout_url ); ?>"><span class="dashicons dashicons-dismiss"></span></a> |
| 268 | </div> |
| 269 | </div> |
| 270 | |
| 271 | <?php |
| 272 | } |
| 273 | |
| 274 | public function get_content_toggle_notice() { |
| 275 | |
| 276 | $option = get_option( 'content-toggle-not' ); |
| 277 | |
| 278 | if ( '1' === $option ) { |
| 279 | return; |
| 280 | } |
| 281 | |
| 282 | $link = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-content-toggle-widget/', 'content-toggle-notification', 'wp-dash', 'content-toggle' ); |
| 283 | |
| 284 | ?> |
| 285 | |
| 286 | <div class="error pa-notice-wrap pa-new-feature-notice"> |
| 287 | <div class="pa-img-wrap"> |
| 288 | <img src="<?php echo PREMIUM_ADDONS_URL . 'admin/images/pa-logo-symbol.png'; ?>"> |
| 289 | </div> |
| 290 | <div class="pa-text-wrap"> |
| 291 | <p> |
| 292 | <strong><?php echo __( 'Elementor Content Toggle Widget', 'premium-addons-for-elementor' ); ?></strong> |
| 293 | <?php printf( __( 'has been rebuilt. <a href="%s" target="_blank">Check it out now!</a>', 'premium-addons-for-elementor' ), $link ); ?> |
| 294 | </p> |
| 295 | </div> |
| 296 | <div class="pa-notice-close" data-notice="content-toggle-not"> |
| 297 | <span class="dashicons dashicons-dismiss"></span> |
| 298 | </div> |
| 299 | </div> |
| 300 | |
| 301 | <?php |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Get Promotion Message |
| 306 | * |
| 307 | * @since 4.11.43 |
| 308 | * @access private |
| 309 | * |
| 310 | * @param string $type promotion type. |
| 311 | * @return array |
| 312 | */ |
| 313 | private function get_promotion_message( $type = 'new' ) { |
| 314 | |
| 315 | if ( 'upgrade' === $type ) { |
| 316 | return array( |
| 317 | 'message' => __( 'Get a <b>FLAT 30% OFF</b> when you upgrade to <b>Premium Addons Pro Lifetime</b>. Use code <b>BFUL2025</b> at checkout – <b>expires soon!</b>', 'premium-addons-for-elementor' ), |
| 318 | 'cta' => __( 'Upgrade Now', 'premium-addons-for-elementor' ), |
| 319 | ); |
| 320 | |
| 321 | } |
| 322 | |
| 323 | return array( |
| 324 | 'message' => __( '<b>Cyber Monday – Save Up To 30% on Premium Addons Pro</b>.', 'premium-addons-for-elementor' ), |
| 325 | 'cta' => __( 'Catch The Deal', 'premium-addons-for-elementor' ), |
| 326 | ); |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * Renders an admin notice error message |
| 331 | * |
| 332 | * @since 1.0.0 |
| 333 | * @access private |
| 334 | * |
| 335 | * @param string $message notice text. |
| 336 | * @param string $class notice class. |
| 337 | * @param string $handle notice handle. |
| 338 | * |
| 339 | * @return void |
| 340 | */ |
| 341 | private function render_admin_notices( $message, $class = '', $handle = '' ) { |
| 342 | ?> |
| 343 | <div class="error pa-new-feature-notice <?php echo esc_attr( $class ); ?>" data-notice="<?php echo esc_attr( $handle ); ?>"> |
| 344 | <?php echo wp_kses_post( $message ); ?> |
| 345 | </div> |
| 346 | <?php |
| 347 | } |
| 348 | |
| 349 | |
| 350 | |
| 351 | /** |
| 352 | * Register admin scripts |
| 353 | * |
| 354 | * @since 3.2.8 |
| 355 | * @access public |
| 356 | */ |
| 357 | public function admin_enqueue_scripts() { |
| 358 | |
| 359 | // Skip loading scripts during AJAX or REST requests. |
| 360 | if ( wp_doing_ajax() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { |
| 361 | return; |
| 362 | } |
| 363 | |
| 364 | wp_enqueue_script( |
| 365 | 'pa-dashboard', |
| 366 | PREMIUM_ADDONS_URL . 'admin/assets/js/pa-dashboard.js', |
| 367 | array( 'jquery' ), |
| 368 | PREMIUM_ADDONS_VERSION, |
| 369 | true |
| 370 | ); |
| 371 | |
| 372 | wp_localize_script( |
| 373 | 'pa-dashboard', |
| 374 | 'PaNoticeSettings', |
| 375 | array( |
| 376 | 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ), |
| 377 | 'nonce' => wp_create_nonce( 'pa-notice-nonce' ), |
| 378 | 'feedback_nonce' => wp_create_nonce( 'pa-feedback-nonce' ), |
| 379 | ) |
| 380 | ); |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Set transient for admin notice |
| 385 | * |
| 386 | * @since 3.2.8 |
| 387 | * @access public |
| 388 | * |
| 389 | * @return void |
| 390 | */ |
| 391 | public function reset_admin_notice() { |
| 392 | |
| 393 | check_ajax_referer( 'pa-notice-nonce', 'nonce' ); |
| 394 | |
| 395 | if ( ! Admin_Helper::check_user_can( 'manage_options' ) ) { |
| 396 | wp_send_json_error(); |
| 397 | } |
| 398 | |
| 399 | $key = isset( $_POST['notice'] ) ? sanitize_text_field( wp_unslash( $_POST['notice'] ) ) : ''; |
| 400 | |
| 401 | if ( ! empty( $key ) && in_array( $key, self::$notices, true ) ) { |
| 402 | |
| 403 | $cache_key = 'pa_review_notice'; |
| 404 | |
| 405 | set_transient( $cache_key, true, WEEK_IN_SECONDS ); |
| 406 | |
| 407 | wp_send_json_success(); |
| 408 | |
| 409 | } else { |
| 410 | |
| 411 | wp_send_json_error(); |
| 412 | |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * Dismiss admin notice |
| 418 | * |
| 419 | * @since 3.11.7 |
| 420 | * @access public |
| 421 | * |
| 422 | * @return void |
| 423 | */ |
| 424 | public function dismiss_admin_notice() { |
| 425 | |
| 426 | check_ajax_referer( 'pa-notice-nonce', 'nonce' ); |
| 427 | |
| 428 | if ( ! current_user_can( 'manage_options' ) ) { |
| 429 | wp_send_json_error(); |
| 430 | } |
| 431 | |
| 432 | $key = isset( $_POST['notice'] ) ? sanitize_text_field( wp_unslash( $_POST['notice'] ) ) : ''; |
| 433 | |
| 434 | if ( ! empty( $key ) && in_array( $key, self::$notices, true ) ) { |
| 435 | |
| 436 | // Make sure new features notices will not appear again. |
| 437 | if ( false !== strpos( $key, 'not' ) ) { |
| 438 | update_option( $key, '1' ); |
| 439 | } else { |
| 440 | set_transient( $key, true, 20 * DAY_IN_SECONDS ); |
| 441 | |
| 442 | } |
| 443 | |
| 444 | wp_send_json_success(); |
| 445 | |
| 446 | } else { |
| 447 | |
| 448 | wp_send_json_error(); |
| 449 | |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | /** |
| 454 | * Check Status |
| 455 | * |
| 456 | * @since 4.10.15 |
| 457 | * @access public |
| 458 | */ |
| 459 | public function check_status( $key ) { |
| 460 | |
| 461 | $status = false; |
| 462 | |
| 463 | $api_params = array( |
| 464 | 'edd_action' => 'check_license', |
| 465 | 'license' => $key, |
| 466 | 'item_id' => 361, |
| 467 | ); |
| 468 | |
| 469 | $response = wp_remote_get( |
| 470 | 'https://my.leap13.com', |
| 471 | array( |
| 472 | 'timeout' => 15, |
| 473 | 'sslverify' => false, |
| 474 | 'body' => $api_params, |
| 475 | ) |
| 476 | ); |
| 477 | |
| 478 | if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { |
| 479 | return false; |
| 480 | } |
| 481 | |
| 482 | $body = wp_remote_retrieve_body( $response ); |
| 483 | |
| 484 | $body = json_decode( $body, true ); |
| 485 | |
| 486 | if ( isset( $body['license'] ) && 'valid' === $body['license'] ) { |
| 487 | $status = true; |
| 488 | } |
| 489 | |
| 490 | return $status; |
| 491 | } |
| 492 | |
| 493 | /** |
| 494 | * Get PA Stories |
| 495 | * |
| 496 | * Gets a list of the latest three blog posts |
| 497 | * |
| 498 | * @since 4.10.64 |
| 499 | * |
| 500 | * @access public |
| 501 | */ |
| 502 | public function get_pa_stories() { |
| 503 | |
| 504 | $stories = get_transient( 'pa_stories_' . PREMIUM_ADDONS_VERSION ); |
| 505 | |
| 506 | if ( ! $stories ) { |
| 507 | |
| 508 | $api_url = 'https://premiumaddons.com/wp-json/stories/v2/get'; |
| 509 | |
| 510 | $response = wp_remote_get( |
| 511 | $api_url, |
| 512 | array( |
| 513 | 'timeout' => 15, |
| 514 | 'sslverify' => true, |
| 515 | ) |
| 516 | ); |
| 517 | |
| 518 | if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { |
| 519 | set_transient( 'pa_stories_' . PREMIUM_ADDONS_VERSION, true, WEEK_IN_SECONDS ); |
| 520 | return false; |
| 521 | } |
| 522 | |
| 523 | $body = wp_remote_retrieve_body( $response ); |
| 524 | $stories = json_decode( $body, true ); |
| 525 | |
| 526 | set_transient( 'pa_stories_' . PREMIUM_ADDONS_VERSION, $stories, WEEK_IN_SECONDS ); |
| 527 | |
| 528 | } |
| 529 | |
| 530 | $this->stories = $stories; |
| 531 | |
| 532 | return $stories; |
| 533 | } |
| 534 | |
| 535 | public function show_story_widget() { |
| 536 | |
| 537 | $stories = $this->get_pa_stories(); |
| 538 | |
| 539 | if ( ! is_array( $stories ) || empty( $stories ) ) { |
| 540 | return; |
| 541 | } |
| 542 | |
| 543 | wp_add_dashboard_widget( |
| 544 | 'pa-stories', |
| 545 | __( 'Premium Addons News', 'premium-addons-for-elementor' ), |
| 546 | array( $this, 'show' ), |
| 547 | null, |
| 548 | null, |
| 549 | 'column3', |
| 550 | 'core' |
| 551 | ); |
| 552 | } |
| 553 | |
| 554 | |
| 555 | public function show() { |
| 556 | |
| 557 | $stories = $this->stories; |
| 558 | |
| 559 | $time = time(); |
| 560 | |
| 561 | $papro_path = 'premium-addons-pro/premium-addons-pro-for-elementor.php'; |
| 562 | |
| 563 | $license_data = get_transient( 'pa_license_info' ); |
| 564 | $highlight = false; |
| 565 | |
| 566 | if ( isset( $license_data['status'] ) && 'valid' === $license_data['status'] ) { |
| 567 | |
| 568 | if ( isset( $license_data['id'] ) && '4' !== $license_data['id'] ) { |
| 569 | |
| 570 | $highlight = true; |
| 571 | array_unshift( |
| 572 | $stories['posts'], |
| 573 | array( |
| 574 | 'title' => 'Switch to Premium Addons Pro Lifetime, Pay the Difference & Save 30% Today!', |
| 575 | 'link' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/upgrade-premium-addons-license/', 'wp-dash', 'summer26-dash-widget', 'summer26' ), |
| 576 | ) |
| 577 | ); |
| 578 | |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | ?> |
| 583 | <style> |
| 584 | .pa-banners-grid { |
| 585 | margin-bottom: 10px; |
| 586 | } |
| 587 | |
| 588 | .pa-stories-banner { |
| 589 | position: relative; |
| 590 | } |
| 591 | |
| 592 | .pa-stories-banner a { |
| 593 | position: absolute; |
| 594 | inset: 0; |
| 595 | } |
| 596 | |
| 597 | .pa-story-img-container img { |
| 598 | width: 100%; |
| 599 | display: block; |
| 600 | } |
| 601 | |
| 602 | .pa-news-post { |
| 603 | margin-bottom: 5px; |
| 604 | } |
| 605 | |
| 606 | .pa-news-post a { |
| 607 | font-weight: 500; |
| 608 | color: #0073aa; |
| 609 | text-decoration: none; |
| 610 | padding-bottom: 5px; |
| 611 | display: inline-block; |
| 612 | } |
| 613 | |
| 614 | .pa-dashboard-widget-block { |
| 615 | width: 100%; |
| 616 | } |
| 617 | |
| 618 | .pa-footer-bar { |
| 619 | border-top: 1px solid #eee; |
| 620 | padding-top: 1rem; |
| 621 | display: flex; |
| 622 | justify-content: space-between; |
| 623 | } |
| 624 | |
| 625 | .pa-dashboard-widget-block a { |
| 626 | text-decoration: none; |
| 627 | font-size: 13px; |
| 628 | color: #007cba; |
| 629 | } |
| 630 | |
| 631 | .pa-dashboard-widget-block .dashicons { |
| 632 | vertical-align: middle; |
| 633 | font-size: 17px; |
| 634 | } |
| 635 | </style> |
| 636 | |
| 637 | |
| 638 | <div class="pa-banners-grid"> |
| 639 | |
| 640 | <?php foreach ( $stories['banners'] as $index => $banner ) : ?> |
| 641 | |
| 642 | <?php if ( isset( $banner['end'] ) && $time < $banner['end'] ) : ?> |
| 643 | |
| 644 | <div class="pa-stories-banner"> |
| 645 | <div class="pa-story-img-container"> |
| 646 | <img src="<?php echo esc_url( $banner['image'] ); ?>" alt="<?php echo esc_attr( $banner['description'] ); ?>"> |
| 647 | </div> |
| 648 | <a href="<?php echo esc_url( Helper_Functions::get_campaign_link( $banner['link'], 'wp-dash', 'dash-widget', 'summer26' ) ); ?>" target="_blank" title="<?php echo esc_attr( $banner['description'] ); ?>"></a> |
| 649 | </div> |
| 650 | |
| 651 | <?php endif; ?> |
| 652 | |
| 653 | <?php endforeach; ?> |
| 654 | |
| 655 | </div> |
| 656 | |
| 657 | |
| 658 | <div class="pa-posts-grid"> |
| 659 | |
| 660 | <?php foreach ( $stories['posts'] as $index => $post ) : ?> |
| 661 | |
| 662 | <div class="pa-news-post"> |
| 663 | <a style="<?php echo 0 === $index && $highlight ? 'color: #93003f' : ''; ?>" target="_blank" href="<?php echo esc_url( $post['link'] ); ?>"> |
| 664 | <?php echo wp_kses_post( $post['title'] ); ?> |
| 665 | </a> |
| 666 | </div> |
| 667 | |
| 668 | <?php endforeach; ?> |
| 669 | |
| 670 | </div> |
| 671 | |
| 672 | <div class="pa-dashboard-widget-block"> |
| 673 | <div class="pa-footer-bar"> |
| 674 | <a href="https://wordpress.org/support/plugin/premium-addons-for-elementor/" target="_blank" style="color: #27ae60"> |
| 675 | Need Help? |
| 676 | <span aria-hidden="true" class="dashicons dashicons-external"></span> |
| 677 | </a> |
| 678 | <a href="https://www.youtube.com/leap13" target="_blank" style="color: #e1002d"> |
| 679 | YouTube Channel |
| 680 | <span aria-hidden="true" class="dashicons dashicons-youtube"></span> |
| 681 | </a> |
| 682 | <a href="https://www.facebook.com/groups/PremiumAddons" target="_blank" style="color: #1877F2;"> |
| 683 | Facebook Community |
| 684 | <span aria-hidden="true" class="dashicons dashicons-facebook-alt"></span> |
| 685 | </a> |
| 686 | </div> |
| 687 | </div> |
| 688 | |
| 689 | <?php |
| 690 | } |
| 691 | |
| 692 | /** |
| 693 | * Creates and returns an instance of the class |
| 694 | * |
| 695 | * @since 2.8.4 |
| 696 | * @access public |
| 697 | * |
| 698 | * @return object |
| 699 | */ |
| 700 | public static function get_instance() { |
| 701 | |
| 702 | if ( ! isset( self::$instance ) ) { |
| 703 | |
| 704 | self::$instance = new self(); |
| 705 | |
| 706 | } |
| 707 | |
| 708 | return self::$instance; |
| 709 | } |
| 710 | } |
| 711 |