?
steps/class-gf-installation-wizard-step-license-key.php 0000666 00000006220 15126405147 0017277 0 ustar 00 <?php
class GF_Installation_Wizard_Step_License_Key extends GF_Installation_Wizard_Step {
public $required = true;
protected $_name = 'license_key';
public $defaults = array(
'license_key' => '',
'accept_terms' => false,
);
function display() {
if ( ! $this->license_key && defined( 'GF_LICENSE_KEY' ) ) {
$this->license_key = GF_LICENSE_KEY;
}
?>
<p>
<?php echo sprintf( esc_html__( 'Enter your Gravity Forms License Key below. Your key unlocks access to automatic updates, the add-on installer, and support. You can find your key on the My Account page on the %sGravity Forms%s site.', 'gravityforms' ), '<a href="https://www.gravityforms.com">', '</a>' ); ?>
</p>
<div>
<input type="text" class="regular-text" id="license_key" value="<?php echo esc_attr( $this->license_key ); ?>" name="license_key" placeholder="<?php esc_attr_e('Enter Your License Key', 'gravityforms'); ?>" />
<?php
$key_error = $this->validation_message( 'license_key', false );
if ( $key_error ) {
echo $key_error;
}
?>
</div>
<?php
$message = $this->validation_message( 'accept_terms', false );
if ( $message || $key_error || $this->accept_terms ) {
?>
<p>
<?php esc_html_e( "If you don't enter a valid license key, you will not be able to update Gravity Forms when important bug fixes and security enhancements are released. This can be a serious security risk for your site.", 'gravityforms' ); ?>
</p>
<div>
<label>
<input type="checkbox" id="accept_terms" value="1" <?php checked( 1, $this->accept_terms ); ?> name="accept_terms" />
<?php esc_html_e( 'I understand the risks of not providing a valid license key.', 'gravityforms' ); ?> <span class="gfield_required">*</span>
</label>
<?php echo $message ?>
</div>
<?php
}
}
function get_title() {
return esc_html__( 'License Key', 'gravityforms' );
}
function validate() {
$this->is_valid_key = true;
$license_key = $this->license_key;
if ( empty ( $license_key ) ) {
$message = esc_html__( 'Please enter a valid license key.', 'gravityforms' ) . '</span>';
$this->set_field_validation_result( 'license_key', $message );
$this->is_valid_key = false;
} else {
$key_info = GFCommon::get_key_info( $license_key );
if ( empty( $key_info ) || ( ! $key_info['is_active'] ) ){
$message = " <i class='fa fa-times gf_keystatus_invalid'></i> <span class='gf_keystatus_invalid_text'>" . __( 'Invalid or Expired Key : Please make sure you have entered the correct value and that your key is not expired.', 'gravityforms' ) . '</span>';
$this->set_field_validation_result( 'license_key', $message );
$this->is_valid_key = false;
}
}
if ( ! $this->is_valid_key && ! $this->accept_terms ) {
$this->set_field_validation_result( 'accept_terms', __( 'Please accept the terms', 'gravityforms' ) );
}
$valid = $this->is_valid_key || ( ! $this->is_valid_key && $this->accept_terms );
return $valid;
}
function install() {
if ( $this->license_key ) {
GFFormsModel::save_key( $this->license_key );
$version_info = GFCommon::get_version_info( false );
}
}
function get_previous_button_text() {
return '';
}
} steps/class-gf-installation-wizard-step-complete.php 0000666 00000001025 15126405147 0016675 0 ustar 00 <?php
class GF_Installation_Wizard_Step_Complete extends GF_Installation_Wizard_Step {
protected $_name = 'complete';
function display() {
?>
<p>
<?php
esc_html_e( "Congratulations! Click the 'Create A Form' button to get started.", 'gravityforms' );
?>
</p>
<?php
}
function get_title(){
return esc_html__( 'Installation Complete', 'gravityforms' );
}
function get_next_button_text(){
return esc_html__( 'Create A Form', 'gravityforms' );
}
function get_previous_button_text(){
return '';
}
} steps/class-gf-installation-wizard-step-settings.php 0000666 00000010476 15126405147 0016737 0 ustar 00 <?php
class GF_Installation_Wizard_Step_Settings extends GF_Installation_Wizard_Step {
protected $_name = 'settings';
public $defaults = array(
'currency' => '',
'enable_noconflict' => false,
'enable_toolbar_menu' => true,
'enable_akismet' => true,
);
function display() {
$disabled = apply_filters( 'gform_currency_disabled', false ) ? "disabled='disabled'" : ''
?>
<table class="form-table">
<tr valign="top">
<th scope="row">
<label for="gforms_currency"><?php esc_html_e( 'Currency', 'gravityforms' ); ?></label> <?php gform_tooltip( 'settings_currency' ) ?>
</th>
<td>
<?php
$disabled = apply_filters( 'gform_currency_disabled', false ) ? "disabled='disabled'" : ''
?>
<select id="gforms_currency" name="currency" <?php echo $disabled ?>>
<option value=""><?php esc_html_e( 'Select a Currency', 'gravityforms' ) ?></option>
<?php
$current_currency = $this->currency;
foreach ( RGCurrency::get_currencies() as $code => $currency ) {
?>
<option value="<?php echo esc_attr( $code ) ?>" <?php echo $current_currency == $code ? "selected='selected'" : '' ?>><?php echo esc_html( $currency['name'] ) ?></option>
<?php
}
?>
</select>
<?php do_action( 'gform_currency_setting_message', '' ); ?>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="gform_enable_noconflict"><?php esc_html_e( 'No-Conflict Mode', 'gravityforms' ); ?></label> <?php gform_tooltip( 'settings_noconflict' ) ?>
</th>
<td>
<input type="radio" name="enable_noconflict" value="1" <?php echo $this->enable_noconflict == 1 ? "checked='checked'" : '' ?> id="gform_enable_noconflict" /> <?php esc_html_e( 'On', 'gravityforms' ); ?>
<input type="radio" name="enable_noconflict" value="0" <?php echo $this->enable_noconflict == 1 ? '' : "checked='checked'" ?> id="gform_disable_noconflict" /> <?php esc_html_e( 'Off', 'gravityforms' ); ?>
<br />
<span class="gf_settings_description"><?php esc_html_e( 'Set this to ON to prevent extraneous scripts and styles from being printed on Gravity Forms admin pages, reducing conflicts with other plugins and themes.', 'gravityforms' ); ?></span>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="gform_enable_toolbar_menu"><?php esc_html_e( 'Toolbar Menu', 'gravityforms' ); ?></label> <?php gform_tooltip( 'settings_toolbar_menu' ) ?>
</th>
<td>
<input type="radio" name="enable_toolbar_menu" value="1" <?php checked( $this->enable_toolbar_menu, true ); ?> id="gform_enable_toolbar_menu" /> <?php esc_html_e( 'On', 'gravityforms' ); ?>
<input type="radio" name="enable_toolbar_menu" value="0" <?php checked( $this->enable_toolbar_menu, false );?> id="gform_disable_toolbar_menu" /> <?php esc_html_e( 'Off', 'gravityforms' ); ?>
<br />
<span class="gf_settings_description"><?php esc_html_e( 'Set this to ON to display the Forms menu in the WordPress top toolbar. The Forms menu will display the latest ten forms recently opened in the form editor.', 'gravityforms' ); ?></span>
</td>
</tr>
<?php if ( GFCommon::has_akismet() ) { ?>
<tr valign="top">
<th scope="row">
<label for="gforms_enable_akismet"><?php esc_html_e( 'Akismet Integration', 'gravityforms' ); ?></label> <?php gform_tooltip( 'settings_akismet' ) ?>
</th>
<td>
<input type="radio" name="enable_akismet" value="1" <?php checked( $this->enable_akismet, true ) ?> id="gforms_enable_akismet" /> <?php esc_html_e( 'Yes', 'gravityforms' ); ?>
<input type="radio" name="enable_akismet" value="0" <?php checked( $this->enable_akismet, false ) ?> /> <?php esc_html_e( 'No', 'gravityforms' ); ?>
<br />
<span class="gf_settings_description"><?php esc_html_e( 'Protect your form entries from spam using Akismet.', 'gravityforms' ); ?></span>
</td>
</tr>
<?php } ?>
</table>
<?php
}
function get_title() {
return esc_html__( 'Global Settings', 'gravityforms' );
}
function install() {
update_option( 'gform_enable_noconflict', (bool) $this->enable_noconflict );
update_option( 'rg_gforms_enable_akismet', (bool) $this->enable_akismet );
update_option( 'rg_gforms_currency', $this->currency );
update_option( 'gform_enable_toolbar_menu', (bool) $this->enable_toolbar_menu );
}
}
steps/class-gf-installation-wizard-step.php 0000666 00000006066 15126405147 0015101 0 ustar 00 <?php
abstract class GF_Installation_Wizard_Step extends stdClass {
protected $_name = '';
protected $_field_validation_results = array();
protected $_validation_summary = '';
public $defaults = array();
private $_step_values;
function __construct( $values = array() ){
if ( empty ( $this->_name ) ) {
throw new Exception( 'Name not set' );
}
$this->_step_values = empty ( $values ) ? $this->defaults : $values;
}
function get_name(){
return $this->_name;
}
function is( $key ) {
return $key == $this->get_name();
}
function get_title(){
return '';
}
public function __set( $key, $value ) {
$this->_step_values[ $key ] = $value;
}
public function __isset( $key ) {
return isset( $this->_step_values[ $key ] );
}
public function __unset( $key ) {
unset( $this->_step_values[ $key ] );
}
function &__get( $key ){
if ( ! isset( $this->_step_values[ $key ] ) ) {
$this->_step_values[ $key ] = '';
}
return $this->_step_values[ $key ];
}
function get_values(){
$set_values = $this->_step_values ? $this->_step_values : array();
$values = array_merge( $this->defaults, $set_values);
return $values;
}
function display(){
}
function validate(){
// Assign $this->_validation_result;
return true;
}
function get_field_validation_result( $key ){
if ( ! isset( $this->_field_validation_results[ $key ] ) ) {
$this->_field_validation_results[ $key ] = '';
}
return $this->_field_validation_results[ $key ];
}
function set_field_validation_result( $key, $text ){
$this->_field_validation_results[ $key ] = $text;
}
function set_validation_summary( $text ) {
$this->_validation_summary = $text;
}
function get_validation_summary(){
return $this->_validation_summary;
}
function validation_message( $key, $echo = true ){
$message = '';
$validation_result = $this->get_field_validation_result( $key );
if ( ! empty ( $validation_result ) ) {
$message = sprintf( '<div class="validation_message">%s</div>', $validation_result );
}
if ( $echo ) {
echo $message;
}
return $message;
}
function is_complete(){
}
function get_next_button_text(){
return __( 'Next', 'gravityforms' );
}
function get_previous_button_text(){
return __( 'Back', 'gravityforms' );
}
function update( $posted_values = array() ){
$step_values = $this->get_values();
if ( empty ( $step_values ) ) {
$step_values = array();
}
$new_values = array_merge( $step_values, $posted_values );
update_option( 'gform_installation_wizard_' . $this->get_name(), $new_values );
$this->_step_values = $new_values;
}
function summary( $echo = true ){
return '';
}
function install(){
// do something
}
function flush_values(){
delete_option( 'gform_installation_wizard_' . $this->get_name() );
}
function get_posted_values() {
$posted_values = stripslashes_deep( $_POST );
$values = array();
foreach ( $posted_values as $key => $value ) {
if ( strpos( $key, '_', 0 ) !== 0 ) {
$values[ $key ] = $value;
}
}
$values = array_merge( $this->defaults, $values);
return $values;
}
} class-gf-upgrade-wizard.php 0000666 00000004077 15126405147 0011720 0 ustar 00 <?php
if ( ! class_exists( 'GFForms' ) ) {
die();
}
class GF_Upgrade_Wizard {
private $_step_class_names = array();
function __construct(){
}
public function display(){
//not implemented
return false;
}
/*
public function display(){
// register admin styles
wp_print_styles( array( 'jquery-ui-styles', 'gform_admin' ) );
?>
<div class="wrap about-wrap gform_installation_progress_step_wrap">
<h1><?php esc_html_e( 'Gravity Forms Upgrade', 'gravityforms' ) ?></h1>
<hr/>
<h2><?php esc_html_e( 'Database Update Required', 'gravityforms' ); ?></h2>
<p><?php esc_html_e( 'Gravity Forms has been updated! Before we send you on your way, we have to update your database to the newest version.', 'gravityforms' ); ?></p>
<p><?php esc_html_e( 'The database update process may take a little while, so please be patient.', 'gravityforms' ); ?></p>
<input class="button button-primary" type="submit" value="<?php esc_attr_e( 'Upgrade', 'gravityforms' ) ?>" name="_upgrade"/>
<script type="text/javascript">
function gform_start_upgrade(){
gform_message( 'Progress: 0%' );
//TODO: implement AJAX callbacks for manual upgrade
jQuery.post(ajaxurl, {
action : "gf_upgrade",
gf_upgrade : '<?php echo wp_create_nonce( 'gf_upgrade' ); ?>',
})
.done(function( data ) {
gform_success_message();
})
setTimeout( 'gform_check_upgrade_status', 1000 );
}
function gform_check_upgrade_status(){
jQuery.post(ajaxurl, {
action : "gf_check_upgrade_status",
gf_upgrade_status : '<?php echo wp_create_nonce( 'gf_upgrade_status' ); ?>',
})
.done(function( data ) {
if( data == '100' ){
gform_success_message();
}
else{
gform_message( 'Progress: ' + parseInt( data ) + '%' );
}
})
}
function gform_message( message ){
jQuery( '#gform_upgrade_message' ).html( message );
}
function gform_success_message(){
gform_message( 'Database upgrade complete' );
}
</script>
</div>
<?php
return true;
}
*/
}