PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.0.6
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.0.6
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 2.2.9 2.3.0 2.3.1 2.3.2 All 195 releases
← All changes | includes/functions.php +0 -285 3.4.23.0.6 View file →
@@ -147,28 +147,8 @@
147 147
148 148 }
149 149
150 150 /**
151 - * Determines whether the current user can create and publish the given Post Type.
152 - *
153 - * @since 3.3.9
154 - *
155 - * @param string $post_type Post Type.
156 - * @return bool User can create and publish Post Type.
157 - */
158 -function convertkit_user_can_create_published_post_type( $post_type ) {
159 -
160 - $post_type_object = get_post_type_object( $post_type );
161 -
162 - if ( ! $post_type_object ) {
163 - return false;
164 - }
165 -
166 - return current_user_can( $post_type_object->cap->create_posts ) && current_user_can( $post_type_object->cap->publish_posts );
167 -
168 -}
169 -
170 -/**
171 151 * Helper method to get supported Post Types for Restricted Content (Member's Content)
172 152 *
173 153 * @since 2.1.0
174 154 *
@@ -254,32 +234,8 @@
254 234
255 235 }
256 236
257 237 /**
258 - * Helper method to get registered plugin sidebars.
259 - *
260 - * @since 3.3.0
261 - *
262 - * @return array Plugin sidebars
263 - */
264 -function convertkit_get_plugin_sidebars() {
265 -
266 - $plugin_sidebars = array();
267 -
268 - /**
269 - * Registers plugin sidebars for the WordPress block editor.
270 - *
271 - * @since 3.3.0
272 - *
273 - * @param array $plugin_sidebars Plugin sidebars.
274 - */
275 - $plugin_sidebars = apply_filters( 'convertkit_plugin_sidebars', $plugin_sidebars );
276 -
277 - return $plugin_sidebars;
278 -
279 -}
280 -
281 -/**
282 238 * Helper method to get registered pre-publish actions.
283 239 *
284 240 * @since 2.4.0
285 241 *
@@ -302,105 +258,8 @@
302 258
303 259 }
304 260
305 261 /**
306 - * Helper method to get registered importers that can replace third party
307 - * form shortcodes and blocks with Kit form shortcodes and blocks.
308 - *
309 - * @since 3.1.7
310 - *
311 - * @return array Importers.
312 - */
313 -function convertkit_get_form_importers() {
314 -
315 - $importers = array();
316 -
317 - /**
318 - * Registers form importers for the ConvertKit Plugin.
319 - *
320 - * @since 3.1.7
321 - *
322 - * @param array $importers Importers.
323 - */
324 - $importers = apply_filters( 'convertkit_get_form_importers', $importers );
325 -
326 - return $importers;
327 -
328 -}
329 -
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 -/**
403 262 * Helper method to return the Plugin Settings Link
404 263 *
405 264 * @since 1.9.6
406 265 *
@@ -645,36 +504,8 @@
645 504
646 505 }
647 506
648 507 /**
649 - * Helper method to enqueue the frontend CSS file.
650 - *
651 - * @since 3.2.0
652 - */
653 -function convertkit_enqueue_frontend_css() {
654 -
655 - wp_enqueue_style( 'convertkit-frontend', CONVERTKIT_PLUGIN_URL . 'resources/frontend/css/frontend.css', array(), CONVERTKIT_PLUGIN_VERSION );
656 -
657 -}
658 -
659 -/**
660 - * Helper method to enqueue the frontend JS file.
661 - *
662 - * @since 3.2.0
663 - */
664 -function convertkit_enqueue_frontend_js() {
665 -
666 - wp_enqueue_script(
667 - 'convertkit-js',
668 - CONVERTKIT_PLUGIN_URL . 'resources/frontend/js/dist/frontend.min.js',
669 - array(),
670 - CONVERTKIT_PLUGIN_VERSION,
671 - true
672 - );
673 -
674 -}
675 -
676 -/**
677 508 * Helper method to enqueue Select2 scripts for use within the ConvertKit Plugin.
678 509 *
679 510 * @since 1.9.6.4
680 511 */
@@ -810,34 +641,8 @@
810 641
811 642 }
812 643
813 644 /**
814 - * Checks if the given Theme is active.
815 - *
816 - * @since 3.1.4
817 - *
818 - * @param string $theme_name Theme name.
819 - * @return bool
820 - */
821 -function convertkit_is_theme_active( $theme_name ) {
822 -
823 - // Assume Theme isn't active if we can't detect it.
824 - if ( ! function_exists( 'wp_get_theme' ) ) {
825 - return false;
826 - }
827 -
828 - // Check the Parent Theme if we're on a Child Theme.
829 - if ( wp_get_theme()->parent() ) {
830 - $theme = wp_get_theme()->parent();
831 - } else {
832 - $theme = wp_get_theme();
833 - }
834 -
835 - return strtolower( $theme->get( 'Name' ) ) === strtolower( $theme_name );
836 -
837 -}
838 -
839 -/**
840 645 * Returns permitted HTML output when using wp_kses( ..., convertkit_kses_allowed_html()).
841 646 *
842 647 * @since 2.8.5
843 648 */
@@ -884,94 +689,4 @@
884 689
885 690 return array_merge( $elements, $form_elements );
886 691
887 692 }
888 -
889 -/**
890 - * Saves the new access token, refresh token and its expiry, and schedules
891 - * a WordPress Cron event to refresh the token on expiry.
892 - *
893 - * @since 3.1.1
894 - *
895 - * @param array $result New Access Token, Refresh Token and Expiry.
896 - * @param string $client_id OAuth Client ID used for the Access and Refresh Tokens.
897 - */
898 -function convertkit_maybe_update_credentials( $result, $client_id ) {
899 -
900 - // Don't save these credentials if they're not for this Client ID.
901 - // They're for another Kit Plugin that uses OAuth.
902 - if ( $client_id !== CONVERTKIT_OAUTH_CLIENT_ID ) {
903 - return;
904 - }
905 -
906 - $settings = new ConvertKit_Settings();
907 - $settings->update_credentials( $result );
908 -
909 -}
910 -
911 -/**
912 - * Deletes the stored access token, refresh token and its expiry from the Plugin settings,
913 - * and clears any existing scheduled WordPress Cron event to refresh the token on expiry,
914 - * when the user revokes the access token.
915 - *
916 - * @since 3.2.4
917 - *
918 - * @param string $client_id OAuth Client ID used for the Access and Refresh Tokens.
919 - */
920 -function convertkit_delete_credentials( $client_id ) {
921 -
922 - // Don't delete these credentials if they're not for this Client ID.
923 - // They're for another Kit Plugin that uses OAuth.
924 - if ( $client_id !== CONVERTKIT_OAUTH_CLIENT_ID ) {
925 - return;
926 - }
927 -
928 - // Delete Access and Refresh Tokens.
929 - $settings = new ConvertKit_Settings();
930 - $settings->delete_credentials();
931 -
932 -}
933 -
934 -/**
935 - * Deletes the stored access token, refresh token and its expiry from the Plugin settings,
936 - * and clears any existing scheduled WordPress Cron event to refresh the token on expiry,
937 - * when either:
938 - * - The access token is invalid
939 - * - The access token expired, and refreshing failed
940 - *
941 - * @since 3.1.1
942 - *
943 - * @param WP_Error $result Error result.
944 - * @param string $client_id OAuth Client ID used for the Access and Refresh Tokens.
945 - */
946 -function convertkit_maybe_delete_credentials( $result, $client_id ) {
947 -
948 - // Don't save these credentials if they're not for this Client ID.
949 - // They're for another Kit Plugin that uses OAuth.
950 - if ( $client_id !== CONVERTKIT_OAUTH_CLIENT_ID ) {
951 - return;
952 - }
953 -
954 - // If the error isn't a 401, don't delete credentials.
955 - // This could be e.g. a temporary network error, rate limit or similar.
956 - if ( $result->get_error_data( 'convertkit_api_error' ) !== 401 ) {
957 - return;
958 - }
959 -
960 - // Persist an error notice in the WordPress Administration until the user fixes the problem.
961 - WP_ConvertKit()->get_class( 'admin_notices' )->add( 'authorization_failed' );
962 -
963 - $settings = new ConvertKit_Settings();
964 - $settings->delete_credentials();
965 -
966 -}
967 -
968 -// Update Access Token when refreshed by the API class.
969 -add_action( 'convertkit_api_get_access_token', 'convertkit_maybe_update_credentials', 10, 2 );
970 -add_action( 'convertkit_api_refresh_token', 'convertkit_maybe_update_credentials', 10, 2 );
971 -
972 -// Delete credentials when the user revokes the access and refresh tokens.
973 -add_action( 'convertkit_api_revoke_tokens', 'convertkit_delete_credentials', 10, 1 );
974 -
975 -// Delete credentials if the API class uses a invalid access token.
976 -// This prevents the Plugin making repetitive API requests that will 401.
977 -add_action( 'convertkit_api_access_token_invalid', 'convertkit_maybe_delete_credentials', 10, 2 );