Server IP : 192.158.238.246 / Your IP : 3.133.142.101 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/cwd/plugins/give/src/Email/ |
Upload File : |
<?php namespace Give\Email; use Give_Admin_Settings; /** * @since 2.17.1 */ class GlobalSettingValidator { /** * @since 2.17.1 */ public function __invoke() { // Bailout. if ( ! Give_Admin_Settings::is_saving_settings() || 'emails' !== give_get_current_setting_tab() || ! isset($_GET['section']) ) { return; } add_filter($this->getFilterHookName(), [$this, 'validateSetting']); } /** * @since 2.17.1 * @since 2.17.2 Only filter value as unique array if set. Some settings do not need to be set, ie donation-receipt_recipient. */ public function validateSetting($value) { if( ! empty( $value ) ) { // Same unique email address for email recipients. $recipientEmails = array_unique(array_filter($value)); // Set default email recipient to admin email. $value = $recipientEmails ?: [get_bloginfo('admin_email')]; } return $value; } /** * @since 2.17.1 * Note: Filter hook defined in Give_Admin_Settings::save_fields function::1163 * * @return string */ private function getFilterHookName() { $email_type = give_get_current_setting_section(); $settingName = "{$email_type}_recipient"; return "give_admin_settings_sanitize_option_$settingName"; } }