5.6.2
This commit is contained in:
parent
252b102ddd
commit
6eb7c397b5
5
acf.php
5
acf.php
|
|
@ -3,7 +3,7 @@
|
|||
Plugin Name: Advanced Custom Fields PRO
|
||||
Plugin URI: https://www.advancedcustomfields.com/
|
||||
Description: Customise WordPress with powerful, professional and intuitive fields.
|
||||
Version: 5.6.1
|
||||
Version: 5.6.2
|
||||
Author: Elliot Condon
|
||||
Author URI: http://www.elliotcondon.com/
|
||||
Copyright: Elliot Condon
|
||||
|
|
@ -18,7 +18,7 @@ if( ! class_exists('acf') ) :
|
|||
class acf {
|
||||
|
||||
// vars
|
||||
var $version = '5.6.1';
|
||||
var $version = '5.6.2';
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -245,6 +245,7 @@ class acf {
|
|||
acf_include('includes/fields/class-acf-field-select.php');
|
||||
acf_include('includes/fields/class-acf-field-checkbox.php');
|
||||
acf_include('includes/fields/class-acf-field-radio.php');
|
||||
acf_include('includes/fields/class-acf-field-range.php');
|
||||
acf_include('includes/fields/class-acf-field-true_false.php');
|
||||
acf_include('includes/fields/class-acf-field-post_object.php');
|
||||
acf_include('includes/fields/class-acf-field-page_link.php');
|
||||
|
|
|
|||
|
|
@ -177,9 +177,8 @@ img.acf-fw {
|
|||
color: #fff;
|
||||
padding: 5px 10px;
|
||||
position: absolute;
|
||||
z-index: 999999;
|
||||
font-size: 12px;
|
||||
z-index: 998;
|
||||
z-index: 900000;
|
||||
/* tip */
|
||||
/* positions */
|
||||
}
|
||||
|
|
@ -232,7 +231,7 @@ img.acf-fw {
|
|||
}
|
||||
/* confirm */
|
||||
.acf-tooltip.-confirm {
|
||||
z-index: 999;
|
||||
z-index: 900001;
|
||||
}
|
||||
.acf-tooltip.-confirm a {
|
||||
text-decoration: none;
|
||||
|
|
@ -937,7 +936,7 @@ html[dir="rtl"] .acf-columns-2 .acf-column-2 {
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
#acf-popup {
|
||||
position: fixed;
|
||||
z-index: 999999;
|
||||
z-index: 900000;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
|
@ -1096,15 +1095,16 @@ html[dir="rtl"] #acf-popup .title .acf-icon {
|
|||
*
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
.acf-hl[data-cols] {
|
||||
margin-left: -8px;
|
||||
margin-right: -8px;
|
||||
margin-left: -10px;
|
||||
margin-right: -10px;
|
||||
}
|
||||
.acf-hl[data-cols] > li {
|
||||
padding: 0 8px;
|
||||
padding: 0 10px;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* sizes */
|
||||
.acf-hl[data-cols="2"] > li {
|
||||
width: 50%;
|
||||
}
|
||||
|
|
@ -1114,14 +1114,51 @@ html[dir="rtl"] #acf-popup .title .acf-icon {
|
|||
.acf-hl[data-cols="4"] > li {
|
||||
width: 25%;
|
||||
}
|
||||
/* mobile */
|
||||
@media screen and (max-width: 782px) {
|
||||
.acf-hl[data-cols] {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
margin-top: -10px;
|
||||
}
|
||||
.acf-hl[data-cols] > li {
|
||||
width: 100% !important;
|
||||
padding: 10px 0 0;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
*
|
||||
* misc
|
||||
*
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
.acf-actions li {
|
||||
.acf-actions {
|
||||
text-align: right;
|
||||
z-index: 1;
|
||||
/* hover */
|
||||
/* rtl */
|
||||
}
|
||||
.acf-actions a {
|
||||
margin-left: 4px;
|
||||
}
|
||||
.acf-actions.-hover {
|
||||
position: absolute;
|
||||
display: none;
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 5px;
|
||||
}
|
||||
html[dir="rtl"] .acf-actions a {
|
||||
margin-left: 0;
|
||||
margin-right: 4px;
|
||||
}
|
||||
html[dir="rtl"] .acf-actions.-hover {
|
||||
right: auto;
|
||||
left: 0;
|
||||
}
|
||||
/* ul compatibility */
|
||||
ul.acf-actions li {
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
*
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ html[dir="rtl"] .acf-fields.-left > .acf-field > .acf-input {
|
|||
.acf-table tr.acf-field > td.acf-label,
|
||||
.acf-table tr.acf-field > td.acf-input {
|
||||
padding: 15px 12px;
|
||||
margin: 0;
|
||||
}
|
||||
.acf-table tr.acf-field > td.acf-label {
|
||||
background: #F9F9F9;
|
||||
|
|
@ -640,6 +641,9 @@ html[dir="rtl"] .select2-container.-acf .select2-choice .select2-arrow {
|
|||
border-color: #f7f7f7;
|
||||
visibility: visible !important;
|
||||
}
|
||||
.select2-container .select2-dropdown {
|
||||
z-index: 900000;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Link
|
||||
|
|
@ -674,6 +678,12 @@ html[dir="rtl"] .select2-container.-acf .select2-choice .select2-arrow {
|
|||
.acf-link.-external .acf-icon.-link-ext {
|
||||
display: inline-block;
|
||||
}
|
||||
#wp-link-backdrop {
|
||||
z-index: 900000 !important;
|
||||
}
|
||||
#wp-link-wrap {
|
||||
z-index: 900001 !important;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Radio
|
||||
|
|
@ -729,8 +739,6 @@ html[dir="rtl"] ul.acf-radio-list input[type="radio"],
|
|||
html[dir="rtl"] ul.acf-checkbox-list input[type="radio"] {
|
||||
margin-left: 4px;
|
||||
margin-right: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
|
|
@ -831,6 +839,10 @@ html[dir="rtl"] ul.acf-checkbox-list input[type="radio"] {
|
|||
position: relative;
|
||||
border: #DFDFDF solid 1px;
|
||||
background: #fff;
|
||||
/* default is focused */
|
||||
/* -search */
|
||||
/* -value */
|
||||
/* -loading */
|
||||
}
|
||||
.acf-google-map .title {
|
||||
position: relative;
|
||||
|
|
@ -848,28 +860,20 @@ html[dir="rtl"] ul.acf-checkbox-list input[type="radio"] {
|
|||
font-family: inherit;
|
||||
cursor: text;
|
||||
}
|
||||
.acf-google-map .title .actions {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
.acf-google-map .title a {
|
||||
float: left;
|
||||
margin: 6px 7px 0 0;
|
||||
display: none;
|
||||
}
|
||||
.acf-google-map .title i {
|
||||
.acf-google-map .title .acf-loading {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 11px;
|
||||
display: none;
|
||||
}
|
||||
.acf-google-map .title:hover .acf-actions {
|
||||
display: block;
|
||||
}
|
||||
.acf-google-map .canvas {
|
||||
height: 400px;
|
||||
}
|
||||
/* default is focused */
|
||||
.acf-google-map .title .acf-icon.-location {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
}
|
||||
.acf-google-map .title .acf-icon.-cancel {
|
||||
display: none;
|
||||
|
|
@ -877,17 +881,15 @@ html[dir="rtl"] ul.acf-checkbox-list input[type="radio"] {
|
|||
.acf-google-map .title .acf-icon.-search {
|
||||
display: none;
|
||||
}
|
||||
/* -search */
|
||||
.acf-google-map.-search .title .acf-icon.-location {
|
||||
display: none;
|
||||
}
|
||||
.acf-google-map.-search .title .acf-icon.-cancel {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
}
|
||||
.acf-google-map.-search .title .acf-icon.-search {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
}
|
||||
/* -value */
|
||||
.acf-google-map.-value .title .search {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
@ -895,17 +897,16 @@ html[dir="rtl"] ul.acf-checkbox-list input[type="radio"] {
|
|||
display: none;
|
||||
}
|
||||
.acf-google-map.-value .title .acf-icon.-cancel {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
}
|
||||
.acf-google-map.-value .title .acf-icon.-search {
|
||||
display: none;
|
||||
}
|
||||
/* -loading */
|
||||
.acf-google-map.-loading .title a {
|
||||
display: none !important;
|
||||
}
|
||||
.acf-google-map.-loading .title i {
|
||||
display: block;
|
||||
display: inline-block;
|
||||
}
|
||||
/* autocomplete */
|
||||
.pac-container {
|
||||
|
|
@ -922,11 +923,6 @@ html[dir="rtl"] ul.acf-checkbox-list input[type="radio"] {
|
|||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
/* rtl */
|
||||
html[dir="rtl"] .acf-google-map .title .acf-icon {
|
||||
right: auto;
|
||||
left: 7px;
|
||||
}
|
||||
html[dir="rtl"] .pac-container .pac-item {
|
||||
text-align: right;
|
||||
}
|
||||
|
|
@ -1145,7 +1141,7 @@ html[dir="rtl"] .acf-relationship .selection .values .acf-icon {
|
|||
box-shadow: none;
|
||||
}
|
||||
#mce_fullscreen_container {
|
||||
z-index: 150005 !important;
|
||||
z-index: 900000 !important;
|
||||
}
|
||||
/* WP < 4.1 */
|
||||
.acf-editor-wrap .wp-switch-editor {
|
||||
|
|
@ -1475,20 +1471,18 @@ html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
|
|||
height: auto;
|
||||
border: 0 none;
|
||||
}
|
||||
.acf-oembed .title .acf-icon {
|
||||
right: 7px;
|
||||
top: 6px;
|
||||
position: absolute;
|
||||
.acf-oembed .title .acf-actions {
|
||||
padding: 6px;
|
||||
}
|
||||
.acf-oembed .title:hover .acf-actions {
|
||||
display: block;
|
||||
}
|
||||
.acf-oembed .canvas {
|
||||
position: relative;
|
||||
min-height: 250px;
|
||||
background: #F9F9F9;
|
||||
}
|
||||
.acf-oembed.has-value .canvas {
|
||||
min-height: 0;
|
||||
}
|
||||
.acf-oembed .canvas-media {
|
||||
.acf-oembed .canvas .canvas-media {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
|
@ -1509,7 +1503,7 @@ html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
|
|||
font-size: 42px;
|
||||
color: #999;
|
||||
}
|
||||
.acf-oembed .canvas-loading {
|
||||
.acf-oembed .canvas .canvas-loading {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
|
@ -1519,13 +1513,13 @@ html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
|
|||
display: none;
|
||||
z-index: 2;
|
||||
}
|
||||
.acf-oembed .canvas-loading .acf-loading {
|
||||
.acf-oembed .canvas .canvas-loading i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -10px 0 0 -10px;
|
||||
}
|
||||
.acf-oembed .canvas-error {
|
||||
.acf-oembed .canvas .canvas-error {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0%;
|
||||
|
|
@ -1534,11 +1528,14 @@ html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
|
|||
text-align: center;
|
||||
display: none;
|
||||
}
|
||||
.acf-oembed .canvas-error p {
|
||||
.acf-oembed .canvas .canvas-error p {
|
||||
padding: 8px;
|
||||
margin: 0;
|
||||
display: inline;
|
||||
}
|
||||
.acf-oembed.has-value .canvas {
|
||||
min-height: 0;
|
||||
}
|
||||
/* states */
|
||||
.acf-oembed .title-value {
|
||||
display: none;
|
||||
|
|
@ -1580,19 +1577,26 @@ html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
.acf-image-uploader {
|
||||
position: relative;
|
||||
/* image wrap*/
|
||||
/* input */
|
||||
/* rtl */
|
||||
}
|
||||
.acf-image-uploader:after {
|
||||
clear: both;
|
||||
content: "";
|
||||
display: table;
|
||||
}
|
||||
.acf-image-uploader .view {
|
||||
float: left;
|
||||
position: relative;
|
||||
max-width: 100%;
|
||||
.acf-image-uploader p {
|
||||
margin: 0;
|
||||
}
|
||||
.acf-image-uploader img {
|
||||
width: 100%;
|
||||
.acf-image-uploader .image-wrap {
|
||||
position: relative;
|
||||
float: left;
|
||||
/* hover */
|
||||
}
|
||||
.acf-image-uploader .image-wrap img {
|
||||
max-width: 100%;
|
||||
width: auto;
|
||||
height: auto;
|
||||
display: block;
|
||||
min-width: 30px;
|
||||
|
|
@ -1600,30 +1604,21 @@ html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group {
|
|||
background: #f1f1f1;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
/* svg */
|
||||
}
|
||||
.acf-image-uploader .image-wrap img[src$=".svg"] {
|
||||
min-height: 100px;
|
||||
min-width: 100px;
|
||||
}
|
||||
.acf-image-uploader .image-wrap:hover .acf-actions {
|
||||
display: block;
|
||||
}
|
||||
.acf-image-uploader input.button {
|
||||
width: auto;
|
||||
}
|
||||
/* svg */
|
||||
.acf-image-uploader img[src$=".svg"] {
|
||||
min-height: 100px;
|
||||
min-width: 100px;
|
||||
}
|
||||
/* rtl */
|
||||
html[dir="rtl"] .acf-image-uploader .view {
|
||||
html[dir="rtl"] .acf-image-uploader .image-wrap {
|
||||
float: right;
|
||||
}
|
||||
/*
|
||||
* Hover
|
||||
*/
|
||||
.acf-image-uploader .acf-soh-target {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
.acf-image-uploader .acf-soh-target li {
|
||||
margin: 0 0 0 4px;
|
||||
}
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
*
|
||||
* File
|
||||
|
|
@ -1631,6 +1626,11 @@ html[dir="rtl"] .acf-image-uploader .view {
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
.acf-file-uploader {
|
||||
position: relative;
|
||||
/* hover */
|
||||
/* rtl */
|
||||
}
|
||||
.acf-file-uploader p {
|
||||
margin: 0;
|
||||
}
|
||||
.acf-file-uploader .file-wrap {
|
||||
border: #DFDFDF solid 1px;
|
||||
|
|
@ -1666,18 +1666,18 @@ html[dir="rtl"] .acf-image-uploader .view {
|
|||
.acf-file-uploader .file-info a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.acf-file-uploader .file-info ul {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
/* rtl */
|
||||
.acf-file-uploader:hover .acf-actions {
|
||||
display: block;
|
||||
}
|
||||
.acf-file-uploader .file-info ul li {
|
||||
margin: 0 0 0 4px;
|
||||
html[dir="rtl"] .acf-file-uploader .file-icon {
|
||||
left: auto;
|
||||
right: 0;
|
||||
border-left: #E5E5E5 solid 1px;
|
||||
border-right: none;
|
||||
}
|
||||
html[dir="rtl"] .acf-file-uploader .file-info ul {
|
||||
right: auto;
|
||||
left: 5px;
|
||||
html[dir="rtl"] .acf-file-uploader .file-info {
|
||||
margin-right: 69px;
|
||||
margin-left: 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
|
|
@ -1685,7 +1685,7 @@ html[dir="rtl"] .acf-file-uploader .file-info ul {
|
|||
*
|
||||
*---------------------------------------------------------------------------------------------*/
|
||||
.acf-ui-datepicker .ui-datepicker {
|
||||
z-index: 999999999 !important;
|
||||
z-index: 900000 !important;
|
||||
}
|
||||
.acf-ui-datepicker .ui-datepicker .ui-widget-header a {
|
||||
cursor: pointer;
|
||||
|
|
@ -1736,6 +1736,8 @@ html[dir="rtl"] .acf-file-uploader .file-info ul {
|
|||
*---------------------------------------------------------------------------------------------*/
|
||||
.acf-taxonomy-field {
|
||||
position: relative;
|
||||
/* hover */
|
||||
/* select */
|
||||
}
|
||||
.acf-taxonomy-field .categorychecklist-holder {
|
||||
border: #DFDFDF solid 1px;
|
||||
|
|
@ -1747,26 +1749,59 @@ html[dir="rtl"] .acf-file-uploader .file-info ul {
|
|||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
.acf-taxonomy-field ul.children {
|
||||
.acf-taxonomy-field .acf-checkbox-list ul.children {
|
||||
padding-left: 18px;
|
||||
}
|
||||
.acf-taxonomy-field .acf-icon {
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
right: 7px;
|
||||
z-index: 1;
|
||||
.acf-taxonomy-field:hover .acf-actions {
|
||||
display: block;
|
||||
}
|
||||
html[dir="rtl"] .acf-taxonomy-field .acf-icon {
|
||||
right: auto;
|
||||
left: 7px;
|
||||
.acf-taxonomy-field[data-type="select"] .acf-actions {
|
||||
padding: 0;
|
||||
margin: -9px;
|
||||
}
|
||||
.acf-taxonomy-field[data-type="select"] .acf-icon {
|
||||
top: -9px;
|
||||
right: -9px;
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Range
|
||||
*
|
||||
*---------------------------------------------------------------------------------------------*/
|
||||
.acf-range-wrap {
|
||||
/* rtl */
|
||||
}
|
||||
html[dir="rtl"] .acf-taxonomy-field[data-type="select"] .acf-icon {
|
||||
right: auto;
|
||||
left: -9px;
|
||||
.acf-range-wrap .acf-append,
|
||||
.acf-range-wrap .acf-prepend {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
line-height: 28px;
|
||||
margin: 0 7px 0 0;
|
||||
}
|
||||
.acf-range-wrap .acf-append {
|
||||
margin: 0 0 0 7px;
|
||||
}
|
||||
.acf-range-wrap input[type="range"] {
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
height: 28px;
|
||||
}
|
||||
.acf-range-wrap input[type="range"]:focus {
|
||||
outline: none;
|
||||
}
|
||||
.acf-range-wrap input[type="number"] {
|
||||
display: inline-block;
|
||||
width: 50px;
|
||||
margin-left: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
html[dir="rtl"] .acf-range-wrap input[type="number"] {
|
||||
margin-right: 10px;
|
||||
margin-left: 0;
|
||||
}
|
||||
html[dir="rtl"] .acf-range-wrap .acf-append {
|
||||
margin: 0 7px 0 0;
|
||||
}
|
||||
html[dir="rtl"] .acf-range-wrap .acf-prepend {
|
||||
margin: 0 0 0 7px;
|
||||
}
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2831,13 +2831,24 @@ var acf;
|
|||
// add event
|
||||
$(document).on(event, context + ' ' + selector, function( e ){
|
||||
|
||||
// append $el to event object
|
||||
e.$el = $(this);
|
||||
e.$field = acf.get_closest_field(e.$el, model.type);
|
||||
// vars
|
||||
var $el = $(this);
|
||||
var $field = acf.get_closest_field( $el, model.type );
|
||||
|
||||
|
||||
// bail early if no field
|
||||
if( !$field.length ) return;
|
||||
|
||||
|
||||
// focus
|
||||
model.set('$field', e.$field);
|
||||
if( !$field.is(model.$field) ) {
|
||||
model.set('$field', $field);
|
||||
}
|
||||
|
||||
|
||||
// append to event
|
||||
e.$el = $el;
|
||||
e.$field = $field;
|
||||
|
||||
|
||||
// callback
|
||||
|
|
@ -2851,9 +2862,7 @@ var acf;
|
|||
|
||||
// callback
|
||||
if( typeof this.focus === 'function' ) {
|
||||
|
||||
this.focus();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
|
@ -8911,6 +8920,57 @@ var acf;
|
|||
|
||||
})(jQuery);
|
||||
|
||||
(function($){
|
||||
|
||||
acf.fields.range = acf.field.extend({
|
||||
|
||||
type: 'range',
|
||||
$el: null,
|
||||
$range: null,
|
||||
$input: null,
|
||||
|
||||
events: {
|
||||
'input input': '_change',
|
||||
'change input': '_change'
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
|
||||
// get elements
|
||||
this.$el = this.$field.find('.acf-range-wrap');
|
||||
this.$range = this.$el.children('input[type="range"]');
|
||||
this.$input = this.$el.children('input[type="number"]');
|
||||
|
||||
},
|
||||
|
||||
_change: function( e ){
|
||||
|
||||
// get value from changed element
|
||||
var val = e.$el.val();
|
||||
var type = e.$el.attr('type');
|
||||
|
||||
|
||||
// allow for cleared value
|
||||
val = val || 0;
|
||||
|
||||
|
||||
// update sibling
|
||||
if( type === 'range' ) {
|
||||
|
||||
this.$input.val( val );
|
||||
|
||||
} else {
|
||||
|
||||
this.$range.val( val );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function($){
|
||||
|
||||
acf.fields.relationship = acf.field.extend({
|
||||
|
|
@ -9196,6 +9256,7 @@ var acf;
|
|||
// underline search match
|
||||
// consider removing due to bug where matched strings within HTML attributes caused incorrect results
|
||||
// Looks like Select2 v4 has moved away from highlighting results, so perhaps we should too
|
||||
/*
|
||||
if( this.o.s ) {
|
||||
|
||||
// vars
|
||||
|
|
@ -9218,6 +9279,7 @@ var acf;
|
|||
});
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// append
|
||||
|
|
@ -9960,12 +10022,6 @@ var acf;
|
|||
|
||||
},
|
||||
|
||||
remove_value: function( $select, value ){
|
||||
|
||||
this.do_function( 'remove_value', arguments );
|
||||
|
||||
},
|
||||
|
||||
remove_value: function( $select, value ){
|
||||
|
||||
this.do_function( 'remove_value', arguments );
|
||||
|
|
@ -13186,13 +13242,17 @@ var acf;
|
|||
this.$el = this.$field.find('.wp-editor-wrap').last();
|
||||
this.$textarea = this.$el.find('textarea');
|
||||
|
||||
|
||||
// get options
|
||||
this.o = acf.get_data( this.$el );
|
||||
this.o.id = this.$textarea.attr('id');
|
||||
this.o = acf.get_data(this.$el, {
|
||||
toolbar: '',
|
||||
active: this.$el.hasClass('tmce-active'),
|
||||
id: this.$textarea.attr('id')
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
mousedown: function(e) {
|
||||
mousedown: function(e){
|
||||
|
||||
// prevent default
|
||||
e.preventDefault();
|
||||
|
|
@ -13214,8 +13274,13 @@ var acf;
|
|||
if( this.$el.hasClass('delay') ) return;
|
||||
|
||||
|
||||
// bail early if no tinyMCEPreInit (needed by both tinymce and quicktags)
|
||||
if( typeof tinyMCEPreInit === 'undefined' ) return;
|
||||
// vars
|
||||
var args = {
|
||||
tinymce: true,
|
||||
quicktags: true,
|
||||
toolbar: this.o.toolbar,
|
||||
mode: this.o.active ? 'visual' : 'text',
|
||||
};
|
||||
|
||||
|
||||
// generate new id
|
||||
|
|
@ -13231,403 +13296,80 @@ var acf;
|
|||
// swap
|
||||
this.$el.replaceWith( html );
|
||||
|
||||
|
||||
|
||||
// update id
|
||||
this.o.id = new_id
|
||||
|
||||
this.o.id = new_id;
|
||||
|
||||
|
||||
// initialize
|
||||
this.initialize_tinymce();
|
||||
this.initialize_quicktags();
|
||||
acf.tinymce.initialize( this.o.id, args, this.$field );
|
||||
|
||||
},
|
||||
|
||||
initialize_tinymce: function(){
|
||||
|
||||
// bail early if no tinymce
|
||||
if( typeof tinymce === 'undefined' ) return;
|
||||
|
||||
|
||||
// bail early if no tinyMCEPreInit.mceInit
|
||||
if( typeof tinyMCEPreInit.mceInit === 'undefined' ) return;
|
||||
|
||||
|
||||
// vars
|
||||
var mceInit = this.get_mceInit();
|
||||
|
||||
|
||||
// append
|
||||
tinyMCEPreInit.mceInit[ mceInit.id ] = mceInit;
|
||||
|
||||
|
||||
// bail early if not visual active
|
||||
if( !this.$el.hasClass('tmce-active') ) return;
|
||||
|
||||
|
||||
// initialize
|
||||
try {
|
||||
|
||||
// init
|
||||
tinymce.init( mceInit );
|
||||
|
||||
|
||||
// vars
|
||||
var ed = tinyMCE.get( mceInit.id );
|
||||
|
||||
|
||||
// action for 3rd party customization
|
||||
acf.do_action('wysiwyg_tinymce_init', ed, ed.id, mceInit, this.$field);
|
||||
|
||||
} catch(e){}
|
||||
|
||||
},
|
||||
|
||||
initialize_quicktags: function(){
|
||||
|
||||
// bail early if no quicktags
|
||||
if( typeof quicktags === 'undefined' ) return;
|
||||
|
||||
|
||||
// bail early if no tinyMCEPreInit.qtInit
|
||||
if( typeof tinyMCEPreInit.qtInit === 'undefined' ) return;
|
||||
|
||||
|
||||
// vars
|
||||
var qtInit = this.get_qtInit();
|
||||
|
||||
|
||||
// append
|
||||
tinyMCEPreInit.qtInit[ qtInit.id ] = qtInit;
|
||||
|
||||
|
||||
// initialize
|
||||
try {
|
||||
|
||||
// init
|
||||
var qtag = quicktags( qtInit );
|
||||
|
||||
|
||||
// buttons
|
||||
this._buttonsInit( qtag );
|
||||
|
||||
|
||||
// action for 3rd party customization
|
||||
acf.do_action('wysiwyg_quicktags_init', qtag, qtag.id, qtInit, this.$field);
|
||||
|
||||
} catch(e){}
|
||||
|
||||
},
|
||||
|
||||
get_mceInit : function(){
|
||||
|
||||
// reference
|
||||
var $field = this.$field;
|
||||
|
||||
|
||||
// vars
|
||||
var toolbar = this.get_toolbar( this.o.toolbar ),
|
||||
mceInit = $.extend({}, tinyMCEPreInit.mceInit.acf_content);
|
||||
|
||||
|
||||
// selector
|
||||
mceInit.selector = '#' + this.o.id;
|
||||
|
||||
|
||||
// id
|
||||
mceInit.id = this.o.id; // tinymce v4
|
||||
mceInit.elements = this.o.id; // tinymce v3
|
||||
|
||||
|
||||
// toolbar
|
||||
if( toolbar ) {
|
||||
|
||||
var k = (tinymce.majorVersion < 4) ? 'theme_advanced_buttons' : 'toolbar';
|
||||
|
||||
for( var i = 1; i < 5; i++ ) {
|
||||
|
||||
mceInit[ k + i ] = acf.isset(toolbar, i) ? toolbar[i] : '';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// events
|
||||
if( tinymce.majorVersion < 4 ) {
|
||||
|
||||
mceInit.setup = function( ed ){
|
||||
|
||||
ed.onInit.add(function(ed, event) {
|
||||
|
||||
// focus
|
||||
$(ed.getBody()).on('focus', function(){
|
||||
|
||||
acf.validation.remove_error( $field );
|
||||
|
||||
});
|
||||
|
||||
$(ed.getBody()).on('blur', function(){
|
||||
|
||||
// update the hidden textarea
|
||||
// - This fixes a bug when adding a taxonomy term as the form is not posted and the hidden textarea is never populated!
|
||||
|
||||
// save to textarea
|
||||
ed.save();
|
||||
|
||||
|
||||
// trigger change on textarea
|
||||
$field.find('textarea').trigger('change');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
} else {
|
||||
|
||||
mceInit.setup = function( ed ){
|
||||
|
||||
ed.on('focus', function(e) {
|
||||
|
||||
acf.validation.remove_error( $field );
|
||||
|
||||
});
|
||||
|
||||
ed.on('change', function(e) {
|
||||
|
||||
// save to textarea
|
||||
ed.save();
|
||||
|
||||
|
||||
$field.find('textarea').trigger('change');
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
ed.on('blur', function(e) {
|
||||
|
||||
// update the hidden textarea
|
||||
// - This fixes a but when adding a taxonomy term as the form is not posted and the hidden textarea is never populated!
|
||||
|
||||
// save to textarea
|
||||
ed.save();
|
||||
|
||||
|
||||
// trigger change on textarea
|
||||
$field.find('textarea').trigger('change');
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
/*
|
||||
ed.on('ResizeEditor', function(e) {
|
||||
// console.log(e);
|
||||
});
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// disable wp_autoresize_on (no solution yet for fixed toolbar)
|
||||
mceInit.wp_autoresize_on = false;
|
||||
|
||||
|
||||
// hook for 3rd party customization
|
||||
mceInit = acf.apply_filters('wysiwyg_tinymce_settings', mceInit, mceInit.id, this.$field);
|
||||
|
||||
|
||||
// return
|
||||
return mceInit;
|
||||
|
||||
},
|
||||
|
||||
get_qtInit : function(){
|
||||
|
||||
// vars
|
||||
var qtInit = $.extend({}, tinyMCEPreInit.qtInit.acf_content);
|
||||
|
||||
|
||||
// id
|
||||
qtInit.id = this.o.id;
|
||||
|
||||
|
||||
// hook for 3rd party customization
|
||||
qtInit = acf.apply_filters('wysiwyg_quicktags_settings', qtInit, qtInit.id, this.$field);
|
||||
|
||||
|
||||
// return
|
||||
return qtInit;
|
||||
|
||||
},
|
||||
|
||||
/*
|
||||
* disable
|
||||
*
|
||||
* This function will disable the tinymce for a given field
|
||||
* Note: txtarea_el is different from $textarea.val() and is the value that you see, not the value that you save.
|
||||
* this allows text like <--more--> to wok instead of showing as an image when the tinymce is removed
|
||||
*
|
||||
* @type function
|
||||
* @date 1/08/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
disable: function(){
|
||||
|
||||
try {
|
||||
|
||||
// vars
|
||||
var ed = tinyMCE.get( this.o.id )
|
||||
|
||||
|
||||
// save
|
||||
ed.save();
|
||||
|
||||
|
||||
// destroy editor
|
||||
ed.destroy();
|
||||
|
||||
} catch(e) {}
|
||||
acf.tinymce.destroy( this.o.id );
|
||||
|
||||
},
|
||||
|
||||
enable: function(){
|
||||
|
||||
try {
|
||||
|
||||
// bail early if html mode
|
||||
if( this.$el.hasClass('tmce-active') ) {
|
||||
|
||||
switchEditors.go( this.o.id, 'tmce');
|
||||
|
||||
}
|
||||
|
||||
} catch(e) {}
|
||||
|
||||
},
|
||||
|
||||
get_toolbar : function( name ){
|
||||
|
||||
// bail early if toolbar doesn't exist
|
||||
if( typeof this.toolbars[ name ] !== 'undefined' ) {
|
||||
|
||||
return this.toolbars[ name ];
|
||||
|
||||
if( this.o.active ) {
|
||||
acf.tinymce.enable( this.o.id );
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* _buttonsInit
|
||||
*
|
||||
* This function will add the quicktags HTML to a WYSIWYG field. Normaly, this is added via quicktags on document ready,
|
||||
* however, there is no support for 'append'. Source: wp-includes/js/quicktags.js:245
|
||||
*
|
||||
* @type function
|
||||
* @date 1/08/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param ed (object) quicktag object
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
_buttonsInit: function( ed ) {
|
||||
var defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
|
||||
|
||||
canvas = ed.canvas;
|
||||
name = ed.name;
|
||||
settings = ed.settings;
|
||||
html = '';
|
||||
theButtons = {};
|
||||
use = '';
|
||||
|
||||
// set buttons
|
||||
if ( settings.buttons ) {
|
||||
use = ','+settings.buttons+',';
|
||||
}
|
||||
|
||||
for ( i in edButtons ) {
|
||||
if ( !edButtons[i] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
id = edButtons[i].id;
|
||||
if ( use && defaults.indexOf( ',' + id + ',' ) !== -1 && use.indexOf( ',' + id + ',' ) === -1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !edButtons[i].instance || edButtons[i].instance === inst ) {
|
||||
theButtons[id] = edButtons[i];
|
||||
|
||||
if ( edButtons[i].html ) {
|
||||
html += edButtons[i].html(name + '_');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( use && use.indexOf(',fullscreen,') !== -1 ) {
|
||||
theButtons.fullscreen = new qt.FullscreenButton();
|
||||
html += theButtons.fullscreen.html(name + '_');
|
||||
}
|
||||
|
||||
|
||||
if ( 'rtl' === document.getElementsByTagName('html')[0].dir ) {
|
||||
theButtons.textdirection = new qt.TextDirectionButton();
|
||||
html += theButtons.textdirection.html(name + '_');
|
||||
}
|
||||
|
||||
ed.toolbar.innerHTML = html;
|
||||
ed.theButtons = theButtons;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* wysiwyg_manager
|
||||
* acf.tinymce
|
||||
*
|
||||
* This model will handle validation of fields within a tab group
|
||||
* description
|
||||
*
|
||||
* @type function
|
||||
* @date 25/11/2015
|
||||
* @since 5.3.2
|
||||
* @date 18/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
var acf_content = acf.model.extend({
|
||||
acf.tinymce = acf.model.extend({
|
||||
|
||||
$div: null,
|
||||
toolbars: {},
|
||||
|
||||
actions: {
|
||||
'ready': 'ready'
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* ready
|
||||
*
|
||||
* This function will move the acf-hidden-wp-editor and fix the activeEditor
|
||||
*
|
||||
* @type function
|
||||
* @date 18/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
ready: function(){
|
||||
|
||||
// vars
|
||||
this.$div = $('#acf-hidden-wp-editor');
|
||||
var $div = $('#acf-hidden-wp-editor');
|
||||
|
||||
|
||||
// bail early if doesn't exist
|
||||
if( !this.$div.exists() ) return;
|
||||
if( !$div.exists() ) return;
|
||||
|
||||
|
||||
// move to footer
|
||||
this.$div.appendTo('body');
|
||||
$div.appendTo('body');
|
||||
|
||||
|
||||
// bail early if no tinymce
|
||||
|
|
@ -13655,9 +13397,370 @@ ed.on('ResizeEditor', function(e) {
|
|||
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* defaults
|
||||
*
|
||||
* This function will return default mce and qt settings
|
||||
*
|
||||
* @type function
|
||||
* @date 18/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
defaults: function(){
|
||||
|
||||
// bail early if no tinyMCEPreInit
|
||||
if( typeof tinyMCEPreInit === 'undefined' ) return false;
|
||||
|
||||
|
||||
// vars
|
||||
var defaults = {
|
||||
tinymce: tinyMCEPreInit.mceInit.acf_content,
|
||||
quicktags: tinyMCEPreInit.qtInit.acf_content
|
||||
};
|
||||
|
||||
|
||||
// return
|
||||
return defaults;
|
||||
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* initialize
|
||||
*
|
||||
* This function will initialize the tinymce and quicktags instances
|
||||
*
|
||||
* @type function
|
||||
* @date 18/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
initialize: function( id, args, $field ){
|
||||
|
||||
// defaults
|
||||
args = args || {};
|
||||
$field = $field || null;
|
||||
|
||||
|
||||
// merge
|
||||
args = acf.parse_args(args, {
|
||||
tinymce: true,
|
||||
quicktags: true,
|
||||
toolbar: 'full',
|
||||
mode: 'visual', // visual,text
|
||||
});
|
||||
|
||||
|
||||
// tinymce
|
||||
if( args.tinymce ) {
|
||||
this.initialize_tinymce( id, args, $field );
|
||||
}
|
||||
|
||||
|
||||
// quicktags
|
||||
if( args.quicktags ) {
|
||||
this.initialize_quicktags( id, args, $field );
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* initialize_tinymce
|
||||
*
|
||||
* This function will initialize the tinymce instance
|
||||
*
|
||||
* @type function
|
||||
* @date 18/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
initialize_tinymce: function( id, args, $field ){
|
||||
|
||||
// vars
|
||||
var $textarea = $('#'+id);
|
||||
var defaults = this.defaults();
|
||||
var toolbars = this.toolbars;
|
||||
|
||||
|
||||
// bail early
|
||||
if( typeof tinymce === 'undefined' ) return false;
|
||||
if( !defaults ) return false;
|
||||
|
||||
|
||||
// check if exists
|
||||
if( tinymce.get(id) ) {
|
||||
return this.enable( id );
|
||||
}
|
||||
|
||||
|
||||
// settings
|
||||
init = $.extend( {}, defaults.tinymce, args.tinymce );
|
||||
init.id = id;
|
||||
init.selector = '#' + id;
|
||||
|
||||
|
||||
// toolbar
|
||||
var toolbar = args.toolbar;
|
||||
if( toolbar && typeof toolbars[toolbar] !== 'undefined' ) {
|
||||
|
||||
for( var i = 1; i <= 4; i++ ) {
|
||||
init[ 'toolbar' + i ] = toolbars[toolbar][i] || '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// event
|
||||
init.setup = function( ed ){
|
||||
|
||||
ed.on('focus', function(e) {
|
||||
acf.validation.remove_error( $field );
|
||||
});
|
||||
|
||||
ed.on('change', function(e) {
|
||||
ed.save(); // save to textarea
|
||||
$textarea.trigger('change');
|
||||
});
|
||||
|
||||
$( ed.getWin() ).on('unload', function() {
|
||||
acf.tinymce.remove( id );
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
// disable wp_autoresize_on (no solution yet for fixed toolbar)
|
||||
init.wp_autoresize_on = false;
|
||||
|
||||
|
||||
// hook for 3rd party customization
|
||||
init = acf.apply_filters('wysiwyg_tinymce_settings', init, id, $field);
|
||||
|
||||
|
||||
// z-index fix
|
||||
if( acf.isset(tinymce,'ui','FloatPanel') ) {
|
||||
tinymce.ui.FloatPanel.zIndex = 900000;
|
||||
}
|
||||
|
||||
|
||||
// store settings
|
||||
tinyMCEPreInit.mceInit[ id ] = init;
|
||||
|
||||
|
||||
// visual tab is active
|
||||
if( args.mode == 'visual' ) {
|
||||
|
||||
// init
|
||||
tinymce.init( init );
|
||||
|
||||
|
||||
// get editor
|
||||
var ed = tinymce.get( id );
|
||||
|
||||
|
||||
// action
|
||||
acf.do_action('wysiwyg_tinymce_init', ed, ed.id, init, $field);
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* initialize_quicktags
|
||||
*
|
||||
* This function will initialize the quicktags instance
|
||||
*
|
||||
* @type function
|
||||
* @date 18/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
initialize_quicktags: function( id, args, $field ){
|
||||
|
||||
// vars
|
||||
var defaults = this.defaults();
|
||||
|
||||
|
||||
// bail early
|
||||
if( typeof quicktags === 'undefined' ) return false;
|
||||
if( !defaults ) return false;
|
||||
|
||||
|
||||
// settings
|
||||
init = $.extend( {}, defaults.quicktags, args.quicktags );
|
||||
init.id = id;
|
||||
|
||||
|
||||
// filter
|
||||
init = acf.apply_filters('wysiwyg_quicktags_settings', init, init.id, $field);
|
||||
|
||||
|
||||
// store settings
|
||||
tinyMCEPreInit.qtInit[ id ] = init;
|
||||
|
||||
|
||||
// init
|
||||
var ed = quicktags( init );
|
||||
|
||||
|
||||
// generate HTML
|
||||
this.build_quicktags( ed );
|
||||
|
||||
|
||||
// action for 3rd party customization
|
||||
acf.do_action('wysiwyg_quicktags_init', ed, ed.id, init, $field);
|
||||
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* build_quicktags
|
||||
*
|
||||
* This function will build the quicktags HTML
|
||||
*
|
||||
* @type function
|
||||
* @date 18/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
build_quicktags: function( ed ){
|
||||
|
||||
var canvas, name, settings, theButtons, html, ed, id, i, use,
|
||||
defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
|
||||
|
||||
canvas = ed.canvas;
|
||||
name = ed.name;
|
||||
settings = ed.settings;
|
||||
html = '';
|
||||
theButtons = {};
|
||||
use = '';
|
||||
|
||||
// set buttons
|
||||
if ( settings.buttons ) {
|
||||
use = ','+settings.buttons+',';
|
||||
}
|
||||
|
||||
for ( i in edButtons ) {
|
||||
if ( ! edButtons[i] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
id = edButtons[i].id;
|
||||
if ( use && defaults.indexOf( ',' + id + ',' ) !== -1 && use.indexOf( ',' + id + ',' ) === -1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! edButtons[i].instance || edButtons[i].instance === instanceId ) {
|
||||
theButtons[id] = edButtons[i];
|
||||
|
||||
if ( edButtons[i].html ) {
|
||||
html += edButtons[i].html( name + '_' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( use && use.indexOf(',dfw,') !== -1 ) {
|
||||
theButtons.dfw = new QTags.DFWButton();
|
||||
html += theButtons.dfw.html( name + '_' );
|
||||
}
|
||||
|
||||
if ( 'rtl' === document.getElementsByTagName( 'html' )[0].dir ) {
|
||||
theButtons.textdirection = new QTags.TextDirectionButton();
|
||||
html += theButtons.textdirection.html( name + '_' );
|
||||
}
|
||||
|
||||
ed.toolbar.innerHTML = html;
|
||||
ed.theButtons = theButtons;
|
||||
|
||||
if ( typeof jQuery !== 'undefined' ) {
|
||||
jQuery( document ).triggerHandler( 'quicktags-init', [ ed ] );
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
disable: function( id ){
|
||||
|
||||
this.destroy( id );
|
||||
|
||||
},
|
||||
|
||||
destroy: function( id ){
|
||||
|
||||
this.destroy_tinymce( id );
|
||||
|
||||
},
|
||||
|
||||
destroy_tinymce: function( id ){
|
||||
|
||||
// bail early
|
||||
if( typeof tinymce === 'undefined' ) return false;
|
||||
|
||||
|
||||
// get editor
|
||||
var ed = tinymce.get( id );
|
||||
|
||||
|
||||
// bail early if no editor
|
||||
if( !ed ) return false;
|
||||
|
||||
|
||||
// save
|
||||
ed.save();
|
||||
|
||||
|
||||
// destroy editor
|
||||
ed.destroy();
|
||||
|
||||
|
||||
// return
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
enable: function( id ){
|
||||
|
||||
this.enable_tinymce( id );
|
||||
|
||||
},
|
||||
|
||||
enable_tinymce: function( id ){
|
||||
|
||||
// bail early
|
||||
if( typeof switchEditors === 'undefined' ) return false;
|
||||
|
||||
|
||||
// toggle
|
||||
switchEditors.go( id, 'tmce');
|
||||
|
||||
|
||||
// return
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
|
@ -13676,6 +13779,7 @@ ed.on('ResizeEditor', function(e) {
|
|||
// @codekit-prepend "../js/acf-media.js";
|
||||
// @codekit-prepend "../js/acf-oembed.js";
|
||||
// @codekit-prepend "../js/acf-radio.js";
|
||||
// @codekit-prepend "../js/acf-range.js";
|
||||
// @codekit-prepend "../js/acf-relationship.js";
|
||||
// @codekit-prepend "../js/acf-select2.js";
|
||||
// @codekit-prepend "../js/acf-select.js";
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -133,7 +133,7 @@ $atts['class'] = str_replace('_', '-', $atts['class']);
|
|||
acf_render_field_wrap(array(
|
||||
'label' => __('Wrapper Attributes','acf'),
|
||||
'instructions' => '',
|
||||
'type' => 'text',
|
||||
'type' => 'number',
|
||||
'name' => 'width',
|
||||
'prefix' => $field['prefix'] . '[wrapper]',
|
||||
'value' => $field['wrapper']['width'],
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ if( $field_groups ) {
|
|||
|
||||
foreach( $field_groups as $field_group ) {
|
||||
|
||||
$field['choices'][ $field_group['key'] ] = $field_group['title'];
|
||||
$field['choices'][ $field_group['key'] ] = esc_html( $field_group['title'] );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function acf_is_field_group_key( $key = '' ) {
|
|||
if( is_numeric($key) ) return false;
|
||||
|
||||
|
||||
// look for 'field_' prefix
|
||||
// look for 'group_' prefix
|
||||
if( substr($key, 0, 6) === 'group_' ) return true;
|
||||
|
||||
|
||||
|
|
@ -52,8 +52,16 @@ function acf_is_field_group_key( $key = '' ) {
|
|||
|
||||
function acf_get_valid_field_group( $field_group = false ) {
|
||||
|
||||
// $field_group must be an array
|
||||
if( !is_array($field_group) ) $field_group = array();
|
||||
|
||||
|
||||
// bail ealry if already valid
|
||||
if( !empty($field_group['_valid']) ) return $field_group;
|
||||
|
||||
|
||||
// parse in defaults
|
||||
$field_group = wp_parse_args( $field_group, array(
|
||||
$field_group = wp_parse_args($field_group, array(
|
||||
'ID' => 0,
|
||||
'key' => '',
|
||||
'title' => '',
|
||||
|
|
@ -65,11 +73,16 @@ function acf_get_valid_field_group( $field_group = false ) {
|
|||
'label_placement' => 'top',
|
||||
'instruction_placement' => 'label',
|
||||
'hide_on_screen' => array(),
|
||||
'active' => 1, // Added in 5.2.9
|
||||
'description' => '' // Added in 5.2.9
|
||||
'active' => 1, // Added in 5.2.9
|
||||
'description' => '', // Added in 5.2.9
|
||||
'_valid' => 0, // Added in 5.6.2
|
||||
));
|
||||
|
||||
|
||||
// field is now valid
|
||||
$field_group['_valid'] = 1;
|
||||
|
||||
|
||||
// filter
|
||||
$field_group = apply_filters('acf/validate_field_group', $field_group);
|
||||
|
||||
|
|
@ -622,7 +635,8 @@ function acf_update_field_group( $field_group = array() ) {
|
|||
'title',
|
||||
'menu_order',
|
||||
'fields',
|
||||
'active'
|
||||
'active',
|
||||
'_valid'
|
||||
));
|
||||
|
||||
|
||||
|
|
@ -648,6 +662,11 @@ function acf_update_field_group( $field_group = array() ) {
|
|||
add_filter( 'wp_unique_post_slug', 'acf_update_field_group_wp_unique_post_slug', 100, 6 );
|
||||
|
||||
|
||||
// slash data
|
||||
// - WP expects all data to be slashed and will unslash it (fixes '\' character issues)
|
||||
$save = wp_slash( $save );
|
||||
|
||||
|
||||
// update the field group and update the ID
|
||||
if( $field_group['ID'] ) {
|
||||
|
||||
|
|
@ -1233,7 +1252,8 @@ function acf_prepare_field_group_for_export( $field_group ) {
|
|||
// extract some args
|
||||
$extract = acf_extract_vars($field_group, array(
|
||||
'ID',
|
||||
'local' // local may have added 'php' or 'json'
|
||||
'local', // local may have added 'php' or 'json'
|
||||
'_valid',
|
||||
));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1213,69 +1213,62 @@ function acf_update_field( $field = false, $specific = false ) {
|
|||
|
||||
// serialize for DB
|
||||
$data = maybe_serialize( $data );
|
||||
|
||||
|
||||
// save
|
||||
$save = array(
|
||||
'ID' => $extract['ID'],
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'acf-field',
|
||||
'post_title' => $extract['label'],
|
||||
'post_name' => $extract['key'],
|
||||
'post_excerpt' => $extract['name'],
|
||||
'post_content' => $data,
|
||||
'post_parent' => $extract['parent'],
|
||||
'menu_order' => $extract['menu_order'],
|
||||
);
|
||||
|
||||
|
||||
// $specific
|
||||
if( !empty($specific) ) {
|
||||
|
||||
// prepend ID
|
||||
array_unshift( $specific, 'ID' );
|
||||
|
||||
|
||||
// vars
|
||||
$_save = $save;
|
||||
|
||||
|
||||
// reset
|
||||
$save = array();
|
||||
|
||||
|
||||
// appen data
|
||||
foreach( $specific as $key ) {
|
||||
|
||||
$save[ $key ] = $_save[ $key ];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// allow fields to contain the same name
|
||||
|
||||
|
||||
// save
|
||||
$save = array(
|
||||
'ID' => $extract['ID'],
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'acf-field',
|
||||
'post_title' => $extract['label'],
|
||||
'post_name' => $extract['key'],
|
||||
'post_excerpt' => $extract['name'],
|
||||
'post_content' => $data,
|
||||
'post_parent' => $extract['parent'],
|
||||
'menu_order' => $extract['menu_order'],
|
||||
);
|
||||
|
||||
|
||||
// specific
|
||||
if( acf_is_array($specific) ) {
|
||||
|
||||
// append ID
|
||||
$specific[] = 'ID';
|
||||
|
||||
|
||||
// get sub array
|
||||
$save = acf_get_sub_array( $save, $specific );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// allow fields to contain the same name
|
||||
add_filter( 'wp_unique_post_slug', 'acf_update_field_wp_unique_post_slug', 100, 6 );
|
||||
|
||||
|
||||
// update the field and update the ID
|
||||
if( $field['ID'] ) {
|
||||
|
||||
wp_update_post( $save );
|
||||
|
||||
} else {
|
||||
|
||||
$field['ID'] = wp_insert_post( $save );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// clear cache
|
||||
acf_delete_cache("get_field/key={$field['key']}");
|
||||
// slash data
|
||||
// - WP expects all data to be slashed and will unslash it (fixes '\' character issues)
|
||||
$save = wp_slash( $save );
|
||||
|
||||
|
||||
// return
|
||||
return $field;
|
||||
// update the field and update the ID
|
||||
if( $field['ID'] ) {
|
||||
|
||||
wp_update_post( $save );
|
||||
|
||||
} else {
|
||||
|
||||
$field['ID'] = wp_insert_post( $save );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// clear cache
|
||||
acf_delete_cache("get_field/key={$field['key']}");
|
||||
|
||||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1944,4 +1937,36 @@ function acf_maybe_get_sub_field( $selectors, $post_id = false, $strict = true )
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_prefix_fields
|
||||
*
|
||||
* This funtion will safely change the prefix for an array of fields
|
||||
* Needed to allow clone field to continue working on nave menu item and widget forms
|
||||
*
|
||||
* @type function
|
||||
* @date 5/9/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function acf_prefix_fields( &$fields, $prefix = 'acf' ) {
|
||||
|
||||
// loop
|
||||
foreach( $fields as &$field ) {
|
||||
|
||||
// replace 'acf' with $prefix
|
||||
$field['prefix'] = substr_replace($field['prefix'], $prefix, 0, 3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $fields;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -2476,7 +2476,7 @@ function acf_decode_choices( $string = '', $array_keys = false ) {
|
|||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function acf_str_replace( $string, $search_replace ) {
|
||||
function acf_str_replace( $string = '', $search_replace = array() ) {
|
||||
|
||||
// vars
|
||||
$ignore = array();
|
||||
|
|
@ -3973,10 +3973,10 @@ function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
|
|||
|
||||
|
||||
// filter for 3rd party customization
|
||||
$errors = apply_filters("acf/validate_attachment", $errors, $file, $attachment, $field);
|
||||
$errors = apply_filters("acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field );
|
||||
$errors = apply_filters("acf/validate_attachment/name={$field['name']}", $errors, $file, $attachment, $field );
|
||||
$errors = apply_filters("acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field );
|
||||
$errors = apply_filters("acf/validate_attachment", $errors, $file, $attachment, $field, $context);
|
||||
$errors = apply_filters("acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field, $context );
|
||||
$errors = apply_filters("acf/validate_attachment/name={$field['name']}", $errors, $file, $attachment, $field, $context );
|
||||
$errors = apply_filters("acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field, $context );
|
||||
|
||||
|
||||
// return
|
||||
|
|
@ -5091,4 +5091,39 @@ function acf_decrypt( $data = '' ) {
|
|||
}
|
||||
|
||||
|
||||
?>
|
||||
/*
|
||||
* acf_get_post_templates
|
||||
*
|
||||
* This function will return an array of all post templates (including parent theme templates)
|
||||
*
|
||||
* @type function
|
||||
* @date 29/8/17
|
||||
* @since 5.6.2
|
||||
*
|
||||
* @param n/a
|
||||
* @return (array)
|
||||
*/
|
||||
|
||||
function acf_get_post_templates() {
|
||||
|
||||
// vars
|
||||
$post_types = acf_get_post_types();
|
||||
$post_templates = array();
|
||||
|
||||
|
||||
// loop
|
||||
foreach( $post_types as $post_type ) {
|
||||
$post_templates[ $post_type ] = wp_get_theme()->get_page_templates(null, $post_type);
|
||||
}
|
||||
|
||||
|
||||
// remove empty templates
|
||||
$post_templates = array_filter( $post_templates );
|
||||
|
||||
|
||||
// return
|
||||
return $post_templates;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -460,6 +460,46 @@ function acf_test_esc_html( $string = '' ) {
|
|||
*/
|
||||
|
||||
|
||||
/*
|
||||
* acf_get_file_input
|
||||
*
|
||||
* This function will return HTML for a file input
|
||||
*
|
||||
* @type function
|
||||
* @date 3/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $atts
|
||||
* @return (string)
|
||||
*/
|
||||
|
||||
function acf_get_file_input( $atts = array() ) {
|
||||
|
||||
$atts['type'] = 'file';
|
||||
return acf_get_text_input( $atts );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_file_input
|
||||
*
|
||||
* This function will output HTML for a file input
|
||||
*
|
||||
* @type function
|
||||
* @date 3/02/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $atts
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function acf_file_input( $atts = array() ) {
|
||||
|
||||
echo acf_get_file_input( $atts );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* acf_esc_attr
|
||||
|
|
|
|||
|
|
@ -65,9 +65,7 @@ class acf_field_file extends acf_field {
|
|||
|
||||
// enqueue
|
||||
if( $uploader == 'wp' ) {
|
||||
|
||||
acf_enqueue_uploader();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -108,55 +106,53 @@ class acf_field_file extends acf_field {
|
|||
|
||||
// url exists
|
||||
if( $o['url'] ) {
|
||||
|
||||
$div['class'] .= ' has-value';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div <?php acf_esc_attr_e($div); ?>>
|
||||
<div <?php acf_esc_attr_e( $div ); ?>>
|
||||
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id' )); ?>
|
||||
<div class="show-if-value file-wrap acf-soh">
|
||||
<div class="show-if-value file-wrap">
|
||||
<div class="file-icon">
|
||||
<img data-name="icon" src="<?php echo $o['icon']; ?>" alt=""/>
|
||||
<img data-name="icon" src="<?php echo esc_url($o['icon']); ?>" alt=""/>
|
||||
</div>
|
||||
<div class="file-info">
|
||||
<p>
|
||||
<strong data-name="title"><?php echo $o['title']; ?></strong>
|
||||
<strong data-name="title"><?php echo esc_html($o['title']); ?></strong>
|
||||
</p>
|
||||
<p>
|
||||
<strong><?php _e('File name', 'acf'); ?>:</strong>
|
||||
<a data-name="filename" href="<?php echo $o['url']; ?>" target="_blank"><?php echo $o['filename']; ?></a>
|
||||
<a data-name="filename" href="<?php echo esc_url($o['url']); ?>" target="_blank"><?php echo esc_html($o['filename']); ?></a>
|
||||
</p>
|
||||
<p>
|
||||
<strong><?php _e('File size', 'acf'); ?>:</strong>
|
||||
<span data-name="filesize"><?php echo $o['filesize']; ?></span>
|
||||
<span data-name="filesize"><?php echo esc_html($o['filesize']); ?></span>
|
||||
</p>
|
||||
|
||||
<ul class="acf-hl acf-soh-target">
|
||||
<?php if( $uploader != 'basic' ): ?>
|
||||
<li><a class="acf-icon -pencil dark" data-name="edit" href="#"></a></li>
|
||||
<?php endif; ?>
|
||||
<li><a class="acf-icon -cancel dark" data-name="remove" href="#"></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="acf-actions -hover">
|
||||
<?php
|
||||
if( $uploader != 'basic' ):
|
||||
?><a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a><?php
|
||||
endif;
|
||||
?><a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hide-if-value">
|
||||
<?php if( $uploader == 'basic' ): ?>
|
||||
|
||||
<?php if( $field['value'] && !is_numeric($field['value']) ): ?>
|
||||
<div class="acf-error-message"><p><?php echo $field['value']; ?></p></div>
|
||||
<div class="acf-error-message"><p><?php echo acf_esc_html($field['value']); ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<label class="acf-basic-uploader">
|
||||
<input type="file" name="<?php echo $field['name']; ?>" id="<?php echo $field['id']; ?>" />
|
||||
<?php acf_file_input(array( 'name' => $field['name'], 'id' => $field['id'] )); ?>
|
||||
</label>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<p style="margin:0;"><?php _e('No file selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add File','acf'); ?></a></p>
|
||||
<p><?php _e('No file selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add File','acf'); ?></a></p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -60,9 +60,7 @@ class acf_field_google_map extends acf_field {
|
|||
|
||||
// validate value
|
||||
if( empty($field['value']) ) {
|
||||
|
||||
$field['value'] = array();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,9 +76,7 @@ class acf_field_google_map extends acf_field {
|
|||
foreach( $this->default_values as $k => $v ) {
|
||||
|
||||
if( empty($field[ $k ]) ) {
|
||||
|
||||
$field[ $k ] = $v;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -98,34 +94,32 @@ class acf_field_google_map extends acf_field {
|
|||
|
||||
// has value
|
||||
if( $field['value']['address'] ) {
|
||||
|
||||
$atts['class'] .= ' -value';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<div <?php acf_esc_attr_e($atts); ?>>
|
||||
|
||||
<div class="acf-hidden">
|
||||
<?php foreach( $field['value'] as $k => $v ): ?>
|
||||
<input type="hidden" class="input-<?php echo $k; ?>" name="<?php echo esc_attr($field['name']); ?>[<?php echo $k; ?>]" value="<?php echo esc_attr( $v ); ?>" />
|
||||
<?php endforeach; ?>
|
||||
<?php foreach( $field['value'] as $k => $v ):
|
||||
acf_hidden_input(array( 'name' => $field['name'].'['.$k.']', 'value' => $v, 'class' => 'input-'.$k ));
|
||||
endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="title acf-soh">
|
||||
<div class="title">
|
||||
|
||||
<div class="actions acf-soh-target">
|
||||
<a href="#" data-name="search" class="acf-icon -search grey" title="<?php _e("Search", 'acf'); ?>"></a>
|
||||
<a href="#" data-name="clear" class="acf-icon -cancel grey" title="<?php _e("Clear location", 'acf'); ?>"></a>
|
||||
<a href="#" data-name="locate" class="acf-icon -location grey" title="<?php _e("Find current location", 'acf'); ?>"></a>
|
||||
<div class="acf-actions -hover">
|
||||
<a href="#" data-name="search" class="acf-icon -search grey" title="<?php _e("Search", 'acf'); ?>"></a><?php
|
||||
?><a href="#" data-name="clear" class="acf-icon -cancel grey" title="<?php _e("Clear location", 'acf'); ?>"></a><?php
|
||||
?><a href="#" data-name="locate" class="acf-icon -location grey" title="<?php _e("Find current location", 'acf'); ?>"></a>
|
||||
</div>
|
||||
|
||||
<input class="search" type="text" placeholder="<?php _e("Search for address...",'acf'); ?>" value="<?php echo $field['value']['address']; ?>" />
|
||||
<input class="search" type="text" placeholder="<?php _e("Search for address...",'acf'); ?>" value="<?php echo esc_attr($field['value']['address']); ?>" />
|
||||
<i class="acf-loading"></i>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="canvas" style="height: <?php echo $field['height']; ?>px"></div>
|
||||
<div class="canvas" style="<?php echo esc_attr('height: '.$field['height'].'px'); ?>"></div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class acf_field__group extends acf_field {
|
|||
|
||||
|
||||
// loop
|
||||
foreach( $field['sub_fields'] as &$sub_field ) {
|
||||
foreach( $field['sub_fields'] as $sub_field ) {
|
||||
|
||||
// load
|
||||
$value[ $sub_field['key'] ] = acf_get_value( $post_id, $sub_field );
|
||||
|
|
@ -196,7 +196,7 @@ class acf_field__group extends acf_field {
|
|||
|
||||
|
||||
// loop
|
||||
foreach( $field['sub_fields'] as &$sub_field ) {
|
||||
foreach( $field['sub_fields'] as $sub_field ) {
|
||||
|
||||
// vars
|
||||
$v = false;
|
||||
|
|
|
|||
|
|
@ -72,9 +72,7 @@ class acf_field_image extends acf_field {
|
|||
|
||||
// enqueue
|
||||
if( $uploader == 'wp' ) {
|
||||
|
||||
acf_enqueue_uploader();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -104,9 +102,7 @@ class acf_field_image extends acf_field {
|
|||
|
||||
// url exists
|
||||
if( $url ) {
|
||||
|
||||
$div['class'] .= ' has-value';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -118,29 +114,30 @@ class acf_field_image extends acf_field {
|
|||
?>
|
||||
<div <?php acf_esc_attr_e( $div ); ?>>
|
||||
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'] )); ?>
|
||||
<div class="view show-if-value acf-soh" <?php if( $size['width'] ) echo 'style="max-width: '.$size['width'].'px"'; ?>>
|
||||
<img data-name="image" src="<?php echo $url; ?>" alt="<?php echo $alt; ?>"/>
|
||||
<ul class="acf-hl acf-soh-target">
|
||||
<?php if( $uploader != 'basic' ): ?>
|
||||
<li><a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a></li>
|
||||
<?php endif; ?>
|
||||
<li><a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a></li>
|
||||
</ul>
|
||||
<div class="show-if-value image-wrap" <?php if( $size['width'] ): ?>style="<?php echo esc_attr('max-width: '.$size['width'].'px'); ?>"<?php endif; ?>>
|
||||
<img data-name="image" src="<?php echo esc_url($url); ?>" alt="<?php echo esc_attr($alt); ?>"/>
|
||||
<div class="acf-actions -hover">
|
||||
<?php
|
||||
if( $uploader != 'basic' ):
|
||||
?><a class="acf-icon -pencil dark" data-name="edit" href="#" title="<?php _e('Edit', 'acf'); ?>"></a><?php
|
||||
endif;
|
||||
?><a class="acf-icon -cancel dark" data-name="remove" href="#" title="<?php _e('Remove', 'acf'); ?>"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="view hide-if-value">
|
||||
<div class="hide-if-value">
|
||||
<?php if( $uploader == 'basic' ): ?>
|
||||
|
||||
<?php if( $field['value'] && !is_numeric($field['value']) ): ?>
|
||||
<div class="acf-error-message"><p><?php echo $field['value']; ?></p></div>
|
||||
<div class="acf-error-message"><p><?php echo acf_esc_html($field['value']); ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<label class="acf-basic-uploader">
|
||||
<input type="file" name="<?php echo $field['name']; ?>" id="<?php echo $field['id']; ?>" />
|
||||
<?php acf_file_input(array( 'name' => $field['name'], 'id' => $field['id'] )); ?>
|
||||
</label>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<p style="margin:0;"><?php _e('No image selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add Image','acf'); ?></a></p>
|
||||
<p><?php _e('No image selected','acf'); ?> <a data-name="add" class="acf-button button" href="#"><?php _e('Add Image','acf'); ?></a></p>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -208,21 +208,20 @@ class acf_field_oembed extends acf_field {
|
|||
|
||||
?>
|
||||
<div <?php acf_esc_attr_e($atts) ?>>
|
||||
<div class="acf-hidden">
|
||||
<input type="hidden" data-name="value-input" name="<?php echo esc_attr($field['name']); ?>" value="<?php echo esc_attr($field['value']); ?>" />
|
||||
</div>
|
||||
<div class="title acf-soh">
|
||||
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'value-input' )); ?>
|
||||
<div class="title">
|
||||
|
||||
<div class="title-value">
|
||||
<h4 data-name="value-title"><?php echo $field['value']; ?></h4>
|
||||
<h4 data-name="value-title"><?php echo esc_html( $field['value'] ); ?></h4>
|
||||
</div>
|
||||
|
||||
<div class="title-search">
|
||||
|
||||
<input data-name="search-input" type="text" placeholder="<?php _e("Enter URL", 'acf'); ?>" autocomplete="off" />
|
||||
</div>
|
||||
|
||||
<a data-name="clear-button" href="#" class="acf-icon -cancel grey acf-soh-target"></a>
|
||||
<div class="acf-actions -hover">
|
||||
<a data-name="clear-button" href="#" class="acf-icon -cancel grey"></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="canvas">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,206 @@
|
|||
<?php
|
||||
|
||||
if( ! class_exists('acf_field_range') ) :
|
||||
|
||||
class acf_field_range extends acf_field_number {
|
||||
|
||||
|
||||
/*
|
||||
* initialize
|
||||
*
|
||||
* This function will setup the field type data
|
||||
*
|
||||
* @type function
|
||||
* @date 5/03/2014
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param n/a
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
function initialize() {
|
||||
|
||||
// vars
|
||||
$this->name = 'range';
|
||||
$this->label = __("Range",'acf');
|
||||
$this->defaults = array(
|
||||
'default_value' => '',
|
||||
'min' => '',
|
||||
'max' => '',
|
||||
'step' => '',
|
||||
'prepend' => '',
|
||||
'append' => ''
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field()
|
||||
*
|
||||
* Create the HTML interface for your field
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*/
|
||||
|
||||
function render_field( $field ) {
|
||||
|
||||
// vars
|
||||
$atts = array();
|
||||
$keys = array( 'type', 'id', 'class', 'name', 'value', 'min', 'max', 'step' );
|
||||
$keys2 = array( 'readonly', 'disabled' );
|
||||
$html = '';
|
||||
|
||||
|
||||
// step
|
||||
if( !$field['step'] ) $field['step'] = 1;
|
||||
|
||||
|
||||
// min / max
|
||||
if( !$field['min'] ) $field['min'] = 0;
|
||||
if( !$field['max'] ) $field['max'] = 100;
|
||||
|
||||
|
||||
// value
|
||||
if( !is_numeric($field['value']) ) {
|
||||
$field['value'] = 0;
|
||||
}
|
||||
|
||||
|
||||
// atts
|
||||
foreach( $keys as $k ) {
|
||||
if( isset($field[ $k ]) ) $atts[ $k ] = $field[ $k ];
|
||||
}
|
||||
|
||||
|
||||
// atts2
|
||||
foreach( $keys2 as $k ) {
|
||||
if( !empty($field[ $k ]) ) $atts[ $k ] = $k;
|
||||
}
|
||||
|
||||
|
||||
// open
|
||||
$html .= '<div class="acf-range-wrap">';
|
||||
|
||||
|
||||
// prepend
|
||||
if( $field['prepend'] !== '' ) {
|
||||
$html .= '<div class="acf-prepend">' . acf_esc_html($field['prepend']) . '</div>';
|
||||
}
|
||||
|
||||
|
||||
// range
|
||||
$html .= acf_get_text_input( $atts );
|
||||
|
||||
|
||||
// input
|
||||
$html .= acf_get_text_input(array(
|
||||
'type' => 'number',
|
||||
'id' => $atts['id'] . '-alt',
|
||||
'value' => $atts['value']
|
||||
));
|
||||
|
||||
|
||||
// append
|
||||
if( $field['append'] !== '' ) {
|
||||
$html .= '<div class="acf-append">' . acf_esc_html($field['append']) . '</div>';
|
||||
}
|
||||
|
||||
|
||||
// close
|
||||
$html .= '</div>';
|
||||
|
||||
|
||||
// return
|
||||
echo $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* render_field_settings()
|
||||
*
|
||||
* Create extra options for your field. This is rendered when editing a field.
|
||||
* The value of $field['name'] can be used (like bellow) to save extra data to the $field
|
||||
*
|
||||
* @type action
|
||||
* @since 3.6
|
||||
* @date 23/01/13
|
||||
*
|
||||
* @param $field - an array holding all the field's data
|
||||
*/
|
||||
|
||||
function render_field_settings( $field ) {
|
||||
|
||||
// default_value
|
||||
acf_render_field_setting( $field, array(
|
||||
'label' => __('Default Value','acf'),
|
||||
'instructions' => __('Appears when creating a new post','acf'),
|
||||
'type' => 'number',
|
||||
'name' => 'default_value',
|
||||
));
|
||||
|
||||
|
||||
// min
|
||||
acf_render_field_setting( $field, array(
|
||||
'label' => __('Minimum Value','acf'),
|
||||
'instructions' => '',
|
||||
'type' => 'number',
|
||||
'name' => 'min',
|
||||
'placeholder' => '0'
|
||||
));
|
||||
|
||||
|
||||
// max
|
||||
acf_render_field_setting( $field, array(
|
||||
'label' => __('Maximum Value','acf'),
|
||||
'instructions' => '',
|
||||
'type' => 'number',
|
||||
'name' => 'max',
|
||||
'placeholder' => '100'
|
||||
));
|
||||
|
||||
|
||||
// step
|
||||
acf_render_field_setting( $field, array(
|
||||
'label' => __('Step Size','acf'),
|
||||
'instructions' => '',
|
||||
'type' => 'number',
|
||||
'name' => 'step',
|
||||
'placeholder' => '1'
|
||||
));
|
||||
|
||||
|
||||
// prepend
|
||||
acf_render_field_setting( $field, array(
|
||||
'label' => __('Prepend','acf'),
|
||||
'instructions' => __('Appears before the input','acf'),
|
||||
'type' => 'text',
|
||||
'name' => 'prepend',
|
||||
));
|
||||
|
||||
|
||||
// append
|
||||
acf_render_field_setting( $field, array(
|
||||
'label' => __('Append','acf'),
|
||||
'instructions' => __('Appears after the input','acf'),
|
||||
'type' => 'text',
|
||||
'name' => 'append',
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( 'acf_field_range' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
?>
|
||||
|
|
@ -566,7 +566,7 @@ class acf_field_taxonomy extends acf_field {
|
|||
|
||||
// vars
|
||||
$div = array(
|
||||
'class' => 'acf-taxonomy-field acf-soh',
|
||||
'class' => 'acf-taxonomy-field',
|
||||
'data-save' => $field['save_terms'],
|
||||
'data-type' => $field['field_type'],
|
||||
'data-taxonomy' => $field['taxonomy']
|
||||
|
|
@ -579,7 +579,9 @@ class acf_field_taxonomy extends acf_field {
|
|||
?>
|
||||
<div <?php acf_esc_attr_e($div); ?>>
|
||||
<?php if( $field['add_term'] && current_user_can( $taxonomy->cap->manage_terms) ): ?>
|
||||
<a href="#" class="acf-icon -plus acf-js-tooltip small acf-soh-target" data-name="add" title="<?php echo esc_attr($taxonomy->labels->add_new_item); ?>"></a>
|
||||
<div class="acf-actions -hover">
|
||||
<a href="#" class="acf-icon -plus acf-js-tooltip small" data-name="add" title="<?php echo esc_attr($taxonomy->labels->add_new_item); ?>"></a>
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
if( $field['field_type'] == 'select' ) {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ class acf_field_wysiwyg extends acf_field {
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if( acf ) acf.fields.wysiwyg.toolbars = <?php echo json_encode($json); ?>;
|
||||
if( acf ) acf.tinymce.toolbars = <?php echo json_encode($json); ?>;
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
|
|
|||
|
|
@ -133,9 +133,10 @@ class acf_form_customizer {
|
|||
|
||||
|
||||
/*
|
||||
* get_customizer_widgets
|
||||
* settings
|
||||
*
|
||||
* This function will return an array of widget settings
|
||||
* This function will return an array of cutomizer settings that include ACF data
|
||||
* similar to `$customizer->settings();`
|
||||
*
|
||||
* @type function
|
||||
* @date 22/03/2016
|
||||
|
|
@ -145,10 +146,10 @@ class acf_form_customizer {
|
|||
* @return $value (mixed)
|
||||
*/
|
||||
|
||||
function get_customizer_widgets( $customizer ) {
|
||||
function settings( $customizer ) {
|
||||
|
||||
// vars
|
||||
$widgets = array();
|
||||
$data = array();
|
||||
$settings = $customizer->settings();
|
||||
|
||||
|
||||
|
|
@ -157,36 +158,44 @@ class acf_form_customizer {
|
|||
|
||||
|
||||
// loop over settings
|
||||
foreach( array_keys($settings) as $i ) {
|
||||
foreach( $settings as $setting ) {
|
||||
|
||||
// vars
|
||||
$setting = $settings[ $i ];
|
||||
$id = $setting->id;
|
||||
|
||||
|
||||
// bail ealry if not widget
|
||||
if( substr($setting->id, 0, 7) !== 'widget_' ) continue;
|
||||
// verify settings type
|
||||
if( substr($id, 0, 6) == 'widget' || substr($id, 0, 7) == 'nav_menu' ) {
|
||||
// allow
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// get value
|
||||
$value = $setting->post_value();
|
||||
|
||||
|
||||
// bail early if no acf
|
||||
if( !is_array($value) || !isset($value['acf']) ) continue;
|
||||
|
||||
|
||||
// set data
|
||||
$setting->acf = acf_maybe_get($value, 'acf');
|
||||
$setting->acf = $value['acf'];
|
||||
|
||||
|
||||
// append
|
||||
$widgets[] = $setting;
|
||||
$data[] = $setting;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// bail ealry if no preview values
|
||||
if( empty($widgets) ) return false;
|
||||
// bail ealry if no settings
|
||||
if( empty($data) ) return false;
|
||||
|
||||
|
||||
// return
|
||||
return $widgets;
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +216,7 @@ class acf_form_customizer {
|
|||
function customize_preview_init( $customizer ) {
|
||||
|
||||
// get customizer settings (widgets)
|
||||
$settings = $customizer->settings();
|
||||
$settings = $this->settings( $customizer );
|
||||
|
||||
|
||||
// bail ealry if no settings
|
||||
|
|
@ -217,17 +226,13 @@ class acf_form_customizer {
|
|||
// append values
|
||||
foreach( $settings as $setting ) {
|
||||
|
||||
// get $_POST value
|
||||
$value = $setting->post_value();
|
||||
|
||||
|
||||
// bail early if no acf
|
||||
if( !isset($value['acf']) ) continue;
|
||||
// get acf data
|
||||
$data = $setting->acf;
|
||||
|
||||
|
||||
// append acf_value to preview_values
|
||||
$this->preview_values[ $value['acf']['post_id'] ] = $value['acf']['values'];
|
||||
$this->preview_fields[ $value['acf']['post_id'] ] = $value['acf']['fields'];
|
||||
$this->preview_values[ $data['post_id'] ] = $data['values'];
|
||||
$this->preview_fields[ $data['post_id'] ] = $data['fields'];
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -298,7 +303,7 @@ class acf_form_customizer {
|
|||
function customize_save( $customizer ) {
|
||||
|
||||
// get customizer settings (widgets)
|
||||
$settings = $customizer->settings();
|
||||
$settings = $this->settings( $customizer );
|
||||
|
||||
|
||||
// bail ealry if no settings
|
||||
|
|
@ -308,16 +313,12 @@ class acf_form_customizer {
|
|||
// append values
|
||||
foreach( $settings as $setting ) {
|
||||
|
||||
// get $_POST value
|
||||
$value = $setting->post_value();
|
||||
|
||||
|
||||
// bail early if no acf
|
||||
if( !isset($value['acf']) ) continue;
|
||||
// get acf data
|
||||
$data = $setting->acf;
|
||||
|
||||
|
||||
// save acf data
|
||||
acf_save_post( $value['acf']['post_id'], $value['acf']['values'] );
|
||||
acf_save_post( $data['post_id'], $data['values'] );
|
||||
|
||||
|
||||
// remove [acf] data from saved widget array
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ class acf_form_front {
|
|||
}
|
||||
|
||||
|
||||
// save
|
||||
if( $save['ID'] ) {
|
||||
|
||||
wp_update_post( $save );
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class acf_form_nav_menu {
|
|||
|
||||
|
||||
// set var
|
||||
$acf_menu = $menu_id;
|
||||
$acf_menu = (int) $menu_id;
|
||||
|
||||
|
||||
// include walker
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class acf_form_widget {
|
|||
|
||||
|
||||
// change prefix
|
||||
foreach( $fields as &$field ) $field['prefix'] = $prefix;
|
||||
acf_prefix_fields( $fields, $prefix );
|
||||
|
||||
|
||||
// render
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class acf_location_nav_menu extends acf_location {
|
|||
|
||||
|
||||
// if location matches, update value
|
||||
if( $menu_locations[$location] === $nav_menu ) {
|
||||
if( $menu_locations[$location] == $nav_menu ) {
|
||||
|
||||
$nav_menu = $rule['value'];
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class acf_location_post_template extends acf_location {
|
|||
// get templates (WP 4.7)
|
||||
if( acf_version_compare('wp', '>=', '4.7') ) {
|
||||
|
||||
$templates = wp_get_theme()->get_post_templates();
|
||||
$templates = acf_get_post_templates();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ class acf_location_post_template extends acf_location {
|
|||
// get templates (WP 4.7)
|
||||
if( acf_version_compare('wp', '>=', '4.7') ) {
|
||||
|
||||
$templates = wp_get_theme()->get_post_templates();
|
||||
$templates = acf_get_post_templates();
|
||||
$choices = array_merge($choices, $templates);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ if( ! class_exists('acf_updates') ) :
|
|||
class acf_updates {
|
||||
|
||||
// vars
|
||||
var $version = '2.0',
|
||||
var $version = '2.1',
|
||||
$plugins = array(),
|
||||
$updates = false,
|
||||
$dev = 0;
|
||||
|
|
@ -193,6 +193,12 @@ class acf_updates {
|
|||
$response = $this->request('v2/plugins/get-info?p='.$id);
|
||||
|
||||
|
||||
// ensure response is expected JSON array (not string)
|
||||
if( is_string($response) ) {
|
||||
$response = new WP_Error( 'server_error', esc_html($response) );
|
||||
}
|
||||
|
||||
|
||||
// update transient
|
||||
set_transient($transient_name, $response, HOUR_IN_SECONDS );
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class ACF_Walker_Nav_Menu_Edit extends Walker_Nav_Menu_Edit {
|
|||
|
||||
|
||||
// change prefix
|
||||
foreach( $fields as &$field ) $field['prefix'] = $prefix;
|
||||
acf_prefix_fields( $fields, $prefix );
|
||||
|
||||
|
||||
// render
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ class acf_wpml_compatibility {
|
|||
add_action('acf/input/form_data', array($this, 'acf_input_form_data'), 10, 1);
|
||||
|
||||
|
||||
// always prevent 'acf-field' from being translated
|
||||
add_filter('get_translatable_documents', array($this, 'get_translatable_documents'));
|
||||
|
||||
|
||||
// bail early if not transaltable
|
||||
if( !$this->is_translatable() ) return;
|
||||
|
||||
|
|
@ -73,26 +77,31 @@ class acf_wpml_compatibility {
|
|||
function is_translatable() {
|
||||
|
||||
// global
|
||||
global $sitepress, $sitepress_settings;
|
||||
global $sitepress;
|
||||
|
||||
|
||||
// vars
|
||||
$post_types = acf_maybe_get($sitepress_settings, 'custom_posts_sync_option', array());
|
||||
$post_types = $sitepress->get_setting('custom_posts_sync_option');
|
||||
|
||||
|
||||
// bail early if no post types
|
||||
if( !acf_is_array($post_types) ) return false;
|
||||
|
||||
|
||||
// always prevent 'acf-field' from being translated
|
||||
$post_types['acf-field'] = 0;
|
||||
$sitepress->set_setting('custom_posts_sync_option', $post_types);
|
||||
|
||||
|
||||
// return true if acf-field-group is translatable
|
||||
if( !empty($post_types['acf-field-group']) ) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return true if acf is translatable, and acf-field-group does not yet exist
|
||||
if( !empty($post_types['acf']) && !isset($post_types['acf-field-group']) ) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -118,12 +127,15 @@ class acf_wpml_compatibility {
|
|||
function update_500() {
|
||||
|
||||
// global
|
||||
global $sitepress, $sitepress_settings;
|
||||
global $sitepress;
|
||||
|
||||
|
||||
// vars
|
||||
$icl_settings = array();
|
||||
$post_types = $sitepress_settings['custom_posts_sync_option'];
|
||||
$post_types = $sitepress->get_setting('custom_posts_sync_option');
|
||||
|
||||
|
||||
// bail early if no post types
|
||||
if( !acf_is_array($post_types) ) return false;
|
||||
|
||||
|
||||
// post type has changed from 'acf' to 'acf-field-group'
|
||||
|
|
@ -134,12 +146,8 @@ class acf_wpml_compatibility {
|
|||
}
|
||||
|
||||
|
||||
// add to icl settings
|
||||
$icl_settings['custom_posts_sync_option'] = $post_types;
|
||||
|
||||
|
||||
// save
|
||||
$sitepress->save_settings( $icl_settings );
|
||||
// update
|
||||
$sitepress->set_setting('custom_posts_sync_option', $post_types);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +168,7 @@ class acf_wpml_compatibility {
|
|||
function update_500_field_group($field_group, $ofg) {
|
||||
|
||||
// global
|
||||
global $wpdb, $sitepress;
|
||||
global $wpdb;
|
||||
|
||||
|
||||
// get translation rows (old acf4 and new acf5)
|
||||
|
|
@ -473,6 +481,31 @@ class acf_wpml_compatibility {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* get_translatable_documents
|
||||
*
|
||||
* This filter will remove 'acf-field' from the available post types for translation
|
||||
*
|
||||
* @type function
|
||||
* @date 17/8/17
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
*/
|
||||
|
||||
function get_translatable_documents( $icl_post_types ) {
|
||||
|
||||
// unset
|
||||
unset( $icl_post_types['acf-field'] );
|
||||
|
||||
|
||||
// return
|
||||
return $icl_post_types;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new acf_wpml_compatibility();
|
||||
|
|
|
|||
Binary file not shown.
1247
lang/acf-fr_FR.po
1247
lang/acf-fr_FR.po
File diff suppressed because it is too large
Load Diff
Binary file not shown.
1206
lang/acf-it_IT.po
1206
lang/acf-it_IT.po
File diff suppressed because it is too large
Load Diff
Binary file not shown.
3155
lang/acf-ro_RO.po
3155
lang/acf-ro_RO.po
File diff suppressed because it is too large
Load Diff
Binary file not shown.
1260
lang/acf-ru_RU.po
1260
lang/acf-ru_RU.po
File diff suppressed because it is too large
Load Diff
Binary file not shown.
4178
lang/acf-tr_TR.po
4178
lang/acf-tr_TR.po
File diff suppressed because it is too large
Load Diff
|
|
@ -75,7 +75,7 @@ class acf_admin_settings_updates {
|
|||
// error object
|
||||
if( is_wp_error($error) ) {
|
||||
|
||||
$error = __('<b>Error</b>. Could not connect to update server', 'acf') . ' <span class="description">(' . $error->get_error_message() . ')</span>';
|
||||
$error = __('<b>Error</b>. Could not connect to update server', 'acf') . ' <span class="description">(' . esc_html( $error->get_error_message() ) . ')</span>';
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ class acf_admin_settings_updates {
|
|||
// is relevant?
|
||||
if( version_compare($h4, $version, '==') ) {
|
||||
|
||||
return '<h4>' . $version . '</h4>' . $text;
|
||||
return '<h4>' . esc_html($version) . '</h4>' . acf_esc_html($text);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -283,6 +283,12 @@ class acf_admin_settings_updates {
|
|||
$response = acf_updates()->request('v2/plugins/activate?p=pro', $post);
|
||||
|
||||
|
||||
// ensure response is expected JSON array (not string)
|
||||
if( is_string($response) ) {
|
||||
$response = new WP_Error( 'server_error', esc_html($response) );
|
||||
}
|
||||
|
||||
|
||||
// error
|
||||
if( is_wp_error($response) ) {
|
||||
|
||||
|
|
@ -345,6 +351,12 @@ class acf_admin_settings_updates {
|
|||
$response = acf_updates()->request('v2/plugins/deactivate?p=pro', $post);
|
||||
|
||||
|
||||
// ensure response is expected JSON array (not string)
|
||||
if( is_string($response) ) {
|
||||
$response = new WP_Error( 'server_error', esc_html($response) );
|
||||
}
|
||||
|
||||
|
||||
// error
|
||||
if( is_wp_error($response) ) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
<?php
|
||||
|
||||
// extract
|
||||
extract($args);
|
||||
|
||||
|
||||
// vars
|
||||
$active = $license ? true : false;
|
||||
$nonce = $active ? 'deactivate_pro_licence' : 'activate_pro_licence';
|
||||
|
|
@ -72,7 +68,7 @@ $readonly = $active ? 1 : 0;
|
|||
<label><?php _e('Current Version', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo $current_version; ?>
|
||||
<?php echo esc_html( $current_version ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -80,7 +76,7 @@ $readonly = $active ? 1 : 0;
|
|||
<label><?php _e('Latest Version', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo $remote_version; ?>
|
||||
<?php echo esc_html( $remote_version ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -111,7 +107,7 @@ $readonly = $active ? 1 : 0;
|
|||
<label><?php _e('Changelog', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo $changelog; ?>
|
||||
<?php echo acf_esc_html( $changelog ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
|
@ -121,7 +117,7 @@ $readonly = $active ? 1 : 0;
|
|||
<label><?php _e('Upgrade Notice', 'acf'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo $upgrade_notice; ?>
|
||||
<?php echo acf_esc_html( $upgrade_notice ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ body.browser-msie .acf-repeater .acf-row-handle .acf-icon.-minus {
|
|||
padding: 7px 0;
|
||||
position: absolute;
|
||||
font-size: 13px;
|
||||
z-index: 9999;
|
||||
z-index: 900000;
|
||||
min-width: 135px;
|
||||
/* tip */
|
||||
/* positions */
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
// vars
|
||||
this.$el = this.$field.find('.acf-repeater:first');
|
||||
this.$input = this.$field.find('input:first');
|
||||
this.$table = this.$field.find('table:first');
|
||||
this.$input = this.$el.children('input');
|
||||
this.$table = this.$el.children('table');
|
||||
this.$tbody = this.$table.children('tbody');
|
||||
this.$clone = this.$tbody.children('tr.acf-clone');
|
||||
|
||||
|
|
@ -74,6 +74,10 @@
|
|||
|
||||
render: function(){
|
||||
|
||||
// vars
|
||||
var $button = this.$el.find('> .acf-actions .button');
|
||||
|
||||
|
||||
// update order numbers
|
||||
this.$tbody.children().each(function(i){
|
||||
|
||||
|
|
@ -97,11 +101,11 @@
|
|||
// row limit reached
|
||||
if( this.o.max > 0 && this.count() >= this.o.max ) {
|
||||
|
||||
this.$el.find('> .acf-actions .button').addClass('disabled');
|
||||
$button.addClass('disabled');
|
||||
|
||||
} else {
|
||||
|
||||
this.$el.find('> .acf-actions .button').removeClass('disabled');
|
||||
$button.removeClass('disabled');
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -446,6 +450,7 @@
|
|||
|
||||
// vars
|
||||
var self = this;
|
||||
var $button = this.$el.find('> .acf-actions .button');
|
||||
|
||||
|
||||
// update order numbers
|
||||
|
|
@ -471,11 +476,11 @@
|
|||
// row limit reached
|
||||
if( this.o.max > 0 && this.count() >= this.o.max ) {
|
||||
|
||||
this.$el.find('> .acf-actions .button').addClass('disabled');
|
||||
$button.addClass('disabled');
|
||||
|
||||
} else {
|
||||
|
||||
this.$el.find('> .acf-actions .button').removeClass('disabled');
|
||||
$button.removeClass('disabled');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -291,29 +291,11 @@ class acf_field_clone extends acf_field {
|
|||
// - only used for parent seamless fields. Block or sub field's prefix will be overriden which also works
|
||||
$field['prefix'] = $clone_field['prefix'] . '[' . $clone_field['key'] . ']';
|
||||
|
||||
|
||||
/*
|
||||
// old (removed)
|
||||
// a seamless clone field replaces itself with it's sub fields. Because of this, the clone field doesn't exist during the 'update_value' function
|
||||
// - because of this, the field prefix does not need to reference all clone fields, only the last one that exists (this one)
|
||||
// modify prefix allowing clone field to save sub fields
|
||||
// - only used for parent seamless fields. Block or sub field's prefix will be overriden which also works
|
||||
// - allways add prefix to beginning (allows cloned clone fields to work correctly - seamless)
|
||||
|
||||
$pos = strpos($field['prefix'], '[');
|
||||
$new = '[' . $clone_field['key'] . ']';
|
||||
|
||||
// modify parent
|
||||
$field['parent'] = $clone_field['parent'];
|
||||
|
||||
// inject
|
||||
if( $pos !== false ) {
|
||||
$field['prefix'] = substr_replace($field['prefix'], $new, $pos, 0);
|
||||
// append
|
||||
} else {
|
||||
$field['prefix'] .= $new;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// label_format
|
||||
if( $clone_field['prefix_label'] ) {
|
||||
|
||||
|
|
@ -351,11 +333,13 @@ class acf_field_clone extends acf_field {
|
|||
|
||||
// type specific
|
||||
// note: seamless clone fields will not be triggered
|
||||
/*
|
||||
if( $field['type'] == 'clone' ) {
|
||||
|
||||
$field = $this->acf_clone_clone_field( $field, $clone_field );
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// return
|
||||
|
|
@ -386,8 +370,8 @@ class acf_field_clone extends acf_field {
|
|||
// - commented out. This may not be neccessary due to new line 315
|
||||
if( $field['prefix_name'] ) {
|
||||
|
||||
$clone_field['name'] = $field['_name'];
|
||||
$clone_field['_name'] = $field['_name'];
|
||||
//$field['name'] = $clone_field['_name'];
|
||||
//$field['_name'] = $clone_field['_name'];
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -400,7 +384,7 @@ class acf_field_clone extends acf_field {
|
|||
foreach( $field['sub_fields'] as &$sub_field ) {
|
||||
|
||||
// clone
|
||||
$sub_field = acf_clone_field( $sub_field, $clone_field );
|
||||
$sub_field = acf_clone_field( $sub_field, $field );
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -457,7 +441,6 @@ class acf_field_clone extends acf_field {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
return $field;
|
||||
|
||||
|
|
@ -1272,11 +1255,13 @@ class acf_field_clone extends acf_field {
|
|||
function acf_prepare_field( $field ) {
|
||||
|
||||
// bail ealry if not cloned
|
||||
if( empty($field['__key']) ) return $field;
|
||||
if( empty($field['_clone']) ) return $field;
|
||||
|
||||
|
||||
// restore
|
||||
$field['key'] = $field['__key'];
|
||||
// restore key
|
||||
if( isset($field['__key']) ) {
|
||||
$field['key'] = $field['__key'];
|
||||
}
|
||||
|
||||
|
||||
// return
|
||||
|
|
|
|||
|
|
@ -305,11 +305,9 @@ class acf_field_flexible_content extends acf_field {
|
|||
endif; ?>
|
||||
</div>
|
||||
|
||||
<ul class="acf-actions acf-hl">
|
||||
<li>
|
||||
<a class="acf-button button button-primary" href="#" data-name="add-layout"><?php echo $field['button_label']; ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="acf-actions">
|
||||
<a class="acf-button button button-primary" href="#" data-name="add-layout"><?php echo $field['button_label']; ?></a>
|
||||
</div>
|
||||
|
||||
<script type="text-html" class="tmpl-popup"><?php
|
||||
?><div class="acf-fc-popup"><ul><?php foreach( $layouts as $layout ):
|
||||
|
|
@ -1770,7 +1768,7 @@ class acf_field_flexible_content extends acf_field {
|
|||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( new acf_field_flexible_content() );
|
||||
acf_register_field_type( 'acf_field_flexible_content' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
|
|
|||
|
|
@ -884,7 +884,7 @@ class acf_field_gallery extends acf_field {
|
|||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( new acf_field_gallery() );
|
||||
acf_register_field_type( 'acf_field_gallery' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
|
|
|||
|
|
@ -199,13 +199,6 @@ class acf_field_repeater extends acf_field {
|
|||
$div['class'] .= ' -' . $field['layout'];
|
||||
|
||||
|
||||
// hidden input
|
||||
acf_hidden_input(array(
|
||||
'type' => 'hidden',
|
||||
'name' => $field['name'],
|
||||
));
|
||||
|
||||
|
||||
// collapsed
|
||||
if( $field['collapsed'] ) {
|
||||
|
||||
|
|
@ -228,7 +221,8 @@ class acf_field_repeater extends acf_field {
|
|||
}
|
||||
|
||||
?>
|
||||
<div <?php acf_esc_attr_e($div); ?>>
|
||||
<div <?php acf_esc_attr_e( $div ); ?>>
|
||||
<?php acf_hidden_input(array( 'name' => $field['name'], 'value' => '' )); ?>
|
||||
<table class="acf-table">
|
||||
|
||||
<?php if( $field['layout'] == 'table' ): ?>
|
||||
|
|
@ -357,11 +351,9 @@ class acf_field_repeater extends acf_field {
|
|||
</table>
|
||||
<?php if( $show_add ): ?>
|
||||
|
||||
<ul class="acf-actions acf-hl">
|
||||
<li>
|
||||
<a class="acf-button button button-primary" href="#" data-event="add-row"><?php echo $field['button_label']; ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="acf-actions">
|
||||
<a class="acf-button button button-primary" href="#" data-event="add-row"><?php echo $field['button_label']; ?></a>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
|
@ -1126,7 +1118,7 @@ class acf_field_repeater extends acf_field {
|
|||
|
||||
|
||||
// initialize
|
||||
acf_register_field_type( new acf_field_repeater() );
|
||||
acf_register_field_type( 'acf_field_repeater' );
|
||||
|
||||
endif; // class_exists check
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class acf_options_page {
|
|||
|
||||
foreach( $migrate as $old => $new ) {
|
||||
if( !empty($page[$old]) ) {
|
||||
$page[ $new ] = acf_extract_var( $page, $old );
|
||||
$page[ $new ] = $page[ $old ];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -301,6 +301,10 @@ function acf_options_page() {
|
|||
}
|
||||
|
||||
|
||||
// remove Options Page add-on conflict
|
||||
unset($GLOBALS['acf_options_page']);
|
||||
|
||||
|
||||
// initialize
|
||||
acf_options_page();
|
||||
|
||||
|
|
|
|||
14
readme.txt
14
readme.txt
|
|
@ -106,6 +106,20 @@ http://support.advancedcustomfields.com/
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 5.6.2 =
|
||||
* Range field: Added new field type
|
||||
* Clone field: Fixed bug causing value update issues for 'seamless' + widgets / nave menu items
|
||||
* Location: Added parent theme's post templates to 'post template' location rule
|
||||
* Location: Fixed bug causing 'nav menu' location rule to fail during AJAX (add new item)
|
||||
* Core: Fixed PHP errors in customizer when editing non ACF panels
|
||||
* Core: Fixed bug casing backslash character to break fields / field groups
|
||||
* Core: Many minor bug fixes
|
||||
* Language: Updated Romanian translation - thanks to Ionut Staicu
|
||||
* Language: Updated Italian translation - thanks to Davide Pantè
|
||||
* Language: Update Turkish translation - thanks to Emre Erkan
|
||||
* Language: Updated Russian translation - Thanks to Алекс Яровиков
|
||||
* Language: Updated French translation - Thanks to Julie Arrigoni
|
||||
|
||||
= 5.6.1 =
|
||||
* Fixed an assortment of bugs found in 5.6.0
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue