• The plugin does its job well. Nice work.

    There is one issue though. When I enable ajax submissions on a Gravity Form, I get a SyntaxError: Invalid or unexpected token because it adds a <script> to the post content and you’re replacing the numbers in JS with Persian numbers, which breaks the JS.

    I did a quick fix for myself for now, but it should be fixed in the plugin.

    Below is the fix I wrote, in case someone else is having the same issue:

    
    function fix_english_number($content)
    {
      return 
        str_replace(
          array('?', '?', '?', '?', '?', '?', '?', '?', '?', '?'),
          range(0, 9),
          $content[0]
        );
    }
    function fix_parsi_numbers_in_scripts($content) {
      return preg_replace_callback(
        '/<script.*(?!<\/script>).*<\/script>/i', 'fix_english_number', $content
      );  
    }
    add_filter('the_content', 'fix_parsi_numbers_in_scripts', 1001);
    
    • This topic was modified 7 years, 5 months ago by ardalanme.
  • The topic ‘Great plugin. Has one issue though.’ is closed to new replies.