var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); /* * js included via the aov-rel-api plugin */ /* * you might be wondering why a js file has a php extension? * that's 'cause the javascript needs to know where to post its requests without having * any knowledge of where this plugin is installed. viz... */ var relApiPostUrl = "/wp_content/plugins/aov_rel_api/aov_rel_api_ajax.html"; /* * plus knowing the user id is also pretty helpful... */ var userID = 0; /** * removes or creates a relationship between the current user and the cited post * @param int postID id of associated post * @param string relationship name of relationship to be referenced e.g. "LIKES", "INTERESTED IN", "WORKING ON" * @param string action either 'create' or 'remove' * @param string callback name of callback function to be executed on ajax return. The callback is passed two * parameters, the second of which is the postID. The first is set to 1 if a relationship * has been set successfully, 0 if it has been removed successfully. * @param int userid (optonal) id of user; defaults to logged in user. */ function aovChangeRelationship(postID, relationship, action, callback, userid) { uid = (userid) ? userid : userID; jQuery.ajax({ url: relApiPostUrl, data: {action: action, userID: uid, postID: postID, relationship: relationship}, dataType: 'text', success: function(data, textStatus, XMLHttpRequest) { callback(data, postID); } }); } /** * checks a relationship between the current user and the cited post * @param int postID id of associated post * @param string relationship name of relationship to be referenced e.g. "LIKES", "INTERESTED IN", "WORKING ON" * @param string callback name of callback function to be executed on ajax return. The callback is passed two * parameters, the second of which is the postID. The first is set to 1 if a relationship * exists, 0 if does not. * @param int userid (optonal) id of user; defaults to logged in user. */ function aovIsRelated(postID, relationship, callback, userid) { uid = (userid) ? userid : userID; jQuery.ajax({ url: relApiPostUrl, data: {action: 'exists', userID: uid, postID: postID, relationship: relationship}, dataType: 'text', success: function(data, textStatus, XMLHttpRequest) { callback(data, postID); } }); } /** * returns an array of users with stated relationship to the cited post * @param int postID id of associated post * @param string relationship name of relationship to be referenced e.g. "LIKES", "INTERESTED IN", "WORKING ON" * @param string callback name of callback function to be executed on ajax return The callback is passed two * parameters, the second of which is the postID. The first is a JSON array of wordpress * users maintaining the specified relationship with the post. */ function aovGetRelated(postID, relationship, callback) { jQuery.ajax({ url: relApiPostUrl, data: {action: 'select', postID: postID, relationship: relationship}, dataType: 'json', success: function(data, textStatus, XMLHttpRequest) { callback(data, postID); } }); } /** * returns a count of the number of users that created a relationship to a post (optionally) between two dates (inclusive) * @param int $postID WP post id * @param string $relationship name of relationship to be referenced e.g. "LIKES","INTERESTED IN","WORKING ON" * @param string $startDate a start date in 'YYYY-MM-DD' format; set '' to default to '2005-01-01' * @param string $endDate an end date in 'YYYY-MM-DD' format e.g. '2010-01-30'; set '' to default to today * @param string callback name of callback function to be executed on ajax return. The callback is passed two * parameters, the second of which is the postID. The first is set to the count. * @return int */ function aovCountRelated(postID, relationship, startDate, endDate, callback) { jQuery.ajax({ url: relApiPostUrl, data: {action: 'count', postID: postID, relationship: relationship, startDate: startDate, endDate: endDate}, dataType: 'json', success: function(data, textStatus, XMLHttpRequest) { callback(data, postID); } }); } /** * returns an array of posts with stated relationship to the cited user * @param int userID id of associated user * @param string relationship name of relationship to be referenced e.g. "LIKES", "INTERESTED IN", "WORKING ON" * @param string callback name of callback function to be executed on ajax return The callback is passed two * parameters, the second of which is the userID. The first is a JSON array of wordpress * posts maintaining the specified relationship with the user. */ function aovGetRelatedPosts(userID, relationship, callback) { jQuery.ajax({ url: relApiPostUrl, data: {action: 'selectPosts', userID: userID, relationship: relationship}, dataType: 'json', success: function(data, textStatus, XMLHttpRequest) { callback(data, userID); } }); } } /*