| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin View: Displaying all LearnPress's related themes. |
| 4 |
* |
| 5 |
* @author ThimPress |
| 6 |
* @package LearnPress/Views |
| 7 |
* @version 3.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit(); |
| 11 |
|
| 12 |
$last_checked = LP_Background_Query_Items::instance()->get_last_checked( 'plugins_tp' ); |
| 13 |
$check_url = wp_nonce_url( esc_url_raw( add_query_arg( 'force-check-update', 'yes' ) ), 'lp-check-updates' ); |
| 14 |
?> |
| 15 |
|
| 16 |
<p><?php printf( __( 'Last checked %1$s. <a href="%2$s">Check again</a>', 'learnpress' ), human_time_diff( $last_checked ), $check_url ); ?></p> |
| 17 |
|
| 18 |
<?php |
| 19 |
// Thimpress Education themes |
| 20 |
$education_themes = LP_Plugins_Helper::get_related_themes( 'education' ); |
| 21 |
// Thimpress other themes |
| 22 |
$other_themes = LP_Plugins_Helper::get_related_themes( 'other' ); |
| 23 |
|
| 24 |
if ( ! ( $education_themes || $other_themes ) ) { |
| 25 |
_e( 'No related themes.', 'learnpress' ); |
| 26 |
return; |
| 27 |
} |
| 28 |
|
| 29 |
$all_themes = array( |
| 30 |
array( |
| 31 |
'title' => __( 'Education Support', 'learnpress' ), |
| 32 |
'items' => $education_themes, |
| 33 |
), |
| 34 |
array( |
| 35 |
'title' => __( 'Other', 'learnpress' ), |
| 36 |
'items' => $other_themes, |
| 37 |
), |
| 38 |
); |
| 39 |
|
| 40 |
require_once LP_PLUGIN_PATH . 'inc/background-process/class-lp-background-query-items.php'; |
| 41 |
$lp_query_items_bg = new LP_Background_Query_Items(); |
| 42 |
$lp_query_items_bg->query_related_themes(); |
| 43 |
|
| 44 |
foreach ( $all_themes as $themes ) { |
| 45 |
if ( $themes['items'] ) { |
| 46 |
?> |
| 47 |
<h2><?php echo $themes['title'] . ' (<span>' . sizeof( $themes['items'] ) . '</span>)'; ?></h2> |
| 48 |
<ul class="addons-browse related-themes widefat"> |
| 49 |
<?php |
| 50 |
foreach ( $themes['items'] as $key => $item ) { |
| 51 |
$item['url'] = learn_press_get_item_referral( $item['id'] ); |
| 52 |
|
| 53 |
learn_press_admin_view( |
| 54 |
'addons/html-loop-theme', |
| 55 |
array( |
| 56 |
'theme' => $item, |
| 57 |
'ref' => '', |
| 58 |
) |
| 59 |
); |
| 60 |
} |
| 61 |
?> |
| 62 |
</ul> |
| 63 |
<?php |
| 64 |
} |
| 65 |
} |
| 66 |
|