Skip to content

Commit 85eaddd

Browse files
committed
Release: (d4cafe9) Merge branch 'develop' into trunk
1 parent dc720e3 commit 85eaddd

File tree

110 files changed

+15405
-10871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+15405
-10871
lines changed

assets/img/screenshot-13.png

45.8 KB
Loading

autoload.php

Lines changed: 0 additions & 152 deletions
This file was deleted.

classifai.php

Lines changed: 15 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://github.com/10up/classifai
55
* Update URI: https://classifaiplugin.com
66
* Description: Enhance your WordPress content with Artificial Intelligence and Machine Learning services.
7-
* Version: 2.5.1
7+
* Version: 3.0.0
88
* Requires at least: 6.1
99
* Requires PHP: 7.4
1010
* Author: 10up
@@ -59,53 +59,32 @@ function () {
5959
}
6060

6161
/**
62-
* Small wrapper around PHP's define function. The defined constant is
63-
* ignored if it has already been defined. This allows the
64-
* config.local.php to override any constant in config.php.
62+
* Small wrapper around PHP's define function.
6563
*
66-
* @param string $name The constant name
67-
* @param mixed $value The constant value
68-
* @return void
64+
* The defined constant is ignored if it has already
65+
* been defined. This allows these constants to be
66+
* overridden.
67+
*
68+
* @param string $name The constant name.
69+
* @param mixed $value The constant value.
6970
*/
7071
function classifai_define( $name, $value ) {
7172
if ( ! defined( $name ) ) {
7273
define( $name, $value );
7374
}
7475
}
7576

76-
if ( file_exists( __DIR__ . '/config.test.php' ) && defined( 'PHPUNIT_RUNNER' ) ) {
77-
require_once __DIR__ . '/config.test.php';
78-
}
79-
80-
if ( file_exists( __DIR__ . '/config.local.php' ) ) {
81-
require_once __DIR__ . '/config.local.php';
82-
}
83-
8477
require_once __DIR__ . '/config.php';
85-
classifai_define( 'CLASSIFAI_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
8678

8779
/**
88-
* Loads the CLASSIFAI PHP autoloader if possible.
80+
* Loads the autoloader if possible.
8981
*
9082
* @return bool True or false if autoloading was successful.
9183
*/
9284
function classifai_autoload() {
93-
if ( classifai_can_autoload() ) {
94-
require_once classifai_autoloader();
85+
if ( file_exists( CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php' ) ) {
86+
require_once CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php';
9587

96-
return true;
97-
} else {
98-
return false;
99-
}
100-
}
101-
102-
/**
103-
* In server mode we can autoload if autoloader file exists. For
104-
* test environments we prevent autoloading of the plugin to prevent
105-
* global pollution and for better performance.
106-
*/
107-
function classifai_can_autoload() {
108-
if ( file_exists( classifai_autoloader() ) ) {
10988
return true;
11089
} else {
11190
error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
@@ -116,32 +95,19 @@ function classifai_can_autoload() {
11695
}
11796
}
11897

119-
/**
120-
* Default is Composer's autoloader
121-
*/
122-
function classifai_autoloader() {
123-
if ( file_exists( CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php' ) ) {
124-
return CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php';
125-
} else {
126-
return CLASSIFAI_PLUGIN_DIR . '/autoload.php';
127-
}
128-
}
129-
13098
/**
13199
* Gets the installation message error.
132100
*
133-
* This was put in a function specifically because it's used both in WP-CLI and within an admin notice if not using
134-
* WP-CLI.
101+
* Used both in a WP-CLI context and within an admin notice.
135102
*
136103
* @return string
137104
*/
138105
function get_error_install_message() {
139-
return esc_html__( 'Error: Please run $ composer install in the classifai plugin directory.', 'classifai' );
106+
return esc_html__( 'Error: Please run $ composer install in the ClassifAI plugin directory.', 'classifai' );
140107
}
141108

142109
/**
143-
* Plugin code entry point. Singleton instance is used to maintain a common single
144-
* instance of the plugin throughout the current request's lifecycle.
110+
* Plugin code entry point.
145111
*
146112
* If autoloading failed an admin notice is shown and logged to
147113
* the PHP error_log.
@@ -167,7 +133,6 @@ function classifai_autorun() {
167133
}
168134
}
169135

170-
171136
/**
172137
* Generate a notice if autoload fails.
173138
*/
@@ -176,9 +141,8 @@ function classifai_autoload_notice() {
176141
error_log( get_error_install_message() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
177142
}
178143

179-
180144
/**
181-
* Register an activation hook that we can hook into.
145+
* Run functionality on plugin activation.
182146
*/
183147
function classifai_activation() {
184148
set_transient( 'classifai_activation_notice', 'classifai', HOUR_IN_SECONDS );

config.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<?php
22
/**
3-
* Global Constants for the ClassifAI Support Plugin. Constants should be
4-
* declared here instead of a Class.
3+
* Global Constants.
54
*/
65

7-
$plugin_version = '2.5.1';
8-
9-
if ( file_exists( __DIR__ . '/.commit' ) ) {
10-
$plugin_version .= '-' . file_get_contents( __DIR__ . '/.commit' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
11-
}
6+
$plugin_version = '3.0.0';
127

138
// Useful global constants
149
classifai_define( 'CLASSIFAI_PLUGIN', __DIR__ . '/classifai.php' );
1510
classifai_define( 'CLASSIFAI_PLUGIN_VERSION', $plugin_version );
1611
classifai_define( 'CLASSIFAI_PLUGIN_DIR', __DIR__ );
1712
classifai_define( 'CLASSIFAI_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
13+
classifai_define( 'CLASSIFAI_PLUGIN_BASENAME', plugin_basename( __DIR__ . '/classifai.php' ) );
14+
15+
// IBM Watson constants
1816

1917
// API - https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-release-notes#active-version-dates
2018
classifai_define( 'WATSON_NLU_VERSION', '2022-08-10' );
@@ -27,13 +25,10 @@ classifai_define( 'WATSON_CONCEPT_TAXONOMY', 'watson-concept' );
2725

2826
// Misc defaults
2927
classifai_define( 'WATSON_TIMEOUT', 60 ); // seconds
28+
classifai_define( 'WATSON_KEYWORD_LIMIT', 10 );
3029

3130
// Default Thresholds
3231
classifai_define( 'WATSON_CATEGORY_THRESHOLD', 70 );
3332
classifai_define( 'WATSON_KEYWORD_THRESHOLD', 70 );
3433
classifai_define( 'WATSON_ENTITY_THRESHOLD', 70 );
3534
classifai_define( 'WATSON_CONCEPT_THRESHOLD', 70 );
36-
37-
classifai_define( 'WATSON_KEYWORD_LIMIT', 10 );
38-
39-
// For Debugging

dist/admin.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'e2c9e5cff2b23adf4bdb');
1+
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '1518940c87b240cc4463');

dist/admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/admin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/commands.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('wp-commands', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => '29252950274641f22357');
1+
<?php return array('dependencies' => array('react', 'wp-commands', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => 'f5ee3619ed735ef57882');

dist/commands.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url', 'wp-wordcount'), 'version' => '86e90a59e31ec76feffd');
1+
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-url', 'wp-wordcount'), 'version' => 'e495efe9c37eb15015df');

0 commit comments

Comments
 (0)