<?php
/**
 * FluentC WordPress Plugin File.
 *
 * This file contains the adjustments for the Permalinks Manager Lite and Pro
 *
 * @package FluentCPlugin
 * @author  FluentC <wp@fluentc.io>
 */

namespace FluentC\Actions;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
use FluentC\Models\Hooks;
use FluentC\Polylang;


/**
 * Permalinks specific modifications
 */
class Permalinks implements Hooks {

	
	/**
	 * FluentC cache class
	 *
	 * @var object
	 */
	protected $fluentc_polylang;


	/**
	 * Constructor.
	 *
	 * @since 2.5
	 */
	public function __construct() {
	
		$this->fluentc_polylang = new Polylang();
		
	}
	/**
	 * Hooks for Autoloading
	 *
	 * @since 2.5
	 */
	public function hooks() {

		    // Add Permalink Manager compatibility hooks
			add_filter('permalink_manager_detect_uri', array($this->fluentc_polylang, 'detect_uri_language'), 9, 3);
			add_filter('permalink_manager_filter_permalink_base', array($this->fluentc_polylang, 'prepend_lang_prefix'), 9, 2);
			add_filter('permalink_manager_filter_query', array($this->fluentc_polylang, 'pl_allow_canonical_redirect'), 3, 5);
			add_filter('permalink_manager_endpoints', array($this->fluentc_polylang, 'pl_translate_pagination_endpoint'), 9);
			add_filter('permalink_manager_detect_uri', array($this->fluentc_polylang, 'pl_detect_pagination_endpoint'), 10, 3);
			add_filter('permalink_manager_uri_editor_extra_info', array($this->fluentc_polylang, 'uri_editor_get_lang_col'), 9, 3);
			add_filter('permalink_manager_uri_editor_extra_fields', array($this->fluentc_polylang, 'uri_editor_filter_lang'), 9, 2);
			add_filter('permalink_manager_filter_uri_editor_query', array($this->fluentc_polylang, 'uri_editor_filter_sql_query'), 9, 3);
			
	}
}
