/var/www/hkosl.com/aga/wp-content/plugins/wordpress-seo/admin/import/class-import-status.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin\Import
 */

/**
 * Class WPSEO_ImportStatus.
 *
 * Holds the status of and message about imports.
 */
class WPSEO_Import_Status {

    
/**
     * The import status.
     *
     * @var bool
     */
    
public $status false;

    
/**
     * The import message.
     *
     * @var string
     */
    
private $msg '';

    
/**
     * The type of action performed.
     *
     * @var string
     */
    
private $action;

    
/**
     * WPSEO_Import_Status constructor.
     *
     * @param string $action The type of import action.
     * @param bool   $status The status of the import.
     * @param string $msg    Extra messages about the status.
     */
    
public function __construct$action$status$msg '' ) {
        
$this->action $action;
        
$this->status $status;
        
$this->msg    $msg;
    }

    
/**
     * Get the import message.
     *
     * @return string Message about current status.
     */
    
public function get_msg() {
        if ( 
$this->msg !== '' ) {
            return 
$this->msg;
        }

        if ( 
$this->status === false ) {
            
/* translators: %s is replaced with the name of the plugin we're trying to find data from. */
            
return __'%s data not found.''wordpress-seo' );
        }

        return 
$this->get_default_success_message();
    }

    
/**
     * Get the import action.
     *
     * @return string Import action type.
     */
    
public function get_action() {
        return 
$this->action;
    }

    
/**
     * Set the import action, set status to false.
     *
     * @param string $action The type of action to set as import action.
     *
     * @return void
     */
    
public function set_action$action ) {
        
$this->action $action;
        
$this->status false;
    }

    
/**
     * Sets the importer status message.
     *
     * @param string $msg The message to set.
     *
     * @return void
     */
    
public function set_msg$msg ) {
        
$this->msg $msg;
    }

    
/**
     * Sets the importer status.
     *
     * @param bool $status The status to set.
     *
     * @return WPSEO_Import_Status The current object.
     */
    
public function set_status$status ) {
        
$this->status = (bool) $status;

        return 
$this;
    }

    
/**
     * Returns a success message depending on the action.
     *
     * @return string Returns a success message for the current action.
     */
    
private function get_default_success_message() {
        switch ( 
$this->action ) {
            case 
'import':
                
/* translators: %s is replaced with the name of the plugin we're importing data from. */
                
return __'%s data successfully imported.''wordpress-seo' );
            case 
'cleanup':
                
/* translators: %s is replaced with the name of the plugin we're removing data from. */
                
return __'%s data successfully removed.''wordpress-seo' );
            case 
'detect':
            default:
                
/* translators: %s is replaced with the name of the plugin we've found data from. */
                
return __'%s data found.''wordpress-seo' );
        }
    }
}