Sync plugins from current page

Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
2019-09-11 19:08:46 +02:00
parent 85d41e4216
commit 8515ff9587
1847 changed files with 505469 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
<?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if( ! class_exists('ACF_Walker_Nav_Menu_Edit') ) :
class ACF_Walker_Nav_Menu_Edit extends Walker_Nav_Menu_Edit {
/**
* Starts the element output.
*
* Calls the Walker_Nav_Menu_Edit start_el function and then injects the custom field HTML
*
* @since 5.0.0
* @since 5.7.2 Added preg_replace based on https://github.com/ineagu/wp-menu-item-custom-fields
*
* @param string $output Used to append additional content (passed by reference).
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $id Current item ID.
*/
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
// vars
$item_output = '';
// call parent function
parent::start_el( $item_output, $item, $depth, $args, $id );
// inject custom field HTML
$output .= preg_replace(
// NOTE: Check this regex from time to time!
'/(?=<(fieldset|p)[^>]+class="[^"]*field-move)/',
$this->get_fields( $item, $depth, $args, $id ),
$item_output
);
}
/**
* Get custom fields HTML
*
* @since 5.0.0
* @since 5.7.2 Added action based on https://github.com/ineagu/wp-menu-item-custom-fields
*
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param array $args Menu item args.
* @param int $id Nav menu ID.
* @return string
*/
function get_fields( $item, $depth, $args = array(), $id = 0 ) {
ob_start();
/**
* Get menu item custom fields from plugins/themes
*
* @since 5.7.2
*
* @param int $item_id post ID of menu
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param array $args Menu item args.
* @param int $id Nav menu ID.
*/
do_action( 'wp_nav_menu_item_custom_fields', $item->ID, $item, $depth, $args, $id );
return ob_get_clean();
}
}
endif;
?>

View File

@@ -0,0 +1,55 @@
<?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if( ! class_exists('ACF_Taxonomy_Field_Walker') ) :
class ACF_Taxonomy_Field_Walker extends Walker {
var $field = null,
$tree_type = 'category',
$db_fields = array ( 'parent' => 'parent', 'id' => 'term_id' );
function __construct( $field ) {
$this->field = $field;
}
function start_el( &$output, $term, $depth = 0, $args = array(), $current_object_id = 0) {
// vars
$selected = in_array( $term->term_id, $this->field['value'] );
// append
$output .= '<li data-id="' . $term->term_id . '"><label' . ($selected ? ' class="selected"' : '') . '><input type="' . $this->field['field_type'] . '" name="' . $this->field['name'] . '" value="' . $term->term_id . '" ' . ($selected ? 'checked="checked"' : '') . ' /> <span>' . $term->name . '</span></label>';
}
function end_el( &$output, $term, $depth = 0, $args = array() ) {
// append
$output .= '</li>' . "\n";
}
function start_lvl( &$output, $depth = 0, $args = array() ) {
// append
$output .= '<ul class="children acf-bl">' . "\n";
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
// append
$output .= '</ul>' . "\n";
}
}
endif;
?>