| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) or die(); |
| 4 |
|
| 5 |
global $wp_version; |
| 6 |
|
| 7 |
/** @var \Gianism\UI\SettingScreen $this */ |
| 8 |
?> |
| 9 |
|
| 10 |
<form method="post"> |
| 11 |
|
| 12 |
<?php wp_nonce_field( 'gianism_option' ); ?> |
| 13 |
|
| 14 |
<h3><i class="lsf lsf-gear"></i> <?php esc_html_e( 'General Setting', 'wp-gianism' ); ?></h3> |
| 15 |
<table class="form-table"> |
| 16 |
<tr> |
| 17 |
<th><?php esc_html_e( 'Current registration setting', 'wp-gianism' ); ?></th> |
| 18 |
<td> |
| 19 |
<p> |
| 20 |
<?php if ( $this->option->user_can_register() ) : ?> |
| 21 |
<i class="lsf lsf-check" style="color: green; font-size: 1.4em;"></i> |
| 22 |
<strong><?php esc_html_e( 'User can register account.', 'wp-gianism' ); ?></strong> |
| 23 |
<?php else : ?> |
| 24 |
<i class="lsf lsf-ban" style="color: lightgrey; font-size: 1.4em;"></i> |
| 25 |
<strong><?php esc_html_e( 'User can\'t register account.', 'wp-gianism' ); ?></strong> |
| 26 |
<?php endif; ?> |
| 27 |
</p> |
| 28 |
<p> |
| 29 |
<label> |
| 30 |
<input type="radio" name="force_register" |
| 31 |
value="1"<?php checked( $this->option->force_register ); ?> /> |
| 32 |
<?php esc_html_e( 'Force register', 'wp-gianism' ); ?> |
| 33 |
</label><br/> |
| 34 |
<label> |
| 35 |
<input type="radio" name="force_register" |
| 36 |
value="0"<?php checked( ! $this->option->force_register ); ?> /> |
| 37 |
<?php esc_html_e( 'Depends on WP setting', 'wp-gianism' ); ?> |
| 38 |
</label> |
| 39 |
</p> |
| 40 |
<p class="description"> |
| 41 |
<?php |
| 42 |
// translators: %s is link to general setting. |
| 43 |
echo wp_kses_post( sprintf( __( 'Whether registration setting depends on <a href="%s">General setting</a>. If users are allowed to register, account will be created with information provided from Web service, or else only connected users can login via SNS account.', 'wp-gianism' ), admin_url( 'options-general.php' ) ) ); |
| 44 |
?> |
| 45 |
</p> |
| 46 |
<?php if ( gianism_woocommerce_detected() ) : ?> |
| 47 |
<p class="description" style="color: #f34357;"> |
| 48 |
<?php echo wp_kses( __( '<strong>WooCommerce found!</strong> In spite of this setting, user can always register account.', 'wp-gianism' ), [ 'strong' => [] ] ); ?> |
| 49 |
</p> |
| 50 |
<?php endif; ?> |
| 51 |
</td> |
| 52 |
</tr> |
| 53 |
<tr> |
| 54 |
<th><?php esc_html_e( 'Login screen', 'wp-gianism' ); ?></th> |
| 55 |
<td> |
| 56 |
<label> |
| 57 |
<input type="radio" name="show_button_on_login" |
| 58 |
value="1"<?php checked( $this->option->show_button_on_login ); ?> /> |
| 59 |
<?php esc_html_e( 'Show all button on Login screen.', 'wp-gianism' ); ?> |
| 60 |
</label><br/> |
| 61 |
<label> |
| 62 |
<input type="radio" name="show_button_on_login" |
| 63 |
value="0"<?php checked( ! $this->option->show_button_on_login ); ?> /> |
| 64 |
<?php esc_html_e( 'Do not show login button.', 'wp-gianism' ); ?> |
| 65 |
</label> |
| 66 |
<p class="description"> |
| 67 |
<?php |
| 68 |
// translators: %1$s is link title, %2$s is link to document. |
| 69 |
echo wp_kses_post( sprintf( __( 'You can output login button manually. See detail at <a href="%2$s">%1$s</a>.', 'wp-gianism' ), esc_html__( 'Customize', 'wp-gianism' ), $this->setting_url( 'customize' ) ) ); |
| 70 |
?> |
| 71 |
</p> |
| 72 |
</td> |
| 73 |
</tr> |
| 74 |
<tr> |
| 75 |
<th><label for="prefix"><?php esc_html_e( 'URL Prefix', 'wp-gianism' ); ?></label></th> |
| 76 |
<td> |
| 77 |
<input type="text" value="<?php echo esc_attr( $this->option->prefix ); ?>" name="prefix" id="prefix" /> |
| 78 |
<p class="description"> |
| 79 |
<?php $this->new_from( '4.0.0' ); ?> |
| 80 |
<?php esc_html_e( 'You can add prefix for all Gianism redirect URIs. Useful if you site is under CDN network which filters cookie strings.', 'wp-gianism' ); ?> |
| 81 |
<br /> |
| 82 |
<?php echo wp_kses_post( __( '<strong>NOTICE: </strong>if you change URL prefix, you have to change all app setting in each SNS. It might cause error on live site.', 'wp-gianism' ) ); ?> |
| 83 |
</p> |
| 84 |
</td> |
| 85 |
</tr> |
| 86 |
<tr> |
| 87 |
<th><label for="wpg-check-profile"><?php esc_html_e( 'Profile Completion', 'wp-gianism' ); ?></label></th> |
| 88 |
<td> |
| 89 |
<?php $this->new_from( '4.1.0' ); ?> |
| 90 |
<select name="check_profile" id="wpg-check-profile"> |
| 91 |
<?php |
| 92 |
foreach ( [ |
| 93 |
'' => __( 'Notify on admin profile screen(Default)', 'wp-gianism' ), |
| 94 |
'popup' => __( 'Show pop up for incomplete users(Aggressive)', 'wp-gianism' ), |
| 95 |
'redirect' => __( 'Redirect users to fill profile(Forcible)', 'wp-gianism' ), |
| 96 |
] as $value => $label ) { |
| 97 |
printf( '<option value="%1$s"%3$s>%2$s</option>', esc_attr( $value ), esc_html( $label ), selected( $value, $this->option->check_profile, false ) ); |
| 98 |
} |
| 99 |
?> |
| 100 |
</select> |
| 101 |
<p class="description"> |
| 102 |
<?php echo wp_kses_post( __( 'Users who registered account via SNS have sometimes incomplete profile. You can choose how to treat them by this option.', 'wp-gianism' ) ); ?> |
| 103 |
<?php if ( ! $this->profile_checker->is_over_5() ) : ?> |
| 104 |
<br /><strong style="color: red"><?php esc_html_e( 'This feature requires WordPress 5.0 and higher. Please consider upgrading.', 'wp-gianism' ); ?></strong> |
| 105 |
<?php endif; ?> |
| 106 |
</p> |
| 107 |
|
| 108 |
<p class="gianism-toggle" data-target="#wpg-check-profile" data-valid="popup,redirect"> |
| 109 |
<label for="profile-completion-path"><?php esc_html_e( 'Profile URL', 'wp-gianism' ); ?></label><br /> |
| 110 |
<input name="profile_completion_path" class="regular-text" type="text" id="profile-completion-path" |
| 111 |
value="<?php echo esc_attr( $this->option->profile_completion_path ); ?>" |
| 112 |
placeholder="<?php esc_attr_e( 'e.g. /my-profile/account', 'wp-gianism' ); ?>" /> |
| 113 |
<br /> |
| 114 |
<span class="description"> |
| 115 |
<?php esc_html_e( 'If you want your users to complete their profiles, you can specify the path to profile completion page.', 'wp-gianism' ); ?><br /> |
| 116 |
<strong><?php esc_html_e( 'Current Setting', 'wp-gianism' ); ?></strong>: |
| 117 |
<?php |
| 118 |
printf( |
| 119 |
'<%1$s>%2$s</%1$s>', |
| 120 |
$this->option->check_profile ? 'code' : 'del', |
| 121 |
esc_url( \Gianism\Controller\ProfileChecker::get_instance()->redirect_url() ) |
| 122 |
); |
| 123 |
?> |
| 124 |
</span> |
| 125 |
</p> |
| 126 |
<p class="gianism-toggle" data-target="#wpg-check-profile" data-valid="redirect"> |
| 127 |
<label for="exclude-from-redirect"><?php esc_html_e( 'Excluded Path', 'wp-gianism' ); ?></label><br /> |
| 128 |
<textarea name="exclude_from_redirect" id="exclude-from-redirect" style="width: 100%; box-sizing: border-box" placeholder="e.g. /my-account"><?php echo esc_textarea( $this->option->exclude_from_redirect ); ?></textarea> |
| 129 |
<br /> |
| 130 |
<span class="description"> |
| 131 |
<?php esc_html_e( 'To avoid the redirect loop, enter paths excluded from redirection. 1 path in 1 line. Asterisk(*) means wildcard.', 'wp-gianism' ); ?> |
| 132 |
</span> |
| 133 |
</p> |
| 134 |
</td> |
| 135 |
</tr> |
| 136 |
</table> |
| 137 |
<?php submit_button(); ?> |
| 138 |
|
| 139 |
|
| 140 |
<?php |
| 141 |
foreach ( $this->service->all_services() as $service ) { |
| 142 |
/** @var \Gianism\Service\AbstractService $instance */ |
| 143 |
$instance = $this->service->get( $service ); |
| 144 |
$path = $instance->get_admin_template( 'setting' ); |
| 145 |
if ( $path && file_exists( $path ) ) { |
| 146 |
include $path; |
| 147 |
} |
| 148 |
} |
| 149 |
?> |
| 150 |
|
| 151 |
</form> |
| 152 |
|