Version Description
Download this release
Release Info
Developer | petervanderdoes |
Plugin | AVH Extended Categories Widgets |
Version | 3.6.6 |
Comparing to | |
See all releases |
Code changes from version 3.6.5 to 3.6.6
- 2.8/class/avh-ec.core.php +1 -1
- 3.3/class/avh-ec.admin.php +1 -1
- 3.3/class/avh-ec.core.php +1 -1
- {trunk/lang → lang}/avh-ec-fr_FR.mo +0 -0
- {trunk/lang → lang}/avh-ec-fr_FR.po +0 -0
- libs/avh-db.php +6 -6
- readme.txt +8 -2
- trunk/2.8/avh-ec.client.php +0 -82
- trunk/2.8/class/avh-ec.admin.php +0 -1517
- trunk/2.8/class/avh-ec.category-group.php +0 -409
- trunk/2.8/class/avh-ec.core.php +0 -736
- trunk/2.8/class/avh-ec.widgets.php +0 -1001
- trunk/2.8/css/avh-ec.admin.css +0 -150
- trunk/2.8/css/avh-ec.widget.css +0 -12
- trunk/2.8/helpers/avh-forms.php +0 -44
- trunk/2.8/images/us_banner_logow_120x60.gif +0 -0
- trunk/2.8/js/avh-ec.admin.manualorder.closure.js +0 -1
- trunk/2.8/js/avh-ec.admin.manualorder.js +0 -19
- trunk/2.8/js/avh-ec.categorygroup.closure.js +0 -1
- trunk/2.8/js/avh-ec.categorygroup.js +0 -21
- trunk/2.8/js/avh-ec.categorygroup.js.closure.js +0 -1
- trunk/3.3/avh-ec.client.php +0 -82
- trunk/3.3/class/avh-ec.admin.php +0 -1490
- trunk/3.3/class/avh-ec.category-group.php +0 -411
- trunk/3.3/class/avh-ec.core.php +0 -759
- trunk/3.3/class/avh-ec.widgets.php +0 -1004
- trunk/3.3/css/avh-ec.admin.css +0 -155
- trunk/3.3/css/avh-ec.widget.css +0 -12
- trunk/3.3/helpers/avh-forms.php +0 -44
- trunk/3.3/images/us_banner_logow_120x60.gif +0 -0
- trunk/3.3/js/avh-ec.admin.manualorder.closure.js +0 -1
- trunk/3.3/js/avh-ec.admin.manualorder.js +0 -19
- trunk/3.3/js/avh-ec.categorygroup.closure.js +0 -1
- trunk/3.3/js/avh-ec.categorygroup.js +0 -21
- trunk/lang/avh-ec-cs_CZ.mo +0 -0
- trunk/lang/avh-ec-de_DE.mo +0 -0
- trunk/lang/avh-ec-el.mo +0 -0
- trunk/lang/avh-ec-en_US.mo +0 -0
- trunk/lang/avh-ec-es_ES.mo +0 -0
- trunk/lang/avh-ec-id_ID.mo +0 -0
- trunk/lang/avh-ec-it_IT.mo +0 -0
- trunk/lang/avh-ec-nl_NL.mo +0 -0
- trunk/lang/avh-ec-ru_RU.mo +0 -0
- trunk/lang/avh-ec-sv_SE.mo +0 -0
- trunk/lang/avh-ec-tr.mo +0 -0
- trunk/lang/avh-ec.mo +0 -0
- trunk/lang/avh-ec.po +0 -1056
- trunk/libs/avh-common.php +0 -100
- trunk/libs/avh-db.php +0 -67
- trunk/libs/avh-registry.php +0 -144
- trunk/libs/avh-security.php +0 -47
- trunk/libs/avh-visitor.php +0 -60
- trunk/readme.txt +0 -310
- trunk/uninstall.php +0 -14
- trunk/widget-pre2.8.php +0 -482
- trunk/widget_extended_categories.php +0 -69
- widget_extended_categories.php +1 -1
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.6.
|
31 |
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
32 |
$this->db_options_core = 'avhec';
|
33 |
$this->db_options_tax_meta = 'avhec-tax_meta';
|
27 |
*/
|
28 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
|
30 |
+
$this->version = '3.6.6';
|
31 |
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
32 |
$this->db_options_core = 'avhec';
|
33 |
$this->db_options_tax_meta = 'avhec-tax_meta';
|
3.3/class/avh-ec.admin.php
CHANGED
@@ -1136,7 +1136,7 @@ class AVH_EC_Admin
|
|
1136 |
*/
|
1137 |
function filterManageCategoriesGroupColumns ($columns)
|
1138 |
{
|
1139 |
-
$categories_group_columns = array ( 'name' => __('Name', 'avh-ec'), 'slug' => 'Slug', 'widget-title' => __('Widget Title', 'avh-ec'), 'description' => __('Description', 'avh-ec'), 'cat-in-group' => __('Categories in the group', 'avh-ec') );
|
1140 |
return $categories_group_columns;
|
1141 |
}
|
1142 |
|
1136 |
*/
|
1137 |
function filterManageCategoriesGroupColumns ($columns)
|
1138 |
{
|
1139 |
+
$categories_group_columns = array ( 'name' => __('Name', 'avh-ec'), 'slug' => __('Slug', 'avh-ec'), 'widget-title' => __('Widget Title', 'avh-ec'), 'description' => __('Description', 'avh-ec'), 'cat-in-group' => __('Categories in the group', 'avh-ec') );
|
1140 |
return $categories_group_columns;
|
1141 |
}
|
1142 |
|
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.6.
|
31 |
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
32 |
$this->db_options_core = 'avhec';
|
33 |
$this->db_options_tax_meta = 'avhec-tax_meta';
|
27 |
*/
|
28 |
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
|
30 |
+
$this->version = '3.6.6';
|
31 |
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
32 |
$this->db_options_core = 'avhec';
|
33 |
$this->db_options_tax_meta = 'avhec-tax_meta';
|
{trunk/lang → lang}/avh-ec-fr_FR.mo
RENAMED
File without changes
|
{trunk/lang → lang}/avh-ec-fr_FR.po
RENAMED
File without changes
|
libs/avh-db.php
CHANGED
@@ -16,13 +16,13 @@ if (! class_exists('AVH_DB')) {
|
|
16 |
public function getFieldNames ($table = '')
|
17 |
{
|
18 |
global $wpdb;
|
19 |
-
|
20 |
$retval = wp_cache_get('field_names_' . $table, 'avhec');
|
21 |
if (false === $retval) {
|
22 |
$sql = $this->_getQueryShowColumns($table);
|
23 |
-
|
24 |
$result = $wpdb->get_results($sql, ARRAY_A);
|
25 |
-
|
26 |
$retval = array ();
|
27 |
foreach ($result as $row) {
|
28 |
if (isset($row['Field'])) {
|
@@ -31,7 +31,7 @@ if (! class_exists('AVH_DB')) {
|
|
31 |
}
|
32 |
wp_cache_set('field_names_' . $table, $retval,'avhec',3600);
|
33 |
}
|
34 |
-
|
35 |
return $retval;
|
36 |
}
|
37 |
|
@@ -59,8 +59,8 @@ if (! class_exists('AVH_DB')) {
|
|
59 |
private function _getQueryShowColumns ($table = '')
|
60 |
{
|
61 |
global $wpdb;
|
62 |
-
return $wpdb->prepare('SHOW COLUMNS FROM '
|
63 |
-
|
64 |
}
|
65 |
}
|
66 |
}
|
16 |
public function getFieldNames ($table = '')
|
17 |
{
|
18 |
global $wpdb;
|
19 |
+
|
20 |
$retval = wp_cache_get('field_names_' . $table, 'avhec');
|
21 |
if (false === $retval) {
|
22 |
$sql = $this->_getQueryShowColumns($table);
|
23 |
+
|
24 |
$result = $wpdb->get_results($sql, ARRAY_A);
|
25 |
+
|
26 |
$retval = array ();
|
27 |
foreach ($result as $row) {
|
28 |
if (isset($row['Field'])) {
|
31 |
}
|
32 |
wp_cache_set('field_names_' . $table, $retval,'avhec',3600);
|
33 |
}
|
34 |
+
|
35 |
return $retval;
|
36 |
}
|
37 |
|
59 |
private function _getQueryShowColumns ($table = '')
|
60 |
{
|
61 |
global $wpdb;
|
62 |
+
return $wpdb->prepare('SHOW COLUMNS FROM %s', $table);
|
63 |
+
|
64 |
}
|
65 |
}
|
66 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: petervanderdoes
|
|
3 |
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.
|
7 |
-
Stable tag: 3.6.
|
8 |
|
9 |
The AVH Extended Categories Widgets gives you three widgets for displaying categories.
|
10 |
== Description ==
|
@@ -65,6 +65,7 @@ Translations:
|
|
65 |
* Dutch - Nederlands (nl_NL)
|
66 |
* German - Deutsch (de_DE)
|
67 |
* Greek (el)
|
|
|
68 |
* Indonesian - Bahasa Indonesia (id_ID)
|
69 |
* Italian - Italiano (it_IT)
|
70 |
* Russian — Русский (ru_RU)
|
@@ -134,6 +135,11 @@ Whether Widget 2 shows Movie or Music depends on the creation order of groups. I
|
|
134 |
None
|
135 |
|
136 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
137 |
= Version 3.6.5 =
|
138 |
* Bugfix: Can not delete category groups
|
139 |
|
3 |
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.5
|
7 |
+
Stable tag: 3.6.6
|
8 |
|
9 |
The AVH Extended Categories Widgets gives you three widgets for displaying categories.
|
10 |
== Description ==
|
65 |
* Dutch - Nederlands (nl_NL)
|
66 |
* German - Deutsch (de_DE)
|
67 |
* Greek (el)
|
68 |
+
* French - Français (fr_FR)
|
69 |
* Indonesian - Bahasa Indonesia (id_ID)
|
70 |
* Italian - Italiano (it_IT)
|
71 |
* Russian — Русский (ru_RU)
|
135 |
None
|
136 |
|
137 |
== Changelog ==
|
138 |
+
= Version 3.6.6 =
|
139 |
+
* Missed a translatable string.
|
140 |
+
* Add French translation.
|
141 |
+
* Fix for WordPress 3.5
|
142 |
+
|
143 |
= Version 3.6.5 =
|
144 |
* Bugfix: Can not delete category groups
|
145 |
|
trunk/2.8/avh-ec.client.php
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Singleton Class
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class AVH_EC_Singleton
|
8 |
-
{
|
9 |
-
|
10 |
-
/**
|
11 |
-
*
|
12 |
-
* @param $class
|
13 |
-
* @param $arg1
|
14 |
-
*/
|
15 |
-
function &getInstance ($class, $arg1 = null)
|
16 |
-
{
|
17 |
-
static $instances = array(); // array of instance names
|
18 |
-
if (array_key_exists($class, $instances)) {
|
19 |
-
$instance = & $instances[$class];
|
20 |
-
} else {
|
21 |
-
if (! class_exists($class)) {
|
22 |
-
switch ($class) {
|
23 |
-
case 'AVH_EC_Core':
|
24 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.core.php');
|
25 |
-
break;
|
26 |
-
case 'AVH_EC_Category_Group':
|
27 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.category-group.php');
|
28 |
-
break;
|
29 |
-
case 'AVH_EC_Widget_Helper_Class':
|
30 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widget-helper.php');
|
31 |
-
break;
|
32 |
-
}
|
33 |
-
}
|
34 |
-
$instances[$class] = new $class($arg1);
|
35 |
-
$instance = & $instances[$class];
|
36 |
-
}
|
37 |
-
return $instance;
|
38 |
-
} // getInstance
|
39 |
-
} // singleton
|
40 |
-
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Include the necessary files
|
44 |
-
*
|
45 |
-
*/
|
46 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-forms.php');
|
47 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widgets.php');
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Initialize the plugin
|
51 |
-
*
|
52 |
-
*/
|
53 |
-
function avhextendedcategories_init ()
|
54 |
-
{
|
55 |
-
// Admin
|
56 |
-
if (is_admin()) {
|
57 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.admin.php');
|
58 |
-
$avhec_admin = new AVH_EC_Admin();
|
59 |
-
}
|
60 |
-
AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
61 |
-
|
62 |
-
add_action('widgets_init', 'avhextendedcategories_widgets_init');
|
63 |
-
|
64 |
-
} // End avhamazon_init()
|
65 |
-
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Register the widget
|
69 |
-
*
|
70 |
-
* @WordPress Action widgets_init
|
71 |
-
* @since 3.0
|
72 |
-
*
|
73 |
-
*/
|
74 |
-
function avhextendedcategories_widgets_init ()
|
75 |
-
{
|
76 |
-
register_widget('WP_Widget_AVH_ExtendedCategories_Normal');
|
77 |
-
register_widget('WP_Widget_AVH_ExtendedCategories_Top');
|
78 |
-
register_widget('WP_Widget_AVH_ExtendedCategories_Category_Group');
|
79 |
-
}
|
80 |
-
|
81 |
-
add_action('plugins_loaded', 'avhextendedcategories_init');
|
82 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/class/avh-ec.admin.php
DELETED
@@ -1,1517 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class AVH_EC_Admin
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
*
|
7 |
-
* @var AVH_EC_Core
|
8 |
-
*/
|
9 |
-
var $core;
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* @var AVH_EC_Category_Group
|
14 |
-
*/
|
15 |
-
var $catgrp;
|
16 |
-
|
17 |
-
var $hooks = array();
|
18 |
-
var $message;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHP5 constructor
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
function __construct ()
|
25 |
-
{
|
26 |
-
|
27 |
-
// Initialize the plugin
|
28 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
29 |
-
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
30 |
-
|
31 |
-
add_action('wp_ajax_delete-group', array(&$this, 'ajaxDeleteGroup'));
|
32 |
-
|
33 |
-
// Admin menu
|
34 |
-
add_action('admin_init', array(&$this,'actionAdminInit'));
|
35 |
-
add_action('admin_menu', array(&$this, 'actionAdminMenu'));
|
36 |
-
add_filter('plugin_action_links_extended-categories-widget/widget_extended_categories.php', array(&$this, 'filterPluginActions'), 10, 2);
|
37 |
-
|
38 |
-
// Actions used for editing posts
|
39 |
-
add_action('load-post.php', array(&$this, 'actionLoadPostPage'));
|
40 |
-
add_action('load-page.php', array(&$this, 'actionLoadPostPage'));
|
41 |
-
|
42 |
-
// Actions related to adding and deletes categories
|
43 |
-
add_action("created_category", array($this, 'actionCreatedCategory'), 10, 2);
|
44 |
-
add_action("delete_category", array($this, 'actionDeleteCategory'), 10, 2);
|
45 |
-
|
46 |
-
add_filter('manage_categories_group_columns', array(&$this, 'filterManageCategoriesGroupColumns'));
|
47 |
-
add_filter('explain_nonce_delete-avhecgroup', array(&$this, 'filterExplainNonceDeleteGroup'), 10, 2);
|
48 |
-
|
49 |
-
return;
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* PHP4 Constructor
|
54 |
-
*
|
55 |
-
*/
|
56 |
-
function AVH_EC_Admin ()
|
57 |
-
{
|
58 |
-
$this->__construct();
|
59 |
-
}
|
60 |
-
|
61 |
-
function actionAdminInit() {
|
62 |
-
if (is_admin() && isset($_GET['taxonomy']) && 'category' == $_GET['taxonomy']) {
|
63 |
-
add_action($_GET['taxonomy'] . '_edit_form', array(&$this,'displayCategoryGroupForm'), 10, 2 );
|
64 |
-
}
|
65 |
-
add_action('edit_term', array(&$this,'handleEditTerm'), 10, 3 );
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
*
|
71 |
-
* Adds Category Group form
|
72 |
-
* @WordPress action category_edit_form
|
73 |
-
*
|
74 |
-
* @param unknown_type $term
|
75 |
-
* @param unknown_type $taxonomy
|
76 |
-
*/
|
77 |
-
function displayCategoryGroupForm($term, $taxonomy){
|
78 |
-
|
79 |
-
$current_selection = '';
|
80 |
-
$tax_meta = get_option($this->core->db_options_tax_meta);
|
81 |
-
if ( isset($tax_meta[$taxonomy][$term->term_id]) ) {
|
82 |
-
$tax_meta = $tax_meta[$taxonomy][$term->term_id];
|
83 |
-
$current_selection = $tax_meta['category_group_term_id'];
|
84 |
-
}
|
85 |
-
|
86 |
-
if (empty($current_selection)) {
|
87 |
-
$current_group = $this->catgrp->getGroupByCategoryID($term->term_id);
|
88 |
-
$current_selection= $current_group->term_id;
|
89 |
-
}
|
90 |
-
|
91 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
|
92 |
-
foreach ($cat_groups as $group) {
|
93 |
-
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
94 |
-
$dropdown_value[] = $group->term_id;
|
95 |
-
$dropdown_text[] = $temp_cat->name;
|
96 |
-
}
|
97 |
-
|
98 |
-
foreach ( $dropdown_value as $key => $sel) {
|
99 |
-
$seldata .= '<option value="' . esc_attr($sel) . '" ' . (($current_selection == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($dropdown_text[$key])) . '</option>' . "\n";
|
100 |
-
}
|
101 |
-
|
102 |
-
echo '<h3>AVH Extended Categories - Category Group Widget</h3>';
|
103 |
-
echo '<table class="form-table"><tbody>';
|
104 |
-
echo '<tr class="form-field">';
|
105 |
-
echo '<th valign="top" scope="row">';
|
106 |
-
echo '<label for="avhec_categorygroup">Category Group</label></th>';
|
107 |
-
echo '<td>';
|
108 |
-
echo '<select id="avhec_categorygroup" name="avhec_categorygroup">';
|
109 |
-
echo $seldata;
|
110 |
-
echo '</select>';
|
111 |
-
echo '<p class="description">Select the category group to show on the archive page.</p>';
|
112 |
-
echo '</td>';
|
113 |
-
echo '</tr>';
|
114 |
-
echo '</tbody></table>';
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Saves the association Category - Category Group fron the edit taxonomy page
|
119 |
-
* @WordPress action edit_form.
|
120 |
-
*
|
121 |
-
* @param unknown_type $term_id
|
122 |
-
* @param unknown_type $tt_id
|
123 |
-
* @param unknown_type $taxonomy
|
124 |
-
*/
|
125 |
-
function handleEditTerm( $term_id, $tt_id, $taxonomy ) {
|
126 |
-
$tax_meta = get_option($this->core->db_options_tax_meta);
|
127 |
-
if ( isset($_POST['avhec_categorygroup']) && $tax_meta[$taxonomy][$term_id]['category_group_term_id'] != $_POST['avhec_categorygroup']) {
|
128 |
-
$tax_meta[$taxonomy][$term_id]['category_group_term_id'] = $_POST['avhec_categorygroup'];
|
129 |
-
update_option($this->core->db_options_tax_meta, $tax_meta);
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* When a category is created this function is called to add the new category to the group all
|
135 |
-
* @param $term_id
|
136 |
-
* @param $term_taxonomy_id
|
137 |
-
*/
|
138 |
-
function actionCreatedCategory ($term_id, $term_taxonomy_id)
|
139 |
-
{
|
140 |
-
$group_id = $this->catgrp->getTermIDBy('slug', 'all');
|
141 |
-
$this->catgrp->setCategoriesForGroup($group_id, (array) $term_id);
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
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 $term_taxonomy_id
|
149 |
-
*/
|
150 |
-
function actionDeleteCategory ($term_id, $term_taxonomy_id)
|
151 |
-
{
|
152 |
-
$this->catgrp->doDeleteCategoryFromGroup($term_id);
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Enqueues the style on the post.php and page.php pages
|
157 |
-
* @WordPress Action load-$pagenow
|
158 |
-
*
|
159 |
-
*/
|
160 |
-
function actionLoadPostPage ()
|
161 |
-
{
|
162 |
-
wp_enqueue_style('avhec-admin-css');
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Add the Tools and Options to the Management and Options page repectively
|
167 |
-
*
|
168 |
-
* @WordPress Action admin_menu
|
169 |
-
*
|
170 |
-
*/
|
171 |
-
function actionAdminMenu ()
|
172 |
-
{
|
173 |
-
|
174 |
-
// Register Style and Scripts
|
175 |
-
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.closure';
|
176 |
-
wp_register_script('avhec-categorygroup-js', AVHEC_PLUGIN_URL . '/js/avh-ec.categorygroup' . $suffix . '.js', array('jquery'), $this->core->version, true);
|
177 |
-
wp_register_script('avhec-manualorder', AVHEC_PLUGIN_URL . '/js/avh-ec.admin.manualorder' . $suffix . '.js', array ( 'jquery-ui-sortable' ), $this->core->version, false);
|
178 |
-
wp_register_style('avhec-admin-css', AVHEC_PLUGIN_URL . '/css/avh-ec.admin.css', array('wp-admin'), $this->core->version, 'screen');
|
179 |
-
|
180 |
-
// Add menu system
|
181 |
-
$folder = $this->core->getBaseDirectory(AVHEC_PLUGIN_DIR);
|
182 |
-
add_menu_page('AVH Extended Categories', 'AVH Extended Categories', 'manage_options', $folder, array(&$this, 'doMenuOverview'));
|
183 |
-
$this->hooks['menu_overview'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Overview', 'avh-ec'), __('Overview', 'avh-ec'), 'manage_options', $folder, array(&$this, 'doMenuOverview'));
|
184 |
-
$this->hooks['menu_general'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('General Options', 'avh-ec'), __('General Options', 'avh-ec'), 'manage_options', 'avhec-general', array(&$this, 'doMenuGeneral'));
|
185 |
-
$this->hooks['menu_category_groups'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Category Groups', 'avh-ec'), __('Category Groups', 'avh-ec'), 'manage_options', 'avhec-grouped', array(&$this, 'doMenuCategoryGroup'));
|
186 |
-
$this->hooks['menu_manual_order'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Manually Order', 'avh-ec'), __('Manually Order', 'avh-ec'), 'manage_options', 'avhec-manual-order', array(&$this, 'doMenuManualOrder'));
|
187 |
-
$this->hooks['menu_faq'] = add_submenu_page($folder, 'AVH Extended Categories:' . __('F.A.Q', 'avh-ec'), __('F.A.Q', 'avh-ec'), 'manage_options', 'avhec-faq', array(&$this, 'doMenuFAQ'));
|
188 |
-
|
189 |
-
// Add actions for menu pages
|
190 |
-
// Overview Menu
|
191 |
-
add_action('load-' . $this->hooks['menu_overview'], array(&$this, 'actionLoadPageHook_Overview'));
|
192 |
-
|
193 |
-
// General Options Menu
|
194 |
-
add_action('load-' . $this->hooks['menu_general'], array(&$this, 'actionLoadPageHook_General'));
|
195 |
-
|
196 |
-
// Category Groups Menu
|
197 |
-
add_action('load-' . $this->hooks['menu_category_groups'], array(&$this, 'actionLoadPageHook_CategoryGroup'));
|
198 |
-
|
199 |
-
// FAQ Menu
|
200 |
-
add_action('load-' . $this->hooks['menu_faq'], array(&$this, 'actionLoadPageHook_faq'));
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Setup everything needed for the Overview page
|
205 |
-
*
|
206 |
-
*/
|
207 |
-
function actionLoadPageHook_Overview ()
|
208 |
-
{
|
209 |
-
// Add metaboxes
|
210 |
-
add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(&$this, 'metaboxCategoryGroupList'), $this->hooks['menu_overview'], 'normal', 'core');
|
211 |
-
add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(&$this, 'metaboxTranslation'), $this->hooks['menu_overview'], 'normal', 'core');
|
212 |
-
|
213 |
-
if (AVH_Common::getWordpressVersion() >= 3.1 ) {
|
214 |
-
add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
|
215 |
-
} else {
|
216 |
-
add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
|
217 |
-
}
|
218 |
-
|
219 |
-
// WordPress core Scripts
|
220 |
-
wp_enqueue_script('common');
|
221 |
-
wp_enqueue_script('wp-lists');
|
222 |
-
wp_enqueue_script('postbox');
|
223 |
-
|
224 |
-
// Plugin Scripts
|
225 |
-
wp_enqueue_script('avhec-categorygroup-js');
|
226 |
-
|
227 |
-
// WordPress core Styles
|
228 |
-
wp_admin_css('css/dashboard');
|
229 |
-
|
230 |
-
// Plugin Style
|
231 |
-
wp_enqueue_style('avhec-admin-css');
|
232 |
-
}
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Menu Page Overview
|
236 |
-
*
|
237 |
-
* @return none
|
238 |
-
*/
|
239 |
-
function doMenuOverview ()
|
240 |
-
{
|
241 |
-
global $screen_layout_columns;
|
242 |
-
|
243 |
-
// This box can't be unselectd in the the Screen Options
|
244 |
-
add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array(&$this, 'metaboxAnnouncements'), $this->hooks['menu_overview'], 'side', '');
|
245 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_overview'], 'side', '');
|
246 |
-
|
247 |
-
$hide2 = '';
|
248 |
-
switch ($screen_layout_columns) {
|
249 |
-
case 2:
|
250 |
-
$width = 'width:49%;';
|
251 |
-
break;
|
252 |
-
default:
|
253 |
-
$width = 'width:98%;';
|
254 |
-
$hide2 = 'display:none;';
|
255 |
-
}
|
256 |
-
|
257 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
258 |
-
echo $this->displayIcon('index');
|
259 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('Overview', 'avh-ec') . '</h2>';
|
260 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
261 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
262 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
263 |
-
do_meta_boxes($this->hooks['menu_overview'], 'normal', '');
|
264 |
-
echo " </div>";
|
265 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
266 |
-
do_meta_boxes($this->hooks['menu_overview'], 'side', '');
|
267 |
-
echo ' </div>';
|
268 |
-
echo ' </div>';
|
269 |
-
|
270 |
-
echo '<br class="clear"/>';
|
271 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
272 |
-
echo '</div>'; // wrap
|
273 |
-
|
274 |
-
|
275 |
-
$this->printMetaboxGeneralNonces();
|
276 |
-
$this->printMetaboxJS('overview');
|
277 |
-
$this->printAdminFooter();
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Setup everything needed for the General Options page
|
282 |
-
*
|
283 |
-
*/
|
284 |
-
function actionLoadPageHook_General ()
|
285 |
-
{
|
286 |
-
// Add metaboxes
|
287 |
-
add_meta_box('avhecBoxOptions', __('Options', 'avh-ec'), array(&$this, 'metaboxOptions'), $this->hooks['menu_general'], 'normal', 'core');
|
288 |
-
|
289 |
-
if (AVH_Common::getWordpressVersion() >= 3.1 ) {
|
290 |
-
add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
|
291 |
-
} else {
|
292 |
-
add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
|
293 |
-
}
|
294 |
-
|
295 |
-
// WordPress core Scripts
|
296 |
-
wp_enqueue_script('common');
|
297 |
-
wp_enqueue_script('wp-lists');
|
298 |
-
wp_enqueue_script('postbox');
|
299 |
-
|
300 |
-
// WordPress core Styles
|
301 |
-
wp_admin_css('css/dashboard');
|
302 |
-
|
303 |
-
// Plugin Style and Scripts
|
304 |
-
wp_enqueue_style('avhec-admin-css');
|
305 |
-
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* Menu Page General Options
|
310 |
-
*
|
311 |
-
* @return none
|
312 |
-
*/
|
313 |
-
function doMenuGeneral ()
|
314 |
-
{
|
315 |
-
global $screen_layout_columns;
|
316 |
-
|
317 |
-
$groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
|
318 |
-
foreach ($groups as $group) {
|
319 |
-
$group_id[] = $group->term_id;
|
320 |
-
$groupname[] = $group->name;
|
321 |
-
}
|
322 |
-
|
323 |
-
$options_general[] = array('avhec[general][alternative_name_select_category]', __('<em>Select Category</em> Alternative', 'avh-ec'), 'text', 20, __('Alternative text for Select Category.', 'avh-ec'));
|
324 |
-
$options_general[] = array('avhec[cat_group][home_group]', 'Home Group', 'dropdown', $group_id, $groupname, __('Select which group to show on the home page.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
|
325 |
-
$options_general[] = array('avhec[cat_group][no_group]', 'Nonexistence Group', 'dropdown', $group_id, $groupname, __('Select which group to show when there is no group associated with the post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
|
326 |
-
$options_general[] = array('avhec[cat_group][default_group]', 'Default Group', 'dropdown', $group_id, $groupname, __('Select which group will be the default group when editing a post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec'));
|
327 |
-
|
328 |
-
if (isset($_POST['updateoptions'])) {
|
329 |
-
check_admin_referer('avh_ec_generaloptions');
|
330 |
-
|
331 |
-
$formoptions = $_POST['avhec'];
|
332 |
-
$options = $this->core->getOptions();
|
333 |
-
|
334 |
-
//$all_data = array_merge( $options_general );
|
335 |
-
$all_data = $options_general;
|
336 |
-
foreach ($all_data as $option) {
|
337 |
-
$section = substr($option[0], strpos($option[0], '[') + 1);
|
338 |
-
$section = substr($section, 0, strpos($section, ']['));
|
339 |
-
$option_key = rtrim($option[0], ']');
|
340 |
-
$option_key = substr($option_key, strpos($option_key, '][') + 2);
|
341 |
-
|
342 |
-
switch ($section) {
|
343 |
-
case 'general':
|
344 |
-
case 'cat_group':
|
345 |
-
$current_value = $options[$section][$option_key];
|
346 |
-
break;
|
347 |
-
}
|
348 |
-
// Every field in a form is set except unchecked checkboxes. Set an unchecked checkbox to 0.
|
349 |
-
$newval = (isset($formoptions[$section][$option_key]) ? attribute_escape($formoptions[$section][$option_key]) : 0);
|
350 |
-
if ($newval != $current_value) { // Only process changed fields.
|
351 |
-
switch ($section) {
|
352 |
-
case 'general':
|
353 |
-
case 'cat_group':
|
354 |
-
$options[$section][$option_key] = $newval;
|
355 |
-
break;
|
356 |
-
}
|
357 |
-
}
|
358 |
-
}
|
359 |
-
$this->core->saveOptions($options);
|
360 |
-
$this->message = __('Options saved', 'avh-ec');
|
361 |
-
$this->status = 'updated fade';
|
362 |
-
|
363 |
-
}
|
364 |
-
$this->displayMessage();
|
365 |
-
|
366 |
-
$actual_options = $this->core->getOptions();
|
367 |
-
foreach ($actual_options['cat_group'] as $key => $value) {
|
368 |
-
if (! (in_array($value, (array) $group_id))) {
|
369 |
-
$actual_options['cat_group'][$key] = $this->catgrp->getTermIDBy('slug', 'none');
|
370 |
-
}
|
371 |
-
}
|
372 |
-
|
373 |
-
$hide2 = '';
|
374 |
-
switch ($screen_layout_columns) {
|
375 |
-
case 2:
|
376 |
-
$width = 'width:49%;';
|
377 |
-
break;
|
378 |
-
default:
|
379 |
-
$width = 'width:98%;';
|
380 |
-
$hide2 = 'display:none;';
|
381 |
-
}
|
382 |
-
$data['options_general'] = $options_general;
|
383 |
-
$data['actual_options'] = $actual_options;
|
384 |
-
|
385 |
-
// This box can't be unselectd in the the Screen Options
|
386 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_general'], 'side', 'core');
|
387 |
-
|
388 |
-
$hide2 = '';
|
389 |
-
switch ($screen_layout_columns) {
|
390 |
-
case 2:
|
391 |
-
$width = 'width:49%;';
|
392 |
-
break;
|
393 |
-
default:
|
394 |
-
$width = 'width:98%;';
|
395 |
-
$hide2 = 'display:none;';
|
396 |
-
}
|
397 |
-
|
398 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
399 |
-
echo $this->displayIcon('index');
|
400 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('General Options', 'avh-ec') . '</h2>';
|
401 |
-
echo '<form name="avhec-generaloptions" id="avhec-generaloptions" method="POST" action="' . admin_url('admin.php?page=avhec-general') . '" accept-charset="utf-8" >';
|
402 |
-
wp_nonce_field('avh_ec_generaloptions');
|
403 |
-
|
404 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
405 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
406 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
407 |
-
do_meta_boxes($this->hooks['menu_general'], 'normal', $data);
|
408 |
-
echo " </div>";
|
409 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
410 |
-
do_meta_boxes($this->hooks['menu_general'], 'side', $data);
|
411 |
-
echo ' </div>';
|
412 |
-
echo ' </div>';
|
413 |
-
|
414 |
-
echo '<br class="clear"/>';
|
415 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
416 |
-
echo '<p class="submit"><input class="button" type="submit" name="updateoptions" value="' . __('Save Changes', 'avhf-ec') . '" /></p>';
|
417 |
-
echo '</form>';
|
418 |
-
|
419 |
-
echo '</div>'; // wrap
|
420 |
-
|
421 |
-
|
422 |
-
$this->printMetaboxGeneralNonces();
|
423 |
-
$this->printMetaboxJS('general');
|
424 |
-
$this->printAdminFooter();
|
425 |
-
}
|
426 |
-
|
427 |
-
/**
|
428 |
-
* Options Metabox
|
429 |
-
*
|
430 |
-
*/
|
431 |
-
function metaboxOptions ($data)
|
432 |
-
{
|
433 |
-
echo $this->printOptions($data['options_general'], $data['actual_options']);
|
434 |
-
}
|
435 |
-
|
436 |
-
/**
|
437 |
-
* Setup everything needed for the Category Group page
|
438 |
-
*
|
439 |
-
*/
|
440 |
-
function actionLoadPageHook_CategoryGroup ()
|
441 |
-
{
|
442 |
-
|
443 |
-
// Add metaboxes
|
444 |
-
add_meta_box('avhecBoxCategoryGroupAdd', __('Add Group', 'avh-ec'), array(&$this, 'metaboxCategoryGroupAdd'), $this->hooks['menu_category_groups'], 'normal', 'core');
|
445 |
-
add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array(&$this, 'metaboxCategoryGroupList'), $this->hooks['menu_category_groups'], 'side', 'core');
|
446 |
-
add_meta_box('avhecBoxCategoryGroupSpecialPages', __('Special Pages', 'avh-ec'), array(&$this, 'metaboxCategoryGroupSpecialPages'), $this->hooks['menu_category_groups'], 'normal', 'core');
|
447 |
-
|
448 |
-
if (AVH_Common::getWordpressVersion() >= 3.1 ) {
|
449 |
-
add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
|
450 |
-
} else {
|
451 |
-
add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
|
452 |
-
}
|
453 |
-
|
454 |
-
// WordPress core Scripts
|
455 |
-
wp_enqueue_script('common');
|
456 |
-
wp_enqueue_script('wp-lists');
|
457 |
-
wp_enqueue_script('postbox');
|
458 |
-
|
459 |
-
// Plugin Scripts
|
460 |
-
wp_enqueue_script('avhec-categorygroup-js');
|
461 |
-
|
462 |
-
// WordPress core Styles
|
463 |
-
wp_admin_css('css/dashboard');
|
464 |
-
|
465 |
-
// Plugin Style
|
466 |
-
wp_enqueue_style('avhec-admin-css');
|
467 |
-
|
468 |
-
}
|
469 |
-
|
470 |
-
/**
|
471 |
-
* Menu Page Category Group
|
472 |
-
*
|
473 |
-
* @return none
|
474 |
-
*/
|
475 |
-
function doMenuCategoryGroup ()
|
476 |
-
{
|
477 |
-
global $screen_layout_columns;
|
478 |
-
|
479 |
-
$data_add_group_default = array('name'=>'', 'slug'=>'', 'widget_title'=>'', 'description'=>'');
|
480 |
-
$data_add_group_new = $data_add_group_default;
|
481 |
-
|
482 |
-
$options_add_group[] = array('avhec_add_group[add][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec'));
|
483 |
-
$options_add_group[] = array('avhec_add_group[add][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec'));
|
484 |
-
$options_add_group[] = array('avhec_add_group[add][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec'));
|
485 |
-
$options_add_group[] = array('avhec_add_group[add][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5);
|
486 |
-
|
487 |
-
$options_edit_group[] = array('avhec_edit_group[edit][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec'));
|
488 |
-
$options_edit_group[] = array('avhec_edit_group[edit][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec'));
|
489 |
-
$options_edit_group[] = array('avhec_edit_group[edit][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec'));
|
490 |
-
$options_edit_group[] = array('avhec_edit_group[edit][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5);
|
491 |
-
$options_edit_group[] = array('avhec_edit_group[edit][categories]', __('Categories', 'avh-ec'), 'catlist', 0, __('Select categories to be included in the group.', 'avh-ec'));
|
492 |
-
|
493 |
-
if (isset($_POST['addgroup'])) {
|
494 |
-
check_admin_referer('avh_ec_addgroup');
|
495 |
-
|
496 |
-
$formoptions = $_POST['avhec_add_group'];
|
497 |
-
|
498 |
-
$data_add_group_new['name'] = $formoptions['add']['name'];
|
499 |
-
$data_add_group_new['slug'] = empty($formoptions['add']['slug']) ? sanitize_title($data_add_group_new['name']) : sanitize_title($formoptions['add']['slug']);
|
500 |
-
$data_add_group_new['widget_title'] = $formoptions['add']['widget_title'];
|
501 |
-
$data_add_group_new['description'] = $formoptions['add']['description'];
|
502 |
-
|
503 |
-
$id = $this->catgrp->getTermIDBy('slug', $data_add_group_new['slug']);
|
504 |
-
if (! $id) {
|
505 |
-
$group_id = $this->catgrp->doInsertGroup($data_add_group_new['name'], array('description'=>$data_add_group_new['description'], 'slug'=>$data_add_group_new['slug']), $data_add_group_new['widget_title']);
|
506 |
-
$this->catgrp->setCategoriesForGroup($group_id);
|
507 |
-
$this->message = __('Category group saved', 'avh-ec');
|
508 |
-
$this->status = 'updated fade';
|
509 |
-
$data_add_group_new = $data_add_group_default;
|
510 |
-
|
511 |
-
} else {
|
512 |
-
$group = $this->catgrp->getGroup($id);
|
513 |
-
$this->message = __('Category group conflicts with ', 'avh-ec') . $group->name;
|
514 |
-
$this->message .= '<br />' . __('Same slug is used. ', 'avh-ec');
|
515 |
-
$this->status = 'error';
|
516 |
-
|
517 |
-
}
|
518 |
-
$this->displayMessage();
|
519 |
-
}
|
520 |
-
$data_add_group['add'] = $data_add_group_new;
|
521 |
-
$data['add'] = array('form'=>$options_add_group, 'data'=>$data_add_group);
|
522 |
-
|
523 |
-
if (isset($_GET['action'])) {
|
524 |
-
$action = $_GET['action'];
|
525 |
-
|
526 |
-
switch ($action) {
|
527 |
-
case 'edit':
|
528 |
-
$group_id = (int) $_GET['group_ID'];
|
529 |
-
$group = $this->catgrp->getGroup($group_id);
|
530 |
-
$widget_title = $this->catgrp->getWidgetTitleForGroup($group_id);
|
531 |
-
$cats = $this->catgrp->getCategoriesFromGroup($group_id);
|
532 |
-
|
533 |
-
$data_edit_group['edit'] = array('group_id'=>$group_id, 'name'=>$group->name, 'slug'=>$group->slug, 'widget_title'=>$widget_title, 'description'=>$group->description, 'categories'=>$cats);
|
534 |
-
$data['edit'] = array('form'=>$options_edit_group, 'data'=>$data_edit_group);
|
535 |
-
|
536 |
-
add_meta_box('avhecBoxCategoryGroupEdit', __('Edit Group', 'avh-ec') . ': ' . $group->name, array(&$this, 'metaboxCategoryGroupEdit'), $this->hooks['menu_category_groups'], 'normal', 'low');
|
537 |
-
break;
|
538 |
-
case 'delete':
|
539 |
-
if (! isset($_GET['group_ID'])) {
|
540 |
-
wp_redirect($this->getBackLink());
|
541 |
-
exit();
|
542 |
-
}
|
543 |
-
|
544 |
-
$group_id = (int) $_GET['group_ID'];
|
545 |
-
check_admin_referer('delete-avhecgroup_' . $group_id);
|
546 |
-
|
547 |
-
if (! current_user_can('manage_categories')) {
|
548 |
-
wp_die(__('Cheatin’ uh?'));
|
549 |
-
}
|
550 |
-
$this->catgrp->doDeleteGroup($group_id);
|
551 |
-
break;
|
552 |
-
default:
|
553 |
-
;
|
554 |
-
break;
|
555 |
-
}
|
556 |
-
}
|
557 |
-
|
558 |
-
if (isset($_POST['editgroup'])) {
|
559 |
-
check_admin_referer('avh_ec_editgroup');
|
560 |
-
|
561 |
-
$formoptions = $_POST['avhec_edit_group'];
|
562 |
-
$selected_categories = $_POST['post_category'];
|
563 |
-
|
564 |
-
$group_id = (int) $_POST['avhec-group_id'];
|
565 |
-
$result = $this->catgrp->doUpdateGroup($group_id, array('name'=>$formoptions['edit']['name'], 'slug'=>$formoptions['edit']['slug'], 'description'=>$formoptions['edit']['description']), $selected_categories, $formoptions['edit']['widget_title']);
|
566 |
-
switch ($result) {
|
567 |
-
case 1:
|
568 |
-
$this->message = __('Category group updated', 'avh-ec');
|
569 |
-
$this->status = 'updated fade';
|
570 |
-
break;
|
571 |
-
case 0:
|
572 |
-
$this->message = __('Category group not updated', 'avh-ec');
|
573 |
-
$this->message .= '<br />' . __('Duplicate slug detected', 'avh-ec');
|
574 |
-
$this->status = 'error';
|
575 |
-
break;
|
576 |
-
case - 1:
|
577 |
-
$this->message = __('Unknown category group', 'avh-ec');
|
578 |
-
$this->status = 'error';
|
579 |
-
break;
|
580 |
-
}
|
581 |
-
$this->displayMessage();
|
582 |
-
}
|
583 |
-
|
584 |
-
$hide2 = '';
|
585 |
-
switch ($screen_layout_columns) {
|
586 |
-
case 2:
|
587 |
-
$width = 'width:49%;';
|
588 |
-
break;
|
589 |
-
default:
|
590 |
-
$width = 'width:98%;';
|
591 |
-
$hide2 = 'display:none;';
|
592 |
-
}
|
593 |
-
|
594 |
-
$data_special_pages_old = $this->core->options['sp_cat_group'];
|
595 |
-
$data_special_pages_new = $data_special_pages_old;
|
596 |
-
if (isset($_POST['avhec_special_pages'])) {
|
597 |
-
check_admin_referer('avh_ec_specialpagesgroup');
|
598 |
-
|
599 |
-
$formoptions = $_POST['avhec_special_pages'];
|
600 |
-
$formdata = $formoptions['sp'];
|
601 |
-
foreach ($formdata as $key => $value) {
|
602 |
-
$data_special_pages_new[$key] = $value;
|
603 |
-
}
|
604 |
-
$this->core->options['sp_cat_group'] = $data_special_pages_new;
|
605 |
-
$this->core->saveOptions($this->core->options);
|
606 |
-
|
607 |
-
}
|
608 |
-
$data_special_pages['sp'] = $data_special_pages_new;
|
609 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
|
610 |
-
|
611 |
-
foreach ($cat_groups as $group) {
|
612 |
-
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
613 |
-
$dropdown_value[] = $group->term_id;
|
614 |
-
$dropdown_text[] = $temp_cat->name;
|
615 |
-
}
|
616 |
-
$options_special_pages[] = array('avhec_special_pages[sp][home_group]', __('Home page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('home','avhec')));
|
617 |
-
//$options_special_pages[] = array('avhec_special_pages[sp][category_group]', __('Category Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('category archive','avhec')));
|
618 |
-
$options_special_pages[] = array('avhec_special_pages[sp][day_group]', __('Daily Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('daily archive','avhec')));
|
619 |
-
$options_special_pages[] = array('avhec_special_pages[sp][month_group]', __('Monthly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('monthly archive','avhec')));
|
620 |
-
$options_special_pages[] = array('avhec_special_pages[sp][year_group]', __('Yearly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('yearly archive','avhec')));
|
621 |
-
$options_special_pages[] = array('avhec_special_pages[sp][author_group]', __('Author Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('author archive','avhec')));
|
622 |
-
$options_special_pages[] = array('avhec_special_pages[sp][search_group]', __('Search Page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('search','avhec')));
|
623 |
-
|
624 |
-
$data['sp'] = array('form'=>$options_special_pages, 'data'=>$data_special_pages);
|
625 |
-
|
626 |
-
// This box can't be unselectd in the the Screen Options
|
627 |
-
//add_meta_box( 'avhecBoxDonations', __( 'Donations', 'avh-ec' ), array (&$this, 'metaboxDonations' ), $this->hooks['menu_category_groups'], 'side', 'core' );
|
628 |
-
|
629 |
-
|
630 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
631 |
-
echo $this->displayIcon('index');
|
632 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('Category Groups', 'avh-ec') . '</h2>';
|
633 |
-
|
634 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
635 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
636 |
-
|
637 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
638 |
-
do_meta_boxes($this->hooks['menu_category_groups'], 'normal', $data);
|
639 |
-
echo " </div>";
|
640 |
-
|
641 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
642 |
-
do_meta_boxes($this->hooks['menu_category_groups'], 'side', $data);
|
643 |
-
echo ' </div>';
|
644 |
-
|
645 |
-
echo ' </div>'; // dashboard-widgets
|
646 |
-
echo '<br class="clear" />';
|
647 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
648 |
-
echo '</div>'; // wrap
|
649 |
-
|
650 |
-
|
651 |
-
$this->printMetaboxGeneralNonces();
|
652 |
-
$this->printMetaboxJS('grouped');
|
653 |
-
$this->printAdminFooter();
|
654 |
-
}
|
655 |
-
|
656 |
-
/**
|
657 |
-
* Metabox for Adding a group
|
658 |
-
* @param $data
|
659 |
-
*/
|
660 |
-
function metaboxCategoryGroupAdd ($data)
|
661 |
-
{
|
662 |
-
echo '<form name="avhec-addgroup" id="avhec-addgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
|
663 |
-
wp_nonce_field('avh_ec_addgroup');
|
664 |
-
echo $this->printOptions($data['add']['form'], $data['add']['data']);
|
665 |
-
echo '<p class="submit"><input class="button" type="submit" name="addgroup" value="' . __('Add group', 'avh-ec') . '" /></p>';
|
666 |
-
echo '</form>';
|
667 |
-
}
|
668 |
-
|
669 |
-
/**
|
670 |
-
* Metabox for showing the groups as a list
|
671 |
-
*
|
672 |
-
* @param $data
|
673 |
-
*/
|
674 |
-
function metaboxCategoryGroupList ($data)
|
675 |
-
{
|
676 |
-
echo '<form id="posts-filter" action="" method="get">';
|
677 |
-
|
678 |
-
echo '<div class="clear"></div>';
|
679 |
-
|
680 |
-
echo '<table class="widefat fixed" cellspacing="0">';
|
681 |
-
echo '<thead>';
|
682 |
-
echo '<tr>';
|
683 |
-
print_column_headers('categories_group');
|
684 |
-
echo '</tr>';
|
685 |
-
echo '</thead>';
|
686 |
-
|
687 |
-
echo '<tfoot>';
|
688 |
-
echo '<tr>';
|
689 |
-
print_column_headers('categories_group', false);
|
690 |
-
echo '</tr>';
|
691 |
-
echo '</tfoot>';
|
692 |
-
|
693 |
-
echo '<tbody id="the-list" class="list:group">';
|
694 |
-
$this->printCategoryGroupRows();
|
695 |
-
echo '</tbody>';
|
696 |
-
echo '</table>';
|
697 |
-
|
698 |
-
echo '<br class="clear" />';
|
699 |
-
echo '</form>';
|
700 |
-
|
701 |
-
//echo '</div>';
|
702 |
-
}
|
703 |
-
|
704 |
-
/**
|
705 |
-
* Metabox Category Group Edit
|
706 |
-
*
|
707 |
-
*/
|
708 |
-
function metaboxCategoryGroupEdit ($data)
|
709 |
-
{
|
710 |
-
echo '<form name="avhec-editgroup" id="avhec-editgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
|
711 |
-
wp_nonce_field('avh_ec_editgroup');
|
712 |
-
echo $this->printOptions($data['edit']['form'], $data['edit']['data']);
|
713 |
-
echo '<input type="hidden" value="' . $data['edit']['data']['edit']['group_id'] . '" name="avhec-group_id" id="avhec-group_id">';
|
714 |
-
echo '<p class="submit"><input class="button" type="submit" name="editgroup" value="' . __('Update group', 'avh-ec') . '" /></p>';
|
715 |
-
echo '</form>';
|
716 |
-
}
|
717 |
-
|
718 |
-
/**
|
719 |
-
* Metabox Category Group Special pages
|
720 |
-
*
|
721 |
-
*/
|
722 |
-
function metaboxCategoryGroupSpecialPages ($data)
|
723 |
-
{
|
724 |
-
echo '<form name="avhec-specialpagesgroup" id="avhec-specialpagesgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
|
725 |
-
wp_nonce_field('avh_ec_specialpagesgroup');
|
726 |
-
echo $this->printOptions($data['sp']['form'], $data['sp']['data']);
|
727 |
-
echo '<p class="submit"><input class="button" type="submit" name="spgroup" value="' . __('Save settings', 'avh-ec') . '" /></p>';
|
728 |
-
echo '</form>';
|
729 |
-
}
|
730 |
-
|
731 |
-
|
732 |
-
/**
|
733 |
-
* Setup everything needed for the Manul Order page
|
734 |
-
*
|
735 |
-
*/
|
736 |
-
function actionLoadPageHook_ManualOrder ()
|
737 |
-
{
|
738 |
-
|
739 |
-
add_meta_box('avhecBoxManualOrder', __('Manually Order Categories', 'avh-ec'), array(&$this, 'metaboxManualOrder'), $this->hooks['menu_manual_order'], 'normal', 'core');
|
740 |
-
|
741 |
-
|
742 |
-
if (AVH_Common::getWordpressVersion() >= 3.1 ) {
|
743 |
-
add_screen_option('layout_columns', array('max' => 1, 'default' => 1) );
|
744 |
-
} else {
|
745 |
-
add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
|
746 |
-
}
|
747 |
-
|
748 |
-
// WordPress core Styles and Scripts
|
749 |
-
wp_enqueue_script('common');
|
750 |
-
wp_enqueue_script('wp-lists');
|
751 |
-
wp_enqueue_script('postbox');
|
752 |
-
wp_enqueue_script('jquery-ui-sortable');
|
753 |
-
wp_enqueue_script('avhec-manualorder');
|
754 |
-
|
755 |
-
// WordPress core Styles
|
756 |
-
wp_admin_css('css/dashboard');
|
757 |
-
|
758 |
-
// Plugin Style
|
759 |
-
wp_enqueue_style('avhec-admin-css');
|
760 |
-
|
761 |
-
}
|
762 |
-
|
763 |
-
/**
|
764 |
-
* Menu Page Manual Order
|
765 |
-
*
|
766 |
-
* @return none
|
767 |
-
*/
|
768 |
-
function doMenuManualOrder ()
|
769 |
-
{
|
770 |
-
global $screen_layout_columns;
|
771 |
-
|
772 |
-
$hide2 = '';
|
773 |
-
switch ($screen_layout_columns) {
|
774 |
-
case 2:
|
775 |
-
$width = 'width:49%;';
|
776 |
-
break;
|
777 |
-
default:
|
778 |
-
$width = 'width:98%;';
|
779 |
-
$hide2 = 'display:none;';
|
780 |
-
}
|
781 |
-
|
782 |
-
echo '<div class="wrap">';
|
783 |
-
echo $this->displayIcon('index');
|
784 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('Manually Order Categories', 'avh-ec') . '</h2>';
|
785 |
-
|
786 |
-
echo '<div class="metabox-holder">';
|
787 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
788 |
-
do_meta_boxes($this->hooks['menu_manual_order'], 'normal', '');
|
789 |
-
echo ' </div>';
|
790 |
-
echo '</div>';
|
791 |
-
echo '</div>'; // wrap
|
792 |
-
echo '<div class="clear"></div>';
|
793 |
-
|
794 |
-
$this->printMetaboxGeneralNonces();
|
795 |
-
$this->printMetaboxJS('manual_order');
|
796 |
-
$this->printAdminFooter();
|
797 |
-
}
|
798 |
-
|
799 |
-
/**
|
800 |
-
*
|
801 |
-
* @return unknown_type
|
802 |
-
*/
|
803 |
-
function metaboxManualOrder ()
|
804 |
-
{
|
805 |
-
global $wpdb;
|
806 |
-
|
807 |
-
$parentID = 0;
|
808 |
-
|
809 |
-
if (isset($_POST['btnSubCats'])) {
|
810 |
-
$parentID = $_POST['cats'];
|
811 |
-
} elseif (isset($_POST['hdnParentID'])) {
|
812 |
-
$parentID = $_POST['hdnParentID'];
|
813 |
-
}
|
814 |
-
|
815 |
-
if (isset($_POST['btnReturnParent'])) {
|
816 |
-
$parentsParent = $wpdb->get_row("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = " . $_POST['hdnParentID'], ARRAY_N);
|
817 |
-
$parentID = $parentsParent[0];
|
818 |
-
}
|
819 |
-
|
820 |
-
$success = "";
|
821 |
-
if (isset($_POST['btnOrderCats'])) {
|
822 |
-
if (isset($_POST['hdnManualOrder']) && $_POST['hdnManualOrder'] != "") {
|
823 |
-
|
824 |
-
$hdnManualOrder = $_POST['hdnManualOrder'];
|
825 |
-
$IDs = explode(",", $hdnManualOrder);
|
826 |
-
$result = count($IDs);
|
827 |
-
|
828 |
-
for ($i = 0; $i < $result; $i ++) {
|
829 |
-
$str = str_replace("id_", "", $IDs[$i]);
|
830 |
-
$wpdb->query($wpdb->prepare("UPDATE $wpdb->terms SET avhec_term_order = '$i' WHERE term_id ='$str'"));
|
831 |
-
}
|
832 |
-
|
833 |
-
$success = '<div id="message" class="updated fade"><p>' . __('Categories updated successfully.', 'avh-ec') . '</p></div>';
|
834 |
-
} else {
|
835 |
-
$success = '<div id="message" class="updated fade"><p>' . __('An error occured, order has not been saved.', 'avh-ec') . '</p></div>';
|
836 |
-
}
|
837 |
-
|
838 |
-
}
|
839 |
-
|
840 |
-
$_SubCategories = "";
|
841 |
-
$results = $wpdb->get_results($wpdb->prepare("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = $parentID AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 0 ORDER BY t.avhec_term_order ASC"));
|
842 |
-
foreach ($results as $row) {
|
843 |
-
$_SubCategories .= "<option value='$row->term_id'>$row->name</option>";
|
844 |
-
}
|
845 |
-
|
846 |
-
echo '<div class="wrap">';
|
847 |
-
echo '<form name="frmMyCatOrder" method="post" action="">';
|
848 |
-
echo $success;
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
echo '<h4>';
|
853 |
-
_e('Order the categories', 'avh-ec');
|
854 |
-
if ($parentID == 0) {
|
855 |
-
echo ' at the Toplevel';
|
856 |
-
} else {
|
857 |
-
$_cats = get_category_parents($parentID, false, ' » ');
|
858 |
-
echo ' in the category ' . trim($_cats, ' » ');
|
859 |
-
}
|
860 |
-
echo '</h4>';
|
861 |
-
echo '<span class="description">';
|
862 |
-
_e('Order the categories on this level by dragging and dropping them into the desired order.', 'avh-ec');
|
863 |
-
echo '</span>';
|
864 |
-
echo '<ul id="avhecManualOrder">';
|
865 |
-
$results = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->terms t inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id WHERE taxonomy = 'category' and parent = $parentID ORDER BY avhec_term_order ASC"));
|
866 |
-
foreach ($results as $row)
|
867 |
-
echo "<li id='id_$row->term_id' class='lineitem menu-item-settings'>" . __($row->name) . "</li>";
|
868 |
-
|
869 |
-
echo '</ul>';
|
870 |
-
echo '<input type="submit" name="btnOrderCats" id="btnOrderCats" class="button-primary" value="' . __('Save Order', 'avh-ec') . '" onclick="javascript:orderCats(); return true;" />';
|
871 |
-
|
872 |
-
if ($parentID != 0) {
|
873 |
-
echo "<input type='submit' class='button' id='btnReturnParent' name='btnReturnParent' value='" . __('Return to parent category', 'avh-ec') . "' />";
|
874 |
-
}
|
875 |
-
|
876 |
-
echo '<strong id="updateText"></strong><br /><br />';
|
877 |
-
if ($_SubCategories != "") {
|
878 |
-
|
879 |
-
echo '<h4>';
|
880 |
-
_e('Select Subcategory', 'avh-ec');
|
881 |
-
echo '</h4>';
|
882 |
-
echo '<select id="cats" name="cats">';
|
883 |
-
echo $_SubCategories;
|
884 |
-
|
885 |
-
echo '</select><input type="submit" name="btnSubCats" class="button" id="btnSubCats" value="' . __('Select', 'avh-ec') . '" />';
|
886 |
-
echo '<span class="description">';
|
887 |
-
_e('Choose a category from the drop down to order the subcategories in that category.', 'avh-ec');
|
888 |
-
echo '</span>';
|
889 |
-
}
|
890 |
-
|
891 |
-
echo '<input type="hidden" id="hdnManualOrder" name="hdnManualOrder" />';
|
892 |
-
echo '<input type="hidden" id="hdnParentID" name="hdnParentID" value="' . $parentID . '" /></form>';
|
893 |
-
echo '</div>';
|
894 |
-
}
|
895 |
-
|
896 |
-
/**
|
897 |
-
* Setup everything needed for the FAQ page
|
898 |
-
*
|
899 |
-
*/
|
900 |
-
function actionLoadPageHook_faq ()
|
901 |
-
{
|
902 |
-
|
903 |
-
add_meta_box('avhecBoxFAQ', __('F.A.Q.', 'avh-ec'), array(&$this, 'metaboxFAQ'), $this->hooks['menu_faq'], 'normal', 'core');
|
904 |
-
add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array(&$this, 'metaboxTranslation'), $this->hooks['menu_faq'], 'normal', 'core');
|
905 |
-
|
906 |
-
if (AVH_Common::getWordpressVersion() >= 3.1 ) {
|
907 |
-
add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
|
908 |
-
} else {
|
909 |
-
add_filter('screen_layout_columns', array ( &$this, 'filterScreenLayoutColumns' ), 10, 2);
|
910 |
-
}
|
911 |
-
|
912 |
-
// WordPress core Styles and Scripts
|
913 |
-
wp_enqueue_script('common');
|
914 |
-
wp_enqueue_script('wp-lists');
|
915 |
-
wp_enqueue_script('postbox');
|
916 |
-
|
917 |
-
// WordPress core Styles
|
918 |
-
wp_admin_css('css/dashboard');
|
919 |
-
|
920 |
-
// Plugin Style
|
921 |
-
wp_enqueue_style('avhec-admin-css');
|
922 |
-
|
923 |
-
}
|
924 |
-
|
925 |
-
/**
|
926 |
-
* Menu Page FAQ
|
927 |
-
*
|
928 |
-
* @return none
|
929 |
-
*/
|
930 |
-
function doMenuFAQ ()
|
931 |
-
{
|
932 |
-
global $screen_layout_columns;
|
933 |
-
|
934 |
-
// This box can't be unselectd in the the Screen Options
|
935 |
-
add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array(&$this, 'metaboxAnnouncements'), $this->hooks['menu_faq'], 'side', 'core');
|
936 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array(&$this, 'metaboxDonations'), $this->hooks['menu_faq'], 'side', 'core');
|
937 |
-
|
938 |
-
$hide2 = '';
|
939 |
-
switch ($screen_layout_columns) {
|
940 |
-
case 2:
|
941 |
-
$width = 'width:49%;';
|
942 |
-
break;
|
943 |
-
default:
|
944 |
-
$width = 'width:98%;';
|
945 |
-
$hide2 = 'display:none;';
|
946 |
-
}
|
947 |
-
|
948 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
949 |
-
echo $this->displayIcon('index');
|
950 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('F.A.Q', 'avh-ec') . '</h2>';
|
951 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
952 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
953 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
954 |
-
do_meta_boxes($this->hooks['menu_faq'], 'normal', '');
|
955 |
-
echo ' </div>';
|
956 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
957 |
-
do_meta_boxes($this->hooks['menu_faq'], 'side', '');
|
958 |
-
echo ' </div>';
|
959 |
-
echo ' </div>';
|
960 |
-
echo '<br class="clear"/>';
|
961 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
962 |
-
echo '</div>'; // wrap
|
963 |
-
|
964 |
-
|
965 |
-
$this->printMetaboxGeneralNonces();
|
966 |
-
$this->printMetaboxJS('faq');
|
967 |
-
$this->printAdminFooter();
|
968 |
-
}
|
969 |
-
|
970 |
-
/**
|
971 |
-
* Translation Metabox
|
972 |
-
* @return unknown_type
|
973 |
-
*/
|
974 |
-
function metaboxTranslation ()
|
975 |
-
{
|
976 |
-
$locale = apply_filters( 'plugin_locale', get_locale(), 'avh-ec' );
|
977 |
-
$available_locale['cs_CZ'] = array('Czech - Čeština',0);
|
978 |
-
$available_locale['nl_NL'] = array('Dutch - Nederlands',0);
|
979 |
-
$available_locale['de_DE'] = array('German - Deutsch', 0);
|
980 |
-
$available_locale['el'] = array('Greek - Čeština',0);
|
981 |
-
$available_locale['id_ID'] = array('Indonesian - Bahasa Indonesia - Čeština',0);
|
982 |
-
$available_locale['it_IT'] = array('Italian - Italiano',1);
|
983 |
-
$available_locale['ru_RU'] = array('Russian — Русский',0);
|
984 |
-
$available_locale['es_ES'] = array('Spanish - Español',0);
|
985 |
-
$available_locale['sv_SE'] = array('Swedish - Svenska',0);
|
986 |
-
$available_locale['tr'] = array('Turkish - Türkçe',0);
|
987 |
-
|
988 |
-
echo '<div class="p">';
|
989 |
-
echo __('This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language.', 'avh-ec') . '<br />';
|
990 |
-
|
991 |
-
echo '</div>';
|
992 |
-
|
993 |
-
echo '<div class="p">';
|
994 |
-
echo '<span class="b">' . __('Available Languages', 'avh-ec') . '</span>';
|
995 |
-
echo '<ul>';
|
996 |
-
foreach ($available_locale as $key => $value) {
|
997 |
-
echo '<li>';
|
998 |
-
$complete = ($value[1] == 1 ? 'Complete' : 'Incomplete');
|
999 |
-
echo $value[0] . ' (' . $key . ') - ' . $complete;
|
1000 |
-
echo '</li>';
|
1001 |
-
}
|
1002 |
-
echo '</ul>';
|
1003 |
-
echo '</div>';
|
1004 |
-
|
1005 |
-
echo '<div class="p">';
|
1006 |
-
if ('en_US' != $locale & (!array_key_exists($locale, $available_locale))){
|
1007 |
-
echo 'Currently the plugin is not available in your language ('.$locale.'). Why not help out and translate the plugin in your language. You can help by visiting <a href="https://translations.launchpad.net/avhextendedcategories/trunk" target="_blank">Launchpad</a>.';
|
1008 |
-
} else {
|
1009 |
-
echo __('You can visit ', 'avh-ec') . '<a href="https://translations.launchpad.net/avhextendedcategories/trunk" target="_blank">Launchpad</a> ' . __('to help complete these translations or add a new language.', 'avh-ec');
|
1010 |
-
}
|
1011 |
-
echo '</div>';
|
1012 |
-
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
/**
|
1016 |
-
* Donation Metabox
|
1017 |
-
* @return unknown_type
|
1018 |
-
*/
|
1019 |
-
function metaboxDonations ()
|
1020 |
-
{
|
1021 |
-
echo '<div class="p">';
|
1022 |
-
echo __('If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation.', 'avh-ec');
|
1023 |
-
echo '</div>';
|
1024 |
-
|
1025 |
-
echo '<div class="p">';
|
1026 |
-
echo '<span class="b">Amazon</span><br />';
|
1027 |
-
echo __('If you decide to buy something from Amazon click the button.', 'avh-ec') . '</span><br />';
|
1028 |
-
echo '<a href="https://www.amazon.com/?tag=avh-donation-20" target="_blank" title="Amazon Homepage"><img alt="Amazon Button" src="' . $this->core->info['graphics_url'] . '/us_banner_logow_120x60.gif" /></a>';
|
1029 |
-
echo '</div>';
|
1030 |
-
|
1031 |
-
echo '<div class="p">';
|
1032 |
-
echo __('You can send me something from my ', 'avh-ec') . '<a href="http://www.amazon.com/registry/wishlist/1U3DTWZ72PI7W?tag=avh-donation-20">' . __('Amazon Wish List', 'avh-ec') . '</a>';
|
1033 |
-
echo '</div>';
|
1034 |
-
|
1035 |
-
echo '<div class="p">';
|
1036 |
-
echo '<span class="b">' . __('Through Paypal.', 'avh-ec') . '</span><br />';
|
1037 |
-
echo __('Click on the Donate button and you will be directed to Paypal where you can make your donation and you don\'t need to have a Paypal account to make a donation.', 'avh-ec') . '<br />';
|
1038 |
-
echo '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=S85FXJ9EBHAF2&lc=US&item_name=AVH%20Plugins&item_number=fdas¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank" title="Donate">';
|
1039 |
-
echo '<img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donate"/></a>';
|
1040 |
-
echo '</div>';
|
1041 |
-
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
/***
|
1045 |
-
* F.A.Q Metabox
|
1046 |
-
* @return none
|
1047 |
-
*/
|
1048 |
-
function metaboxFAQ ()
|
1049 |
-
{
|
1050 |
-
echo '<div class="p">';
|
1051 |
-
echo '<span class="b">' . __('What about support?', 'avh-ec') . '</span><br />';
|
1052 |
-
echo __('I created a support site at http://forums.avirtualhome.com where you can ask questions or request features.', 'avh-ec') . '<br />';
|
1053 |
-
echo '</div>';
|
1054 |
-
|
1055 |
-
echo '<div class="p">';
|
1056 |
-
echo '<span class="b">' . __('What is depth selection?', 'avh-ec') . '</span><br />';
|
1057 |
-
echo __('Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well.', 'avh-ec') . '<br /><br />';
|
1058 |
-
echo __('Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:', 'avh-ec') . '<br />';
|
1059 |
-
echo __('You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only.', 'avh-ec') . '<br />';
|
1060 |
-
echo '</div>';
|
1061 |
-
|
1062 |
-
echo '<div class="p">';
|
1063 |
-
echo '<span class="b">' . __('Multiple Category Groups', 'avh-ec') . '</span><br />';
|
1064 |
-
echo __('The following is an explanation how assigning multiple groups to page/post works.', 'avh-ec') . '<br /><br />';
|
1065 |
-
echo __('Lets say you have the following groups:', 'avh-ec');
|
1066 |
-
echo '<ul>';
|
1067 |
-
echo '<li>' . __('Free Time', 'avh-ec') . '</li>';
|
1068 |
-
echo '<li>' . __('Theater', 'avh-ec') . '</li>';
|
1069 |
-
echo '<li>' . __('Movie', 'avh-ec') . '</li>';
|
1070 |
-
echo '<li>' . __('Music', 'avh-ec') . '</li>';
|
1071 |
-
echo '</ul>';
|
1072 |
-
echo __('Setup several Category Group widgets and associated each widget with one or more groups.', 'avh-ec') . '<br />';
|
1073 |
-
echo __('Widget 1 has association with Free Time', 'avh-ec') . '<br />';
|
1074 |
-
echo __('Widget 2 has association with Theater, Movie and Music', 'avh-ec') . '<br />';
|
1075 |
-
echo __('Widget 3 has association with Theater, Movie and Music', 'avh-ec') . '<br /><br />';
|
1076 |
-
echo __('Page has associations the groups Free Time and Theater', 'avh-ec');
|
1077 |
-
echo '<ul>';
|
1078 |
-
echo '<li>' . __('Widget 1: Shows categories of the Free Time group', 'avh-ec') . '</li>';
|
1079 |
-
echo '<li>' . __('Widget 2: Shows categories of the Theater group.', 'avh-ec') . '</li>';
|
1080 |
-
echo '<li>' . __('Widget 3: Not displayed', 'avh-ec') . '</li>';
|
1081 |
-
echo '</ul>';
|
1082 |
-
echo __('Page has associations the group Movie.', 'avh-ec');
|
1083 |
-
echo '<ul>';
|
1084 |
-
echo '<li>' . __('Widget 1: Not displayed', 'avh-ec') . '</li>';
|
1085 |
-
echo '<li>' . __('Widget 2: Shows categories of the Movie group.', 'avh-ec') . '</li>';
|
1086 |
-
echo '<li>' . __('Widget 3: Not displayed', 'avh-ec') . '</li>';
|
1087 |
-
echo '</ul>';
|
1088 |
-
echo __('Page has associations the groups Free Time, Movie and Music', 'avh-ec');
|
1089 |
-
echo '<ul>';
|
1090 |
-
echo '<li>' . __('Widget 1: Shows categories of the Free Time group', 'avh-ec') . '</li>';
|
1091 |
-
echo '<li>' . __('Widget 2: Shows categories of the Movie or Music group.', 'avh-ec') . '</li>';
|
1092 |
-
echo '<li>' . __('Widget 3: Shows categories of the Music or Movie group.', 'avh-ec') . '</li>';
|
1093 |
-
echo '</ul>';
|
1094 |
-
echo __('Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie.', 'avh-ec') . '<br />';
|
1095 |
-
echo '</div>';
|
1096 |
-
}
|
1097 |
-
|
1098 |
-
function metaboxAnnouncements ()
|
1099 |
-
{
|
1100 |
-
$php5 = version_compare('5.2', phpversion(), '<');
|
1101 |
-
echo '<div class="p">';
|
1102 |
-
echo '<span class="b">' . __('PHP4 Support', 'avh-ec') . '</span><br />';
|
1103 |
-
echo __('The next major release of the plugin will no longer support PHP4.', 'avh-ec') . '<br />';
|
1104 |
-
echo __('It will be written for PHP 5.2 and ', 'avh-ec');
|
1105 |
-
if ($php5) {
|
1106 |
-
echo __('your blog already runs the needed PHP version. When the new release comes out you can safely update.', 'avh-ec') . '<br />';
|
1107 |
-
} else {
|
1108 |
-
echo __('your blog still runs PHP4. When the new release comes out you can not use it.', 'avh-ec') . '<br />';
|
1109 |
-
echo __('I don\'t have a timeline for the next version but consider contacting your host if PHP 5.2 is available.', 'avh-ec') . '<br />';
|
1110 |
-
echo __('If your hosts doesn\'t offer PHP 5.2 you might want to consider switching hosts.', 'avh-ec') . '<br />';
|
1111 |
-
echo __('A host to consider is ', 'avh-ec') . '<a href="http://www.lunarpages.com/id/pdoes" target="_blank">Lunarpages</a>';
|
1112 |
-
echo __('I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price.', 'avh-ec');
|
1113 |
-
}
|
1114 |
-
echo '</div>';
|
1115 |
-
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
/**
|
1119 |
-
* Sets the amount of columns wanted for a particuler screen
|
1120 |
-
*
|
1121 |
-
* @WordPress filter screen_meta_screen
|
1122 |
-
* @param $screen
|
1123 |
-
* @return strings
|
1124 |
-
*/
|
1125 |
-
|
1126 |
-
function filterScreenLayoutColumns ($columns, $screen)
|
1127 |
-
{
|
1128 |
-
switch ($screen) {
|
1129 |
-
case $this->hooks['menu_overview']:
|
1130 |
-
$columns[$this->hooks['menu_overview']] = 2;
|
1131 |
-
break;
|
1132 |
-
case $this->hooks['menu_general']:
|
1133 |
-
$columns[$this->hooks['menu_general']] = 2;
|
1134 |
-
break;
|
1135 |
-
case $this->hooks['menu_category_groups']:
|
1136 |
-
$columns[$this->hooks['menu_category_groups']] = 2;
|
1137 |
-
break;
|
1138 |
-
case $this->hooks['menu_faq']:
|
1139 |
-
$columns[$this->hooks['menu_faq']] = 2;
|
1140 |
-
break;
|
1141 |
-
|
1142 |
-
}
|
1143 |
-
return $columns;
|
1144 |
-
}
|
1145 |
-
|
1146 |
-
/**
|
1147 |
-
* Adds Settings next to the plugin actions
|
1148 |
-
*
|
1149 |
-
* @WordPress Filter plugin_action_links_avh-amazon/avh-amazon.php
|
1150 |
-
*
|
1151 |
-
*/
|
1152 |
-
function filterPluginActions ($links, $file)
|
1153 |
-
{
|
1154 |
-
$settings_link = '<a href="admin.php?page=extended-categories-widget">' . __('Settings', 'avh-ec') . '</a>';
|
1155 |
-
array_unshift($links, $settings_link); // before other links
|
1156 |
-
return $links;
|
1157 |
-
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
/**
|
1161 |
-
* Creates a new array for columns headers. Used in print_column_headers. The filter is called from get_column_headers
|
1162 |
-
*
|
1163 |
-
* @param $columns
|
1164 |
-
* @return Array
|
1165 |
-
* @see print_column_headers, get_column_headers
|
1166 |
-
*/
|
1167 |
-
function filterManageCategoriesGroupColumns ($columns)
|
1168 |
-
{
|
1169 |
-
$categories_group_columns = array('name'=>__('Name', 'avh-ec'), 'slug'=>'Slug', 'widget-title'=>__('Widget Title', 'avh-ec'), 'description'=>__('Description', 'avh-ec'), 'cat-in-group'=>__('Categories in the group', 'avh-ec'));
|
1170 |
-
return $categories_group_columns;
|
1171 |
-
}
|
1172 |
-
|
1173 |
-
/**
|
1174 |
-
* When not using AJAX, this function is called when the deletion fails.
|
1175 |
-
*
|
1176 |
-
* @param string $text
|
1177 |
-
* @param int $group_id
|
1178 |
-
* @return string
|
1179 |
-
* @WordPress Filter explain_nonce_$verb-$noun
|
1180 |
-
* @see wp_explain_nonce
|
1181 |
-
*/
|
1182 |
-
function filterExplainNonceDeleteGroup ($text, $group_id)
|
1183 |
-
{
|
1184 |
-
$group = get_term($group_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
|
1185 |
-
|
1186 |
-
$return = sprintf(__('Your attempt to delete this group: “%s” has failed.'), $group->name);
|
1187 |
-
return ($return);
|
1188 |
-
}
|
1189 |
-
|
1190 |
-
############## Admin WP Helper ##############
|
1191 |
-
|
1192 |
-
|
1193 |
-
/**
|
1194 |
-
* Get the backlink for forms
|
1195 |
-
*
|
1196 |
-
* @return strings
|
1197 |
-
*/
|
1198 |
-
function getBackLink ()
|
1199 |
-
{
|
1200 |
-
$page = basename(__FILE__);
|
1201 |
-
if (isset($_GET['page']) && ! empty($_GET['page'])) {
|
1202 |
-
$page = preg_replace('[^a-zA-Z0-9\.\_\-]', '', $_GET['page']);
|
1203 |
-
}
|
1204 |
-
|
1205 |
-
if (function_exists("admin_url"))
|
1206 |
-
return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
|
1207 |
-
else
|
1208 |
-
return $_SERVER['PHP_SELF'] . "?page=" . $page;
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
/**
|
1212 |
-
* Print all Category Group rows
|
1213 |
-
*
|
1214 |
-
* @uses printCategoryGroupRow
|
1215 |
-
*
|
1216 |
-
*/
|
1217 |
-
function printCategoryGroupRows ()
|
1218 |
-
{
|
1219 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array('hide_empty'=>FALSE));
|
1220 |
-
|
1221 |
-
foreach ($cat_groups as $group) {
|
1222 |
-
if ('none' != $group->slug) {
|
1223 |
-
echo $this->printCategoryGroupRow($group->term_id, $group->term_taxonomy_id);
|
1224 |
-
}
|
1225 |
-
}
|
1226 |
-
}
|
1227 |
-
|
1228 |
-
/**
|
1229 |
-
* Displays all the information of a group in a row
|
1230 |
-
* Adds inline link for delete and/or edit.
|
1231 |
-
*
|
1232 |
-
* @param int $group_term_id
|
1233 |
-
* @param int $group_term_taxonomy_id
|
1234 |
-
*/
|
1235 |
-
function printCategoryGroupRow ($group_term_id, $group_term_taxonomy_id)
|
1236 |
-
{
|
1237 |
-
static $row_class = '';
|
1238 |
-
|
1239 |
-
$group = get_term($group_term_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
|
1240 |
-
|
1241 |
-
$no_edit[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
|
1242 |
-
$no_delete[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
|
1243 |
-
|
1244 |
-
if (current_user_can('manage_categories')) {
|
1245 |
-
$actions = array();
|
1246 |
-
if (! array_key_exists($group->term_id, $no_edit)) {
|
1247 |
-
$edit_link = "admin.php?page=avhec-grouped&action=edit&group_ID=$group->term_id";
|
1248 |
-
$edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit “%s”'), $group->name)) . "'>" . esc_attr($group->name) . '</a><br />';
|
1249 |
-
|
1250 |
-
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
|
1251 |
-
} else {
|
1252 |
-
$edit = esc_attr($group->name);
|
1253 |
-
}
|
1254 |
-
if (! (array_key_exists($group->term_id, $no_delete))) {
|
1255 |
-
$actions['delete'] = "<a class='delete:the-list:group-$group->term_id submitdelete' href='" . wp_nonce_url("admin.php?page=avhec-grouped&action=delete&group_ID=$group->term_id", 'delete-avhecgroup_' . $group->term_id) . "'>" . __('Delete') . "</a>";
|
1256 |
-
}
|
1257 |
-
$action_count = count($actions);
|
1258 |
-
$i = 0;
|
1259 |
-
$edit .= '<div class="row-actions">';
|
1260 |
-
foreach ($actions as $action => $link) {
|
1261 |
-
++ $i;
|
1262 |
-
($i == $action_count) ? $sep = '' : $sep = ' | ';
|
1263 |
-
$edit .= "<span class='$action'>$link$sep</span>";
|
1264 |
-
}
|
1265 |
-
$edit .= '</div>';
|
1266 |
-
} else {
|
1267 |
-
$edit = $group->name;
|
1268 |
-
}
|
1269 |
-
|
1270 |
-
$row_class = 'alternate' == $row_class ? '' : 'alternate';
|
1271 |
-
$qe_data = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
1272 |
-
|
1273 |
-
$output = "<tr id='group-$group->term_id' class='iedit $row_class'>";
|
1274 |
-
|
1275 |
-
$columns = get_column_headers('categories_group');
|
1276 |
-
$hidden = get_hidden_columns('categories_group');
|
1277 |
-
foreach ($columns as $column_name => $column_display_name) {
|
1278 |
-
$class = 'class="' . $column_name . ' column-' . $column_name . '"';
|
1279 |
-
|
1280 |
-
$style = '';
|
1281 |
-
if (in_array($column_name, $hidden))
|
1282 |
-
$style = ' style="display:none;"';
|
1283 |
-
|
1284 |
-
$attributes = $class . $style;
|
1285 |
-
|
1286 |
-
switch ($column_name) {
|
1287 |
-
case 'cb':
|
1288 |
-
$output .= '<th scope="row" class="check-column">';
|
1289 |
-
if (! (array_key_exists($group->term_id, $no_delete))) {
|
1290 |
-
$output .= '<input type="checkbox" name="delete[]" value="' . $group->term_id . '" />';
|
1291 |
-
} else {
|
1292 |
-
$output .= " ";
|
1293 |
-
}
|
1294 |
-
$output .= '</th>';
|
1295 |
-
break;
|
1296 |
-
case 'name':
|
1297 |
-
$output .= '<td ' . $attributes . '>' . $edit;
|
1298 |
-
$output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
|
1299 |
-
$output .= '<div class="name">' . $qe_data->name . '</div>';
|
1300 |
-
$output .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
|
1301 |
-
$output .= '</div></td>';
|
1302 |
-
break;
|
1303 |
-
case 'widget-title':
|
1304 |
-
$title = $this->catgrp->getWidgetTitleForGroup($group->term_id);
|
1305 |
-
$output .= '<td ' . $attributes . '>' . $title . '</td>';
|
1306 |
-
break;
|
1307 |
-
|
1308 |
-
case 'description':
|
1309 |
-
$output .= '<td ' . $attributes . '>' . $qe_data->description . '</td>';
|
1310 |
-
break;
|
1311 |
-
case 'slug':
|
1312 |
-
$output .= "<td $attributes>" . apply_filters('editable_slug', $qe_data->slug) . "</td>";
|
1313 |
-
break;
|
1314 |
-
case 'cat-in-group':
|
1315 |
-
$cats = $this->catgrp->getCategoriesFromGroup($group_term_id);
|
1316 |
-
$catname = array();
|
1317 |
-
foreach ($cats as $cat_id) {
|
1318 |
-
$catname[] = get_cat_name($cat_id);
|
1319 |
-
}
|
1320 |
-
natsort($catname);
|
1321 |
-
$cat = implode(', ', $catname);
|
1322 |
-
$output .= '<td ' . $attributes . '>' . $cat . '</td>';
|
1323 |
-
break;
|
1324 |
-
|
1325 |
-
}
|
1326 |
-
}
|
1327 |
-
$output .= '</tr>';
|
1328 |
-
|
1329 |
-
return $output;
|
1330 |
-
}
|
1331 |
-
|
1332 |
-
/**
|
1333 |
-
* Prints the general nonces, used by the AJAX
|
1334 |
-
*/
|
1335 |
-
function printMetaboxGeneralNonces ()
|
1336 |
-
{
|
1337 |
-
echo '<form style="display:none" method="get" action="">';
|
1338 |
-
echo '<p>';
|
1339 |
-
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
|
1340 |
-
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
|
1341 |
-
echo '</p>';
|
1342 |
-
echo '</form>';
|
1343 |
-
|
1344 |
-
}
|
1345 |
-
|
1346 |
-
/**
|
1347 |
-
* Print the Metabox JS for toggling closed and open
|
1348 |
-
*
|
1349 |
-
* @param $boxid
|
1350 |
-
*/
|
1351 |
-
function printMetaboxJS ($boxid)
|
1352 |
-
{
|
1353 |
-
$a = $this->hooks['menu_' . $boxid];
|
1354 |
-
echo '<script type="text/javascript">' . "\n";
|
1355 |
-
echo ' //<![CDATA[' . "\n";
|
1356 |
-
echo ' jQuery(document).ready( function($) {' . "\n";
|
1357 |
-
echo ' $(\'.if-js-closed\').removeClass(\'if-js-closed\').addClass(\'closed\');' . "\n";
|
1358 |
-
echo ' // postboxes setup' . "\n";
|
1359 |
-
echo ' postboxes.add_postbox_toggles(\'' . $a . '\');' . "\n";
|
1360 |
-
echo ' });' . "\n";
|
1361 |
-
echo ' //]]>' . "\n";
|
1362 |
-
echo '</script>';
|
1363 |
-
|
1364 |
-
}
|
1365 |
-
|
1366 |
-
/**
|
1367 |
-
* Display plugin Copyright
|
1368 |
-
*
|
1369 |
-
*/
|
1370 |
-
function printAdminFooter ()
|
1371 |
-
{
|
1372 |
-
echo '<p class="footer_avhec">';
|
1373 |
-
printf('© Copyright %d <a href="http://blog.avirtualhome.com/" title="My Thoughts">Peter van der Does</a> | AVH Extended Categories Version %s', date('Y'), $this->core->version);
|
1374 |
-
echo '</p>';
|
1375 |
-
}
|
1376 |
-
|
1377 |
-
/**
|
1378 |
-
* Display WP alert
|
1379 |
-
*
|
1380 |
-
*/
|
1381 |
-
function displayMessage ()
|
1382 |
-
{
|
1383 |
-
if ($this->message != '') {
|
1384 |
-
$message = $this->message;
|
1385 |
-
$status = $this->status;
|
1386 |
-
$this->message = $this->status = ''; // Reset
|
1387 |
-
}
|
1388 |
-
if (isset($message)) {
|
1389 |
-
$status = ($status != '') ? $status : 'updated fade';
|
1390 |
-
echo '<div id="message" class="' . $status . '">';
|
1391 |
-
echo '<p><strong>' . $message . '</strong></p></div>';
|
1392 |
-
}
|
1393 |
-
}
|
1394 |
-
|
1395 |
-
/**
|
1396 |
-
* Ouput formatted options
|
1397 |
-
*
|
1398 |
-
* @param array $option_data
|
1399 |
-
* @return string
|
1400 |
-
*/
|
1401 |
-
function printOptions ($option_data, $option_actual)
|
1402 |
-
{
|
1403 |
-
// Generate output
|
1404 |
-
$output = '';
|
1405 |
-
$output .= "\n" . '<table class="form-table avhec-options">' . "\n";
|
1406 |
-
foreach ($option_data as $option) {
|
1407 |
-
$section = substr($option[0], strpos($option[0], '[') + 1);
|
1408 |
-
$section = substr($section, 0, strpos($section, ']['));
|
1409 |
-
$option_key = rtrim($option[0], ']');
|
1410 |
-
$option_key = substr($option_key, strpos($option_key, '][') + 2);
|
1411 |
-
// Helper
|
1412 |
-
if ($option[2] == 'helper') {
|
1413 |
-
$output .= '<tr style="vertical-align: top;"><td class="helper" colspan="2">' . wp_filter_post_kses($option[4]) . '</td></tr>' . "\n";
|
1414 |
-
continue;
|
1415 |
-
}
|
1416 |
-
switch ($option[2]) {
|
1417 |
-
case 'checkbox':
|
1418 |
-
$input_type = '<input type="checkbox" id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option[3]) . '" ' . $this->isChecked('1', $option_actual[$section][$option_key]) . ' />' . "\n";
|
1419 |
-
$explanation = $option[4];
|
1420 |
-
break;
|
1421 |
-
case 'dropdown':
|
1422 |
-
$selvalue = $option[3];
|
1423 |
-
$seltext = $option[4];
|
1424 |
-
$seldata = '';
|
1425 |
-
foreach ((array) $selvalue as $key => $sel) {
|
1426 |
-
$seldata .= '<option value="' . esc_attr($sel) . '" ' . (($option_actual[$section][$option_key] == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($seltext[$key])) . '</option>' . "\n";
|
1427 |
-
}
|
1428 |
-
$input_type = '<select id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '">' . $seldata . '</select>' . "\n";
|
1429 |
-
$explanation = $option[5];
|
1430 |
-
break;
|
1431 |
-
case 'text-color':
|
1432 |
-
$input_type = '<input type="text" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" /><div class="box_color ' . esc_attr($option[0]) . '"></div>' . "\n";
|
1433 |
-
$explanation = $option[4];
|
1434 |
-
break;
|
1435 |
-
case 'textarea':
|
1436 |
-
$input_type = '<textarea rows="' . esc_attr($option[5]) . '" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" size="' . esc_attr($option[3]) . '" />' . $option_actual[$section][$option_key] . '</textarea>';
|
1437 |
-
$explanation = $option[4];
|
1438 |
-
break;
|
1439 |
-
case 'catlist':
|
1440 |
-
ob_start();
|
1441 |
-
echo '<div id="avhec-catlist">';
|
1442 |
-
echo '<ul>';
|
1443 |
-
wp_category_checklist(0, 0, $option_actual[$section][$option_key]);
|
1444 |
-
echo '</ul>';
|
1445 |
-
echo '</div>';
|
1446 |
-
$input_type = ob_get_contents();
|
1447 |
-
ob_end_clean();
|
1448 |
-
$explanation = $option[4];
|
1449 |
-
break;
|
1450 |
-
case 'text':
|
1451 |
-
default:
|
1452 |
-
$input_type = '<input type="text" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" />' . "\n";
|
1453 |
-
$explanation = $option[4];
|
1454 |
-
break;
|
1455 |
-
}
|
1456 |
-
// Additional Information
|
1457 |
-
$extra = '';
|
1458 |
-
if ($explanation) {
|
1459 |
-
$extra = '<br /><span class="description">' . wp_filter_kses($explanation) . '</span>' . "\n";
|
1460 |
-
}
|
1461 |
-
// Output
|
1462 |
-
$output .= '<tr style="vertical-align: top;"><th align="left" scope="row"><label for="' . esc_attr($option[0]) . '">' . wp_filter_kses($option[1]) . '</label></th><td>' . $input_type . ' ' . $extra . '</td></tr>' . "\n";
|
1463 |
-
}
|
1464 |
-
$output .= '</table>' . "\n";
|
1465 |
-
return $output;
|
1466 |
-
}
|
1467 |
-
|
1468 |
-
/**
|
1469 |
-
* Used in forms to set an option checked
|
1470 |
-
*
|
1471 |
-
* @param mixed $checked
|
1472 |
-
* @param mixed $current
|
1473 |
-
* @return strings
|
1474 |
-
*/
|
1475 |
-
function isChecked ($checked, $current)
|
1476 |
-
{
|
1477 |
-
$return = '';
|
1478 |
-
if ($checked == $current) {
|
1479 |
-
$return = ' checked="checked"';
|
1480 |
-
}
|
1481 |
-
return $return;
|
1482 |
-
}
|
1483 |
-
|
1484 |
-
/**
|
1485 |
-
* Displays the icon on the menu pages
|
1486 |
-
*
|
1487 |
-
* @param $icon
|
1488 |
-
*/
|
1489 |
-
function displayIcon ($icon)
|
1490 |
-
{
|
1491 |
-
return ('<div class="icon32" id="icon-' . $icon . '"><br/></div>');
|
1492 |
-
}
|
1493 |
-
|
1494 |
-
/**
|
1495 |
-
* Ajax Helper: inline delete of the groups
|
1496 |
-
*/
|
1497 |
-
function ajaxDeleteGroup ()
|
1498 |
-
{
|
1499 |
-
$group_id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
|
1500 |
-
check_ajax_referer('delete-avhecgroup_' . $group_id);
|
1501 |
-
|
1502 |
-
if (! current_user_can('manage_categories')) {
|
1503 |
-
die('-1');
|
1504 |
-
}
|
1505 |
-
$check = $this->catgrp->getGroup($group_id);
|
1506 |
-
if (false === $check) {
|
1507 |
-
die('1');
|
1508 |
-
}
|
1509 |
-
|
1510 |
-
if ($this->catgrp->doDeleteGroup($group_id)) {
|
1511 |
-
die('1');
|
1512 |
-
} else {
|
1513 |
-
die('0');
|
1514 |
-
}
|
1515 |
-
}
|
1516 |
-
}
|
1517 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/class/avh-ec.category-group.php
DELETED
@@ -1,409 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* AVH Extended Categorie Category Group Class
|
5 |
-
*
|
6 |
-
* @author Peter van der Does
|
7 |
-
*/
|
8 |
-
class AVH_EC_Category_Group
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* Taxonomy name
|
12 |
-
* @var string
|
13 |
-
*/
|
14 |
-
var $taxonomy_name;
|
15 |
-
|
16 |
-
var $db_options_widget_titles;
|
17 |
-
|
18 |
-
var $options_widget_titles;
|
19 |
-
|
20 |
-
var $widget_done_catgroup;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* PHP4 constructor.
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
function AVH_EC_Category_Group ()
|
27 |
-
{
|
28 |
-
return $this->__construct();
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* PHP5 Constructor
|
33 |
-
* Init the Database Abstraction layer
|
34 |
-
*
|
35 |
-
*/
|
36 |
-
function __construct ()
|
37 |
-
{
|
38 |
-
global $wpdb;
|
39 |
-
|
40 |
-
register_shutdown_function(array(&$this, '__destruct'));
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Taxonomy name
|
44 |
-
* @var string
|
45 |
-
*/
|
46 |
-
$this->taxonomy_name = 'avhec_catgroup';
|
47 |
-
|
48 |
-
$this->db_options_widget_titles = 'avhec_widget_titles';
|
49 |
-
// add DB pointer
|
50 |
-
$wpdb->avhec_cat_group = $wpdb->prefix . 'avhec_category_groups';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Create the table if it doesn't exist.
|
54 |
-
*
|
55 |
-
*/
|
56 |
-
if ($wpdb->get_var('show tables like \'' . $wpdb->avhec_cat_group . '\'') != $wpdb->avhec_cat_group) {
|
57 |
-
add_action('init', array(&$this, 'doCreateTable'), 2); // Priority needs to be the same as the Register Taxonomy
|
58 |
-
}
|
59 |
-
add_action('init', array(&$this, 'doRegisterTaxonomy'), 2); // Priority for registering custom taxonomies is +1 over the creation of the initial taxonomies
|
60 |
-
add_action('init', array(&$this, 'doSetupOptions'));
|
61 |
-
|
62 |
-
add_action('admin_init', array(&$this, 'addMetaBoxes'));
|
63 |
-
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* PHP5 style destructor and will run when database object is destroyed.
|
68 |
-
*
|
69 |
-
* @return bool Always true
|
70 |
-
*/
|
71 |
-
function __destruct ()
|
72 |
-
{
|
73 |
-
return true;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Create Table
|
78 |
-
* @WordPress action init
|
79 |
-
*
|
80 |
-
*/
|
81 |
-
function doCreateTable ()
|
82 |
-
{
|
83 |
-
global $wpdb;
|
84 |
-
|
85 |
-
// Setup the DB Tables
|
86 |
-
$charset_collate = '';
|
87 |
-
|
88 |
-
if (version_compare(mysql_get_server_info(), '4.1.0', '>=')) {
|
89 |
-
if (! empty($wpdb->charset))
|
90 |
-
$charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
|
91 |
-
if (! empty($wpdb->collate))
|
92 |
-
$charset_collate .= ' COLLATE ' . $wpdb->collate;
|
93 |
-
}
|
94 |
-
|
95 |
-
$sql = 'CREATE TABLE `' . $wpdb->avhec_cat_group . '` ( `group_term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`group_term_id`, `term_id`) )' . $charset_collate . ';';
|
96 |
-
|
97 |
-
$result = $wpdb->query($sql);
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Setup Group Categories Taxonomy
|
102 |
-
* @WordPress action init
|
103 |
-
*
|
104 |
-
*/
|
105 |
-
function doRegisterTaxonomy ()
|
106 |
-
{
|
107 |
-
/**
|
108 |
-
* As we don't want to see the Menu Item we have to disable show_ui. This also disables the metabox on the posts and pages, so we add thse manually instead.
|
109 |
-
* We remove the capabilities to manage, edit and delete the terms. We have written this part ourselves and don't use WordPress for these functions. The only one we use is the assign_terms.
|
110 |
-
*/
|
111 |
-
$labels = array('name'=>__('Category Groups', 'avh-ec'), 'singular_name'=>__('Category Group', 'avh-ec'), 'search_items'=>__('Search Category Groups', 'avh-ec'), 'popular_items'=>__('Popular Category Groups'), 'all_items'=>__('All Category Groups'), 'parent_item'=>__('Parent Category Group'), 'parent_item_colon'=>__('Parent Category Group:'), 'edit_item'=>__('Edit Category Group'), 'update_item'=>__('Update Category Group'), 'add_new_item'=>__('Add New Category Group'), 'new_item_name'=>__('New Category Group Name'));
|
112 |
-
$caps = array('manage_terms'=>null, 'edit_terms'=>null, 'delete_terms'=>null, 'assign_terms'=>'edit_posts');
|
113 |
-
register_taxonomy($this->taxonomy_name, array('post', 'page'), array('hierarchical'=>TRUE, 'labels'=>$labels, 'query_var'=>TRUE, 'rewrite'=>TRUE, 'show_in_nav_menus'=>FALSE, 'public'=>TRUE, 'show_ui'=>FALSE, 'capabilities'=>$caps));
|
114 |
-
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Setup the options for the widget titles
|
119 |
-
* @WordPress action init
|
120 |
-
*
|
121 |
-
*/
|
122 |
-
function doSetupOptions ()
|
123 |
-
{
|
124 |
-
// Setup the standard groups if the none group does not exists.
|
125 |
-
$all_categories = $this->getAllCategoriesTermID();
|
126 |
-
if (false === $this->getTermIDBy('slug', 'none')) {
|
127 |
-
$none_group_id = wp_insert_term('none', $this->taxonomy_name, array('description'=>__('This group will not show the widget.', 'avh-ec')));
|
128 |
-
$all_group_id = wp_insert_term('All', $this->taxonomy_name, array('description'=>__('Holds all the categories.', 'avh-ec')));
|
129 |
-
$home_group_id = wp_insert_term('Home', $this->taxonomy_name, array('description'=>__('This group will be shown on the front page.', 'avh-ec')));
|
130 |
-
|
131 |
-
// Fill the standard groups with all categories
|
132 |
-
$this->setCategoriesForGroup($home_group_id['term_id'], $all_categories);
|
133 |
-
$this->setWidgetTitleForGroup($all_group_id['term_id'], '');
|
134 |
-
$this->setWidgetTitleForGroup($home_group_id['term_id'], '');
|
135 |
-
}
|
136 |
-
|
137 |
-
$options = get_option($this->db_options_widget_titles);
|
138 |
-
if (! $options) {
|
139 |
-
$options = array();
|
140 |
-
$id = $this->getTermIDBy('slug', 'all');
|
141 |
-
$options[$id] = '';
|
142 |
-
$id = $this->getTermIDBy('slug', 'home');
|
143 |
-
$options[$id] = '';
|
144 |
-
update_option($this->db_options_widget_titles, $options);
|
145 |
-
}
|
146 |
-
$this->options_widget_titles = $options;
|
147 |
-
$this->setCategoriesForGroup($this->getTermIDBy('slug', 'all'), $all_categories);
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Add the metaboxes for the pots and page pages.
|
152 |
-
* @WordPress action admin_init
|
153 |
-
*
|
154 |
-
*/
|
155 |
-
function addMetaBoxes ()
|
156 |
-
{
|
157 |
-
add_meta_box($this->taxonomy_name . 'div', __('Category Groups', 'avh-ec'), 'post_categories_meta_box', 'post', 'side', 'core', array('taxonomy'=>$this->taxonomy_name));
|
158 |
-
add_meta_box($this->taxonomy_name . 'div', __('Category Groups', 'avh-ec'), 'post_categories_meta_box', 'page', 'side', 'core', array('taxonomy'=>$this->taxonomy_name));
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Get all groups term_id
|
163 |
-
*
|
164 |
-
* @return array Term_id
|
165 |
-
*/
|
166 |
-
function getAllCategoriesTermID ()
|
167 |
-
{
|
168 |
-
$all_cat_id = array();
|
169 |
-
$categories = get_categories();
|
170 |
-
if (! is_wp_error($categories)) {
|
171 |
-
foreach ($categories as $category) {
|
172 |
-
$all_cat_id[] = $category->term_id;
|
173 |
-
}
|
174 |
-
}
|
175 |
-
return ($all_cat_id);
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Get the categories from the given group from the DB
|
180 |
-
*
|
181 |
-
* @param int $group_id The Taxonomy Term ID
|
182 |
-
* @return Array|False categories. Will return FALSE, if the row does not exists.
|
183 |
-
*
|
184 |
-
*/
|
185 |
-
function getCategoriesFromGroup ($group_id)
|
186 |
-
{
|
187 |
-
global $wpdb;
|
188 |
-
|
189 |
-
// Query database
|
190 |
-
$result = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->terms . ' t, ' . $wpdb->avhec_cat_group . ' cg WHERE t.term_id = cg.term_id AND cg.group_term_id = %d', $group_id));
|
191 |
-
|
192 |
-
if (is_array($result)) { // Call succeeded
|
193 |
-
if (empty($result)) { // No rows found
|
194 |
-
$return = array();
|
195 |
-
} else {
|
196 |
-
foreach ($result as $row) {
|
197 |
-
$return[] = $row->term_id;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
} else {
|
201 |
-
$return = false;
|
202 |
-
}
|
203 |
-
return ($return);
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Set the categories for the given group from the DB. Insert the group if it doesn't exists.
|
208 |
-
*
|
209 |
-
* @param int $group_id The Taxonomy Term ID
|
210 |
-
* @param array $categories The categories
|
211 |
-
* @return Object (false if not found)
|
212 |
-
*
|
213 |
-
*/
|
214 |
-
function setCategoriesForGroup ($group_id, $categories = array())
|
215 |
-
{
|
216 |
-
global $wpdb;
|
217 |
-
|
218 |
-
$old_categories = $this->getCategoriesFromGroup($group_id);
|
219 |
-
|
220 |
-
if (! is_array($categories)) {
|
221 |
-
$categories = array();
|
222 |
-
}
|
223 |
-
$new_categories = $categories;
|
224 |
-
sort($old_categories);
|
225 |
-
sort($new_categories);
|
226 |
-
// If the new and old values are the same, no need to update.
|
227 |
-
if ($new_categories === $old_categories) {
|
228 |
-
return false;
|
229 |
-
}
|
230 |
-
|
231 |
-
$new = array_diff($new_categories, $old_categories);
|
232 |
-
$removed = array_diff($old_categories, $new_categories);
|
233 |
-
|
234 |
-
if (! empty($new)) {
|
235 |
-
foreach ($new as $cat_term_id) {
|
236 |
-
$insert[] = '(' . $group_id . ',' . $cat_term_id . ')';
|
237 |
-
}
|
238 |
-
$value = implode(',', $insert);
|
239 |
-
$sql = 'INSERT INTO ' . $wpdb->avhec_cat_group . ' (group_term_id, term_id) VALUES ' . $value;
|
240 |
-
$result = $wpdb->query($sql);
|
241 |
-
|
242 |
-
}
|
243 |
-
|
244 |
-
if (! empty($removed)) {
|
245 |
-
$delete = implode(',', $removed);
|
246 |
-
$sql = $wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d and term_id IN (' . $delete . ')', $group_id);
|
247 |
-
$result = $wpdb->query($sql);
|
248 |
-
|
249 |
-
}
|
250 |
-
|
251 |
-
return $result;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Set the Widget Title for a Group
|
256 |
-
* @param int $group_id
|
257 |
-
* @param string $widget_title
|
258 |
-
*
|
259 |
-
*/
|
260 |
-
function setWidgetTitleForGroup ($group_id, $widget_title = '')
|
261 |
-
{
|
262 |
-
$this->options_widget_titles[$group_id] = $widget_title;
|
263 |
-
update_option($this->db_options_widget_titles, $this->options_widget_titles);
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Return the title for a group_id if exsist otherwise return false
|
268 |
-
* @param $group_id
|
269 |
-
*
|
270 |
-
*/
|
271 |
-
function getWidgetTitleForGroup ($group_id)
|
272 |
-
{
|
273 |
-
if (isset($this->options_widget_titles[$group_id])) {
|
274 |
-
return ($this->options_widget_titles[$group_id]);
|
275 |
-
}
|
276 |
-
return false;
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Delete the Widget Title for a group
|
281 |
-
*
|
282 |
-
* @param $group_id
|
283 |
-
*/
|
284 |
-
function doDeleteWidgetTitle ($group_id)
|
285 |
-
{
|
286 |
-
if (isset($this->db_options_widget_titles[$group_id])) {
|
287 |
-
unset($this->db_options_widget_titles[$group_id]);
|
288 |
-
}
|
289 |
-
update_option($this->db_options_widget_titles, $this->options_widget_titles);
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Same as get_term_by, but returns the ID only if found, else false
|
294 |
-
* @param string $field
|
295 |
-
* @param string $value
|
296 |
-
* @return int|boolean
|
297 |
-
*/
|
298 |
-
function getTermIDBy ($field, $value)
|
299 |
-
{
|
300 |
-
$row = get_term_by($field, $value, $this->taxonomy_name);
|
301 |
-
if (false === $row) {
|
302 |
-
$return = false;
|
303 |
-
} else {
|
304 |
-
$return = (int) $row->term_id;
|
305 |
-
}
|
306 |
-
return ($return);
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Gets all information of a group
|
311 |
-
*
|
312 |
-
* @param $group_id
|
313 |
-
* @return Object|False Returns False when the group doesn't exists.
|
314 |
-
*/
|
315 |
-
function getGroup ($group_id)
|
316 |
-
{
|
317 |
-
global $wpdb;
|
318 |
-
|
319 |
-
$result = get_term((int) $group_id, $this->taxonomy_name);
|
320 |
-
if (null === $result) {
|
321 |
-
$result = false;
|
322 |
-
}
|
323 |
-
return ($result);
|
324 |
-
}
|
325 |
-
|
326 |
-
function getGroupByCategoryID($category_id){
|
327 |
-
$return = get_term_by('slug', 'none', $this->taxonomy_name);
|
328 |
-
$cat_groups = get_terms($this->taxonomy_name, array('hide_empty'=>FALSE));
|
329 |
-
|
330 |
-
foreach ($cat_groups as $group) {
|
331 |
-
$cats = $this->getCategoriesFromGroup($group->term_id);
|
332 |
-
if ($group->slug != 'all' && in_array($category_id,$cats)) {
|
333 |
-
$return = $group;
|
334 |
-
break;
|
335 |
-
}
|
336 |
-
}
|
337 |
-
return $return;
|
338 |
-
}
|
339 |
-
/**
|
340 |
-
* Inserts a new group
|
341 |
-
*
|
342 |
-
* @param $term
|
343 |
-
* @param array $args
|
344 |
-
*/
|
345 |
-
function doInsertGroup ($term, $args = array(), $widget_title = '')
|
346 |
-
{
|
347 |
-
$row = wp_insert_term($term, $this->taxonomy_name, $args);
|
348 |
-
$this->setWidgetTitleForGroup($term, $widget_title);
|
349 |
-
return ($row['term_id']);
|
350 |
-
}
|
351 |
-
|
352 |
-
/**
|
353 |
-
* Deletes a group
|
354 |
-
*
|
355 |
-
* @param $group_id
|
356 |
-
*/
|
357 |
-
function doDeleteGroup ($group_id)
|
358 |
-
{
|
359 |
-
|
360 |
-
global $wpdb;
|
361 |
-
|
362 |
-
$group = $this->getGroup($group_id);
|
363 |
-
$result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d', $group_id));
|
364 |
-
$this->doDeleteWidgetTitle($group_id);
|
365 |
-
$return = wp_delete_term($group->term_id, $this->taxonomy_name);
|
366 |
-
|
367 |
-
return ($return);
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Update a group
|
372 |
-
*
|
373 |
-
* @param $group_id
|
374 |
-
* @param $selected_categories
|
375 |
-
* @param $widget_title
|
376 |
-
*
|
377 |
-
* return -1,0,1 Unknown Group, Duplicate Slug, Succesfull
|
378 |
-
*/
|
379 |
-
function doUpdateGroup ($group_id, $args = array(), $selected_categories, $widget_title = '')
|
380 |
-
{
|
381 |
-
|
382 |
-
$group = $this->getGroup($group_id);
|
383 |
-
if (is_object($group)) {
|
384 |
-
$id = wp_update_term($group->term_id, $this->taxonomy_name, $args);
|
385 |
-
if (! is_wp_error($id)) {
|
386 |
-
$this->setWidgetTitleForGroup($group_id, $widget_title);
|
387 |
-
$this->setCategoriesForGroup($group_id, $selected_categories);
|
388 |
-
$return = 1; // Succesful
|
389 |
-
} else {
|
390 |
-
$return = 0; // Duplicate Slug
|
391 |
-
}
|
392 |
-
} else {
|
393 |
-
$return = - 1; // Unknown group
|
394 |
-
}
|
395 |
-
return ($return);
|
396 |
-
}
|
397 |
-
|
398 |
-
/**
|
399 |
-
* Deletes the given category from all groups
|
400 |
-
*
|
401 |
-
* @param $category_id
|
402 |
-
*/
|
403 |
-
function doDeleteCategoryFromGroup ($category_id)
|
404 |
-
{
|
405 |
-
global $wpdb;
|
406 |
-
$result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE term_id=%d', $category_id));
|
407 |
-
}
|
408 |
-
}
|
409 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/class/avh-ec.core.php
DELETED
@@ -1,736 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class AVH_EC_Core
|
4 |
-
{
|
5 |
-
var $version;
|
6 |
-
var $comment;
|
7 |
-
var $info;
|
8 |
-
var $db_options_core;
|
9 |
-
var $default_options;
|
10 |
-
var $default_options_general;
|
11 |
-
var $default_options_category_group;
|
12 |
-
var $default_options_sp_category_group;
|
13 |
-
|
14 |
-
var $db_options_tax_meta;
|
15 |
-
|
16 |
-
var $options;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* PHP5 constructor
|
20 |
-
*
|
21 |
-
*/
|
22 |
-
function __construct ()
|
23 |
-
{
|
24 |
-
/**
|
25 |
-
*
|
26 |
-
* @var AVH_EC_Category_Group
|
27 |
-
*/
|
28 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
-
|
30 |
-
$this->version = '3.6.6';
|
31 |
-
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
32 |
-
$this->db_options_core = 'avhec';
|
33 |
-
$this->db_options_tax_meta = 'avhec-tax_meta';
|
34 |
-
|
35 |
-
add_action('init', array ( &$this, 'handleInitializePlugin' ), 10);
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* PHP4 Constructor
|
40 |
-
*
|
41 |
-
* @return AVHExtendedCategoriesCore
|
42 |
-
*/
|
43 |
-
function AVH_EC_Core ()
|
44 |
-
{
|
45 |
-
$this->__construct();
|
46 |
-
}
|
47 |
-
|
48 |
-
function handleInitializePlugin ()
|
49 |
-
{
|
50 |
-
global $wpdb;
|
51 |
-
|
52 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
53 |
-
$db_version = 4;
|
54 |
-
|
55 |
-
$info['siteurl'] = get_option('siteurl');
|
56 |
-
$info['plugin_dir'] = AVHEC_PLUGIN_DIR;
|
57 |
-
$info['graphics_url'] = AVHEC_PLUGIN_URL . '/images';
|
58 |
-
|
59 |
-
// Set class property for info
|
60 |
-
$this->info = array ( 'home' => get_option('home'), 'siteurl' => $info['siteurl'], 'plugin_dir' => $info['plugin_dir'], 'js_dir' => $info['plugin_dir'] . '/js', 'graphics_url' => $info['graphics_url'] );
|
61 |
-
|
62 |
-
// Set the default options
|
63 |
-
$this->default_options_general = array ( 'version' => $this->version, 'dbversion' => $db_version, 'alternative_name_select_category' => '' );
|
64 |
-
|
65 |
-
// Set the default category group options
|
66 |
-
$no_group_id = $catgrp->getTermIDBy('slug', 'none');
|
67 |
-
$home_group_id = $catgrp->getTermIDBy('slug', 'home');
|
68 |
-
$default_group_id = $catgrp->getTermIDBy('slug', 'all');
|
69 |
-
$this->default_options_category_group = array ( 'no_group' => $no_group_id, 'home_group' => $home_group_id, 'default_group' => $default_group_id );
|
70 |
-
|
71 |
-
$this->default_options_sp_category_group = array ( 'home_group' => $home_group_id, 'category_group' => $default_group_id, 'day_group' => $default_group_id, 'month_group' => $default_group_id, 'year_group' => $default_group_id, 'author_group' => $default_group_id, 'search_group' => $default_group_id );
|
72 |
-
|
73 |
-
$this->default_options = array ( 'general' => $this->default_options_general, 'cat_group' => $this->default_options_category_group, 'widget_titles' => array (), 'sp_cat_group' => $this->default_options_sp_category_group );
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Set the options for the program
|
77 |
-
*
|
78 |
-
*/
|
79 |
-
$this->loadOptions();
|
80 |
-
|
81 |
-
// Check if we have to do updates
|
82 |
-
if ((! isset($this->options['general']['dbversion'])) || $this->options['general']['dbversion'] < $db_version) {
|
83 |
-
$this->doUpdateOptions($db_version);
|
84 |
-
}
|
85 |
-
|
86 |
-
$db = new AVH_DB();
|
87 |
-
if (! $db->field_exists('avhec_term_order', $wpdb->terms)) {
|
88 |
-
$wpdb->query("ALTER TABLE $wpdb->terms ADD `avhec_term_order` INT( 4 ) NULL DEFAULT '0'");
|
89 |
-
}
|
90 |
-
|
91 |
-
$this->handleTextdomain();
|
92 |
-
add_filter('get_terms_orderby', array ( &$this, 'applyOrderFilter' ), 10, 2);
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
function applyOrderFilter ($orderby, $args)
|
97 |
-
{
|
98 |
-
switch ($args['orderby']) {
|
99 |
-
case 'avhec_manualorder':
|
100 |
-
$new_orderby = 't.avhec_term_order';
|
101 |
-
break;
|
102 |
-
case 'avhec_3rdparty_mycategoryorder':
|
103 |
-
$new_orderby = 't.term_order';
|
104 |
-
break;
|
105 |
-
default:
|
106 |
-
$new_orderby = $orderby;
|
107 |
-
break;
|
108 |
-
}
|
109 |
-
return $new_orderby;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Loads the i18n
|
114 |
-
*
|
115 |
-
* @return
|
116 |
-
*/
|
117 |
-
function handleTextdomain ()
|
118 |
-
{
|
119 |
-
|
120 |
-
load_plugin_textdomain('avh-ec', false, AVHEC_RELATIVE_PLUGIN_DIR . '/lang');
|
121 |
-
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Checks if running version is newer and do upgrades if necessary
|
126 |
-
*
|
127 |
-
* @since 1.2.3
|
128 |
-
*
|
129 |
-
*/
|
130 |
-
function doUpdateOptions ($db_version)
|
131 |
-
{
|
132 |
-
$options = $this->getOptions();
|
133 |
-
|
134 |
-
// Add none existing sections and/or elements to the options
|
135 |
-
foreach ($this->default_options as $section => $default_data) {
|
136 |
-
if (! array_key_exists($section, $options)) {
|
137 |
-
$options[$section] = $default_data;
|
138 |
-
continue;
|
139 |
-
}
|
140 |
-
foreach ($default_data as $element => $default_value) {
|
141 |
-
if (! array_key_exists($element, $options[$section])) {
|
142 |
-
$options[$section][$element] = $default_value;
|
143 |
-
}
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
// Remove none existing sections and/or elements from the options
|
148 |
-
foreach ($options as $section => $data) {
|
149 |
-
if (! array_key_exists($section, $this->default_options)) {
|
150 |
-
unset($options[$section]);
|
151 |
-
continue;
|
152 |
-
}
|
153 |
-
foreach ($data as $element => $value) {
|
154 |
-
if (! array_key_exists($element, $this->default_options[$section])) {
|
155 |
-
unset($options[$section][$element]);
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
/**
|
160 |
-
* Update the options to the latests versions
|
161 |
-
*/
|
162 |
-
$options['general']['version'] = $this->version;
|
163 |
-
$options['general']['dbversion'] = $db_version;
|
164 |
-
$this->saveOptions($options);
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Used in forms to set the checked option.
|
169 |
-
*
|
170 |
-
* @param mixed $checked
|
171 |
-
* @param mixed_type $current
|
172 |
-
* @return string
|
173 |
-
*
|
174 |
-
* @since 2.0
|
175 |
-
*/
|
176 |
-
function isChecked ($checked, $current)
|
177 |
-
{
|
178 |
-
if ($checked == $current) {
|
179 |
-
return (' checked="checked"');
|
180 |
-
}
|
181 |
-
return ('');
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Used in forms to set the SELECTED option
|
186 |
-
*
|
187 |
-
* @param string $current
|
188 |
-
* @param string $field
|
189 |
-
* @return string
|
190 |
-
*/
|
191 |
-
function isSelected ($current, $field)
|
192 |
-
{
|
193 |
-
if ($current == $field) {
|
194 |
-
return (' SELECTED');
|
195 |
-
}
|
196 |
-
return ('');
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Get the base directory of a directory structure
|
201 |
-
*
|
202 |
-
* @param string $directory
|
203 |
-
* @return string
|
204 |
-
*
|
205 |
-
*/
|
206 |
-
function getBaseDirectory ($directory)
|
207 |
-
{
|
208 |
-
//place each directory into array and get the last element
|
209 |
-
$return = end(explode('/', $directory));
|
210 |
-
|
211 |
-
return $return;
|
212 |
-
}
|
213 |
-
|
214 |
-
/*********************************
|
215 |
-
* *
|
216 |
-
* Methods for variable: options *
|
217 |
-
* *
|
218 |
-
********************************/
|
219 |
-
|
220 |
-
/**
|
221 |
-
* @param array $data
|
222 |
-
*/
|
223 |
-
function setOptions ($options)
|
224 |
-
{
|
225 |
-
$this->options = $options;
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* return array
|
230 |
-
*/
|
231 |
-
function getOptions ()
|
232 |
-
{
|
233 |
-
return ($this->options);
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Save all current options and set the options
|
238 |
-
*
|
239 |
-
*/
|
240 |
-
function saveOptions ($options)
|
241 |
-
{
|
242 |
-
update_option($this->db_options_core, $options);
|
243 |
-
wp_cache_flush(); // Delete cache
|
244 |
-
$this->setOptions($options);
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Retrieves the plugin options from the WordPress options table and assigns to class variable.
|
249 |
-
* If the options do not exists, like a new installation, the options are set to the default value.
|
250 |
-
*
|
251 |
-
* @return none
|
252 |
-
*/
|
253 |
-
function loadOptions ()
|
254 |
-
{
|
255 |
-
$options = get_option($this->db_options_core);
|
256 |
-
if (false === $options) { // New installation
|
257 |
-
$this->resetToDefaultOptions();
|
258 |
-
} else {
|
259 |
-
$this->setOptions($options);
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Get the value for an option element. If there's no option is set on the Admin page, return the default value.
|
265 |
-
*
|
266 |
-
* @param string $key
|
267 |
-
* @param string $option
|
268 |
-
* @return mixed
|
269 |
-
*/
|
270 |
-
function getOptionElement ($option, $key)
|
271 |
-
{
|
272 |
-
if ($this->options[$option][$key]) {
|
273 |
-
$return = $this->options[$option][$key]; // From Admin Page
|
274 |
-
} else {
|
275 |
-
$return = $this->default_options[$option][$key]; // Default
|
276 |
-
}
|
277 |
-
return ($return);
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Reset to default options and save in DB
|
282 |
-
*
|
283 |
-
*/
|
284 |
-
function resetToDefaultOptions ()
|
285 |
-
{
|
286 |
-
$this->options = $this->default_options;
|
287 |
-
$this->saveOptions($this->default_options);
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Display or retrieve the HTML dropdown list of categories.
|
292 |
-
*
|
293 |
-
* The list of arguments is below:
|
294 |
-
* 'show_option_all' (string) - Text to display for showing all categories.
|
295 |
-
* 'show_option_none' (string) - Text to display for showing no categories.
|
296 |
-
* 'orderby' (string) default is 'ID' - What column to use for ordering the
|
297 |
-
* categories.
|
298 |
-
* 'order' (string) default is 'ASC' - What direction to order categories.
|
299 |
-
* 'show_last_update' (bool|int) default is 0 - See {@link get_categories()}
|
300 |
-
* 'show_count' (bool|int) default is 0 - Whether to show how many posts are
|
301 |
-
* in the category.
|
302 |
-
* 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
|
303 |
-
* don't have any posts attached to them.
|
304 |
-
* 'child_of' (int) default is 0 - See {@link get_categories()}.
|
305 |
-
* 'exclude' (string) - See {@link get_categories()}.
|
306 |
-
* 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
|
307 |
-
* 'depth' (int) - The max depth.
|
308 |
-
* 'tab_index' (int) - Tab index for select element.
|
309 |
-
* 'name' (string) - The name attribute value for selected element.
|
310 |
-
* 'class' (string) - The class attribute value for selected element.
|
311 |
-
* 'selected' (int) - Which category ID is selected.
|
312 |
-
*
|
313 |
-
* The 'hierarchical' argument, which is disabled by default, will override the
|
314 |
-
* depth argument, unless it is true. When the argument is false, it will
|
315 |
-
* display all of the categories. When it is enabled it will use the value in
|
316 |
-
* the 'depth' argument.
|
317 |
-
*
|
318 |
-
* @since 2.1.0
|
319 |
-
*
|
320 |
-
* @param string|array $args Optional. Override default arguments.
|
321 |
-
* @return string HTML content only if 'echo' argument is 0.
|
322 |
-
*/
|
323 |
-
function avh_wp_dropdown_categories ($args = '', $selectedonly)
|
324 |
-
{
|
325 |
-
$mywalker = new AVH_Walker_CategoryDropdown();
|
326 |
-
|
327 |
-
$defaults = array ( 'show_option_all' => '', 'show_option_none' => '', 'orderby' => 'id', 'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'walker' => $mywalker );
|
328 |
-
|
329 |
-
$defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
|
330 |
-
|
331 |
-
$r = wp_parse_args($args, $defaults);
|
332 |
-
|
333 |
-
if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
|
334 |
-
$r['pad_counts'] = true;
|
335 |
-
}
|
336 |
-
|
337 |
-
$r['include_last_update_time'] = $r['show_last_update'];
|
338 |
-
extract($r);
|
339 |
-
|
340 |
-
$tab_index_attribute = '';
|
341 |
-
if ((int) $tab_index > 0)
|
342 |
-
$tab_index_attribute = ' tabindex="' . $tab_index . '"';
|
343 |
-
|
344 |
-
$categories = get_categories($r);
|
345 |
-
$name = esc_attr($name);
|
346 |
-
$class = esc_attr($class);
|
347 |
-
|
348 |
-
$output = '';
|
349 |
-
if (! empty($categories)) {
|
350 |
-
$output = '<select name="' . $name . '" id="' . $name . '" class="' . $class . '" ' . $tab_index_attribute . '>' . "\n";
|
351 |
-
|
352 |
-
if ($show_option_all) {
|
353 |
-
$show_option_all = apply_filters('list_cats', $show_option_all);
|
354 |
-
$selected = ('0' === strval($r['selected'])) ? " selected='selected'" : '';
|
355 |
-
$output .= "\t" . '<option value="0"' . $selected . '>' . $show_option_all . '</option>' . "\n";
|
356 |
-
}
|
357 |
-
|
358 |
-
if ($show_option_none) {
|
359 |
-
$show_option_none = apply_filters('list_cats', $show_option_none);
|
360 |
-
$selected = ('-1' === strval($r['selected'])) ? " selected='selected'" : '';
|
361 |
-
$output .= "\t" . '<option value="-1"' . $selected . '>' . $show_option_none . '</option>' . "\n";
|
362 |
-
}
|
363 |
-
|
364 |
-
if ($hierarchical) {
|
365 |
-
$depth = $r['depth']; // Walk the full depth.
|
366 |
-
} else {
|
367 |
-
$depth = - 1; // Flat
|
368 |
-
}
|
369 |
-
$output .= walk_category_dropdown_tree($categories, $depth, $r);
|
370 |
-
$output .= "</select>\n";
|
371 |
-
}
|
372 |
-
|
373 |
-
$output = apply_filters('wp_dropdown_cats', $output);
|
374 |
-
|
375 |
-
if ($echo)
|
376 |
-
echo $output;
|
377 |
-
|
378 |
-
return $output;
|
379 |
-
}
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Display or retrieve the HTML list of categories.
|
383 |
-
*
|
384 |
-
* The list of arguments is below:
|
385 |
-
* 'show_option_all' (string) - Text to display for showing all categories.
|
386 |
-
* 'orderby' (string) default is 'ID' - What column to use for ordering the
|
387 |
-
* categories.
|
388 |
-
* 'order' (string) default is 'ASC' - What direction to order categories.
|
389 |
-
* 'show_last_update' (bool|int) default is 0 - See {@link
|
390 |
-
* walk_category_dropdown_tree()}
|
391 |
-
* 'show_count' (bool|int) default is 0 - Whether to show how many posts are
|
392 |
-
* in the category.
|
393 |
-
* 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
|
394 |
-
* don't have any posts attached to them.
|
395 |
-
* 'use_desc_for_title' (bool|int) default is 1 - Whether to use the
|
396 |
-
* description instead of the category title.
|
397 |
-
* 'feed' - See {@link get_categories()}.
|
398 |
-
* 'feed_type' - See {@link get_categories()}.
|
399 |
-
* 'feed_image' - See {@link get_categories()}.
|
400 |
-
* 'child_of' (int) default is 0 - See {@link get_categories()}.
|
401 |
-
* 'exclude' (string) - See {@link get_categories()}.
|
402 |
-
* 'exclude_tree' (string) - See {@link get_categories()}.
|
403 |
-
* 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
|
404 |
-
* 'current_category' (int) - See {@link get_categories()}.
|
405 |
-
* 'hierarchical' (bool) - See {@link get_categories()}.
|
406 |
-
* 'title_li' (string) - See {@link get_categories()}.
|
407 |
-
* 'depth' (int) - The max depth.
|
408 |
-
*
|
409 |
-
* @since 2.1.0
|
410 |
-
*
|
411 |
-
* @param string|array $args Optional. Override default arguments.
|
412 |
-
* @return string HTML content only if 'echo' argument is 0.
|
413 |
-
*/
|
414 |
-
function avh_wp_list_categories ($args = '', $selectedonly)
|
415 |
-
{
|
416 |
-
$mywalker = new AVHEC_Walker_Category();
|
417 |
-
$defaults = array ( 'show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0, 'hierarchical' => true, 'title_li' => __('Categories'), 'echo' => 1, 'depth' => 0, 'walker' => $mywalker );
|
418 |
-
|
419 |
-
$r = wp_parse_args($args, $defaults);
|
420 |
-
|
421 |
-
if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
|
422 |
-
$r['pad_counts'] = true;
|
423 |
-
}
|
424 |
-
|
425 |
-
if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
|
426 |
-
$r['pad_counts'] = true;
|
427 |
-
}
|
428 |
-
|
429 |
-
if (isset($r['show_date'])) {
|
430 |
-
$r['include_last_update_time'] = $r['show_date'];
|
431 |
-
}
|
432 |
-
|
433 |
-
if (true == $r['hierarchical']) {
|
434 |
-
$r['exclude_tree'] = $r['exclude'];
|
435 |
-
$r['exclude'] = '';
|
436 |
-
}
|
437 |
-
|
438 |
-
extract($r);
|
439 |
-
|
440 |
-
$categories = get_categories($r);
|
441 |
-
|
442 |
-
$output = '';
|
443 |
-
if ($title_li && 'list' == $style)
|
444 |
-
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
445 |
-
|
446 |
-
if (empty($categories)) {
|
447 |
-
if ('list' == $style)
|
448 |
-
$output .= '<li>' . __("No categories") . '</li>';
|
449 |
-
else
|
450 |
-
$output .= __("No categories");
|
451 |
-
} else {
|
452 |
-
global $wp_query;
|
453 |
-
|
454 |
-
if (! empty($show_option_all))
|
455 |
-
if ('list' == $style)
|
456 |
-
$output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
|
457 |
-
else
|
458 |
-
$output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
|
459 |
-
|
460 |
-
if (empty($r['current_category']) && is_category())
|
461 |
-
$r['current_category'] = $wp_query->get_queried_object_id();
|
462 |
-
|
463 |
-
if ($hierarchical) {
|
464 |
-
$depth = $r['depth'];
|
465 |
-
} else {
|
466 |
-
$depth = - 1; // Flat.
|
467 |
-
}
|
468 |
-
|
469 |
-
$output .= walk_category_tree($categories, $depth, $r);
|
470 |
-
}
|
471 |
-
|
472 |
-
if ($title_li && 'list' == $style)
|
473 |
-
$output .= '</ul></li>';
|
474 |
-
|
475 |
-
$output = apply_filters('wp_list_categories', $output);
|
476 |
-
|
477 |
-
if ($echo)
|
478 |
-
echo $output;
|
479 |
-
else
|
480 |
-
return $output;
|
481 |
-
}
|
482 |
-
|
483 |
-
function getCategories ()
|
484 |
-
{
|
485 |
-
static $_categories = NULL;
|
486 |
-
if (NULL === $_categories) {
|
487 |
-
$_categories = get_categories('get=all');
|
488 |
-
}
|
489 |
-
return $_categories;
|
490 |
-
}
|
491 |
-
|
492 |
-
function getCategoriesId ($categories)
|
493 |
-
{
|
494 |
-
static $_categories_id = NULL;
|
495 |
-
if (NULL == $_categories_id) {
|
496 |
-
foreach ($categories as $key => $category) {
|
497 |
-
$_categories_id[$category->term_id] = $key;
|
498 |
-
}
|
499 |
-
}
|
500 |
-
return $_categories_id;
|
501 |
-
}
|
502 |
-
}
|
503 |
-
|
504 |
-
/**
|
505 |
-
* Create HTML dropdown list of Categories.
|
506 |
-
*
|
507 |
-
* @uses Walker
|
508 |
-
*/
|
509 |
-
class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
|
510 |
-
{
|
511 |
-
|
512 |
-
function walk ($elements, $max_depth)
|
513 |
-
{
|
514 |
-
|
515 |
-
$args = array_slice(func_get_args(), 2);
|
516 |
-
$output = '';
|
517 |
-
|
518 |
-
if ($max_depth < - 1) //invalid parameter
|
519 |
-
return $output;
|
520 |
-
|
521 |
-
if (empty($elements)) //nothing to walk
|
522 |
-
return $output;
|
523 |
-
|
524 |
-
$id_field = $this->db_fields['id'];
|
525 |
-
$parent_field = $this->db_fields['parent'];
|
526 |
-
|
527 |
-
// flat display
|
528 |
-
if (- 1 == $max_depth) {
|
529 |
-
$empty_array = array ();
|
530 |
-
foreach ($elements as $e)
|
531 |
-
$this->display_element($e, $empty_array, 1, 0, $args, $output);
|
532 |
-
return $output;
|
533 |
-
}
|
534 |
-
|
535 |
-
/*
|
536 |
-
* need to display in hierarchical order
|
537 |
-
* seperate elements into two buckets: top level and children elements
|
538 |
-
* children_elements is two dimensional array, eg.
|
539 |
-
* children_elements[10][] contains all sub-elements whose parent is 10.
|
540 |
-
*/
|
541 |
-
$top_level_elements = array ();
|
542 |
-
$children_elements = array ();
|
543 |
-
foreach ($elements as $e) {
|
544 |
-
if (0 == $e->$parent_field)
|
545 |
-
$top_level_elements[] = $e;
|
546 |
-
else
|
547 |
-
$children_elements[$e->$parent_field][] = $e;
|
548 |
-
}
|
549 |
-
|
550 |
-
/*
|
551 |
-
* when none of the elements is top level
|
552 |
-
* assume the first one must be root of the sub elements
|
553 |
-
*/
|
554 |
-
if (empty($top_level_elements)) {
|
555 |
-
|
556 |
-
$first = array_slice($elements, 0, 1);
|
557 |
-
$root = $first[0];
|
558 |
-
|
559 |
-
$top_level_elements = array ();
|
560 |
-
$children_elements = array ();
|
561 |
-
foreach ($elements as $e) {
|
562 |
-
if ($root->$parent_field == $e->$parent_field)
|
563 |
-
$top_level_elements[] = $e;
|
564 |
-
else
|
565 |
-
$children_elements[$e->$parent_field][] = $e;
|
566 |
-
}
|
567 |
-
}
|
568 |
-
|
569 |
-
foreach ($top_level_elements as $e)
|
570 |
-
$this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
|
571 |
-
|
572 |
-
/*
|
573 |
-
* if we are displaying all levels, and remaining children_elements is not empty,
|
574 |
-
* then we got orphans, which should be displayed regardless
|
575 |
-
*/
|
576 |
-
if ((0 == $max_depth) && count($children_elements) > 0) {
|
577 |
-
$empty_array = array ();
|
578 |
-
foreach ($children_elements as $orphans)
|
579 |
-
foreach ($orphans as $op)
|
580 |
-
$this->display_element($op, $empty_array, 1, 0, $args, $output);
|
581 |
-
}
|
582 |
-
|
583 |
-
return $output;
|
584 |
-
}
|
585 |
-
}
|
586 |
-
|
587 |
-
/**
|
588 |
-
* Create HTML list of categories.
|
589 |
-
*
|
590 |
-
* @uses Walker
|
591 |
-
*/
|
592 |
-
class AVHEC_Walker_Category extends Walker
|
593 |
-
{
|
594 |
-
/**
|
595 |
-
* @see Walker::$tree_type
|
596 |
-
* @since 2.1.0
|
597 |
-
* @var string
|
598 |
-
*/
|
599 |
-
var $tree_type = 'category';
|
600 |
-
|
601 |
-
/**
|
602 |
-
* @see Walker::$db_fields
|
603 |
-
* @since 2.1.0
|
604 |
-
* @todo Decouple this
|
605 |
-
* @var array
|
606 |
-
*/
|
607 |
-
var $db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' );
|
608 |
-
|
609 |
-
/**
|
610 |
-
* @see Walker::start_lvl()
|
611 |
-
* @since 2.1.0
|
612 |
-
*
|
613 |
-
* @param string $output Passed by reference. Used to append additional content.
|
614 |
-
* @param int $depth Depth of category. Used for tab indentation.
|
615 |
-
* @param array $args Will only append content if style argument value is 'list'.
|
616 |
-
*/
|
617 |
-
function start_lvl (&$output, $depth, $args)
|
618 |
-
{
|
619 |
-
if ('list' != $args['style'])
|
620 |
-
return;
|
621 |
-
|
622 |
-
$indent = str_repeat("\t", $depth);
|
623 |
-
$output .= $indent . '<ul class="children">' . "\n";
|
624 |
-
}
|
625 |
-
|
626 |
-
/**
|
627 |
-
* @see Walker::end_lvl()
|
628 |
-
* @since 2.1.0
|
629 |
-
*
|
630 |
-
* @param string $output Passed by reference. Used to append additional content.
|
631 |
-
* @param int $depth Depth of category. Used for tab indentation.
|
632 |
-
* @param array $args Will only append content if style argument value is 'list'.
|
633 |
-
*/
|
634 |
-
function end_lvl (&$output, $depth, $args)
|
635 |
-
{
|
636 |
-
if ('list' != $args['style'])
|
637 |
-
return;
|
638 |
-
|
639 |
-
$indent = str_repeat("\t", $depth);
|
640 |
-
$output .= $indent . '</ul>' . "\n";
|
641 |
-
}
|
642 |
-
|
643 |
-
/**
|
644 |
-
* @see Walker::start_el()
|
645 |
-
* @since 2.1.0
|
646 |
-
*
|
647 |
-
* @param string $output Passed by reference. Used to append additional content.
|
648 |
-
* @param object $category Category data object.
|
649 |
-
* @param int $depth Depth of category in reference to parents.
|
650 |
-
* @param array $args
|
651 |
-
*/
|
652 |
-
function start_el (&$output, $category, $depth, $args)
|
653 |
-
{
|
654 |
-
extract($args);
|
655 |
-
|
656 |
-
$cat_name = esc_attr($category->name);
|
657 |
-
$cat_name = apply_filters('list_cats', $cat_name, $category);
|
658 |
-
$link = '<div class="avhec-widget-line"><a href="' . get_category_link($category->term_id) . '" ';
|
659 |
-
if ($use_desc_for_title == 0 || empty($category->description))
|
660 |
-
$link .= 'title="' . sprintf(__('View all posts filed under %s'), $cat_name) . '"';
|
661 |
-
else
|
662 |
-
$link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"';
|
663 |
-
$link .= '>';
|
664 |
-
$link .= $cat_name . '</a>';
|
665 |
-
|
666 |
-
if ((! empty($feed_image)) || (! empty($feed))) {
|
667 |
-
$link .= '<div class="avhec-widget-rss"> ';
|
668 |
-
|
669 |
-
if (empty($feed_image))
|
670 |
-
$link .= '(';
|
671 |
-
|
672 |
-
$link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"';
|
673 |
-
|
674 |
-
if (empty($feed))
|
675 |
-
$alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"';
|
676 |
-
else {
|
677 |
-
$title = ' title="' . $feed . '"';
|
678 |
-
$alt = ' alt="' . $feed . '"';
|
679 |
-
$name = $feed;
|
680 |
-
$link .= $title;
|
681 |
-
}
|
682 |
-
|
683 |
-
$link .= '>';
|
684 |
-
|
685 |
-
if (empty($feed_image))
|
686 |
-
$link .= $name;
|
687 |
-
else
|
688 |
-
$link .= '<img src="' . $feed_image . '"' . $alt . $title . ' />';
|
689 |
-
$link .= '</a>';
|
690 |
-
if (empty($feed_image))
|
691 |
-
$link .= ')';
|
692 |
-
$link .= '</div>';
|
693 |
-
}
|
694 |
-
|
695 |
-
if (isset($show_count) && $show_count)
|
696 |
-
$link .= '<div class="avhec-widget-count"> (' . intval($category->count) . ')</div>';
|
697 |
-
|
698 |
-
if (isset($show_date) && $show_date) {
|
699 |
-
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
|
700 |
-
}
|
701 |
-
|
702 |
-
if (isset($current_category) && $current_category)
|
703 |
-
$_current_category = get_category($current_category);
|
704 |
-
|
705 |
-
if ('list' == $args['style']) {
|
706 |
-
$output .= "\t" . '<li';
|
707 |
-
$class = 'cat-item cat-item-' . $category->term_id;
|
708 |
-
if (isset($current_category) && $current_category && ($category->term_id == $current_category))
|
709 |
-
$class .= ' current-cat';
|
710 |
-
elseif (isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent))
|
711 |
-
$class .= ' current-cat-parent';
|
712 |
-
$output .= ' class="' . $class . '"';
|
713 |
-
$output .= '>' . $link . '</div>' . "\n";
|
714 |
-
} else {
|
715 |
-
$output .= "\t" . $link . '</div><br />' . "\n";
|
716 |
-
}
|
717 |
-
}
|
718 |
-
|
719 |
-
/**
|
720 |
-
* @see Walker::end_el()
|
721 |
-
* @since 2.1.0
|
722 |
-
*
|
723 |
-
* @param string $output Passed by reference. Used to append additional content.
|
724 |
-
* @param object $page Not used.
|
725 |
-
* @param int $depth Depth of category. Not used.
|
726 |
-
* @param array $args Only uses 'list' for whether should append to output.
|
727 |
-
*/
|
728 |
-
function end_el (&$output, $page, $depth, $args)
|
729 |
-
{
|
730 |
-
if ('list' != $args['style'])
|
731 |
-
return;
|
732 |
-
|
733 |
-
$output .= '</li>' . "\n";
|
734 |
-
}
|
735 |
-
}
|
736 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/class/avh-ec.widgets.php
DELETED
@@ -1,1001 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Widget Class for displaying categories. Extended version of the dfeault categories.
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
*
|
11 |
-
* @var AVH_EC_Core
|
12 |
-
*/
|
13 |
-
var $core;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* PHP 5 Constructor
|
17 |
-
*
|
18 |
-
*/
|
19 |
-
function __construct ()
|
20 |
-
{
|
21 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
22 |
-
|
23 |
-
//Convert the old option widget_extended_categories to widget_extended-categories
|
24 |
-
$old = get_option('widget_extended_categories');
|
25 |
-
if (! (FALSE === $old)) {
|
26 |
-
update_option('widget_extended-categories', $old);
|
27 |
-
delete_option('widget_extended_categories');
|
28 |
-
}
|
29 |
-
$widget_ops = array('description'=>__("An extended version of the default Categories widget.", 'avh-ec'));
|
30 |
-
WP_Widget::__construct('extended-categories', 'AVH Extended Categories', $widget_ops);
|
31 |
-
|
32 |
-
add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
function WP_Widget_AVH_ExtendedCategories_Normal ()
|
37 |
-
{
|
38 |
-
$this->__construct();
|
39 |
-
}
|
40 |
-
|
41 |
-
function actionWpPrintStyles ()
|
42 |
-
{
|
43 |
-
|
44 |
-
if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
|
45 |
-
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
46 |
-
wp_enqueue_style('avhec-widget');
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Display the widget
|
52 |
-
*
|
53 |
-
* @param unknown_type $args
|
54 |
-
* @param unknown_type $instance
|
55 |
-
*/
|
56 |
-
function widget ($args, $instance)
|
57 |
-
{
|
58 |
-
|
59 |
-
extract($args);
|
60 |
-
|
61 |
-
$selectedonly = $instance['selectedonly'] ? TRUE : FALSE;
|
62 |
-
$c = $instance['count'] ? TRUE : FALSE;
|
63 |
-
$h = $instance['hierarchical'] ? TRUE : FALSE;
|
64 |
-
$d = $instance['depth'] ? $instance['depth'] : 0;
|
65 |
-
$e = $instance['hide_empty'] ? TRUE : FALSE;
|
66 |
-
$use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
|
67 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
68 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
69 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
70 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
71 |
-
$invert = $instance['invert_included'] ? TRUE : FALSE;
|
72 |
-
|
73 |
-
if (empty($r)) {
|
74 |
-
$i = '';
|
75 |
-
}
|
76 |
-
|
77 |
-
if (empty($d)) {
|
78 |
-
$d = 0;
|
79 |
-
}
|
80 |
-
|
81 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
|
82 |
-
$style = empty($instance['style']) ? 'list' : $instance['style'];
|
83 |
-
|
84 |
-
$included_cats = '';
|
85 |
-
if ($instance['post_category']) {
|
86 |
-
$post_category = unserialize($instance['post_category']);
|
87 |
-
$children = array();
|
88 |
-
if (! $instance['selectedonly']) {
|
89 |
-
foreach ($post_category as $cat_id) {
|
90 |
-
$children = array_merge($children, get_term_children($cat_id, 'category'));
|
91 |
-
}
|
92 |
-
}
|
93 |
-
$included_cats = implode(",", array_merge($post_category, $children));
|
94 |
-
}
|
95 |
-
|
96 |
-
if ($invert) {
|
97 |
-
$inc_exc = 'exclude';
|
98 |
-
} else {
|
99 |
-
$inc_exc = 'include';
|
100 |
-
}
|
101 |
-
|
102 |
-
$options = $this->core->getOptions();
|
103 |
-
$show_option_none = __('Select Category', 'avh-ec');
|
104 |
-
if ($options['general']['alternative_name_select_category']) {
|
105 |
-
$show_option_none = $options['general']['alternative_name_select_category'];
|
106 |
-
}
|
107 |
-
|
108 |
-
$cat_args = array($inc_exc=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, 'hide_empty'=>$e, 'hierarchical'=>$h, 'depth'=>$d, 'title_li'=>'', 'show_option_none'=>$show_option_none, 'feed'=>$r, 'feed_image'=>$i, 'name'=>'extended-categories-select-' . $this->number);
|
109 |
-
echo $before_widget;
|
110 |
-
echo $this->core->comment;
|
111 |
-
echo $before_title . $title . $after_title;
|
112 |
-
|
113 |
-
if ($style == 'list') {
|
114 |
-
echo '<ul>';
|
115 |
-
$this->core->avh_wp_list_categories($cat_args, $selectedonly);
|
116 |
-
echo '</ul>';
|
117 |
-
} else {
|
118 |
-
$this->core->avh_wp_dropdown_categories($cat_args, $selectedonly);
|
119 |
-
echo '<script type=\'text/javascript\'>' . "\n";
|
120 |
-
echo '/* <![CDATA[ */' . "\n";
|
121 |
-
echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-' . $this->number . '");' . "\n";
|
122 |
-
echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
|
123 |
-
echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
|
124 |
-
echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
|
125 |
-
echo ' }' . "\n";
|
126 |
-
echo ' }' . "\n";
|
127 |
-
echo ' ec_dropdown_' . $this->number . '.onchange = ec_onCatChange_' . $this->number . ';' . "\n";
|
128 |
-
echo '/* ]]> */' . "\n";
|
129 |
-
echo '</script>' . "\n";
|
130 |
-
}
|
131 |
-
echo $after_widget;
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* When Widget Control Form Is Posted
|
136 |
-
*
|
137 |
-
* @param unknown_type $new_instance
|
138 |
-
* @param unknown_type $old_instance
|
139 |
-
* @return unknown
|
140 |
-
*/
|
141 |
-
function update ($new_instance, $old_instance)
|
142 |
-
{
|
143 |
-
// update the instance's settings
|
144 |
-
if (! isset($new_instance['submit'])) {
|
145 |
-
return FALSE;
|
146 |
-
}
|
147 |
-
|
148 |
-
$instance = $old_instance;
|
149 |
-
|
150 |
-
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
151 |
-
$instance['selectedonly'] = $new_instance['selectedonly'] ? TRUE : FALSE;
|
152 |
-
$instance['count'] = $new_instance['count'] ? TRUE : FALSE;
|
153 |
-
$instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
|
154 |
-
$instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
|
155 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
|
156 |
-
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
157 |
-
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
158 |
-
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
159 |
-
$instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
|
160 |
-
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
161 |
-
if (array_key_exists('all', $new_instance['post_category'])) {
|
162 |
-
$instance['post_category'] = FALSE;
|
163 |
-
} else {
|
164 |
-
$instance['post_category'] = serialize($new_instance['post_category']);
|
165 |
-
}
|
166 |
-
$instance['depth'] = (int) $new_instance['depth'];
|
167 |
-
if ($instance['depth'] < 0 || 11 < $instance['depth']) {
|
168 |
-
$instance['depth'] = 0;
|
169 |
-
}
|
170 |
-
$instance['invert_included'] = $new_instance['invert_included'] ? TRUE : FALSE;
|
171 |
-
|
172 |
-
return $instance;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Display Widget Control Form
|
177 |
-
*
|
178 |
-
* @param unknown_type $instance
|
179 |
-
*/
|
180 |
-
function form ($instance)
|
181 |
-
{
|
182 |
-
// displays the widget admin form
|
183 |
-
$instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>'', 'depth'=>0));
|
184 |
-
|
185 |
-
// Prepare data for display
|
186 |
-
$depth = (int) $instance['depth'];
|
187 |
-
if ($depth < 0 || 11 < $depth) {
|
188 |
-
$depth = 0;
|
189 |
-
}
|
190 |
-
$selected_cats = ($instance['post_category'] != '') ? unserialize($instance['post_category']) : FALSE;
|
191 |
-
|
192 |
-
echo '<p>';
|
193 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
194 |
-
echo '</p>';
|
195 |
-
|
196 |
-
echo '<p>';
|
197 |
-
avh_doWidgetFormCheckbox($this->get_field_id('selectedonly'), $this->get_field_name('selectedonly'), __('Show selected categories only', 'avh-ec'), (bool) $instance['selectedonly']);
|
198 |
-
|
199 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
|
200 |
-
|
201 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
|
202 |
-
|
203 |
-
$options = array(0=>__('All Levels', 'avh-ec'), 1=>__('Toplevel only', 'avh-ec'));
|
204 |
-
for ($i = 2; $i <= 11; $i ++) {
|
205 |
-
$options[$i] = __('Child ', 'avh-ec') . ($i - 1);
|
206 |
-
}
|
207 |
-
avh_doWidgetFormSelect($this->get_field_id('depth'), $this->get_field_name('depth'), __('How many levels to show', 'avh-ec'), $options, $depth);
|
208 |
-
unset($options);
|
209 |
-
|
210 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
|
211 |
-
|
212 |
-
avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
|
213 |
-
echo '</p>';
|
214 |
-
|
215 |
-
echo '<p>';
|
216 |
-
$options['ID'] = __('ID', 'avh-ec');
|
217 |
-
$options['name'] = __('Name', 'avh-ec');
|
218 |
-
$options['count'] = __('Count', 'avh-ec');
|
219 |
-
$options['slug'] = __('Slug', 'avh-ec');
|
220 |
-
if (is_plugin_active('my-category-order/mycategoryorder.php')) {
|
221 |
-
$options['avhec_3rdparty_mycategoryorder'] = 'My Category Order';
|
222 |
-
}
|
223 |
-
|
224 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
|
225 |
-
unset($options);
|
226 |
-
|
227 |
-
$options['asc'] = __('Ascending', 'avh-ec');
|
228 |
-
$options['desc'] = __('Descending', 'avh-ec');
|
229 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
|
230 |
-
unset($options);
|
231 |
-
|
232 |
-
$options['list'] = __('List', 'avh-ec');
|
233 |
-
$options['drop'] = __('Drop down', 'avh-ec');
|
234 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
|
235 |
-
unset($options);
|
236 |
-
echo '</p>';
|
237 |
-
|
238 |
-
echo '<p>';
|
239 |
-
|
240 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
|
241 |
-
|
242 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
|
243 |
-
|
244 |
-
echo '</p>';
|
245 |
-
|
246 |
-
echo '<p>';
|
247 |
-
echo '<b>' . __('Select categories', 'avh-ec') . '</b><hr />';
|
248 |
-
echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear" style="list-style-type: none; margin-left: 5px; padding-left: 0px; margin-bottom: 20px;">';
|
249 |
-
echo '<li id="' . $this->get_field_id('category--1') . '" class="popular-category">';
|
250 |
-
echo '<label for="' . $this->get_field_id('post_category') . '" class="selectit">';
|
251 |
-
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' : '') . '> ';
|
252 |
-
_e('All Categories', 'avh-ec');
|
253 |
-
echo '</label>';
|
254 |
-
echo '</li>';
|
255 |
-
ob_start();
|
256 |
-
$this->avh_wp_category_checklist($selected_cats, $this->number);
|
257 |
-
ob_end_flush();
|
258 |
-
echo '</ul>';
|
259 |
-
echo '</p>';
|
260 |
-
|
261 |
-
echo '<p>';
|
262 |
-
avh_doWidgetFormCheckbox($this->get_field_id('invert_included'), $this->get_field_name('invert_included'), __('Exclude the selected categories', 'avh-ec'), (bool) $instance['invert_included']);
|
263 |
-
echo '</p>';
|
264 |
-
|
265 |
-
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
266 |
-
}
|
267 |
-
|
268 |
-
/**
|
269 |
-
* Creates the categories checklist
|
270 |
-
*
|
271 |
-
* @param int $post_id
|
272 |
-
* @param int $descendants_and_self
|
273 |
-
* @param array $selected_cats
|
274 |
-
* @param array $popular_cats
|
275 |
-
* @param int $number
|
276 |
-
*/
|
277 |
-
function avh_wp_category_checklist ($selected_cats, $number)
|
278 |
-
{
|
279 |
-
|
280 |
-
$walker = new AVH_Walker_Category_Checklist();
|
281 |
-
$walker->number = $number;
|
282 |
-
$walker->input_id = $this->get_field_id('post_category');
|
283 |
-
$walker->input_name = $this->get_field_name('post_category');
|
284 |
-
$walker->li_id = $this->get_field_id('category--1');
|
285 |
-
|
286 |
-
$args = array('taxonomy'=>'category', 'descendants_and_self'=>0, 'selected_cats'=>$selected_cats, 'popular_cats'=>array(), 'walker'=>$walker, 'checked_ontop'=>true, 'popular_cats'=>array());
|
287 |
-
|
288 |
-
if (is_array($selected_cats))
|
289 |
-
$args['selected_cats'] = $selected_cats;
|
290 |
-
else
|
291 |
-
$args['selected_cats'] = array();
|
292 |
-
|
293 |
-
$categories = $this->core->getCategories();
|
294 |
-
$_categories_id = $this->core->getCategoriesId($categories);
|
295 |
-
|
296 |
-
// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
|
297 |
-
$checked_categories = array();
|
298 |
-
foreach ($args['selected_cats'] as $key => $value) {
|
299 |
-
if (isset($_categories_id[$key])) {
|
300 |
-
$category_key = $_categories_id[$key];
|
301 |
-
$checked_categories[] = $categories[$category_key];
|
302 |
-
unset($categories[$category_key]);
|
303 |
-
}
|
304 |
-
}
|
305 |
-
|
306 |
-
// Put checked cats on top
|
307 |
-
echo $walker->walk($checked_categories, 0, array ( $args ));
|
308 |
-
// Then the rest of them
|
309 |
-
echo $walker->walk($categories, 0, array ( $args ));
|
310 |
-
}
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Widget Class for displaying the top categories
|
315 |
-
*
|
316 |
-
*/
|
317 |
-
class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
318 |
-
{
|
319 |
-
/**
|
320 |
-
*
|
321 |
-
* @var AVH_EC_Core
|
322 |
-
*/
|
323 |
-
var $core;
|
324 |
-
|
325 |
-
/**
|
326 |
-
* PHP 5 Constructor
|
327 |
-
*
|
328 |
-
*/
|
329 |
-
function __construct ()
|
330 |
-
{
|
331 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
332 |
-
|
333 |
-
$widget_ops = array('description'=>__("Shows the top categories.", 'avh-ec'));
|
334 |
-
WP_Widget::__construct(FALSE, 'AVH Extended Categories: '.__('Top Categories'), $widget_ops);
|
335 |
-
add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
|
336 |
-
|
337 |
-
}
|
338 |
-
|
339 |
-
function WP_Widget_AVH_ExtendedCategories_Top ()
|
340 |
-
{
|
341 |
-
$this->__construct();
|
342 |
-
}
|
343 |
-
|
344 |
-
function actionWpPrintStyles ()
|
345 |
-
{
|
346 |
-
if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
|
347 |
-
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
348 |
-
wp_enqueue_style('avhec-widget');
|
349 |
-
}
|
350 |
-
}
|
351 |
-
|
352 |
-
/** Echo the widget content.
|
353 |
-
*
|
354 |
-
* Subclasses should over-ride this function to generate their widget code.
|
355 |
-
*
|
356 |
-
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
|
357 |
-
* @param array $instance The settings for the particular instance of the widget
|
358 |
-
*/
|
359 |
-
function widget ($args, $instance)
|
360 |
-
{
|
361 |
-
extract($args);
|
362 |
-
|
363 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
|
364 |
-
$style = empty($instance['style']) ? 'list' : $instance['style'];
|
365 |
-
if (! $a = (int) $instance['amount']) {
|
366 |
-
$a = 5;
|
367 |
-
} elseif ($a < 1) {
|
368 |
-
$a = 1;
|
369 |
-
}
|
370 |
-
$c = $instance['count'] ? TRUE : FALSE;
|
371 |
-
$use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
|
372 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
373 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
374 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
375 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
376 |
-
if (empty($r)) {
|
377 |
-
$i = '';
|
378 |
-
}
|
379 |
-
if (! empty($i)) {
|
380 |
-
if (! file_exists(ABSPATH . '/' . $i)) {
|
381 |
-
$i = '';
|
382 |
-
}
|
383 |
-
}
|
384 |
-
|
385 |
-
$options = $this->core->getOptions();
|
386 |
-
$show_option_none = __('Select Category', 'avh-ec');
|
387 |
-
if ($options['general']['alternative_name_select_category']) {
|
388 |
-
$show_option_none = $options['general']['alternative_name_select_category'];
|
389 |
-
}
|
390 |
-
|
391 |
-
$top_cats = get_terms('category', array('fields'=>'ids', 'orderby'=>'count', 'order'=>'DESC', 'number'=>$a, 'hierarchical'=>FALSE));
|
392 |
-
$included_cats = implode(",", $top_cats);
|
393 |
-
|
394 |
-
$cat_args = array('include'=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, 'hide_empty'=>FALSE, 'hierarchical'=>FALSE, 'depth'=>- 1, 'title_li'=>'', 'show_option_none'=>$show_option_none, 'feed'=>$r, 'feed_image'=>$i, 'name'=>'extended-categories-top-select-' . $this->number);
|
395 |
-
echo $before_widget;
|
396 |
-
echo $this->core->comment;
|
397 |
-
echo $before_title . $title . $after_title;
|
398 |
-
echo '<ul>';
|
399 |
-
|
400 |
-
if ($style == 'list') {
|
401 |
-
wp_list_categories($cat_args);
|
402 |
-
} else {
|
403 |
-
wp_dropdown_categories($cat_args);
|
404 |
-
echo '<script type=\'text/javascript\'>' . "\n";
|
405 |
-
echo '/* <![CDATA[ */' . "\n";
|
406 |
-
echo ' var ec_dropdown_top_' . $this->number . ' = document.getElementById("extended-categories-top-select-' . $this->number . '");' . "\n";
|
407 |
-
echo ' function ec_top_onCatChange_' . $this->number . '() {' . "\n";
|
408 |
-
echo ' if ( ec_dropdown_top_' . $this->number . '.options[ec_dropdown_top_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
|
409 |
-
echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_top_' . $this->number . '.options[ec_dropdown_top_' . $this->number . '.selectedIndex].value;' . "\n";
|
410 |
-
echo ' }' . "\n";
|
411 |
-
echo ' }' . "\n";
|
412 |
-
echo ' ec_dropdown_top_' . $this->number . '.onchange = ec_top_onCatChange_' . $this->number . ';' . "\n";
|
413 |
-
echo '/* ]]> */' . "\n";
|
414 |
-
echo '</script>' . "\n";
|
415 |
-
}
|
416 |
-
echo '</ul>';
|
417 |
-
echo $after_widget;
|
418 |
-
}
|
419 |
-
|
420 |
-
/** Update a particular instance.
|
421 |
-
*
|
422 |
-
* This function should check that $new_instance is set correctly.
|
423 |
-
* The newly calculated value of $instance should be returned.
|
424 |
-
* If "FALSE" is returned, the instance won't be saved/updated.
|
425 |
-
*
|
426 |
-
* @param array $new_instance New settings for this instance as input by the user via form()
|
427 |
-
* @param array $old_instance Old settings for this instance
|
428 |
-
* @return array Settings to save or bool FALSE to cancel saving
|
429 |
-
*/
|
430 |
-
function update ($new_instance, $old_instance)
|
431 |
-
{
|
432 |
-
// update the instance's settings
|
433 |
-
if (! isset($new_instance['submit'])) {
|
434 |
-
return FALSE;
|
435 |
-
}
|
436 |
-
|
437 |
-
$instance = $old_instance;
|
438 |
-
|
439 |
-
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
440 |
-
$instance['amount'] = (int) $new_instance['amount'];
|
441 |
-
$instance['count'] = $new_instance['count'] ? TRUE : FALSE;
|
442 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
|
443 |
-
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
444 |
-
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
445 |
-
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
446 |
-
$instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
|
447 |
-
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
448 |
-
|
449 |
-
return $instance;
|
450 |
-
}
|
451 |
-
|
452 |
-
/** Echo the settings update form
|
453 |
-
*
|
454 |
-
* @param array $instance Current settings
|
455 |
-
*/
|
456 |
-
function form ($instance)
|
457 |
-
{
|
458 |
-
// displays the widget admin form
|
459 |
-
$instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>''));
|
460 |
-
|
461 |
-
// Prepare data for display
|
462 |
-
if (! $amount = (int) $instance['amount']) {
|
463 |
-
$amount = 5;
|
464 |
-
}
|
465 |
-
|
466 |
-
if ($amount < 1) {
|
467 |
-
$amount = 1;
|
468 |
-
}
|
469 |
-
echo '<p>';
|
470 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
471 |
-
echo '</p>';
|
472 |
-
|
473 |
-
echo '<p>';
|
474 |
-
avh_doWidgetFormText($this->get_field_id('amount'), $this->get_field_name('amount'), __('How many categories to show', 'avh-ec'), $amount);
|
475 |
-
echo '</p>';
|
476 |
-
|
477 |
-
echo '<p>';
|
478 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
|
479 |
-
echo '<br />';
|
480 |
-
|
481 |
-
avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
|
482 |
-
echo '</p>';
|
483 |
-
|
484 |
-
echo '<p>';
|
485 |
-
$options['ID'] = __('ID', 'avh-ec');
|
486 |
-
$options['name'] = __('Name', 'avh-ec');
|
487 |
-
$options['count'] = __('Count', 'avh-ec');
|
488 |
-
$options['slug'] = __('Slug', 'avh-ec');
|
489 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
|
490 |
-
unset($options);
|
491 |
-
|
492 |
-
$options['asc'] = __('Ascending', 'avh-ec');
|
493 |
-
$options['desc'] = __('Descending', 'avh-ec');
|
494 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
|
495 |
-
unset($options);
|
496 |
-
|
497 |
-
$options['list'] = __('List', 'avh-ec');
|
498 |
-
$options['drop'] = __('Drop down', 'avh-ec');
|
499 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
|
500 |
-
unset($options);
|
501 |
-
echo '</p>';
|
502 |
-
|
503 |
-
echo '<p>';
|
504 |
-
|
505 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
|
506 |
-
|
507 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
|
508 |
-
|
509 |
-
echo '</p>';
|
510 |
-
|
511 |
-
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
512 |
-
}
|
513 |
-
}
|
514 |
-
|
515 |
-
/**
|
516 |
-
* Widget Class for displaying the grouped categories
|
517 |
-
*
|
518 |
-
*/
|
519 |
-
class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
520 |
-
{
|
521 |
-
/**
|
522 |
-
*
|
523 |
-
* @var AVH_EC_Core
|
524 |
-
*/
|
525 |
-
var $core;
|
526 |
-
|
527 |
-
/**
|
528 |
-
*
|
529 |
-
* @var AVH_EC_Category_Group
|
530 |
-
*/
|
531 |
-
var $catgrp;
|
532 |
-
|
533 |
-
/**
|
534 |
-
* PHP 5 Constructor
|
535 |
-
*
|
536 |
-
*/
|
537 |
-
function __construct ()
|
538 |
-
{
|
539 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
540 |
-
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
541 |
-
|
542 |
-
$widget_ops = array('description'=>__("Shows grouped categories.", 'avh-ec'));
|
543 |
-
WP_Widget::__construct(FALSE, 'AVH Extended Categories: '.__('Category Group'), $widget_ops);
|
544 |
-
add_action('wp_print_styles', array(&$this, 'actionWpPrintStyles'));
|
545 |
-
|
546 |
-
}
|
547 |
-
|
548 |
-
function WP_Widget_AVH_ExtendedCategories_Category_Group ()
|
549 |
-
{
|
550 |
-
$this->__construct();
|
551 |
-
}
|
552 |
-
|
553 |
-
function actionWpPrintStyles ()
|
554 |
-
{
|
555 |
-
if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
|
556 |
-
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array(), $this->core->version);
|
557 |
-
wp_enqueue_style('avhec-widget');
|
558 |
-
}
|
559 |
-
}
|
560 |
-
|
561 |
-
/**
|
562 |
-
* Display the widget
|
563 |
-
*
|
564 |
-
* @param unknown_type $args
|
565 |
-
* @param unknown_type $instance
|
566 |
-
*/
|
567 |
-
function widget ($args, $instance)
|
568 |
-
{
|
569 |
-
global $post, $wp_query;
|
570 |
-
|
571 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
572 |
-
$options = $this->core->getOptions();
|
573 |
-
|
574 |
-
$row = array();
|
575 |
-
|
576 |
-
if (is_home()) {
|
577 |
-
$special_page = 'home_group';
|
578 |
-
} elseif (is_category()) {
|
579 |
-
$special_page = 'category_group';
|
580 |
-
} elseif (is_day()) {
|
581 |
-
$special_page = 'day_group';
|
582 |
-
} elseif (is_month()) {
|
583 |
-
$special_page = 'month_group';
|
584 |
-
} elseif (is_year()) {
|
585 |
-
$special_page = 'year_group';
|
586 |
-
} elseif (is_author()) {
|
587 |
-
$special_page = 'author_group';
|
588 |
-
} elseif (is_search()) {
|
589 |
-
$special_page = 'search_group';
|
590 |
-
} else {
|
591 |
-
$special_page = 'none';
|
592 |
-
}
|
593 |
-
|
594 |
-
$toDisplay = FALSE;
|
595 |
-
if ('none' == $special_page) {
|
596 |
-
$terms = wp_get_object_terms($post->ID, $catgrp->taxonomy_name);
|
597 |
-
if (! empty($terms)) {
|
598 |
-
$selected_catgroups = unserialize($instance['post_group_category']);
|
599 |
-
foreach ($terms as $key => $value) {
|
600 |
-
if ($selected_catgroups === FALSE || array_key_exists($value->term_id, $selected_catgroups)) {
|
601 |
-
if (! ($this->getWidgetDoneCatGroup($value->term_id))) {
|
602 |
-
$row = $value;
|
603 |
-
$group_found = TRUE;
|
604 |
-
break;
|
605 |
-
}
|
606 |
-
}
|
607 |
-
}
|
608 |
-
} else {
|
609 |
-
$options = $this->core->options;
|
610 |
-
$no_cat_group = $options['cat_group']['no_group'];
|
611 |
-
$row = get_term_by('id', $no_cat_group, $catgrp->taxonomy_name);
|
612 |
-
$group_found = TRUE;
|
613 |
-
}
|
614 |
-
} else {
|
615 |
-
if ('category_group' == $special_page) {
|
616 |
-
$tax_meta = get_option($this->core->db_options_tax_meta);
|
617 |
-
$term = $wp_query->get_queried_object();
|
618 |
-
if (isset($tax_meta[$term->taxonomy][$term->term_id]['category_group_term_id'])) {
|
619 |
-
$sp_category_group_id = $tax_meta[$term->taxonomy][$term->term_id]['category_group_term_id'];
|
620 |
-
} else {
|
621 |
-
$sp_category_group = $this->catgrp->getGroupByCategoryID($term->term_id);
|
622 |
-
$sp_category_group_id = $sp_category_group->term_id;
|
623 |
-
}
|
624 |
-
} else {
|
625 |
-
$sp_category_group_id = $options['sp_cat_group'][$special_page];
|
626 |
-
}
|
627 |
-
$row = get_term_by('id', $sp_category_group_id, $catgrp->taxonomy_name); // Returns FALSE when non-existance. (empty(FALSE)=TRUE)
|
628 |
-
$group_found = TRUE;
|
629 |
-
}
|
630 |
-
|
631 |
-
if ($group_found) {
|
632 |
-
$toDisplay = TRUE;
|
633 |
-
$category_group_id_none = $this->catgrp->getTermIDBy('slug', 'none');
|
634 |
-
$selected_catgroups = unserialize($instance['post_group_category']);
|
635 |
-
|
636 |
-
if ($category_group_id_none == $row->term_id ) {
|
637 |
-
$toDisplay = FALSE;
|
638 |
-
} elseif (! (FALSE == $selected_catgroups || array_key_exists($row->term_id, $selected_catgroups))) {
|
639 |
-
$toDisplay = FALSE;
|
640 |
-
} elseif ($special_page != 'none' && $this->getWidgetDoneCatGroup($sp_category_group_id)) {
|
641 |
-
$toDisplay = FALSE;
|
642 |
-
}
|
643 |
-
}
|
644 |
-
|
645 |
-
if ($toDisplay) {
|
646 |
-
extract($args);
|
647 |
-
|
648 |
-
$c = $instance['count'] ? TRUE : FALSE;
|
649 |
-
$e = $instance['hide_empty'] ? TRUE : FALSE;
|
650 |
-
$h = $instance['hierarchical'] ? TRUE : FALSE;
|
651 |
-
$use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
|
652 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
653 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
654 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
655 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
656 |
-
|
657 |
-
if (empty($r)) {
|
658 |
-
$i = '';
|
659 |
-
}
|
660 |
-
|
661 |
-
$style = empty($instance['style']) ? 'list' : $instance['style'];
|
662 |
-
$group_id = $row->term_id;
|
663 |
-
$cats = $catgrp->getCategoriesFromGroup($group_id);
|
664 |
-
if (empty($instance['title'])) {
|
665 |
-
$title = $catgrp->getWidgetTitleForGroup($group_id);
|
666 |
-
if (! $title) {
|
667 |
-
$title = __('Categories', 'avh-ec');
|
668 |
-
}
|
669 |
-
} else {
|
670 |
-
$title = $instance['title'];
|
671 |
-
}
|
672 |
-
$title = apply_filters('widget_title', $title);
|
673 |
-
|
674 |
-
$included_cats = implode(',', $cats);
|
675 |
-
|
676 |
-
$show_option_none = __('Select Category', 'avh-ec');
|
677 |
-
if ($options['general']['alternative_name_select_category']) {
|
678 |
-
$show_option_none = $options['general']['alternative_name_select_category'];
|
679 |
-
}
|
680 |
-
|
681 |
-
$cat_args = array('include'=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'use_desc_for_title'=>$use_desc_for_title, 'hide_empty'=>$e, 'hierarchical'=>$h, 'title_li'=>'', 'show_option_none'=>$show_option_none, 'feed'=>$r, 'feed_image'=>$i, 'name'=>'extended-categories-select-group-' . $this->number);
|
682 |
-
echo $before_widget;
|
683 |
-
echo $this->core->comment;
|
684 |
-
echo $before_title . $title . $after_title;
|
685 |
-
|
686 |
-
if ($style == 'list') {
|
687 |
-
echo '<ul>';
|
688 |
-
$this->core->avh_wp_list_categories($cat_args, TRUE);
|
689 |
-
echo '</ul>';
|
690 |
-
} else {
|
691 |
-
$this->core->avh_wp_dropdown_categories($cat_args, TRUE);
|
692 |
-
echo '<script type=\'text/javascript\'>' . "\n";
|
693 |
-
echo '/* <![CDATA[ */' . "\n";
|
694 |
-
echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-group-' . $this->number . '");' . "\n";
|
695 |
-
echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
|
696 |
-
echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
|
697 |
-
echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
|
698 |
-
echo ' }' . "\n";
|
699 |
-
echo ' }' . "\n";
|
700 |
-
echo ' ec_dropdown_' . $this->number . '.onchange = ec_onCatChange_' . $this->number . ';' . "\n";
|
701 |
-
echo '/* ]]> */' . "\n";
|
702 |
-
echo '</script>' . "\n";
|
703 |
-
}
|
704 |
-
echo $after_widget;
|
705 |
-
}
|
706 |
-
}
|
707 |
-
|
708 |
-
/**
|
709 |
-
* When Widget Control Form Is Posted
|
710 |
-
*
|
711 |
-
* @param unknown_type $new_instance
|
712 |
-
* @param unknown_type $old_instance
|
713 |
-
* @return unknown
|
714 |
-
*/
|
715 |
-
function update ($new_instance, $old_instance)
|
716 |
-
{
|
717 |
-
// update the instance's settings
|
718 |
-
if (! isset($new_instance['submit'])) {
|
719 |
-
return FALSE;
|
720 |
-
}
|
721 |
-
|
722 |
-
$instance = $old_instance;
|
723 |
-
|
724 |
-
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
725 |
-
$instance['count'] = $new_instance['count'] ? TRUE : FALSE;
|
726 |
-
$instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
|
727 |
-
$instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
|
728 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
|
729 |
-
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
730 |
-
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
731 |
-
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
732 |
-
$instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
|
733 |
-
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
734 |
-
if (array_key_exists('all', $new_instance['post_group_category'])) {
|
735 |
-
$instance['post_group_category'] = FALSE;
|
736 |
-
} else {
|
737 |
-
$instance['post_group_category'] = serialize($new_instance['post_group_category']);
|
738 |
-
}
|
739 |
-
return $instance;
|
740 |
-
}
|
741 |
-
|
742 |
-
/**
|
743 |
-
* Display Widget Control Form
|
744 |
-
*
|
745 |
-
* @param unknown_type $instance
|
746 |
-
*/
|
747 |
-
function form ($instance)
|
748 |
-
{
|
749 |
-
// displays the widget admin form
|
750 |
-
$instance = wp_parse_args((array) $instance, array('title'=>'', 'rssimage'=>''));
|
751 |
-
|
752 |
-
// Prepare data for display
|
753 |
-
$title = esc_attr($instance['title']);
|
754 |
-
$count = (bool) $instance['count'];
|
755 |
-
$hierarchical = (bool) $instance['hierarchical'];
|
756 |
-
$hide_empty = (bool) $instance['hide_empty'];
|
757 |
-
$use_desc_for_title = (bool) $instance['use_desc_for_title'];
|
758 |
-
$sort_id = ($instance['sort_column'] == 'ID') ? ' SELECTED' : '';
|
759 |
-
$sort_name = ($instance['sort_column'] == 'name') ? ' SELECTED' : '';
|
760 |
-
$sort_count = ($instance['sort_column'] == 'count') ? ' SELECTED' : '';
|
761 |
-
$sort_order_a = ($instance['sort_order'] == 'asc') ? ' SELECTED' : '';
|
762 |
-
$sort_order_d = ($instance['sort_order'] == 'desc') ? ' SELECTED' : '';
|
763 |
-
$style_list = ($instance['style'] == 'list') ? ' SELECTED' : '';
|
764 |
-
$style_drop = ($instance['style'] == 'drop') ? ' SELECTED' : '';
|
765 |
-
$rssfeed = (bool) $instance['rssfeed'];
|
766 |
-
$rssimage = esc_attr($instance['rssimage']);
|
767 |
-
|
768 |
-
$selected_cats = ($instance['post_group_category'] != '') ? unserialize($instance['post_group_category']) : FALSE;
|
769 |
-
ob_start();
|
770 |
-
echo '<p>';
|
771 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
772 |
-
echo '</p>';
|
773 |
-
|
774 |
-
echo '<p>';
|
775 |
-
|
776 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
|
777 |
-
|
778 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
|
779 |
-
|
780 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
|
781 |
-
|
782 |
-
avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
|
783 |
-
echo '</p>';
|
784 |
-
|
785 |
-
echo '<p>';
|
786 |
-
$options['ID'] = __('ID', 'avh-ec');
|
787 |
-
$options['name'] = __('Name', 'avh-ec');
|
788 |
-
$options['count'] = __('Count', 'avh-ec');
|
789 |
-
$options['slug'] = __('Slug', 'avh-ec');
|
790 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
|
791 |
-
unset($options);
|
792 |
-
|
793 |
-
$options['asc'] = __('Ascending', 'avh-ec');
|
794 |
-
$options['desc'] = __('Descending', 'avh-ec');
|
795 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
|
796 |
-
unset($options);
|
797 |
-
|
798 |
-
$options['list'] = __('List', 'avh-ec');
|
799 |
-
$options['drop'] = __('Drop down', 'avh-ec');
|
800 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
|
801 |
-
unset($options);
|
802 |
-
echo '</p>';
|
803 |
-
|
804 |
-
echo '<p>';
|
805 |
-
|
806 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
|
807 |
-
|
808 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
|
809 |
-
echo '</p>';
|
810 |
-
|
811 |
-
echo '<p>';
|
812 |
-
echo '<b>' . __('Select Groups', 'avh-ec') . '</b><hr />';
|
813 |
-
echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear" style="list-style-type: none; margin-left: 5px; padding-left: 0px; margin-bottom: 20px;">';
|
814 |
-
echo '<li id="' . $this->get_field_id('group_category--1') . '" class="popular-group_category">';
|
815 |
-
echo '<label for="' . $this->get_field_id('group_post_category') . '" class="selectit">';
|
816 |
-
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' : '') . '> ';
|
817 |
-
_e('Any Group', 'avh-ec');
|
818 |
-
echo '</label>';
|
819 |
-
echo '</li>';
|
820 |
-
|
821 |
-
$this->avh_wp_group_category_checklist($selected_cats, $this->number);
|
822 |
-
|
823 |
-
echo '</ul>';
|
824 |
-
echo '</p>';
|
825 |
-
|
826 |
-
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
827 |
-
ob_end_flush();
|
828 |
-
}
|
829 |
-
|
830 |
-
function avh_wp_group_category_checklist ($selected_cats, $number)
|
831 |
-
{
|
832 |
-
|
833 |
-
$walker = new AVH_Walker_Category_Checklist();
|
834 |
-
$walker->number = $number;
|
835 |
-
$walker->input_id = $this->get_field_id('post_group_category');
|
836 |
-
$walker->input_name = $this->get_field_name('post_group_category');
|
837 |
-
$walker->li_id = $this->get_field_id('group_category--1');
|
838 |
-
|
839 |
-
$args = array('taxonomy'=>'avhec_catgroup', 'descendants_and_self'=>0, 'selected_cats'=>array(), 'popular_cats'=>array(), 'walker'=>$walker, 'checked_ontop'=>true);
|
840 |
-
|
841 |
-
if (is_array($selected_cats))
|
842 |
-
$args['selected_cats'] = $selected_cats;
|
843 |
-
else
|
844 |
-
$args['selected_cats'] = array();
|
845 |
-
|
846 |
-
$categories = (array) get_terms($args['taxonomy'], array('get'=>'all'));
|
847 |
-
|
848 |
-
// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
|
849 |
-
$checked_categories = array();
|
850 |
-
$keys = array_keys($categories);
|
851 |
-
|
852 |
-
foreach ($keys as $k) {
|
853 |
-
if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
|
854 |
-
$checked_categories[] = $categories[$k];
|
855 |
-
unset($categories[$k]);
|
856 |
-
}
|
857 |
-
}
|
858 |
-
|
859 |
-
// Put checked cats on top
|
860 |
-
echo $walker->walk($checked_categories, 0, array ( $args ));
|
861 |
-
// Then the rest of them
|
862 |
-
echo $walker->walk($categories, 0, array ( $args ));
|
863 |
-
}
|
864 |
-
|
865 |
-
function getWidgetDoneCatGroup ($id)
|
866 |
-
{
|
867 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
868 |
-
if (is_array($catgrp->widget_done_catgroup) && array_key_exists($id, $catgrp->widget_done_catgroup)) {
|
869 |
-
return TRUE;
|
870 |
-
}
|
871 |
-
$catgrp->widget_done_catgroup[$id] = TRUE;
|
872 |
-
return FALSE;
|
873 |
-
}
|
874 |
-
}
|
875 |
-
|
876 |
-
/**
|
877 |
-
* Class that will display the categories
|
878 |
-
*
|
879 |
-
*/
|
880 |
-
class AVH_Walker_Category_Checklist extends Walker
|
881 |
-
{
|
882 |
-
var $tree_type = 'category';
|
883 |
-
var $db_fields = array('parent'=>'parent', 'id'=>'term_id'); //TODO: decouple this
|
884 |
-
var $number;
|
885 |
-
var $input_id;
|
886 |
-
var $input_name;
|
887 |
-
var $li_id;
|
888 |
-
|
889 |
-
/**
|
890 |
-
* Display array of elements hierarchically.
|
891 |
-
*
|
892 |
-
* It is a generic function which does not assume any existing order of
|
893 |
-
* elements. max_depth = -1 means flatly display every element. max_depth =
|
894 |
-
* 0 means display all levels. max_depth > 0 specifies the number of
|
895 |
-
* display levels.
|
896 |
-
*
|
897 |
-
* @since 2.1.0
|
898 |
-
*
|
899 |
-
* @param array $elements
|
900 |
-
* @param int $max_depth
|
901 |
-
* @param array $args;
|
902 |
-
* @return string
|
903 |
-
*/
|
904 |
-
function walk( $elements, $max_depth, $args) {
|
905 |
-
|
906 |
-
$output = '';
|
907 |
-
|
908 |
-
if ($max_depth < -1) //invalid parameter
|
909 |
-
return $output;
|
910 |
-
|
911 |
-
if (empty($elements)) //nothing to walk
|
912 |
-
return $output;
|
913 |
-
|
914 |
-
$id_field = $this->db_fields['id'];
|
915 |
-
$parent_field = $this->db_fields['parent'];
|
916 |
-
|
917 |
-
// flat display
|
918 |
-
if ( -1 == $max_depth ) {
|
919 |
-
$empty_array = array();
|
920 |
-
foreach ( $elements as $e )
|
921 |
-
$this->display_element( $e, $empty_array, 1, 0, $args, $output );
|
922 |
-
return $output;
|
923 |
-
}
|
924 |
-
|
925 |
-
/*
|
926 |
-
* need to display in hierarchical order
|
927 |
-
* separate elements into two buckets: top level and children elements
|
928 |
-
* children_elements is two dimensional array, eg.
|
929 |
-
* children_elements[10][] contains all sub-elements whose parent is 10.
|
930 |
-
*/
|
931 |
-
$top_level_elements = array();
|
932 |
-
$children_elements = array();
|
933 |
-
foreach ( $elements as $e) {
|
934 |
-
if ( 0 == $e->$parent_field )
|
935 |
-
$top_level_elements[] = $e;
|
936 |
-
else
|
937 |
-
$children_elements[ $e->$parent_field ][] = $e;
|
938 |
-
}
|
939 |
-
|
940 |
-
/*
|
941 |
-
* when none of the elements is top level
|
942 |
-
* assume the first one must be root of the sub elements
|
943 |
-
*/
|
944 |
-
if ( empty($top_level_elements) ) {
|
945 |
-
|
946 |
-
$first = array_slice( $elements, 0, 1 );
|
947 |
-
$root = $first[0];
|
948 |
-
|
949 |
-
$top_level_elements = array();
|
950 |
-
$children_elements = array();
|
951 |
-
foreach ( $elements as $e) {
|
952 |
-
if ( $root->$parent_field == $e->$parent_field )
|
953 |
-
$top_level_elements[] = $e;
|
954 |
-
else
|
955 |
-
$children_elements[ $e->$parent_field ][] = $e;
|
956 |
-
}
|
957 |
-
}
|
958 |
-
|
959 |
-
foreach ( $top_level_elements as $e )
|
960 |
-
$this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
|
961 |
-
|
962 |
-
/*
|
963 |
-
* if we are displaying all levels, and remaining children_elements is not empty,
|
964 |
-
* then we got orphans, which should be displayed regardless
|
965 |
-
*/
|
966 |
-
if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {
|
967 |
-
$empty_array = array();
|
968 |
-
foreach ( $children_elements as $orphans )
|
969 |
-
foreach( $orphans as $op )
|
970 |
-
$this->display_element( $op, $empty_array, 1, 0, $args, $output );
|
971 |
-
}
|
972 |
-
|
973 |
-
return $output;
|
974 |
-
}
|
975 |
-
function start_lvl (&$output, $depth, $args)
|
976 |
-
{
|
977 |
-
$indent = str_repeat("\t", $depth);
|
978 |
-
$output .= $indent . '<ul class="children">' . "\n";
|
979 |
-
}
|
980 |
-
|
981 |
-
function end_lvl (&$output, $depth, $args)
|
982 |
-
{
|
983 |
-
$indent = str_repeat("\t", $depth);
|
984 |
-
$output .= $indent . '</ul>' . "\n";
|
985 |
-
}
|
986 |
-
|
987 |
-
function start_el (&$output, $category, $depth, $args)
|
988 |
-
{
|
989 |
-
extract($args);
|
990 |
-
$input_id = $this->input_id . '-' . $category->term_id;
|
991 |
-
$output .= "\n" . '<li id="' . $this->li_id . '">';
|
992 |
-
$output .= '<label for="' . $input_id . '" class="selectit">';
|
993 |
-
$output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $category->term_id . ']" id="' . $input_id . '"' . (in_array($category->term_id, $selected_cats) ? ' checked="checked"' : "") . '/> ' . wp_specialchars(apply_filters('the_category', $category->name)) . '</label>';
|
994 |
-
}
|
995 |
-
|
996 |
-
function end_el (&$output, $category, $depth, $args)
|
997 |
-
{
|
998 |
-
$output .= "</li>\n";
|
999 |
-
}
|
1000 |
-
}
|
1001 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/css/avh-ec.admin.css
DELETED
@@ -1,150 +0,0 @@
|
|
1 |
-
.footer_avhec {
|
2 |
-
font-size: 0.8em;
|
3 |
-
text-align: center;
|
4 |
-
}
|
5 |
-
|
6 |
-
div.clearer {
|
7 |
-
clear: both;
|
8 |
-
line-height: 1px;
|
9 |
-
font-size: 1px;
|
10 |
-
height: 1px;
|
11 |
-
}
|
12 |
-
|
13 |
-
/* Metabox in General */
|
14 |
-
table.avhec-options {
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
.avhec-metabox-wrap {
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
.avhec-metabox-wrap .p {
|
23 |
-
|
24 |
-
line-height: 140%;
|
25 |
-
margin: 1em 0;
|
26 |
-
}
|
27 |
-
|
28 |
-
#avhecBoxOptions option {
|
29 |
-
padding: .5em;
|
30 |
-
}
|
31 |
-
|
32 |
-
.avhec-metabox-wrap span.description {
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
.avhec-metabox-wrap .b {
|
37 |
-
font-weight: bold;
|
38 |
-
}
|
39 |
-
|
40 |
-
.avhec-metabox-wrap ul {
|
41 |
-
margin-bottom: 1em;
|
42 |
-
}
|
43 |
-
|
44 |
-
.avhec-metabox-wrap ul li {
|
45 |
-
line-height: 120%;
|
46 |
-
list-style: disc inside none;
|
47 |
-
margin-bottom: 0;
|
48 |
-
}
|
49 |
-
|
50 |
-
#avhec-options input {
|
51 |
-
|
52 |
-
}
|
53 |
-
|
54 |
-
#avhec-generaloptions input {
|
55 |
-
|
56 |
-
}
|
57 |
-
|
58 |
-
/* Metabox FAQ */
|
59 |
-
#avhecBoxFAQ .inside ul {
|
60 |
-
|
61 |
-
margin-bottom: 6px;
|
62 |
-
}
|
63 |
-
#avhecBoxFAQ .inside ul li{
|
64 |
-
line-height: 120%;
|
65 |
-
list-style: disc inside none;
|
66 |
-
margin-bottom: 0;
|
67 |
-
}
|
68 |
-
|
69 |
-
/* Metabox Donations*/
|
70 |
-
#avhecBoxDonations .inside {
|
71 |
-
|
72 |
-
}
|
73 |
-
|
74 |
-
#avhecBoxDonations .versions {
|
75 |
-
padding: 6px 10px 12px;
|
76 |
-
}
|
77 |
-
|
78 |
-
/* Metabox Donations*/
|
79 |
-
#avhecBoxTranslation .inside {
|
80 |
-
|
81 |
-
}
|
82 |
-
|
83 |
-
/* Metabox in post and page */
|
84 |
-
#post_avhec_category_group {
|
85 |
-
width: 100%;
|
86 |
-
}
|
87 |
-
|
88 |
-
#avhec-catlist {
|
89 |
-
-moz-border-radius: 4px 4px 4px 4px;
|
90 |
-
background-color: #FFFFFF;
|
91 |
-
border: 1px solid #DFDFDF;
|
92 |
-
height: 20em;
|
93 |
-
margin-bottom: -1.8em;
|
94 |
-
overflow: auto;
|
95 |
-
width: 95%;
|
96 |
-
}
|
97 |
-
|
98 |
-
#avhec-catlist ul {
|
99 |
-
padding: 3px;
|
100 |
-
}
|
101 |
-
|
102 |
-
#avhec-catlist li ul {
|
103 |
-
padding: 0px;
|
104 |
-
}
|
105 |
-
|
106 |
-
#avhec-catlist li {
|
107 |
-
margin-bottom: 0px;
|
108 |
-
}
|
109 |
-
|
110 |
-
#avhecManualOrder {
|
111 |
-
width: 25%;
|
112 |
-
/* border: 1px solid #B2B2B2;*/
|
113 |
-
/* margin: 10px 10px 10px 0px;*/
|
114 |
-
/* padding: 5px 10px 5px 10px;*/
|
115 |
-
/* list-style: none;*/
|
116 |
-
/* background-color: #fff;*/
|
117 |
-
/* border-radius: 3px;*/
|
118 |
-
/* -webkit-border-radius: 3px;*/
|
119 |
-
}
|
120 |
-
|
121 |
-
#avhecManualOrder li.lineitem {
|
122 |
-
border: 1px solid #DFDFDF;
|
123 |
-
background-image: none;
|
124 |
-
border-radius: 3px;
|
125 |
-
-webkit-border-radius: 3px;
|
126 |
-
background-color: #FFFFFF;
|
127 |
-
color: #555555;
|
128 |
-
cursor: move;
|
129 |
-
margin-top: 5px;
|
130 |
-
margin-bottom: 5px;
|
131 |
-
padding: 2px 5px 2px 5px;
|
132 |
-
list-style: none outside none;
|
133 |
-
}
|
134 |
-
|
135 |
-
#avhecManualOrder .sortable-placeholder {
|
136 |
-
border: 1px dashed #B2B2B2;
|
137 |
-
margin-top: 5px;
|
138 |
-
margin-bottom: 5px;
|
139 |
-
padding: 2px 5px 2px 5px;
|
140 |
-
height: 1.5em;
|
141 |
-
line-height: 1.5em;
|
142 |
-
list-style: none outside none;
|
143 |
-
background-color: transparent;
|
144 |
-
background-image: -ms-linear-gradient(top, #f9f9f9, #f5f5f5); /* IE10 */
|
145 |
-
background-image: -moz-linear-gradient(top, #f9f9f9, #f5f5f5); /* Firefox */
|
146 |
-
background-image: -o-linear-gradient(top, #f9f9f9, #f5f5f5); /* Opera */
|
147 |
-
background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f5f5f5)); /* old Webkit */
|
148 |
-
background-image: -webkit-linear-gradient(top, #f9f9f9, #f5f5f5); /* new Webkit */
|
149 |
-
background-image: linear-gradient(top, #f9f9f9, #f5f5f5); /* proposed W3C Markup */
|
150 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/css/avh-ec.widget.css
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
/* AVH Extended Categories Widget CSS */
|
2 |
-
.avhec-widget-line {
|
3 |
-
display: inline-block;
|
4 |
-
}
|
5 |
-
|
6 |
-
.avhec-widget-count {
|
7 |
-
display: inline;
|
8 |
-
}
|
9 |
-
|
10 |
-
.avhec-widget-rss {
|
11 |
-
display: inline;
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/helpers/avh-forms.php
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! function_exists('avh_doWidgetFormText')) {
|
3 |
-
|
4 |
-
function avh_doWidgetFormText ($field_id, $field_name, $description, $value)
|
5 |
-
{
|
6 |
-
echo '<label for="' . $field_id . '">';
|
7 |
-
echo $description;
|
8 |
-
echo '<input class="widefat" id="' . $field_id . '" name="' . $field_name . '" type="text" value="' . esc_attr($value) . '" /> ';
|
9 |
-
echo '</label>';
|
10 |
-
echo '<br />';
|
11 |
-
}
|
12 |
-
}
|
13 |
-
|
14 |
-
if (! function_exists('avh_doWidgetFormCheckbox')) {
|
15 |
-
|
16 |
-
function avh_doWidgetFormCheckbox ($field_id, $field_name, $description, $is_checked = FALSE)
|
17 |
-
{
|
18 |
-
|
19 |
-
echo '<label for="' . $field_id . '">';
|
20 |
-
echo '<input class="checkbox" type="checkbox" id="' . $field_id . '" name="' . $field_name . '"' . ($is_checked ? ' CHECKED' : '') . ' /> ';
|
21 |
-
echo $description;
|
22 |
-
echo '</label>';
|
23 |
-
echo '<br />';
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
if (! function_exists('avh_doWidgetFormSelect')) {
|
28 |
-
|
29 |
-
function avh_doWidgetFormSelect ($field_id, $field_name, $description, $options, $selected_value)
|
30 |
-
{
|
31 |
-
echo '<label for="' . $field_id . '">';
|
32 |
-
echo $description . ' ';
|
33 |
-
echo '</label>';
|
34 |
-
|
35 |
-
$data = '';
|
36 |
-
foreach ($options as $value => $text) {
|
37 |
-
$data .= '<option value="' . $value . '" ' . ($value == $selected_value ? "SELECTED" : '') . '>' . $text . '</option>' . "/n";
|
38 |
-
}
|
39 |
-
echo '<select id="' . $field_id . '" name="' . $field_name . '"> ';
|
40 |
-
echo $data;
|
41 |
-
echo '</select>';
|
42 |
-
echo '<br />';
|
43 |
-
}
|
44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/images/us_banner_logow_120x60.gif
DELETED
Binary file
|
trunk/2.8/js/avh-ec.admin.manualorder.closure.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
function avhecManualOrder(){jQuery("#avhecManualOrder").sortable({placeholder:"sortable-placeholder",revert:false,items:".lineitem",opacity:0.65,cursor:"move",forcePlaceholderSize:true,tolerance:"pointer"})}addLoadEvent(avhecManualOrder);function orderCats(){jQuery("#updateText").html("Updating Category Order...");jQuery("#hdnManualOrder").val(jQuery("#avhecManualOrder").sortable("toArray"))};
|
|
trunk/2.8/js/avh-ec.admin.manualorder.js
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
function avhecManualOrder() {
|
2 |
-
jQuery("#avhecManualOrder").sortable({
|
3 |
-
placeholder : "sortable-placeholder",
|
4 |
-
revert : false,
|
5 |
-
items : '.lineitem',
|
6 |
-
opacity: 0.65,
|
7 |
-
cursor: 'move',
|
8 |
-
forcePlaceholderSize: true,
|
9 |
-
tolerance : "pointer"
|
10 |
-
});
|
11 |
-
};
|
12 |
-
|
13 |
-
addLoadEvent(avhecManualOrder);
|
14 |
-
|
15 |
-
function orderCats() {
|
16 |
-
jQuery("#updateText").html("Updating Category Order...");
|
17 |
-
jQuery("#hdnManualOrder").val(
|
18 |
-
jQuery("#avhecManualOrder").sortable("toArray"));
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/js/avh-ec.categorygroup.closure.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(a){a("#the-list").wpList({delBefore:function(b){if("undefined"!=showNotice)return showNotice.warn()?b:false;return b}});a('.delete a[class^="delete"]').live("click",function(){return false})});
|
|
trunk/2.8/js/avh-ec.categorygroup.js
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
var options = false, delBefore, delAfter;
|
3 |
-
|
4 |
-
delAfter = function( r, settings ) {
|
5 |
-
var id = $('cat', r).attr('id'), o;
|
6 |
-
for ( o = 0; o < options.length; o++ )
|
7 |
-
if ( id == options[o].value )
|
8 |
-
options[o] = null;
|
9 |
-
};
|
10 |
-
|
11 |
-
delBefore = function(s) {
|
12 |
-
if ( 'undefined' != showNotice )
|
13 |
-
return showNotice.warn() ? s : false;
|
14 |
-
|
15 |
-
return s;
|
16 |
-
};
|
17 |
-
|
18 |
-
$('#the-list').wpList({ delBefore: delBefore });
|
19 |
-
|
20 |
-
$('.delete a[class^="delete"]').live('click', function(){return false;});
|
21 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/2.8/js/avh-ec.categorygroup.js.closure.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(a){a("#the-list").wpList({delBefore:function(b){if("undefined"!=showNotice)return showNotice.warn()?b:false;return b}});a('.delete a[class^="delete"]').live("click",function(){return false})});
|
|
trunk/3.3/avh-ec.client.php
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Singleton Class
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class AVH_EC_Singleton
|
8 |
-
{
|
9 |
-
|
10 |
-
/**
|
11 |
-
*
|
12 |
-
* @param $class
|
13 |
-
* @param $arg1
|
14 |
-
*/
|
15 |
-
function &getInstance ($class, $arg1 = null)
|
16 |
-
{
|
17 |
-
static $instances = array (); // array of instance names
|
18 |
-
if (array_key_exists($class, $instances)) {
|
19 |
-
$instance = & $instances[$class];
|
20 |
-
} else {
|
21 |
-
if (! class_exists($class)) {
|
22 |
-
switch ($class) {
|
23 |
-
case 'AVH_EC_Core':
|
24 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.core.php');
|
25 |
-
break;
|
26 |
-
case 'AVH_EC_Category_Group':
|
27 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.category-group.php');
|
28 |
-
break;
|
29 |
-
case 'AVH_EC_Widget_Helper_Class':
|
30 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widget-helper.php');
|
31 |
-
break;
|
32 |
-
}
|
33 |
-
}
|
34 |
-
$instances[$class] = new $class($arg1);
|
35 |
-
$instance = & $instances[$class];
|
36 |
-
}
|
37 |
-
return $instance;
|
38 |
-
} // getInstance
|
39 |
-
} // singleton
|
40 |
-
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Include the necessary files
|
44 |
-
*
|
45 |
-
*/
|
46 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/helpers/avh-forms.php');
|
47 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.widgets.php');
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Initialize the plugin
|
51 |
-
*
|
52 |
-
*/
|
53 |
-
function avhextendedcategories_init ()
|
54 |
-
{
|
55 |
-
// Admin
|
56 |
-
if (is_admin()) {
|
57 |
-
require_once (AVHEC_ABSOLUTE_WORKING_DIR . '/class/avh-ec.admin.php');
|
58 |
-
$avhec_admin = new AVH_EC_Admin();
|
59 |
-
}
|
60 |
-
AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
61 |
-
|
62 |
-
add_action('widgets_init', 'avhextendedcategories_widgets_init');
|
63 |
-
|
64 |
-
} // End avhamazon_init()
|
65 |
-
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Register the widget
|
69 |
-
*
|
70 |
-
* @WordPress Action widgets_init
|
71 |
-
* @since 3.0
|
72 |
-
*
|
73 |
-
*/
|
74 |
-
function avhextendedcategories_widgets_init ()
|
75 |
-
{
|
76 |
-
register_widget('WP_Widget_AVH_ExtendedCategories_Normal');
|
77 |
-
register_widget('WP_Widget_AVH_ExtendedCategories_Top');
|
78 |
-
register_widget('WP_Widget_AVH_ExtendedCategories_Category_Group');
|
79 |
-
}
|
80 |
-
|
81 |
-
add_action('plugins_loaded', 'avhextendedcategories_init');
|
82 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/class/avh-ec.admin.php
DELETED
@@ -1,1490 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class AVH_EC_Admin
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
*
|
7 |
-
* @var AVH_EC_Core
|
8 |
-
*/
|
9 |
-
var $core;
|
10 |
-
|
11 |
-
/**
|
12 |
-
*
|
13 |
-
* @var AVH_EC_Category_Group
|
14 |
-
*/
|
15 |
-
var $catgrp;
|
16 |
-
|
17 |
-
var $hooks = array ();
|
18 |
-
var $message;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHP5 constructor
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
function __construct ()
|
25 |
-
{
|
26 |
-
|
27 |
-
// Initialize the plugin
|
28 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
29 |
-
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
30 |
-
|
31 |
-
add_action('wp_ajax_delete-group', array ( &$this, 'ajaxDeleteGroup' ));
|
32 |
-
|
33 |
-
// Admin menu
|
34 |
-
add_action('admin_init', array ( &$this, 'actionAdminInit' ));
|
35 |
-
add_action('admin_menu', array ( &$this, 'actionAdminMenu' ));
|
36 |
-
add_filter('plugin_action_links_extended-categories-widget/widget_extended_categories.php', array ( &$this, 'filterPluginActions' ), 10, 2);
|
37 |
-
|
38 |
-
// Actions used for editing posts
|
39 |
-
add_action('load-post.php', array ( &$this, 'actionLoadPostPage' ));
|
40 |
-
add_action('load-page.php', array ( &$this, 'actionLoadPostPage' ));
|
41 |
-
|
42 |
-
// Actions related to adding and deletes categories
|
43 |
-
add_action("created_category", array ( $this, 'actionCreatedCategory' ), 10, 2);
|
44 |
-
add_action("delete_category", array ( $this, 'actionDeleteCategory' ), 10, 2);
|
45 |
-
|
46 |
-
add_filter('manage_categories_group_columns', array ( &$this, 'filterManageCategoriesGroupColumns' ));
|
47 |
-
add_filter('explain_nonce_delete-avhecgroup', array ( &$this, 'filterExplainNonceDeleteGroup' ), 10, 2);
|
48 |
-
|
49 |
-
return;
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* PHP4 Constructor
|
54 |
-
*
|
55 |
-
*/
|
56 |
-
function AVH_EC_Admin ()
|
57 |
-
{
|
58 |
-
$this->__construct();
|
59 |
-
}
|
60 |
-
|
61 |
-
function actionAdminInit ()
|
62 |
-
{
|
63 |
-
if (is_admin() && isset($_GET['taxonomy']) && 'category' == $_GET['taxonomy']) {
|
64 |
-
add_action($_GET['taxonomy'] . '_edit_form', array ( &$this, 'displayCategoryGroupForm' ), 10, 2);
|
65 |
-
}
|
66 |
-
add_action('edit_term', array ( &$this, 'handleEditTerm' ), 10, 3);
|
67 |
-
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
*
|
72 |
-
* Adds Category Group form
|
73 |
-
* @WordPress action category_edit_form
|
74 |
-
*
|
75 |
-
* @param unknown_type $term
|
76 |
-
* @param unknown_type $taxonomy
|
77 |
-
*/
|
78 |
-
function displayCategoryGroupForm ($term, $taxonomy)
|
79 |
-
{
|
80 |
-
|
81 |
-
$current_selection = '';
|
82 |
-
$tax_meta = get_option($this->core->db_options_tax_meta);
|
83 |
-
if (isset($tax_meta[$taxonomy][$term->term_id])) {
|
84 |
-
$tax_meta = $tax_meta[$taxonomy][$term->term_id];
|
85 |
-
$current_selection = $tax_meta['category_group_term_id'];
|
86 |
-
}
|
87 |
-
|
88 |
-
if (empty($current_selection)) {
|
89 |
-
$current_group = $this->catgrp->getGroupByCategoryID($term->term_id);
|
90 |
-
$current_selection = $current_group->term_id;
|
91 |
-
}
|
92 |
-
|
93 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
|
94 |
-
foreach ($cat_groups as $group) {
|
95 |
-
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
96 |
-
$dropdown_value[] = $group->term_id;
|
97 |
-
$dropdown_text[] = $temp_cat->name;
|
98 |
-
}
|
99 |
-
|
100 |
-
foreach ($dropdown_value as $key => $sel) {
|
101 |
-
$seldata .= '<option value="' . esc_attr($sel) . '" ' . (($current_selection == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($dropdown_text[$key])) . '</option>' . "\n";
|
102 |
-
}
|
103 |
-
|
104 |
-
echo '<h3>AVH Extended Categories - Category Group Widget</h3>';
|
105 |
-
echo '<table class="form-table"><tbody>';
|
106 |
-
echo '<tr class="form-field">';
|
107 |
-
echo '<th valign="top" scope="row">';
|
108 |
-
echo '<label for="avhec_categorygroup">Category Group</label></th>';
|
109 |
-
echo '<td>';
|
110 |
-
echo '<select id="avhec_categorygroup" name="avhec_categorygroup">';
|
111 |
-
echo $seldata;
|
112 |
-
echo '</select>';
|
113 |
-
echo '<p class="description">Select the category group to show on the archive page.</p>';
|
114 |
-
echo '</td>';
|
115 |
-
echo '</tr>';
|
116 |
-
echo '</tbody></table>';
|
117 |
-
}
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Saves the association Category - Category Group fron the edit taxonomy page
|
121 |
-
* @WordPress action edit_form.
|
122 |
-
*
|
123 |
-
* @param unknown_type $term_id
|
124 |
-
* @param unknown_type $tt_id
|
125 |
-
* @param unknown_type $taxonomy
|
126 |
-
*/
|
127 |
-
function handleEditTerm ($term_id, $tt_id, $taxonomy)
|
128 |
-
{
|
129 |
-
$tax_meta = get_option($this->core->db_options_tax_meta);
|
130 |
-
if (isset($_POST['avhec_categorygroup']) && $tax_meta[$taxonomy][$term_id]['category_group_term_id'] != $_POST['avhec_categorygroup']) {
|
131 |
-
$tax_meta[$taxonomy][$term_id]['category_group_term_id'] = $_POST['avhec_categorygroup'];
|
132 |
-
update_option($this->core->db_options_tax_meta, $tax_meta);
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* When a category is created this function is called to add the new category to the group all
|
138 |
-
* @param $term_id
|
139 |
-
* @param $term_taxonomy_id
|
140 |
-
*/
|
141 |
-
function actionCreatedCategory ($term_id, $term_taxonomy_id)
|
142 |
-
{
|
143 |
-
$group_id = $this->catgrp->getTermIDBy('slug', 'all');
|
144 |
-
$this->catgrp->setCategoriesForGroup($group_id, (array) $term_id);
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* When a category is deleted this function is called so the category is deleted from every group as well.
|
149 |
-
*
|
150 |
-
* @param object $term
|
151 |
-
* @param int $term_taxonomy_id
|
152 |
-
*/
|
153 |
-
function actionDeleteCategory ($term_id, $term_taxonomy_id)
|
154 |
-
{
|
155 |
-
$this->catgrp->doDeleteCategoryFromGroup($term_id);
|
156 |
-
}
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Enqueues the style on the post.php and page.php pages
|
160 |
-
* @WordPress Action load-$pagenow
|
161 |
-
*
|
162 |
-
*/
|
163 |
-
function actionLoadPostPage ()
|
164 |
-
{
|
165 |
-
wp_enqueue_style('avhec-admin-css');
|
166 |
-
}
|
167 |
-
|
168 |
-
/**
|
169 |
-
* Add the Tools and Options to the Management and Options page repectively
|
170 |
-
*
|
171 |
-
* @WordPress Action admin_menu
|
172 |
-
*
|
173 |
-
*/
|
174 |
-
function actionAdminMenu ()
|
175 |
-
{
|
176 |
-
|
177 |
-
// Register Style and Scripts
|
178 |
-
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.closure';
|
179 |
-
wp_register_script('avhec-categorygroup-js', AVHEC_PLUGIN_URL . '/js/avh-ec.categorygroup' . $suffix . '.js', array ( 'jquery' ), $this->core->version, true);
|
180 |
-
wp_register_script('avhec-manualorder', AVHEC_PLUGIN_URL . '/js/avh-ec.admin.manualorder' . $suffix . '.js', array ( 'jquery-ui-sortable' ), $this->core->version, false);
|
181 |
-
wp_register_style('avhec-admin-css', AVHEC_PLUGIN_URL . '/css/avh-ec.admin.css', array ( 'wp-admin' ), $this->core->version, 'screen');
|
182 |
-
|
183 |
-
// Add menu system
|
184 |
-
$folder = $this->core->getBaseDirectory(AVHEC_PLUGIN_DIR);
|
185 |
-
add_menu_page('AVH Extended Categories', 'AVH Extended Categories', 'manage_options', $folder, array ( &$this, 'doMenuOverview' ));
|
186 |
-
$this->hooks['menu_overview'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Overview', 'avh-ec'), __('Overview', 'avh-ec'), 'manage_options', $folder, array ( &$this, 'doMenuOverview' ));
|
187 |
-
$this->hooks['menu_general'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('General Options', 'avh-ec'), __('General Options', 'avh-ec'), 'manage_options', 'avhec-general', array ( &$this, 'doMenuGeneral' ));
|
188 |
-
$this->hooks['menu_category_groups'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Category Groups', 'avh-ec'), __('Category Groups', 'avh-ec'), 'manage_options', 'avhec-grouped', array ( &$this, 'doMenuCategoryGroup' ));
|
189 |
-
$this->hooks['menu_manual_order'] = add_submenu_page($folder, 'AVH Extended Categories: ' . __('Manually Order', 'avh-ec'), __('Manually Order', 'avh-ec'), 'manage_options', 'avhec-manual-order', array ( &$this, 'doMenuManualOrder' ));
|
190 |
-
$this->hooks['menu_faq'] = add_submenu_page($folder, 'AVH Extended Categories:' . __('F.A.Q', 'avh-ec'), __('F.A.Q', 'avh-ec'), 'manage_options', 'avhec-faq', array ( &$this, 'doMenuFAQ' ));
|
191 |
-
|
192 |
-
// Add actions for menu pages
|
193 |
-
// Overview Menu
|
194 |
-
add_action('load-' . $this->hooks['menu_overview'], array ( &$this, 'actionLoadPageHook_Overview' ));
|
195 |
-
|
196 |
-
// General Options Menu
|
197 |
-
add_action('load-' . $this->hooks['menu_general'], array ( &$this, 'actionLoadPageHook_General' ));
|
198 |
-
|
199 |
-
// Category Groups Menu
|
200 |
-
add_action('load-' . $this->hooks['menu_category_groups'], array ( &$this, 'actionLoadPageHook_CategoryGroup' ));
|
201 |
-
|
202 |
-
// Manual Order Menu
|
203 |
-
add_action('load-' . $this->hooks['menu_manual_order'], array ( &$this, 'actionLoadPageHook_ManualOrder' ));
|
204 |
-
|
205 |
-
// FAQ Menu
|
206 |
-
add_action('load-' . $this->hooks['menu_faq'], array ( &$this, 'actionLoadPageHook_faq' ));
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Setup everything needed for the Overview page
|
211 |
-
*
|
212 |
-
*/
|
213 |
-
function actionLoadPageHook_Overview ()
|
214 |
-
{
|
215 |
-
// Add metaboxes
|
216 |
-
add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupList' ), $this->hooks['menu_overview'], 'normal', 'core');
|
217 |
-
add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array ( &$this, 'metaboxTranslation' ), $this->hooks['menu_overview'], 'normal', 'core');
|
218 |
-
|
219 |
-
add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
|
220 |
-
|
221 |
-
// WordPress core Scripts
|
222 |
-
wp_enqueue_script('common');
|
223 |
-
wp_enqueue_script('wp-lists');
|
224 |
-
wp_enqueue_script('postbox');
|
225 |
-
|
226 |
-
// Plugin Scripts
|
227 |
-
wp_enqueue_script('avhec-categorygroup-js');
|
228 |
-
|
229 |
-
// Plugin Style
|
230 |
-
wp_enqueue_style('avhec-admin-css');
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Menu Page Overview
|
235 |
-
*
|
236 |
-
* @return none
|
237 |
-
*/
|
238 |
-
function doMenuOverview ()
|
239 |
-
{
|
240 |
-
global $screen_layout_columns;
|
241 |
-
|
242 |
-
// This box can't be unselectd in the the Screen Options
|
243 |
-
//add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array ( &$this, 'metaboxAnnouncements' ), $this->hooks['menu_overview'], 'side', '');
|
244 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array ( &$this, 'metaboxDonations' ), $this->hooks['menu_overview'], 'side', '');
|
245 |
-
|
246 |
-
$hide2 = '';
|
247 |
-
switch ($screen_layout_columns) {
|
248 |
-
case 2:
|
249 |
-
$width = 'width:49%;';
|
250 |
-
break;
|
251 |
-
default:
|
252 |
-
$width = 'width:98%;';
|
253 |
-
$hide2 = 'display:none;';
|
254 |
-
}
|
255 |
-
|
256 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
257 |
-
echo $this->displayIcon('index');
|
258 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('Overview', 'avh-ec') . '</h2>';
|
259 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
260 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
261 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
262 |
-
do_meta_boxes($this->hooks['menu_overview'], 'normal', '');
|
263 |
-
echo " </div>";
|
264 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
265 |
-
do_meta_boxes($this->hooks['menu_overview'], 'side', '');
|
266 |
-
echo ' </div>';
|
267 |
-
echo ' </div>';
|
268 |
-
|
269 |
-
echo '<br class="clear"/>';
|
270 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
271 |
-
echo '</div>'; // wrap
|
272 |
-
|
273 |
-
|
274 |
-
$this->printMetaboxGeneralNonces();
|
275 |
-
$this->printMetaboxJS('overview');
|
276 |
-
$this->printAdminFooter();
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Setup everything needed for the General Options page
|
281 |
-
*
|
282 |
-
*/
|
283 |
-
function actionLoadPageHook_General ()
|
284 |
-
{
|
285 |
-
// Add metaboxes
|
286 |
-
add_meta_box('avhecBoxOptions', __('Options', 'avh-ec'), array ( &$this, 'metaboxOptions' ), $this->hooks['menu_general'], 'normal', 'core');
|
287 |
-
|
288 |
-
add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
|
289 |
-
|
290 |
-
// WordPress core Scripts
|
291 |
-
wp_enqueue_script('common');
|
292 |
-
wp_enqueue_script('wp-lists');
|
293 |
-
wp_enqueue_script('postbox');
|
294 |
-
|
295 |
-
// Plugin Style and Scripts
|
296 |
-
wp_enqueue_style('avhec-admin-css');
|
297 |
-
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Menu Page General Options
|
302 |
-
*
|
303 |
-
* @return none
|
304 |
-
*/
|
305 |
-
function doMenuGeneral ()
|
306 |
-
{
|
307 |
-
global $screen_layout_columns;
|
308 |
-
|
309 |
-
$groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
|
310 |
-
foreach ($groups as $group) {
|
311 |
-
$group_id[] = $group->term_id;
|
312 |
-
$groupname[] = $group->name;
|
313 |
-
}
|
314 |
-
|
315 |
-
$options_general[] = array ( 'avhec[general][alternative_name_select_category]', __('<em>Select Category</em> Alternative', 'avh-ec'), 'text', 20, __('Alternative text for Select Category.', 'avh-ec') );
|
316 |
-
$options_general[] = array ( 'avhec[cat_group][home_group]', 'Home Group', 'dropdown', $group_id, $groupname, __('Select which group to show on the home page.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec') );
|
317 |
-
$options_general[] = array ( 'avhec[cat_group][no_group]', 'Nonexistence Group', 'dropdown', $group_id, $groupname, __('Select which group to show when there is no group associated with the post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec') );
|
318 |
-
$options_general[] = array ( 'avhec[cat_group][default_group]', 'Default Group', 'dropdown', $group_id, $groupname, __('Select which group will be the default group when editing a post.', 'avh-ec') . '<br />' . __('Selecting the group \'none\' will not show the widget on the page.', 'avh-ec') );
|
319 |
-
|
320 |
-
if (isset($_POST['updateoptions'])) {
|
321 |
-
check_admin_referer('avh_ec_generaloptions');
|
322 |
-
|
323 |
-
$formoptions = $_POST['avhec'];
|
324 |
-
$options = $this->core->getOptions();
|
325 |
-
|
326 |
-
//$all_data = array_merge( $options_general );
|
327 |
-
$all_data = $options_general;
|
328 |
-
foreach ($all_data as $option) {
|
329 |
-
$section = substr($option[0], strpos($option[0], '[') + 1);
|
330 |
-
$section = substr($section, 0, strpos($section, ']['));
|
331 |
-
$option_key = rtrim($option[0], ']');
|
332 |
-
$option_key = substr($option_key, strpos($option_key, '][') + 2);
|
333 |
-
|
334 |
-
switch ($section) {
|
335 |
-
case 'general':
|
336 |
-
case 'cat_group':
|
337 |
-
$current_value = $options[$section][$option_key];
|
338 |
-
break;
|
339 |
-
}
|
340 |
-
// Every field in a form is set except unchecked checkboxes. Set an unchecked checkbox to 0.
|
341 |
-
$newval = (isset($formoptions[$section][$option_key]) ? esc_attr($formoptions[$section][$option_key]) : 0);
|
342 |
-
if ($newval != $current_value) { // Only process changed fields.
|
343 |
-
switch ($section) {
|
344 |
-
case 'general':
|
345 |
-
case 'cat_group':
|
346 |
-
$options[$section][$option_key] = $newval;
|
347 |
-
break;
|
348 |
-
}
|
349 |
-
}
|
350 |
-
}
|
351 |
-
$this->core->saveOptions($options);
|
352 |
-
$this->message = __('Options saved', 'avh-ec');
|
353 |
-
$this->status = 'updated fade';
|
354 |
-
|
355 |
-
}
|
356 |
-
$this->displayMessage();
|
357 |
-
|
358 |
-
$actual_options = $this->core->getOptions();
|
359 |
-
foreach ($actual_options['cat_group'] as $key => $value) {
|
360 |
-
if (! (in_array($value, (array) $group_id))) {
|
361 |
-
$actual_options['cat_group'][$key] = $this->catgrp->getTermIDBy('slug', 'none');
|
362 |
-
}
|
363 |
-
}
|
364 |
-
|
365 |
-
$hide2 = '';
|
366 |
-
switch ($screen_layout_columns) {
|
367 |
-
case 2:
|
368 |
-
$width = 'width:49%;';
|
369 |
-
break;
|
370 |
-
default:
|
371 |
-
$width = 'width:98%;';
|
372 |
-
$hide2 = 'display:none;';
|
373 |
-
}
|
374 |
-
$data['options_general'] = $options_general;
|
375 |
-
$data['actual_options'] = $actual_options;
|
376 |
-
|
377 |
-
// This box can't be unselectd in the the Screen Options
|
378 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array ( &$this, 'metaboxDonations' ), $this->hooks['menu_general'], 'side', 'core');
|
379 |
-
|
380 |
-
$hide2 = '';
|
381 |
-
switch ($screen_layout_columns) {
|
382 |
-
case 2:
|
383 |
-
$width = 'width:49%;';
|
384 |
-
break;
|
385 |
-
default:
|
386 |
-
$width = 'width:98%;';
|
387 |
-
$hide2 = 'display:none;';
|
388 |
-
}
|
389 |
-
|
390 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
391 |
-
echo $this->displayIcon('index');
|
392 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('General Options', 'avh-ec') . '</h2>';
|
393 |
-
echo '<form name="avhec-generaloptions" id="avhec-generaloptions" method="POST" action="' . admin_url('admin.php?page=avhec-general') . '" accept-charset="utf-8" >';
|
394 |
-
wp_nonce_field('avh_ec_generaloptions');
|
395 |
-
|
396 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
397 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
398 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
399 |
-
do_meta_boxes($this->hooks['menu_general'], 'normal', $data);
|
400 |
-
echo " </div>";
|
401 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
402 |
-
do_meta_boxes($this->hooks['menu_general'], 'side', $data);
|
403 |
-
echo ' </div>';
|
404 |
-
echo ' </div>';
|
405 |
-
|
406 |
-
echo '<br class="clear"/>';
|
407 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
408 |
-
echo '<p class="submit"><input class="button" type="submit" name="updateoptions" value="' . __('Save Changes', 'avhf-ec') . '" /></p>';
|
409 |
-
echo '</form>';
|
410 |
-
|
411 |
-
echo '</div>'; // wrap
|
412 |
-
|
413 |
-
|
414 |
-
$this->printMetaboxGeneralNonces();
|
415 |
-
$this->printMetaboxJS('general');
|
416 |
-
$this->printAdminFooter();
|
417 |
-
}
|
418 |
-
|
419 |
-
/**
|
420 |
-
* Options Metabox
|
421 |
-
*
|
422 |
-
*/
|
423 |
-
function metaboxOptions ($data)
|
424 |
-
{
|
425 |
-
echo $this->printOptions($data['options_general'], $data['actual_options']);
|
426 |
-
}
|
427 |
-
|
428 |
-
/**
|
429 |
-
* Setup everything needed for the Category Group page
|
430 |
-
*
|
431 |
-
*/
|
432 |
-
function actionLoadPageHook_CategoryGroup ()
|
433 |
-
{
|
434 |
-
|
435 |
-
// Add metaboxes
|
436 |
-
add_meta_box('avhecBoxCategoryGroupAdd', __('Add Group', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupAdd' ), $this->hooks['menu_category_groups'], 'normal', 'core');
|
437 |
-
add_meta_box('avhecBoxCategoryGroupList', __('Group Overview', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupList' ), $this->hooks['menu_category_groups'], 'side', 'core');
|
438 |
-
add_meta_box('avhecBoxCategoryGroupSpecialPages', __('Special Pages', 'avh-ec'), array ( &$this, 'metaboxCategoryGroupSpecialPages' ), $this->hooks['menu_category_groups'], 'normal', 'core');
|
439 |
-
|
440 |
-
add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
|
441 |
-
|
442 |
-
// WordPress core Scripts
|
443 |
-
wp_enqueue_script('common');
|
444 |
-
wp_enqueue_script('wp-lists');
|
445 |
-
wp_enqueue_script('postbox');
|
446 |
-
|
447 |
-
// Plugin Scripts
|
448 |
-
wp_enqueue_script('avhec-categorygroup-js');
|
449 |
-
|
450 |
-
// Plugin Style
|
451 |
-
wp_enqueue_style('avhec-admin-css');
|
452 |
-
|
453 |
-
}
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Menu Page Category Group
|
457 |
-
*
|
458 |
-
* @return none
|
459 |
-
*/
|
460 |
-
function doMenuCategoryGroup ()
|
461 |
-
{
|
462 |
-
global $screen_layout_columns;
|
463 |
-
|
464 |
-
$data_add_group_default = array ( 'name' => '', 'slug' => '', 'widget_title' => '', 'description' => '' );
|
465 |
-
$data_add_group_new = $data_add_group_default;
|
466 |
-
|
467 |
-
$options_add_group[] = array ( 'avhec_add_group[add][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec') );
|
468 |
-
$options_add_group[] = array ( 'avhec_add_group[add][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec') );
|
469 |
-
$options_add_group[] = array ( 'avhec_add_group[add][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec') );
|
470 |
-
$options_add_group[] = array ( 'avhec_add_group[add][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5 );
|
471 |
-
|
472 |
-
$options_edit_group[] = array ( 'avhec_edit_group[edit][name]', __('Group Name', 'avh-ec'), 'text', 20, __('The name is used to identify the group.', 'avh-ec') );
|
473 |
-
$options_edit_group[] = array ( 'avhec_edit_group[edit][slug]', __('Slug Group', 'avh-ec'), 'text', 20, __('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'avh-ec') );
|
474 |
-
$options_edit_group[] = array ( 'avhec_edit_group[edit][widget_title]', __('Widget Title', 'avh-ec'), 'text', 20, __('When no title is given in the widget options, this will used as the title of the widget when this group is shown.', 'avh-ec') );
|
475 |
-
$options_edit_group[] = array ( 'avhec_edit_group[edit][description]', __('Description', 'avh-ec'), 'textarea', 40, __('Description is not prominent by default.', 'avh-ec'), 5 );
|
476 |
-
$options_edit_group[] = array ( 'avhec_edit_group[edit][categories]', __('Categories', 'avh-ec'), 'catlist', 0, __('Select categories to be included in the group.', 'avh-ec') );
|
477 |
-
|
478 |
-
if (isset($_POST['addgroup'])) {
|
479 |
-
check_admin_referer('avh_ec_addgroup');
|
480 |
-
|
481 |
-
$formoptions = $_POST['avhec_add_group'];
|
482 |
-
|
483 |
-
$data_add_group_new['name'] = $formoptions['add']['name'];
|
484 |
-
$data_add_group_new['slug'] = empty($formoptions['add']['slug']) ? sanitize_title($data_add_group_new['name']) : sanitize_title($formoptions['add']['slug']);
|
485 |
-
$data_add_group_new['widget_title'] = $formoptions['add']['widget_title'];
|
486 |
-
$data_add_group_new['description'] = $formoptions['add']['description'];
|
487 |
-
|
488 |
-
$id = $this->catgrp->getTermIDBy('slug', $data_add_group_new['slug']);
|
489 |
-
if (! $id) {
|
490 |
-
$group_id = $this->catgrp->doInsertGroup($data_add_group_new['name'], array ( 'description' => $data_add_group_new['description'], 'slug' => $data_add_group_new['slug'] ), $data_add_group_new['widget_title']);
|
491 |
-
$this->catgrp->setCategoriesForGroup($group_id);
|
492 |
-
$this->message = __('Category group saved', 'avh-ec');
|
493 |
-
$this->status = 'updated fade';
|
494 |
-
$data_add_group_new = $data_add_group_default;
|
495 |
-
|
496 |
-
} else {
|
497 |
-
$group = $this->catgrp->getGroup($id);
|
498 |
-
$this->message = __('Category group conflicts with ', 'avh-ec') . $group->name;
|
499 |
-
$this->message .= '<br />' . __('Same slug is used. ', 'avh-ec');
|
500 |
-
$this->status = 'error';
|
501 |
-
|
502 |
-
}
|
503 |
-
$this->displayMessage();
|
504 |
-
}
|
505 |
-
$data_add_group['add'] = $data_add_group_new;
|
506 |
-
$data['add'] = array ( 'form' => $options_add_group, 'data' => $data_add_group );
|
507 |
-
|
508 |
-
if (isset($_GET['action'])) {
|
509 |
-
$action = $_GET['action'];
|
510 |
-
|
511 |
-
switch ($action) {
|
512 |
-
case 'edit':
|
513 |
-
$group_id = (int) $_GET['group_ID'];
|
514 |
-
$group = $this->catgrp->getGroup($group_id);
|
515 |
-
$widget_title = $this->catgrp->getWidgetTitleForGroup($group_id);
|
516 |
-
$cats = $this->catgrp->getCategoriesFromGroup($group_id);
|
517 |
-
|
518 |
-
$data_edit_group['edit'] = array ( 'group_id' => $group_id, 'name' => $group->name, 'slug' => $group->slug, 'widget_title' => $widget_title, 'description' => $group->description, 'categories' => $cats );
|
519 |
-
$data['edit'] = array ( 'form' => $options_edit_group, 'data' => $data_edit_group );
|
520 |
-
|
521 |
-
add_meta_box('avhecBoxCategoryGroupEdit', __('Edit Group', 'avh-ec') . ': ' . $group->name, array ( &$this, 'metaboxCategoryGroupEdit' ), $this->hooks['menu_category_groups'], 'normal', 'low');
|
522 |
-
break;
|
523 |
-
case 'delete':
|
524 |
-
if (! isset($_GET['group_ID'])) {
|
525 |
-
wp_redirect($this->getBackLink());
|
526 |
-
exit();
|
527 |
-
}
|
528 |
-
|
529 |
-
$group_id = (int) $_GET['group_ID'];
|
530 |
-
check_admin_referer('delete-avhecgroup_' . $group_id);
|
531 |
-
|
532 |
-
if (! current_user_can('manage_categories')) {
|
533 |
-
wp_die(__('Cheatin’ uh?'));
|
534 |
-
}
|
535 |
-
$this->catgrp->doDeleteGroup($group_id);
|
536 |
-
break;
|
537 |
-
default:
|
538 |
-
;
|
539 |
-
break;
|
540 |
-
}
|
541 |
-
}
|
542 |
-
|
543 |
-
if (isset($_POST['editgroup'])) {
|
544 |
-
check_admin_referer('avh_ec_editgroup');
|
545 |
-
|
546 |
-
$formoptions = $_POST['avhec_edit_group'];
|
547 |
-
$selected_categories = $_POST['post_category'];
|
548 |
-
|
549 |
-
$group_id = (int) $_POST['avhec-group_id'];
|
550 |
-
$result = $this->catgrp->doUpdateGroup($group_id, array ( 'name' => $formoptions['edit']['name'], 'slug' => $formoptions['edit']['slug'], 'description' => $formoptions['edit']['description'] ), $selected_categories, $formoptions['edit']['widget_title']);
|
551 |
-
switch ($result) {
|
552 |
-
case 1:
|
553 |
-
$this->message = __('Category group updated', 'avh-ec');
|
554 |
-
$this->status = 'updated fade';
|
555 |
-
break;
|
556 |
-
case 0:
|
557 |
-
$this->message = __('Category group not updated', 'avh-ec');
|
558 |
-
$this->message .= '<br />' . __('Duplicate slug detected', 'avh-ec');
|
559 |
-
$this->status = 'error';
|
560 |
-
break;
|
561 |
-
case - 1:
|
562 |
-
$this->message = __('Unknown category group', 'avh-ec');
|
563 |
-
$this->status = 'error';
|
564 |
-
break;
|
565 |
-
}
|
566 |
-
$this->displayMessage();
|
567 |
-
}
|
568 |
-
|
569 |
-
$hide2 = '';
|
570 |
-
switch ($screen_layout_columns) {
|
571 |
-
case 2:
|
572 |
-
$width = 'width:49%;';
|
573 |
-
break;
|
574 |
-
default:
|
575 |
-
$width = 'width:98%;';
|
576 |
-
$hide2 = 'display:none;';
|
577 |
-
}
|
578 |
-
|
579 |
-
$data_special_pages_old = $this->core->options['sp_cat_group'];
|
580 |
-
$data_special_pages_new = $data_special_pages_old;
|
581 |
-
if (isset($_POST['avhec_special_pages'])) {
|
582 |
-
check_admin_referer('avh_ec_specialpagesgroup');
|
583 |
-
|
584 |
-
$formoptions = $_POST['avhec_special_pages'];
|
585 |
-
$formdata = $formoptions['sp'];
|
586 |
-
foreach ($formdata as $key => $value) {
|
587 |
-
$data_special_pages_new[$key] = $value;
|
588 |
-
}
|
589 |
-
$this->core->options['sp_cat_group'] = $data_special_pages_new;
|
590 |
-
$this->core->saveOptions($this->core->options);
|
591 |
-
|
592 |
-
}
|
593 |
-
$data_special_pages['sp'] = $data_special_pages_new;
|
594 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
|
595 |
-
|
596 |
-
foreach ($cat_groups as $group) {
|
597 |
-
$temp_cat = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
598 |
-
$dropdown_value[] = $group->term_id;
|
599 |
-
$dropdown_text[] = $temp_cat->name;
|
600 |
-
}
|
601 |
-
$options_special_pages[] = array ( 'avhec_special_pages[sp][home_group]', __('Home page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('home', 'avhec')) );
|
602 |
-
//$options_special_pages[] = array('avhec_special_pages[sp][category_group]', __('Category Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.','avh-ec'),__('category archive','avhec')));
|
603 |
-
$options_special_pages[] = array ( 'avhec_special_pages[sp][day_group]', __('Daily Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('daily archive', 'avhec')) );
|
604 |
-
$options_special_pages[] = array ( 'avhec_special_pages[sp][month_group]', __('Monthly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('monthly archive', 'avhec')) );
|
605 |
-
$options_special_pages[] = array ( 'avhec_special_pages[sp][year_group]', __('Yearly Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('yearly archive', 'avhec')) );
|
606 |
-
$options_special_pages[] = array ( 'avhec_special_pages[sp][author_group]', __('Author Archive', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('author archive', 'avhec')) );
|
607 |
-
$options_special_pages[] = array ( 'avhec_special_pages[sp][search_group]', __('Search Page', 'avh-ec'), 'dropdown', $dropdown_value, $dropdown_text, sprintf(__('Select which category to show on the %s page.', 'avh-ec'), __('search', 'avhec')) );
|
608 |
-
|
609 |
-
$data['sp'] = array ( 'form' => $options_special_pages, 'data' => $data_special_pages );
|
610 |
-
|
611 |
-
// This box can't be unselectd in the the Screen Options
|
612 |
-
//add_meta_box( 'avhecBoxDonations', __( 'Donations', 'avh-ec' ), array (&$this, 'metaboxDonations' ), $this->hooks['menu_category_groups'], 'side', 'core' );
|
613 |
-
|
614 |
-
|
615 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
616 |
-
echo $this->displayIcon('index');
|
617 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('Category Groups', 'avh-ec') . '</h2>';
|
618 |
-
|
619 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
620 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
621 |
-
|
622 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
623 |
-
do_meta_boxes($this->hooks['menu_category_groups'], 'normal', $data);
|
624 |
-
echo " </div>";
|
625 |
-
|
626 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
627 |
-
do_meta_boxes($this->hooks['menu_category_groups'], 'side', $data);
|
628 |
-
echo ' </div>';
|
629 |
-
|
630 |
-
echo ' </div>'; // dashboard-widgets
|
631 |
-
echo '<br class="clear" />';
|
632 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
633 |
-
echo '</div>'; // wrap
|
634 |
-
|
635 |
-
|
636 |
-
$this->printMetaboxGeneralNonces();
|
637 |
-
$this->printMetaboxJS('grouped');
|
638 |
-
$this->printAdminFooter();
|
639 |
-
}
|
640 |
-
|
641 |
-
/**
|
642 |
-
* Metabox for Adding a group
|
643 |
-
* @param $data
|
644 |
-
*/
|
645 |
-
function metaboxCategoryGroupAdd ($data)
|
646 |
-
{
|
647 |
-
echo '<form name="avhec-addgroup" id="avhec-addgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
|
648 |
-
wp_nonce_field('avh_ec_addgroup');
|
649 |
-
echo $this->printOptions($data['add']['form'], $data['add']['data']);
|
650 |
-
echo '<p class="submit"><input class="button" type="submit" name="addgroup" value="' . __('Add group', 'avh-ec') . '" /></p>';
|
651 |
-
echo '</form>';
|
652 |
-
}
|
653 |
-
|
654 |
-
/**
|
655 |
-
* Metabox for showing the groups as a list
|
656 |
-
*
|
657 |
-
* @param $data
|
658 |
-
*/
|
659 |
-
function metaboxCategoryGroupList ($data)
|
660 |
-
{
|
661 |
-
echo '<form id="posts-filter" action="" method="get">';
|
662 |
-
|
663 |
-
echo '<div class="clear"></div>';
|
664 |
-
|
665 |
-
echo '<table class="widefat fixed" cellspacing="0">';
|
666 |
-
echo '<thead>';
|
667 |
-
echo '<tr>';
|
668 |
-
print_column_headers('categories_group');
|
669 |
-
echo '</tr>';
|
670 |
-
echo '</thead>';
|
671 |
-
|
672 |
-
echo '<tfoot>';
|
673 |
-
echo '<tr>';
|
674 |
-
print_column_headers('categories_group', false);
|
675 |
-
echo '</tr>';
|
676 |
-
echo '</tfoot>';
|
677 |
-
|
678 |
-
echo '<tbody id="the-list" class="list:group">';
|
679 |
-
$this->printCategoryGroupRows();
|
680 |
-
echo '</tbody>';
|
681 |
-
echo '</table>';
|
682 |
-
|
683 |
-
echo '<br class="clear" />';
|
684 |
-
echo '</form>';
|
685 |
-
|
686 |
-
//echo '</div>';
|
687 |
-
}
|
688 |
-
|
689 |
-
/**
|
690 |
-
* Metabox Category Group Edit
|
691 |
-
*
|
692 |
-
*/
|
693 |
-
function metaboxCategoryGroupEdit ($data)
|
694 |
-
{
|
695 |
-
echo '<form name="avhec-editgroup" id="avhec-editgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
|
696 |
-
wp_nonce_field('avh_ec_editgroup');
|
697 |
-
echo $this->printOptions($data['edit']['form'], $data['edit']['data']);
|
698 |
-
echo '<input type="hidden" value="' . $data['edit']['data']['edit']['group_id'] . '" name="avhec-group_id" id="avhec-group_id">';
|
699 |
-
echo '<p class="submit"><input class="button" type="submit" name="editgroup" value="' . __('Update group', 'avh-ec') . '" /></p>';
|
700 |
-
echo '</form>';
|
701 |
-
}
|
702 |
-
|
703 |
-
/**
|
704 |
-
* Metabox Category Group Special pages
|
705 |
-
*
|
706 |
-
*/
|
707 |
-
function metaboxCategoryGroupSpecialPages ($data)
|
708 |
-
{
|
709 |
-
echo '<form name="avhec-specialpagesgroup" id="avhec-specialpagesgroup" method="POST" action="' . $this->getBackLink() . '" accept-charset="utf-8" >';
|
710 |
-
wp_nonce_field('avh_ec_specialpagesgroup');
|
711 |
-
echo $this->printOptions($data['sp']['form'], $data['sp']['data']);
|
712 |
-
echo '<p class="submit"><input class="button" type="submit" name="spgroup" value="' . __('Save settings', 'avh-ec') . '" /></p>';
|
713 |
-
echo '</form>';
|
714 |
-
}
|
715 |
-
|
716 |
-
/**
|
717 |
-
* Setup everything needed for the Manul Order page
|
718 |
-
*
|
719 |
-
*/
|
720 |
-
function actionLoadPageHook_ManualOrder ()
|
721 |
-
{
|
722 |
-
|
723 |
-
add_meta_box('avhecBoxManualOrder', __('Manually Order Categories', 'avh-ec'), array ( &$this, 'metaboxManualOrder' ), $this->hooks['menu_manual_order'], 'normal', 'core');
|
724 |
-
|
725 |
-
add_screen_option('layout_columns', array ( 'max' => 1, 'default' => 1 ));
|
726 |
-
|
727 |
-
// WordPress core Styles and Scripts
|
728 |
-
wp_enqueue_script('common');
|
729 |
-
wp_enqueue_script('wp-lists');
|
730 |
-
wp_enqueue_script('postbox');
|
731 |
-
wp_enqueue_script('jquery-ui-sortable');
|
732 |
-
wp_enqueue_script('avhec-manualorder');
|
733 |
-
|
734 |
-
// Plugin Style
|
735 |
-
wp_enqueue_style('avhec-admin-css');
|
736 |
-
|
737 |
-
}
|
738 |
-
|
739 |
-
/**
|
740 |
-
* Menu Page Manual Order
|
741 |
-
*
|
742 |
-
* @return none
|
743 |
-
*/
|
744 |
-
function doMenuManualOrder ()
|
745 |
-
{
|
746 |
-
global $screen_layout_columns;
|
747 |
-
|
748 |
-
$hide2 = '';
|
749 |
-
switch ($screen_layout_columns) {
|
750 |
-
case 2:
|
751 |
-
$width = 'width:49%;';
|
752 |
-
break;
|
753 |
-
default:
|
754 |
-
$width = 'width:98%;';
|
755 |
-
$hide2 = 'display:none;';
|
756 |
-
}
|
757 |
-
|
758 |
-
echo '<div class="wrap">';
|
759 |
-
echo $this->displayIcon('index');
|
760 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('Manually Order Categories', 'avh-ec') . '</h2>';
|
761 |
-
|
762 |
-
echo '<div class="metabox-holder">';
|
763 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
764 |
-
do_meta_boxes($this->hooks['menu_manual_order'], 'normal', '');
|
765 |
-
echo ' </div>';
|
766 |
-
echo '</div>';
|
767 |
-
echo '</div>'; // wrap
|
768 |
-
echo '<div class="clear"></div>';
|
769 |
-
|
770 |
-
$this->printMetaboxGeneralNonces();
|
771 |
-
$this->printMetaboxJS('manual_order');
|
772 |
-
$this->printAdminFooter();
|
773 |
-
}
|
774 |
-
|
775 |
-
/**
|
776 |
-
*
|
777 |
-
* Displays the Manual Order metabox.
|
778 |
-
*
|
779 |
-
* @author Andrew Charlton - original
|
780 |
-
* @author Peter van der Does - modifications
|
781 |
-
*/
|
782 |
-
function metaboxManualOrder ()
|
783 |
-
{
|
784 |
-
global $wpdb;
|
785 |
-
|
786 |
-
$parentID = 0;
|
787 |
-
|
788 |
-
if (isset($_POST['btnSubCats'])) {
|
789 |
-
$parentID = $_POST['cats'];
|
790 |
-
} elseif (isset($_POST['hdnParentID'])) {
|
791 |
-
$parentID = $_POST['hdnParentID'];
|
792 |
-
}
|
793 |
-
|
794 |
-
if (isset($_POST['btnReturnParent'])) {
|
795 |
-
$parentsParent = $wpdb->get_row($wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d", $_POST['hdnParentID']), ARRAY_N);
|
796 |
-
$parentID = $parentsParent[0];
|
797 |
-
}
|
798 |
-
|
799 |
-
$success = "";
|
800 |
-
if (isset($_POST['btnOrderCats'])) {
|
801 |
-
if (isset($_POST['hdnManualOrder']) && $_POST['hdnManualOrder'] != "") {
|
802 |
-
|
803 |
-
$manualOrder = $_POST['hdnManualOrder'];
|
804 |
-
$IDs = explode(",", $manualOrder);
|
805 |
-
$result = count($IDs);
|
806 |
-
|
807 |
-
for ($i = 0; $i < $result; $i ++) {
|
808 |
-
$str = str_replace("id_", "", $IDs[$i]);
|
809 |
-
$wpdb->query($wpdb->prepare("UPDATE $wpdb->terms SET avhec_term_order = %d WHERE term_id =%d", $i, $str));
|
810 |
-
}
|
811 |
-
|
812 |
-
$success = '<div id="message" class="updated fade"><p>' . __('Manual order of the categories successfully updated.', 'avh-ec') . '</p></div>';
|
813 |
-
} else {
|
814 |
-
$success = '<div id="message" class="updated fade"><p>' . __('An error occured, order has not been saved.', 'avh-ec') . '</p></div>';
|
815 |
-
}
|
816 |
-
|
817 |
-
}
|
818 |
-
|
819 |
-
$subCategories = "";
|
820 |
-
$results = $wpdb->get_results($wpdb->prepare("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = %d AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 0 ORDER BY t.avhec_term_order ASC", $parentID));
|
821 |
-
foreach ($results as $row) {
|
822 |
-
$subCategories .= "<option value='$row->term_id'>$row->name</option>";
|
823 |
-
}
|
824 |
-
|
825 |
-
echo '<div class="wrap">';
|
826 |
-
echo '<form name="frmMyCatOrder" method="post" action="">';
|
827 |
-
echo $success;
|
828 |
-
|
829 |
-
echo '<h4>';
|
830 |
-
_e('Order the categories', 'avh-ec');
|
831 |
-
if ($parentID == 0) {
|
832 |
-
echo ' at the Toplevel';
|
833 |
-
} else {
|
834 |
-
$categories = get_category_parents($parentID, false, ' » ');
|
835 |
-
echo ' in the category ' . trim($categories, ' » ');
|
836 |
-
}
|
837 |
-
echo '</h4>';
|
838 |
-
echo '<span class="description">';
|
839 |
-
_e('Order the categories on this level by dragging and dropping them into the desired order.', 'avh-ec');
|
840 |
-
echo '</span>';
|
841 |
-
echo '<ul id="avhecManualOrder">';
|
842 |
-
$results = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->terms t inner join $wpdb->term_taxonomy tt on t.term_id = tt.term_id WHERE taxonomy = 'category' and parent = %d ORDER BY avhec_term_order ASC", $parentID));
|
843 |
-
foreach ($results as $row)
|
844 |
-
echo "<li id='id_$row->term_id' class='lineitem menu-item-settings'>" . __($row->name) . "</li>";
|
845 |
-
|
846 |
-
echo '</ul>';
|
847 |
-
echo '<input type="submit" name="btnOrderCats" id="btnOrderCats" class="button-primary" value="' . __('Save Order', 'avh-ec') . '" onclick="javascript:orderCats(); return true;" />';
|
848 |
-
|
849 |
-
if ($parentID != 0) {
|
850 |
-
echo "<input type='submit' class='button' id='btnReturnParent' name='btnReturnParent' value='" . __('Return to parent category', 'avh-ec') . "' />";
|
851 |
-
}
|
852 |
-
|
853 |
-
echo '<strong id="updateText"></strong><br /><br />';
|
854 |
-
if ($subCategories != "") {
|
855 |
-
|
856 |
-
echo '<h4>';
|
857 |
-
_e('Select Subcategory', 'avh-ec');
|
858 |
-
echo '</h4>';
|
859 |
-
echo '<select id="cats" name="cats">';
|
860 |
-
echo $subCategories;
|
861 |
-
|
862 |
-
echo '</select><input type="submit" name="btnSubCats" class="button" id="btnSubCats" value="' . __('Select', 'avh-ec') . '" />';
|
863 |
-
echo '<span class="description">';
|
864 |
-
_e('Choose a category from the drop down to order the subcategories in that category.', 'avh-ec');
|
865 |
-
echo '</span>';
|
866 |
-
}
|
867 |
-
|
868 |
-
echo '<input type="hidden" id="hdnManualOrder" name="hdnManualOrder" />';
|
869 |
-
echo '<input type="hidden" id="hdnParentID" name="hdnParentID" value="' . $parentID . '" /></form>';
|
870 |
-
echo '</div>';
|
871 |
-
}
|
872 |
-
|
873 |
-
/**
|
874 |
-
* Setup everything needed for the FAQ page
|
875 |
-
*
|
876 |
-
*/
|
877 |
-
function actionLoadPageHook_faq ()
|
878 |
-
{
|
879 |
-
|
880 |
-
add_meta_box('avhecBoxFAQ', __('F.A.Q.', 'avh-ec'), array ( &$this, 'metaboxFAQ' ), $this->hooks['menu_faq'], 'normal', 'core');
|
881 |
-
add_meta_box('avhecBoxTranslation', __('Translation', 'avh-ec'), array ( &$this, 'metaboxTranslation' ), $this->hooks['menu_faq'], 'normal', 'core');
|
882 |
-
|
883 |
-
add_screen_option('layout_columns', array ( 'max' => 2, 'default' => 2 ));
|
884 |
-
|
885 |
-
// WordPress core Styles and Scripts
|
886 |
-
wp_enqueue_script('common');
|
887 |
-
wp_enqueue_script('wp-lists');
|
888 |
-
wp_enqueue_script('postbox');
|
889 |
-
|
890 |
-
// Plugin Style
|
891 |
-
wp_enqueue_style('avhec-admin-css');
|
892 |
-
|
893 |
-
}
|
894 |
-
|
895 |
-
/**
|
896 |
-
* Menu Page FAQ
|
897 |
-
*
|
898 |
-
* @return none
|
899 |
-
*/
|
900 |
-
function doMenuFAQ ()
|
901 |
-
{
|
902 |
-
global $screen_layout_columns;
|
903 |
-
|
904 |
-
// This box can't be unselectd in the the Screen Options
|
905 |
-
// add_meta_box('avhecBoxAnnouncements', __('Announcements', 'avh-ec'), array ( &$this, 'metaboxAnnouncements' ), $this->hooks['menu_faq'], 'side', 'core');
|
906 |
-
add_meta_box('avhecBoxDonations', __('Donations', 'avh-ec'), array ( &$this, 'metaboxDonations' ), $this->hooks['menu_faq'], 'side', 'core');
|
907 |
-
|
908 |
-
$hide2 = '';
|
909 |
-
switch ($screen_layout_columns) {
|
910 |
-
case 2:
|
911 |
-
$width = 'width:49%;';
|
912 |
-
break;
|
913 |
-
default:
|
914 |
-
$width = 'width:98%;';
|
915 |
-
$hide2 = 'display:none;';
|
916 |
-
}
|
917 |
-
|
918 |
-
echo '<div class="wrap avhec-metabox-wrap">';
|
919 |
-
echo $this->displayIcon('index');
|
920 |
-
echo '<h2>' . 'AVH Extended Categories - ' . __('F.A.Q', 'avh-ec') . '</h2>';
|
921 |
-
echo ' <div id="dashboard-widgets-wrap">';
|
922 |
-
echo ' <div id="dashboard-widgets" class="metabox-holder">';
|
923 |
-
echo ' <div class="postbox-container" style="' . $width . '">' . "\n";
|
924 |
-
do_meta_boxes($this->hooks['menu_faq'], 'normal', '');
|
925 |
-
echo ' </div>';
|
926 |
-
echo ' <div class="postbox-container" style="' . $hide2 . $width . '">' . "\n";
|
927 |
-
do_meta_boxes($this->hooks['menu_faq'], 'side', '');
|
928 |
-
echo ' </div>';
|
929 |
-
echo ' </div>';
|
930 |
-
echo '<br class="clear"/>';
|
931 |
-
echo ' </div>'; //dashboard-widgets-wrap
|
932 |
-
echo '</div>'; // wrap
|
933 |
-
|
934 |
-
|
935 |
-
$this->printMetaboxGeneralNonces();
|
936 |
-
$this->printMetaboxJS('faq');
|
937 |
-
$this->printAdminFooter();
|
938 |
-
}
|
939 |
-
|
940 |
-
/**
|
941 |
-
* Translation Metabox
|
942 |
-
* @return unknown_type
|
943 |
-
*/
|
944 |
-
function metaboxTranslation ()
|
945 |
-
{
|
946 |
-
$locale = apply_filters('plugin_locale', get_locale(), 'avh-ec');
|
947 |
-
$available_locale['cs_CZ'] = array ( 'Czech - Čeština', 0 );
|
948 |
-
$available_locale['nl_NL'] = array ( 'Dutch - Nederlands', 0 );
|
949 |
-
$available_locale['de_DE'] = array ( 'German - Deutsch', 0 );
|
950 |
-
$available_locale['el'] = array ( 'Greek - Čeština', 0 );
|
951 |
-
$available_locale['id_ID'] = array ( 'Indonesian - Bahasa Indonesia - Čeština', 0 );
|
952 |
-
$available_locale['it_IT'] = array ( 'Italian - Italiano', 1 );
|
953 |
-
$available_locale['ru_RU'] = array ( 'Russian — Русский', 0 );
|
954 |
-
$available_locale['es_ES'] = array ( 'Spanish - Español', 0 );
|
955 |
-
$available_locale['sv_SE'] = array ( 'Swedish - Svenska', 0 );
|
956 |
-
$available_locale['tr'] = array ( 'Turkish - Türkçe', 0 );
|
957 |
-
|
958 |
-
echo '<div class="p">';
|
959 |
-
echo __('This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language.', 'avh-ec') . '<br />';
|
960 |
-
|
961 |
-
echo '</div>';
|
962 |
-
|
963 |
-
echo '<div class="p">';
|
964 |
-
echo '<span class="b">' . __('Available Languages', 'avh-ec') . '</span>';
|
965 |
-
echo '<ul>';
|
966 |
-
foreach ($available_locale as $key => $value) {
|
967 |
-
echo '<li>';
|
968 |
-
$complete = ($value[1] == 1 ? 'Complete' : 'Incomplete');
|
969 |
-
echo $value[0] . ' (' . $key . ') - ' . $complete;
|
970 |
-
echo '</li>';
|
971 |
-
}
|
972 |
-
echo '</ul>';
|
973 |
-
echo '</div>';
|
974 |
-
|
975 |
-
echo '<div class="p">';
|
976 |
-
if ('en_US' != $locale & (! array_key_exists($locale, $available_locale))) {
|
977 |
-
echo 'Currently the plugin is not available in your language (' . $locale . '). We\'re in the middle of changing the way you can help with translations. Keep an eye on the <a href="http:///blog.avirtualhome.com">website</a> for the announcement.';
|
978 |
-
} else {
|
979 |
-
echo 'We\'re in the middle of changing the way you can help with translations. Keep an eye on the <a href="http:///blog.avirtualhome.com">website</a> for the announcement.';
|
980 |
-
}
|
981 |
-
echo '</div>';
|
982 |
-
|
983 |
-
}
|
984 |
-
|
985 |
-
/**
|
986 |
-
* Donation Metabox
|
987 |
-
* @return unknown_type
|
988 |
-
*/
|
989 |
-
function metaboxDonations ()
|
990 |
-
{
|
991 |
-
echo '<div class="p">';
|
992 |
-
echo __('If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation.', 'avh-ec');
|
993 |
-
echo '</div>';
|
994 |
-
|
995 |
-
echo '<div class="p">';
|
996 |
-
echo '<span class="b">Amazon</span><br />';
|
997 |
-
echo __('If you decide to buy something from Amazon click the button.', 'avh-ec') . '</span><br />';
|
998 |
-
echo '<a href="https://www.amazon.com/?tag=avh-donation-20" target="_blank" title="Amazon Homepage"><img alt="Amazon Button" src="' . $this->core->info['graphics_url'] . '/us_banner_logow_120x60.gif" /></a>';
|
999 |
-
echo '</div>';
|
1000 |
-
|
1001 |
-
echo '<div class="p">';
|
1002 |
-
echo __('You can send me something from my ', 'avh-ec') . '<a href="http://www.amazon.com/registry/wishlist/1U3DTWZ72PI7W?tag=avh-donation-20">' . __('Amazon Wish List', 'avh-ec') . '</a>';
|
1003 |
-
echo '</div>';
|
1004 |
-
|
1005 |
-
echo '<div class="p">';
|
1006 |
-
echo '<span class="b">' . __('Through Paypal.', 'avh-ec') . '</span><br />';
|
1007 |
-
echo __('Click on the Donate button and you will be directed to Paypal where you can make your donation and you don\'t need to have a Paypal account to make a donation.', 'avh-ec') . '<br />';
|
1008 |
-
echo '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=S85FXJ9EBHAF2&lc=US&item_name=AVH%20Plugins&item_number=fdas¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" target="_blank" title="Donate">';
|
1009 |
-
echo '<img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donate"/></a>';
|
1010 |
-
echo '</div>';
|
1011 |
-
|
1012 |
-
}
|
1013 |
-
|
1014 |
-
/***
|
1015 |
-
* F.A.Q Metabox
|
1016 |
-
* @return none
|
1017 |
-
*/
|
1018 |
-
function metaboxFAQ ()
|
1019 |
-
{
|
1020 |
-
echo '<div class="p">';
|
1021 |
-
echo '<span class="b">' . __('What about support?', 'avh-ec') . '</span><br />';
|
1022 |
-
echo __('I created a <a href="http://forums.avirtualhome.com" target="_blank">support site</a> where you can ask questions or request features.', 'avh-ec') . '<br />';
|
1023 |
-
echo '</div>';
|
1024 |
-
|
1025 |
-
echo '<div class="p">';
|
1026 |
-
echo '<span class="b">' . __('What is depth selection?', 'avh-ec') . '</span><br />';
|
1027 |
-
echo __('Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well.', 'avh-ec') . '<br /><br />';
|
1028 |
-
echo __('Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:', 'avh-ec') . '<br />';
|
1029 |
-
echo __('You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only.', 'avh-ec') . '<br />';
|
1030 |
-
echo '</div>';
|
1031 |
-
|
1032 |
-
echo '<div class="p">';
|
1033 |
-
echo '<span class="b">' . __('Multiple Category Groups', 'avh-ec') . '</span><br />';
|
1034 |
-
echo __('The following is an explanation how assigning multiple groups to page/post works.', 'avh-ec') . '<br /><br />';
|
1035 |
-
echo __('Lets say you have the following groups:', 'avh-ec');
|
1036 |
-
echo '<ul>';
|
1037 |
-
echo '<li>' . __('Free Time', 'avh-ec') . '</li>';
|
1038 |
-
echo '<li>' . __('Theater', 'avh-ec') . '</li>';
|
1039 |
-
echo '<li>' . __('Movie', 'avh-ec') . '</li>';
|
1040 |
-
echo '<li>' . __('Music', 'avh-ec') . '</li>';
|
1041 |
-
echo '</ul>';
|
1042 |
-
echo __('Setup several Category Group widgets and associated each widget with one or more groups.', 'avh-ec') . '<br />';
|
1043 |
-
echo __('Widget 1 has association with Free Time', 'avh-ec') . '<br />';
|
1044 |
-
echo __('Widget 2 has association with Theater, Movie and Music', 'avh-ec') . '<br />';
|
1045 |
-
echo __('Widget 3 has association with Theater, Movie and Music', 'avh-ec') . '<br /><br />';
|
1046 |
-
echo __('Page has associations the groups Free Time and Theater', 'avh-ec');
|
1047 |
-
echo '<ul>';
|
1048 |
-
echo '<li>' . __('Widget 1: Shows categories of the Free Time group', 'avh-ec') . '</li>';
|
1049 |
-
echo '<li>' . __('Widget 2: Shows categories of the Theater group.', 'avh-ec') . '</li>';
|
1050 |
-
echo '<li>' . __('Widget 3: Not displayed', 'avh-ec') . '</li>';
|
1051 |
-
echo '</ul>';
|
1052 |
-
echo __('Page has associations the group Movie.', 'avh-ec');
|
1053 |
-
echo '<ul>';
|
1054 |
-
echo '<li>' . __('Widget 1: Not displayed', 'avh-ec') . '</li>';
|
1055 |
-
echo '<li>' . __('Widget 2: Shows categories of the Movie group.', 'avh-ec') . '</li>';
|
1056 |
-
echo '<li>' . __('Widget 3: Not displayed', 'avh-ec') . '</li>';
|
1057 |
-
echo '</ul>';
|
1058 |
-
echo __('Page has associations the groups Free Time, Movie and Music', 'avh-ec');
|
1059 |
-
echo '<ul>';
|
1060 |
-
echo '<li>' . __('Widget 1: Shows categories of the Free Time group', 'avh-ec') . '</li>';
|
1061 |
-
echo '<li>' . __('Widget 2: Shows categories of the Movie or Music group.', 'avh-ec') . '</li>';
|
1062 |
-
echo '<li>' . __('Widget 3: Shows categories of the Music or Movie group.', 'avh-ec') . '</li>';
|
1063 |
-
echo '</ul>';
|
1064 |
-
echo __('Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie.', 'avh-ec') . '<br />';
|
1065 |
-
echo '</div>';
|
1066 |
-
}
|
1067 |
-
|
1068 |
-
function metaboxAnnouncements ()
|
1069 |
-
{
|
1070 |
-
$php5 = version_compare('5.2', phpversion(), '<');
|
1071 |
-
echo '<div class="p">';
|
1072 |
-
echo '<span class="b">' . __('PHP4 Support', 'avh-ec') . '</span><br />';
|
1073 |
-
echo __('The next major release of the plugin will no longer support PHP4.', 'avh-ec') . '<br />';
|
1074 |
-
echo __('It will be written for PHP 5.2 and ', 'avh-ec');
|
1075 |
-
if ($php5) {
|
1076 |
-
echo __('your blog already runs the needed PHP version. When the new release comes out you can safely update.', 'avh-ec') . '<br />';
|
1077 |
-
} else {
|
1078 |
-
echo __('your blog still runs PHP4. When the new release comes out you can not use it.', 'avh-ec') . '<br />';
|
1079 |
-
echo __('I don\'t have a timeline for the next version but consider contacting your host if PHP 5.2 is available.', 'avh-ec') . '<br />';
|
1080 |
-
echo __('If your hosts doesn\'t offer PHP 5.2 you might want to consider switching hosts.', 'avh-ec') . '<br />';
|
1081 |
-
echo __('A host to consider is ', 'avh-ec') . '<a href="http://www.lunarpages.com/id/pdoes" target="_blank">Lunarpages</a>';
|
1082 |
-
echo __('I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price.', 'avh-ec');
|
1083 |
-
}
|
1084 |
-
echo '</div>';
|
1085 |
-
|
1086 |
-
}
|
1087 |
-
|
1088 |
-
/**
|
1089 |
-
* Sets the amount of columns wanted for a particuler screen
|
1090 |
-
*
|
1091 |
-
* @WordPress filter screen_meta_screen
|
1092 |
-
* @param $screen
|
1093 |
-
* @return strings
|
1094 |
-
*/
|
1095 |
-
|
1096 |
-
function filterScreenLayoutColumns ($columns, $screen)
|
1097 |
-
{
|
1098 |
-
switch ($screen) {
|
1099 |
-
case $this->hooks['menu_overview']:
|
1100 |
-
$columns[$this->hooks['menu_overview']] = 2;
|
1101 |
-
break;
|
1102 |
-
case $this->hooks['menu_general']:
|
1103 |
-
$columns[$this->hooks['menu_general']] = 2;
|
1104 |
-
break;
|
1105 |
-
case $this->hooks['menu_category_groups']:
|
1106 |
-
$columns[$this->hooks['menu_category_groups']] = 2;
|
1107 |
-
break;
|
1108 |
-
case $this->hooks['menu_faq']:
|
1109 |
-
$columns[$this->hooks['menu_faq']] = 2;
|
1110 |
-
break;
|
1111 |
-
|
1112 |
-
}
|
1113 |
-
return $columns;
|
1114 |
-
}
|
1115 |
-
|
1116 |
-
/**
|
1117 |
-
* Adds Settings next to the plugin actions
|
1118 |
-
*
|
1119 |
-
* @WordPress Filter plugin_action_links_avh-amazon/avh-amazon.php
|
1120 |
-
*
|
1121 |
-
*/
|
1122 |
-
function filterPluginActions ($links, $file)
|
1123 |
-
{
|
1124 |
-
$settings_link = '<a href="admin.php?page=extended-categories-widget">' . __('Settings', 'avh-ec') . '</a>';
|
1125 |
-
array_unshift($links, $settings_link); // before other links
|
1126 |
-
return $links;
|
1127 |
-
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
/**
|
1131 |
-
* Creates a new array for columns headers. Used in print_column_headers. The filter is called from get_column_headers
|
1132 |
-
*
|
1133 |
-
* @param $columns
|
1134 |
-
* @return Array
|
1135 |
-
* @see print_column_headers, get_column_headers
|
1136 |
-
*/
|
1137 |
-
function filterManageCategoriesGroupColumns ($columns)
|
1138 |
-
{
|
1139 |
-
$categories_group_columns = array ( 'name' => __('Name', 'avh-ec'), 'slug' => __('Slug', 'avh-ec'), 'widget-title' => __('Widget Title', 'avh-ec'), 'description' => __('Description', 'avh-ec'), 'cat-in-group' => __('Categories in the group', 'avh-ec') );
|
1140 |
-
return $categories_group_columns;
|
1141 |
-
}
|
1142 |
-
|
1143 |
-
/**
|
1144 |
-
* When not using AJAX, this function is called when the deletion fails.
|
1145 |
-
*
|
1146 |
-
* @param string $text
|
1147 |
-
* @param int $group_id
|
1148 |
-
* @return string
|
1149 |
-
* @WordPress Filter explain_nonce_$verb-$noun
|
1150 |
-
* @see wp_explain_nonce
|
1151 |
-
*/
|
1152 |
-
function filterExplainNonceDeleteGroup ($text, $group_id)
|
1153 |
-
{
|
1154 |
-
$group = get_term($group_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
|
1155 |
-
|
1156 |
-
$return = sprintf(__('Your attempt to delete this group: “%s” has failed.'), $group->name);
|
1157 |
-
return ($return);
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
############## Admin WP Helper ##############
|
1161 |
-
|
1162 |
-
|
1163 |
-
/**
|
1164 |
-
* Get the backlink for forms
|
1165 |
-
*
|
1166 |
-
* @return strings
|
1167 |
-
*/
|
1168 |
-
function getBackLink ()
|
1169 |
-
{
|
1170 |
-
$page = basename(__FILE__);
|
1171 |
-
if (isset($_GET['page']) && ! empty($_GET['page'])) {
|
1172 |
-
$page = preg_replace('[^a-zA-Z0-9\.\_\-]', '', $_GET['page']);
|
1173 |
-
}
|
1174 |
-
|
1175 |
-
if (function_exists("admin_url"))
|
1176 |
-
return admin_url(basename($_SERVER["PHP_SELF"])) . "?page=" . $page;
|
1177 |
-
else
|
1178 |
-
return $_SERVER['PHP_SELF'] . "?page=" . $page;
|
1179 |
-
}
|
1180 |
-
|
1181 |
-
/**
|
1182 |
-
* Print all Category Group rows
|
1183 |
-
*
|
1184 |
-
* @uses printCategoryGroupRow
|
1185 |
-
*
|
1186 |
-
*/
|
1187 |
-
function printCategoryGroupRows ()
|
1188 |
-
{
|
1189 |
-
$cat_groups = get_terms($this->catgrp->taxonomy_name, array ( 'hide_empty' => FALSE ));
|
1190 |
-
|
1191 |
-
foreach ($cat_groups as $group) {
|
1192 |
-
if ('none' != $group->slug) {
|
1193 |
-
echo $this->printCategoryGroupRow($group->term_id, $group->term_taxonomy_id);
|
1194 |
-
}
|
1195 |
-
}
|
1196 |
-
}
|
1197 |
-
|
1198 |
-
/**
|
1199 |
-
* Displays all the information of a group in a row
|
1200 |
-
* Adds inline link for delete and/or edit.
|
1201 |
-
*
|
1202 |
-
* @param int $group_term_id
|
1203 |
-
* @param int $group_term_taxonomy_id
|
1204 |
-
*/
|
1205 |
-
function printCategoryGroupRow ($group_term_id, $group_term_taxonomy_id)
|
1206 |
-
{
|
1207 |
-
static $row_class = '';
|
1208 |
-
|
1209 |
-
$group = get_term($group_term_id, $this->catgrp->taxonomy_name, OBJECT, 'display');
|
1210 |
-
|
1211 |
-
$no_edit[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
|
1212 |
-
$no_delete[$this->catgrp->getTermIDBy('slug', 'all')] = 0;
|
1213 |
-
|
1214 |
-
if (current_user_can('manage_categories')) {
|
1215 |
-
$actions = array ();
|
1216 |
-
if (! array_key_exists($group->term_id, $no_edit)) {
|
1217 |
-
$edit_link = "admin.php?page=avhec-grouped&action=edit&group_ID=$group->term_id";
|
1218 |
-
$edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit “%s”'), $group->name)) . "'>" . esc_attr($group->name) . '</a><br />';
|
1219 |
-
|
1220 |
-
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
|
1221 |
-
} else {
|
1222 |
-
$edit = esc_attr($group->name);
|
1223 |
-
}
|
1224 |
-
if (! (array_key_exists($group->term_id, $no_delete))) {
|
1225 |
-
$actions['delete'] = "<a class='delete:the-list:group-$group->term_id submitdelete' href='" . wp_nonce_url("admin.php?page=avhec-grouped&action=delete&group_ID=$group->term_id", 'delete-avhecgroup_' . $group->term_id) . "'>" . __('Delete') . "</a>";
|
1226 |
-
}
|
1227 |
-
$action_count = count($actions);
|
1228 |
-
$i = 0;
|
1229 |
-
$edit .= '<div class="row-actions">';
|
1230 |
-
foreach ($actions as $action => $link) {
|
1231 |
-
++ $i;
|
1232 |
-
($i == $action_count) ? $sep = '' : $sep = ' | ';
|
1233 |
-
$edit .= "<span class='$action'>$link$sep</span>";
|
1234 |
-
}
|
1235 |
-
$edit .= '</div>';
|
1236 |
-
} else {
|
1237 |
-
$edit = $group->name;
|
1238 |
-
}
|
1239 |
-
|
1240 |
-
$row_class = 'alternate' == $row_class ? '' : 'alternate';
|
1241 |
-
$qe_data = get_term($group->term_id, $this->catgrp->taxonomy_name, OBJECT, 'edit');
|
1242 |
-
|
1243 |
-
$output = "<tr id='group-$group->term_id' class='iedit $row_class'>";
|
1244 |
-
|
1245 |
-
$columns = get_column_headers('categories_group');
|
1246 |
-
$hidden = get_hidden_columns('categories_group');
|
1247 |
-
foreach ($columns as $column_name => $column_display_name) {
|
1248 |
-
$class = 'class="' . $column_name . ' column-' . $column_name . '"';
|
1249 |
-
|
1250 |
-
$style = '';
|
1251 |
-
if (in_array($column_name, $hidden))
|
1252 |
-
$style = ' style="display:none;"';
|
1253 |
-
|
1254 |
-
$attributes = $class . $style;
|
1255 |
-
|
1256 |
-
switch ($column_name) {
|
1257 |
-
case 'cb':
|
1258 |
-
$output .= '<th scope="row" class="check-column">';
|
1259 |
-
if (! (array_key_exists($group->term_id, $no_delete))) {
|
1260 |
-
$output .= '<input type="checkbox" name="delete[]" value="' . $group->term_id . '" />';
|
1261 |
-
} else {
|
1262 |
-
$output .= " ";
|
1263 |
-
}
|
1264 |
-
$output .= '</th>';
|
1265 |
-
break;
|
1266 |
-
case 'name':
|
1267 |
-
$output .= '<td ' . $attributes . '>' . $edit;
|
1268 |
-
$output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
|
1269 |
-
$output .= '<div class="name">' . $qe_data->name . '</div>';
|
1270 |
-
$output .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
|
1271 |
-
$output .= '</div></td>';
|
1272 |
-
break;
|
1273 |
-
case 'widget-title':
|
1274 |
-
$title = $this->catgrp->getWidgetTitleForGroup($group->term_id);
|
1275 |
-
if (! $title) {
|
1276 |
-
$title = " ";
|
1277 |
-
}
|
1278 |
-
$output .= '<td ' . $attributes . '>' . $title . '</td>';
|
1279 |
-
break;
|
1280 |
-
|
1281 |
-
case 'description':
|
1282 |
-
$output .= '<td ' . $attributes . '>' . $qe_data->description . '</td>';
|
1283 |
-
break;
|
1284 |
-
case 'slug':
|
1285 |
-
$output .= "<td $attributes>" . apply_filters('editable_slug', $qe_data->slug) . "</td>";
|
1286 |
-
break;
|
1287 |
-
case 'cat-in-group':
|
1288 |
-
$cats = $this->catgrp->getCategoriesFromGroup($group_term_id);
|
1289 |
-
$catname = array ();
|
1290 |
-
foreach ($cats as $cat_id) {
|
1291 |
-
$catname[] = get_cat_name($cat_id);
|
1292 |
-
}
|
1293 |
-
natsort($catname);
|
1294 |
-
$cat = implode(', ', $catname);
|
1295 |
-
$output .= '<td ' . $attributes . '>' . $cat . '</td>';
|
1296 |
-
break;
|
1297 |
-
|
1298 |
-
}
|
1299 |
-
}
|
1300 |
-
$output .= '</tr>';
|
1301 |
-
|
1302 |
-
return $output;
|
1303 |
-
}
|
1304 |
-
|
1305 |
-
/**
|
1306 |
-
* Prints the general nonces, used by the AJAX
|
1307 |
-
*/
|
1308 |
-
function printMetaboxGeneralNonces ()
|
1309 |
-
{
|
1310 |
-
echo '<form style="display:none" method="get" action="">';
|
1311 |
-
echo '<p>';
|
1312 |
-
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
|
1313 |
-
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
|
1314 |
-
echo '</p>';
|
1315 |
-
echo '</form>';
|
1316 |
-
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
/**
|
1320 |
-
* Print the Metabox JS for toggling closed and open
|
1321 |
-
*
|
1322 |
-
* @param $boxid
|
1323 |
-
*/
|
1324 |
-
function printMetaboxJS ($boxid)
|
1325 |
-
{
|
1326 |
-
$a = $this->hooks['menu_' . $boxid];
|
1327 |
-
echo '<script type="text/javascript">' . "\n";
|
1328 |
-
echo ' //<![CDATA[' . "\n";
|
1329 |
-
echo ' jQuery(document).ready( function($) {' . "\n";
|
1330 |
-
echo ' $(\'.if-js-closed\').removeClass(\'if-js-closed\').addClass(\'closed\');' . "\n";
|
1331 |
-
echo ' // postboxes setup' . "\n";
|
1332 |
-
echo ' postboxes.add_postbox_toggles(\'' . $a . '\');' . "\n";
|
1333 |
-
echo ' });' . "\n";
|
1334 |
-
echo ' //]]>' . "\n";
|
1335 |
-
echo '</script>';
|
1336 |
-
|
1337 |
-
}
|
1338 |
-
|
1339 |
-
/**
|
1340 |
-
* Display plugin Copyright
|
1341 |
-
*
|
1342 |
-
*/
|
1343 |
-
function printAdminFooter ()
|
1344 |
-
{
|
1345 |
-
echo '<p class="footer_avhec">';
|
1346 |
-
printf('© Copyright %d <a href="http://blog.avirtualhome.com/" title="My Thoughts">Peter van der Does</a> | AVH Extended Categories Version %s', date('Y'), $this->core->version);
|
1347 |
-
echo '</p>';
|
1348 |
-
}
|
1349 |
-
|
1350 |
-
/**
|
1351 |
-
* Display WP alert
|
1352 |
-
*
|
1353 |
-
*/
|
1354 |
-
function displayMessage ()
|
1355 |
-
{
|
1356 |
-
if ($this->message != '') {
|
1357 |
-
$message = $this->message;
|
1358 |
-
$status = $this->status;
|
1359 |
-
$this->message = $this->status = ''; // Reset
|
1360 |
-
}
|
1361 |
-
if (isset($message)) {
|
1362 |
-
$status = ($status != '') ? $status : 'updated fade';
|
1363 |
-
echo '<div id="message" class="' . $status . '">';
|
1364 |
-
echo '<p><strong>' . $message . '</strong></p></div>';
|
1365 |
-
}
|
1366 |
-
}
|
1367 |
-
|
1368 |
-
/**
|
1369 |
-
* Ouput formatted options
|
1370 |
-
*
|
1371 |
-
* @param array $option_data
|
1372 |
-
* @return string
|
1373 |
-
*/
|
1374 |
-
function printOptions ($option_data, $option_actual)
|
1375 |
-
{
|
1376 |
-
// Generate output
|
1377 |
-
$output = '';
|
1378 |
-
$output .= "\n" . '<table class="form-table avhec-options">' . "\n";
|
1379 |
-
foreach ($option_data as $option) {
|
1380 |
-
$section = substr($option[0], strpos($option[0], '[') + 1);
|
1381 |
-
$section = substr($section, 0, strpos($section, ']['));
|
1382 |
-
$option_key = rtrim($option[0], ']');
|
1383 |
-
$option_key = substr($option_key, strpos($option_key, '][') + 2);
|
1384 |
-
// Helper
|
1385 |
-
if ($option[2] == 'helper') {
|
1386 |
-
$output .= '<tr style="vertical-align: top;"><td class="helper" colspan="2">' . wp_filter_post_kses($option[4]) . '</td></tr>' . "\n";
|
1387 |
-
continue;
|
1388 |
-
}
|
1389 |
-
switch ($option[2]) {
|
1390 |
-
case 'checkbox':
|
1391 |
-
$input_type = '<input type="checkbox" id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option[3]) . '" ' . $this->isChecked('1', $option_actual[$section][$option_key]) . ' />' . "\n";
|
1392 |
-
$explanation = $option[4];
|
1393 |
-
break;
|
1394 |
-
case 'dropdown':
|
1395 |
-
$selvalue = $option[3];
|
1396 |
-
$seltext = $option[4];
|
1397 |
-
$seldata = '';
|
1398 |
-
foreach ((array) $selvalue as $key => $sel) {
|
1399 |
-
$seldata .= '<option value="' . esc_attr($sel) . '" ' . (($option_actual[$section][$option_key] == $sel) ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($seltext[$key])) . '</option>' . "\n";
|
1400 |
-
}
|
1401 |
-
$input_type = '<select id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '">' . $seldata . '</select>' . "\n";
|
1402 |
-
$explanation = $option[5];
|
1403 |
-
break;
|
1404 |
-
case 'text-color':
|
1405 |
-
$input_type = '<input type="text" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" /><div class="box_color ' . esc_attr($option[0]) . '"></div>' . "\n";
|
1406 |
-
$explanation = $option[4];
|
1407 |
-
break;
|
1408 |
-
case 'textarea':
|
1409 |
-
$input_type = '<textarea rows="' . esc_attr($option[5]) . '" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" size="' . esc_attr($option[3]) . '" />' . $option_actual[$section][$option_key] . '</textarea>';
|
1410 |
-
$explanation = $option[4];
|
1411 |
-
break;
|
1412 |
-
case 'catlist':
|
1413 |
-
ob_start();
|
1414 |
-
echo '<div id="avhec-catlist">';
|
1415 |
-
echo '<ul>';
|
1416 |
-
wp_category_checklist(0, 0, $option_actual[$section][$option_key]);
|
1417 |
-
echo '</ul>';
|
1418 |
-
echo '</div>';
|
1419 |
-
$input_type = ob_get_contents();
|
1420 |
-
ob_end_clean();
|
1421 |
-
$explanation = $option[4];
|
1422 |
-
break;
|
1423 |
-
case 'text':
|
1424 |
-
default:
|
1425 |
-
$input_type = '<input type="text" ' . (($option[3] > 1) ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" />' . "\n";
|
1426 |
-
$explanation = $option[4];
|
1427 |
-
break;
|
1428 |
-
}
|
1429 |
-
// Additional Information
|
1430 |
-
$extra = '';
|
1431 |
-
if ($explanation) {
|
1432 |
-
$extra = '<br /><span class="description">' . wp_filter_kses($explanation) . '</span>' . "\n";
|
1433 |
-
}
|
1434 |
-
// Output
|
1435 |
-
$output .= '<tr style="vertical-align: top;"><th align="left" scope="row"><label for="' . esc_attr($option[0]) . '">' . wp_filter_kses($option[1]) . '</label></th><td>' . $input_type . ' ' . $extra . '</td></tr>' . "\n";
|
1436 |
-
}
|
1437 |
-
$output .= '</table>' . "\n";
|
1438 |
-
return $output;
|
1439 |
-
}
|
1440 |
-
|
1441 |
-
/**
|
1442 |
-
* Used in forms to set an option checked
|
1443 |
-
*
|
1444 |
-
* @param mixed $checked
|
1445 |
-
* @param mixed $current
|
1446 |
-
* @return strings
|
1447 |
-
*/
|
1448 |
-
function isChecked ($checked, $current)
|
1449 |
-
{
|
1450 |
-
$return = '';
|
1451 |
-
if ($checked == $current) {
|
1452 |
-
$return = ' checked="checked"';
|
1453 |
-
}
|
1454 |
-
return $return;
|
1455 |
-
}
|
1456 |
-
|
1457 |
-
/**
|
1458 |
-
* Displays the icon on the menu pages
|
1459 |
-
*
|
1460 |
-
* @param $icon
|
1461 |
-
*/
|
1462 |
-
function displayIcon ($icon)
|
1463 |
-
{
|
1464 |
-
return ('<div class="icon32" id="icon-' . $icon . '"><br/></div>');
|
1465 |
-
}
|
1466 |
-
|
1467 |
-
/**
|
1468 |
-
* Ajax Helper: inline delete of the groups
|
1469 |
-
*/
|
1470 |
-
function ajaxDeleteGroup ()
|
1471 |
-
{
|
1472 |
-
$group_id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
|
1473 |
-
check_ajax_referer('delete-avhecgroup_' . $group_id);
|
1474 |
-
|
1475 |
-
if (! current_user_can('manage_categories')) {
|
1476 |
-
die('-1');
|
1477 |
-
}
|
1478 |
-
$check = $this->catgrp->getGroup($group_id);
|
1479 |
-
if (false === $check) {
|
1480 |
-
die('1');
|
1481 |
-
}
|
1482 |
-
|
1483 |
-
if ($this->catgrp->doDeleteGroup($group_id)) {
|
1484 |
-
die('1');
|
1485 |
-
} else {
|
1486 |
-
die('0');
|
1487 |
-
}
|
1488 |
-
}
|
1489 |
-
}
|
1490 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/class/avh-ec.category-group.php
DELETED
@@ -1,411 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* AVH Extended Categorie Category Group Class
|
5 |
-
*
|
6 |
-
* @author Peter van der Does
|
7 |
-
*/
|
8 |
-
class AVH_EC_Category_Group
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* Taxonomy name
|
12 |
-
* @var string
|
13 |
-
*/
|
14 |
-
var $taxonomy_name;
|
15 |
-
|
16 |
-
var $db_options_widget_titles;
|
17 |
-
|
18 |
-
var $options_widget_titles;
|
19 |
-
|
20 |
-
var $widget_done_catgroup;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* PHP4 constructor.
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
function AVH_EC_Category_Group ()
|
27 |
-
{
|
28 |
-
return $this->__construct();
|
29 |
-
}
|
30 |
-
|
31 |
-
/**
|
32 |
-
* PHP5 Constructor
|
33 |
-
* Init the Database Abstraction layer
|
34 |
-
*
|
35 |
-
*/
|
36 |
-
function __construct ()
|
37 |
-
{
|
38 |
-
global $wpdb;
|
39 |
-
|
40 |
-
register_shutdown_function(array ( &$this, '__destruct' ));
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Taxonomy name
|
44 |
-
* @var string
|
45 |
-
*/
|
46 |
-
$this->taxonomy_name = 'avhec_catgroup';
|
47 |
-
|
48 |
-
$this->db_options_widget_titles = 'avhec_widget_titles';
|
49 |
-
// add DB pointer
|
50 |
-
$wpdb->avhec_cat_group = $wpdb->prefix . 'avhec_category_groups';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Create the table if it doesn't exist.
|
54 |
-
*
|
55 |
-
*/
|
56 |
-
if ($wpdb->get_var('show tables like \'' . $wpdb->avhec_cat_group . '\'') != $wpdb->avhec_cat_group) {
|
57 |
-
add_action('init', array ( &$this, 'doCreateTable' ), 2); // Priority needs to be the same as the Register Taxonomy
|
58 |
-
}
|
59 |
-
add_action('init', array ( &$this, 'doRegisterTaxonomy' ), 2); // Priority for registering custom taxonomies is +1 over the creation of the initial taxonomies
|
60 |
-
add_action('init', array ( &$this, 'doSetupOptions' ));
|
61 |
-
|
62 |
-
add_action('admin_init', array ( &$this, 'addMetaBoxes' ));
|
63 |
-
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* PHP5 style destructor and will run when database object is destroyed.
|
68 |
-
*
|
69 |
-
* @return bool Always true
|
70 |
-
*/
|
71 |
-
function __destruct ()
|
72 |
-
{
|
73 |
-
return true;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Create Table
|
78 |
-
* @WordPress action init
|
79 |
-
*
|
80 |
-
*/
|
81 |
-
function doCreateTable ()
|
82 |
-
{
|
83 |
-
global $wpdb;
|
84 |
-
|
85 |
-
// Setup the DB Tables
|
86 |
-
$charset_collate = '';
|
87 |
-
|
88 |
-
if (! empty($wpdb->charset)) {
|
89 |
-
$charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
|
90 |
-
}
|
91 |
-
if (! empty($wpdb->collate)) {
|
92 |
-
$charset_collate .= ' COLLATE ' . $wpdb->collate;
|
93 |
-
}
|
94 |
-
|
95 |
-
$sql = 'CREATE TABLE `' . $wpdb->avhec_cat_group . '` ( `group_term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `term_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`group_term_id`, `term_id`) )' . $charset_collate . ';';
|
96 |
-
|
97 |
-
$result = $wpdb->query($sql);
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Setup Group Categories Taxonomy
|
102 |
-
* @WordPress action init
|
103 |
-
*
|
104 |
-
*/
|
105 |
-
function doRegisterTaxonomy ()
|
106 |
-
{
|
107 |
-
/**
|
108 |
-
* As we don't want to see the Menu Item we have to disable show_ui. This also disables the metabox on the posts and pages, so we add thse manually instead.
|
109 |
-
* We remove the capabilities to manage, edit and delete the terms. We have written this part ourselves and don't use WordPress for these functions. The only one we use is the assign_terms.
|
110 |
-
*/
|
111 |
-
$labels = array ( 'name' => __('Category Groups', 'avh-ec'), 'singular_name' => __('Category Group', 'avh-ec'), 'search_items' => __('Search Category Groups', 'avh-ec'), 'popular_items' => __('Popular Category Groups'), 'all_items' => __('All Category Groups'), 'parent_item' => __('Parent Category Group'), 'parent_item_colon' => __('Parent Category Group:'), 'edit_item' => __('Edit Category Group'), 'update_item' => __('Update Category Group'), 'add_new_item' => __('Add New Category Group'), 'new_item_name' => __('New Category Group Name') );
|
112 |
-
$caps = array ( 'manage_terms' => null, 'edit_terms' => null, 'delete_terms' => null, 'assign_terms' => 'edit_posts' );
|
113 |
-
register_taxonomy($this->taxonomy_name, array ( 'post', 'page' ), array ( 'hierarchical' => TRUE, 'labels' => $labels, 'query_var' => TRUE, 'rewrite' => TRUE, 'show_in_nav_menus' => FALSE, 'public' => TRUE, 'show_ui' => FALSE, 'capabilities' => $caps ));
|
114 |
-
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Setup the options for the widget titles
|
119 |
-
* @WordPress action init
|
120 |
-
*
|
121 |
-
*/
|
122 |
-
function doSetupOptions ()
|
123 |
-
{
|
124 |
-
// Setup the standard groups if the none group does not exists.
|
125 |
-
$all_categories = $this->getAllCategoriesTermID();
|
126 |
-
if (false === $this->getTermIDBy('slug', 'none')) {
|
127 |
-
$none_group_id = wp_insert_term('none', $this->taxonomy_name, array ( 'description' => __('This group will not show the widget.', 'avh-ec') ));
|
128 |
-
$all_group_id = wp_insert_term('All', $this->taxonomy_name, array ( 'description' => __('Holds all the categories.', 'avh-ec') ));
|
129 |
-
$home_group_id = wp_insert_term('Home', $this->taxonomy_name, array ( 'description' => __('This group will be shown on the front page.', 'avh-ec') ));
|
130 |
-
|
131 |
-
// Fill the standard groups with all categories
|
132 |
-
$this->setCategoriesForGroup($home_group_id['term_id'], $all_categories);
|
133 |
-
$this->setWidgetTitleForGroup($all_group_id['term_id'], '');
|
134 |
-
$this->setWidgetTitleForGroup($home_group_id['term_id'], '');
|
135 |
-
}
|
136 |
-
|
137 |
-
$options = get_option($this->db_options_widget_titles);
|
138 |
-
if (! $options) {
|
139 |
-
$options = array ();
|
140 |
-
$id = $this->getTermIDBy('slug', 'all');
|
141 |
-
$options[$id] = '';
|
142 |
-
$id = $this->getTermIDBy('slug', 'home');
|
143 |
-
$options[$id] = '';
|
144 |
-
update_option($this->db_options_widget_titles, $options);
|
145 |
-
}
|
146 |
-
$this->options_widget_titles = $options;
|
147 |
-
$this->setCategoriesForGroup($this->getTermIDBy('slug', 'all'), $all_categories);
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Add the metaboxes for the pots and page pages.
|
152 |
-
* @WordPress action admin_init
|
153 |
-
*
|
154 |
-
*/
|
155 |
-
function addMetaBoxes ()
|
156 |
-
{
|
157 |
-
add_meta_box($this->taxonomy_name . 'div', __('Category Groups', 'avh-ec'), 'post_categories_meta_box', 'post', 'side', 'core', array ( 'taxonomy' => $this->taxonomy_name ));
|
158 |
-
add_meta_box($this->taxonomy_name . 'div', __('Category Groups', 'avh-ec'), 'post_categories_meta_box', 'page', 'side', 'core', array ( 'taxonomy' => $this->taxonomy_name ));
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Get all groups term_id
|
163 |
-
*
|
164 |
-
* @return array Term_id
|
165 |
-
*/
|
166 |
-
function getAllCategoriesTermID ()
|
167 |
-
{
|
168 |
-
$all_cat_id = array ();
|
169 |
-
$categories = get_categories();
|
170 |
-
if (! is_wp_error($categories)) {
|
171 |
-
foreach ($categories as $category) {
|
172 |
-
$all_cat_id[] = $category->term_id;
|
173 |
-
}
|
174 |
-
}
|
175 |
-
return ($all_cat_id);
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Get the categories from the given group from the DB
|
180 |
-
*
|
181 |
-
* @param int $group_id The Taxonomy Term ID
|
182 |
-
* @return Array|False categories. Will return FALSE, if the row does not exists.
|
183 |
-
*
|
184 |
-
*/
|
185 |
-
function getCategoriesFromGroup ($group_id)
|
186 |
-
{
|
187 |
-
global $wpdb;
|
188 |
-
|
189 |
-
// Query database
|
190 |
-
$result = $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->terms . ' t, ' . $wpdb->avhec_cat_group . ' cg WHERE t.term_id = cg.term_id AND cg.group_term_id = %d', $group_id));
|
191 |
-
|
192 |
-
if (is_array($result)) { // Call succeeded
|
193 |
-
if (empty($result)) { // No rows found
|
194 |
-
$return = array ();
|
195 |
-
} else {
|
196 |
-
foreach ($result as $row) {
|
197 |
-
$return[] = $row->term_id;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
} else {
|
201 |
-
$return = false;
|
202 |
-
}
|
203 |
-
return ($return);
|
204 |
-
}
|
205 |
-
|
206 |
-
/**
|
207 |
-
* Set the categories for the given group from the DB. Insert the group if it doesn't exists.
|
208 |
-
*
|
209 |
-
* @param int $group_id The Taxonomy Term ID
|
210 |
-
* @param array $categories The categories
|
211 |
-
* @return Object (false if not found)
|
212 |
-
*
|
213 |
-
*/
|
214 |
-
function setCategoriesForGroup ($group_id, $categories = array())
|
215 |
-
{
|
216 |
-
global $wpdb;
|
217 |
-
|
218 |
-
$old_categories = $this->getCategoriesFromGroup($group_id);
|
219 |
-
|
220 |
-
if (! is_array($categories)) {
|
221 |
-
$categories = array ();
|
222 |
-
}
|
223 |
-
$new_categories = $categories;
|
224 |
-
sort($old_categories);
|
225 |
-
sort($new_categories);
|
226 |
-
// If the new and old values are the same, no need to update.
|
227 |
-
if ($new_categories === $old_categories) {
|
228 |
-
return false;
|
229 |
-
}
|
230 |
-
|
231 |
-
$new = array_diff($new_categories, $old_categories);
|
232 |
-
$removed = array_diff($old_categories, $new_categories);
|
233 |
-
|
234 |
-
if (! empty($new)) {
|
235 |
-
foreach ($new as $cat_term_id) {
|
236 |
-
$insert[] = '(' . $group_id . ',' . $cat_term_id . ')';
|
237 |
-
}
|
238 |
-
$value = implode(',', $insert);
|
239 |
-
$sql = 'INSERT INTO ' . $wpdb->avhec_cat_group . ' (group_term_id, term_id) VALUES ' . $value;
|
240 |
-
$result = $wpdb->query($sql);
|
241 |
-
|
242 |
-
}
|
243 |
-
|
244 |
-
if (! empty($removed)) {
|
245 |
-
$delete = implode(',', $removed);
|
246 |
-
$sql = $wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d and term_id IN (' . $delete . ')', $group_id);
|
247 |
-
$result = $wpdb->query($sql);
|
248 |
-
|
249 |
-
}
|
250 |
-
|
251 |
-
return $result;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Set the Widget Title for a Group
|
256 |
-
* @param int $group_id
|
257 |
-
* @param string $widget_title
|
258 |
-
*
|
259 |
-
*/
|
260 |
-
function setWidgetTitleForGroup ($group_id, $widget_title = '')
|
261 |
-
{
|
262 |
-
$this->options_widget_titles[$group_id] = $widget_title;
|
263 |
-
update_option($this->db_options_widget_titles, $this->options_widget_titles);
|
264 |
-
}
|
265 |
-
|
266 |
-
/**
|
267 |
-
* Return the title for a group_id if exsist otherwise return false
|
268 |
-
* @param $group_id
|
269 |
-
*
|
270 |
-
*/
|
271 |
-
function getWidgetTitleForGroup ($group_id)
|
272 |
-
{
|
273 |
-
if (isset($this->options_widget_titles[$group_id])) {
|
274 |
-
return ($this->options_widget_titles[$group_id]);
|
275 |
-
}
|
276 |
-
return false;
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Delete the Widget Title for a group
|
281 |
-
*
|
282 |
-
* @param $group_id
|
283 |
-
*/
|
284 |
-
function doDeleteWidgetTitle ($group_id)
|
285 |
-
{
|
286 |
-
if (isset($this->options_widget_titles[$group_id])) {
|
287 |
-
unset($this->options_widget_titles[$group_id]);
|
288 |
-
}
|
289 |
-
update_option($this->db_options_widget_titles, $this->options_widget_titles);
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Same as get_term_by, but returns the ID only if found, else false
|
294 |
-
* @param string $field
|
295 |
-
* @param string $value
|
296 |
-
* @return int|boolean
|
297 |
-
*/
|
298 |
-
function getTermIDBy ($field, $value)
|
299 |
-
{
|
300 |
-
$row = get_term_by($field, $value, $this->taxonomy_name);
|
301 |
-
if (false === $row) {
|
302 |
-
$return = false;
|
303 |
-
} else {
|
304 |
-
$return = (int) $row->term_id;
|
305 |
-
}
|
306 |
-
return ($return);
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Gets all information of a group
|
311 |
-
*
|
312 |
-
* @param $group_id
|
313 |
-
* @return Object|False Returns False when the group doesn't exists.
|
314 |
-
*/
|
315 |
-
function getGroup ($group_id)
|
316 |
-
{
|
317 |
-
global $wpdb;
|
318 |
-
|
319 |
-
$result = get_term((int) $group_id, $this->taxonomy_name);
|
320 |
-
if (null === $result) {
|
321 |
-
$result = false;
|
322 |
-
}
|
323 |
-
return ($result);
|
324 |
-
}
|
325 |
-
|
326 |
-
function getGroupByCategoryID ($category_id)
|
327 |
-
{
|
328 |
-
$return = get_term_by('slug', 'none', $this->taxonomy_name);
|
329 |
-
$cat_groups = get_terms($this->taxonomy_name, array ( 'hide_empty' => FALSE ));
|
330 |
-
|
331 |
-
foreach ($cat_groups as $group) {
|
332 |
-
$cats = $this->getCategoriesFromGroup($group->term_id);
|
333 |
-
if ($group->slug != 'all' && in_array($category_id, $cats)) {
|
334 |
-
$return = $group;
|
335 |
-
break;
|
336 |
-
}
|
337 |
-
}
|
338 |
-
return $return;
|
339 |
-
}
|
340 |
-
|
341 |
-
/**
|
342 |
-
* Inserts a new group
|
343 |
-
*
|
344 |
-
* @param $term
|
345 |
-
* @param array $args
|
346 |
-
*/
|
347 |
-
function doInsertGroup ($term, $args = array(), $widget_title = '')
|
348 |
-
{
|
349 |
-
$row = wp_insert_term($term, $this->taxonomy_name, $args);
|
350 |
-
$this->setWidgetTitleForGroup($term, $widget_title);
|
351 |
-
return ($row['term_id']);
|
352 |
-
}
|
353 |
-
|
354 |
-
/**
|
355 |
-
* Deletes a group
|
356 |
-
*
|
357 |
-
* @param $group_id
|
358 |
-
*/
|
359 |
-
function doDeleteGroup ($group_id)
|
360 |
-
{
|
361 |
-
|
362 |
-
global $wpdb;
|
363 |
-
|
364 |
-
$group = $this->getGroup($group_id);
|
365 |
-
$result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE group_term_id=%d', $group_id));
|
366 |
-
$this->doDeleteWidgetTitle($group_id);
|
367 |
-
$return = wp_delete_term($group->term_id, $this->taxonomy_name);
|
368 |
-
|
369 |
-
return ($return);
|
370 |
-
}
|
371 |
-
|
372 |
-
/**
|
373 |
-
* Update a group
|
374 |
-
*
|
375 |
-
* @param $group_id
|
376 |
-
* @param $selected_categories
|
377 |
-
* @param $widget_title
|
378 |
-
*
|
379 |
-
* return -1,0,1 Unknown Group, Duplicate Slug, Succesfull
|
380 |
-
*/
|
381 |
-
function doUpdateGroup ($group_id, $args = array(), $selected_categories, $widget_title = '')
|
382 |
-
{
|
383 |
-
|
384 |
-
$group = $this->getGroup($group_id);
|
385 |
-
if (is_object($group)) {
|
386 |
-
$id = wp_update_term($group->term_id, $this->taxonomy_name, $args);
|
387 |
-
if (! is_wp_error($id)) {
|
388 |
-
$this->setWidgetTitleForGroup($group_id, $widget_title);
|
389 |
-
$this->setCategoriesForGroup($group_id, $selected_categories);
|
390 |
-
$return = 1; // Succesful
|
391 |
-
} else {
|
392 |
-
$return = 0; // Duplicate Slug
|
393 |
-
}
|
394 |
-
} else {
|
395 |
-
$return = - 1; // Unknown group
|
396 |
-
}
|
397 |
-
return ($return);
|
398 |
-
}
|
399 |
-
|
400 |
-
/**
|
401 |
-
* Deletes the given category from all groups
|
402 |
-
*
|
403 |
-
* @param $category_id
|
404 |
-
*/
|
405 |
-
function doDeleteCategoryFromGroup ($category_id)
|
406 |
-
{
|
407 |
-
global $wpdb;
|
408 |
-
$result = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->avhec_cat_group . ' WHERE term_id=%d', $category_id));
|
409 |
-
}
|
410 |
-
}
|
411 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/class/avh-ec.core.php
DELETED
@@ -1,759 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class AVH_EC_Core
|
4 |
-
{
|
5 |
-
var $version;
|
6 |
-
var $comment;
|
7 |
-
var $info;
|
8 |
-
var $db_options_core;
|
9 |
-
var $default_options;
|
10 |
-
var $default_options_general;
|
11 |
-
var $default_options_category_group;
|
12 |
-
var $default_options_sp_category_group;
|
13 |
-
|
14 |
-
var $db_options_tax_meta;
|
15 |
-
|
16 |
-
var $options;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* PHP5 constructor
|
20 |
-
*
|
21 |
-
*/
|
22 |
-
function __construct ()
|
23 |
-
{
|
24 |
-
/**
|
25 |
-
*
|
26 |
-
* @var AVH_EC_Category_Group
|
27 |
-
*/
|
28 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
29 |
-
|
30 |
-
$this->version = '3.6.6';
|
31 |
-
$this->comment = '<!-- AVH Extended Categories version ' . $this->version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
32 |
-
$this->db_options_core = 'avhec';
|
33 |
-
$this->db_options_tax_meta = 'avhec-tax_meta';
|
34 |
-
|
35 |
-
add_action('init', array ( &$this, 'handleInitializePlugin' ), 10);
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* PHP4 Constructor
|
40 |
-
*
|
41 |
-
* @return AVHExtendedCategoriesCore
|
42 |
-
*/
|
43 |
-
function AVH_EC_Core ()
|
44 |
-
{
|
45 |
-
$this->__construct();
|
46 |
-
}
|
47 |
-
|
48 |
-
function handleInitializePlugin ()
|
49 |
-
{
|
50 |
-
global $wpdb;
|
51 |
-
|
52 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
53 |
-
$db_version = 4;
|
54 |
-
|
55 |
-
$info['siteurl'] = get_option('siteurl');
|
56 |
-
$info['plugin_dir'] = AVHEC_PLUGIN_DIR;
|
57 |
-
$info['graphics_url'] = AVHEC_PLUGIN_URL . '/images';
|
58 |
-
|
59 |
-
// Set class property for info
|
60 |
-
$this->info = array ( 'home' => get_option('home'), 'siteurl' => $info['siteurl'], 'plugin_dir' => $info['plugin_dir'], 'js_dir' => $info['plugin_dir'] . '/js', 'graphics_url' => $info['graphics_url'] );
|
61 |
-
|
62 |
-
// Set the default options
|
63 |
-
$this->default_options_general = array ( 'version' => $this->version, 'dbversion' => $db_version, 'alternative_name_select_category' => '' );
|
64 |
-
|
65 |
-
// Set the default category group options
|
66 |
-
$no_group_id = $catgrp->getTermIDBy('slug', 'none');
|
67 |
-
$home_group_id = $catgrp->getTermIDBy('slug', 'home');
|
68 |
-
$default_group_id = $catgrp->getTermIDBy('slug', 'all');
|
69 |
-
$this->default_options_category_group = array ( 'no_group' => $no_group_id, 'home_group' => $home_group_id, 'default_group' => $default_group_id );
|
70 |
-
|
71 |
-
$this->default_options_sp_category_group = array ( 'home_group' => $home_group_id, 'category_group' => $default_group_id, 'day_group' => $default_group_id, 'month_group' => $default_group_id, 'year_group' => $default_group_id, 'author_group' => $default_group_id, 'search_group' => $default_group_id );
|
72 |
-
|
73 |
-
$this->default_options = array ( 'general' => $this->default_options_general, 'cat_group' => $this->default_options_category_group, 'widget_titles' => array (), 'sp_cat_group' => $this->default_options_sp_category_group );
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Set the options for the program
|
77 |
-
*
|
78 |
-
*/
|
79 |
-
$this->loadOptions();
|
80 |
-
|
81 |
-
// Check if we have to do updates
|
82 |
-
if ((! isset($this->options['general']['dbversion'])) || $this->options['general']['dbversion'] < $db_version) {
|
83 |
-
$this->doUpdateOptions($db_version);
|
84 |
-
}
|
85 |
-
|
86 |
-
$db = new AVH_DB();
|
87 |
-
if (! $db->field_exists('avhec_term_order', $wpdb->terms)) {
|
88 |
-
$wpdb->query("ALTER TABLE $wpdb->terms ADD `avhec_term_order` INT( 4 ) NULL DEFAULT '0'");
|
89 |
-
}
|
90 |
-
|
91 |
-
$this->handleTextdomain();
|
92 |
-
add_filter('get_terms_orderby', array ( &$this, 'applyOrderFilter' ), 10, 2);
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
function applyOrderFilter ($orderby, $args)
|
97 |
-
{
|
98 |
-
switch ($args['orderby']) {
|
99 |
-
case 'avhec_manualorder':
|
100 |
-
$new_orderby = 't.avhec_term_order';
|
101 |
-
break;
|
102 |
-
case 'avhec_3rdparty_mycategoryorder':
|
103 |
-
$new_orderby = 't.term_order';
|
104 |
-
break;
|
105 |
-
default:
|
106 |
-
$new_orderby = $orderby;
|
107 |
-
break;
|
108 |
-
}
|
109 |
-
return $new_orderby;
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Loads the i18n
|
114 |
-
*
|
115 |
-
* @return
|
116 |
-
*/
|
117 |
-
function handleTextdomain ()
|
118 |
-
{
|
119 |
-
|
120 |
-
load_plugin_textdomain('avh-ec', false, AVHEC_RELATIVE_PLUGIN_DIR . '/lang');
|
121 |
-
|
122 |
-
}
|
123 |
-
|
124 |
-
/**
|
125 |
-
* Checks if running version is newer and do upgrades if necessary
|
126 |
-
*
|
127 |
-
* @since 1.2.3
|
128 |
-
*
|
129 |
-
*/
|
130 |
-
function doUpdateOptions ($db_version)
|
131 |
-
{
|
132 |
-
$options = $this->getOptions();
|
133 |
-
|
134 |
-
// Add none existing sections and/or elements to the options
|
135 |
-
foreach ($this->default_options as $section => $default_data) {
|
136 |
-
if (! array_key_exists($section, $options)) {
|
137 |
-
$options[$section] = $default_data;
|
138 |
-
continue;
|
139 |
-
}
|
140 |
-
foreach ($default_data as $element => $default_value) {
|
141 |
-
if (! array_key_exists($element, $options[$section])) {
|
142 |
-
$options[$section][$element] = $default_value;
|
143 |
-
}
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
// Remove none existing sections and/or elements from the options
|
148 |
-
foreach ($options as $section => $data) {
|
149 |
-
if (! array_key_exists($section, $this->default_options)) {
|
150 |
-
unset($options[$section]);
|
151 |
-
continue;
|
152 |
-
}
|
153 |
-
foreach ($data as $element => $value) {
|
154 |
-
if (! array_key_exists($element, $this->default_options[$section])) {
|
155 |
-
unset($options[$section][$element]);
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
/**
|
160 |
-
* Update the options to the latests versions
|
161 |
-
*/
|
162 |
-
$options['general']['version'] = $this->version;
|
163 |
-
$options['general']['dbversion'] = $db_version;
|
164 |
-
$this->saveOptions($options);
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Used in forms to set the checked option.
|
169 |
-
*
|
170 |
-
* @param mixed $checked
|
171 |
-
* @param mixed_type $current
|
172 |
-
* @return string
|
173 |
-
*
|
174 |
-
* @since 2.0
|
175 |
-
*/
|
176 |
-
function isChecked ($checked, $current)
|
177 |
-
{
|
178 |
-
if ($checked == $current) {
|
179 |
-
return (' checked="checked"');
|
180 |
-
}
|
181 |
-
return ('');
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Used in forms to set the SELECTED option
|
186 |
-
*
|
187 |
-
* @param string $current
|
188 |
-
* @param string $field
|
189 |
-
* @return string
|
190 |
-
*/
|
191 |
-
function isSelected ($current, $field)
|
192 |
-
{
|
193 |
-
if ($current == $field) {
|
194 |
-
return (' SELECTED');
|
195 |
-
}
|
196 |
-
return ('');
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Get the base directory of a directory structure
|
201 |
-
*
|
202 |
-
* @param string $directory
|
203 |
-
* @return string
|
204 |
-
*
|
205 |
-
*/
|
206 |
-
function getBaseDirectory ($directory)
|
207 |
-
{
|
208 |
-
//place each directory into array and get the last element
|
209 |
-
$return = end(explode('/', $directory));
|
210 |
-
|
211 |
-
return $return;
|
212 |
-
}
|
213 |
-
|
214 |
-
/*********************************
|
215 |
-
* *
|
216 |
-
* Methods for variable: options *
|
217 |
-
* *
|
218 |
-
********************************/
|
219 |
-
|
220 |
-
/**
|
221 |
-
* @param array $data
|
222 |
-
*/
|
223 |
-
function setOptions ($options)
|
224 |
-
{
|
225 |
-
$this->options = $options;
|
226 |
-
}
|
227 |
-
|
228 |
-
/**
|
229 |
-
* return array
|
230 |
-
*/
|
231 |
-
function getOptions ()
|
232 |
-
{
|
233 |
-
return ($this->options);
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Save all current options and set the options
|
238 |
-
*
|
239 |
-
*/
|
240 |
-
function saveOptions ($options)
|
241 |
-
{
|
242 |
-
update_option($this->db_options_core, $options);
|
243 |
-
wp_cache_flush(); // Delete cache
|
244 |
-
$this->setOptions($options);
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Retrieves the plugin options from the WordPress options table and assigns to class variable.
|
249 |
-
* If the options do not exists, like a new installation, the options are set to the default value.
|
250 |
-
*
|
251 |
-
* @return none
|
252 |
-
*/
|
253 |
-
function loadOptions ()
|
254 |
-
{
|
255 |
-
$options = get_option($this->db_options_core);
|
256 |
-
if (false === $options) { // New installation
|
257 |
-
$this->resetToDefaultOptions();
|
258 |
-
} else {
|
259 |
-
$this->setOptions($options);
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Get the value for an option element. If there's no option is set on the Admin page, return the default value.
|
265 |
-
*
|
266 |
-
* @param string $key
|
267 |
-
* @param string $option
|
268 |
-
* @return mixed
|
269 |
-
*/
|
270 |
-
function getOptionElement ($option, $key)
|
271 |
-
{
|
272 |
-
if ($this->options[$option][$key]) {
|
273 |
-
$return = $this->options[$option][$key]; // From Admin Page
|
274 |
-
} else {
|
275 |
-
$return = $this->default_options[$option][$key]; // Default
|
276 |
-
}
|
277 |
-
return ($return);
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Reset to default options and save in DB
|
282 |
-
*
|
283 |
-
*/
|
284 |
-
function resetToDefaultOptions ()
|
285 |
-
{
|
286 |
-
$this->options = $this->default_options;
|
287 |
-
$this->saveOptions($this->default_options);
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Display or retrieve the HTML dropdown list of categories.
|
292 |
-
*
|
293 |
-
* The list of arguments is below:
|
294 |
-
* 'show_option_all' (string) - Text to display for showing all categories.
|
295 |
-
* 'show_option_none' (string) - Text to display for showing no categories.
|
296 |
-
* 'orderby' (string) default is 'ID' - What column to use for ordering the
|
297 |
-
* categories.
|
298 |
-
* 'order' (string) default is 'ASC' - What direction to order categories.
|
299 |
-
* 'show_last_update' (bool|int) default is 0 - See {@link get_categories()}
|
300 |
-
* 'show_count' (bool|int) default is 0 - Whether to show how many posts are
|
301 |
-
* in the category.
|
302 |
-
* 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
|
303 |
-
* don't have any posts attached to them.
|
304 |
-
* 'child_of' (int) default is 0 - See {@link get_categories()}.
|
305 |
-
* 'exclude' (string) - See {@link get_categories()}.
|
306 |
-
* 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
|
307 |
-
* 'depth' (int) - The max depth.
|
308 |
-
* 'tab_index' (int) - Tab index for select element.
|
309 |
-
* 'name' (string) - The name attribute value for selected element.
|
310 |
-
* 'class' (string) - The class attribute value for selected element.
|
311 |
-
* 'selected' (int) - Which category ID is selected.
|
312 |
-
*
|
313 |
-
* The 'hierarchical' argument, which is disabled by default, will override the
|
314 |
-
* depth argument, unless it is true. When the argument is false, it will
|
315 |
-
* display all of the categories. When it is enabled it will use the value in
|
316 |
-
* the 'depth' argument.
|
317 |
-
*
|
318 |
-
* @since 2.1.0
|
319 |
-
*
|
320 |
-
* @param string|array $args Optional. Override default arguments.
|
321 |
-
* @return string HTML content only if 'echo' argument is 0.
|
322 |
-
*/
|
323 |
-
function avh_wp_dropdown_categories ($args = '', $selectedonly)
|
324 |
-
{
|
325 |
-
$mywalker = new AVH_Walker_CategoryDropdown();
|
326 |
-
|
327 |
-
// @format_off
|
328 |
-
$defaults = array(
|
329 |
-
'show_option_all' => '', 'show_option_none' => '',
|
330 |
-
'orderby' => 'id', 'order' => 'ASC',
|
331 |
-
'show_last_update' => 0, 'show_count' => 0,
|
332 |
-
'hide_empty' => 1, 'child_of' => 0,
|
333 |
-
'exclude' => '', 'echo' => 1,
|
334 |
-
'selected' => 0, 'hierarchical' => 0,
|
335 |
-
'name' => 'cat', 'id' => '',
|
336 |
-
'class' => 'postform', 'depth' => 0,
|
337 |
-
'tab_index' => 0, 'taxonomy' => 'category',
|
338 |
-
'walker' => $mywalker,
|
339 |
-
'hide_if_empty' => false
|
340 |
-
);
|
341 |
-
// @format_on
|
342 |
-
$defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
|
343 |
-
|
344 |
-
$r = wp_parse_args($args, $defaults);
|
345 |
-
|
346 |
-
if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
|
347 |
-
$r['pad_counts'] = true;
|
348 |
-
}
|
349 |
-
|
350 |
-
$r['include_last_update_time'] = $r['show_last_update'];
|
351 |
-
extract($r);
|
352 |
-
|
353 |
-
$tab_index_attribute = '';
|
354 |
-
if ((int) $tab_index > 0)
|
355 |
-
$tab_index_attribute = ' tabindex="' . $tab_index . '"';
|
356 |
-
|
357 |
-
$categories = get_terms($taxonomy, $r);
|
358 |
-
$name = esc_attr($name);
|
359 |
-
$class = esc_attr($class);
|
360 |
-
$id = $id ? esc_attr($id) : $name;
|
361 |
-
|
362 |
-
if (! $r['hide_if_empty'] || ! empty($categories))
|
363 |
-
$output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n";
|
364 |
-
else
|
365 |
-
$output = '';
|
366 |
-
|
367 |
-
if (empty($categories) && ! $r['hide_if_empty'] && ! empty($show_option_none)) {
|
368 |
-
$show_option_none = apply_filters('list_cats', $show_option_none);
|
369 |
-
$output .= "\t<option value='-1' selected='selected'>$show_option_none</option>\n";
|
370 |
-
}
|
371 |
-
if (! empty($categories)) {
|
372 |
-
|
373 |
-
if ($show_option_all) {
|
374 |
-
$show_option_all = apply_filters('list_cats', $show_option_all);
|
375 |
-
$selected = ('0' === strval($r['selected'])) ? " selected='selected'" : '';
|
376 |
-
$output .= "\t" . '<option value="0"' . $selected . '>' . $show_option_all . '</option>' . "\n";
|
377 |
-
}
|
378 |
-
|
379 |
-
if ($show_option_none) {
|
380 |
-
$show_option_none = apply_filters('list_cats', $show_option_none);
|
381 |
-
$selected = ('-1' === strval($r['selected'])) ? " selected='selected'" : '';
|
382 |
-
$output .= "\t" . '<option value="-1"' . $selected . '>' . $show_option_none . '</option>' . "\n";
|
383 |
-
}
|
384 |
-
|
385 |
-
if ($hierarchical) {
|
386 |
-
$depth = $r['depth']; // Walk the full depth.
|
387 |
-
} else {
|
388 |
-
$depth = - 1; // Flat
|
389 |
-
}
|
390 |
-
$output .= walk_category_dropdown_tree($categories, $depth, $r);
|
391 |
-
}
|
392 |
-
if (! $r['hide_if_empty'] || ! empty($categories))
|
393 |
-
$output .= "</select>\n";
|
394 |
-
|
395 |
-
$output = apply_filters('wp_dropdown_cats', $output);
|
396 |
-
|
397 |
-
if ($echo)
|
398 |
-
echo $output;
|
399 |
-
|
400 |
-
return $output;
|
401 |
-
}
|
402 |
-
|
403 |
-
/**
|
404 |
-
* Display or retrieve the HTML list of categories.
|
405 |
-
*
|
406 |
-
* The list of arguments is below:
|
407 |
-
* 'show_option_all' (string) - Text to display for showing all categories.
|
408 |
-
* 'orderby' (string) default is 'ID' - What column to use for ordering the
|
409 |
-
* categories.
|
410 |
-
* 'order' (string) default is 'ASC' - What direction to order categories.
|
411 |
-
* 'show_last_update' (bool|int) default is 0 - See {@link
|
412 |
-
* walk_category_dropdown_tree()}
|
413 |
-
* 'show_count' (bool|int) default is 0 - Whether to show how many posts are
|
414 |
-
* in the category.
|
415 |
-
* 'hide_empty' (bool|int) default is 1 - Whether to hide categories that
|
416 |
-
* don't have any posts attached to them.
|
417 |
-
* 'use_desc_for_title' (bool|int) default is 1 - Whether to use the
|
418 |
-
* description instead of the category title.
|
419 |
-
* 'feed' - See {@link get_categories()}.
|
420 |
-
* 'feed_type' - See {@link get_categories()}.
|
421 |
-
* 'feed_image' - See {@link get_categories()}.
|
422 |
-
* 'child_of' (int) default is 0 - See {@link get_categories()}.
|
423 |
-
* 'exclude' (string) - See {@link get_categories()}.
|
424 |
-
* 'exclude_tree' (string) - See {@link get_categories()}.
|
425 |
-
* 'echo' (bool|int) default is 1 - Whether to display or retrieve content.
|
426 |
-
* 'current_category' (int) - See {@link get_categories()}.
|
427 |
-
* 'hierarchical' (bool) - See {@link get_categories()}.
|
428 |
-
* 'title_li' (string) - See {@link get_categories()}.
|
429 |
-
* 'depth' (int) - The max depth.
|
430 |
-
*
|
431 |
-
* @since 2.1.0
|
432 |
-
*
|
433 |
-
* @param string|array $args Optional. Override default arguments.
|
434 |
-
* @return string HTML content only if 'echo' argument is 0.
|
435 |
-
*/
|
436 |
-
function avh_wp_list_categories ($args = '', $selectedonly)
|
437 |
-
{
|
438 |
-
$mywalker = new AVHEC_Walker_Category();
|
439 |
-
$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 );
|
440 |
-
|
441 |
-
$r = wp_parse_args($args, $defaults);
|
442 |
-
|
443 |
-
if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
|
444 |
-
$r['pad_counts'] = true;
|
445 |
-
}
|
446 |
-
|
447 |
-
if (! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
|
448 |
-
$r['pad_counts'] = true;
|
449 |
-
}
|
450 |
-
|
451 |
-
if (isset($r['show_date'])) {
|
452 |
-
$r['include_last_update_time'] = $r['show_date'];
|
453 |
-
}
|
454 |
-
|
455 |
-
if (true == $r['hierarchical']) {
|
456 |
-
$r['exclude_tree'] = $r['exclude'];
|
457 |
-
$r['exclude'] = '';
|
458 |
-
}
|
459 |
-
|
460 |
-
extract($r);
|
461 |
-
|
462 |
-
$categories = get_categories($r);
|
463 |
-
|
464 |
-
$output = '';
|
465 |
-
if ($title_li && 'list' == $style)
|
466 |
-
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
467 |
-
|
468 |
-
if (empty($categories)) {
|
469 |
-
if ('list' == $style)
|
470 |
-
$output .= '<li>' . __("No categories") . '</li>';
|
471 |
-
else
|
472 |
-
$output .= __("No categories");
|
473 |
-
} else {
|
474 |
-
global $wp_query;
|
475 |
-
|
476 |
-
if (! empty($show_option_all))
|
477 |
-
if ('list' == $style)
|
478 |
-
$output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
|
479 |
-
else
|
480 |
-
$output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
|
481 |
-
|
482 |
-
if (empty($r['current_category']) && is_category())
|
483 |
-
$r['current_category'] = $wp_query->get_queried_object_id();
|
484 |
-
|
485 |
-
if ($hierarchical) {
|
486 |
-
$depth = $r['depth'];
|
487 |
-
} else {
|
488 |
-
$depth = - 1; // Flat.
|
489 |
-
}
|
490 |
-
|
491 |
-
$output .= walk_category_tree($categories, $depth, $r);
|
492 |
-
}
|
493 |
-
|
494 |
-
if ($title_li && 'list' == $style)
|
495 |
-
$output .= '</ul></li>';
|
496 |
-
|
497 |
-
$output = apply_filters('wp_list_categories', $output);
|
498 |
-
|
499 |
-
if ($echo)
|
500 |
-
echo $output;
|
501 |
-
else
|
502 |
-
return $output;
|
503 |
-
}
|
504 |
-
|
505 |
-
function getCategories ()
|
506 |
-
{
|
507 |
-
static $_categories = NULL;
|
508 |
-
if (NULL === $_categories) {
|
509 |
-
$_categories = get_categories('get=all');
|
510 |
-
}
|
511 |
-
return $_categories;
|
512 |
-
}
|
513 |
-
|
514 |
-
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 |
-
}
|
521 |
-
}
|
522 |
-
return $_categories_id;
|
523 |
-
}
|
524 |
-
}
|
525 |
-
|
526 |
-
/**
|
527 |
-
* Create HTML dropdown list of Categories.
|
528 |
-
*
|
529 |
-
* @uses Walker
|
530 |
-
*/
|
531 |
-
class AVH_Walker_CategoryDropdown extends Walker_CategoryDropdown
|
532 |
-
{
|
533 |
-
|
534 |
-
function walk ($elements, $max_depth)
|
535 |
-
{
|
536 |
-
|
537 |
-
$args = array_slice(func_get_args(), 2);
|
538 |
-
$output = '';
|
539 |
-
|
540 |
-
if ($max_depth < - 1) //invalid parameter
|
541 |
-
return $output;
|
542 |
-
|
543 |
-
if (empty($elements)) //nothing to walk
|
544 |
-
return $output;
|
545 |
-
|
546 |
-
$id_field = $this->db_fields['id'];
|
547 |
-
$parent_field = $this->db_fields['parent'];
|
548 |
-
|
549 |
-
// flat display
|
550 |
-
if (- 1 == $max_depth) {
|
551 |
-
$empty_array = array ();
|
552 |
-
foreach ($elements as $e)
|
553 |
-
$this->display_element($e, $empty_array, 1, 0, $args, $output);
|
554 |
-
return $output;
|
555 |
-
}
|
556 |
-
|
557 |
-
/*
|
558 |
-
* need to display in hierarchical order
|
559 |
-
* seperate elements into two buckets: top level and children elements
|
560 |
-
* children_elements is two dimensional array, eg.
|
561 |
-
* children_elements[10][] contains all sub-elements whose parent is 10.
|
562 |
-
*/
|
563 |
-
$top_level_elements = array ();
|
564 |
-
$children_elements = array ();
|
565 |
-
foreach ($elements as $e) {
|
566 |
-
if (0 == $e->$parent_field)
|
567 |
-
$top_level_elements[] = $e;
|
568 |
-
else
|
569 |
-
$children_elements[$e->$parent_field][] = $e;
|
570 |
-
}
|
571 |
-
|
572 |
-
/*
|
573 |
-
* when none of the elements is top level
|
574 |
-
* assume the first one must be root of the sub elements
|
575 |
-
*/
|
576 |
-
if (empty($top_level_elements)) {
|
577 |
-
|
578 |
-
$first = array_slice($elements, 0, 1);
|
579 |
-
$root = $first[0];
|
580 |
-
|
581 |
-
$top_level_elements = array ();
|
582 |
-
$children_elements = array ();
|
583 |
-
foreach ($elements as $e) {
|
584 |
-
if ($root->$parent_field == $e->$parent_field)
|
585 |
-
$top_level_elements[] = $e;
|
586 |
-
else
|
587 |
-
$children_elements[$e->$parent_field][] = $e;
|
588 |
-
}
|
589 |
-
}
|
590 |
-
|
591 |
-
foreach ($top_level_elements as $e) {
|
592 |
-
$this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
|
593 |
-
}
|
594 |
-
|
595 |
-
/*
|
596 |
-
* if we are displaying all levels, and remaining children_elements is not empty,
|
597 |
-
* then we got orphans, which should be displayed regardless
|
598 |
-
*/
|
599 |
-
if ((0 == $max_depth) && count($children_elements) > 0) {
|
600 |
-
$empty_array = array ();
|
601 |
-
foreach ($children_elements as $orphans)
|
602 |
-
foreach ($orphans as $op)
|
603 |
-
$this->display_element($op, $empty_array, 1, 0, $args, $output);
|
604 |
-
}
|
605 |
-
|
606 |
-
return $output;
|
607 |
-
}
|
608 |
-
}
|
609 |
-
|
610 |
-
/**
|
611 |
-
* Create HTML list of categories.
|
612 |
-
*
|
613 |
-
* @uses Walker
|
614 |
-
*/
|
615 |
-
class AVHEC_Walker_Category extends Walker
|
616 |
-
{
|
617 |
-
/**
|
618 |
-
* @see Walker::$tree_type
|
619 |
-
* @since 2.1.0
|
620 |
-
* @var string
|
621 |
-
*/
|
622 |
-
var $tree_type = 'category';
|
623 |
-
|
624 |
-
/**
|
625 |
-
* @see Walker::$db_fields
|
626 |
-
* @since 2.1.0
|
627 |
-
* @todo Decouple this
|
628 |
-
* @var array
|
629 |
-
*/
|
630 |
-
var $db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' );
|
631 |
-
|
632 |
-
/**
|
633 |
-
* @see Walker::start_lvl()
|
634 |
-
* @since 2.1.0
|
635 |
-
*
|
636 |
-
* @param string $output Passed by reference. Used to append additional content.
|
637 |
-
* @param int $depth Depth of category. Used for tab indentation.
|
638 |
-
* @param array $args Will only append content if style argument value is 'list'.
|
639 |
-
*/
|
640 |
-
function start_lvl (&$output, $depth, $args)
|
641 |
-
{
|
642 |
-
if ('list' != $args['style'])
|
643 |
-
return;
|
644 |
-
|
645 |
-
$indent = str_repeat("\t", $depth);
|
646 |
-
$output .= $indent . '<ul class="children">' . "\n";
|
647 |
-
}
|
648 |
-
|
649 |
-
/**
|
650 |
-
* @see Walker::end_lvl()
|
651 |
-
* @since 2.1.0
|
652 |
-
*
|
653 |
-
* @param string $output Passed by reference. Used to append additional content.
|
654 |
-
* @param int $depth Depth of category. Used for tab indentation.
|
655 |
-
* @param array $args Will only append content if style argument value is 'list'.
|
656 |
-
*/
|
657 |
-
function end_lvl (&$output, $depth, $args)
|
658 |
-
{
|
659 |
-
if ('list' != $args['style'])
|
660 |
-
return;
|
661 |
-
|
662 |
-
$indent = str_repeat("\t", $depth);
|
663 |
-
$output .= $indent . '</ul>' . "\n";
|
664 |
-
}
|
665 |
-
|
666 |
-
/**
|
667 |
-
* @see Walker::start_el()
|
668 |
-
* @since 2.1.0
|
669 |
-
*
|
670 |
-
* @param string $output Passed by reference. Used to append additional content.
|
671 |
-
* @param object $category Category data object.
|
672 |
-
* @param int $depth Depth of category in reference to parents.
|
673 |
-
* @param array $args
|
674 |
-
*/
|
675 |
-
function start_el (&$output, $category, $depth, $args)
|
676 |
-
{
|
677 |
-
extract($args);
|
678 |
-
|
679 |
-
$cat_name = esc_attr($category->name);
|
680 |
-
$cat_name = apply_filters('list_cats', $cat_name, $category);
|
681 |
-
$link = '<div class="avhec-widget-line"><a href="' . get_category_link($category->term_id) . '" ';
|
682 |
-
if ($use_desc_for_title == 0 || empty($category->description))
|
683 |
-
$link .= 'title="' . sprintf(__('View all posts filed under %s'), $cat_name) . '"';
|
684 |
-
else
|
685 |
-
$link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"';
|
686 |
-
$link .= '>';
|
687 |
-
$link .= $cat_name . '</a>';
|
688 |
-
|
689 |
-
if ((! empty($feed_image)) || (! empty($feed))) {
|
690 |
-
$link .= '<div class="avhec-widget-rss"> ';
|
691 |
-
|
692 |
-
if (empty($feed_image))
|
693 |
-
$link .= '(';
|
694 |
-
|
695 |
-
$link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"';
|
696 |
-
|
697 |
-
if (empty($feed))
|
698 |
-
$alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"';
|
699 |
-
else {
|
700 |
-
$title = ' title="' . $feed . '"';
|
701 |
-
$alt = ' alt="' . $feed . '"';
|
702 |
-
$name = $feed;
|
703 |
-
$link .= $title;
|
704 |
-
}
|
705 |
-
|
706 |
-
$link .= '>';
|
707 |
-
|
708 |
-
if (empty($feed_image))
|
709 |
-
$link .= $name;
|
710 |
-
else
|
711 |
-
$link .= '<img src="' . $feed_image . '"' . $alt . $title . ' />';
|
712 |
-
$link .= '</a>';
|
713 |
-
if (empty($feed_image))
|
714 |
-
$link .= ')';
|
715 |
-
$link .= '</div>';
|
716 |
-
}
|
717 |
-
|
718 |
-
if (isset($show_count) && $show_count)
|
719 |
-
$link .= '<div class="avhec-widget-count"> (' . intval($category->count) . ')</div>';
|
720 |
-
|
721 |
-
if (isset($show_date) && $show_date) {
|
722 |
-
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
|
723 |
-
}
|
724 |
-
|
725 |
-
if (isset($current_category) && $current_category)
|
726 |
-
$_current_category = get_category($current_category);
|
727 |
-
|
728 |
-
if ('list' == $args['style']) {
|
729 |
-
$output .= "\t" . '<li';
|
730 |
-
$class = 'cat-item cat-item-' . $category->term_id;
|
731 |
-
if (isset($current_category) && $current_category && ($category->term_id == $current_category))
|
732 |
-
$class .= ' current-cat';
|
733 |
-
elseif (isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent))
|
734 |
-
$class .= ' current-cat-parent';
|
735 |
-
$output .= ' class="' . $class . '"';
|
736 |
-
$output .= '>' . $link . '</div>' . "\n";
|
737 |
-
} else {
|
738 |
-
$output .= "\t" . $link . '</div><br />' . "\n";
|
739 |
-
}
|
740 |
-
}
|
741 |
-
|
742 |
-
/**
|
743 |
-
* @see Walker::end_el()
|
744 |
-
* @since 2.1.0
|
745 |
-
*
|
746 |
-
* @param string $output Passed by reference. Used to append additional content.
|
747 |
-
* @param object $page Not used.
|
748 |
-
* @param int $depth Depth of category. Not used.
|
749 |
-
* @param array $args Only uses 'list' for whether should append to output.
|
750 |
-
*/
|
751 |
-
function end_el (&$output, $page, $depth, $args)
|
752 |
-
{
|
753 |
-
if ('list' != $args['style'])
|
754 |
-
return;
|
755 |
-
|
756 |
-
$output .= '</li>' . "\n";
|
757 |
-
}
|
758 |
-
}
|
759 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/class/avh-ec.widgets.php
DELETED
@@ -1,1004 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Widget Class for displaying categories. Extended version of the dfeault categories.
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class WP_Widget_AVH_ExtendedCategories_Normal extends WP_Widget
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
*
|
11 |
-
* @var AVH_EC_Core
|
12 |
-
*/
|
13 |
-
var $core;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* PHP 5 Constructor
|
17 |
-
*
|
18 |
-
*/
|
19 |
-
function __construct ()
|
20 |
-
{
|
21 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
22 |
-
|
23 |
-
//Convert the old option widget_extended_categories to widget_extended-categories
|
24 |
-
$old = get_option('widget_extended_categories');
|
25 |
-
if (! (FALSE === $old)) {
|
26 |
-
update_option('widget_extended-categories', $old);
|
27 |
-
delete_option('widget_extended_categories');
|
28 |
-
}
|
29 |
-
$widget_ops = array ( 'description' => __("An extended version of the default Categories widget.", 'avh-ec') );
|
30 |
-
WP_Widget::__construct('extended-categories', 'AVH Extended Categories', $widget_ops);
|
31 |
-
|
32 |
-
add_action('wp_print_styles', array ( &$this, 'actionWpPrintStyles' ));
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
function WP_Widget_AVH_ExtendedCategories_Normal ()
|
37 |
-
{
|
38 |
-
$this->__construct();
|
39 |
-
}
|
40 |
-
|
41 |
-
function actionWpPrintStyles ()
|
42 |
-
{
|
43 |
-
|
44 |
-
if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
|
45 |
-
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version);
|
46 |
-
wp_enqueue_style('avhec-widget');
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Display the widget
|
52 |
-
*
|
53 |
-
* @param unknown_type $args
|
54 |
-
* @param unknown_type $instance
|
55 |
-
*/
|
56 |
-
function widget ($args, $instance)
|
57 |
-
{
|
58 |
-
|
59 |
-
extract($args);
|
60 |
-
|
61 |
-
$selectedonly = $instance['selectedonly'] ? TRUE : FALSE;
|
62 |
-
$c = $instance['count'] ? TRUE : FALSE;
|
63 |
-
$h = $instance['hierarchical'] ? TRUE : FALSE;
|
64 |
-
$d = $instance['depth'] ? $instance['depth'] : 0;
|
65 |
-
$e = $instance['hide_empty'] ? TRUE : FALSE;
|
66 |
-
$use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
|
67 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
68 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
69 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
70 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
71 |
-
$invert = $instance['invert_included'] ? TRUE : FALSE;
|
72 |
-
|
73 |
-
if (empty($r)) {
|
74 |
-
$i = '';
|
75 |
-
}
|
76 |
-
|
77 |
-
if (empty($d)) {
|
78 |
-
$d = 0;
|
79 |
-
}
|
80 |
-
|
81 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
|
82 |
-
$style = empty($instance['style']) ? 'list' : $instance['style'];
|
83 |
-
|
84 |
-
$included_cats = '';
|
85 |
-
if ($instance['post_category']) {
|
86 |
-
$post_category = unserialize($instance['post_category']);
|
87 |
-
$children = array ();
|
88 |
-
if (! $instance['selectedonly']) {
|
89 |
-
foreach ($post_category as $cat_id) {
|
90 |
-
$children = array_merge($children, get_term_children($cat_id, 'category'));
|
91 |
-
}
|
92 |
-
}
|
93 |
-
$included_cats = implode(",", array_merge($post_category, $children));
|
94 |
-
}
|
95 |
-
|
96 |
-
if ($invert) {
|
97 |
-
$inc_exc = 'exclude';
|
98 |
-
} else {
|
99 |
-
$inc_exc = 'include';
|
100 |
-
}
|
101 |
-
|
102 |
-
$options = $this->core->getOptions();
|
103 |
-
$show_option_none = __('Select Category', 'avh-ec');
|
104 |
-
if ($options['general']['alternative_name_select_category']) {
|
105 |
-
$show_option_none = $options['general']['alternative_name_select_category'];
|
106 |
-
}
|
107 |
-
|
108 |
-
$cat_args = array ( $inc_exc => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' => $e, 'hierarchical' => $h, 'depth' => $d, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-select-' . $this->number );
|
109 |
-
echo $before_widget;
|
110 |
-
echo $this->core->comment;
|
111 |
-
echo $before_title . $title . $after_title;
|
112 |
-
|
113 |
-
if ($style == 'list') {
|
114 |
-
echo '<ul>';
|
115 |
-
$this->core->avh_wp_list_categories($cat_args, $selectedonly);
|
116 |
-
echo '</ul>';
|
117 |
-
} else {
|
118 |
-
$this->core->avh_wp_dropdown_categories($cat_args, $selectedonly);
|
119 |
-
echo '<script type=\'text/javascript\'>' . "\n";
|
120 |
-
echo '/* <![CDATA[ */' . "\n";
|
121 |
-
echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-' . $this->number . '");' . "\n";
|
122 |
-
echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
|
123 |
-
echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
|
124 |
-
echo ' location.href = "' .home_url() . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
|
125 |
-
echo ' }' . "\n";
|
126 |
-
echo ' }' . "\n";
|
127 |
-
echo ' ec_dropdown_' . $this->number . '.onchange = ec_onCatChange_' . $this->number . ';' . "\n";
|
128 |
-
echo '/* ]]> */' . "\n";
|
129 |
-
echo '</script>' . "\n";
|
130 |
-
}
|
131 |
-
echo $after_widget;
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* When Widget Control Form Is Posted
|
136 |
-
*
|
137 |
-
* @param unknown_type $new_instance
|
138 |
-
* @param unknown_type $old_instance
|
139 |
-
* @return unknown
|
140 |
-
*/
|
141 |
-
function update ($new_instance, $old_instance)
|
142 |
-
{
|
143 |
-
// update the instance's settings
|
144 |
-
if (! isset($new_instance['submit'])) {
|
145 |
-
return FALSE;
|
146 |
-
}
|
147 |
-
|
148 |
-
$instance = $old_instance;
|
149 |
-
|
150 |
-
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
151 |
-
$instance['selectedonly'] = $new_instance['selectedonly'] ? TRUE : FALSE;
|
152 |
-
$instance['count'] = $new_instance['count'] ? TRUE : FALSE;
|
153 |
-
$instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
|
154 |
-
$instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
|
155 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
|
156 |
-
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
157 |
-
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
158 |
-
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
159 |
-
$instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
|
160 |
-
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
161 |
-
if (array_key_exists('all', $new_instance['post_category'])) {
|
162 |
-
$instance['post_category'] = FALSE;
|
163 |
-
} else {
|
164 |
-
$instance['post_category'] = serialize($new_instance['post_category']);
|
165 |
-
}
|
166 |
-
$instance['depth'] = (int) $new_instance['depth'];
|
167 |
-
if ($instance['depth'] < 0 || 11 < $instance['depth']) {
|
168 |
-
$instance['depth'] = 0;
|
169 |
-
}
|
170 |
-
$instance['invert_included'] = $new_instance['invert_included'] ? TRUE : FALSE;
|
171 |
-
|
172 |
-
return $instance;
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Display Widget Control Form
|
177 |
-
*
|
178 |
-
* @param unknown_type $instance
|
179 |
-
*/
|
180 |
-
function form ($instance)
|
181 |
-
{
|
182 |
-
// displays the widget admin form
|
183 |
-
$instance = wp_parse_args((array) $instance, array ( 'title' => '', 'rssimage' => '', 'depth' => 0 ));
|
184 |
-
|
185 |
-
// Prepare data for display
|
186 |
-
$depth = (int) $instance['depth'];
|
187 |
-
if ($depth < 0 || 11 < $depth) {
|
188 |
-
$depth = 0;
|
189 |
-
}
|
190 |
-
$selected_cats = ($instance['post_category'] != '') ? unserialize($instance['post_category']) : FALSE;
|
191 |
-
|
192 |
-
echo '<p>';
|
193 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
194 |
-
echo '</p>';
|
195 |
-
|
196 |
-
echo '<p>';
|
197 |
-
avh_doWidgetFormCheckbox($this->get_field_id('selectedonly'), $this->get_field_name('selectedonly'), __('Show selected categories only', 'avh-ec'), (bool) $instance['selectedonly']);
|
198 |
-
|
199 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
|
200 |
-
|
201 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
|
202 |
-
|
203 |
-
$options = array ( 0 => __('All Levels', 'avh-ec'), 1 => __('Toplevel only', 'avh-ec') );
|
204 |
-
for ($i = 2; $i <= 11; $i ++) {
|
205 |
-
$options[$i] = __('Child ', 'avh-ec') . ($i - 1);
|
206 |
-
}
|
207 |
-
avh_doWidgetFormSelect($this->get_field_id('depth'), $this->get_field_name('depth'), __('How many levels to show', 'avh-ec'), $options, $depth);
|
208 |
-
unset($options);
|
209 |
-
|
210 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
|
211 |
-
|
212 |
-
avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
|
213 |
-
echo '</p>';
|
214 |
-
|
215 |
-
echo '<p>';
|
216 |
-
$options['ID'] = __('ID', 'avh-ec');
|
217 |
-
$options['name'] = __('Name', 'avh-ec');
|
218 |
-
$options['count'] = __('Count', 'avh-ec');
|
219 |
-
$options['slug'] = __('Slug', 'avh-ec');
|
220 |
-
$options['avhec_manualorder'] = 'AVH EC ' . __('Manual Order', 'avh-ec');
|
221 |
-
if (is_plugin_active('my-category-order/mycategoryorder.php')) {
|
222 |
-
$options['avhec_3rdparty_mycategoryorder'] = 'My Category Order';
|
223 |
-
}
|
224 |
-
|
225 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
|
226 |
-
unset($options);
|
227 |
-
|
228 |
-
$options['asc'] = __('Ascending', 'avh-ec');
|
229 |
-
$options['desc'] = __('Descending', 'avh-ec');
|
230 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
|
231 |
-
unset($options);
|
232 |
-
|
233 |
-
$options['list'] = __('List', 'avh-ec');
|
234 |
-
$options['drop'] = __('Drop down', 'avh-ec');
|
235 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
|
236 |
-
unset($options);
|
237 |
-
echo '</p>';
|
238 |
-
|
239 |
-
echo '<p>';
|
240 |
-
|
241 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
|
242 |
-
|
243 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
|
244 |
-
|
245 |
-
echo '</p>';
|
246 |
-
|
247 |
-
echo '<p>';
|
248 |
-
echo '<b>' . __('Select categories', 'avh-ec') . '</b><hr />';
|
249 |
-
echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear" style="list-style-type: none; margin-left: 5px; padding-left: 0px; margin-bottom: 20px;">';
|
250 |
-
echo '<li id="' . $this->get_field_id('category--1') . '" class="popular-category">';
|
251 |
-
echo '<label for="' . $this->get_field_id('post_category') . '" class="selectit">';
|
252 |
-
echo '<input value="all" id="' . $this->get_field_id('post_category') . '" name="' . $this->get_field_name('post_category') . '[all]" type="checkbox" ' . (FALSE === $selected_cats ? ' CHECKED' : '') . '> ';
|
253 |
-
_e('All Categories', 'avh-ec');
|
254 |
-
echo '</label>';
|
255 |
-
echo '</li>';
|
256 |
-
ob_start();
|
257 |
-
$this->avh_wp_category_checklist($selected_cats, $this->number);
|
258 |
-
ob_end_flush();
|
259 |
-
echo '</ul>';
|
260 |
-
echo '</p>';
|
261 |
-
|
262 |
-
echo '<p>';
|
263 |
-
avh_doWidgetFormCheckbox($this->get_field_id('invert_included'), $this->get_field_name('invert_included'), __('Exclude the selected categories', 'avh-ec'), (bool) $instance['invert_included']);
|
264 |
-
echo '</p>';
|
265 |
-
|
266 |
-
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
267 |
-
}
|
268 |
-
|
269 |
-
/**
|
270 |
-
* Creates the categories checklist
|
271 |
-
*
|
272 |
-
* @param int $post_id
|
273 |
-
* @param int $descendants_and_self
|
274 |
-
* @param array $selected_cats
|
275 |
-
* @param array $popular_cats
|
276 |
-
* @param int $number
|
277 |
-
*/
|
278 |
-
function avh_wp_category_checklist ($selected_cats, $number)
|
279 |
-
{
|
280 |
-
|
281 |
-
$walker = new AVH_Walker_Category_Checklist();
|
282 |
-
$walker->number = $number;
|
283 |
-
$walker->input_id = $this->get_field_id('post_category');
|
284 |
-
$walker->input_name = $this->get_field_name('post_category');
|
285 |
-
$walker->li_id = $this->get_field_id('category--1');
|
286 |
-
|
287 |
-
$args = array ( 'taxonomy' => 'category', 'descendants_and_self' => 0, 'selected_cats' => $selected_cats, 'popular_cats' => array (), 'walker' => $walker, 'checked_ontop' => true, 'popular_cats' => array () );
|
288 |
-
|
289 |
-
if (is_array($selected_cats))
|
290 |
-
$args['selected_cats'] = $selected_cats;
|
291 |
-
else
|
292 |
-
$args['selected_cats'] = array ();
|
293 |
-
|
294 |
-
$categories = $this->core->getCategories();
|
295 |
-
$_categories_id = $this->core->getCategoriesId($categories);
|
296 |
-
|
297 |
-
// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
|
298 |
-
$checked_categories = array ();
|
299 |
-
foreach ($args['selected_cats'] as $key => $value) {
|
300 |
-
if (isset($_categories_id[$key])) {
|
301 |
-
$category_key = $_categories_id[$key];
|
302 |
-
$checked_categories[] = $categories[$category_key];
|
303 |
-
unset($categories[$category_key]);
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
// Put checked cats on top
|
308 |
-
echo $walker->walk($checked_categories, 0, array ( $args ));
|
309 |
-
// Then the rest of them
|
310 |
-
echo $walker->walk($categories, 0, array ( $args ));
|
311 |
-
}
|
312 |
-
}
|
313 |
-
|
314 |
-
/**
|
315 |
-
* Widget Class for displaying the top categories
|
316 |
-
*
|
317 |
-
*/
|
318 |
-
class WP_Widget_AVH_ExtendedCategories_Top extends WP_Widget
|
319 |
-
{
|
320 |
-
/**
|
321 |
-
*
|
322 |
-
* @var AVH_EC_Core
|
323 |
-
*/
|
324 |
-
var $core;
|
325 |
-
|
326 |
-
/**
|
327 |
-
* PHP 5 Constructor
|
328 |
-
*
|
329 |
-
*/
|
330 |
-
function __construct ()
|
331 |
-
{
|
332 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
333 |
-
|
334 |
-
$widget_ops = array ( 'description' => __("Shows the top categories.", 'avh-ec') );
|
335 |
-
WP_Widget::__construct(FALSE, 'AVH Extended Categories: ' . __('Top Categories'), $widget_ops);
|
336 |
-
add_action('wp_print_styles', array ( &$this, 'actionWpPrintStyles' ));
|
337 |
-
|
338 |
-
}
|
339 |
-
|
340 |
-
function WP_Widget_AVH_ExtendedCategories_Top ()
|
341 |
-
{
|
342 |
-
$this->__construct();
|
343 |
-
}
|
344 |
-
|
345 |
-
function actionWpPrintStyles ()
|
346 |
-
{
|
347 |
-
if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
|
348 |
-
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version);
|
349 |
-
wp_enqueue_style('avhec-widget');
|
350 |
-
}
|
351 |
-
}
|
352 |
-
|
353 |
-
/** Echo the widget content.
|
354 |
-
*
|
355 |
-
* Subclasses should over-ride this function to generate their widget code.
|
356 |
-
*
|
357 |
-
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
|
358 |
-
* @param array $instance The settings for the particular instance of the widget
|
359 |
-
*/
|
360 |
-
function widget ($args, $instance)
|
361 |
-
{
|
362 |
-
extract($args);
|
363 |
-
|
364 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? __('Categories', 'avh-ec') : $instance['title']);
|
365 |
-
$style = empty($instance['style']) ? 'list' : $instance['style'];
|
366 |
-
if (! $a = (int) $instance['amount']) {
|
367 |
-
$a = 5;
|
368 |
-
} elseif ($a < 1) {
|
369 |
-
$a = 1;
|
370 |
-
}
|
371 |
-
$c = $instance['count'] ? TRUE : FALSE;
|
372 |
-
$use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
|
373 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
374 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
375 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
376 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
377 |
-
if (empty($r)) {
|
378 |
-
$i = '';
|
379 |
-
}
|
380 |
-
if (! empty($i)) {
|
381 |
-
if (! file_exists(ABSPATH . '/' . $i)) {
|
382 |
-
$i = '';
|
383 |
-
}
|
384 |
-
}
|
385 |
-
|
386 |
-
$options = $this->core->getOptions();
|
387 |
-
$show_option_none = __('Select Category', 'avh-ec');
|
388 |
-
if ($options['general']['alternative_name_select_category']) {
|
389 |
-
$show_option_none = $options['general']['alternative_name_select_category'];
|
390 |
-
}
|
391 |
-
|
392 |
-
$top_cats = get_terms('category', array ( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => $a, 'hierarchical' => FALSE ));
|
393 |
-
$included_cats = implode(",", $top_cats);
|
394 |
-
|
395 |
-
$cat_args = array ( 'include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' => FALSE, 'hierarchical' => FALSE, 'depth' => - 1, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-top-select-' . $this->number );
|
396 |
-
echo $before_widget;
|
397 |
-
echo $this->core->comment;
|
398 |
-
echo $before_title . $title . $after_title;
|
399 |
-
echo '<ul>';
|
400 |
-
|
401 |
-
if ($style == 'list') {
|
402 |
-
wp_list_categories($cat_args);
|
403 |
-
} else {
|
404 |
-
wp_dropdown_categories($cat_args);
|
405 |
-
echo '<script type=\'text/javascript\'>' . "\n";
|
406 |
-
echo '/* <![CDATA[ */' . "\n";
|
407 |
-
echo ' var ec_dropdown_top_' . $this->number . ' = document.getElementById("extended-categories-top-select-' . $this->number . '");' . "\n";
|
408 |
-
echo ' function ec_top_onCatChange_' . $this->number . '() {' . "\n";
|
409 |
-
echo ' if ( ec_dropdown_top_' . $this->number . '.options[ec_dropdown_top_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
|
410 |
-
echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_top_' . $this->number . '.options[ec_dropdown_top_' . $this->number . '.selectedIndex].value;' . "\n";
|
411 |
-
echo ' }' . "\n";
|
412 |
-
echo ' }' . "\n";
|
413 |
-
echo ' ec_dropdown_top_' . $this->number . '.onchange = ec_top_onCatChange_' . $this->number . ';' . "\n";
|
414 |
-
echo '/* ]]> */' . "\n";
|
415 |
-
echo '</script>' . "\n";
|
416 |
-
}
|
417 |
-
echo '</ul>';
|
418 |
-
echo $after_widget;
|
419 |
-
}
|
420 |
-
|
421 |
-
/** Update a particular instance.
|
422 |
-
*
|
423 |
-
* This function should check that $new_instance is set correctly.
|
424 |
-
* The newly calculated value of $instance should be returned.
|
425 |
-
* If "FALSE" is returned, the instance won't be saved/updated.
|
426 |
-
*
|
427 |
-
* @param array $new_instance New settings for this instance as input by the user via form()
|
428 |
-
* @param array $old_instance Old settings for this instance
|
429 |
-
* @return array Settings to save or bool FALSE to cancel saving
|
430 |
-
*/
|
431 |
-
function update ($new_instance, $old_instance)
|
432 |
-
{
|
433 |
-
// update the instance's settings
|
434 |
-
if (! isset($new_instance['submit'])) {
|
435 |
-
return FALSE;
|
436 |
-
}
|
437 |
-
|
438 |
-
$instance = $old_instance;
|
439 |
-
|
440 |
-
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
441 |
-
$instance['amount'] = (int) $new_instance['amount'];
|
442 |
-
$instance['count'] = $new_instance['count'] ? TRUE : FALSE;
|
443 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
|
444 |
-
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
445 |
-
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
446 |
-
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
447 |
-
$instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
|
448 |
-
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
449 |
-
|
450 |
-
return $instance;
|
451 |
-
}
|
452 |
-
|
453 |
-
/** Echo the settings update form
|
454 |
-
*
|
455 |
-
* @param array $instance Current settings
|
456 |
-
*/
|
457 |
-
function form ($instance)
|
458 |
-
{
|
459 |
-
// displays the widget admin form
|
460 |
-
$instance = wp_parse_args((array) $instance, array ( 'title' => '', 'rssimage' => '' ));
|
461 |
-
|
462 |
-
// Prepare data for display
|
463 |
-
if (! $amount = (int) $instance['amount']) {
|
464 |
-
$amount = 5;
|
465 |
-
}
|
466 |
-
|
467 |
-
if ($amount < 1) {
|
468 |
-
$amount = 1;
|
469 |
-
}
|
470 |
-
echo '<p>';
|
471 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
472 |
-
echo '</p>';
|
473 |
-
|
474 |
-
echo '<p>';
|
475 |
-
avh_doWidgetFormText($this->get_field_id('amount'), $this->get_field_name('amount'), __('How many categories to show', 'avh-ec'), $amount);
|
476 |
-
echo '</p>';
|
477 |
-
|
478 |
-
echo '<p>';
|
479 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
|
480 |
-
echo '<br />';
|
481 |
-
|
482 |
-
avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
|
483 |
-
echo '</p>';
|
484 |
-
|
485 |
-
echo '<p>';
|
486 |
-
$options['ID'] = __('ID', 'avh-ec');
|
487 |
-
$options['name'] = __('Name', 'avh-ec');
|
488 |
-
$options['count'] = __('Count', 'avh-ec');
|
489 |
-
$options['slug'] = __('Slug', 'avh-ec');
|
490 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
|
491 |
-
unset($options);
|
492 |
-
|
493 |
-
$options['asc'] = __('Ascending', 'avh-ec');
|
494 |
-
$options['desc'] = __('Descending', 'avh-ec');
|
495 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
|
496 |
-
unset($options);
|
497 |
-
|
498 |
-
$options['list'] = __('List', 'avh-ec');
|
499 |
-
$options['drop'] = __('Drop down', 'avh-ec');
|
500 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
|
501 |
-
unset($options);
|
502 |
-
echo '</p>';
|
503 |
-
|
504 |
-
echo '<p>';
|
505 |
-
|
506 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
|
507 |
-
|
508 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
|
509 |
-
|
510 |
-
echo '</p>';
|
511 |
-
|
512 |
-
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
513 |
-
}
|
514 |
-
}
|
515 |
-
|
516 |
-
/**
|
517 |
-
* Widget Class for displaying the grouped categories
|
518 |
-
*
|
519 |
-
*/
|
520 |
-
class WP_Widget_AVH_ExtendedCategories_Category_Group extends WP_Widget
|
521 |
-
{
|
522 |
-
/**
|
523 |
-
*
|
524 |
-
* @var AVH_EC_Core
|
525 |
-
*/
|
526 |
-
var $core;
|
527 |
-
|
528 |
-
/**
|
529 |
-
*
|
530 |
-
* @var AVH_EC_Category_Group
|
531 |
-
*/
|
532 |
-
var $catgrp;
|
533 |
-
|
534 |
-
/**
|
535 |
-
* PHP 5 Constructor
|
536 |
-
*
|
537 |
-
*/
|
538 |
-
function __construct ()
|
539 |
-
{
|
540 |
-
$this->core = & AVH_EC_Singleton::getInstance('AVH_EC_Core');
|
541 |
-
$this->catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
542 |
-
|
543 |
-
$widget_ops = array ( 'description' => __("Shows grouped categories.", 'avh-ec') );
|
544 |
-
WP_Widget::__construct(FALSE, 'AVH Extended Categories: ' . __('Category Group'), $widget_ops);
|
545 |
-
add_action('wp_print_styles', array ( &$this, 'actionWpPrintStyles' ));
|
546 |
-
|
547 |
-
}
|
548 |
-
|
549 |
-
function WP_Widget_AVH_ExtendedCategories_Category_Group ()
|
550 |
-
{
|
551 |
-
$this->__construct();
|
552 |
-
}
|
553 |
-
|
554 |
-
function actionWpPrintStyles ()
|
555 |
-
{
|
556 |
-
if (! (FALSE === is_active_widget(FALSE, FALSE, $this->id_base, TRUE))) {
|
557 |
-
wp_register_style('avhec-widget', AVHEC_PLUGIN_URL . '/css/avh-ec.widget.css', array (), $this->core->version);
|
558 |
-
wp_enqueue_style('avhec-widget');
|
559 |
-
}
|
560 |
-
}
|
561 |
-
|
562 |
-
/**
|
563 |
-
* Display the widget
|
564 |
-
*
|
565 |
-
* @param unknown_type $args
|
566 |
-
* @param unknown_type $instance
|
567 |
-
*/
|
568 |
-
function widget ($args, $instance)
|
569 |
-
{
|
570 |
-
global $post, $wp_query;
|
571 |
-
|
572 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
573 |
-
$options = $this->core->getOptions();
|
574 |
-
|
575 |
-
$row = array ();
|
576 |
-
|
577 |
-
if (is_home()) {
|
578 |
-
$special_page = 'home_group';
|
579 |
-
} elseif (is_category()) {
|
580 |
-
$special_page = 'category_group';
|
581 |
-
} elseif (is_day()) {
|
582 |
-
$special_page = 'day_group';
|
583 |
-
} elseif (is_month()) {
|
584 |
-
$special_page = 'month_group';
|
585 |
-
} elseif (is_year()) {
|
586 |
-
$special_page = 'year_group';
|
587 |
-
} elseif (is_author()) {
|
588 |
-
$special_page = 'author_group';
|
589 |
-
} elseif (is_search()) {
|
590 |
-
$special_page = 'search_group';
|
591 |
-
} else {
|
592 |
-
$special_page = 'none';
|
593 |
-
}
|
594 |
-
|
595 |
-
$toDisplay = FALSE;
|
596 |
-
if ('none' == $special_page) {
|
597 |
-
$terms = wp_get_object_terms($post->ID, $catgrp->taxonomy_name);
|
598 |
-
if (! empty($terms)) {
|
599 |
-
$selected_catgroups = unserialize($instance['post_group_category']);
|
600 |
-
foreach ($terms as $key => $value) {
|
601 |
-
if ($selected_catgroups === FALSE || array_key_exists($value->term_id, $selected_catgroups)) {
|
602 |
-
if (! ($this->getWidgetDoneCatGroup($value->term_id))) {
|
603 |
-
$row = $value;
|
604 |
-
$group_found = TRUE;
|
605 |
-
break;
|
606 |
-
}
|
607 |
-
}
|
608 |
-
}
|
609 |
-
} else {
|
610 |
-
$options = $this->core->options;
|
611 |
-
$no_cat_group = $options['cat_group']['no_group'];
|
612 |
-
$row = get_term_by('id', $no_cat_group, $catgrp->taxonomy_name);
|
613 |
-
$group_found = TRUE;
|
614 |
-
}
|
615 |
-
} else {
|
616 |
-
if ('category_group' == $special_page) {
|
617 |
-
$tax_meta = get_option($this->core->db_options_tax_meta);
|
618 |
-
$term = $wp_query->get_queried_object();
|
619 |
-
if (isset($tax_meta[$term->taxonomy][$term->term_id]['category_group_term_id'])) {
|
620 |
-
$sp_category_group_id = $tax_meta[$term->taxonomy][$term->term_id]['category_group_term_id'];
|
621 |
-
} else {
|
622 |
-
$sp_category_group = $this->catgrp->getGroupByCategoryID($term->term_id);
|
623 |
-
$sp_category_group_id = $sp_category_group->term_id;
|
624 |
-
}
|
625 |
-
} else {
|
626 |
-
$sp_category_group_id = $options['sp_cat_group'][$special_page];
|
627 |
-
}
|
628 |
-
$row = get_term_by('id', $sp_category_group_id, $catgrp->taxonomy_name); // Returns FALSE when non-existance. (empty(FALSE)=TRUE)
|
629 |
-
$group_found = TRUE;
|
630 |
-
}
|
631 |
-
|
632 |
-
if ($group_found) {
|
633 |
-
$toDisplay = TRUE;
|
634 |
-
$category_group_id_none = $this->catgrp->getTermIDBy('slug', 'none');
|
635 |
-
$selected_catgroups = unserialize($instance['post_group_category']);
|
636 |
-
|
637 |
-
if ($category_group_id_none == $row->term_id) {
|
638 |
-
$toDisplay = FALSE;
|
639 |
-
} elseif (! (FALSE == $selected_catgroups || array_key_exists($row->term_id, $selected_catgroups))) {
|
640 |
-
$toDisplay = FALSE;
|
641 |
-
} elseif ($special_page != 'none' && $this->getWidgetDoneCatGroup($sp_category_group_id)) {
|
642 |
-
$toDisplay = FALSE;
|
643 |
-
}
|
644 |
-
}
|
645 |
-
|
646 |
-
if ($toDisplay) {
|
647 |
-
extract($args);
|
648 |
-
|
649 |
-
$c = $instance['count'] ? TRUE : FALSE;
|
650 |
-
$e = $instance['hide_empty'] ? TRUE : FALSE;
|
651 |
-
$h = $instance['hierarchical'] ? TRUE : FALSE;
|
652 |
-
$use_desc_for_title = $instance['use_desc_for_title'] ? TRUE : FALSE;
|
653 |
-
$s = $instance['sort_column'] ? $instance['sort_column'] : 'name';
|
654 |
-
$o = $instance['sort_order'] ? $instance['sort_order'] : 'asc';
|
655 |
-
$r = $instance['rssfeed'] ? 'RSS' : '';
|
656 |
-
$i = $instance['rssimage'] ? $instance['rssimage'] : '';
|
657 |
-
|
658 |
-
if (empty($r)) {
|
659 |
-
$i = '';
|
660 |
-
}
|
661 |
-
|
662 |
-
$style = empty($instance['style']) ? 'list' : $instance['style'];
|
663 |
-
$group_id = $row->term_id;
|
664 |
-
$cats = $catgrp->getCategoriesFromGroup($group_id);
|
665 |
-
if (empty($instance['title'])) {
|
666 |
-
$title = $catgrp->getWidgetTitleForGroup($group_id);
|
667 |
-
if (! $title) {
|
668 |
-
$title = __('Categories', 'avh-ec');
|
669 |
-
}
|
670 |
-
} else {
|
671 |
-
$title = $instance['title'];
|
672 |
-
}
|
673 |
-
$title = apply_filters('widget_title', $title);
|
674 |
-
|
675 |
-
$included_cats = implode(',', $cats);
|
676 |
-
|
677 |
-
$show_option_none = __('Select Category', 'avh-ec');
|
678 |
-
if ($options['general']['alternative_name_select_category']) {
|
679 |
-
$show_option_none = $options['general']['alternative_name_select_category'];
|
680 |
-
}
|
681 |
-
|
682 |
-
$cat_args = array ( 'include' => $included_cats, 'orderby' => $s, 'order' => $o, 'show_count' => $c, 'use_desc_for_title' => $use_desc_for_title, 'hide_empty' => $e, 'hierarchical' => $h, 'title_li' => '', 'show_option_none' => $show_option_none, 'feed' => $r, 'feed_image' => $i, 'name' => 'extended-categories-select-group-' . $this->number );
|
683 |
-
echo $before_widget;
|
684 |
-
echo $this->core->comment;
|
685 |
-
echo $before_title . $title . $after_title;
|
686 |
-
|
687 |
-
if ($style == 'list') {
|
688 |
-
echo '<ul>';
|
689 |
-
$this->core->avh_wp_list_categories($cat_args, TRUE);
|
690 |
-
echo '</ul>';
|
691 |
-
} else {
|
692 |
-
$this->core->avh_wp_dropdown_categories($cat_args, TRUE);
|
693 |
-
echo '<script type=\'text/javascript\'>' . "\n";
|
694 |
-
echo '/* <![CDATA[ */' . "\n";
|
695 |
-
echo ' var ec_dropdown_' . $this->number . ' = document.getElementById("extended-categories-select-group-' . $this->number . '");' . "\n";
|
696 |
-
echo ' function ec_onCatChange_' . $this->number . '() {' . "\n";
|
697 |
-
echo ' if ( ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value > 0 ) {' . "\n";
|
698 |
-
echo ' location.href = "' . get_option('home') . '/?cat="+ec_dropdown_' . $this->number . '.options[ec_dropdown_' . $this->number . '.selectedIndex].value;' . "\n";
|
699 |
-
echo ' }' . "\n";
|
700 |
-
echo ' }' . "\n";
|
701 |
-
echo ' ec_dropdown_' . $this->number . '.onchange = ec_onCatChange_' . $this->number . ';' . "\n";
|
702 |
-
echo '/* ]]> */' . "\n";
|
703 |
-
echo '</script>' . "\n";
|
704 |
-
}
|
705 |
-
echo $after_widget;
|
706 |
-
}
|
707 |
-
}
|
708 |
-
|
709 |
-
/**
|
710 |
-
* When Widget Control Form Is Posted
|
711 |
-
*
|
712 |
-
* @param unknown_type $new_instance
|
713 |
-
* @param unknown_type $old_instance
|
714 |
-
* @return unknown
|
715 |
-
*/
|
716 |
-
function update ($new_instance, $old_instance)
|
717 |
-
{
|
718 |
-
// update the instance's settings
|
719 |
-
if (! isset($new_instance['submit'])) {
|
720 |
-
return FALSE;
|
721 |
-
}
|
722 |
-
|
723 |
-
$instance = $old_instance;
|
724 |
-
|
725 |
-
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
|
726 |
-
$instance['count'] = $new_instance['count'] ? TRUE : FALSE;
|
727 |
-
$instance['hierarchical'] = $new_instance['hierarchical'] ? TRUE : FALSE;
|
728 |
-
$instance['hide_empty'] = $new_instance['hide_empty'] ? TRUE : FALSE;
|
729 |
-
$instance['use_desc_for_title'] = $new_instance['use_desc_for_title'] ? TRUE : FALSE;
|
730 |
-
$instance['sort_column'] = strip_tags(stripslashes($new_instance['sort_column']));
|
731 |
-
$instance['sort_order'] = strip_tags(stripslashes($new_instance['sort_order']));
|
732 |
-
$instance['style'] = strip_tags(stripslashes($new_instance['style']));
|
733 |
-
$instance['rssfeed'] = $new_instance['rssfeed'] ? TRUE : FALSE;
|
734 |
-
$instance['rssimage'] = strip_tags(stripslashes($new_instance['rssimage']));
|
735 |
-
if (array_key_exists('all', $new_instance['post_group_category'])) {
|
736 |
-
$instance['post_group_category'] = FALSE;
|
737 |
-
} else {
|
738 |
-
$instance['post_group_category'] = serialize($new_instance['post_group_category']);
|
739 |
-
}
|
740 |
-
return $instance;
|
741 |
-
}
|
742 |
-
|
743 |
-
/**
|
744 |
-
* Display Widget Control Form
|
745 |
-
*
|
746 |
-
* @param unknown_type $instance
|
747 |
-
*/
|
748 |
-
function form ($instance)
|
749 |
-
{
|
750 |
-
// displays the widget admin form
|
751 |
-
$instance = wp_parse_args((array) $instance, array ( 'title' => '', 'rssimage' => '' ));
|
752 |
-
|
753 |
-
// Prepare data for display
|
754 |
-
$title = esc_attr($instance['title']);
|
755 |
-
$count = (bool) $instance['count'];
|
756 |
-
$hierarchical = (bool) $instance['hierarchical'];
|
757 |
-
$hide_empty = (bool) $instance['hide_empty'];
|
758 |
-
$use_desc_for_title = (bool) $instance['use_desc_for_title'];
|
759 |
-
$sort_id = ($instance['sort_column'] == 'ID') ? ' SELECTED' : '';
|
760 |
-
$sort_name = ($instance['sort_column'] == 'name') ? ' SELECTED' : '';
|
761 |
-
$sort_count = ($instance['sort_column'] == 'count') ? ' SELECTED' : '';
|
762 |
-
$sort_order_a = ($instance['sort_order'] == 'asc') ? ' SELECTED' : '';
|
763 |
-
$sort_order_d = ($instance['sort_order'] == 'desc') ? ' SELECTED' : '';
|
764 |
-
$style_list = ($instance['style'] == 'list') ? ' SELECTED' : '';
|
765 |
-
$style_drop = ($instance['style'] == 'drop') ? ' SELECTED' : '';
|
766 |
-
$rssfeed = (bool) $instance['rssfeed'];
|
767 |
-
$rssimage = esc_attr($instance['rssimage']);
|
768 |
-
|
769 |
-
$selected_cats = ($instance['post_group_category'] != '') ? unserialize($instance['post_group_category']) : FALSE;
|
770 |
-
ob_start();
|
771 |
-
echo '<p>';
|
772 |
-
avh_doWidgetFormText($this->get_field_id('title'), $this->get_field_name('title'), __('Title', 'avh-ec'), $instance['title']);
|
773 |
-
echo '</p>';
|
774 |
-
|
775 |
-
echo '<p>';
|
776 |
-
|
777 |
-
avh_doWidgetFormCheckbox($this->get_field_id('count'), $this->get_field_name('count'), __('Show post counts', 'avh-ec'), (bool) $instance['count']);
|
778 |
-
|
779 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hierarchical'), $this->get_field_name('hierarchical'), __('Show hierarchy', 'avh-ec'), (bool) $instance['hierarchical']);
|
780 |
-
|
781 |
-
avh_doWidgetFormCheckbox($this->get_field_id('hide_empty'), $this->get_field_name('hide_empty'), __('Hide empty categories', 'avh-ec'), (bool) $instance['hide_empty']);
|
782 |
-
|
783 |
-
avh_doWidgetFormCheckbox($this->get_field_id('use_desc_for_title'), $this->get_field_name('use_desc_for_title'), __('Use description for title', 'avh-ec'), (bool) $instance['use_desc_for_title']);
|
784 |
-
echo '</p>';
|
785 |
-
|
786 |
-
echo '<p>';
|
787 |
-
$options['ID'] = __('ID', 'avh-ec');
|
788 |
-
$options['name'] = __('Name', 'avh-ec');
|
789 |
-
$options['count'] = __('Count', 'avh-ec');
|
790 |
-
$options['slug'] = __('Slug', 'avh-ec');
|
791 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_column'), $this->get_field_name('sort_column'), __('Sort by', 'avh-ec'), $options, $instance['sort_column']);
|
792 |
-
unset($options);
|
793 |
-
|
794 |
-
$options['asc'] = __('Ascending', 'avh-ec');
|
795 |
-
$options['desc'] = __('Descending', 'avh-ec');
|
796 |
-
avh_doWidgetFormSelect($this->get_field_id('sort_order'), $this->get_field_name('sort_order'), __('Sort order', 'avh-ec'), $options, $instance['sort_order']);
|
797 |
-
unset($options);
|
798 |
-
|
799 |
-
$options['list'] = __('List', 'avh-ec');
|
800 |
-
$options['drop'] = __('Drop down', 'avh-ec');
|
801 |
-
avh_doWidgetFormSelect($this->get_field_id('style'), $this->get_field_name('style'), __('Display style', 'avh-ec'), $options, $instance['style']);
|
802 |
-
unset($options);
|
803 |
-
echo '</p>';
|
804 |
-
|
805 |
-
echo '<p>';
|
806 |
-
|
807 |
-
avh_doWidgetFormCheckbox($this->get_field_id('rssfeed'), $this->get_field_name('rssfeed'), __('Show RSS Feed', 'avh-ec'), (bool) $instance['rssfeed']);
|
808 |
-
|
809 |
-
avh_doWidgetFormText($this->get_field_id('rssimage'), $this->get_field_name('rssimage'), __('Path (URI) to RSS image', 'avh-ec'), $instance['rssimage']);
|
810 |
-
echo '</p>';
|
811 |
-
|
812 |
-
echo '<p>';
|
813 |
-
echo '<b>' . __('Select Groups', 'avh-ec') . '</b><hr />';
|
814 |
-
echo '<ul id="categorychecklist" class="list:category categorychecklist form-no-clear" style="list-style-type: none; margin-left: 5px; padding-left: 0px; margin-bottom: 20px;">';
|
815 |
-
echo '<li id="' . $this->get_field_id('group_category--1') . '" class="popular-group_category">';
|
816 |
-
echo '<label for="' . $this->get_field_id('group_post_category') . '" class="selectit">';
|
817 |
-
echo '<input value="all" id="' . $this->get_field_id('group_post_category') . '" name="' . $this->get_field_name('post_group_category') . '[all]" type="checkbox" ' . (FALSE === $selected_cats ? ' CHECKED' : '') . '> ';
|
818 |
-
_e('Any Group', 'avh-ec');
|
819 |
-
echo '</label>';
|
820 |
-
echo '</li>';
|
821 |
-
|
822 |
-
$this->avh_wp_group_category_checklist($selected_cats, $this->number);
|
823 |
-
|
824 |
-
echo '</ul>';
|
825 |
-
echo '</p>';
|
826 |
-
|
827 |
-
echo '<input type="hidden" id="' . $this->get_field_id('submit') . '" name="' . $this->get_field_name('submit') . '" value="1" />';
|
828 |
-
ob_end_flush();
|
829 |
-
}
|
830 |
-
|
831 |
-
function avh_wp_group_category_checklist ($selected_cats, $number)
|
832 |
-
{
|
833 |
-
|
834 |
-
$walker = new AVH_Walker_Category_Checklist();
|
835 |
-
$walker->number = $number;
|
836 |
-
$walker->input_id = $this->get_field_id('post_group_category');
|
837 |
-
$walker->input_name = $this->get_field_name('post_group_category');
|
838 |
-
$walker->li_id = $this->get_field_id('group_category--1');
|
839 |
-
|
840 |
-
$args = array ( 'taxonomy' => 'avhec_catgroup', 'descendants_and_self' => 0, 'selected_cats' => array (), 'popular_cats' => array (), 'walker' => $walker, 'checked_ontop' => true );
|
841 |
-
|
842 |
-
if (is_array($selected_cats))
|
843 |
-
$args['selected_cats'] = $selected_cats;
|
844 |
-
else
|
845 |
-
$args['selected_cats'] = array ();
|
846 |
-
|
847 |
-
$categories = (array) get_terms($args['taxonomy'], array ( 'get' => 'all' ));
|
848 |
-
|
849 |
-
// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
|
850 |
-
$checked_categories = array ();
|
851 |
-
$keys = array_keys($categories);
|
852 |
-
|
853 |
-
foreach ($keys as $k) {
|
854 |
-
if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
|
855 |
-
$checked_categories[] = $categories[$k];
|
856 |
-
unset($categories[$k]);
|
857 |
-
}
|
858 |
-
}
|
859 |
-
|
860 |
-
// Put checked cats on top
|
861 |
-
echo $walker->walk($checked_categories, 0, array ( $args ));
|
862 |
-
// Then the rest of them
|
863 |
-
echo $walker->walk($categories, 0, array ( $args ));
|
864 |
-
}
|
865 |
-
|
866 |
-
function getWidgetDoneCatGroup ($id)
|
867 |
-
{
|
868 |
-
$catgrp = & AVH_EC_Singleton::getInstance('AVH_EC_Category_Group');
|
869 |
-
if (is_array($catgrp->widget_done_catgroup) && array_key_exists($id, $catgrp->widget_done_catgroup)) {
|
870 |
-
return TRUE;
|
871 |
-
}
|
872 |
-
$catgrp->widget_done_catgroup[$id] = TRUE;
|
873 |
-
return FALSE;
|
874 |
-
}
|
875 |
-
}
|
876 |
-
|
877 |
-
/**
|
878 |
-
* Class that will display the categories
|
879 |
-
*
|
880 |
-
*/
|
881 |
-
class AVH_Walker_Category_Checklist extends Walker
|
882 |
-
{
|
883 |
-
var $tree_type = 'category';
|
884 |
-
var $db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' ); //TODO: decouple this
|
885 |
-
var $number;
|
886 |
-
var $input_id;
|
887 |
-
var $input_name;
|
888 |
-
var $li_id;
|
889 |
-
|
890 |
-
/**
|
891 |
-
* Display array of elements hierarchically.
|
892 |
-
*
|
893 |
-
* It is a generic function which does not assume any existing order of
|
894 |
-
* elements. max_depth = -1 means flatly display every element. max_depth =
|
895 |
-
* 0 means display all levels. max_depth > 0 specifies the number of
|
896 |
-
* display levels.
|
897 |
-
*
|
898 |
-
* @since 2.1.0
|
899 |
-
*
|
900 |
-
* @param array $elements
|
901 |
-
* @param int $max_depth
|
902 |
-
* @param array $args;
|
903 |
-
* @return string
|
904 |
-
*/
|
905 |
-
function walk ($elements, $max_depth, $args)
|
906 |
-
{
|
907 |
-
|
908 |
-
$output = '';
|
909 |
-
|
910 |
-
if ($max_depth < - 1) //invalid parameter
|
911 |
-
return $output;
|
912 |
-
|
913 |
-
if (empty($elements)) //nothing to walk
|
914 |
-
return $output;
|
915 |
-
|
916 |
-
$id_field = $this->db_fields['id'];
|
917 |
-
$parent_field = $this->db_fields['parent'];
|
918 |
-
|
919 |
-
// flat display
|
920 |
-
if (- 1 == $max_depth) {
|
921 |
-
$empty_array = array ();
|
922 |
-
foreach ($elements as $e)
|
923 |
-
$this->display_element($e, $empty_array, 1, 0, $args, $output);
|
924 |
-
return $output;
|
925 |
-
}
|
926 |
-
|
927 |
-
/*
|
928 |
-
* need to display in hierarchical order
|
929 |
-
* separate elements into two buckets: top level and children elements
|
930 |
-
* children_elements is two dimensional array, eg.
|
931 |
-
* children_elements[10][] contains all sub-elements whose parent is 10.
|
932 |
-
*/
|
933 |
-
$top_level_elements = array ();
|
934 |
-
$children_elements = array ();
|
935 |
-
foreach ($elements as $e) {
|
936 |
-
if (0 == $e->$parent_field)
|
937 |
-
$top_level_elements[] = $e;
|
938 |
-
else
|
939 |
-
$children_elements[$e->$parent_field][] = $e;
|
940 |
-
}
|
941 |
-
|
942 |
-
/*
|
943 |
-
* when none of the elements is top level
|
944 |
-
* assume the first one must be root of the sub elements
|
945 |
-
*/
|
946 |
-
if (empty($top_level_elements)) {
|
947 |
-
|
948 |
-
$first = array_slice($elements, 0, 1);
|
949 |
-
$root = $first[0];
|
950 |
-
|
951 |
-
$top_level_elements = array ();
|
952 |
-
$children_elements = array ();
|
953 |
-
foreach ($elements as $e) {
|
954 |
-
if ($root->$parent_field == $e->$parent_field)
|
955 |
-
$top_level_elements[] = $e;
|
956 |
-
else
|
957 |
-
$children_elements[$e->$parent_field][] = $e;
|
958 |
-
}
|
959 |
-
}
|
960 |
-
|
961 |
-
foreach ($top_level_elements as $e)
|
962 |
-
$this->display_element($e, $children_elements, $max_depth, 0, $args, $output);
|
963 |
-
|
964 |
-
/*
|
965 |
-
* if we are displaying all levels, and remaining children_elements is not empty,
|
966 |
-
* then we got orphans, which should be displayed regardless
|
967 |
-
*/
|
968 |
-
if (($max_depth == 0) && count($children_elements) > 0) {
|
969 |
-
$empty_array = array ();
|
970 |
-
foreach ($children_elements as $orphans)
|
971 |
-
foreach ($orphans as $op)
|
972 |
-
$this->display_element($op, $empty_array, 1, 0, $args, $output);
|
973 |
-
}
|
974 |
-
|
975 |
-
return $output;
|
976 |
-
}
|
977 |
-
|
978 |
-
function start_lvl (&$output, $depth, $args)
|
979 |
-
{
|
980 |
-
$indent = str_repeat("\t", $depth);
|
981 |
-
$output .= $indent . '<ul class="children">' . "\n";
|
982 |
-
}
|
983 |
-
|
984 |
-
function end_lvl (&$output, $depth, $args)
|
985 |
-
{
|
986 |
-
$indent = str_repeat("\t", $depth);
|
987 |
-
$output .= $indent . '</ul>' . "\n";
|
988 |
-
}
|
989 |
-
|
990 |
-
function start_el (&$output, $category, $depth, $args)
|
991 |
-
{
|
992 |
-
extract($args);
|
993 |
-
$input_id = $this->input_id . '-' . $category->term_id;
|
994 |
-
$output .= "\n" . '<li id="' . $this->li_id . '">';
|
995 |
-
$output .= '<label for="' . $input_id . '" class="selectit">';
|
996 |
-
$output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $category->term_id . ']" id="' . $input_id . '"' . (in_array($category->term_id, $selected_cats) ? ' checked="checked"' : "") . '/> ' . esc_html(apply_filters('the_category', $category->name)) . '</label>';
|
997 |
-
}
|
998 |
-
|
999 |
-
function end_el (&$output, $category, $depth, $args)
|
1000 |
-
{
|
1001 |
-
$output .= "</li>\n";
|
1002 |
-
}
|
1003 |
-
}
|
1004 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/css/avh-ec.admin.css
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
.footer_avhec {
|
2 |
-
font-size: 0.8em;
|
3 |
-
text-align: center;
|
4 |
-
}
|
5 |
-
|
6 |
-
div.clearer {
|
7 |
-
clear: both;
|
8 |
-
line-height: 1px;
|
9 |
-
font-size: 1px;
|
10 |
-
height: 1px;
|
11 |
-
}
|
12 |
-
|
13 |
-
/* Metabox in General */
|
14 |
-
table.avhec-options {
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
.avhec-metabox-wrap {
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
-
.avhec-metabox-wrap .p {
|
23 |
-
line-height: 140%;
|
24 |
-
margin: 1em 0;
|
25 |
-
}
|
26 |
-
|
27 |
-
#avhecBoxOptions option {
|
28 |
-
padding: .5em;
|
29 |
-
}
|
30 |
-
|
31 |
-
.avhec-metabox-wrap span.description {
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
.avhec-metabox-wrap .b {
|
36 |
-
font-weight: bold;
|
37 |
-
}
|
38 |
-
|
39 |
-
.avhec-metabox-wrap ul {
|
40 |
-
margin-bottom: 1em;
|
41 |
-
}
|
42 |
-
|
43 |
-
.avhec-metabox-wrap ul li {
|
44 |
-
line-height: 120%;
|
45 |
-
list-style: disc inside none;
|
46 |
-
margin-bottom: 0;
|
47 |
-
}
|
48 |
-
|
49 |
-
#avhec-options input {
|
50 |
-
|
51 |
-
}
|
52 |
-
|
53 |
-
#avhec-generaloptions input {
|
54 |
-
|
55 |
-
}
|
56 |
-
|
57 |
-
/* Metabox FAQ */
|
58 |
-
#avhecBoxFAQ .inside ul {
|
59 |
-
margin-bottom: 6px;
|
60 |
-
}
|
61 |
-
|
62 |
-
#avhecBoxFAQ .inside ul li {
|
63 |
-
line-height: 120%;
|
64 |
-
list-style: disc inside none;
|
65 |
-
margin-bottom: 0;
|
66 |
-
}
|
67 |
-
|
68 |
-
/* Metabox Donations*/
|
69 |
-
#avhecBoxDonations .inside {
|
70 |
-
|
71 |
-
}
|
72 |
-
|
73 |
-
#avhecBoxDonations .versions {
|
74 |
-
padding: 6px 10px 12px;
|
75 |
-
}
|
76 |
-
|
77 |
-
/* Metabox Donations*/
|
78 |
-
#avhecBoxTranslation .inside {
|
79 |
-
|
80 |
-
}
|
81 |
-
|
82 |
-
/* Metabox in post and page */
|
83 |
-
#post_avhec_category_group {
|
84 |
-
width: 100%;
|
85 |
-
}
|
86 |
-
|
87 |
-
#avhec-catlist {
|
88 |
-
-moz-border-radius: 4px 4px 4px 4px;
|
89 |
-
background-color: #FFFFFF;
|
90 |
-
border: 1px solid #DFDFDF;
|
91 |
-
height: 20em;
|
92 |
-
margin-bottom: -1.8em;
|
93 |
-
overflow: auto;
|
94 |
-
width: 95%;
|
95 |
-
}
|
96 |
-
|
97 |
-
#avhec-catlist ul {
|
98 |
-
padding: 3px;
|
99 |
-
}
|
100 |
-
|
101 |
-
#avhec-catlist li ul {
|
102 |
-
padding: 0px;
|
103 |
-
}
|
104 |
-
|
105 |
-
#avhec-catlist li {
|
106 |
-
margin-bottom: 0px;
|
107 |
-
}
|
108 |
-
|
109 |
-
#avhecManualOrder {
|
110 |
-
width: 25%;
|
111 |
-
/* border: 1px solid #B2B2B2;*/
|
112 |
-
/* margin: 10px 10px 10px 0px;*/
|
113 |
-
/* padding: 5px 10px 5px 10px;*/
|
114 |
-
/* list-style: none;*/
|
115 |
-
/* background-color: #fff;*/
|
116 |
-
/* border-radius: 3px;*/
|
117 |
-
/* -webkit-border-radius: 3px;*/
|
118 |
-
}
|
119 |
-
|
120 |
-
#avhecManualOrder li.lineitem {
|
121 |
-
border: 1px solid #DFDFDF;
|
122 |
-
background-image: none;
|
123 |
-
border-radius: 3px;
|
124 |
-
-webkit-border-radius: 3px;
|
125 |
-
background-color: #FFFFFF;
|
126 |
-
color: #555555;
|
127 |
-
cursor: move;
|
128 |
-
margin-top: 5px;
|
129 |
-
margin-bottom: 5px;
|
130 |
-
padding: 2px 5px 2px 5px;
|
131 |
-
list-style: none outside none;
|
132 |
-
}
|
133 |
-
|
134 |
-
#avhecManualOrder .sortable-placeholder {
|
135 |
-
border: 1px dashed #B2B2B2;
|
136 |
-
margin-top: 5px;
|
137 |
-
margin-bottom: 5px;
|
138 |
-
padding: 2px 5px 2px 5px;
|
139 |
-
height: 1.5em;
|
140 |
-
line-height: 1.5em;
|
141 |
-
list-style: none outside none;
|
142 |
-
background-color: transparent;
|
143 |
-
/* IE10 */
|
144 |
-
background-image: -ms-linear-gradient(top, #f9f9f9, #f5f5f5);
|
145 |
-
/* Firefox */
|
146 |
-
background-image: -moz-linear-gradient(top, #f9f9f9, #f5f5f5);
|
147 |
-
/* Opera */
|
148 |
-
background-image: -o-linear-gradient(top, #f9f9f9, #f5f5f5);
|
149 |
-
/* old Webkit */
|
150 |
-
background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f5f5f5) );
|
151 |
-
/* new Webkit */
|
152 |
-
background-image: -webkit-linear-gradient(top, #f9f9f9, #f5f5f5);
|
153 |
-
/* proposed W3C Markup */
|
154 |
-
background-image: linear-gradient(top, #f9f9f9, #f5f5f5);
|
155 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/css/avh-ec.widget.css
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
/* AVH Extended Categories Widget CSS */
|
2 |
-
.avhec-widget-line {
|
3 |
-
display: inline-block;
|
4 |
-
}
|
5 |
-
|
6 |
-
.avhec-widget-count {
|
7 |
-
display: inline;
|
8 |
-
}
|
9 |
-
|
10 |
-
.avhec-widget-rss {
|
11 |
-
display: inline;
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/helpers/avh-forms.php
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! function_exists('avh_doWidgetFormText')) {
|
3 |
-
|
4 |
-
function avh_doWidgetFormText ($field_id, $field_name, $description, $value)
|
5 |
-
{
|
6 |
-
echo '<label for="' . $field_id . '">';
|
7 |
-
echo $description;
|
8 |
-
echo '<input class="widefat" id="' . $field_id . '" name="' . $field_name . '" type="text" value="' . esc_attr($value) . '" /> ';
|
9 |
-
echo '</label>';
|
10 |
-
echo '<br />';
|
11 |
-
}
|
12 |
-
}
|
13 |
-
|
14 |
-
if (! function_exists('avh_doWidgetFormCheckbox')) {
|
15 |
-
|
16 |
-
function avh_doWidgetFormCheckbox ($field_id, $field_name, $description, $is_checked = FALSE)
|
17 |
-
{
|
18 |
-
|
19 |
-
echo '<label for="' . $field_id . '">';
|
20 |
-
echo '<input class="checkbox" type="checkbox" id="' . $field_id . '" name="' . $field_name . '"' . ($is_checked ? ' CHECKED' : '') . ' /> ';
|
21 |
-
echo $description;
|
22 |
-
echo '</label>';
|
23 |
-
echo '<br />';
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
if (! function_exists('avh_doWidgetFormSelect')) {
|
28 |
-
|
29 |
-
function avh_doWidgetFormSelect ($field_id, $field_name, $description, $options, $selected_value)
|
30 |
-
{
|
31 |
-
echo '<label for="' . $field_id . '">';
|
32 |
-
echo $description . ' ';
|
33 |
-
echo '</label>';
|
34 |
-
|
35 |
-
$data = '';
|
36 |
-
foreach ($options as $value => $text) {
|
37 |
-
$data .= '<option value="' . $value . '" ' . ($value == $selected_value ? "SELECTED" : '') . '>' . $text . '</option>' . "/n";
|
38 |
-
}
|
39 |
-
echo '<select id="' . $field_id . '" name="' . $field_name . '"> ';
|
40 |
-
echo $data;
|
41 |
-
echo '</select>';
|
42 |
-
echo '<br />';
|
43 |
-
}
|
44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/images/us_banner_logow_120x60.gif
DELETED
Binary file
|
trunk/3.3/js/avh-ec.admin.manualorder.closure.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
function avhecManualOrder(){jQuery("#avhecManualOrder").sortable({placeholder:"sortable-placeholder",revert:false,items:".lineitem",opacity:0.65,cursor:"move",forcePlaceholderSize:true,tolerance:"pointer"})}addLoadEvent(avhecManualOrder);function orderCats(){jQuery("#updateText").html("Updating Category Order...");jQuery("#hdnManualOrder").val(jQuery("#avhecManualOrder").sortable("toArray"))};
|
|
trunk/3.3/js/avh-ec.admin.manualorder.js
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
function avhecManualOrder() {
|
2 |
-
jQuery("#avhecManualOrder").sortable({
|
3 |
-
placeholder : "sortable-placeholder",
|
4 |
-
revert : false,
|
5 |
-
items : '.lineitem',
|
6 |
-
opacity: 0.65,
|
7 |
-
cursor: 'move',
|
8 |
-
forcePlaceholderSize: true,
|
9 |
-
tolerance : "pointer"
|
10 |
-
});
|
11 |
-
};
|
12 |
-
|
13 |
-
addLoadEvent(avhecManualOrder);
|
14 |
-
|
15 |
-
function orderCats() {
|
16 |
-
jQuery("#updateText").html("Updating Category Order...");
|
17 |
-
jQuery("#hdnManualOrder").val(
|
18 |
-
jQuery("#avhecManualOrder").sortable("toArray"));
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/3.3/js/avh-ec.categorygroup.closure.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(a){a("#the-list").wpList({delBefore:function(b){if("undefined"!=showNotice)return showNotice.warn()?b:false;return b}});a('.delete a[class^="delete"]').live("click",function(){return false})});
|
|
trunk/3.3/js/avh-ec.categorygroup.js
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
var options = false, delBefore, delAfter;
|
3 |
-
|
4 |
-
delAfter = function( r, settings ) {
|
5 |
-
var id = $('cat', r).attr('id'), o;
|
6 |
-
for ( o = 0; o < options.length; o++ )
|
7 |
-
if ( id == options[o].value )
|
8 |
-
options[o] = null;
|
9 |
-
};
|
10 |
-
|
11 |
-
delBefore = function(s) {
|
12 |
-
if ( 'undefined' != showNotice )
|
13 |
-
return showNotice.warn() ? s : false;
|
14 |
-
|
15 |
-
return s;
|
16 |
-
};
|
17 |
-
|
18 |
-
$('#the-list').wpList({ delBefore: delBefore });
|
19 |
-
|
20 |
-
$('.delete a[class^="delete"]').live('click', function(){return false;});
|
21 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/lang/avh-ec-cs_CZ.mo
DELETED
Binary file
|
trunk/lang/avh-ec-de_DE.mo
DELETED
Binary file
|
trunk/lang/avh-ec-el.mo
DELETED
Binary file
|
trunk/lang/avh-ec-en_US.mo
DELETED
Binary file
|
trunk/lang/avh-ec-es_ES.mo
DELETED
Binary file
|
trunk/lang/avh-ec-id_ID.mo
DELETED
Binary file
|
trunk/lang/avh-ec-it_IT.mo
DELETED
Binary file
|
trunk/lang/avh-ec-nl_NL.mo
DELETED
Binary file
|
trunk/lang/avh-ec-ru_RU.mo
DELETED
Binary file
|
trunk/lang/avh-ec-sv_SE.mo
DELETED
Binary file
|
trunk/lang/avh-ec-tr.mo
DELETED
Binary file
|
trunk/lang/avh-ec.mo
DELETED
Binary file
|
trunk/lang/avh-ec.po
DELETED
@@ -1,1056 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: AVH Extended Categories\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2012-01-17 19:13-0500\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: Peter van der Does <avhsoftware@avirtualhome.com>\n"
|
8 |
-
"Language-Team: \n"
|
9 |
-
"Language: \n"
|
10 |
-
"MIME-Version: 1.0\n"
|
11 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
-
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
14 |
-
"X-Poedit-KeywordsList: __ngettext:1,2;__;_e\n"
|
15 |
-
"X-Poedit-Basepath: ..\n"
|
16 |
-
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
17 |
-
"X-Poedit-Language: English\n"
|
18 |
-
"X-Poedit-Country: UNITED STATES\n"
|
19 |
-
"X-Poedit-SearchPath-0: .\n"
|
20 |
-
|
21 |
-
#: widget-pre2.8.php:33
|
22 |
-
#: 3.3/class/avh-ec.widgets.php:81
|
23 |
-
#: 3.3/class/avh-ec.widgets.php:364
|
24 |
-
#: 3.3/class/avh-ec.widgets.php:668
|
25 |
-
#: 3.3/class/avh-ec.admin.php:476
|
26 |
-
#: 3.3/class/avh-ec.core.php:417
|
27 |
-
#: 2.8/class/avh-ec.widgets.php:81
|
28 |
-
#: 2.8/class/avh-ec.widgets.php:363
|
29 |
-
#: 2.8/class/avh-ec.widgets.php:667
|
30 |
-
#: 2.8/class/avh-ec.admin.php:491
|
31 |
-
#: 2.8/class/avh-ec.core.php:417
|
32 |
-
msgid "Categories"
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: widget-pre2.8.php:40
|
36 |
-
#: widget-pre2.8.php:42
|
37 |
-
#: 3.3/class/avh-ec.widgets.php:103
|
38 |
-
#: 3.3/class/avh-ec.widgets.php:387
|
39 |
-
#: 3.3/class/avh-ec.widgets.php:677
|
40 |
-
#: 2.8/class/avh-ec.widgets.php:103
|
41 |
-
#: 2.8/class/avh-ec.widgets.php:386
|
42 |
-
#: 2.8/class/avh-ec.widgets.php:676
|
43 |
-
msgid "Select Category"
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: widget-pre2.8.php:153
|
47 |
-
msgid "Title:"
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: widget-pre2.8.php:266
|
51 |
-
msgid "Path (URI) to RSS image:"
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
#: widget-pre2.8.php:340
|
55 |
-
msgid "AVH Extended Categories Widgets"
|
56 |
-
msgstr ""
|
57 |
-
|
58 |
-
#: widget-pre2.8.php:343
|
59 |
-
msgid "How many wishlist widgets would you like?"
|
60 |
-
msgstr ""
|
61 |
-
|
62 |
-
#: widget-pre2.8.php:358
|
63 |
-
msgid "Save"
|
64 |
-
msgstr ""
|
65 |
-
|
66 |
-
#: widget-pre2.8.php:376
|
67 |
-
#, php-format
|
68 |
-
msgid "Extended Categories %d"
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: 3.3/class/avh-ec.widgets.php:29
|
72 |
-
#: 2.8/class/avh-ec.widgets.php:29
|
73 |
-
msgid "An extended version of the default Categories widget."
|
74 |
-
msgstr ""
|
75 |
-
|
76 |
-
#: 3.3/class/avh-ec.widgets.php:193
|
77 |
-
#: 3.3/class/avh-ec.widgets.php:471
|
78 |
-
#: 3.3/class/avh-ec.widgets.php:772
|
79 |
-
#: 2.8/class/avh-ec.widgets.php:193
|
80 |
-
#: 2.8/class/avh-ec.widgets.php:470
|
81 |
-
#: 2.8/class/avh-ec.widgets.php:771
|
82 |
-
msgid "Title"
|
83 |
-
msgstr ""
|
84 |
-
|
85 |
-
#: 3.3/class/avh-ec.widgets.php:197
|
86 |
-
#: 2.8/class/avh-ec.widgets.php:197
|
87 |
-
msgid "Show selected categories only"
|
88 |
-
msgstr ""
|
89 |
-
|
90 |
-
#: 3.3/class/avh-ec.widgets.php:199
|
91 |
-
#: 3.3/class/avh-ec.widgets.php:479
|
92 |
-
#: 3.3/class/avh-ec.widgets.php:777
|
93 |
-
#: 2.8/class/avh-ec.widgets.php:199
|
94 |
-
#: 2.8/class/avh-ec.widgets.php:478
|
95 |
-
#: 2.8/class/avh-ec.widgets.php:776
|
96 |
-
msgid "Show post counts"
|
97 |
-
msgstr ""
|
98 |
-
|
99 |
-
#: 3.3/class/avh-ec.widgets.php:201
|
100 |
-
#: 3.3/class/avh-ec.widgets.php:779
|
101 |
-
#: 2.8/class/avh-ec.widgets.php:201
|
102 |
-
#: 2.8/class/avh-ec.widgets.php:778
|
103 |
-
msgid "Show hierarchy"
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
#: 3.3/class/avh-ec.widgets.php:203
|
107 |
-
#: 2.8/class/avh-ec.widgets.php:203
|
108 |
-
msgid "All Levels"
|
109 |
-
msgstr ""
|
110 |
-
|
111 |
-
#: 3.3/class/avh-ec.widgets.php:203
|
112 |
-
#: 2.8/class/avh-ec.widgets.php:203
|
113 |
-
msgid "Toplevel only"
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: 3.3/class/avh-ec.widgets.php:205
|
117 |
-
#: 2.8/class/avh-ec.widgets.php:205
|
118 |
-
msgid "Child "
|
119 |
-
msgstr ""
|
120 |
-
|
121 |
-
#: 3.3/class/avh-ec.widgets.php:207
|
122 |
-
#: 2.8/class/avh-ec.widgets.php:207
|
123 |
-
msgid "How many levels to show"
|
124 |
-
msgstr ""
|
125 |
-
|
126 |
-
#: 3.3/class/avh-ec.widgets.php:210
|
127 |
-
#: 3.3/class/avh-ec.widgets.php:781
|
128 |
-
#: 2.8/class/avh-ec.widgets.php:210
|
129 |
-
#: 2.8/class/avh-ec.widgets.php:780
|
130 |
-
msgid "Hide empty categories"
|
131 |
-
msgstr ""
|
132 |
-
|
133 |
-
#: 3.3/class/avh-ec.widgets.php:212
|
134 |
-
#: 3.3/class/avh-ec.widgets.php:482
|
135 |
-
#: 3.3/class/avh-ec.widgets.php:783
|
136 |
-
#: 2.8/class/avh-ec.widgets.php:212
|
137 |
-
#: 2.8/class/avh-ec.widgets.php:481
|
138 |
-
#: 2.8/class/avh-ec.widgets.php:782
|
139 |
-
msgid "Use description for title"
|
140 |
-
msgstr ""
|
141 |
-
|
142 |
-
#: 3.3/class/avh-ec.widgets.php:216
|
143 |
-
#: 3.3/class/avh-ec.widgets.php:486
|
144 |
-
#: 3.3/class/avh-ec.widgets.php:787
|
145 |
-
#: 2.8/class/avh-ec.widgets.php:216
|
146 |
-
#: 2.8/class/avh-ec.widgets.php:485
|
147 |
-
#: 2.8/class/avh-ec.widgets.php:786
|
148 |
-
msgid "ID"
|
149 |
-
msgstr ""
|
150 |
-
|
151 |
-
#: 3.3/class/avh-ec.widgets.php:217
|
152 |
-
#: 3.3/class/avh-ec.widgets.php:487
|
153 |
-
#: 3.3/class/avh-ec.widgets.php:788
|
154 |
-
#: 3.3/class/avh-ec.admin.php:1139
|
155 |
-
#: 2.8/class/avh-ec.widgets.php:217
|
156 |
-
#: 2.8/class/avh-ec.widgets.php:486
|
157 |
-
#: 2.8/class/avh-ec.widgets.php:787
|
158 |
-
#: 2.8/class/avh-ec.admin.php:1169
|
159 |
-
msgid "Name"
|
160 |
-
msgstr ""
|
161 |
-
|
162 |
-
#: 3.3/class/avh-ec.widgets.php:218
|
163 |
-
#: 3.3/class/avh-ec.widgets.php:488
|
164 |
-
#: 3.3/class/avh-ec.widgets.php:789
|
165 |
-
#: 2.8/class/avh-ec.widgets.php:218
|
166 |
-
#: 2.8/class/avh-ec.widgets.php:487
|
167 |
-
#: 2.8/class/avh-ec.widgets.php:788
|
168 |
-
msgid "Count"
|
169 |
-
msgstr ""
|
170 |
-
|
171 |
-
#: 3.3/class/avh-ec.widgets.php:219
|
172 |
-
#: 3.3/class/avh-ec.widgets.php:489
|
173 |
-
#: 3.3/class/avh-ec.widgets.php:790
|
174 |
-
#: 2.8/class/avh-ec.widgets.php:219
|
175 |
-
#: 2.8/class/avh-ec.widgets.php:488
|
176 |
-
#: 2.8/class/avh-ec.widgets.php:789
|
177 |
-
msgid "Slug"
|
178 |
-
msgstr ""
|
179 |
-
|
180 |
-
#: 3.3/class/avh-ec.widgets.php:220
|
181 |
-
msgid "Manual Order"
|
182 |
-
msgstr ""
|
183 |
-
|
184 |
-
#: 3.3/class/avh-ec.widgets.php:225
|
185 |
-
#: 3.3/class/avh-ec.widgets.php:490
|
186 |
-
#: 3.3/class/avh-ec.widgets.php:791
|
187 |
-
#: 2.8/class/avh-ec.widgets.php:224
|
188 |
-
#: 2.8/class/avh-ec.widgets.php:489
|
189 |
-
#: 2.8/class/avh-ec.widgets.php:790
|
190 |
-
msgid "Sort by"
|
191 |
-
msgstr ""
|
192 |
-
|
193 |
-
#: 3.3/class/avh-ec.widgets.php:228
|
194 |
-
#: 3.3/class/avh-ec.widgets.php:493
|
195 |
-
#: 3.3/class/avh-ec.widgets.php:794
|
196 |
-
#: 2.8/class/avh-ec.widgets.php:227
|
197 |
-
#: 2.8/class/avh-ec.widgets.php:492
|
198 |
-
#: 2.8/class/avh-ec.widgets.php:793
|
199 |
-
msgid "Ascending"
|
200 |
-
msgstr ""
|
201 |
-
|
202 |
-
#: 3.3/class/avh-ec.widgets.php:229
|
203 |
-
#: 3.3/class/avh-ec.widgets.php:494
|
204 |
-
#: 3.3/class/avh-ec.widgets.php:795
|
205 |
-
#: 2.8/class/avh-ec.widgets.php:228
|
206 |
-
#: 2.8/class/avh-ec.widgets.php:493
|
207 |
-
#: 2.8/class/avh-ec.widgets.php:794
|
208 |
-
msgid "Descending"
|
209 |
-
msgstr ""
|
210 |
-
|
211 |
-
#: 3.3/class/avh-ec.widgets.php:230
|
212 |
-
#: 3.3/class/avh-ec.widgets.php:495
|
213 |
-
#: 3.3/class/avh-ec.widgets.php:796
|
214 |
-
#: 2.8/class/avh-ec.widgets.php:229
|
215 |
-
#: 2.8/class/avh-ec.widgets.php:494
|
216 |
-
#: 2.8/class/avh-ec.widgets.php:795
|
217 |
-
msgid "Sort order"
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
#: 3.3/class/avh-ec.widgets.php:233
|
221 |
-
#: 3.3/class/avh-ec.widgets.php:498
|
222 |
-
#: 3.3/class/avh-ec.widgets.php:799
|
223 |
-
#: 2.8/class/avh-ec.widgets.php:232
|
224 |
-
#: 2.8/class/avh-ec.widgets.php:497
|
225 |
-
#: 2.8/class/avh-ec.widgets.php:798
|
226 |
-
msgid "List"
|
227 |
-
msgstr ""
|
228 |
-
|
229 |
-
#: 3.3/class/avh-ec.widgets.php:234
|
230 |
-
#: 3.3/class/avh-ec.widgets.php:499
|
231 |
-
#: 3.3/class/avh-ec.widgets.php:800
|
232 |
-
#: 2.8/class/avh-ec.widgets.php:233
|
233 |
-
#: 2.8/class/avh-ec.widgets.php:498
|
234 |
-
#: 2.8/class/avh-ec.widgets.php:799
|
235 |
-
msgid "Drop down"
|
236 |
-
msgstr ""
|
237 |
-
|
238 |
-
#: 3.3/class/avh-ec.widgets.php:235
|
239 |
-
#: 3.3/class/avh-ec.widgets.php:500
|
240 |
-
#: 3.3/class/avh-ec.widgets.php:801
|
241 |
-
#: 2.8/class/avh-ec.widgets.php:234
|
242 |
-
#: 2.8/class/avh-ec.widgets.php:499
|
243 |
-
#: 2.8/class/avh-ec.widgets.php:800
|
244 |
-
msgid "Display style"
|
245 |
-
msgstr ""
|
246 |
-
|
247 |
-
#: 3.3/class/avh-ec.widgets.php:241
|
248 |
-
#: 3.3/class/avh-ec.widgets.php:506
|
249 |
-
#: 3.3/class/avh-ec.widgets.php:807
|
250 |
-
#: 2.8/class/avh-ec.widgets.php:240
|
251 |
-
#: 2.8/class/avh-ec.widgets.php:505
|
252 |
-
#: 2.8/class/avh-ec.widgets.php:806
|
253 |
-
msgid "Show RSS Feed"
|
254 |
-
msgstr ""
|
255 |
-
|
256 |
-
#: 3.3/class/avh-ec.widgets.php:243
|
257 |
-
#: 3.3/class/avh-ec.widgets.php:508
|
258 |
-
#: 3.3/class/avh-ec.widgets.php:809
|
259 |
-
#: 2.8/class/avh-ec.widgets.php:242
|
260 |
-
#: 2.8/class/avh-ec.widgets.php:507
|
261 |
-
#: 2.8/class/avh-ec.widgets.php:808
|
262 |
-
msgid "Path (URI) to RSS image"
|
263 |
-
msgstr ""
|
264 |
-
|
265 |
-
#: 3.3/class/avh-ec.widgets.php:248
|
266 |
-
#: 2.8/class/avh-ec.widgets.php:247
|
267 |
-
msgid "Select categories"
|
268 |
-
msgstr ""
|
269 |
-
|
270 |
-
#: 3.3/class/avh-ec.widgets.php:253
|
271 |
-
#: 2.8/class/avh-ec.widgets.php:252
|
272 |
-
msgid "All Categories"
|
273 |
-
msgstr ""
|
274 |
-
|
275 |
-
#: 3.3/class/avh-ec.widgets.php:263
|
276 |
-
#: 2.8/class/avh-ec.widgets.php:262
|
277 |
-
msgid "Exclude the selected categories"
|
278 |
-
msgstr ""
|
279 |
-
|
280 |
-
#: 3.3/class/avh-ec.widgets.php:334
|
281 |
-
#: 2.8/class/avh-ec.widgets.php:333
|
282 |
-
msgid "Shows the top categories."
|
283 |
-
msgstr ""
|
284 |
-
|
285 |
-
#: 3.3/class/avh-ec.widgets.php:335
|
286 |
-
#: 2.8/class/avh-ec.widgets.php:334
|
287 |
-
msgid "Top Categories"
|
288 |
-
msgstr ""
|
289 |
-
|
290 |
-
#: 3.3/class/avh-ec.widgets.php:475
|
291 |
-
#: 2.8/class/avh-ec.widgets.php:474
|
292 |
-
msgid "How many categories to show"
|
293 |
-
msgstr ""
|
294 |
-
|
295 |
-
#: 3.3/class/avh-ec.widgets.php:543
|
296 |
-
#: 2.8/class/avh-ec.widgets.php:542
|
297 |
-
msgid "Shows grouped categories."
|
298 |
-
msgstr ""
|
299 |
-
|
300 |
-
#: 3.3/class/avh-ec.widgets.php:544
|
301 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
302 |
-
#: 2.8/class/avh-ec.widgets.php:543
|
303 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
304 |
-
msgid "Category Group"
|
305 |
-
msgstr ""
|
306 |
-
|
307 |
-
#: 3.3/class/avh-ec.widgets.php:813
|
308 |
-
#: 2.8/class/avh-ec.widgets.php:812
|
309 |
-
msgid "Select Groups"
|
310 |
-
msgstr ""
|
311 |
-
|
312 |
-
#: 3.3/class/avh-ec.widgets.php:818
|
313 |
-
#: 2.8/class/avh-ec.widgets.php:817
|
314 |
-
msgid "Any Group"
|
315 |
-
msgstr ""
|
316 |
-
|
317 |
-
#: 3.3/class/avh-ec.admin.php:186
|
318 |
-
#: 3.3/class/avh-ec.admin.php:258
|
319 |
-
#: 2.8/class/avh-ec.admin.php:183
|
320 |
-
#: 2.8/class/avh-ec.admin.php:259
|
321 |
-
msgid "Overview"
|
322 |
-
msgstr ""
|
323 |
-
|
324 |
-
#: 3.3/class/avh-ec.admin.php:187
|
325 |
-
#: 3.3/class/avh-ec.admin.php:392
|
326 |
-
#: 2.8/class/avh-ec.admin.php:184
|
327 |
-
#: 2.8/class/avh-ec.admin.php:400
|
328 |
-
msgid "General Options"
|
329 |
-
msgstr ""
|
330 |
-
|
331 |
-
#: 3.3/class/avh-ec.admin.php:188
|
332 |
-
#: 3.3/class/avh-ec.admin.php:617
|
333 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
334 |
-
#: 3.3/class/avh-ec.category-group.php:157
|
335 |
-
#: 3.3/class/avh-ec.category-group.php:158
|
336 |
-
#: 2.8/class/avh-ec.admin.php:185
|
337 |
-
#: 2.8/class/avh-ec.admin.php:632
|
338 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
339 |
-
#: 2.8/class/avh-ec.category-group.php:157
|
340 |
-
#: 2.8/class/avh-ec.category-group.php:158
|
341 |
-
msgid "Category Groups"
|
342 |
-
msgstr ""
|
343 |
-
|
344 |
-
#: 3.3/class/avh-ec.admin.php:189
|
345 |
-
#: 2.8/class/avh-ec.admin.php:186
|
346 |
-
msgid "Manually Order"
|
347 |
-
msgstr ""
|
348 |
-
|
349 |
-
#: 3.3/class/avh-ec.admin.php:190
|
350 |
-
#: 3.3/class/avh-ec.admin.php:920
|
351 |
-
#: 2.8/class/avh-ec.admin.php:187
|
352 |
-
#: 2.8/class/avh-ec.admin.php:950
|
353 |
-
msgid "F.A.Q"
|
354 |
-
msgstr ""
|
355 |
-
|
356 |
-
#: 3.3/class/avh-ec.admin.php:216
|
357 |
-
#: 3.3/class/avh-ec.admin.php:437
|
358 |
-
#: 2.8/class/avh-ec.admin.php:210
|
359 |
-
#: 2.8/class/avh-ec.admin.php:445
|
360 |
-
msgid "Group Overview"
|
361 |
-
msgstr ""
|
362 |
-
|
363 |
-
#: 3.3/class/avh-ec.admin.php:217
|
364 |
-
#: 3.3/class/avh-ec.admin.php:881
|
365 |
-
#: 2.8/class/avh-ec.admin.php:211
|
366 |
-
#: 2.8/class/avh-ec.admin.php:904
|
367 |
-
msgid "Translation"
|
368 |
-
msgstr ""
|
369 |
-
|
370 |
-
#: 3.3/class/avh-ec.admin.php:244
|
371 |
-
#: 3.3/class/avh-ec.admin.php:378
|
372 |
-
#: 3.3/class/avh-ec.admin.php:906
|
373 |
-
#: 2.8/class/avh-ec.admin.php:245
|
374 |
-
#: 2.8/class/avh-ec.admin.php:386
|
375 |
-
#: 2.8/class/avh-ec.admin.php:936
|
376 |
-
msgid "Donations"
|
377 |
-
msgstr ""
|
378 |
-
|
379 |
-
#: 3.3/class/avh-ec.admin.php:286
|
380 |
-
#: 2.8/class/avh-ec.admin.php:287
|
381 |
-
msgid "Options"
|
382 |
-
msgstr ""
|
383 |
-
|
384 |
-
#: 3.3/class/avh-ec.admin.php:315
|
385 |
-
#: 2.8/class/avh-ec.admin.php:323
|
386 |
-
msgid "<em>Select Category</em> Alternative"
|
387 |
-
msgstr ""
|
388 |
-
|
389 |
-
#: 3.3/class/avh-ec.admin.php:315
|
390 |
-
#: 2.8/class/avh-ec.admin.php:323
|
391 |
-
msgid "Alternative text for Select Category."
|
392 |
-
msgstr ""
|
393 |
-
|
394 |
-
#: 3.3/class/avh-ec.admin.php:316
|
395 |
-
#: 2.8/class/avh-ec.admin.php:324
|
396 |
-
msgid "Select which group to show on the home page."
|
397 |
-
msgstr ""
|
398 |
-
|
399 |
-
#: 3.3/class/avh-ec.admin.php:316
|
400 |
-
#: 3.3/class/avh-ec.admin.php:317
|
401 |
-
#: 3.3/class/avh-ec.admin.php:318
|
402 |
-
#: 2.8/class/avh-ec.admin.php:324
|
403 |
-
#: 2.8/class/avh-ec.admin.php:325
|
404 |
-
#: 2.8/class/avh-ec.admin.php:326
|
405 |
-
msgid "Selecting the group 'none' will not show the widget on the page."
|
406 |
-
msgstr ""
|
407 |
-
|
408 |
-
#: 3.3/class/avh-ec.admin.php:317
|
409 |
-
#: 2.8/class/avh-ec.admin.php:325
|
410 |
-
msgid "Select which group to show when there is no group associated with the post."
|
411 |
-
msgstr ""
|
412 |
-
|
413 |
-
#: 3.3/class/avh-ec.admin.php:318
|
414 |
-
#: 2.8/class/avh-ec.admin.php:326
|
415 |
-
msgid "Select which group will be the default group when editing a post."
|
416 |
-
msgstr ""
|
417 |
-
|
418 |
-
#: 3.3/class/avh-ec.admin.php:352
|
419 |
-
#: 2.8/class/avh-ec.admin.php:360
|
420 |
-
msgid "Options saved"
|
421 |
-
msgstr ""
|
422 |
-
|
423 |
-
#: 3.3/class/avh-ec.admin.php:408
|
424 |
-
#: 2.8/class/avh-ec.admin.php:416
|
425 |
-
msgid "Save Changes"
|
426 |
-
msgstr ""
|
427 |
-
|
428 |
-
#: 3.3/class/avh-ec.admin.php:436
|
429 |
-
#: 2.8/class/avh-ec.admin.php:444
|
430 |
-
msgid "Add Group"
|
431 |
-
msgstr ""
|
432 |
-
|
433 |
-
#: 3.3/class/avh-ec.admin.php:438
|
434 |
-
#: 2.8/class/avh-ec.admin.php:446
|
435 |
-
msgid "Special Pages"
|
436 |
-
msgstr ""
|
437 |
-
|
438 |
-
#: 3.3/class/avh-ec.admin.php:467
|
439 |
-
#: 3.3/class/avh-ec.admin.php:472
|
440 |
-
#: 2.8/class/avh-ec.admin.php:482
|
441 |
-
#: 2.8/class/avh-ec.admin.php:487
|
442 |
-
msgid "Group Name"
|
443 |
-
msgstr ""
|
444 |
-
|
445 |
-
#: 3.3/class/avh-ec.admin.php:467
|
446 |
-
#: 3.3/class/avh-ec.admin.php:472
|
447 |
-
#: 2.8/class/avh-ec.admin.php:482
|
448 |
-
#: 2.8/class/avh-ec.admin.php:487
|
449 |
-
msgid "The name is used to identify the group."
|
450 |
-
msgstr ""
|
451 |
-
|
452 |
-
#: 3.3/class/avh-ec.admin.php:468
|
453 |
-
#: 3.3/class/avh-ec.admin.php:473
|
454 |
-
#: 2.8/class/avh-ec.admin.php:483
|
455 |
-
#: 2.8/class/avh-ec.admin.php:488
|
456 |
-
msgid "Slug Group"
|
457 |
-
msgstr ""
|
458 |
-
|
459 |
-
#: 3.3/class/avh-ec.admin.php:468
|
460 |
-
#: 3.3/class/avh-ec.admin.php:473
|
461 |
-
#: 2.8/class/avh-ec.admin.php:483
|
462 |
-
#: 2.8/class/avh-ec.admin.php:488
|
463 |
-
msgid "The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens."
|
464 |
-
msgstr ""
|
465 |
-
|
466 |
-
#: 3.3/class/avh-ec.admin.php:469
|
467 |
-
#: 3.3/class/avh-ec.admin.php:474
|
468 |
-
#: 3.3/class/avh-ec.admin.php:1139
|
469 |
-
#: 2.8/class/avh-ec.admin.php:484
|
470 |
-
#: 2.8/class/avh-ec.admin.php:489
|
471 |
-
#: 2.8/class/avh-ec.admin.php:1169
|
472 |
-
msgid "Widget Title"
|
473 |
-
msgstr ""
|
474 |
-
|
475 |
-
#: 3.3/class/avh-ec.admin.php:469
|
476 |
-
#: 3.3/class/avh-ec.admin.php:474
|
477 |
-
#: 2.8/class/avh-ec.admin.php:484
|
478 |
-
#: 2.8/class/avh-ec.admin.php:489
|
479 |
-
msgid "When no title is given in the widget options, this will used as the title of the widget when this group is shown."
|
480 |
-
msgstr ""
|
481 |
-
|
482 |
-
#: 3.3/class/avh-ec.admin.php:470
|
483 |
-
#: 3.3/class/avh-ec.admin.php:475
|
484 |
-
#: 3.3/class/avh-ec.admin.php:1139
|
485 |
-
#: 2.8/class/avh-ec.admin.php:485
|
486 |
-
#: 2.8/class/avh-ec.admin.php:490
|
487 |
-
#: 2.8/class/avh-ec.admin.php:1169
|
488 |
-
msgid "Description"
|
489 |
-
msgstr ""
|
490 |
-
|
491 |
-
#: 3.3/class/avh-ec.admin.php:470
|
492 |
-
#: 3.3/class/avh-ec.admin.php:475
|
493 |
-
#: 2.8/class/avh-ec.admin.php:485
|
494 |
-
#: 2.8/class/avh-ec.admin.php:490
|
495 |
-
msgid "Description is not prominent by default."
|
496 |
-
msgstr ""
|
497 |
-
|
498 |
-
#: 3.3/class/avh-ec.admin.php:476
|
499 |
-
#: 2.8/class/avh-ec.admin.php:491
|
500 |
-
msgid "Select categories to be included in the group."
|
501 |
-
msgstr ""
|
502 |
-
|
503 |
-
#: 3.3/class/avh-ec.admin.php:492
|
504 |
-
#: 2.8/class/avh-ec.admin.php:507
|
505 |
-
msgid "Category group saved"
|
506 |
-
msgstr ""
|
507 |
-
|
508 |
-
#: 3.3/class/avh-ec.admin.php:498
|
509 |
-
#: 2.8/class/avh-ec.admin.php:513
|
510 |
-
msgid "Category group conflicts with "
|
511 |
-
msgstr ""
|
512 |
-
|
513 |
-
#: 3.3/class/avh-ec.admin.php:499
|
514 |
-
#: 2.8/class/avh-ec.admin.php:514
|
515 |
-
msgid "Same slug is used. "
|
516 |
-
msgstr ""
|
517 |
-
|
518 |
-
#: 3.3/class/avh-ec.admin.php:521
|
519 |
-
#: 2.8/class/avh-ec.admin.php:536
|
520 |
-
msgid "Edit Group"
|
521 |
-
msgstr ""
|
522 |
-
|
523 |
-
#: 3.3/class/avh-ec.admin.php:533
|
524 |
-
#: 2.8/class/avh-ec.admin.php:548
|
525 |
-
msgid "Cheatin’ uh?"
|
526 |
-
msgstr ""
|
527 |
-
|
528 |
-
#: 3.3/class/avh-ec.admin.php:553
|
529 |
-
#: 2.8/class/avh-ec.admin.php:568
|
530 |
-
msgid "Category group updated"
|
531 |
-
msgstr ""
|
532 |
-
|
533 |
-
#: 3.3/class/avh-ec.admin.php:557
|
534 |
-
#: 2.8/class/avh-ec.admin.php:572
|
535 |
-
msgid "Category group not updated"
|
536 |
-
msgstr ""
|
537 |
-
|
538 |
-
#: 3.3/class/avh-ec.admin.php:558
|
539 |
-
#: 2.8/class/avh-ec.admin.php:573
|
540 |
-
msgid "Duplicate slug detected"
|
541 |
-
msgstr ""
|
542 |
-
|
543 |
-
#: 3.3/class/avh-ec.admin.php:562
|
544 |
-
#: 2.8/class/avh-ec.admin.php:577
|
545 |
-
msgid "Unknown category group"
|
546 |
-
msgstr ""
|
547 |
-
|
548 |
-
#: 3.3/class/avh-ec.admin.php:601
|
549 |
-
#: 2.8/class/avh-ec.admin.php:616
|
550 |
-
msgid "Home page"
|
551 |
-
msgstr ""
|
552 |
-
|
553 |
-
#: 3.3/class/avh-ec.admin.php:601
|
554 |
-
#: 3.3/class/avh-ec.admin.php:603
|
555 |
-
#: 3.3/class/avh-ec.admin.php:604
|
556 |
-
#: 3.3/class/avh-ec.admin.php:605
|
557 |
-
#: 3.3/class/avh-ec.admin.php:606
|
558 |
-
#: 3.3/class/avh-ec.admin.php:607
|
559 |
-
#: 2.8/class/avh-ec.admin.php:616
|
560 |
-
#: 2.8/class/avh-ec.admin.php:618
|
561 |
-
#: 2.8/class/avh-ec.admin.php:619
|
562 |
-
#: 2.8/class/avh-ec.admin.php:620
|
563 |
-
#: 2.8/class/avh-ec.admin.php:621
|
564 |
-
#: 2.8/class/avh-ec.admin.php:622
|
565 |
-
#, php-format
|
566 |
-
msgid "Select which category to show on the %s page."
|
567 |
-
msgstr ""
|
568 |
-
|
569 |
-
#: 3.3/class/avh-ec.admin.php:601
|
570 |
-
#: 2.8/class/avh-ec.admin.php:616
|
571 |
-
msgid "home"
|
572 |
-
msgstr ""
|
573 |
-
|
574 |
-
#: 3.3/class/avh-ec.admin.php:603
|
575 |
-
#: 2.8/class/avh-ec.admin.php:618
|
576 |
-
msgid "Daily Archive"
|
577 |
-
msgstr ""
|
578 |
-
|
579 |
-
#: 3.3/class/avh-ec.admin.php:603
|
580 |
-
#: 2.8/class/avh-ec.admin.php:618
|
581 |
-
msgid "daily archive"
|
582 |
-
msgstr ""
|
583 |
-
|
584 |
-
#: 3.3/class/avh-ec.admin.php:604
|
585 |
-
#: 2.8/class/avh-ec.admin.php:619
|
586 |
-
msgid "Monthly Archive"
|
587 |
-
msgstr ""
|
588 |
-
|
589 |
-
#: 3.3/class/avh-ec.admin.php:604
|
590 |
-
#: 2.8/class/avh-ec.admin.php:619
|
591 |
-
msgid "monthly archive"
|
592 |
-
msgstr ""
|
593 |
-
|
594 |
-
#: 3.3/class/avh-ec.admin.php:605
|
595 |
-
#: 2.8/class/avh-ec.admin.php:620
|
596 |
-
msgid "Yearly Archive"
|
597 |
-
msgstr ""
|
598 |
-
|
599 |
-
#: 3.3/class/avh-ec.admin.php:605
|
600 |
-
#: 2.8/class/avh-ec.admin.php:620
|
601 |
-
msgid "yearly archive"
|
602 |
-
msgstr ""
|
603 |
-
|
604 |
-
#: 3.3/class/avh-ec.admin.php:606
|
605 |
-
#: 2.8/class/avh-ec.admin.php:621
|
606 |
-
msgid "Author Archive"
|
607 |
-
msgstr ""
|
608 |
-
|
609 |
-
#: 3.3/class/avh-ec.admin.php:606
|
610 |
-
#: 2.8/class/avh-ec.admin.php:621
|
611 |
-
msgid "author archive"
|
612 |
-
msgstr ""
|
613 |
-
|
614 |
-
#: 3.3/class/avh-ec.admin.php:607
|
615 |
-
#: 2.8/class/avh-ec.admin.php:622
|
616 |
-
msgid "Search Page"
|
617 |
-
msgstr ""
|
618 |
-
|
619 |
-
#: 3.3/class/avh-ec.admin.php:607
|
620 |
-
#: 2.8/class/avh-ec.admin.php:622
|
621 |
-
msgid "search"
|
622 |
-
msgstr ""
|
623 |
-
|
624 |
-
#: 3.3/class/avh-ec.admin.php:650
|
625 |
-
#: 2.8/class/avh-ec.admin.php:665
|
626 |
-
msgid "Add group"
|
627 |
-
msgstr ""
|
628 |
-
|
629 |
-
#: 3.3/class/avh-ec.admin.php:699
|
630 |
-
#: 2.8/class/avh-ec.admin.php:714
|
631 |
-
msgid "Update group"
|
632 |
-
msgstr ""
|
633 |
-
|
634 |
-
#: 3.3/class/avh-ec.admin.php:712
|
635 |
-
#: 2.8/class/avh-ec.admin.php:727
|
636 |
-
msgid "Save settings"
|
637 |
-
msgstr ""
|
638 |
-
|
639 |
-
#: 3.3/class/avh-ec.admin.php:723
|
640 |
-
#: 3.3/class/avh-ec.admin.php:760
|
641 |
-
#: 2.8/class/avh-ec.admin.php:739
|
642 |
-
#: 2.8/class/avh-ec.admin.php:784
|
643 |
-
msgid "Manually Order Categories"
|
644 |
-
msgstr ""
|
645 |
-
|
646 |
-
#: 3.3/class/avh-ec.admin.php:812
|
647 |
-
msgid "Manual order of the categories successfully updated."
|
648 |
-
msgstr ""
|
649 |
-
|
650 |
-
#: 3.3/class/avh-ec.admin.php:814
|
651 |
-
#: 2.8/class/avh-ec.admin.php:835
|
652 |
-
msgid "An error occured, order has not been saved."
|
653 |
-
msgstr ""
|
654 |
-
|
655 |
-
#: 3.3/class/avh-ec.admin.php:830
|
656 |
-
#: 2.8/class/avh-ec.admin.php:853
|
657 |
-
msgid "Order the categories"
|
658 |
-
msgstr ""
|
659 |
-
|
660 |
-
#: 3.3/class/avh-ec.admin.php:839
|
661 |
-
#: 2.8/class/avh-ec.admin.php:862
|
662 |
-
msgid "Order the categories on this level by dragging and dropping them into the desired order."
|
663 |
-
msgstr ""
|
664 |
-
|
665 |
-
#: 3.3/class/avh-ec.admin.php:847
|
666 |
-
#: 2.8/class/avh-ec.admin.php:870
|
667 |
-
msgid "Save Order"
|
668 |
-
msgstr ""
|
669 |
-
|
670 |
-
#: 3.3/class/avh-ec.admin.php:850
|
671 |
-
#: 2.8/class/avh-ec.admin.php:873
|
672 |
-
msgid "Return to parent category"
|
673 |
-
msgstr ""
|
674 |
-
|
675 |
-
#: 3.3/class/avh-ec.admin.php:857
|
676 |
-
#: 2.8/class/avh-ec.admin.php:880
|
677 |
-
msgid "Select Subcategory"
|
678 |
-
msgstr ""
|
679 |
-
|
680 |
-
#: 3.3/class/avh-ec.admin.php:862
|
681 |
-
#: 2.8/class/avh-ec.admin.php:885
|
682 |
-
msgid "Select"
|
683 |
-
msgstr ""
|
684 |
-
|
685 |
-
#: 3.3/class/avh-ec.admin.php:864
|
686 |
-
#: 2.8/class/avh-ec.admin.php:887
|
687 |
-
msgid "Choose a category from the drop down to order the subcategories in that category."
|
688 |
-
msgstr ""
|
689 |
-
|
690 |
-
#: 3.3/class/avh-ec.admin.php:880
|
691 |
-
#: 2.8/class/avh-ec.admin.php:903
|
692 |
-
msgid "F.A.Q."
|
693 |
-
msgstr ""
|
694 |
-
|
695 |
-
#: 3.3/class/avh-ec.admin.php:959
|
696 |
-
#: 2.8/class/avh-ec.admin.php:989
|
697 |
-
msgid "This plugin is translated in several languages. Some of the languages might be incomplete. Please help to complete these translations or add a new language."
|
698 |
-
msgstr ""
|
699 |
-
|
700 |
-
#: 3.3/class/avh-ec.admin.php:964
|
701 |
-
#: 2.8/class/avh-ec.admin.php:994
|
702 |
-
msgid "Available Languages"
|
703 |
-
msgstr ""
|
704 |
-
|
705 |
-
#: 3.3/class/avh-ec.admin.php:979
|
706 |
-
#: 2.8/class/avh-ec.admin.php:1009
|
707 |
-
msgid "You can visit "
|
708 |
-
msgstr ""
|
709 |
-
|
710 |
-
#: 3.3/class/avh-ec.admin.php:979
|
711 |
-
#: 2.8/class/avh-ec.admin.php:1009
|
712 |
-
msgid "to help complete these translations or add a new language."
|
713 |
-
msgstr ""
|
714 |
-
|
715 |
-
#: 3.3/class/avh-ec.admin.php:992
|
716 |
-
#: 2.8/class/avh-ec.admin.php:1022
|
717 |
-
msgid "If you enjoy this plug-in please consider a donation. There are several ways you can show your appreciation."
|
718 |
-
msgstr ""
|
719 |
-
|
720 |
-
#: 3.3/class/avh-ec.admin.php:997
|
721 |
-
#: 2.8/class/avh-ec.admin.php:1027
|
722 |
-
msgid "If you decide to buy something from Amazon click the button."
|
723 |
-
msgstr ""
|
724 |
-
|
725 |
-
#: 3.3/class/avh-ec.admin.php:1002
|
726 |
-
#: 2.8/class/avh-ec.admin.php:1032
|
727 |
-
msgid "You can send me something from my "
|
728 |
-
msgstr ""
|
729 |
-
|
730 |
-
#: 3.3/class/avh-ec.admin.php:1002
|
731 |
-
#: 2.8/class/avh-ec.admin.php:1032
|
732 |
-
msgid "Amazon Wish List"
|
733 |
-
msgstr ""
|
734 |
-
|
735 |
-
#: 3.3/class/avh-ec.admin.php:1006
|
736 |
-
#: 2.8/class/avh-ec.admin.php:1036
|
737 |
-
msgid "Through Paypal."
|
738 |
-
msgstr ""
|
739 |
-
|
740 |
-
#: 3.3/class/avh-ec.admin.php:1007
|
741 |
-
#: 2.8/class/avh-ec.admin.php:1037
|
742 |
-
msgid "Click on the Donate button and you will be directed to Paypal where you can make your donation and you don't need to have a Paypal account to make a donation."
|
743 |
-
msgstr ""
|
744 |
-
|
745 |
-
#: 3.3/class/avh-ec.admin.php:1021
|
746 |
-
#: 2.8/class/avh-ec.admin.php:1051
|
747 |
-
msgid "What about support?"
|
748 |
-
msgstr ""
|
749 |
-
|
750 |
-
#: 3.3/class/avh-ec.admin.php:1022
|
751 |
-
msgid "I created a <a href=\"http://forums.avirtualhome.com\" target=\"_blank\">support site</a> where you can ask questions or request features."
|
752 |
-
msgstr ""
|
753 |
-
|
754 |
-
#: 3.3/class/avh-ec.admin.php:1026
|
755 |
-
#: 2.8/class/avh-ec.admin.php:1056
|
756 |
-
msgid "What is depth selection?"
|
757 |
-
msgstr ""
|
758 |
-
|
759 |
-
#: 3.3/class/avh-ec.admin.php:1027
|
760 |
-
#: 2.8/class/avh-ec.admin.php:1057
|
761 |
-
msgid "Starting with version 2.0 and WordPress 2.8 you can select how many levels deep you want to show your categories. This option only works when you select Show Hierarchy as well."
|
762 |
-
msgstr ""
|
763 |
-
|
764 |
-
#: 3.3/class/avh-ec.admin.php:1028
|
765 |
-
#: 2.8/class/avh-ec.admin.php:1058
|
766 |
-
msgid "Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:"
|
767 |
-
msgstr ""
|
768 |
-
|
769 |
-
#: 3.3/class/avh-ec.admin.php:1029
|
770 |
-
#: 2.8/class/avh-ec.admin.php:1059
|
771 |
-
msgid "You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only."
|
772 |
-
msgstr ""
|
773 |
-
|
774 |
-
#: 3.3/class/avh-ec.admin.php:1033
|
775 |
-
#: 2.8/class/avh-ec.admin.php:1063
|
776 |
-
msgid "Multiple Category Groups"
|
777 |
-
msgstr ""
|
778 |
-
|
779 |
-
#: 3.3/class/avh-ec.admin.php:1034
|
780 |
-
#: 2.8/class/avh-ec.admin.php:1064
|
781 |
-
msgid "The following is an explanation how assigning multiple groups to page/post works."
|
782 |
-
msgstr ""
|
783 |
-
|
784 |
-
#: 3.3/class/avh-ec.admin.php:1035
|
785 |
-
#: 2.8/class/avh-ec.admin.php:1065
|
786 |
-
msgid "Lets say you have the following groups:"
|
787 |
-
msgstr ""
|
788 |
-
|
789 |
-
#: 3.3/class/avh-ec.admin.php:1037
|
790 |
-
#: 2.8/class/avh-ec.admin.php:1067
|
791 |
-
msgid "Free Time"
|
792 |
-
msgstr ""
|
793 |
-
|
794 |
-
#: 3.3/class/avh-ec.admin.php:1038
|
795 |
-
#: 2.8/class/avh-ec.admin.php:1068
|
796 |
-
msgid "Theater"
|
797 |
-
msgstr ""
|
798 |
-
|
799 |
-
#: 3.3/class/avh-ec.admin.php:1039
|
800 |
-
#: 2.8/class/avh-ec.admin.php:1069
|
801 |
-
msgid "Movie"
|
802 |
-
msgstr ""
|
803 |
-
|
804 |
-
#: 3.3/class/avh-ec.admin.php:1040
|
805 |
-
#: 2.8/class/avh-ec.admin.php:1070
|
806 |
-
msgid "Music"
|
807 |
-
msgstr ""
|
808 |
-
|
809 |
-
#: 3.3/class/avh-ec.admin.php:1042
|
810 |
-
#: 2.8/class/avh-ec.admin.php:1072
|
811 |
-
msgid "Setup several Category Group widgets and associated each widget with one or more groups."
|
812 |
-
msgstr ""
|
813 |
-
|
814 |
-
#: 3.3/class/avh-ec.admin.php:1043
|
815 |
-
#: 2.8/class/avh-ec.admin.php:1073
|
816 |
-
msgid "Widget 1 has association with Free Time"
|
817 |
-
msgstr ""
|
818 |
-
|
819 |
-
#: 3.3/class/avh-ec.admin.php:1044
|
820 |
-
#: 2.8/class/avh-ec.admin.php:1074
|
821 |
-
msgid "Widget 2 has association with Theater, Movie and Music"
|
822 |
-
msgstr ""
|
823 |
-
|
824 |
-
#: 3.3/class/avh-ec.admin.php:1045
|
825 |
-
#: 2.8/class/avh-ec.admin.php:1075
|
826 |
-
msgid "Widget 3 has association with Theater, Movie and Music"
|
827 |
-
msgstr ""
|
828 |
-
|
829 |
-
#: 3.3/class/avh-ec.admin.php:1046
|
830 |
-
#: 2.8/class/avh-ec.admin.php:1076
|
831 |
-
msgid "Page has associations the groups Free Time and Theater"
|
832 |
-
msgstr ""
|
833 |
-
|
834 |
-
#: 3.3/class/avh-ec.admin.php:1048
|
835 |
-
#: 3.3/class/avh-ec.admin.php:1060
|
836 |
-
#: 2.8/class/avh-ec.admin.php:1078
|
837 |
-
#: 2.8/class/avh-ec.admin.php:1090
|
838 |
-
msgid "Widget 1: Shows categories of the Free Time group"
|
839 |
-
msgstr ""
|
840 |
-
|
841 |
-
#: 3.3/class/avh-ec.admin.php:1049
|
842 |
-
#: 2.8/class/avh-ec.admin.php:1079
|
843 |
-
msgid "Widget 2: Shows categories of the Theater group."
|
844 |
-
msgstr ""
|
845 |
-
|
846 |
-
#: 3.3/class/avh-ec.admin.php:1050
|
847 |
-
#: 3.3/class/avh-ec.admin.php:1056
|
848 |
-
#: 2.8/class/avh-ec.admin.php:1080
|
849 |
-
#: 2.8/class/avh-ec.admin.php:1086
|
850 |
-
msgid "Widget 3: Not displayed"
|
851 |
-
msgstr ""
|
852 |
-
|
853 |
-
#: 3.3/class/avh-ec.admin.php:1052
|
854 |
-
#: 2.8/class/avh-ec.admin.php:1082
|
855 |
-
msgid "Page has associations the group Movie."
|
856 |
-
msgstr ""
|
857 |
-
|
858 |
-
#: 3.3/class/avh-ec.admin.php:1054
|
859 |
-
#: 2.8/class/avh-ec.admin.php:1084
|
860 |
-
msgid "Widget 1: Not displayed"
|
861 |
-
msgstr ""
|
862 |
-
|
863 |
-
#: 3.3/class/avh-ec.admin.php:1055
|
864 |
-
#: 2.8/class/avh-ec.admin.php:1085
|
865 |
-
msgid "Widget 2: Shows categories of the Movie group."
|
866 |
-
msgstr ""
|
867 |
-
|
868 |
-
#: 3.3/class/avh-ec.admin.php:1058
|
869 |
-
#: 2.8/class/avh-ec.admin.php:1088
|
870 |
-
msgid "Page has associations the groups Free Time, Movie and Music"
|
871 |
-
msgstr ""
|
872 |
-
|
873 |
-
#: 3.3/class/avh-ec.admin.php:1061
|
874 |
-
#: 2.8/class/avh-ec.admin.php:1091
|
875 |
-
msgid "Widget 2: Shows categories of the Movie or Music group."
|
876 |
-
msgstr ""
|
877 |
-
|
878 |
-
#: 3.3/class/avh-ec.admin.php:1062
|
879 |
-
#: 2.8/class/avh-ec.admin.php:1092
|
880 |
-
msgid "Widget 3: Shows categories of the Music or Movie group."
|
881 |
-
msgstr ""
|
882 |
-
|
883 |
-
#: 3.3/class/avh-ec.admin.php:1064
|
884 |
-
#: 2.8/class/avh-ec.admin.php:1094
|
885 |
-
msgid "Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie."
|
886 |
-
msgstr ""
|
887 |
-
|
888 |
-
#: 3.3/class/avh-ec.admin.php:1072
|
889 |
-
#: 2.8/class/avh-ec.admin.php:1102
|
890 |
-
msgid "PHP4 Support"
|
891 |
-
msgstr ""
|
892 |
-
|
893 |
-
#: 3.3/class/avh-ec.admin.php:1073
|
894 |
-
#: 2.8/class/avh-ec.admin.php:1103
|
895 |
-
msgid "The next major release of the plugin will no longer support PHP4."
|
896 |
-
msgstr ""
|
897 |
-
|
898 |
-
#: 3.3/class/avh-ec.admin.php:1074
|
899 |
-
#: 2.8/class/avh-ec.admin.php:1104
|
900 |
-
msgid "It will be written for PHP 5.2 and "
|
901 |
-
msgstr ""
|
902 |
-
|
903 |
-
#: 3.3/class/avh-ec.admin.php:1076
|
904 |
-
#: 2.8/class/avh-ec.admin.php:1106
|
905 |
-
msgid "your blog already runs the needed PHP version. When the new release comes out you can safely update."
|
906 |
-
msgstr ""
|
907 |
-
|
908 |
-
#: 3.3/class/avh-ec.admin.php:1078
|
909 |
-
#: 2.8/class/avh-ec.admin.php:1108
|
910 |
-
msgid "your blog still runs PHP4. When the new release comes out you can not use it."
|
911 |
-
msgstr ""
|
912 |
-
|
913 |
-
#: 3.3/class/avh-ec.admin.php:1079
|
914 |
-
#: 2.8/class/avh-ec.admin.php:1109
|
915 |
-
msgid "I don't have a timeline for the next version but consider contacting your host if PHP 5.2 is available."
|
916 |
-
msgstr ""
|
917 |
-
|
918 |
-
#: 3.3/class/avh-ec.admin.php:1080
|
919 |
-
#: 2.8/class/avh-ec.admin.php:1110
|
920 |
-
msgid "If your hosts doesn't offer PHP 5.2 you might want to consider switching hosts."
|
921 |
-
msgstr ""
|
922 |
-
|
923 |
-
#: 3.3/class/avh-ec.admin.php:1081
|
924 |
-
#: 2.8/class/avh-ec.admin.php:1111
|
925 |
-
msgid "A host to consider is "
|
926 |
-
msgstr ""
|
927 |
-
|
928 |
-
#: 3.3/class/avh-ec.admin.php:1082
|
929 |
-
#: 2.8/class/avh-ec.admin.php:1112
|
930 |
-
msgid "I run my personal blog there and I am very happy with their services. You can get an account with unlimited bandwidth, storage and much more for a low price."
|
931 |
-
msgstr ""
|
932 |
-
|
933 |
-
#: 3.3/class/avh-ec.admin.php:1124
|
934 |
-
#: 2.8/class/avh-ec.admin.php:1154
|
935 |
-
msgid "Settings"
|
936 |
-
msgstr ""
|
937 |
-
|
938 |
-
#: 3.3/class/avh-ec.admin.php:1139
|
939 |
-
#: 2.8/class/avh-ec.admin.php:1169
|
940 |
-
msgid "Categories in the group"
|
941 |
-
msgstr ""
|
942 |
-
|
943 |
-
#: 3.3/class/avh-ec.admin.php:1156
|
944 |
-
#: 2.8/class/avh-ec.admin.php:1186
|
945 |
-
#, php-format
|
946 |
-
msgid "Your attempt to delete this group: “%s” has failed."
|
947 |
-
msgstr ""
|
948 |
-
|
949 |
-
#: 3.3/class/avh-ec.admin.php:1218
|
950 |
-
#: 2.8/class/avh-ec.admin.php:1248
|
951 |
-
#, php-format
|
952 |
-
msgid "Edit “%s”"
|
953 |
-
msgstr ""
|
954 |
-
|
955 |
-
#: 3.3/class/avh-ec.admin.php:1220
|
956 |
-
#: 2.8/class/avh-ec.admin.php:1250
|
957 |
-
msgid "Edit"
|
958 |
-
msgstr ""
|
959 |
-
|
960 |
-
#: 3.3/class/avh-ec.admin.php:1225
|
961 |
-
#: 2.8/class/avh-ec.admin.php:1255
|
962 |
-
msgid "Delete"
|
963 |
-
msgstr ""
|
964 |
-
|
965 |
-
#: 3.3/class/avh-ec.core.php:448
|
966 |
-
#: 3.3/class/avh-ec.core.php:450
|
967 |
-
#: 2.8/class/avh-ec.core.php:448
|
968 |
-
#: 2.8/class/avh-ec.core.php:450
|
969 |
-
msgid "No categories"
|
970 |
-
msgstr ""
|
971 |
-
|
972 |
-
#: 3.3/class/avh-ec.core.php:661
|
973 |
-
#: 2.8/class/avh-ec.core.php:660
|
974 |
-
#, php-format
|
975 |
-
msgid "View all posts filed under %s"
|
976 |
-
msgstr ""
|
977 |
-
|
978 |
-
#: 3.3/class/avh-ec.core.php:676
|
979 |
-
#: 2.8/class/avh-ec.core.php:675
|
980 |
-
#, php-format
|
981 |
-
msgid "Feed for all posts filed under %s"
|
982 |
-
msgstr ""
|
983 |
-
|
984 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
985 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
986 |
-
msgid "Search Category Groups"
|
987 |
-
msgstr ""
|
988 |
-
|
989 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
990 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
991 |
-
msgid "Popular Category Groups"
|
992 |
-
msgstr ""
|
993 |
-
|
994 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
995 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
996 |
-
msgid "All Category Groups"
|
997 |
-
msgstr ""
|
998 |
-
|
999 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
1000 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
1001 |
-
msgid "Parent Category Group"
|
1002 |
-
msgstr ""
|
1003 |
-
|
1004 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
1005 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
1006 |
-
msgid "Parent Category Group:"
|
1007 |
-
msgstr ""
|
1008 |
-
|
1009 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
1010 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
1011 |
-
msgid "Edit Category Group"
|
1012 |
-
msgstr ""
|
1013 |
-
|
1014 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
1015 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
1016 |
-
msgid "Update Category Group"
|
1017 |
-
msgstr ""
|
1018 |
-
|
1019 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
1020 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
1021 |
-
msgid "Add New Category Group"
|
1022 |
-
msgstr ""
|
1023 |
-
|
1024 |
-
#: 3.3/class/avh-ec.category-group.php:111
|
1025 |
-
#: 2.8/class/avh-ec.category-group.php:111
|
1026 |
-
msgid "New Category Group Name"
|
1027 |
-
msgstr ""
|
1028 |
-
|
1029 |
-
#: 3.3/class/avh-ec.category-group.php:127
|
1030 |
-
#: 2.8/class/avh-ec.category-group.php:127
|
1031 |
-
msgid "This group will not show the widget."
|
1032 |
-
msgstr ""
|
1033 |
-
|
1034 |
-
#: 3.3/class/avh-ec.category-group.php:128
|
1035 |
-
#: 2.8/class/avh-ec.category-group.php:128
|
1036 |
-
msgid "Holds all the categories."
|
1037 |
-
msgstr ""
|
1038 |
-
|
1039 |
-
#: 3.3/class/avh-ec.category-group.php:129
|
1040 |
-
#: 2.8/class/avh-ec.category-group.php:129
|
1041 |
-
msgid "This group will be shown on the front page."
|
1042 |
-
msgstr ""
|
1043 |
-
|
1044 |
-
#: 2.8/class/avh-ec.admin.php:244
|
1045 |
-
#: 2.8/class/avh-ec.admin.php:935
|
1046 |
-
msgid "Announcements"
|
1047 |
-
msgstr ""
|
1048 |
-
|
1049 |
-
#: 2.8/class/avh-ec.admin.php:833
|
1050 |
-
msgid "Categories updated successfully."
|
1051 |
-
msgstr ""
|
1052 |
-
|
1053 |
-
#: 2.8/class/avh-ec.admin.php:1052
|
1054 |
-
msgid "I created a support site at http://forums.avirtualhome.com where you can ask questions or request features."
|
1055 |
-
msgstr ""
|
1056 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/libs/avh-common.php
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('AVH_FRAMEWORK'))
|
3 |
-
die('You are not allowed to call this page directly.');
|
4 |
-
if (! class_exists('AVH_Common')) {
|
5 |
-
|
6 |
-
final class AVH_Common
|
7 |
-
{
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Sends the email
|
11 |
-
*
|
12 |
-
*/
|
13 |
-
public static function sendMail ($to, $subject, $message, $footer = array())
|
14 |
-
{
|
15 |
-
$message = array_merge($message, $footer);
|
16 |
-
$msg = '';
|
17 |
-
foreach ($message as $line) {
|
18 |
-
$msg .= $line . "\r\n";
|
19 |
-
}
|
20 |
-
wp_mail($to, $subject, $msg);
|
21 |
-
return;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Returns the wordpress version
|
26 |
-
* Note: 2.7.x will return 2.7
|
27 |
-
*
|
28 |
-
* @return float
|
29 |
-
*/
|
30 |
-
public static function getWordpressVersion ()
|
31 |
-
{
|
32 |
-
static $_version = null;
|
33 |
-
if (! isset($_version)) {
|
34 |
-
// Include WordPress version
|
35 |
-
require (ABSPATH . WPINC . '/version.php');
|
36 |
-
$_version = (float) $wp_version;
|
37 |
-
}
|
38 |
-
return $_version;
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Determines if the current version of PHP is greater then the supplied value
|
43 |
-
*
|
44 |
-
* @param string
|
45 |
-
* @return bool
|
46 |
-
*/
|
47 |
-
public static function isPHP ($version = '5.0.0')
|
48 |
-
{
|
49 |
-
static $_is_php = null;
|
50 |
-
$version = (string) $version;
|
51 |
-
if (! isset($_is_php[$version])) {
|
52 |
-
$_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? false : true;
|
53 |
-
}
|
54 |
-
return $_is_php[$version];
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Get the base directory of a directory structure
|
59 |
-
*
|
60 |
-
* @param string $directory
|
61 |
-
* @return string
|
62 |
-
*
|
63 |
-
*/
|
64 |
-
public static function getBaseDirectory ($directory)
|
65 |
-
{
|
66 |
-
//get public directory structure eg "/top/second/third"
|
67 |
-
$public_directory = dirname($directory);
|
68 |
-
//place each directory into array
|
69 |
-
$directory_array = explode('/', $public_directory);
|
70 |
-
//get highest or top level in array of directory strings
|
71 |
-
$public_base = max($directory_array);
|
72 |
-
return $public_base;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* This function will take an IP address or IP number in almost any format (that I can think of) and will return it's decimal unsigned equivalent, as a string.
|
77 |
-
* Kind => Input => Return => long2ip(Return)
|
78 |
-
* DottedQuadDec => 192.168.255.109 => 3232300909 => 192.168.255.109
|
79 |
-
* PosIntStr => 3232300909 => 3232300909 => 192.168.255.109
|
80 |
-
* NegIntStr => -1062666387 => 3232300909 => 192.168.255.109
|
81 |
-
* PosInt => 3232300909 => 3232300909 => 192.168.255.109
|
82 |
-
* NegInt => -1062666387 => 3232300909 => 192.168.255.109
|
83 |
-
* DottedQuadHex => 0xc0.0xA8.0xFF.0x6D => 0 => 0.0.0.0
|
84 |
-
* DottedQuadOct => 0300.0250.0377.0155 => 0 => 0.0.0.0
|
85 |
-
* HexIntStr => 0xC0A8FF6D => 0 => 0.0.0.0
|
86 |
-
* HexInt => 3232300909 => 3232300909 => 192.168.255.109
|
87 |
-
*
|
88 |
-
* @param string/numeric $ip
|
89 |
-
*/
|
90 |
-
public static function getIp2long ($ip)
|
91 |
-
{
|
92 |
-
if (is_numeric($ip)) {
|
93 |
-
$return = sprintf("%u", floatval($ip));
|
94 |
-
} else {
|
95 |
-
$return = sprintf("%u", floatval(ip2long($ip)));
|
96 |
-
}
|
97 |
-
return $return;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/libs/avh-db.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('AVH_FRAMEWORK'))
|
3 |
-
die('You are not allowed to call this page directly.');
|
4 |
-
if (! class_exists('AVH_DB')) {
|
5 |
-
|
6 |
-
final class AVH_DB
|
7 |
-
{
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Fetch MySQL Field Names
|
11 |
-
*
|
12 |
-
* @access public
|
13 |
-
* @param string the table name
|
14 |
-
* @return array
|
15 |
-
*/
|
16 |
-
public function getFieldNames ($table = '')
|
17 |
-
{
|
18 |
-
global $wpdb;
|
19 |
-
|
20 |
-
$retval = wp_cache_get('field_names_' . $table, 'avhec');
|
21 |
-
if (false === $retval) {
|
22 |
-
$sql = $this->_getQueryShowColumns($table);
|
23 |
-
|
24 |
-
$result = $wpdb->get_results($sql, ARRAY_A);
|
25 |
-
|
26 |
-
$retval = array ();
|
27 |
-
foreach ($result as $row) {
|
28 |
-
if (isset($row['Field'])) {
|
29 |
-
$retval[] = $row['Field'];
|
30 |
-
}
|
31 |
-
}
|
32 |
-
wp_cache_set('field_names_' . $table, $retval,'avhec',3600);
|
33 |
-
}
|
34 |
-
|
35 |
-
return $retval;
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Determine if a particular field exists
|
40 |
-
* @access public
|
41 |
-
* @param string
|
42 |
-
* @param string
|
43 |
-
* @return boolean
|
44 |
-
*/
|
45 |
-
public function field_exists ($field_name, $table_name)
|
46 |
-
{
|
47 |
-
return (in_array($field_name, $this->getFieldNames($table_name)));
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Show column query
|
52 |
-
*
|
53 |
-
* Generates a platform-specific query string so that the column names can be fetched
|
54 |
-
*
|
55 |
-
* @access public
|
56 |
-
* @param string the table name
|
57 |
-
* @return string
|
58 |
-
*/
|
59 |
-
private function _getQueryShowColumns ($table = '')
|
60 |
-
{
|
61 |
-
global $wpdb;
|
62 |
-
return $wpdb->prepare('SHOW COLUMNS FROM %s', $table);
|
63 |
-
|
64 |
-
}
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/libs/avh-registry.php
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('AVH_FRAMEWORK'))
|
3 |
-
die('You are not allowed to call this page directly.');
|
4 |
-
if (! class_exists('AVH_Settings_Registry')) {
|
5 |
-
|
6 |
-
abstract class AVH_Settings_Registry
|
7 |
-
{
|
8 |
-
/**
|
9 |
-
* Our array of settings
|
10 |
-
* @access protected
|
11 |
-
*/
|
12 |
-
private $_settings = array ();
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Stores settings in the registry
|
16 |
-
* @param string $data
|
17 |
-
* @param string $key The key for the array
|
18 |
-
* @return void
|
19 |
-
*/
|
20 |
-
public function storeSetting ($key, $data)
|
21 |
-
{
|
22 |
-
$this->_settings[$key] = $data;
|
23 |
-
$this->$key = $data;
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Gets a setting from the registry
|
28 |
-
* @param string $key The key in the array
|
29 |
-
* @return mixed
|
30 |
-
*/
|
31 |
-
public function getSetting ($key)
|
32 |
-
{
|
33 |
-
return $this->_settings[$key];
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Removes a setting from the registry
|
38 |
-
* @param string $key The key for the array
|
39 |
-
*/
|
40 |
-
public function removeSetting ($key)
|
41 |
-
{
|
42 |
-
unset($this->_settings[$key]);
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
46 |
-
if (! class_exists('AVH_Class_Registry')) {
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Class registry
|
50 |
-
*
|
51 |
-
*/
|
52 |
-
abstract class AVH_Class_Registry
|
53 |
-
{
|
54 |
-
/**
|
55 |
-
* Our array of objects
|
56 |
-
* @access protected
|
57 |
-
* @var array
|
58 |
-
*/
|
59 |
-
private $_objects = array ();
|
60 |
-
private $_dir;
|
61 |
-
private $_class_file_prefix;
|
62 |
-
private $_class_name_prefix;
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Loads a class
|
66 |
-
*
|
67 |
-
* @param string $class Name of the class you want to load
|
68 |
-
* @param string $type What kind of class, System, Plugin
|
69 |
-
* @param boolean $store Store the class in the registry
|
70 |
-
* @return object
|
71 |
-
*/
|
72 |
-
public function load_class ($class, $type = 'system', $store = false)
|
73 |
-
{
|
74 |
-
if (isset($this->_objects[$class])) {
|
75 |
-
return ($this->_objects[$class]);
|
76 |
-
}
|
77 |
-
switch ($type) {
|
78 |
-
case 'plugin':
|
79 |
-
$in = '/class';
|
80 |
-
$file = $this->_class_file_prefix . $class . '.php';
|
81 |
-
break;
|
82 |
-
case 'system':
|
83 |
-
default:
|
84 |
-
$in = '/libs';
|
85 |
-
$file = 'avh-' . $class . '.php';
|
86 |
-
}
|
87 |
-
require_once ($this->_dir . $in . '/' . strtolower($file));
|
88 |
-
$name = ('system' == $type) ? 'AVH_' . $class : $this->_class_name_prefix . $class;
|
89 |
-
$object = $this->instantiate_class(new $name());
|
90 |
-
if ($store) {
|
91 |
-
$this->_objects[$class] = $object;
|
92 |
-
}
|
93 |
-
return $object;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Instantiate Class
|
98 |
-
*
|
99 |
-
* Returns a new class object by reference, used by load_class() and the DB class.
|
100 |
-
* Required to make PHP 5.3 cry.
|
101 |
-
*
|
102 |
-
* Use: $obj =& instantiate_class(new Foo());
|
103 |
-
*
|
104 |
-
* @access public
|
105 |
-
* @param object
|
106 |
-
* @return object
|
107 |
-
*/
|
108 |
-
protected function instantiate_class (&$class_object)
|
109 |
-
{
|
110 |
-
return $class_object;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* @param $dir the $dir to set
|
115 |
-
*/
|
116 |
-
public function setDir ($dir)
|
117 |
-
{
|
118 |
-
$this->_dir = $dir;
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* @param $class Unique Identifier
|
123 |
-
* @param $class_prefix the $class_prefix to set
|
124 |
-
*/
|
125 |
-
public function setClassFilePrefix ($class_prefix)
|
126 |
-
{
|
127 |
-
$this->_class_file_prefix = $class_prefix;
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* @param $class Unique Identifier
|
132 |
-
* @param $class_name_prefix the $class_name_prefix to set
|
133 |
-
*/
|
134 |
-
public function setClassNamePrefix ($class_name_prefix)
|
135 |
-
{
|
136 |
-
$this->_class_name_prefix = $class_name_prefix;
|
137 |
-
}
|
138 |
-
|
139 |
-
public function setClassProperties ($properties)
|
140 |
-
{
|
141 |
-
$default_properties = array ( 'type' => 'system', 'store' => false );
|
142 |
-
}
|
143 |
-
}
|
144 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/libs/avh-security.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('AVH_FRAMEWORK'))
|
3 |
-
die('You are not allowed to call this page directly.');
|
4 |
-
if (! class_exists('AVH_Security')) {
|
5 |
-
|
6 |
-
final class AVH_Security
|
7 |
-
{
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Local nonce creation. WordPress uses the UID and sometimes I don't want that
|
11 |
-
* Creates a random, one time use token.
|
12 |
-
*
|
13 |
-
* @param string|int $action Scalar value to add context to the nonce.
|
14 |
-
* @return string The one use form token
|
15 |
-
*
|
16 |
-
*/
|
17 |
-
public static function createNonce ($action = -1)
|
18 |
-
{
|
19 |
-
$i = wp_nonce_tick();
|
20 |
-
return substr(wp_hash($i . $action, 'nonce'), - 12, 10);
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Local nonce verification. WordPress uses the UID and sometimes I don't want that
|
25 |
-
* Verify that correct nonce was used with time limit.
|
26 |
-
*
|
27 |
-
* The user is given an amount of time to use the token, so therefore, since the
|
28 |
-
* $action remain the same, the independent variable is the time.
|
29 |
-
*
|
30 |
-
* @param string $nonce Nonce that was used in the form to verify
|
31 |
-
* @param string|int $action Should give context to what is taking place and be the same when nonce was created.
|
32 |
-
* @return bool Whether the nonce check passed or failed.
|
33 |
-
*/
|
34 |
-
public static function verifyNonce ($nonce, $action = -1)
|
35 |
-
{
|
36 |
-
$r = false;
|
37 |
-
$i = wp_nonce_tick();
|
38 |
-
// Nonce generated 0-12 hours ago
|
39 |
-
if (substr(wp_hash($i . $action, 'nonce'), - 12, 10) == $nonce) {
|
40 |
-
$r = 1;
|
41 |
-
} elseif (substr(wp_hash(($i - 1) . $action, 'nonce'), - 12, 10) == $nonce) { // Nonce generated 12-24 hours ago
|
42 |
-
$r = 2;
|
43 |
-
}
|
44 |
-
return $r;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/libs/avh-visitor.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (! defined('AVH_FRAMEWORK'))
|
3 |
-
die('You are not allowed to call this page directly.');
|
4 |
-
if (! class_exists('AVH_Visitor')) {
|
5 |
-
|
6 |
-
final class AVH_Visitor
|
7 |
-
{
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Get the user's IP
|
11 |
-
*
|
12 |
-
* @return string
|
13 |
-
*/
|
14 |
-
public static function getUserIp ()
|
15 |
-
{
|
16 |
-
$ip = array ();
|
17 |
-
foreach (array ( 'HTTP_CF_CONNECTING_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
|
18 |
-
'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key) {
|
19 |
-
if (array_key_exists($key, $_SERVER) === true) {
|
20 |
-
foreach (explode(',', $_SERVER[$key]) as $visitors_ip) {
|
21 |
-
$ip[] = str_replace(' ', '', $visitors_ip);
|
22 |
-
}
|
23 |
-
}
|
24 |
-
}
|
25 |
-
// If for some strange reason we don't get an IP we return imemdiately with 0.0.0.0
|
26 |
-
if (empty($ip)) {
|
27 |
-
return '0.0.0.0';
|
28 |
-
}
|
29 |
-
$ip = array_values(array_unique($ip));
|
30 |
-
$return = null;
|
31 |
-
// In PHP 5.3 and up the function filter_var can be used, much quicker as the regular expression check
|
32 |
-
if (AVH_Common::isPHP('5.3')) {
|
33 |
-
foreach ($ip as $i) {
|
34 |
-
if (filter_var($i, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE)) {
|
35 |
-
$return = $i;
|
36 |
-
break;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
} else {
|
40 |
-
$dec_octet = '(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])';
|
41 |
-
$ip4_address = $dec_octet . '.' . $dec_octet . '.' . $dec_octet . '.' . $dec_octet;
|
42 |
-
$match = array ();
|
43 |
-
foreach ($ip as $i) {
|
44 |
-
if (preg_match('/^' . $ip4_address . '$/', $i, $match)) {
|
45 |
-
if (preg_match('/^(127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)/', $i)) {
|
46 |
-
continue;
|
47 |
-
} else {
|
48 |
-
$return = $i;
|
49 |
-
break;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
if (null === $return) {
|
55 |
-
$return = '0.0.0.0';
|
56 |
-
}
|
57 |
-
return $return;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/readme.txt
DELETED
@@ -1,310 +0,0 @@
|
|
1 |
-
=== AVH Extended Categories Widgets ===
|
2 |
-
Contributors: petervanderdoes
|
3 |
-
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.5
|
7 |
-
Stable tag: 3.6.5
|
8 |
-
|
9 |
-
The AVH Extended Categories Widgets gives you three widgets for displaying categories.
|
10 |
-
== Description ==
|
11 |
-
|
12 |
-
The AVH Extended Categories Widgets gives you three widgets for displaying categories.
|
13 |
-
|
14 |
-
1. Replacement of the default category widget to allow for greater customization.
|
15 |
-
|
16 |
-
1. A top categories widget. Shows the top X categories. This requires WordPress 2.8 or higher.
|
17 |
-
|
18 |
-
1. A Category Group widget. Shows categories from a group which is associated with the post/page that the visitor is looking at. Categories can be added to a group. Multiple groups can be made and every post/page can be associated with a different group. This requires WordPress 2.8 or higher.
|
19 |
-
|
20 |
-
The replacement widget gives you the following customizable options:
|
21 |
-
|
22 |
-
* Title of the widget.
|
23 |
-
* Display as List or Drop-down.
|
24 |
-
* Show number of posts (Count) after the category.
|
25 |
-
* Hide empty categories.
|
26 |
-
* Show categories hierarchical.
|
27 |
-
* Show categories up to a certain depth. (Requires WordPress 2.8 or higher).
|
28 |
-
* Sort by ID, Name, Count, Slug or manual order (Requires WordPress 3.3 or higher).
|
29 |
-
* Sort ascending or descending.
|
30 |
-
* Show RSS link after the category as text or image.
|
31 |
-
* Select which categories to show. (Requires WordPress 2.5.1 or higher).
|
32 |
-
|
33 |
-
The Top Categories widget gives you the following customizable options:
|
34 |
-
|
35 |
-
* Title of the widget.
|
36 |
-
* How many categories to show.
|
37 |
-
* Display as List or Drop-down.
|
38 |
-
* Show number of posts (Count) after the category.
|
39 |
-
* Sort by ID, Name, Count, Slug.
|
40 |
-
* Sort ascending or descending.
|
41 |
-
* Show RSS link after the category as text or image.
|
42 |
-
* Select which categories to show. (Requires WordPress 2.5.1 or higher).
|
43 |
-
|
44 |
-
The Category Group widget gives you the following customizable options:
|
45 |
-
|
46 |
-
* Title of the widget. Either per widget or per group.
|
47 |
-
* Display as List or Drop-down.
|
48 |
-
* Show number of posts (Count) after the category.
|
49 |
-
* Hide empty categories.
|
50 |
-
* Sort by ID, Name, Count, Slug.
|
51 |
-
* Sort ascending or descending.
|
52 |
-
* Show RSS link after the category as text or image.
|
53 |
-
|
54 |
-
You can set the following options for the Category Group Widget:
|
55 |
-
|
56 |
-
* Which group to show on the 'special' pages. The 'special' pages are: Home, Category archive, Tag archive, Daily/Monthly/Yearly archive, Author archive, Search results page.
|
57 |
-
* Which group to show when no group is associated with a post. Useful for older posts that don't have the association.
|
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)
|
65 |
-
* Dutch - Nederlands (nl_NL)
|
66 |
-
* German - Deutsch (de_DE)
|
67 |
-
* Greek (el)
|
68 |
-
* French - Français (fr_FR)
|
69 |
-
* Indonesian - Bahasa Indonesia (id_ID)
|
70 |
-
* Italian - Italiano (it_IT)
|
71 |
-
* Russian — Русский (ru_RU)
|
72 |
-
* Spanish - Español (es_ES)
|
73 |
-
* Swedish - Svenska (sv_SE)
|
74 |
-
* Turkish - Türkçe (tr)
|
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:
|
81 |
-
|
82 |
-
1. Unzip the extended-categories-widget archive and put the directory "extended-categories-widget" into your "plug-ins" folder (wp-content/plugins/).
|
83 |
-
|
84 |
-
1. Activate the plug-in
|
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 |
-
I created a support site at http://forums.avirtualhome.com where you can ask questions or request features.
|
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.
|
96 |
-
|
97 |
-
Here is how it works: Say you have 5 top level categories and each top level has a number of children. You could manually select all the Top Level categories you want to show but now you can do the following:
|
98 |
-
You select to display all categories, select to Show hierarchy and select how many levels you want to show, in this case Toplevel only.
|
99 |
-
|
100 |
-
= I want to help and translate the plug-in =
|
101 |
-
I have setup a project in [Launchpad](https://translations.launchpad.net/avhextendedcategories/trunk) for translating the plug-in.
|
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
|
109 |
-
Movie
|
110 |
-
Music
|
111 |
-
|
112 |
-
Setup several Category Group widgets and associated each widget with one or more groups.
|
113 |
-
Widget 1 has association with Free Time
|
114 |
-
Widget 2 has association with Theater, Movie and Music
|
115 |
-
Widget 3 has association with Theater, Movie and Music
|
116 |
-
|
117 |
-
Page has associations the groups Free Time and Theater
|
118 |
-
* Widget 1: Shows categories of the Free Time group
|
119 |
-
* Widget 2: Shows categories of the Theater group.
|
120 |
-
* Widget 3: Not displayed
|
121 |
-
|
122 |
-
Page has associations the group Movie.
|
123 |
-
* Widget 1: Not displayed
|
124 |
-
* Widget 2: Shows categories of the Movie group.
|
125 |
-
* Widget 3: Not displayed
|
126 |
-
|
127 |
-
|
128 |
-
Page has associations the groups Free Time, Movie and Music
|
129 |
-
* Widget 1: Shows categories of the Free Time group
|
130 |
-
* Widget 2: Shows categories of the Movie or Music group.
|
131 |
-
* Widget 3: Shows categories of the Music or Movie group.
|
132 |
-
Whether Widget 2 shows Movie or Music depends on the creation order of groups. If Widget 2 shows Movie, Widget 3 will show Music but if Widget 2 shows Music, Widget 3 will show Movie.
|
133 |
-
|
134 |
-
== Screen shots ==
|
135 |
-
None
|
136 |
-
|
137 |
-
== Changelog ==
|
138 |
-
= Version 3.6.6 =
|
139 |
-
* Missed a translatable string.
|
140 |
-
* Add French translation.
|
141 |
-
* Fix for WordPress 3.5
|
142 |
-
|
143 |
-
= Version 3.6.5 =
|
144 |
-
* Bugfix: Can not delete category groups
|
145 |
-
|
146 |
-
= Version 3.6.4 =
|
147 |
-
* Bugfix: Problem with categories not showing up when showing dropdown categories.
|
148 |
-
|
149 |
-
= Version 3.6.3 =
|
150 |
-
* Bugfix: Problem with url's on Windows platform.
|
151 |
-
|
152 |
-
= Version 3.6.2 =
|
153 |
-
* Bugfix: Another problem related to WordPress prior 3.3
|
154 |
-
|
155 |
-
= Version 3.6.1 =
|
156 |
-
* Bugfix: Problem with a flat display of categories.
|
157 |
-
* Bugfix: Problem loading the plugin on WordPress 3.2.x
|
158 |
-
|
159 |
-
= Version 3.6 =
|
160 |
-
* Adds Manual Order option. No need for 3rd party plugin anymore. This only works in WordPress 3.3.x
|
161 |
-
* Speed up the creation of the categories checklist in the widgets.
|
162 |
-
|
163 |
-
= Version 3.5.1 =
|
164 |
-
* Bugfix: The columns in the admin section don't save, making certain columns disappear.
|
165 |
-
|
166 |
-
= Version 3.5 =
|
167 |
-
* RFC: Adds the ability for the widgets to sort the categories as set with plugin My Category Order. This plugin allows to order categories manually.
|
168 |
-
|
169 |
-
= Version 3.4.2 =
|
170 |
-
* Bugfix: Fails to display the Category Group Widget when the widget is to display any group.
|
171 |
-
|
172 |
-
= Version 3.4.1 =
|
173 |
-
* Bugfix: Problems with multiple category group widgets.
|
174 |
-
* Bugfix: The category group All sometimes does not contain all categories.
|
175 |
-
|
176 |
-
= Version 3.4 =
|
177 |
-
* RFC: Category Groups can be associated with categories. This enables the plugin to display the Category Group Widget for that category group on the category archive page.
|
178 |
-
* Bugfix: In combination with WP Supercache an error can occur.
|
179 |
-
* Bugfix: An error occurs if there are no categories present in WordPress.
|
180 |
-
|
181 |
-
= Version 3.3.5 =
|
182 |
-
* Bugfix: Category Groups would be created every time you saved a post.
|
183 |
-
|
184 |
-
= Version 3.3.4 =
|
185 |
-
* Bugfix: Problem with initializing the plugin.
|
186 |
-
|
187 |
-
= Version 3.3.3 =
|
188 |
-
* RFC: Changed selecting Category groups in posts from tag-like to checkboxes.
|
189 |
-
* Removed the Menu item Category groups under Posts and Pages.
|
190 |
-
|
191 |
-
= Version 3.3.2 =
|
192 |
-
* Added several new localizations.
|
193 |
-
* Bugfix: When using multiple Category Group widgets, all of them would show up on the special pages instead of just the one selected in the options.
|
194 |
-
* Bugfix: Localization didn't work.
|
195 |
-
|
196 |
-
= Version 3.3.1 =
|
197 |
-
* Bugfix: A PHP warning would show up when using multiple Category Group widgets.
|
198 |
-
|
199 |
-
= Version 3.3 =
|
200 |
-
* Ability to assign multiple Category Groups to a post/page.
|
201 |
-
* A Category Group can be assigned to 'special' pages. The 'special' pages are: Home, Category archive, Tag archive, Daily/Monthly/Yearly archive, Author archive, Search results page.
|
202 |
-
* Bugfix: When using SSL in the admin section save would redirect to non-SSL and not saving the options.
|
203 |
-
* Bugfix: Hierarchy in the dropdown with selected categories didn't work properly.
|
204 |
-
* Bugfix: The widget for the Groups was a different setup as the others breaking certain theme layouts.
|
205 |
-
|
206 |
-
= Version 3.2.2 =
|
207 |
-
* Bugfix: Problem with Chrome and saving the category group.
|
208 |
-
* Bugfix: Extra metabox displayed. The plugin uses it's own metabox for Category Group selection.
|
209 |
-
|
210 |
-
= Version 3.2.1 =
|
211 |
-
* Speed improvements in the admin section when there are a lot of categories and several Categories widgets.
|
212 |
-
|
213 |
-
= Version 3.2.0.1 =
|
214 |
-
* Bugfix: Forgot to add a directory into SVN.
|
215 |
-
|
216 |
-
= Version 3.2 =
|
217 |
-
* Compatibility issues with upcoming WordPress 3 resolved.
|
218 |
-
* Bugfix: Description of the groups didn't save.
|
219 |
-
* RFC: All widgets - Option to sort the categories by slug.
|
220 |
-
* RFC: Category Group widget - Ability to set the widget title per group.
|
221 |
-
|
222 |
-
= Version 3.1 =
|
223 |
-
* Wrap the group widget in a div with id = name of group. This enables CSS modification based on the group.
|
224 |
-
* Hierarchical now works with the option "Select Categories" as well.
|
225 |
-
* Bugfix: If the normal widget and group widget are displayed on the same page as dropdown, the selected option could be the wrong one.
|
226 |
-
* Bugfix: In a RTL-based theme the admin menu would flip back to the left, instead of staying right.
|
227 |
-
* Bugfix: Hierarchical works in the Category Group widget.
|
228 |
-
* Bugfix: Change div tags in widget from ID to class to comply to W3 validation.
|
229 |
-
|
230 |
-
= Version 3.0.2 =
|
231 |
-
* Bugfix: The plugin conflicts with the standard theme/plugin editor in WordPress
|
232 |
-
|
233 |
-
= Version 3.0.1 =
|
234 |
-
* Bugfix: Definition of the metabox for post/page in the wrong place
|
235 |
-
|
236 |
-
= Version 3.0 =
|
237 |
-
* Renamed the plug-in to AVH Extended Categories Widgets
|
238 |
-
* Added new widget: Category Group. You can create groups with categories and associate the group with a post. The widget will show the categories from the group.
|
239 |
-
* Added translation: Italian - Italiano (it_IT)
|
240 |
-
* Added css file for widgets. Using the CSS you can change the layout of the text.
|
241 |
-
* Redid settings. Settings are now a separate menu.
|
242 |
-
* Reduced memory foot print.
|
243 |
-
* Increased speed.
|
244 |
-
* Development improvements.
|
245 |
-
* Added uninstall capability.
|
246 |
-
* Bugfix: The hierarchy check mark in the widgets would disappear.
|
247 |
-
* Bugfix: In drop down list the hierarchy would appear despite the fact that "Show selected categories only" was selected.
|
248 |
-
* Note: Some of the translations are not yet complete with version 3.0.
|
249 |
-
|
250 |
-
= Version 2.3.3 =
|
251 |
-
* Bugfix: Validation error on drop down categories.
|
252 |
-
|
253 |
-
= Version 2.3.2 =
|
254 |
-
* Bugfix: Saving the option didn't work
|
255 |
-
* Added translation: Spanish - Español (es_ES)
|
256 |
-
|
257 |
-
= Version 2.3.1 =
|
258 |
-
* Bugfix: Undefined function
|
259 |
-
|
260 |
-
= Version 2.3 =
|
261 |
-
* RFC: You can change the text Select Category, without editing any translation file.
|
262 |
-
* Bugfix: Selecting one parent wouldn't show it's children.
|
263 |
-
* You can now display only selected categories. This didn't work properly in an hierachical category structure.
|
264 |
-
* Added Czech translation.
|
265 |
-
|
266 |
-
= Version 2.2 =
|
267 |
-
* RFC: Internationalization of the plug-in.
|
268 |
-
* Bugfix: W3 Validation Errors when using drop down categories.
|
269 |
-
* Added option to exclude categories from displaying instead of including them. (Compliments to: Jose Luis Moya - http://www.alsur.es )
|
270 |
-
|
271 |
-
= Version 2.1 =
|
272 |
-
* RFC: The path for the RSS image can be URI.
|
273 |
-
|
274 |
-
= Version 2.0.3 =
|
275 |
-
* Bugfix: When selecting hierarchy and showing of all levels, the hierarchy wouldn't be shown.
|
276 |
-
|
277 |
-
= Version 2.0.2 =
|
278 |
-
* Top categories widget caused error in PHP4.
|
279 |
-
|
280 |
-
= Version 2.0.1 =
|
281 |
-
* Reported problem with calling a class by self ()
|
282 |
-
|
283 |
-
= Version 2.0 =
|
284 |
-
* Updated for WordPress 2.8. Unlimited amount of Extended Categories widgets is now possible.
|
285 |
-
* In WordPress 2.8 you have the options to select depth when showing hierarchy. See FAQ for more information.
|
286 |
-
* With WordPress 2.8 there is a new widget, AVH Extended Categories Top. This will show the top categories based on amount of posts.
|
287 |
-
|
288 |
-
= Version 1.5.1 =
|
289 |
-
* Bugfix: Compatibility issue with the plug-in wp-security-scan
|
290 |
-
|
291 |
-
= Version 1.5 =
|
292 |
-
* RFC: Option to show RSS feed after categories
|
293 |
-
|
294 |
-
= Version 1.4.1 =
|
295 |
-
* Bugfix: Problem when using multiple widgets with the drop down option.
|
296 |
-
|
297 |
-
= Version 1.4 =
|
298 |
-
* Ability to have up to 9 widgets.
|
299 |
-
|
300 |
-
= Version 1.3 =
|
301 |
-
* You can select which categories to show (Requires WordPress 2.5.1 or higher).
|
302 |
-
|
303 |
-
= Version 1.2 =
|
304 |
-
* When no category or an empty category is selected the dropdown menu shows Select Category, like the default category widget.
|
305 |
-
|
306 |
-
= Version 1.1 =
|
307 |
-
* Drop down menu didn't work. Page wasn't refreshed with selected category.
|
308 |
-
|
309 |
-
= Version 1.0 =
|
310 |
-
* Initial version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/uninstall.php
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// This is an include file, all normal WordPress functions will still work.
|
3 |
-
// Because the plugin is already deactivated it won't regonize any class declarations.
|
4 |
-
|
5 |
-
|
6 |
-
if (! defined('ABSPATH') && ! defined('WP_UNINSTALL_PLUGIN'))
|
7 |
-
exit();
|
8 |
-
|
9 |
-
global $wpdb;
|
10 |
-
if ('extended-categories-widget' == dirname($file)) {
|
11 |
-
delete_option('avhec');
|
12 |
-
$db__used_by_plugin = $wpdb->prefix . 'avhec_category_groups';
|
13 |
-
$result = $wpdb->query('DROP TABLE IF EXISTS `' . $db__used_by_plugin . '`');
|
14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/widget-pre2.8.php
DELETED
@@ -1,482 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function widget_extended_categories_init ()
|
4 |
-
{
|
5 |
-
// Widgets exists?
|
6 |
-
if (! function_exists('wp_register_sidebar_widget') || ! function_exists('wp_register_widget_control')) {
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
function widget_extended_categories ($args, $number = 1)
|
11 |
-
{
|
12 |
-
$version = '3.6.4';
|
13 |
-
// Check for version
|
14 |
-
require (ABSPATH . WPINC . '/version.php');
|
15 |
-
if (version_compare($wp_version, '2.5.1', '<')) {
|
16 |
-
$avh_extcat_canselectcats = false;
|
17 |
-
} else {
|
18 |
-
$avh_extcat_canselectcats = true;
|
19 |
-
}
|
20 |
-
extract($args);
|
21 |
-
$options = get_option('widget_extended_categories');
|
22 |
-
$c = $options[$number]['count'] ? '1' : '0';
|
23 |
-
$h = $options[$number]['hierarchical'] ? '1' : '0';
|
24 |
-
$e = $options[$number]['hide_empty'] ? '1' : '0';
|
25 |
-
$s = $options[$number]['sort_column'] ? $options[$number]['sort_column'] : 'name';
|
26 |
-
$o = $options[$number]['sort_order'] ? $options[$number]['sort_order'] : 'asc';
|
27 |
-
$r = $options[$number]['rssfeed'] ? 'RSS' : '';
|
28 |
-
$i = $options[$number]['rssimage'] ? $options[$number]['rssimage'] : '';
|
29 |
-
if (empty($r)) {
|
30 |
-
$i = '';
|
31 |
-
}
|
32 |
-
|
33 |
-
$title = empty($options[$number]['title']) ? __('Categories') : attribute_escape($options[$number]['title']);
|
34 |
-
$style = empty($options[$number]['style']) ? 'list' : $options[$number]['style'];
|
35 |
-
if ($avh_extcat_canselectcats) {
|
36 |
-
if ($options[$number]['post_category']) {
|
37 |
-
$post_category = unserialize($options[$number]['post_category']);
|
38 |
-
$included_cats = implode(",", $post_category);
|
39 |
-
}
|
40 |
-
$cat_args = array('include'=>$included_cats, 'orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'hide_empty'=>$e, 'hierarchical'=>$h, 'title_li'=>'', 'show_option_none'=>__('Select Category'), 'feed'=>$r, 'feed_image'=>$i, 'name'=>'ec-cat-' . $number, 'depth'=>2);
|
41 |
-
} else {
|
42 |
-
$cat_args = array('orderby'=>$s, 'order'=>$o, 'show_count'=>$c, 'hide_empty'=>$e, 'hierarchical'=>$h, 'title_li'=>'', 'show_option_none'=>__('Select Category'), 'feed'=>$r, 'feed_image'=>$i, 'name'=>'ec-cat-' . $number);
|
43 |
-
}
|
44 |
-
echo $before_widget;
|
45 |
-
echo '<!-- AVH Extended Categories version ' . $version . ' | http://blog.avirtualhome.com/wordpress-plugins/ -->';
|
46 |
-
echo $before_title . $title . $after_title;
|
47 |
-
|
48 |
-
if ($style == 'list') {
|
49 |
-
echo '<ul>';
|
50 |
-
wp_list_categories($cat_args);
|
51 |
-
echo '</ul>';
|
52 |
-
} else {
|
53 |
-
wp_dropdown_categories($cat_args);
|
54 |
-
?>
|
55 |
-
<script lang='javascript'><!--
|
56 |
-
var ec_dropdown_<?php
|
57 |
-
echo ($number);
|
58 |
-
?> = document.getElementById('ec-cat-<?php
|
59 |
-
echo ($number);
|
60 |
-
?>');
|
61 |
-
function ec_onCatChange_<?php
|
62 |
-
echo ($number);
|
63 |
-
?>() {
|
64 |
-
if ( ec_dropdown_<?php
|
65 |
-
echo ($number);
|
66 |
-
?>.options[ec_dropdown_<?php
|
67 |
-
echo ($number);
|
68 |
-
?>.selectedIndex].value > 0 ) {
|
69 |
-
location.href = "<?php
|
70 |
-
echo get_option('home');
|
71 |
-
?>/?cat="+ec_dropdown_<?php
|
72 |
-
echo ($number);
|
73 |
-
?>.options[ec_dropdown_<?php
|
74 |
-
echo ($number);
|
75 |
-
?>.selectedIndex].value;
|
76 |
-
}
|
77 |
-
}
|
78 |
-
ec_dropdown_<?php
|
79 |
-
echo ($number);
|
80 |
-
?>.onchange = ec_onCatChange_<?php
|
81 |
-
echo ($number);
|
82 |
-
?>;
|
83 |
-
--></script>
|
84 |
-
<?php
|
85 |
-
}
|
86 |
-
echo $after_widget;
|
87 |
-
}
|
88 |
-
|
89 |
-
function widget_extended_categories_control ($number = 1)
|
90 |
-
{
|
91 |
-
// Check for version
|
92 |
-
require (ABSPATH . WPINC . '/version.php');
|
93 |
-
if (version_compare($wp_version, '2.5.1', '<')) {
|
94 |
-
$avh_extcat_canselectcats = false;
|
95 |
-
} else {
|
96 |
-
$avh_extcat_canselectcats = true;
|
97 |
-
}
|
98 |
-
// Get actual options
|
99 |
-
$options = $newoptions = get_option('widget_extended_categories');
|
100 |
-
if (! is_array($options)) {
|
101 |
-
$options = $newoptions = array();
|
102 |
-
}
|
103 |
-
// Post to new options array
|
104 |
-
|
105 |
-
|
106 |
-
if ($_POST['categories-submit-' . $number]) {
|
107 |
-
$newoptions[$number]['title'] = strip_tags(stripslashes($_POST['categories-title-' . $number]));
|
108 |
-
$newoptions[$number]['count'] = isset($_POST['categories-count-' . $number]);
|
109 |
-
$newoptions[$number]['hierarchical'] = isset($_POST['categories-hierarchical-' . $number]);
|
110 |
-
$newoptions[$number]['hide_empty'] = isset($_POST['categories-hide_empty-' . $number]);
|
111 |
-
$newoptions[$number]['sort_column'] = strip_tags(stripslashes($_POST['categories-sort_column-' . $number]));
|
112 |
-
$newoptions[$number]['sort_order'] = strip_tags(stripslashes($_POST['categories-sort_order-' . $number]));
|
113 |
-
$newoptions[$number]['style'] = strip_tags(stripslashes($_POST['categories-style-' . $number]));
|
114 |
-
$newoptions[$number]['rssfeed'] = isset($_POST['categories-rssfeed-' . $number]);
|
115 |
-
$newoptions[$number]['rssimage'] = attribute_escape($_POST['categories-rssimage-' . $number]);
|
116 |
-
if ($avh_extcat_canselectcats) {
|
117 |
-
if (in_array('-1', $_POST['post_category-' . $number], true)) {
|
118 |
-
$newoptions[$number]['post_category'] = false;
|
119 |
-
} else {
|
120 |
-
$newoptions[$number]['post_category'] = serialize($_POST['post_category-' . $number]);
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
// Update if new options
|
127 |
-
if ($options != $newoptions) {
|
128 |
-
$options = $newoptions;
|
129 |
-
update_option('widget_extended_categories', $options);
|
130 |
-
}
|
131 |
-
|
132 |
-
// Prepare data for display
|
133 |
-
$title = htmlspecialchars($options[$number]['title'], ENT_QUOTES);
|
134 |
-
$count = $options[$number]['count'] ? 'checked="checked"' : '';
|
135 |
-
$hierarchical = $options[$number]['hierarchical'] ? 'checked="checked"' : '';
|
136 |
-
$hide_empty = $options[$number]['hide_empty'] ? 'checked="checked"' : '';
|
137 |
-
$sort_id = ($options[$number]['sort_column'] == 'ID') ? ' SELECTED' : '';
|
138 |
-
$sort_name = ($options[$number]['sort_column'] == 'name') ? ' SELECTED' : '';
|
139 |
-
$sort_count = ($options[$number]['sort_column'] == 'count') ? ' SELECTED' : '';
|
140 |
-
$sort_order_a = ($options[$number]['sort_order'] == 'asc') ? ' SELECTED' : '';
|
141 |
-
$sort_order_d = ($options[$number]['sort_order'] == 'desc') ? ' SELECTED' : '';
|
142 |
-
$style_list = ($options[$number]['style'] == 'list') ? ' SELECTED' : '';
|
143 |
-
$style_drop = ($options[$number]['style'] == 'drop') ? ' SELECTED' : '';
|
144 |
-
$rssfeed = $options[$number]['rssfeed'] ? 'checked="checked"' : '';
|
145 |
-
$rssimage = htmlspecialchars($options[$number]['rssimage'], ENT_QUOTES);
|
146 |
-
if ($avh_extcat_canselectcats) {
|
147 |
-
$selected_cats = ($options[$number]['post_category'] != '') ? unserialize($options[$number]['post_category']) : false;
|
148 |
-
}
|
149 |
-
?>
|
150 |
-
<div><label for="categories-title-<?php
|
151 |
-
echo $number;
|
152 |
-
?>"><?php
|
153 |
-
_e('Title:');
|
154 |
-
?>
|
155 |
-
<input style="width: 250px;"
|
156 |
-
id="categories-title-<?php
|
157 |
-
echo $number;
|
158 |
-
?>"
|
159 |
-
name="categories-title-<?php
|
160 |
-
echo $number;
|
161 |
-
?>" type="text"
|
162 |
-
value="<?php
|
163 |
-
echo $title;
|
164 |
-
?>" /> </label> <label
|
165 |
-
for="categories-count-<?php
|
166 |
-
echo $number;
|
167 |
-
?>"
|
168 |
-
style="line-height: 35px; display: block;">Show post counts <input
|
169 |
-
class="checkbox" type="checkbox" <?php
|
170 |
-
echo $count;
|
171 |
-
?>
|
172 |
-
id="categories-count-<?php
|
173 |
-
echo $number;
|
174 |
-
?>"
|
175 |
-
name="categories-count-<?php
|
176 |
-
echo $number;
|
177 |
-
?>" /> </label> <label
|
178 |
-
for="categories-hierarchical"
|
179 |
-
style="line-height: 35px; display: block;">Show hierarchy <input
|
180 |
-
class="checkbox" type="checkbox" <?php
|
181 |
-
echo $hierarchical;
|
182 |
-
?>
|
183 |
-
id="categories-hierarchical-<?php
|
184 |
-
echo $number;
|
185 |
-
?>"
|
186 |
-
name="categories-hierarchical-<?php
|
187 |
-
echo $number;
|
188 |
-
?>" /> </label> <label
|
189 |
-
for="categories-hide_empty-<?php
|
190 |
-
echo $number;
|
191 |
-
?>"
|
192 |
-
style="line-height: 35px; display: block;">Hide empty categories <input
|
193 |
-
class="checkbox" type="checkbox" <?php
|
194 |
-
echo $hide_empty;
|
195 |
-
?>
|
196 |
-
id="categories-hide_empty-<?php
|
197 |
-
echo $number;
|
198 |
-
?>"
|
199 |
-
name="categories-hide_empty-<?php
|
200 |
-
echo $number;
|
201 |
-
?>" /> </label> <label
|
202 |
-
for="categories-sort_column-<?php
|
203 |
-
echo $number;
|
204 |
-
?>"
|
205 |
-
style="line-height: 35px; display: block;">Sort by <select
|
206 |
-
id="categories-sort_column-<?php
|
207 |
-
echo $number;
|
208 |
-
?>"
|
209 |
-
name="categories-sort_column-<?php
|
210 |
-
echo $number;
|
211 |
-
?>">
|
212 |
-
<option value="ID" <?php
|
213 |
-
echo $sort_id?>>ID</option>
|
214 |
-
<option value="name" <?php
|
215 |
-
echo $sort_name?>>Name</option>
|
216 |
-
<option value="count" <?php
|
217 |
-
echo $sort_count?>>Count</option>
|
218 |
-
</select> </label> <label
|
219 |
-
for="categories-sort_order-<?php
|
220 |
-
echo $number;
|
221 |
-
?>"
|
222 |
-
style="line-height: 35px; display: block;">Sort order <select
|
223 |
-
id="categories-sort_order-<?php
|
224 |
-
echo $number;
|
225 |
-
?>"
|
226 |
-
name="categories-sort_order-<?php
|
227 |
-
echo $number;
|
228 |
-
?>">
|
229 |
-
<option value="asc" <?php
|
230 |
-
echo $sort_order_a?>>Ascending</option>
|
231 |
-
<option value="desc" <?php
|
232 |
-
echo $sort_order_d?>>Descending</option>
|
233 |
-
</select> </label> <label for="categories-style-<?php
|
234 |
-
echo $number;
|
235 |
-
?>"
|
236 |
-
style="line-height: 35px; display: block;">Display style <select
|
237 |
-
id="categories-style-<?php
|
238 |
-
echo $number;
|
239 |
-
?>"
|
240 |
-
name="categories-style-<?php
|
241 |
-
echo $number;
|
242 |
-
?>">
|
243 |
-
<option value='list' <?php
|
244 |
-
echo $style_list;
|
245 |
-
?>>List</option>
|
246 |
-
<option value='drop' <?php
|
247 |
-
echo $style_drop;
|
248 |
-
?>>Drop down</option>
|
249 |
-
</select> </label> <label
|
250 |
-
for="categories-rssfeed-<?php
|
251 |
-
echo $number;
|
252 |
-
?>"
|
253 |
-
style="line-height: 35px; display: block;">Show RSS Feed <input
|
254 |
-
class="checkbox" type="checkbox" <?php
|
255 |
-
echo $rssfeed;
|
256 |
-
?>
|
257 |
-
id="categories-rssfeed-<?php
|
258 |
-
echo $number;
|
259 |
-
?>"
|
260 |
-
name="categories-rssfeed-<?php
|
261 |
-
echo $number;
|
262 |
-
?>" /> </label> <label
|
263 |
-
for="categories-rssimage-<?php
|
264 |
-
echo $number;
|
265 |
-
?>"><?php
|
266 |
-
_e('Path (URI) to RSS image:');
|
267 |
-
?>
|
268 |
-
<input style="width: 250px;"
|
269 |
-
id="categories-rssimage-<?php
|
270 |
-
echo $number;
|
271 |
-
?>"
|
272 |
-
name="categories-rssimage-<?php
|
273 |
-
echo $number;
|
274 |
-
?>" type="text"
|
275 |
-
value="<?php
|
276 |
-
echo $rssimage;
|
277 |
-
?>" /> </label>
|
278 |
-
|
279 |
-
<?php
|
280 |
-
if ($avh_extcat_canselectcats) {
|
281 |
-
echo ' <b>Include these categories</b><hr />';
|
282 |
-
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;">';
|
283 |
-
echo ' <li id="category--1-' . $number . '" class="popular-category">';
|
284 |
-
echo ' <label for="in-category--1-' . $number . '" class="selectit">';
|
285 |
-
echo ' <input value="-1" name="post_category-' . $number . '[]" id="in-category--1-' . $number . '" type="checkbox"';
|
286 |
-
if (! $selected_cats) {
|
287 |
-
echo 'checked';
|
288 |
-
}
|
289 |
-
echo '> Include All Categories';
|
290 |
-
echo ' </label>';
|
291 |
-
echo ' </li>';
|
292 |
-
avh_wp_category_checklist(0, 0, $selected_cats, false, $number);
|
293 |
-
echo ' </ul>';
|
294 |
-
}
|
295 |
-
?>
|
296 |
-
|
297 |
-
<input type="hidden" id="categories-submit-<?php
|
298 |
-
echo $number;
|
299 |
-
?>"
|
300 |
-
name="categories-submit-<?php
|
301 |
-
echo $number;
|
302 |
-
?>" value="1" /></div>
|
303 |
-
<?php
|
304 |
-
}
|
305 |
-
|
306 |
-
/**
|
307 |
-
* Called after the widget_extended_categories_page form has been submitted.
|
308 |
-
* Set the amount of widgets wanted and register the widgets
|
309 |
-
*
|
310 |
-
*/
|
311 |
-
function widget_extended_categories_setup ()
|
312 |
-
{
|
313 |
-
$options = $newoptions = get_option('widget_extended_categories');
|
314 |
-
if (isset($_POST['extended_categories-number-submit'])) {
|
315 |
-
$number = (int) $_POST['extended_categories-number'];
|
316 |
-
if ($number > 9)
|
317 |
-
$number = 9;
|
318 |
-
if ($number < 1)
|
319 |
-
$number = 1;
|
320 |
-
$newoptions['number'] = $number;
|
321 |
-
}
|
322 |
-
if ($options != $newoptions) {
|
323 |
-
$options = $newoptions;
|
324 |
-
update_option('widget_extended_categories', $options);
|
325 |
-
widget_extended_categories_register($options['number']);
|
326 |
-
}
|
327 |
-
}
|
328 |
-
|
329 |
-
/**
|
330 |
-
* How many Wish List widgets are wanted.
|
331 |
-
*
|
332 |
-
*/
|
333 |
-
function widget_extended_categories_page ()
|
334 |
-
{
|
335 |
-
$options = get_option('widget_extended_categories');
|
336 |
-
?>
|
337 |
-
<div class="wrap">
|
338 |
-
<form method="post">
|
339 |
-
<h2><?php
|
340 |
-
_e('AVH Extended Categories Widgets', 'avhextendedcategories');
|
341 |
-
?></h2>
|
342 |
-
<p style="line-height: 30px;"><?php
|
343 |
-
_e('How many wishlist widgets would you like?', 'avhextendedcategories');
|
344 |
-
?>
|
345 |
-
<select id="extended_categories-number"
|
346 |
-
name="extended_categories-number"
|
347 |
-
value="<?php
|
348 |
-
echo $options['number'];
|
349 |
-
?>">
|
350 |
-
<?php
|
351 |
-
for ($i = 1; $i < 10; ++ $i)
|
352 |
-
echo "<option value='$i' " . ($options['number'] == $i ? "selected='selected'" : '') . ">$i</option>";
|
353 |
-
?>
|
354 |
-
</select> <span class="submit"><input type="submit"
|
355 |
-
name="extended_categories-number-submit"
|
356 |
-
id="extended_categories-number-submit"
|
357 |
-
value="<?php
|
358 |
-
echo attribute_escape(__('Save', 'avhextendedcategories'));
|
359 |
-
?>" /></span></p>
|
360 |
-
</form>
|
361 |
-
</div>
|
362 |
-
<?php
|
363 |
-
}
|
364 |
-
|
365 |
-
function widget_extended_categories_register ()
|
366 |
-
{
|
367 |
-
$options = get_option('widget_extended_categories');
|
368 |
-
|
369 |
-
$number = (int) $options['number'];
|
370 |
-
if ($number < 1)
|
371 |
-
$number = 1;
|
372 |
-
if ($number > 9)
|
373 |
-
$number = 9;
|
374 |
-
for ($i = 1; $i <= 9; $i ++) {
|
375 |
-
$id = "extended-categories-$i";
|
376 |
-
$name = sprintf(__('Extended Categories %d'), $i);
|
377 |
-
wp_register_sidebar_widget($id, $name, $i <= $number ? 'widget_extended_categories' : /* unregister */ '', array('classname'=>'widget_extended_categories_init'), $i);
|
378 |
-
wp_register_widget_control($id, $name, $i <= $number ? 'widget_extended_categories_control' : /* unregister */ '', array('width'=>300, 'height'=>270), $i);
|
379 |
-
}
|
380 |
-
add_action('sidebar_admin_setup', 'widget_extended_categories_setup');
|
381 |
-
add_action('sidebar_admin_page', 'widget_extended_categories_page');
|
382 |
-
}
|
383 |
-
|
384 |
-
// Launch Widgets
|
385 |
-
widget_extended_categories_register();
|
386 |
-
}
|
387 |
-
add_action('plugins_loaded', 'widget_extended_categories_init');
|
388 |
-
|
389 |
-
/**
|
390 |
-
* As the original wp_category_checklist doesn't support multiple lists on the same page I needed to duplicate the functions
|
391 |
-
* use by the wp_category_checklist function
|
392 |
-
*
|
393 |
-
*/
|
394 |
-
/**
|
395 |
-
* Class that will display the categories
|
396 |
-
*
|
397 |
-
*/
|
398 |
-
class AVH_Walker_Category_Checklist extends Walker
|
399 |
-
{
|
400 |
-
var $tree_type = 'category';
|
401 |
-
var $db_fields = array('parent'=>'parent', 'id'=>'term_id'); //TODO: decouple this
|
402 |
-
var $number;
|
403 |
-
|
404 |
-
function start_lvl (&$output, $depth, $args)
|
405 |
-
{
|
406 |
-
$indent = str_repeat("\t", $depth);
|
407 |
-
$output .= "$indent<ul class='children'>\n";
|
408 |
-
}
|
409 |
-
|
410 |
-
function end_lvl (&$output, $depth, $args)
|
411 |
-
{
|
412 |
-
$indent = str_repeat("\t", $depth);
|
413 |
-
$output .= "$indent</ul>\n";
|
414 |
-
}
|
415 |
-
|
416 |
-
function start_el (&$output, $category, $depth, $args)
|
417 |
-
{
|
418 |
-
extract($args);
|
419 |
-
|
420 |
-
$class = in_array($category->term_id, $popular_cats) ? ' class="popular-category"' : '';
|
421 |
-
$output .= "\n<li id='category-$category->term_id-$this->number'$class>" . '<label for="in-category-' . $category->term_id . '-' . $this->number . '" class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category-' . $this->number . '[]" id="in-category-' . $category->term_id . '-' . $this->number . '"' . (in_array($category->term_id, $selected_cats) ? ' checked="checked"' : "") . '/> ' . wp_specialchars(apply_filters('the_category', $category->name)) . '</label>';
|
422 |
-
}
|
423 |
-
|
424 |
-
function end_el (&$output, $category, $depth, $args)
|
425 |
-
{
|
426 |
-
$output .= "</li>\n";
|
427 |
-
}
|
428 |
-
}
|
429 |
-
|
430 |
-
/**
|
431 |
-
* Creates the categories checklist
|
432 |
-
*
|
433 |
-
* @param int $post_id
|
434 |
-
* @param int $descendants_and_self
|
435 |
-
* @param array $selected_cats
|
436 |
-
* @param array $popular_cats
|
437 |
-
* @param int $number
|
438 |
-
*/
|
439 |
-
function avh_wp_category_checklist ($post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $number)
|
440 |
-
{
|
441 |
-
$walker = new AVH_Walker_Category_Checklist();
|
442 |
-
$walker->number = $number;
|
443 |
-
|
444 |
-
$descendants_and_self = (int) $descendants_and_self;
|
445 |
-
|
446 |
-
$args = array();
|
447 |
-
if (is_array($selected_cats))
|
448 |
-
$args['selected_cats'] = $selected_cats;
|
449 |
-
elseif ($post_id)
|
450 |
-
$args['selected_cats'] = wp_get_post_categories($post_id);
|
451 |
-
else
|
452 |
-
$args['selected_cats'] = array();
|
453 |
-
|
454 |
-
if (is_array($popular_cats))
|
455 |
-
$args['popular_cats'] = $popular_cats;
|
456 |
-
else
|
457 |
-
$args['popular_cats'] = get_terms('category', array('fields'=>'ids', 'orderby'=>'count', 'order'=>'DESC', 'number'=>10, 'hierarchical'=>false));
|
458 |
-
|
459 |
-
if ($descendants_and_self) {
|
460 |
-
$categories = get_categories("child_of=$descendants_and_self&hierarchical=0&hide_empty=0");
|
461 |
-
$self = get_category($descendants_and_self);
|
462 |
-
array_unshift($categories, $self);
|
463 |
-
} else {
|
464 |
-
$categories = get_categories('get=all');
|
465 |
-
}
|
466 |
-
|
467 |
-
// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
|
468 |
-
$checked_categories = array();
|
469 |
-
for ($i = 0; isset($categories[$i]); $i ++) {
|
470 |
-
if (in_array($categories[$i]->term_id, $args['selected_cats'])) {
|
471 |
-
$checked_categories[] = $categories[$i];
|
472 |
-
unset($categories[$i]);
|
473 |
-
}
|
474 |
-
}
|
475 |
-
|
476 |
-
// Put checked cats on top
|
477 |
-
echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
|
478 |
-
// Then the rest of them
|
479 |
-
echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
|
480 |
-
}
|
481 |
-
|
482 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/widget_extended_categories.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: AVH Extended Categories Widgets
|
4 |
-
Plugin URI: http://blog.avirtualhome.com/wordpress-plugins
|
5 |
-
Description: Replacement of the category widget to allow for greater customization of the category widget.
|
6 |
-
Version: 3.6.6
|
7 |
-
Author: Peter van der Does
|
8 |
-
Author URI: http://blog.avirtualhome.com/
|
9 |
-
|
10 |
-
Copyright 2012 Peter van der Does (email : peter@avirtualhome.com)
|
11 |
-
|
12 |
-
This program is free software; you can redistribute it and/or modify
|
13 |
-
it under the terms of the GNU General Public License as published by
|
14 |
-
the Free Software Foundation; either version 2 of the License, or
|
15 |
-
(at your option) any later version.
|
16 |
-
|
17 |
-
This program is distributed in the hope that it will be useful,
|
18 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
-
GNU General Public License for more details.
|
21 |
-
|
22 |
-
You should have received a copy of the GNU General Public License
|
23 |
-
along with this program; if not, write to the Free Software
|
24 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
-
*/
|
26 |
-
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 >= 2.8 && $_avhec_version < 3.3):
|
43 |
-
$_avhec_version_dir = '/2.8';
|
44 |
-
break;
|
45 |
-
case ($_avhec_version >= 3.3):
|
46 |
-
$_avhec_version_dir = '/3.3';
|
47 |
-
break;
|
48 |
-
}
|
49 |
-
|
50 |
-
$_avhec_dir = basename($_avhec_abs_dir);
|
51 |
-
$_avhec_url = plugins_url() . '/'. $_avhec_dir;
|
52 |
-
|
53 |
-
define('AVHEC_PLUGIN_DIR', $_avhec_abs_dir);
|
54 |
-
define('AVHEC_RELATIVE_PLUGIN_DIR', $_avhec_dir);
|
55 |
-
define('AVHEC_PLUGIN_URL', $_avhec_url . $_avhec_version_dir);
|
56 |
-
define('AVHEC_ABSOLUTE_WORKING_DIR', AVHEC_PLUGIN_DIR . $_avhec_version_dir);
|
57 |
-
define('AVHEC_RELATIVE_WORKING_DIR', $_avhec_dir . $_avhec_version_dir);
|
58 |
-
|
59 |
-
unset($_avhec_version);
|
60 |
-
unset($_avhec_dir);
|
61 |
-
unset($_avhec_abs_dir);
|
62 |
-
unset($_avhec_version_dir);
|
63 |
-
unset($_avhec_url);
|
64 |
-
require (AVHEC_ABSOLUTE_WORKING_DIR . '/avh-ec.client.php');
|
65 |
-
|
66 |
-
} else {
|
67 |
-
require_once 'widget-pre2.8.php';
|
68 |
-
}
|
69 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.6.
|
7 |
Author: Peter van der Does
|
8 |
Author URI: http://blog.avirtualhome.com/
|
9 |
|
3 |
Plugin Name: AVH Extended Categories Widgets
|
4 |
Plugin URI: http://blog.avirtualhome.com/wordpress-plugins
|
5 |
Description: Replacement of the category widget to allow for greater customization of the category widget.
|
6 |
+
Version: 3.6.6
|
7 |
Author: Peter van der Does
|
8 |
Author URI: http://blog.avirtualhome.com/
|
9 |
|