public static function HighlightCustomPanel()
{
global $wpdb, $submenu_file, $post;
if (empty($post)) {
return true;
}
$sql = $wpdb->prepare("SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id = %d and meta_key = %s", array($post->ID, "_mf_write_panel_id"));
$result = $wpdb->get_results($sql, ARRAY_A);
$currPage = basename($_SERVER['SCRIPT_NAME']);
if (is_wp30()) {
if (count($result) > 0 && $currPage == "edit.php") {
$id = $result[0]['meta_value'];
$base = 'edit.php?';
if (isset($_GET['post_type']) && $_GET['post_type'] == 'page') {
$base = 'edit.php?post_type=page&';
}
$submenu_file = $base . "filter-posts=1&custom-write-panel-id={$id}";
} elseif (@$_GET['custom-write-panel-id']) {
//$id = $result[0]['meta_value'];
$base = 'post-new.php?';
if (isset($_GET['post_type']) && $_GET['post_type'] == 'page') {
$base = 'post-new.php?post_type=page&';
}
$submenu_file = $base . "custom-write-panel-id=" . $_GET['custom-write-panel-id'];
} elseif (count($result) > 0 && $currPage == "post.php") {
$id = $result[0]['meta_value'];
$base = 'edit.php?';
if ($post->post_type == 'page') {
$base = 'edit.php?post_type=page&';
}
$submenu_file = $base . "filter-posts=1&custom-write-panel-id={$id}";
}
} else {
if (count($result) > 0 && $currPage == "post.php") {
$id = $result[0]['meta_value'];
$submenu_file = "edit.php?filter-posts=1&custom-write-panel-id={$id}";
} elseif (count($result) > 0 && $currPage == "page.php") {
$id = $result[0]['meta_value'];
$submenu_file = "edit-pages.php?filter-posts=1&custom-write-panel-id={$id}";
}
}
}