[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-admin/ -> link-manager.php (source)

   1  <?php
   2  /**
   3   * Link Management Administration Screen.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** Load WordPress Administration Bootstrap */
  10  require_once( dirname( __FILE__ ) . '/admin.php' );
  11  if ( ! current_user_can( 'manage_links' ) ) {
  12      wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) );
  13  }
  14  
  15  $wp_list_table = _get_list_table( 'WP_Links_List_Table' );
  16  
  17  // Handle bulk deletes
  18  $doaction = $wp_list_table->current_action();
  19  
  20  if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
  21      check_admin_referer( 'bulk-bookmarks' );
  22  
  23      $redirect_to = admin_url( 'link-manager.php' );
  24      $bulklinks   = (array) $_REQUEST['linkcheck'];
  25  
  26      if ( 'delete' == $doaction ) {
  27          foreach ( $bulklinks as $link_id ) {
  28              $link_id = (int) $link_id;
  29  
  30              wp_delete_link( $link_id );
  31          }
  32  
  33          $redirect_to = add_query_arg( 'deleted', count( $bulklinks ), $redirect_to );
  34      } else {
  35          /** This action is documented in wp-admin/edit-comments.php */
  36          $redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $bulklinks ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
  37      }
  38      wp_redirect( $redirect_to );
  39      exit;
  40  } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
  41      wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
  42      exit;
  43  }
  44  
  45  $wp_list_table->prepare_items();
  46  
  47  $title       = __( 'Links' );
  48  $this_file   = 'link-manager.php';
  49  $parent_file = $this_file;
  50  
  51  get_current_screen()->add_help_tab(
  52      array(
  53          'id'      => 'overview',
  54          'title'   => __( 'Overview' ),
  55          'content' =>
  56              '<p>' . sprintf(
  57                  /* translators: %s: URL to Widgets screen. */
  58                  __( 'You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.' ),
  59                  'widgets.php'
  60              ) . '</p>' .
  61              '<p>' . __( 'Links may be separated into Link Categories; these are different than the categories used on your posts.' ) . '</p>' .
  62              '<p>' . __( 'You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.' ) . '</p>',
  63      )
  64  );
  65  get_current_screen()->add_help_tab(
  66      array(
  67          'id'      => 'deleting-links',
  68          'title'   => __( 'Deleting Links' ),
  69          'content' =>
  70              '<p>' . __( 'If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.' ) . '</p>',
  71      )
  72  );
  73  
  74  get_current_screen()->set_help_sidebar(
  75      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  76      '<p>' . __( '<a href="https://codex.wordpress.org/Links_Screen">Documentation on Managing Links</a>' ) . '</p>' .
  77      '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
  78  );
  79  
  80  get_current_screen()->set_screen_reader_content(
  81      array(
  82          'heading_list' => __( 'Links list' ),
  83      )
  84  );
  85  
  86  include_once ( ABSPATH . 'wp-admin/admin-header.php' );
  87  
  88  if ( ! current_user_can( 'manage_links' ) ) {
  89      wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) );
  90  }
  91  
  92  ?>
  93  
  94  <div class="wrap nosubsub">
  95  <h1 class="wp-heading-inline">
  96  <?php
  97  echo esc_html( $title );
  98  ?>
  99  </h1>
 100  
 101  <a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a>
 102  
 103  <?php
 104  if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
 105      /* translators: %s: Search query. */
 106      printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
 107  }
 108  ?>
 109  
 110  <hr class="wp-header-end">
 111  
 112  <?php
 113  if ( isset( $_REQUEST['deleted'] ) ) {
 114      echo '<div id="message" class="updated notice is-dismissible"><p>';
 115      $deleted = (int) $_REQUEST['deleted'];
 116      /* translators: %s: Number of links. */
 117      printf( _n( '%s link deleted.', '%s links deleted.', $deleted ), $deleted );
 118      echo '</p></div>';
 119      $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'deleted' ), $_SERVER['REQUEST_URI'] );
 120  }
 121  ?>
 122  
 123  <form id="posts-filter" method="get">
 124  
 125  <?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?>
 126  
 127  <?php $wp_list_table->display(); ?>
 128  
 129  <div id="ajax-response"></div>
 130  </form>
 131  
 132  </div>
 133  
 134  <?php
 135  include ( ABSPATH . 'wp-admin/admin-footer.php' );


Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7