2020-04-07 13:03:04 +00:00
|
|
|
<?php
|
2020-08-13 14:53:39 +00:00
|
|
|
/**
|
|
|
|
* This file handles general functions in the plugin.
|
|
|
|
*
|
|
|
|
* @package GP Premium
|
|
|
|
*/
|
|
|
|
|
2020-04-07 13:03:04 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // No direct access, please.
|
|
|
|
}
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
/**
|
|
|
|
* Get the requested media query.
|
|
|
|
*
|
|
|
|
* @since 1.9.0
|
|
|
|
* @param string $name Name of the media query.
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
function generate_premium_get_media_query( $name ) {
|
|
|
|
if ( function_exists( 'generate_get_media_query' ) ) {
|
|
|
|
return generate_get_media_query( $name );
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the theme function doesn't exist, build our own queries.
|
|
|
|
$desktop = apply_filters( 'generate_desktop_media_query', '(min-width:1025px)' );
|
|
|
|
$tablet = apply_filters( 'generate_tablet_media_query', '(min-width: 769px) and (max-width: 1024px)' );
|
|
|
|
$mobile = apply_filters( 'generate_mobile_media_query', '(max-width:768px)' );
|
|
|
|
$mobile_menu = apply_filters( 'generate_mobile_menu_media_query', $mobile );
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
$queries = apply_filters(
|
|
|
|
'generate_media_queries',
|
|
|
|
array(
|
|
|
|
'desktop' => $desktop,
|
|
|
|
'tablet' => $tablet,
|
|
|
|
'mobile' => $mobile,
|
|
|
|
'mobile-menu' => $mobile_menu,
|
|
|
|
)
|
|
|
|
);
|
2020-04-07 13:03:04 +00:00
|
|
|
|
|
|
|
return $queries[ $name ];
|
2020-08-13 14:53:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get our CSS print method.
|
|
|
|
*
|
|
|
|
* @since 1.11.0
|
|
|
|
*/
|
|
|
|
function generate_get_css_print_method() {
|
|
|
|
$mode = apply_filters( 'generatepress_dynamic_css_print_method', 'inline' );
|
|
|
|
|
|
|
|
if ( ( function_exists( 'is_customize_preview' ) && is_customize_preview() ) || is_preview() ) {
|
|
|
|
return 'inline';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! defined( 'GENERATE_VERSION' ) ) {
|
|
|
|
return 'inline';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $mode;
|
|
|
|
}
|