芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/popup-maker/includes/integrations/class-pum-cf7.php
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; } ?>
/>
>
0, 'label' => __( 'Select a popup', 'popup-maker' ), ], ]; $popups = get_posts( [ 'post_type' => 'popup', 'post_status' => [ 'publish' ], 'posts_per_page' => - 1, ] ); foreach ( $popups as $popup ) { $popup_list[] = [ 'value' => $popup->ID, 'label' => $popup->post_title, ]; } return $popup_list; } /** * Save form popup options. * * @param $args */ public static function save( $args ) { if ( ! empty( $_POST['wpcf7-pum'] ) ) { $settings = $_POST['wpcf7-pum']; // Sanitize values. $settings['openpopup'] = ! empty( $settings['openpopup'] ); $settings['openpopup_id'] = ! empty( $settings['openpopup_id'] ) ? absint( $settings['openpopup_id'] ) : 0; $settings['closepopup'] = ! empty( $settings['closepopup'] ); $settings['closedelay'] = ! empty( $settings['closedelay'] ) ? absint( $settings['closedelay'] ) : 0; update_option( 'cf7_pum_' . $args->id(), $settings ); } else { delete_option( 'cf7_pum_' . $args->id() ); } } }