admin
3 months ago
field-groups
3 months ago
fields
1 week ago
fields-settings
3 months ago
forms
3 months ago
locations
3 months ago
modules
1 week ago
screens
3 months ago
acfe-deprecated-functions.php
2 years ago
acfe-field-functions.php
3 months ago
acfe-field-group-functions.php
3 months ago
acfe-file-functions.php
1 year ago
acfe-form-functions.php
3 months ago
acfe-helper-array-functions.php
3 months ago
acfe-helper-functions.php
3 months ago
acfe-helper-multi-functions.php
3 months ago
acfe-helper-string-functions.php
3 months ago
acfe-meta-functions.php
3 months ago
acfe-post-functions.php
3 months ago
acfe-screen-functions.php
3 months ago
acfe-template-functions.php
3 months ago
acfe-term-functions.php
3 months ago
acfe-user-functions.php
3 months ago
acfe-wp-functions.php
3 years ago
assets.php
3 months ago
compatibility-acf-5.8.php
4 months ago
compatibility-acf-5.9.php
3 months ago
compatibility-acf-6.5.php
3 months ago
compatibility-acf-6.8.6.php
1 week ago
compatibility.php
3 months ago
field-extend.php
4 months ago
field.php
4 months ago
hooks.php
3 months ago
init.php
3 months ago
local-meta.php
3 years ago
media.php
3 months ago
module-acf.php
3 months ago
module-db.php
3 months ago
module-l10n.php
3 months ago
module-legacy.php
3 years ago
module-manager.php
4 months ago
module-post.php
3 months ago
module-posts.php
4 months ago
module-upgrades.php
3 years ago
module.php
3 months ago
multilang.php
3 months ago
revisions.php
4 months ago
screen.php
3 months ago
settings.php
3 months ago
template-tags.php
3 months ago
third-party.php
3 years ago
upgrades.php
3 months ago
module-l10n.php
65 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')){ |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | if(!class_exists('acfe_module_l10n')): |
| 8 | |
| 9 | class acfe_module_l10n{ |
| 10 | |
| 11 | /** |
| 12 | * construct |
| 13 | */ |
| 14 | function __construct(){ |
| 15 | |
| 16 | add_action('acfe/module/updated_item', array($this, 'updated_item'), 10, 2); |
| 17 | add_filter('acfe/module/register_item_args', array($this, 'register_item_args'), 10, 2); |
| 18 | |
| 19 | } |
| 20 | |
| 21 | |
| 22 | /** |
| 23 | * updated_item |
| 24 | * |
| 25 | * @param $item |
| 26 | * @param $module |
| 27 | */ |
| 28 | function updated_item($item, $module){ |
| 29 | |
| 30 | foreach($module->l10n as $key){ |
| 31 | |
| 32 | $name = ucfirst($key); |
| 33 | acfe_register_translate(acfe_get($item, $key), $name, "ACF Extended: {$module->get_label('name')}"); |
| 34 | |
| 35 | } |
| 36 | |
| 37 | } |
| 38 | |
| 39 | |
| 40 | /** |
| 41 | * register_item_args |
| 42 | * |
| 43 | * @param $item |
| 44 | * @param $module |
| 45 | * |
| 46 | * @return mixed |
| 47 | */ |
| 48 | function register_item_args($item, $module){ |
| 49 | |
| 50 | foreach($module->l10n as $key){ |
| 51 | |
| 52 | $name = ucfirst($key); |
| 53 | acfe_set($item, $key, acfe_translate(acfe_get($item, $key), ucfirst($name), "ACF Extended: {$module->get_label('name')}")); |
| 54 | |
| 55 | } |
| 56 | |
| 57 | return $item; |
| 58 | |
| 59 | } |
| 60 | |
| 61 | } |
| 62 | |
| 63 | acf_new_instance('acfe_module_l10n'); |
| 64 | |
| 65 | endif; |