deprecated.php
| 1 | <?php |
| 2 | |
| 3 | if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 4 | |
| 5 | if( ! class_exists('acf_deprecated') ) : |
| 6 | |
| 7 | class acf_deprecated { |
| 8 | |
| 9 | /* |
| 10 | * __construct |
| 11 | * |
| 12 | * This function will setup the class functionality |
| 13 | * |
| 14 | * @type function |
| 15 | * @date 30/1/17 |
| 16 | * @since 5.5.6 |
| 17 | * |
| 18 | * @param n/a |
| 19 | * @return n/a |
| 20 | */ |
| 21 | |
| 22 | function __construct() { |
| 23 | |
| 24 | // settings |
| 25 | add_filter('acf/settings/show_admin', array($this, 'acf_settings_show_admin'), 5, 1); // 5.0.0 |
| 26 | add_filter('acf/settings/l10n_textdomain', array($this, 'acf_settings_l10n_textdomain'), 5, 1); // 5.3.3 |
| 27 | add_filter('acf/settings/l10n_field', array($this, 'acf_settings_l10n_field'), 5, 1); // 5.3.3 |
| 28 | add_filter('acf/settings/l10n_field_group', array($this, 'acf_settings_l10n_field'), 5, 1); // 5.3.3 |
| 29 | |
| 30 | |
| 31 | // filters |
| 32 | add_filter('acf/validate_field', array($this, 'acf_validate_field'), 10, 1); // 5.5.6 |
| 33 | add_filter('acf/validate_field_group', array($this, 'acf_validate_field_group'), 10, 1); // 5.5.6 |
| 34 | add_filter('acf/validate_post_id', array($this, 'acf_validate_post_id'), 10, 2); // 5.5.6 |
| 35 | |
| 36 | } |
| 37 | |
| 38 | |
| 39 | /* |
| 40 | * acf_settings_show_admin |
| 41 | * |
| 42 | * This function will add compatibility for previously named hooks |
| 43 | * |
| 44 | * @type function |
| 45 | * @date 19/05/2014 |
| 46 | * @since 5.0.0 |
| 47 | * |
| 48 | * @param n/a |
| 49 | * @return n/a |
| 50 | */ |
| 51 | |
| 52 | function acf_settings_show_admin( $setting ) { |
| 53 | |
| 54 | // 5.0.0 - removed ACF_LITE |
| 55 | return ( defined('ACF_LITE') && ACF_LITE ) ? false : $setting; |
| 56 | |
| 57 | } |
| 58 | |
| 59 | |
| 60 | /* |
| 61 | * acf_settings_l10n_textdomain |
| 62 | * |
| 63 | * This function will add compatibility for previously named hooks |
| 64 | * |
| 65 | * @type function |
| 66 | * @date 19/05/2014 |
| 67 | * @since 5.0.0 |
| 68 | * |
| 69 | * @param n/a |
| 70 | * @return n/a |
| 71 | */ |
| 72 | |
| 73 | function acf_settings_l10n_textdomain( $setting ) { |
| 74 | |
| 75 | // 5.3.3 - changed filter name |
| 76 | return acf_get_setting( 'export_textdomain', $setting ); |
| 77 | |
| 78 | } |
| 79 | |
| 80 | |
| 81 | /* |
| 82 | * acf_settings_l10n_field |
| 83 | * |
| 84 | * This function will add compatibility for previously named hooks |
| 85 | * |
| 86 | * @type function |
| 87 | * @date 19/05/2014 |
| 88 | * @since 5.0.0 |
| 89 | * |
| 90 | * @param n/a |
| 91 | * @return n/a |
| 92 | */ |
| 93 | |
| 94 | function acf_settings_l10n_field( $setting ) { |
| 95 | |
| 96 | // 5.3.3 - changed filter name |
| 97 | return acf_get_setting( 'export_translate', $setting ); |
| 98 | |
| 99 | } |
| 100 | |
| 101 | |
| 102 | /* |
| 103 | * acf_validate_field |
| 104 | * |
| 105 | * This function will add compatibility for previously named hooks |
| 106 | * |
| 107 | * @type function |
| 108 | * @date 30/1/17 |
| 109 | * @since 5.5.6 |
| 110 | * |
| 111 | * @param $post_id (int) |
| 112 | * @return $post_id (int) |
| 113 | */ |
| 114 | |
| 115 | function acf_validate_field( $field ) { |
| 116 | |
| 117 | // 5.5.6 - changed filter name |
| 118 | $field = apply_filters( "acf/get_valid_field", $field ); |
| 119 | $field = apply_filters( "acf/get_valid_field/type={$field['type']}", $field ); |
| 120 | |
| 121 | |
| 122 | // return |
| 123 | return $field; |
| 124 | |
| 125 | } |
| 126 | |
| 127 | |
| 128 | /* |
| 129 | * acf_validate_field_group |
| 130 | * |
| 131 | * This function will add compatibility for previously named hooks |
| 132 | * |
| 133 | * @type function |
| 134 | * @date 30/1/17 |
| 135 | * @since 5.5.6 |
| 136 | * |
| 137 | * @param $post_id (int) |
| 138 | * @return $post_id (int) |
| 139 | */ |
| 140 | |
| 141 | function acf_validate_field_group( $field_group ) { |
| 142 | |
| 143 | // 5.5.6 - changed filter name |
| 144 | $field_group = apply_filters('acf/get_valid_field_group', $field_group); |
| 145 | |
| 146 | |
| 147 | // return |
| 148 | return $field_group; |
| 149 | |
| 150 | } |
| 151 | |
| 152 | |
| 153 | /* |
| 154 | * acf_validate_post_id |
| 155 | * |
| 156 | * This function will add compatibility for previously named hooks |
| 157 | * |
| 158 | * @type function |
| 159 | * @date 6/2/17 |
| 160 | * @since 5.5.6 |
| 161 | * |
| 162 | * @param $post_id (int) |
| 163 | * @return $post_id (int) |
| 164 | */ |
| 165 | |
| 166 | function acf_validate_post_id( $post_id, $_post_id ) { |
| 167 | |
| 168 | // 5.5.6 - changed filter name |
| 169 | $post_id = apply_filters('acf/get_valid_post_id', $post_id, $_post_id); |
| 170 | |
| 171 | |
| 172 | // return |
| 173 | return $post_id; |
| 174 | |
| 175 | } |
| 176 | |
| 177 | } |
| 178 | |
| 179 | |
| 180 | // initialize |
| 181 | acf()->deprecated = new acf_deprecated(); |
| 182 | |
| 183 | endif; // class_exists check |
| 184 | |
| 185 | ?> |