|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Wordlift\Videoobject\Pages; |
|
4
|
|
|
|
|
5
|
|
View Code Duplication |
class Import_Videos_Page { |
|
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Sync_Page constructor. |
|
9
|
|
|
*/ |
|
10
|
|
|
public function __construct() { |
|
11
|
|
|
|
|
12
|
|
|
add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
13
|
|
|
|
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
public function admin_menu() { |
|
17
|
|
|
|
|
18
|
|
|
add_submenu_page( 'wl_admin_menu', |
|
19
|
|
|
__( 'Import all videos', 'wordlift' ), |
|
20
|
|
|
__( 'Import all videos', 'wordlift' ), |
|
21
|
|
|
'manage_options', 'wl_videos_import', array( |
|
22
|
|
|
$this, |
|
23
|
|
|
'render' |
|
24
|
|
|
) ); |
|
25
|
|
|
|
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function render() { |
|
29
|
|
|
|
|
30
|
|
|
wp_enqueue_style( |
|
31
|
|
|
'wl-tasks-page', |
|
32
|
|
|
plugin_dir_url( dirname( __FILE__ ) ) . 'tasks/admin/assets/tasks-page.css', |
|
33
|
|
|
array(), |
|
34
|
|
|
\Wordlift::get_instance()->get_version(), |
|
35
|
|
|
'all' ); |
|
36
|
|
|
wp_enqueue_script( |
|
37
|
|
|
'wl-dataset-sync-page', |
|
38
|
|
|
plugin_dir_url( __FILE__ ) . 'assets/videoobject-import-page.js', |
|
39
|
|
|
array( 'wp-api' ), |
|
40
|
|
|
\Wordlift::get_instance()->get_version() ); |
|
41
|
|
|
|
|
42
|
|
|
?> |
|
43
|
|
|
<div class="wrap"> |
|
44
|
|
|
<h2><?php esc_html_e( 'Import all videos', 'wordlift' ); ?></h2> |
|
45
|
|
|
|
|
46
|
|
|
<div class="wl-task__progress" style="border: 1px solid #23282D; height: 20px; margin: 8px 0;"> |
|
47
|
|
|
<div class="wl-task__progress__bar" |
|
48
|
|
|
style="width:0;background: #0073AA; text-align: center; height: 100%; color: #fff;"></div> |
|
49
|
|
|
</div> |
|
50
|
|
|
|
|
51
|
|
|
<button id="wl-start-btn" type="button" class="button button-large button-primary"><?php |
|
52
|
|
|
esc_html_e( 'Start', 'wordlift' ); ?></button> |
|
53
|
|
|
<button id="wl-stop-btn" type="button" class="button button-large button-primary hidden"><?php |
|
54
|
|
|
esc_html_e( 'Stop', 'wordlift' ); ?></button> |
|
55
|
|
|
|
|
56
|
|
|
</div> |
|
57
|
|
|
<?php |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
} |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.