-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwp-dtree-lnk.php
More file actions
55 lines (55 loc) · 1.76 KB
/
wp-dtree-lnk.php
File metadata and controls
55 lines (55 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
function wpdt_get_links_nodelist($args){
extract( $args, EXTR_SKIP );
$idcount = 1;
$cats = get_terms('link_category', array(
'name__like' => $category_name,
'include' => $category,
'exclude' => $exclude,
'orderby' => $catsorderby,
'order' => $order,
'hierarchical' => 0
));
$nodelist = array();
foreach($cats as $cat){
$nodelist[$idcount] = array(
'id' => -$cat->term_id,
'pid' => $cat->parent,
'url' => '',
'name' => ($showcount) ? strip_tags($cat->name ." ({$cat->count})") : strip_tags($cat->name),
'title' => $cat->description
);
$idcount++;
$bookmarks = get_bookmarks(array(
'orderby' => $orderby,
'order' => $order,
'category' => $cat->term_id,
'hide_invisible' => $hide_invisible,
'show_updated' => $show_updated,
//'search'
//'include' => $include,
'exclude' => $exclude
));
foreach( $bookmarks as $bookmark ){
$the_link = '#';
if(!empty($bookmark->link_url)){
$the_link = esc_url($bookmark->link_url);
}
$name = esc_attr(sanitize_bookmark_field('link_name', $bookmark->link_name, $bookmark->link_id, 'display'));
if($show_updated && '00' != substr($bookmark->link_updated_f, 0, 2)){
$name .= ' ('.sprintf(__('Last updated: %s'), date(get_option('links_updated_date_format'), $bookmark->link_updated_f + (get_option('gmt_offset') * 3600))).')';
}
$nodelist[$idcount] = array(
'id' => $bookmark->link_id,
'pid' => -$cat->term_id,
'url' => $the_link,
'name' => $name,
'title' => esc_attr(sanitize_bookmark_field('link_description', $bookmark->link_description, $bookmark->link_id, 'display')),
'target' => $bookmark->link_target
);
$idcount++;
}
}
return $nodelist;
}
?>