basename( $url ), 'type' => 'font/woff', 'tmp_name' => $temp_file, 'error' => 0, 'size' => filesize( $temp_file ), ); $overrides = array( 'test_form' => false, 'test_size' => true, ); // Move the temporary file into the uploads directory. $results = wp_handle_sideload( $file, $overrides ); if ( empty( $results['error'] ) ) { return $results['url']; } return false; } /** * Gets the root folder url. * Other urls are built based on this. * * @static * @since 3.0.36 * @access public * @return string */ public static function get_root_url() { // Get the upload directory for this site. $upload_dir = wp_upload_dir(); // The URL. $url = trailingslashit( $upload_dir['baseurl'] ); // Take care of domain mapping. // When using domain mapping we have to make sure that the URL to the file // does not include the original domain but instead the mapped domain. if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) { if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) { $mapped_domain = domain_mapping_siteurl( false ); $original_domain = get_original_url( 'siteurl' ); $url = str_replace( $original_domain, $mapped_domain, $url ); } } $url = str_replace( array( 'https://', 'http://' ), '//', $url ); return apply_filters( 'kirki_googlefonts_root_url', untrailingslashit( esc_url_raw( $url ) ) . '/webfonts' ); } }