Skip to content

Commit

Permalink
v4.15.4
Browse files Browse the repository at this point in the history
  • Loading branch information
aurovrata committed Feb 22, 2023
1 parent 6a5e88a commit 5a5f911
Show file tree
Hide file tree
Showing 22 changed files with 440 additions and 73 deletions.
12 changes: 9 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: contact form 7 module, form custom styling, contact form 7 extension, responsive forms, multi-step form, form builder, multi-slide slider form, repetitive fields, form custom JavaScript
Requires at least: 4.7
Requires PHP: 5.6
Tested up to: 6.1.0
Tested up to: 6.1.1
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -352,9 +352,15 @@ For JavaScript helper codes, paste them in your `<theme folder>/js/<form-unique-
21. (21) The plugin include hooks for further customisation. Handy helper code snippets are provided within form editor in the metabox 'Actions & Filers', with a set of links on which you can click to copy the code snippet and paste it in your *functions.php* file.
22. (22) You can set a maximum number of rows a user can add to a table, by adding the `data-max` attribute to your table element.
23. (23) You can filter mail tags, hover your mouse over the blue information icon next to each tag and click the link, this will copy the filter code to your clipboard which you can paste into your functions.php file.
24. (24) Redirect your form on submission to one of your existing pages and retrieve the submitted values from a transient field.

== Changelog ==
= 4.16.0 =
* add 'c2p-refill-field' prefill event in public js.
= 4.15.4 =
* fix dynamic field validation.
= 4.15.3 =
* update mininfied public css.
= 4.15.2 =
* fix codemirror init loop.
= 4.15.1 =
* fix prefill filter.
* fix shortcode regex for form detection in pages.
Expand Down
Empty file modified admin/css/image/tutorial.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 24 additions & 21 deletions admin/js/cf7-grid-codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
}else $(':input',$themeRadio).prop('disabled',true);

$(document).ready( function(){
let codemirrorUpdated = false, formFields={},
let codemirrorUpdated = false, initCF7sgPage =true, formFields={},
$grid = $('#grid-form'),
$jsTags = $('#js-tags'),
gridTab = '#cf7-editor-grid', //default at load time.
Expand Down Expand Up @@ -164,26 +164,29 @@

if('#cf7-codemirror' == panel){
//finalise any changes in the grid form editor
$grid.on('cf7grid-form-ready', function(){
let code = $grid.CF7FormHTML();
if($grid.children('.container').length > 0){ //beautify.
code = html_beautify(code ,
{
'indent_size': 2,
'wrap_line_length': 0
});
}
cme.setValue(code);
// cme.refresh();
//reset the codemirror change flag
codemirrorUpdated = false;
//remove id from textarea
$('textarea#wpcf7-form').attr('id', '');
//change the wpcf7 textarea
$('textarea.codemirror-cf7-update', $codemirror).attr('id', 'wpcf7-form');
//setup the form code in the hidden textarea
$wpcf7Editor.html(code);
});
if(initCF7sgPage){ //initialises the event listener 'cf7grid-form-ready'.
initCF7sgPage = false;
$grid.on('cf7grid-form-ready', function(){
let code = $grid.CF7FormHTML();
if($grid.children('.container').length > 0){ //beautify.
code = html_beautify(code ,
{
'indent_size': 2,
'wrap_line_length': 0
});
}
cme.setValue(code);
// cme.refresh();
//reset the codemirror change flag
codemirrorUpdated = false;
//remove id from textarea
$('textarea#wpcf7-form').attr('id', '');
//change the wpcf7 textarea
$('textarea.codemirror-cf7-update', $codemirror).attr('id', 'wpcf7-form');
//setup the form code in the hidden textarea
$wpcf7Editor.html(code);
});
}
/** @since 2.8.3 clear the codemirror textarea##wpcf7-form */
$('textarea.codemirror-cf7-update', $codemirror).val('');
$grid.trigger('cf7grid-form-finalise');
Expand Down
Empty file modified admin/partials/pointers/cf7sg-pointer-tag-dynamic-checkbox.php
100644 → 100755
Empty file.
Empty file modified admin/partials/pointers/cf7sg-pointer-tag-ui-editor-tags.php
100644 → 100755
Empty file.
184 changes: 184 additions & 0 deletions assets/codemirror/edit/closetag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE

/**
* Tag-closer extension for CodeMirror.
*
* This extension adds an "autoCloseTags" option that can be set to
* either true to get the default behavior, or an object to further
* configure its behavior.
*
* These are supported options:
*
* `whenClosing` (default true)
* Whether to autoclose when the '/' of a closing tag is typed.
* `whenOpening` (default true)
* Whether to autoclose the tag when the final '>' of an opening
* tag is typed.
* `dontCloseTags` (default is empty tags for HTML, none for XML)
* An array of tag names that should not be autoclosed.
* `indentTags` (default is block tags for HTML, none for XML)
* An array of tag names that should, when opened, cause a
* blank line to be added inside the tag, and the blank line and
* closing line to be indented.
* `emptyTags` (default is none)
* An array of XML tag names that should be autoclosed with '/>'.
*
* See demos/closetag.html for a usage example.
*/

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../fold/xml-fold"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
if (old != CodeMirror.Init && old)
cm.removeKeyMap("autoCloseTags");
if (!val) return;
var map = {name: "autoCloseTags"};
if (typeof val != "object" || val.whenClosing !== false)
map["'/'"] = function(cm) { return autoCloseSlash(cm); };
if (typeof val != "object" || val.whenOpening !== false)
map["'>'"] = function(cm) { return autoCloseGT(cm); };
cm.addKeyMap(map);
});

var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
"source", "track", "wbr"];
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];

function autoCloseGT(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections(), replacements = [];
var opt = cm.getOption("autoCloseTags");
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
var tagInfo = inner.mode.xmlCurrentTag && inner.mode.xmlCurrentTag(state)
var tagName = tagInfo && tagInfo.name
if (!tagName) return CodeMirror.Pass

var html = inner.mode.configuration == "html";
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);

if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
var lowerTagName = tagName.toLowerCase();
// Don't process the '>' at the end of an end-tag or self-closing tag
if (!tagName ||
tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
tok.type == "tag" && tagInfo.close ||
tok.string.indexOf("/") == (pos.ch - tok.start - 1) || // match something like <someTagName />
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
closingTagExists(cm, inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) || [], tagName, pos, true))
return CodeMirror.Pass;

var emptyTags = typeof opt == "object" && opt.emptyTags;
if (emptyTags && indexOf(emptyTags, tagName) > -1) {
replacements[i] = { text: "/>", newPos: CodeMirror.Pos(pos.line, pos.ch + 2) };
continue;
}

var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
replacements[i] = {indent: indent,
text: ">" + (indent ? "\n\n" : "") + "</" + tagName + ">",
newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};
}

var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnAutoClose);
for (var i = ranges.length - 1; i >= 0; i--) {
var info = replacements[i];
cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
var sel = cm.listSelections().slice(0);
sel[i] = {head: info.newPos, anchor: info.newPos};
cm.setSelections(sel);
if (!dontIndentOnAutoClose && info.indent) {
cm.indentLine(info.newPos.line, null, true);
cm.indentLine(info.newPos.line + 1, null, true);
}
}
}

function autoCloseCurrent(cm, typingSlash) {
var ranges = cm.listSelections(), replacements = [];
var head = typingSlash ? "/" : "</";
var opt = cm.getOption("autoCloseTags");
var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnSlash);
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" ||
tok.start != pos.ch - 1))
return CodeMirror.Pass;
// Kludge to get around the fact that we are not in XML mode
// when completing in JS/CSS snippet in htmlmixed mode. Does not
// work for other XML embedded languages (there is no general
// way to go from a mixed mode to its current XML state).
var replacement, mixed = inner.mode.name != "xml" && cm.getMode().name == "htmlmixed"
if (mixed && inner.mode.name == "javascript") {
replacement = head + "script";
} else if (mixed && inner.mode.name == "css") {
replacement = head + "style";
} else {
var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state)
if (!context || (context.length && closingTagExists(cm, context, context[context.length - 1], pos)))
return CodeMirror.Pass;
replacement = head + context[context.length - 1]
}
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
replacements[i] = replacement;
}
cm.replaceSelections(replacements);
ranges = cm.listSelections();
if (!dontIndentOnAutoClose) {
for (var i = 0; i < ranges.length; i++)
if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)
cm.indentLine(ranges[i].head.line);
}
}

function autoCloseSlash(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
return autoCloseCurrent(cm, true);
}

CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };

function indexOf(collection, elt) {
if (collection.indexOf) return collection.indexOf(elt);
for (var i = 0, e = collection.length; i < e; ++i)
if (collection[i] == elt) return i;
return -1;
}

// If xml-fold is loaded, we use its functionality to try and verify
// whether a given tag is actually unclosed.
function closingTagExists(cm, context, tagName, pos, newTag) {
if (!CodeMirror.scanForClosingTag) return false;
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
if (!nextClose || nextClose.tag != tagName) return false;
// If the immediate wrapping context contains onCx instances of
// the same tag, a closing tag only exists if there are at least
// that many closing tags of that type following.
var onCx = newTag ? 1 : 0
for (var i = context.length - 1; i >= 0; i--) {
if (context[i] == tagName) ++onCx
else break
}
pos = nextClose.to;
for (var i = 1; i < onCx; i++) {
var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
if (!next || next.tag != tagName) return false;
pos = next.to;
}
return true;
}
});
66 changes: 66 additions & 0 deletions assets/codemirror/edit/matchtags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../fold/xml-fold"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";

CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) {
cm.off("cursorActivity", doMatchTags);
cm.off("viewportChange", maybeUpdateMatch);
clear(cm);
}
if (val) {
cm.state.matchBothTags = typeof val == "object" && val.bothTags;
cm.on("cursorActivity", doMatchTags);
cm.on("viewportChange", maybeUpdateMatch);
doMatchTags(cm);
}
});

function clear(cm) {
if (cm.state.tagHit) cm.state.tagHit.clear();
if (cm.state.tagOther) cm.state.tagOther.clear();
cm.state.tagHit = cm.state.tagOther = null;
}

function doMatchTags(cm) {
cm.state.failedTagMatch = false;
cm.operation(function() {
clear(cm);
if (cm.somethingSelected()) return;
var cur = cm.getCursor(), range = cm.getViewport();
range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
var match = CodeMirror.findMatchingTag(cm, cur, range);
if (!match) return;
if (cm.state.matchBothTags) {
var hit = match.at == "open" ? match.open : match.close;
if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
}
var other = match.at == "close" ? match.open : match.close;
if (other)
cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
else
cm.state.failedTagMatch = true;
});
}

function maybeUpdateMatch(cm) {
if (cm.state.failedTagMatch) doMatchTags(cm);
}

CodeMirror.commands.toMatchingTag = function(cm) {
var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
if (found) {
var other = found.at == "close" ? found.open : found.close;
if (other) cm.extendSelection(other.to, other.from);
}
};
});
23 changes: 23 additions & 0 deletions assets/codemirror/theme/eclipse.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.cm-s-eclipse span.cm-meta { color: #FF1717; }
.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
.cm-s-eclipse span.cm-atom { color: #219; }
.cm-s-eclipse span.cm-number { color: #164; }
.cm-s-eclipse span.cm-def { color: #00f; }
.cm-s-eclipse span.cm-variable { color: black; }
.cm-s-eclipse span.cm-variable-2 { color: #0000C0; }
.cm-s-eclipse span.cm-variable-3 { color: #0000C0; }
.cm-s-eclipse span.cm-property { color: black; }
.cm-s-eclipse span.cm-operator { color: black; }
.cm-s-eclipse span.cm-comment { color: #3F7F5F; }
.cm-s-eclipse span.cm-string { color: #2A00FF; }
.cm-s-eclipse span.cm-string-2 { color: #f50; }
.cm-s-eclipse span.cm-qualifier { color: #555; }
.cm-s-eclipse span.cm-builtin { color: #30a; }
.cm-s-eclipse span.cm-bracket { color: #cc7; }
.cm-s-eclipse span.cm-tag { color: #170; }
.cm-s-eclipse span.cm-attribute { color: #00c; }
.cm-s-eclipse span.cm-link { color: #219; }
.cm-s-eclipse span.cm-error { color: #f00; }

.cm-s-eclipse .CodeMirror-activeline-background { background: #e8f2ff; }
.cm-s-eclipse .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
Empty file added assets/codemirror/v.5.24.2
Empty file.
Empty file added assets/codemirror/v.5.32.0
Empty file.
Empty file modified assets/glider-js/glider.css
100644 → 100755
Empty file.
Empty file modified assets/hybrid-html-dropdown/hybrid-dropdown.min.js
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions cf7-grid-layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin URI: https://wordpress.org/plugins/cf7-grid-layout/
* GitHub Plugin URI: https://github.com/aurovrata/cf7-grid-layout
* Description: Enabled responsive grid layout designs for Contact Form 7 forms.
* Version: 4.15.1
* Version: 4.15.4rc1
* Author: Aurovrata V.
* Author URI: https://profiles.wordpress.org/aurovrata
* License: GPL-2.0+
Expand All @@ -23,7 +23,7 @@
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'CF7_GRID_VERSION', '4.15.1' );
define( 'CF7_GRID_VERSION', '4.15.4rc1' );

if(! defined('WPCF7_AUTOP') ) define('WPCF7_AUTOP', false);

Expand Down
7 changes: 3 additions & 4 deletions includes/class-cf7-grid-layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,11 @@ private function define_public_hooks() {
//setup individual tag filers
$this->loader->add_filter( 'wpcf7_posted_data', $plugin_public, 'setup_grid_values', 5, 1 );
//filter cf7 validation
$this->loader->add_action('wpcf7_swv_create_schema', $plugin_public, 'validate_swv_schemas', PHP_INT_MAX , 2);
$this->loader->add_action('wpcf7_swv_create_schema', $plugin_public, 'cf7_swv_schemas_repetitive_fields', PHP_INT_MAX , 2);
$this->loader->add_action('wpcf7_swv_create_schema', $plugin_public, 'cf7_swv_schemas_dynamic_fields', 10 , 2);

$this->loader->add_filter( 'wpcf7_validate', $plugin_public, 'filter_wpcf7_validate', 1, 1);
//benchmark validation
$this->loader->add_filter( 'wpcf7_validate_dynamic_select*', $plugin_public, 'validate_required', 30, 2 );
$this->loader->add_filter( 'wpcf7_validate_benchmark*', $plugin_public, 'validate_required', 30, 2 );

/**
* @since 2.1 filter mail tags for tables and tabs.*/
$this->loader->add_filter( 'wpcf7_mail_tag_replaced', $plugin_public, 'filter_table_tab_mail_tag', 30, 4 );
Expand Down
Loading

0 comments on commit 5a5f911

Please sign in to comment.