bulk-add.php
7 years ago
clone-form.php
7 years ago
delete-confirmation-modal.php
7 years ago
empty-trash-modal.php
7 years ago
link-form.php
7 years ago
new-child.php
8 years ago
quickedit-link.php
8 years ago
quickedit-post.php
7 years ago
quickedit-post.php
261 lines
| 1 | <?php |
| 2 | /** |
| 3 | * See public inline_edit method of WP_Posts_List_Table class |
| 4 | */ |
| 5 | $post_type_object = get_post_type_object( 'page' ); |
| 6 | $can_publish = current_user_can( $post_type_object->cap->publish_posts ); |
| 7 | $wpml_pages = ( $this->integrations->plugins->wpml->installed && $this->integrations->plugins->wpml->isDefaultLanguage()) ? true : false; |
| 8 | if ( !$this->integrations->plugins->wpml->installed ) $wpml_pages = true; |
| 9 | $has_taxonomies = ( !empty($this->h_taxonomies) || !empty($this->f_taxonomies) ) ? true : false; |
| 10 | ?> |
| 11 | |
| 12 | <form method="get" action=""> |
| 13 | <div class="form-interior"> |
| 14 | <h3><?php _e('Quick Edit', 'wp-nested-pages'); ?><span class="page_id"></span></h3> |
| 15 | |
| 16 | <div class="np-quickedit-error" style="clear:both;display:none;"></div> |
| 17 | |
| 18 | <div class="fields"> |
| 19 | |
| 20 | <div class="left"> |
| 21 | |
| 22 | <?php if ( !array_key_exists('title', $this->disabled_standard_fields) ) : ?> |
| 23 | <div class="form-control"> |
| 24 | <label><?php _e( 'Title' ); ?></label> |
| 25 | <input type="text" name="post_title" class="np_title" value="" /> |
| 26 | </div> |
| 27 | <?php endif; ?> |
| 28 | |
| 29 | <?php if ( !array_key_exists('slug', $this->disabled_standard_fields) ) : ?> |
| 30 | <div class="form-control"> |
| 31 | <label><?php _e( 'Slug' ); ?></label> |
| 32 | <input type="text" name="post_name" class="np_slug" value="" /> |
| 33 | </div> |
| 34 | <?php endif; ?> |
| 35 | |
| 36 | <?php if ( !array_key_exists('date', $this->disabled_standard_fields) ) : ?> |
| 37 | <?php if ( $this->settings->datepickerEnabled() ) : ?> |
| 38 | <div class="form-control np-datepicker-container"> |
| 39 | <label><?php _e( 'Date' ); ?></label> |
| 40 | <div class="datetime"> |
| 41 | <input type="text" name="np_date" class="np_datepicker" value="" /> |
| 42 | <span><?php _e('@', 'wp-nested-pages'); ?></span> |
| 43 | <div class="np-time-container"> |
| 44 | <?php if ( get_option('time_format') !== 'H:i' ) : ?> |
| 45 | <select name="np_ampm" class="np_ampm"> |
| 46 | <option value="am"><?php _e('am', 'wp-nested-pages'); ?></option> |
| 47 | <option value="pm"><?php _e('pm', 'wp-nested-pages'); ?></option> |
| 48 | </select> |
| 49 | <?php endif; ?> |
| 50 | <input type="text" name="np_time" class="np_time" value="" /> |
| 51 | </div> |
| 52 | </div> |
| 53 | </div> |
| 54 | <?php else : ?> |
| 55 | <div> |
| 56 | <label><?php _e( 'Date' ); ?></label> |
| 57 | <div class="dates"><?php touch_time( 1, 1, 0, 1 ); ?></div> |
| 58 | </div> |
| 59 | <?php endif; endif; ?> |
| 60 | |
| 61 | <?php |
| 62 | /* |
| 63 | * Authors Dropdown |
| 64 | */ |
| 65 | if ( !array_key_exists('author', $this->disabled_standard_fields) ) : |
| 66 | $authors_dropdown = ''; |
| 67 | if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) : |
| 68 | $users_opt = [ |
| 69 | 'hide_if_only_one_author' => false, |
| 70 | 'who' => 'authors', |
| 71 | 'name' => 'post_author', |
| 72 | 'id' => 'post_author', |
| 73 | 'class'=> 'authors', |
| 74 | 'multi' => 1, |
| 75 | 'echo' => 0 |
| 76 | ]; |
| 77 | |
| 78 | if ( $authors = wp_dropdown_users( $users_opt ) ) : |
| 79 | $authors_dropdown = '<div class="form-control np_author"><label>' . __( 'Author' ) . '</label>'; |
| 80 | $authors_dropdown .= $authors; |
| 81 | $authors_dropdown .= '</div>'; |
| 82 | endif; |
| 83 | echo $authors_dropdown; |
| 84 | endif; |
| 85 | endif; |
| 86 | ?> |
| 87 | |
| 88 | <?php |
| 89 | if ( !array_key_exists('status', $this->disabled_standard_fields) ) : |
| 90 | $statuses = $this->post_type_repo->quickEditStatuses($this->post_type->name); |
| 91 | ?> |
| 92 | <div class="form-control"> |
| 93 | <label><?php _e( 'Status' ); ?></label> |
| 94 | <select name="_status" class="np_status"> |
| 95 | <?php |
| 96 | if ( $can_publish && isset($statuses['can_publish']) ) : |
| 97 | foreach ( $statuses['can_publish'] as $status => $label ){ |
| 98 | echo '<option value="' . $status . '">' . $label . '</option>'; |
| 99 | } |
| 100 | endif; |
| 101 | foreach ( $statuses['other'] as $status => $label ){ |
| 102 | echo '<option value="' . $status . '">' . $label . '</option>'; |
| 103 | } |
| 104 | ?> |
| 105 | </select> |
| 106 | </div> |
| 107 | <?php endif; ?> |
| 108 | |
| 109 | </div><!-- .left --> |
| 110 | |
| 111 | <div class="right"> |
| 112 | |
| 113 | <?php if ( $this->post_type->hierarchical && !array_key_exists('template', $this->disabled_standard_fields)) : ?> |
| 114 | <div class="form-control"> |
| 115 | <label><?php _e( 'Template' ); ?></label> |
| 116 | <select name="page_template" class="np_template"> |
| 117 | <option value="default"><?php _e( 'Default Template' ); ?></option> |
| 118 | <?php page_template_dropdown() ?> |
| 119 | </select> |
| 120 | </div> |
| 121 | <?php endif; ?> |
| 122 | |
| 123 | <?php if ( $can_publish && !array_key_exists('password', $this->disabled_standard_fields) ) : ?> |
| 124 | <div class="form-control password"> |
| 125 | <label><?php _e( 'Password' ); ?></label> |
| 126 | <input type="text" class="post_password" name="post_password" value="" /> |
| 127 | <div class="private"> |
| 128 | <em style="margin:2px 8px 0 0" class="alignleft"><?php _e( '–OR–' ); ?></em> |
| 129 | <label> |
| 130 | <input type="checkbox" class="keep_private" name="keep_private" value="private" /> |
| 131 | <?php echo __( 'Private' ); ?> |
| 132 | </label> |
| 133 | </div> |
| 134 | </div> |
| 135 | <?php endif; ?> |
| 136 | |
| 137 | <?php if ( !array_key_exists('allow_comments', $this->disabled_standard_fields) ) : ?> |
| 138 | <div class="comments"> |
| 139 | <label> |
| 140 | <input type="checkbox" name="comment_status" class="np_cs" value="open" /> |
| 141 | <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span> |
| 142 | </label> |
| 143 | </div> |
| 144 | <?php endif; ?> |
| 145 | |
| 146 | <?php if ( current_user_can('edit_theme_options') && !array_key_exists('hide_in_np', $this->disabled_standard_fields) ) : ?> |
| 147 | <div class="comments"> |
| 148 | <label> |
| 149 | <input type="checkbox" name="nested_pages_status" class="nested_pages_status" value="hide" /> |
| 150 | <span class="checkbox-title"><?php _e( 'Hide in Nested Pages', 'wp-nested-pages' ); ?></span> |
| 151 | </label> |
| 152 | </div> |
| 153 | <?php endif; // Edit theme options ?> |
| 154 | |
| 155 | <?php if ( !$this->post_type->hierarchical ) : ?> |
| 156 | <div class="comments"> |
| 157 | <label> |
| 158 | <input type="checkbox" name="sticky" class="np-sticky" value="sticky" /> |
| 159 | <span class="checkbox-title"><?php _e( 'Make Sticky', 'wp-nested-pages' ); ?></span> |
| 160 | </label> |
| 161 | </div> |
| 162 | <?php endif; ?> |
| 163 | |
| 164 | <div class="form-control np-toggle-options"> |
| 165 | <?php if ( $this->user->canSortPages() && $this->post_type->name == 'page' && !$this->listing_repo->isSearch() && !array_key_exists('menu_options', $this->disabled_standard_fields) && $wpml_pages ) : ?> |
| 166 | <a href="#" class="np-btn np-btn-half np-toggle-menuoptions"><?php _e('Menu Options', 'wp-nested-pages'); ?></a> |
| 167 | <?php endif; ?> |
| 168 | |
| 169 | <?php if ( $has_taxonomies && !array_key_exists('hide_taxonomies', $this->disabled_standard_fields) ) : ?> |
| 170 | <a href="#" class="np-btn np-btn-half btn-right np-toggle-taxonomies"><?php _e('Taxonomies', 'wp-nested-pages'); ?></a> |
| 171 | <?php endif; ?> |
| 172 | </div> |
| 173 | |
| 174 | </div><!-- .right --> |
| 175 | |
| 176 | <?php if ( $has_taxonomies ) : ?> |
| 177 | <div class="np-taxonomies"> |
| 178 | <?php |
| 179 | foreach ( $this->h_taxonomies as $taxonomy ) : |
| 180 | $disabled = $this->post_type_repo->taxonomyDisabled($taxonomy->name, $this->post_type->name); |
| 181 | if ( !$disabled ) : |
| 182 | ?> |
| 183 | <div class="np-taxonomy"> |
| 184 | <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span> |
| 185 | <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> |
| 186 | <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist"> |
| 187 | <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?> |
| 188 | </ul> |
| 189 | </div><!-- .np-taxonomy --> |
| 190 | <?php |
| 191 | endif; |
| 192 | endforeach; |
| 193 | ?> |
| 194 | |
| 195 | <?php |
| 196 | foreach ( $this->f_taxonomies as $taxonomy ) : |
| 197 | $disabled = $this->post_type_repo->taxonomyDisabled($taxonomy->name, $this->post_type->name); |
| 198 | if ( !$disabled ) : |
| 199 | ?> |
| 200 | <div class="np-taxonomy"> |
| 201 | <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span> |
| 202 | <textarea id="<?php echo esc_attr($taxonomy->name); ?>-quickedit" cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>" data-autotag data-taxonomy="<?php echo esc_attr($taxonomy->name); ?>"></textarea> |
| 203 | </div><!-- .np-taxonomy --> |
| 204 | <?php |
| 205 | endif; |
| 206 | endforeach; |
| 207 | ?> |
| 208 | </div><!-- .taxonomies --> |
| 209 | <?php endif; // if taxonomies ?> |
| 210 | |
| 211 | |
| 212 | <?php if ( $this->user->canSortPages() && !$this->listing_repo->isSearch() ) : ?> |
| 213 | <div class="np-menuoptions"> |
| 214 | <div class="menuoptions-left"> |
| 215 | <div class="form-control"> |
| 216 | <label><?php _e( 'Navigation Label' ); ?></label> |
| 217 | <input type="text" name="np_nav_title" class="np_nav_title" value="" /> |
| 218 | </div> |
| 219 | <div class="form-control"> |
| 220 | <label><?php _e( 'Title Attribute' ); ?></label> |
| 221 | <input type="text" name="np_title_attribute" class="np_title_attribute" value="" /> |
| 222 | </div> |
| 223 | <div class="form-control"> |
| 224 | <label><?php _e( 'CSS Classes' ); ?></label> |
| 225 | <input type="text" name="np_nav_css_classes" class="np_nav_css_classes" value="" /> |
| 226 | </div> |
| 227 | </div><!-- .menuoptions-left --> |
| 228 | <div class="menuoptions-right"> |
| 229 | <div class="form-control"> |
| 230 | <label> |
| 231 | <input type="checkbox" name="nav_status" class="np_nav_status" value="hide" /> |
| 232 | <span class="checkbox-title"><?php _e( 'Hide in Nav Menu', 'wp-nested-pages' ); ?></span> |
| 233 | </label> |
| 234 | </div> |
| 235 | <div class="form-control"> |
| 236 | <label> |
| 237 | <input type="checkbox" name="link_target" class="link_target" value="_blank" /> |
| 238 | <span class="checkbox-title"><?php _e( 'Open link in a new window/tab' ); ?></span> |
| 239 | </label> |
| 240 | </div> |
| 241 | </div><!-- .menuoptions-right --> |
| 242 | </div> |
| 243 | <?php endif; ?> |
| 244 | |
| 245 | </div><!-- .fields --> |
| 246 | |
| 247 | </div><!-- .form-interior --> |
| 248 | |
| 249 | <div class="buttons"> |
| 250 | <input type="hidden" name="post_id" class="np_id" value="<?php echo get_the_id(); ?>"> |
| 251 | <a accesskey="c" href="#inline-edit" class="button-secondary alignleft np-cancel-quickedit"> |
| 252 | <?php _e( 'Cancel' ); ?> |
| 253 | </a> |
| 254 | <a accesskey="s" href="#inline-edit" class="button-primary np-save-quickedit alignright"> |
| 255 | <?php _e( 'Update' ); ?> |
| 256 | </a> |
| 257 | <div class="np-qe-loading"> |
| 258 | <?php include( NestedPages\Helpers::asset('images/spinner.svg') ); ?> |
| 259 | </div> |
| 260 | </div> |
| 261 | </form> |