0

This error came out of nowhere to disable a Revolution Slider plugin. From reading other similar questions I assume there is a mismatched set of curly brackets somewhere.

I use Brackets to edit, and it helps show the connections between the opening and closing symbols, but in all my experimenting (I am really really bad, basically non-coder) I can't seem to find the proper combination.

This code includes the first 3 Unexpected '}' } errors and the first of 9 Unexpected 'public' public function add_inline_js(){ errors in the code, I've not copied the subsequent 8 errors with all their variables. The last error is a final Unexpected '} } error on the second to the last line before the ?> line.

");
                    var htmlDiv = document.getElementById('rs-plugin-settings-inline-css');
                    if(htmlDiv) {
                        htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
                    }
                    else{
                        var htmlDiv = document.createElement('div');
                        htmlDiv.innerHTML = '<style>' + htmlDivCss + '</style>';
                        document.getElementsByTagName('head')[0].appendChild(htmlDiv.childNodes[0]);
                    }
                  </script></style><?php    
                if($markup_export === true){
                    echo '<!-- /STYLE -->';
                }
            }
        }


        //add custom Slide CSS here

        if(trim($nav_css) !== ''){
            if(!is_admin()){
                ?><script>
                    var htmlDivCss = unescape("<?php echo RevSliderCssParser::compress_css(rawurlencode($nav_css));?>");
                    var htmlDiv = document.getElementById('rs-plugin-settings-inline-css');
                    if(htmlDiv) {
                        htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
                    }
                    else{
                        var htmlDiv = document.createElement('div');
                        htmlDiv.innerHTML = '<style>' + htmlDivCss + '</style>';
                        document.getElementsByTagName('head')[0].appendChild(htmlDiv.childNodes[0]);
                    }
                  </script>
                <?php
            }else{
                if($markup_export === true){
                    echo '<!-- STYLE -->';
                }
                ?>
                <style type="text/css"><?php echo RevSliderCssParser::compress_css(($nav_css));?></style>
                <?php
                if($markup_export === true){
                    echo '<!-- /STYLE -->';
                }
            }
        }

        if(!$markup_export){ //not needed for html markup export
            if(has_action('wp_footer', array($this, 'add_inline_double_jquery_error')) === false){
                add_action('wp_footer', array($this, 'add_inline_double_jquery_error'));
            }
        }
    }

    /**
     * Output Inline JS
     */
    public function add_inline_js(){

        echo $this->rev_inline_js;

    }
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • The code you posted has extra `}}` in the first ` – Accountant م Aug 22 '19 at 23:45
  • Think about dividing your PHP files in 2 parts, **top part** is for the code logic, DB, everything, **bottom part** for outputting , now you have a clean variables that are ready to be outputting. that will make your files are easier to read and maintain, and will reduce these types of problems – Accountant م Aug 22 '19 at 23:58
  • 2
    A `public` function has to be inside a class. Is this code in a class? Global functions are defined with just `function`, not `public function`. – Barmar Aug 23 '19 at 00:13
  • 1
    It's really hard to tell what's wrong when the snippet starts in the middle of the code. – Barmar Aug 23 '19 at 00:14
  • This is the beginning. Maybe that's the problem. I did not copy similar code below that repeated the same syntax and error. – Nesdon Booth Aug 23 '19 at 00:27
  • Maybe I should have made clear that this is a Wordpress site. I got an email telling me this site I admin was down and returning that parse syntax error. I downloaded the offending file, which was part of a plugin that was working fine yesterday, and was trying to make sense of the errors that Brackets was listing. I do have some other members of my team editing the site, tho I'm not sure why they would be modifying anything in this plug in. Maybe I'll try to restore a revision and see what this file looks like then. Its path is: "...plugins/revslider/includes/output.class.php – Nesdon Booth Aug 23 '19 at 00:40

0 Answers0