Created
October 6, 2011 17:23
-
-
Save thomasgriffin/1268010 to your computer and use it in GitHub Desktop.
This file contains 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
/** Set type, based on whether the source starts with http:// or https:// */ | |
$type = preg_match('|^http(s)?://|', $plugin['source'] ) ? 'web' : 'upload'; | |
/** Prefix a default path to pre-packaged plugins */ | |
$source = ( 'upload' == $type ) ? $this->default_path . $plugin['source'] : $plugin['source']; | |
$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact( 'title', 'url', 'nonce', 'plugin', 'api' ) ) ); // Create a new instance of Plugin_Upgrader | |
$upgrader->install( $source ); // Perform the action and install the plugin from the $source URL | |
activate_plugin( $plugin['file_path'] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment