@@ -214,80 +214,4 @@ public function add_api_key_field( array $args = [] ) {
214
214
]
215
215
);
216
216
}
217
-
218
- /**
219
- * Determine if the current user has access of the feature
220
- *
221
- * @param string $feature Feature to check.
222
- * @return bool
223
- */
224
- protected function has_access ( string $ feature ): bool {
225
- $ access_control = new AccessControl ( $ this , $ feature );
226
- return $ access_control ->has_access ();
227
- }
228
-
229
- /**
230
- * Determine if the feature is enabled and current user can access the feature
231
- *
232
- * @param string $feature Feature to check.
233
- * @return bool
234
- */
235
- public function is_feature_enabled ( string $ feature ): bool {
236
- $ is_feature_enabled = false ;
237
- $ settings = $ this ->get_settings ();
238
-
239
- // Check if provider is configured, user has access to the feature and the feature is turned on.
240
- if (
241
- $ this ->is_configured () &&
242
- $ this ->has_access ( $ feature ) &&
243
- $ this ->is_enabled ( $ feature )
244
- ) {
245
- $ is_feature_enabled = true ;
246
- }
247
-
248
- /**
249
- * Filter to override permission to a specific classifai feature.
250
- *
251
- * @since 2.4.0
252
- * @hook classifai_{$this->option_name}_enable_{$feature}
253
- *
254
- * @param {bool} $is_feature_enabled Is the feature enabled?
255
- * @param {array} $settings Current feature settings.
256
- *
257
- * @return {bool} Returns true if the user has access and the feature is enabled, false otherwise.
258
- */
259
- return apply_filters ( "classifai_ {$ this ->option_name }_enable_ {$ feature }" , $ is_feature_enabled , $ settings );
260
- }
261
-
262
- /**
263
- * Determine if the feature is turned on.
264
- *
265
- * Note: This function does not check if the user has access to the feature.
266
- *
267
- * - Use `is_feature_enabled()` to check if the user has access to the feature and feature is turned on.
268
- * - Use `has_access()` to check if the user has access to the feature.
269
- *
270
- * @param string $feature Feature to check.
271
- * @return bool
272
- */
273
- public function is_enabled ( string $ feature ): bool {
274
- $ settings = $ this ->get_settings ();
275
- $ enable_key = 'enable_ ' . $ feature ;
276
-
277
- // Check if feature is turned on.
278
- $ is_enabled = ( isset ( $ settings [ $ enable_key ] ) && 1 === (int ) $ settings [ $ enable_key ] );
279
-
280
- /**
281
- * Filter to override a specific classifai feature enabled.
282
- *
283
- * @since 2.5.0
284
- * @hook classifai_is_{$feature}_enabled
285
- *
286
- * @param {bool} $is_enabled Is the feature enabled?
287
- * @param {array} $settings Current feature settings.
288
- *
289
- * @return {bool} Returns true if the feature is enabled, false otherwise.
290
- */
291
- return apply_filters ( "classifai_is_ {$ feature }_enabled " , $ is_enabled , $ settings );
292
- }
293
217
}
0 commit comments