/** * Returns array of selectable pages * */ protected static function selectable_pages($plugin_id, $type) { // $type = [include] [exclude] global $wp_post_types, $wp_taxonomies; $values_to_select = q2w3_include_obj::page_selectors($plugin_id); if ($type == 'exclude') { array_shift($values_to_select); } $options = get_option(q2w3_inc_manager::ID); if (!$options) { $options = q2w3_inc_manager::$default_options; } if ($options['taxonomies']['post_format']['enable']) { $formats_orig = get_post_format_strings(); foreach ($formats_orig as $fkey => $fname) { $formats['post_format_' . $fkey] = __('PF', $plugin_id) . ': ' . $fname; } $values_to_select[__('Post Formats')] = $formats; } foreach ($options['post_types'] as $post_type => $params) { $pages = NULL; if ($params['enable'] == 'on' && !in_array($post_type, q2w3_inc_manager::$restricted_post_types)) { $post_type_name = $wp_post_types[$post_type]->labels->name; $selectors = array($post_type . '_all' => __('All', $plugin_id) . ' ' . $post_type_name); if (version_compare($GLOBALS['wp_version'], '3.1.0', '>=') && $post_type != 'page') { $selectors = array_merge($selectors, array('post_type_archive_' . $post_type => __('Archive', $plugin_id) . ': ' . $post_type_name)); } if ($params['expand'] == 'on') { $pages = q2w3_table_func::select_post_type($post_type); } if (!empty($pages)) { $selectors = array_merge($selectors, $pages); } $values_to_select[$post_type_name] = $selectors; } } foreach ($options['taxonomies'] as $taxonomy => $params) { $pages = NULL; if ($params['enable'] == 'on' && !in_array($taxonomy, q2w3_inc_manager::$restricted_taxonomies)) { $taxonomy_name = $wp_taxonomies[$taxonomy]->labels->name; $selectors = array($taxonomy . '_all' => __('All', $plugin_id) . ' ' . $taxonomy_name); if ($params['expand'] == 'on') { $pages = q2w3_table_func::select_taxonomy($taxonomy); } if (!empty($pages)) { $selectors = array_merge($selectors, $pages); } $values_to_select[$taxonomy_name] = $selectors; } } /*$pages = q2w3_table_func::wp_pages(); if (!empty($pages)) $values_to_select[__('Pages', $plugin_id)] = $pages; $pages = q2w3_table_func::wp_categories(); if (!empty($pages)) $values_to_select[__('Categories', $plugin_id)] = $pages; $pages = q2w3_table_func::wp_tags(); if (!empty($pages)) $values_to_select[__('Tags', $plugin_id)] = $pages; $pages = q2w3_table_func::wp_posts(); if (!empty($pages)) $values_to_select[__('Posts', $plugin_id)] = $pages;*/ return $values_to_select; }