PluginProbe
ManageWP Worker / 3.9.17
ManageWP Worker v3.9.17
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / link.class.php

link.class.php in ManageWP Worker 3.9.17, at link.class.php

61 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*************************************************************
3 *
4 * user.class.php
5 *
6 * Add Users
7 *
8 *
9 * Copyright (c) 2011 Prelovac Media
10 * www.prelovac.com
11 **************************************************************/
12
13 class MMB_Link extends MMB_Core
14 {
15 function __construct()
16 {
17 parent::__construct();
18 }
19
20 function add_link($args)
21 {
22 extract($args);
23
24 $params['link_url'] = esc_html($url);
25 $params['link_url'] = esc_url($params['link_url']);
26 $params['link_name'] = esc_html($name);
27 $params['link_id'] = '';
28 $params['link_description'] = $description;
29 $params['link_target'] = $link_target;
30 $params['link_category'] = array();
31
32 //Add Link category
33 if(is_array($link_category) && !empty($link_category)){
34 $terms = get_terms('link_category',array('hide_empty' => 0));
35
36 if($terms){
37 foreach($terms as $term){
38 if(in_array($term->name,$link_category)){
39 $params['link_category'][] = $term->term_id;
40 }
41 }
42 }
43 }
44
45 //Add Link Owner
46 $user_obj = get_userdatabylogin($user);
47 if($user_obj && $user_obj->ID){
48 $params['link_owner'] = $user_obj->ID;
49 }
50
51
52 if(!function_exists('wp_insert_link'))
53 include_once (ABSPATH . 'wp-admin/includes/bookmark.php');
54
55 $is_success = wp_insert_link($params);
56
57 return $is_success ? true : array('error' => 'Failed to add link.');
58 }
59
60 }
61 ?>