| @@ -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_Posts |
| 12 | 17 | * |
| 13 | 18 | * @uses MainWP_Bulk_Add |
| @@ -85,33 +90,23 @@ | ||
| 85 | 90 | * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() |
| 86 | 91 | * @uses \MainWP\Dashboard\MainWP_Post_Page_Handler::get_class_name() |
| 87 | 92 | */ |
| 88 | 93 | public static function init_menu() { |
| 89 | - $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Posts', 'mainwp' ), '<span id="mainwp-Posts">' . esc_html__( 'Posts', 'mainwp' ) . '</span>', 'read', 'PostBulkManage', array( static::get_class_name(), 'render' ) ); | |
| 94 | + $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Posts', 'mainwp' ), '<span id="mainwp-Posts">' . esc_html__( 'Posts', 'mainwp' ) . '</span>', 'manage_options', 'PostBulkManage', array( static::get_class_name(), 'render' ) ); | |
| 90 | 95 | add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_page' ) ); |
| 91 | 96 | add_filter( 'manage_' . $_page . '_columns', array( static::get_class_name(), 'get_manage_columns' ) ); |
| 92 | 97 | |
| 93 | 98 | if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PostBulkAdd' ) ) { |
| 94 | - $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Posts', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Add New', 'mainwp' ) . '</div>', 'read', 'PostBulkAdd', array( static::get_class_name(), 'render_bulk_add' ) ); | |
| 99 | + $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Posts', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Add New', 'mainwp' ) . '</div>', 'manage_options', 'PostBulkAdd', array( static::get_class_name(), 'render_bulk_add' ) ); | |
| 95 | 100 | add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_add_edit' ) ); |
| 96 | 101 | } |
| 97 | 102 | |
| 98 | 103 | if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PostBulkEdit' ) ) { |
| 99 | - $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Posts', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Edit Post', 'mainwp' ) . '</div>', 'read', 'PostBulkEdit', array( static::get_class_name(), 'render_bulk_edit' ) ); | |
| 104 | + $_page = add_submenu_page( 'mainwp_tab', esc_html__( 'Posts', 'mainwp' ), '<div class="mainwp-hidden">' . esc_html__( 'Edit Post', 'mainwp' ) . '</div>', 'manage_options', 'PostBulkEdit', array( static::get_class_name(), 'render_bulk_edit' ) ); | |
| 100 | 105 | add_action( 'load-' . $_page, array( static::get_class_name(), 'on_load_add_edit' ) ); |
| 101 | 106 | } |
| 102 | 107 | |
| 103 | - add_submenu_page( | |
| 104 | - 'mainwp_tab', | |
| 105 | - 'Posting new bulkpost', | |
| 106 | - '<div class="mainwp-hidden">' . esc_html__( 'Posts', 'mainwp' ) . '</div>', | |
| 107 | - 'read', | |
| 108 | - 'PostingBulkPost', | |
| 109 | - array( | |
| 110 | - MainWP_Post_Page_Handler::get_class_name(), | |
| 111 | - 'posting_bulk', | |
| 112 | - ) | |
| 113 | - ); | |
| 108 | + add_submenu_page( 'mainwp_tab', 'Posting new bulkpost', '<div class="mainwp-hidden">' . esc_html__( 'Posts', 'mainwp' ) . '</div>', 'manage_options', 'PostingBulkPost', array( MainWP_Post_Page_Handler::get_class_name(), 'posting_bulk' ) ); | |
| 114 | 109 | |
| 115 | 110 | /** |
| 116 | 111 | * Posts Subpages |
| 117 | 112 | * |
| @@ -127,14 +122,15 @@ | ||
| 127 | 122 | foreach ( static::$subPages as $subPage ) { |
| 128 | 123 | if ( MainWP_Menu::is_disable_menu_item( 3, 'Post' . $subPage['slug'] ) ) { |
| 129 | 124 | continue; |
| 130 | 125 | } |
| 131 | - add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'read', 'Post' . $subPage['slug'], $subPage['callback'] ); | |
| 126 | + add_submenu_page( 'mainwp_tab', $subPage['title'], '<div class="mainwp-hidden">' . $subPage['title'] . '</div>', 'manage_options', 'Post' . $subPage['slug'], $subPage['callback'] ); | |
| 132 | 127 | } |
| 133 | 128 | } |
| 134 | 129 | static::init_left_menu( static::$subPages ); |
| 135 | 130 | } |
| 136 | 131 | |
| 132 | + | |
| 137 | 133 | /** |
| 138 | 134 | * Method on_load_page() |
| 139 | 135 | * |
| 140 | 136 | * Used during init_menu() to get the class names of, |
| @@ -148,8 +144,36 @@ | ||
| 148 | 144 | add_action( 'mainwp_screen_options_modal_bottom', array( static::get_class_name(), 'hook_screen_options_modal_bottom' ), 10, 2 ); |
| 149 | 145 | } |
| 150 | 146 | |
| 151 | 147 | /** |
| 148 | + * Init custom bulkpost metaboxes. | |
| 149 | + * | |
| 150 | + * @return void | |
| 151 | + */ | |
| 152 | + public static function init_custom_metaboxes() { | |
| 153 | + $metaboxes = apply_filters( 'mainwp_edit_bulkpost_getmetaboxes', array() ); // hooks load widgets for individual overview page and for manage sites's subpage. | |
| 154 | + foreach ( $metaboxes as $idx => $metaBox ) { | |
| 155 | + MainWP_UI::add_bulkpost_widget_box( $idx, $metaBox ); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * Method get_fix_metabox_page(). | |
| 161 | + * | |
| 162 | + * @param string $page page. | |
| 163 | + * | |
| 164 | + * @return string | |
| 165 | + */ | |
| 166 | + public static function get_fix_metabox_page( $page ) { | |
| 167 | + if ( 'mainwp_page_PostBulkAdd' === $page || 'mainwp_page_PostBulkEdit' === $page ) { | |
| 168 | + $page = 'bulkpost'; | |
| 169 | + } elseif ( 'mainwp_page_PageBulkAdd' === $page || 'mainwp_page_PageBulkEdit' === $page ) { | |
| 170 | + $page = 'bulkpage'; | |
| 171 | + } | |
| 172 | + return $page; | |
| 173 | + } | |
| 174 | + | |
| 175 | + /** | |
| 152 | 176 | * Method on_load_add_edit() |
| 153 | 177 | * |
| 154 | 178 | * Get the post ID, |
| 155 | 179 | * pass it to method on_load_bulkpost(). |
| @@ -156,9 +180,8 @@ | ||
| 156 | 180 | * |
| 157 | 181 | * @return void static::on_load_bulkpost( $post_id ). |
| 158 | 182 | */ |
| 159 | 183 | public static function on_load_add_edit() { |
| 160 | - global $_mainwp_menu_active_slugs; | |
| 161 | 184 | if ( isset( $_GET['page'] ) && 'PostBulkAdd' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 162 | 185 | |
| 163 | 186 | /** |
| 164 | 187 | * MainWP default post to edit. |
| @@ -170,10 +193,9 @@ | ||
| 170 | 193 | $post_type = 'bulkpost'; |
| 171 | 194 | $_mainwp_default_post_to_edit = get_default_post_to_edit( $post_type, true ); |
| 172 | 195 | $post_id = $_mainwp_default_post_to_edit ? $_mainwp_default_post_to_edit->ID : 0; |
| 173 | 196 | } else { |
| 174 | - $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 175 | - $_mainwp_menu_active_slugs['PostBulkEdit'] = 'PostBulkManage'; // to fix hidden second menu level. | |
| 197 | + $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 176 | 198 | } |
| 177 | 199 | |
| 178 | 200 | if ( ! $post_id ) { |
| 179 | 201 | wp_die( esc_html__( 'Invalid post.', 'mainwp' ) ); |
| @@ -179,8 +201,9 @@ | ||
| 179 | 201 | wp_die( esc_html__( 'Invalid post.', 'mainwp' ) ); |
| 180 | 202 | } |
| 181 | 203 | |
| 182 | 204 | static::on_load_bulkpost( $post_id ); |
| 205 | + static::init_custom_metaboxes(); | |
| 183 | 206 | } |
| 184 | 207 | |
| 185 | 208 | /** |
| 186 | 209 | * Method on_load_bulkpost() |
| @@ -314,49 +337,8 @@ | ||
| 314 | 337 | } |
| 315 | 338 | } |
| 316 | 339 | |
| 317 | 340 | /** |
| 318 | - * Method init_subpages_menu() | |
| 319 | - * | |
| 320 | - * Initiate subpages menu. | |
| 321 | - * | |
| 322 | - * @return void Render subpages menu. | |
| 323 | - * | |
| 324 | - * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() | |
| 325 | - */ | |
| 326 | - public static function init_subpages_menu() { // phpcs:ignore -- NOSONAR - complex. | |
| 327 | - ?> | |
| 328 | - <div id="menu-mainwp-Posts" class="mainwp-submenu-wrapper"> | |
| 329 | - <div class="wp-submenu sub-open"> | |
| 330 | - <div class="mainwp_boxout"> | |
| 331 | - <div class="mainwp_boxoutin"></div> | |
| 332 | - <?php if ( mainwp_current_user_have_right( 'dashboard', 'manage_posts' ) ) { ?> | |
| 333 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=PostBulkManage' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Manage Posts', 'mainwp' ); ?></a> | |
| 334 | - <?php if ( ! MainWP_Menu::is_disable_menu_item( 3, 'PostBulkAdd' ) ) { ?> | |
| 335 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=PostBulkAdd' ) ); ?>" class="mainwp-submenu"><?php esc_html_e( 'Add New', 'mainwp' ); ?></a> | |
| 336 | - <?php } ?> | |
| 337 | - <?php } ?> | |
| 338 | - <?php | |
| 339 | - if ( isset( static::$subPages ) && is_array( static::$subPages ) ) { | |
| 340 | - foreach ( static::$subPages as $subPage ) { | |
| 341 | - if ( ! isset( $subPage['menu_hidden'] ) || ( isset( $subPage['menu_hidden'] ) && true !== $subPage['menu_hidden'] ) ) { | |
| 342 | - if ( MainWP_Menu::is_disable_menu_item( 3, 'Post' . $subPage['slug'] ) ) { | |
| 343 | - continue; | |
| 344 | - } | |
| 345 | - ?> | |
| 346 | - <a href="<?php echo esc_url( admin_url( 'admin.php?page=Post' . $subPage['slug'] ) ); ?>" class="mainwp-submenu"><?php echo esc_html( $subPage['title'] ); ?></a> | |
| 347 | - <?php | |
| 348 | - } | |
| 349 | - } | |
| 350 | - } | |
| 351 | - ?> | |
| 352 | - </div> | |
| 353 | - </div> | |
| 354 | - </div> | |
| 355 | - <?php | |
| 356 | - } | |
| 357 | - | |
| 358 | - /** | |
| 359 | 341 | * Method init_left_menu() |
| 360 | 342 | * |
| 361 | 343 | * Initiate left menu. |
| 362 | 344 | * |
| @@ -368,38 +350,37 @@ | ||
| 368 | 350 | * @uses \MainWP\Dashboard\MainWP_Menu::init_subpages_left_menu() |
| 369 | 351 | * @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() |
| 370 | 352 | */ |
| 371 | 353 | public static function init_left_menu( $subPages = array() ) { |
| 372 | - | |
| 373 | - MainWP_Menu::add_left_menu( | |
| 374 | - array( | |
| 375 | - 'title' => esc_html__( 'Posts', 'mainwp' ), | |
| 376 | - 'parent_key' => 'managesites', | |
| 377 | - 'slug' => 'PostBulkManage', | |
| 378 | - 'href' => 'admin.php?page=PostBulkManage', | |
| 379 | - 'icon' => '<i class="file alternate icon"></i>', | |
| 380 | - 'leftsub_order' => 8, | |
| 381 | - ), | |
| 382 | - 1 | |
| 383 | - ); | |
| 384 | - | |
| 385 | 354 | $init_sub_subleftmenu = array( |
| 386 | 355 | array( |
| 387 | 356 | 'title' => esc_html__( 'Manage Posts', 'mainwp' ), |
| 388 | - 'parent_key' => 'PostBulkManage', | |
| 357 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 389 | 358 | 'href' => 'admin.php?page=PostBulkManage', |
| 390 | 359 | 'slug' => 'PostBulkManage', |
| 391 | 360 | 'right' => 'manage_posts', |
| 392 | 361 | 'leftsub_order_level2' => 1, |
| 362 | + 'active_path' => array( | |
| 363 | + 'PostBulkEdit' => 'PostBulkManage', | |
| 364 | + 'PostBulkAdd' => 'PostBulkManage', | |
| 365 | + ), | |
| 393 | 366 | ), |
| 394 | 367 | array( |
| 395 | 368 | 'title' => esc_html__( 'Add New', 'mainwp' ), |
| 396 | - 'parent_key' => 'PostBulkManage', | |
| 369 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 397 | 370 | 'href' => 'admin.php?page=PostBulkAdd', |
| 398 | 371 | 'slug' => 'PostBulkAdd', |
| 399 | 372 | 'right' => 'manage_posts', |
| 400 | - 'leftsub_order_level2' => 2, | |
| 373 | + 'leftsub_order_level2' => 1, | |
| 401 | 374 | ), |
| 375 | + array( | |
| 376 | + 'title' => esc_html__( 'Edit Post', 'mainwp' ), | |
| 377 | + 'parent_key' => 'Extensions-Mainwp-Content-Operations', | |
| 378 | + 'href' => 'admin.php?page=PostBulkEdit', | |
| 379 | + 'slug' => 'PostBulkEdit', | |
| 380 | + 'right' => 'manage_posts', | |
| 381 | + 'leftsub_order_level2' => 1, | |
| 382 | + ), | |
| 402 | 383 | ); |
| 403 | 384 | MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'PostBulkManage', 'Post' ); |
| 404 | 385 | |
| 405 | 386 | foreach ( $init_sub_subleftmenu as $item ) { |
| @@ -405,9 +386,10 @@ | ||
| 405 | 386 | foreach ( $init_sub_subleftmenu as $item ) { |
| 406 | 387 | if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { |
| 407 | 388 | continue; |
| 408 | 389 | } |
| 409 | - MainWP_Menu::add_left_menu( $item, 2 ); | |
| 390 | + $level = ( 'PostBulkManage' === $item['slug'] ) ? 2 : 3; | |
| 391 | + MainWP_Menu::add_left_menu( $item, $level ); | |
| 410 | 392 | } |
| 411 | 393 | } |
| 412 | 394 | |
| 413 | 395 | /** |
| @@ -452,9 +434,9 @@ | ||
| 452 | 434 | MainWP_UI::render_top_header( $params ); |
| 453 | 435 | |
| 454 | 436 | $renderItems = array(); |
| 455 | 437 | |
| 456 | - if ( mainwp_current_user_have_right( 'dashboard', 'manage_posts' ) ) { | |
| 438 | + if ( \mainwp_current_user_can( 'dashboard', 'manage_posts' ) ) { | |
| 457 | 439 | $renderItems[] = array( |
| 458 | 440 | 'title' => esc_html__( 'Manage Posts', 'mainwp' ), |
| 459 | 441 | 'href' => 'admin.php?page=PostBulkManage', |
| 460 | 442 | 'active' => ( 'BulkManage' === $shownPage ) ? true : false, |
| @@ -516,10 +498,10 @@ | ||
| 516 | 498 | * |
| 517 | 499 | * @uses \MainWP\Dashboard\MainWP_Cache::get_cached_context() |
| 518 | 500 | */ |
| 519 | 501 | public static function render() { // phpcs:ignore -- NOSONAR - complex. |
| 520 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'manage_posts' ) ) { | |
| 521 | - mainwp_do_not_have_permissions( esc_html__( 'manage posts', 'mainwp' ) ); | |
| 502 | + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_posts' ) ) { | |
| 503 | + \mainwp_do_not_have_permissions( esc_html__( 'manage posts', 'mainwp' ) ); | |
| 522 | 504 | return; |
| 523 | 505 | } |
| 524 | 506 | |
| 525 | 507 | $cachedSearch = MainWP_Cache::get_cached_context( 'Post' ); |
| @@ -591,17 +573,21 @@ | ||
| 591 | 573 | * @since 4.0 |
| 592 | 574 | */ |
| 593 | 575 | do_action( 'mainwp_posts_actions_bar_right' ); |
| 594 | 576 | ?> |
| 577 | + <a href="admin.php?page=PostBulkAdd" class="ui mini green button"><?php esc_html_e( 'Create New Post', 'mainwp' ); ?></a> | |
| 578 | + <?php if ( MainWP_Extensions_Handler::is_extension_available( 'boilerplate-extension' ) ) : ?> | |
| 579 | + <a href="admin.php?page=PostBulkAdd&boilerplate=1" class="ui mini green basic button"><?php esc_html_e( 'Create New Boilerplate', 'mainwp' ); ?></a> | |
| 580 | + <?php endif; ?> | |
| 595 | 581 | </div> |
| 596 | 582 | </div> |
| 597 | 583 | </div> |
| 598 | 584 | </div> |
| 599 | - <div class="ui segment" id="mainwp-posts-table-wrapper"> | |
| 585 | + <div class="ui padded segment" id="mainwp-posts-table-wrapper"> | |
| 600 | 586 | <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-manage-posts-info-message' ) ) : ?> |
| 601 | 587 | <div class="ui info message"> |
| 602 | 588 | <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-manage-posts-info-message"></i> |
| 603 | - <?php printf( esc_html__( 'Manage existing posts 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-posts/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 589 | + <?php /* translators: 1: opening anchor tag, 2: closing anchor tag with icon */ 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-posts" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 604 | 590 | </div> |
| 605 | 591 | <?php endif; ?> |
| 606 | 592 | <?php static::render_table( true ); ?> |
| 607 | 593 | </div> |
| @@ -791,28 +777,30 @@ | ||
| 791 | 777 | } |
| 792 | 778 | |
| 793 | 779 | ?> |
| 794 | 780 | <div class="ui mini form"> |
| 795 | - <div class="field"> | |
| 796 | - <div class="ui input fluid"> | |
| 797 | - <input type="text" placeholder="<?php esc_attr_e( 'Containing keyword', 'mainwp' ); ?>" id="mainwp_post_search_by_keyword" class="text" value="<?php echo ( null !== $cachedSearch ) ? esc_attr( $cachedSearch['keyword'] ) : ''; ?>"/> | |
| 781 | + <div class="two fields"> | |
| 782 | + <div class="field"> | |
| 783 | + <div class="ui input fluid"> | |
| 784 | + <input type="text" placeholder="<?php esc_attr_e( 'Containing keyword', 'mainwp' ); ?>" id="mainwp_post_search_by_keyword" class="text" value="<?php echo ( null !== $cachedSearch ) ? esc_attr( $cachedSearch['keyword'] ) : ''; ?>"/> | |
| 785 | + </div> | |
| 798 | 786 | </div> |
| 787 | + <div class="field"> | |
| 788 | + <?php | |
| 789 | + $searchon = 'title'; | |
| 790 | + if ( null !== $cachedSearch ) { | |
| 791 | + $searchon = $cachedSearch['search_on']; | |
| 792 | + } | |
| 793 | + ?> | |
| 794 | + <select class="ui dropdown fluid" id="mainwp_post_search_on"> | |
| 795 | + <option value=""><?php esc_html_e( 'Search in...', 'mainwp' ); ?></option> | |
| 796 | + <option value="title" <?php echo 'title' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title', 'mainwp' ); ?></option> | |
| 797 | + <option value="content" <?php echo 'content' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Body', 'mainwp' ); ?></option> | |
| 798 | + <option value="all" <?php echo 'all' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title and Body', 'mainwp' ); ?></option> | |
| 799 | + </select> | |
| 800 | + </div> | |
| 799 | 801 | </div> |
| 800 | 802 | <div class="field"> |
| 801 | - <?php | |
| 802 | - $searchon = 'title'; | |
| 803 | - if ( null !== $cachedSearch ) { | |
| 804 | - $searchon = $cachedSearch['search_on']; | |
| 805 | - } | |
| 806 | - ?> | |
| 807 | - <select class="ui dropdown fluid" id="mainwp_post_search_on"> | |
| 808 | - <option value=""><?php esc_html_e( 'Search in...', 'mainwp' ); ?></option> | |
| 809 | - <option value="title" <?php echo 'title' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title', 'mainwp' ); ?></option> | |
| 810 | - <option value="content" <?php echo 'content' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Body', 'mainwp' ); ?></option> | |
| 811 | - <option value="all" <?php echo 'all' === $searchon ? 'selected' : ''; ?>><?php esc_html_e( 'Title and Body', 'mainwp' ); ?></option> | |
| 812 | - </select> | |
| 813 | - </div> | |
| 814 | - <div class="field"> | |
| 815 | 803 | <label><?php esc_html_e( 'Date range', 'mainwp' ); ?></label> |
| 816 | 804 | <div class="two fields"> |
| 817 | 805 | <div class="field"> |
| 818 | 806 | <div class="ui calendar mainwp_datepicker" > |
| @@ -876,9 +864,9 @@ | ||
| 876 | 864 | * |
| 877 | 865 | * @uses \MainWP\Dashboard\MainWP_Cache::echo_body() |
| 878 | 866 | * @uses \MainWP\Dashboard\MainWP_Utility::enabled_wp_seo() |
| 879 | 867 | */ |
| 880 | - public static function render_table( $cached = true, $keyword = '', $dtsstart = '', $dtsstop = '', $status = '', $params = array() ) { | |
| 868 | + public static function render_table( $cached = true, $keyword = '', $dtsstart = '', $dtsstop = '', $status = '', $params = array() ) { // phpcs:ignore -- NOSONAR - complex. | |
| 881 | 869 | |
| 882 | 870 | if ( ! is_array( $params ) ) { |
| 883 | 871 | $params = array(); |
| 884 | 872 | } |
| @@ -890,15 +878,17 @@ | ||
| 890 | 878 | $post_type = isset( $params['post_type'] ) ? $params['post_type'] : ''; |
| 891 | 879 | $search_on = isset( $params['search_on'] ) ? $params['search_on'] : 'all'; |
| 892 | 880 | $clients = isset( $params['clients'] ) ? $params['clients'] : ''; |
| 893 | 881 | |
| 882 | + $has_cached_results = $cached && isset( $_SESSION['MainWPPostSearch'] ) && ! empty( $_SESSION['MainWPPostSearch'] ); | |
| 883 | + | |
| 894 | 884 | ?> |
| 895 | 885 | |
| 896 | 886 | <div id="mainwp-message-zone"></div> |
| 897 | 887 | |
| 898 | 888 | <div id="mainwp-loading-posts-row" style="display: none;"> |
| 899 | - <div class="ui active inverted dimmer"> | |
| 900 | - <div class="ui indeterminate large text loader"><?php esc_html_e( 'Loading Posts...', 'mainwp' ); ?></div> | |
| 889 | + <div class="ui active page dimmer"> | |
| 890 | + <div class="ui double text loader"><?php esc_html_e( 'Loading...', 'mainwp' ); ?></div> | |
| 901 | 891 | </div> |
| 902 | 892 | </div> |
| 903 | 893 | |
| 904 | 894 | <?php |
| @@ -909,9 +899,11 @@ | ||
| 909 | 899 | * |
| 910 | 900 | * @since 4.1 |
| 911 | 901 | */ |
| 912 | 902 | do_action( 'mainwp_before_posts_table' ); |
| 913 | - ?> | |
| 903 | + | |
| 904 | + if ( ! $cached || $has_cached_results ) { | |
| 905 | + ?> | |
| 914 | 906 | <table id="mainwp-posts-table" class="ui unstackable single line table" style="width:100%"> |
| 915 | 907 | <thead class="full-width"> |
| 916 | 908 | <tr> |
| 917 | 909 | <th id="check-column-all" class="no-sort collapsing check-column"><span class="ui checkbox"><input id="cb-select-all-top" type="checkbox" /></span></th> |
| @@ -948,19 +940,26 @@ | ||
| 948 | 940 | </tr> |
| 949 | 941 | </thead> |
| 950 | 942 | |
| 951 | 943 | <tbody id="mainwp-posts-list"> |
| 952 | - <?php | |
| 953 | - if ( $cached ) { | |
| 954 | - MainWP_Cache::echo_body( 'Post' ); | |
| 944 | + <?php | |
| 945 | + if ( $cached ) { | |
| 946 | + MainWP_Cache::echo_body( 'Post' ); | |
| 947 | + } else { | |
| 948 | + MainWP_Cache::init_cache( 'Post' ); | |
| 949 | + static::render_table_body( $keyword, $dtsstart, $dtsstop, $status, $groups, $sites, $postId, $userId, $post_type, $search_on, false, $clients ); | |
| 950 | + } | |
| 951 | + ?> | |
| 952 | + </tbody> | |
| 953 | + </table> | |
| 954 | + <?php | |
| 955 | 955 | } else { |
| 956 | - MainWP_Cache::init_cache( 'Post' ); | |
| 957 | - static::render_table_body( $keyword, $dtsstart, $dtsstop, $status, $groups, $sites, $postId, $userId, $post_type, $search_on, false, $clients ); | |
| 956 | + MainWP_UI::render_empty_page_placeholder( | |
| 957 | + esc_html__( 'Find Posts', 'mainwp' ), | |
| 958 | + esc_html__( 'Select the Child Sites you want, choose any filters, then click Show Posts.', 'mainwp' ), | |
| 959 | + '<em data-emoji=":page_facing_up:" class="big"></em>' | |
| 960 | + ); | |
| 958 | 961 | } |
| 959 | - ?> | |
| 960 | - </tbody> | |
| 961 | - </table> | |
| 962 | - <?php | |
| 963 | 962 | /** |
| 964 | 963 | * Action: mainwp_after_posts_table |
| 965 | 964 | * |
| 966 | 965 | * Fires after the Manage Posts table. |
| @@ -1011,14 +1010,14 @@ | ||
| 1011 | 1010 | "columnDefs": [ { |
| 1012 | 1011 | "targets": 'no-sort', |
| 1013 | 1012 | "orderable": false |
| 1014 | 1013 | } ], |
| 1015 | - "language" : { "emptyTable": "<?php esc_html_e( 'Use the search options to find the post you want to manage.', 'mainwp' ); ?>" }, | |
| 1016 | - "preDrawCallback": function( settings ) { | |
| 1014 | + "language" : { "emptyTable": "<?php esc_html_e( 'No posts found matching your search criteria.', 'mainwp' ); ?>" }, | |
| 1015 | + "drawCallback": function( settings ) { | |
| 1017 | 1016 | setTimeout(() => { // to fix. |
| 1018 | - jQuery( '#mainwp-posts-table-wrapper table .ui.dropdown' ).dropdown(); | |
| 1019 | - jQuery( '#mainwp-posts-table-wrapper table .ui.checkbox' ).checkbox(); | |
| 1020 | - mainwp_datatable_fix_menu_overflow(); | |
| 1017 | + jQuery( '#mainwp-posts-table .ui.dropdown' ).dropdown(); | |
| 1018 | + jQuery( '#mainwp-posts-table .ui.checkbox' ).checkbox(); | |
| 1019 | + mainwp_datatable_fix_menu_overflow('#mainwp-posts-table'); | |
| 1021 | 1020 | mainwp_table_check_columns_init(); // ajax: to fix checkbox all. |
| 1022 | 1021 | }, 1000); |
| 1023 | 1022 | }, |
| 1024 | 1023 | select: { |
| @@ -1038,13 +1037,12 @@ | ||
| 1038 | 1037 | .nodes() |
| 1039 | 1038 | .to$().find('td.check-column .ui.checkbox' ).checkbox('set unchecked'); |
| 1040 | 1039 | } |
| 1041 | 1040 | }).on( 'columns-reordered', function () { |
| 1042 | - console.log('columns-reordered'); | |
| 1043 | 1041 | setTimeout(() => { // to fix. |
| 1044 | 1042 | jQuery( '#mainwp-posts-table .ui.dropdown' ).dropdown(); |
| 1045 | 1043 | jQuery( '#mainwp-posts-table .ui.checkbox' ).checkbox(); |
| 1046 | - mainwp_datatable_fix_menu_overflow(); | |
| 1044 | + mainwp_datatable_fix_menu_overflow('#mainwp-posts-table'); | |
| 1047 | 1045 | mainwp_table_check_columns_init(); // ajax: to fix checkbox all. |
| 1048 | 1046 | }, 1000); |
| 1049 | 1047 | }); |
| 1050 | 1048 | } catch ( err ) { |
| @@ -1250,8 +1248,29 @@ | ||
| 1250 | 1248 | return esc_html( ucfirst( $status ) ); |
| 1251 | 1249 | } |
| 1252 | 1250 | |
| 1253 | 1251 | /** |
| 1252 | + * Get a copyable permalink for a post/page row. | |
| 1253 | + * | |
| 1254 | + * Uses the child response value when available and falls back to | |
| 1255 | + * the plain `?p=` form currently used by the View action. | |
| 1256 | + * | |
| 1257 | + * @param array $item Post or page data. | |
| 1258 | + * @param object $website Website object. | |
| 1259 | + * | |
| 1260 | + * @return string | |
| 1261 | + */ | |
| 1262 | + public static function get_copyable_permalink( $item, $website ) { | |
| 1263 | + foreach ( array( 'permalink', 'link', 'url' ) as $key ) { | |
| 1264 | + if ( ! empty( $item[ $key ] ) && is_string( $item[ $key ] ) ) { | |
| 1265 | + return $item[ $key ]; | |
| 1266 | + } | |
| 1267 | + } | |
| 1268 | + | |
| 1269 | + return trailingslashit( $website->url ) . '?p=' . intval( $item['id'] ); | |
| 1270 | + } | |
| 1271 | + | |
| 1272 | + /** | |
| 1254 | 1273 | * Method posts_search_handler() |
| 1255 | 1274 | * |
| 1256 | 1275 | * Post page search handler. |
| 1257 | 1276 | * |
| @@ -1303,8 +1322,9 @@ | ||
| 1303 | 1322 | |
| 1304 | 1323 | $table_rows = ''; |
| 1305 | 1324 | foreach ( $posts as $post ) { |
| 1306 | 1325 | $raw_dts = ''; |
| 1326 | + $copy_permalink = static::get_copyable_permalink( $post, $website ); | |
| 1307 | 1327 | if ( isset( $post['dts'] ) ) { |
| 1308 | 1328 | $raw_dts = $post['dts']; |
| 1309 | 1329 | if ( ! stristr( $post['dts'], '-' ) ) { |
| 1310 | 1330 | $post['dts'] = MainWP_Utility::format_timestamp( MainWP_Utility::get_timestamp( $post['dts'] ) ); |
| @@ -1332,13 +1352,13 @@ | ||
| 1332 | 1352 | * @since 4.1 |
| 1333 | 1353 | */ |
| 1334 | 1354 | do_action( 'mainwp_posts_table_column', $post, $website ); |
| 1335 | 1355 | ?> |
| 1336 | - <td class="title column-title"> | |
| 1356 | + <td class="title column-title not-selectable"> | |
| 1337 | 1357 | <strong> |
| 1338 | 1358 | <abbr title="<?php echo esc_attr( $post['title'] ); ?>"> |
| 1339 | 1359 | <?php if ( 'trash' !== $post['status'] ) { ?> |
| 1340 | - <a class="row-title" href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php echo intval( $website->id ); ?>&location=<?php echo esc_attr( base64_encode( 'post.php?post=' . $post['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"> | |
| 1360 | + <a class="row-title" href="<?php MainWP_Site_Open::get_open_site_admin_link( $website->id, true ); ?>&location=<?php echo esc_attr( base64_encode( 'post.php?post=' . $post['id'] . '&action=edit' ) ); // phpcs:ignore -- base64_encode used for http encoding compatible. ?>" target="_blank"> | |
| 1341 | 1361 | <?php echo esc_html( $post['title'] ); ?> |
| 1342 | 1362 | </a> |
| 1343 | 1363 | <?php |
| 1344 | 1364 | } else { |
| @@ -1348,20 +1368,20 @@ | ||
| 1348 | 1368 | </abbr> |
| 1349 | 1369 | </strong> |
| 1350 | 1370 | </td> |
| 1351 | 1371 | |
| 1352 | - <td class="author column-author"><?php echo esc_html( $post['author'] ); ?></td> | |
| 1372 | + <td class="author column-author not-selectable"><?php echo esc_html( $post['author'] ); ?></td> | |
| 1353 | 1373 | |
| 1354 | - <td class="categories column-categories"><?php echo esc_html( $post['categories'] ); ?></td> | |
| 1374 | + <td class="categories column-categories not-selectable"><?php echo esc_html( $post['categories'] ); ?></td> | |
| 1355 | 1375 | |
| 1356 | - <td class="tags"><?php echo esc_html( '' === $post['tags'] ? 'No Tags' : $post['tags'] ); ?></td> | |
| 1376 | + <td class="tags not-selectable"><?php echo esc_html( '' === $post['tags'] ? 'No Tags' : $post['tags'] ); ?></td> | |
| 1357 | 1377 | |
| 1358 | 1378 | <?php if ( is_plugin_active( 'mainwp-custom-post-types/mainwp-custom-post-types.php' ) ) : ?> |
| 1359 | - <td class="post-type column-post-type"><?php echo esc_html( $post['post_type'] ); ?></td> | |
| 1379 | + <td class="post-type column-post-type not-selectable"><?php echo esc_html( $post['post_type'] ); ?></td> | |
| 1360 | 1380 | <?php endif; ?> |
| 1361 | 1381 | |
| 1362 | 1382 | <?php if ( is_plugin_active( 'mainwp-comments-extension/mainwp-comments-extension.php' ) ) : ?> |
| 1363 | - <td class="comments column-comments"> | |
| 1383 | + <td class="comments column-comments not-selectable"> | |
| 1364 | 1384 | <div class="post-com-count-wrapper"> |
| 1365 | 1385 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=CommentBulkManage&siteid=' . intval( $website->id ) ) . '&postid=' . $post['id'] ); ?>" title="0 pending" class="post-com-count"><span class="comment-count"><abbr title="<?php echo esc_attr( $post['comment_count'] ); ?>"><?php echo esc_html( $post['comment_count'] ); ?></abbr></span></a> |
| 1366 | 1386 | </div> |
| 1367 | 1387 | </td> |
| @@ -1366,11 +1386,11 @@ | ||
| 1366 | 1386 | </div> |
| 1367 | 1387 | </td> |
| 1368 | 1388 | <?php endif; ?> |
| 1369 | 1389 | |
| 1370 | - <td class="date column-date" data-order="<?php echo esc_attr( $raw_dts ); ?>"><abbr raw_value="<?php echo esc_attr( $raw_dts ); ?>" title="<?php echo esc_attr( $post['dts'] ); ?>"><?php echo esc_html( $post['dts'] ); ?></abbr></td> | |
| 1390 | + <td class="date column-date not-selectable" data-order="<?php echo esc_attr( $raw_dts ); ?>"><abbr raw_value="<?php echo esc_attr( $raw_dts ); ?>" title="<?php echo esc_attr( $post['dts'] ); ?>"><?php echo esc_html( $post['dts'] ); ?></abbr></td> | |
| 1371 | 1391 | |
| 1372 | - <td class="status column-status <?php echo 'trash' === $post['status'] ? 'post-trash' : ''; ?>"><?php echo esc_html( static::get_status( $post['status'] ) ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> | |
| 1392 | + <td class="status column-status not-selectable <?php echo 'trash' === $post['status'] ? 'post-trash' : ''; ?>"><?php echo esc_html( static::get_status( $post['status'] ) ); // phpcs:ignore WordPress.Security.EscapeOutput ?></td> | |
| 1373 | 1393 | |
| 1374 | 1394 | <?php |
| 1375 | 1395 | if ( MainWP_Utility::enabled_wp_seo() ) : |
| 1376 | 1396 | $count_seo_links = null; |
| @@ -1384,21 +1404,22 @@ | ||
| 1384 | 1404 | $seo_score = MainWP_Utility::esc_content( $seo_data['seo_score'], 'mixed' ); |
| 1385 | 1405 | $readability_score = MainWP_Utility::esc_content( $seo_data['readability_score'], 'mixed' ); |
| 1386 | 1406 | } |
| 1387 | 1407 | ?> |
| 1388 | - <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> | |
| 1389 | - <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> | |
| 1390 | - <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> | |
| 1391 | - <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> | |
| 1408 | + <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> | |
| 1409 | + <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> | |
| 1410 | + <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> | |
| 1411 | + <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> | |
| 1392 | 1412 | <?php endif; ?> |
| 1393 | 1413 | |
| 1394 | - <td class="website column-website"><a href="<?php echo esc_url( $website->url ); ?>" target="_blank"><?php echo esc_html( $website->url ); ?></a></td> | |
| 1414 | + <td class="website column-website not-selectable"><a href="<?php echo esc_url( $website->url ); ?>" target="_blank"><?php echo esc_html( $website->url ); ?></a></td> | |
| 1395 | 1415 | <td class="right aligned not-selectable"> |
| 1396 | 1416 | <input class="postId" type="hidden" name="id" value="<?php echo esc_attr( $post['id'] ); ?>"/> |
| 1417 | + <input class="copyPermalinkValue" type="hidden" value="<?php echo esc_url( $copy_permalink ); ?>"/> | |
| 1397 | 1418 | <input class="allowedBulkActions" type="hidden" name="allowedBulkActions" value="|get_edit|trash|delete|<?php echo 'publish' === $post['status'] ? 'unpublish|' : ''; ?><?php echo ( 'pending' === $post['status'] ) ? 'approve|' : ''; ?><?php echo ( 'trash' === $post['status'] ) ? 'restore|' : ''; ?><?php echo ( 'future' === $post['status'] || 'draft' === $post['status'] ) ? 'publish|' : ''; ?>" /> |
| 1398 | 1419 | <input class="websiteId" type="hidden" name="id" value="<?php echo intval( $website->id ); ?>"/> |
| 1399 | - <div class="ui left pointing dropdown icon mini basic green button" style="z-index: 999"> | |
| 1400 | - <a href="javascript:void(0)"><i class="ellipsis horizontal icon"></i></a> | |
| 1420 | + <div class="ui right pointing dropdown" style="z-index: 999"> | |
| 1421 | + <a href="javascript:void(0)"><i class="ellipsis vertical icon"></i></a> | |
| 1401 | 1422 | <div class="menu"> |
| 1402 | 1423 | <?php if ( 'future' === $post['status'] || 'draft' === $post['status'] ) : ?> |
| 1403 | 1424 | <a class="item post_submitpublish" href="#"><?php esc_html_e( 'Publish', 'mainwp' ); ?></a> |
| 1404 | 1425 | <?php endif; ?> |
| @@ -1425,9 +1446,11 @@ | ||
| 1425 | 1446 | <?php } ?> |
| 1426 | 1447 | <?php do_action( 'mainwp_manage_posts_action_item', $post, $child_to_dash_array ); ?> |
| 1427 | 1448 | <a class="item post_submitdelete" href="#"><?php esc_html_e( 'Trash', 'mainwp' ); ?></a> |
| 1428 | 1449 | <?php endif; ?> |
| 1429 | - <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> | |
| 1450 | + <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> | |
| 1451 | + <a class="item mainwp-copy-row-value" href="#" data-copy-target=".postId" data-copy-success="<?php echo esc_attr__( 'Copied ID to clipboard.', 'mainwp' ); ?>"><?php esc_html_e( 'Copy ID', 'mainwp' ); ?></a> | |
| 1452 | + <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> | |
| 1430 | 1453 | <?php |
| 1431 | 1454 | /** |
| 1432 | 1455 | * Action: mainwp_posts_table_action |
| 1433 | 1456 | * |
| @@ -1576,12 +1599,12 @@ | ||
| 1576 | 1599 | } |
| 1577 | 1600 | ?> |
| 1578 | 1601 | |
| 1579 | 1602 | <div class="two column row" id="mainwp-metaform-row"> |
| 1580 | - <div class="column"> | |
| 1603 | + <div class="column field"> | |
| 1581 | 1604 | <label for="<?php echo esc_attr( $meta_key_input_id ); ?>"><?php esc_html_e( 'Name', 'mainwp' ); ?></label> |
| 1582 | 1605 | <?php if ( $keys ) { ?> |
| 1583 | - <select id="metakeyselect" name="metakeyselect"> | |
| 1606 | + <select id="metakeyselect" name="metakeyselect" class="ui dropdown"> | |
| 1584 | 1607 | <option value="#NONE#"><?php esc_html_e( '— Select —', 'mainwp' ); ?></option> |
| 1585 | 1608 | <?php |
| 1586 | 1609 | foreach ( $keys as $key ) { |
| 1587 | 1610 | if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $_post->ID, $key ) ) { |
| @@ -1590,12 +1613,13 @@ | ||
| 1590 | 1613 | echo "\n<option value='" . esc_attr( $key ) . "'>" . esc_html( $key ) . '</option>'; |
| 1591 | 1614 | } |
| 1592 | 1615 | ?> |
| 1593 | 1616 | </select> |
| 1594 | - <input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" value="" /> | |
| 1595 | - <a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery( '#metakeyinput, #metakeyselect, #enternew, #cancelnew' ).toggle();return false;"> | |
| 1617 | + <input style="display:none;" type="text" id="metakeyinput" name="metakeyinput" value="" /> | |
| 1618 | + <br/> | |
| 1619 | + <a href="#postcustomstuff" class="ui mini basic grey button" onclick="jQuery('div.ui.dropdown:has(#metakeyselect), #metakeyinput, #enternew, #cancelnew').toggle();return false;"> | |
| 1596 | 1620 | <span id="enternew"><?php esc_html_e( 'Enter new', 'mainwp' ); ?></span> |
| 1597 | - <span id="cancelnew" class="hidden"><?php esc_html_e( 'Cancel', 'mainwp' ); ?></span> | |
| 1621 | + <span id="cancelnew" style="display:none;"><?php esc_html_e( 'Cancel', 'mainwp' ); ?></span> | |
| 1598 | 1622 | </a> |
| 1599 | 1623 | <?php } else { ?> |
| 1600 | 1624 | <input type="text" id="metakeyinput" name="metakeyinput" value="" /> |
| 1601 | 1625 | <?php } ?> |
| @@ -1604,8 +1628,9 @@ | ||
| 1604 | 1628 | <label for="metavalue"><?php esc_html_e( 'Value', 'mainwp' ); ?></label> |
| 1605 | 1629 | <textarea id="metavalue" name="metavalue" rows="2" cols="25"></textarea> |
| 1606 | 1630 | </div> |
| 1607 | 1631 | </div> |
| 1632 | + <div class="ui divider"></div> | |
| 1608 | 1633 | <div class="two column row"> |
| 1609 | 1634 | <div class="column"> |
| 1610 | 1635 | <input type="button" onclick="mainwp_post_newmeta_submit( 'add' )" class="ui mini button" value="<?php esc_attr_e( 'Add Custom Field', 'mainwp' ); ?>"> |
| 1611 | 1636 | </div> |
| @@ -1624,28 +1649,33 @@ | ||
| 1624 | 1649 | * @param object $post Current post object. |
| 1625 | 1650 | */ |
| 1626 | 1651 | public static function post_custom_meta_box( $post ) { |
| 1627 | 1652 | ?> |
| 1628 | - <div class="ui secondary segment"> | |
| 1629 | - <div class="ui header"><?php esc_html_e( 'Custom Fields', 'mainwp' ); ?></div> | |
| 1630 | - <div class="ui grid"> | |
| 1631 | - <?php | |
| 1632 | - $metadata = has_meta( $post->ID ); | |
| 1633 | - foreach ( $metadata as $key => $value ) { | |
| 1634 | - if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) { | |
| 1635 | - unset( $metadata[ $key ] ); | |
| 1653 | + <div class="ui fluid accordion mainwp-sidebar-accordion" style="background:none!important;"> | |
| 1654 | + <div class="title active" style="background:none!important;"> | |
| 1655 | + <i class="dropdown icon"></i> | |
| 1656 | + <?php esc_html_e( 'Custom Fields', 'mainwp' ); ?> | |
| 1657 | + </div> | |
| 1658 | + <div class="content active" style="background:none!important;"> | |
| 1659 | + <div class="ui grid"> | |
| 1660 | + <?php | |
| 1661 | + $metadata = has_meta( $post->ID ); | |
| 1662 | + foreach ( $metadata as $key => $value ) { | |
| 1663 | + if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) { | |
| 1664 | + unset( $metadata[ $key ] ); | |
| 1665 | + } | |
| 1636 | 1666 | } |
| 1637 | - } | |
| 1638 | 1667 | |
| 1639 | - $count = 0; | |
| 1640 | - if ( $metadata ) { | |
| 1641 | - foreach ( $metadata as $entry ) { | |
| 1642 | - echo static::list_meta_row( $entry, $count ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1668 | + $count = 0; | |
| 1669 | + if ( $metadata ) { | |
| 1670 | + foreach ( $metadata as $entry ) { | |
| 1671 | + echo static::list_meta_row( $entry, $count ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1672 | + } | |
| 1643 | 1673 | } |
| 1644 | - } | |
| 1645 | 1674 | |
| 1646 | - static::meta_form( $post ); | |
| 1647 | - ?> | |
| 1675 | + static::meta_form( $post ); | |
| 1676 | + ?> | |
| 1677 | + </div> | |
| 1648 | 1678 | </div> |
| 1649 | 1679 | </div> |
| 1650 | 1680 | <?php |
| 1651 | 1681 | } |
| @@ -1695,9 +1725,9 @@ | ||
| 1695 | 1725 | |
| 1696 | 1726 | if ( ! empty( $thumbnail_html ) ) { |
| 1697 | 1727 | $thumb_ok = true; |
| 1698 | 1728 | |
| 1699 | - $set_thumbnail_link = '<p class="hide-if-no-js"><div class="field"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></div></p>'; | |
| 1729 | + $set_thumbnail_link = '<p class="hide-if-no-js"><div class="field"><a href="%s" id="set-post-thumbnail" %s class="thickbox">%s</a></div></p>'; | |
| 1700 | 1730 | $content = '<div class="ui setment">'; |
| 1701 | 1731 | $content .= sprintf( |
| 1702 | 1732 | $set_thumbnail_link, |
| 1703 | 1733 | esc_url( $upload_iframe_src ), |
| @@ -1723,9 +1753,9 @@ | ||
| 1723 | 1753 | $content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr( $thumbnail_id ? $thumbnail_id : '-1' ) . '" />'; |
| 1724 | 1754 | |
| 1725 | 1755 | $html = '<div class="ui fluid accordion mainwp-sidebar-accordion">'; |
| 1726 | 1756 | $html .= '<div class="title active"><i class="dropdown icon"></i> ' . esc_html__( 'Featured Image', 'mainwp' ) . '</div>'; |
| 1727 | - $html .= '<div class="content active"'; | |
| 1757 | + $html .= '<div class="content active">'; | |
| 1728 | 1758 | $html .= $content; |
| 1729 | 1759 | $html .= '</div>'; |
| 1730 | 1760 | $html .= '</div>'; |
| 1731 | 1761 | |
| @@ -1808,8 +1838,9 @@ | ||
| 1808 | 1838 | for ( $i = 1; $i < 13; ++$i ) { |
| 1809 | 1839 | $monthnum = zeroise( $i, 2 ); |
| 1810 | 1840 | $monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ); |
| 1811 | 1841 | $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>'; |
| 1842 | + /* translators: 1: month number, 2: month abbreviation */ | |
| 1812 | 1843 | $month .= sprintf( esc_html__( '%1$s-%2$s', 'mainwp' ), $monthnum, $monthtext ) . "</option>\n"; |
| 1813 | 1844 | } |
| 1814 | 1845 | |
| 1815 | 1846 | $month .= '</select></label>'; |
| @@ -1819,8 +1850,9 @@ | ||
| 1819 | 1850 | $hour = '<label><span class="screen-reader-text">' . esc_html__( 'Hour', 'mainwp' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>'; |
| 1820 | 1851 | $minute = '<label><span class="screen-reader-text">' . esc_html__( 'Minute', 'mainwp' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>'; |
| 1821 | 1852 | |
| 1822 | 1853 | echo '<div class="timestamp-wrap">'; |
| 1854 | + /* translators: 1: month dropdown, 2: day input, 3: year input, 4: hour input, 5: minute input */ | |
| 1823 | 1855 | printf( esc_html__( '%1$s %2$s, %3$s @ %4$s:%5$s', 'mainwp' ), $month, $day, $year, $hour, $minute ); // phpcs:ignore WordPress.Security.EscapeOutput |
| 1824 | 1856 | |
| 1825 | 1857 | echo '</div><input type="hidden" id="ss" name="ss" value="' . esc_attr( $ss ) . '" />'; |
| 1826 | 1858 | |
| @@ -1880,10 +1912,14 @@ | ||
| 1880 | 1912 | } elseif ( 'mainwp_page_PageBulkAdd' === $page || 'mainwp_page_PageBulkEdit' === $page ) { |
| 1881 | 1913 | $page = 'bulkpage'; |
| 1882 | 1914 | } |
| 1883 | 1915 | |
| 1884 | - printf( '<div id="%s-sortables" class="meta-box-sortables">', esc_attr( $context ) ); | |
| 1916 | + if ( ! is_array( $wp_meta_boxes ) || empty( $wp_meta_boxes[ $page ][ $context ] ) ) { | |
| 1917 | + return; | |
| 1918 | + } | |
| 1885 | 1919 | |
| 1920 | + printf( '<div id="%s-sortables" class="meta-box-sortables ui secondary postbox-container segment">', esc_attr( $context ) ); | |
| 1921 | + | |
| 1886 | 1922 | $sorted = get_user_option( "meta-box-order_$page" ); |
| 1887 | 1923 | if ( ! $already_sorted && $sorted ) { |
| 1888 | 1924 | foreach ( $sorted as $widget_context => $ids ) { |
| 1889 | 1925 | foreach ( explode( ',', $ids ) as $id ) { |
| @@ -1901,14 +1937,14 @@ | ||
| 1901 | 1937 | if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
| 1902 | 1938 | foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { |
| 1903 | 1939 | if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
| 1904 | 1940 | foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
| 1905 | - if ( false === $box || ! $box['title'] ) { | |
| 1941 | + if ( false === $box || ! isset( $box['title'] ) ) { | |
| 1906 | 1942 | continue; |
| 1907 | 1943 | } |
| 1908 | 1944 | |
| 1909 | 1945 | $block_compatible = true; |
| 1910 | - if ( is_array( $box['args'] ) ) { | |
| 1946 | + if ( isset( $box['args'] ) && is_array( $box['args'] ) ) { | |
| 1911 | 1947 | if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) { |
| 1912 | 1948 | continue; |
| 1913 | 1949 | } |
| 1914 | 1950 | |
| @@ -1929,26 +1965,22 @@ | ||
| 1929 | 1965 | } |
| 1930 | 1966 | |
| 1931 | 1967 | ++$i; |
| 1932 | 1968 | echo '<div id="' . esc_attr( $box['id'] ) . '" class="postbox" >' . "\n"; |
| 1933 | - if ( 'dashboard_browser_nag' !== $box['id'] ) { | |
| 1934 | - $widget_title = $box['title']; | |
| 1969 | + if ( 'dashboard_browser_nag' !== $box['id'] && isset( $box['args'] ) && is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { | |
| 1970 | + unset( $box['args']['__widget_basename'] ); | |
| 1971 | + } | |
| 1935 | 1972 | |
| 1936 | - if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { | |
| 1937 | - $widget_title = $box['args']['__widget_basename']; | |
| 1938 | - unset( $box['args']['__widget_basename'] ); | |
| 1939 | - } | |
| 1973 | + $title = $box['title']; | |
| 1974 | + if ( empty( $box['metabox-custom'] ) && ! empty( $title ) ) { | |
| 1975 | + $title = '{' . $title . '}'; | |
| 1976 | + } | |
| 1940 | 1977 | |
| 1941 | - echo '<button type="button" class="handlediv" aria-expanded="true">'; | |
| 1942 | - echo '<span class="screen-reader-text">' . sprintf( esc_html__( 'Toggle panel: %s', 'mainwp' ), esc_html( $widget_title ) ) . '</span>'; // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1943 | - echo '<span class="toggle-indicator" aria-hidden="true"></span>'; | |
| 1944 | - echo '</button>'; | |
| 1945 | - } | |
| 1946 | - echo "<h2 class='hndle'><span>{" . esc_html( $box['title'] ) . "}</span></h2>\n"; | |
| 1978 | + echo '<div class="postbox-header"><h2 class="hndle"><span>' . esc_html( $title ) . "</span></h2></div>\n"; | |
| 1947 | 1979 | echo '<div class="inside">' . "\n"; |
| 1948 | 1980 | |
| 1949 | 1981 | // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 1950 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { | |
| 1982 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG && empty( $box['metabox-custom'] ) && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { | |
| 1951 | 1983 | $plugin = _get_plugin_from_callback( $box['callback'] ); |
| 1952 | 1984 | if ( $plugin ) { |
| 1953 | 1985 | ?> |
| 1954 | 1986 | <div class="error inline"> |
| @@ -1953,8 +1985,9 @@ | ||
| 1953 | 1985 | ?> |
| 1954 | 1986 | <div class="error inline"> |
| 1955 | 1987 | <p> |
| 1956 | 1988 | <?php |
| 1989 | + /* translators: %s: plugin name wrapped in strong tag */ | |
| 1957 | 1990 | printf( esc_html__( 'This meta box, from the %s plugin, is not compatible with the block editor.', 'mainwp' ), '<strong>{' . esc_html( $plugin['Name'] ) . '}</strong>' ); // phpcs:ignore WordPress.Security.EscapeOutput |
| 1958 | 1991 | ?> |
| 1959 | 1992 | </p> |
| 1960 | 1993 | </div> |
| @@ -1961,9 +1994,11 @@ | ||
| 1961 | 1994 | <?php |
| 1962 | 1995 | } |
| 1963 | 1996 | } |
| 1964 | 1997 | // phpcs:enable |
| 1965 | - call_user_func( $box['callback'], $input_obj, $box ); | |
| 1998 | + if ( is_callable( $box['callback'] ) ) { | |
| 1999 | + call_user_func( $box['callback'], $input_obj, $box ); | |
| 2000 | + } | |
| 1966 | 2001 | echo "</div>\n"; |
| 1967 | 2002 | echo "</div>\n"; |
| 1968 | 2003 | } |
| 1969 | 2004 | } |
| @@ -2008,8 +2043,10 @@ | ||
| 2008 | 2043 | } |
| 2009 | 2044 | |
| 2010 | 2045 | $post_ID = $post->ID; |
| 2011 | 2046 | |
| 2047 | + $GLOBAL['bulkpost_edit'] = $post; | |
| 2048 | + | |
| 2012 | 2049 | /** |
| 2013 | 2050 | * Current user global. |
| 2014 | 2051 | * |
| 2015 | 2052 | * @global string |
| @@ -2070,9 +2107,9 @@ | ||
| 2070 | 2107 | wp_original_referer_field( true, 'previous' ); |
| 2071 | 2108 | } |
| 2072 | 2109 | echo $form_extra; // phpcs:ignore WordPress.Security.EscapeOutput |
| 2073 | 2110 | ?> |
| 2074 | - <div class="mainwp-main-content"> | |
| 2111 | + <div class="mainwp-main-content ui padded segment"> | |
| 2075 | 2112 | <?php do_action( 'mainwp_top_bulkpost_edit_content', $post ); ?> |
| 2076 | 2113 | <div class="ui red message" id="mainwp-message-zone" style="display:none"></div> |
| 2077 | 2114 | <?php |
| 2078 | 2115 | if ( $message ) { |
| @@ -2091,18 +2128,14 @@ | ||
| 2091 | 2128 | </div> |
| 2092 | 2129 | <?php endif; ?> |
| 2093 | 2130 | <?php endif; ?> |
| 2094 | 2131 | |
| 2095 | - | |
| 2096 | - <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-create-new-bulkpost-info-message' ) ) : ?> | |
| 2132 | + <?php if ( MainWP_Utility::show_mainwp_message( 'notice', 'mainwp-legacy-content-editor-info-message' ) ) : ?> | |
| 2097 | 2133 | <?php if ( ! isset( $_GET['boilerplate'] ) ) : ?> |
| 2098 | - <div class="ui message info"> | |
| 2099 | - <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-create-new-bulkpost-info-message"></i> | |
| 2100 | - <?php if ( 'bulkpost' === $post_type ) : ?> | |
| 2101 | - <?php printf( esc_html__( 'Create a new bulk post. Scheduling posts on Child Sites is almost the same as publishing it. The only difference is before clicking the Publish button is setting it to Scheduled status and setting the time. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/create-a-new-post/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 2102 | - <?php else : ?> | |
| 2103 | - <?php printf( esc_html__( 'Create a new bulk page. Scheduling pages on Child Sites is almost the same as publishing it. The only difference is before clicking the Publish button is setting it to Scheduled status and setting the time. For additional help, please check this %1$shelp documentation%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/create-a-new-page/" target="_blank">', '</a> <i class="external alternate icon"></i>' ); ?> | |
| 2104 | - <?php endif; ?> | |
| 2134 | + <div class="ui blue message"> | |
| 2135 | + <i class="close icon mainwp-notice-dismiss" notice-id="mainwp-legacy-content-editor-info-message"></i> | |
| 2136 | + <div class="header"><?php esc_html_e( 'Legacy Editing Mode', 'mainwp' ); ?></div> | |
| 2137 | + <p><?php esc_html_e( 'This editor supports basic classic content editing only. Block and layout editing is intentionally handled inside each site.', 'mainwp' ); ?></p> | |
| 2105 | 2138 | </div> |
| 2106 | 2139 | <?php endif; ?> |
| 2107 | 2140 | <?php endif; ?> |
| 2108 | 2141 | <?php // phpcs:enable ?> |
| @@ -2153,9 +2186,9 @@ | ||
| 2153 | 2186 | ); |
| 2154 | 2187 | |
| 2155 | 2188 | ?> |
| 2156 | 2189 | <table id="post-status-info"><tbody><tr> |
| 2157 | - <td id="wp-word-count" class="hide-if-no-js"><?php printf( esc_html__( 'Word count: %s', 'mainwp' ), '<span class="word-count">0</span>' ); ?></td> | |
| 2190 | + <td id="wp-word-count" class="hide-if-no-js"><?php /* translators: %s: word count span element */ printf( esc_html__( 'Word count: %s', 'mainwp' ), '<span class="word-count">0</span>' ); ?></td> | |
| 2158 | 2191 | <td class="autosave-info"> |
| 2159 | 2192 | <span class="autosave-message"> </span> |
| 2160 | 2193 | <?php |
| 2161 | 2194 | if ( 'auto-draft' !== $post->post_status ) { |
| @@ -2161,11 +2194,13 @@ | ||
| 2161 | 2194 | if ( 'auto-draft' !== $post->post_status ) { |
| 2162 | 2195 | echo '<span id="last-edit">'; |
| 2163 | 2196 | $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ); |
| 2164 | 2197 | if ( $last_user ) { |
| 2165 | - printf( esc_html__( 'Last edited by %1$s on %2$s at %3$s', 'mainwp' ), esc_html( $last_user->display_name ), mysql2date( esc_html__( 'F j, Y' ), $post->post_modified ), mysql2date( esc_html__( 'g:i a' ), $post->post_modified ) ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 2198 | + /* translators: 1: user display name, 2: date, 3: time */ | |
| 2199 | + printf( esc_html__( 'Last edited by %1$s on %2$s at %3$s', 'mainwp' ), esc_html( $last_user->display_name ), mysql2date( esc_html__( 'F j, Y', 'mainwp' ), $post->post_modified ), mysql2date( esc_html__( 'g:i a', 'mainwp' ), $post->post_modified ) ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 2166 | 2200 | } else { |
| 2167 | - printf( esc_html__( 'Last edited on %1$s at %2$s', 'mainwp' ), mysql2date( esc_html__( 'F j, Y' ), $post->post_modified ), mysql2date( esc_html__( 'g:i a' ), $post->post_modified ) ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 2201 | + /* translators: 1: date, 2: time */ | |
| 2202 | + printf( esc_html__( 'Last edited on %1$s at %2$s', 'mainwp' ), mysql2date( esc_html__( 'F j, Y', 'mainwp' ), $post->post_modified ), mysql2date( esc_html__( 'g:i a', 'mainwp' ), $post->post_modified ) ); // phpcs:ignore WordPress.Security.EscapeOutput | |
| 2168 | 2203 | } |
| 2169 | 2204 | echo '</span>'; |
| 2170 | 2205 | } |
| 2171 | 2206 | ?> |
| @@ -2193,9 +2228,9 @@ | ||
| 2193 | 2228 | <div class="field"> |
| 2194 | 2229 | <?php static::post_custom_meta_box( $post ); ?> |
| 2195 | 2230 | </div> |
| 2196 | 2231 | |
| 2197 | - <div class="field postbox-container"> | |
| 2232 | + <div class="field"> | |
| 2198 | 2233 | <?php |
| 2199 | 2234 | |
| 2200 | 2235 | /** |
| 2201 | 2236 | * Edit bulkpost |
| @@ -2206,9 +2241,9 @@ | ||
| 2206 | 2241 | * @param string $post_type Post type. |
| 2207 | 2242 | */ |
| 2208 | 2243 | do_action( 'mainwp_bulkpost_edit', $post, $post_type ); |
| 2209 | 2244 | |
| 2210 | - static::do_meta_boxes( null, 'normal', $post ); | |
| 2245 | + static::do_meta_boxes( null, 'top', $post ); | |
| 2211 | 2246 | |
| 2212 | 2247 | static::do_meta_boxes( null, 'advanced', $post ); |
| 2213 | 2248 | |
| 2214 | 2249 | /** |
| @@ -2222,9 +2257,9 @@ | ||
| 2222 | 2257 | * @see https://developer.wordpress.org/reference/hooks/add_meta_boxes/ |
| 2223 | 2258 | */ |
| 2224 | 2259 | do_action( 'add_meta_boxes', $post_type, $post ); |
| 2225 | 2260 | |
| 2226 | - static::do_meta_boxes( $post_type, 'normal', $post ); | |
| 2261 | + static::do_meta_boxes( null, 'normal', $post ); | |
| 2227 | 2262 | |
| 2228 | 2263 | ?> |
| 2229 | 2264 | </div> |
| 2230 | 2265 | </div> |
| @@ -2268,9 +2303,9 @@ | ||
| 2268 | 2303 | 'show_client' => true, |
| 2269 | 2304 | ); |
| 2270 | 2305 | MainWP_UI_Select_Sites::select_sites_box( $sel_params ); |
| 2271 | 2306 | ?> |
| 2272 | - <input type="hidden" name="select_sites_nonce" id="select_sites_nonce" value="<?php echo esc_attr( wp_create_nonce( 'select_sites_' . $post->ID ) ); ?>" /> | |
| 2307 | + <input type="hidden" name="select_sites_nonce" value="<?php echo esc_attr( wp_create_nonce( 'select_sites_' . $post->ID ) ); ?>" /> | |
| 2273 | 2308 | </div> |
| 2274 | 2309 | </div> |
| 2275 | 2310 | <div class="ui fitted divider"></div> |
| 2276 | 2311 | <?php |
| @@ -2278,9 +2313,9 @@ | ||
| 2278 | 2313 | static::render_categories_list( $post ); |
| 2279 | 2314 | } |
| 2280 | 2315 | static::render_post_fields( $post, $post_type ); |
| 2281 | 2316 | ?> |
| 2282 | - <?php static::do_meta_boxes( $post_type, 'side', $post ); ?> | |
| 2317 | + <?php static::do_meta_boxes( null, 'side', $post ); ?> | |
| 2283 | 2318 | <div class="ui fitted divider"></div> |
| 2284 | 2319 | <?php |
| 2285 | 2320 | /** |
| 2286 | 2321 | * Action: mainwp_edit_posts_before_submit_button |
| @@ -2322,10 +2357,10 @@ | ||
| 2322 | 2357 | jQuery( '#mainwp-publish-dimmer' ).show(); |
| 2323 | 2358 | } ); |
| 2324 | 2359 | } ); |
| 2325 | 2360 | </script> |
| 2326 | - <div class="ui active inverted dimmer" id="mainwp-publish-dimmer" style="display:none"> | |
| 2327 | - <div class="ui text loader"><?php esc_html_e( 'Publishing...', 'mainwp' ); ?></div> | |
| 2361 | + <div class="ui active page dimmer" id="mainwp-publish-dimmer" style="display:none"> | |
| 2362 | + <div class="ui double text loader"><?php esc_html_e( 'Publishing...', 'mainwp' ); ?></div> | |
| 2328 | 2363 | </div> |
| 2329 | 2364 | <div class="ui clearing hidden divider"></div> |
| 2330 | 2365 | </div> |
| 2331 | 2366 | <?php |
| @@ -2359,9 +2394,9 @@ | ||
| 2359 | 2394 | $post_only = get_post_meta( $post->ID, '_post_to_only_existing_categories', true ); |
| 2360 | 2395 | } |
| 2361 | 2396 | ?> |
| 2362 | 2397 | <div class="content active"> |
| 2363 | - <input type="hidden" name="post_category_nonce" id="post_category_nonce" value="<?php echo esc_attr( wp_create_nonce( 'post_category_' . $post->ID ) ); ?>" /> | |
| 2398 | + <input type="hidden" name="post_category_nonce" value="<?php echo esc_attr( wp_create_nonce( 'post_category_' . $post->ID ) ); ?>" /> | |
| 2364 | 2399 | <div class="field"> |
| 2365 | 2400 | <div class="ui checkbox"> |
| 2366 | 2401 | <input type="checkbox" name="post_only_existing" id="post_only_existing" value="1" <?php echo $post_only ? 'checked' : ''; ?>> |
| 2367 | 2402 | <label><?php esc_html_e( 'Post only to existing categories', 'mainwp' ); ?></label> |
| @@ -2445,9 +2480,9 @@ | ||
| 2445 | 2480 | $post_only = get_post_meta( $post->ID, '_post_to_only_existing_categories', true ); |
| 2446 | 2481 | } |
| 2447 | 2482 | ?> |
| 2448 | 2483 | <div class="content active"> |
| 2449 | - <input type="hidden" name="post_category_nonce" id="post_category_nonce" value="<?php echo esc_attr( wp_create_nonce( 'post_category_' . $post->ID ) ); ?>" /> | |
| 2484 | + <input type="hidden" name="post_category_nonce" value="<?php echo esc_attr( wp_create_nonce( 'post_category_' . $post->ID ) ); ?>" /> | |
| 2450 | 2485 | <div class="field"> |
| 2451 | 2486 | <div class="ui checkbox"> |
| 2452 | 2487 | <input type="checkbox" name="post_only_existing" id="post_only_existing" value="1" <?php echo $post_only ? 'checked' : ''; ?>> |
| 2453 | 2488 | <label><?php esc_html_e( 'Post only to existing categories', 'mainwp' ); ?></label> |
| @@ -2618,10 +2653,10 @@ | ||
| 2618 | 2653 | * |
| 2619 | 2654 | * @return string Bulk add tab html. |
| 2620 | 2655 | */ |
| 2621 | 2656 | public static function render_bulk_add() { |
| 2622 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'manage_posts' ) ) { | |
| 2623 | - mainwp_do_not_have_permissions( esc_html__( 'manage posts', 'mainwp' ) ); | |
| 2657 | + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_posts' ) ) { | |
| 2658 | + \mainwp_do_not_have_permissions( esc_html__( 'manage posts', 'mainwp' ) ); | |
| 2624 | 2659 | return; |
| 2625 | 2660 | } |
| 2626 | 2661 | |
| 2627 | 2662 | /** |
| @@ -2643,10 +2678,10 @@ | ||
| 2643 | 2678 | * |
| 2644 | 2679 | * @return string Bulk edit tab html. |
| 2645 | 2680 | */ |
| 2646 | 2681 | public static function render_bulk_edit() { |
| 2647 | - if ( ! mainwp_current_user_have_right( 'dashboard', 'manage_posts' ) ) { | |
| 2648 | - mainwp_do_not_have_permissions( esc_html__( 'manage posts', 'mainwp' ) ); | |
| 2682 | + if ( ! \mainwp_current_user_can( 'dashboard', 'manage_posts' ) ) { | |
| 2683 | + \mainwp_do_not_have_permissions( esc_html__( 'manage posts', 'mainwp' ) ); | |
| 2649 | 2684 | return; |
| 2650 | 2685 | } |
| 2651 | 2686 | // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 2652 | 2687 | $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; |
| @@ -2691,9 +2726,9 @@ | ||
| 2691 | 2726 | |
| 2692 | 2727 | /** |
| 2693 | 2728 | * Method mainwp_help_content() |
| 2694 | 2729 | * |
| 2695 | - * Attatch MainWP help content. | |
| 2730 | + * Creates the MainWP Help Documentation List for the help component in the sidebar. | |
| 2696 | 2731 | */ |
| 2697 | 2732 | public static function mainwp_help_content() { |
| 2698 | 2733 | // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 2699 | 2734 | if ( isset( $_GET['page'] ) && ( 'PostBulkManage' === $_GET['page'] || 'PostBulkAdd' === $_GET['page'] ) ) { |
| @@ -2698,15 +2733,15 @@ | ||
| 2698 | 2733 | // phpcs:disable WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 2699 | 2734 | if ( isset( $_GET['page'] ) && ( 'PostBulkManage' === $_GET['page'] || 'PostBulkAdd' === $_GET['page'] ) ) { |
| 2700 | 2735 | ?> |
| 2701 | 2736 | <p><?php esc_html_e( 'If you need help with managing posts, please review following help documents', 'mainwp' ); ?></p> |
| 2702 | - <div class="ui relaxed bulleted list"> | |
| 2703 | - <div class="item"><a href="https://kb.mainwp.com/docs/manage-posts/" target="_blank">Manage Posts</a> <i class="external alternate icon"></i></div> | |
| 2704 | - <div class="item"><a href="https://kb.mainwp.com/docs/create-a-new-post/" target="_blank">Create a New Post</a> <i class="external alternate icon"></i></div> | |
| 2705 | - <div class="item"><a href="https://kb.mainwp.com/docs/edit-an-existing-post/" target="_blank">Edit an Existing Post</a> <i class="external alternate icon"></i></div> | |
| 2706 | - <div class="item"><a href="https://kb.mainwp.com/docs/change-status-of-an-existing-post/" target="_blank">Change Status of an Existing Post</a> <i class="external alternate icon"></i></div> | |
| 2707 | - <div class="item"><a href="https://kb.mainwp.com/docs/view-an-existing-post/" target="_blank">View an Existing Post</a> <i class="external alternate icon"></i></div> | |
| 2708 | - <div class="item"><a href="https://kb.mainwp.com/docs/delete-posts/" target="_blank">Delete Post(s)</a> <i class="external alternate icon"></i></div> | |
| 2737 | + <div class="ui list"> | |
| 2738 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-posts" target="_blank">Manage Posts</a></div> | |
| 2739 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-posts#create-a-new-post" target="_blank">Create a New Post</a></div> | |
| 2740 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-posts#edit-an-existing-post" target="_blank">Edit an Existing Post</a></div> | |
| 2741 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-posts#change-post-status" target="_blank">Change Status of an Existing Post</a></div> | |
| 2742 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-posts#view-existing-posts" target="_blank">View an Existing Post</a></div> | |
| 2743 | + <div class="item"><i class="external alternate icon"></i> <a href="https://docs.mainwp.com/sites/content/manage-posts#delete-posts" target="_blank">Delete Post(s)</a></div> | |
| 2709 | 2744 | <?php |
| 2710 | 2745 | /** |
| 2711 | 2746 | * Action: mainwp_posts_help_item |
| 2712 | 2747 | * |