本文整理匯總了PHP中FrmField::get_option方法的典型用法代碼示例。如果您正苦於以下問題:PHP FrmField::get_option方法的具體用法?PHP FrmField::get_option怎麽用?PHP FrmField::get_option使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FrmField
的用法示例。
在下文中一共展示了FrmField::get_option方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_error_msg
/**
* @since 2.0
*/
public static function get_error_msg($field, $error)
{
$frm_settings = FrmAppHelper::get_settings();
$default_settings = $frm_settings->default_options();
$field_name = is_array($field) ? $field['name'] : $field->name;
$defaults = array('unique_msg' => array('full' => $default_settings['unique_msg'], 'part' => sprintf(__('%s must be unique', 'formidable'), $field_name)), 'invalid' => array('full' => __('This field is invalid', 'formidable'), 'part' => sprintf(__('%s is invalid', 'formidable'), $field_name)), 'blank' => array('full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg));
$msg = FrmField::get_option($field, $error);
$msg = $msg == $defaults[$error]['full'] || empty($msg) ? $defaults[$error]['part'] : $msg;
return $msg;
}
示例2: phone_format
public static function phone_format($field)
{
$default_format = '^((\\+\\d{1,3}(-|.| )?\\(?\\d\\)?(-| |.)?\\d{1,5})|(\\(?\\d{2,6}\\)?))(-|.| )?(\\d{3,4})(-|.| )?(\\d{4})(( x| ext)\\d{1,5}){0,1}$';
if (FrmField::is_option_empty($field, 'format')) {
$pattern = $default_format;
} else {
$pattern = FrmField::get_option($field, 'format');
}
$pattern = apply_filters('frm_phone_pattern', $pattern, $field);
// Create a regexp if format is not already a regexp
if (strpos($pattern, '^') !== 0) {
$pattern = self::create_regular_expression_from_format($pattern);
}
$pattern = '/' . $pattern . '/';
return $pattern;
}
示例3: phone_format
public static function phone_format($field)
{
$default_format = '^((\\+\\d{1,3}(-|.| )?\\(?\\d\\)?(-| |.)?\\d{1,5})|(\\(?\\d{2,6}\\)?))(-|.| )?(\\d{3,4})(-|.| )?(\\d{4})(( x| ext)\\d{1,5}){0,1}$';
if (FrmField::is_option_empty($field, 'format')) {
$pattern = $default_format;
} else {
$pattern = FrmField::get_option($field, 'format');
}
$pattern = apply_filters('frm_phone_pattern', $pattern, $field);
//check if format is already a regular expression
if (strpos($pattern, '^') !== 0) {
//if not, create a regular expression
$pattern = preg_replace('/\\d/', '\\d', preg_quote($pattern));
$pattern = str_replace('a', '[a-z]', $pattern);
$pattern = str_replace('A', '[A-Z]', $pattern);
$pattern = str_replace('*', 'w', $pattern);
$pattern = str_replace('/', '\\/', $pattern);
if (strpos($pattern, '\\?') !== false) {
$parts = explode('\\?', $pattern);
$pattern = '';
foreach ($parts as $part) {
if (empty($pattern)) {
$pattern .= $part;
} else {
$pattern .= '(' . $part . ')?';
}
}
}
$pattern = '^' . $pattern . '$';
}
$pattern = '/' . $pattern . '/';
return $pattern;
}