wp2static/views/options-page.phtml
2016-12-29 17:22:51 +13:00

133 lines
5.8 KiB
PHTML

<?php
/**
* @package WP Static HTML Output
*
* Copyright (c) 2011 Leon Stafford
*/
?>
<script>
jQuery(document).ready(function($){
$('#generateArchiveButton').click(function() {
$('#results').show();
// set form action for generation vs saving options
$('#formActionHiddenField').val('generate_archive')
data = $('#general-options').serialize();
jQuery.post(ajaxurl, data, function(response) {
$('#results').html(response);
});
// revert form action for saving options vs generation
$('#formActionHiddenField').val('generate')
});
});
</script>
<div class="wrap">
<h2><?= __('WP Static HTML Output - Configure & Run', 'static-html-output-plugin');?></h2>
<div class="postbox-container">
<div class="metabox-holder">
<div class="meta-box-sortables ui-sortable">
<form id="general-options" method="post" action="">
<div class="postbox">
<div class="handlediv" title="Click to toggle"><br /></div>
<h3 class="hndle"><span><?= __('Configurable options', 'static-html-output-plugin');?></span></h3>
<div class="inside">
<p>
<strong><label for="baseUrl"><?= __('Base Url', 'static-html-output-plugin');?></label></strong>
<p>
<i>This defaults to your WordPress Site URL. If you know the URL of where you'll be hosting the static version of your site, it will be good to change this to that, ie http://mystaticsite.github.io</i>
</p>
<input type="text" id="baseUrl" name="baseUrl" value="<?php echo esc_attr($this->baseUrl) ?>" size="50" />
</p>
<p>
<strong><label for="additionalUrls"><?= __('Additional Urls', 'static-html-output-plugin');?></label></strong>
<p>
<i>For a few themes, certain files may not be detected as part of the export process. Enter any such files here, one per line. </i>
</p>
<textarea class="widefat" name="additionalUrls" id="additionalUrls" rows="5" cols="10"><?php echo esc_html($this->additionalUrls) ?></textarea>
</p>
<p>
<input name="cleanMeta" id="cleanMeta" value="1" type="checkbox" <?php if ($this->cleanMeta == 1) echo "checked"; ?> />
<label for="cleanMeta"><?= __('Strip out unneeded WordPress meta tags', 'static-html-output-plugin');?></label>
</p>
<p>
<input name="retainStaticFiles" id="retainStaticFiles" value="1" type="checkbox" <?php if ($this->retainStaticFiles == 1) echo "checked"; ?> />
<label for="retainStaticFiles"><?= __('Retain generated static files on server', 'static-html-output-plugin');?></label>
</p>
<p>
<input name="sendViaFTP" id="sendViaFTP" value="1" type="checkbox" <?php if ($this->sendViaFTP == 1) echo "checked"; ?> />
<label for="sendViaFTP"><?= __('Transfer files via FTP', 'static-html-output-plugin');?></label>
<br /><b><span style="color:red;"><?= __('FTP functionality is in Beta testing: For large sites, page may seem unresponsive until complete. If in doubt, check your remote FTP directory for activity.', 'static-html-output-plugin');?> </span></b>
</p>
<p>
<label for="ftpServer"><?= __('FTP Server', 'static-html-output-plugin');?>:</label><br />
<input name="ftpServer" id="ftpServer" value="<?php echo esc_attr($this->ftpServer) ?>" size="30" />
</p>
<p>
<label for="ftpUsername"><?= __('FTP Username', 'static-html-output-plugin');?>:</label><br />
<input name="ftpUsername" id="ftpUsername" value="<?php echo esc_attr($this->ftpUsername) ?>" size="30" />
</p>
<p>
<label for="ftpPassword"><?= __('FTP Password', 'static-html-output-plugin');?>:</label><br />
<input name="ftpPassword" id="ftpPassword" type="password" value="" size="30" />
</p>
<p>
<label for="ftpRemotePath"><?= __('FTP Remote Path', 'static-html-output-plugin');?>:</label><br />
<input name="ftpRemotePath" id="ftpRemotePath" value="<?php echo esc_attr($this->ftpRemotePath) ?>" size="30" />
</p>
<p class="submit">
<?php wp_nonce_field($this->onceAction) ?>
<input id="formActionHiddenField" type="hidden" name="action" value="generate" />
<input class="button-primary" type="submit" name="submit" value="Save current options" />
</p>
</div>
</div>
<div class="postbox">
<div class="handlediv" title="Click to toggle"><br /></div>
<h3 class="hndle"><span><?= __('Export your site', 'static-html-output-plugin');?></span></h3>
<div class="inside">
<p>
<p>
<i>Clicking the button below will start the process of generating a static site from your WordPress installation. Depending on the size of your website, this process may take some time.</i>
</p>
<div id="results" style="display:none;">
<img src="<?php echo plugins_url('../images/dashinfinity.gif', __FILE__); ?>" />
</div>
<p class="submit">
<?php wp_nonce_field($this->onceAction) ?>
<input id="generateArchiveButton" class="button-primary" value="Start static site export" />
</p>
</p>
</div>
</div>
</form>
</div>
</div>
</div>
</div>