芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/popup-maker/includes/integrations/class-pum-gravity-forms.php
post_content, 'gravityform' ) ) { $regex = "/\[gravityform.*id=[\'\"]?([0-9]*)[\'\"]?.*/"; $popup = get_post( $popup_id ); preg_match_all( $regex, $popup->post_content, $matches ); foreach ( $matches[1] as $form_id ) { add_filter( "gform_confirmation_anchor_{$form_id}", '__return_false' ); gravity_form_enqueue_scripts( $form_id, true ); } } } } public static function settings_menu( $setting_tabs ) { $setting_tabs['998.002'] = [ 'name' => 'popup-maker', 'label' => __( 'Popup Maker', 'popup-maker' ), ]; return $setting_tabs; } public static function get_form( $form_string, $form ) { $settings = wp_json_encode( self::form_options( $form['id'] ) ); $field = "
"; $form_string = preg_replace( '/(
)/', "$1 \r\n " . $field, $form_string ); return $form_string; } /** * Get default values. * * @return array */ public static function defaults() { return [ 'closepopup' => false, 'closedelay' => 0, 'openpopup' => false, 'openpopup_id' => 0, ]; } /** * Get a specific forms options. * * @param $id * * @return array */ public static function form_options( $id ) { $settings = get_option( 'gforms_pum_' . $id, self::defaults() ); return wp_parse_args( $settings, self::defaults() ); } /** * Registers new cookie events. * * @param array $cookies * * @return array */ public static function register_cookies( $cookies = [] ) { $cookies['gforms_form_success'] = [ 'labels' => [ 'name' => __( 'Gravity Form Success (deprecated. Use Form Submission instead.)', 'popup-maker' ), ], 'fields' => pum_get_cookie_fields(), ]; return $cookies; } public static function render_settings_page() { $form_id = rgget( 'id' ); self::save(); $settings = self::form_options( $form_id ); GFFormSettings::page_header( __( 'Popup Settings', 'popup-maker' ) ); ?>
/>
= 3 ) { $settings['closedelay'] = $settings['closedelay'] / 1000; } ?>
/>
>
'', '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. */ public static function save() { if ( empty( $_POST ) || ! check_admin_referer( 'gform_popup_settings_edit', 'gform_popup_settings_edit' ) ) { return; } $form_id = rgget( 'id' ); if ( ! empty( $_POST['gforms-pum'] ) ) { $settings = $_POST['gforms-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( 'gforms_pum_' . $form_id, $settings ); } else { delete_option( 'gforms_pum_' . $form_id ); } } } /** * * add_action( 'gform_loaded', array( 'PUM_Gravity_Forms_Integration', 'load' ), 5 ); * * class PUM_Gravity_Forms_Integration { * * public static function load() { * if ( ! method_exists( 'GFForms', 'include_feed_addon_framework' ) ) { * return; * } * require_once 'gravity-forms/class-pum-gf-popup-addon.php'; * GFAddOn::register( 'PUM_GF_Popup_Addon' ); * } * } * * function pum_gf_addon() { * return PUM_GF_Popup_Addon::get_instance(); * } */