From 7fc75384e710b1975bd67091b61f3a3bedd17703 Mon Sep 17 00:00:00 2001 From: Brandon Date: Wed, 12 Aug 2020 02:55:29 -0500 Subject: [PATCH] v1.0.5 --- composer.lock | 10 +++++----- plugin.php | 2 +- src/PhoneNumber.php | 19 ++++++++++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 6ee04ae..0818d01 100644 --- a/composer.lock +++ b/composer.lock @@ -341,16 +341,16 @@ "packages-dev": [ { "name": "squizlabs/php_codesniffer", - "version": "3.5.5", + "version": "3.5.6", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", - "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e97627871a7eab2f70e59166072a6b767d5834e0", + "reference": "e97627871a7eab2f70e59166072a6b767d5834e0", "shasum": "" }, "require": { @@ -388,7 +388,7 @@ "phpcs", "standards" ], - "time": "2020-04-17T01:09:41+00:00" + "time": "2020-08-10T04:50:15+00:00" } ], "aliases": [], diff --git a/plugin.php b/plugin.php index 3695f83..f60a0bc 100644 --- a/plugin.php +++ b/plugin.php @@ -4,7 +4,7 @@ * Plugin Name: Advanced Custom Fields: Phone Number * Plugin URI: https://github.com/log1x/acf-phone-number * Description: A real ACF phone number field. - * Version: 1.0.4 + * Version: 1.0.5 * Author: Brandon Nifong * Author URI: https://github.com/log1x */ diff --git a/src/PhoneNumber.php b/src/PhoneNumber.php index 027f992..23f0915 100644 --- a/src/PhoneNumber.php +++ b/src/PhoneNumber.php @@ -132,6 +132,23 @@ public function format_value($value, $post_id, $field) ]); } + /** + * This filter is applied to the $value before it is saved in the database. + * + * @param mixed $value + * @param mixed $post_id + * @param array $field + * @return mixed + */ + public function update_value($value, $post_id, $field) + { + if (! is_array($value) || empty($value['number'])) { + return; + } + + return $value; + } + /** * This filter is used to perform validation on the value prior to saving. * @@ -144,7 +161,7 @@ public function format_value($value, $post_id, $field) public function validate_value($valid, $value, $field, $input) { if (! is_array($value) || empty($value['number'])) { - return 'The phone number entered is not valid.'; + return $valid; } if (empty($value['country'])) {