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
|
<?php /** * WPSEO plugin file. * * @package WPSEO\Admin\Import\Plugins */
/** * Class WPSEO_Import_Plugin. * * Class with functionality to import Yoast SEO settings from other plugins. */ class WPSEO_Import_Plugin {
/** * @var WPSEO_Import_Status */ public $status;
/** * @var WPSEO_Plugin_Importer */ protected $importer;
/** * Import class constructor. * * @param WPSEO_Plugin_Importer $importer The importer that needs to perform this action. * @param string $action The action to perform. */ public function __construct( WPSEO_Plugin_Importer $importer, $action ) { $this->importer = $importer;
switch ( $action ) { case 'cleanup': $this->status = $this->importer->run_cleanup(); break; case 'import': $this->status = $this->importer->run_import(); break; case 'detect': default: $this->status = $this->importer->run_detect(); }
$this->status->set_msg( $this->complete_msg( $this->status->get_msg() ) ); }
/** * Convenience function to replace %s with plugin name in import message. * * @param string $msg Message string. * * @return string Returns message with plugin name instead of replacement variables. */ protected function complete_msg( $msg ) { return sprintf( $msg, $this->importer->get_plugin_name() ); } }
|