Пример #1
0
 /**
  * Set plugin info and add essential hooks
  * 
  * @param string $plugin_slug                 The name of directory and main file name of plugin
  * @param string $slug                        Then slug name of plugin (optional)
  * @param string $installable_plugin_zip_file Installable update file name. Default is {plugin_slug}-installable.zip
  */
 public function __construct($plugin_slug, $slug = '', $installable_plugin_zip_file = '')
 {
     parent::__construct();
     $this->plugin_slug = $plugin_slug;
     $parts = explode('/', $plugin_slug);
     $this->slug = empty($slug) ? str_replace('.php', '', $parts[1]) : $slug;
     $this->installable_plugin_zip_file = empty($installable_plugin_zip_file) ? $this->slug . '-installable.zip' : $installable_plugin_zip_file;
     add_action('admin_init', array($this, 'plugin_update_rows'), 12);
     // a custom hook that fires on update.php page while upgrading package
     add_action("update-custom_{$this->slug}-upgrade", array($this, 'on_update_plugin'));
 }
 /**
  * Set plugin info and add essential hooks
  *
  * @param string $plugin_slug                 The name of directory and main file name of plugin
  * @param string $slug                        Then slug name of plugin (optional)
  * @param string $installable_plugin_zip_file Installable update file name. Default is {plugin_slug}-installable.zip
  */
 public function __construct($plugin_slug, $slug = '', $installable_plugin_zip_file = '')
 {
     parent::__construct();
     $this->plugin_slug = $plugin_slug;
     $parts = explode('/', $plugin_slug);
     $this->slug = empty($slug) ? str_replace('.php', '', $parts[1]) : $slug;
     $this->installable_plugin_zip_file = empty($installable_plugin_zip_file) ? $this->slug . '-installable.zip' : $installable_plugin_zip_file;
     add_action('admin_init', array($this, 'plugin_update_rows'), 12);
     // a custom hook that fires on update.php page while upgrading the packages
     add_action("update-custom_{$this->slug}-upgrade", array($this, 'custom_upgrade_plugin'));
     // add_action( "upgrader_process_complete", array( $this, "on_bulk_upgrader_process_complete" ), 10, 2 );
     add_filter('site_transient_update_plugins', array($this, 'define_package_for_plugin_update_transient'));
 }
 /**
  * References parent constructor and sets defaults for class.
  *
  * @since 2.2.0
  *
  * @param \Bulk_Upgrader_Skin|null $skin Installer skin.
  */
 public function __construct($skin = null)
 {
     // Get TGMPA class instance.
     $this->tgmpa = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance'));
     parent::__construct($skin);
     if (isset($this->skin->options['install_type']) && 'update' === $this->skin->options['install_type']) {
         $this->clear_destination = true;
     }
     if ($this->tgmpa->is_automatic) {
         $this->activate_strings();
     }
     add_action('upgrader_process_complete', array($this->tgmpa, 'populate_file_path'));
 }
 /**
  *
  * @TODO document
  *
  */
 function __construct($args = array())
 {
     parent::__construct($args);
 }