) { $path = $this->get_wpml_flags_directory() . $file; if ( $this->flag_file_exists( $path ) ) { $ext = pathinfo( $path, PATHINFO_EXTENSION ); if ( in_array( $ext, $allowed_file_types, true ) ) { $result[] = $file; } } } return $result; } /** * @param string $base_url * @param string $path * * @return string */ private function append_path_to_url( $base_url, $path ) { $base_url_parts = wp_parse_url( $base_url ); $base_url_path_components = array(); if ( $base_url_parts && array_key_exists( 'path', $base_url_parts ) ) { $base_url_path_components = explode( '/', untrailingslashit( $base_url_parts['path'] ) ); } $sub_dir_path_components = explode( '/', trim( $path, '/' ) ); foreach ( $sub_dir_path_components as $sub_dir_path_part ) { $base_url_path_components[] = $sub_dir_path_part; } $base_url_parts['path'] = implode( '/', $base_url_path_components ); return http_build_url( $base_url_parts ); } }