function widget($args, $instance) { extract($args, EXTR_SKIP); $title = $instance['title'] ? $instance['title'] : "Subscirbe via E-Mail"; //there will be any output only if the corresponding subscription form exists. //generate an output only if the subscription form exists. if (!($subscriptionForm = _wpr_subscriptionform_get($instance['the_form']))) { return false; } echo '<span class="wprsf">'; echo $before_widget; echo '<span class="wprsfbt">'; echo $before_title; echo esc_html($instance['title']); echo $after_title; echo '</span>'; echo '<span class="wprsf-beforeform">'; echo $instance['before_form']; echo '</span>'; echo '<span class="wprsf-theform">'; echo _wpr_subscriptionform_code($subscriptionForm, true); echo '</span>'; echo '<span class="wprsf-afterform">'; echo $instance['after_form']; echo '</span>'; echo $after_widget; echo '</span>'; }
function _wpr_subscriptionform_getcode($form, $title) { ?> <div class="wrap"> <h2><?php echo $title; ?> </h2> The form has been saved. <h3>Now place the subscription form in the sidebar to start gathering subscribers.</h3> <a href="widgets.php"><img src="<?php echo get_bloginfo("url"); ?> /?wpr-file=widget-help.png" title="Click to go to Widgets Section" border="0"/></a> <h3>Click on image to go to Widgets Section</h3> <h2>Alternatively...</h2> Copy and paste the code in the box below on the page where you want the subscription form to appear. <h3>Form Code:</h3> <?php $code = _wpr_subscriptionform_code($form); ?> <textarea rows="20" cols="70" id="wpr_code"><?php echo $code; ?> </textarea> <br /> <div style="display:none" id="preview"> <?php echo $code; ?> </div> <script> var preview; function preview() { preview = window.open('about:blank','previewWindow','top=20,left=20,width=300,height=500'); preview.document.write(document.getElementById('preview').innerHTML); } </script> <a href="admin.php?page=wpresponder/subscriptionforms.php" class="button">« Back To Forms</a> <input type="button" value="Select All" onclick="document.getElementById('wpr_code').select();" class="button"/> <input type="button" onclick="preview();" value="Preview" class="button" /> </div> <?php }