2021-09-21 15:01:08 +02:00
< ? php
/**
* WPSEO plugin file .
*
* @ package WPSEO\Admin
*/
if ( ! defined ( 'WPSEO_VERSION' ) ) {
header ( 'Status: 403 Forbidden' );
header ( 'HTTP/1.1 403 Forbidden' );
exit ();
}
$tool_page = ( string ) filter_input ( INPUT_GET , 'tool' );
$yform = Yoast_Form :: get_instance ();
$yform -> admin_header ( false );
2021-09-21 15:05:30 +02:00
if ( $tool_page === '' ) {
2021-09-21 15:01:08 +02:00
2021-09-21 15:05:30 +02:00
$tools = [];
2021-09-21 15:01:08 +02:00
2021-09-21 15:05:30 +02:00
$tools [ 'import-export' ] = [
2021-09-21 15:01:08 +02:00
'title' => __ ( 'Import and Export' , 'wordpress-seo' ),
'desc' => __ ( 'Import settings from other SEO plugins and export your settings for re-use on (another) blog.' , 'wordpress-seo' ),
2021-09-21 15:05:30 +02:00
];
2021-09-21 15:01:08 +02:00
if ( WPSEO_Utils :: allow_system_file_edit () === true && ! is_multisite () ) {
2021-09-21 15:05:30 +02:00
$tools [ 'file-editor' ] = [
2021-09-21 15:01:08 +02:00
'title' => __ ( 'File editor' , 'wordpress-seo' ),
'desc' => __ ( 'This tool allows you to quickly change important files for your SEO, like your robots.txt and, if you have one, your .htaccess file.' , 'wordpress-seo' ),
2021-09-21 15:05:30 +02:00
];
2021-09-21 15:01:08 +02:00
}
2021-09-21 15:05:30 +02:00
$tools [ 'bulk-editor' ] = [
2021-09-21 15:01:08 +02:00
'title' => __ ( 'Bulk editor' , 'wordpress-seo' ),
'desc' => __ ( 'This tool allows you to quickly change titles and descriptions of your posts and pages without having to go into the editor for each page.' , 'wordpress-seo' ),
2021-09-21 15:05:30 +02:00
];
2021-09-21 15:01:08 +02:00
echo '<p>' ;
printf (
/* translators: %1$s expands to Yoast SEO */
esc_html__ ( '%1$s comes with some very powerful built-in tools:' , 'wordpress-seo' ),
'Yoast SEO'
);
echo '</p>' ;
echo '<ul class="ul-disc">' ;
$admin_url = admin_url ( 'admin.php?page=wpseo_tools' );
foreach ( $tools as $slug => $tool ) {
2021-09-21 15:05:30 +02:00
$href = ( ! empty ( $tool [ 'href' ] ) ) ? $admin_url . $tool [ 'href' ] : add_query_arg ( [ 'tool' => $slug ], $admin_url );
2021-09-21 15:01:08 +02:00
$attr = ( ! empty ( $tool [ 'attr' ] ) ) ? $tool [ 'attr' ] : '' ;
echo '<li>' ;
2021-09-21 15:05:30 +02:00
echo '<strong><a href="' , esc_url ( $href ), '" ' , esc_attr ( $attr ), '>' , esc_html ( $tool [ 'title' ] ), '</a></strong><br/>' ;
echo esc_html ( $tool [ 'desc' ] );
2021-09-21 15:01:08 +02:00
echo '</li>' ;
}
/**
* Action : 'wpseo_tools_overview_list_items' - Hook to add additional tools to the overview .
*/
do_action ( 'wpseo_tools_overview_list_items' );
echo '</ul>' ;
}
else {
echo '<a href="' , esc_url ( admin_url ( 'admin.php?page=wpseo_tools' ) ), '">' , esc_html__ ( '« Back to Tools page' , 'wordpress-seo' ), '</a>' ;
2021-09-21 15:05:30 +02:00
$tool_pages = [ 'bulk-editor' , 'import-export' ];
2021-09-21 15:01:08 +02:00
if ( WPSEO_Utils :: allow_system_file_edit () === true && ! is_multisite () ) {
$tool_pages [] = 'file-editor' ;
}
if ( in_array ( $tool_page , $tool_pages , true ) ) {
require_once WPSEO_PATH . 'admin/views/tool-' . $tool_page . '.php' ;
}
}
$yform -> admin_footer ( false );