Advanced Custom Fields: Image Crop Add-on - Version 1.4.10

Version Description

  • Add compatibility with ACF Pro 5.5.5
Download this release

Release Info

Developer andersthorborg
Plugin Icon wp plugin Advanced Custom Fields: Image Crop Add-on
Version 1.4.10
Comparing to
See all releases

Code changes from version 1.4.9 to 1.4.10

acf-image-crop-v4.php CHANGED
@@ -594,13 +594,10 @@ class acf_field_image_crop extends acf_field_image
594
 
595
  function input_admin_enqueue_scripts()
596
  {
597
- // Note: This function can be removed if not used
598
-
599
-
600
  // register acf scripts
601
- wp_register_script('acf-input-image_crop', $this->settings['dir'] . 'js/input-v4.js', array('acf-input', 'imgareaselect'), $this->settings['version']);
602
 
603
- wp_register_style('acf-input-image_crop', $this->settings['dir'] . 'css/input.css', array('acf-input'), $this->settings['version']);
604
  wp_register_script( 'jcrop', includes_url( 'js/jcrop/jquery.Jcrop.min.css' ));
605
 
606
 
@@ -892,7 +889,7 @@ class acf_field_image_crop extends acf_field_image
892
  function filterMediaQuery($args){
893
  // get options
894
  $options = get_option( 'acf_image_crop_settings' );
895
- $hide = $options['hide_cropped'];
896
 
897
  // If hide option is enabled, do not select items with the acf_is_cropped meta-field
898
  if($hide){
@@ -940,24 +937,24 @@ class acf_field_image_crop extends acf_field_image
940
  function displayHideFromMediaInput(){
941
  // Get plugin options
942
  $options = get_option( 'acf_image_crop_settings' );
943
- $value = $options['hide_cropped'];
944
 
945
  // echo the field
946
  ?>
947
  <input name='acf_image_crop_settings[hide_cropped]'
948
- type='checkbox' <?php echo $value ? 'checked' : '' ?> value='true' />
949
  <?php
950
  }
951
 
952
  function displayRetinaModeInput(){
953
  // Get plugin options
954
  $options = get_option( 'acf_image_crop_settings' );
955
- $value = $options['retina_mode'];
956
 
957
  // echo the field
958
  ?>
959
  <input id="acf-image-crop-retina-mode" name='acf_image_crop_settings[retina_mode]'
960
- type='checkbox' <?php echo $value ? 'checked' : '' ?> value='true' />
961
  <?php
962
  }
963
 
594
 
595
  function input_admin_enqueue_scripts()
596
  {
 
 
 
597
  // register acf scripts
598
+ wp_register_script('acf-input-image_crop', plugins_url('js/input-v4.js', __FILE__), array('acf-input', 'imgareaselect'), $this->settings['version']);
599
 
600
+ wp_register_style('acf-input-image_crop', plugins_url('css/input.css', __FILE__), array('acf-input'), $this->settings['version']);
601
  wp_register_script( 'jcrop', includes_url( 'js/jcrop/jquery.Jcrop.min.css' ));
602
 
603
 
889
  function filterMediaQuery($args){
890
  // get options
891
  $options = get_option( 'acf_image_crop_settings' );
892
+ $hide = isset($options['hide_cropped']) && $options['hide_cropped'];
893
 
894
  // If hide option is enabled, do not select items with the acf_is_cropped meta-field
895
  if($hide){
937
  function displayHideFromMediaInput(){
938
  // Get plugin options
939
  $options = get_option( 'acf_image_crop_settings' );
940
+ $hide = isset($options['hide_cropped']) && $options['hide_cropped'];
941
 
942
  // echo the field
943
  ?>
944
  <input name='acf_image_crop_settings[hide_cropped]'
945
+ type='checkbox' <?php echo $hide ? 'checked' : '' ?> value='true' />
946
  <?php
947
  }
948
 
949
  function displayRetinaModeInput(){
950
  // Get plugin options
951
  $options = get_option( 'acf_image_crop_settings' );
952
+ $retina = isset($options['retina_mode']) && $options['retina_mode'];
953
 
954
  // echo the field
955
  ?>
956
  <input id="acf-image-crop-retina-mode" name='acf_image_crop_settings[retina_mode]'
957
+ type='checkbox' <?php echo $retina ? 'checked' : '' ?> value='true' />
958
  <?php
959
  }
960
 
acf-image-crop-v5.php CHANGED
@@ -909,28 +909,13 @@ class acf_field_image_crop extends acf_field_image {
909
 
910
  /*
911
  * update_value()
912
- *
913
- * This filter is applied to the $value before it is saved in the db
914
- *
915
- * @type filter
916
- * @since 3.6
917
- * @date 23/01/13
918
- *
919
- * @param $value (mixed) the value found in the database
920
- * @param $post_id (mixed) the $post_id from which the value was loaded
921
- * @param $field (array) the field array holding all the field options
922
- * @return $value
923
  */
924
-
925
- /*
926
-
927
  function update_value( $value, $post_id, $field ) {
928
-
929
  return $value;
930
-
931
  }
932
 
933
- */
934
 
935
 
936
  /*
@@ -1149,30 +1134,13 @@ class acf_field_image_crop extends acf_field_image {
1149
  * @return $valid
1150
  */
1151
 
1152
- /*
1153
-
1154
- function validate_value( $valid, $value, $field, $input ){
1155
-
1156
- // Basic usage
1157
- if( $value < $field['custom_minimum_setting'] )
1158
- {
1159
- $valid = false;
1160
- }
1161
 
1162
 
1163
- // Advanced usage
1164
- if( $value < $field['custom_minimum_setting'] )
1165
- {
1166
- $valid = __('The value is too little!','acf-image_crop'),
1167
- }
1168
-
1169
-
1170
- // return
1171
  return $valid;
1172
-
1173
  }
1174
 
1175
- */
1176
 
1177
 
1178
  /*
909
 
910
  /*
911
  * update_value()
912
+ * Implement this function to avoid parent function taking over and trying to validate json data
 
 
 
 
 
 
 
 
 
 
913
  */
 
 
 
914
  function update_value( $value, $post_id, $field ) {
 
915
  return $value;
 
916
  }
917
 
918
+
919
 
920
 
921
  /*
1134
  * @return $valid
1135
  */
1136
 
 
 
 
 
 
 
 
 
 
1137
 
1138
 
1139
+ function validate_value( $valid, $value, $field, $input ){
 
 
 
 
 
 
 
1140
  return $valid;
 
1141
  }
1142
 
1143
+
1144
 
1145
 
1146
  /*
acf-image-crop.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields: Image Crop Add-on
4
  Plugin URI: https://github.com/andersthorborg/ACF-Image-Crop
5
  Description: An image field making it possible/required for the user to crop the selected image to the specified image size or dimensions
6
- Version: 1.4.9
7
  Author: Anders Thorborg
8
  Author URI: http://thorb.org
9
  License: GPLv2 or later
3
  Plugin Name: Advanced Custom Fields: Image Crop Add-on
4
  Plugin URI: https://github.com/andersthorborg/ACF-Image-Crop
5
  Description: An image field making it possible/required for the user to crop the selected image to the specified image size or dimensions
6
+ Version: 1.4.10
7
  Author: Anders Thorborg
8
  Author URI: http://thorb.org
9
  License: GPLv2 or later
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: andersthorborg
3
  Tags: afc, advanced custom fields, image crop, image, crop
4
  Requires at least: 3.5
5
  Tested up to: 4.6
6
- Stable tag: 1.4.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -61,6 +61,9 @@ function my_register_fields()
61
 
62
  == Changelog ==
63
 
 
 
 
64
  = 1.4.9 =
65
  * Use acf-image-crop/filename_postfix to allow custom filename postfixes
66
 
3
  Tags: afc, advanced custom fields, image crop, image, crop
4
  Requires at least: 3.5
5
  Tested up to: 4.6
6
+ Stable tag: 1.4.10
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
61
 
62
  == Changelog ==
63
 
64
+ = 1.4.10 =
65
+ * Add compatibility with ACF Pro 5.5.5
66
+
67
  = 1.4.9 =
68
  * Use acf-image-crop/filename_postfix to allow custom filename postfixes
69