function get_image_id($args)
{
    global $wpdb;
    $wpdb->escape($args);
    $guid = $args[0];
    $username = $args[1];
    $password = $args[2];
    $error = check_xmlrpc($username, $password);
    if (is_a($error, 'IXR_Error')) {
        return $error;
    }
    $query = "SELECT id FROM " . $wpdb->posts . " WHERE guid='" . $guid . "'";
    $image = $wpdb->get_row($query);
    return $image->id;
}
Пример #2
0
function set_coords($args)
{
    global $wpdb;
    $wpdb->escape($args);
    $post_ID = (int) $args[0];
    $username = $args[1];
    $password = $args[2];
    $coords = $args[3];
    $error = check_xmlrpc($username, $password);
    if (is_a($error, 'IXR_Error')) {
        return $error;
    }
    if (!($post = get_post($post_ID))) {
        return new IXR_Error(404, 'Post does not exist');
    }
    $_wp_geo_latitude = $coords['_wp_geo_latitude'];
    $_wp_geo_longitude = $coords['_wp_geo_longitude'];
    update_post_meta($post_ID, '_wp_geo_latitude', $_wp_geo_latitude);
    update_post_meta($post_ID, '_wp_geo_longitude', $_wp_geo_longitude);
    return array($_wp_geo_latitude, $_wp_geo_longitude);
}