| 1 |
<?php |
| 2 |
/** |
| 3 |
* Notice Out of date template. |
| 4 |
* |
| 5 |
* @author ThimPress (nhamdv) |
| 6 |
* @version 4.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
if ( LP_Admin_Notice::instance()->has_dismissed_notice( 'outdated-template' ) == 'yes' ) { |
| 14 |
return; |
| 15 |
} |
| 16 |
|
| 17 |
$template_dir = get_template_directory(); |
| 18 |
$stylesheet_dir = get_stylesheet_directory(); |
| 19 |
$cradle = LP_Outdated_Template_Helper::detect_outdated_template(); |
| 20 |
$theme = wp_get_theme(); |
| 21 |
$theme_name = array(); |
| 22 |
|
| 23 |
if ( $template_dir === $stylesheet_dir ) { |
| 24 |
$theme_name[] = $theme['Name']; |
| 25 |
} else { |
| 26 |
if ( $cradle['parent_item'] ) { |
| 27 |
$theme_name[] = $parent = $theme->__get( 'parent_theme' ); |
| 28 |
} |
| 29 |
if ( $cradle['child_item'] ) { |
| 30 |
$theme_name[] = $theme['Name']; |
| 31 |
} |
| 32 |
} |
| 33 |
$theme_name = implode( ' & ', $theme_name ); |
| 34 |
|
| 35 |
$readmore = 'https://thimpress.com/knowledge-base/outdated-template-fix/'; |
| 36 |
?> |
| 37 |
|
| 38 |
<div id="message" class="learn-press-notice notice-warning notice"> |
| 39 |
<p><?php printf( wp_kses( __( 'There is a new update of LearnPress. You may need to update your theme <strong>(%s)</strong> to avoid outdated template files.', 'learnpress' ), array( 'strong' => array() ) ), $theme_name ); ?></p> |
| 40 |
<p class="outdated-readmore-link"> |
| 41 |
<?php |
| 42 |
echo sprintf( |
| 43 |
wp_kses( |
| 44 |
__( 'This is not a bug, don\'t worry. Read more about Outdated template files notice <a href="%s" target="_blank">here</a>.', 'learnpress' ), |
| 45 |
array( |
| 46 |
'a' => array( |
| 47 |
'href' => array(), |
| 48 |
'target' => array(), |
| 49 |
), |
| 50 |
) |
| 51 |
), |
| 52 |
esc_url_raw( $readmore ) |
| 53 |
); |
| 54 |
?> |
| 55 |
</p> |
| 56 |
<p> |
| 57 |
<a class="button" href="<?php echo admin_url( 'admin.php?page=learn-press-tools&tab=template' ); ?>"> |
| 58 |
<?php esc_html_e( 'View list of outdated templates', 'learnpress' ); ?> |
| 59 |
</a> |
| 60 |
<a href="" onclick="LP.dismissMessage(this, {expired: 3600}); return false;" data-name="outdated-template" data-value="yes" data-el="#message" data-instant="yes"> |
| 61 |
<?php esc_html_e( 'Dismiss', 'learnpress' ); ?> |
| 62 |
</a> |
| 63 |
</p> |
| 64 |
</div> |
| 65 |
|