Plugin Directory

Changeset 2246438


Ignore:
Timestamp:
02/18/2020 09:49:02 PM (6 years ago)
Author:
moshensky
Message:

v 2.2.2

Location:
cf7-spreadsheets/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cf7-spreadsheets/trunk/CF7-spreadsheets.php

    r2097840 r2246438  
    44Plugin URI: https://github.com/moshenskyDV/CF7-spreadsheets
    55Description: Send Contact form 7 mail to Google spreadsheets
    6 Version: 2.2.1
     6Version: 2.2.2
    77Author: Moshenskyi Danylo
    88Author URI: https://github.com/moshenskyDV/
     
    132132    }
    133133
     134    /**
     135     * Regex similar to contact-form-7/includes/form-tags-manager.php:262.
     136     *
     137     * @param $meta
     138     *
     139     * @return bool|mixed
     140     */
    134141    public function get_fields($meta)
    135142    {
    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';
    137159        $arr = [];
    138160        if (false == preg_match_all($regexp, $meta, $arr)) {
     
    204226                $values = [];
    205227                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());
    207229                    $cellData = new Google_Service_Sheets_CellData();
    208230                    $value = new Google_Service_Sheets_ExtendedValue();
     
    657679    }
    658680
    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        }
    661687        $regexp = '/\[.*\]/U';
    662688        preg_match_all($regexp, $string, $arr);
     
    678704                        $replace_to[] = implode(', ', $_POST[$clear_tag]);
    679705                    } 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                        }
    681712                    }
    682713                } elseif ($defined = wpcf7_special_mail_tag(false, $clear_tag, false)) {
  • cf7-spreadsheets/trunk/readme.txt

    r2097840 r2246438  
    44Requires at least: 4.7
    55Tested up to: 5.2.1
    6 Stable tag: 2.2.1
     6Stable tag: 2.2.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6060== Changelog ==
    6161
    62 = 2.2.1 =
     62= 2.2.2 =
    6363
    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/)
    6566
    6667= 2.2.0 =
Note: See TracChangeset for help on using the changeset viewer.