} $output .= "\n\t\t" . __("Tags (separate multiple tags with commas: cats, pet food, dogs):", "tdomf"); $output .= '</label>'; $output .= "\n\t\t<br/>\n\t\t" . '<input type="text" id="tags" name="tags" size="60" value="'; $output .= "<?php echo htmlentities(\$tags,ENT_QUOTES,get_bloginfo('charset')); ?>" . '" />'; $output .= $after_widget; } return $output; } tdomf_register_form_widget_hack('tags', __('Tags', 'tdomf'), 'tdomf_widget_tags_hack', array("new-post")); /////////////////////////////////////// // Validate required tags // function tdomf_widget_tags_validate($args, $preview) { extract($args); $options = tdomf_widget_tags_options($tdomf_form_id); $output = ""; if ($options['user'] && $options['required']) { if (empty($tags)) { $output .= __('You must specify at least one tag.', 'tdomf'); } } // return output if any if ($output != "") { return $before_widget . $output . $after_widget; } return NULL; } tdomf_register_form_widget_validate('tags', __('Tags', 'tdomf'), 'tdomf_widget_tags_validate'); }
/** * Start widget * * @access public */ function start() { $retVal = false; if (!$this->started || !$this->internalName || !$this->displayName) { $retVal = true; if ($this->multipleInstances) { add_action('tdomf_generate_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_create_post_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_control_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_preview_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_validate_form_start', array($this, '_multipleInstancesInit'), 10, 2); add_action('tdomf_control_form_start', array($this, '_multipleInstancesHandler'), 10, 2); add_action('tdomf_widget_page_bottom', array($this, '_multipleInstancesForm'), 10, 2); add_action('tdomf_upload_inline_form_start', array($this, '_multipleInstancesInit'), 10, 2); // for multiple instances, init is handled in _multipleInstancesInit function } else { tdomf_register_form_widget($this->internalName, $this->displayName, array($this, '_form'), $this->modes); if ($this->hack) { tdomf_register_form_widget_hack($this->internalName, $this->displayName, array($this, '_formHack'), $this->modes); } if ($this->control) { tdomf_register_form_widget_control($this->internalName, $this->displayName, array($this, '_control'), $this->controlWidth, $this->controlHeight, $this->modes); } if ($this->preview) { tdomf_register_form_widget_preview($this->internalName, $this->displayName, array($this, '_preview'), $this->modes); } if ($this->previewHack) { tdomf_register_form_widget_preview_hack($this->internalName, $this->displayName, array($this, '_previewHack'), $this->modes); } if ($this->validate) { tdomf_register_form_widget_validate($this->internalName, $this->displayName, array($this, '_validate'), $this->modes); } if ($this->post) { tdomf_register_form_widget_post($this->internalName, $this->displayName, array($this, '_post'), $this->modes); } if ($this->adminEmail) { tdomf_register_form_widget_adminemail($this->internalName, $this->displayName, array($this, '_adminEmail'), $this->modes); } if ($this->adminError) { tdomf_register_form_widget_admin_error($this->internalName, $this->displayName, array($this, '_adminError'), $this->modes); } } } return $retVal; }
tdomf_register_form_widget_hack('notifyme', 'Notify Me', 'tdomf_widget_notifyme_hack', $modes = array('new')); // Widget validate input // function tdomf_widget_notifyme_validate($args, $preview) { extract($args); if (!$preview) { if (tdomf_widget_notifyme_show_email_input($tdomf_form_id)) { if (isset($notifyme) && !tdomf_check_email_address($notifyme_email)) { return $before_widget . __("You must specify a valid email address to send the notification to.", "tdomf") . $after_widget; } } } return NULL; } tdomf_register_form_widget_validate('notifyme', 'Notify Me', 'tdomf_widget_notifyme_validate', $modes = array('new')); // Widget post submitted post-op // function tdomf_widget_notifyme_post($args) { global $current_user; get_currentuserinfo(); extract($args); if (isset($notifyme)) { if (!isset($notifyme_email)) { if (is_user_logged_in() && tdomf_check_email_address($current_user->user_email)) { $notifyme_email = $current_user->user_email; } else { if (isset($whoami_email)) { $notifyme_email = $whoami_email; } else {
} tdomf_register_form_widget_hack('subscribe_to_comments', __('Subscribe to Comments', "tdomf"), 'tdomf_widget_subscribe_to_comments_hack'); function tdomf_widget_subscribe_to_comments_validate($args, $preview) { $options = tdomf_widget_subscribe_to_comments_get_options($args['tdomf_form_id']); extract($args); if (!$preview) { if ((tdomf_widget_notifyme_show_email_input($tdomf_form_id) || $options['show_email_field']) && ($options['always_subscribe'] || $subscribe_to_comments)) { if (isset($subscribe_to_comments_email) && !tdomf_check_email_address($subscribe_to_comments_email)) { return $before_widget . __("You must specify a valid email address to send the comment notifications to.", "tdomf") . $after_widget; } } } return NULL; } tdomf_register_form_widget_validate('subscribe_to_comments', __('Subscribe to Comments', "tdomf"), 'tdomf_widget_subscribe_to_comments_validate'); function tdomf_widget_subscribe_to_comments_post($args) { global $current_user, $sg_subscribe; $options = tdomf_widget_subscribe_to_comments_get_options($args['tdomf_form_id']); get_currentuserinfo(); extract($args); if ($options['always_subscribe'] || $subscribe_to_comments) { if (!isset($subscribe_to_comments_email)) { if (is_user_logged_in() && tdomf_check_email_address($current_user->user_email)) { $subscribe_to_comments_email = $current_user->user_email; } else { if (isset($whoami_email)) { $subscribe_to_comments_email = $whoami_email; } else { tdomf_log_message("Could not find a email address to use for comment subscribption!", TDOMF_LOG_ERROR);