[wpseo_breadcrumb]

Fatal error: Switch statements may only contain one default clause (php7)

Solutons:


You can not use a case statement inside a case. Try this corrected code

switch ( $type ) {

            case 'heading':
                echo '</td></tr><tr valign="top"><td colspan="2"><h4>' . $desc . '</h4>';
                break;

            case 'checkbox':
                echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" value="1" ' . checked( $options[$id], 1, false ) . ' /> <label for="' . $id . '">' . $desc . '</label>';

                break;

            case 'select':
                echo '<select class="select' . $field_class . '" name="' . $shortname_options . '[' . $id . ']' . '">';

                foreach ( $choices as $value => $label )
                    echo '<option value="' . esc_attr( $value ) . '"' . selected( $options[$id], $value, false ) . '>' . $label . '</option>';

                echo '</select>';

                if ( $desc != '' )
                    echo '<br /><span class="description">' . $desc . '</span>';

                break;

            case 'radio':
                $i = 0;
                foreach ( $choices as $value => $label ) {
                    echo '<input class="radio' . $field_class . '" type="radio" name="' . $shortname_options . '[' . $id . ']' . '" id="' . $id . $i . '" value="' . esc_attr( $value ) . '" ' . checked( $options[$id], $value, false ) . '> <label for="' . $id . $i . '">' . $label . '</label>';
                    if ( $i < count( $options ) - 1 )
                        echo '<br />';
                    $i++;
                }

                if ( $desc != '' )
                    echo '<br /><span class="description">' . $desc . '</span>';

                break;

            case 'textarea':
                echo '<textarea class="' . $field_class . '" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre( $options[$id] ) . '</textarea>';

                if ( $desc != '' )
                    echo '<br /><span class="description">' . $desc . '</span>';

                break;

            case 'password':
                echo '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" value="' . esc_attr( $options[$id] ) . '" />';

                if ( $desc != '' )
                    echo '<br /><span class="description">' . $desc . '</span>';

                break;

            case 'text':
                echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . $shortname_options . '[' . $id . ']' . '" placeholder="' . $std . '" value="' . esc_attr( $options[$id] ) . '" />';

                if ( $desc != '' )
                    echo '<br /><span class="description">' . $desc . '</span>';

                break;

            case 'html':
                echo $std;

                if ( $desc != '' )
                    echo '<br /><span class="description">' . $desc . '</span>';

                break;

            default:
               echo '<input id="' . $id . '" class="upload-url' . $field_class . '" type="text" name="' . $shortname_options . '[' . $id . ']' . '" value="' . esc_attr( $options[$id] ) . '" /><input id="st_upload_button" class="st_upload_button" type="button" name="upload_button" value="Upload" />';

            if ( $desc != '' )
               echo '
               <span class="description">' . $desc . '</span>';
            echo '<div class="upload-img-preview">';
            if (esc_attr( $options[$id] <> '')) {
                echo '<img class="upload-img-preview" src="https://stackoverflow.com/questions/44000568/.esc_attr( $options[$id])." />';
                echo '<a class="removeupload">'. __('Delete Image', 'icore') .'</a>';
            }
                echo '</div>';
                break;

                case 'slide':
                    if ( $desc != '' )
                        echo '<span class="description' . $field_class . '">' . $desc . '</span>';

                    echo '<br /><span id="slides-details-button"></span>';
                    echo '<ul id="slideshow_list">';

                    if ( $options['slider'] <> '' ) {

                        $slides = array();
                        foreach ($options[$id]['title'] as $k => $v) {
                            $slides[] = array(
                                'title' => $v,
                                'link' => $options[$id]['link'][$k],
                                'caption' => $options[$id]['caption'][$k],
                                'image' => $options[$id]['image'][$k]
                            );
                        }

                        $i = 1;
                        foreach ($slides as $slide) {
                            echo '<li class="slide">';
                            echo '<a class="editslideimage">edit</a>';
                            echo '<div class="image-details slidedetails">';
                            echo '<span class="description">' . __( 'Slide Title', 'icore' ) . '</span>';
                            echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . ']Fatal error: Switch statements may only contain one default clause (php7)[]" placeholder="' . $std . '" id="'. $id .'_title_'.$i.'"  value="'.$slide['title'].'" type="text" />';

                            echo '<span class="description">' . __( 'Slide Link', 'icore' ) . '</span>';
                            echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . ']https://stackoverflow.com/questions/44000568/fatal-error-switch-statements-may-only-contain-one-default-clause-php7[]" placeholder="' . $std . '" id="'. $id .'_title_'.$i.'"  value="'.$slide['link'].'" type="text" />';

                            echo '<span class="description">' . __( 'Slide Caption', 'icore' ) . '</span>';
                            echo '<textarea class="'.$field_class.'" name="' . $shortname_options . '[' . $id . '][]" id="'. $id .'_caption_'.$i.'" cols="40" rows="4">'.$slide['caption'].'</textarea>';

                            echo '<span class="description">' . __( 'Slide Image', 'icore' ) . '</span>';
                            echo '<input class="upload-input-text src" name="' . $shortname_options . '[' . $id . '][image][]" id="'. $id .'_image_'.$i.'" type="text" value="'.$slide['image'].'" type="text" />
                            <a href="'.get_option('siteurl').'/wp-admin/admin-ajax.php?action=choice&width=150&height=100" id="'.$id.'_button" class="button upbutton">' . __( 'Upload','InterStellar' ) . '</a>';
                            echo '<a class="doneslideimage">Done</a>';
                            echo '</div>';
                            echo '<div class="clear"></div><div class="upload-img-preview">';
                            if ( $slide['image'] != "" )
                            {
                                echo '<img class="upload-img-preview" id="image_'. $id .'_image_'.$i.'" src="'.$slide['image'].'" />';
                            }
                            echo '</div>';
                            echo '<a class="remove_slide submitdelete">' . __( 'Delete Slide', 'InterStellar' ) . '</a>';
                            echo '</li>';
                            $i++;
                        }

                    } else {
                        $i = 1;
                        echo '<li class="slide">';
                        echo '<span class="description">' . __( 'Slide Title', 'icore' ) . '</span>';
                        echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . ']Fatal error: Switch statements may only contain one default clause (php7)[]" placeholder="' . $std . '" id="'. $id .'_title_'.$i.'"  value="" type="text" />';

                        echo '<span class="description">' . __( 'Slide Link', 'icore' ) . '</span>';
                        echo '<input class="regular-text' . $field_class . '" name="' . $shortname_options . '[' . $id . ']https://stackoverflow.com/questions/44000568/fatal-error-switch-statements-may-only-contain-one-default-clause-php7[]" placeholder="' . $std . '" id="'. $id .'_title_'.$i.'"  value="" type="text" />';

                        echo '<span class="description">' . __( 'Slide Caption', 'icore' ) . '</span>';
                        echo '<textarea class="'.$field_class.'" name="' . $shortname_options . '[' . $id . '][]" id="'. $id .'_caption_'.$i.'" cols="40" rows="4"></textarea>';

                        echo '<span class="description">' . __( 'Slide Image', 'icore' ) . '</span>';
                        echo '<input class="upload-input-text src" name="' . $shortname_options . '[' . $id . '][image][]" id="'. $id .'_image_'.$i.'" type="text" value="" type="text" />
                        <a href="'.get_option('siteurl').'/wp-admin/admin-ajax.php?action=choice&width=150&height=100" id="'.$id.'_button" class="button upbutton">' . __( 'Upload', 'icore' ) . '</a>';

                        echo '<div class="clear"></div><div class="upload-img-preview">';
                        echo '</div>';
                        echo '<a class="remove_slide submitdelete">' . __( 'Delete Slide','InterStellar' ) . '</a>';
                        echo '</li>';
                    }

                    echo '</ul>';
                    break;

        }
    }

Related Solutions

Getting last modification date of a PostgreSQL database table

There is no reliable, authorative record of the last modified time of a table. Using the relfilenode is wrong for a lot of reasons: Writes are initially recorded to the write-head log (WAL), then lazily to the heap (the table files). Once the record is in WAL,...

How do I make this sed script a “one liner”?

An ANSI C string -- with $'' -- can contain backslash escapes, like \n -- so you can have a newline in sed's arguments while still having the shell command invoking sed be only one line. sed -i $'/INTERPRETER_PYTHON_DISTRO_MAP/,/version_added/ {\n /default/a\\...

How to OCR a PDF file and get the text stored within the PDF?

ocrmypdf does a good job and can be used like this: ocrmypdf in.pdf out.pdf To install: pip install ocrmypdf or sudo apt install ocrmypdf # ubuntu sudo dnf -y install ocrmypdf # fedora After learning that Tesseract can now also produce searchable PDFs, I found...

If …Else If wont work [closed]

First of all, put the javascript code between a <script></script> tag because javascript code will not run in an html <div></div> tag. Then, instead of x == 0||9||2, use x == 0 || x == 9 || x == 2. Kindly indent your code for easier...

How to convert the object of character to string

Your object of characters is already almost an array. It has numeric indices, but is missing the .length property. If you add that it, it will be an "array like" object, which can then be passed to Array.from to get a proper array. Once you have a real array,...

How can I write the approximate value of PI?

Because your { and } is wrong. I think brackets will be as given below If the formula is PI = 4/1 - 4/3 + 4/5 - 4/7 + ... ( Leibniz's Series ) then you can formalate as given below #include <iostream> using namespace std; int main() { double n, i; //...

c# Regex catch string between two string [duplicate]

You can try this: <[a-z\s]+id=[\'\"]mobile[\w]+[\'\"][\sa-zA-Z\d\'\=\;\:]*>([a-zA-Z\d\s]+)<[\/a-z\s]+> Anyway it will not match special chars or symbols. You can test and optimize it here: https://regex101.com/r/fnYQ1o/10 EDIT - Code example This...

Do I need CSRF token if I’m using Bearer JWT?

This is relevant but doesn't necessarily answer 100% of your question: https://security.stackexchange.com/a/166798/149676 The short of it is that as long as authentication isn't automatic (typically provided by the browser) then you don't have to worry about...

Java cannot find symbol during compiling

The problem is this line: System.out.println(pref); You have not defined pref in this scope. The field pref is only defined in main method but cannot be read outside of it and therefore outside your main method the pref field has to be defined as well. (You may...

HOW TO MAKE A DYNAMIC PROFILE PAGE? [closed]

Well, for such small tasks no CMS (I mean WP or Drupal) is necessarily needed - customizing one for your needs will me much more painful, than adding a few PHP lines to your HTML files. To make your website able to get data, you will have to make it perform...

Weird results in c [closed]

In addition to LihOs answer above this block looks wrong: if(tab1[i] != '\0') tab1[i]==result[i]; else if (tab2[i] !='\0') tab2[i]==result[i]; else printf(" "); Don't you mean to assign the value in tab1[i]or tab2[i] to result[i]like this? if(tab1[i] != '\0')...

Notepad in windows form application [closed]

This should demonstrate how to open Notepad and put text into it. This is a simple example of starting a Notepad process and then adding text to it. Will open a new Notepad.exe process and then add the text "Sending a message, a message from me to you" to the...

Check whether number is even or odd without using any operator

I think you are talking about no arithmetic operator In this case you can ask yourself, in binary what represents the least significant bit (bit 0)? So you can test that bit to know if a number is odd or even: if (number & 0x01) { // odd number } else { //...

What is the output of the program with reason?

See annotations: #include <stdio.h> void f(int *p, int *q) // p contains address of i, q contains address of j { p=q; // p now contains address of j *p=2; // assigns 2 to j, not i } int main() { int i=0,j=1; // i contains 0, j contains 1 f( &i, &j...

Relative imports for the billionth time

Script vs. Module Here's an explanation. The short version is that there is a big difference between directly running a Python file, and importing that file from somewhere else. Just knowing what directory a file is in does not determine what package Python...