Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move this into a view file and include #49

Open
jrtashjian opened this issue May 19, 2020 · 0 comments
Open

Move this into a view file and include #49

jrtashjian opened this issue May 19, 2020 · 0 comments

Comments

@jrtashjian
Copy link
Member

Migrating TODO from inline comment.

/**
* Displays the settings page.
*
* @todo Move this into a view file and include.
*/
public function display_settings_page() {
$tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : '';
$forms = GEM_Dispatcher::get_forms();
$valid_creds = (bool) get_option( 'gem-valid-creds' );
// Create a default form.
if ( empty( $forms->signups ) && $valid_creds ) {
GEM_Dispatcher::add_default_form();
$forms = GEM_Dispatcher::fetch_forms();
}
if ( ! empty( $forms->signups ) && empty( $tab ) ) {
$tab = 'forms';
}
?>
<div class="wrap about-wrap">
<div class="intro">
<h1>
<?php esc_html_e( 'GoDaddy Email Marketing Signup Forms', 'godaddy-email-marketing-sign-up-forms' ); ?>
<sup><?php echo esc_html( GEM_VERSION ); ?></sup>
</h1>
<?php if ( empty( $forms->signups ) ) : ?>
<div class="gem-identity updated notice">
<p><?php echo esc_html_x( 'Enjoy the GoDaddy Email Marketing Experience.', 'gem header note', 'godaddy-email-marketing-sign-up-forms' ); ?></p>
<p><?php echo esc_html_x( 'Add your GoDaddy Email Marketing signup form to your WordPress site! Easy to set up, the GoDaddy Email Marketing plugin allows your site visitors to subscribe to your email list.', 'header note', 'godaddy-email-marketing-sign-up-forms' ); ?></p>
<p class="description">
<?php if ( true === $valid_creds ) : ?>
<?php echo esc_html_x( 'You don\'t have any forms yet.', 'header note', 'godaddy-email-marketing-sign-up-forms' ); ?>
<?php $this->signups_button(); ?>
<?php else : ?>
<?php echo /* translators: %s: Sign Up Now button */ sprintf( esc_html_x( 'New to GoDaddy? Create an account to get started today. %s', 'Sign up button', 'godaddy-email-marketing-sign-up-forms' ), sprintf( '<a target="_blank" href="%s" class="button">%s</a>', 'https://sso.godaddy.com/account/create?path=/wordpress_plugin&app=gem&realm=idp&ssoreturnpath=/%3Fpath%3D%2Fwordpress_plugin%26app%3Dgem%26realm%3Didp', esc_html_x( 'Sign Up Now', 'header button', 'godaddy-email-marketing-sign-up-forms' ) ) ); ?>
<?php endif; ?>
</p>
</div>
<?php endif; ?>
</div>
<form method="post" action="options.php">
<h2 class="nav-tab-wrapper">
<?php if ( ! empty( $forms->signups ) ) : ?>
<a href="#forms" class="nav-tab <?php echo esc_attr( 'forms' === $tab ? 'nav-tab-active' : '' ); ?>"><?php esc_html_e( 'Forms', 'godaddy-email-marketing-sign-up-forms' ); ?></a>
<?php endif; ?>
<a href="#settings" class="nav-tab <?php echo esc_attr( 'settings' === $tab || empty( $tab ) ? 'nav-tab-active' : '' ); ?>"><?php esc_html_e( 'Settings', 'godaddy-email-marketing-sign-up-forms' ); ?></a>
<a href="#help" class="nav-tab <?php echo esc_attr( 'help' === $tab ? 'nav-tab-active' : '' ); ?>"><?php esc_html_e( 'Help', 'godaddy-email-marketing-sign-up-forms' ); ?></a>
</h2>
<div id="setting-errors"></div>
<?php if ( ! empty( $forms->signups ) ) : ?>
<div id="forms" class="panel">
<h3><?php esc_html_e( 'Reach Your Fans', 'godaddy-email-marketing-sign-up-forms' ); ?></h3>
<p>
<?php
printf(
/* translators: %1$s: <a href="https://gem.godaddy.com">, %2$s: </a> */
esc_html__( 'Email marketing makes it easier than ever to turn casual visits into lasting relationship. You\'re already collecting subscribers, now you just need to start emailing them. It only takes a few moments to %1$screate an email marketing campaign%2$s.', 'godaddy-email-marketing-sign-up-forms' ),
'<a href="https://gem.godaddy.com" target="_blank">',
'</a>'
);
?>
</p>
<h3><?php esc_html_e( 'Available Signup Forms', 'godaddy-email-marketing-sign-up-forms' ); ?></h3>
<table class="wp-list-table widefat fixed striped">
<thead>
<tr>
<th scope="col" class="manage-column column-primary"><?php esc_html_e( 'Form Name', 'godaddy-email-marketing-sign-up-forms' ); ?></th>
<th scope="col" class="manage-column"><?php esc_html_e( 'Form ID', 'godaddy-email-marketing-sign-up-forms' ); ?></th>
<th scope="col" class="manage-column"><?php esc_html_e( 'Shortcode', 'godaddy-email-marketing-sign-up-forms' ); ?></th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="col" class="manage-column column-primary"><?php esc_html_e( 'Form Name', 'godaddy-email-marketing-sign-up-forms' ); ?></th>
<th scope="col" class="manage-column"><?php esc_html_e( 'Form ID', 'godaddy-email-marketing-sign-up-forms' ); ?></th>
<th scope="col" class="manage-column"><?php esc_html_e( 'Shortcode', 'godaddy-email-marketing-sign-up-forms' ); ?></th>
</tr>
</tfoot>
<tbody>
<?php foreach ( $forms->signups as $form ) : ?>
<tr>
<td class="has-row-actions column-primary" data-colname="<?php esc_html_e( 'Form Name', 'godaddy-email-marketing-sign-up-forms' ); ?>">
<strong class="row-title"><?php echo esc_html( $form->name ); ?></strong>
<div class="row-actions">
<span class="edit">
<a target="_blank" href="<?php echo esc_url( "https://gem.godaddy.com/signups/{$form->id}/edit" ); ?>" title="<?php esc_attr_e( 'Opens in a new window', 'godaddy-email-marketing-sign-up-forms' ); ?>"><?php esc_html_e( 'Edit form in GoDaddy Email Marketing', 'godaddy-email-marketing-sign-up-forms' ); ?></a> |
</span>
<span class="view">
<a target="_blank" href="<?php echo esc_url( $form->url ); ?>"><?php esc_html_e( 'Preview', 'godaddy-email-marketing-sign-up-forms' ); ?></a>
</span>
</div>
<button type="button" class="toggle-row">
<span class="screen-reader-text">Show more details</span>
</button>
</td>
<td data-colname="<?php esc_html_e( 'Form ID', 'godaddy-email-marketing-sign-up-forms' ); ?>">
<code class="gem-form-id"><?php echo absint( $form->id ); ?></code>
</td>
<td data-colname="<?php esc_html_e( 'Shortcode', 'godaddy-email-marketing-sign-up-forms' ); ?>">
<input type="text" id="form-<?php echo absint( $form->id ); ?>" class="code clipboard-value" value="[gem id=<?php echo absint( $form->id ); ?>]" readonly />
<button data-copytarget="#form-<?php echo absint( $form->id ); ?>" class="button copy-to-clipboard">
<img src="<?php echo esc_url( plugins_url( 'images/clippy.svg', GEM_PLUGIN_BASE ) ); ?>" width="14" alt="Copy to clipboard">
</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<br style="clear:both" />
<p class="description">
<?php esc_html_e( 'Not seeing your form?', 'godaddy-email-marketing-sign-up-forms' ); ?> <?php $this->refresh_button( true ); ?>
<?php
if ( true === $valid_creds ) {
$this->signups_button();
$this->campaign_button();
}
?>
</p>
</div>
<?php endif; ?>
<div id="settings" class="two-col panel">
<?php settings_fields( 'gem-options' ); ?>
<?php $this->do_settings_sections( $this->slug ); ?>
<br style="clear:both" />
<p class="submit">
<?php
submit_button( _x( 'Save Settings', 'save settings button', 'godaddy-email-marketing-sign-up-forms' ), 'primary', 'submit', false );
if ( empty( $forms->signups ) && true === $valid_creds ) {
$this->refresh_button();
}
?>
</p>
</div>
</form>
<div id="help" class="panel">
<?php $this->generate_help_tab_content(); ?>
<br style="clear:both" />
</div>
</div>
<?php
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant