AVH Extended Categories Widgets - Version 2.3

Version Description

Download this release

Release Info

Developer petervanderdoes
Plugin Icon wp plugin AVH Extended Categories Widgets
Version 2.3
Comparing to
See all releases

Code changes from version 2.2 to 2.3

2.8/class/avh-ec.admin.php CHANGED
@@ -2,25 +2,18 @@
2
  class AVH_EC_Admin
3
  {
4
  var $core;
 
 
5
 
6
  function __construct ()
7
  {
 
8
  // Initialize the plugin
9
  $this->core = & AVHExtendedCategoriesCore::getInstance();
10
 
11
  // Admin menu
12
  add_action( 'admin_menu', array (&$this, 'actionAdminMenu' ) );
13
-
14
- /**
15
- * Inject CSS and Javascript on the right pages
16
- *
17
- * Main Action: admin_print_styles-, admin_print-scripts-
18
- * Top level page: toplevel_page_avh-first-defense-against-spam
19
- * Sub menus: avh-f-d-a-s_page_avh-fdas-general
20
- *
21
- */
22
- add_action( 'admin_print_styles', array (&$this, 'actionInjectCSS' ) );
23
- add_action( 'admin_print_scripts', array (&$this, 'actionInjectJS' ) );
24
 
25
  return;
26
  }
@@ -39,104 +32,197 @@ class AVH_EC_Admin
39
  function actionAdminMenu ()
40
  {
41
 
42
- add_options_page( 'AVH Extended Categories', 'AVH Extended Categories', 'manage_options', 'avhec_options', array (&$this, 'pageOptions' ) );
43
- add_filter( 'plugin_action_links_extended-categories-widget/widget_extended_categories.php', array (&$this, 'filterPluginActions' ), 10, 2 );
 
 
 
 
 
44
  // Add metaboxes
45
- add_meta_box( 'dashboard_right_now', 'Translation', array (&$this, 'metaboxTranslation' ), 'avhec-translation', 'left', 'core' );
46
- add_meta_box( 'dashboard_right_now', 'Donations', array (&$this, 'metaboxDonations' ), 'avhec-donation', 'left', 'core' );
 
 
 
 
 
 
 
 
47
  }
48
 
49
- function pageOptions ()
 
 
 
 
 
 
 
 
50
  {
51
- echo '<div class="wrap avhfdas-wrap">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  echo $this->displayIcon( 'index' );
53
  echo '<h2>' . 'AVH Extended Categories' . '</h2>';
54
- echo '<div id="dashboard-widgets-wrap" class="avhec-meta">';
55
- echo ' <div id="dashboard-widgets" class="metabox-holder">';
56
- echo ' <div id="post-body">';
57
- echo ' <div id="dashboard-widgets-main-content">';
58
- echo ' <div class="postbox-container" style="width:49%;">';
59
- do_meta_boxes( 'avhec-translation', 'left', '' );
60
- echo ' </div>';
61
- echo ' <div class="postbox-container" style="width:49%;">';
62
- do_meta_boxes( 'avhec-donation', 'left', '' );
63
- echo ' </div>';
64
 
 
 
 
 
 
 
 
65
  echo ' </div>';
66
  echo ' </div>';
67
- echo ' </div>';
68
- echo '</div>';
69
- echo '</div>';
 
 
 
 
 
 
70
  echo '<script type="text/javascript">' . "\n";
71
  echo ' //<![CDATA[' . "\n";
72
  echo ' jQuery(document).ready( function($) {' . "\n";
 
73
  echo ' // postboxes setup' . "\n";
74
- echo ' postboxes.add_postbox_toggles(\'avhec-meta\');' . "\n";
75
  echo ' });' . "\n";
76
  echo ' //]]>' . "\n";
77
  echo '</script>';
 
 
78
  }
79
 
80
  /**
81
- * Donation Metabox
82
- * @return unknown_type
83
  */
84
- function metaboxDonations ()
85
  {
86
- echo '<p>If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation</p>';
87
- echo '<div class="versions">';
88
- echo '<p>';
89
- echo '<span class="b">Amazon Wish List</span><br />';
90
- echo 'You can send me something from my <a href="http://www.amazon.com/gp/registry/wishlist/1U3DTWZ72PI7W?tag=avh-donation-20">Amazon Wish List</a>';
91
- echo '</p>';
92
- echo '<p>';
93
- echo '<span class="b">Through Paypal.</span><br />';
94
- echo 'Click on the Donate button and you will be directed to Paypal where you can make your donation and you don\'t need to have a Paypal account to make a donation.';
95
- echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input name="cmd" type="hidden" value="_donations" /> <input name="business" type="hidden" value="paypal@avirtualhome.com" /> <input name="item_name" type="hidden" value="AVH Plugins" /> <input name="no_shipping" type="hidden" value="1" /> <input name="no_note" type="hidden" value="1" /> <input name="currency_code" type="hidden" value="USD" /> <input name="tax" type="hidden" value="0" /> <input name="lc" type="hidden" value="US" /> <input name="bn" type="hidden" value="PP-DonationsBF" /> <input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> </form>';
96
- echo '</p></div>';
97
  }
98
 
99
  /**
100
- * Donation Metabox
101
  * @return unknown_type
102
  */
103
  function metaboxTranslation ()
104
  {
105
  echo '<p>A language pack can be created for this plugin. The .pot file is included with the plugin and can be found in the directory extended-categories-widget/2.8/lang</p>';
106
- echo '<div class="versions">';
107
  echo '<p>';
108
  echo 'If you have created a language pack you can send the .po, and if you have it the .mo file, to me and I will include the files with the plugin';
109
  echo '</p>';
110
  echo '<p>';
111
  echo 'More information about translating can found at http://codex.wordpress.org/Translating_WordPress . This page is dedicated for translating WordPress but the instructions are the same for this plugin.';
112
- echo '</p></div>';
113
- }
114
- function displayIcon ( $icon )
115
- {
116
- return ('<div class="icon32" id="icon-' . $icon . '"><br/></div>');
117
  }
118
 
119
  /**
120
- * Insert link to CSS
121
- *
122
  */
123
- function actionInjectCSS ()
124
  {
125
- wp_admin_css( 'css/dashboard' );
126
-
 
 
 
 
 
 
 
 
127
  }
128
 
129
  /**
130
- * Insert link to JS
131
- *
132
- */
133
- function actionInjectJS ()
134
- {
135
- wp_enqueue_script( 'postbox' );
136
-
137
- }
138
-
139
- /**
140
  * Adds Settings next to the plugin actions
141
  *
142
  * @WordPress Filter plugin_action_links_avh-amazon/avh-amazon.php
@@ -159,5 +245,118 @@ class AVH_EC_Admin
159
 
160
  }
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
163
  ?>
2
  class AVH_EC_Admin
3
  {
4
  var $core;
5
+ var $pagehook_OptionsPage;
6
+ var $message;
7
 
8
  function __construct ()
9
  {
10
+
11
  // Initialize the plugin
12
  $this->core = & AVHExtendedCategoriesCore::getInstance();
13
 
14
  // Admin menu
15
  add_action( 'admin_menu', array (&$this, 'actionAdminMenu' ) );
16
+ add_filter( 'plugin_action_links_extended-categories-widget/widget_extended_categories.php', array (&$this, 'filterPluginActions' ), 10, 2 );
 
 
 
 
 
 
 
 
 
 
17
 
18
  return;
19
  }
32
  function actionAdminMenu ()
33
  {
34
 
35
+ $this->pagehook_OptionsPage = add_options_page( 'AVH Extended Categories', 'AVH Extended Categories', 'manage_options', 'avhec_options', array (&$this, 'doPageOptions' ) );
36
+ add_action( 'load-' . $this->pagehook_OptionsPage, array (&$this, 'actionLoadpagehook_OptionsPage' ) );
37
+
38
+ }
39
+
40
+ function actionLoadpagehook_OptionsPage ()
41
+ {
42
  // Add metaboxes
43
+ add_meta_box( 'avhecBoxOptions', __( 'Options', 'avh-ec' ), array (&$this, 'metaboxOptions' ), $this->pagehook_OptionsPage, 'normal', 'core' );
44
+ add_meta_box( 'avhecBoxTranslation', __( 'Translation', 'avh-ec' ), array (&$this, 'metaboxTranslation' ), $this->pagehook_OptionsPage, 'normal', 'core' );
45
+
46
+ add_filter( 'screen_layout_columns', array (&$this, 'filterScreenLayoutColumns' ), 10, 2 );
47
+
48
+ wp_enqueue_style( 'avhecadmin', $this->core->info['plugin_url'] . '/inc/avh-ec.admin.css', array (), $this->core->version, 'screen' );
49
+ wp_admin_css( 'css/dashboard' );
50
+ wp_enqueue_script( 'common' );
51
+ wp_enqueue_script( 'wp-lists' );
52
+ wp_enqueue_script( 'postbox' );
53
  }
54
 
55
+ /**
56
+ * Sets the amount of columns wanted for a particuler screen
57
+ *
58
+ * @WordPress filter screen_meta_screen
59
+ * @param $screen
60
+ * @return strings
61
+ */
62
+
63
+ function filterScreenLayoutColumns ( $columns, $screen )
64
  {
65
+ if ( $screen == $this->pagehook_OptionsPage ) {
66
+ $columns[$this->pagehook_OptionsPage] = 2;
67
+ }
68
+ return $columns;
69
+
70
+ }
71
+
72
+ function doPageOptions ()
73
+ {
74
+ global $screen_layout_columns;
75
+
76
+ $options_general[] = array ('avhec[general][selectcategory]', '<em>Select Category</em> Alternative', 'text', 20, 'Alternative text for Select Category.' );
77
+ if ( isset( $_POST['updateoptions'] ) ) {
78
+ check_admin_referer( 'avh_ec_generaloptions' );
79
+
80
+ $formoptions = $_POST['avhec'];
81
+ $options = $this->core->getOptions();
82
+
83
+ //$all_data = array_merge( $options_general );
84
+ $all_data = $options_general;
85
+ foreach ( $all_data as $option ) {
86
+ $section = substr( $option[0], strpos( $option[0], '[' ) + 1 );
87
+ $section = substr( $section, 0, strpos( $section, '][' ) );
88
+ $option_key = rtrim( $option[0], ']' );
89
+ $option_key = substr( $option_key, strpos( $option_key, '][' ) + 2 );
90
+
91
+ switch ( $section ) {
92
+ case 'general' :
93
+ $current_value = $options[$section][$option_key];
94
+ break;
95
+ }
96
+ // Every field in a form is set except unchecked checkboxes. Set an unchecked checkbox to 0.
97
+ $newval = (isset( $formoptions[$section][$option_key] ) ? attribute_escape( $formoptions[$section][$option_key] ) : 0);
98
+ if ( $newval != $current_value ) { // Only process changed fields.
99
+ switch ( $section ) {
100
+ case 'general' :
101
+ $options[$section][$option_key] = $newval;
102
+ break;
103
+ }
104
+ }
105
+ }
106
+ $this->core->saveOptions( $options );
107
+ $this->message = __( 'Options saved', 'avhfdas' );
108
+ $this->status = 'updated fade';
109
+
110
+ }
111
+ $this->displayMessage();
112
+
113
+ $actual_options = $this->core->getOptions();
114
+
115
+ $hide2 = '';
116
+ switch ( $screen_layout_columns ) {
117
+ case 2 :
118
+ $width = 'width:49%;';
119
+ break;
120
+ default :
121
+ $width = 'width:98%;';
122
+ $hide2 = 'display:none;';
123
+ }
124
+ $data['options_general'] = $options_general;
125
+ $data['actual_options'] = $actual_options;
126
+
127
+ // This box can't be unselectd in the the Screen Options
128
+ add_meta_box( 'avhecBoxDonations', 'Donations', array (&$this, 'metaboxDonations' ), $this->pagehook_OptionsPage, 'side', 'core' );
129
+ $hide2 = '';
130
+ switch ( $screen_layout_columns ) {
131
+ case 2 :
132
+ $width = 'width:49%;';
133
+ break;
134
+ default :
135
+ $width = 'width:98%;';
136
+ $hide2 = 'display:none;';
137
+ }
138
+
139
+ echo '<div class="wrap avhec-wrap">';
140
  echo $this->displayIcon( 'index' );
141
  echo '<h2>' . 'AVH Extended Categories' . '</h2>';
142
+ $admin_base_url = $this->core->info['siteurl'] . '/wp-admin/admin.php?page=';
143
+ echo '<form name="avhec-generaloptions" id="avhec-generaloptions" method="POST" action="' . $admin_base_url . 'avhec_options' . '" accept-charset="utf-8" >';
144
+ wp_nonce_field( 'avh_ec_generaloptions' );
145
+ wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
146
+ wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
 
 
 
 
 
147
 
148
+ echo ' <div id="dashboard-widgets-wrap">';
149
+ echo ' <div id="dashboard-widgets" class="metabox-holder">';
150
+ echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
151
+ do_meta_boxes( $this->pagehook_OptionsPage, 'normal', $data );
152
+ echo " </div>";
153
+ echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
154
+ do_meta_boxes( $this->pagehook_OptionsPage, 'side', $data );
155
  echo ' </div>';
156
  echo ' </div>';
157
+
158
+ echo '<br class="clear"/>';
159
+ echo ' </div>'; //dashboard-widgets-wrap
160
+ echo '<p class="submit"><input class="button-primary" type="submit" name="updateoptions" value="' . __( 'Save Changes', 'avhf-ec' ) . '" /></p>';
161
+ echo '</form>';
162
+
163
+ echo '</div>'; // wrap
164
+
165
+
166
  echo '<script type="text/javascript">' . "\n";
167
  echo ' //<![CDATA[' . "\n";
168
  echo ' jQuery(document).ready( function($) {' . "\n";
169
+ echo ' $(\'.if-js-closed\').removeClass(\'if-js-closed\').addClass(\'closed\');' . "\n";
170
  echo ' // postboxes setup' . "\n";
171
+ echo ' postboxes.add_postbox_toggles(\'avhfdas-menu-overview\');' . "\n";
172
  echo ' });' . "\n";
173
  echo ' //]]>' . "\n";
174
  echo '</script>';
175
+
176
+ $this->printAdminFooter();
177
  }
178
 
179
  /**
180
+ * Options Metabox
181
+ *
182
  */
183
+ function metaboxOptions ( $data )
184
  {
185
+ echo $this->printOptions( $data['options_general'], $data['actual_options'] );
 
 
 
 
 
 
 
 
 
 
186
  }
187
 
188
  /**
189
+ * Translation Metabox
190
  * @return unknown_type
191
  */
192
  function metaboxTranslation ()
193
  {
194
  echo '<p>A language pack can be created for this plugin. The .pot file is included with the plugin and can be found in the directory extended-categories-widget/2.8/lang</p>';
 
195
  echo '<p>';
196
  echo 'If you have created a language pack you can send the .po, and if you have it the .mo file, to me and I will include the files with the plugin';
197
  echo '</p>';
198
  echo '<p>';
199
  echo 'More information about translating can found at http://codex.wordpress.org/Translating_WordPress . This page is dedicated for translating WordPress but the instructions are the same for this plugin.';
200
+ echo '</p>';
201
+ echo '<p>';
202
+ echo '<span class="b">Available Languages</span></p><p>';
203
+ echo 'Czech (cs_CZ) by Dirty Mind - <a href="http://dirtymind.ic.cz" target="_blank">http://dirtymind.ic.cz</a><br />';
204
+ echo '</p>';
205
  }
206
 
207
  /**
208
+ * Donation Metabox
209
+ * @return unknown_type
210
  */
211
+ function metaboxDonations ()
212
  {
213
+ echo '<p>If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation</p>';
214
+ echo '<p>';
215
+ echo '<span class="b">Amazon Wish List</span><br />';
216
+ echo 'You can send me something from my <a href="http://www.amazon.com/gp/registry/wishlist/1U3DTWZ72PI7W?tag=avh-donation-20">Amazon Wish List</a>';
217
+ echo '</p>';
218
+ echo '<p>';
219
+ echo '<span class="b">Through Paypal.</span><br />';
220
+ echo 'Click on the Donate button and you will be directed to Paypal where you can make your donation and you don\'t need to have a Paypal account to make a donation.';
221
+ echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input name="cmd" type="hidden" value="_donations" /> <input name="business" type="hidden" value="paypal@avirtualhome.com" /> <input name="item_name" type="hidden" value="AVH Plugins" /> <input name="no_shipping" type="hidden" value="1" /> <input name="no_note" type="hidden" value="1" /> <input name="currency_code" type="hidden" value="USD" /> <input name="tax" type="hidden" value="0" /> <input name="lc" type="hidden" value="US" /> <input name="bn" type="hidden" value="PP-DonationsBF" /> <input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" /> </form>';
222
+ echo '</p>';
223
  }
224
 
225
  /**
 
 
 
 
 
 
 
 
 
 
226
  * Adds Settings next to the plugin actions
227
  *
228
  * @WordPress Filter plugin_action_links_avh-amazon/avh-amazon.php
245
 
246
  }
247
 
248
+ ############## Admin WP Helper ##############
249
+ /**
250
+ * Display plugin Copyright
251
+ *
252
+ */
253
+ function printAdminFooter ()
254
+ {
255
+ echo '<p class="footer_avhec">';
256
+ printf( '&copy; Copyright 2009 <a href="http://blog.avirtualhome.com/" title="My Thoughts">Peter van der Does</a> | AVH Extended Categories Version %s', $this->core->version );
257
+ echo '</p>';
258
+ }
259
+
260
+ /**
261
+ * Display WP alert
262
+ *
263
+ */
264
+ function displayMessage ()
265
+ {
266
+ if ( $this->message != '' ) {
267
+ $message = $this->message;
268
+ $status = $this->status;
269
+ $this->message = $this->status = ''; // Reset
270
+ }
271
+ if ( $message ) {
272
+ $status = ($status != '') ? $status : 'updated fade';
273
+ echo '<div id="message" class="' . $status . '">';
274
+ echo '<p><strong>' . $message . '</strong></p></div>';
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Ouput formatted options
280
+ *
281
+ * @param array $option_data
282
+ * @return string
283
+ */
284
+ function printOptions ( $option_data, $option_actual )
285
+ {
286
+ // Generate output
287
+ $output = '';
288
+ $output .= "\n" . '<table class="form-table avhec-options">' . "\n";
289
+ foreach ( $option_data as $option ) {
290
+ $section = substr( $option[0], strpos( $option[0], '[' ) + 1 );
291
+ $section = substr( $section, 0, strpos( $section, '][' ) );
292
+ $option_key = rtrim( $option[0], ']' );
293
+ $option_key = substr( $option_key, strpos( $option_key, '][' ) + 2 );
294
+ // Helper
295
+ if ( $option[2] == 'helper' ) {
296
+ $output .= '<tr style="vertical-align: top;"><td class="helper" colspan="2">' . $option[4] . '</td></tr>' . "\n";
297
+ continue;
298
+ }
299
+ switch ( $option[2] ) {
300
+ case 'checkbox' :
301
+ $input_type = '<input type="checkbox" id="' . $option[0] . '" name="' . $option[0] . '" value="' . attribute_escape( $option[3] ) . '" ' . $this->isChecked( '1', $option_actual[$section][$option_key] ) . ' />' . "\n";
302
+ $explanation = $option[4];
303
+ break;
304
+ case 'dropdown' :
305
+ $selvalue = explode( '/', $option[3] );
306
+ $seltext = explode( '/', $option[4] );
307
+ $seldata = '';
308
+ foreach ( ( array ) $selvalue as $key => $sel ) {
309
+ $seldata .= '<option value="' . $sel . '" ' . (($option_actual[$section][$option_key] == $sel) ? 'selected="selected"' : '') . ' >' . ucfirst( $seltext[$key] ) . '</option>' . "\n";
310
+ }
311
+ $input_type = '<select id="' . $option[0] . '" name="' . $option[0] . '">' . $seldata . '</select>' . "\n";
312
+ $explanation = $option[5];
313
+ break;
314
+ case 'text-color' :
315
+ $input_type = '<input type="text" ' . (($option[3] > 50) ? ' style="width: 95%" ' : '') . 'id="' . $option[0] . '" name="' . $option[0] . '" value="' . attribute_escape( $option_actual[$section][$option_key] ) . '" size="' . $option[3] . '" /><div class="box_color ' . $option[0] . '"></div>' . "\n";
316
+ $explanation = $option[4];
317
+ break;
318
+ case 'textarea' :
319
+ $input_type = '<textarea rows="' . $option[5] . '" ' . (($option[3] > 50) ? ' style="width: 95%" ' : '') . 'id="' . $option[0] . '" name="' . $option[0] . '" size="' . $option[3] . '" />' . attribute_escape( $option_actual[$section][$option_key] ) . '</textarea>';
320
+ $explanation = $option[4];
321
+ break;
322
+ case 'text' :
323
+ default :
324
+ $input_type = '<input type="text" ' . (($option[3] > 50) ? ' style="width: 95%" ' : '') . 'id="' . $option[0] . '" name="' . $option[0] . '" value="' . attribute_escape( $option_actual[$section][$option_key] ) . '" size="' . $option[3] . '" />' . "\n";
325
+ $explanation = $option[4];
326
+ break;
327
+ }
328
+ // Additional Information
329
+ $extra = '';
330
+ if ( $explanation ) {
331
+ $extra = '<br /><span class="description">' . __( $explanation ) . '</span>' . "\n";
332
+ }
333
+ // Output
334
+ $output .= '<tr style="vertical-align: top;"><th align="left" scope="row"><label for="' . $option[0] . '">' . __( $option[1] ) . '</label></th><td>' . $input_type . ' ' . $extra . '</td></tr>' . "\n";
335
+ }
336
+ $output .= '</table>' . "\n";
337
+ return $output;
338
+ }
339
+
340
+ /**
341
+ * Used in forms to set an option checked
342
+ *
343
+ * @param mixed $checked
344
+ * @param mixed $current
345
+ * @return strings
346
+ */
347
+ function isChecked ( $checked, $current )
348
+ {
349
+ $return = '';
350
+ if ( $checked == $current ) {
351
+ $return = ' checked="checked"';
352
+ }
353
+ return $return;
354
+ }
355
+
356
+ function displayIcon ( $icon )
357
+ {
358
+ return ('<div class="icon32" id="icon-' . $icon . '"><br/></div>');
359
+ }
360
+
361
  }
362
  ?>
2.8/class/avh-ec.core.php CHANGED
@@ -4,6 +4,10 @@ class AVHExtendedCategoriesCore
4
  var $version;
5
  var $comment;
6
  var $info;
 
 
 
 
7
 
8
  /**
9
  * PHP5 constructor
@@ -11,8 +15,10 @@ class AVHExtendedCategoriesCore
11
  */
12
  function __construct ()
13
  {
14
- $this->version = '2.2';
15
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
 
 
16
 
17
  // Determine installation path & url
18
  $path = str_replace( '\\', '/', dirname( __FILE__ ) );
@@ -33,7 +39,22 @@ class AVHExtendedCategoriesCore
33
  // Set class property for info
34
  $this->info = array ('home' => get_option( 'home' ), 'siteurl' => $info['siteurl'], 'plugin_url' => $info['plugin_url'], 'plugin_dir' => $info['plugin_dir'], 'lang_dir' => $info['lang_dir'] );
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  $this->handleTextdomain();
 
37
  }
38
 
39
  /**
@@ -72,6 +93,32 @@ class AVHExtendedCategoriesCore
72
 
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * Used in forms to set the checked option.
77
  *
@@ -89,7 +136,7 @@ class AVHExtendedCategoriesCore
89
  return ('');
90
  }
91
 
92
- /**
93
  * Get the base directory of a directory structure
94
  *
95
  * @param string $directory
@@ -108,5 +155,341 @@ class AVHExtendedCategoriesCore
108
  return $public_base;
109
  }
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  ?>
4
  var $version;
5
  var $comment;
6
  var $info;
7
+ var $db_options_core;
8
+ var $default_options;
9
+ var $default_general_options;
10
+ var $options;
11
 
12
  /**
13
  * PHP5 constructor
15
  */
16
  function __construct ()
17
  {
18
+ $this->version = '2.3';
19
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
20
+ $db_version = 1;
21
+ $this->db_options_core = 'avhec';
22
 
23
  // Determine installation path & url
24
  $path = str_replace( '\\', '/', dirname( __FILE__ ) );
39
  // Set class property for info
40
  $this->info = array ('home' => get_option( 'home' ), 'siteurl' => $info['siteurl'], 'plugin_url' => $info['plugin_url'], 'plugin_dir' => $info['plugin_dir'], 'lang_dir' => $info['lang_dir'] );
41
 
42
+ $this->default_general_options = array ('version' => $this->version, 'dbversion' => $db_version, 'selectcategory' => '' );
43
+ $this->default_options = array ('general' => $this->default_general_options );
44
+
45
+ /**
46
+ * Set the options for the program
47
+ *
48
+ */
49
+ $this->loadOptions();
50
+
51
+ // Check if we have to do upgrades
52
+ if ( (! isset( $this->options['general']['dbversion'] )) || $this->options['general']['dbversion'] < $db_version ) {
53
+ $this->doUpgrade();
54
+ }
55
+
56
  $this->handleTextdomain();
57
+
58
  }
59
 
60
  /**
93
 
94
  }
95
 
96
+ /**
97
+ * Checks if running version is newer and do upgrades if necessary
98
+ *
99
+ * @since 1.2.3
100
+ *
101
+ */
102
+ function doUpgrade ()
103
+ {
104
+ $options = $this->getOptions();
105
+
106
+ // Add none existing sections and/or elements to the data
107
+ foreach ( $this->default_data as $section => $default_data ) {
108
+ if ( ! array_key_exists( $section, $data ) ) {
109
+ $data[$section] = $default_data;
110
+ continue;
111
+ }
112
+ foreach ( $default_data as $element => $default_value ) {
113
+ if ( ! array_key_exists( $element, $data[$section] ) ) {
114
+ $data[$section][$element] = $default_value;
115
+ }
116
+ }
117
+ }
118
+ $options['general']['version'] = $this->version;
119
+ $this->saveOptions( $options );
120
+ }
121
+
122
  /**
123
  * Used in forms to set the checked option.
124
  *
136
  return ('');
137
  }
138
 
139
+ /**
140
  * Get the base directory of a directory structure
141
  *
142
  * @param string $directory
155
  return $public_base;
156
  }
157
 
158
+ /*********************************
159
+ * *
160
+ * Methods for variable: options *
161
+ * *
162
+ ********************************/
163
+
164
+ /**
165
+ * @param array $data
166
+ */
167
+ function setOptions ( $options )
168
+ {
169
+ $this->options = $options;
170
+ }
171
+
172
+ /**
173
+ * return array
174
+ */
175
+ function getOptions ()
176
+ {
177
+ return ($this->options);
178
+ }
179
+
180
+ /**
181
+ * Save all current options and set the options
182
+ *
183
+ */
184
+ function saveOptions ( $options )
185
+ {
186
+ update_option( $this->db_options_core, $options );
187
+ wp_cache_flush(); // Delete cache
188
+ $this->setOptions( $options );
189
+ }
190
+
191
+ /**
192
+ * Retrieves the plugin options from the WordPress options table and assigns to class variable.
193
+ * If the options do not exists, like a new installation, the options are set to the default value.
194
+ *
195
+ * @return none
196
+ */
197
+ function loadOptions ()
198
+ {
199
+ $options = get_option( $this->db_options_core );
200
+ if ( false === $options ) { // New installation
201
+ $this->resetToDefaultOptions();
202
+ } else {
203
+ $this->setOptions( $options );
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Get the value for an option element. If there's no option is set on the Admin page, return the default value.
209
+ *
210
+ * @param string $key
211
+ * @param string $option
212
+ * @return mixed
213
+ */
214
+ function getOptionElement ( $option, $key )
215
+ {
216
+ if ( $this->options[$option][$key] ) {
217
+ $return = $this->options[$option][$key]; // From Admin Page
218
+ } else {
219
+ $return = $this->default_options[$option][$key]; // Default
220
+ }
221
+ return ($return);
222
+ }
223
+
224
+ /**
225
+ * Reset to default options and save in DB
226
+ *
227
+ */
228
+ function resetToDefaultOptions ()
229
+ {
230
+ $this->options = $this->default_options;
231
+ $this->saveOptions( $this->default_options );
232
+ }
233
+
234
+ /**
235
+ * Display or retrieve the HTML dropdown list of categories.
236
+ *
237
+ * The list of arguments is below:
238
+ * 'show_option_all' (string) - Text to display for showing all categories.
239
+ * 'show_option_none' (string) - Text to display for showing no categories.
240
+ * 'orderby' (string) default is 'ID' - What column to use for ordering the
241
+ * categories.
242
+ * 'order' (string) default is 'ASC' - What direction to order categories.
243
+ * 'show_last_update' (bool|int) default is 0 - See {@link get_categories()}
244
+ * 'show_count' (bool|int) default is 0 - Whether to show how many posts are
245
+ * in the category.
246
+ * 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
247
+ * don't have any posts attached to them.
248
+ * 'child_of' (int) default is 0 - See {@link get_categories()}.
249
+ * 'exclude' (string) - See {@link get_categories()}.
250
+ * 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
251
+ * 'depth' (int) - The max depth.
252
+ * 'tab_index' (int) - Tab index for select element.
253
+ * 'name' (string) - The name attribute value for selected element.
254
+ * 'class' (string) - The class attribute value for selected element.
255
+ * 'selected' (int) - Which category ID is selected.
256
+ *
257
+ * The 'hierarchical' argument, which is disabled by default, will override the
258
+ * depth argument, unless it is true. When the argument is false, it will
259
+ * display all of the categories. When it is enabled it will use the value in
260
+ * the 'depth' argument.
261
+ *
262
+ * @since 2.1.0
263
+ *
264
+ * @param string|array $args Optional. Override default arguments.
265
+ * @return string HTML content only if 'echo' argument is 0.
266
+ */
267
+ function avh_wp_dropdown_categories ( $args = '', $selectedonly )
268
+ {
269
+ $mywalker = new AVH_Walker_CategoryDropdown( );
270
+
271
+ $defaults = array ('show_option_all' => '', 'show_option_none' => '', 'orderby' => 'id', 'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'walker' => $mywalker );
272
+
273
+ $defaults['selected'] = (is_category()) ? get_query_var( 'cat' ) : 0;
274
+
275
+ $r = wp_parse_args( $args, $defaults );
276
+ $r['include_last_update_time'] = $r['show_last_update'];
277
+
278
+ extract( $r );
279
+
280
+ $tab_index_attribute = '';
281
+ if ( ( int ) $tab_index > 0 )
282
+ $tab_index_attribute = ' tabindex="' . $tab_index . '"';
283
+
284
+ $categories = get_categories( $r );
285
+
286
+ $output = '';
287
+ if ( ! empty( $categories ) ) {
288
+ $output = '<select name="' . $name . '" id="' . $name . '" class="' . $class . '" ' . $tab_index_attribute . '>' . "\n";
289
+
290
+ if ( $show_option_all ) {
291
+ $show_option_all = apply_filters( 'list_cats', $show_option_all );
292
+ $selected = ('0' === strval( $r['selected'] )) ? " selected='selected'" : '';
293
+ $output .= '\t<option value="0"' . $selected . '>' . $show_option_all . '</option>' . "\n";
294
+ }
295
+
296
+ if ( $show_option_none ) {
297
+ $show_option_none = apply_filters( 'list_cats', $show_option_none );
298
+ $selected = ('-1' === strval( $r['selected'] )) ? " selected='selected'" : '';
299
+ $output .= '\t<option value="-1"' . $selected . '>' . $show_option_none . '</option>' . "\n";
300
+ }
301
+
302
+ if ( $hierarchical && (! $selectonly) ) {
303
+ $depth = $r['depth']; // Walk the full depth.
304
+ } else {
305
+ $depth = - 1; // Flat
306
+ }
307
+ $output .= walk_category_dropdown_tree( $categories, $depth, $r );
308
+ $output .= "</select>\n";
309
+ }
310
+
311
+ $output = apply_filters( 'wp_dropdown_cats', $output );
312
+
313
+ if ( $echo )
314
+ echo $output;
315
+
316
+ return $output;
317
+ }
318
+
319
+ /**
320
+ * Display or retrieve the HTML list of categories.
321
+ *
322
+ * The list of arguments is below:
323
+ * 'show_option_all' (string) - Text to display for showing all categories.
324
+ * 'orderby' (string) default is 'ID' - What column to use for ordering the
325
+ * categories.
326
+ * 'order' (string) default is 'ASC' - What direction to order categories.
327
+ * 'show_last_update' (bool|int) default is 0 - See {@link
328
+ * walk_category_dropdown_tree()}
329
+ * 'show_count' (bool|int) default is 0 - Whether to show how many posts are
330
+ * in the category.
331
+ * 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
332
+ * don't have any posts attached to them.
333
+ * 'use_desc_for_title' (bool|int) default is 1 - Whether to use the
334
+ * description instead of the category title.
335
+ * 'feed' - See {@link get_categories()}.
336
+ * 'feed_type' - See {@link get_categories()}.
337
+ * 'feed_image' - See {@link get_categories()}.
338
+ * 'child_of' (int) default is 0 - See {@link get_categories()}.
339
+ * 'exclude' (string) - See {@link get_categories()}.
340
+ * 'exclude_tree' (string) - See {@link get_categories()}.
341
+ * 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
342
+ * 'current_category' (int) - See {@link get_categories()}.
343
+ * 'hierarchical' (bool) - See {@link get_categories()}.
344
+ * 'title_li' (string) - See {@link get_categories()}.
345
+ * 'depth' (int) - The max depth.
346
+ *
347
+ * @since 2.1.0
348
+ *
349
+ * @param string|array $args Optional. Override default arguments.
350
+ * @return string HTML content only if 'echo' argument is 0.
351
+ */
352
+ function wp_list_categories ( $args = '', $selectedonly )
353
+ {
354
+ $defaults = array ('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0, 'hierarchical' => true, 'title_li' => __( 'Categories' ), 'echo' => 1, 'depth' => 0 );
355
+
356
+ $r = wp_parse_args( $args, $defaults );
357
+
358
+ if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
359
+ $r['pad_counts'] = true;
360
+ }
361
+
362
+ if ( isset( $r['show_date'] ) ) {
363
+ $r['include_last_update_time'] = $r['show_date'];
364
+ }
365
+
366
+ if ( true == $r['hierarchical'] ) {
367
+ $r['exclude_tree'] = $r['exclude'];
368
+ $r['exclude'] = '';
369
+ }
370
+
371
+ extract( $r );
372
+
373
+ $categories = get_categories( $r );
374
+
375
+ $output = '';
376
+ if ( $title_li && 'list' == $style )
377
+ $output = '<li class="categories">' . $r['title_li'] . '<ul>';
378
+
379
+ if ( empty( $categories ) ) {
380
+ if ( 'list' == $style )
381
+ $output .= '<li>' . __( "No categories" ) . '</li>';
382
+ else
383
+ $output .= __( "No categories" );
384
+ } else {
385
+ global $wp_query;
386
+
387
+ if ( ! empty( $show_option_all ) )
388
+ if ( 'list' == $style )
389
+ $output .= '<li><a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a></li>';
390
+ else
391
+ $output .= '<a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a>';
392
+
393
+ if ( empty( $r['current_category'] ) && is_category() )
394
+ $r['current_category'] = $wp_query->get_queried_object_id();
395
+
396
+ if ( $hierarchical && (! $selectonly) ) {
397
+ $depth = $r['depth'];
398
+ } else {
399
+ $depth = - 1; // Flat.
400
+ }
401
+
402
+ $output .= walk_category_tree( $categories, $depth, $r );
403
+ }
404
+
405
+ if ( $title_li && 'list' == $style )
406
+ $output .= '</ul></li>';
407
+
408
+ $output = apply_filters( 'wp_list_categories', $output );
409
+
410
+ if ( $echo )
411
+ echo $output;
412
+ else
413
+ return $output;
414
+ }
415
  }
416
+
417
+ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
418
+ {
419
+
420
+ function walk ( $elements, $max_depth )
421
+ {
422
+
423
+ $args = array_slice( func_get_args(), 2 );
424
+ $output = '';
425
+
426
+ if ( $max_depth < - 1 ) //invalid parameter
427
+ return $output;
428
+
429
+ if ( empty( $elements ) ) //nothing to walk
430
+ return $output;
431
+
432
+ $id_field = $this->db_fields['id'];
433
+ $parent_field = $this->db_fields['parent'];
434
+
435
+ // flat display
436
+ if ( - 1 == $max_depth ) {
437
+ $empty_array = array ();
438
+ foreach ( $elements as $e )
439
+ $this->display_element( $e, $empty_array, 1, 0, $args, $output );
440
+ return $output;
441
+ }
442
+
443
+ /*
444
+ * need to display in hierarchical order
445
+ * seperate elements into two buckets: top level and children elements
446
+ * children_elements is two dimensional array, eg.
447
+ * children_elements[10][] contains all sub-elements whose parent is 10.
448
+ */
449
+ $top_level_elements = array ();
450
+ $children_elements = array ();
451
+ foreach ( $elements as $e ) {
452
+ if ( 0 == $e->$parent_field )
453
+ $top_level_elements[] = $e;
454
+ else
455
+ $children_elements[$e->$parent_field][] = $e;
456
+ }
457
+
458
+ /*
459
+ * when none of the elements is top level
460
+ * assume the first one must be root of the sub elements
461
+ */
462
+ if ( empty( $top_level_elements ) ) {
463
+
464
+ $first = array_slice( $elements, 0, 1 );
465
+ $root = $first[0];
466
+
467
+ $top_level_elements = array ();
468
+ $children_elements = array ();
469
+ foreach ( $elements as $e ) {
470
+ if ( $root->$parent_field == $e->$parent_field )
471
+ $top_level_elements[] = $e;
472
+ else
473
+ $children_elements[$e->$parent_field][] = $e;
474
+ }
475
+ }
476
+
477
+ foreach ( $top_level_elements as $e )
478
+ $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
479
+
480
+ /*
481
+ * if we are displaying all levels, and remaining children_elements is not empty,
482
+ * then we got orphans, which should be displayed regardless
483
+ */
484
+ if ( (0 == $max_depth) && count( $children_elements ) > 0 ) {
485
+ $empty_array = array ();
486
+ foreach ( $children_elements as $orphans )
487
+ foreach ( $orphans as $op )
488
+ $this->display_element( $op, $empty_array, 1, 0, $args, $output );
489
+ }
490
+
491
+ return $output;
492
+ }
493
+ }
494
+
495
  ?>
2.8/class/avh-ec.widgets.php CHANGED
@@ -40,6 +40,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
40
  {
41
  extract( $args );
42
 
 
43
  $c = $instance['count'] ? '1' : '0';
44
  $h = $instance['hierarchical'] ? '1' : '0';
45
  $d = $instance['depth'] ? $instance['depth'] : 0;
@@ -58,28 +59,44 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
58
  $d = 0;
59
  }
60
 
61
- $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories','avh-ec' ) : $instance['title'] );
62
  $style = empty( $instance['style'] ) ? 'list' : $instance['style'];
 
63
  $included_cats = '';
64
  if ( $instance['post_category'] ) {
65
  $post_category = unserialize( $instance['post_category'] );
66
- $included_cats = implode( ",", $post_category );
 
 
 
 
 
 
67
  }
68
 
 
 
 
 
 
69
 
70
- if ($invert) {$inc_exc = 'exclude';}
71
- else {$inc_exc = 'include';}
72
- $cat_args = array ($inc_exc => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'hide_empty' => $e, 'hierarchical' => $h, 'depth' => $d, 'title_li' => '', 'show_option_none' => __( 'Select Category','avh-ec' ), 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-select-' . $this->number );
 
 
 
 
73
  echo $before_widget;
74
  echo $this->core->comment;
75
  echo $before_title . $title . $after_title;
76
 
77
  if ( $style == 'list' ) {
78
  echo '<ul>';
79
- wp_list_categories( $cat_args );
80
  echo '</ul>';
81
  } else {
82
- wp_dropdown_categories( $cat_args );
83
  echo '<script type=\'text/javascript\'>' . "\n";
84
  echo '/* <![CDATA[ */' . "\n";
85
  echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-' . $this->number . '");' . "\n";
@@ -112,6 +129,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
112
  $instance = $old_instance;
113
 
114
  $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
 
115
  $instance['count'] = $new_instance['count'] ? 1 : 0;
116
  $instance['hierarchical'] = $new_instance['hierarchical'] ? 1 : 0;
117
  $instance['hide_empty'] = $new_instance['hide_empty'] ? 1 : 0;
@@ -131,6 +149,10 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
131
  }
132
  $instance['invert_included'] = $new_instance['invert_included'] ? 1 : 0;
133
 
 
 
 
 
134
  return $instance;
135
  }
136
 
@@ -146,6 +168,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
146
 
147
  // Prepare data for display
148
  $title = esc_attr( $instance['title'] );
 
149
  $count = ( bool ) $instance['count'];
150
  $hierarchical = ( bool ) $instance['hierarchical'];
151
  $depth = ( int ) $instance['depth'];
@@ -165,71 +188,81 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
165
  if ( $depth < 0 || 11 < $depth ) {
166
  $depth = 0;
167
  }
 
 
 
 
168
  echo '<p>';
169
  echo '<label for="' . $this->get_field_id( 'title' ) . '">';
170
- _e( 'Title','avh-ec' );
171
  echo '<input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . $title . '" /> ';
172
  echo '</label>';
173
  echo '</p>';
174
 
175
  echo '<p>';
176
 
 
 
 
 
 
 
177
  echo '<label for="' . $this->get_field_id( 'count' ) . '">';
178
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'count' ) . '" name="' . $this->get_field_name( 'count' ) . '" ' . $this->core->isChecked( true, $count ) . ' /> ';
179
- _e( 'Show post counts','avh-ec' );
180
  echo '</label>';
181
  echo '<br />';
182
 
183
  echo '<label for="' . $this->get_field_id( 'hierachical' ) . '">';
184
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'hierachical' ) . '" name="' . $this->get_field_name( 'hierarchical' ) . '" ' . $this->core->isChecked( true, $hierarchical ) . ' /> ';
185
- _e( 'Show hierarchy','avh-ec' );
186
  echo '</label>';
187
  echo '<br />';
188
 
189
  echo '<label for="' . $this->get_field_id( 'depth' ) . '">';
190
- _e( 'How many levels to show','avh-ec' );
191
  echo '</label>';
192
  echo '<select id="' . $this->get_field_id( 'depth' ) . '" name="' . $this->get_field_name( 'depth' ) . '"> ';
193
- echo '<option value="0" ' . (0 == $depth ? "selected='selected'" : '') . '>' . __( 'All Levels','avh-ec' ) . '</option>';
194
- echo '<option value="1" ' . (1 == $depth ? "selected='selected'" : '') . '>' . __( 'Toplevel only','avh-ec' ) . '</option>';
195
  for ( $i = 2; $i <= 11; $i ++ ) {
196
- echo '<option value="' . $i . '" ' . ($i == $depth ? "selected='selected'" : '') . '>' . __( 'Child ','avh-ec' ) . ($i - 1) . '</option>';
197
  }
198
  echo '</select>';
199
  echo '<br />';
200
 
201
  echo '<label for="' . $this->get_field_id( 'hide_empty' ) . '">';
202
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'hide_empty' ) . '" name="' . $this->get_field_name( 'hide_empty' ) . '" ' . $this->core->isChecked( true, $hide_empty ) . '/> ';
203
- _e( 'Hide empty categories','avh-ec' );
204
  echo '</label>';
205
  echo '<br />';
206
  echo '</p>';
207
 
208
  echo '<p>';
209
  echo '<label for="' . $this->get_field_id( 'sort_column' ) . '">';
210
- _e( 'Sort by ','avh-ec' );
211
  echo '<select id="' . $this->get_field_id( 'sort_column' ) . '" name="' . $this->get_field_name( 'sort_column' ) . '"> ';
212
- echo '<option value="ID" ' . $sort_id . '>' . __( 'ID' ,'avh-ec' ) . '</option>';
213
- echo '<option value="name" ' . $sort_name . '>' . __( 'Name','avh-ec' ) . '</option>';
214
- echo '<option value="count" ' . $sort_count . '>' . __( 'Count','avh-ec' ) . '</option>';
215
  echo '</select>';
216
  echo '</label>';
217
  echo '<br />';
218
 
219
  echo '<label for="' . $this->get_field_id( 'sort_order' ) . '">';
220
- _e( 'Sort order ','avh-ec' );
221
  echo '<select id="' . $this->get_field_id( 'sort_order' ) . '" name="' . $this->get_field_name( 'sort_order' ) . '"> ';
222
- echo '<option value="asc" ' . $sort_order_a . '>' . __( 'Ascending','avh-ec' ) . '</option>';
223
- echo '<option value="desc" ' . $sort_order_d . '>' . __( 'Descending','avh-ec' ) . '</option>';
224
  echo '</select>';
225
  echo '</label>';
226
  echo '<br />';
227
 
228
  echo '<label for="' . $this->get_field_id( 'style' ) . '">';
229
- _e( 'Display style ','avh-ec' );
230
  echo '<select id="' . $this->get_field_id( 'style' ) . '" name="' . $this->get_field_name( 'style' ) . '"> ';
231
- echo '<option value="list" ' . $style_list . '>' . __( 'List','avh-ec' ) . '</option>';
232
- echo '<option value="drop" ' . $style_drop . '>' . __( 'Drop down','avh-ec' ) . '</option>';
233
  echo '</select>';
234
  echo '</label>';
235
  echo '<br />';
@@ -239,33 +272,33 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
239
 
240
  echo '<label for="' . $this->get_field_id( 'rssfeed' ) . '">';
241
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'rssfeed' ) . '" name="' . $this->get_field_name( 'rssfeed' ) . '" ' . $this->core->isChecked( true, $rssfeed ) . '/> ';
242
- _e( 'Show RSS Feed','avh-ec' );
243
  echo '</label>';
244
  echo '<br />';
245
 
246
  echo '<label for="">';
247
- _e( 'Path (URI) to RSS image','avh-ec' );
248
  echo '<input class="widefat" id="' . $this->get_field_id( 'rssimage' ) . '" name="' . $this->get_field_name( 'rssimage' ) . '" type="text" value="' . $rssimage . '" />';
249
  echo '</label>';
250
  echo '</p>';
251
 
252
  echo '<p>';
253
- echo '<b>' . __( 'Select categories','avh-ec' ) . '</b><hr />';
254
  echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear" style="list-style-type: none; margin-left: 5px; padding-left: 0px; margin-bottom: 20px;">';
255
  echo '<li id="' . $this->get_field_id( 'category--1' ) . '" class="popular-category">';
256
  echo '<label for="' . $this->get_field_id( 'post_category' ) . '" class="selectit">';
257
  echo '<input value="all" id="' . $this->get_field_id( 'post_category' ) . '" name="' . $this->get_field_name( 'post_category' ) . '[all]" type="checkbox" ' . $this->core->isChecked( false, $selected_cats ) . '> ';
258
- _e( 'All Categories','avh-ec' );
259
  echo '</label>';
260
  echo '</li>';
261
- $this->avh_wp_category_checklist( 0, 0, $selected_cats, false, $this->number );
262
  echo '</ul>';
263
  echo '</p>';
264
 
265
  echo '<p>';
266
  echo '<label for="' . $this->get_field_id( 'invert_included' ) . '">';
267
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'invert_included' ) . '" name="' . $this->get_field_name( 'invert_included' ) . '" ' . $this->core->isChecked( true, $invert_included ) . '/> ';
268
- _e( 'Exclude the selected categories','avh-ec' );
269
  echo '</label>';
270
  echo '<br />';
271
  echo '</p>';
@@ -282,7 +315,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
282
  * @param array $popular_cats
283
  * @param int $number
284
  */
285
- function avh_wp_category_checklist ( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $number )
286
  {
287
  $walker = new AVH_Walker_Category_Checklist( );
288
  $walker->number = $number;
@@ -294,16 +327,16 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
294
 
295
  $args = array ();
296
  if ( is_array( $selected_cats ) )
297
- $args['selected_cats'] = $selected_cats;
298
  elseif ( $post_id )
299
- $args['selected_cats'] = wp_get_post_categories( $post_id );
300
  else
301
- $args['selected_cats'] = array ();
302
 
303
  if ( is_array( $popular_cats ) )
304
- $args['popular_cats'] = $popular_cats;
305
  else
306
- $args['popular_cats'] = get_terms( 'category', array ('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
307
 
308
  if ( $descendants_and_self ) {
309
  $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
@@ -312,6 +345,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
312
  } else {
313
  $categories = get_categories( 'get=all' );
314
  }
 
315
 
316
  // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
317
  $checked_categories = array ();
@@ -322,10 +356,14 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
322
  }
323
  }
324
 
325
- // Put checked cats on top
326
- echo call_user_func_array( array (&$walker, 'walk' ), array ($checked_categories, 0, $args ) );
327
- // Then the rest of them
328
- echo call_user_func_array( array (&$walker, 'walk' ), array ($categories, 0, $args ) );
 
 
 
 
329
  }
330
  }
331
 
@@ -345,7 +383,7 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
345
  {
346
  $this->core = & AVHExtendedCategoriesCore::getInstance();
347
 
348
- $widget_ops = array ('description' => __( "Shows the top categories.",'avh-ec' ) );
349
  WP_Widget::__construct( false, __( 'AVH Extended Categories Top' ), $widget_ops );
350
  }
351
 
@@ -366,7 +404,7 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
366
 
367
  extract( $args );
368
 
369
- $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories','avh-ec' ) : $instance['title'] );
370
  $style = empty( $instance['style'] ) ? 'list' : $instance['style'];
371
  if ( ! $a = ( int ) $instance['amount'] ) {
372
  $a = 5;
@@ -387,10 +425,16 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
387
  }
388
  }
389
 
 
 
 
 
 
 
390
  $top_cats = get_terms( 'category', array ('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => $a, 'hierarchical' => false ) );
391
  $included_cats = implode( ",", $top_cats );
392
 
393
- $cat_args = array ('include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'hide_empty' => 0, 'hierarchical' => 0, 'depth' => - 1, 'title_li' => '', 'show_option_none' => __( 'Select Category','avh-ec' ), 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-top-select-' . $this->number );
394
  echo $before_widget;
395
  echo $this->core->comment;
396
  echo $before_title . $title . $after_title;
@@ -477,14 +521,14 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
477
  }
478
  echo '<p>';
479
  echo '<label for="' . $this->get_field_id( 'title' ) . '">';
480
- _e( 'Title','avh-ec' );
481
  echo '<input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . $title . '" /> ';
482
  echo '</label>';
483
  echo '</p>';
484
 
485
  echo '<p>';
486
  echo '<label for="' . $this->get_field_id( 'amount' ) . '">';
487
- _e( 'How many categories to show','avh-ec' );
488
  echo '</label>';
489
  echo '<input class="widefat" id="' . $this->get_field_id( 'amount' ) . '" name="' . $this->get_field_name( 'amount' ) . '" type="text" value="' . $amount . '" /> ';
490
  echo '</select>';
@@ -493,34 +537,34 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
493
  echo '<p>';
494
  echo '<label for="' . $this->get_field_id( 'count' ) . '">';
495
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'count' ) . '" name="' . $this->get_field_name( 'count' ) . '" ' . $this->core->isChecked( true, $count ) . ' /> ';
496
- _e( 'Show post counts','avh-ec' );
497
  echo '</label>';
498
  echo '<br />';
499
 
500
  echo '<label for="' . $this->get_field_id( 'sort_column' ) . '">';
501
- _e( 'Sort by ','avh-ec' );
502
  echo '<select id="' . $this->get_field_id( 'sort_column' ) . '" name="' . $this->get_field_name( 'sort_column' ) . '"> ';
503
- echo '<option value="ID" ' . $sort_id . '>' . __( 'ID','avh-ec' ) . '</option>';
504
- echo '<option value="name" ' . $sort_name . '>' . __( 'Name','avh-ec' ) . '</option>';
505
- echo '<option value="count" ' . $sort_count . '>' . __( 'Count','avh-ec' ) . '</option>';
506
  echo '</select>';
507
  echo '</label>';
508
  echo '<br />';
509
 
510
  echo '<label for="' . $this->get_field_id( 'sort_order' ) . '">';
511
- _e( 'Sort order ','avh-ec' );
512
  echo '<select id="' . $this->get_field_id( 'sort_order' ) . '" name="' . $this->get_field_name( 'sort_order' ) . '"> ';
513
- echo '<option value="asc" ' . $sort_order_a . '>' . __( 'Ascending','avh-ec' ) . '</option>';
514
- echo '<option value="desc" ' . $sort_order_d . '>' . __( 'Descending','avh-ec' ) . '</option>';
515
  echo '</select>';
516
  echo '</label>';
517
  echo '<br />';
518
 
519
  echo '<label for="' . $this->get_field_id( 'style' ) . '">';
520
- _e( 'Display style ','avh-ec' );
521
  echo '<select id="' . $this->get_field_id( 'style' ) . '" name="' . $this->get_field_name( 'style' ) . '"> ';
522
- echo '<option value="list" ' . $style_list . '>' . __( 'List','avh-ec' ) . '</option>';
523
- echo '<option value="drop" ' . $style_drop . '>' . __( 'Drop down','avh-ec' ) . '</option>';
524
  echo '</select>';
525
  echo '</label>';
526
  echo '<br />';
@@ -530,12 +574,12 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
530
 
531
  echo '<label for="' . $this->get_field_id( 'rssfeed' ) . '">';
532
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'rssfeed' ) . '" name="' . $this->get_field_name( 'rssfeed' ) . '" ' . $this->core->isChecked( true, $rssfeed ) . '/> ';
533
- _e( 'Show RSS Feed','avh-ec' );
534
  echo '</label>';
535
  echo '<br />';
536
 
537
  echo '<label for="">';
538
- _e( 'Path (URI) to RSS image','avh-ec' );
539
  echo '<input class="widefat" id="' . $this->get_field_id( 'rssimage' ) . '" name="' . $this->get_field_name( 'rssimage' ) . '" type="text" value="' . $rssimage . '" />';
540
  echo '</label>';
541
  echo '</p>';
@@ -560,13 +604,13 @@ class AVH_Walker_Category_Checklist extends Walker
560
  function start_lvl ( &$output, $depth, $args )
561
  {
562
  $indent = str_repeat( "\t", $depth );
563
- $output .= "$indent<ul class='children'>\n";
564
  }
565
 
566
  function end_lvl ( &$output, $depth, $args )
567
  {
568
  $indent = str_repeat( "\t", $depth );
569
- $output .= "$indent</ul>\n";
570
  }
571
 
572
  function start_el ( &$output, $category, $depth, $args )
@@ -574,7 +618,9 @@ class AVH_Walker_Category_Checklist extends Walker
574
  extract( $args );
575
  $this->input_id = $this->input_id . '-' . $category->term_id;
576
  $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
577
- $output .= "\n<li id='$this->li_id'$class>" . '<label for="' . $this->input_id . '" class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $category->term_id . ']" id="' . $this->input_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "") . '/> ' . wp_specialchars( apply_filters( 'the_category', $category->name ) ) . '</label>';
 
 
578
  }
579
 
580
  function end_el ( &$output, $category, $depth, $args )
40
  {
41
  extract( $args );
42
 
43
+ $selectedonly = $instance['selectedonly'] ? '1' : '0';
44
  $c = $instance['count'] ? '1' : '0';
45
  $h = $instance['hierarchical'] ? '1' : '0';
46
  $d = $instance['depth'] ? $instance['depth'] : 0;
59
  $d = 0;
60
  }
61
 
62
+ $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories', 'avh-ec' ) : $instance['title'] );
63
  $style = empty( $instance['style'] ) ? 'list' : $instance['style'];
64
+
65
  $included_cats = '';
66
  if ( $instance['post_category'] ) {
67
  $post_category = unserialize( $instance['post_category'] );
68
+ $children = array ();
69
+ if ( ! $instance['selectedonly'] ) {
70
+ foreach ( $post_category as $cat_id ) {
71
+ $children = array_merge( $children, get_term_children( $cat_id, 'category' ) );
72
+ }
73
+ }
74
+ $included_cats = implode( ",", array_merge( $post_category, $children ) );
75
  }
76
 
77
+ if ( $invert ) {
78
+ $inc_exc = 'exclude';
79
+ } else {
80
+ $inc_exc = 'include';
81
+ }
82
 
83
+ $options = $this->core->getOptions();
84
+ $show_option_none = __( 'Select Category', 'avh-ec' );
85
+ if ( $options['general']['selectcategory'] ) {
86
+ $show_option_none = $options['general']['selectcategory'];
87
+ }
88
+
89
+ $cat_args = array ($inc_exc => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'hide_empty' => $e, 'hierarchical' => $h, 'depth' => $d, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-select-' . $this->number );
90
  echo $before_widget;
91
  echo $this->core->comment;
92
  echo $before_title . $title . $after_title;
93
 
94
  if ( $style == 'list' ) {
95
  echo '<ul>';
96
+ $this->core->avh_wp_list_categories( $cat_args, $selectedonly );
97
  echo '</ul>';
98
  } else {
99
+ $this->core->avh_wp_dropdown_categories( $cat_args, $selectedonly );
100
  echo '<script type=\'text/javascript\'>' . "\n";
101
  echo '/* <![CDATA[ */' . "\n";
102
  echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-' . $this->number . '");' . "\n";
129
  $instance = $old_instance;
130
 
131
  $instance['title'] = strip_tags( stripslashes( $new_instance['title'] ) );
132
+ $instance['selectedonly'] = $new_instance['selectedonly'] ? 1 : 0;
133
  $instance['count'] = $new_instance['count'] ? 1 : 0;
134
  $instance['hierarchical'] = $new_instance['hierarchical'] ? 1 : 0;
135
  $instance['hide_empty'] = $new_instance['hide_empty'] ? 1 : 0;
149
  }
150
  $instance['invert_included'] = $new_instance['invert_included'] ? 1 : 0;
151
 
152
+ // If only the selected categories are to be displayed, this implies a flat view. Can't be hierarchical
153
+ if ( 1 == $new_instance['selectedonly'] ) {
154
+ $instance['hierarchical'] = 0;
155
+ }
156
  return $instance;
157
  }
158
 
168
 
169
  // Prepare data for display
170
  $title = esc_attr( $instance['title'] );
171
+ $selectedonly = ( bool ) $instance['selectedonly'];
172
  $count = ( bool ) $instance['count'];
173
  $hierarchical = ( bool ) $instance['hierarchical'];
174
  $depth = ( int ) $instance['depth'];
188
  if ( $depth < 0 || 11 < $depth ) {
189
  $depth = 0;
190
  }
191
+
192
+ if (1 == $selectedonly) {
193
+ $hierarchical = 0;
194
+ }
195
  echo '<p>';
196
  echo '<label for="' . $this->get_field_id( 'title' ) . '">';
197
+ _e( 'Title', 'avh-ec' );
198
  echo '<input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . $title . '" /> ';
199
  echo '</label>';
200
  echo '</p>';
201
 
202
  echo '<p>';
203
 
204
+ echo '<label for="' . $this->get_field_id( 'selectedonly' ) . '">';
205
+ echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'selectedonly' ) . '" name="' . $this->get_field_name( 'selectedonly' ) . '" ' . $this->core->isChecked( true, $selectedonly ) . ' /> ';
206
+ _e( 'Show selected categories only', 'avh-ec' );
207
+ echo '</label>';
208
+ echo '<br />';
209
+
210
  echo '<label for="' . $this->get_field_id( 'count' ) . '">';
211
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'count' ) . '" name="' . $this->get_field_name( 'count' ) . '" ' . $this->core->isChecked( true, $count ) . ' /> ';
212
+ _e( 'Show post counts', 'avh-ec' );
213
  echo '</label>';
214
  echo '<br />';
215
 
216
  echo '<label for="' . $this->get_field_id( 'hierachical' ) . '">';
217
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'hierachical' ) . '" name="' . $this->get_field_name( 'hierarchical' ) . '" ' . $this->core->isChecked( true, $hierarchical ) . ' /> ';
218
+ _e( 'Show hierarchy', 'avh-ec' );
219
  echo '</label>';
220
  echo '<br />';
221
 
222
  echo '<label for="' . $this->get_field_id( 'depth' ) . '">';
223
+ _e( 'How many levels to show', 'avh-ec' );
224
  echo '</label>';
225
  echo '<select id="' . $this->get_field_id( 'depth' ) . '" name="' . $this->get_field_name( 'depth' ) . '"> ';
226
+ echo '<option value="0" ' . (0 == $depth ? "selected='selected'" : '') . '>' . __( 'All Levels', 'avh-ec' ) . '</option>';
227
+ echo '<option value="1" ' . (1 == $depth ? "selected='selected'" : '') . '>' . __( 'Toplevel only', 'avh-ec' ) . '</option>';
228
  for ( $i = 2; $i <= 11; $i ++ ) {
229
+ echo '<option value="' . $i . '" ' . ($i == $depth ? "selected='selected'" : '') . '>' . __( 'Child ', 'avh-ec' ) . ($i - 1) . '</option>';
230
  }
231
  echo '</select>';
232
  echo '<br />';
233
 
234
  echo '<label for="' . $this->get_field_id( 'hide_empty' ) . '">';
235
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'hide_empty' ) . '" name="' . $this->get_field_name( 'hide_empty' ) . '" ' . $this->core->isChecked( true, $hide_empty ) . '/> ';
236
+ _e( 'Hide empty categories', 'avh-ec' );
237
  echo '</label>';
238
  echo '<br />';
239
  echo '</p>';
240
 
241
  echo '<p>';
242
  echo '<label for="' . $this->get_field_id( 'sort_column' ) . '">';
243
+ _e( 'Sort by ', 'avh-ec' );
244
  echo '<select id="' . $this->get_field_id( 'sort_column' ) . '" name="' . $this->get_field_name( 'sort_column' ) . '"> ';
245
+ echo '<option value="ID" ' . $sort_id . '>' . __( 'ID', 'avh-ec' ) . '</option>';
246
+ echo '<option value="name" ' . $sort_name . '>' . __( 'Name', 'avh-ec' ) . '</option>';
247
+ echo '<option value="count" ' . $sort_count . '>' . __( 'Count', 'avh-ec' ) . '</option>';
248
  echo '</select>';
249
  echo '</label>';
250
  echo '<br />';
251
 
252
  echo '<label for="' . $this->get_field_id( 'sort_order' ) . '">';
253
+ _e( 'Sort order ', 'avh-ec' );
254
  echo '<select id="' . $this->get_field_id( 'sort_order' ) . '" name="' . $this->get_field_name( 'sort_order' ) . '"> ';
255
+ echo '<option value="asc" ' . $sort_order_a . '>' . __( 'Ascending', 'avh-ec' ) . '</option>';
256
+ echo '<option value="desc" ' . $sort_order_d . '>' . __( 'Descending', 'avh-ec' ) . '</option>';
257
  echo '</select>';
258
  echo '</label>';
259
  echo '<br />';
260
 
261
  echo '<label for="' . $this->get_field_id( 'style' ) . '">';
262
+ _e( 'Display style ', 'avh-ec' );
263
  echo '<select id="' . $this->get_field_id( 'style' ) . '" name="' . $this->get_field_name( 'style' ) . '"> ';
264
+ echo '<option value="list" ' . $style_list . '>' . __( 'List', 'avh-ec' ) . '</option>';
265
+ echo '<option value="drop" ' . $style_drop . '>' . __( 'Drop down', 'avh-ec' ) . '</option>';
266
  echo '</select>';
267
  echo '</label>';
268
  echo '<br />';
272
 
273
  echo '<label for="' . $this->get_field_id( 'rssfeed' ) . '">';
274
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'rssfeed' ) . '" name="' . $this->get_field_name( 'rssfeed' ) . '" ' . $this->core->isChecked( true, $rssfeed ) . '/> ';
275
+ _e( 'Show RSS Feed', 'avh-ec' );
276
  echo '</label>';
277
  echo '<br />';
278
 
279
  echo '<label for="">';
280
+ _e( 'Path (URI) to RSS image', 'avh-ec' );
281
  echo '<input class="widefat" id="' . $this->get_field_id( 'rssimage' ) . '" name="' . $this->get_field_name( 'rssimage' ) . '" type="text" value="' . $rssimage . '" />';
282
  echo '</label>';
283
  echo '</p>';
284
 
285
  echo '<p>';
286
+ echo '<b>' . __( 'Select categories', 'avh-ec' ) . '</b><hr />';
287
  echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear" style="list-style-type: none; margin-left: 5px; padding-left: 0px; margin-bottom: 20px;">';
288
  echo '<li id="' . $this->get_field_id( 'category--1' ) . '" class="popular-category">';
289
  echo '<label for="' . $this->get_field_id( 'post_category' ) . '" class="selectit">';
290
  echo '<input value="all" id="' . $this->get_field_id( 'post_category' ) . '" name="' . $this->get_field_name( 'post_category' ) . '[all]" type="checkbox" ' . $this->core->isChecked( false, $selected_cats ) . '> ';
291
+ _e( 'All Categories', 'avh-ec' );
292
  echo '</label>';
293
  echo '</li>';
294
+ $this->avh_wp_category_checklist( 0, 0, $selected_cats, false, $this->number, 1 );
295
  echo '</ul>';
296
  echo '</p>';
297
 
298
  echo '<p>';
299
  echo '<label for="' . $this->get_field_id( 'invert_included' ) . '">';
300
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'invert_included' ) . '" name="' . $this->get_field_name( 'invert_included' ) . '" ' . $this->core->isChecked( true, $invert_included ) . '/> ';
301
+ _e( 'Exclude the selected categories', 'avh-ec' );
302
  echo '</label>';
303
  echo '<br />';
304
  echo '</p>';
315
  * @param array $popular_cats
316
  * @param int $number
317
  */
318
+ function avh_wp_category_checklist ( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $number, $display = 1 )
319
  {
320
  $walker = new AVH_Walker_Category_Checklist( );
321
  $walker->number = $number;
327
 
328
  $args = array ();
329
  if ( is_array( $selected_cats ) )
330
+ $args['selected_cats'] = $selected_cats;
331
  elseif ( $post_id )
332
+ $args['selected_cats'] = wp_get_post_categories( $post_id );
333
  else
334
+ $args['selected_cats'] = array ();
335
 
336
  if ( is_array( $popular_cats ) )
337
+ $args['popular_cats'] = $popular_cats;
338
  else
339
+ $args['popular_cats'] = get_terms( 'category', array ('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
340
 
341
  if ( $descendants_and_self ) {
342
  $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
345
  } else {
346
  $categories = get_categories( 'get=all' );
347
  }
348
+ $all_categories = $categories;
349
 
350
  // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
351
  $checked_categories = array ();
356
  }
357
  }
358
 
359
+ if ( 1 == $display ) {
360
+ // Put checked cats on top
361
+ echo call_user_func_array( array (&$walker, 'walk' ), array ($checked_categories, 0, $args ) );
362
+ // Then the rest of them
363
+ echo call_user_func_array( array (&$walker, 'walk' ), array ($categories, 0, $args ) );
364
+ } else {
365
+ $return( $all_categories );
366
+ }
367
  }
368
  }
369
 
383
  {
384
  $this->core = & AVHExtendedCategoriesCore::getInstance();
385
 
386
+ $widget_ops = array ('description' => __( "Shows the top categories.", 'avh-ec' ) );
387
  WP_Widget::__construct( false, __( 'AVH Extended Categories Top' ), $widget_ops );
388
  }
389
 
404
 
405
  extract( $args );
406
 
407
+ $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories', 'avh-ec' ) : $instance['title'] );
408
  $style = empty( $instance['style'] ) ? 'list' : $instance['style'];
409
  if ( ! $a = ( int ) $instance['amount'] ) {
410
  $a = 5;
425
  }
426
  }
427
 
428
+ $options = $this->core->getOptions();
429
+ $show_option_none = __( 'Select Category', 'avh-ec' );
430
+ if ( $options['general']['selectcategory'] ) {
431
+ $show_option_none = $options['general']['selectcategory'];
432
+ }
433
+
434
  $top_cats = get_terms( 'category', array ('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => $a, 'hierarchical' => false ) );
435
  $included_cats = implode( ",", $top_cats );
436
 
437
+ $cat_args = array ('include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'hide_empty' => 0, 'hierarchical' => 0, 'depth' => - 1, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-top-select-' . $this->number );
438
  echo $before_widget;
439
  echo $this->core->comment;
440
  echo $before_title . $title . $after_title;
521
  }
522
  echo '<p>';
523
  echo '<label for="' . $this->get_field_id( 'title' ) . '">';
524
+ _e( 'Title', 'avh-ec' );
525
  echo '<input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . $title . '" /> ';
526
  echo '</label>';
527
  echo '</p>';
528
 
529
  echo '<p>';
530
  echo '<label for="' . $this->get_field_id( 'amount' ) . '">';
531
+ _e( 'How many categories to show', 'avh-ec' );
532
  echo '</label>';
533
  echo '<input class="widefat" id="' . $this->get_field_id( 'amount' ) . '" name="' . $this->get_field_name( 'amount' ) . '" type="text" value="' . $amount . '" /> ';
534
  echo '</select>';
537
  echo '<p>';
538
  echo '<label for="' . $this->get_field_id( 'count' ) . '">';
539
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'count' ) . '" name="' . $this->get_field_name( 'count' ) . '" ' . $this->core->isChecked( true, $count ) . ' /> ';
540
+ _e( 'Show post counts', 'avh-ec' );
541
  echo '</label>';
542
  echo '<br />';
543
 
544
  echo '<label for="' . $this->get_field_id( 'sort_column' ) . '">';
545
+ _e( 'Sort by ', 'avh-ec' );
546
  echo '<select id="' . $this->get_field_id( 'sort_column' ) . '" name="' . $this->get_field_name( 'sort_column' ) . '"> ';
547
+ echo '<option value="ID" ' . $sort_id . '>' . __( 'ID', 'avh-ec' ) . '</option>';
548
+ echo '<option value="name" ' . $sort_name . '>' . __( 'Name', 'avh-ec' ) . '</option>';
549
+ echo '<option value="count" ' . $sort_count . '>' . __( 'Count', 'avh-ec' ) . '</option>';
550
  echo '</select>';
551
  echo '</label>';
552
  echo '<br />';
553
 
554
  echo '<label for="' . $this->get_field_id( 'sort_order' ) . '">';
555
+ _e( 'Sort order ', 'avh-ec' );
556
  echo '<select id="' . $this->get_field_id( 'sort_order' ) . '" name="' . $this->get_field_name( 'sort_order' ) . '"> ';
557
+ echo '<option value="asc" ' . $sort_order_a . '>' . __( 'Ascending', 'avh-ec' ) . '</option>';
558
+ echo '<option value="desc" ' . $sort_order_d . '>' . __( 'Descending', 'avh-ec' ) . '</option>';
559
  echo '</select>';
560
  echo '</label>';
561
  echo '<br />';
562
 
563
  echo '<label for="' . $this->get_field_id( 'style' ) . '">';
564
+ _e( 'Display style ', 'avh-ec' );
565
  echo '<select id="' . $this->get_field_id( 'style' ) . '" name="' . $this->get_field_name( 'style' ) . '"> ';
566
+ echo '<option value="list" ' . $style_list . '>' . __( 'List', 'avh-ec' ) . '</option>';
567
+ echo '<option value="drop" ' . $style_drop . '>' . __( 'Drop down', 'avh-ec' ) . '</option>';
568
  echo '</select>';
569
  echo '</label>';
570
  echo '<br />';
574
 
575
  echo '<label for="' . $this->get_field_id( 'rssfeed' ) . '">';
576
  echo '<input class="checkbox" type="checkbox" id="' . $this->get_field_id( 'rssfeed' ) . '" name="' . $this->get_field_name( 'rssfeed' ) . '" ' . $this->core->isChecked( true, $rssfeed ) . '/> ';
577
+ _e( 'Show RSS Feed', 'avh-ec' );
578
  echo '</label>';
579
  echo '<br />';
580
 
581
  echo '<label for="">';
582
+ _e( 'Path (URI) to RSS image', 'avh-ec' );
583
  echo '<input class="widefat" id="' . $this->get_field_id( 'rssimage' ) . '" name="' . $this->get_field_name( 'rssimage' ) . '" type="text" value="' . $rssimage . '" />';
584
  echo '</label>';
585
  echo '</p>';
604
  function start_lvl ( &$output, $depth, $args )
605
  {
606
  $indent = str_repeat( "\t", $depth );
607
+ $output .= $indent . '<ul class="children">' . "\n";
608
  }
609
 
610
  function end_lvl ( &$output, $depth, $args )
611
  {
612
  $indent = str_repeat( "\t", $depth );
613
+ $output .= $indent . '</ul>' . "\n";
614
  }
615
 
616
  function start_el ( &$output, $category, $depth, $args )
618
  extract( $args );
619
  $this->input_id = $this->input_id . '-' . $category->term_id;
620
  $class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
621
+ $output .= "\n" . '<li id="' . $this->li_id . '"' . $class . '>';
622
+ $output .= '<label for="' . $this->input_id . '" class="selectit">';
623
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $category->term_id . ']" id="' . $this->input_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "") . '/> ' . wp_specialchars( apply_filters( 'the_category', $category->name ) ) . '</label>';
624
  }
625
 
626
  function end_el ( &$output, $category, $depth, $args )
2.8/inc/avh-ec.admin.css ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .footer_avhec {
2
+ font-size: 0.8em;
3
+ text-align: center;
4
+ }
5
+
6
+ div.clearer {
7
+ clear: both;
8
+ line-height: 1px;
9
+ font-size: 1px;
10
+ height: 1px;
11
+ }
12
+ .avhec-wrap span.description {
13
+ font-size: 11px;
14
+ }
15
+ #avhec-generaloptions input {
16
+ font-size: 11px;
17
+ }
18
+
19
+ table.avhec-options {
20
+ font-size: 11px;
21
+ }
22
+ .avhfec-wrap .b {
23
+ font-weight: bold;
24
+ }
25
+
26
+ #avhecBoxDonations .b {
27
+ font-weight: bold;
28
+ }
29
+ #avhecBoxDonations .inside {
30
+ font-size: 12px;
31
+ }
32
+
33
+ #avhecBoxDonations .versions {
34
+ padding: 6px 10px 12px;
35
+ }
36
+
37
+ #avhecBoxTranslation .inside {
38
+ font-size: 12px;
39
+ }
2.8/lang/avh-ec-cs_CZ.mo ADDED
Binary file
2.8/lang/avh-ec-cs_CZ.po ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: AVH Extended Categories, Czech, 20-09-2009\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2009-09-17 14:16-0500\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: Dirty Mind <bluebat@seznam.cz>\n"
8
+ "Language-Team: Dirty Mind <bluebat@seznam.cz>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-Language: Czech\n"
13
+ "X-Poedit-Country: CZECH REPUBLIC\n"
14
+
15
+ #: ../class/avh-ec.admin.php:43
16
+ msgid "Options"
17
+ msgstr "Nastavení"
18
+
19
+ #: ../class/avh-ec.admin.php:44
20
+ msgid "Translation"
21
+ msgstr "Překlad"
22
+
23
+ #: ../class/avh-ec.admin.php:107
24
+ msgid "Options saved"
25
+ msgstr "Nastavení bylo uloženo"
26
+
27
+ #: ../class/avh-ec.admin.php:160
28
+ msgid "Save Changes"
29
+ msgstr "Uložit změny"
30
+
31
+ #: ../class/avh-ec.admin.php:241
32
+ msgid "Settings"
33
+ msgstr "Nastavení"
34
+
35
+ #: ../class/avh-ec.core.php:354
36
+ #: ../class/avh-ec.widgets.php:62
37
+ #: ../class/avh-ec.widgets.php:407
38
+ msgid "Categories"
39
+ msgstr "Rubriky"
40
+
41
+ #: ../class/avh-ec.core.php:381
42
+ #: ../class/avh-ec.core.php:383
43
+ msgid "No categories"
44
+ msgstr "Žádné rubriky"
45
+
46
+ #: ../class/avh-ec.widgets.php:24
47
+ msgid "An extended version of the default Categories widget."
48
+ msgstr "Rozšířená verze základního widgetu Rubriky."
49
+
50
+ #: ../class/avh-ec.widgets.php:84
51
+ #: ../class/avh-ec.widgets.php:429
52
+ msgid "Select Category"
53
+ msgstr "Vybrat rubriku"
54
+
55
+ #: ../class/avh-ec.widgets.php:197
56
+ #: ../class/avh-ec.widgets.php:524
57
+ msgid "Title"
58
+ msgstr "Název"
59
+
60
+ #: ../class/avh-ec.widgets.php:206
61
+ msgid "Show selected categories only"
62
+ msgstr "Zobrazit pouze vybrané rubriky"
63
+
64
+ #: ../class/avh-ec.widgets.php:212
65
+ #: ../class/avh-ec.widgets.php:540
66
+ msgid "Show post counts"
67
+ msgstr "Zobrazit počty příspěvků"
68
+
69
+ #: ../class/avh-ec.widgets.php:218
70
+ msgid "Show hierarchy"
71
+ msgstr "Zobrazit hierarchii"
72
+
73
+ #: ../class/avh-ec.widgets.php:223
74
+ msgid "How many levels to show"
75
+ msgstr "Počet zobrazovaných úrovní"
76
+
77
+ #: ../class/avh-ec.widgets.php:226
78
+ msgid "All Levels"
79
+ msgstr "Všechny úrovně"
80
+
81
+ #: ../class/avh-ec.widgets.php:227
82
+ msgid "Toplevel only"
83
+ msgstr "Pouze základní úroveň"
84
+
85
+ #: ../class/avh-ec.widgets.php:229
86
+ msgid "Child "
87
+ msgstr "Potomků: "
88
+
89
+ #: ../class/avh-ec.widgets.php:236
90
+ msgid "Hide empty categories"
91
+ msgstr "Skrýt prázdné rubriky"
92
+
93
+ #: ../class/avh-ec.widgets.php:243
94
+ #: ../class/avh-ec.widgets.php:545
95
+ msgid "Sort by "
96
+ msgstr "Setřídit podle"
97
+
98
+ #: ../class/avh-ec.widgets.php:245
99
+ #: ../class/avh-ec.widgets.php:547
100
+ msgid "ID"
101
+ msgstr "ID"
102
+
103
+ #: ../class/avh-ec.widgets.php:246
104
+ #: ../class/avh-ec.widgets.php:548
105
+ msgid "Name"
106
+ msgstr "Jméno"
107
+
108
+ #: ../class/avh-ec.widgets.php:247
109
+ #: ../class/avh-ec.widgets.php:549
110
+ msgid "Count"
111
+ msgstr "Počet"
112
+
113
+ #: ../class/avh-ec.widgets.php:253
114
+ #: ../class/avh-ec.widgets.php:555
115
+ msgid "Sort order "
116
+ msgstr "Způsob řazení"
117
+
118
+ #: ../class/avh-ec.widgets.php:255
119
+ #: ../class/avh-ec.widgets.php:557
120
+ msgid "Ascending"
121
+ msgstr "Vzestupně"
122
+
123
+ #: ../class/avh-ec.widgets.php:256
124
+ #: ../class/avh-ec.widgets.php:558
125
+ msgid "Descending"
126
+ msgstr "Sestupně"
127
+
128
+ #: ../class/avh-ec.widgets.php:262
129
+ #: ../class/avh-ec.widgets.php:564
130
+ msgid "Display style "
131
+ msgstr "Styl zobrazení"
132
+
133
+ #: ../class/avh-ec.widgets.php:264
134
+ #: ../class/avh-ec.widgets.php:566
135
+ msgid "List"
136
+ msgstr "Seznam"
137
+
138
+ #: ../class/avh-ec.widgets.php:265
139
+ #: ../class/avh-ec.widgets.php:567
140
+ msgid "Drop down"
141
+ msgstr "Drop down"
142
+
143
+ #: ../class/avh-ec.widgets.php:275
144
+ #: ../class/avh-ec.widgets.php:577
145
+ msgid "Show RSS Feed"
146
+ msgstr "Ukázat RSS Feed"
147
+
148
+ #: ../class/avh-ec.widgets.php:280
149
+ #: ../class/avh-ec.widgets.php:582
150
+ msgid "Path (URI) to RSS image"
151
+ msgstr "Cesta (URI) k obrázku RSS"
152
+
153
+ #: ../class/avh-ec.widgets.php:286
154
+ msgid "Select categories"
155
+ msgstr "Vybrat rubriky"
156
+
157
+ #: ../class/avh-ec.widgets.php:291
158
+ msgid "All Categories"
159
+ msgstr "Všechny rubriky"
160
+
161
+ #: ../class/avh-ec.widgets.php:301
162
+ msgid "Exclude the selected categories"
163
+ msgstr "Vyloučit vybrané rubriky"
164
+
165
+ #: ../class/avh-ec.widgets.php:386
166
+ msgid "Shows the top categories."
167
+ msgstr "Zobrazí top rubriky."
168
+
169
+ #: ../class/avh-ec.widgets.php:387
170
+ msgid "AVH Extended Categories Top"
171
+ msgstr "AVH Extended Categories Top"
172
+
173
+ #: ../class/avh-ec.widgets.php:531
174
+ msgid "How many categories to show"
175
+ msgstr "Počet zobrazovaných rubrik"
176
+
2.8/lang/avh-ec.pot CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: AVH Extended Categories\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2009-08-26 20:46-0500\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Peter van der Does <peter@avirtualhome.com>\n"
8
  "Language-Team: \n"
@@ -16,135 +16,165 @@ msgstr ""
16
  "X-Poedit-SearchPath-0: .\n"
17
  "X-Poedit-SearchPath-1: ..\n"
18
 
19
- #: ../class/avh-ec.widgets.php:24
20
- msgid "An extended version of the default Categories widget."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  msgstr ""
22
 
23
- #: ../class/avh-ec.widgets.php:61
24
- #: ../class/avh-ec.widgets.php:369
 
25
  msgid "Categories"
26
  msgstr ""
27
 
28
- #: ../class/avh-ec.widgets.php:72
29
- #: ../class/avh-ec.widgets.php:393
 
 
 
 
 
 
 
 
 
30
  msgid "Select Category"
31
  msgstr ""
32
 
33
- #: ../class/avh-ec.widgets.php:170
34
- #: ../class/avh-ec.widgets.php:480
35
  msgid "Title"
36
  msgstr ""
37
 
38
- #: ../class/avh-ec.widgets.php:179
39
- #: ../class/avh-ec.widgets.php:496
 
 
 
 
40
  msgid "Show post counts"
41
  msgstr ""
42
 
43
- #: ../class/avh-ec.widgets.php:185
44
  msgid "Show hierarchy"
45
  msgstr ""
46
 
47
- #: ../class/avh-ec.widgets.php:190
48
  msgid "How many levels to show"
49
  msgstr ""
50
 
51
- #: ../class/avh-ec.widgets.php:193
52
  msgid "All Levels"
53
  msgstr ""
54
 
55
- #: ../class/avh-ec.widgets.php:194
56
  msgid "Toplevel only"
57
  msgstr ""
58
 
59
- #: ../class/avh-ec.widgets.php:196
60
  msgid "Child "
61
  msgstr ""
62
 
63
- #: ../class/avh-ec.widgets.php:203
64
  msgid "Hide empty categories"
65
  msgstr ""
66
 
67
- #: ../class/avh-ec.widgets.php:210
68
- #: ../class/avh-ec.widgets.php:501
69
  msgid "Sort by "
70
  msgstr ""
71
 
72
- #: ../class/avh-ec.widgets.php:212
73
- #: ../class/avh-ec.widgets.php:503
74
  msgid "ID"
75
  msgstr ""
76
 
77
- #: ../class/avh-ec.widgets.php:213
78
- #: ../class/avh-ec.widgets.php:504
79
  msgid "Name"
80
  msgstr ""
81
 
82
- #: ../class/avh-ec.widgets.php:214
83
- #: ../class/avh-ec.widgets.php:505
84
  msgid "Count"
85
  msgstr ""
86
 
87
- #: ../class/avh-ec.widgets.php:220
88
- #: ../class/avh-ec.widgets.php:511
89
  msgid "Sort order "
90
  msgstr ""
91
 
92
- #: ../class/avh-ec.widgets.php:222
93
- #: ../class/avh-ec.widgets.php:513
94
  msgid "Ascending"
95
  msgstr ""
96
 
97
- #: ../class/avh-ec.widgets.php:223
98
- #: ../class/avh-ec.widgets.php:514
99
  msgid "Descending"
100
  msgstr ""
101
 
102
- #: ../class/avh-ec.widgets.php:229
103
- #: ../class/avh-ec.widgets.php:520
104
  msgid "Display style "
105
  msgstr ""
106
 
107
- #: ../class/avh-ec.widgets.php:231
108
- #: ../class/avh-ec.widgets.php:522
109
  msgid "List"
110
  msgstr ""
111
 
112
- #: ../class/avh-ec.widgets.php:232
113
- #: ../class/avh-ec.widgets.php:523
114
  msgid "Drop down"
115
  msgstr ""
116
 
117
- #: ../class/avh-ec.widgets.php:242
118
- #: ../class/avh-ec.widgets.php:533
119
  msgid "Show RSS Feed"
120
  msgstr ""
121
 
122
- #: ../class/avh-ec.widgets.php:247
123
- #: ../class/avh-ec.widgets.php:538
124
  msgid "Path (URI) to RSS image"
125
  msgstr ""
126
 
127
- #: ../class/avh-ec.widgets.php:253
128
  msgid "Select categories"
129
  msgstr ""
130
 
131
- #: ../class/avh-ec.widgets.php:258
132
  msgid "All Categories"
133
  msgstr ""
134
 
135
- #: ../class/avh-ec.widgets.php:268
136
  msgid "Exclude the selected categories"
137
  msgstr ""
138
 
139
- #: ../class/avh-ec.widgets.php:348
140
  msgid "Shows the top categories."
141
  msgstr ""
142
 
143
- #: ../class/avh-ec.widgets.php:349
144
  msgid "AVH Extended Categories Top"
145
  msgstr ""
146
 
147
- #: ../class/avh-ec.widgets.php:487
148
  msgid "How many categories to show"
149
  msgstr ""
150
 
2
  msgstr ""
3
  "Project-Id-Version: AVH Extended Categories\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2009-09-17 14:16-0500\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Peter van der Does <peter@avirtualhome.com>\n"
8
  "Language-Team: \n"
16
  "X-Poedit-SearchPath-0: .\n"
17
  "X-Poedit-SearchPath-1: ..\n"
18
 
19
+ #: ../class/avh-ec.admin.php:43
20
+ msgid "Options"
21
+ msgstr ""
22
+
23
+ #: ../class/avh-ec.admin.php:44
24
+ msgid "Translation"
25
+ msgstr ""
26
+
27
+ #: ../class/avh-ec.admin.php:107
28
+ msgid "Options saved"
29
+ msgstr ""
30
+
31
+ #: ../class/avh-ec.admin.php:160
32
+ msgid "Save Changes"
33
+ msgstr ""
34
+
35
+ #: ../class/avh-ec.admin.php:241
36
+ msgid "Settings"
37
  msgstr ""
38
 
39
+ #: ../class/avh-ec.core.php:354
40
+ #: ../class/avh-ec.widgets.php:62
41
+ #: ../class/avh-ec.widgets.php:407
42
  msgid "Categories"
43
  msgstr ""
44
 
45
+ #: ../class/avh-ec.core.php:381
46
+ #: ../class/avh-ec.core.php:383
47
+ msgid "No categories"
48
+ msgstr ""
49
+
50
+ #: ../class/avh-ec.widgets.php:24
51
+ msgid "An extended version of the default Categories widget."
52
+ msgstr ""
53
+
54
+ #: ../class/avh-ec.widgets.php:84
55
+ #: ../class/avh-ec.widgets.php:429
56
  msgid "Select Category"
57
  msgstr ""
58
 
59
+ #: ../class/avh-ec.widgets.php:197
60
+ #: ../class/avh-ec.widgets.php:524
61
  msgid "Title"
62
  msgstr ""
63
 
64
+ #: ../class/avh-ec.widgets.php:206
65
+ msgid "Show selected categories only"
66
+ msgstr ""
67
+
68
+ #: ../class/avh-ec.widgets.php:212
69
+ #: ../class/avh-ec.widgets.php:540
70
  msgid "Show post counts"
71
  msgstr ""
72
 
73
+ #: ../class/avh-ec.widgets.php:218
74
  msgid "Show hierarchy"
75
  msgstr ""
76
 
77
+ #: ../class/avh-ec.widgets.php:223
78
  msgid "How many levels to show"
79
  msgstr ""
80
 
81
+ #: ../class/avh-ec.widgets.php:226
82
  msgid "All Levels"
83
  msgstr ""
84
 
85
+ #: ../class/avh-ec.widgets.php:227
86
  msgid "Toplevel only"
87
  msgstr ""
88
 
89
+ #: ../class/avh-ec.widgets.php:229
90
  msgid "Child "
91
  msgstr ""
92
 
93
+ #: ../class/avh-ec.widgets.php:236
94
  msgid "Hide empty categories"
95
  msgstr ""
96
 
97
+ #: ../class/avh-ec.widgets.php:243
98
+ #: ../class/avh-ec.widgets.php:545
99
  msgid "Sort by "
100
  msgstr ""
101
 
102
+ #: ../class/avh-ec.widgets.php:245
103
+ #: ../class/avh-ec.widgets.php:547
104
  msgid "ID"
105
  msgstr ""
106
 
107
+ #: ../class/avh-ec.widgets.php:246
108
+ #: ../class/avh-ec.widgets.php:548
109
  msgid "Name"
110
  msgstr ""
111
 
112
+ #: ../class/avh-ec.widgets.php:247
113
+ #: ../class/avh-ec.widgets.php:549
114
  msgid "Count"
115
  msgstr ""
116
 
117
+ #: ../class/avh-ec.widgets.php:253
118
+ #: ../class/avh-ec.widgets.php:555
119
  msgid "Sort order "
120
  msgstr ""
121
 
122
+ #: ../class/avh-ec.widgets.php:255
123
+ #: ../class/avh-ec.widgets.php:557
124
  msgid "Ascending"
125
  msgstr ""
126
 
127
+ #: ../class/avh-ec.widgets.php:256
128
+ #: ../class/avh-ec.widgets.php:558
129
  msgid "Descending"
130
  msgstr ""
131
 
132
+ #: ../class/avh-ec.widgets.php:262
133
+ #: ../class/avh-ec.widgets.php:564
134
  msgid "Display style "
135
  msgstr ""
136
 
137
+ #: ../class/avh-ec.widgets.php:264
138
+ #: ../class/avh-ec.widgets.php:566
139
  msgid "List"
140
  msgstr ""
141
 
142
+ #: ../class/avh-ec.widgets.php:265
143
+ #: ../class/avh-ec.widgets.php:567
144
  msgid "Drop down"
145
  msgstr ""
146
 
147
+ #: ../class/avh-ec.widgets.php:275
148
+ #: ../class/avh-ec.widgets.php:577
149
  msgid "Show RSS Feed"
150
  msgstr ""
151
 
152
+ #: ../class/avh-ec.widgets.php:280
153
+ #: ../class/avh-ec.widgets.php:582
154
  msgid "Path (URI) to RSS image"
155
  msgstr ""
156
 
157
+ #: ../class/avh-ec.widgets.php:286
158
  msgid "Select categories"
159
  msgstr ""
160
 
161
+ #: ../class/avh-ec.widgets.php:291
162
  msgid "All Categories"
163
  msgstr ""
164
 
165
+ #: ../class/avh-ec.widgets.php:301
166
  msgid "Exclude the selected categories"
167
  msgstr ""
168
 
169
+ #: ../class/avh-ec.widgets.php:386
170
  msgid "Shows the top categories."
171
  msgstr ""
172
 
173
+ #: ../class/avh-ec.widgets.php:387
174
  msgid "AVH Extended Categories Top"
175
  msgstr ""
176
 
177
+ #: ../class/avh-ec.widgets.php:531
178
  msgid "How many categories to show"
179
  msgstr ""
180
 
readme.txt CHANGED
@@ -4,10 +4,9 @@ Donate link: http://blog.avirtualhome.com/wordpress-plugins/
4
  Tags: extended, categories, widget, top categories
5
  Requires at least: 2.3
6
  Tested up to: 2.8
7
- Stable tag: 2.2
8
-
9
- The AVH Extended Categories Widget gives you two widgets for displaying categories. One is a replacement of the default category widget to allow for greater customization. The second is a Top Categories widget.
10
 
 
11
  == Description ==
12
 
13
  The AVH Extended Categories Widget gives you two widgets for displaying categories.
@@ -40,6 +39,9 @@ The Top Categories widget gives you the following customizable options:
40
  * Show RSS link after the category as text or image.
41
  * Select which categories to show. (Requires WordPress 2.5.1 or higher).
42
 
 
 
 
43
  == Installation ==
44
 
45
  The Extended Categories Widget can be installed in 3 easy steps:
@@ -71,6 +73,12 @@ I'll keep a list of translators and their websites here in the readme.txt and on
71
  None
72
 
73
  == Changelog ==
 
 
 
 
 
 
74
  = Version 2.2 =
75
  * RFC: Internationalization of the plugin.
76
  * Bugfix: W3 Validation Errors when using dropdown categories.
4
  Tags: extended, categories, widget, top categories
5
  Requires at least: 2.3
6
  Tested up to: 2.8
7
+ Stable tag: 2.3
 
 
8
 
9
+ The AVH Extended Categories Widget gives you two widgets for displaying categories.
10
  == Description ==
11
 
12
  The AVH Extended Categories Widget gives you two widgets for displaying categories.
39
  * Show RSS link after the category as text or image.
40
  * Select which categories to show. (Requires WordPress 2.5.1 or higher).
41
 
42
+ Translations:
43
+ * Czech (cs_CZ) by Dirty Mind - http://dirtymind.ic.cz
44
+
45
  == Installation ==
46
 
47
  The Extended Categories Widget can be installed in 3 easy steps:
73
  None
74
 
75
  == Changelog ==
76
+ = Version 2.3 =
77
+ * RFC: You can change the text Select Category, without editing any translation file.
78
+ * Bugfix: Selecting one parent wouldn;t show it's children.
79
+ * You can now display only selected categories. This didn't work properly in an hierachical category structure.
80
+ * Added Czech translation.
81
+
82
  = Version 2.2 =
83
  * RFC: Internationalization of the plugin.
84
  * Bugfix: W3 Validation Errors when using dropdown categories.
widget-pre2.8.php CHANGED
@@ -7,7 +7,7 @@ function widget_extended_categories_init() {
7
  }
8
 
9
  function widget_extended_categories($args, $number = 1) {
10
- $version = '2.2';
11
  // Check for version
12
  require (ABSPATH . WPINC . '/version.php');
13
  if ( version_compare($wp_version, '2.5.1', '<') ) {
7
  }
8
 
9
  function widget_extended_categories($args, $number = 1) {
10
+ $version = '2.3';
11
  // Check for version
12
  require (ABSPATH . WPINC . '/version.php');
13
  if ( version_compare($wp_version, '2.5.1', '<') ) {
widget_extended_categories.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Extended Category Widget
4
  Plugin URI: http://blog.avirtualhome.com/wordpress-plugins
5
  Description: Replacement of the category widget to allow for greater customization of the category widget.
6
- Version: 2.2
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9
 
3
  Plugin Name: Extended Category Widget
4
  Plugin URI: http://blog.avirtualhome.com/wordpress-plugins
5
  Description: Replacement of the category widget to allow for greater customization of the category widget.
6
+ Version: 2.3
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9