PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/blog/wp-content/themes/p2/post-form.php

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 92 lines | 77 code | 8 blank | 7 comment | 20 complexity | 446682fdad9ecfee32079070f1f03013 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage P2
  5. */
  6. ?>
  7. <script type="text/javascript">
  8. /* <![CDATA[ */
  9. jQuery(document).ready(function($) {
  10. jQuery('#post_cat').val($('#post-types a.selected').attr('id'));
  11. $('#post-types a').click(function(e) {
  12. jQuery('.post-input').hide();
  13. $('#post-types a').removeClass('selected');
  14. jQuery(this).addClass('selected');
  15. if ($(this).attr('id') == 'post') {
  16. jQuery('#posttitle').val("<?php echo esc_js( __('Post Title', 'p2') ); ?>");
  17. } else {
  18. jQuery('#posttitle').val('');
  19. }
  20. jQuery('#postbox-type-' + $(this).attr('id')).show();
  21. jQuery('#post_cat').val($(this).attr('id'));
  22. return false;
  23. });
  24. });
  25. /* ]]> */
  26. </script>
  27. <?php
  28. // set default post type
  29. $post_type = p2_get_posting_type();
  30. ?>
  31. <div id="postbox">
  32. <ul id="post-types">
  33. <li><a id="status"<?php if ( $post_type == 'status' ) : ?> class="selected"<?php endif; ?> href="<?php echo site_url( '?p=status' ); ?>" title="<?php _e( 'Status Update', 'p2' ); ?>"><?php _e( 'Status Update', 'p2' ); ?></a></li>
  34. <li><a id="post"<?php if ( $post_type == 'post' ) : ?> class="selected"<?php endif; ?> href="<?php echo site_url( '?p=post' ); ?>" title="<?php _e( 'Blog Post', 'p2' ); ?>"><?php _e( 'Blog Post', 'p2' ); ?></a></li>
  35. <li><a id="quote"<?php if ( $post_type == 'quote' ) : ?> class="selected"<?php endif; ?> href="<?php echo site_url( '?p=quote' ); ?>" title="<?php _e( 'Quote', 'p2' ); ?>"><?php _e( 'Quote', 'p2' ); ?></a></li>
  36. <li><a id="link"<?php if ( $post_type == 'link' ) : ?> class="selected"<?php endif; ?> href="<?php echo site_url( '?p=link' ); ?>" title="<?php _e( 'Link', 'p2' ); ?>"><?php _e( 'Link', 'p2' ); ?></a></li>
  37. </ul>
  38. <div class="avatar">
  39. <?php p2_user_avatar( 'size=48' ); ?>
  40. </div>
  41. <div class="inputarea">
  42. <form id="new_post" name="new_post" method="post" action="<?php echo site_url(); ?>/">
  43. <?php if ( 'status' == p2_get_posting_type() || '' == p2_get_posting_type() ) : ?>
  44. <label for="posttext">
  45. <?php p2_user_prompt(); ?>
  46. </label>
  47. <?php endif; ?>
  48. <div id="postbox-type-post" class="post-input <?php if ( 'post' == p2_get_posting_type() ) echo ' selected'; ?>">
  49. <input type="text" name="posttitle" id="posttitle" tabindex="1" value=""
  50. onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Post Title', 'p2' ) ); ?>') ? '' : this.value;"
  51. onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Post Title', 'p2' ) ); ?>' : this.value;" />
  52. </div>
  53. <?php if ( current_user_can( 'upload_files' ) ): ?>
  54. <div id="media-buttons" class="hide-if-no-js">
  55. <?php echo P2::media_buttons(); ?>
  56. </div>
  57. <?php endif; ?>
  58. <textarea class="expand70-200" name="posttext" id="posttext" tabindex="1" rows="4" cols="60"></textarea>
  59. <div id="postbox-type-quote" class="post-input <?php if ( 'quote' == p2_get_posting_type() ) echo " selected"; ?>">
  60. <label for="postcitation" class="invisible"><?php _e( 'Citation', 'p2' ); ?></label>
  61. <input id="postcitation" name="postcitation" type="text" tabindex="2"
  62. value="<?php esc_attr_e( 'Citation', 'p2' ); ?>"
  63. onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Citation', 'p2' ) ); ?>') ? '' : this.value;"
  64. onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Citation', 'p2' ) ); ?>' : this.value;" />
  65. </div>
  66. <label class="post-error" for="posttext" id="posttext_error"></label>
  67. <div class="postrow">
  68. <input id="tags" name="tags" type="text" tabindex="2" autocomplete="off"
  69. value="<?php esc_attr_e( 'Tag it', 'p2' ); ?>"
  70. onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Tag it', 'p2' ) ); ?>') ? '' : this.value;"
  71. onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Tag it', 'p2' ) ); ?>' : this.value;" />
  72. <input id="submit" type="submit" tabindex="3" value="<?php esc_attr_e( 'Post it', 'p2' ); ?>" />
  73. </div>
  74. <input type="hidden" name="post_cat" id="post_cat" value="<?php echo esc_attr( $post_type ); ?>" />
  75. <span class="progress" id="ajaxActivity">
  76. <img src="<?php echo str_replace( WP_CONTENT_DIR, content_url(), locate_template( array( 'i/indicator.gif' ) ) ); ?>"
  77. alt="<?php esc_attr_e( 'Loading...', 'p2' ); ?>" title="<?php esc_attr_e( 'Loading...', 'p2' ); ?>"/>
  78. </span>
  79. <input type="hidden" name="action" value="post" />
  80. <?php wp_nonce_field( 'new-post' ); ?>
  81. </form>
  82. </div>
  83. <div class="clear"></div>
  84. </div> <!-- // postbox -->