PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | pages/page-mainwp-page.php +119 -132 5.2 → 6.2.1 View file →
@@ -6,8 +6,13 @@
6 6 */
7 7
8 8 namespace MainWP\Dashboard;
9 9
10 +// Exit if accessed directly.
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
14 +
10 15 /**
11 16 * Class MainWP_Page
12 17 *
13 18 * @package MainWP\Dashboard
@@ -87,19 +92,23 @@
87 92 *
88 93 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
89 94 */
90 95 public static function init_menu() {
91 - $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Pages', 'mainwp' ), '<span id="mainwp-Pages">' . esc_html__( 'Pages', 'mainwp' ) . '</span>', 'read', 'PageBulkManage', array( static::get_class_name(), 'render' ) );
96 + $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Pages', 'mainwp' ), '<span id="mainwp-Pages">' . esc_html__( 'Pages', 'mainwp' ) . '</span>', 'manage_options', 'PageBulkManage', array( static::get_class_name(), 'render' ) );
92 97 add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_page' ) );
93 98 add_filter( 'manage_' . $_page . '_columns', array( static::get_class_name(), 'get_manage_columns' ) );
94 99
95 - $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Pages', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Add New', 'mainwp' ) . '</div>', 'read', 'PageBulkAdd', array( static::get_class_name(), 'render_bulk_add' ) );
96 - add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_add_edit' ) );
100 + if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PageBulkAdd' ) ) {
101 + $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Pages', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Add New', 'mainwp' ) . '</div>', 'manage_options', 'PageBulkAdd', array( static::get_class_name(), 'render_bulk_add' ) );
102 + add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_add_edit' ) );
103 + }
97 104
98 - $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Pages', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Edit Page', 'mainwp' ) . '</div>', 'read', 'PageBulkEdit', array( static::get_class_name(), 'render_bulk_edit' ) );
99 - add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_add_edit' ) );
105 + if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PageBulkEdit' ) ) {
106 + $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Pages', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Edit Page', 'mainwp' ) . '</div>', 'manage_options', 'PageBulkEdit', array( static::get_class_name(), 'render_bulk_edit' ) );
107 + add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_add_edit' ) );
108 + }
100 109
101 - add_submenu_page( 'mainwp_tab', esc_html__( 'Posting new bulkpage', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Add New Page', 'mainwp' ) . '</div>', 'read', 'PostingBulkPage', array( static::get_class_name(), 'posting' ) ); // removed from menu afterwards.
110 + add_submenu_page( 'mainwp_tab', esc_html__( 'Posting new bulkpage', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Add New Page', 'mainwp' ) . '</div>', 'manage_options', 'PostingBulkPage', array( static::get_class_name(), 'posting' ), ); // removed from menu afterwards.
102 111
103 112 /**
104 113 * Pages Subpages
105 114 *
@@ -118,9 +127,9 @@
118 127 }
119 128 if ( MainWP_Menu::is_disable_menu_item( 3, 'Page' . $subPage['slug'] ) ) {
120 129 continue;
121 130 }
122 - add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'read', 'Page' . $subPage['slug'], $subPage['callback'] );
131 + add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'manage_options', 'Page' . $subPage['slug'], $subPage['callback'] );
123 132 }
124 133 }
125 134 static::init_left_menu( static::$subPages );
126 135 }
@@ -134,11 +143,8 @@
134 143 *
135 144 * @uses \MainWP\Dashboard\MainWP_Post::on_load_bulkpost()
136 145 */
137 146 public static function on_load_add_edit() {
138 -
139 - global $_mainwp_menu_active_slugs;
140 -
141 147 if ( isset( $_GET['page'] ) && 'PageBulkAdd' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
142 148
143 149 /**
144 150 * MainWP default post to edit.
@@ -150,14 +156,13 @@
150 156 $post_type = 'bulkpage';
151 157 $_mainwp_default_post_to_edit = get_default_post_to_edit( $post_type, true );
152 158 $post_id = $_mainwp_default_post_to_edit ? $_mainwp_default_post_to_edit->ID : 0;
153 159 } else {
154 - $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
155 - $_mainwp_menu_active_slugs['PageBulkEdit'] = 'PageBulkManage'; // to fix hidden second menu level.
160 + $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
156 161 }
157 162
158 163 if ( ! $post_id ) {
159 - wp_die( esc_html__( 'Invalid post.' ) );
164 + wp_die( esc_html__( 'Invalid post.', 'mainwp' ) );
160 165 }
161 166
162 167 MainWP_Post::on_load_bulkpost( $post_id );
163 168 }
@@ -162,47 +167,8 @@
162 167 MainWP_Post::on_load_bulkpost( $post_id );
163 168 }
164 169
165 170 /**
166 - * Method init_subpages_menu()
167 - *
168 - * Initiate subpages menu.
169 - *
170 - * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
171 - */
172 - public static function init_subpages_menu() { // phpcs:ignore -- NOSONAR - complex.
173 - ?>
174 - <div id="menu-mainwp-Pages" class="mainwp-submenu-wrapper">
175 - <div class="wp-submenu sub-open" style="">
176 - <div class="mainwp_boxout">
177 - <div class="mainwp_boxoutin"></div>
178 - <?php if ( mainwp_current_user_have_right( 'dashboard', 'manage_pages' ) ) { ?>
179 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=PageBulkManage' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Manage Pages', 'mainwp' ); ?></a>
180 - <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PageBulkAdd' ) ) { ?>
181 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=PageBulkAdd' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Add New', 'mainwp' ); ?></a>
182 - <?php } ?>
183 - <?php } ?>
184 - <?php
185 - if ( isset( static::$subPages ) && is_array( static::$subPages ) ) {
186 - foreach ( static::$subPages as $subPage ) {
187 - if ( ! isset( $subPage['menu_hidden'] ) || ( isset( $subPage['menu_hidden'] ) && true !== $subPage['menu_hidden'] ) ) {
188 - if ( MainWP_Menu::is_disable_menu_item( 3, 'Page' . $subPage['slug'] ) ) {
189 - continue;
190 - }
191 - ?>
192 - <a href="<?php echo esc_url( admin_url( 'admin.php?page=Page' . $subPage['slug'] ) ); ?>" class="mainwp-submenu"><?php echo esc_html( $subPage['title'] ); ?></a>
193 - <?php
194 - }
195 - }
196 - }
197 - ?>
198 - </div>
199 - </div>
200 - </div>
201 - <?php
202 - }
203 -
204 - /**
205 171 * Method init_left_menu()
206 172 *
207 173 * Initiate left menu.
208 174 *
@@ -212,37 +178,37 @@
212 178 * @uses \MainWP\Dashboard\MainWP_Menu::init_subpages_left_menu()
213 179 * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item()
214 180 */
215 181 public static function init_left_menu( $subPages = array() ) {
216 -
217 - MainWP_Menu::add_left_menu(
218 - array(
219 - 'title' => esc_html__( 'Pages', 'mainwp' ),
220 - 'parent_key' => 'managesites',
221 - 'slug' => 'PageBulkManage',
222 - 'href' => 'admin.php?page=PageBulkManage',
223 - 'icon' => '<i class="file icon"></i>',
224 - 'leftsub_order' => 8,
225 - ),
226 - 1
227 - );
228 182 $init_sub_subleftmenu = array(
229 183 array(
230 184 'title' => esc_html__( 'Manage Pages', 'mainwp' ),
231 - 'parent_key' => 'PageBulkManage',
185 + 'parent_key' => 'Extensions-Mainwp-Content-Operations',
232 186 'href' => 'admin.php?page=PageBulkManage',
233 187 'slug' => 'PageBulkManage',
234 188 'right' => 'manage_pages',
235 - 'leftsub_order_level2' => 1,
189 + 'leftsub_order_level2' => 2,
190 + 'active_path' => array(
191 + 'PageBulkEdit' => 'PageBulkManage',
192 + 'PageBulkAdd' => 'PageBulkManage',
193 + ),
236 194 ),
237 195 array(
238 196 'title' => esc_html__( 'Add New', 'mainwp' ),
239 - 'parent_key' => 'PageBulkManage',
197 + 'parent_key' => 'Extensions-Mainwp-Content-Operations',
240 198 'href' => 'admin.php?page=PageBulkAdd',
241 199 'slug' => 'PageBulkAdd',
242 200 'right' => 'manage_pages',
243 201 'leftsub_order_level2' => 2,
244 202 ),
203 + array(
204 + 'title' => esc_html__( 'Edit Page', 'mainwp' ),
205 + 'parent_key' => 'Extensions-Mainwp-Content-Operations',
206 + 'href' => 'admin.php?page=PageBulkEdit',
207 + 'slug' => 'PageBulkEdit',
208 + 'right' => 'manage_pages',
209 + 'leftsub_order_level2' => 2,
210 + ),
245 211 );
246 212 MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'PageBulkManage', 'Page' );
247 213
248 214 foreach ( $init_sub_subleftmenu as $item ) {
@@ -248,9 +214,10 @@
248 214 foreach ( $init_sub_subleftmenu as $item ) {
249 215 if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) {
250 216 continue;
251 217 }
252 - MainWP_Menu::add_left_menu( $item, 2 );
218 + $level = ( 'PageBulkManage' === $item['slug'] ) ? 2 : 3;
219 + MainWP_Menu::add_left_menu( $item, $level );
253 220 }
254 221 }
255 222
256 223 /**
@@ -376,9 +343,9 @@
376 343 MainWP_UI::render_top_header( $params );
377 344
378 345 $renderItems = array();
379 346
380 - if ( mainwp_current_user_have_right( 'dashboard', 'manage_pages' ) ) {
347 + if ( \mainwp_current_user_can( 'dashboard', 'manage_pages' ) ) {
381 348 $renderItems[] = array(
382 349 'title' => esc_html__( 'Manage Pages', 'mainwp' ),
383 350 'href' => 'admin.php?page=PageBulkManage',
384 351 'active' => ( 'BulkManage' === $shownPage ) ? true : false,
@@ -438,10 +405,10 @@
438 405 *
439 406 * @uses \MainWP\Dashboard\MainWP_Cache::get_cached_context()
440 407 */
441 408 public static function render() {
442 - if ( ! mainwp_current_user_have_right( 'dashboard', 'manage_pages' ) ) {
443 - mainwp_do_not_have_permissions( esc_html__( 'manage pages', 'mainwp' ) );
409 + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_pages' ) ) {
410 + \mainwp_do_not_have_permissions( esc_html__( 'manage pages', 'mainwp' ) );
444 411 return;
445 412 }
446 413
447 414 $cachedSearch = MainWP_Cache::get_cached_context( 'Page' );
@@ -511,17 +478,21 @@
511 478 * @since 4.0
512 479 */
513 480 do_action( 'mainwp_pages_actions_bar_right' );
514 481 ?>
482 + <a href="admin.php?page=PageBulkAdd" class="ui mini green button"><?php esc_html_e( 'Create New Page', 'mainwp' ); ?></a>
483 + <?php if ( MainWP_Extensions_Handler::is_extension_available( 'boilerplate-extension' ) ) : ?>
484 + <a href="admin.php?page=PageBulkAdd&boilerplate=1" class="ui mini green basic button"><?php esc_html_e( 'Create New Boilerplate', 'mainwp' ); ?></a>
485 + <?php endif; ?>
515 486 </div>
516 487 </div>
517 488 </div>
518 489 </div>
519 - <div class="ui segment" id="mainwp_pages_wrap_table">
490 + <div class="ui padded segment" id="mainwp_pages_wrap_table">
520 491 <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-manage-pages-info-message' ) ) : ?>
521 492 <div class="ui info message">
522 493 <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-manage-pages-info-message"></i>
523 - <?php printf( esc_html__( 'Manage existing pages on your child sites. Here you can edit, view and delete pages. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/manage-pages/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?>
494 + <?php /* translators: 1: opening anchor tag, 2: closing anchor tag */ printf( esc_html__( 'Monitor and manage the lifecycle of content across all connected sites. Perform safe, bulk operations without editing layouts or page design. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://docs.mainwp.com/sites/content/manage-pages" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?>
524 495 </div>
525 496 <?php endif; ?>
526 497 <?php static::render_table( true ); ?>
527 498 </div>
@@ -679,28 +650,30 @@
679 650 $cachedSearch['keyword'] = trim( $cachedSearch['keyword'] );
680 651 }
681 652 ?>
682 653 <div class="ui mini form">
683 - <div class="field">
684 - <div class="ui input fluid">
685 - <input type="text" placeholder="<?php esc_attr_e( 'Containing keyword', 'mainwp' ); ?>" id="mainwp_page_search_by_keyword" class="text" value="<?php echo ( null !== $cachedSearch ) ? esc_attr( $cachedSearch['keyword'] ) : ''; ?>" />
654 + <div class="two fields">
655 + <div class="field">
656 + <div class="ui input fluid">
657 + <input type="text" placeholder="<?php esc_attr_e( 'Containing keyword', 'mainwp' ); ?>" id="mainwp_page_search_by_keyword" class="text" value="<?php echo ( null !== $cachedSearch ) ? esc_attr( $cachedSearch['keyword'] ) : ''; ?>" />
658 + </div>
686 659 </div>
660 + <div class="field">
661 + <?php
662 + $searchon = 'all';
663 + if ( null !== $cachedSearch ) {
664 + $searchon = $cachedSearch['search_on'];
665 + }
666 + ?>
667 + <select class="ui dropdown fluid" id="mainwp_page_search_on">
668 + <option value=""><?php esc_html_e( 'Search in...', 'mainwp' ); ?></option>
669 + <option value="title" <?php echo 'title' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title', 'mainwp' ); ?></option>
670 + <option value="content" <?php echo 'content' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Body', 'mainwp' ); ?></option>
671 + <option value="all" <?php echo 'all' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title and Body', 'mainwp' ); ?></option>
672 + </select>
673 + </div>
687 674 </div>
688 675 <div class="field">
689 - <?php
690 - $searchon = 'all';
691 - if ( null !== $cachedSearch ) {
692 - $searchon = $cachedSearch['search_on'];
693 - }
694 - ?>
695 - <select class="ui dropdown fluid" id="mainwp_page_search_on">
696 - <option value=""><?php esc_html_e( 'Search in...', 'mainwp' ); ?></option>
697 - <option value="title" <?php echo 'title' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title', 'mainwp' ); ?></option>
698 - <option value="content" <?php echo 'content' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Body', 'mainwp' ); ?></option>
699 - <option value="all" <?php echo 'all' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title and Body', 'mainwp' ); ?></option>
700 - </select>
701 - </div>
702 - <div class="field">
703 676 <label><?php esc_html_e( 'Date range', 'mainwp' ); ?></label>
704 677 <div class="two fields">
705 678 <div class="field">
706 679 <div class="ui calendar mainwp_datepicker" >
@@ -781,15 +754,18 @@
781 754 $sites = isset( $params['sites'] ) ? $params['sites'] : '';
782 755 $search_on = isset( $params['search_on'] ) ? $params['search_on'] : 'all';
783 756 $clients = isset( $params['clients'] ) ? $params['clients'] : '';
784 757
758 + $has_cached_results = $cached && isset( $_SESSION['MainWPPageSearch'] ) && ! empty( $_SESSION['MainWPPageSearch'] );
759 +
785 760 ?>
786 761 <div id="mainwp_pages_error"></div>
787 762 <div id="mainwp-loading-pages-row" style="display: none;">
788 - <div class="ui active inverted dimmer">
789 - <div class="ui indeterminate large text loader"><?php esc_html_e( 'Loading Pages...', 'mainwp' ); ?></div>
763 + <div class="ui active page dimmer">
764 + <div class="ui double text loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div>
790 765 </div>
791 766 </div>
767 +
792 768 <?php
793 769 /**
794 770 * Action: mainwp_before_pages_table
795 771 *
@@ -797,9 +773,11 @@
797 773 *
798 774 * @since 4.1
799 775 */
800 776 do_action( 'mainwp_before_pages_table' );
801 - ?>
777 +
778 + if ( ! $cached || $has_cached_results ) {
779 + ?>
802 780 <table id="mainwp-pages-table" class="ui unstackable single line table" style="width:100%">
803 781 <thead>
804 782 <tr>
805 783 <th class="no-sort check-column collapsing"><span class="ui checkbox"><input id="cb-select-all-top" type="checkbox" /></span></th>
@@ -837,9 +815,16 @@
837 815 }
838 816 ?>
839 817 </tbody>
840 818 </table>
841 - <?php
819 + <?php
820 + } else {
821 + MainWP_UI::render_empty_page_placeholder(
822 + esc_html__( 'Find Pages', 'mainwp' ),
823 + esc_html__( 'Select the Child Sites you want, choose any filters, then click Show Pages.', 'mainwp' ),
824 + '<em data-emoji=":page_facing_up:" class="big"></em>'
825 + );
826 + }
842 827 /**
843 828 * Action: mainwp_after_pages_table
844 829 *
845 830 * Fires after the Manage Pages table.
@@ -889,15 +874,14 @@
889 874 "columnDefs": [ {
890 875 "targets": 'no-sort',
891 876 "orderable": false
892 877 } ],
893 - "language" : { "emptyTable": "<?php esc_html_e( 'Use the search options to find the page you want to manage.', 'mainwp' ); ?>" },
878 + "language" : { "emptyTable": "<?php esc_html_e( 'No pages found matching your search criteria.', 'mainwp' ); ?>" },
894 879 "drawCallback": function( settings ) {
895 - console.log('drawCallback page');
896 880 setTimeout(() => { // to fix.
897 - jQuery( '#mainwp_pages_wrap_table table .ui.dropdown' ).dropdown();
898 - jQuery( '#mainwp_pages_wrap_table table .ui.checkbox' ).checkbox();
899 - mainwp_datatable_fix_menu_overflow();
881 + jQuery( '#mainwp-pages-table .ui.dropdown' ).dropdown();
882 + jQuery( '#mainwp-pages-table .ui.checkbox' ).checkbox();
883 + mainwp_datatable_fix_menu_overflow('#mainwp-pages-table');
900 884 mainwp_table_check_columns_init(); // ajax: to fix checkbox all.
901 885 }, 1000);
902 886 },
903 887 select: {
@@ -917,13 +901,12 @@
917 901 .nodes()
918 902 .to$().find('td.check-column .ui.checkbox' ).checkbox('set unchecked');
919 903 }
920 904 }).on( 'columns-reordered', function () {
921 - console.log('columns-reordered');
922 905 setTimeout(() => { // to fix.
923 - jQuery( '#mainwp_pages_wrap_table table .ui.dropdown' ).dropdown();
924 - jQuery( '#mainwp_pages_wrap_table table .ui.checkbox' ).checkbox();
925 - mainwp_datatable_fix_menu_overflow();
906 + jQuery( '#mainwp-pages-table .ui.dropdown' ).dropdown();
907 + jQuery( '#mainwp-pages-table .ui.checkbox' ).checkbox();
908 + mainwp_datatable_fix_menu_overflow('#mainwp-pages-table');
926 909 mainwp_table_check_columns_init(); // ajax: to fix checkbox all.
927 910 }, 1000);
928 911 });
929 912 } catch( err ) {
@@ -1126,9 +1109,10 @@
1126 1109 }
1127 1110
1128 1111 unset( $results );
1129 1112 foreach ( $pages as $page ) {
1130 - $raw_dts = '';
1113 + $raw_dts = '';
1114 + $copy_permalink = MainWP_Post::get_copyable_permalink( $page, $website );
1131 1115 if ( isset( $page['dts'] ) ) {
1132 1116 $raw_dts = $page['dts'];
1133 1117 if ( ! stristr( $page['dts'], '-' ) ) {
1134 1118 $page['dts'] = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $page['dts'] ) );
@@ -1154,13 +1138,13 @@
1154 1138 * @since 4.1
1155 1139 */
1156 1140 do_action( 'mainwp_pages_table_column', $page, $website );
1157 1141 ?>
1158 - <td class="page-title column-title">
1142 + <td class="page-title column-title not-selectable">
1159 1143 <strong>
1160 1144 <abbr title="<?php echo esc_html( $page['title'] ); ?>">
1161 1145 <?php if ( 'trash' !== $page['status'] ) { ?>
1162 - <a class="row-title" href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php echo esc_attr( $website->id ); ?>&location=<?php echo esc_attr( base64_encode( 'post.php?post=' . $page['id'] . '&action=edit' ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode used for http encoding compatible. ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" target="_blank" title="Edit '<?php echo esc_html( $page['title'] ); ?>'?"><?php echo esc_html( $page['title'] ); ?></a>
1146 + <a class="row-title" href="<?php MainWP_Site_Open::get_open_site_admin_link( $website->id, true ); //phpcs:ignore -- ok. ?>&location=<?php echo esc_attr( base64_encode( 'post.php?post=' . $page['id'] . '&action=edit' ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode used for http encoding compatible. ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" target="_blank" title="Edit '<?php echo esc_html( $page['title'] ); ?>'?"><?php echo esc_html( $page['title'] ); ?></a>
1163 1147 <?php } else { ?>
1164 1148 <?php echo esc_html( $page['title'] ); ?>
1165 1149 <?php } ?>
1166 1150 </abbr>
@@ -1166,12 +1150,12 @@
1166 1150 </abbr>
1167 1151 </strong>
1168 1152
1169 1153 </td>
1170 - <td class="author column-author">
1154 + <td class="author column-author not-selectable">
1171 1155 <?php echo esc_html( $page['author'] ); ?>
1172 1156 </td>
1173 - <td class="comments">
1157 + <td class="comments not-selectable">
1174 1158 <div class="page-com-count-wrapper">
1175 1159 <a href="#" title="0 pending" class="post-com-count">
1176 1160 <span class="comment-count"><abbr title="<?php echo esc_attr( $page['comment_count'] ); ?>"><?php echo esc_html( $page['comment_count'] ); ?></abbr></span>
1177 1161 </a>
@@ -1176,12 +1160,12 @@
1176 1160 <span class="comment-count"><abbr title="<?php echo esc_attr( $page['comment_count'] ); ?>"><?php echo esc_html( $page['comment_count'] ); ?></abbr></span>
1177 1161 </a>
1178 1162 </div>
1179 1163 </td>
1180 - <td class="date" data-order="<?php echo esc_attr( $raw_dts ); ?>">
1164 + <td class="date not-selectable" data-order="<?php echo esc_attr( $raw_dts ); ?>">
1181 1165 <abbr raw_value="<?php echo esc_attr( $raw_dts ); ?>" title="<?php echo esc_attr( $page['dts'] ); ?>"><?php echo esc_html( $page['dts'] ); ?></abbr>
1182 1166 </td>
1183 - <td class="status column-status <?php echo 'trash' === $page['status'] ? 'post-trash' : ''; ?>"><?php echo esc_html( static::get_status( $page['status'] ) ); ?>
1167 + <td class="status column-status not-selectable <?php echo 'trash' === $page['status'] ? 'post-trash' : ''; ?>"><?php echo esc_html( static::get_status( $page['status'] ) ); ?>
1184 1168 </td>
1185 1169 <?php
1186 1170 if ( MainWP_Utility::enabled_wp_seo() ) {
1187 1171 $count_seo_links = null;
@@ -1195,24 +1179,25 @@
1195 1179 $seo_score = MainWP_Utility::esc_content( $seo_data['seo_score'], 'mixed' );
1196 1180 $readability_score = MainWP_Utility::esc_content( $seo_data['readability_score'], 'mixed' );
1197 1181 }
1198 1182 ?>
1199 - <td class="column-seo-links"><abbr raw_value="<?php echo null !== $count_seo_links ? $count_seo_links : -1; ?>" title=""><?php echo null !== $count_seo_links ? $count_seo_links : ''; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1200 - <td class="column-seo-linked"><abbr raw_value="<?php echo null !== $count_seo_linked ? $count_seo_linked : -1; ?>" title=""><?php echo null !== $count_seo_linked ? $count_seo_linked : ''; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1201 - <td class="column-seo-score"><abbr raw_value="<?php echo $seo_score ? 1 : 0; ?>" title=""><?php echo $seo_score; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1202 - <td class="column-seo-readability"><abbr raw_value="<?php echo $readability_score ? 1 : 0; ?>" title=""><?php echo $readability_score; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1183 + <td class="column-seo-links not-selectable"><abbr raw_value="<?php echo null !== $count_seo_links ? $count_seo_links : -1; ?>" title=""><?php echo null !== $count_seo_links ? $count_seo_links : ''; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1184 + <td class="column-seo-linked not-selectable"><abbr raw_value="<?php echo null !== $count_seo_linked ? $count_seo_linked : -1; ?>" title=""><?php echo null !== $count_seo_linked ? $count_seo_linked : ''; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1185 + <td class="column-seo-score not-selectable"><abbr raw_value="<?php echo $seo_score ? 1 : 0; ?>" title=""><?php echo $seo_score; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1186 + <td class="column-seo-readability not-selectable"><abbr raw_value="<?php echo $readability_score ? 1 : 0; ?>" title=""><?php echo $readability_score; // phpcs:ignore WordPress.Security.EscapeOutput ?></abbr></td>
1203 1187 <?php
1204 1188 }
1205 1189 ?>
1206 - <td class="website">
1190 + <td class="website not-selectable">
1207 1191 <a href="<?php echo esc_html( $website->url ); ?>" class="mainwp-may-hide-referrer" target="_blank"><?php echo esc_html( $website->url ); ?></a>
1208 1192 </td>
1209 1193 <td class="right aligned not-selectable">
1210 1194 <input class="pageId" type="hidden" name="id" value="<?php echo intval( $page['id'] ); ?>"/>
1195 + <input class="copyPermalinkValue" type="hidden" value="<?php echo esc_url( $copy_permalink ); ?>"/>
1211 1196 <input class="allowedBulkActions" type="hidden" name="allowedBulkActions" value="|get_edit|trash|delete|<?php echo 'trash' === $page['status'] ? 'restore|' : ''; ?><?php echo 'future' === $page['status'] || 'draft' === $page['status'] ? 'publish|' : ''; ?>" />
1212 1197 <input class="websiteId" type="hidden" name="id" value="<?php echo esc_attr( $website->id ); ?>"/>
1213 - <div class="ui right pointing dropdown icon mini basic green button" style="z-index: 999">
1214 - <a href="javascript:void(0)"><i class="ellipsis horizontal icon"></i></a>
1198 + <div class="ui right pointing dropdown" style="z-index: 999">
1199 + <a href="javascript:void(0)"><i class="ellipsis vertical icon"></i></a>
1215 1200 <div class="menu">
1216 1201 <?php if ( 'future' === $page['status'] || 'draft' === $page['status'] ) : ?>
1217 1202 <a class="item page_submitpublish" href="#"><?php esc_html_e( 'Publish', 'mainwp' ); ?></a>
1218 1203 <?php endif; ?>
@@ -1227,9 +1212,11 @@
1227 1212 <?php if ( 'trash' === $page['status'] ) { ?>
1228 1213 <a class="item page_submitrestore" href="#"><?php esc_html_e( 'Restore', 'mainwp' ); ?></a>
1229 1214 <a class="item page_submitdelete_perm" href="#"><?php esc_html_e( 'Delete permanently', 'mainwp' ); ?></a>
1230 1215 <?php } ?>
1231 - <a class="item" href="<?php echo 'admin.php?page=SiteOpen&newWindow=yes&websiteid=' . intval( $website->id ); ?>&_opennonce=<?php echo esc_html( wp_create_nonce( 'mainwp-admin-nonce' ) ); ?>" data-tooltip="<?php esc_attr_e( 'Jump to the site WP Admin', 'mainwp' ); ?>" data-position="bottom right" data-inverted="" class="open_newwindow_wpadmin ui green basic icon button" target="_blank"><?php esc_html_e( 'Go to WP Admin', 'mainwp' ); ?></a>
1216 + <a class="item mainwp-copy-row-value" href="#" data-copy-target=".copyPermalinkValue" data-copy-success="<?php echo esc_attr__( 'Copied permalink to clipboard.', 'mainwp' ); ?>"><?php esc_html_e( 'Copy Permalink', 'mainwp' ); ?></a>
1217 + <a class="item mainwp-copy-row-value" href="#" data-copy-target=".pageId" data-copy-success="<?php echo esc_attr__( 'Copied ID to clipboard.', 'mainwp' ); ?>"><?php esc_html_e( 'Copy ID', 'mainwp' ); ?></a>
1218 + <a class="item" href="<?php MainWP_Site_Open::get_open_site_admin_link( $website->id, true ); //phpcs:ignore -- ok. ?>" data-tooltip="<?php esc_attr_e( 'Jump to the site WP Admin', 'mainwp' ); ?>" data-position="bottom right" data-inverted="" class="open_newwindow_wpadmin ui green basic icon button" target="_blank"><?php esc_html_e( 'Go to WP Admin', 'mainwp' ); ?></a>
1232 1219 <?php
1233 1220 /**
1234 1221 * Action: mainwp_pages_table_action
1235 1222 *
@@ -1329,10 +1316,10 @@
1329 1316 *
1330 1317 * @return void
1331 1318 */
1332 1319 public static function render_bulk_add() {
1333 - if ( ! mainwp_current_user_have_right( 'dashboard', 'manage_pages' ) ) {
1334 - mainwp_do_not_have_permissions( esc_html__( 'manage pages', 'mainwp' ) );
1320 + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_pages' ) ) {
1321 + \mainwp_do_not_have_permissions( esc_html__( 'manage pages', 'mainwp' ) );
1335 1322 return;
1336 1323 }
1337 1324
1338 1325 /**
@@ -1354,10 +1341,10 @@
1354 1341 *
1355 1342 * @return void
1356 1343 */
1357 1344 public static function render_bulk_edit() {
1358 - if ( ! mainwp_current_user_have_right( 'dashboard', 'manage_pages' ) ) {
1359 - mainwp_do_not_have_permissions( esc_html__( 'manage pages', 'mainwp' ) );
1345 + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_pages' ) ) {
1346 + \mainwp_do_not_have_permissions( esc_html__( 'manage pages', 'mainwp' ) );
1360 1347 return;
1361 1348 }
1362 1349
1363 1350 $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
@@ -1691,9 +1678,9 @@
1691 1678 }
1692 1679 } else {
1693 1680 ?>
1694 1681 <div class="error">
1695 - <p><strong>ERROR</strong>: <?php esc_html_e( 'An undefined error occured.', 'mainwp' ); ?></p>
1682 + <p><strong>ERROR</strong>: <?php esc_html_e( 'An undefined error occurred.', 'mainwp' ); ?></p>
1696 1683 </div>
1697 1684 <?php
1698 1685 }
1699 1686 }
@@ -1703,10 +1690,10 @@
1703 1690 <?php do_action( 'mainwp_pages_posting_popup_actions', $id ); ?>
1704 1691 <a href="admin.php?page=PageBulkAdd" class="ui green button new-bulk-page"><?php esc_html_e( 'New Page', 'mainwp' ); ?></a>
1705 1692 </div>
1706 1693 </div>
1707 - <div class="ui active inverted dimmer" id="mainwp-posting-running">
1708 - <div class="ui indeterminate large text loader"><?php esc_html_e( 'Running ...', 'mainwp' ); ?></div>
1694 + <div class="ui active dimmer" id="mainwp-posting-running">
1695 + <div class="ui double text loader"><?php esc_html_e( 'Running ...', 'mainwp' ); ?></div>
1709 1696 </div>
1710 1697 <script type="text/javascript">
1711 1698 jQuery( document ).ready( function () {
1712 1699 jQuery( "#mainwp-posting-running" ).hide();
@@ -1712,9 +1699,9 @@
1712 1699 jQuery( "#mainwp-posting-running" ).hide();
1713 1700 jQuery( "#mainwp-posting-page-modal" ).modal( {
1714 1701 closable: true,
1715 1702 onHide: function() {
1716 - location.href = 'admin.php?page=PageBulkManage';
1703 + mainwp_forceReload('admin.php?page=PageBulkManage');
1717 1704 }
1718 1705 } ).modal( 'show' );
1719 1706 } );
1720 1707 </script>
@@ -1730,14 +1717,14 @@
1730 1717 if ( isset( $_GET['page'] ) && ( 'PageBulkManage' === $_GET['page'] || 'PageBulkAdd' === $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1731 1718 ?>
1732 1719 <p><?php esc_html_e( 'If you need help with managing pages, please review following help documents', 'mainwp' ); ?></p>
1733 1720 <div class="ui list">
1734 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-pages/" target="_blank">Manage Pages</a></div>
1735 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-pages/#create-a-new-page" target="_blank">Create a New Page</a></div>
1736 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-pages/#edit-a-page" target="_blank">Edit an Existing Page</a></div>
1737 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-pages/#view-existing-page" target="_blank">View an Existing Page</a></div>
1738 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-pages/#delete-a-page" target="_blank">Delete Page(s)</a></div>
1739 - <div class="item"><i class="external alternate icon"></i> <a href="https://kb.mainwp.com/docs/manage-pages/#restore-a-page" target="_blank">Restore Page(s)</a></div>
1721 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-pages" target="_blank">Manage Pages</a></div>
1722 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-pages#create-a-new-page" target="_blank">Create a New Page</a></div>
1723 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-pages#edit-an-existing-page" target="_blank">Edit an Existing Page</a></div>
1724 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-pages#view-a-page-on-its-site" target="_blank">View an Existing Page</a></div>
1725 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-pages#delete-pages" target="_blank">Delete Page(s)</a></div>
1726 + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-pages#restore-a-page" target="_blank">Restore Page(s)</a></div>
1740 1727 <?php
1741 1728 /**
1742 1729 * Action: mainwp_pages_help_item
1743 1730 *