first commit
This commit is contained in:
36
wp-content/plugins/brizy/compatibilities/wp-ultimo.php
Normal file
36
wp-content/plugins/brizy/compatibilities/wp-ultimo.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_WpUltimo {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'init', [ $this, 'init' ] );
|
||||
}
|
||||
|
||||
public function init() {
|
||||
if ( isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) || isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
add_filter( 'brizy_editor_config', [ $this, 'remappingAssetsUrl' ] );
|
||||
}
|
||||
}
|
||||
|
||||
public function remappingAssetsUrl( $config ) {
|
||||
|
||||
if ( ! class_exists( 'Mercator\Mapping' ) ) {
|
||||
return $config;
|
||||
}
|
||||
|
||||
$mapping = Mercator\Mapping::get_by_domain( $_SERVER['HTTP_HOST'] );
|
||||
|
||||
if ( empty( $mapping ) || ! $mapping->is_active() ) {
|
||||
return $config;
|
||||
}
|
||||
|
||||
$url_mapped = $mapping->get_domain();
|
||||
|
||||
$original_url = get_blog_option( $mapping->get_site_id(), 'siteurl' );
|
||||
$original_url = trim( preg_replace( '#^https?://#', '', $original_url ), '/' );
|
||||
|
||||
$config['urls']['assets'] = str_replace( $original_url, $url_mapped, $config['urls']['assets'] );
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user