root/tags/2.1.2/wp-admin/dbx-admin-key-js.php

Revision 4535, 3.2 kB (checked in by ryan, 2 years ago)

Use js_escape. Props nbachiyski. fixes #3399

  • Property svn:eol-style set to native
Line 
1 <?php
2 require_once('admin.php');
3 cache_javascript_headers();
4
5 switch ( $_GET['pagenow'] ) :
6     case 'post.php' :
7     case 'post-new.php' :
8         $man = 'postmeta';
9         break;
10     case 'page.php' :
11     case 'page-new.php' :
12         $man = 'pagemeta';
13         break;
14     case 'link.php' :
15         $man = 'linkmeta';
16         break;
17     default:
18         exit;
19         break;
20 endswitch;
21 ?>
22 addLoadEvent( function() {var manager = new dbxManager('<?php echo $man; ?>');} );
23
24 addLoadEvent( function()
25 {
26     //create new docking boxes group
27     var meta = new dbxGroup(
28         'grabit',         // container ID [/-_a-zA-Z0-9/]
29         'vertical',     // orientation ['vertical'|'horizontal']
30         '10',             // drag threshold ['n' pixels]
31         'no',            // restrict drag movement to container axis ['yes'|'no']
32         '10',             // animate re-ordering [frames per transition, or '0' for no effect]
33         'yes',             // include open/close toggle buttons ['yes'|'no']
34         'closed',         // default state ['open'|'closed']
35         '<?php echo js_escape(__('open')); ?>',         // word for "open", as in "open this box"
36         '<?php echo js_escape(__('close')); ?>',         // word for "close", as in "close this box"
37         '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse
38         '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse
39         '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard
40         '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
41         '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
42         );
43
44     // Boxes are closed by default. Open the Category box if the cookie isn't already set.
45     var catdiv = document.getElementById('categorydiv');
46     if ( catdiv ) {
47         var button = catdiv.getElementsByTagName('A')[0];
48         if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) )
49             meta.toggleBoxState(button, true);
50     }
51
52     var advanced = new dbxGroup(
53         'advancedstuff',         // container ID [/-_a-zA-Z0-9/]
54         'vertical',         // orientation ['vertical'|'horizontal']
55         '10',             // drag threshold ['n' pixels]
56         'yes',            // restrict drag movement to container axis ['yes'|'no']
57         '10',             // animate re-ordering [frames per transition, or '0' for no effect]
58         'yes',             // include open/close toggle buttons ['yes'|'no']
59         'closed',         // default state ['open'|'closed']
60         '<?php echo js_escape(__('open')); ?>',         // word for "open", as in "open this box"
61         '<?php echo js_escape(__('close')); ?>',         // word for "close", as in "close this box"
62         '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse
63         '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse
64         '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard
65         '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
66         '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
67         );
68 });
69
Note: See TracBrowser for help on using the browser.