38 * @since 2.6.0 |
24 * @since 2.6.0 |
39 * |
25 * |
40 * @return int Post ID |
26 * @return int Post ID |
41 */ |
27 */ |
42 function press_it() { |
28 function press_it() { |
43 // define some basic variables |
29 |
44 $quick['post_status'] = 'draft'; // set as draft first |
30 $post = get_default_post_to_edit(); |
45 $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null; |
31 $post = get_object_vars($post); |
46 $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null; |
32 $post_ID = $post['ID'] = (int) $_POST['post_id']; |
47 $quick['post_title'] = ( trim($_POST['title']) != '' ) ? $_POST['title'] : ' '; |
33 |
48 $quick['post_content'] = isset($_POST['post_content']) ? $_POST['post_content'] : ''; |
34 if ( !current_user_can('edit_post', $post_ID) ) |
49 |
35 wp_die(__('You are not allowed to edit this post.')); |
50 // insert the post with nothing in it, to get an ID |
36 |
51 $post_ID = wp_insert_post($quick, true); |
37 $post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : ''; |
52 if ( is_wp_error($post_ID) ) |
38 $post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : ''; |
53 wp_die($post_ID); |
39 $post['post_title'] = isset($_POST['title']) ? $_POST['title'] : ''; |
54 |
|
55 $content = isset($_POST['content']) ? $_POST['content'] : ''; |
40 $content = isset($_POST['content']) ? $_POST['content'] : ''; |
56 |
41 |
57 $upload = false; |
42 $upload = false; |
58 if( !empty($_POST['photo_src']) && current_user_can('upload_files') ) { |
43 if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) { |
59 foreach( (array) $_POST['photo_src'] as $key => $image) { |
44 foreach( (array) $_POST['photo_src'] as $key => $image) { |
60 // see if files exist in content - we don't want to upload non-used selected files. |
45 // see if files exist in content - we don't want to upload non-used selected files. |
61 if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) { |
46 if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) { |
62 $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : ''; |
47 $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : ''; |
63 $upload = media_sideload_image($image, $post_ID, $desc); |
48 $upload = media_sideload_image($image, $post_ID, $desc); |
64 |
49 |
65 // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes |
50 // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes |
66 if( !is_wp_error($upload) ) |
51 if ( !is_wp_error($upload) ) |
67 $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content); |
52 $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content); |
68 } |
53 } |
69 } |
54 } |
70 } |
55 } |
71 // set the post_content and status |
56 // set the post_content and status |
72 $quick['post_status'] = isset($_POST['publish']) ? 'publish' : 'draft'; |
57 $post['post_content'] = $content; |
73 $quick['post_content'] = $content; |
58 if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) ) |
|
59 $post['post_status'] = 'publish'; |
|
60 elseif ( isset( $_POST['review'] ) ) |
|
61 $post['post_status'] = 'pending'; |
|
62 else |
|
63 $post['post_status'] = 'draft'; |
|
64 |
74 // error handling for media_sideload |
65 // error handling for media_sideload |
75 if ( is_wp_error($upload) ) { |
66 if ( is_wp_error($upload) ) { |
76 wp_delete_post($post_ID); |
67 wp_delete_post($post_ID); |
77 wp_die($upload); |
68 wp_die($upload); |
78 } else { |
69 } else { |
79 $quick['ID'] = $post_ID; |
70 // Post formats |
80 wp_update_post($quick); |
71 if ( isset( $_POST['post_format'] ) ) { |
|
72 if ( current_theme_supports( 'post-formats', $_POST['post_format'] ) ) |
|
73 set_post_format( $post_ID, $_POST['post_format'] ); |
|
74 elseif ( '0' == $_POST['post_format'] ) |
|
75 set_post_format( $post_ID, false ); |
|
76 } |
|
77 |
|
78 $post_ID = wp_update_post($post); |
81 } |
79 } |
|
80 |
82 return $post_ID; |
81 return $post_ID; |
83 } |
82 } |
84 |
83 |
85 // For submitted posts. |
84 // For submitted posts. |
86 if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) { |
85 if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) { |
87 check_admin_referer('press-this'); |
86 check_admin_referer('press-this'); |
88 $post_ID = press_it(); |
87 $posted = $post_ID = press_it(); |
89 $posted = $post_ID; |
|
90 } else { |
88 } else { |
91 $post_ID = 0; |
89 $post = get_default_post_to_edit('post', true); |
|
90 $post_ID = $post->ID; |
92 } |
91 } |
93 |
92 |
94 // Set Variables |
93 // Set Variables |
95 $title = isset( $_GET['t'] ) ? trim( strip_tags( aposfix( stripslashes( $_GET['t'] ) ) ) ) : ''; |
94 $title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : ''; |
96 $selection = isset( $_GET['s'] ) ? trim( htmlspecialchars( html_entity_decode( aposfix( stripslashes( $_GET['s'] ) ) ) ) ) : ''; |
95 |
|
96 $selection = ''; |
|
97 if ( !empty($_GET['s']) ) { |
|
98 $selection = str_replace(''', "'", stripslashes($_GET['s'])); |
|
99 $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) ); |
|
100 } |
|
101 |
97 if ( ! empty($selection) ) { |
102 if ( ! empty($selection) ) { |
98 $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection); |
103 $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection); |
99 $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>'; |
104 $selection = '<p>' . str_replace('<p></p>', '', $selection) . '</p>'; |
100 } |
105 } |
101 |
106 |
102 $url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; |
107 $url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; |
103 $image = isset($_GET['i']) ? $_GET['i'] : ''; |
108 $image = isset($_GET['i']) ? $_GET['i'] : ''; |
104 |
109 |
291 insert_editor( "\n\n" + encodeURI('<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>')); |
268 insert_editor( "\n\n" + encodeURI('<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>')); |
292 } |
269 } |
293 return false; |
270 return false; |
294 } |
271 } |
295 |
272 |
296 function image_selector() { |
273 function image_selector(el) { |
|
274 var desc, src, parent = jQuery(el).closest('#photo-add-url-div'); |
|
275 |
|
276 if ( parent.length ) { |
|
277 desc = parent.find('input.tb_this_photo_description').val() || ''; |
|
278 src = parent.find('input.tb_this_photo').val() || '' |
|
279 } else { |
|
280 desc = jQuery('#tb_this_photo_description').val() || ''; |
|
281 src = jQuery('#tb_this_photo').val() || '' |
|
282 } |
|
283 |
297 tb_remove(); |
284 tb_remove(); |
298 desc = jQuery('#this_photo_description').val(); |
|
299 src = jQuery('#this_photo').val(); |
|
300 pick(src, desc); |
285 pick(src, desc); |
301 jQuery('#extra-fields').hide(); |
286 jQuery('#extra-fields').hide(); |
302 jQuery('#extra-fields').html(''); |
287 jQuery('#extra-fields').html(''); |
303 return false; |
288 return false; |
304 } |
289 } |
305 jQuery('#extra-fields').html('<div class="postbox"><h2>Add Photos <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul class="actions"><li><a href="#" id="photo-add-url" class="thickbox button"><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>'); |
290 |
306 jQuery('#img_container').html(strtoappend); |
291 jQuery('#extra-fields').html('<div class="postbox"><h2><?php _e( 'Add Photos' ); ?> <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul class="actions"><li><a href="#" id="photo-add-url" class="button"><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>'); |
|
292 jQuery('#img_container').html(strtoappend); |
307 <?php break; |
293 <?php break; |
308 } |
294 } |
309 die; |
295 die; |
310 } |
296 } |
311 |
297 |
312 ?> |
|
313 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
314 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>> |
|
315 <head> |
|
316 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> |
|
317 <title><?php _e('Press This') ?></title> |
|
318 |
|
319 <?php |
|
320 add_thickbox(); |
|
321 wp_enqueue_style( 'press-this' ); |
|
322 wp_enqueue_style( 'press-this-ie'); |
|
323 wp_enqueue_style( 'colors' ); |
298 wp_enqueue_style( 'colors' ); |
324 wp_enqueue_script( 'post' ); |
299 wp_enqueue_script( 'post' ); |
325 wp_enqueue_script( 'editor' ); |
300 _wp_admin_html_begin(); |
326 ?> |
301 ?> |
|
302 <title><?php _e('Press This') ?></title> |
327 <script type="text/javascript"> |
303 <script type="text/javascript"> |
328 //<![CDATA[ |
304 //<![CDATA[ |
329 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();}}}; |
305 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();}}}; |
330 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() ?>'}; |
306 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() ?>'}; |
331 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'press-this'; |
307 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>; |
332 var photostorage = false; |
308 var photostorage = false; |
333 //]]> |
309 //]]> |
334 </script> |
310 </script> |
335 |
311 |
336 <?php |
312 <?php |
337 do_action('admin_print_styles'); |
313 do_action('admin_print_styles'); |
338 do_action('admin_print_scripts'); |
314 do_action('admin_print_scripts'); |
339 do_action('admin_head'); |
315 do_action('admin_head'); |
340 |
|
341 if ( user_can_richedit() ) |
|
342 wp_tiny_mce( true, array( 'height' => '370' ) ); |
|
343 ?> |
316 ?> |
344 <script type="text/javascript"> |
317 <script type="text/javascript"> |
|
318 var wpActiveEditor = 'content'; |
|
319 |
345 function insert_plain_editor(text) { |
320 function insert_plain_editor(text) { |
346 edCanvas = document.getElementById('content'); |
321 if ( typeof(QTags) != 'undefined' ) |
347 edInsertContent(edCanvas, text); |
322 QTags.insertContent(text); |
348 } |
323 } |
349 function set_editor(text) { |
324 function set_editor(text) { |
350 if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>'; |
325 if ( '' == text || '<p></p>' == text ) |
351 if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text); |
326 text = '<p><br /></p>'; |
|
327 |
|
328 if ( tinyMCE.activeEditor ) |
|
329 tinyMCE.execCommand('mceSetContent', false, text); |
352 } |
330 } |
353 function insert_editor(text) { |
331 function insert_editor(text) { |
354 if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) { |
332 if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) { |
355 tinyMCE.execCommand('mceInsertContent', false, '<p>' + decodeURI(tinymce.DOM.decode(text)) + '</p>', {format : 'raw'}); |
333 tinyMCE.execCommand('mceInsertContent', false, '<p>' + decodeURI(tinymce.DOM.decode(text)) + '</p>', {format : 'raw'}); |
356 } else { |
334 } else { |
454 $(this).siblings('.inside').toggle(); |
433 $(this).siblings('.inside').toggle(); |
455 }); |
434 }); |
456 }); |
435 }); |
457 </script> |
436 </script> |
458 </head> |
437 </head> |
459 <body class="press-this wp-admin"> |
438 <?php |
460 <div id="wphead"></div> |
439 $admin_body_class = ( is_rtl() ) ? 'rtl' : ''; |
|
440 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
|
441 ?> |
|
442 <body class="press-this wp-admin <?php echo $admin_body_class; ?>"> |
461 <form action="press-this.php?action=post" method="post"> |
443 <form action="press-this.php?action=post" method="post"> |
462 <div id="poststuff" class="metabox-holder"> |
444 <div id="poststuff" class="metabox-holder"> |
463 <div id="side-info-column"> |
445 <div id="side-sortables" class="press-this-sidebar"> |
464 <div class="sleeve"> |
446 <div class="sleeve"> |
465 <h1 id="viewsite"><a href="<?php echo get_option('home'); ?>/" target="_blank"><?php bloginfo('name'); ?> › <?php _e('Press This') ?></a></span></h1> |
|
466 |
|
467 <?php wp_nonce_field('press-this') ?> |
447 <?php wp_nonce_field('press-this') ?> |
468 <input type="hidden" name="post_type" id="post_type" value="text"/> |
448 <input type="hidden" name="post_type" id="post_type" value="text"/> |
469 <input type="hidden" name="autosave" id="autosave" /> |
449 <input type="hidden" name="autosave" id="autosave" /> |
470 <input type="hidden" id="original_post_status" name="original_post_status" value="draft" /> |
450 <input type="hidden" id="original_post_status" name="original_post_status" value="draft" /> |
471 <input type="hidden" id="prev_status" name="prev_status" value="draft" /> |
451 <input type="hidden" id="prev_status" name="prev_status" value="draft" /> |
|
452 <input type="hidden" id="post_id" name="post_id" value="<?php echo (int) $post_ID; ?>" /> |
472 |
453 |
473 <!-- This div holds the photo metadata --> |
454 <!-- This div holds the photo metadata --> |
474 <div class="photolist"></div> |
455 <div class="photolist"></div> |
475 |
456 |
476 <div id="submitdiv" class="stuffbox"> |
457 <div id="submitdiv" class="postbox"> |
477 <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>"> |
458 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> |
478 <br/> |
459 <h3 class="hndle"><?php _e('Press This') ?></h3> |
479 </div> |
|
480 <h3><?php _e('Publish') ?></h3> |
|
481 <div class="inside"> |
460 <div class="inside"> |
|
461 <p id="publishing-actions"> |
|
462 <?php |
|
463 submit_button( __( 'Save Draft' ), 'button', 'draft', false, array( 'id' => 'save' ) ); |
|
464 if ( current_user_can('publish_posts') ) { |
|
465 submit_button( __( 'Publish' ), 'primary', 'publish', false ); |
|
466 } else { |
|
467 echo '<br /><br />'; |
|
468 submit_button( __( 'Submit for Review' ), 'primary', 'review', false ); |
|
469 } ?> |
|
470 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" id="saving" style="display:none;" /> |
|
471 </p> |
|
472 <?php if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) : |
|
473 $post_formats = get_theme_support( 'post-formats' ); |
|
474 if ( is_array( $post_formats[0] ) ) : |
|
475 $default_format = get_option( 'default_post_format', '0' ); |
|
476 ?> |
482 <p> |
477 <p> |
483 <input class="button" type="submit" name="draft" value="<?php esc_attr_e('Save Draft') ?>" id="save" /> |
478 <label for="post_format"><?php _e( 'Post Format:' ); ?> |
484 <?php if ( current_user_can('publish_posts') ) { ?> |
479 <select name="post_format" id="post_format"> |
485 <input class="button-primary" type="submit" name="publish" value="<?php esc_attr_e('Publish') ?>" id="publish" /> |
480 <option value="0"><?php _ex( 'Standard', 'Post format' ); ?></option> |
486 <?php } else { ?> |
481 <?php foreach ( $post_formats[0] as $format ): ?> |
487 <br /><br /><input class="button-primary" type="submit" name="review" value="<?php esc_attr_e('Submit for Review') ?>" id="review" /> |
482 <option<?php selected( $default_format, $format ); ?> value="<?php echo esc_attr( $format ); ?>"> <?php echo esc_html( get_post_format_string( $format ) ); ?></option> |
488 <?php } ?> |
483 <?php endforeach; ?> |
489 <img src="images/wpspin_light.gif" alt="" id="saving" style="display:none;" /> |
484 </select></label> |
490 </p> |
485 </p> |
|
486 <?php endif; endif; ?> |
491 </div> |
487 </div> |
492 </div> |
488 </div> |
493 |
489 |
494 <div id="categorydiv" class="stuffbox"> |
490 <?php $tax = get_taxonomy( 'category' ); ?> |
495 <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>"> |
491 <div id="categorydiv" class="postbox"> |
496 <br/> |
492 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> |
497 </div> |
493 <h3 class="hndle"><?php _e('Categories') ?></h3> |
498 <h3><?php _e('Categories') ?></h3> |
|
499 <div class="inside"> |
494 <div class="inside"> |
500 |
495 <div id="taxonomy-category" class="categorydiv"> |
501 <div id="categories-all" class="tabs-panel"> |
496 |
502 |
497 <ul id="category-tabs" class="category-tabs"> |
503 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
498 <li class="tabs"><a href="#category-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li> |
504 <?php wp_category_checklist($post_ID, false) ?> |
499 <li class="hide-if-no-js"><a href="#category-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> |
|
500 </ul> |
|
501 |
|
502 <div id="category-pop" class="tabs-panel" style="display: none;"> |
|
503 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > |
|
504 <?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?> |
505 </ul> |
505 </ul> |
506 </div> |
506 </div> |
507 |
507 |
508 <div id="category-adder" class="wp-hidden-children"> |
508 <div id="category-all" class="tabs-panel"> |
509 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a> |
509 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
510 <p id="category-add" class="wp-hidden-child"> |
510 <?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?> |
511 <label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/> |
511 </ul> |
512 <label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> |
|
513 <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" /> |
|
514 <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> |
|
515 <span id="category-ajax-response"></span> |
|
516 </p> |
|
517 </div> |
512 </div> |
|
513 |
|
514 <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?> |
|
515 <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p> |
|
516 <?php endif; ?> |
|
517 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> |
|
518 <div id="category-adder" class="wp-hidden-children"> |
|
519 <h4> |
|
520 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"> |
|
521 <?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?> |
|
522 </a> |
|
523 </h4> |
|
524 <p id="category-add" class="category-add wp-hidden-child"> |
|
525 <label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label> |
|
526 <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" tabindex="3" aria-required="true"/> |
|
527 <label class="screen-reader-text" for="newcategory_parent"> |
|
528 <?php echo $tax->labels->parent_item_colon; ?> |
|
529 </label> |
|
530 <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3 ) ); ?> |
|
531 <input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" /> |
|
532 <?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?> |
|
533 <span id="category-ajax-response"></span> |
|
534 </p> |
|
535 </div> |
|
536 <?php endif; ?> |
|
537 </div> |
518 </div> |
538 </div> |
519 </div> |
539 </div> |
520 |
540 |
521 <div id="tagsdiv-post_tag" class="stuffbox" > |
541 <div id="tagsdiv-post_tag" class="postbox"> |
522 <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>"> |
542 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> |
523 <br/> |
543 <h3><span><?php _e('Tags'); ?></span></h3> |
524 </div> |
|
525 <h3><span><?php _e('Post Tags'); ?></span></h3> |
|
526 <div class="inside"> |
544 <div class="inside"> |
527 <div class="tagsdiv" id="post_tag"> |
545 <div class="tagsdiv" id="post_tag"> |
528 <p class="jaxtag"> |
546 <div class="jaxtag"> |
529 <label class="screen-reader-text" for="newtag"><?php _e('Post Tags'); ?></label> |
547 <label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?></label> |
530 <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> |
548 <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> |
531 <div class="ajaxtag"> |
549 <div class="ajaxtag"> |
532 <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> |
550 <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> |
533 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /> |
551 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /> |
534 </div> |
552 </div> |
535 </p> |
553 </div> |
536 <div class="tagchecklist"></div> |
554 <div class="tagchecklist"></div> |
537 </div> |
555 </div> |
538 <p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags in Post Tags'); ?></a></p> |
556 <p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags'); ?></a></p> |
539 </div> |
557 </div> |
540 </div> |
558 </div> |
541 </div> |
559 </div> |
542 </div> |
560 </div> |
543 <div class="posting"> |
561 <div class="posting"> |
544 <?php if ( isset($posted) && intval($posted) ) { $post_ID = intval($posted); ?> |
562 |
545 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div> |
563 <div id="wphead"> |
|
564 <img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="16" height="16" /> |
|
565 <h1 id="site-heading"> |
|
566 <a href="<?php echo get_option('home'); ?>/" target="_blank"> |
|
567 <span id="site-title"><?php bloginfo('name'); ?></span> |
|
568 </a> |
|
569 </h1> |
|
570 </div> |
|
571 |
|
572 <?php |
|
573 if ( isset($posted) && intval($posted) ) { |
|
574 $post_ID = intval($posted); ?> |
|
575 <div id="message" class="updated"> |
|
576 <p><strong><?php _e('Your post has been saved.'); ?></strong> |
|
577 <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink($post_ID); ?>"><?php _e('View post'); ?></a> |
|
578 | <a href="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit Post'); ?></a> |
|
579 | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p> |
|
580 </div> |
546 <?php } ?> |
581 <?php } ?> |
547 |
582 |
548 <div id="titlediv"> |
583 <div id="titlediv"> |
549 <div class="titlewrap"> |
584 <div class="titlewrap"> |
550 <input name="title" id="title" class="text" value="<?php echo esc_attr($title);?>"/> |
585 <input name="title" id="title" class="text" value="<?php echo esc_attr($title);?>"/> |
551 </div> |
586 </div> |
552 </div> |
587 </div> |
553 |
588 |
|
589 <div id="waiting" style="display: none"><img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> <?php esc_html_e( 'Loading...' ); ?></div> |
|
590 |
554 <div id="extra-fields" style="display: none"></div> |
591 <div id="extra-fields" style="display: none"></div> |
555 |
592 |
556 <div class="postdivrich"> |
593 <div class="postdivrich"> |
557 <ul id="actions" class="actions"> |
594 <?php |
558 |
595 |
559 <li id="photo_button"> |
596 $editor_settings = array( |
560 Add: <?php if ( current_user_can('upload_files') ) { ?><a title="<?php _e('Insert an Image'); ?>" href="#"> |
597 'teeny' => true, |
561 <img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.gif"/></a> |
598 'textarea_rows' => '15' |
562 <?php } ?> |
599 ); |
563 </li> |
600 |
564 <li id="video_button"> |
601 $content = ''; |
565 <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="images/media-button-video.gif"/></a> |
602 if ( $selection ) |
566 </li> |
603 $content .= $selection; |
567 <?php if( user_can_richedit() ) { ?> |
604 |
568 <li id="switcher"> |
605 if ( $url ) { |
569 <?php wp_print_scripts( 'quicktags' ); ?> |
606 $content .= '<p>'; |
570 <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?> |
607 |
571 <a id="edButtonHTML" onclick="switchEditors.go('content', 'html');"><?php _e('HTML'); ?></a> |
608 if ( $selection ) |
572 <a id="edButtonPreview" class="active" onclick="switchEditors.go('content', 'tinymce');"><?php _e('Visual'); ?></a> |
609 $content .= __('via '); |
573 <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('content')" /></div> |
610 |
574 </li> |
611 $content .= sprintf( "<a href='%s'>%s</a>.</p>", esc_url( $url ), esc_html( $title ) ); |
575 <?php } ?> |
612 } |
576 </ul> |
613 |
577 <div id="quicktags"></div> |
614 remove_action( 'media_buttons', 'media_buttons' ); |
578 <div class="editor-container"> |
615 add_action( 'media_buttons', 'press_this_media_buttons' ); |
579 <textarea name="content" id="content" style="width:100%;" class="theEditor" rows="15"><?php |
616 function press_this_media_buttons() { |
580 if ( $selection ) |
617 _e( 'Add:' ); |
581 echo wp_richedit_pre($selection); |
618 |
582 if ( $url ) { |
619 if ( current_user_can('upload_files') ) { |
583 echo '<p>'; |
620 ?> |
584 if ( $selection ) |
621 <a id="photo_button" title="<?php esc_attr_e('Insert an Image'); ?>" href="#"> |
585 _e('via '); |
622 <img alt="<?php esc_attr_e('Insert an Image'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-image.gif?ver=20100531' ) ); ?>"/></a> |
586 printf( "<a href='%s'>%s</a>.</p>", esc_url( $url ), esc_html( $title ) ); |
623 <?php |
587 } |
624 } |
588 ?></textarea> |
625 ?> |
589 </div> |
626 <a id="video_button" title="<?php esc_attr_e('Embed a Video'); ?>" href="#"><img alt="<?php esc_attr_e('Embed a Video'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-video.gif?ver=20100531' ) ); ?>"/></a> |
|
627 <?php |
|
628 } |
|
629 |
|
630 wp_editor( $content, 'content', $editor_settings ); |
|
631 |
|
632 ?> |
590 </div> |
633 </div> |
591 </div> |
634 </div> |
592 </div> |
635 </div> |
593 </form> |
636 </form> |
594 <?php do_action('admin_print_footer_scripts'); ?> |
637 <div id="photo-add-url-div" style="display:none;"> |
|
638 <table><tr> |
|
639 <td><label for="this_photo"><?php _e('URL') ?></label></td> |
|
640 <td><input type="text" id="this_photo" name="this_photo" class="tb_this_photo text" onkeypress="if(event.keyCode==13) image_selector(this);" /></td> |
|
641 </tr><tr> |
|
642 <td><label for="this_photo_description"><?php _e('Description') ?></label></td> |
|
643 <td><input type="text" id="this_photo_description" name="photo_description" class="tb_this_photo_description text" onkeypress="if(event.keyCode==13) image_selector(this);" value="<?php echo esc_attr($title);?>"/></td> |
|
644 </tr><tr> |
|
645 <td><input type="button" class="button" onclick="image_selector(this)" value="<?php esc_attr_e('Insert Image'); ?>" /></td> |
|
646 </tr></table> |
|
647 </div> |
|
648 <?php |
|
649 do_action('admin_footer'); |
|
650 do_action('admin_print_footer_scripts'); |
|
651 ?> |
595 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> |
652 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> |
596 </body> |
653 </body> |
597 </html> |
654 </html> |