| 1 |
<?php |
| 2 |
add_action('admin_init', 'wpdocs_version_type_update'); |
| 3 |
|
| 4 |
function wpdocs_version_type_update(){ |
| 5 |
|
| 6 |
if(isset($_POST['version_type'])){ |
| 7 |
if ( |
| 8 |
! isset( $_POST['version_type_nonce_field'] ) |
| 9 |
|| ! wp_verify_nonce( sanitize_wpdocs_data(wp_unslash($_POST['version_type_nonce_field'])), 'version_type_action' ) |
| 10 |
) { |
| 11 |
|
| 12 |
print _e('Sorry, your nonce did not verify.', 'wp-docs'); |
| 13 |
exit; |
| 14 |
|
| 15 |
} else { |
| 16 |
|
| 17 |
// process form data |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
update_option('wpdocs_versions_type', sanitize_wpdocs_data($_POST['version_type'])); |
| 22 |
|
| 23 |
if($_POST['version_type']=='new') |
| 24 |
wp_redirect('options-general.php?page=wpdocs'); |
| 25 |
else |
| 26 |
wp_redirect('admin.php?page=wpdocs-engine.php'); |
| 27 |
|
| 28 |
exit; |
| 29 |
|
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
function wpdocs_downward_compatibility(){ |
| 35 |
global $wpdocs_data, $wpdocs_versions_type, $wpdocs_pro, $wpdocs_url, $wpdocs_android_settings; |
| 36 |
?> |
| 37 |
<h2><?php echo $wpdocs_data['Name']; ?> <?php echo '('.$wpdocs_data['Version'].($wpdocs_pro?') Pro':')'); ?> - <?php _e('Settings', 'wp-docs'); ?></h2> |
| 38 |
<?php if(!$wpdocs_pro): ?> |
| 39 |
<a style="float:right; position:relative; top:-40px; display:none;" href="<?php echo esc_url($wpdocs_premium_link); ?>" target="_blank"><?php _e('Go Premium', 'wp-docs'); ?></a> |
| 40 |
<?php endif; ?> |
| 41 |
|
| 42 |
<div class="wpdocs_android"> |
| 43 |
<?php if(class_exists('QR_Code_Settings_WPDOCS')){ $wpdocs_android_settings->ab_io_display($wpdocs_url); } ?> |
| 44 |
</div> |
| 45 |
|
| 46 |
<?php |
| 47 |
|
| 48 |
|
| 49 |
$wpdocs_versions_type = get_option('wpdocs_versions_type', 'old'); |
| 50 |
?> |
| 51 |
|
| 52 |
<style type="text/css"> |
| 53 |
.versions_type{ |
| 54 |
background-color:#CCC; |
| 55 |
border-radius:4px; |
| 56 |
padding:10px 20px 20px 20px; |
| 57 |
display:none; |
| 58 |
|
| 59 |
} |
| 60 |
.versions_type label{ |
| 61 |
font-weight:normal; |
| 62 |
padding:0; |
| 63 |
margin:0; |
| 64 |
} |
| 65 |
.versions_type input[type="radio"]{ |
| 66 |
padding:0; |
| 67 |
margin:0; |
| 68 |
} |
| 69 |
.update-nag{ |
| 70 |
display:none; |
| 71 |
} |
| 72 |
</style> |
| 73 |
<script type="text/javascript" language="javascript"> |
| 74 |
jQuery(document).ready(function($){ |
| 75 |
$('.versions_type input[type="radio"]').on('click', function(){ |
| 76 |
$('.versions_type > form').submit(); |
| 77 |
}); |
| 78 |
}); |
| 79 |
</script> |
| 80 |
|
| 81 |
<div class="versions_type"> |
| 82 |
<form action="" method="post"> |
| 83 |
<?php wp_nonce_field( 'version_type_action', 'version_type_nonce_field' ); ?> |
| 84 |
</form> |
| 85 |
</div> |
| 86 |
<div class="wpdocs_help"> |
| 87 |
<h6><?php _e('How it works?', 'wp-docs'); ?></h6> |
| 88 |
<p><?php echo __('A default page is created with title', 'wp-docs').' "WP Docs" '.__('in', 'wp-docs').' <a href="edit.php?post_type=page" target="_blank">'.__('pages', 'wp-docs').'</a>. '.__('You can create more pages with a shortcode', 'wp-docs').' <code>[wpdocs]</code>. '.__('Create directories, sub-directories and add documents to list them with the shortcode.', 'wp-docs').' '.__("That's it.", 'wp-docs'); ?></p> |
| 89 |
</div> |
| 90 |
|
| 91 |
<h2 class="nav-tab-wrapper"> |
| 92 |
|
| 93 |
<a class="nav-tab nav-tab-active" data-tab="directories"><?php _e("Directories",'wp-docs'); ?> <i class="fa fa-folder"></i> / <?php _e("Files",'wp-docs'); ?> <i class="fas fa-file-word"></i> <i class="fas fa-file-pdf"></i> <i class="fas fa-file-image"></i> <i class="fas fa-file-archive"></i></a> |
| 94 |
<a class="nav-tab" data-tab="tools"><?php _e("Tools",'wp-docs'); ?> <i class="fas fa-tools"></i></a> |
| 95 |
|
| 96 |
<a class="nav-tab float-right" data-tab="help"><?php _e("Help",'wp-docs'); ?> <i class="fas fa-question-circle"></i></a> |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
</h2> |
| 102 |
<?php |
| 103 |
} |