/
OptionPage.php
100 lines (72 loc) · 2.38 KB
/
OptionPage.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
<?php
defined( 'ABSPATH' ) or die( 'Sorry,you are not allowd to access this file!' );
session_start();
require_once 'PictureListTable.php';
require_once 'Repo.php';
class OptionPage {
// class instance
static $instance;
// customer WP_List_Table object
protected $pictureListTable;
// class constructor
public function __construct() {
add_action( 'admin_menu', [ $this, 'plugin_menu' ] );
$this->pictureListTable = new PictureListTable();
}
public function plugin_menu() {
$hook = add_menu_page(
_x('Magic SEO Image nextgen','page title',TXD),
_x('Magic SEO Image nextgen','menu title',TXD),
'manage_options',
'magic-seo-image-nextgen',
[ $this, 'plugin_settings_page' ]
);
}
/**
* Plugin settings page
*/
public function plugin_settings_page() {
?>
<div class="wrap">
<h2><?php _e('SEO nextGallery images',TXD); ?></h2>
<?php $fail_or_success = $this->pictureListTable->prepare_items();?>
<?php $this->pictureListTable->repo->flashMessage(); ?>
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="post-body-content">
<div class="meta-box-sortables ui-sortable">
<div class="gallery-select-div">
<h3><?php _e('Please select a gallery',TXD); ?></h3>
<?php $this->pictureListTable->repo->showGalleries(); ?>
</div>
<form method="post">
<a id="show-tags"><?php _e('show posts tags',TXD); ?></a>
<?php $this->pictureListTable->repo->showTags('checkbox_alt',$fail_or_success); ?>
<div id="js-div-tag-container"><h3><?php _e('your custom tags :',TXD); ?></h3></div>
<div class="custom-alt-input">
<h3><?php _e('add your custom alt:',TXD); ?> </h3>
<span><?php _e('Separate each alt with comma',TXD); ?></span>
<?php $this->pictureListTable->repo->inputHtml('custom-alt',$fail_or_success); ?>
<?php $this->pictureListTable->repo->buttonHtml(__('add to tags',TXD),'tag-button',true); ?>
</div>
<?php $this->pictureListTable->display(); ?>
</form>
</div>
</div>
</div>
<br class="clear">
</div>
</div>
<?php
}
/** Singleton instance */
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
}
add_action( 'plugins_loaded', function () {
OptionPage::get_instance();
} );