[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/ -> tools.php (source)

   1  <?php
   2  /**
   3   * Tools Administration Screen.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  if ( isset( $_GET['page'] ) && ! empty( $_POST ) ) {
  10      // Ensure POST-ing to `tools.php?page=export_personal_data` and `tools.php?page=remove_personal_data`
  11      // continues to work after creating the new files for exporting and erasing of personal data.
  12      if ( 'export_personal_data' === $_GET['page'] ) {
  13          require_once ABSPATH . 'wp-admin/export-personal-data.php';
  14          return;
  15      } elseif ( 'remove_personal_data' === $_GET['page'] ) {
  16          require_once ABSPATH . 'wp-admin/erase-personal-data.php';
  17          return;
  18      }
  19  }
  20  
  21  // The privacy policy guide used to be outputted from here. Since WP 5.3 it is in wp-admin/privacy-policy-guide.php.
  22  if ( isset( $_GET['wp-privacy-policy-guide'] ) ) {
  23      require_once dirname( __DIR__ ) . '/wp-load.php';
  24      wp_redirect( admin_url( 'privacy-policy-guide.php' ), 301 );
  25      exit;
  26  } elseif ( isset( $_GET['page'] ) ) {
  27      // These were also moved to files in WP 5.3.
  28      if ( 'export_personal_data' === $_GET['page'] ) {
  29          require_once dirname( __DIR__ ) . '/wp-load.php';
  30          wp_redirect( admin_url( 'export-personal-data.php' ), 301 );
  31          exit;
  32      } elseif ( 'remove_personal_data' === $_GET['page'] ) {
  33          require_once dirname( __DIR__ ) . '/wp-load.php';
  34          wp_redirect( admin_url( 'erase-personal-data.php' ), 301 );
  35          exit;
  36      }
  37  }
  38  
  39  /** WordPress Administration Bootstrap */
  40  require_once  __DIR__ . '/admin.php';
  41  
  42  $title = __( 'Tools' );
  43  
  44  get_current_screen()->add_help_tab(
  45      array(
  46          'id'      => 'converter',
  47          'title'   => __( 'Categories and Tags Converter' ),
  48          'content' => '<p>' . __( 'Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
  49          '<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
  50      )
  51  );
  52  
  53  get_current_screen()->set_help_sidebar(
  54      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  55      '<p>' . __( '<a href="https://wordpress.org/support/article/tools-screen/">Documentation on Tools</a>' ) . '</p>' .
  56      '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
  57  );
  58  
  59  require_once ABSPATH . 'wp-admin/admin-header.php';
  60  
  61  ?>
  62  <div class="wrap">
  63  <h1><?php echo esc_html( $title ); ?></h1>
  64  <?php
  65  
  66  if ( current_user_can( 'import' ) ) :
  67      $cats = get_taxonomy( 'category' );
  68      $tags = get_taxonomy( 'post_tag' );
  69      if ( current_user_can( $cats->cap->manage_terms ) || current_user_can( $tags->cap->manage_terms ) ) :
  70          ?>
  71          <div class="card">
  72              <h2 class="title"><?php _e( 'Categories and Tags Converter' ); ?></h2>
  73              <p>
  74              <?php
  75                  printf(
  76                      /* translators: %s: URL to Import screen. */
  77                      __( 'If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.' ),
  78                      'import.php'
  79                  );
  80              ?>
  81              </p>
  82          </div>
  83          <?php
  84      endif;
  85  endif;
  86  
  87  /**
  88   * Fires at the end of the Tools Administration screen.
  89   *
  90   * @since 2.8.0
  91   */
  92  do_action( 'tool_box' );
  93  
  94  ?>
  95  </div>
  96  <?php
  97  
  98  require_once ABSPATH . 'wp-admin/admin-footer.php';


Generated: Wed Oct 21 01:00:04 2020 Cross-referenced by PHPXref 0.7.1