Exemplo n.º 1
0
     }
 }
 if (count($errors) > 0) {
     // form errors, build feedback string to display the errors
     $feedback_msg = '<div class="alert alert-danger" role="alert">Sorry, but there are a few errors in your entry. Please correct and try again.<ul>';
     // Hah, each one is an oops, get it?
     foreach ($errors as $oops) {
         $feedback_msg .= '<li>' . $oops . '</li>';
     }
     $feedback_msg .= '</ul></div>';
 } else {
     // set up stuff if we are just doing a preview
     $previewBtnState = '';
     $submitBtnState = '';
     $feedback_msg = '<div class="alert alert-warning" role="alert"><span class="glyphicon glyphicon-thumbs-up""></span> The form information looks good! Now you can <a href="#" class="btn btn-warning btn-xs disabled">preview</a> your entry and continue to edit and then <a href="#" class="btn btn-success btn-xs disabled">submit</a> when you are ready.</div>';
     $exampleDescription = oembed_filter($exampleDescription);
     // Now process form only if submit button used
     if (isset($_POST['submitexample'])) {
         // good enough, let's make a post! Or a custom post type
         $add_tags = explode(",", $exampleTags);
         // holder for tags
         // add a tag for twitter name, if provided
         if ($use_twitter_name) {
             $add_tags[] = $submitterTwitter;
         }
         $example_information = array('post_title' => esc_attr(strip_tags($_POST['exampleTitle'])), 'post_content' => $exampleDescription, 'post_type' => 'examples', 'post_status' => $my_new_status);
         // insert as a post type
         $post_id = wp_insert_post($example_information);
         // check for success
         if ($post_id) {
             // set metadata, will use same custom fields as FWP
Exemplo n.º 2
0
         $errors['captcha'] = '<span class="label label-danger">Captcha Error</span>- please retry the captcha field.';
     }
 }
 if (count($errors) > 0) {
     // form errors, build feedback string to display the errors
     $feedback_msg = '<div class="alert alert-danger" role="alert">Sorry, but there are a few errors in your entry. Please correct the following items and try again.<ul>';
     // Hah, each one is an oops, get it?
     foreach ($errors as $oops) {
         $feedback_msg .= '<li>' . $oops . '</li>';
     }
     $feedback_msg .= '</ul></div>';
 } else {
     // set up stuff if we are just doing a preview
     $previewBtnState = '';
     $feedback_msg = '<div class="alert alert-warning" role="alert"><span class="glyphicon glyphicon-thumbs-up""></span> The information for this new ' . THINGNAME . ' seems to be ok! Now you can preview your entry; continue to edit and modify until you think it is ready. You must <a href="#" class="btn btn-warning btn-xs disabled">preview</a> at least once to activate the submit button. Note that if you change the URL, you will have to click the <a href="#" class="btn btn-primary btn-xs disabled">update</a> button again to refresh its content.</div>';
     $assignmentDescription = oembed_filter($assignmentDescription);
     // Now process form only if submit button used
     if (isset($_POST['submitassignment'])) {
         $add_tags = $assignmentTags;
         // holder for tags
         // add a tag for twitter name, if provided
         if ($submitterTwitter != '') {
             $add_tags .= ',' . $submitterTwitter;
         }
         // good enough, let's add this thing
         $assignment_information = array('post_title' => $assignmentTitle, 'post_content' => $assignmentDescription, 'tags_input' => $add_tags, 'post_type' => 'assignments', 'post_status' => $my_new_status);
         // insert as a post
         $post_id = wp_insert_post($assignment_information);
         // check for success
         if ($post_id) {
             // set metadata