From cd5919936cf2c298784c1c44882898ff0b337f58 Mon Sep 17 00:00:00 2001 From: dkotter Date: Tue, 5 Sep 2023 19:07:40 +0000 Subject: [PATCH] Release: (1742dc0) Merge branch 'develop' into trunk --- assets/img/screenshot-12.png | Bin 0 -> 36930 bytes autoload.php | 4 +- classifai.php | 61 +- config.php | 9 +- dist/admin.asset.php | 2 +- dist/admin.css | 2 +- dist/commands.asset.php | 1 + dist/commands.js | 1 + dist/content-resizing-plugin.asset.php | 1 + dist/content-resizing-plugin.css | 1 + dist/content-resizing-plugin.js | 1 + dist/generate-excerpt-classic.asset.php | 1 + dist/generate-excerpt-classic.css | 1 + dist/generate-excerpt-classic.js | 1 + dist/generate-image-media-upload.asset.php | 1 + dist/generate-image-media-upload.js | 1 + dist/generate-title-classic.asset.php | 2 +- dist/generate-title-classic.css | 2 +- dist/gutenberg-plugin.asset.php | 2 +- dist/gutenberg-plugin.js | 7 +- dist/inserter-media-category.asset.php | 1 + dist/inserter-media-category.js | 1 + dist/post-excerpt.asset.php | 2 +- dist/post-excerpt.js | 2 +- dist/post-status-info.asset.php | 2 +- dist/post-status-info.js | 2 +- dist/recommended-content-block.asset.php | 2 +- dist/recommended-content-block.js | 2 +- includes/Classifai/Admin/BulkActions.php | 13 +- includes/Classifai/Admin/Onboarding.php | 8 +- .../Classifai/Admin/PreviewClassifierData.php | 10 +- includes/Classifai/Admin/SavePostHandler.php | 4 +- includes/Classifai/Admin/Update.php | 12 +- .../recommended-content-block/block.json | 2 +- .../Blocks/recommended-content-block/index.js | 2 +- .../Classifai/Command/ClassifaiCommand.php | 4 +- .../Classifai/Command/RSSImporterCommand.php | 2 +- includes/Classifai/Helpers.php | 23 + includes/Classifai/Plugin.php | 10 + .../Providers/Azure/ComputerVision.php | 8 +- .../Providers/Azure/Personalizer.php | 16 +- includes/Classifai/Providers/Azure/Read.php | 3 - .../Providers/Azure/TextToSpeech.php | 282 ++- .../Classifai/Providers/OpenAI/ChatGPT.php | 470 ++++- includes/Classifai/Providers/OpenAI/DallE.php | 114 +- .../Classifai/Providers/OpenAI/Embeddings.php | 6 +- .../Classifai/Providers/OpenAI/Whisper.php | 2 +- includes/Classifai/Providers/Provider.php | 13 +- includes/Classifai/Providers/Watson/NLU.php | 7 + .../Classifai/Services/ImageProcessing.php | 29 +- .../Classifai/Services/LanguageProcessing.php | 234 ++- includes/Classifai/Services/Personalizer.php | 20 +- includes/Classifai/Services/Service.php | 2 +- .../Classifai/Taxonomy/AbstractTaxonomy.php | 72 +- includes/Classifai/Watson/APIRequest.php | 2 +- includes/Classifai/Watson/Classifier.php | 2 +- includes/Classifai/Watson/Normalizer.php | 7 +- languages/classifai.pot | 537 +++--- readme.txt | 18 +- vendor/autoload.php | 2 +- vendor/composer/autoload_files.php | 2 +- vendor/composer/autoload_real.php | 10 +- vendor/composer/autoload_static.php | 10 +- vendor/composer/ca-bundle/res/cacert.pem | 917 +++++----- vendor/composer/installed.json | 30 +- vendor/composer/installed.php | 12 +- .../plugin-update-checker/.gitattributes | 1 + .../plugin-update-checker/Puc/v4/Factory.php | 6 - .../Puc/v4p13/Autoloader.php | 70 - .../Puc/v4p13/DebugBar/PluginExtension.php | 33 - .../Puc/v5/PucFactory.php | 10 + .../Puc/v5p1/Autoloader.php | 86 + .../{v4p13 => v5p1}/DebugBar/Extension.php | 53 +- .../Puc/{v4p13 => v5p1}/DebugBar/Panel.php | 25 +- .../Puc/v5p1/DebugBar/PluginExtension.php | 40 + .../{v4p13 => v5p1}/DebugBar/PluginPanel.php | 9 +- .../{v4p13 => v5p1}/DebugBar/ThemePanel.php | 10 +- .../Puc/{v4p13 => v5p1}/InstalledPackage.php | 8 +- .../Puc/{v4p13 => v5p1}/Metadata.php | 38 +- .../Puc/{v4p13 => v5p1}/OAuthSignature.php | 14 +- .../Puc/{v4p13 => v5p1}/Plugin/Package.php | 18 +- .../Info.php => v5p1/Plugin/PluginInfo.php} | 16 +- .../Puc/{v4p13 => v5p1}/Plugin/Ui.php | 38 +- .../Puc/{v4p13 => v5p1}/Plugin/Update.php | 22 +- .../{v4p13 => v5p1}/Plugin/UpdateChecker.php | 67 +- .../Factory.php => v5p1/PucFactory.php} | 71 +- .../Puc/{v4p13 => v5p1}/Scheduler.php | 30 +- .../Puc/{v4p13 => v5p1}/StateStore.php | 39 +- .../Puc/{v4p13 => v5p1}/Theme/Package.php | 10 +- .../Puc/{v4p13 => v5p1}/Theme/Update.php | 18 +- .../{v4p13 => v5p1}/Theme/UpdateChecker.php | 29 +- .../Puc/{v4p13 => v5p1}/Update.php | 8 +- .../Puc/{v4p13 => v5p1}/UpdateChecker.php | 94 +- .../Puc/{v4p13 => v5p1}/UpgraderStatus.php | 23 +- .../Puc/{v4p13 => v5p1}/Utils.php | 5 +- .../Puc/{v4p13 => v5p1}/Vcs/Api.php | 107 +- .../Puc/{v4p13 => v5p1}/Vcs/BaseChecker.php | 8 +- .../Puc/{v4p13 => v5p1}/Vcs/BitBucketApi.php | 71 +- .../Puc/{v4p13 => v5p1}/Vcs/GitHubApi.php | 236 +-- .../Puc/{v4p13 => v5p1}/Vcs/GitLabApi.php | 214 +-- .../Vcs/PluginUpdateChecker.php | 67 +- .../Puc/{v4p13 => v5p1}/Vcs/Reference.php | 6 +- .../Puc/v5p1/Vcs/ReleaseAssetSupport.php | 83 + .../Puc/v5p1/Vcs/ReleaseFilteringFeature.php | 108 ++ .../Vcs/ThemeUpdateChecker.php | 67 +- .../Puc/v5p1/Vcs/VcsCheckerMethods.php | 59 + .../plugin-update-checker/README.md | 184 +- .../plugin-update-checker/composer.json | 6 +- .../css/puc-debug-bar.css | 2 +- .../examples/plugin.json | 102 +- .../plugin-update-checker/examples/theme.json | 8 +- .../plugin-update-checker/js/debug-bar.js | 14 +- .../languages/plugin-update-checker.pot | 12 +- .../plugin-update-checker/load-v4p13.php | 28 - .../plugin-update-checker/load-v5p1.php | 34 + .../plugin-update-checker/phpcs.xml | 21 + .../plugin-update-checker.php | 4 +- .../vendor/Parsedown.php | 7 +- .../vendor/ParsedownLegacy.php | 1535 ----------------- .../vendor/PucReadmeParser.php | 6 +- 120 files changed, 3439 insertions(+), 3473 deletions(-) create mode 100644 assets/img/screenshot-12.png create mode 100644 dist/commands.asset.php create mode 100644 dist/commands.js create mode 100644 dist/content-resizing-plugin.asset.php create mode 100644 dist/content-resizing-plugin.css create mode 100644 dist/content-resizing-plugin.js create mode 100644 dist/generate-excerpt-classic.asset.php create mode 100644 dist/generate-excerpt-classic.css create mode 100644 dist/generate-excerpt-classic.js create mode 100644 dist/generate-image-media-upload.asset.php create mode 100644 dist/generate-image-media-upload.js create mode 100644 dist/inserter-media-category.asset.php create mode 100644 dist/inserter-media-category.js create mode 100644 vendor/yahnis-elsts/plugin-update-checker/.gitattributes delete mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v4/Factory.php delete mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v4p13/Autoloader.php delete mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v4p13/DebugBar/PluginExtension.php create mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v5/PucFactory.php create mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v5p1/Autoloader.php rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/DebugBar/Extension.php (73%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/DebugBar/Panel.php (85%) create mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v5p1/DebugBar/PluginExtension.php rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/DebugBar/PluginPanel.php (76%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/DebugBar/ThemePanel.php (60%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/InstalledPackage.php (94%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Metadata.php (74%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/OAuthSignature.php (87%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Plugin/Package.php (90%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13/Plugin/Info.php => v5p1/Plugin/PluginInfo.php} (91%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Plugin/Ui.php (89%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Plugin/Update.php (85%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Plugin/UpdateChecker.php (88%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13/Factory.php => v5p1/PucFactory.php} (85%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Scheduler.php (89%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/StateStore.php (78%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Theme/Package.php (87%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Theme/Update.php (83%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Theme/UpdateChecker.php (79%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Update.php (79%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/UpdateChecker.php (93%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/UpgraderStatus.php (91%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Utils.php (94%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/Api.php (71%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/BaseChecker.php (72%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/BitBucketApi.php (79%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/GitHubApi.php (64%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/GitLabApi.php (65%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/PluginUpdateChecker.php (84%) rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/Reference.php (89%) create mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v5p1/Vcs/ReleaseAssetSupport.php create mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v5p1/Vcs/ReleaseFilteringFeature.php rename vendor/yahnis-elsts/plugin-update-checker/Puc/{v4p13 => v5p1}/Vcs/ThemeUpdateChecker.php (55%) create mode 100644 vendor/yahnis-elsts/plugin-update-checker/Puc/v5p1/Vcs/VcsCheckerMethods.php delete mode 100644 vendor/yahnis-elsts/plugin-update-checker/load-v4p13.php create mode 100644 vendor/yahnis-elsts/plugin-update-checker/load-v5p1.php create mode 100644 vendor/yahnis-elsts/plugin-update-checker/phpcs.xml delete mode 100644 vendor/yahnis-elsts/plugin-update-checker/vendor/ParsedownLegacy.php diff --git a/assets/img/screenshot-12.png b/assets/img/screenshot-12.png new file mode 100644 index 0000000000000000000000000000000000000000..3cfd508733c303981fb28615a953ff26708388be GIT binary patch literal 36930 zcmbTcWl$Vl&@j4$;1=8^cpzAC2=4Cg9^7s5KyW9xy9alc;O=f&2+k6G7nhIcy|><~ z`{Vm_r>1JA&vf^+oYSYe`$VZK%V40ApaK8@3^`dzbpQYX2mri8MTUPHsd7Z}2LRyg zRTVX*USD6|MkpvK0REkKcX#pe@pyQ6@87@2#Kbf=H-CD1`uOqV!^4BJvhvQ(4j&)i z^z^ikk56G?Ap-+LYHBJnGIB;n1}ZA5j*bo#3gzPB5)>5l@bDlaA{rSP86O|_^Ygp8 zxoK-_3kwTtY;0UxTVrNs=HTGK#>V#c_Lh*40D(Zw&CR5wq$w#WrlzJ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Kn3|92L%A zS%6K>T)Mo(Y9ZW#5v$_o%+n_Zoy;Rk83>^q-6JqOBl40$>O(RjZi`X8sq{cW@S~gc z;rPF4-7hGH52!kO5vc3H3lEKdm5E4=EI+ePA`YFXZf8MbBOy8la0b3g|xfX8+6{v6{r+T4I?x zagT!O5X;on{te1^gi`_gXNi+)J+55S#iBrO#nyW6ubW}Et^?6IWjH~rI$|O`=wf@2 zKBaBXP&yH_np-~R$Z!P|mNnF~XnF(5seBN*IRUWjje%@if^8yq68#y;t zH9iuj)&r6w@i|&bQ_GEPhkD+J)XACD5~VPA1~IOoplLr0)dq60m1!%p;~N+Zh^^kZ zpc#0R{5o{5{iJ|}D#0Ggmn6lp{$l?-A${(d+_`)&B~DdxLvx|lAk8qW;vH+Fa#}v zsg1&ToTXf3D_7!XOQrkQoLOZ;`&lMjD03P3)*rHRd7zeeQ7^3YOf2~FcHh)BRL2`bwP1r@4XdyEW0r$zNLB6>=*4B6|zyd3n?)}RbjT2X|H*9LxCmX zGJ(YF)Xz5bk4rcaQ=#1UPE*g9k^8xBLKZ0I2ZD58wR*dFyhpRk3U_4|pHSZ}aEwR= znvbo}LIHmnY@UI+IkHhcH>&;+u^CGD&gir#@5fvg<7Suuu67}!l&`+-Et|>38Sa@C zGfu(HPIugkDVng$r_Xs#PDY&7n_K^iW+3XSq`K2_ zUjZ~&FfxnQKAi;jZvz8=8i1NBIJJpV-M&qiO-(x{8(jFoP9p5xO3LxNme6YjW*1*N zGS>#2^}{X_k-u{Wzi=fAObcD{fVklir)GAZt*_ds5!pr|CbCfP8 z6Ndl(#NivA=zr;Hr(Rde%KwK*{@<4WW0SL`&tOJ6x>^l^#B>;Z_cvNk`{DiSdyY~6 E1db~h9RL6T literal 0 HcmV?d00001 diff --git a/autoload.php b/autoload.php index f76ca3d4e..8f2cb4fbf 100644 --- a/autoload.php +++ b/autoload.php @@ -111,9 +111,7 @@ protected function load_mapped_file( $prefix, $relative_class ) { // replace the namespace prefix with the base directory, // replace namespace separators with directory separators // in the relative class name, append with .php - $file = $base_dir - . str_replace( '\\', '/', $relative_class ) - . '.php'; + $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php'; // if the mapped file exists, require it if ( $this->require_file( $file ) ) { diff --git a/classifai.php b/classifai.php index db6c1d15f..427b98352 100644 --- a/classifai.php +++ b/classifai.php @@ -4,8 +4,8 @@ * 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.2.3 - * Requires at least: 5.7 + * Version: 2.3.0 + * Requires at least: 5.8 * Requires PHP: 7.4 * Author: 10up * Author URI: https://10up.com @@ -16,30 +16,47 @@ */ /** - * Require PHP version 7.4+ - throw an error if the plugin is activated on an older version. + * Get the minimum version of PHP required by this plugin. * - * Note that this itself is only PHP5.3+ compatible because of the anonymous callback. + * @return string Minimum version required. */ -register_activation_hook( - __FILE__, - function() { - if ( version_compare( PHP_VERSION, '7.4.0', '<' ) ) { - wp_die( - sprintf( - wp_kses( - /* translators: PHP Update guide URL */ - __( 'ClassifAI requires PHP version 7.4. Click here to learn how to update your PHP version.', 'classifai' ), - array( - 'a' => array( 'href' => array() ), +function classifai_minimum_php_requirement() { + return '7.4'; +} + +/** + * Whether PHP installation meets the minimum requirements + * + * @return bool True if meets minimum requirements, false otherwise. + */ +function classifai_site_meets_php_requirements() { + return version_compare( phpversion(), classifai_minimum_php_requirement(), '>=' ); +} + +// Ensuring our PHP version requirement is met first before loading plugin. +if ( ! classifai_site_meets_php_requirements() ) { + add_action( + 'admin_notices', + function() { + ?> +

+

+ +

+
+ array(), 'version' => 'bebd517578e28722f510'); + array(), 'version' => 'b88da674f852dcc57e0e'); diff --git a/dist/admin.css b/dist/admin.css index 57ef7df3d..d066c8fe7 100644 --- a/dist/admin.css +++ b/dist/admin.css @@ -1,3 +1,3 @@ -:root{--classifai-admin-theme-color:#007cba;--classifai-admin-theme-color--rgb:0,124,186;--classifai-admin-theme-color-darker-10:#006ba1}body.admin-color-light{--classifai-admin-theme-color:#0085ba;--classifai-admin-theme-color--rgb:0,133,186;--classifai-admin-theme-color-darker-10:#0073a1}body.admin-color-modern{--classifai-admin-theme-color:#3858e9;--classifai-admin-theme-color--rgb:56,88,233;--classifai-admin-theme-color-darker-10:#2145e6}body.admin-color-blue{--classifai-admin-theme-color:#096484;--classifai-admin-theme-color--rgb:9,100,132;--classifai-admin-theme-color-darker-10:#07526c}body.admin-color-coffee{--classifai-admin-theme-color:#46403c;--classifai-admin-theme-color--rgb:70,64,60;--classifai-admin-theme-color-darker-10:#383330}body.admin-color-ectoplasm{--classifai-admin-theme-color:#523f6d;--classifai-admin-theme-color--rgb:82,63,109;--classifai-admin-theme-color-darker-10:#46365d}body.admin-color-midnight{--classifai-admin-theme-color:#e14d43;--classifai-admin-theme-color--rgb:225,77,67;--classifai-admin-theme-color-darker-10:#dd382d}body.admin-color-ocean{--classifai-admin-theme-color:#627c83;--classifai-admin-theme-color--rgb:98,124,131;--classifai-admin-theme-color-darker-10:#576e74}body.admin-color-sunrise{--classifai-admin-theme-color:#dd823b;--classifai-admin-theme-color--rgb:221,130,59;--classifai-admin-theme-color-darker-10:#d97426}#classifai-activation-notice{padding:24px}#classifai-activation-notice .classifai-logo{line-height:0}#classifai-activation-notice .classifai-logo img{width:180px}#classifai-activation-notice h3.classifai-activation-message{font-size:1.6em;font-weight:400;line-height:1.3;margin:8px 0 18px}a.classifai-button,input.classifai-button{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color);border-radius:4px;border-style:solid;border-width:1px;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-block;font-size:14px;font-style:normal;font-weight:400;padding:8px 16px;text-decoration:none;text-shadow:none;text-transform:uppercase;white-space:nowrap}a.classifai-button:active,a.classifai-button:focus,a.classifai-button:hover,input.classifai-button:active,input.classifai-button:focus,input.classifai-button:hover{background:var(--classifai-admin-theme-color-darker-10);border-color:var(--classifai-admin-theme-color-darker-10);color:#fff}a.classifai-button:focus,input.classifai-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--classifai-admin-theme-color-darker-10)}a.classifai-button:active,input.classifai-button:active{box-shadow:none}a.classifai-button.disabled,a.classifai-button:disabled,input.classifai-button.disabled,input.classifai-button:disabled{background:#9ea3a8;box-shadow:none;color:#fff;cursor:not-allowed}#classifai-header{background-color:#fff;box-shadow:0 10px 10px 0 #f0f0f1;box-sizing:border-box;display:block;left:0;margin-left:-20px;padding:0 10px;position:sticky;right:0;top:0;z-index:1001}@media screen and (max-width:782px){#classifai-header{margin-left:-10px;padding:0 5px}}@media(min-width:601px){body.admin-bar #classifai-header{top:46px}}@media(min-width:783px){body.admin-bar #classifai-header{top:32px}}.classifai-setup-page #classifai-header{position:relative}@media(min-width:601px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}@media(min-width:783px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}#classifai-header .classifai-header-layout{align-items:center;display:flex;justify-content:space-between;padding:18px}#classifai-header #classifai-logo{line-height:0}#classifai-header #classifai-logo img{max-width:180px}#classifai-header #classifai-header-controls{align-items:center;display:flex;flex-direction:row}#classifai-header #classifai-header-controls .header-control-item{align-items:center;cursor:pointer;display:flex;flex-direction:column;justify-content:center;margin-left:24px;outline:none;position:relative}#classifai-header #classifai-header-controls a.classifai-help-links{color:#757575;text-align:center;text-decoration:none}#classifai-header #classifai-header-controls a.classifai-help-links:hover,#classifai-header #classifai-header-controls a.classifai-help-links[aria-expanded=true]{color:var(--classifai-admin-theme-color)}#classifai-header #classifai-header-controls a.classifai-help-links span.control-item-text{display:block}#classifai-header .classifai-help-menu{display:block;width:200px}#classifai-header .classifai-help-menu__menu-item{color:#757575;display:block;padding:8px 12px;text-decoration:none}#classifai-header .classifai-help-menu__menu-item:hover{color:var(--classifai-admin-theme-color)}.admin_page_classifai_setup #classifai-header{box-shadow:none}.classifai-content .classifai-wrap{background-color:#fff;border-radius:4px;margin:0 20px 0 0;padding:24px}.classifai-content .classifai-wrap .form-table td fieldset p{margin-bottom:12px}.classifai-content input[type=password],.classifai-content input[type=text]{font-size:14px;height:38px;margin-bottom:4px}.classifai-content h2.nav-tab-wrapper.classifai-nav-wrapper{border-color:transparent;margin-right:20px;margin-top:20px;padding-top:0}.classifai-content a.nav-tab{background:transparent;border:none;margin-left:0;padding:10px 12px;position:relative}.classifai-content a.nav-tab:after{background:var(--classifai-admin-theme-color);border-radius:3px 3px 0 0;bottom:0;box-shadow:0 4px 10px 3px rgba(var(--classifai-admin-theme-color--rgb),.15);content:"";height:3px;left:0;opacity:0;position:absolute;right:0;transform:scaleX(0);transition:all .3s cubic-bezier(1,0,0,1);will-change:transform,box-shadow,opacity}.classifai-content a.nav-tab.nav-tab-active,.classifai-content a.nav-tab:hover{color:var(--classifai-admin-theme-color);font-weight:600}.classifai-content a.nav-tab.nav-tab-active:after,.classifai-content a.nav-tab:hover:after{opacity:1;transform:scale(1)}.classifai-setup{margin-left:-20px}.classifai-setup__header{align-items:center;background:#fff;border-bottom:1px solid #dcdcde;border-top:1px solid #dcdcde;display:flex;height:60px;justify-content:center}.classifai-setup__step-wrapper{margin:0 16px;max-width:980px;width:100%}.classifai-setup__steps{display:flex;justify-content:space-around}.classifai-setup__step{font-weight:400;padding:8px;position:relative}.classifai-setup__step__label{align-items:center;display:inline-flex;font-size:16px;justify-content:center}.classifai-setup__step__label span.step-count{background:#f0f0f0;border-radius:50%;color:#757575;height:24px;margin-right:8px;min-width:24px;width:24px}.classifai-setup__step__label span.step-count,.classifai-setup__step__label span.step-title{align-items:center;display:inline-flex;justify-content:center}.classifai-setup__step__label a,.classifai-setup__step__label a:active,.classifai-setup__step__label a:focus,.classifai-setup__step__label a:hover{color:#3c434a;display:inherit;text-decoration:none}@media screen and (max-width:480px){.classifai-setup__step__label{font-size:14px}}.classifai-setup__step.is-complete span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step.is-active span.step-title{font-weight:600}.classifai-setup__step.is-active span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step-divider{align-self:flex-start;border-bottom:1px solid #f0f0f0;flex-grow:1;margin-top:20px}.classifai-setup__step-label{font-size:1.2em}@media screen and (max-width:782px){.classifai-setup{margin-left:-10px}}.classifai-setup__wrapper{margin:0 auto;max-width:1232px}.classifai-setup__content{background-color:#fff;border-radius:4px;box-sizing:border-box;display:block;margin:20px;padding:24px 24px 48px}.classifai-setup__content__row{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.classifai-setup__content__row__column{display:flex;flex-basis:100%;flex-direction:column}.classifai-setup__content__row__column img{max-width:400px;width:100%}@media screen and (min-width:767px){.classifai-setup__content__row__column{flex:1;padding:0 10px}}.classifai-setup__content h1.classifai-setup-heading{font-size:22px;font-weight:600;margin:24px 0;text-align:center}.classifai-setup__content .classifai-setup-image{margin-top:20px;text-align:center}.classifai-setup__content h2.classifai-setup-title{font-size:22px;font-weight:400;margin:0;padding:0}.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:400px}.classifai-setup__content .classifai-step2-content{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-feature-box{margin:40px 0}.classifai-setup__content .classifai-feature-box-title{font-weight:700;text-transform:uppercase}.classifai-setup__content li.classifai-enable-feature{clear:both;display:block;list-style:none;margin-top:14px;width:100%}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-yes-alt{color:#48be1e}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-dismiss{color:#c00}.classifai-setup__content .classifai-feature-box-divider{border:1px solid #ddd}.classifai-setup__content label.classifai-feature-text,.classifai-setup__content span.classifai-feature-text{color:#707070;font-size:14px}.classifai-setup__content span.classifai-feature-text{float:left}.classifai-setup__content .classifai-setup-footer{text-align:right}.classifai-setup__content a.classifai-setup-skip-link{color:#000;font-weight:400;text-decoration:none}.classifai-setup__content .classifai-setup-footer__right{margin-left:40px}@media screen and (max-width:767px){.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:100%}.classifai-setup__content h2.classifai-setup-title{text-align:center}}.classifai-step3-content .classifai-setup__content .classifai-setup-form{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-setup-form .classifai-setup-form-field{margin-top:40px}.classifai-setup__content .classifai-setup-form label{display:block;font-weight:700;margin-bottom:20px;text-transform:uppercase}.classifai-setup__content .classifai-setup-form input[type=password],.classifai-setup__content .classifai-setup-form input[type=text]{font-size:14px;height:38px;margin-bottom:4px;width:100%}.classifai-setup__content .classifai-setup-form .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-step3-content{margin:0 auto}.classifai-setup__content .classifai-step3-content .classifai-setup-title{margin-bottom:12px;text-align:center}.classifai-setup__content .classifai-step3-content .classifai-setup-footer,.classifai-setup__content .classifai-step3-content .classifai-setup-form{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-step3-content .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-tabs{display:block}.classifai-setup__content .classifai-tabs.tabs-center{margin:auto auto 24px}.classifai-setup__content .classifai-tabs.tabs-justify{table-layout:fixed;width:100%}.classifai-setup__content .classifai-tabs a.tab{color:#1d2327;cursor:pointer;display:inline-block;font-size:14px;padding:16px 12px;position:relative;text-decoration:none;transform:translateZ(0);transition:all .3s ease;white-space:nowrap}.classifai-setup__content .classifai-tabs a.tab:focus{box-shadow:none}.classifai-setup__content .classifai-tabs a.tab:hover{color:var(--classifai-admin-theme-color)}.classifai-setup__content .classifai-tabs a.tab:after{background:var(--classifai-admin-theme-color);border-radius:3px 3px 0 0;bottom:0;box-shadow:0 4px 10px 3px rgba(var(--classifai-admin-theme-color--rgb),.15);content:"";height:3px;left:0;opacity:0;position:absolute;right:0;transform:scaleX(0);transition:all .3s cubic-bezier(1,0,0,1);will-change:transform,box-shadow,opacity}.classifai-setup__content .classifai-tabs a.tab.active{color:var(--classifai-admin-theme-color);font-weight:600}.classifai-setup__content .classifai-tabs a.tab.active:after{opacity:1;transform:scale(1)}.classifai-setup__content p.classifai-setup-error{color:red;text-align:center}.classifai-setup__content span.classifai-input-description{font-size:12px}.classifai-toggle{cursor:pointer;display:inline-block;text-align:right;width:100%}.classifai-toggle-switch{background:transparent;border:1px solid #1e1e1e;border-radius:9px;box-sizing:border-box;display:inline-block;height:18px;position:relative;transition:background .25s;vertical-align:middle;width:36px}.classifai-toggle-switch:after,.classifai-toggle-switch:before{content:""}.classifai-toggle-switch:before{background:#1e1e1e;border-radius:50%;box-sizing:border-box;display:block;height:12px;left:2px;position:absolute;top:2px;transition:left .25s;width:12px}.classifai-toggle-checkbox:checked+.classifai-toggle-switch{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color)}.classifai-toggle-checkbox:checked+.classifai-toggle-switch:before{background-color:#fff;left:20px}.classifai-toggle-checkbox{position:absolute;visibility:hidden} +:root{--classifai-admin-theme-color:#007cba;--classifai-admin-theme-color--rgb:0,124,186;--classifai-admin-theme-color-darker-10:#006ba1}body.admin-color-light{--classifai-admin-theme-color:#0085ba;--classifai-admin-theme-color--rgb:0,133,186;--classifai-admin-theme-color-darker-10:#0073a1}body.admin-color-modern{--classifai-admin-theme-color:#3858e9;--classifai-admin-theme-color--rgb:56,88,233;--classifai-admin-theme-color-darker-10:#2145e6}body.admin-color-blue{--classifai-admin-theme-color:#096484;--classifai-admin-theme-color--rgb:9,100,132;--classifai-admin-theme-color-darker-10:#07526c}body.admin-color-coffee{--classifai-admin-theme-color:#46403c;--classifai-admin-theme-color--rgb:70,64,60;--classifai-admin-theme-color-darker-10:#383330}body.admin-color-ectoplasm{--classifai-admin-theme-color:#523f6d;--classifai-admin-theme-color--rgb:82,63,109;--classifai-admin-theme-color-darker-10:#46365d}body.admin-color-midnight{--classifai-admin-theme-color:#e14d43;--classifai-admin-theme-color--rgb:225,77,67;--classifai-admin-theme-color-darker-10:#dd382d}body.admin-color-ocean{--classifai-admin-theme-color:#627c83;--classifai-admin-theme-color--rgb:98,124,131;--classifai-admin-theme-color-darker-10:#576e74}body.admin-color-sunrise{--classifai-admin-theme-color:#dd823b;--classifai-admin-theme-color--rgb:221,130,59;--classifai-admin-theme-color-darker-10:#d97426}#classifai-activation-notice{padding:24px}#classifai-activation-notice .classifai-logo{line-height:0}#classifai-activation-notice .classifai-logo img{width:180px}#classifai-activation-notice h3.classifai-activation-message{font-size:1.6em;font-weight:400;line-height:1.3;margin:8px 0 18px}a.classifai-button,input.classifai-button{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color);border-radius:4px;border-style:solid;border-width:1px;box-sizing:border-box;color:#fff;cursor:pointer;display:inline-block;font-size:14px;font-style:normal;font-weight:400;padding:8px 16px;text-decoration:none;text-shadow:none;text-transform:uppercase;white-space:nowrap}a.classifai-button:active,a.classifai-button:focus,a.classifai-button:hover,input.classifai-button:active,input.classifai-button:focus,input.classifai-button:hover{background:var(--classifai-admin-theme-color-darker-10);border-color:var(--classifai-admin-theme-color-darker-10);color:#fff}a.classifai-button:focus,input.classifai-button:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px var(--classifai-admin-theme-color-darker-10)}a.classifai-button:active,input.classifai-button:active{box-shadow:none}a.classifai-button.disabled,a.classifai-button:disabled,input.classifai-button.disabled,input.classifai-button:disabled{background:#9ea3a8;box-shadow:none;color:#fff;cursor:not-allowed}#classifai-header{background-color:#fff;box-shadow:0 10px 10px 0 #f0f0f1;box-sizing:border-box;display:block;left:0;margin-left:-20px;padding:0 10px;position:sticky;right:0;top:0;z-index:1001}@media screen and (max-width:782px){#classifai-header{margin-left:-10px;padding:0 5px}}@media(min-width:601px){body.admin-bar #classifai-header{top:46px}}@media(min-width:783px){body.admin-bar #classifai-header{top:32px}}.classifai-setup-page #classifai-header{position:relative}@media(min-width:601px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}@media(min-width:783px){body.admin-bar .classifai-setup-page #classifai-header{top:0}}#classifai-header .classifai-header-layout{align-items:center;display:flex;justify-content:space-between;padding:18px}#classifai-header #classifai-logo{line-height:0}#classifai-header #classifai-logo img{max-width:180px}#classifai-header #classifai-header-controls{align-items:center;display:flex;flex-direction:row}#classifai-header #classifai-header-controls .header-control-item{align-items:center;cursor:pointer;display:flex;flex-direction:column;justify-content:center;margin-left:24px;outline:none;position:relative}#classifai-header #classifai-header-controls a.classifai-help-links{color:#757575;text-align:center;text-decoration:none}#classifai-header #classifai-header-controls a.classifai-help-links:hover,#classifai-header #classifai-header-controls a.classifai-help-links[aria-expanded=true]{color:var(--classifai-admin-theme-color)}#classifai-header #classifai-header-controls a.classifai-help-links span.control-item-text{display:block}#classifai-header .classifai-help-menu{display:block;width:200px}#classifai-header .classifai-help-menu__menu-item{color:#757575;display:block;padding:8px 12px;text-decoration:none}#classifai-header .classifai-help-menu__menu-item:hover{color:var(--classifai-admin-theme-color)}.admin_page_classifai_setup #classifai-header{box-shadow:none}.classifai-content .classifai-wrap{background-color:#fff;border-radius:4px;margin:0 20px 0 0;padding:24px}.classifai-content .classifai-wrap .form-table td fieldset p{margin-bottom:12px}.classifai-content input[type=password],.classifai-content input[type=text]{font-size:14px;height:38px;margin-bottom:4px}.classifai-content h2.nav-tab-wrapper.classifai-nav-wrapper{border-color:transparent;margin-right:20px;margin-top:20px;padding-top:0}.classifai-content a.nav-tab{background:transparent;border:none;margin-left:0;padding:10px 12px;position:relative}.classifai-content a.nav-tab:after{background:var(--classifai-admin-theme-color);border-radius:3px 3px 0 0;bottom:0;box-shadow:0 4px 10px 3px rgba(var(--classifai-admin-theme-color--rgb),.15);content:"";height:3px;left:0;opacity:0;position:absolute;right:0;transform:scaleX(0);transition:all .3s cubic-bezier(1,0,0,1);will-change:transform,box-shadow,opacity}.classifai-content a.nav-tab.nav-tab-active,.classifai-content a.nav-tab:hover{color:var(--classifai-admin-theme-color);font-weight:600}.classifai-content a.nav-tab.nav-tab-active:after,.classifai-content a.nav-tab:hover:after{opacity:1;transform:scale(1)}.classifai-setup{margin-left:-20px}.classifai-setup__header{align-items:center;background:#fff;border-bottom:1px solid #dcdcde;border-top:1px solid #dcdcde;display:flex;height:60px;justify-content:center}.classifai-setup__step-wrapper{margin:0 16px;max-width:980px;width:100%}.classifai-setup__steps{display:flex;justify-content:space-around}.classifai-setup__step{font-weight:400;padding:8px;position:relative}.classifai-setup__step__label{align-items:center;display:inline-flex;font-size:16px;justify-content:center}.classifai-setup__step__label span.step-count{background:#f0f0f0;border-radius:50%;color:#757575;height:24px;margin-right:8px;min-width:24px;width:24px}.classifai-setup__step__label span.step-count,.classifai-setup__step__label span.step-title{align-items:center;display:inline-flex;justify-content:center}.classifai-setup__step__label a,.classifai-setup__step__label a:active,.classifai-setup__step__label a:focus,.classifai-setup__step__label a:hover{color:#3c434a;display:inherit;text-decoration:none}@media screen and (max-width:480px){.classifai-setup__step__label{font-size:14px}}.classifai-setup__step.is-complete span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step.is-active span.step-title{font-weight:600}.classifai-setup__step.is-active span.step-count{background:var(--classifai-admin-theme-color);color:#fff}.classifai-setup__step-divider{align-self:flex-start;border-bottom:1px solid #f0f0f0;flex-grow:1;margin-top:20px}.classifai-setup__step-label{font-size:1.2em}@media screen and (max-width:782px){.classifai-setup{margin-left:-10px}}.classifai-setup__wrapper{margin:0 auto;max-width:1232px}.classifai-setup__content{background-color:#fff;border-radius:4px;box-sizing:border-box;display:block;margin:20px;padding:24px 24px 48px}.classifai-setup__content__row{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}.classifai-setup__content__row__column{display:flex;flex-basis:100%;flex-direction:column}.classifai-setup__content__row__column img{max-width:400px;width:100%}@media screen and (min-width:767px){.classifai-setup__content__row__column{flex:1;padding:0 10px}}.classifai-setup__content h1.classifai-setup-heading{font-size:22px;font-weight:600;margin:24px 0;text-align:center}.classifai-setup__content .classifai-setup-image{margin-top:20px;text-align:center}.classifai-setup__content h2.classifai-setup-title{font-size:22px;font-weight:400;margin:0;padding:0}.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:400px}.classifai-setup__content .classifai-step2-content{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-feature-box{margin:40px 0}.classifai-setup__content .classifai-feature-box-title{font-weight:700;text-transform:uppercase}.classifai-setup__content li.classifai-enable-feature{clear:both;display:block;list-style:none;margin-top:14px;width:100%}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-yes-alt{color:#48be1e}.classifai-setup__content li.classifai-enable-feature span.dashicons.dashicons-dismiss{color:#c00}.classifai-setup__content .classifai-feature-box-divider{border:1px solid #ddd}.classifai-setup__content label.classifai-feature-text,.classifai-setup__content span.classifai-feature-text{color:#707070;font-size:14px}.classifai-setup__content span.classifai-feature-text{float:left}.classifai-setup__content .classifai-setup-footer{text-align:right}.classifai-setup__content a.classifai-setup-skip-link{color:#000;font-weight:400;text-decoration:none}.classifai-setup__content .classifai-setup-footer__right{margin-left:40px}@media screen and (max-width:767px){.classifai-setup__content .classifai-step1-content,.classifai-setup__content .classifai-step4-content{margin-top:20px;max-width:100%}.classifai-setup__content h2.classifai-setup-title{text-align:center}}.classifai-step3-content .classifai-setup__content .classifai-setup-form{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-setup-form .classifai-setup-form-field{margin-top:40px}.classifai-setup__content .classifai-setup-form label{display:block;font-weight:700;margin-bottom:20px;text-transform:uppercase}.classifai-setup__content .classifai-setup-form input[type=password],.classifai-setup__content .classifai-setup-form input[type=text]{font-size:14px;height:38px;margin-bottom:4px;width:100%}.classifai-setup__content .classifai-setup-form .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-step3-content{margin:0 auto}.classifai-setup__content .classifai-step3-content .classifai-setup-title{margin-bottom:12px;text-align:center}.classifai-setup__content .classifai-step3-content .classifai-setup-footer,.classifai-setup__content .classifai-step3-content .classifai-setup-form{margin:0 auto;max-width:480px}.classifai-setup__content .classifai-step3-content .classifai-setup-footer{margin-top:40px}.classifai-setup__content .classifai-tabs{display:block}.classifai-setup__content .classifai-tabs.tabs-center{margin:auto auto 24px}.classifai-setup__content .classifai-tabs.tabs-justify{table-layout:fixed;width:100%}.classifai-setup__content .classifai-tabs a.tab{color:#1d2327;cursor:pointer;display:inline-block;font-size:14px;padding:16px 12px;position:relative;text-decoration:none;transform:translateZ(0);transition:all .3s ease;white-space:nowrap}.classifai-setup__content .classifai-tabs a.tab:focus{box-shadow:none}.classifai-setup__content .classifai-tabs a.tab:hover{color:var(--classifai-admin-theme-color)}.classifai-setup__content .classifai-tabs a.tab:after{background:var(--classifai-admin-theme-color);border-radius:3px 3px 0 0;bottom:0;box-shadow:0 4px 10px 3px rgba(var(--classifai-admin-theme-color--rgb),.15);content:"";height:3px;left:0;opacity:0;position:absolute;right:0;transform:scaleX(0);transition:all .3s cubic-bezier(1,0,0,1);will-change:transform,box-shadow,opacity}.classifai-setup__content .classifai-tabs a.tab.active{color:var(--classifai-admin-theme-color);font-weight:600}.classifai-setup__content .classifai-tabs a.tab.active:after{opacity:1;transform:scale(1)}.classifai-setup__content p.classifai-setup-error{color:red;text-align:center}.classifai-setup__content span.classifai-input-description{font-size:12px}.classifai-toggle{cursor:pointer;display:inline-block;text-align:right;width:100%}.classifai-toggle-switch{background:transparent;border:1px solid #1e1e1e;border-radius:9px;box-sizing:border-box;display:inline-block;height:18px;position:relative;transition:background .25s;vertical-align:middle;width:36px}.classifai-toggle-switch:after,.classifai-toggle-switch:before{content:""}.classifai-toggle-switch:before{background:#1e1e1e;border-radius:50%;box-sizing:border-box;display:block;height:12px;left:2px;position:absolute;top:2px;transition:left .25s;width:12px}.classifai-toggle-checkbox:checked+.classifai-toggle-switch{background:var(--classifai-admin-theme-color);border-color:var(--classifai-admin-theme-color)}.classifai-toggle-checkbox:checked+.classifai-toggle-switch:before{background-color:#fff;left:20px}.classifai-toggle-checkbox{position:absolute;visibility:hidden}#classifai-generate-excerpt{position:absolute;right:12px;top:70px} .tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity;white-space:normal}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:"";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1} .tippy-box[data-theme~=light]{background-color:#fff;box-shadow:0 0 20px 4px rgba(154,161,177,.15),0 4px 80px -8px rgba(36,40,47,.25),0 4px 4px -2px rgba(91,94,105,.15);color:#26323d}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff} diff --git a/dist/commands.asset.php b/dist/commands.asset.php new file mode 100644 index 000000000..942cfc7f6 --- /dev/null +++ b/dist/commands.asset.php @@ -0,0 +1 @@ + array('wp-commands', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => '29252950274641f22357'); diff --git a/dist/commands.js b/dist/commands.js new file mode 100644 index 000000000..db108b161 --- /dev/null +++ b/dist/commands.js @@ -0,0 +1 @@ +(()=>{"use strict";const e=window.wp.commands,a=window.wp.element,c=window.wp.primitives,s=(0,a.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(c.Path,{d:"M14.5 13.8c-1.1 0-2.1.7-2.4 1.8H4V17h8.1c.3 1 1.3 1.8 2.4 1.8s2.1-.7 2.4-1.8H20v-1.5h-3.1c-.3-1-1.3-1.7-2.4-1.7zM11.9 7c-.3-1-1.3-1.8-2.4-1.8S7.4 6 7.1 7H4v1.5h3.1c.3 1 1.3 1.8 2.4 1.8s2.1-.7 2.4-1.8H20V7h-8.1z"})),t=(0,a.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(c.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),l=(0,a.createElement)(c.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(c.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),i=window.wp.i18n,n=window.wp.plugins;"function"==typeof e.useCommandLoader&&(0,n.registerPlugin)("classifai-commands",{render:()=>((0,e.useCommandLoader)({name:"classifai",hook:()=>{const e=[],a=document.querySelector(".editor-post-excerpt button.classifai-post-excerpt"),c=document.querySelector(".classifai-post-status button.title");return e.push({name:"classifai/settings",label:(0,i.__)("ClassifAI settings","classifai"),icon:s,callback:()=>{document.location.href="tools.php?page=classifai"}}),a&&e.push({name:"classifai/generate-excerpt",label:(0,i.__)("ClassifAI: Generate excerpt","classifai"),icon:t,callback:({close:e})=>{e(),a.scrollIntoView({block:"center"}),a.click()}}),c&&e.push({name:"classifai/generate-titles",label:(0,i.__)("ClassifAI: Generate titles","classifai"),icon:t,callback:({close:e})=>{e(),c.scrollIntoView({block:"center"}),c.click()}}),"undefined"!=typeof classifaiDalleData&&e.push({name:"classifai/generate-image",label:(0,i.__)("ClassifAI: Generate image","classifai"),icon:l,callback:()=>{document.location.href="upload.php?action=classifai-generate-image"}}),{commands:e}}}),null)})})(); \ No newline at end of file diff --git a/dist/content-resizing-plugin.asset.php b/dist/content-resizing-plugin.asset.php new file mode 100644 index 000000000..ed1f73547 --- /dev/null +++ b/dist/content-resizing-plugin.asset.php @@ -0,0 +1 @@ + array('wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-wordcount'), 'version' => 'bc2e64ef6385d5eae7f7'); diff --git a/dist/content-resizing-plugin.css b/dist/content-resizing-plugin.css new file mode 100644 index 000000000..8439bed8d --- /dev/null +++ b/dist/content-resizing-plugin.css @@ -0,0 +1 @@ +.classifai-content-resize__stat-header{width:130px}.classifai-content-resize__grow-stat strong,.classifai-content-resize__shrink-stat strong{font-family:monospace}.classifai-content-resize__shrink-stat{color:#dc3232}.classifai-content-resize__grow-stat{color:#46b450}.classifai-content-resize__result-wrapper{max-width:700px}.classifai-content-resize__result-table{border:1px solid #e4e4e4;border-collapse:collapse;width:100%}.classifai-content-resize__result-table td,.classifai-content-resize__result-table th{border:1px solid #e4e4e4;border-collapse:collapse;padding:.75rem .5rem}.classifai-content-resize__result-table tr{cursor:pointer}.classifai-content-resize__result-table tr:hover{background-color:#f3f3f3}.classifai-content-resize__modal-close-btn{position:absolute;right:1rem;top:1rem;z-index:10}.classifai-content-resize__overlay{align-items:center;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:rgba(0,0,0,.2);border-radius:8px;display:flex;height:calc(100% + 1.6rem);justify-content:center;left:-.8rem;position:absolute;top:-.8rem;width:calc(100% + 1.6rem);z-index:10}.classifai-content-resize__overlay-text{background-color:rgba(0,0,0,.5);border-radius:5px;color:#fff;font-size:1rem;padding:.5rem}.classifai-content-resize__blot{animation:blotIn .75s ease-in;background-color:#000;color:rgba(0,0,0,.5)}@keyframes blotIn{95%{background-color:inherit}to{background-color:transparent}}#classifai-content-resize__mock-content{background-color:#fff;height:100%;left:0;position:absolute;top:0;width:100%;z-index:9} diff --git a/dist/content-resizing-plugin.js b/dist/content-resizing-plugin.js new file mode 100644 index 000000000..3bc304200 --- /dev/null +++ b/dist/content-resizing-plugin.js @@ -0,0 +1 @@ +(()=>{"use strict";const e=window.wp.element,t=window.wp.plugins,n=window.wp.blockEditor,i=window.wp.editor,s=window.wp.data,c=window.wp.dom,l=window.wp.compose,a=window.wp.components,r=window.wp.wordcount,o=window.wp.i18n,d=(0,e.createElement)("svg",{width:"20",height:"15",viewBox:"0 0 61 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.51922 0C1.57575 0 0 1.5842 0 3.53846V42.4615C0 44.4158 1.57575 46 3.51922 46H57.4808C59.4243 46 61 44.4158 61 42.4615V3.53846C61 1.5842 59.4243 0 57.4808 0H3.51922ZM16.709 8.13836H21.4478L33.58 39.5542H27.524L24.0318 30.5144H13.9699L10.5169 39.5542H4.55669L16.709 8.13836ZM19.0894 16.7007C18.9846 17.041 18.878 17.3735 18.7702 17.698L18.7582 17.7344L15.9976 25.1398H22.1464L19.4013 17.6851L19.0894 16.7007ZM40.3164 8.13836H52.9056V12.1528L49.4929 12.9715V34.6306L52.9056 35.41V39.4338H40.3164V35.41L43.7291 34.6306V12.9715L40.3164 12.1528V8.13836Z"})),u={clientId:"",resizingType:null,isResizing:!1},g=(0,s.createReduxStore)("resize-content-store",{reducer(e=u,t){switch(t.type){case"SET_CLIENT_ID":return{...e,clientId:t.clientId};case"SET_RESIZING_TYPE":return{...e,resizingType:t.resizingType};case"SET_IS_RESIZING":return{...e,isResizing:t.isResizing}}return e},actions:{setClientId:e=>({type:"SET_CLIENT_ID",clientId:e}),setResizingType:e=>({type:"SET_RESIZING_TYPE",resizingType:e}),setIsResizing:e=>({type:"SET_IS_RESIZING",isResizing:e})},selectors:{getClientId:e=>e.clientId,getResizingType:e=>e.resizingType,getIsResizing:e=>e.isResizing}});(0,s.register)(g);const p=({count:t=0,countEntity:n="word"})=>0===t?(0,e.createElement)("div",null,"word"===n?(0,o.__)("No change in word count.","classifai"):(0,o.__)("No change in character count.","classifai")):t<0?(0,e.createElement)("div",{className:"classifai-content-resize__shrink-stat"},"word"===n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,t)," ",(0,o.__)("words","classifai")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,t)," ",(0,o.__)("characters","classifai"))):(0,e.createElement)("div",{className:"classifai-content-resize__grow-stat"},"word"===n?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,"+",t)," ",(0,o.__)("words","classifai")):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("strong",null,"+",t)," ",(0,o.__)("characters","classifai")));function m(e){return e=e.replace(/
/g,"\n"),(0,c.__unstableStripHTML)(e).trim().replace(/\n\n+/g,"\n\n")}(0,t.registerPlugin)("tenup-openai-expand-reduce-content",{render:()=>{const[t,c]=(0,e.useState)(""),[l,d]=(0,e.useState)(null),[u,_]=(0,e.useState)([]),[E,w]=(0,e.useState)(!1),{isMultiBlocksSelected:h,resizingType:f,isResizing:z}=(0,s.useSelect)((e=>({isMultiBlocksSelected:e(n.store).hasMultiSelection(),resizingType:e(g).getResizingType(),isResizing:e(g).getIsResizing()})));function I(){d(null),_([]),w(!1),(0,s.dispatch)(g).setResizingType(null)}return(0,e.useEffect)((()=>{f&&(async()=>{await async function(){var e;const t=(0,s.select)(n.store).getSelectedBlock(),i=null!==(e=t.attributes.content)&&void 0!==e?e:"";d(t),c(m(i)),(0,s.dispatch)(g).setIsResizing(!0)}()})()}),[f]),(0,e.useEffect)((()=>{z&&l&&(async()=>{const e=await async function(){let e=[];const n=`${wpApiSettings.root}classifai/v1/openai/resize-content`,c=(0,s.select)(i.store).getCurrentPostId(),a=new FormData;a.append("id",c),a.append("content",t),a.append("resize_type",f),(0,s.dispatch)(g).setClientId(l.clientId);const r=await fetch(n,{method:"POST",body:a,headers:new Headers({"X-WP-Nonce":wpApiSettings.nonce})});return 200===r.status?e=await r.json():((0,s.dispatch)(g).setIsResizing(!1),(0,s.dispatch)(g).setClientId(""),I()),(0,s.dispatch)(g).setIsResizing(!1),(0,s.dispatch)(g).setClientId(""),e}();_(e),w(!0)})()}),[z,l]),h||z?null:!z&&u.length&&E&&(0,e.createElement)(a.Modal,{title:(0,o.__)("Select a suggestion","classifai"),isFullScreen:!1,className:"classifai-content-resize__suggestion-modal",onRequestClose:()=>{w(!1),I()}},(0,e.createElement)("div",{className:"classifai-content-resize__result-wrapper"},(0,e.createElement)("table",{className:"classifai-content-resize__result-table"},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,(0,o.__)("Suggestion","classifai")),(0,e.createElement)("th",{className:"classifai-content-resize__stat-header"},(0,o.__)("Stats","classifai")),(0,e.createElement)("th",null,(0,o.__)("Action","classifai")))),(0,e.createElement)("tbody",null,u.map(((i,c)=>{const d=(0,r.count)(t,"words"),u=(0,r.count)(t,"characters_including_spaces"),g=(0,r.count)(i,"words")-d,m=(0,r.count)(i,"characters_including_spaces")-u;return(0,e.createElement)("tr",{key:c},(0,e.createElement)("td",null,i),(0,e.createElement)("td",null,(0,e.createElement)(p,{count:g}),(0,e.createElement)(p,{count:m,countEntity:"character"})),(0,e.createElement)("td",null,(0,e.createElement)(a.Button,{text:(0,o.__)("Select","classifai"),variant:"secondary",onClick:()=>{return e=i,(0,s.dispatch)(n.store).updateBlockAttributes(l.clientId,{content:e}),(0,s.dispatch)(n.store).selectionChange(l.clientId,"content",0,e.length),void I();var e},tabIndex:"0"})))}))))))}});const _=["#8c2525","#ca4444","#303030"];let E=0;function w(e="",t){if(!t)return;if(!(0,s.select)(g).getIsResizing())return void clearTimeout(E);const n=e.split(" "),i=function(e=[],t=10){const n=Array.from({length:e.length},((e,t)=>t)),i=[];for(;i.length{if(i.includes(t)){const t=Math.floor(5*Math.random());return`${e}`}return e}));t.current.innerHTML=c.join(" "),E=setTimeout((()=>{requestAnimationFrame((()=>w(e,t)))}),1e3/1.35)}const h=(0,l.createHigherOrderComponent)((t=>n=>{const{currentClientId:i}=(0,s.useSelect)((e=>({currentClientId:e(g).getClientId()}))),c=(0,e.useRef)();if(i!==n.clientId)return(0,e.createElement)(t,n);if("core/paragraph"!==n.name)return(0,e.createElement)(t,n);const l=m(n.attributes.content);return(0,s.select)(g).getIsResizing()&&requestAnimationFrame((()=>w(l,c))),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{style:{position:"relative"}},(0,e.createElement)("div",{className:"classifai-content-resize__overlay"},(0,e.createElement)("div",{className:"classifai-content-resize__overlay-text"},(0,o.__)("Processing data…","classifai"))),(0,e.createElement)("div",{id:"classifai-content-resize__mock-content",ref:c},l),(0,e.createElement)(t,n)))}),"withInspectorControl");wp.hooks.addFilter("editor.BlockEdit","resize-content/lock-block-editing",h);const f=(0,l.createHigherOrderComponent)((t=>i=>{const{isMultiBlocksSelected:c,resizingType:l}=(0,s.useSelect)((e=>({isMultiBlocksSelected:e(n.store).hasMultiSelection(),currentClientId:e(g).getClientId(),resizingType:e(g).getResizingType()})));return"core/paragraph"!==i.name?(0,e.createElement)(t,i):(0,e.createElement)(e.Fragment,null,l||c?null:(0,e.createElement)(n.BlockControls,{group:"other"},(0,e.createElement)(a.ToolbarDropdownMenu,{icon:d,className:"classifai-resize-content-btn",controls:[{title:(0,o.__)("Expand this text","classifai"),onClick:()=>{(0,s.dispatch)(g).setResizingType("grow")}},{title:(0,o.__)("Condense this text","classifai"),onClick:()=>{(0,s.dispatch)(g).setResizingType("shrink")}}]})),(0,e.createElement)(t,i))}),"withBlockControl");wp.hooks.addFilter("editor.BlockEdit","resize-content/lock-block-editing",f)})(); \ No newline at end of file diff --git a/dist/generate-excerpt-classic.asset.php b/dist/generate-excerpt-classic.asset.php new file mode 100644 index 000000000..887f9cfbb --- /dev/null +++ b/dist/generate-excerpt-classic.asset.php @@ -0,0 +1 @@ + array('wp-api-fetch'), 'version' => '284bc067245a0a71d7c5'); diff --git a/dist/generate-excerpt-classic.css b/dist/generate-excerpt-classic.css new file mode 100644 index 000000000..3f1040c55 --- /dev/null +++ b/dist/generate-excerpt-classic.css @@ -0,0 +1 @@ +#titlewrap{display:flex}#titlewrap #classifai-openai__title-generate-btn{height:2.348rem;line-height:2.348rem;margin-left:.5rem;position:relative}#titlewrap #classifai-openai__title-generate-btn>.classifai-openai__title-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#postexcerpt #classifai-openai__excerpt-generate-btn{display:block;margin:1em 0 0 auto;max-width:100%;position:relative;text-align:center;width:160px}#postexcerpt #classifai-openai__excerpt-generate-btn>.classifai-openai__excerpt-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#classifai-openai__overlay{background:rgba(0,0,0,.35);height:100%;left:0;top:0;z-index:99998}#classifai-openai__modal,#classifai-openai__overlay{position:fixed;transition:opacity .3s ease!important;width:100%}#classifai-openai__modal{background:#fff;border:1px solid;box-shadow:0 .7px 1px rgba(0,0,0,.15),0 2.7px 3.8px -.2px rgba(0,0,0,.15),0 5.5px 7.8px -.3px rgba(0,0,0,.15),.1px 11.5px 16.4px -.5px rgba(0,0,0,.15);left:50%;margin:0 1rem;max-width:900px;top:100px;transform:translate(-50%,-10%);z-index:99999}#classifai-openai__results-title{font-size:1.5rem!important;padding-top:1.5rem!important}#classifai-openai__results-content{display:flex;flex-flow:row wrap;gap:1rem;padding:1rem 1rem 1.5rem}#classifai-openai__close-modal-button{cursor:pointer;height:40px;position:fixed;right:.5rem;top:.5rem;width:40px}#classifai-openai__close-modal-button:before{content:"";display:block;font-family:dashicons;font-size:3rem;position:relative;right:0;top:.5rem}.classifai-openai__result-item{flex-basis:0;flex-grow:1;min-width:25%}.classifai-openai__result-item textarea{display:block;height:80px;width:100%}.classifai-openai__select-title{margin-top:1rem!important}.classifai-openai--fade-in #classifai-openai__overlay{opacity:1!important;transition:opacity .3s ease!important}.classifai-openai--fade-in #classifai-openai__modal{opacity:1!important;transform:translate(-50%)!important;transition:opacity .3s ease,transform .3s ease!important}.classifai-openai__excerpt-generate-btn--spinner:before,.classifai-openai__title-generate-btn--spinner:before{animation:rotation 2s linear infinite;content:"";display:block;font-family:dashicons;font-size:1.75rem;height:1.75rem;width:1.75rem}@keyframes rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} diff --git a/dist/generate-excerpt-classic.js b/dist/generate-excerpt-classic.js new file mode 100644 index 000000000..aab9096fa --- /dev/null +++ b/dist/generate-excerpt-classic.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.apiFetch;var n=e.n(t);const a=window.classifaiGenerateExcerpt||{};var r;(r=jQuery)(document).ready((()=>{document.getElementById("postexcerpt")&&function(){var e,t;const i=document.getElementById("excerpt");let s=!1;r("",{text:i.value?null!==(e=a?.regenerateText)&&void 0!==e?e:"":null!==(t=a?.buttonText)&&void 0!==t?t:"",class:"classifai-openai__excerpt-generate-btn--text"}).wrap('
').parent().append(r("",{class:"classifai-openai__excerpt-generate-btn--spinner"})).insertAfter(i);const c=r("#post_ID").val();r(document).on("click","#classifai-openai__excerpt-generate-btn",(()=>{if(s)return;const e=r(".classifai-openai__excerpt-generate-btn--text"),t=r(".classifai-openai__excerpt-generate-btn--spinner");e.css("opacity","0"),t.show(),s=!0;const o=a?.path+c;n()({path:o}).then((n=>{var c;e.css("opacity","1"),t.hide(),s=!1,r(i).val(n).trigger("input"),e.text(null!==(c=a?.regenerateText)&&void 0!==c?c:"")}))}))}()}))})(); \ No newline at end of file diff --git a/dist/generate-image-media-upload.asset.php b/dist/generate-image-media-upload.asset.php new file mode 100644 index 000000000..a9a60e7d7 --- /dev/null +++ b/dist/generate-image-media-upload.asset.php @@ -0,0 +1 @@ + array('wp-i18n'), 'version' => '5cb5eef05c879e06dcd5'); diff --git a/dist/generate-image-media-upload.js b/dist/generate-image-media-upload.js new file mode 100644 index 000000000..99de9f32e --- /dev/null +++ b/dist/generate-image-media-upload.js @@ -0,0 +1 @@ +(()=>{"use strict";const e=window.wp.i18n;document.addEventListener("DOMContentLoaded",(function(){if(wp.media){const i=wp.media({title:(0,e.__)("Generate images","classifai"),button:{text:(0,e.__)("View details","classifai")},multiple:!1,frame:"select"});i.on("open",(function(){const e=i.$el.find(".media-menu-item#menu-item-upload"),t=i.$el.find(".media-menu-item#menu-item-generate");e.length&&e.hide(),t.length&&t.trigger("click")})),i.on("close",(function(){classifaiGenerateImages&&(window.location.href=classifaiGenerateImages.upload_url)})),i.on("select",(function(){if(classifaiGenerateImages){const e=i.state().get("selection").first().toJSON();window.location.href=`${classifaiGenerateImages.upload_url}?item=${e.id}`}})),i.open()}}))})(); \ No newline at end of file diff --git a/dist/generate-title-classic.asset.php b/dist/generate-title-classic.asset.php index 15741a669..2d0287b71 100644 --- a/dist/generate-title-classic.asset.php +++ b/dist/generate-title-classic.asset.php @@ -1 +1 @@ - array('wp-api-fetch'), 'version' => '86c7a3e0ce047dd248e3'); + array('wp-api-fetch'), 'version' => '6f8009d31b5c3b9d753c'); diff --git a/dist/generate-title-classic.css b/dist/generate-title-classic.css index 1ae13889c..3f1040c55 100644 --- a/dist/generate-title-classic.css +++ b/dist/generate-title-classic.css @@ -1 +1 @@ -#titlewrap{display:flex}#titlewrap #classifai-openai__title-generate-btn{height:2.348rem;line-height:2.348rem;margin-left:.5rem;position:relative}#titlewrap #classifai-openai__title-generate-btn>.classifai-openai__title-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#classifai-openai__overlay{background:rgba(0,0,0,.35);height:100%;left:0;top:0;z-index:99998}#classifai-openai__modal,#classifai-openai__overlay{position:fixed;transition:opacity .3s ease!important;width:100%}#classifai-openai__modal{background:#fff;border:1px solid;box-shadow:0 .7px 1px rgba(0,0,0,.15),0 2.7px 3.8px -.2px rgba(0,0,0,.15),0 5.5px 7.8px -.3px rgba(0,0,0,.15),.1px 11.5px 16.4px -.5px rgba(0,0,0,.15);left:50%;margin:0 1rem;max-width:900px;top:100px;transform:translate(-50%,-10%);z-index:99999}#classifai-openai__results-title{font-size:1.5rem!important;padding-top:1.5rem!important}#classifai-openai__results-content{display:flex;flex-flow:row wrap;gap:1rem;padding:1rem 1rem 1.5rem}#classifai-openai__close-modal-button{cursor:pointer;height:40px;position:fixed;right:.5rem;top:.5rem;width:40px}#classifai-openai__close-modal-button:before{content:"";display:block;font-family:dashicons;font-size:3rem;position:relative;right:0;top:.5rem}.classifai-openai__result-item{flex-basis:0;flex-grow:1;min-width:25%}.classifai-openai__result-item textarea{display:block;height:80px;width:100%}.classifai-openai__select-title{margin-top:1rem!important}.classifai-openai--fade-in #classifai-openai__overlay{opacity:1!important;transition:opacity .3s ease!important}.classifai-openai--fade-in #classifai-openai__modal{opacity:1!important;transform:translate(-50%)!important;transition:opacity .3s ease,transform .3s ease!important}.classifai-openai__title-generate-btn--spinner:before{animation:rotation 2s linear infinite;content:"";display:block;font-family:dashicons;font-size:1.75rem;height:1.75rem;width:1.75rem}@keyframes rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} +#titlewrap{display:flex}#titlewrap #classifai-openai__title-generate-btn{height:2.348rem;line-height:2.348rem;margin-left:.5rem;position:relative}#titlewrap #classifai-openai__title-generate-btn>.classifai-openai__title-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#postexcerpt #classifai-openai__excerpt-generate-btn{display:block;margin:1em 0 0 auto;max-width:100%;position:relative;text-align:center;width:160px}#postexcerpt #classifai-openai__excerpt-generate-btn>.classifai-openai__excerpt-generate-btn--spinner{display:none;left:50%;line-height:29px;position:absolute;top:50%;transform:translate(-50%,-50%)}#classifai-openai__overlay{background:rgba(0,0,0,.35);height:100%;left:0;top:0;z-index:99998}#classifai-openai__modal,#classifai-openai__overlay{position:fixed;transition:opacity .3s ease!important;width:100%}#classifai-openai__modal{background:#fff;border:1px solid;box-shadow:0 .7px 1px rgba(0,0,0,.15),0 2.7px 3.8px -.2px rgba(0,0,0,.15),0 5.5px 7.8px -.3px rgba(0,0,0,.15),.1px 11.5px 16.4px -.5px rgba(0,0,0,.15);left:50%;margin:0 1rem;max-width:900px;top:100px;transform:translate(-50%,-10%);z-index:99999}#classifai-openai__results-title{font-size:1.5rem!important;padding-top:1.5rem!important}#classifai-openai__results-content{display:flex;flex-flow:row wrap;gap:1rem;padding:1rem 1rem 1.5rem}#classifai-openai__close-modal-button{cursor:pointer;height:40px;position:fixed;right:.5rem;top:.5rem;width:40px}#classifai-openai__close-modal-button:before{content:"";display:block;font-family:dashicons;font-size:3rem;position:relative;right:0;top:.5rem}.classifai-openai__result-item{flex-basis:0;flex-grow:1;min-width:25%}.classifai-openai__result-item textarea{display:block;height:80px;width:100%}.classifai-openai__select-title{margin-top:1rem!important}.classifai-openai--fade-in #classifai-openai__overlay{opacity:1!important;transition:opacity .3s ease!important}.classifai-openai--fade-in #classifai-openai__modal{opacity:1!important;transform:translate(-50%)!important;transition:opacity .3s ease,transform .3s ease!important}.classifai-openai__excerpt-generate-btn--spinner:before,.classifai-openai__title-generate-btn--spinner:before{animation:rotation 2s linear infinite;content:"";display:block;font-family:dashicons;font-size:1.75rem;height:1.75rem;width:1.75rem}@keyframes rotation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}} diff --git a/dist/gutenberg-plugin.asset.php b/dist/gutenberg-plugin.asset.php index f42c732be..796ca2a26 100644 --- a/dist/gutenberg-plugin.asset.php +++ b/dist/gutenberg-plugin.asset.php @@ -1 +1 @@ - array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins'), 'version' => '8a4bc513cdeb0113e497'); + array('react', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => 'eaf02626032e72db78d7'); diff --git a/dist/gutenberg-plugin.js b/dist/gutenberg-plugin.js index 63705bb7d..ba7d5f6b1 100644 --- a/dist/gutenberg-plugin.js +++ b/dist/gutenberg-plugin.js @@ -1,3 +1,4 @@ -(()=>{"use strict";const e=window.wp.element,t=window.React;var s;function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t({type:"SET_AUDIO_ID",id:e}),setIsProcessing:e=>({type:"SET_PROCESSING_STATUS",status:e})},selectors:{getAudioId:e=>e.audioId,getIsProcessing:e=>e.isProcessing}});(0,r.register)(g);const{classifaiEmbeddingData:f,classifaiPostData:y}=window,_=()=>(0,e.createElement)(l.Icon,{className:"components-panel__icon",icon:o,size:24}),m=()=>{const t=(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_process_content"))),{editPost:s}=(0,r.useDispatch)("core/editor"),i="no"===t?"no":"yes";return(0,e.createElement)(l.ToggleControl,{label:(0,a.__)("Process content on update","classifai"),help:"yes"===i?(0,a.__)("ClassifAI language processing is enabled","classifai"):(0,a.__)("ClassifAI language processing is disabled","classifai"),checked:"yes"===i,onChange:e=>{s({classifai_process_content:e?"yes":"no"})}})},w=async e=>{const{select:t,dispatch:s}=wp.data,i=t("core/editor").getCurrentPostId(),o=t("core/editor").getCurrentPostType(),n=t("core/editor").getPostTypeLabel()||(0,a.__)("Post","classifai");if(e&&e.terms){let r=!1;const c=Object.keys(e.terms),l={};if(c.forEach((s=>{let i=s;"post_tag"===s&&(i="tags"),"category"===s&&(i="categories");const o=[...t("core/editor").getEditedPostAttribute(s)||[],...e.terms[s].map((e=>Number.parseInt(e)))].filter(((e,t,s)=>s.indexOf(e)===t));o&&o.length&&(r=!0,l[i]=o)})),r){const e=await t("core/editor").isEditedPostDirty();await s("core").editEntityRecord("postType",o,i,l),e||await s("core").saveEditedEntityRecord("postType",o,i),s("core/notices").createSuccessNotice((0,a.sprintf)(/** translators: %s is post type label. */ -(0,a.__)("%s classified successfully.","classifai"),n),{type:"snackbar"})}}},P=()=>{if("yes"==("no"===(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_process_content")))?"no":"yes"))return null;const t=wp.data.select("core/editor").getCurrentPostId(),s=wp.data.select("core/editor").getPostTypeLabel()||(0,a.__)("Post","classifai"),i=(0,a.sprintf)(/** translators: %s Post type label */ -(0,a.__)("Classify %s","classifai"),s);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(l.Button,{variant:"secondary","data-id":t,onClick:e=>(({button:e,endpoint:t,callback:s=!1,buttonText:i=(0,a.__)("Rescan","classifai")})=>{const o=e.getAttribute("data-id"),[r]=e.parentNode.getElementsByClassName("spinner"),[c]=e.parentNode.getElementsByClassName("error"),l=`${t}${o}`;e.setAttribute("disabled","disabled"),r.style.display="inline-block",r.classList.add("is-active"),c.style.display="none",wp.apiRequest({path:l}).then((t=>{e.removeAttribute("disabled"),r.style.display="none",r.classList.remove("is-active"),e.textContent=i,s&&s(t)}),(t=>{const s=n(t,"responseJSON",{code:"unknown_error",message:(0,a.__)("An unknown error occurred.","classifai")});r.style.display="none",r.classList.remove("is-active"),e.removeAttribute("disabled"),e.textContent=i,c.style.display="inline-block",c.textContent=`Error: ${s.message}`}))})({button:e.target,endpoint:"/classifai/v1/generate-tags/",callback:w,buttonText:i})},i),(0,e.createElement)("span",{className:"spinner",style:{display:"none",float:"none"}}),(0,e.createElement)("span",{className:"error",style:{display:"none",color:"#bc0b0b",padding:"5px"}}))};let h="";const b=t=>{const[s,i]=(0,e.useState)(!1),[o,n]=(0,e.useState)((new Date).getTime());let c=!1;const d="yes"===(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_synthesize_speech"))),u=(0,r.useSelect)((e=>e("core/editor").getCurrentPostType())),p=(0,r.useSelect)((e=>e(g).getIsProcessing()));"undefined"!=typeof classifaiTextToSpeechData&&classifaiTextToSpeechData.supportedPostTypes.includes(u)&&(c=!0);const f=(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_post_audio_id"))),y=t.audioId||f,_=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","attachment",{include:[y]}))),m=_&&_.length>0&&_[0].source_url,w=(0,e.useRef)(!1);(0,e.useEffect)((()=>{const e=document.getElementById("classifai-audio-preview");e&&(s?e.play():e.pause())}),[s]),(0,e.useEffect)((()=>{p&&(w.current=!0),w.current&&!p&&n((new Date).getTime())}),[p]);const P=`${m}?ver=${o}`;let h="controls-play";return p?h="format-audio":s&&(h="controls-pause"),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(l.ToggleControl,{label:(0,a.__)("Enable audio generation","classifai"),help:c?(0,a.__)("ClassifAI will generate audio for the post when it is published or updated.","classifai"):(0,a.__)("Text to Speech generation is disabled for this post type.","classifai"),checked:c&&d,onChange:e=>{wp.data.dispatch("core/editor").editPost({classifai_synthesize_speech:e?"yes":"no"})},disabled:!c}),m&&(0,e.createElement)("audio",{id:"classifai-audio-preview",src:P,onEnded:()=>i(!1)}),m&&d&&(0,e.createElement)(l.BaseControl,{id:"classifai-audio-controls",help:p?"":(0,a.__)("Preview the generated audio.","classifai")},(0,e.createElement)(l.Button,{id:"classifai-audio-controls__preview-btn",icon:(0,e.createElement)(l.Icon,{icon:h}),variant:"secondary",onClick:()=>i(!s),disabled:p,isBusy:p},p?(0,a.__)("Generating audio..","classifai"):(0,a.__)("Preview","classifai"))))};let E=!1;wp.data.subscribe((function(){const{select:e}=wp.data;if("yes"!==e("core/editor").getEditedPostAttribute("classifai_synthesize_speech"))return;let t=e("core/editor").isSavingPost();const s=e("core/editor").isAutosavingPost(),i=e("core/editor").getCurrentPostId();t=t&&!s,t&&!E&&(E=!0),!t&&E&&((async e=>{const{select:t,dispatch:s}=wp.data,i=`${wpApiSettings.root}classifai/v1/synthesize-speech/${e}`;if(t(g).getIsProcessing())return;s(g).setIsProcessing(!0);const o=await fetch(i,{headers:new Headers({"X-WP-Nonce":wpApiSettings.nonce})});if(200!==o.status)return s(g).setIsProcessing(!1),!1;const a=await o.json();if(a.success)return s(g).setAudioId(a.audio_id),s(g).setIsProcessing(!1),h&&(s(u.store).removeNotice(h),h=""),!0;h=a.code,s("core/notices").createErrorNotice(a.message,{id:h}),s(g).setIsProcessing(!1)})(i),E=!1)})),(0,d.registerPlugin)("classifai-plugin",{render:()=>{const t=(0,r.useSelect)((e=>e("core/editor").getCurrentPostType())),s=(0,r.useSelect)((e=>e("core/editor").getCurrentPostAttribute("status"))),i=(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_post_audio_id"))),o=(0,r.useSelect)((e=>e(g).getAudioId()))||i,n=y&&y.NLUEnabled,l=f&&f.enabled,d=y&&y.supportedPostTypes&&y.supportedPostTypes.includes(t),u=f&&f.supportedPostTypes&&f.supportedPostTypes.includes(t),p=y&&y.supportedPostStatues&&y.supportedPostStatues.includes(s),w=f&&f.supportedPostStatues&&f.supportedPostStatues.includes(s),h=y&&!(y.noPermissions&&1===parseInt(y.noPermissions))&&n&&d&&p,E=f&&!(f.noPermissions&&1===parseInt(f.noPermissions))&&l&&u&&w;return(0,e.createElement)(c.PluginDocumentSettingPanel,{title:(0,a.__)("ClassifAI","classifai"),icon:_,className:"classifai-panel"},(0,e.createElement)(e.Fragment,null,(h||E)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(m,null),h&&(0,e.createElement)(P,null))),(0,e.createElement)(b,{audioId:o}))}})})(); \ No newline at end of file +(()=>{"use strict";const e=window.wp.element,t=window.React;var s;function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t({type:"SET_AUDIO_ID",id:e}),setIsProcessing:e=>({type:"SET_PROCESSING_STATUS",status:e})},selectors:{getAudioId:e=>e.audioId,getIsProcessing:e=>e.isProcessing}});(0,r.register)(p);const{classifaiEmbeddingData:g,classifaiPostData:f,classifaiTTSEnabled:_}=window,y=()=>(0,e.createElement)(l.Icon,{className:"components-panel__icon",icon:a,size:24}),m=()=>{const t=(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_process_content"))),{editPost:s}=(0,r.useDispatch)("core/editor"),i="no"===t?"no":"yes";return(0,e.createElement)(l.ToggleControl,{label:(0,o.__)("Process content on update","classifai"),help:"yes"===i?(0,o.__)("ClassifAI language processing is enabled","classifai"):(0,o.__)("ClassifAI language processing is disabled","classifai"),checked:"yes"===i,onChange:e=>{s({classifai_process_content:e?"yes":"no"})}})},P=async e=>{const{select:t,dispatch:s}=wp.data,i=t("core/editor").getCurrentPostId(),a=t("core/editor").getCurrentPostType(),n=t("core/editor").getPostTypeLabel()||(0,o.__)("Post","classifai");if(e&&e.terms){let r=!1;const c=Object.keys(e.terms),l={};if(c.forEach((s=>{let i=s;"post_tag"===s&&(i="tags"),"category"===s&&(i="categories");const a=[...t("core/editor").getEditedPostAttribute(s)||[],...e.terms[s].map((e=>Number.parseInt(e)))].filter(((e,t,s)=>s.indexOf(e)===t));a&&a.length&&(r=!0,l[i]=a)})),r){const e=await t("core/editor").isEditedPostDirty();await s("core").editEntityRecord("postType",a,i,l),e||await s("core").saveEditedEntityRecord("postType",a,i),s("core/notices").createSuccessNotice((0,o.sprintf)(/** translators: %s is post type label. */ +(0,o.__)("%s classified successfully.","classifai"),n),{type:"snackbar"})}}},w=()=>{if("yes"==("no"===(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_process_content")))?"no":"yes"))return null;const t=wp.data.select("core/editor").getCurrentPostId(),s=wp.data.select("core/editor").getPostTypeLabel()||(0,o.__)("Post","classifai"),i=(0,o.sprintf)(/** translators: %s Post type label */ +(0,o.__)("Classify %s","classifai"),s);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(l.Button,{variant:"secondary","data-id":t,onClick:e=>(({button:e,endpoint:t,callback:s=!1,buttonText:i=(0,o.__)("Rescan","classifai")})=>{const a=e.getAttribute("data-id"),[r]=e.parentNode.getElementsByClassName("spinner"),[c]=e.parentNode.getElementsByClassName("error"),l=`${t}${a}`;e.setAttribute("disabled","disabled"),r.style.display="inline-block",r.classList.add("is-active"),c.style.display="none",wp.apiRequest({path:l}).then((t=>{e.removeAttribute("disabled"),r.style.display="none",r.classList.remove("is-active"),e.textContent=i,s&&s(t)}),(t=>{const s=n(t,"responseJSON",{code:"unknown_error",message:(0,o.__)("An unknown error occurred.","classifai")});r.style.display="none",r.classList.remove("is-active"),e.removeAttribute("disabled"),e.textContent=i,c.style.display="inline-block",c.textContent=`Error: ${s.message}`}))})({button:e.target,endpoint:"/classifai/v1/generate-tags/",callback:P,buttonText:i})},i),(0,e.createElement)("span",{className:"spinner",style:{display:"none",float:"none"}}),(0,e.createElement)("span",{className:"error",style:{display:"none",color:"#bc0b0b",padding:"5px"}}))},b=()=>{const[t,s]=(0,e.useState)(!1),[i,a]=(0,e.useState)((new Date).getTime()),n=(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_synthesize_speech"))),c=(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_display_generated_audio"))),d=(0,r.useSelect)((e=>void 0!==e("core/editor").getPostTypeLabel&&e("core/editor").getPostTypeLabel()||(0,o.__)("Post","classifai"))),u=(0,r.useSelect)((e=>e(p).getIsProcessing())),g=(0,r.useSelect)((e=>e("core/editor").getEditedPostAttribute("classifai_post_audio_id"))),f=(0,r.useSelect)((e=>e(p).getAudioId()))||g,_=(0,r.useSelect)((e=>e("core").getEntityRecords("postType","attachment",{include:[f]}))),y=_&&_.length>0&&_[0].source_url,m=(0,e.useRef)(!1),P=(0,e.useRef)(!1),{isSavingPost:w}=(0,r.useSelect)((e=>({isSavingPost:e("core/editor").isSavingPost()}))),{isAutosavingPost:b}=(0,r.useSelect)((e=>({isSavingPost:e("core/editor").isAutosavingPost()})));(0,e.useEffect)((()=>{const e=document.getElementById("classifai-audio-preview");e&&(t?e.play():e.pause())}),[t]),(0,e.useEffect)((()=>{u&&(m.current=!0),m.current&&!u&&a((new Date).getTime())}),[u]),(0,e.useEffect)((()=>{!w||b||P.current||(P.current=!0,n&&wp.data.dispatch(p).setIsProcessing(!0)),w||b||!P.current||(P.current=!1,wp.data.dispatch(p).setIsProcessing(!1))}),[w,b,n]);const E=`${y}?ver=${i}`;let h="controls-play";return u?h="format-audio":t&&(h="controls-pause"),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(l.ToggleControl,{label:(0,o.__)("Enable audio generation","classifai"),help:(0,o.sprintf)(/** translators: %s is post type label. */ +(0,o.__)("ClassifAI will generate audio for this %s when it is published or updated.","classifai"),d),checked:n,onChange:e=>{wp.data.dispatch("core/editor").editPost({classifai_synthesize_speech:e})},disabled:u,isBusy:u}),y&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(l.ToggleControl,{label:(0,o.__)("Display audio controls","classifai"),help:(0,o.__)("Controls the display of the audio player on the front-end.","classifai"),checked:c,onChange:e=>{wp.data.dispatch("core/editor").editPost({classifai_display_generated_audio:e})},disabled:u,isBusy:u}),(0,e.createElement)(l.BaseControl,{id:"classifai-audio-preview-controls",help:u?"":(0,o.__)("Preview the generated audio.","classifai")},(0,e.createElement)(l.Button,{id:"classifai-audio-controls__preview-btn",icon:(0,e.createElement)(l.Icon,{icon:h}),variant:"secondary",onClick:()=>s(!t),disabled:u,isBusy:u},u?(0,o.__)("Generating audio..","classifai"):(0,o.__)("Preview","classifai")))),y&&(0,e.createElement)("audio",{id:"classifai-audio-preview",src:E,onEnded:()=>s(!1)}))};(0,d.registerPlugin)("classifai-plugin",{render:()=>{const t=(0,r.useSelect)((e=>e("core/editor").getCurrentPostType())),s=(0,r.useSelect)((e=>e("core/editor").getCurrentPostAttribute("status"))),i=f&&f.NLUEnabled,a=g&&g.enabled,n=f&&f.supportedPostTypes&&f.supportedPostTypes.includes(t),l=g&&g.supportedPostTypes&&g.supportedPostTypes.includes(t),d=f&&f.supportedPostStatues&&f.supportedPostStatues.includes(s),u=g&&g.supportedPostStatues&&g.supportedPostStatues.includes(s),p=f&&!(f.noPermissions&&1===parseInt(f.noPermissions))&&i&&n&&d,P=g&&!(g.noPermissions&&1===parseInt(g.noPermissions))&&a&&l&&u;return(0,e.createElement)(c.PluginDocumentSettingPanel,{title:(0,o.__)("ClassifAI","classifai"),icon:y,className:"classifai-panel"},(0,e.createElement)(e.Fragment,null,(p||P)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(m,null),p&&(0,e.createElement)(w,null)),_&&(0,e.createElement)(b,null)))}})})(); \ No newline at end of file diff --git a/dist/inserter-media-category.asset.php b/dist/inserter-media-category.asset.php new file mode 100644 index 000000000..2fd2e6803 --- /dev/null +++ b/dist/inserter-media-category.asset.php @@ -0,0 +1 @@ + array('wp-api-fetch', 'wp-data', 'wp-i18n', 'wp-url'), 'version' => 'e89ccec876ea48c1cb71'); diff --git a/dist/inserter-media-category.js b/dist/inserter-media-category.js new file mode 100644 index 000000000..c27fed701 --- /dev/null +++ b/dist/inserter-media-category.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.apiFetch;var a=e.n(t);const r=window.wp.data,i=window.wp.i18n,s=window.wp.url,{classifaiDalleData:n}=window;(async e=>new Promise((e=>{const t=(0,r.subscribe)((()=>{((0,r.select)("core/edit-post")?.isInserterOpened()||(0,r.select)("core/edit-site")?.isInserterOpened()||(0,r.select)("core/edit-widgets")?.isInserterOpened?.())&&(t(),e())}))})))().then((()=>(0,r.dispatch)("core/block-editor")?.registerInserterMediaCategory?.(d())));const o=(e,t=250)=>{let a;return(...r)=>(clearTimeout(a),new Promise((i=>{a=setTimeout((()=>{i(e.apply(void 0,r))}),t)})))},c=async({search:e=""})=>e?await a()({path:(0,s.addQueryArgs)(n.endpoint,{prompt:e,format:"b64_json"}),method:"GET"}).then((t=>t.map((t=>({title:e,url:`data:image/png;base64,${t.url}`,previewUrl:`data:image/png;base64,${t.url}`,id:void 0,alt:e,caption:n.caption}))))).catch((()=>[])):[],d=()=>({name:"classifai-generate-image",labels:{name:n.tabText,search_items:(0,i.__)("Enter a prompt","classifai")},mediaType:"image",fetch:o(c,2500),isExternalResource:!0})})(); \ No newline at end of file diff --git a/dist/post-excerpt.asset.php b/dist/post-excerpt.asset.php index d81ef3d97..1fe21fb0d 100644 --- a/dist/post-excerpt.asset.php +++ b/dist/post-excerpt.asset.php @@ -1 +1 @@ - array('wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '764b402ecd2a2c3902c6'); + array('wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '62fd488cabc3d26e57c7'); diff --git a/dist/post-excerpt.js b/dist/post-excerpt.js index 927d8cf79..053deb3aa 100644 --- a/dist/post-excerpt.js +++ b/dist/post-excerpt.js @@ -1 +1 @@ -(()=>{"use strict";const e=window.wp.element,t=window.wp.i18n,n=window.wp.data,s=window.wp.editPost,r=window.wp.editor,a=window.wp.plugins,i=window.wp.components,o=window.wp.compose,{get:l}=lodash,c=(0,o.compose)([(0,n.withSelect)((e=>({excerpt:e("core/editor").getEditedPostAttribute("excerpt")}))),(0,n.withDispatch)((e=>({onUpdateExcerpt(t){e("core/editor").editPost({excerpt:t})}})))])((function({excerpt:n,onUpdateExcerpt:s}){const{select:r}=wp.data,a=r("core/editor").getCurrentPostId(),o=""===n?(0,t.__)("Generate excerpt","classifai"):(0,t.__)("Re-generate excerpt","classifai"),c=r("core/edit-post").isPublishSidebarOpened();return(0,e.createElement)("div",{className:"editor-post-excerpt"},(0,e.createElement)(i.TextareaControl,{__nextHasNoMarginBottom:!0,label:c?null:(0,t.__)("Write an excerpt (optional)"),className:"editor-post-excerpt__textarea",onChange:e=>s(e),value:n}),!c&&(0,e.createElement)(i.ExternalLink,{href:(0,t.__)("https://wordpress.org/support/article/settings-sidebar/#excerpt")},(0,t.__)("Learn more about manual excerpts")),(0,e.createElement)(i.Button,{variant:"secondary","data-id":a,onClick:e=>(({button:e,endpoint:n,callback:s=!1,buttonText:r=(0,t.__)("Rescan","classifai")})=>{const a=e.getAttribute("data-id"),[i]=e.parentNode.getElementsByClassName("spinner"),[o]=e.parentNode.getElementsByClassName("error"),c=`${n}${a}`;e.setAttribute("disabled","disabled"),i.style.display="inline-block",i.classList.add("is-active"),o.style.display="none",wp.apiRequest({path:c}).then((t=>{e.removeAttribute("disabled"),i.style.display="none",i.classList.remove("is-active"),e.textContent=r,s&&s(t)}),(n=>{const s=l(n,"responseJSON",{code:"unknown_error",message:(0,t.__)("An unknown error occurred.","classifai")});i.style.display="none",i.classList.remove("is-active"),e.removeAttribute("disabled"),e.textContent=r,o.style.display="inline-block",o.textContent=`Error: ${s.message}`}))})({button:e.target,endpoint:"/classifai/v1/openai/generate-excerpt/",callback:s,buttonText:o})},o),(0,e.createElement)("span",{className:"spinner",style:{display:"none",float:"none"}}),(0,e.createElement)("span",{className:"error",style:{display:"none",color:"#bc0b0b",paddingTop:"5px"}}))})),p=({children:n})=>{const r=[(0,t.__)("Suggestion:"),(0,e.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},(0,t.__)("Generate excerpt","classifai"))];return(0,e.createElement)(s.PluginPrePublishPanel,{title:r,icon:"aside",initialOpen:!0},n)};class d extends e.Component{constructor(e){super(e),this.state={hadExcerptWhenOpeningThePanel:""!==e.excerpt}}componentDidUpdate(e){this.props.isPublishPanelOpen&&e.isPublishPanelOpen!==this.props.isPublishPanelOpen&&this.setState({hadExcerptWhenOpeningThePanel:""!==this.props.excerpt})}render(){return this.state.hadExcerptWhenOpeningThePanel?null:(0,e.createElement)(p,null,this.props.children)}}const u=(0,n.withSelect)((e=>({excerpt:e("core/editor").getEditedPostAttribute("excerpt"),isPublishPanelOpen:e("core/edit-post").isPublishSidebarOpened()})))(d);(0,n.dispatch)("core/edit-post").removeEditorPanel("post-excerpt"),(0,a.registerPlugin)("post-excerpt",{render:()=>(0,e.createElement)(r.PostExcerptCheck,null,(0,e.createElement)(s.PluginDocumentSettingPanel,{title:(0,t.__)("Excerpt")},(0,e.createElement)(c,null)),(0,e.createElement)(u,null,(0,e.createElement)(c,null)))})})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,n=window.wp.i18n,r=window.wp.data,a=window.wp.editPost,i=window.wp.editor,s=window.wp.plugins,o=window.wp.components,c=window.wp.compose,l=window.wp.apiFetch;var p=e.n(l);const d=(0,c.compose)([(0,r.withSelect)((e=>({excerpt:e("core/editor").getEditedPostAttribute("excerpt")}))),(0,r.withDispatch)((e=>({onUpdateExcerpt(t){e("core/editor").editPost({excerpt:t})}})))])((function({excerpt:e,onUpdateExcerpt:r}){const[a,i]=(0,t.useState)(!1),[s,c]=(0,t.useState)(!1),{select:l}=wp.data,d=l("core/editor").getCurrentPostId(),u=l("core/editor").getEditedPostAttribute("content"),h=l("core/editor").getEditedPostAttribute("title"),m=""===e?(0,n.__)("Generate excerpt","classifai"):(0,n.__)("Re-generate excerpt","classifai"),w=l("core/edit-post").isPublishSidebarOpened();return(0,t.createElement)("div",{className:"editor-post-excerpt"},(0,t.createElement)(o.TextareaControl,{__nextHasNoMarginBottom:!0,label:w?null:(0,n.__)("Write an excerpt (optional)"),className:"editor-post-excerpt__textarea",onChange:e=>r(e),value:e}),!w&&(0,t.createElement)(o.ExternalLink,{href:(0,n.__)("https://wordpress.org/support/article/settings-sidebar/#excerpt")},(0,n.__)("Learn more about manual excerpts")),(0,t.createElement)(o.Button,{className:"classifai-post-excerpt",variant:"secondary",disabled:a,"data-id":d,onClick:()=>(async e=>{i(!0),p()({path:"/classifai/v1/openai/generate-excerpt/",method:"POST",data:{id:d,content:u,title:h}}).then((e=>{r(e),c(!1),i(!1)}),(e=>{c(e?.message),i(!1)}))})()},m),a&&(0,t.createElement)("span",{className:"spinner is-active",style:{float:"none"}}),s&&!a&&(0,t.createElement)("span",{className:"error",style:{color:"#bc0b0b",display:"inline-block",paddingTop:"5px"}},s))})),u=({children:e})=>{const r=[(0,n.__)("Suggestion:"),(0,t.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},(0,n.__)("Generate excerpt","classifai"))];return(0,t.createElement)(a.PluginPrePublishPanel,{title:r,icon:"aside",initialOpen:!0},e)};class h extends t.Component{constructor(e){super(e),this.state={hadExcerptWhenOpeningThePanel:""!==e.excerpt}}componentDidUpdate(e){this.props.isPublishPanelOpen&&e.isPublishPanelOpen!==this.props.isPublishPanelOpen&&this.setState({hadExcerptWhenOpeningThePanel:""!==this.props.excerpt})}render(){return this.state.hadExcerptWhenOpeningThePanel?null:(0,t.createElement)(u,null,this.props.children)}}const m=(0,r.withSelect)((e=>({excerpt:e("core/editor").getEditedPostAttribute("excerpt"),isPublishPanelOpen:e("core/edit-post").isPublishSidebarOpened()})))(h);(0,r.dispatch)("core/edit-post").removeEditorPanel("post-excerpt"),(0,s.registerPlugin)("post-excerpt",{render:()=>(0,t.createElement)(i.PostExcerptCheck,null,(0,t.createElement)(a.PluginDocumentSettingPanel,{title:(0,n.__)("Excerpt")},(0,t.createElement)(d,null)),(0,t.createElement)(m,null,(0,t.createElement)(d,null)))})})(); \ No newline at end of file diff --git a/dist/post-status-info.asset.php b/dist/post-status-info.asset.php index 8a3b0d7fb..42aaecebc 100644 --- a/dist/post-status-info.asset.php +++ b/dist/post-status-info.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '4e017814ec22614f285d'); + array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => 'bfb28730ba8a02436042'); diff --git a/dist/post-status-info.js b/dist/post-status-info.js index 104f63198..63944da2e 100644 --- a/dist/post-status-info.js +++ b/dist/post-status-info.js @@ -1 +1 @@ -(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,a=window.wp.data,n=window.wp.editPost,r=window.wp.editor,s=window.wp.components,l=window.wp.i18n,o=window.wp.plugins,i=window.wp.apiFetch;var c=e.n(i);const{classifaiChatGPTData:u}=window,d=({error:e})=>e?(0,t.createElement)("div",{className:"error"},e):null;(0,o.registerPlugin)("classifai-status-info",{render:()=>{const[e,o]=(0,t.useState)(!1),[i,p]=(0,t.useState)(!1),[w,m]=(0,t.useState)(!1),[f,E]=(0,t.useState)([]);if(!u||!u.enabledFeatures)return null;if(u.noPermissions&&1===parseInt(u.noPermissions))return null;const P=(0,a.select)("core/editor").getCurrentPostId(),g=()=>p(!1)&&E([])&&m(!1);return(0,t.createElement)(n.PluginPostStatusInfo,{className:"classifai-post-status"},i&&(0,t.createElement)(s.Modal,{title:(0,l.__)("Select a title","classifai"),onRequestClose:g,isFullScreen:!1,className:"title-modal"},e&&(0,t.createElement)(s.Spinner,null),!e&&f&&(0,t.createElement)((({data:e})=>e?(0,t.createElement)(t.Fragment,null,e.map(((n,r)=>(0,t.createElement)("div",{className:"classifai-title",key:r},(0,t.createElement)("textarea",{rows:"5",onChange:t=>{e[r]=t.target.value,E(e)}},n),(0,t.createElement)(s.Button,{variant:"secondary",onClick:()=>{(0,a.dispatch)("core/editor").editPost({title:f[r]}),g()}},(0,l.__)("Select","classifai")))))):null),{data:f}),!e&&w&&(0,t.createElement)(d,{error:w})),u.enabledFeatures.map((e=>{const a=e?.path+P;return(0,t.createElement)(r.PostTypeSupportCheck,{key:e?.feature,supportKeys:e?.feature},(0,t.createElement)(s.Button,{className:e?.feature,variant:"secondary",onClick:()=>(async e=>{o(!0),p(!0),c()({path:e}).then((e=>{E(e),m(!1),o(!1)}),(e=>{m(e?.message),E([]),o(!1)}))})(a)},e?.buttonText))})))}})})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,a=window.wp.data,n=window.wp.editPost,r=window.wp.editor,s=window.wp.components,o=window.wp.i18n,l=window.wp.plugins,i=window.wp.apiFetch;var c=e.n(i);const{classifaiChatGPTData:u}=window,d=({error:e})=>e?(0,t.createElement)("div",{className:"error"},e):null;(0,l.registerPlugin)("classifai-status-info",{render:()=>{const[e,l]=(0,t.useState)(!1),[i,m]=(0,t.useState)(!1),[p,w]=(0,t.useState)(!1),[f,P]=(0,t.useState)([]);if(!u||!u.enabledFeatures)return null;if(u.noPermissions&&1===parseInt(u.noPermissions))return null;const E=(0,a.select)("core/editor").getCurrentPostId(),g=(0,a.select)("core/editor").getEditedPostAttribute("content"),S=()=>m(!1)&&P([])&&w(!1);return(0,t.createElement)(n.PluginPostStatusInfo,{className:"classifai-post-status"},i&&(0,t.createElement)(s.Modal,{title:(0,o.__)("Select a title","classifai"),onRequestClose:S,isFullScreen:!1,className:"title-modal"},e&&(0,t.createElement)(s.Spinner,null),!e&&f&&(0,t.createElement)((({data:e})=>e?(0,t.createElement)(t.Fragment,null,e.map(((n,r)=>(0,t.createElement)("div",{className:"classifai-title",key:r},(0,t.createElement)("textarea",{rows:"5",onChange:t=>{e[r]=t.target.value,P(e)}},n),(0,t.createElement)(s.Button,{variant:"secondary",onClick:()=>{(0,a.dispatch)("core/editor").editPost({title:f[r]}),S()}},(0,o.__)("Select","classifai")))))):null),{data:f}),!e&&p&&(0,t.createElement)(d,{error:p})),u.enabledFeatures.map((e=>{const a=e?.path;return(0,t.createElement)(r.PostTypeSupportCheck,{key:e?.feature,supportKeys:e?.feature},(0,t.createElement)(s.Button,{className:e?.feature,variant:"secondary",onClick:()=>(async e=>{l(!0),m(!0),c()({path:e,method:"POST",data:{id:E,content:g}}).then((e=>{P(e),w(!1),l(!1)}),(e=>{w(e?.message),P([]),l(!1)}))})(a)},e?.buttonText))})))}})})(); \ No newline at end of file diff --git a/dist/recommended-content-block.asset.php b/dist/recommended-content-block.asset.php index 2b06451fa..a7320a747 100644 --- a/dist/recommended-content-block.asset.php +++ b/dist/recommended-content-block.asset.php @@ -1 +1 @@ - array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-server-side-render'), 'version' => '501cbbd0d2fb22ad2bfc'); + array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-server-side-render'), 'version' => '5c1e6b67447be750d260'); diff --git a/dist/recommended-content-block.js b/dist/recommended-content-block.js index d67f06d7a..bbefe7417 100644 --- a/dist/recommended-content-block.js +++ b/dist/recommended-content-block.js @@ -1 +1 @@ -(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.i18n,n=window.wp.blocks,a=window.wp.element,l=window.wp.components,o=window.wp.blockEditor,s=window.wp.primitives,r=(0,a.createElement)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(s.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})),i=(0,a.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(s.Path,{d:"m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",fillRule:"evenodd",clipRule:"evenodd"})),c=window.wp.data,d=window.wp.serverSideRender;var m=e.n(d);const u=window.wp.coreData,p=e=>{const t=e?.reduce(((e,t)=>{const{mapById:n,mapByName:a,names:l}=e;return n[t.id]=t,a[t.name]=t,l.push(t.name),e}),{mapById:{},mapByName:{},names:[]});return{entities:e,...t}},g=({onChange:e,query:t})=>{const n=(o=t.contentPostType,(0,c.useSelect)((e=>{const{getTaxonomies:t}=e(u.store);return t({type:o,per_page:-1,context:"view"})}),[o]));var o;const s=(0,c.useSelect)((e=>{const{getEntityRecords:t}=e(u.store),a={per_page:100},l=n?.map((({slug:e,name:n})=>{const l=t("taxonomy",e,a);return{slug:e,name:n,terms:p(l)}}));return l}),[n]),r=e=>{const n=s.find((({slug:t})=>t===e));return n?(t.taxQuery?.[e]||[]).reduce(((e,t)=>{const a=n.terms.mapById[t];return a&&e.push({id:t,value:a.name}),e}),[]):[]};return(0,a.createElement)(a.Fragment,null,!!s?.length&&s.map((({slug:n,name:o,terms:i})=>{return i?.names?.length?(0,a.createElement)(l.FormTokenField,{key:n,label:o,value:r(n),suggestions:i.names,onChange:(c=n,n=>{const a=s.find((({slug:e})=>e===c));if(!a)return;const l=Array.from(n.reduce(((e,t)=>{const n=((e,t)=>{const n=t?.id||e[t]?.id;if(n)return n;const a=t.toLocaleLowerCase();for(const t in e)if(t.toLocaleLowerCase()===a)return e[t].id})(a.terms.mapByName,t);return n&&e.add(n),e}),new Set)),o={...t.taxQuery,[c]:l};e({taxQuery:o})})}):null;var c})))},y=JSON.parse('{"u2":"classifai/recommended-content-block"}'),h=window.React;var w;function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{attributes:n,setAttributes:s}=e,{columns:d=3,displayLayout:p="grid",numberOfItems:y=3,contentPostType:h,taxQuery:w,displayAuthor:v,displayFeaturedImage:f,displayPostDate:_,displayPostExcerpt:b,addLinkToFeaturedImage:C}=n,E=(0,c.useSelect)((e=>e("core/editor").getCurrentPostId())),P=(0,o.useBlockProps)(),{postTypesTaxonomiesMap:x,postTypesSelectOptions:k}=(()=>{const e=(0,c.useSelect)((e=>{const{getPostTypes:t}=e(u.store),n=["attachment"],a=t({per_page:-1})?.filter((({viewable:e,slug:t})=>e&&!n.includes(t)));return a}),[]);return{postTypesTaxonomiesMap:(0,a.useMemo)((()=>{if(e?.length)return e.reduce(((e,t)=>(e[t.slug]=t.taxonomies,e)),{})}),[e]),postTypesSelectOptions:(0,a.useMemo)((()=>(e||[]).map((({labels:e,slug:t})=>({label:e.singular_name,value:t})))),[e])}})(),T=[{icon:r,title:(0,t.__)("List view","classifai"),onClick:()=>s({displayLayout:"list"}),isActive:"list"===p},{icon:i,title:(0,t.__)("Grid view"),onClick:()=>s({displayLayout:"grid"}),isActive:"grid"===p}];return(0,a.createElement)("div",P,(0,a.createElement)(o.BlockControls,null,(0,a.createElement)(l.ToolbarGroup,{controls:T})),(0,a.createElement)(o.InspectorControls,null,(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Recommended Content Filters","classifai")},k&&(0,a.createElement)(l.SelectControl,{label:(0,t.__)("Post type","classifai"),value:h,options:k,onChange:e=>{const t={contentPostType:e},n=x[e],a=Object.entries(w||{}).reduce(((e,[t,a])=>(n.includes(t)&&(e[t]=a),e)),{});t.taxQuery=Object.keys(a).length?a:void 0,s(t)}}),k&&(0,a.createElement)(g,{onChange:s,query:n})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Settings","classifai")},(0,a.createElement)(l.RangeControl,{label:(0,t.__)("Number of items","classifai"),value:y,onChange:e=>s({numberOfItems:e}),min:1,max:50,required:!0}),"grid"===p&&(0,a.createElement)(l.RangeControl,{label:(0,t.__)("Columns","classifai"),value:d,onChange:e=>s({columns:e}),min:2,max:6,required:!0})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Post content settings","classifai")},(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Post excerpt","classifai"),checked:b,onChange:e=>s({displayPostExcerpt:e})})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Post meta settings","classifai")},(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Display author name","classifai"),checked:v,onChange:e=>s({displayAuthor:e})}),(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Display post date","classifai"),checked:_,onChange:e=>s({displayPostDate:e})})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Featured image settings","classifai")},(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Display featured image","classifai"),checked:f,onChange:e=>s({displayFeaturedImage:e})}),f&&(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Add link to featured image","classifai"),checked:C,onChange:e=>s({addLinkToFeaturedImage:e})}))),!h&&(0,a.createElement)(l.Placeholder,{label:(0,t.__)("ClassifAI Recommended Content","classifai")},(0,a.createElement)("p",null,(0,t.__)("Please select Post type for this Recommended Content block on the sidebar settings.","classifai"))),h&&(0,a.createElement)(m(),{block:"classifai/recommended-content-block",attributes:{addLinkToFeaturedImage:C,columns:d,contentPostType:h,displayAuthor:v,displayFeaturedImage:f,displayLayout:p,displayPostDate:_,displayPostExcerpt:b,numberOfItems:y,taxQuery:w,excludeId:E||0}}))},save:()=>null,icon:function(e){return h.createElement("svg",v({width:20,height:15,viewBox:"0 0 61 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),w||(w=h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.52 0C1.575 0 0 1.584 0 3.538v38.924C0 44.416 1.576 46 3.52 46h53.96c1.944 0 3.52-1.584 3.52-3.538V3.538C61 1.584 59.424 0 57.48 0H3.52Zm13.189 8.138h4.739L33.58 39.554h-6.056l-3.492-9.04H13.97l-3.453 9.04h-5.96L16.709 8.138Zm2.38 8.563c-.104.34-.211.672-.319.997l-.012.036-2.76 7.406h6.148l-2.745-7.455-.312-.984Zm21.227-8.563h12.59v4.015l-3.413.819V34.63l3.413.779v4.024h-12.59V35.41l3.413-.78V12.972l-3.413-.818V8.138Z",fill:"#1e1e1e"})))}})})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.i18n,n=window.wp.blocks,a=window.wp.element,l=window.wp.components,o=window.wp.blockEditor,s=window.wp.primitives,r=(0,a.createElement)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(s.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})),i=(0,a.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(s.Path,{d:"m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z",fillRule:"evenodd",clipRule:"evenodd"})),c=window.wp.data,d=window.wp.serverSideRender;var m=e.n(d);const u=window.wp.coreData,p=e=>{const t=e?.reduce(((e,t)=>{const{mapById:n,mapByName:a,names:l}=e;return n[t.id]=t,a[t.name]=t,l.push(t.name),e}),{mapById:{},mapByName:{},names:[]});return{entities:e,...t}},g=({onChange:e,query:t})=>{const n=(o=t.contentPostType,(0,c.useSelect)((e=>{const{getTaxonomies:t}=e(u.store);return t({type:o,per_page:-1,context:"view"})}),[o]));var o;const s=(0,c.useSelect)((e=>{const{getEntityRecords:t}=e(u.store),a={per_page:100},l=n?.map((({slug:e,name:n})=>{const l=t("taxonomy",e,a);return{slug:e,name:n,terms:p(l)}}));return l}),[n]),r=e=>{const n=s.find((({slug:t})=>t===e));return n?(t.taxQuery?.[e]||[]).reduce(((e,t)=>{const a=n.terms.mapById[t];return a&&e.push({id:t,value:a.name}),e}),[]):[]};return(0,a.createElement)(a.Fragment,null,!!s?.length&&s.map((({slug:n,name:o,terms:i})=>{return i?.names?.length?(0,a.createElement)(l.FormTokenField,{key:n,label:o,value:r(n),suggestions:i.names,onChange:(c=n,n=>{const a=s.find((({slug:e})=>e===c));if(!a)return;const l=Array.from(n.reduce(((e,t)=>{const n=((e,t)=>{const n=t?.id||e[t]?.id;if(n)return n;const a=t.toLocaleLowerCase();for(const t in e)if(t.toLocaleLowerCase()===a)return e[t].id})(a.terms.mapByName,t);return n&&e.add(n),e}),new Set)),o={...t.taxQuery,[c]:l};e({taxQuery:o})})}):null;var c})))},y=JSON.parse('{"u2":"classifai/recommended-content-block"}'),h=window.React;var w;function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const{attributes:n,setAttributes:s}=e,{columns:d=3,displayLayout:p="grid",numberOfItems:y=3,contentPostType:h,taxQuery:w,displayAuthor:v,displayFeaturedImage:f,displayPostDate:_,displayPostExcerpt:b,addLinkToFeaturedImage:C}=n,E=(0,c.useSelect)((e=>e("core/editor").getCurrentPostId())),P=(0,o.useBlockProps)(),{postTypesTaxonomiesMap:x,postTypesSelectOptions:k}=(()=>{const e=(0,c.useSelect)((e=>{const{getPostTypes:t}=e(u.store),n=["attachment"],a=t({per_page:-1})?.filter((({viewable:e,slug:t})=>e&&!n.includes(t)));return a}),[]);return{postTypesTaxonomiesMap:(0,a.useMemo)((()=>{if(e?.length)return e.reduce(((e,t)=>(e[t.slug]=t.taxonomies,e)),{})}),[e]),postTypesSelectOptions:(0,a.useMemo)((()=>(e||[]).map((({labels:e,slug:t})=>({label:e.singular_name,value:t})))),[e])}})(),T=[{icon:r,title:(0,t.__)("List view","classifai"),onClick:()=>s({displayLayout:"list"}),isActive:"list"===p},{icon:i,title:(0,t.__)("Grid view"),onClick:()=>s({displayLayout:"grid"}),isActive:"grid"===p}];return(0,a.createElement)("div",P,(0,a.createElement)(o.BlockControls,null,(0,a.createElement)(l.ToolbarGroup,{controls:T})),(0,a.createElement)(o.InspectorControls,null,(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Recommended Content Filters","classifai")},k&&(0,a.createElement)(l.SelectControl,{label:(0,t.__)("Post type","classifai"),value:h,options:k,onChange:e=>{const t={contentPostType:e},n=x[e],a=Object.entries(w||{}).reduce(((e,[t,a])=>(n.includes(t)&&(e[t]=a),e)),{});t.taxQuery=Object.keys(a).length?a:void 0,s(t)}}),k&&(0,a.createElement)(g,{onChange:s,query:n})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Settings","classifai")},(0,a.createElement)(l.RangeControl,{label:(0,t.__)("Number of items","classifai"),value:y,onChange:e=>s({numberOfItems:e}),min:1,max:50,required:!0}),"grid"===p&&(0,a.createElement)(l.RangeControl,{label:(0,t.__)("Columns","classifai"),value:d,onChange:e=>s({columns:e}),min:2,max:6,required:!0})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Post content settings","classifai")},(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Post excerpt","classifai"),checked:b,onChange:e=>s({displayPostExcerpt:e})})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Post meta settings","classifai")},(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Display author name","classifai"),checked:v,onChange:e=>s({displayAuthor:e})}),(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Display post date","classifai"),checked:_,onChange:e=>s({displayPostDate:e})})),(0,a.createElement)(l.PanelBody,{title:(0,t.__)("Featured image settings","classifai")},(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Display featured image","classifai"),checked:f,onChange:e=>s({displayFeaturedImage:e})}),f&&(0,a.createElement)(l.ToggleControl,{label:(0,t.__)("Add link to featured image","classifai"),checked:C,onChange:e=>s({addLinkToFeaturedImage:e})}))),!h&&(0,a.createElement)(l.Placeholder,{label:(0,t.__)("ClassifAI Recommended Content","classifai")},(0,a.createElement)("p",null,(0,t.__)("Please select Post type for this Recommended Content block on the sidebar settings.","classifai"))),h&&(0,a.createElement)(m(),{block:"classifai/recommended-content-block",attributes:{addLinkToFeaturedImage:C,columns:d,contentPostType:h,displayAuthor:v,displayFeaturedImage:f,displayLayout:p,displayPostDate:_,displayPostExcerpt:b,numberOfItems:y,taxQuery:w,excludeId:E||0}}))},save:()=>null,icon:function(e){return h.createElement("svg",v({width:20,height:15,viewBox:"0 0 61 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),w||(w=h.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.52 0C1.575 0 0 1.584 0 3.538v38.924C0 44.416 1.576 46 3.52 46h53.96c1.944 0 3.52-1.584 3.52-3.538V3.538C61 1.584 59.424 0 57.48 0H3.52Zm13.189 8.138h4.739L33.58 39.554h-6.056l-3.492-9.04H13.97l-3.453 9.04h-5.96L16.709 8.138Zm2.38 8.563c-.104.34-.211.672-.319.997l-.012.036-2.76 7.406h6.148l-2.745-7.455-.312-.984Zm21.227-8.563h12.59v4.015l-3.413.819V34.63l3.413.779v4.024h-12.59V35.41l3.413-.78V12.972l-3.413-.818V8.138Z",fill:"#1e1e1e"})))}})})(); \ No newline at end of file diff --git a/includes/Classifai/Admin/BulkActions.php b/includes/Classifai/Admin/BulkActions.php index c6bc730b3..e01e75f9d 100644 --- a/includes/Classifai/Admin/BulkActions.php +++ b/includes/Classifai/Admin/BulkActions.php @@ -9,6 +9,7 @@ use Classifai\Providers\OpenAI\Whisper\Transcribe; use function Classifai\get_post_types_for_language_settings; use function Classifai\get_supported_post_types; +use function Classifai\get_tts_supported_post_types; /** * Handle bulk actions. @@ -68,15 +69,14 @@ public function register() { * Register bulk actions for language processing. */ public function register_language_processing_hooks() { - $this->chat_gpt = new ChatGPT( false ); - $this->embeddings = new Embeddings( false ); - $this->text_to_speech = new TextToSpeech( false ); + $this->chat_gpt = new ChatGPT( false ); + $this->embeddings = new Embeddings( false ); $user_roles = wp_get_current_user()->roles ?? []; $embedding_settings = $this->embeddings->get_settings(); $embeddings_post_types = []; $nlu_post_types = get_supported_post_types(); - $text_to_speech_post_types = $this->text_to_speech->get_supported_post_types(); + $text_to_speech_post_types = get_tts_supported_post_types(); $chat_gpt_post_types = []; $chat_gpt_settings = $this->chat_gpt->get_settings(); @@ -104,11 +104,6 @@ public function register_language_processing_hooks() { $this->embeddings = null; } - // Clear our TextToSpeech handler if no post types are set up. - if ( empty( $text_to_speech_post_types ) ) { - $this->text_to_speech = null; - } - // Merge our post types together and make them unique. $post_types = array_unique( array_merge( $chat_gpt_post_types, $embeddings_post_types, $nlu_post_types, $text_to_speech_post_types ) ); diff --git a/includes/Classifai/Admin/Onboarding.php b/includes/Classifai/Admin/Onboarding.php index b96ebc2cb..be329cca8 100644 --- a/includes/Classifai/Admin/Onboarding.php +++ b/includes/Classifai/Admin/Onboarding.php @@ -170,7 +170,7 @@ public function handle_step_submission() { switch ( $step ) { case 1: // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $enabled_features = isset( $_POST['classifai-features'] ) ? $this->classifai_sanitize( $_POST['classifai-features'] ) : array(); + $enabled_features = isset( $_POST['classifai-features'] ) ? $this->classifai_sanitize( wp_unslash( $_POST['classifai-features'] ) ) : array(); if ( empty( $enabled_features ) ) { add_settings_error( @@ -228,7 +228,7 @@ public function handle_step_submission() { case 2: // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $classifai_settings = isset( $_POST['classifai_settings'] ) ? $this->classifai_sanitize( $_POST['classifai_settings'] ) : array(); + $classifai_settings = isset( $_POST['classifai_settings'] ) ? $this->classifai_sanitize( wp_unslash( $_POST['classifai_settings'] ) ) : array(); // Save the ClassifAI settings. update_option( 'classifai_settings', $classifai_settings ); @@ -256,7 +256,7 @@ public function handle_step_submission() { } // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $form_data = isset( $_POST[ $provider_option ] ) ? $this->classifai_sanitize( $_POST[ $provider_option ] ) : array(); + $form_data = isset( $_POST[ $provider_option ] ) ? $this->classifai_sanitize( wp_unslash( $_POST[ $provider_option ] ) ) : array(); $settings = $provider->get_settings(); $options = self::get_onboarding_options(); @@ -543,7 +543,7 @@ public function update_onboarding_options( $options ) { * Handle skip setup step. */ public function handle_skip_setup_step() { - if ( ! empty( $_GET['classifai_skip_step_nonce'] ) && wp_verify_nonce( sanitize_text_field( $_GET['classifai_skip_step_nonce'] ), 'classifai_skip_step_action' ) ) { + if ( ! empty( $_GET['classifai_skip_step_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['classifai_skip_step_nonce'] ) ), 'classifai_skip_step_action' ) ) { $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; $onboarding_options = array( diff --git a/includes/Classifai/Admin/PreviewClassifierData.php b/includes/Classifai/Admin/PreviewClassifierData.php index e643f3c0f..d5cfa0973 100644 --- a/includes/Classifai/Admin/PreviewClassifierData.php +++ b/includes/Classifai/Admin/PreviewClassifierData.php @@ -18,7 +18,7 @@ public function __construct() { * Returns classifier data for previewing. */ public function get_post_classifier_preview_data() { - $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : false; + $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : false; if ( ! $nonce || ! wp_verify_nonce( $nonce, 'classifai-previewer-action' ) ) { wp_send_json_error( esc_html__( 'Failed nonce check.', 'classifai' ) ); @@ -42,15 +42,15 @@ public function get_post_classifier_preview_data() { * Searches and returns posts. */ public function get_post_search_results() { - $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : false; + $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : false; if ( ! $nonce || ! wp_verify_nonce( $nonce, 'classifai-previewer-action' ) ) { wp_send_json_error( esc_html__( 'Failed nonce check.', 'classifai' ) ); } - $search_term = isset( $_POST['search'] ) ? sanitize_text_field( $_POST['search'] ) : ''; - $post_types = isset( $_POST['post_types'] ) ? explode( ',', sanitize_text_field( $_POST['post_types'] ) ) : 'post'; - $post_statuses = isset( $_POST['post_status'] ) ? explode( ',', sanitize_text_field( $_POST['post_status'] ) ) : 'publish'; + $search_term = isset( $_POST['search'] ) ? sanitize_text_field( wp_unslash( $_POST['search'] ) ) : ''; + $post_types = isset( $_POST['post_types'] ) ? explode( ',', sanitize_text_field( wp_unslash( $_POST['post_types'] ) ) ) : 'post'; + $post_statuses = isset( $_POST['post_status'] ) ? explode( ',', sanitize_text_field( wp_unslash( $_POST['post_status'] ) ) ) : 'publish'; $posts = get_posts( array( diff --git a/includes/Classifai/Admin/SavePostHandler.php b/includes/Classifai/Admin/SavePostHandler.php index 0cf6ddb68..6a8df50fe 100644 --- a/includes/Classifai/Admin/SavePostHandler.php +++ b/includes/Classifai/Admin/SavePostHandler.php @@ -418,7 +418,7 @@ public function is_rest_route() { $rest_bases = apply_filters( 'classifai_rest_bases', array( 'posts', 'pages' ) ); foreach ( $rest_bases as $rest_base ) { - if ( false !== strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'wp-json/wp/v2/' . $rest_base ) ) { + if ( false !== strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-json/wp/v2/' . $rest_base ) ) { return true; } } @@ -432,7 +432,7 @@ public function is_rest_route() { * @return void */ public function classifai_classify_post() { - if ( ! empty( $_GET['classifai_classify_post_nonce'] ) && wp_verify_nonce( sanitize_text_field( $_GET['classifai_classify_post_nonce'] ), 'classifai_classify_post_action' ) ) { + if ( ! empty( $_GET['classifai_classify_post_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['classifai_classify_post_nonce'] ) ), 'classifai_classify_post_action' ) ) { $post_id = isset( $_GET['post_id'] ) ? absint( $_GET['post_id'] ) : 0; if ( $post_id ) { $result = $this->classify( $post_id ); diff --git a/includes/Classifai/Admin/Update.php b/includes/Classifai/Admin/Update.php index dee70034f..69b0d2530 100644 --- a/includes/Classifai/Admin/Update.php +++ b/includes/Classifai/Admin/Update.php @@ -7,7 +7,7 @@ namespace Classifai\Admin; -use Puc_v4_Factory; +use YahnisElsts\PluginUpdateChecker\v5\PucFactory; /** * Plugin update class. @@ -24,7 +24,7 @@ class Update { /** * The update checker object. * - * @var Puc_v4p13_Plugin_UpdateChecker + * @var YahnisElsts\PluginUpdateChecker\v5p1\Vcs\PluginUpdateChecker */ protected $updater; @@ -34,7 +34,7 @@ class Update { * @return bool */ public function can_register() { - return class_exists( '\Puc_v4_Factory' ) && self::license_check(); + return class_exists( '\YahnisElsts\PluginUpdateChecker\v5\PucFactory' ) && self::license_check(); } /** @@ -52,7 +52,7 @@ public function register() { * @return void */ public function init() { - $this->updater = Puc_v4_Factory::buildUpdateChecker( + $this->updater = PucFactory::buildUpdateChecker( self::$repo_url, CLASSIFAI_PLUGIN, 'classifai' @@ -87,7 +87,9 @@ public function maybe_update( $transient ) { // Adding the plugin info to the `no_update` property is required // for the enable/disable auto-update links to appear correctly in the UI. - $transient->no_update[ $update->filename ] = $update; + if ( $update ) { + $transient->no_update[ $update->filename ] = $update; + } } return $transient; diff --git a/includes/Classifai/Blocks/recommended-content-block/block.json b/includes/Classifai/Blocks/recommended-content-block/block.json index 611821ec9..925350880 100644 --- a/includes/Classifai/Blocks/recommended-content-block/block.json +++ b/includes/Classifai/Blocks/recommended-content-block/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2, "title": "Recommended Content", - "description": "Display content recommended by Azure Personalizer", + "description": "Display content recommended by Azure AI Personalizer", "textdomain": "classifai", "name": "classifai/recommended-content-block", "category": "classifai-blocks", diff --git a/includes/Classifai/Blocks/recommended-content-block/index.js b/includes/Classifai/Blocks/recommended-content-block/index.js index 51a29d7b3..0f67973af 100644 --- a/includes/Classifai/Blocks/recommended-content-block/index.js +++ b/includes/Classifai/Blocks/recommended-content-block/index.js @@ -26,7 +26,7 @@ import { ReactComponent as icon } from '../../../../assets/img/block-icon.svg'; registerBlockType( block.name, { title: __( 'Recommended Content', 'classifai' ), description: __( - 'Display content recommended by Azure Personalizer', + 'Display content recommended by Azure AI Personalizer', 'classifai' ), edit, diff --git a/includes/Classifai/Command/ClassifaiCommand.php b/includes/Classifai/Command/ClassifaiCommand.php index 7c9047fe2..fb6050b8a 100644 --- a/includes/Classifai/Command/ClassifaiCommand.php +++ b/includes/Classifai/Command/ClassifaiCommand.php @@ -164,7 +164,7 @@ public function text( $args = [], $opts = [] ) { } if ( ! empty( $opts['input'] ) ) { - $text = file_get_contents( $opts['input'] ); + $text = file_get_contents( $opts['input'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents } elseif ( ! empty( $args ) ) { $text = $args[0]; } else { @@ -1156,7 +1156,7 @@ private function get_posts_to_classify( $opts = [] ) { 'post_type' => ! empty( $opts['post_type'] ) ? $opts['post_type'] : 'any', 'post_status' => 'publish', 'fields' => 'ids', - 'posts_per_page' => -1, + 'posts_per_page' => -1, // phpcs:ignore WordPress.WP.PostsPerPageNoUnlimited.posts_per_page_posts_per_page ]; \WP_CLI::log( 'Fetching posts to classify ...' ); diff --git a/includes/Classifai/Command/RSSImporterCommand.php b/includes/Classifai/Command/RSSImporterCommand.php index 4678334c6..a841f43af 100644 --- a/includes/Classifai/Command/RSSImporterCommand.php +++ b/includes/Classifai/Command/RSSImporterCommand.php @@ -203,7 +203,7 @@ public function get_url_meta( $url ) { $options['headers']['x-api-key'] = MERCURY_PARSER_API_KEY; $options['timeout'] = 60; // phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout - $request_url = 'https://mercury.postlight.com/parser?url=' . urlencode( $url ); + $request_url = 'https://mercury.postlight.com/parser?url=' . rawurlencode( $url ); $response = wp_remote_get( $request_url, $options ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get if ( ! is_wp_error( $response ) ) { diff --git a/includes/Classifai/Helpers.php b/includes/Classifai/Helpers.php index 734bf1db6..47f47e3f1 100644 --- a/includes/Classifai/Helpers.php +++ b/includes/Classifai/Helpers.php @@ -3,6 +3,7 @@ namespace Classifai; use Classifai\Providers\Provider; +use Classifai\Providers\Azure; use Classifai\Services\Service; use Classifai\Services\ServicesManager; use WP_Error; @@ -275,6 +276,28 @@ function get_supported_post_types() { return $post_types; } +/** + * The list of post types that TTS supports. + * + * @return array Supported Post Types. + */ +function get_tts_supported_post_types() { + $classifai_settings = get_plugin_settings( 'language_processing', Azure\TextToSpeech::FEATURE_NAME ); + + if ( empty( $classifai_settings ) ) { + $post_types = []; + } else { + $post_types = []; + foreach ( $classifai_settings['post_types'] as $post_type => $enabled ) { + if ( ! empty( $enabled ) ) { + $post_types[] = $post_type; + } + } + } + + return $post_types; +} + /** * The list of post statuses that get the ClassifAI taxonomies. Defaults * to 'publish'. diff --git a/includes/Classifai/Plugin.php b/includes/Classifai/Plugin.php index 4587dfa18..d9aad7b04 100644 --- a/includes/Classifai/Plugin.php +++ b/includes/Classifai/Plugin.php @@ -188,6 +188,16 @@ public function enqueue_admin_assets() { 'ajax_nonce' => wp_create_nonce( 'classifai' ), ] ); + + if ( wp_script_is( 'wp-commands', 'registered' ) ) { + wp_enqueue_script( + 'classifai-commands', + CLASSIFAI_PLUGIN_URL . 'dist/commands.js', + get_asset_info( 'commands', 'dependencies' ), + get_asset_info( 'commands', 'version' ), + true + ); + } } /** diff --git a/includes/Classifai/Providers/Azure/ComputerVision.php b/includes/Classifai/Providers/Azure/ComputerVision.php index 00ee86901..5fdabe5e3 100644 --- a/includes/Classifai/Providers/Azure/ComputerVision.php +++ b/includes/Classifai/Providers/Azure/ComputerVision.php @@ -31,14 +31,14 @@ class ComputerVision extends Provider { public function __construct( $service ) { parent::__construct( 'Microsoft Azure', - 'Computer Vision', + 'AI Vision', 'computer_vision', $service ); // Set the onboarding options. $this->onboarding_options = array( - 'title' => __( 'Microsoft Azure Computer Vision', 'classifai' ), + 'title' => __( 'Microsoft Azure AI Vision', 'classifai' ), 'fields' => array( 'url', 'api-key' ), 'features' => array( 'enable_image_captions' => __( 'Automatically add alt-text to images', 'classifai' ), @@ -62,7 +62,7 @@ public function reset_settings() { * * @return array */ - private function get_default_settings() { + public function get_default_settings() { return [ 'valid' => false, 'url' => '', @@ -1053,7 +1053,7 @@ public function setup_fields_sections() { 'input_type' => 'checkbox', 'default_value' => $default_settings['enable_smart_cropping'], 'description' => __( - 'ComputerVision detects and saves the most visually interesting part of your image (i.e., faces, animals, notable text).', + 'AI Vision detects and saves the most visually interesting part of your image (i.e., faces, animals, notable text).', 'classifai' ), ] diff --git a/includes/Classifai/Providers/Azure/Personalizer.php b/includes/Classifai/Providers/Azure/Personalizer.php index e9600cef6..3a6775917 100644 --- a/includes/Classifai/Providers/Azure/Personalizer.php +++ b/includes/Classifai/Providers/Azure/Personalizer.php @@ -1,6 +1,6 @@ onboarding_options = array( - 'title' => __( 'Microsoft Azure Personalizer', 'classifai' ), + 'title' => __( 'Microsoft Azure AI Personalizer', 'classifai' ), 'fields' => array( 'url', 'api-key' ), 'features' => array( 'authenticated' => __( 'Recommended content block', 'classifai' ), @@ -62,7 +62,7 @@ public function reset_settings() { * * @return array */ - private function get_default_settings() { + public function get_default_settings() { return [ 'authenticated' => false, 'url' => '', @@ -97,7 +97,7 @@ public function setup_fields_sections() { 'description' => sprintf( wp_kses( // translators: 1 - link to create a Personalizer resource. - __( 'Azure Cognitive Service Personalizer Endpoint, create a Personalizer resource in the Azure portal to get your key and endpoint.', 'classifai' ), + __( 'Azure AI Personalizer Endpoint, create a Personalizer resource in the Azure portal to get your key and endpoint.', 'classifai' ), array( 'a' => array( 'href' => array(), @@ -119,7 +119,7 @@ public function setup_fields_sections() { 'label_for' => 'api_key', 'input_type' => 'password', 'default_value' => $default_settings['api_key'], - 'description' => __( 'Azure Cognitive Service Personalizer Key.', 'classifai' ), + 'description' => __( 'Azure AI Personalizer Key.', 'classifai' ), ] ); } @@ -310,7 +310,7 @@ function( $ele ) { if ( is_wp_error( $response ) ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log - error_log( __( 'Failed to contact Azure Cognitive Service Personalizer: ', 'classifai' ) . $response->get_error_message() ); + error_log( __( 'Failed to contact Azure AI Personalizer: ', 'classifai' ) . $response->get_error_message() ); return array( 'response' => (object) array(), 'actions' => $action_ids, @@ -605,7 +605,7 @@ protected function get_string_words( $string ) { } /** - * Get Ranked action by sending request to Azure Personalizer. + * Get Ranked action by sending request to Azure AI Personalizer. * * @param array $rank_request Prepared Request data. * @return object|string diff --git a/includes/Classifai/Providers/Azure/Read.php b/includes/Classifai/Providers/Azure/Read.php index b7b9ed49e..dfb45a4d6 100644 --- a/includes/Classifai/Providers/Azure/Read.php +++ b/includes/Classifai/Providers/Azure/Read.php @@ -268,13 +268,10 @@ public function check_read_result( $operation_url ) { break; case 'failed': return $this->log_error( new WP_Error( 'failed_read_request', esc_html__( 'The Read operation has failed.', 'classifai' ) ) ); - break; case 'succeeded': return $this->update_document_description( $body ); - break; default: return $this->log_error( new WP_Error( 'invalid_read_result_status', esc_html__( 'Invalid Read result status.', 'classifai' ) ) ); - break; } } } diff --git a/includes/Classifai/Providers/Azure/TextToSpeech.php b/includes/Classifai/Providers/Azure/TextToSpeech.php index 8ceeffba1..d978f89a7 100644 --- a/includes/Classifai/Providers/Azure/TextToSpeech.php +++ b/includes/Classifai/Providers/Azure/TextToSpeech.php @@ -11,6 +11,7 @@ use WP_Http; use function Classifai\get_post_types_for_language_settings; +use function Classifai\get_tts_supported_post_types; use function Classifai\get_asset_info; class TextToSpeech extends Provider { @@ -30,12 +31,11 @@ class TextToSpeech extends Provider { const API_PATH = 'cognitiveservices/v1'; /** - * Meta key to store data indicating whether Text to Speech is enabled for - * the current post. + * Meta key to hide/unhide already generated audio file. * * @var string */ - const SYNTHESIZE_SPEECH_KEY = '_classifai_synthesize_speech'; + const DISPLAY_GENERATED_AUDIO = '_classifai_display_generated_audio'; /** * Meta key to get/set the ID of the speech audio file. @@ -87,21 +87,13 @@ public function __construct( $service ) { * Enqueue the editor scripts. */ public function enqueue_editor_assets() { - global $post; - - wp_enqueue_script( - 'classifai-editor', // Handle. - CLASSIFAI_PLUGIN_URL . 'dist/editor.js', - array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor', 'wp-edit-post' ), - CLASSIFAI_PLUGIN_VERSION, - true - ); + $post = get_post(); if ( empty( $post ) ) { return; } - $supported_post_types = self::get_supported_post_types(); + $supported_post_types = get_tts_supported_post_types(); if ( ! in_array( $post->post_type, $supported_post_types, true ) ) { return; @@ -115,13 +107,13 @@ public function enqueue_editor_assets() { true ); - wp_localize_script( + wp_add_inline_script( 'classifai-gutenberg-plugin', - 'classifaiTextToSpeechData', - [ - 'supportedPostTypes' => self::get_supported_post_types(), - 'noPermissions' => ! is_user_logged_in() || ! current_user_can( 'edit_post', $post->ID ), - ] + sprintf( + 'var classifaiTTSEnabled = %d;', + true + ), + 'before' ); } @@ -133,11 +125,17 @@ public function register() { add_action( 'rest_api_init', [ $this, 'add_synthesize_speech_meta_to_rest_api' ] ); add_action( 'add_meta_boxes', [ $this, 'add_meta_box' ] ); add_action( 'save_post', [ $this, 'save_post_metadata' ], 5 ); + + $supported_post_type = get_tts_supported_post_types(); + foreach ( get_tts_supported_post_types() as $post_type ) { + add_action( 'rest_insert_' . $post_type, [ $this, 'rest_handle_audio' ], 10, 2 ); + } + add_filter( 'the_content', [ $this, 'render_post_audio_controls' ] ); } /** - * Resets settings for the Personalizer provider. + * Resets settings for the TextToSpeech provider. */ public function reset_settings() { update_option( $this->get_option_name(), $this->get_default_settings() ); @@ -190,7 +188,7 @@ public function setup_fields_sections() { 'label_for' => 'post_types', 'option_index' => 'post_types', 'options' => $this->get_post_types_select_options(), - 'default_values' => $default_settings['post-types'], + 'default_values' => $default_settings['post_types'], ] ); @@ -240,6 +238,9 @@ public function sanitize_settings( $settings ) { if ( ! empty( $current_settings['voices'] ) ) { $current_settings['authenticated'] = true; + } else { + $current_settings['voices'] = []; + $current_settings['authenticated'] = false; } } } else { @@ -267,8 +268,6 @@ public function sanitize_settings( $settings ) { if ( isset( $settings['voice'] ) && ! empty( $settings['voice'] ) ) { $current_settings['voice'] = sanitize_text_field( $settings['voice'] ); - } else { - $current_settings['voice'] = ''; } return $current_settings; @@ -427,7 +426,7 @@ public function get_provider_debug_information( $settings = null, $configured = /** * Returns the default settings. */ - private function get_default_settings() { + public function get_default_settings() { return [ 'credentials' => array( 'url' => '', @@ -436,44 +435,108 @@ private function get_default_settings() { 'voices' => array(), 'voice' => '', 'authenticated' => false, - 'post-types' => array(), + 'post_types' => array(), ]; } /** - * Add `classifai_synthesize_speech` to rest API for view/edit. + * Initial audio generation state. + * + * Fetch the initial state of audio generation prior to the audio existing for the post. + * + * @param int|WP_Post|null $post Optional. Post ID or post object. `null`, `false`, `0` and other PHP falsey values + * return the current global post inside the loop. A numerically valid post ID that + * points to a non-existent post returns `null`. Defaults to global $post. + * @return bool The initial state of audio generation. Default true. + */ + public function get_audio_generation_initial_state( $post = null ) { + /** + * Initial state of the audio generation toggle when no audio already exists for the post. + * + * @since 2.3.0 + * @hook classifai_audio_generation_initial_state + * + * @param {bool} $state Initial state of audio generation toggle on a post. Default true. + * @param {WP_Post} $post The current Post object. + * + * @return {bool} Initial state the audio generation toggle should be set to when no audio exists. + */ + return apply_filters( 'classifai_audio_generation_initial_state', true, get_post( $post ) ); + } + + /** + * Subsequent audio generation state. + * + * Fetch the subsequent state of audio generation once audio is generated for the post. + * + * @param int|WP_Post|null $post Optional. Post ID or post object. `null`, `false`, `0` and other PHP falsey values + * return the current global post inside the loop. A numerically valid post ID that + * points to a non-existent post returns `null`. Defaults to global $post. + * @return bool The subsequent state of audio generation. Default false. + */ + public function get_audio_generation_subsequent_state( $post = null ) { + /** + * Subsequent state of the audio generation toggle when audio exists for the post. + * + * @since 2.3.0 + * @hook classifai_audio_generation_subsequent_state + * + * @param {bool} $state Subsequent state of audio generation toggle on a post. Default false. + * @param {WP_Post} $post The current Post object. + * + * @return {bool} Subsequent state the audio generation toggle should be set to when audio exists. + */ + return apply_filters( 'classifai_audio_generation_subsequent_state', false, get_post( $post ) ); + } + + /** + * Add audio related fields to rest API for view/edit. */ public function add_synthesize_speech_meta_to_rest_api() { - $settings = $this->get_settings(); - $supported_post_types = $settings['post_types'] ?? array(); - - $supported_post_types = array_keys( - array_filter( - $supported_post_types, - function( $post_type ) { - return ! is_null( $post_type ); - } + $supported_post_types = get_tts_supported_post_types(); + + register_rest_field( + $supported_post_types, + 'classifai_synthesize_speech', + array( + 'get_callback' => function( $object ) { + $audio_id = get_post_meta( $object['id'], self::AUDIO_ID_KEY, true ); + if ( + ( $this->get_audio_generation_initial_state( $object['id'] ) && ! $audio_id ) || + ( $this->get_audio_generation_subsequent_state( $object['id'] ) && $audio_id ) + ) { + return true; + } else { + return false; + } + }, + 'schema' => [ + 'type' => 'boolean', + 'context' => [ 'view', 'edit' ], + ], ) ); - if ( empty( $supported_post_types ) ) { - return; - } - register_rest_field( $supported_post_types, - 'classifai_synthesize_speech', + 'classifai_display_generated_audio', array( 'get_callback' => function( $object ) { - $process_content = get_post_meta( $object['id'], self::SYNTHESIZE_SPEECH_KEY, true ); - return ( 'no' === $process_content ) ? 'no' : 'yes'; + // Default to display the audio if available. + if ( metadata_exists( 'post', $object['id'], self::DISPLAY_GENERATED_AUDIO ) ) { + return (bool) get_post_meta( $object['id'], self::DISPLAY_GENERATED_AUDIO, true ); + } + return true; }, - 'update_callback' => function ( $value, $object ) { - $value = ( 'no' === $value ) ? 'no' : 'yes'; - return update_post_meta( $object->ID, self::SYNTHESIZE_SPEECH_KEY, $value ); + 'update_callback' => function( $value, $object ) { + if ( $value ) { + delete_post_meta( $object->ID, self::DISPLAY_GENERATED_AUDIO ); + } else { + update_post_meta( $object->ID, self::DISPLAY_GENERATED_AUDIO, false ); + } }, 'schema' => [ - 'type' => 'string', + 'type' => 'boolean', 'context' => [ 'view', 'edit' ], ], ) @@ -495,13 +558,42 @@ function( $post_type ) { ); } + /** + * Handles audio generation on rest updates / inserts. + * + * @param WP_Post $post Inserted or updated post object. + * @param WP_REST_Request $request Request object. + */ + public function rest_handle_audio( $post, $request ) { + + $audio_id = get_post_meta( $request->get_param( 'id' ), self::AUDIO_ID_KEY, true ); + + // Since we have dynamic generation option agnostic to meta saves we need a flag to differentiate audio generation accurately + $process_content = false; + if ( + ( $this->get_audio_generation_initial_state( $post ) && ! $audio_id ) || + ( $this->get_audio_generation_subsequent_state( $post ) && $audio_id ) + ) { + $process_content = true; + } + + // Add/Update audio if it was requested. + if ( + ( $process_content && null === $request->get_param( 'classifai_synthesize_speech' ) ) || + true === $request->get_param( 'classifai_synthesize_speech' ) + ) { + $save_post_handler = new SavePostHandler(); + $save_post_handler->synthesize_speech( $request->get_param( 'id' ) ); + } + } + /** * Add meta box to post types that support speech synthesis. * * @param string $post_type Post type. */ public function add_meta_box( $post_type ) { - if ( ! in_array( $post_type, $this->get_supported_post_types(), true ) ) { + if ( ! in_array( $post_type, get_tts_supported_post_types(), true ) ) { return; } @@ -511,7 +603,7 @@ public function add_meta_box( $post_type ) { [ $this, 'render_meta_box' ], null, 'side', - 'low', + 'high', array( '__back_compat_meta_box' => true ) ); } @@ -524,38 +616,65 @@ public function add_meta_box( $post_type ) { public function render_meta_box( $post ) { wp_nonce_field( 'classifai_text_to_speech_meta_action', 'classifai_text_to_speech_meta' ); - $process_content = get_post_meta( $post->ID, self::SYNTHESIZE_SPEECH_KEY, true ); - $process_content = ( 'no' === $process_content ) ? 'no' : 'yes'; + $source_url = false; + $audio_id = get_post_meta( $post->ID, self::AUDIO_ID_KEY, true ); + if ( $audio_id ) { + $source_url = wp_get_attachment_url( $audio_id ); + } + + $process_content = false; + if ( + ( $this->get_audio_generation_initial_state( $post ) && ! $audio_id ) || + ( $this->get_audio_generation_subsequent_state( $post ) && $audio_id ) + ) { + $process_content = true; + } + + $display_audio = true; + if ( metadata_exists( 'post', $post->ID, self::DISPLAY_GENERATED_AUDIO ) && + ! (bool) get_post_meta( $post->ID, self::DISPLAY_GENERATED_AUDIO, true ) ) { + $display_audio = false; + } - $post_type = get_post_type_object( get_post_type( $post ) ); $post_type_label = esc_html__( 'Post', 'classifai' ); + $post_type = get_post_type_object( get_post_type( $post ) ); if ( $post_type ) { $post_type_label = $post_type->labels->singular_name; } - $audio_id = get_post_meta( $post->ID, self::AUDIO_ID_KEY, true ); ?> -

+ +

+ +