Exemple #1
0
function truwriter_editlink_meta_box_callback($post)
{
    // Add a nonce field so we can check for it later.
    wp_nonce_field('truwriter_editlink_meta_box_data', 'truwriter_editlink_meta_box_nonce');
    // get edit key
    $ekey = get_post_meta($post->ID, 'wEditKey', 1);
    // make an edit link if it does not exist
    if (!$ekey) {
        truwriter_make_edit_link($post->ID);
        $ekey = get_post_meta($post->ID, 'wEditKey', 1);
    }
    echo '<label for="writing_edit_link">';
    _e('Click to highlight, then copy', 'radcliffe');
    echo '</label> ';
    echo '<input style="width:100%; type="text" id="writing_edit_link" name="writing_edit_link" value="' . get_bloginfo('url') . '/write/?wid=' . $post->ID . '&tk=' . $ekey . '"  onclick="this.select();" />';
}
     // store the header image caption as post metadata
     add_post_meta($post_id, 'wHeaderCaption', $wHeaderImageCaption);
     // store notes for editor
     if ($wNotes) {
         add_post_meta($post_id, 'wEditorNotes', $wNotes);
     }
     // store notes for editor
     if ($wFooter) {
         add_post_meta($post_id, 'wFooter', nl2br($wFooter));
     }
     // user selected license
     if ($my_cc_mode != 'none') {
         add_post_meta($post_id, 'wLicense', $wLicense);
     }
     // add a token for editing
     truwriter_make_edit_link($post_id, $wTitle);
     $feedback_msg = 'Ok, we have saved this first version of your article. You can <a href="' . site_url() . '/?p=' . $post_id . 'preview=true' . '" target="_blank">preview it now</a> (opens in a new window), or make edits and save again. ';
 } else {
     // the post exists, let's update
     // make a copy of the category array so we can append the default category ID
     $copy_cats = $wCats;
     // check if we have a publish button click or this is a re-edit,
     // in this case we update the post with the form information
     if (isset($_POST['wPublish']) or $is_re_edit) {
         // ---------- FINAL PUBLISH -----------
         // roger, we have ignition
         $is_published = true;
         // set the published category
         $copy_cats[] = $published_cat_id;
         if ($is_re_edit) {
             // revise status to pending (new ones)