bulk-edit.php
2 days ago
list-header.php
4 years ago
row-link.php
2 days ago
row.php
2 days ago
tool-list.php
4 years ago
wpml-translations.php
8 years ago
row.php
329 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Row represents a single page |
| 4 | */ |
| 5 | $wpml = $this->integrations->plugins->wpml->installed; |
| 6 | $wpml_pages = ( $wpml && $this->integrations->plugins->wpml->isDefaultLanguage()) ? true : false; |
| 7 | if ( !$wpml ) $wpml_pages = true; |
| 8 | ?> |
| 9 | <div class="row <?php echo apply_filters('nestedpages_row_css_classes', $row_classes, $this->post, $this->post_type); ?>"> |
| 10 | |
| 11 | <?php if ( $this->post_type->hierarchical ) : ?> |
| 12 | <div class="child-toggle"> |
| 13 | <div class="child-toggle-spacer"></div> |
| 14 | </div> |
| 15 | <?php endif; ?> |
| 16 | |
| 17 | <?php if ( !$this->post_type->hierarchical ) echo '<div class="non-hierarchical-spacer"></div>'; ?> |
| 18 | |
| 19 | <div class="row-inner"> |
| 20 | <img src="<?php echo \NestedPages\Helpers::plugin_url() . '/assets/images/arrow-child.svg'; ?>" alt="<?php _e('Arrow', 'wp-nested-pages'); ?>" class="np-icon-sub-menu"> |
| 21 | |
| 22 | <?php |
| 23 | $sortable = apply_filters('nestedpages_post_sortable', true, $this->post, $this->post_type); |
| 24 | if ( $this->user->canSortPosts($this->post_type->name) && !$this->listing_repo->isSearch() && !$this->post_type_settings->disable_sorting && $wpml_current_language !== 'all' && !$this->listing_repo->isOrdered($this->post_type->name) && $sortable ) : ?> |
| 25 | <img src="<?php echo \NestedPages\Helpers::plugin_url() . '/assets/images/handle.svg'; ?>" alt="<?php _e('Sorting Handle', 'wp-nested-pages'); ?>" class="handle np-icon-menu"> |
| 26 | <?php endif; ?> |
| 27 | |
| 28 | <a href="<?php echo apply_filters('nestedpages_edit_link', get_edit_post_link(), $this->post); ?>" class="page-link page-title"> |
| 29 | <span class="title"> |
| 30 | <?php |
| 31 | $title = apply_filters( 'the_title', $this->post->title, $this->post->id ); |
| 32 | echo apply_filters('nestedpages_post_title', esc_attr($title), $this->post); |
| 33 | echo $this->postStates($assigned_pt); |
| 34 | ?> |
| 35 | </span> |
| 36 | <?php |
| 37 | // Post Status |
| 38 | echo '<span class="status">'; |
| 39 | if ( $this->post->status !== 'publish' ) : |
| 40 | global $wp_post_statuses; |
| 41 | echo '(' . $wp_post_statuses[$this->post->status]->label . ')'; |
| 42 | endif; |
| 43 | if ( post_password_required($this->post->id) ) { |
| 44 | echo '<span class="locked password-required">'; |
| 45 | echo '<img src="' . \NestedPages\Helpers::plugin_url() . '/assets/images/lock.svg" alt="' . __('Lock Icon', 'wp-nested-pages') . '">'; |
| 46 | echo '</span>'; |
| 47 | } |
| 48 | echo '</span>'; |
| 49 | |
| 50 | // Nested Pages Status |
| 51 | if ( $this->post->np_status == 'hide' && !$wpml ) |
| 52 | echo '<img src="' . \NestedPages\Helpers::plugin_url() . '/assets/images/hidden.svg" alt="' . __('Hidden Icon', 'wp-nested-pages') . '" class="row-status-icon status-np-hidden">'; |
| 53 | |
| 54 | // Nav Status |
| 55 | echo ( $this->post->nav_status == 'hide' && !$wpml ) |
| 56 | ? '<span class="nav-status">' . __('Hidden', 'wp-nested-pages') . '</span>' |
| 57 | : '<span class="nav-status"></span>'; |
| 58 | |
| 59 | // Post Lock |
| 60 | if ( $user = wp_check_post_lock($this->post->id) ){ |
| 61 | $u = get_userdata($user); |
| 62 | echo '<span class="locked">'; |
| 63 | echo '<img src="' . \NestedPages\Helpers::plugin_url() . '/assets/images/lock.svg" alt="' . __('Lock Icon', 'wp-nested-pages') . '">'; |
| 64 | echo '<em> ' . sprintf(__('%s currently editing', 'wp-nested-pages'), esc_html($u->display_name)) . '</em></span>'; |
| 65 | } elseif ( !$this->integrations->plugins->editorial_access_manager->hasAccess($this->post->id) ){ |
| 66 | echo '<span class="locked">'; |
| 67 | echo '<img src="' . \NestedPages\Helpers::plugin_url() . '/assets/images/lock.svg" alt="' . __('Lock Icon', 'wp-nested-pages') . '">'; |
| 68 | echo '</span>'; |
| 69 | } else { |
| 70 | $display_edit = ( !current_user_can('edit_others_posts') && $this->post->author !== get_current_user_id() ) ? false : true; |
| 71 | if ( $display_edit ) echo '<span class="edit-indicator">' . apply_filters('nestedpages_edit_link_text', __('Edit', 'wp-nested-pages'), $this->post) . '</span>'; |
| 72 | } |
| 73 | |
| 74 | // Sticky |
| 75 | echo '<span class="sticky"'; |
| 76 | $sticky_text = apply_filters('nestedpages_make_sticky_text_row', __('(Sticky)', 'wp-nested-pages'), $this->post, $this->post_type); |
| 77 | if ( !in_array($this->post->id, $this->sticky_posts) ) echo ' style="display:none;"'; |
| 78 | echo '>' . $sticky_text . '<span>'; |
| 79 | |
| 80 | if ( post_password_required($this->post->id) ) { |
| 81 | echo '<img src="' . \NestedPages\Helpers::plugin_url() . '/assets/images/lock.svg" alt="' . __('Lock Icon', 'wp-nested-pages') . '">'; |
| 82 | } |
| 83 | ?> |
| 84 | </a> |
| 85 | |
| 86 | <?php echo $this->rowActions($assigned_pt); ?> |
| 87 | |
| 88 | <?php if ( !$this->post->hierarchical ) : echo $this->post->hierarchical; ?> |
| 89 | <div class="np-post-columns"> |
| 90 | <ul class="np-post-info"> |
| 91 | <li><span class="np-author-display"><?php echo apply_filters('nestedpages_post_author', $this->post->author, $this->post); ?></span></li> |
| 92 | <li><?php echo get_the_date(); ?></li> |
| 93 | </ul> |
| 94 | </div> |
| 95 | <?php endif; ?> |
| 96 | |
| 97 | <?php if ( $this->integrations->plugins->yoast->installed ) echo $this->post->score; ?> |
| 98 | |
| 99 | <div class="action-buttons"> |
| 100 | |
| 101 | <div class="nestedpages-dropdown" data-dropdown> |
| 102 | <a href="#" class="np-btn has-icon toggle" data-dropdown-toggle> |
| 103 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/more.svg" alt="<?php _e('More Icon', 'wp-nested-pages'); ?>"> |
| 104 | </a> |
| 105 | <ul class="nestedpages-dropdown-content" data-dropdown-content> |
| 106 | |
| 107 | <?php |
| 108 | // WPML Translations |
| 109 | if ( $wpml && in_array('wpml', $this->post_type_settings->row_actions) ) : ?> |
| 110 | <li> |
| 111 | <a href="#" data-nestedpages-translations> |
| 112 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/globe.svg" alt="<?php _e('Globe Icon', 'wp-nested-pages'); ?>"> |
| 113 | <?php echo sprintf(__('Translations (%s)', 'wp-nested-pages'), $this->integrations->plugins->wpml->getAllTranslations($this->post->id, 'count')); ?> |
| 114 | </a> |
| 115 | </li> |
| 116 | <?php endif; ?> |
| 117 | |
| 118 | <?php |
| 119 | // Comments |
| 120 | if ( $this->post->comment_status == 'open' && in_array('comments', $this->post_type_settings->row_actions) ) : $comments = wp_count_comments($this->post->id); $cs = 'open' ?> |
| 121 | <li> |
| 122 | <a href="<?php echo admin_url( 'edit-comments.php?p=' . get_the_id() ); ?>"> |
| 123 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/comments.svg" alt="<?php _e('Comments Icon', 'wp-nested-pages'); ?>"> |
| 124 | <?php echo sprintf(__('%d Comments', 'wp-nested-pages'), intval($comments->total_comments)); ?> |
| 125 | </a> |
| 126 | </li> |
| 127 | <?php else : $cs = 'closed'; endif; ?> |
| 128 | |
| 129 | <?php |
| 130 | $include_link_dropdown = ( $this->post_type->name == 'page' ) ? true : false; |
| 131 | $include_link_dropdown = apply_filters('nestedpages_include_links_dropdown', $include_link_dropdown, $this->post_type); |
| 132 | |
| 133 | if ( (current_user_can('publish_pages') || $this->user->canSubmitPending($this->post_type->name)) && $this->post_type->hierarchical && !$this->listing_repo->isSearch() && $wpml_pages ) : |
| 134 | |
| 135 | // Link |
| 136 | if ( !$this->settings->menusDisabled() && !$this->integrations->plugins->wpml->installed && in_array('add_child_link', $this->post_type_settings->row_actions) && $include_link_dropdown ) : ?> |
| 137 | <li> |
| 138 | <a href="#" class="open-redirect-modal" data-parentid="<?php esc_attr_e($this->post->id); ?>"> |
| 139 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/link.svg" alt="<?php _e('Link Icon', 'wp-nested-pages'); ?>"> |
| 140 | <?php _e('Add Child Link', 'wp-nested-pages'); ?></a> |
| 141 | </li> |
| 142 | <?php endif; ?> |
| 143 | |
| 144 | <?php if ( in_array('add_child_page', $this->post_type_settings->row_actions) ) : ?> |
| 145 | <li> |
| 146 | <a href="#" class="add-new-child" data-id="<?php esc_attr_e(get_the_id()); ?>" data-parentname="<?php echo esc_attr($this->post->title); ?>"> |
| 147 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/child-page.svg" alt="<?php _e('Child Page Icon', 'wp-nested-pages'); ?>"> |
| 148 | <?php echo sprintf(__('Add Child %s', 'wp-nested-pages'), esc_attr($this->post_type->labels->singular_name)); ?></a> |
| 149 | </li> |
| 150 | <?php endif; ?> |
| 151 | |
| 152 | <?php endif; ?> |
| 153 | |
| 154 | <?php if ( (current_user_can('publish_pages') || $this->user->canSubmitPending($this->post_type->name) ) && !$this->listing_repo->isSearch() && !$this->listing_repo->isOrdered($this->post_type->name) ) : ?> |
| 155 | |
| 156 | <?php if ( in_array('insert_before', $this->post_type_settings->row_actions) ) : ?> |
| 157 | <li> |
| 158 | <a href="#" data-insert-before="<?php esc_attr_e(get_the_id()); ?>" data-parentname="<?php echo esc_attr($this->post->title); ?>"> |
| 159 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/insert-before.svg" alt="<?php _e('Insert Before Icon', 'wp-nested-pages'); ?>"> |
| 160 | <?php printf(esc_html__('Insert %s Before', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a> |
| 161 | </li> |
| 162 | <?php endif; ?> |
| 163 | |
| 164 | <?php if ( in_array('insert_after', $this->post_type_settings->row_actions) ) : ?> |
| 165 | <li> |
| 166 | <a href="#" data-insert-after="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php echo esc_attr($this->post->title); ?>"> |
| 167 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/insert-after.svg" alt="<?php _e('Insert After Icon', 'wp-nested-pages'); ?>"> |
| 168 | <?php printf(esc_html__('Insert %s After', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a> |
| 169 | </li> |
| 170 | <?php endif; ?> |
| 171 | |
| 172 | <?php endif; ?> |
| 173 | |
| 174 | <?php if ( $this->user->canSortPosts($this->post_type->name) && !$this->listing_repo->isSearch() && !$this->post_type_settings->disable_sorting && $wpml_current_language !== 'all' && !$this->listing_repo->isOrdered($this->post_type->name) ) : ?> |
| 175 | |
| 176 | <?php if ( in_array('push_to_top', $this->post_type_settings->row_actions) ) : ?> |
| 177 | <li> |
| 178 | <a href="#" data-push-to-top> |
| 179 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/arrow-up.svg" alt="<?php _e('Arrow Up Icon', 'wp-nested-pages'); ?>"> |
| 180 | <?php _e('Push to Top', 'wp-nested-pages'); ?></a> |
| 181 | </li> |
| 182 | <?php endif; ?> |
| 183 | |
| 184 | <?php if ( in_array('push_to_bottom', $this->post_type_settings->row_actions) ) : ?> |
| 185 | <li> |
| 186 | <a href="#" data-push-to-bottom> |
| 187 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/arrow-down.svg" alt="<?php _e('Arrow Down Icon', 'wp-nested-pages'); ?>"> |
| 188 | <?php _e('Push to Bottom', 'wp-nested-pages'); ?></a> |
| 189 | </li> |
| 190 | <?php endif; ?> |
| 191 | |
| 192 | <?php endif; ?> |
| 193 | |
| 194 | <?php if ( current_user_can('edit_pages') && current_user_can('edit_posts') && in_array('clone', $this->post_type_settings->row_actions) ) : ?> |
| 195 | <li> |
| 196 | <a href="#" class="clone-post" data-id="<?php echo esc_attr(get_the_id()); ?>" data-parentname="<?php esc_attr($this->post->title); ?>"> |
| 197 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/clone.svg" alt="<?php _e('Clone Icon', 'wp-nested-pages'); ?>"> |
| 198 | <?php _e('Clone', 'wp-nested-pages'); ?></a> |
| 199 | </li> |
| 200 | <?php endif; ?> |
| 201 | </ul> |
| 202 | </div><!-- .dropdown --> |
| 203 | |
| 204 | <?php |
| 205 | $can_quickedit_post = apply_filters('nestedpages_quickedit', true, $this->post); |
| 206 | if ( !current_user_can('edit_others_posts') ){ |
| 207 | $author = get_post_field('post_author', $this->post->ID); |
| 208 | if ( intval($author) !== get_current_user_id() ) $can_quickedit_post = false; |
| 209 | } |
| 210 | if ( !$user = wp_check_post_lock($this->post->id) || !$this->integrations->plugins->editorial_access_manager->hasAccess($this->post->id) && current_user_can('edit_posts', $this->post) && $can_quickedit_post && in_array('quickedit', $this->post_type_settings->row_actions) ) : |
| 211 | if ( $can_quickedit_post ) : |
| 212 | ?> |
| 213 | <a href="#" |
| 214 | class="np-btn np-quick-edit" |
| 215 | data-id="<?php echo esc_attr($this->post->id); ?>" |
| 216 | data-template="<?php echo esc_attr($this->post->template); ?>" |
| 217 | data-title="<?php echo esc_attr($this->post->title); ?>" |
| 218 | data-slug="<?php echo esc_attr(urldecode($post->post_name)); ?>" |
| 219 | data-commentstatus="<?php echo esc_attr($cs); ?>" |
| 220 | data-status="<?php echo esc_attr($this->post->status); ?>" |
| 221 | data-np-status="<?php echo esc_attr($this->post->np_status); ?>" |
| 222 | data-navstatus="<?php echo esc_attr($this->post->nav_status); ?>" |
| 223 | data-navtitleattr="<?php echo esc_attr($this->post->nav_title_attr); ?>" |
| 224 | data-navcss="<?php echo esc_attr($this->post->nav_css); ?>" |
| 225 | data-linktarget="<?php echo esc_attr($this->post->link_target); ?>" |
| 226 | data-navtitle="<?php echo esc_attr($this->post->nav_title); ?>" |
| 227 | data-author="<?php echo esc_attr($post->post_author); ?>" |
| 228 | <?php if ( current_user_can('publish_pages') ) : ?> |
| 229 | data-password="<?php echo esc_attr($post->post_password); ?>" |
| 230 | <?php endif; ?> |
| 231 | data-month="<?php echo esc_attr($this->post->date->month); ?>" |
| 232 | data-day="<?php echo esc_attr($this->post->date->d); ?>" |
| 233 | data-year="<?php echo esc_attr($this->post->date->y); ?>" |
| 234 | data-hour="<?php echo esc_attr($this->post->date->h); ?>" |
| 235 | data-minute="<?php echo esc_attr($this->post->date->m);?>" |
| 236 | data-datepicker="<?php echo date_i18n('n/j/Y', $this->post->date->datepicker); ?>" |
| 237 | data-time="<?php echo date_i18n('H:i', $this->post->date->datepicker); ?>" |
| 238 | data-formattedtime="<?php echo date_i18n('g:i', $this->post->date->datepicker); ?>" |
| 239 | data-timeformat="<?php echo get_option('time_format'); ?>" |
| 240 | data-ampm="<?php echo date('a', $this->post->date->datepicker); ?>" |
| 241 | data-sticky="<?php if ( in_array($this->post->id, $this->sticky_posts) ) echo 'sticky'; ?>" |
| 242 | data-custom-url="<?php echo esc_attr($this->post->nav_custom_url); ?>" |
| 243 | <?php echo $this->custom_fields_repo->dataAttributes($this->post, $this->post_type); ?> |
| 244 | > |
| 245 | <?php _e('Quick Edit', 'wp-nested-pages'); ?> |
| 246 | </a> |
| 247 | <?php endif; endif; ?> |
| 248 | |
| 249 | <?php |
| 250 | /** |
| 251 | * View/Preview Link |
| 252 | */ |
| 253 | if ( in_array('view', $this->post_type_settings->row_actions) ) : |
| 254 | if ( $this->post->status == 'publish' ) : |
| 255 | $link = apply_filters('nestedpages_view_link', get_the_permalink(), $this->post); |
| 256 | $link = ( $this->post_type->name !== 'post' ) |
| 257 | ? apply_filters('page_link', $link, $this->post->ID, false) |
| 258 | : apply_filters('post_link', $link, $this->post, false); |
| 259 | ?> |
| 260 | <a href="<?php echo $link; ?>" class="np-btn np-view-button" target="_blank"> |
| 261 | <?php echo apply_filters('nestedpages_view_link_text', __('View', 'wp-nested-pages'), $this->post); ?> |
| 262 | </a> |
| 263 | <?php |
| 264 | else : |
| 265 | $link = apply_filters('nestedpages_preview_link', get_the_permalink(), $this->post); |
| 266 | $link = apply_filters('preview_post_link', $link, $this->post); |
| 267 | ?> |
| 268 | <a href="<?php echo $link; ?>" class="np-btn np-view-button" target="_blank"> |
| 269 | <?php echo apply_filters('nestedpages_preview_link_text', __('Preview', 'wp-nested-pages'), $this->post); ?> |
| 270 | </a> |
| 271 | <?php |
| 272 | endif; // status |
| 273 | endif; // View in row actions |
| 274 | ?> |
| 275 | |
| 276 | <?php if ( current_user_can('delete_pages') && $this->integrations->plugins->editorial_access_manager->hasAccess($this->post->id) && in_array('trash', $this->post_type_settings->row_actions) ) : ?> |
| 277 | <?php if ( $this->post_type->hierarchical && $this->publishedChildrenCount($this->post) > 0 ) : ?> |
| 278 | <div class="nestedpages-dropdown" data-dropdown> |
| 279 | <a href="#" class="np-btn np-btn-trash" data-dropdown-toggle> |
| 280 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/trash.svg" alt="<?php _e('Trash Icon', 'wp-nested-pages'); ?>" class="np-icon-remove"> |
| 281 | </a> |
| 282 | <ul class="nestedpages-dropdown-content" data-dropdown-content> |
| 283 | <li> |
| 284 | <a href="<?php echo get_delete_post_link(get_the_id()); ?>"> |
| 285 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/trash-black.svg" alt="<?php _e('Trash Icon', 'wp-nested-pages'); ?>" class="np-icon-remove"> |
| 286 | <?php printf(__('Trash %s', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a> |
| 287 | </li> |
| 288 | <li> |
| 289 | <a href="#" data-nestedpages-trash-children data-post-id="<?php echo $this->post->ID; ?>"> |
| 290 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/trash-children.svg" alt="<?php _e('Trash Children Icon', 'wp-nested-pages'); ?>" class="np-icon-remove"> |
| 291 | <?php printf(__('Trash %s & Children', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a> |
| 292 | </li> |
| 293 | </ul> |
| 294 | </div> |
| 295 | <?php else : ?> |
| 296 | <a href="<?php echo get_delete_post_link(get_the_id()); ?>" class="np-btn np-btn-trash"> |
| 297 | <img src="<?php echo \NestedPages\Helpers::plugin_url(); ?>/assets/images/trash.svg" alt="<?php _e('Trash Icon', 'wp-nested-pages'); ?>" class="np-icon-remove"> |
| 298 | </a> |
| 299 | <?php endif; ?> |
| 300 | <?php endif; ?> |
| 301 | </div><!-- .action-buttons --> |
| 302 | </div><!-- .row-inner --> |
| 303 | |
| 304 | <?php |
| 305 | // Thumbnail |
| 306 | $thumbnail_source = $this->post_type_repo->thumbnails($this->post_type->name, 'source'); |
| 307 | $thumbnail_size = $this->post_type_repo->thumbnails($this->post_type->name, 'display_size'); |
| 308 | if ( $thumbnail_source ) : |
| 309 | $out = '<div class="np-thumbnail ' . $thumbnail_size . '">'; |
| 310 | if ( has_post_thumbnail($this->post->id) ) : |
| 311 | $image = get_the_post_thumbnail($this->post->id, $thumbnail_source); |
| 312 | $out .= apply_filters('nestedpages_thumbnail', $image, $this->post); |
| 313 | else : |
| 314 | $image_fallback = apply_filters('nestedpages_thumbnail_fallback', false, $this->post); |
| 315 | if ( $image_fallback ) : |
| 316 | $out .= apply_filters('nestedpages_thumbnail_fallback', $image_fallback, $this->post); |
| 317 | endif; |
| 318 | endif; |
| 319 | $out .= '</div>'; |
| 320 | echo $out; |
| 321 | endif; |
| 322 | |
| 323 | if ( $this->can_user_perform_bulk_actions ) : ?> |
| 324 | <div class="np-bulk-checkbox"> |
| 325 | <input type="checkbox" name="nestedpages_bulk[]" value="<?php echo esc_attr($this->post->id); ?>" data-np-bulk-checkbox="<?php echo sanitize_text_field(esc_attr($this->post->title)); ?>" data-np-post-type="<?php echo esc_attr($this->post->post_type); ?>" /> |
| 326 | </div> |
| 327 | <?php endif ?> |
| 328 | </div><!-- .row --> |
| 329 |