<?php

namespace WPDesk\DropshippingXmlFree\Action\Loader\Plugin;

use DropshippingXmlFreeVendor\WPDesk\Library\DropshippingXmlCore\Action\Loader\Plugin\PluginLinksLoaderAction as PluginLinksLoaderActionCore;
/**
 * Class PluginLinksLoaderAction, plugin links loader.
 */
class PluginLinksLoaderAction extends PluginLinksLoaderActionCore {

	public function links_filter( array $links ): array {
		$url = \get_locale() === 'pl_PL' ? 'https://www.wpdesk.pl/sk/dropshipping-xml-for-woocommerce-pro-pl' : 'https://wpdesk.net/sk/dropshipping-xml-for-woocommerce-pro-en';
		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-xml-for-woocommerce' ) . ' &rarr; </a>',
		];

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