listing.php
125 lines
| 1 | <?php |
| 2 | $wpml_pages = ( $this->integrations->plugins->wpml->installed && $this->integrations->plugins->wpml->isDefaultLanguage()) ? true : false; |
| 3 | if ( !$this->integrations->plugins->wpml->installed ) $wpml_pages = true; |
| 4 | $dark_mode = ( $this->integrations->plugins->dark_mode->installed ) ? true : false; |
| 5 | if ( $dark_mode ) : |
| 6 | $dark_meta = get_user_meta(get_current_user_id(), 'dark_mode', true); |
| 7 | if ( $dark_meta !== 'on' ) $dark_mode = false; |
| 8 | endif; |
| 9 | ?> |
| 10 | <div class="wrap nestedpages <?php if ( $dark_mode ) echo 'np-dark-mode'; ?>"> |
| 11 | <div class="nestedpages-listing-title"> |
| 12 | <h1 class="wp-heading-inline"> |
| 13 | <?php echo apply_filters('nestedpages_page_title', esc_html($this->post_type->labels->name), $this->post_type); ?> |
| 14 | </h1> |
| 15 | |
| 16 | <?php if ( $this->user->canPublish($this->post_type->name) || $this->user->canSubmitPending($this->post_type->name) ) : ?> |
| 17 | <a href="<?php echo $this->post_type_repo->addNewPostLink($this->post_type->name); ?>" class="page-title-action"> |
| 18 | <?php echo apply_filters('nestedpages_add_new_text', esc_html($this->post_type->labels->add_new), $this->post_type); ?> |
| 19 | </a> |
| 20 | <?php endif; ?> |
| 21 | |
| 22 | <?php if ( ($this->user->canPublish($this->post_type->name) || $this->user->canSubmitPending($this->post_type->name)) && !$this->listing_repo->isSearch() && $wpml_pages && !$this->listing_repo->isFiltered() ) : ?> |
| 23 | <a href="#" class="open-bulk-modal page-title-action" title="<?php _e('Add Multiple', 'wp-nested-pages'); ?>" data-parentid="0" data-nestedpages-modal-toggle="np-bulk-modal"> |
| 24 | <?php echo apply_filters('nestedpages_add_multiple_text', esc_html__('Add Multiple', 'wp-nested-pages'), $this->post_type); ?> |
| 25 | </a> |
| 26 | <?php endif; ?> |
| 27 | |
| 28 | <?php if ( $this->listing_repo->showLinks($this->post_type, $this->user) ) : ?> |
| 29 | <a href="#" class="open-redirect-modal page-title-action" title="<?php _e('Add Link', 'wp-nested-pages'); ?>" data-parentid="0"> |
| 30 | <?php echo apply_filters('nestedpages_add_link_text', esc_html__('Add Link', 'wp-nested-pages'), $this->post_type); ?> |
| 31 | </a> |
| 32 | <?php endif; ?> |
| 33 | |
| 34 | <?php do_action('nestedpages_top_buttons', $this->post_type); ?> |
| 35 | |
| 36 | <div class="nestedpages-top-toggles"> |
| 37 | <?php if ( $this->post_type->hierarchical && !$this->listing_repo->isSearch() ) : ?> |
| 38 | <a href="#" class="np-btn nestedpages-toggleall" data-toggle="closed"><?php esc_html_e('Expand All', 'wp-nested-pages'); ?></a> |
| 39 | <?php endif; ?> |
| 40 | |
| 41 | <?php if ( $this->user->canSortPosts($this->post_type->name) && !$this->listing_repo->isSearch() && !$this->listing_repo->isFiltered() && !$this->listing_repo->isOrdered($this->post_type->name) ) : ?> |
| 42 | <div class="np-sync-menu-cont" <?php if ( $this->confirmation->getMessage() ) echo 'style="margin-top:2px;"';?>> |
| 43 | |
| 44 | <?php if ( $this->settings->autoPageOrderDisabled() ) : ?> |
| 45 | <a href="#" class="np-btn" data-np-manual-order-sync><?php echo sprintf(__('Sync %s Order', 'wp-nested-pages'), $this->post_type->labels->singular_name); ?></a> |
| 46 | <?php endif; ?> |
| 47 | |
| 48 | <?php |
| 49 | $wpml = $this->integrations->plugins->wpml->installed; |
| 50 | $primary_language = ( $wpml && $this->integrations->plugins->wpml->isDefaultLanguage() ) ? true : false; |
| 51 | if ( !$wpml ) $primary_language = true; |
| 52 | |
| 53 | if ( $this->post_type->name == 'page' && |
| 54 | !$this->settings->hideMenuSync() && |
| 55 | !$this->settings->menusDisabled() && |
| 56 | $primary_language ) : |
| 57 | ?> |
| 58 | |
| 59 | <?php if ( !$this->settings->autoMenuDisabled() ) : ?> |
| 60 | <label> |
| 61 | <input type="checkbox" name="np_sync_menu" class="np-sync-menu" value="sync" <?php if ( get_option('nestedpages_menusync') == 'sync' ) echo 'checked'; ?>/> |
| 62 | <?php |
| 63 | esc_html_e('Sync Menu', 'wp-nested-pages'); |
| 64 | if ( $wpml ) echo ' (' . esc_html($this->integrations->plugins->wpml->getCurrentLanguage('name')) . ')'; |
| 65 | ?> |
| 66 | </label> |
| 67 | <?php else : ?> |
| 68 | <a href="#" class="np-btn" data-np-manual-menu-sync><?php esc_html_e('Sync Menu', 'wp-nested-pages'); ?></a> |
| 69 | <?php endif; ?> |
| 70 | |
| 71 | |
| 72 | <?php endif; ?> |
| 73 | |
| 74 | <?php if ( $wpml && !$primary_language ) echo $this->integrations->plugins->wpml->syncMenusButton(); ?> |
| 75 | |
| 76 | </div> |
| 77 | <?php endif; ?> |
| 78 | |
| 79 | <div id="nested-loading"> |
| 80 | <?php include( NestedPages\Helpers::asset('images/spinner.svg') ); ?> |
| 81 | </div> |
| 82 | </div><!-- .nestedpages-top-toggles --> |
| 83 | |
| 84 | </div><!-- .nestedpages-listing-title --> |
| 85 | |
| 86 | <?php if ( $this->confirmation->getMessage() ) : ?> |
| 87 | <div id="message" class="updated notice is-dismissible"><p><?php echo $this->confirmation->getMessage(); ?></p><button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e('Dismiss this notice.', 'wp-nested-pages'); ?></span></button></div> |
| 88 | <?php endif; ?> |
| 89 | |
| 90 | <div data-nestedpages-error class="updated error notice is-dismissible" style="display:none;"><p></p><button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e('Dismiss this notice.', 'wp-nested-pages'); ?></span></button></div> |
| 91 | |
| 92 | <?php include(NestedPages\Helpers::view('partials/tool-list')); ?> |
| 93 | |
| 94 | <div id="np-error" class="updated error" style="clear:both;display:none;"></div> |
| 95 | |
| 96 | |
| 97 | <div class="nestedpages"> |
| 98 | <?php $this->getPosts(); ?> |
| 99 | |
| 100 | <div class="quick-edit quick-edit-form np-inline-modal" style="display:none;"> |
| 101 | <?php include( NestedPages\Helpers::view('forms/quickedit-post') ); ?> |
| 102 | </div> |
| 103 | |
| 104 | <?php if ( $this->user->canPublish($this->post_type->name) && !$this->integrations->plugins->wpml->installed ) : ?> |
| 105 | <div class="quick-edit quick-edit-form-redirect np-inline-modal" style="display:none;"> |
| 106 | <?php include( NestedPages\Helpers::view('forms/quickedit-link') ); ?> |
| 107 | </div> |
| 108 | <?php endif; ?> |
| 109 | |
| 110 | <?php if ( $this->user->canPublish($this->post_type->name) || $this->user->canSubmitPending($this->post_type->name) ) : ?> |
| 111 | <div class="new-child new-child-form np-inline-modal" style="display:none;"> |
| 112 | <?php include( NestedPages\Helpers::view('forms/new-child') ); ?> |
| 113 | </div> |
| 114 | <?php endif; ?> |
| 115 | </div> |
| 116 | |
| 117 | </div><!-- .wrap --> |
| 118 | |
| 119 | <?php |
| 120 | include( NestedPages\Helpers::view('forms/empty-trash-modal') ); |
| 121 | include( NestedPages\Helpers::view('forms/clone-form') ); |
| 122 | if ( $this->listing_repo->showLinks($this->post_type, $this->user) ) include( NestedPages\Helpers::view('forms/link-form') ); |
| 123 | include( NestedPages\Helpers::view('forms/bulk-add') ); |
| 124 | include( NestedPages\Helpers::view('forms/delete-confirmation-modal') ); |
| 125 | if ( $this->integrations->plugins->wpml->installed ) include( NestedPages\Helpers::view('partials/wpml-translations') ); |