/** * is_allowed * Determines if a workflow tab is allowed to be shown. * * @param array $data The tab configuration object. * * @return array The statuse of whether its allowed. * * @access public * @static * @since 1.0 */ public static function is_allowed($data, $strict = true) { global $pagenow; $allowed = !$strict; // Check to see if there is an active flow if (isset($_REQUEST['flow']) && piklist::slug($flow, 'UTF-8') == $_REQUEST['flow']) { $allowed = true; } // Check Pages $pages = $data['data']['page']; if (!empty($pages)) { $allowed = in_array($pagenow, $pages); if (isset($_REQUEST['page'])) { $allowed = in_array($_REQUEST['page'], $pages); } } // Check Post Types if ($allowed && piklist_admin::is_post()) { $post_types = $data['data']['post_type']; $current_post_type = piklist_cpt::detect_post_type(); if (!empty($post_types)) { $allowed = in_array($current_post_type, $post_types); } } // Check which mode we are on for the term pages if (piklist_admin::is_term()) { $taxonomies = $data['data']['taxonomy']; $current_taxonomy = isset($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : false; if (!empty($taxonomies) && $current_taxonomy) { $allowed = in_array($current_taxonomy, $taxonomies); } if (piklist_admin::is_term() === 'new') { $allowed = false; } } return $allowed; }