<?php
/**
 * Plugin Name: RTL/LTR Switcher
 * Description: Easily switch between RTL and LTR text directions on multilingual WordPress sites. Responsive and theme-compatible for global audiences.
 * Version: 2.2
 * Tested up to: 6.9
 * Author: ThemeForen
 * License: GPLv2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 */

function rtl_ltr_toggler_enqueue_scripts() {

    wp_enqueue_style('rtl-ltr-toggler-style', plugins_url('assets/css/style.css', __FILE__));


    wp_enqueue_script('rtl-ltr-toggler-script', plugins_url('assets/js/script.js', __FILE__), array('jquery'), null, true);
}
add_action('wp_enqueue_scripts', 'rtl_ltr_toggler_enqueue_scripts');

function rtl_ltr_toggler_button() {
    echo '<button id="rtl-ltr-toggler-btn" class="rtl-ltr-toggler-btn"><svg fill="#000000" height="20px" width="20px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 381.67 381.67" xml:space="preserve" stroke="#ffffff" stroke-width="0.0038166899999999998" transform="matrix(-1, 0, 0, 1, 0, 0)"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <polygon points="106.615,214.469 0,283.87 106.615,353.271 106.615,313.207 211.979,313.207 211.979,254.534 106.615,254.534 "></polygon> <path d="M302.485,218.295c-36.158,0-65.575,29.417-65.575,65.575s29.417,65.575,65.575,65.575s65.575-29.417,65.575-65.575 S338.643,218.295,302.485,218.295z"></path> <polygon points="275.054,167.2 381.669,97.799 275.054,28.398 275.054,68.462 169.69,68.462 169.69,127.135 275.054,127.135 "></polygon> <path d="M79.184,163.374c36.158,0,65.575-29.417,65.575-65.575s-29.417-65.575-65.575-65.575S13.609,61.641,13.609,97.799 S43.026,163.374,79.184,163.374z"></path> </g> </g></svg></button>';
}
add_action('wp_footer', 'rtl_ltr_toggler_button');