芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/popup-maker/classes/Privacy.php
' . __( 'Suggested text:', 'popup-maker' ) . ' ' : ''; ob_start(); ?>
'', 'label' => '', 'time' => '', ] ); printf( '
%s
%s
%s
', $cookie['name'], $cookie['label'], $cookie['time'] ); } ?>
__( 'Popup Maker Subscribe Form' ), 'callback' => [ __CLASS__, 'exporter' ], ]; return $exporters; } /** * Register erasers for Popup Maker Optin Form Subscriber Data. * * @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md * * @param $exporters * * @return array */ public static function register_erasers( $exporters ) { $exporters[] = [ 'eraser_friendly_name' => __( 'Popup Maker Subscribe Form' ), 'callback' => [ __CLASS__, 'eraser' ], ]; return $exporters; } /** * Exporter for Popup Maker Optin Form Subscriber Data. * * @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md * * @param $email_address * @param int $page * * @return array */ public static function exporter( $email_address, $page = 1 ) { $number = 500; // Limit us to avoid timing out $page = (int) $page; $export_items = []; $subscribers = PUM_DB_Subscribers::instance()->query( [ 's' => $email_address, 'page' => $page, 'limit' => $number, 'orderby' => 'ID', 'order' => 'ASC', ], 'ARRAY_A' ); foreach ( (array) $subscribers as $subscriber ) { if ( $subscriber['email'] === $email_address ) { // Most item IDs should look like postType-postID // If you don't have a post, comment or other ID to work with, // use a unique value to avoid having this item's export // combined in the final report with other items of the same id $item_id = "pum-subscriber-{$subscriber['ID']}"; // Core group IDs include 'comments', 'posts', etc. // But you can add your own group IDs as needed $group_id = 'pum-subscribers'; // Optional group label. Core provides these for core groups. // If you define your own group, the first exporter to // include a label will be used as the group label in the // final exported report $group_label = __( 'Subscriber Data' ); // Plugins can add as many items in the item data array as they want $data = []; foreach ( $subscriber as $field_key => $field_value ) { switch ( $field_key ) { case 'ID': $data[] = [ 'name' => __( 'ID', 'popup-maker' ), 'value' => $field_value, ]; break; case 'email': $data[] = [ 'name' => __( 'Email', 'popup-maker' ), 'value' => $field_value, ]; break; case 'name': $data[] = [ 'name' => __( 'Name', 'popup-maker' ), 'value' => $field_value, ]; break; case 'fname': $data[] = [ 'name' => __( 'First Name', 'popup-maker' ), 'value' => $field_value, ]; break; case 'lname': $data[] = [ 'name' => __( 'Last Name', 'popup-maker' ), 'value' => $field_value, ]; break; case 'consent': $data[] = [ 'name' => __( 'Provided Consent', 'popup-maker' ), 'value' => ucfirst( $field_value ), ]; break; case 'values': case 'consent_args': $values = maybe_unserialize( $field_value ); foreach ( (array) $values as $key => $value ) { // Empty values don't need to be rendered. if ( empty( $value ) ) { continue; } $label = ''; switch ( $key ) { case 'provider': $providers = PUM_Newsletter_Providers::instance()->get_providers(); if ( ! empty( $providers[ $value ] ) ) { $label = $providers[ $value ]->name; } break; case 'required': $label = __( 'Consent Required', 'popup-maker' ); break; case 'text': $label = __( 'Consent Text', 'popup-maker' ); break; case 'name': case 'lname': case 'email': case 'fname': case 'list_id': case 'popup_id': case 'email_hash': case 'pum_form_popup_id': case 'mc_args': // Leave these values out. break; } $label = apply_filters( 'pum_privacy_subscriber_value_label', $label, $key, $value ); if ( ! empty( $label ) ) { $data[] = [ 'name' => $label, 'value' => $value, ]; } } break; case 'created': $data[] = [ 'name' => __( 'Date Subscribed', 'popup-maker' ), 'value' => $field_value, ]; break; } } $export_items[] = [ 'group_id' => $group_id, 'group_label' => $group_label, 'item_id' => $item_id, 'data' => $data, ]; } } // Tell core if we have more comments to work on still $done = count( $subscribers ) < $number; return [ 'data' => $export_items, 'done' => $done, ]; } /** * Eraser for Popup Maker Optin Form Subscriber Data. * * @see https://github.com/allendav/wp-privacy-requests/blob/master/EXPORT.md * * @param $email_address * @param int $page * * @return array */ public static function eraser( $email_address, $page = 1 ) { if ( empty( $email_address ) ) { return [ 'items_removed' => false, 'items_retained' => false, 'messages' => [], 'done' => true, ]; } $messages = []; $items_removed = false; $items_retained = false; $number = 500; // Limit us to avoid timing out $page = (int) $page; $subscribers = PUM_DB_Subscribers::instance()->query( [ 's' => $email_address, 'page' => $page, 'limit' => $number, 'orderby' => 'ID', 'order' => 'ASC', ], 'ARRAY_A' ); foreach ( (array) $subscribers as $subscriber ) { if ( $subscriber['email'] === $email_address ) { // Data should not be deleted if the user was left subscribed to a service provider. $unsubscribed = apply_filters( 'pum_privacy_eraser_subscriber_was_unsubscribed', true, $email_address, $subscriber ); if ( $unsubscribed ) { $deleted = PUM_DB_Subscribers::instance()->delete( $subscriber['ID'] ); if ( $deleted ) { $items_removed = true; } else { $items_retained = true; $messages[] = __( 'Subscription information was not removed. A database error may have occurred during deletion.', 'popup-maker' ); } } else { $items_retained = true; $messages[] = __( 'Subscription information was not removed. This may occur when no immediate confirmation is received during our attempt to unsubscribe you from our mailing list.', 'popup-maker' ); } } } // Tell core if we have more comments to work on still $done = count( $subscribers ) < $number; return [ 'items_removed' => $items_removed, 'items_retained' => $items_retained, 'messages' => $messages, 'done' => $done, ]; } /** * @return array */ public static function get_all_cookies() { $cookie_list = get_option( 'pum_privacy_cookie_list' ); $cookies = ! empty( $cookie_list['cookies'] ) ? $cookie_list['cookies'] : []; if ( false === $cookie_list || ! isset( $cookie_list['timestamp'] ) || strtotime( '-7 days' ) > $cookie_list['timestamp'] ) { $popups = pum_get_all_popups(); if ( ! empty( $popups ) ) { foreach ( $popups as $popup ) { if ( ! pum_is_popup( $popup ) ) { continue; } // Set this popup as the global $current. pum()->current_popup = $popup; $popup_cookies = $popup->get_setting( 'cookies', [] ); if ( ! empty( $popup_cookies ) ) { foreach ( $popup_cookies as $cookie ) { if ( ! empty( $cookie['settings']['name'] ) ) { $current_time = 0; if ( ! empty( $cookies[ $cookie['settings']['name'] ] ) ) { $current_time = strtotime( '+' . $cookies[ $cookie['settings']['name'] ]['time'] ); } if ( empty( $cookies[ $cookie['settings']['name'] ] ) ) { $cookies[ $cookie['settings']['name'] ] = [ 'label' => __( 'Cookie used to prevent popup from displaying repeatedly.', 'popup-maker' ), 'name' => $cookie['settings']['name'], 'time' => $cookie['settings']['time'], ]; } $new_time = strtotime( '+' . $cookie['settings']['time'] ); if ( $new_time > $current_time ) { $cookies[ $cookie['settings']['name'] ]['time'] = $cookie['settings']['time']; } } } } } // Clear the global $current. pum()->current_popup = null; } // Update cookie list so we don't have to regenerate it every page load. update_option( 'pum_privacy_cookie_list', [ 'cookies' => $cookies, 'timestamp' => strtotime( 'now' ), ] ); } return apply_filters( 'pum_privacy_get_all_cookies', $cookies ); } }