Version Description
- New style for buttons
- Bug Fix: Repeater maximum row setting was disabling the "add row" button 1 row early.
- Performance: Field options are now loaded in via ajax. This results in much less HTML on the edit field group page
- Performance: Field inputs are now loaded in via ajax. Again, less HTML on edit screens improves load times / memory usage
- Bug Fix: Field groups registered by code were not showing on ajax change (category / page type / page template / etc). To fix this, your field group needs a unique ID. When you export a field group, you will now be given a unique ID to fix this issue. Field groups without a fixed id will still show on page load.
- New Option: Repeater field can now have a custom button label
- New Option: Flexible content field can now have a custom button label
- Improvement: Updated the HTML / CSS for file fields with icon
- Bug Fix: Fixed multi upload / select image in repeater.
- Performance: Added caching to the get_field function. Templates will now render quicker.
- Bug Fix: Fixed Post formats location rule - it now works.
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 3.1.6 |
Comparing to | |
See all releases |
Code changes from version 3.1.5 to 3.1.6
- acf.php +354 -50
- core/admin/meta_box_fields.php +28 -12
- core/admin/meta_box_input.php +8 -32
- core/admin/meta_box_location.php +17 -228
- core/admin/page_settings.php +3 -2
- core/api.php +55 -42
- core/fields/file.php +128 -64
- core/fields/flexible_content.php +38 -20
- core/fields/image.php +74 -118
- core/fields/repeater.php +36 -11
- core/options_page.php +5 -5
- css/fields.css +63 -13
- css/global.css +105 -15
- css/input.css +35 -34
- js/fields.js +164 -95
- js/input-actions.js +36 -19
- js/input-ajax.js +45 -5
- readme.txt +13 -0
acf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://www.advancedcustomfields.com/
|
5 |
Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress.Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker and more!
|
6 |
-
Version: 3.1.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -45,7 +45,7 @@ class Acf
|
|
45 |
$this->dir = plugins_url('',__FILE__);
|
46 |
$this->siteurl = get_bloginfo('url');
|
47 |
$this->wpadminurl = admin_url();
|
48 |
-
$this->version = '3.1.
|
49 |
$this->upgrade_version = '3.0.0'; // this is the latest version which requires an upgrade
|
50 |
|
51 |
|
@@ -69,7 +69,10 @@ class Acf
|
|
69 |
add_action('admin_print_scripts', array($this, 'admin_print_scripts'));
|
70 |
add_action('admin_print_styles', array($this, 'admin_print_styles'));
|
71 |
add_action('wp_ajax_acf_upgrade', array($this, 'upgrade_ajax'));
|
72 |
-
|
|
|
|
|
|
|
73 |
return true;
|
74 |
}
|
75 |
|
@@ -292,7 +295,8 @@ class Acf
|
|
292 |
{
|
293 |
if($GLOBALS['post_type'] == 'acf')
|
294 |
{
|
295 |
-
//
|
|
|
296 |
}
|
297 |
else
|
298 |
{
|
@@ -361,9 +365,9 @@ class Acf
|
|
361 |
// edit field
|
362 |
if($GLOBALS['post_type'] == 'acf')
|
363 |
{
|
364 |
-
echo '<script type="text/javascript" src="'.$this->dir.'/js/fields.js" ></script>';
|
365 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/global.css" />';
|
366 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/fields.css" />';
|
367 |
|
368 |
add_meta_box('acf_fields', 'Fields', array($this, 'meta_box_fields'), 'acf', 'normal', 'high');
|
369 |
add_meta_box('acf_location', 'Location </span><span class="description">- Add Fields to Edit Screens', array($this, 'meta_box_location'), 'acf', 'normal', 'high');
|
@@ -388,8 +392,8 @@ class Acf
|
|
388 |
}
|
389 |
|
390 |
// Style
|
391 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/global.css" />';
|
392 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/input.css" />';
|
393 |
echo '<style type="text/css">.acf_postbox, .postbox[id*="acf_"] { display: none; }</style>';
|
394 |
|
395 |
// find user editor setting
|
@@ -397,8 +401,8 @@ class Acf
|
|
397 |
$editor_mode = get_user_setting('editor', 'tinymce');
|
398 |
|
399 |
// Javascript
|
400 |
-
echo '<script type="text/javascript" src="'.$this->dir.'/js/input-actions.js" ></script>';
|
401 |
-
echo '<script type="text/javascript" src="'.$this->dir.'/js/input-ajax.js" ></script>';
|
402 |
echo '<script type="text/javascript">
|
403 |
acf.validation_message = "' . __("Validation Failed. One or more fields below are required.",'acf') . '";
|
404 |
acf.post_id = ' . $post->ID . ';
|
@@ -1183,6 +1187,10 @@ class Acf
|
|
1183 |
}
|
1184 |
|
1185 |
|
|
|
|
|
|
|
|
|
1186 |
|
1187 |
|
1188 |
switch ($rule['param']) {
|
@@ -1403,34 +1411,6 @@ class Acf
|
|
1403 |
|
1404 |
break;
|
1405 |
|
1406 |
-
// PAGE PARENT
|
1407 |
-
/*
|
1408 |
-
case "post_format":
|
1409 |
-
|
1410 |
-
$post_format = isset($overrides['post_format']) ? $overrides['post_format'] : get_post_format();
|
1411 |
-
|
1412 |
-
if($rule['operator'] == "==")
|
1413 |
-
{
|
1414 |
-
if($post_format == $rule['value'])
|
1415 |
-
{
|
1416 |
-
return true;
|
1417 |
-
}
|
1418 |
-
|
1419 |
-
return false;
|
1420 |
-
|
1421 |
-
}
|
1422 |
-
elseif($post_format == "!=")
|
1423 |
-
{
|
1424 |
-
if($post->post_parent != $rule['value'])
|
1425 |
-
{
|
1426 |
-
return true;
|
1427 |
-
}
|
1428 |
-
|
1429 |
-
return false;
|
1430 |
-
}
|
1431 |
-
|
1432 |
-
break;
|
1433 |
-
*/
|
1434 |
|
1435 |
// USER TYPE
|
1436 |
case "user_type":
|
@@ -1489,28 +1469,30 @@ class Acf
|
|
1489 |
// Post Format
|
1490 |
case "post_format":
|
1491 |
|
1492 |
-
|
1493 |
-
|
|
|
1494 |
|
1495 |
if($rule['operator'] == "==")
|
1496 |
{
|
1497 |
-
if($post_format)
|
1498 |
{
|
1499 |
-
return true;
|
1500 |
}
|
1501 |
|
1502 |
return false;
|
1503 |
}
|
1504 |
elseif($rule['operator'] == "!=")
|
1505 |
{
|
1506 |
-
if(
|
1507 |
{
|
1508 |
-
return true;
|
1509 |
}
|
1510 |
|
1511 |
return false;
|
1512 |
}
|
1513 |
|
|
|
1514 |
break;
|
1515 |
|
1516 |
// Taxonomy
|
@@ -1627,13 +1609,14 @@ class Acf
|
|
1627 |
$GLOBALS['acf_mesage'] = $message;
|
1628 |
$GLOBALS['acf_mesage_type'] = $type;
|
1629 |
|
1630 |
-
|
1631 |
-
{
|
1632 |
-
echo '<div class="' . $GLOBALS['acf_mesage_type'] . '" id="message">'.$GLOBALS['acf_mesage'].'</div>';
|
1633 |
-
}
|
1634 |
-
add_action('admin_notices', 'my_admin_notice');
|
1635 |
}
|
1636 |
|
|
|
|
|
|
|
|
|
|
|
1637 |
|
1638 |
|
1639 |
/*--------------------------------------------------------------------------------------
|
@@ -1727,5 +1710,326 @@ class Acf
|
|
1727 |
|
1728 |
}
|
1729 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1730 |
}
|
1731 |
?>
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://www.advancedcustomfields.com/
|
5 |
Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerfull API, it’s a must have for any web developer working with WordPress.Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker and more!
|
6 |
+
Version: 3.1.6
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
45 |
$this->dir = plugins_url('',__FILE__);
|
46 |
$this->siteurl = get_bloginfo('url');
|
47 |
$this->wpadminurl = admin_url();
|
48 |
+
$this->version = '3.1.6';
|
49 |
$this->upgrade_version = '3.0.0'; // this is the latest version which requires an upgrade
|
50 |
|
51 |
|
69 |
add_action('admin_print_scripts', array($this, 'admin_print_scripts'));
|
70 |
add_action('admin_print_styles', array($this, 'admin_print_styles'));
|
71 |
add_action('wp_ajax_acf_upgrade', array($this, 'upgrade_ajax'));
|
72 |
+
add_action('wp_ajax_acf_field_options', array($this, 'ajax_acf_field_options'));
|
73 |
+
add_action('wp_ajax_acf_input', array($this, 'ajax_acf_input'));
|
74 |
+
add_action('wp_ajax_acf_location', array($this, 'ajax_acf_location'));
|
75 |
+
|
76 |
return true;
|
77 |
}
|
78 |
|
295 |
{
|
296 |
if($GLOBALS['post_type'] == 'acf')
|
297 |
{
|
298 |
+
// remove autosave from acf post type
|
299 |
+
wp_dequeue_script( 'autosave' );
|
300 |
}
|
301 |
else
|
302 |
{
|
365 |
// edit field
|
366 |
if($GLOBALS['post_type'] == 'acf')
|
367 |
{
|
368 |
+
echo '<script type="text/javascript" src="'.$this->dir.'/js/fields.js?ver=' . $this->version . '" ></script>';
|
369 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/global.css?ver=' . $this->version . '" />';
|
370 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/fields.css?ver=' . $this->version . '" />';
|
371 |
|
372 |
add_meta_box('acf_fields', 'Fields', array($this, 'meta_box_fields'), 'acf', 'normal', 'high');
|
373 |
add_meta_box('acf_location', 'Location </span><span class="description">- Add Fields to Edit Screens', array($this, 'meta_box_location'), 'acf', 'normal', 'high');
|
392 |
}
|
393 |
|
394 |
// Style
|
395 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/global.css?ver=' . $this->version . '" />';
|
396 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/input.css?ver=' . $this->version . '" />';
|
397 |
echo '<style type="text/css">.acf_postbox, .postbox[id*="acf_"] { display: none; }</style>';
|
398 |
|
399 |
// find user editor setting
|
401 |
$editor_mode = get_user_setting('editor', 'tinymce');
|
402 |
|
403 |
// Javascript
|
404 |
+
echo '<script type="text/javascript" src="'.$this->dir.'/js/input-actions.js?ver=' . $this->version . '" ></script>';
|
405 |
+
echo '<script type="text/javascript" src="'.$this->dir.'/js/input-ajax.js?ver=' . $this->version . '" ></script>';
|
406 |
echo '<script type="text/javascript">
|
407 |
acf.validation_message = "' . __("Validation Failed. One or more fields below are required.",'acf') . '";
|
408 |
acf.post_id = ' . $post->ID . ';
|
1187 |
}
|
1188 |
|
1189 |
|
1190 |
+
if(!isset($rule['value']))
|
1191 |
+
{
|
1192 |
+
return false;
|
1193 |
+
}
|
1194 |
|
1195 |
|
1196 |
switch ($rule['param']) {
|
1411 |
|
1412 |
break;
|
1413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1414 |
|
1415 |
// USER TYPE
|
1416 |
case "user_type":
|
1469 |
// Post Format
|
1470 |
case "post_format":
|
1471 |
|
1472 |
+
|
1473 |
+
$post_format = isset($overrides['post_format']) ? $overrides['post_format'] : get_post_format( $post->ID );
|
1474 |
+
if($post_format == "0") $post_format = "standard";
|
1475 |
|
1476 |
if($rule['operator'] == "==")
|
1477 |
{
|
1478 |
+
if($post_format == $rule['value'])
|
1479 |
{
|
1480 |
+
return true;
|
1481 |
}
|
1482 |
|
1483 |
return false;
|
1484 |
}
|
1485 |
elseif($rule['operator'] == "!=")
|
1486 |
{
|
1487 |
+
if($post_format != $rule['value'])
|
1488 |
{
|
1489 |
+
return true;
|
1490 |
}
|
1491 |
|
1492 |
return false;
|
1493 |
}
|
1494 |
|
1495 |
+
|
1496 |
break;
|
1497 |
|
1498 |
// Taxonomy
|
1609 |
$GLOBALS['acf_mesage'] = $message;
|
1610 |
$GLOBALS['acf_mesage_type'] = $type;
|
1611 |
|
1612 |
+
add_action('admin_notices', array($this, 'acf_admin_notice'));
|
|
|
|
|
|
|
|
|
1613 |
}
|
1614 |
|
1615 |
+
function acf_admin_notice()
|
1616 |
+
{
|
1617 |
+
echo '<div class="' . $GLOBALS['acf_mesage_type'] . '" id="message">'.$GLOBALS['acf_mesage'].'</div>';
|
1618 |
+
}
|
1619 |
+
|
1620 |
|
1621 |
|
1622 |
/*--------------------------------------------------------------------------------------
|
1710 |
|
1711 |
}
|
1712 |
|
1713 |
+
|
1714 |
+
/*--------------------------------------------------------------------------------------
|
1715 |
+
*
|
1716 |
+
* ajax_acf_field_options
|
1717 |
+
*
|
1718 |
+
* @author Elliot Condon
|
1719 |
+
* @since 3.1.6
|
1720 |
+
*
|
1721 |
+
*-------------------------------------------------------------------------------------*/
|
1722 |
+
|
1723 |
+
function ajax_acf_field_options()
|
1724 |
+
{
|
1725 |
+
// defaults
|
1726 |
+
$defaults = array(
|
1727 |
+
'field_key' => null,
|
1728 |
+
'field_type' => null,
|
1729 |
+
'post_id' => null,
|
1730 |
+
);
|
1731 |
+
|
1732 |
+
// load post options
|
1733 |
+
$options = array_merge($defaults, $_POST);
|
1734 |
+
|
1735 |
+
// required
|
1736 |
+
if(!$options['field_type'])
|
1737 |
+
{
|
1738 |
+
echo "";
|
1739 |
+
die();
|
1740 |
+
}
|
1741 |
+
|
1742 |
+
$options['field_key'] = str_replace("fields[", "", $options['field_key']);
|
1743 |
+
$options['field_key'] = str_replace("][type]", "", $options['field_key']) ;
|
1744 |
+
|
1745 |
+
|
1746 |
+
// load field
|
1747 |
+
//$field = $this->get_acf_field("field_" . $options['field_key'], $options['post_id']);
|
1748 |
+
$field = array();
|
1749 |
+
|
1750 |
+
// render options
|
1751 |
+
$this->fields[$options['field_type']]->create_options($options['field_key'], $field);
|
1752 |
+
die();
|
1753 |
+
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
|
1757 |
+
/*--------------------------------------------------------------------------------------
|
1758 |
+
*
|
1759 |
+
* ajax_acf_input
|
1760 |
+
*
|
1761 |
+
* @author Elliot Condon
|
1762 |
+
* @since 3.1.6
|
1763 |
+
*
|
1764 |
+
*-------------------------------------------------------------------------------------*/
|
1765 |
+
|
1766 |
+
function ajax_acf_input()
|
1767 |
+
{
|
1768 |
+
|
1769 |
+
// defaults
|
1770 |
+
$defaults = array(
|
1771 |
+
'acf_id' => null,
|
1772 |
+
'post_id' => null,
|
1773 |
+
);
|
1774 |
+
|
1775 |
+
// load post options
|
1776 |
+
$options = array_merge($defaults, $_POST);
|
1777 |
+
|
1778 |
+
// required
|
1779 |
+
if(!$options['acf_id'] || !$options['post_id'])
|
1780 |
+
{
|
1781 |
+
echo "";
|
1782 |
+
die();
|
1783 |
+
}
|
1784 |
+
|
1785 |
+
// get fields
|
1786 |
+
$fields = $this->get_acf_fields($options['acf_id']);
|
1787 |
+
|
1788 |
+
$this->render_fields_for_input($fields, $options['post_id']);
|
1789 |
+
|
1790 |
+
die();
|
1791 |
+
|
1792 |
+
}
|
1793 |
+
|
1794 |
+
|
1795 |
+
/*--------------------------------------------------------------------------------------
|
1796 |
+
*
|
1797 |
+
* render_fields_for_input
|
1798 |
+
*
|
1799 |
+
* @author Elliot Condon
|
1800 |
+
* @since 3.1.6
|
1801 |
+
*
|
1802 |
+
*-------------------------------------------------------------------------------------*/
|
1803 |
+
|
1804 |
+
function render_fields_for_input($fields, $post_id)
|
1805 |
+
{
|
1806 |
+
// create fields
|
1807 |
+
if($fields)
|
1808 |
+
{
|
1809 |
+
foreach($fields as $field)
|
1810 |
+
{
|
1811 |
+
// if they didn't select a type, skip this field
|
1812 |
+
if($field['type'] == 'null') continue;
|
1813 |
+
|
1814 |
+
// set value
|
1815 |
+
$field['value'] = $this->get_value($post_id, $field);
|
1816 |
+
|
1817 |
+
// required
|
1818 |
+
if(!isset($field['required']))
|
1819 |
+
{
|
1820 |
+
$field['required'] = "0";
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
$required_class = "";
|
1824 |
+
$required_label = "";
|
1825 |
+
|
1826 |
+
if($field['required'] == "1")
|
1827 |
+
{
|
1828 |
+
$required_class = ' required';
|
1829 |
+
$required_label = ' <span class="required">*</span>';
|
1830 |
+
}
|
1831 |
+
|
1832 |
+
echo '<div class="field field-' . $field['type'] . $required_class . '">';
|
1833 |
+
|
1834 |
+
echo '<label class="field_label" for="fields[' . $field['key'] . ']">' . $field['label'] . $required_label . '</label>';
|
1835 |
+
if($field['instructions']) echo '<p class="instructions">' . $field['instructions'] . '</p>';
|
1836 |
+
|
1837 |
+
$field['name'] = 'fields[' . $field['key'] . ']';
|
1838 |
+
$this->create_field($field);
|
1839 |
+
|
1840 |
+
echo '</div>';
|
1841 |
+
|
1842 |
+
}
|
1843 |
+
}
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
|
1847 |
+
/*--------------------------------------------------------------------------------------
|
1848 |
+
*
|
1849 |
+
* ajax_acf_location
|
1850 |
+
*
|
1851 |
+
* @author Elliot Condon
|
1852 |
+
* @since 3.1.6
|
1853 |
+
*
|
1854 |
+
*-------------------------------------------------------------------------------------*/
|
1855 |
+
|
1856 |
+
function ajax_acf_location($options = array())
|
1857 |
+
{
|
1858 |
+
// defaults
|
1859 |
+
$defaults = array(
|
1860 |
+
'key' => null,
|
1861 |
+
'value' => null,
|
1862 |
+
'param' => null,
|
1863 |
+
);
|
1864 |
+
|
1865 |
+
// Is AJAX call?
|
1866 |
+
if(isset($_POST['action']) && $_POST['action'] == "acf_location")
|
1867 |
+
{
|
1868 |
+
$options = array_merge($defaults, $_POST);
|
1869 |
+
}
|
1870 |
+
else
|
1871 |
+
{
|
1872 |
+
$options = array_merge($defaults, $options);
|
1873 |
+
}
|
1874 |
+
|
1875 |
+
|
1876 |
+
// some case's have the same outcome
|
1877 |
+
if($options['param'] == "page_parent")
|
1878 |
+
{
|
1879 |
+
$options['param'] = "page";
|
1880 |
+
}
|
1881 |
+
|
1882 |
+
|
1883 |
+
$choices = array();
|
1884 |
+
$optgroup = false;
|
1885 |
+
|
1886 |
+
switch($options['param'])
|
1887 |
+
{
|
1888 |
+
case "post_type":
|
1889 |
+
|
1890 |
+
$choices = get_post_types(array('public' => true));
|
1891 |
+
unset($choices['attachment']);
|
1892 |
+
|
1893 |
+
break;
|
1894 |
+
|
1895 |
+
|
1896 |
+
case "page":
|
1897 |
+
|
1898 |
+
$pages = get_pages('sort_column=menu_order&sort_order=desc');
|
1899 |
+
|
1900 |
+
foreach($pages as $page)
|
1901 |
+
{
|
1902 |
+
$value = '';
|
1903 |
+
$ancestors = get_ancestors($page->ID, 'page');
|
1904 |
+
if($ancestors)
|
1905 |
+
{
|
1906 |
+
foreach($ancestors as $a)
|
1907 |
+
{
|
1908 |
+
$value .= '– ';
|
1909 |
+
}
|
1910 |
+
}
|
1911 |
+
$value .= get_the_title($page->ID);
|
1912 |
+
|
1913 |
+
$choices[$page->ID] = $value;
|
1914 |
+
|
1915 |
+
}
|
1916 |
+
|
1917 |
+
break;
|
1918 |
+
|
1919 |
+
|
1920 |
+
case "page_type" :
|
1921 |
+
|
1922 |
+
$choices = array(
|
1923 |
+
'parent' => 'Parent Page',
|
1924 |
+
'child' => 'Child Page',
|
1925 |
+
);
|
1926 |
+
|
1927 |
+
break;
|
1928 |
+
|
1929 |
+
case "page_template" :
|
1930 |
+
|
1931 |
+
$choices = array(
|
1932 |
+
'default' => 'Default Template',
|
1933 |
+
);
|
1934 |
+
|
1935 |
+
$templates = get_page_templates();
|
1936 |
+
foreach($templates as $k => $v)
|
1937 |
+
{
|
1938 |
+
$choices[$v] = $k;
|
1939 |
+
}
|
1940 |
+
|
1941 |
+
break;
|
1942 |
+
|
1943 |
+
case "post" :
|
1944 |
+
|
1945 |
+
$posts = get_posts( array('numberposts' => '-1' ));
|
1946 |
+
foreach($posts as $v)
|
1947 |
+
{
|
1948 |
+
$choices[$v->ID] = $v->post_title;
|
1949 |
+
}
|
1950 |
+
|
1951 |
+
break;
|
1952 |
+
|
1953 |
+
case "post_category" :
|
1954 |
+
|
1955 |
+
$category_ids = get_all_category_ids();
|
1956 |
+
|
1957 |
+
foreach($category_ids as $cat_id)
|
1958 |
+
{
|
1959 |
+
$cat_name = get_cat_name($cat_id);
|
1960 |
+
$choices[$cat_id] = $cat_name;
|
1961 |
+
}
|
1962 |
+
|
1963 |
+
break;
|
1964 |
+
|
1965 |
+
case "post_format" :
|
1966 |
+
|
1967 |
+
/*$choices = array(
|
1968 |
+
'0' => 'Standard',
|
1969 |
+
'aside' => 'Aside',
|
1970 |
+
'link' => 'Link',
|
1971 |
+
'gallery' => 'Gallery',
|
1972 |
+
'status' => 'Status',
|
1973 |
+
'quote' => 'Quote',
|
1974 |
+
'image' => 'Image',
|
1975 |
+
);*/
|
1976 |
+
|
1977 |
+
$choices = get_post_format_strings();
|
1978 |
+
|
1979 |
+
break;
|
1980 |
+
|
1981 |
+
case "user_type" :
|
1982 |
+
|
1983 |
+
global $wp_roles;
|
1984 |
+
|
1985 |
+
$choices = $wp_roles->get_names();
|
1986 |
+
|
1987 |
+
break;
|
1988 |
+
|
1989 |
+
case "options_page" :
|
1990 |
+
|
1991 |
+
$choices = array(
|
1992 |
+
'Options' => 'Options',
|
1993 |
+
);
|
1994 |
+
|
1995 |
+
$custom = apply_filters('acf_register_options_page',array());
|
1996 |
+
if(!empty($custom))
|
1997 |
+
{
|
1998 |
+
$choices = array();
|
1999 |
+
foreach($custom as $c)
|
2000 |
+
{
|
2001 |
+
$choices[$c['title']] = $c['title'];
|
2002 |
+
}
|
2003 |
+
}
|
2004 |
+
|
2005 |
+
break;
|
2006 |
+
|
2007 |
+
case "taxonomy" :
|
2008 |
+
|
2009 |
+
$choices = $this->get_taxonomies_for_select();
|
2010 |
+
$optgroup = true;
|
2011 |
+
|
2012 |
+
break;
|
2013 |
+
|
2014 |
+
}
|
2015 |
+
|
2016 |
+
$this->create_field(array(
|
2017 |
+
'type' => 'select',
|
2018 |
+
'name' => 'location[rules][' . $options['key'] . '][value]',
|
2019 |
+
'value' => $options['value'],
|
2020 |
+
'choices' => $choices,
|
2021 |
+
'optgroup' => $optgroup,
|
2022 |
+
));
|
2023 |
+
|
2024 |
+
// ajax?
|
2025 |
+
if(isset($_POST['action']) && $_POST['action'] == "acf_location")
|
2026 |
+
{
|
2027 |
+
die();
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
}
|
2031 |
+
|
2032 |
+
|
2033 |
+
|
2034 |
}
|
2035 |
?>
|
core/admin/meta_box_fields.php
CHANGED
@@ -30,7 +30,19 @@ foreach($this->fields as $field)
|
|
30 |
|
31 |
// hidden field for saving
|
32 |
?>
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<div class="fields_header">
|
35 |
<table class="acf widefat">
|
36 |
<thead>
|
@@ -56,12 +68,12 @@ foreach($this->fields as $field)
|
|
56 |
<td class="field_order"><span class="circle"><?php echo (int)$field['order_no'] + 1; ?></span></td>
|
57 |
<td class="field_label">
|
58 |
<strong>
|
59 |
-
<a class="acf_edit_field row-title" title="Edit this Field" href="javascript:;"><?php echo $field['label']; ?></a>
|
60 |
</strong>
|
61 |
<div class="row_options">
|
62 |
-
<span><a class="acf_edit_field" title="Edit this Field" href="javascript:;"><?php _e("Edit",'acf'); ?></a> | </span>
|
63 |
-
<span><a title="Read documentation for this field" href="http://
|
64 |
-
<span><a class="acf_delete_field" title="Delete this Field" href="javascript:;"><?php _e("Delete",'acf'); ?></a>
|
65 |
</div>
|
66 |
</td>
|
67 |
<td class="field_name"><?php echo $field['name']; ?></td>
|
@@ -150,16 +162,20 @@ foreach($this->fields as $field)
|
|
150 |
</td>
|
151 |
</tr>
|
152 |
<?php
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
?>
|
157 |
<tr class="field_save">
|
158 |
<td class="label">
|
159 |
-
<label><?php _e("Save Field",'acf'); ?></label>
|
160 |
</td>
|
161 |
-
<td
|
162 |
-
|
|
|
|
|
|
|
|
|
163 |
</td>
|
164 |
</tr>
|
165 |
</tbody>
|
@@ -171,5 +187,5 @@ foreach($this->fields as $field)
|
|
171 |
</div>
|
172 |
<div class="table_footer">
|
173 |
<div class="order_message"></div>
|
174 |
-
<a href="javascript:;" id="add_field" class="button
|
175 |
</div>
|
30 |
|
31 |
// hidden field for saving
|
32 |
?>
|
33 |
+
|
34 |
+
<!-- Hidden Fields -->
|
35 |
+
<div style="display:none;">
|
36 |
+
<script type="text/javascript">
|
37 |
+
acf_messages = {
|
38 |
+
move_to_trash : "<?php _e("Move to trash. Are you sure?",'acf'); ?>"
|
39 |
+
};
|
40 |
+
</script>
|
41 |
+
<input type="hidden" name="save_fields" value="true" />
|
42 |
+
</div>
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
<div class="fields_header">
|
47 |
<table class="acf widefat">
|
48 |
<thead>
|
68 |
<td class="field_order"><span class="circle"><?php echo (int)$field['order_no'] + 1; ?></span></td>
|
69 |
<td class="field_label">
|
70 |
<strong>
|
71 |
+
<a class="acf_edit_field row-title" title="<?php _e("Edit this Field",'acf'); ?>" href="javascript:;"><?php echo $field['label']; ?></a>
|
72 |
</strong>
|
73 |
<div class="row_options">
|
74 |
+
<span><a class="acf_edit_field" title="<?php _e("Edit this Field",'acf'); ?>" href="javascript:;"><?php _e("Edit",'acf'); ?></a> | </span>
|
75 |
+
<span><a title="<?php _e("Read documentation for this field",'acf'); ?>" href="http://advancedcustomfields.com/documentation" target="_blank"><?php _e("Docs",'acf'); ?></a> | </span>
|
76 |
+
<span><a class="acf_delete_field" title="<?php _e("Delete this Field",'acf'); ?>" href="javascript:;"><?php _e("Delete",'acf'); ?></a>
|
77 |
</div>
|
78 |
</td>
|
79 |
<td class="field_name"><?php echo $field['name']; ?></td>
|
162 |
</td>
|
163 |
</tr>
|
164 |
<?php
|
165 |
+
|
166 |
+
$this->fields[$field['type']]->create_options($key, $field);
|
167 |
+
|
168 |
?>
|
169 |
<tr class="field_save">
|
170 |
<td class="label">
|
171 |
+
<!-- <label><?php _e("Save Field",'acf'); ?></label> -->
|
172 |
</td>
|
173 |
+
<td>
|
174 |
+
<ul class="hl clearfix">
|
175 |
+
<li>
|
176 |
+
<a class="acf_edit_field acf-button grey" title="<?php _e("Close Field",'acf'); ?>" href="javascript:;"><?php _e("Close Field",'acf'); ?></a>
|
177 |
+
</li>
|
178 |
+
</ul>
|
179 |
</td>
|
180 |
</tr>
|
181 |
</tbody>
|
187 |
</div>
|
188 |
<div class="table_footer">
|
189 |
<div class="order_message"></div>
|
190 |
+
<a href="javascript:;" id="add_field" class="acf-button"><?php _e('+ Add Field','acf'); ?></a>
|
191 |
</div>
|
core/admin/meta_box_input.php
CHANGED
@@ -18,39 +18,15 @@ if($fields)
|
|
18 |
{
|
19 |
echo '<input type="hidden" name="save_input" value="true" />';
|
20 |
echo '<div class="options" data-layout="' . $options['layout'] . '" data-show="' . $show . '" style="display:none"></div>';
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
{
|
23 |
-
|
24 |
-
if($field['type'] == 'null') continue;
|
25 |
-
|
26 |
-
// set value
|
27 |
-
$field['value'] = $this->get_value($post_id, $field);
|
28 |
-
|
29 |
-
// required
|
30 |
-
if(!isset($field['required']))
|
31 |
-
{
|
32 |
-
$field['required'] = "0";
|
33 |
-
}
|
34 |
-
|
35 |
-
$required_class = "";
|
36 |
-
$required_label = "";
|
37 |
-
|
38 |
-
if($field['required'] == "1")
|
39 |
-
{
|
40 |
-
$required_class = ' required';
|
41 |
-
$required_label = ' <span class="required">*</span>';
|
42 |
-
}
|
43 |
-
|
44 |
-
echo '<div class="field field-' . $field['type'] . $required_class . '">';
|
45 |
-
|
46 |
-
echo '<label class="field_label" for="fields[' . $field['key'] . ']">' . $field['label'] . $required_label . '</label>';
|
47 |
-
if($field['instructions']) echo '<p class="instructions">' . $field['instructions'] . '</p>';
|
48 |
-
|
49 |
-
$field['name'] = 'fields[' . $field['key'] . ']';
|
50 |
-
$this->create_field($field);
|
51 |
-
|
52 |
-
echo '</div>';
|
53 |
-
|
54 |
}
|
55 |
}
|
56 |
|
18 |
{
|
19 |
echo '<input type="hidden" name="save_input" value="true" />';
|
20 |
echo '<div class="options" data-layout="' . $options['layout'] . '" data-show="' . $show . '" style="display:none"></div>';
|
21 |
+
|
22 |
+
if($show == "false")
|
23 |
+
{
|
24 |
+
// don't create fields
|
25 |
+
echo '<div class="acf-replace-with-fields"><div class="acf-loading"></div></div>';
|
26 |
+
}
|
27 |
+
else
|
28 |
{
|
29 |
+
$this->render_fields_for_input($fields, $post_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
}
|
32 |
|
core/admin/meta_box_location.php
CHANGED
@@ -10,7 +10,7 @@ if(empty($location['rules']))
|
|
10 |
{
|
11 |
$location['rules'] = array(
|
12 |
array(
|
13 |
-
'param' => '',
|
14 |
'operator' => '',
|
15 |
'value' => '',
|
16 |
)
|
@@ -31,8 +31,8 @@ if(empty($location['rules']))
|
|
31 |
<tbody>
|
32 |
<?php foreach($location['rules'] as $k => $rule): ?>
|
33 |
<tr>
|
34 |
-
<td class="param"
|
35 |
-
|
36 |
$args = array(
|
37 |
'type' => 'select',
|
38 |
'name' => 'location[rules]['.$k.'][param]',
|
@@ -58,10 +58,10 @@ if(empty($location['rules']))
|
|
58 |
}
|
59 |
|
60 |
$this->create_field($args);
|
61 |
-
|
62 |
-
|
63 |
-
<td class="operator"
|
64 |
-
|
65 |
$this->create_field(array(
|
66 |
'type' => 'select',
|
67 |
'name' => 'location[rules]['.$k.'][operator]',
|
@@ -71,228 +71,17 @@ if(empty($location['rules']))
|
|
71 |
'!=' => 'is not equal to',
|
72 |
)
|
73 |
));
|
74 |
-
?>
|
75 |
-
</td>
|
76 |
-
<td class="value">
|
77 |
-
<div rel="post_type">
|
78 |
-
<?php
|
79 |
-
$choices = get_post_types(array('public' => true));
|
80 |
-
unset($choices['attachment']);
|
81 |
-
|
82 |
-
|
83 |
-
$this->create_field(array(
|
84 |
-
'type' => 'select',
|
85 |
-
'name' => 'location[rules]['.$k.'][value]',
|
86 |
-
'value' => $rule['value'],
|
87 |
-
'choices' => $choices,
|
88 |
-
));
|
89 |
-
?>
|
90 |
-
</div>
|
91 |
-
<div rel="page">
|
92 |
-
<?php
|
93 |
-
$choices = array();
|
94 |
-
|
95 |
-
foreach(get_pages('sort_column=menu_order&sort_order=desc') as $page)
|
96 |
-
{
|
97 |
-
$value = '';
|
98 |
-
$ancestors = get_ancestors($page->ID, 'page');
|
99 |
-
if($ancestors)
|
100 |
-
{
|
101 |
-
foreach($ancestors as $a)
|
102 |
-
{
|
103 |
-
$value .= '– ';
|
104 |
-
}
|
105 |
-
}
|
106 |
-
$value .= get_the_title($page->ID);
|
107 |
-
|
108 |
-
$choices[$page->ID] = $value;
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
$this->create_field(array(
|
113 |
-
'type' => 'select',
|
114 |
-
'name' => 'location[rules]['.$k.'][value]',
|
115 |
-
'value' => $rule['value'],
|
116 |
-
'choices' => $choices,
|
117 |
-
));
|
118 |
-
|
119 |
-
?>
|
120 |
-
</div>
|
121 |
-
<div rel="page_type">
|
122 |
-
<?php
|
123 |
-
$this->create_field(array(
|
124 |
-
'type' => 'select',
|
125 |
-
'name' => 'location[rules]['.$k.'][value]',
|
126 |
-
'value' => $rule['value'],
|
127 |
-
'choices' => array(
|
128 |
-
'parent' => 'Parent Page',
|
129 |
-
'child' => 'Child Page'
|
130 |
-
),
|
131 |
-
));
|
132 |
-
?>
|
133 |
-
</div>
|
134 |
-
<div rel="page_parent">
|
135 |
-
<?php
|
136 |
-
|
137 |
-
$choices = array();
|
138 |
-
|
139 |
-
foreach(get_pages('sort_column=menu_order&sort_order=desc') as $page)
|
140 |
-
{
|
141 |
-
$value = '';
|
142 |
-
$ancestors = get_ancestors($page->ID, 'page');
|
143 |
-
if($ancestors)
|
144 |
-
{
|
145 |
-
foreach($ancestors as $a)
|
146 |
-
{
|
147 |
-
$value .= '– ';
|
148 |
-
}
|
149 |
-
}
|
150 |
-
$value .= get_the_title($page->ID);
|
151 |
-
|
152 |
-
$choices[$page->ID] = $value;
|
153 |
-
|
154 |
-
}
|
155 |
-
|
156 |
-
$this->create_field(array(
|
157 |
-
'type' => 'select',
|
158 |
-
'name' => 'location[rules]['.$k.'][value]',
|
159 |
-
'value' => $rule['value'],
|
160 |
-
'choices' => $choices,
|
161 |
-
));
|
162 |
-
|
163 |
-
?>
|
164 |
-
</div>
|
165 |
-
<div rel="page_template">
|
166 |
-
<?php
|
167 |
-
|
168 |
-
$choices = array(
|
169 |
-
'default' => 'Default Template',
|
170 |
-
);
|
171 |
-
foreach(get_page_templates() as $tk => $tv)
|
172 |
-
{
|
173 |
-
$choices[$tv] = $tk;
|
174 |
-
}
|
175 |
-
|
176 |
-
$this->create_field(array(
|
177 |
-
'type' => 'select',
|
178 |
-
'name' => 'location[rules]['.$k.'][value]',
|
179 |
-
'value' => $rule['value'],
|
180 |
-
'choices' => $choices,
|
181 |
-
));
|
182 |
-
|
183 |
-
?>
|
184 |
-
</div>
|
185 |
-
<div rel="post">
|
186 |
-
<?php
|
187 |
-
|
188 |
-
$choices = array();
|
189 |
-
foreach(get_posts(array('numberposts'=>'-1')) as $v)
|
190 |
-
{
|
191 |
-
$choices[$v->ID] = $v->post_title;
|
192 |
-
}
|
193 |
-
|
194 |
-
$this->create_field(array(
|
195 |
-
'type' => 'select',
|
196 |
-
'name' => 'location[rules]['.$k.'][value]',
|
197 |
-
'value' => $rule['value'],
|
198 |
-
'choices' => $choices,
|
199 |
-
));
|
200 |
-
|
201 |
-
?>
|
202 |
-
</div>
|
203 |
-
<div rel="post_category">
|
204 |
-
<?php
|
205 |
-
|
206 |
-
$choices = array();
|
207 |
-
$category_ids = get_all_category_ids();
|
208 |
-
|
209 |
-
foreach($category_ids as $cat_id)
|
210 |
-
{
|
211 |
-
$cat_name = get_cat_name($cat_id);
|
212 |
-
$choices[$cat_id] = $cat_name;
|
213 |
-
}
|
214 |
-
|
215 |
-
$this->create_field(array(
|
216 |
-
'type' => 'select',
|
217 |
-
'name' => 'location[rules]['.$k.'][value]',
|
218 |
-
'value' => $rule['value'],
|
219 |
-
'choices' => $choices,
|
220 |
-
));
|
221 |
-
|
222 |
-
?>
|
223 |
-
</div>
|
224 |
-
<div rel="post_format">
|
225 |
-
<?php
|
226 |
-
|
227 |
-
$this->create_field(array(
|
228 |
-
'type' => 'select',
|
229 |
-
'name' => 'location[rules]['.$k.'][value]',
|
230 |
-
'value' => $rule['value'],
|
231 |
-
'choices' => array(
|
232 |
-
'0' => 'Standard',
|
233 |
-
'aside' => 'Aside',
|
234 |
-
'link' => 'Link',
|
235 |
-
'gallery' => 'Gallery',
|
236 |
-
'status' => 'Status',
|
237 |
-
'quote' => 'Quote',
|
238 |
-
'image' => 'Image',
|
239 |
-
),
|
240 |
-
));
|
241 |
-
|
242 |
-
?>
|
243 |
-
</div>
|
244 |
-
<div rel="user_type">
|
245 |
-
<?php
|
246 |
-
global $wp_roles;
|
247 |
-
$this->create_field(array(
|
248 |
-
'type' => 'select',
|
249 |
-
'name' => 'location[rules]['.$k.'][value]',
|
250 |
-
'value' => $rule['value'],
|
251 |
-
'choices' => $roles = $wp_roles->get_names()
|
252 |
-
));
|
253 |
-
|
254 |
-
?>
|
255 |
-
</div>
|
256 |
-
<div rel="options_page">
|
257 |
-
<?php
|
258 |
-
$choices = array(
|
259 |
-
'Options' => 'Options',
|
260 |
-
);
|
261 |
-
|
262 |
-
$custom = apply_filters('acf_register_options_page',array());
|
263 |
-
if(!empty($custom))
|
264 |
-
{
|
265 |
-
$choices = array();
|
266 |
-
foreach($custom as $c)
|
267 |
-
{
|
268 |
-
$choices[$c['title']] = $c['title'];
|
269 |
-
}
|
270 |
-
}
|
271 |
-
|
272 |
-
$this->create_field(array(
|
273 |
-
'type' => 'select',
|
274 |
-
'name' => 'location[rules]['.$k.'][value]',
|
275 |
-
'value' => $rule['value'],
|
276 |
-
'choices' => $choices,
|
277 |
-
));
|
278 |
-
|
279 |
-
?>
|
280 |
-
</div>
|
281 |
-
<div rel="taxonomy">
|
282 |
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
?>
|
294 |
-
</div>
|
295 |
-
</td>
|
296 |
<td class="buttons">
|
297 |
<a href="javascript:;" class="remove"></a>
|
298 |
<a href="javascript:;" class="add"></a>
|
10 |
{
|
11 |
$location['rules'] = array(
|
12 |
array(
|
13 |
+
'param' => 'post_type',
|
14 |
'operator' => '',
|
15 |
'value' => '',
|
16 |
)
|
31 |
<tbody>
|
32 |
<?php foreach($location['rules'] as $k => $rule): ?>
|
33 |
<tr>
|
34 |
+
<td class="param"><?php
|
35 |
+
|
36 |
$args = array(
|
37 |
'type' => 'select',
|
38 |
'name' => 'location[rules]['.$k.'][param]',
|
58 |
}
|
59 |
|
60 |
$this->create_field($args);
|
61 |
+
|
62 |
+
?></td>
|
63 |
+
<td class="operator"><?php
|
64 |
+
|
65 |
$this->create_field(array(
|
66 |
'type' => 'select',
|
67 |
'name' => 'location[rules]['.$k.'][operator]',
|
71 |
'!=' => 'is not equal to',
|
72 |
)
|
73 |
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
?></td>
|
76 |
+
<td class="value"><?php
|
77 |
+
|
78 |
+
$this->ajax_acf_location(array(
|
79 |
+
'key' => $k,
|
80 |
+
'value' => $rule['value'],
|
81 |
+
'param' => $rule['param'],
|
82 |
+
));
|
83 |
+
|
84 |
+
?></td>
|
|
|
|
|
|
|
85 |
<td class="buttons">
|
86 |
<a href="javascript:;" class="remove"></a>
|
87 |
<a href="javascript:;" class="add"></a>
|
core/admin/page_settings.php
CHANGED
@@ -166,7 +166,7 @@ if($action == ""):
|
|
166 |
<li><?php _e("ACF will create a .xml export file which is compatible with the native WP import plugin.",'acf'); ?></li>
|
167 |
</ul>
|
168 |
<ul class="hl right">
|
169 |
-
<li><input type="submit" class="button
|
170 |
</ul>
|
171 |
</div>
|
172 |
</div>
|
@@ -233,7 +233,7 @@ if($action == ""):
|
|
233 |
<li><?php _e("ACF will create the PHP code to include in your theme",'acf'); ?></li>
|
234 |
</ul>
|
235 |
<ul class="hl right">
|
236 |
-
<li><input type="submit" class="button
|
237 |
</ul>
|
238 |
</div>
|
239 |
</div>
|
@@ -318,6 +318,7 @@ if(function_exists("register_field_group"))
|
|
318 |
foreach($acfs as $acf)
|
319 |
{
|
320 |
$var = array(
|
|
|
321 |
'title' => get_the_title($acf->ID),
|
322 |
'fields' => $this->get_acf_fields($acf->ID),
|
323 |
'location' => $this->get_acf_location($acf->ID),
|
166 |
<li><?php _e("ACF will create a .xml export file which is compatible with the native WP import plugin.",'acf'); ?></li>
|
167 |
</ul>
|
168 |
<ul class="hl right">
|
169 |
+
<li><input type="submit" class="acf-button" value="<?php _e("Export XML",'acf'); ?>" /></li>
|
170 |
</ul>
|
171 |
</div>
|
172 |
</div>
|
233 |
<li><?php _e("ACF will create the PHP code to include in your theme",'acf'); ?></li>
|
234 |
</ul>
|
235 |
<ul class="hl right">
|
236 |
+
<li><input type="submit" class="acf-button" value="<?php _e("Create PHP",'acf'); ?>" /></li>
|
237 |
</ul>
|
238 |
</div>
|
239 |
</div>
|
318 |
foreach($acfs as $acf)
|
319 |
{
|
320 |
$var = array(
|
321 |
+
'id' => uniqid(),
|
322 |
'title' => get_the_title($acf->ID),
|
323 |
'fields' => $this->get_acf_fields($acf->ID),
|
324 |
'location' => $this->get_acf_location($acf->ID),
|
core/api.php
CHANGED
@@ -54,7 +54,6 @@ function get_fields($post_id = false)
|
|
54 |
}
|
55 |
|
56 |
|
57 |
-
|
58 |
/*--------------------------------------------------------------------------------------
|
59 |
*
|
60 |
* get_field
|
@@ -63,43 +62,53 @@ function get_fields($post_id = false)
|
|
63 |
* @since 1.0.3
|
64 |
*
|
65 |
*-------------------------------------------------------------------------------------*/
|
66 |
-
|
67 |
-
function get_field($field_name, $post_id = false)
|
68 |
-
{
|
69 |
-
global $post, $acf;
|
70 |
-
|
71 |
-
if(!$post_id)
|
72 |
-
{
|
73 |
-
$post_id = $post->ID;
|
74 |
-
}
|
75 |
-
elseif($post_id == "options")
|
76 |
-
{
|
77 |
-
$post_id = 999999999;
|
78 |
-
}
|
79 |
-
|
80 |
-
//
|
81 |
-
$
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
|
@@ -273,7 +282,11 @@ $GLOBALS['acf_register_field_group'] = array();
|
|
273 |
function register_field_group($array)
|
274 |
{
|
275 |
// add id
|
276 |
-
$array['id']
|
|
|
|
|
|
|
|
|
277 |
$GLOBALS['acf_register_field_group'][] = $array;
|
278 |
}
|
279 |
|
@@ -469,12 +482,12 @@ function acf_form_wp_head()
|
|
469 |
|
470 |
|
471 |
// Style
|
472 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/global.css" />';
|
473 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/input.css" />';
|
474 |
|
475 |
|
476 |
// Javascript
|
477 |
-
echo '<script type="text/javascript" src="'.$acf->dir.'/js/input-actions.js" ></script>';
|
478 |
echo '<script type="text/javascript">
|
479 |
acf.validation_message = "' . __("Validation Failed. One or more fields below are required.",'acf') . '";
|
480 |
acf.post_id = ' . $post->ID . ';
|
54 |
}
|
55 |
|
56 |
|
|
|
57 |
/*--------------------------------------------------------------------------------------
|
58 |
*
|
59 |
* get_field
|
62 |
* @since 1.0.3
|
63 |
*
|
64 |
*-------------------------------------------------------------------------------------*/
|
65 |
+
|
66 |
+
function get_field($field_name, $post_id = false)
|
67 |
+
{
|
68 |
+
global $post, $acf;
|
69 |
+
|
70 |
+
if(!$post_id)
|
71 |
+
{
|
72 |
+
$post_id = $post->ID;
|
73 |
+
}
|
74 |
+
elseif($post_id == "options")
|
75 |
+
{
|
76 |
+
$post_id = 999999999;
|
77 |
+
}
|
78 |
+
|
79 |
+
// return cache
|
80 |
+
$cache = wp_cache_get('acf_get_field_' . $post_id . '_' . $field_name);
|
81 |
+
if($cache)
|
82 |
+
{
|
83 |
+
return $cache;
|
84 |
+
}
|
85 |
+
|
86 |
+
// default
|
87 |
+
$value = "";
|
88 |
+
|
89 |
+
// get value
|
90 |
+
$field_key = get_post_meta($post_id, '_' . $field_name, true);
|
91 |
+
|
92 |
+
if($field_key != "")
|
93 |
+
{
|
94 |
+
// we can load the field properly!
|
95 |
+
$field = $acf->get_acf_field($field_key);
|
96 |
+
$value = $acf->get_value_for_api($post_id, $field);
|
97 |
+
}
|
98 |
+
else
|
99 |
+
{
|
100 |
+
// just load the text version
|
101 |
+
$value = get_post_meta($post_id, $field_name, true);
|
102 |
+
}
|
103 |
+
|
104 |
+
// no value?
|
105 |
+
if($value == "") $value = false;
|
106 |
+
|
107 |
+
// update cache
|
108 |
+
wp_cache_set('acf_get_field_' . $post_id . '_' . $field_name, $value);
|
109 |
+
|
110 |
+
return $value;
|
111 |
+
|
112 |
}
|
113 |
|
114 |
|
282 |
function register_field_group($array)
|
283 |
{
|
284 |
// add id
|
285 |
+
if(!isset($array['id']))
|
286 |
+
{
|
287 |
+
$array['id'] = uniqid();
|
288 |
+
}
|
289 |
+
|
290 |
$GLOBALS['acf_register_field_group'][] = $array;
|
291 |
}
|
292 |
|
482 |
|
483 |
|
484 |
// Style
|
485 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/global.css?ver=' . $acf->version . '" />';
|
486 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/input.css?ver=' . $acf->version . '" />';
|
487 |
|
488 |
|
489 |
// Javascript
|
490 |
+
echo '<script type="text/javascript" src="'.$acf->dir.'/js/input-actions.js?ver=' . $acf->version . '" ></script>';
|
491 |
echo '<script type="text/javascript">
|
492 |
acf.validation_message = "' . __("Validation Failed. One or more fields below are required.",'acf') . '";
|
493 |
acf.post_id = ' . $post->ID . ';
|
core/fields/file.php
CHANGED
@@ -20,14 +20,53 @@ class acf_File extends acf_Field
|
|
20 |
$this->title = __('File','acf');
|
21 |
|
22 |
add_action('admin_head-media-upload-popup', array($this, 'popup_head'));
|
23 |
-
add_action('wp_ajax_acf_select_file', array($this, '
|
24 |
add_filter('get_media_item_args', array($this, 'allow_file_insertion'));
|
25 |
}
|
26 |
|
27 |
|
28 |
/*--------------------------------------------------------------------------------------
|
29 |
*
|
30 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
*
|
32 |
* @description ajax function to provide url of selected file
|
33 |
* @author Elliot Condon
|
@@ -35,7 +74,7 @@ class acf_File extends acf_Field
|
|
35 |
*
|
36 |
*-------------------------------------------------------------------------------------*/
|
37 |
|
38 |
-
function
|
39 |
{
|
40 |
$id = isset($_POST['id']) ? $_POST['id'] : false;
|
41 |
|
@@ -47,10 +86,8 @@ class acf_File extends acf_Field
|
|
47 |
die();
|
48 |
}
|
49 |
|
|
|
50 |
|
51 |
-
$file_src = wp_get_attachment_url($id);
|
52 |
-
|
53 |
-
echo $file_src;
|
54 |
die();
|
55 |
}
|
56 |
|
@@ -112,23 +149,25 @@ class acf_File extends acf_Field
|
|
112 |
|
113 |
function create_field($field)
|
114 |
{
|
|
|
115 |
// vars
|
116 |
-
$class = "";
|
117 |
-
$file_src = "";
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
132 |
|
133 |
}
|
134 |
|
@@ -247,7 +286,12 @@ class acf_File extends acf_Field
|
|
247 |
<script type="text/javascript">
|
248 |
(function($){
|
249 |
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
251 |
$('#media-items .media-item .filename a.acf-select').live('click', function(){
|
252 |
|
253 |
var id = $(this).attr('href');
|
@@ -266,7 +310,7 @@ class acf_File extends acf_Field
|
|
266 |
}
|
267 |
|
268 |
self.parent.acf_div.find('input.value').val(id);
|
269 |
-
|
270 |
self.parent.acf_div.addClass('active');
|
271 |
|
272 |
// validation
|
@@ -282,23 +326,37 @@ class acf_File extends acf_Field
|
|
282 |
});
|
283 |
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
var data = {
|
300 |
-
action: '
|
301 |
-
id:
|
302 |
};
|
303 |
|
304 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
@@ -309,37 +367,43 @@ class acf_File extends acf_Field
|
|
309 |
return false;
|
310 |
}
|
311 |
|
312 |
-
self.parent.acf_div.find('input.value').val(
|
313 |
-
|
314 |
self.parent.acf_div.addClass('active');
|
315 |
|
316 |
// validation
|
317 |
self.parent.acf_div.closest('.field').removeClass('error');
|
318 |
|
319 |
-
if((i+1) < total)
|
320 |
-
{
|
321 |
-
// add row
|
322 |
-
self.parent.acf_div.closest('.repeater').find('.table_footer #r_add_row').trigger('click');
|
323 |
-
|
324 |
-
// set acf_div to new row image
|
325 |
-
self.parent.acf_div = self.parent.acf_div.closest('.repeater').find('table tbody tr.row:last-child .acf_file_uploader');
|
326 |
-
}
|
327 |
-
else
|
328 |
-
{
|
329 |
-
// reset acf_div and return false
|
330 |
-
self.parent.acf_div = null;
|
331 |
-
self.parent.tb_remove();
|
332 |
-
}
|
333 |
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
|
344 |
|
345 |
// set a interval function to add buttons to media items
|
20 |
$this->title = __('File','acf');
|
21 |
|
22 |
add_action('admin_head-media-upload-popup', array($this, 'popup_head'));
|
23 |
+
add_action('wp_ajax_acf_select_file', array($this, 'ajax_select_file'));
|
24 |
add_filter('get_media_item_args', array($this, 'allow_file_insertion'));
|
25 |
}
|
26 |
|
27 |
|
28 |
/*--------------------------------------------------------------------------------------
|
29 |
*
|
30 |
+
* render_file
|
31 |
+
*
|
32 |
+
* @description : Renders the file html from an ID
|
33 |
+
* @author Elliot Condon
|
34 |
+
* @since 3.1.6
|
35 |
+
*
|
36 |
+
*-------------------------------------------------------------------------------------*/
|
37 |
+
|
38 |
+
function render_file($id = null)
|
39 |
+
{
|
40 |
+
if(!$id)
|
41 |
+
{
|
42 |
+
echo "";
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
// vars
|
48 |
+
$file_src = wp_get_attachment_url($id);
|
49 |
+
preg_match("~[^/]*$~", $file_src, $file_name);
|
50 |
+
$class = "active";
|
51 |
+
|
52 |
+
|
53 |
+
?>
|
54 |
+
<ul class="hl">
|
55 |
+
<li data-mime="<?php echo get_post_mime_type( $id ) ; ?>">
|
56 |
+
<img class="acf-file-icon" src="<?php echo wp_mime_type_icon( $id ); ?>" alt=""/>
|
57 |
+
</li>
|
58 |
+
<li>
|
59 |
+
<span class="acf-file-name"><?php echo $file_name[0]; ?></span><br />
|
60 |
+
<a href="javascript:;" class="acf-file-delete"><?php _e('Remove File','acf'); ?></a>
|
61 |
+
</li>
|
62 |
+
</ul>
|
63 |
+
<?php
|
64 |
+
|
65 |
+
}
|
66 |
+
|
67 |
+
/*--------------------------------------------------------------------------------------
|
68 |
+
*
|
69 |
+
* ajax_select_file
|
70 |
*
|
71 |
* @description ajax function to provide url of selected file
|
72 |
* @author Elliot Condon
|
74 |
*
|
75 |
*-------------------------------------------------------------------------------------*/
|
76 |
|
77 |
+
function ajax_select_file()
|
78 |
{
|
79 |
$id = isset($_POST['id']) ? $_POST['id'] : false;
|
80 |
|
86 |
die();
|
87 |
}
|
88 |
|
89 |
+
$this->render_file($id);
|
90 |
|
|
|
|
|
|
|
91 |
die();
|
92 |
}
|
93 |
|
149 |
|
150 |
function create_field($field)
|
151 |
{
|
152 |
+
|
153 |
// vars
|
154 |
+
$class = $field['value'] ? "active" : "";
|
|
|
155 |
|
156 |
+
?>
|
157 |
+
<div class="acf_file_uploader <?php echo $class; ?>">
|
158 |
+
<input class="value" type="hidden" name="<?php echo $field['name']; ?>" value="<?php echo $field['value']; ?>" />
|
159 |
+
<div class="has-file">
|
160 |
+
<?php $this->render_file( $field['value'] ); ?>
|
161 |
+
</div>
|
162 |
+
<div class="no-file">
|
163 |
+
<ul class="hl">
|
164 |
+
<li>
|
165 |
+
<span class="acf-file-name"><?php _e('No File Selected','acf'); ?></span>. <a href="javascript:;" class="button"><?php _e('Add File','acf'); ?></a>
|
166 |
+
</li>
|
167 |
+
</ul>
|
168 |
+
</div>
|
169 |
+
</div>
|
170 |
+
<?php
|
171 |
|
172 |
}
|
173 |
|
286 |
<script type="text/javascript">
|
287 |
(function($){
|
288 |
|
289 |
+
/*
|
290 |
+
* Select File
|
291 |
+
*
|
292 |
+
* @created : 29/03/2012
|
293 |
+
*/
|
294 |
+
|
295 |
$('#media-items .media-item .filename a.acf-select').live('click', function(){
|
296 |
|
297 |
var id = $(this).attr('href');
|
310 |
}
|
311 |
|
312 |
self.parent.acf_div.find('input.value').val(id);
|
313 |
+
self.parent.acf_div.find('.has-file').html(html);
|
314 |
self.parent.acf_div.addClass('active');
|
315 |
|
316 |
// validation
|
326 |
});
|
327 |
|
328 |
|
329 |
+
|
330 |
+
$('#acf-add-selected').live('click', function(){
|
331 |
+
|
332 |
+
// check total
|
333 |
+
var ids = [];
|
334 |
+
var i = -1;
|
335 |
+
|
336 |
+
$('#media-items .media-item .acf-checkbox:checked').each(function(){
|
337 |
+
ids.push($(this).val());
|
338 |
+
});
|
339 |
+
|
340 |
+
if(ids.length == 0)
|
341 |
+
{
|
342 |
+
alert("<?php _e("No files selected",'acf'); ?>");
|
343 |
+
return false;
|
344 |
+
}
|
345 |
+
|
346 |
+
|
347 |
+
function acf_add_next_file()
|
348 |
+
{
|
349 |
+
i++;
|
350 |
+
|
351 |
+
if(!ids[i])
|
352 |
+
{
|
353 |
+
return false;
|
354 |
+
}
|
355 |
+
|
356 |
+
var this_id = ids[i];
|
357 |
var data = {
|
358 |
+
action: 'acf_select_file',
|
359 |
+
id: this_id
|
360 |
};
|
361 |
|
362 |
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
367 |
return false;
|
368 |
}
|
369 |
|
370 |
+
self.parent.acf_div.find('input.value').val(this_id);
|
371 |
+
self.parent.acf_div.find('.has-file').html(html);
|
372 |
self.parent.acf_div.addClass('active');
|
373 |
|
374 |
// validation
|
375 |
self.parent.acf_div.closest('.field').removeClass('error');
|
376 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
|
378 |
+
if((i+1) < ids.length)
|
379 |
+
{
|
380 |
+
// add row
|
381 |
+
self.parent.acf_div.closest('.repeater').find('.table_footer #r_add_row').trigger('click');
|
382 |
+
|
383 |
+
// set acf_div to new row image
|
384 |
+
self.parent.acf_div = self.parent.acf_div.closest('.repeater').find('> table > tbody > tr.row:last-child .acf_file_uploader');
|
385 |
+
}
|
386 |
+
else
|
387 |
+
{
|
388 |
+
// reset acf_div and return false
|
389 |
+
self.parent.acf_div = null;
|
390 |
+
self.parent.tb_remove();
|
391 |
+
}
|
392 |
+
|
393 |
+
// add next image
|
394 |
+
acf_add_next_file();
|
395 |
+
|
396 |
+
|
397 |
+
});
|
398 |
+
|
399 |
+
}
|
400 |
+
acf_add_next_file();
|
401 |
+
|
402 |
+
|
403 |
+
return false;
|
404 |
+
|
405 |
+
});
|
406 |
+
|
407 |
|
408 |
|
409 |
// set a interval function to add buttons to media items
|
core/fields/flexible_content.php
CHANGED
@@ -35,7 +35,7 @@ class acf_Flexible_content extends acf_Field
|
|
35 |
|
36 |
function create_field($field)
|
37 |
{
|
38 |
-
|
39 |
$layouts = array();
|
40 |
foreach($field['layouts'] as $l)
|
41 |
{
|
@@ -46,7 +46,7 @@ class acf_Flexible_content extends acf_Field
|
|
46 |
<div class="acf_flexible_content">
|
47 |
|
48 |
<div class="no_value_message" <?php if($field['value']){echo 'style="display:none;"';} ?>>
|
49 |
-
<?php _e("Click the \"
|
50 |
</div>
|
51 |
|
52 |
<div class="clones">
|
@@ -151,8 +151,11 @@ class acf_Flexible_content extends acf_Field
|
|
151 |
</ul>
|
152 |
<div class="bit"></div>
|
153 |
</div>
|
154 |
-
<
|
155 |
-
|
|
|
|
|
|
|
156 |
</div>
|
157 |
|
158 |
</div>
|
@@ -177,6 +180,7 @@ class acf_Flexible_content extends acf_Field
|
|
177 |
// vars
|
178 |
$fields_names = array();
|
179 |
$field['layouts'] = isset($field['layouts']) ? $field['layouts'] : array();
|
|
|
180 |
|
181 |
// load default layout
|
182 |
if(empty($field['layouts']))
|
@@ -214,9 +218,9 @@ class acf_Flexible_content extends acf_Field
|
|
214 |
<td class="label">
|
215 |
<label><?php _e("Layout",'acf'); ?></label>
|
216 |
<p class="desription">
|
217 |
-
<span><a class="acf_fc_reorder" title="
|
218 |
-
<span><a class="acf_fc_add" title="
|
219 |
-
<span><a class="acf_fc_delete" title="Delete
|
220 |
</p>
|
221 |
</td>
|
222 |
<td>
|
@@ -355,16 +359,20 @@ class acf_Flexible_content extends acf_Field
|
|
355 |
</td>
|
356 |
</tr>
|
357 |
<?php
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
?>
|
362 |
<tr class="field_save">
|
363 |
<td class="label">
|
364 |
-
<label><?php _e("Save Field",'acf'); ?></label>
|
365 |
</td>
|
366 |
-
<td
|
367 |
-
|
|
|
|
|
|
|
|
|
368 |
</td>
|
369 |
</tr>
|
370 |
</tbody>
|
@@ -377,16 +385,26 @@ class acf_Flexible_content extends acf_Field
|
|
377 |
</div>
|
378 |
<div class="table_footer">
|
379 |
<div class="order_message"></div>
|
380 |
-
<a href="javascript:;" id="add_field" class="button
|
381 |
</div>
|
382 |
</div>
|
383 |
</td>
|
384 |
-
</tr
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
|
391 |
|
392 |
|
35 |
|
36 |
function create_field($field)
|
37 |
{
|
38 |
+
$button_label = ( isset($field['button_label']) && $field['button_label'] != "" ) ? $field['button_label'] : __("+ Add Row",'acf');
|
39 |
$layouts = array();
|
40 |
foreach($field['layouts'] as $l)
|
41 |
{
|
46 |
<div class="acf_flexible_content">
|
47 |
|
48 |
<div class="no_value_message" <?php if($field['value']){echo 'style="display:none;"';} ?>>
|
49 |
+
<?php _e("Click the \"$button_label\" button below to start creating your layout",'acf'); ?>
|
50 |
</div>
|
51 |
|
52 |
<div class="clones">
|
151 |
</ul>
|
152 |
<div class="bit"></div>
|
153 |
</div>
|
154 |
+
<ul class="hl clearfix">
|
155 |
+
<li class="right">
|
156 |
+
<a href="javascript:;" id="fc_add_row" class="add_row acf-button"><?php echo $button_label; ?></a>
|
157 |
+
</li>
|
158 |
+
</ul>
|
159 |
</div>
|
160 |
|
161 |
</div>
|
180 |
// vars
|
181 |
$fields_names = array();
|
182 |
$field['layouts'] = isset($field['layouts']) ? $field['layouts'] : array();
|
183 |
+
$field['button_label'] = (isset($field['button_label']) && $field['button_label'] != "") ? $field['button_label'] : __("+ Add Row",'acf');
|
184 |
|
185 |
// load default layout
|
186 |
if(empty($field['layouts']))
|
218 |
<td class="label">
|
219 |
<label><?php _e("Layout",'acf'); ?></label>
|
220 |
<p class="desription">
|
221 |
+
<span><a class="acf_fc_reorder" title="<?php _e("Reorder Layout",'acf'); ?>" href="javascript:;"><?php _e("Reorder",'acf'); ?></a> | </span>
|
222 |
+
<span><a class="acf_fc_add" title="<?php _e("Add New Layout",'acf'); ?>" href="javascript:;"><?php _e("Add New",'acf'); ?></a> | </span>
|
223 |
+
<span><a class="acf_fc_delete" title="<?php _e("Delete Layout",'acf'); ?>" href="javascript:;"><?php _e("Delete",'acf'); ?></a>
|
224 |
</p>
|
225 |
</td>
|
226 |
<td>
|
359 |
</td>
|
360 |
</tr>
|
361 |
<?php
|
362 |
+
|
363 |
+
$this->parent->fields[$sub_field['type']]->create_options($key.'][layouts][' . $layout_key . '][sub_fields]['.$key2, $sub_field);
|
364 |
+
|
365 |
?>
|
366 |
<tr class="field_save">
|
367 |
<td class="label">
|
368 |
+
<!-- <label><?php _e("Save Field",'acf'); ?></label> -->
|
369 |
</td>
|
370 |
+
<td>
|
371 |
+
<ul class="hl clearfix">
|
372 |
+
<li>
|
373 |
+
<a class="acf_edit_field acf-button grey" title="<?php _e("Close Field",'acf'); ?>" href="javascript:;"><?php _e("Close Sub Field",'acf'); ?></a>
|
374 |
+
</li>
|
375 |
+
</ul>
|
376 |
</td>
|
377 |
</tr>
|
378 |
</tbody>
|
385 |
</div>
|
386 |
<div class="table_footer">
|
387 |
<div class="order_message"></div>
|
388 |
+
<a href="javascript:;" id="add_field" class="acf-button"><?php _e('+ Add Field','acf'); ?></a>
|
389 |
</div>
|
390 |
</div>
|
391 |
</td>
|
392 |
+
</tr><?php endforeach; endif; ?>
|
393 |
+
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
394 |
+
<td class="label">
|
395 |
+
<label><?php _e("Button Label",'acf'); ?></label>
|
396 |
+
</td>
|
397 |
+
<td>
|
398 |
+
<?php
|
399 |
+
$this->parent->create_field(array(
|
400 |
+
'type' => 'text',
|
401 |
+
'name' => 'fields['.$key.'][button_label]',
|
402 |
+
'value' => $field['button_label'],
|
403 |
+
));
|
404 |
+
?>
|
405 |
+
</td>
|
406 |
+
</tr><?php
|
407 |
+
}
|
408 |
|
409 |
|
410 |
|
core/fields/image.php
CHANGED
@@ -21,43 +21,10 @@ class acf_Image extends acf_Field
|
|
21 |
$this->title = __('Image','acf');
|
22 |
|
23 |
add_action('admin_head-media-upload-popup', array($this, 'popup_head'));
|
24 |
-
add_action('wp_ajax_acf_select_image', array($this, 'select_image'));
|
25 |
add_filter('get_media_item_args', array($this, 'allow_img_insertion'));
|
26 |
}
|
27 |
|
28 |
|
29 |
-
/*--------------------------------------------------------------------------------------
|
30 |
-
*
|
31 |
-
* select_image
|
32 |
-
*
|
33 |
-
* @description ajax function to provide url of selected image
|
34 |
-
* @author Elliot Condon
|
35 |
-
* @since 3.1.5
|
36 |
-
*
|
37 |
-
*-------------------------------------------------------------------------------------*/
|
38 |
-
|
39 |
-
function select_image()
|
40 |
-
{
|
41 |
-
$id = isset($_POST['id']) ? $_POST['id'] : false;
|
42 |
-
$preview_size = isset($_POST['preview_size']) ? $_POST['preview_size'] : 'medium';
|
43 |
-
|
44 |
-
|
45 |
-
// attachment ID is required
|
46 |
-
if(!$id)
|
47 |
-
{
|
48 |
-
echo "";
|
49 |
-
die();
|
50 |
-
}
|
51 |
-
|
52 |
-
|
53 |
-
$file_src = wp_get_attachment_image_src($id, $preview_size);
|
54 |
-
$file_src = $file_src[0];
|
55 |
-
|
56 |
-
echo $file_src;
|
57 |
-
die();
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
/*--------------------------------------------------------------------------------------
|
62 |
*
|
63 |
* admin_print_scripts / admin_print_styles
|
@@ -275,101 +242,100 @@ class acf_Image extends acf_Field
|
|
275 |
<script type="text/javascript">
|
276 |
(function($){
|
277 |
|
278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
$('#media-items .media-item .filename a.acf-select').live('click', function(){
|
280 |
|
281 |
var id = $(this).attr('href');
|
|
|
282 |
|
283 |
-
var data = {
|
284 |
-
action: 'acf_select_image',
|
285 |
-
id: id,
|
286 |
-
preview_size : "<?php echo $preview_size; ?>"
|
287 |
-
};
|
288 |
-
|
289 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
290 |
-
$.post(ajaxurl, data, function(html) {
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
|
310 |
return false;
|
311 |
});
|
312 |
|
313 |
|
314 |
-
$('#acf-add-selected').live('click', function(){
|
315 |
-
|
316 |
-
// check total
|
317 |
var total = $('#media-items .media-item .acf-checkbox:checked').length;
|
318 |
-
if(total == 0)
|
319 |
-
{
|
320 |
-
alert("<?php _e("No images selected",'acf'); ?>");
|
321 |
-
return false;
|
322 |
-
}
|
323 |
|
|
|
|
|
324 |
$('#media-items .media-item .acf-checkbox:checked').each(function(i){
|
325 |
|
326 |
var id = $(this).val();
|
|
|
327 |
|
328 |
-
var data = {
|
329 |
-
action: 'acf_select_image',
|
330 |
-
id: id,
|
331 |
-
preview_size : "<?php echo $preview_size; ?>"
|
332 |
-
};
|
333 |
-
|
334 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
335 |
-
$.post(ajaxurl, data, function(html) {
|
336 |
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
if((i+1) < total)
|
350 |
-
{
|
351 |
-
// add row
|
352 |
-
self.parent.acf_div.closest('.repeater').find('.table_footer #r_add_row').trigger('click');
|
353 |
-
|
354 |
-
// set acf_div to new row image
|
355 |
-
self.parent.acf_div = self.parent.acf_div.closest('.repeater').find('table tbody tr.row:last-child .acf_image_uploader');
|
356 |
-
}
|
357 |
-
else
|
358 |
-
{
|
359 |
-
// reset acf_div and return false
|
360 |
-
self.parent.acf_div = null;
|
361 |
-
self.parent.tb_remove();
|
362 |
-
}
|
363 |
-
|
364 |
-
|
365 |
-
});
|
366 |
|
367 |
-
|
368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
|
370 |
return false;
|
371 |
-
|
372 |
-
});
|
373 |
|
374 |
|
375 |
// set a interval function to add buttons to media items
|
@@ -435,16 +401,6 @@ class acf_Image extends acf_Field
|
|
435 |
$(this).append('<input type="hidden" name="acf_preview_size" value="<?php echo $preview_size; ?>" />');
|
436 |
$(this).append('<input type="hidden" name="acf_type" value="image" />');
|
437 |
|
438 |
-
/*var action = $(this).attr('action');
|
439 |
-
if(action.indexOf("acf_type") == -1)
|
440 |
-
{
|
441 |
-
action += "&acf_type=image";
|
442 |
-
}
|
443 |
-
if(action.indexOf("acf_preview_size") == -1)
|
444 |
-
{
|
445 |
-
action += "&acf_preview_size=<?php echo $preview_size; ?>";
|
446 |
-
}
|
447 |
-
$(this).attr('action', action);*/
|
448 |
});
|
449 |
});
|
450 |
|
21 |
$this->title = __('Image','acf');
|
22 |
|
23 |
add_action('admin_head-media-upload-popup', array($this, 'popup_head'));
|
|
|
24 |
add_filter('get_media_item_args', array($this, 'allow_img_insertion'));
|
25 |
}
|
26 |
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/*--------------------------------------------------------------------------------------
|
29 |
*
|
30 |
* admin_print_scripts / admin_print_styles
|
242 |
<script type="text/javascript">
|
243 |
(function($){
|
244 |
|
245 |
+
/*
|
246 |
+
* Vars
|
247 |
+
*/
|
248 |
+
|
249 |
+
// generate the preview size (150x150)
|
250 |
+
var preview_size = "<?php echo get_option($preview_size . '_size_w'); ?>x<?php echo get_option($preview_size . '_size_h'); ?>";
|
251 |
+
|
252 |
+
|
253 |
+
/*
|
254 |
+
* Select Image
|
255 |
+
*
|
256 |
+
* @created : 28/03/2012
|
257 |
+
*/
|
258 |
+
|
259 |
$('#media-items .media-item .filename a.acf-select').live('click', function(){
|
260 |
|
261 |
var id = $(this).attr('href');
|
262 |
+
var src = $(this).closest('.media-item').find('img').attr('src');
|
263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
+
// image will be thumbnail size, find last 150x150.png and replace with 150x150.png
|
266 |
+
src = src.replace(/-([0-9]+)x([0-9]+)\.([a-zA-Z]{2,4})/, "-" + preview_size + ".$3");
|
267 |
+
|
268 |
+
|
269 |
+
// updae acf_div
|
270 |
+
self.parent.acf_div.find('input.value').val( id );
|
271 |
+
self.parent.acf_div.find('img').attr('src', src );
|
272 |
+
self.parent.acf_div.addClass('active');
|
273 |
+
|
274 |
+
|
275 |
+
// validation
|
276 |
+
self.parent.acf_div.closest('.field').removeClass('error');
|
277 |
+
|
278 |
+
|
279 |
+
// reset acf_div and return false
|
280 |
+
self.parent.acf_div = null;
|
281 |
+
self.parent.tb_remove();
|
282 |
|
283 |
return false;
|
284 |
});
|
285 |
|
286 |
|
287 |
+
$('#acf-add-selected').live('click', function(){
|
288 |
+
|
289 |
+
// check total
|
290 |
var total = $('#media-items .media-item .acf-checkbox:checked').length;
|
291 |
+
if(total == 0)
|
292 |
+
{
|
293 |
+
alert("<?php _e("No images selected",'acf'); ?>");
|
294 |
+
return false;
|
295 |
+
}
|
296 |
|
297 |
+
|
298 |
+
// loop through and add rows / images
|
299 |
$('#media-items .media-item .acf-checkbox:checked').each(function(i){
|
300 |
|
301 |
var id = $(this).val();
|
302 |
+
var src = $(this).closest('.media-item').find('img').attr('src');
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
|
305 |
+
// image will be thumbnail size, find last 150x150.png and replace with 150x150.png
|
306 |
+
src = src.replace(/-([0-9]+)x([0-9]+)\.([a-zA-Z]{2,4})/, "-" + preview_size + ".$3");
|
307 |
+
|
308 |
+
|
309 |
+
// update acf_div
|
310 |
+
self.parent.acf_div.find('input.value').val( id );
|
311 |
+
self.parent.acf_div.find('img').attr('src', src );
|
312 |
+
self.parent.acf_div.addClass('active');
|
313 |
+
|
314 |
+
|
315 |
+
// validation
|
316 |
+
self.parent.acf_div.closest('.field').removeClass('error');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
+
|
319 |
+
if((i+1) < total)
|
320 |
+
{
|
321 |
+
// add row
|
322 |
+
self.parent.acf_div.closest('.repeater').find('.table_footer #r_add_row').trigger('click');
|
323 |
+
|
324 |
+
// set acf_div to new row image
|
325 |
+
self.parent.acf_div = self.parent.acf_div.closest('.repeater').find('> table > tbody > tr.row:last-child .acf_image_uploader');
|
326 |
+
}
|
327 |
+
else
|
328 |
+
{
|
329 |
+
// reset acf_div and return false
|
330 |
+
self.parent.acf_div = null;
|
331 |
+
self.parent.tb_remove();
|
332 |
+
}
|
333 |
+
|
334 |
+
});
|
335 |
|
336 |
return false;
|
337 |
+
|
338 |
+
});
|
339 |
|
340 |
|
341 |
// set a interval function to add buttons to media items
|
401 |
$(this).append('<input type="hidden" name="acf_preview_size" value="<?php echo $preview_size; ?>" />');
|
402 |
$(this).append('<input type="hidden" name="acf_type" value="image" />');
|
403 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
});
|
405 |
});
|
406 |
|
core/fields/repeater.php
CHANGED
@@ -62,6 +62,8 @@ class acf_Repeater extends acf_Field
|
|
62 |
$row_limit = ( isset($field['row_limit']) && is_numeric($field['row_limit']) ) ? $field['row_limit'] : 999;
|
63 |
$layout = isset($field['layout']) ? $field['layout'] : 'table';
|
64 |
$sub_fields = isset($field['sub_fields']) ? $field['sub_fields'] : array();
|
|
|
|
|
65 |
|
66 |
// add clone field
|
67 |
if($row_limit == 1 && count($field['value']) == 0)
|
@@ -149,8 +151,11 @@ class acf_Repeater extends acf_Field
|
|
149 |
</table>
|
150 |
<?php if($row_limit > 1): ?>
|
151 |
<div class="table_footer">
|
152 |
-
<
|
153 |
-
|
|
|
|
|
|
|
154 |
</div>
|
155 |
<?php endif; ?>
|
156 |
</div>
|
@@ -176,6 +181,8 @@ class acf_Repeater extends acf_Field
|
|
176 |
$field['row_limit'] = isset($field['row_limit']) ? $field['row_limit'] : '';
|
177 |
$field['layout'] = isset($field['layout']) ? $field['layout'] : 'table';
|
178 |
$field['sub_fields'] = isset($field['sub_fields']) ? $field['sub_fields'] : array();
|
|
|
|
|
179 |
|
180 |
// add clone field
|
181 |
$field['sub_fields'][999] = array(
|
@@ -191,8 +198,8 @@ class acf_Repeater extends acf_Field
|
|
191 |
{
|
192 |
$fields_names[$f->name] = $f->title;
|
193 |
}
|
194 |
-
unset($fields_names['repeater']);
|
195 |
-
unset($fields_names['flexible_content']);
|
196 |
|
197 |
?>
|
198 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
@@ -296,16 +303,20 @@ class acf_Repeater extends acf_Field
|
|
296 |
</td>
|
297 |
</tr>
|
298 |
<?php
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
?>
|
303 |
<tr class="field_save">
|
304 |
<td class="label">
|
305 |
-
<label><?php _e("Save Field",'acf'); ?></label>
|
306 |
</td>
|
307 |
-
<td
|
308 |
-
|
|
|
|
|
|
|
|
|
309 |
</td>
|
310 |
</tr>
|
311 |
</tbody>
|
@@ -319,7 +330,7 @@ class acf_Repeater extends acf_Field
|
|
319 |
</div>
|
320 |
<div class="table_footer">
|
321 |
<div class="order_message"></div>
|
322 |
-
<a href="javascript:;" id="add_field" class="button
|
323 |
</div>
|
324 |
</div>
|
325 |
</td>
|
@@ -357,6 +368,20 @@ class acf_Repeater extends acf_Field
|
|
357 |
));
|
358 |
?>
|
359 |
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
</tr>
|
361 |
<?php
|
362 |
}
|
62 |
$row_limit = ( isset($field['row_limit']) && is_numeric($field['row_limit']) ) ? $field['row_limit'] : 999;
|
63 |
$layout = isset($field['layout']) ? $field['layout'] : 'table';
|
64 |
$sub_fields = isset($field['sub_fields']) ? $field['sub_fields'] : array();
|
65 |
+
$button_label = ( isset($field['button_label']) && $field['button_label'] != "" ) ? $field['button_label'] : __("+ Add Row",'acf');
|
66 |
+
|
67 |
|
68 |
// add clone field
|
69 |
if($row_limit == 1 && count($field['value']) == 0)
|
151 |
</table>
|
152 |
<?php if($row_limit > 1): ?>
|
153 |
<div class="table_footer">
|
154 |
+
<ul class="hl clearfix">
|
155 |
+
<li class="right">
|
156 |
+
<a href="javascript:;" id="r_add_row" class="add_row acf-button"><?php echo $button_label; ?></a>
|
157 |
+
</li>
|
158 |
+
</ul>
|
159 |
</div>
|
160 |
<?php endif; ?>
|
161 |
</div>
|
181 |
$field['row_limit'] = isset($field['row_limit']) ? $field['row_limit'] : '';
|
182 |
$field['layout'] = isset($field['layout']) ? $field['layout'] : 'table';
|
183 |
$field['sub_fields'] = isset($field['sub_fields']) ? $field['sub_fields'] : array();
|
184 |
+
$field['button_label'] = (isset($field['button_label']) && $field['button_label'] != "") ? $field['button_label'] : __("+ Add Row",'acf');
|
185 |
+
|
186 |
|
187 |
// add clone field
|
188 |
$field['sub_fields'][999] = array(
|
198 |
{
|
199 |
$fields_names[$f->name] = $f->title;
|
200 |
}
|
201 |
+
//unset($fields_names['repeater']);
|
202 |
+
//unset($fields_names['flexible_content']);
|
203 |
|
204 |
?>
|
205 |
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
303 |
</td>
|
304 |
</tr>
|
305 |
<?php
|
306 |
+
|
307 |
+
$this->parent->fields[$sub_field['type']]->create_options($key.'][sub_fields]['.$key2, $sub_field);
|
308 |
+
|
309 |
?>
|
310 |
<tr class="field_save">
|
311 |
<td class="label">
|
312 |
+
<!-- <label><?php _e("Save Field",'acf'); ?></label> -->
|
313 |
</td>
|
314 |
+
<td>
|
315 |
+
<ul class="hl clearfix">
|
316 |
+
<li>
|
317 |
+
<a class="acf_edit_field acf-button grey" title="<?php _e("Close Field",'acf'); ?>" href="javascript:;"><?php _e("Close Sub Field",'acf'); ?></a>
|
318 |
+
</li>
|
319 |
+
</ul>
|
320 |
</td>
|
321 |
</tr>
|
322 |
</tbody>
|
330 |
</div>
|
331 |
<div class="table_footer">
|
332 |
<div class="order_message"></div>
|
333 |
+
<a href="javascript:;" id="add_field" class="acf-button"><?php _e('+ Add Field','acf'); ?></a>
|
334 |
</div>
|
335 |
</div>
|
336 |
</td>
|
368 |
));
|
369 |
?>
|
370 |
</td>
|
371 |
+
</tr>
|
372 |
+
<tr class="field_option field_option_<?php echo $this->name; ?>">
|
373 |
+
<td class="label">
|
374 |
+
<label><?php _e("Button Label",'acf'); ?></label>
|
375 |
+
</td>
|
376 |
+
<td>
|
377 |
+
<?php
|
378 |
+
$this->parent->create_field(array(
|
379 |
+
'type' => 'text',
|
380 |
+
'name' => 'fields['.$key.'][button_label]',
|
381 |
+
'value' => $field['button_label'],
|
382 |
+
));
|
383 |
+
?>
|
384 |
+
</td>
|
385 |
</tr>
|
386 |
<?php
|
387 |
}
|
core/options_page.php
CHANGED
@@ -175,11 +175,11 @@ class Options_page
|
|
175 |
|
176 |
|
177 |
// Style
|
178 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$this->parent->dir.'/css/global.css" />';
|
179 |
-
echo '<link rel="stylesheet" type="text/css" href="'.$this->parent->dir.'/css/input.css" />';
|
180 |
|
181 |
// Javascript
|
182 |
-
echo '<script type="text/javascript" src="'.$this->parent->dir.'/js/input-actions.js" ></script>';
|
183 |
echo '<script type="text/javascript">
|
184 |
acf.validation_message = "' . __("Validation Failed. One or more fields below are required.",'acf') . '";
|
185 |
acf.post_id = 999999999;
|
@@ -287,10 +287,10 @@ class Options_page
|
|
287 |
|
288 |
<!-- Update -->
|
289 |
<div class="postbox">
|
290 |
-
<h3 class="hndle"><span><?php _e("
|
291 |
<div class="inside">
|
292 |
<input type="hidden" name="HTTP_REFERER" value="<?php echo $_SERVER['HTTP_REFERER'] ?>" />
|
293 |
-
<input type="submit" class="button
|
294 |
</div>
|
295 |
</div>
|
296 |
|
175 |
|
176 |
|
177 |
// Style
|
178 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->parent->dir.'/css/global.css?ver=' . $this->parent->version . '" />';
|
179 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->parent->dir.'/css/input.css?ver=' . $this->parent->version . '" />';
|
180 |
|
181 |
// Javascript
|
182 |
+
echo '<script type="text/javascript" src="'.$this->parent->dir.'/js/input-actions.js?ver=' . $this->parent->version . '" ></script>';
|
183 |
echo '<script type="text/javascript">
|
184 |
acf.validation_message = "' . __("Validation Failed. One or more fields below are required.",'acf') . '";
|
185 |
acf.post_id = 999999999;
|
287 |
|
288 |
<!-- Update -->
|
289 |
<div class="postbox">
|
290 |
+
<h3 class="hndle"><span><?php _e("Publish",'acf'); ?></span></h3>
|
291 |
<div class="inside">
|
292 |
<input type="hidden" name="HTTP_REFERER" value="<?php echo $_SERVER['HTTP_REFERER'] ?>" />
|
293 |
+
<input type="submit" class="acf-button" value="Save Options" name="update_options" />
|
294 |
</div>
|
295 |
</div>
|
296 |
|
css/fields.css
CHANGED
@@ -191,14 +191,26 @@ table.widefat.acf td {
|
|
191 |
|
192 |
.fields {
|
193 |
position: relative;
|
194 |
-
|
195 |
-
|
196 |
}
|
197 |
|
198 |
.fields .field {
|
199 |
position: relative;
|
200 |
overflow: hidden;
|
201 |
-
background: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
|
204 |
.fields .field:nth-child(even) {
|
@@ -247,15 +259,13 @@ table.widefat.acf td {
|
|
247 |
width: 161px;
|
248 |
height: 23px;
|
249 |
float: left;
|
250 |
-
margin-left:
|
251 |
}
|
252 |
|
253 |
#acf_fields .table_footer a#add_field{
|
254 |
display: block;
|
255 |
float: right;
|
256 |
margin: 0;
|
257 |
-
text-align: center;
|
258 |
-
width: 70px;
|
259 |
}
|
260 |
|
261 |
.inline_metabox {
|
@@ -352,11 +362,6 @@ table.acf_input tr td .acf tr td {
|
|
352 |
clear: both;
|
353 |
}
|
354 |
|
355 |
-
.field_form .field_option {
|
356 |
-
display: none;
|
357 |
-
}
|
358 |
-
|
359 |
-
|
360 |
/*---------------------------------------------------------------------------------------------
|
361 |
Location
|
362 |
---------------------------------------------------------------------------------------------*/
|
@@ -457,8 +462,9 @@ table#location_rules a.add:hover {
|
|
457 |
width: 50px;
|
458 |
}
|
459 |
|
460 |
-
table#location_rules
|
461 |
-
|
|
|
462 |
}
|
463 |
|
464 |
|
@@ -537,3 +543,47 @@ table.acf_input table.acf_cf_meta select {
|
|
537 |
.field_form table.acf_input .field_option_flexible_content > td {
|
538 |
background: #f9f9f9;
|
539 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
.fields {
|
193 |
position: relative;
|
194 |
+
background: #f1f1f1;
|
195 |
+
box-shadow: inset 0 0 0 1px #DFDFDF;
|
196 |
}
|
197 |
|
198 |
.fields .field {
|
199 |
position: relative;
|
200 |
overflow: hidden;
|
201 |
+
background: #F9F9F9;
|
202 |
+
}
|
203 |
+
|
204 |
+
#acf_fields .field.ui-sortable-helper {
|
205 |
+
|
206 |
+
}
|
207 |
+
#acf_fields .field.ui-sortable-helper {
|
208 |
+
border-top: 1px solid #DFDFDF;
|
209 |
+
border-bottom: 1px solid #DFDFDF;
|
210 |
+
}
|
211 |
+
|
212 |
+
#acf_fields .field.ui-sortable-placeholder + .field {
|
213 |
+
border-top: 1px solid #DFDFDF;
|
214 |
}
|
215 |
|
216 |
.fields .field:nth-child(even) {
|
259 |
width: 161px;
|
260 |
height: 23px;
|
261 |
float: left;
|
262 |
+
margin-left: 13px;
|
263 |
}
|
264 |
|
265 |
#acf_fields .table_footer a#add_field{
|
266 |
display: block;
|
267 |
float: right;
|
268 |
margin: 0;
|
|
|
|
|
269 |
}
|
270 |
|
271 |
.inline_metabox {
|
362 |
clear: both;
|
363 |
}
|
364 |
|
|
|
|
|
|
|
|
|
|
|
365 |
/*---------------------------------------------------------------------------------------------
|
366 |
Location
|
367 |
---------------------------------------------------------------------------------------------*/
|
462 |
width: 50px;
|
463 |
}
|
464 |
|
465 |
+
table#location_rules .acf-loading {
|
466 |
+
margin: 0 auto;
|
467 |
+
margin-top: -2px;
|
468 |
}
|
469 |
|
470 |
|
543 |
.field_form table.acf_input .field_option_flexible_content > td {
|
544 |
background: #f9f9f9;
|
545 |
}
|
546 |
+
|
547 |
+
|
548 |
+
/*---------------------------------------------------------------------------------------------
|
549 |
+
*
|
550 |
+
* Publish Metabox
|
551 |
+
*
|
552 |
+
*---------------------------------------------------------------------------------------------*/
|
553 |
+
|
554 |
+
.postbox {
|
555 |
+
min-width: 200px;
|
556 |
+
}
|
557 |
+
|
558 |
+
.inner-sidebar #side-sortables,
|
559 |
+
.columns-2 .inner-sidebar #side-sortables {
|
560 |
+
width: 200px;
|
561 |
+
}
|
562 |
+
|
563 |
+
.has-right-sidebar #side-info-column {
|
564 |
+
width: 200px;
|
565 |
+
}
|
566 |
+
|
567 |
+
.has-right-sidebar #post-body-content {
|
568 |
+
margin-right: 220px;
|
569 |
+
}
|
570 |
+
|
571 |
+
#submitdiv .acf-button {
|
572 |
+
width: 100%;
|
573 |
+
}
|
574 |
+
|
575 |
+
#submitdiv a.acf-button {
|
576 |
+
width: 150px;
|
577 |
+
margin: 0 0 10px;
|
578 |
+
}
|
579 |
+
|
580 |
+
#submitdiv #delete-action {
|
581 |
+
float: none;
|
582 |
+
}
|
583 |
+
#submitdiv #publishing-action {
|
584 |
+
float: none;
|
585 |
+
}
|
586 |
+
#submitdiv #publishing-action img {
|
587 |
+
display: none;
|
588 |
+
}
|
589 |
+
|
css/global.css
CHANGED
@@ -4,26 +4,30 @@
|
|
4 |
*
|
5 |
*--------------------------------------------------------------------------------------------*/
|
6 |
|
7 |
-
.hl {
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
padding: 0;
|
13 |
-
position: relative;
|
14 |
-
}
|
15 |
|
16 |
-
.
|
17 |
-
|
18 |
-
|
19 |
-
margin: 0;
|
20 |
-
padding: 0;
|
21 |
-
}
|
22 |
|
23 |
#icon-acf {
|
24 |
background: url(../images/acf-icon-32.png) 0 0 no-repeat !important;
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/*--------------------------------------------------------------------------------------------
|
28 |
*
|
29 |
* WP Box
|
@@ -125,6 +129,20 @@ table.acf_input tbody tr td.label {
|
|
125 |
border-right: #ebebeb solid 1px;
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
table.acf_input tbody tr td.label label{
|
129 |
display: block;
|
130 |
font-size: 12px;
|
@@ -144,7 +162,7 @@ table.acf_input tbody tr td.label label span.required {
|
|
144 |
|
145 |
table.acf_input tbody tr td.label p{
|
146 |
display: block;
|
147 |
-
font-size:
|
148 |
padding: 6px 0 !important;
|
149 |
margin: 0 !important;
|
150 |
font-style: normal;
|
@@ -196,3 +214,75 @@ ul.checkbox_list {
|
|
196 |
ul.checkbox_list input[type="checkbox"] {
|
197 |
margin-right: 5px;
|
198 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*
|
5 |
*--------------------------------------------------------------------------------------------*/
|
6 |
|
7 |
+
.hl { padding: 0; margin: 0; list-style: none; display: block; position: relative; }
|
8 |
+
.hl li { float: left; display: block; margin: 0; padding: 0; }
|
9 |
+
.hl li.right { float: right; }
|
10 |
+
.hl.center { position: relative; overflow: visible; left: 50%; float: left; }
|
11 |
+
.hl.center li { position: relative; left: -50%; }
|
|
|
|
|
|
|
12 |
|
13 |
+
.clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; visibility: hidden; }
|
14 |
+
.clearfix:after { clear: both; }
|
15 |
+
.clearfix { zoom: 1; }
|
|
|
|
|
|
|
16 |
|
17 |
#icon-acf {
|
18 |
background: url(../images/acf-icon-32.png) 0 0 no-repeat !important;
|
19 |
}
|
20 |
|
21 |
+
.acf-loading {
|
22 |
+
background: url("../../../../wp-admin/images/wpspin_light.gif") no-repeat scroll 50% 50% #EAEAEA;
|
23 |
+
border-radius: 30px;
|
24 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) inset;
|
25 |
+
height: 16px;
|
26 |
+
margin: 10px auto;
|
27 |
+
padding: 6px;
|
28 |
+
width: 16px;
|
29 |
+
}
|
30 |
+
|
31 |
/*--------------------------------------------------------------------------------------------
|
32 |
*
|
33 |
* WP Box
|
129 |
border-right: #ebebeb solid 1px;
|
130 |
}
|
131 |
|
132 |
+
table.acf_input td.label ul.hl {
|
133 |
+
margin: 20px 0 0;
|
134 |
+
}
|
135 |
+
table.acf_input td.label ul.hl li {
|
136 |
+
margin: 0 3px 0 0;
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
table.acf_input td.label ul.hl li a.acf-button {
|
141 |
+
font-size: 12px;
|
142 |
+
padding: 6px 10px;
|
143 |
+
font-weight: normal;
|
144 |
+
}
|
145 |
+
|
146 |
table.acf_input tbody tr td.label label{
|
147 |
display: block;
|
148 |
font-size: 12px;
|
162 |
|
163 |
table.acf_input tbody tr td.label p{
|
164 |
display: block;
|
165 |
+
font-size: 12px;
|
166 |
padding: 6px 0 !important;
|
167 |
margin: 0 !important;
|
168 |
font-style: normal;
|
214 |
ul.checkbox_list input[type="checkbox"] {
|
215 |
margin-right: 5px;
|
216 |
}
|
217 |
+
|
218 |
+
|
219 |
+
/*--------------------------------------------------------------------------------------------
|
220 |
+
*
|
221 |
+
* Buttons
|
222 |
+
*
|
223 |
+
*--------------------------------------------------------------------------------------------*/
|
224 |
+
|
225 |
+
a.acf-button,
|
226 |
+
input[type="submit"].acf-button {
|
227 |
+
display: block;
|
228 |
+
border-radius: 4px;
|
229 |
+
background: #2c8bbe;
|
230 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2c8bbe', endColorstr='#246f99'); /* for IE */
|
231 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#2c8bbe), to(#246f99)); /* for webkit browsers */
|
232 |
+
background: -moz-linear-gradient(top, #2c8bbe, #246f99); /* for firefox 3.6+ */
|
233 |
+
color: #FFFFFF;
|
234 |
+
font-weight: normal;
|
235 |
+
text-shadow: 0 1px 0 rgba(0,0,0,0.5);
|
236 |
+
font-size: 13px;
|
237 |
+
line-height: 1em;
|
238 |
+
padding: 6px 11px;
|
239 |
+
border: 0 none;
|
240 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
241 |
+
cursor: pointer;
|
242 |
+
position: relative;
|
243 |
+
text-align: center;
|
244 |
+
text-decoration: none;
|
245 |
+
}
|
246 |
+
|
247 |
+
a.acf-button:hover,
|
248 |
+
input[type="submit"].acf-button:hover {
|
249 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
|
250 |
+
background: #3b97c9;
|
251 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3b97c9', endColorstr='#246f99'); /* for IE */
|
252 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#3b97c9), to(#246f99)); /* for webkit browsers */
|
253 |
+
background: -moz-linear-gradient(top, #3b97c9, #246f99); /* for firefox 3.6+ */
|
254 |
+
}
|
255 |
+
|
256 |
+
a.acf-button:active,
|
257 |
+
input[type="submit"].acf-button:active {
|
258 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
259 |
+
top: 1px;
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
a.acf-button.grey,
|
264 |
+
input[type="submit"].acf-button.grey {
|
265 |
+
text-shadow: 0 1px 0 #fff;
|
266 |
+
color: #454545;
|
267 |
+
background: #fff;
|
268 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff', endColorstr='#ececec'); /* for IE */
|
269 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ececec)); /* for webkit browsers */
|
270 |
+
background: -moz-linear-gradient(top, #fff, #ececec); /* for firefox 3.6+ */
|
271 |
+
|
272 |
+
}
|
273 |
+
|
274 |
+
a.acf-button[disabled],
|
275 |
+
input[type="submit"].acf-button[disabled] {
|
276 |
+
opacity: 0.7;
|
277 |
+
}
|
278 |
+
|
279 |
+
a.acf-button[disabled]:hover,
|
280 |
+
input[type="submit"].acf-button[disabled]:hover {
|
281 |
+
background: #2c8bbe;
|
282 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#2c8bbe', endColorstr='#246f99'); /* for IE */
|
283 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#2c8bbe), to(#246f99)); /* for webkit browsers */
|
284 |
+
background: -moz-linear-gradient(top, #2c8bbe, #246f99); /* for firefox 3.6+ */
|
285 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
286 |
+
}
|
287 |
+
|
288 |
+
|
css/input.css
CHANGED
@@ -2,6 +2,11 @@
|
|
2 |
Post Box
|
3 |
---------------------------------------------------------------------------------------------*/
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
#poststuff .acf_postbox .inside {
|
6 |
margin: 0;
|
7 |
padding: 0;
|
@@ -71,9 +76,14 @@
|
|
71 |
display: none;
|
72 |
}
|
73 |
|
74 |
-
#poststuff .acf_postbox.no_box .field {
|
75 |
-
border-bottom: 1px solid #F4F4F4;
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
|
79 |
/*---------------------------------------------------------------------------------------------
|
@@ -139,6 +149,8 @@
|
|
139 |
cursor: pointer;
|
140 |
margin: -3px 0 0 -3px;
|
141 |
display: none;
|
|
|
|
|
142 |
}
|
143 |
|
144 |
.acf_image_uploader.active:hover a.remove_image {
|
@@ -172,28 +184,29 @@
|
|
172 |
---------------------------------------------------------------------------------------------*/
|
173 |
.acf_file_uploader {
|
174 |
position: relative;
|
|
|
175 |
}
|
176 |
|
177 |
-
.acf_file_uploader
|
178 |
-
margin: 0 !important;
|
179 |
-
}
|
180 |
-
|
181 |
-
.acf_file_uploader p.file {
|
182 |
display: none;
|
183 |
}
|
184 |
|
185 |
-
.acf_file_uploader
|
186 |
display: block;
|
187 |
}
|
188 |
|
189 |
-
.acf_file_uploader.active
|
190 |
display: block;
|
191 |
}
|
192 |
|
193 |
-
.acf_file_uploader.active
|
194 |
display: none;
|
195 |
}
|
196 |
|
|
|
|
|
|
|
|
|
197 |
|
198 |
/*---------------------------------------------------------------------------------------------
|
199 |
Repeater
|
@@ -240,11 +253,11 @@
|
|
240 |
border-right: 0 none;
|
241 |
}
|
242 |
|
243 |
-
.repeater > table > tbody > tr:hover a.remove_row {
|
244 |
visibility: visible;
|
245 |
}
|
246 |
|
247 |
-
.repeater.hide_remove_buttons > table > tbody > tr:hover a.remove_row {
|
248 |
visibility: hidden;
|
249 |
}
|
250 |
|
@@ -259,6 +272,8 @@ a.remove_row {
|
|
259 |
height: 16px;
|
260 |
background: url(../images/button_remove.png) 0 0 no-repeat;
|
261 |
visibility: hidden;
|
|
|
|
|
262 |
}
|
263 |
|
264 |
a.remove_row:hover {
|
@@ -307,20 +322,9 @@ a.remove_row:hover {
|
|
307 |
}
|
308 |
|
309 |
.repeater .table_footer {
|
310 |
-
position: relative;
|
311 |
-
overflow: hidden;
|
312 |
padding: 8px 0;
|
313 |
}
|
314 |
|
315 |
-
.repeater .table_footer a.add_row{
|
316 |
-
display: block;
|
317 |
-
float: right;
|
318 |
-
margin: 0;
|
319 |
-
text-align: center;
|
320 |
-
color: #fff;
|
321 |
-
text-decoration: none;
|
322 |
-
}
|
323 |
-
|
324 |
#acf_input .wp_themeSkin tr.mceFirst td.mceToolbar {
|
325 |
|
326 |
}
|
@@ -450,6 +454,8 @@ ul.checkbox_list {
|
|
450 |
cursor: pointer;
|
451 |
margin: 5px 9px 0 0;
|
452 |
display: none;
|
|
|
|
|
453 |
}
|
454 |
|
455 |
.acf_relationship .relationship_list a.sortable_active {
|
@@ -474,6 +480,8 @@ ul.checkbox_list {
|
|
474 |
cursor: pointer;
|
475 |
margin: 5px 9px 0 0;
|
476 |
display: none;
|
|
|
|
|
477 |
}
|
478 |
|
479 |
.acf_relationship .relationship_list a:hover .remove {
|
@@ -585,15 +593,6 @@ ul.checkbox_list {
|
|
585 |
padding: 8px 0;
|
586 |
}
|
587 |
|
588 |
-
.acf_flexible_content .table_footer a.add_row{
|
589 |
-
display: block;
|
590 |
-
float: right;
|
591 |
-
margin: 0;
|
592 |
-
text-align: center;
|
593 |
-
color: #fff;
|
594 |
-
text-decoration: none;
|
595 |
-
}
|
596 |
-
|
597 |
.acf_popup {
|
598 |
position: absolute;
|
599 |
bottom: 25px;
|
@@ -604,6 +603,8 @@ ul.checkbox_list {
|
|
604 |
margin-bottom: 25px;
|
605 |
margin-right: -5px;
|
606 |
display: none;
|
|
|
|
|
607 |
}
|
608 |
|
609 |
.has-right-sidebar .acf_popup {
|
@@ -611,7 +612,7 @@ ul.checkbox_list {
|
|
611 |
}
|
612 |
|
613 |
.has-right-sidebar .acf_popup .bit {
|
614 |
-
right:
|
615 |
}
|
616 |
|
617 |
.acf_popup .bit {
|
2 |
Post Box
|
3 |
---------------------------------------------------------------------------------------------*/
|
4 |
|
5 |
+
#poststuff .acf_postbox .widefat th,
|
6 |
+
#poststuff .acf_postbox .widefat td {
|
7 |
+
overflow: visible;
|
8 |
+
}
|
9 |
+
|
10 |
#poststuff .acf_postbox .inside {
|
11 |
margin: 0;
|
12 |
padding: 0;
|
76 |
display: none;
|
77 |
}
|
78 |
|
79 |
+
#poststuff .acf_postbox.no_box .field {
|
80 |
+
border-bottom: 1px solid #F4F4F4;
|
81 |
+
padding: 10px 0;
|
82 |
+
}
|
83 |
+
|
84 |
+
#poststuff .acf_postbox.no_box .field.error {
|
85 |
+
padding: 10px;
|
86 |
+
}
|
87 |
|
88 |
|
89 |
/*---------------------------------------------------------------------------------------------
|
149 |
cursor: pointer;
|
150 |
margin: -3px 0 0 -3px;
|
151 |
display: none;
|
152 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
153 |
+
border-radius: 8px;
|
154 |
}
|
155 |
|
156 |
.acf_image_uploader.active:hover a.remove_image {
|
184 |
---------------------------------------------------------------------------------------------*/
|
185 |
.acf_file_uploader {
|
186 |
position: relative;
|
187 |
+
line-height: 1.5em;
|
188 |
}
|
189 |
|
190 |
+
.acf_file_uploader .has-file {
|
|
|
|
|
|
|
|
|
191 |
display: none;
|
192 |
}
|
193 |
|
194 |
+
.acf_file_uploader .no-file {
|
195 |
display: block;
|
196 |
}
|
197 |
|
198 |
+
.acf_file_uploader.active .has-file {
|
199 |
display: block;
|
200 |
}
|
201 |
|
202 |
+
.acf_file_uploader.active .no-file {
|
203 |
display: none;
|
204 |
}
|
205 |
|
206 |
+
.acf_file_uploader img {
|
207 |
+
margin: 0 5px 0 0;
|
208 |
+
height:
|
209 |
+
}
|
210 |
|
211 |
/*---------------------------------------------------------------------------------------------
|
212 |
Repeater
|
253 |
border-right: 0 none;
|
254 |
}
|
255 |
|
256 |
+
.repeater > table > tbody > tr:hover >td.remove > a.remove_row {
|
257 |
visibility: visible;
|
258 |
}
|
259 |
|
260 |
+
.repeater.hide_remove_buttons > table > tbody > tr:hover >td.remove a.remove_row {
|
261 |
visibility: hidden;
|
262 |
}
|
263 |
|
272 |
height: 16px;
|
273 |
background: url(../images/button_remove.png) 0 0 no-repeat;
|
274 |
visibility: hidden;
|
275 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
276 |
+
border-radius: 8px;
|
277 |
}
|
278 |
|
279 |
a.remove_row:hover {
|
322 |
}
|
323 |
|
324 |
.repeater .table_footer {
|
|
|
|
|
325 |
padding: 8px 0;
|
326 |
}
|
327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
#acf_input .wp_themeSkin tr.mceFirst td.mceToolbar {
|
329 |
|
330 |
}
|
454 |
cursor: pointer;
|
455 |
margin: 5px 9px 0 0;
|
456 |
display: none;
|
457 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
458 |
+
border-radius: 8px;
|
459 |
}
|
460 |
|
461 |
.acf_relationship .relationship_list a.sortable_active {
|
480 |
cursor: pointer;
|
481 |
margin: 5px 9px 0 0;
|
482 |
display: none;
|
483 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
484 |
+
border-radius: 8px;
|
485 |
}
|
486 |
|
487 |
.acf_relationship .relationship_list a:hover .remove {
|
593 |
padding: 8px 0;
|
594 |
}
|
595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
.acf_popup {
|
597 |
position: absolute;
|
598 |
bottom: 25px;
|
603 |
margin-bottom: 25px;
|
604 |
margin-right: -5px;
|
605 |
display: none;
|
606 |
+
min-width: 135px;
|
607 |
+
z-index: 99;
|
608 |
}
|
609 |
|
610 |
.has-right-sidebar .acf_popup {
|
612 |
}
|
613 |
|
614 |
.has-right-sidebar .acf_popup .bit {
|
615 |
+
right: 37px;
|
616 |
}
|
617 |
|
618 |
.acf_popup .bit {
|
js/fields.js
CHANGED
@@ -1,22 +1,107 @@
|
|
1 |
(function($){
|
2 |
|
3 |
-
|
4 |
-
*
|
5 |
-
*
|
6 |
-
*
|
7 |
-
|
|
|
8 |
|
9 |
$.fn.exists = function()
|
10 |
{
|
11 |
return $(this).length>0;
|
12 |
};
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
function uniqid()
|
15 |
{
|
16 |
var newDate = new Date;
|
17 |
return newDate.getTime();
|
18 |
}
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/*----------------------------------------------------------------------
|
21 |
*
|
22 |
* Update Names
|
@@ -139,32 +224,7 @@
|
|
139 |
});
|
140 |
|
141 |
|
142 |
-
|
143 |
-
$('#acf_fields tr.field_type select').live('change', function(){
|
144 |
-
|
145 |
-
var tbody = $(this).closest('tbody');
|
146 |
-
var type = $(this).val();
|
147 |
-
|
148 |
-
tbody.children('tr.field_option').hide();
|
149 |
-
tbody.children('tr.field_option').find('[name]').attr('disabled', 'true');
|
150 |
-
|
151 |
-
var tr = tbody.children('tr.field_option_'+type);
|
152 |
-
tr.find('[name]').removeAttr('disabled');
|
153 |
-
|
154 |
-
var tr_top = tbody.children('tr.field_type');
|
155 |
-
|
156 |
-
tr.insertAfter(tr_top);
|
157 |
-
tr.show();
|
158 |
-
|
159 |
-
// firefox radio button fix
|
160 |
-
tr.find('input[type="radio"][data-checked="checked"]').each(function(){
|
161 |
-
|
162 |
-
$(this).removeAttr('checked').attr('checked', 'checked');
|
163 |
-
|
164 |
-
});
|
165 |
-
|
166 |
-
|
167 |
-
}).trigger('change');
|
168 |
|
169 |
|
170 |
// Add Field Button
|
@@ -281,7 +341,9 @@
|
|
281 |
update: function(event, ui){
|
282 |
update_order_numbers();
|
283 |
},
|
284 |
-
handle: 'td.field_order'
|
|
|
|
|
285 |
});
|
286 |
});
|
287 |
|
@@ -296,45 +358,64 @@
|
|
296 |
|
297 |
function setup_rules()
|
298 |
{
|
299 |
-
|
|
|
300 |
|
301 |
|
302 |
-
//
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
var val = $(this).val();
|
307 |
-
|
308 |
-
|
309 |
-
// does it have options?
|
310 |
-
if(!$(this).find('option[value="options_page"]').exists())
|
311 |
-
{
|
312 |
-
//console.log('select: '+type+'. parent length: '+$(this).closest('.repeater').length);
|
313 |
-
$(this).append('<option value="options_page" disabled="true">Options Page (Unlock field with activation code)</option>');
|
314 |
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
|
321 |
-
tr.find('td.value div[rel="'+val+'"]').show();
|
322 |
-
tr.find('td.value div[rel="'+val+'"] [name]').removeAttr('disabled');
|
323 |
|
324 |
-
})
|
325 |
|
326 |
|
327 |
// Add Button
|
328 |
-
|
329 |
|
330 |
-
var tr_count = $(this).closest('tbody').children('tr').length;
|
331 |
var tr = $(this).closest('tr').clone();
|
332 |
|
333 |
-
|
334 |
|
335 |
-
|
336 |
|
337 |
-
|
338 |
|
339 |
return false;
|
340 |
|
@@ -342,39 +423,33 @@
|
|
342 |
|
343 |
|
344 |
// Remove Button
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
346 |
|
347 |
var tr = $(this).closest('tr').remove();
|
348 |
|
349 |
-
|
|
|
|
|
|
|
350 |
|
351 |
return false;
|
352 |
|
353 |
});
|
354 |
|
355 |
-
|
356 |
{
|
357 |
-
|
358 |
-
{
|
359 |
-
tbody.children('tr').each(function(){
|
360 |
-
$(this).find('td.buttons a.remove').addClass('disabled');
|
361 |
-
});
|
362 |
-
}
|
363 |
-
else
|
364 |
-
{
|
365 |
-
tbody.children('tr').each(function(){
|
366 |
-
$(this).find('td.buttons a.remove').removeClass('disabled');
|
367 |
-
});
|
368 |
-
}
|
369 |
-
|
370 |
}
|
371 |
|
372 |
-
|
373 |
-
|
374 |
-
function update_names()
|
375 |
{
|
376 |
-
|
377 |
-
|
378 |
$(this).find('[name]').each(function(){
|
379 |
|
380 |
var name = $(this).attr('name').split("][");
|
@@ -397,12 +472,9 @@
|
|
397 |
|
398 |
$(document).ready(function(){
|
399 |
|
400 |
-
//
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
// add active to Settings Menu
|
405 |
-
//$('#adminmenu #menu-settings').removeClass('wp-not-current-submenu').addClass('current wp-menu-open wp-has-current-submenu');
|
406 |
|
407 |
// setup fields
|
408 |
setup_fields();
|
@@ -418,13 +490,6 @@
|
|
418 |
* @created: 3/03/2011
|
419 |
*/
|
420 |
|
421 |
-
function uniqid()
|
422 |
-
{
|
423 |
-
var newDate = new Date;
|
424 |
-
return newDate.getTime();
|
425 |
-
}
|
426 |
-
|
427 |
-
|
428 |
/*----------------------------------------------------------------------
|
429 |
*
|
430 |
* Add Layout Option
|
@@ -463,7 +528,9 @@
|
|
463 |
|
464 |
// add drag / drop
|
465 |
new_tr.find('.fields').sortable({
|
466 |
-
handle: 'td.field_order'
|
|
|
|
|
467 |
});
|
468 |
|
469 |
return false;
|
@@ -517,7 +584,9 @@
|
|
517 |
items: ".field_option_flexible_content",
|
518 |
handle: 'a.acf_fc_reorder',
|
519 |
helper: fixHelper,
|
520 |
-
placeholder: "ui-state-highlight"
|
|
|
|
|
521 |
});
|
522 |
|
523 |
});
|
1 |
(function($){
|
2 |
|
3 |
+
/*
|
4 |
+
* Exists
|
5 |
+
*
|
6 |
+
* @since 3.1.6
|
7 |
+
* @description returns true or false on a element's existance
|
8 |
+
*/
|
9 |
|
10 |
$.fn.exists = function()
|
11 |
{
|
12 |
return $(this).length>0;
|
13 |
};
|
14 |
+
|
15 |
+
|
16 |
+
/*
|
17 |
+
* uniqid
|
18 |
+
*
|
19 |
+
* @since 3.1.6
|
20 |
+
* @description Returns a unique ID (secconds of time)
|
21 |
+
*/
|
22 |
+
|
23 |
function uniqid()
|
24 |
{
|
25 |
var newDate = new Date;
|
26 |
return newDate.getTime();
|
27 |
}
|
28 |
|
29 |
+
|
30 |
+
/*
|
31 |
+
* Place Confirm message on Publish trash button
|
32 |
+
*
|
33 |
+
* @since 3.1.6
|
34 |
+
* @description
|
35 |
+
*/
|
36 |
+
|
37 |
+
$('#submit-delete').live('click', function(){
|
38 |
+
|
39 |
+
var response = confirm(acf_messages.move_to_trash);
|
40 |
+
if(!response)
|
41 |
+
{
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
});
|
46 |
+
|
47 |
+
|
48 |
+
/*
|
49 |
+
* acf/update_field_options
|
50 |
+
*
|
51 |
+
* @since 3.1.6
|
52 |
+
* @description Load in the opions html
|
53 |
+
*/
|
54 |
+
|
55 |
+
$('#acf_fields tr.field_type select').live('change', function(){
|
56 |
+
|
57 |
+
var tbody = $(this).closest('tbody');
|
58 |
+
|
59 |
+
// show field options if they already exist
|
60 |
+
if(tbody.children('tr.field_option_'+$(this).val()).exists())
|
61 |
+
{
|
62 |
+
// hide + disable options
|
63 |
+
tbody.children('tr.field_option').hide().find('[name]').attr('disabled', 'true');
|
64 |
+
|
65 |
+
// show and enable options
|
66 |
+
tbody.children('tr.field_option_'+$(this).val()).show().find('[name]').removeAttr('disabled');
|
67 |
+
}
|
68 |
+
else
|
69 |
+
{
|
70 |
+
// add loading gif
|
71 |
+
var tr = $('<tr"><td class="label"></td><td><div class="acf-loading"></div></td></tr>');
|
72 |
+
|
73 |
+
// hide current options
|
74 |
+
tbody.children('tr.field_option').hide().find('[name]').attr('disabled', 'true');
|
75 |
+
|
76 |
+
// append tr
|
77 |
+
tbody.children('tr.field_save').before(tr);
|
78 |
+
|
79 |
+
var ajax_data = {
|
80 |
+
action : "acf_field_options",
|
81 |
+
post_id : $('#post_ID').val(),
|
82 |
+
field_key : $(this).attr('name'),
|
83 |
+
field_type : $(this).val()
|
84 |
+
};
|
85 |
+
|
86 |
+
$.ajax({
|
87 |
+
url: ajaxurl,
|
88 |
+
data: ajax_data,
|
89 |
+
type: 'post',
|
90 |
+
dataType: 'html',
|
91 |
+
success: function(html){
|
92 |
+
|
93 |
+
tr.replaceWith(html);
|
94 |
+
|
95 |
+
}
|
96 |
+
});
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
|
101 |
+
});
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
/*----------------------------------------------------------------------
|
106 |
*
|
107 |
* Update Names
|
224 |
});
|
225 |
|
226 |
|
227 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
|
230 |
// Add Field Button
|
341 |
update: function(event, ui){
|
342 |
update_order_numbers();
|
343 |
},
|
344 |
+
handle: 'td.field_order',
|
345 |
+
axis: "y",
|
346 |
+
revert: true
|
347 |
});
|
348 |
});
|
349 |
|
358 |
|
359 |
function setup_rules()
|
360 |
{
|
361 |
+
// vars
|
362 |
+
var location_rules = $('table#location_rules');
|
363 |
|
364 |
|
365 |
+
// does it have options?
|
366 |
+
if(!location_rules.find('td.param select option[value="options_page"]').exists())
|
367 |
+
{
|
368 |
+
location_rules.find('td.param select').append('<option value="options_page" disabled="true">Options Page (Unlock field with activation code)</option>');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
// show field type options
|
374 |
+
location_rules.find('td.param select').live('change', function(){
|
375 |
+
|
376 |
+
// vars
|
377 |
+
var tr = $(this).closest('tr');
|
378 |
+
var key = $(this).attr('name').split("]["); key = key[1];
|
379 |
+
var ajax_data = {
|
380 |
+
'action' : "acf_location",
|
381 |
+
'key' : key,
|
382 |
+
'value' : '',
|
383 |
+
'param' : $(this).val()
|
384 |
+
};
|
385 |
+
|
386 |
+
|
387 |
+
// add loading gif
|
388 |
+
var div = $('<div class="acf-loading"></div>');
|
389 |
+
tr.find('td.value').html(div);
|
390 |
+
|
391 |
+
|
392 |
+
// load location html
|
393 |
+
$.ajax({
|
394 |
+
url: ajaxurl,
|
395 |
+
data: ajax_data,
|
396 |
+
type: 'post',
|
397 |
+
dataType: 'html',
|
398 |
+
success: function(html){
|
399 |
+
|
400 |
+
div.replaceWith(html);
|
401 |
+
|
402 |
+
}
|
403 |
+
});
|
404 |
|
|
|
|
|
405 |
|
406 |
+
});
|
407 |
|
408 |
|
409 |
// Add Button
|
410 |
+
location_rules.find('td.buttons a.add').live('click',function(){
|
411 |
|
|
|
412 |
var tr = $(this).closest('tr').clone();
|
413 |
|
414 |
+
$(this).closest('tr').after(tr);
|
415 |
|
416 |
+
update_location_names();
|
417 |
|
418 |
+
location_rules.find('td.buttons a.remove').removeClass('disabled');
|
419 |
|
420 |
return false;
|
421 |
|
423 |
|
424 |
|
425 |
// Remove Button
|
426 |
+
location_rules.find('td.buttons a.remove').live('click',function(){
|
427 |
+
|
428 |
+
if($(this).hasClass('disabled'))
|
429 |
+
{
|
430 |
+
return false;
|
431 |
+
}
|
432 |
|
433 |
var tr = $(this).closest('tr').remove();
|
434 |
|
435 |
+
if(location_rules.find('tr').length <= 1)
|
436 |
+
{
|
437 |
+
location_rules.find('td.buttons a.remove').addClass('disabled');
|
438 |
+
}
|
439 |
|
440 |
return false;
|
441 |
|
442 |
});
|
443 |
|
444 |
+
if(location_rules.find('tr').length <= 1)
|
445 |
{
|
446 |
+
location_rules.find('td.buttons a.remove').addClass('disabled');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
}
|
448 |
|
449 |
+
function update_location_names()
|
|
|
|
|
450 |
{
|
451 |
+
location_rules.find('tr').each(function(i){
|
452 |
+
|
453 |
$(this).find('[name]').each(function(){
|
454 |
|
455 |
var name = $(this).attr('name').split("][");
|
472 |
|
473 |
$(document).ready(function(){
|
474 |
|
475 |
+
// custom Publish metabox
|
476 |
+
$('#submitdiv #publish').attr('class', 'acf-button');
|
477 |
+
$('#submitdiv a.submitdelete').attr('class', 'acf-button grey').attr('id', 'submit-delete');
|
|
|
|
|
|
|
478 |
|
479 |
// setup fields
|
480 |
setup_fields();
|
490 |
* @created: 3/03/2011
|
491 |
*/
|
492 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
/*----------------------------------------------------------------------
|
494 |
*
|
495 |
* Add Layout Option
|
528 |
|
529 |
// add drag / drop
|
530 |
new_tr.find('.fields').sortable({
|
531 |
+
handle: 'td.field_order',
|
532 |
+
axis: "y",
|
533 |
+
revert: true
|
534 |
});
|
535 |
|
536 |
return false;
|
584 |
items: ".field_option_flexible_content",
|
585 |
handle: 'a.acf_fc_reorder',
|
586 |
helper: fixHelper,
|
587 |
+
placeholder: "ui-state-highlight",
|
588 |
+
axis: "y",
|
589 |
+
revert: true
|
590 |
});
|
591 |
|
592 |
});
|
js/input-actions.js
CHANGED
@@ -117,7 +117,7 @@ var acf = {
|
|
117 |
{
|
118 |
validation = false;
|
119 |
}
|
120 |
-
console.log(validation);
|
121 |
|
122 |
}
|
123 |
|
@@ -220,7 +220,7 @@ var acf = {
|
|
220 |
* @created: 1/03/2011
|
221 |
*/
|
222 |
|
223 |
-
$('#poststuff .acf_file_uploader .
|
224 |
|
225 |
// vars
|
226 |
var div = $(this).closest('.acf_file_uploader');
|
@@ -234,7 +234,7 @@ var acf = {
|
|
234 |
return false;
|
235 |
});
|
236 |
|
237 |
-
$('#poststuff .acf_file_uploader .file
|
238 |
|
239 |
// vars
|
240 |
var div = $(this).closest('.acf_file_uploader');
|
@@ -288,7 +288,7 @@ var acf = {
|
|
288 |
*/
|
289 |
|
290 |
// on mouse over, make list sortable
|
291 |
-
$('.acf_relationship').live('mouseenter', function(){
|
292 |
|
293 |
if($(this).attr('data-is_setup')) return false;
|
294 |
|
@@ -474,6 +474,18 @@ var acf = {
|
|
474 |
};
|
475 |
|
476 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
$(window).load(function(){
|
478 |
|
479 |
if(typeof(tinyMCE) != "object")
|
@@ -487,8 +499,8 @@ var acf = {
|
|
487 |
acf_wysiwyg_buttons.theme_advanced_buttons1 = tinyMCE.settings.theme_advanced_buttons1;
|
488 |
acf_wysiwyg_buttons.theme_advanced_buttons2 = tinyMCE.settings.theme_advanced_buttons2;
|
489 |
}
|
490 |
-
|
491 |
-
$('#poststuff')
|
492 |
|
493 |
// if editor_mode == html, toggle the html mode button on the default editor
|
494 |
if(acf.editor_mode && acf.editor_mode == "html")
|
@@ -559,15 +571,16 @@ var acf = {
|
|
559 |
update: function(event, ui){
|
560 |
update_r_order_numbers(div);
|
561 |
},
|
562 |
-
|
563 |
-
|
|
|
|
|
564 |
});
|
565 |
};
|
566 |
|
567 |
-
|
568 |
-
$(document).ready(function(){
|
569 |
|
570 |
-
$('
|
571 |
|
572 |
var div = $(this);
|
573 |
var row_limit = parseInt(div.attr('data-row_limit'));
|
@@ -621,7 +634,8 @@ var acf = {
|
|
621 |
div.children('table').children('tbody').append(new_field);
|
622 |
|
623 |
// activate wysiwyg
|
624 |
-
|
|
|
625 |
|
626 |
update_r_order_numbers(div);
|
627 |
|
@@ -629,7 +643,7 @@ var acf = {
|
|
629 |
row_count ++;
|
630 |
|
631 |
// disable the add field button if row limit is reached
|
632 |
-
if(
|
633 |
{
|
634 |
div.find('#r_add_row').attr('disabled','true');
|
635 |
}
|
@@ -684,7 +698,9 @@ var acf = {
|
|
684 |
update: function(event, ui){
|
685 |
update_fc_order_numbers(div);
|
686 |
},
|
687 |
-
|
|
|
|
|
688 |
});
|
689 |
}
|
690 |
|
@@ -695,12 +711,12 @@ var acf = {
|
|
695 |
if($(this).hasClass('active'))
|
696 |
{
|
697 |
$(this).removeClass('active');
|
698 |
-
$(this).
|
699 |
}
|
700 |
else
|
701 |
{
|
702 |
$(this).addClass('active');
|
703 |
-
$(this).
|
704 |
}
|
705 |
});
|
706 |
|
@@ -763,7 +779,8 @@ var acf = {
|
|
763 |
div.children('.values').append(new_field);
|
764 |
|
765 |
// activate wysiwyg
|
766 |
-
|
|
|
767 |
|
768 |
update_fc_order_numbers(div);
|
769 |
|
@@ -779,9 +796,9 @@ var acf = {
|
|
779 |
});
|
780 |
|
781 |
|
782 |
-
$(document).
|
783 |
|
784 |
-
$('
|
785 |
|
786 |
// sortable
|
787 |
make_fc_sortable($(this));
|
117 |
{
|
118 |
validation = false;
|
119 |
}
|
120 |
+
//console.log(validation);
|
121 |
|
122 |
}
|
123 |
|
220 |
* @created: 1/03/2011
|
221 |
*/
|
222 |
|
223 |
+
$('#poststuff .acf_file_uploader .no-file .button').live('click', function(){
|
224 |
|
225 |
// vars
|
226 |
var div = $(this).closest('.acf_file_uploader');
|
234 |
return false;
|
235 |
});
|
236 |
|
237 |
+
$('#poststuff .acf_file_uploader .acf-file-delete').live('click', function(){
|
238 |
|
239 |
// vars
|
240 |
var div = $(this).closest('.acf_file_uploader');
|
288 |
*/
|
289 |
|
290 |
// on mouse over, make list sortable
|
291 |
+
$('#poststuff .acf_relationship').live('mouseenter', function(){
|
292 |
|
293 |
if($(this).attr('data-is_setup')) return false;
|
294 |
|
474 |
};
|
475 |
|
476 |
|
477 |
+
// create wysiwygs
|
478 |
+
$(document).live('acf/setup_fields', function(e, postbox){
|
479 |
+
|
480 |
+
if(typeof(tinyMCE) != "object")
|
481 |
+
{
|
482 |
+
return false;
|
483 |
+
}
|
484 |
+
|
485 |
+
$(postbox).acf_activate_wysiwyg();
|
486 |
+
|
487 |
+
});
|
488 |
+
|
489 |
$(window).load(function(){
|
490 |
|
491 |
if(typeof(tinyMCE) != "object")
|
499 |
acf_wysiwyg_buttons.theme_advanced_buttons1 = tinyMCE.settings.theme_advanced_buttons1;
|
500 |
acf_wysiwyg_buttons.theme_advanced_buttons2 = tinyMCE.settings.theme_advanced_buttons2;
|
501 |
}
|
502 |
+
|
503 |
+
$(document).trigger('acf/setup_fields', $('#poststuff'));
|
504 |
|
505 |
// if editor_mode == html, toggle the html mode button on the default editor
|
506 |
if(acf.editor_mode && acf.editor_mode == "html")
|
571 |
update: function(event, ui){
|
572 |
update_r_order_numbers(div);
|
573 |
},
|
574 |
+
items : '> tr',
|
575 |
+
handle: '> td.order',
|
576 |
+
helper: fixHelper,
|
577 |
+
axis: "y" // limit the dragging to up/down only
|
578 |
});
|
579 |
};
|
580 |
|
581 |
+
$(document).live('acf/setup_fields', function(e, postbox){
|
|
|
582 |
|
583 |
+
$(postbox).find('.repeater').each(function(){
|
584 |
|
585 |
var div = $(this);
|
586 |
var row_limit = parseInt(div.attr('data-row_limit'));
|
634 |
div.children('table').children('tbody').append(new_field);
|
635 |
|
636 |
// activate wysiwyg
|
637 |
+
$(document).trigger('acf/setup_fields',new_field);
|
638 |
+
//new_field.acf_activate_wysiwyg();
|
639 |
|
640 |
update_r_order_numbers(div);
|
641 |
|
643 |
row_count ++;
|
644 |
|
645 |
// disable the add field button if row limit is reached
|
646 |
+
if(row_count >= row_limit)
|
647 |
{
|
648 |
div.find('#r_add_row').attr('disabled','true');
|
649 |
}
|
698 |
update: function(event, ui){
|
699 |
update_fc_order_numbers(div);
|
700 |
},
|
701 |
+
items : '> table',
|
702 |
+
handle: '> tbody > tr > td.order',
|
703 |
+
axis: "y" // limit the dragging to up/down only
|
704 |
});
|
705 |
}
|
706 |
|
711 |
if($(this).hasClass('active'))
|
712 |
{
|
713 |
$(this).removeClass('active');
|
714 |
+
$(this).closest('.table_footer').find('.acf_popup').animate({ opacity : 0, bottom : '35px' }, 250);
|
715 |
}
|
716 |
else
|
717 |
{
|
718 |
$(this).addClass('active');
|
719 |
+
$(this).closest('.table_footer').find('.acf_popup').css({display : 'block', opacity : 0, bottom : '15px'}).animate({ opacity : 1, bottom : '25px' }, 250);
|
720 |
}
|
721 |
});
|
722 |
|
779 |
div.children('.values').append(new_field);
|
780 |
|
781 |
// activate wysiwyg
|
782 |
+
$(document).trigger('acf/setup_fields',new_field);
|
783 |
+
//new_field.acf_activate_wysiwyg();
|
784 |
|
785 |
update_fc_order_numbers(div);
|
786 |
|
796 |
});
|
797 |
|
798 |
|
799 |
+
$(document).live('acf/setup_fields', function(e, postbox){
|
800 |
|
801 |
+
$(postbox).find('.acf_flexible_content').each(function(){
|
802 |
|
803 |
// sortable
|
804 |
make_fc_sortable($(this));
|
js/input-ajax.js
CHANGED
@@ -64,7 +64,7 @@
|
|
64 |
var id = $(this).attr('id').replace('acf_', '');
|
65 |
|
66 |
// layout
|
67 |
-
$(this).addClass(
|
68 |
|
69 |
// show / hide
|
70 |
if(show == 'true')
|
@@ -87,6 +87,8 @@
|
|
87 |
|
88 |
function update_fields()
|
89 |
{
|
|
|
|
|
90 |
$.ajax({
|
91 |
url: ajaxurl,
|
92 |
data: acf.data,
|
@@ -98,10 +100,46 @@
|
|
98 |
$('#poststuff .acf_postbox').hide();
|
99 |
$('#adv-settings .acf_hide_label').hide();
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
// show the new postboxes
|
102 |
$.each(result, function(k, v) {
|
103 |
-
|
|
|
|
|
|
|
104 |
$('#adv-settings .acf_hide_label[for="acf_' + v + '-hide"]').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
});
|
106 |
|
107 |
// load style
|
@@ -156,7 +194,7 @@
|
|
156 |
|
157 |
});
|
158 |
|
159 |
-
$('#
|
160 |
|
161 |
acf.data.post_category = ['0'];
|
162 |
|
@@ -165,7 +203,6 @@
|
|
165 |
});
|
166 |
|
167 |
//console.log(data.post_category);
|
168 |
-
|
169 |
update_fields();
|
170 |
|
171 |
});
|
@@ -181,12 +218,15 @@
|
|
181 |
// taxonomy
|
182 |
$('div[id*="taxonomy-"] input[type="checkbox"]').live('change', function(){
|
183 |
|
|
|
|
|
|
|
184 |
acf.data.taxonomy = ['0'];
|
185 |
|
186 |
$(this).closest('ul').find('input[type="checkbox"]:checked').each(function(){
|
187 |
acf.data.taxonomy.push($(this).val())
|
188 |
});
|
189 |
-
|
190 |
update_fields();
|
191 |
|
192 |
});
|
64 |
var id = $(this).attr('id').replace('acf_', '');
|
65 |
|
66 |
// layout
|
67 |
+
$(this).addClass(layout);
|
68 |
|
69 |
// show / hide
|
70 |
if(show == 'true')
|
87 |
|
88 |
function update_fields()
|
89 |
{
|
90 |
+
|
91 |
+
//console.log('update_fields');
|
92 |
$.ajax({
|
93 |
url: ajaxurl,
|
94 |
data: acf.data,
|
100 |
$('#poststuff .acf_postbox').hide();
|
101 |
$('#adv-settings .acf_hide_label').hide();
|
102 |
|
103 |
+
|
104 |
+
// dont bother loading style or html for inputs
|
105 |
+
if(result.length == 0)
|
106 |
+
{
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
// show the new postboxes
|
112 |
$.each(result, function(k, v) {
|
113 |
+
|
114 |
+
|
115 |
+
var postbox = $('#poststuff #acf_' + v);
|
116 |
+
postbox.show();
|
117 |
$('#adv-settings .acf_hide_label[for="acf_' + v + '-hide"]').show();
|
118 |
+
|
119 |
+
// load fields if needed
|
120 |
+
postbox.find('.acf-replace-with-fields').each(function(){
|
121 |
+
|
122 |
+
var div = $(this);
|
123 |
+
|
124 |
+
$.ajax({
|
125 |
+
url: ajaxurl,
|
126 |
+
data: {
|
127 |
+
action : 'acf_input',
|
128 |
+
acf_id : v,
|
129 |
+
post_id : acf.post_id
|
130 |
+
},
|
131 |
+
type: 'post',
|
132 |
+
dataType: 'html',
|
133 |
+
success: function(html){
|
134 |
+
|
135 |
+
div.replaceWith(html);
|
136 |
+
|
137 |
+
$(document).trigger('acf/setup_fields', postbox);
|
138 |
+
|
139 |
+
}
|
140 |
+
});
|
141 |
+
|
142 |
+
});
|
143 |
});
|
144 |
|
145 |
// load style
|
194 |
|
195 |
});
|
196 |
|
197 |
+
$('#taxonomy-category input[type="checkbox"]').live('change', function(){
|
198 |
|
199 |
acf.data.post_category = ['0'];
|
200 |
|
203 |
});
|
204 |
|
205 |
//console.log(data.post_category);
|
|
|
206 |
update_fields();
|
207 |
|
208 |
});
|
218 |
// taxonomy
|
219 |
$('div[id*="taxonomy-"] input[type="checkbox"]').live('change', function(){
|
220 |
|
221 |
+
// ignore categories
|
222 |
+
if($(this).closest('#taxonomy-category').exists()) return false;
|
223 |
+
|
224 |
acf.data.taxonomy = ['0'];
|
225 |
|
226 |
$(this).closest('ul').find('input[type="checkbox"]:checked').each(function(){
|
227 |
acf.data.taxonomy.push($(this).val())
|
228 |
});
|
229 |
+
|
230 |
update_fields();
|
231 |
|
232 |
});
|
readme.txt
CHANGED
@@ -86,6 +86,19 @@ http://www.advancedcustomfields.com/support/
|
|
86 |
|
87 |
== Changelog ==
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
= 3.1.5 =
|
90 |
* Improvement: Redesigned the experience for uploading and selecting images / files in fields and sub fields. Image / File fields within a repeater can now add multiple images / files
|
91 |
|
86 |
|
87 |
== Changelog ==
|
88 |
|
89 |
+
= 3.1.6 =
|
90 |
+
* New style for buttons
|
91 |
+
* Bug Fix: Repeater maximum row setting was disabling the "add row" button 1 row early.
|
92 |
+
* Performance: Field options are now loaded in via ajax. This results in much less HTML on the edit field group page
|
93 |
+
* Performance: Field inputs are now loaded in via ajax. Again, less HTML on edit screens improves load times / memory usage
|
94 |
+
* Bug Fix: Field groups registered by code were not showing on ajax change (category / page type / page template / etc). To fix this, your field group needs a unique ID. When you export a field group, you will now be given a unique ID to fix this issue. Field groups without a fixed id will still show on page load.
|
95 |
+
* New Option: Repeater field can now have a custom button label
|
96 |
+
* New Option: Flexible content field can now have a custom button label
|
97 |
+
* Improvement: Updated the HTML / CSS for file fields with icon
|
98 |
+
* Bug Fix: Fixed multi upload / select image in repeater.
|
99 |
+
* Performance: Added caching to the get_field function. Templates will now render quicker.
|
100 |
+
* Bug Fix: Fixed Post formats location rule - it now works.
|
101 |
+
|
102 |
= 3.1.5 =
|
103 |
* Improvement: Redesigned the experience for uploading and selecting images / files in fields and sub fields. Image / File fields within a repeater can now add multiple images / files
|
104 |
|