PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-admin/press-this.php

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