Changeset 31534 for trunk/src/wp-admin/press-this.php
- Timestamp:
- 02/25/2015 01:49:26 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/press-this.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/press-this.php
r31034 r31534 12 12 require_once( dirname( __FILE__ ) . '/admin.php' ); 13 13 14 header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));15 16 14 if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) 17 15 wp_die( __( 'Cheatin’ uh?' ), 403 ); 18 16 19 /** 20 * Press It form handler. 21 * 22 * @since 2.6.0 23 * 24 * @return int Post ID 25 */ 26 function press_it() { 27 28 $post = get_default_post_to_edit(); 29 $post = get_object_vars($post); 30 $post_ID = $post['ID'] = (int) $_POST['post_id']; 31 32 if ( !current_user_can('edit_post', $post_ID) ) 33 wp_die(__('You are not allowed to edit this post.')); 34 35 $post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : ''; 36 $post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : ''; 37 $post['post_title'] = isset($_POST['title']) ? $_POST['title'] : ''; 38 $content = isset($_POST['content']) ? $_POST['content'] : ''; 39 40 $upload = false; 41 if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) { 42 foreach( (array) $_POST['photo_src'] as $key => $image) { 43 // See if files exist in content - we don't want to upload non-used selected files. 44 if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) { 45 $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : ''; 46 $upload = media_sideload_image($image, $post_ID, $desc); 47 48 // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes 49 if ( !is_wp_error($upload) ) 50 $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content); 51 } 52 } 53 } 54 // Set the post_content and status. 55 $post['post_content'] = $content; 56 if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) ) 57 $post['post_status'] = 'publish'; 58 elseif ( isset( $_POST['review'] ) ) 59 $post['post_status'] = 'pending'; 60 else 61 $post['post_status'] = 'draft'; 62 63 // Error handling for media_sideload. 64 if ( is_wp_error($upload) ) { 65 wp_delete_post($post_ID); 66 wp_die( esc_html( $upload->get_error_message() ) ); 67 } else { 68 // Post formats. 69 if ( isset( $_POST['post_format'] ) ) { 70 if ( current_theme_supports( 'post-formats', $_POST['post_format'] ) ) 71 set_post_format( $post_ID, $_POST['post_format'] ); 72 elseif ( '0' == $_POST['post_format'] ) 73 set_post_format( $post_ID, false ); 74 } 75 76 $post_ID = wp_update_post($post); 77 } 78 79 return $post_ID; 17 if ( empty( $GLOBALS['wp_press_this'] ) ) { 18 include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' ); 80 19 } 81 20 82 // For submitted posts. 83 if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) { 84 check_admin_referer('press-this'); 85 $posted = $post_ID = press_it(); 86 } else { 87 $post = get_default_post_to_edit('post', true); 88 $post_ID = $post->ID; 89 } 90 91 // Set Variables 92 $title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( wp_unslash( $_GET['t'] ) , ENT_QUOTES) ) ) : ''; 93 94 $selection = ''; 95 if ( !empty($_GET['s']) ) { 96 $selection = str_replace(''', "'", wp_unslash($_GET['s'])); 97 $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) ); 98 } 99 100 if ( ! empty($selection) ) { 101 $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection); 102 $selection = '<p>' . str_replace('<p></p>', '', $selection) . '</p>'; 103 } 104 105 $url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; 106 $image = isset($_GET['i']) ? $_GET['i'] : ''; 107 108 if ( !empty($_REQUEST['ajax']) ) { 109 switch ($_REQUEST['ajax']) { 110 case 'video': ?> 111 <script type="text/javascript"> 112 jQuery('.select').click(function() { 113 append_editor(jQuery('#embed-code').val()); 114 jQuery('#extra-fields').hide(); 115 jQuery('#extra-fields').html(''); 116 }); 117 jQuery('.close').click(function() { 118 jQuery('#extra-fields').hide(); 119 jQuery('#extra-fields').html(''); 120 }); 121 </script> 122 <div class="postbox"> 123 <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2> 124 <div class="inside"> 125 <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo esc_textarea( $selection ); ?></textarea> 126 <p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p> 127 </div> 128 </div> 129 <?php break; 130 131 case 'photo_thickbox': ?> 132 <script type="text/javascript"> 133 jQuery('.cancel').click(function() { 134 tb_remove(); 135 }); 136 jQuery('.select').click(function() { 137 image_selector(this); 138 }); 139 </script> 140 <h3 class="tb"><label for="tb_this_photo_description"><?php _e('Description') ?></label></h3> 141 <div class="titlediv"> 142 <div class="titlewrap"> 143 <input id="tb_this_photo_description" name="photo_description" class="tb_this_photo_description tbtitle text" type="text" onkeypress="if(event.keyCode==13) image_selector(this);" value="<?php echo esc_attr($title);?>"/> 144 </div> 145 </div> 146 147 <p class="centered"> 148 <input type="hidden" name="this_photo" value="<?php echo esc_attr( $image ); ?>" id="tb_this_photo" class="tb_this_photo" /> 149 <a href="#" class="select"> 150 <img src="<?php echo esc_url( $image ); ?>" alt="<?php esc_attr_e( 'Click to insert.' ); ?>" title="<?php esc_attr_e( 'Click to insert.' ); ?>" /> 151 </a> 152 </p> 153 154 <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p> 155 <?php break; 156 case 'photo_images': 157 /** 158 * Retrieve all image URLs from given URI. 159 * 160 * @since 2.6.0 161 * 162 * @param string $uri 163 * @return string 164 */ 165 function get_images_from_uri($uri) { 166 $uri = preg_replace('/\/#.+?$/','', $uri); 167 if ( preg_match( '/\.(jpe?g|jpe|gif|png)\b/i', $uri ) && !strpos( $uri, 'blogger.com' ) ) 168 return "'" . esc_attr( html_entity_decode($uri) ) . "'"; 169 $content = wp_remote_fopen($uri); 170 if ( false === $content ) 171 return ''; 172 $host = parse_url($uri); 173 $pattern = '/<img ([^>]*)src=(\"|\')([^<>\'\"]+)(\2)([^>]*)\/*>/i'; 174 $content = str_replace(array("\n","\t","\r"), '', $content); 175 preg_match_all($pattern, $content, $matches); 176 if ( empty($matches[0]) ) 177 return ''; 178 $sources = array(); 179 foreach ($matches[3] as $src) { 180 181 // If no http in URL. 182 if (strpos($src, 'http') === false) 183 // If it doesn't have a relative URI. 184 if ( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0) 185 $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src); 186 else 187 $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src); 188 $sources[] = esc_url($src); 189 } 190 return "'" . implode("','", $sources) . "'"; 191 } 192 $url = wp_kses(urldecode($url), null); 193 echo 'new Array('.get_images_from_uri($url).')'; 194 break; 195 196 case 'photo_js': ?> 197 // Gather images and load some default JS. 198 var last = null 199 var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; 200 if(photostorage == false) { 201 var my_src = eval( 202 jQuery.ajax({ 203 type: "GET", 204 url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>", 205 cache : false, 206 async : false, 207 data: "ajax=photo_images&u=<?php echo urlencode($url); ?>", 208 dataType : "script" 209 }).responseText 210 ); 211 if(my_src.length == 0) { 212 var my_src = eval( 213 jQuery.ajax({ 214 type: "GET", 215 url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>", 216 cache : false, 217 async : false, 218 data: "ajax=photo_images&u=<?php echo urlencode($url); ?>", 219 dataType : "script" 220 }).responseText 221 ); 222 if(my_src.length == 0) { 223 strtoappend = '<?php _e('Unable to retrieve images or no images on page.'); ?>'; 224 } 225 } 226 } 227 for (i = 0; i < my_src.length; i++) { 228 img = new Image(); 229 img.src = my_src[i]; 230 img_attr = 'id="img' + i + '"'; 231 skip = false; 232 233 maybeappend = '<a href="?ajax=photo_thickbox&i=' + encodeURIComponent(img.src) + '&u=<?php echo urlencode($url); ?>&height=400&width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; 234 235 if (img.width && img.height) { 236 if (img.width >= 30 && img.height >= 30) { 237 aspect = img.width / img.height; 238 scale = (aspect > 1) ? (71 / img.width) : (71 / img.height); 239 240 w = img.width; 241 h = img.height; 242 243 if (scale < 1) { 244 w = parseInt(img.width * scale); 245 h = parseInt(img.height * scale); 246 } 247 img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; 248 strtoappend += maybeappend; 249 } 250 } else { 251 strtoappend += maybeappend; 252 } 253 } 254 255 function pick(img, desc) { 256 if (img) { 257 if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length; 258 if(length == 0) length = 1; 259 jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>'); 260 jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>'); 261 insert_editor( "\n\n" + encodeURI('<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>')); 262 } 263 return false; 264 } 265 266 function image_selector(el) { 267 var desc, src, parent = jQuery(el).closest('#photo-add-url-div'); 268 269 if ( parent.length ) { 270 desc = parent.find('input.tb_this_photo_description').val() || ''; 271 src = parent.find('input.tb_this_photo').val() || '' 272 } else { 273 desc = jQuery('#tb_this_photo_description').val() || ''; 274 src = jQuery('#tb_this_photo').val() || '' 275 } 276 277 tb_remove(); 278 pick(src, desc); 279 jQuery('#extra-fields').hide(); 280 jQuery('#extra-fields').html(''); 281 return false; 282 } 283 284 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 button-small"><?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>'); 285 jQuery('#img_container').html(strtoappend); 286 <?php break; 287 } 288 die; 289 } 290 291 wp_enqueue_style( 'colors' ); 292 wp_enqueue_script( 'post' ); 293 add_thickbox(); 294 _wp_admin_html_begin(); 295 ?> 296 <title><?php _e('Press This') ?></title> 297 <script type="text/javascript"> 298 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();}}}; 299 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>; 300 var photostorage = false; 301 </script> 302 303 <?php 304 /** This action is documented in wp-admin/admin-header.php */ 305 do_action( 'admin_enqueue_scripts', 'press-this.php' ); 306 307 /** 308 * Fires when styles are printed for the Press This admin page. 309 * 310 * @since 3.7.0 311 */ 312 do_action( 'admin_print_styles-press-this.php' ); 313 314 /** This action is documented in wp-admin/admin-header.php */ 315 do_action( 'admin_print_styles' ); 316 317 /** 318 * Fires when scripts are printed for the Press This admin page. 319 * 320 * @since 3.7.0 321 */ 322 do_action( 'admin_print_scripts-press-this.php' ); 323 324 /** This action is documented in wp-admin/admin-header.php */ 325 do_action( 'admin_print_scripts' ); 326 327 /** 328 * Fires in the head tag on the Press This admin page. 329 * 330 * @since 3.7.0 331 */ 332 do_action( 'admin_head-press-this.php' ); 333 334 /** This action is documented in wp-admin/admin-header.php */ 335 do_action( 'admin_head' ); 336 ?> 337 <script type="text/javascript"> 338 var wpActiveEditor = 'content'; 339 340 function insert_plain_editor(text) { 341 if ( typeof(QTags) != 'undefined' ) 342 QTags.insertContent(text); 343 } 344 function set_editor(text) { 345 if ( '' == text || '<p></p>' == text ) 346 text = '<p><br /></p>'; 347 348 if ( tinyMCE.activeEditor ) 349 tinyMCE.execCommand('mceSetContent', false, text); 350 } 351 function insert_editor(text) { 352 if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) { 353 tinyMCE.execCommand('mceInsertContent', false, '<p>' + decodeURI(tinymce.DOM.decode(text)) + '</p>', {format : 'raw'}); 354 } else { 355 insert_plain_editor(decodeURI(text)); 356 } 357 } 358 function append_editor(text) { 359 if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) { 360 tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>'); 361 } else { 362 insert_plain_editor(text); 363 } 364 } 365 366 function show(tab_name) { 367 jQuery('#extra-fields').html(''); 368 switch(tab_name) { 369 case 'video' : 370 jQuery('#extra-fields').load('<?php echo esc_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo esc_attr($selection); ?>'}, function() { 371 <?php 372 $content = ''; 373 if ( preg_match("/youtube\.com\/watch/i", $url) ) { 374 list($domain, $video_id) = explode("v=", $url); 375 $video_id = esc_attr($video_id); 376 $content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; 377 378 } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { 379 list($domain, $video_id) = explode(".com/", $url); 380 $video_id = esc_attr($video_id); 381 $content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" /> <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&server=www.vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>'; 382 383 if ( trim($selection) == '' ) 384 $selection = '<p><a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a></p>'; 385 386 } elseif ( strpos( $selection, '<object' ) !== false ) { 387 $content = $selection; 388 } 389 ?> 390 jQuery('#embed-code').prepend('<?php echo htmlentities($content); ?>'); 391 }); 392 jQuery('#extra-fields').show(); 393 return false; 394 break; 395 case 'photo' : 396 function setup_photo_actions() { 397 jQuery('.close').click(function() { 398 jQuery('#extra-fields').hide(); 399 jQuery('#extra-fields').html(''); 400 }); 401 jQuery('.refresh').click(function() { 402 photostorage = false; 403 show('photo'); 404 }); 405 jQuery('#photo-add-url').click(function(){ 406 var form = jQuery('#photo-add-url-div').clone(); 407 jQuery('#img_container').empty().append( form.show() ); 408 }); 409 jQuery('#waiting').hide(); 410 jQuery('#extra-fields').show(); 411 } 412 413 jQuery('#waiting').show(); 414 if(photostorage == false) { 415 jQuery.ajax({ 416 type: "GET", 417 cache : false, 418 url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>", 419 data: "ajax=photo_js&u=<?php echo urlencode($url)?>", 420 dataType : "script", 421 success : function(data) { 422 eval(data); 423 photostorage = jQuery('#extra-fields').html(); 424 setup_photo_actions(); 425 } 426 }); 427 } else { 428 jQuery('#extra-fields').html(photostorage); 429 setup_photo_actions(); 430 } 431 return false; 432 break; 433 } 434 } 435 jQuery(document).ready(function($) { 436 var $contnet = $( '#content' ); 437 438 // Resize screen. 439 window.resizeTo(760,580); 440 441 // Set button actions. 442 jQuery('#photo_button').click(function() { show('photo'); return false; }); 443 jQuery('#video_button').click(function() { show('video'); return false; }); 444 445 // Auto select. 446 <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?> 447 show('video'); 448 <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?> 449 show('video'); 450 <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?> 451 show('photo'); 452 <?php } ?> 453 jQuery('#title').unbind(); 454 jQuery('#publish, #save').click(function() { jQuery('.press-this #publishing-actions .spinner').css('display', 'inline-block'); }); 455 456 $('#tagsdiv-post_tag, #categorydiv').children('h3, .handlediv').click(function(){ 457 $(this).siblings('.inside').toggle(); 458 }); 459 460 if ( $( '#wp-content-wrap' ).hasClass( 'html-active' ) && window.switchEditors && 461 ( tinyMCEPreInit.mceInit.content && tinyMCEPreInit.mceInit.content.wpautop ) ) { 462 // The Text editor is default, run the initial content through pre_wpautop() to convert the paragraphs 463 $contnet.text( window.switchEditors.pre_wpautop( $contnet.text() ) ); 464 } 465 }); 466 </script> 467 </head> 468 <?php 469 $admin_body_class = ( is_rtl() ) ? 'rtl' : ''; 470 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); 471 ?> 472 <body class="press-this wp-admin wp-core-ui <?php echo $admin_body_class; ?>"> 473 <form action="press-this.php?action=post" method="post"> 474 <div id="poststuff" class="metabox-holder"> 475 <div id="side-sortables" class="press-this-sidebar"> 476 <div class="sleeve"> 477 <?php wp_nonce_field('press-this') ?> 478 <input type="hidden" name="post_type" id="post_type" value="text"/> 479 <input type="hidden" name="autosave" id="autosave" /> 480 <input type="hidden" id="original_post_status" name="original_post_status" value="draft" /> 481 <input type="hidden" id="prev_status" name="prev_status" value="draft" /> 482 <input type="hidden" id="post_id" name="post_id" value="<?php echo (int) $post_ID; ?>" /> 483 484 <!-- This div holds the photo metadata --> 485 <div class="photolist"></div> 486 487 <div id="submitdiv" class="postbox"> 488 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> 489 <h3 class="hndle"><?php _e('Press This') ?></h3> 490 <div class="inside"> 491 <p id="publishing-actions"> 492 <?php 493 submit_button( __( 'Save Draft' ), 'button', 'draft', false, array( 'id' => 'save' ) ); 494 if ( current_user_can('publish_posts') ) { 495 submit_button( __( 'Publish' ), 'primary', 'publish', false ); 496 } else { 497 echo '<br /><br />'; 498 submit_button( __( 'Submit for Review' ), 'primary', 'review', false ); 499 } ?> 500 <span class="spinner" style="display: none;"></span> 501 </p> 502 <?php if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) : 503 $post_formats = get_theme_support( 'post-formats' ); 504 if ( is_array( $post_formats[0] ) ) : 505 $default_format = get_option( 'default_post_format', '0' ); 506 ?> 507 <p> 508 <label for="post_format"><?php _e( 'Post Format:' ); ?> 509 <select name="post_format" id="post_format"> 510 <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option> 511 <?php foreach ( $post_formats[0] as $format ): ?> 512 <option<?php selected( $default_format, $format ); ?> value="<?php echo esc_attr( $format ); ?>"> <?php echo esc_html( get_post_format_string( $format ) ); ?></option> 513 <?php endforeach; ?> 514 </select></label> 515 </p> 516 <?php endif; endif; ?> 517 </div> 518 </div> 519 520 <?php $tax = get_taxonomy( 'category' ); ?> 521 <div id="categorydiv" class="postbox"> 522 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> 523 <h3 class="hndle"><?php _e('Categories') ?></h3> 524 <div class="inside"> 525 <div id="taxonomy-category" class="categorydiv"> 526 527 <ul id="category-tabs" class="category-tabs"> 528 <li class="tabs"><a href="#category-all"><?php echo $tax->labels->all_items; ?></a></li> 529 <li class="hide-if-no-js"><a href="#category-pop"><?php _e( 'Most Used' ); ?></a></li> 530 </ul> 531 532 <div id="category-pop" class="tabs-panel" style="display: none;"> 533 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 534 <?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?> 535 </ul> 536 </div> 537 538 <div id="category-all" class="tabs-panel"> 539 <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> 540 <?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?> 541 </ul> 542 </div> 543 544 <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?> 545 <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p> 546 <?php endif; ?> 547 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> 548 <div id="category-adder" class="wp-hidden-children"> 549 <h4> 550 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js"> 551 <?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?> 552 </a> 553 </h4> 554 <p id="category-add" class="category-add wp-hidden-child"> 555 <label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label> 556 <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/> 557 <label class="screen-reader-text" for="newcategory_parent"> 558 <?php echo $tax->labels->parent_item_colon; ?> 559 </label> 560 <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?> 561 <input type="button" id="category-add-submit" data-wp-lists="add:categorychecklist:category-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" /> 562 <?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?> 563 <span id="category-ajax-response"></span> 564 </p> 565 </div> 566 <?php endif; ?> 567 </div> 568 </div> 569 </div> 570 571 <div id="tagsdiv-post_tag" class="postbox"> 572 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> 573 <h3><span><?php _e('Tags'); ?></span></h3> 574 <div class="inside"> 575 <div class="tagsdiv" id="post_tag"> 576 <div class="jaxtag"> 577 <label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?></label> 578 <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> 579 <div class="ajaxtag"> 580 <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> 581 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /> 582 </div> 583 </div> 584 <div class="tagchecklist"></div> 585 </div> 586 <p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags'); ?></a></p> 587 </div> 588 </div> 589 </div> 590 </div> 591 <div class="posting"> 592 593 <div id="wphead"> 594 <h1 id="site-heading"> 595 <a href="<?php echo get_option('home'); ?>/" target="_blank"> 596 <span id="site-title"><?php bloginfo('name'); ?></span> 597 </a> 598 </h1> 599 </div> 600 601 <?php 602 if ( isset($posted) && intval($posted) ) { 603 $post_ID = intval($posted); ?> 604 <div id="message" class="updated"> 605 <p><strong><?php _e('Your post has been saved.'); ?></strong> 606 <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink($post_ID); ?>"><?php _e('View post'); ?></a> 607 | <a href="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit Post'); ?></a> 608 | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p> 609 </div> 610 <?php } ?> 611 612 <div id="titlediv"> 613 <div class="titlewrap"> 614 <input name="title" id="title" class="text" type="text" value="<?php echo esc_attr($title);?>"/> 615 </div> 616 </div> 617 618 <div id="waiting" style="display: none"><span class="spinner"></span> <span><?php esc_html_e( 'Loading…' ); ?></span></div> 619 620 <div id="extra-fields" style="display: none"></div> 621 622 <div class="postdivrich"> 623 <?php 624 625 $editor_settings = array( 626 'teeny' => true, 627 'textarea_rows' => '15' 628 ); 629 630 $content = ''; 631 if ( $selection ) 632 $content .= $selection; 633 634 if ( $url ) { 635 $content .= '<p>'; 636 637 if ( $selection ) 638 $content .= __('via '); 639 640 $content .= sprintf( "<a href='%s'>%s</a>.</p>", esc_url( $url ), esc_html( $title ) ); 641 } 642 643 remove_action( 'media_buttons', 'media_buttons' ); 644 add_action( 'media_buttons', 'press_this_media_buttons' ); 645 function press_this_media_buttons() { 646 _e( 'Add:' ); 647 648 if ( current_user_can('upload_files') ) { 649 ?> 650 <a id="photo_button" title="<?php esc_attr_e('Insert an Image'); ?>" href="#"> 651 <img alt="<?php esc_attr_e('Insert an Image'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-image.gif?ver=20100531' ) ); ?>"/></a> 652 <?php 653 } 654 ?> 655 <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> 656 <?php 657 } 658 659 wp_editor( $content, 'content', $editor_settings ); 660 661 ?> 662 </div> 663 </div> 664 </div> 665 </form> 666 <div id="photo-add-url-div" style="display:none;"> 667 <table><tr> 668 <td><label for="this_photo"><?php _e('URL') ?></label></td> 669 <td><input type="text" id="this_photo" name="this_photo" class="tb_this_photo text" onkeypress="if(event.keyCode==13) image_selector(this);" /></td> 670 </tr><tr> 671 <td><label for="this_photo_description"><?php _e('Description') ?></label></td> 672 <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> 673 </tr><tr> 674 <td><input type="button" class="button" onclick="image_selector(this)" value="<?php esc_attr_e('Insert Image'); ?>" /></td> 675 </tr></table> 676 </div> 677 <?php 678 /** This action is documented in wp-admin/admin-footer.php */ 679 do_action( 'admin_footer' ); 680 /** This action is documented in wp-admin/admin-footer.php */ 681 do_action( 'admin_print_footer_scripts' ); 682 ?> 683 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> 684 </body> 685 </html> 21 $GLOBALS['wp_press_this']->html();
Note: See TracChangeset
for help on using the changeset viewer.