Version Description
Download this release
Release Info
Developer | petervanderdoes |
Plugin | AVH Extended Categories Widgets |
Version | 3.8.3 |
Comparing to | |
See all releases |
Code changes from version 3.8.2 to 3.8.3
- 2.8/class/avh-ec.core.php +1 -1
- 3.3/class/avh-ec.core.php +1 -1
- 3.6/avh-ec.client.php +3 -2
- 3.6/class/avh-ec.admin.php +55 -57
- 3.6/class/avh-ec.category-group.php +15 -15
- 3.6/class/avh-ec.core.php +85 -62
- 3.6/class/avh-ec.widgets.php +161 -167
- 3.6/helpers/avh-common.php +19 -0
- 3.6/helpers/avh-forms.php +1 -1
- Contributing.md +47 -0
- libs/avh-common.php +95 -90
- readme.txt +17 -9
- widget_extended_categories.php +34 -38
2.8/class/avh-ec.core.php
CHANGED
@@ -27,7 +27,7 @@ class AVH_EC_Core
|
|
27 |
*/
|
28 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
|
30 |
-
$this->version = '3.8.
|
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';
|
27 |
*/
|
28 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
|
30 |
+
$this->version = '3.8.3';
|
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';
|
3.3/class/avh-ec.core.php
CHANGED
@@ -27,7 +27,7 @@ class AVH_EC_Core
|
|
27 |
*/
|
28 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
|
30 |
-
$this->version = '3.8.
|
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';
|
27 |
*/
|
28 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
|
30 |
+
$this->version = '3.8.3';
|
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';
|
3.6/avh-ec.client.php
CHANGED
@@ -36,13 +36,14 @@ class AVH_EC_Singleton
|
|
36 |
}
|
37 |
|
38 |
return $instance;
|
39 |
-
}
|
40 |
-
}
|
41 |
|
42 |
/**
|
43 |
* Include the necessary files
|
44 |
*/
|
45 |
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-forms.php');
|
|
|
46 |
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widgets.php');
|
47 |
|
48 |
/**
|
36 |
}
|
37 |
|
38 |
return $instance;
|
39 |
+
}
|
40 |
+
}
|
41 |
|
42 |
/**
|
43 |
* Include the necessary files
|
44 |
*/
|
45 |
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-forms.php');
|
46 |
+
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-common.php');
|
47 |
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widgets.php');
|
48 |
|
49 |
/**
|
3.6/class/avh-ec.admin.php
CHANGED
@@ -29,23 +29,23 @@ class AVH_EC_Admin
|
|
29 |
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
30 |
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
31 |
|
32 |
-
add_action('wp_ajax_delete-group', array(
|
33 |
|
34 |
// Admin menu
|
35 |
-
add_action('admin_init', array(
|
36 |
-
add_action('admin_menu', array(
|
37 |
-
add_filter('plugin_action_links_extended-categories-widget/widget_extended_categories.php', array(
|
38 |
|
39 |
// Actions used for editing posts
|
40 |
-
add_action('load-post.php', array(
|
41 |
-
add_action('load-page.php', array(
|
42 |
|
43 |
// Actions related to adding and deletes categories
|
44 |
add_action("created_category", array($this, 'actionCreatedCategory'), 10, 2);
|
45 |
add_action("delete_category", array($this, 'actionDeleteCategory'), 10, 2);
|
46 |
|
47 |
-
add_filter('manage_categories_group_columns', array(
|
48 |
-
add_filter('explain_nonce_delete-avhecgroup', array(
|
49 |
|
50 |
return;
|
51 |
}
|
@@ -53,14 +53,12 @@ class AVH_EC_Admin
|
|
53 |
public function actionAdminInit()
|
54 |
{
|
55 |
if (is_admin() && isset($_GET['taxonomy']) && 'category' == $_GET['taxonomy']) {
|
56 |
-
add_action($_GET['taxonomy'] . '_edit_form', array(
|
57 |
}
|
58 |
-
add_action('edit_term', array(
|
59 |
}
|
60 |
|
61 |
/**
|
62 |
-
*
|
63 |
-
*
|
64 |
* Adds Category Group form
|
65 |
* @WordPress action category_edit_form
|
66 |
*
|
@@ -81,14 +79,14 @@ class AVH_EC_Admin
|
|
81 |
$current_selection = $current_group->term_id;
|
82 |
}
|
83 |
|
84 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' =>
|
85 |
foreach ($cat_groups as $group) {
|
86 |
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
87 |
$dropdown_value[] = $group->term_id;
|
88 |
$dropdown_text[] = $temp_cat->name;
|
89 |
}
|
90 |
|
91 |
-
$seldata ='';
|
92 |
foreach ($dropdown_value as $key => $sel) {
|
93 |
$seldata .= '<option value="' . esc_attr($sel) . '" ' . (($current_selection == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($dropdown_text[$key])) . '</option>' . "\n";
|
94 |
}
|
@@ -145,7 +143,7 @@ class AVH_EC_Admin
|
|
145 |
* When a category is deleted this function is called so the category is deleted from every group as well.
|
146 |
*
|
147 |
* @param object $term
|
148 |
-
* @param int
|
149 |
*/
|
150 |
public function actionDeleteCategory($term_id, $term_taxonomy_id)
|
151 |
{
|
@@ -177,28 +175,28 @@ class AVH_EC_Admin
|
|
177 |
|
178 |
// Add menu system
|
179 |
$folder = $this->core->getBaseDirectory(AVHEC_PLUGIN_DIR);
|
180 |
-
add_menu_page('AVH Extended Categories', 'AVH Extended Categories', 'manage_options', $folder, array(
|
181 |
-
$this->hooks['menu_overview'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Overview', 'avh-ec'), __('Overview', 'avh-ec'), 'manage_options', $folder, array(
|
182 |
-
$this->hooks['menu_general'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('General Options', 'avh-ec'), __('General Options', 'avh-ec'), 'manage_options', 'avhec-general', array(
|
183 |
-
$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(
|
184 |
-
$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(
|
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(
|
186 |
|
187 |
// Add actions for menu pages
|
188 |
// Overview Menu
|
189 |
-
add_action('load-' . $this->hooks['menu_overview'], array(
|
190 |
|
191 |
// General Options Menu
|
192 |
-
add_action('load-' . $this->hooks['menu_general'], array(
|
193 |
|
194 |
// Category Groups Menu
|
195 |
-
add_action('load-' . $this->hooks['menu_category_groups'], array(
|
196 |
|
197 |
// Manual Order Menu
|
198 |
-
add_action('load-' . $this->hooks['menu_manual_order'], array(
|
199 |
|
200 |
// FAQ Menu
|
201 |
-
add_action('load-' . $this->hooks['menu_faq'], array(
|
202 |
}
|
203 |
|
204 |
/**
|
@@ -207,8 +205,8 @@ class AVH_EC_Admin
|
|
207 |
public function actionLoadPageHook_Overview()
|
208 |
{
|
209 |
// Add metaboxes
|
210 |
-
add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(
|
211 |
-
add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(
|
212 |
|
213 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
214 |
|
@@ -234,8 +232,8 @@ class AVH_EC_Admin
|
|
234 |
global $screen_layout_columns;
|
235 |
|
236 |
// This box can't be unselectd in the the Screen Options
|
237 |
-
// add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array (
|
238 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(
|
239 |
|
240 |
$hide2 = '';
|
241 |
switch ($screen_layout_columns) {
|
@@ -275,7 +273,7 @@ class AVH_EC_Admin
|
|
275 |
public function actionLoadPageHook_General()
|
276 |
{
|
277 |
// Add metaboxes
|
278 |
-
add_meta_box('avhecBoxOptions', __('Options', 'avh-ec'), array(
|
279 |
|
280 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
281 |
|
@@ -297,7 +295,7 @@ class AVH_EC_Admin
|
|
297 |
{
|
298 |
global $screen_layout_columns;
|
299 |
|
300 |
-
$groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' =>
|
301 |
foreach ($groups as $group) {
|
302 |
$group_id[] = $group->term_id;
|
303 |
$groupname[] = $group->name;
|
@@ -365,7 +363,7 @@ class AVH_EC_Admin
|
|
365 |
$data['actual_options'] = $actual_options;
|
366 |
|
367 |
// This box can't be unselectd in the the Screen Options
|
368 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(
|
369 |
|
370 |
$hide2 = '';
|
371 |
switch ($screen_layout_columns) {
|
@@ -420,9 +418,9 @@ class AVH_EC_Admin
|
|
420 |
{
|
421 |
|
422 |
// Add metaboxes
|
423 |
-
add_meta_box('avhecBoxCategoryGroupAdd', __('Add Group', 'avh-ec'), array(
|
424 |
-
add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(
|
425 |
-
add_meta_box('avhecBoxCategoryGroupSpecialPages', __('Special Pages', 'avh-ec'), array(
|
426 |
|
427 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
428 |
|
@@ -502,7 +500,7 @@ class AVH_EC_Admin
|
|
502 |
$data_edit_group['edit'] = array('group_id' => $group_id, 'name' => $group->name, 'slug' => $group->slug, 'widget_title' => $widget_title, 'description' => $group->description, 'categories' => $cats);
|
503 |
$data['edit'] = array('form' => $options_edit_group, 'data' => $data_edit_group);
|
504 |
|
505 |
-
add_meta_box('avhecBoxCategoryGroupEdit', __('Edit Group', 'avh-ec') . ': ' . $group->name, array(
|
506 |
break;
|
507 |
case 'delete':
|
508 |
if (!isset($_GET['group_ID'])) {
|
@@ -574,7 +572,7 @@ class AVH_EC_Admin
|
|
574 |
$this->core->saveOptions($this->core->options);
|
575 |
}
|
576 |
$data_special_pages['sp'] = $data_special_pages_new;
|
577 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' =>
|
578 |
|
579 |
foreach ($cat_groups as $group) {
|
580 |
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
@@ -592,7 +590,7 @@ class AVH_EC_Admin
|
|
592 |
$data['sp'] = array('form' => $options_special_pages, 'data' => $data_special_pages);
|
593 |
|
594 |
// This box can't be unselectd in the the Screen Options
|
595 |
-
// add_meta_box( 'avhecBoxDonations', __( 'Donations', 'avh-ec' ), array (
|
596 |
|
597 |
echo '<div class="wrap avhec-metabox-wrap">';
|
598 |
echo $this->displayIcon('index');
|
@@ -700,7 +698,7 @@ class AVH_EC_Admin
|
|
700 |
*/
|
701 |
public function actionLoadPageHook_ManualOrder()
|
702 |
{
|
703 |
-
add_meta_box('avhecBoxManualOrder', __('Manually Order Categories', 'avh-ec'), array(
|
704 |
|
705 |
add_screen_option('layout_columns', array('max' => 1, 'default' => 1));
|
706 |
|
@@ -752,8 +750,6 @@ class AVH_EC_Admin
|
|
752 |
}
|
753 |
|
754 |
/**
|
755 |
-
*
|
756 |
-
*
|
757 |
* Displays the Manual Order metabox.
|
758 |
*
|
759 |
* @author Andrew Charlton - original
|
@@ -819,9 +815,9 @@ class AVH_EC_Admin
|
|
819 |
echo '</span>';
|
820 |
echo '<ul id="avhecManualOrder">';
|
821 |
$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));
|
822 |
-
foreach ($results as $row)
|
823 |
echo "<li id='id_$row->term_id' class='lineitem menu-item-settings'>" . __($row->name) . "</li>";
|
824 |
-
|
825 |
echo '</ul>';
|
826 |
echo '<input type="submit" name="btnOrderCats" id="btnOrderCats" class="button-primary" value="' . __('Save Order', 'avh-ec') . '" onclick="javascript:orderCats(); return true;" />';
|
827 |
|
@@ -854,8 +850,8 @@ class AVH_EC_Admin
|
|
854 |
*/
|
855 |
public function actionLoadPageHook_faq()
|
856 |
{
|
857 |
-
add_meta_box('avhecBoxFAQ', __('F.A.Q.', 'avh-ec'), array(
|
858 |
-
add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(
|
859 |
|
860 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
861 |
|
@@ -878,8 +874,8 @@ class AVH_EC_Admin
|
|
878 |
global $screen_layout_columns;
|
879 |
|
880 |
// This box can't be unselectd in the the Screen Options
|
881 |
-
// add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array (
|
882 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(
|
883 |
|
884 |
$hide2 = '';
|
885 |
switch ($screen_layout_columns) {
|
@@ -1122,8 +1118,8 @@ class AVH_EC_Admin
|
|
1122 |
/**
|
1123 |
* When not using AJAX, this function is called when the deletion fails.
|
1124 |
*
|
1125 |
-
* @param
|
1126 |
-
* @param
|
1127 |
* @return string @WordPress Filter explain_nonce_$verb-$noun
|
1128 |
* @see wp_explain_nonce
|
1129 |
*/
|
@@ -1150,10 +1146,11 @@ class AVH_EC_Admin
|
|
1150 |
$page = preg_replace('[^a-zA-Z0-9\.\_\-]', '', $_GET['page']);
|
1151 |
}
|
1152 |
|
1153 |
-
if (function_exists("admin_url"))
|
1154 |
return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
|
1155 |
-
else
|
1156 |
return $_SERVER['PHP_SELF'] . "?page=" . $page;
|
|
|
1157 |
}
|
1158 |
|
1159 |
/**
|
@@ -1164,7 +1161,7 @@ class AVH_EC_Admin
|
|
1164 |
*/
|
1165 |
public function printCategoryGroupRows()
|
1166 |
{
|
1167 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' =>
|
1168 |
|
1169 |
foreach ($cat_groups as $group) {
|
1170 |
if ('none' != $group->slug) {
|
@@ -1226,8 +1223,9 @@ class AVH_EC_Admin
|
|
1226 |
$class = 'class="' . $column_name . ' column-' . $column_name . '"';
|
1227 |
|
1228 |
$style = '';
|
1229 |
-
if (in_array($column_name, $hidden))
|
1230 |
$style = ' style="display:none;"';
|
|
|
1231 |
|
1232 |
$attributes = $class . $style;
|
1233 |
|
@@ -1342,7 +1340,7 @@ class AVH_EC_Admin
|
|
1342 |
/**
|
1343 |
* Ouput formatted options
|
1344 |
*
|
1345 |
-
* @param
|
1346 |
* @return string
|
1347 |
*/
|
1348 |
public function printOptions($option_data, $option_actual)
|
@@ -1416,8 +1414,8 @@ class AVH_EC_Admin
|
|
1416 |
/**
|
1417 |
* Used in forms to set an option checked
|
1418 |
*
|
1419 |
-
* @param
|
1420 |
-
* @param
|
1421 |
* @return strings
|
1422 |
*/
|
1423 |
public function isChecked($checked, $current)
|
29 |
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
30 |
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
31 |
|
32 |
+
add_action('wp_ajax_delete-group', array($this, 'ajaxDeleteGroup'));
|
33 |
|
34 |
// Admin menu
|
35 |
+
add_action('admin_init', array($this, 'actionAdminInit'));
|
36 |
+
add_action('admin_menu', array($this, 'actionAdminMenu'));
|
37 |
+
add_filter('plugin_action_links_extended-categories-widget/widget_extended_categories.php', array($this, 'filterPluginActions'), 10, 2);
|
38 |
|
39 |
// Actions used for editing posts
|
40 |
+
add_action('load-post.php', array($this, 'actionLoadPostPage'));
|
41 |
+
add_action('load-page.php', array($this, 'actionLoadPostPage'));
|
42 |
|
43 |
// Actions related to adding and deletes categories
|
44 |
add_action("created_category", array($this, 'actionCreatedCategory'), 10, 2);
|
45 |
add_action("delete_category", array($this, 'actionDeleteCategory'), 10, 2);
|
46 |
|
47 |
+
add_filter('manage_categories_group_columns', array($this, 'filterManageCategoriesGroupColumns'));
|
48 |
+
add_filter('explain_nonce_delete-avhecgroup', array($this, 'filterExplainNonceDeleteGroup'), 10, 2);
|
49 |
|
50 |
return;
|
51 |
}
|
53 |
public function actionAdminInit()
|
54 |
{
|
55 |
if (is_admin() && isset($_GET['taxonomy']) && 'category' == $_GET['taxonomy']) {
|
56 |
+
add_action($_GET['taxonomy'] . '_edit_form', array($this, 'displayCategoryGroupForm'), 10, 2);
|
57 |
}
|
58 |
+
add_action('edit_term', array($this, 'handleEditTerm'), 10, 3);
|
59 |
}
|
60 |
|
61 |
/**
|
|
|
|
|
62 |
* Adds Category Group form
|
63 |
* @WordPress action category_edit_form
|
64 |
*
|
79 |
$current_selection = $current_group->term_id;
|
80 |
}
|
81 |
|
82 |
+
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' => false));
|
83 |
foreach ($cat_groups as $group) {
|
84 |
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
85 |
$dropdown_value[] = $group->term_id;
|
86 |
$dropdown_text[] = $temp_cat->name;
|
87 |
}
|
88 |
|
89 |
+
$seldata = '';
|
90 |
foreach ($dropdown_value as $key => $sel) {
|
91 |
$seldata .= '<option value="' . esc_attr($sel) . '" ' . (($current_selection == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($dropdown_text[$key])) . '</option>' . "\n";
|
92 |
}
|
143 |
* When a category is deleted this function is called so the category is deleted from every group as well.
|
144 |
*
|
145 |
* @param object $term
|
146 |
+
* @param int $term_taxonomy_id
|
147 |
*/
|
148 |
public function actionDeleteCategory($term_id, $term_taxonomy_id)
|
149 |
{
|
175 |
|
176 |
// Add menu system
|
177 |
$folder = $this->core->getBaseDirectory(AVHEC_PLUGIN_DIR);
|
178 |
+
add_menu_page('AVH Extended Categories', 'AVH Extended Categories', 'manage_options', $folder, array($this, 'doMenuOverview'));
|
179 |
+
$this->hooks['menu_overview'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Overview', 'avh-ec'), __('Overview', 'avh-ec'), 'manage_options', $folder, array($this, 'doMenuOverview'));
|
180 |
+
$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'));
|
181 |
+
$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'));
|
182 |
+
$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'));
|
183 |
+
$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'));
|
184 |
|
185 |
// Add actions for menu pages
|
186 |
// Overview Menu
|
187 |
+
add_action('load-' . $this->hooks['menu_overview'], array($this, 'actionLoadPageHook_Overview'));
|
188 |
|
189 |
// General Options Menu
|
190 |
+
add_action('load-' . $this->hooks['menu_general'], array($this, 'actionLoadPageHook_General'));
|
191 |
|
192 |
// Category Groups Menu
|
193 |
+
add_action('load-' . $this->hooks['menu_category_groups'], array($this, 'actionLoadPageHook_CategoryGroup'));
|
194 |
|
195 |
// Manual Order Menu
|
196 |
+
add_action('load-' . $this->hooks['menu_manual_order'], array($this, 'actionLoadPageHook_ManualOrder'));
|
197 |
|
198 |
// FAQ Menu
|
199 |
+
add_action('load-' . $this->hooks['menu_faq'], array($this, 'actionLoadPageHook_faq'));
|
200 |
}
|
201 |
|
202 |
/**
|
205 |
public function actionLoadPageHook_Overview()
|
206 |
{
|
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_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
212 |
|
232 |
global $screen_layout_columns;
|
233 |
|
234 |
// This box can't be unselectd in the the Screen Options
|
235 |
+
// add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array ( $this, 'metaboxAnnouncements' ), $this->hooks['menu_overview'], 'side', '');
|
236 |
+
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array($this, 'metaboxDonations'), $this->hooks['menu_overview'], 'side', '');
|
237 |
|
238 |
$hide2 = '';
|
239 |
switch ($screen_layout_columns) {
|
273 |
public function actionLoadPageHook_General()
|
274 |
{
|
275 |
// Add metaboxes
|
276 |
+
add_meta_box('avhecBoxOptions', __('Options', 'avh-ec'), array($this, 'metaboxOptions'), $this->hooks['menu_general'], 'normal', 'core');
|
277 |
|
278 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
279 |
|
295 |
{
|
296 |
global $screen_layout_columns;
|
297 |
|
298 |
+
$groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' => false));
|
299 |
foreach ($groups as $group) {
|
300 |
$group_id[] = $group->term_id;
|
301 |
$groupname[] = $group->name;
|
363 |
$data['actual_options'] = $actual_options;
|
364 |
|
365 |
// This box can't be unselectd in the the Screen Options
|
366 |
+
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array($this, 'metaboxDonations'), $this->hooks['menu_general'], 'side', 'core');
|
367 |
|
368 |
$hide2 = '';
|
369 |
switch ($screen_layout_columns) {
|
418 |
{
|
419 |
|
420 |
// Add metaboxes
|
421 |
+
add_meta_box('avhecBoxCategoryGroupAdd', __('Add Group', 'avh-ec'), array($this, 'metaboxCategoryGroupAdd'), $this->hooks['menu_category_groups'], 'normal', 'core');
|
422 |
+
add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array($this, 'metaboxCategoryGroupList'), $this->hooks['menu_category_groups'], 'side', 'core');
|
423 |
+
add_meta_box('avhecBoxCategoryGroupSpecialPages', __('Special Pages', 'avh-ec'), array($this, 'metaboxCategoryGroupSpecialPages'), $this->hooks['menu_category_groups'], 'normal', 'core');
|
424 |
|
425 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
426 |
|
500 |
$data_edit_group['edit'] = array('group_id' => $group_id, 'name' => $group->name, 'slug' => $group->slug, 'widget_title' => $widget_title, 'description' => $group->description, 'categories' => $cats);
|
501 |
$data['edit'] = array('form' => $options_edit_group, 'data' => $data_edit_group);
|
502 |
|
503 |
+
add_meta_box('avhecBoxCategoryGroupEdit', __('Edit Group', 'avh-ec') . ': ' . $group->name, array($this, 'metaboxCategoryGroupEdit'), $this->hooks['menu_category_groups'], 'normal', 'low');
|
504 |
break;
|
505 |
case 'delete':
|
506 |
if (!isset($_GET['group_ID'])) {
|
572 |
$this->core->saveOptions($this->core->options);
|
573 |
}
|
574 |
$data_special_pages['sp'] = $data_special_pages_new;
|
575 |
+
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' => false));
|
576 |
|
577 |
foreach ($cat_groups as $group) {
|
578 |
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
590 |
$data['sp'] = array('form' => $options_special_pages, 'data' => $data_special_pages);
|
591 |
|
592 |
// This box can't be unselectd in the the Screen Options
|
593 |
+
// add_meta_box( 'avhecBoxDonations', __( 'Donations', 'avh-ec' ), array ($this, 'metaboxDonations' ), $this->hooks['menu_category_groups'], 'side', 'core' );
|
594 |
|
595 |
echo '<div class="wrap avhec-metabox-wrap">';
|
596 |
echo $this->displayIcon('index');
|
698 |
*/
|
699 |
public function actionLoadPageHook_ManualOrder()
|
700 |
{
|
701 |
+
add_meta_box('avhecBoxManualOrder', __('Manually Order Categories', 'avh-ec'), array($this, 'metaboxManualOrder'), $this->hooks['menu_manual_order'], 'normal', 'core');
|
702 |
|
703 |
add_screen_option('layout_columns', array('max' => 1, 'default' => 1));
|
704 |
|
750 |
}
|
751 |
|
752 |
/**
|
|
|
|
|
753 |
* Displays the Manual Order metabox.
|
754 |
*
|
755 |
* @author Andrew Charlton - original
|
815 |
echo '</span>';
|
816 |
echo '<ul id="avhecManualOrder">';
|
817 |
$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));
|
818 |
+
foreach ($results as $row) {
|
819 |
echo "<li id='id_$row->term_id' class='lineitem menu-item-settings'>" . __($row->name) . "</li>";
|
820 |
+
}
|
821 |
echo '</ul>';
|
822 |
echo '<input type="submit" name="btnOrderCats" id="btnOrderCats" class="button-primary" value="' . __('Save Order', 'avh-ec') . '" onclick="javascript:orderCats(); return true;" />';
|
823 |
|
850 |
*/
|
851 |
public function actionLoadPageHook_faq()
|
852 |
{
|
853 |
+
add_meta_box('avhecBoxFAQ', __('F.A.Q.', 'avh-ec'), array($this, 'metaboxFAQ'), $this->hooks['menu_faq'], 'normal', 'core');
|
854 |
+
add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array($this, 'metaboxTranslation'), $this->hooks['menu_faq'], 'normal', 'core');
|
855 |
|
856 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
|
857 |
|
874 |
global $screen_layout_columns;
|
875 |
|
876 |
// This box can't be unselectd in the the Screen Options
|
877 |
+
// add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array ( $this, 'metaboxAnnouncements' ), $this->hooks['menu_faq'], 'side', 'core');
|
878 |
+
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array($this, 'metaboxDonations'), $this->hooks['menu_faq'], 'side', 'core');
|
879 |
|
880 |
$hide2 = '';
|
881 |
switch ($screen_layout_columns) {
|
1118 |
/**
|
1119 |
* When not using AJAX, this function is called when the deletion fails.
|
1120 |
*
|
1121 |
+
* @param string $text
|
1122 |
+
* @param int $group_id
|
1123 |
* @return string @WordPress Filter explain_nonce_$verb-$noun
|
1124 |
* @see wp_explain_nonce
|
1125 |
*/
|
1146 |
$page = preg_replace('[^a-zA-Z0-9\.\_\-]', '', $_GET['page']);
|
1147 |
}
|
1148 |
|
1149 |
+
if (function_exists("admin_url")) {
|
1150 |
return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
|
1151 |
+
} else {
|
1152 |
return $_SERVER['PHP_SELF'] . "?page=" . $page;
|
1153 |
+
}
|
1154 |
}
|
1155 |
|
1156 |
/**
|
1161 |
*/
|
1162 |
public function printCategoryGroupRows()
|
1163 |
{
|
1164 |
+
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty' => false));
|
1165 |
|
1166 |
foreach ($cat_groups as $group) {
|
1167 |
if ('none' != $group->slug) {
|
1223 |
$class = 'class="' . $column_name . ' column-' . $column_name . '"';
|
1224 |
|
1225 |
$style = '';
|
1226 |
+
if (in_array($column_name, $hidden)) {
|
1227 |
$style = ' style="display:none;"';
|
1228 |
+
}
|
1229 |
|
1230 |
$attributes = $class . $style;
|
1231 |
|
1340 |
/**
|
1341 |
* Ouput formatted options
|
1342 |
*
|
1343 |
+
* @param array $option_data
|
1344 |
* @return string
|
1345 |
*/
|
1346 |
public function printOptions($option_data, $option_actual)
|
1414 |
/**
|
1415 |
* Used in forms to set an option checked
|
1416 |
*
|
1417 |
+
* @param mixed $checked
|
1418 |
+
* @param mixed $current
|
1419 |
* @return strings
|
1420 |
*/
|
1421 |
public function isChecked($checked, $current)
|
3.6/class/avh-ec.category-group.php
CHANGED
@@ -29,7 +29,7 @@ class AVH_EC_Category_Group
|
|
29 |
{
|
30 |
global $wpdb;
|
31 |
|
32 |
-
register_shutdown_function(array(
|
33 |
|
34 |
/**
|
35 |
* Taxonomy name
|
@@ -46,12 +46,12 @@ class AVH_EC_Category_Group
|
|
46 |
* Create the table if it doesn't exist.
|
47 |
*/
|
48 |
if ($wpdb->get_var('show tables like \'' . $wpdb->avhec_cat_group . '\'') != $wpdb->avhec_cat_group) {
|
49 |
-
add_action('init', array(
|
50 |
}
|
51 |
-
add_action('init', array(
|
52 |
-
add_action('init', array(
|
53 |
|
54 |
-
add_action('admin_init', array(
|
55 |
}
|
56 |
|
57 |
/**
|
@@ -82,7 +82,7 @@ class AVH_EC_Category_Group
|
|
82 |
$charset_collate .= ' COLLATE ' . $wpdb->collate;
|
83 |
}
|
84 |
|
85 |
-
$sql = 'CREATE TABLE `' . $wpdb->avhec_cat_group . '` ( `group_term_id` BIGINT(20) UNSIGNED NOT
|
86 |
|
87 |
$result = $wpdb->query($sql);
|
88 |
}
|
@@ -100,7 +100,7 @@ class AVH_EC_Category_Group
|
|
100 |
*/
|
101 |
$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'));
|
102 |
$caps = array('manage_terms' => null, 'edit_terms' => null, 'delete_terms' => null, 'assign_terms' => 'edit_posts');
|
103 |
-
register_taxonomy($this->taxonomy_name, array('post', 'page'), array('hierarchical' =>
|
104 |
}
|
105 |
|
106 |
/**
|
@@ -168,7 +168,7 @@ class AVH_EC_Category_Group
|
|
168 |
*
|
169 |
* @param int $group_id
|
170 |
* The Taxonomy Term ID
|
171 |
-
* @return Array
|
172 |
*
|
173 |
*/
|
174 |
public function getCategoriesFromGroup($group_id)
|
@@ -245,7 +245,7 @@ class AVH_EC_Category_Group
|
|
245 |
/**
|
246 |
* Set the Widget Title for a Group
|
247 |
*
|
248 |
-
* @param int
|
249 |
* @param string $widget_title
|
250 |
*
|
251 |
*/
|
@@ -288,9 +288,9 @@ class AVH_EC_Category_Group
|
|
288 |
/**
|
289 |
* Same as get_term_by, but returns the ID only if found, else false
|
290 |
*
|
291 |
-
* @param
|
292 |
-
* @param
|
293 |
-
* @return int
|
294 |
*/
|
295 |
public function getTermIDBy($field, $value)
|
296 |
{
|
@@ -309,7 +309,7 @@ class AVH_EC_Category_Group
|
|
309 |
*
|
310 |
* @param
|
311 |
* $group_id
|
312 |
-
* @return Object
|
313 |
*/
|
314 |
public function getGroup($group_id)
|
315 |
{
|
@@ -326,7 +326,7 @@ class AVH_EC_Category_Group
|
|
326 |
public 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' =>
|
330 |
|
331 |
foreach ($cat_groups as $group) {
|
332 |
$cats = $this->getCategoriesFromGroup($group->term_id);
|
@@ -382,7 +382,7 @@ class AVH_EC_Category_Group
|
|
382 |
* @param $widget_title return
|
383 |
* -1,0,1 Unknown Group, Duplicate Slug, Succesfull
|
384 |
*/
|
385 |
-
public function doUpdateGroup($group_id, $args = array(), $selected_categories, $widget_title = '')
|
386 |
{
|
387 |
$group = $this->getGroup($group_id);
|
388 |
if (is_object($group)) {
|
29 |
{
|
30 |
global $wpdb;
|
31 |
|
32 |
+
register_shutdown_function(array($this, '__destruct'));
|
33 |
|
34 |
/**
|
35 |
* Taxonomy name
|
46 |
* Create the table if it doesn't exist.
|
47 |
*/
|
48 |
if ($wpdb->get_var('show tables like \'' . $wpdb->avhec_cat_group . '\'') != $wpdb->avhec_cat_group) {
|
49 |
+
add_action('init', array($this, 'doCreateTable'), 2); // Priority needs to be the same as the Register Taxonomy
|
50 |
}
|
51 |
+
add_action('init', array($this, 'doRegisterTaxonomy'), 2); // Priority for registering custom taxonomies is +1 over the creation of the initial taxonomies
|
52 |
+
add_action('init', array($this, 'doSetupOptions'));
|
53 |
|
54 |
+
add_action('admin_init', array($this, 'addMetaBoxes'));
|
55 |
}
|
56 |
|
57 |
/**
|
82 |
$charset_collate .= ' COLLATE ' . $wpdb->collate;
|
83 |
}
|
84 |
|
85 |
+
$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 . ';';
|
86 |
|
87 |
$result = $wpdb->query($sql);
|
88 |
}
|
100 |
*/
|
101 |
$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'));
|
102 |
$caps = array('manage_terms' => null, 'edit_terms' => null, 'delete_terms' => null, 'assign_terms' => 'edit_posts');
|
103 |
+
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));
|
104 |
}
|
105 |
|
106 |
/**
|
168 |
*
|
169 |
* @param int $group_id
|
170 |
* The Taxonomy Term ID
|
171 |
+
* @return Array false Will return false, if the row does not exists.
|
172 |
*
|
173 |
*/
|
174 |
public function getCategoriesFromGroup($group_id)
|
245 |
/**
|
246 |
* Set the Widget Title for a Group
|
247 |
*
|
248 |
+
* @param int $group_id
|
249 |
* @param string $widget_title
|
250 |
*
|
251 |
*/
|
288 |
/**
|
289 |
* Same as get_term_by, but returns the ID only if found, else false
|
290 |
*
|
291 |
+
* @param string $field
|
292 |
+
* @param string $value
|
293 |
+
* @return int boolean
|
294 |
*/
|
295 |
public function getTermIDBy($field, $value)
|
296 |
{
|
309 |
*
|
310 |
* @param
|
311 |
* $group_id
|
312 |
+
* @return Object false false when the group doesn't exists.
|
313 |
*/
|
314 |
public function getGroup($group_id)
|
315 |
{
|
326 |
public 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);
|
382 |
* @param $widget_title return
|
383 |
* -1,0,1 Unknown Group, Duplicate Slug, Succesfull
|
384 |
*/
|
385 |
+
public function doUpdateGroup($group_id, $args = array(), $selected_categories = array(), $widget_title = '')
|
386 |
{
|
387 |
$group = $this->getGroup($group_id);
|
388 |
if (is_object($group)) {
|
3.6/class/avh-ec.core.php
CHANGED
@@ -34,12 +34,12 @@ class AVH_EC_Core
|
|
34 |
*/
|
35 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
36 |
|
37 |
-
$this->version = '3.8.
|
38 |
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
39 |
$this->db_options_core = 'avhec';
|
40 |
$this->db_options_tax_meta = 'avhec-tax_meta';
|
41 |
|
42 |
-
add_action('init', array(
|
43 |
}
|
44 |
|
45 |
public function handleInitializePlugin()
|
@@ -81,11 +81,11 @@ class AVH_EC_Core
|
|
81 |
|
82 |
$db = new AVH_DB();
|
83 |
if (!$db->field_exists('avhec_term_order', $wpdb->terms)) {
|
84 |
-
$wpdb->query("ALTER TABLE $wpdb->terms ADD `avhec_term_order` INT( 4 )
|
85 |
}
|
86 |
|
87 |
$this->handleTextdomain();
|
88 |
-
add_filter('get_terms_orderby', array(
|
89 |
}
|
90 |
|
91 |
public function applyOrderFilter($orderby, $args)
|
@@ -107,10 +107,6 @@ class AVH_EC_Core
|
|
107 |
|
108 |
/**
|
109 |
* Loads the i18n
|
110 |
-
*
|
111 |
-
* @return
|
112 |
-
*
|
113 |
-
*
|
114 |
*/
|
115 |
public function handleTextdomain()
|
116 |
{
|
@@ -163,8 +159,8 @@ class AVH_EC_Core
|
|
163 |
/**
|
164 |
* Used in forms to set the checked option.
|
165 |
*
|
166 |
-
* @param
|
167 |
-
* @param
|
168 |
* @return string
|
169 |
*
|
170 |
* @since 2.0
|
@@ -181,8 +177,8 @@ class AVH_EC_Core
|
|
181 |
/**
|
182 |
* Used in forms to set the SELECTED option
|
183 |
*
|
184 |
-
* @param
|
185 |
-
* @param
|
186 |
* @return string
|
187 |
*/
|
188 |
public function isSelected($current, $field)
|
@@ -197,14 +193,14 @@ class AVH_EC_Core
|
|
197 |
/**
|
198 |
* Get the base directory of a directory structure
|
199 |
*
|
200 |
-
* @param
|
201 |
* @return string
|
202 |
*
|
203 |
*/
|
204 |
public function getBaseDirectory($directory)
|
205 |
{
|
206 |
// place each directory into array and get the last element
|
207 |
-
$directory_array = explode('/', directory);
|
208 |
// get highest or top level in array of directory strings
|
209 |
$public_base = end($directory_array);
|
210 |
|
@@ -266,8 +262,8 @@ class AVH_EC_Core
|
|
266 |
* Get the value for an option element.
|
267 |
* If there's no option is set on the Admin page, return the default value.
|
268 |
*
|
269 |
-
* @param
|
270 |
-
* @param
|
271 |
* @return mixed
|
272 |
*/
|
273 |
public function getOptionElement($option, $key)
|
@@ -324,7 +320,7 @@ class AVH_EC_Core
|
|
324 |
* Optional. Override default arguments.
|
325 |
* @return string HTML content only if 'echo' argument is 0.
|
326 |
*/
|
327 |
-
public function avh_wp_dropdown_categories($args =
|
328 |
{
|
329 |
$mywalker = new AVH_Walker_CategoryDropdown();
|
330 |
|
@@ -343,18 +339,20 @@ class AVH_EC_Core
|
|
343 |
extract($r);
|
344 |
|
345 |
$tab_index_attribute = '';
|
346 |
-
if ((int) $tab_index > 0)
|
347 |
$tab_index_attribute = ' tabindex="' . $tab_index . '"';
|
|
|
348 |
|
349 |
$categories = get_terms($taxonomy, $r);
|
350 |
$name = esc_attr($name);
|
351 |
$class = esc_attr($class);
|
352 |
$id = $id ? esc_attr($id) : $name;
|
353 |
|
354 |
-
if (!$r['hide_if_empty'] || !empty($categories))
|
355 |
$output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n";
|
356 |
-
else
|
357 |
$output = '';
|
|
|
358 |
|
359 |
if (empty($categories) && !$r['hide_if_empty'] && !empty($show_option_none)) {
|
360 |
$show_option_none = apply_filters('list_cats', $show_option_none);
|
@@ -381,13 +379,15 @@ class AVH_EC_Core
|
|
381 |
}
|
382 |
$output .= walk_category_dropdown_tree($categories, $depth, $r);
|
383 |
}
|
384 |
-
if (!$r['hide_if_empty'] || !empty($categories))
|
385 |
$output .= "</select>\n";
|
|
|
386 |
|
387 |
$output = apply_filters('wp_dropdown_cats', $output);
|
388 |
|
389 |
-
if ($echo)
|
390 |
echo $output;
|
|
|
391 |
|
392 |
return $output;
|
393 |
}
|
@@ -426,7 +426,7 @@ class AVH_EC_Core
|
|
426 |
* Optional. Override default arguments.
|
427 |
* @return string HTML content only if 'echo' argument is 0.
|
428 |
*/
|
429 |
-
public function avh_wp_list_categories($args =
|
430 |
{
|
431 |
$mywalker = new AVHEC_Walker_Category();
|
432 |
$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);
|
@@ -455,25 +455,29 @@ class AVH_EC_Core
|
|
455 |
$categories = get_categories($r);
|
456 |
|
457 |
$output = '';
|
458 |
-
if ($title_li && 'list' == $style)
|
459 |
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
|
|
460 |
|
461 |
if (empty($categories)) {
|
462 |
-
if ('list' == $style)
|
463 |
$output .= '<li>' . __("No categories") . '</li>';
|
464 |
-
else
|
465 |
$output .= __("No categories");
|
|
|
466 |
} else {
|
467 |
global $wp_query;
|
468 |
|
469 |
-
if (!empty($show_option_all))
|
470 |
-
if ('list' == $style)
|
471 |
$output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
|
472 |
-
else
|
473 |
$output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
|
474 |
-
|
475 |
-
|
|
|
476 |
$r['current_category'] = $wp_query->get_queried_object_id();
|
|
|
477 |
|
478 |
if ($hierarchical) {
|
479 |
$depth = $r['depth'];
|
@@ -484,21 +488,23 @@ class AVH_EC_Core
|
|
484 |
$output .= walk_category_tree($categories, $depth, $r);
|
485 |
}
|
486 |
|
487 |
-
if ($title_li && 'list' == $style)
|
488 |
$output .= '</ul></li>';
|
|
|
489 |
|
490 |
$output = apply_filters('wp_list_categories', $output);
|
491 |
|
492 |
-
if ($echo)
|
493 |
echo $output;
|
494 |
-
else
|
495 |
return $output;
|
|
|
496 |
}
|
497 |
|
498 |
public function getCategories()
|
499 |
{
|
500 |
-
static $_categories =
|
501 |
-
if (
|
502 |
$_categories = get_categories('get=all');
|
503 |
}
|
504 |
|
@@ -507,8 +513,8 @@ class AVH_EC_Core
|
|
507 |
|
508 |
public function getCategoriesId($categories)
|
509 |
{
|
510 |
-
static $_categories_id =
|
511 |
-
if (
|
512 |
foreach ($categories as $key => $category) {
|
513 |
$_categories_id[$category->term_id] = $key;
|
514 |
}
|
@@ -531,11 +537,13 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
|
|
531 |
$args = array_slice(func_get_args(), 2);
|
532 |
$output = '';
|
533 |
|
534 |
-
if ($max_depth < -1)
|
535 |
return $output;
|
|
|
536 |
|
537 |
-
if (empty($elements))
|
538 |
return $output;
|
|
|
539 |
|
540 |
$id_field = $this->db_fields['id'];
|
541 |
$parent_field = $this->db_fields['parent'];
|
@@ -543,8 +551,9 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
|
|
543 |
// flat display
|
544 |
if (-1 == $max_depth) {
|
545 |
$empty_array = array();
|
546 |
-
foreach ($elements as $e)
|
547 |
$this->display_element($e, $empty_array, 1, 0, $args, $output);
|
|
|
548 |
|
549 |
return $output;
|
550 |
}
|
@@ -555,10 +564,11 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
|
|
555 |
$top_level_elements = array();
|
556 |
$children_elements = array();
|
557 |
foreach ($elements as $e) {
|
558 |
-
if (0 == $e->$parent_field)
|
559 |
$top_level_elements[] = $e;
|
560 |
-
else
|
561 |
$children_elements[$e->$parent_field][] = $e;
|
|
|
562 |
}
|
563 |
|
564 |
/*
|
@@ -572,10 +582,11 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
|
|
572 |
$top_level_elements = array();
|
573 |
$children_elements = array();
|
574 |
foreach ($elements as $e) {
|
575 |
-
if ($root->$parent_field == $e->$parent_field)
|
576 |
$top_level_elements[] = $e;
|
577 |
-
else
|
578 |
$children_elements[$e->$parent_field][] = $e;
|
|
|
579 |
}
|
580 |
}
|
581 |
|
@@ -588,9 +599,11 @@ class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
|
|
588 |
*/
|
589 |
if ((0 == $max_depth) && count($children_elements) > 0) {
|
590 |
$empty_array = array();
|
591 |
-
foreach ($children_elements as $orphans)
|
592 |
-
foreach ($orphans as $op)
|
593 |
$this->display_element($op, $empty_array, 1, 0, $args, $output);
|
|
|
|
|
594 |
}
|
595 |
|
596 |
return $output;
|
@@ -636,8 +649,9 @@ class AVHEC_Walker_Category extends Walker
|
|
636 |
*/
|
637 |
public function start_lvl(&$output, $depth = 0, $args = array())
|
638 |
{
|
639 |
-
if ('list' != $args['style'])
|
640 |
return;
|
|
|
641 |
|
642 |
$indent = str_repeat("\t", $depth);
|
643 |
$output .= $indent . '<ul class="children">' . "\n";
|
@@ -657,8 +671,9 @@ class AVHEC_Walker_Category extends Walker
|
|
657 |
*/
|
658 |
public function end_lvl(&$output, $depth = 0, $args = array())
|
659 |
{
|
660 |
-
if ('list' != $args['style'])
|
661 |
return;
|
|
|
662 |
|
663 |
$indent = str_repeat("\t", $depth);
|
664 |
$output .= $indent . '</ul>' . "\n";
|
@@ -684,24 +699,26 @@ class AVHEC_Walker_Category extends Walker
|
|
684 |
$cat_name = esc_attr($object->name);
|
685 |
$cat_name = apply_filters('list_cats', $cat_name, $object);
|
686 |
$link = '<div class="avhec-widget-line"><a href="' . get_category_link($object->term_id) . '" ';
|
687 |
-
if ($use_desc_for_title == 0 || empty($object->description))
|
688 |
$link .= 'title="' . sprintf(__('View all posts filed under %s'), $cat_name) . '"';
|
689 |
-
else
|
690 |
$link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $object->description, $object))) . '"';
|
|
|
691 |
$link .= '>';
|
692 |
$link .= $cat_name . '</a>';
|
693 |
|
694 |
if ((!empty($feed_image)) || (!empty($feed))) {
|
695 |
$link .= '<div class="avhec-widget-rss"> ';
|
696 |
|
697 |
-
if (empty($feed_image))
|
698 |
$link .= '(';
|
|
|
699 |
|
700 |
$link .= '<a href="' . get_category_feed_link($object->term_id, $feed_type) . '"';
|
701 |
|
702 |
-
if (empty($feed))
|
703 |
$alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"';
|
704 |
-
else {
|
705 |
$title = ' title="' . $feed . '"';
|
706 |
$alt = ' alt="' . $feed . '"';
|
707 |
$name = $feed;
|
@@ -710,33 +727,38 @@ class AVHEC_Walker_Category extends Walker
|
|
710 |
|
711 |
$link .= '>';
|
712 |
|
713 |
-
if (empty($feed_image))
|
714 |
$link .= $name;
|
715 |
-
else
|
716 |
$link .= '<img src="' . $feed_image . '"' . $alt . $title . ' />';
|
|
|
717 |
$link .= '</a>';
|
718 |
-
if (empty($feed_image))
|
719 |
$link .= ')';
|
|
|
720 |
$link .= '</div>';
|
721 |
}
|
722 |
|
723 |
-
if (isset($show_count) && $show_count)
|
724 |
$link .= '<div class="avhec-widget-count"> (' . intval($object->count) . ')</div>';
|
|
|
725 |
|
726 |
if (isset($show_date) && $show_date) {
|
727 |
$link .= ' ' . gmdate('Y-m-d', $object->last_update_timestamp);
|
728 |
}
|
729 |
|
730 |
-
if (isset($current_category) && $current_category)
|
731 |
$_current_category = get_category($current_category);
|
|
|
732 |
|
733 |
if ('list' == $args['style']) {
|
734 |
$output .= "\t" . '<li';
|
735 |
$class = 'cat-item cat-item-' . $object->term_id;
|
736 |
-
if (isset($current_category) && $current_category && ($object->term_id == $current_category))
|
737 |
$class .= ' current-cat';
|
738 |
-
elseif (isset($_current_category) && $_current_category && ($object->term_id == $_current_category->parent))
|
739 |
$class .= ' current-cat-parent';
|
|
|
740 |
$output .= ' class="' . $class . '"';
|
741 |
$output .= '>' . $link . '</div>' . "\n";
|
742 |
} else {
|
@@ -760,8 +782,9 @@ class AVHEC_Walker_Category extends Walker
|
|
760 |
*/
|
761 |
public function end_el(&$output, $object, $depth = 0, $args = array())
|
762 |
{
|
763 |
-
if ('list' != $args['style'])
|
764 |
return;
|
|
|
765 |
|
766 |
$output .= '</li>' . "\n";
|
767 |
}
|
34 |
*/
|
35 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
36 |
|
37 |
+
$this->version = '3.8.3';
|
38 |
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
39 |
$this->db_options_core = 'avhec';
|
40 |
$this->db_options_tax_meta = 'avhec-tax_meta';
|
41 |
|
42 |
+
add_action('init', array($this, 'handleInitializePlugin'), 10);
|
43 |
}
|
44 |
|
45 |
public function handleInitializePlugin()
|
81 |
|
82 |
$db = new AVH_DB();
|
83 |
if (!$db->field_exists('avhec_term_order', $wpdb->terms)) {
|
84 |
+
$wpdb->query("ALTER TABLE $wpdb->terms ADD `avhec_term_order` INT( 4 ) null DEFAULT '0'");
|
85 |
}
|
86 |
|
87 |
$this->handleTextdomain();
|
88 |
+
add_filter('get_terms_orderby', array($this, 'applyOrderFilter'), 10, 2);
|
89 |
}
|
90 |
|
91 |
public function applyOrderFilter($orderby, $args)
|
107 |
|
108 |
/**
|
109 |
* Loads the i18n
|
|
|
|
|
|
|
|
|
110 |
*/
|
111 |
public function handleTextdomain()
|
112 |
{
|
159 |
/**
|
160 |
* Used in forms to set the checked option.
|
161 |
*
|
162 |
+
* @param mixed $checked
|
163 |
+
* @param mixed_type $current
|
164 |
* @return string
|
165 |
*
|
166 |
* @since 2.0
|
177 |
/**
|
178 |
* Used in forms to set the SELECTED option
|
179 |
*
|
180 |
+
* @param string $current
|
181 |
+
* @param string $field
|
182 |
* @return string
|
183 |
*/
|
184 |
public function isSelected($current, $field)
|
193 |
/**
|
194 |
* Get the base directory of a directory structure
|
195 |
*
|
196 |
+
* @param string $directory
|
197 |
* @return string
|
198 |
*
|
199 |
*/
|
200 |
public function getBaseDirectory($directory)
|
201 |
{
|
202 |
// place each directory into array and get the last element
|
203 |
+
$directory_array = explode('/', $directory);
|
204 |
// get highest or top level in array of directory strings
|
205 |
$public_base = end($directory_array);
|
206 |
|
262 |
* Get the value for an option element.
|
263 |
* If there's no option is set on the Admin page, return the default value.
|
264 |
*
|
265 |
+
* @param string $key
|
266 |
+
* @param string $option
|
267 |
* @return mixed
|
268 |
*/
|
269 |
public function getOptionElement($option, $key)
|
320 |
* Optional. Override default arguments.
|
321 |
* @return string HTML content only if 'echo' argument is 0.
|
322 |
*/
|
323 |
+
public function avh_wp_dropdown_categories($args = array(), $selectedonly = false)
|
324 |
{
|
325 |
$mywalker = new AVH_Walker_CategoryDropdown();
|
326 |
|
339 |
extract($r);
|
340 |
|
341 |
$tab_index_attribute = '';
|
342 |
+
if ((int) $tab_index > 0) {
|
343 |
$tab_index_attribute = ' tabindex="' . $tab_index . '"';
|
344 |
+
}
|
345 |
|
346 |
$categories = get_terms($taxonomy, $r);
|
347 |
$name = esc_attr($name);
|
348 |
$class = esc_attr($class);
|
349 |
$id = $id ? esc_attr($id) : $name;
|
350 |
|
351 |
+
if (!$r['hide_if_empty'] || !empty($categories)) {
|
352 |
$output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n";
|
353 |
+
} else {
|
354 |
$output = '';
|
355 |
+
}
|
356 |
|
357 |
if (empty($categories) && !$r['hide_if_empty'] && !empty($show_option_none)) {
|
358 |
$show_option_none = apply_filters('list_cats', $show_option_none);
|
379 |
}
|
380 |
$output .= walk_category_dropdown_tree($categories, $depth, $r);
|
381 |
}
|
382 |
+
if (!$r['hide_if_empty'] || !empty($categories)) {
|
383 |
$output .= "</select>\n";
|
384 |
+
}
|
385 |
|
386 |
$output = apply_filters('wp_dropdown_cats', $output);
|
387 |
|
388 |
+
if ($echo) {
|
389 |
echo $output;
|
390 |
+
}
|
391 |
|
392 |
return $output;
|
393 |
}
|
426 |
* Optional. Override default arguments.
|
427 |
* @return string HTML content only if 'echo' argument is 0.
|
428 |
*/
|
429 |
+
public function avh_wp_list_categories($args = array(), $selectedonly = false)
|
430 |
{
|
431 |
$mywalker = new AVHEC_Walker_Category();
|
432 |
$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);
|
455 |
$categories = get_categories($r);
|
456 |
|
457 |
$output = '';
|
458 |
+
if ($title_li && 'list' == $style) {
|
459 |
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
460 |
+
}
|
461 |
|
462 |
if (empty($categories)) {
|
463 |
+
if ('list' == $style) {
|
464 |
$output .= '<li>' . __("No categories") . '</li>';
|
465 |
+
} else {
|
466 |
$output .= __("No categories");
|
467 |
+
}
|
468 |
} else {
|
469 |
global $wp_query;
|
470 |
|
471 |
+
if (!empty($show_option_all)) {
|
472 |
+
if ('list' == $style) {
|
473 |
$output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
|
474 |
+
} else {
|
475 |
$output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
|
476 |
+
}
|
477 |
+
}
|
478 |
+
if (empty($r['current_category']) && is_category()) {
|
479 |
$r['current_category'] = $wp_query->get_queried_object_id();
|
480 |
+
}
|
481 |
|
482 |
if ($hierarchical) {
|
483 |
$depth = $r['depth'];
|
488 |
$output .= walk_category_tree($categories, $depth, $r);
|
489 |
}
|
490 |
|
491 |
+
if ($title_li && 'list' == $style) {
|
492 |
$output .= '</ul></li>';
|
493 |
+
}
|
494 |
|
495 |
$output = apply_filters('wp_list_categories', $output);
|
496 |
|
497 |
+
if ($echo) {
|
498 |
echo $output;
|
499 |
+
} else {
|
500 |
return $output;
|
501 |
+
}
|
502 |
}
|
503 |
|
504 |
public function getCategories()
|
505 |
{
|
506 |
+
static $_categories = null;
|
507 |
+
if (null === $_categories) {
|
508 |
$_categories = get_categories('get=all');
|
509 |
}
|
510 |
|
513 |
|
514 |
public function getCategoriesId($categories)
|
515 |
{
|
516 |
+
static $_categories_id = null;
|
517 |
+
if (null == $_categories_id) {
|
518 |
foreach ($categories as $key => $category) {
|
519 |
$_categories_id[$category->term_id] = $key;
|
520 |
}
|
537 |
$args = array_slice(func_get_args(), 2);
|
538 |
$output = '';
|
539 |
|
540 |
+
if ($max_depth < -1) {
|
541 |
return $output;
|
542 |
+
}
|
543 |
|
544 |
+
if (empty($elements)) {
|
545 |
return $output;
|
546 |
+
}
|
547 |
|
548 |
$id_field = $this->db_fields['id'];
|
549 |
$parent_field = $this->db_fields['parent'];
|
551 |
// flat display
|
552 |
if (-1 == $max_depth) {
|
553 |
$empty_array = array();
|
554 |
+
foreach ($elements as $e) {
|
555 |
$this->display_element($e, $empty_array, 1, 0, $args, $output);
|
556 |
+
}
|
557 |
|
558 |
return $output;
|
559 |
}
|
564 |
$top_level_elements = array();
|
565 |
$children_elements = array();
|
566 |
foreach ($elements as $e) {
|
567 |
+
if (0 == $e->$parent_field) {
|
568 |
$top_level_elements[] = $e;
|
569 |
+
} else {
|
570 |
$children_elements[$e->$parent_field][] = $e;
|
571 |
+
}
|
572 |
}
|
573 |
|
574 |
/*
|
582 |
$top_level_elements = array();
|
583 |
$children_elements = array();
|
584 |
foreach ($elements as $e) {
|
585 |
+
if ($root->$parent_field == $e->$parent_field) {
|
586 |
$top_level_elements[] = $e;
|
587 |
+
} else {
|
588 |
$children_elements[$e->$parent_field][] = $e;
|
589 |
+
}
|
590 |
}
|
591 |
}
|
592 |
|
599 |
*/
|
600 |
if ((0 == $max_depth) && count($children_elements) > 0) {
|
601 |
$empty_array = array();
|
602 |
+
foreach ($children_elements as $orphans) {
|
603 |
+
foreach ($orphans as $op) {
|
604 |
$this->display_element($op, $empty_array, 1, 0, $args, $output);
|
605 |
+
}
|
606 |
+
}
|
607 |
}
|
608 |
|
609 |
return $output;
|
649 |
*/
|
650 |
public function start_lvl(&$output, $depth = 0, $args = array())
|
651 |
{
|
652 |
+
if ('list' != $args['style']) {
|
653 |
return;
|
654 |
+
}
|
655 |
|
656 |
$indent = str_repeat("\t", $depth);
|
657 |
$output .= $indent . '<ul class="children">' . "\n";
|
671 |
*/
|
672 |
public function end_lvl(&$output, $depth = 0, $args = array())
|
673 |
{
|
674 |
+
if ('list' != $args['style']) {
|
675 |
return;
|
676 |
+
}
|
677 |
|
678 |
$indent = str_repeat("\t", $depth);
|
679 |
$output .= $indent . '</ul>' . "\n";
|
699 |
$cat_name = esc_attr($object->name);
|
700 |
$cat_name = apply_filters('list_cats', $cat_name, $object);
|
701 |
$link = '<div class="avhec-widget-line"><a href="' . get_category_link($object->term_id) . '" ';
|
702 |
+
if ($use_desc_for_title == 0 || empty($object->description)) {
|
703 |
$link .= 'title="' . sprintf(__('View all posts filed under %s'), $cat_name) . '"';
|
704 |
+
} else {
|
705 |
$link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $object->description, $object))) . '"';
|
706 |
+
}
|
707 |
$link .= '>';
|
708 |
$link .= $cat_name . '</a>';
|
709 |
|
710 |
if ((!empty($feed_image)) || (!empty($feed))) {
|
711 |
$link .= '<div class="avhec-widget-rss"> ';
|
712 |
|
713 |
+
if (empty($feed_image)) {
|
714 |
$link .= '(';
|
715 |
+
}
|
716 |
|
717 |
$link .= '<a href="' . get_category_feed_link($object->term_id, $feed_type) . '"';
|
718 |
|
719 |
+
if (empty($feed)) {
|
720 |
$alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"';
|
721 |
+
} else {
|
722 |
$title = ' title="' . $feed . '"';
|
723 |
$alt = ' alt="' . $feed . '"';
|
724 |
$name = $feed;
|
727 |
|
728 |
$link .= '>';
|
729 |
|
730 |
+
if (empty($feed_image)) {
|
731 |
$link .= $name;
|
732 |
+
} else {
|
733 |
$link .= '<img src="' . $feed_image . '"' . $alt . $title . ' />';
|
734 |
+
}
|
735 |
$link .= '</a>';
|
736 |
+
if (empty($feed_image)) {
|
737 |
$link .= ')';
|
738 |
+
}
|
739 |
$link .= '</div>';
|
740 |
}
|
741 |
|
742 |
+
if (isset($show_count) && $show_count) {
|
743 |
$link .= '<div class="avhec-widget-count"> (' . intval($object->count) . ')</div>';
|
744 |
+
}
|
745 |
|
746 |
if (isset($show_date) && $show_date) {
|
747 |
$link .= ' ' . gmdate('Y-m-d', $object->last_update_timestamp);
|
748 |
}
|
749 |
|
750 |
+
if (isset($current_category) && $current_category) {
|
751 |
$_current_category = get_category($current_category);
|
752 |
+
}
|
753 |
|
754 |
if ('list' == $args['style']) {
|
755 |
$output .= "\t" . '<li';
|
756 |
$class = 'cat-item cat-item-' . $object->term_id;
|
757 |
+
if (isset($current_category) && $current_category && ($object->term_id == $current_category)) {
|
758 |
$class .= ' current-cat';
|
759 |
+
} elseif (isset($_current_category) && $_current_category && ($object->term_id == $_current_category->parent)) {
|
760 |
$class .= ' current-cat-parent';
|
761 |
+
}
|
762 |
$output .= ' class="' . $class . '"';
|
763 |
$output .= '>' . $link . '</div>' . "\n";
|
764 |
} else {
|
782 |
*/
|
783 |
public function end_el(&$output, $object, $depth = 0, $args = array())
|
784 |
{
|
785 |
+
if ('list' != $args['style']) {
|
786 |
return;
|
787 |
+
}
|
788 |
|
789 |
$output .= '</li>' . "\n";
|
790 |
}
|
3.6/class/avh-ec.widgets.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Widget Class for displaying categories.
|
5 |
-
*
|
6 |
*/
|
7 |
class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
8 |
{
|
@@ -22,19 +22,19 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
22 |
|
23 |
// Convert the old option widget_extended_categories to widget_extended-categories
|
24 |
$old = get_option('widget_extended_categories');
|
25 |
-
if (!(
|
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(
|
33 |
}
|
34 |
|
35 |
public function actionWpPrintStyles()
|
36 |
{
|
37 |
-
if (!(
|
38 |
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
39 |
wp_enqueue_style('avhec-widget');
|
40 |
}
|
@@ -50,17 +50,17 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
50 |
{
|
51 |
extract($args);
|
52 |
|
53 |
-
$selectedonly = $instance['selectedonly']
|
54 |
-
$c = $instance['count']
|
55 |
-
$h = $instance['hierarchical']
|
56 |
-
$d = $instance['depth'] ? $instance['depth'] : 0;
|
57 |
-
$e = $instance['hide_empty']
|
58 |
-
$use_desc_for_title = $instance['use_desc_for_title']
|
59 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
60 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
61 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
62 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
63 |
-
$invert = $instance['invert_included']
|
64 |
|
65 |
if (empty($r)) {
|
66 |
$i = '';
|
@@ -126,32 +126,32 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
126 |
/**
|
127 |
* When Widget Control Form Is Posted
|
128 |
*
|
129 |
-
* @param
|
130 |
-
* @param
|
131 |
* @return unknown
|
132 |
*/
|
133 |
public function update($new_instance, $old_instance)
|
134 |
{
|
135 |
// update the instance's settings
|
136 |
if (!isset($new_instance['submit'])) {
|
137 |
-
return
|
138 |
}
|
139 |
|
140 |
$instance = $old_instance;
|
141 |
|
142 |
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
143 |
-
$instance['selectedonly'] = $new_instance['selectedonly']
|
144 |
-
$instance['count'] = $new_instance['count']
|
145 |
-
$instance['hierarchical'] = $new_instance['hierarchical']
|
146 |
-
$instance['hide_empty'] = $new_instance['hide_empty']
|
147 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title']
|
148 |
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
149 |
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
150 |
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
151 |
-
$instance['rssfeed'] = $new_instance['rssfeed']
|
152 |
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
153 |
if (array_key_exists('all', $new_instance['post_category'])) {
|
154 |
-
$instance['post_category'] =
|
155 |
} else {
|
156 |
$instance['post_category'] = serialize($new_instance['post_category']);
|
157 |
}
|
@@ -159,7 +159,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
159 |
if ($instance['depth'] < 0 || 11 < $instance['depth']) {
|
160 |
$instance['depth'] = 0;
|
161 |
}
|
162 |
-
$instance['invert_included'] = $new_instance['invert_included']
|
163 |
|
164 |
return $instance;
|
165 |
}
|
@@ -179,18 +179,18 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
179 |
if ($depth < 0 || 11 < $depth) {
|
180 |
$depth = 0;
|
181 |
}
|
182 |
-
$selected_cats = ($instance
|
183 |
|
184 |
echo '<p>';
|
185 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance
|
186 |
echo '</p>';
|
187 |
|
188 |
echo '<p>';
|
189 |
-
avh_doWidgetFormCheckbox($this->get_field_id('selectedonly'), $this->get_field_name('selectedonly'), __('Show selected categories only', 'avh-ec'), (bool) $instance
|
190 |
|
191 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance
|
192 |
|
193 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance
|
194 |
|
195 |
$options = array(0 => __('All Levels', 'avh-ec'), 1 => __('Toplevel only', 'avh-ec'));
|
196 |
for ($i = 2; $i <= 11; $i ++) {
|
@@ -199,9 +199,9 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
199 |
avh_doWidgetFormSelect($this->get_field_id('depth'), $this->get_field_name('depth'), __('How many levels to show', 'avh-ec'), $options, $depth);
|
200 |
unset($options);
|
201 |
|
202 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance
|
203 |
|
204 |
-
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
|
205 |
echo '</p>';
|
206 |
|
207 |
echo '<p>';
|
@@ -214,25 +214,25 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
214 |
$options['avhec_3rdparty_mycategoryorder'] = 'My Category Order';
|
215 |
}
|
216 |
|
217 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance
|
218 |
unset($options);
|
219 |
|
220 |
$options['asc'] = __('Ascending', 'avh-ec');
|
221 |
$options['desc'] = __('Descending', 'avh-ec');
|
222 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance
|
223 |
unset($options);
|
224 |
|
225 |
$options['list'] = __('List', 'avh-ec');
|
226 |
$options['drop'] = __('Drop down', 'avh-ec');
|
227 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance
|
228 |
unset($options);
|
229 |
echo '</p>';
|
230 |
|
231 |
echo '<p>';
|
232 |
|
233 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance
|
234 |
|
235 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance
|
236 |
|
237 |
echo '</p>';
|
238 |
|
@@ -241,7 +241,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
241 |
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;">';
|
242 |
echo '<li id="' . $this->get_field_id('category--1') . '" class="popular-category">';
|
243 |
echo '<label for="' . $this->get_field_id('post_category') . '" class="selectit">';
|
244 |
-
echo '<input value="all" id="' . $this->get_field_id('post_category') . '" name="' . $this->get_field_name('post_category') . '[all]" type="checkbox" ' . (
|
245 |
_e('All Categories', 'avh-ec');
|
246 |
echo '</label>';
|
247 |
echo '</li>';
|
@@ -252,7 +252,7 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
252 |
echo '</p>';
|
253 |
|
254 |
echo '<p>';
|
255 |
-
avh_doWidgetFormCheckbox($this->get_field_id('invert_included'), $this->get_field_name('invert_included'), __('Exclude the selected categories', 'avh-ec'), (bool) $instance
|
256 |
echo '</p>';
|
257 |
|
258 |
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
@@ -261,11 +261,11 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
261 |
/**
|
262 |
* Creates the categories checklist
|
263 |
*
|
264 |
-
* @param int
|
265 |
-
* @param int
|
266 |
* @param array $selected_cats
|
267 |
* @param array $popular_cats
|
268 |
-
* @param int
|
269 |
*/
|
270 |
public function avh_wp_category_checklist($selected_cats, $number)
|
271 |
{
|
@@ -277,10 +277,11 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
277 |
|
278 |
$args = array('taxonomy' => 'category', 'descendants_and_self' => 0, 'selected_cats' => $selected_cats, 'popular_cats' => array(), 'walker' => $walker, 'checked_ontop' => true, 'popular_cats' => array());
|
279 |
|
280 |
-
if (is_array($selected_cats))
|
281 |
$args['selected_cats'] = $selected_cats;
|
282 |
-
else
|
283 |
$args['selected_cats'] = array();
|
|
|
284 |
|
285 |
$categories = $this->core->getCategories();
|
286 |
$_categories_id = $this->core->getCategoriesId($categories);
|
@@ -296,9 +297,9 @@ class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
|
296 |
}
|
297 |
|
298 |
// Put checked cats on top
|
299 |
-
echo $walker->walk($checked_categories, 0,
|
300 |
// Then the rest of them
|
301 |
-
echo $walker->walk($categories, 0,
|
302 |
}
|
303 |
}
|
304 |
|
@@ -322,13 +323,13 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
|
322 |
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
323 |
|
324 |
$widget_ops = array('description' => __("Shows the top categories.", 'avh-ec'));
|
325 |
-
WP_Widget::__construct(
|
326 |
-
add_action('wp_print_styles', array(
|
327 |
}
|
328 |
|
329 |
public function actionWpPrintStyles()
|
330 |
{
|
331 |
-
if (!(
|
332 |
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
333 |
wp_enqueue_style('avhec-widget');
|
334 |
}
|
@@ -355,12 +356,12 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
|
355 |
} elseif ($a < 1) {
|
356 |
$a = 1;
|
357 |
}
|
358 |
-
$c = $instance['count']
|
359 |
-
$use_desc_for_title = $instance['use_desc_for_title']
|
360 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
361 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
362 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
363 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
364 |
if (empty($r)) {
|
365 |
$i = '';
|
366 |
}
|
@@ -376,10 +377,10 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
|
376 |
$show_option_none = $options['general']['alternative_name_select_category'];
|
377 |
}
|
378 |
|
379 |
-
$top_cats = get_terms('category', array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => $a, 'hierarchical' =>
|
380 |
$included_cats = implode(",", $top_cats);
|
381 |
|
382 |
-
$cat_args = array('include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' =>
|
383 |
echo $before_widget;
|
384 |
echo $this->core->comment;
|
385 |
echo $before_title . $title . $after_title;
|
@@ -410,31 +411,31 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
|
410 |
*
|
411 |
* This function should check that $new_instance is set correctly.
|
412 |
* The newly calculated value of $instance should be returned.
|
413 |
-
* If "
|
414 |
*
|
415 |
* @param array $new_instance
|
416 |
* New settings for this instance as input by the user via form()
|
417 |
* @param array $old_instance
|
418 |
* Old settings for this instance
|
419 |
-
* @return array Settings to save or bool
|
420 |
*/
|
421 |
public function update($new_instance, $old_instance)
|
422 |
{
|
423 |
// update the instance's settings
|
424 |
if (!isset($new_instance['submit'])) {
|
425 |
-
return
|
426 |
}
|
427 |
|
428 |
$instance = $old_instance;
|
429 |
|
430 |
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
431 |
$instance['amount'] = (int) $new_instance['amount'];
|
432 |
-
$instance['count'] = $new_instance['count']
|
433 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title']
|
434 |
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
435 |
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
436 |
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
437 |
-
$instance['rssfeed'] = $new_instance['rssfeed']
|
438 |
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
439 |
|
440 |
return $instance;
|
@@ -449,18 +450,14 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
|
449 |
public function form($instance)
|
450 |
{
|
451 |
// displays the widget admin form
|
452 |
-
$instance = wp_parse_args((array) $instance, array('title' => '', 'rssimage' => ''));
|
453 |
-
|
454 |
-
// Prepare data for display
|
455 |
-
if (!$amount = (int) $instance['amount']) {
|
456 |
-
$amount = 5;
|
457 |
-
}
|
458 |
|
|
|
459 |
if ($amount < 1) {
|
460 |
$amount = 1;
|
461 |
}
|
462 |
echo '<p>';
|
463 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance
|
464 |
echo '</p>';
|
465 |
|
466 |
echo '<p>';
|
@@ -468,10 +465,10 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
|
468 |
echo '</p>';
|
469 |
|
470 |
echo '<p>';
|
471 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance
|
472 |
echo '<br />';
|
473 |
|
474 |
-
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
|
475 |
echo '</p>';
|
476 |
|
477 |
echo '<p>';
|
@@ -479,25 +476,25 @@ class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
|
479 |
$options['name'] = __('Name', 'avh-ec');
|
480 |
$options['count'] = __('Count', 'avh-ec');
|
481 |
$options['slug'] = __('Slug', 'avh-ec');
|
482 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance
|
483 |
unset($options);
|
484 |
|
485 |
$options['asc'] = __('Ascending', 'avh-ec');
|
486 |
$options['desc'] = __('Descending', 'avh-ec');
|
487 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance
|
488 |
unset($options);
|
489 |
|
490 |
$options['list'] = __('List', 'avh-ec');
|
491 |
$options['drop'] = __('Drop down', 'avh-ec');
|
492 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance
|
493 |
unset($options);
|
494 |
echo '</p>';
|
495 |
|
496 |
echo '<p>';
|
497 |
|
498 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance
|
499 |
|
500 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance
|
501 |
|
502 |
echo '</p>';
|
503 |
|
@@ -532,13 +529,13 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
532 |
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
533 |
|
534 |
$widget_ops = array('description' => __("Shows grouped categories.", 'avh-ec'));
|
535 |
-
WP_Widget::__construct(
|
536 |
-
add_action('wp_print_styles', array(
|
537 |
}
|
538 |
|
539 |
public function actionWpPrintStyles()
|
540 |
{
|
541 |
-
if (!(
|
542 |
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
543 |
wp_enqueue_style('avhec-widget');
|
544 |
}
|
@@ -577,16 +574,16 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
577 |
$special_page = 'none';
|
578 |
}
|
579 |
|
580 |
-
$toDisplay =
|
581 |
if ('none' == $special_page) {
|
582 |
$terms = wp_get_object_terms($post->ID, $catgrp->taxonomy_name);
|
583 |
if (!empty($terms)) {
|
584 |
$selected_catgroups = unserialize($instance['post_group_category']);
|
585 |
foreach ($terms as $key => $value) {
|
586 |
-
if ($selected_catgroups ===
|
587 |
if (!($this->getWidgetDoneCatGroup($value->term_id))) {
|
588 |
$row = $value;
|
589 |
-
$group_found =
|
590 |
break;
|
591 |
}
|
592 |
}
|
@@ -595,7 +592,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
595 |
$options = $this->core->options;
|
596 |
$no_cat_group = $options['cat_group']['no_group'];
|
597 |
$row = get_term_by('id', $no_cat_group, $catgrp->taxonomy_name);
|
598 |
-
$group_found =
|
599 |
}
|
600 |
} else {
|
601 |
if ('category_group' == $special_page) {
|
@@ -610,35 +607,35 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
610 |
} else {
|
611 |
$sp_category_group_id = $options['sp_cat_group'][$special_page];
|
612 |
}
|
613 |
-
$row = get_term_by('id', $sp_category_group_id, $catgrp->taxonomy_name); // Returns
|
614 |
-
$group_found =
|
615 |
}
|
616 |
|
617 |
if ($group_found) {
|
618 |
-
$toDisplay =
|
619 |
$category_group_id_none = $this->catgrp->getTermIDBy('slug', 'none');
|
620 |
$selected_catgroups = unserialize($instance['post_group_category']);
|
621 |
|
622 |
if ($category_group_id_none == $row->term_id) {
|
623 |
-
$toDisplay =
|
624 |
-
} elseif (!(
|
625 |
-
$toDisplay =
|
626 |
} elseif ($special_page != 'none' && $this->getWidgetDoneCatGroup($sp_category_group_id)) {
|
627 |
-
$toDisplay =
|
628 |
}
|
629 |
}
|
630 |
|
631 |
if ($toDisplay) {
|
632 |
extract($args);
|
633 |
|
634 |
-
$c = $instance['count']
|
635 |
-
$e = $instance['hide_empty']
|
636 |
-
$h = $instance['hierarchical']
|
637 |
-
$use_desc_for_title = $instance['use_desc_for_title']
|
638 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
639 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
640 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
641 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
642 |
|
643 |
if (empty($r)) {
|
644 |
$i = '';
|
@@ -671,10 +668,10 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
671 |
|
672 |
if ($style == 'list') {
|
673 |
echo '<ul>';
|
674 |
-
$this->core->avh_wp_list_categories($cat_args,
|
675 |
echo '</ul>';
|
676 |
} else {
|
677 |
-
$this->core->avh_wp_dropdown_categories($cat_args,
|
678 |
echo '<script type=\'text/javascript\'>' . "\n";
|
679 |
echo '/* <![CDATA[ */' . "\n";
|
680 |
echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-group-' . $this->number . '");' . "\n";
|
@@ -694,31 +691,31 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
694 |
/**
|
695 |
* When Widget Control Form Is Posted
|
696 |
*
|
697 |
-
* @param
|
698 |
-
* @param
|
699 |
* @return unknown
|
700 |
*/
|
701 |
public function update($new_instance, $old_instance)
|
702 |
{
|
703 |
// update the instance's settings
|
704 |
if (!isset($new_instance['submit'])) {
|
705 |
-
return
|
706 |
}
|
707 |
|
708 |
$instance = $old_instance;
|
709 |
|
710 |
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
711 |
-
$instance['count'] = $new_instance['count']
|
712 |
-
$instance['hierarchical'] = $new_instance['hierarchical']
|
713 |
-
$instance['hide_empty'] = $new_instance['hide_empty']
|
714 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title']
|
715 |
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
716 |
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
717 |
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
718 |
-
$instance['rssfeed'] = $new_instance['rssfeed']
|
719 |
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
720 |
if (array_key_exists('all', $new_instance['post_group_category'])) {
|
721 |
-
$instance['post_group_category'] =
|
722 |
} else {
|
723 |
$instance['post_group_category'] = serialize($new_instance['post_group_category']);
|
724 |
}
|
@@ -736,23 +733,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
736 |
// displays the widget admin form
|
737 |
$instance = wp_parse_args((array) $instance, array('title' => '', 'rssimage' => ''));
|
738 |
|
739 |
-
|
740 |
-
$title = esc_attr($instance['title']);
|
741 |
-
$count = (bool) $instance['count'];
|
742 |
-
$hierarchical = (bool) $instance['hierarchical'];
|
743 |
-
$hide_empty = (bool) $instance['hide_empty'];
|
744 |
-
$use_desc_for_title = (bool) $instance['use_desc_for_title'];
|
745 |
-
$sort_id = ($instance['sort_column'] == 'ID') ? ' SELECTED' : '';
|
746 |
-
$sort_name = ($instance['sort_column'] == 'name') ? ' SELECTED' : '';
|
747 |
-
$sort_count = ($instance['sort_column'] == 'count') ? ' SELECTED' : '';
|
748 |
-
$sort_order_a = ($instance['sort_order'] == 'asc') ? ' SELECTED' : '';
|
749 |
-
$sort_order_d = ($instance['sort_order'] == 'desc') ? ' SELECTED' : '';
|
750 |
-
$style_list = ($instance['style'] == 'list') ? ' SELECTED' : '';
|
751 |
-
$style_drop = ($instance['style'] == 'drop') ? ' SELECTED' : '';
|
752 |
-
$rssfeed = (bool) $instance['rssfeed'];
|
753 |
-
$rssimage = esc_attr($instance['rssimage']);
|
754 |
-
|
755 |
-
$selected_cats = ($instance['post_group_category'] != '') ? unserialize($instance['post_group_category']) : FALSE;
|
756 |
ob_start();
|
757 |
echo '<p>';
|
758 |
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
@@ -760,13 +741,13 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
760 |
|
761 |
echo '<p>';
|
762 |
|
763 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance
|
764 |
|
765 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance
|
766 |
|
767 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance
|
768 |
|
769 |
-
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
|
770 |
echo '</p>';
|
771 |
|
772 |
echo '<p>';
|
@@ -774,25 +755,25 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
774 |
$options['name'] = __('Name', 'avh-ec');
|
775 |
$options['count'] = __('Count', 'avh-ec');
|
776 |
$options['slug'] = __('Slug', 'avh-ec');
|
777 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance
|
778 |
unset($options);
|
779 |
|
780 |
$options['asc'] = __('Ascending', 'avh-ec');
|
781 |
$options['desc'] = __('Descending', 'avh-ec');
|
782 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance
|
783 |
unset($options);
|
784 |
|
785 |
$options['list'] = __('List', 'avh-ec');
|
786 |
$options['drop'] = __('Drop down', 'avh-ec');
|
787 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance
|
788 |
unset($options);
|
789 |
echo '</p>';
|
790 |
|
791 |
echo '<p>';
|
792 |
|
793 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance
|
794 |
|
795 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance
|
796 |
echo '</p>';
|
797 |
|
798 |
echo '<p>';
|
@@ -800,7 +781,7 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
800 |
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;">';
|
801 |
echo '<li id="' . $this->get_field_id('group_category--1') . '" class="popular-group_category">';
|
802 |
echo '<label for="' . $this->get_field_id('group_post_category') . '" class="selectit">';
|
803 |
-
echo '<input value="all" id="' . $this->get_field_id('group_post_category') . '" name="' . $this->get_field_name('post_group_category') . '[all]" type="checkbox" ' . (
|
804 |
_e('Any Group', 'avh-ec');
|
805 |
echo '</label>';
|
806 |
echo '</li>';
|
@@ -824,10 +805,11 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
824 |
|
825 |
$args = array('taxonomy' => 'avhec_catgroup', 'descendants_and_self' => 0, 'selected_cats' => array(), 'popular_cats' => array(), 'walker' => $walker, 'checked_ontop' => true);
|
826 |
|
827 |
-
if (is_array($selected_cats))
|
828 |
$args['selected_cats'] = $selected_cats;
|
829 |
-
else
|
830 |
$args['selected_cats'] = array();
|
|
|
831 |
|
832 |
$categories = (array) get_terms($args['taxonomy'], array('get' => 'all'));
|
833 |
|
@@ -843,20 +825,20 @@ class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
|
843 |
}
|
844 |
|
845 |
// Put checked cats on top
|
846 |
-
echo $walker->walk($checked_categories, 0,
|
847 |
// Then the rest of them
|
848 |
-
echo $walker->walk($categories, 0,
|
849 |
}
|
850 |
|
851 |
public function getWidgetDoneCatGroup($id)
|
852 |
{
|
853 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
854 |
if (is_array($catgrp->widget_done_catgroup) && array_key_exists($id, $catgrp->widget_done_catgroup)) {
|
855 |
-
return
|
856 |
}
|
857 |
-
$catgrp->widget_done_catgroup[$id] =
|
858 |
|
859 |
-
return
|
860 |
}
|
861 |
}
|
862 |
|
@@ -887,20 +869,23 @@ class AVH_Walker_Category_Checklist extends Walker
|
|
887 |
*
|
888 |
* @since 2.1.0
|
889 |
*
|
890 |
-
* @param
|
891 |
-
* @param
|
892 |
-
* @param
|
893 |
* @return string
|
894 |
*/
|
895 |
-
public function walk($elements, $max_depth
|
896 |
{
|
|
|
897 |
$output = '';
|
898 |
|
899 |
-
if ($max_depth < -1)
|
900 |
return $output;
|
|
|
901 |
|
902 |
-
if (empty($elements)) // nothing to walk
|
903 |
return $output;
|
|
|
904 |
|
905 |
$id_field = $this->db_fields['id'];
|
906 |
$parent_field = $this->db_fields['parent'];
|
@@ -908,8 +893,9 @@ class AVH_Walker_Category_Checklist extends Walker
|
|
908 |
// flat display
|
909 |
if (-1 == $max_depth) {
|
910 |
$empty_array = array();
|
911 |
-
foreach ($elements as $e)
|
912 |
$this->display_element($e, $empty_array, 1, 0, $args, $output);
|
|
|
913 |
|
914 |
return $output;
|
915 |
}
|
@@ -920,10 +906,11 @@ class AVH_Walker_Category_Checklist extends Walker
|
|
920 |
$top_level_elements = array();
|
921 |
$children_elements = array();
|
922 |
foreach ($elements as $e) {
|
923 |
-
if (0 == $e->$parent_field)
|
924 |
$top_level_elements[] = $e;
|
925 |
-
else
|
926 |
$children_elements[$e->$parent_field][] = $e;
|
|
|
927 |
}
|
928 |
|
929 |
/*
|
@@ -937,51 +924,58 @@ class AVH_Walker_Category_Checklist extends Walker
|
|
937 |
$top_level_elements = array();
|
938 |
$children_elements = array();
|
939 |
foreach ($elements as $e) {
|
940 |
-
if ($root->$parent_field == $e->$parent_field)
|
941 |
$top_level_elements[] = $e;
|
942 |
-
else
|
943 |
$children_elements[$e->$parent_field][] = $e;
|
|
|
944 |
}
|
945 |
}
|
946 |
|
947 |
-
foreach ($top_level_elements as $e)
|
948 |
$this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
|
|
|
949 |
|
950 |
-
|
951 |
* if we are displaying all levels, and remaining children_elements is not empty, then we got orphans, which should be displayed regardless
|
952 |
*/
|
953 |
if (($max_depth == 0) && count($children_elements) > 0) {
|
954 |
$empty_array = array();
|
955 |
-
foreach ($children_elements as $orphans)
|
956 |
-
foreach ($orphans as $op)
|
957 |
$this->display_element($op, $empty_array, 1, 0, $args, $output);
|
|
|
|
|
958 |
}
|
959 |
|
960 |
return $output;
|
961 |
}
|
962 |
|
963 |
-
public function start_lvl(&$output, $depth, $args)
|
964 |
{
|
965 |
$indent = str_repeat("\t", $depth);
|
966 |
$output .= $indent . '<ul class="children">' . "\n";
|
967 |
}
|
968 |
|
969 |
-
public function end_lvl(&$output, $depth, $args)
|
970 |
{
|
971 |
$indent = str_repeat("\t", $depth);
|
972 |
$output .= $indent . '</ul>' . "\n";
|
973 |
}
|
974 |
|
975 |
-
public function start_el(&$output, $
|
976 |
{
|
977 |
extract($args);
|
978 |
-
|
|
|
|
|
|
|
979 |
$output .= "\n" . '<li id="' . $this->li_id . '">';
|
980 |
$output .= '<label for="' . $input_id . '" class="selectit">';
|
981 |
-
$output .= '<input value="' . $
|
982 |
}
|
983 |
|
984 |
-
public function end_el(&$output, $
|
985 |
{
|
986 |
$output .= "</li>\n";
|
987 |
}
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Widget Class for displaying categories.
|
5 |
+
* Extended version of the default categories.
|
6 |
*/
|
7 |
class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
8 |
{
|
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 |
public function actionWpPrintStyles()
|
36 |
{
|
37 |
+
if (!(false === is_active_widget(false, false, $this->id_base, true))) {
|
38 |
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
39 |
wp_enqueue_style('avhec-widget');
|
40 |
}
|
50 |
{
|
51 |
extract($args);
|
52 |
|
53 |
+
$selectedonly = isset($instance['selectedonly']);
|
54 |
+
$c = isset($instance['count']);
|
55 |
+
$h = isset($instance['hierarchical']);
|
56 |
+
$d = isset($instance['depth']) ? $instance['depth'] : 0;
|
57 |
+
$e = isset($instance['hide_empty']);
|
58 |
+
$use_desc_for_title = isset($instance['use_desc_for_title']);
|
59 |
+
$s = isset($instance['sort_column']) ? $instance['sort_column'] : 'name';
|
60 |
+
$o = isset($instance['sort_order']) ? $instance['sort_order'] : 'asc';
|
61 |
+
$r = isset($instance['rssfeed']) ? 'RSS' : '';
|
62 |
+
$i = isset($instance['rssimage']) ? $instance['rssimage'] : '';
|
63 |
+
$invert = isset($instance['invert_included']);
|
64 |
|
65 |
if (empty($r)) {
|
66 |
$i = '';
|
126 |
/**
|
127 |
* When Widget Control Form Is Posted
|
128 |
*
|
129 |
+
* @param unknown_type $new_instance
|
130 |
+
* @param unknown_type $old_instance
|
131 |
* @return unknown
|
132 |
*/
|
133 |
public function update($new_instance, $old_instance)
|
134 |
{
|
135 |
// update the instance's settings
|
136 |
if (!isset($new_instance['submit'])) {
|
137 |
+
return false;
|
138 |
}
|
139 |
|
140 |
$instance = $old_instance;
|
141 |
|
142 |
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
143 |
+
$instance['selectedonly'] = isset($new_instance['selectedonly']);
|
144 |
+
$instance['count'] = isset($new_instance['count']);
|
145 |
+
$instance['hierarchical'] = isset($new_instance['hierarchical']);
|
146 |
+
$instance['hide_empty'] = isset($new_instance['hide_empty']);
|
147 |
+
$instance['use_desc_for_title'] = isset($new_instance['use_desc_for_title']);
|
148 |
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
149 |
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
150 |
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
151 |
+
$instance['rssfeed'] = isset($new_instance['rssfeed']);
|
152 |
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
153 |
if (array_key_exists('all', $new_instance['post_category'])) {
|
154 |
+
$instance['post_category'] = false;
|
155 |
} else {
|
156 |
$instance['post_category'] = serialize($new_instance['post_category']);
|
157 |
}
|
159 |
if ($instance['depth'] < 0 || 11 < $instance['depth']) {
|
160 |
$instance['depth'] = 0;
|
161 |
}
|
162 |
+
$instance['invert_included'] = isset($new_instance['invert_included']);
|
163 |
|
164 |
return $instance;
|
165 |
}
|
179 |
if ($depth < 0 || 11 < $depth) {
|
180 |
$depth = 0;
|
181 |
}
|
182 |
+
$selected_cats = (avhGetArrayValue($instance, 'post_category') !== '') ? unserialize($instance['post_category']) : false;
|
183 |
|
184 |
echo '<p>';
|
185 |
+
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), avhGetArrayValue($instance, 'title'));
|
186 |
echo '</p>';
|
187 |
|
188 |
echo '<p>';
|
189 |
+
avh_doWidgetFormCheckbox($this->get_field_id('selectedonly'), $this->get_field_name('selectedonly'), __('Show selected categories only', 'avh-ec'), (bool) avhGetArrayValue($instance, 'selectedonly'));
|
190 |
|
191 |
+
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) avhGetArrayValue($instance, 'count'));
|
192 |
|
193 |
+
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) avhGetArrayValue($instance, 'hierarchical'));
|
194 |
|
195 |
$options = array(0 => __('All Levels', 'avh-ec'), 1 => __('Toplevel only', 'avh-ec'));
|
196 |
for ($i = 2; $i <= 11; $i ++) {
|
199 |
avh_doWidgetFormSelect($this->get_field_id('depth'), $this->get_field_name('depth'), __('How many levels to show', 'avh-ec'), $options, $depth);
|
200 |
unset($options);
|
201 |
|
202 |
+
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) avhGetArrayValue($instance, 'hide_empty'));
|
203 |
|
204 |
+
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) avhGetArrayValue($instance, 'use_desc_for_title'));
|
205 |
echo '</p>';
|
206 |
|
207 |
echo '<p>';
|
214 |
$options['avhec_3rdparty_mycategoryorder'] = 'My Category Order';
|
215 |
}
|
216 |
|
217 |
+
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_column'));
|
218 |
unset($options);
|
219 |
|
220 |
$options['asc'] = __('Ascending', 'avh-ec');
|
221 |
$options['desc'] = __('Descending', 'avh-ec');
|
222 |
+
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_order'));
|
223 |
unset($options);
|
224 |
|
225 |
$options['list'] = __('List', 'avh-ec');
|
226 |
$options['drop'] = __('Drop down', 'avh-ec');
|
227 |
+
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, avhGetArrayValue($instance, 'style'));
|
228 |
unset($options);
|
229 |
echo '</p>';
|
230 |
|
231 |
echo '<p>';
|
232 |
|
233 |
+
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) avhGetArrayValue($instance, 'rssfeed'));
|
234 |
|
235 |
+
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), avhGetArrayValue($instance, 'rssimage'));
|
236 |
|
237 |
echo '</p>';
|
238 |
|
241 |
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;">';
|
242 |
echo '<li id="' . $this->get_field_id('category--1') . '" class="popular-category">';
|
243 |
echo '<label for="' . $this->get_field_id('post_category') . '" class="selectit">';
|
244 |
+
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' : '') . '> ';
|
245 |
_e('All Categories', 'avh-ec');
|
246 |
echo '</label>';
|
247 |
echo '</li>';
|
252 |
echo '</p>';
|
253 |
|
254 |
echo '<p>';
|
255 |
+
avh_doWidgetFormCheckbox($this->get_field_id('invert_included'), $this->get_field_name('invert_included'), __('Exclude the selected categories', 'avh-ec'), (bool) avhGetArrayValue($instance, 'invert_included'));
|
256 |
echo '</p>';
|
257 |
|
258 |
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
261 |
/**
|
262 |
* Creates the categories checklist
|
263 |
*
|
264 |
+
* @param int $post_id
|
265 |
+
* @param int $descendants_and_self
|
266 |
* @param array $selected_cats
|
267 |
* @param array $popular_cats
|
268 |
+
* @param int $number
|
269 |
*/
|
270 |
public function avh_wp_category_checklist($selected_cats, $number)
|
271 |
{
|
277 |
|
278 |
$args = array('taxonomy' => 'category', 'descendants_and_self' => 0, 'selected_cats' => $selected_cats, 'popular_cats' => array(), 'walker' => $walker, 'checked_ontop' => true, 'popular_cats' => array());
|
279 |
|
280 |
+
if (is_array($selected_cats)) {
|
281 |
$args['selected_cats'] = $selected_cats;
|
282 |
+
} else {
|
283 |
$args['selected_cats'] = array();
|
284 |
+
}
|
285 |
|
286 |
$categories = $this->core->getCategories();
|
287 |
$_categories_id = $this->core->getCategoriesId($categories);
|
297 |
}
|
298 |
|
299 |
// Put checked cats on top
|
300 |
+
echo $walker->walk($checked_categories, 0, $args);
|
301 |
// Then the rest of them
|
302 |
+
echo $walker->walk($categories, 0, $args);
|
303 |
}
|
304 |
}
|
305 |
|
323 |
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
324 |
|
325 |
$widget_ops = array('description' => __("Shows the top categories.", 'avh-ec'));
|
326 |
+
WP_Widget::__construct(false, 'AVH Extended Categories: ' . __('Top Categories'), $widget_ops);
|
327 |
+
add_action('wp_print_styles', array($this, 'actionWpPrintStyles'));
|
328 |
}
|
329 |
|
330 |
public function actionWpPrintStyles()
|
331 |
{
|
332 |
+
if (!(false === is_active_widget(false, false, $this->id_base, true))) {
|
333 |
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
334 |
wp_enqueue_style('avhec-widget');
|
335 |
}
|
356 |
} elseif ($a < 1) {
|
357 |
$a = 1;
|
358 |
}
|
359 |
+
$c = isset($instance['count']);
|
360 |
+
$use_desc_for_title = isset($instance['use_desc_for_title']);
|
361 |
+
$s = isset($instance['sort_column']) ? $instance['sort_column'] : 'name';
|
362 |
+
$o = isset($instance['sort_order']) ? $instance['sort_order'] : 'asc';
|
363 |
+
$r = isset($instance['rssfeed']) ? 'RSS' : '';
|
364 |
+
$i = isset($instance['rssimage']) ? $instance['rssimage'] : '';
|
365 |
if (empty($r)) {
|
366 |
$i = '';
|
367 |
}
|
377 |
$show_option_none = $options['general']['alternative_name_select_category'];
|
378 |
}
|
379 |
|
380 |
+
$top_cats = get_terms('category', array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => $a, 'hierarchical' => false));
|
381 |
$included_cats = implode(",", $top_cats);
|
382 |
|
383 |
+
$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);
|
384 |
echo $before_widget;
|
385 |
echo $this->core->comment;
|
386 |
echo $before_title . $title . $after_title;
|
411 |
*
|
412 |
* This function should check that $new_instance is set correctly.
|
413 |
* The newly calculated value of $instance should be returned.
|
414 |
+
* If "false" is returned, the instance won't be saved/updated.
|
415 |
*
|
416 |
* @param array $new_instance
|
417 |
* New settings for this instance as input by the user via form()
|
418 |
* @param array $old_instance
|
419 |
* Old settings for this instance
|
420 |
+
* @return array Settings to save or bool false to cancel saving
|
421 |
*/
|
422 |
public function update($new_instance, $old_instance)
|
423 |
{
|
424 |
// update the instance's settings
|
425 |
if (!isset($new_instance['submit'])) {
|
426 |
+
return false;
|
427 |
}
|
428 |
|
429 |
$instance = $old_instance;
|
430 |
|
431 |
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
432 |
$instance['amount'] = (int) $new_instance['amount'];
|
433 |
+
$instance['count'] = isset($new_instance['count']);
|
434 |
+
$instance['use_desc_for_title'] = isset($new_instance['use_desc_for_title']);
|
435 |
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
436 |
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
437 |
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
438 |
+
$instance['rssfeed'] = isset($new_instance['rssfeed']);
|
439 |
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
440 |
|
441 |
return $instance;
|
450 |
public function form($instance)
|
451 |
{
|
452 |
// displays the widget admin form
|
453 |
+
$instance = wp_parse_args((array) $instance, array('title' => '', 'rssimage' => '', 'amount' => '5'));
|
|
|
|
|
|
|
|
|
|
|
454 |
|
455 |
+
$amount = (int) avhGetArrayValue($instance, 'amount');
|
456 |
if ($amount < 1) {
|
457 |
$amount = 1;
|
458 |
}
|
459 |
echo '<p>';
|
460 |
+
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), avhGetArrayValue($instance, 'title'));
|
461 |
echo '</p>';
|
462 |
|
463 |
echo '<p>';
|
465 |
echo '</p>';
|
466 |
|
467 |
echo '<p>';
|
468 |
+
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) avhGetArrayValue($instance, 'count'));
|
469 |
echo '<br />';
|
470 |
|
471 |
+
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) avhGetArrayValue($instance, 'use_desc_for_title'));
|
472 |
echo '</p>';
|
473 |
|
474 |
echo '<p>';
|
476 |
$options['name'] = __('Name', 'avh-ec');
|
477 |
$options['count'] = __('Count', 'avh-ec');
|
478 |
$options['slug'] = __('Slug', 'avh-ec');
|
479 |
+
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_column'));
|
480 |
unset($options);
|
481 |
|
482 |
$options['asc'] = __('Ascending', 'avh-ec');
|
483 |
$options['desc'] = __('Descending', 'avh-ec');
|
484 |
+
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_order'));
|
485 |
unset($options);
|
486 |
|
487 |
$options['list'] = __('List', 'avh-ec');
|
488 |
$options['drop'] = __('Drop down', 'avh-ec');
|
489 |
+
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, avhGetArrayValue($instance, 'style'));
|
490 |
unset($options);
|
491 |
echo '</p>';
|
492 |
|
493 |
echo '<p>';
|
494 |
|
495 |
+
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) avhGetArrayValue($instance, 'rssfeed'));
|
496 |
|
497 |
+
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), avhGetArrayValue($instance, 'rssimage'));
|
498 |
|
499 |
echo '</p>';
|
500 |
|
529 |
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
530 |
|
531 |
$widget_ops = array('description' => __("Shows grouped categories.", 'avh-ec'));
|
532 |
+
WP_Widget::__construct(false, 'AVH Extended Categories: ' . __('Category Group'), $widget_ops);
|
533 |
+
add_action('wp_print_styles', array($this, 'actionWpPrintStyles'));
|
534 |
}
|
535 |
|
536 |
public function actionWpPrintStyles()
|
537 |
{
|
538 |
+
if (!(false === is_active_widget(false, false, $this->id_base, true))) {
|
539 |
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
540 |
wp_enqueue_style('avhec-widget');
|
541 |
}
|
574 |
$special_page = 'none';
|
575 |
}
|
576 |
|
577 |
+
$toDisplay = false;
|
578 |
if ('none' == $special_page) {
|
579 |
$terms = wp_get_object_terms($post->ID, $catgrp->taxonomy_name);
|
580 |
if (!empty($terms)) {
|
581 |
$selected_catgroups = unserialize($instance['post_group_category']);
|
582 |
foreach ($terms as $key => $value) {
|
583 |
+
if ($selected_catgroups === false || array_key_exists($value->term_id, $selected_catgroups)) {
|
584 |
if (!($this->getWidgetDoneCatGroup($value->term_id))) {
|
585 |
$row = $value;
|
586 |
+
$group_found = true;
|
587 |
break;
|
588 |
}
|
589 |
}
|
592 |
$options = $this->core->options;
|
593 |
$no_cat_group = $options['cat_group']['no_group'];
|
594 |
$row = get_term_by('id', $no_cat_group, $catgrp->taxonomy_name);
|
595 |
+
$group_found = true;
|
596 |
}
|
597 |
} else {
|
598 |
if ('category_group' == $special_page) {
|
607 |
} else {
|
608 |
$sp_category_group_id = $options['sp_cat_group'][$special_page];
|
609 |
}
|
610 |
+
$row = get_term_by('id', $sp_category_group_id, $catgrp->taxonomy_name); // Returns false when non-existance. (empty(false)=true)
|
611 |
+
$group_found = true;
|
612 |
}
|
613 |
|
614 |
if ($group_found) {
|
615 |
+
$toDisplay = true;
|
616 |
$category_group_id_none = $this->catgrp->getTermIDBy('slug', 'none');
|
617 |
$selected_catgroups = unserialize($instance['post_group_category']);
|
618 |
|
619 |
if ($category_group_id_none == $row->term_id) {
|
620 |
+
$toDisplay = false;
|
621 |
+
} elseif (!(false == $selected_catgroups || array_key_exists($row->term_id, $selected_catgroups))) {
|
622 |
+
$toDisplay = false;
|
623 |
} elseif ($special_page != 'none' && $this->getWidgetDoneCatGroup($sp_category_group_id)) {
|
624 |
+
$toDisplay = false;
|
625 |
}
|
626 |
}
|
627 |
|
628 |
if ($toDisplay) {
|
629 |
extract($args);
|
630 |
|
631 |
+
$c = isset($instance['count']);
|
632 |
+
$e = isset($instance['hide_empty']);
|
633 |
+
$h = isset($instance['hierarchical']);
|
634 |
+
$use_desc_for_title = isset($instance['use_desc_for_title']);
|
635 |
+
$s = isset($instance['sort_column']) ? $instance['sort_column'] : 'name';
|
636 |
+
$o = isset($instance['sort_order']) ? $instance['sort_order'] : 'asc';
|
637 |
+
$r = isset($instance['rssfeed']) ? 'RSS' : '';
|
638 |
+
$i = isset($instance['rssimage']) ? $instance['rssimage'] : '';
|
639 |
|
640 |
if (empty($r)) {
|
641 |
$i = '';
|
668 |
|
669 |
if ($style == 'list') {
|
670 |
echo '<ul>';
|
671 |
+
$this->core->avh_wp_list_categories($cat_args, true);
|
672 |
echo '</ul>';
|
673 |
} else {
|
674 |
+
$this->core->avh_wp_dropdown_categories($cat_args, true);
|
675 |
echo '<script type=\'text/javascript\'>' . "\n";
|
676 |
echo '/* <![CDATA[ */' . "\n";
|
677 |
echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-group-' . $this->number . '");' . "\n";
|
691 |
/**
|
692 |
* When Widget Control Form Is Posted
|
693 |
*
|
694 |
+
* @param unknown_type $new_instance
|
695 |
+
* @param unknown_type $old_instance
|
696 |
* @return unknown
|
697 |
*/
|
698 |
public function update($new_instance, $old_instance)
|
699 |
{
|
700 |
// update the instance's settings
|
701 |
if (!isset($new_instance['submit'])) {
|
702 |
+
return false;
|
703 |
}
|
704 |
|
705 |
$instance = $old_instance;
|
706 |
|
707 |
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
708 |
+
$instance['count'] = isset($new_instance['count']);
|
709 |
+
$instance['hierarchical'] = isset($new_instance['hierarchical']);
|
710 |
+
$instance['hide_empty'] = isset($new_instance['hide_empty']);
|
711 |
+
$instance['use_desc_for_title'] = isset($new_instance['use_desc_for_title']);
|
712 |
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
713 |
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
714 |
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
715 |
+
$instance['rssfeed'] = isset($new_instance['rssfeed']);
|
716 |
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
717 |
if (array_key_exists('all', $new_instance['post_group_category'])) {
|
718 |
+
$instance['post_group_category'] = false;
|
719 |
} else {
|
720 |
$instance['post_group_category'] = serialize($new_instance['post_group_category']);
|
721 |
}
|
733 |
// displays the widget admin form
|
734 |
$instance = wp_parse_args((array) $instance, array('title' => '', 'rssimage' => ''));
|
735 |
|
736 |
+
$selected_cats = (avhGetArrayValue($instance, 'post_group_category') !== '') ? unserialize($instance['post_group_category']) : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
ob_start();
|
738 |
echo '<p>';
|
739 |
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
741 |
|
742 |
echo '<p>';
|
743 |
|
744 |
+
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) avhGetArrayValue($instance, 'count'));
|
745 |
|
746 |
+
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) avhGetArrayValue($instance, 'hierarchical'));
|
747 |
|
748 |
+
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) avhGetArrayValue($instance, 'hide_empty'));
|
749 |
|
750 |
+
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) avhGetArrayValue($instance, 'use_desc_for_title'));
|
751 |
echo '</p>';
|
752 |
|
753 |
echo '<p>';
|
755 |
$options['name'] = __('Name', 'avh-ec');
|
756 |
$options['count'] = __('Count', 'avh-ec');
|
757 |
$options['slug'] = __('Slug', 'avh-ec');
|
758 |
+
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_column'));
|
759 |
unset($options);
|
760 |
|
761 |
$options['asc'] = __('Ascending', 'avh-ec');
|
762 |
$options['desc'] = __('Descending', 'avh-ec');
|
763 |
+
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, avhGetArrayValue($instance, 'sort_order'));
|
764 |
unset($options);
|
765 |
|
766 |
$options['list'] = __('List', 'avh-ec');
|
767 |
$options['drop'] = __('Drop down', 'avh-ec');
|
768 |
+
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, avhGetArrayValue($instance, 'style'));
|
769 |
unset($options);
|
770 |
echo '</p>';
|
771 |
|
772 |
echo '<p>';
|
773 |
|
774 |
+
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) avhGetArrayValue($instance, 'rssfeed'));
|
775 |
|
776 |
+
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), avhGetArrayValue($instance, 'rssimage'));
|
777 |
echo '</p>';
|
778 |
|
779 |
echo '<p>';
|
781 |
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;">';
|
782 |
echo '<li id="' . $this->get_field_id('group_category--1') . '" class="popular-group_category">';
|
783 |
echo '<label for="' . $this->get_field_id('group_post_category') . '" class="selectit">';
|
784 |
+
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' : '') . '> ';
|
785 |
_e('Any Group', 'avh-ec');
|
786 |
echo '</label>';
|
787 |
echo '</li>';
|
805 |
|
806 |
$args = array('taxonomy' => 'avhec_catgroup', 'descendants_and_self' => 0, 'selected_cats' => array(), 'popular_cats' => array(), 'walker' => $walker, 'checked_ontop' => true);
|
807 |
|
808 |
+
if (is_array($selected_cats)) {
|
809 |
$args['selected_cats'] = $selected_cats;
|
810 |
+
} else {
|
811 |
$args['selected_cats'] = array();
|
812 |
+
}
|
813 |
|
814 |
$categories = (array) get_terms($args['taxonomy'], array('get' => 'all'));
|
815 |
|
825 |
}
|
826 |
|
827 |
// Put checked cats on top
|
828 |
+
echo $walker->walk($checked_categories, 0, $args);
|
829 |
// Then the rest of them
|
830 |
+
echo $walker->walk($categories, 0, $args);
|
831 |
}
|
832 |
|
833 |
public function getWidgetDoneCatGroup($id)
|
834 |
{
|
835 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
836 |
if (is_array($catgrp->widget_done_catgroup) && array_key_exists($id, $catgrp->widget_done_catgroup)) {
|
837 |
+
return true;
|
838 |
}
|
839 |
+
$catgrp->widget_done_catgroup[$id] = true;
|
840 |
|
841 |
+
return false;
|
842 |
}
|
843 |
}
|
844 |
|
869 |
*
|
870 |
* @since 2.1.0
|
871 |
*
|
872 |
+
* @param array $elements
|
873 |
+
* @param int $max_depth
|
874 |
+
* @param array $args;
|
875 |
* @return string
|
876 |
*/
|
877 |
+
public function walk($elements, $max_depth)
|
878 |
{
|
879 |
+
$args = array_slice(func_get_args(), 2);
|
880 |
$output = '';
|
881 |
|
882 |
+
if ($max_depth < -1) {
|
883 |
return $output;
|
884 |
+
}
|
885 |
|
886 |
+
if (empty($elements)) { // nothing to walk
|
887 |
return $output;
|
888 |
+
}
|
889 |
|
890 |
$id_field = $this->db_fields['id'];
|
891 |
$parent_field = $this->db_fields['parent'];
|
893 |
// flat display
|
894 |
if (-1 == $max_depth) {
|
895 |
$empty_array = array();
|
896 |
+
foreach ($elements as $e) {
|
897 |
$this->display_element($e, $empty_array, 1, 0, $args, $output);
|
898 |
+
}
|
899 |
|
900 |
return $output;
|
901 |
}
|
906 |
$top_level_elements = array();
|
907 |
$children_elements = array();
|
908 |
foreach ($elements as $e) {
|
909 |
+
if (0 == $e->$parent_field) {
|
910 |
$top_level_elements[] = $e;
|
911 |
+
} else {
|
912 |
$children_elements[$e->$parent_field][] = $e;
|
913 |
+
}
|
914 |
}
|
915 |
|
916 |
/*
|
924 |
$top_level_elements = array();
|
925 |
$children_elements = array();
|
926 |
foreach ($elements as $e) {
|
927 |
+
if ($root->$parent_field == $e->$parent_field) {
|
928 |
$top_level_elements[] = $e;
|
929 |
+
} else {
|
930 |
$children_elements[$e->$parent_field][] = $e;
|
931 |
+
}
|
932 |
}
|
933 |
}
|
934 |
|
935 |
+
foreach ($top_level_elements as $e) {
|
936 |
$this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
|
937 |
+
}
|
938 |
|
939 |
+
/*
|
940 |
* if we are displaying all levels, and remaining children_elements is not empty, then we got orphans, which should be displayed regardless
|
941 |
*/
|
942 |
if (($max_depth == 0) && count($children_elements) > 0) {
|
943 |
$empty_array = array();
|
944 |
+
foreach ($children_elements as $orphans) {
|
945 |
+
foreach ($orphans as $op) {
|
946 |
$this->display_element($op, $empty_array, 1, 0, $args, $output);
|
947 |
+
}
|
948 |
+
}
|
949 |
}
|
950 |
|
951 |
return $output;
|
952 |
}
|
953 |
|
954 |
+
public function start_lvl(&$output, $depth = 0, $args = array())
|
955 |
{
|
956 |
$indent = str_repeat("\t", $depth);
|
957 |
$output .= $indent . '<ul class="children">' . "\n";
|
958 |
}
|
959 |
|
960 |
+
public function end_lvl(&$output, $depth = 0, $args = array())
|
961 |
{
|
962 |
$indent = str_repeat("\t", $depth);
|
963 |
$output .= $indent . '</ul>' . "\n";
|
964 |
}
|
965 |
|
966 |
+
public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
|
967 |
{
|
968 |
extract($args);
|
969 |
+
if (!isset($selected_cats)) {
|
970 |
+
$selected_cats = array();
|
971 |
+
}
|
972 |
+
$input_id = $this->input_id . '-' . $object->term_id;
|
973 |
$output .= "\n" . '<li id="' . $this->li_id . '">';
|
974 |
$output .= '<label for="' . $input_id . '" class="selectit">';
|
975 |
+
$output .= '<input value="' . $object->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $object->term_id . ']" id="' . $input_id . '"' . (in_array($object->term_id, $selected_cats) ? ' checked="checked"' : "") . '/> ' . esc_html(apply_filters('the_category', $object->name)) . '</label>';
|
976 |
}
|
977 |
|
978 |
+
public function end_el(&$output, $object, $depth = 0, $args = array())
|
979 |
{
|
980 |
$output .= "</li>\n";
|
981 |
}
|
3.6/helpers/avh-common.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( !function_exists('avhGetArrayValue') ) {
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Get the value of $array[$name]
|
6 |
+
*
|
7 |
+
* @param array $array
|
8 |
+
* @param string $name
|
9 |
+
*
|
10 |
+
* @return mixed An empty string when the $array[$name] does not exists
|
11 |
+
*/
|
12 |
+
function avhGetArrayValue ($array, $name)
|
13 |
+
{
|
14 |
+
if ( isset($array[$name]) )
|
15 |
+
return $array[$name];
|
16 |
+
|
17 |
+
return '';
|
18 |
+
}
|
19 |
+
}
|
3.6/helpers/avh-forms.php
CHANGED
@@ -13,7 +13,7 @@ if (!function_exists('avh_doWidgetFormText')) {
|
|
13 |
|
14 |
if (!function_exists('avh_doWidgetFormCheckbox')) {
|
15 |
|
16 |
-
function avh_doWidgetFormCheckbox($field_id, $field_name, $description, $is_checked =
|
17 |
{
|
18 |
echo '<label for="' . $field_id . '">';
|
19 |
echo '<input class="checkbox" type="checkbox" id="' . $field_id . '" name="' . $field_name . '"' . ($is_checked ? ' CHECKED' : '') . ' /> ';
|
13 |
|
14 |
if (!function_exists('avh_doWidgetFormCheckbox')) {
|
15 |
|
16 |
+
function avh_doWidgetFormCheckbox($field_id, $field_name, $description, $is_checked = false)
|
17 |
{
|
18 |
echo '<label for="' . $field_id . '">';
|
19 |
echo '<input class="checkbox" type="checkbox" id="' . $field_id . '" name="' . $field_name . '"' . ($is_checked ? ' CHECKED' : '') . ' /> ';
|
Contributing.md
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AVH Extended Categories Contribution Guide
|
2 |
+
|
3 |
+
This page contains guidelines for contributing to AVH Extended Categories. Please review these guidelines before submitting any pull requests.
|
4 |
+
|
5 |
+
## Getting started
|
6 |
+
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
7 |
+
|
8 |
+
## Submitting an issue
|
9 |
+
|
10 |
+
* Submit a ticket for your issue, assuming one does not already exist.
|
11 |
+
* Clearly describe the issue including steps to reproduce when it is a bug.
|
12 |
+
* Make sure you fill in the earliest version that you know has the issue.
|
13 |
+
|
14 |
+
## Submitting a feature request
|
15 |
+
* Submit a ticket for your issue, assuming one does not already exist.
|
16 |
+
* The title of the ticket should start with `[Request]`
|
17 |
+
* Make sure you fill in the earliest version that you know has the issue.
|
18 |
+
|
19 |
+
## Translating
|
20 |
+
We have yet to find a good way to organize the translations for the AVH Extended Categories plugin. We have looked at several solutions but never really could decide one which works pretty good. If you have a suggestion please submit an issue and we'll lokk into it.
|
21 |
+
|
22 |
+
## For developers
|
23 |
+
|
24 |
+
### Getting started
|
25 |
+
* Fork the repository on GitHub
|
26 |
+
* We use [git-flow AVH Edition](https://github.com/petervanderdoes/gitflow) for our development.
|
27 |
+
|
28 |
+
### Which Branch?
|
29 |
+
|
30 |
+
**ALL** bug fixes should be made to the master branch. Bug fixes should never be sent to the `develop` branch unless they fix features that exist only in the upcoming release.
|
31 |
+
|
32 |
+
### Pull Requests
|
33 |
+
|
34 |
+
The pull request process differs for new features and bugs. Before sending a pull request for a new feature, you should first create an issue with `[Proposal]` in the title. The proposal should describe the new feature, as well as implementation ideas. The proposal will then be reviewed and either approved or denied. Once a proposal is approved, a pull request may be created implementing the new feature. Pull requests which do not follow this guideline will be closed immediately.
|
35 |
+
|
36 |
+
Pull requests for bugs may be sent without creating any proposal issue. If you believe that you know of a solution for a bug that has been filed on Github, please leave a comment detailing your proposed fix.
|
37 |
+
|
38 |
+
### Coding Guidelines
|
39 |
+
|
40 |
+
AVH Extended Categories tries to follow the [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md), [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) and [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) coding standards.
|
41 |
+
|
42 |
+
We understand the code is not fully compliant with the above guidelines and sometimes it can't be, but when coding do follow the guidelines as close as possible.
|
43 |
+
|
44 |
+
## Additional Resources
|
45 |
+
|
46 |
+
* [General GitHub documentation](http://help.github.com/)
|
47 |
+
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
libs/avh-common.php
CHANGED
@@ -1,100 +1,105 @@
|
|
1 |
<?php
|
2 |
if (! defined('AVH_FRAMEWORK'))
|
3 |
-
|
4 |
if (! class_exists('AVH_Common')) {
|
5 |
|
6 |
-
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
return;
|
22 |
-
}
|
23 |
|
24 |
-
|
25 |
-
|
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 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
}
|
56 |
|
57 |
-
|
58 |
-
|
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 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
22 |
+
return;
|
23 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
/**
|
26 |
+
* Returns the wordpress version
|
27 |
+
* Note: 2.7.x will return 2.7
|
28 |
+
*
|
29 |
+
* @return float
|
30 |
+
*/
|
31 |
+
public static function getWordpressVersion ()
|
32 |
+
{
|
33 |
+
static $_version = null;
|
34 |
+
if (! isset($_version)) {
|
35 |
+
// Include WordPress version
|
36 |
+
require (ABSPATH . WPINC . '/version.php');
|
37 |
+
$_version = (float) $wp_version;
|
38 |
+
}
|
|
|
39 |
|
40 |
+
return $_version;
|
41 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
+
/**
|
44 |
+
* Determines if the current version of PHP is greater then the supplied value
|
45 |
+
*
|
46 |
+
* @param string
|
47 |
+
* @return bool
|
48 |
+
*/
|
49 |
+
public static function isPHP ($version = '5.0.0')
|
50 |
+
{
|
51 |
+
static $_is_php = null;
|
52 |
+
$version = (string) $version;
|
53 |
+
if (! isset($_is_php[$version])) {
|
54 |
+
$_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? false : true;
|
55 |
+
}
|
56 |
+
|
57 |
+
return $_is_php[$version];
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Get the base directory of a directory structure
|
62 |
+
*
|
63 |
+
* @param string $directory
|
64 |
+
* @return string
|
65 |
+
*
|
66 |
+
*/
|
67 |
+
public static function getBaseDirectory ($directory)
|
68 |
+
{
|
69 |
+
//get public directory structure eg "/top/second/third"
|
70 |
+
$public_directory = dirname($directory);
|
71 |
+
//place each directory into array
|
72 |
+
$directory_array = explode('/', $public_directory);
|
73 |
+
//get highest or top level in array of directory strings
|
74 |
+
$public_base = max($directory_array);
|
75 |
+
|
76 |
+
return $public_base;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* 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.
|
81 |
+
* Kind => Input => Return => long2ip(Return)
|
82 |
+
* DottedQuadDec => 192.168.255.109 => 3232300909 => 192.168.255.109
|
83 |
+
* PosIntStr => 3232300909 => 3232300909 => 192.168.255.109
|
84 |
+
* NegIntStr => -1062666387 => 3232300909 => 192.168.255.109
|
85 |
+
* PosInt => 3232300909 => 3232300909 => 192.168.255.109
|
86 |
+
* NegInt => -1062666387 => 3232300909 => 192.168.255.109
|
87 |
+
* DottedQuadHex => 0xc0.0xA8.0xFF.0x6D => 0 => 0.0.0.0
|
88 |
+
* DottedQuadOct => 0300.0250.0377.0155 => 0 => 0.0.0.0
|
89 |
+
* HexIntStr => 0xC0A8FF6D => 0 => 0.0.0.0
|
90 |
+
* HexInt => 3232300909 => 3232300909 => 192.168.255.109
|
91 |
+
*
|
92 |
+
* @param string/numeric $ip
|
93 |
+
*/
|
94 |
+
public static function getIp2long ($ip)
|
95 |
+
{
|
96 |
+
if (is_numeric($ip)) {
|
97 |
+
$return = sprintf("%u", floatval($ip));
|
98 |
+
} else {
|
99 |
+
$return = sprintf("%u", floatval(ip2long($ip)));
|
100 |
+
}
|
101 |
+
|
102 |
+
return $return;
|
103 |
+
}
|
104 |
+
}
|
105 |
}
|
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.6.1
|
7 |
-
Stable tag: 3.8.
|
8 |
|
9 |
The AVH Extended Categories Widgets gives you three widgets for displaying categories.
|
10 |
== Description ==
|
@@ -58,7 +58,7 @@ You can set the following options for the Category Group Widget:
|
|
58 |
* Set the default group when editing or creating a post.
|
59 |
|
60 |
You can also select not to show the Category Group widget by selecting the group: None
|
61 |
-
|
62 |
Translations:
|
63 |
|
64 |
* Czech - Čeština (cs_CZ)
|
@@ -75,6 +75,11 @@ Translations:
|
|
75 |
|
76 |
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.
|
77 |
|
|
|
|
|
|
|
|
|
|
|
78 |
== Installation ==
|
79 |
|
80 |
The AVH Extended Categories Widgets can be installed in 3 easy steps:
|
@@ -85,11 +90,10 @@ The AVH Extended Categories Widgets can be installed in 3 easy steps:
|
|
85 |
|
86 |
1. Go to the Presentation/Appearance->Widgets page and drag the widget into the sidebar of your choice. Configuration of the widget is done like all other widgets.
|
87 |
|
88 |
-
|
89 |
== Support ==
|
90 |
|
91 |
= What about support? =
|
92 |
-
|
93 |
|
94 |
= Depth selection =
|
95 |
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.
|
@@ -102,7 +106,7 @@ I have setup a project in [Launchpad](https://translations.launchpad.net/avhexte
|
|
102 |
|
103 |
= Multiple Category Groups =
|
104 |
The following is an explanation how assigning multiple groups to page/post works.
|
105 |
-
|
106 |
Lets say you have the following groups:
|
107 |
Free Time
|
108 |
Theater
|
@@ -135,6 +139,10 @@ Whether Widget 2 shows Movie or Music depends on the creation order of groups. I
|
|
135 |
None
|
136 |
|
137 |
== Changelog ==
|
|
|
|
|
|
|
|
|
138 |
= Version 3.8.2 =
|
139 |
* WordPress plugin page is no longer available.
|
140 |
|
@@ -226,7 +234,7 @@ None
|
|
226 |
|
227 |
= Version 3.2.2 =
|
228 |
* Bugfix: Problem with Chrome and saving the category group.
|
229 |
-
* Bugfix: Extra metabox displayed. The plugin uses it's own metabox for Category Group selection.
|
230 |
|
231 |
= Version 3.2.1 =
|
232 |
* Speed improvements in the admin section when there are a lot of categories and several Categories widgets.
|
@@ -250,7 +258,7 @@ None
|
|
250 |
|
251 |
= Version 3.0.2 =
|
252 |
* Bugfix: The plugin conflicts with the standard theme/plugin editor in WordPress
|
253 |
-
|
254 |
= Version 3.0.1 =
|
255 |
* Bugfix: Definition of the metabox for post/page in the wrong place
|
256 |
|
@@ -278,7 +286,7 @@ None
|
|
278 |
= Version 2.3.1 =
|
279 |
* Bugfix: Undefined function
|
280 |
|
281 |
-
= Version 2.3 =
|
282 |
* RFC: You can change the text Select Category, without editing any translation file.
|
283 |
* Bugfix: Selecting one parent wouldn't show it's children.
|
284 |
* You can now display only selected categories. This didn't work properly in an hierachical category structure.
|
@@ -287,7 +295,7 @@ None
|
|
287 |
= Version 2.2 =
|
288 |
* RFC: Internationalization of the plug-in.
|
289 |
* Bugfix: W3 Validation Errors when using drop down categories.
|
290 |
-
* Added option to exclude categories from displaying instead of including them. (Compliments to: Jose Luis Moya - http://www.alsur.es )
|
291 |
|
292 |
= Version 2.1 =
|
293 |
* RFC: The path for the RSS image can be URI.
|
4 |
Tags: extended, categories, widget, top categories
|
5 |
Requires at least: 2.3
|
6 |
Tested up to: 3.6.1
|
7 |
+
Stable tag: 3.8.3
|
8 |
|
9 |
The AVH Extended Categories Widgets gives you three widgets for displaying categories.
|
10 |
== Description ==
|
58 |
* Set the default group when editing or creating a post.
|
59 |
|
60 |
You can also select not to show the Category Group widget by selecting the group: None
|
61 |
+
|
62 |
Translations:
|
63 |
|
64 |
* Czech - Čeština (cs_CZ)
|
75 |
|
76 |
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.
|
77 |
|
78 |
+
= Get involved =
|
79 |
+
|
80 |
+
Bugs and feature requests can be submitted at the [AVH Extended Categories GitHub Repository](https://github.com/petervanderdoes/AVH-Extended-Categories/blob/develop/Contributing.md).
|
81 |
+
Developers can checkout and contribute to the source code on the [AVH Extended Categories GitHub Repository](https://github.com/petervanderdoes/AVH-Extended-Categories/blob/develop/Contributing.md).
|
82 |
+
|
83 |
== Installation ==
|
84 |
|
85 |
The AVH Extended Categories Widgets can be installed in 3 easy steps:
|
90 |
|
91 |
1. Go to the Presentation/Appearance->Widgets page and drag the widget into the sidebar of your choice. Configuration of the widget is done like all other widgets.
|
92 |
|
|
|
93 |
== Support ==
|
94 |
|
95 |
= What about support? =
|
96 |
+
Support is done through WordPress.org
|
97 |
|
98 |
= Depth selection =
|
99 |
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.
|
106 |
|
107 |
= Multiple Category Groups =
|
108 |
The following is an explanation how assigning multiple groups to page/post works.
|
109 |
+
|
110 |
Lets say you have the following groups:
|
111 |
Free Time
|
112 |
Theater
|
139 |
None
|
140 |
|
141 |
== Changelog ==
|
142 |
+
= Version 3.8.3 =
|
143 |
+
* Bugfix: Widget would not keep checked categories
|
144 |
+
* Bugfix: Several PHP warnings and notices are shown.
|
145 |
+
|
146 |
= Version 3.8.2 =
|
147 |
* WordPress plugin page is no longer available.
|
148 |
|
234 |
|
235 |
= Version 3.2.2 =
|
236 |
* Bugfix: Problem with Chrome and saving the category group.
|
237 |
+
* Bugfix: Extra metabox displayed. The plugin uses it's own metabox for Category Group selection.
|
238 |
|
239 |
= Version 3.2.1 =
|
240 |
* Speed improvements in the admin section when there are a lot of categories and several Categories widgets.
|
258 |
|
259 |
= Version 3.0.2 =
|
260 |
* Bugfix: The plugin conflicts with the standard theme/plugin editor in WordPress
|
261 |
+
|
262 |
= Version 3.0.1 =
|
263 |
* Bugfix: Definition of the metabox for post/page in the wrong place
|
264 |
|
286 |
= Version 2.3.1 =
|
287 |
* Bugfix: Undefined function
|
288 |
|
289 |
+
= Version 2.3 =
|
290 |
* RFC: You can change the text Select Category, without editing any translation file.
|
291 |
* Bugfix: Selecting one parent wouldn't show it's children.
|
292 |
* You can now display only selected categories. This didn't work properly in an hierachical category structure.
|
295 |
= Version 2.2 =
|
296 |
* RFC: Internationalization of the plug-in.
|
297 |
* Bugfix: W3 Validation Errors when using drop down categories.
|
298 |
+
* Added option to exclude categories from displaying instead of including them. (Compliments to: Jose Luis Moya - http://www.alsur.es )
|
299 |
|
300 |
= Version 2.1 =
|
301 |
* RFC: The path for the RSS image can be URI.
|
widget_extended_categories.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.8.
|
7 |
* Author: Peter van der Does
|
8 |
* Author URI: http://blog.avirtualhome.com/
|
9 |
*
|
@@ -23,52 +23,48 @@
|
|
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 |
-
|
28 |
-
define('AVH_FRAMEWORK', true);
|
29 |
}
|
30 |
require (ABSPATH . WPINC . '/version.php');
|
31 |
$_avhec_version = (float) $wp_version;
|
32 |
|
33 |
if ($_avhec_version >= 2.8) {
|
34 |
-
|
35 |
-
|
36 |
-
require_once ($_avhec_abs_dir . '/libs/avh-registry.php');
|
37 |
-
require_once ($_avhec_abs_dir . '/libs/avh-common.php');
|
38 |
-
require_once ($_avhec_abs_dir . '/libs/avh-security.php');
|
39 |
-
require_once ($_avhec_abs_dir . '/libs/avh-visitor.php');
|
40 |
-
require_once ($_avhec_abs_dir . '/libs/avh-db.php');
|
41 |
-
|
42 |
-
switch ($_avhec_version) {
|
43 |
-
case ($_avhec_version >= 3.6):
|
44 |
-
$_avhec_version_dir = '/3.6';
|
45 |
-
break;
|
46 |
-
case ($_avhec_version >= 3.3):
|
47 |
-
$_avhec_version_dir = '/3.3';
|
48 |
-
break;
|
49 |
-
case ($_avhec_version >= 2.8):
|
50 |
-
$_avhec_version_dir = '/2.8';
|
51 |
-
break;
|
52 |
|
53 |
-
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
define('AVHEC_PLUGIN_URL', $_avhec_url . $_avhec_version_dir);
|
61 |
-
define('AVHEC_ABSOLUTE_WORKING_DIR', AVHEC_PLUGIN_DIR . $_avhec_version_dir);
|
62 |
-
define('AVHEC_RELATIVE_WORKING_DIR', $_avhec_dir . $_avhec_version_dir);
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
require (AVHEC_ABSOLUTE_WORKING_DIR . '/avh-ec.client.php');
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
} else {
|
72 |
-
|
73 |
}
|
74 |
-
?>
|
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.8.3
|
7 |
* Author: Peter van der Does
|
8 |
* Author URI: http://blog.avirtualhome.com/
|
9 |
*
|
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 = dirname(__FILE__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 >= 3.6):
|
43 |
+
$_avhec_version_dir = '/3.6';
|
44 |
+
break;
|
45 |
+
case ($_avhec_version >= 3.3):
|
46 |
+
$_avhec_version_dir = '/3.3';
|
47 |
+
break;
|
48 |
+
case ($_avhec_version >= 2.8):
|
49 |
+
$_avhec_version_dir = '/2.8';
|
50 |
+
break;
|
51 |
+
}
|
52 |
|
53 |
+
$_avhec_dir = basename($_avhec_abs_dir);
|
54 |
+
$_avhec_url = plugins_url() . '/' . $_avhec_dir;
|
|
|
|
|
|
|
55 |
|
56 |
+
define('AVHEC_PLUGIN_DIR', $_avhec_abs_dir);
|
57 |
+
define('AVHEC_RELATIVE_PLUGIN_DIR', $_avhec_dir);
|
58 |
+
define('AVHEC_PLUGIN_URL', $_avhec_url . $_avhec_version_dir);
|
59 |
+
define('AVHEC_ABSOLUTE_WORKING_DIR', AVHEC_PLUGIN_DIR . $_avhec_version_dir);
|
60 |
+
define('AVHEC_RELATIVE_WORKING_DIR', $_avhec_dir . $_avhec_version_dir);
|
|
|
61 |
|
62 |
+
unset($_avhec_version);
|
63 |
+
unset($_avhec_dir);
|
64 |
+
unset($_avhec_abs_dir);
|
65 |
+
unset($_avhec_version_dir);
|
66 |
+
unset($_avhec_url);
|
67 |
+
require (AVHEC_ABSOLUTE_WORKING_DIR . '/avh-ec.client.php');
|
68 |
} else {
|
69 |
+
require_once 'widget-pre2.8.php';
|
70 |
}
|
|