This commit introduces a more reliable and consistent approach to setting up the development environment using backups: - Add setup-from-backup.sh script for environment setup from existing backups - Standardize script naming and organization - Move obsolete scripts to bin/obsolete directory - Update documentation with new workflow instructions - Create migration guide for transitioning to new workflow - Update Memory Bank with workflow improvements The new workflow provides: - More reliable environment setup - Faster setup process - Offline development capability - Consistent development environments across team members Breaking changes: - setup-dev.sh is replaced by setup-from-backup.sh - sync-and-setup.sh is replaced by separate scripts - verify-with-wpcli.sh is no longer used Migration path is documented in MIGRATION_GUIDE.md
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
header( 'Status: 403 Forbidden' );
|
|
header( 'HTTP/1.1 403 Forbidden' );
|
|
exit;
|
|
}
|
|
|
|
class Breeze_DNS_Prefetch {
|
|
|
|
function __construct() {
|
|
add_filter( 'wp_resource_hints', array( &$this, 'breeze_dns_prefetch' ), 10, 2 );
|
|
}
|
|
|
|
/**
|
|
* Optimize by adding URLs to the prefetch DNS list.
|
|
*
|
|
* @param array $urls Array of resources and their attributes, or URLs to print for resource hints.
|
|
* @param string $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.
|
|
*
|
|
* @return array
|
|
* @since 2.0.2
|
|
* @access public
|
|
*/
|
|
public function breeze_dns_prefetch( $urls, $relation_type ) {
|
|
|
|
$prefetch_url_list = Breeze_Options_Reader::get_option_value( 'breeze-prefetch-urls' );
|
|
if ( ! is_array( $prefetch_url_list ) ) {
|
|
$prefetch_url_list = array();
|
|
}
|
|
|
|
if ( ! empty( $prefetch_url_list ) ) {
|
|
$prefetch_url_list = array_map( 'breeze_rtrim_urls', $prefetch_url_list );
|
|
$prefetch_url_list = array_map( array( $this, 'clean_schema' ), $prefetch_url_list );
|
|
|
|
foreach ( $prefetch_url_list as $url_domain ) {
|
|
|
|
if ( 'dns-prefetch' === $relation_type ) {
|
|
$urls[] = $url_domain;
|
|
}
|
|
}
|
|
}
|
|
|
|
return $urls;
|
|
}
|
|
|
|
/**
|
|
* Remove link schema.
|
|
*
|
|
* @param string $current_url Given url string.
|
|
*
|
|
* @return string
|
|
* @since 2.0.2
|
|
* @access public
|
|
*/
|
|
private function clean_schema( $current_url ) {
|
|
return ltrim( $current_url, 'https:' );
|
|
}
|
|
}
|
|
|
|
new Breeze_DNS_Prefetch();
|