Changeset 3747607
- Timestamp:
- 10/15/2026 04:39:06 AM (10 days ago)
- Location:
- integrate-convertkit-wpforms
- Files:
-
- 16 edited
- 1 copied
-
tags/2.0.1 (copied) (copied from integrate-convertkit-wpforms/trunk )
-
tags/2.0.1/includes/class-integrate-convertkit-wpforms.php (modified) (1 diff)
-
tags/2.0.1/includes/functions.php (modified) (1 diff)
-
tags/2.0.1/integrate-convertkit-wpforms.php (modified) (2 diffs)
-
tags/2.0.1/languages/integrate-convertkit-wpforms.pot (modified) (2 diffs)
-
tags/2.0.1/readme.txt (modified) (2 diffs)
-
tags/2.0.1/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php (modified) (5 diffs)
-
tags/2.0.1/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php (modified) (7 diffs)
-
tags/2.0.1/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php (modified) (4 diffs)
-
trunk/includes/class-integrate-convertkit-wpforms.php (modified) (1 diff)
-
trunk/includes/functions.php (modified) (1 diff)
-
trunk/integrate-convertkit-wpforms.php (modified) (2 diffs)
-
trunk/languages/integrate-convertkit-wpforms.pot (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php (modified) (5 diffs)
-
trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php (modified) (7 diffs)
-
trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
integrate-convertkit-wpforms/tags/2.0.1/includes/class-integrate-convertkit-wpforms.php
r3728375 r3747607 938 938 // If this request is served in a popup window (i.e. from the form builder), 939 939 // serve a view that will close the popup. 940 if ( array_key_exists( ' convertkit-modal', $_REQUEST ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended940 if ( array_key_exists( 'kit-modal', $_REQUEST ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 941 941 require INTEGRATE_CONVERTKIT_WPFORMS_PATH . '/views/backend/close-modal.php'; 942 942 exit(); -
integrate-convertkit-wpforms/tags/2.0.1/includes/functions.php
r3728375 r3747607 169 169 // Close the popup window once connected, if the OAuth flow started in the form builder. 170 170 if ( $modal ) { 171 $args[' convertkit-modal'] = '1';171 $args['kit-modal'] = '1'; 172 172 } 173 173 -
integrate-convertkit-wpforms/tags/2.0.1/integrate-convertkit-wpforms.php
r3728375 r3747607 10 10 * Plugin URI: https://kit.com 11 11 * Description: Create Kit signup forms using WPForms 12 * Version: 2.0. 012 * Version: 2.0.1 13 13 * Author: Kit 14 14 * Author URI: https://kit.com … … 29 29 define( 'INTEGRATE_CONVERTKIT_WPFORMS_URL', plugin_dir_url( __FILE__ ) ); 30 30 define( 'INTEGRATE_CONVERTKIT_WPFORMS_PATH', __DIR__ ); 31 define( 'INTEGRATE_CONVERTKIT_WPFORMS_VERSION', '2.0. 0' );31 define( 'INTEGRATE_CONVERTKIT_WPFORMS_VERSION', '2.0.1' ); 32 32 define( 'INTEGRATE_CONVERTKIT_WPFORMS_OAUTH_CLIENT_ID', '147qqKJeENYp5MqgL6AOShDDcLK3UQeClmcIV1ij3gI' ); 33 33 define( 'INTEGRATE_CONVERTKIT_WPFORMS_OAUTH_REDIRECT_URI', 'https://app.kit.com/wordpress/redirect' ); -
integrate-convertkit-wpforms/tags/2.0.1/languages/integrate-convertkit-wpforms.pot
r3728375 r3747607 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Kit (formerly ConvertKit) for WPForms 2.0. 0\n"5 "Project-Id-Version: Kit (formerly ConvertKit) for WPForms 2.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/convertkit-wpforms\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: 2026-10- 05T02:23:48+00:00\n"12 "POT-Creation-Date: 2026-10-14T07:52:48+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" -
integrate-convertkit-wpforms/tags/2.0.1/readme.txt
r3728375 r3747607 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.1 8 Stable tag: 2.0. 08 Stable tag: 2.0.1 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 45 45 46 46 == Changelog == 47 48 ### 2.0.1 2026-10-15 49 * Updated: OAuth: Use `kit-modal` parameter when connecting to Kit from the form builder 50 * Updated: WordPress Libraries to 2.8.0 47 51 48 52 ### 2.0.0 2026-10-05 -
integrate-convertkit-wpforms/tags/2.0.1/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php
r3698141 r3747607 2238 2238 * @since 2.0.0 2239 2239 * 2240 * @see https://developers.kit.com/api-reference/webhooks /list-webhooks2240 * @see https://developers.kit.com/api-reference/webhooks-legacy/list-webhooks 2241 2241 * 2242 2242 * @return false|mixed … … 2268 2268 * @param string $parameter Optional parameter depending on the event. 2269 2269 * 2270 * @see https://developers.kit.com/api-reference/webhooks /create-a-webhook2270 * @see https://developers.kit.com/api-reference/webhooks-legacy/create-a-webhook 2271 2271 * 2272 2272 * @throws \InvalidArgumentException If the event is not supported. … … 2351 2351 * @param integer $id Webhook ID. 2352 2352 * 2353 * @see https://developers.kit.com/api-reference/webhooks /delete-a-webhook2353 * @see https://developers.kit.com/api-reference/webhooks-legacy/delete-a-webhook 2354 2354 * 2355 2355 * @return mixed|object … … 2358 2358 { 2359 2359 return $this->delete(sprintf('webhooks/%s', $id)); 2360 } 2361 2362 /** 2363 * List webhook endpoints. 2364 * 2365 * Webhook endpoints supersede the legacy webhooks resource. Use these methods for 2366 * new integrations; get_webhooks(), create_webhook() and delete_webhook() continue 2367 * to work against the legacy resource. 2368 * 2369 * @param string $status Endpoint status (active|disabled). 2370 * @param boolean $include_total_count To include the total count of records in the response, use true. 2371 * @param string $after_cursor Return results after the given pagination cursor. 2372 * @param string $before_cursor Return results before the given pagination cursor. 2373 * @param integer $per_page Number of results to return. 2374 * 2375 * @since 2.8.0 2376 * 2377 * @see https://developers.kit.com/api-reference/webhooks/list-webhook-endpoints 2378 * 2379 * @return false|mixed 2380 */ 2381 public function get_webhook_endpoints( 2382 string $status = '', 2383 bool $include_total_count = false, 2384 string $after_cursor = '', 2385 string $before_cursor = '', 2386 int $per_page = 100 2387 ) { 2388 // Build parameters. 2389 $options = []; 2390 2391 if (!empty($status)) { 2392 $options['status'] = $status; 2393 } 2394 2395 // Send request. 2396 return $this->get( 2397 'webhook_endpoints', 2398 $this->build_total_count_and_pagination_params( 2399 $options, 2400 $include_total_count, 2401 $after_cursor, 2402 $before_cursor, 2403 $per_page 2404 ) 2405 ); 2406 } 2407 2408 /** 2409 * Create a webhook endpoint. 2410 * 2411 * The signing secret is returned in this response only, and cannot be fetched again. 2412 * Store it to verify the signature of deliveries sent to this endpoint. 2413 * 2414 * @param string $url URL to receive deliveries. Must be publicly reachable. 2415 * @param array<string> $events Event types to subscribe to e.g. subscriber.created. 2416 * @param string $name Name of the webhook endpoint. 2417 * @param string $description Description of the webhook endpoint. 2418 * 2419 * @since 2.8.0 2420 * 2421 * @see https://developers.kit.com/api-reference/webhooks/create-a-webhook-endpoint 2422 * 2423 * @return mixed|object 2424 */ 2425 public function create_webhook_endpoint( 2426 string $url, 2427 array $events, 2428 string $name = '', 2429 string $description = '' 2430 ) { 2431 // Build parameters. 2432 $options = [ 2433 'url' => $url, 2434 'events' => $events, 2435 ]; 2436 2437 if (!empty($name)) { 2438 $options['name'] = $name; 2439 } 2440 if (!empty($description)) { 2441 $options['description'] = $description; 2442 } 2443 2444 // Send request. 2445 return $this->post( 2446 'webhook_endpoints', 2447 $options 2448 ); 2449 } 2450 2451 /** 2452 * Get a webhook endpoint. 2453 * 2454 * The signing secret is never included in this response. 2455 * 2456 * @param integer $id Webhook Endpoint ID. 2457 * 2458 * @since 2.8.0 2459 * 2460 * @see https://developers.kit.com/api-reference/webhooks/get-a-webhook-endpoint 2461 * 2462 * @return mixed|object 2463 */ 2464 public function get_webhook_endpoint(int $id) 2465 { 2466 return $this->get(sprintf('webhook_endpoints/%s', $id)); 2467 } 2468 2469 /** 2470 * Update a webhook endpoint. 2471 * 2472 * Only the supplied parameters are sent, leaving any other values unchanged. 2473 * $events replaces the endpoint's entire subscription list, so specify the 2474 * full set of event types to subscribe to, not just additions. 2475 * 2476 * @param integer $id Webhook Endpoint ID. 2477 * @param string|null $name Name of the webhook endpoint. 2478 * @param string|null $url URL to receive deliveries. Must be publicly reachable. 2479 * @param string|null $description Description of the webhook endpoint. 2480 * @param string|null $status Endpoint status (active|disabled). 2481 * @param array<string>|null $events Event types to subscribe to e.g. subscriber.created. 2482 * 2483 * @since 2.8.0 2484 * 2485 * @see https://developers.kit.com/api-reference/webhooks/update-a-webhook-endpoint 2486 * 2487 * @return mixed|object 2488 */ 2489 public function update_webhook_endpoint( 2490 int $id, 2491 ?string $name = null, 2492 ?string $url = null, 2493 ?string $description = null, 2494 ?string $status = null, 2495 ?array $events = null 2496 ) { 2497 // Build parameters, omitting any that weren't specified. 2498 $options = []; 2499 2500 if (!is_null($name)) { 2501 $options['name'] = $name; 2502 } 2503 if (!is_null($url)) { 2504 $options['url'] = $url; 2505 } 2506 if (!is_null($description)) { 2507 $options['description'] = $description; 2508 } 2509 if (!is_null($status)) { 2510 $options['status'] = $status; 2511 } 2512 if (!is_null($events)) { 2513 $options['events'] = $events; 2514 } 2515 2516 // Send request. 2517 return $this->patch( 2518 sprintf('webhook_endpoints/%s', $id), 2519 $options 2520 ); 2521 } 2522 2523 /** 2524 * Delete a webhook endpoint. 2525 * 2526 * To stop deliveries without deleting the endpoint, use update_webhook_endpoint() 2527 * to set the endpoint's status to disabled. 2528 * 2529 * @param integer $id Webhook Endpoint ID. 2530 * 2531 * @since 2.8.0 2532 * 2533 * @see https://developers.kit.com/api-reference/webhooks/delete-a-webhook-endpoint 2534 * 2535 * @return mixed|object 2536 */ 2537 public function delete_webhook_endpoint(int $id) 2538 { 2539 return $this->delete(sprintf('webhook_endpoints/%s', $id)); 2540 } 2541 2542 /** 2543 * Rotate a webhook endpoint's signing secret. 2544 * 2545 * The new signing secret is returned in this response only, and cannot be fetched 2546 * again. The previous secret continues to verify deliveries until the endpoint's 2547 * previous_secret_expires_at, with deliveries signed by both secrets until then. 2548 * 2549 * Rotating whilst a previous rotation's overlap window is still open returns an 2550 * error; specify $force to rotate anyway, expiring the older secret immediately. 2551 * 2552 * @param integer $id Webhook Endpoint ID. 2553 * @param boolean $force Rotate even if the previous rotation's overlap window is open. 2554 * 2555 * @since 2.8.0 2556 * 2557 * @see https://developers.kit.com/api-reference/webhooks/rotate-a-webhook-endpoint-secret 2558 * 2559 * @return mixed|object 2560 */ 2561 public function rotate_webhook_endpoint_secret(int $id, bool $force = false) 2562 { 2563 // Build parameters. 2564 $options = []; 2565 2566 if ($force) { 2567 $options['force'] = true; 2568 } 2569 2570 // Send request. 2571 return $this->post( 2572 sprintf('webhook_endpoints/%s/rotate_secret', $id), 2573 $options 2574 ); 2575 } 2576 2577 /** 2578 * Revoke a webhook endpoint's previous signing secret. 2579 * 2580 * Closes a rotation's overlap window early, so that only the current secret 2581 * verifies deliveries. 2582 * 2583 * @param integer $id Webhook Endpoint ID. 2584 * 2585 * @since 2.8.0 2586 * 2587 * @see https://developers.kit.com/api-reference/webhooks/revoke-the-previous-webhook-endpoint-secret 2588 * 2589 * @return mixed|object 2590 */ 2591 public function revoke_webhook_endpoint_previous_secret(int $id) 2592 { 2593 return $this->post(sprintf('webhook_endpoints/%s/revoke_previous_secret', $id)); 2594 } 2595 2596 /** 2597 * Verify the signature of a webhook endpoint delivery. 2598 * 2599 * Kit signs each delivery with the endpoint's signing secret, sending the timestamp 2600 * and one or more signatures in the X-Kit-Signature header. Deliveries are signed 2601 * with both the current and previous secret whilst a rotation's overlap window is 2602 * open, so any one signature matching means the delivery is valid. 2603 * 2604 * $payload must be the raw request body, byte for byte. Decoding and re-encoding it 2605 * changes whitespace and key order, which produces a different signature. 2606 * 2607 * @param string $payload Raw request body. 2608 * @param string $signature_header X-Kit-Signature header value. 2609 * @param string $secret Webhook endpoint signing secret. 2610 * @param integer $tolerance Maximum permitted age of the delivery, in seconds. 2611 * 2612 * @since 2.8.0 2613 * 2614 * @see https://developers.kit.com/webhooks/verifying-signatures 2615 * 2616 * @return boolean 2617 */ 2618 public function verify_webhook_signature( 2619 string $payload, 2620 string $signature_header, 2621 string $secret, 2622 int $tolerance = 300 2623 ) { 2624 // Parse the header into its timestamp and signatures. 2625 $timestamp = ''; 2626 $signatures = []; 2627 2628 foreach (explode(',', $signature_header) as $part) { 2629 $part = trim($part); 2630 2631 if (strpos($part, 't=') === 0) { 2632 $timestamp = substr($part, 2); 2633 continue; 2634 } 2635 2636 if (strpos($part, 'v1=') === 0) { 2637 $signatures[] = substr($part, 3); 2638 } 2639 } 2640 2641 // Bail if the header didn't include a timestamp and at least one signature. 2642 if (!is_numeric($timestamp) || !count($signatures)) { 2643 return false; 2644 } 2645 2646 // Bail if the delivery is older than the permitted tolerance, to prevent replays. 2647 if (abs((time() - (int) $timestamp)) > $tolerance) { 2648 return false; 2649 } 2650 2651 // Build the signature we expect for this payload. 2652 $expected = hash_hmac('sha256', $timestamp . '.' . $payload, $secret); 2653 2654 // The delivery is valid if any of its signatures match. 2655 foreach ($signatures as $signature) { 2656 if (hash_equals($expected, $signature)) { 2657 return true; 2658 } 2659 } 2660 2661 return false; 2360 2662 } 2361 2663 … … 2801 3103 2802 3104 /** 3105 * Performs a PATCH request to the API. 3106 * 3107 * @param string $endpoint API Endpoint. 3108 * @param array<string, bool|integer|float|string|null|array<int|string, bool|integer|float|string>> $args Request arguments. 3109 * 3110 * @since 2.8.0 3111 * 3112 * @return false|mixed 3113 */ 3114 public function patch(string $endpoint, array $args = []) 3115 { 3116 return $this->request($endpoint, 'PATCH', $args); 3117 } 3118 3119 /** 2803 3120 * Performs a DELETE request to the API. 2804 3121 * -
integrate-convertkit-wpforms/tags/2.0.1/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php
r3654577 r3747607 113 113 */ 114 114 protected $api_endpoints_wordpress = array( 115 'posts',116 115 'products', 117 116 'profile/', … … 173 172 // phpcs:disable 174 173 $this->error_messages = array( 175 // get_all_posts().176 'get_all_posts_posts_per_request_bound_too_low' => __( 'get_all_posts(): the posts_per_request parameter must be equal to or greater than 1.', 'convertkit' ),177 'get_all_posts_posts_per_request_bound_too_high' => __( 'get_all_posts(): the posts_per_request parameter must be equal to or less than 50.', 'convertkit' ),178 179 // get_posts().180 'get_posts_page_parameter_bound_too_low' => __( 'get_posts(): the page parameter must be equal to or greater than 1.', 'convertkit' ),181 'get_posts_per_page_parameter_bound_too_low' => __( 'get_posts(): the per_page parameter must be equal to or greater than 1.', 'convertkit' ),182 'get_posts_per_page_parameter_bound_too_high' => __( 'get_posts(): the per_page parameter must be equal to or less than 50.', 'convertkit' ),183 184 174 // subscriber_authentication_send_code(). 185 175 'subscriber_authentication_send_code_email_empty' => __( 'subscriber_authentication_send_code(): the email parameter is empty.', 'convertkit' ), … … 757 747 ) 758 748 ); 759 760 }761 762 /**763 * Gets all posts from the API.764 *765 * @since 1.0.0766 *767 * @param int $posts_per_request Number of Posts to fetch in each request.768 * @return WP_Error|array769 */770 public function get_all_posts( $posts_per_request = 50 ) {771 772 // Sanitize some parameters.773 $posts_per_request = absint( $posts_per_request );774 775 // Sanity check that parameters aren't outside of the bounds as defined by the API.776 if ( $posts_per_request < 1 ) {777 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_all_posts_posts_per_request_bound_too_low' ) );778 }779 if ( $posts_per_request > 50 ) {780 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_all_posts_posts_per_request_bound_too_high' ) );781 }782 783 // Define an array to store the posts in.784 $posts = array();785 786 // Mock the response to start the while loop.787 $response = array(788 'page' => 0, // Start on page zero, as the below loop will add 1 to this.789 'total_pages' => 1, // We always know there will be one page of posts.790 );791 792 // Iterate through each page of posts.793 while ( absint( $response['total_pages'] ) >= absint( $response['page'] ) + 1 ) {794 // Fetch posts.795 $response = $this->get_posts( absint( $response['page'] ) + 1, $posts_per_request );796 797 // Bail if an error occured.798 if ( is_wp_error( $response ) ) {799 return $response;800 }801 802 // Exit loop if no posts exist.803 if ( ! count( $response ) ) {804 break;805 }806 807 // Append posts to array.808 foreach ( $response['posts'] as $post ) {809 $posts[ $post['id'] ] = $post;810 }811 }812 813 // If no posts exist, log an error.814 if ( ! count( $posts ) ) {815 $this->log( 'API: get_posts(): Error: No broadcasts exist in ConvertKit.' );816 }817 818 // Return posts.819 return $posts;820 749 821 750 } … … 886 815 887 816 /** 888 * Gets posts from the API.889 *890 * @since 1.0.0891 *892 * @param int $page Page number.893 * @param int $per_page Number of Posts to return.894 * @return WP_Error|array895 */896 public function get_posts( $page = 1, $per_page = 10 ) {897 898 // Sanitize some parameters.899 $page = absint( $page );900 $per_page = absint( $per_page );901 902 // Sanity check that parameters aren't outside of the bounds as defined by the API.903 if ( $page < 1 ) {904 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_posts_page_parameter_bound_too_low' ) );905 }906 if ( $per_page < 1 ) {907 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_posts_per_page_parameter_bound_too_low' ) );908 }909 if ( $per_page > 50 ) {910 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_posts_per_page_parameter_bound_too_high' ) );911 }912 913 $posts = array();914 915 // Send request.916 $response = $this->get(917 'posts',918 array(919 'page' => $page,920 'per_page' => $per_page,921 )922 );923 924 // If an error occured, return WP_Error.925 if ( is_wp_error( $response ) ) {926 $this->log( 'API: get_posts(): Error: ' . $response->get_error_message() );927 return $response;928 }929 930 // If the response isn't an array as we expect, log that no posts exist and return a blank array.931 if ( ! is_array( $response['posts'] ) ) {932 $this->log( 'API: get_posts(): Error: No broadcasts exist in ConvertKit.' );933 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'response_type_unexpected' ) );934 }935 936 // If no posts exist, log that no posts exist and return a blank array.937 if ( ! count( $response['posts'] ) ) {938 $this->log( 'API: get_posts(): Error: No broadcasts exist in ConvertKit.' );939 return $posts;940 }941 942 return $response;943 944 }945 946 /**947 * Gets a specific post.948 *949 * @since 1.3.8950 *951 * @param int $post_id Post ID.952 * @return WP_Error|array953 */954 public function get_post( $post_id ) {955 956 // Send request.957 $response = $this->get(958 sprintf( 'posts/%s', $post_id )959 );960 961 // If an error occured, return WP_Error.962 if ( is_wp_error( $response ) ) {963 $this->log( 'API: get_posts(): Error: ' . $response->get_error_message() );964 return $response;965 }966 967 // If the response contains a message, an error occured.968 // Log and return it now.969 if ( array_key_exists( 'message', $response ) ) {970 $error = new WP_Error(971 'convertkit_api_error',972 $response['message']973 );974 975 $this->log( 'API: get_post(): Error: ' . $error->get_error_message() );976 return $error;977 }978 979 return $response['post'];980 981 }982 983 /**984 817 * Fetches all products from the API. 985 818 * … … 1531 1364 break; 1532 1365 1366 case 'patch': 1367 $result = wp_remote_request( 1368 $this->get_api_url( $endpoint ), 1369 array( 1370 'method' => 'PATCH', 1371 'headers' => $this->get_request_headers(), 1372 'body' => wp_json_encode( $params ), 1373 'timeout' => $this->get_timeout(), 1374 'user-agent' => $this->get_user_agent(), 1375 ) 1376 ); 1377 break; 1378 1533 1379 case 'delete': 1534 1380 $result = wp_remote_request( … … 1855 1701 // For some specific API endpoints created primarily for the WordPress Plugin, the API base is 1856 1702 // https://api.kit.com/wordpress/$endpoint. 1857 // We perform a string search instead of in_array(), because the $endpoint might be e.g. 1858 // profile/{subscriber_id} or subscriber_authentication/send_code. 1703 // We match on the start of the $endpoint instead of in_array(), because the $endpoint might be 1704 // e.g. profile/{subscriber_id} or subscriber_authentication/send_code. Matching anywhere in the 1705 // $endpoint would wrongly match v4 endpoints that contain one of these names in a later segment, 1706 // such as webhook_endpoints/{id}/revoke_previous_secret. 1859 1707 foreach ( $this->api_endpoints_wordpress as $wordpress_endpoint ) { 1860 if ( strpos( $endpoint, $wordpress_endpoint ) !== false) {1708 if ( strpos( $endpoint, $wordpress_endpoint ) === 0 ) { 1861 1709 return path_join( $this->api_url_base . 'wordpress', $endpoint ); // phpcs:ignore WordPress.WP.CapitalPDangit 1862 1710 } … … 1865 1713 // For oAuth API endpoints, the API base is https://api.kit.com/oauth/$endpoint. 1866 1714 foreach ( $this->api_endpoints_oauth as $oauth_endpoint ) { 1867 if ( strpos( $endpoint, $oauth_endpoint ) !== false) {1715 if ( strpos( $endpoint, $oauth_endpoint ) === 0 ) { 1868 1716 return path_join( $this->api_url_base . 'oauth', $endpoint ); 1869 1717 } -
integrate-convertkit-wpforms/tags/2.0.1/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php
r3654577 r3747607 393 393 case 'sequences': 394 394 case 'custom_fields': 395 case 'posts': 395 396 $results = $this->get_all_resources( $this->type ); 396 break;397 398 case 'posts':399 $results = $this->api->get_all_posts();400 397 break; 401 398 … … 567 564 case 'legacy_landing_pages': 568 565 $args = array( 566 false, 567 '', 568 '', 569 $per_page, 570 ); 571 break; 572 573 case 'posts': 574 $args = array( 575 false, // Don't include post content. 569 576 false, 570 577 '', … … 649 656 break; 650 657 658 case 'posts': 659 $args = array( 660 false, // Don't include post content. 661 false, 662 $response['pagination']['end_cursor'], 663 '', 664 $per_page, 665 ); 666 break; 667 651 668 case 'tags': 652 669 case 'sequences': … … 720 737 721 738 foreach ( $response[ $type ] as $item ) { 722 // Exclude Forms that have a null `format` value, as they are Creator Profile / Creator Network 723 // forms that we don't need in WordPress. 724 // Legacy forms don't have a `format` key, and we always want to include them in the resultset. 725 if ( $resource_type === 'forms' && array_key_exists( 'format', $item ) && is_null( $item['format'] ) ) { 726 continue; 739 switch ( $resource_type ) { 740 case 'forms': 741 // Exclude Forms that have a null `format` value, as they are Creator Profile / Creator Network 742 // forms that we don't need in WordPress. 743 // Legacy forms don't have a `format` key, and we always want to include them in the resultset. 744 if ( array_key_exists( 'format', $item ) && is_null( $item['format'] ) ) { 745 continue 2; 746 } 747 break; 748 749 case 'posts': 750 // Exclude Posts that have a null `published_at` value or aren't published, as they 751 // are draft or scheduled Posts that aren't yet publicly viewable and therefore 752 // shouldn't be displayed or imported in WordPress. 753 if ( ! array_key_exists( 'published_at', $item ) || is_null( $item['published_at'] ) ) { 754 continue 2; 755 } 756 if ( ! array_key_exists( 'status', $item ) || $item['status'] !== 'published' ) { 757 continue 2; 758 } 759 break; 727 760 } 728 761 -
integrate-convertkit-wpforms/trunk/includes/class-integrate-convertkit-wpforms.php
r3728375 r3747607 938 938 // If this request is served in a popup window (i.e. from the form builder), 939 939 // serve a view that will close the popup. 940 if ( array_key_exists( ' convertkit-modal', $_REQUEST ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended940 if ( array_key_exists( 'kit-modal', $_REQUEST ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended 941 941 require INTEGRATE_CONVERTKIT_WPFORMS_PATH . '/views/backend/close-modal.php'; 942 942 exit(); -
integrate-convertkit-wpforms/trunk/includes/functions.php
r3728375 r3747607 169 169 // Close the popup window once connected, if the OAuth flow started in the form builder. 170 170 if ( $modal ) { 171 $args[' convertkit-modal'] = '1';171 $args['kit-modal'] = '1'; 172 172 } 173 173 -
integrate-convertkit-wpforms/trunk/integrate-convertkit-wpforms.php
r3728375 r3747607 10 10 * Plugin URI: https://kit.com 11 11 * Description: Create Kit signup forms using WPForms 12 * Version: 2.0. 012 * Version: 2.0.1 13 13 * Author: Kit 14 14 * Author URI: https://kit.com … … 29 29 define( 'INTEGRATE_CONVERTKIT_WPFORMS_URL', plugin_dir_url( __FILE__ ) ); 30 30 define( 'INTEGRATE_CONVERTKIT_WPFORMS_PATH', __DIR__ ); 31 define( 'INTEGRATE_CONVERTKIT_WPFORMS_VERSION', '2.0. 0' );31 define( 'INTEGRATE_CONVERTKIT_WPFORMS_VERSION', '2.0.1' ); 32 32 define( 'INTEGRATE_CONVERTKIT_WPFORMS_OAUTH_CLIENT_ID', '147qqKJeENYp5MqgL6AOShDDcLK3UQeClmcIV1ij3gI' ); 33 33 define( 'INTEGRATE_CONVERTKIT_WPFORMS_OAUTH_REDIRECT_URI', 'https://app.kit.com/wordpress/redirect' ); -
integrate-convertkit-wpforms/trunk/languages/integrate-convertkit-wpforms.pot
r3728375 r3747607 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Kit (formerly ConvertKit) for WPForms 2.0. 0\n"5 "Project-Id-Version: Kit (formerly ConvertKit) for WPForms 2.0.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/convertkit-wpforms\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: 2026-10- 05T02:23:48+00:00\n"12 "POT-Creation-Date: 2026-10-14T07:52:48+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" -
integrate-convertkit-wpforms/trunk/readme.txt
r3728375 r3747607 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.1 8 Stable tag: 2.0. 08 Stable tag: 2.0.1 9 9 License: GPLv3 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 45 45 46 46 == Changelog == 47 48 ### 2.0.1 2026-10-15 49 * Updated: OAuth: Use `kit-modal` parameter when connecting to Kit from the form builder 50 * Updated: WordPress Libraries to 2.8.0 47 51 48 52 ### 2.0.0 2026-10-05 -
integrate-convertkit-wpforms/trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-traits.php
r3698141 r3747607 2238 2238 * @since 2.0.0 2239 2239 * 2240 * @see https://developers.kit.com/api-reference/webhooks /list-webhooks2240 * @see https://developers.kit.com/api-reference/webhooks-legacy/list-webhooks 2241 2241 * 2242 2242 * @return false|mixed … … 2268 2268 * @param string $parameter Optional parameter depending on the event. 2269 2269 * 2270 * @see https://developers.kit.com/api-reference/webhooks /create-a-webhook2270 * @see https://developers.kit.com/api-reference/webhooks-legacy/create-a-webhook 2271 2271 * 2272 2272 * @throws \InvalidArgumentException If the event is not supported. … … 2351 2351 * @param integer $id Webhook ID. 2352 2352 * 2353 * @see https://developers.kit.com/api-reference/webhooks /delete-a-webhook2353 * @see https://developers.kit.com/api-reference/webhooks-legacy/delete-a-webhook 2354 2354 * 2355 2355 * @return mixed|object … … 2358 2358 { 2359 2359 return $this->delete(sprintf('webhooks/%s', $id)); 2360 } 2361 2362 /** 2363 * List webhook endpoints. 2364 * 2365 * Webhook endpoints supersede the legacy webhooks resource. Use these methods for 2366 * new integrations; get_webhooks(), create_webhook() and delete_webhook() continue 2367 * to work against the legacy resource. 2368 * 2369 * @param string $status Endpoint status (active|disabled). 2370 * @param boolean $include_total_count To include the total count of records in the response, use true. 2371 * @param string $after_cursor Return results after the given pagination cursor. 2372 * @param string $before_cursor Return results before the given pagination cursor. 2373 * @param integer $per_page Number of results to return. 2374 * 2375 * @since 2.8.0 2376 * 2377 * @see https://developers.kit.com/api-reference/webhooks/list-webhook-endpoints 2378 * 2379 * @return false|mixed 2380 */ 2381 public function get_webhook_endpoints( 2382 string $status = '', 2383 bool $include_total_count = false, 2384 string $after_cursor = '', 2385 string $before_cursor = '', 2386 int $per_page = 100 2387 ) { 2388 // Build parameters. 2389 $options = []; 2390 2391 if (!empty($status)) { 2392 $options['status'] = $status; 2393 } 2394 2395 // Send request. 2396 return $this->get( 2397 'webhook_endpoints', 2398 $this->build_total_count_and_pagination_params( 2399 $options, 2400 $include_total_count, 2401 $after_cursor, 2402 $before_cursor, 2403 $per_page 2404 ) 2405 ); 2406 } 2407 2408 /** 2409 * Create a webhook endpoint. 2410 * 2411 * The signing secret is returned in this response only, and cannot be fetched again. 2412 * Store it to verify the signature of deliveries sent to this endpoint. 2413 * 2414 * @param string $url URL to receive deliveries. Must be publicly reachable. 2415 * @param array<string> $events Event types to subscribe to e.g. subscriber.created. 2416 * @param string $name Name of the webhook endpoint. 2417 * @param string $description Description of the webhook endpoint. 2418 * 2419 * @since 2.8.0 2420 * 2421 * @see https://developers.kit.com/api-reference/webhooks/create-a-webhook-endpoint 2422 * 2423 * @return mixed|object 2424 */ 2425 public function create_webhook_endpoint( 2426 string $url, 2427 array $events, 2428 string $name = '', 2429 string $description = '' 2430 ) { 2431 // Build parameters. 2432 $options = [ 2433 'url' => $url, 2434 'events' => $events, 2435 ]; 2436 2437 if (!empty($name)) { 2438 $options['name'] = $name; 2439 } 2440 if (!empty($description)) { 2441 $options['description'] = $description; 2442 } 2443 2444 // Send request. 2445 return $this->post( 2446 'webhook_endpoints', 2447 $options 2448 ); 2449 } 2450 2451 /** 2452 * Get a webhook endpoint. 2453 * 2454 * The signing secret is never included in this response. 2455 * 2456 * @param integer $id Webhook Endpoint ID. 2457 * 2458 * @since 2.8.0 2459 * 2460 * @see https://developers.kit.com/api-reference/webhooks/get-a-webhook-endpoint 2461 * 2462 * @return mixed|object 2463 */ 2464 public function get_webhook_endpoint(int $id) 2465 { 2466 return $this->get(sprintf('webhook_endpoints/%s', $id)); 2467 } 2468 2469 /** 2470 * Update a webhook endpoint. 2471 * 2472 * Only the supplied parameters are sent, leaving any other values unchanged. 2473 * $events replaces the endpoint's entire subscription list, so specify the 2474 * full set of event types to subscribe to, not just additions. 2475 * 2476 * @param integer $id Webhook Endpoint ID. 2477 * @param string|null $name Name of the webhook endpoint. 2478 * @param string|null $url URL to receive deliveries. Must be publicly reachable. 2479 * @param string|null $description Description of the webhook endpoint. 2480 * @param string|null $status Endpoint status (active|disabled). 2481 * @param array<string>|null $events Event types to subscribe to e.g. subscriber.created. 2482 * 2483 * @since 2.8.0 2484 * 2485 * @see https://developers.kit.com/api-reference/webhooks/update-a-webhook-endpoint 2486 * 2487 * @return mixed|object 2488 */ 2489 public function update_webhook_endpoint( 2490 int $id, 2491 ?string $name = null, 2492 ?string $url = null, 2493 ?string $description = null, 2494 ?string $status = null, 2495 ?array $events = null 2496 ) { 2497 // Build parameters, omitting any that weren't specified. 2498 $options = []; 2499 2500 if (!is_null($name)) { 2501 $options['name'] = $name; 2502 } 2503 if (!is_null($url)) { 2504 $options['url'] = $url; 2505 } 2506 if (!is_null($description)) { 2507 $options['description'] = $description; 2508 } 2509 if (!is_null($status)) { 2510 $options['status'] = $status; 2511 } 2512 if (!is_null($events)) { 2513 $options['events'] = $events; 2514 } 2515 2516 // Send request. 2517 return $this->patch( 2518 sprintf('webhook_endpoints/%s', $id), 2519 $options 2520 ); 2521 } 2522 2523 /** 2524 * Delete a webhook endpoint. 2525 * 2526 * To stop deliveries without deleting the endpoint, use update_webhook_endpoint() 2527 * to set the endpoint's status to disabled. 2528 * 2529 * @param integer $id Webhook Endpoint ID. 2530 * 2531 * @since 2.8.0 2532 * 2533 * @see https://developers.kit.com/api-reference/webhooks/delete-a-webhook-endpoint 2534 * 2535 * @return mixed|object 2536 */ 2537 public function delete_webhook_endpoint(int $id) 2538 { 2539 return $this->delete(sprintf('webhook_endpoints/%s', $id)); 2540 } 2541 2542 /** 2543 * Rotate a webhook endpoint's signing secret. 2544 * 2545 * The new signing secret is returned in this response only, and cannot be fetched 2546 * again. The previous secret continues to verify deliveries until the endpoint's 2547 * previous_secret_expires_at, with deliveries signed by both secrets until then. 2548 * 2549 * Rotating whilst a previous rotation's overlap window is still open returns an 2550 * error; specify $force to rotate anyway, expiring the older secret immediately. 2551 * 2552 * @param integer $id Webhook Endpoint ID. 2553 * @param boolean $force Rotate even if the previous rotation's overlap window is open. 2554 * 2555 * @since 2.8.0 2556 * 2557 * @see https://developers.kit.com/api-reference/webhooks/rotate-a-webhook-endpoint-secret 2558 * 2559 * @return mixed|object 2560 */ 2561 public function rotate_webhook_endpoint_secret(int $id, bool $force = false) 2562 { 2563 // Build parameters. 2564 $options = []; 2565 2566 if ($force) { 2567 $options['force'] = true; 2568 } 2569 2570 // Send request. 2571 return $this->post( 2572 sprintf('webhook_endpoints/%s/rotate_secret', $id), 2573 $options 2574 ); 2575 } 2576 2577 /** 2578 * Revoke a webhook endpoint's previous signing secret. 2579 * 2580 * Closes a rotation's overlap window early, so that only the current secret 2581 * verifies deliveries. 2582 * 2583 * @param integer $id Webhook Endpoint ID. 2584 * 2585 * @since 2.8.0 2586 * 2587 * @see https://developers.kit.com/api-reference/webhooks/revoke-the-previous-webhook-endpoint-secret 2588 * 2589 * @return mixed|object 2590 */ 2591 public function revoke_webhook_endpoint_previous_secret(int $id) 2592 { 2593 return $this->post(sprintf('webhook_endpoints/%s/revoke_previous_secret', $id)); 2594 } 2595 2596 /** 2597 * Verify the signature of a webhook endpoint delivery. 2598 * 2599 * Kit signs each delivery with the endpoint's signing secret, sending the timestamp 2600 * and one or more signatures in the X-Kit-Signature header. Deliveries are signed 2601 * with both the current and previous secret whilst a rotation's overlap window is 2602 * open, so any one signature matching means the delivery is valid. 2603 * 2604 * $payload must be the raw request body, byte for byte. Decoding and re-encoding it 2605 * changes whitespace and key order, which produces a different signature. 2606 * 2607 * @param string $payload Raw request body. 2608 * @param string $signature_header X-Kit-Signature header value. 2609 * @param string $secret Webhook endpoint signing secret. 2610 * @param integer $tolerance Maximum permitted age of the delivery, in seconds. 2611 * 2612 * @since 2.8.0 2613 * 2614 * @see https://developers.kit.com/webhooks/verifying-signatures 2615 * 2616 * @return boolean 2617 */ 2618 public function verify_webhook_signature( 2619 string $payload, 2620 string $signature_header, 2621 string $secret, 2622 int $tolerance = 300 2623 ) { 2624 // Parse the header into its timestamp and signatures. 2625 $timestamp = ''; 2626 $signatures = []; 2627 2628 foreach (explode(',', $signature_header) as $part) { 2629 $part = trim($part); 2630 2631 if (strpos($part, 't=') === 0) { 2632 $timestamp = substr($part, 2); 2633 continue; 2634 } 2635 2636 if (strpos($part, 'v1=') === 0) { 2637 $signatures[] = substr($part, 3); 2638 } 2639 } 2640 2641 // Bail if the header didn't include a timestamp and at least one signature. 2642 if (!is_numeric($timestamp) || !count($signatures)) { 2643 return false; 2644 } 2645 2646 // Bail if the delivery is older than the permitted tolerance, to prevent replays. 2647 if (abs((time() - (int) $timestamp)) > $tolerance) { 2648 return false; 2649 } 2650 2651 // Build the signature we expect for this payload. 2652 $expected = hash_hmac('sha256', $timestamp . '.' . $payload, $secret); 2653 2654 // The delivery is valid if any of its signatures match. 2655 foreach ($signatures as $signature) { 2656 if (hash_equals($expected, $signature)) { 2657 return true; 2658 } 2659 } 2660 2661 return false; 2360 2662 } 2361 2663 … … 2801 3103 2802 3104 /** 3105 * Performs a PATCH request to the API. 3106 * 3107 * @param string $endpoint API Endpoint. 3108 * @param array<string, bool|integer|float|string|null|array<int|string, bool|integer|float|string>> $args Request arguments. 3109 * 3110 * @since 2.8.0 3111 * 3112 * @return false|mixed 3113 */ 3114 public function patch(string $endpoint, array $args = []) 3115 { 3116 return $this->request($endpoint, 'PATCH', $args); 3117 } 3118 3119 /** 2803 3120 * Performs a DELETE request to the API. 2804 3121 * -
integrate-convertkit-wpforms/trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-api-v4.php
r3654577 r3747607 113 113 */ 114 114 protected $api_endpoints_wordpress = array( 115 'posts',116 115 'products', 117 116 'profile/', … … 173 172 // phpcs:disable 174 173 $this->error_messages = array( 175 // get_all_posts().176 'get_all_posts_posts_per_request_bound_too_low' => __( 'get_all_posts(): the posts_per_request parameter must be equal to or greater than 1.', 'convertkit' ),177 'get_all_posts_posts_per_request_bound_too_high' => __( 'get_all_posts(): the posts_per_request parameter must be equal to or less than 50.', 'convertkit' ),178 179 // get_posts().180 'get_posts_page_parameter_bound_too_low' => __( 'get_posts(): the page parameter must be equal to or greater than 1.', 'convertkit' ),181 'get_posts_per_page_parameter_bound_too_low' => __( 'get_posts(): the per_page parameter must be equal to or greater than 1.', 'convertkit' ),182 'get_posts_per_page_parameter_bound_too_high' => __( 'get_posts(): the per_page parameter must be equal to or less than 50.', 'convertkit' ),183 184 174 // subscriber_authentication_send_code(). 185 175 'subscriber_authentication_send_code_email_empty' => __( 'subscriber_authentication_send_code(): the email parameter is empty.', 'convertkit' ), … … 757 747 ) 758 748 ); 759 760 }761 762 /**763 * Gets all posts from the API.764 *765 * @since 1.0.0766 *767 * @param int $posts_per_request Number of Posts to fetch in each request.768 * @return WP_Error|array769 */770 public function get_all_posts( $posts_per_request = 50 ) {771 772 // Sanitize some parameters.773 $posts_per_request = absint( $posts_per_request );774 775 // Sanity check that parameters aren't outside of the bounds as defined by the API.776 if ( $posts_per_request < 1 ) {777 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_all_posts_posts_per_request_bound_too_low' ) );778 }779 if ( $posts_per_request > 50 ) {780 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_all_posts_posts_per_request_bound_too_high' ) );781 }782 783 // Define an array to store the posts in.784 $posts = array();785 786 // Mock the response to start the while loop.787 $response = array(788 'page' => 0, // Start on page zero, as the below loop will add 1 to this.789 'total_pages' => 1, // We always know there will be one page of posts.790 );791 792 // Iterate through each page of posts.793 while ( absint( $response['total_pages'] ) >= absint( $response['page'] ) + 1 ) {794 // Fetch posts.795 $response = $this->get_posts( absint( $response['page'] ) + 1, $posts_per_request );796 797 // Bail if an error occured.798 if ( is_wp_error( $response ) ) {799 return $response;800 }801 802 // Exit loop if no posts exist.803 if ( ! count( $response ) ) {804 break;805 }806 807 // Append posts to array.808 foreach ( $response['posts'] as $post ) {809 $posts[ $post['id'] ] = $post;810 }811 }812 813 // If no posts exist, log an error.814 if ( ! count( $posts ) ) {815 $this->log( 'API: get_posts(): Error: No broadcasts exist in ConvertKit.' );816 }817 818 // Return posts.819 return $posts;820 749 821 750 } … … 886 815 887 816 /** 888 * Gets posts from the API.889 *890 * @since 1.0.0891 *892 * @param int $page Page number.893 * @param int $per_page Number of Posts to return.894 * @return WP_Error|array895 */896 public function get_posts( $page = 1, $per_page = 10 ) {897 898 // Sanitize some parameters.899 $page = absint( $page );900 $per_page = absint( $per_page );901 902 // Sanity check that parameters aren't outside of the bounds as defined by the API.903 if ( $page < 1 ) {904 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_posts_page_parameter_bound_too_low' ) );905 }906 if ( $per_page < 1 ) {907 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_posts_per_page_parameter_bound_too_low' ) );908 }909 if ( $per_page > 50 ) {910 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'get_posts_per_page_parameter_bound_too_high' ) );911 }912 913 $posts = array();914 915 // Send request.916 $response = $this->get(917 'posts',918 array(919 'page' => $page,920 'per_page' => $per_page,921 )922 );923 924 // If an error occured, return WP_Error.925 if ( is_wp_error( $response ) ) {926 $this->log( 'API: get_posts(): Error: ' . $response->get_error_message() );927 return $response;928 }929 930 // If the response isn't an array as we expect, log that no posts exist and return a blank array.931 if ( ! is_array( $response['posts'] ) ) {932 $this->log( 'API: get_posts(): Error: No broadcasts exist in ConvertKit.' );933 return new WP_Error( 'convertkit_api_error', $this->get_error_message( 'response_type_unexpected' ) );934 }935 936 // If no posts exist, log that no posts exist and return a blank array.937 if ( ! count( $response['posts'] ) ) {938 $this->log( 'API: get_posts(): Error: No broadcasts exist in ConvertKit.' );939 return $posts;940 }941 942 return $response;943 944 }945 946 /**947 * Gets a specific post.948 *949 * @since 1.3.8950 *951 * @param int $post_id Post ID.952 * @return WP_Error|array953 */954 public function get_post( $post_id ) {955 956 // Send request.957 $response = $this->get(958 sprintf( 'posts/%s', $post_id )959 );960 961 // If an error occured, return WP_Error.962 if ( is_wp_error( $response ) ) {963 $this->log( 'API: get_posts(): Error: ' . $response->get_error_message() );964 return $response;965 }966 967 // If the response contains a message, an error occured.968 // Log and return it now.969 if ( array_key_exists( 'message', $response ) ) {970 $error = new WP_Error(971 'convertkit_api_error',972 $response['message']973 );974 975 $this->log( 'API: get_post(): Error: ' . $error->get_error_message() );976 return $error;977 }978 979 return $response['post'];980 981 }982 983 /**984 817 * Fetches all products from the API. 985 818 * … … 1531 1364 break; 1532 1365 1366 case 'patch': 1367 $result = wp_remote_request( 1368 $this->get_api_url( $endpoint ), 1369 array( 1370 'method' => 'PATCH', 1371 'headers' => $this->get_request_headers(), 1372 'body' => wp_json_encode( $params ), 1373 'timeout' => $this->get_timeout(), 1374 'user-agent' => $this->get_user_agent(), 1375 ) 1376 ); 1377 break; 1378 1533 1379 case 'delete': 1534 1380 $result = wp_remote_request( … … 1855 1701 // For some specific API endpoints created primarily for the WordPress Plugin, the API base is 1856 1702 // https://api.kit.com/wordpress/$endpoint. 1857 // We perform a string search instead of in_array(), because the $endpoint might be e.g. 1858 // profile/{subscriber_id} or subscriber_authentication/send_code. 1703 // We match on the start of the $endpoint instead of in_array(), because the $endpoint might be 1704 // e.g. profile/{subscriber_id} or subscriber_authentication/send_code. Matching anywhere in the 1705 // $endpoint would wrongly match v4 endpoints that contain one of these names in a later segment, 1706 // such as webhook_endpoints/{id}/revoke_previous_secret. 1859 1707 foreach ( $this->api_endpoints_wordpress as $wordpress_endpoint ) { 1860 if ( strpos( $endpoint, $wordpress_endpoint ) !== false) {1708 if ( strpos( $endpoint, $wordpress_endpoint ) === 0 ) { 1861 1709 return path_join( $this->api_url_base . 'wordpress', $endpoint ); // phpcs:ignore WordPress.WP.CapitalPDangit 1862 1710 } … … 1865 1713 // For oAuth API endpoints, the API base is https://api.kit.com/oauth/$endpoint. 1866 1714 foreach ( $this->api_endpoints_oauth as $oauth_endpoint ) { 1867 if ( strpos( $endpoint, $oauth_endpoint ) !== false) {1715 if ( strpos( $endpoint, $oauth_endpoint ) === 0 ) { 1868 1716 return path_join( $this->api_url_base . 'oauth', $endpoint ); 1869 1717 } -
integrate-convertkit-wpforms/trunk/vendor/convertkit/convertkit-wordpress-libraries/src/class-convertkit-resource-v4.php
r3654577 r3747607 393 393 case 'sequences': 394 394 case 'custom_fields': 395 case 'posts': 395 396 $results = $this->get_all_resources( $this->type ); 396 break;397 398 case 'posts':399 $results = $this->api->get_all_posts();400 397 break; 401 398 … … 567 564 case 'legacy_landing_pages': 568 565 $args = array( 566 false, 567 '', 568 '', 569 $per_page, 570 ); 571 break; 572 573 case 'posts': 574 $args = array( 575 false, // Don't include post content. 569 576 false, 570 577 '', … … 649 656 break; 650 657 658 case 'posts': 659 $args = array( 660 false, // Don't include post content. 661 false, 662 $response['pagination']['end_cursor'], 663 '', 664 $per_page, 665 ); 666 break; 667 651 668 case 'tags': 652 669 case 'sequences': … … 720 737 721 738 foreach ( $response[ $type ] as $item ) { 722 // Exclude Forms that have a null `format` value, as they are Creator Profile / Creator Network 723 // forms that we don't need in WordPress. 724 // Legacy forms don't have a `format` key, and we always want to include them in the resultset. 725 if ( $resource_type === 'forms' && array_key_exists( 'format', $item ) && is_null( $item['format'] ) ) { 726 continue; 739 switch ( $resource_type ) { 740 case 'forms': 741 // Exclude Forms that have a null `format` value, as they are Creator Profile / Creator Network 742 // forms that we don't need in WordPress. 743 // Legacy forms don't have a `format` key, and we always want to include them in the resultset. 744 if ( array_key_exists( 'format', $item ) && is_null( $item['format'] ) ) { 745 continue 2; 746 } 747 break; 748 749 case 'posts': 750 // Exclude Posts that have a null `published_at` value or aren't published, as they 751 // are draft or scheduled Posts that aren't yet publicly viewable and therefore 752 // shouldn't be displayed or imported in WordPress. 753 if ( ! array_key_exists( 'published_at', $item ) || is_null( $item['published_at'] ) ) { 754 continue 2; 755 } 756 if ( ! array_key_exists( 'status', $item ) || $item['status'] !== 'published' ) { 757 continue 2; 758 } 759 break; 727 760 } 728 761
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)