107 | | echo '<script type="text/javascript"> |
108 | | (function( wp ) { |
109 | | if ( wp && wp.updates.decrementCount ) { |
110 | | wp.updates.decrementCount( "' . $type . '" ); |
| 107 | |
| 108 | if ( defined( 'IFRAME_REQUEST' ) && IFRAME_REQUEST ) { |
| 109 | echo '<script type="text/javascript"> |
| 110 | if ( window.postMessage && JSON ) { |
| 111 | window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname ); |
287 | | |
288 | | /** |
289 | | * Output JavaScript that sends message to parent window to decrement the update counts. |
290 | | * |
291 | | * @since 3.9.0 |
292 | | * |
293 | | * @param string $type Type of update count to decrement. Likely values include 'plugin', |
294 | | * 'theme', 'translation', etc. |
295 | | */ |
296 | | protected function decrement_update_count( $type ) { |
297 | | if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) { |
298 | | return; |
299 | | } |
300 | | echo '<script type="text/javascript"> |
301 | | if ( window.postMessage && JSON ) { |
302 | | window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname ); |
303 | | } |
304 | | </script>'; |
305 | | } |