'Settings', ) ); } return $actions; } function allclients_core_settings_api_test() { $key = isset( $_POST['key'] ) ? $_POST['key'] : ''; $account_id = isset( $_POST['accountid'] ) ? $_POST['accountid'] : ''; try { if ( !$api = get_allclients()->get_api() ) { throw new Exception( 'API not instantiated.' ); } // API key if ( empty( $key ) ) { throw new Exception( 'API key is required.' ); } $api->set_key( $key ); // API account id if ( empty( $account_id ) ) { throw new Exception( 'API account ID is required.' ); } $api->set_account_id( $account_id ); // Test the API if (!$api->test()) { wp_send_json_error( $api->get_last_error() ); } else { wp_send_json_success( 'Success!' ); } } catch (Exception $e) { wp_send_json_error( $e->getMessage() ); } } function allclients_core_settings_api_save() { if(isset($_GET['settings-updated']) && $_GET['settings-updated']) { flush_rewrite_rules(); } } function allclients_core_settings_clear_cache() { try { if ( !$api = get_allclients()->get_api() ) { throw new Exception( 'API not instantiated.' ); } // Set token to current time $cache_token = time(); set_user_setting( allclients_get_option_name( 'api_cache_token' ), $cache_token ); $api->set_cache_token( $cache_token ); wp_send_json_success( 'Cache cleared! ' ); } catch (Exception $e) { wp_send_json_error( $e->getMessage() ); } } function allclients_core_settings_page() { $components = allclients_components_array(); $connected = get_allclients()->get_api()->test(); ?>

AllClients Plugin Settings

API Settings

Account ID:
API Key:
 

Components

: checked value="1" class="component-activator"> Enabled