| 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){ |
| | 24 | add_filter('wp_list_categories', 'access_keys_cats'); |
| | 25 | |
| | 26 | function 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 | // ******************************* |
| | 33 | add_filter('wp_list_pages', 'access_keys_pages'); |
| | 34 | |
| | 35 | function 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 | |
| | 44 | function access_keys_finish($matches){ |
| 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 | } |
| | 52 | return $link; |
| | 53 | } |
| | 54 | |
| | 55 | |
| | 56 | // ******************************* |
| | 57 | // Admin Panel |
| | 58 | // ******************************* |
| | 59 | function access_keys_update_options($options){ |
| 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 | } |
| | 64 | return $access_keys; |
| | 65 | } |
| 149 | | function access_keys_menu() { |
| 150 | | add_submenu_page('edit.php', 'Access Keys', 'Access Keys', 8, __FILE__,'access_keys_admin'); |
| 151 | | } |
| | 69 | |
| | 70 | function access_keys_menu() { |
| | 71 | add_submenu_page('edit.php', 'Access Keys', 'Access Keys', 8, __FILE__,'access_keys_admin'); |
| | 72 | } |
| 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> |