Server IP : 104.21.38.3 / Your IP : 162.158.189.224 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/coircraft.com/wp-content/plugins/caldera-forms/classes/cdn/ |
Upload File : |
<?php /** * Settings for CDNs * * @package Caldera_Forms * @author Josh Pollock <[email protected]> * @license GPL-2.0+ * @link * @copyright 2017 CalderaWP LLC */ class Caldera_Forms_CDN_Settings extends Caldera_Forms_Settings_Option { /** * Get the defaults * * @since 1.5.3 * * @var array */ protected $defaults = array( 'cdn' => false, 'combine' => false, ); /** * Get allowed CDNs * * @since 1.5.3 * * @var array */ protected $cdns = array( 'jsdelivr' ); /** * @inheritdoc * @since 1.5.3 */ public function get_name(){ return 'cdn'; } /** * @inheritdoc * @since 1.5.3 */ public function get_option_key(){ return '_caldera_forms_cdn_settings'; } /** * Reverse CDN enabled state * * Enables if disabled, Disables if enabled * * @since 1.5.3 * * @return array */ public function toggle_cdn_enable(){ if( $this->enabled() ){ return $this->disable(); } return $this->enable(); } /** * Check if CDN is enable * * @since 1.5.3 * * @return bool */ public function enabled(){ $settings = $this->get_settings(); if( $settings[ 'cdn' ] ){ return true; } return false; } /** * Is combine mode enabled? * * @since 1.5.3 * * @return bool */ public function combine(){ $settings = $this->get_settings(); return $settings[ 'combine' ]; } /** * Enable CDN * * @since 1.5.3 * * @return array */ public function enable(){ $settings = $this->get_settings(); $settings[ 'cdn' ] = $this->cdns[0]; return $this->save_settings( $settings ); } /** * Disable CDN * * @since 1.5.3 * * @return array */ public function disable(){ $settings = $this->get_settings(); $settings[ 'cdn' ] = false; return $this->save_settings( $settings ); } /** * @inheritdoc * @since 1.5.3 */ protected function prepare( array $settings ){ foreach ( $settings as $key => $value ){ if( ! array_key_exists( $key, $this->defaults ) ){ unset( $settings[ $key ] ); continue; } if( 'cdn' === $key && false != $value ){ if ( ! in_array( $value, $this->cdns ) ) { $settings[ $key ] = $this->defaults[ 'cdn' ]; } } } return wp_parse_args( $settings, $this->defaults ); } /** * @inheritdoc * @since 1.5.3 */ protected function get_defaults(){ return $this->defaults; } }