{"id":180924,"date":"2023-11-06T15:26:37","date_gmt":"2023-11-06T15:26:37","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/a-faster-load-textdomain\/"},"modified":"2024-07-20T21:58:44","modified_gmt":"2024-07-20T21:58:44","slug":"a-faster-load-textdomain","status":"publish","type":"plugin","link":"https:\/\/ru.wordpress.org\/plugins\/a-faster-load-textdomain\/","author":3803,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"2.3.2","stable_tag":"2.3.2","tested":"6.4.8","requires":"5.9","requires_php":"7.4","requires_plugins":null,"header_name":"A faster load_textdomain","header_author":"Per Soderlind","header_description":"Cache the .mo file as PHP array, and load the array instead of the .mo file.","assets_banners_color":"","last_updated":"2024-07-20 21:58:44","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/paypal.me\/PerSoderlind","header_plugin_uri":"https:\/\/github.com\/soderlind\/a-faster-load-textdomain","header_author_uri":"https:\/\/soderlind.no","rating":0,"author_block_rating":0,"active_installs":10,"downloads":4069,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":{"2.1.5":{"tag":"2.1.5","author":"PerS","date":"2023-11-12 23:07:30"},"2.2.0":{"tag":"2.2.0","author":"PerS","date":"2023-11-21 14:47:44"},"2.2.1":{"tag":"2.2.1","author":"PerS","date":"2023-11-23 16:26:59"},"2.2.2":{"tag":"2.2.2","author":"PerS","date":"2023-11-29 09:31:22"},"2.2.3":{"tag":"2.2.3","author":"PerS","date":"2023-12-09 00:42:58"},"2.2.4":{"tag":"2.2.4","author":"PerS","date":"2024-01-10 14:00:01"},"2.3.0":{"tag":"2.3.0","author":"PerS","date":"2024-02-27 23:10:12"},"2.3.1":{"tag":"2.3.1","author":"PerS","date":"2024-06-12 09:20:19"},"2.3.2":{"tag":"2.3.2","author":"PerS","date":"2024-07-20 21:58:44"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-256x256.jpg":{"filename":"icon-256x256.jpg","revision":2990056,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["2.1.5","2.2.0","2.2.1","2.2.2","2.2.3","2.2.4","2.3.0","2.3.1","2.3.2"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[146,1984,222802,247],"plugin_category":[48,52,54],"plugin_contributors":[78884],"plugin_business_model":[],"class_list":["post-180924","plugin","type-plugin","status-publish","hentry","plugin_tags-cache","plugin_tags-l10n","plugin_tags-load_textdomain","plugin_tags-performance","plugin_category-language-tools","plugin_category-performance","plugin_category-security-and-spam-protection","plugin_contributors-pers","plugin_committers-pers"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/a-faster-load-textdomain\/assets\/icon-256x256.jpg?rev=2990056","icon_2x":"https:\/\/ps.w.org\/a-faster-load-textdomain\/assets\/icon-256x256.jpg?rev=2990056","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<blockquote>\n  <p><strong>NOTE<\/strong> This plugin is not needed if you are running WordPress 6.5 or later, as the functionality <a href=\"https:\/\/make.wordpress.org\/core\/2024\/02\/27\/i18n-improvements-6-5-performant-translations\/\">is built into WordPress core<\/a>. If you need to generate translation in the new <code>.l10n.php<\/code> format, use the <a href=\"https:\/\/wordpress.org\/plugins\/performant-translations\/\">Performant Translations<\/a> plugin instead.<\/p>\n<\/blockquote>\n\n<p>This is a WordPress plugin that caches the .mo file as an PHP array, and <a href=\"https:\/\/www.php.net\/manual\/en\/function.include.php\">include<\/a> the array instead of the .mo file.\nIn theory, nothing is faster in PHP than loading and executing another PHP file.<\/p>\n\n<h4>How it works<\/h4>\n\n<p>If you have a plugin or theme that loads a textdomain, e.g. <code>load_textdomain( 'textdomain', $path_to_mo_file )<\/code>, then this plugin will:<\/p>\n\n<ol>\n<li>Look for a PHP version of the .mo file in <code>WP_CONTENT_DIR . '\/cache\/a-faster-load-textdomain'<\/code> directory.<\/li>\n<li>If the PHP version exists, <a href=\"https:\/\/www.php.net\/manual\/en\/function.include.php\">include<\/a> the file.<\/li>\n<li>If the PHP version doesn't exist, load the .mo file, and save the file as an PHP array in <code>wp-content\/cache\/a-faster-load-textdomain\/<\/code> directory.<\/li>\n<\/ol>\n\n<p>The localized PHP array can be cached via <a href=\"http:\/\/blog.jpauli.tech\/2015-03-05-opcache-html\/\">PHP OPcache<\/a>. If you have PHP OPcache enabled, then the localized PHP array will be cached in memory, and the PHP file will not be parsed again.<\/p>\n\n<h4>Filters<\/h4>\n\n<pre><code>a_faster_load_textdomain_cache_path\n<\/code><\/pre>\n\n<p>Change the cache path, default is <code>WP_CONTENT_DIR . '\/cache\/a-faster-load-textdomain'<\/code>.<\/p>\n\n<pre><code>add_filter( 'a_faster_load_textdomain_cache_path', function( $path ) {\n    return WP_CONTENT_DIR . '\/cache\/my-cache';\n} );\n<\/code><\/pre>\n\n<h4>GitHub<\/h4>\n\n<p>The plugin source is available at <a href=\"https:\/\/github.com\/soderlind\/a-faster-load-textdomain\/blob\/main\/a-faster-load-textdomain.php\">GitHub<\/a><\/p>\n\n<!--section=installation-->\n<p>Either (recommended):\n- Download the plugin files and extract <code>a-faster-load-textdomain.php<\/code> and <code>class-afld-cachehandler.php<\/code> to the <code>wp-content\/mu-plugins<\/code> directory.<\/p>\n\n<p>Or:\n- Search for \"A faster load_textdomain\" and install with the WordPress plugin installer. \n- (Network) Activate the plugin through the 'Plugins' menu in WordPress.<\/p>\n\n<p>It's also possible to install the plugin via Composer:<\/p>\n\n<pre><code>composer require soderlind\/a-faster-load-textdomain\n<\/code><\/pre>\n\n<!--section=changelog-->\n<h4>2.3.2<\/h4>\n\n<ul>\n<li>Housekeeping.<\/li>\n<\/ul>\n\n<h4>2.3.1<\/h4>\n\n<ul>\n<li>Catch errors in the cache handler. If the cache file is corrupt, update the file and return the .mo file.<\/li>\n<\/ul>\n\n<h4>2.3.0<\/h4>\n\n<ul>\n<li>If running WordPress 6.5, give a notice that the plugin is not needed.<\/li>\n<\/ul>\n\n<h4>2.2.4<\/h4>\n\n<ul>\n<li>Fail gracefully if  cache directory can't be created.<\/li>\n<\/ul>\n\n<h4>2.2.3<\/h4>\n\n<ul>\n<li>Housekeeping.<\/li>\n<\/ul>\n\n<h4>2.2.2<\/h4>\n\n<ul>\n<li>Add uninstall handler. Will remove the cache directory when the plugin is uninstalled.<\/li>\n<\/ul>\n\n<h4>2.2.1<\/h4>\n\n<ul>\n<li>Fix bug in cache handler.<\/li>\n<\/ul>\n\n<h4>2.2.0<\/h4>\n\n<ul>\n<li>Refactor cache handler.<\/li>\n<\/ul>\n\n<h4>2.1.5<\/h4>\n\n<ul>\n<li>Bump version to force deploy to WordPress.org<\/li>\n<\/ul>\n\n<h4>2.1.4<\/h4>\n\n<ul>\n<li>Deploy with GitHub Actions to WordPress.org<\/li>\n<\/ul>\n\n<h4>2.1.3<\/h4>\n\n<ul>\n<li>Remove <code>mkdir()<\/code><\/li>\n<\/ul>\n\n<h4>2.1.2<\/h4>\n\n<ul>\n<li>Fail gracefully if <code>$cache_path<\/code> can't be created.<\/li>\n<\/ul>\n\n<h4>2.1.1<\/h4>\n\n<ul>\n<li>Add <code>aflt_load_textdomain<\/code> filter.<\/li>\n<\/ul>\n\n<h4>2.1.0<\/h4>\n\n<ul>\n<li>Rename namespace to <code>Soderlind\\Plugin\\A_Faster_Load_Textdomain<\/code><\/li>\n<li>Rename cache directory to <code>WP_CONTENT_DIR . '\/cache\/a-faster-load-textdomain'<\/code><\/li>\n<\/ul>\n\n<h4>2.0.1<\/h4>\n\n<ul>\n<li>Rename file to <code>a-faster-load-textdomain.php<\/code> to follow WordPress plugin standards.<\/li>\n<\/ul>\n\n<h4>2.0.0<\/h4>\n\n<ul>\n<li>Refactor code, instead of using a transient, save .mo file as an PHP array, and <a href=\"https:\/\/www.php.net\/manual\/en\/function.include.php\">include<\/a> the array instead of the .mo file.<\/li>\n<\/ul>\n\n<h4>1.0.3<\/h4>\n\n<ul>\n<li>Housekeeping.<\/li>\n<\/ul>\n\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>DRY (Don't Repeat Yourself) code. Add namespace.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Add multisite support<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"A faster load_textdomain","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/180924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=180924"}],"author":[{"embeddable":true,"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/pers"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=180924"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=180924"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=180924"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=180924"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=180924"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ru.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=180924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}