Server : Apache/2 System : Linux vps.sdns.vn 3.10.0-1160.15.2.el7.x86_64 #1 SMP Wed Feb 3 15:06:38 UTC 2021 x86_64 User : phatdatpq ( 1022) PHP Version : 7.2.34 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/phatdatpq/public_html/wp-content/plugins/nextend-facebook-connect/ |
Upload File : |
<?php class NextendSocialLoginSettings { protected $optionKey; protected $settings = array( 'default' => array(), 'stored' => array(), 'final' => array() ); /** * NextendSocialLoginSettings constructor. * * @param $optionKey string * @param $defaultSettings array */ public function __construct($optionKey, $defaultSettings) { $this->optionKey = $optionKey; $this->settings['default'] = $defaultSettings; $storedSettings = get_option($this->optionKey); if ($storedSettings !== false) { $storedSettings = (array)maybe_unserialize($storedSettings); } else { $storedSettings = array(); } $this->settings['stored'] = array_merge($this->settings['default'], $storedSettings); $this->settings['final'] = apply_filters('nsl_finalize_settings_' . $optionKey, $this->settings['stored']); } public function get($key, $storage = 'final') { return $this->settings[$storage][$key]; } public function getAll($storage = 'final') { return $this->settings[$storage]; } public function update($postedData) { if (is_array($postedData)) { $newData = array(); $newData = apply_filters('nsl_update_settings_validate_' . $this->optionKey, $newData, $postedData); if (count($newData)) { $isChanged = false; foreach ($newData AS $key => $value) { if ($this->settings['stored'][$key] != $value) { $this->settings['stored'][$key] = $value; $isChanged = true; } } if ($isChanged) { $allowedKeys = array_keys($this->settings['default']); $this->settings['stored'] = array_intersect_key($this->settings['stored'], array_flip($allowedKeys)); $this->storeSettings(); } } } } protected function storeSettings() { update_option($this->optionKey, maybe_serialize($this->settings['stored'])); $this->settings['final'] = apply_filters('nsl_finalize_settings_' . $this->optionKey, $this->settings['stored']); } }