| @@ -9,8 +9,10 @@ | ||
| 9 | 9 | add_action( 'init', [ $this, 'register_post_type' ] ); |
| 10 | 10 | add_action( 'admin_menu', [ $this, 'register_admin_menu' ] ); |
| 11 | 11 | add_action( 'pre_update_option_wpuf_general', [ $this, 'watch_wpuf_settings' ] ); |
| 12 | 12 | |
| 13 | + add_action( 'admin_notices', array( $this, 'wpuf_premium_cta' ) ); | |
| 14 | + | |
| 13 | 15 | add_filter( 'admin_footer_text', [ $this, 'admin_footer_text' ] ); |
| 14 | 16 | add_filter( 'admin_post_weforms_export_forms', [ $this, 'export_forms' ] ); |
| 15 | 17 | add_filter( 'admin_post_weforms_export_form_entries', [ $this, 'export_form_entries' ] ); |
| 16 | 18 | |
| @@ -18,8 +20,9 @@ | ||
| 18 | 20 | add_filter( 'weforms_settings_tabs', [ $this, 'set_default_settings' ], 5 ); |
| 19 | 21 | add_action( 'weforms_settings_tab_content_general', [ $this, 'settings_tab_general' ] ); |
| 20 | 22 | add_action( 'weforms_settings_tab_content_recaptcha', [ $this, 'settings_tab_recaptcha' ] ); |
| 21 | 23 | add_action( 'weforms_settings_tab_content_secure-database', [ $this, 'settings_tab_secure_database' ] ); |
| 24 | + add_action( 'weforms_settings_tab_content_humanpresence', [ $this, 'settings_tab_humanpresence' ] ); | |
| 22 | 25 | add_action( 'weforms_settings_tab_content_privacy', [ $this, 'settings_tab_privacy' ] ); |
| 23 | 26 | } |
| 24 | 27 | |
| 25 | 28 | /** |
| @@ -166,11 +169,19 @@ | ||
| 166 | 169 | * |
| 167 | 170 | * @return void |
| 168 | 171 | */ |
| 169 | 172 | public function export_form_entries() { |
| 173 | + if ( ! current_user_can( 'administrator' ) ) { | |
| 174 | + wp_die( esc_html__( 'You do not have permission to export entries', 'weforms' ) ); | |
| 175 | + } | |
| 176 | + | |
| 177 | + if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'weforms-export-entries' ) ) { | |
| 178 | + wp_die( esc_html__( 'Invalid nonce', 'weforms' ) ); | |
| 179 | + } | |
| 180 | + | |
| 170 | 181 | $form_id = isset( $_REQUEST['selected_forms'] ) ? absint( $_REQUEST['selected_forms'] ) : 0; |
| 171 | 182 | |
| 172 | - if ( !$form_id ) { | |
| 183 | + if ( ! $form_id ) { | |
| 173 | 184 | return; |
| 174 | 185 | } |
| 175 | 186 | |
| 176 | 187 | $entry_array = []; |
| @@ -334,8 +345,13 @@ | ||
| 334 | 345 | 'label' => __( 'Secure Database', 'weforms' ), |
| 335 | 346 | 'icon' => WEFORMS_ASSET_URI . '/images/integrations/secure-database.png', |
| 336 | 347 | ]; |
| 337 | 348 | |
| 349 | + $tabs['humanpresence'] = [ | |
| 350 | + 'label' => __( 'Human Presence', 'weforms' ), | |
| 351 | + 'icon' => WEFORMS_ASSET_URI . '/images/integrations/hp-shield.svg', | |
| 352 | + ]; | |
| 353 | + | |
| 338 | 354 | /* TODO: Refactor this block when more options are added in privacy settings*/ |
| 339 | 355 | if ( class_exists( 'WeForms_Pro' ) ) { |
| 340 | 356 | $tabs['privacy'] = [ |
| 341 | 357 | 'label' => __( 'Privacy', 'weforms' ), |
| @@ -377,8 +393,18 @@ | ||
| 377 | 393 | public function settings_tab_secure_database( $tab ) { |
| 378 | 394 | include __DIR__ . '/views/weforms-settings-secure-database.php'; |
| 379 | 395 | } |
| 380 | 396 | /** |
| 397 | + * Human Presence tab content | |
| 398 | + * | |
| 399 | + * @param array $tab | |
| 400 | + * | |
| 401 | + * @return void | |
| 402 | + */ | |
| 403 | + public function settings_tab_humanpresence( $tab ) { | |
| 404 | + include __DIR__ . '/views/weforms-settings-humanpresence.php'; | |
| 405 | + } | |
| 406 | + /** | |
| 381 | 407 | * Privacy tab content |
| 382 | 408 | * |
| 383 | 409 | * @param array $tab |
| 384 | 410 | * |
| @@ -386,5 +412,31 @@ | ||
| 386 | 412 | */ |
| 387 | 413 | public function settings_tab_privacy( $tab ) { |
| 388 | 414 | include __DIR__ . '/views/weforms-settings-privacy.php'; |
| 389 | 415 | } |
| 416 | + | |
| 417 | + /** | |
| 418 | + * WeForms Pro CTA notice | |
| 419 | + * | |
| 420 | + * @since 1.6.5 | |
| 421 | + */ | |
| 422 | + public function wpuf_premium_cta() { | |
| 423 | + $screen = get_current_screen(); | |
| 424 | + if ( $screen && $screen->base && 'toplevel_page_weforms' !== $screen->base ) { | |
| 425 | + return; | |
| 426 | + } | |
| 427 | + | |
| 428 | + if ( ! class_exists( 'WeForms_Pro' ) ) { | |
| 429 | + ?> | |
| 430 | + <div class="notice updated premium-cta"> | |
| 431 | + <p style="display: flex;align-items: center;"> | |
| 432 | + <img style="padding-right:15px;" src="<?php echo WEFORMS_ASSET_URI . '/images/weforms-logo.png'; ?>"> | |
| 433 | + <?php _e( 'You're using weForms Free. For more features, modules and more consider upgrading to Pro.' , 'weforms' ); ?> | |
| 434 | + </p> | |
| 435 | + <p class="submit"> | |
| 436 | + <a href="https://weformspro.com/get-premium/?utm_source=Entries&utm_medium=Button&utm_campaign=Upgrade%20Now" target="_blank" class="button-primary"><?php _e( 'UPGRADE NOW!' , 'weforms' ); ?></a> | |
| 437 | + </p> | |
| 438 | + </div> | |
| 439 | + <?php | |
| 440 | + } | |
| 441 | + } | |
| 390 | 442 | } |