PluginProbe
WP Ultimate Post Grid / 2.8.0
WP Ultimate Post Grid v2.8.0
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / vendor / vafpress / classes / wp / admin.php

admin.php in WP Ultimate Post Grid 2.8.0, at vendor/vafpress/classes/wp/admin.php

80 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class VP_WP_Admin
4 {
5
6 /**
7 * [taken from WPAlchemy Class by Dimas Begunoff]
8 * Used to check if creating or editing a post or page
9 *
10 * @static
11 * @access private
12 * @return string "post" or "page"
13 */
14 public static function is_post_or_page()
15 {
16 $post_type = self::get_current_post_type();
17
18 if (isset($post_type))
19 {
20 if ('page' == $post_type)
21 {
22 return 'page';
23 }
24 else
25 {
26 return 'post';
27 }
28 }
29
30 return NULL;
31 }
32
33 /**
34 * [taken from WPAlchemy Class by Dimas Begunoff]
35 * Used to check for the current post type, works when creating or editing a
36 * new post, page or custom post type.
37 *
38 * @static
39 * @return string [custom_post_type], page or post
40 */
41 public static function get_current_post_type()
42 {
43
44 if(!class_exists('WPAlchemy_MetaBox'))
45 {
46 require_once VP_FileSystem::instance()->resolve_path('includes', 'wpalchemy/MetaBox');
47 }
48
49 $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : NULL ;
50
51 if ( isset( $uri ) )
52 {
53 $uri_parts = parse_url($uri);
54
55 $file = basename($uri_parts['path']);
56
57 if ($uri AND in_array($file, array('post.php', 'post-new.php')))
58 {
59 $post_id = WPAlchemy_MetaBox::_get_post_id();
60
61 $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : NULL ;
62
63 $post_type = $post_id ? get_post_type($post_id) : $post_type ;
64
65 if (isset($post_type))
66 {
67 return $post_type;
68 }
69 else
70 {
71 // because of the 'post.php' and 'post-new.php' checks above, we can default to 'post'
72 return 'post';
73 }
74 }
75 }
76
77 return NULL;
78 }
79
80 }