rebase from live enviornment
This commit is contained in:
34
wp/plugins/imagify/inc/3rd-party/hosting/flywheel.php
vendored
Normal file
34
wp/plugins/imagify/inc/3rd-party/hosting/flywheel.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
if ( defined( 'FLYWHEEL_CONFIG_DIR' ) ) :
|
||||
|
||||
add_filter( 'imagify_site_root', 'imagify_flywheel_site_root', IMAGIFY_INT_MAX );
|
||||
/**
|
||||
* Filter the path to the site’s root.
|
||||
*
|
||||
* @since 1.9
|
||||
* @author Grégory Viguier
|
||||
*
|
||||
* @param string|null $root_path Path to the site's root. Default is null.
|
||||
* @return string|null
|
||||
*/
|
||||
function imagify_flywheel_site_root( $root_path ) {
|
||||
if ( ! empty( $_SERVER['DOCUMENT_ROOT'] ) ) {
|
||||
return trailingslashit( wp_unslash( $_SERVER['DOCUMENT_ROOT'] ) );
|
||||
}
|
||||
|
||||
$upload_basedir = imagify_get_filesystem()->get_upload_basedir( true );
|
||||
|
||||
if ( strpos( $upload_basedir, '/wp-content/' ) === false ) {
|
||||
// Uh oooooh...
|
||||
return $root_path;
|
||||
}
|
||||
|
||||
$upload_basedir = explode( '/wp-content/', $upload_basedir );
|
||||
$upload_basedir = reset( $upload_basedir );
|
||||
|
||||
return $upload_basedir . '/';
|
||||
}
|
||||
|
||||
endif;
|
||||
24
wp/plugins/imagify/inc/3rd-party/hosting/pressable.php
vendored
Normal file
24
wp/plugins/imagify/inc/3rd-party/hosting/pressable.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
if ( defined( 'IS_PRESSABLE' ) ) :
|
||||
|
||||
add_filter( 'imagify_site_root', 'imagify_pressable_site_root', IMAGIFY_INT_MAX );
|
||||
/**
|
||||
* Filter the path to the site's root.
|
||||
*
|
||||
* @since 1.9.4
|
||||
* @author Grégory Viguier
|
||||
*
|
||||
* @param string|null $root_path Path to the site's root. Default is null.
|
||||
* @return string
|
||||
*/
|
||||
function imagify_pressable_site_root( $root_path ) {
|
||||
$upload_basedir = trim( wp_normalize_path( WP_CONTENT_DIR ), '/' );
|
||||
$upload_basedir = explode( '/', $upload_basedir );
|
||||
$upload_basedir = reset( $upload_basedir );
|
||||
|
||||
return '/' . $upload_basedir . '/';
|
||||
}
|
||||
|
||||
endif;
|
||||
71
wp/plugins/imagify/inc/3rd-party/hosting/siteground.php
vendored
Normal file
71
wp/plugins/imagify/inc/3rd-party/hosting/siteground.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
add_filter( 'http_request_args', 'imagify_siteground_change_user_agent', 10, 2 );
|
||||
/**
|
||||
* Filter the arguments used in a HTTP request to change the User Agent for requests "to self", to prevent firewalls to be triggered.
|
||||
*
|
||||
* @since 1.6.13
|
||||
* @author Grégory Viguier
|
||||
*
|
||||
* @param array $r An array of HTTP request arguments.
|
||||
* @param string $url The request URL.
|
||||
* @return array
|
||||
*/
|
||||
function imagify_siteground_change_user_agent( $r, $url ) {
|
||||
static $user_agent;
|
||||
static $site_url;
|
||||
|
||||
$url = wp_parse_url( $url );
|
||||
|
||||
if ( empty( $url['path'] ) ) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
$paths = array(
|
||||
'/wp-admin/admin-ajax.php',
|
||||
'/wp-admin/admin-post.php',
|
||||
'/wp-cron.php',
|
||||
);
|
||||
|
||||
if ( ! isset( $site_url ) ) {
|
||||
$site_url = wp_parse_url( site_url( '/' ) );
|
||||
}
|
||||
|
||||
// Limit to requests to self.
|
||||
if ( false === strpos( $url['path'], $site_url['path'] ) && false === strpos( $site_url['path'], $url['path'] ) ) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
// Limit to requests to admin-ajax.php, admin-post.php, and wp-cron.php.
|
||||
foreach ( $paths as $i => $path ) {
|
||||
if ( false !== strpos( $url['path'], $path ) ) {
|
||||
$paths = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $paths ) {
|
||||
return $r;
|
||||
}
|
||||
|
||||
// Randomize the User-Agent.
|
||||
if ( ! isset( $user_agent ) ) {
|
||||
$user_agent = wp_generate_password( 12, false );
|
||||
/**
|
||||
* Filter the User-Agent used for requests "to self".
|
||||
*
|
||||
* @since 1.7.1
|
||||
* @author Grégory Viguier
|
||||
*
|
||||
* @param string $user_agent The User-Agent.
|
||||
* @param array $r An array of HTTP request arguments.
|
||||
* @param array $url The request URL, parsed.
|
||||
*/
|
||||
$user_agent = apply_filters( 'imagify_user_agent_for_internal_requests', $user_agent, $r, $url );
|
||||
}
|
||||
|
||||
$r['user-agent'] = $user_agent;
|
||||
|
||||
return $r;
|
||||
}
|
||||
30
wp/plugins/imagify/inc/3rd-party/hosting/wordpress-com.php
vendored
Normal file
30
wp/plugins/imagify/inc/3rd-party/hosting/wordpress-com.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
if ( defined( 'WPCOMSH_VERSION' ) ) :
|
||||
|
||||
add_filter( 'imagify_site_root', 'imagify_wpcom_site_root', IMAGIFY_INT_MAX );
|
||||
/**
|
||||
* Filter the path to the site's root.
|
||||
*
|
||||
* @since 1.8.4
|
||||
* @author Grégory Viguier
|
||||
*
|
||||
* @param string|null $root_path Path to the site's root. Default is null.
|
||||
* @return string|null
|
||||
*/
|
||||
function imagify_wpcom_site_root( $root_path ) {
|
||||
$upload_basedir = imagify_get_filesystem()->get_upload_basedir( true );
|
||||
|
||||
if ( strpos( $upload_basedir, '/wp-content/' ) === false ) {
|
||||
// Uh oooooh...
|
||||
return $root_path;
|
||||
}
|
||||
|
||||
$upload_basedir = explode( '/wp-content/', $upload_basedir );
|
||||
$upload_basedir = reset( $upload_basedir );
|
||||
|
||||
return $upload_basedir . '/';
|
||||
}
|
||||
|
||||
endif;
|
||||
21
wp/plugins/imagify/inc/3rd-party/hosting/wpengine.php
vendored
Normal file
21
wp/plugins/imagify/inc/3rd-party/hosting/wpengine.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
|
||||
|
||||
if ( class_exists( 'WpeCommon' ) ) :
|
||||
|
||||
add_filter( 'imagify_unoptimized_attachment_limit', '_imagify_wpengine_unoptimized_attachment_limit' );
|
||||
add_filter( 'imagify_count_saving_data_limit', '_imagify_wpengine_unoptimized_attachment_limit' );
|
||||
/**
|
||||
* Change the limit for the number of posts: WP Engine limits SQL queries size to 2048 octets (16384 characters).
|
||||
*
|
||||
* @since 1.4.7
|
||||
* @since 1.6.7 Renamed (and deprecated) _imagify_wengine_unoptimized_attachment_limit() into _imagify_wpengine_unoptimized_attachment_limit().
|
||||
* @author Jonathan Buttigieg
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function _imagify_wpengine_unoptimized_attachment_limit() {
|
||||
return 2500;
|
||||
}
|
||||
|
||||
endif;
|
||||
Reference in New Issue
Block a user