$element_help_text_debug = 'mcw_debug_helptext'; $description_backup = 'You can save or restore a backup of your widgets. ("' . $button_text_get_backup . '" will overwrite current Widgets.)'; $description_debug = 'Beta-Feature:<br> After activating the Debug-checkbox you will be able to see your widget splitted into code pieces, when using the preview functionality (<img src="' . MCW_get_url('preview') . '">).<br>' . 'This can help to find mistakes inside of your code. A split will be done whenever html-code changes to php-code and vice versa.<br><br>' . 'Known issues: <ul>' . '<li>The debugger is not able to handle "if" statements in combination with HTML-code.</li>' . '<li>Debugger will interpret each "<?php" and "?>" as a php-tag.</li>' . '</ul>'; // initialize technical variables unset($cache_widget); $meta = MCW_get_meta(); if ($meta['initial']) { $meta['initial'] = false; MCW_set_meta($meta); } if ($_POST[$hidden_field_submit] != 'Y') { $cache_all_widgets = MCW_get_all_widgets(); $my_options = MCW_get_option(); $options_are_empty = empty($my_options); if ($options_are_empty) { $my_options = MCW_get_default_options(); MCW_set_options($my_options); echo '<div id="message" class="updated fade"><p>Options have not been configured, yet. <br>Default values have been loaded. Click <a href="' . get_option('siteurl') . '/wp-admin/options-general.php?page=' . MCW_get_mainfile_name() . '">here »</a> to configure plugin.</p></div>'; } } else { /******************/ /*** set backup ***/ /******************/ if ($_POST[$element_widget_backup] == $button_text_set_backup) { if ($_POST[$data_widget_backup] != $data_widget_backup) { echo '<div id="message" class="updated fade"><p>To save backup you have to check the Backup-Checkbox as well.</p></div>'; } else { $cache_all_widgets = MCW_get_all_widgets(); MCW_set_widget_backup($cache_all_widgets); $max = count($cache_all_widgets); echo '<div id="message" class="updated fade"><p>Backup stored successfully.</p></div>';
/** * Creates the edit form for the widget. * */ function form($instance) { global $mcw_prefix; global $mcw_path; //if (!empty($instance)){ include_once MCW_get_url('style'); //} //Defaults $defaults = MCW_get_default_options(); $instance = wp_parse_args((array) $instance, array('title' => '', 'kind' => $defaults['std_kind'], 'name' => $this->id, 'filter-all' => 1)); $title = htmlspecialchars($instance['title']); echo '<div class="mcw-row-"><label for="' . $this->get_field_name('title') . '"><input type="text" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" value="' . $title . '" size="13" ></label></div>'; echo '<div class="mcw-row-small"><nobr><label for="' . $this->get_field_name('kind') . '_php"><input type="radio" id="' . $this->get_field_id('kind') . '_php" name="' . $this->get_field_name('kind') . '" value="php" checked="checked"> PHP</label></nobr>'; echo '<nobr><label for="' . $this->get_field_name('kind') . '_html"><input type="radio" id="' . $this->get_field_id('kind') . '_html" name="' . $this->get_field_name('kind') . '" value="html"' . MCW_check($instance['kind'], "html") . '> HTML</label></nobr></div><br>'; //echo '<div class="mcw-row">'.MCW_get_input_code($instance, $this).'</div>'; echo '<div class="mcw-row"><textarea cols="60" id="' . $this->get_field_id('code') . '" name="' . $this->get_field_name('code') . '" style="height:' . MCW_get_option('code_height') . 'px; font-family:Courier, Monaco, monospace;" >' . stripslashes($instance["code"]) . '</textarea><br></div>'; //echo '<div class="mcw-row-small">'.MCW_get_input_filters($instance, $this).'</div>'; $myfilteroptions = MCW_get_option('filters'); // get all filters if (empty($myfilteroptions)) { $myfilteroptions = array('all' => '1'); } $max = count($myfilteroptions); echo '<div class="mcw-row-small">'; for ($i = 0; $i < $max; ++$i) { echo '<nobr><label for="' . $this->get_field_id('filter' . '-' . $myfilteroptions[$i][0]) . '">'; echo '<input type="checkbox" id="' . $this->get_field_id('filter' . '-' . $myfilteroptions[$i][0]) . '" name="' . $this->get_field_name('filter' . '-' . $myfilteroptions[$i][0]) . '" value="1" '; echo MCW_check($instance['filter-' . $myfilteroptions[$i][0]], "1"); //active or not echo '> ' . $myfilteroptions[$i][0] . ' </label></nobr>'; } echo '</div>'; }
function MCW_include_option_page() { global $mcw_prefix; global $mcw_configoption; $mcw_options = MCW_get_default_options(); add_option($mcw_prefix . $mcw_configoption, $mcw_options, 'Options for My Custom Widgets - Plugin', true); include MCW_get_url('style'); //echo "<h2>My Custom Widget - Configuration</h2>"; include "my_custom_widget_configuration.php"; }
<p> <strong> <?php echo 'options have been saved'; ?> </strong> </p> </div> <?php } else { if ($_POST[$button_name_submit] == $button_text_reset) { if ($_POST[$data_options_reset] != $data_options_reset) { echo '<div id="message" class="updated fade"><p><strong> To reset you have to check the Reset-Checkbox as well.</strong></p></div>'; } else { //load Default Settings $cache_options = MCW_get_default_options(); if (empty($cache_options)) { ?> <div id="message" class="error fade"><p><strong><?php echo 'Settings have NOT been loaded.'; ?> </strong></p></div> <?php } else { MCW_set_options($cache_options); $javascript_is_allowed = $cache_options['allow_js'] == 'yes'; ?> <div id="message" class="updated fade"> <p> <strong> <?php