post_content, 'contact-form-7' ) ) { if ( defined( 'WPCF7_LOAD_JS' ) && ! WPCF7_LOAD_JS ) { return; } if ( function_exists( 'wpcf7_enqueue_scripts' ) ) { wpcf7_enqueue_scripts(); } if ( function_exists( 'wpcf7_enqueue_styles' ) ) { wpcf7_enqueue_styles(); } } } /** * Append a hidden meta html element with the forms popup settings. * * @param $elements * * @return string */ public static function form_elements( $elements ) { $form = wpcf7_get_current_contact_form(); $settings = wp_json_encode( self::form_options( $form->id() ) ); return $elements . ""; } /** * Get a specific forms options. * * @param $id * * @return array */ public static function form_options( $id ) { $settings = get_option( 'cf7_pum_' . $id, self::defaults() ); return wp_parse_args( $settings, self::defaults() ); } /** * Get default values. * * @return array */ public static function defaults() { return [ 'closepopup' => false, 'closedelay' => 0, 'openpopup' => false, 'openpopup_id' => 0, ]; } /** * Registers new cookie events. * * @param array $cookies * * @return array */ public static function register_cookies( $cookies = [] ) { $cookies['cf7_form_success'] = [ 'labels' => [ 'name' => __( 'Contact Form 7 Success (deprecated. Use Form Submission instead.)', 'popup-maker' ), ], 'fields' => pum_get_cookie_fields(), ]; return $cookies; } /** * Register new CF7 form editor tab. * * @param array $panels * * @return array */ public static function editor_panels( $panels = [] ) { return array_merge( $panels, [ 'popups' => [ 'title' => __( 'Popup Settings', 'popup-maker' ), 'callback' => [ __CLASS__, 'editor_panel' ], ], ] ); } /** * Render the popup tab. * * @param object $args */ public static function editor_panel( $args ) { $settings = self::form_options( $args->id() ); ?>
| /> | |
| = 3 ) { $settings['closedelay'] = $settings['closedelay'] / 1000; } ?> | |
| /> | |