function control($options, $form_id, $postfixOptionKey = '', $postfixInternalName = '') { // Store settings for this widget // if ($_POST[$this->internalName . $postfixInternalName . '-submit']) { $newoptions = array(); $newoptions['path'] = $_POST['upload-files-path-' . $postfixInternalName]; $newoptions['types'] = $_POST['upload-files-types-' . $postfixInternalName]; $newoptions['size'] = intval($_POST['upload-files-size-' . $postfixInternalName]); $newoptions['min'] = intval($_POST['upload-files-min-' . $postfixInternalName]); $newoptions['max'] = intval($_POST['upload-files-max-' . $postfixInternalName]); $newoptions['cmd'] = $_POST['upload-files-cmd-' . $postfixInternalName]; $newoptions['attach'] = isset($_POST['upload-files-attach-' . $postfixInternalName]); $newoptions['a'] = isset($_POST['upload-files-a-' . $postfixInternalName]); $newoptions['img'] = isset($_POST['upload-files-img-' . $postfixInternalName]); $newoptions['custom'] = isset($_POST['upload-files-custom-' . $postfixInternalName]); $newoptions['custom-key'] = $_POST['upload-files-custom-key-' . $postfixInternalName]; $newoptions['post-title'] = isset($_POST['upload-files-post-title-' . $postfixInternalName]); $newoptions['attach-a'] = isset($_POST['upload-files-attach-a-' . $postfixInternalName]); $newoptions['attach-thumb-a'] = isset($_POST['upload-files-attach-thumb-a-' . $postfixInternalName]); $newoptions['thumb-a'] = isset($_POST['upload-files-thumb-a-' . $postfixInternalName]); $newoptions['url'] = $_POST['upload-files-url-' . $postfixInternalName]; $newoptions['nohandler'] = isset($_POST['upload-files-nohandler-' . $postfixInternalName]); $options = wp_parse_args($newoptions, $options, $postfixOptionKey); $this->updateOptions($options, $form_id, $postfixOptionKey); } // Display control panel for this widget // extract($options); ?> <div> <p style="text-align:left;"> <?php $this->controlCommon($options, $postfixOptionKey); ?> <label for="upload-files-path-<?php echo $postfixInternalName; ?> " ><?php _e("Path to store uploads (should not be publically accessible):", "tdomf"); ?> <br/> <input type="textfield" size="40" id="upload-files-path-<?php echo $postfixInternalName; ?> " name="upload-files-path-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['path'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> </label><br/><br/> <label for="upload-files-types-<?php echo $postfixInternalName; ?> " ><?php _e("Allowed File Types:", "tdomf"); ?> <br/> <input type="textfield" size="40" id="upload-files-types-<?php echo $postfixInternalName; ?> " name="upload-files-types-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['types'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> </label><br/><br/> <label for="upload-files-post-title-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-post-title-<?php echo $postfixInternalName; ?> " id="upload-files-post-title-<?php echo $postfixInternalName; ?> " <?php if ($options['post-title']) { echo "checked"; } ?> > <?php _e("Use filename as post title (as long as the content widget doesn't set it)", "tdomf"); ?> </label><br/><br/> <label for="upload-files-size-<?php echo $postfixInternalName; ?> "> <input type="textfield" name="upload-files-size-<?php echo $postfixInternalName; ?> " id="upload-files-size-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['size'], ENT_QUOTES, get_bloginfo('charset')); ?> " size="10" /> <?php printf(__("Max File Size in bytes. Example: 1024 = %s, 1048576 = %s", "tdomf"), tdomf_filesize_format(1024), tdomf_filesize_format(1048576)); ?> </label><br/><br/> <input type="textfield" name="upload-files-min-<?php echo $postfixInternalName; ?> " id="upload-files-min-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['min'], ENT_QUOTES, get_bloginfo('charset')); ?> " size="2" /> <label for="upload-files-min-<?php echo $postfixInternalName; ?> "><?php _e("Minimum File Uploads <i>(0 indicates file uploads optional)</i>", "tdomf"); ?> </label><br/> <input type="textfield" name="upload-files-max-<?php echo $postfixInternalName; ?> " id="upload-files-max-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['max'], ENT_QUOTES, get_bloginfo('charset')); ?> " size="2" /> <label for="upload-files-max-<?php echo $postfixInternalName; ?> "><?php _e("Maximum File Uploads", "tdomf"); ?> </label><br/> <br/> <label for="upload-files-nohandler-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-nohandler-<?php echo $postfixInternalName; ?> " id="upload-files-nohandler-<?php echo $postfixInternalName; ?> " <?php if ($options['nohandler']) { echo "checked"; } ?> > <?php _e("Do not use TDOMF handler for URL of download", "tdomf"); ?> </label><br/> <label for="upload-files-url-<?php echo $postfixInternalName; ?> " ><?php _e("URL of uploaded file area:", "tdomf"); ?> <br/> <input type="textfield" size="40" id="upload-files-url-<?php echo $postfixInternalName; ?> " name="upload-files-url-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['url'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> </label> <br/><br/> <label for="upload-files-cmd-<?php echo $postfixInternalName; ?> " ><?php _e("Command to execute on file after file uploaded successfully (result will be added to log). Leave blank to do nothing:", "tdomf"); ?> <br/> <input type="textfield" size="40" id="upload-files-cmd-<?php echo $postfixInternalName; ?> " name="upload-files-cmd-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['cmd'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> </label><br/><br/> <label for="upload-files-attach-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-attach-<?php echo $postfixInternalName; ?> " id="upload-files-attach-<?php echo $postfixInternalName; ?> " <?php if ($options['attach']) { echo "checked"; } ?> > <?php _e("Insert Uploaded Files as Attachments on post (this will also generate a thumbnail using Wordpress core if upload is an image)", "tdomf"); ?> </label><br/> <label for="upload-files-attach-a"> <input type="checkbox" name="upload-files-attach-a-<?php echo $postfixInternalName; ?> " id="upload-files-attach-a-<?php echo $postfixInternalName; ?> " <?php if ($options['attach-a']) { echo "checked"; } ?> > <?php _e("Add link to Attachment page to post content", "tdomf"); ?> </label><br/> <label for="upload-files-attach-thumb-a-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-attach-thumb-a-<?php echo $postfixInternalName; ?> " id="upload-files-attach-thumb-a-<?php echo $postfixInternalName; ?> " <?php if ($options['attach-thumb-a']) { echo "checked"; } ?> > <?php _e("Add thumbnail link to Attachment page to post content (if thumbnail avaliable)", "tdomf"); ?> </label><br/> <label for="upload-files-thumb-a-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-thumb-a-<?php echo $postfixInternalName; ?> " id="upload-files-thumb-a-<?php echo $postfixInternalName; ?> " <?php if ($options['thumb-a']) { echo "checked"; } ?> > <?php _e("Add thumbnail as download link to post content (if thumbnail avaliable)", "tdomf"); ?> </label><br/> <br/> <label for="upload-files-a-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-a-<?php echo $postfixInternalName; ?> " id="upload-files-a-<?php echo $postfixInternalName; ?> " <?php if ($options['a']) { echo "checked"; } ?> > <?php _e("Add download link to post content", "tdomf"); ?> </label><br/> <label for="upload-files-img-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-img-<?php echo $postfixInternalName; ?> " id="upload-files-img-<?php echo $postfixInternalName; ?> " <?php if ($options['img']) { echo "checked"; } ?> > <?php _e("Add download link as image tag to post content", "tdomf"); ?> </label><br/> <br/> <label for="upload-files-custom-<?php echo $postfixInternalName; ?> "> <input type="checkbox" name="upload-files-custom-<?php echo $postfixInternalName; ?> " id="upload-files-custom-<?php echo $postfixInternalName; ?> " <?php if ($options['custom']) { echo "checked"; } ?> > <?php _e("Add Download Link as custom value", "tdomf"); ?> </label><br/> <label for="upload-files-custom-key-<?php echo $postfixInternalName; ?> " ><?php _e("Name of Custom Key:", "tdomf"); ?> <br/> <input type="textfield" size="40" id="upload-files-custom-key-<?php echo $postfixInternalName; ?> " name="upload-files-custom-key-<?php echo $postfixInternalName; ?> " value="<?php echo htmlentities($options['custom-key'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> </label> </p> </div> <?php }
?> <br/> </small></p> <?php } ?> <?php for ($i = 0, $j = 0; $i < $options['max']; $i++) { if (isset($mysessionfiles[$i])) { ?> <input type='hidden' name='deletefile[]' value="<?php echo $i; ?> " /> <?php printf(__("<i>%s</i> (%s) Uploaded", "tdomf"), $mysessionfiles[$i]['name'], tdomf_filesize_format($mysessionfiles[$i]['size'])); ?> <br/> <?php } else { if ($sessioncount + $j < $options['min']) { ?> <label for='uploadfile<?php echo $form_id; ?> _<?php echo $index; ?> _<?php echo $i; ?>