WordPress.org

Ready to get started?Download WordPress

Forums

Shortcoder
PHP Notices after enabling the plugin (1 post)

  1. aaemnnosttv
    Member
    Posted 1 year ago #

    Love the plugin. It seems there are some loose ends that could be quickly fixed.

    NOTICE: C:\xampp\htdocs\wordpress\wp-content\plugins\shortcoder\shortcoder.php:231 - Undefined variable: edit
    NOTICE: C:\xampp\htdocs\wordpress\wp-content\plugins\shortcoder\shortcoder.php:234 - Undefined variable: sc_name_edit

    Because you're using comparison logic on the variable without checking if it exists, the variable should be set either way in the logic that is defining it.

    if($_POST["sc_form_action"] == "edit"){
    			$sc_content = stripslashes($sc_options[$sc_name_edit]['content']);
    			$sc_disable = $sc_options[$sc_name_edit]['disabled'];
    			$sc_hide_admin = $sc_options[$sc_name_edit]['hide_admin'];
    
    			$title = "Edit this Shortcode - " . '<small>' . $sc_name_edit . '</small>';
    			$button = "Update Shortcode";
    			$edit = 1;
    		}else{
    			unset($sc_options[$sc_name_edit]);
    			unset($sc_name_edit);
    			update_option("shortcoder_data", $sc_options);
    			echo '<div class="message updated fade"><p>' . __('Shortcode deleted successfully !', 'sc') . '</p></div>';
    		}

    for example, you could change it like this:

    }else{
    	$edit = 0;
    	unset($sc_options[$sc_name_edit]);
    	unset($sc_name_edit);
    	update_option("shortcoder_data", $sc_options);
    	echo '<div class="message updated fade"><p>' . __('Shortcode deleted successfully !', 'sc') . '</p></div>';
    }

    http://wordpress.org/extend/plugins/shortcoder/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.