[ 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( 'options-privacy.php?tab=policyguide' ), 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  // Used in the HTML title tag.
  43  $title = __( 'Tools' );
  44  
  45  get_current_screen()->add_help_tab(
  46      array(
  47          'id'      => 'converter',
  48          'title'   => __( 'Categories and Tags Converter' ),
  49          '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>' .
  50          '<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>',
  51      )
  52  );
  53  
  54  get_current_screen()->set_help_sidebar(
  55      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  56      '<p>' . __( '<a href="https://wordpress.org/support/article/tools-screen/">Documentation on Tools</a>' ) . '</p>' .
  57      '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
  58  );
  59  
  60  require_once ABSPATH . 'wp-admin/admin-header.php';
  61  
  62  ?>
  63  <div class="wrap">
  64  <h1><?php echo esc_html( $title ); ?></h1>
  65  <?php
  66  
  67  if ( current_user_can( 'import' ) ) :
  68      $cats = get_taxonomy( 'category' );
  69      $tags = get_taxonomy( 'post_tag' );
  70      if ( current_user_can( $cats->cap->manage_terms ) || current_user_can( $tags->cap->manage_terms ) ) :
  71          ?>
  72          <div class="card">
  73              <h2 class="title"><?php _e( 'Categories and Tags Converter' ); ?></h2>
  74              <p>
  75              <?php
  76                  printf(
  77                      /* translators: %s: URL to Import screen. */
  78                      __( '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.' ),
  79                      'import.php'
  80                  );
  81              ?>
  82              </p>
  83          </div>
  84          <?php
  85      endif;
  86  endif;
  87  
  88  /**
  89   * Fires at the end of the Tools Administration screen.
  90   *
  91   * @since 2.8.0
  92   */
  93  do_action( 'tool_box' );
  94  
  95  ?>
  96  </div>
  97  <?php
  98  
  99  require_once ABSPATH . 'wp-admin/admin-footer.php';


Generated: Sat Apr 27 01:00:02 2024 Cross-referenced by PHPXref 0.7.1