/**
* The admin settings handler of the plugin.
*
* Handles saving and validating settings from the admin UI and network admin.
*
* @since 1.1.0
* @package LiteSpeed
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit();
/**
* Class Admin_Settings
*
* Saves, sanitizes, and validates LiteSpeed Cache settings.
*/
class Admin_Settings extends Base {
const LOG_TAG = '[Settings]';
const ENROLL = '_settings-enroll';
/**
* Save settings (single site).
*
* Accepts data from $_POST or WP-CLI.
* Importers may call the Conf class directly.
*
* @since 3.0
*
* @param array $raw_data Raw data from request/CLI.
* @return void
*/
public function save( $raw_data ) {
self::debug( 'saving' );
if ( empty( $raw_data[ self::ENROLL ] ) ) {
wp_die( esc_html__( 'No fields', 'litespeed-cache' ) );
}
$raw_data = Admin::cleanup_text( $raw_data );
// Convert data to config format.
$the_matrix = [];
foreach ( array_unique( $raw_data[ self::ENROLL ] ) as $id ) {
$child = false;
// Drop array format.
if ( false !== strpos( $id, '[' ) ) {
if ( 0 === strpos( $id, self::O_CDN_MAPPING ) || 0 === strpos( $id, self::O_CRAWLER_COOKIES ) ) {
// CDN child | Cookie Crawler settings.
$child = substr( $id, strpos( $id, '[' ) + 1, strpos( $id, ']' ) - strpos( $id, '[' ) - 1 );
// Drop ending []; Compatible with xx[0] way from CLI.
$id = substr( $id, 0, strpos( $id, '[' ) );
} else {
// Drop ending [].
$id = substr( $id, 0, strpos( $id, '[' ) );
}
}
if ( ! array_key_exists( $id, self::$_default_options ) ) {
continue;
}
// Validate $child.
if ( self::O_CDN_MAPPING === $id ) {
if ( ! in_array( $child, [ self::CDN_MAPPING_URL, self::CDN_MAPPING_INC_IMG, self::CDN_MAPPING_INC_CSS, self::CDN_MAPPING_INC_JS, self::CDN_MAPPING_FILETYPE ], true ) ) {
continue;
}
}
if ( self::O_CRAWLER_COOKIES === $id ) {
if ( ! in_array( $child, [ self::CRWL_COOKIE_NAME, self::CRWL_COOKIE_VALS ], true ) ) {
continue;
}
}
// Pull value from request.
if ( $child ) {
// []=xxx or [0]=xxx
$data = ! empty( $raw_data[ $id ][ $child ] ) ? $raw_data[ $id ][ $child ] : $this->type_casting(false, $id);
} else {
$data = ! empty( $raw_data[ $id ] ) ? $raw_data[ $id ] : $this->type_casting(false, $id);
}
// Sanitize/normalize complex fields.
if ( self::O_CDN_MAPPING === $id || self::O_CRAWLER_COOKIES === $id ) {
// Use existing queued data if available (only when $child != false).
$data2 = array_key_exists( $id, $the_matrix )
? $the_matrix[ $id ]
: ( defined( 'WP_CLI' ) && WP_CLI ? $this->conf( $id ) : [] );
}
switch ( $id ) {
// Don't allow Editor/admin to be used in crawler role simulator.
case self::O_CRAWLER_ROLES:
$data = Utility::sanitize_lines( $data );
if ( $data ) {
foreach ( $data as $k => $v ) {
if ( user_can( $v, 'edit_posts' ) ) {
/* translators: %s: user id in tags */
$msg = sprintf(
esc_html__( 'The user with id %s has editor access, which is not allowed for the role simulator.', 'litespeed-cache' ),
'' . esc_html( $v ) . ''
);
Admin_Display::error( $msg );
unset( $data[ $k ] );
}
}
}
break;
case self::O_CDN_MAPPING:
/**
* CDN setting
*
* Raw data format:
* cdn-mapping[url][] = 'xxx'
* cdn-mapping[url][2] = 'xxx2'
* cdn-mapping[inc_js][] = 1
*
* Final format:
* cdn-mapping[0][url] = 'xxx'
* cdn-mapping[2][url] = 'xxx2'
*/
if ( $data ) {
foreach ( $data as $k => $v ) {
if ( self::CDN_MAPPING_FILETYPE === $child ) {
$v = Utility::sanitize_lines( $v );
}
if ( self::CDN_MAPPING_URL === $child ) {
// If not a valid URL, turn off CDN.
if ( 0 !== strpos( $v, 'https://' ) ) {
self::debug( '❌ CDN mapping set to OFF due to invalid URL' );
$the_matrix[ self::O_CDN ] = false;
}
$v = trailingslashit( $v );
}
if ( in_array( $child, [ self::CDN_MAPPING_INC_IMG, self::CDN_MAPPING_INC_CSS, self::CDN_MAPPING_INC_JS ], true ) ) {
// Because these can't be auto detected in `config->update()`, need to format here.
$v = 'false' === $v ? 0 : (bool) $v;
}
if ( empty( $data2[ $k ] ) ) {
$data2[ $k ] = [];
}
$data2[ $k ][ $child ] = $v;
}
}
$data = $data2;
break;
case self::O_CRAWLER_COOKIES:
/**
* Cookie Crawler setting
* Raw Format:
* crawler-cookies[name][] = xxx
* crawler-cookies[name][2] = xxx2
* crawler-cookies[vals][] = xxx
*
* Final format:
* crawler-cookie[0][name] = 'xxx'
* crawler-cookie[0][vals] = 'xxx'
* crawler-cookie[2][name] = 'xxx2'
*
* Empty line for `vals` uses literal `_null`.
*/
if ( $data ) {
foreach ( $data as $k => $v ) {
if ( self::CRWL_COOKIE_VALS === $child ) {
$v = Utility::sanitize_lines( $v );
}
if ( empty( $data2[ $k ] ) ) {
$data2[ $k ] = [];
}
$data2[ $k ][ $child ] = $v;
}
}
$data = $data2;
break;
// Cache exclude category.
case self::O_CACHE_EXC_CAT:
$data2 = [];
$data = Utility::sanitize_lines( $data );
foreach ( $data as $v ) {
$cat_id = get_cat_ID( $v );
if ( ! $cat_id ) {
continue;
}
$data2[] = $cat_id;
}
$data = $data2;
break;
// Cache exclude tag.
case self::O_CACHE_EXC_TAG:
$data2 = [];
$data = Utility::sanitize_lines( $data );
foreach ( $data as $v ) {
$term = get_term_by( 'name', $v, 'post_tag' );
if ( ! $term ) {
// Could surface an admin error here if desired.
continue;
}
$data2[] = $term->term_id;
}
$data = $data2;
break;
case self::O_IMG_OPTM_SIZES_SKIPPED: // Skip image sizes
$image_sizes = Utility::prepare_image_sizes_array();
$saved_sizes = isset( $raw_data[$id] ) ? $raw_data[$id] : [];
$data = array_diff( $image_sizes, $saved_sizes );
break;
default:
break;
}
$the_matrix[ $id ] = $data;
}
// Special handler for CDN/Crawler 2d list to drop empty rows.
foreach ( $the_matrix as $id => $data ) {
/**
* Format:
* cdn-mapping[0][url] = 'xxx'
* cdn-mapping[2][url] = 'xxx2'
* crawler-cookie[0][name] = 'xxx'
* crawler-cookie[0][vals] = 'xxx'
* crawler-cookie[2][name] = 'xxx2'
*/
if ( self::O_CDN_MAPPING === $id || self::O_CRAWLER_COOKIES === $id ) {
// Drop row if all children are empty.
foreach ( $data as $k => $v ) {
foreach ( $v as $v2 ) {
if ( $v2 ) {
continue 2;
}
}
// All empty.
unset( $the_matrix[ $id ][ $k ] );
}
}
// Don't allow repeated cookie names.
if ( self::O_CRAWLER_COOKIES === $id ) {
$existed = [];
foreach ( $the_matrix[ $id ] as $k => $v ) {
if ( empty( $v[ self::CRWL_COOKIE_NAME ] ) || in_array( $v[ self::CRWL_COOKIE_NAME ], $existed, true ) ) {
// Filter repeated or empty name.
unset( $the_matrix[ $id ][ $k ] );
continue;
}
$existed[] = $v[ self::CRWL_COOKIE_NAME ];
}
}
// tmp fix the 3rd part woo update hook issue when enabling vary cookie.
if ( 'wc_cart_vary' === $id ) {
if ( $data ) {
add_filter(
'litespeed_vary_cookies',
function ( $arr ) {
$arr[] = 'woocommerce_cart_hash';
return array_unique( $arr );
}
);
} else {
add_filter(
'litespeed_vary_cookies',
function ( $arr ) {
$key = array_search( 'woocommerce_cart_hash', $arr, true );
if ( false !== $key ) {
unset( $arr[ $key ] );
}
return array_unique( $arr );
}
);
}
}
}
// id validation will be inside.
$this->cls( 'Conf' )->update_confs( $the_matrix );
$msg = __( 'Options saved.', 'litespeed-cache' );
Admin_Display::success( $msg );
}
/**
* Parses any changes made by the network admin on the network settings.
*
* @since 3.0
*
* @param array $raw_data Raw data from request/CLI.
* @return void
*/
public function network_save( $raw_data ) {
self::debug( 'network saving' );
if ( empty( $raw_data[ self::ENROLL ] ) ) {
wp_die( esc_html__( 'No fields', 'litespeed-cache' ) );
}
$raw_data = Admin::cleanup_text( $raw_data );
foreach ( array_unique( $raw_data[ self::ENROLL ] ) as $id ) {
// Append current field to setting save.
if ( ! array_key_exists( $id, self::$_default_site_options ) ) {
continue;
}
$data = ! empty( $raw_data[ $id ] ) ? $raw_data[ $id ] : false;
// id validation will be inside.
$this->cls( 'Conf' )->network_update( $id, $data );
}
// Update related files.
Activation::cls()->update_files();
$msg = __( 'Options saved.', 'litespeed-cache' );
Admin_Display::success( $msg );
}
/**
* Hooked to the wp_redirect filter when saving widgets fails validation.
*
* @since 1.1.3
*
* @param string $location The redirect location.
* @return string Updated location string.
*/
public static function widget_save_err( $location ) {
return str_replace( '?message=0', '?error=0', $location );
}
/**
* Validate the LiteSpeed Cache settings on widget save.
*
* @since 1.1.3
*
* @param array $instance The new settings.
* @param array $new_instance The raw submitted settings.
* @param array $old_instance The original settings.
* @param \WP_Widget $widget The widget instance.
* @return array|false Updated settings on success, false on error.
*/
public static function validate_widget_save( $instance, $new_instance, $old_instance, $widget ) {
if ( empty( $new_instance ) ) {
return $instance;
}
if ( ! isset( $new_instance[ ESI::WIDGET_O_ESIENABLE ], $new_instance[ ESI::WIDGET_O_TTL ] ) ) {
return $instance;
}
$esi = (int) $new_instance[ ESI::WIDGET_O_ESIENABLE ] % 3;
$ttl = (int) $new_instance[ ESI::WIDGET_O_TTL ];
if ( 0 !== $ttl && $ttl < 30 ) {
add_filter( 'wp_redirect', __CLASS__ . '::widget_save_err' );
return false; // Invalid ttl.
}
if ( empty( $instance[ Conf::OPTION_NAME ] ) ) {
// @todo to be removed.
$instance[ Conf::OPTION_NAME ] = [];
}
$instance[ Conf::OPTION_NAME ][ ESI::WIDGET_O_ESIENABLE ] = $esi;
$instance[ Conf::OPTION_NAME ][ ESI::WIDGET_O_TTL ] = $ttl;
$current = ! empty( $old_instance[ Conf::OPTION_NAME ] ) ? $old_instance[ Conf::OPTION_NAME ] : false;
// Avoid unsanitized superglobal usage.
$referrer = isset( $_SERVER['HTTP_REFERER'] ) ? esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : '';
// Only purge when not in the Customizer.
if ( false === strpos( $referrer, '/wp-admin/customize.php' ) ) {
if ( ! $current || $esi !== (int) $current[ ESI::WIDGET_O_ESIENABLE ] ) {
Purge::purge_all( 'Widget ESI_enable changed' );
} elseif ( 0 !== $ttl && $ttl !== (int) $current[ ESI::WIDGET_O_TTL ] ) {
Purge::add( Tag::TYPE_WIDGET . $widget->id );
}
Purge::purge_all( 'Widget saved' );
}
return $instance;
}
}
{
"translation-revision-date": "2026-05-28T20:57:38+00:00",
"generator": "WP-CLI\/2.12.0",
"source": "build\/3.1.0\/index.js",
"domain": "messages",
"locale_data": {
"messages": {
"": {
"domain": "messages",
"lang": "it_IT",
"plural-forms": "nplurals=2; plural=(n != 1);"
},
"HostGator": [
""
],
"Home": [
""
],
"Settings": [
""
],
"Not Live": [
""
],
"Live": [
""
],
"Your website is currently displaying a \"Coming Soon\" page.": [
""
],
"Editor": [
""
],
"Hosting Panel": [
""
],
"Oh No, An Error!": [
""
],
"You found an error, please refresh the page and try again!": [
""
],
"If the error persists, please contact support.": [
""
],
"Error code:": [
""
],
"HostGator WordPress Plugin": [
""
],
"Phone": [
""
],
"Give us a ring at (866) 96-GATOR": [
""
],
"Call Us": [
""
],
"Chat": [
""
],
"Have a question? We're here 24\/7\/365": [
""
],
"Live Chat": [
""
],
"Tweet": [
""
],
"Tweet us at @hgsupport for support": [
""
],
"Tweet Us": [
""
],
"Knowledge Base": [
""
],
"Know what the pros know.": [
""
],
"Find Answers": [
""
],
"Blog": [
""
],
"Get our tips and in-depth articles.": [
""
],
"Learn Stuff": [
""
],
"Video Tutorials": [
""
],
"Step-by-step tutorials and additional guides.": [
""
],
"Watch Now": [
""
],
"There's nothing here!": [
""
],
"Manage WordPress": [
""
],
"Staging": [
""
],
"Performance": [
""
],
"Commerce": [
""
],
"Marketplace": [
""
],
"Help": [
""
],
"Admin": [
""
],
"Secret page to manage admin features and settings.": [
""
],
"Premium tools available in eCommerce Add-Ons": [
""
],
"Discover exclusive features, designed to deliver unmatched value and elevate your online experience.": [
""
],
"We are available 24\/7 to help answer questions and solve your problems.": [
""
],
"Welcome to HostGator": [
""
],
"We're very excited to get started with you!": [
""
],
"Quick Links": [
""
],
"Settings and Performance": [
""
],
"Customize & fine-tune your site.": [
""
],
"Manage Settings": [
""
],
"Manage your site settings. You can adjust automatic updates, comments, revisions and more.": [
""
],
"Manage site performance and caching settings as well as clear the site cache.": [
""
],
"Visit Marketplace": [
""
],
"Add site services, themes or plugins from the marketplace.": [
""
],
"Website Content": [
""
],
"Create, manage & sort your story.": [
""
],
"New Post": [
""
],
"Write a new blog post.": [
""
],
"Pages": [
""
],
"New Page": [
""
],
"Add fresh pages to your website.": [
""
],
"Categories": [
""
],
"Manage Categories": [
""
],
"Organize existing content into categories.": [
""
],
"Web Hosting": [
""
],
"Access & manage your HostGator account.": [
""
],
"Manage Sites": [
""
],
"Manage your site from the control panel. You can create backups, set security, and improve performance.": [
""
],
"Email": [
""
],
"Manage Email": [
""
],
"Create email accounts, compose, send, and receive your email from the control panel.": [
""
],
"Domains": [
""
],
"Manage Domain": [
""
],
"Find a Domain": [
""
],
"Find a new domain and assign it to your site or start a new site with a fresh domain.": [
""
],
"Get Help": [
""
],
"24\/7\/365 support. We work when you work.": [
""
],
"Explore our featured collection of tools and services.": [
""
],
"Oops, there was an error loading the marketplace, please try again later.": [
""
],
"Sorry, no marketplace items. Please, try again later.": [
""
],
"Load More": [
""
],
"Oops! Something Went Wrong": [
""
],
"An error occurred while loading the content. Please try again later.": [
""
],
"Manage All Updates": [
""
],
"WordPress Core": [
""
],
"Plugins": [
""
],
"Themes": [
""
],
"Automatic Updates": [
""
],
"Keeping automatic updates on ensures timely security fixes and the latest features.": [
""
],
"Oops! Something went wrong. Please try again.": [
""
],
"Coming soon activated": [
""
],
"Coming soon deactivated": [
""
],
"Coming soon page is active. Site requires login.": [
""
],
"Coming soon page is not active. Site is live to visitors.": [
""
],
"Site Status": [
""
],
"Turn off your \"Coming Soon\" page when you are ready to launch your website.": [
""
],
"Turn on your \"Coming Soon\" page when you need to make major changes to your website.": [
""
],
"Coming Soon page": [
""
],
"Your Hostgator Coming Soon page lets you hide your site from visitors while you make the magic happen.": [
""
],
"Disabled old post comments": [
""
],
"Enabled old post comments": [
""
],
"Comments on old posts are disabled.": [
""
],
"Comments are allowed on old posts.": [
""
],
"Disable comments for older posts": [
""
],
"Comments setting saved": [
""
],
"Comments on posts are disabled after %s day.": [
""
],
"Close comments after %s day.": [
""
],
"Comments setting saved.": [
""
],
"Posts will display %s comment at a time.": [
""
],
"Display %s comments per page.": [
""
],
"Comments": [
""
],
"Comments allow visitors to provide feedback and respond to your posts or pages.": [
""
],
"Post revision setting saved": [
""
],
"Posts will save %s revision.": [
""
],
"Number of revisions posts can save": [
""
],
"Saving drafts and updating published content creates revisions. Make changes with confidence, knowing you can take %s step back.": [
""
],
"Trash setting saved": [
""
],
"The trash will automatically empty every %s week.": [
""
],
"Trash emptying frequency": [
""
],
"Content Options": [
""
],
"Controls for content revisions and how often to empty the trash.": [
""
],
"The Help Center provides guided, step-by-step assistance as you build your site.": [
""
],
"Sorry, that is not allowed.": [
""
],
"This feature cannot currently be modified.": [
""
],
"Optimize your website my managing cache, security and performance settings.": [
""
],
"Optimize your website by managing cache and performance settings": [
""
],
"General Settings": [
""
],
"This is where you can manage common settings for your website.": [
""
],
"Features": [
""
],
"Customize the available features as you manage your website.": [
""
],
"A staging site is a duplicate of your live site, offering a secure environment to experiment, test updates, and deploy when ready.": [
""
],
"The performance feature provides improvements to loads faster for visitors including cache settings.": [
""
],
"The staging feature provides a way to copy a site to test new updates, features or content.": [
""
],
"WonderBlocks provides a library of customizable block patterns and page templates.": [
""
],
"Site Editor": [
""
],
"Customizer": [
""
]
}
}
}
/**
* Inline On Mobile - Dynamic CSS.
*
* @package astra
* @since 3.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
add_filter( 'astra_dynamic_theme_css', 'astra_inline_on_mobile_css' );
/**
* Inline On Mobile - Dynamic CSS.
*
* @param string $dynamic_css Dynamic CSS.
* @since 3.5.0
* @return string
*/
function astra_inline_on_mobile_css( $dynamic_css ) {
$inline_on_mobile_enable = false;
for ( $index = 1; $index <= Astra_Builder_Helper::$component_limit; $index++ ) {
if ( false === astra_get_option( 'header-menu' . $index . '-menu-stack-on-mobile' ) ) {
$inline_on_mobile_enable = true;
break;
}
}
if ( false === $inline_on_mobile_enable ) {
return $dynamic_css;
}
$inline_on_mobile_css = '
.ast-header-break-point .ast-mobile-header-wrap .ast-above-header-wrap .main-header-bar-navigation .inline-on-mobile .menu-item .menu-link,
.ast-header-break-point .ast-mobile-header-wrap .ast-main-header-wrap .main-header-bar-navigation .inline-on-mobile .menu-item .menu-link,
.ast-header-break-point .ast-mobile-header-wrap .ast-below-header-wrap .main-header-bar-navigation .inline-on-mobile .menu-item .menu-link {
border: none;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-above-header-wrap .main-header-bar-navigation .inline-on-mobile .menu-item-has-children > .ast-menu-toggle::before,
.ast-header-break-point .ast-mobile-header-wrap .ast-main-header-wrap .main-header-bar-navigation .inline-on-mobile .menu-item-has-children > .ast-menu-toggle::before,
.ast-header-break-point .ast-mobile-header-wrap .ast-below-header-wrap .main-header-bar-navigation .inline-on-mobile .menu-item-has-children > .ast-menu-toggle::before {
font-size: .6rem;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile {
flex-wrap: unset;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu .menu-link {
padding: .1em 1em;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item .ast-menu-toggle::before {
transform: rotate(-90deg);
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item.ast-submenu-expanded .ast-menu-toggle::before {
transform: rotate(-270deg);
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item > .sub-menu > .menu-item .menu-link:before {
content: none;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile {
flex-wrap: unset;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu .menu-link {
padding: .1em 1em;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item .ast-menu-toggle::before {
transform: rotate(-90deg);
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item.ast-submenu-expanded .ast-menu-toggle::before {
transform: rotate(-270deg);
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item > .sub-menu > .menu-item .menu-link:before {
content: none;
}
.ast-header-break-point .inline-on-mobile .sub-menu {
width: 150px;
}';
if ( is_rtl() ) {
$inline_on_mobile_css .= '
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.menu-item-has-children {
margin-left: 10px;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu {
display: block;
position: absolute;
left: auto;
right: 0;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu .menu-item .ast-menu-toggle {
padding: 0;
left: 1em;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item > .sub-menu {
right: 100%;
left: auto;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .ast-menu-toggle {
left: -15px;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.menu-item-has-children {
margin-left: 10px;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu {
display: block;
position: absolute;
left: auto;
right: 0;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item > .sub-menu {
right: 100%;
left: auto;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .ast-menu-toggle {
left: -15px;
}';
} else {
$inline_on_mobile_css .= '
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.menu-item-has-children {
margin-right: 10px;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu {
display: block;
position: absolute;
right: auto;
left: 0;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu .menu-item .ast-menu-toggle {
padding: 0;
right: 1em;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item > .sub-menu {
left: 100%;
right: auto;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .ast-menu-toggle {
right: -15px;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.menu-item-has-children {
margin-right: 10px;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu {
display: block;
position: absolute;
right: auto;
left: 0;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .menu-item.ast-submenu-expanded > .sub-menu > .menu-item > .sub-menu {
left: 100%;
right: auto;
}
.ast-header-break-point .ast-mobile-header-wrap .ast-flex.inline-on-mobile .ast-menu-toggle {
right: -15px;
}';
}
return $dynamic_css .= Astra_Enqueue_Scripts::trim_css( $inline_on_mobile_css );
}
/**
* Related Posts Loader for Astra theme.
*
* @package Astra
* @author Brainstorm Force
* @copyright Copyright (c) 2021, Brainstorm Force
* @link https://www.brainstormforce.com
* @since Astra 3.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Customizer Initialization
*
* @since 3.5.0
*/
class Astra_Related_Posts_Loader {
/**
* Constructor
*
* @since 3.5.0
*/
public function __construct() {
add_filter( 'astra_theme_defaults', array( $this, 'theme_defaults' ) );
add_action( 'customize_register', array( $this, 'related_posts_customize_register' ), 2 );
// Load Google fonts.
add_action( 'astra_get_fonts', array( $this, 'add_fonts' ), 1 );
}
/**
* Enqueue google fonts.
*
* @return void
*/
public function add_fonts() {
if ( astra_target_rules_for_related_posts() ) {
// Related Posts Section title.
$section_title_font_family = astra_get_option( 'related-posts-section-title-font-family' );
$section_title_font_weight = astra_get_option( 'related-posts-section-title-font-weight' );
Astra_Fonts::add_font( $section_title_font_family, $section_title_font_weight );
// Related Posts - Posts title.
$post_title_font_family = astra_get_option( 'related-posts-title-font-family' );
$post_title_font_weight = astra_get_option( 'related-posts-title-font-weight' );
Astra_Fonts::add_font( $post_title_font_family, $post_title_font_weight );
// Related Posts - Meta Font.
$meta_font_family = astra_get_option( 'related-posts-meta-font-family' );
$meta_font_weight = astra_get_option( 'related-posts-meta-font-weight' );
Astra_Fonts::add_font( $meta_font_family, $meta_font_weight );
// Related Posts - Content Font.
$content_font_family = astra_get_option( 'related-posts-content-font-family' );
$content_font_weight = astra_get_option( 'related-posts-content-font-weight' );
Astra_Fonts::add_font( $content_font_family, $content_font_weight );
}
}
/**
* Set Options Default Values
*
* @param array $defaults Astra options default value array.
* @return array
*/
public function theme_defaults( $defaults ) {
/**
* Update Astra default color and typography values. To not update directly on existing users site, added backwards.
*
* @since 4.0.0
*/
$apply_new_default_color_typo_values = Astra_Dynamic_CSS::astra_check_default_color_typo();
$astra_options = Astra_Theme_Options::get_astra_options();
$astra_blog_update = Astra_Dynamic_CSS::astra_4_6_0_compatibility();
// Related Posts.
$defaults['enable-related-posts'] = false;
$defaults['related-posts-title'] = __( 'Related Posts', 'astra' );
$defaults['releted-posts-title-alignment'] = 'left';
$defaults['related-posts-total-count'] = 2;
$defaults['enable-related-posts-excerpt'] = false;
$defaults['related-posts-box-placement'] = 'default';
$defaults['related-posts-outside-location'] = 'above';
$defaults['related-posts-container-width'] = $astra_blog_update ? '' : 'fallback';
$defaults['related-posts-excerpt-count'] = 25;
$defaults['related-posts-based-on'] = 'categories';
$defaults['related-posts-order-by'] = 'date';
$defaults['related-posts-order'] = 'asc';
$defaults['related-posts-grid-responsive'] = array(
'desktop' => '2-equal',
'tablet' => '2-equal',
'mobile' => 'full',
);
$defaults['related-posts-structure'] = array(
'featured-image',
'title-meta',
);
$defaults['related-posts-tag-style'] = 'none';
$defaults['related-posts-category-style'] = 'none';
$defaults['related-posts-date-format'] = '';
$defaults['related-posts-meta-date-type'] = 'published';
$defaults['related-posts-author-avatar-size'] = '';
$defaults['related-posts-author-avatar'] = false;
$defaults['related-posts-author-prefix-label'] = astra_default_strings( 'string-blog-meta-author-by', false );
$defaults['related-posts-image-size'] = '';
$defaults['related-posts-image-custom-scale-width'] = 16;
$defaults['related-posts-image-custom-scale-height'] = 9;
$defaults['related-posts-image-ratio-pre-scale'] = '16/9';
$defaults['related-posts-image-ratio-type'] = '';
$defaults['related-posts-meta-structure'] = array(
'comments',
'category',
'author',
);
// Related Posts - Color styles.
$defaults['related-posts-text-color'] = $apply_new_default_color_typo_values ? 'var(--ast-global-color-2)' : '';
$defaults['related-posts-link-color'] = '';
$defaults['related-posts-title-color'] = $apply_new_default_color_typo_values ? 'var(--ast-global-color-2)' : '';
$defaults['related-posts-background-color'] = '';
$defaults['related-posts-meta-color'] = '';
$defaults['related-posts-link-hover-color'] = '';
$defaults['related-posts-meta-link-hover-color'] = '';
// Related Posts - Title typo.
$defaults['related-posts-section-title-font-family'] = 'inherit';
$defaults['related-posts-section-title-font-weight'] = 'inherit';
$defaults['related-posts-section-title-text-transform'] = '';
$defaults['related-posts-section-title-line-height'] = $apply_new_default_color_typo_values ? '1.25' : '';
$defaults['related-posts-section-title-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-section-title-font-extras'] ) && isset( $astra_options['related-posts-section-title-line-height'] ) ? $astra_options['related-posts-section-title-line-height'] : '1.6',
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-section-title-font-extras'] ) && isset( $astra_options['related-posts-section-title-text-transform'] ) ? $astra_options['related-posts-section-title-text-transform'] : '',
'text-decoration' => '',
);
$defaults['related-posts-section-title-font-size'] = array(
'desktop' => $apply_new_default_color_typo_values ? '26' : '30',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
// Related Posts - Title typo.
$defaults['related-posts-title-font-family'] = 'inherit';
$defaults['related-posts-title-font-weight'] = $apply_new_default_color_typo_values ? '500' : 'inherit';
$defaults['related-posts-title-text-transform'] = '';
$defaults['related-posts-title-line-height'] = '1';
$defaults['related-posts-title-font-size'] = array(
'desktop' => '20',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
$defaults['related-posts-title-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-title-font-extras'] ) && isset( $astra_options['related-posts-title-line-height'] ) ? $astra_options['related-posts-title-line-height'] : ( $astra_blog_update ? '1.5' : '1' ),
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-title-font-extras'] ) && isset( $astra_options['related-posts-title-text-transform'] ) ? $astra_options['related-posts-title-text-transform'] : '',
'text-decoration' => '',
);
// Related Posts - Meta typo.
$defaults['related-posts-meta-font-family'] = 'inherit';
$defaults['related-posts-meta-font-weight'] = 'inherit';
$defaults['related-posts-meta-text-transform'] = '';
$defaults['related-posts-meta-line-height'] = '';
$defaults['related-posts-meta-font-size'] = array(
'desktop' => '14',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
$defaults['related-posts-meta-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-meta-font-extras'] ) && isset( $astra_options['related-posts-meta-line-height'] ) ? $astra_options['related-posts-meta-line-height'] : '1.6',
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-meta-font-extras'] ) && isset( $astra_options['related-posts-meta-text-transform'] ) ? $astra_options['related-posts-meta-text-transform'] : '',
'text-decoration' => '',
);
// Related Posts - Content typo.
$defaults['related-posts-content-font-family'] = 'inherit';
$defaults['related-posts-content-font-weight'] = 'inherit';
$defaults['related-posts-content-font-extras'] = array(
'line-height' => ! isset( $astra_options['related-posts-content-font-extras'] ) && isset( $astra_options['related-posts-content-line-height'] ) ? $astra_options['related-posts-content-line-height'] : '',
'line-height-unit' => 'em',
'letter-spacing' => '',
'letter-spacing-unit' => 'px',
'text-transform' => ! isset( $astra_options['related-posts-content-font-extras'] ) && isset( $astra_options['related-posts-content-text-transform'] ) ? $astra_options['related-posts-content-text-transform'] : '',
'text-decoration' => '',
);
$defaults['related-posts-content-font-size'] = array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
'desktop-unit' => 'px',
'tablet-unit' => 'px',
'mobile-unit' => 'px',
);
$defaults['ast-sub-section-related-posts-padding'] = array(
'desktop' => array(
'top' => 2.5,
'right' => 2.5,
'bottom' => 2.5,
'left' => 2.5,
),
'tablet' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'mobile' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'desktop-unit' => 'em',
'tablet-unit' => 'em',
'mobile-unit' => 'em',
);
$defaults['ast-sub-section-related-posts-margin'] = array(
'desktop' => array(
'top' => 2,
'right' => '',
'bottom' => '',
'left' => '',
),
'tablet' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'mobile' => array(
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
),
'desktop-unit' => 'em',
'tablet-unit' => 'em',
'mobile-unit' => 'em',
);
return $defaults;
}
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*
* @since 3.5.0
*/
public function related_posts_customize_register( $wp_customize ) {
/**
* Register Config control in Related Posts.
*/
// @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
require_once ASTRA_RELATED_POSTS_DIR . 'customizer/class-astra-related-posts-configs.php';
// @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
}
/**
* Render the Related Posts title for the selective refresh partial.
*
* @since 3.5.0
*/
public function render_related_posts_title() {
return astra_get_option( 'related-posts-title' );
}
}
/**
* Kicking this off by creating NEW instace.
*/
new Astra_Related_Posts_Loader();
/**
* Astra Theme Customizer Configuration Builder.
*
* @package astra-builder
* @author Astra
* @copyright Copyright (c) 2020, Astra
* @link https://wpastra.com/
* @since 3.0.0
*/
// No direct access, please.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Register Builder Customizer Configurations.
*
* @since 3.0.0
*/
class Astra_Button_Component_Configs {
/**
* Register Builder Customizer Configurations.
*
* @param array $configurations Configurations.
* @param string $builder_type Builder Type.
* @param string $section Section.
*
* @since 3.0.0
* @return array $configurations Astra Customizer Configurations with updated configurations.
*/
public static function register_configuration( $configurations, $builder_type = 'header', $section = 'section-hb-button-' ) {
if ( 'footer' === $builder_type ) {
$class_obj = Astra_Builder_Footer::get_instance();
$number_of_button = Astra_Builder_Helper::$num_of_footer_button;
$component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_footer_button;
} else {
$class_obj = Astra_Builder_Header::get_instance();
$number_of_button = Astra_Builder_Helper::$num_of_header_button;
$component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_button;
}
$button_config = array();
for ( $index = 1; $index <= $component_limit; $index++ ) {
$_section = $section . $index;
$_prefix = 'button' . $index;
/**
* These options are related to Header Section - Button.
* Prefix hs represents - Header Section.
*/
$button_config[] = array(
/*
* Header Builder section - Button Component Configs.
*/
array(
'name' => $_section,
'type' => 'section',
'priority' => 50,
/* translators: %s Index */
'title' => ( 1 === $number_of_button ) ? __( 'Button', 'astra' ) : sprintf( __( 'Button %s', 'astra' ), $index ),
'panel' => 'panel-' . $builder_type . '-builder-group',
'clone_index' => $index,
'clone_type' => $builder_type . '-button',
),
/**
* Option: Header Builder Tabs
*/
array(
'name' => $_section . '-ast-context-tabs',
'section' => $_section,
'type' => 'control',
'control' => 'ast-builder-header-control',
'priority' => 0,
'description' => '',
),
/**
* Option: Button Text
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text' ),
'type' => 'control',
'control' => 'text',
'section' => $_section,
'priority' => 20,
'title' => __( 'Text', 'astra' ),
'transport' => 'postMessage',
'partial' => array(
'selector' => '.ast-' . $builder_type . '-button-' . $index,
'container_inclusive' => false,
'render_callback' => array( $class_obj, 'button_' . $index ),
'fallback_refresh' => false,
),
'context' => Astra_Builder_Helper::$general_tab,
),
/**
* Option: Button Link
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-link-option]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-link-option' ),
'type' => 'control',
'control' => 'ast-link',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_link' ),
'section' => $_section,
'priority' => 30,
'title' => __( 'Link', 'astra' ),
'transport' => 'postMessage',
'partial' => array(
'selector' => '.ast-' . $builder_type . '-button-' . $index,
'container_inclusive' => false,
'render_callback' => array( $class_obj, 'button_' . $index ),
),
'context' => Astra_Builder_Helper::$general_tab,
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
),
/**
* Group: Primary Header Button Colors Group
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-color-group' ),
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Text Color', 'astra' ),
'section' => $_section,
'transport' => 'postMessage',
'priority' => 70,
'context' => Astra_Builder_Helper::$design_tab,
'responsive' => true,
'divider' => array( 'ast_class' => 'ast-section-spacing' ),
),
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-color-group' ),
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Background Color', 'astra' ),
'section' => $_section,
'transport' => 'postMessage',
'priority' => 70,
'context' => Astra_Builder_Helper::$design_tab,
'responsive' => true,
),
/**
* Option: Button Text Color
*/
array(
'name' => $builder_type . '-' . $_prefix . '-text-color',
'transport' => 'postMessage',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-color' ),
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]',
'section' => $_section,
'tab' => __( 'Normal', 'astra' ),
'control' => 'ast-responsive-color',
'responsive' => true,
'rgba' => true,
'priority' => 9,
'context' => Astra_Builder_Helper::$design_tab,
'title' => __( 'Normal', 'astra' ),
),
/**
* Option: Button Text Hover Color
*/
array(
'name' => $builder_type . '-' . $_prefix . '-text-h-color',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-h-color' ),
'transport' => 'postMessage',
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-color-group]',
'section' => $_section,
'tab' => __( 'Hover', 'astra' ),
'control' => 'ast-responsive-color',
'responsive' => true,
'rgba' => true,
'priority' => 9,
'context' => Astra_Builder_Helper::$design_tab,
'title' => __( 'Hover', 'astra' ),
),
/**
* Option: Button Background Color
*/
array(
'name' => $builder_type . '-' . $_prefix . '-back-color',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-back-color' ),
'transport' => 'postMessage',
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]',
'section' => $_section,
'tab' => __( 'Normal', 'astra' ),
'control' => 'ast-responsive-color',
'responsive' => true,
'rgba' => true,
'priority' => 10,
'context' => Astra_Builder_Helper::$design_tab,
'title' => __( 'Normal', 'astra' ),
),
/**
* Option: Button Button Hover Color
*/
array(
'name' => $builder_type . '-' . $_prefix . '-back-h-color',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-back-h-color' ),
'transport' => 'postMessage',
'type' => 'sub-control',
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-background-color-group]',
'section' => $_section,
'tab' => __( 'Hover', 'astra' ),
'control' => 'ast-responsive-color',
'responsive' => true,
'rgba' => true,
'priority' => 10,
'context' => Astra_Builder_Helper::$design_tab,
'title' => __( 'Hover', 'astra' ),
),
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]',
'type' => 'control',
'control' => 'ast-color-group',
'title' => __( 'Border Color', 'astra' ),
'section' => $_section,
'priority' => 70,
'transport' => 'postMessage',
'context' => Astra_Builder_Helper::$design_tab,
'responsive' => true,
'divider' => array( 'ast_class' => 'ast-bottom-divider' ),
),
/**
* Option: Button Border Color
*/
array(
'name' => $builder_type . '-' . $_prefix . '-border-color',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-color' ),
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]',
'transport' => 'postMessage',
'type' => 'sub-control',
'section' => $_section,
'control' => 'ast-responsive-color',
'responsive' => true,
'rgba' => true,
'priority' => 70,
'context' => Astra_Builder_Helper::$design_tab,
'title' => __( 'Normal', 'astra' ),
),
/**
* Option: Button Border Hover Color
*/
array(
'name' => $builder_type . '-' . $_prefix . '-border-h-color',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-h-color' ),
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-builder-button-border-colors-group]',
'transport' => 'postMessage',
'type' => 'sub-control',
'section' => $_section,
'control' => 'ast-responsive-color',
'responsive' => true,
'rgba' => true,
'priority' => 70,
'context' => Astra_Builder_Helper::$design_tab,
'title' => __( 'Hover', 'astra' ),
),
/**
* Option: Button Border Size
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-border-size]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-size' ),
'type' => 'control',
'section' => $_section,
'control' => 'ast-border',
'transport' => 'postMessage',
'linked_choices' => true,
'priority' => 99,
'title' => __( 'Border Width', 'astra' ),
'context' => Astra_Builder_Helper::$design_tab,
'choices' => array(
'top' => __( 'Top', 'astra' ),
'right' => __( 'Right', 'astra' ),
'bottom' => __( 'Bottom', 'astra' ),
'left' => __( 'Left', 'astra' ),
),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
),
/**
* Option: Button Radius Fields
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-border-radius-fields]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-border-radius-fields' ),
'type' => 'control',
'control' => 'ast-responsive-spacing',
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_spacing' ),
'section' => $_section,
'title' => __( 'Border Radius', 'astra' ),
'linked_choices' => true,
'transport' => 'postMessage',
'unit_choices' => array( 'px', 'em', '%' ),
'choices' => array(
'top' => __( 'Top', 'astra' ),
'right' => __( 'Right', 'astra' ),
'bottom' => __( 'Bottom', 'astra' ),
'left' => __( 'Left', 'astra' ),
),
'priority' => 99,
'context' => Astra_Builder_Helper::$design_tab,
'connected' => false,
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
),
/**
* Option: Primary Header Button Typography
*/
array(
'name' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-text-typography' ),
'type' => 'control',
'control' => 'ast-settings-group',
'title' => __( 'Font', 'astra' ),
'section' => $_section,
'transport' => 'postMessage',
'context' => Astra_Builder_Helper::$design_tab,
'priority' => 90,
),
/**
* Option: Primary Header Button Font Family
*/
array(
'name' => $builder_type . '-' . $_prefix . '-font-family',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-family' ),
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]',
'type' => 'sub-control',
'section' => $_section,
'control' => 'ast-font',
'font_type' => 'ast-font-family',
'title' => __( 'Font Family', 'astra' ),
'context' => Astra_Builder_Helper::$general_tab,
'connect' => $builder_type . '-' . $_prefix . '-font-weight',
'priority' => 1,
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Primary Footer Button Font Weight
*/
array(
'name' => $builder_type . '-' . $_prefix . '-font-weight',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-weight' ),
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]',
'type' => 'sub-control',
'section' => $_section,
'control' => 'ast-font',
'font_type' => 'ast-font-weight',
'title' => __( 'Font Weight', 'astra' ),
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_font_weight' ),
'connect' => $builder_type . '-' . $_prefix . '-font-family',
'priority' => 2,
'context' => Astra_Builder_Helper::$general_tab,
'divider' => array( 'ast_class' => 'ast-sub-bottom-dotted-divider' ),
),
/**
* Option: Primary Header Button Font Size
*/
array(
'name' => $builder_type . '-' . $_prefix . '-font-size',
'default' => astra_get_option( $builder_type . '-' . $_prefix . '-font-size' ),
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]',
'transport' => 'postMessage',
'title' => __( 'Font Size', 'astra' ),
'type' => 'sub-control',
'section' => $_section,
'control' => 'ast-responsive-slider',
'priority' => 3,
'context' => Astra_Builder_Helper::$general_tab,
'sanitize_callback' => array( 'Astra_Customizer_Sanitizes', 'sanitize_responsive_slider' ),
'suffix' => array( 'px', 'em', 'vw', 'rem' ),
'input_attrs' => array(
'px' => array(
'min' => 0,
'step' => 1,
'max' => 200,
),
'em' => array(
'min' => 0,
'step' => 0.01,
'max' => 20,
),
'vw' => array(
'min' => 0,
'step' => 0.1,
'max' => 25,
),
'rem' => array(
'min' => 0,
'step' => 0.1,
'max' => 20,
),
),
),
/**
* Option: Primary Footer Button Font Extras
*/
array(
'name' => $builder_type . '-' . $_prefix . '-font-extras',
'parent' => ASTRA_THEME_SETTINGS . '[' . $builder_type . '-' . $_prefix . '-text-typography]',
'section' => $_section,
'type' => 'sub-control',
'control' => 'ast-font-extras',
'priority' => 5,
'default' => astra_get_option( 'breadcrumb-font-extras' ),
'context' => Astra_Builder_Helper::$general_tab,
'title' => __( 'Font Extras', 'astra' ),
),
);
if ( 'footer' === $builder_type ) {
$button_config[] = array(
array(
'name' => ASTRA_THEME_SETTINGS . '[footer-button-' . $index . '-alignment]',
'default' => astra_get_option( 'footer-button-' . $index . '-alignment' ),
'type' => 'control',
'control' => 'ast-selector',
'section' => $_section,
'priority' => 35,
'title' => __( 'Alignment', 'astra' ),
'context' => Astra_Builder_Helper::$general_tab,
'transport' => 'postMessage',
'choices' => array(
'flex-start' => 'align-left',
'center' => 'align-center',
'flex-end' => 'align-right',
),
'divider' => array( 'ast_class' => 'ast-top-section-divider' ),
),
);
}
$button_config[] = Astra_Builder_Base_Configuration::prepare_visibility_tab( $_section, $builder_type );
$button_config[] = Astra_Extended_Base_Configuration::prepare_advanced_tab( $_section );
}
$button_config = call_user_func_array( 'array_merge', $button_config + array( array() ) );
$configurations = array_merge( $configurations, $button_config );
return $configurations;
}
}
/**
* Kicking this off by creating object of this class.
*/
new Astra_Button_Component_Configs();
操作のヒント
UIの操作は、オペレーティングシステムの標準ファイルマネージャにほぼ準拠しています。ただし、モバイルブラウザではドラッグ&ドロップはできません。
- 右クリックまたはロングタップでコンテキストメニューを表示します。
- アイテムを移動/コピーするには、フォルダツリーまたはワークスペースにドラッグ&ドロップします。
- ワークスペース内のアイテムの選択は、ShiftキーまたはAltキー(Optionキー)で選択範囲を拡張できます。
- コピー先のフォルダまたはワークスペースにドラッグアンドドロップして、ファイルとフォルダをアップロードします。
- アップロードダイアログでは、クリップボードのデータやURLリストのペースト/ドロップ、他のブラウザやファイルマネージャからのドラッグ&ドロップなどを受け入れることができます。
- Altキー(Optionキー)を押しながらドラッグすると、ブラウザの外にドラッグできます。Google Chromeでダウンロード操作になります。
import Box from '@elementor/ui/Box';
import Container from '@elementor/ui/Container';
import { styled } from '@elementor/ui/styles';
import AccessibilityAssistantEmptyState from '@ea11y/pages/assistant/empty-state';
import AccessibilityAssistantHeading from '@ea11y/pages/assistant/heading';
import AccessibilityAssistantNoResultsState from '@ea11y/pages/assistant/no-results-state';
import AccessibilityAssistantResultsHeading from '@ea11y/pages/assistant/results/heading';
import AccessibilityAssistantResultsTable from '@ea11y/pages/assistant/results/table';
import AccessibilityAssistantStats from '@ea11y/pages/assistant/stats';
import { mixpanelEvents, mixpanelService } from '@ea11y-apps/global/services';
import { useEffect } from '@wordpress/element';
import { useAccessibilityAssistantContext } from '../../contexts/accessibility-assistant-context';
const AccessibilityAssistant = () => {
const {
stats,
loading,
period,
scannerResults,
getFilteredScannerResults,
onPeriodChange,
} = useAccessibilityAssistantContext();
useEffect(() => {
mixpanelService.sendEvent(mixpanelEvents.pageView, {
page: 'Dashboard',
});
}, []);
if (!loading && !scannerResults.length) {
return (
);
}
if (
!loading &&
scannerResults.length &&
!getFilteredScannerResults().length
) {
return (
<>
>
);
}
return (
<>
>
);
};
export const StyledBox = styled(Box)`
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
max-height: 100%;
min-height: 50%;
overflow: auto;
`;
const StyledHeadingWrapper = styled(Box)`
width: 100%;
`;
const StyledHeadingContainer = styled(Container)`
padding: ${({ theme }) => theme.spacing(4)};
@media (min-width: ${({ theme }) => theme.breakpoints.values.xl}px) {
padding-inline: 0;
}
`;
export const StyledContainer = styled(Container)`
padding: ${({ theme }) => theme.spacing(1, 4, 4)};
@media (min-width: ${({ theme }) => theme.breakpoints.values.xl}px) {
padding-inline: 0;
}
`;
export default AccessibilityAssistant;