Server IP : 104.21.38.3 / Your IP : 172.69.166.65 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/shortcode/ |
Upload File : |
<?php /** * Sets the defaults specified by a shortcode, unique for each shortcode usage * * Solves problem where two shortcodes of same form have different defaults field sets, see: https://github.com/CalderaWP/Caldera-Forms/issues/1499 * * @package Caldera_Forms * @author Josh Pollock <[email protected]> * @license GPL-2.0+ * @link * @copyright 2017 CalderaWP LLC */ class Caldera_Forms_Shortcode_Defaults { /** * Form ID this object acts on * * @since 1.5.0.9 * * @var string */ protected $form_id; /** * Defaults to add to fields * * @since 1.5.0.9 * * @var array */ protected $defaults; /** * Caldera_Forms_Shortcode_Defaults constructor. * * @since 1.5.0.9 * * @param string $form_id ID of form * @param array $defaults Defaults */ public function __construct( $form_id, $defaults ){ $this->form_id = $form_id; $this->defaults = $defaults; } /** * Add the filter * * @since 1.5.0.9 */ public function add_hooks(){ add_filter( 'caldera_forms_render_get_field', array( $this, 'set_default' ), 19, 2 ); } /** * Remove the filter * * @since 1.5.0.9 */ public function remove_hooks(){ remove_filter( 'caldera_forms_render_get_field', array( $this, 'set_default' ), 19 ); } /** * Set field default * * @since 1.5.0.9 * * @uses "caldera_forms_render_get_field" filter * * @param array $field Field config * @param array $form Form config * * @return array */ public function set_default( $field, $form ){ if( array_key_exists( $field[ 'ID' ], $this->defaults ) && $form[ 'ID' ] == $this->form_id ){ $field[ 'config' ][ 'default' ] = $this->defaults[ $field[ 'ID' ] ]; } return $field; } }