WordPress.org

Plugin Directory

Changeset 201713


Ignore:
Timestamp:
02/04/10 08:36:28 (4 years ago)
Author:
djzone
Message:
 
Location:
advanced-category-excluder/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • advanced-category-excluder/trunk/CHANGES.txt

    r114747 r201713  
     12010. 02. 03. - DjZoNe 
     21.5-alpha: 
     3    - added "Categories Widget support"  
     4 
     52009. 05. 12. - DjZoNe 
     61.4.3: 
     7    - removed "$force == 1"  
     8    - removed "getarchives_join" filter 
  • advanced-category-excluder/trunk/ace-widgets.php

    r115632 r201713  
    22/* 
    33Plugin Name: Advanced Category Excluder Widgets 
    4 Version: 1.4.2 
     4Version: 1.4.3 
    55Plugin URI: http://advanced-category-excluder.dev.rain.hu 
    66Description: This plugin one basic widgetsm that support exclusion 
  • advanced-category-excluder/trunk/advanced-category-excluder.php

    r115639 r201713  
    22/* 
    33Plugin Name: Advanced Category Excluder 
    4 Version: 1.4.2 
     4Version: 1.4.3 
    55Plugin URI: http://ace.dev.rain.hu 
    66Description: This plugin helps you to manage your content, RSS feeds, sidebar widgets, and fine tune where you want to display your posts, pages, links, link categories, or hide. 
     
    1111global $ace_targets, $ace_settings, $ace_version; 
    1212 
    13 $ace_version = '1.4'; 
     13$ace_version = '1.5'; 
    1414 
    1515if ($_GET['page'] == 'ace_page_main') 
     
    3434 remove_filter('get_bookmarks', 'ace_get_bookmarks'); 
    3535 remove_filter('getarchives_where','ace_getarchives_where'); 
    36  remove_filter('getarchives_join','ace_getarchives_join'); 
     36 //remove_filter('getarchives_join','ace_getarchives_join'); 
    3737 remove_filter('get_terms','ace_get_terms'); 
    3838} 
     
    8585function ace_list_pages_excludes($excludes) 
    8686{ 
    87     $filter = ace_get_section(); 
     87      $filter = ace_get_section(); 
    8888    $posts_to_exclude = get_option("ace_page_sections_".$filter); 
    8989     
     
    9191} 
    9292 
    93 function ace_oldstylefilter($cats_to_exclude, $field) 
    94 /*  
    95  * This function is to generate old style category / taxonomy filter for 
    96  * MySQL 4.0 database server family 
    97  */ 
    98 { 
    99     $cats = explode(",",$cats_to_exclude); 
    100  
    101     $out = ""; 
    102       
    103     for($i = 0; $i < count($cats); $i++) 
    104     { 
    105         $out .= "$field != '".$cats[$i]."'"; 
    106         if ($i+1 != count($cats)) $out .= " AND "; 
    107     } 
    108      
    109     return $out; 
    110 } 
    111  
    112 function ace_where(&$where,$filter="")  
     93function ace_where($where,$filter="")  
    11394{ 
    11495    global $wpdb, $wp_query; 
    11596 
    116     if((!empty($wp_query->is_category) || !empty($wp_query->is_tag) || get_option("ace_settings_onlyinwidget")) && $force == 1 ) return $where; 
     97    if((!empty($wp_query->is_category) || !empty($wp_query->is_tag) || get_option("ace_settings_onlyinwidget"))) return $where; 
    11798    /* If we are in a category archive, tag archive, or only in widgets don't apply filters */ 
    11899    
     
    126107    if ( !empty($filter) && !empty($cats_to_exclude) && strlen($cats_to_exclude) > 0) 
    127108    { 
    128         $sql_version = substr(mysql_get_server_info(),0,3); 
    129          
    130         if (empty($wpdb->term_taxonomy))  
    131         // wordpress version < 2.3 
    132         { 
    133            if ($sql_version == "4.0") 
    134            // old mysql without subquery 
    135            { 
    136                 $where .= " AND ( ".ace_oldstylefilter($cats_to_exclude, "$wpdb->post2cat.category_id")." ) "; 
    137            } 
    138            else 
    139            // at least MySQL 4.1 
    140            { 
     109         if (empty($wpdb->term_taxonomy))  
     110         // wordpress version < 2.3 
     111         { 
    141112              $where .= " AND $wpdb->post2cat.category_id NOT IN (" . $cats_to_exclude . ")"; 
    142            } 
    143113         } 
    144114         else 
    145115       { 
    146         if ($sql_version == "4.0") 
    147         { 
    148             $where .= " AND ".$wpdb->term_taxonomy.".taxonomy = 'category' AND ";        
    149             $where .= "( ".ace_oldstylefilter($cats_to_exclude, "$wpdb->term_taxonomy.term_id")." )"; 
    150         } 
    151         else 
    152         { 
    153116            $where .= " AND NOT EXISTS ("; 
    154117            $where .= "SELECT * FROM ".$wpdb->term_relationships." JOIN ".$wpdb->term_taxonomy." ON ".$wpdb->term_taxonomy.".term_taxonomy_id = ".$wpdb->term_relationships.".term_taxonomy_id "; 
    155118            $where .= "WHERE ".$wpdb->term_relationships.".object_id = ".$wpdb->posts.".ID AND ".$wpdb->term_taxonomy.".taxonomy = 'category' AND ".$wpdb->term_taxonomy.".term_id IN (" . $cats_to_exclude . ") )"; 
    156         } 
    157119      } 
    158120    } 
     
    161123} 
    162124 
    163 function ace_join(&$join,$filter="")  
     125function ace_join($join,$filter="")  
    164126{ 
    165127    global $wpdb, $wp_query; 
     
    200162} 
    201163 
    202 function ace_list_categories(&$args) 
     164function ace_list_categories($args) 
    203165/*  
    204166 * Manipulating category list  
    205167 */ 
    206168{ 
    207  
    208   if (get_option("ace_settings_hide") == 1 && get_option("ace_categories_is_home") != "") 
     169  global $wp_query; 
     170 
     171  if (get_option("ace_settings_hide") == 1) 
    209172  /* Only if the user wants this function */ 
    210   {  
    211     $cats = explode(",",get_option("ace_categories_is_home")); 
    212         
    213     if (count($cats) > 0) 
     173  { 
     174    $filter = ace_get_section(); 
     175     
     176    $cats = get_option("ace_categories_".$filter); 
     177       
     178    if (!empty($cats) && count($cats) > 0) 
    214179    /* if there is any category to hide :) */ 
    215180    { 
     
    258223    } 
    259224  } 
     225   
    260226  return($args); 
    261227} 
     
    278244            add_submenu_page('advanced-category-excluder/main.php', __('Pages', 'ace'), __('Pages', 'ace'), 'manage_options', 'advanced-category-excluder/pages/pages.php');           
    279245            add_submenu_page('advanced-category-excluder/main.php', __('Links', 'ace'), __('Links', 'ace'), 'manage_options', 'advanced-category-excluder/pages/links.php'); 
    280             add_submenu_page('advanced-category-excluder/main.php', __('Link categories', 'ace'), __('Link categories', 'ace'), 'manage_options', 'advanced-category-excluder/pages/link_categories.php');           
     246            add_submenu_page('advanced-category-excluder/main.php', __('Link categories', 'ace'), __('Link categories', 'ace'), 'manage_options', 'advanced-category-excluder/pages/link_categories.php'); 
     247      add_submenu_page('advanced-category-excluder/main.php', __('Widget - Categories', 'ace'), __('Widget - Categories', 'ace'), 'manage_options', 'advanced-category-excluder/pages/cat_widget.php');                  
    281248            add_submenu_page('advanced-category-excluder/main.php', __('Tags', 'ace'), __('Tags', 'ace'), 'manage_options', 'advanced-category-excluder/pages/tags.php'); 
    282249            add_submenu_page('advanced-category-excluder/main.php', __('Plugins homepage', 'ace'), __('Plugin homepage', 'ace'), 'manage_options', 'advanced-category-excluder/pages/home.php'); 
     
    308275    } 
    309276     
    310     $ace_targets = array('is_archive'=>__('Archive','ace'),'is_home'=>__('Home','ace'),'is_feed'=>__('RSS Posts','ace'),'is_comment_feed'=>__('RSS Comments','ace'),'is_search'=>__('Search','ace'), 'is_page'=>__('Pages', ace), 'is_single'=>__('Single Posts', ace),'norobots'=>__('Disable robots','ace')); 
     277    $ace_targets = array('is_404'=>__('404 error','ace'),'is_attachment'=>__('Attachment','ace'),'is_archive'=>__('Archive','ace'),'norobots'=>__('Disable robots','ace'),'is_home'=>__('Home','ace'), 'is_page'=>__('Pages', ace),'is_feed'=>__('RSS Posts','ace'),'is_comment_feed'=>__('RSS Comments','ace'),'is_search'=>__('Search','ace'), 'is_single'=>__('Single Post', ace)); 
    311278   
    312279  $ace_settings = array(  
     
    448415} 
    449416 
     417function ace_categories_dropdown_args($args) 
     418{ 
     419  $filter = ace_get_section();       
     420  $cats_to_exclude = get_option("ace_catwidget_".$filter); 
     421    
     422  $args['exclude']=$cats_to_exclude; 
     423   
     424  return $args; 
     425} 
     426 
    450427function ace_get_terms($terms, $taxonomies="", $args="") 
    451428{ 
     
    464441        break; 
    465442         
    466         default: 
    467             return $terms; 
     443        case "category": 
     444      $items = get_option("ace_categories_".$filter);          
    468445        break; 
    469446    } 
     
    494471add_filter('posts_distinct', 'ace_distinct'); 
    495472 
    496 add_filter('get_terms','ace_get_terms');  
     473add_filter('get_terms','ace_get_terms'); 
     474 
    497475//add_filter('wp_list_categories','ace_list_categories'); // deprecated 
    498476 
    499477add_filter('getarchives_where','ace_getarchives_where'); 
    500 add_filter('getarchives_join','ace_getarchives_join'); 
     478//add_filter('getarchives_join','ace_getarchives_join'); 
    501479add_filter('wp_list_pages_excludes','ace_list_pages_excludes'); 
    502480add_filter('get_bookmarks','ace_get_bookmarks'); 
     
    508486add_action('wp_head', 'ace_head'); 
    509487 
     488// new 
     489add_action('widget_categories_dropdown_args', 'ace_categories_dropdown_args'); 
     490add_action('widget_categories_args', 'ace_categories_dropdown_args'); 
     491 
    510492add_action('activate_advanced-category-excluder/advanced-category-excluder.php', 'ace_install'); 
    511493add_action('deactivate_advanced-category-excluder/advanced-category-excluder.php', 'ace_uninstall'); 
Note: See TracChangeset for help on using the changeset viewer.