| @@ -84,11 +84,8 @@ | ||
| 84 | 84 | |
| 85 | 85 | // Enqueue Category CSS. |
| 86 | 86 | wp_enqueue_style( 'convertkit-category', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/category.css', array(), CONVERTKIT_PLUGIN_VERSION ); |
| 87 | 87 | |
| 88 | - // Enqueue Refresh Resources CSS. | |
| 89 | - wp_enqueue_style( 'convertkit-admin-refresh-resources', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/refresh-resources.css', array(), CONVERTKIT_PLUGIN_VERSION ); | |
| 90 | - | |
| 91 | 88 | /** |
| 92 | 89 | * Enqueue CSS when editing a Category that outputs |
| 93 | 90 | * ConvertKit Plugin settings. |
| 94 | 91 | * |
| @@ -113,15 +110,20 @@ | ||
| 113 | 110 | return false; |
| 114 | 111 | } |
| 115 | 112 | |
| 116 | 113 | // Bail if we are not editing a Category. |
| 117 | - if ( convertkit_get_current_screen( 'id' ) !== 'edit-category' ) { | |
| 114 | + if ( ! function_exists( 'get_current_screen' ) ) { | |
| 118 | 115 | return false; |
| 119 | 116 | } |
| 117 | + $screen = get_current_screen(); | |
| 120 | 118 | |
| 119 | + if ( $screen->id !== 'edit-category' ) { | |
| 120 | + return false; | |
| 121 | + } | |
| 122 | + | |
| 121 | 123 | // Bail if the API hasn't been configured. |
| 122 | 124 | $settings = new ConvertKit_Settings(); |
| 123 | - if ( ! $settings->has_access_and_refresh_token() ) { | |
| 125 | + if ( ! $settings->has_api_key_and_secret() ) { | |
| 124 | 126 | return false; |
| 125 | 127 | } |
| 126 | 128 | |
| 127 | 129 | return true; |
| @@ -135,9 +137,9 @@ | ||
| 135 | 137 | public function add_category_form_fields() { |
| 136 | 138 | |
| 137 | 139 | // Don't show the form fields if the API hasn't been configured. |
| 138 | 140 | $settings = new ConvertKit_Settings(); |
| 139 | - if ( ! $settings->has_access_and_refresh_token() ) { | |
| 141 | + if ( ! $settings->has_api_key_and_secret() ) { | |
| 140 | 142 | return; |
| 141 | 143 | } |
| 142 | 144 | |
| 143 | 145 | // Fetch Forms. |
| @@ -158,9 +160,9 @@ | ||
| 158 | 160 | public function edit_category_form_fields( $term ) { |
| 159 | 161 | |
| 160 | 162 | // Don't show the form fields if the API hasn't been configured. |
| 161 | 163 | $settings = new ConvertKit_Settings(); |
| 162 | - if ( ! $settings->has_access_and_refresh_token() ) { | |
| 164 | + if ( ! $settings->has_api_key_and_secret() ) { | |
| 163 | 165 | return; |
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | // Fetch Category Settings and Forms. |
| @@ -196,12 +198,9 @@ | ||
| 196 | 198 | return; |
| 197 | 199 | } |
| 198 | 200 | |
| 199 | 201 | // Build metadata. |
| 200 | - $meta = array( | |
| 201 | - 'form' => ( isset( $_POST['wp-convertkit']['form'] ) ? intval( $_POST['wp-convertkit']['form'] ) : '' ), | |
| 202 | - 'form_position' => ( isset( $_POST['wp-convertkit']['form_position'] ) ? sanitize_text_field( wp_unslash( $_POST['wp-convertkit']['form_position'] ) ) : '' ), | |
| 203 | - ); | |
| 202 | + $meta = ( isset( $_POST['wp-convertkit']['form'] ) ? intval( $_POST['wp-convertkit']['form'] ) : '' ); | |
| 204 | 203 | |
| 205 | 204 | // Save metadata. |
| 206 | 205 | $convertkit_term = new ConvertKit_Term( $term_id ); |
| 207 | 206 | return $convertkit_term->save( $meta ); |