Skip to content

Instantly share code, notes, and snippets.

@thomasgriffin
Created October 6, 2011 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasgriffin/1268010 to your computer and use it in GitHub Desktop.
Save thomasgriffin/1268010 to your computer and use it in GitHub Desktop.
/** 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