|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Wordlift\Vocabulary\Pages; |
|
4
|
|
|
|
|
5
|
|
|
use Wordlift\Scripts\Scripts_Helper; |
|
6
|
|
|
use Wordlift\Vocabulary\Api\Api_Config; |
|
7
|
|
|
use Wordlift\Vocabulary\Data\Term_Count\Term_Count; |
|
8
|
|
|
use Wordlift\Vocabulary\Menu\Badge\Badge_Generator; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @since 1.0.0 |
|
12
|
|
|
* @author Naveen Muthusamy <[email protected]> |
|
13
|
|
|
*/ |
|
14
|
|
|
class Match_Terms { |
|
15
|
|
|
/** |
|
16
|
|
|
* @var Term_Count |
|
17
|
|
|
*/ |
|
18
|
|
|
private $term_count; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Match_Terms constructor. |
|
22
|
|
|
* |
|
23
|
|
|
* @param $term_count Term_Count |
|
24
|
|
|
*/ |
|
25
|
|
|
public function __construct( $term_count ) { |
|
26
|
|
|
|
|
27
|
|
|
$this->term_count = $term_count; |
|
28
|
|
|
add_action( 'admin_menu', array( $this, 'admin_menu', ) ); |
|
29
|
|
|
|
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function admin_menu() { |
|
33
|
|
|
$number = $this->term_count->get_term_count(); |
|
34
|
|
|
add_submenu_page( |
|
35
|
|
|
'wl_admin_menu', |
|
36
|
|
|
__( 'Match Terms', 'wordlift' ), |
|
37
|
|
|
__( 'Match Terms', 'wordlift' ) . " " . Badge_Generator::generate_html($number), |
|
38
|
|
|
'manage_options', |
|
39
|
|
|
'wl-vocabulary-match-terms', |
|
40
|
|
|
array( $this, 'submenu_page_callback' ) |
|
41
|
|
|
); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
|
|
46
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
public function submenu_page_callback() { |
|
49
|
|
|
|
|
50
|
|
|
Scripts_Helper::enqueue_based_on_wordpress_version( |
|
51
|
|
|
'wl-vocabulary-reconcile-script', |
|
52
|
|
|
plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . 'js/dist/vocabulary', |
|
53
|
|
|
array( 'react', 'react-dom', 'wp-polyfill' ), |
|
54
|
|
|
true |
|
55
|
|
|
); |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
wp_enqueue_style( 'wl-vocabulary-reconcile-script', |
|
59
|
|
|
plugin_dir_url( dirname( dirname( __DIR__ ) ) ) . "js/dist/vocabulary.full.css" ); |
|
60
|
|
|
wp_localize_script( 'wl-vocabulary-reconcile-script', '_wlVocabularyMatchTermsConfig', Api_Config::get_api_config() ); |
|
61
|
|
|
echo "<div id='wl_cmkg_reconcile_progress' class='wrap'></div>"; |
|
62
|
|
|
echo "<div id='wl_cmkg_table' class='wrap'></div>"; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
} |
|
66
|
|
|
|