PluginProbe
Contact Forms by Cimatti / 1.9.2
Contact Forms by Cimatti v1.9.2
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
← All changes | PFBC/Form.php +1 -30 2.3.51.9.2 View file →
@@ -1,13 +1,5 @@
1 1 <?php
2 -/**
3 - * PFBC (PHP Form Builder Class) - Third-party library
4 - * @package PFBC
5 - */
6 -if ( ! defined( 'ABSPATH' ) ) exit;
7 -
8 -// phpcs:disable WordPress.Security.EscapeOutput, WordPress.NamingConventions.PrefixAllGlobals, PluginCheck.CodeAnalysis.Heredoc, WordPress.Security.NonceVerification, WordPress.Security.ValidatedSanitizedInput, WordPress.WP.AlternativeFunctions, WordPress.WP.EnqueuedResources -- Third-party library
9 -
10 2 /*This project's namespace structure is leveraged to autoload requested classes at runtime.*/
11 3 function PFBC_Load($class) {
12 4 $file = dirname(__FILE__) . "/" . str_replace("_", DIRECTORY_SEPARATOR, $class) . ".php";
13 5 if(is_file($file))
@@ -98,25 +90,8 @@
98 90 $element->setValue($this->values[substr($name, 0, -2)]);
99 91 }
100 92 }
101 93
102 - /*Errors from session are applied to elements for accessibility (ARIA attributes).
103 - This ensures elements have errors set before rendering, enabling proper aria-invalid and aria-describedby attributes.*/
104 - protected function applyErrors() {
105 - $errors = $this->getErrors();
106 - if(!empty($errors)) {
107 - foreach($this->elements as $element) {
108 - $name = $element->getName();
109 - if(substr($name, -2) == "[]")
110 - $name = substr($name, 0, -2);
111 -
112 - if(isset($errors[$name]) && is_array($errors[$name])) {
113 - $element->setErrors($errors[$name]);
114 - }
115 - }
116 - }
117 - }
118 -
119 94 public static function clearErrors($id = "pfbc") {
120 95 if(!empty($_SESSION["pfbc"][$id]["errors"]))
121 96 unset($_SESSION["pfbc"][$id]["errors"]);
122 97 }
@@ -178,11 +153,10 @@
178 153 $errors[""] = array("Error: The pfbc project requires an active session to function properly. Simply add session_start() to your script before any output has been sent to the browser.");
179 154 else {
180 155 $errors = array();
181 156 $id = $this->attributes["id"];
182 - if(!empty($_SESSION["pfbc"][$id]["errors"])) {
157 + if(!empty($_SESSION["pfbc"][$id]["errors"]))
183 158 $errors = $_SESSION["pfbc"][$id]["errors"];
184 - }
185 159 }
186 160
187 161 return $errors;
188 162 }
@@ -282,11 +256,8 @@
282 256 $values = self::getSessionValues($this->attributes["id"]);
283 257 if(!empty($values))
284 258 $this->setValues($values);
285 259 $this->applyValues();
286 -
287 - /*Apply validation errors to elements for accessibility (ARIA attributes)*/
288 - $this->applyErrors();
289 260
290 261 $this->formatWidthProperties();
291 262
292 263 if($returnHTML)