[Plugin: Shortcoder] PHP Notices after enabling the plugin
-
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>'; }
- The topic ‘[Plugin: Shortcoder] PHP Notices after enabling the plugin’ is closed to new replies.