[ XREF Home ] [ Index ]

PHP Cross Reference of WordPress Trunk

Provided by Yoast

title

Body

[close]

/wp-admin/ -> press-this.php (source)

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


Generated: Wed Jun 1 08:30:02 2011 Cross-referenced by PHPXref 0.7
Provided by Yoast and awesome WordPress Hosting