forked from lloc/Multisite-Language-Switcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMslsPostType.php
More file actions
64 lines (58 loc) · 1.28 KB
/
Copy pathMslsPostType.php
File metadata and controls
64 lines (58 loc) · 1.28 KB
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
<?php
/**
* MslsPostType
* @author Dennis Ploetner <[email protected]>
* @since 0.9.8
*/
/**
* Content types: Post types (Pages, Posts, ...)
* @package Msls
*/
class MslsPostType extends MslsContentTypes implements IMslsRegistryInstance {
/**
* Constructor
* @uses get_post_types
*/
public function __construct() {
$this->types = array_merge(
array( 'post', 'page' ), // we don't need attachment, revision or nav_menu_item here
get_post_types(
array(
'public' => true,
'_builtin' => false,
),
'names',
'and'
)
);
$_request = MslsPlugin::get_superglobals( array( 'post_type' ) );
if ( '' != $_request['post_type'] ) {
$this->request = esc_attr( $_request['post_type'] );
}
else {
$this->request = get_post_type();
if ( ! $this->request ) {
$this->request = 'post';
}
}
}
/**
* Check for post_type
* @return bool
*/
function is_post_type() {
return true;
}
/**
* Get or create an instance of MslsPostType
* @todo Until PHP 5.2 is not longer the minimum for WordPress ...
* @return MslsBlogPostType
*/
public static function instance() {
if ( ! ( $obj = MslsRegistry::get_object( 'MslsBlogPostType' ) ) ) {
$obj = new self();
MslsRegistry::set_object( 'MslsBlogPostType', $obj );
}
return $obj;
}
}