gravityview /
GravityView
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @file class-gravityview-field-email.php |
||
| 4 | * @package GravityView |
||
| 5 | * @subpackage includes\fields |
||
| 6 | */ |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Add custom options for email fields |
||
| 10 | */ |
||
| 11 | class GravityView_Field_Email extends GravityView_Field { |
||
| 12 | |||
| 13 | var $name = 'email'; |
||
|
0 ignored issues
–
show
|
|||
| 14 | |||
| 15 | var $is_searchable = true; |
||
| 16 | |||
| 17 | var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' ); |
||
| 18 | |||
| 19 | var $_gf_field_class_name = 'GF_Field_Email'; |
||
| 20 | |||
| 21 | var $group = 'advanced'; |
||
| 22 | |||
| 23 | public function __construct() { |
||
| 24 | $this->label = esc_html__( 'Email', 'gravityview' ); |
||
| 25 | parent::__construct(); |
||
| 26 | } |
||
| 27 | |||
| 28 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
||
| 29 | |||
| 30 | // It makes no sense to use this as the link. |
||
| 31 | unset( $field_options['show_as_link'] ); |
||
| 32 | |||
| 33 | if( 'edit' === $context ) { |
||
| 34 | return $field_options; |
||
| 35 | } |
||
| 36 | |||
| 37 | $email_options = array( |
||
| 38 | 'emailmailto' => array( |
||
| 39 | 'type' => 'checkbox', |
||
| 40 | 'value' => true, |
||
| 41 | 'label' => __( 'Link the Email Address', 'gravityview' ), |
||
| 42 | 'desc' => __( 'Clicking the link will generate a new email.', 'gravityview' ), |
||
| 43 | ), |
||
| 44 | 'emailsubject' => array( |
||
| 45 | 'type' => 'text', |
||
| 46 | 'label' => __( 'Email Subject', 'gravityview' ), |
||
| 47 | 'value' => '', |
||
| 48 | 'desc' => __( 'Set the default email subject line.', 'gravityview' ), |
||
| 49 | 'merge_tags' => 'force', |
||
| 50 | ), |
||
| 51 | 'emailbody' => array( |
||
| 52 | 'type' => 'textarea', |
||
| 53 | 'label' => __( 'Email Body', 'gravityview' ), |
||
| 54 | 'value' => '', |
||
| 55 | 'desc' => __( 'Set the default email content.', 'gravityview' ), |
||
| 56 | 'merge_tags' => 'force', |
||
| 57 | 'class' => 'widefat', |
||
| 58 | ), |
||
| 59 | 'emailencrypt' => array( |
||
| 60 | 'type' => 'checkbox', |
||
| 61 | 'value' => true, |
||
| 62 | 'label' => __( 'Encrypt Email Address', 'gravityview' ), |
||
| 63 | 'desc' => __( 'Make it harder for spammers to get email addresses from your entries. Email addresses will not be visible with Javascript disabled.', 'gravityview' ) |
||
| 64 | ) |
||
| 65 | ); |
||
| 66 | |||
| 67 | return $email_options + $field_options; |
||
| 68 | } |
||
| 69 | |||
| 70 | } |
||
| 71 | |||
| 72 | new GravityView_Field_Email; |
||
| 73 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.