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