| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPSEO plugin file. |
| 4 |
* |
| 5 |
* @package WPSEO\Admin\Views |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'WPSEO_VERSION' ) ) { |
| 9 |
header( 'Status: 403 Forbidden' ); |
| 10 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 11 |
exit(); |
| 12 |
} |
| 13 |
|
| 14 |
// To improve readability, this tab has been divided into separate blocks, included below. |
| 15 |
require __DIR__ . '/archives/help.php'; |
| 16 |
|
| 17 |
$wpseo_archives = [ |
| 18 |
[ |
| 19 |
'title' => esc_html__( 'Author archives', 'wordpress-seo' ), |
| 20 |
'view_file' => 'paper-content/author-archive-settings.php', |
| 21 |
'paper_id' => 'settings-author-archives', |
| 22 |
], |
| 23 |
[ |
| 24 |
'title' => esc_html__( 'Date archives', 'wordpress-seo' ), |
| 25 |
'view_file' => 'paper-content/date-archives-settings.php', |
| 26 |
'paper_id' => 'settings-date-archives', |
| 27 |
], |
| 28 |
[ |
| 29 |
'title' => esc_html__( 'Special pages', 'wordpress-seo' ), |
| 30 |
'view_file' => 'paper-content/special-pages.php', |
| 31 |
'paper_id' => 'settings-special-pages', |
| 32 |
], |
| 33 |
]; |
| 34 |
|
| 35 |
$view_utils = new Yoast_View_Utils(); |
| 36 |
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars(); |
| 37 |
$editor_specific_replace_vars = new WPSEO_Admin_Editor_Specific_Replace_Vars(); |
| 38 |
$opengraph_disabled_alert = $view_utils->generate_opengraph_disabled_alert( 'archives' ); |
| 39 |
|
| 40 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Is correctly escaped in the generate_opengraph_disabled_alert() method. |
| 41 |
echo $opengraph_disabled_alert; |
| 42 |
|
| 43 |
foreach ( $wpseo_archives as $wpseo_archive_index => $wpseo_archive ) { |
| 44 |
$wpseo_archive_presenter = new WPSEO_Paper_Presenter( |
| 45 |
$wpseo_archive['title'], |
| 46 |
__DIR__ . '/' . $wpseo_archive['view_file'], |
| 47 |
[ |
| 48 |
'collapsible' => true, |
| 49 |
'expanded' => ( $wpseo_archive_index === 0 ), |
| 50 |
'paper_id' => $wpseo_archive['paper_id'], |
| 51 |
'recommended_replace_vars' => $recommended_replace_vars, |
| 52 |
'editor_specific_replace_vars' => $editor_specific_replace_vars, |
| 53 |
'class' => 'search-appearance', |
| 54 |
] |
| 55 |
); |
| 56 |
|
| 57 |
// phpcs:ignore WordPress.Security.EscapeOutput -- get_output() output is properly escaped. |
| 58 |
echo $wpseo_archive_presenter->get_output(); |
| 59 |
} |
| 60 |
|
| 61 |
unset( $wpseo_archives, $wpseo_archive_presenter, $wpseo_archive_index ); |
| 62 |
|