| @@ -44,12 +44,12 @@ | ||
| 44 | 44 | */ |
| 45 | 45 | protected $format = 'text'; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @var FrmTableHTMLGenerator|null | |
| 48 | + * @var FrmTableHTMLGenerator | |
| 49 | 49 | * @since 2.04 |
| 50 | 50 | */ |
| 51 | - protected $table_generator; | |
| 51 | + protected $table_generator = null; | |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @var array |
| 55 | 55 | * @since 2.04 |
| @@ -59,9 +59,9 @@ | ||
| 59 | 59 | /** |
| 60 | 60 | * FrmEntryShortcodeFormatter constructor |
| 61 | 61 | * |
| 62 | 62 | * @param int|string $form_id |
| 63 | - * @param array $atts | |
| 63 | + * @param array $atts | |
| 64 | 64 | */ |
| 65 | 65 | public function __construct( $form_id, $atts ) { |
| 66 | 66 | if ( ! $form_id ) { |
| 67 | 67 | return; |
| @@ -86,11 +86,9 @@ | ||
| 86 | 86 | * Initialize the form_id property |
| 87 | 87 | * |
| 88 | 88 | * @since 2.04 |
| 89 | 89 | * |
| 90 | - * @param int|string $form_id | |
| 91 | - * | |
| 92 | - * @return void | |
| 90 | + * @param $form_id | |
| 93 | 91 | */ |
| 94 | 92 | protected function init_form_id( $form_id ) { |
| 95 | 93 | $this->form_id = (int) $form_id; |
| 96 | 94 | } |
| @@ -98,10 +96,8 @@ | ||
| 98 | 96 | /** |
| 99 | 97 | * Initialize the fields property |
| 100 | 98 | * |
| 101 | 99 | * @since 2.04 |
| 102 | - * | |
| 103 | - * @return void | |
| 104 | 100 | */ |
| 105 | 101 | protected function init_fields() { |
| 106 | 102 | $this->fields = FrmField::get_all_for_form( $this->form_id, '', 'exclude', 'exclude' ); |
| 107 | 103 | } |
| @@ -111,10 +107,8 @@ | ||
| 111 | 107 | * |
| 112 | 108 | * @since 2.05 |
| 113 | 109 | * |
| 114 | 110 | * @param array $atts |
| 115 | - * | |
| 116 | - * @return void | |
| 117 | 111 | */ |
| 118 | 112 | protected function init_plain_text( $atts ) { |
| 119 | 113 | if ( isset( $atts['plain_text'] ) && $atts['plain_text'] ) { |
| 120 | 114 | $this->is_plain_text = true; |
| @@ -126,10 +120,8 @@ | ||
| 126 | 120 | * |
| 127 | 121 | * @since 2.04 |
| 128 | 122 | * |
| 129 | 123 | * @param array $atts |
| 130 | - * | |
| 131 | - * @return void | |
| 132 | 124 | */ |
| 133 | 125 | protected function init_format( $atts ) { |
| 134 | 126 | if ( isset( $atts['format'] ) && is_string( $atts['format'] ) && $atts['format'] !== '' ) { |
| 135 | 127 | $this->format = $atts['format']; |
| @@ -141,10 +133,8 @@ | ||
| 141 | 133 | /** |
| 142 | 134 | * Initialize the table_generator property |
| 143 | 135 | * |
| 144 | 136 | * @since 2.04 |
| 145 | - * | |
| 146 | - * @return void | |
| 147 | 137 | */ |
| 148 | 138 | protected function init_table_generator() { |
| 149 | 139 | $this->table_generator = new FrmTableHTMLGenerator( 'shortcode' ); |
| 150 | 140 | } |
| @@ -158,9 +148,9 @@ | ||
| 158 | 148 | if ( ! $this->form_id || empty( $this->fields ) ) { |
| 159 | 149 | return ''; |
| 160 | 150 | } |
| 161 | 151 | |
| 162 | - if ( $this->format === 'array' ) { | |
| 152 | + if ( $this->format == 'array' ) { | |
| 163 | 153 | $content = $this->get_array(); |
| 164 | 154 | } elseif ( $this->is_plain_text_format() ) { |
| 165 | 155 | $content = $this->get_plain_text(); |
| 166 | 156 | } else { |
| @@ -173,10 +163,8 @@ | ||
| 173 | 163 | /** |
| 174 | 164 | * Return the default HTML array |
| 175 | 165 | * |
| 176 | 166 | * @since 2.04 |
| 177 | - * | |
| 178 | - * @return array | |
| 179 | 167 | */ |
| 180 | 168 | protected function get_array() { |
| 181 | 169 | foreach ( $this->fields as $field ) { |
| 182 | 170 | $this->add_field_array( $field ); |
| @@ -188,10 +176,8 @@ | ||
| 188 | 176 | /** |
| 189 | 177 | * Return the default plain text for an email message |
| 190 | 178 | * |
| 191 | 179 | * @since 2.04 |
| 192 | - * | |
| 193 | - * @return string | |
| 194 | 180 | */ |
| 195 | 181 | protected function get_plain_text() { |
| 196 | 182 | return $this->generate_content_for_all_fields(); |
| 197 | 183 | } |
| @@ -199,13 +185,11 @@ | ||
| 199 | 185 | /** |
| 200 | 186 | * Return the default HTML for an email message |
| 201 | 187 | * |
| 202 | 188 | * @since 2.04 |
| 203 | - * | |
| 204 | - * @return string | |
| 205 | 189 | */ |
| 206 | 190 | protected function get_table() { |
| 207 | - $content = $this->table_generator->generate_table_header(); | |
| 191 | + $content = $this->table_generator->generate_table_header(); | |
| 208 | 192 | $content .= $this->generate_content_for_all_fields(); |
| 209 | 193 | $content .= $this->table_generator->generate_table_footer(); |
| 210 | 194 | |
| 211 | 195 | return $content; |
| @@ -252,9 +236,9 @@ | ||
| 252 | 236 | * |
| 253 | 237 | * @since 2.04 |
| 254 | 238 | * |
| 255 | 239 | * @param stdClass $field |
| 256 | - * @param mixed $value | |
| 240 | + * @param mixed $value | |
| 257 | 241 | * |
| 258 | 242 | * @return string |
| 259 | 243 | */ |
| 260 | 244 | protected function generate_two_cell_shortcode_row( $field, $value = null ) { |
| @@ -286,10 +270,8 @@ | ||
| 286 | 270 | * |
| 287 | 271 | * @since 2.04 |
| 288 | 272 | * |
| 289 | 273 | * @param stdClass $field |
| 290 | - * | |
| 291 | - * @return void | |
| 292 | 274 | */ |
| 293 | 275 | protected function add_field_array( $field ) { |
| 294 | 276 | if ( in_array( $field->type, $this->skip_fields ) ) { |
| 295 | 277 | return; |
| @@ -303,11 +285,9 @@ | ||
| 303 | 285 | * |
| 304 | 286 | * @since 2.04 |
| 305 | 287 | * |
| 306 | 288 | * @param stdClass $field |
| 307 | - * @param string $value | |
| 308 | - * | |
| 309 | - * @return void | |
| 289 | + * @param string $value | |
| 310 | 290 | */ |
| 311 | 291 | protected function add_single_field_array( $field, $value ) { |
| 312 | 292 | $array = array( |
| 313 | 293 | 'label' => '[' . $field->id . ' show=field_label]', |