本文整理汇总了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;
}