WordPress.org

Plugin Directory

Changeset 202414


Ignore:
Timestamp:
02/06/10 00:57:02 (4 years ago)
Author:
djzone
Message:
 
Location:
advanced-category-excluder/trunk
Files:
13 added
11 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • advanced-category-excluder/trunk/advanced-category-excluder.php

    r202021 r202414  
    1818} 
    1919 
    20 function ace_admin_head()  
    21 { 
    22   global $ace_version; 
    23    
    24   $_ace_version = get_option('ace_version'); 
    25    
    26  if ($_ace_version != $ace_version) 
    27  { 
    28     add_action('admin_notices','ace_admin_notices'); 
    29     update_option('ace_version',$ace_version);     
    30  } 
    31  remove_filter('posts_join', 'ace_join'); 
    32  remove_filter('posts_where', 'ace_where'); 
    33  remove_filter('posts_distinct', 'ace_distinct'); 
    34  remove_filter('wp_list_bookmarks', 'ace_get_bookmarks'); 
    35  remove_filter('getarchives_where','ace_getarchives_where'); 
    36  //remove_filter('getarchives_join','ace_getarchives_join'); 
    37  remove_filter('get_terms','ace_get_terms'); 
    38 } 
    39  
    40 function ace_admin_notices($msg) 
    41 { 
    42   global $ace_version; 
    43    
    44   $url = 'http://ace.dev.rain.hu';    
    45   $msg = sprintf(__('It seems <strong>ACE plugin</strong> is just upgraded to the latest version %1$s. Please <strong>review the changes</strong> at our homepage <a href="%2$s" target="_blank">%2$s</a>','ace'),$ace_version,$url); 
    46  
    47   echo "<div id='update-nag'>$msg</div>";   
    48 } 
    4920function ace_getarchives_where($where,$r="") 
    5021{ 
     
    231202} 
    232203 
    233 /** 
    234  * ACE Dashboard page functions 
    235  **/ 
    236  
    237 function ace_adminmenu() 
    238 { 
    239     if ( function_exists('add_menu_page') )  
    240     { 
    241       add_menu_page(__('ACE', 'ace'), __('ACE', 'ace'), 'manage_options', 'advanced-category-excluder/main.php'); 
    242     } 
    243      
    244     if (function_exists('add_submenu_page'))  
    245     { 
    246             add_submenu_page('advanced-category-excluder/main.php', __('Settings', 'ace'), __('Settings', 'ace'), 'manage_options', 'advanced-category-excluder/main.php'); 
    247             add_submenu_page('advanced-category-excluder/main.php', __('Categories', 'ace'), __('Categories', 'ace'), 'manage_options', 'advanced-category-excluder/pages/categories.php'); 
    248             add_submenu_page('advanced-category-excluder/main.php', __('Pages', 'ace'), __('Pages', 'ace'), 'manage_options', 'advanced-category-excluder/pages/pages.php');           
    249             add_submenu_page('advanced-category-excluder/main.php', __('Links', 'ace'), __('Links', 'ace'), 'manage_options', 'advanced-category-excluder/pages/links.php'); 
    250             add_submenu_page('advanced-category-excluder/main.php', __('Link categories', 'ace'), __('Link categories', 'ace'), 'manage_options', 'advanced-category-excluder/pages/link_categories.php'); 
    251       add_submenu_page('advanced-category-excluder/main.php', __('Widget - Categories', 'ace'), __('Widget - Categories', 'ace'), 'manage_options', 'advanced-category-excluder/pages/cat_widget.php'); 
    252       add_submenu_page('advanced-category-excluder/main.php', __('Widget - Pages', 'ace'), __('Widget - Pages', 'ace'), 'manage_options', 'advanced-category-excluder/pages/page_widget.php');                       
    253             add_submenu_page('advanced-category-excluder/main.php', __('Tags', 'ace'), __('Tags', 'ace'), 'manage_options', 'advanced-category-excluder/pages/tags.php'); 
    254             add_submenu_page('advanced-category-excluder/main.php', __('Plugins homepage', 'ace'), __('Plugin homepage', 'ace'), 'manage_options', 'advanced-category-excluder/pages/home.php'); 
    255     } 
    256 } 
     204 
    257205 
    258206function ace_page_main() 
     
    262210    $ace_subpage = 1; 
    263211      if (!empty($_GET['subpage'])) $ace_subpage = intval($_GET['subpage']);  
    264 } 
    265  
    266 function ace_init() 
    267 { 
    268   global $ace_targets, $ace_settings, $ace_methods; 
    269  
    270     if (function_exists('load_plugin_textdomain'))  
    271   { 
    272         if ( !defined('WP_PLUGIN_DIR') )  
    273     { 
    274             load_plugin_textdomain('ace','wp-content/plugins/advaced-category-excluder/lang'); 
    275         } 
    276     else  
    277     { 
    278             load_plugin_textdomain('ace', false, dirname(plugin_basename(__FILE__)) . '/lang'); 
    279         } 
    280     } 
    281      
    282     $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)); 
    283    
    284   $ace_settings = array(  
    285       'hide'=>__('Do you want the categories selected for <strong>Home</strong> section, to be hidden from <strong>category list</strong> as well?','ace'), 
    286       'onlyinwidget'=>__('Do you want the posts related to the categories selected for <strong>Home</strong> section to be <strong>only</strong> excluded from the <strong>sidebar widget</strong>s? (Recent Posts, Recent Commants, Calendar)','ace'),       
    287       'showempty'=>__('Do you want the category lister, to list the empty categories?','ace'), 
    288       'ec3'=>sprintf(__('Do you want to display Event Calendar default category in the <a href="%s">Categories</a> tab?','ace'), $_SERVER['PHP_SELF']."?page=ace_page_main&amp;subpage=2"), 
    289       'exclude_method'=>__('What <strong>exclusion method</strong> do you want to use in recent comments / recent posts <strong>widgets</strong>?','ace'), 
    290       'xsg_category'=>__('Select a section to export excluded categories into <strong>XML Sitemap Generator</strong>:','ace') 
    291       ); 
    292        
    293   $ace_methods = array( 
    294     'smart' => __('This means, what widgets shows on the front shows everywhere on the site, exept when listing an excluded category, reading a post that is in an excluded category, or meet with another rule (archive, search). In that case the related comments/posts from that category will be shown as well. This method is introduced in ACE 1.3.','ace'), 
    295     'front' => __('This means, that the widgets displays what they would on the front. No exeption.','ace'), 
    296     'normal' => __('This means widget always using the actualy exclusion rules, depends on what part of the page you are browsing. It could be different on the front, in the search and in the archive','ace'), 
    297     'none' => __('No exclusion in widgets','ace') 
    298   ); 
    299212} 
    300213 
     
    360273} 
    361274 
    362 function ace_install() 
    363 { 
    364   global $wpdb, $ace_targets, $ace_settings; 
    365  
    366   foreach ($ace_targets as $key=>$v) 
    367   { 
    368     add_option("ace_categories_".$key,'','',true); 
    369   } 
    370    
    371   foreach ($ace_settings as $key=>$v) 
    372   { 
    373     switch($key) 
    374     { 
    375       case 'showempty': 
    376         $val = 1; 
    377       break; 
    378        
    379       case 'exclude_method': 
    380         $val = 'smart'; 
    381       break; 
    382        
    383       default: 
    384         $val = 0; 
    385       break; 
    386     } 
    387      
    388     add_option("ace_settings_".$key,$val,'',true); 
    389   } 
    390 } 
    391  
    392 function ace_uninstall() 
    393 { 
    394   global $ace_version; 
    395  
    396   $_ace_version = get_option('ace_version'); 
    397    
    398   if (!$_ace_version) 
    399   { 
    400     add_option("ace_version",$ace_version); 
    401   } 
    402   elseif ($_ace_version != $ace_version) 
    403   { 
    404     update_option("ace_version",$ace_version); 
    405   } 
    406 } 
    407275function ace_get_section() 
    408276{ 
     
    516384 
    517385add_filter('wp_list_pages_excludes','ace_list_pages_excludes'); 
    518 //add_filter('wp_list_bookmarks','ace_list_bookmarks'); 
    519  
    520 add_action('admin_menu', 'ace_adminmenu'); 
    521 add_action('admin_head', 'ace_admin_head'); 
    522 add_action('init','ace_init'); 
     386add_filter('wp_list_bookmarks','ace_list_bookmarks'); 
     387 
    523388 
    524389add_action('wp_head', 'ace_head'); 
     
    531396add_action('widget_links_args', 'ace_links_args'); 
    532397 
    533  
    534 add_action('activate_advanced-category-excluder/advanced-category-excluder.php', 'ace_install'); 
    535 add_action('deactivate_advanced-category-excluder/advanced-category-excluder.php', 'ace_uninstall'); 
     398require_once("ace-ui.php"); 
     399 
     400$aceui = new AceUI(); 
     401     
     402//add_action("admin_menu", );     
     403 
     404add_action('admin_menu', array($aceui, 'AdminMenu')); 
     405add_action('admin_head', array($aceui, 'AdminHead')); 
     406add_action('init',array($aceui, 'Init')); 
     407add_action('admin_init',array($aceui, 'AdminInit')); 
     408 
     409add_action('activate_advanced-category-excluder/advanced-category-excluder.php', array($aceui, 'install')); 
     410add_action('deactivate_advanced-category-excluder/advanced-category-excluder.php', array($aceui, 'deinstall'));      
     411 
    536412?> 
Note: See TracChangeset for help on using the changeset viewer.