<?php

namespace WPDesk\DropshippingExportFree\Action\Loader\Plugin;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Action\Loader\Plugin\PluginLinksLoaderAction as PluginLinksLoaderActionCore;

class PluginLinksLoaderAction extends PluginLinksLoaderActionCore {


	public function links_filter( array $links ): array {

		$url = \get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sklep/dropshipping-export-products-dla-woocommerce/?utm_source=wp-admin-plugins&utm_medium=link&utm_campaign=dropshipping-export-pro&utm_content=plugin-list' : 'https://wpdesk.net/products/dropshipping-export-products-pro-woocommerce/?utm_source=wp-admin-plugins&utm_medium=link&utm_campaign=dropshipping-export-pro&utm_content=plugin-list';
		foreach ( $links as $key => $val ) {
			if ( strpos( $val, 'https://www.wpdesk.pl/support/' ) !== false || strpos( $val, 'https://www.wpdesk.net/support' ) !== false ) {
				unset( $links[ $key ] );
			}
		}

		$free_plugin_links = [
			'<a href="' . $url . '" target="_blank" style="color:#FF9743;font-weight:bold;">' . __( 'Upgrade to PRO', 'dropshipping-export-free' ) . ' &rarr; </a>',
		];

		return \array_merge( $free_plugin_links, $links );
	}
}
