| @@ -60,26 +60,23 @@ | ||
| 60 | 60 | $bulk_checks = array(); |
| 61 | 61 | |
| 62 | 62 | foreach ( $check_exts as $ext_name => $ext ) { |
| 63 | 63 | $bulk_checks[ $ext_name ] = $ext; |
| 64 | - ++$i; | |
| 65 | - ++$count; | |
| 66 | - if ( $count === $max_check || $i === $total_check ) { | |
| 67 | - $results = MainWP_Api_Manager_Plugin_Update::instance()->bulk_update_check( $bulk_checks ); // bulk check response array of info. | |
| 64 | + $i++; | |
| 65 | + $count++; | |
| 66 | + if ( $count == $max_check || $i == $total_check ) { | |
| 67 | + $results = MainWP_Api_Manager_Plugin_Update::instance()->bulk_update_check( $bulk_checks ); | |
| 68 | 68 | if ( is_array( $results ) && 0 < count( $results ) ) { |
| 69 | 69 | foreach ( $results as $slug => $response ) { |
| 70 | - if ( ! is_array( $response ) || ! isset( $response['new_version'] ) ) { | |
| 71 | - continue; | |
| 72 | - } | |
| 73 | - $rslt = new \stdClass(); | |
| 74 | - $rslt->slug = $slug; | |
| 75 | - $rslt->new_version = $response['new_version']; | |
| 76 | - $rslt->package = $response['package']; | |
| 77 | - $rslt->key_status = ''; | |
| 78 | - $rslt->apiManager = 1; | |
| 70 | + $rslt = new \stdClass(); | |
| 71 | + $rslt->slug = $slug; | |
| 72 | + $rslt->latest_version = $response->new_version; | |
| 73 | + $rslt->download_url = $response->package; | |
| 74 | + $rslt->key_status = ''; | |
| 75 | + $rslt->apiManager = 1; | |
| 79 | 76 | |
| 80 | - if ( isset( $response['errors'] ) ) { | |
| 81 | - $rslt->error = $response['errors']; | |
| 77 | + if ( isset( $response->errors ) ) { | |
| 78 | + $rslt->error = $response->errors; | |
| 82 | 79 | } |
| 83 | 80 | $output[ $slug ] = $rslt; |
| 84 | 81 | } |
| 85 | 82 | } |
| @@ -105,9 +102,9 @@ | ||
| 105 | 102 | |
| 106 | 103 | $extensions = MainWP_Extensions_Handler::get_extensions(); |
| 107 | 104 | $rslt = null; |
| 108 | 105 | foreach ( $extensions as $ext ) { |
| 109 | - if ( isset( $ext['api'] ) && ( $pSlug === $ext['api'] ) && isset( $ext['apiManager'] ) && ! empty( $ext['apiManager'] ) ) { | |
| 106 | + if ( isset( $ext['api'] ) && ( $pSlug == $ext['api'] ) && isset( $ext['apiManager'] ) && ! empty( $ext['apiManager'] ) ) { | |
| 110 | 107 | $args = array(); |
| 111 | 108 | $args['plugin_name'] = $ext['api']; |
| 112 | 109 | $args['version'] = $ext['version']; |
| 113 | 110 | $args['product_id'] = $ext['product_id']; |
| @@ -113,17 +110,16 @@ | ||
| 113 | 110 | $args['product_id'] = $ext['product_id']; |
| 114 | 111 | $args['api_key'] = $ext['api_key']; |
| 115 | 112 | $args['instance'] = $ext['instance_id']; |
| 116 | 113 | $args['software_version'] = $ext['software_version']; |
| 117 | - $response = MainWP_Api_Manager_Plugin_Update::instance()->update_check( $args ); | |
| 118 | - | |
| 114 | + $response = MainWP_Api_Manager::instance()->update_check( $args ); | |
| 119 | 115 | if ( ! empty( $response ) ) { |
| 120 | - $rslt = new \stdClass(); | |
| 121 | - $rslt->slug = $ext['api']; | |
| 122 | - $rslt->new_version = $response->new_version; | |
| 123 | - $rslt->package = $response->package; | |
| 124 | - $rslt->key_status = ''; | |
| 125 | - $rslt->apiManager = 1; | |
| 116 | + $rslt = new \stdClass(); | |
| 117 | + $rslt->slug = $ext['api']; | |
| 118 | + $rslt->latest_version = $response->new_version; | |
| 119 | + $rslt->download_url = $response->package; | |
| 120 | + $rslt->key_status = ''; | |
| 121 | + $rslt->apiManager = 1; | |
| 126 | 122 | if ( isset( $response->errors ) ) { |
| 127 | 123 | $rslt->error = $response->errors; |
| 128 | 124 | } |
| 129 | 125 | } |
| @@ -146,9 +142,9 @@ | ||
| 146 | 142 | public static function get_update_information( $pSlug ) { |
| 147 | 143 | $extensions = MainWP_Extensions_Handler::get_extensions(); |
| 148 | 144 | $rslt = null; |
| 149 | 145 | foreach ( $extensions as $ext ) { |
| 150 | - if ( isset( $ext['api'] ) && $pSlug === $ext['api'] && isset( $ext['apiManager'] ) && ! empty( $ext['apiManager'] ) ) { | |
| 146 | + if ( isset( $ext['api'] ) && $pSlug == $ext['api'] && isset( $ext['apiManager'] ) && ! empty( $ext['apiManager'] ) ) { | |
| 151 | 147 | $args = array(); |
| 152 | 148 | $args['plugin_name'] = $ext['api']; |
| 153 | 149 | $args['version'] = $ext['version']; |
| 154 | 150 | $args['product_id'] = $ext['product_id']; |
| @@ -160,5 +156,6 @@ | ||
| 160 | 156 | } |
| 161 | 157 | } |
| 162 | 158 | return $rslt; |
| 163 | 159 | } |
| 160 | + | |
| 164 | 161 | } |