| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin View: Displaying all LearnPress's add-ons available but haven't installed. |
| 4 |
* |
| 5 |
* @author ThimPress |
| 6 |
* @package LearnPress/Views |
| 7 |
* @version 3.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit(); |
| 11 |
|
| 12 |
// get all free Learnpress plugins |
| 13 |
$wp_plugins = LP_Plugins_Helper::get_plugins( 'free' ); |
| 14 |
// get all premium Learnpress plugins |
| 15 |
$tp_plugins = LP_Plugins_Helper::get_plugins( 'premium' ); |
| 16 |
|
| 17 |
if ( ! ( $wp_plugins || $tp_plugins ) ) { |
| 18 |
_e( 'There is no available add-ons.', 'learnpress' ); |
| 19 |
|
| 20 |
return; |
| 21 |
} |
| 22 |
|
| 23 |
$all_plugins = array( |
| 24 |
array( |
| 25 |
'key' => 'free', |
| 26 |
'title' => __( 'Free add-ons', 'learnpress' ), |
| 27 |
'items' => $wp_plugins, |
| 28 |
), |
| 29 |
array( |
| 30 |
'key' => 'premium', |
| 31 |
'title' => __( 'Premium add-ons', 'learnpress' ), |
| 32 |
'items' => $tp_plugins, |
| 33 |
), |
| 34 |
); |
| 35 |
|
| 36 |
foreach ( $all_plugins as $plugins ) { |
| 37 |
if ( $plugins['items'] ) { |
| 38 |
?> |
| 39 |
<h2> |
| 40 |
<?php echo sprintf( '%s (<span>%s</span>)', esc_html( $plugins['title'] ), sizeof( $plugins['items'] ) ); ?> |
| 41 |
</h2> |
| 42 |
<ul class="addons-browse widefat"> |
| 43 |
<?php |
| 44 |
foreach ( $plugins['items'] as $file => $add_on ) { |
| 45 |
include learn_press_get_admin_view( 'addons/html-loop-plugin' ); |
| 46 |
} |
| 47 |
?> |
| 48 |
</ul> |
| 49 |
<?php |
| 50 |
} |
| 51 |
} |
| 52 |
?> |
| 53 |
|