-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-form.php
90 lines (80 loc) · 4.3 KB
/
post-form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
* Front-end post form.
*
* @package P3
*/
?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
$('#post_format').val($('#post-types a.selected').attr('id'));
$('#post-types a').click(function(e) {
$('.post-input').hide();
$('#post-types a').removeClass('selected');
$(this).addClass('selected');
if ($(this).attr('id') == 'post') {
$('#posttitle').val("<?php echo esc_js( __('Post Title', 'p3') ); ?>");
} else {
$('#posttitle').val('');
}
$('#postbox-type-' + $(this).attr('id')).show();
$('#post_format').val($(this).attr('id'));
return false;
});
});
/* ]]> */
</script>
<?php $post_format = isset( $_GET['p'] ) ? $_GET['p'] : 'status'; ?>
<div id="postbox">
<ul id="post-types">
<li><a id="status" class="post-format-button<?php if ( 'status' == $post_format ) : ?> selected<?php endif; ?>" href="<?php echo site_url( '?p=status' ); ?>" title="<?php esc_attr_e( 'Status Update', 'p3' ); ?>"><?php _e( 'Status Update', 'p3' ); ?></a></li>
<li><a id="post" class="post-format-button<?php if ( 'post' == $post_format || 'standard' == $post_format ) : ?> selected<?php endif; ?>" href="<?php echo site_url( '?p=post' ); ?>" title="<?php esc_attr_e( 'Blog Post', 'p3' ); ?>"><?php _e( 'Blog Post', 'p3' ); ?></a></li>
<li><a id="quote" class="post-format-button<?php if ( 'quote' == $post_format ) : ?> selected<?php endif; ?>" href="<?php echo site_url( '?p=quote' ); ?>" title="<?php esc_attr_e( 'Quote', 'p3' ); ?>"><?php _e( 'Quote', 'p3' ); ?></a></li>
<li><a id="link" class="post-format-button<?php if ( 'link' == $post_format ) : ?> selected<?php endif; ?>" href="<?php echo site_url( '?p=link' ); ?>" title="<?php esc_attr_e( 'Link', 'p3' ); ?>"><?php _e( 'Link', 'p3' ); ?></a></li>
</ul>
<div class="avatar">
<?php echo get_avatar( get_current_user_id(), 48 ); ?>
</div>
<div class="inputarea">
<form id="new_post" name="new_post" method="post" action="<?php echo site_url(); ?>/">
<?php if ( 'status' == $post_format || empty( $post_format ) ) : ?>
<label for="posttext" id="post-prompt">
<?php p3_user_prompt(); ?>
</label>
<?php endif; ?>
<div id="postbox-type-post" class="post-input <?php if ( 'post' == $post_format || 'standard' == $post_format ) echo ' selected'; ?>">
<input type="text" name="posttitle" id="posttitle" value=""
onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Post Title', 'p3' ) ); ?>') ? '' : this.value;"
onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Post Title', 'p3' ) ); ?>' : this.value;" />
</div>
<?php if ( current_user_can( 'upload_files' ) ): ?>
<div id="media-buttons" class="hide-if-no-js">
<?php p3_media_buttons(); ?>
</div>
<?php endif; ?>
<textarea class="expand70-200" name="posttext" id="posttext" rows="4" cols="60"></textarea>
<div id="postbox-type-quote" class="post-input <?php if ( 'quote' == $post_format ) echo " selected"; ?>">
<label for="postcitation" class="invisible"><?php _e( 'Citation', 'p3' ); ?></label>
<input id="postcitation" name="postcitation" type="text"
value="<?php esc_attr_e( 'Citation', 'p3' ); ?>"
onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Citation', 'p3' ) ); ?>') ? '' : this.value;"
onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Citation', 'p3' ) ); ?>' : this.value;" />
</div>
<label class="post-error" for="posttext" id="posttext_error"></label>
<div class="postrow">
<input id="tags" name="tags" type="text" autocomplete="off"
value="<?php esc_attr_e( 'Tag it', 'p3' ); ?>"
onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Tag it', 'p3' ) ); ?>') ? '' : this.value;"
onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Tag it', 'p3' ) ); ?>' : this.value;" />
<input id="submit" type="submit" value="<?php esc_attr_e( 'Post it', 'p3' ); ?>" />
</div>
<input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
<span class="progress spinner-post-new" id="ajaxActivity"></span>
<?php do_action( 'p3_post_form' ); ?>
<input type="hidden" name="action" value="post" />
<?php wp_nonce_field( 'new-post' ); ?>
</form>
</div>
<div class="clear"></div>
</div> <!-- // postbox -->