Created
December 22, 2016 23:42
-
-
Save scofennell/65030712b59fa38591c0db87c8206783 to your computer and use it in GitHub Desktop.
Inject a Bitbucket repo into the WordPress updates UI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'set_plugin_transient' ) ); | |
/** | |
* Inject our updates into core's list of updates. | |
* | |
* @param array $transient The existing list of assets that need an update. | |
* @return The list of assets that need an update, filtered. | |
*/ | |
public function set_plugin_transient( $transient ) { | |
if( ! is_array( $this -> assets_to_update ) ) { return $transient; } | |
foreach( $this -> assets_to_update as $asset ) { | |
if( empty( $asset -> transient_key ) ) { continue; } | |
if( ! $asset -> transient_content ) { continue; } | |
$transient -> response[ $asset -> transient_key ] = $asset -> transient_content; | |
} | |
return $transient; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment