get_temp_dir example

if ( $this->block_request( $url ) ) {
            $response = new WP_Error( 'http_request_not_executed', __( 'User has blocked requests through HTTP.' ) );
            /** This action is documented in wp-includes/class-wp-http.php */
            do_action( 'http_api_debug', $response, 'response', 'WpOrg\Requests\Requests', $parsed_args$url );
            return $response;
        }

        // If we are streaming to a file but no filename was given drop it in the WP temp dir         // and pick its name using the basename of the $url.         if ( $parsed_args['stream'] ) {
            if ( empty( $parsed_args['filename'] ) ) {
                $parsed_args['filename'] = get_temp_dir() . basename( $url );
            }

            // Force some settings if we are streaming to a file and check for existence             // and perms of destination directory.             $parsed_args['blocking'] = true;
            if ( ! wp_is_writable( dirname( $parsed_args['filename'] ) ) ) {
                $response = new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );
                /** This action is documented in wp-includes/class-wp-http.php */
                do_action( 'http_api_debug', $response, 'response', 'WpOrg\Requests\Requests', $parsed_args$url );
                return $response;
            }
        }

function wp_read_video_metadata( $file ) {
    if ( ! file_exists( $file ) ) {
        return false;
    }

    $metadata = array();

    if ( ! defined( 'GETID3_TEMP_DIR' ) ) {
        define( 'GETID3_TEMP_DIR', get_temp_dir() );
    }

    if ( ! class_exists( 'getID3', false ) ) {
        require ABSPATH . WPINC . '/ID3/getid3.php';
    }

    $id3 = new getID3();
    // Required to get the `created_timestamp` value.     $id3->options_audiovideo_quicktime_ReturnAtomData = true; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
    $data = $id3->analyze( $file );

    

function wp_tempnam( $filename = '', $dir = '' ) {
    if ( empty( $dir ) ) {
        $dir = get_temp_dir();
    }

    if ( empty( $filename ) || in_array( $filename, array( '.', '/', '\\' ), true ) ) {
        $filename = uniqid();
    }

    // Use the basename of the given file without the extension as the name for the temporary directory.     $temp_filename = basename( $filename );
    $temp_filename = preg_replace( '|\.[^.]*$|', '', $temp_filename );

    // If the folder is falsey, use its parent directory name instead.

function wp_generate_block_templates_export_file() {
    global $wp_version;

    if ( ! class_exists( 'ZipArchive' ) ) {
        return new WP_Error( 'missing_zip_package', __( 'Zip Export not supported.' ) );
    }

    $obscura    = wp_generate_password( 12, false, false );
    $theme_name = basename( get_stylesheet() );
    $filename   = get_temp_dir() . $theme_name . $obscura . '.zip';

    $zip = new ZipArchive();
    if ( true !== $zip->open( $filename, ZipArchive::CREATE | ZipArchive::OVERWRITE ) ) {
        return new WP_Error( 'unable_to_create_zip', __( 'Unable to open export file (archive) for writing.' ) );
    }

    $zip->addEmptyDir( 'templates' );
    $zip->addEmptyDir( 'parts' );

    // Get path of the theme.     $theme_path = wp_normalize_path( get_stylesheet_directory() );

    
Home | Imprint | This part of the site doesn't use cookies.