| @@ -11,10 +11,17 @@ | ||
| 11 | 11 | |
| 12 | 12 | add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | + /** | |
| 16 | + * Include license box template on demand. | |
| 17 | + * | |
| 18 | + * @return void | |
| 19 | + */ | |
| 15 | 20 | public static function license_box() { |
| 16 | - $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 21 | + if ( ! current_user_can( 'activate_plugins' ) ) { | |
| 22 | + return; | |
| 23 | + } | |
| 17 | 24 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); |
| 18 | 25 | } |
| 19 | 26 | |
| 20 | 27 | public static function display_form( $errors = array(), $message = '' ) { |
| @@ -177,17 +184,38 @@ | ||
| 177 | 184 | wp_die(); |
| 178 | 185 | } |
| 179 | 186 | |
| 180 | 187 | /** |
| 188 | + * Render the general global settings section. | |
| 189 | + * | |
| 181 | 190 | * @since 4.0 |
| 191 | + * | |
| 192 | + * @return void | |
| 182 | 193 | */ |
| 183 | 194 | public static function general_settings() { |
| 184 | 195 | $frm_settings = FrmAppHelper::get_settings(); |
| 196 | + $uploads = wp_upload_dir(); | |
| 197 | + $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 185 | 198 | |
| 186 | - $uploads = wp_upload_dir(); | |
| 187 | - $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 199 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php'; | |
| 200 | + } | |
| 188 | 201 | |
| 189 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php' ); | |
| 202 | + /** | |
| 203 | + * Render the global currency selector if Pro is up to date. | |
| 204 | + * | |
| 205 | + * @param FrmSettings $frm_settings | |
| 206 | + * @param string $more_html | |
| 207 | + * @return void | |
| 208 | + */ | |
| 209 | + public static function maybe_render_currency_selector( $frm_settings, $more_html ) { | |
| 210 | + if ( false !== strpos( $more_html, 'id="frm_currency"' ) ) { | |
| 211 | + // Avoid rendering the Currency setting if it gets rendered from the frm_settings_form hook. | |
| 212 | + // This is for backward compatibility. If Pro is outdated there won't be two currency dropdowns. | |
| 213 | + return; | |
| 214 | + } | |
| 215 | + | |
| 216 | + $currencies = FrmCurrencyHelper::get_currencies(); | |
| 217 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/_currency.php'; | |
| 190 | 218 | } |
| 191 | 219 | |
| 192 | 220 | /** |
| 193 | 221 | * @since 4.0 |
| @@ -240,9 +268,15 @@ | ||
| 240 | 268 | $frm_settings = FrmAppHelper::get_settings(); |
| 241 | 269 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 242 | 270 | |
| 243 | 271 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 244 | - wp_die( esc_html( $frm_settings->admin_permission ) ); | |
| 272 | + $error_args = array( | |
| 273 | + 'title' => __( 'Verification failed', 'formidable' ), | |
| 274 | + 'body' => $frm_settings->admin_permission, | |
| 275 | + 'cancel_text' => __( 'Cancel', 'formidable' ), | |
| 276 | + ); | |
| 277 | + FrmAppController::show_error_modal( $error_args ); | |
| 278 | + return; | |
| 245 | 279 | } |
| 246 | 280 | |
| 247 | 281 | $errors = array(); |
| 248 | 282 | $message = ''; |