Skip to content

Commit dd56f0f

Browse files
author
Md. Alimuzzaman Alim
committed
Elementor sync css file #235
Sync Elementor css file to GCS. No way to upadate the files yes.
1 parent 62d5944 commit dd56f0f

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

lib/classes/class-compatibility.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ public function __construct(){
8181
* Support for WPForms
8282
*/
8383
new CompatibilityWooExtraPorductOptions();
84+
85+
/**
86+
* Support for Elementor
87+
*/
88+
new Elementor();
8489
}
8590

8691
/**
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Plugin Name: Elementor Page Builder
4+
* Plugin URI: https://wordpress.org/plugins/elementor/
5+
*
6+
* Compatibility Description: Ensures compatibility with Elementor.
7+
*
8+
*/
9+
10+
namespace wpCloud\StatelessMedia {
11+
12+
if(!class_exists('wpCloud\StatelessMedia\Elementor')) {
13+
14+
class Elementor extends ICompatibility {
15+
protected $id = 'elementor';
16+
protected $title = 'Elementor Page Builder';
17+
protected $constant = 'WP_STATELESS_COMPATIBILITY_ELEMENTOR';
18+
protected $description = 'Ensures compatibility with Elementor Page Builder. Sync css files generated by Elementor.';
19+
protected $plugin_file = 'elementor/elementor.php';
20+
21+
public function module_init($sm){
22+
add_filter('set_url_scheme', array($this, 'sync_rewrite_url'), 10, 3);
23+
}
24+
25+
public function sync_rewrite_url($url, $scheme, $orig_scheme){
26+
try{
27+
if(strpos($url, 'elementor/') !== false){
28+
$wp_uploads_dir = wp_get_upload_dir();
29+
$name = str_replace($wp_uploads_dir['baseurl'] . '/', '', $url);
30+
31+
if($name != $url){
32+
$name = apply_filters( 'wp_stateless_file_name', $name);
33+
do_action('sm:sync::syncFile', $name, $wp_uploads_dir['basedir'] . '/' . $name);
34+
$url = ud_get_stateless_media()->get_gs_host() . '/' . $name;
35+
}
36+
}
37+
38+
}
39+
catch(Exception $e){
40+
41+
}
42+
return $url;
43+
}
44+
45+
}
46+
47+
}
48+
49+
}

vendor/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'wpCloud\\StatelessMedia\\CompatibilityWooExtraPorductOptions' => $baseDir . '/lib/classes/compatibility/woo-extra-product-options.php',
3232
'wpCloud\\StatelessMedia\\DynamicImageSupport' => $baseDir . '/lib/classes/compatibility/dynamic-image-support.php',
3333
'wpCloud\\StatelessMedia\\EDDDownloadMethod' => $baseDir . '/lib/classes/compatibility/easy-digital-downloads.php',
34+
'wpCloud\\StatelessMedia\\Elementor' => $baseDir . '/lib/classes/compatibility/elementor.php',
3435
'wpCloud\\StatelessMedia\\Errors' => $baseDir . '/lib/classes/class-errors.php',
3536
'wpCloud\\StatelessMedia\\GS_Client' => $baseDir . '/lib/classes/class-gs-client.php',
3637
'wpCloud\\StatelessMedia\\GravityForm' => $baseDir . '/lib/classes/compatibility/gravity-forms.php',

vendor/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class ComposerStaticInitc00cd3c666f8dfa818cb7edfd488ed20
5656
'wpCloud\\StatelessMedia\\CompatibilityWooExtraPorductOptions' => __DIR__ . '/../..' . '/lib/classes/compatibility/woo-extra-product-options.php',
5757
'wpCloud\\StatelessMedia\\DynamicImageSupport' => __DIR__ . '/../..' . '/lib/classes/compatibility/dynamic-image-support.php',
5858
'wpCloud\\StatelessMedia\\EDDDownloadMethod' => __DIR__ . '/../..' . '/lib/classes/compatibility/easy-digital-downloads.php',
59+
'wpCloud\\StatelessMedia\\Elementor' => __DIR__ . '/../..' . '/lib/classes/compatibility/elementor.php',
5960
'wpCloud\\StatelessMedia\\Errors' => __DIR__ . '/../..' . '/lib/classes/class-errors.php',
6061
'wpCloud\\StatelessMedia\\GS_Client' => __DIR__ . '/../..' . '/lib/classes/class-gs-client.php',
6162
'wpCloud\\StatelessMedia\\GravityForm' => __DIR__ . '/../..' . '/lib/classes/compatibility/gravity-forms.php',

0 commit comments

Comments
 (0)