deprecated.php 3.54 KB
Newer Older
imac's avatar
imac committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
<?php 

if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

if( ! class_exists('acf_deprecated') ) :

class acf_deprecated {
	
	/*
	*  __construct
	*
	*  This function will setup the class functionality
	*
	*  @type	function
	*  @date	30/1/17
	*  @since	5.5.6
	*
	*  @param	n/a
	*  @return	n/a
	*/
	
	function __construct() {
		
		// settings
		add_filter('acf/settings/show_admin',			array($this, 'acf_settings_show_admin'), 5, 1);				// 5.0.0
		add_filter('acf/settings/l10n_textdomain',		array($this, 'acf_settings_l10n_textdomain'), 5, 1);		// 5.3.3
		add_filter('acf/settings/l10n_field',			array($this, 'acf_settings_l10n_field'), 5, 1);				// 5.3.3
		add_filter('acf/settings/l10n_field_group',		array($this, 'acf_settings_l10n_field'), 5, 1);				// 5.3.3
		
		
		// filters
		add_filter('acf/validate_field', 				array($this, 'acf_validate_field'), 10, 1); 				// 5.5.6
		add_filter('acf/validate_field_group', 			array($this, 'acf_validate_field_group'), 10, 1); 			// 5.5.6
		add_filter('acf/validate_post_id', 				array($this, 'acf_validate_post_id'), 10, 2); 			// 5.5.6
		
	}
	
	
	/*
	*  acf_settings_show_admin
	*
	*  This function will add compatibility for previously named hooks
	*
	*  @type	function
	*  @date	19/05/2014
	*  @since	5.0.0
	*
	*  @param	n/a
	*  @return	n/a
	*/
	
	function acf_settings_show_admin( $setting ) {
		
		// 5.0.0 - removed ACF_LITE
		return ( defined('ACF_LITE') && ACF_LITE ) ? false : $setting;
		
	}
	
	
	/*
	*  acf_settings_l10n_textdomain
	*
	*  This function will add compatibility for previously named hooks
	*
	*  @type	function
	*  @date	19/05/2014
	*  @since	5.0.0
	*
	*  @param	n/a
	*  @return	n/a
	*/
	
	function acf_settings_l10n_textdomain( $setting ) {
		
		// 5.3.3 - changed filter name
		return acf_get_setting( 'export_textdomain', $setting );
		
	}
	
	
	/*
	*  acf_settings_l10n_field
	*
	*  This function will add compatibility for previously named hooks
	*
	*  @type	function
	*  @date	19/05/2014
	*  @since	5.0.0
	*
	*  @param	n/a
	*  @return	n/a
	*/
	
	function acf_settings_l10n_field( $setting ) {
		
		// 5.3.3 - changed filter name
		return acf_get_setting( 'export_translate', $setting );
		
	}
	
	
	/*
	*  acf_validate_field
	*
	*  This function will add compatibility for previously named hooks
	*
	*  @type	function
	*  @date	30/1/17
	*  @since	5.5.6
	*
	*  @param	$post_id (int)
	*  @return	$post_id (int)
	*/
	
	function acf_validate_field( $field ) {
		
		// 5.5.6 - changed filter name
		$field = apply_filters( "acf/get_valid_field", $field );
		$field = apply_filters( "acf/get_valid_field/type={$field['type']}", $field );
		
		
		// return
		return $field;
		
	}
	
	
	/*
	*  acf_validate_field_group
	*
	*  This function will add compatibility for previously named hooks
	*
	*  @type	function
	*  @date	30/1/17
	*  @since	5.5.6
	*
	*  @param	$post_id (int)
	*  @return	$post_id (int)
	*/
	
	function acf_validate_field_group( $field_group ) {
		
		// 5.5.6 - changed filter name
		$field_group = apply_filters('acf/get_valid_field_group', $field_group);
		
		
		// return
		return $field_group;
		
	}
	
	
	/*
	*  acf_validate_post_id
	*
	*  This function will add compatibility for previously named hooks
	*
	*  @type	function
	*  @date	6/2/17
	*  @since	5.5.6
	*
	*  @param	$post_id (int)
	*  @return	$post_id (int)
	*/
	
	function acf_validate_post_id( $post_id, $_post_id ) {
		
		// 5.5.6 - changed filter name
		$post_id = apply_filters('acf/get_valid_post_id', $post_id, $_post_id);
		
		
		// return
		return $post_id;
		
	}
	
}


// initialize
acf()->deprecated = new acf_deprecated();

endif; // class_exists check

?>