AVH Extended Categories Widgets - Version 3.6

Version Description

Download this release

Release Info

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

Code changes from version 3.5 to 3.6

Files changed (47) hide show
  1. 2.8/avh-ec.client.php +2 -0
  2. 2.8/class/avh-ec.admin.php +343 -159
  3. 2.8/class/avh-ec.category-group.php +32 -33
  4. 2.8/class/avh-ec.core.php +112 -86
  5. 2.8/class/avh-ec.widgets.php +203 -115
  6. 2.8/css/avh-ec.admin.css +51 -9
  7. 2.8/js/avh-ec.admin.manualorder.closure.js +1 -0
  8. 2.8/js/avh-ec.admin.manualorder.js +19 -0
  9. 2.8/js/avh-ec.categorygroup.closure.js +1 -0
  10. 2.8/js/avh-ec.categorygroup.js +21 -1
  11. 2.8/js/avh-ec.categorygroup.js.closure.js +1 -0
  12. 2.8/lang/avh-ec.po +0 -752
  13. 2.8/lang/avh-ec.pot +0 -720
  14. 3.3/avh-ec.client.php +82 -0
  15. 3.3/class/avh-ec.admin.php +1490 -0
  16. 3.3/class/avh-ec.category-group.php +411 -0
  17. 3.3/class/avh-ec.core.php +737 -0
  18. 3.3/class/avh-ec.widgets.php +1004 -0
  19. 3.3/css/avh-ec.admin.css +155 -0
  20. 3.3/css/avh-ec.widget.css +12 -0
  21. 3.3/helpers/avh-forms.php +44 -0
  22. 3.3/images/us_banner_logow_120x60.gif +0 -0
  23. 3.3/js/avh-ec.admin.manualorder.closure.js +1 -0
  24. 3.3/js/avh-ec.admin.manualorder.js +19 -0
  25. 3.3/js/avh-ec.categorygroup.closure.js +1 -0
  26. 2.8/js/avh-ec.categorygroup.dev.js → 3.3/js/avh-ec.categorygroup.js +1 -1
  27. {2.8/lang → lang}/avh-ec-cs_CZ.mo +0 -0
  28. {2.8/lang → lang}/avh-ec-de_DE.mo +0 -0
  29. {2.8/lang → lang}/avh-ec-el.mo +0 -0
  30. lang/avh-ec-en_US.mo +0 -0
  31. {2.8/lang → lang}/avh-ec-es_ES.mo +0 -0
  32. {2.8/lang → lang}/avh-ec-id_ID.mo +0 -0
  33. {2.8/lang → lang}/avh-ec-it_IT.mo +0 -0
  34. {2.8/lang → lang}/avh-ec-nl_NL.mo +0 -0
  35. {2.8/lang → lang}/avh-ec-ru_RU.mo +0 -0
  36. {2.8/lang → lang}/avh-ec-sv_SE.mo +0 -0
  37. {2.8/lang → lang}/avh-ec-tr.mo +0 -0
  38. {2.8/lang → lang}/avh-ec.mo +0 -0
  39. lang/avh-ec.po +1056 -0
  40. libs/avh-common.php +100 -0
  41. libs/avh-db.php +67 -0
  42. libs/avh-registry.php +144 -0
  43. libs/avh-security.php +47 -0
  44. libs/avh-visitor.php +60 -0
  45. readme.txt +10 -3
  46. widget-pre2.8.php +1 -1
  47. widget_extended_categories.php +37 -14
2.8/avh-ec.client.php CHANGED
@@ -45,6 +45,8 @@ class AVH_EC_Singleton
45
  */
46
  require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-forms.php');
47
  require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widgets.php');
 
 
48
 
49
  /**
50
  * Initialize the plugin
45
  */
46
  require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-forms.php');
47
  require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widgets.php');
48
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/libs/avh-common.php');
49
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/libs/avh-db.php');
50
 
51
  /**
52
  * Initialize the plugin
2.8/class/avh-ec.admin.php CHANGED
@@ -7,13 +7,13 @@ class AVH_EC_Admin
7
  * @var AVH_EC_Core
8
  */
9
  var $core;
10
-
11
  /**
12
  *
13
  * @var AVH_EC_Category_Group
14
  */
15
  var $catgrp;
16
-
17
  var $hooks = array();
18
  var $message;
19
 
@@ -23,29 +23,29 @@ class AVH_EC_Admin
23
  */
24
  function __construct ()
25
  {
26
-
27
  // Initialize the plugin
28
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
29
  $this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
30
-
31
  add_action('wp_ajax_delete-group', array(&$this, 'ajaxDeleteGroup'));
32
-
33
  // Admin menu
34
  add_action('admin_init', array(&$this,'actionAdminInit'));
35
  add_action('admin_menu', array(&$this, 'actionAdminMenu'));
36
  add_filter('plugin_action_links_extended-categories-widget/widget_extended_categories.php', array(&$this, 'filterPluginActions'), 10, 2);
37
-
38
  // Actions used for editing posts
39
  add_action('load-post.php', array(&$this, 'actionLoadPostPage'));
40
  add_action('load-page.php', array(&$this, 'actionLoadPostPage'));
41
-
42
  // Actions related to adding and deletes categories
43
  add_action("created_category", array($this, 'actionCreatedCategory'), 10, 2);
44
  add_action("delete_category", array($this, 'actionDeleteCategory'), 10, 2);
45
-
46
  add_filter('manage_categories_group_columns', array(&$this, 'filterManageCategoriesGroupColumns'));
47
  add_filter('explain_nonce_delete-avhecgroup', array(&$this, 'filterExplainNonceDeleteGroup'), 10, 2);
48
-
49
  return;
50
  }
51
 
@@ -65,7 +65,7 @@ class AVH_EC_Admin
65
  add_action('edit_term', array(&$this,'handleEditTerm'), 10, 3 );
66
 
67
  }
68
-
69
  /**
70
  *
71
  * Adds Category Group form
@@ -75,30 +75,30 @@ class AVH_EC_Admin
75
  * @param unknown_type $taxonomy
76
  */
77
  function displayCategoryGroupForm($term, $taxonomy){
78
-
79
  $current_selection = '';
80
  $tax_meta = get_option($this->core->db_options_tax_meta);
81
  if ( isset($tax_meta[$taxonomy][$term->term_id]) ) {
82
  $tax_meta = $tax_meta[$taxonomy][$term->term_id];
83
  $current_selection = $tax_meta['category_group_term_id'];
84
  }
85
-
86
  if (empty($current_selection)) {
87
  $current_group = $this->catgrp->getGroupByCategoryID($term->term_id);
88
  $current_selection= $current_group->term_id;
89
  }
90
-
91
  $cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
92
  foreach ($cat_groups as $group) {
93
  $temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
94
  $dropdown_value[] = $group->term_id;
95
  $dropdown_text[] = $temp_cat->name;
96
  }
97
-
98
  foreach ( $dropdown_value as $key => $sel) {
99
  $seldata .= '<option value="' . esc_attr($sel) . '" ' . (($current_selection == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($dropdown_text[$key])) . '</option>' . "\n";
100
  }
101
-
102
  echo '<h3>AVH Extended Categories - Category Group Widget</h3>';
103
  echo '<table class="form-table"><tbody>';
104
  echo '<tr class="form-field">';
@@ -113,7 +113,7 @@ class AVH_EC_Admin
113
  echo '</tr>';
114
  echo '</tbody></table>';
115
  }
116
-
117
  /**
118
  * Saves the association Category - Category Group fron the edit taxonomy page
119
  * @WordPress action edit_form.
@@ -129,7 +129,7 @@ class AVH_EC_Admin
129
  update_option($this->core->db_options_tax_meta, $tax_meta);
130
  }
131
  }
132
-
133
  /**
134
  * When a category is created this function is called to add the new category to the group all
135
  * @param $term_id
@@ -170,30 +170,32 @@ class AVH_EC_Admin
170
  */
171
  function actionAdminMenu ()
172
  {
173
-
174
  // Register Style and Scripts
175
- $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
176
  wp_register_script('avhec-categorygroup-js', AVHEC_PLUGIN_URL . '/js/avh-ec.categorygroup' . $suffix . '.js', array('jquery'), $this->core->version, true);
 
177
  wp_register_style('avhec-admin-css', AVHEC_PLUGIN_URL . '/css/avh-ec.admin.css', array('wp-admin'), $this->core->version, 'screen');
178
-
179
  // Add menu system
180
  $folder = $this->core->getBaseDirectory(AVHEC_PLUGIN_DIR);
181
  add_menu_page('AVH Extended Categories', 'AVH Extended Categories', 'manage_options', $folder, array(&$this, 'doMenuOverview'));
182
  $this->hooks['menu_overview'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Overview', 'avh-ec'), __('Overview', 'avh-ec'), 'manage_options', $folder, array(&$this, 'doMenuOverview'));
183
  $this->hooks['menu_general'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('General Options', 'avh-ec'), __('General Options', 'avh-ec'), 'manage_options', 'avhec-general', array(&$this, 'doMenuGeneral'));
184
  $this->hooks['menu_category_groups'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Category Groups', 'avh-ec'), __('Category Groups', 'avh-ec'), 'manage_options', 'avhec-grouped', array(&$this, 'doMenuCategoryGroup'));
 
185
  $this->hooks['menu_faq'] = add_submenu_page($folder, 'AVH Extended Categories:' . __('F.A.Q', 'avh-ec'), __('F.A.Q', 'avh-ec'), 'manage_options', 'avhec-faq', array(&$this, 'doMenuFAQ'));
186
-
187
  // Add actions for menu pages
188
  // Overview Menu
189
  add_action('load-' . $this->hooks['menu_overview'], array(&$this, 'actionLoadPageHook_Overview'));
190
-
191
  // General Options Menu
192
  add_action('load-' . $this->hooks['menu_general'], array(&$this, 'actionLoadPageHook_General'));
193
-
194
  // Category Groups Menu
195
  add_action('load-' . $this->hooks['menu_category_groups'], array(&$this, 'actionLoadPageHook_CategoryGroup'));
196
-
197
  // FAQ Menu
198
  add_action('load-' . $this->hooks['menu_faq'], array(&$this, 'actionLoadPageHook_faq'));
199
  }
@@ -207,20 +209,24 @@ class AVH_EC_Admin
207
  // Add metaboxes
208
  add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(&$this, 'metaboxCategoryGroupList'), $this->hooks['menu_overview'], 'normal', 'core');
209
  add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(&$this, 'metaboxTranslation'), $this->hooks['menu_overview'], 'normal', 'core');
210
-
211
- add_filter('screen_layout_columns', array(&$this, 'filterScreenLayoutColumns'), 10, 2);
212
-
 
 
 
 
213
  // WordPress core Scripts
214
  wp_enqueue_script('common');
215
  wp_enqueue_script('wp-lists');
216
  wp_enqueue_script('postbox');
217
-
218
  // Plugin Scripts
219
  wp_enqueue_script('avhec-categorygroup-js');
220
-
221
  // WordPress core Styles
222
  wp_admin_css('css/dashboard');
223
-
224
  // Plugin Style
225
  wp_enqueue_style('avhec-admin-css');
226
  }
@@ -233,11 +239,11 @@ class AVH_EC_Admin
233
  function doMenuOverview ()
234
  {
235
  global $screen_layout_columns;
236
-
237
  // This box can't be unselectd in the the Screen Options
238
  add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array(&$this, 'metaboxAnnouncements'), $this->hooks['menu_overview'], 'side', '');
239
  add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_overview'], 'side', '');
240
-
241
  $hide2 = '';
242
  switch ($screen_layout_columns) {
243
  case 2:
@@ -247,7 +253,7 @@ class AVH_EC_Admin
247
  $width = 'width:98%;';
248
  $hide2 = 'display:none;';
249
  }
250
-
251
  echo '<div class="wrap avhec-metabox-wrap">';
252
  echo $this->displayIcon('index');
253
  echo '<h2>' . 'AVH Extended Categories - ' . __('Overview', 'avh-ec') . '</h2>';
@@ -260,11 +266,11 @@ class AVH_EC_Admin
260
  do_meta_boxes($this->hooks['menu_overview'], 'side', '');
261
  echo ' </div>';
262
  echo ' </div>';
263
-
264
  echo '<br class="clear"/>';
265
  echo ' </div>'; //dashboard-widgets-wrap
266
  echo '</div>'; // wrap
267
-
268
 
269
  $this->printMetaboxGeneralNonces();
270
  $this->printMetaboxJS('overview');
@@ -279,20 +285,24 @@ class AVH_EC_Admin
279
  {
280
  // Add metaboxes
281
  add_meta_box('avhecBoxOptions', __('Options', 'avh-ec'), array(&$this, 'metaboxOptions'), $this->hooks['menu_general'], 'normal', 'core');
282
-
283
- add_filter('screen_layout_columns', array(&$this, 'filterScreenLayoutColumns'), 10, 2);
284
-
 
 
 
 
285
  // WordPress core Scripts
286
  wp_enqueue_script('common');
287
  wp_enqueue_script('wp-lists');
288
  wp_enqueue_script('postbox');
289
-
290
  // WordPress core Styles
291
  wp_admin_css('css/dashboard');
292
-
293
  // Plugin Style and Scripts
294
  wp_enqueue_style('avhec-admin-css');
295
-
296
  }
297
 
298
  /**
@@ -303,24 +313,24 @@ class AVH_EC_Admin
303
  function doMenuGeneral ()
304
  {
305
  global $screen_layout_columns;
306
-
307
  $groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
308
  foreach ($groups as $group) {
309
  $group_id[] = $group->term_id;
310
  $groupname[] = $group->name;
311
  }
312
-
313
  $options_general[] = array('avhec[general][alternative_name_select_category]', __('<em>Select Category</em> Alternative', 'avh-ec'), 'text', 20, __('Alternative text for Select Category.', 'avh-ec'));
314
  $options_general[] = array('avhec[cat_group][home_group]', 'Home Group', 'dropdown', $group_id, $groupname, __('Select which group to show on the home page.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
315
  $options_general[] = array('avhec[cat_group][no_group]', 'Nonexistence Group', 'dropdown', $group_id, $groupname, __('Select which group to show when there is no group associated with the post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
316
  $options_general[] = array('avhec[cat_group][default_group]', 'Default Group', 'dropdown', $group_id, $groupname, __('Select which group will be the default group when editing a post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
317
-
318
  if (isset($_POST['updateoptions'])) {
319
  check_admin_referer('avh_ec_generaloptions');
320
-
321
  $formoptions = $_POST['avhec'];
322
  $options = $this->core->getOptions();
323
-
324
  //$all_data = array_merge( $options_general );
325
  $all_data = $options_general;
326
  foreach ($all_data as $option) {
@@ -328,7 +338,7 @@ class AVH_EC_Admin
328
  $section = substr($section, 0, strpos($section, ']['));
329
  $option_key = rtrim($option[0], ']');
330
  $option_key = substr($option_key, strpos($option_key, '][') + 2);
331
-
332
  switch ($section) {
333
  case 'general':
334
  case 'cat_group':
@@ -349,17 +359,17 @@ class AVH_EC_Admin
349
  $this->core->saveOptions($options);
350
  $this->message = __('Options saved', 'avh-ec');
351
  $this->status = 'updated fade';
352
-
353
  }
354
  $this->displayMessage();
355
-
356
  $actual_options = $this->core->getOptions();
357
  foreach ($actual_options['cat_group'] as $key => $value) {
358
  if (! (in_array($value, (array) $group_id))) {
359
  $actual_options['cat_group'][$key] = $this->catgrp->getTermIDBy('slug', 'none');
360
  }
361
  }
362
-
363
  $hide2 = '';
364
  switch ($screen_layout_columns) {
365
  case 2:
@@ -371,10 +381,10 @@ class AVH_EC_Admin
371
  }
372
  $data['options_general'] = $options_general;
373
  $data['actual_options'] = $actual_options;
374
-
375
  // This box can't be unselectd in the the Screen Options
376
  add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_general'], 'side', 'core');
377
-
378
  $hide2 = '';
379
  switch ($screen_layout_columns) {
380
  case 2:
@@ -384,13 +394,13 @@ class AVH_EC_Admin
384
  $width = 'width:98%;';
385
  $hide2 = 'display:none;';
386
  }
387
-
388
  echo '<div class="wrap avhec-metabox-wrap">';
389
  echo $this->displayIcon('index');
390
  echo '<h2>' . 'AVH Extended Categories - ' . __('General Options', 'avh-ec') . '</h2>';
391
  echo '<form name="avhec-generaloptions" id="avhec-generaloptions" method="POST" action="' . admin_url('admin.php?page=avhec-general') . '" accept-charset="utf-8" >';
392
  wp_nonce_field('avh_ec_generaloptions');
393
-
394
  echo ' <div id="dashboard-widgets-wrap">';
395
  echo ' <div id="dashboard-widgets" class="metabox-holder">';
396
  echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
@@ -400,14 +410,14 @@ class AVH_EC_Admin
400
  do_meta_boxes($this->hooks['menu_general'], 'side', $data);
401
  echo ' </div>';
402
  echo ' </div>';
403
-
404
  echo '<br class="clear"/>';
405
  echo ' </div>'; //dashboard-widgets-wrap
406
  echo '<p class="submit"><input class="button" type="submit" name="updateoptions" value="' . __('Save Changes', 'avhf-ec') . '" /></p>';
407
  echo '</form>';
408
-
409
  echo '</div>'; // wrap
410
-
411
 
412
  $this->printMetaboxGeneralNonces();
413
  $this->printMetaboxJS('general');
@@ -429,27 +439,32 @@ class AVH_EC_Admin
429
  */
430
  function actionLoadPageHook_CategoryGroup ()
431
  {
432
-
433
  // Add metaboxes
434
  add_meta_box('avhecBoxCategoryGroupAdd', __('Add Group', 'avh-ec'), array(&$this, 'metaboxCategoryGroupAdd'), $this->hooks['menu_category_groups'], 'normal', 'core');
435
  add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(&$this, 'metaboxCategoryGroupList'), $this->hooks['menu_category_groups'], 'side', 'core');
436
  add_meta_box('avhecBoxCategoryGroupSpecialPages', __('Special Pages', 'avh-ec'), array(&$this, 'metaboxCategoryGroupSpecialPages'), $this->hooks['menu_category_groups'], 'normal', 'core');
437
-
438
- add_filter('screen_layout_columns', array(&$this, 'filterScreenLayoutColumns'), 10, 2);
 
 
 
 
 
439
  // WordPress core Scripts
440
  wp_enqueue_script('common');
441
  wp_enqueue_script('wp-lists');
442
  wp_enqueue_script('postbox');
443
-
444
  // Plugin Scripts
445
  wp_enqueue_script('avhec-categorygroup-js');
446
-
447
  // WordPress core Styles
448
  wp_admin_css('css/dashboard');
449
-
450
  // Plugin Style
451
  wp_enqueue_style('avhec-admin-css');
452
-
453
  }
454
 
455
  /**
@@ -460,31 +475,31 @@ class AVH_EC_Admin
460
  function doMenuCategoryGroup ()
461
  {
462
  global $screen_layout_columns;
463
-
464
  $data_add_group_default = array('name'=>'', 'slug'=>'', 'widget_title'=>'', 'description'=>'');
465
  $data_add_group_new = $data_add_group_default;
466
-
467
- $options_add_group[] = array('avhec_add_group[add][name]', __(' Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec'));
468
- $options_add_group[] = array('avhec_add_group[add][slug]', __(' Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec'));
469
- $options_add_group[] = array('avhec_add_group[add][widget_title]', __(' Widget Title,', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec'));
470
- $options_add_group[] = array('avhec_add_group[add][description]', __(' Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5);
471
-
472
- $options_edit_group[] = array('avhec_edit_group[edit][name]', __(' Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec'));
473
- $options_edit_group[] = array('avhec_edit_group[edit][slug]', __(' Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec'));
474
- $options_edit_group[] = array('avhec_edit_group[edit][widget_title]', __(' Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec'));
475
- $options_edit_group[] = array('avhec_edit_group[edit][description]', __(' Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5);
476
- $options_edit_group[] = array('avhec_edit_group[edit][categories]', __(' Categories', 'avh-ec'), 'catlist', 0, __('Select categories to be included in the group.', 'avh-ec'));
477
-
478
  if (isset($_POST['addgroup'])) {
479
  check_admin_referer('avh_ec_addgroup');
480
-
481
  $formoptions = $_POST['avhec_add_group'];
482
-
483
  $data_add_group_new['name'] = $formoptions['add']['name'];
484
  $data_add_group_new['slug'] = empty($formoptions['add']['slug']) ? sanitize_title($data_add_group_new['name']) : sanitize_title($formoptions['add']['slug']);
485
  $data_add_group_new['widget_title'] = $formoptions['add']['widget_title'];
486
  $data_add_group_new['description'] = $formoptions['add']['description'];
487
-
488
  $id = $this->catgrp->getTermIDBy('slug', $data_add_group_new['slug']);
489
  if (! $id) {
490
  $group_id = $this->catgrp->doInsertGroup($data_add_group_new['name'], array('description'=>$data_add_group_new['description'], 'slug'=>$data_add_group_new['slug']), $data_add_group_new['widget_title']);
@@ -492,32 +507,32 @@ class AVH_EC_Admin
492
  $this->message = __('Category group saved', 'avh-ec');
493
  $this->status = 'updated fade';
494
  $data_add_group_new = $data_add_group_default;
495
-
496
  } else {
497
  $group = $this->catgrp->getGroup($id);
498
  $this->message = __('Category group conflicts with ', 'avh-ec') . $group->name;
499
  $this->message .= '<br />' . __('Same slug is used. ', 'avh-ec');
500
  $this->status = 'error';
501
-
502
  }
503
  $this->displayMessage();
504
  }
505
  $data_add_group['add'] = $data_add_group_new;
506
  $data['add'] = array('form'=>$options_add_group, 'data'=>$data_add_group);
507
-
508
  if (isset($_GET['action'])) {
509
  $action = $_GET['action'];
510
-
511
  switch ($action) {
512
  case 'edit':
513
  $group_id = (int) $_GET['group_ID'];
514
  $group = $this->catgrp->getGroup($group_id);
515
  $widget_title = $this->catgrp->getWidgetTitleForGroup($group_id);
516
  $cats = $this->catgrp->getCategoriesFromGroup($group_id);
517
-
518
  $data_edit_group['edit'] = array('group_id'=>$group_id, 'name'=>$group->name, 'slug'=>$group->slug, 'widget_title'=>$widget_title, 'description'=>$group->description, 'categories'=>$cats);
519
  $data['edit'] = array('form'=>$options_edit_group, 'data'=>$data_edit_group);
520
-
521
  add_meta_box('avhecBoxCategoryGroupEdit', __('Edit Group', 'avh-ec') . ': ' . $group->name, array(&$this, 'metaboxCategoryGroupEdit'), $this->hooks['menu_category_groups'], 'normal', 'low');
522
  break;
523
  case 'delete':
@@ -525,10 +540,10 @@ class AVH_EC_Admin
525
  wp_redirect($this->getBackLink());
526
  exit();
527
  }
528
-
529
  $group_id = (int) $_GET['group_ID'];
530
  check_admin_referer('delete-avhecgroup_' . $group_id);
531
-
532
  if (! current_user_can('manage_categories')) {
533
  wp_die(__('Cheatin&#8217; uh?'));
534
  }
@@ -539,13 +554,13 @@ class AVH_EC_Admin
539
  break;
540
  }
541
  }
542
-
543
  if (isset($_POST['editgroup'])) {
544
  check_admin_referer('avh_ec_editgroup');
545
-
546
  $formoptions = $_POST['avhec_edit_group'];
547
  $selected_categories = $_POST['post_category'];
548
-
549
  $group_id = (int) $_POST['avhec-group_id'];
550
  $result = $this->catgrp->doUpdateGroup($group_id, array('name'=>$formoptions['edit']['name'], 'slug'=>$formoptions['edit']['slug'], 'description'=>$formoptions['edit']['description']), $selected_categories, $formoptions['edit']['widget_title']);
551
  switch ($result) {
@@ -565,7 +580,7 @@ class AVH_EC_Admin
565
  }
566
  $this->displayMessage();
567
  }
568
-
569
  $hide2 = '';
570
  switch ($screen_layout_columns) {
571
  case 2:
@@ -575,12 +590,12 @@ class AVH_EC_Admin
575
  $width = 'width:98%;';
576
  $hide2 = 'display:none;';
577
  }
578
-
579
  $data_special_pages_old = $this->core->options['sp_cat_group'];
580
  $data_special_pages_new = $data_special_pages_old;
581
  if (isset($_POST['avhec_special_pages'])) {
582
  check_admin_referer('avh_ec_specialpagesgroup');
583
-
584
  $formoptions = $_POST['avhec_special_pages'];
585
  $formdata = $formoptions['sp'];
586
  foreach ($formdata as $key => $value) {
@@ -588,11 +603,11 @@ class AVH_EC_Admin
588
  }
589
  $this->core->options['sp_cat_group'] = $data_special_pages_new;
590
  $this->core->saveOptions($this->core->options);
591
-
592
  }
593
  $data_special_pages['sp'] = $data_special_pages_new;
594
  $cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
595
-
596
  foreach ($cat_groups as $group) {
597
  $temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
598
  $dropdown_value[] = $group->term_id;
@@ -605,33 +620,33 @@ class AVH_EC_Admin
605
  $options_special_pages[] = array('avhec_special_pages[sp][year_group]', __('Yearly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('yearly archive','avhec')));
606
  $options_special_pages[] = array('avhec_special_pages[sp][author_group]', __('Author Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('author archive','avhec')));
607
  $options_special_pages[] = array('avhec_special_pages[sp][search_group]', __('Search Page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('search','avhec')));
608
-
609
  $data['sp'] = array('form'=>$options_special_pages, 'data'=>$data_special_pages);
610
-
611
  // This box can't be unselectd in the the Screen Options
612
  //add_meta_box( 'avhecBoxDonations', __( 'Donations', 'avh-ec' ), array (&$this, 'metaboxDonations' ), $this->hooks['menu_category_groups'], 'side', 'core' );
613
-
614
 
615
  echo '<div class="wrap avhec-metabox-wrap">';
616
  echo $this->displayIcon('index');
617
  echo '<h2>' . 'AVH Extended Categories - ' . __('Category Groups', 'avh-ec') . '</h2>';
618
-
619
  echo ' <div id="dashboard-widgets-wrap">';
620
  echo ' <div id="dashboard-widgets" class="metabox-holder">';
621
-
622
  echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
623
  do_meta_boxes($this->hooks['menu_category_groups'], 'normal', $data);
624
  echo " </div>";
625
-
626
  echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
627
  do_meta_boxes($this->hooks['menu_category_groups'], 'side', $data);
628
  echo ' </div>';
629
-
630
  echo ' </div>'; // dashboard-widgets
631
  echo '<br class="clear" />';
632
  echo ' </div>'; //dashboard-widgets-wrap
633
  echo '</div>'; // wrap
634
-
635
 
636
  $this->printMetaboxGeneralNonces();
637
  $this->printMetaboxJS('grouped');
@@ -659,30 +674,30 @@ class AVH_EC_Admin
659
  function metaboxCategoryGroupList ($data)
660
  {
661
  echo '<form id="posts-filter" action="" method="get">';
662
-
663
  echo '<div class="clear"></div>';
664
-
665
  echo '<table class="widefat fixed" cellspacing="0">';
666
  echo '<thead>';
667
  echo '<tr>';
668
  print_column_headers('categories_group');
669
  echo '</tr>';
670
  echo '</thead>';
671
-
672
  echo '<tfoot>';
673
  echo '<tr>';
674
  print_column_headers('categories_group', false);
675
  echo '</tr>';
676
  echo '</tfoot>';
677
-
678
  echo '<tbody id="the-list" class="list:group">';
679
  $this->printCategoryGroupRows();
680
  echo '</tbody>';
681
  echo '</table>';
682
-
683
  echo '<br class="clear" />';
684
  echo '</form>';
685
-
686
  //echo '</div>';
687
  }
688
 
@@ -713,29 +728,198 @@ class AVH_EC_Admin
713
  echo '</form>';
714
  }
715
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
716
  /**
717
  * Setup everything needed for the FAQ page
718
  *
719
  */
720
  function actionLoadPageHook_faq ()
721
  {
722
-
723
  add_meta_box('avhecBoxFAQ', __('F.A.Q.', 'avh-ec'), array(&$this, 'metaboxFAQ'), $this->hooks['menu_faq'], 'normal', 'core');
724
  add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(&$this, 'metaboxTranslation'), $this->hooks['menu_faq'], 'normal', 'core');
725
-
726
- add_filter('screen_layout_columns', array(&$this, 'filterScreenLayoutColumns'), 10, 2);
727
-
 
 
 
 
728
  // WordPress core Styles and Scripts
729
  wp_enqueue_script('common');
730
  wp_enqueue_script('wp-lists');
731
  wp_enqueue_script('postbox');
732
-
733
  // WordPress core Styles
734
  wp_admin_css('css/dashboard');
735
-
736
  // Plugin Style
737
  wp_enqueue_style('avhec-admin-css');
738
-
739
  }
740
 
741
  /**
@@ -746,11 +930,11 @@ class AVH_EC_Admin
746
  function doMenuFAQ ()
747
  {
748
  global $screen_layout_columns;
749
-
750
  // This box can't be unselectd in the the Screen Options
751
  add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array(&$this, 'metaboxAnnouncements'), $this->hooks['menu_faq'], 'side', 'core');
752
  add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_faq'], 'side', 'core');
753
-
754
  $hide2 = '';
755
  switch ($screen_layout_columns) {
756
  case 2:
@@ -760,7 +944,7 @@ class AVH_EC_Admin
760
  $width = 'width:98%;';
761
  $hide2 = 'display:none;';
762
  }
763
-
764
  echo '<div class="wrap avhec-metabox-wrap">';
765
  echo $this->displayIcon('index');
766
  echo '<h2>' . 'AVH Extended Categories - ' . __('F.A.Q', 'avh-ec') . '</h2>';
@@ -776,7 +960,7 @@ class AVH_EC_Admin
776
  echo '<br class="clear"/>';
777
  echo ' </div>'; //dashboard-widgets-wrap
778
  echo '</div>'; // wrap
779
-
780
 
781
  $this->printMetaboxGeneralNonces();
782
  $this->printMetaboxJS('faq');
@@ -800,12 +984,12 @@ class AVH_EC_Admin
800
  $available_locale['es_ES'] = array('Spanish - Español',0);
801
  $available_locale['sv_SE'] = array('Swedish - Svenska',0);
802
  $available_locale['tr'] = array('Turkish - Türkçe',0);
803
-
804
  echo '<div class="p">';
805
  echo __('This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language.', 'avh-ec') . '<br />';
806
 
807
  echo '</div>';
808
-
809
  echo '<div class="p">';
810
  echo '<span class="b">' . __('Available Languages', 'avh-ec') . '</span>';
811
  echo '<ul>';
@@ -817,7 +1001,7 @@ class AVH_EC_Admin
817
  }
818
  echo '</ul>';
819
  echo '</div>';
820
-
821
  echo '<div class="p">';
822
  if ('en_US' != $locale & (!array_key_exists($locale, $available_locale))){
823
  echo 'Currently the plugin is not available in your language ('.$locale.'). Why not help out and translate the plugin in your language. You can help by visiting <a href="https://translations.launchpad.net/avhextendedcategories/trunk" target="_blank">Launchpad</a>.';
@@ -825,7 +1009,7 @@ class AVH_EC_Admin
825
  echo __('You can visit ', 'avh-ec') . '<a href="https://translations.launchpad.net/avhextendedcategories/trunk" target="_blank">Launchpad</a> ' . __('to help complete these translations or add a new language.', 'avh-ec');
826
  }
827
  echo '</div>';
828
-
829
  }
830
 
831
  /**
@@ -837,24 +1021,24 @@ class AVH_EC_Admin
837
  echo '<div class="p">';
838
  echo __('If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation.', 'avh-ec');
839
  echo '</div>';
840
-
841
  echo '<div class="p">';
842
  echo '<span class="b">Amazon</span><br />';
843
  echo __('If you decide to buy something from Amazon click the button.', 'avh-ec') . '</span><br />';
844
- echo '<a href="https://www.amazon.com/?&tag=avh-donation-20" target="_blank" title="Amazon Homepage"><img alt="Amazon Button" src="' . $this->core->info['graphics_url'] . '/us_banner_logow_120x60.gif" /></a>';
845
  echo '</div>';
846
-
847
  echo '<div class="p">';
848
- echo __('You can send me something from my ', 'avh-ec') . '<a href="http://www.amazon.com/gp/registry/wishlist/1U3DTWZ72PI7W?tag=avh-donation-20">' . __('Amazon Wish List', 'avh-ec') . '</a>';
849
  echo '</div>';
850
-
851
  echo '<div class="p">';
852
  echo '<span class="b">' . __('Through Paypal.', 'avh-ec') . '</span><br />';
853
  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.', 'avh-ec') . '<br />';
854
  echo '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=S85FXJ9EBHAF2&lc=US&item_name=AVH%20Plugins&item_number=fdas&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank" title="Donate">';
855
  echo '<img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donate"/></a>';
856
  echo '</div>';
857
-
858
  }
859
 
860
  /***
@@ -867,14 +1051,14 @@ class AVH_EC_Admin
867
  echo '<span class="b">' . __('What about support?', 'avh-ec') . '</span><br />';
868
  echo __('I created a support site at http://forums.avirtualhome.com where you can ask questions or request features.', 'avh-ec') . '<br />';
869
  echo '</div>';
870
-
871
  echo '<div class="p">';
872
  echo '<span class="b">' . __('What is depth selection?', 'avh-ec') . '</span><br />';
873
  echo __('Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well.', 'avh-ec') . '<br /><br />';
874
  echo __('Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:', 'avh-ec') . '<br />';
875
  echo __('You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only.', 'avh-ec') . '<br />';
876
  echo '</div>';
877
-
878
  echo '<div class="p">';
879
  echo '<span class="b">' . __('Multiple Category Groups', 'avh-ec') . '</span><br />';
880
  echo __('The following is an explanation how assigning multiple groups to page/post works.', 'avh-ec') . '<br /><br />';
@@ -928,7 +1112,7 @@ class AVH_EC_Admin
928
  echo __('I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price.', 'avh-ec');
929
  }
930
  echo '</div>';
931
-
932
  }
933
 
934
  /**
@@ -938,7 +1122,7 @@ class AVH_EC_Admin
938
  * @param $screen
939
  * @return strings
940
  */
941
-
942
  function filterScreenLayoutColumns ($columns, $screen)
943
  {
944
  switch ($screen) {
@@ -954,7 +1138,7 @@ class AVH_EC_Admin
954
  case $this->hooks['menu_faq']:
955
  $columns[$this->hooks['menu_faq']] = 2;
956
  break;
957
-
958
  }
959
  return $columns;
960
  }
@@ -970,7 +1154,7 @@ class AVH_EC_Admin
970
  $settings_link = '<a href="admin.php?page=extended-categories-widget">' . __('Settings', 'avh-ec') . '</a>';
971
  array_unshift($links, $settings_link); // before other links
972
  return $links;
973
-
974
  }
975
 
976
  /**
@@ -998,13 +1182,13 @@ class AVH_EC_Admin
998
  function filterExplainNonceDeleteGroup ($text, $group_id)
999
  {
1000
  $group = get_term($group_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
1001
-
1002
  $return = sprintf(__('Your attempt to delete this group: &#8220;%s&#8221; has failed.'), $group->name);
1003
  return ($return);
1004
  }
1005
 
1006
  ############## Admin WP Helper ##############
1007
-
1008
 
1009
  /**
1010
  * Get the backlink for forms
@@ -1017,7 +1201,7 @@ class AVH_EC_Admin
1017
  if (isset($_GET['page']) && ! empty($_GET['page'])) {
1018
  $page = preg_replace('[^a-zA-Z0-9\.\_\-]', '', $_GET['page']);
1019
  }
1020
-
1021
  if (function_exists("admin_url"))
1022
  return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
1023
  else
@@ -1033,7 +1217,7 @@ class AVH_EC_Admin
1033
  function printCategoryGroupRows ()
1034
  {
1035
  $cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
1036
-
1037
  foreach ($cat_groups as $group) {
1038
  if ('none' != $group->slug) {
1039
  echo $this->printCategoryGroupRow($group->term_id, $group->term_taxonomy_id);
@@ -1051,18 +1235,18 @@ class AVH_EC_Admin
1051
  function printCategoryGroupRow ($group_term_id, $group_term_taxonomy_id)
1052
  {
1053
  static $row_class = '';
1054
-
1055
  $group = get_term($group_term_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
1056
-
1057
  $no_edit[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
1058
  $no_delete[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
1059
-
1060
  if (current_user_can('manage_categories')) {
1061
  $actions = array();
1062
  if (! array_key_exists($group->term_id, $no_edit)) {
1063
  $edit_link = "admin.php?page=avhec-grouped&amp;action=edit&amp;group_ID=$group->term_id";
1064
  $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $group->name)) . "'>" . esc_attr($group->name) . '</a><br />';
1065
-
1066
  $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
1067
  } else {
1068
  $edit = esc_attr($group->name);
@@ -1082,23 +1266,23 @@ class AVH_EC_Admin
1082
  } else {
1083
  $edit = $group->name;
1084
  }
1085
-
1086
  $row_class = 'alternate' == $row_class ? '' : 'alternate';
1087
  $qe_data = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
1088
-
1089
  $output = "<tr id='group-$group->term_id' class='iedit $row_class'>";
1090
-
1091
  $columns = get_column_headers('categories_group');
1092
  $hidden = get_hidden_columns('categories_group');
1093
  foreach ($columns as $column_name => $column_display_name) {
1094
  $class = 'class="' . $column_name . ' column-' . $column_name . '"';
1095
-
1096
  $style = '';
1097
  if (in_array($column_name, $hidden))
1098
  $style = ' style="display:none;"';
1099
-
1100
  $attributes = $class . $style;
1101
-
1102
  switch ($column_name) {
1103
  case 'cb':
1104
  $output .= '<th scope="row" class="check-column">';
@@ -1120,7 +1304,7 @@ class AVH_EC_Admin
1120
  $title = $this->catgrp->getWidgetTitleForGroup($group->term_id);
1121
  $output .= '<td ' . $attributes . '>' . $title . '</td>';
1122
  break;
1123
-
1124
  case 'description':
1125
  $output .= '<td ' . $attributes . '>' . $qe_data->description . '</td>';
1126
  break;
@@ -1137,11 +1321,11 @@ class AVH_EC_Admin
1137
  $cat = implode(', ', $catname);
1138
  $output .= '<td ' . $attributes . '>' . $cat . '</td>';
1139
  break;
1140
-
1141
  }
1142
  }
1143
  $output .= '</tr>';
1144
-
1145
  return $output;
1146
  }
1147
 
@@ -1156,7 +1340,7 @@ class AVH_EC_Admin
1156
  wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1157
  echo '</p>';
1158
  echo '</form>';
1159
-
1160
  }
1161
 
1162
  /**
@@ -1176,7 +1360,7 @@ class AVH_EC_Admin
1176
  echo ' });' . "\n";
1177
  echo ' //]]>' . "\n";
1178
  echo '</script>';
1179
-
1180
  }
1181
 
1182
  /**
@@ -1186,7 +1370,7 @@ class AVH_EC_Admin
1186
  function printAdminFooter ()
1187
  {
1188
  echo '<p class="footer_avhec">';
1189
- printf('&copy; Copyright 2011 <a href="http://blog.avirtualhome.com/" title="My Thoughts">Peter van der Does</a> | AVH Extended Categories Version %s', $this->core->version);
1190
  echo '</p>';
1191
  }
1192
 
@@ -1314,7 +1498,7 @@ class AVH_EC_Admin
1314
  {
1315
  $group_id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
1316
  check_ajax_referer('delete-avhecgroup_' . $group_id);
1317
-
1318
  if (! current_user_can('manage_categories')) {
1319
  die('-1');
1320
  }
@@ -1322,7 +1506,7 @@ class AVH_EC_Admin
1322
  if (false === $check) {
1323
  die('1');
1324
  }
1325
-
1326
  if ($this->catgrp->doDeleteGroup($group_id)) {
1327
  die('1');
1328
  } else {
7
  * @var AVH_EC_Core
8
  */
9
  var $core;
10
+
11
  /**
12
  *
13
  * @var AVH_EC_Category_Group
14
  */
15
  var $catgrp;
16
+
17
  var $hooks = array();
18
  var $message;
19
 
23
  */
24
  function __construct ()
25
  {
26
+
27
  // Initialize the plugin
28
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
29
  $this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
30
+
31
  add_action('wp_ajax_delete-group', array(&$this, 'ajaxDeleteGroup'));
32
+
33
  // Admin menu
34
  add_action('admin_init', array(&$this,'actionAdminInit'));
35
  add_action('admin_menu', array(&$this, 'actionAdminMenu'));
36
  add_filter('plugin_action_links_extended-categories-widget/widget_extended_categories.php', array(&$this, 'filterPluginActions'), 10, 2);
37
+
38
  // Actions used for editing posts
39
  add_action('load-post.php', array(&$this, 'actionLoadPostPage'));
40
  add_action('load-page.php', array(&$this, 'actionLoadPostPage'));
41
+
42
  // Actions related to adding and deletes categories
43
  add_action("created_category", array($this, 'actionCreatedCategory'), 10, 2);
44
  add_action("delete_category", array($this, 'actionDeleteCategory'), 10, 2);
45
+
46
  add_filter('manage_categories_group_columns', array(&$this, 'filterManageCategoriesGroupColumns'));
47
  add_filter('explain_nonce_delete-avhecgroup', array(&$this, 'filterExplainNonceDeleteGroup'), 10, 2);
48
+
49
  return;
50
  }
51
 
65
  add_action('edit_term', array(&$this,'handleEditTerm'), 10, 3 );
66
 
67
  }
68
+
69
  /**
70
  *
71
  * Adds Category Group form
75
  * @param unknown_type $taxonomy
76
  */
77
  function displayCategoryGroupForm($term, $taxonomy){
78
+
79
  $current_selection = '';
80
  $tax_meta = get_option($this->core->db_options_tax_meta);
81
  if ( isset($tax_meta[$taxonomy][$term->term_id]) ) {
82
  $tax_meta = $tax_meta[$taxonomy][$term->term_id];
83
  $current_selection = $tax_meta['category_group_term_id'];
84
  }
85
+
86
  if (empty($current_selection)) {
87
  $current_group = $this->catgrp->getGroupByCategoryID($term->term_id);
88
  $current_selection= $current_group->term_id;
89
  }
90
+
91
  $cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
92
  foreach ($cat_groups as $group) {
93
  $temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
94
  $dropdown_value[] = $group->term_id;
95
  $dropdown_text[] = $temp_cat->name;
96
  }
97
+
98
  foreach ( $dropdown_value as $key => $sel) {
99
  $seldata .= '<option value="' . esc_attr($sel) . '" ' . (($current_selection == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($dropdown_text[$key])) . '</option>' . "\n";
100
  }
101
+
102
  echo '<h3>AVH Extended Categories - Category Group Widget</h3>';
103
  echo '<table class="form-table"><tbody>';
104
  echo '<tr class="form-field">';
113
  echo '</tr>';
114
  echo '</tbody></table>';
115
  }
116
+
117
  /**
118
  * Saves the association Category - Category Group fron the edit taxonomy page
119
  * @WordPress action edit_form.
129
  update_option($this->core->db_options_tax_meta, $tax_meta);
130
  }
131
  }
132
+
133
  /**
134
  * When a category is created this function is called to add the new category to the group all
135
  * @param $term_id
170
  */
171
  function actionAdminMenu ()
172
  {
173
+
174
  // Register Style and Scripts
175
+ $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.closure';
176
  wp_register_script('avhec-categorygroup-js', AVHEC_PLUGIN_URL . '/js/avh-ec.categorygroup' . $suffix . '.js', array('jquery'), $this->core->version, true);
177
+ wp_register_script('avhec-manualorder', AVHEC_PLUGIN_URL . '/js/avh-ec.admin.manualorder' . $suffix . '.js', array ( 'jquery-ui-sortable' ), $this->core->version, false);
178
  wp_register_style('avhec-admin-css', AVHEC_PLUGIN_URL . '/css/avh-ec.admin.css', array('wp-admin'), $this->core->version, 'screen');
179
+
180
  // Add menu system
181
  $folder = $this->core->getBaseDirectory(AVHEC_PLUGIN_DIR);
182
  add_menu_page('AVH Extended Categories', 'AVH Extended Categories', 'manage_options', $folder, array(&$this, 'doMenuOverview'));
183
  $this->hooks['menu_overview'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Overview', 'avh-ec'), __('Overview', 'avh-ec'), 'manage_options', $folder, array(&$this, 'doMenuOverview'));
184
  $this->hooks['menu_general'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('General Options', 'avh-ec'), __('General Options', 'avh-ec'), 'manage_options', 'avhec-general', array(&$this, 'doMenuGeneral'));
185
  $this->hooks['menu_category_groups'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Category Groups', 'avh-ec'), __('Category Groups', 'avh-ec'), 'manage_options', 'avhec-grouped', array(&$this, 'doMenuCategoryGroup'));
186
+ $this->hooks['menu_manual_order'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Manually Order', 'avh-ec'), __('Manually Order', 'avh-ec'), 'manage_options', 'avhec-manual-order', array(&$this, 'doMenuManualOrder'));
187
  $this->hooks['menu_faq'] = add_submenu_page($folder, 'AVH Extended Categories:' . __('F.A.Q', 'avh-ec'), __('F.A.Q', 'avh-ec'), 'manage_options', 'avhec-faq', array(&$this, 'doMenuFAQ'));
188
+
189
  // Add actions for menu pages
190
  // Overview Menu
191
  add_action('load-' . $this->hooks['menu_overview'], array(&$this, 'actionLoadPageHook_Overview'));
192
+
193
  // General Options Menu
194
  add_action('load-' . $this->hooks['menu_general'], array(&$this, 'actionLoadPageHook_General'));
195
+
196
  // Category Groups Menu
197
  add_action('load-' . $this->hooks['menu_category_groups'], array(&$this, 'actionLoadPageHook_CategoryGroup'));
198
+
199
  // FAQ Menu
200
  add_action('load-' . $this->hooks['menu_faq'], array(&$this, 'actionLoadPageHook_faq'));
201
  }
209
  // Add metaboxes
210
  add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(&$this, 'metaboxCategoryGroupList'), $this->hooks['menu_overview'], 'normal', 'core');
211
  add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(&$this, 'metaboxTranslation'), $this->hooks['menu_overview'], 'normal', 'core');
212
+
213
+ if (AVH_Common::getWordpressVersion() >= 3.1 ) {
214
+ add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
215
+ } else {
216
+ add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
217
+ }
218
+
219
  // WordPress core Scripts
220
  wp_enqueue_script('common');
221
  wp_enqueue_script('wp-lists');
222
  wp_enqueue_script('postbox');
223
+
224
  // Plugin Scripts
225
  wp_enqueue_script('avhec-categorygroup-js');
226
+
227
  // WordPress core Styles
228
  wp_admin_css('css/dashboard');
229
+
230
  // Plugin Style
231
  wp_enqueue_style('avhec-admin-css');
232
  }
239
  function doMenuOverview ()
240
  {
241
  global $screen_layout_columns;
242
+
243
  // This box can't be unselectd in the the Screen Options
244
  add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array(&$this, 'metaboxAnnouncements'), $this->hooks['menu_overview'], 'side', '');
245
  add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_overview'], 'side', '');
246
+
247
  $hide2 = '';
248
  switch ($screen_layout_columns) {
249
  case 2:
253
  $width = 'width:98%;';
254
  $hide2 = 'display:none;';
255
  }
256
+
257
  echo '<div class="wrap avhec-metabox-wrap">';
258
  echo $this->displayIcon('index');
259
  echo '<h2>' . 'AVH Extended Categories - ' . __('Overview', 'avh-ec') . '</h2>';
266
  do_meta_boxes($this->hooks['menu_overview'], 'side', '');
267
  echo ' </div>';
268
  echo ' </div>';
269
+
270
  echo '<br class="clear"/>';
271
  echo ' </div>'; //dashboard-widgets-wrap
272
  echo '</div>'; // wrap
273
+
274
 
275
  $this->printMetaboxGeneralNonces();
276
  $this->printMetaboxJS('overview');
285
  {
286
  // Add metaboxes
287
  add_meta_box('avhecBoxOptions', __('Options', 'avh-ec'), array(&$this, 'metaboxOptions'), $this->hooks['menu_general'], 'normal', 'core');
288
+
289
+ if (AVH_Common::getWordpressVersion() >= 3.1 ) {
290
+ add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
291
+ } else {
292
+ add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
293
+ }
294
+
295
  // WordPress core Scripts
296
  wp_enqueue_script('common');
297
  wp_enqueue_script('wp-lists');
298
  wp_enqueue_script('postbox');
299
+
300
  // WordPress core Styles
301
  wp_admin_css('css/dashboard');
302
+
303
  // Plugin Style and Scripts
304
  wp_enqueue_style('avhec-admin-css');
305
+
306
  }
307
 
308
  /**
313
  function doMenuGeneral ()
314
  {
315
  global $screen_layout_columns;
316
+
317
  $groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
318
  foreach ($groups as $group) {
319
  $group_id[] = $group->term_id;
320
  $groupname[] = $group->name;
321
  }
322
+
323
  $options_general[] = array('avhec[general][alternative_name_select_category]', __('<em>Select Category</em> Alternative', 'avh-ec'), 'text', 20, __('Alternative text for Select Category.', 'avh-ec'));
324
  $options_general[] = array('avhec[cat_group][home_group]', 'Home Group', 'dropdown', $group_id, $groupname, __('Select which group to show on the home page.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
325
  $options_general[] = array('avhec[cat_group][no_group]', 'Nonexistence Group', 'dropdown', $group_id, $groupname, __('Select which group to show when there is no group associated with the post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
326
  $options_general[] = array('avhec[cat_group][default_group]', 'Default Group', 'dropdown', $group_id, $groupname, __('Select which group will be the default group when editing a post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
327
+
328
  if (isset($_POST['updateoptions'])) {
329
  check_admin_referer('avh_ec_generaloptions');
330
+
331
  $formoptions = $_POST['avhec'];
332
  $options = $this->core->getOptions();
333
+
334
  //$all_data = array_merge( $options_general );
335
  $all_data = $options_general;
336
  foreach ($all_data as $option) {
338
  $section = substr($section, 0, strpos($section, ']['));
339
  $option_key = rtrim($option[0], ']');
340
  $option_key = substr($option_key, strpos($option_key, '][') + 2);
341
+
342
  switch ($section) {
343
  case 'general':
344
  case 'cat_group':
359
  $this->core->saveOptions($options);
360
  $this->message = __('Options saved', 'avh-ec');
361
  $this->status = 'updated fade';
362
+
363
  }
364
  $this->displayMessage();
365
+
366
  $actual_options = $this->core->getOptions();
367
  foreach ($actual_options['cat_group'] as $key => $value) {
368
  if (! (in_array($value, (array) $group_id))) {
369
  $actual_options['cat_group'][$key] = $this->catgrp->getTermIDBy('slug', 'none');
370
  }
371
  }
372
+
373
  $hide2 = '';
374
  switch ($screen_layout_columns) {
375
  case 2:
381
  }
382
  $data['options_general'] = $options_general;
383
  $data['actual_options'] = $actual_options;
384
+
385
  // This box can't be unselectd in the the Screen Options
386
  add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_general'], 'side', 'core');
387
+
388
  $hide2 = '';
389
  switch ($screen_layout_columns) {
390
  case 2:
394
  $width = 'width:98%;';
395
  $hide2 = 'display:none;';
396
  }
397
+
398
  echo '<div class="wrap avhec-metabox-wrap">';
399
  echo $this->displayIcon('index');
400
  echo '<h2>' . 'AVH Extended Categories - ' . __('General Options', 'avh-ec') . '</h2>';
401
  echo '<form name="avhec-generaloptions" id="avhec-generaloptions" method="POST" action="' . admin_url('admin.php?page=avhec-general') . '" accept-charset="utf-8" >';
402
  wp_nonce_field('avh_ec_generaloptions');
403
+
404
  echo ' <div id="dashboard-widgets-wrap">';
405
  echo ' <div id="dashboard-widgets" class="metabox-holder">';
406
  echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
410
  do_meta_boxes($this->hooks['menu_general'], 'side', $data);
411
  echo ' </div>';
412
  echo ' </div>';
413
+
414
  echo '<br class="clear"/>';
415
  echo ' </div>'; //dashboard-widgets-wrap
416
  echo '<p class="submit"><input class="button" type="submit" name="updateoptions" value="' . __('Save Changes', 'avhf-ec') . '" /></p>';
417
  echo '</form>';
418
+
419
  echo '</div>'; // wrap
420
+
421
 
422
  $this->printMetaboxGeneralNonces();
423
  $this->printMetaboxJS('general');
439
  */
440
  function actionLoadPageHook_CategoryGroup ()
441
  {
442
+
443
  // Add metaboxes
444
  add_meta_box('avhecBoxCategoryGroupAdd', __('Add Group', 'avh-ec'), array(&$this, 'metaboxCategoryGroupAdd'), $this->hooks['menu_category_groups'], 'normal', 'core');
445
  add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(&$this, 'metaboxCategoryGroupList'), $this->hooks['menu_category_groups'], 'side', 'core');
446
  add_meta_box('avhecBoxCategoryGroupSpecialPages', __('Special Pages', 'avh-ec'), array(&$this, 'metaboxCategoryGroupSpecialPages'), $this->hooks['menu_category_groups'], 'normal', 'core');
447
+
448
+ if (AVH_Common::getWordpressVersion() >= 3.1 ) {
449
+ add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
450
+ } else {
451
+ add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
452
+ }
453
+
454
  // WordPress core Scripts
455
  wp_enqueue_script('common');
456
  wp_enqueue_script('wp-lists');
457
  wp_enqueue_script('postbox');
458
+
459
  // Plugin Scripts
460
  wp_enqueue_script('avhec-categorygroup-js');
461
+
462
  // WordPress core Styles
463
  wp_admin_css('css/dashboard');
464
+
465
  // Plugin Style
466
  wp_enqueue_style('avhec-admin-css');
467
+
468
  }
469
 
470
  /**
475
  function doMenuCategoryGroup ()
476
  {
477
  global $screen_layout_columns;
478
+
479
  $data_add_group_default = array('name'=>'', 'slug'=>'', 'widget_title'=>'', 'description'=>'');
480
  $data_add_group_new = $data_add_group_default;
481
+
482
+ $options_add_group[] = array('avhec_add_group[add][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec'));
483
+ $options_add_group[] = array('avhec_add_group[add][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec'));
484
+ $options_add_group[] = array('avhec_add_group[add][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec'));
485
+ $options_add_group[] = array('avhec_add_group[add][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5);
486
+
487
+ $options_edit_group[] = array('avhec_edit_group[edit][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec'));
488
+ $options_edit_group[] = array('avhec_edit_group[edit][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec'));
489
+ $options_edit_group[] = array('avhec_edit_group[edit][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec'));
490
+ $options_edit_group[] = array('avhec_edit_group[edit][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5);
491
+ $options_edit_group[] = array('avhec_edit_group[edit][categories]', __('Categories', 'avh-ec'), 'catlist', 0, __('Select categories to be included in the group.', 'avh-ec'));
492
+
493
  if (isset($_POST['addgroup'])) {
494
  check_admin_referer('avh_ec_addgroup');
495
+
496
  $formoptions = $_POST['avhec_add_group'];
497
+
498
  $data_add_group_new['name'] = $formoptions['add']['name'];
499
  $data_add_group_new['slug'] = empty($formoptions['add']['slug']) ? sanitize_title($data_add_group_new['name']) : sanitize_title($formoptions['add']['slug']);
500
  $data_add_group_new['widget_title'] = $formoptions['add']['widget_title'];
501
  $data_add_group_new['description'] = $formoptions['add']['description'];
502
+
503
  $id = $this->catgrp->getTermIDBy('slug', $data_add_group_new['slug']);
504
  if (! $id) {
505
  $group_id = $this->catgrp->doInsertGroup($data_add_group_new['name'], array('description'=>$data_add_group_new['description'], 'slug'=>$data_add_group_new['slug']), $data_add_group_new['widget_title']);
507
  $this->message = __('Category group saved', 'avh-ec');
508
  $this->status = 'updated fade';
509
  $data_add_group_new = $data_add_group_default;
510
+
511
  } else {
512
  $group = $this->catgrp->getGroup($id);
513
  $this->message = __('Category group conflicts with ', 'avh-ec') . $group->name;
514
  $this->message .= '<br />' . __('Same slug is used. ', 'avh-ec');
515
  $this->status = 'error';
516
+
517
  }
518
  $this->displayMessage();
519
  }
520
  $data_add_group['add'] = $data_add_group_new;
521
  $data['add'] = array('form'=>$options_add_group, 'data'=>$data_add_group);
522
+
523
  if (isset($_GET['action'])) {
524
  $action = $_GET['action'];
525
+
526
  switch ($action) {
527
  case 'edit':
528
  $group_id = (int) $_GET['group_ID'];
529
  $group = $this->catgrp->getGroup($group_id);
530
  $widget_title = $this->catgrp->getWidgetTitleForGroup($group_id);
531
  $cats = $this->catgrp->getCategoriesFromGroup($group_id);
532
+
533
  $data_edit_group['edit'] = array('group_id'=>$group_id, 'name'=>$group->name, 'slug'=>$group->slug, 'widget_title'=>$widget_title, 'description'=>$group->description, 'categories'=>$cats);
534
  $data['edit'] = array('form'=>$options_edit_group, 'data'=>$data_edit_group);
535
+
536
  add_meta_box('avhecBoxCategoryGroupEdit', __('Edit Group', 'avh-ec') . ': ' . $group->name, array(&$this, 'metaboxCategoryGroupEdit'), $this->hooks['menu_category_groups'], 'normal', 'low');
537
  break;
538
  case 'delete':
540
  wp_redirect($this->getBackLink());
541
  exit();
542
  }
543
+
544
  $group_id = (int) $_GET['group_ID'];
545
  check_admin_referer('delete-avhecgroup_' . $group_id);
546
+
547
  if (! current_user_can('manage_categories')) {
548
  wp_die(__('Cheatin&#8217; uh?'));
549
  }
554
  break;
555
  }
556
  }
557
+
558
  if (isset($_POST['editgroup'])) {
559
  check_admin_referer('avh_ec_editgroup');
560
+
561
  $formoptions = $_POST['avhec_edit_group'];
562
  $selected_categories = $_POST['post_category'];
563
+
564
  $group_id = (int) $_POST['avhec-group_id'];
565
  $result = $this->catgrp->doUpdateGroup($group_id, array('name'=>$formoptions['edit']['name'], 'slug'=>$formoptions['edit']['slug'], 'description'=>$formoptions['edit']['description']), $selected_categories, $formoptions['edit']['widget_title']);
566
  switch ($result) {
580
  }
581
  $this->displayMessage();
582
  }
583
+
584
  $hide2 = '';
585
  switch ($screen_layout_columns) {
586
  case 2:
590
  $width = 'width:98%;';
591
  $hide2 = 'display:none;';
592
  }
593
+
594
  $data_special_pages_old = $this->core->options['sp_cat_group'];
595
  $data_special_pages_new = $data_special_pages_old;
596
  if (isset($_POST['avhec_special_pages'])) {
597
  check_admin_referer('avh_ec_specialpagesgroup');
598
+
599
  $formoptions = $_POST['avhec_special_pages'];
600
  $formdata = $formoptions['sp'];
601
  foreach ($formdata as $key => $value) {
603
  }
604
  $this->core->options['sp_cat_group'] = $data_special_pages_new;
605
  $this->core->saveOptions($this->core->options);
606
+
607
  }
608
  $data_special_pages['sp'] = $data_special_pages_new;
609
  $cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
610
+
611
  foreach ($cat_groups as $group) {
612
  $temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
613
  $dropdown_value[] = $group->term_id;
620
  $options_special_pages[] = array('avhec_special_pages[sp][year_group]', __('Yearly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('yearly archive','avhec')));
621
  $options_special_pages[] = array('avhec_special_pages[sp][author_group]', __('Author Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('author archive','avhec')));
622
  $options_special_pages[] = array('avhec_special_pages[sp][search_group]', __('Search Page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('search','avhec')));
623
+
624
  $data['sp'] = array('form'=>$options_special_pages, 'data'=>$data_special_pages);
625
+
626
  // This box can't be unselectd in the the Screen Options
627
  //add_meta_box( 'avhecBoxDonations', __( 'Donations', 'avh-ec' ), array (&$this, 'metaboxDonations' ), $this->hooks['menu_category_groups'], 'side', 'core' );
628
+
629
 
630
  echo '<div class="wrap avhec-metabox-wrap">';
631
  echo $this->displayIcon('index');
632
  echo '<h2>' . 'AVH Extended Categories - ' . __('Category Groups', 'avh-ec') . '</h2>';
633
+
634
  echo ' <div id="dashboard-widgets-wrap">';
635
  echo ' <div id="dashboard-widgets" class="metabox-holder">';
636
+
637
  echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
638
  do_meta_boxes($this->hooks['menu_category_groups'], 'normal', $data);
639
  echo " </div>";
640
+
641
  echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
642
  do_meta_boxes($this->hooks['menu_category_groups'], 'side', $data);
643
  echo ' </div>';
644
+
645
  echo ' </div>'; // dashboard-widgets
646
  echo '<br class="clear" />';
647
  echo ' </div>'; //dashboard-widgets-wrap
648
  echo '</div>'; // wrap
649
+
650
 
651
  $this->printMetaboxGeneralNonces();
652
  $this->printMetaboxJS('grouped');
674
  function metaboxCategoryGroupList ($data)
675
  {
676
  echo '<form id="posts-filter" action="" method="get">';
677
+
678
  echo '<div class="clear"></div>';
679
+
680
  echo '<table class="widefat fixed" cellspacing="0">';
681
  echo '<thead>';
682
  echo '<tr>';
683
  print_column_headers('categories_group');
684
  echo '</tr>';
685
  echo '</thead>';
686
+
687
  echo '<tfoot>';
688
  echo '<tr>';
689
  print_column_headers('categories_group', false);
690
  echo '</tr>';
691
  echo '</tfoot>';
692
+
693
  echo '<tbody id="the-list" class="list:group">';
694
  $this->printCategoryGroupRows();
695
  echo '</tbody>';
696
  echo '</table>';
697
+
698
  echo '<br class="clear" />';
699
  echo '</form>';
700
+
701
  //echo '</div>';
702
  }
703
 
728
  echo '</form>';
729
  }
730
 
731
+
732
+ /**
733
+ * Setup everything needed for the Manul Order page
734
+ *
735
+ */
736
+ function actionLoadPageHook_ManualOrder ()
737
+ {
738
+
739
+ add_meta_box('avhecBoxManualOrder', __('Manually Order Categories', 'avh-ec'), array(&$this, 'metaboxManualOrder'), $this->hooks['menu_manual_order'], 'normal', 'core');
740
+
741
+
742
+ if (AVH_Common::getWordpressVersion() >= 3.1 ) {
743
+ add_screen_option('layout_columns', array('max' => 1, 'default' => 1) );
744
+ } else {
745
+ add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
746
+ }
747
+
748
+ // WordPress core Styles and Scripts
749
+ wp_enqueue_script('common');
750
+ wp_enqueue_script('wp-lists');
751
+ wp_enqueue_script('postbox');
752
+ wp_enqueue_script('jquery-ui-sortable');
753
+ wp_enqueue_script('avhec-manualorder');
754
+
755
+ // WordPress core Styles
756
+ wp_admin_css('css/dashboard');
757
+
758
+ // Plugin Style
759
+ wp_enqueue_style('avhec-admin-css');
760
+
761
+ }
762
+
763
+ /**
764
+ * Menu Page Manual Order
765
+ *
766
+ * @return none
767
+ */
768
+ function doMenuManualOrder ()
769
+ {
770
+ global $screen_layout_columns;
771
+
772
+ $hide2 = '';
773
+ switch ($screen_layout_columns) {
774
+ case 2:
775
+ $width = 'width:49%;';
776
+ break;
777
+ default:
778
+ $width = 'width:98%;';
779
+ $hide2 = 'display:none;';
780
+ }
781
+
782
+ echo '<div class="wrap">';
783
+ echo $this->displayIcon('index');
784
+ echo '<h2>' . 'AVH Extended Categories - ' . __('Manually Order Categories', 'avh-ec') . '</h2>';
785
+
786
+ echo '<div class="metabox-holder">';
787
+ echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
788
+ do_meta_boxes($this->hooks['menu_manual_order'], 'normal', '');
789
+ echo ' </div>';
790
+ echo '</div>';
791
+ echo '</div>'; // wrap
792
+ echo '<div class="clear"></div>';
793
+
794
+ $this->printMetaboxGeneralNonces();
795
+ $this->printMetaboxJS('manual_order');
796
+ $this->printAdminFooter();
797
+ }
798
+
799
+ /**
800
+ *
801
+ * @return unknown_type
802
+ */
803
+ function metaboxManualOrder ()
804
+ {
805
+ global $wpdb;
806
+
807
+ $parentID = 0;
808
+
809
+ if (isset($_POST['btnSubCats'])) {
810
+ $parentID = $_POST['cats'];
811
+ } elseif (isset($_POST['hdnParentID'])) {
812
+ $parentID = $_POST['hdnParentID'];
813
+ }
814
+
815
+ if (isset($_POST['btnReturnParent'])) {
816
+ $parentsParent = $wpdb->get_row("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = " . $_POST['hdnParentID'], ARRAY_N);
817
+ $parentID = $parentsParent[0];
818
+ }
819
+
820
+ $success = "";
821
+ if (isset($_POST['btnOrderCats'])) {
822
+ if (isset($_POST['hdnManualOrder']) && $_POST['hdnManualOrder'] != "") {
823
+
824
+ $hdnManualOrder = $_POST['hdnManualOrder'];
825
+ $IDs = explode(",", $hdnManualOrder);
826
+ $result = count($IDs);
827
+
828
+ for ($i = 0; $i < $result; $i ++) {
829
+ $str = str_replace("id_", "", $IDs[$i]);
830
+ $wpdb->query($wpdb->prepare("UPDATE $wpdb->terms SET avhec_term_order = '$i' WHERE term_id ='$str'"));
831
+ }
832
+
833
+ $success = '<div id="message" class="updated fade"><p>' . __('Categories updated successfully.', 'avh-ec') . '</p></div>';
834
+ } else {
835
+ $success = '<div id="message" class="updated fade"><p>' . __('An error occured, order has not been saved.', 'avh-ec') . '</p></div>';
836
+ }
837
+
838
+ }
839
+
840
+ $_SubCategories = "";
841
+ $results = $wpdb->get_results($wpdb->prepare("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = $parentID AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 0 ORDER BY t.avhec_term_order ASC"));
842
+ foreach ($results as $row) {
843
+ $_SubCategories .= "<option value='$row->term_id'>$row->name</option>";
844
+ }
845
+
846
+ echo '<div class="wrap">';
847
+ echo '<form name="frmMyCatOrder" method="post" action="">';
848
+ echo $success;
849
+
850
+
851
+
852
+ echo '<h4>';
853
+ _e('Order the categories', 'avh-ec');
854
+ if ($parentID == 0) {
855
+ echo ' at the Toplevel';
856
+ } else {
857
+ $_cats = get_category_parents($parentID, false, ' » ');
858
+ echo ' in the category ' . trim($_cats, ' » ');
859
+ }
860
+ echo '</h4>';
861
+ echo '<span class="description">';
862
+ _e('Order the categories on this level by dragging and dropping them into the desired order.', 'avh-ec');
863
+ echo '</span>';
864
+ echo '<ul id="avhecManualOrder">';
865
+ $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->terms t inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id WHERE taxonomy = 'category' and parent = $parentID ORDER BY avhec_term_order ASC"));
866
+ foreach ($results as $row)
867
+ echo "<li id='id_$row->term_id' class='lineitem menu-item-settings'>" . __($row->name) . "</li>";
868
+
869
+ echo '</ul>';
870
+ echo '<input type="submit" name="btnOrderCats" id="btnOrderCats" class="button-primary" value="' . __('Save Order', 'avh-ec') . '" onclick="javascript:orderCats(); return true;" />';
871
+
872
+ if ($parentID != 0) {
873
+ echo "<input type='submit' class='button' id='btnReturnParent' name='btnReturnParent' value='" . __('Return to parent category', 'avh-ec') . "' />";
874
+ }
875
+
876
+ echo '<strong id="updateText"></strong><br /><br />';
877
+ if ($_SubCategories != "") {
878
+
879
+ echo '<h4>';
880
+ _e('Select Subcategory', 'avh-ec');
881
+ echo '</h4>';
882
+ echo '<select id="cats" name="cats">';
883
+ echo $_SubCategories;
884
+
885
+ echo '</select><input type="submit" name="btnSubCats" class="button" id="btnSubCats" value="' . __('Select', 'avh-ec') . '" />';
886
+ echo '<span class="description">';
887
+ _e('Choose a category from the drop down to order the subcategories in that category.', 'avh-ec');
888
+ echo '</span>';
889
+ }
890
+
891
+ echo '<input type="hidden" id="hdnManualOrder" name="hdnManualOrder" />';
892
+ echo '<input type="hidden" id="hdnParentID" name="hdnParentID" value="' . $parentID . '" /></form>';
893
+ echo '</div>';
894
+ }
895
+
896
  /**
897
  * Setup everything needed for the FAQ page
898
  *
899
  */
900
  function actionLoadPageHook_faq ()
901
  {
902
+
903
  add_meta_box('avhecBoxFAQ', __('F.A.Q.', 'avh-ec'), array(&$this, 'metaboxFAQ'), $this->hooks['menu_faq'], 'normal', 'core');
904
  add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(&$this, 'metaboxTranslation'), $this->hooks['menu_faq'], 'normal', 'core');
905
+
906
+ if (AVH_Common::getWordpressVersion() >= 3.1 ) {
907
+ add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
908
+ } else {
909
+ add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
910
+ }
911
+
912
  // WordPress core Styles and Scripts
913
  wp_enqueue_script('common');
914
  wp_enqueue_script('wp-lists');
915
  wp_enqueue_script('postbox');
916
+
917
  // WordPress core Styles
918
  wp_admin_css('css/dashboard');
919
+
920
  // Plugin Style
921
  wp_enqueue_style('avhec-admin-css');
922
+
923
  }
924
 
925
  /**
930
  function doMenuFAQ ()
931
  {
932
  global $screen_layout_columns;
933
+
934
  // This box can't be unselectd in the the Screen Options
935
  add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array(&$this, 'metaboxAnnouncements'), $this->hooks['menu_faq'], 'side', 'core');
936
  add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_faq'], 'side', 'core');
937
+
938
  $hide2 = '';
939
  switch ($screen_layout_columns) {
940
  case 2:
944
  $width = 'width:98%;';
945
  $hide2 = 'display:none;';
946
  }
947
+
948
  echo '<div class="wrap avhec-metabox-wrap">';
949
  echo $this->displayIcon('index');
950
  echo '<h2>' . 'AVH Extended Categories - ' . __('F.A.Q', 'avh-ec') . '</h2>';
960
  echo '<br class="clear"/>';
961
  echo ' </div>'; //dashboard-widgets-wrap
962
  echo '</div>'; // wrap
963
+
964
 
965
  $this->printMetaboxGeneralNonces();
966
  $this->printMetaboxJS('faq');
984
  $available_locale['es_ES'] = array('Spanish - Español',0);
985
  $available_locale['sv_SE'] = array('Swedish - Svenska',0);
986
  $available_locale['tr'] = array('Turkish - Türkçe',0);
987
+
988
  echo '<div class="p">';
989
  echo __('This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language.', 'avh-ec') . '<br />';
990
 
991
  echo '</div>';
992
+
993
  echo '<div class="p">';
994
  echo '<span class="b">' . __('Available Languages', 'avh-ec') . '</span>';
995
  echo '<ul>';
1001
  }
1002
  echo '</ul>';
1003
  echo '</div>';
1004
+
1005
  echo '<div class="p">';
1006
  if ('en_US' != $locale & (!array_key_exists($locale, $available_locale))){
1007
  echo 'Currently the plugin is not available in your language ('.$locale.'). Why not help out and translate the plugin in your language. You can help by visiting <a href="https://translations.launchpad.net/avhextendedcategories/trunk" target="_blank">Launchpad</a>.';
1009
  echo __('You can visit ', 'avh-ec') . '<a href="https://translations.launchpad.net/avhextendedcategories/trunk" target="_blank">Launchpad</a> ' . __('to help complete these translations or add a new language.', 'avh-ec');
1010
  }
1011
  echo '</div>';
1012
+
1013
  }
1014
 
1015
  /**
1021
  echo '<div class="p">';
1022
  echo __('If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation.', 'avh-ec');
1023
  echo '</div>';
1024
+
1025
  echo '<div class="p">';
1026
  echo '<span class="b">Amazon</span><br />';
1027
  echo __('If you decide to buy something from Amazon click the button.', 'avh-ec') . '</span><br />';
1028
+ echo '<a href="https://www.amazon.com/?tag=avh-donation-20" target="_blank" title="Amazon Homepage"><img alt="Amazon Button" src="' . $this->core->info['graphics_url'] . '/us_banner_logow_120x60.gif" /></a>';
1029
  echo '</div>';
1030
+
1031
  echo '<div class="p">';
1032
+ echo __('You can send me something from my ', 'avh-ec') . '<a href="http://www.amazon.com/registry/wishlist/1U3DTWZ72PI7W?tag=avh-donation-20">' . __('Amazon Wish List', 'avh-ec') . '</a>';
1033
  echo '</div>';
1034
+
1035
  echo '<div class="p">';
1036
  echo '<span class="b">' . __('Through Paypal.', 'avh-ec') . '</span><br />';
1037
  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.', 'avh-ec') . '<br />';
1038
  echo '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=S85FXJ9EBHAF2&lc=US&item_name=AVH%20Plugins&item_number=fdas&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank" title="Donate">';
1039
  echo '<img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donate"/></a>';
1040
  echo '</div>';
1041
+
1042
  }
1043
 
1044
  /***
1051
  echo '<span class="b">' . __('What about support?', 'avh-ec') . '</span><br />';
1052
  echo __('I created a support site at http://forums.avirtualhome.com where you can ask questions or request features.', 'avh-ec') . '<br />';
1053
  echo '</div>';
1054
+
1055
  echo '<div class="p">';
1056
  echo '<span class="b">' . __('What is depth selection?', 'avh-ec') . '</span><br />';
1057
  echo __('Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well.', 'avh-ec') . '<br /><br />';
1058
  echo __('Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:', 'avh-ec') . '<br />';
1059
  echo __('You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only.', 'avh-ec') . '<br />';
1060
  echo '</div>';
1061
+
1062
  echo '<div class="p">';
1063
  echo '<span class="b">' . __('Multiple Category Groups', 'avh-ec') . '</span><br />';
1064
  echo __('The following is an explanation how assigning multiple groups to page/post works.', 'avh-ec') . '<br /><br />';
1112
  echo __('I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price.', 'avh-ec');
1113
  }
1114
  echo '</div>';
1115
+
1116
  }
1117
 
1118
  /**
1122
  * @param $screen
1123
  * @return strings
1124
  */
1125
+
1126
  function filterScreenLayoutColumns ($columns, $screen)
1127
  {
1128
  switch ($screen) {
1138
  case $this->hooks['menu_faq']:
1139
  $columns[$this->hooks['menu_faq']] = 2;
1140
  break;
1141
+
1142
  }
1143
  return $columns;
1144
  }
1154
  $settings_link = '<a href="admin.php?page=extended-categories-widget">' . __('Settings', 'avh-ec') . '</a>';
1155
  array_unshift($links, $settings_link); // before other links
1156
  return $links;
1157
+
1158
  }
1159
 
1160
  /**
1182
  function filterExplainNonceDeleteGroup ($text, $group_id)
1183
  {
1184
  $group = get_term($group_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
1185
+
1186
  $return = sprintf(__('Your attempt to delete this group: &#8220;%s&#8221; has failed.'), $group->name);
1187
  return ($return);
1188
  }
1189
 
1190
  ############## Admin WP Helper ##############
1191
+
1192
 
1193
  /**
1194
  * Get the backlink for forms
1201
  if (isset($_GET['page']) && ! empty($_GET['page'])) {
1202
  $page = preg_replace('[^a-zA-Z0-9\.\_\-]', '', $_GET['page']);
1203
  }
1204
+
1205
  if (function_exists("admin_url"))
1206
  return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
1207
  else
1217
  function printCategoryGroupRows ()
1218
  {
1219
  $cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
1220
+
1221
  foreach ($cat_groups as $group) {
1222
  if ('none' != $group->slug) {
1223
  echo $this->printCategoryGroupRow($group->term_id, $group->term_taxonomy_id);
1235
  function printCategoryGroupRow ($group_term_id, $group_term_taxonomy_id)
1236
  {
1237
  static $row_class = '';
1238
+
1239
  $group = get_term($group_term_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
1240
+
1241
  $no_edit[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
1242
  $no_delete[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
1243
+
1244
  if (current_user_can('manage_categories')) {
1245
  $actions = array();
1246
  if (! array_key_exists($group->term_id, $no_edit)) {
1247
  $edit_link = "admin.php?page=avhec-grouped&amp;action=edit&amp;group_ID=$group->term_id";
1248
  $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $group->name)) . "'>" . esc_attr($group->name) . '</a><br />';
1249
+
1250
  $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
1251
  } else {
1252
  $edit = esc_attr($group->name);
1266
  } else {
1267
  $edit = $group->name;
1268
  }
1269
+
1270
  $row_class = 'alternate' == $row_class ? '' : 'alternate';
1271
  $qe_data = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
1272
+
1273
  $output = "<tr id='group-$group->term_id' class='iedit $row_class'>";
1274
+
1275
  $columns = get_column_headers('categories_group');
1276
  $hidden = get_hidden_columns('categories_group');
1277
  foreach ($columns as $column_name => $column_display_name) {
1278
  $class = 'class="' . $column_name . ' column-' . $column_name . '"';
1279
+
1280
  $style = '';
1281
  if (in_array($column_name, $hidden))
1282
  $style = ' style="display:none;"';
1283
+
1284
  $attributes = $class . $style;
1285
+
1286
  switch ($column_name) {
1287
  case 'cb':
1288
  $output .= '<th scope="row" class="check-column">';
1304
  $title = $this->catgrp->getWidgetTitleForGroup($group->term_id);
1305
  $output .= '<td ' . $attributes . '>' . $title . '</td>';
1306
  break;
1307
+
1308
  case 'description':
1309
  $output .= '<td ' . $attributes . '>' . $qe_data->description . '</td>';
1310
  break;
1321
  $cat = implode(', ', $catname);
1322
  $output .= '<td ' . $attributes . '>' . $cat . '</td>';
1323
  break;
1324
+
1325
  }
1326
  }
1327
  $output .= '</tr>';
1328
+
1329
  return $output;
1330
  }
1331
 
1340
  wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1341
  echo '</p>';
1342
  echo '</form>';
1343
+
1344
  }
1345
 
1346
  /**
1360
  echo ' });' . "\n";
1361
  echo ' //]]>' . "\n";
1362
  echo '</script>';
1363
+
1364
  }
1365
 
1366
  /**
1370
  function printAdminFooter ()
1371
  {
1372
  echo '<p class="footer_avhec">';
1373
+ printf('&copy; Copyright %d <a href="http://blog.avirtualhome.com/" title="My Thoughts">Peter van der Does</a> | AVH Extended Categories Version %s', date('Y'), $this->core->version);
1374
  echo '</p>';
1375
  }
1376
 
1498
  {
1499
  $group_id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
1500
  check_ajax_referer('delete-avhecgroup_' . $group_id);
1501
+
1502
  if (! current_user_can('manage_categories')) {
1503
  die('-1');
1504
  }
1506
  if (false === $check) {
1507
  die('1');
1508
  }
1509
+
1510
  if ($this->catgrp->doDeleteGroup($group_id)) {
1511
  die('1');
1512
  } else {
2.8/class/avh-ec.category-group.php CHANGED
@@ -4,7 +4,6 @@
4
  * AVH Extended Categorie Category Group Class
5
  *
6
  * @author Peter van der Does
7
- * @copyright 2010
8
  */
9
  class AVH_EC_Category_Group
10
  {
@@ -13,11 +12,11 @@ class AVH_EC_Category_Group
13
  * @var string
14
  */
15
  var $taxonomy_name;
16
-
17
  var $db_options_widget_titles;
18
-
19
  var $options_widget_titles;
20
-
21
  var $widget_done_catgroup;
22
 
23
  /**
@@ -37,19 +36,19 @@ class AVH_EC_Category_Group
37
  function __construct ()
38
  {
39
  global $wpdb;
40
-
41
  register_shutdown_function(array(&$this, '__destruct'));
42
-
43
  /**
44
  * Taxonomy name
45
  * @var string
46
  */
47
  $this->taxonomy_name = 'avhec_catgroup';
48
-
49
  $this->db_options_widget_titles = 'avhec_widget_titles';
50
  // add DB pointer
51
  $wpdb->avhec_cat_group = $wpdb->prefix . 'avhec_category_groups';
52
-
53
  /**
54
  * Create the table if it doesn't exist.
55
  *
@@ -59,9 +58,9 @@ class AVH_EC_Category_Group
59
  }
60
  add_action('init', array(&$this, 'doRegisterTaxonomy'), 2); // Priority for registering custom taxonomies is +1 over the creation of the initial taxonomies
61
  add_action('init', array(&$this, 'doSetupOptions'));
62
-
63
  add_action('admin_init', array(&$this, 'addMetaBoxes'));
64
-
65
  }
66
 
67
  /**
@@ -82,19 +81,19 @@ class AVH_EC_Category_Group
82
  function doCreateTable ()
83
  {
84
  global $wpdb;
85
-
86
  // Setup the DB Tables
87
  $charset_collate = '';
88
-
89
  if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
90
  if (! empty($wpdb->charset))
91
  $charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
92
  if (! empty($wpdb->collate))
93
  $charset_collate .= ' COLLATE ' . $wpdb->collate;
94
  }
95
-
96
  $sql = 'CREATE TABLE `' . $wpdb->avhec_cat_group . '` ( `group_term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`group_term_id`, `term_id`) )' . $charset_collate . ';';
97
-
98
  $result = $wpdb->query($sql);
99
  }
100
 
@@ -112,7 +111,7 @@ class AVH_EC_Category_Group
112
  $labels = array('name'=>__('Category Groups', 'avh-ec'), 'singular_name'=>__('Category Group', 'avh-ec'), 'search_items'=>__('Search Category Groups', 'avh-ec'), 'popular_items'=>__('Popular Category Groups'), 'all_items'=>__('All Category Groups'), 'parent_item'=>__('Parent Category Group'), 'parent_item_colon'=>__('Parent Category Group:'), 'edit_item'=>__('Edit Category Group'), 'update_item'=>__('Update Category Group'), 'add_new_item'=>__('Add New Category Group'), 'new_item_name'=>__('New Category Group Name'));
113
  $caps = array('manage_terms'=>null, 'edit_terms'=>null, 'delete_terms'=>null, 'assign_terms'=>'edit_posts');
114
  register_taxonomy($this->taxonomy_name, array('post', 'page'), array('hierarchical'=>TRUE, 'labels'=>$labels, 'query_var'=>TRUE, 'rewrite'=>TRUE, 'show_in_nav_menus'=>FALSE, 'public'=>TRUE, 'show_ui'=>FALSE, 'capabilities'=>$caps));
115
-
116
  }
117
 
118
  /**
@@ -128,13 +127,13 @@ class AVH_EC_Category_Group
128
  $none_group_id = wp_insert_term('none', $this->taxonomy_name, array('description'=>__('This group will not show the widget.', 'avh-ec')));
129
  $all_group_id = wp_insert_term('All', $this->taxonomy_name, array('description'=>__('Holds all the categories.', 'avh-ec')));
130
  $home_group_id = wp_insert_term('Home', $this->taxonomy_name, array('description'=>__('This group will be shown on the front page.', 'avh-ec')));
131
-
132
  // Fill the standard groups with all categories
133
  $this->setCategoriesForGroup($home_group_id['term_id'], $all_categories);
134
  $this->setWidgetTitleForGroup($all_group_id['term_id'], '');
135
  $this->setWidgetTitleForGroup($home_group_id['term_id'], '');
136
  }
137
-
138
  $options = get_option($this->db_options_widget_titles);
139
  if (! $options) {
140
  $options = array();
@@ -186,10 +185,10 @@ class AVH_EC_Category_Group
186
  function getCategoriesFromGroup ($group_id)
187
  {
188
  global $wpdb;
189
-
190
  // Query database
191
  $result = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->terms . ' t, ' . $wpdb->avhec_cat_group . ' cg WHERE t.term_id = cg.term_id AND cg.group_term_id = %d', $group_id));
192
-
193
  if (is_array($result)) { // Call succeeded
194
  if (empty($result)) { // No rows found
195
  $return = array();
@@ -215,9 +214,9 @@ class AVH_EC_Category_Group
215
  function setCategoriesForGroup ($group_id, $categories = array())
216
  {
217
  global $wpdb;
218
-
219
  $old_categories = $this->getCategoriesFromGroup($group_id);
220
-
221
  if (! is_array($categories)) {
222
  $categories = array();
223
  }
@@ -228,10 +227,10 @@ class AVH_EC_Category_Group
228
  if ($new_categories === $old_categories) {
229
  return false;
230
  }
231
-
232
  $new = array_diff($new_categories, $old_categories);
233
  $removed = array_diff($old_categories, $new_categories);
234
-
235
  if (! empty($new)) {
236
  foreach ($new as $cat_term_id) {
237
  $insert[] = '(' . $group_id . ',' . $cat_term_id . ')';
@@ -239,16 +238,16 @@ class AVH_EC_Category_Group
239
  $value = implode(',', $insert);
240
  $sql = 'INSERT INTO ' . $wpdb->avhec_cat_group . ' (group_term_id, term_id) VALUES ' . $value;
241
  $result = $wpdb->query($sql);
242
-
243
  }
244
-
245
  if (! empty($removed)) {
246
  $delete = implode(',', $removed);
247
  $sql = $wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d and term_id IN (' . $delete . ')', $group_id);
248
  $result = $wpdb->query($sql);
249
-
250
  }
251
-
252
  return $result;
253
  }
254
 
@@ -316,7 +315,7 @@ class AVH_EC_Category_Group
316
  function getGroup ($group_id)
317
  {
318
  global $wpdb;
319
-
320
  $result = get_term((int) $group_id, $this->taxonomy_name);
321
  if (null === $result) {
322
  $result = false;
@@ -327,7 +326,7 @@ class AVH_EC_Category_Group
327
  function getGroupByCategoryID($category_id){
328
  $return = get_term_by('slug', 'none', $this->taxonomy_name);
329
  $cat_groups = get_terms($this->taxonomy_name, array('hide_empty'=>FALSE));
330
-
331
  foreach ($cat_groups as $group) {
332
  $cats = $this->getCategoriesFromGroup($group->term_id);
333
  if ($group->slug != 'all' && in_array($category_id,$cats)) {
@@ -357,14 +356,14 @@ class AVH_EC_Category_Group
357
  */
358
  function doDeleteGroup ($group_id)
359
  {
360
-
361
  global $wpdb;
362
-
363
  $group = $this->getGroup($group_id);
364
  $result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d', $group_id));
365
  $this->doDeleteWidgetTitle($group_id);
366
  $return = wp_delete_term($group->term_id, $this->taxonomy_name);
367
-
368
  return ($return);
369
  }
370
 
@@ -379,7 +378,7 @@ class AVH_EC_Category_Group
379
  */
380
  function doUpdateGroup ($group_id, $args = array(), $selected_categories, $widget_title = '')
381
  {
382
-
383
  $group = $this->getGroup($group_id);
384
  if (is_object($group)) {
385
  $id = wp_update_term($group->term_id, $this->taxonomy_name, $args);
4
  * AVH Extended Categorie Category Group Class
5
  *
6
  * @author Peter van der Does
 
7
  */
8
  class AVH_EC_Category_Group
9
  {
12
  * @var string
13
  */
14
  var $taxonomy_name;
15
+
16
  var $db_options_widget_titles;
17
+
18
  var $options_widget_titles;
19
+
20
  var $widget_done_catgroup;
21
 
22
  /**
36
  function __construct ()
37
  {
38
  global $wpdb;
39
+
40
  register_shutdown_function(array(&$this, '__destruct'));
41
+
42
  /**
43
  * Taxonomy name
44
  * @var string
45
  */
46
  $this->taxonomy_name = 'avhec_catgroup';
47
+
48
  $this->db_options_widget_titles = 'avhec_widget_titles';
49
  // add DB pointer
50
  $wpdb->avhec_cat_group = $wpdb->prefix . 'avhec_category_groups';
51
+
52
  /**
53
  * Create the table if it doesn't exist.
54
  *
58
  }
59
  add_action('init', array(&$this, 'doRegisterTaxonomy'), 2); // Priority for registering custom taxonomies is +1 over the creation of the initial taxonomies
60
  add_action('init', array(&$this, 'doSetupOptions'));
61
+
62
  add_action('admin_init', array(&$this, 'addMetaBoxes'));
63
+
64
  }
65
 
66
  /**
81
  function doCreateTable ()
82
  {
83
  global $wpdb;
84
+
85
  // Setup the DB Tables
86
  $charset_collate = '';
87
+
88
  if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
89
  if (! empty($wpdb->charset))
90
  $charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
91
  if (! empty($wpdb->collate))
92
  $charset_collate .= ' COLLATE ' . $wpdb->collate;
93
  }
94
+
95
  $sql = 'CREATE TABLE `' . $wpdb->avhec_cat_group . '` ( `group_term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`group_term_id`, `term_id`) )' . $charset_collate . ';';
96
+
97
  $result = $wpdb->query($sql);
98
  }
99
 
111
  $labels = array('name'=>__('Category Groups', 'avh-ec'), 'singular_name'=>__('Category Group', 'avh-ec'), 'search_items'=>__('Search Category Groups', 'avh-ec'), 'popular_items'=>__('Popular Category Groups'), 'all_items'=>__('All Category Groups'), 'parent_item'=>__('Parent Category Group'), 'parent_item_colon'=>__('Parent Category Group:'), 'edit_item'=>__('Edit Category Group'), 'update_item'=>__('Update Category Group'), 'add_new_item'=>__('Add New Category Group'), 'new_item_name'=>__('New Category Group Name'));
112
  $caps = array('manage_terms'=>null, 'edit_terms'=>null, 'delete_terms'=>null, 'assign_terms'=>'edit_posts');
113
  register_taxonomy($this->taxonomy_name, array('post', 'page'), array('hierarchical'=>TRUE, 'labels'=>$labels, 'query_var'=>TRUE, 'rewrite'=>TRUE, 'show_in_nav_menus'=>FALSE, 'public'=>TRUE, 'show_ui'=>FALSE, 'capabilities'=>$caps));
114
+
115
  }
116
 
117
  /**
127
  $none_group_id = wp_insert_term('none', $this->taxonomy_name, array('description'=>__('This group will not show the widget.', 'avh-ec')));
128
  $all_group_id = wp_insert_term('All', $this->taxonomy_name, array('description'=>__('Holds all the categories.', 'avh-ec')));
129
  $home_group_id = wp_insert_term('Home', $this->taxonomy_name, array('description'=>__('This group will be shown on the front page.', 'avh-ec')));
130
+
131
  // Fill the standard groups with all categories
132
  $this->setCategoriesForGroup($home_group_id['term_id'], $all_categories);
133
  $this->setWidgetTitleForGroup($all_group_id['term_id'], '');
134
  $this->setWidgetTitleForGroup($home_group_id['term_id'], '');
135
  }
136
+
137
  $options = get_option($this->db_options_widget_titles);
138
  if (! $options) {
139
  $options = array();
185
  function getCategoriesFromGroup ($group_id)
186
  {
187
  global $wpdb;
188
+
189
  // Query database
190
  $result = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->terms . ' t, ' . $wpdb->avhec_cat_group . ' cg WHERE t.term_id = cg.term_id AND cg.group_term_id = %d', $group_id));
191
+
192
  if (is_array($result)) { // Call succeeded
193
  if (empty($result)) { // No rows found
194
  $return = array();
214
  function setCategoriesForGroup ($group_id, $categories = array())
215
  {
216
  global $wpdb;
217
+
218
  $old_categories = $this->getCategoriesFromGroup($group_id);
219
+
220
  if (! is_array($categories)) {
221
  $categories = array();
222
  }
227
  if ($new_categories === $old_categories) {
228
  return false;
229
  }
230
+
231
  $new = array_diff($new_categories, $old_categories);
232
  $removed = array_diff($old_categories, $new_categories);
233
+
234
  if (! empty($new)) {
235
  foreach ($new as $cat_term_id) {
236
  $insert[] = '(' . $group_id . ',' . $cat_term_id . ')';
238
  $value = implode(',', $insert);
239
  $sql = 'INSERT INTO ' . $wpdb->avhec_cat_group . ' (group_term_id, term_id) VALUES ' . $value;
240
  $result = $wpdb->query($sql);
241
+
242
  }
243
+
244
  if (! empty($removed)) {
245
  $delete = implode(',', $removed);
246
  $sql = $wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d and term_id IN (' . $delete . ')', $group_id);
247
  $result = $wpdb->query($sql);
248
+
249
  }
250
+
251
  return $result;
252
  }
253
 
315
  function getGroup ($group_id)
316
  {
317
  global $wpdb;
318
+
319
  $result = get_term((int) $group_id, $this->taxonomy_name);
320
  if (null === $result) {
321
  $result = false;
326
  function getGroupByCategoryID($category_id){
327
  $return = get_term_by('slug', 'none', $this->taxonomy_name);
328
  $cat_groups = get_terms($this->taxonomy_name, array('hide_empty'=>FALSE));
329
+
330
  foreach ($cat_groups as $group) {
331
  $cats = $this->getCategoriesFromGroup($group->term_id);
332
  if ($group->slug != 'all' && in_array($category_id,$cats)) {
356
  */
357
  function doDeleteGroup ($group_id)
358
  {
359
+
360
  global $wpdb;
361
+
362
  $group = $this->getGroup($group_id);
363
  $result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d', $group_id));
364
  $this->doDeleteWidgetTitle($group_id);
365
  $return = wp_delete_term($group->term_id, $this->taxonomy_name);
366
+
367
  return ($return);
368
  }
369
 
378
  */
379
  function doUpdateGroup ($group_id, $args = array(), $selected_categories, $widget_title = '')
380
  {
381
+
382
  $group = $this->getGroup($group_id);
383
  if (is_object($group)) {
384
  $id = wp_update_term($group->term_id, $this->taxonomy_name, $args);
2.8/class/avh-ec.core.php CHANGED
@@ -10,9 +10,9 @@ class AVH_EC_Core
10
  var $default_options_general;
11
  var $default_options_category_group;
12
  var $default_options_sp_category_group;
13
-
14
  var $db_options_tax_meta;
15
-
16
  var $options;
17
 
18
  /**
@@ -26,12 +26,12 @@ class AVH_EC_Core
26
  * @var AVH_EC_Category_Group
27
  */
28
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
29
-
30
- $this->version = '3.5';
31
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
32
  $this->db_options_core = 'avhec';
33
  $this->db_options_tax_meta = 'avhec-tax_meta';
34
-
35
  add_action('init', array ( &$this, 'handleInitializePlugin' ), 10);
36
  }
37
 
@@ -47,52 +47,66 @@ class AVH_EC_Core
47
 
48
  function handleInitializePlugin ()
49
  {
 
 
50
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
51
  $db_version = 4;
52
-
53
  $info['siteurl'] = get_option('siteurl');
54
  $info['plugin_dir'] = AVHEC_PLUGIN_DIR;
55
- $info['lang_dir'] = AVHEC_RELATIVE_WORKING_DIR . '/lang';
56
  $info['graphics_url'] = AVHEC_PLUGIN_URL . '/images';
57
-
58
  // Set class property for info
59
- $this->info = array ( 'home' => get_option('home'), 'siteurl' => $info['siteurl'], 'plugin_dir' => $info['plugin_dir'], 'lang_dir' => $info['lang_dir'], 'graphics_url' => $info['graphics_url'] );
60
-
61
  // Set the default options
62
  $this->default_options_general = array ( 'version' => $this->version, 'dbversion' => $db_version, 'alternative_name_select_category' => '' );
63
-
64
  // Set the default category group options
65
  $no_group_id = $catgrp->getTermIDBy('slug', 'none');
66
  $home_group_id = $catgrp->getTermIDBy('slug', 'home');
67
  $default_group_id = $catgrp->getTermIDBy('slug', 'all');
68
  $this->default_options_category_group = array ( 'no_group' => $no_group_id, 'home_group' => $home_group_id, 'default_group' => $default_group_id );
69
-
70
  $this->default_options_sp_category_group = array ( 'home_group' => $home_group_id, 'category_group' => $default_group_id, 'day_group' => $default_group_id, 'month_group' => $default_group_id, 'year_group' => $default_group_id, 'author_group' => $default_group_id, 'search_group' => $default_group_id );
71
-
72
  $this->default_options = array ( 'general' => $this->default_options_general, 'cat_group' => $this->default_options_category_group, 'widget_titles' => array (), 'sp_cat_group' => $this->default_options_sp_category_group );
73
-
74
  /**
75
  * Set the options for the program
76
  *
77
  */
78
  $this->loadOptions();
79
-
80
  // Check if we have to do updates
81
  if ((! isset($this->options['general']['dbversion'])) || $this->options['general']['dbversion'] < $db_version) {
82
  $this->doUpdateOptions($db_version);
83
  }
84
-
 
 
 
 
 
85
  $this->handleTextdomain();
86
  add_filter('get_terms_orderby', array ( &$this, 'applyOrderFilter' ), 10, 2);
87
-
88
  }
89
 
90
  function applyOrderFilter ($orderby, $args)
91
  {
92
- if ($args['orderby'] == 'avhec_3rdparty_mycategoryorder')
93
- return 't.term_order';
94
- else
95
- return $orderby;
 
 
 
 
 
 
 
 
96
  }
97
 
98
  /**
@@ -102,9 +116,9 @@ class AVH_EC_Core
102
  */
103
  function handleTextdomain ()
104
  {
105
-
106
- load_plugin_textdomain('avh-ec', false, $this->info['lang_dir']);
107
-
108
  }
109
 
110
  /**
@@ -116,7 +130,7 @@ class AVH_EC_Core
116
  function doUpdateOptions ($db_version)
117
  {
118
  $options = $this->getOptions();
119
-
120
  // Add none existing sections and/or elements to the options
121
  foreach ($this->default_options as $section => $default_data) {
122
  if (! array_key_exists($section, $options)) {
@@ -129,7 +143,19 @@ class AVH_EC_Core
129
  }
130
  }
131
  }
132
-
 
 
 
 
 
 
 
 
 
 
 
 
133
  /**
134
  * Update the options to the latests versions
135
  */
@@ -181,7 +207,7 @@ class AVH_EC_Core
181
  {
182
  //place each directory into array and get the last element
183
  $return = end(explode('/', $directory));
184
-
185
  return $return;
186
  }
187
 
@@ -190,7 +216,7 @@ class AVH_EC_Core
190
  * Methods for variable: options *
191
  * *
192
  ********************************/
193
-
194
  /**
195
  * @param array $data
196
  */
@@ -297,44 +323,44 @@ class AVH_EC_Core
297
  function avh_wp_dropdown_categories ($args = '', $selectedonly)
298
  {
299
  $mywalker = new AVH_Walker_CategoryDropdown();
300
-
301
  $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 );
302
-
303
  $defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
304
-
305
  $r = wp_parse_args($args, $defaults);
306
-
307
  if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
308
  $r['pad_counts'] = true;
309
  }
310
-
311
  $r['include_last_update_time'] = $r['show_last_update'];
312
  extract($r);
313
-
314
  $tab_index_attribute = '';
315
  if ((int) $tab_index > 0)
316
  $tab_index_attribute = ' tabindex="' . $tab_index . '"';
317
-
318
  $categories = get_categories($r);
319
  $name = esc_attr($name);
320
  $class = esc_attr($class);
321
-
322
  $output = '';
323
  if (! empty($categories)) {
324
  $output = '<select name="' . $name . '" id="' . $name . '" class="' . $class . '" ' . $tab_index_attribute . '>' . "\n";
325
-
326
  if ($show_option_all) {
327
  $show_option_all = apply_filters('list_cats', $show_option_all);
328
  $selected = ('0' === strval($r['selected'])) ? " selected='selected'" : '';
329
  $output .= "\t" . '<option value="0"' . $selected . '>' . $show_option_all . '</option>' . "\n";
330
  }
331
-
332
  if ($show_option_none) {
333
  $show_option_none = apply_filters('list_cats', $show_option_none);
334
  $selected = ('-1' === strval($r['selected'])) ? " selected='selected'" : '';
335
  $output .= "\t" . '<option value="-1"' . $selected . '>' . $show_option_none . '</option>' . "\n";
336
  }
337
-
338
  if ($hierarchical) {
339
  $depth = $r['depth']; // Walk the full depth.
340
  } else {
@@ -343,12 +369,12 @@ class AVH_EC_Core
343
  $output .= walk_category_dropdown_tree($categories, $depth, $r);
344
  $output .= "</select>\n";
345
  }
346
-
347
  $output = apply_filters('wp_dropdown_cats', $output);
348
-
349
  if ($echo)
350
  echo $output;
351
-
352
  return $output;
353
  }
354
 
@@ -389,34 +415,34 @@ class AVH_EC_Core
389
  {
390
  $mywalker = new AVHEC_Walker_Category();
391
  $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, 'walker' => $mywalker );
392
-
393
  $r = wp_parse_args($args, $defaults);
394
-
395
  if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
396
  $r['pad_counts'] = true;
397
  }
398
-
399
  if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
400
  $r['pad_counts'] = true;
401
  }
402
-
403
  if (isset($r['show_date'])) {
404
  $r['include_last_update_time'] = $r['show_date'];
405
  }
406
-
407
  if (true == $r['hierarchical']) {
408
  $r['exclude_tree'] = $r['exclude'];
409
  $r['exclude'] = '';
410
  }
411
-
412
  extract($r);
413
-
414
  $categories = get_categories($r);
415
-
416
  $output = '';
417
  if ($title_li && 'list' == $style)
418
  $output = '<li class="categories">' . $r['title_li'] . '<ul>';
419
-
420
  if (empty($categories)) {
421
  if ('list' == $style)
422
  $output .= '<li>' . __("No categories") . '</li>';
@@ -424,30 +450,30 @@ class AVH_EC_Core
424
  $output .= __("No categories");
425
  } else {
426
  global $wp_query;
427
-
428
  if (! empty($show_option_all))
429
  if ('list' == $style)
430
  $output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
431
  else
432
  $output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
433
-
434
  if (empty($r['current_category']) && is_category())
435
  $r['current_category'] = $wp_query->get_queried_object_id();
436
-
437
  if ($hierarchical) {
438
  $depth = $r['depth'];
439
  } else {
440
  $depth = - 1; // Flat.
441
  }
442
-
443
  $output .= walk_category_tree($categories, $depth, $r);
444
  }
445
-
446
  if ($title_li && 'list' == $style)
447
  $output .= '</ul></li>';
448
-
449
  $output = apply_filters('wp_list_categories', $output);
450
-
451
  if ($echo)
452
  echo $output;
453
  else
@@ -485,19 +511,19 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
485
 
486
  function walk ($elements, $max_depth)
487
  {
488
-
489
  $args = array_slice(func_get_args(), 2);
490
  $output = '';
491
-
492
  if ($max_depth < - 1) //invalid parameter
493
  return $output;
494
-
495
  if (empty($elements)) //nothing to walk
496
  return $output;
497
-
498
  $id_field = $this->db_fields['id'];
499
  $parent_field = $this->db_fields['parent'];
500
-
501
  // flat display
502
  if (- 1 == $max_depth) {
503
  $empty_array = array ();
@@ -505,7 +531,7 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
505
  $this->display_element($e, $empty_array, 1, 0, $args, $output);
506
  return $output;
507
  }
508
-
509
  /*
510
  * need to display in hierarchical order
511
  * seperate elements into two buckets: top level and children elements
@@ -520,16 +546,16 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
520
  else
521
  $children_elements[$e->$parent_field][] = $e;
522
  }
523
-
524
  /*
525
  * when none of the elements is top level
526
  * assume the first one must be root of the sub elements
527
  */
528
  if (empty($top_level_elements)) {
529
-
530
  $first = array_slice($elements, 0, 1);
531
  $root = $first[0];
532
-
533
  $top_level_elements = array ();
534
  $children_elements = array ();
535
  foreach ($elements as $e) {
@@ -539,11 +565,11 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
539
  $children_elements[$e->$parent_field][] = $e;
540
  }
541
  }
542
-
543
  foreach ($top_level_elements as $e)
544
  $this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
545
-
546
- /*
547
  * if we are displaying all levels, and remaining children_elements is not empty,
548
  * then we got orphans, which should be displayed regardless
549
  */
@@ -553,7 +579,7 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
553
  foreach ($orphans as $op)
554
  $this->display_element($op, $empty_array, 1, 0, $args, $output);
555
  }
556
-
557
  return $output;
558
  }
559
  }
@@ -571,7 +597,7 @@ class AVHEC_Walker_Category extends Walker
571
  * @var string
572
  */
573
  var $tree_type = 'category';
574
-
575
  /**
576
  * @see Walker::$db_fields
577
  * @since 2.1.0
@@ -592,7 +618,7 @@ class AVHEC_Walker_Category extends Walker
592
  {
593
  if ('list' != $args['style'])
594
  return;
595
-
596
  $indent = str_repeat("\t", $depth);
597
  $output .= $indent . '<ul class="children">' . "\n";
598
  }
@@ -609,7 +635,7 @@ class AVHEC_Walker_Category extends Walker
609
  {
610
  if ('list' != $args['style'])
611
  return;
612
-
613
  $indent = str_repeat("\t", $depth);
614
  $output .= $indent . '</ul>' . "\n";
615
  }
@@ -626,7 +652,7 @@ class AVHEC_Walker_Category extends Walker
626
  function start_el (&$output, $category, $depth, $args)
627
  {
628
  extract($args);
629
-
630
  $cat_name = esc_attr($category->name);
631
  $cat_name = apply_filters('list_cats', $cat_name, $category);
632
  $link = '<div class="avhec-widget-line"><a href="' . get_category_link($category->term_id) . '" ';
@@ -636,15 +662,15 @@ class AVHEC_Walker_Category extends Walker
636
  $link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"';
637
  $link .= '>';
638
  $link .= $cat_name . '</a>';
639
-
640
  if ((! empty($feed_image)) || (! empty($feed))) {
641
  $link .= '<div class="avhec-widget-rss"> ';
642
-
643
  if (empty($feed_image))
644
  $link .= '(';
645
-
646
  $link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"';
647
-
648
  if (empty($feed))
649
  $alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"';
650
  else {
@@ -653,9 +679,9 @@ class AVHEC_Walker_Category extends Walker
653
  $name = $feed;
654
  $link .= $title;
655
  }
656
-
657
  $link .= '>';
658
-
659
  if (empty($feed_image))
660
  $link .= $name;
661
  else
@@ -665,17 +691,17 @@ class AVHEC_Walker_Category extends Walker
665
  $link .= ')';
666
  $link .= '</div>';
667
  }
668
-
669
  if (isset($show_count) && $show_count)
670
  $link .= '<div class="avhec-widget-count"> (' . intval($category->count) . ')</div>';
671
-
672
  if (isset($show_date) && $show_date) {
673
  $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
674
  }
675
-
676
  if (isset($current_category) && $current_category)
677
  $_current_category = get_category($current_category);
678
-
679
  if ('list' == $args['style']) {
680
  $output .= "\t" . '<li';
681
  $class = 'cat-item cat-item-' . $category->term_id;
@@ -703,7 +729,7 @@ class AVHEC_Walker_Category extends Walker
703
  {
704
  if ('list' != $args['style'])
705
  return;
706
-
707
  $output .= '</li>' . "\n";
708
  }
709
  }
10
  var $default_options_general;
11
  var $default_options_category_group;
12
  var $default_options_sp_category_group;
13
+
14
  var $db_options_tax_meta;
15
+
16
  var $options;
17
 
18
  /**
26
  * @var AVH_EC_Category_Group
27
  */
28
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
29
+
30
+ $this->version = '3.6';
31
  $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
32
  $this->db_options_core = 'avhec';
33
  $this->db_options_tax_meta = 'avhec-tax_meta';
34
+
35
  add_action('init', array ( &$this, 'handleInitializePlugin' ), 10);
36
  }
37
 
47
 
48
  function handleInitializePlugin ()
49
  {
50
+ global $wpdb;
51
+
52
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
53
  $db_version = 4;
54
+
55
  $info['siteurl'] = get_option('siteurl');
56
  $info['plugin_dir'] = AVHEC_PLUGIN_DIR;
 
57
  $info['graphics_url'] = AVHEC_PLUGIN_URL . '/images';
58
+
59
  // Set class property for info
60
+ $this->info = array ( 'home' => get_option('home'), 'siteurl' => $info['siteurl'], 'plugin_dir' => $info['plugin_dir'], 'js_dir' => $info['plugin_dir'] . '/js', 'graphics_url' => $info['graphics_url'] );
61
+
62
  // Set the default options
63
  $this->default_options_general = array ( 'version' => $this->version, 'dbversion' => $db_version, 'alternative_name_select_category' => '' );
64
+
65
  // Set the default category group options
66
  $no_group_id = $catgrp->getTermIDBy('slug', 'none');
67
  $home_group_id = $catgrp->getTermIDBy('slug', 'home');
68
  $default_group_id = $catgrp->getTermIDBy('slug', 'all');
69
  $this->default_options_category_group = array ( 'no_group' => $no_group_id, 'home_group' => $home_group_id, 'default_group' => $default_group_id );
70
+
71
  $this->default_options_sp_category_group = array ( 'home_group' => $home_group_id, 'category_group' => $default_group_id, 'day_group' => $default_group_id, 'month_group' => $default_group_id, 'year_group' => $default_group_id, 'author_group' => $default_group_id, 'search_group' => $default_group_id );
72
+
73
  $this->default_options = array ( 'general' => $this->default_options_general, 'cat_group' => $this->default_options_category_group, 'widget_titles' => array (), 'sp_cat_group' => $this->default_options_sp_category_group );
74
+
75
  /**
76
  * Set the options for the program
77
  *
78
  */
79
  $this->loadOptions();
80
+
81
  // Check if we have to do updates
82
  if ((! isset($this->options['general']['dbversion'])) || $this->options['general']['dbversion'] < $db_version) {
83
  $this->doUpdateOptions($db_version);
84
  }
85
+
86
+ $db = new AVH_DB();
87
+ if (! $db->field_exists('avhec_term_order', $wpdb->terms)) {
88
+ $wpdb->query("ALTER TABLE $wpdb->terms ADD `avhec_term_order` INT( 4 ) NULL DEFAULT '0'");
89
+ }
90
+
91
  $this->handleTextdomain();
92
  add_filter('get_terms_orderby', array ( &$this, 'applyOrderFilter' ), 10, 2);
93
+
94
  }
95
 
96
  function applyOrderFilter ($orderby, $args)
97
  {
98
+ switch ($args['orderby']) {
99
+ case 'avhec_manualorder':
100
+ $new_orderby = 't.avhec_term_order';
101
+ break;
102
+ case 'avhec_3rdparty_mycategoryorder':
103
+ $new_orderby = 't.term_order';
104
+ break;
105
+ default:
106
+ $new_orderby = $orderby;
107
+ break;
108
+ }
109
+ return $new_orderby;
110
  }
111
 
112
  /**
116
  */
117
  function handleTextdomain ()
118
  {
119
+
120
+ load_plugin_textdomain('avh-ec', false, AVHEC_RELATIVE_PLUGIN_DIR . '/lang');
121
+
122
  }
123
 
124
  /**
130
  function doUpdateOptions ($db_version)
131
  {
132
  $options = $this->getOptions();
133
+
134
  // Add none existing sections and/or elements to the options
135
  foreach ($this->default_options as $section => $default_data) {
136
  if (! array_key_exists($section, $options)) {
143
  }
144
  }
145
  }
146
+
147
+ // Remove none existing sections and/or elements from the options
148
+ foreach ($options as $section => $data) {
149
+ if (! array_key_exists($section, $this->default_options)) {
150
+ unset($options[$section]);
151
+ continue;
152
+ }
153
+ foreach ($data as $element => $value) {
154
+ if (! array_key_exists($element, $this->default_options[$section])) {
155
+ unset($options[$section][$element]);
156
+ }
157
+ }
158
+ }
159
  /**
160
  * Update the options to the latests versions
161
  */
207
  {
208
  //place each directory into array and get the last element
209
  $return = end(explode('/', $directory));
210
+
211
  return $return;
212
  }
213
 
216
  * Methods for variable: options *
217
  * *
218
  ********************************/
219
+
220
  /**
221
  * @param array $data
222
  */
323
  function avh_wp_dropdown_categories ($args = '', $selectedonly)
324
  {
325
  $mywalker = new AVH_Walker_CategoryDropdown();
326
+
327
  $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 );
328
+
329
  $defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
330
+
331
  $r = wp_parse_args($args, $defaults);
332
+
333
  if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
334
  $r['pad_counts'] = true;
335
  }
336
+
337
  $r['include_last_update_time'] = $r['show_last_update'];
338
  extract($r);
339
+
340
  $tab_index_attribute = '';
341
  if ((int) $tab_index > 0)
342
  $tab_index_attribute = ' tabindex="' . $tab_index . '"';
343
+
344
  $categories = get_categories($r);
345
  $name = esc_attr($name);
346
  $class = esc_attr($class);
347
+
348
  $output = '';
349
  if (! empty($categories)) {
350
  $output = '<select name="' . $name . '" id="' . $name . '" class="' . $class . '" ' . $tab_index_attribute . '>' . "\n";
351
+
352
  if ($show_option_all) {
353
  $show_option_all = apply_filters('list_cats', $show_option_all);
354
  $selected = ('0' === strval($r['selected'])) ? " selected='selected'" : '';
355
  $output .= "\t" . '<option value="0"' . $selected . '>' . $show_option_all . '</option>' . "\n";
356
  }
357
+
358
  if ($show_option_none) {
359
  $show_option_none = apply_filters('list_cats', $show_option_none);
360
  $selected = ('-1' === strval($r['selected'])) ? " selected='selected'" : '';
361
  $output .= "\t" . '<option value="-1"' . $selected . '>' . $show_option_none . '</option>' . "\n";
362
  }
363
+
364
  if ($hierarchical) {
365
  $depth = $r['depth']; // Walk the full depth.
366
  } else {
369
  $output .= walk_category_dropdown_tree($categories, $depth, $r);
370
  $output .= "</select>\n";
371
  }
372
+
373
  $output = apply_filters('wp_dropdown_cats', $output);
374
+
375
  if ($echo)
376
  echo $output;
377
+
378
  return $output;
379
  }
380
 
415
  {
416
  $mywalker = new AVHEC_Walker_Category();
417
  $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, 'walker' => $mywalker );
418
+
419
  $r = wp_parse_args($args, $defaults);
420
+
421
  if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
422
  $r['pad_counts'] = true;
423
  }
424
+
425
  if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
426
  $r['pad_counts'] = true;
427
  }
428
+
429
  if (isset($r['show_date'])) {
430
  $r['include_last_update_time'] = $r['show_date'];
431
  }
432
+
433
  if (true == $r['hierarchical']) {
434
  $r['exclude_tree'] = $r['exclude'];
435
  $r['exclude'] = '';
436
  }
437
+
438
  extract($r);
439
+
440
  $categories = get_categories($r);
441
+
442
  $output = '';
443
  if ($title_li && 'list' == $style)
444
  $output = '<li class="categories">' . $r['title_li'] . '<ul>';
445
+
446
  if (empty($categories)) {
447
  if ('list' == $style)
448
  $output .= '<li>' . __("No categories") . '</li>';
450
  $output .= __("No categories");
451
  } else {
452
  global $wp_query;
453
+
454
  if (! empty($show_option_all))
455
  if ('list' == $style)
456
  $output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
457
  else
458
  $output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
459
+
460
  if (empty($r['current_category']) && is_category())
461
  $r['current_category'] = $wp_query->get_queried_object_id();
462
+
463
  if ($hierarchical) {
464
  $depth = $r['depth'];
465
  } else {
466
  $depth = - 1; // Flat.
467
  }
468
+
469
  $output .= walk_category_tree($categories, $depth, $r);
470
  }
471
+
472
  if ($title_li && 'list' == $style)
473
  $output .= '</ul></li>';
474
+
475
  $output = apply_filters('wp_list_categories', $output);
476
+
477
  if ($echo)
478
  echo $output;
479
  else
511
 
512
  function walk ($elements, $max_depth)
513
  {
514
+
515
  $args = array_slice(func_get_args(), 2);
516
  $output = '';
517
+
518
  if ($max_depth < - 1) //invalid parameter
519
  return $output;
520
+
521
  if (empty($elements)) //nothing to walk
522
  return $output;
523
+
524
  $id_field = $this->db_fields['id'];
525
  $parent_field = $this->db_fields['parent'];
526
+
527
  // flat display
528
  if (- 1 == $max_depth) {
529
  $empty_array = array ();
531
  $this->display_element($e, $empty_array, 1, 0, $args, $output);
532
  return $output;
533
  }
534
+
535
  /*
536
  * need to display in hierarchical order
537
  * seperate elements into two buckets: top level and children elements
546
  else
547
  $children_elements[$e->$parent_field][] = $e;
548
  }
549
+
550
  /*
551
  * when none of the elements is top level
552
  * assume the first one must be root of the sub elements
553
  */
554
  if (empty($top_level_elements)) {
555
+
556
  $first = array_slice($elements, 0, 1);
557
  $root = $first[0];
558
+
559
  $top_level_elements = array ();
560
  $children_elements = array ();
561
  foreach ($elements as $e) {
565
  $children_elements[$e->$parent_field][] = $e;
566
  }
567
  }
568
+
569
  foreach ($top_level_elements as $e)
570
  $this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
571
+
572
+ /*
573
  * if we are displaying all levels, and remaining children_elements is not empty,
574
  * then we got orphans, which should be displayed regardless
575
  */
579
  foreach ($orphans as $op)
580
  $this->display_element($op, $empty_array, 1, 0, $args, $output);
581
  }
582
+
583
  return $output;
584
  }
585
  }
597
  * @var string
598
  */
599
  var $tree_type = 'category';
600
+
601
  /**
602
  * @see Walker::$db_fields
603
  * @since 2.1.0
618
  {
619
  if ('list' != $args['style'])
620
  return;
621
+
622
  $indent = str_repeat("\t", $depth);
623
  $output .= $indent . '<ul class="children">' . "\n";
624
  }
635
  {
636
  if ('list' != $args['style'])
637
  return;
638
+
639
  $indent = str_repeat("\t", $depth);
640
  $output .= $indent . '</ul>' . "\n";
641
  }
652
  function start_el (&$output, $category, $depth, $args)
653
  {
654
  extract($args);
655
+
656
  $cat_name = esc_attr($category->name);
657
  $cat_name = apply_filters('list_cats', $cat_name, $category);
658
  $link = '<div class="avhec-widget-line"><a href="' . get_category_link($category->term_id) . '" ';
662
  $link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"';
663
  $link .= '>';
664
  $link .= $cat_name . '</a>';
665
+
666
  if ((! empty($feed_image)) || (! empty($feed))) {
667
  $link .= '<div class="avhec-widget-rss"> ';
668
+
669
  if (empty($feed_image))
670
  $link .= '(';
671
+
672
  $link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"';
673
+
674
  if (empty($feed))
675
  $alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"';
676
  else {
679
  $name = $feed;
680
  $link .= $title;
681
  }
682
+
683
  $link .= '>';
684
+
685
  if (empty($feed_image))
686
  $link .= $name;
687
  else
691
  $link .= ')';
692
  $link .= '</div>';
693
  }
694
+
695
  if (isset($show_count) && $show_count)
696
  $link .= '<div class="avhec-widget-count"> (' . intval($category->count) . ')</div>';
697
+
698
  if (isset($show_date) && $show_date) {
699
  $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
700
  }
701
+
702
  if (isset($current_category) && $current_category)
703
  $_current_category = get_category($current_category);
704
+
705
  if ('list' == $args['style']) {
706
  $output .= "\t" . '<li';
707
  $class = 'cat-item cat-item-' . $category->term_id;
729
  {
730
  if ('list' != $args['style'])
731
  return;
732
+
733
  $output .= '</li>' . "\n";
734
  }
735
  }
2.8/class/avh-ec.widgets.php CHANGED
@@ -19,7 +19,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
19
  function __construct ()
20
  {
21
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
22
-
23
  //Convert the old option widget_extended_categories to widget_extended-categories
24
  $old = get_option('widget_extended_categories');
25
  if (! (FALSE === $old)) {
@@ -27,10 +27,10 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
27
  delete_option('widget_extended_categories');
28
  }
29
  $widget_ops = array('description'=>__("An extended version of the default Categories widget.", 'avh-ec'));
30
- WP_Widget::__construct('extended-categories', __('AVH Extended Categories'), $widget_ops);
31
-
32
  add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
33
-
34
  }
35
 
36
  function WP_Widget_AVH_ExtendedCategories_Normal ()
@@ -40,7 +40,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
40
 
41
  function actionWpPrintStyles ()
42
  {
43
-
44
  if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
45
  wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
46
  wp_enqueue_style('avhec-widget');
@@ -55,9 +55,9 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
55
  */
56
  function widget ($args, $instance)
57
  {
58
-
59
  extract($args);
60
-
61
  $selectedonly = $instance['selectedonly'] ? TRUE : FALSE;
62
  $c = $instance['count'] ? TRUE : FALSE;
63
  $h = $instance['hierarchical'] ? TRUE : FALSE;
@@ -69,18 +69,18 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
69
  $r = $instance['rssfeed'] ? 'RSS' : '';
70
  $i = $instance['rssimage'] ? $instance['rssimage'] : '';
71
  $invert = $instance['invert_included'] ? TRUE : FALSE;
72
-
73
  if (empty($r)) {
74
  $i = '';
75
  }
76
-
77
  if (empty($d)) {
78
  $d = 0;
79
  }
80
-
81
  $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
82
  $style = empty($instance['style']) ? 'list' : $instance['style'];
83
-
84
  $included_cats = '';
85
  if ($instance['post_category']) {
86
  $post_category = unserialize($instance['post_category']);
@@ -92,24 +92,24 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
92
  }
93
  $included_cats = implode(",", array_merge($post_category, $children));
94
  }
95
-
96
  if ($invert) {
97
  $inc_exc = 'exclude';
98
  } else {
99
  $inc_exc = 'include';
100
  }
101
-
102
  $options = $this->core->getOptions();
103
  $show_option_none = __('Select Category', 'avh-ec');
104
  if ($options['general']['alternative_name_select_category']) {
105
  $show_option_none = $options['general']['alternative_name_select_category'];
106
  }
107
-
108
  $cat_args = array($inc_exc=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, '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);
109
  echo $before_widget;
110
  echo $this->core->comment;
111
  echo $before_title . $title . $after_title;
112
-
113
  if ($style == 'list') {
114
  echo '<ul>';
115
  $this->core->avh_wp_list_categories($cat_args, $selectedonly);
@@ -144,9 +144,9 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
144
  if (! isset($new_instance['submit'])) {
145
  return FALSE;
146
  }
147
-
148
  $instance = $old_instance;
149
-
150
  $instance['title'] = strip_tags(stripslashes($new_instance['title']));
151
  $instance['selectedonly'] = $new_instance['selectedonly'] ? TRUE : FALSE;
152
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
@@ -168,7 +168,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
168
  $instance['depth'] = 0;
169
  }
170
  $instance['invert_included'] = $new_instance['invert_included'] ? TRUE : FALSE;
171
-
172
  return $instance;
173
  }
174
 
@@ -181,67 +181,68 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
181
  {
182
  // displays the widget admin form
183
  $instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>'', 'depth'=>0));
184
-
185
  // Prepare data for display
186
  $depth = (int) $instance['depth'];
187
  if ($depth < 0 || 11 < $depth) {
188
  $depth = 0;
189
  }
190
  $selected_cats = ($instance['post_category'] != '') ? unserialize($instance['post_category']) : FALSE;
191
-
192
  echo '<p>';
193
  avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
194
  echo '</p>';
195
-
196
  echo '<p>';
197
  avh_doWidgetFormCheckbox($this->get_field_id('selectedonly'), $this->get_field_name('selectedonly'), __('Show selected categories only', 'avh-ec'), (bool) $instance['selectedonly']);
198
-
199
  avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
200
-
201
  avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
202
-
203
  $options = array(0=>__('All Levels', 'avh-ec'), 1=>__('Toplevel only', 'avh-ec'));
204
  for ($i = 2; $i <= 11; $i ++) {
205
  $options[$i] = __('Child ', 'avh-ec') . ($i - 1);
206
  }
207
  avh_doWidgetFormSelect($this->get_field_id('depth'), $this->get_field_name('depth'), __('How many levels to show', 'avh-ec'), $options, $depth);
208
  unset($options);
209
-
210
  avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
211
-
212
  avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
213
  echo '</p>';
214
-
215
  echo '<p>';
216
  $options['ID'] = __('ID', 'avh-ec');
217
  $options['name'] = __('Name', 'avh-ec');
218
  $options['count'] = __('Count', 'avh-ec');
219
  $options['slug'] = __('Slug', 'avh-ec');
220
  if (is_plugin_active('my-category-order/mycategoryorder.php')) {
221
- $options['avhec_3rdparty_mycategoryorder'] = __('My Category Order', 'avh-ec');
222
  }
 
223
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
224
  unset($options);
225
-
226
  $options['asc'] = __('Ascending', 'avh-ec');
227
  $options['desc'] = __('Descending', 'avh-ec');
228
  avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
229
  unset($options);
230
-
231
  $options['list'] = __('List', 'avh-ec');
232
  $options['drop'] = __('Drop down', 'avh-ec');
233
  avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
234
  unset($options);
235
  echo '</p>';
236
-
237
  echo '<p>';
238
-
239
  avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
240
-
241
  avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
242
-
243
  echo '</p>';
244
-
245
  echo '<p>';
246
  echo '<b>' . __('Select categories', 'avh-ec') . '</b><hr />';
247
  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;">';
@@ -256,11 +257,11 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
256
  ob_end_flush();
257
  echo '</ul>';
258
  echo '</p>';
259
-
260
  echo '<p>';
261
  avh_doWidgetFormCheckbox($this->get_field_id('invert_included'), $this->get_field_name('invert_included'), __('Exclude the selected categories', 'avh-ec'), (bool) $instance['invert_included']);
262
  echo '</p>';
263
-
264
  echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
265
  }
266
 
@@ -275,23 +276,23 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
275
  */
276
  function avh_wp_category_checklist ($selected_cats, $number)
277
  {
278
-
279
  $walker = new AVH_Walker_Category_Checklist();
280
  $walker->number = $number;
281
  $walker->input_id = $this->get_field_id('post_category');
282
  $walker->input_name = $this->get_field_name('post_category');
283
  $walker->li_id = $this->get_field_id('category--1');
284
-
285
  $args = array('taxonomy'=>'category', 'descendants_and_self'=>0, 'selected_cats'=>$selected_cats, 'popular_cats'=>array(), 'walker'=>$walker, 'checked_ontop'=>true, 'popular_cats'=>array());
286
-
287
  if (is_array($selected_cats))
288
  $args['selected_cats'] = $selected_cats;
289
  else
290
  $args['selected_cats'] = array();
291
-
292
  $categories = $this->core->getCategories();
293
  $_categories_id = $this->core->getCategoriesId($categories);
294
-
295
  // 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)
296
  $checked_categories = array();
297
  foreach ($args['selected_cats'] as $key => $value) {
@@ -301,7 +302,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
301
  unset($categories[$category_key]);
302
  }
303
  }
304
-
305
  // Put checked cats on top
306
  echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
307
  // Then the rest of them
@@ -328,11 +329,11 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
328
  function __construct ()
329
  {
330
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
331
-
332
  $widget_ops = array('description'=>__("Shows the top categories.", 'avh-ec'));
333
- WP_Widget::__construct(FALSE, __('AVH Extended Categories: Top Categories'), $widget_ops);
334
  add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
335
-
336
  }
337
 
338
  function WP_Widget_AVH_ExtendedCategories_Top ()
@@ -358,7 +359,7 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
358
  function widget ($args, $instance)
359
  {
360
  extract($args);
361
-
362
  $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
363
  $style = empty($instance['style']) ? 'list' : $instance['style'];
364
  if (! $a = (int) $instance['amount']) {
@@ -380,22 +381,22 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
380
  $i = '';
381
  }
382
  }
383
-
384
  $options = $this->core->getOptions();
385
  $show_option_none = __('Select Category', 'avh-ec');
386
  if ($options['general']['alternative_name_select_category']) {
387
  $show_option_none = $options['general']['alternative_name_select_category'];
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, 'use_desc_for_title'=>$use_desc_for_title, 'hide_empty'=>FALSE, 'hierarchical'=>FALSE, 'depth'=>- 1, 'title_li'=>'', 'show_option_none'=>$show_option_none, '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;
397
  echo '<ul>';
398
-
399
  if ($style == 'list') {
400
  wp_list_categories($cat_args);
401
  } else {
@@ -432,9 +433,9 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
432
  if (! isset($new_instance['submit'])) {
433
  return FALSE;
434
  }
435
-
436
  $instance = $old_instance;
437
-
438
  $instance['title'] = strip_tags(stripslashes($new_instance['title']));
439
  $instance['amount'] = (int) $new_instance['amount'];
440
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
@@ -444,7 +445,7 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
444
  $instance['style'] = strip_tags(stripslashes($new_instance['style']));
445
  $instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
446
  $instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
447
-
448
  return $instance;
449
  }
450
 
@@ -456,30 +457,30 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
456
  {
457
  // displays the widget admin form
458
  $instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>''));
459
-
460
  // Prepare data for display
461
  if (! $amount = (int) $instance['amount']) {
462
  $amount = 5;
463
  }
464
-
465
  if ($amount < 1) {
466
  $amount = 1;
467
  }
468
  echo '<p>';
469
  avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
470
  echo '</p>';
471
-
472
  echo '<p>';
473
  avh_doWidgetFormText($this->get_field_id('amount'), $this->get_field_name('amount'), __('How many categories to show', 'avh-ec'), $amount);
474
  echo '</p>';
475
-
476
  echo '<p>';
477
  avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
478
  echo '<br />';
479
-
480
  avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
481
  echo '</p>';
482
-
483
  echo '<p>';
484
  $options['ID'] = __('ID', 'avh-ec');
485
  $options['name'] = __('Name', 'avh-ec');
@@ -487,26 +488,26 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
487
  $options['slug'] = __('Slug', 'avh-ec');
488
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
489
  unset($options);
490
-
491
  $options['asc'] = __('Ascending', 'avh-ec');
492
  $options['desc'] = __('Descending', 'avh-ec');
493
  avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
494
  unset($options);
495
-
496
  $options['list'] = __('List', 'avh-ec');
497
  $options['drop'] = __('Drop down', 'avh-ec');
498
  avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
499
  unset($options);
500
  echo '</p>';
501
-
502
  echo '<p>';
503
-
504
  avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
505
-
506
  avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
507
-
508
  echo '</p>';
509
-
510
  echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
511
  }
512
  }
@@ -522,13 +523,13 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
522
  * @var AVH_EC_Core
523
  */
524
  var $core;
525
-
526
  /**
527
  *
528
  * @var AVH_EC_Category_Group
529
  */
530
  var $catgrp;
531
-
532
  /**
533
  * PHP 5 Constructor
534
  *
@@ -537,11 +538,11 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
537
  {
538
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
539
  $this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
540
-
541
  $widget_ops = array('description'=>__("Shows grouped categories.", 'avh-ec'));
542
- WP_Widget::__construct(FALSE, __('AVH Extended Category: Category Group'), $widget_ops);
543
  add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
544
-
545
  }
546
 
547
  function WP_Widget_AVH_ExtendedCategories_Category_Group ()
@@ -566,12 +567,12 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
566
  function widget ($args, $instance)
567
  {
568
  global $post, $wp_query;
569
-
570
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
571
  $options = $this->core->getOptions();
572
-
573
  $row = array();
574
-
575
  if (is_home()) {
576
  $special_page = 'home_group';
577
  } elseif (is_category()) {
@@ -589,7 +590,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
589
  } else {
590
  $special_page = 'none';
591
  }
592
-
593
  $toDisplay = FALSE;
594
  if ('none' == $special_page) {
595
  $terms = wp_get_object_terms($post->ID, $catgrp->taxonomy_name);
@@ -626,12 +627,12 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
626
  $row = get_term_by('id', $sp_category_group_id, $catgrp->taxonomy_name); // Returns FALSE when non-existance. (empty(FALSE)=TRUE)
627
  $group_found = TRUE;
628
  }
629
-
630
  if ($group_found) {
631
  $toDisplay = TRUE;
632
  $category_group_id_none = $this->catgrp->getTermIDBy('slug', 'none');
633
  $selected_catgroups = unserialize($instance['post_group_category']);
634
-
635
  if ($category_group_id_none == $row->term_id ) {
636
  $toDisplay = FALSE;
637
  } elseif (! (FALSE == $selected_catgroups || array_key_exists($row->term_id, $selected_catgroups))) {
@@ -640,10 +641,10 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
640
  $toDisplay = FALSE;
641
  }
642
  }
643
-
644
  if ($toDisplay) {
645
  extract($args);
646
-
647
  $c = $instance['count'] ? TRUE : FALSE;
648
  $e = $instance['hide_empty'] ? TRUE : FALSE;
649
  $h = $instance['hierarchical'] ? TRUE : FALSE;
@@ -652,11 +653,11 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
652
  $o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
653
  $r = $instance['rssfeed'] ? 'RSS' : '';
654
  $i = $instance['rssimage'] ? $instance['rssimage'] : '';
655
-
656
  if (empty($r)) {
657
  $i = '';
658
  }
659
-
660
  $style = empty($instance['style']) ? 'list' : $instance['style'];
661
  $group_id = $row->term_id;
662
  $cats = $catgrp->getCategoriesFromGroup($group_id);
@@ -669,19 +670,19 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
669
  $title = $instance['title'];
670
  }
671
  $title = apply_filters('widget_title', $title);
672
-
673
  $included_cats = implode(',', $cats);
674
-
675
  $show_option_none = __('Select Category', 'avh-ec');
676
  if ($options['general']['alternative_name_select_category']) {
677
  $show_option_none = $options['general']['alternative_name_select_category'];
678
  }
679
-
680
  $cat_args = array('include'=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, 'hide_empty'=>$e, 'hierarchical'=>$h, 'title_li'=>'', 'show_option_none'=>$show_option_none, 'feed'=>$r, 'feed_image'=>$i, 'name'=>'extended-categories-select-group-' . $this->number);
681
  echo $before_widget;
682
  echo $this->core->comment;
683
  echo $before_title . $title . $after_title;
684
-
685
  if ($style == 'list') {
686
  echo '<ul>';
687
  $this->core->avh_wp_list_categories($cat_args, TRUE);
@@ -717,9 +718,9 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
717
  if (! isset($new_instance['submit'])) {
718
  return FALSE;
719
  }
720
-
721
  $instance = $old_instance;
722
-
723
  $instance['title'] = strip_tags(stripslashes($new_instance['title']));
724
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
725
  $instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
@@ -747,7 +748,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
747
  {
748
  // displays the widget admin form
749
  $instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>''));
750
-
751
  // Prepare data for display
752
  $title = esc_attr($instance['title']);
753
  $count = (bool) $instance['count'];
@@ -763,24 +764,24 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
763
  $style_drop = ($instance['style'] == 'drop') ? ' SELECTED' : '';
764
  $rssfeed = (bool) $instance['rssfeed'];
765
  $rssimage = esc_attr($instance['rssimage']);
766
-
767
  $selected_cats = ($instance['post_group_category'] != '') ? unserialize($instance['post_group_category']) : FALSE;
768
-
769
  echo '<p>';
770
  avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
771
  echo '</p>';
772
-
773
  echo '<p>';
774
-
775
  avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
776
-
777
  avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
778
-
779
  avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
780
-
781
  avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
782
  echo '</p>';
783
-
784
  echo '<p>';
785
  $options['ID'] = __('ID', 'avh-ec');
786
  $options['name'] = __('Name', 'avh-ec');
@@ -788,25 +789,25 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
788
  $options['slug'] = __('Slug', 'avh-ec');
789
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
790
  unset($options);
791
-
792
  $options['asc'] = __('Ascending', 'avh-ec');
793
  $options['desc'] = __('Descending', 'avh-ec');
794
  avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
795
  unset($options);
796
-
797
  $options['list'] = __('List', 'avh-ec');
798
  $options['drop'] = __('Drop down', 'avh-ec');
799
  avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
800
  unset($options);
801
  echo '</p>';
802
-
803
  echo '<p>';
804
-
805
  avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
806
-
807
  avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
808
  echo '</p>';
809
-
810
  echo '<p>';
811
  echo '<b>' . __('Select Groups', 'avh-ec') . '</b><hr />';
812
  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;">';
@@ -816,48 +817,49 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
816
  _e('Any Group', 'avh-ec');
817
  echo '</label>';
818
  echo '</li>';
819
- ob_start();
820
  $this->avh_wp_group_category_checklist($selected_cats, $this->number);
821
- ob_end_flush();
822
  echo '</ul>';
823
  echo '</p>';
824
-
825
  echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
 
826
  }
827
 
828
  function avh_wp_group_category_checklist ($selected_cats, $number)
829
  {
830
-
831
  $walker = new AVH_Walker_Category_Checklist();
832
  $walker->number = $number;
833
  $walker->input_id = $this->get_field_id('post_group_category');
834
  $walker->input_name = $this->get_field_name('post_group_category');
835
  $walker->li_id = $this->get_field_id('group_category--1');
836
-
837
  $args = array('taxonomy'=>'avhec_catgroup', 'descendants_and_self'=>0, 'selected_cats'=>array(), 'popular_cats'=>array(), 'walker'=>$walker, 'checked_ontop'=>true);
838
-
839
  if (is_array($selected_cats))
840
  $args['selected_cats'] = $selected_cats;
841
  else
842
  $args['selected_cats'] = array();
843
-
844
  $categories = (array) get_terms($args['taxonomy'], array('get'=>'all'));
845
-
846
  // 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)
847
  $checked_categories = array();
848
  $keys = array_keys($categories);
849
-
850
  foreach ($keys as $k) {
851
  if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
852
  $checked_categories[] = $categories[$k];
853
  unset($categories[$k]);
854
  }
855
  }
856
-
857
  // Put checked cats on top
858
- echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
859
  // Then the rest of them
860
- echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
861
  }
862
 
863
  function getWidgetDoneCatGroup ($id)
@@ -884,6 +886,92 @@ class AVH_Walker_Category_Checklist extends Walker
884
  var $input_name;
885
  var $li_id;
886
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
887
  function start_lvl (&$output, $depth, $args)
888
  {
889
  $indent = str_repeat("\t", $depth);
19
  function __construct ()
20
  {
21
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
22
+
23
  //Convert the old option widget_extended_categories to widget_extended-categories
24
  $old = get_option('widget_extended_categories');
25
  if (! (FALSE === $old)) {
27
  delete_option('widget_extended_categories');
28
  }
29
  $widget_ops = array('description'=>__("An extended version of the default Categories widget.", 'avh-ec'));
30
+ WP_Widget::__construct('extended-categories', 'AVH Extended Categories', $widget_ops);
31
+
32
  add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
33
+
34
  }
35
 
36
  function WP_Widget_AVH_ExtendedCategories_Normal ()
40
 
41
  function actionWpPrintStyles ()
42
  {
43
+
44
  if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
45
  wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
46
  wp_enqueue_style('avhec-widget');
55
  */
56
  function widget ($args, $instance)
57
  {
58
+
59
  extract($args);
60
+
61
  $selectedonly = $instance['selectedonly'] ? TRUE : FALSE;
62
  $c = $instance['count'] ? TRUE : FALSE;
63
  $h = $instance['hierarchical'] ? TRUE : FALSE;
69
  $r = $instance['rssfeed'] ? 'RSS' : '';
70
  $i = $instance['rssimage'] ? $instance['rssimage'] : '';
71
  $invert = $instance['invert_included'] ? TRUE : FALSE;
72
+
73
  if (empty($r)) {
74
  $i = '';
75
  }
76
+
77
  if (empty($d)) {
78
  $d = 0;
79
  }
80
+
81
  $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
82
  $style = empty($instance['style']) ? 'list' : $instance['style'];
83
+
84
  $included_cats = '';
85
  if ($instance['post_category']) {
86
  $post_category = unserialize($instance['post_category']);
92
  }
93
  $included_cats = implode(",", array_merge($post_category, $children));
94
  }
95
+
96
  if ($invert) {
97
  $inc_exc = 'exclude';
98
  } else {
99
  $inc_exc = 'include';
100
  }
101
+
102
  $options = $this->core->getOptions();
103
  $show_option_none = __('Select Category', 'avh-ec');
104
  if ($options['general']['alternative_name_select_category']) {
105
  $show_option_none = $options['general']['alternative_name_select_category'];
106
  }
107
+
108
  $cat_args = array($inc_exc=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, '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);
109
  echo $before_widget;
110
  echo $this->core->comment;
111
  echo $before_title . $title . $after_title;
112
+
113
  if ($style == 'list') {
114
  echo '<ul>';
115
  $this->core->avh_wp_list_categories($cat_args, $selectedonly);
144
  if (! isset($new_instance['submit'])) {
145
  return FALSE;
146
  }
147
+
148
  $instance = $old_instance;
149
+
150
  $instance['title'] = strip_tags(stripslashes($new_instance['title']));
151
  $instance['selectedonly'] = $new_instance['selectedonly'] ? TRUE : FALSE;
152
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
168
  $instance['depth'] = 0;
169
  }
170
  $instance['invert_included'] = $new_instance['invert_included'] ? TRUE : FALSE;
171
+
172
  return $instance;
173
  }
174
 
181
  {
182
  // displays the widget admin form
183
  $instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>'', 'depth'=>0));
184
+
185
  // Prepare data for display
186
  $depth = (int) $instance['depth'];
187
  if ($depth < 0 || 11 < $depth) {
188
  $depth = 0;
189
  }
190
  $selected_cats = ($instance['post_category'] != '') ? unserialize($instance['post_category']) : FALSE;
191
+
192
  echo '<p>';
193
  avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
194
  echo '</p>';
195
+
196
  echo '<p>';
197
  avh_doWidgetFormCheckbox($this->get_field_id('selectedonly'), $this->get_field_name('selectedonly'), __('Show selected categories only', 'avh-ec'), (bool) $instance['selectedonly']);
198
+
199
  avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
200
+
201
  avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
202
+
203
  $options = array(0=>__('All Levels', 'avh-ec'), 1=>__('Toplevel only', 'avh-ec'));
204
  for ($i = 2; $i <= 11; $i ++) {
205
  $options[$i] = __('Child ', 'avh-ec') . ($i - 1);
206
  }
207
  avh_doWidgetFormSelect($this->get_field_id('depth'), $this->get_field_name('depth'), __('How many levels to show', 'avh-ec'), $options, $depth);
208
  unset($options);
209
+
210
  avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
211
+
212
  avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
213
  echo '</p>';
214
+
215
  echo '<p>';
216
  $options['ID'] = __('ID', 'avh-ec');
217
  $options['name'] = __('Name', 'avh-ec');
218
  $options['count'] = __('Count', 'avh-ec');
219
  $options['slug'] = __('Slug', 'avh-ec');
220
  if (is_plugin_active('my-category-order/mycategoryorder.php')) {
221
+ $options['avhec_3rdparty_mycategoryorder'] = 'My Category Order';
222
  }
223
+
224
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
225
  unset($options);
226
+
227
  $options['asc'] = __('Ascending', 'avh-ec');
228
  $options['desc'] = __('Descending', 'avh-ec');
229
  avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
230
  unset($options);
231
+
232
  $options['list'] = __('List', 'avh-ec');
233
  $options['drop'] = __('Drop down', 'avh-ec');
234
  avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
235
  unset($options);
236
  echo '</p>';
237
+
238
  echo '<p>';
239
+
240
  avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
241
+
242
  avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
243
+
244
  echo '</p>';
245
+
246
  echo '<p>';
247
  echo '<b>' . __('Select categories', 'avh-ec') . '</b><hr />';
248
  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;">';
257
  ob_end_flush();
258
  echo '</ul>';
259
  echo '</p>';
260
+
261
  echo '<p>';
262
  avh_doWidgetFormCheckbox($this->get_field_id('invert_included'), $this->get_field_name('invert_included'), __('Exclude the selected categories', 'avh-ec'), (bool) $instance['invert_included']);
263
  echo '</p>';
264
+
265
  echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
266
  }
267
 
276
  */
277
  function avh_wp_category_checklist ($selected_cats, $number)
278
  {
279
+
280
  $walker = new AVH_Walker_Category_Checklist();
281
  $walker->number = $number;
282
  $walker->input_id = $this->get_field_id('post_category');
283
  $walker->input_name = $this->get_field_name('post_category');
284
  $walker->li_id = $this->get_field_id('category--1');
285
+
286
  $args = array('taxonomy'=>'category', 'descendants_and_self'=>0, 'selected_cats'=>$selected_cats, 'popular_cats'=>array(), 'walker'=>$walker, 'checked_ontop'=>true, 'popular_cats'=>array());
287
+
288
  if (is_array($selected_cats))
289
  $args['selected_cats'] = $selected_cats;
290
  else
291
  $args['selected_cats'] = array();
292
+
293
  $categories = $this->core->getCategories();
294
  $_categories_id = $this->core->getCategoriesId($categories);
295
+
296
  // 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)
297
  $checked_categories = array();
298
  foreach ($args['selected_cats'] as $key => $value) {
302
  unset($categories[$category_key]);
303
  }
304
  }
305
+
306
  // Put checked cats on top
307
  echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
308
  // Then the rest of them
329
  function __construct ()
330
  {
331
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
332
+
333
  $widget_ops = array('description'=>__("Shows the top categories.", 'avh-ec'));
334
+ WP_Widget::__construct(FALSE, 'AVH Extended Categories: '.__('Top Categories'), $widget_ops);
335
  add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
336
+
337
  }
338
 
339
  function WP_Widget_AVH_ExtendedCategories_Top ()
359
  function widget ($args, $instance)
360
  {
361
  extract($args);
362
+
363
  $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
364
  $style = empty($instance['style']) ? 'list' : $instance['style'];
365
  if (! $a = (int) $instance['amount']) {
381
  $i = '';
382
  }
383
  }
384
+
385
  $options = $this->core->getOptions();
386
  $show_option_none = __('Select Category', 'avh-ec');
387
  if ($options['general']['alternative_name_select_category']) {
388
  $show_option_none = $options['general']['alternative_name_select_category'];
389
  }
390
+
391
  $top_cats = get_terms('category', array('fields'=>'ids', 'orderby'=>'count', 'order'=>'DESC', 'number'=>$a, 'hierarchical'=>FALSE));
392
  $included_cats = implode(",", $top_cats);
393
+
394
  $cat_args = array('include'=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, 'hide_empty'=>FALSE, 'hierarchical'=>FALSE, 'depth'=>- 1, 'title_li'=>'', 'show_option_none'=>$show_option_none, 'feed'=>$r, 'feed_image'=>$i, 'name'=>'extended-categories-top-select-' . $this->number);
395
  echo $before_widget;
396
  echo $this->core->comment;
397
  echo $before_title . $title . $after_title;
398
  echo '<ul>';
399
+
400
  if ($style == 'list') {
401
  wp_list_categories($cat_args);
402
  } else {
433
  if (! isset($new_instance['submit'])) {
434
  return FALSE;
435
  }
436
+
437
  $instance = $old_instance;
438
+
439
  $instance['title'] = strip_tags(stripslashes($new_instance['title']));
440
  $instance['amount'] = (int) $new_instance['amount'];
441
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
445
  $instance['style'] = strip_tags(stripslashes($new_instance['style']));
446
  $instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
447
  $instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
448
+
449
  return $instance;
450
  }
451
 
457
  {
458
  // displays the widget admin form
459
  $instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>''));
460
+
461
  // Prepare data for display
462
  if (! $amount = (int) $instance['amount']) {
463
  $amount = 5;
464
  }
465
+
466
  if ($amount < 1) {
467
  $amount = 1;
468
  }
469
  echo '<p>';
470
  avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
471
  echo '</p>';
472
+
473
  echo '<p>';
474
  avh_doWidgetFormText($this->get_field_id('amount'), $this->get_field_name('amount'), __('How many categories to show', 'avh-ec'), $amount);
475
  echo '</p>';
476
+
477
  echo '<p>';
478
  avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
479
  echo '<br />';
480
+
481
  avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
482
  echo '</p>';
483
+
484
  echo '<p>';
485
  $options['ID'] = __('ID', 'avh-ec');
486
  $options['name'] = __('Name', 'avh-ec');
488
  $options['slug'] = __('Slug', 'avh-ec');
489
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
490
  unset($options);
491
+
492
  $options['asc'] = __('Ascending', 'avh-ec');
493
  $options['desc'] = __('Descending', 'avh-ec');
494
  avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
495
  unset($options);
496
+
497
  $options['list'] = __('List', 'avh-ec');
498
  $options['drop'] = __('Drop down', 'avh-ec');
499
  avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
500
  unset($options);
501
  echo '</p>';
502
+
503
  echo '<p>';
504
+
505
  avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
506
+
507
  avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
508
+
509
  echo '</p>';
510
+
511
  echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
512
  }
513
  }
523
  * @var AVH_EC_Core
524
  */
525
  var $core;
526
+
527
  /**
528
  *
529
  * @var AVH_EC_Category_Group
530
  */
531
  var $catgrp;
532
+
533
  /**
534
  * PHP 5 Constructor
535
  *
538
  {
539
  $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
540
  $this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
541
+
542
  $widget_ops = array('description'=>__("Shows grouped categories.", 'avh-ec'));
543
+ WP_Widget::__construct(FALSE, 'AVH Extended Categories: '.__('Category Group'), $widget_ops);
544
  add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
545
+
546
  }
547
 
548
  function WP_Widget_AVH_ExtendedCategories_Category_Group ()
567
  function widget ($args, $instance)
568
  {
569
  global $post, $wp_query;
570
+
571
  $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
572
  $options = $this->core->getOptions();
573
+
574
  $row = array();
575
+
576
  if (is_home()) {
577
  $special_page = 'home_group';
578
  } elseif (is_category()) {
590
  } else {
591
  $special_page = 'none';
592
  }
593
+
594
  $toDisplay = FALSE;
595
  if ('none' == $special_page) {
596
  $terms = wp_get_object_terms($post->ID, $catgrp->taxonomy_name);
627
  $row = get_term_by('id', $sp_category_group_id, $catgrp->taxonomy_name); // Returns FALSE when non-existance. (empty(FALSE)=TRUE)
628
  $group_found = TRUE;
629
  }
630
+
631
  if ($group_found) {
632
  $toDisplay = TRUE;
633
  $category_group_id_none = $this->catgrp->getTermIDBy('slug', 'none');
634
  $selected_catgroups = unserialize($instance['post_group_category']);
635
+
636
  if ($category_group_id_none == $row->term_id ) {
637
  $toDisplay = FALSE;
638
  } elseif (! (FALSE == $selected_catgroups || array_key_exists($row->term_id, $selected_catgroups))) {
641
  $toDisplay = FALSE;
642
  }
643
  }
644
+
645
  if ($toDisplay) {
646
  extract($args);
647
+
648
  $c = $instance['count'] ? TRUE : FALSE;
649
  $e = $instance['hide_empty'] ? TRUE : FALSE;
650
  $h = $instance['hierarchical'] ? TRUE : FALSE;
653
  $o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
654
  $r = $instance['rssfeed'] ? 'RSS' : '';
655
  $i = $instance['rssimage'] ? $instance['rssimage'] : '';
656
+
657
  if (empty($r)) {
658
  $i = '';
659
  }
660
+
661
  $style = empty($instance['style']) ? 'list' : $instance['style'];
662
  $group_id = $row->term_id;
663
  $cats = $catgrp->getCategoriesFromGroup($group_id);
670
  $title = $instance['title'];
671
  }
672
  $title = apply_filters('widget_title', $title);
673
+
674
  $included_cats = implode(',', $cats);
675
+
676
  $show_option_none = __('Select Category', 'avh-ec');
677
  if ($options['general']['alternative_name_select_category']) {
678
  $show_option_none = $options['general']['alternative_name_select_category'];
679
  }
680
+
681
  $cat_args = array('include'=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, 'hide_empty'=>$e, 'hierarchical'=>$h, 'title_li'=>'', 'show_option_none'=>$show_option_none, 'feed'=>$r, 'feed_image'=>$i, 'name'=>'extended-categories-select-group-' . $this->number);
682
  echo $before_widget;
683
  echo $this->core->comment;
684
  echo $before_title . $title . $after_title;
685
+
686
  if ($style == 'list') {
687
  echo '<ul>';
688
  $this->core->avh_wp_list_categories($cat_args, TRUE);
718
  if (! isset($new_instance['submit'])) {
719
  return FALSE;
720
  }
721
+
722
  $instance = $old_instance;
723
+
724
  $instance['title'] = strip_tags(stripslashes($new_instance['title']));
725
  $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
726
  $instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
748
  {
749
  // displays the widget admin form
750
  $instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>''));
751
+
752
  // Prepare data for display
753
  $title = esc_attr($instance['title']);
754
  $count = (bool) $instance['count'];
764
  $style_drop = ($instance['style'] == 'drop') ? ' SELECTED' : '';
765
  $rssfeed = (bool) $instance['rssfeed'];
766
  $rssimage = esc_attr($instance['rssimage']);
767
+
768
  $selected_cats = ($instance['post_group_category'] != '') ? unserialize($instance['post_group_category']) : FALSE;
769
+ ob_start();
770
  echo '<p>';
771
  avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
772
  echo '</p>';
773
+
774
  echo '<p>';
775
+
776
  avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
777
+
778
  avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
779
+
780
  avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
781
+
782
  avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
783
  echo '</p>';
784
+
785
  echo '<p>';
786
  $options['ID'] = __('ID', 'avh-ec');
787
  $options['name'] = __('Name', 'avh-ec');
789
  $options['slug'] = __('Slug', 'avh-ec');
790
  avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
791
  unset($options);
792
+
793
  $options['asc'] = __('Ascending', 'avh-ec');
794
  $options['desc'] = __('Descending', 'avh-ec');
795
  avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
796
  unset($options);
797
+
798
  $options['list'] = __('List', 'avh-ec');
799
  $options['drop'] = __('Drop down', 'avh-ec');
800
  avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
801
  unset($options);
802
  echo '</p>';
803
+
804
  echo '<p>';
805
+
806
  avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
807
+
808
  avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
809
  echo '</p>';
810
+
811
  echo '<p>';
812
  echo '<b>' . __('Select Groups', 'avh-ec') . '</b><hr />';
813
  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;">';
817
  _e('Any Group', 'avh-ec');
818
  echo '</label>';
819
  echo '</li>';
820
+
821
  $this->avh_wp_group_category_checklist($selected_cats, $this->number);
822
+
823
  echo '</ul>';
824
  echo '</p>';
825
+
826
  echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
827
+ ob_end_flush();
828
  }
829
 
830
  function avh_wp_group_category_checklist ($selected_cats, $number)
831
  {
832
+
833
  $walker = new AVH_Walker_Category_Checklist();
834
  $walker->number = $number;
835
  $walker->input_id = $this->get_field_id('post_group_category');
836
  $walker->input_name = $this->get_field_name('post_group_category');
837
  $walker->li_id = $this->get_field_id('group_category--1');
838
+
839
  $args = array('taxonomy'=>'avhec_catgroup', 'descendants_and_self'=>0, 'selected_cats'=>array(), 'popular_cats'=>array(), 'walker'=>$walker, 'checked_ontop'=>true);
840
+
841
  if (is_array($selected_cats))
842
  $args['selected_cats'] = $selected_cats;
843
  else
844
  $args['selected_cats'] = array();
845
+
846
  $categories = (array) get_terms($args['taxonomy'], array('get'=>'all'));
847
+
848
  // 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)
849
  $checked_categories = array();
850
  $keys = array_keys($categories);
851
+
852
  foreach ($keys as $k) {
853
  if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
854
  $checked_categories[] = $categories[$k];
855
  unset($categories[$k]);
856
  }
857
  }
858
+
859
  // Put checked cats on top
860
+ echo $walker->walk($checked_categories, 0, $args);
861
  // Then the rest of them
862
+ echo $walker->walk($categories, 0, $args);
863
  }
864
 
865
  function getWidgetDoneCatGroup ($id)
886
  var $input_name;
887
  var $li_id;
888
 
889
+ /**
890
+ * Display array of elements hierarchically.
891
+ *
892
+ * It is a generic function which does not assume any existing order of
893
+ * elements. max_depth = -1 means flatly display every element. max_depth =
894
+ * 0 means display all levels. max_depth > 0 specifies the number of
895
+ * display levels.
896
+ *
897
+ * @since 2.1.0
898
+ *
899
+ * @param array $elements
900
+ * @param int $max_depth
901
+ * @param array $args;
902
+ * @return string
903
+ */
904
+ function walk( $elements, $max_depth, $args) {
905
+
906
+ $output = '';
907
+
908
+ if ($max_depth < -1) //invalid parameter
909
+ return $output;
910
+
911
+ if (empty($elements)) //nothing to walk
912
+ return $output;
913
+
914
+ $id_field = $this->db_fields['id'];
915
+ $parent_field = $this->db_fields['parent'];
916
+
917
+ // flat display
918
+ if ( -1 == $max_depth ) {
919
+ $empty_array = array();
920
+ foreach ( $elements as $e )
921
+ $this->display_element( $e, $empty_array, 1, 0, $args, $output );
922
+ return $output;
923
+ }
924
+
925
+ /*
926
+ * need to display in hierarchical order
927
+ * separate elements into two buckets: top level and children elements
928
+ * children_elements is two dimensional array, eg.
929
+ * children_elements[10][] contains all sub-elements whose parent is 10.
930
+ */
931
+ $top_level_elements = array();
932
+ $children_elements = array();
933
+ foreach ( $elements as $e) {
934
+ if ( 0 == $e->$parent_field )
935
+ $top_level_elements[] = $e;
936
+ else
937
+ $children_elements[ $e->$parent_field ][] = $e;
938
+ }
939
+
940
+ /*
941
+ * when none of the elements is top level
942
+ * assume the first one must be root of the sub elements
943
+ */
944
+ if ( empty($top_level_elements) ) {
945
+
946
+ $first = array_slice( $elements, 0, 1 );
947
+ $root = $first[0];
948
+
949
+ $top_level_elements = array();
950
+ $children_elements = array();
951
+ foreach ( $elements as $e) {
952
+ if ( $root->$parent_field == $e->$parent_field )
953
+ $top_level_elements[] = $e;
954
+ else
955
+ $children_elements[ $e->$parent_field ][] = $e;
956
+ }
957
+ }
958
+
959
+ foreach ( $top_level_elements as $e )
960
+ $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
961
+
962
+ /*
963
+ * if we are displaying all levels, and remaining children_elements is not empty,
964
+ * then we got orphans, which should be displayed regardless
965
+ */
966
+ if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {
967
+ $empty_array = array();
968
+ foreach ( $children_elements as $orphans )
969
+ foreach( $orphans as $op )
970
+ $this->display_element( $op, $empty_array, 1, 0, $args, $output );
971
+ }
972
+
973
+ return $output;
974
+ }
975
  function start_lvl (&$output, $depth, $args)
976
  {
977
  $indent = str_repeat("\t", $depth);
2.8/css/avh-ec.admin.css CHANGED
@@ -12,15 +12,15 @@ div.clearer {
12
 
13
  /* Metabox in General */
14
  table.avhec-options {
15
- font-size: 11px;
16
  }
17
 
18
  .avhec-metabox-wrap {
19
- font-size: 11px;
20
  }
21
 
22
  .avhec-metabox-wrap .p {
23
- font-size: 11px;
24
  line-height: 140%;
25
  margin: 1em 0;
26
  }
@@ -30,7 +30,7 @@ table.avhec-options {
30
  }
31
 
32
  .avhec-metabox-wrap span.description {
33
- font-size: 11px;
34
  }
35
 
36
  .avhec-metabox-wrap .b {
@@ -48,16 +48,16 @@ table.avhec-options {
48
  }
49
 
50
  #avhec-options input {
51
- font-size: 11px;
52
  }
53
 
54
  #avhec-generaloptions input {
55
- font-size: 11px;
56
  }
57
 
58
  /* Metabox FAQ */
59
  #avhecBoxFAQ .inside ul {
60
- font-size: 11px;
61
  margin-bottom: 6px;
62
  }
63
  #avhecBoxFAQ .inside ul li{
@@ -68,7 +68,7 @@ table.avhec-options {
68
 
69
  /* Metabox Donations*/
70
  #avhecBoxDonations .inside {
71
- font-size: 12px;
72
  }
73
 
74
  #avhecBoxDonations .versions {
@@ -77,7 +77,7 @@ table.avhec-options {
77
 
78
  /* Metabox Donations*/
79
  #avhecBoxTranslation .inside {
80
- font-size: 12px;
81
  }
82
 
83
  /* Metabox in post and page */
@@ -105,4 +105,46 @@ table.avhec-options {
105
 
106
  #avhec-catlist li {
107
  margin-bottom: 0px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
12
 
13
  /* Metabox in General */
14
  table.avhec-options {
15
+
16
  }
17
 
18
  .avhec-metabox-wrap {
19
+
20
  }
21
 
22
  .avhec-metabox-wrap .p {
23
+
24
  line-height: 140%;
25
  margin: 1em 0;
26
  }
30
  }
31
 
32
  .avhec-metabox-wrap span.description {
33
+
34
  }
35
 
36
  .avhec-metabox-wrap .b {
48
  }
49
 
50
  #avhec-options input {
51
+
52
  }
53
 
54
  #avhec-generaloptions input {
55
+
56
  }
57
 
58
  /* Metabox FAQ */
59
  #avhecBoxFAQ .inside ul {
60
+
61
  margin-bottom: 6px;
62
  }
63
  #avhecBoxFAQ .inside ul li{
68
 
69
  /* Metabox Donations*/
70
  #avhecBoxDonations .inside {
71
+
72
  }
73
 
74
  #avhecBoxDonations .versions {
77
 
78
  /* Metabox Donations*/
79
  #avhecBoxTranslation .inside {
80
+
81
  }
82
 
83
  /* Metabox in post and page */
105
 
106
  #avhec-catlist li {
107
  margin-bottom: 0px;
108
+ }
109
+
110
+ #avhecManualOrder {
111
+ width: 25%;
112
+ /* border: 1px solid #B2B2B2;*/
113
+ /* margin: 10px 10px 10px 0px;*/
114
+ /* padding: 5px 10px 5px 10px;*/
115
+ /* list-style: none;*/
116
+ /* background-color: #fff;*/
117
+ /* border-radius: 3px;*/
118
+ /* -webkit-border-radius: 3px;*/
119
+ }
120
+
121
+ #avhecManualOrder li.lineitem {
122
+ border: 1px solid #DFDFDF;
123
+ background-image: none;
124
+ border-radius: 3px;
125
+ -webkit-border-radius: 3px;
126
+ background-color: #FFFFFF;
127
+ color: #555555;
128
+ cursor: move;
129
+ margin-top: 5px;
130
+ margin-bottom: 5px;
131
+ padding: 2px 5px 2px 5px;
132
+ list-style: none outside none;
133
+ }
134
+
135
+ #avhecManualOrder .sortable-placeholder {
136
+ border: 1px dashed #B2B2B2;
137
+ margin-top: 5px;
138
+ margin-bottom: 5px;
139
+ padding: 2px 5px 2px 5px;
140
+ height: 1.5em;
141
+ line-height: 1.5em;
142
+ list-style: none outside none;
143
+ background-color: transparent;
144
+ background-image: -ms-linear-gradient(top, #f9f9f9, #f5f5f5); /* IE10 */
145
+ background-image: -moz-linear-gradient(top, #f9f9f9, #f5f5f5); /* Firefox */
146
+ background-image: -o-linear-gradient(top, #f9f9f9, #f5f5f5); /* Opera */
147
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f5f5f5)); /* old Webkit */
148
+ background-image: -webkit-linear-gradient(top, #f9f9f9, #f5f5f5); /* new Webkit */
149
+ background-image: linear-gradient(top, #f9f9f9, #f5f5f5); /* proposed W3C Markup */
150
  }
2.8/js/avh-ec.admin.manualorder.closure.js ADDED
@@ -0,0 +1 @@
 
1
+ function avhecManualOrder(){jQuery("#avhecManualOrder").sortable({placeholder:"sortable-placeholder",revert:false,items:".lineitem",opacity:0.65,cursor:"move",forcePlaceholderSize:true,tolerance:"pointer"})}addLoadEvent(avhecManualOrder);function orderCats(){jQuery("#updateText").html("Updating Category Order...");jQuery("#hdnManualOrder").val(jQuery("#avhecManualOrder").sortable("toArray"))};
2.8/js/avh-ec.admin.manualorder.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function avhecManualOrder() {
2
+ jQuery("#avhecManualOrder").sortable({
3
+ placeholder : "sortable-placeholder",
4
+ revert : false,
5
+ items : '.lineitem',
6
+ opacity: 0.65,
7
+ cursor: 'move',
8
+ forcePlaceholderSize: true,
9
+ tolerance : "pointer"
10
+ });
11
+ };
12
+
13
+ addLoadEvent(avhecManualOrder);
14
+
15
+ function orderCats() {
16
+ jQuery("#updateText").html("Updating Category Order...");
17
+ jQuery("#hdnManualOrder").val(
18
+ jQuery("#avhecManualOrder").sortable("toArray"));
19
+ }
2.8/js/avh-ec.categorygroup.closure.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(a){a("#the-list").wpList({delBefore:function(b){if("undefined"!=showNotice)return showNotice.warn()?b:false;return b}});a('.delete a[class^="delete"]').live("click",function(){return false})});
2.8/js/avh-ec.categorygroup.js CHANGED
@@ -1 +1,21 @@
1
- jQuery(document).ready(function(d){var b=false,c,a;a=function(f,e){var h=d("cat",f).attr("id"),g;for(g=0;g<b.length;g++){if(h==b[g].value){b[g]=null}}};c=function(e){if("undefined"!=showNotice){return showNotice.warn()?e:false}return e};d("#the-list").wpList({delBefore:c});d('.delete a[class^="delete"]').live("click",function(){return false})});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ var options = false, delBefore, delAfter;
3
+
4
+ delAfter = function( r, settings ) {
5
+ var id = $('cat', r).attr('id'), o;
6
+ for ( o = 0; o < options.length; o++ )
7
+ if ( id == options[o].value )
8
+ options[o] = null;
9
+ };
10
+
11
+ delBefore = function(s) {
12
+ if ( 'undefined' != showNotice )
13
+ return showNotice.warn() ? s : false;
14
+
15
+ return s;
16
+ };
17
+
18
+ $('#the-list').wpList({ delBefore: delBefore });
19
+
20
+ $('.delete a[class^="delete"]').live('click', function(){return false;});
21
+ });
2.8/js/avh-ec.categorygroup.js.closure.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(a){a("#the-list").wpList({delBefore:function(b){if("undefined"!=showNotice)return showNotice.warn()?b:false;return b}});a('.delete a[class^="delete"]').live("click",function(){return false})});
2.8/lang/avh-ec.po DELETED
@@ -1,752 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: AVH Extended Categories\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-03-10 09:35-0500\n"
6
- "PO-Revision-Date: \n"
7
- "Last-Translator: Peter van der Does <peter@avirtualhome.com>\n"
8
- "Language-Team: \n"
9
- "Language: \n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-SourceCharset: utf-8\n"
14
- "X-Poedit-KeywordsList: __ngettext:1,2;__;_e\n"
15
- "X-Poedit-Basepath: .\n"
16
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Poedit-SearchPath-0: .\n"
18
- "X-Poedit-SearchPath-1: ..\n"
19
-
20
- #: ../class/avh-ec.admin.php:182
21
- #: ../class/avh-ec.admin.php:252
22
- msgid "Overview"
23
- msgstr ""
24
-
25
- #: ../class/avh-ec.admin.php:183
26
- #: ../class/avh-ec.admin.php:389
27
- msgid "General Options"
28
- msgstr ""
29
-
30
- #: ../class/avh-ec.admin.php:184
31
- #: ../class/avh-ec.admin.php:616
32
- #: ../class/avh-ec.category-group.php:112
33
- #: ../class/avh-ec.category-group.php:158
34
- #: ../class/avh-ec.category-group.php:159
35
- msgid "Category Groups"
36
- msgstr ""
37
-
38
- #: ../class/avh-ec.admin.php:185
39
- #: ../class/avh-ec.admin.php:765
40
- msgid "F.A.Q"
41
- msgstr ""
42
-
43
- #: ../class/avh-ec.admin.php:208
44
- #: ../class/avh-ec.admin.php:434
45
- msgid "Group Overview"
46
- msgstr ""
47
-
48
- #: ../class/avh-ec.admin.php:237
49
- #: ../class/avh-ec.admin.php:750
50
- msgid "Announcements"
51
- msgstr ""
52
-
53
- #: ../class/avh-ec.admin.php:238
54
- #: ../class/avh-ec.admin.php:375
55
- #: ../class/avh-ec.admin.php:751
56
- msgid "Donations"
57
- msgstr ""
58
-
59
- #: ../class/avh-ec.admin.php:280
60
- msgid "Options"
61
- msgstr ""
62
-
63
- #: ../class/avh-ec.admin.php:312
64
- msgid "<em>Select Category</em> Alternative"
65
- msgstr ""
66
-
67
- #: ../class/avh-ec.admin.php:312
68
- msgid "Alternative text for Select Category."
69
- msgstr ""
70
-
71
- #: ../class/avh-ec.admin.php:313
72
- msgid "Select which group to show on the home page."
73
- msgstr ""
74
-
75
- #: ../class/avh-ec.admin.php:313
76
- #: ../class/avh-ec.admin.php:314
77
- #: ../class/avh-ec.admin.php:315
78
- msgid "Selecting the group 'none' will not show the widget on the page."
79
- msgstr ""
80
-
81
- #: ../class/avh-ec.admin.php:314
82
- msgid "Select which group to show when there is no group associated with the post."
83
- msgstr ""
84
-
85
- #: ../class/avh-ec.admin.php:315
86
- msgid "Select which group will be the default group when editing a post."
87
- msgstr ""
88
-
89
- #: ../class/avh-ec.admin.php:349
90
- msgid "Options saved"
91
- msgstr ""
92
-
93
- #: ../class/avh-ec.admin.php:405
94
- msgid "Save Changes"
95
- msgstr ""
96
-
97
- #: ../class/avh-ec.admin.php:433
98
- msgid "Add Group"
99
- msgstr ""
100
-
101
- #: ../class/avh-ec.admin.php:435
102
- msgid "Special Pages"
103
- msgstr ""
104
-
105
- #: ../class/avh-ec.admin.php:466
106
- #: ../class/avh-ec.admin.php:471
107
- msgid " Group Name"
108
- msgstr ""
109
-
110
- #: ../class/avh-ec.admin.php:466
111
- #: ../class/avh-ec.admin.php:471
112
- msgid "The name is used to identify the group."
113
- msgstr ""
114
-
115
- #: ../class/avh-ec.admin.php:467
116
- #: ../class/avh-ec.admin.php:472
117
- msgid " Slug Group"
118
- msgstr ""
119
-
120
- #: ../class/avh-ec.admin.php:467
121
- #: ../class/avh-ec.admin.php:472
122
- msgid "The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens."
123
- msgstr ""
124
-
125
- #: ../class/avh-ec.admin.php:468
126
- msgid " Widget Title,"
127
- msgstr ""
128
-
129
- #: ../class/avh-ec.admin.php:468
130
- #: ../class/avh-ec.admin.php:473
131
- msgid "When no title is given in the widget options, this will used as the title of the widget when this group is shown."
132
- msgstr ""
133
-
134
- #: ../class/avh-ec.admin.php:469
135
- #: ../class/avh-ec.admin.php:474
136
- msgid " Description"
137
- msgstr ""
138
-
139
- #: ../class/avh-ec.admin.php:469
140
- #: ../class/avh-ec.admin.php:474
141
- msgid "Description is not prominent by default."
142
- msgstr ""
143
-
144
- #: ../class/avh-ec.admin.php:473
145
- msgid " Widget Title"
146
- msgstr ""
147
-
148
- #: ../class/avh-ec.admin.php:475
149
- msgid " Categories"
150
- msgstr ""
151
-
152
- #: ../class/avh-ec.admin.php:475
153
- msgid "Select categories to be included in the group."
154
- msgstr ""
155
-
156
- #: ../class/avh-ec.admin.php:491
157
- msgid "Category group saved"
158
- msgstr ""
159
-
160
- #: ../class/avh-ec.admin.php:497
161
- msgid "Category group conflicts with "
162
- msgstr ""
163
-
164
- #: ../class/avh-ec.admin.php:498
165
- msgid "Same slug is used. "
166
- msgstr ""
167
-
168
- #: ../class/avh-ec.admin.php:520
169
- msgid "Edit Group"
170
- msgstr ""
171
-
172
- #: ../class/avh-ec.admin.php:532
173
- msgid "Cheatin&#8217; uh?"
174
- msgstr ""
175
-
176
- #: ../class/avh-ec.admin.php:552
177
- msgid "Category group updated"
178
- msgstr ""
179
-
180
- #: ../class/avh-ec.admin.php:556
181
- msgid "Category group not updated"
182
- msgstr ""
183
-
184
- #: ../class/avh-ec.admin.php:557
185
- msgid "Duplicate slug detected"
186
- msgstr ""
187
-
188
- #: ../class/avh-ec.admin.php:561
189
- msgid "Unknown category group"
190
- msgstr ""
191
-
192
- #: ../class/avh-ec.admin.php:600
193
- msgid "Home page"
194
- msgstr ""
195
-
196
- #: ../class/avh-ec.admin.php:600
197
- #: ../class/avh-ec.admin.php:602
198
- #: ../class/avh-ec.admin.php:603
199
- #: ../class/avh-ec.admin.php:604
200
- #: ../class/avh-ec.admin.php:605
201
- #: ../class/avh-ec.admin.php:606
202
- #, php-format
203
- msgid "Select which category to show on the %s page."
204
- msgstr ""
205
-
206
- #: ../class/avh-ec.admin.php:600
207
- msgid "home"
208
- msgstr ""
209
-
210
- #: ../class/avh-ec.admin.php:602
211
- msgid "Daily Archive"
212
- msgstr ""
213
-
214
- #: ../class/avh-ec.admin.php:602
215
- msgid "daily archive"
216
- msgstr ""
217
-
218
- #: ../class/avh-ec.admin.php:603
219
- msgid "Monthly Archive"
220
- msgstr ""
221
-
222
- #: ../class/avh-ec.admin.php:603
223
- msgid "monthly archive"
224
- msgstr ""
225
-
226
- #: ../class/avh-ec.admin.php:604
227
- msgid "Yearly Archive"
228
- msgstr ""
229
-
230
- #: ../class/avh-ec.admin.php:604
231
- msgid "yearly archive"
232
- msgstr ""
233
-
234
- #: ../class/avh-ec.admin.php:605
235
- msgid "Author Archive"
236
- msgstr ""
237
-
238
- #: ../class/avh-ec.admin.php:605
239
- msgid "author archive"
240
- msgstr ""
241
-
242
- #: ../class/avh-ec.admin.php:606
243
- msgid "Search Page"
244
- msgstr ""
245
-
246
- #: ../class/avh-ec.admin.php:606
247
- msgid "search"
248
- msgstr ""
249
-
250
- #: ../class/avh-ec.admin.php:649
251
- msgid "Add group"
252
- msgstr ""
253
-
254
- #: ../class/avh-ec.admin.php:698
255
- msgid "Update group"
256
- msgstr ""
257
-
258
- #: ../class/avh-ec.admin.php:711
259
- msgid "Save settings"
260
- msgstr ""
261
-
262
- #: ../class/avh-ec.admin.php:722
263
- msgid "F.A.Q."
264
- msgstr ""
265
-
266
- #: ../class/avh-ec.admin.php:723
267
- msgid "Translation"
268
- msgstr ""
269
-
270
- #: ../class/avh-ec.admin.php:792
271
- msgid "This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language."
272
- msgstr ""
273
-
274
- #: ../class/avh-ec.admin.php:793
275
- msgid "You can visit "
276
- msgstr ""
277
-
278
- #: ../class/avh-ec.admin.php:793
279
- msgid "to help complete these translations or add a new language."
280
- msgstr ""
281
-
282
- #: ../class/avh-ec.admin.php:797
283
- msgid "Available Languages"
284
- msgstr ""
285
-
286
- #: ../class/avh-ec.admin.php:812
287
- msgid "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."
288
- msgstr ""
289
-
290
- #: ../class/avh-ec.admin.php:824
291
- msgid "If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation."
292
- msgstr ""
293
-
294
- #: ../class/avh-ec.admin.php:829
295
- msgid "If you decide to buy something from Amazon click the button."
296
- msgstr ""
297
-
298
- #: ../class/avh-ec.admin.php:834
299
- msgid "You can send me something from my "
300
- msgstr ""
301
-
302
- #: ../class/avh-ec.admin.php:834
303
- msgid "Amazon Wish List"
304
- msgstr ""
305
-
306
- #: ../class/avh-ec.admin.php:838
307
- msgid "Through Paypal."
308
- msgstr ""
309
-
310
- #: ../class/avh-ec.admin.php:839
311
- msgid "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."
312
- msgstr ""
313
-
314
- #: ../class/avh-ec.admin.php:853
315
- msgid "What about support?"
316
- msgstr ""
317
-
318
- #: ../class/avh-ec.admin.php:854
319
- msgid "I created a support site at http://forums.avirtualhome.com where you can ask questions or request features."
320
- msgstr ""
321
-
322
- #: ../class/avh-ec.admin.php:858
323
- msgid "What is depth selection?"
324
- msgstr ""
325
-
326
- #: ../class/avh-ec.admin.php:859
327
- msgid "Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well."
328
- msgstr ""
329
-
330
- #: ../class/avh-ec.admin.php:860
331
- msgid "Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:"
332
- msgstr ""
333
-
334
- #: ../class/avh-ec.admin.php:861
335
- msgid "You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only."
336
- msgstr ""
337
-
338
- #: ../class/avh-ec.admin.php:865
339
- msgid "Multiple Category Groups"
340
- msgstr ""
341
-
342
- #: ../class/avh-ec.admin.php:866
343
- msgid "The following is an explanation how assigning multiple groups to page/post works."
344
- msgstr ""
345
-
346
- #: ../class/avh-ec.admin.php:867
347
- msgid "Lets say you have the following groups:"
348
- msgstr ""
349
-
350
- #: ../class/avh-ec.admin.php:869
351
- msgid "Free Time"
352
- msgstr ""
353
-
354
- #: ../class/avh-ec.admin.php:870
355
- msgid "Theater"
356
- msgstr ""
357
-
358
- #: ../class/avh-ec.admin.php:871
359
- msgid "Movie"
360
- msgstr ""
361
-
362
- #: ../class/avh-ec.admin.php:872
363
- msgid "Music"
364
- msgstr ""
365
-
366
- #: ../class/avh-ec.admin.php:874
367
- msgid "Setup several Category Group widgets and associated each widget with one or more groups."
368
- msgstr ""
369
-
370
- #: ../class/avh-ec.admin.php:875
371
- msgid "Widget 1 has association with Free Time"
372
- msgstr ""
373
-
374
- #: ../class/avh-ec.admin.php:876
375
- msgid "Widget 2 has association with Theater, Movie and Music"
376
- msgstr ""
377
-
378
- #: ../class/avh-ec.admin.php:877
379
- msgid "Widget 3 has association with Theater, Movie and Music"
380
- msgstr ""
381
-
382
- #: ../class/avh-ec.admin.php:878
383
- msgid "Page has associations the groups Free Time and Theater"
384
- msgstr ""
385
-
386
- #: ../class/avh-ec.admin.php:880
387
- #: ../class/avh-ec.admin.php:892
388
- msgid "Widget 1: Shows categories of the Free Time group"
389
- msgstr ""
390
-
391
- #: ../class/avh-ec.admin.php:881
392
- msgid "Widget 2: Shows categories of the Theater group."
393
- msgstr ""
394
-
395
- #: ../class/avh-ec.admin.php:882
396
- #: ../class/avh-ec.admin.php:888
397
- msgid "Widget 3: Not displayed"
398
- msgstr ""
399
-
400
- #: ../class/avh-ec.admin.php:884
401
- msgid "Page has associations the group Movie."
402
- msgstr ""
403
-
404
- #: ../class/avh-ec.admin.php:886
405
- msgid "Widget 1: Not displayed"
406
- msgstr ""
407
-
408
- #: ../class/avh-ec.admin.php:887
409
- msgid "Widget 2: Shows categories of the Movie group."
410
- msgstr ""
411
-
412
- #: ../class/avh-ec.admin.php:890
413
- msgid "Page has associations the groups Free Time, Movie and Music"
414
- msgstr ""
415
-
416
- #: ../class/avh-ec.admin.php:893
417
- msgid "Widget 2: Shows categories of the Movie or Music group."
418
- msgstr ""
419
-
420
- #: ../class/avh-ec.admin.php:894
421
- msgid "Widget 3: Shows categories of the Music or Movie group."
422
- msgstr ""
423
-
424
- #: ../class/avh-ec.admin.php:896
425
- msgid "Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie."
426
- msgstr ""
427
-
428
- #: ../class/avh-ec.admin.php:904
429
- msgid "PHP4 Support"
430
- msgstr ""
431
-
432
- #: ../class/avh-ec.admin.php:905
433
- msgid "The next major release of the plugin will no longer support PHP4."
434
- msgstr ""
435
-
436
- #: ../class/avh-ec.admin.php:906
437
- msgid "It will be written for PHP 5.2 and "
438
- msgstr ""
439
-
440
- #: ../class/avh-ec.admin.php:908
441
- msgid "your blog already runs the needed PHP version. When the new release comes out you can safely update."
442
- msgstr ""
443
-
444
- #: ../class/avh-ec.admin.php:910
445
- msgid "your blog still runs PHP4. When the new release comes out you can not use it."
446
- msgstr ""
447
-
448
- #: ../class/avh-ec.admin.php:911
449
- msgid "I don't have a timeline for the next version but consider contacting your host if PHP 5.2 is available."
450
- msgstr ""
451
-
452
- #: ../class/avh-ec.admin.php:912
453
- msgid "If your hosts doesn't offer PHP 5.2 you might want to consider switching hosts."
454
- msgstr ""
455
-
456
- #: ../class/avh-ec.admin.php:913
457
- msgid "A host to consider is "
458
- msgstr ""
459
-
460
- #: ../class/avh-ec.admin.php:914
461
- msgid "I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price."
462
- msgstr ""
463
-
464
- #: ../class/avh-ec.admin.php:956
465
- msgid "Settings"
466
- msgstr ""
467
-
468
- #: ../class/avh-ec.admin.php:971
469
- #: ../class/avh-ec.widgets.php:217
470
- #: ../class/avh-ec.widgets.php:482
471
- #: ../class/avh-ec.widgets.php:780
472
- msgid "Name"
473
- msgstr ""
474
-
475
- #: ../class/avh-ec.admin.php:971
476
- msgid "Widget Title"
477
- msgstr ""
478
-
479
- #: ../class/avh-ec.admin.php:971
480
- msgid "Description"
481
- msgstr ""
482
-
483
- #: ../class/avh-ec.admin.php:971
484
- msgid "Categories in the group"
485
- msgstr ""
486
-
487
- #: ../class/avh-ec.admin.php:988
488
- #, php-format
489
- msgid "Your attempt to delete this group: &#8220;%s&#8221; has failed."
490
- msgstr ""
491
-
492
- #: ../class/avh-ec.admin.php:1050
493
- #, php-format
494
- msgid "Edit &#8220;%s&#8221;"
495
- msgstr ""
496
-
497
- #: ../class/avh-ec.admin.php:1052
498
- msgid "Edit"
499
- msgstr ""
500
-
501
- #: ../class/avh-ec.admin.php:1057
502
- msgid "Delete"
503
- msgstr ""
504
-
505
- #: ../class/avh-ec.category-group.php:112
506
- msgid "Category Group"
507
- msgstr ""
508
-
509
- #: ../class/avh-ec.category-group.php:112
510
- msgid "Search Category Groups"
511
- msgstr ""
512
-
513
- #: ../class/avh-ec.category-group.php:112
514
- msgid "Popular Category Groups"
515
- msgstr ""
516
-
517
- #: ../class/avh-ec.category-group.php:112
518
- msgid "All Category Groups"
519
- msgstr ""
520
-
521
- #: ../class/avh-ec.category-group.php:112
522
- msgid "Parent Category Group"
523
- msgstr ""
524
-
525
- #: ../class/avh-ec.category-group.php:112
526
- msgid "Parent Category Group:"
527
- msgstr ""
528
-
529
- #: ../class/avh-ec.category-group.php:112
530
- msgid "Edit Category Group"
531
- msgstr ""
532
-
533
- #: ../class/avh-ec.category-group.php:112
534
- msgid "Update Category Group"
535
- msgstr ""
536
-
537
- #: ../class/avh-ec.category-group.php:112
538
- msgid "Add New Category Group"
539
- msgstr ""
540
-
541
- #: ../class/avh-ec.category-group.php:112
542
- msgid "New Category Group Name"
543
- msgstr ""
544
-
545
- #: ../class/avh-ec.category-group.php:127
546
- msgid "This group will not show the widget."
547
- msgstr ""
548
-
549
- #: ../class/avh-ec.category-group.php:128
550
- msgid "Holds all the categories."
551
- msgstr ""
552
-
553
- #: ../class/avh-ec.category-group.php:129
554
- msgid "This group will be shown on the front page."
555
- msgstr ""
556
-
557
- #: ../class/avh-ec.core.php:382
558
- #: ../class/avh-ec.widgets.php:81
559
- #: ../class/avh-ec.widgets.php:359
560
- #: ../class/avh-ec.widgets.php:660
561
- msgid "Categories"
562
- msgstr ""
563
-
564
- #: ../class/avh-ec.core.php:413
565
- #: ../class/avh-ec.core.php:415
566
- msgid "No categories"
567
- msgstr ""
568
-
569
- #: ../class/avh-ec.core.php:625
570
- #, php-format
571
- msgid "View all posts filed under %s"
572
- msgstr ""
573
-
574
- #: ../class/avh-ec.core.php:640
575
- #, php-format
576
- msgid "Feed for all posts filed under %s"
577
- msgstr ""
578
-
579
- #: ../class/avh-ec.widgets.php:29
580
- msgid "An extended version of the default Categories widget."
581
- msgstr ""
582
-
583
- #: ../class/avh-ec.widgets.php:30
584
- msgid "AVH Extended Categories"
585
- msgstr ""
586
-
587
- #: ../class/avh-ec.widgets.php:103
588
- #: ../class/avh-ec.widgets.php:382
589
- #: ../class/avh-ec.widgets.php:669
590
- msgid "Select Category"
591
- msgstr ""
592
-
593
- #: ../class/avh-ec.widgets.php:193
594
- #: ../class/avh-ec.widgets.php:466
595
- #: ../class/avh-ec.widgets.php:764
596
- msgid "Title"
597
- msgstr ""
598
-
599
- #: ../class/avh-ec.widgets.php:197
600
- msgid "Show selected categories only"
601
- msgstr ""
602
-
603
- #: ../class/avh-ec.widgets.php:199
604
- #: ../class/avh-ec.widgets.php:474
605
- #: ../class/avh-ec.widgets.php:769
606
- msgid "Show post counts"
607
- msgstr ""
608
-
609
- #: ../class/avh-ec.widgets.php:201
610
- #: ../class/avh-ec.widgets.php:771
611
- msgid "Show hierarchy"
612
- msgstr ""
613
-
614
- #: ../class/avh-ec.widgets.php:203
615
- msgid "All Levels"
616
- msgstr ""
617
-
618
- #: ../class/avh-ec.widgets.php:203
619
- msgid "Toplevel only"
620
- msgstr ""
621
-
622
- #: ../class/avh-ec.widgets.php:205
623
- msgid "Child "
624
- msgstr ""
625
-
626
- #: ../class/avh-ec.widgets.php:207
627
- msgid "How many levels to show"
628
- msgstr ""
629
-
630
- #: ../class/avh-ec.widgets.php:210
631
- #: ../class/avh-ec.widgets.php:773
632
- msgid "Hide empty categories"
633
- msgstr ""
634
-
635
- #: ../class/avh-ec.widgets.php:212
636
- #: ../class/avh-ec.widgets.php:477
637
- #: ../class/avh-ec.widgets.php:775
638
- msgid "Use description for title"
639
- msgstr ""
640
-
641
- #: ../class/avh-ec.widgets.php:216
642
- #: ../class/avh-ec.widgets.php:481
643
- #: ../class/avh-ec.widgets.php:779
644
- msgid "ID"
645
- msgstr ""
646
-
647
- #: ../class/avh-ec.widgets.php:218
648
- #: ../class/avh-ec.widgets.php:483
649
- #: ../class/avh-ec.widgets.php:781
650
- msgid "Count"
651
- msgstr ""
652
-
653
- #: ../class/avh-ec.widgets.php:219
654
- #: ../class/avh-ec.widgets.php:484
655
- #: ../class/avh-ec.widgets.php:782
656
- msgid "Slug"
657
- msgstr ""
658
-
659
- #: ../class/avh-ec.widgets.php:220
660
- #: ../class/avh-ec.widgets.php:485
661
- #: ../class/avh-ec.widgets.php:783
662
- msgid "Sort by"
663
- msgstr ""
664
-
665
- #: ../class/avh-ec.widgets.php:223
666
- #: ../class/avh-ec.widgets.php:488
667
- #: ../class/avh-ec.widgets.php:786
668
- msgid "Ascending"
669
- msgstr ""
670
-
671
- #: ../class/avh-ec.widgets.php:224
672
- #: ../class/avh-ec.widgets.php:489
673
- #: ../class/avh-ec.widgets.php:787
674
- msgid "Descending"
675
- msgstr ""
676
-
677
- #: ../class/avh-ec.widgets.php:225
678
- #: ../class/avh-ec.widgets.php:490
679
- #: ../class/avh-ec.widgets.php:788
680
- msgid "Sort order"
681
- msgstr ""
682
-
683
- #: ../class/avh-ec.widgets.php:228
684
- #: ../class/avh-ec.widgets.php:493
685
- #: ../class/avh-ec.widgets.php:791
686
- msgid "List"
687
- msgstr ""
688
-
689
- #: ../class/avh-ec.widgets.php:229
690
- #: ../class/avh-ec.widgets.php:494
691
- #: ../class/avh-ec.widgets.php:792
692
- msgid "Drop down"
693
- msgstr ""
694
-
695
- #: ../class/avh-ec.widgets.php:230
696
- #: ../class/avh-ec.widgets.php:495
697
- #: ../class/avh-ec.widgets.php:793
698
- msgid "Display style"
699
- msgstr ""
700
-
701
- #: ../class/avh-ec.widgets.php:236
702
- #: ../class/avh-ec.widgets.php:501
703
- #: ../class/avh-ec.widgets.php:799
704
- msgid "Show RSS Feed"
705
- msgstr ""
706
-
707
- #: ../class/avh-ec.widgets.php:238
708
- #: ../class/avh-ec.widgets.php:503
709
- #: ../class/avh-ec.widgets.php:801
710
- msgid "Path (URI) to RSS image"
711
- msgstr ""
712
-
713
- #: ../class/avh-ec.widgets.php:243
714
- msgid "Select categories"
715
- msgstr ""
716
-
717
- #: ../class/avh-ec.widgets.php:248
718
- msgid "All Categories"
719
- msgstr ""
720
-
721
- #: ../class/avh-ec.widgets.php:258
722
- msgid "Exclude the selected categories"
723
- msgstr ""
724
-
725
- #: ../class/avh-ec.widgets.php:329
726
- msgid "Shows the top categories."
727
- msgstr ""
728
-
729
- #: ../class/avh-ec.widgets.php:330
730
- msgid "AVH Extended Categories: Top Categories"
731
- msgstr ""
732
-
733
- #: ../class/avh-ec.widgets.php:470
734
- msgid "How many categories to show"
735
- msgstr ""
736
-
737
- #: ../class/avh-ec.widgets.php:538
738
- msgid "Shows grouped categories."
739
- msgstr ""
740
-
741
- #: ../class/avh-ec.widgets.php:539
742
- msgid "AVH Extended Category: Category Group"
743
- msgstr ""
744
-
745
- #: ../class/avh-ec.widgets.php:805
746
- msgid "Select Groups"
747
- msgstr ""
748
-
749
- #: ../class/avh-ec.widgets.php:810
750
- msgid "Any Group"
751
- msgstr ""
752
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2.8/lang/avh-ec.pot DELETED
@@ -1,720 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: AVH Extended Categories\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-02-13 22:02-0500\n"
6
- "PO-Revision-Date: \n"
7
- "Last-Translator: Peter van der Does <peter@avirtualhome.com>\n"
8
- "Language-Team: \n"
9
- "Language: \n"
10
- "MIME-Version: 1.0\n"
11
- "Content-Type: text/plain; charset=UTF-8\n"
12
- "Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-SourceCharset: utf-8\n"
14
- "X-Poedit-KeywordsList: __ngettext:1,2;__;_e\n"
15
- "X-Poedit-Basepath: .\n"
16
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Poedit-SearchPath-0: .\n"
18
- "X-Poedit-SearchPath-1: ..\n"
19
-
20
- #: ../class/avh-ec.admin.php:108
21
- #: ../class/avh-ec.admin.php:179
22
- msgid "Overview"
23
- msgstr ""
24
-
25
- #: ../class/avh-ec.admin.php:109
26
- #: ../class/avh-ec.admin.php:320
27
- msgid "General Options"
28
- msgstr ""
29
-
30
- #: ../class/avh-ec.admin.php:110
31
- #: ../class/avh-ec.admin.php:551
32
- #: ../class/avh-ec.category-group.php:85
33
- msgid "Category Groups"
34
- msgstr ""
35
-
36
- #: ../class/avh-ec.admin.php:111
37
- #: ../class/avh-ec.admin.php:700
38
- msgid "F.A.Q"
39
- msgstr ""
40
-
41
- #: ../class/avh-ec.admin.php:134
42
- #: ../class/avh-ec.admin.php:365
43
- msgid "Group Overview"
44
- msgstr ""
45
-
46
- #: ../class/avh-ec.admin.php:163
47
- #: ../class/avh-ec.admin.php:684
48
- msgid "Announcements"
49
- msgstr ""
50
-
51
- #: ../class/avh-ec.admin.php:164
52
- #: ../class/avh-ec.admin.php:305
53
- #: ../class/avh-ec.admin.php:685
54
- msgid "Donations"
55
- msgstr ""
56
-
57
- #: ../class/avh-ec.admin.php:207
58
- msgid "Options"
59
- msgstr ""
60
-
61
- #: ../class/avh-ec.admin.php:239
62
- msgid "<em>Select Category</em> Alternative"
63
- msgstr ""
64
-
65
- #: ../class/avh-ec.admin.php:239
66
- msgid "Alternative text for Select Category."
67
- msgstr ""
68
-
69
- #: ../class/avh-ec.admin.php:240
70
- msgid "Select which group to show on the home page."
71
- msgstr ""
72
-
73
- #: ../class/avh-ec.admin.php:240
74
- #: ../class/avh-ec.admin.php:241
75
- #: ../class/avh-ec.admin.php:242
76
- msgid "Selecting the group 'none' will not show the widget on the page."
77
- msgstr ""
78
-
79
- #: ../class/avh-ec.admin.php:241
80
- msgid "Select which group to show when there is no group associated with the post."
81
- msgstr ""
82
-
83
- #: ../class/avh-ec.admin.php:242
84
- msgid "Select which group will be the default group when editing a post."
85
- msgstr ""
86
-
87
- #: ../class/avh-ec.admin.php:278
88
- msgid "Options saved"
89
- msgstr ""
90
-
91
- #: ../class/avh-ec.admin.php:336
92
- msgid "Save Changes"
93
- msgstr ""
94
-
95
- #: ../class/avh-ec.admin.php:364
96
- msgid "Add Group"
97
- msgstr ""
98
-
99
- #: ../class/avh-ec.admin.php:366
100
- msgid "Special Pages"
101
- msgstr ""
102
-
103
- #: ../class/avh-ec.admin.php:397
104
- #: ../class/avh-ec.admin.php:402
105
- msgid " Group Name"
106
- msgstr ""
107
-
108
- #: ../class/avh-ec.admin.php:397
109
- #: ../class/avh-ec.admin.php:402
110
- msgid "The name is used to identify the group."
111
- msgstr ""
112
-
113
- #: ../class/avh-ec.admin.php:398
114
- #: ../class/avh-ec.admin.php:403
115
- msgid " Slug Group"
116
- msgstr ""
117
-
118
- #: ../class/avh-ec.admin.php:398
119
- #: ../class/avh-ec.admin.php:403
120
- msgid "The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens."
121
- msgstr ""
122
-
123
- #: ../class/avh-ec.admin.php:399
124
- msgid " Widget Title,"
125
- msgstr ""
126
-
127
- #: ../class/avh-ec.admin.php:399
128
- #: ../class/avh-ec.admin.php:404
129
- msgid "When no title is given in the widget options, this will used as the title of the widget when this group is shown."
130
- msgstr ""
131
-
132
- #: ../class/avh-ec.admin.php:400
133
- #: ../class/avh-ec.admin.php:405
134
- msgid " Description"
135
- msgstr ""
136
-
137
- #: ../class/avh-ec.admin.php:400
138
- #: ../class/avh-ec.admin.php:405
139
- msgid "Description is not prominent by default."
140
- msgstr ""
141
-
142
- #: ../class/avh-ec.admin.php:404
143
- msgid " Widget Title"
144
- msgstr ""
145
-
146
- #: ../class/avh-ec.admin.php:406
147
- msgid " Categories"
148
- msgstr ""
149
-
150
- #: ../class/avh-ec.admin.php:406
151
- msgid "Select categories to be included in the group."
152
- msgstr ""
153
-
154
- #: ../class/avh-ec.admin.php:423
155
- msgid "Category group saved"
156
- msgstr ""
157
-
158
- #: ../class/avh-ec.admin.php:429
159
- msgid "Category group conflicts with "
160
- msgstr ""
161
-
162
- #: ../class/avh-ec.admin.php:430
163
- msgid "Same slug is used. "
164
- msgstr ""
165
-
166
- #: ../class/avh-ec.admin.php:453
167
- msgid "Edit Group"
168
- msgstr ""
169
-
170
- #: ../class/avh-ec.admin.php:465
171
- msgid "Cheatin&#8217; uh?"
172
- msgstr ""
173
-
174
- #: ../class/avh-ec.admin.php:486
175
- msgid "Category group updated"
176
- msgstr ""
177
-
178
- #: ../class/avh-ec.admin.php:490
179
- msgid "Category group not updated"
180
- msgstr ""
181
-
182
- #: ../class/avh-ec.admin.php:491
183
- msgid "Duplicate slug detected"
184
- msgstr ""
185
-
186
- #: ../class/avh-ec.admin.php:495
187
- msgid "Unknown category group"
188
- msgstr ""
189
-
190
- #: ../class/avh-ec.admin.php:535
191
- msgid "Home page"
192
- msgstr ""
193
-
194
- #: ../class/avh-ec.admin.php:536
195
- msgid "Category Archive"
196
- msgstr ""
197
-
198
- #: ../class/avh-ec.admin.php:537
199
- msgid "Daily Archive"
200
- msgstr ""
201
-
202
- #: ../class/avh-ec.admin.php:538
203
- msgid "Monthly Archive"
204
- msgstr ""
205
-
206
- #: ../class/avh-ec.admin.php:539
207
- msgid "Yearly Archive"
208
- msgstr ""
209
-
210
- #: ../class/avh-ec.admin.php:540
211
- msgid "Author Archive"
212
- msgstr ""
213
-
214
- #: ../class/avh-ec.admin.php:541
215
- msgid "Search Page"
216
- msgstr ""
217
-
218
- #: ../class/avh-ec.admin.php:584
219
- msgid "Add group"
220
- msgstr ""
221
-
222
- #: ../class/avh-ec.admin.php:633
223
- msgid "Update group"
224
- msgstr ""
225
-
226
- #: ../class/avh-ec.admin.php:646
227
- msgid "Save settings"
228
- msgstr ""
229
-
230
- #: ../class/avh-ec.admin.php:656
231
- msgid "F.A.Q."
232
- msgstr ""
233
-
234
- #: ../class/avh-ec.admin.php:657
235
- msgid "Translation"
236
- msgstr ""
237
-
238
- #: ../class/avh-ec.admin.php:727
239
- msgid "This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language."
240
- msgstr ""
241
-
242
- #: ../class/avh-ec.admin.php:728
243
- msgid "You can visit "
244
- msgstr ""
245
-
246
- #: ../class/avh-ec.admin.php:728
247
- msgid "to help complete these translations or add a new language."
248
- msgstr ""
249
-
250
- #: ../class/avh-ec.admin.php:732
251
- msgid "Available Languages"
252
- msgstr ""
253
-
254
- #: ../class/avh-ec.admin.php:747
255
- msgid "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."
256
- msgstr ""
257
-
258
- #: ../class/avh-ec.admin.php:759
259
- msgid "If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation."
260
- msgstr ""
261
-
262
- #: ../class/avh-ec.admin.php:764
263
- msgid "If you decide to buy something from Amazon click the button."
264
- msgstr ""
265
-
266
- #: ../class/avh-ec.admin.php:769
267
- msgid "You can send me something from my "
268
- msgstr ""
269
-
270
- #: ../class/avh-ec.admin.php:769
271
- msgid "Amazon Wish List"
272
- msgstr ""
273
-
274
- #: ../class/avh-ec.admin.php:773
275
- msgid "Through Paypal."
276
- msgstr ""
277
-
278
- #: ../class/avh-ec.admin.php:774
279
- msgid "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."
280
- msgstr ""
281
-
282
- #: ../class/avh-ec.admin.php:789
283
- msgid "What about support?"
284
- msgstr ""
285
-
286
- #: ../class/avh-ec.admin.php:790
287
- msgid "I created a support site at http://forums.avirtualhome.com where you can ask questions or request features."
288
- msgstr ""
289
-
290
- #: ../class/avh-ec.admin.php:794
291
- msgid "What is depth selection?"
292
- msgstr ""
293
-
294
- #: ../class/avh-ec.admin.php:795
295
- msgid "Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well."
296
- msgstr ""
297
-
298
- #: ../class/avh-ec.admin.php:796
299
- msgid "Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:"
300
- msgstr ""
301
-
302
- #: ../class/avh-ec.admin.php:797
303
- msgid "You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only."
304
- msgstr ""
305
-
306
- #: ../class/avh-ec.admin.php:801
307
- msgid "Multiple Category Groups"
308
- msgstr ""
309
-
310
- #: ../class/avh-ec.admin.php:802
311
- msgid "The following is an explanation how assigning multiple groups to page/post works."
312
- msgstr ""
313
-
314
- #: ../class/avh-ec.admin.php:803
315
- msgid "Lets say you have the following groups:"
316
- msgstr ""
317
-
318
- #: ../class/avh-ec.admin.php:805
319
- msgid "Free Time"
320
- msgstr ""
321
-
322
- #: ../class/avh-ec.admin.php:806
323
- msgid "Theater"
324
- msgstr ""
325
-
326
- #: ../class/avh-ec.admin.php:807
327
- msgid "Movie"
328
- msgstr ""
329
-
330
- #: ../class/avh-ec.admin.php:808
331
- msgid "Music"
332
- msgstr ""
333
-
334
- #: ../class/avh-ec.admin.php:811
335
- msgid "Setup several Category Group widgets and associated each widget with one or more groups."
336
- msgstr ""
337
-
338
- #: ../class/avh-ec.admin.php:812
339
- msgid "Widget 1 has association with Free Time"
340
- msgstr ""
341
-
342
- #: ../class/avh-ec.admin.php:813
343
- msgid "Widget 2 has association with Theater, Movie and Music"
344
- msgstr ""
345
-
346
- #: ../class/avh-ec.admin.php:814
347
- msgid "Widget 3 has association with Theater, Movie and Music"
348
- msgstr ""
349
-
350
- #: ../class/avh-ec.admin.php:816
351
- msgid "Page has associations the groups Free Time and Theater"
352
- msgstr ""
353
-
354
- #: ../class/avh-ec.admin.php:818
355
- #: ../class/avh-ec.admin.php:832
356
- msgid "Widget 1: Shows categories of the Free Time group"
357
- msgstr ""
358
-
359
- #: ../class/avh-ec.admin.php:819
360
- msgid "Widget 2: Shows categories of the Theater group."
361
- msgstr ""
362
-
363
- #: ../class/avh-ec.admin.php:820
364
- #: ../class/avh-ec.admin.php:827
365
- msgid "Widget 3: Not displayed"
366
- msgstr ""
367
-
368
- #: ../class/avh-ec.admin.php:823
369
- msgid "Page has associations the group Movie."
370
- msgstr ""
371
-
372
- #: ../class/avh-ec.admin.php:825
373
- msgid "Widget 1: Not displayed"
374
- msgstr ""
375
-
376
- #: ../class/avh-ec.admin.php:826
377
- msgid "Widget 2: Shows categories of the Movie group."
378
- msgstr ""
379
-
380
- #: ../class/avh-ec.admin.php:830
381
- msgid "Page has associations the groups Free Time, Movie and Music"
382
- msgstr ""
383
-
384
- #: ../class/avh-ec.admin.php:833
385
- msgid "Widget 2: Shows categories of the Movie or Music group."
386
- msgstr ""
387
-
388
- #: ../class/avh-ec.admin.php:834
389
- msgid "Widget 3: Shows categories of the Music or Movie group."
390
- msgstr ""
391
-
392
- #: ../class/avh-ec.admin.php:837
393
- msgid "Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie."
394
- msgstr ""
395
-
396
- #: ../class/avh-ec.admin.php:846
397
- msgid "PHP4 Support"
398
- msgstr ""
399
-
400
- #: ../class/avh-ec.admin.php:847
401
- msgid "The next major release of the plugin will no longer support PHP4."
402
- msgstr ""
403
-
404
- #: ../class/avh-ec.admin.php:848
405
- msgid "It will be written for PHP 5.2 and "
406
- msgstr ""
407
-
408
- #: ../class/avh-ec.admin.php:850
409
- msgid "your blog already runs the needed PHP version. When the new release comes out you can safely update."
410
- msgstr ""
411
-
412
- #: ../class/avh-ec.admin.php:852
413
- msgid "your blog still runs PHP4. When the new release comes out you can not use it."
414
- msgstr ""
415
-
416
- #: ../class/avh-ec.admin.php:853
417
- msgid "I don't have a timeline for the next version but consider contacting your host if PHP 5.2 is available."
418
- msgstr ""
419
-
420
- #: ../class/avh-ec.admin.php:854
421
- msgid "If your hosts doesn't offer PHP 5.2 you might want to consider switching hosts."
422
- msgstr ""
423
-
424
- #: ../class/avh-ec.admin.php:855
425
- msgid "A host to consider is "
426
- msgstr ""
427
-
428
- #: ../class/avh-ec.admin.php:856
429
- msgid "I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price."
430
- msgstr ""
431
-
432
- #: ../class/avh-ec.admin.php:899
433
- msgid "Settings"
434
- msgstr ""
435
-
436
- #: ../class/avh-ec.admin.php:914
437
- #: ../class/avh-ec.widgets.php:216
438
- #: ../class/avh-ec.widgets.php:487
439
- #: ../class/avh-ec.widgets.php:760
440
- msgid "Name"
441
- msgstr ""
442
-
443
- #: ../class/avh-ec.admin.php:914
444
- msgid "Widget Title"
445
- msgstr ""
446
-
447
- #: ../class/avh-ec.admin.php:914
448
- msgid "Description"
449
- msgstr ""
450
-
451
- #: ../class/avh-ec.admin.php:914
452
- msgid "Categories in the group"
453
- msgstr ""
454
-
455
- #: ../class/avh-ec.admin.php:931
456
- #, php-format
457
- msgid "Your attempt to delete this group: &#8220;%s&#8221; has failed."
458
- msgstr ""
459
-
460
- #: ../class/avh-ec.admin.php:993
461
- #, php-format
462
- msgid "Edit &#8220;%s&#8221;"
463
- msgstr ""
464
-
465
- #: ../class/avh-ec.admin.php:995
466
- msgid "Edit"
467
- msgstr ""
468
-
469
- #: ../class/avh-ec.admin.php:1000
470
- msgid "Delete"
471
- msgstr ""
472
-
473
- #: ../class/avh-ec.category-group.php:85
474
- msgid "Category Group"
475
- msgstr ""
476
-
477
- #: ../class/avh-ec.category-group.php:85
478
- msgid "Search Category Groups"
479
- msgstr ""
480
-
481
- #: ../class/avh-ec.category-group.php:85
482
- msgid "Popular Category Groups"
483
- msgstr ""
484
-
485
- #: ../class/avh-ec.category-group.php:85
486
- msgid "All Category Groups"
487
- msgstr ""
488
-
489
- #: ../class/avh-ec.category-group.php:85
490
- msgid "Parent Category Group"
491
- msgstr ""
492
-
493
- #: ../class/avh-ec.category-group.php:85
494
- msgid "Parent Category Group:"
495
- msgstr ""
496
-
497
- #: ../class/avh-ec.category-group.php:85
498
- msgid "Edit Category Group"
499
- msgstr ""
500
-
501
- #: ../class/avh-ec.category-group.php:85
502
- msgid "Update Category Group"
503
- msgstr ""
504
-
505
- #: ../class/avh-ec.category-group.php:85
506
- msgid "Add New Category Group"
507
- msgstr ""
508
-
509
- #: ../class/avh-ec.category-group.php:85
510
- msgid "New Category Group Name"
511
- msgstr ""
512
-
513
- #: ../class/avh-ec.category-group.php:90
514
- msgid "This group will not show the widget."
515
- msgstr ""
516
-
517
- #: ../class/avh-ec.category-group.php:91
518
- msgid "Holds all the categories."
519
- msgstr ""
520
-
521
- #: ../class/avh-ec.category-group.php:92
522
- msgid "This group will be shown on the front page."
523
- msgstr ""
524
-
525
- #: ../class/avh-ec.core.php:374
526
- #: ../class/avh-ec.widgets.php:80
527
- #: ../class/avh-ec.widgets.php:364
528
- #: ../class/avh-ec.widgets.php:640
529
- msgid "Categories"
530
- msgstr ""
531
-
532
- #: ../class/avh-ec.core.php:405
533
- #: ../class/avh-ec.core.php:407
534
- msgid "No categories"
535
- msgstr ""
536
-
537
- #: ../class/avh-ec.core.php:616
538
- #, php-format
539
- msgid "View all posts filed under %s"
540
- msgstr ""
541
-
542
- #: ../class/avh-ec.core.php:631
543
- #, php-format
544
- msgid "Feed for all posts filed under %s"
545
- msgstr ""
546
-
547
- #: ../class/avh-ec.widgets.php:28
548
- msgid "An extended version of the default Categories widget."
549
- msgstr ""
550
-
551
- #: ../class/avh-ec.widgets.php:29
552
- msgid "AVH Extended Categories"
553
- msgstr ""
554
-
555
- #: ../class/avh-ec.widgets.php:102
556
- #: ../class/avh-ec.widgets.php:387
557
- #: ../class/avh-ec.widgets.php:649
558
- msgid "Select Category"
559
- msgstr ""
560
-
561
- #: ../class/avh-ec.widgets.php:192
562
- #: ../class/avh-ec.widgets.php:471
563
- #: ../class/avh-ec.widgets.php:744
564
- msgid "Title"
565
- msgstr ""
566
-
567
- #: ../class/avh-ec.widgets.php:196
568
- msgid "Show selected categories only"
569
- msgstr ""
570
-
571
- #: ../class/avh-ec.widgets.php:198
572
- #: ../class/avh-ec.widgets.php:479
573
- #: ../class/avh-ec.widgets.php:749
574
- msgid "Show post counts"
575
- msgstr ""
576
-
577
- #: ../class/avh-ec.widgets.php:200
578
- #: ../class/avh-ec.widgets.php:751
579
- msgid "Show hierarchy"
580
- msgstr ""
581
-
582
- #: ../class/avh-ec.widgets.php:202
583
- msgid "All Levels"
584
- msgstr ""
585
-
586
- #: ../class/avh-ec.widgets.php:202
587
- msgid "Toplevel only"
588
- msgstr ""
589
-
590
- #: ../class/avh-ec.widgets.php:204
591
- msgid "Child "
592
- msgstr ""
593
-
594
- #: ../class/avh-ec.widgets.php:206
595
- msgid "How many levels to show"
596
- msgstr ""
597
-
598
- #: ../class/avh-ec.widgets.php:209
599
- #: ../class/avh-ec.widgets.php:753
600
- msgid "Hide empty categories"
601
- msgstr ""
602
-
603
- #: ../class/avh-ec.widgets.php:211
604
- #: ../class/avh-ec.widgets.php:482
605
- #: ../class/avh-ec.widgets.php:755
606
- msgid "Use description for title"
607
- msgstr ""
608
-
609
- #: ../class/avh-ec.widgets.php:215
610
- #: ../class/avh-ec.widgets.php:486
611
- #: ../class/avh-ec.widgets.php:759
612
- msgid "ID"
613
- msgstr ""
614
-
615
- #: ../class/avh-ec.widgets.php:217
616
- #: ../class/avh-ec.widgets.php:488
617
- #: ../class/avh-ec.widgets.php:761
618
- msgid "Count"
619
- msgstr ""
620
-
621
- #: ../class/avh-ec.widgets.php:218
622
- #: ../class/avh-ec.widgets.php:489
623
- #: ../class/avh-ec.widgets.php:762
624
- msgid "Slug"
625
- msgstr ""
626
-
627
- #: ../class/avh-ec.widgets.php:219
628
- #: ../class/avh-ec.widgets.php:490
629
- #: ../class/avh-ec.widgets.php:763
630
- msgid "Sort by"
631
- msgstr ""
632
-
633
- #: ../class/avh-ec.widgets.php:222
634
- #: ../class/avh-ec.widgets.php:493
635
- #: ../class/avh-ec.widgets.php:766
636
- msgid "Ascending"
637
- msgstr ""
638
-
639
- #: ../class/avh-ec.widgets.php:223
640
- #: ../class/avh-ec.widgets.php:494
641
- #: ../class/avh-ec.widgets.php:767
642
- msgid "Descending"
643
- msgstr ""
644
-
645
- #: ../class/avh-ec.widgets.php:224
646
- #: ../class/avh-ec.widgets.php:495
647
- #: ../class/avh-ec.widgets.php:768
648
- msgid "Sort order"
649
- msgstr ""
650
-
651
- #: ../class/avh-ec.widgets.php:227
652
- #: ../class/avh-ec.widgets.php:498
653
- #: ../class/avh-ec.widgets.php:771
654
- msgid "List"
655
- msgstr ""
656
-
657
- #: ../class/avh-ec.widgets.php:228
658
- #: ../class/avh-ec.widgets.php:499
659
- #: ../class/avh-ec.widgets.php:772
660
- msgid "Drop down"
661
- msgstr ""
662
-
663
- #: ../class/avh-ec.widgets.php:229
664
- #: ../class/avh-ec.widgets.php:500
665
- #: ../class/avh-ec.widgets.php:773
666
- msgid "Display style"
667
- msgstr ""
668
-
669
- #: ../class/avh-ec.widgets.php:235
670
- #: ../class/avh-ec.widgets.php:506
671
- #: ../class/avh-ec.widgets.php:779
672
- msgid "Show RSS Feed"
673
- msgstr ""
674
-
675
- #: ../class/avh-ec.widgets.php:237
676
- #: ../class/avh-ec.widgets.php:508
677
- #: ../class/avh-ec.widgets.php:781
678
- msgid "Path (URI) to RSS image"
679
- msgstr ""
680
-
681
- #: ../class/avh-ec.widgets.php:242
682
- msgid "Select categories"
683
- msgstr ""
684
-
685
- #: ../class/avh-ec.widgets.php:247
686
- msgid "All Categories"
687
- msgstr ""
688
-
689
- #: ../class/avh-ec.widgets.php:257
690
- msgid "Exclude the selected categories"
691
- msgstr ""
692
-
693
- #: ../class/avh-ec.widgets.php:334
694
- msgid "Shows the top categories."
695
- msgstr ""
696
-
697
- #: ../class/avh-ec.widgets.php:335
698
- msgid "AVH Extended Categories: Top Categories"
699
- msgstr ""
700
-
701
- #: ../class/avh-ec.widgets.php:475
702
- msgid "How many categories to show"
703
- msgstr ""
704
-
705
- #: ../class/avh-ec.widgets.php:536
706
- msgid "Shows grouped categories."
707
- msgstr ""
708
-
709
- #: ../class/avh-ec.widgets.php:537
710
- msgid "AVH Extended Category: Category Group"
711
- msgstr ""
712
-
713
- #: ../class/avh-ec.widgets.php:785
714
- msgid "Select Groups"
715
- msgstr ""
716
-
717
- #: ../class/avh-ec.widgets.php:790
718
- msgid "Any Group"
719
- msgstr ""
720
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3.3/avh-ec.client.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Singleton Class
5
+ *
6
+ */
7
+ class AVH_EC_Singleton
8
+ {
9
+
10
+ /**
11
+ *
12
+ * @param $class
13
+ * @param $arg1
14
+ */
15
+ function &getInstance ($class, $arg1 = null)
16
+ {
17
+ static $instances = array (); // array of instance names
18
+ if (array_key_exists($class, $instances)) {
19
+ $instance = & $instances[$class];
20
+ } else {
21
+ if (! class_exists($class)) {
22
+ switch ($class) {
23
+ case 'AVH_EC_Core':
24
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.core.php');
25
+ break;
26
+ case 'AVH_EC_Category_Group':
27
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.category-group.php');
28
+ break;
29
+ case 'AVH_EC_Widget_Helper_Class':
30
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widget-helper.php');
31
+ break;
32
+ }
33
+ }
34
+ $instances[$class] = new $class($arg1);
35
+ $instance = & $instances[$class];
36
+ }
37
+ return $instance;
38
+ } // getInstance
39
+ } // singleton
40
+
41
+
42
+ /**
43
+ * Include the necessary files
44
+ *
45
+ */
46
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-forms.php');
47
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widgets.php');
48
+
49
+ /**
50
+ * Initialize the plugin
51
+ *
52
+ */
53
+ function avhextendedcategories_init ()
54
+ {
55
+ // Admin
56
+ if (is_admin()) {
57
+ require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.admin.php');
58
+ $avhec_admin = new AVH_EC_Admin();
59
+ }
60
+ AVH_EC_Singleton::getInstance('AVH_EC_Core');
61
+
62
+ add_action('widgets_init', 'avhextendedcategories_widgets_init');
63
+
64
+ } // End avhamazon_init()
65
+
66
+
67
+ /**
68
+ * Register the widget
69
+ *
70
+ * @WordPress Action widgets_init
71
+ * @since 3.0
72
+ *
73
+ */
74
+ function avhextendedcategories_widgets_init ()
75
+ {
76
+ register_widget('WP_Widget_AVH_ExtendedCategories_Normal');
77
+ register_widget('WP_Widget_AVH_ExtendedCategories_Top');
78
+ register_widget('WP_Widget_AVH_ExtendedCategories_Category_Group');
79
+ }
80
+
81
+ add_action('plugins_loaded', 'avhextendedcategories_init');
82
+ ?>
3.3/class/avh-ec.admin.php ADDED
@@ -0,0 +1,1490 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AVH_EC_Admin
4
+ {
5
+ /**
6
+ *
7
+ * @var AVH_EC_Core
8
+ */
9
+ var $core;
10
+
11
+ /**
12
+ *
13
+ * @var AVH_EC_Category_Group
14
+ */
15
+ var $catgrp;
16
+
17
+ var $hooks = array ();
18
+ var $message;
19
+
20
+ /**
21
+ * PHP5 constructor
22
+ *
23
+ */
24
+ function __construct ()
25
+ {
26
+
27
+ // Initialize the plugin
28
+ $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
29
+ $this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
30
+
31
+ add_action('wp_ajax_delete-group', array ( &$this, 'ajaxDeleteGroup' ));
32
+
33
+ // Admin menu
34
+ add_action('admin_init', array ( &$this, 'actionAdminInit' ));
35
+ add_action('admin_menu', array ( &$this, 'actionAdminMenu' ));
36
+ add_filter('plugin_action_links_extended-categories-widget/widget_extended_categories.php', array ( &$this, 'filterPluginActions' ), 10, 2);
37
+
38
+ // Actions used for editing posts
39
+ add_action('load-post.php', array ( &$this, 'actionLoadPostPage' ));
40
+ add_action('load-page.php', array ( &$this, 'actionLoadPostPage' ));
41
+
42
+ // Actions related to adding and deletes categories
43
+ add_action("created_category", array ( $this, 'actionCreatedCategory' ), 10, 2);
44
+ add_action("delete_category", array ( $this, 'actionDeleteCategory' ), 10, 2);
45
+
46
+ add_filter('manage_categories_group_columns', array ( &$this, 'filterManageCategoriesGroupColumns' ));
47
+ add_filter('explain_nonce_delete-avhecgroup', array ( &$this, 'filterExplainNonceDeleteGroup' ), 10, 2);
48
+
49
+ return;
50
+ }
51
+
52
+ /**
53
+ * PHP4 Constructor
54
+ *
55
+ */
56
+ function AVH_EC_Admin ()
57
+ {
58
+ $this->__construct();
59
+ }
60
+
61
+ function actionAdminInit ()
62
+ {
63
+ if (is_admin() && isset($_GET['taxonomy']) && 'category' == $_GET['taxonomy']) {
64
+ add_action($_GET['taxonomy'] . '_edit_form', array ( &$this, 'displayCategoryGroupForm' ), 10, 2);
65
+ }
66
+ add_action('edit_term', array ( &$this, 'handleEditTerm' ), 10, 3);
67
+
68
+ }
69
+
70
+ /**
71
+ *
72
+ * Adds Category Group form
73
+ * @WordPress action category_edit_form
74
+ *
75
+ * @param unknown_type $term
76
+ * @param unknown_type $taxonomy
77
+ */
78
+ function displayCategoryGroupForm ($term, $taxonomy)
79
+ {
80
+
81
+ $current_selection = '';
82
+ $tax_meta = get_option($this->core->db_options_tax_meta);
83
+ if (isset($tax_meta[$taxonomy][$term->term_id])) {
84
+ $tax_meta = $tax_meta[$taxonomy][$term->term_id];
85
+ $current_selection = $tax_meta['category_group_term_id'];
86
+ }
87
+
88
+ if (empty($current_selection)) {
89
+ $current_group = $this->catgrp->getGroupByCategoryID($term->term_id);
90
+ $current_selection = $current_group->term_id;
91
+ }
92
+
93
+ $cat_groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
94
+ foreach ($cat_groups as $group) {
95
+ $temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
96
+ $dropdown_value[] = $group->term_id;
97
+ $dropdown_text[] = $temp_cat->name;
98
+ }
99
+
100
+ foreach ($dropdown_value as $key => $sel) {
101
+ $seldata .= '<option value="' . esc_attr($sel) . '" ' . (($current_selection == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($dropdown_text[$key])) . '</option>' . "\n";
102
+ }
103
+
104
+ echo '<h3>AVH Extended Categories - Category Group Widget</h3>';
105
+ echo '<table class="form-table"><tbody>';
106
+ echo '<tr class="form-field">';
107
+ echo '<th valign="top" scope="row">';
108
+ echo '<label for="avhec_categorygroup">Category Group</label></th>';
109
+ echo '<td>';
110
+ echo '<select id="avhec_categorygroup" name="avhec_categorygroup">';
111
+ echo $seldata;
112
+ echo '</select>';
113
+ echo '<p class="description">Select the category group to show on the archive page.</p>';
114
+ echo '</td>';
115
+ echo '</tr>';
116
+ echo '</tbody></table>';
117
+ }
118
+
119
+ /**
120
+ * Saves the association Category - Category Group fron the edit taxonomy page
121
+ * @WordPress action edit_form.
122
+ *
123
+ * @param unknown_type $term_id
124
+ * @param unknown_type $tt_id
125
+ * @param unknown_type $taxonomy
126
+ */
127
+ function handleEditTerm ($term_id, $tt_id, $taxonomy)
128
+ {
129
+ $tax_meta = get_option($this->core->db_options_tax_meta);
130
+ if (isset($_POST['avhec_categorygroup']) && $tax_meta[$taxonomy][$term_id]['category_group_term_id'] != $_POST['avhec_categorygroup']) {
131
+ $tax_meta[$taxonomy][$term_id]['category_group_term_id'] = $_POST['avhec_categorygroup'];
132
+ update_option($this->core->db_options_tax_meta, $tax_meta);
133
+ }
134
+ }
135
+
136
+ /**
137
+ * When a category is created this function is called to add the new category to the group all
138
+ * @param $term_id
139
+ * @param $term_taxonomy_id
140
+ */
141
+ function actionCreatedCategory ($term_id, $term_taxonomy_id)
142
+ {
143
+ $group_id = $this->catgrp->getTermIDBy('slug', 'all');
144
+ $this->catgrp->setCategoriesForGroup($group_id, (array) $term_id);
145
+ }
146
+
147
+ /**
148
+ * When a category is deleted this function is called so the category is deleted from every group as well.
149
+ *
150
+ * @param object $term
151
+ * @param int $term_taxonomy_id
152
+ */
153
+ function actionDeleteCategory ($term_id, $term_taxonomy_id)
154
+ {
155
+ $this->catgrp->doDeleteCategoryFromGroup($term_id);
156
+ }
157
+
158
+ /**
159
+ * Enqueues the style on the post.php and page.php pages
160
+ * @WordPress Action load-$pagenow
161
+ *
162
+ */
163
+ function actionLoadPostPage ()
164
+ {
165
+ wp_enqueue_style('avhec-admin-css');
166
+ }
167
+
168
+ /**
169
+ * Add the Tools and Options to the Management and Options page repectively
170
+ *
171
+ * @WordPress Action admin_menu
172
+ *
173
+ */
174
+ function actionAdminMenu ()
175
+ {
176
+
177
+ // Register Style and Scripts
178
+ $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.closure';
179
+ wp_register_script('avhec-categorygroup-js', AVHEC_PLUGIN_URL . '/js/avh-ec.categorygroup' . $suffix . '.js', array ( 'jquery' ), $this->core->version, true);
180
+ wp_register_script('avhec-manualorder', AVHEC_PLUGIN_URL . '/js/avh-ec.admin.manualorder' . $suffix . '.js', array ( 'jquery-ui-sortable' ), $this->core->version, false);
181
+ wp_register_style('avhec-admin-css', AVHEC_PLUGIN_URL . '/css/avh-ec.admin.css', array ( 'wp-admin' ), $this->core->version, 'screen');
182
+
183
+ // Add menu system
184
+ $folder = $this->core->getBaseDirectory(AVHEC_PLUGIN_DIR);
185
+ add_menu_page('AVH Extended Categories', 'AVH Extended Categories', 'manage_options', $folder, array ( &$this, 'doMenuOverview' ));
186
+ $this->hooks['menu_overview'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Overview', 'avh-ec'), __('Overview', 'avh-ec'), 'manage_options', $folder, array ( &$this, 'doMenuOverview' ));
187
+ $this->hooks['menu_general'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('General Options', 'avh-ec'), __('General Options', 'avh-ec'), 'manage_options', 'avhec-general', array ( &$this, 'doMenuGeneral' ));
188
+ $this->hooks['menu_category_groups'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Category Groups', 'avh-ec'), __('Category Groups', 'avh-ec'), 'manage_options', 'avhec-grouped', array ( &$this, 'doMenuCategoryGroup' ));
189
+ $this->hooks['menu_manual_order'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Manually Order', 'avh-ec'), __('Manually Order', 'avh-ec'), 'manage_options', 'avhec-manual-order', array ( &$this, 'doMenuManualOrder' ));
190
+ $this->hooks['menu_faq'] = add_submenu_page($folder, 'AVH Extended Categories:' . __('F.A.Q', 'avh-ec'), __('F.A.Q', 'avh-ec'), 'manage_options', 'avhec-faq', array ( &$this, 'doMenuFAQ' ));
191
+
192
+ // Add actions for menu pages
193
+ // Overview Menu
194
+ add_action('load-' . $this->hooks['menu_overview'], array ( &$this, 'actionLoadPageHook_Overview' ));
195
+
196
+ // General Options Menu
197
+ add_action('load-' . $this->hooks['menu_general'], array ( &$this, 'actionLoadPageHook_General' ));
198
+
199
+ // Category Groups Menu
200
+ add_action('load-' . $this->hooks['menu_category_groups'], array ( &$this, 'actionLoadPageHook_CategoryGroup' ));
201
+
202
+ // Manual Order Menu
203
+ add_action('load-' . $this->hooks['menu_manual_order'], array ( &$this, 'actionLoadPageHook_ManualOrder' ));
204
+
205
+ // FAQ Menu
206
+ add_action('load-' . $this->hooks['menu_faq'], array ( &$this, 'actionLoadPageHook_faq' ));
207
+ }
208
+
209
+ /**
210
+ * Setup everything needed for the Overview page
211
+ *
212
+ */
213
+ function actionLoadPageHook_Overview ()
214
+ {
215
+ // Add metaboxes
216
+ add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupList' ), $this->hooks['menu_overview'], 'normal', 'core');
217
+ add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array ( &$this, 'metaboxTranslation' ), $this->hooks['menu_overview'], 'normal', 'core');
218
+
219
+ add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
220
+
221
+ // WordPress core Scripts
222
+ wp_enqueue_script('common');
223
+ wp_enqueue_script('wp-lists');
224
+ wp_enqueue_script('postbox');
225
+
226
+ // Plugin Scripts
227
+ wp_enqueue_script('avhec-categorygroup-js');
228
+
229
+ // Plugin Style
230
+ wp_enqueue_style('avhec-admin-css');
231
+ }
232
+
233
+ /**
234
+ * Menu Page Overview
235
+ *
236
+ * @return none
237
+ */
238
+ function doMenuOverview ()
239
+ {
240
+ global $screen_layout_columns;
241
+
242
+ // This box can't be unselectd in the the Screen Options
243
+ //add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array ( &$this, 'metaboxAnnouncements' ), $this->hooks['menu_overview'], 'side', '');
244
+ add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array ( &$this, 'metaboxDonations' ), $this->hooks['menu_overview'], 'side', '');
245
+
246
+ $hide2 = '';
247
+ switch ($screen_layout_columns) {
248
+ case 2:
249
+ $width = 'width:49%;';
250
+ break;
251
+ default:
252
+ $width = 'width:98%;';
253
+ $hide2 = 'display:none;';
254
+ }
255
+
256
+ echo '<div class="wrap avhec-metabox-wrap">';
257
+ echo $this->displayIcon('index');
258
+ echo '<h2>' . 'AVH Extended Categories - ' . __('Overview', 'avh-ec') . '</h2>';
259
+ echo ' <div id="dashboard-widgets-wrap">';
260
+ echo ' <div id="dashboard-widgets" class="metabox-holder">';
261
+ echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
262
+ do_meta_boxes($this->hooks['menu_overview'], 'normal', '');
263
+ echo " </div>";
264
+ echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
265
+ do_meta_boxes($this->hooks['menu_overview'], 'side', '');
266
+ echo ' </div>';
267
+ echo ' </div>';
268
+
269
+ echo '<br class="clear"/>';
270
+ echo ' </div>'; //dashboard-widgets-wrap
271
+ echo '</div>'; // wrap
272
+
273
+
274
+ $this->printMetaboxGeneralNonces();
275
+ $this->printMetaboxJS('overview');
276
+ $this->printAdminFooter();
277
+ }
278
+
279
+ /**
280
+ * Setup everything needed for the General Options page
281
+ *
282
+ */
283
+ function actionLoadPageHook_General ()
284
+ {
285
+ // Add metaboxes
286
+ add_meta_box('avhecBoxOptions', __('Options', 'avh-ec'), array ( &$this, 'metaboxOptions' ), $this->hooks['menu_general'], 'normal', 'core');
287
+
288
+ add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
289
+
290
+ // WordPress core Scripts
291
+ wp_enqueue_script('common');
292
+ wp_enqueue_script('wp-lists');
293
+ wp_enqueue_script('postbox');
294
+
295
+ // Plugin Style and Scripts
296
+ wp_enqueue_style('avhec-admin-css');
297
+
298
+ }
299
+
300
+ /**
301
+ * Menu Page General Options
302
+ *
303
+ * @return none
304
+ */
305
+ function doMenuGeneral ()
306
+ {
307
+ global $screen_layout_columns;
308
+
309
+ $groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
310
+ foreach ($groups as $group) {
311
+ $group_id[] = $group->term_id;
312
+ $groupname[] = $group->name;
313
+ }
314
+
315
+ $options_general[] = array ( 'avhec[general][alternative_name_select_category]', __('<em>Select Category</em> Alternative', 'avh-ec'), 'text', 20, __('Alternative text for Select Category.', 'avh-ec') );
316
+ $options_general[] = array ( 'avhec[cat_group][home_group]', 'Home Group', 'dropdown', $group_id, $groupname, __('Select which group to show on the home page.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec') );
317
+ $options_general[] = array ( 'avhec[cat_group][no_group]', 'Nonexistence Group', 'dropdown', $group_id, $groupname, __('Select which group to show when there is no group associated with the post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec') );
318
+ $options_general[] = array ( 'avhec[cat_group][default_group]', 'Default Group', 'dropdown', $group_id, $groupname, __('Select which group will be the default group when editing a post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec') );
319
+
320
+ if (isset($_POST['updateoptions'])) {
321
+ check_admin_referer('avh_ec_generaloptions');
322
+
323
+ $formoptions = $_POST['avhec'];
324
+ $options = $this->core->getOptions();
325
+
326
+ //$all_data = array_merge( $options_general );
327
+ $all_data = $options_general;
328
+ foreach ($all_data as $option) {
329
+ $section = substr($option[0], strpos($option[0], '[') + 1);
330
+ $section = substr($section, 0, strpos($section, ']['));
331
+ $option_key = rtrim($option[0], ']');
332
+ $option_key = substr($option_key, strpos($option_key, '][') + 2);
333
+
334
+ switch ($section) {
335
+ case 'general':
336
+ case 'cat_group':
337
+ $current_value = $options[$section][$option_key];
338
+ break;
339
+ }
340
+ // Every field in a form is set except unchecked checkboxes. Set an unchecked checkbox to 0.
341
+ $newval = (isset($formoptions[$section][$option_key]) ? esc_attr($formoptions[$section][$option_key]) : 0);
342
+ if ($newval != $current_value) { // Only process changed fields.
343
+ switch ($section) {
344
+ case 'general':
345
+ case 'cat_group':
346
+ $options[$section][$option_key] = $newval;
347
+ break;
348
+ }
349
+ }
350
+ }
351
+ $this->core->saveOptions($options);
352
+ $this->message = __('Options saved', 'avh-ec');
353
+ $this->status = 'updated fade';
354
+
355
+ }
356
+ $this->displayMessage();
357
+
358
+ $actual_options = $this->core->getOptions();
359
+ foreach ($actual_options['cat_group'] as $key => $value) {
360
+ if (! (in_array($value, (array) $group_id))) {
361
+ $actual_options['cat_group'][$key] = $this->catgrp->getTermIDBy('slug', 'none');
362
+ }
363
+ }
364
+
365
+ $hide2 = '';
366
+ switch ($screen_layout_columns) {
367
+ case 2:
368
+ $width = 'width:49%;';
369
+ break;
370
+ default:
371
+ $width = 'width:98%;';
372
+ $hide2 = 'display:none;';
373
+ }
374
+ $data['options_general'] = $options_general;
375
+ $data['actual_options'] = $actual_options;
376
+
377
+ // This box can't be unselectd in the the Screen Options
378
+ add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array ( &$this, 'metaboxDonations' ), $this->hooks['menu_general'], 'side', 'core');
379
+
380
+ $hide2 = '';
381
+ switch ($screen_layout_columns) {
382
+ case 2:
383
+ $width = 'width:49%;';
384
+ break;
385
+ default:
386
+ $width = 'width:98%;';
387
+ $hide2 = 'display:none;';
388
+ }
389
+
390
+ echo '<div class="wrap avhec-metabox-wrap">';
391
+ echo $this->displayIcon('index');
392
+ echo '<h2>' . 'AVH Extended Categories - ' . __('General Options', 'avh-ec') . '</h2>';
393
+ echo '<form name="avhec-generaloptions" id="avhec-generaloptions" method="POST" action="' . admin_url('admin.php?page=avhec-general') . '" accept-charset="utf-8" >';
394
+ wp_nonce_field('avh_ec_generaloptions');
395
+
396
+ echo ' <div id="dashboard-widgets-wrap">';
397
+ echo ' <div id="dashboard-widgets" class="metabox-holder">';
398
+ echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
399
+ do_meta_boxes($this->hooks['menu_general'], 'normal', $data);
400
+ echo " </div>";
401
+ echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
402
+ do_meta_boxes($this->hooks['menu_general'], 'side', $data);
403
+ echo ' </div>';
404
+ echo ' </div>';
405
+
406
+ echo '<br class="clear"/>';
407
+ echo ' </div>'; //dashboard-widgets-wrap
408
+ echo '<p class="submit"><input class="button" type="submit" name="updateoptions" value="' . __('Save Changes', 'avhf-ec') . '" /></p>';
409
+ echo '</form>';
410
+
411
+ echo '</div>'; // wrap
412
+
413
+
414
+ $this->printMetaboxGeneralNonces();
415
+ $this->printMetaboxJS('general');
416
+ $this->printAdminFooter();
417
+ }
418
+
419
+ /**
420
+ * Options Metabox
421
+ *
422
+ */
423
+ function metaboxOptions ($data)
424
+ {
425
+ echo $this->printOptions($data['options_general'], $data['actual_options']);
426
+ }
427
+
428
+ /**
429
+ * Setup everything needed for the Category Group page
430
+ *
431
+ */
432
+ function actionLoadPageHook_CategoryGroup ()
433
+ {
434
+
435
+ // Add metaboxes
436
+ add_meta_box('avhecBoxCategoryGroupAdd', __('Add Group', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupAdd' ), $this->hooks['menu_category_groups'], 'normal', 'core');
437
+ add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupList' ), $this->hooks['menu_category_groups'], 'side', 'core');
438
+ add_meta_box('avhecBoxCategoryGroupSpecialPages', __('Special Pages', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupSpecialPages' ), $this->hooks['menu_category_groups'], 'normal', 'core');
439
+
440
+ add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
441
+
442
+ // WordPress core Scripts
443
+ wp_enqueue_script('common');
444
+ wp_enqueue_script('wp-lists');
445
+ wp_enqueue_script('postbox');
446
+
447
+ // Plugin Scripts
448
+ wp_enqueue_script('avhec-categorygroup-js');
449
+
450
+ // Plugin Style
451
+ wp_enqueue_style('avhec-admin-css');
452
+
453
+ }
454
+
455
+ /**
456
+ * Menu Page Category Group
457
+ *
458
+ * @return none
459
+ */
460
+ function doMenuCategoryGroup ()
461
+ {
462
+ global $screen_layout_columns;
463
+
464
+ $data_add_group_default = array ( 'name' => '', 'slug' => '', 'widget_title' => '', 'description' => '' );
465
+ $data_add_group_new = $data_add_group_default;
466
+
467
+ $options_add_group[] = array ( 'avhec_add_group[add][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec') );
468
+ $options_add_group[] = array ( 'avhec_add_group[add][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec') );
469
+ $options_add_group[] = array ( 'avhec_add_group[add][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec') );
470
+ $options_add_group[] = array ( 'avhec_add_group[add][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5 );
471
+
472
+ $options_edit_group[] = array ( 'avhec_edit_group[edit][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec') );
473
+ $options_edit_group[] = array ( 'avhec_edit_group[edit][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec') );
474
+ $options_edit_group[] = array ( 'avhec_edit_group[edit][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec') );
475
+ $options_edit_group[] = array ( 'avhec_edit_group[edit][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5 );
476
+ $options_edit_group[] = array ( 'avhec_edit_group[edit][categories]', __('Categories', 'avh-ec'), 'catlist', 0, __('Select categories to be included in the group.', 'avh-ec') );
477
+
478
+ if (isset($_POST['addgroup'])) {
479
+ check_admin_referer('avh_ec_addgroup');
480
+
481
+ $formoptions = $_POST['avhec_add_group'];
482
+
483
+ $data_add_group_new['name'] = $formoptions['add']['name'];
484
+ $data_add_group_new['slug'] = empty($formoptions['add']['slug']) ? sanitize_title($data_add_group_new['name']) : sanitize_title($formoptions['add']['slug']);
485
+ $data_add_group_new['widget_title'] = $formoptions['add']['widget_title'];
486
+ $data_add_group_new['description'] = $formoptions['add']['description'];
487
+
488
+ $id = $this->catgrp->getTermIDBy('slug', $data_add_group_new['slug']);
489
+ if (! $id) {
490
+ $group_id = $this->catgrp->doInsertGroup($data_add_group_new['name'], array ( 'description' => $data_add_group_new['description'], 'slug' => $data_add_group_new['slug'] ), $data_add_group_new['widget_title']);
491
+ $this->catgrp->setCategoriesForGroup($group_id);
492
+ $this->message = __('Category group saved', 'avh-ec');
493
+ $this->status = 'updated fade';
494
+ $data_add_group_new = $data_add_group_default;
495
+
496
+ } else {
497
+ $group = $this->catgrp->getGroup($id);
498
+ $this->message = __('Category group conflicts with ', 'avh-ec') . $group->name;
499
+ $this->message .= '<br />' . __('Same slug is used. ', 'avh-ec');
500
+ $this->status = 'error';
501
+
502
+ }
503
+ $this->displayMessage();
504
+ }
505
+ $data_add_group['add'] = $data_add_group_new;
506
+ $data['add'] = array ( 'form' => $options_add_group, 'data' => $data_add_group );
507
+
508
+ if (isset($_GET['action'])) {
509
+ $action = $_GET['action'];
510
+
511
+ switch ($action) {
512
+ case 'edit':
513
+ $group_id = (int) $_GET['group_ID'];
514
+ $group = $this->catgrp->getGroup($group_id);
515
+ $widget_title = $this->catgrp->getWidgetTitleForGroup($group_id);
516
+ $cats = $this->catgrp->getCategoriesFromGroup($group_id);
517
+
518
+ $data_edit_group['edit'] = array ( 'group_id' => $group_id, 'name' => $group->name, 'slug' => $group->slug, 'widget_title' => $widget_title, 'description' => $group->description, 'categories' => $cats );
519
+ $data['edit'] = array ( 'form' => $options_edit_group, 'data' => $data_edit_group );
520
+
521
+ add_meta_box('avhecBoxCategoryGroupEdit', __('Edit Group', 'avh-ec') . ': ' . $group->name, array ( &$this, 'metaboxCategoryGroupEdit' ), $this->hooks['menu_category_groups'], 'normal', 'low');
522
+ break;
523
+ case 'delete':
524
+ if (! isset($_GET['group_ID'])) {
525
+ wp_redirect($this->getBackLink());
526
+ exit();
527
+ }
528
+
529
+ $group_id = (int) $_GET['group_ID'];
530
+ check_admin_referer('delete-avhecgroup_' . $group_id);
531
+
532
+ if (! current_user_can('manage_categories')) {
533
+ wp_die(__('Cheatin&#8217; uh?'));
534
+ }
535
+ $this->catgrp->doDeleteGroup($group_id);
536
+ break;
537
+ default:
538
+ ;
539
+ break;
540
+ }
541
+ }
542
+
543
+ if (isset($_POST['editgroup'])) {
544
+ check_admin_referer('avh_ec_editgroup');
545
+
546
+ $formoptions = $_POST['avhec_edit_group'];
547
+ $selected_categories = $_POST['post_category'];
548
+
549
+ $group_id = (int) $_POST['avhec-group_id'];
550
+ $result = $this->catgrp->doUpdateGroup($group_id, array ( 'name' => $formoptions['edit']['name'], 'slug' => $formoptions['edit']['slug'], 'description' => $formoptions['edit']['description'] ), $selected_categories, $formoptions['edit']['widget_title']);
551
+ switch ($result) {
552
+ case 1:
553
+ $this->message = __('Category group updated', 'avh-ec');
554
+ $this->status = 'updated fade';
555
+ break;
556
+ case 0:
557
+ $this->message = __('Category group not updated', 'avh-ec');
558
+ $this->message .= '<br />' . __('Duplicate slug detected', 'avh-ec');
559
+ $this->status = 'error';
560
+ break;
561
+ case - 1:
562
+ $this->message = __('Unknown category group', 'avh-ec');
563
+ $this->status = 'error';
564
+ break;
565
+ }
566
+ $this->displayMessage();
567
+ }
568
+
569
+ $hide2 = '';
570
+ switch ($screen_layout_columns) {
571
+ case 2:
572
+ $width = 'width:49%;';
573
+ break;
574
+ default:
575
+ $width = 'width:98%;';
576
+ $hide2 = 'display:none;';
577
+ }
578
+
579
+ $data_special_pages_old = $this->core->options['sp_cat_group'];
580
+ $data_special_pages_new = $data_special_pages_old;
581
+ if (isset($_POST['avhec_special_pages'])) {
582
+ check_admin_referer('avh_ec_specialpagesgroup');
583
+
584
+ $formoptions = $_POST['avhec_special_pages'];
585
+ $formdata = $formoptions['sp'];
586
+ foreach ($formdata as $key => $value) {
587
+ $data_special_pages_new[$key] = $value;
588
+ }
589
+ $this->core->options['sp_cat_group'] = $data_special_pages_new;
590
+ $this->core->saveOptions($this->core->options);
591
+
592
+ }
593
+ $data_special_pages['sp'] = $data_special_pages_new;
594
+ $cat_groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
595
+
596
+ foreach ($cat_groups as $group) {
597
+ $temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
598
+ $dropdown_value[] = $group->term_id;
599
+ $dropdown_text[] = $temp_cat->name;
600
+ }
601
+ $options_special_pages[] = array ( 'avhec_special_pages[sp][home_group]', __('Home page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('home', 'avhec')) );
602
+ //$options_special_pages[] = array('avhec_special_pages[sp][category_group]', __('Category Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('category archive','avhec')));
603
+ $options_special_pages[] = array ( 'avhec_special_pages[sp][day_group]', __('Daily Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('daily archive', 'avhec')) );
604
+ $options_special_pages[] = array ( 'avhec_special_pages[sp][month_group]', __('Monthly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('monthly archive', 'avhec')) );
605
+ $options_special_pages[] = array ( 'avhec_special_pages[sp][year_group]', __('Yearly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('yearly archive', 'avhec')) );
606
+ $options_special_pages[] = array ( 'avhec_special_pages[sp][author_group]', __('Author Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('author archive', 'avhec')) );
607
+ $options_special_pages[] = array ( 'avhec_special_pages[sp][search_group]', __('Search Page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('search', 'avhec')) );
608
+
609
+ $data['sp'] = array ( 'form' => $options_special_pages, 'data' => $data_special_pages );
610
+
611
+ // This box can't be unselectd in the the Screen Options
612
+ //add_meta_box( 'avhecBoxDonations', __( 'Donations', 'avh-ec' ), array (&$this, 'metaboxDonations' ), $this->hooks['menu_category_groups'], 'side', 'core' );
613
+
614
+
615
+ echo '<div class="wrap avhec-metabox-wrap">';
616
+ echo $this->displayIcon('index');
617
+ echo '<h2>' . 'AVH Extended Categories - ' . __('Category Groups', 'avh-ec') . '</h2>';
618
+
619
+ echo ' <div id="dashboard-widgets-wrap">';
620
+ echo ' <div id="dashboard-widgets" class="metabox-holder">';
621
+
622
+ echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
623
+ do_meta_boxes($this->hooks['menu_category_groups'], 'normal', $data);
624
+ echo " </div>";
625
+
626
+ echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
627
+ do_meta_boxes($this->hooks['menu_category_groups'], 'side', $data);
628
+ echo ' </div>';
629
+
630
+ echo ' </div>'; // dashboard-widgets
631
+ echo '<br class="clear" />';
632
+ echo ' </div>'; //dashboard-widgets-wrap
633
+ echo '</div>'; // wrap
634
+
635
+
636
+ $this->printMetaboxGeneralNonces();
637
+ $this->printMetaboxJS('grouped');
638
+ $this->printAdminFooter();
639
+ }
640
+
641
+ /**
642
+ * Metabox for Adding a group
643
+ * @param $data
644
+ */
645
+ function metaboxCategoryGroupAdd ($data)
646
+ {
647
+ echo '<form name="avhec-addgroup" id="avhec-addgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
648
+ wp_nonce_field('avh_ec_addgroup');
649
+ echo $this->printOptions($data['add']['form'], $data['add']['data']);
650
+ echo '<p class="submit"><input class="button" type="submit" name="addgroup" value="' . __('Add group', 'avh-ec') . '" /></p>';
651
+ echo '</form>';
652
+ }
653
+
654
+ /**
655
+ * Metabox for showing the groups as a list
656
+ *
657
+ * @param $data
658
+ */
659
+ function metaboxCategoryGroupList ($data)
660
+ {
661
+ echo '<form id="posts-filter" action="" method="get">';
662
+
663
+ echo '<div class="clear"></div>';
664
+
665
+ echo '<table class="widefat fixed" cellspacing="0">';
666
+ echo '<thead>';
667
+ echo '<tr>';
668
+ print_column_headers('categories_group');
669
+ echo '</tr>';
670
+ echo '</thead>';
671
+
672
+ echo '<tfoot>';
673
+ echo '<tr>';
674
+ print_column_headers('categories_group', false);
675
+ echo '</tr>';
676
+ echo '</tfoot>';
677
+
678
+ echo '<tbody id="the-list" class="list:group">';
679
+ $this->printCategoryGroupRows();
680
+ echo '</tbody>';
681
+ echo '</table>';
682
+
683
+ echo '<br class="clear" />';
684
+ echo '</form>';
685
+
686
+ //echo '</div>';
687
+ }
688
+
689
+ /**
690
+ * Metabox Category Group Edit
691
+ *
692
+ */
693
+ function metaboxCategoryGroupEdit ($data)
694
+ {
695
+ echo '<form name="avhec-editgroup" id="avhec-editgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
696
+ wp_nonce_field('avh_ec_editgroup');
697
+ echo $this->printOptions($data['edit']['form'], $data['edit']['data']);
698
+ echo '<input type="hidden" value="' . $data['edit']['data']['edit']['group_id'] . '" name="avhec-group_id" id="avhec-group_id">';
699
+ echo '<p class="submit"><input class="button" type="submit" name="editgroup" value="' . __('Update group', 'avh-ec') . '" /></p>';
700
+ echo '</form>';
701
+ }
702
+
703
+ /**
704
+ * Metabox Category Group Special pages
705
+ *
706
+ */
707
+ function metaboxCategoryGroupSpecialPages ($data)
708
+ {
709
+ echo '<form name="avhec-specialpagesgroup" id="avhec-specialpagesgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
710
+ wp_nonce_field('avh_ec_specialpagesgroup');
711
+ echo $this->printOptions($data['sp']['form'], $data['sp']['data']);
712
+ echo '<p class="submit"><input class="button" type="submit" name="spgroup" value="' . __('Save settings', 'avh-ec') . '" /></p>';
713
+ echo '</form>';
714
+ }
715
+
716
+ /**
717
+ * Setup everything needed for the Manul Order page
718
+ *
719
+ */
720
+ function actionLoadPageHook_ManualOrder ()
721
+ {
722
+
723
+ add_meta_box('avhecBoxManualOrder', __('Manually Order Categories', 'avh-ec'), array ( &$this, 'metaboxManualOrder' ), $this->hooks['menu_manual_order'], 'normal', 'core');
724
+
725
+ add_screen_option('layout_columns', array ( 'max' => 1, 'default' => 1 ));
726
+
727
+ // WordPress core Styles and Scripts
728
+ wp_enqueue_script('common');
729
+ wp_enqueue_script('wp-lists');
730
+ wp_enqueue_script('postbox');
731
+ wp_enqueue_script('jquery-ui-sortable');
732
+ wp_enqueue_script('avhec-manualorder');
733
+
734
+ // Plugin Style
735
+ wp_enqueue_style('avhec-admin-css');
736
+
737
+ }
738
+
739
+ /**
740
+ * Menu Page Manual Order
741
+ *
742
+ * @return none
743
+ */
744
+ function doMenuManualOrder ()
745
+ {
746
+ global $screen_layout_columns;
747
+
748
+ $hide2 = '';
749
+ switch ($screen_layout_columns) {
750
+ case 2:
751
+ $width = 'width:49%;';
752
+ break;
753
+ default:
754
+ $width = 'width:98%;';
755
+ $hide2 = 'display:none;';
756
+ }
757
+
758
+ echo '<div class="wrap">';
759
+ echo $this->displayIcon('index');
760
+ echo '<h2>' . 'AVH Extended Categories - ' . __('Manually Order Categories', 'avh-ec') . '</h2>';
761
+
762
+ echo '<div class="metabox-holder">';
763
+ echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
764
+ do_meta_boxes($this->hooks['menu_manual_order'], 'normal', '');
765
+ echo ' </div>';
766
+ echo '</div>';
767
+ echo '</div>'; // wrap
768
+ echo '<div class="clear"></div>';
769
+
770
+ $this->printMetaboxGeneralNonces();
771
+ $this->printMetaboxJS('manual_order');
772
+ $this->printAdminFooter();
773
+ }
774
+
775
+ /**
776
+ *
777
+ * Displays the Manual Order metabox.
778
+ *
779
+ * @author Andrew Charlton - original
780
+ * @author Peter van der Does - modifications
781
+ */
782
+ function metaboxManualOrder ()
783
+ {
784
+ global $wpdb;
785
+
786
+ $parentID = 0;
787
+
788
+ if (isset($_POST['btnSubCats'])) {
789
+ $parentID = $_POST['cats'];
790
+ } elseif (isset($_POST['hdnParentID'])) {
791
+ $parentID = $_POST['hdnParentID'];
792
+ }
793
+
794
+ if (isset($_POST['btnReturnParent'])) {
795
+ $parentsParent = $wpdb->get_row($wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d", $_POST['hdnParentID']), ARRAY_N);
796
+ $parentID = $parentsParent[0];
797
+ }
798
+
799
+ $success = "";
800
+ if (isset($_POST['btnOrderCats'])) {
801
+ if (isset($_POST['hdnManualOrder']) && $_POST['hdnManualOrder'] != "") {
802
+
803
+ $manualOrder = $_POST['hdnManualOrder'];
804
+ $IDs = explode(",", $manualOrder);
805
+ $result = count($IDs);
806
+
807
+ for ($i = 0; $i < $result; $i ++) {
808
+ $str = str_replace("id_", "", $IDs[$i]);
809
+ $wpdb->query($wpdb->prepare("UPDATE $wpdb->terms SET avhec_term_order = %d WHERE term_id =%d", $i, $str));
810
+ }
811
+
812
+ $success = '<div id="message" class="updated fade"><p>' . __('Manual order of the categories successfully updated.', 'avh-ec') . '</p></div>';
813
+ } else {
814
+ $success = '<div id="message" class="updated fade"><p>' . __('An error occured, order has not been saved.', 'avh-ec') . '</p></div>';
815
+ }
816
+
817
+ }
818
+
819
+ $subCategories = "";
820
+ $results = $wpdb->get_results($wpdb->prepare("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = %d AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 0 ORDER BY t.avhec_term_order ASC", $parentID));
821
+ foreach ($results as $row) {
822
+ $subCategories .= "<option value='$row->term_id'>$row->name</option>";
823
+ }
824
+
825
+ echo '<div class="wrap">';
826
+ echo '<form name="frmMyCatOrder" method="post" action="">';
827
+ echo $success;
828
+
829
+ echo '<h4>';
830
+ _e('Order the categories', 'avh-ec');
831
+ if ($parentID == 0) {
832
+ echo ' at the Toplevel';
833
+ } else {
834
+ $categories = get_category_parents($parentID, false, ' » ');
835
+ echo ' in the category ' . trim($categories, ' » ');
836
+ }
837
+ echo '</h4>';
838
+ echo '<span class="description">';
839
+ _e('Order the categories on this level by dragging and dropping them into the desired order.', 'avh-ec');
840
+ echo '</span>';
841
+ echo '<ul id="avhecManualOrder">';
842
+ $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->terms t inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id WHERE taxonomy = 'category' and parent = %d ORDER BY avhec_term_order ASC", $parentID));
843
+ foreach ($results as $row)
844
+ echo "<li id='id_$row->term_id' class='lineitem menu-item-settings'>" . __($row->name) . "</li>";
845
+
846
+ echo '</ul>';
847
+ echo '<input type="submit" name="btnOrderCats" id="btnOrderCats" class="button-primary" value="' . __('Save Order', 'avh-ec') . '" onclick="javascript:orderCats(); return true;" />';
848
+
849
+ if ($parentID != 0) {
850
+ echo "<input type='submit' class='button' id='btnReturnParent' name='btnReturnParent' value='" . __('Return to parent category', 'avh-ec') . "' />";
851
+ }
852
+
853
+ echo '<strong id="updateText"></strong><br /><br />';
854
+ if ($subCategories != "") {
855
+
856
+ echo '<h4>';
857
+ _e('Select Subcategory', 'avh-ec');
858
+ echo '</h4>';
859
+ echo '<select id="cats" name="cats">';
860
+ echo $subCategories;
861
+
862
+ echo '</select><input type="submit" name="btnSubCats" class="button" id="btnSubCats" value="' . __('Select', 'avh-ec') . '" />';
863
+ echo '<span class="description">';
864
+ _e('Choose a category from the drop down to order the subcategories in that category.', 'avh-ec');
865
+ echo '</span>';
866
+ }
867
+
868
+ echo '<input type="hidden" id="hdnManualOrder" name="hdnManualOrder" />';
869
+ echo '<input type="hidden" id="hdnParentID" name="hdnParentID" value="' . $parentID . '" /></form>';
870
+ echo '</div>';
871
+ }
872
+
873
+ /**
874
+ * Setup everything needed for the FAQ page
875
+ *
876
+ */
877
+ function actionLoadPageHook_faq ()
878
+ {
879
+
880
+ add_meta_box('avhecBoxFAQ', __('F.A.Q.', 'avh-ec'), array ( &$this, 'metaboxFAQ' ), $this->hooks['menu_faq'], 'normal', 'core');
881
+ add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array ( &$this, 'metaboxTranslation' ), $this->hooks['menu_faq'], 'normal', 'core');
882
+
883
+ add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
884
+
885
+ // WordPress core Styles and Scripts
886
+ wp_enqueue_script('common');
887
+ wp_enqueue_script('wp-lists');
888
+ wp_enqueue_script('postbox');
889
+
890
+ // Plugin Style
891
+ wp_enqueue_style('avhec-admin-css');
892
+
893
+ }
894
+
895
+ /**
896
+ * Menu Page FAQ
897
+ *
898
+ * @return none
899
+ */
900
+ function doMenuFAQ ()
901
+ {
902
+ global $screen_layout_columns;
903
+
904
+ // This box can't be unselectd in the the Screen Options
905
+ // add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array ( &$this, 'metaboxAnnouncements' ), $this->hooks['menu_faq'], 'side', 'core');
906
+ add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array ( &$this, 'metaboxDonations' ), $this->hooks['menu_faq'], 'side', 'core');
907
+
908
+ $hide2 = '';
909
+ switch ($screen_layout_columns) {
910
+ case 2:
911
+ $width = 'width:49%;';
912
+ break;
913
+ default:
914
+ $width = 'width:98%;';
915
+ $hide2 = 'display:none;';
916
+ }
917
+
918
+ echo '<div class="wrap avhec-metabox-wrap">';
919
+ echo $this->displayIcon('index');
920
+ echo '<h2>' . 'AVH Extended Categories - ' . __('F.A.Q', 'avh-ec') . '</h2>';
921
+ echo ' <div id="dashboard-widgets-wrap">';
922
+ echo ' <div id="dashboard-widgets" class="metabox-holder">';
923
+ echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
924
+ do_meta_boxes($this->hooks['menu_faq'], 'normal', '');
925
+ echo ' </div>';
926
+ echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
927
+ do_meta_boxes($this->hooks['menu_faq'], 'side', '');
928
+ echo ' </div>';
929
+ echo ' </div>';
930
+ echo '<br class="clear"/>';
931
+ echo ' </div>'; //dashboard-widgets-wrap
932
+ echo '</div>'; // wrap
933
+
934
+
935
+ $this->printMetaboxGeneralNonces();
936
+ $this->printMetaboxJS('faq');
937
+ $this->printAdminFooter();
938
+ }
939
+
940
+ /**
941
+ * Translation Metabox
942
+ * @return unknown_type
943
+ */
944
+ function metaboxTranslation ()
945
+ {
946
+ $locale = apply_filters('plugin_locale', get_locale(), 'avh-ec');
947
+ $available_locale['cs_CZ'] = array ( 'Czech - Čeština', 0 );
948
+ $available_locale['nl_NL'] = array ( 'Dutch - Nederlands', 0 );
949
+ $available_locale['de_DE'] = array ( 'German - Deutsch', 0 );
950
+ $available_locale['el'] = array ( 'Greek - Čeština', 0 );
951
+ $available_locale['id_ID'] = array ( 'Indonesian - Bahasa Indonesia - Čeština', 0 );
952
+ $available_locale['it_IT'] = array ( 'Italian - Italiano', 1 );
953
+ $available_locale['ru_RU'] = array ( 'Russian — Русский', 0 );
954
+ $available_locale['es_ES'] = array ( 'Spanish - Español', 0 );
955
+ $available_locale['sv_SE'] = array ( 'Swedish - Svenska', 0 );
956
+ $available_locale['tr'] = array ( 'Turkish - Türkçe', 0 );
957
+
958
+ echo '<div class="p">';
959
+ echo __('This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language.', 'avh-ec') . '<br />';
960
+
961
+ echo '</div>';
962
+
963
+ echo '<div class="p">';
964
+ echo '<span class="b">' . __('Available Languages', 'avh-ec') . '</span>';
965
+ echo '<ul>';
966
+ foreach ($available_locale as $key => $value) {
967
+ echo '<li>';
968
+ $complete = ($value[1] == 1 ? 'Complete' : 'Incomplete');
969
+ echo $value[0] . ' (' . $key . ') - ' . $complete;
970
+ echo '</li>';
971
+ }
972
+ echo '</ul>';
973
+ echo '</div>';
974
+
975
+ echo '<div class="p">';
976
+ if ('en_US' != $locale & (! array_key_exists($locale, $available_locale))) {
977
+ echo 'Currently the plugin is not available in your language (' . $locale . '). We\'re in the middle of changing the way you can help with translations. Keep an eye on the <a href="http:///blog.avirtualhome.com">website</a> for the announcement.';
978
+ } else {
979
+ echo 'We\'re in the middle of changing the way you can help with translations. Keep an eye on the <a href="http:///blog.avirtualhome.com">website</a> for the announcement.';
980
+ }
981
+ echo '</div>';
982
+
983
+ }
984
+
985
+ /**
986
+ * Donation Metabox
987
+ * @return unknown_type
988
+ */
989
+ function metaboxDonations ()
990
+ {
991
+ echo '<div class="p">';
992
+ echo __('If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation.', 'avh-ec');
993
+ echo '</div>';
994
+
995
+ echo '<div class="p">';
996
+ echo '<span class="b">Amazon</span><br />';
997
+ echo __('If you decide to buy something from Amazon click the button.', 'avh-ec') . '</span><br />';
998
+ echo '<a href="https://www.amazon.com/?tag=avh-donation-20" target="_blank" title="Amazon Homepage"><img alt="Amazon Button" src="' . $this->core->info['graphics_url'] . '/us_banner_logow_120x60.gif" /></a>';
999
+ echo '</div>';
1000
+
1001
+ echo '<div class="p">';
1002
+ echo __('You can send me something from my ', 'avh-ec') . '<a href="http://www.amazon.com/registry/wishlist/1U3DTWZ72PI7W?tag=avh-donation-20">' . __('Amazon Wish List', 'avh-ec') . '</a>';
1003
+ echo '</div>';
1004
+
1005
+ echo '<div class="p">';
1006
+ echo '<span class="b">' . __('Through Paypal.', 'avh-ec') . '</span><br />';
1007
+ 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.', 'avh-ec') . '<br />';
1008
+ echo '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=S85FXJ9EBHAF2&lc=US&item_name=AVH%20Plugins&item_number=fdas&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank" title="Donate">';
1009
+ echo '<img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donate"/></a>';
1010
+ echo '</div>';
1011
+
1012
+ }
1013
+
1014
+ /***
1015
+ * F.A.Q Metabox
1016
+ * @return none
1017
+ */
1018
+ function metaboxFAQ ()
1019
+ {
1020
+ echo '<div class="p">';
1021
+ echo '<span class="b">' . __('What about support?', 'avh-ec') . '</span><br />';
1022
+ echo __('I created a <a href="http://forums.avirtualhome.com" target="_blank">support site</a> where you can ask questions or request features.', 'avh-ec') . '<br />';
1023
+ echo '</div>';
1024
+
1025
+ echo '<div class="p">';
1026
+ echo '<span class="b">' . __('What is depth selection?', 'avh-ec') . '</span><br />';
1027
+ echo __('Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well.', 'avh-ec') . '<br /><br />';
1028
+ echo __('Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:', 'avh-ec') . '<br />';
1029
+ echo __('You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only.', 'avh-ec') . '<br />';
1030
+ echo '</div>';
1031
+
1032
+ echo '<div class="p">';
1033
+ echo '<span class="b">' . __('Multiple Category Groups', 'avh-ec') . '</span><br />';
1034
+ echo __('The following is an explanation how assigning multiple groups to page/post works.', 'avh-ec') . '<br /><br />';
1035
+ echo __('Lets say you have the following groups:', 'avh-ec');
1036
+ echo '<ul>';
1037
+ echo '<li>' . __('Free Time', 'avh-ec') . '</li>';
1038
+ echo '<li>' . __('Theater', 'avh-ec') . '</li>';
1039
+ echo '<li>' . __('Movie', 'avh-ec') . '</li>';
1040
+ echo '<li>' . __('Music', 'avh-ec') . '</li>';
1041
+ echo '</ul>';
1042
+ echo __('Setup several Category Group widgets and associated each widget with one or more groups.', 'avh-ec') . '<br />';
1043
+ echo __('Widget 1 has association with Free Time', 'avh-ec') . '<br />';
1044
+ echo __('Widget 2 has association with Theater, Movie and Music', 'avh-ec') . '<br />';
1045
+ echo __('Widget 3 has association with Theater, Movie and Music', 'avh-ec') . '<br /><br />';
1046
+ echo __('Page has associations the groups Free Time and Theater', 'avh-ec');
1047
+ echo '<ul>';
1048
+ echo '<li>' . __('Widget 1: Shows categories of the Free Time group', 'avh-ec') . '</li>';
1049
+ echo '<li>' . __('Widget 2: Shows categories of the Theater group.', 'avh-ec') . '</li>';
1050
+ echo '<li>' . __('Widget 3: Not displayed', 'avh-ec') . '</li>';
1051
+ echo '</ul>';
1052
+ echo __('Page has associations the group Movie.', 'avh-ec');
1053
+ echo '<ul>';
1054
+ echo '<li>' . __('Widget 1: Not displayed', 'avh-ec') . '</li>';
1055
+ echo '<li>' . __('Widget 2: Shows categories of the Movie group.', 'avh-ec') . '</li>';
1056
+ echo '<li>' . __('Widget 3: Not displayed', 'avh-ec') . '</li>';
1057
+ echo '</ul>';
1058
+ echo __('Page has associations the groups Free Time, Movie and Music', 'avh-ec');
1059
+ echo '<ul>';
1060
+ echo '<li>' . __('Widget 1: Shows categories of the Free Time group', 'avh-ec') . '</li>';
1061
+ echo '<li>' . __('Widget 2: Shows categories of the Movie or Music group.', 'avh-ec') . '</li>';
1062
+ echo '<li>' . __('Widget 3: Shows categories of the Music or Movie group.', 'avh-ec') . '</li>';
1063
+ echo '</ul>';
1064
+ echo __('Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie.', 'avh-ec') . '<br />';
1065
+ echo '</div>';
1066
+ }
1067
+
1068
+ function metaboxAnnouncements ()
1069
+ {
1070
+ $php5 = version_compare('5.2', phpversion(), '<');
1071
+ echo '<div class="p">';
1072
+ echo '<span class="b">' . __('PHP4 Support', 'avh-ec') . '</span><br />';
1073
+ echo __('The next major release of the plugin will no longer support PHP4.', 'avh-ec') . '<br />';
1074
+ echo __('It will be written for PHP 5.2 and ', 'avh-ec');
1075
+ if ($php5) {
1076
+ echo __('your blog already runs the needed PHP version. When the new release comes out you can safely update.', 'avh-ec') . '<br />';
1077
+ } else {
1078
+ echo __('your blog still runs PHP4. When the new release comes out you can not use it.', 'avh-ec') . '<br />';
1079
+ echo __('I don\'t have a timeline for the next version but consider contacting your host if PHP 5.2 is available.', 'avh-ec') . '<br />';
1080
+ echo __('If your hosts doesn\'t offer PHP 5.2 you might want to consider switching hosts.', 'avh-ec') . '<br />';
1081
+ echo __('A host to consider is ', 'avh-ec') . '<a href="http://www.lunarpages.com/id/pdoes" target="_blank">Lunarpages</a>';
1082
+ echo __('I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price.', 'avh-ec');
1083
+ }
1084
+ echo '</div>';
1085
+
1086
+ }
1087
+
1088
+ /**
1089
+ * Sets the amount of columns wanted for a particuler screen
1090
+ *
1091
+ * @WordPress filter screen_meta_screen
1092
+ * @param $screen
1093
+ * @return strings
1094
+ */
1095
+
1096
+ function filterScreenLayoutColumns ($columns, $screen)
1097
+ {
1098
+ switch ($screen) {
1099
+ case $this->hooks['menu_overview']:
1100
+ $columns[$this->hooks['menu_overview']] = 2;
1101
+ break;
1102
+ case $this->hooks['menu_general']:
1103
+ $columns[$this->hooks['menu_general']] = 2;
1104
+ break;
1105
+ case $this->hooks['menu_category_groups']:
1106
+ $columns[$this->hooks['menu_category_groups']] = 2;
1107
+ break;
1108
+ case $this->hooks['menu_faq']:
1109
+ $columns[$this->hooks['menu_faq']] = 2;
1110
+ break;
1111
+
1112
+ }
1113
+ return $columns;
1114
+ }
1115
+
1116
+ /**
1117
+ * Adds Settings next to the plugin actions
1118
+ *
1119
+ * @WordPress Filter plugin_action_links_avh-amazon/avh-amazon.php
1120
+ *
1121
+ */
1122
+ function filterPluginActions ($links, $file)
1123
+ {
1124
+ $settings_link = '<a href="admin.php?page=extended-categories-widget">' . __('Settings', 'avh-ec') . '</a>';
1125
+ array_unshift($links, $settings_link); // before other links
1126
+ return $links;
1127
+
1128
+ }
1129
+
1130
+ /**
1131
+ * Creates a new array for columns headers. Used in print_column_headers. The filter is called from get_column_headers
1132
+ *
1133
+ * @param $columns
1134
+ * @return Array
1135
+ * @see print_column_headers, get_column_headers
1136
+ */
1137
+ function filterManageCategoriesGroupColumns ($columns)
1138
+ {
1139
+ $categories_group_columns = array ( 'name' => __('Name', 'avh-ec'), 'slug' => 'Slug', 'widget-title' => __('Widget Title', 'avh-ec'), 'description' => __('Description', 'avh-ec'), 'cat-in-group' => __('Categories in the group', 'avh-ec') );
1140
+ return $categories_group_columns;
1141
+ }
1142
+
1143
+ /**
1144
+ * When not using AJAX, this function is called when the deletion fails.
1145
+ *
1146
+ * @param string $text
1147
+ * @param int $group_id
1148
+ * @return string
1149
+ * @WordPress Filter explain_nonce_$verb-$noun
1150
+ * @see wp_explain_nonce
1151
+ */
1152
+ function filterExplainNonceDeleteGroup ($text, $group_id)
1153
+ {
1154
+ $group = get_term($group_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
1155
+
1156
+ $return = sprintf(__('Your attempt to delete this group: &#8220;%s&#8221; has failed.'), $group->name);
1157
+ return ($return);
1158
+ }
1159
+
1160
+ ############## Admin WP Helper ##############
1161
+
1162
+
1163
+ /**
1164
+ * Get the backlink for forms
1165
+ *
1166
+ * @return strings
1167
+ */
1168
+ function getBackLink ()
1169
+ {
1170
+ $page = basename(__FILE__);
1171
+ if (isset($_GET['page']) && ! empty($_GET['page'])) {
1172
+ $page = preg_replace('[^a-zA-Z0-9\.\_\-]', '', $_GET['page']);
1173
+ }
1174
+
1175
+ if (function_exists("admin_url"))
1176
+ return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
1177
+ else
1178
+ return $_SERVER['PHP_SELF'] . "?page=" . $page;
1179
+ }
1180
+
1181
+ /**
1182
+ * Print all Category Group rows
1183
+ *
1184
+ * @uses printCategoryGroupRow
1185
+ *
1186
+ */
1187
+ function printCategoryGroupRows ()
1188
+ {
1189
+ $cat_groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
1190
+
1191
+ foreach ($cat_groups as $group) {
1192
+ if ('none' != $group->slug) {
1193
+ echo $this->printCategoryGroupRow($group->term_id, $group->term_taxonomy_id);
1194
+ }
1195
+ }
1196
+ }
1197
+
1198
+ /**
1199
+ * Displays all the information of a group in a row
1200
+ * Adds inline link for delete and/or edit.
1201
+ *
1202
+ * @param int $group_term_id
1203
+ * @param int $group_term_taxonomy_id
1204
+ */
1205
+ function printCategoryGroupRow ($group_term_id, $group_term_taxonomy_id)
1206
+ {
1207
+ static $row_class = '';
1208
+
1209
+ $group = get_term($group_term_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
1210
+
1211
+ $no_edit[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
1212
+ $no_delete[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
1213
+
1214
+ if (current_user_can('manage_categories')) {
1215
+ $actions = array ();
1216
+ if (! array_key_exists($group->term_id, $no_edit)) {
1217
+ $edit_link = "admin.php?page=avhec-grouped&amp;action=edit&amp;group_ID=$group->term_id";
1218
+ $edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $group->name)) . "'>" . esc_attr($group->name) . '</a><br />';
1219
+
1220
+ $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
1221
+ } else {
1222
+ $edit = esc_attr($group->name);
1223
+ }
1224
+ if (! (array_key_exists($group->term_id, $no_delete))) {
1225
+ $actions['delete'] = "<a class='delete:the-list:group-$group->term_id submitdelete' href='" . wp_nonce_url("admin.php?page=avhec-grouped&amp;action=delete&amp;group_ID=$group->term_id", 'delete-avhecgroup_' . $group->term_id) . "'>" . __('Delete') . "</a>";
1226
+ }
1227
+ $action_count = count($actions);
1228
+ $i = 0;
1229
+ $edit .= '<div class="row-actions">';
1230
+ foreach ($actions as $action => $link) {
1231
+ ++ $i;
1232
+ ($i == $action_count) ? $sep = '' : $sep = ' | ';
1233
+ $edit .= "<span class='$action'>$link$sep</span>";
1234
+ }
1235
+ $edit .= '</div>';
1236
+ } else {
1237
+ $edit = $group->name;
1238
+ }
1239
+
1240
+ $row_class = 'alternate' == $row_class ? '' : 'alternate';
1241
+ $qe_data = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
1242
+
1243
+ $output = "<tr id='group-$group->term_id' class='iedit $row_class'>";
1244
+
1245
+ $columns = get_column_headers('categories_group');
1246
+ $hidden = get_hidden_columns('categories_group');
1247
+ foreach ($columns as $column_name => $column_display_name) {
1248
+ $class = 'class="' . $column_name . ' column-' . $column_name . '"';
1249
+
1250
+ $style = '';
1251
+ if (in_array($column_name, $hidden))
1252
+ $style = ' style="display:none;"';
1253
+
1254
+ $attributes = $class . $style;
1255
+
1256
+ switch ($column_name) {
1257
+ case 'cb':
1258
+ $output .= '<th scope="row" class="check-column">';
1259
+ if (! (array_key_exists($group->term_id, $no_delete))) {
1260
+ $output .= '<input type="checkbox" name="delete[]" value="' . $group->term_id . '" />';
1261
+ } else {
1262
+ $output .= "&nbsp;";
1263
+ }
1264
+ $output .= '</th>';
1265
+ break;
1266
+ case 'name':
1267
+ $output .= '<td ' . $attributes . '>' . $edit;
1268
+ $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
1269
+ $output .= '<div class="name">' . $qe_data->name . '</div>';
1270
+ $output .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
1271
+ $output .= '</div></td>';
1272
+ break;
1273
+ case 'widget-title':
1274
+ $title = $this->catgrp->getWidgetTitleForGroup($group->term_id);
1275
+ if (! $title) {
1276
+ $title = "&nbsp;";
1277
+ }
1278
+ $output .= '<td ' . $attributes . '>' . $title . '</td>';
1279
+ break;
1280
+
1281
+ case 'description':
1282
+ $output .= '<td ' . $attributes . '>' . $qe_data->description . '</td>';
1283
+ break;
1284
+ case 'slug':
1285
+ $output .= "<td $attributes>" . apply_filters('editable_slug', $qe_data->slug) . "</td>";
1286
+ break;
1287
+ case 'cat-in-group':
1288
+ $cats = $this->catgrp->getCategoriesFromGroup($group_term_id);
1289
+ $catname = array ();
1290
+ foreach ($cats as $cat_id) {
1291
+ $catname[] = get_cat_name($cat_id);
1292
+ }
1293
+ natsort($catname);
1294
+ $cat = implode(', ', $catname);
1295
+ $output .= '<td ' . $attributes . '>' . $cat . '</td>';
1296
+ break;
1297
+
1298
+ }
1299
+ }
1300
+ $output .= '</tr>';
1301
+
1302
+ return $output;
1303
+ }
1304
+
1305
+ /**
1306
+ * Prints the general nonces, used by the AJAX
1307
+ */
1308
+ function printMetaboxGeneralNonces ()
1309
+ {
1310
+ echo '<form style="display:none" method="get" action="">';
1311
+ echo '<p>';
1312
+ wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1313
+ wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1314
+ echo '</p>';
1315
+ echo '</form>';
1316
+
1317
+ }
1318
+
1319
+ /**
1320
+ * Print the Metabox JS for toggling closed and open
1321
+ *
1322
+ * @param $boxid
1323
+ */
1324
+ function printMetaboxJS ($boxid)
1325
+ {
1326
+ $a = $this->hooks['menu_' . $boxid];
1327
+ echo '<script type="text/javascript">' . "\n";
1328
+ echo ' //<![CDATA[' . "\n";
1329
+ echo ' jQuery(document).ready( function($) {' . "\n";
1330
+ echo ' $(\'.if-js-closed\').removeClass(\'if-js-closed\').addClass(\'closed\');' . "\n";
1331
+ echo ' // postboxes setup' . "\n";
1332
+ echo ' postboxes.add_postbox_toggles(\'' . $a . '\');' . "\n";
1333
+ echo ' });' . "\n";
1334
+ echo ' //]]>' . "\n";
1335
+ echo '</script>';
1336
+
1337
+ }
1338
+
1339
+ /**
1340
+ * Display plugin Copyright
1341
+ *
1342
+ */
1343
+ function printAdminFooter ()
1344
+ {
1345
+ echo '<p class="footer_avhec">';
1346
+ printf('&copy; Copyright %d <a href="http://blog.avirtualhome.com/" title="My Thoughts">Peter van der Does</a> | AVH Extended Categories Version %s', date('Y'), $this->core->version);
1347
+ echo '</p>';
1348
+ }
1349
+
1350
+ /**
1351
+ * Display WP alert
1352
+ *
1353
+ */
1354
+ function displayMessage ()
1355
+ {
1356
+ if ($this->message != '') {
1357
+ $message = $this->message;
1358
+ $status = $this->status;
1359
+ $this->message = $this->status = ''; // Reset
1360
+ }
1361
+ if (isset($message)) {
1362
+ $status = ($status != '') ? $status : 'updated fade';
1363
+ echo '<div id="message" class="' . $status . '">';
1364
+ echo '<p><strong>' . $message . '</strong></p></div>';
1365
+ }
1366
+ }
1367
+
1368
+ /**
1369
+ * Ouput formatted options
1370
+ *
1371
+ * @param array $option_data
1372
+ * @return string
1373
+ */
1374
+ function printOptions ($option_data, $option_actual)
1375
+ {
1376
+ // Generate output
1377
+ $output = '';
1378
+ $output .= "\n" . '<table class="form-table avhec-options">' . "\n";
1379
+ foreach ($option_data as $option) {
1380
+ $section = substr($option[0], strpos($option[0], '[') + 1);
1381
+ $section = substr($section, 0, strpos($section, ']['));
1382
+ $option_key = rtrim($option[0], ']');
1383
+ $option_key = substr($option_key, strpos($option_key, '][') + 2);
1384
+ // Helper
1385
+ if ($option[2] == 'helper') {
1386
+ $output .= '<tr style="vertical-align: top;"><td class="helper" colspan="2">' . wp_filter_post_kses($option[4]) . '</td></tr>' . "\n";
1387
+ continue;
1388
+ }
1389
+ switch ($option[2]) {
1390
+ case 'checkbox':
1391
+ $input_type = '<input type="checkbox" id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option[3]) . '" ' . $this->isChecked('1', $option_actual[$section][$option_key]) . ' />' . "\n";
1392
+ $explanation = $option[4];
1393
+ break;
1394
+ case 'dropdown':
1395
+ $selvalue = $option[3];
1396
+ $seltext = $option[4];
1397
+ $seldata = '';
1398
+ foreach ((array) $selvalue as $key => $sel) {
1399
+ $seldata .= '<option value="' . esc_attr($sel) . '" ' . (($option_actual[$section][$option_key] == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($seltext[$key])) . '</option>' . "\n";
1400
+ }
1401
+ $input_type = '<select id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '">' . $seldata . '</select>' . "\n";
1402
+ $explanation = $option[5];
1403
+ break;
1404
+ case 'text-color':
1405
+ $input_type = '<input type="text" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" /><div class="box_color ' . esc_attr($option[0]) . '"></div>' . "\n";
1406
+ $explanation = $option[4];
1407
+ break;
1408
+ case 'textarea':
1409
+ $input_type = '<textarea rows="' . esc_attr($option[5]) . '" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" size="' . esc_attr($option[3]) . '" />' . $option_actual[$section][$option_key] . '</textarea>';
1410
+ $explanation = $option[4];
1411
+ break;
1412
+ case 'catlist':
1413
+ ob_start();
1414
+ echo '<div id="avhec-catlist">';
1415
+ echo '<ul>';
1416
+ wp_category_checklist(0, 0, $option_actual[$section][$option_key]);
1417
+ echo '</ul>';
1418
+ echo '</div>';
1419
+ $input_type = ob_get_contents();
1420
+ ob_end_clean();
1421
+ $explanation = $option[4];
1422
+ break;
1423
+ case 'text':
1424
+ default:
1425
+ $input_type = '<input type="text" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" />' . "\n";
1426
+ $explanation = $option[4];
1427
+ break;
1428
+ }
1429
+ // Additional Information
1430
+ $extra = '';
1431
+ if ($explanation) {
1432
+ $extra = '<br /><span class="description">' . wp_filter_kses($explanation) . '</span>' . "\n";
1433
+ }
1434
+ // Output
1435
+ $output .= '<tr style="vertical-align: top;"><th align="left" scope="row"><label for="' . esc_attr($option[0]) . '">' . wp_filter_kses($option[1]) . '</label></th><td>' . $input_type . ' ' . $extra . '</td></tr>' . "\n";
1436
+ }
1437
+ $output .= '</table>' . "\n";
1438
+ return $output;
1439
+ }
1440
+
1441
+ /**
1442
+ * Used in forms to set an option checked
1443
+ *
1444
+ * @param mixed $checked
1445
+ * @param mixed $current
1446
+ * @return strings
1447
+ */
1448
+ function isChecked ($checked, $current)
1449
+ {
1450
+ $return = '';
1451
+ if ($checked == $current) {
1452
+ $return = ' checked="checked"';
1453
+ }
1454
+ return $return;
1455
+ }
1456
+
1457
+ /**
1458
+ * Displays the icon on the menu pages
1459
+ *
1460
+ * @param $icon
1461
+ */
1462
+ function displayIcon ($icon)
1463
+ {
1464
+ return ('<div class="icon32" id="icon-' . $icon . '"><br/></div>');
1465
+ }
1466
+
1467
+ /**
1468
+ * Ajax Helper: inline delete of the groups
1469
+ */
1470
+ function ajaxDeleteGroup ()
1471
+ {
1472
+ $group_id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
1473
+ check_ajax_referer('delete-avhecgroup_' . $group_id);
1474
+
1475
+ if (! current_user_can('manage_categories')) {
1476
+ die('-1');
1477
+ }
1478
+ $check = $this->catgrp->getGroup($group_id);
1479
+ if (false === $check) {
1480
+ die('1');
1481
+ }
1482
+
1483
+ if ($this->catgrp->doDeleteGroup($group_id)) {
1484
+ die('1');
1485
+ } else {
1486
+ die('0');
1487
+ }
1488
+ }
1489
+ }
1490
+ ?>
3.3/class/avh-ec.category-group.php ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * AVH Extended Categorie Category Group Class
5
+ *
6
+ * @author Peter van der Does
7
+ */
8
+ class AVH_EC_Category_Group
9
+ {
10
+ /**
11
+ * Taxonomy name
12
+ * @var string
13
+ */
14
+ var $taxonomy_name;
15
+
16
+ var $db_options_widget_titles;
17
+
18
+ var $options_widget_titles;
19
+
20
+ var $widget_done_catgroup;
21
+
22
+ /**
23
+ * PHP4 constructor.
24
+ *
25
+ */
26
+ function AVH_EC_Category_Group ()
27
+ {
28
+ return $this->__construct();
29
+ }
30
+
31
+ /**
32
+ * PHP5 Constructor
33
+ * Init the Database Abstraction layer
34
+ *
35
+ */
36
+ function __construct ()
37
+ {
38
+ global $wpdb;
39
+
40
+ register_shutdown_function(array ( &$this, '__destruct' ));
41
+
42
+ /**
43
+ * Taxonomy name
44
+ * @var string
45
+ */
46
+ $this->taxonomy_name = 'avhec_catgroup';
47
+
48
+ $this->db_options_widget_titles = 'avhec_widget_titles';
49
+ // add DB pointer
50
+ $wpdb->avhec_cat_group = $wpdb->prefix . 'avhec_category_groups';
51
+
52
+ /**
53
+ * Create the table if it doesn't exist.
54
+ *
55
+ */
56
+ if ($wpdb->get_var('show tables like \'' . $wpdb->avhec_cat_group . '\'') != $wpdb->avhec_cat_group) {
57
+ add_action('init', array ( &$this, 'doCreateTable' ), 2); // Priority needs to be the same as the Register Taxonomy
58
+ }
59
+ add_action('init', array ( &$this, 'doRegisterTaxonomy' ), 2); // Priority for registering custom taxonomies is +1 over the creation of the initial taxonomies
60
+ add_action('init', array ( &$this, 'doSetupOptions' ));
61
+
62
+ add_action('admin_init', array ( &$this, 'addMetaBoxes' ));
63
+
64
+ }
65
+
66
+ /**
67
+ * PHP5 style destructor and will run when database object is destroyed.
68
+ *
69
+ * @return bool Always true
70
+ */
71
+ function __destruct ()
72
+ {
73
+ return true;
74
+ }
75
+
76
+ /**
77
+ * Create Table
78
+ * @WordPress action init
79
+ *
80
+ */
81
+ function doCreateTable ()
82
+ {
83
+ global $wpdb;
84
+
85
+ // Setup the DB Tables
86
+ $charset_collate = '';
87
+
88
+ if (! empty($wpdb->charset)) {
89
+ $charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
90
+ }
91
+ if (! empty($wpdb->collate)) {
92
+ $charset_collate .= ' COLLATE ' . $wpdb->collate;
93
+ }
94
+
95
+ $sql = 'CREATE TABLE `' . $wpdb->avhec_cat_group . '` ( `group_term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`group_term_id`, `term_id`) )' . $charset_collate . ';';
96
+
97
+ $result = $wpdb->query($sql);
98
+ }
99
+
100
+ /**
101
+ * Setup Group Categories Taxonomy
102
+ * @WordPress action init
103
+ *
104
+ */
105
+ function doRegisterTaxonomy ()
106
+ {
107
+ /**
108
+ * As we don't want to see the Menu Item we have to disable show_ui. This also disables the metabox on the posts and pages, so we add thse manually instead.
109
+ * We remove the capabilities to manage, edit and delete the terms. We have written this part ourselves and don't use WordPress for these functions. The only one we use is the assign_terms.
110
+ */
111
+ $labels = array ( 'name' => __('Category Groups', 'avh-ec'), 'singular_name' => __('Category Group', 'avh-ec'), 'search_items' => __('Search Category Groups', 'avh-ec'), 'popular_items' => __('Popular Category Groups'), 'all_items' => __('All Category Groups'), 'parent_item' => __('Parent Category Group'), 'parent_item_colon' => __('Parent Category Group:'), 'edit_item' => __('Edit Category Group'), 'update_item' => __('Update Category Group'), 'add_new_item' => __('Add New Category Group'), 'new_item_name' => __('New Category Group Name') );
112
+ $caps = array ( 'manage_terms' => null, 'edit_terms' => null, 'delete_terms' => null, 'assign_terms' => 'edit_posts' );
113
+ register_taxonomy($this->taxonomy_name, array ( 'post', 'page' ), array ( 'hierarchical' => TRUE, 'labels' => $labels, 'query_var' => TRUE, 'rewrite' => TRUE, 'show_in_nav_menus' => FALSE, 'public' => TRUE, 'show_ui' => FALSE, 'capabilities' => $caps ));
114
+
115
+ }
116
+
117
+ /**
118
+ * Setup the options for the widget titles
119
+ * @WordPress action init
120
+ *
121
+ */
122
+ function doSetupOptions ()
123
+ {
124
+ // Setup the standard groups if the none group does not exists.
125
+ $all_categories = $this->getAllCategoriesTermID();
126
+ if (false === $this->getTermIDBy('slug', 'none')) {
127
+ $none_group_id = wp_insert_term('none', $this->taxonomy_name, array ( 'description' => __('This group will not show the widget.', 'avh-ec') ));
128
+ $all_group_id = wp_insert_term('All', $this->taxonomy_name, array ( 'description' => __('Holds all the categories.', 'avh-ec') ));
129
+ $home_group_id = wp_insert_term('Home', $this->taxonomy_name, array ( 'description' => __('This group will be shown on the front page.', 'avh-ec') ));
130
+
131
+ // Fill the standard groups with all categories
132
+ $this->setCategoriesForGroup($home_group_id['term_id'], $all_categories);
133
+ $this->setWidgetTitleForGroup($all_group_id['term_id'], '');
134
+ $this->setWidgetTitleForGroup($home_group_id['term_id'], '');
135
+ }
136
+
137
+ $options = get_option($this->db_options_widget_titles);
138
+ if (! $options) {
139
+ $options = array ();
140
+ $id = $this->getTermIDBy('slug', 'all');
141
+ $options[$id] = '';
142
+ $id = $this->getTermIDBy('slug', 'home');
143
+ $options[$id] = '';
144
+ update_option($this->db_options_widget_titles, $options);
145
+ }
146
+ $this->options_widget_titles = $options;
147
+ $this->setCategoriesForGroup($this->getTermIDBy('slug', 'all'), $all_categories);
148
+ }
149
+
150
+ /**
151
+ * Add the metaboxes for the pots and page pages.
152
+ * @WordPress action admin_init
153
+ *
154
+ */
155
+ function addMetaBoxes ()
156
+ {
157
+ add_meta_box($this->taxonomy_name . 'div', __('Category Groups', 'avh-ec'), 'post_categories_meta_box', 'post', 'side', 'core', array ( 'taxonomy' => $this->taxonomy_name ));
158
+ add_meta_box($this->taxonomy_name . 'div', __('Category Groups', 'avh-ec'), 'post_categories_meta_box', 'page', 'side', 'core', array ( 'taxonomy' => $this->taxonomy_name ));
159
+ }
160
+
161
+ /**
162
+ * Get all groups term_id
163
+ *
164
+ * @return array Term_id
165
+ */
166
+ function getAllCategoriesTermID ()
167
+ {
168
+ $all_cat_id = array ();
169
+ $categories = get_categories();
170
+ if (! is_wp_error($categories)) {
171
+ foreach ($categories as $category) {
172
+ $all_cat_id[] = $category->term_id;
173
+ }
174
+ }
175
+ return ($all_cat_id);
176
+ }
177
+
178
+ /**
179
+ * Get the categories from the given group from the DB
180
+ *
181
+ * @param int $group_id The Taxonomy Term ID
182
+ * @return Array|False categories. Will return FALSE, if the row does not exists.
183
+ *
184
+ */
185
+ function getCategoriesFromGroup ($group_id)
186
+ {
187
+ global $wpdb;
188
+
189
+ // Query database
190
+ $result = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->terms . ' t, ' . $wpdb->avhec_cat_group . ' cg WHERE t.term_id = cg.term_id AND cg.group_term_id = %d', $group_id));
191
+
192
+ if (is_array($result)) { // Call succeeded
193
+ if (empty($result)) { // No rows found
194
+ $return = array ();
195
+ } else {
196
+ foreach ($result as $row) {
197
+ $return[] = $row->term_id;
198
+ }
199
+ }
200
+ } else {
201
+ $return = false;
202
+ }
203
+ return ($return);
204
+ }
205
+
206
+ /**
207
+ * Set the categories for the given group from the DB. Insert the group if it doesn't exists.
208
+ *
209
+ * @param int $group_id The Taxonomy Term ID
210
+ * @param array $categories The categories
211
+ * @return Object (false if not found)
212
+ *
213
+ */
214
+ function setCategoriesForGroup ($group_id, $categories = array())
215
+ {
216
+ global $wpdb;
217
+
218
+ $old_categories = $this->getCategoriesFromGroup($group_id);
219
+
220
+ if (! is_array($categories)) {
221
+ $categories = array ();
222
+ }
223
+ $new_categories = $categories;
224
+ sort($old_categories);
225
+ sort($new_categories);
226
+ // If the new and old values are the same, no need to update.
227
+ if ($new_categories === $old_categories) {
228
+ return false;
229
+ }
230
+
231
+ $new = array_diff($new_categories, $old_categories);
232
+ $removed = array_diff($old_categories, $new_categories);
233
+
234
+ if (! empty($new)) {
235
+ foreach ($new as $cat_term_id) {
236
+ $insert[] = '(' . $group_id . ',' . $cat_term_id . ')';
237
+ }
238
+ $value = implode(',', $insert);
239
+ $sql = 'INSERT INTO ' . $wpdb->avhec_cat_group . ' (group_term_id, term_id) VALUES ' . $value;
240
+ $result = $wpdb->query($sql);
241
+
242
+ }
243
+
244
+ if (! empty($removed)) {
245
+ $delete = implode(',', $removed);
246
+ $sql = $wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d and term_id IN (' . $delete . ')', $group_id);
247
+ $result = $wpdb->query($sql);
248
+
249
+ }
250
+
251
+ return $result;
252
+ }
253
+
254
+ /**
255
+ * Set the Widget Title for a Group
256
+ * @param int $group_id
257
+ * @param string $widget_title
258
+ *
259
+ */
260
+ function setWidgetTitleForGroup ($group_id, $widget_title = '')
261
+ {
262
+ $this->options_widget_titles[$group_id] = $widget_title;
263
+ update_option($this->db_options_widget_titles, $this->options_widget_titles);
264
+ }
265
+
266
+ /**
267
+ * Return the title for a group_id if exsist otherwise return false
268
+ * @param $group_id
269
+ *
270
+ */
271
+ function getWidgetTitleForGroup ($group_id)
272
+ {
273
+ if (isset($this->options_widget_titles[$group_id])) {
274
+ return ($this->options_widget_titles[$group_id]);
275
+ }
276
+ return false;
277
+ }
278
+
279
+ /**
280
+ * Delete the Widget Title for a group
281
+ *
282
+ * @param $group_id
283
+ */
284
+ function doDeleteWidgetTitle ($group_id)
285
+ {
286
+ if (isset($this->db_options_widget_titles[$group_id])) {
287
+ unset($this->db_options_widget_titles[$group_id]);
288
+ }
289
+ update_option($this->db_options_widget_titles, $this->options_widget_titles);
290
+ }
291
+
292
+ /**
293
+ * Same as get_term_by, but returns the ID only if found, else false
294
+ * @param string $field
295
+ * @param string $value
296
+ * @return int|boolean
297
+ */
298
+ function getTermIDBy ($field, $value)
299
+ {
300
+ $row = get_term_by($field, $value, $this->taxonomy_name);
301
+ if (false === $row) {
302
+ $return = false;
303
+ } else {
304
+ $return = (int) $row->term_id;
305
+ }
306
+ return ($return);
307
+ }
308
+
309
+ /**
310
+ * Gets all information of a group
311
+ *
312
+ * @param $group_id
313
+ * @return Object|False Returns False when the group doesn't exists.
314
+ */
315
+ function getGroup ($group_id)
316
+ {
317
+ global $wpdb;
318
+
319
+ $result = get_term((int) $group_id, $this->taxonomy_name);
320
+ if (null === $result) {
321
+ $result = false;
322
+ }
323
+ return ($result);
324
+ }
325
+
326
+ function getGroupByCategoryID ($category_id)
327
+ {
328
+ $return = get_term_by('slug', 'none', $this->taxonomy_name);
329
+ $cat_groups = get_terms($this->taxonomy_name, array ( 'hide_empty' => FALSE ));
330
+
331
+ foreach ($cat_groups as $group) {
332
+ $cats = $this->getCategoriesFromGroup($group->term_id);
333
+ if ($group->slug != 'all' && in_array($category_id, $cats)) {
334
+ $return = $group;
335
+ break;
336
+ }
337
+ }
338
+ return $return;
339
+ }
340
+
341
+ /**
342
+ * Inserts a new group
343
+ *
344
+ * @param $term
345
+ * @param array $args
346
+ */
347
+ function doInsertGroup ($term, $args = array(), $widget_title = '')
348
+ {
349
+ $row = wp_insert_term($term, $this->taxonomy_name, $args);
350
+ $this->setWidgetTitleForGroup($term, $widget_title);
351
+ return ($row['term_id']);
352
+ }
353
+
354
+ /**
355
+ * Deletes a group
356
+ *
357
+ * @param $group_id
358
+ */
359
+ function doDeleteGroup ($group_id)
360
+ {
361
+
362
+ global $wpdb;
363
+
364
+ $group = $this->getGroup($group_id);
365
+ $result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d', $group_id));
366
+ $this->doDeleteWidgetTitle($group_id);
367
+ $return = wp_delete_term($group->term_id, $this->taxonomy_name);
368
+
369
+ return ($return);
370
+ }
371
+
372
+ /**
373
+ * Update a group
374
+ *
375
+ * @param $group_id
376
+ * @param $selected_categories
377
+ * @param $widget_title
378
+ *
379
+ * return -1,0,1 Unknown Group, Duplicate Slug, Succesfull
380
+ */
381
+ function doUpdateGroup ($group_id, $args = array(), $selected_categories, $widget_title = '')
382
+ {
383
+
384
+ $group = $this->getGroup($group_id);
385
+ if (is_object($group)) {
386
+ $id = wp_update_term($group->term_id, $this->taxonomy_name, $args);
387
+ if (! is_wp_error($id)) {
388
+ $this->setWidgetTitleForGroup($group_id, $widget_title);
389
+ $this->setCategoriesForGroup($group_id, $selected_categories);
390
+ $return = 1; // Succesful
391
+ } else {
392
+ $return = 0; // Duplicate Slug
393
+ }
394
+ } else {
395
+ $return = - 1; // Unknown group
396
+ }
397
+ return ($return);
398
+ }
399
+
400
+ /**
401
+ * Deletes the given category from all groups
402
+ *
403
+ * @param $category_id
404
+ */
405
+ function doDeleteCategoryFromGroup ($category_id)
406
+ {
407
+ global $wpdb;
408
+ $result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE term_id=%d', $category_id));
409
+ }
410
+ }
411
+ ?>
3.3/class/avh-ec.core.php ADDED
@@ -0,0 +1,737 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AVH_EC_Core
4
+ {
5
+ var $version;
6
+ var $comment;
7
+ var $info;
8
+ var $db_options_core;
9
+ var $default_options;
10
+ var $default_options_general;
11
+ var $default_options_category_group;
12
+ var $default_options_sp_category_group;
13
+
14
+ var $db_options_tax_meta;
15
+
16
+ var $options;
17
+
18
+ /**
19
+ * PHP5 constructor
20
+ *
21
+ */
22
+ function __construct ()
23
+ {
24
+ /**
25
+ *
26
+ * @var AVH_EC_Category_Group
27
+ */
28
+ $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
29
+
30
+ $this->version = '3.6';
31
+ $this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
32
+ $this->db_options_core = 'avhec';
33
+ $this->db_options_tax_meta = 'avhec-tax_meta';
34
+
35
+ add_action('init', array ( &$this, 'handleInitializePlugin' ), 10);
36
+ }
37
+
38
+ /**
39
+ * PHP4 Constructor
40
+ *
41
+ * @return AVHExtendedCategoriesCore
42
+ */
43
+ function AVH_EC_Core ()
44
+ {
45
+ $this->__construct();
46
+ }
47
+
48
+ function handleInitializePlugin ()
49
+ {
50
+ global $wpdb;
51
+
52
+ $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
53
+ $db_version = 4;
54
+
55
+ $info['siteurl'] = get_option('siteurl');
56
+ $info['plugin_dir'] = AVHEC_PLUGIN_DIR;
57
+ $info['graphics_url'] = AVHEC_PLUGIN_URL . '/images';
58
+
59
+ // Set class property for info
60
+ $this->info = array ( 'home' => get_option('home'), 'siteurl' => $info['siteurl'], 'plugin_dir' => $info['plugin_dir'], 'js_dir' => $info['plugin_dir'] . '/js', 'graphics_url' => $info['graphics_url'] );
61
+
62
+ // Set the default options
63
+ $this->default_options_general = array ( 'version' => $this->version, 'dbversion' => $db_version, 'alternative_name_select_category' => '' );
64
+
65
+ // Set the default category group options
66
+ $no_group_id = $catgrp->getTermIDBy('slug', 'none');
67
+ $home_group_id = $catgrp->getTermIDBy('slug', 'home');
68
+ $default_group_id = $catgrp->getTermIDBy('slug', 'all');
69
+ $this->default_options_category_group = array ( 'no_group' => $no_group_id, 'home_group' => $home_group_id, 'default_group' => $default_group_id );
70
+
71
+ $this->default_options_sp_category_group = array ( 'home_group' => $home_group_id, 'category_group' => $default_group_id, 'day_group' => $default_group_id, 'month_group' => $default_group_id, 'year_group' => $default_group_id, 'author_group' => $default_group_id, 'search_group' => $default_group_id );
72
+
73
+ $this->default_options = array ( 'general' => $this->default_options_general, 'cat_group' => $this->default_options_category_group, 'widget_titles' => array (), 'sp_cat_group' => $this->default_options_sp_category_group );
74
+
75
+ /**
76
+ * Set the options for the program
77
+ *
78
+ */
79
+ $this->loadOptions();
80
+
81
+ // Check if we have to do updates
82
+ if ((! isset($this->options['general']['dbversion'])) || $this->options['general']['dbversion'] < $db_version) {
83
+ $this->doUpdateOptions($db_version);
84
+ }
85
+
86
+ $db = new AVH_DB();
87
+ if (! $db->field_exists('avhec_term_order', $wpdb->terms)) {
88
+ $wpdb->query("ALTER TABLE $wpdb->terms ADD `avhec_term_order` INT( 4 ) NULL DEFAULT '0'");
89
+ }
90
+
91
+ $this->handleTextdomain();
92
+ add_filter('get_terms_orderby', array ( &$this, 'applyOrderFilter' ), 10, 2);
93
+
94
+ }
95
+
96
+ function applyOrderFilter ($orderby, $args)
97
+ {
98
+ switch ($args['orderby']) {
99
+ case 'avhec_manualorder':
100
+ $new_orderby = 't.avhec_term_order';
101
+ break;
102
+ case 'avhec_3rdparty_mycategoryorder':
103
+ $new_orderby = 't.term_order';
104
+ break;
105
+ default:
106
+ $new_orderby = $orderby;
107
+ break;
108
+ }
109
+ return $new_orderby;
110
+ }
111
+
112
+ /**
113
+ * Loads the i18n
114
+ *
115
+ * @return
116
+ */
117
+ function handleTextdomain ()
118
+ {
119
+
120
+ load_plugin_textdomain('avh-ec', false, AVHEC_RELATIVE_PLUGIN_DIR . '/lang');
121
+
122
+ }
123
+
124
+ /**
125
+ * Checks if running version is newer and do upgrades if necessary
126
+ *
127
+ * @since 1.2.3
128
+ *
129
+ */
130
+ function doUpdateOptions ($db_version)
131
+ {
132
+ $options = $this->getOptions();
133
+
134
+ // Add none existing sections and/or elements to the options
135
+ foreach ($this->default_options as $section => $default_data) {
136
+ if (! array_key_exists($section, $options)) {
137
+ $options[$section] = $default_data;
138
+ continue;
139
+ }
140
+ foreach ($default_data as $element => $default_value) {
141
+ if (! array_key_exists($element, $options[$section])) {
142
+ $options[$section][$element] = $default_value;
143
+ }
144
+ }
145
+ }
146
+
147
+ // Remove none existing sections and/or elements from the options
148
+ foreach ($options as $section => $data) {
149
+ if (! array_key_exists($section, $this->default_options)) {
150
+ unset($options[$section]);
151
+ continue;
152
+ }
153
+ foreach ($data as $element => $value) {
154
+ if (! array_key_exists($element, $this->default_options[$section])) {
155
+ unset($options[$section][$element]);
156
+ }
157
+ }
158
+ }
159
+ /**
160
+ * Update the options to the latests versions
161
+ */
162
+ $options['general']['version'] = $this->version;
163
+ $options['general']['dbversion'] = $db_version;
164
+ $this->saveOptions($options);
165
+ }
166
+
167
+ /**
168
+ * Used in forms to set the checked option.
169
+ *
170
+ * @param mixed $checked
171
+ * @param mixed_type $current
172
+ * @return string
173
+ *
174
+ * @since 2.0
175
+ */
176
+ function isChecked ($checked, $current)
177
+ {
178
+ if ($checked == $current) {
179
+ return (' checked="checked"');
180
+ }
181
+ return ('');
182
+ }
183
+
184
+ /**
185
+ * Used in forms to set the SELECTED option
186
+ *
187
+ * @param string $current
188
+ * @param string $field
189
+ * @return string
190
+ */
191
+ function isSelected ($current, $field)
192
+ {
193
+ if ($current == $field) {
194
+ return (' SELECTED');
195
+ }
196
+ return ('');
197
+ }
198
+
199
+ /**
200
+ * Get the base directory of a directory structure
201
+ *
202
+ * @param string $directory
203
+ * @return string
204
+ *
205
+ */
206
+ function getBaseDirectory ($directory)
207
+ {
208
+ //place each directory into array and get the last element
209
+ $return = end(explode('/', $directory));
210
+
211
+ return $return;
212
+ }
213
+
214
+ /*********************************
215
+ * *
216
+ * Methods for variable: options *
217
+ * *
218
+ ********************************/
219
+
220
+ /**
221
+ * @param array $data
222
+ */
223
+ function setOptions ($options)
224
+ {
225
+ $this->options = $options;
226
+ }
227
+
228
+ /**
229
+ * return array
230
+ */
231
+ function getOptions ()
232
+ {
233
+ return ($this->options);
234
+ }
235
+
236
+ /**
237
+ * Save all current options and set the options
238
+ *
239
+ */
240
+ function saveOptions ($options)
241
+ {
242
+ update_option($this->db_options_core, $options);
243
+ wp_cache_flush(); // Delete cache
244
+ $this->setOptions($options);
245
+ }
246
+
247
+ /**
248
+ * Retrieves the plugin options from the WordPress options table and assigns to class variable.
249
+ * If the options do not exists, like a new installation, the options are set to the default value.
250
+ *
251
+ * @return none
252
+ */
253
+ function loadOptions ()
254
+ {
255
+ $options = get_option($this->db_options_core);
256
+ if (false === $options) { // New installation
257
+ $this->resetToDefaultOptions();
258
+ } else {
259
+ $this->setOptions($options);
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Get the value for an option element. If there's no option is set on the Admin page, return the default value.
265
+ *
266
+ * @param string $key
267
+ * @param string $option
268
+ * @return mixed
269
+ */
270
+ function getOptionElement ($option, $key)
271
+ {
272
+ if ($this->options[$option][$key]) {
273
+ $return = $this->options[$option][$key]; // From Admin Page
274
+ } else {
275
+ $return = $this->default_options[$option][$key]; // Default
276
+ }
277
+ return ($return);
278
+ }
279
+
280
+ /**
281
+ * Reset to default options and save in DB
282
+ *
283
+ */
284
+ function resetToDefaultOptions ()
285
+ {
286
+ $this->options = $this->default_options;
287
+ $this->saveOptions($this->default_options);
288
+ }
289
+
290
+ /**
291
+ * Display or retrieve the HTML dropdown list of categories.
292
+ *
293
+ * The list of arguments is below:
294
+ * 'show_option_all' (string) - Text to display for showing all categories.
295
+ * 'show_option_none' (string) - Text to display for showing no categories.
296
+ * 'orderby' (string) default is 'ID' - What column to use for ordering the
297
+ * categories.
298
+ * 'order' (string) default is 'ASC' - What direction to order categories.
299
+ * 'show_last_update' (bool|int) default is 0 - See {@link get_categories()}
300
+ * 'show_count' (bool|int) default is 0 - Whether to show how many posts are
301
+ * in the category.
302
+ * 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
303
+ * don't have any posts attached to them.
304
+ * 'child_of' (int) default is 0 - See {@link get_categories()}.
305
+ * 'exclude' (string) - See {@link get_categories()}.
306
+ * 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
307
+ * 'depth' (int) - The max depth.
308
+ * 'tab_index' (int) - Tab index for select element.
309
+ * 'name' (string) - The name attribute value for selected element.
310
+ * 'class' (string) - The class attribute value for selected element.
311
+ * 'selected' (int) - Which category ID is selected.
312
+ *
313
+ * The 'hierarchical' argument, which is disabled by default, will override the
314
+ * depth argument, unless it is true. When the argument is false, it will
315
+ * display all of the categories. When it is enabled it will use the value in
316
+ * the 'depth' argument.
317
+ *
318
+ * @since 2.1.0
319
+ *
320
+ * @param string|array $args Optional. Override default arguments.
321
+ * @return string HTML content only if 'echo' argument is 0.
322
+ */
323
+ function avh_wp_dropdown_categories ($args = '', $selectedonly)
324
+ {
325
+ $mywalker = new AVH_Walker_CategoryDropdown();
326
+
327
+ $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 );
328
+
329
+ $defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
330
+
331
+ $r = wp_parse_args($args, $defaults);
332
+
333
+ if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
334
+ $r['pad_counts'] = true;
335
+ }
336
+
337
+ $r['include_last_update_time'] = $r['show_last_update'];
338
+ extract($r);
339
+
340
+ $tab_index_attribute = '';
341
+ if ((int) $tab_index > 0)
342
+ $tab_index_attribute = ' tabindex="' . $tab_index . '"';
343
+
344
+ $categories = get_categories($r);
345
+ $name = esc_attr($name);
346
+ $class = esc_attr($class);
347
+
348
+ $output = '';
349
+ if (! empty($categories)) {
350
+ $output = '<select name="' . $name . '" id="' . $name . '" class="' . $class . '" ' . $tab_index_attribute . '>' . "\n";
351
+
352
+ if ($show_option_all) {
353
+ $show_option_all = apply_filters('list_cats', $show_option_all);
354
+ $selected = ('0' === strval($r['selected'])) ? " selected='selected'" : '';
355
+ $output .= "\t" . '<option value="0"' . $selected . '>' . $show_option_all . '</option>' . "\n";
356
+ }
357
+
358
+ if ($show_option_none) {
359
+ $show_option_none = apply_filters('list_cats', $show_option_none);
360
+ $selected = ('-1' === strval($r['selected'])) ? " selected='selected'" : '';
361
+ $output .= "\t" . '<option value="-1"' . $selected . '>' . $show_option_none . '</option>' . "\n";
362
+ }
363
+
364
+ if ($hierarchical) {
365
+ $depth = $r['depth']; // Walk the full depth.
366
+ } else {
367
+ $depth = - 1; // Flat
368
+ }
369
+ $output .= walk_category_dropdown_tree($categories, $depth, $r);
370
+ $output .= "</select>\n";
371
+ }
372
+
373
+ $output = apply_filters('wp_dropdown_cats', $output);
374
+
375
+ if ($echo)
376
+ echo $output;
377
+
378
+ return $output;
379
+ }
380
+
381
+ /**
382
+ * Display or retrieve the HTML list of categories.
383
+ *
384
+ * The list of arguments is below:
385
+ * 'show_option_all' (string) - Text to display for showing all categories.
386
+ * 'orderby' (string) default is 'ID' - What column to use for ordering the
387
+ * categories.
388
+ * 'order' (string) default is 'ASC' - What direction to order categories.
389
+ * 'show_last_update' (bool|int) default is 0 - See {@link
390
+ * walk_category_dropdown_tree()}
391
+ * 'show_count' (bool|int) default is 0 - Whether to show how many posts are
392
+ * in the category.
393
+ * 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
394
+ * don't have any posts attached to them.
395
+ * 'use_desc_for_title' (bool|int) default is 1 - Whether to use the
396
+ * description instead of the category title.
397
+ * 'feed' - See {@link get_categories()}.
398
+ * 'feed_type' - See {@link get_categories()}.
399
+ * 'feed_image' - See {@link get_categories()}.
400
+ * 'child_of' (int) default is 0 - See {@link get_categories()}.
401
+ * 'exclude' (string) - See {@link get_categories()}.
402
+ * 'exclude_tree' (string) - See {@link get_categories()}.
403
+ * 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
404
+ * 'current_category' (int) - See {@link get_categories()}.
405
+ * 'hierarchical' (bool) - See {@link get_categories()}.
406
+ * 'title_li' (string) - See {@link get_categories()}.
407
+ * 'depth' (int) - The max depth.
408
+ *
409
+ * @since 2.1.0
410
+ *
411
+ * @param string|array $args Optional. Override default arguments.
412
+ * @return string HTML content only if 'echo' argument is 0.
413
+ */
414
+ function avh_wp_list_categories ($args = '', $selectedonly)
415
+ {
416
+ $mywalker = new AVHEC_Walker_Category();
417
+ $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, 'walker' => $mywalker );
418
+
419
+ $r = wp_parse_args($args, $defaults);
420
+
421
+ if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
422
+ $r['pad_counts'] = true;
423
+ }
424
+
425
+ if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
426
+ $r['pad_counts'] = true;
427
+ }
428
+
429
+ if (isset($r['show_date'])) {
430
+ $r['include_last_update_time'] = $r['show_date'];
431
+ }
432
+
433
+ if (true == $r['hierarchical']) {
434
+ $r['exclude_tree'] = $r['exclude'];
435
+ $r['exclude'] = '';
436
+ }
437
+
438
+ extract($r);
439
+
440
+ $categories = get_categories($r);
441
+
442
+ $output = '';
443
+ if ($title_li && 'list' == $style)
444
+ $output = '<li class="categories">' . $r['title_li'] . '<ul>';
445
+
446
+ if (empty($categories)) {
447
+ if ('list' == $style)
448
+ $output .= '<li>' . __("No categories") . '</li>';
449
+ else
450
+ $output .= __("No categories");
451
+ } else {
452
+ global $wp_query;
453
+
454
+ if (! empty($show_option_all))
455
+ if ('list' == $style)
456
+ $output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
457
+ else
458
+ $output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
459
+
460
+ if (empty($r['current_category']) && is_category())
461
+ $r['current_category'] = $wp_query->get_queried_object_id();
462
+
463
+ if ($hierarchical) {
464
+ $depth = $r['depth'];
465
+ } else {
466
+ $depth = - 1; // Flat.
467
+ }
468
+
469
+ $output .= walk_category_tree($categories, $depth, $r);
470
+ }
471
+
472
+ if ($title_li && 'list' == $style)
473
+ $output .= '</ul></li>';
474
+
475
+ $output = apply_filters('wp_list_categories', $output);
476
+
477
+ if ($echo)
478
+ echo $output;
479
+ else
480
+ return $output;
481
+ }
482
+
483
+ function getCategories ()
484
+ {
485
+ static $_categories = NULL;
486
+ if (NULL === $_categories) {
487
+ $_categories = get_categories('get=all');
488
+ }
489
+ return $_categories;
490
+ }
491
+
492
+ function getCategoriesId ($categories)
493
+ {
494
+ static $_categories_id = NULL;
495
+ if (NULL == $_categories_id) {
496
+ foreach ($categories as $key => $category) {
497
+ $_categories_id[$category->term_id] = $key;
498
+ }
499
+ }
500
+ return $_categories_id;
501
+ }
502
+ }
503
+
504
+ /**
505
+ * Create HTML dropdown list of Categories.
506
+ *
507
+ * @uses Walker
508
+ */
509
+ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
510
+ {
511
+
512
+ function walk ($elements, $max_depth)
513
+ {
514
+
515
+ $args = array_slice(func_get_args(), 2);
516
+ $output = '';
517
+
518
+ if ($max_depth < - 1) //invalid parameter
519
+ return $output;
520
+
521
+ if (empty($elements)) //nothing to walk
522
+ return $output;
523
+
524
+ $id_field = $this->db_fields['id'];
525
+ $parent_field = $this->db_fields['parent'];
526
+
527
+ // flat display
528
+ if (- 1 == $max_depth) {
529
+ $empty_array = array ();
530
+ foreach ($elements as $e)
531
+ $this->display_element($e, $empty_array, 1, 0, $args, $output);
532
+ return $output;
533
+ }
534
+
535
+ /*
536
+ * need to display in hierarchical order
537
+ * seperate elements into two buckets: top level and children elements
538
+ * children_elements is two dimensional array, eg.
539
+ * children_elements[10][] contains all sub-elements whose parent is 10.
540
+ */
541
+ $top_level_elements = array ();
542
+ $children_elements = array ();
543
+ foreach ($elements as $e) {
544
+ if (0 == $e->$parent_field)
545
+ $top_level_elements[] = $e;
546
+ else
547
+ $children_elements[$e->$parent_field][] = $e;
548
+ }
549
+
550
+ /*
551
+ * when none of the elements is top level
552
+ * assume the first one must be root of the sub elements
553
+ */
554
+ if (empty($top_level_elements)) {
555
+
556
+ $first = array_slice($elements, 0, 1);
557
+ $root = $first[0];
558
+
559
+ $top_level_elements = array ();
560
+ $children_elements = array ();
561
+ foreach ($elements as $e) {
562
+ if ($root->$parent_field == $e->$parent_field)
563
+ $top_level_elements[] = $e;
564
+ else
565
+ $children_elements[$e->$parent_field][] = $e;
566
+ }
567
+ }
568
+
569
+ foreach ($top_level_elements as $e) {
570
+ $this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
571
+ }
572
+
573
+ /*
574
+ * if we are displaying all levels, and remaining children_elements is not empty,
575
+ * then we got orphans, which should be displayed regardless
576
+ */
577
+ if ((0 == $max_depth) && count($children_elements) > 0) {
578
+ $empty_array = array ();
579
+ foreach ($children_elements as $orphans)
580
+ foreach ($orphans as $op)
581
+ $this->display_element($op, $empty_array, 1, 0, $args, $output);
582
+ }
583
+
584
+ return $output;
585
+ }
586
+ }
587
+
588
+ /**
589
+ * Create HTML list of categories.
590
+ *
591
+ * @uses Walker
592
+ */
593
+ class AVHEC_Walker_Category extends Walker
594
+ {
595
+ /**
596
+ * @see Walker::$tree_type
597
+ * @since 2.1.0
598
+ * @var string
599
+ */
600
+ var $tree_type = 'category';
601
+
602
+ /**
603
+ * @see Walker::$db_fields
604
+ * @since 2.1.0
605
+ * @todo Decouple this
606
+ * @var array
607
+ */
608
+ var $db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' );
609
+
610
+ /**
611
+ * @see Walker::start_lvl()
612
+ * @since 2.1.0
613
+ *
614
+ * @param string $output Passed by reference. Used to append additional content.
615
+ * @param int $depth Depth of category. Used for tab indentation.
616
+ * @param array $args Will only append content if style argument value is 'list'.
617
+ */
618
+ function start_lvl (&$output, $depth, $args)
619
+ {
620
+ if ('list' != $args['style'])
621
+ return;
622
+
623
+ $indent = str_repeat("\t", $depth);
624
+ $output .= $indent . '<ul class="children">' . "\n";
625
+ }
626
+
627
+ /**
628
+ * @see Walker::end_lvl()
629
+ * @since 2.1.0
630
+ *
631
+ * @param string $output Passed by reference. Used to append additional content.
632
+ * @param int $depth Depth of category. Used for tab indentation.
633
+ * @param array $args Will only append content if style argument value is 'list'.
634
+ */
635
+ function end_lvl (&$output, $depth, $args)
636
+ {
637
+ if ('list' != $args['style'])
638
+ return;
639
+
640
+ $indent = str_repeat("\t", $depth);
641
+ $output .= $indent . '</ul>' . "\n";
642
+ }
643
+
644
+ /**
645
+ * @see Walker::start_el()
646
+ * @since 2.1.0
647
+ *
648
+ * @param string $output Passed by reference. Used to append additional content.
649
+ * @param object $category Category data object.
650
+ * @param int $depth Depth of category in reference to parents.
651
+ * @param array $args
652
+ */
653
+ function start_el (&$output, $category, $depth, $args)
654
+ {
655
+ extract($args);
656
+
657
+ $cat_name = esc_attr($category->name);
658
+ $cat_name = apply_filters('list_cats', $cat_name, $category);
659
+ $link = '<div class="avhec-widget-line"><a href="' . get_category_link($category->term_id) . '" ';
660
+ if ($use_desc_for_title == 0 || empty($category->description))
661
+ $link .= 'title="' . sprintf(__('View all posts filed under %s'), $cat_name) . '"';
662
+ else
663
+ $link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"';
664
+ $link .= '>';
665
+ $link .= $cat_name . '</a>';
666
+
667
+ if ((! empty($feed_image)) || (! empty($feed))) {
668
+ $link .= '<div class="avhec-widget-rss"> ';
669
+
670
+ if (empty($feed_image))
671
+ $link .= '(';
672
+
673
+ $link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"';
674
+
675
+ if (empty($feed))
676
+ $alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"';
677
+ else {
678
+ $title = ' title="' . $feed . '"';
679
+ $alt = ' alt="' . $feed . '"';
680
+ $name = $feed;
681
+ $link .= $title;
682
+ }
683
+
684
+ $link .= '>';
685
+
686
+ if (empty($feed_image))
687
+ $link .= $name;
688
+ else
689
+ $link .= '<img src="' . $feed_image . '"' . $alt . $title . ' />';
690
+ $link .= '</a>';
691
+ if (empty($feed_image))
692
+ $link .= ')';
693
+ $link .= '</div>';
694
+ }
695
+
696
+ if (isset($show_count) && $show_count)
697
+ $link .= '<div class="avhec-widget-count"> (' . intval($category->count) . ')</div>';
698
+
699
+ if (isset($show_date) && $show_date) {
700
+ $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
701
+ }
702
+
703
+ if (isset($current_category) && $current_category)
704
+ $_current_category = get_category($current_category);
705
+
706
+ if ('list' == $args['style']) {
707
+ $output .= "\t" . '<li';
708
+ $class = 'cat-item cat-item-' . $category->term_id;
709
+ if (isset($current_category) && $current_category && ($category->term_id == $current_category))
710
+ $class .= ' current-cat';
711
+ elseif (isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent))
712
+ $class .= ' current-cat-parent';
713
+ $output .= ' class="' . $class . '"';
714
+ $output .= '>' . $link . '</div>' . "\n";
715
+ } else {
716
+ $output .= "\t" . $link . '</div><br />' . "\n";
717
+ }
718
+ }
719
+
720
+ /**
721
+ * @see Walker::end_el()
722
+ * @since 2.1.0
723
+ *
724
+ * @param string $output Passed by reference. Used to append additional content.
725
+ * @param object $page Not used.
726
+ * @param int $depth Depth of category. Not used.
727
+ * @param array $args Only uses 'list' for whether should append to output.
728
+ */
729
+ function end_el (&$output, $page, $depth, $args)
730
+ {
731
+ if ('list' != $args['style'])
732
+ return;
733
+
734
+ $output .= '</li>' . "\n";
735
+ }
736
+ }
737
+ ?>
3.3/class/avh-ec.widgets.php ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Widget Class for displaying categories. Extended version of the dfeault categories.
5
+ *
6
+ */
7
+ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
8
+ {
9
+ /**
10
+ *
11
+ * @var AVH_EC_Core
12
+ */
13
+ var $core;
14
+
15
+ /**
16
+ * PHP 5 Constructor
17
+ *
18
+ */
19
+ function __construct ()
20
+ {
21
+ $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
22
+
23
+ //Convert the old option widget_extended_categories to widget_extended-categories
24
+ $old = get_option('widget_extended_categories');
25
+ if (! (FALSE === $old)) {
26
+ update_option('widget_extended-categories', $old);
27
+ delete_option('widget_extended_categories');
28
+ }
29
+ $widget_ops = array ( 'description' => __("An extended version of the default Categories widget.", 'avh-ec') );
30
+ WP_Widget::__construct('extended-categories', 'AVH Extended Categories', $widget_ops);
31
+
32
+ add_action('wp_print_styles', array ( &$this, 'actionWpPrintStyles' ));
33
+
34
+ }
35
+
36
+ function WP_Widget_AVH_ExtendedCategories_Normal ()
37
+ {
38
+ $this->__construct();
39
+ }
40
+
41
+ function actionWpPrintStyles ()
42
+ {
43
+
44
+ if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
45
+ wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version);
46
+ wp_enqueue_style('avhec-widget');
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Display the widget
52
+ *
53
+ * @param unknown_type $args
54
+ * @param unknown_type $instance
55
+ */
56
+ function widget ($args, $instance)
57
+ {
58
+
59
+ extract($args);
60
+
61
+ $selectedonly = $instance['selectedonly'] ? TRUE : FALSE;
62
+ $c = $instance['count'] ? TRUE : FALSE;
63
+ $h = $instance['hierarchical'] ? TRUE : FALSE;
64
+ $d = $instance['depth'] ? $instance['depth'] : 0;
65
+ $e = $instance['hide_empty'] ? TRUE : FALSE;
66
+ $use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
67
+ $s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
68
+ $o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
69
+ $r = $instance['rssfeed'] ? 'RSS' : '';
70
+ $i = $instance['rssimage'] ? $instance['rssimage'] : '';
71
+ $invert = $instance['invert_included'] ? TRUE : FALSE;
72
+
73
+ if (empty($r)) {
74
+ $i = '';
75
+ }
76
+
77
+ if (empty($d)) {
78
+ $d = 0;
79
+ }
80
+
81
+ $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
82
+ $style = empty($instance['style']) ? 'list' : $instance['style'];
83
+
84
+ $included_cats = '';
85
+ if ($instance['post_category']) {
86
+ $post_category = unserialize($instance['post_category']);
87
+ $children = array ();
88
+ if (! $instance['selectedonly']) {
89
+ foreach ($post_category as $cat_id) {
90
+ $children = array_merge($children, get_term_children($cat_id, 'category'));
91
+ }
92
+ }
93
+ $included_cats = implode(",", array_merge($post_category, $children));
94
+ }
95
+
96
+ if ($invert) {
97
+ $inc_exc = 'exclude';
98
+ } else {
99
+ $inc_exc = 'include';
100
+ }
101
+
102
+ $options = $this->core->getOptions();
103
+ $show_option_none = __('Select Category', 'avh-ec');
104
+ if ($options['general']['alternative_name_select_category']) {
105
+ $show_option_none = $options['general']['alternative_name_select_category'];
106
+ }
107
+
108
+ $cat_args = array ( $inc_exc => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, '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 );
109
+ echo $before_widget;
110
+ echo $this->core->comment;
111
+ echo $before_title . $title . $after_title;
112
+
113
+ if ($style == 'list') {
114
+ echo '<ul>';
115
+ $this->core->avh_wp_list_categories($cat_args, $selectedonly);
116
+ echo '</ul>';
117
+ } else {
118
+ $this->core->avh_wp_dropdown_categories($cat_args, $selectedonly);
119
+ echo '<script type=\'text/javascript\'>' . "\n";
120
+ echo '/* <![CDATA[ */' . "\n";
121
+ echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-' . $this->number . '");' . "\n";
122
+ echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
123
+ echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
124
+ echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
125
+ echo ' }' . "\n";
126
+ echo ' }' . "\n";
127
+ echo ' ec_dropdown_' . $this->number . '.onchange = ec_onCatChange_' . $this->number . ';' . "\n";
128
+ echo '/* ]]> */' . "\n";
129
+ echo '</script>' . "\n";
130
+ }
131
+ echo $after_widget;
132
+ }
133
+
134
+ /**
135
+ * When Widget Control Form Is Posted
136
+ *
137
+ * @param unknown_type $new_instance
138
+ * @param unknown_type $old_instance
139
+ * @return unknown
140
+ */
141
+ function update ($new_instance, $old_instance)
142
+ {
143
+ // update the instance's settings
144
+ if (! isset($new_instance['submit'])) {
145
+ return FALSE;
146
+ }
147
+
148
+ $instance = $old_instance;
149
+
150
+ $instance['title'] = strip_tags(stripslashes($new_instance['title']));
151
+ $instance['selectedonly'] = $new_instance['selectedonly'] ? TRUE : FALSE;
152
+ $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
153
+ $instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
154
+ $instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
155
+ $instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
156
+ $instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
157
+ $instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
158
+ $instance['style'] = strip_tags(stripslashes($new_instance['style']));
159
+ $instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
160
+ $instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
161
+ if (array_key_exists('all', $new_instance['post_category'])) {
162
+ $instance['post_category'] = FALSE;
163
+ } else {
164
+ $instance['post_category'] = serialize($new_instance['post_category']);
165
+ }
166
+ $instance['depth'] = (int) $new_instance['depth'];
167
+ if ($instance['depth'] < 0 || 11 < $instance['depth']) {
168
+ $instance['depth'] = 0;
169
+ }
170
+ $instance['invert_included'] = $new_instance['invert_included'] ? TRUE : FALSE;
171
+
172
+ return $instance;
173
+ }
174
+
175
+ /**
176
+ * Display Widget Control Form
177
+ *
178
+ * @param unknown_type $instance
179
+ */
180
+ function form ($instance)
181
+ {
182
+ // displays the widget admin form
183
+ $instance = wp_parse_args((array) $instance, array ( 'title' => '', 'rssimage' => '', 'depth' => 0 ));
184
+
185
+ // Prepare data for display
186
+ $depth = (int) $instance['depth'];
187
+ if ($depth < 0 || 11 < $depth) {
188
+ $depth = 0;
189
+ }
190
+ $selected_cats = ($instance['post_category'] != '') ? unserialize($instance['post_category']) : FALSE;
191
+
192
+ echo '<p>';
193
+ avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
194
+ echo '</p>';
195
+
196
+ echo '<p>';
197
+ avh_doWidgetFormCheckbox($this->get_field_id('selectedonly'), $this->get_field_name('selectedonly'), __('Show selected categories only', 'avh-ec'), (bool) $instance['selectedonly']);
198
+
199
+ avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
200
+
201
+ avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
202
+
203
+ $options = array ( 0 => __('All Levels', 'avh-ec'), 1 => __('Toplevel only', 'avh-ec') );
204
+ for ($i = 2; $i <= 11; $i ++) {
205
+ $options[$i] = __('Child ', 'avh-ec') . ($i - 1);
206
+ }
207
+ avh_doWidgetFormSelect($this->get_field_id('depth'), $this->get_field_name('depth'), __('How many levels to show', 'avh-ec'), $options, $depth);
208
+ unset($options);
209
+
210
+ avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
211
+
212
+ avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
213
+ echo '</p>';
214
+
215
+ echo '<p>';
216
+ $options['ID'] = __('ID', 'avh-ec');
217
+ $options['name'] = __('Name', 'avh-ec');
218
+ $options['count'] = __('Count', 'avh-ec');
219
+ $options['slug'] = __('Slug', 'avh-ec');
220
+ $options['avhec_manualorder'] = 'AVH EC '.__('Manual Order', 'avh-ec');
221
+ if (is_plugin_active('my-category-order/mycategoryorder.php')) {
222
+ $options['avhec_3rdparty_mycategoryorder'] = 'My Category Order';
223
+ }
224
+
225
+ avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
226
+ unset($options);
227
+
228
+ $options['asc'] = __('Ascending', 'avh-ec');
229
+ $options['desc'] = __('Descending', 'avh-ec');
230
+ avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
231
+ unset($options);
232
+
233
+ $options['list'] = __('List', 'avh-ec');
234
+ $options['drop'] = __('Drop down', 'avh-ec');
235
+ avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
236
+ unset($options);
237
+ echo '</p>';
238
+
239
+ echo '<p>';
240
+
241
+ avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
242
+
243
+ avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
244
+
245
+ echo '</p>';
246
+
247
+ echo '<p>';
248
+ echo '<b>' . __('Select categories', 'avh-ec') . '</b><hr />';
249
+ 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;">';
250
+ echo '<li id="' . $this->get_field_id('category--1') . '" class="popular-category">';
251
+ echo '<label for="' . $this->get_field_id('post_category') . '" class="selectit">';
252
+ echo '<input value="all" id="' . $this->get_field_id('post_category') . '" name="' . $this->get_field_name('post_category') . '[all]" type="checkbox" ' . (FALSE === $selected_cats ? ' CHECKED' : '') . '> ';
253
+ _e('All Categories', 'avh-ec');
254
+ echo '</label>';
255
+ echo '</li>';
256
+ ob_start();
257
+ $this->avh_wp_category_checklist($selected_cats, $this->number);
258
+ ob_end_flush();
259
+ echo '</ul>';
260
+ echo '</p>';
261
+
262
+ echo '<p>';
263
+ avh_doWidgetFormCheckbox($this->get_field_id('invert_included'), $this->get_field_name('invert_included'), __('Exclude the selected categories', 'avh-ec'), (bool) $instance['invert_included']);
264
+ echo '</p>';
265
+
266
+ echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
267
+ }
268
+
269
+ /**
270
+ * Creates the categories checklist
271
+ *
272
+ * @param int $post_id
273
+ * @param int $descendants_and_self
274
+ * @param array $selected_cats
275
+ * @param array $popular_cats
276
+ * @param int $number
277
+ */
278
+ function avh_wp_category_checklist ($selected_cats, $number)
279
+ {
280
+
281
+ $walker = new AVH_Walker_Category_Checklist();
282
+ $walker->number = $number;
283
+ $walker->input_id = $this->get_field_id('post_category');
284
+ $walker->input_name = $this->get_field_name('post_category');
285
+ $walker->li_id = $this->get_field_id('category--1');
286
+
287
+ $args = array ( 'taxonomy' => 'category', 'descendants_and_self' => 0, 'selected_cats' => $selected_cats, 'popular_cats' => array (), 'walker' => $walker, 'checked_ontop' => true, 'popular_cats' => array () );
288
+
289
+ if (is_array($selected_cats))
290
+ $args['selected_cats'] = $selected_cats;
291
+ else
292
+ $args['selected_cats'] = array ();
293
+
294
+ $categories = $this->core->getCategories();
295
+ $_categories_id = $this->core->getCategoriesId($categories);
296
+
297
+ // 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)
298
+ $checked_categories = array ();
299
+ foreach ($args['selected_cats'] as $key => $value) {
300
+ if (isset($_categories_id[$key])) {
301
+ $category_key = $_categories_id[$key];
302
+ $checked_categories[] = $categories[$category_key];
303
+ unset($categories[$category_key]);
304
+ }
305
+ }
306
+
307
+ // Put checked cats on top
308
+ echo call_user_func_array(array ( &$walker, 'walk' ), array ( $checked_categories, 0, $args ));
309
+ // Then the rest of them
310
+ echo call_user_func_array(array ( &$walker, 'walk' ), array ( $categories, 0, $args ));
311
+ }
312
+ }
313
+
314
+ /**
315
+ * Widget Class for displaying the top categories
316
+ *
317
+ */
318
+ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
319
+ {
320
+ /**
321
+ *
322
+ * @var AVH_EC_Core
323
+ */
324
+ var $core;
325
+
326
+ /**
327
+ * PHP 5 Constructor
328
+ *
329
+ */
330
+ function __construct ()
331
+ {
332
+ $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
333
+
334
+ $widget_ops = array ( 'description' => __("Shows the top categories.", 'avh-ec') );
335
+ WP_Widget::__construct(FALSE, 'AVH Extended Categories: '.__('Top Categories'), $widget_ops);
336
+ add_action('wp_print_styles', array ( &$this, 'actionWpPrintStyles' ));
337
+
338
+ }
339
+
340
+ function WP_Widget_AVH_ExtendedCategories_Top ()
341
+ {
342
+ $this->__construct();
343
+ }
344
+
345
+ function actionWpPrintStyles ()
346
+ {
347
+ if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
348
+ wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version);
349
+ wp_enqueue_style('avhec-widget');
350
+ }
351
+ }
352
+
353
+ /** Echo the widget content.
354
+ *
355
+ * Subclasses should over-ride this function to generate their widget code.
356
+ *
357
+ * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
358
+ * @param array $instance The settings for the particular instance of the widget
359
+ */
360
+ function widget ($args, $instance)
361
+ {
362
+ extract($args);
363
+
364
+ $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
365
+ $style = empty($instance['style']) ? 'list' : $instance['style'];
366
+ if (! $a = (int) $instance['amount']) {
367
+ $a = 5;
368
+ } elseif ($a < 1) {
369
+ $a = 1;
370
+ }
371
+ $c = $instance['count'] ? TRUE : FALSE;
372
+ $use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
373
+ $s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
374
+ $o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
375
+ $r = $instance['rssfeed'] ? 'RSS' : '';
376
+ $i = $instance['rssimage'] ? $instance['rssimage'] : '';
377
+ if (empty($r)) {
378
+ $i = '';
379
+ }
380
+ if (! empty($i)) {
381
+ if (! file_exists(ABSPATH . '/' . $i)) {
382
+ $i = '';
383
+ }
384
+ }
385
+
386
+ $options = $this->core->getOptions();
387
+ $show_option_none = __('Select Category', 'avh-ec');
388
+ if ($options['general']['alternative_name_select_category']) {
389
+ $show_option_none = $options['general']['alternative_name_select_category'];
390
+ }
391
+
392
+ $top_cats = get_terms('category', array ( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => $a, 'hierarchical' => FALSE ));
393
+ $included_cats = implode(",", $top_cats);
394
+
395
+ $cat_args = array ( 'include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' => FALSE, 'hierarchical' => FALSE, 'depth' => - 1, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-top-select-' . $this->number );
396
+ echo $before_widget;
397
+ echo $this->core->comment;
398
+ echo $before_title . $title . $after_title;
399
+ echo '<ul>';
400
+
401
+ if ($style == 'list') {
402
+ wp_list_categories($cat_args);
403
+ } else {
404
+ wp_dropdown_categories($cat_args);
405
+ echo '<script type=\'text/javascript\'>' . "\n";
406
+ echo '/* <![CDATA[ */' . "\n";
407
+ echo ' var ec_dropdown_top_' . $this->number . ' = document.getElementById("extended-categories-top-select-' . $this->number . '");' . "\n";
408
+ echo ' function ec_top_onCatChange_' . $this->number . '() {' . "\n";
409
+ echo ' if ( ec_dropdown_top_' . $this->number . '.options[ec_dropdown_top_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
410
+ echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_top_' . $this->number . '.options[ec_dropdown_top_' . $this->number . '.selectedIndex].value;' . "\n";
411
+ echo ' }' . "\n";
412
+ echo ' }' . "\n";
413
+ echo ' ec_dropdown_top_' . $this->number . '.onchange = ec_top_onCatChange_' . $this->number . ';' . "\n";
414
+ echo '/* ]]> */' . "\n";
415
+ echo '</script>' . "\n";
416
+ }
417
+ echo '</ul>';
418
+ echo $after_widget;
419
+ }
420
+
421
+ /** Update a particular instance.
422
+ *
423
+ * This function should check that $new_instance is set correctly.
424
+ * The newly calculated value of $instance should be returned.
425
+ * If "FALSE" is returned, the instance won't be saved/updated.
426
+ *
427
+ * @param array $new_instance New settings for this instance as input by the user via form()
428
+ * @param array $old_instance Old settings for this instance
429
+ * @return array Settings to save or bool FALSE to cancel saving
430
+ */
431
+ function update ($new_instance, $old_instance)
432
+ {
433
+ // update the instance's settings
434
+ if (! isset($new_instance['submit'])) {
435
+ return FALSE;
436
+ }
437
+
438
+ $instance = $old_instance;
439
+
440
+ $instance['title'] = strip_tags(stripslashes($new_instance['title']));
441
+ $instance['amount'] = (int) $new_instance['amount'];
442
+ $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
443
+ $instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
444
+ $instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
445
+ $instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
446
+ $instance['style'] = strip_tags(stripslashes($new_instance['style']));
447
+ $instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
448
+ $instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
449
+
450
+ return $instance;
451
+ }
452
+
453
+ /** Echo the settings update form
454
+ *
455
+ * @param array $instance Current settings
456
+ */
457
+ function form ($instance)
458
+ {
459
+ // displays the widget admin form
460
+ $instance = wp_parse_args((array) $instance, array ( 'title' => '', 'rssimage' => '' ));
461
+
462
+ // Prepare data for display
463
+ if (! $amount = (int) $instance['amount']) {
464
+ $amount = 5;
465
+ }
466
+
467
+ if ($amount < 1) {
468
+ $amount = 1;
469
+ }
470
+ echo '<p>';
471
+ avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
472
+ echo '</p>';
473
+
474
+ echo '<p>';
475
+ avh_doWidgetFormText($this->get_field_id('amount'), $this->get_field_name('amount'), __('How many categories to show', 'avh-ec'), $amount);
476
+ echo '</p>';
477
+
478
+ echo '<p>';
479
+ avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
480
+ echo '<br />';
481
+
482
+ avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
483
+ echo '</p>';
484
+
485
+ echo '<p>';
486
+ $options['ID'] = __('ID', 'avh-ec');
487
+ $options['name'] = __('Name', 'avh-ec');
488
+ $options['count'] = __('Count', 'avh-ec');
489
+ $options['slug'] = __('Slug', 'avh-ec');
490
+ avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
491
+ unset($options);
492
+
493
+ $options['asc'] = __('Ascending', 'avh-ec');
494
+ $options['desc'] = __('Descending', 'avh-ec');
495
+ avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
496
+ unset($options);
497
+
498
+ $options['list'] = __('List', 'avh-ec');
499
+ $options['drop'] = __('Drop down', 'avh-ec');
500
+ avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
501
+ unset($options);
502
+ echo '</p>';
503
+
504
+ echo '<p>';
505
+
506
+ avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
507
+
508
+ avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
509
+
510
+ echo '</p>';
511
+
512
+ echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
513
+ }
514
+ }
515
+
516
+ /**
517
+ * Widget Class for displaying the grouped categories
518
+ *
519
+ */
520
+ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
521
+ {
522
+ /**
523
+ *
524
+ * @var AVH_EC_Core
525
+ */
526
+ var $core;
527
+
528
+ /**
529
+ *
530
+ * @var AVH_EC_Category_Group
531
+ */
532
+ var $catgrp;
533
+
534
+ /**
535
+ * PHP 5 Constructor
536
+ *
537
+ */
538
+ function __construct ()
539
+ {
540
+ $this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
541
+ $this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
542
+
543
+ $widget_ops = array ( 'description' => __("Shows grouped categories.", 'avh-ec') );
544
+ WP_Widget::__construct(FALSE,'AVH Extended Categories: '. __('Category Group'), $widget_ops);
545
+ add_action('wp_print_styles', array ( &$this, 'actionWpPrintStyles' ));
546
+
547
+ }
548
+
549
+ function WP_Widget_AVH_ExtendedCategories_Category_Group ()
550
+ {
551
+ $this->__construct();
552
+ }
553
+
554
+ function actionWpPrintStyles ()
555
+ {
556
+ if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
557
+ wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version);
558
+ wp_enqueue_style('avhec-widget');
559
+ }
560
+ }
561
+
562
+ /**
563
+ * Display the widget
564
+ *
565
+ * @param unknown_type $args
566
+ * @param unknown_type $instance
567
+ */
568
+ function widget ($args, $instance)
569
+ {
570
+ global $post, $wp_query;
571
+
572
+ $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
573
+ $options = $this->core->getOptions();
574
+
575
+ $row = array ();
576
+
577
+ if (is_home()) {
578
+ $special_page = 'home_group';
579
+ } elseif (is_category()) {
580
+ $special_page = 'category_group';
581
+ } elseif (is_day()) {
582
+ $special_page = 'day_group';
583
+ } elseif (is_month()) {
584
+ $special_page = 'month_group';
585
+ } elseif (is_year()) {
586
+ $special_page = 'year_group';
587
+ } elseif (is_author()) {
588
+ $special_page = 'author_group';
589
+ } elseif (is_search()) {
590
+ $special_page = 'search_group';
591
+ } else {
592
+ $special_page = 'none';
593
+ }
594
+
595
+ $toDisplay = FALSE;
596
+ if ('none' == $special_page) {
597
+ $terms = wp_get_object_terms($post->ID, $catgrp->taxonomy_name);
598
+ if (! empty($terms)) {
599
+ $selected_catgroups = unserialize($instance['post_group_category']);
600
+ foreach ($terms as $key => $value) {
601
+ if ($selected_catgroups === FALSE || array_key_exists($value->term_id, $selected_catgroups)) {
602
+ if (! ($this->getWidgetDoneCatGroup($value->term_id))) {
603
+ $row = $value;
604
+ $group_found = TRUE;
605
+ break;
606
+ }
607
+ }
608
+ }
609
+ } else {
610
+ $options = $this->core->options;
611
+ $no_cat_group = $options['cat_group']['no_group'];
612
+ $row = get_term_by('id', $no_cat_group, $catgrp->taxonomy_name);
613
+ $group_found = TRUE;
614
+ }
615
+ } else {
616
+ if ('category_group' == $special_page) {
617
+ $tax_meta = get_option($this->core->db_options_tax_meta);
618
+ $term = $wp_query->get_queried_object();
619
+ if (isset($tax_meta[$term->taxonomy][$term->term_id]['category_group_term_id'])) {
620
+ $sp_category_group_id = $tax_meta[$term->taxonomy][$term->term_id]['category_group_term_id'];
621
+ } else {
622
+ $sp_category_group = $this->catgrp->getGroupByCategoryID($term->term_id);
623
+ $sp_category_group_id = $sp_category_group->term_id;
624
+ }
625
+ } else {
626
+ $sp_category_group_id = $options['sp_cat_group'][$special_page];
627
+ }
628
+ $row = get_term_by('id', $sp_category_group_id, $catgrp->taxonomy_name); // Returns FALSE when non-existance. (empty(FALSE)=TRUE)
629
+ $group_found = TRUE;
630
+ }
631
+
632
+ if ($group_found) {
633
+ $toDisplay = TRUE;
634
+ $category_group_id_none = $this->catgrp->getTermIDBy('slug', 'none');
635
+ $selected_catgroups = unserialize($instance['post_group_category']);
636
+
637
+ if ($category_group_id_none == $row->term_id) {
638
+ $toDisplay = FALSE;
639
+ } elseif (! (FALSE == $selected_catgroups || array_key_exists($row->term_id, $selected_catgroups))) {
640
+ $toDisplay = FALSE;
641
+ } elseif ($special_page != 'none' && $this->getWidgetDoneCatGroup($sp_category_group_id)) {
642
+ $toDisplay = FALSE;
643
+ }
644
+ }
645
+
646
+ if ($toDisplay) {
647
+ extract($args);
648
+
649
+ $c = $instance['count'] ? TRUE : FALSE;
650
+ $e = $instance['hide_empty'] ? TRUE : FALSE;
651
+ $h = $instance['hierarchical'] ? TRUE : FALSE;
652
+ $use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
653
+ $s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
654
+ $o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
655
+ $r = $instance['rssfeed'] ? 'RSS' : '';
656
+ $i = $instance['rssimage'] ? $instance['rssimage'] : '';
657
+
658
+ if (empty($r)) {
659
+ $i = '';
660
+ }
661
+
662
+ $style = empty($instance['style']) ? 'list' : $instance['style'];
663
+ $group_id = $row->term_id;
664
+ $cats = $catgrp->getCategoriesFromGroup($group_id);
665
+ if (empty($instance['title'])) {
666
+ $title = $catgrp->getWidgetTitleForGroup($group_id);
667
+ if (! $title) {
668
+ $title = __('Categories', 'avh-ec');
669
+ }
670
+ } else {
671
+ $title = $instance['title'];
672
+ }
673
+ $title = apply_filters('widget_title', $title);
674
+
675
+ $included_cats = implode(',', $cats);
676
+
677
+ $show_option_none = __('Select Category', 'avh-ec');
678
+ if ($options['general']['alternative_name_select_category']) {
679
+ $show_option_none = $options['general']['alternative_name_select_category'];
680
+ }
681
+
682
+ $cat_args = array ( 'include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' => $e, 'hierarchical' => $h, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-select-group-' . $this->number );
683
+ echo $before_widget;
684
+ echo $this->core->comment;
685
+ echo $before_title . $title . $after_title;
686
+
687
+ if ($style == 'list') {
688
+ echo '<ul>';
689
+ $this->core->avh_wp_list_categories($cat_args, TRUE);
690
+ echo '</ul>';
691
+ } else {
692
+ $this->core->avh_wp_dropdown_categories($cat_args, TRUE);
693
+ echo '<script type=\'text/javascript\'>' . "\n";
694
+ echo '/* <![CDATA[ */' . "\n";
695
+ echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-group-' . $this->number . '");' . "\n";
696
+ echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
697
+ echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
698
+ echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
699
+ echo ' }' . "\n";
700
+ echo ' }' . "\n";
701
+ echo ' ec_dropdown_' . $this->number . '.onchange = ec_onCatChange_' . $this->number . ';' . "\n";
702
+ echo '/* ]]> */' . "\n";
703
+ echo '</script>' . "\n";
704
+ }
705
+ echo $after_widget;
706
+ }
707
+ }
708
+
709
+ /**
710
+ * When Widget Control Form Is Posted
711
+ *
712
+ * @param unknown_type $new_instance
713
+ * @param unknown_type $old_instance
714
+ * @return unknown
715
+ */
716
+ function update ($new_instance, $old_instance)
717
+ {
718
+ // update the instance's settings
719
+ if (! isset($new_instance['submit'])) {
720
+ return FALSE;
721
+ }
722
+
723
+ $instance = $old_instance;
724
+
725
+ $instance['title'] = strip_tags(stripslashes($new_instance['title']));
726
+ $instance['count'] = $new_instance['count'] ? TRUE : FALSE;
727
+ $instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
728
+ $instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
729
+ $instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
730
+ $instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
731
+ $instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
732
+ $instance['style'] = strip_tags(stripslashes($new_instance['style']));
733
+ $instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
734
+ $instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
735
+ if (array_key_exists('all', $new_instance['post_group_category'])) {
736
+ $instance['post_group_category'] = FALSE;
737
+ } else {
738
+ $instance['post_group_category'] = serialize($new_instance['post_group_category']);
739
+ }
740
+ return $instance;
741
+ }
742
+
743
+ /**
744
+ * Display Widget Control Form
745
+ *
746
+ * @param unknown_type $instance
747
+ */
748
+ function form ($instance)
749
+ {
750
+ // displays the widget admin form
751
+ $instance = wp_parse_args((array) $instance, array ( 'title' => '', 'rssimage' => '' ));
752
+
753
+ // Prepare data for display
754
+ $title = esc_attr($instance['title']);
755
+ $count = (bool) $instance['count'];
756
+ $hierarchical = (bool) $instance['hierarchical'];
757
+ $hide_empty = (bool) $instance['hide_empty'];
758
+ $use_desc_for_title = (bool) $instance['use_desc_for_title'];
759
+ $sort_id = ($instance['sort_column'] == 'ID') ? ' SELECTED' : '';
760
+ $sort_name = ($instance['sort_column'] == 'name') ? ' SELECTED' : '';
761
+ $sort_count = ($instance['sort_column'] == 'count') ? ' SELECTED' : '';
762
+ $sort_order_a = ($instance['sort_order'] == 'asc') ? ' SELECTED' : '';
763
+ $sort_order_d = ($instance['sort_order'] == 'desc') ? ' SELECTED' : '';
764
+ $style_list = ($instance['style'] == 'list') ? ' SELECTED' : '';
765
+ $style_drop = ($instance['style'] == 'drop') ? ' SELECTED' : '';
766
+ $rssfeed = (bool) $instance['rssfeed'];
767
+ $rssimage = esc_attr($instance['rssimage']);
768
+
769
+ $selected_cats = ($instance['post_group_category'] != '') ? unserialize($instance['post_group_category']) : FALSE;
770
+ ob_start();
771
+ echo '<p>';
772
+ avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
773
+ echo '</p>';
774
+
775
+ echo '<p>';
776
+
777
+ avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
778
+
779
+ avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
780
+
781
+ avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
782
+
783
+ avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
784
+ echo '</p>';
785
+
786
+ echo '<p>';
787
+ $options['ID'] = __('ID', 'avh-ec');
788
+ $options['name'] = __('Name', 'avh-ec');
789
+ $options['count'] = __('Count', 'avh-ec');
790
+ $options['slug'] = __('Slug', 'avh-ec');
791
+ avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
792
+ unset($options);
793
+
794
+ $options['asc'] = __('Ascending', 'avh-ec');
795
+ $options['desc'] = __('Descending', 'avh-ec');
796
+ avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
797
+ unset($options);
798
+
799
+ $options['list'] = __('List', 'avh-ec');
800
+ $options['drop'] = __('Drop down', 'avh-ec');
801
+ avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
802
+ unset($options);
803
+ echo '</p>';
804
+
805
+ echo '<p>';
806
+
807
+ avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
808
+
809
+ avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
810
+ echo '</p>';
811
+
812
+ echo '<p>';
813
+ echo '<b>' . __('Select Groups', 'avh-ec') . '</b><hr />';
814
+ 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;">';
815
+ echo '<li id="' . $this->get_field_id('group_category--1') . '" class="popular-group_category">';
816
+ echo '<label for="' . $this->get_field_id('group_post_category') . '" class="selectit">';
817
+ echo '<input value="all" id="' . $this->get_field_id('group_post_category') . '" name="' . $this->get_field_name('post_group_category') . '[all]" type="checkbox" ' . (FALSE === $selected_cats ? ' CHECKED' : '') . '> ';
818
+ _e('Any Group', 'avh-ec');
819
+ echo '</label>';
820
+ echo '</li>';
821
+
822
+ $this->avh_wp_group_category_checklist($selected_cats, $this->number);
823
+
824
+ echo '</ul>';
825
+ echo '</p>';
826
+
827
+ echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
828
+ ob_end_flush();
829
+ }
830
+
831
+ function avh_wp_group_category_checklist ($selected_cats, $number)
832
+ {
833
+
834
+ $walker = new AVH_Walker_Category_Checklist();
835
+ $walker->number = $number;
836
+ $walker->input_id = $this->get_field_id('post_group_category');
837
+ $walker->input_name = $this->get_field_name('post_group_category');
838
+ $walker->li_id = $this->get_field_id('group_category--1');
839
+
840
+ $args = array ( 'taxonomy' => 'avhec_catgroup', 'descendants_and_self' => 0, 'selected_cats' => array (), 'popular_cats' => array (), 'walker' => $walker, 'checked_ontop' => true );
841
+
842
+ if (is_array($selected_cats))
843
+ $args['selected_cats'] = $selected_cats;
844
+ else
845
+ $args['selected_cats'] = array ();
846
+
847
+ $categories = (array) get_terms($args['taxonomy'], array ( 'get' => 'all' ));
848
+
849
+ // 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)
850
+ $checked_categories = array ();
851
+ $keys = array_keys($categories);
852
+
853
+ foreach ($keys as $k) {
854
+ if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
855
+ $checked_categories[] = $categories[$k];
856
+ unset($categories[$k]);
857
+ }
858
+ }
859
+
860
+ // Put checked cats on top
861
+ echo $walker->walk($checked_categories, 0, $args);
862
+ // Then the rest of them
863
+ echo $walker->walk($categories, 0, $args);
864
+ }
865
+
866
+ function getWidgetDoneCatGroup ($id)
867
+ {
868
+ $catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
869
+ if (is_array($catgrp->widget_done_catgroup) && array_key_exists($id, $catgrp->widget_done_catgroup)) {
870
+ return TRUE;
871
+ }
872
+ $catgrp->widget_done_catgroup[$id] = TRUE;
873
+ return FALSE;
874
+ }
875
+ }
876
+
877
+ /**
878
+ * Class that will display the categories
879
+ *
880
+ */
881
+ class AVH_Walker_Category_Checklist extends Walker
882
+ {
883
+ var $tree_type = 'category';
884
+ var $db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' ); //TODO: decouple this
885
+ var $number;
886
+ var $input_id;
887
+ var $input_name;
888
+ var $li_id;
889
+
890
+ /**
891
+ * Display array of elements hierarchically.
892
+ *
893
+ * It is a generic function which does not assume any existing order of
894
+ * elements. max_depth = -1 means flatly display every element. max_depth =
895
+ * 0 means display all levels. max_depth > 0 specifies the number of
896
+ * display levels.
897
+ *
898
+ * @since 2.1.0
899
+ *
900
+ * @param array $elements
901
+ * @param int $max_depth
902
+ * @param array $args;
903
+ * @return string
904
+ */
905
+ function walk ($elements, $max_depth, $args)
906
+ {
907
+
908
+ $output = '';
909
+
910
+ if ($max_depth < - 1) //invalid parameter
911
+ return $output;
912
+
913
+ if (empty($elements)) //nothing to walk
914
+ return $output;
915
+
916
+ $id_field = $this->db_fields['id'];
917
+ $parent_field = $this->db_fields['parent'];
918
+
919
+ // flat display
920
+ if (- 1 == $max_depth) {
921
+ $empty_array = array ();
922
+ foreach ($elements as $e)
923
+ $this->display_element($e, $empty_array, 1, 0, $args, $output);
924
+ return $output;
925
+ }
926
+
927
+ /*
928
+ * need to display in hierarchical order
929
+ * separate elements into two buckets: top level and children elements
930
+ * children_elements is two dimensional array, eg.
931
+ * children_elements[10][] contains all sub-elements whose parent is 10.
932
+ */
933
+ $top_level_elements = array ();
934
+ $children_elements = array ();
935
+ foreach ($elements as $e) {
936
+ if (0 == $e->$parent_field)
937
+ $top_level_elements[] = $e;
938
+ else
939
+ $children_elements[$e->$parent_field][] = $e;
940
+ }
941
+
942
+ /*
943
+ * when none of the elements is top level
944
+ * assume the first one must be root of the sub elements
945
+ */
946
+ if (empty($top_level_elements)) {
947
+
948
+ $first = array_slice($elements, 0, 1);
949
+ $root = $first[0];
950
+
951
+ $top_level_elements = array ();
952
+ $children_elements = array ();
953
+ foreach ($elements as $e) {
954
+ if ($root->$parent_field == $e->$parent_field)
955
+ $top_level_elements[] = $e;
956
+ else
957
+ $children_elements[$e->$parent_field][] = $e;
958
+ }
959
+ }
960
+
961
+ foreach ($top_level_elements as $e)
962
+ $this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
963
+
964
+ /*
965
+ * if we are displaying all levels, and remaining children_elements is not empty,
966
+ * then we got orphans, which should be displayed regardless
967
+ */
968
+ if (($max_depth == 0) && count($children_elements) > 0) {
969
+ $empty_array = array ();
970
+ foreach ($children_elements as $orphans)
971
+ foreach ($orphans as $op)
972
+ $this->display_element($op, $empty_array, 1, 0, $args, $output);
973
+ }
974
+
975
+ return $output;
976
+ }
977
+
978
+ function start_lvl (&$output, $depth, $args)
979
+ {
980
+ $indent = str_repeat("\t", $depth);
981
+ $output .= $indent . '<ul class="children">' . "\n";
982
+ }
983
+
984
+ function end_lvl (&$output, $depth, $args)
985
+ {
986
+ $indent = str_repeat("\t", $depth);
987
+ $output .= $indent . '</ul>' . "\n";
988
+ }
989
+
990
+ function start_el (&$output, $category, $depth, $args)
991
+ {
992
+ extract($args);
993
+ $input_id = $this->input_id . '-' . $category->term_id;
994
+ $output .= "\n" . '<li id="' . $this->li_id . '">';
995
+ $output .= '<label for="' . $input_id . '" class="selectit">';
996
+ $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $category->term_id . ']" id="' . $input_id . '"' . (in_array($category->term_id, $selected_cats) ? ' checked="checked"' : "") . '/> ' . esc_html(apply_filters('the_category', $category->name)) . '</label>';
997
+ }
998
+
999
+ function end_el (&$output, $category, $depth, $args)
1000
+ {
1001
+ $output .= "</li>\n";
1002
+ }
1003
+ }
1004
+ ?>
3.3/css/avh-ec.admin.css ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
13
+ /* Metabox in General */
14
+ table.avhec-options {
15
+
16
+ }
17
+
18
+ .avhec-metabox-wrap {
19
+
20
+ }
21
+
22
+ .avhec-metabox-wrap .p {
23
+ line-height: 140%;
24
+ margin: 1em 0;
25
+ }
26
+
27
+ #avhecBoxOptions option {
28
+ padding: .5em;
29
+ }
30
+
31
+ .avhec-metabox-wrap span.description {
32
+
33
+ }
34
+
35
+ .avhec-metabox-wrap .b {
36
+ font-weight: bold;
37
+ }
38
+
39
+ .avhec-metabox-wrap ul {
40
+ margin-bottom: 1em;
41
+ }
42
+
43
+ .avhec-metabox-wrap ul li {
44
+ line-height: 120%;
45
+ list-style: disc inside none;
46
+ margin-bottom: 0;
47
+ }
48
+
49
+ #avhec-options input {
50
+
51
+ }
52
+
53
+ #avhec-generaloptions input {
54
+
55
+ }
56
+
57
+ /* Metabox FAQ */
58
+ #avhecBoxFAQ .inside ul {
59
+ margin-bottom: 6px;
60
+ }
61
+
62
+ #avhecBoxFAQ .inside ul li {
63
+ line-height: 120%;
64
+ list-style: disc inside none;
65
+ margin-bottom: 0;
66
+ }
67
+
68
+ /* Metabox Donations*/
69
+ #avhecBoxDonations .inside {
70
+
71
+ }
72
+
73
+ #avhecBoxDonations .versions {
74
+ padding: 6px 10px 12px;
75
+ }
76
+
77
+ /* Metabox Donations*/
78
+ #avhecBoxTranslation .inside {
79
+
80
+ }
81
+
82
+ /* Metabox in post and page */
83
+ #post_avhec_category_group {
84
+ width: 100%;
85
+ }
86
+
87
+ #avhec-catlist {
88
+ -moz-border-radius: 4px 4px 4px 4px;
89
+ background-color: #FFFFFF;
90
+ border: 1px solid #DFDFDF;
91
+ height: 20em;
92
+ margin-bottom: -1.8em;
93
+ overflow: auto;
94
+ width: 95%;
95
+ }
96
+
97
+ #avhec-catlist ul {
98
+ padding: 3px;
99
+ }
100
+
101
+ #avhec-catlist li ul {
102
+ padding: 0px;
103
+ }
104
+
105
+ #avhec-catlist li {
106
+ margin-bottom: 0px;
107
+ }
108
+
109
+ #avhecManualOrder {
110
+ width: 25%;
111
+ /* border: 1px solid #B2B2B2;*/
112
+ /* margin: 10px 10px 10px 0px;*/
113
+ /* padding: 5px 10px 5px 10px;*/
114
+ /* list-style: none;*/
115
+ /* background-color: #fff;*/
116
+ /* border-radius: 3px;*/
117
+ /* -webkit-border-radius: 3px;*/
118
+ }
119
+
120
+ #avhecManualOrder li.lineitem {
121
+ border: 1px solid #DFDFDF;
122
+ background-image: none;
123
+ border-radius: 3px;
124
+ -webkit-border-radius: 3px;
125
+ background-color: #FFFFFF;
126
+ color: #555555;
127
+ cursor: move;
128
+ margin-top: 5px;
129
+ margin-bottom: 5px;
130
+ padding: 2px 5px 2px 5px;
131
+ list-style: none outside none;
132
+ }
133
+
134
+ #avhecManualOrder .sortable-placeholder {
135
+ border: 1px dashed #B2B2B2;
136
+ margin-top: 5px;
137
+ margin-bottom: 5px;
138
+ padding: 2px 5px 2px 5px;
139
+ height: 1.5em;
140
+ line-height: 1.5em;
141
+ list-style: none outside none;
142
+ background-color: transparent;
143
+ /* IE10 */
144
+ background-image: -ms-linear-gradient(top, #f9f9f9, #f5f5f5);
145
+ /* Firefox */
146
+ background-image: -moz-linear-gradient(top, #f9f9f9, #f5f5f5);
147
+ /* Opera */
148
+ background-image: -o-linear-gradient(top, #f9f9f9, #f5f5f5);
149
+ /* old Webkit */
150
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f5f5f5) );
151
+ /* new Webkit */
152
+ background-image: -webkit-linear-gradient(top, #f9f9f9, #f5f5f5);
153
+ /* proposed W3C Markup */
154
+ background-image: linear-gradient(top, #f9f9f9, #f5f5f5);
155
+ }
3.3/css/avh-ec.widget.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* AVH Extended Categories Widget CSS */
2
+ .avhec-widget-line {
3
+ display: inline-block;
4
+ }
5
+
6
+ .avhec-widget-count {
7
+ display: inline;
8
+ }
9
+
10
+ .avhec-widget-rss {
11
+ display: inline;
12
+ }
3.3/helpers/avh-forms.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! function_exists('avh_doWidgetFormText')) {
3
+
4
+ function avh_doWidgetFormText ($field_id, $field_name, $description, $value)
5
+ {
6
+ echo '<label for="' . $field_id . '">';
7
+ echo $description;
8
+ echo '<input class="widefat" id="' . $field_id . '" name="' . $field_name . '" type="text" value="' . esc_attr($value) . '" /> ';
9
+ echo '</label>';
10
+ echo '<br />';
11
+ }
12
+ }
13
+
14
+ if (! function_exists('avh_doWidgetFormCheckbox')) {
15
+
16
+ function avh_doWidgetFormCheckbox ($field_id, $field_name, $description, $is_checked = FALSE)
17
+ {
18
+
19
+ echo '<label for="' . $field_id . '">';
20
+ echo '<input class="checkbox" type="checkbox" id="' . $field_id . '" name="' . $field_name . '"' . ($is_checked ? ' CHECKED' : '') . ' /> ';
21
+ echo $description;
22
+ echo '</label>';
23
+ echo '<br />';
24
+ }
25
+ }
26
+
27
+ if (! function_exists('avh_doWidgetFormSelect')) {
28
+
29
+ function avh_doWidgetFormSelect ($field_id, $field_name, $description, $options, $selected_value)
30
+ {
31
+ echo '<label for="' . $field_id . '">';
32
+ echo $description . ' ';
33
+ echo '</label>';
34
+
35
+ $data = '';
36
+ foreach ($options as $value => $text) {
37
+ $data .= '<option value="' . $value . '" ' . ($value == $selected_value ? "SELECTED" : '') . '>' . $text . '</option>' . "/n";
38
+ }
39
+ echo '<select id="' . $field_id . '" name="' . $field_name . '"> ';
40
+ echo $data;
41
+ echo '</select>';
42
+ echo '<br />';
43
+ }
44
+ }
3.3/images/us_banner_logow_120x60.gif ADDED
Binary file
3.3/js/avh-ec.admin.manualorder.closure.js ADDED
@@ -0,0 +1 @@
 
1
+ function avhecManualOrder(){jQuery("#avhecManualOrder").sortable({placeholder:"sortable-placeholder",revert:false,items:".lineitem",opacity:0.65,cursor:"move",forcePlaceholderSize:true,tolerance:"pointer"})}addLoadEvent(avhecManualOrder);function orderCats(){jQuery("#updateText").html("Updating Category Order...");jQuery("#hdnManualOrder").val(jQuery("#avhecManualOrder").sortable("toArray"))};
3.3/js/avh-ec.admin.manualorder.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function avhecManualOrder() {
2
+ jQuery("#avhecManualOrder").sortable({
3
+ placeholder : "sortable-placeholder",
4
+ revert : false,
5
+ items : '.lineitem',
6
+ opacity: 0.65,
7
+ cursor: 'move',
8
+ forcePlaceholderSize: true,
9
+ tolerance : "pointer"
10
+ });
11
+ };
12
+
13
+ addLoadEvent(avhecManualOrder);
14
+
15
+ function orderCats() {
16
+ jQuery("#updateText").html("Updating Category Order...");
17
+ jQuery("#hdnManualOrder").val(
18
+ jQuery("#avhecManualOrder").sortable("toArray"));
19
+ }
3.3/js/avh-ec.categorygroup.closure.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(a){a("#the-list").wpList({delBefore:function(b){if("undefined"!=showNotice)return showNotice.warn()?b:false;return b}});a('.delete a[class^="delete"]').live("click",function(){return false})});
2.8/js/avh-ec.categorygroup.dev.js → 3.3/js/avh-ec.categorygroup.js RENAMED
@@ -18,4 +18,4 @@ jQuery(document).ready(function($) {
18
  $('#the-list').wpList({ delBefore: delBefore });
19
 
20
  $('.delete a[class^="delete"]').live('click', function(){return false;});
21
- });
18
  $('#the-list').wpList({ delBefore: delBefore });
19
 
20
  $('.delete a[class^="delete"]').live('click', function(){return false;});
21
+ });
{2.8/lang → lang}/avh-ec-cs_CZ.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-de_DE.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-el.mo RENAMED
File without changes
lang/avh-ec-en_US.mo ADDED
Binary file
{2.8/lang → lang}/avh-ec-es_ES.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-id_ID.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-it_IT.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-nl_NL.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-ru_RU.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-sv_SE.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec-tr.mo RENAMED
File without changes
{2.8/lang → lang}/avh-ec.mo RENAMED
Binary file
lang/avh-ec.po ADDED
@@ -0,0 +1,1056 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: AVH Extended Categories\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-01-17 19:13-0500\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: Peter van der Does <avhsoftware@avirtualhome.com>\n"
8
+ "Language-Team: \n"
9
+ "Language: \n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Poedit-SourceCharset: utf-8\n"
14
+ "X-Poedit-KeywordsList: __ngettext:1,2;__;_e\n"
15
+ "X-Poedit-Basepath: ..\n"
16
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Poedit-Language: English\n"
18
+ "X-Poedit-Country: UNITED STATES\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+
21
+ #: widget-pre2.8.php:33
22
+ #: 3.3/class/avh-ec.widgets.php:81
23
+ #: 3.3/class/avh-ec.widgets.php:364
24
+ #: 3.3/class/avh-ec.widgets.php:668
25
+ #: 3.3/class/avh-ec.admin.php:476
26
+ #: 3.3/class/avh-ec.core.php:417
27
+ #: 2.8/class/avh-ec.widgets.php:81
28
+ #: 2.8/class/avh-ec.widgets.php:363
29
+ #: 2.8/class/avh-ec.widgets.php:667
30
+ #: 2.8/class/avh-ec.admin.php:491
31
+ #: 2.8/class/avh-ec.core.php:417
32
+ msgid "Categories"
33
+ msgstr ""
34
+
35
+ #: widget-pre2.8.php:40
36
+ #: widget-pre2.8.php:42
37
+ #: 3.3/class/avh-ec.widgets.php:103
38
+ #: 3.3/class/avh-ec.widgets.php:387
39
+ #: 3.3/class/avh-ec.widgets.php:677
40
+ #: 2.8/class/avh-ec.widgets.php:103
41
+ #: 2.8/class/avh-ec.widgets.php:386
42
+ #: 2.8/class/avh-ec.widgets.php:676
43
+ msgid "Select Category"
44
+ msgstr ""
45
+
46
+ #: widget-pre2.8.php:153
47
+ msgid "Title:"
48
+ msgstr ""
49
+
50
+ #: widget-pre2.8.php:266
51
+ msgid "Path (URI) to RSS image:"
52
+ msgstr ""
53
+
54
+ #: widget-pre2.8.php:340
55
+ msgid "AVH Extended Categories Widgets"
56
+ msgstr ""
57
+
58
+ #: widget-pre2.8.php:343
59
+ msgid "How many wishlist widgets would you like?"
60
+ msgstr ""
61
+
62
+ #: widget-pre2.8.php:358
63
+ msgid "Save"
64
+ msgstr ""
65
+
66
+ #: widget-pre2.8.php:376
67
+ #, php-format
68
+ msgid "Extended Categories %d"
69
+ msgstr ""
70
+
71
+ #: 3.3/class/avh-ec.widgets.php:29
72
+ #: 2.8/class/avh-ec.widgets.php:29
73
+ msgid "An extended version of the default Categories widget."
74
+ msgstr ""
75
+
76
+ #: 3.3/class/avh-ec.widgets.php:193
77
+ #: 3.3/class/avh-ec.widgets.php:471
78
+ #: 3.3/class/avh-ec.widgets.php:772
79
+ #: 2.8/class/avh-ec.widgets.php:193
80
+ #: 2.8/class/avh-ec.widgets.php:470
81
+ #: 2.8/class/avh-ec.widgets.php:771
82
+ msgid "Title"
83
+ msgstr ""
84
+
85
+ #: 3.3/class/avh-ec.widgets.php:197
86
+ #: 2.8/class/avh-ec.widgets.php:197
87
+ msgid "Show selected categories only"
88
+ msgstr ""
89
+
90
+ #: 3.3/class/avh-ec.widgets.php:199
91
+ #: 3.3/class/avh-ec.widgets.php:479
92
+ #: 3.3/class/avh-ec.widgets.php:777
93
+ #: 2.8/class/avh-ec.widgets.php:199
94
+ #: 2.8/class/avh-ec.widgets.php:478
95
+ #: 2.8/class/avh-ec.widgets.php:776
96
+ msgid "Show post counts"
97
+ msgstr ""
98
+
99
+ #: 3.3/class/avh-ec.widgets.php:201
100
+ #: 3.3/class/avh-ec.widgets.php:779
101
+ #: 2.8/class/avh-ec.widgets.php:201
102
+ #: 2.8/class/avh-ec.widgets.php:778
103
+ msgid "Show hierarchy"
104
+ msgstr ""
105
+
106
+ #: 3.3/class/avh-ec.widgets.php:203
107
+ #: 2.8/class/avh-ec.widgets.php:203
108
+ msgid "All Levels"
109
+ msgstr ""
110
+
111
+ #: 3.3/class/avh-ec.widgets.php:203
112
+ #: 2.8/class/avh-ec.widgets.php:203
113
+ msgid "Toplevel only"
114
+ msgstr ""
115
+
116
+ #: 3.3/class/avh-ec.widgets.php:205
117
+ #: 2.8/class/avh-ec.widgets.php:205
118
+ msgid "Child "
119
+ msgstr ""
120
+
121
+ #: 3.3/class/avh-ec.widgets.php:207
122
+ #: 2.8/class/avh-ec.widgets.php:207
123
+ msgid "How many levels to show"
124
+ msgstr ""
125
+
126
+ #: 3.3/class/avh-ec.widgets.php:210
127
+ #: 3.3/class/avh-ec.widgets.php:781
128
+ #: 2.8/class/avh-ec.widgets.php:210
129
+ #: 2.8/class/avh-ec.widgets.php:780
130
+ msgid "Hide empty categories"
131
+ msgstr ""
132
+
133
+ #: 3.3/class/avh-ec.widgets.php:212
134
+ #: 3.3/class/avh-ec.widgets.php:482
135
+ #: 3.3/class/avh-ec.widgets.php:783
136
+ #: 2.8/class/avh-ec.widgets.php:212
137
+ #: 2.8/class/avh-ec.widgets.php:481
138
+ #: 2.8/class/avh-ec.widgets.php:782
139
+ msgid "Use description for title"
140
+ msgstr ""
141
+
142
+ #: 3.3/class/avh-ec.widgets.php:216
143
+ #: 3.3/class/avh-ec.widgets.php:486
144
+ #: 3.3/class/avh-ec.widgets.php:787
145
+ #: 2.8/class/avh-ec.widgets.php:216
146
+ #: 2.8/class/avh-ec.widgets.php:485
147
+ #: 2.8/class/avh-ec.widgets.php:786
148
+ msgid "ID"
149
+ msgstr ""
150
+
151
+ #: 3.3/class/avh-ec.widgets.php:217
152
+ #: 3.3/class/avh-ec.widgets.php:487
153
+ #: 3.3/class/avh-ec.widgets.php:788
154
+ #: 3.3/class/avh-ec.admin.php:1139
155
+ #: 2.8/class/avh-ec.widgets.php:217
156
+ #: 2.8/class/avh-ec.widgets.php:486
157
+ #: 2.8/class/avh-ec.widgets.php:787
158
+ #: 2.8/class/avh-ec.admin.php:1169
159
+ msgid "Name"
160
+ msgstr ""
161
+
162
+ #: 3.3/class/avh-ec.widgets.php:218
163
+ #: 3.3/class/avh-ec.widgets.php:488
164
+ #: 3.3/class/avh-ec.widgets.php:789
165
+ #: 2.8/class/avh-ec.widgets.php:218
166
+ #: 2.8/class/avh-ec.widgets.php:487
167
+ #: 2.8/class/avh-ec.widgets.php:788
168
+ msgid "Count"
169
+ msgstr ""
170
+
171
+ #: 3.3/class/avh-ec.widgets.php:219
172
+ #: 3.3/class/avh-ec.widgets.php:489
173
+ #: 3.3/class/avh-ec.widgets.php:790
174
+ #: 2.8/class/avh-ec.widgets.php:219
175
+ #: 2.8/class/avh-ec.widgets.php:488
176
+ #: 2.8/class/avh-ec.widgets.php:789
177
+ msgid "Slug"
178
+ msgstr ""
179
+
180
+ #: 3.3/class/avh-ec.widgets.php:220
181
+ msgid "Manual Order"
182
+ msgstr ""
183
+
184
+ #: 3.3/class/avh-ec.widgets.php:225
185
+ #: 3.3/class/avh-ec.widgets.php:490
186
+ #: 3.3/class/avh-ec.widgets.php:791
187
+ #: 2.8/class/avh-ec.widgets.php:224
188
+ #: 2.8/class/avh-ec.widgets.php:489
189
+ #: 2.8/class/avh-ec.widgets.php:790
190
+ msgid "Sort by"
191
+ msgstr ""
192
+
193
+ #: 3.3/class/avh-ec.widgets.php:228
194
+ #: 3.3/class/avh-ec.widgets.php:493
195
+ #: 3.3/class/avh-ec.widgets.php:794
196
+ #: 2.8/class/avh-ec.widgets.php:227
197
+ #: 2.8/class/avh-ec.widgets.php:492
198
+ #: 2.8/class/avh-ec.widgets.php:793
199
+ msgid "Ascending"
200
+ msgstr ""
201
+
202
+ #: 3.3/class/avh-ec.widgets.php:229
203
+ #: 3.3/class/avh-ec.widgets.php:494
204
+ #: 3.3/class/avh-ec.widgets.php:795
205
+ #: 2.8/class/avh-ec.widgets.php:228
206
+ #: 2.8/class/avh-ec.widgets.php:493
207
+ #: 2.8/class/avh-ec.widgets.php:794
208
+ msgid "Descending"
209
+ msgstr ""
210
+
211
+ #: 3.3/class/avh-ec.widgets.php:230
212
+ #: 3.3/class/avh-ec.widgets.php:495
213
+ #: 3.3/class/avh-ec.widgets.php:796
214
+ #: 2.8/class/avh-ec.widgets.php:229
215
+ #: 2.8/class/avh-ec.widgets.php:494
216
+ #: 2.8/class/avh-ec.widgets.php:795
217
+ msgid "Sort order"
218
+ msgstr ""
219
+
220
+ #: 3.3/class/avh-ec.widgets.php:233
221
+ #: 3.3/class/avh-ec.widgets.php:498
222
+ #: 3.3/class/avh-ec.widgets.php:799
223
+ #: 2.8/class/avh-ec.widgets.php:232
224
+ #: 2.8/class/avh-ec.widgets.php:497
225
+ #: 2.8/class/avh-ec.widgets.php:798
226
+ msgid "List"
227
+ msgstr ""
228
+
229
+ #: 3.3/class/avh-ec.widgets.php:234
230
+ #: 3.3/class/avh-ec.widgets.php:499
231
+ #: 3.3/class/avh-ec.widgets.php:800
232
+ #: 2.8/class/avh-ec.widgets.php:233
233
+ #: 2.8/class/avh-ec.widgets.php:498
234
+ #: 2.8/class/avh-ec.widgets.php:799
235
+ msgid "Drop down"
236
+ msgstr ""
237
+
238
+ #: 3.3/class/avh-ec.widgets.php:235
239
+ #: 3.3/class/avh-ec.widgets.php:500
240
+ #: 3.3/class/avh-ec.widgets.php:801
241
+ #: 2.8/class/avh-ec.widgets.php:234
242
+ #: 2.8/class/avh-ec.widgets.php:499
243
+ #: 2.8/class/avh-ec.widgets.php:800
244
+ msgid "Display style"
245
+ msgstr ""
246
+
247
+ #: 3.3/class/avh-ec.widgets.php:241
248
+ #: 3.3/class/avh-ec.widgets.php:506
249
+ #: 3.3/class/avh-ec.widgets.php:807
250
+ #: 2.8/class/avh-ec.widgets.php:240
251
+ #: 2.8/class/avh-ec.widgets.php:505
252
+ #: 2.8/class/avh-ec.widgets.php:806
253
+ msgid "Show RSS Feed"
254
+ msgstr ""
255
+
256
+ #: 3.3/class/avh-ec.widgets.php:243
257
+ #: 3.3/class/avh-ec.widgets.php:508
258
+ #: 3.3/class/avh-ec.widgets.php:809
259
+ #: 2.8/class/avh-ec.widgets.php:242
260
+ #: 2.8/class/avh-ec.widgets.php:507
261
+ #: 2.8/class/avh-ec.widgets.php:808
262
+ msgid "Path (URI) to RSS image"
263
+ msgstr ""
264
+
265
+ #: 3.3/class/avh-ec.widgets.php:248
266
+ #: 2.8/class/avh-ec.widgets.php:247
267
+ msgid "Select categories"
268
+ msgstr ""
269
+
270
+ #: 3.3/class/avh-ec.widgets.php:253
271
+ #: 2.8/class/avh-ec.widgets.php:252
272
+ msgid "All Categories"
273
+ msgstr ""
274
+
275
+ #: 3.3/class/avh-ec.widgets.php:263
276
+ #: 2.8/class/avh-ec.widgets.php:262
277
+ msgid "Exclude the selected categories"
278
+ msgstr ""
279
+
280
+ #: 3.3/class/avh-ec.widgets.php:334
281
+ #: 2.8/class/avh-ec.widgets.php:333
282
+ msgid "Shows the top categories."
283
+ msgstr ""
284
+
285
+ #: 3.3/class/avh-ec.widgets.php:335
286
+ #: 2.8/class/avh-ec.widgets.php:334
287
+ msgid "Top Categories"
288
+ msgstr ""
289
+
290
+ #: 3.3/class/avh-ec.widgets.php:475
291
+ #: 2.8/class/avh-ec.widgets.php:474
292
+ msgid "How many categories to show"
293
+ msgstr ""
294
+
295
+ #: 3.3/class/avh-ec.widgets.php:543
296
+ #: 2.8/class/avh-ec.widgets.php:542
297
+ msgid "Shows grouped categories."
298
+ msgstr ""
299
+
300
+ #: 3.3/class/avh-ec.widgets.php:544
301
+ #: 3.3/class/avh-ec.category-group.php:111
302
+ #: 2.8/class/avh-ec.widgets.php:543
303
+ #: 2.8/class/avh-ec.category-group.php:111
304
+ msgid "Category Group"
305
+ msgstr ""
306
+
307
+ #: 3.3/class/avh-ec.widgets.php:813
308
+ #: 2.8/class/avh-ec.widgets.php:812
309
+ msgid "Select Groups"
310
+ msgstr ""
311
+
312
+ #: 3.3/class/avh-ec.widgets.php:818
313
+ #: 2.8/class/avh-ec.widgets.php:817
314
+ msgid "Any Group"
315
+ msgstr ""
316
+
317
+ #: 3.3/class/avh-ec.admin.php:186
318
+ #: 3.3/class/avh-ec.admin.php:258
319
+ #: 2.8/class/avh-ec.admin.php:183
320
+ #: 2.8/class/avh-ec.admin.php:259
321
+ msgid "Overview"
322
+ msgstr ""
323
+
324
+ #: 3.3/class/avh-ec.admin.php:187
325
+ #: 3.3/class/avh-ec.admin.php:392
326
+ #: 2.8/class/avh-ec.admin.php:184
327
+ #: 2.8/class/avh-ec.admin.php:400
328
+ msgid "General Options"
329
+ msgstr ""
330
+
331
+ #: 3.3/class/avh-ec.admin.php:188
332
+ #: 3.3/class/avh-ec.admin.php:617
333
+ #: 3.3/class/avh-ec.category-group.php:111
334
+ #: 3.3/class/avh-ec.category-group.php:157
335
+ #: 3.3/class/avh-ec.category-group.php:158
336
+ #: 2.8/class/avh-ec.admin.php:185
337
+ #: 2.8/class/avh-ec.admin.php:632
338
+ #: 2.8/class/avh-ec.category-group.php:111
339
+ #: 2.8/class/avh-ec.category-group.php:157
340
+ #: 2.8/class/avh-ec.category-group.php:158
341
+ msgid "Category Groups"
342
+ msgstr ""
343
+
344
+ #: 3.3/class/avh-ec.admin.php:189
345
+ #: 2.8/class/avh-ec.admin.php:186
346
+ msgid "Manually Order"
347
+ msgstr ""
348
+
349
+ #: 3.3/class/avh-ec.admin.php:190
350
+ #: 3.3/class/avh-ec.admin.php:920
351
+ #: 2.8/class/avh-ec.admin.php:187
352
+ #: 2.8/class/avh-ec.admin.php:950
353
+ msgid "F.A.Q"
354
+ msgstr ""
355
+
356
+ #: 3.3/class/avh-ec.admin.php:216
357
+ #: 3.3/class/avh-ec.admin.php:437
358
+ #: 2.8/class/avh-ec.admin.php:210
359
+ #: 2.8/class/avh-ec.admin.php:445
360
+ msgid "Group Overview"
361
+ msgstr ""
362
+
363
+ #: 3.3/class/avh-ec.admin.php:217
364
+ #: 3.3/class/avh-ec.admin.php:881
365
+ #: 2.8/class/avh-ec.admin.php:211
366
+ #: 2.8/class/avh-ec.admin.php:904
367
+ msgid "Translation"
368
+ msgstr ""
369
+
370
+ #: 3.3/class/avh-ec.admin.php:244
371
+ #: 3.3/class/avh-ec.admin.php:378
372
+ #: 3.3/class/avh-ec.admin.php:906
373
+ #: 2.8/class/avh-ec.admin.php:245
374
+ #: 2.8/class/avh-ec.admin.php:386
375
+ #: 2.8/class/avh-ec.admin.php:936
376
+ msgid "Donations"
377
+ msgstr ""
378
+
379
+ #: 3.3/class/avh-ec.admin.php:286
380
+ #: 2.8/class/avh-ec.admin.php:287
381
+ msgid "Options"
382
+ msgstr ""
383
+
384
+ #: 3.3/class/avh-ec.admin.php:315
385
+ #: 2.8/class/avh-ec.admin.php:323
386
+ msgid "<em>Select Category</em> Alternative"
387
+ msgstr ""
388
+
389
+ #: 3.3/class/avh-ec.admin.php:315
390
+ #: 2.8/class/avh-ec.admin.php:323
391
+ msgid "Alternative text for Select Category."
392
+ msgstr ""
393
+
394
+ #: 3.3/class/avh-ec.admin.php:316
395
+ #: 2.8/class/avh-ec.admin.php:324
396
+ msgid "Select which group to show on the home page."
397
+ msgstr ""
398
+
399
+ #: 3.3/class/avh-ec.admin.php:316
400
+ #: 3.3/class/avh-ec.admin.php:317
401
+ #: 3.3/class/avh-ec.admin.php:318
402
+ #: 2.8/class/avh-ec.admin.php:324
403
+ #: 2.8/class/avh-ec.admin.php:325
404
+ #: 2.8/class/avh-ec.admin.php:326
405
+ msgid "Selecting the group 'none' will not show the widget on the page."
406
+ msgstr ""
407
+
408
+ #: 3.3/class/avh-ec.admin.php:317
409
+ #: 2.8/class/avh-ec.admin.php:325
410
+ msgid "Select which group to show when there is no group associated with the post."
411
+ msgstr ""
412
+
413
+ #: 3.3/class/avh-ec.admin.php:318
414
+ #: 2.8/class/avh-ec.admin.php:326
415
+ msgid "Select which group will be the default group when editing a post."
416
+ msgstr ""
417
+
418
+ #: 3.3/class/avh-ec.admin.php:352
419
+ #: 2.8/class/avh-ec.admin.php:360
420
+ msgid "Options saved"
421
+ msgstr ""
422
+
423
+ #: 3.3/class/avh-ec.admin.php:408
424
+ #: 2.8/class/avh-ec.admin.php:416
425
+ msgid "Save Changes"
426
+ msgstr ""
427
+
428
+ #: 3.3/class/avh-ec.admin.php:436
429
+ #: 2.8/class/avh-ec.admin.php:444
430
+ msgid "Add Group"
431
+ msgstr ""
432
+
433
+ #: 3.3/class/avh-ec.admin.php:438
434
+ #: 2.8/class/avh-ec.admin.php:446
435
+ msgid "Special Pages"
436
+ msgstr ""
437
+
438
+ #: 3.3/class/avh-ec.admin.php:467
439
+ #: 3.3/class/avh-ec.admin.php:472
440
+ #: 2.8/class/avh-ec.admin.php:482
441
+ #: 2.8/class/avh-ec.admin.php:487
442
+ msgid "Group Name"
443
+ msgstr ""
444
+
445
+ #: 3.3/class/avh-ec.admin.php:467
446
+ #: 3.3/class/avh-ec.admin.php:472
447
+ #: 2.8/class/avh-ec.admin.php:482
448
+ #: 2.8/class/avh-ec.admin.php:487
449
+ msgid "The name is used to identify the group."
450
+ msgstr ""
451
+
452
+ #: 3.3/class/avh-ec.admin.php:468
453
+ #: 3.3/class/avh-ec.admin.php:473
454
+ #: 2.8/class/avh-ec.admin.php:483
455
+ #: 2.8/class/avh-ec.admin.php:488
456
+ msgid "Slug Group"
457
+ msgstr ""
458
+
459
+ #: 3.3/class/avh-ec.admin.php:468
460
+ #: 3.3/class/avh-ec.admin.php:473
461
+ #: 2.8/class/avh-ec.admin.php:483
462
+ #: 2.8/class/avh-ec.admin.php:488
463
+ msgid "The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens."
464
+ msgstr ""
465
+
466
+ #: 3.3/class/avh-ec.admin.php:469
467
+ #: 3.3/class/avh-ec.admin.php:474
468
+ #: 3.3/class/avh-ec.admin.php:1139
469
+ #: 2.8/class/avh-ec.admin.php:484
470
+ #: 2.8/class/avh-ec.admin.php:489
471
+ #: 2.8/class/avh-ec.admin.php:1169
472
+ msgid "Widget Title"
473
+ msgstr ""
474
+
475
+ #: 3.3/class/avh-ec.admin.php:469
476
+ #: 3.3/class/avh-ec.admin.php:474
477
+ #: 2.8/class/avh-ec.admin.php:484
478
+ #: 2.8/class/avh-ec.admin.php:489
479
+ msgid "When no title is given in the widget options, this will used as the title of the widget when this group is shown."
480
+ msgstr ""
481
+
482
+ #: 3.3/class/avh-ec.admin.php:470
483
+ #: 3.3/class/avh-ec.admin.php:475
484
+ #: 3.3/class/avh-ec.admin.php:1139
485
+ #: 2.8/class/avh-ec.admin.php:485
486
+ #: 2.8/class/avh-ec.admin.php:490
487
+ #: 2.8/class/avh-ec.admin.php:1169
488
+ msgid "Description"
489
+ msgstr ""
490
+
491
+ #: 3.3/class/avh-ec.admin.php:470
492
+ #: 3.3/class/avh-ec.admin.php:475
493
+ #: 2.8/class/avh-ec.admin.php:485
494
+ #: 2.8/class/avh-ec.admin.php:490
495
+ msgid "Description is not prominent by default."
496
+ msgstr ""
497
+
498
+ #: 3.3/class/avh-ec.admin.php:476
499
+ #: 2.8/class/avh-ec.admin.php:491
500
+ msgid "Select categories to be included in the group."
501
+ msgstr ""
502
+
503
+ #: 3.3/class/avh-ec.admin.php:492
504
+ #: 2.8/class/avh-ec.admin.php:507
505
+ msgid "Category group saved"
506
+ msgstr ""
507
+
508
+ #: 3.3/class/avh-ec.admin.php:498
509
+ #: 2.8/class/avh-ec.admin.php:513
510
+ msgid "Category group conflicts with "
511
+ msgstr ""
512
+
513
+ #: 3.3/class/avh-ec.admin.php:499
514
+ #: 2.8/class/avh-ec.admin.php:514
515
+ msgid "Same slug is used. "
516
+ msgstr ""
517
+
518
+ #: 3.3/class/avh-ec.admin.php:521
519
+ #: 2.8/class/avh-ec.admin.php:536
520
+ msgid "Edit Group"
521
+ msgstr ""
522
+
523
+ #: 3.3/class/avh-ec.admin.php:533
524
+ #: 2.8/class/avh-ec.admin.php:548
525
+ msgid "Cheatin&#8217; uh?"
526
+ msgstr ""
527
+
528
+ #: 3.3/class/avh-ec.admin.php:553
529
+ #: 2.8/class/avh-ec.admin.php:568
530
+ msgid "Category group updated"
531
+ msgstr ""
532
+
533
+ #: 3.3/class/avh-ec.admin.php:557
534
+ #: 2.8/class/avh-ec.admin.php:572
535
+ msgid "Category group not updated"
536
+ msgstr ""
537
+
538
+ #: 3.3/class/avh-ec.admin.php:558
539
+ #: 2.8/class/avh-ec.admin.php:573
540
+ msgid "Duplicate slug detected"
541
+ msgstr ""
542
+
543
+ #: 3.3/class/avh-ec.admin.php:562
544
+ #: 2.8/class/avh-ec.admin.php:577
545
+ msgid "Unknown category group"
546
+ msgstr ""
547
+
548
+ #: 3.3/class/avh-ec.admin.php:601
549
+ #: 2.8/class/avh-ec.admin.php:616
550
+ msgid "Home page"
551
+ msgstr ""
552
+
553
+ #: 3.3/class/avh-ec.admin.php:601
554
+ #: 3.3/class/avh-ec.admin.php:603
555
+ #: 3.3/class/avh-ec.admin.php:604
556
+ #: 3.3/class/avh-ec.admin.php:605
557
+ #: 3.3/class/avh-ec.admin.php:606
558
+ #: 3.3/class/avh-ec.admin.php:607
559
+ #: 2.8/class/avh-ec.admin.php:616
560
+ #: 2.8/class/avh-ec.admin.php:618
561
+ #: 2.8/class/avh-ec.admin.php:619
562
+ #: 2.8/class/avh-ec.admin.php:620
563
+ #: 2.8/class/avh-ec.admin.php:621
564
+ #: 2.8/class/avh-ec.admin.php:622
565
+ #, php-format
566
+ msgid "Select which category to show on the %s page."
567
+ msgstr ""
568
+
569
+ #: 3.3/class/avh-ec.admin.php:601
570
+ #: 2.8/class/avh-ec.admin.php:616
571
+ msgid "home"
572
+ msgstr ""
573
+
574
+ #: 3.3/class/avh-ec.admin.php:603
575
+ #: 2.8/class/avh-ec.admin.php:618
576
+ msgid "Daily Archive"
577
+ msgstr ""
578
+
579
+ #: 3.3/class/avh-ec.admin.php:603
580
+ #: 2.8/class/avh-ec.admin.php:618
581
+ msgid "daily archive"
582
+ msgstr ""
583
+
584
+ #: 3.3/class/avh-ec.admin.php:604
585
+ #: 2.8/class/avh-ec.admin.php:619
586
+ msgid "Monthly Archive"
587
+ msgstr ""
588
+
589
+ #: 3.3/class/avh-ec.admin.php:604
590
+ #: 2.8/class/avh-ec.admin.php:619
591
+ msgid "monthly archive"
592
+ msgstr ""
593
+
594
+ #: 3.3/class/avh-ec.admin.php:605
595
+ #: 2.8/class/avh-ec.admin.php:620
596
+ msgid "Yearly Archive"
597
+ msgstr ""
598
+
599
+ #: 3.3/class/avh-ec.admin.php:605
600
+ #: 2.8/class/avh-ec.admin.php:620
601
+ msgid "yearly archive"
602
+ msgstr ""
603
+
604
+ #: 3.3/class/avh-ec.admin.php:606
605
+ #: 2.8/class/avh-ec.admin.php:621
606
+ msgid "Author Archive"
607
+ msgstr ""
608
+
609
+ #: 3.3/class/avh-ec.admin.php:606
610
+ #: 2.8/class/avh-ec.admin.php:621
611
+ msgid "author archive"
612
+ msgstr ""
613
+
614
+ #: 3.3/class/avh-ec.admin.php:607
615
+ #: 2.8/class/avh-ec.admin.php:622
616
+ msgid "Search Page"
617
+ msgstr ""
618
+
619
+ #: 3.3/class/avh-ec.admin.php:607
620
+ #: 2.8/class/avh-ec.admin.php:622
621
+ msgid "search"
622
+ msgstr ""
623
+
624
+ #: 3.3/class/avh-ec.admin.php:650
625
+ #: 2.8/class/avh-ec.admin.php:665
626
+ msgid "Add group"
627
+ msgstr ""
628
+
629
+ #: 3.3/class/avh-ec.admin.php:699
630
+ #: 2.8/class/avh-ec.admin.php:714
631
+ msgid "Update group"
632
+ msgstr ""
633
+
634
+ #: 3.3/class/avh-ec.admin.php:712
635
+ #: 2.8/class/avh-ec.admin.php:727
636
+ msgid "Save settings"
637
+ msgstr ""
638
+
639
+ #: 3.3/class/avh-ec.admin.php:723
640
+ #: 3.3/class/avh-ec.admin.php:760
641
+ #: 2.8/class/avh-ec.admin.php:739
642
+ #: 2.8/class/avh-ec.admin.php:784
643
+ msgid "Manually Order Categories"
644
+ msgstr ""
645
+
646
+ #: 3.3/class/avh-ec.admin.php:812
647
+ msgid "Manual order of the categories successfully updated."
648
+ msgstr ""
649
+
650
+ #: 3.3/class/avh-ec.admin.php:814
651
+ #: 2.8/class/avh-ec.admin.php:835
652
+ msgid "An error occured, order has not been saved."
653
+ msgstr ""
654
+
655
+ #: 3.3/class/avh-ec.admin.php:830
656
+ #: 2.8/class/avh-ec.admin.php:853
657
+ msgid "Order the categories"
658
+ msgstr ""
659
+
660
+ #: 3.3/class/avh-ec.admin.php:839
661
+ #: 2.8/class/avh-ec.admin.php:862
662
+ msgid "Order the categories on this level by dragging and dropping them into the desired order."
663
+ msgstr ""
664
+
665
+ #: 3.3/class/avh-ec.admin.php:847
666
+ #: 2.8/class/avh-ec.admin.php:870
667
+ msgid "Save Order"
668
+ msgstr ""
669
+
670
+ #: 3.3/class/avh-ec.admin.php:850
671
+ #: 2.8/class/avh-ec.admin.php:873
672
+ msgid "Return to parent category"
673
+ msgstr ""
674
+
675
+ #: 3.3/class/avh-ec.admin.php:857
676
+ #: 2.8/class/avh-ec.admin.php:880
677
+ msgid "Select Subcategory"
678
+ msgstr ""
679
+
680
+ #: 3.3/class/avh-ec.admin.php:862
681
+ #: 2.8/class/avh-ec.admin.php:885
682
+ msgid "Select"
683
+ msgstr ""
684
+
685
+ #: 3.3/class/avh-ec.admin.php:864
686
+ #: 2.8/class/avh-ec.admin.php:887
687
+ msgid "Choose a category from the drop down to order the subcategories in that category."
688
+ msgstr ""
689
+
690
+ #: 3.3/class/avh-ec.admin.php:880
691
+ #: 2.8/class/avh-ec.admin.php:903
692
+ msgid "F.A.Q."
693
+ msgstr ""
694
+
695
+ #: 3.3/class/avh-ec.admin.php:959
696
+ #: 2.8/class/avh-ec.admin.php:989
697
+ msgid "This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language."
698
+ msgstr ""
699
+
700
+ #: 3.3/class/avh-ec.admin.php:964
701
+ #: 2.8/class/avh-ec.admin.php:994
702
+ msgid "Available Languages"
703
+ msgstr ""
704
+
705
+ #: 3.3/class/avh-ec.admin.php:979
706
+ #: 2.8/class/avh-ec.admin.php:1009
707
+ msgid "You can visit "
708
+ msgstr ""
709
+
710
+ #: 3.3/class/avh-ec.admin.php:979
711
+ #: 2.8/class/avh-ec.admin.php:1009
712
+ msgid "to help complete these translations or add a new language."
713
+ msgstr ""
714
+
715
+ #: 3.3/class/avh-ec.admin.php:992
716
+ #: 2.8/class/avh-ec.admin.php:1022
717
+ msgid "If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation."
718
+ msgstr ""
719
+
720
+ #: 3.3/class/avh-ec.admin.php:997
721
+ #: 2.8/class/avh-ec.admin.php:1027
722
+ msgid "If you decide to buy something from Amazon click the button."
723
+ msgstr ""
724
+
725
+ #: 3.3/class/avh-ec.admin.php:1002
726
+ #: 2.8/class/avh-ec.admin.php:1032
727
+ msgid "You can send me something from my "
728
+ msgstr ""
729
+
730
+ #: 3.3/class/avh-ec.admin.php:1002
731
+ #: 2.8/class/avh-ec.admin.php:1032
732
+ msgid "Amazon Wish List"
733
+ msgstr ""
734
+
735
+ #: 3.3/class/avh-ec.admin.php:1006
736
+ #: 2.8/class/avh-ec.admin.php:1036
737
+ msgid "Through Paypal."
738
+ msgstr ""
739
+
740
+ #: 3.3/class/avh-ec.admin.php:1007
741
+ #: 2.8/class/avh-ec.admin.php:1037
742
+ msgid "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."
743
+ msgstr ""
744
+
745
+ #: 3.3/class/avh-ec.admin.php:1021
746
+ #: 2.8/class/avh-ec.admin.php:1051
747
+ msgid "What about support?"
748
+ msgstr ""
749
+
750
+ #: 3.3/class/avh-ec.admin.php:1022
751
+ msgid "I created a <a href=\"http://forums.avirtualhome.com\" target=\"_blank\">support site</a> where you can ask questions or request features."
752
+ msgstr ""
753
+
754
+ #: 3.3/class/avh-ec.admin.php:1026
755
+ #: 2.8/class/avh-ec.admin.php:1056
756
+ msgid "What is depth selection?"
757
+ msgstr ""
758
+
759
+ #: 3.3/class/avh-ec.admin.php:1027
760
+ #: 2.8/class/avh-ec.admin.php:1057
761
+ msgid "Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well."
762
+ msgstr ""
763
+
764
+ #: 3.3/class/avh-ec.admin.php:1028
765
+ #: 2.8/class/avh-ec.admin.php:1058
766
+ msgid "Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:"
767
+ msgstr ""
768
+
769
+ #: 3.3/class/avh-ec.admin.php:1029
770
+ #: 2.8/class/avh-ec.admin.php:1059
771
+ msgid "You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only."
772
+ msgstr ""
773
+
774
+ #: 3.3/class/avh-ec.admin.php:1033
775
+ #: 2.8/class/avh-ec.admin.php:1063
776
+ msgid "Multiple Category Groups"
777
+ msgstr ""
778
+
779
+ #: 3.3/class/avh-ec.admin.php:1034
780
+ #: 2.8/class/avh-ec.admin.php:1064
781
+ msgid "The following is an explanation how assigning multiple groups to page/post works."
782
+ msgstr ""
783
+
784
+ #: 3.3/class/avh-ec.admin.php:1035
785
+ #: 2.8/class/avh-ec.admin.php:1065
786
+ msgid "Lets say you have the following groups:"
787
+ msgstr ""
788
+
789
+ #: 3.3/class/avh-ec.admin.php:1037
790
+ #: 2.8/class/avh-ec.admin.php:1067
791
+ msgid "Free Time"
792
+ msgstr ""
793
+
794
+ #: 3.3/class/avh-ec.admin.php:1038
795
+ #: 2.8/class/avh-ec.admin.php:1068
796
+ msgid "Theater"
797
+ msgstr ""
798
+
799
+ #: 3.3/class/avh-ec.admin.php:1039
800
+ #: 2.8/class/avh-ec.admin.php:1069
801
+ msgid "Movie"
802
+ msgstr ""
803
+
804
+ #: 3.3/class/avh-ec.admin.php:1040
805
+ #: 2.8/class/avh-ec.admin.php:1070
806
+ msgid "Music"
807
+ msgstr ""
808
+
809
+ #: 3.3/class/avh-ec.admin.php:1042
810
+ #: 2.8/class/avh-ec.admin.php:1072
811
+ msgid "Setup several Category Group widgets and associated each widget with one or more groups."
812
+ msgstr ""
813
+
814
+ #: 3.3/class/avh-ec.admin.php:1043
815
+ #: 2.8/class/avh-ec.admin.php:1073
816
+ msgid "Widget 1 has association with Free Time"
817
+ msgstr ""
818
+
819
+ #: 3.3/class/avh-ec.admin.php:1044
820
+ #: 2.8/class/avh-ec.admin.php:1074
821
+ msgid "Widget 2 has association with Theater, Movie and Music"
822
+ msgstr ""
823
+
824
+ #: 3.3/class/avh-ec.admin.php:1045
825
+ #: 2.8/class/avh-ec.admin.php:1075
826
+ msgid "Widget 3 has association with Theater, Movie and Music"
827
+ msgstr ""
828
+
829
+ #: 3.3/class/avh-ec.admin.php:1046
830
+ #: 2.8/class/avh-ec.admin.php:1076
831
+ msgid "Page has associations the groups Free Time and Theater"
832
+ msgstr ""
833
+
834
+ #: 3.3/class/avh-ec.admin.php:1048
835
+ #: 3.3/class/avh-ec.admin.php:1060
836
+ #: 2.8/class/avh-ec.admin.php:1078
837
+ #: 2.8/class/avh-ec.admin.php:1090
838
+ msgid "Widget 1: Shows categories of the Free Time group"
839
+ msgstr ""
840
+
841
+ #: 3.3/class/avh-ec.admin.php:1049
842
+ #: 2.8/class/avh-ec.admin.php:1079
843
+ msgid "Widget 2: Shows categories of the Theater group."
844
+ msgstr ""
845
+
846
+ #: 3.3/class/avh-ec.admin.php:1050
847
+ #: 3.3/class/avh-ec.admin.php:1056
848
+ #: 2.8/class/avh-ec.admin.php:1080
849
+ #: 2.8/class/avh-ec.admin.php:1086
850
+ msgid "Widget 3: Not displayed"
851
+ msgstr ""
852
+
853
+ #: 3.3/class/avh-ec.admin.php:1052
854
+ #: 2.8/class/avh-ec.admin.php:1082
855
+ msgid "Page has associations the group Movie."
856
+ msgstr ""
857
+
858
+ #: 3.3/class/avh-ec.admin.php:1054
859
+ #: 2.8/class/avh-ec.admin.php:1084
860
+ msgid "Widget 1: Not displayed"
861
+ msgstr ""
862
+
863
+ #: 3.3/class/avh-ec.admin.php:1055
864
+ #: 2.8/class/avh-ec.admin.php:1085
865
+ msgid "Widget 2: Shows categories of the Movie group."
866
+ msgstr ""
867
+
868
+ #: 3.3/class/avh-ec.admin.php:1058
869
+ #: 2.8/class/avh-ec.admin.php:1088
870
+ msgid "Page has associations the groups Free Time, Movie and Music"
871
+ msgstr ""
872
+
873
+ #: 3.3/class/avh-ec.admin.php:1061
874
+ #: 2.8/class/avh-ec.admin.php:1091
875
+ msgid "Widget 2: Shows categories of the Movie or Music group."
876
+ msgstr ""
877
+
878
+ #: 3.3/class/avh-ec.admin.php:1062
879
+ #: 2.8/class/avh-ec.admin.php:1092
880
+ msgid "Widget 3: Shows categories of the Music or Movie group."
881
+ msgstr ""
882
+
883
+ #: 3.3/class/avh-ec.admin.php:1064
884
+ #: 2.8/class/avh-ec.admin.php:1094
885
+ msgid "Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie."
886
+ msgstr ""
887
+
888
+ #: 3.3/class/avh-ec.admin.php:1072
889
+ #: 2.8/class/avh-ec.admin.php:1102
890
+ msgid "PHP4 Support"
891
+ msgstr ""
892
+
893
+ #: 3.3/class/avh-ec.admin.php:1073
894
+ #: 2.8/class/avh-ec.admin.php:1103
895
+ msgid "The next major release of the plugin will no longer support PHP4."
896
+ msgstr ""
897
+
898
+ #: 3.3/class/avh-ec.admin.php:1074
899
+ #: 2.8/class/avh-ec.admin.php:1104
900
+ msgid "It will be written for PHP 5.2 and "
901
+ msgstr ""
902
+
903
+ #: 3.3/class/avh-ec.admin.php:1076
904
+ #: 2.8/class/avh-ec.admin.php:1106
905
+ msgid "your blog already runs the needed PHP version. When the new release comes out you can safely update."
906
+ msgstr ""
907
+
908
+ #: 3.3/class/avh-ec.admin.php:1078
909
+ #: 2.8/class/avh-ec.admin.php:1108
910
+ msgid "your blog still runs PHP4. When the new release comes out you can not use it."
911
+ msgstr ""
912
+
913
+ #: 3.3/class/avh-ec.admin.php:1079
914
+ #: 2.8/class/avh-ec.admin.php:1109
915
+ msgid "I don't have a timeline for the next version but consider contacting your host if PHP 5.2 is available."
916
+ msgstr ""
917
+
918
+ #: 3.3/class/avh-ec.admin.php:1080
919
+ #: 2.8/class/avh-ec.admin.php:1110
920
+ msgid "If your hosts doesn't offer PHP 5.2 you might want to consider switching hosts."
921
+ msgstr ""
922
+
923
+ #: 3.3/class/avh-ec.admin.php:1081
924
+ #: 2.8/class/avh-ec.admin.php:1111
925
+ msgid "A host to consider is "
926
+ msgstr ""
927
+
928
+ #: 3.3/class/avh-ec.admin.php:1082
929
+ #: 2.8/class/avh-ec.admin.php:1112
930
+ msgid "I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price."
931
+ msgstr ""
932
+
933
+ #: 3.3/class/avh-ec.admin.php:1124
934
+ #: 2.8/class/avh-ec.admin.php:1154
935
+ msgid "Settings"
936
+ msgstr ""
937
+
938
+ #: 3.3/class/avh-ec.admin.php:1139
939
+ #: 2.8/class/avh-ec.admin.php:1169
940
+ msgid "Categories in the group"
941
+ msgstr ""
942
+
943
+ #: 3.3/class/avh-ec.admin.php:1156
944
+ #: 2.8/class/avh-ec.admin.php:1186
945
+ #, php-format
946
+ msgid "Your attempt to delete this group: &#8220;%s&#8221; has failed."
947
+ msgstr ""
948
+
949
+ #: 3.3/class/avh-ec.admin.php:1218
950
+ #: 2.8/class/avh-ec.admin.php:1248
951
+ #, php-format
952
+ msgid "Edit &#8220;%s&#8221;"
953
+ msgstr ""
954
+
955
+ #: 3.3/class/avh-ec.admin.php:1220
956
+ #: 2.8/class/avh-ec.admin.php:1250
957
+ msgid "Edit"
958
+ msgstr ""
959
+
960
+ #: 3.3/class/avh-ec.admin.php:1225
961
+ #: 2.8/class/avh-ec.admin.php:1255
962
+ msgid "Delete"
963
+ msgstr ""
964
+
965
+ #: 3.3/class/avh-ec.core.php:448
966
+ #: 3.3/class/avh-ec.core.php:450
967
+ #: 2.8/class/avh-ec.core.php:448
968
+ #: 2.8/class/avh-ec.core.php:450
969
+ msgid "No categories"
970
+ msgstr ""
971
+
972
+ #: 3.3/class/avh-ec.core.php:661
973
+ #: 2.8/class/avh-ec.core.php:660
974
+ #, php-format
975
+ msgid "View all posts filed under %s"
976
+ msgstr ""
977
+
978
+ #: 3.3/class/avh-ec.core.php:676
979
+ #: 2.8/class/avh-ec.core.php:675
980
+ #, php-format
981
+ msgid "Feed for all posts filed under %s"
982
+ msgstr ""
983
+
984
+ #: 3.3/class/avh-ec.category-group.php:111
985
+ #: 2.8/class/avh-ec.category-group.php:111
986
+ msgid "Search Category Groups"
987
+ msgstr ""
988
+
989
+ #: 3.3/class/avh-ec.category-group.php:111
990
+ #: 2.8/class/avh-ec.category-group.php:111
991
+ msgid "Popular Category Groups"
992
+ msgstr ""
993
+
994
+ #: 3.3/class/avh-ec.category-group.php:111
995
+ #: 2.8/class/avh-ec.category-group.php:111
996
+ msgid "All Category Groups"
997
+ msgstr ""
998
+
999
+ #: 3.3/class/avh-ec.category-group.php:111
1000
+ #: 2.8/class/avh-ec.category-group.php:111
1001
+ msgid "Parent Category Group"
1002
+ msgstr ""
1003
+
1004
+ #: 3.3/class/avh-ec.category-group.php:111
1005
+ #: 2.8/class/avh-ec.category-group.php:111
1006
+ msgid "Parent Category Group:"
1007
+ msgstr ""
1008
+
1009
+ #: 3.3/class/avh-ec.category-group.php:111
1010
+ #: 2.8/class/avh-ec.category-group.php:111
1011
+ msgid "Edit Category Group"
1012
+ msgstr ""
1013
+
1014
+ #: 3.3/class/avh-ec.category-group.php:111
1015
+ #: 2.8/class/avh-ec.category-group.php:111
1016
+ msgid "Update Category Group"
1017
+ msgstr ""
1018
+
1019
+ #: 3.3/class/avh-ec.category-group.php:111
1020
+ #: 2.8/class/avh-ec.category-group.php:111
1021
+ msgid "Add New Category Group"
1022
+ msgstr ""
1023
+
1024
+ #: 3.3/class/avh-ec.category-group.php:111
1025
+ #: 2.8/class/avh-ec.category-group.php:111
1026
+ msgid "New Category Group Name"
1027
+ msgstr ""
1028
+
1029
+ #: 3.3/class/avh-ec.category-group.php:127
1030
+ #: 2.8/class/avh-ec.category-group.php:127
1031
+ msgid "This group will not show the widget."
1032
+ msgstr ""
1033
+
1034
+ #: 3.3/class/avh-ec.category-group.php:128
1035
+ #: 2.8/class/avh-ec.category-group.php:128
1036
+ msgid "Holds all the categories."
1037
+ msgstr ""
1038
+
1039
+ #: 3.3/class/avh-ec.category-group.php:129
1040
+ #: 2.8/class/avh-ec.category-group.php:129
1041
+ msgid "This group will be shown on the front page."
1042
+ msgstr ""
1043
+
1044
+ #: 2.8/class/avh-ec.admin.php:244
1045
+ #: 2.8/class/avh-ec.admin.php:935
1046
+ msgid "Announcements"
1047
+ msgstr ""
1048
+
1049
+ #: 2.8/class/avh-ec.admin.php:833
1050
+ msgid "Categories updated successfully."
1051
+ msgstr ""
1052
+
1053
+ #: 2.8/class/avh-ec.admin.php:1052
1054
+ msgid "I created a support site at http://forums.avirtualhome.com where you can ask questions or request features."
1055
+ msgstr ""
1056
+
libs/avh-common.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! defined('AVH_FRAMEWORK'))
3
+ die('You are not allowed to call this page directly.');
4
+ if (! class_exists('AVH_Common')) {
5
+
6
+ final class AVH_Common
7
+ {
8
+
9
+ /**
10
+ * Sends the email
11
+ *
12
+ */
13
+ public static function sendMail ($to, $subject, $message, $footer = array())
14
+ {
15
+ $message = array_merge($message, $footer);
16
+ $msg = '';
17
+ foreach ($message as $line) {
18
+ $msg .= $line . "\r\n";
19
+ }
20
+ wp_mail($to, $subject, $msg);
21
+ return;
22
+ }
23
+
24
+ /**
25
+ * Returns the wordpress version
26
+ * Note: 2.7.x will return 2.7
27
+ *
28
+ * @return float
29
+ */
30
+ public static function getWordpressVersion ()
31
+ {
32
+ static $_version = null;
33
+ if (! isset($_version)) {
34
+ // Include WordPress version
35
+ require (ABSPATH . WPINC . '/version.php');
36
+ $_version = (float) $wp_version;
37
+ }
38
+ return $_version;
39
+ }
40
+
41
+ /**
42
+ * Determines if the current version of PHP is greater then the supplied value
43
+ *
44
+ * @param string
45
+ * @return bool
46
+ */
47
+ public static function isPHP ($version = '5.0.0')
48
+ {
49
+ static $_is_php = null;
50
+ $version = (string) $version;
51
+ if (! isset($_is_php[$version])) {
52
+ $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? false : true;
53
+ }
54
+ return $_is_php[$version];
55
+ }
56
+
57
+ /**
58
+ * Get the base directory of a directory structure
59
+ *
60
+ * @param string $directory
61
+ * @return string
62
+ *
63
+ */
64
+ public static function getBaseDirectory ($directory)
65
+ {
66
+ //get public directory structure eg "/top/second/third"
67
+ $public_directory = dirname($directory);
68
+ //place each directory into array
69
+ $directory_array = explode('/', $public_directory);
70
+ //get highest or top level in array of directory strings
71
+ $public_base = max($directory_array);
72
+ return $public_base;
73
+ }
74
+
75
+ /**
76
+ * This function will take an IP address or IP number in almost any format (that I can think of) and will return it's decimal unsigned equivalent, as a string.
77
+ * Kind => Input => Return => long2ip(Return)
78
+ * DottedQuadDec => 192.168.255.109 => 3232300909 => 192.168.255.109
79
+ * PosIntStr => 3232300909 => 3232300909 => 192.168.255.109
80
+ * NegIntStr => -1062666387 => 3232300909 => 192.168.255.109
81
+ * PosInt => 3232300909 => 3232300909 => 192.168.255.109
82
+ * NegInt => -1062666387 => 3232300909 => 192.168.255.109
83
+ * DottedQuadHex => 0xc0.0xA8.0xFF.0x6D => 0 => 0.0.0.0
84
+ * DottedQuadOct => 0300.0250.0377.0155 => 0 => 0.0.0.0
85
+ * HexIntStr => 0xC0A8FF6D => 0 => 0.0.0.0
86
+ * HexInt => 3232300909 => 3232300909 => 192.168.255.109
87
+ *
88
+ * @param string/numeric $ip
89
+ */
90
+ public static function getIp2long ($ip)
91
+ {
92
+ if (is_numeric($ip)) {
93
+ $return = sprintf("%u", floatval($ip));
94
+ } else {
95
+ $return = sprintf("%u", floatval(ip2long($ip)));
96
+ }
97
+ return $return;
98
+ }
99
+ }
100
+ }
libs/avh-db.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! defined('AVH_FRAMEWORK'))
3
+ die('You are not allowed to call this page directly.');
4
+ if (! class_exists('AVH_DB')) {
5
+
6
+ final class AVH_DB
7
+ {
8
+
9
+ /**
10
+ * Fetch MySQL Field Names
11
+ *
12
+ * @access public
13
+ * @param string the table name
14
+ * @return array
15
+ */
16
+ public function getFieldNames ($table = '')
17
+ {
18
+ global $wpdb;
19
+
20
+ $retval = wp_cache_get('field_names_' . $table, 'avhec');
21
+ if (false === $retval) {
22
+ $sql = $this->_getQueryShowColumns($table);
23
+
24
+ $result = $wpdb->get_results($sql, ARRAY_A);
25
+
26
+ $retval = array ();
27
+ foreach ($result as $row) {
28
+ if (isset($row['Field'])) {
29
+ $retval[] = $row['Field'];
30
+ }
31
+ }
32
+ wp_cache_set('field_names_' . $table, $retval,'avhec',3600);
33
+ }
34
+
35
+ return $retval;
36
+ }
37
+
38
+ /**
39
+ * Determine if a particular field exists
40
+ * @access public
41
+ * @param string
42
+ * @param string
43
+ * @return boolean
44
+ */
45
+ public function field_exists ($field_name, $table_name)
46
+ {
47
+ return (in_array($field_name, $this->getFieldNames($table_name)));
48
+ }
49
+
50
+ /**
51
+ * Show column query
52
+ *
53
+ * Generates a platform-specific query string so that the column names can be fetched
54
+ *
55
+ * @access public
56
+ * @param string the table name
57
+ * @return string
58
+ */
59
+ private function _getQueryShowColumns ($table = '')
60
+ {
61
+ global $wpdb;
62
+ return $wpdb->prepare('SHOW COLUMNS FROM ' . $table);
63
+
64
+ }
65
+ }
66
+ }
67
+
libs/avh-registry.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! defined('AVH_FRAMEWORK'))
3
+ die('You are not allowed to call this page directly.');
4
+ if (! class_exists('AVH_Settings_Registry')) {
5
+
6
+ abstract class AVH_Settings_Registry
7
+ {
8
+ /**
9
+ * Our array of settings
10
+ * @access protected
11
+ */
12
+ private $_settings = array ();
13
+
14
+ /**
15
+ * Stores settings in the registry
16
+ * @param string $data
17
+ * @param string $key The key for the array
18
+ * @return void
19
+ */
20
+ public function storeSetting ($key, $data)
21
+ {
22
+ $this->_settings[$key] = $data;
23
+ $this->$key = $data;
24
+ }
25
+
26
+ /**
27
+ * Gets a setting from the registry
28
+ * @param string $key The key in the array
29
+ * @return mixed
30
+ */
31
+ public function getSetting ($key)
32
+ {
33
+ return $this->_settings[$key];
34
+ }
35
+
36
+ /**
37
+ * Removes a setting from the registry
38
+ * @param string $key The key for the array
39
+ */
40
+ public function removeSetting ($key)
41
+ {
42
+ unset($this->_settings[$key]);
43
+ }
44
+ }
45
+ }
46
+ if (! class_exists('AVH_Class_Registry')) {
47
+
48
+ /**
49
+ * Class registry
50
+ *
51
+ */
52
+ abstract class AVH_Class_Registry
53
+ {
54
+ /**
55
+ * Our array of objects
56
+ * @access protected
57
+ * @var array
58
+ */
59
+ private $_objects = array ();
60
+ private $_dir;
61
+ private $_class_file_prefix;
62
+ private $_class_name_prefix;
63
+
64
+ /**
65
+ * Loads a class
66
+ *
67
+ * @param string $class Name of the class you want to load
68
+ * @param string $type What kind of class, System, Plugin
69
+ * @param boolean $store Store the class in the registry
70
+ * @return object
71
+ */
72
+ public function load_class ($class, $type = 'system', $store = false)
73
+ {
74
+ if (isset($this->_objects[$class])) {
75
+ return ($this->_objects[$class]);
76
+ }
77
+ switch ($type) {
78
+ case 'plugin':
79
+ $in = '/class';
80
+ $file = $this->_class_file_prefix . $class . '.php';
81
+ break;
82
+ case 'system':
83
+ default:
84
+ $in = '/libs';
85
+ $file = 'avh-' . $class . '.php';
86
+ }
87
+ require_once ($this->_dir . $in . '/' . strtolower($file));
88
+ $name = ('system' == $type) ? 'AVH_' . $class : $this->_class_name_prefix . $class;
89
+ $object = $this->instantiate_class(new $name());
90
+ if ($store) {
91
+ $this->_objects[$class] = $object;
92
+ }
93
+ return $object;
94
+ }
95
+
96
+ /**
97
+ * Instantiate Class
98
+ *
99
+ * Returns a new class object by reference, used by load_class() and the DB class.
100
+ * Required to make PHP 5.3 cry.
101
+ *
102
+ * Use: $obj =& instantiate_class(new Foo());
103
+ *
104
+ * @access public
105
+ * @param object
106
+ * @return object
107
+ */
108
+ protected function instantiate_class (&$class_object)
109
+ {
110
+ return $class_object;
111
+ }
112
+
113
+ /**
114
+ * @param $dir the $dir to set
115
+ */
116
+ public function setDir ($dir)
117
+ {
118
+ $this->_dir = $dir;
119
+ }
120
+
121
+ /**
122
+ * @param $class Unique Identifier
123
+ * @param $class_prefix the $class_prefix to set
124
+ */
125
+ public function setClassFilePrefix ($class_prefix)
126
+ {
127
+ $this->_class_file_prefix = $class_prefix;
128
+ }
129
+
130
+ /**
131
+ * @param $class Unique Identifier
132
+ * @param $class_name_prefix the $class_name_prefix to set
133
+ */
134
+ public function setClassNamePrefix ($class_name_prefix)
135
+ {
136
+ $this->_class_name_prefix = $class_name_prefix;
137
+ }
138
+
139
+ public function setClassProperties ($properties)
140
+ {
141
+ $default_properties = array ( 'type' => 'system', 'store' => false );
142
+ }
143
+ }
144
+ }
libs/avh-security.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! defined('AVH_FRAMEWORK'))
3
+ die('You are not allowed to call this page directly.');
4
+ if (! class_exists('AVH_Security')) {
5
+
6
+ final class AVH_Security
7
+ {
8
+
9
+ /**
10
+ * Local nonce creation. WordPress uses the UID and sometimes I don't want that
11
+ * Creates a random, one time use token.
12
+ *
13
+ * @param string|int $action Scalar value to add context to the nonce.
14
+ * @return string The one use form token
15
+ *
16
+ */
17
+ public static function createNonce ($action = -1)
18
+ {
19
+ $i = wp_nonce_tick();
20
+ return substr(wp_hash($i . $action, 'nonce'), - 12, 10);
21
+ }
22
+
23
+ /**
24
+ * Local nonce verification. WordPress uses the UID and sometimes I don't want that
25
+ * Verify that correct nonce was used with time limit.
26
+ *
27
+ * The user is given an amount of time to use the token, so therefore, since the
28
+ * $action remain the same, the independent variable is the time.
29
+ *
30
+ * @param string $nonce Nonce that was used in the form to verify
31
+ * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
32
+ * @return bool Whether the nonce check passed or failed.
33
+ */
34
+ public static function verifyNonce ($nonce, $action = -1)
35
+ {
36
+ $r = false;
37
+ $i = wp_nonce_tick();
38
+ // Nonce generated 0-12 hours ago
39
+ if (substr(wp_hash($i . $action, 'nonce'), - 12, 10) == $nonce) {
40
+ $r = 1;
41
+ } elseif (substr(wp_hash(($i - 1) . $action, 'nonce'), - 12, 10) == $nonce) { // Nonce generated 12-24 hours ago
42
+ $r = 2;
43
+ }
44
+ return $r;
45
+ }
46
+ }
47
+ }
libs/avh-visitor.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! defined('AVH_FRAMEWORK'))
3
+ die('You are not allowed to call this page directly.');
4
+ if (! class_exists('AVH_Visitor')) {
5
+
6
+ final class AVH_Visitor
7
+ {
8
+
9
+ /**
10
+ * Get the user's IP
11
+ *
12
+ * @return string
13
+ */
14
+ public static function getUserIp ()
15
+ {
16
+ $ip = array ();
17
+ foreach (array ( 'HTTP_CF_CONNECTING_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
18
+ 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key) {
19
+ if (array_key_exists($key, $_SERVER) === true) {
20
+ foreach (explode(',', $_SERVER[$key]) as $visitors_ip) {
21
+ $ip[] = str_replace(' ', '', $visitors_ip);
22
+ }
23
+ }
24
+ }
25
+ // If for some strange reason we don't get an IP we return imemdiately with 0.0.0.0
26
+ if (empty($ip)) {
27
+ return '0.0.0.0';
28
+ }
29
+ $ip = array_values(array_unique($ip));
30
+ $return = null;
31
+ // In PHP 5.3 and up the function filter_var can be used, much quicker as the regular expression check
32
+ if (AVH_Common::isPHP('5.3')) {
33
+ foreach ($ip as $i) {
34
+ if (filter_var($i, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE)) {
35
+ $return = $i;
36
+ break;
37
+ }
38
+ }
39
+ } else {
40
+ $dec_octet = '(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])';
41
+ $ip4_address = $dec_octet . '.' . $dec_octet . '.' . $dec_octet . '.' . $dec_octet;
42
+ $match = array ();
43
+ foreach ($ip as $i) {
44
+ if (preg_match('/^' . $ip4_address . '$/', $i, $match)) {
45
+ if (preg_match('/^(127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)/', $i)) {
46
+ continue;
47
+ } else {
48
+ $return = $i;
49
+ break;
50
+ }
51
+ }
52
+ }
53
+ }
54
+ if (null === $return) {
55
+ $return = '0.0.0.0';
56
+ }
57
+ return $return;
58
+ }
59
+ }
60
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 3.3
7
- Stable tag: 3.5
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
@@ -25,7 +25,7 @@ The replacement widget gives you the following customizable options:
25
  * Hide empty categories.
26
  * Show categories hierarchical.
27
  * Show categories up to a certain depth. (Requires WordPress 2.8 or higher).
28
- * Sort by ID, Name, Count, Slug and manual order set by the plugin My Category Order.
29
  * Sort ascending or descending.
30
  * Show RSS link after the category as text or image.
31
  * Select which categories to show. (Requires WordPress 2.5.1 or higher).
@@ -72,7 +72,7 @@ Translations:
72
  * Swedish - Svenska (sv_SE)
73
  * Turkish - Türkçe (tr)
74
 
75
- Some of the translations are incomplete. You can complete them or add your own language through [Launchpad](https://translations.launchpad.net/avhextendedcategories/trunk)
76
 
77
  == Installation ==
78
 
@@ -134,6 +134,13 @@ Whether Widget 2 shows Movie or Music depends on the creation order of groups. I
134
  None
135
 
136
  == Changelog ==
 
 
 
 
 
 
 
137
  = Version 3.5 =
138
  * RFC: Adds the ability for the widgets to sort the categories as set with plugin My Category Order. This plugin allows to order categories manually.
139
 
4
  Tags: extended, categories, widget, top categories
5
  Requires at least: 2.3
6
  Tested up to: 3.3
7
+ Stable tag: 3.6
8
 
9
  The AVH Extended Categories Widgets gives you three widgets for displaying categories.
10
  == Description ==
25
  * Hide empty categories.
26
  * Show categories hierarchical.
27
  * Show categories up to a certain depth. (Requires WordPress 2.8 or higher).
28
+ * Sort by ID, Name, Count, Slug or manual order (Requires WordPress 3.3 or higher).
29
  * Sort ascending or descending.
30
  * Show RSS link after the category as text or image.
31
  * Select which categories to show. (Requires WordPress 2.5.1 or higher).
72
  * Swedish - Svenska (sv_SE)
73
  * Turkish - Türkçe (tr)
74
 
75
+ Some of the translations are incomplete. Currently we're in the middle of changing the way you can help with translations. Keep an eye on the [website](http:///blog.avirtualhome.com) for the announcement.
76
 
77
  == Installation ==
78
 
134
  None
135
 
136
  == Changelog ==
137
+ = Version 3.6 =
138
+ * Adds Manual Order option. No need for 3rd party plugin anymore. This only works in WordPress 3.3.x
139
+ * Speed up the creation of the categories checklist in the widgets.
140
+
141
+ = Version 3.5.1 =
142
+ * Bugfix: The columns in the admin section don't save, making certain columns disappear.
143
+
144
  = Version 3.5 =
145
  * RFC: Adds the ability for the widgets to sort the categories as set with plugin My Category Order. This plugin allows to order categories manually.
146
 
widget-pre2.8.php CHANGED
@@ -9,7 +9,7 @@ function widget_extended_categories_init ()
9
 
10
  function widget_extended_categories ($args, $number = 1)
11
  {
12
- $version = '3.5';
13
  // Check for version
14
  require (ABSPATH . WPINC . '/version.php');
15
  if (version_compare($wp_version, '2.5.1', '<')) {
9
 
10
  function widget_extended_categories ($args, $number = 1)
11
  {
12
+ $version = '3.6';
13
  // Check for version
14
  require (ABSPATH . WPINC . '/version.php');
15
  if (version_compare($wp_version, '2.5.1', '<')) {
widget_extended_categories.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: AVH Extended Categories Widgets
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: 3.5
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9
 
10
- Copyright 2008 Peter van der Does (email : peter@avirtualhome.com)
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
@@ -23,24 +23,47 @@ You should have received a copy of the GNU General Public License
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
-
27
- // Include WordPress version
 
28
  require (ABSPATH . WPINC . '/version.php');
 
 
 
 
29
 
30
- $_basename = plugin_basename(__FILE__);
31
- $dir = current(explode('/', $_basename));
 
 
 
32
 
 
 
 
 
 
 
 
 
33
 
34
- define('AVHEC_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . $dir);
35
- define('AVHEC_PLUGIN_NAME', $_basename);
36
 
37
- if ((float) $wp_version >= 2.8) {
38
- define('AVHEC_PLUGIN_URL', WP_PLUGIN_URL . '/' . $dir . '/2.8');
39
- define('AVHEC_ABSOLUTE_WORKING_DIR', AVHEC_PLUGIN_DIR . '/2.8');
40
- define('AVHEC_RELATIVE_WORKING_DIR', $dir . '/2.8');
41
- unset($dir);
 
 
 
 
 
 
42
  require (AVHEC_ABSOLUTE_WORKING_DIR . '/avh-ec.client.php');
 
43
  } else {
44
  require_once 'widget-pre2.8.php';
45
  }
46
- ?>
3
  Plugin Name: AVH Extended Categories Widgets
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: 3.6
7
  Author: Peter van der Does
8
  Author URI: http://blog.avirtualhome.com/
9
 
10
+ Copyright 2012 Peter van der Does (email : peter@avirtualhome.com)
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
+ if (! defined('AVH_FRAMEWORK')) {
27
+ define('AVH_FRAMEWORK', true);
28
+ }
29
  require (ABSPATH . WPINC . '/version.php');
30
+ $_avhec_version = (float) $wp_version;
31
+
32
+ if ($_avhec_version >= 2.8) {
33
+ $_avhec_abs_dir = pathinfo(__FILE__, PATHINFO_DIRNAME);
34
 
35
+ require_once ($_avhec_abs_dir . '/libs/avh-registry.php');
36
+ require_once ($_avhec_abs_dir . '/libs/avh-common.php');
37
+ require_once ($_avhec_abs_dir . '/libs/avh-security.php');
38
+ require_once ($_avhec_abs_dir . '/libs/avh-visitor.php');
39
+ require_once ($_avhec_abs_dir . '/libs/avh-db.php');
40
 
41
+ switch ($_avhec_version) {
42
+ case ($_avhec_version >= 2.8 && $_avhec_version < 3.2):
43
+ $_avhec_version_dir = '/2.8';
44
+ break;
45
+ case ($_avhec_version >= 3.3):
46
+ $_avhec_version_dir = '/3.3';
47
+ break;
48
+ }
49
 
50
+ $_avhec_dir = '/' . end(explode('/', $_avhec_abs_dir));
51
+ $_avhec_url = plugins_url() . $_avhec_dir;
52
 
53
+ define('AVHEC_PLUGIN_DIR', $_avhec_abs_dir);
54
+ define('AVHEC_RELATIVE_PLUGIN_DIR', $_avhec_dir);
55
+ define('AVHEC_PLUGIN_URL', $_avhec_url . $_avhec_version_dir);
56
+ define('AVHEC_ABSOLUTE_WORKING_DIR', AVHEC_PLUGIN_DIR . $_avhec_version_dir);
57
+ define('AVHEC_RELATIVE_WORKING_DIR', $_avhec_dir . $_avhec_version_dir);
58
+
59
+ unset($_avhec_version);
60
+ unset($_avhec_dir);
61
+ unset($_avhec_abs_dir);
62
+ unset($_avhec_version_dir);
63
+ unset($_avhec_url);
64
  require (AVHEC_ABSOLUTE_WORKING_DIR . '/avh-ec.client.php');
65
+
66
  } else {
67
  require_once 'widget-pre2.8.php';
68
  }
69
+ ?>