$api_url . "asowp/v1", "ajax_url" => esc_url(admin_url('admin-ajax.php')), "assets_url" => ASOWP_ASSETS, "page" => "admin", "version" => ASOWP_VERSION, 'currencySymbol' => class_exists('WooCommerce') ? html_entity_decode(get_woocommerce_currency_symbol()) : '', 'currency_pos' => class_exists('WooCommerce') ? get_option('woocommerce_currency_pos') : '' ]); wp_localize_script("asowp-admin", "asowp_configurator_data", array( "fixing_methods_url" => ASOWP_ASSETS . '/images/fixing-methodes', "borders_url" => ASOWP_ASSETS . '/images/borders', )); } public function asowp_add_custom_mime_types($mimes) { return array_merge( $mimes, array( 'svg' => 'image/svg+xml', 'ttf' => 'application/x-font-ttf', 'woff' => 'application/x-font-woff', 'otf' => 'application/x-font-otf', 'icc' => 'application/vnd.iccprofile', ) ); } /** * Check file type and extension. * * @param array $data The data. * @param mixed $file The file. * @param string $filename The file name. * @param array $mimes The mimes. * @param string $real_mime The real mimes. * @return array */ public function asowp_check_filetype_and_ext($data, $file, $filename, $mimes, $real_mime) { if (!empty($data['ext']) && !empty($data['type'])) { return $data; } $wp_file_type = wp_check_filetype($filename, $mimes); // Check for the file type you want to enable, e.g. 'svg'. if ('ttf' === $wp_file_type['ext']) { $data['ext'] = 'ttf'; $data['type'] = 'font/ttf'; } if ('otf' === $wp_file_type['ext']) { $data['ext'] = 'otf'; $data['type'] = 'font/otf'; } if ('woff' === $wp_file_type['ext']) { $data['ext'] = 'woff'; $data['type'] = 'font/woff'; } if ('woff2' === $wp_file_type['ext']) { $data['ext'] = 'woff2'; $data['type'] = 'font/woff2'; } if ('svg' === $wp_file_type['svg']) { $data['ext'] = 'svg'; $data['type'] = 'image/svg+xml'; } return $data; } }