Skip to content

Commit

Permalink
Remove language handling functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Oct 15, 2024
1 parent 670bc80 commit 4247245
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 76 deletions.
1 change: 0 additions & 1 deletion .psalm/stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function as_unschedule_action($string) {}
function mollieWooCommerceIsCheckoutContext() {}
function wcs_get_subscriptions($subs) {}
function mollieWooCommerceFormatCurrencyValue($value, $currency){}
function mollieDeleteWPTranslationFiles(){}
function mollieWooCommerceIsPayPalButtonEnabled($page){}
function mollieWooCommerceIsApplePayDirectEnabled($page){}
function mollieWooCommerceCheckIfNeedShipping($product){}
Expand Down
44 changes: 0 additions & 44 deletions inc/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,50 +190,6 @@ function mollieWooCommerceFormatCurrencyValue($value, $currency)
return number_format($value, 2, '.', '');
}

function mollieUpdateCompleted($upgrader_object, $options)
{
//whenever something gets updated they update the languages, we need to delete them
mollieDeleteWPTranslationFiles();
}

function mollieDeleteWPTranslationFiles()
{
if (!function_exists('WP_Filesystem')) {
require_once ABSPATH . '/wp-admin/includes/file.php';
}
WP_Filesystem();
global $wp_filesystem;
if (!$wp_filesystem) {
return;
}
$remote_destination = $wp_filesystem->find_folder(WP_LANG_DIR);
if (!$wp_filesystem->exists($remote_destination)) {
return;
}
$languageExtensions = [
'de_DE',
'de_DE_formal',
'es_ES',
'fr_FR',
'it_IT',
'nl_BE',
'nl_NL',
'nl_NL_formal',
'en_GB',
'nl_BE_formal',
];
$translationExtensions = ['.mo', '.po', '.l10n.php'];
$destination = WP_LANG_DIR
. '/plugins/mollie-payments-for-woocommerce-';
foreach ($languageExtensions as $languageExtension) {
foreach ($translationExtensions as $translationExtension) {
$file = $destination . $languageExtension
. $translationExtension;
$wp_filesystem->delete($file, false);
}
}
}

function transformPhoneToNLFormat($phone)
{
$startsWith06 = preg_match('/^06/', $phone);
Expand Down
16 changes: 0 additions & 16 deletions mollie-payments-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,6 @@
define('M4W_PLUGIN_URL', plugin_dir_url(M4W_FILE));
}

/**
* Called when plugin is activated
*/
function mollie_wc_plugin_activation_hook()
{
require_once __DIR__ . '/inc/functions.php';

if (!mollie_wc_plugin_autoload()) {
return;
}

mollieDeleteWPTranslationFiles();
}


function mollie_wc_plugin_autoload()
{
Expand Down Expand Up @@ -174,5 +160,3 @@ function initialize()
}

add_action('plugins_loaded', __NAMESPACE__ . '\\initialize');

register_activation_hook(M4W_FILE, __NAMESPACE__ . '\mollie_wc_plugin_activation_hook');
15 changes: 0 additions & 15 deletions src/Activation/ActivationModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function run(ContainerInterface $container): bool
[$this, 'pluginInit']
);
$this->declareCompatibleWithHPOS();
$this->handleTranslations();
$this->mollieWcNoticeApiKeyMissing();
$this->appleValidationFileRewriteRules();
return true;
Expand Down Expand Up @@ -77,20 +76,6 @@ public function initDb()
}
}

/**
*
*/
public function handleTranslations(): void
{
add_action('upgrader_process_complete', 'mollieUpdateCompleted', 10, 2);
// we need to handle this version specifically, we can remove this on the next
$translationFlag = get_option('mollie_plugin_update_translation');
if ($translationFlag !== 'yes') {
mollieDeleteWPTranslationFiles();
update_option('mollie_plugin_update_translation', 'yes');
}
}

/**
*
*/
Expand Down

0 comments on commit 4247245

Please sign in to comment.