Hi!
In the file includes/Services/Tools/LocaleMapper.php on line 39 you have this piece of code:
$languages = json_decode(file_get_contents(plugins_url('smartcat-wpml/languages/smartcat-languages.json')));
What this does is basically makes a remote request towards the file on the server.
file_get_contents(https://example.com/wp-content/plugins/smartcat-wpml/languages/smartcat-languages.json)
Which, in case you’ve blocked access for certain allowed IP addresses, or if you’ve blocked direct access to json files on your server (security), would fail.
The solution is kinda simple. Just use
$languages = json_decode(file_get_contents( dirname(__DIR__, 4) . '/smartcat-wpml/languages/smartcat-languages.json'));
And that should work like a charm.
You’re welcome.
]]>Yesterday I was trying to translate content automatically with smartcat through my WordPress but every time I was performing the get from smartcat action the translated pages were not pushed to my wordpress.
I received an email from WordPress:
Howdy!
WordPress has a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.
In this case, WordPress caught an error with one of your plugins, Smartcat Integration for WPML.
First, visit your website (https://www.support-strong-eu.com/) and check for any visible issues. Next, visit the page where the error was caught (https://www.support-strong-eu.com/wp-admin/post.php?post=36263&action=edit&lang=en&message=4) and check for any visible issues.
Please contact your host for assistance with investigating this issue further.
If your site appears broken and you can't access your dashboard normally, WordPress now has a special "recovery mode". This lets you safely login to your dashboard and investigate further.
https://www.support-strong-eu.com/wp-login.php?action=enter_recovery_mode&rm_token=1VBIb5CnPkmB2dvIx27piM&rm_key=00I7zI8eEEO7b7iqYY5zj0
To keep your site safe, this link will expire in 1 day. Don't worry about that, though: a new link will be emailed to you if the error occurs again after it expires.
When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.4.3
Active theme: Knowledge Base Lite (version 0.5) Current plugin: Smartcat Integration for WPML (version 3.1.50) PHP version 8.1.18
Error Details
=============
An error of type E_ERROR was caused in line 302 of the file /home/khduxsgr/public_html/wp-content/plugins/smartcat-wpml/includes/Services/API/SmartcatClient.php. Error message: Uncaught Error: Cannot use object of type WP_Error as array in /home/khduxsgr/public_html/wp-content/plugins/smartcat-wpml/includes/Services/API/SmartcatClient.php:302
Stack trace:
#0 /home/khduxsgr/public_html/wp-content/plugins/smartcat-wpml/includes/Services/API/SmartcatClient.php(203): Smartcat\Includes\Services\API\SmartcatClient->getJsonFromBody()
#1 /home/khduxsgr/public_html/wp-content/plugins/smartcat-wpml/includes/Views/Components.php(252): Smartcat\Includes\Services\API\SmartcatClient->getProjectsList()
#2 /home/khduxsgr/public_html/wp-content/plugins/smartcat-wpml/includes/Views/Components.php(302): Smartcat\Includes\Views\Components->newProjectsSelector()
#3 /home/khduxsgr/public_html/wp-content/plugins/smartcat-wpml/includes/Views/Metabox.php(79): Smartcat\Includes\Views\Components->projectsSelector()
#4 /home/khduxsgr/public_html/wp-content/plugins/smartcat-wpml/admin/SmartcatAdmin.php(274): Smartcat\Includes\Views\Metabox->display()
#5 /home/khduxsgr/public_html/wp-admin/includes/template.php(1456): SmartcatAdmin->displayMetabox()
#6 /home/khduxsgr/public_html/wp-admin/includes/post.php(2369): do_meta_boxes()
#7 /home/khduxsgr/public_html/wp-admin/edit-form-blocks.php(316): the_block_editor_meta_boxes()
#8 /home/khduxsgr/public_html/wp-admin/post.php(187): require('/home/khduxsgr/...')
#9 {main}
thrown
I’ve tried translated content again this morning and have the exact same issue.
]]>Интеграция в WPML существует, какая появилась необходимость и с чем связана?
Старый сайт работает, но новый сайт не включает API через WPML, эта возможность специально ограничена?
Я не против, но не люблю лишний плагин если функция такая уже есть.
Буду рад новой полезной информации.
]]>About a year ago or more I connected my site using API from your web page, as far as I remember there was no plugin needed.
Please tell me what is the difference between these two solutions and should I change the connection if everything works?
]]>