wordpress/wp-content/plugins/cms-tree-page-view/functions.php
/**
 * Detect if we are on a page that use CMS Tree Page View
 */
Detect if we are on a page that use CMS Tree Page View
Detect if we are on a page that use CMS Tree Page View
function cms_tpv_is_one_of_our_pages() {
	$options = cms_tpv_get_options();
	$post_type = cms_tpv_get_selected_post_type();
	if (! function_exists("get_current_screen")) return FALSE;
	$current_screen = get_current_screen();
	$is_plugin_page = FALSE;
	foreach ($options["menu"] as $one_post_type) {
		if ( strpos($current_screen->id, "_page_cms-tpv-page-{$one_post_type}") !== FALSE) {
			$is_plugin_page = TRUE;
			break;
		}
	}
	if ($current_screen->base === "edit" && in_array($current_screen->post_type, $options["postsoverview"])) {
		$is_plugin_page = TRUE;
	}
	if ($current_screen->id === "settings_page_cms-tpv-options") {
		$is_plugin_page = TRUE;
	} elseif ($current_screen->id === "dashboard" && !empty($options["dashboard"])) {
		$is_plugin_page = TRUE;
	}
	return $is_plugin_page;
}
function cms_tpv_is_one_of_our_pages ( ) { $ options = cms_tpv_get_options ( ) ; $ post_type = cms_tpv_get_selected_post_type ( ) ; if ( ! function_exists ( " get_current_screen " ) ) return FALSE ; $ current_screen = get_current_screen ( ) ; $ is_plugin_page = FALSE ; foreach ( $ options [ " menu " ] as $ one_post_type ) { if ( strpos ( $ current_screen -> id , " _page_cms-tpv-page- { $ one_post_type } " ) !== FALSE ) { $ is_plugin_page = TRUE ; break ; } } if ( $ current_screen -> base === " edit " && in_array ( $ current_screen -> post_type , $ options [ " postsoverview " ] ) ) { $ is_plugin_page = TRUE ; } if ( $ current_screen -> id === " settings_page_cms-tpv-options " ) { $ is_plugin_page = TRUE ; } elseif ( $ current_screen -> id === " dashboard " && ! empty ( $ options [ " dashboard " ] ) ) { $ is_plugin_page = TRUE ; } return $ is_plugin_page ; }
Detect if we are on a page that use CMS Tree Page View
Detect if we are on a page that use CMS Tree Page View
// Check if current page is one of the ones defined in $options["menu"] // Check if current page is one of the ones defined in $options["postsoverview"] // Is settings page for plugin // At least one post type is enabled to be visible on dashboard