| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPSEO plugin file. |
| 4 |
* |
| 5 |
* @package WPSEO\Admin\Views |
| 6 |
* |
| 7 |
* @uses string $paper_id The ID of the paper. |
| 8 |
* @uses string $paper_id_prefix The ID prefix of the paper. |
| 9 |
* @uses bool $collapsible Whether the collapsible should be rendered. |
| 10 |
* @uses array $collapsible_config Configuration for the collapsible. |
| 11 |
* @uses string $collapsible_header_class Class for the collapsible header. |
| 12 |
* @uses string $title The title. |
| 13 |
* @uses string $title_after Additional content to render after the title. |
| 14 |
* @uses string $view_file Path to the view file. |
| 15 |
* @uses WPSEO_Admin_Help_Panel $help_text The help text. |
| 16 |
*/ |
| 17 |
|
| 18 |
if ( ! defined( 'WPSEO_VERSION' ) ) { |
| 19 |
header( 'Status: 403 Forbidden' ); |
| 20 |
header( 'HTTP/1.1 403 Forbidden' ); |
| 21 |
exit(); |
| 22 |
} |
| 23 |
|
| 24 |
?> |
| 25 |
<div |
| 26 |
class="<?php echo esc_attr( 'paper tab-block ' . $class ); ?>"<?php echo ( $paper_id ) ? ' id="' . esc_attr( $paper_id_prefix . $paper_id ) . '"' : ''; ?>> |
| 27 |
|
| 28 |
<?php |
| 29 |
if ( ! empty( $title ) ) { |
| 30 |
|
| 31 |
if ( ! empty( $collapsible ) ) { |
| 32 |
|
| 33 |
$button_id_attr = ''; |
| 34 |
if ( ! empty( $paper_id ) ) { |
| 35 |
$button_id_attr = sprintf( ' id="%s"', esc_attr( $paper_id_prefix . $paper_id . '-button' ) ); |
| 36 |
} |
| 37 |
|
| 38 |
printf( |
| 39 |
'<h2 class="%1$s"><button%2$s type="button" class="toggleable-container-trigger" aria-expanded="%3$s">%4$s%5$s <span class="toggleable-container-icon dashicons %6$s" aria-hidden="true"></span></button></h2>', |
| 40 |
esc_attr( 'collapsible-header ' . $collapsible_header_class ), |
| 41 |
// phpcs:ignore WordPress.Security.EscapeOutput -- $button_id_attr is escaped above. |
| 42 |
$button_id_attr, |
| 43 |
esc_attr( $collapsible_config['expanded'] ), |
| 44 |
// phpcs:ignore WordPress.Security.EscapeOutput -- $help_text is an instance of WPSEO_Admin_Help_Panel, which escapes it's own output. |
| 45 |
$help_text->get_button_html(), |
| 46 |
esc_html( $title ) . wp_kses_post( $title_after ), |
| 47 |
wp_kses_post( $collapsible_config['toggle_icon'] ), |
| 48 |
); |
| 49 |
} |
| 50 |
else { |
| 51 |
echo '<div class="paper-title"><h2 class="help-button-inline">', |
| 52 |
esc_html( $title ), |
| 53 |
wp_kses_post( $title_after ), |
| 54 |
// phpcs:ignore WordPress.Security.EscapeOutput -- $help_text is an instance of WPSEO_Admin_Help_Panel, which escapes it's own output. |
| 55 |
$help_text->get_button_html(), |
| 56 |
'</h2></div>'; |
| 57 |
} |
| 58 |
} |
| 59 |
?> |
| 60 |
<?php |
| 61 |
|
| 62 |
// phpcs:ignore WordPress.Security.EscapeOutput -- $help_text is an instance of WPSEO_Admin_Help_Panel, which escapes it's own output. |
| 63 |
echo $help_text->get_panel_html(); |
| 64 |
|
| 65 |
$container_id_attr = ''; |
| 66 |
if ( ! empty( $paper_id ) ) { |
| 67 |
$container_id_attr = sprintf( ' id="%s"', esc_attr( $paper_id_prefix . $paper_id . '-container' ) ); |
| 68 |
} |
| 69 |
|
| 70 |
printf( |
| 71 |
'<div%1$s class="%2$s">%3$s</div>', |
| 72 |
// phpcs:ignore WordPress.Security.EscapeOutput -- $container_id_attr is escaped above. |
| 73 |
$container_id_attr, |
| 74 |
esc_attr( 'paper-container ' . $collapsible_config['class'] ), |
| 75 |
$content, |
| 76 |
); |
| 77 |
?> |
| 78 |
|
| 79 |
</div> |
| 80 |
|