Changeset 38551

Show
Ignore:
Timestamp:
04/06/08 01:46:42 (4 months ago)
Author:
Aaron Harun
Message:

Version 1.0 released.

Location:
access-keys/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • access-keys/trunk/access_keys.php

    r31064 r38551  
    55Description: This plugin allows you to add Access Keys to Category and Page navigation menus to make your website far more accessible. 
    66Author: Aaron Harun 
    7 Version: 0.6 
     7Version: 1.0 
    88Author URI: http://anthologyoi.com/ 
    99*/ 
     
    1414TWO: Activate. 
    1515THREE: Go to the Admin Menu under Manage named Access Keys. 
    16 FOUR: Read the instructions on the Admin Panel.  
     16FOUR: Read the instructions on the Admin Panel. 
    1717 
    1818*/ 
    1919 $access_keys = get_option('access_keys'); 
     20 
    2021// ******************************* 
    2122// Add Category Access Keys 
    2223// ******************************* 
    23  
    24 if(is_home() || is_archive() || is_singular()){ 
    25       add_filter('wp_list_categories', 'access_keys_fix_links'); 
    26        
    27       if (!strpos($_SERVER['PHP_SELF'], 'wp-admin')){ 
    28             if (version_compare($wp_version, '2.3', '<')){ 
    29                   add_filter('get_categories', 'access_keys_categories_add_key_wp21'); 
    30             }else{ 
    31                   add_filter('get_terms', 'access_keys_categories_add_key',10,2); 
    32             } 
    33              
    34       } 
    35 } 
    36  
    37 function access_keys_categories_add_key_wp21($cats){ 
     24add_filter('wp_list_categories', 'access_keys_cats'); 
     25 
     26function access_keys_cats($cats) { 
     27            return preg_replace_callback('!(<li class="cat-item (cat)-item-([0-9]*)">[\s\S]*?<a([^>]*)>)!ims', 'access_keys_finish', $cats); 
     28} 
     29 
     30// ******************************* 
     31// Add Page Access Keys 
     32// ******************************* 
     33add_filter('wp_list_pages', 'access_keys_pages'); 
     34 
     35function access_keys_pages($pages) { 
     36      return preg_replace_callback('!(<li class="page_item (page)-item-([0-9]*)"><a([^>]*)>)!ims', 'access_keys_finish', $pages); 
     37} 
     38 
     39// ******************************* 
     40// Add Access Keys 
     41// ******************************* 
     42 
     43 
     44function access_keys_finish($matches){ 
    3845global $access_keys; 
    39 $cats_temp=array(); 
    40       foreach ($cats as $cat){ 
    41             if(strlen($access_keys['cat'][$cat->cat_ID])>0){ 
    42                   $cat->cat_name .= 'accesskey=@'.$access_keys['cat'][$cat->cat_ID].'@'; 
    43             } 
    44             $cats_temp[]=$page; 
    45       } 
    46  
    47 $cats=$cats_temp;  
    48 return $cats; 
    49  
    50 } 
    51  
    52 function access_keys_categories_add_key($cats,$is_cat){ 
     46      $id = $matches[3]; 
     47      $link = $matches[0]; 
     48      if($access_keys[$matches[2]][$id]){ 
     49            $accesskey = $matches[4]. ' accesskey="'.$access_keys[$matches[2]][$id].'" '; 
     50            $link = str_replace($matches[4], $accesskey, $link); 
     51      } 
     52return $link; 
     53} 
     54 
     55 
     56// ******************************* 
     57// Admin Panel 
     58// ******************************* 
     59function access_keys_update_options($options){ 
    5360global $access_keys; 
    54       if($is_cat[0] == 'category'){ 
    55             $cats_temp=array(); 
    56             foreach ($cats as $cat){ 
    57                   if(strlen($access_keys['cat'][$cat->term_id])>0){ 
    58                         $cat->name .= 'accesskey=@'.$access_keys['cat'][$cat->term_id].'@'; 
    59                          
    60                   } 
    61                   $cats_temp[]=$cat; 
    62             } 
    63        
    64             $cats=$cats_temp;  
    65       } 
    66 return $cats; 
    67  
    68 } 
    69  
    70  
    71 // ******************************* 
    72 // Add Page Access Keys 
    73 // ******************************* 
    74 add_filter('wp_list_pages', 'access_keys_fix_links'); 
    75 if (!strpos($_SERVER['PHP_SELF'], 'wp-admin')){ 
    76       if (version_compare($wp_version, '2.3', '<')){ 
    77             add_filter('get_pages', 'access_keys_pages_add_key21'); 
    78       }else{ 
    79             add_filter('get_pages', 'access_keys_pages_add_key'); 
    80       } 
    81        
    82 } 
    83 function access_keys_pages_add_keywp21($pages){ 
    84 global $access_keys,$id; 
    85 $pages_temp=array(); 
    86 if(!$id){ 
    87       foreach ($pages as $page){ 
    88             if(strlen($access_keys['page'][$page->ID])>0){ 
    89                   $page->post_title .= 'accesskey=@'.$access_keys['page'][$page->ID].'@'; 
    90             } 
    91             $pages_temp[]=$page; 
    92       } 
    93 $pages=$pages_temp;  
    94 } 
    95        
    96 return $pages; 
    97  
    98 } 
    99  
    100 function access_keys_pages_add_key($pages){ 
    101 global $access_keys,$id; 
    102 $pages_temp=array(); 
    103  
    104       foreach ($pages as $page){ 
    105             if(strlen($access_keys['page'][$page->ID])>0){ 
    106                   $page->post_title .= 'accesskey=@'.$access_keys['page'][$page->ID].'@'; 
    107             } 
    108             $pages_temp[]=$page; 
    109       } 
    110 $pages=$pages_temp;  
    111  
    112        
    113 return $pages; 
    114  
    115 } 
    116  
    117  
    118 // ******************************* 
    119 // Add Access Keys 
    120 // ******************************* 
    121  
    122 function access_keys_fix_links($cats) { 
    123       return preg_replace_callback('!<a[^>]*>[^>]*?(accesskey=@([^<]*)@)</a>!ims', 'access_keys_finish', $cats); 
    124 } 
    125  
    126 function access_keys_finish($matches){ 
    127       if($matches[1]) 
    128             $link = preg_replace('/accesskey=\@.*?\@/','',$matches[0]); 
    129        
    130       if(!is_int($matches[2]) || $matches[2]>=0) 
    131             $link = str_replace(' title=', ' accesskey="'.$matches[2].'" title=', $link); 
    132        
    133 return $link; 
    134 } 
    135  
    136 // ******************************* 
    137 // Admin Panel 
    138 // ******************************* 
    139       function access_keys_update_options($options){ 
    140       global $access_keys; 
    141             while (list($option, $value) = each($options)) { 
    142                         $access_keys[$option] =$value; 
    143             } 
    144       return $access_keys; 
    145       } 
     61      while (list($option, $value) = each($options)) { 
     62                  $access_keys[$option] =$value; 
     63      } 
     64return $access_keys; 
     65} 
    14666 
    14767 
    14868add_action('admin_menu', 'access_keys_menu'); 
    149       function access_keys_menu() { 
    150             add_submenu_page('edit.php', 'Access Keys', 'Access Keys', 8, __FILE__,'access_keys_admin'); 
    151       } 
     69 
     70function access_keys_menu() { 
     71      add_submenu_page('edit.php', 'Access Keys', 'Access Keys', 8, __FILE__,'access_keys_admin'); 
     72} 
    15273 
    15374function access_keys_admin(){ 
     
    185106      } 
    186107?> 
    187  
    188  
    189 <script type="text/javascript" src="../wp-includes/js/dbx.js"></script> 
    190 <script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script> 
    191 <script type="text/javascript"> 
    192                         //<![CDATA[ 
    193                         addLoadEvent( function() { 
    194                               var manager = new dbxManager('inap'); 
    195                                
    196                               //create new docking boxes group 
    197                               var advanced = new dbxGroup( 
    198                                     'advancedstuff',        // container ID [/-_a-zA-Z0-9/] 
    199                                     'vertical',             // orientation ['vertical'|'horizontal'] 
    200                                     '10',                   // drag threshold ['n' pixels] 
    201                                     'yes',                  // restrict drag movement to container axis ['yes'|'no'] 
    202                                     '0',              // animate re-ordering [frames per transition, or '0' for no effect] 
    203                                     'yes',                  // include open/close toggle buttons ['yes'|'no'] 
    204                                     'open',           // default state ['open'|'closed'] 
    205                                     'open',           // word for "open", as in "open this box" 
    206                                     'close',          // word for "close", as in "close this box" 
    207                                     'click-down and drag to move this box', // sentence for "move this box" by mouse 
    208                                     'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse 
    209                                     'use the arrow keys to move this box', // sentence for "move this box" by keyboard 
    210                                     ', or press the enter key to %toggle% it',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
    211                                     '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 
    212                                     ); 
    213                         }); 
    214                         //]]> 
    215 </script> 
    216108<div class="wrap"> 
    217109<form method="post"> 
     
    230122            </div> 
    231123      </fieldset> 
    232 </div>                         
     124</div> 
    233125<div class="dbx-b-ox-wrapper"> 
    234126      <fieldset id="accesskeys" class="dbx-box"> 
     
    240132echo <<<block 
    241133    <li><p> 
    242                               <label>Access Key for $x[1] <input type="text" maxlength="1" value="$x[2]" name="access_keys[page][$x[0]]"></label> 
     134            <label>Access Key for $x[1] <input type="text" maxlength="1" value="$x[2]" name="access_keys[page][$x[0]]"></label> 
    243135    </p></li> 
    244136block; 
     
    252144echo <<<block 
    253145    <li><p> 
    254                               <label>Access Key for $x[1] <input type="text" maxlength="1" value="$x[2]" name="access_keys[cat][$x[0]]"></label> 
     146            <label>Access Key for $x[1] <input type="text" maxlength="1" value="$x[2]" name="access_keys[cat][$x[0]]"></label> 
    255147    </p></li> 
    256148block; 
  • access-keys/trunk/readme.txt

    r32758 r38551  
    22Contributors: Aaron Harun 
    33Donate link: http://anthologyoi.com/about/donate/ 
    4 Tags: accessibility, access keys,  
     4Tags: accessibility, access keys, 
    55Requires at least: 2.1 
    6 Tested up to: 2.3 
    7 Stable tag: 0.6 
     6Tested up to: 2.5 
     7Stable tag: 1.0 
    88 
    9 This plugin allows you to add Access Keys to Category and Page navigation menus to make your website far more accessible. 
     9Add Access Keys to Category and Page navigation menus to make your website far more accessible. 
    1010 
    1111== Description == 
    12 The WordPress Access Keys Plugin allows you to add access keys to pages and categories to improve accessibility of your WordPress website. This works with any page or category list that is called with wp_list pages and wp_list_categories respectively. (Translation: If your Wordpress theme works in any Wordpress version after 2.1 then this plugin should work for you.) 
     12The WordPress Access Keys Plugin allows you to add access keys to pages and categories to improve accessibility of your WordPress website. This works with any page or category list that is called with wp_list pages and wp_list_categories respectively. 
    1313 
    14 It is simple to use this this plugin. On the Admin panel it lists pages and categories with a current access key, and in a separate list it lists the pages and categories without access keys. Just add an access key just type an access key in a text box and then click the save button. The categories or posts will now move to the top list. 
     14It is simple to use this this plugin. On the Admin panel it lists pages and categories with a current access key, and in a separate list it lists the pages and categories without access keys. Just add an access key just type a number or letter in a text box and click the save button. The categories or posts will then move to the top list, and you will feel great about be kind to your users. 
    1515 
    1616== Installation == 
     
    19191. Activate. 
    20201. Go to the Admin Menu under Manage named Access Keys. 
    21 1. Read the instructions. 
     211. Read the short instructions. 
    2222