public function register(Pusher $pusher)
 {
     // Bind the Pusher instance itself to the container
     $pusher->bind('Pusher\\Pusher', $pusher);
     // Initialise logger from log file
     $pusher->bind('Pusher\\Log\\Logger', function (Pusher $pusher) {
         $log = Logger::file(trailingslashit($pusher->pusherPath) . 'pusherlog');
         return $log;
     });
     // Use EDD for licensing
     $pusher->bind('Pusher\\License\\LicenseApi', 'Pusher\\License\\EddLicenseApi');
     // Singletons must be last for now, since they call "make()"
     $pusher->singleton('Pusher\\Dashboard', 'Pusher\\Dashboard');
 }
 public function handle(InstallThemeCommand $command)
 {
     $theme = new Theme();
     $repository = $this->repositoryFactory->build($command->type, $command->repository);
     if ($command->private and $this->pusher->hasValidLicenseKey()) {
         $repository->makePrivate();
     }
     $repository->setBranch($command->branch);
     $theme->setRepository($repository);
     $theme->setSubdirectory($command->subdirectory);
     $command->dryRun ?: $this->upgrader->installTheme($theme);
     if ($command->subdirectory) {
         $slug = end(explode('/', $command->subdirectory));
     } else {
         $slug = $repository->getSlug();
     }
     $theme = $this->themes->fromSlug($slug);
     $theme->setRepository($repository);
     $theme->setPushToDeploy($command->ptd);
     $theme->setSubdirectory($command->subdirectory);
     $this->themes->store($theme);
     do_action('wppusher_theme_was_installed', new ThemeWasInstalled($theme));
 }
Example #3
0
 /**
  * Utility function used to create the curl object with common settings
  */
 private function create_curl($s_url, $request_method = 'GET', $query_params = array())
 {
     # Create the signed signature...
     $signed_query = \Pusher\Pusher::build_auth_query_string($this->settings['auth_key'], $this->settings['secret'], $request_method, $s_url, $query_params);
     $full_url = $this->settings['server'] . ':' . $this->settings['port'] . $s_url . '?' . $signed_query;
     $this->log('curl_init( ' . $full_url . ' )');
     # Set cURL opts and execute request
     $ch = curl_init();
     if ($ch === false) {
         throw new PusherException('Could not initialise cURL!');
     }
     curl_setopt($ch, CURLOPT_URL, $full_url);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, $this->settings['timeout']);
     return $ch;
 }
 public function register(Pusher $pusher)
 {
     // Plugin was installed
     $pusher->addAction('wppusher_plugin_was_installed', 'Pusher\\ActionHandlers\\LogWhenPluginWasInstalled');
     $pusher->addAction('wppusher_plugin_was_installed', 'Pusher\\ActionHandlers\\ShowMessageWhenPluginWasInstalled');
     // Plugin was edited
     $pusher->addAction('wppusher_plugin_was_edited', 'Pusher\\ActionHandlers\\ShowMessageWhenPluginWasEdited');
     // Plugin was updated
     $pusher->addAction('wppusher_plugin_was_updated', 'Pusher\\ActionHandlers\\LogWhenPluginWasUpdated');
     $pusher->addAction('wppusher_plugin_was_updated', 'Pusher\\ActionHandlers\\ShowMessageWhenPluginWasUpdated');
     // Plugin was unlinked
     $pusher->addAction('wppusher_plugin_was_unlinked', 'Pusher\\ActionHandlers\\ShowMessageWhenPluginWasUnlinked');
     // Theme was installed
     $pusher->addAction('wppusher_theme_was_installed', 'Pusher\\ActionHandlers\\LogWhenThemeWasInstalled');
     $pusher->addAction('wppusher_theme_was_installed', 'Pusher\\ActionHandlers\\ShowMessageWhenThemeWasInstalled');
     // Theme was edited
     $pusher->addAction('wppusher_theme_was_edited', 'Pusher\\ActionHandlers\\ShowMessageWhenThemeWasEdited');
     // Theme was update
     $pusher->addAction('wppusher_theme_was_updated', 'Pusher\\ActionHandlers\\LogWhenThemeWasUpdated');
     $pusher->addAction('wppusher_theme_was_updated', 'Pusher\\ActionHandlers\\ShowMessageWhenThemeWasUpdated');
     // Theme was unlinked
     $pusher->addAction('wppusher_theme_was_unlinked', 'Pusher\\ActionHandlers\\ShowMessageWhenThemeWasUnlinked');
 }
Example #5
0
 * Plugin URI: http://wppusher.com
 * Description: Pain-free deployment of WordPress themes and plugins directly from GitHub.
 * Version: 2.0.0
 * Author: WP Pusher
 * Author URI: http://wppusher.com
 * License: GNU GENERAL PUBLIC LICENSE
 */
// If this file is called directly, abort.
if (!defined('WPINC')) {
    die;
}
require __DIR__ . '/autoload.php';
use Pusher\ActionHandlers\ActionHandlerProvider;
use Pusher\Pusher;
use Pusher\PusherServiceProvider;
$pusher = new Pusher();
$pusher->pusherPath = plugin_dir_path(__FILE__);
$pusher->pusherUrl = plugin_dir_url(__FILE__);
$pusher->register(new PusherServiceProvider());
$pusher->register(new ActionHandlerProvider());
register_activation_hook(__FILE__, array($pusher, 'activate'));
require_once 'wp-updates-plugin.php';
new WPUpdatesPluginUpdater_957('http://wp-updates.com/api/2/plugin', plugin_basename(__FILE__));
$pusher->init();
if (!function_exists('getHostIcon')) {
    function getHostIcon($host)
    {
        if ($host === 'gh') {
            return 'fa-github';
        } elseif ($host === 'bb') {
            return 'fa-bitbucket';