enable everywhere and make false if found! if (($showcategory == "denied")) { $show_widget = true; foreach((get_the_category()) as $cat) { if ((in_array($cat->cat_ID , $categorieslist))) $show_widget = false; } } // Allow list -> false is the default -> enable if found if (($showcategory == "allow")) foreach((get_the_category()) as $cat) { if ((in_array($cat->cat_ID , $categorieslist))) $show_widget = true; } // All categories -> if it's not the home -> enable if (($showcategory == "all")) if ((is_home() != true)) $show_widget = true; // Home page -> If yes -> enable if (($showinhome == "yes")) if ((is_home())) $show_widget = true; // here comes the display (v.08) // These lines generate our output. Widgets can be very complex // but as you can see here, they can also be very, very simple. $url_parts = parse_url(get_bloginfo('home')); // Null parameters check if ( ($number == '') ) $number = 1; if ( ($sizeX == '') ) $sizeX = 190; if ( ($sizeY == '') ) $sizeY = 190; // if ( ($border == '') ) $border = 0; // if ( ($bordercolor == '') ) $bordercolor = "#dadada"; // if ( ($margin == '') ) $margin = 5; if ($show_widget) { echo $before_widget . $before_title . $title . $after_title; echo "\n".'
'."\n"; } echo ''."\n"; echo ''."\n"; echo $after_widget; } } /** * @desc Output of pluginīs editform in te adminarea * @author KeViN */ function widget_nextgenimage_control($number=1) { $options = get_option('widget_NextGenimage'); if ( !is_array($options) ) $options = array('title'=>'', 'buttontext'=>__('NextGEN Random Image','nggallery')); if ( $_POST['nextgen-submit'] ) { // Remember to sanitize and format use input appropriately. $options = ""; $options['title'] = strip_tags(stripslashes($_POST['nextgen-title'])); $options['number'] = strip_tags(stripslashes($_POST['nextgen-number'])); $options['sizeX'] = /* 90; */ strip_tags(stripslashes($_POST['nextgen-sizeX'])); $options['sizeY'] = /* 90; */ strip_tags(stripslashes($_POST['nextgen-sizeY'])); $options['mode'] = /* "web20" ; */ strip_tags(stripslashes($_POST['nextgen-mode'])); // $options['border'] = strip_tags(stripslashes($_POST['nextgen-border'])); // $options['bordercolor'] = strip_tags(stripslashes($_POST['nextgen-bordercolor'])); // $options['margin'] = strip_tags(stripslashes($_POST['nextgen-margin'])); // Category controll (v0.8b) $options['showinhome'] = strip_tags(stripslashes($_POST['nextgen-showinhome'])); $options['showcategory'] = strip_tags(stripslashes($_POST['nextgen-showcategory'])); $options['categorylist'] = strip_tags(stripslashes($_POST['nextgen-categorylist'])); update_option('widget_NextGenimage', $options); } // Be sure you format your options to be valid HTML attributes. $title = htmlspecialchars($options['title'], ENT_QUOTES); $number = htmlspecialchars($options['number'], ENT_QUOTES); $sizeX = htmlspecialchars($options['sizeX'], ENT_QUOTES); $sizeY = htmlspecialchars($options['sizeY'], ENT_QUOTES); $mode = htmlspecialchars($options['mode'], ENT_QUOTES); // $border = htmlspecialchars($options['border'], ENT_QUOTES); // $bordercolor = htmlspecialchars($options['bordercolor'], ENT_QUOTES); // $margin = htmlspecialchars($options['margin'], ENT_QUOTES); $showinhome = htmlspecialchars($options['showinhome'], ENT_QUOTES); $showcategory = htmlspecialchars($options['showcategory'], ENT_QUOTES); $categorylist = htmlspecialchars($options['categorylist'], ENT_QUOTES); // Here comes the form echo''; echo ''; echo ''; echo ''; echo ''; // moved to CSS file // echo ''; // echo ''; // echo ''; // v0.8 - category control echo ''; echo ''; echo ''; echo ''; } // This registers our widget so it appears with the other available // widgets and can be dragged and dropped into any active sidebars. register_sidebar_widget(array('NextGEN Random Image', 'widgets'), 'widget_nextgenimage'); register_widget_control(array('NextGEN Random Image', 'widgets'), 'widget_nextgenimage_control', 300, 400); } // Run our code later in case this loads prior to any required plugins. add_action('widgets_init', 'widget_nextgenimage_init'); ?>