PluginProbe
HTML Forms – Simple WordPress Forms Plugin / 1.3.30
HTML Forms – Simple WordPress Forms Plugin v1.3.30
1.7.0 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 All 67 releases
← All changes | src/class-form.php +10 -2 1.3.161.3.30 View file →
@@ -129,9 +129,13 @@
129 129 /**
130 130 * @return string
131 131 */
132 132 public function get_markup() {
133 - return apply_filters( 'hf_form_markup', $this->markup );
133 + /**
134 + * @param string $markup
135 + * @param Form $form
136 + */
137 + return apply_filters( 'hf_form_markup', $this->markup, $this );
134 138 }
135 139
136 140 /**
137 141 * @return array
@@ -174,11 +178,15 @@
174 178 }
175 179
176 180 /**
177 181 * @return int The number of named fields in the form
182 + *
183 + * Note: this includes all default fields and an additional field for the "was-required" element we include in every request.
178 184 */
179 185 public function get_field_count() {
180 - $count = substr_count( strtolower( $this->get_html() ), ' name=' );
186 + $pattern = '/\bname\s*=\s*["\']/i';
187 + preg_match_all( $pattern, $this->get_html(), $matches );
188 + $count = ! empty( $matches ) ? count( $matches[0] ) : 0;
181 189 $count++; // Add one for 'was-required'
182 190 return $count;
183 191 }
184 192 }