/var/www/html_uk/wp-content/plugins/automatewoo/includes/AdminNotices/AddonWelcome.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php

namespace AutomateWoo\AdminNotices;

use 
AutomateWoo\Addon;
use 
AutomateWoo\Addons;
use 
AutomateWoo\Admin;

defined'ABSPATH' ) || exit;

/**
 * Class AddonWelcome
 *
 * @since 5.2.0
 */
class AddonWelcome extends AbstractAdminNotice {

    
/**
     * The name of the add-on.
     *
     * @var Addon
     */
    
protected $addon;

    
/**
     * AddonWelcome constructor.
     *
     * @param Addon $addon
     */
    
public function __constructAddon $addon ) {
        
$this->addon $addon;
    }

    
/**
     * Get the unique notice ID.
     *
     * @return string
     */
    
protected function get_id(): string {
        return 
'addon_welcome_' $this->addon->id;
    }

    
/**
     * Output/render the notice HTML.
     */
    
public function output() {
        
$message '';

        
$start_url $this->addon->get_getting_started_url();

        if ( 
$start_url ) {
            
$message .= sprintf(
                
/* translators: %1$s: opening link tag, %2$s: closing link tag */
                
'View the <%1$s>getting started guide<%2$s>.',
                
'a href="' esc_url$start_url ) . '" target="_blank"',
                
'/a'
            
);
        }

        
/* translators: Addon name. */
        
$strong sprintf__'Welcome to the %s add-on!''automatewoo' ), $this->addon->name );

        
Admin::get_view(
            
'simple-notice',
            [
                
'notice_identifier' => $this->get_id(),
                
'type'              => 'info',
                
'class'             => 'is-dismissible',
                
'strong'            => $strong,
                
'message'           => $message,
            ]
        );
    }
}