~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-admin/press-this.php

  • Committer: Andrew Glen-Young
  • Date: 2011-03-08 14:47:51 UTC
  • Revision ID: andrew.glen-young@canonical.com-20110308144751-1n6spqgayztf9h77
[AGY] import 3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * @subpackage Press_This
7
7
 */
8
8
 
 
9
define('IFRAME_REQUEST' , true);
 
10
 
9
11
/** WordPress Administration Bootstrap */
10
12
require_once('./admin.php');
 
13
 
11
14
header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
12
15
 
13
16
if ( ! current_user_can('edit_posts') )
24
27
 */
25
28
function press_it() {
26
29
        // define some basic variables
 
30
        $quick = array();
27
31
        $quick['post_status'] = 'draft'; // set as draft first
28
32
        $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
29
33
        $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
59
63
                wp_delete_post($post_ID);
60
64
                wp_die($upload);
61
65
        } else {
 
66
                // Post formats
 
67
                if ( current_theme_supports( 'post-formats' ) && isset( $_POST['post_format'] ) ) {
 
68
                        $post_formats = get_theme_support( 'post-formats' );
 
69
                        if ( is_array( $post_formats ) ) {
 
70
                                $post_formats = $post_formats[0];
 
71
                                if ( in_array( $_POST['post_format'], $post_formats ) )
 
72
                                        set_post_format( $post_ID, $_POST['post_format'] );
 
73
                                elseif ( '0' == $_POST['post_format'] )
 
74
                                        set_post_format( $post_ID, false );
 
75
                        }
 
76
                }
 
77
 
62
78
                $quick['ID'] = $post_ID;
63
79
                wp_update_post($quick);
64
80
        }
110
126
                        <div class="postbox">
111
127
                                <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2>
112
128
                                <div class="inside">
113
 
                                        <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo wp_htmledit_pre( $selection ); ?></textarea>
 
129
                                        <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo esc_textarea( $selection ); ?></textarea>
114
130
                                        <p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p>
115
131
                                </div>
116
132
                        </div>
317
333
//<![CDATA[
318
334
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
319
335
var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
320
 
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'press-this';
 
336
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>;
321
337
var photostorage = false;
322
338
//]]>
323
339
</script>
327
343
        do_action('admin_print_scripts');
328
344
        do_action('admin_head');
329
345
 
330
 
        if ( user_can_richedit() )
 
346
        if ( user_can_richedit() ) {
331
347
                wp_tiny_mce( true, array( 'height' => '370' ) );
 
348
                add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
 
349
        }
332
350
?>
333
351
        <script type="text/javascript">
334
352
        function insert_plain_editor(text) {
463
481
                        <div class="photolist"></div>
464
482
 
465
483
                        <div id="submitdiv" class="stuffbox">
466
 
                                <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>">
467
 
                                        <br/>
468
 
                                </div>
469
 
                                <h3><?php _e('Publish') ?></h3>
470
484
                                <div class="inside">
471
485
                                        <p>
472
 
                                                <input class="button" type="submit" name="draft" value="<?php esc_attr_e('Save Draft') ?>" id="save" />
473
 
                                                <?php if ( current_user_can('publish_posts') ) { ?>
474
 
                                                        <input class="button-primary" type="submit" name="publish" value="<?php esc_attr_e('Publish') ?>" id="publish" />
475
 
                                                <?php } else { ?>
476
 
                                                        <br /><br /><input class="button-primary" type="submit" name="review" value="<?php esc_attr_e('Submit for Review') ?>" id="review" />
477
 
                                                <?php } ?>
 
486
                                        <?php
 
487
                                                submit_button( __( 'Save Draft' ), 'button', 'draft', false, array( 'id' => 'save' ) );
 
488
                                                if ( current_user_can('publish_posts') ) {
 
489
                                                        submit_button( __( 'Publish' ), 'primary', 'publish', false );
 
490
                                                } else {
 
491
                                                        echo '<br /><br />';
 
492
                                                        submit_button( __( 'Submit for Review' ), 'primary', 'review', false );
 
493
                                                } ?>
478
494
                                                <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" id="saving" style="display:none;" />
479
495
                                        </p>
 
496
                                        <?php if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) :
 
497
                                                        $post_formats = get_theme_support( 'post-formats' );
 
498
                                                        if ( is_array( $post_formats[0] ) ) :
 
499
                                                                $default_format = get_option( 'default_post_format', '0' );
 
500
                                                ?>
 
501
                                        <p>
 
502
                                                <label for="post_format"><?php _e( 'Post Format:' ); ?>
 
503
                                                <select name="post_format" id="post_format">
 
504
                                                        <option value="0"><?php _e( 'Standard' ); ?></option>
 
505
                                                <?php foreach ( $post_formats[0] as $format ): ?>
 
506
                                                        <option<?php selected( $default_format, $format ); ?> value="<?php echo esc_attr( $format ); ?>"> <?php echo esc_html( get_post_format_string( $format ) ); ?></option>
 
507
                                                <?php endforeach; ?>
 
508
                                                </select></label>
 
509
                                        </p>
 
510
                                        <?php endif; endif; ?>
480
511
                                </div>
481
512
                        </div>
482
513