Changeset 2246438
- Timestamp:
- 02/18/2020 09:49:02 PM (6 years ago)
- Location:
- cf7-spreadsheets/trunk
- Files:
-
- 2 edited
-
CF7-spreadsheets.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cf7-spreadsheets/trunk/CF7-spreadsheets.php
r2097840 r2246438 4 4 Plugin URI: https://github.com/moshenskyDV/CF7-spreadsheets 5 5 Description: Send Contact form 7 mail to Google spreadsheets 6 Version: 2.2. 16 Version: 2.2.2 7 7 Author: Moshenskyi Danylo 8 8 Author URI: https://github.com/moshenskyDV/ … … 132 132 } 133 133 134 /** 135 * Regex similar to contact-form-7/includes/form-tags-manager.php:262. 136 * 137 * @param $meta 138 * 139 * @return bool|mixed 140 */ 134 141 public function get_fields($meta) 135 142 { 136 $regexp = '/\[.*\]/'; 143 $allowed_tags_string = implode( 144 '|', 145 array_merge( 146 $this->allowed_tags, 147 array_map(function ($tag) { return $tag.'\*'; }, $this->allowed_tags), 148 $this->predefined_mail, 149 $this->predefined_post, 150 $this->predefined_site, 151 $this->predefined_user, 152 array_keys($this->obsolete_predefined_tags) 153 ) 154 ); 155 $regexp = '/(\[?)' 156 .'\[('.$allowed_tags_string.')(?:[\r\n\t ](.*?))?(?:[\r\n\t ](\/))?\]' 157 .'(?:([^[]*?)\[\/\2\])?' 158 .'(\]?)/s'; 137 159 $arr = []; 138 160 if (false == preg_match_all($regexp, $meta, $arr)) { … … 204 226 $values = []; 205 227 foreach ($params_names as $i => $param) { 206 $d = $this->replace_tags($this->exec_shortcodes($param) );228 $d = $this->replace_tags($this->exec_shortcodes($param), $cf7->scan_form_tags()); 207 229 $cellData = new Google_Service_Sheets_CellData(); 208 230 $value = new Google_Service_Sheets_ExtendedValue(); … … 657 679 } 658 680 659 private function replace_tags($string) 660 { 681 private function replace_tags($string, $request_form_tags) 682 { 683 $assoc_request_form_tags = []; 684 foreach ($request_form_tags as $tag) { 685 $assoc_request_form_tags[$tag->name] = $tag; 686 } 661 687 $regexp = '/\[.*\]/U'; 662 688 preg_match_all($regexp, $string, $arr); … … 678 704 $replace_to[] = implode(', ', $_POST[$clear_tag]); 679 705 } else { 680 $replace_to[] = $_POST[$clear_tag]; 706 if (!empty($assoc_request_form_tags[$clear_tag]->pipes->collect_befores())) { 707 $index = array_search($_POST[$clear_tag], $assoc_request_form_tags[$clear_tag]->pipes->collect_befores()); 708 $replace_to[] = $assoc_request_form_tags[$clear_tag]->pipes->collect_afters()[$index]; 709 } else { 710 $replace_to[] = $_POST[$clear_tag]; 711 } 681 712 } 682 713 } elseif ($defined = wpcf7_special_mail_tag(false, $clear_tag, false)) { -
cf7-spreadsheets/trunk/readme.txt
r2097840 r2246438 4 4 Requires at least: 4.7 5 5 Tested up to: 5.2.1 6 Stable tag: 2.2. 16 Stable tag: 2.2.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 60 60 == Changelog == 61 61 62 = 2.2. 1=62 = 2.2.2 = 63 63 64 * Fixed broken packages 64 * Fixed regexp, responsible for parsing text message (multiline tags and couple of tags in one line works well now) 65 * Added [pipes feature](https://contactform7.com/selectable-recipient-with-pipes/) 65 66 66 67 = 2.2.0 =
Note: See TracChangeset
for help on using the changeset viewer.