BP_BuddyBoss_Platform_Updater::plugins_api( $def, $action, $args )
Description
Source
File: bp-core/classes/class-bp-buddyboss-platform-updater.php
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | function plugins_api( $def , $action , $args ) { if ( ! isset( $args ->slug ) || $args ->slug != $this ->plugin_slug ) { return $def ; } $plugin_info = get_site_transient( 'update_plugins' ); $request_data = array ( 'id' => $this ->plugin_id, 'slug' => $this ->plugin_slug, 'version' => ( isset( $plugin_info ->checked ) ) ? $plugin_info ->checked[ $this ->plugin_path ] : 0 // Current version ); if ( ! empty ( $this ->license ) ) { $request_data [ 'license' ] = $this ->license; } $request_string = $this ->request_call( $action , $request_data ); $raw_response = wp_remote_post( $this ->api_url, $request_string ); if ( is_wp_error( $raw_response ) ) { $res = new WP_Error( 'plugins_api_failed' , __( 'An Unexpected HTTP Error occurred during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>' , 'buddyboss' ), $raw_response ->get_error_message() ); } else { $res = unserialize( $raw_response [ 'body' ] ); if ( $res === false ) { $res = new WP_Error( 'plugins_api_failed' , __( 'An unknown error occurred' , 'buddyboss' ), $raw_response [ 'body' ] ); } } return $res ; } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.