| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin View: Page - Reports |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
?> |
| 11 |
<div class="wrap propertyhive"> |
| 12 |
<nav class="nav-tab-wrapper"> |
| 13 |
<?php |
| 14 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 15 |
foreach ( $reports as $key => $report_group ) { |
| 16 |
echo '<a href="' . esc_url( admin_url( 'admin.php?page=ph-reports&tab=' . urlencode( $key ) ) ) . '" class="nav-tab '; |
| 17 |
if ( $current_tab == $key ) { |
| 18 |
echo 'nav-tab-active'; |
| 19 |
} |
| 20 |
echo '">' . esc_html( $report_group[ 'title' ] ) . '</a>'; |
| 21 |
} |
| 22 |
|
| 23 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Existing public Property Hive extension hook ph_reports_tabs; changing the established name would detach installed callbacks. |
| 24 |
do_action( 'ph_reports_tabs' ); |
| 25 |
?> |
| 26 |
</nav> |
| 27 |
<?php //if ( sizeof( $reports[ $current_tab ]['reports'] ) > 1 ) { |
| 28 |
?> |
| 29 |
<ul class="subsubsub"> |
| 30 |
<li><?php |
| 31 |
|
| 32 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 33 |
$links = array(); |
| 34 |
|
| 35 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 36 |
foreach ( $reports[ $current_tab ]['reports'] as $key => $report ) { |
| 37 |
|
| 38 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local report navigation markup. |
| 39 |
$link = '<a href="' . esc_url( 'admin.php?page=ph-reports&tab=' . urlencode( $current_tab ) . '&report=' . urlencode( $key ) ) . '" class="'; |
| 40 |
|
| 41 |
if ( $key == $current_report ) { |
| 42 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local report navigation markup. |
| 43 |
$link .= 'current'; |
| 44 |
} |
| 45 |
|
| 46 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local report navigation markup. |
| 47 |
$link .= '">' . esc_html( $report['title'] ) . '</a>'; |
| 48 |
|
| 49 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 50 |
$links[] = $link; |
| 51 |
|
| 52 |
} |
| 53 |
|
| 54 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Locally assembled navigation links: URLs and titles are escaped above; class values and separators are fixed markup. |
| 55 |
echo implode( ' | </li><li>', $links ); |
| 56 |
|
| 57 |
?></li> |
| 58 |
</ul> |
| 59 |
<br class="clear" /> |
| 60 |
<?php |
| 61 |
//} |
| 62 |
|
| 63 |
if ( isset( $reports[ $current_tab ][ 'reports' ][ $current_report ] ) ) { |
| 64 |
|
| 65 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 66 |
$report = $reports[ $current_tab ][ 'reports' ][ $current_report ]; |
| 67 |
|
| 68 |
if ( ! isset( $report['hide_title'] ) || $report['hide_title'] != true ) { |
| 69 |
echo '<h1>' . esc_html( $report['title'] ) . '</h1>'; |
| 70 |
} else { |
| 71 |
echo '<h1 class="screen-reader-text">' . esc_html( $report['title'] ) . '</h1>'; |
| 72 |
} |
| 73 |
|
| 74 |
if ( $report['description'] ) { |
| 75 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Trusted HTML from PHP report registrations via propertyhive_admin_reports (core descriptions are empty). Extension callbacks own escaping of dynamic values in their descriptions. |
| 76 |
echo '<p>' . $report['description'] . '</p>'; |
| 77 |
} |
| 78 |
|
| 79 |
if ( $report['callback'] && ( is_callable( $report['callback'] ) ) ) { |
| 80 |
call_user_func( $report['callback'], $current_report ); |
| 81 |
} |
| 82 |
} |
| 83 |
?> |
| 84 |
</div> |
| 85 |
|