| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin screen functionality for Easy Footnotes. |
| 4 |
* |
| 5 |
* @package easy-footnotes |
| 6 |
*/ |
| 7 |
|
| 8 |
$footnoteOptions = get_option( 'easy_footnotes_options' ); |
| 9 |
|
| 10 |
if ( isset( $_POST['easy_footnote_hidden'] ) ) { |
| 11 |
// Check the nonce for the Reading Time. |
| 12 |
check_admin_referer( 'easy_footnotes_settings_nonce' ); |
| 13 |
|
| 14 |
if ( 'Y' === $_POST['easy_footnote_hidden'] ) : |
| 15 |
// Form data sent. |
| 16 |
$easyFootnoteLabel = ( isset( $_POST['easy_footnotes_label'] ) ) ? sanitize_text_field( wp_unslash( $_POST['easy_footnotes_label'] ) ) : ''; |
| 17 |
|
| 18 |
if ( isset( $_POST['easy_footnote_check'] ) ) { |
| 19 |
$easyFootnoteCheck = true; |
| 20 |
} else { |
| 21 |
$easyFootnoteCheck = false; |
| 22 |
} |
| 23 |
|
| 24 |
if ( isset( $_POST['hide_easy_footnote_after_posts'] ) ) { |
| 25 |
$hide_easy_footnote_after_posts = true; |
| 26 |
} else { |
| 27 |
$hide_easy_footnote_after_posts = false; |
| 28 |
} |
| 29 |
|
| 30 |
if ( isset( $_POST['show_easy_footnote_on_front'] ) ) { |
| 31 |
$show_easy_footnote_on_front = true; |
| 32 |
} else { |
| 33 |
$show_easy_footnote_on_front = false; |
| 34 |
} |
| 35 |
|
| 36 |
$updateOptions = array( |
| 37 |
'footnoteLabel' => $easyFootnoteLabel, |
| 38 |
'useLabel' => $easyFootnoteCheck, |
| 39 |
'hide_easy_footnote_after_posts' => $hide_easy_footnote_after_posts, |
| 40 |
'show_easy_footnote_on_front' => $show_easy_footnote_on_front, |
| 41 |
); |
| 42 |
|
| 43 |
update_option( 'easy_footnotes_options', $updateOptions ); |
| 44 |
?> |
| 45 |
<div class="updated"> |
| 46 |
<p><strong><?php esc_html_e( 'Options saved.', 'easy-footnotes' ); ?></strong></p> |
| 47 |
</div> |
| 48 |
<?php |
| 49 |
endif; |
| 50 |
} else { |
| 51 |
// Normal page display. |
| 52 |
$easyFootnoteLabel = $footnoteOptions['footnoteLabel']; |
| 53 |
$easyFootnoteCheck = $footnoteOptions['useLabel']; |
| 54 |
$hide_easy_footnote_after_posts = $footnoteOptions['hide_easy_footnote_after_posts']; |
| 55 |
$show_easy_footnote_on_front = $footnoteOptions['show_easy_footnote_on_front']; |
| 56 |
} |
| 57 |
?> |
| 58 |
|
| 59 |
<div class="wrap"> |
| 60 |
<?php echo '<h2>' . esc_html__( 'Easy Footnotes Settings', 'easy-footnotes' ) . '</h2>'; ?> |
| 61 |
|
| 62 |
<form name="easy_footnotes_form" method="post"> |
| 63 |
<input type="hidden" name="easy_footnote_hidden" value="Y"> |
| 64 |
<?php wp_nonce_field( 'easy_footnotes_settings_nonce' ); ?> |
| 65 |
<?php echo '<h4>' . esc_html__( 'Easy Footnotes Settings', 'easy-footnotes' ) . '</h4>'; ?> |
| 66 |
<p><?php esc_html_e( 'Want to add a label to your footnotes section at the bottom of your post? Just enter some text here and check the box and you\'re good to go.', 'easy-footnotes' ); ?></p> |
| 67 |
<p><?php esc_html_e( 'Easy Footnotes Label: ', 'easy-footnotes' ); ?><input type="text" name="easy_footnotes_label" value="<?php echo esc_attr( $easyFootnoteLabel ); ?>" size="20"></p> |
| 68 |
|
| 69 |
<p><?php esc_html_e( 'Insert Easy Footnotes Label: ', 'easy-footnotes' ); ?><input type="checkbox" name="easy_footnote_check" <?php checked( $easyFootnoteCheck ); ?> size="20"></p> |
| 70 |
|
| 71 |
<p><?php esc_html_e( 'Hide Footnotes after post content: ', 'easy-footnotes' ); ?><input type="checkbox" name="hide_easy_footnote_after_posts" <?php checked( $hide_easy_footnote_after_posts ); ?> size="20"></p> |
| 72 |
|
| 73 |
<p id="easy_footnote_on_front"><?php esc_html_e( 'Show Footnotes on Front Page: ', 'easy-footnotes' ); ?><input type="checkbox" name="show_easy_footnote_on_front" <?php checked( $show_easy_footnote_on_front ); ?> size="20"></p> |
| 74 |
|
| 75 |
<p class="submit"> |
| 76 |
<input type="submit" name="Submit" value="<?php esc_attr_e( 'Update Options', 'easy_footnotes_trdom' ); ?>" /> |
| 77 |
</p> |
| 78 |
</form> |
| 79 |
|
| 80 |
<div class="easy-footnotes-shortcode-hint"> |
| 81 |
<p><?php echo esc_html__( 'Shortcode: [efn_note]Insert your note here.[/efn_note]', 'easy-footnotes' ); ?></p> |
| 82 |
</div> |
| 83 |
|
| 84 |
<div class="efn-preview"> |
| 85 |
<a class="efn-theme-link" href="<?php echo esc_url( 'https://www.themes.pizza/?utm_source=easy-footnotes&utm_medium=button&utm_campaign=efnupsell' ); ?>" target="_blank"><img src="<?php echo esc_url( plugins_url( '/assets/zuul-wordpress-theme.jpg', __FILE__ ) ); ?>" alt="Zuul WordPress Theme homepage in various color options" /></a> |
| 86 |
<div class="efn-preview-copy"> |
| 87 |
<h2><?php esc_html_e( 'Tasty WordPress Themes', 'easy-footnotes' ); ?></h2> |
| 88 |
<p> |
| 89 |
<?php |
| 90 |
printf( |
| 91 |
wp_kses_post( 'Love easy footnotes? Check out my premium themes now available on Themes.Pizza. Each theme is hand crafted from the finest ingredients with a specific purpose in mind. Need to start a side project / membership site? Try out <a href="%1s" target="_blank">Zuul</a>. Looking to establish yourself as an authoirty on a subject? Try out <a href="%2s" target="_blank">The Authority Pro</a>.', 'easy-footnotes' ), |
| 92 |
esc_url( 'https://www.themes.pizza/downloads/zuul-pro/?utm_source=easy-footnotes&utm_medium=button&utm_campaign=efnupsell' ), |
| 93 |
esc_url( 'https://www.themes.pizza/downloads/the-authority-pro/?utm_source=easy-footnotes&utm_medium=button&utm_campaign=efnupsell' ) |
| 94 |
); |
| 95 |
?> |
| 96 |
</p> |
| 97 |
<p><?php echo wp_kses_post( 'All themes are 100% GPL. Use them on as many sites as you want and make something awesome! And for being a faithful Easy Footnotes user get 20% off with the code <strong>TASTYZA</strong>.', 'easy-footnotes' ); ?></p> |
| 98 |
<a class="efn-theme-button" href="<?php echo esc_url( 'https://www.themes.pizza/?utm_source=easy-footnotes&utm_medium=button&utm_campaign=efnupsell' ); ?>" target="_blank"><?php esc_html_e( 'Shop Now', 'easy-footnotes' ); ?></a> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
</div> |
| 102 |
|