Skip to content

Commit

Permalink
WIP fix frontend for elementor
Browse files Browse the repository at this point in the history
  • Loading branch information
reatlat committed Apr 23, 2019
1 parent 8889216 commit 9c91bfc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
4 changes: 4 additions & 0 deletions prepros-6.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
{
"path": "source/admin/css/_mixinx.scss",
"configJson": "{\"forceCompile\":false,\"customOutput\":\"\",\"autoCompile\":false,\"sourceMap\":false,\"compiler-node-sass\":{\"enabled\":true,\"outputStyle\":\"nested\"},\"compiler-autoprefixer\":{\"enabled\":false},\"compiler-minify-css\":{\"enabled\":false},\"outputSuffix\":null}"
},
{
"path": "source/admin/js/multidomain-support-for-elementor-admin.js",
"configJson": "{\"autoCompile\":true,\"forceCompile\":false,\"customOutput\":\"\",\"sourceMap\":true,\"compiler-concat-js\":{\"enabled\":true},\"compiler-babel\":{\"enabled\":true},\"compiler-uglify-js\":{\"enabled\":true,\"mangle\":true},\"outputSuffix\":\".min\"}"
}
],
"fileTree": {
Expand Down
19 changes: 14 additions & 5 deletions source/admin/class-multidomain-support-for-elementor-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private function get_current_language()
break;

case 'wpml':
return apply_filters( 'wpml_current_language', null );
return apply_filters('wpml_current_language', null);
break;

default:
Expand Down Expand Up @@ -244,13 +244,16 @@ public function get_domains($attr = 'all')
*/
private function get_content_lang()
{
//TODO: improve this part
$postID = get_the_ID() ? get_the_ID() : $_GET['post'];

switch ($this->get_wpml_plugin_name()) {
case 'polylang':
$lang_key = pll_get_post_language(get_the_ID());
$lang_key = pll_get_post_language($postID);
break;

case 'wpml':
$lang_key = wpml_get_language_information(get_the_ID())['language_code'];
$lang_key = wpml_get_language_information($postID)['language_code'];
break;

default:
Expand Down Expand Up @@ -287,6 +290,14 @@ private function get_default_lang()
}


public function override_elementor_config($settings)
{
$settings['home_url'] = $this->get_domains('url')[$this->get_current_language()];

return $settings;
}


/**
* Add danoate and rateit links to plugin meta
* @param $actions
Expand Down Expand Up @@ -328,8 +339,6 @@ public function get_server_origin()
{
if (array_key_exists('HTTP_ORIGIN', $_SERVER)) {
$origin = $_SERVER['HTTP_ORIGIN'];
} else if (array_key_exists('HTTP_REFERER', $_SERVER)) {
$origin = $_SERVER['HTTP_REFERER'];
} else {
$origin = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST']; // in theory should be IP $_SERVER['REMOTE_ADDR'];
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions source/includes/class-multidomain-support-for-elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class Multidomain_Support_For_Elementor
*/
public function __construct()
{
if (defined('Multidomain_Support_For_Elementor_VERSION')) {
$this->version = Multidomain_Support_For_Elementor_VERSION;
if (defined('MULTIDOMAIN_SUPPORT_FOR_ELEMENTOR_VERSION')) {
$this->version = MULTIDOMAIN_SUPPORT_FOR_ELEMENTOR_VERSION;
} else {
$this->version = '1.0.0';
}
Expand Down Expand Up @@ -165,6 +165,7 @@ private function define_admin_hooks()
$this->loader->add_action('page_row_actions', $plugin_admin, 'update_row_actions_link', 12, 2);
$this->loader->add_filter('plugin_action_links', $plugin_admin,'plugin_action_links', 10, 5);
$this->loader->add_filter('plugin_row_meta', $plugin_admin, 'plugin_row_meta', 10, 3);
$this->loader->add_filter('elementor/admin/localize_settings', $plugin_admin, 'override_elementor_config', 10, 1);
$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );

Expand Down

0 comments on commit 9c91bfc

Please sign in to comment.