se_version = "2.0.6.6";
$this->admin_menu_label = __("Simply Exclude", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->options_key = "simplyexclude_v2";
$plugindir_node = dirname(plugin_basename(__FILE__));
$this->plugindir_url = WP_PLUGIN_URL . "/". $plugindir_node;
$this->se_taxonomies_exclude = array('media-tags', 'post_format', 'link_category', 'nav_menu');
$this->se_post_types_exclude = array('revision', 'nav_menu_item', 'attachment');
$this->page_hooks = array();
/* Setup the tetdomain for i18n language handling see http://codex.wordpress.org/Function_Reference/load_plugin_textdomain */
load_plugin_textdomain( SIMPLY_EXCLUDE_I18N_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
add_action( 'init', array(&$this,'init_proc') );
add_action( 'admin_init', array(&$this,'admin_init_proc') );
add_action( 'admin_menu', array(&$this,'se_add_nav') );
add_action( 'admin_footer', array(&$this,'se_admin_footer') );
add_action( 'wp_ajax_se_update', array(&$this, 'se_ajax_update') );
// In 2.0.6.4 added a define to allow control of the SE_FILTERS_PRIORITY
//https://wordpress.org/support/topic/first-install-problems-in-wordpress-40?replies=3#post-6579114
if (defined('SE_FILTERS_PRIORITY'))
$SE_FILTERS_PRIORITY = intval(SE_FILTERS_PRIORITY);
else {
$SE_FILTERS_PRIORITY = 999;
}
$SE_FILTERS_PRIORITY = apply_filters('se_filters_priority', $SE_FILTERS_PRIORITY);
// Used to limit the categories displayed on the home page. Simple
add_filter('pre_get_posts', array($this,'se_filters'), $SE_FILTERS_PRIORITY);
}
function admin_init_proc()
{
$this->tabs = array(
'taxonomies' => __('Taxonomies', SIMPLY_EXCLUDE_I18N_DOMAIN),
'post_types' => __('Post Types', SIMPLY_EXCLUDE_I18N_DOMAIN),
'users' => __('Users', SIMPLY_EXCLUDE_I18N_DOMAIN),
);
$this->current_tab = '';
$this->se_load_config();
if ( ($this->check_url('wp-admin/edit-tags.php'))
|| ($this->check_url('wp-admin/edit.php'))
|| ($this->check_url('wp-admin/users.php')) )
{
wp_enqueue_style( 'simplyexclude-stylesheet', $this->plugindir_url .'/simplyexclude_style_admin.css', false, $this->se_version);
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-dialog');
wp_enqueue_style( 'simplyexclude-jquery-ui',
$this->plugindir_url .'/js/jquery-ui/css/flick/jquery-ui-1.8.17.custom.css',
null, $this->se_version );
wp_enqueue_script('simplyexclude-admin-dialog-js', $this->plugindir_url .'/js/simplyexclude_admin_dialog.js',
array('jquery', 'jquery-ui-core', 'jquery-ui-dialog'), $this->se_version);
wp_enqueue_script('simplyexclude-admin-ajax-js', $this->plugindir_url .'/js/simplyexclude_admin_ajax.js',
array('jquery', 'jquery-ui-core'), $this->se_version);
}
add_action('edit_category_form_fields', array(&$this,'se_show_taxonomy_term_fields'), 99, 1);
add_action('edit_tag_form_fields', array(&$this,'se_show_taxonomy_term_fields'), 99, 1);
add_action('edited_term', array(&$this,'se_save_taxonomy_term_fields'), 99, 3);
add_action( 'show_user_profile', array(&$this,'se_show_user_profile'), 99 );
add_action( 'edit_user_profile', array(&$this,'se_show_user_profile'), 99 );
add_action( 'profile_update', array(&$this,'se_save_user_profile'), 99);
add_filter( 'plugin_action_links_'. basename( dirname( __FILE__ ) ). '/' .basename( __FILE__ ), array(&$this,'plugin_settings'));
}
// Adds a 'Settings' link on the Plugins listing row. Cool!
function plugin_settings( $links ) {
$settings_link = ''.__( 'Settings', SIMPLY_EXCLUDE_I18N_DOMAIN ).' ';
array_unshift( $links, $settings_link );
return $links;
}
function init_proc()
{
if (!is_admin())
{
add_filter('widget_pages_args', array(&$this, 'se_widget_pages_args_proc'));
// Not needed since wp_list_pages is user managable.
//aad_filter('wp_list_pages_excludes', array(&$this, 'se_wp_list_pages_excludes_proc'));
// Suport for the Category list/dropdown widget
add_filter('widget_categories_dropdown_args', array(&$this, 'se_widget_categories_dropdown_args_proc'));
add_filter('widget_categories_args', array(&$this, 'se_widget_categories_dropdown_args_proc'));
// Support for the Tag Clod widget. This widget supports both the post_tag and category taxonomies.
add_filter('widget_tag_cloud_args', array(&$this, 'se_widget_tag_cloud_args_proc'));
// Support for Archive widget. This widget will output a month or year archive listing/dropdown of posts
add_filter('getarchives_where', array($this, 'se_widget_getarchives_where'), 99);
}
}
function se_add_nav()
{
// Add the Main Nav item to the WP menu
add_menu_page( 'Simply Exclude', 'Simply Exclude', 'manage_options', 'se_manage_settings',
array(&$this, 'se_manage_settings'));
// Add our Options sub menu.
$this->pagehooks['se_manage_settings'] = add_submenu_page( 'se_manage_settings', 'Settings', 'Settings', 'manage_options',
'se_manage_settings', array(&$this, 'se_manage_settings'));
add_action('load-'. $this->pagehooks['se_manage_settings'], array(&$this, 'on_load_settings_page'));
// Add our Help sub menu.
$this->pagehooks['se_manage_help'] = add_submenu_page( 'se_manage_settings', 'Help', 'Help', 'manage_options',
'se_manage_help', array(&$this, 'se_manage_help'));
add_action('load-'. $this->pagehooks['se_manage_help'], array(&$this, 'on_load_help_page'));
if ( !current_user_can('manage_options') )
return;
$this->se_load_config();
// Now add a submenu for each registered taxonomy
$se_taxonomies = $this->se_load_taxonomy_list();
if ($se_taxonomies)
{
foreach($se_taxonomies as $t_item)
{
if ((isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide']))
&& ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == 'show'))
{
add_filter( "manage_edit-". $t_item->name ."_columns", array( &$this, 'se_manage_taxonomy_columns' ), 99, 1);
add_filter( "manage_". $t_item->name. "_custom_column", array(&$this, 'se_display_taxonomy_column_filters'), 99, 3);
}
}
//add_action("delete_term", array(&$this, 'se_delete_taxonomy_term'), 99, 3);
}
// Now add a submenu for each registered post_type
$se_post_types = $this->se_load_post_type_list();
if ($se_post_types)
{
foreach($se_post_types as $t_item)
{
if ((isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide']))
&& ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == 'show'))
{
add_filter( "manage_". $t_item->name ."_posts_columns", array( &$this, 'se_manage_post_type_columns' ), 99 );
add_action( "manage_". $t_item->name ."_posts_custom_column", array(&$this, 'se_display_post_type_column_actions'), 99, 2);
add_meta_box($this->options_key, $this->admin_menu_label, array(&$this,'show_post_type_exclude_sidebar_dbx'), $t_item->name, 'side');
add_action('save_post', array(&$this,'save_post_type_exclude_sidebar_dbx'));
}
}
}
// Users table
if ((isset($this->se_cfg['data']['se_types']['users']['options']['showhide']))
&& ($this->se_cfg['data']['se_types']['users']['options']['showhide'] == 'show'))
{
add_filter( "manage_users_columns", array( &$this, 'se_manage_user_columns' ), 99 );
add_filter( 'manage_users_custom_column', array(&$this, 'se_display_user_column_actions'), 99, 3);
}
}
/*
function se_delete_taxonomy_term($term, $tt_id, $taxonomy)
{
echo "term
"; print_r($term); echo " ";
echo "tt_id=[". $tt_id ."] ";
echo "taxonomy=[". $taxonomy ."] ";
exit;
}
*/
/****************************************************************************************************************************/
/* */
/* ON LOAD PAGES */
/* */
/****************************************************************************************************************************/
function on_load_settings_page() {
wp_enqueue_style( 'simplyexclude-stylesheet', $this->plugindir_url .'/simplyexclude_style_admin.css', false, $this->se_version);
wp_enqueue_script('simplyexclude-admin-ajax-js', $this->plugindir_url .'/js/simplyexclude_admin_ajax.js',
array('jquery', 'jquery-ui-core'), $this->se_version);
wp_enqueue_script('common');
wp_enqueue_script('wp-lists');
wp_enqueue_script('postbox');
if ( isset( $_GET['tab'] )) {
$this->current_tab = esc_attr($_GET['tab']);
if (!isset($this->tabs[$this->current_tab])) {
$this->current_tab = 'taxonomies';
}
} else {
$this->current_tab = 'taxonomies';
}
add_meta_box('se_settings_about_sidebar', 'About this Plugin', array(&$this, 'se_settings_about_sidebar'),
$this->pagehooks['se_manage_settings'], 'side', 'core');
add_meta_box('se_settings_donate_sidebar', 'Make a Donation', array(&$this, 'se_settings_donate_sidebar'),
$this->pagehooks['se_manage_settings'], 'side', 'core');
}
function on_load_help_page()
{
global $wp_version;
wp_enqueue_style( 'simplyexclude-stylesheet', $this->plugindir_url .'/simplyexclude_style_admin.css', false, $this->se_version);
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-ui-core');
if ( version_compare( $wp_version, '3.3', '<' ) ) {
wp_register_script( 'jquery-ui-widget-se', $this->plugindir_url .'/js/jquery-ui/jquery.ui.widget.min.js',
array('jquery', 'jquery-ui-core'), $this->se_version);
wp_enqueue_script( 'jquery-ui-widget-se' );
wp_register_script( 'jquery-ui-accordion-se', $this->plugindir_url .'/js/jquery-ui/jquery.ui.accordion.min.js',
array('jquery', 'jquery-ui-core', 'jquery-ui-widget-se'), $this->se_version);
wp_enqueue_script( 'jquery-ui-accordion-se' );
} else {
wp_enqueue_script('jquery-ui-widget');
wp_enqueue_script('jquery-ui-accordion');
}
add_meta_box('se_settings_about_sidebar', 'About this Plugin', array(&$this, 'se_settings_about_sidebar'),
$this->pagehooks['se_manage_help'], 'side', 'core');
add_meta_box('se_settings_donate_sidebar', 'Make a Donation', array(&$this, 'se_settings_donate_sidebar'),
$this->pagehooks['se_manage_help'], 'side', 'core');
}
/****************************************************************************************************************************/
/* */
/* ACTIONS PANELS */
/* */
/****************************************************************************************************************************/
function se_show_taxonomy_actions_panel($taxonomy)
{
if (!$taxonomy) return;
if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy]))
return;
$this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
?>
current_taxonomy['actions'] as $action_key => $action_val)
{
$class = ('alternate' == $class) ? '' : 'alternate';
?>
>
get_taxonomy_action_label($taxonomy, $action_key, 'name'); //$action_val['name'] ?>
get_taxonomy_action_label($taxonomy, $action_key, 'description');//$action_val['description'] ?>
se_cfg['data']['post_types'][$post_type]))
return;
$this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
?>
current_post_type['actions'] as $action_key => $action_val)
{
$class = ('alternate' == $class) ? '' : 'alternate';
?>
>
get_post_type_action_label($post_type, $action_key, 'name'); ?>
get_post_type_action_label($post_type, $action_key, 'description'); ?>
se_cfg['data']['se_types'][$se_type]))
return;
$this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
?>
current_se_type['actions'] as $action_key => $action_val)
{
$class = ('alternate' == $class) ? '' : 'alternate';
?>
>
get_se_type_action_label($se_type, $action_key, 'name'); ?>
get_se_type_action_label($se_type, $action_key, 'description'); ?>
se_cfg['data']['taxonomies'][$taxonomy]))
return;
$this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
if (!isset($this->current_taxonomy['options']['active']))
$this->current_taxonomy['options']['active'] = "yes";
?>
se_cfg['data']['post_types'][$post_type]))
return;
$this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
if (!isset($this->current_post_type['options']['active']))
$this->current_post_type['options']['active'] = "yes";
?>
se_cfg['data']['se_types'][$se_type]))
return;
$this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
if (!isset($this->current_se_type['options']['active']))
$this->current_se_type['options']['active'] = "yes";
?>
se_cfg['data']['taxonomies'][$taxonomy]))
return;
$this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
?>
se_cfg['data']['post_types'][$post_type]))
return;
$this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
?>
se_cfg['data']['se_types'][$se_type]))
return;
$this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
?>
se_cfg['data']['taxonomies'][$taxonomy]))
return;
$this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
?>
se_cfg['data']['post_types'][$post_type]))
return;
$this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
?>
se_cfg['data']['se_types'][$se_type]))
return;
$this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
?>
'. __('Simply Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN) .'';
}
return $columns;
}
function se_manage_post_type_columns($columns)
{
if (current_user_can('manage_options')) {
if (!isset($columns['se_actions']))
$columns['se-actions'] = __('Simply Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN). ' '. __('show', SIMPLY_EXCLUDE_I18N_DOMAIN) .' ';
}
return $columns;
}
function se_manage_user_columns($columns)
{
if (current_user_can('manage_options')) {
if (!isset($columns['se_actions']))
$columns['se-actions'] = __('Simply Exclude', SIMPLY_EXCLUDE_I18N_DOMAIN). ' '. __('show', SIMPLY_EXCLUDE_I18N_DOMAIN) .' ';
}
return $columns;
}
/****************************************************************************************************************************/
/* */
/* COLUMNS (ACTIONS) */
/* */
/****************************************************************************************************************************/
function se_display_taxonomy_column_filters($content='', $column_name, $term_id)
{
global $taxonomy, $post_type;
if (current_user_can('manage_options')) {
if ($column_name == "se-actions")
{
if ($taxonomy)
{
$term = get_term( $term_id, $taxonomy );
if ($term)
{
$this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$taxonomy];
ob_start();
$this->se_display_taxonomy_term_action_row($taxonomy, $term);
$out = ob_get_contents();
ob_end_clean();
return $out;
}
}
}
}
return $content;
}
function se_display_post_type_column_actions($column_name, $post_id)
{
global $post_type;
if (current_user_can('manage_options')) {
if ($column_name == "se-actions")
{
$this->current_post_type = $this->se_cfg['data']['post_types'][$post_type];
if ($post_id)
{
$p_item = get_post( $post_id );
if ($p_item)
{
$this->se_display_post_type_action_row($post_type, $p_item);
}
}
}
}
}
function se_display_user_column_actions($content='', $column_name, $user_id )
{
if (current_user_can('manage_options')) {
if ($column_name == "se-actions")
{
$se_type = "users";
if (isset($this->se_cfg['data']['se_types'][$se_type]))
{
ob_start();
$this->current_se_type = $this->se_cfg['data']['se_types'][$se_type];
if ($user_id)
{
$user = get_userdata($user_id);
if ($user)
{
$this->se_display_user_action_row($se_type, $user);
}
}
$out = ob_get_contents();
ob_end_clean();
return $out;
}
}
}
return $content;
}
/****************************************************************************************************************************/
/* */
/* COLUMNS ACTION ROW */
/* */
/****************************************************************************************************************************/
function se_display_taxonomy_term_action_row($taxonomy='', $term='')
{
if (!$taxonomy) return;
if (!$term) return;
if (current_user_can('manage_options')) {
if ((isset($this->current_taxonomy['actions'])) && (count($this->current_taxonomy['actions'])))
{
?>current_post_type['actions'])) && (count($this->current_post_type['actions'])))
{
?>current_se_type['actions'])) && (count($this->current_se_type['actions'])))
{
?>current_se_type = $this->se_cfg['data']['se_types'][$se_type];
if (current_user_can('manage_options')) {
if ($this->current_se_type['options']['showhide'] == "show") {
?>
se_load_config();
// First remove all traces of the post item in the actions
$se_type = "users";
if ((isset($this->se_cfg['data']['se_types'][$se_type]['terms'])) && (count($this->se_cfg['data']['se_types'][$se_type]['terms'])))
{
foreach($this->se_cfg['data']['se_types'][$se_type]['terms'] as $cfg_action => $cfg_action_items)
{
foreach($cfg_action_items as $action_id => $action_val)
{
if ($action_id == $_REQUEST['user_id'])
{
unset($this->se_cfg['data']['se_types'][$se_type]['terms'][$cfg_action][$action_id]);
}
}
}
}
if (isset($_REQUEST['se_cfg']))
{
$se_cfg = $_REQUEST['se_cfg'];
// Now add back the items which were checked.
foreach($se_cfg as $se_type => $se_type_items)
{
foreach($se_type_items as $term => $se_items)
{
foreach($se_items as $action => $action_items)
{
foreach($action_items as $action_id => $action_val)
{
$this->se_cfg['data']['se_types'][$se_type][$term][$action][$action_id] = $action_val;
}
}
}
}
}
$this->se_save_config();
}
/****************************************************************************************************************************/
/* */
/* POST DBX SIDEBAR FOR POST TYPES */
/* */
/****************************************************************************************************************************/
function show_post_type_exclude_sidebar_dbx()
{
global $post;
if (isset($this->se_cfg['data']['post_types'][$post->post_type]))
{
$this->current_post_type = $this->se_cfg['data']['post_types'][$post->post_type];
$this->se_display_post_type_action_row($post->post_type, $post);
}
}
function save_post_type_exclude_sidebar_dbx($post_id)
{
if (!$post_id)
return;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
if ( wp_is_post_revision( $post_id ) )
return;
$this->se_load_config();
if( (isset($_REQUEST['post_type'])) && (isset($_REQUEST['post_ID'])))
{
// First remove all traces of the post item in the actions
$post_type = $_REQUEST['post_type'];
if (isset($this->se_cfg['data']['post_types'][$post_type]['terms']))
{
foreach($this->se_cfg['data']['post_types'][$post_type]['terms'] as $cfg_action => $cfg_action_items)
{
foreach($cfg_action_items as $action_id => $action_val)
{
if ($action_id == $_REQUEST['post_ID'])
{
unset($this->se_cfg['data']['post_types'][$post_type]['terms'][$cfg_action][$action_id]);
}
}
}
}
if (isset($_REQUEST['se_cfg']))
{
$se_cfg = $_REQUEST['se_cfg'];
// Now add back the items which were checked.
foreach($se_cfg as $post_type => $post_type_items)
{
foreach($post_type_items as $term => $term_items)
{
foreach($term_items as $action => $action_items)
{
foreach($action_items as $action_id => $action_val)
{
$this->se_cfg['data']['post_types'][$post_type][$term][$action][$action_id] = $action_val;
}
}
}
}
}
}
$this->se_save_config();
}
/****************************************************************************************************************************/
/* */
/* TAXONOMY EXTRA FIELDS */
/* */
/****************************************************************************************************************************/
function se_show_taxonomy_term_fields()
{
if (!isset($_REQUEST['tag_ID']))
return;
if (!isset($_REQUEST['taxonomy']))
return;
$this->se_load_config();
$this->current_taxonomy = $this->se_cfg['data']['taxonomies'][$_REQUEST['taxonomy']];
$term = get_term_by("ID", $_REQUEST['tag_ID'], $_REQUEST['taxonomy']);
?>
se_display_taxonomy_term_action_row($_REQUEST['taxonomy'], $term) ?>
se_load_config();
if ((isset($taxonomy)) && (isset($term_id)))
{
// First remove all traces of the taxonomy item in the actions
if (isset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'])) {
foreach($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'] as $cfg_action => $cfg_action_items)
{
foreach($cfg_action_items as $action_id => $action_val)
{
if ($action_id == $term_id)
{
unset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$cfg_action][$action_id]);
}
}
}
}
if (isset($_REQUEST['se_cfg']))
{
$se_cfg = $_REQUEST['se_cfg'];
// Now add back the items which were checked.
foreach($se_cfg as $taxonomy => $taxonomy_items)
{
foreach($taxonomy_items as $term => $term_items)
{
foreach($term_items as $action => $action_items)
{
foreach($action_items as $action_id => $action_val)
{
$this->se_cfg['data']['taxonomies'][$taxonomy][$term][$action][$action_id] = $action_val;
}
}
}
}
}
$this->se_save_config();
}
}
/****************************************************************************************************************************/
/* */
/* LOAD CONFIG */
/* */
/****************************************************************************************************************************/
function se_load_config()
{
$tmp_se_cfg = get_option($this->options_key);
if (!$tmp_se_cfg)
{
$tmp_se_cfg = $this->se_convert_configuration();
}
else if ($tmp_se_cfg)
{
if (is_serialized($tmp_se_cfg))
$this->se_cfg = unserialize($tmp_se_cfg);
else
$this->se_cfg = $tmp_se_cfg;
// if (!isset($this->se_cfg['cfg']['version']))
// $this->se_cfg['cfg']['version'] = $this->se_version;
}
$this->se_cfg['cfg']['version'] = $this->se_version;
$se_taxonomies = $this->se_load_taxonomy_list();
if ($se_taxonomies)
{
foreach($se_taxonomies as $t_idx => $t_item)
{
if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['actions']))
$this->se_cfg['data']['taxonomies'][$t_item->name]['actions'] = array();
$default_actions = $this->se_load_taxonomy_default_actions($t_item->name);
if ($default_actions)
{
$this->se_cfg['data']['taxonomies'][$t_item->name]['actions'] = array_merge($default_actions,
$this->se_cfg['data']['taxonomies'][$t_item->name]['actions']);
}
ksort($this->se_cfg['data']['taxonomies'][$t_item->name]['actions']);
if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']))
$this->se_cfg['data']['taxonomies'][$t_item->name]['options'] = array();
if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['active']))
$this->se_cfg['data']['taxonomies'][$t_item->name]['options']['active'] = 'yes';
if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide']))
$this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'show';
if ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == "yes")
$this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'show';
else if ($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] == "no")
$this->se_cfg['data']['taxonomies'][$t_item->name]['options']['showhide'] = 'hide';
if (!isset($this->se_cfg['data']['taxonomies'][$t_item->name]['options']['qover']))
$this->se_cfg['data']['taxonomies'][$t_item->name]['options']['qover'] = 'main';
$this->se_cfg['data']['taxonomies'][$t_item->name]['options']['hierarchical'] = $t_item->hierarchical;
}
}
$se_post_types = $this->se_load_post_type_list();
if ($se_post_types)
{
foreach($se_post_types as $t_idx => $t_item)
{
if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['actions']))
$this->se_cfg['data']['post_types'][$t_item->name]['actions'] = array();
$actions = $this->se_load_post_type_default_actions($t_item->name);
if ($actions)
{
$this->se_cfg['data']['post_types'][$t_item->name]['actions'] = array_merge($actions,
$this->se_cfg['data']['post_types'][$t_item->name]['actions']);
}
ksort($this->se_cfg['data']['post_types'][$t_item->name]['actions']);
if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']))
$this->se_cfg['data']['post_types'][$t_item->name]['options'] = array();
if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['active']))
$this->se_cfg['data']['post_types'][$t_item->name]['options']['active'] = 'yes';
if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide']))
$this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'show';
if ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == "yes")
$this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'show';
else if ($this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] == "no")
$this->se_cfg['data']['post_types'][$t_item->name]['options']['showhide'] = 'hide';
if (!isset($this->se_cfg['data']['post_types'][$t_item->name]['options']['qover']))
$this->se_cfg['data']['post_types'][$t_item->name]['options']['qover'] = 'main';
$this->se_cfg['data']['post_types'][$t_item->name]['options']['capability_type'] = $t_item->capability_type;
}
}
$se_types = $this->se_load_se_type_list();
if ($se_types)
{
foreach($se_types as $t_idx => $t_item)
{
if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['actions']))
$this->se_cfg['data']['se_types'][$t_item['name']]['actions'] = array();
$actions = $this->se_load_se_type_default_actions($t_item['name']);
if ($actions)
{
$this->se_cfg['data']['se_types'][$t_item['name']]['actions'] = array_merge($actions,
$this->se_cfg['data']['se_types'][$t_item['name']]['actions']);
}
if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']))
$this->se_cfg['data']['se_types'][$t_item['name']]['options'] = array();
if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']['active']))
$this->se_cfg['data']['se_types'][$t_item['name']]['options']['active'] = 'yes';
if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide']))
$this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'show';
if ($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] == "yes")
$this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'show';
else if ($this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] == "no")
$this->se_cfg['data']['se_types'][$t_item['name']]['options']['showhide'] = 'hide';
if (!isset($this->se_cfg['data']['se_types'][$t_item['name']]['options']['qover']))
$this->se_cfg['data']['se_types'][$t_item['name']]['options']['qover'] = 'main';
}
}
if (!isset($this->se_cfg['options']))
$this->se_cfg['options'] = array();
/*
$this->se_cfg['options']['plugins'] = array();
$this->se_cfg['options']['plugins']['google-sitemap-generator'] = array();
$this->se_cfg['options']['plugins']['google-sitemap-generator']['name'] = __("Google XML Sitemaps", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['google-sitemap-generator']['url'] = "http://wordpress.org/extend/plugins/google-sitemap-generator/";
$this->se_cfg['options']['plugins']['google-sitemap-generator']['desc'] = __("Warning: Page ID listed in the Sitemap plugin will be removed and replaced with Page ID from the Simply Exclude plugin. Post ID values will be ignored", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['google-sitemap-generator']['version'] = "3.1.6";
$this->se_cfg['options']['plugins']['google-sitemap-generator']['active'] = false;
$this->se_cfg['options']['plugins']['google-sitemap-generator']['plugin_key'] = "google-sitemap-generator/sitemap.php";
$this->se_cfg['options']['plugins']['google-sitemap-generator']['actions'] = array();
$this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['pages']['desc'] = __("Update Excluded Pages", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['pages']['update'] = false;
$this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['categories']['desc'] = __("Update Excluded Categories", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['google-sitemap-generator']['actions']['categories']['update'] = false;
$this->se_cfg['options']['plugins']['search-unleashed'] = array();
$this->se_cfg['options']['plugins']['search-unleashed']['name'] = __("Search Unleashed", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['search-unleashed']['url'] = "http://wordpress.org/extend/plugins/search-unleashed/";
$this->se_cfg['options']['plugins']['search-unleashed']['desc'] = __("Warning: Page ID listed in the Search Unleashed plugin will be removed and replaced with Page ID from the Simply Exclude plugin. Post ID values will be ignored", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['search-unleashed']['version'] = "1.0.5";
$this->se_cfg['options']['plugins']['search-unleashed']['active'] = false;
$this->se_cfg['options']['plugins']['search-unleashed']['plugin_key'] = "search-unleashed/search-unleashed.php";
$this->se_cfg['options']['plugins']['search-unleashed']['actions'] = array();
$this->se_cfg['options']['plugins']['search-unleashed']['actions']['pages']['desc'] = __("Update Excluded Pages", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['search-unleashed']['actions']['pages']['update'] = false;
$this->se_cfg['options']['plugins']['search-unleashed']['actions']['categories']['desc'] = __("Update Excluded Categories", SIMPLY_EXCLUDE_I18N_DOMAIN);
$this->se_cfg['options']['plugins']['search-unleashed']['actions']['categories']['update'] = false;
$this->se_cfg['options']['plugins']['search-unleashed']['desc'] = __("Warning: Page ID listed in the Search Unleashed plugin will be removed and replaced with Page ID from the Simply Exclude plugin. Post ID values will be ignored", SIMPLY_EXCLUDE_I18N_DOMAIN);
foreach($this->se_cfg['options']['plugins'] as $plugin => $plugin_data)
{
if ((isset($plugin_data['plugin_key'])) && (strlen($plugin_data['plugin_key'])))
{
if ($this->is_plugin_active($plugin_data['plugin_key']))
{
$this->se_cfg['options']['plugins'][$plugin]['active'] = true;
}
}
}
*/
}
function se_convert_configuration() {
$local_cfg = array();
// If we don't find the main SE option then assume we are upgrading to grab via the old 'key'
$tmp_se_cfg = get_option('simplyexclude');
if (is_serialized($tmp_se_cfg))
$local_cfg = unserialize($tmp_se_cfg);
if (isset($local_cfg['cfg']['myurl']))
unset($local_cfg['cfg']['myurl']);
// Here assumed older data structure. Need to convert the old array elements to match the new Taxonomy tags
if (isset($local_cfg['cats']))
{
$local_cfg['data']['taxonomies']['category'] = $local_cfg['cats'];
unset($local_cfg['cats']);
if (!isset($local_cfg['data']['taxonomies']['category']['terms']))
$local_cfg['data']['taxonomies']['category']['terms'] = array();
if (isset($local_cfg['data']['taxonomies']['category']['is_home'])) {
$local_cfg['data']['taxonomies']['category']['terms']['is_home'] = $local_cfg['data']['taxonomies']['category']['is_home'];
unset($local_cfg['data']['taxonomies']['category']['is_home']);
}
if (isset($local_cfg['data']['taxonomies']['category']['is_archive'])) {
$local_cfg['data']['taxonomies']['category']['terms']['is_archive'] = $local_cfg['data']['taxonomies']['category']['is_archive'];
unset($local_cfg['data']['taxonomies']['category']['is_archive']);
}
if (isset($local_cfg['data']['taxonomies']['category']['is_search'])) {
$local_cfg['data']['taxonomies']['category']['terms']['is_search'] = $local_cfg['data']['taxonomies']['category']['is_search'];
unset($local_cfg['data']['taxonomies']['category']['is_search']);
}
if (isset($local_cfg['data']['taxonomies']['category']['is_feed'])) {
$local_cfg['data']['taxonomies']['category']['terms']['is_feed'] = $local_cfg['data']['taxonomies']['category']['is_feed'];
unset($local_cfg['data']['taxonomies']['category']['is_feed']);
}
if (isset($local_cfg['data']['taxonomies']['category']['extra'])) {
if (isset($local_cfg['data']['taxonomies']['category']['extra']['wp_list_categories'])) {
if ($local_cfg['data']['taxonomies']['category']['extra']['wp_list_categories'] == "Yes")
$local_cfg['data']['taxonomies']['category']['actions']['widget_category'] = "e";
if (isset($local_cfg['data']['taxonomies']['category']['terms']['is_archive']))
$local_cfg['data']['taxonomies']['category']['terms']['widget_category'] = $local_cfg['data']['taxonomies']['category']['terms']['is_archive'];
unset($local_cfg['data']['taxonomies']['category']['wp_list_categories']);
}
unset($local_cfg['data']['taxonomies']['category']['extra']);
}
}
if (isset($local_cfg['tags']))
{
$local_cfg['data']['taxonomies']['post_tag'] = $local_cfg['tags'];
unset($local_cfg['tags']);
if (!isset($local_cfg['data']['taxonomies']['post_tag']['terms']))
$local_cfg['data']['taxonomies']['post_tag']['terms'] = array();
if (isset($local_cfg['data']['taxonomies']['post_tag']['is_home'])) {
$local_cfg['data']['taxonomies']['post_tag']['terms']['is_home'] = $local_cfg['data']['taxonomies']['post_tag']['is_home'];
unset($local_cfg['data']['taxonomies']['post_tag']['is_home']);
}
if (isset($local_cfg['data']['taxonomies']['post_tag']['is_archive'])) {
$local_cfg['data']['taxonomies']['post_tag']['terms']['is_archive'] = $local_cfg['data']['taxonomies']['post_tag']['is_archive'];
unset($local_cfg['data']['taxonomies']['post_tag']['is_archive']);
}
if (isset($local_cfg['data']['taxonomies']['post_tag']['is_search'])) {
$local_cfg['data']['taxonomies']['post_tag']['terms']['is_search'] = $local_cfg['data']['taxonomies']['post_tag']['is_search'];
unset($local_cfg['data']['taxonomies']['post_tag']['is_search']);
}
if (isset($local_cfg['data']['taxonomies']['post_tag']['is_feed'])) {
$local_cfg['data']['taxonomies']['post_tag']['terms']['is_feed'] = $local_cfg['data']['taxonomies']['post_tag']['is_feed'];
unset($local_cfg['data']['taxonomies']['post_tag']['is_feed']);
}
if (isset($local_cfg['data']['taxonomies']['post_tag']['extra'])) {
if (isset($local_cfg['data']['taxonomies']['post_tag']['extra']['wp_tag_cloud'])) {
if ($local_cfg['data']['taxonomies']['post_tag']['extra']['wp_list_categories'] == "Yes")
$local_cfg['data']['taxonomies']['post_tag']['actions']['widget_tag_cloud'] = "e";
if (isset($local_cfg['data']['taxonomies']['post_tag']['terms']['is_archive']))
$local_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'] = $local_cfg['data']['taxonomies']['post_tag']['terms']['is_archive'];
unset($local_cfg['data']['taxonomies']['post_tag']['wp_list_categories']);
}
unset($local_cfg['data']['taxonomies']['post_tag']['extra']);
}
}
if (isset($local_cfg['authors']))
{
$local_cfg['data']['se_types']['users'] = $local_cfg['authors'];
unset($local_cfg['authors']);
if (!isset($local_cfg['data']['se_types']['users']['terms']))
$local_cfg['data']['se_types']['users']['terms'] = array();
if (isset($local_cfg['data']['se_types']['users']['is_home'])) {
$local_cfg['data']['se_types']['users']['terms']['is_home'] = $local_cfg['data']['se_types']['users']['is_home'];
unset($local_cfg['data']['se_types']['users']['is_home']);
}
if (isset($local_cfg['data']['se_types']['users']['is_archive'])) {
$local_cfg['data']['se_types']['users']['terms']['is_archive'] = $local_cfg['data']['se_types']['users']['is_archive'];
unset($local_cfg['data']['se_types']['users']['is_archive']);
}
if (isset($local_cfg['data']['se_types']['users']['is_search'])) {
$local_cfg['data']['se_types']['users']['terms']['is_search'] = $local_cfg['data']['se_types']['users']['is_search'];
unset($local_cfg['data']['se_types']['users']['is_search']);
}
if (isset($local_cfg['data']['se_types']['users']['is_feed'])) {
$local_cfg['data']['se_types']['users']['terms']['is_feed'] = $local_cfg['data']['se_types']['users']['is_feed'];
unset($local_cfg['data']['se_types']['users']['is_feed']);
}
}
if (isset($local_cfg['pages']))
{
$local_cfg['data']['post_types']['page'] = $local_cfg['pages'];
unset($local_cfg['pages']);
if (!isset($local_cfg['data']['post_types']['page']['terms']))
$local_cfg['data']['post_types']['page']['terms'] = array();
if (isset($local_cfg['data']['post_types']['page']['is_search'])) {
$local_cfg['data']['post_types']['page']['terms']['is_search'] = $local_cfg['data']['post_types']['page']['is_search'];
unset($local_cfg['data']['post_types']['page']['is_search']);
}
}
/*
if (isset($local_cfg['options']['google-sitemap-generator']))
{
$local_cfg['options']['plugins']['google-sitemap-generator'] = $local_cfg['options']['google-sitemap-generator'];
unset($local_cfg['options']['google-sitemap-generator']);
if (!isset($local_cfg['options']['plugins']['google-sitemap-generator']['plugin_key']))
$local_cfg['options']['plugins']['google-sitemap-generator']['plugin_key'] = "google-sitemap-generator/sitemap.php";
}
if (isset($local_cfg['options']['search-unleashed']))
{
$local_cfg['options']['plugins']['search-unleashed'] = $local_cfg['options']['search-unleashed'];
unset($local_cfg['options']['search-unleashed']);
if (!isset($local_cfg['options']['plugins']['search-unleashed']['plugin_key']))
$local_cfg['options']['plugins']['search-unleashed']['plugin_key'] = "search-unleashed/search-unleashed.php";
}
*/
return $local_cfg;
}
function is_plugin_active( $plugin ) {
if (is_admin())
{
return is_plugin_active($plugin);
}
else
{
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
}
}
function se_save_config()
{
$ret = update_option($this->options_key, serialize($this->se_cfg));
}
/*
function se_load_options()
{
$check_plugins = get_option('active_plugins');
if ($check_plugins)
{
foreach($check_plugins as $plugin_item)
{
$plugin_path_prefix = explode('/', $plugin_item);
if (isset($this->se_cfg['options'][$plugin_path_prefix[0]]))
$this->se_cfg['options'][$plugin_path_prefix[0]]['status'] = true;
}
}
}
*/
/****************************************************************************************************************************/
/* */
/* LOAD TYPES (TAX, POST, SE) */
/* */
/****************************************************************************************************************************/
function se_load_taxonomy_list()
{
$se_taxonomies = array();
$taxonomies = get_taxonomies();
if ( $taxonomies )
{
foreach($taxonomies as $tax_item)
{
if (array_search($tax_item, $this->se_taxonomies_exclude) !== false)
continue;
$tax_struct = get_taxonomy($tax_item);
//echo "tax_struct"; print_r($tax_struct); echo " ";
if ($tax_struct)
{
//$se_taxonomies[$tax_struct->labels->name] = $tax_struct;
$se_taxonomies[$tax_item] = $tax_struct;
}
}
}
ksort($se_taxonomies);
return $se_taxonomies;
}
function se_load_post_type_list()
{
$se_post_types = array();
$post_types = get_post_types();
if ( $post_types )
{
foreach($post_types as $post_type_item)
{
if (array_search($post_type_item, $this->se_post_types_exclude) !== false)
continue;
$post_type_struct = get_post_type_object($post_type_item);
if ($post_type_struct)
{
//$se_post_types[$post_type_struct->labels->name] = $post_type_struct;
$se_post_types[$post_type_item] = $post_type_struct;
}
}
}
ksort($se_post_types);
return $se_post_types;
}
function se_load_se_type_list()
{
$se_types['users'] = array(
'name' => 'users'
);
ksort($se_types);
return $se_types;
}
/****************************************************************************************************************************/
/* */
/* LOAD TYPE DEFAULT ACTIONS */
/* */
/****************************************************************************************************************************/
function se_load_taxonomy_default_actions($taxonomy)
{
if (!$taxonomy) return;
$taxonomy_actions['is_home'] = "i";
$taxonomy_actions['is_archive'] = "e";
$taxonomy_actions['is_search'] = "e";
$taxonomy_actions['is_feed'] = "e";
if ($taxonomy == "category")
{
$taxonomy_actions['widget_category'] = "e";
$taxonomy_actions['widget_tag_cloud'] = "e";
}
if ($taxonomy == "post_tag")
{
$taxonomy_actions['widget_tag_cloud'] = "e";
}
return $taxonomy_actions;
}
function se_load_post_type_default_actions($post_type)
{
if (!$post_type) return;
$taxonomy_actions = array();
$post_type_object = get_post_type_object($post_type);
if ($post_type_object->capability_type == "post")
{
$taxonomy_actions['is_home'] = "i";
$taxonomy_actions['is_archive'] = "e";
$taxonomy_actions['is_search'] = "e";
$taxonomy_actions['is_feed'] = "e";
//$taxonomy_actions['widget_archives'] = "e";
}
else if ($post_type == "page")
{
$taxonomy_actions['is_search'] = "e";
$taxonomy_actions['widget_pages'] = "e";
}
else
{
$taxonomy_actions['is_search'] = "e";
}
return $taxonomy_actions;
}
function se_load_se_type_default_actions()
{
$taxonomy_actions['is_home'] = "i";
$taxonomy_actions['is_archive'] = "e";
$taxonomy_actions['is_search'] = "e";
$taxonomy_actions['is_feed'] = "e";
return $taxonomy_actions;
}
/****************************************************************************************************************************/
/* */
/* ACTION LABELS */
/* */
/****************************************************************************************************************************/
function get_taxonomy_action_label($taxonomy, $action, $key)
{
// echo "taxonomy=[". $taxonomy ."] ";
// echo "action=[". $action ."] ";
// echo "key=[". $key ."] ";
switch($action)
{
case 'is_home':
switch($key)
{
case 'name':
return __("Front/Home", SIMPLY_EXCLUDE_I18N_DOMAIN);;
break;
case 'description':
return __("Visibility on the front/main page.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'is_archive':
switch($key)
{
case 'name':
return __("Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility on the archive of categories on the sidebar.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'is_search':
switch($key)
{
case 'name':
return __("Searches", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility in search results.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'is_feed':
switch($key)
{
case 'name':
return __("Feeds", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility in RSS/RSS2/Atom feeds.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'widget_category':
if ($taxonomy == "category")
{
switch($key)
{
case 'name':
return __("Widget: Categories", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Exclude from WordPress List Category Widget.", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
default:
return;
break;
}
}
return;
break;
case 'widget_tag_cloud':
if (($taxonomy == "post_tag") || ($taxonomy == "category"))
{
switch($key)
{
case 'name':
return __("Widget: Tag Cloud", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Exclude from WordPress Tag Cloud Widget.", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
default:
return;
break;
}
}
return;
break;
default:
return;
break;
}
}
function get_post_type_action_label($post_type, $action, $key)
{
switch($action)
{
case 'is_home':
switch($key)
{
case 'name':
return __("Front/Home", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility on the front/main page. Set 'Include All' to have this Post Type displayed in addition to the normal Posts.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'is_archive':
switch($key)
{
case 'name':
return __("Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility on the Post Type archive.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'is_feed':
switch($key)
{
case 'name':
return __("Feeds", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility in RSS/RSS2/Atom feeds.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'is_search':
switch($key)
{
case 'name':
return __("Searches", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility in search results.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'widget_pages':
switch($key)
{
case 'name':
return __("Widget: Pages", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Exclude from WordPress Pages Widget. Child pages are automatically excluded if the parent is Excluded.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
return;
break;
case 'widget_archives':
if ($post_type == "post") {
switch($key)
{
case 'name':
return __("Widget: Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Exclude from Post Archives Widget.", SIMPLY_EXCLUDE_I18N_DOMAIN);
default:
return;
}
}
return;
break;
default:
return;
break;
}
}
function get_se_type_action_label($se_type, $action, $key)
{
switch($action)
{
case 'is_home':
switch($key)
{
case 'name':
return __("Front/Home", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility on the front/main page.", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
default:
return;
}
return;
break;
case 'is_archive':
switch($key)
{
case 'name':
return __("Archives", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility on the archive of categories on the sidebar.", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
default:
return;
}
return;
break;
case 'is_search':
switch($key)
{
case 'name':
return __("Searches", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility in search results.", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
default:
return;
}
return;
break;
case 'is_feed':
switch($key)
{
case 'name':
return __("Feeds", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
case 'description':
return __("Visibility in RSS/RSS2/Atom feeds.", SIMPLY_EXCLUDE_I18N_DOMAIN);
break;
default:
return;
}
return;
break;
default:
return;
break;
}
}
/****************************************************************************************************************************/
/* */
/* SE FILTER LOGIC */
/* */
/****************************************************************************************************************************/
function se_filters($query)
{
global $wp_version;
// We don't process filtering for admin. ever!
if ((is_admin()) || ($query->is_admin))
return $query;
// Check our debug
if (( current_user_can('manage_options') ) && (isset($_GET['SE_DEBUG'])))
$se_debug = true;
else
$se_debug = false;
// Normally we only want to handle the main page loop. But sometimes...
$is_main_query_loop = false;
global $wp_the_query;
if ($wp_the_query === $query)
$is_main_query_loop = true;
if ( $se_debug == true ) {
if ($is_main_query_loop == true)
echo "is_main_query_loop=[true] ";
else
echo "is_main_query_loop=[false] ";
}
if (isset($query->query_vars['post_type'])) {
if (array_search($query->query_vars['post_type'], $this->se_post_types_exclude) !== false)
return $query;
}
$this->se_load_config();
$action_data = array();
// Only filter on our actions.
if (($query->is_home) || ($query->is_posts_page))
{
$action_data = $this->se_get_action_data('is_home');
}
else if ($query->is_search)
{
$action_data = $this->se_get_action_data('is_search');
}
else if ($query->is_feed)
{
$action_data = $this->se_get_action_data('is_feed');
}
else if ($query->is_archive)
{
$action_data = $this->se_get_action_data('is_archive');
}
if ( $se_debug == true ) {
echo "action_data"; print_r($action_data); echo " ";
}
if ($action_data)
{
$tax_query = array();
$tax_query_relation = array();
foreach($action_data as $key => $key_data)
{
if ($key == "taxonomies")
{
foreach($key_data as $key_key => $key_key_data)
{
if (($is_main_query_loop == false) && ($this->se_cfg['data']['taxonomies'][$key_key]['options']['qover'] == "main"))
continue;
$tax_args = array(
'taxonomy' => $key_key,
'field' => 'id',
'terms' => $key_key_data['terms']
);
if ($key_key_data['actions'] == "e")
{
$tax_args['operator'] = "NOT IN";
$tax_query_relation['NOT IN'] = "NOT IN";
}
else if ($key_key_data['actions'] == "i")
{
$tax_args['operator'] = "IN";
$tax_query_relation['IN'] = "IN";
}
$tax_query[] = $tax_args;
}
}
else if ($key == "post_types")
{
$post_types_array = array();
$post__in = array();
$post__not_in = array();
$post__all = array();
foreach($key_data as $key_key => $key_key_data)
{
if (($is_main_query_loop == false) && ($this->se_cfg['data']['post_types'][$key_key]['options']['qover'] == "main"))
continue;
if ($key_key_data['actions'] == 'e') {
$post__not_in = array_merge($post__not_in, $key_key_data['terms']);
$post_types_array['__not_in'][] = $key_key;
} else if ($key_key_data['actions'] == 'i') {
$post__in = array_merge($post__in, $key_key_data['terms']);
$post_types_array['__in'][] = $key_key;
} else if ($key_key_data['actions'] == 'a') {
$post_types_array['all'][] = $key_key;
}
}
$query_post_types = $query->get('post_type');
if (!$query_post_types) {
if (isset($_GET['post_type'])) {
$query_post_types = explode(',', $_GET['post_type']);
if ($query_post_types) {
foreach($query_post_types as $idx => $post_type) {
$query_post_types[$idx] = trim($post_type);
}
}
}
}
if (!$query_post_types) $query_post_types = array();
else if (!is_array($query_post_types))
{
$query_post_types = array($query_post_types);
}
if ( $se_debug == true ) {
echo "query_post_types"; print_r($query_post_types); echo " ";
echo "post_types_array"; print_r($post_types_array); echo " ";
echo "post__not_in"; print_r($post__not_in); echo " ";
echo "post__in"; print_r($post__in); echo " ";
}
if (count($post__not_in))
{
$query->set('post__not_in', $post__not_in);
if ( $se_debug == true ) {
echo "PROCESSING: POST__NOT_IN ";
echo "post__not_in"; print_r($post__not_in); echo " ";
}
}
else if (count($post__in))
{
$query->set('post__in', $post__in);
if (isset($post_types_array['__in']))
{
$merged_query_post_types = array_unique(array_merge($post_types_array['__in'], $query_post_types));
$query->set('post_type', $merged_query_post_types);
}
if ( $se_debug == true ) {
echo "PROCESSING: POST__IN ";
echo "post__in"; print_r($post__in); echo " ";
echo "merged_query_post_types"; print_r($merged_query_post_types); echo " ";
}
}
else if ((isset($post_types_array['all'])) && (count($post_types_array['all'])))
{
$merged_query_post_types = array_unique(array_merge($post_types_array['all'], $query_post_types));
if ( $se_debug == true ) {
echo "post_types_array[all]"; print_r($post_types_array['all']); echo " ";
echo "merged_query_post_types"; print_r($merged_query_post_types); echo " ";
}
$query->set('post_type', $merged_query_post_types);
}
}
else if ($key == "se_types")
{
foreach($key_data as $key_key => $key_key_data)
{
if (($is_main_query_loop == false) && ($this->se_cfg['data']['se_types'][$key_key]['options']['qover'] == "main"))
continue;
if ($key_key == "users")
{
$user_ids = $this->se_listify_ids($key_key_data['terms'], $key_key_data['actions']);
if ($user_ids)
{
$query->set('author', $user_ids);
if ( $se_debug == true ) {
echo "user_ids=[". $user_ids ."] ";
}
}
}
}
}
}
if (count($tax_query))
{
if (count($tax_query_relation) == 2)
$tax_query['relation'] = "OR";
else
$tax_query['relation'] = "AND";
if ( $se_debug == true ) {
echo "tax_query"; print_r($tax_query); echo " ";
}
$query->set('tax_query', $tax_query);
}
if ( $se_debug == true ) {
echo "query"; print_r($query); echo " ";
}
}
return $query;
}
function se_get_action_data($action='')
{
if (!$action) return;
$action_data = array();
//echo "action=[". $action ."] ";
//echo "se_cfg taxonomies"; print_r($this->se_cfg['data']['taxonomies']); echo " ";
foreach($this->se_cfg['data']['taxonomies'] as $key => $data)
{
//echo "data"; print_r($data); echo " ";
if ((isset($data['options']['active'])) && ($data['options']['active'] == 'yes'))
{
if ((!isset($data['terms'][$action])) || (!count($data['terms'][$action])))
continue;
foreach($data['terms'][$action] as $id => $val)
{
$action_data['taxonomies'][$key]['terms'][] = $id;
}
$action_data['taxonomies'][$key]['actions'] = $data['actions'][$action];
}
}
//echo "se_cfg post_types"; print_r($this->se_cfg['data']['post_types']); echo " ";
foreach($this->se_cfg['data']['post_types'] as $key => $data)
{
if ((isset($data['options']['active'])) && ($data['options']['active'] == 'yes'))
{
if ((!isset($data['terms'][$action])) || (!count($data['terms'][$action])))
{
if ((isset($data['actions'][$action]['action'])) && ($data['actions'][$action]['action'] == 'a'))
{
$action_data['post_types'][$key]['actions'] = $data['actions'][$action];
}
continue;
}
foreach($data['terms'][$action] as $id => $val)
{
$action_data['post_types'][$key]['terms'][] = $id;
}
$action_data['post_types'][$key]['actions'] = $data['actions'][$action];
}
}
//echo "se_cfg se_types"; print_r($this->se_cfg['data']['se_types']); echo " ";
foreach($this->se_cfg['data']['se_types'] as $key => $data)
{
if ((isset($data['options']['active'])) && ($data['options']['active'] == 'yes'))
{
if ((!isset($data['terms'][$action])) || (!count($data['terms'][$action])))
continue;
foreach($data['terms'][$action] as $id => $val)
{
$action_data['se_types'][$key]['terms'][] = $id;
}
$action_data['se_types'][$key]['actions'] = $data['actions'][$action];
}
}
//echo "action_data"; print_r($action_data); echo " ";
return $action_data;
}
/****************************************************************************************************************************/
/* */
/* WIDGET FILTER LOGIC */
/* */
/****************************************************************************************************************************/
function se_widget_pages_args_proc($args)
{
//echo "args"; print_r($args); echo " ";
if (isset($args['exclude']))
{
if ((is_array($args['exclude'])) && (count($args['exclude'])))
return $args;
else if (strlen($args['exclude']))
return $args;
}
if (isset($args['include']))
{
if ((is_array($args['include'])) && (count($args['include'])))
return $args;
else if (strlen($args['include']))
return $args;
}
$this->se_load_config();
// echo "se_cfg"; print_r($this->se_cfg['data']['post_types']['page']); echo " ";
if ( (isset($this->se_cfg['data']['post_types']['page']['terms']['widget_pages']))
&& (count($this->se_cfg['data']['post_types']['page']['terms']['widget_pages'])) )
{
//echo "se_cfg"; print_r($this->se_cfg['data']['post_types']['page']); echo " ";
//die();
$action = $this->se_cfg['data']['post_types']['page']['actions']['widget_pages'];
$terms = $this->se_listify_ids(array_keys($this->se_cfg['data']['post_types']['page']['terms']['widget_pages']), 'i');
//echo "terms"; print_r($terms); echo " ";
if ($action == "e")
$args['exclude'] = $terms;
else if ($action == 'i')
$args['include'] = $terms;
}
//echo "args AFTER"; print_r($args); echo " ";
return $args;
}
function se_widget_categories_dropdown_args_proc($args)
{
if ((isset($args['include'])) || (isset($args['exclude'])))
return;
$this->se_load_config();
//echo "widget_category"; print_r($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category']); echo " ";
if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category']))
&& (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'])) )
{
$action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_category'];
$terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_category'];
$all_cat_ids = array();
if ($action == 'e')
{
$all_cat_ids = array_keys($terms);
}
else if ($action == 'i')
{
$all_cat_ids = get_all_category_ids();
if (!$all_cat_ids)
$all_cat_ids = array();
foreach($terms as $c_idx => $c_item)
{
$item_idx = array_search($c_idx, $all_cat_ids);
if ($item_idx !== false)
unset($all_cat_ids[$item_idx]);
}
}
if ((isset($all_cat_ids)) && (count($all_cat_ids)))
{
$args['exclude'] = implode(',', $all_cat_ids);
}
}
return $args;
}
// The tag Cloud widget now supports using either taxonomy (post_tag or category).
function se_widget_tag_cloud_args_proc($args)
{
if ((isset($args['include'])) || (isset($args['exclude'])))
return $args;
if (!isset($args['taxonomy']))
return $args;
if ( ($args['taxonomy'] != "category") && ($args['taxonomy'] != "post_tag") )
return $args;
$this->se_load_config();
switch ($args['taxonomy'])
{
case 'post_tag':
if ( (isset($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud']))
&& (count($this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'])) )
{
$action = $this->se_cfg['data']['taxonomies']['post_tag']['actions']['widget_tag_cloud'];
$terms = $this->se_cfg['data']['taxonomies']['post_tag']['terms']['widget_tag_cloud'];
$all_tags = get_tags('hide_empty=0&orderby=name&order=ASC');
$all_tag_ids = array();
if ($all_tags)
{
foreach($all_tags as $t_item)
{
$all_tag_ids[] = $t_item->term_id;
}
}
if (count($all_tag_ids))
{
if ($action == 'e')
{
$all_tag_ids = array_keys($terms);
}
else if ($action == 'i')
{
foreach($terms as $c_idx => $c_item)
{
$item_idx = array_search($c_idx, $all_tag_ids);
if ($item_idx !== false)
unset($all_tag_ids[$item_idx]);
}
}
if ((isset($all_tag_ids)) && (count($all_tag_ids)))
{
$args['exclude'] = implode(',', $all_tag_ids);
}
}
}
break;
case 'category':
if ( (isset($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud']))
&& (count($this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'])) )
{
$action = $this->se_cfg['data']['taxonomies']['category']['actions']['widget_tag_cloud'];
$terms = $this->se_cfg['data']['taxonomies']['category']['terms']['widget_tag_cloud'];
$all_cat_ids = array();
if ($action == 'e')
{
$all_cat_ids = array_keys($terms);
}
else if ($action == 'i')
{
$all_cat_ids = get_all_category_ids();
if (!$all_cat_ids)
$all_cat_ids = array();
foreach($terms as $c_idx => $c_item)
{
$item_idx = array_search($c_idx, $all_cat_ids);
if ($item_idx !== false)
unset($all_cat_ids[$item_idx]);
}
}
if ((isset($all_cat_ids)) && (count($all_cat_ids)))
{
$args['exclude'] = implode(',', $all_cat_ids);
}
}
break;
default:
break;
}
return $args;
}
function se_widget_getarchives_where($where_sql) {
if (is_admin()) return $where_sql;
//echo "where_sql[". $where_sql ."] ";
//echo "args"; print_r($args); echo " ";
$this->se_load_config();
//echo "se_cfg"; print_r($this->se_cfg); echo " ";
$action_data = $this->se_get_action_data('is_archive');
//echo "action_data"; print_r($action_data); echo " ";
//die();
$post__in = array();
$post__not_in = array();
if ($action_data) {
foreach($action_data as $key => $key_data) {
if ($key == "post_types") {
foreach($key_data as $key_key => $key_key_data) {
//echo "key_key[". $key_key ."] ";
//echo "key_key_data"; print_r($key_key_data); echo " ";
if ($key_key_data['actions'] == 'e') {
$post__not_in = array_merge($post__not_in, $key_key_data['terms']);
} else if ($key_key_data['actions'] == 'i') {
$post__in = array_merge($post__in, $key_key_data['terms']);
}
}
} else if ($key == "taxonomies") {
foreach($key_data as $key_key => $key_key_data) {
//echo "key_key[". $key_key ."] ";
//echo "key_key_data"; print_r($key_key_data); echo " ";
if ((isset($key_key_data['terms'])) && (!empty($key_key_data['terms']))) {
$posts_ids = get_objects_in_term( $key_key_data['terms'], $key_key );
if ( !is_wp_error( $posts_ids ) ) {
//echo "posts_ids"; print_r($posts_ids); echo " ";
if ($key_key_data['actions'] == 'e') {
$post__not_in = array_merge($post__not_in, $posts_ids);
} else if ($key_key_data['actions'] == 'i') {
$post__in = array_merge($post__in, $posts_ids);
}
}
}
}
}
}
}
if (!empty($post__not_in)) {
//echo "post__not_in"; print_r($post__not_in); echo " ";
$where_sql .= " AND ID NOT IN(". implode(',', $post__not_in) .") ";
} else if (!empty($post__in)) {
//echo "post__in"; print_r($post__in); echo " ";
$where_sql .= " AND ID IN(". implode(',', $post__not_in) .") ";
}
//echo "where_sql[". $where_sql ."] ";
return $where_sql;
}
function se_admin_footer()
{
if ( !current_user_can('manage_options') )
return;
if ($this->check_url('wp-admin/edit-tags.php'))
{
global $taxonomy;
?>
display_instructions('taxonomy');
$this->se_show_taxonomy_actions_panel($taxonomy);
}
?>
check_url('wp-admin/edit.php'))
{
global $post_type;
?>
display_instructions('post_type');
$this->se_show_post_type_actions_panel($post_type);
}
?>
check_url('wp-admin/users.php'))
{
?>
display_instructions('users');
$this->se_show_se_type_actions_panel('users');
?>
"; print_r($_REQUEST); echo "";
//die();
if ( !current_user_can('manage_options') )
die();
if ((isset($_REQUEST['se_action'])) && ($_REQUEST['se_action'] == "se_update_terms"))
{
if (!isset($_REQUEST['is_checked'])) die();
if (($_REQUEST['is_checked'] != 'yes') && ($_REQUEST['is_checked'] != 'no')) die();
$is_checked = $_REQUEST['is_checked'];
if (isset($_REQUEST['se_cfg']))
{
$this->se_load_config();
$se_cfg = $_REQUEST['se_cfg'];
$arg_parts = explode('[', $se_cfg);
foreach($arg_parts as $idx => $val)
{
$arg_parts[$idx] = str_replace(']', '', $val);
}
//echo "arg_parts"; print_r($arg_parts); echo " ";
if ($arg_parts[1] == "users") // Is a User
{
$se_type = $arg_parts[1];
$action = $arg_parts[3];
$user_id = $arg_parts[4];
//echo "se_cfg BEFORE"; print_r($this->se_cfg['data']['se_types'][$se_type]); echo " ";
if ($is_checked == 'yes')
{
if (!isset($this->se_cfg['data']['se_types'][$se_type]['terms'][$action]))
$this->se_cfg['data']['se_types'][$post_type]['terms'][$action] = array();
$this->se_cfg['data']['se_types'][$se_type]['terms'][$action][$user_id] = "on";
}
else
{
if (isset($this->se_cfg['data']['se_types'][$se_type]['terms'][$action][$user_id]))
unset($this->se_cfg['data']['se_types'][$se_type]['terms'][$action][$user_id]);
}
//echo "se_cfg AFTER"; print_r($this->se_cfg['data']['se_types'][$se_type]); echo " ";
$this->se_save_config();
echo "SUCCESS";
die();
}
else if ($arg_parts[1] == "plugins")
{
if ($is_checked == "yes")
$this->se_cfg['options'][$arg_parts[1]][$arg_parts[2]]['actions'][$arg_parts[3]][$arg_parts[4]] = true;
else
$this->se_cfg['options'][$arg_parts[1]][$arg_parts[2]]['actions'][$arg_parts[3]][$arg_parts[4]] = false;
$this->se_save_config();
echo "SUCCESS";
die();
}
else if (post_type_exists($arg_parts[1])) // Is a Post Type
{
$post_type = $arg_parts[1];
$action = $arg_parts[3];
$term_id = $arg_parts[4];
if ($is_checked == 'yes')
{
if (!isset($this->se_cfg['data']['post_types'][$post_type]['terms'][$action]))
$this->se_cfg['data']['post_types'][$post_type]['terms'][$action] = array();
$this->se_cfg['data']['post_types'][$post_type]['terms'][$action][$term_id] = "on";
}
else
{
if (isset($this->se_cfg['data']['post_types'][$post_type]['terms'][$action][$term_id]))
unset($this->se_cfg['data']['post_types'][$post_type]['terms'][$action][$term_id]);
}
$this->se_save_config();
echo "SUCCESS";
die();
}
else if (taxonomy_exists($arg_parts[1])) // Else is a Taxonomy
{
$taxonomy = $arg_parts[1];
$action = $arg_parts[3];
$term_id = $arg_parts[4];
if ($is_checked == 'yes')
{
if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action]))
$this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action] = array();
$this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action][$term_id] = "on";
}
else
{
if (isset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action][$term_id]))
unset($this->se_cfg['data']['taxonomies'][$taxonomy]['terms'][$action][$term_id]);
}
$this->se_save_config();
echo "SUCCESS";
die();
}
}
}
else if ((isset($_REQUEST['se_action'])) && ($_REQUEST['se_action'] == "se_update_actions"))
{
if (!isset($_REQUEST['is_checked']))
die();
//if (($_REQUEST['is_checked'] != 'i') && ($_REQUEST['is_checked'] != 'e'))
// die();
$is_checked = $_REQUEST['is_checked'];
if (isset($_REQUEST['se_cfg']))
{
$this->se_load_config();
$se_cfg = $_REQUEST['se_cfg'];
$arg_parts = explode('[', $se_cfg);
foreach($arg_parts as $idx => $val)
{
$arg_parts[$idx] = str_replace(']', '', $val);
}
if ($arg_parts[1] == "users")
{
$se_type = $arg_parts[1];
$option = $arg_parts[2];
$action = $arg_parts[3];
if ($option == "actions")
{
if (!isset($this->se_cfg['data']['se_types'][$se_type][$option]))
$this->se_cfg['data']['se_types'][$se_type][$option] = array();
$this->se_cfg['data']['se_types'][$se_type][$option][$action] = $is_checked;
}
else if ($option == "options")
{
$this->se_cfg['data']['se_types'][$se_type][$option][$action] = $is_checked;
}
$this->se_save_config();
echo "SUCCESS";
die();
}
else if (post_type_exists($arg_parts[1])) // Is a Post Type
{
$post_type = $arg_parts[1];
$option = $arg_parts[2];
$action = $arg_parts[3];
if ($option == "actions")
{
if (!isset($this->se_cfg['data']['post_types'][$post_type][$option]))
$this->se_cfg['data']['post_types'][$post_type][$option] = array();
$this->se_cfg['data']['post_types'][$post_type][$option][$action] = $is_checked;
}
else if ($option == "options")
{
$this->se_cfg['data']['post_types'][$post_type][$option][$action] = $is_checked;
}
$this->se_save_config();
echo "SUCCESS";
die();
}
else if (taxonomy_exists($arg_parts[1])) // Else is a Taxonomy
{
$taxonomy = $arg_parts[1];
$option = $arg_parts[2];
$action = $arg_parts[3];
if ($option == "actions")
{
if (!isset($this->se_cfg['data']['taxonomies'][$taxonomy][$option]))
$this->se_cfg['data']['taxonomies'][$taxonomy][$option] = array();
$this->se_cfg['data']['taxonomies'][$taxonomy][$option][$action] = $is_checked;
}
else if ($option == "options")
{
$this->se_cfg['data']['taxonomies'][$taxonomy][$option][$action] = $is_checked;
}
$this->se_save_config();
echo "SUCCESS";
die();
}
}
}
die(); // this is required to return a proper result
}
function display_instructions($item)
{
switch ($item) {
case 'users':
?>
Include only and Exclude ?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
:
:
Include only and Exclude ?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
:
:
Include only and Exclude ?", SIMPLY_EXCLUDE_I18N_DOMAIN); ?>
:
:
display_instructions('taxonomy');
$se_taxonomies = $this->se_load_taxonomy_list();
if ($se_taxonomies)
{
foreach($se_taxonomies as $key => $taxonomy)
{
?>
labels->name; ?> ()
se_show_taxonomy_active_panel($taxonomy->name);
$this->se_show_taxonomy_actions_panel($taxonomy->name);
$this->se_show_taxonomy_showhide_panel($taxonomy->name);
$this->se_show_taxonomy_query_override_panel($taxonomy->name);
?>
display_instructions('post_type');
$se_post_types = $this->se_load_post_type_list();
if ($se_post_types)
{
foreach($se_post_types as $key => $post_type)
{
?>
labels->name; ?> ()
se_show_post_type_active_panel($post_type->name);
$this->se_show_post_type_actions_panel($post_type->name);
$this->se_show_post_type_showhide_panel($post_type->name);
$this->se_show_post_type_query_override_panel($post_type->name);
?>
display_instructions('users');
?>
se_show_se_type_active_panel('users');
$this->se_show_se_type_actions_panel('users');
$this->se_show_se_type_showhide_panel('users');
$this->se_show_se_type_query_override_panel('users');
?>
se_convert_configuration();
if ($local_cfg) {
$this->se_cfg = $local_cfg;
$this->se_save_config();
?>
Simply follow these steps
Go to the Simply Exclude Settings panel . Location the Category you want to manage
On the sub-panel ensure the Category is Active .
Next, find the row for Archives . Ensure the selection is set to Exclude
Finally, ensure the Show/Hide option is set to Show .
Now go to the WordPress Category panel . Locate the row of the Category term you want to exclude. Within the Simply Exclude column set the checkbox for Archives
Done. At this point you have set the selected Category to exclude from the Archives listing.
On the Simply Exclude Settings panel you will see a listing of all Taxonomies and Post Types as well as Users and supported plugins. For each item you will see a set of Active/Disabled radio buttons.
Active : If you set the state to Active you are telling the plugin code you want to allow filtering of this Taxonomy/Post Type.
Disabled : If you set the state to Disabled you are instead telling the plugin to not filter this Taxonomy/Post Type.
On the Simply Exclude Settings panel you will see a listing of all Taxonomies and Post Types as well as Users and supported plugins. For each item you will see a set of Show/Hide radio buttons.
Show : If you set the state to Show the plugin code will add a new column to the Taxonomy/Post Type listing tables. The plug will also add a new set of fields to the Taxonomy/Post Type editor form.
Disabled : If you set the state to Disabled the plugin will not add a new column to the Taxonomy/Post Type listing tables. Nor will it add a new set of fields to the Taxonomy/Post Type editor form.
Include only : This setting tells the plugin to include only these selected items within the filtering logic. Let us take a example. Assume you have 100 Category terms and you want to only show 3 of these Category terms on the Front/Home post listing. You could setup the logic to exclude the other 97 Category terms. The problem with this is when you are more categories which you also don't want show on the Front/Home listing you will need to remember to exclude these. Instead the Include only lets you set only the 3 Categories to be included. Now as more Categories are added they will automatically be excluded from the Front/Home listing.
Exclude : This action state is the simpler to understand. Quite simply you set this to Exclude Taxonomy or Post Type items from the available actions, Archive, Feeds, Searches, etc.
Include all : This is a special action state only available to Post Types compatible with Post . When using this special action state you can include the Post Type into the output of the other Post Types. For example in the default WordPress setup a site will display the latest Posts on the front page. Now assume you have a Custom Post Type 'Books' you also want to show on the front page. To accomplish this you would set both Posts and Books Post Types to the Include All action state.
Short answer, YES! Longer answer. This can be done but you need to be careful with the setup. This could effect how other post_types are displayed.
First, some assumptions about your WordPress setup. You MUST be able to answer YES to the following
The first assumption is you have your WordPress system setup to show your latest posts on your Home page and not a static Page.
Next, it is assumed you have setup a Custom Post Type. And this Post Type is compatible with the legacy Post type and not Page type.
Here is the setup
Go to the Simply Exclude Settings panel . Location the Post Type you want to manage
On the sub-panel ensure the Post Type is Active . Next, find the row for Front/Home . Ensure the selection is set to Include All . Finally, ensure the Show/Hide option is set to Show .
Now navigate to the Post Type listing. This is important. You must ensure no items are set to Include Only or Exclude for this Post Type.
Notes:
You can mix Post Types to include on the Home/Front page. For example you have a custom Post Type Books and you want to show Books and Posts on the Home/Front page. You should set both Post Types to Include All . You would also set one or both Post Types to Include only . The result is only those checked items will be includes. Similar results setting the Post Types to Exclude will exclude only those Post Type item.
But the process is trial and errors. You need to make sure you review this in your own setup.
Also beware of setting one Post Type to Include all or Include only then setting a second Post Type as Exclude . The Exclude Post Type items will be processed while the Include all/only items will be ignored
You can also use the Include all on the Feeds actions for Post Types
My suggestion is to start on the Simply Exclude Settings panel . For each Taxonomy and Post Type set the Active state to Disabled . Then one at a time enable a Taxonomy and check your site. Depending on the number of Taxonomies and Custom Post Types you may be introducing a conflict my including one set of items then excluding them at the same time.
Well you need to be careful when excluding both categories and tags. Since a post can be associated with both Categories and Tags there is potential that you have excluded all your posts because they are either members of excluded categories and/or members or excluded tags.
Only the parent Page itself is excluded from searches. By default WordPress does not yet include Pages in search. Make sure you have other search plugins correctly configured to not search attachments.
The Simply Exclude plugin can filter for the default WordPress Categories and Tag Cloud widgets. Note the newest version of WordPress (3.3) supports using either Tags or Categories for the Tag Cloud widget.
To set the Exclude/Include actions to work with these widgets look for the Widget: Categories and Widget: Tag Cloud actions. Then set them accordingly
If you have set these up and your widgets are still showing excluded terms then double check your theme. If you are not using the WordPress version of the widget of widgets which are included as part of your theme then there is a chance they are bypassing the filtering logic required for using the Simply Exclude plugin. Sorry to say this is beyond my control since I cannot maintain support for the many available Category or Tag Cloud widgets other developers create.
First, I'm sorry to hear my plugin effected your site. I try to test for most combinations but that is no substitute for a real system. To remove the plugin you can delete the plugin via the WordPress admin plugins panel. Or it for some reason your site is down you can FTP to your site and simply remove the plugins folder named ''. The Simply Exclude plugin does not add any permanent hack to any WordPress core file. Only one entry is added to the options table.
One important piece of information is to understand how the WP_Query system works within WordPress. If you have one Post Types where you are setting the Include only . This will execute before any excludes. This is just the way WordPress works and not something the plugin can control.
Let's consider an example. Assume you have the default Post Type Posts setup to Include only for the Front/Home. Now also assume you have a custom Post Type name Books and this action state is set to 'Include All'. When you view the Front/Home page you only see the Posts but not the Books? Why? Because WordPress see the Include only as a higher request. If both are included in your setup the Include only will be processed while the additional Exclude or Include all will be ignored.
To summarize. You can combine Exclude and Include all options with in the same Taxonomy or Post Type. But if you combine Include only with other action states like Exclude or Include all only the Include only information will be used.
"; print_r($ids_array); echo "";
//echo "action=[". $action ."] ";
$id_list = "";
if ($action == "e")
$action_value = "-";
else
$action_value = "";
foreach($ids_array as $id_key => $id_val)
{
if (strlen($id_list))
$id_list .= ",";
$id_list .= $action_value.$id_val;
}
return $id_list;
}
}
$simplyexclude = new SimplyExclude();