| @@ -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 | * |
| @@ -838,31 +794,8 @@ | ||
| 838 | 794 | |
| 839 | 795 | /** |
| 840 | 796 | * Deletes the stored access token, refresh token and its expiry from the Plugin settings, |
| 841 | 797 | * and clears any existing scheduled WordPress Cron event to refresh the token on expiry, |
| 842 | - * when the user revokes the access token. | |
| 843 | - * | |
| 844 | - * @since 3.2.4 | |
| 845 | - * | |
| 846 | - * @param string $client_id OAuth Client ID used for the Access and Refresh Tokens. | |
| 847 | - */ | |
| 848 | -function convertkit_delete_credentials( $client_id ) { | |
| 849 | - | |
| 850 | - // Don't delete these credentials if they're not for this Client ID. | |
| 851 | - // They're for another Kit Plugin that uses OAuth. | |
| 852 | - if ( $client_id !== CONVERTKIT_OAUTH_CLIENT_ID ) { | |
| 853 | - return; | |
| 854 | - } | |
| 855 | - | |
| 856 | - // Delete Access and Refresh Tokens. | |
| 857 | - $settings = new ConvertKit_Settings(); | |
| 858 | - $settings->delete_credentials(); | |
| 859 | - | |
| 860 | -} | |
| 861 | - | |
| 862 | -/** | |
| 863 | - * Deletes the stored access token, refresh token and its expiry from the Plugin settings, | |
| 864 | - * and clears any existing scheduled WordPress Cron event to refresh the token on expiry, | |
| 865 | 798 | * when either: |
| 866 | 799 | * - The access token is invalid |
| 867 | 800 | * - The access token expired, and refreshing failed |
| 868 | 801 | * |
| @@ -895,11 +828,8 @@ | ||
| 895 | 828 | |
| 896 | 829 | // Update Access Token when refreshed by the API class. |
| 897 | 830 | add_action( 'convertkit_api_get_access_token', 'convertkit_maybe_update_credentials', 10, 2 ); |
| 898 | 831 | add_action( 'convertkit_api_refresh_token', 'convertkit_maybe_update_credentials', 10, 2 ); |
| 899 | - | |
| 900 | -// Delete credentials when the user revokes the access and refresh tokens. | |
| 901 | -add_action( 'convertkit_api_revoke_tokens', 'convertkit_delete_credentials', 10, 1 ); | |
| 902 | 832 | |
| 903 | 833 | // Delete credentials if the API class uses a invalid access token. |
| 904 | 834 | // This prevents the Plugin making repetitive API requests that will 401. |
| 905 | 835 | add_action( 'convertkit_api_access_token_invalid', 'convertkit_maybe_delete_credentials', 10, 2 ); |