| 1 | Index: Sewar/WordPress/Plugins/widgets/delicious.php
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | +++ Sewar/WordPress/Plugins/widgets/delicious.php (working copy)
|
|---|
| 4 | @@ -29,10 +29,10 @@
|
|---|
| 5 | }
|
|---|
| 6 | ?>
|
|---|
| 7 | <div style="text-align:right">
|
|---|
| 8 | - <label for="delicious-title" style="line-height:35px;display:block;">Widget title: <input type="text" id="delicious-title" name="delicious-title" value="<?php echo htmlspecialchars($options['title']); ?>" /></label>
|
|---|
| 9 | - <label for="delicious-username" style="line-height:35px;display:block;">del.icio.us login: <input type="text" id="delicious-username" name="delicious-username" value="<?php echo htmlspecialchars($options['username']); ?>" /></label>
|
|---|
| 10 | - <label for="delicious-count" style="line-height:35px;display:block;">Number of links: <input type="text" id="delicious-count" name="delicious-count" value="<?php echo $options['count']; ?>" /></label>
|
|---|
| 11 | - <label for="delicious-tags" style="line-height:35px;display:block;">Show only these tags (separated by spaces): <textarea id="delicious-tags" name="delicious-tags" style="width:290px;height:20px;"><?php echo htmlspecialchars(implode(' ', (array) $options['tags'])); ?></textarea></label>
|
|---|
| 12 | + <label for="delicious-title" style="line-height:35px;display:block;"><?php _e('Widget title:', 'widgets'); ?> <input type="text" id="delicious-title" name="delicious-title" value="<?php echo htmlspecialchars($options['title']); ?>" /></label>
|
|---|
| 13 | + <label for="delicious-username" style="line-height:35px;display:block;"><?php _e('del.icio.us login:', 'widgets'); ?> <input type="text" id="delicious-username" name="delicious-username" value="<?php echo htmlspecialchars($options['username']); ?>" /></label>
|
|---|
| 14 | + <label for="delicious-count" style="line-height:35px;display:block;"><?php _e('Number of links:', 'widgets'); ?> <input type="text" id="delicious-count" name="delicious-count" value="<?php echo $options['count']; ?>" /></label>
|
|---|
| 15 | + <label for="delicious-tags" style="line-height:35px;display:block;"><?php _e('Show only these tags (separated by spaces):', 'widgets'); ?> <textarea id="delicious-tags" name="delicious-tags" style="width:290px;height:20px;"><?php echo htmlspecialchars(implode(' ', (array) $options['tags'])); ?></textarea></label>
|
|---|
| 16 | <input type="hidden" name="delicious-submit" id="delicious-submit" value="1" />
|
|---|
| 17 | </div>
|
|---|
| 18 | <?php
|
|---|
| 19 | @@ -74,12 +74,12 @@
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | // Tell Dynamic Sidebar about our new widget and its control
|
|---|
| 23 | - register_sidebar_widget('del.icio.us', 'widget_delicious');
|
|---|
| 24 | - register_widget_control('del.icio.us', 'widget_delicious_control');
|
|---|
| 25 | + register_sidebar_widget(array('del.icio.us', 'widgets'), 'widget_delicious');
|
|---|
| 26 | + register_widget_control(array('del.icio.us', 'widgets'), 'widget_delicious_control');
|
|---|
| 27 |
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | // Delay plugin execution to ensure Dynamic Sidebar has a chance to load first
|
|---|
| 31 | -add_action('plugins_loaded', 'widget_delicious_init');
|
|---|
| 32 | +add_action('init', 'widget_delicious_init');
|
|---|
| 33 |
|
|---|
| 34 | ?>
|
|---|
| 35 | Index: Sewar/WordPress/Plugins/widgets/gsearch.php
|
|---|
| 36 | ===================================================================
|
|---|
| 37 | +++ Sewar/WordPress/Plugins/widgets/gsearch.php (working copy)
|
|---|
| 38 | @@ -44,7 +44,7 @@
|
|---|
| 39 | // Get our options and see if we're handling a form submission.
|
|---|
| 40 | $options = get_option('widget_gsearch');
|
|---|
| 41 | if ( !is_array($options) )
|
|---|
| 42 | - $options = array('title'=>'', 'buttontext'=>'Google Search');
|
|---|
| 43 | + $options = array('title'=>'', 'buttontext'=>__('Google Search', 'widgets'));
|
|---|
| 44 | if ( $_POST['gsearch-submit'] ) {
|
|---|
| 45 |
|
|---|
| 46 | // Remember to sanitize and format use input appropriately.
|
|---|
| 47 | @@ -59,21 +59,21 @@
|
|---|
| 48 |
|
|---|
| 49 | // Here is our little form segment. Notice that we don't need a
|
|---|
| 50 | // complete form. This will be embedded into the existing form.
|
|---|
| 51 | - echo '<p style="text-align:right;"><label for="gsearch-title">Title: <input style="width: 200px;" id="gsearch-title" name="gsearch-title" type="text" value="'.$title.'" /></label></p>';
|
|---|
| 52 | - echo '<p style="text-align:right;"><label for="gsearch-buttontext">Button Text: <input style="width: 200px;" id="gsearch-buttontext" name="gsearch-buttontext" type="text" value="'.$buttontext.'" /></label></p>';
|
|---|
| 53 | + echo '<p style="text-align:right;"><label for="gsearch-title">' . __('Title:') . ' <input style="width: 200px;" id="gsearch-title" name="gsearch-title" type="text" value="'.$title.'" /></label></p>';
|
|---|
| 54 | + echo '<p style="text-align:right;"><label for="gsearch-buttontext">' . __('Button Text:', 'widgets') . ' <input style="width: 200px;" id="gsearch-buttontext" name="gsearch-buttontext" type="text" value="'.$buttontext.'" /></label></p>';
|
|---|
| 55 | echo '<input type="hidden" id="gsearch-submit" name="gsearch-submit" value="1" />';
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | // This registers our widget so it appears with the other available
|
|---|
| 59 | // widgets and can be dragged and dropped into any active sidebars.
|
|---|
| 60 | - register_sidebar_widget('Google Search', 'widget_gsearch');
|
|---|
| 61 | + register_sidebar_widget(array('Google Search', 'widgets'), 'widget_gsearch');
|
|---|
| 62 |
|
|---|
| 63 | // This registers our optional widget control form. Because of this
|
|---|
| 64 | // our widget will have a button that reveals a 300x100 pixel form.
|
|---|
| 65 | - register_widget_control('Google Search', 'widget_gsearch_control', 300, 100);
|
|---|
| 66 | + register_widget_control(array('Google Search', 'widgets'), 'widget_gsearch_control', 300, 100);
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | // Run our code later in case this loads prior to any required plugins.
|
|---|
| 70 | -add_action('plugins_loaded', 'widget_gsearch_init');
|
|---|
| 71 | +add_action('init', 'widget_gsearch_init');
|
|---|
| 72 |
|
|---|
| 73 | ?>
|
|---|
| 74 | \ No newline at end of file
|
|---|
| 75 | Index: Sewar/WordPress/Plugins/widgets/widgets.php
|
|---|
| 76 | ===================================================================
|
|---|
| 77 | +++ Sewar/WordPress/Plugins/widgets/widgets.php (working copy)
|
|---|
| 78 | @@ -4,8 +4,8 @@
|
|---|
| 79 | Plugin URI: http://svn.wp-plugins.org/widgets/trunk
|
|---|
| 80 | Description: Adds "Sidebar Widgets" panel under Presentation menu
|
|---|
| 81 | Author: Automattic, Inc.
|
|---|
| 82 | +Author URI: http://www.automattic.com
|
|---|
| 83 | Version: 1.0
|
|---|
| 84 | -Author URI: http://automattic.com
|
|---|
| 85 | */
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 | @@ -48,7 +48,8 @@
|
|---|
| 89 | parse_str($args, $args);
|
|---|
| 90 |
|
|---|
| 91 | $defaults = array(
|
|---|
| 92 | - 'name' => sprintf(__('Sidebar %d'), count($registered_sidebars) + 1 ),
|
|---|
| 93 | + 'id' => sanitize_title(sprintf('Sidebar %d', count($registered_sidebars) + 1)),
|
|---|
| 94 | + 'name' => sprintf(__('Sidebar %d', 'widgets'), count($registered_sidebars) + 1 ),
|
|---|
| 95 | 'before_widget' => '<li id="%1$s" class="widget %2$s">',
|
|---|
| 96 | 'after_widget' => "</li>\n",
|
|---|
| 97 | 'before_title' => '<h2 class="widgettitle">',
|
|---|
| 98 | @@ -57,7 +58,7 @@
|
|---|
| 99 |
|
|---|
| 100 | $sidebar = array_merge($defaults, $args);
|
|---|
| 101 |
|
|---|
| 102 | - $index = sanitize_title($sidebar['name']);
|
|---|
| 103 | + $index = $sidebar['id'];
|
|---|
| 104 |
|
|---|
| 105 | $registered_sidebars[$index] = $sidebar;
|
|---|
| 106 |
|
|---|
| 107 | @@ -67,9 +68,7 @@
|
|---|
| 108 | function unregister_sidebar($name) {
|
|---|
| 109 | global $registered_sidebars;
|
|---|
| 110 |
|
|---|
| 111 | - $index = sanitize_title($name);
|
|---|
| 112 | -
|
|---|
| 113 | - unset( $registered_sidebars[$index] );
|
|---|
| 114 | + unset( $registered_sidebars[$name]['id'] );
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 117 | function register_sidebar_widget($name, $output_callback, $classname = '') {
|
|---|
| 118 | @@ -122,6 +121,7 @@
|
|---|
| 119 | unset($registered_widget_controls[$name]);
|
|---|
| 120 | else
|
|---|
| 121 | $registered_widget_controls[$name] = array(
|
|---|
| 122 | + 'id' => $id,
|
|---|
| 123 | 'callback' => $control_callback,
|
|---|
| 124 | 'width' => $width,
|
|---|
| 125 | 'height' => $height,
|
|---|
| 126 | @@ -136,11 +136,11 @@
|
|---|
| 127 | function dynamic_sidebar($name = 1) {
|
|---|
| 128 | global $registered_sidebars, $registered_widgets;
|
|---|
| 129 |
|
|---|
| 130 | - if ( is_int($name) )
|
|---|
| 131 | - $name = "Sidebar $name";
|
|---|
| 132 | + if ( is_int($name) ) {
|
|---|
| 133 | + $index = sanitize_title('Sidebar ' . $name);
|
|---|
| 134 | + $name = sprintf(__('Sidebar %d', 'widgets'), $name);
|
|---|
| 135 | + }
|
|---|
| 136 |
|
|---|
| 137 | - $index = sanitize_title($name);
|
|---|
| 138 | -
|
|---|
| 139 | $sidebars_widgets = get_option('sidebars_widgets');
|
|---|
| 140 |
|
|---|
| 141 | $sidebar = $registered_sidebars[$index];
|
|---|
| 142 | @@ -197,7 +197,7 @@
|
|---|
| 143 | return;
|
|---|
| 144 | $page = preg_replace('!^.*[\\\\/]wp-content[\\\\/][^\\\\/]*plugins[\\\\/]!', '', __FILE__);
|
|---|
| 145 | $page = str_replace('\\', '/', $page);
|
|---|
| 146 | - add_submenu_page('themes.php', 'Sidebar Widgets', 'Sidebar Widgets', 5, $page, 'sidebar_admin_page');
|
|---|
| 147 | + add_submenu_page('themes.php', __('Sidebar Widgets', 'widgets'), __('Sidebar Widgets', 'widgets'), 5, $page, 'sidebar_admin_page');
|
|---|
| 148 | if ( $_GET['page'] == $page ) {
|
|---|
| 149 | add_action('admin_head', 'sidebar_admin_head');
|
|---|
| 150 | do_action('sidebar_admin_setup');
|
|---|
| 151 | @@ -379,22 +379,22 @@
|
|---|
| 152 | cols[<?php echo $i++; ?>] = '<?php echo $index; ?>';
|
|---|
| 153 | <?php endforeach; ?>
|
|---|
| 154 | var widgets = new Array;
|
|---|
| 155 | -<?php $i = 0; foreach ( $registered_widgets as $name => $widget ) : $san_name = sanitize_title($name); ?>
|
|---|
| 156 | +<?php $i = 0; foreach ( $registered_widgets as $name => $widget ) : $san_name = $widget['id']; ?>
|
|---|
| 157 | widgets[<?php echo $i++; ?>] = '<?php echo $san_name; ?>';
|
|---|
| 158 | <?php endforeach; ?>
|
|---|
| 159 | var controldims = new Array;
|
|---|
| 160 | -<?php foreach ( $registered_widget_controls as $name => $control ) : ?>
|
|---|
| 161 | - controldims['<?php echo sanitize_title($name); ?>control'] = new Array;
|
|---|
| 162 | - controldims['<?php echo sanitize_title($name); ?>control']['width'] = <?php echo (int) $control['width']; ?>;
|
|---|
| 163 | - controldims['<?php echo sanitize_title($name); ?>control']['height'] = <?php echo (int) $control['height']; ?>;
|
|---|
| 164 | +<?php foreach ( $registered_widget_controls as $name => $control ) : $san_name = $control['id']; ?>
|
|---|
| 165 | + controldims['<?php echo $san_name; ?>control'] = new Array;
|
|---|
| 166 | + controldims['<?php echo $san_name; ?>control']['width'] = <?php echo (int) $control['width']; ?>;
|
|---|
| 167 | + controldims['<?php echo $san_name; ?>control']['height'] = <?php echo (int) $control['height']; ?>;
|
|---|
| 168 | <?php endforeach; ?>
|
|---|
| 169 | function initWidgets() {
|
|---|
| 170 | -<?php foreach ( $registered_widget_controls as $name => $control ) : $san_name = sanitize_title($name); ?>
|
|---|
| 171 | +<?php foreach ( $registered_widget_controls as $name => $control ) : $san_name = $control['id']; ?>
|
|---|
| 172 | $('<?php echo $san_name; ?>popper').onclick = function() {popControl('<?php echo $san_name; ?>control');};
|
|---|
| 173 | $('<?php echo $san_name; ?>closer').onclick = function() {unpopControl('<?php echo $san_name; ?>control');};
|
|---|
| 174 | - new Draggable('<?php echo sanitize_title($name); ?>control', {revert:false,handle:'controlhandle',starteffect:function(){},endeffect:function(){},change:function(o){dragChange(o);}});
|
|---|
| 175 | + new Draggable('<?php echo $san_name; ?>control', {revert:false,handle:'controlhandle',starteffect:function(){},endeffect:function(){},change:function(o){dragChange(o);}});
|
|---|
| 176 | if ( true && window.opera )
|
|---|
| 177 | - $('<?php echo sanitize_title($name); ?>control').style.border = '1px solid #bbb';
|
|---|
| 178 | + $('<?php echo $san_name; ?>control').style.border = '1px solid #bbb';
|
|---|
| 179 | <?php endforeach; ?>
|
|---|
| 180 | if ( true && window.opera )
|
|---|
| 181 | $('shadow').style.background = 'transparent';
|
|---|
| 182 | @@ -416,13 +416,13 @@
|
|---|
| 183 | function dragChange(o) {
|
|---|
| 184 | el = o.element ? o.element : $(o);
|
|---|
| 185 | var p = Position.page(el);
|
|---|
| 186 | - var left = p[0];
|
|---|
| 187 | + var right = p[0];
|
|---|
| 188 | var top = p[1];
|
|---|
| 189 | - var right = $('shadow').offsetWidth - (el.offsetWidth + left);
|
|---|
| 190 | + var left = $('shadow').offsetWidth - (el.offsetWidth + left);
|
|---|
| 191 | var bottom = $('shadow').offsetHeight - (el.offsetHeight + top);
|
|---|
| 192 | - if ( left < 1 ) el.style.left = 0;
|
|---|
| 193 | + if ( right < 1 ) el.style.left = 0;
|
|---|
| 194 | if ( top < 1 ) el.style.top = 0;
|
|---|
| 195 | - if ( right < 1 ) el.style.left = (left + right) + 'px';
|
|---|
| 196 | + if ( left < 1 ) el.style.left = (left + right) + 'px';
|
|---|
| 197 | if ( bottom < 1 ) el.style.top = (top + bottom) + 'px';
|
|---|
| 198 | }
|
|---|
| 199 | function popControl(elm) {
|
|---|
| 200 | @@ -432,7 +432,7 @@
|
|---|
| 201 | var x = ( document.body.clientWidth - controldims[elm]['width'] ) / 2;
|
|---|
| 202 | var y = ( document.body.parentNode.clientHeight - controldims[elm]['height'] ) / 2;
|
|---|
| 203 | el.style.position = 'absolute';
|
|---|
| 204 | - el.style.left = '' + x + 'px';
|
|---|
| 205 | + el.style.right = '' + x + 'px';
|
|---|
| 206 | el.style.top = '' + y + 'px';
|
|---|
| 207 | el.style.zIndex = 1000;
|
|---|
| 208 | el.className='control';
|
|---|
| 209 | @@ -521,8 +521,8 @@
|
|---|
| 210 | $new_order = $order[$index];
|
|---|
| 211 | if ( is_array($new_order) )
|
|---|
| 212 | foreach ( $new_order as $sanitized_name )
|
|---|
| 213 | - foreach ( $registered_widgets as $name => $callback )
|
|---|
| 214 | - if ( $sanitized_name == sanitize_title($name) )
|
|---|
| 215 | + foreach ( $registered_widgets as $name => $widget )
|
|---|
| 216 | + if ( $sanitized_name == $widget['id'] )
|
|---|
| 217 | $sidebars_widgets[$index][] = $name;
|
|---|
| 218 | }
|
|---|
| 219 | update_option('sidebars_widgets', $sidebars_widgets);
|
|---|
| 220 | @@ -533,7 +533,7 @@
|
|---|
| 221 | ksort($registered_widgets);
|
|---|
| 222 |
|
|---|
| 223 | $inactive_widgets = array();
|
|---|
| 224 | - foreach ( $registered_widgets as $name => $callback ) {
|
|---|
| 225 | + foreach ( $registered_widgets as $name => $widget ) {
|
|---|
| 226 | $is_active = false;
|
|---|
| 227 | foreach ( $registered_sidebars as $index => $sidebar ) {
|
|---|
| 228 | if ( is_array($sidebars_widgets[$index]) && in_array($name, $sidebars_widgets[$index]) ) {
|
|---|
| 229 | @@ -555,24 +555,24 @@
|
|---|
| 230 | ?>
|
|---|
| 231 | <?php if ( $_POST['action'] ) { ?>
|
|---|
| 232 | <div class="fade updated" id="message">
|
|---|
| 233 | - <p><?php printf(__('Sidebar Updated. <a href="%s">View site »</a>'), get_settings('home') . '/'); ?></p>
|
|---|
| 234 | + <p><?php printf(__('Sidebar Updated. <a href="%s">View site »</a>', 'widgets'), get_settings('home') . '/'); ?></p>
|
|---|
| 235 | </div>
|
|---|
| 236 | <?php } ?>
|
|---|
| 237 | <div class="wrap">
|
|---|
| 238 | - <h2><?php _e('Sidebar Arrangement'); ?></h2>
|
|---|
| 239 | - <p><?php _e("You can drag and drop widgets into your sidebar below."); ?></p>
|
|---|
| 240 | + <h2><?php _e('Sidebar Arrangement', 'widgets'); ?></h2>
|
|---|
| 241 | + <p><?php _e('You can drag and drop widgets into your sidebar below.', 'widgets'); ?></p>
|
|---|
| 242 | <form id="sbadmin" method="POST" onsubmit="serializeAll()">
|
|---|
| 243 | <p>
|
|---|
| 244 | <div>
|
|---|
| 245 | <div class="dropzone">
|
|---|
| 246 | - <h3><?php _e('Available Widgets'); ?></h3>
|
|---|
| 247 | + <h3><?php _e('Available Widgets', 'widgets'); ?></h3>
|
|---|
| 248 | <ul id="palette"><?php foreach ( $inactive_widgets as $name ) widget_draggable($name); ?></ul>
|
|---|
| 249 | </div>
|
|---|
| 250 | <?php $i = 1; foreach ( $registered_sidebars as $index => $sidebar ) : ?>
|
|---|
| 251 | <input type="hidden" id="<?php echo $index; ?>order" name="<?php echo $index; ?>order" value="" />
|
|---|
| 252 | <div class="dropzone">
|
|---|
| 253 | <h3><?php echo $sidebar['name']; ?></h3>
|
|---|
| 254 | - <div id="<?php echo $index; ?>placematt" class="module placematt"><span class="handle"><h4><?php _e('Default Sidebar'); ?></h4><?php _e('Your theme will display its usual sidebar when this box is empty. Dragging widgets into this box will replace the usual sidebar with your customized sidebar.'); ?></span></div>
|
|---|
| 255 | + <div id="<?php echo $index; ?>placematt" class="module placematt"><span class="handle"><h4><?php _e('Default Sidebar', 'widgets'); ?></h4><?php _e('Your theme will display its usual sidebar when this box is empty. Dragging widgets into this box will replace the usual sidebar with your customized sidebar.', 'widgets'); ?></span></div>
|
|---|
| 256 | <ul id="<?php echo $index; ?>"><?php if ( is_array($sidebars_widgets[$index]) ) foreach ( $sidebars_widgets[$index] as $name ) widget_draggable($name); ?></ul>
|
|---|
| 257 | </div>
|
|---|
| 258 | <?php endforeach; ?>
|
|---|
| 259 | @@ -590,13 +590,13 @@
|
|---|
| 260 | </p>
|
|---|
| 261 | <p class="submit">
|
|---|
| 262 | <input type="hidden" name="action" id="action" value="save_widget_order" />
|
|---|
| 263 | - <input type="submit" value="<?php _e('Save changes'); ?> »" />
|
|---|
| 264 | + <input type="submit" value="<?php _e('Save Changes »'); ?>" />
|
|---|
| 265 | </p>
|
|---|
| 266 | <div id="controls">
|
|---|
| 267 | <?php foreach ( $registered_widget_controls as $name => $control ) : ?>
|
|---|
| 268 | - <div class="hidden" id="<?php echo sanitize_title($name); ?>control">
|
|---|
| 269 | + <div class="hidden" id="<?php echo $control['id']; ?>control">
|
|---|
| 270 | <span class="controlhandle"><?php echo $name; ?></span>
|
|---|
| 271 | - <span id="<?php echo sanitize_title($name); ?>closer" class="controlcloser">×</span>
|
|---|
| 272 | + <span id="<?php echo $control['id']; ?>closer" class="controlcloser">×</span>
|
|---|
| 273 | <div class="controlform">
|
|---|
| 274 | <?php call_user_func_array($control['callback'], $control['params']); ?>
|
|---|
| 275 | </div>
|
|---|
| 276 | @@ -613,10 +613,10 @@
|
|---|
| 277 |
|
|---|
| 278 | function widget_draggable($name) {
|
|---|
| 279 | global $registered_widgets, $registered_widget_controls;
|
|---|
| 280 | - $san_name = sanitize_title($name);
|
|---|
| 281 | if ( !isset($registered_widgets[$name]) )
|
|---|
| 282 | return;
|
|---|
| 283 | - $poptitle = __('Configure');
|
|---|
| 284 | + $san_name = sanitize_title($registered_widgets[$name]['id']);
|
|---|
| 285 | + $poptitle = __('Configure', 'widgets');
|
|---|
| 286 | $popper = $registered_widget_controls[$name] ? " <div class='popper' id='{$san_name}popper' title='$poptitle'>≡</div>" : '';
|
|---|
| 287 | echo "<li class='module' id='widgetprefix-$san_name'><span class='handle'>$name$popper</span></li>";
|
|---|
| 288 | }
|
|---|
| 289 | @@ -823,8 +823,8 @@
|
|---|
| 290 | ?>
|
|---|
| 291 | <div class="wrap">
|
|---|
| 292 | <form method="POST">
|
|---|
| 293 | - <h2>Text Widgets</h2>
|
|---|
| 294 | - <p style="line-height: 30px;"><?php _e('How many text widgets would you like?'); ?>
|
|---|
| 295 | + <h2><?php _e('Text Widgets', 'widgets'); ?></h2>
|
|---|
| 296 | + <p style="line-height: 30px;"><?php _e('How many text widgets would you like?', 'widgets'); ?>
|
|---|
| 297 | <select id="text-number" name="text-number" value="<?php echo $options['number']; ?>">
|
|---|
| 298 | <?php for ( $i = 1; $i < 10; ++$i ) echo "<option value='$i' ".($options['number']==$i ? "selected='selected'" : '').">$i</option>"; ?>
|
|---|
| 299 | </select>
|
|---|
| 300 | @@ -840,7 +840,7 @@
|
|---|
| 301 | if ( $number < 1 ) $number = 1;
|
|---|
| 302 | if ( $number > 9 ) $number = 9;
|
|---|
| 303 | for ($i = 1; $i <= 9; $i++) {
|
|---|
| 304 | - $name = array('Text %s', null, $i);
|
|---|
| 305 | + $name = array('Text %s', 'widgets', $i);
|
|---|
| 306 | register_sidebar_widget($name, $i <= $number ? 'widget_text' : /* unregister */ '', $i);
|
|---|
| 307 | register_widget_control($name, $i <= $number ? 'widget_text_control' : /* unregister */ '', 460, 350, $i);
|
|---|
| 308 | }
|
|---|
| 309 | @@ -880,15 +880,15 @@
|
|---|
| 310 | $title = wp_specialchars($options['title']);
|
|---|
| 311 | ?>
|
|---|
| 312 | <p><label for="categories-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="categories-title" name="categories-title" type="text" value="<?php echo $title; ?>" /></label></p>
|
|---|
| 313 | - <p style="text-align:right;margin-right:40px;"><label for="categories-count">Show post counts <input class="checkbox" type="checkbox" <?php echo $count; ?> id="categories-count" name="categories-count" /></label></p>
|
|---|
| 314 | - <p style="text-align:right;margin-right:40px;"><label for="categories-hierarchical" style="text-align:right;">Show hierarchy <input class="checkbox" type="checkbox" <?php echo $hierarchical; ?> id="categories-hierarchical" name="categories-hierarchical" /></label></p>
|
|---|
| 315 | + <p style="text-align:right;margin-right:40px;"><label for="categories-count"><?php _e('Show post counts', 'widgets'); ?> <input class="checkbox" type="checkbox" <?php echo $count; ?> id="categories-count" name="categories-count" /></label></p>
|
|---|
| 316 | + <p style="text-align:right;margin-right:40px;"><label for="categories-hierarchical" style="text-align:right;"><?php _e('Show hierarchy', 'widgets'); ?> <input class="checkbox" type="checkbox" <?php echo $hierarchical; ?> id="categories-hierarchical" name="categories-hierarchical" /></label></p>
|
|---|
| 317 | <input type="hidden" id="categories-submit" name="categories-submit" value="1" />
|
|---|
| 318 | <?php
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | function widget_recent_entries($args) {
|
|---|
| 322 | extract($args);
|
|---|
| 323 | - $title = __('Recent Posts');
|
|---|
| 324 | + $title = __('Recent Posts', 'widgets');
|
|---|
| 325 | $r = new WP_Query('showposts=10');
|
|---|
| 326 | if ($r->have_posts()) :
|
|---|
| 327 | ?>
|
|---|
| 328 | @@ -908,7 +908,7 @@
|
|---|
| 329 | global $wpdb, $comments, $comment;
|
|---|
| 330 | extract($args, EXTR_SKIP);
|
|---|
| 331 | $options = get_option('widget_recent_comments');
|
|---|
| 332 | - $title = empty($options['title']) ? __('Recent Comments') : $options['title'];
|
|---|
| 333 | + $title = empty($options['title']) ? __('Recent Comments', 'widgets') : $options['title'];
|
|---|
| 334 | $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5");
|
|---|
| 335 | ?>
|
|---|
| 336 |
|
|---|
| 337 | @@ -945,8 +945,8 @@
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 | function widget_recent_comments_register() {
|
|---|
| 341 | - register_sidebar_widget('Recent Comments', 'widget_recent_comments');
|
|---|
| 342 | - register_widget_control('Recent Comments', 'widget_recent_comments_control', 300, 90);
|
|---|
| 343 | + register_sidebar_widget(array('Recent Comments', 'widgets'), 'widget_recent_comments');
|
|---|
| 344 | + register_widget_control(array('Recent Comments', 'widgets'), 'widget_recent_comments_control', 300, 90);
|
|---|
| 345 |
|
|---|
| 346 | if ( is_active_widget('widget_recent_comments') )
|
|---|
| 347 | add_action('wp_head', 'widget_recent_comments_style');
|
|---|
| 348 | @@ -975,7 +975,7 @@
|
|---|
| 349 | if ( empty($title) )
|
|---|
| 350 | $title = $desc;
|
|---|
| 351 | if ( empty($title) )
|
|---|
| 352 | - $title = "Unknown Feed";
|
|---|
| 353 | + $title = __('Unknown Feed', 'widgets');
|
|---|
| 354 | $url = wp_specialchars(strip_tags($url), 1);
|
|---|
| 355 | if ( file_exists(dirname(__FILE__) . '/rss.png') )
|
|---|
| 356 | $icon = str_replace(str_replace('\\', '/', ABSPATH), get_settings('siteurl').'/', str_replace('\\', '/', dirname(__FILE__))) . '/rss.png';
|
|---|
| 357 | @@ -1006,7 +1006,7 @@
|
|---|
| 358 | echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>$summary</li>";
|
|---|
| 359 | }
|
|---|
| 360 | } else {
|
|---|
| 361 | - echo "<li>An error has occured; the feed is probably down. Try again later.</li>";
|
|---|
| 362 | + echo __('<li>An error has occured; the feed is probably down. Try again later.</li>', 'widgets');
|
|---|
| 363 | }
|
|---|
| 364 | ?>
|
|---|
| 365 | </ul>
|
|---|
| 366 | @@ -1030,11 +1030,11 @@
|
|---|
| 367 | $title = htmlspecialchars($options[$number]['title'], ENT_QUOTES);
|
|---|
| 368 | if ( empty($items) || $items < 1 ) $items = 10;
|
|---|
| 369 | ?>
|
|---|
| 370 | - <p style="text-align:center;">Enter the RSS feed URL here:</p>
|
|---|
| 371 | + <p style="text-align:center;"><?php _e('Enter the RSS feed URL here:', 'widgets'); ?></p>
|
|---|
| 372 | <input style="width: 400px;" id="rss-url-<?php echo "$number"; ?>" name="rss-url-<?php echo "$number"; ?>" type="text" value="<?php echo $url; ?>" />
|
|---|
| 373 | - <p style="text-align:center;">Give the feed a title (optional):</p>
|
|---|
| 374 | + <p style="text-align:center;"><?php _e('Give the feed a title (optional):', 'widgets'); ?></p>
|
|---|
| 375 | <input style="width: 400px;" id="rss-title-<?php echo "$number"; ?>" name="rss-title-<?php echo "$number"; ?>" type="text" value="<?php echo $title; ?>" />
|
|---|
| 376 | - <p style="text-align:center; line-height: 30px;"><?php _e('How many items would you like to display?'); ?> <select id="rss-items-<?php echo $number; ?>" name="rss-items-<?php echo $number; ?>"><?php for ( $i = 1; $i <= 10; ++$i ) echo "<option value='$i' ".($items==$i ? "selected='selected'" : '').">$i</option>"; ?></select></p>
|
|---|
| 377 | + <p style="text-align:center; line-height: 30px;"><?php _e('How many items would you like to display?', 'widgets'); ?> <select id="rss-items-<?php echo $number; ?>" name="rss-items-<?php echo $number; ?>"><?php for ( $i = 1; $i <= 10; ++$i ) echo "<option value='$i' ".($items==$i ? "selected='selected'" : '').">$i</option>"; ?></select></p>
|
|---|
| 378 | <input type="hidden" id="rss-submit-<?php echo "$number"; ?>" name="rss-submit-<?php echo "$number"; ?>" value="1" />
|
|---|
| 379 | <?php
|
|---|
| 380 | }
|
|---|
| 381 | @@ -1059,8 +1059,8 @@
|
|---|
| 382 | ?>
|
|---|
| 383 | <div class="wrap">
|
|---|
| 384 | <form method="POST">
|
|---|
| 385 | - <h2>RSS Feed Widgets</h2>
|
|---|
| 386 | - <p style="line-height: 30px;"><?php _e('How many RSS widgets would you like?'); ?>
|
|---|
| 387 | + <h2><?php _e('RSS Feed Widgets', 'widgets'); ?></h2>
|
|---|
| 388 | + <p style="line-height: 30px;"><?php _e('How many RSS widgets would you like?', 'widgets'); ?>
|
|---|
| 389 | <select id="rss-number" name="rss-number" value="<?php echo $options['number']; ?>">
|
|---|
| 390 | <?php for ( $i = 1; $i < 10; ++$i ) echo "<option value='$i' ".($options['number']==$i ? "selected='selected'" : '').">$i</option>"; ?>
|
|---|
| 391 | </select>
|
|---|
| 392 | @@ -1076,7 +1076,7 @@
|
|---|
| 393 | if ( $number < 1 ) $number = 1;
|
|---|
| 394 | if ( $number > 9 ) $number = 9;
|
|---|
| 395 | for ($i = 1; $i <= 9; $i++) {
|
|---|
| 396 | - $name = array('RSS %s', null, $i);
|
|---|
| 397 | + $name = array('RSS %s', 'widgets', $i);
|
|---|
| 398 | register_sidebar_widget($name, $i <= $number ? 'widget_rss' : /* unregister */ '', $i);
|
|---|
| 399 | register_widget_control($name, $i <= $number ? 'widget_rss_control' : /* unregister */ '', 410, 200, $i);
|
|---|
| 400 | }
|
|---|
| 401 | @@ -1096,23 +1096,28 @@
|
|---|
| 402 |
|
|---|
| 403 | /////////////////////////////////////////////////////////// Actions and Registrations
|
|---|
| 404 |
|
|---|
| 405 | -add_action('admin_menu', 'sidebar_admin_setup');
|
|---|
| 406 | +function widgets_init(){
|
|---|
| 407 | + load_plugin_textdomain('widgets', 'wp-content/plugins/widgets');
|
|---|
| 408 |
|
|---|
| 409 | -widget_text_register();
|
|---|
| 410 | -widget_rss_register();
|
|---|
| 411 | -widget_recent_comments_register();
|
|---|
| 412 | -register_sidebar_widget('Pages', 'widget_pages');
|
|---|
| 413 | -register_widget_control('Pages', 'widget_pages_control', 300, 90);
|
|---|
| 414 | -register_sidebar_widget('Calendar', 'widget_calendar');
|
|---|
| 415 | -register_widget_control('Calendar', 'widget_calendar_control', 300, 90);
|
|---|
| 416 | -register_sidebar_widget('Archives', 'widget_archives');
|
|---|
| 417 | -register_widget_control('Archives', 'widget_archives_control', 300, 90);
|
|---|
| 418 | -register_sidebar_widget('Links', 'widget_links');
|
|---|
| 419 | -register_sidebar_widget('Meta', 'widget_meta');
|
|---|
| 420 | -register_widget_control('Meta', 'widget_meta_control', 300, 90);
|
|---|
| 421 | -register_sidebar_widget('Search', 'widget_search');
|
|---|
| 422 | -register_sidebar_widget('Categories', 'widget_categories');
|
|---|
| 423 | -register_widget_control('Categories', 'widget_categories_control', 300, 150);
|
|---|
| 424 | -register_sidebar_widget('Recent Posts', 'widget_recent_entries');
|
|---|
| 425 | + add_action('admin_menu', 'sidebar_admin_setup');
|
|---|
| 426 |
|
|---|
| 427 | + widget_text_register();
|
|---|
| 428 | + widget_rss_register();
|
|---|
| 429 | + widget_recent_comments_register();
|
|---|
| 430 | + register_sidebar_widget('Pages', 'widget_pages');
|
|---|
| 431 | + register_widget_control('Pages', 'widget_pages_control', 300, 90);
|
|---|
| 432 | + register_sidebar_widget(array('Calendar', 'widgets'), 'widget_calendar');
|
|---|
| 433 | + register_widget_control(array('Calendar', 'widgets'), 'widget_calendar_control', 300, 90);
|
|---|
| 434 | + register_sidebar_widget('Archives', 'widget_archives');
|
|---|
| 435 | + register_widget_control('Archives', 'widget_archives_control', 300, 90);
|
|---|
| 436 | + register_sidebar_widget('Links', 'widget_links');
|
|---|
| 437 | + register_sidebar_widget(array('Meta', 'widgets'), 'widget_meta');
|
|---|
| 438 | + register_widget_control(array('Meta', 'widgets'), 'widget_meta_control', 300, 90);
|
|---|
| 439 | + register_sidebar_widget('Search', 'widget_search');
|
|---|
| 440 | + register_sidebar_widget('Categories', 'widget_categories');
|
|---|
| 441 | + register_widget_control('Categories', 'widget_categories_control', 300, 150);
|
|---|
| 442 | + register_sidebar_widget(array('Recent Posts', 'widgets'), 'widget_recent_entries');
|
|---|
| 443 | +}
|
|---|
| 444 | +
|
|---|
| 445 | +add_action('init', 'widgets_init');
|
|---|
| 446 | ?>
|
|---|