Guest User

Untitled

a guest
Jan 5th, 2011
356
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * Press This Display and Handler.
  4. *
  5. * @package WordPress
  6. * @subpackage Press_This
  7. */
  8.  
  9. /** WordPress Administration Bootstrap */
  10. require_once('./admin.php');
  11. header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
  12.  
  13. if ( ! current_user_can('edit_posts') )
  14. wp_die( __( 'Cheatin&#8217; uh?' ) );
  15.  
  16. /**
  17. * Press It form handler.
  18. *
  19. * @package WordPress
  20. * @subpackage Press_This
  21. * @since 2.6.0
  22. *
  23. * @return int Post ID
  24. */
  25. function press_it() {
  26. // define some basic variables
  27. $quick['post_status'] = 'draft'; // set as draft first
  28. $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
  29. $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
  30. $quick['post_title'] = ( trim($_POST['title']) != '' ) ? $_POST['title'] : ' ';
  31. $quick['post_content'] = isset($_POST['post_content']) ? $_POST['post_content'] : '';
  32. $linked_list_url = $_REQUEST['linked_list_url'];
  33.  
  34. // insert the post with nothing in it, to get an ID
  35. $post_ID = wp_insert_post($quick, true);
  36. if ( is_wp_error($post_ID) )
  37. wp_die($post_ID);
  38.  
  39. $content = isset($_POST['content']) ? $_POST['content'] : '';
  40.  
  41. $upload = false;
  42. if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) {
  43. foreach( (array) $_POST['photo_src'] as $key => $image) {
  44. // see if files exist in content - we don't want to upload non-used selected files.
  45. if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) {
  46. $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : '';
  47. $upload = media_sideload_image($image, $post_ID, $desc);
  48.  
  49. // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
  50. if ( !is_wp_error($upload) )
  51. $content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
  52. }
  53. }
  54. }
  55. // set the post_content and status
  56. $quick['post_status'] = isset($_POST['publish']) ? 'publish' : 'draft';
  57. $quick['post_content'] = $content;
  58. // error handling for media_sideload
  59. if ( is_wp_error($upload) ) {
  60. wp_delete_post($post_ID);
  61. wp_die($upload);
  62. } else {
  63. $quick['ID'] = $post_ID;
  64. wp_update_post($quick);
  65. add_post_meta($post_ID, 'linked_list_url', $linked_list_url, false);
  66.  
  67. }
  68. return $post_ID;
  69. }
  70.  
  71. // For submitted posts.
  72. if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) {
  73. check_admin_referer('press-this');
  74. $post_ID = press_it();
  75. $posted = $post_ID;
  76. } else {
  77. $post_ID = 0;
  78. }
  79.  
  80. // Set Variables
  81. $title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : '';
  82.  
  83. $selection = '';
  84. if ( !empty($_GET['s']) ) {
  85. $selection = str_replace('&apos;', "'", stripslashes($_GET['s']));
  86. $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) );
  87. }
  88.  
  89. if ( ! empty($selection) ) {
  90. $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
  91. $selection = '<p>' . str_replace('<p></p>', '', $selection) . '</p>';
  92. }
  93.  
  94. $url = isset($_GET['u']) ? esc_url($_GET['u']) : '';
  95. $image = isset($_GET['i']) ? $_GET['i'] : '';
  96.  
  97. if ( !empty($_REQUEST['ajax']) ) {
  98. switch ($_REQUEST['ajax']) {
  99. case 'video': ?>
  100. <script type="text/javascript" charset="utf-8">
  101. /* <![CDATA[ */
  102. jQuery('.select').click(function() {
  103. append_editor(jQuery('#embed-code').val());
  104. jQuery('#extra-fields').hide();
  105. jQuery('#extra-fields').html('');
  106. });
  107. jQuery('.close').click(function() {
  108. jQuery('#extra-fields').hide();
  109. jQuery('#extra-fields').html('');
  110. });
  111. /* ]]> */
  112. </script>
  113. <div class="postbox">
  114. <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2>
  115. <div class="inside">
  116. <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo wp_htmledit_pre( $selection ); ?></textarea>
  117. <p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p>
  118. </div>
  119. </div>
  120. <?php break;
  121.  
  122. case 'photo_thickbox': ?>
  123. <script type="text/javascript" charset="utf-8">
  124. /* <![CDATA[ */
  125. jQuery('.cancel').click(function() {
  126. tb_remove();
  127. });
  128. jQuery('.select').click(function() {
  129. image_selector();
  130. });
  131. /* ]]> */
  132. </script>
  133. <h3 class="tb"><label for="this_photo_description"><?php _e('Description') ?></label></h3>
  134. <div class="titlediv">
  135. <div class="titlewrap">
  136. <input id="this_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/>
  137. </div>
  138. </div>
  139.  
  140. <p class="centered">
  141. <input type="hidden" name="this_photo" value="<?php echo esc_attr($image); ?>" id="this_photo" />
  142. <a href="#" class="select">
  143. <img src="<?php echo esc_url($image); ?>" alt="<?php echo esc_attr(__('Click to insert.')); ?>" title="<?php echo esc_attr(__('Click to insert.')); ?>" />
  144. </a>
  145. </p>
  146.  
  147. <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
  148. <?php break;
  149.  
  150. case 'photo_thickbox_url': ?>
  151. <script type="text/javascript" charset="utf-8">
  152. /* <![CDATA[ */
  153. jQuery('.cancel').click(function() {
  154. tb_remove();
  155. });
  156.  
  157. jQuery('.select').click(function() {
  158. image_selector();
  159. });
  160. /* ]]> */
  161. </script>
  162. <h3 class="tb"><label for="this_photo"><?php _e('URL') ?></label></h3>
  163. <div class="titlediv">
  164. <div class="titlewrap">
  165. <input id="this_photo" name="this_photo" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" />
  166. </div>
  167. </div>
  168. <h3 class="tb"><label for="photo_description"><?php _e('Description') ?></label></h3>
  169. <div id="titlediv">
  170. <div class="titlewrap">
  171. <input id="this_photo_description" name="photo_description" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo esc_attr($title);?>"/>
  172. </div>
  173. </div>
  174.  
  175. <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p>
  176. <?php break;
  177. case 'photo_images':
  178. /**
  179. * Retrieve all image URLs from given URI.
  180. *
  181. * @package WordPress
  182. * @subpackage Press_This
  183. * @since 2.6.0
  184. *
  185. * @param string $uri
  186. * @return string
  187. */
  188. function get_images_from_uri($uri) {
  189. $uri = preg_replace('/\/#.+?$/','', $uri);
  190. if ( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )
  191. return "'" . esc_attr( html_entity_decode($uri) ) . "'";
  192. $content = wp_remote_fopen($uri);
  193. if ( false === $content )
  194. return '';
  195. $host = parse_url($uri);
  196. $pattern = '/<img ([^>]*)src=(\"|\')([^<>\'\"]+)(\2)([^>]*)\/*>/i';
  197. $content = str_replace(array("\n","\t","\r"), '', $content);
  198. preg_match_all($pattern, $content, $matches);
  199. if ( empty($matches[0]) )
  200. return '';
  201. $sources = array();
  202. foreach ($matches[3] as $src) {
  203. // if no http in url
  204. if (strpos($src, 'http') === false)
  205. // if it doesn't have a relative uri
  206. if ( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0)
  207. $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
  208. else
  209. $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
  210. $sources[] = esc_attr($src);
  211. }
  212. return "'" . implode("','", $sources) . "'";
  213. }
  214. $url = wp_kses(urldecode($url), null);
  215. echo 'new Array('.get_images_from_uri($url).')';
  216. break;
  217.  
  218. case 'photo_js': ?>
  219. // gather images and load some default JS
  220. var last = null
  221. var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
  222. if(photostorage == false) {
  223. var my_src = eval(
  224. jQuery.ajax({
  225. type: "GET",
  226. url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
  227. cache : false,
  228. async : false,
  229. data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
  230. dataType : "script"
  231. }).responseText
  232. );
  233. if(my_src.length == 0) {
  234. var my_src = eval(
  235. jQuery.ajax({
  236. type: "GET",
  237. url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
  238. cache : false,
  239. async : false,
  240. data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
  241. dataType : "script"
  242. }).responseText
  243. );
  244. if(my_src.length == 0) {
  245. strtoappend = '<?php _e('Unable to retrieve images or no images on page.'); ?>';
  246. }
  247. }
  248. }
  249. for (i = 0; i < my_src.length; i++) {
  250. img = new Image();
  251. img.src = my_src[i];
  252. img_attr = 'id="img' + i + '"';
  253. skip = false;
  254.  
  255. maybeappend = '<a href="?ajax=photo_thickbox&amp;i=' + encodeURIComponent(img.src) + '&amp;u=<?php echo urlencode($url); ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
  256.  
  257. if (img.width && img.height) {
  258. if (img.width >= 30 && img.height >= 30) {
  259. aspect = img.width / img.height;
  260. scale = (aspect > 1) ? (71 / img.width) : (71 / img.height);
  261.  
  262. w = img.width;
  263. h = img.height;
  264.  
  265. if (scale < 1) {
  266. w = parseInt(img.width * scale);
  267. h = parseInt(img.height * scale);
  268. }
  269. img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
  270. strtoappend += maybeappend;
  271. }
  272. } else {
  273. strtoappend += maybeappend;
  274. }
  275. }
  276.  
  277. function pick(img, desc) {
  278. if (img) {
  279. if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length;
  280. if(length == 0) length = 1;
  281. jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
  282. jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
  283. insert_editor( "\n\n" + encodeURI('<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>'));
  284. }
  285. return false;
  286. }
  287.  
  288. function image_selector() {
  289. tb_remove();
  290. desc = jQuery('#this_photo_description').val();
  291. src = jQuery('#this_photo').val();
  292. pick(src, desc);
  293. jQuery('#extra-fields').hide();
  294. jQuery('#extra-fields').html('');
  295. return false;
  296. }
  297. 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>');
  298. jQuery('#img_container').html(strtoappend);
  299. <?php break;
  300. }
  301. die;
  302. }
  303.  
  304. ?>
  305. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  306. <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
  307. <head>
  308. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
  309. <title><?php _e('Press This') ?></title>
  310.  
  311. <?php
  312. add_thickbox();
  313. wp_enqueue_style( 'press-this' );
  314. wp_enqueue_style( 'press-this-ie');
  315. wp_enqueue_style( 'colors' );
  316. wp_enqueue_script( 'post' );
  317. wp_enqueue_script( 'editor' );
  318. ?>
  319. <script type="text/javascript">
  320. //<![CDATA[
  321. 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();}}};
  322. 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() ?>'};
  323. var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = 'press-this';
  324. var photostorage = false;
  325. //]]>
  326. </script>
  327.  
  328. <?php
  329. do_action('admin_print_styles');
  330. do_action('admin_print_scripts');
  331. do_action('admin_head');
  332.  
  333. if ( user_can_richedit() )
  334. wp_tiny_mce( true, array( 'height' => '370' ) );
  335. ?>
  336. <script type="text/javascript">
  337. function insert_plain_editor(text) {
  338. edCanvas = document.getElementById('content');
  339. edInsertContent(edCanvas, text);
  340. }
  341. function set_editor(text) {
  342. if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>';
  343. if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
  344. }
  345. function insert_editor(text) {
  346. if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
  347. tinyMCE.execCommand('mceInsertContent', false, '<p>' + decodeURI(tinymce.DOM.decode(text)) + '</p>', {format : 'raw'});
  348. } else {
  349. insert_plain_editor(decodeURI(text));
  350. }
  351. }
  352. function append_editor(text) {
  353. if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
  354. tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>');
  355. tinyMCE.execCommand('mceCleanup');
  356. } else {
  357. insert_plain_editor(text);
  358. }
  359. }
  360.  
  361. function show(tab_name) {
  362. jQuery('#extra-fields').html('');
  363. switch(tab_name) {
  364. case 'video' :
  365. jQuery('#extra-fields').load('<?php echo esc_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo esc_attr($selection); ?>'}, function() {
  366. <?php
  367. $content = '';
  368. if ( preg_match("/youtube\.com\/watch/i", $url) ) {
  369. list($domain, $video_id) = split("v=", $url);
  370. $video_id = esc_attr($video_id);
  371. $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>';
  372.  
  373. } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
  374. list($domain, $video_id) = split(".com/", $url);
  375. $video_id = esc_attr($video_id);
  376. $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 . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /> <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
  377.  
  378. if ( trim($selection) == '' )
  379. $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>';
  380.  
  381. } elseif ( strpos( $selection, '<object' ) !== false ) {
  382. $content = $selection;
  383. }
  384. ?>
  385. jQuery('#embed-code').prepend('<?php echo htmlentities($content); ?>');
  386. });
  387. jQuery('#extra-fields').show();
  388. return false;
  389. break;
  390. case 'photo' :
  391. function setup_photo_actions() {
  392. jQuery('.close').click(function() {
  393. jQuery('#extra-fields').hide();
  394. jQuery('#extra-fields').html('');
  395. });
  396. jQuery('.refresh').click(function() {
  397. photostorage = false;
  398. show('photo');
  399. });
  400. jQuery('#photo-add-url').attr('href', '?ajax=photo_thickbox_url&height=200&width=500');
  401. tb_init('#extra-fields .thickbox');
  402. jQuery('#waiting').hide();
  403. jQuery('#extra-fields').show();
  404. }
  405. jQuery('#extra-fields').before('<div id="waiting"><img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> <?php echo esc_js( __( 'Loading...' ) ); ?></div>');
  406.  
  407. if(photostorage == false) {
  408. jQuery.ajax({
  409. type: "GET",
  410. cache : false,
  411. url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
  412. data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
  413. dataType : "script",
  414. success : function(data) {
  415. eval(data);
  416. photostorage = jQuery('#extra-fields').html();
  417. setup_photo_actions();
  418. }
  419. });
  420. } else {
  421. jQuery('#extra-fields').html(photostorage);
  422. setup_photo_actions();
  423. }
  424. return false;
  425. break;
  426. }
  427. }
  428. jQuery(document).ready(function($) {
  429. //resize screen
  430. window.resizeTo(720,540);
  431. // set button actions
  432. jQuery('#photo_button').click(function() { show('photo'); return false; });
  433. jQuery('#video_button').click(function() { show('video'); return false; });
  434. // auto select
  435. <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
  436. show('video');
  437. <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
  438. show('video');
  439. <?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?>
  440. show('photo');
  441. <?php } ?>
  442. jQuery('#title').unbind();
  443. jQuery('#publish, #save').click(function() { jQuery('#saving').css('display', 'inline'); });
  444.  
  445. $('#tagsdiv-post_tag, #categorydiv').children('h3, .handlediv').click(function(){
  446. $(this).siblings('.inside').toggle();
  447. });
  448. });
  449. </script>
  450. </head>
  451. <body class="press-this wp-admin">
  452. <div id="wphead"></div>
  453. <form action="press-this.php?action=post" method="post">
  454. <div id="poststuff" class="metabox-holder">
  455. <div id="side-info-column">
  456. <div class="sleeve">
  457. <h1 id="viewsite"><a href="<?php echo get_option('home'); ?>/" target="_blank"><?php bloginfo('name'); ?> &rsaquo; <?php _e('Press This') ?></a></span></h1>
  458.  
  459. <?php wp_nonce_field('press-this') ?>
  460. <input type="hidden" name="post_type" id="post_type" value="text"/>
  461. <input type="hidden" name="autosave" id="autosave" />
  462. <input type="hidden" id="original_post_status" name="original_post_status" value="draft" />
  463. <input type="hidden" id="prev_status" name="prev_status" value="draft" />
  464.  
  465. <!-- This div holds the photo metadata -->
  466. <div class="photolist"></div>
  467.  
  468. <div id="submitdiv" class="stuffbox">
  469. <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>">
  470. <br/>
  471. </div>
  472. <h3><?php _e('Publish') ?></h3>
  473. <div class="inside">
  474. <p>
  475. <input class="button" type="submit" name="draft" value="<?php esc_attr_e('Save Draft') ?>" id="save" />
  476. <?php if ( current_user_can('publish_posts') ) { ?>
  477. <input class="button-primary" type="submit" name="publish" value="<?php esc_attr_e('Publish') ?>" id="publish" />
  478. <?php } else { ?>
  479. <br /><br /><input class="button-primary" type="submit" name="review" value="<?php esc_attr_e('Submit for Review') ?>" id="review" />
  480. <?php } ?>
  481. <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" id="saving" style="display:none;" />
  482. </p>
  483. </div>
  484. </div>
  485.  
  486. <?php $tax = get_taxonomy( 'category' ); ?>
  487. <div id="categorydiv" class="postbox">
  488. <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>"><br /></div>
  489. <h3 class="hndle"><?php _e('Categories') ?></h3>
  490. <div class="inside">
  491. <div id="taxonomy-category" class="categorydiv">
  492.  
  493. <ul id="category-tabs" class="category-tabs">
  494. <li class="tabs"><a href="#category-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li>
  495. <li class="hide-if-no-js"><a href="#category-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
  496. </ul>
  497.  
  498. <div id="category-pop" class="tabs-panel" style="display: none;">
  499. <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
  500. <?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?>
  501. </ul>
  502. </div>
  503.  
  504. <div id="category-all" class="tabs-panel">
  505. <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
  506. <?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?>
  507. </ul>
  508. </div>
  509.  
  510. <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?>
  511. <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p>
  512. <?php endif; ?>
  513. <?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
  514. <div id="category-adder" class="wp-hidden-children">
  515. <h4>
  516. <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3">
  517. <?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?>
  518. </a>
  519. </h4>
  520. <p id="category-add" class="category-add wp-hidden-child">
  521. <label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label>
  522. <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"/>
  523. <label class="screen-reader-text" for="newcategory_parent">
  524. <?php echo $tax->labels->parent_item_colon; ?>
  525. </label>
  526. <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;', 'tab_index' => 3 ) ); ?>
  527. <input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-sumbit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" tabindex="3" />
  528. <?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?>
  529. <span id="category-ajax-response"></span>
  530. </p>
  531. </div>
  532. <?php endif; ?>
  533. </div>
  534. </div>
  535. </div>
  536.  
  537. <div id="tagsdiv-post_tag" class="stuffbox" >
  538. <div class="handlediv" title="<?php _e( 'Click to toggle' ); ?>">
  539. <br/>
  540. </div>
  541. <h3><span><?php _e('Post Tags'); ?></span></h3>
  542. <div class="inside">
  543. <div class="tagsdiv" id="post_tag">
  544. <p class="jaxtag">
  545. <label class="screen-reader-text" for="newtag"><?php _e('Post Tags'); ?></label>
  546. <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" />
  547. <div class="ajaxtag">
  548. <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
  549. <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
  550. </div>
  551. </p>
  552. <div class="tagchecklist"></div>
  553. </div>
  554. <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>
  555. </div>
  556. </div>
  557. </div>
  558. </div>
  559. <div class="posting">
  560. <?php if ( isset($posted) && intval($posted) ) { $post_ID = intval($posted); ?>
  561. <div id="message" class="updated"><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>
  562. <?php } ?>
  563.  
  564. <div id="titlediv">
  565. <div class="titlewrap">
  566. <input name="title" id="title" class="text" value="<?php echo esc_attr($title);?>"/>
  567. </div>
  568. </div>
  569.  
  570. <div id="extra-fields" style="display: none"></div>
  571.  
  572. <div class="postdivrich">
  573. <ul id="actions" class="actions">
  574.  
  575. <li id="photo_button">
  576. Add: <?php if ( current_user_can('upload_files') ) { ?><a title="<?php _e('Insert an Image'); ?>" href="#">
  577. <img alt="<?php _e('Insert an Image'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-image.gif?ver=20100531' ) ); ?>"/></a>
  578. <?php } ?>
  579. </li>
  580. <li id="video_button">
  581. <a title="<?php _e('Embed a Video'); ?>" href="#"><img alt="<?php _e('Embed a Video'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-video.gif?ver=20100531' ) ); ?>"/></a>
  582. </li>
  583. <?php if ( user_can_richedit() ) { ?>
  584. <li id="switcher">
  585. <?php wp_print_scripts( 'quicktags' ); ?>
  586. <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?>
  587. <a id="edButtonHTML" onclick="switchEditors.go('content', 'html');"><?php _e('HTML'); ?></a>
  588. <a id="edButtonPreview" class="active" onclick="switchEditors.go('content', 'tinymce');"><?php _e('Visual'); ?></a>
  589. <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('content')" /></div>
  590. </li>
  591. <?php } ?>
  592. </ul>
  593. <div id="quicktags"></div>
  594. <div class="editor-container">
  595. <textarea name="content" id="content" style="width:100%;" class="theEditor" rows="15"><?php
  596. if ( $selection )
  597. echo wp_richedit_pre($selection);
  598. if ( $url ) {
  599. echo '<p>';
  600. if ( $selection )
  601. _e('via ');
  602. printf( "<a href='%s'>%s</a>.</p>", esc_url( $url ), esc_html( $title ) );
  603. }
  604. ?></textarea>
  605. <h3>My Link URL</h3>
  606.  
  607. <input name="linked_list_url" type="text" id="elink" class="mceEditor" style="width:100%;" value="<?php echo $url; ?>"/>
  608.  
  609. </div>
  610. </div>
  611. </div>
  612. </div>
  613. </form>
  614. <?php do_action('admin_print_footer_scripts'); ?>
  615. <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
  616. </body>
  617. </html>
RAW Paste Data