Changeset 1668943
- Timestamp:
- 06/01/2017 04:49:31 PM (9 years ago)
- File:
-
- 1 edited
-
wp-to-buffer/trunk/includes/admin/admin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-to-buffer/trunk/includes/admin/admin.php
r1668938 r1668943 343 343 */ 344 344 case 'auth': 345 // Check token exists346 if ( empty( $_POST['access_token'] ) ) {347 return __( 'Please enter an access token to use this plugin. You can obtain one by following the instructions below.', $this->base->plugin->name );348 }349 350 // Check token meets valid format351 if ( substr( $_POST['access_token'], 0, 2 ) != '1/' ) {352 // Missing353 return __( 'Oops - you\'ve not quite copied your access token from Buffer correctly. It should start with 1/. Please try again.', $this->base->plugin->name );354 }355 if ( substr($_POST['access_token'], ( strlen( $_POST['access_token'] ) - 4 ), 4 ) == 'Edit') {356 return __( 'Oops - you\'ve not quite copied your access token from Buffer correctly. It should not end with the word Edit. Please try again.', $this->base->plugin->name );357 }358 359 345 // Get instances 360 $api = WP_To_Buffer_Pro_Buffer_API::get_instance();361 346 $settings = WP_To_Buffer_Pro_Settings::get_instance(); 362 363 // Test Token364 $api->set_access_token( $_POST['access_token'] );365 $result = $api->user();366 if ( is_wp_error( $result ) ) {367 return $result->get_error_message();368 }369 370 // Save Token371 $settings->update_access_token( $_POST['access_token'] );372 347 373 348 // Save other Settings
Note: See TracChangeset
for help on using the changeset viewer.