admin
3 months ago
emails
4 months ago
fields
4 months ago
functions
3 months ago
providers
10 months ago
templates
4 months ago
class-db.php
1 year ago
class-fields.php
1 year ago
class-form.php
4 months ago
class-install.php
1 year ago
class-process.php
4 months ago
class-providers.php
1 year ago
class-templates.php
2 years ago
class-widget.php
1 year ago
deprecated.php
8 months ago
functions-list.php
3 years ago
functions.php
11 months ago
integrations.php
4 months ago
deprecated.php
426 lines
| 1 | <?php |
| 2 | |
| 3 | // phpcs:ignoreFile Generic.Files.OneObjectStructurePerFile.MultipleFound |
| 4 | |
| 5 | namespace WPForms { |
| 6 | /** |
| 7 | * The removed class helps prevent fatal errors for clients |
| 8 | * that use some of the classes we are about to remove. |
| 9 | * Use the class extending instead of class_alias function. |
| 10 | * |
| 11 | * @since 1.8.0 |
| 12 | */ |
| 13 | class Removed { |
| 14 | |
| 15 | /** |
| 16 | * List of removed classes in the next format: |
| 17 | * Fully Qualified Class Name => version. |
| 18 | * |
| 19 | * @since 1.8.0 |
| 20 | */ |
| 21 | const CLASSES = [ |
| 22 | 'WPForms\Pro\Admin\Entries\DefaultScreen' => '1.8.2', |
| 23 | 'WPForms\Pro\Integrations\AI\AI' => '1.9.4', |
| 24 | 'WPForms\Pro\Integrations\AI\Helpers' => '1.9.4', |
| 25 | 'WPForms_Install_Skin' => '1.9.5', |
| 26 | 'WPForms_Install_Silent_Skin' => '1.5.6.1', |
| 27 | 'WPForms\Helpers\PluginSilentUpgraderSkin' => '1.9.5', |
| 28 | ]; |
| 29 | |
| 30 | /** |
| 31 | * Inform clients that the class is removed. |
| 32 | * |
| 33 | * @since 1.8.0 |
| 34 | */ |
| 35 | public function __construct() { |
| 36 | |
| 37 | self::trigger_error(); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Inform clients that the class is removed. |
| 42 | * |
| 43 | * @since 1.8.0 |
| 44 | * |
| 45 | * @param string $name Property name. |
| 46 | */ |
| 47 | public function __get( $name ) { |
| 48 | |
| 49 | self::trigger_error( $name ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Inform clients that the class is removed. |
| 54 | * |
| 55 | * @since 1.8.0 |
| 56 | * |
| 57 | * @param string $name Property name. |
| 58 | * @param mixed $value Property value. |
| 59 | */ |
| 60 | public function __set( $name, $value ) { |
| 61 | |
| 62 | self::trigger_error( $name ); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Inform clients that the class is removed. |
| 67 | * |
| 68 | * @since 1.8.0 |
| 69 | * |
| 70 | * @param string $name Property name. |
| 71 | */ |
| 72 | public function __isset( $name ) { |
| 73 | |
| 74 | self::trigger_error( $name ); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Inform clients that the class is removed. |
| 79 | * |
| 80 | * @since 1.8.0 |
| 81 | * |
| 82 | * @param string $name Method name. |
| 83 | * @param array $arguments List of arguments. |
| 84 | */ |
| 85 | public function __call( $name, $arguments ) { |
| 86 | |
| 87 | self::trigger_error( $name ); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Inform clients that the class is removed. |
| 92 | * |
| 93 | * @since 1.8.0 |
| 94 | * |
| 95 | * @param string $name Method name. |
| 96 | * @param array $arguments List of arguments. |
| 97 | */ |
| 98 | public static function __callStatic( $name, $arguments ) { |
| 99 | |
| 100 | self::trigger_error( $name ); |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Inform clients that the class is removed. |
| 105 | * |
| 106 | * @since 1.8.0 |
| 107 | * |
| 108 | * @param string $element_name Property or method name. |
| 109 | */ |
| 110 | private static function trigger_error( $element_name = '' ) { |
| 111 | |
| 112 | $current_class = static::class; |
| 113 | $removed_element = $current_class; |
| 114 | |
| 115 | if ( $element_name ) { |
| 116 | $removed_element .= '::' . $element_name; |
| 117 | } |
| 118 | |
| 119 | $version = ! empty( self::CLASSES[ $current_class ] ) ? self::CLASSES[ $current_class ] : WPFORMS_VERSION; |
| 120 | |
| 121 | trigger_error( |
| 122 | sprintf( |
| 123 | '%1$s has been removed in %2$s of the WPForms plugin', |
| 124 | esc_html( $removed_element ), |
| 125 | esc_html( $version ) |
| 126 | ), |
| 127 | E_USER_WARNING |
| 128 | ); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | namespace WPForms\Forms { |
| 134 | |
| 135 | use WPForms\Removed; |
| 136 | |
| 137 | class Loader extends Removed {} |
| 138 | } |
| 139 | |
| 140 | namespace { |
| 141 | /** |
| 142 | * Legacy `WPForms_Addons` class was refactored and moved to the new `WPForms\Pro\Admin\Pages\Addons` class. |
| 143 | * This alias is a safeguard to those developers who use our internal class WPForms_Addons, |
| 144 | * which we deleted. |
| 145 | * |
| 146 | * @since 1.6.7 |
| 147 | */ |
| 148 | class_alias( wpforms()->is_pro() ? 'WPForms\Pro\Admin\Pages\Addons' : 'WPForms\Lite\Admin\Pages\Addons', 'WPForms_Addons' ); |
| 149 | |
| 150 | /** |
| 151 | * This alias is a safeguard to those developers who decided to use our internal class WPForms_Smart_Tags, |
| 152 | * which we deleted. |
| 153 | * |
| 154 | * @since 1.6.7 |
| 155 | */ |
| 156 | class_alias( wpforms()->is_pro() ? 'WPForms\Pro\SmartTags\SmartTags' : 'WPForms\SmartTags\SmartTags', 'WPForms_Smart_Tags' ); |
| 157 | |
| 158 | /** |
| 159 | * This alias is a safeguard to those developers who decided to use our internal class \WPForms\Providers\Loader, |
| 160 | * which we deleted. |
| 161 | * |
| 162 | * @since 1.7.3 |
| 163 | */ |
| 164 | class_alias( '\WPForms\Providers\Providers', '\WPForms\Providers\Loader' ); |
| 165 | |
| 166 | /** |
| 167 | * Legacy `\WPForms\Admin\Notifications` class was refactored and moved to the new `\WPForms\Admin\Notifications\Notifications` class. |
| 168 | * This alias is a safeguard to those developers who use our internal class \WPForms\Admin\Notifications, |
| 169 | * which we deleted. |
| 170 | * |
| 171 | * @since 1.7.5 |
| 172 | */ |
| 173 | class_alias( '\WPForms\Admin\Notifications\Notifications', '\WPForms\Admin\Notifications' ); |
| 174 | |
| 175 | /** |
| 176 | * Legacy `\WPForms_Field_Payment_Checkbox` class was refactored and moved to the new `\WPForms\Forms\Fields\PaymentCheckbox\Field` class. |
| 177 | * This alias is a safeguard to those developers who use our internal class \WPForms_Field_Payment_Checkbox, |
| 178 | * which we deleted. |
| 179 | * |
| 180 | * @since 1.8.2 |
| 181 | */ |
| 182 | class_alias( '\WPForms\Forms\Fields\PaymentCheckbox\Field', '\WPForms_Field_Payment_Checkbox' ); |
| 183 | |
| 184 | /** |
| 185 | * Legacy `\WPForms_Field_Payment_Multiple` class was refactored and moved to the new `\WPForms\Forms\Fields\PaymentMultiple\Field` class. |
| 186 | * This alias is a safeguard to those developers who use our internal class \WPForms_Field_Payment_Multiple, |
| 187 | * which we deleted. |
| 188 | * |
| 189 | * @since 1.8.2 |
| 190 | */ |
| 191 | class_alias( '\WPForms\Forms\Fields\PaymentMultiple\Field', '\WPForms_Field_Payment_Multiple' ); |
| 192 | |
| 193 | /** |
| 194 | * Legacy `\WPForms_Field_Payment_Single` class was refactored and moved to the new `\WPForms\Forms\Fields\PaymentSingle\Field` class. |
| 195 | * This alias is a safeguard to those developers who use our internal class \WPForms_Field_Payment_Single, |
| 196 | * which we deleted. |
| 197 | * |
| 198 | * @since 1.8.2 |
| 199 | */ |
| 200 | class_alias( '\WPForms\Forms\Fields\PaymentSingle\Field', '\WPForms_Field_Payment_Single' ); |
| 201 | |
| 202 | /** |
| 203 | * Legacy `\WPForms_Field_Payment_Total` class was refactored and moved to the new `\WPForms\Forms\Fields\PaymentTotal\Field` class. |
| 204 | * This alias is a safeguard to those developers who use our internal class \WPForms_Field_Payment_Total, |
| 205 | * which we deleted. |
| 206 | * |
| 207 | * @since 1.8.2 |
| 208 | */ |
| 209 | class_alias( '\WPForms\Forms\Fields\PaymentTotal\Field', '\WPForms_Field_Payment_Total' ); |
| 210 | |
| 211 | /** |
| 212 | * Legacy `\WPForms_Field_Payment_Select` class was refactored and moved to the new `\WPForms\Forms\Fields\PaymentSelect\Field` class. |
| 213 | * This alias is a safeguard to those developers who use our internal class \WPForms_Field_Payment_Select, |
| 214 | * which we deleted. |
| 215 | * |
| 216 | * @since 1.8.2 |
| 217 | */ |
| 218 | class_alias( '\WPForms\Forms\Fields\PaymentSelect\Field', '\WPForms_Field_Payment_Select' ); |
| 219 | |
| 220 | /** |
| 221 | * Legacy `\WPForms\Migrations` class was refactored and moved to the new `\WPForms\Migrations\Migrations` class. |
| 222 | * This alias is a safeguard to those developers who use our internal class \WPForms\Migrations, which we deleted. |
| 223 | * |
| 224 | * @since 1.7.5 |
| 225 | */ |
| 226 | class_alias( '\WPForms\Migrations\Migrations', '\WPForms\Migrations' ); |
| 227 | |
| 228 | /** |
| 229 | * Legacy `\WPForms_Frontend` class was refactored and moved to the new `\WPForms\Frontend\Frontend` class. |
| 230 | * This alias is a safeguard to those developers who use our internal class \WPForms_Frontend, which we deleted. |
| 231 | * |
| 232 | * @since 1.8.1 |
| 233 | */ |
| 234 | class_alias( '\WPForms\Frontend\Frontend', '\WPForms_Frontend' ); |
| 235 | |
| 236 | /** |
| 237 | * This alias is a safeguard to those developers who use our internal class \WPForms_Overview, which we deleted. |
| 238 | * |
| 239 | * @since 1.8.6 |
| 240 | */ |
| 241 | class_alias( '\WPForms\Admin\Forms\Page', '\WPForms_Overview' ); |
| 242 | |
| 243 | /** |
| 244 | * This alias is a safeguard to those developers who use our internal class \WPForms_Overview_Table, which we deleted. |
| 245 | * |
| 246 | * @since 1.8.6 |
| 247 | */ |
| 248 | class_alias( '\WPForms\Admin\Forms\ListTable', '\WPForms_Overview_Table' ); |
| 249 | |
| 250 | /** |
| 251 | * This alias is a safeguard to those developers who use our internal |
| 252 | * class \WPForms\Emails\FetchInfoBlocksTask, which we deleted. |
| 253 | * |
| 254 | * @since 1.9.8 |
| 255 | */ |
| 256 | class_alias( '\WPForms\Emails\Tasks\FetchInfoBlocksTask', '\WPForms\Emails\FetchInfoBlocksTask' ); |
| 257 | |
| 258 | // Pro specific aliases. |
| 259 | if ( wpforms()->is_pro() ) { |
| 260 | /** |
| 261 | * Legacy `\WPForms\Pro\Migrations` class was refactored and moved to the new `\WPForms\Pro\Migrations\Migrations` class. |
| 262 | * This alias is a safeguard to those developers who use our internal class \WPForms\Migrations, which we deleted. |
| 263 | * |
| 264 | * @since 1.7.5 |
| 265 | */ |
| 266 | class_alias( '\WPForms\Pro\Migrations\Migrations', '\WPForms\Pro\Migrations' ); |
| 267 | |
| 268 | /** |
| 269 | * Legacy `\WPForms\Pro\Integrations\TranslationsPress\Translations` class was refactored and moved to the new |
| 270 | * `\WPForms\Pro\Integrations\Translations\Translations` class. |
| 271 | * This alias is a safeguard to those developers who use our internal class \WPForms\Pro\Integrations\TranslationsPress, which we deleted. |
| 272 | * |
| 273 | * @since 1.8.2.2 |
| 274 | */ |
| 275 | class_alias( '\WPForms\Pro\Integrations\Translations\Translations', '\WPForms\Pro\Integrations\TranslationsPress\Translations' ); |
| 276 | |
| 277 | /** |
| 278 | * This alias is a safeguard to those developers who use our internal class \WPForms_Entries_List, which we deleted. |
| 279 | * |
| 280 | * @since 1.8.6 |
| 281 | */ |
| 282 | class_alias( '\WPForms\Pro\Admin\Entries\Page', '\WPForms_Entries_List' ); |
| 283 | |
| 284 | /** |
| 285 | * This alias is a safeguard to those developers who use our internal class \WPForms_Entries_Table, which we deleted. |
| 286 | * |
| 287 | * @since 1.8.6 |
| 288 | */ |
| 289 | class_alias( '\WPForms\Pro\Admin\Entries\ListTable', '\WPForms_Entries_Table' ); |
| 290 | |
| 291 | /** |
| 292 | * This alias is a safeguard to those developers who use our internal class \WPForms_Field_Layout, which we deleted. |
| 293 | * |
| 294 | * @since 1.8.9 |
| 295 | */ |
| 296 | class_alias( '\WPForms\Pro\Forms\Fields\Layout\Field', '\WPForms_Field_Layout' ); |
| 297 | |
| 298 | /** |
| 299 | * These aliases are a safeguard to those developers who use our internal legacy field classes, which we deleted. |
| 300 | * |
| 301 | * @since 1.9.4 |
| 302 | */ |
| 303 | class_alias( '\WPForms\Pro\Forms\Fields\Address\Field', '\WPForms_Field_Address' ); |
| 304 | class_alias( '\WPForms\Pro\Forms\Fields\Content\Field', '\WPForms_Field_Content' ); |
| 305 | class_alias( '\WPForms\Pro\Forms\Fields\DateTime\Field', '\WPForms_Field_Date_Time' ); |
| 306 | class_alias( '\WPForms\Pro\Forms\Fields\Divider\Field', '\WPForms_Field_Divider' ); |
| 307 | class_alias( '\WPForms\Pro\Forms\Fields\EntryPreview\Field', '\WPForms_Entry_Preview' ); |
| 308 | class_alias( '\WPForms\Pro\Forms\Fields\FileUpload\Field', '\WPForms_Field_File_Upload' ); |
| 309 | class_alias( '\WPForms\Pro\Forms\Fields\Hidden\Field', '\WPForms_Field_Hidden' ); |
| 310 | class_alias( '\WPForms\Pro\Forms\Fields\Html\Field', '\WPForms_Field_HTML' ); |
| 311 | class_alias( '\WPForms\Pro\Forms\Fields\Pagebreak\Field', '\WPForms_Field_Page_Break' ); |
| 312 | class_alias( '\WPForms\Pro\Forms\Fields\Password\Field', '\WPForms_Field_Password' ); |
| 313 | class_alias( '\WPForms\Pro\Forms\Fields\CreditCard\Field', '\WPForms_Field_CreditCard' ); |
| 314 | class_alias( '\WPForms\Pro\Forms\Fields\Phone\Field', '\WPForms_Field_Phone' ); |
| 315 | class_alias( '\WPForms\Pro\Forms\Fields\Rating\Field', '\WPForms_Rating_Text' ); |
| 316 | class_alias( '\WPForms\Pro\Forms\Fields\Richtext\Field', '\WPForms_Field_Richtext' ); |
| 317 | class_alias( '\WPForms\Pro\Forms\Fields\Url\Field', '\WPForms_Field_URL' ); |
| 318 | |
| 319 | /** |
| 320 | * This alias is a safeguard to those developers who use our internal |
| 321 | * class \WPForms\Pro\Integrations\AI\API\Forms, which we deleted. |
| 322 | * |
| 323 | * @since 1.9.4 |
| 324 | */ |
| 325 | class_alias( '\WPForms\Integrations\AI\API\Forms', '\WPForms\Pro\Integrations\AI\API\Forms' ); |
| 326 | |
| 327 | /** |
| 328 | * This alias is a safeguard to those developers who use our internal |
| 329 | * class \WPForms\Pro\Integrations\AI\Admin\Ajax\Forms, which we deleted. |
| 330 | * |
| 331 | * @since 1.9.4 |
| 332 | */ |
| 333 | class_alias( '\WPForms\Integrations\AI\Admin\Ajax\Forms', '\WPForms\Pro\Integrations\AI\Admin\Ajax\Forms' ); |
| 334 | |
| 335 | /** |
| 336 | * This alias is a safeguard to those developers who use our internal |
| 337 | * class \WPForms\Pro\Integrations\AI\Admin\Builder\Enqueues, which we deleted. |
| 338 | * |
| 339 | * @since 1.9.4 |
| 340 | */ |
| 341 | class_alias( '\WPForms\Integrations\AI\Admin\Builder\Forms', '\WPForms\Pro\Integrations\AI\Admin\Builder\Enqueues' ); |
| 342 | |
| 343 | /** |
| 344 | * This alias is a safeguard to those developers who use our internal |
| 345 | * class \WPForms\Pro\Integrations\AI\Admin\Pages\Templates, which we deleted. |
| 346 | * |
| 347 | * @since 1.9.4 |
| 348 | */ |
| 349 | class_alias( '\WPForms\Integrations\AI\Admin\Pages\Templates', '\WPForms\Pro\Integrations\AI\Admin\Pages\Templates' ); |
| 350 | } |
| 351 | |
| 352 | /** |
| 353 | * This adds backwards compatibility after scoping the stripe lib and using our own prefix `\WPForms\Vendor\Stripe`. |
| 354 | * This alias is a safeguard for the users who update core plugin to 1.8.5 but have an older version of stripe pro addon. |
| 355 | * Fire this right before autoloading of legacy classes so that there is no conflict with other stripe libs when aliasing. |
| 356 | * |
| 357 | * @since 1.8.5 |
| 358 | */ |
| 359 | spl_autoload_register( |
| 360 | static function ( $class_name ) { |
| 361 | static $stripe_check_done = false; |
| 362 | |
| 363 | static $aliases = [ |
| 364 | '\WPForms\Vendor\Stripe\Charge' => 'Stripe\Charge', |
| 365 | '\WPForms\Vendor\Stripe\Customer' => 'Stripe\Customer', |
| 366 | '\WPForms\Vendor\Stripe\Subscription' => 'Stripe\Subscription', |
| 367 | '\WPForms\Vendor\Stripe\Invoice' => 'Stripe\Invoice', |
| 368 | '\WPForms\Vendor\Stripe\Exception\CardException' => 'Stripe\Exception\CardException', |
| 369 | '\WPForms\Vendor\Stripe\Source' => 'Stripe\Source', |
| 370 | ]; |
| 371 | |
| 372 | if ( $stripe_check_done ) { |
| 373 | return; |
| 374 | } |
| 375 | |
| 376 | // If class not for aliasing, bail. |
| 377 | if ( ! in_array( $class_name, $aliases, true ) ) { |
| 378 | return; |
| 379 | } |
| 380 | |
| 381 | $stripe_check_done = true; |
| 382 | |
| 383 | // If no Stripe Pro addon bail. |
| 384 | if ( ! defined( 'WPFORMS_STRIPE_VERSION' ) ) { |
| 385 | return; |
| 386 | } |
| 387 | |
| 388 | // Version 3.2.0 has prefixed lib. |
| 389 | // Versions 2.11.0 and below already have the lib bundled, so they don't require alias. |
| 390 | if ( |
| 391 | version_compare( WPFORMS_STRIPE_VERSION, '3.2.0', '>=' ) || |
| 392 | version_compare( WPFORMS_STRIPE_VERSION, '2.11.0', '<=' ) |
| 393 | ) { |
| 394 | return; |
| 395 | } |
| 396 | |
| 397 | // We only need to alias if we are using the legacy API version. |
| 398 | if ( ! \WPFormsStripe\Helpers::is_legacy_api_version() ) { |
| 399 | return; |
| 400 | } |
| 401 | |
| 402 | // If a lib is already loaded by a third party plugin, |
| 403 | // checking the CardException class here as a niche to make sure it is the correct library. |
| 404 | if ( class_exists( '\Stripe\Exception\CardException', false ) ) { |
| 405 | return; |
| 406 | } |
| 407 | |
| 408 | foreach ( $aliases as $prefixed => $alias ) { |
| 409 | class_alias( $prefixed, '\\' . $alias ); |
| 410 | } |
| 411 | } |
| 412 | ); |
| 413 | } |
| 414 | |
| 415 | namespace WPForms\Pro\Admin\Entries { |
| 416 | |
| 417 | /** |
| 418 | * The default Entries screen showed a chart and the form entries stats. |
| 419 | * Replaced with "WPForms\Pro\Admin\Entries\Overview". |
| 420 | * |
| 421 | * @since 1.5.5 |
| 422 | * @deprecated 1.8.2 |
| 423 | */ |
| 424 | class DefaultScreen extends \WPForms\Removed {} |
| 425 | } |
| 426 |