Plugin Directory

Changeset 3128827


Ignore:
Timestamp:
07/31/2024 01:36:13 PM (20 months ago)
Author:
karim42
Message:

fix error json api rest

Location:
quran-text-multilanguage/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • quran-text-multilanguage/trunk/inc/quran_style.php

    r2827897 r3128827  
    11<?php
    22defined( 'ABSPATH' ) or die( 'Salem aleykoum!' );
     3if (!defined('REST_REQUEST')) {
    34?>
    4 
    5 
    65
    76<style>
     
    528527}
    529528</style>
    530 
    531 
    532 
     529<?php
     530}
     531?>
     532
     533
  • quran-text-multilanguage/trunk/inc/template.php

    r2921936 r3128827  
     1<?php
     2if (!defined('REST_REQUEST')) {
     3
     4?>
    15<div id="template_quran">
    26
     
    191195            ?>
    192196            <script>
    193             jQuery(document).ready(function(e) {
    194                 var UrlPrevSourate = "?sourate=<?php echo $_GET['sourate'];echo "&lang=".$_GET['lang']."";?>";
    195                 history.pushState({ path: this.path }, '', ''+UrlPrevSourate+'');
     197            document.addEventListener('DOMContentLoaded', function() {
     198                var sourate = "<?php echo $_GET['sourate']; ?>";
     199                var lang = "<?php echo $_GET['lang']; ?>";
     200                var UrlPrevSourate = "?sourate=" + sourate + "&lang=" + lang;
     201                history.pushState({ path: window.location.pathname }, '', UrlPrevSourate);
    196202            });
    197203            </script>
     
    206212           $lang = get_option('quran_languages');
    207213        ?>
    208             <script>
    209             var UrlPrevSourate = "?sourate=al-fatiha-1" ;
    210             history.pushState({ path: this.path }, '', ''+UrlPrevSourate+'&lang=<?=$lang;?>');
    211             </script>
     214<script>
     215document.addEventListener('DOMContentLoaded', function() {
     216    var lang = "<?= $lang; ?>";
     217    var UrlPrevSourate = "?sourate=al-fatiha-1";
     218    history.pushState({ path: window.location.pathname }, '', UrlPrevSourate + '&lang=' + lang);
     219});
     220</script>
     221
    212222            <div id="result">
    213223        <?php
     
    222232</div>
    223233</div>
     234<?php
     235}
     236?>
  • quran-text-multilanguage/trunk/quran-text-multilanguage.php

    r2921938 r3128827  
    77Description: Quran Text Multilanguage translated into 29 languages. Full ajax version and responsive. Fully customizable. More reciter...
    88
    9 Version: 2.3.20
     9Version: 2.3.21
    1010
    1111Author: Bahmed karim
     
    455455//LOAD JS FILE
    456456function add_js_scripts() {
     457    wp_enqueue_script( 'jquery' );
    457458    wp_enqueue_script( 'loadquran', plugin_dir_url(__FILE__).'/js/load_sura.js', array('jquery'), '1.0', true );
    458459    wp_enqueue_script('msdropdownddjs',plugin_dir_url( __FILE__ ).'js/jquery.dd.js', array('jquery'), '1.0', true); 
     
    497498
    498499
    499 function qtm_renderquran(){
    500    
    501 require('inc/quran_style.php');
    502 
    503 require('inc/template.php');
    504 init_quran();
    505 
    506 ?>
    507 
    508 
    509 
    510   <script language="javascript">
    511 jQuery(document).ready(function(e) {
    512 
    513 try {
    514 jQuery("#select_language,#change_sura").msDropDown();
    515 } catch(e) {
    516 alert(e.message);
    517 }
    518 });
    519 </script>
    520 
    521 
    522 <?php
    523 
     500function qtm_renderquran() {
     501    // Enqueue jQuery
     502    wp_enqueue_script('jquery');
     503
     504    // Add inline script to ensure jQuery is used
     505    $inline_script = "
     506    jQuery(document).ready(function($) {
     507        try {
     508            $('#select_language, #change_sura').msDropDown();
     509        } catch(e) {
     510            alert(e.message);
     511        }
     512    });
     513    ";
     514
     515    // Enqueue a placeholder script to ensure jQuery is available
     516    wp_register_script('qtm-inline', '', [], '', true);
     517    wp_enqueue_script('qtm-inline');
     518
     519    // Add inline script to the placeholder script
     520    wp_add_inline_script('qtm-inline', $inline_script);
     521
     522    // Include necessary files
     523    require_once plugin_dir_path(__FILE__) . 'inc/quran_style.php';
     524    require_once plugin_dir_path(__FILE__) . 'inc/template.php';
     525
     526    // Initialize Quran (assuming this is required)
     527    init_quran();
    524528}
    525529
  • quran-text-multilanguage/trunk/readme.txt

    r3128746 r3128827  
    362362 
    363363 - add Tajik language
     364
     365= 2.3.21
     366 - fix json error api rest
Note: See TracChangeset for help on using the changeset viewer.