Issues (2187)

classes/class-lsx-wetu-importer-welcome.php (25 issues)

1
<?php
2
/**
3
 * The Welcome Screen for the Importer Plugin
4
 *
5
 * @package   lsx_wetu_importer
6
 * @author    LightSpeed
7
 * @license   GPL-2.0+
8
 * @link
9
 * @copyright 2019 LightSpeed
10
 **/
11
12
/**
13
 * The Welcome Screen for the Importer Plugin
14
 */
15
class LSX_WETU_Importer_Welcome {
16
17
	/**
18
	 * Holds instance of the class
19
	 *
20
	 * @var object
21
	 */
22
	private static $instance;
23
24
	/**
25
	 * Initialize the plugin by setting localization, filters, and administration functions.
26
	 *
27
	 * @since 1.0.0
28
	 *
29
	 * @access private
30
	 */
31
	public function __construct() {
0 ignored issues
show
Expected 2 blank lines before function; 1 found
Loading history...
32
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
33
34
	/**
35
	 * Return an instance of this class.
36
	 *
37
	 * @return  object
38
	 */
39
	public static function get_instance() {
40
		// If the single instance hasn't been set, set it now.
41
		if ( ! isset( self::$instance ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
42
			self::$instance = new self();
43
		}
0 ignored issues
show
No blank line found after control structure
Loading history...
44
		return self::$instance;
45
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
46
47
	/**
48
	 * Display the importer welcome screen
49
	 */
50
	public function display_page() {
51
		?>
52
		<div class="row section">
53
			<h1><?php esc_html_e( 'Welcome to the LSX Importer for Wetu', 'lsx-wetu-importer' ); ?></h1>
54
			<p><?php esc_html_e( 'If this is the first time running the import, please follow the steps below.', 'lsx-wetu-importer' ); ?></p>
55
		</div>
56
		<?php
57
		$this->importer_steps();
58
		$this->welcome_blocks();
59
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
60
61
	/**
62
	 * Undocumented function
63
	 *
64
	 * @return void
65
	 */
66
	public function importer_steps() {
67
		?>
68
		<div class="row section postbox">
69
			<div class="welcome-block-header">
70
				<p class="heading"><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=tour' ); ?>"><?php esc_html_e( 'Import your tours', 'lsx-wetu-importer' ); ?></a></p>
71
				<p class="value"><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=tour' ); ?>"><span>1</span></a></p>
72
			</div>
73
			<div class="welcome-block-header">
74
				<p class="heading"><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>"><?php esc_html_e( 'Import accommodation', 'lsx-wetu-importer' ); ?></a></p>
75
				<p class="value"><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>"><span>2</span></a></p>
76
			</div>
77
			<div class="welcome-block-header">
78
				<p class="heading"><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>"><?php esc_html_e( 'Import destination', 'lsx-wetu-importer' ); ?></a></p>
79
				<p class="value"><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>"><span>3</span></a></p>
80
			</div>
81
			<div class="welcome-block-header">
82
				<p class="heading"><?php esc_html_e( 'Done', 'lsx-wetu-importer' ); ?></p>
83
				<p class="value"><span class="dashicons dashicons-yes"></span></p>
84
			</div>
85
			<div class="spacer"></div>
86
		</div>
87
		<?php
88
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
89
90
	/**
91
	 * Outputs the welcome blocks on the welcome screen
92
	 *
93
	 * @return void
94
	 */
95
	public function welcome_blocks() {
96
		?>
97
		<div class="row section">
98
			<div class="welcome-block postbox">
99
				<?php $this->tour_block(); ?>
100
			</div>
101
			<div class="welcome-block postbox">
102
				<?php $this->accommodation_block(); ?>
103
			</div>
104
			<div class="welcome-block postbox">
105
				<?php $this->destination_block(); ?>
106
			</div>
107
			<div class="welcome-block postbox">
108
				<?php $this->end_block(); ?>
109
			</div>
110
		</div>
111
		<?php
112
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
113
114
	/**
115
	 * Outputs the Tour Block.
116
	 *
117
	 * @return void
118
	 */
119
	public function tour_block() {
120
		?>
121
			<h2 class="title"><?php esc_html_e( 'Importing tours', 'lsx-wetu-importer' ); ?></h2>
122
			<p class="excerpt"><?php esc_html_e( 'Search for tours, select the ones you want to import and choose the data you want to sync on import. All connected accommodadtions will be imported as drafts to be pubished after completing the tour import.', 'lsx-wetu-importer' ); ?></p>
123
			<p><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=tour' ); ?>" class="button button-primary"><?php esc_html_e( 'Import Tours', 'lsx-wetu-importer' ); ?></a></p>
124
			<p>
125
				<ul class="link-list">
126
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=tour' ); ?>#publish"><?php esc_html_e( 'Published', 'lsx-wetu-importer' ); ?>  (<?php echo esc_attr( lsx_wetu_get_post_count( 'tour', 'publish ' ) ); ?>)</a></li>
0 ignored issues
show
lsx_wetu_get_post_count('tour', 'publish ') of type void is incompatible with the type string expected by parameter $text of esc_attr(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

126
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=tour' ); ?>#publish"><?php esc_html_e( 'Published', 'lsx-wetu-importer' ); ?>  (<?php echo esc_attr( /** @scrutinizer ignore-type */ lsx_wetu_get_post_count( 'tour', 'publish ' ) ); ?>)</a></li>
Loading history...
127
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=tour' ); ?>#pending"><?php esc_html_e( 'Pending', 'lsx-wetu-importer' ); ?>  (<?php echo esc_attr( lsx_wetu_get_post_count( 'tour', 'pending ' ) ); ?>)</a></li>
128
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=tour' ); ?>#draft"><?php esc_html_e( 'Draft', 'lsx-wetu-importer' ); ?>  (<?php echo esc_attr( lsx_wetu_get_post_count( 'tour', 'draft ' ) ); ?>)</a></li>
129
				</ul>
130
			</p>			
131
		<?php
132
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
133
	/**
134
	 * Outputs the Accommodation Block.
135
	 *
136
	 * @return void
137
	 */
138
	public function accommodation_block() {
139
		?>
140
			<h2 class="title"><?php esc_html_e( 'Import and publish accommodation', 'lsx-wetu-importer' ); ?></h2>
141
			<p class="excerpt"><?php esc_html_e( 'All accommodations connnected to your tours have been imported as drafts. Review the imported accommodations, sync selected data and publish.', 'lsx-wetu-importer' ); ?></p>
142
			<p><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>" class="button button-primary"><?php esc_html_e( 'Sync accommodation', 'lsx-wetu-importer' ); ?></a></p>
143
144
			<p>
145
				<ul class="link-list">
146
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>#publish"><?php esc_html_e( 'Published', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( lsx_wetu_get_post_count( 'accommodation', 'publish ' ) ); ?>)</a></li>
0 ignored issues
show
lsx_wetu_get_post_count(...mmodation', 'publish ') of type void is incompatible with the type string expected by parameter $text of esc_attr(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

146
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>#publish"><?php esc_html_e( 'Published', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( /** @scrutinizer ignore-type */ lsx_wetu_get_post_count( 'accommodation', 'publish ' ) ); ?>)</a></li>
Loading history...
147
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>#pending"><?php esc_html_e( 'Pending', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( lsx_wetu_get_post_count( 'accommodation', 'pending ' ) ); ?>)</a></li>
148
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>#draft"><?php esc_html_e( 'Draft', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( lsx_wetu_get_post_count( 'accommodation', 'draft ' ) ); ?>)</a></li>
149
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=accommodation' ); ?>#import"><?php esc_html_e( 'Wetu Queue', 'lsx-wetu-importer' ); ?>  (<?php echo esc_attr( lsx_wetu_get_queue_count( 'accommodation' ) ); ?>)</a></li>
150
				</ul>
151
			</p>			
152
		<?php
153
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
154
	/**
155
	 * Outputs the Destination Block.
156
	 *
157
	 * @return void
158
	 */
159
	public function destination_block() {
160
		?>
161
			<h2 class="title"><?php esc_html_e( 'Import and publish destinations', 'lsx-wetu-importer' ); ?></h2>
162
			<p class="excerpt"><?php esc_html_e( 'All destinations and regions connnected to your tours & accommodations have been imported as drafts. Review the imported accommodations, sync selected data and publish.', 'lsx-wetu-importer' ); ?></p>
163
			<p><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>" class="button button-primary"><?php esc_html_e( 'Sync destinations', 'lsx-wetu-importer' ); ?></a></p>
164
			<p>
165
				<ul class="link-list">
166
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>#publish"><?php esc_html_e( 'Published', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( lsx_wetu_get_post_count( 'destination', 'publish ' ) ); ?>)</a></li>
0 ignored issues
show
lsx_wetu_get_post_count(...stination', 'publish ') of type void is incompatible with the type string expected by parameter $text of esc_attr(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

166
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>#publish"><?php esc_html_e( 'Published', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( /** @scrutinizer ignore-type */ lsx_wetu_get_post_count( 'destination', 'publish ' ) ); ?>)</a></li>
Loading history...
167
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>#pending"><?php esc_html_e( 'Pending', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( lsx_wetu_get_post_count( 'destination', 'pending ' ) ); ?>)</a></li>
168
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>#draft"><?php esc_html_e( 'Draft', 'lsx-wetu-importer' ); ?> (<?php echo esc_attr( lsx_wetu_get_post_count( 'destination', 'draft ' ) ); ?>)</a></li>
169
					<li><a href="<?php echo esc_attr( admin_url( 'admin.php' ) . '?page=lsx-wetu-importer&tab=destination' ); ?>#import"><?php esc_html_e( 'Wetu Queue', 'lsx-wetu-importer' ); ?>  (<?php echo esc_attr( lsx_wetu_get_queue_count( 'destination' ) ); ?>)</a></li>
170
				</ul>
171
			</p>
172
		<?php
173
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
174
	/**
175
	 * Outputs the last welcome block
176
	 *
177
	 * @return void
178
	 */
179
	public function end_block() {
180
		?>
181
			<h2 class="title"><?php esc_html_e( 'Done! Check out your imported content', 'lsx-wetu-importer' ); ?></h2>
182
			<p><?php esc_html_e( 'If you’ve updated your content on Wetu then you can return to these steps at any stage to import and re-sync any updates', 'lsx-wetu-importer' ); ?></p>
183
		<?php
184
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 0 found
Loading history...
185
}
186