Created
June 13, 2015 05:36
-
-
Save campg2j003/1dde510a6e752dc2a1a2 to your computer and use it in GitHub Desktop.
Fix for error in WordPress plugin enable-shortcode-and-php-support-in-text-widget v1.2.2 that fixes notices caused by undefined options.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- vendor\enable-shortcode-and-php-support-in-text-widget.php Fri Jun 12 10:58:00 2015 | |
+++ local\enable-shortcode-and-php-support-in-text-widget.php Fri Jun 12 22:05:16 2015 | |
@@ -1,18 +1,23 @@ | |
<?php | |
/* | |
Plugin Name: Enable Shortcode and PHP in Text widget | |
Plugin URI: http://w3guy.com/shortcode-php-support-wordpress-text-widget/ | |
Description: Enable shortcode support and execute PHP in WordPress's Text Widget | |
Author: Agbonghama Collins | |
- Version: 1.2.2 | |
+ Version: 1.2.2.1 | |
Author URI: http://w3guy.com | |
Text Domain: espw-plugin | |
Domain Path: /languages/ | |
+ Stable tag: 1.2.2 | |
+ */ | |
+ | |
+/* | |
+ 6/12/15 by campg2003@gmail.com: Added isset to test for options to keep nonexistent option errors from showing up on the page. | |
*/ | |
function espw_load_plugin_textdomain() { | |
load_plugin_textdomain( 'espw-plugin', false, basename( dirname( __FILE__ ) ) . '/languages/' ); | |
} | |
add_action( 'plugins_loaded', 'espw_load_plugin_textdomain' ); | |
@@ -143,23 +148,23 @@ | |
} | |
// register options | |
add_action( 'admin_init', 'espw_plugin_option' ); | |
$espw_options = get_option( 'espw_option' ); | |
-if ( $espw_options['shortcode'] ) { | |
+if ( isset($espw_options['shortcode']) && $espw_options['shortcode'] ) { | |
// shortcode support | |
add_filter( 'widget_text', 'do_shortcode' ); | |
} | |
-if ( $espw_options['php'] ) { | |
+if ( isset($espw_options['php']) && $espw_options['php'] ) { | |
// PHP support | |
function exam_plug_text_replace( $text ) { | |
ob_start(); | |
eval( '?>' | |
. $text ); | |
$text = ob_get_contents(); | |
ob_end_clean(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment