<?php

/**
 * The admin-facing functionality of the plugin.
 *
 * @link       https://themeatelier.net
 * @since      1.0.0
 *
 * @package domain-for-sale
 * @subpackage domain-for-sale/src/Admin
 * @author     ThemeAtelier<themeatelierbd@gmail.com>
 */

namespace ThemeAtelier\DomainForSale\Admin;

use ThemeAtelier\DomainForSale\Admin\DBUpdates;
use ThemeAtelier\DomainForSale\Admin\HelpPage\Help;
use ThemeAtelier\DomainForSale\Admin\Duplicator;
use ThemeAtelier\DomainForSale\Admin\Views\DomainForSaleMetaboxes;
use ThemeAtelier\DomainForSale\Admin\Views\DomainForSaleSettings;
use ThemeAtelier\DomainForSale\Admin\Preview\Preview;
use ThemeAtelier\DomainForSale\Admin\ReviewNotice\ReviewNotice;
use ThemeAtelier\DomainForSale\Admin\ReviewNotice\ThemeAtelier_Offer_Banner;
use ThemeAtelier\DomainForSale\Admin\Views\DomainForSaleTools;
use ThemeAtelier\DomainForSale\Admin\Views\ListingMetabox;
use ThemeAtelier\DomainForSale\Frontend\Helpers\Helpers;
use ThemeAtelier\DomainForSale\Admin\Dashboard;

/**
 * The admin class
 */
class Admin
{
  protected $suffix;

  /**
   * The slug of this plugin.
   *
   * @since    1.0.0
   * @access   private
   * @var      string    $plugin_slug   The slug of this plugin.
   */
  private $plugin_slug;

  /**
   * The min of this plugin.
   *
   * @since    1.0.0
   * @access   private
   * @var      string    $min   The slug of this plugin.
   */
  private $min;

  /**
   * The version of this plugin.
   *
   * @since    1.0.0
   * @access   private
   * @var      string    $version    The current version of this plugin.
   */
  private $version;

  /**
   * The class constructor.
   *
   * @param string $plugin_slug The slug of the plugin.
   * @param string $version Current version of the plugin.
   */
  function __construct($plugin_slug, $version)
  {
    $this->suffix      = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || defined('WP_DEBUG') && WP_DEBUG ? '' : '.min';
    $this->plugin_slug = $plugin_slug;
    $this->version     = $version;
    $this->min         = defined('WP_DEBUG') && WP_DEBUG ? '' : '.min';
    add_action('save_post', [$this, 'dfs_exclusive_replace_theme_template'], 20, 3);
    add_action('admin_menu', array($this, 'domain_for_sale_support_submenu'));
    add_action('admin_menu', array($this, 'reorder_dfs_submenu'), 999);
    add_filter('submenu_file', array($this, 'highlight_dashboard_submenu'));
    add_action('after_setup_theme', array($this, 'initialize_metabox_configs'));
    add_action('after_setup_theme', array($this, 'listing_metabox_configs'));
    add_action('init', [$this, 'register_domain_for_sale_post_type']);
    add_action('init', [$this, 'register_domain_listing_post_type']);


    add_action('add_meta_boxes', [$this, 'sp_lc_add_meta_box']);

    Help::instance();
    new ReviewNotice();
    new DBUpdates();
    new Preview();
    new Dashboard();
    new Offers();
    new ImportExport();
    new Duplicator();

    if (! defined('THEMEATELIER_OFFER_BANNER_LOADED')) {
      define('THEMEATELIER_OFFER_BANNER_LOADED', true);
      ThemeAtelier_Offer_Banner::instance();
    }

    $active_plugins = get_option('active_plugins');
    foreach ($active_plugins as $active_plugin) {
      $_temp = strpos($active_plugin, 'domain-for-sale.php');
      if (false != $_temp) {
        add_filter('plugin_action_links_' . $active_plugin, array($this, 'domain_for_sale_plugin_action_links'));
        add_filter('plugin_row_meta', array($this, 'after_domain_for_sale_row_meta'), 10, 4);
      }
    }

    add_filter('parent_file', array($this, 'domain_for_sale_highlight_menu'));
    add_filter('submenu_file', array($this, 'domain_for_sale_submenu_highlight'));

    add_filter('admin_footer_text', array($this, 'domain_for_sale_admin_footer'), 1, 2);
  }
  /**
   * Logo Meta Box
   *
   * @return void
   */
  public function sp_lc_add_meta_box()
  {

    remove_meta_box('postcustom', 'dfs_template', 'normal');
  }
  public function initialize_metabox_configs()
  {
    DomainForSaleMetaboxes::layout_metabox('dfs_layouts');
    DomainForSaleMetaboxes::option_metabox('dfs_template_options');
    DomainForSaleMetaboxes::shortcode_metabox('dfs_shortcode');
    DomainForSaleMetaboxes::page_builders_metabox('dfs_page_builders_metabox');
    DomainForSaleMetaboxes::promotional_metabox('dfs_promotional_metabox');
    DomainForSaleSettings::settings('dfs-opt');
  }
  public function listing_metabox_configs()
  {
    ListingMetabox::layout_metabox('listing_layouts');
    ListingMetabox::option_metabox('listing_template_options');
    ListingMetabox::shortcode_metabox('listing_shortcode');
  }

  public function dfs_exclusive_replace_theme_template($post_id, $post, $update)
  {
    // ✅ Set your custom post type here
    $post_type = 'dfs_template';
    if ($post->post_type !== $post_type) return;
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
    if (wp_is_post_revision($post_id)) return;
    if (!post_type_exists('dfs_template')) return;
    if (!current_user_can('edit_post', $post_id)) return;
    // Get updated dfs_template_options from POST
    if (!isset($_POST['dfs_template_options']) || !is_array($_POST['dfs_template_options'])) return;
    $new_data = $_POST['dfs_template_options'];
    if (!isset($new_data['dfs_apply_on']) || $new_data['dfs_apply_on'] !== 'replace_theme') return;
    // Find other posts with replace_theme selected
    $args = array(
      'post_type'      => $post_type,
      'post_status'    => 'any',
      'posts_per_page' => -1,
      'post__not_in'   => array($post_id),
      'meta_query'     => array(
        array(
          'key'     => 'dfs_template_options',
          'value'   => '"dfs_apply_on";s:13:"replace_theme"',
          'compare' => 'LIKE',
        ),
      ),
    );
    $query = new \WP_Query($args);
    if ($query->have_posts()) {
      foreach ($query->posts as $other_post) {
        $other_id = $other_post->ID;
        $options = get_post_meta($other_id, 'dfs_template_options', true);
        if (!is_array($options)) continue;
        // Only update if current value is replace_theme
        if (isset($options['dfs_apply_on']) && $options['dfs_apply_on'] === 'replace_theme') {
          $options['dfs_apply_on'] = 'shortcode';
          update_post_meta($other_id, 'dfs_template_options', $options);
        }
      }
    }
  }

  /**
   * Register the stylesheets for the public-facing side of the site.
   *
   * @since    1.0.0
   */
  public function enqueue_styles()
  {

    // Review notice CSS
    wp_enqueue_style('domain-for-sale-review-notice', DOMAIN_FOR_SALE_URL . '/src/Admin/ReviewNotice/assets/css/review-notice' . $this->min . '.css', array(), DOMAIN_FOR_SALE_VERSION, 'all');
  }

  /**
   * Register the stylesheets for the public-facing side of the site.
   *
   * @since    1.0.0
   */
  public function enqueue_scripts($hook)
  {
    $current_screen        = get_current_screen();
    $the_current_post_type = $current_screen->post_type;

    wp_enqueue_style('help');

    if ('dfs_template' == $the_current_post_type || 'domain_listing' === $the_current_post_type) {
      wp_enqueue_script('domain-for-sale-admin', DOMAIN_FOR_SALE_URL . '/src/Admin/assets/js/domain-for-sale-admin' . $this->suffix . '.js', array('jquery'), $this->version, false);
    }
  }

  public function domain_for_sale_support_submenu()
  {
    add_menu_page(
      esc_html__('Domain For Sale', 'domain-for-sale'),
      esc_html__('Domain For Sale', 'domain-for-sale'),
      'manage_options', // More permissive for testing
      'domain-for-sale',
      [$this, 'render_react_app'],
      'dashicons-admin-site',
      65
    );

    // Dashboard — replaces the WordPress auto-generated duplicate first submenu item
    add_submenu_page(
      'domain-for-sale',
      __('Dashboard', 'domain-for-sale'),
      __('Dashboard', 'domain-for-sale'),
      'manage_options',
      'domain-for-sale',
      [$this, 'render_react_app']
    );

    add_submenu_page(
      'domain-for-sale',
      __('Add New Domain', 'domain-for-sale'),
      __('Add New Domain', 'domain-for-sale'),
      'manage_options',
      'post-new.php?post_type=dfs_template'
    );

    add_submenu_page(
      'domain-for-sale',
      __('Domain Listings', 'domain-for-sale'),
      __('Domain Listing <span class="update-plugins" style="background:#d63638;color:#fff;border-radius:3px;padding:1px 4px;font-size:10px;vertical-align:middle;float:right;">NEW</span>', 'domain-for-sale'),
      'manage_options',
      'edit.php?post_type=domain_listing'
    );

    // Offers page
    add_submenu_page(
      'domain-for-sale',
      __('Offers', 'domain-for-sale'),
      __('Offers', 'domain-for-sale'),
      'manage_options',
      'domain-for-sale#/offers', // slug 1
      [$this, 'render_react_app']
    );
    add_submenu_page(
      'domain-for-sale',
      esc_html__('Settings', 'domain-for-sale'),
      esc_html__('Settings', 'domain-for-sale'),
      'manage_options', // More permissive for testing
      'domain-for-sale-settings',
      array($this, 'domain_for_sale_settings'),
    );
    add_submenu_page(
      'domain-for-sale',
      __('Tools', 'domain-for-sale'),
      __('Tools', 'domain-for-sale'),
      'manage_options',
      'domain-for-sale#/import-domains',
      [$this, 'render_react_app']
    );



    do_action('dfs_recommended_page_menu');


    // add_submenu_page(
    //   'domain-for-sale',
    //   __('👑 Upgrade to Pro!', 'domain-for-sale'),
    //   sprintf(
    //     '<span style="color:#FFCC4D;" class="domain-for-sale-text">%s</span>',
    //     __('Upgrade To Pro', 'domain-for-sale')
    //   ),
    //   'manage_options',
    //   'https://wpdomainforsale.com/pricing/?utm_source=domain_for_sale_plugin&utm_medium=submenu_page&utm_campaign=regular'
    // );

  }

  // Same callback for all
  public function render_react_app()
  {
    echo '<div id="domain_for_sale_admin_ui"></div>';
  }

  public function domain_for_sale_settings() {}

  public function reorder_dfs_submenu()
  {
    global $submenu;

    $key = 'domain-for-sale';
    if (empty($submenu[$key])) {
      return;
    }

    $desired_order = [
      'domain-for-sale',                  // Dashboard
      'edit.php?post_type=dfs_template',      // All Domains
      'post-new.php?post_type=dfs_template',  // Add New Domain
      'edit.php?post_type=domain_listing',    // Domain Listing
      'domain-for-sale#/offers',          // Offers
      'domain-for-sale#/transactions',    // Transactions
      'domain-for-sale-settings',         // Settings
      'domain-for-sale#/import-domains',  // Tools
      'domain-for-sale#/help',            // Help
    ];

    // Index items by slug, keeping only the first occurrence per slug
    $indexed = [];
    foreach ($submenu[$key] as $item) {
      $slug = $item[2];
      if (!isset($indexed[$slug])) {
        $indexed[$slug] = $item;
      }
    }

    $sorted = [];
    foreach ($desired_order as $slug) {
      if (isset($indexed[$slug])) {
        $sorted[] = $indexed[$slug];
        unset($indexed[$slug]);
      }
    }

    // Append any items not explicitly ordered
    foreach ($indexed as $item) {
      $sorted[] = $item;
    }

    $submenu[$key] = $sorted;
  }

  public function highlight_dashboard_submenu($submenu_file)
  {
    if (isset($_GET['page']) && $_GET['page'] === 'domain-for-sale') { // phpcs:ignore WordPress.Security.NonceVerification
      return 'domain-for-sale';
    }
    return $submenu_file;
  }

  // Help page callbacks
  /**
   * Add domain_for_sale admin columns.
   *
   * @since 2.0.0
   * @return statement
   */
  public function filter_domain_for_sale_admin_column()
  {
    $admin_columns['cb']            = '<input type="checkbox" />';
    $admin_columns['title']         = esc_html__('Title', 'domain-for-sale');
    $admin_columns['shortcode']     = esc_html__('Shortcode', 'domain-for-sale');
    $admin_columns['info']        = esc_html__('Info', 'domain-for-sale');
    $admin_columns['date']          = esc_html__('Date', 'domain-for-sale');

    return $admin_columns;
  }

  /**
   * Display admin columns for the domain_for_sales.
   *
   * @param mix    $column The columns.
   * @param string $post_id The post ID.
   * @return void
   */
  public function display_domain_for_sale_admin_fields($column, $post_id)
  {
    $layouts                = get_post_meta($post_id, 'dfs_layouts', true);
    $domain_for_sales_types = isset($layouts['dfs_layout_preset']) ? $layouts['dfs_layout_preset'] : '';
    $template_options                = get_post_meta($post_id, 'dfs_template_options', true);
    $apply_on = isset($template_options['dfs_apply_on']) ? $template_options['dfs_apply_on'] : '';
    $domain = isset($template_options['domain_name']) ? $template_options['domain_name'] : '';
    $apply_on = ucwords(str_replace('_', ' ', $apply_on));
    $layout = ucwords(str_replace('_layout', ' ', $domain_for_sales_types));
    switch ($column) {
      case 'shortcode':
        $column_field = '<input  class="ta_domain_for_sale_input" style="width: 215px;padding: 4px 8px;cursor: pointer;" type="text" onClick="this.select();" readonly="readonly" value="[domain_for_sale id=&quot;' . $post_id . '&quot;]"/> <div class="domain-for-sale-after-copy-text"><i class="icofont-check-circled"></i> ' . esc_html__('Shortcode Copied to Clipboard!', 'domain-for-sale') . ' </div>';
        echo wp_kses(
          $column_field,
          array(
            'input' => array(
              'class'   => true,
              'style'   => true,
              'type'    => true,
              'onClick' => true,
              'readonly' => true,
              'value'   => true,
            ),
            'div' => array(
              'class' => true,
            ),
            'i' => array(
              'class' => true,
            ),
          )
        );
        break;
      case 'info':
        printf(
          /* translators: 1: domain link, 2: apply-with value, 3: layout value */
          __('Domain: %1$s<br>Apply With: %2$s<br>Layout: %3$s', 'domain-for-sale'),
          sprintf(
            '<a target="_blank" rel="noopener noreferrer" href="%s">%s</a>',
            esc_url($domain),
            esc_html($domain)
          ),
          esc_html($apply_on),
          esc_html($layout)
        );
        break;
    } // end switch.
  }

  /**
   * Defines custom admin columns for DFS templates.
   *
   * @since 2.0.0
   * @return array List of admin columns.
   */
  public function filter_domain_listing_admin_column()
  {
    $admin_columns['cb']        = '<input type="checkbox" />';
    $admin_columns['title']     = esc_html__('Layout Title', 'domain-for-sale');
    $admin_columns['shortcode'] = esc_html__('Shortcode', 'domain-for-sale');
    $admin_columns['date']      = esc_html__('Date', 'domain-for-sale');
    return $admin_columns;
  }

  /**
   * Renders values for custom admin columns.
   *
   * @param string $column  Column name.
   * @param int    $post_id Post ID.
   * @since 2.0.0
   * @return void
   */
  public function display_domain_listing_admin_fields($column, $post_id)
  {
    switch ($column) {
      case 'shortcode':
        $column_field = '<div><input  class="ta_domain_for_sale_input" style="width: 215px;padding: 4px 8px;cursor: pointer;" type="text" onClick="this.select();" readonly="readonly" value="[domain_listing id=&quot;' . $post_id . '&quot;]"/></div>  <div class="domain-for-sale-after-copy-text"><i class="icofont-check-circled"></i> ' . esc_html__('Shortcode Copied to Clipboard!', 'domain-for-sale') . ' </div>';
        echo wp_kses(
          $column_field,
          array(
            'input' => array(
              'class'   => true,
              'style'   => true,
              'type'    => true,
              'onClick' => true,
              'readonly' => true,
              'value'   => true,
            ),
            'div' => array(
              'class' => true,
            ),
            'i' => array(
              'class' => true,
            ),
          )
        );
        break;
    } // end switch.
  }

  /**
   * Domain For Sale post type
   */
  public function register_domain_for_sale_post_type()
  {
    if (post_type_exists('dfs_template')) {
      return;
    }
    $options = get_option('dfs-opt');
    $single_domain_url_slug = !empty($options['single_domain_url_slug']) ? $options['single_domain_url_slug'] : 'domain';

    $capability =  Helpers::domain_for_sale_dashboard_capability();
    $show_ui =  current_user_can($capability) ? true : false;
    // Set the Domain For Sale post type labels.
    $labels = apply_filters(
      'domain_for_sale_post_type_labels',
      array(
        'name'               => esc_html__('Domains', 'domain-for-sale'),
        'singular_name'      => esc_html__('Domain', 'domain-for-sale'),
        'menu_name'          => esc_html__('Domain For Sale', 'domain-for-sale'),
        'all_items'          => esc_html__('All Domains', 'domain-for-sale'),
        'add_new'            => esc_html__('Add New Domain', 'domain-for-sale'),
        'add_new_item'       => esc_html__('Add New Domain', 'domain-for-sale'),
        'new_item'           => esc_html__('New', 'domain-for-sale'),
        'edit_item'          => esc_html__('Edit', 'domain-for-sale'),
        'view_item'          => esc_html__('View', 'domain-for-sale'),
        'search_items'       => esc_html__('Search', 'domain-for-sale'),
        'parent_item_colon'  => esc_html__('Parent ', 'domain-for-sale'),
        'not_found'          => esc_html__('No Domain Found.', 'domain-for-sale'),
        'not_found_in_trash' => esc_html__('No Domain Found in Trash.', 'domain-for-sale')
      )
    );
    $menu_icon      = 'dashicons-admin-site';
    $args      = apply_filters(
      'domain_for_sale_post_type_args',
      array(
        'label'               => esc_html__('DFS Template', 'domain-for-sale'),
        'description'         => esc_html__('DFS Template', 'domain-for-sale'),
        'public'              => false,
        'show_ui'             => $show_ui,
        'show_in_nav_menus'   => true,
        'show_in_menu'        => 'domain-for-sale',
        'menu_icon'           => $menu_icon,
        'hierarchical'        => false,
        'query_var'           => false,
        'publicly_queryable' => true,
        'menu_position'       => 5,
        'supports'            => array('title'),
        'capabilities'        => array(
          'publish_posts'       => $capability,
          'edit_posts'          => $capability,
          'edit_others_posts'   => $capability,
          'delete_posts'        => $capability,
          'delete_others_posts' => $capability,
          'read_private_posts'  => $capability,
          'edit_post'           => $capability,
          'delete_post'         => $capability,
          'read_post'           => $capability,
        ),
        'capability_type' => 'post',
        'rewrite'         => array('slug' => $single_domain_url_slug),
        'show_in_rest'    => true,
        'labels'          => $labels,
      )
    );

    register_post_type('dfs_template', $args);
    flush_rewrite_rules();
  }

  /**
   * Domain Listing post type
   */
  public function register_domain_listing_post_type()
  {
    if (post_type_exists('domain_listing')) {
      return;
    }
    $capability =  Helpers::domain_for_sale_dashboard_capability();
    $show_ui =  current_user_can($capability) ? true : false;
    // Set the Domain For Sale post type labels.
    $labels = apply_filters(
      'domain_listing_post_type_labels',
      array(
        'name'               => esc_html__('Domain Listings', 'domain-for-sale'),
        'singular_name'      => esc_html__('Domain Listing', 'domain-for-sale'),
        'menu_name'          => esc_html__('Domain Listing', 'domain-for-sale'),
        'all_items'          => esc_html__('Domain Listing', 'domain-for-sale'),
        'add_new'            => esc_html__('Add New', 'domain-for-sale'),
        'add_new_item'       => esc_html__('Add New', 'domain-for-sale'),
        'new_item'           => esc_html__('New', 'domain-for-sale'),
        'edit_item'          => esc_html__('Edit', 'domain-for-sale'),
        'view_item'          => esc_html__('View', 'domain-for-sale'),
        'search_items'       => esc_html__('Search', 'domain-for-sale'),
        'parent_item_colon'  => esc_html__('Parent ', 'domain-for-sale'),
        'not_found'          => esc_html__('No Domain Found.', 'domain-for-sale'),
        'not_found_in_trash' => esc_html__('No Domain Found in Trash.', 'domain-for-sale')
      )
    );
    $menu_icon      = 'dashicons-admin-site';
    $args      = apply_filters(
      'domain_listing_post_type_args',
      array(
        'label'               => esc_html__('Listing Template', 'domain-for-sale'),
        'description'         => esc_html__('Listing Template', 'domain-for-sale'),
        'public'              => false,
        'show_ui'             => $show_ui,
        'show_in_nav_menus'   => false,
        'show_in_menu'        => false,
        'menu_icon'           => $menu_icon,
        'hierarchical'        => false,
        'query_var'           => false,
        'publicly_queryable'  => true,
        'menu_position'       => 100,
        'supports'            => array('title'),
        'capabilities'        => array(
          'publish_posts'       => $capability,
          'edit_posts'          => $capability,
          'edit_others_posts'   => $capability,
          'delete_posts'        => $capability,
          'delete_others_posts' => $capability,
          'read_private_posts'  => $capability,
          'edit_post'           => $capability,
          'delete_post'         => $capability,
          'read_post'           => $capability,
        ),
        'capability_type' => 'post',
        'rewrite'         => array('slug' => 'domain-listing'),
        'show_in_rest'    => true,
        'labels'          => $labels,
      )
    );

    register_post_type('domain_listing', $args);
    flush_rewrite_rules();
  }

  /**
   * Add plugin row meta link.
   *
   * @since 2.0
   *
   * @param array  $plugin_meta .
   * @param string $file .
   *
   * @return array
   */
  public function after_domain_for_sale_row_meta($plugin_meta, $file)
  {

    if (DOMAIN_FOR_SALE_BASENAME === $file) {
      $plugin_meta[] = '<a href="' . DOMAIN_FOR_SALE_DEMO_URL . '" target="_blank">' . esc_html__('Live Demo', 'domain-for-sale') . '</a>';
    }

    return $plugin_meta;
  }

  public function domain_for_sale_highlight_menu($parent_file)
  {
    global $current_screen;
    if ($current_screen->post_type === 'domain_listing') {
      $parent_file = 'domain-for-sale';
    }
    return $parent_file;
  }
  public function domain_for_sale_submenu_highlight($submenu_file)
  {
    global $current_screen;
    if ($current_screen->post_type === 'domain_listing') {
      $submenu_file = 'edit.php?post_type=domain_listing';
      return $submenu_file;
    }
    // Highlight Dashboard when on the main plugin page (no hash sub-page)
    if (isset($_GET['page']) && $_GET['page'] === 'domain-for-sale') {
      $submenu_file = 'domain-for-sale';
    }
    return $submenu_file;
  }

  /**
   * Review Text.
   *
   * @param string $text text.
   *
   * @return string
   */
  public function domain_for_sale_admin_footer($text)
  {

    $screen = get_current_screen();

    if ('dfs_template' === $screen->post_type || 'domain_listing' === $screen->post_type) {
      $text = sprintf(
        /* translators: 1: start strong tag, 2: close strong tag. 3: start link 4: close link */
        __('<i>Enjoying %1$sDomain For Sale?%2$s Please rate us %3$sWordPress.org%4$s. Your positive feedback will help us grow more. Thank you! 😊</i>', 'domain-for-sale'),
        '<strong>',
        '</strong>',
        '<span class="greet-footer-text-star">★★★★★</span> <a href="https://wordpress.org/support/plugin/domain-for-sale/reviews/#new-post" target="_blank">',
        '</a>'
      );
    }

    return $text;
  }

  // Plugin settings in plugin list
  public function domain_for_sale_plugin_action_links(array $links): array
  {
    $new_links = array(
      sprintf('<a href="' . esc_url(admin_url('admin.php?page=domain-for-sale-settings')) . '">' . esc_html__('Settings', 'domain-for-sale') . '</a>'),
    );

    $links[] = sprintf('<a style="font-weight: bold;color:#35b747" target="_blank" href="https://wpdomainforsale.com/?utm_source=domain_for_sale_plugin&utm_medium=action_link&utm_campaign=regular">%s</a>', esc_html__('Go Pro!', 'domain-for-sale'));
    return array_merge($new_links, $links);
  }
}
