tutor_pages.php
114 lines
| 1 | <?php |
| 2 | $tutor_pages = tutor_utils()->tutor_pages(); |
| 3 | ?> |
| 4 | |
| 5 | <div id="tools-tutor-pages" class="tools-tutor-pages"> |
| 6 | <table class="tutor-table tutor-pages-table"> |
| 7 | <thead> |
| 8 | <tr> |
| 9 | <th><?php _e( 'ID', 'tutor' ); ?></th> |
| 10 | <th><?php _e( 'Page Name', 'tutor' ); ?></th> |
| 11 | <th><?php _e( 'Status', 'tutor' ); ?></th> |
| 12 | </tr> |
| 13 | </thead> |
| 14 | <tbody> |
| 15 | <?php |
| 16 | foreach ( $tutor_pages as $page ) { |
| 17 | $page_id = $page['page_id']; |
| 18 | ?> |
| 19 | <tr> |
| 20 | <td><?php echo esc_attr( $page_id ); ?></td> |
| 21 | <td> |
| 22 | <p> |
| 23 | <?php |
| 24 | if ( $page['page_exists'] ) { |
| 25 | $edit_url = admin_url( "post.php?post={$page_id}&action=edit" ); |
| 26 | echo '<a href="' . esc_url( $edit_url ) . '" target="_blank">'. $page['page_name'] .'</a>'; |
| 27 | } else { |
| 28 | echo $page['page_name']; |
| 29 | } |
| 30 | ?> |
| 31 | </p> |
| 32 | </td> |
| 33 | |
| 34 | <td> |
| 35 | <?php if ( ! $page_id ): ?> |
| 36 | <p style="color: red;"> |
| 37 | <i class="dashicons dashicons-warning"></i> <?php _e( ' Page not set', 'tutor' ); ?> |
| 38 | </p> |
| 39 | <?php endif; ?> |
| 40 | |
| 41 | <?php if ( ! $page['page_exists'] ): ?> |
| 42 | <p style="color: red;"> |
| 43 | <i class="dashicons dashicons-warning"></i> |
| 44 | <?php _e( ' Page deleted, please set new one', 'tutor' ); ?> |
| 45 | </p> |
| 46 | <?php endif; ?> |
| 47 | |
| 48 | <?php if ( $page['page_exists'] && ! $page['page_visible'] ): ?> |
| 49 | <p style="color: red;"> |
| 50 | <i class="dashicons dashicons-warning"></i> |
| 51 | <?php _e( 'Page visibility is not public', 'tutor' ); ?> |
| 52 | </p> |
| 53 | <?php endif; ?> |
| 54 | |
| 55 | <?php |
| 56 | if ( $page['page_exists'] && $page['page_visible'] ) { |
| 57 | $page = get_post( $page_id ); |
| 58 | echo '<a href="' . get_permalink( $page ) . '" target="_blank" style="color: green;"> |
| 59 | <i class="dashicons dashicons-yes-alt"></i> /' . esc_attr( $page->post_name ) . ' |
| 60 | </a>'; |
| 61 | } |
| 62 | ?> |
| 63 | </td> |
| 64 | </tr> |
| 65 | <?php |
| 66 | } |
| 67 | ?> |
| 68 | <tr> |
| 69 | <td><?php echo $page_id; ?></td> |
| 70 | <td> |
| 71 | <?php |
| 72 | echo "<p>"; |
| 73 | |
| 74 | if ($page['page_exists']){ |
| 75 | $edit_url = admin_url("post.php?post={$page_id}&action=edit"); |
| 76 | echo "<a href='{$edit_url}' target='_blank'>"; |
| 77 | } |
| 78 | echo $page['page_name']; |
| 79 | |
| 80 | if ($page['page_exists']){ |
| 81 | echo '</a>'; |
| 82 | } |
| 83 | echo "</p>"; |
| 84 | ?> |
| 85 | </td> |
| 86 | |
| 87 | <td> |
| 88 | <?php |
| 89 | if ( ! $page_id ){ |
| 90 | echo '<p style="color: red;">'; |
| 91 | echo "<i class='dashicons dashicons-warning'></i> "; _e(' Page not set', 'tutor'); |
| 92 | echo '</p>'; |
| 93 | } |
| 94 | ?> |
| 95 | |
| 96 | <form action="" method="post"> |
| 97 | <?php |
| 98 | tutor_action_field( 'regenerate_tutor_pages' ); |
| 99 | tutor_nonce_field(); |
| 100 | ?> |
| 101 | |
| 102 | <p> |
| 103 | <button class="tutor-btn" type="submit"><?php _e('Re-Generate Tutor Pages','tutor'); ?></button> |
| 104 | </p> |
| 105 | </form> |
| 106 | </td> |
| 107 | </tr> |
| 108 | </tbody> |
| 109 | </table> |
| 110 | <?php |
| 111 | tutor_alert( __( 'Note: This tool will install all the missing Tutor pages. Pages already defined and set up will not be replaced.', 'tutor' ), 'info' ); |
| 112 | ?> |
| 113 | </div> |
| 114 |