• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / EDD_Register_Meta::sanitize_files() – Sanitize the file downloads

You appear to be a bot. Output may be restricted

Description

Sanitize the file downloads

Ensures files are correctly mapped to an array starting with an index of 0

Usage

$array = EDD_Register_Meta::sanitize_files( $files );

Parameters

$files
( array ) optional – Array of all the file downloads

Returns

array $files Array of the remapped file downloads

Source

File name: easy-digital-downloads/includes/class-edd-register-meta.php
Lines:

1 to 23 of 23
  function sanitize_files( $files = array() ) {
    $files = $this->remove_blank_rows( $files );

    // Files should always be in array format, even when there are none.
    if ( ! is_array( $files ) ) {
      $files = array();
    }

    // Clean up filenames to ensure whitespaces are stripped
    foreach( $files as $id => $file ) {

      if( ! empty( $files[ $id ]['file'] ) ) {
        $files[ $id ]['file'] = trim( $file['file'] );
      }

      if( ! empty( $files[ $id ]['name'] ) ) {
        $files[ $id ]['name'] = sanitize_text_field( $file['name'] );
      }
    }

    // Make sure all files are rekeyed starting at 0
    return $files;
  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 26th November 2019

Primary Sidebar

Information

Function name: EDD_Register_Meta::sanitize_files
Class ref: EDD_Register_Meta
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/class-edd-register-meta.php
File ref: includes/class-edd-register-meta.php
Deprecated?: No
API Letters: E,F,M,R,S

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites