Skip to content

Commit 564cd56

Browse files
committed
remove more dead code
1 parent 4a624e3 commit 564cd56

File tree

4 files changed

+0
-104
lines changed

4 files changed

+0
-104
lines changed

includes/Classifai/Helpers.php

-46
Original file line numberDiff line numberDiff line change
@@ -24,52 +24,6 @@ function get_plugin() {
2424
return Plugin::get_instance();
2525
}
2626

27-
/**
28-
* Returns the ClassifAI plugin's stored settings in the WP options.
29-
*
30-
* @param string $service The service to get settings from, defaults to the ServiceManager class.
31-
* @param string $provider The provider service name to get settings from, defaults to the first one found.
32-
* @return array The array of ClassifAi settings.
33-
*/
34-
function get_plugin_settings( string $service = '', string $provider = '' ): array {
35-
$services = Plugin::$instance->services;
36-
if ( empty( $services ) || empty( $services['service_manager'] ) || ! $services['service_manager'] instanceof ServicesManager ) {
37-
return [];
38-
}
39-
40-
/** @var ServicesManager $service_manager Instance of the services manager class. */
41-
$service_manager = $services['service_manager'];
42-
if ( empty( $service ) ) {
43-
return $service_manager->get_settings();
44-
}
45-
46-
if ( ! isset( $service_manager->service_classes[ $service ] ) || ! $service_manager->service_classes[ $service ] instanceof Service ) {
47-
return [];
48-
}
49-
50-
// Ensure we have at least one provider.
51-
$providers = $service_manager->service_classes[ $service ]->provider_classes;
52-
53-
if ( empty( $providers ) ) {
54-
return [];
55-
}
56-
57-
// If we want settings for a specific provider, find the proper provider service.
58-
if ( ! empty( $provider ) ) {
59-
foreach ( $providers as $provider_class ) {
60-
if ( $provider_class->provider_service_name === $provider ) {
61-
return $provider_class->get_settings();
62-
}
63-
}
64-
65-
return [];
66-
}
67-
68-
/** @var Provider $provider An instance or extension of the provider abstract class. */
69-
$provider = $providers[0];
70-
return $provider->get_settings();
71-
}
72-
7327
/**
7428
* Overwrites the ClassifAI plugin's stored settings. Expected format is,
7529
*

includes/Classifai/Providers/Provider.php

-55
Original file line numberDiff line numberDiff line change
@@ -14,68 +14,13 @@ abstract class Provider {
1414
*/
1515
const ID = '';
1616

17-
/**
18-
* @var string The display name for the provider, i.e. Azure
19-
*/
20-
public $provider_name;
21-
22-
/**
23-
* @var string $provider_service_name Formal name of the provider, i.e AI Vision, NLU, Rekongnition.
24-
*/
25-
public $provider_service_name;
26-
2717
/**
2818
* Feature instance.
2919
*
3020
* @var \Classifai\Features\Feature
3121
*/
3222
protected $feature_instance = null;
3323

34-
/**
35-
* @var array $features Array of features provided by this provider.
36-
*/
37-
protected $features = array();
38-
39-
40-
/**
41-
* Provides the provider name.
42-
*
43-
* @return string
44-
*/
45-
public function get_provider_name(): string {
46-
return $this->provider_name;
47-
}
48-
49-
/**
50-
* Get provider features.
51-
*
52-
* @return array
53-
*/
54-
public function get_features(): array {
55-
return $this->features;
56-
}
57-
58-
/**
59-
* Default settings for Provider.
60-
*
61-
* @return array
62-
*/
63-
public function get_default_settings(): array {
64-
return [];
65-
}
66-
67-
/**
68-
* Common entry point for all REST endpoints for this provider.
69-
*
70-
* @param mixed $item The item we're processing.
71-
* @param string $route_to_call The name of the route we're going to be processing.
72-
* @param array $args Optional arguments to pass to the route.
73-
* @return mixed
74-
*/
75-
public function rest_endpoint_callback( $item, string $route_to_call, array $args = [] ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
76-
return null;
77-
}
78-
7924
/**
8025
* Format the result of most recent request.
8126
*

includes/Classifai/Providers/Watson/Helpers.php

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
use Classifai\Features\Classification;
99

10-
use function Classifai\get_plugin_settings;
11-
1210
/**
1311
* Returns the currently configured Watson API URL. Lookup order is,
1412
*

includes/Classifai/Services/Service.php

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ public function get_display_name(): string {
135135
* Render the start of a settings page. The rest is added by the providers
136136
*/
137137
public function render_settings_page() {
138-
$active_tab = isset( $_GET['provider'] ) ? sanitize_text_field( wp_unslash( $_GET['provider'] ) ) : $active_tab; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
139138
$base_url = add_query_arg(
140139
array(
141140
'page' => 'classifai',

0 commit comments

Comments
 (0)