| Conditions | 1 |
| Paths | 1 |
| Total Lines | 47 |
| Code Lines | 36 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
||
| 95 | protected function __construct( $timezone = null ) { |
||
| 96 | $this->singular_item = __('Message','event_espresso'); |
||
| 97 | $this->plural_item = __('Messages','event_espresso'); |
||
| 98 | |||
| 99 | //used for token generator |
||
| 100 | EE_Registry::instance()->load_helper( 'URL' ); |
||
| 101 | |||
| 102 | $this->_tables = array( |
||
| 103 | 'Message'=>new EE_Primary_Table('esp_message','MSG_ID') |
||
| 104 | ); |
||
| 105 | |||
| 106 | $allowed_priority = array( |
||
| 107 | self::priority_high => __( 'high', 'event_espresso' ), |
||
| 108 | self::priority_medium => __( 'medium', 'event_espresso' ), |
||
| 109 | self::priority_low => __( 'low', 'event_espresso' ) |
||
| 110 | ); |
||
| 111 | |||
| 112 | $this->_fields = array( |
||
| 113 | 'Message'=>array( |
||
| 114 | 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID','event_espresso')), |
||
| 115 | 'MSG_token' => new EE_Plain_Text_Field( 'MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso' ), false, EEH_URL::generate_unique_token() ), |
||
|
1 ignored issue
–
show
|
|||
| 116 | 'GRP_ID'=>new EE_Foreign_Key_Int_Field( 'GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso' ), true, 0, 'Message_Template_Group' ), |
||
| 117 | 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( 'Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso' ), true, 0, 'Transaction' ), |
||
| 118 | 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __( 'Corresponds to the EE_Messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso' ), false, 'email' ), |
||
|
1 ignored issue
–
show
|
|||
| 119 | 'MSG_message_type' => new EE_Plain_Text_Field( 'MSG_message_type', __( 'Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso' ), false, 'receipt' ), |
||
|
1 ignored issue
–
show
|
|||
| 120 | 'MSG_context' => new EE_Plain_Text_Field( 'MSG_context', __( 'Context', 'event_espresso' ), false ), |
||
| 121 | 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field( 'MSG_recipient_ID', __( 'Recipient ID', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
||
| 122 | 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field( 'MSG_recipient_type', __( 'Recipient Type', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
||
| 123 | 'MSG_content' => new EE_Maybe_Serialized_Text_Field( 'MSG_content', __( 'Content', 'event_espresso' ), true, '' ), |
||
|
1 ignored issue
–
show
|
|||
| 124 | 'MSG_to' => new EE_Maybe_Serialized_Text_Field( 'MSG_to', __( 'Address To', 'event_espresso' ), true ), |
||
| 125 | 'MSG_from' => new EE_Maybe_Serialized_Text_Field( 'MSG_from', __( 'Address From', 'event_espresso' ), true ), |
||
| 126 | 'MSG_subject' => new EE_Maybe_Serialized_Text_Field( 'MSG_subject', __( 'Subject', 'event_espresso' ), true, '' ), |
||
|
1 ignored issue
–
show
|
|||
| 127 | 'MSG_priority' => new EE_Enum_Integer_Field( 'MSG_priority', __( 'Priority', 'event_espresso' ), false, self::priority_low, $allowed_priority ), |
||
| 128 | 'STS_ID' => new EE_Foreign_Key_String_Field( 'STS_ID', __( 'Status', 'event_espresso' ), false, self::status_incomplete, 'Status' ), |
||
| 129 | 'MSG_created' => new EE_Datetime_Field( 'MSG_created', __( 'Created', 'event_espresso' ), false, time() ), |
||
| 130 | 'MSG_modified' => new EE_Datetime_Field( 'MSG_modified', __( 'Modified', 'event_espresso' ), true, time() ) |
||
| 131 | ) |
||
| 132 | ); |
||
| 133 | $this->_model_relations = array( |
||
| 134 | 'Attendee' => new EE_Belongs_To_Any_Relation(), |
||
| 135 | 'Registration' => new EE_Belongs_To_Any_Relation(), |
||
| 136 | 'WP_User' => new EE_Belongs_To_Any_Relation(), |
||
| 137 | 'Message_Template_Group' => new EE_Belongs_To_Relation(), |
||
| 138 | 'Transaction' => new EE_Belongs_To_Relation() |
||
| 139 | ); |
||
| 140 | parent::__construct( $timezone ); |
||
| 141 | } |
||
| 142 | |||
| 306 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.