Plugin Directory

Changeset 1668943


Ignore:
Timestamp:
06/01/2017 04:49:31 PM (9 years ago)
Author:
n7studios
Message:

Fixed admin.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-to-buffer/trunk/includes/admin/admin.php

    r1668938 r1668943  
    343343            */
    344344            case 'auth':
    345                 // Check token exists
    346                 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 format
    351                 if ( substr( $_POST['access_token'], 0, 2 ) != '1/' ) {
    352                     // Missing
    353                     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 
    359345                // Get instances
    360                 $api        = WP_To_Buffer_Pro_Buffer_API::get_instance();
    361346                $settings   = WP_To_Buffer_Pro_Settings::get_instance();
    362 
    363                 // Test Token
    364                 $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 Token
    371                 $settings->update_access_token( $_POST['access_token'] );
    372347
    373348                // Save other Settings
Note: See TracChangeset for help on using the changeset viewer.