first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace WPML\Installer;
|
||||
|
||||
use WPML\FP\Obj;
|
||||
use WPML\LIB\WP\Hooks;
|
||||
use function WPML\FP\spreadArgs;
|
||||
|
||||
class AddSiteUrl implements \IWPML_Backend_Action {
|
||||
|
||||
public function add_hooks() {
|
||||
Hooks::onFilter( 'otgs_installer_add_site_url', 10, 2 )
|
||||
->then( spreadArgs( function ( $url, $repoID ) {
|
||||
return $repoID === 'wpml' ? ( $url . '&wpml_version=' . Obj::prop( 'Version', get_plugin_data( WPML_PLUGIN_PATH . '/' . WPML_PLUGIN_FILE ) ) ) : $url;
|
||||
} ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace WPML\Installer;
|
||||
|
||||
use WPML\LIB\WP\Hooks;
|
||||
use function WPML\FP\spreadArgs;
|
||||
|
||||
class DisableRegisterNow implements \IWPML_Backend_Action {
|
||||
|
||||
public function add_hooks() {
|
||||
Hooks::onFilter( 'otgs_installer_display_subscription_notice' )
|
||||
->then( spreadArgs( function ( $notice ) {
|
||||
return $notice['repo'] === 'wpml' ? false : $notice;
|
||||
} ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
class WPML_Installer_Domain_URL_Factory implements IWPML_Backend_Action_Loader, IWPML_AJAX_Action_Loader {
|
||||
|
||||
public function create() {
|
||||
global $sitepress;
|
||||
|
||||
if ( WPML_LANGUAGE_NEGOTIATION_TYPE_DOMAIN === (int) $sitepress->get_setting( 'language_negotiation_type' ) ) {
|
||||
/* @var WPML_URL_Converter $wpml_url_converter */
|
||||
global $wpml_url_converter;
|
||||
$site_url_default_lang = $wpml_url_converter->get_default_site_url();
|
||||
if ( $site_url_default_lang ) {
|
||||
return new WPML_Installer_Domain_URL( $site_url_default_lang );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class WPML_Installer_Domain_URL {
|
||||
|
||||
private $site_url_in_default_lang;
|
||||
|
||||
public function __construct( $site_url_in_default_lang ) {
|
||||
$this->site_url_in_default_lang = $site_url_in_default_lang;
|
||||
}
|
||||
|
||||
public function add_hooks() {
|
||||
add_filter( 'otgs_installer_site_url', array( $this, 'get_site_url_in_default_lang' ) );
|
||||
}
|
||||
|
||||
public function get_site_url_in_default_lang() {
|
||||
return $this->site_url_in_default_lang;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
class WPML_Installer_Gateway {
|
||||
|
||||
private static $the_instance;
|
||||
|
||||
private function __construct() {}
|
||||
|
||||
private function __clone() {}
|
||||
|
||||
public static function get_instance() {
|
||||
if ( ! self::$the_instance ) {
|
||||
self::$the_instance = new WPML_Installer_Gateway();
|
||||
}
|
||||
return self::$the_instance;
|
||||
}
|
||||
|
||||
public static function set_instance( $instance ) {
|
||||
self::$the_instance = $instance;
|
||||
}
|
||||
|
||||
public function class_exists() {
|
||||
return class_exists( 'WP_Installer_API' );
|
||||
}
|
||||
|
||||
public function get_site_key( $repository_id = 'wpml' ) {
|
||||
return WP_Installer_API::get_site_key( $repository_id );
|
||||
}
|
||||
|
||||
public function get_ts_client_id( $repository_id = 'wpml' ) {
|
||||
return WP_Installer_API::get_ts_client_id( $repository_id );
|
||||
}
|
||||
|
||||
public function get_registering_user_id( $repository_id = 'wpml' ) {
|
||||
return WP_Installer_API::get_registering_user_id( $repository_id );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user