WPCF7_ContactForm::additional_setting()
Returns additional setting values searched by name.
Метод класса: WPCF7_ContactForm{}
Хуков нет.
Возвращает
Массив
. Additional setting values.
Использование
$WPCF7_ContactForm = new WPCF7_ContactForm(); $WPCF7_ContactForm->additional_setting( $name, $max );
- $name(строка) (обязательный)
- Name of setting.
- $max(int)
- Maximum result item count.
По умолчанию: 1
Код WPCF7_ContactForm::additional_setting() WPCF7 ContactForm::additional setting CF7 5.9.8
public function additional_setting( $name, $max = 1 ) { $settings = (array) explode( "\n", $this->prop( 'additional_settings' ) ); $pattern = '/^([a-zA-Z0-9_]+)[\t ]*:(.*)$/'; $count = 0; $values = array(); foreach ( $settings as $setting ) { if ( preg_match( $pattern, $setting, $matches ) ) { if ( $matches[1] != $name ) { continue; } if ( ! $max or $count < (int) $max ) { $values[] = trim( $matches[2] ); $count += 1; } } } return $values; }