| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 |
/** |
| 4 |
* Represents the view for the administration dashboard. |
| 5 |
* |
| 6 |
* This includes the header, options, and other information that should |
| 7 |
* provide the user interface to the end user. |
| 8 |
* |
| 9 |
* @package PixTypes |
| 10 |
* @author Pixelgrade <contact@pixelgrade.com> |
| 11 |
* @license GPL-2.0+ |
| 12 |
* @link http://pixelgrade.com |
| 13 |
* @copyright 2013 Pixel Grade Media |
| 14 |
*/ |
| 15 |
|
| 16 |
$config = include pixtypes::pluginpath() . 'plugin-config' . PIXTYPES_EXT; |
| 17 |
|
| 18 |
// invoke processor |
| 19 |
$processor = pixtypes::processor( $config ); |
| 20 |
$status = $processor->status(); |
| 21 |
$errors = $processor->errors(); ?> |
| 22 |
|
| 23 |
<div class="wrap" id="pixtypes_form"> |
| 24 |
|
| 25 |
<div id="icon-options-general" class="icon32"><br></div> |
| 26 |
|
| 27 |
<h2><?php esc_html_e( 'Pixtypes', 'pixtypes' ); ?></h2> |
| 28 |
|
| 29 |
<?php if ( $processor->ok() ): ?> |
| 30 |
|
| 31 |
<?php if ( ! empty( $errors ) ): ?> |
| 32 |
<br/> |
| 33 |
<p class="update-nag"> |
| 34 |
<strong><?php esc_html_e( 'Unable to save settings.', 'pixtypes' ); ?></strong> |
| 35 |
<?php esc_html_e( 'Please check the fields for errors and typos.', 'pixtypes' ); ?> |
| 36 |
</p> |
| 37 |
<?php endif; ?> |
| 38 |
|
| 39 |
<?php if ( $processor->performed_update() ): ?> |
| 40 |
<br/> |
| 41 |
<p class="update-nag"> |
| 42 |
<?php esc_html_e( 'Settings have been updated.', 'pixtypes' ); ?> |
| 43 |
</p> |
| 44 |
<?php endif; ?> |
| 45 |
|
| 46 |
<?php |
| 47 |
$f = pixtypes::form( $config, $processor ); ?> |
| 48 |
|
| 49 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Form renderer escapes its markup. ?> |
| 50 |
<?php echo $f->startform() ?> |
| 51 |
|
| 52 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Field renderer escapes its own controls. ?> |
| 53 |
<?php echo $f->field( 'hiddens' )->render(); ?> |
| 54 |
|
| 55 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Field renderer escapes its own controls. ?> |
| 56 |
<?php echo $f->field( 'post_types' )->render(); ?> |
| 57 |
|
| 58 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Field renderer escapes its own controls. ?> |
| 59 |
<?php echo $f->field( 'taxonomies' )->render(); ?> |
| 60 |
|
| 61 |
<?php wp_nonce_field( 'pixtypes-save-settings' ); ?> |
| 62 |
|
| 63 |
<button type="submit" class="button button-primary"> |
| 64 |
<?php esc_html_e( 'Save Changes', 'pixtypes' ); ?> |
| 65 |
</button> |
| 66 |
|
| 67 |
<?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Form renderer escapes its markup. ?> |
| 68 |
<?php echo $f->endform() ?> |
| 69 |
|
| 70 |
<?php elseif ( 'error' === $status['state'] ): ?> |
| 71 |
|
| 72 |
<h3><?php esc_html_e( 'Critical Error', 'pixtypes' ); ?></h3> |
| 73 |
|
| 74 |
<p><?php echo esc_html( $status['message'] ); ?></p> |
| 75 |
|
| 76 |
<?php endif; ?> |
| 77 |
|
| 78 |
<?php $options = get_option( 'pixtypes_settings' ); |
| 79 |
if ( isset( $options['themes'] ) && count( $options['themes'] ) > 1 ) { ?> |
| 80 |
|
| 81 |
<div class="uninstall_area postbox"> |
| 82 |
|
| 83 |
<div class="handlediv" title="Click to toggle"><br></div> |
| 84 |
<h3 class="hndle"><span><?php esc_html_e( 'Extra Careful Zone', 'pixtypes' ); ?></span></h3> |
| 85 |
|
| 86 |
<div class="inside"> |
| 87 |
|
| 88 |
<p><?php esc_html_e( 'If you are done with copying your content from old themes to new ones, you can also get rid of the old themes settings and post types.', 'pixtypes' ); ?></p> |
| 89 |
<form method="post" id="unset_pixypes" |
| 90 |
action="<?php echo esc_url( admin_url( 'options-general.php?page=pixtypes' ) ) ?>"> |
| 91 |
<input type="hidden" class="unset_nonce" name="unset_nonce" |
| 92 |
value="<?php echo esc_attr( wp_create_nonce( 'unset_pixtype' ) ); ?>"/> |
| 93 |
<ul> |
| 94 |
<?php |
| 95 |
if ( isset( $options['themes'] ) && count( $options['themes'] ) > 1 ) { |
| 96 |
foreach ( $options['themes'] as $key => $theme ) { |
| 97 |
echo '<li><button class="button delete-action" type="submit" name="unset_pixtype" value="' . esc_attr( $key ) . '">' . esc_html__( 'Clean-up after', 'pixtypes' ) . ' ' . esc_html( ucfirst( $key ) ) . '</button></li>'; |
| 98 |
} |
| 99 |
} ?> |
| 100 |
</ul> |
| 101 |
</form> |
| 102 |
</div> |
| 103 |
</div> |
| 104 |
<?php } ?> |
| 105 |
</div> |
| 106 |
|