Changeset 3408882
- Timestamp:
- 12/03/2025 06:41:11 AM (3 months ago)
- Location:
- convertkit-for-woocommerce
- Files:
-
- 2 added
- 14 edited
- 1 copied
-
tags/2.0.2 (copied) (copied from convertkit-for-woocommerce/trunk)
-
tags/2.0.2/includes/class-ckwc-admin-notices.php (added)
-
tags/2.0.2/includes/class-ckwc-integration.php (modified) (3 diffs)
-
tags/2.0.2/includes/class-wp-ckwc.php (modified) (2 diffs)
-
tags/2.0.2/languages/woocommerce-convertkit.pot (modified) (8 diffs)
-
tags/2.0.2/readme.txt (modified) (2 diffs)
-
tags/2.0.2/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php (modified) (5 diffs)
-
tags/2.0.2/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php (modified) (3 diffs)
-
tags/2.0.2/woocommerce-convertkit.php (modified) (3 diffs)
-
trunk/includes/class-ckwc-admin-notices.php (added)
-
trunk/includes/class-ckwc-integration.php (modified) (3 diffs)
-
trunk/includes/class-wp-ckwc.php (modified) (2 diffs)
-
trunk/languages/woocommerce-convertkit.pot (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php (modified) (5 diffs)
-
trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php (modified) (3 diffs)
-
trunk/woocommerce-convertkit.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
convertkit-for-woocommerce/tags/2.0.2/includes/class-ckwc-integration.php
r3322555 r3408882 91 91 add_action( 'convertkit_api_refresh_token', array( $this, 'update_credentials' ), 10, 2 ); 92 92 93 // Delete credentials if the API class uses a invalid access token. 94 // This prevents the Plugin making repetitive API requests that will 401. 95 add_action( 'convertkit_api_access_token_invalid', array( $this, 'maybe_delete_credentials' ), 10, 2 ); 96 93 97 // Load Admin screens, save settings. 94 98 if ( is_admin() ) { … … 129 133 } 130 134 135 // Remove any existing persistent notice. 136 WP_CKWC()->get_class( 'admin_notices' )->delete( 'authorization_failed' ); 137 131 138 // Update settings. 132 139 $this->update_option( 'access_token', $result['access_token'] ); … … 143 150 144 151 /** 145 * Deletes the OAuth Access Token, Refresh Token and Expiry from the Plugin's settings, if the user 146 * clicked the Disconnect button. 147 * 148 * @since 1.8.0 149 */ 150 public function maybe_disconnect() { 151 152 // Bail if we're not on the integration screen for this action. 153 if ( ! $this->get_integration_screen_name() ) { 154 return; 155 } 156 157 // Bail if nonce verification fails. 158 if ( ! isset( $_REQUEST['nonce'] ) ) { 159 return; 160 } 161 if ( ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ckwc-oauth-disconnect' ) ) { 162 return; 163 } 164 165 // Delete resources. 166 $this->resources_delete(); 167 168 // Remove Access Token from settings. 152 * Deletes the stored access token, refresh token and its expiry from the Plugin settings, 153 * and clears any existing scheduled WordPress Cron event to refresh the token on expiry, 154 * when either: 155 * - The access token is invalid 156 * - The access token expired, and refreshing failed 157 * 158 * @since 2.0.2 159 * 160 * @param WP_Error $result Error result. 161 * @param string $client_id OAuth Client ID used for the Access and Refresh Tokens. 162 */ 163 public function maybe_delete_credentials( $result, $client_id ) { 164 165 // Don't save these credentials if they're not for this Client ID. 166 // They're for another Kit Plugin that uses OAuth. 167 if ( $client_id !== CKWC_OAUTH_CLIENT_ID ) { 168 return; 169 } 170 171 // Persist an error notice in the WordPress Administration until the user fixes the problem. 172 WP_CKWC()->get_class( 'admin_notices' )->add( 'authorization_failed' ); 173 174 // Delete the credentials from the Plugin settings. 175 $this->delete_credentials(); 176 177 } 178 179 /** 180 * Deletes any existing access token, refresh token and its expiry from the Plugin settings, 181 * and clears any existing scheduled WordPress Cron event to refresh the token on expiry. 182 * 183 * @since 2.0.2 184 */ 185 public function delete_credentials() { 186 169 187 $this->update_option( 'access_token', '' ); 170 188 $this->update_option( 'refresh_token', '' ); 171 189 $this->update_option( 'token_expires', '' ); 190 191 // Clear any existing scheduled WordPress Cron event. 192 wp_clear_scheduled_hook( 'ckwc_refresh_token' ); 193 194 } 195 196 /** 197 * Deletes the OAuth Access Token, Refresh Token and Expiry from the Plugin's settings, if the user 198 * clicked the Disconnect button. 199 * 200 * @since 1.8.0 201 */ 202 public function maybe_disconnect() { 203 204 // Bail if we're not on the integration screen for this action. 205 if ( ! $this->get_integration_screen_name() ) { 206 return; 207 } 208 209 // Bail if nonce verification fails. 210 if ( ! isset( $_REQUEST['nonce'] ) ) { 211 return; 212 } 213 if ( ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ckwc-oauth-disconnect' ) ) { 214 return; 215 } 216 217 // Delete resources. 218 $this->resources_delete(); 219 220 // Remove tokens from settings. 221 $this->delete_credentials(); 172 222 173 223 // Redirect to General screen, which will now show the Plugin's settings, because the Plugin -
convertkit-for-woocommerce/tags/2.0.2/includes/class-wp-ckwc.php
r3261448 r3408882 184 184 return; 185 185 } 186 if ( ! WP_CLI ) { 186 if ( ! WP_CLI ) { // @phpstan-ignore-line 187 187 return; 188 188 } … … 249 249 private function initialize_global() { 250 250 251 $this->classes['admin_notices'] = new CKWC_Admin_Notices(); 251 252 $this->classes['checkout'] = new CKWC_Checkout(); 252 253 $this->classes['order'] = new CKWC_Order(); -
convertkit-for-woocommerce/tags/2.0.2/languages/woocommerce-convertkit.pot
r3369639 r3408882 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Kit (formerly ConvertKit) for WooCommerce 2.0. 1\n"5 "Project-Id-Version: Kit (formerly ConvertKit) for WooCommerce 2.0.2\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/convertkit-woocommerce\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025- 09-29T02:55:29+00:00\n"12 "POT-Creation-Date: 2025-12-03T01:33:06+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.12.0\n" … … 74 74 msgstr "" 75 75 76 #: includes/class-ckwc-admin-notices.php:64 77 msgid "Kit for WooCommerce: Authorization failed. Please" 78 msgstr "" 79 80 #: includes/class-ckwc-admin-notices.php:68 81 msgid "connect your Kit account." 82 msgstr "" 83 76 84 #: includes/class-ckwc-api.php:67 77 85 msgid "form_subscribe(): the form_id parameter is empty." … … 226 234 msgstr "" 227 235 228 #: includes/class-ckwc-integration.php:3 13236 #: includes/class-ckwc-integration.php:363 229 237 msgid "The uploaded configuration file isn't valid." 230 238 msgstr "" 231 239 232 #: includes/class-ckwc-integration.php:3 22240 #: includes/class-ckwc-integration.php:372 233 241 msgid "The uploaded configuration file contains no settings." 234 242 msgstr "" 235 243 236 #: includes/class-ckwc-integration.php:3 39244 #: includes/class-ckwc-integration.php:389 237 245 msgid "Configuration imported successfully." 238 246 msgstr "" 239 247 240 #: includes/class-ckwc-integration.php: 454248 #: includes/class-ckwc-integration.php:504 241 249 msgid "Account Name" 242 250 msgstr "" 243 251 244 #: includes/class-ckwc-integration.php: 456252 #: includes/class-ckwc-integration.php:506 245 253 msgid "Disconnect" 246 254 msgstr "" 247 255 248 #: includes/class-ckwc-integration.php: 473256 #: includes/class-ckwc-integration.php:523 249 257 msgid "Enable/Disable" 250 258 msgstr "" 251 259 252 #: includes/class-ckwc-integration.php: 475260 #: includes/class-ckwc-integration.php:525 253 261 msgid "Enable Kit integration" 254 262 msgstr "" 255 263 256 #: includes/class-ckwc-integration.php: 481264 #: includes/class-ckwc-integration.php:531 257 265 msgid "Subscribe Event" 258 266 msgstr "" 259 267 260 #: includes/class-ckwc-integration.php: 487268 #: includes/class-ckwc-integration.php:537 261 269 msgid "When should customers be subscribed?" 262 270 msgstr "" 263 271 264 #: includes/class-ckwc-integration.php: 491272 #: includes/class-ckwc-integration.php:541 265 273 msgid "Pending payment:" 266 274 msgstr "" 267 275 268 #: includes/class-ckwc-integration.php: 492276 #: includes/class-ckwc-integration.php:542 269 277 msgid "WooCommerce order created, payment not received." 270 278 msgstr "" 271 279 272 #: includes/class-ckwc-integration.php: 497273 #: includes/class-ckwc-integration.php:7 09280 #: includes/class-ckwc-integration.php:547 281 #: includes/class-ckwc-integration.php:759 274 282 msgid "Processing:" 275 283 msgstr "" 276 284 277 #: includes/class-ckwc-integration.php: 498278 #: includes/class-ckwc-integration.php:7 10285 #: includes/class-ckwc-integration.php:548 286 #: includes/class-ckwc-integration.php:760 279 287 msgid "WooCommerce order created, payment received, order awaiting fulfilment." 280 288 msgstr "" 281 289 282 #: includes/class-ckwc-integration.php:5 03283 #: includes/class-ckwc-integration.php:7 15290 #: includes/class-ckwc-integration.php:553 291 #: includes/class-ckwc-integration.php:765 284 292 msgid "Completed:" 285 293 msgstr "" 286 294 287 #: includes/class-ckwc-integration.php:5 04288 #: includes/class-ckwc-integration.php:7 16295 #: includes/class-ckwc-integration.php:554 296 #: includes/class-ckwc-integration.php:766 289 297 msgid "WooCommerce order created, payment received, order fulfiled." 290 298 msgstr "" 291 299 292 #: includes/class-ckwc-integration.php:5 10300 #: includes/class-ckwc-integration.php:560 293 301 msgid "Order Pending payment" 294 302 msgstr "" 295 303 296 #: includes/class-ckwc-integration.php:5 11297 #: includes/class-ckwc-integration.php:7 22304 #: includes/class-ckwc-integration.php:561 305 #: includes/class-ckwc-integration.php:772 298 306 msgid "Order Processing" 299 307 msgstr "" 300 308 301 #: includes/class-ckwc-integration.php:5 12302 #: includes/class-ckwc-integration.php:7 23309 #: includes/class-ckwc-integration.php:562 310 #: includes/class-ckwc-integration.php:773 303 311 msgid "Order Completed" 304 312 msgstr "" 305 313 306 #: includes/class-ckwc-integration.php:5 19314 #: includes/class-ckwc-integration.php:569 307 315 msgid "Subscription" 308 316 msgstr "" 309 317 310 #: includes/class-ckwc-integration.php:5 22318 #: includes/class-ckwc-integration.php:572 311 319 msgid "The Kit form, tag or sequence to subscribe customers to." 312 320 msgstr "" 313 321 314 #: includes/class-ckwc-integration.php:5 28322 #: includes/class-ckwc-integration.php:578 315 323 msgid "Name Format" 316 324 msgstr "" 317 325 318 #: includes/class-ckwc-integration.php:5 31326 #: includes/class-ckwc-integration.php:581 319 327 msgid "How should the customer name be sent to Kit?" 320 328 msgstr "" 321 329 322 #: includes/class-ckwc-integration.php:5 34330 #: includes/class-ckwc-integration.php:584 323 331 msgid "Billing First Name" 324 332 msgstr "" 325 333 326 #: includes/class-ckwc-integration.php:5 35334 #: includes/class-ckwc-integration.php:585 327 335 msgid "Billing Last Name" 328 336 msgstr "" 329 337 330 #: includes/class-ckwc-integration.php:5 36338 #: includes/class-ckwc-integration.php:586 331 339 msgid "Billing First Name + Billing Last Name" 332 340 msgstr "" 333 341 334 #: includes/class-ckwc-integration.php:5 45342 #: includes/class-ckwc-integration.php:595 335 343 msgid "Send Last Name" 336 344 msgstr "" 337 345 338 #: includes/class-ckwc-integration.php:5 48346 #: includes/class-ckwc-integration.php:598 339 347 msgid "The Kit custom field to store the order's last name." 340 348 msgstr "" 341 349 342 #: includes/class-ckwc-integration.php: 554350 #: includes/class-ckwc-integration.php:604 343 351 msgid "Send Phone Number" 344 352 msgstr "" 345 353 346 #: includes/class-ckwc-integration.php: 557354 #: includes/class-ckwc-integration.php:607 347 355 msgid "The Kit custom field to store the order's phone number." 348 356 msgstr "" 349 357 350 #: includes/class-ckwc-integration.php: 563358 #: includes/class-ckwc-integration.php:613 351 359 msgid "Send Billing Address" 352 360 msgstr "" 353 361 354 #: includes/class-ckwc-integration.php: 566362 #: includes/class-ckwc-integration.php:616 355 363 msgid "The Kit custom field to store the order's billing address." 356 364 msgstr "" 357 365 358 #: includes/class-ckwc-integration.php: 572366 #: includes/class-ckwc-integration.php:622 359 367 msgid "Send Shipping Address" 360 368 msgstr "" 361 369 362 #: includes/class-ckwc-integration.php: 575370 #: includes/class-ckwc-integration.php:625 363 371 msgid "The Kit custom field to store the order's shipping address." 364 372 msgstr "" 365 373 366 #: includes/class-ckwc-integration.php: 581374 #: includes/class-ckwc-integration.php:631 367 375 msgid "Address Format" 368 376 msgstr "" 369 377 370 #: includes/class-ckwc-integration.php: 592378 #: includes/class-ckwc-integration.php:642 371 379 msgid "The format of the billing and shipping addresses to store in Kit." 372 380 msgstr "" 373 381 374 #: includes/class-ckwc-integration.php: 595382 #: includes/class-ckwc-integration.php:645 375 383 msgid "Name" 376 384 msgstr "" 377 385 378 #: includes/class-ckwc-integration.php: 596386 #: includes/class-ckwc-integration.php:646 379 387 msgid "Company Name" 380 388 msgstr "" 381 389 382 #: includes/class-ckwc-integration.php: 597390 #: includes/class-ckwc-integration.php:647 383 391 msgid "Address 1" 384 392 msgstr "" 385 393 386 #: includes/class-ckwc-integration.php: 598394 #: includes/class-ckwc-integration.php:648 387 395 msgid "Address 2" 388 396 msgstr "" 389 397 390 #: includes/class-ckwc-integration.php: 599398 #: includes/class-ckwc-integration.php:649 391 399 msgid "City" 392 400 msgstr "" 393 401 394 #: includes/class-ckwc-integration.php:6 00402 #: includes/class-ckwc-integration.php:650 395 403 msgid "State" 396 404 msgstr "" 397 405 398 #: includes/class-ckwc-integration.php:6 01406 #: includes/class-ckwc-integration.php:651 399 407 msgid "Postcode" 400 408 msgstr "" 401 409 402 #: includes/class-ckwc-integration.php:6 02410 #: includes/class-ckwc-integration.php:652 403 411 msgid "Country" 404 412 msgstr "" 405 413 406 #: includes/class-ckwc-integration.php:6 09414 #: includes/class-ckwc-integration.php:659 407 415 msgid "Send Payment Method" 408 416 msgstr "" 409 417 410 #: includes/class-ckwc-integration.php:6 12418 #: includes/class-ckwc-integration.php:662 411 419 msgid "The Kit custom field to store the order's payment method." 412 420 msgstr "" 413 421 414 #: includes/class-ckwc-integration.php:6 18422 #: includes/class-ckwc-integration.php:668 415 423 msgid "Send Customer Note" 416 424 msgstr "" 417 425 418 #: includes/class-ckwc-integration.php:6 21426 #: includes/class-ckwc-integration.php:671 419 427 msgid "The Kit custom field to store the order's customer note." 420 428 msgstr "" 421 429 422 #: includes/class-ckwc-integration.php:6 29430 #: includes/class-ckwc-integration.php:679 423 431 msgid "Opt-In Checkbox" 424 432 msgstr "" 425 433 426 #: includes/class-ckwc-integration.php:6 30434 #: includes/class-ckwc-integration.php:680 427 435 msgid "Display an opt-in checkbox on checkout" 428 436 msgstr "" 429 437 430 #: includes/class-ckwc-integration.php:6 33438 #: includes/class-ckwc-integration.php:683 431 439 msgid "" 432 440 "If enabled, customers will <strong>only</strong> be subscribed to the chosen forms, tags and sequences if they check the opt-in checkbox at checkout.<br />\n" … … 434 442 msgstr "" 435 443 436 #: includes/class-ckwc-integration.php:6 44444 #: includes/class-ckwc-integration.php:694 437 445 msgid "Opt-In Checkbox: Label" 438 446 msgstr "" 439 447 440 #: includes/class-ckwc-integration.php:6 46448 #: includes/class-ckwc-integration.php:696 441 449 msgid "I want to subscribe to the newsletter" 442 450 msgstr "" 443 451 444 #: includes/class-ckwc-integration.php:6 47452 #: includes/class-ckwc-integration.php:697 445 453 msgid "Customize the label next to the opt-in checkbox." 446 454 msgstr "" 447 455 448 #: includes/class-ckwc-integration.php: 654456 #: includes/class-ckwc-integration.php:704 449 457 msgid "Opt-In Checkbox: Default Status" 450 458 msgstr "" 451 459 452 #: includes/class-ckwc-integration.php: 657460 #: includes/class-ckwc-integration.php:707 453 461 msgid "The default state of the opt-in checkbox." 454 462 msgstr "" 455 463 456 #: includes/class-ckwc-integration.php: 660464 #: includes/class-ckwc-integration.php:710 457 465 msgid "Checked" 458 466 msgstr "" 459 467 460 #: includes/class-ckwc-integration.php: 661468 #: includes/class-ckwc-integration.php:711 461 469 msgid "Unchecked" 462 470 msgstr "" 463 471 464 #: includes/class-ckwc-integration.php: 668472 #: includes/class-ckwc-integration.php:718 465 473 msgid "Opt-In Checkbox: Display Location" 466 474 msgstr "" 467 475 468 #: includes/class-ckwc-integration.php: 671476 #: includes/class-ckwc-integration.php:721 469 477 msgid "Where to display the opt-in checkbox on the checkout page (under \"Billing details\" or \"Additional information\")." 470 478 msgstr "" 471 479 472 #: includes/class-ckwc-integration.php: 674480 #: includes/class-ckwc-integration.php:724 473 481 msgid "Billing" 474 482 msgstr "" 475 483 476 #: includes/class-ckwc-integration.php: 675484 #: includes/class-ckwc-integration.php:725 477 485 msgid "Order" 478 486 msgstr "" 479 487 480 #: includes/class-ckwc-integration.php: 684488 #: includes/class-ckwc-integration.php:734 481 489 msgid "Purchase Data" 482 490 msgstr "" 483 491 484 #: includes/class-ckwc-integration.php: 685492 #: includes/class-ckwc-integration.php:735 485 493 msgid "Send purchase data to Kit." 486 494 msgstr "" 487 495 488 #: includes/class-ckwc-integration.php: 688496 #: includes/class-ckwc-integration.php:738 489 497 msgid "" 490 498 "If enabled, the customer's order data will be sent to Kit. Their email address will always be subscribed to Kit, <strong>regardless of the Customer's opt in status.</strong><br />\n" … … 492 500 msgstr "" 493 501 494 #: includes/class-ckwc-integration.php: 699502 #: includes/class-ckwc-integration.php:749 495 503 msgid "Purchase Data Event" 496 504 msgstr "" 497 505 498 #: includes/class-ckwc-integration.php:7 05506 #: includes/class-ckwc-integration.php:755 499 507 msgid "When should purchase data be sent?" 500 508 msgstr "" 501 509 502 #: includes/class-ckwc-integration.php:7 30510 #: includes/class-ckwc-integration.php:780 503 511 msgid "Sync Past Orders" 504 512 msgstr "" 505 513 506 #: includes/class-ckwc-integration.php:7 31514 #: includes/class-ckwc-integration.php:781 507 515 msgid "Send old purchase data to Kit i.e. Orders that were created in WooCommerce prior to this Plugin being installed." 508 516 msgstr "" 509 517 510 #: includes/class-ckwc-integration.php:7 47518 #: includes/class-ckwc-integration.php:797 511 519 msgid "Debug" 512 520 msgstr "" 513 521 514 #: includes/class-ckwc-integration.php:7 49522 #: includes/class-ckwc-integration.php:799 515 523 msgid "Write data to a log file" 516 524 msgstr "" 517 525 518 #: includes/class-ckwc-integration.php: 754526 #: includes/class-ckwc-integration.php:804 519 527 msgid "View log file" 520 528 msgstr "" 521 529 522 #: includes/class-ckwc-integration.php:8 24530 #: includes/class-ckwc-integration.php:874 523 531 msgid "Do you want to send past WooCommerce Orders to Kit?" 524 532 msgstr "" 525 533 526 534 #. translators: Number of WooCommerce Orders 527 #: includes/class-ckwc-integration.php:10 04535 #: includes/class-ckwc-integration.php:1054 528 536 #, php-format 529 537 msgid "%s not been sent to Kit based on the Purchase Data Event setting above. This is either because sending purchase data is/was disabled, and/or orders were created prior to installing this integration.<br />Use the sync button to send data for these orders to Kit." … … 531 539 532 540 #. translators: number of Orders not sent to ConvertKit 533 #: includes/class-ckwc-integration.php:10 07541 #: includes/class-ckwc-integration.php:1057 534 542 #, php-format 535 543 msgid "%s WooCommerce order has" … … 625 633 626 634 #. translators: %1$s: PHP class name 627 #: includes/class-wp-ckwc.php:29 7635 #: includes/class-wp-ckwc.php:298 628 636 #, php-format 629 637 msgid "Kit for WooCommerce Error: Could not load Plugin class <strong>%1$s</strong>" 630 638 msgstr "" 631 639 632 #: includes/class-wp-ckwc.php:30 7640 #: includes/class-wp-ckwc.php:308 633 641 msgid "Kit for WooCommerce Error" 634 642 msgstr "" -
convertkit-for-woocommerce/tags/2.0.2/readme.txt
r3369639 r3408882 4 4 Tags: email, marketing, embed form, convertkit, capture 5 5 Requires at least: 5.0 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 7.1 8 Stable tag: 2.0. 18 Stable tag: 2.0.2 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 46 46 47 47 == Changelog == 48 49 ### 2.0.2 2025-12-03 50 * Fix: Settings: Automatically delete invalid Access Tokens 51 * Updated: Use WordPress Libraries 2.1.2 48 52 49 53 ### 2.0.1 2025-09-29 -
convertkit-for-woocommerce/tags/2.0.2/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php
r3369639 r3408882 378 378 if ( is_wp_error( $result ) ) { 379 379 $this->log( 'API: Error: ' . $result->get_error_message() ); 380 381 /** 382 * Perform any actions when obtaining an access token fails. 383 * 384 * @since 2.1.1 385 * 386 * @param WP_Error $result Error from API. 387 * @param string $client_id OAuth Client ID. 388 */ 389 do_action( 'convertkit_api_get_access_token_error', $result, $this->client_id ); 390 380 391 return $result; 381 392 } … … 415 426 if ( is_wp_error( $result ) ) { 416 427 $this->log( 'API: Error: ' . $result->get_error_message() ); 428 429 /** 430 * Perform any actions when refreshing an expired access token fails. 431 * 432 * @since 2.1.1 433 * 434 * @param WP_Error $result Error from API. 435 * @param string $client_id OAuth Client ID. 436 */ 437 do_action( 'convertkit_api_refresh_token_error', $result, $this->client_id ); 438 417 439 return $result; 418 440 } … … 1433 1455 // Return the API error message as a WP_Error if the HTTP response code is a 4xx code. 1434 1456 if ( $http_response_code >= 400 ) { 1457 1435 1458 // Define the error message. 1436 1459 $error = $this->get_error_message_string( $response ); … … 1439 1462 1440 1463 switch ( $http_response_code ) { 1441 // If the HTTP response code is 401, and the error matches 'The access token expired', refresh the access token now1442 // and re-attempt the request.1443 1464 case 401: 1444 if ( $error !== 'The access token expired' ) { 1445 break; 1465 switch ( $error ) { 1466 case 'The access token expired': 1467 // Attempt to refresh the access token. 1468 $result = $this->refresh_token(); 1469 1470 // If an error occured, bail. 1471 if ( is_wp_error( $result ) ) { 1472 return $result; 1473 } 1474 1475 // Attempt the request again, now we have a new access token. 1476 return $this->request( $endpoint, $method, $params, false ); 1477 1478 case 'The access token is invalid': 1479 $error = new WP_Error( 1480 'convertkit_api_error', 1481 $error, 1482 $http_response_code 1483 ); 1484 1485 /** 1486 * Perform any actions when an invalid access token was used. 1487 * 1488 * @since 2.1.1 1489 * 1490 * @param WP_Error $error WP_Error object. 1491 * @param string $client_id OAuth Client ID. 1492 */ 1493 do_action( 'convertkit_api_access_token_invalid', $error, $this->client_id ); 1494 1495 // Return error. 1496 return $error; 1497 1498 default: 1499 return new WP_Error( 1500 'convertkit_api_error', 1501 $error, 1502 $http_response_code 1503 ); 1446 1504 } 1447 1505 1448 // Don't automatically refresh the expired access token if we're not on a production environment.1449 // This prevents the same ConvertKit account used on both a staging and production site from1450 // reaching a race condition where the staging site refreshes the token first, resulting in1451 // the production site unable to later refresh its same expired access token.1452 if ( ! $this->is_production_site() ) {1453 break;1454 }1455 1456 // Refresh the access token.1457 $result = $this->refresh_token();1458 1459 // If an error occured, bail.1460 if ( is_wp_error( $result ) ) {1461 return $result;1462 }1463 1464 // Attempt the request again, now we have a new access token.1465 return $this->request( $endpoint, $method, $params, false );1466 1467 // If a rate limit was hit, maybe try again.1468 1506 case 429: 1469 1507 // If retry on rate limit hit is disabled, return a WP_Error. … … 1489 1527 1490 1528 return $response; 1491 1492 }1493 1494 /**1495 * Helper method to determine the WordPress environment type, checking1496 * if the wp_get_environment_type() function exists in WordPress (versions1497 * older than WordPress 5.5 won't have this function).1498 *1499 * @since 2.0.21500 *1501 * @return bool1502 */1503 private function is_production_site() {1504 1505 // If the WordPress wp_get_environment_type() function isn't available,1506 // assume this is a production site.1507 if ( ! function_exists( 'wp_get_environment_type' ) ) {1508 return true;1509 }1510 1511 return ( wp_get_environment_type() === 'production' );1512 1529 1513 1530 } -
convertkit-for-woocommerce/tags/2.0.2/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php
r3112082 r3408882 117 117 // would never expire. 118 118 if ( ! $this->last_queried ) { 119 $this->refresh(); 120 return; 119 return $this->refresh(); 121 120 } 122 121 123 122 // If the resources have expired, refresh them now. 124 123 if ( time() > ( $this->last_queried + $this->cache_duration ) ) { 125 $this->refresh(); 126 return; 124 return $this->refresh(); 127 125 } 128 126 … … 345 343 * @since 1.0.0 346 344 * 347 * @return bool|WP_Error|array345 * @return WP_Error|array 348 346 */ 349 347 public function refresh() { … … 351 349 // Bail if no API class was defined. 352 350 if ( ! $this->api ) { 353 return false;351 return new WP_Error( 'convertkit_resource_refresh_error', 'Connect the Plugin to your Kit account to refresh resources.' ); 354 352 } 355 353 -
convertkit-for-woocommerce/tags/2.0.2/woocommerce-convertkit.php
r3369639 r3408882 10 10 * Plugin URI: https://www.kit.com 11 11 * Description: Integrates WooCommerce with Kit, allowing customers to be automatically sent to your Kit account. 12 * Version: 2.0. 112 * Version: 2.0.2 13 13 * Author: Kit 14 14 * Author URI: https://www.kit.com … … 31 31 define( 'CKWC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 32 32 define( 'CKWC_PLUGIN_PATH', __DIR__ ); 33 define( 'CKWC_PLUGIN_VERSION', '2.0. 1' );33 define( 'CKWC_PLUGIN_VERSION', '2.0.2' ); 34 34 define( 'CKWC_OAUTH_CLIENT_ID', 'L0kyADsB3WP5zO5MvUpXQU64gIntQg9BBAIme17r_7A' ); 35 35 define( 'CKWC_OAUTH_CLIENT_REDIRECT_URI', 'https://app.kit.com/wordpress/redirect' ); … … 53 53 require_once CKWC_PLUGIN_PATH . '/includes/functions.php'; 54 54 require_once CKWC_PLUGIN_PATH . '/includes/class-wp-ckwc.php'; 55 require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-admin-notices.php'; 55 56 require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-api.php'; 56 57 require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-checkout.php'; -
convertkit-for-woocommerce/trunk/includes/class-ckwc-integration.php
r3322555 r3408882 91 91 add_action( 'convertkit_api_refresh_token', array( $this, 'update_credentials' ), 10, 2 ); 92 92 93 // Delete credentials if the API class uses a invalid access token. 94 // This prevents the Plugin making repetitive API requests that will 401. 95 add_action( 'convertkit_api_access_token_invalid', array( $this, 'maybe_delete_credentials' ), 10, 2 ); 96 93 97 // Load Admin screens, save settings. 94 98 if ( is_admin() ) { … … 129 133 } 130 134 135 // Remove any existing persistent notice. 136 WP_CKWC()->get_class( 'admin_notices' )->delete( 'authorization_failed' ); 137 131 138 // Update settings. 132 139 $this->update_option( 'access_token', $result['access_token'] ); … … 143 150 144 151 /** 145 * Deletes the OAuth Access Token, Refresh Token and Expiry from the Plugin's settings, if the user 146 * clicked the Disconnect button. 147 * 148 * @since 1.8.0 149 */ 150 public function maybe_disconnect() { 151 152 // Bail if we're not on the integration screen for this action. 153 if ( ! $this->get_integration_screen_name() ) { 154 return; 155 } 156 157 // Bail if nonce verification fails. 158 if ( ! isset( $_REQUEST['nonce'] ) ) { 159 return; 160 } 161 if ( ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ckwc-oauth-disconnect' ) ) { 162 return; 163 } 164 165 // Delete resources. 166 $this->resources_delete(); 167 168 // Remove Access Token from settings. 152 * Deletes the stored access token, refresh token and its expiry from the Plugin settings, 153 * and clears any existing scheduled WordPress Cron event to refresh the token on expiry, 154 * when either: 155 * - The access token is invalid 156 * - The access token expired, and refreshing failed 157 * 158 * @since 2.0.2 159 * 160 * @param WP_Error $result Error result. 161 * @param string $client_id OAuth Client ID used for the Access and Refresh Tokens. 162 */ 163 public function maybe_delete_credentials( $result, $client_id ) { 164 165 // Don't save these credentials if they're not for this Client ID. 166 // They're for another Kit Plugin that uses OAuth. 167 if ( $client_id !== CKWC_OAUTH_CLIENT_ID ) { 168 return; 169 } 170 171 // Persist an error notice in the WordPress Administration until the user fixes the problem. 172 WP_CKWC()->get_class( 'admin_notices' )->add( 'authorization_failed' ); 173 174 // Delete the credentials from the Plugin settings. 175 $this->delete_credentials(); 176 177 } 178 179 /** 180 * Deletes any existing access token, refresh token and its expiry from the Plugin settings, 181 * and clears any existing scheduled WordPress Cron event to refresh the token on expiry. 182 * 183 * @since 2.0.2 184 */ 185 public function delete_credentials() { 186 169 187 $this->update_option( 'access_token', '' ); 170 188 $this->update_option( 'refresh_token', '' ); 171 189 $this->update_option( 'token_expires', '' ); 190 191 // Clear any existing scheduled WordPress Cron event. 192 wp_clear_scheduled_hook( 'ckwc_refresh_token' ); 193 194 } 195 196 /** 197 * Deletes the OAuth Access Token, Refresh Token and Expiry from the Plugin's settings, if the user 198 * clicked the Disconnect button. 199 * 200 * @since 1.8.0 201 */ 202 public function maybe_disconnect() { 203 204 // Bail if we're not on the integration screen for this action. 205 if ( ! $this->get_integration_screen_name() ) { 206 return; 207 } 208 209 // Bail if nonce verification fails. 210 if ( ! isset( $_REQUEST['nonce'] ) ) { 211 return; 212 } 213 if ( ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ckwc-oauth-disconnect' ) ) { 214 return; 215 } 216 217 // Delete resources. 218 $this->resources_delete(); 219 220 // Remove tokens from settings. 221 $this->delete_credentials(); 172 222 173 223 // Redirect to General screen, which will now show the Plugin's settings, because the Plugin -
convertkit-for-woocommerce/trunk/includes/class-wp-ckwc.php
r3261448 r3408882 184 184 return; 185 185 } 186 if ( ! WP_CLI ) { 186 if ( ! WP_CLI ) { // @phpstan-ignore-line 187 187 return; 188 188 } … … 249 249 private function initialize_global() { 250 250 251 $this->classes['admin_notices'] = new CKWC_Admin_Notices(); 251 252 $this->classes['checkout'] = new CKWC_Checkout(); 252 253 $this->classes['order'] = new CKWC_Order(); -
convertkit-for-woocommerce/trunk/languages/woocommerce-convertkit.pot
r3369639 r3408882 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Kit (formerly ConvertKit) for WooCommerce 2.0. 1\n"5 "Project-Id-Version: Kit (formerly ConvertKit) for WooCommerce 2.0.2\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/convertkit-woocommerce\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025- 09-29T02:55:29+00:00\n"12 "POT-Creation-Date: 2025-12-03T01:33:06+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.12.0\n" … … 74 74 msgstr "" 75 75 76 #: includes/class-ckwc-admin-notices.php:64 77 msgid "Kit for WooCommerce: Authorization failed. Please" 78 msgstr "" 79 80 #: includes/class-ckwc-admin-notices.php:68 81 msgid "connect your Kit account." 82 msgstr "" 83 76 84 #: includes/class-ckwc-api.php:67 77 85 msgid "form_subscribe(): the form_id parameter is empty." … … 226 234 msgstr "" 227 235 228 #: includes/class-ckwc-integration.php:3 13236 #: includes/class-ckwc-integration.php:363 229 237 msgid "The uploaded configuration file isn't valid." 230 238 msgstr "" 231 239 232 #: includes/class-ckwc-integration.php:3 22240 #: includes/class-ckwc-integration.php:372 233 241 msgid "The uploaded configuration file contains no settings." 234 242 msgstr "" 235 243 236 #: includes/class-ckwc-integration.php:3 39244 #: includes/class-ckwc-integration.php:389 237 245 msgid "Configuration imported successfully." 238 246 msgstr "" 239 247 240 #: includes/class-ckwc-integration.php: 454248 #: includes/class-ckwc-integration.php:504 241 249 msgid "Account Name" 242 250 msgstr "" 243 251 244 #: includes/class-ckwc-integration.php: 456252 #: includes/class-ckwc-integration.php:506 245 253 msgid "Disconnect" 246 254 msgstr "" 247 255 248 #: includes/class-ckwc-integration.php: 473256 #: includes/class-ckwc-integration.php:523 249 257 msgid "Enable/Disable" 250 258 msgstr "" 251 259 252 #: includes/class-ckwc-integration.php: 475260 #: includes/class-ckwc-integration.php:525 253 261 msgid "Enable Kit integration" 254 262 msgstr "" 255 263 256 #: includes/class-ckwc-integration.php: 481264 #: includes/class-ckwc-integration.php:531 257 265 msgid "Subscribe Event" 258 266 msgstr "" 259 267 260 #: includes/class-ckwc-integration.php: 487268 #: includes/class-ckwc-integration.php:537 261 269 msgid "When should customers be subscribed?" 262 270 msgstr "" 263 271 264 #: includes/class-ckwc-integration.php: 491272 #: includes/class-ckwc-integration.php:541 265 273 msgid "Pending payment:" 266 274 msgstr "" 267 275 268 #: includes/class-ckwc-integration.php: 492276 #: includes/class-ckwc-integration.php:542 269 277 msgid "WooCommerce order created, payment not received." 270 278 msgstr "" 271 279 272 #: includes/class-ckwc-integration.php: 497273 #: includes/class-ckwc-integration.php:7 09280 #: includes/class-ckwc-integration.php:547 281 #: includes/class-ckwc-integration.php:759 274 282 msgid "Processing:" 275 283 msgstr "" 276 284 277 #: includes/class-ckwc-integration.php: 498278 #: includes/class-ckwc-integration.php:7 10285 #: includes/class-ckwc-integration.php:548 286 #: includes/class-ckwc-integration.php:760 279 287 msgid "WooCommerce order created, payment received, order awaiting fulfilment." 280 288 msgstr "" 281 289 282 #: includes/class-ckwc-integration.php:5 03283 #: includes/class-ckwc-integration.php:7 15290 #: includes/class-ckwc-integration.php:553 291 #: includes/class-ckwc-integration.php:765 284 292 msgid "Completed:" 285 293 msgstr "" 286 294 287 #: includes/class-ckwc-integration.php:5 04288 #: includes/class-ckwc-integration.php:7 16295 #: includes/class-ckwc-integration.php:554 296 #: includes/class-ckwc-integration.php:766 289 297 msgid "WooCommerce order created, payment received, order fulfiled." 290 298 msgstr "" 291 299 292 #: includes/class-ckwc-integration.php:5 10300 #: includes/class-ckwc-integration.php:560 293 301 msgid "Order Pending payment" 294 302 msgstr "" 295 303 296 #: includes/class-ckwc-integration.php:5 11297 #: includes/class-ckwc-integration.php:7 22304 #: includes/class-ckwc-integration.php:561 305 #: includes/class-ckwc-integration.php:772 298 306 msgid "Order Processing" 299 307 msgstr "" 300 308 301 #: includes/class-ckwc-integration.php:5 12302 #: includes/class-ckwc-integration.php:7 23309 #: includes/class-ckwc-integration.php:562 310 #: includes/class-ckwc-integration.php:773 303 311 msgid "Order Completed" 304 312 msgstr "" 305 313 306 #: includes/class-ckwc-integration.php:5 19314 #: includes/class-ckwc-integration.php:569 307 315 msgid "Subscription" 308 316 msgstr "" 309 317 310 #: includes/class-ckwc-integration.php:5 22318 #: includes/class-ckwc-integration.php:572 311 319 msgid "The Kit form, tag or sequence to subscribe customers to." 312 320 msgstr "" 313 321 314 #: includes/class-ckwc-integration.php:5 28322 #: includes/class-ckwc-integration.php:578 315 323 msgid "Name Format" 316 324 msgstr "" 317 325 318 #: includes/class-ckwc-integration.php:5 31326 #: includes/class-ckwc-integration.php:581 319 327 msgid "How should the customer name be sent to Kit?" 320 328 msgstr "" 321 329 322 #: includes/class-ckwc-integration.php:5 34330 #: includes/class-ckwc-integration.php:584 323 331 msgid "Billing First Name" 324 332 msgstr "" 325 333 326 #: includes/class-ckwc-integration.php:5 35334 #: includes/class-ckwc-integration.php:585 327 335 msgid "Billing Last Name" 328 336 msgstr "" 329 337 330 #: includes/class-ckwc-integration.php:5 36338 #: includes/class-ckwc-integration.php:586 331 339 msgid "Billing First Name + Billing Last Name" 332 340 msgstr "" 333 341 334 #: includes/class-ckwc-integration.php:5 45342 #: includes/class-ckwc-integration.php:595 335 343 msgid "Send Last Name" 336 344 msgstr "" 337 345 338 #: includes/class-ckwc-integration.php:5 48346 #: includes/class-ckwc-integration.php:598 339 347 msgid "The Kit custom field to store the order's last name." 340 348 msgstr "" 341 349 342 #: includes/class-ckwc-integration.php: 554350 #: includes/class-ckwc-integration.php:604 343 351 msgid "Send Phone Number" 344 352 msgstr "" 345 353 346 #: includes/class-ckwc-integration.php: 557354 #: includes/class-ckwc-integration.php:607 347 355 msgid "The Kit custom field to store the order's phone number." 348 356 msgstr "" 349 357 350 #: includes/class-ckwc-integration.php: 563358 #: includes/class-ckwc-integration.php:613 351 359 msgid "Send Billing Address" 352 360 msgstr "" 353 361 354 #: includes/class-ckwc-integration.php: 566362 #: includes/class-ckwc-integration.php:616 355 363 msgid "The Kit custom field to store the order's billing address." 356 364 msgstr "" 357 365 358 #: includes/class-ckwc-integration.php: 572366 #: includes/class-ckwc-integration.php:622 359 367 msgid "Send Shipping Address" 360 368 msgstr "" 361 369 362 #: includes/class-ckwc-integration.php: 575370 #: includes/class-ckwc-integration.php:625 363 371 msgid "The Kit custom field to store the order's shipping address." 364 372 msgstr "" 365 373 366 #: includes/class-ckwc-integration.php: 581374 #: includes/class-ckwc-integration.php:631 367 375 msgid "Address Format" 368 376 msgstr "" 369 377 370 #: includes/class-ckwc-integration.php: 592378 #: includes/class-ckwc-integration.php:642 371 379 msgid "The format of the billing and shipping addresses to store in Kit." 372 380 msgstr "" 373 381 374 #: includes/class-ckwc-integration.php: 595382 #: includes/class-ckwc-integration.php:645 375 383 msgid "Name" 376 384 msgstr "" 377 385 378 #: includes/class-ckwc-integration.php: 596386 #: includes/class-ckwc-integration.php:646 379 387 msgid "Company Name" 380 388 msgstr "" 381 389 382 #: includes/class-ckwc-integration.php: 597390 #: includes/class-ckwc-integration.php:647 383 391 msgid "Address 1" 384 392 msgstr "" 385 393 386 #: includes/class-ckwc-integration.php: 598394 #: includes/class-ckwc-integration.php:648 387 395 msgid "Address 2" 388 396 msgstr "" 389 397 390 #: includes/class-ckwc-integration.php: 599398 #: includes/class-ckwc-integration.php:649 391 399 msgid "City" 392 400 msgstr "" 393 401 394 #: includes/class-ckwc-integration.php:6 00402 #: includes/class-ckwc-integration.php:650 395 403 msgid "State" 396 404 msgstr "" 397 405 398 #: includes/class-ckwc-integration.php:6 01406 #: includes/class-ckwc-integration.php:651 399 407 msgid "Postcode" 400 408 msgstr "" 401 409 402 #: includes/class-ckwc-integration.php:6 02410 #: includes/class-ckwc-integration.php:652 403 411 msgid "Country" 404 412 msgstr "" 405 413 406 #: includes/class-ckwc-integration.php:6 09414 #: includes/class-ckwc-integration.php:659 407 415 msgid "Send Payment Method" 408 416 msgstr "" 409 417 410 #: includes/class-ckwc-integration.php:6 12418 #: includes/class-ckwc-integration.php:662 411 419 msgid "The Kit custom field to store the order's payment method." 412 420 msgstr "" 413 421 414 #: includes/class-ckwc-integration.php:6 18422 #: includes/class-ckwc-integration.php:668 415 423 msgid "Send Customer Note" 416 424 msgstr "" 417 425 418 #: includes/class-ckwc-integration.php:6 21426 #: includes/class-ckwc-integration.php:671 419 427 msgid "The Kit custom field to store the order's customer note." 420 428 msgstr "" 421 429 422 #: includes/class-ckwc-integration.php:6 29430 #: includes/class-ckwc-integration.php:679 423 431 msgid "Opt-In Checkbox" 424 432 msgstr "" 425 433 426 #: includes/class-ckwc-integration.php:6 30434 #: includes/class-ckwc-integration.php:680 427 435 msgid "Display an opt-in checkbox on checkout" 428 436 msgstr "" 429 437 430 #: includes/class-ckwc-integration.php:6 33438 #: includes/class-ckwc-integration.php:683 431 439 msgid "" 432 440 "If enabled, customers will <strong>only</strong> be subscribed to the chosen forms, tags and sequences if they check the opt-in checkbox at checkout.<br />\n" … … 434 442 msgstr "" 435 443 436 #: includes/class-ckwc-integration.php:6 44444 #: includes/class-ckwc-integration.php:694 437 445 msgid "Opt-In Checkbox: Label" 438 446 msgstr "" 439 447 440 #: includes/class-ckwc-integration.php:6 46448 #: includes/class-ckwc-integration.php:696 441 449 msgid "I want to subscribe to the newsletter" 442 450 msgstr "" 443 451 444 #: includes/class-ckwc-integration.php:6 47452 #: includes/class-ckwc-integration.php:697 445 453 msgid "Customize the label next to the opt-in checkbox." 446 454 msgstr "" 447 455 448 #: includes/class-ckwc-integration.php: 654456 #: includes/class-ckwc-integration.php:704 449 457 msgid "Opt-In Checkbox: Default Status" 450 458 msgstr "" 451 459 452 #: includes/class-ckwc-integration.php: 657460 #: includes/class-ckwc-integration.php:707 453 461 msgid "The default state of the opt-in checkbox." 454 462 msgstr "" 455 463 456 #: includes/class-ckwc-integration.php: 660464 #: includes/class-ckwc-integration.php:710 457 465 msgid "Checked" 458 466 msgstr "" 459 467 460 #: includes/class-ckwc-integration.php: 661468 #: includes/class-ckwc-integration.php:711 461 469 msgid "Unchecked" 462 470 msgstr "" 463 471 464 #: includes/class-ckwc-integration.php: 668472 #: includes/class-ckwc-integration.php:718 465 473 msgid "Opt-In Checkbox: Display Location" 466 474 msgstr "" 467 475 468 #: includes/class-ckwc-integration.php: 671476 #: includes/class-ckwc-integration.php:721 469 477 msgid "Where to display the opt-in checkbox on the checkout page (under \"Billing details\" or \"Additional information\")." 470 478 msgstr "" 471 479 472 #: includes/class-ckwc-integration.php: 674480 #: includes/class-ckwc-integration.php:724 473 481 msgid "Billing" 474 482 msgstr "" 475 483 476 #: includes/class-ckwc-integration.php: 675484 #: includes/class-ckwc-integration.php:725 477 485 msgid "Order" 478 486 msgstr "" 479 487 480 #: includes/class-ckwc-integration.php: 684488 #: includes/class-ckwc-integration.php:734 481 489 msgid "Purchase Data" 482 490 msgstr "" 483 491 484 #: includes/class-ckwc-integration.php: 685492 #: includes/class-ckwc-integration.php:735 485 493 msgid "Send purchase data to Kit." 486 494 msgstr "" 487 495 488 #: includes/class-ckwc-integration.php: 688496 #: includes/class-ckwc-integration.php:738 489 497 msgid "" 490 498 "If enabled, the customer's order data will be sent to Kit. Their email address will always be subscribed to Kit, <strong>regardless of the Customer's opt in status.</strong><br />\n" … … 492 500 msgstr "" 493 501 494 #: includes/class-ckwc-integration.php: 699502 #: includes/class-ckwc-integration.php:749 495 503 msgid "Purchase Data Event" 496 504 msgstr "" 497 505 498 #: includes/class-ckwc-integration.php:7 05506 #: includes/class-ckwc-integration.php:755 499 507 msgid "When should purchase data be sent?" 500 508 msgstr "" 501 509 502 #: includes/class-ckwc-integration.php:7 30510 #: includes/class-ckwc-integration.php:780 503 511 msgid "Sync Past Orders" 504 512 msgstr "" 505 513 506 #: includes/class-ckwc-integration.php:7 31514 #: includes/class-ckwc-integration.php:781 507 515 msgid "Send old purchase data to Kit i.e. Orders that were created in WooCommerce prior to this Plugin being installed." 508 516 msgstr "" 509 517 510 #: includes/class-ckwc-integration.php:7 47518 #: includes/class-ckwc-integration.php:797 511 519 msgid "Debug" 512 520 msgstr "" 513 521 514 #: includes/class-ckwc-integration.php:7 49522 #: includes/class-ckwc-integration.php:799 515 523 msgid "Write data to a log file" 516 524 msgstr "" 517 525 518 #: includes/class-ckwc-integration.php: 754526 #: includes/class-ckwc-integration.php:804 519 527 msgid "View log file" 520 528 msgstr "" 521 529 522 #: includes/class-ckwc-integration.php:8 24530 #: includes/class-ckwc-integration.php:874 523 531 msgid "Do you want to send past WooCommerce Orders to Kit?" 524 532 msgstr "" 525 533 526 534 #. translators: Number of WooCommerce Orders 527 #: includes/class-ckwc-integration.php:10 04535 #: includes/class-ckwc-integration.php:1054 528 536 #, php-format 529 537 msgid "%s not been sent to Kit based on the Purchase Data Event setting above. This is either because sending purchase data is/was disabled, and/or orders were created prior to installing this integration.<br />Use the sync button to send data for these orders to Kit." … … 531 539 532 540 #. translators: number of Orders not sent to ConvertKit 533 #: includes/class-ckwc-integration.php:10 07541 #: includes/class-ckwc-integration.php:1057 534 542 #, php-format 535 543 msgid "%s WooCommerce order has" … … 625 633 626 634 #. translators: %1$s: PHP class name 627 #: includes/class-wp-ckwc.php:29 7635 #: includes/class-wp-ckwc.php:298 628 636 #, php-format 629 637 msgid "Kit for WooCommerce Error: Could not load Plugin class <strong>%1$s</strong>" 630 638 msgstr "" 631 639 632 #: includes/class-wp-ckwc.php:30 7640 #: includes/class-wp-ckwc.php:308 633 641 msgid "Kit for WooCommerce Error" 634 642 msgstr "" -
convertkit-for-woocommerce/trunk/readme.txt
r3369639 r3408882 4 4 Tags: email, marketing, embed form, convertkit, capture 5 5 Requires at least: 5.0 6 Tested up to: 6. 86 Tested up to: 6.9 7 7 Requires PHP: 7.1 8 Stable tag: 2.0. 18 Stable tag: 2.0.2 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 46 46 47 47 == Changelog == 48 49 ### 2.0.2 2025-12-03 50 * Fix: Settings: Automatically delete invalid Access Tokens 51 * Updated: Use WordPress Libraries 2.1.2 48 52 49 53 ### 2.0.1 2025-09-29 -
convertkit-for-woocommerce/trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php
r3369639 r3408882 378 378 if ( is_wp_error( $result ) ) { 379 379 $this->log( 'API: Error: ' . $result->get_error_message() ); 380 381 /** 382 * Perform any actions when obtaining an access token fails. 383 * 384 * @since 2.1.1 385 * 386 * @param WP_Error $result Error from API. 387 * @param string $client_id OAuth Client ID. 388 */ 389 do_action( 'convertkit_api_get_access_token_error', $result, $this->client_id ); 390 380 391 return $result; 381 392 } … … 415 426 if ( is_wp_error( $result ) ) { 416 427 $this->log( 'API: Error: ' . $result->get_error_message() ); 428 429 /** 430 * Perform any actions when refreshing an expired access token fails. 431 * 432 * @since 2.1.1 433 * 434 * @param WP_Error $result Error from API. 435 * @param string $client_id OAuth Client ID. 436 */ 437 do_action( 'convertkit_api_refresh_token_error', $result, $this->client_id ); 438 417 439 return $result; 418 440 } … … 1433 1455 // Return the API error message as a WP_Error if the HTTP response code is a 4xx code. 1434 1456 if ( $http_response_code >= 400 ) { 1457 1435 1458 // Define the error message. 1436 1459 $error = $this->get_error_message_string( $response ); … … 1439 1462 1440 1463 switch ( $http_response_code ) { 1441 // If the HTTP response code is 401, and the error matches 'The access token expired', refresh the access token now1442 // and re-attempt the request.1443 1464 case 401: 1444 if ( $error !== 'The access token expired' ) { 1445 break; 1465 switch ( $error ) { 1466 case 'The access token expired': 1467 // Attempt to refresh the access token. 1468 $result = $this->refresh_token(); 1469 1470 // If an error occured, bail. 1471 if ( is_wp_error( $result ) ) { 1472 return $result; 1473 } 1474 1475 // Attempt the request again, now we have a new access token. 1476 return $this->request( $endpoint, $method, $params, false ); 1477 1478 case 'The access token is invalid': 1479 $error = new WP_Error( 1480 'convertkit_api_error', 1481 $error, 1482 $http_response_code 1483 ); 1484 1485 /** 1486 * Perform any actions when an invalid access token was used. 1487 * 1488 * @since 2.1.1 1489 * 1490 * @param WP_Error $error WP_Error object. 1491 * @param string $client_id OAuth Client ID. 1492 */ 1493 do_action( 'convertkit_api_access_token_invalid', $error, $this->client_id ); 1494 1495 // Return error. 1496 return $error; 1497 1498 default: 1499 return new WP_Error( 1500 'convertkit_api_error', 1501 $error, 1502 $http_response_code 1503 ); 1446 1504 } 1447 1505 1448 // Don't automatically refresh the expired access token if we're not on a production environment.1449 // This prevents the same ConvertKit account used on both a staging and production site from1450 // reaching a race condition where the staging site refreshes the token first, resulting in1451 // the production site unable to later refresh its same expired access token.1452 if ( ! $this->is_production_site() ) {1453 break;1454 }1455 1456 // Refresh the access token.1457 $result = $this->refresh_token();1458 1459 // If an error occured, bail.1460 if ( is_wp_error( $result ) ) {1461 return $result;1462 }1463 1464 // Attempt the request again, now we have a new access token.1465 return $this->request( $endpoint, $method, $params, false );1466 1467 // If a rate limit was hit, maybe try again.1468 1506 case 429: 1469 1507 // If retry on rate limit hit is disabled, return a WP_Error. … … 1489 1527 1490 1528 return $response; 1491 1492 }1493 1494 /**1495 * Helper method to determine the WordPress environment type, checking1496 * if the wp_get_environment_type() function exists in WordPress (versions1497 * older than WordPress 5.5 won't have this function).1498 *1499 * @since 2.0.21500 *1501 * @return bool1502 */1503 private function is_production_site() {1504 1505 // If the WordPress wp_get_environment_type() function isn't available,1506 // assume this is a production site.1507 if ( ! function_exists( 'wp_get_environment_type' ) ) {1508 return true;1509 }1510 1511 return ( wp_get_environment_type() === 'production' );1512 1529 1513 1530 } -
convertkit-for-woocommerce/trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php
r3112082 r3408882 117 117 // would never expire. 118 118 if ( ! $this->last_queried ) { 119 $this->refresh(); 120 return; 119 return $this->refresh(); 121 120 } 122 121 123 122 // If the resources have expired, refresh them now. 124 123 if ( time() > ( $this->last_queried + $this->cache_duration ) ) { 125 $this->refresh(); 126 return; 124 return $this->refresh(); 127 125 } 128 126 … … 345 343 * @since 1.0.0 346 344 * 347 * @return bool|WP_Error|array345 * @return WP_Error|array 348 346 */ 349 347 public function refresh() { … … 351 349 // Bail if no API class was defined. 352 350 if ( ! $this->api ) { 353 return false;351 return new WP_Error( 'convertkit_resource_refresh_error', 'Connect the Plugin to your Kit account to refresh resources.' ); 354 352 } 355 353 -
convertkit-for-woocommerce/trunk/woocommerce-convertkit.php
r3369639 r3408882 10 10 * Plugin URI: https://www.kit.com 11 11 * Description: Integrates WooCommerce with Kit, allowing customers to be automatically sent to your Kit account. 12 * Version: 2.0. 112 * Version: 2.0.2 13 13 * Author: Kit 14 14 * Author URI: https://www.kit.com … … 31 31 define( 'CKWC_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 32 32 define( 'CKWC_PLUGIN_PATH', __DIR__ ); 33 define( 'CKWC_PLUGIN_VERSION', '2.0. 1' );33 define( 'CKWC_PLUGIN_VERSION', '2.0.2' ); 34 34 define( 'CKWC_OAUTH_CLIENT_ID', 'L0kyADsB3WP5zO5MvUpXQU64gIntQg9BBAIme17r_7A' ); 35 35 define( 'CKWC_OAUTH_CLIENT_REDIRECT_URI', 'https://app.kit.com/wordpress/redirect' ); … … 53 53 require_once CKWC_PLUGIN_PATH . '/includes/functions.php'; 54 54 require_once CKWC_PLUGIN_PATH . '/includes/class-wp-ckwc.php'; 55 require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-admin-notices.php'; 55 56 require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-api.php'; 56 57 require_once CKWC_PLUGIN_PATH . '/includes/class-ckwc-checkout.php';
Note: See TracChangeset
for help on using the changeset viewer.