function MCW_get_all_widgets() { //2.0 compatible global $mcw_prefix; global $mcw_widgetsoption; global $mcw_all_widgets; if (empty($mcw_all_widgets)) { $mcw_all_widget_IDs = get_option($mcw_prefix . $mcw_widgetsoption); $mcw_all_widget_IDs = MCW_sort_my_elements($mcw_all_widget_IDs, 'name'); $max = count($mcw_all_widget_IDs); //$mcw_all_widgets = $mcw_all_widget_IDs; // if not updated yet for ($i = 0; $i < $max; ++$i) { $single_widget = MCW_get_mywidget_by_name($mcw_all_widget_IDs[$i]['name']); if (empty($single_widget)) { // if not updated yet //Move widgets to own db-entry MCW_swap_widgetdata($i); $mcw_all_widgets[$i] = $mcw_all_widget_IDs[$i]; } else { $mcw_all_widgets[$i] = $single_widget; } } } return $mcw_all_widgets; }
if (MCW_widget_already_exist($cache_widget['name'])) { echo '<div class="error"><p><b>Widget-ID allready exist!</b></p></div>'; } else { $error_message = MCW_add_mywidget($cache_widget); if ($error_message != '') { ?> <div id="message" class="error"> <p><b><?php echo $error_message; ?> </b></p> </div> <?php } $cache_all_widgets[] = $cache_widget; $cache_all_widgets = MCW_sort_my_elements($cache_all_widgets, 'name'); echo '<div id="message" class="updated fade"><p><strong>New custom-widget "' . $cache_widget['name'] . '" created.</strong></p></div>'; $help_plausi_failed = MCW_plausibility_check($cache_widget); if ($help_plausi_failed) { echo '<div id="' . $element_widget_warning . '" class="error" ><p><b>Code did not pass the plausibility check. Please review your code!</b> <br><i>(' . $help_plausi_failed . ')</i></p></div>'; } $cache_widget = array(); } } } } $backup_available = MCW_get_widget_backup(); //print_r($backup_available); $backup_available = !empty($backup_available[0]); $javascript_is_allowed = MCW_get_option('allow_js'); if (empty($cache_widget)) {
<strong> <?php echo 'Filter "' . $add_cache[0] . '" added'; ?> </strong> </p> </div> <?php $add_cache = array(); } } } } } } $cache_filters = MCW_sort_my_elements($cache_options['filters']); $max_filters = count($cache_filters); /**************************/ /*** remove all widgets ***/ /*** remove all options ***/ /**************************/ if ($_POST[$button_name_submit] == $button_text_deinstall) { if ($_POST[$data_options_deinstall] != $data_options_deinstall) { echo '<div id="message" class="updated fade"><p><strong> For Deinstallation you have to check the Deinstall-Checkbox.</strong></p></div>'; } else { $max_widgets = count(MCW_get_all_widget_IDs()); MCW_deinstall(); echo '<div id="message" class="updated fade"><p><b> All ' . $max_widgets . ' custom-widgets have been removed.</b> <br><b> All options for MyCustomWidgets have been removed.</b> <br>To to deactivate plugin click <a href=' . get_option('siteurl') . '/wp-admin/plugins.php >here »</a></p></div>'; } } $backup_available = MCW_get_option_backup();