Previsioni Meteo Moscheri (Trambileno) TRA 18 GIORNI
name = 'export';
$this->title = __( 'Export Field Groups', 'acf' );
// active
if ( $this->is_active() ) {
$this->title .= ' - ' . __( 'Generate PHP', 'acf' );
}
}
/**
* submit
*
* This function will run when the tool's form has been submit
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit() {
// vars
$action = acf_maybe_get_POST( 'action' );
// download
if ( $action === 'download' ) {
$this->submit_download();
// generate
} elseif ( $action === 'generate' ) {
$this->submit_generate();
}
}
/**
* submit_download
*
* description
*
* @date 17/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit_download() {
// vars
$json = $this->get_selected();
// validate
if ( $json === false ) {
return acf_add_admin_notice( __( 'No field groups selected', 'acf' ), 'warning' );
}
// headers
$file_name = 'acf-export-' . date( 'Y-m-d' ) . '.json';
header( 'Content-Description: File Transfer' );
header( "Content-Disposition: attachment; filename={$file_name}" );
header( 'Content-Type: application/json; charset=utf-8' );
// return
echo acf_json_encode( $json ) . "\r\n"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped as JSON export.
die;
}
/**
* submit_generate
*
* description
*
* @date 17/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function submit_generate() {
// vars
$keys = $this->get_selected_keys();
// validate
if ( ! $keys ) {
return acf_add_admin_notice( __( 'No field groups selected', 'acf' ), 'warning' );
}
// url
$url = add_query_arg( 'keys', implode( '+', $keys ), $this->get_url() );
// redirect
wp_safe_redirect( $url );
exit;
}
/**
* load
*
* description
*
* @date 21/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function load() {
// active
if ( $this->is_active() ) {
// get selected keys
$selected = $this->get_selected_keys();
// add notice
if ( $selected ) {
$count = count( $selected );
$text = sprintf( _n( 'Exported 1 item.', 'Exported %s items.', $count, 'acf' ), $count );
acf_add_admin_notice( $text, 'success' );
}
}
}
/**
* html
*
* This function will output the metabox HTML
*
* @date 10/10/17
* @since 5.6.3
*
* @param n/a
* @return n/a
*/
function html() {
// single (generate PHP)
if ( $this->is_active() ) {
$this->html_single();
// archive
} else {
$this->html_archive();
}
}
/**
* Renders the checkboxes to select items to export.
*
* @since 5.6.3
*/
public function html_field_selection() {
// Ensure `l10n_var_export` is always false at the point we're outputting the options.
acf_update_setting( 'l10n_var_export', false );
// Reset the field-groups store which may have been corrupted by export.
$store = acf_get_store( 'field-groups' );
if ( $store ) {
$store->reset();
}
$choices = array();
$selected = $this->get_selected_keys();
$field_groups = array_filter(
acf_get_internal_post_type_posts( 'acf-field-group' ),
'acf_internal_post_object_contains_valid_key'
);
if ( $field_groups ) {
foreach ( $field_groups as $field_group ) {
$choices[ $field_group['key'] ] = esc_html( $field_group['title'] );
}
}
acf_render_field_wrap(
array(
'label' => __( 'Select Field Groups', 'acf' ),
'type' => 'checkbox',
'name' => 'keys',
'prefix' => false,
'value' => $selected,
'toggle' => true,
'choices' => $choices,
)
);
$choices = array();
$selected = $this->get_selected_keys();
$post_types = array_filter(
acf_get_internal_post_type_posts( 'acf-post-type' ),
'acf_internal_post_object_contains_valid_key'
);
if ( $post_types ) {
foreach ( $post_types as $post_type ) {
$choices[ $post_type['key'] ] = esc_html( $post_type['title'] );
}
acf_render_field_wrap(
array(
'label' => __( 'Select Post Types', 'acf' ),
'type' => 'checkbox',
'name' => 'post_type_keys',
'prefix' => false,
'value' => $selected,
'toggle' => true,
'choices' => $choices,
)
);
}
$choices = array();
$selected = $this->get_selected_keys();
$taxonomies = array_filter(
acf_get_internal_post_type_posts( 'acf-taxonomy' ),
'acf_internal_post_object_contains_valid_key'
);
if ( $taxonomies ) {
foreach ( $taxonomies as $taxonomy ) {
$choices[ $taxonomy['key'] ] = esc_html( $taxonomy['title'] );
}
acf_render_field_wrap(
array(
'label' => __( 'Select Taxonomies', 'acf' ),
'type' => 'checkbox',
'name' => 'taxonomy_keys',
'prefix' => false,
'value' => $selected,
'toggle' => true,
'choices' => $choices,
)
);
}
$choices = array();
$selected = $this->get_selected_keys();
$options_pages = array_filter(
acf_get_internal_post_type_posts( 'acf-ui-options-page' ),
'acf_internal_post_object_contains_valid_key'
);
if ( $options_pages ) {
foreach ( $options_pages as $options_page ) {
$choices[ $options_page['key'] ] = esc_html( $options_page['title'] );
}
acf_render_field_wrap(
array(
'label' => __( 'Select Options Pages', 'acf' ),
'type' => 'checkbox',
'name' => 'ui_options_page_keys',
'prefix' => false,
'value' => $selected,
'toggle' => true,
'choices' => $choices,
)
);
}
}
/**
* Renders the side panel for selecting ACF items to export via PHP.
*
* @since 5.6.3
*/
public function html_panel_selection() {
?>
get_selected();
$to_export = array();
// Sort by ACF post type first so we can wrap them in related functions.
foreach ( $json as $post ) {
$post_type = acf_determine_internal_post_type( $post['key'] );
if ( $post_type ) {
$to_export[ $post_type ][] = $post;
}
}
echo '';
?>
get_selected_keys();
$json = array();
if ( ! $selected ) {
return false;
}
foreach ( $selected as $key ) {
$post_type = acf_determine_internal_post_type( $key );
$post = acf_get_internal_post_type( $key, $post_type );
if ( empty( $post ) ) {
continue;
}
if ( 'acf-field-group' === $post_type ) {
$post['fields'] = acf_get_fields( $post );
}
$post = acf_prepare_internal_post_type_for_export( $post, $post_type );
$json[] = $post;
}
return $json;
}
}
// initialize
acf_register_admin_tool( 'ACF_Admin_Tool_Export' );
endif; // class_exists check
?>
LSCH Ç 5Ý( www.sportfair.it:443/foto/2018/01/ilenia-pastorelli-film-verdone-attrice-benedetta-follia-grande-fratello/658505/#_lscache_vary;+ismobile;;wp-postpass_9adf22f166615dee0ea3a6e7e9d50400;@185.116.60.167
html_field_selection(); ?>
?
html_field_selection(); ?>
">?
html_generate(); ?>
html_panel_selection(); ?>