| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Display the main tools page wrapper. |
| 10 |
* |
| 11 |
* @author David Bisset |
| 12 |
* @package Charitable/Admin View/Tools |
| 13 |
* @copyright Copyright (c) 2023, WP Charitable LLC |
| 14 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 15 |
* @since 1.8.1.6 |
| 16 |
* @version 1.8.1.6 |
| 17 |
* @version 1.8.8.6 |
| 18 |
*/ |
| 19 |
|
| 20 |
$charitable_active_tab = isset( $_GET['tab'] ) ? esc_html( $_GET['tab'] ) : ''; // phpcs:ignore |
| 21 |
|
| 22 |
$charitable_sections = [ |
| 23 |
'featured' => esc_html__( 'Featured', 'charitable' ), |
| 24 |
'traffic' => esc_html__( 'Traffic', 'charitable' ), |
| 25 |
'engagement' => esc_html__( 'Engagement', 'charitable' ), |
| 26 |
'revenue' => esc_html__( 'Revenue', 'charitable' ), |
| 27 |
'guides' => esc_html__( 'Guides & Resources', 'charitable' ), |
| 28 |
]; |
| 29 |
$charitable_section_tools = array(); |
| 30 |
|
| 31 |
$charitable_growth_tools = Charitable_Guide_Tools::get_instance(); |
| 32 |
|
| 33 |
$charitable_tools = $charitable_growth_tools->get_growth_tools(); |
| 34 |
$charitable_show_button = true; |
| 35 |
|
| 36 |
if ( is_array( $charitable_tools ) && ! empty( $charitable_tools ) ) : |
| 37 |
|
| 38 |
foreach ( $charitable_tools as $charitable_slug => $charitable_tool_info ) : |
| 39 |
|
| 40 |
if ( isset( $charitable_tool_info['gt_section'] ) ) { |
| 41 |
$charitable_section_tools[ $charitable_tool_info['gt_section'] ][ $charitable_slug ] = $charitable_tool_info; |
| 42 |
} |
| 43 |
|
| 44 |
endforeach; |
| 45 |
|
| 46 |
endif; |
| 47 |
|
| 48 |
ob_start(); |
| 49 |
?> |
| 50 |
|
| 51 |
<div id="charitable-growth-tools" class="wrap"> |
| 52 |
<h2 class="nav-tab-wrapper"> |
| 53 |
<?php |
| 54 |
foreach ( $charitable_sections as $charitable_section_slug => $charitable_section_title ) : |
| 55 |
|
| 56 |
if ( ! isset( $charitable_section_tools[ $charitable_section_slug ] ) || empty( $charitable_section_tools[ $charitable_section_slug ] ) ) { |
| 57 |
continue; |
| 58 |
} |
| 59 |
|
| 60 |
?> |
| 61 |
<a href="#<?php echo esc_attr( sanitize_title( $charitable_section_slug ) ); ?>" class="nav-tab <?php echo $charitable_active_tab === $charitable_section_slug ? 'nav-tab-active' : ''; ?>"><?php echo esc_html( $charitable_section_title ); ?></a> |
| 62 |
<?php endforeach; ?> |
| 63 |
|
| 64 |
</h2> |
| 65 |
|
| 66 |
<main id="charitable-growth-tools" class="charitable-growth-tools"> |
| 67 |
|
| 68 |
<div class="charitable-growth-container"> |
| 69 |
|
| 70 |
<?php |
| 71 |
|
| 72 |
if ( is_array( $charitable_sections ) && ! empty( $charitable_sections ) ) : |
| 73 |
|
| 74 |
foreach ( $charitable_sections as $charitable_section_slug => $charitable_section_title ) : |
| 75 |
|
| 76 |
if ( ! isset( $charitable_section_tools[ $charitable_section_slug ] ) || empty( $charitable_section_tools[ $charitable_section_slug ] ) ) { |
| 77 |
continue; |
| 78 |
} |
| 79 |
|
| 80 |
?> |
| 81 |
|
| 82 |
<section id="charitable-section-<?php echo esc_attr( $charitable_section_slug ); ?>" class="charitable-growth-block"> |
| 83 |
<a id="wpchr-<?php echo esc_attr( $charitable_section_slug ); ?>"></a> |
| 84 |
<h2 class="charitable-growth-block-title"><?php echo esc_html( $charitable_section_title ); ?></h2> |
| 85 |
<div class="charitable-growth-item"> |
| 86 |
|
| 87 |
<?php |
| 88 |
|
| 89 |
foreach ( $charitable_section_tools[ $charitable_section_slug ] as $charitable_tool_slug => $charitable_tool_info ) : |
| 90 |
|
| 91 |
if ( empty( $charitable_tool_info ) ) { |
| 92 |
continue; |
| 93 |
} |
| 94 |
|
| 95 |
$charitable_content_class = ''; |
| 96 |
|
| 97 |
if ( isset( $charitable_tool_info['coming_soon'] ) && true === $charitable_tool_info['coming_soon'] ) { |
| 98 |
$charitable_content_class = 'charitable-growth-coming-soon'; |
| 99 |
$charitable_show_button = false; |
| 100 |
} |
| 101 |
|
| 102 |
?> |
| 103 |
|
| 104 |
<div class="charitable-growth-content <?php echo esc_attr( $charitable_content_class ); ?>" id="charitable-growth-content-<?php echo esc_attr( $charitable_tool_info['id'] ); ?>"> |
| 105 |
|
| 106 |
<a id="wpchr-<?php echo esc_attr( $charitable_tool_info['id'] ); ?>"></a> |
| 107 |
|
| 108 |
<div class="charitable-growth-content-icon_container"> |
| 109 |
<div class="charitable-growth-content-icon icon-<?php echo esc_attr( $charitable_tool_info['id'] ); ?>"></div> |
| 110 |
</div> |
| 111 |
|
| 112 |
<div class="charitable-growth-content-desc_container"> |
| 113 |
<h3 class="charitable-growth-desc-title"><?php echo esc_html( $charitable_tool_info['title'] ); ?></h3> |
| 114 |
<?php if ( ! empty( $charitable_tool_info['excerpt'] ) ) : ?> |
| 115 |
<p class="charitable-growth-desc-excerpt"> |
| 116 |
<?php |
| 117 |
echo wp_kses( |
| 118 |
$charitable_tool_info['excerpt'], |
| 119 |
[ |
| 120 |
'a' => [ |
| 121 |
'href' => [], |
| 122 |
'target' => [], |
| 123 |
'rel' => [], |
| 124 |
], |
| 125 |
'span' => [ |
| 126 |
'class' => [], |
| 127 |
], |
| 128 |
] |
| 129 |
); |
| 130 |
?> |
| 131 |
</p> |
| 132 |
<?php endif; ?> |
| 133 |
<?php if ( ! empty( $charitable_tool_info['why'] ) ) : ?> |
| 134 |
<p class="charitable-growth-desc-why"><strong><?php echo esc_html__( 'TIP:', 'charitable' ); ?></strong> <?php echo $charitable_tool_info['why']; // phpcs:ignore ?></p> |
| 135 |
<?php endif; ?> |
| 136 |
</div> |
| 137 |
<div class="charitable-growth-content-button_container"> |
| 138 |
<div> |
| 139 |
<?php if ( $charitable_show_button ) : ?> |
| 140 |
<?php |
| 141 |
|
| 142 |
$charitable_plugins_third_party = new Charitable_Admin_Plugins_Third_Party(); |
| 143 |
$charitable_plugin_button_html = $charitable_plugins_third_party->get_plugin_button_html( $charitable_tool_slug, false, '' ); |
| 144 |
echo $charitable_plugin_button_html; // phpcs:ignore |
| 145 |
|
| 146 |
?> |
| 147 |
<?php endif; ?> |
| 148 |
</div> |
| 149 |
</div> |
| 150 |
</div> |
| 151 |
|
| 152 |
<?php |
| 153 |
|
| 154 |
endforeach; |
| 155 |
|
| 156 |
?> |
| 157 |
|
| 158 |
</div> |
| 159 |
</section> |
| 160 |
|
| 161 |
<?php |
| 162 |
endforeach; |
| 163 |
|
| 164 |
endif; |
| 165 |
|
| 166 |
?> |
| 167 |
|
| 168 |
</div> |
| 169 |
|
| 170 |
</main> |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
</div> |
| 175 |
<?php |
| 176 |
echo ob_get_clean(); // phpcs:ignore |
| 177 |
|