|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GeminiLabs\Pollux\PostType; |
|
4
|
|
|
|
|
5
|
|
|
use GeminiLabs\Pollux\Application; |
|
6
|
|
|
use GeminiLabs\Pollux\Facades\MetaArchive; |
|
7
|
|
|
use GeminiLabs\Pollux\Helper; |
|
8
|
|
|
use GeminiLabs\Pollux\Settings\Settings; |
|
9
|
|
|
|
|
10
|
|
|
class Archive extends Settings |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* @var string |
|
14
|
|
|
*/ |
|
15
|
|
|
CONST ID = 'pollux_archives'; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* {@inheritdoc} |
|
19
|
|
|
*/ |
|
20
|
|
|
public function init() |
|
21
|
|
|
{ |
|
22
|
|
|
// @todo: run GateKeeper to check dependencies and capability (make sure it it run on the correct hook!) |
|
|
|
|
|
|
23
|
|
|
// if( !is_plugin_active( 'meta-box/meta-box.php' ))return; |
|
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
$this->id = apply_filters( 'pollux/archives/option', static::ID ); |
|
26
|
|
|
|
|
27
|
|
|
// $this->normalize( $this->app->config['archives'] ); |
|
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
add_action( 'admin_menu', [$this, 'addPage'] ); |
|
30
|
|
|
add_action( 'pollux/archive/editor', [$this, 'renderEditor'] ); |
|
31
|
|
|
// add_action( 'pollux/settings/init', [$this, 'addSubmitMetaBox'] ); |
|
|
|
|
|
|
32
|
|
|
// add_action( 'current_screen', [$this, 'register'] ); |
|
|
|
|
|
|
33
|
|
|
// add_action( 'admin_menu', [$this, 'registerSetting'] ); |
|
|
|
|
|
|
34
|
|
|
// add_action( 'pollux/settings/init', [$this, 'reset'] ); |
|
|
|
|
|
|
35
|
|
|
// add_action( "admin_footer-toplevel_page_{$this->id}", [$this, 'renderFooterScript'] ); |
|
|
|
|
|
|
36
|
|
|
// add_filter( 'pollux/settings/instruction', [$this, 'filterInstruction'], 10, 3 ); |
|
|
|
|
|
|
37
|
|
|
// add_filter( 'wp_redirect', [$this, 'filterRedirectOnSave'] ); |
|
|
|
|
|
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @return void |
|
42
|
|
|
* @action admin_menu |
|
43
|
|
|
*/ |
|
44
|
|
View Code Duplication |
public function addPage() |
|
|
|
|
|
|
45
|
|
|
{ |
|
46
|
|
|
$this->hook = call_user_func_array( 'add_menu_page', apply_filters( 'pollux/archive/page', [ |
|
47
|
|
|
__( 'Archive Page', 'pollux' ), |
|
48
|
|
|
__( 'Archive Page', 'pollux' ), |
|
49
|
|
|
'edit_theme_options', |
|
50
|
|
|
$this->id, |
|
51
|
|
|
[$this, 'renderPage'], |
|
52
|
|
|
'dashicons-screenoptions', |
|
53
|
|
|
1310 |
|
54
|
|
|
])); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return void |
|
59
|
|
|
* @callback add_menu_page |
|
60
|
|
|
*/ |
|
61
|
|
View Code Duplication |
public function renderPage() |
|
|
|
|
|
|
62
|
|
|
{ |
|
63
|
|
|
$this->render( 'archive/index', [ |
|
64
|
|
|
'columns' => get_current_screen()->get_columns(), |
|
65
|
|
|
'id' => $this->id, |
|
66
|
|
|
'title' => __( 'Archive Page', 'pollux' ), |
|
67
|
|
|
]); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return void |
|
72
|
|
|
* @callback pollux/archive/editor |
|
73
|
|
|
*/ |
|
74
|
|
|
public function renderEditor() |
|
75
|
|
|
{ |
|
76
|
|
|
wp_editor( '', 'content', [ |
|
77
|
|
|
'_content_editor_dfw' => true, |
|
78
|
|
|
'drag_drop_upload' => true, |
|
79
|
|
|
'tabfocus_elements' => 'content-html, save-post', |
|
80
|
|
|
'editor_height' => 300, |
|
81
|
|
|
'tinymce' => [ |
|
82
|
|
|
'resize' => false, |
|
83
|
|
|
'wp_autoresize_on' => true, |
|
84
|
|
|
'add_unload_trigger' => false, |
|
85
|
|
|
], |
|
86
|
|
|
]); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|