function tdomf_widget_notifyme_hack_messages($form_id, $mode) { $widget_order = tdomf_get_widget_order($form_id); if (in_array('notifyme', $widget_order) && tdomf_get_option_form(TDOMF_OPTION_MODERATION, $form_id)) { if (isset($_REQUEST['tdomf_hack_messages_save'])) { #if (get_magic_quotes_gpc()) { $options = array('approved' => stripslashes($_REQUEST['tdomf_widget_notifyme_msg_approved']), 'rejected' => stripslashes($_REQUEST['tdomf_widget_notifyme_msg_rejected']), 'approved_subject' => stripslashes($_REQUEST['tdomf_widget_notifyme_msg_approved_subject']), 'rejected_subject' => stripslashes($_REQUEST['tdomf_widget_notifyme_msg_rejected_subject'])); #} else { # $options = array( 'approved' => $_REQUEST['tdomf_widget_notifyme_msg_approved'], # 'rejected' => $_REQUEST['tdomf_widget_notifyme_msg_rejected'], # 'approved_subject' => $_REQUEST['tdomf_widget_notifyme_msg_approved_subject'], # 'rejected_subject' => $_REQUEST['tdomf_widget_notifyme_msg_rejected_subject'] ); #} tdomf_set_option_widget('notifyme', $options, $form_id); } else { if (isset($_REQUEST['tdomf_hack_messages_reset'])) { tdomf_set_option_widget('notifyme', false, $form_id); } } ?> <h3><?php _e('Submission Approved Email', 'tdomf'); ?> </h3> <input type="textfield" name="tdomf_widget_notifyme_msg_approved_subject" id="tdomf_widget_notifyme_msg_approved_subject" size="70" value="<?php echo htmlentities(tdomf_widget_notify_get_message($form_id, 'approved_subject'), ENT_QUOTES, get_bloginfo('charset')); ?> " /> <textarea title="true" rows="5" cols="70" name="tdomf_widget_notifyme_msg_approved" id="tdomf_widget_notifyme_msg_approved" ><?php echo htmlentities(tdomf_widget_notify_get_message($form_id, 'approved'), ENT_NOQUOTES, get_bloginfo('charset')); ?> </textarea> <br/><br/> <h3><?php _e('Submission Rejected Email', 'tdomf'); ?> </h3> <input type="textfield" name="tdomf_widget_notifyme_msg_rejected_subject" id="tdomf_widget_notifyme_msg_rejected_subject" size="70" value="<?php echo htmlentities(tdomf_widget_notify_get_message($form_id, 'rejected_subject'), ENT_QUOTES, get_bloginfo('charset')); ?> " /> <textarea title="true" rows="5" cols="70" name="tdomf_widget_notifyme_msg_rejected" id="tdomf_widget_notifyme_msg_rejected" ><?php echo htmlentities(tdomf_widget_notify_get_message($form_id, 'rejected'), ENT_NOQUOTES, get_bloginfo('charset')); ?> </textarea> <br/><br/> <?php } }
function tdomf_widget_tags_control($form_id) { $options = tdomf_widget_tags_options($form_id); // Store settings for this widget if ($_POST['tags-submit']) { $newoptions['title'] = strip_tags(stripslashes($_POST['tags-title'])); $newoptions['required'] = isset($_POST['tags-required']); $newoptions['user'] = isset($_POST['tags-user']); $newoptions['default'] = $_POST['tags-default']; if ($options != $newoptions) { $options = $newoptions; tdomf_set_option_widget('tdomf_tags_widget', $options, $form_id); } } // Display control panel for this widget extract($options); ?> <div> <label for="tags-title" style="line-height:35px;"><?php _e("Title: ", "tdomf"); ?> </label> <input type="textfield" id="tags-title" name="tags-title" value="<?php echo htmlentities($options['title'], ENT_QUOTES, get_bloginfo('charset')); ?> " /></label> <br/> <input type="checkbox" name="tags-user" id="tags-user" <?php if ($options['user']) { echo "checked"; } ?> > <label for="tags-user" style="line-height:35px;"><?php _e("Allow the submitter to add tags to the submission", "tdomf"); ?> </label> <br/> <input type="checkbox" name="tags-required" id="tags-required" <?php if ($options['required']) { echo "checked"; } ?> > <label for="tags-required" style="line-height:35px;"><?php _e("The submitter must supply at least one tag", "tdomf"); ?> </label> <br/> <label for="tags-title" style="line-height:35px;"><?php _e("Default Tags: ", "tdomf"); ?> </label><br/> <small><?php _e("These tags will be added to any post submitted using this form. Separate multiple tags with commas: cats, pet food, dogs", "tdomf"); ?> </small><br/> <input type="textfield" id="tags-default" name="tags-default" size='40' value="<?php echo htmlentities($options['default'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> </div> <?php }
/** * Updates options for this widget * * @access public */ function updateOptions($options, $form_id, $postfix = '') { $options = tdomf_set_option_widget($this->optionKey . $postfix, $options, $form_id); }
function tdomf_widget_comments_control($form_id) { $options = tdomf_widget_comments_get_options($form_id); // Store settings for this widget if ($_POST['excerpt-submit']) { $newoptions['title'] = strip_tags(stripslashes($_POST['comments-title'])); $newoptions['overwrite'] = isset($_POST['comments-overwrite']); $newoptions['comments'] = isset($_POST['comments-comments']); $newoptions['pings'] = isset($_POST['comments-pings']); $newoptions['user-comments'] = isset($_POST['comments-user-comments']); $newoptions['user-pings'] = isset($_POST['comments-user-pings']); if ($options != $newoptions) { $options = $newoptions; tdomf_set_option_widget('tdomf_comment_widget', $options, $form_id); } } // Display control panel for this widget extract($options); ?> <div> <label for="comments-title" style="line-height:35px;display:block;"><?php _e("Title: ", "tdomf"); ?> <input type="textfield" id="comments-title" name="comments-title" value="<?php echo htmlentities($options['title'], ENT_QUOTES, get_bloginfo('charset')); ?> " /></label> <br/> <label for="overwrite" style="line-height:35px;"><b><?php _e("Overwrite Default Settings", "tdomf"); ?> </b></label> <input type="checkbox" name="comments-overwrite" id="comments-overwrite" <?php if ($options['overwrite']) { echo "checked"; } ?> > <br/> <small><?php _e("You can overwrite the default settings for comments pings for any submission from this form by enabling this option and setting defaults below", "tdomf"); ?> </small> <br/> <input type="checkbox" name="comments-comments" id="comments-comments" <?php if ($options['comments']) { echo "checked"; } ?> > <label for="overwrite" style="line-height:35px;"><?php _e("Allow Comments on Submission", "tdomf"); ?> </label> <br/> <input type="checkbox" name="comments-pings" id="comments-pings" <?php if ($options['pings']) { echo "checked"; } ?> > <label for="overwrite" style="line-height:35px;"><?php _e("Allow Pings and Trackbacks on Submission", "tdomf"); ?> </label> <br/><br/> <small><?php _e("Use these options to allow submitters to set if they want comments or pings on their submission. This will overwrite any other configuration.", "tdomf"); ?> </small> <br/> <input type="checkbox" name="comments-user-comments" id="comments-user-comments" <?php if ($options['user-comments']) { echo "checked"; } ?> > <label for="overwrite" style="line-height:35px;"><?php _e("Submitter can choose to allow Comments", "tdomf"); ?> </label> <br/> <input type="checkbox" name="comments-user-pings" id="comments-user-pings" <?php if ($options['user-pings']) { echo "checked"; } ?> > <label for="overwrite" style="line-height:35px;"><?php _e("Submitter can choose to allow Pings and Trackbacks", "tdomf"); ?> </label> </div> <?php }
function tdomf_widget_categories_control($form_id, $params) { $number = 1; if (is_array($params) && count($params) >= 1) { $number = $params[0]; } $options = tdomf_widget_categories_get_options($number, $form_id); $postfix1 = ""; $postfix2 = ""; if ($number != 1) { $postfix1 = "-{$number}"; $postfix2 = "_{$number}"; } // Store settings for this widget if ($_POST["categories{$postfix1}-submit"]) { $newoptions['title'] = strip_tags($_POST["categories{$postfix1}-title"]); $newoptions['overwrite'] = isset($_POST["categories{$postfix1}-overwrite"]); $newoptions['multi'] = isset($_POST["categories{$postfix1}-multi"]); $newoptions['hierarchical'] = isset($_POST["categories{$postfix1}-hierarchical"]); $newoptions['include'] = str_replace(' ', '', strip_tags($_POST["categories{$postfix1}-include"])); $newoptions['exclude'] = str_replace(' ', '', strip_tags($_POST["categories{$postfix1}-exclude"])); $newoptions['display'] = $_POST["categories{$postfix1}-display"]; $newoptions['order'] = $_POST["categories{$postfix1}-order"]; $newoptions['orderby'] = $_POST["categories{$postfix1}-orderby"]; if ($options != $newoptions) { $options = $newoptions; tdomf_set_option_widget('tdomf_categories_widget' . $postfix2, $options, $form_id); } } // Display control panel for this widget ?> <div> <p>A number of fields are disabled as they have not yet been implemented. They will be implemented in later releases of TDO Mini Forms</p> <label for="categories<?php echo $postfix1; ?> -title" > <?php _e("Title:", "tdomf"); ?> <br/></label> <input type="text" size="40" id="categories<?php echo $postfix1; ?> -title" name="categories<?php echo $postfix1; ?> -title" value="<?php echo htmlentities($options['title'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> <br/><br/> <input type="checkbox" name="categories<?php echo $postfix1; ?> -overwrite" id="categories<?php echo $postfix1; ?> -overwrite" <?php if ($options['overwrite']) { ?> checked <?php } ?> /> <label for="categories<?php echo $postfix1; ?> -overwrite"> <?php _e("Overwrite Default Categories", "tdomf"); ?> </label> <br/><br/> <input type="checkbox" name="categories<?php echo $postfix1; ?> -multi" id="categories<?php echo $postfix1; ?> -multi" <?php if ($options['multi']) { ?> checked <?php } ?> /> <label for="categories<?php echo $postfix1; ?> -multi"> <?php _e("Allow users to select more than one category", "tdomf"); ?> </label> <br/><br/> <input type="checkbox" name="categories<?php echo $postfix1; ?> -hierarchical" id="categories<?php echo $postfix1; ?> -hierarchical" <?php if ($options['hierarchical']) { ?> checked <?php } ?> /> <label for="categories<?php echo $postfix1; ?> -hierarchical"> <?php _e("Display categories in hierarchical mode", "tdomf"); ?> </label> <br/><br/> <label for="categories<?php echo $postfix1; ?> -include" > <?php _e("List of categories to include (leave blank for all) (separate multiple categories with commas: 0,2,3) (overwrites exclude setting)", "tdomf"); ?> <br/></label> <input type="text" size="40" id="categories<?php echo $postfix1; ?> -include" name="categories<?php echo $postfix1; ?> -include" value="<?php echo htmlentities($options['include'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> <br/><br/> <label for="categories<?php echo $postfix1; ?> -exclude" > <?php _e("List of categories to exclude (separate multiple categories with commas: 0,2,3)", "tdomf"); ?> <br/></label> <input type="text" size="40" id="categories<?php echo $postfix1; ?> -exclude" name="categories<?php echo $postfix1; ?> -exclude" value="<?php echo htmlentities($options['exclude'], ENT_QUOTES, get_bloginfo('charset')); ?> " /> <br/><br/> <label for="categories<?php echo $postfix1; ?> -orderby" > <?php _e("How the list of categories should be ordered", 'tdomf'); ?> <br/></label> <input type="radio" name="categories<?php echo $postfix1; ?> -orderby" id="categories<?php echo $postfix1; ?> -orderby" value="ID" <?php if ($options['orderby'] == 'ID') { ?> checked <?php } ?> ><?php _e("ID", "tdomf"); ?> <br> <input type="radio" name="categories<?php echo $postfix1; ?> -orderby" id="categories<?php echo $postfix1; ?> -orderby" value="name" <?php if ($options['orderby'] == 'name') { ?> checked <?php } ?> ><?php _e("Name", "tdomf"); ?> <br> <br/> <label for="categories<?php echo $postfix1; ?> -order" > <?php _e("How the list of categories should be sorted", 'tdomf'); ?> <br/></label> <input type="radio" name="categories<?php echo $postfix1; ?> -order" id="categories<?php echo $postfix1; ?> -order" value="asc" <?php if ($options['order'] == 'asc') { ?> checked <?php } ?> ><?php _e("Ascending order", "tdomf"); ?> <br> <input type="radio" name="categories<?php echo $postfix1; ?> -order" id="categories<?php echo $postfix1; ?> -order" value="desc" <?php if ($options['order'] == 'desc') { ?> checked <?php } ?> ><?php _e("Descending order", "tdomf"); ?> <br> <br/> <label for"categories<?php echo $postfix1; ?> -display"> <?php _e("Display categtories as:", "tdomf"); ?> <br/></label> <input type="radio" name="categories<?php echo $postfix1; ?> -display" id="categories<?php echo $postfix1; ?> -display" value="dropdown" <?php if ($options['display'] == 'dropdown') { ?> checked <?php } ?> ><?php _e("Dropdown", "tdomf"); ?> <br> <input type="radio" name="categories<?php echo $postfix1; ?> -display" id="categories<?php echo $postfix1; ?> -display" value="list" <?php if ($options['display'] == 'list') { ?> checked <?php } ?> ><?php _e("List", "tdomf"); ?> <br> <input type="radio" name="categories<?php echo $postfix1; ?> -display" id="categories<?php echo $postfix1; ?> -display" value="checkbox" <?php if ($options['display'] == 'checkbox') { ?> checked <?php } ?> ><?php _e("Checkboxes", "tdomf"); ?> <br> <br/><br/> </div> <?php }
function tdomf_copy_form($form_id) { global $wp_roles, $wpdb; $table_name = $wpdb->prefix . TDOMF_DB_TABLE_WIDGETS; // Copy form options // $form_name = sprintf(__("Copy of %s", "tdomf"), tdomf_get_option_form(TDOMF_OPTION_NAME, $form_id)); $form_to_copy_options = tdomf_get_options_form($form_id); if (empty($form_to_copy_options)) { return 0; } $options = wp_parse_args($options, $form_to_copy_options); $copied_form_id = tdomf_create_form($form_name, $options); // Reset the "created pages" option // tdomf_set_option_form(TDOMF_OPTION_CREATEDPAGES, false, $copied_form_id); //Copy widget options // $query = "SELECT * \n FROM {$table_name} \n WHERE form_id = '" . $wpdb->escape($form_id) . "'"; $widgets = $wpdb->get_results($query); foreach ($widgets as $widget) { tdomf_set_option_widget($widget->widget_key, maybe_unserialize($widget->widget_value), $copied_form_id); } // Copy capablities // if ($copied_form_id != 0) { if (!isset($wp_roles)) { $wp_roles = new WP_Roles(); } $roles = $wp_roles->role_objects; foreach ($roles as $role) { if (isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM . '_' . $form_id])) { $role->add_cap(TDOMF_CAPABILITY_CAN_SEE_FORM . '_' . $copied_form_id); } } } return $copied_form_id; }
function tdomf_widget_subscribe_to_comments_control($form_id) { $options = tdomf_widget_subscribe_to_comments_get_options($form_id); // Store settings for this widget if ($_POST['subscribe_to_comments-submit']) { $newoptions['title'] = strip_tags(stripslashes($_POST['subscribe_to_comments-title'])); $newoptions['show_email_field'] = isset($_POST['subscribe_to_comments-show_email_field']); $newoptions['always_subscribe'] = isset($_POST['subscribe_to_comments-always_subscribe']); if ($options != $newoptions) { $options = $newoptions; tdomf_set_option_widget('tdomf_subscribe_to_comments_widget', $options, $form_id); } } // Display control panel for this widget extract($options); ?> <div> <small><?php _e('This widget uses the <a href="http://txfx.net/code/wordpress/subscribe-to-comments/">Subscribe to Comments plugin</a> (version 2.1 at least) to automatically subscribe submitters to comments.', 'tdomf'); ?> </small> <br/><br/> <label for="subscribe_to_comments-title" style="line-height:35px;"><?php _e("Title: ", "tdomf"); ?> <input type="textfield" id="subscribe_to_comments-title" name="subscribe_to_comments-title" value="<?php echo htmlentities($options['title'], ENT_QUOTES, get_bloginfo('charset')); ?> " /></label> <br/> <input type="checkbox" name="subscribe_to_comments-show_email_field" id="subscribe_to_comments-show_email_field" <?php if ($options['show_email_field']) { echo "checked"; } ?> > <label for="subscribe_to_comments-show_email_field" style="line-height:35px;"><?php _e("Always show an Email Field", "tdomf"); ?> </label><br/> <small><?php _e('Only matters to non-registered users. If the Who Am I widget is used with the email field set to required, this widget will use that field, otherwise it\'ll display a email field for the user to subscribe to. Checking this option will force the email field to always be visible.', 'tdomf'); ?> </small> <br/> <input type="checkbox" name="subscribe_to_comments-always_subscribe" id="subscribe_to_comments-always_subscribe" <?php if ($options['always_subscribe']) { echo "checked"; } ?> > <label for="subscribe_to_comments-always_subscribe" style="line-height:35px;"><?php _e("Always Subscribe Submitter", "tdomf"); ?> </label><br/> <small><?php _e('Enabling this option means that the submitter (as long as we have a valid email address) will automatically be subscribed to comments. Otherwise they will have a choice.', 'tdomf'); ?> </small> </div> <?php }