PageRenderTime 62ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-admin/press-this.php

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