Skip to content

Commit

Permalink
Release: (d4cafe9) Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Feb 29, 2024
1 parent dc720e3 commit 85eaddd
Show file tree
Hide file tree
Showing 110 changed files with 15,405 additions and 10,871 deletions.
Binary file added assets/img/screenshot-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
152 changes: 0 additions & 152 deletions autoload.php

This file was deleted.

66 changes: 15 additions & 51 deletions classifai.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/10up/classifai
* Update URI: https://classifaiplugin.com
* Description: Enhance your WordPress content with Artificial Intelligence and Machine Learning services.
* Version: 2.5.1
* Version: 3.0.0
* Requires at least: 6.1
* Requires PHP: 7.4
* Author: 10up
Expand Down Expand Up @@ -59,53 +59,32 @@ function () {
}

/**
* Small wrapper around PHP's define function. The defined constant is
* ignored if it has already been defined. This allows the
* config.local.php to override any constant in config.php.
* Small wrapper around PHP's define function.
*
* @param string $name The constant name
* @param mixed $value The constant value
* @return void
* The defined constant is ignored if it has already
* been defined. This allows these constants to be
* overridden.
*
* @param string $name The constant name.
* @param mixed $value The constant value.
*/
function classifai_define( $name, $value ) {
if ( ! defined( $name ) ) {
define( $name, $value );
}
}

if ( file_exists( __DIR__ . '/config.test.php' ) && defined( 'PHPUNIT_RUNNER' ) ) {
require_once __DIR__ . '/config.test.php';
}

if ( file_exists( __DIR__ . '/config.local.php' ) ) {
require_once __DIR__ . '/config.local.php';
}

require_once __DIR__ . '/config.php';
classifai_define( 'CLASSIFAI_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

/**
* Loads the CLASSIFAI PHP autoloader if possible.
* Loads the autoloader if possible.
*
* @return bool True or false if autoloading was successful.
*/
function classifai_autoload() {
if ( classifai_can_autoload() ) {
require_once classifai_autoloader();
if ( file_exists( CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php' ) ) {
require_once CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php';

return true;
} else {
return false;
}
}

/**
* In server mode we can autoload if autoloader file exists. For
* test environments we prevent autoloading of the plugin to prevent
* global pollution and for better performance.
*/
function classifai_can_autoload() {
if ( file_exists( classifai_autoloader() ) ) {
return true;
} else {
error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
Expand All @@ -116,32 +95,19 @@ function classifai_can_autoload() {
}
}

/**
* Default is Composer's autoloader
*/
function classifai_autoloader() {
if ( file_exists( CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php' ) ) {
return CLASSIFAI_PLUGIN_DIR . '/vendor/autoload.php';
} else {
return CLASSIFAI_PLUGIN_DIR . '/autoload.php';
}
}

/**
* Gets the installation message error.
*
* This was put in a function specifically because it's used both in WP-CLI and within an admin notice if not using
* WP-CLI.
* Used both in a WP-CLI context and within an admin notice.
*
* @return string
*/
function get_error_install_message() {
return esc_html__( 'Error: Please run $ composer install in the classifai plugin directory.', 'classifai' );
return esc_html__( 'Error: Please run $ composer install in the ClassifAI plugin directory.', 'classifai' );
}

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


/**
* Generate a notice if autoload fails.
*/
Expand All @@ -176,9 +141,8 @@ function classifai_autoload_notice() {
error_log( get_error_install_message() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
}


/**
* Register an activation hook that we can hook into.
* Run functionality on plugin activation.
*/
function classifai_activation() {
set_transient( 'classifai_activation_notice', 'classifai', HOUR_IN_SECONDS );
Expand Down
17 changes: 6 additions & 11 deletions config.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?php
/**
* Global Constants for the ClassifAI Support Plugin. Constants should be
* declared here instead of a Class.
* Global Constants.
*/

$plugin_version = '2.5.1';

if ( file_exists( __DIR__ . '/.commit' ) ) {
$plugin_version .= '-' . file_get_contents( __DIR__ . '/.commit' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
}
$plugin_version = '3.0.0';

// Useful global constants
classifai_define( 'CLASSIFAI_PLUGIN', __DIR__ . '/classifai.php' );
classifai_define( 'CLASSIFAI_PLUGIN_VERSION', $plugin_version );
classifai_define( 'CLASSIFAI_PLUGIN_DIR', __DIR__ );
classifai_define( 'CLASSIFAI_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
classifai_define( 'CLASSIFAI_PLUGIN_BASENAME', plugin_basename( __DIR__ . '/classifai.php' ) );

// IBM Watson constants

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

// Misc defaults
classifai_define( 'WATSON_TIMEOUT', 60 ); // seconds
classifai_define( 'WATSON_KEYWORD_LIMIT', 10 );

// Default Thresholds
classifai_define( 'WATSON_CATEGORY_THRESHOLD', 70 );
classifai_define( 'WATSON_KEYWORD_THRESHOLD', 70 );
classifai_define( 'WATSON_ENTITY_THRESHOLD', 70 );
classifai_define( 'WATSON_CONCEPT_THRESHOLD', 70 );

classifai_define( 'WATSON_KEYWORD_LIMIT', 10 );

// For Debugging
2 changes: 1 addition & 1 deletion dist/admin.asset.php
Original file line number Diff line number Diff line change
@@ -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');
<?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');
2 changes: 1 addition & 1 deletion dist/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/commands.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-commands', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => '29252950274641f22357');
<?php return array('dependencies' => array('react', 'wp-commands', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => 'f5ee3619ed735ef57882');
2 changes: 1 addition & 1 deletion dist/commands.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/content-resizing-plugin.asset.php
Original file line number Diff line number Diff line change
@@ -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');
<?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');
Loading

0 comments on commit 85eaddd

Please sign in to comment.