Changeset 3161147
- Timestamp:
- 10/02/2024 01:36:11 AM (18 months ago)
- Location:
- fluentc-translation
- Files:
-
- 365 added
- 7 edited
-
tags/1.9.5 (added)
-
tags/1.9.5/.gitignore (added)
-
tags/1.9.5/LICENSE (added)
-
tags/1.9.5/README.md (added)
-
tags/1.9.5/bootstrap.php (added)
-
tags/1.9.5/fluentc_autoload.php (added)
-
tags/1.9.5/fluentc_plugin.php (added)
-
tags/1.9.5/fluentc_settings.php (added)
-
tags/1.9.5/fluentc_wordpress_plugin.php (added)
-
tags/1.9.5/languages (added)
-
tags/1.9.5/languages/fluentc-translation.pot (added)
-
tags/1.9.5/readme.txt (added)
-
tags/1.9.5/src (added)
-
tags/1.9.5/src/actions (added)
-
tags/1.9.5/src/actions/class-admin.php (added)
-
tags/1.9.5/src/actions/class-aioseo.php (added)
-
tags/1.9.5/src/actions/class-insert.php (added)
-
tags/1.9.5/src/actions/class-links.php (added)
-
tags/1.9.5/src/actions/class-rankmath.php (added)
-
tags/1.9.5/src/actions/class-siteorigin.php (added)
-
tags/1.9.5/src/actions/class-translationstatus.php (added)
-
tags/1.9.5/src/actions/class-wordpress.php (added)
-
tags/1.9.5/src/actions/class-yoast.php (added)
-
tags/1.9.5/src/blocks (added)
-
tags/1.9.5/src/blocks/fluentc-languages-block.js (added)
-
tags/1.9.5/src/class-bootstrap-fluentc.php (added)
-
tags/1.9.5/src/class-fluentc-manager.php (added)
-
tags/1.9.5/src/class-polylang.php (added)
-
tags/1.9.5/src/fluentc_pll_api.php (added)
-
tags/1.9.5/src/includes (added)
-
tags/1.9.5/src/includes/admin_top_bar.css (added)
-
tags/1.9.5/src/includes/css (added)
-
tags/1.9.5/src/includes/css/fluentc-translations.css (added)
-
tags/1.9.5/src/includes/css/translation-status.css (added)
-
tags/1.9.5/src/includes/fluentc-logo.png (added)
-
tags/1.9.5/src/includes/fluentc-styles.css (added)
-
tags/1.9.5/src/includes/js (added)
-
tags/1.9.5/src/includes/js/translation-status.js (added)
-
tags/1.9.5/src/includes/js/translations.js (added)
-
tags/1.9.5/src/models (added)
-
tags/1.9.5/src/models/class-body.php (added)
-
tags/1.9.5/src/models/class-fluentc-links-model.php (added)
-
tags/1.9.5/src/models/class-hooks.php (added)
-
tags/1.9.5/src/models/class-htmltags.php (added)
-
tags/1.9.5/src/services (added)
-
tags/1.9.5/src/services/class-cache.php (added)
-
tags/1.9.5/src/services/class-connect.php (added)
-
tags/1.9.5/src/services/class-fluentc-translations.php (added)
-
tags/1.9.5/src/services/class-frontpage.php (added)
-
tags/1.9.5/src/services/class-html.php (added)
-
tags/1.9.5/src/services/class-pll-language.php (added)
-
tags/1.9.5/src/services/class-scan.php (added)
-
tags/1.9.5/src/services/class-translation-processor.php (added)
-
tags/1.9.5/src/services/class-url.php (added)
-
tags/1.9.5/src/services/class-widget.php (added)
-
tags/1.9.5/src/templates (added)
-
tags/1.9.5/src/templates/manage-translations-page.php (added)
-
tags/1.9.5/src/templates/translation-status.php (added)
-
tags/1.9.5/src/utils (added)
-
tags/1.9.5/src/utils/class-language.php (added)
-
tags/1.9.5/vendor (added)
-
tags/1.9.5/vendor/autoload.php (added)
-
tags/1.9.5/vendor/composer (added)
-
tags/1.9.5/vendor/composer/ClassLoader.php (added)
-
tags/1.9.5/vendor/composer/InstalledVersions.php (added)
-
tags/1.9.5/vendor/composer/LICENSE (added)
-
tags/1.9.5/vendor/composer/autoload_classmap.php (added)
-
tags/1.9.5/vendor/composer/autoload_files.php (added)
-
tags/1.9.5/vendor/composer/autoload_namespaces.php (added)
-
tags/1.9.5/vendor/composer/autoload_psr4.php (added)
-
tags/1.9.5/vendor/composer/autoload_real.php (added)
-
tags/1.9.5/vendor/composer/autoload_static.php (added)
-
tags/1.9.5/vendor/composer/installed.json (added)
-
tags/1.9.5/vendor/composer/installed.php (added)
-
tags/1.9.5/vendor/composer/platform_check.php (added)
-
tags/1.9.5/vendor/fluentc (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/.gitattributes (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/.github (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/.github/FUNDING.yml (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/.scrutinizer.yml (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/SECURITY.md (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/composer.json (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Content.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/Dom (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/Dom/CleanerInterface.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/Dom/ParserInterface.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/DomInterface.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/Selector (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/Selector/ParserInterface.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/Selector/SeekerInterface.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Contracts/Selector/SelectorInterface.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO/Selector (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO/Selector/ParsedSelectorCollectionDTO.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO/Selector/ParsedSelectorDTO.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO/Selector/RuleDTO.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO/Tag (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO/Tag/AttributeDTO.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/DTO/TagDTO.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Discovery (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Discovery/CleanerDiscovery.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Discovery/DomParserDiscovery.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Discovery/SeekerDiscovery.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Discovery/SelectorParserDiscovery.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Cleaner.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/AbstractNode.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/ArrayNode.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/Collection.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/HtmlNode.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/InnerNode.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/LeafNode.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Node/TextNode.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Parser.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/RootAccessTrait.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Tag.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Enum (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Enum/StringToken.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/ChildNotFoundException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/CircularException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/ContentLengthException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/CurlException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/EmptyCollectionException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/LogicalException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/NotLoadedException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/ParentNotFoundException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/StrictException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/Tag (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/Tag/AttributeNotFoundException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/UnknownChildTypeException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Exceptions/UnknownOptionException.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Finder.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Options.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Selector (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Selector/Parser.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Selector/Seeker.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Selector/Selector.php (added)
-
tags/1.9.5/vendor/fluentc/php-html-parser/src/PHPHtmlParser/StaticDom.php (added)
-
tags/1.9.5/vendor/guzzlehttp (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/CHANGELOG.md (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/LICENSE (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/README.md (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/UPGRADING.md (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/composer.json (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/BodySummarizer.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/BodySummarizerInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Client.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/ClientInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/ClientTrait.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Cookie (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/HandlerStack.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/MessageFormatter.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/MessageFormatterInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Middleware.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Pool.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/RequestOptions.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/TransferStats.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/Utils.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/functions.php (added)
-
tags/1.9.5/vendor/guzzlehttp/guzzle/src/functions_include.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/CHANGELOG.md (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/LICENSE (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/README.md (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/composer.json (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/AggregateException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/CancellationException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/Coroutine.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/Create.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/Each.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/EachPromise.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/FulfilledPromise.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/Is.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/Promise.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/PromiseInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/PromisorInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/RejectedPromise.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/RejectionException.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/TaskQueue.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/TaskQueueInterface.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/Utils.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/functions.php (added)
-
tags/1.9.5/vendor/guzzlehttp/promises/src/functions_include.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7 (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.github (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.github/FUNDING.yml (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.github/stale.yml (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.github/workflows (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.github/workflows/ci.yml (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.github/workflows/integration.yml (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.github/workflows/static.yml (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/.php_cs.dist (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/CHANGELOG.md (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/LICENSE (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/README.md (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/composer.json (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/AppendStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/BufferStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/CachingStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/DroppingStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/FnStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Header.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/InflateStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/LazyOpenStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/LimitStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Message.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/MessageTrait.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/MimeType.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/MultipartStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/NoSeekStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/PumpStream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Query.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Request.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Response.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Rfc7230.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/ServerRequest.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Stream.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/StreamWrapper.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/UploadedFile.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Uri.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/UriComparator.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/UriNormalizer.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/UriResolver.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/Utils.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/functions.php (added)
-
tags/1.9.5/vendor/guzzlehttp/psr7/src/functions_include.php (added)
-
tags/1.9.5/vendor/myclabs (added)
-
tags/1.9.5/vendor/myclabs/php-enum (added)
-
tags/1.9.5/vendor/myclabs/php-enum/LICENSE (added)
-
tags/1.9.5/vendor/myclabs/php-enum/README.md (added)
-
tags/1.9.5/vendor/myclabs/php-enum/SECURITY.md (added)
-
tags/1.9.5/vendor/myclabs/php-enum/composer.json (added)
-
tags/1.9.5/vendor/myclabs/php-enum/src (added)
-
tags/1.9.5/vendor/myclabs/php-enum/src/Enum.php (added)
-
tags/1.9.5/vendor/myclabs/php-enum/src/PHPUnit (added)
-
tags/1.9.5/vendor/myclabs/php-enum/src/PHPUnit/Comparator.php (added)
-
tags/1.9.5/vendor/myclabs/php-enum/stubs (added)
-
tags/1.9.5/vendor/myclabs/php-enum/stubs/Stringable.php (added)
-
tags/1.9.5/vendor/paquettg (added)
-
tags/1.9.5/vendor/paquettg/string-encode (added)
-
tags/1.9.5/vendor/paquettg/string-encode/.travis.yml (added)
-
tags/1.9.5/vendor/paquettg/string-encode/CONTRIBUTING.md (added)
-
tags/1.9.5/vendor/paquettg/string-encode/README.md (added)
-
tags/1.9.5/vendor/paquettg/string-encode/composer.json (added)
-
tags/1.9.5/vendor/paquettg/string-encode/phpunit.php (added)
-
tags/1.9.5/vendor/paquettg/string-encode/phpunit.xml (added)
-
tags/1.9.5/vendor/paquettg/string-encode/src (added)
-
tags/1.9.5/vendor/paquettg/string-encode/src/stringEncode (added)
-
tags/1.9.5/vendor/paquettg/string-encode/src/stringEncode/Encode.php (added)
-
tags/1.9.5/vendor/paquettg/string-encode/src/stringEncode/Exception.php (added)
-
tags/1.9.5/vendor/paquettg/string-encode/tests (added)
-
tags/1.9.5/vendor/paquettg/string-encode/tests/EncodeTest.php (added)
-
tags/1.9.5/vendor/php-http (added)
-
tags/1.9.5/vendor/php-http/httplug (added)
-
tags/1.9.5/vendor/php-http/httplug/.php-cs-fixer.dist.php (added)
-
tags/1.9.5/vendor/php-http/httplug/CHANGELOG.md (added)
-
tags/1.9.5/vendor/php-http/httplug/LICENSE (added)
-
tags/1.9.5/vendor/php-http/httplug/README.md (added)
-
tags/1.9.5/vendor/php-http/httplug/composer.json (added)
-
tags/1.9.5/vendor/php-http/httplug/puli.json (added)
-
tags/1.9.5/vendor/php-http/httplug/src (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Exception (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Exception.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Exception/HttpException.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Exception/NetworkException.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Exception/RequestException.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Exception/TransferException.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/HttpAsyncClient.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/HttpClient.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Promise (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php (added)
-
tags/1.9.5/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php (added)
-
tags/1.9.5/vendor/php-http/promise (added)
-
tags/1.9.5/vendor/php-http/promise/CHANGELOG.md (added)
-
tags/1.9.5/vendor/php-http/promise/LICENSE (added)
-
tags/1.9.5/vendor/php-http/promise/README.md (added)
-
tags/1.9.5/vendor/php-http/promise/composer.json (added)
-
tags/1.9.5/vendor/php-http/promise/phpstan.neon.dist (added)
-
tags/1.9.5/vendor/php-http/promise/src (added)
-
tags/1.9.5/vendor/php-http/promise/src/FulfilledPromise.php (added)
-
tags/1.9.5/vendor/php-http/promise/src/Promise.php (added)
-
tags/1.9.5/vendor/php-http/promise/src/RejectedPromise.php (added)
-
tags/1.9.5/vendor/psr (added)
-
tags/1.9.5/vendor/psr/http-client (added)
-
tags/1.9.5/vendor/psr/http-client/CHANGELOG.md (added)
-
tags/1.9.5/vendor/psr/http-client/LICENSE (added)
-
tags/1.9.5/vendor/psr/http-client/README.md (added)
-
tags/1.9.5/vendor/psr/http-client/composer.json (added)
-
tags/1.9.5/vendor/psr/http-client/src (added)
-
tags/1.9.5/vendor/psr/http-client/src/ClientExceptionInterface.php (added)
-
tags/1.9.5/vendor/psr/http-client/src/ClientInterface.php (added)
-
tags/1.9.5/vendor/psr/http-client/src/NetworkExceptionInterface.php (added)
-
tags/1.9.5/vendor/psr/http-client/src/RequestExceptionInterface.php (added)
-
tags/1.9.5/vendor/psr/http-message (added)
-
tags/1.9.5/vendor/psr/http-message/CHANGELOG.md (added)
-
tags/1.9.5/vendor/psr/http-message/LICENSE (added)
-
tags/1.9.5/vendor/psr/http-message/README.md (added)
-
tags/1.9.5/vendor/psr/http-message/composer.json (added)
-
tags/1.9.5/vendor/psr/http-message/docs (added)
-
tags/1.9.5/vendor/psr/http-message/docs/PSR7-Interfaces.md (added)
-
tags/1.9.5/vendor/psr/http-message/docs/PSR7-Usage.md (added)
-
tags/1.9.5/vendor/psr/http-message/src (added)
-
tags/1.9.5/vendor/psr/http-message/src/MessageInterface.php (added)
-
tags/1.9.5/vendor/psr/http-message/src/RequestInterface.php (added)
-
tags/1.9.5/vendor/psr/http-message/src/ResponseInterface.php (added)
-
tags/1.9.5/vendor/psr/http-message/src/ServerRequestInterface.php (added)
-
tags/1.9.5/vendor/psr/http-message/src/StreamInterface.php (added)
-
tags/1.9.5/vendor/psr/http-message/src/UploadedFileInterface.php (added)
-
tags/1.9.5/vendor/psr/http-message/src/UriInterface.php (added)
-
tags/1.9.5/vendor/ralouphie (added)
-
tags/1.9.5/vendor/ralouphie/getallheaders (added)
-
tags/1.9.5/vendor/ralouphie/getallheaders/LICENSE (added)
-
tags/1.9.5/vendor/ralouphie/getallheaders/README.md (added)
-
tags/1.9.5/vendor/ralouphie/getallheaders/composer.json (added)
-
tags/1.9.5/vendor/ralouphie/getallheaders/src (added)
-
tags/1.9.5/vendor/ralouphie/getallheaders/src/getallheaders.php (added)
-
tags/1.9.5/vendor/symfony (added)
-
tags/1.9.5/vendor/symfony/deprecation-contracts (added)
-
tags/1.9.5/vendor/symfony/deprecation-contracts/.gitignore (added)
-
tags/1.9.5/vendor/symfony/deprecation-contracts/CHANGELOG.md (added)
-
tags/1.9.5/vendor/symfony/deprecation-contracts/LICENSE (added)
-
tags/1.9.5/vendor/symfony/deprecation-contracts/README.md (added)
-
tags/1.9.5/vendor/symfony/deprecation-contracts/composer.json (added)
-
tags/1.9.5/vendor/symfony/deprecation-contracts/function.php (added)
-
trunk/fluentc_settings.php (modified) (2 diffs)
-
trunk/fluentc_wordpress_plugin.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/actions/class-admin.php (modified) (4 diffs)
-
trunk/src/actions/class-links.php (modified) (2 diffs)
-
trunk/src/models/class-fluentc-links-model.php (modified) (2 diffs)
-
trunk/src/services/class-connect.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fluentc-translation/trunk/fluentc_settings.php
r3159297 r3161147 28 28 29 29 <div id="tab-1" class="tab-content current"> 30 <?php do_action( 'fluentc_activation_setup' ); ?> 30 31 <p><?php _e( 'To use FluentC, you need an active subscription.', 'fluentc-translation' ); ?></p> 31 32 <?php if ( $this->fluentc_get_settings() ) { ?> … … 90 91 </form> 91 92 <?php do_action( 'fluentc_admin_tab_three_page' ); ?> 92 <?php do_action( 'fluentc_activation_setup' ); ?>93 93 94 </div> 94 95 -
fluentc-translation/trunk/fluentc_wordpress_plugin.php
r3159591 r3161147 7 7 * Plugin URI: https://github.com/fluentc/wordpress-plugin 8 8 * Description: A plugin that enables website owners to easily install the FluentC Translation on their WordPress site. 9 * Version: 1.9. 49 * Version: 1.9.5 10 10 * Author: FluentC 11 11 * Author URI: https://www.fluentc.ai … … 17 17 define( 'FLUENTC_DIR', __DIR__ ); 18 18 define( 'FLUENTC_SLUG', 'fluentc_translation' ); 19 define( 'FLUENTC_TRANSLATION_VERSION', "1.9. 4" );19 define( 'FLUENTC_TRANSLATION_VERSION', "1.9.5" ); 20 20 define( 'FLUENTC_TRANSLATION_PLUGIN_DIR', plugin_dir_path(__FILE__) ); 21 21 define( 'FLUENTC_TRANSLATION_PLUGIN_URL', plugin_dir_url(__FILE__) ); -
fluentc-translation/trunk/readme.txt
r3159591 r3161147 5 5 Requires at least: 4.6 6 6 Tested up to: 6.6.2 7 Stable tag: 1.9. 47 Stable tag: 1.9.5 8 8 Requires PHP: 7.3 9 9 License: GPLv2 or later -
fluentc-translation/trunk/src/actions/class-admin.php
r3148988 r3161147 11 11 namespace FluentC\Actions; 12 12 13 if ( ! defined( 'ABSPATH') ) {14 exit;13 if (! defined('ABSPATH') ) { 14 exit; 15 15 } 16 16 … … 27 27 * @since 1.2 28 28 */ 29 class Admin implements Hooks { 30 31 /** 32 * FluentC Widget class 33 * 34 * @var object 35 */ 36 protected $fluentc_widget_c; 37 38 /** 39 * FluentC Widget class 40 * 41 * @var object 42 */ 43 protected $translations; 44 /** 45 * FluentC URL class 46 * 47 * @var object 48 */ 49 protected $fluentc_url; 50 /** 51 * FluentC connection class 52 * 53 * @var object 54 */ 55 protected $fluentc_connect; 56 /** 57 * FluentC connection class 58 * 59 * @var object 60 */ 61 protected $fluentc_cache; 62 /** 63 * Constructor. 64 * 65 * @since 1.2 66 */ 67 public function __construct() { 68 $this->fluentc_widget_c = new Widget(); 69 $this->fluentc_connect = new Connect(); 70 $this->fluentc_cache = new Cache(); 71 $this->fluentc_url = new Url(); 72 $this->translations = new FluentC_Translations(); 73 } 74 /** 75 * Hooks for Autoloading 76 * 77 * @since 1.2 78 */ 79 public function hooks() { 80 add_action( 'fluentc_admin_settings_page', array( $this, 'get_fluentc_languages' ) ); 81 add_action( 'fluentc_admin_settings_page', array( $this, 'fluentc_admin_get_settings' ) ); 82 add_action( 'fluentc_admin_tab_three_page', array( $this, 'get_cache_form' ) ); 83 add_action( 'fluentc_admin_settings_page_save', array( $this, 'settings_save' ) ); 84 add_action( 'admin_post_fluentc_save_settings_action', array( $this, 'fluentc_admin_save_settings' ) ); 85 add_action( 'admin_post_fluentc_clean_cache_action', array( $this, 'fluentc_admin_clean_cache' ) ); 86 add_action( 'wp_update_nav_menu', array( $this, 'update_menu_cache' ) ); 87 add_action( 'edited_category', array( $this, 'update_menu_cache' ), 10, 2 ); 88 add_action( 'woocommerce_update_product', array( $this, 'update_product_cache' ), 10, 1 ); 89 add_action( 'admin_notices', array( $this, 'check_fluentc_apikey' ), 10, 1 ); 90 add_action( 'admin_enqueue_scripts', array( $this, 'fluentc_apikey_enqueue_script' ), 10, 1 ); 91 add_filter( 'query_vars', array( $this, 'fluentc_var' ), 10, 3 ); 92 add_action( 'wp_ajax_dismiss_fluentc_apikey_warning', array( $this, 'dismiss_fluentc_apikey_warning' ) ); 93 add_action( 'enqueue_block_editor_assets', array( $this, 'fluentc_block_script' ) ); 94 add_action( 'init', array( $this, 'register_fluentc_block' ) ); 95 add_action( 'fluentc_activation_setup', array( $this, 'fluentc_setup' ) ); 96 add_action('init', array( $this, 'integrate_fluentc_languages' ) ); 97 add_action('admin_menu', array($this, 'fluentc_sub_menu')); 29 class Admin implements Hooks 30 { 31 32 /** 33 * FluentC Widget class 34 * 35 * @var object 36 */ 37 protected $fluentc_widget_c; 38 39 /** 40 * FluentC Widget class 41 * 42 * @var object 43 */ 44 protected $translations; 45 /** 46 * FluentC URL class 47 * 48 * @var object 49 */ 50 protected $fluentc_url; 51 /** 52 * FluentC connection class 53 * 54 * @var object 55 */ 56 protected $fluentc_connect; 57 /** 58 * FluentC connection class 59 * 60 * @var object 61 */ 62 protected $fluentc_cache; 63 /** 64 * Constructor. 65 * 66 * @since 1.2 67 */ 68 public function __construct() 69 { 70 $this->fluentc_widget_c = new Widget(); 71 $this->fluentc_connect = new Connect(); 72 $this->fluentc_cache = new Cache(); 73 $this->fluentc_url = new Url(); 74 $this->translations = new FluentC_Translations(); 75 } 76 /** 77 * Hooks for Autoloading 78 * 79 * @since 1.2 80 */ 81 public function hooks() 82 { 83 add_action('fluentc_admin_settings_page', array( $this, 'get_fluentc_languages' )); 84 add_action('fluentc_admin_settings_page', array( $this, 'fluentc_admin_get_settings' )); 85 add_action('fluentc_admin_tab_three_page', array( $this, 'get_cache_form' )); 86 add_action('fluentc_admin_settings_page_save', array( $this, 'settings_save' )); 87 add_action('admin_post_fluentc_save_settings_action', array( $this, 'fluentc_admin_save_settings' )); 88 add_action('admin_post_fluentc_clean_cache_action', array( $this, 'fluentc_admin_clean_cache' )); 89 add_action('wp_update_nav_menu', array( $this, 'update_menu_cache' )); 90 add_action('edited_category', array( $this, 'update_menu_cache' ), 10, 2); 91 add_action('woocommerce_update_product', array( $this, 'update_product_cache' ), 10, 1); 92 add_action('admin_notices', array( $this, 'check_fluentc_apikey' ), 10, 1); 93 add_action('admin_enqueue_scripts', array( $this, 'fluentc_apikey_enqueue_script' ), 10, 1); 94 add_filter('query_vars', array( $this, 'fluentc_var' ), 10, 3); 95 add_action('wp_ajax_dismiss_fluentc_apikey_warning', array( $this, 'dismiss_fluentc_apikey_warning' )); 96 add_action('enqueue_block_editor_assets', array( $this, 'fluentc_block_script' )); 97 add_action('init', array( $this, 'register_fluentc_block' )); 98 add_action('fluentc_activation_setup', array( $this, 'fluentc_setup' )); 99 add_action('init', array( $this, 'integrate_fluentc_languages' )); 100 add_action('admin_menu', array($this, 'fluentc_sub_menu')); 98 101 add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); 99 102 add_action('wp_ajax_fluentc_inline_edit', array($this->translations, 'handle_inline_edit')); 100 add_action('wp_ajax_fluentc_delete_translation', array($this->translations, 'handle_delete_translation')); 101 add_action('wp_ajax_fluentc_search_translations', array($this->translations, 'handle_search_translations')); 102 add_action('wp_ajax_fluentc_get_translations', array($this->translations, 'handle_get_translations')); 103 } 104 /** 105 * Set FluentC Vars 106 * 107 * @param mixed $vars WordPress vars. 108 */ 109 public function fluentc_var( $vars ) { 110 $vars[] = 'fluentc'; // 'fluentc' is the name of path variable. 111 return $vars; 112 } 113 114 /** 115 * Adds a menu item to the WordPress admin dashboard for the plugin settings 116 */ 117 public function fluentc_sub_menu() { 118 add_submenu_page('fluentc-settings', 'Edit Translations', 'Edit Translations', 'manage_options', 'fluentc-manage-translations', array($this->translations, 'display_translations_page')); 119 } 120 121 /** 122 * Adds scripts to Management Page 123 */ 124 public function enqueue_admin_scripts($hook) { 103 add_action('wp_ajax_fluentc_delete_translation', array($this->translations, 'handle_delete_translation')); 104 add_action('wp_ajax_fluentc_search_translations', array($this->translations, 'handle_search_translations')); 105 add_action('wp_ajax_fluentc_get_translations', array($this->translations, 'handle_get_translations')); 106 } 107 /** 108 * Set FluentC Vars 109 * 110 * @param mixed $vars WordPress vars. 111 */ 112 public function fluentc_var( $vars ) 113 { 114 $vars[] = 'fluentc'; // 'fluentc' is the name of path variable. 115 return $vars; 116 } 117 118 /** 119 * Adds a menu item to the WordPress admin dashboard for the plugin settings 120 */ 121 public function fluentc_sub_menu() 122 { 123 add_submenu_page('fluentc-settings', 'Edit Translations', 'Edit Translations', 'manage_options', 'fluentc-manage-translations', array($this->translations, 'display_translations_page')); 124 } 125 126 /** 127 * Adds scripts to Management Page 128 */ 129 public function enqueue_admin_scripts($hook) 130 { 125 131 126 132 $this->translations->enqueue_scripts(); 127 133 128 134 } 129 /** 130 * GET from fluentc.ai 131 */ 132 public function fluentc_admin_get_settings() { 133 if ( isset( $_GET['fluentc'] ) ) { 134 $api_key = sanitize_text_field( wp_unslash( $_GET['fluentc'] ) ); 135 $this->save_settings( $api_key ); 136 $this->fluentc_cache->clean(); 137 wp_safe_redirect( admin_url( 'admin.php?page=fluentc-settings' ) ); 138 exit; 139 } 140 } 141 /** 142 * Save Function sanitize_text_field( wp_unslash( $_POST['faq_highlighted'] ) ) 143 */ 144 public function fluentc_admin_save_settings() { 145 if ( isset( $_POST['submit'] ) ) { 146 if ( isset( $_POST['fluentc_settings_nonce_field'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['fluentc_settings_nonce_field'] ) ), 'fluentc_save_settings_action' ) ) { 147 try { 148 $api_key = isset( $_POST['fluentc_api_key'] ) ? sanitize_text_field( wp_unslash( $_POST['fluentc_api_key'] ) ) : ''; 149 $this->save_settings( $api_key ); 150 add_settings_error( 'fluentc-settings', 'fluentc_api_key_saved', 'FluentC API key saved.', 'updated' ); 151 do_action( 'fluentc_admin_settings_page_save' ); 152 wp_safe_redirect( admin_url( 'admin.php?page=fluentc-settings' ) ); 153 exit; 154 } catch ( \Exception $e ) { 155 add_settings_error( 'fluentc-settings', 'fluentc_api_key_error', 'Error saving FluentC API key: ' . $e->getMessage(), 'error' ); 156 } 157 } else { 158 // Handle the case where the nonce check fails. 159 wp_die( 'Security check failed' ); 160 } 161 } 162 } 163 /** 164 * Empty Cache 165 */ 166 public function fluentc_admin_clean_cache() { 167 $clean_cache_nonce_field = sanitize_text_field( wp_unslash( $_POST['fluentc_clean_cache_nonce_field'] ?? null ) ); 168 169 if ( isset( $_POST['submit'] ) && isset( $clean_cache_nonce_field ) && wp_verify_nonce( $clean_cache_nonce_field, 'fluentc_clean_cache_action' ) ) { 170 try { 171 $this->fluentc_cache->clean(); 172 do_action( 'fluentc_admin_clean_cache' ); 173 wp_safe_redirect( admin_url( 'admin.php?page=fluentc-settings' ) ); 174 exit; 175 } catch ( \Exception $e ) { 176 add_settings_error( 'fluentc-settings', 'fluentc_api_key_error', 'Error Clearing Cache: ' . $e->getMessage(), 'error' ); 177 } 178 } else { 179 // Handle the case where the nonce check fails. 180 wp_die( 'Security check failed' ); 181 } 182 } 183 /** 184 * Sets up the FluentC account 185 * 186 * 187 */ 188 public function fluentc_setup( ) { 189 190 $widgetapikey = get_option( 'fluentc_api_key' ); 191 192 $this->fluentc_connect->heartbeat($widgetapikey); 193 194 } 195 196 /** 197 * Saves the user's FluentC API key to the WordPress database 198 * 199 * @param string $api_key FluentC Key. 200 */ 201 public function save_settings( $api_key ) { 202 203 update_option( 'fluentc_api_key', $api_key ); 204 } 205 206 /** 207 * Update all cache when the menu is updated 208 */ 209 public function update_menu_cache() { 210 211 $this->fluentc_cache->clean(); 212 } 213 214 /** 215 * Update all cache when the category is updated 216 * 217 * @param int $term_id taxonomy term. 218 * @param int $tt_id ttid. 219 */ 220 public function update_category_cache( $term_id, $tt_id ) { 221 222 $this->fluentc_cache->clean(); 223 } 224 225 /** 226 * Update all cache when the product is updated 227 * 228 * @param int $product_id id of the product. 229 */ 230 public function update_product_cache( $product_id ) { 231 232 // getall Language combinations. 233 $this->fluentc_cache->clean(); 234 } 235 /** 236 * Update all cache when the pages and post is updated 237 * 238 * @param int $id id of the post. 239 */ 240 public function update_post_and_pages( $id ) { 241 // Loop. 242 // Source Lang . dispalyLange[1] . id. 243 // Add_action publish_page. 244 // add_action publish_pust. 245 // Update the cache when a post is saved. 246 $this->fluentc_cache->clean(); 247 } 248 /** 249 * GetFluentCLanguages and return them in table form 250 */ 251 public function get_fluentc_languages() { 252 $widgetapikey = get_option( 'fluentc_api_key' ); 253 if ( $widgetapikey ) { 254 ?> 255 <table class="wp-list-table widefat fixed"> 256 <thead> 257 <tr> 258 <td class="column-primary">Language</td> 259 <td class="column-name">Language Code</td> 260 </tr> 261 </thead> 262 <tbody> 263 <?php 264 $languages = $this->fluentc_connect->get_display_language_list( $widgetapikey ); 265 266 foreach ( $languages as $language ) { 267 ?> 268 <tr> 269 <td> 270 <?php echo esc_html( $language[0] ); ?> 271 </td> 272 <td> 273 <?php echo esc_html( $language[1] ); ?> 274 </td> 275 </tr> 276 <?php 277 } 278 ?> 279 </tbody> 280 </table> 281 <?php 282 } else { 283 echo esc_html( 'FluentC API Key Not Set' ); 284 } 285 286 } 287 288 /** 289 * Return the Cache form 290 */ 291 public function get_cache_form() { 292 $action_url = esc_url( admin_url( 'admin-post.php' ) ); 293 294 ?> 295 <hr /> 296 <h3>If you have made changes at FluentC.ai, Clearing Cache will update</h3> 297 <form method="post" action='<?php echo esc_html( $action_url ); ?>'> 298 299 <?php 300 // Directly call wp_nonce_field to output its content. 301 wp_nonce_field( 'fluentc_clean_cache_action', 'fluentc_clean_cache_nonce_field' ); 302 ?> 303 <input type="hidden" name="action" value="fluentc_clean_cache_action"> 304 <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Clear Cache"> 305 </p> 306 </form> 307 <h3>FluentC API Calls : <?php $apicalls = $this->fluentc_cache->get('apicalls'); echo esc_html( $apicalls ); ?></h3> 308 <?php 309 } 310 311 /** 312 * Check if API Key is set 313 */ 314 public function check_fluentc_apikey() { 315 // Check if the user has dismissed the notice and if the dismissal period is still active. 316 if ( get_transient( 'fluentc_apikey_dismissed' ) ) { 317 return; 318 } 319 320 // Check if the API key is stored in the settings. 321 $widgetapikey = get_option( 'fluentc_api_key' ); 322 if ( empty( $widgetapikey ) ) { 323 ?> 324 <div class="notice notice-warning is-dismissible"> 325 <?php _e( '<p><strong>FluentC API Key is missing.</strong> Please add your API key in settings to use the FluentC features.</p>', 'fluentc-translation' ); ?> 326 </div> 327 <?php 328 add_action( 'admin_notices', array( $this, 'fluentc_apikey_enqueue_script' ), 10, 1 ); 329 } 330 } 331 332 /** 333 * Script to update API Notice dismiss 334 */ 335 public function fluentc_apikey_enqueue_script() { 336 // Register the script. 337 wp_register_script( 'fluentc-apikey-script', null ); // Use 'null' if you're not using an external JS file. 338 wp_add_inline_script( 339 'fluentc-apikey-script', 340 ' 135 /** 136 * GET from fluentc.ai 137 */ 138 public function fluentc_admin_get_settings() 139 { 140 if (isset($_GET['fluentc']) ) { 141 $api_key = sanitize_text_field(wp_unslash($_GET['fluentc'])); 142 $this->save_settings($api_key); 143 $this->fluentc_cache->clean(); 144 wp_safe_redirect(admin_url('admin.php?page=fluentc-settings')); 145 exit; 146 } 147 } 148 /** 149 * Save Function sanitize_text_field( wp_unslash( $_POST['faq_highlighted'] ) ) 150 */ 151 public function fluentc_admin_save_settings() 152 { 153 if (isset($_POST['submit']) ) { 154 if (isset($_POST['fluentc_settings_nonce_field']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['fluentc_settings_nonce_field'])), 'fluentc_save_settings_action') ) { 155 try { 156 $api_key = isset($_POST['fluentc_api_key']) ? sanitize_text_field(wp_unslash($_POST['fluentc_api_key'])) : ''; 157 $this->save_settings($api_key); 158 add_settings_error('fluentc-settings', 'fluentc_api_key_saved', 'FluentC API key saved.', 'updated'); 159 do_action('fluentc_admin_settings_page_save'); 160 wp_safe_redirect(admin_url('admin.php?page=fluentc-settings')); 161 exit; 162 } catch ( \Exception $e ) { 163 add_settings_error('fluentc-settings', 'fluentc_api_key_error', 'Error saving FluentC API key: ' . $e->getMessage(), 'error'); 164 } 165 } else { 166 // Handle the case where the nonce check fails. 167 wp_die('Security check failed'); 168 } 169 } 170 } 171 /** 172 * Empty Cache 173 */ 174 public function fluentc_admin_clean_cache() 175 { 176 $clean_cache_nonce_field = sanitize_text_field(wp_unslash($_POST['fluentc_clean_cache_nonce_field'] ?? null)); 177 178 if (isset($_POST['submit']) && isset($clean_cache_nonce_field) && wp_verify_nonce($clean_cache_nonce_field, 'fluentc_clean_cache_action') ) { 179 try { 180 $this->fluentc_cache->clean(); 181 do_action('fluentc_admin_clean_cache'); 182 wp_safe_redirect(admin_url('admin.php?page=fluentc-settings')); 183 exit; 184 } catch ( \Exception $e ) { 185 add_settings_error('fluentc-settings', 'fluentc_api_key_error', 'Error Clearing Cache: ' . $e->getMessage(), 'error'); 186 } 187 } else { 188 // Handle the case where the nonce check fails. 189 wp_die('Security check failed'); 190 } 191 } 192 /** 193 * Sets up the FluentC account 194 */ 195 public function fluentc_setup( ) 196 { 197 198 $widgetapikey = get_option('fluentc_api_key'); 199 200 $this->fluentc_connect->heartbeat($widgetapikey); 201 202 } 203 204 /** 205 * Saves the user's FluentC API key to the WordPress database 206 * 207 * @param string $api_key FluentC Key. 208 */ 209 public function save_settings( $api_key ) 210 { 211 212 update_option('fluentc_api_key', $api_key); 213 } 214 215 /** 216 * Update all cache when the menu is updated 217 */ 218 public function update_menu_cache() 219 { 220 221 $this->fluentc_cache->clean(); 222 } 223 224 /** 225 * Update all cache when the category is updated 226 * 227 * @param int $term_id taxonomy term. 228 * @param int $tt_id ttid. 229 */ 230 public function update_category_cache( $term_id, $tt_id ) 231 { 232 233 $this->fluentc_cache->clean(); 234 } 235 236 /** 237 * Update all cache when the product is updated 238 * 239 * @param int $product_id id of the product. 240 */ 241 public function update_product_cache( $product_id ) 242 { 243 244 // getall Language combinations. 245 $this->fluentc_cache->clean(); 246 } 247 /** 248 * Update all cache when the pages and post is updated 249 * 250 * @param int $id id of the post. 251 */ 252 public function update_post_and_pages( $id ) 253 { 254 // Loop. 255 // Source Lang . dispalyLange[1] . id. 256 // Add_action publish_page. 257 // add_action publish_pust. 258 // Update the cache when a post is saved. 259 $this->fluentc_cache->clean(); 260 } 261 /** 262 * GetFluentCLanguages and return them in table form 263 */ 264 public function get_fluentc_languages() 265 { 266 $widgetapikey = get_option('fluentc_api_key'); 267 if ($widgetapikey ) { 268 ?> 269 <table class="wp-list-table widefat fixed"> 270 <thead> 271 <tr> 272 <td class="column-primary">Language</td> 273 <td class="column-name">Language Code</td> 274 </tr> 275 </thead> 276 <tbody> 277 <?php 278 $languages = $this->fluentc_connect->get_display_language_list($widgetapikey); 279 280 foreach ( $languages as $language ) { 281 ?> 282 <tr> 283 <td> 284 <?php echo esc_html($language[0]); ?> 285 </td> 286 <td> 287 <?php echo esc_html($language[1]); ?> 288 </td> 289 </tr> 290 <?php 291 } 292 ?> 293 </tbody> 294 </table> 295 <?php 296 } else { 297 echo esc_html('FluentC API Key Not Set'); 298 } 299 300 } 301 302 /** 303 * Return the Cache form 304 */ 305 public function get_cache_form() 306 { 307 $action_url = esc_url(admin_url('admin-post.php')); 308 309 ?> 310 <hr /> 311 <h3>If you have made changes at FluentC.ai, Clearing Cache will update</h3> 312 <form method="post" action='<?php echo esc_html($action_url); ?>'> 313 314 <?php 315 // Directly call wp_nonce_field to output its content. 316 wp_nonce_field('fluentc_clean_cache_action', 'fluentc_clean_cache_nonce_field'); 317 ?> 318 <input type="hidden" name="action" value="fluentc_clean_cache_action"> 319 <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Clear Cache"> 320 </p> 321 </form> 322 <h3>FluentC API Calls : <?php $apicalls = $this->fluentc_cache->get('apicalls'); echo esc_html($apicalls); ?></h3> 323 <?php 324 } 325 326 /** 327 * Check if API Key is set 328 */ 329 public function check_fluentc_apikey() 330 { 331 // Check if the user has dismissed the notice and if the dismissal period is still active. 332 if (get_transient('fluentc_apikey_dismissed') ) { 333 return; 334 } 335 336 // Check if the API key is stored in the settings. 337 $widgetapikey = get_option('fluentc_api_key'); 338 if (empty($widgetapikey) ) { 339 ?> 340 <div class="notice notice-warning is-dismissible"> 341 <?php _e('<p><strong>FluentC API Key is missing.</strong> Please add your API key in settings to use the FluentC features.</p>', 'fluentc-translation'); ?> 342 </div> 343 <?php 344 add_action('admin_notices', array( $this, 'fluentc_apikey_enqueue_script' ), 10, 1); 345 } 346 } 347 348 /** 349 * Script to update API Notice dismiss 350 */ 351 public function fluentc_apikey_enqueue_script() 352 { 353 // Register the script. 354 wp_register_script('fluentc-apikey-script', null); // Use 'null' if you're not using an external JS file. 355 wp_add_inline_script( 356 'fluentc-apikey-script', 357 ' 341 358 jQuery(document).ready(function($) { 342 359 $(document).on("click", ".notice-warning.is-dismissible button.notice-dismiss", function() { … … 347 364 }); 348 365 ' 349 ); 350 // Enqueue the script. 351 wp_enqueue_script( 'fluentc-apikey-script' ); 352 } 353 /** 354 * Set transient to dismiss message for 7 days 355 */ 356 public function dismiss_fluentc_apikey_warning() { 357 // Set a transient for 7 days. 358 set_transient( 'fluentc_apikey_dismissed', 'yes', 7 * DAY_IN_SECONDS ); 359 wp_die(); // This is required to terminate immediately and return a proper response. 360 } 361 362 /** 363 * Handle the saving settings 364 */ 365 public function settings_save() { 366 // Validate Widget Key. 367 $widgetapikey = get_option( 'fluentc_api_key' ); 368 $languages = $this->fluentc_connect->get_display_language_list( $widgetapikey ); 369 if ( $languages ) { 370 wp_safe_redirect( admin_url( 'admin.php?page=fluentc-settings' ) ); 371 exit; 372 } else { 373 echo esc_html( '<strong>Widget has no languages setup, please visit FluentC and enable a language to translate</strong>' ); 374 } 375 } 376 377 // Register the block script. 378 public function fluentc_block_script() { 379 wp_enqueue_script( 'fluentc-block-script', plugins_url( '/include/script.js', __FILE__ ), array( 'wp-blocks' ), '1.0', true ); 380 } 381 382 383 // Register the Block. 384 public function register_fluentc_block() { 385 register_block_type( 386 'fluentc/fluentc-block', 387 array( 388 'editor_script' => 'fluentc-block-script', 389 'render_callback' => 'fluentc_block_render_callback', 390 ) 391 ); 392 } 393 394 // Render Callback Function 395 public function fluentc_block_render_callback( $attributes ) { 396 return '<div id="fluentc-widget"></div>'; 397 } 398 399 /** 400 * Retrieve Available Language by Site Key and Insert into WordPress 401 * 402 * @return void 403 * @since 1.2 404 * @param string $environment_id FluentC Environment ID. 405 */ 406 public function integrate_fluentc_languages( ) { 407 $widgetapikey = get_option( 'fluentc_api_key' ); 408 $languages = $this->fluentc_connect->get_display_language_list( $widgetapikey ); 409 410 if (is_null($languages)) { 411 return; 412 } 413 foreach ($languages as $language) { 366 ); 367 // Enqueue the script. 368 wp_enqueue_script('fluentc-apikey-script'); 369 } 370 /** 371 * Set transient to dismiss message for 7 days 372 */ 373 public function dismiss_fluentc_apikey_warning() 374 { 375 // Set a transient for 7 days. 376 set_transient('fluentc_apikey_dismissed', 'yes', 7 * DAY_IN_SECONDS); 377 wp_die(); // This is required to terminate immediately and return a proper response. 378 } 379 380 /** 381 * Handle the saving settings 382 */ 383 public function settings_save() 384 { 385 // Validate Widget Key. 386 $widgetapikey = get_option('fluentc_api_key'); 387 $languages = $this->fluentc_connect->get_display_language_list($widgetapikey); 388 if ($languages ) { 389 wp_safe_redirect(admin_url('admin.php?page=fluentc-settings')); 390 exit; 391 } else { 392 echo esc_html('<strong>Widget has no languages setup, please visit FluentC and enable a language to translate</strong>'); 393 } 394 } 395 396 // Register the block script. 397 public function fluentc_block_script() 398 { 399 wp_enqueue_script('fluentc-block-script', plugins_url('/include/script.js', __FILE__), array( 'wp-blocks' ), '1.0', true); 400 } 401 402 403 // Register the Block. 404 public function register_fluentc_block() 405 { 406 register_block_type( 407 'fluentc/fluentc-block', 408 array( 409 'editor_script' => 'fluentc-block-script', 410 'render_callback' => 'fluentc_block_render_callback', 411 ) 412 ); 413 } 414 415 // Render Callback Function 416 public function fluentc_block_render_callback( $attributes ) 417 { 418 return '<div id="fluentc-widget"></div>'; 419 } 420 421 /** 422 * Retrieve Available Language by Site Key and Insert into WordPress 423 * 424 * @return void 425 * @since 1.2 426 * @param string $environment_id FluentC Environment ID. 427 */ 428 public function integrate_fluentc_languages( ) 429 { 430 $widgetapikey = get_option('fluentc_api_key'); 431 $languages = $this->fluentc_connect->get_display_language_list($widgetapikey); 432 433 if (is_null($languages)) { 434 return; 435 } 436 foreach ($languages as $language) { 414 437 $name = $language[0]; 415 438 $slug = $language[1]; … … 421 444 } 422 445 446 } 423 447 } 424 } -
fluentc-translation/trunk/src/actions/class-links.php
r3122693 r3161147 5 5 * This file contains the WordPress functions for updating Permalinks and Routes 6 6 * 7 * @package FluentCPlugin8 * @author FluentC <wp@fluentc.io>9 7 */ 10 8 11 9 namespace FluentC\Actions; 12 10 13 if ( ! defined( 'ABSPATH') ) {14 exit;11 if (! defined('ABSPATH') ) { 12 exit; 15 13 } 16 14 … … 22 20 * Permalinks Actions 23 21 */ 24 class Links implements Hooks { 25 26 27 /** 28 * FluentC connection class 29 * 30 * @var object 31 */ 32 protected $fluentc_connect; 33 /** 34 * FluentC connection class 35 * 36 * @var object 37 */ 38 protected $fluentc_language; 39 40 /** 41 * Constructor. 42 * 43 * @since 1.2 44 */ 45 public function __construct() { 46 47 $this->fluentc_connect = new Connect(); 48 $this->fluentc_language = new Language(); 49 } 50 /** 51 * Hooks for Autoloading 52 * 53 * @since 1.2 54 */ 55 public function hooks() { 56 add_action( 'wp', array( $this, 'add_language_code_to_home_url_later' ) ); 57 add_filter( 'woocommerce_get_cart_url', array( $this, 'add_language_code_to_cart_url' ), 10, 1 ); 58 add_filter( 'query_vars', array( $this, 'language_var' ), 10, 3 ); 59 add_action( 'init', array( $this, 'flush_rewrite' ), 1000 ); 60 add_filter( 'rewrite_rules_array', array( $this, 'fluentc_rewrite_rules' ), 100 ); 61 } 62 63 /** 64 * HomeLink that filters after wp is ready. 65 */ 66 public function add_language_code_to_home_url_later() { 67 add_filter( 'home_url', array( $this, 'add_language_code_to_home_url' ), 10, 4 ); 68 } 69 70 /** 71 * Updates Home page link 72 * 73 * @param string $url url. 74 * @param string $path path. 75 * @param string $orig_scheme orig_scheme. 76 * @param string $blog_id blog_id. 77 */ 78 public function add_language_code_to_home_url($url, $path, $orig_scheme, $blog_id) { 79 // Assuming you have a function that returns the current language code. 80 $language_code = $this->fluentc_language->get_fluentc_language(); 81 82 // If there's no language code, return the original URL. 83 if (empty($language_code)) { 84 return $url; 85 } 86 87 // Modify the home URL to add the language code. 88 $url_parts = wp_parse_url($url); 89 90 // Ensure the necessary parts exist. 91 $scheme = isset($url_parts['scheme']) ? $url_parts['scheme'] : 'http'; 92 $host = isset($url_parts['host']) ? $url_parts['host'] : ''; 93 $existing_path = isset($url_parts['path']) ? $url_parts['path'] : ''; 94 95 // Ensure the path includes the leading '/'. 96 $modified_path = '/' . trim($language_code . '/' . ltrim($existing_path, '/'), '/'); 97 98 // Rebuild the URL with the language code. 99 $new_url = $scheme . '://' . $host . $modified_path; 100 if (!empty($url_parts['query'])) { 101 $new_url .= '?' . $url_parts['query']; 102 } 103 if (!empty($url_parts['fragment'])) { 104 $new_url .= '#' . $url_parts['fragment']; 105 } 106 107 return $new_url; 108 } 109 110 /** 111 * Updates Permalinks 112 * 113 * @param string $permalink permalink. 114 * @param string $post post. 115 */ 116 public function add_language_code_to_post( $permalink, $post ) { 117 // Assuming you have a function that returns the current language code. 118 $language_code = $this->fluentc_language->get_fluentc_language(); 119 120 // If there's no language code, return the original permalink. 121 if ( empty( $language_code ) ) { 122 return $permalink; 123 } 124 125 // Modify the permalink to add the language code. 126 $url_parts = wp_parse_url( $permalink ); 127 $path = '/' . $language_code . $url_parts['path']; 128 129 // Rebuild the URL with the language code. 130 $new_permalink = $url_parts['scheme'] . '://' . $url_parts['host'] . $path; 131 if ( ! empty( $url_parts['query'] ) ) { 132 $new_permalink .= '?' . $url_parts['query']; 133 } 134 if ( ! empty( $url_parts['fragment'] ) ) { 135 $new_permalink .= '#' . $url_parts['fragment']; 136 } 137 138 return $new_permalink; 139 } 140 141 /** 142 * Updates Permalink for Cart Link 143 * 144 * @param string $cart_url cart_url . 145 */ 146 public function add_language_code_to_cart_url( $cart_url ) { 147 // Assuming you have a function that returns the current language code. 148 $language_code = $this->fluentc_language->get_fluentc_language(); 149 150 // If there's no language code, return the original cart URL. 151 if ( empty( $language_code ) ) { 152 return $cart_url; 153 } 154 155 // Modify the cart URL to add the language code. 156 $url_parts = wp_parse_url( $cart_url ); 157 // Ensure the path includes the leading '/'. 158 $modified_path = '/' . trim( $language_code . '/' . ltrim( $url_parts['path'], '/' ), '/' ); 159 160 // Rebuild the URL with the language code. 161 $new_cart_url = $url_parts['scheme'] . '://' . $url_parts['host'] . $modified_path; 162 if ( ! empty( $url_parts['query'] ) ) { 163 $new_cart_url .= '?' . $url_parts['query']; 164 } 165 if ( ! empty( $url_parts['fragment'] ) ) { 166 $new_cart_url .= '#' . $url_parts['fragment']; 167 } 168 169 return $new_cart_url; 170 } 171 172 /** 173 * Updates Permalinks 174 * 175 * @param string $permalink permalink. 176 * @param string $post post. 177 */ 178 public function add_language_code_to_permalink( $permalink, $post ) { 179 // Assuming you have a function that returns the current language code. 180 $language_code = $this->fluentc_language->get_fluentc_language(); 181 182 // If there's no language code, return the original permalink. 183 if ( empty( $language_code ) ) { 184 return $permalink; 185 } 186 187 // Modify the permalink to add the language code. 188 $url_parts = wp_parse_url( $permalink ); 189 $path = '/' . $language_code . $url_parts['path']; 190 191 // Rebuild the URL with the language code. 192 $new_permalink = $url_parts['scheme'] . '://' . $url_parts['host'] . $path; 193 if ( ! empty( $url_parts['query'] ) ) { 194 $new_permalink .= '?' . $url_parts['query']; 195 } 196 if ( ! empty( $url_parts['fragment'] ) ) { 197 $new_permalink .= '#' . $url_parts['fragment']; 198 } 199 200 return $new_permalink; 201 } 202 203 /** 204 * Updates Flush ReWrite Rules 205 */ 206 public function flush_rewrite() { 207 flush_rewrite_rules(); 208 } 209 210 /** 211 * Adds Language Var 212 * 213 * @param array $vars All WordPress Vars. 214 */ 215 public function language_var( $vars ) { 216 $vars[] = 'fluentc_language'; // 'fluentc_language' is the name of path variable. 217 return $vars; 218 } 219 220 /** 221 * Updates ReWriteRules 222 * 223 * @param mixed $rules WordPress rewrite rules. 224 */ 225 public function fluentc_rewrite_rules( $rules ) { 226 227 $new_rules = array(); 228 $widget_id = get_option( 'fluentc_api_key' ); 229 $regex_lang = $this->fluentc_connect->get_language_list_string( $widget_id ); 230 $new_rules[ '(?:' . $regex_lang . ')/?$' ] = 'index.php'; 231 232 $languages = $this->fluentc_connect->get_language_list( $widget_id ); 233 foreach ( $rules as $key => $val ) { 234 235 if ( $languages ) { 236 // For Pretty Permalinks. 237 foreach ( $languages as $language ) { 238 // Add language codes to existing rewrite rules. 239 ${"new_key_$language"} = '(?:' . $language . ')/?' . ltrim( $key, '^' ); 240 241 // Add rules for each language. 242 $new_rules[ ${"new_key_$language"} ] = $val; 243 244 } 245 } 246 // Retain the original rule without the language code prefix. 247 $new_rules[ $key ] = $val; 248 } 249 250 return $new_rules; 251 } 22 class Links implements Hooks 23 { 24 25 26 /** 27 * FluentC connection class 28 * 29 * @var object 30 */ 31 protected $fluentc_connect; 32 /** 33 * FluentC connection class 34 * 35 * @var object 36 */ 37 protected $fluentc_language; 38 39 /** 40 * Constructor. 41 * 42 * @since 1.2 43 */ 44 public function __construct() 45 { 46 47 $this->fluentc_connect = new Connect(); 48 $this->fluentc_language = new Language(); 49 } 50 /** 51 * Hooks for Autoloading 52 * 53 * @since 1.2 54 */ 55 public function hooks() 56 { 57 add_action('wp', array( $this, 'add_language_code_to_home_url_later' )); 58 add_filter('woocommerce_get_cart_url', array( $this, 'add_language_code_to_cart_url' ), 10, 1); 59 add_filter('query_vars', array( $this, 'language_var' ), 10, 3); 60 add_action('init', array( $this, 'flush_rewrite' ), 1000); 61 add_filter('rewrite_rules_array', array( $this, 'fluentc_rewrite_rules' ), 100); 62 } 63 64 /** 65 * HomeLink that filters after wp is ready. 66 */ 67 public function add_language_code_to_home_url_later() 68 { 69 add_filter('home_url', array( $this, 'add_language_code_to_home_url' ), 10, 4); 70 } 71 72 /** 73 * Updates Home page link 74 * 75 * @param string $url url. 76 * @param string $path path. 77 * @param string $orig_scheme orig_scheme. 78 * @param string $blog_id blog_id. 79 */ 80 public function add_language_code_to_home_url($url, $path, $orig_scheme, $blog_id) 81 { 82 // Assuming you have a function that returns the current language code. 83 $language_code = $this->fluentc_language->get_fluentc_language(); 84 85 // If there's no language code, return the original URL. 86 if (empty($language_code)) { 87 return $url; 88 } 89 90 // Modify the home URL to add the language code. 91 $url_parts = wp_parse_url($url); 92 93 // Ensure the necessary parts exist. 94 $scheme = isset($url_parts['scheme']) ? $url_parts['scheme'] : 'http'; 95 $host = isset($url_parts['host']) ? $url_parts['host'] : ''; 96 $existing_path = isset($url_parts['path']) ? $url_parts['path'] : ''; 97 98 // Ensure the path includes the leading '/'. 99 $modified_path = '/' . trim($language_code . '/' . ltrim($existing_path, '/'), '/'); 100 101 // Rebuild the URL with the language code. 102 $new_url = $scheme . '://' . $host . $modified_path; 103 if (!empty($url_parts['query'])) { 104 $new_url .= '?' . $url_parts['query']; 105 } 106 if (!empty($url_parts['fragment'])) { 107 $new_url .= '#' . $url_parts['fragment']; 108 } 109 110 return $new_url; 111 } 112 113 /** 114 * Updates Permalinks 115 * 116 * @param string $permalink permalink. 117 * @param string $post post. 118 */ 119 public function add_language_code_to_post( $permalink, $post ) 120 { 121 // Assuming you have a function that returns the current language code. 122 $language_code = $this->fluentc_language->get_fluentc_language(); 123 124 // If there's no language code, return the original permalink. 125 if (empty($language_code) ) { 126 return $permalink; 127 } 128 129 // Modify the permalink to add the language code. 130 $url_parts = wp_parse_url($permalink); 131 $path = '/' . $language_code . $url_parts['path']; 132 133 // Rebuild the URL with the language code. 134 $new_permalink = $url_parts['scheme'] . '://' . $url_parts['host'] . $path; 135 if (! empty($url_parts['query']) ) { 136 $new_permalink .= '?' . $url_parts['query']; 137 } 138 if (! empty($url_parts['fragment']) ) { 139 $new_permalink .= '#' . $url_parts['fragment']; 140 } 141 142 return $new_permalink; 143 } 144 145 /** 146 * Updates Permalink for Cart Link 147 * 148 * @param string $cart_url cart_url . 149 */ 150 public function add_language_code_to_cart_url( $cart_url ) 151 { 152 // Assuming you have a function that returns the current language code. 153 $language_code = $this->fluentc_language->get_fluentc_language(); 154 155 // If there's no language code, return the original cart URL. 156 if (empty($language_code) ) { 157 return $cart_url; 158 } 159 160 // Modify the cart URL to add the language code. 161 $url_parts = wp_parse_url($cart_url); 162 // Ensure the path includes the leading '/'. 163 $modified_path = '/' . trim($language_code . '/' . ltrim($url_parts['path'], '/'), '/'); 164 165 // Rebuild the URL with the language code. 166 $new_cart_url = $url_parts['scheme'] . '://' . $url_parts['host'] . $modified_path; 167 if (! empty($url_parts['query']) ) { 168 $new_cart_url .= '?' . $url_parts['query']; 169 } 170 if (! empty($url_parts['fragment']) ) { 171 $new_cart_url .= '#' . $url_parts['fragment']; 172 } 173 174 return $new_cart_url; 175 } 176 177 /** 178 * Updates Permalinks 179 * 180 * @param string $permalink permalink. 181 * @param string $post post. 182 */ 183 public function add_language_code_to_permalink( $permalink, $post ) 184 { 185 // Assuming you have a function that returns the current language code. 186 $language_code = $this->fluentc_language->get_fluentc_language(); 187 188 // If there's no language code, return the original permalink. 189 if (empty($language_code) ) { 190 return $permalink; 191 } 192 193 // Modify the permalink to add the language code. 194 $url_parts = wp_parse_url($permalink); 195 $path = '/' . $language_code . $url_parts['path']; 196 197 // Rebuild the URL with the language code. 198 $new_permalink = $url_parts['scheme'] . '://' . $url_parts['host'] . $path; 199 if (! empty($url_parts['query']) ) { 200 $new_permalink .= '?' . $url_parts['query']; 201 } 202 if (! empty($url_parts['fragment']) ) { 203 $new_permalink .= '#' . $url_parts['fragment']; 204 } 205 206 return $new_permalink; 207 } 208 209 /** 210 * Updates Flush ReWrite Rules 211 */ 212 public function flush_rewrite() 213 { 214 flush_rewrite_rules(); 215 } 216 217 /** 218 * Adds Language Var 219 * 220 * @param array $vars All WordPress Vars. 221 */ 222 public function language_var( $vars ) 223 { 224 $vars[] = 'fluentc_language'; // 'fluentc_language' is the name of path variable. 225 return $vars; 226 } 227 228 /** 229 * Updates ReWriteRules 230 * 231 * @param mixed $rules WordPress rewrite rules. 232 */ 233 public function fluentc_rewrite_rules( $rules ) 234 { 235 236 $new_rules = array(); 237 $widget_id = get_option('fluentc_api_key'); 238 if (!$widget_id ) { 239 return; 240 } 241 $regex_lang = $this->fluentc_connect->get_language_list_string($widget_id); 242 if (!$regex_lang ) { 243 return; 244 } 245 $new_rules[ '(?:' . $regex_lang . ')/?$' ] = 'index.php'; 246 247 $languages = $this->fluentc_connect->get_language_list($widget_id); 248 foreach ( $rules as $key => $val ) { 249 250 if ($languages ) { 251 // For Pretty Permalinks. 252 foreach ( $languages as $language ) { 253 // Add language codes to existing rewrite rules. 254 ${"new_key_$language"} = '(?:' . $language . ')/?' . ltrim($key, '^'); 255 256 // Add rules for each language. 257 $new_rules[ ${"new_key_$language"} ] = $val; 258 259 } 260 } 261 // Retain the original rule without the language code prefix. 262 $new_rules[ $key ] = $val; 263 } 264 265 return $new_rules; 266 } 252 267 } -
fluentc-translation/trunk/src/models/class-fluentc-links-model.php
r3159591 r3161147 7 7 8 8 namespace FluentC\Models; 9 10 use FluentC\Utils\Language; 9 11 10 12 class FluentC_Links_Model { … … 29 31 ); 30 32 } 33 34 function get_language_from_url( $field = 'slug' ) { 35 $fluentc_language = new Language(); 36 37 $lang = $fluentc_language->fluentc_site_language(); 38 39 return $lang; 40 } 31 41 } -
fluentc-translation/trunk/src/services/class-connect.php
r3159591 r3161147 83 83 } 84 84 // fetch available languages Environment ID. 85 $this->fluentc_cache->set( 'fluentc_language_list', $languages ); 85 $this->fluentc_cache->set_exp( 'fluentc_language_list', $languages, 43200 ); 86 do_action( 'fluentc_activation_setup' ); 86 87 } 87 88 } … … 111 112 112 113 $this->fluentc_cache->set_exp( 'fluentc_display_language_list', $languages , 43200 ); 114 do_action( 'fluentc_activation_setup' ); 113 115 } 114 116 return $languages; … … 162 164 // Re-index the array. 163 165 $languages = array_values( $languages ); 164 $this->heartbeat($widgetapikey);166 165 167 // Return the requested fields or the full language objects. 166 168 return empty( $args['fields'] ) ? $languages : wp_list_pluck( $languages, $args['fields'] );
Note: See TracChangeset
for help on using the changeset viewer.