PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.6
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.6
3.4.6 3.4.5 3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 All 199 releases
← All changes | includes/functions.php +99 -0 3.3.9 → 3.4.6 View file →
@@ -327,8 +327,80 @@
327 327
328 328 }
329 329
330 330 /**
331 + * Helper method to get registered abilities.
332 + *
333 + * @since 3.4.0
334 + *
335 + * @return array Abilities.
336 + */
337 +function convertkit_get_abilities() {
338 +
339 + $abilities = array();
340 +
341 + /**
342 + * Registers abilities for the Kit Plugin.
343 + *
344 + * @since 3.4.0
345 + *
346 + * @param array $abilities Abilities.
347 + */
348 + $abilities = apply_filters( 'convertkit_abilities', $abilities );
349 +
350 + return $abilities;
351 +
352 +}
353 +
354 +/**
355 + * Helper method to get registered MCP resources.
356 + *
357 + * @since 3.4.2
358 + *
359 + * @return array Resources.
360 + */
361 +function convertkit_get_resources() {
362 +
363 + $resources = array();
364 +
365 + /**
366 + * Registers MCP resources for the Kit Plugin.
367 + *
368 + * @since 3.4.2
369 + *
370 + * @param array $resources Resources.
371 + */
372 + $resources = apply_filters( 'convertkit_resources', $resources );
373 +
374 + return $resources;
375 +
376 +}
377 +
378 +/**
379 + * Helper method to get registered MCP prompts.
380 + *
381 + * @since 3.4.2
382 + *
383 + * @return array Prompts.
384 + */
385 +function convertkit_get_prompts() {
386 +
387 + $prompts = array();
388 +
389 + /**
390 + * Registers MCP prompts for the Kit Plugin.
391 + *
392 + * @since 3.4.2
393 + *
394 + * @param array $prompts Prompts.
395 + */
396 + $prompts = apply_filters( 'convertkit_prompts', $prompts );
397 +
398 + return $prompts;
399 +
400 +}
401 +
402 +/**
331 403 * Helper method to return the Plugin Settings Link
332 404 *
333 405 * @since 1.9.6
334 406 *
@@ -889,8 +961,35 @@
889 961 WP_ConvertKit()->get_class( 'admin_notices' )->add( 'authorization_failed' );
890 962
891 963 $settings = new ConvertKit_Settings();
892 964 $settings->delete_credentials();
965 +
966 +}
967 +
968 +/**
969 + * Returns the OAuth authorization URL to connect the Plugin to a Kit account.
970 + *
971 + * A nonce is added to the return URL, which is verified before the authorization
972 + * code is exchanged for an access token.
973 + *
974 + * @since 3.4.6
975 + *
976 + * @param string $return_url URL to return to after authorization. Defaults to the Plugin's settings screen.
977 + * @return string OAuth authorization URL.
978 + */
979 +function convertkit_get_oauth_url( $return_url = '' ) {
980 +
981 + // Default to returning to the Plugin's settings screen.
982 + if ( empty( $return_url ) ) {
983 + $return_url = convertkit_get_settings_link();
984 + }
985 +
986 + $api = new ConvertKit_API_V4( CONVERTKIT_OAUTH_CLIENT_ID, CONVERTKIT_OAUTH_CLIENT_REDIRECT_URI );
987 +
988 + return $api->get_oauth_url(
989 + add_query_arg( 'nonce', wp_create_nonce( CONVERTKIT_NONCE_ACTION_OAUTH_CONNECT ), $return_url ),
990 + get_site_url()
991 + );
893 992
894 993 }
895 994
896 995 // Update Access Token when refreshed by the API class.