/* * This file is part of Psy Shell. * * (c) 2012-2025 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy; use Psy\Exception\BreakException; use Psy\ExecutionLoop\ProcessForker; use Psy\ManualUpdater\ManualUpdate; use Psy\Util\DependencyChecker; use Psy\VersionUpdater\GitHubChecker; use Psy\VersionUpdater\Installer; use Psy\VersionUpdater\SelfUpdate; use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; if (!\function_exists('Psy\\sh')) { /** * Command to return the eval-able code to startup PsySH. * * eval(\Psy\sh()); */ function sh(): string { if (\version_compare(\PHP_VERSION, '8.0', '<')) { return '\extract(\Psy\debug(\get_defined_vars(), isset($this) ? $this : @\get_called_class()));'; } return <<<'EOS' if (isset($this)) { \extract(\Psy\debug(\get_defined_vars(), $this)); } else { try { static::class; \extract(\Psy\debug(\get_defined_vars(), static::class)); } catch (\Error $e) { \extract(\Psy\debug(\get_defined_vars())); } } EOS; } } if (!\function_exists('Psy\\debug')) { /** * Invoke a Psy Shell from the current context. * * For example: * * foreach ($items as $item) { * \Psy\debug(get_defined_vars()); * } * * If you would like your shell interaction to affect the state of the * current context, you can extract() the values returned from this call: * * foreach ($items as $item) { * extract(\Psy\debug(get_defined_vars())); * var_dump($item); // will be whatever you set $item to in Psy Shell * } * * Optionally, supply an object as the `$bindTo` parameter. This determines * the value `$this` will have in the shell, and sets up class scope so that * private and protected members are accessible: * * class Foo { * function bar() { * \Psy\debug(get_defined_vars(), $this); * } * } * * For the static equivalent, pass a class name as the `$bindTo` parameter. * This makes `self` work in the shell, and sets up static scope so that * private and protected static members are accessible: * * class Foo { * static function bar() { * \Psy\debug(get_defined_vars(), get_called_class()); * } * } * * @param array $vars Scope variables from the calling context (default: []) * @param object|string $bindTo Bound object ($this) or class (self) value for the shell * * @return array Scope variables from the debugger session */ function debug(array $vars = [], $bindTo = null): array { echo \PHP_EOL; $sh = new Shell(); $sh->setScopeVariables($vars); // Show a couple of lines of call context for the debug session. // // @todo come up with a better way of doing this which doesn't involve injecting input :-P if ($sh->has('whereami')) { $sh->addInput('whereami -n2', true); } if (\is_string($bindTo)) { $sh->setBoundClass($bindTo); } elseif ($bindTo !== null) { $sh->setBoundObject($bindTo); } $sh->run(); return $sh->getScopeVariables(false); } } if (!\function_exists('Psy\\info')) { /** * Get a bunch of debugging info about the current PsySH environment and * configuration. * * If a Configuration param is passed, that configuration is stored and * used for the current shell session, and no debugging info is returned. * * @param Configuration|null $config * * @return array|null */ function info(?Configuration $config = null) { static $lastConfig; if ($config !== null) { $lastConfig = $config; return null; } $config = $lastConfig ?: new Configuration(); $configEnv = (isset($_SERVER['PSYSH_CONFIG']) && $_SERVER['PSYSH_CONFIG']) ? $_SERVER['PSYSH_CONFIG'] : false; if ($configEnv === false && \PHP_SAPI === 'cli-server') { $configEnv = \getenv('PSYSH_CONFIG'); } $shellInfo = [ 'PsySH version' => Shell::VERSION, ]; $core = [ 'PHP version' => \PHP_VERSION, 'OS' => \PHP_OS, 'default includes' => $config->getDefaultIncludes(), 'require semicolons' => $config->requireSemicolons(), 'strict types' => $config->strictTypes(), 'error logging level' => $config->errorLoggingLevel(), 'config file' => [ 'default config file' => ConfigPaths::prettyPath($config->getConfigFile()), 'local config file' => ConfigPaths::prettyPath($config->getLocalConfigFile()), 'PSYSH_CONFIG env' => ConfigPaths::prettyPath($configEnv), ], // 'config dir' => $config->getConfigDir(), // 'data dir' => $config->getDataDir(), // 'runtime dir' => $config->getRuntimeDir(), ]; // Use an explicit, fresh update check here, rather than relying on whatever is in $config. $checker = new GitHubChecker(); $updateAvailable = null; $latest = null; try { $updateAvailable = !$checker->isLatest(); $latest = $checker->getLatest(); } catch (\Throwable $e) { } $updates = [ 'update available' => $updateAvailable, 'latest release version' => $latest, 'update check interval' => $config->getUpdateCheck(), 'update cache file' => ConfigPaths::prettyPath($config->getUpdateCheckCacheFile()), ]; $input = [ 'interactive mode' => $config->interactiveMode(), 'input interactive' => $config->getInputInteractive(), 'yolo' => $config->yolo(), ]; if ($config->hasReadline()) { $info = \readline_info(); $readline = [ 'readline available' => true, 'readline enabled' => $config->useReadline(), 'readline service' => \get_class($config->getReadline()), ]; if (isset($info['library_version'])) { $readline['readline library'] = $info['library_version']; } if (isset($info['readline_name']) && $info['readline_name'] !== '') { $readline['readline name'] = $info['readline_name']; } } else { $readline = [ 'readline available' => false, ]; } $output = [ 'color mode' => $config->colorMode(), 'output decorated' => $config->getOutputDecorated(), 'output verbosity' => $config->verbosity(), 'output pager' => $config->getPager(), ]; $theme = $config->theme(); // @todo show styles (but only if they're different than default?) $output['theme'] = [ 'compact' => $theme->compact(), 'prompt' => $theme->prompt(), 'bufferPrompt' => $theme->bufferPrompt(), 'replayPrompt' => $theme->replayPrompt(), 'returnValue' => $theme->returnValue(), ]; $pcntl = [ 'pcntl available' => DependencyChecker::functionsAvailable(ProcessForker::PCNTL_FUNCTIONS), 'posix available' => DependencyChecker::functionsAvailable(ProcessForker::POSIX_FUNCTIONS), ]; if ($disabledPcntl = DependencyChecker::functionsDisabled(ProcessForker::PCNTL_FUNCTIONS)) { $pcntl['disabled pcntl functions'] = $disabledPcntl; } if ($disabledPosix = DependencyChecker::functionsDisabled(ProcessForker::POSIX_FUNCTIONS)) { $pcntl['disabled posix functions'] = $disabledPosix; } $pcntl['use pcntl'] = $config->usePcntl(); $history = [ 'history file' => ConfigPaths::prettyPath($config->getHistoryFile()), 'history size' => $config->getHistorySize(), 'erase duplicates' => $config->getEraseDuplicates(), ]; $manualDbFile = $config->getManualDbFile(); $manual = $config->getManual(); // If we have a manual but no db file path, it's bundled in the PHAR if ($manual && !$manualDbFile && \Phar::running(false)) { $docs = [ 'manual db file' => '', ]; } else { $docs = [ 'manual db file' => ConfigPaths::prettyPath($manualDbFile), ]; } if ($manual) { $meta = $manual->getMeta(); foreach ($meta as $key => $val) { switch ($key) { case 'built_at': $d = new \DateTime('@'.$val); $val = $d->format(\DateTime::RFC2822); break; } $key = 'manual '.\str_replace('_', ' ', $key); $docs[$key] = $val; } } $autocomplete = [ 'tab completion enabled' => $config->useTabCompletion(), 'bracketed paste' => $config->useBracketedPaste(), ]; $warmers = $config->getAutoloadWarmers(); $autoload = [ 'autoload warming enabled' => !empty($warmers), 'warmers configured' => \count($warmers), ]; if (!empty($warmers)) { $autoload['warmer types'] = \array_map('get_class', $warmers); // Add extended info for ComposerAutoloadWarmer foreach ($warmers as $warmer) { if ($warmer instanceof TabCompletion\AutoloadWarmer\ComposerAutoloadWarmer) { try { $autoload['composer warmer config'] = [ 'include vendor' => Sudo::fetchProperty($warmer, 'includeVendor'), 'include tests' => Sudo::fetchProperty($warmer, 'includeTests'), 'vendor dir' => Sudo::fetchProperty($warmer, 'vendorDir'), 'phar prefix' => Sudo::fetchProperty($warmer, 'pharPrefix'), ]; $includeNamespaces = Sudo::fetchProperty($warmer, 'includeNamespaces'); $excludeNamespaces = Sudo::fetchProperty($warmer, 'excludeNamespaces'); $includeVendorNamespaces = Sudo::fetchProperty($warmer, 'includeVendorNamespaces'); $excludeVendorNamespaces = Sudo::fetchProperty($warmer, 'excludeVendorNamespaces'); if (!empty($includeNamespaces)) { $autoload['composer warmer config']['include namespaces'] = $includeNamespaces; } if (!empty($excludeNamespaces)) { $autoload['composer warmer config']['exclude namespaces'] = $excludeNamespaces; } if (!empty($includeVendorNamespaces)) { $autoload['composer warmer config']['include vendor namespaces'] = $includeVendorNamespaces; } if (!empty($excludeVendorNamespaces)) { $autoload['composer warmer config']['exclude vendor namespaces'] = $excludeVendorNamespaces; } } catch (\ReflectionException $e) { // shrug } break; // Only show info for the first ComposerAutoloadWarmer } } } $implicitUse = []; $implicitUseConfig = $config->getImplicitUse(); if (\is_array($implicitUseConfig)) { if (!empty($implicitUseConfig['includeNamespaces'])) { $implicitUse['include namespaces'] = $implicitUseConfig['includeNamespaces']; } if (!empty($implicitUseConfig['excludeNamespaces'])) { $implicitUse['exclude namespaces'] = $implicitUseConfig['excludeNamespaces']; } } if (empty($implicitUse)) { $implicitUse = false; } // Shenanigans, but totally justified. try { if ($shell = Sudo::fetchProperty($config, 'shell')) { $shellClass = \get_class($shell); if ($shellClass !== 'Psy\\Shell') { $shellInfo = [ 'PsySH version' => $shell::VERSION, 'Shell class' => $shellClass, ]; } try { $core['loop listeners'] = \array_map('get_class', Sudo::fetchProperty($shell, 'loopListeners')); } catch (\ReflectionException $e) { // shrug } $core['commands'] = \array_map('get_class', $shell->all()); try { $autocomplete['custom matchers'] = \array_map('get_class', Sudo::fetchProperty($shell, 'matchers')); } catch (\ReflectionException $e) { // shrug } } } catch (\ReflectionException $e) { // shrug } // @todo Show Presenter / custom casters. return \array_merge( $shellInfo, $core, \compact( 'updates', 'pcntl', 'input', 'readline', 'output', 'history', 'docs', 'autocomplete', 'autoload' ), [ 'implicit use' => $implicitUse, ], ); } } if (!\function_exists('Psy\\bin')) { /** * `psysh` command line executable. * * @return \Closure */ function bin(): \Closure { return function () { if (!isset($_SERVER['PSYSH_IGNORE_ENV']) || !$_SERVER['PSYSH_IGNORE_ENV']) { if (\defined('HHVM_VERSION_ID')) { \fwrite(\STDERR, 'PsySH v0.11 and higher does not support HHVM. Install an older version, or set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (\PHP_VERSION_ID < 70400) { \fwrite(\STDERR, 'PHP 7.4.0 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (\PHP_VERSION_ID > 89999) { \fwrite(\STDERR, 'PHP 9 or higher is not supported. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (!\function_exists('json_encode')) { \fwrite(\STDERR, 'The JSON extension is required. Please install it. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } if (!\function_exists('token_get_all')) { \fwrite(\STDERR, 'The Tokenizer extension is required. Please install it. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.'.\PHP_EOL); exit(1); } } $usageException = null; $shellIsPhar = Shell::isPhar(); $input = new ArgvInput(); try { $input->bind(new InputDefinition(\array_merge(Configuration::getInputOptions(), [ new InputOption('help', 'h', InputOption::VALUE_NONE), new InputOption('version', 'V', InputOption::VALUE_NONE), new InputOption('self-update', 'u', InputOption::VALUE_NONE), new InputOption('update-manual', null, InputOption::VALUE_OPTIONAL, '', false), new InputOption('info', null, InputOption::VALUE_NONE), new InputArgument('include', InputArgument::IS_ARRAY), ]))); } catch (\RuntimeException $e) { $usageException = $e; } try { $config = Configuration::fromInput($input); } catch (\InvalidArgumentException $e) { $usageException = $e; } // Handle --help if (!isset($config) || $usageException !== null || $input->getOption('help')) { // Determine if we should use colors $useColors = true; if ($input->hasParameterOption(['--no-color'])) { $useColors = false; } elseif (!$input->hasParameterOption(['--color']) && !\stream_isatty(\STDOUT)) { $useColors = false; } // Create output formatter for proper tag rendering $formatter = new OutputFormatter($useColors); if ($usageException !== null) { echo $usageException->getMessage().\PHP_EOL.\PHP_EOL; } $version = Shell::getVersionHeader(false); $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : []; $name = $argv ? \basename(\reset($argv)) : 'psysh'; $selfUpdateOption = $shellIsPhar ? "\n -u, --self-update Install a newer version if available" : ''; $helpText = <<Description: A runtime developer console, interactive debugger and REPL for PHP Usage: $name [options] [--] [...] Arguments: files PHP file(s) to load before starting the shell Options: -h, --help Display this help message --info Display PsySH environment and configuration info -V, --version Display the PsySH version{$selfUpdateOption} --update-manual[=LANG] Download and install the latest PHP manual (optional language code) --warm-autoload Enable autoload warming for better tab completion --yolo Run PsySH without input validation (you don't want this) -c, --config=FILE Use an alternate PsySH config file location --cwd=PATH Use an alternate working directory --color|--no-color Force (or disable with --no-color) colors in output -i, --interactive Force PsySH to run in interactive mode -n, --no-interactive Run PsySH without interactive input (requires input from stdin) -r, --raw-output Print var_export-style return values (for non-interactive input) --compact Run PsySH with compact output -q, --quiet Shhhhhh -v|vv|vvv, --verbose Increase the verbosity of messages Help: PsySH is an interactive runtime developer console for PHP. Use it as a REPL for quick experiments, or drop into your code with eval(\Psy\sh()); or \Psy\debug(); to inspect application state and debug interactively. For more information, see https://psysh.org Examples: $name # Start interactive shell $name -c ~/.config/psysh.php # Use custom config $name --warm-autoload # Enable autoload warming $name index.php # Load file before starting EOL; echo $formatter->format($helpText); exit($usageException === null ? 0 : 1); } // Handle --version if ($input->getOption('version')) { echo Shell::getVersionHeader($config->useUnicode()).\PHP_EOL; exit(0); } // Handle --info if ($input->getOption('info')) { // Store config for info() function info($config); $infoData = info(); // Format and display the info $output = $config->getOutput(); if ($config->rawOutput()) { $output->writeln(\var_export($infoData, true)); } else { $presenter = $config->getPresenter(); $output->writeln($presenter->present($infoData)); } exit(0); } // Handle --self-update if ($input->getOption('self-update')) { if (!$shellIsPhar) { \fwrite(\STDERR, 'The --self-update option can only be used with with a phar based install.'.\PHP_EOL); exit(1); } $selfUpdate = new SelfUpdate(new GitHubChecker(), new Installer()); $result = $selfUpdate->run($input, $config->getOutput()); exit($result); } // Handle --update-manual if ($input->getOption('update-manual') !== false) { $manualUpdate = ManualUpdate::fromConfig($config, $input); $result = $manualUpdate->run($input, $config->getOutput()); exit($result); } $shell = new Shell($config); // Pass additional arguments to Shell as 'includes' $shell->setIncludes($input->getArgument('include')); try { // And go! $exitCode = $shell->run(); if ($exitCode !== 0) { exit($exitCode); } } catch (BreakException $e) { // BreakException can escape if thrown before the execution loop starts // (though it shouldn't in normal operation) exit($e->getCode()); } catch (\Throwable $e) { \fwrite(\STDERR, $e->getMessage().\PHP_EOL); exit(1); } }; } } /** * Astra Updates * * Functions for updating data, used by the background updater. * * @package Astra * @version 2.1.3 */ defined( 'ABSPATH' ) || exit; /** * Clear Astra + Astra Pro assets cache. * * @since 3.6.1 * @return void. */ function astra_clear_all_assets_cache() { if ( ! class_exists( 'Astra_Cache_Base' ) ) { return; } // Clear Astra theme asset cache. $astra_cache_base_instance = new Astra_Cache_Base( 'astra' ); $astra_cache_base_instance->refresh_assets( 'astra' ); // Clear Astra Addon's static and dynamic CSS asset cache. $astra_addon_cache_base_instance = new Astra_Cache_Base( 'astra-addon' ); $astra_addon_cache_base_instance->refresh_assets( 'astra-addon' ); } /** * 4.0.0 backward handling part. * * 1. Migrate existing setting & do required onboarding for new admin dashboard v4.0.0 app. * 2. Migrating Post Structure & Meta options in title area meta parts. * * @since 4.0.0 * @return void */ function astra_theme_background_updater_4_0_0() { // Dynamic customizer migration starts here. $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['dynamic-blog-layouts'] ) && ! isset( $theme_options['theme-dynamic-customizer-support'] ) ) { $theme_options['dynamic-blog-layouts'] = false; $theme_options['theme-dynamic-customizer-support'] = true; $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); // Archive summary box compatibility. $archive_title_font_size = array( 'desktop' => isset( $theme_options['font-size-archive-summary-title']['desktop'] ) ? $theme_options['font-size-archive-summary-title']['desktop'] : 40, 'tablet' => isset( $theme_options['font-size-archive-summary-title']['tablet'] ) ? $theme_options['font-size-archive-summary-title']['tablet'] : '', 'mobile' => isset( $theme_options['font-size-archive-summary-title']['mobile'] ) ? $theme_options['font-size-archive-summary-title']['mobile'] : '', 'desktop-unit' => isset( $theme_options['font-size-archive-summary-title']['desktop-unit'] ) ? $theme_options['font-size-archive-summary-title']['desktop-unit'] : 'px', 'tablet-unit' => isset( $theme_options['font-size-archive-summary-title']['tablet-unit'] ) ? $theme_options['font-size-archive-summary-title']['tablet-unit'] : 'px', 'mobile-unit' => isset( $theme_options['font-size-archive-summary-title']['mobile-unit'] ) ? $theme_options['font-size-archive-summary-title']['mobile-unit'] : 'px', ); $single_title_font_size = array( 'desktop' => isset( $theme_options['font-size-entry-title']['desktop'] ) ? $theme_options['font-size-entry-title']['desktop'] : '', 'tablet' => isset( $theme_options['font-size-entry-title']['tablet'] ) ? $theme_options['font-size-entry-title']['tablet'] : '', 'mobile' => isset( $theme_options['font-size-entry-title']['mobile'] ) ? $theme_options['font-size-entry-title']['mobile'] : '', 'desktop-unit' => isset( $theme_options['font-size-entry-title']['desktop-unit'] ) ? $theme_options['font-size-entry-title']['desktop-unit'] : 'px', 'tablet-unit' => isset( $theme_options['font-size-entry-title']['tablet-unit'] ) ? $theme_options['font-size-entry-title']['tablet-unit'] : 'px', 'mobile-unit' => isset( $theme_options['font-size-entry-title']['mobile-unit'] ) ? $theme_options['font-size-entry-title']['mobile-unit'] : 'px', ); $archive_summary_box_bg = array( 'desktop' => array( 'background-color' => ! empty( $theme_options['archive-summary-box-bg-color'] ) ? $theme_options['archive-summary-box-bg-color'] : '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', 'background-type' => '', 'background-media' => '', ), 'tablet' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', 'background-type' => '', 'background-media' => '', ), 'mobile' => array( 'background-color' => '', 'background-image' => '', 'background-repeat' => 'repeat', 'background-position' => 'center center', 'background-size' => 'auto', 'background-attachment' => 'scroll', 'background-type' => '', 'background-media' => '', ), ); // Single post structure. foreach ( $post_types as $index => $post_type ) { /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_post_structure = isset( $theme_options['blog-single-post-structure'] ) ? $theme_options['blog-single-post-structure'] : array( 'single-image', 'single-title-meta' ); /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrated_post_structure = array(); if ( ! empty( $single_post_structure ) ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort foreach ( $single_post_structure as $key ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( 'single-title-meta' === $key ) { $migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title'; if ( 'post' === $post_type ) { $migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-meta'; } } if ( 'single-image' === $key ) { $migrated_post_structure[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-image'; } } $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-structure' ] = $migrated_post_structure; } // Single post meta. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_post_meta = isset( $theme_options['blog-single-meta'] ) ? $theme_options['blog-single-meta'] : array( 'comments', 'category', 'author' ); /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrated_post_metadata = array(); if ( ! empty( $single_post_meta ) ) { $tax_counter = 0; $tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy'; /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort foreach ( $single_post_meta as $key ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort switch ( $key ) { case 'author': $migrated_post_metadata[] = 'author'; break; case 'date': $migrated_post_metadata[] = 'date'; break; case 'comments': $migrated_post_metadata[] = 'comments'; break; case 'category': if ( 'post' === $post_type ) { $migrated_post_metadata[] = $tax_slug; $theme_options[ $tax_slug ] = 'category'; $tax_counter = ++$tax_counter; $tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy-' . $tax_counter; } break; case 'tag': if ( 'post' === $post_type ) { $migrated_post_metadata[] = $tax_slug; $theme_options[ $tax_slug ] = 'post_tag'; $tax_counter = ++$tax_counter; $tax_slug = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-taxonomy-' . $tax_counter; } break; default: break; } } $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-metadata' ] = $migrated_post_metadata; } // Archive layout compatibilities. $archive_banner_layout = ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true; // Setting WooCommerce archive option disabled as WC already added their header content on archive. $theme_options[ 'ast-archive-' . esc_attr( $post_type ) . '-title' ] = $archive_banner_layout; // Single layout compatibilities. $single_banner_layout = ( class_exists( 'WooCommerce' ) && 'product' === $post_type ) ? false : true; // Setting WC single option disabled as there is no any header set from default WooCommerce. $theme_options[ 'ast-single-' . esc_attr( $post_type ) . '-title' ] = $single_banner_layout; // BG color support. $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-image-type' ] = ! empty( $theme_options['archive-summary-box-bg-color'] ) ? 'custom' : 'none'; $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-custom-bg' ] = $archive_summary_box_bg; // Archive title font support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-family' ] = ! empty( $theme_options['font-family-archive-summary-title'] ) ? $theme_options['font-family-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-size' ] = $archive_title_font_size; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-weight' ] = ! empty( $theme_options['font-weight-archive-summary-title'] ) ? $theme_options['font-weight-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $archive_dynamic_line_height = ! empty( $theme_options['line-height-archive-summary-title'] ) ? $theme_options['line-height-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $archive_dynamic_text_transform = ! empty( $theme_options['text-transform-archive-summary-title'] ) ? $theme_options['text-transform-archive-summary-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-title-font-extras' ] = array( 'line-height' => $archive_dynamic_line_height, 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => $archive_dynamic_text_transform, 'text-decoration' => '', ); // Archive title colors support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-title-color' ] = ! empty( $theme_options['archive-summary-box-title-color'] ) ? $theme_options['archive-summary-box-title-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-text-color' ] = ! empty( $theme_options['archive-summary-box-text-color'] ) ? $theme_options['archive-summary-box-text-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort // Single title colors support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-banner-title-color' ] = ! empty( $theme_options['entry-title-color'] ) ? $theme_options['entry-title-color'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort // Single title font support. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-family' ] = ! empty( $theme_options['font-family-entry-title'] ) ? $theme_options['font-family-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-size' ] = $single_title_font_size; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-weight' ] = ! empty( $theme_options['font-weight-entry-title'] ) ? $theme_options['font-weight-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_dynamic_line_height = ! empty( $theme_options['line-height-entry-title'] ) ? $theme_options['line-height-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $single_dynamic_text_transform = ! empty( $theme_options['text-transform-entry-title'] ) ? $theme_options['text-transform-entry-title'] : ''; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras' ] = array( 'line-height' => $single_dynamic_line_height, 'line-height-unit' => 'em', 'letter-spacing' => '', 'letter-spacing-unit' => 'px', 'text-transform' => $single_dynamic_text_transform, 'text-decoration' => '', ); } // Set page specific structure, as page only has featured image at top & title beneath to it, hardcoded writing it here. $theme_options['ast-dynamic-single-page-structure'] = array( 'ast-dynamic-single-page-image', 'ast-dynamic-single-page-title' ); // EDD content layout & sidebar layout migration in new dynamic option. $theme_options['archive-download-content-layout'] = isset( $theme_options['edd-archive-product-layout'] ) ? $theme_options['edd-archive-product-layout'] : 'default'; $theme_options['archive-download-sidebar-layout'] = isset( $theme_options['edd-sidebar-layout'] ) ? $theme_options['edd-sidebar-layout'] : 'no-sidebar'; $theme_options['single-download-content-layout'] = isset( $theme_options['edd-single-product-layout'] ) ? $theme_options['edd-single-product-layout'] : 'default'; $theme_options['single-download-sidebar-layout'] = isset( $theme_options['edd-single-product-sidebar-layout'] ) ? $theme_options['edd-single-product-sidebar-layout'] : 'default'; update_option( 'astra-settings', $theme_options ); } // Admin backward handling starts here. $admin_dashboard_settings = get_option( 'astra_admin_settings', array() ); if ( ! isset( $admin_dashboard_settings['theme-setup-admin-migrated'] ) ) { if ( ! isset( $admin_dashboard_settings['self_hosted_gfonts'] ) ) { $admin_dashboard_settings['self_hosted_gfonts'] = isset( $theme_options['load-google-fonts-locally'] ) ? $theme_options['load-google-fonts-locally'] : false; } if ( ! isset( $admin_dashboard_settings['preload_local_fonts'] ) ) { $admin_dashboard_settings['preload_local_fonts'] = isset( $theme_options['preload-local-fonts'] ) ? $theme_options['preload-local-fonts'] : false; } // Consider admin part from theme side migrated. $admin_dashboard_settings['theme-setup-admin-migrated'] = true; update_option( 'astra_admin_settings', $admin_dashboard_settings ); } // Check if existing user and disable smooth scroll-to-id. if ( ! isset( $theme_options['enable-scroll-to-id'] ) ) { $theme_options['enable-scroll-to-id'] = false; update_option( 'astra-settings', $theme_options ); } // Check if existing user and disable scroll to top if disabled from pro addons list. $scroll_to_top_visibility = false; /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( defined( 'ASTRA_EXT_VER' ) && Astra_Ext_Extension::is_active( 'scroll-to-top' ) ) { /** @psalm-suppress UndefinedClass */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $scroll_to_top_visibility = true; } if ( ! isset( $theme_options['scroll-to-top-enable'] ) ) { $theme_options['scroll-to-top-enable'] = $scroll_to_top_visibility; update_option( 'astra-settings', $theme_options ); } // Default colors & typography flag. if ( ! isset( $theme_options['update-default-color-typo'] ) ) { $theme_options['update-default-color-typo'] = false; update_option( 'astra-settings', $theme_options ); } // Block editor experience improvements compatibility flag. if ( ! isset( $theme_options['v4-block-editor-compat'] ) ) { $theme_options['v4-block-editor-compat'] = false; update_option( 'astra-settings', $theme_options ); } } /** * 4.0.2 backward handling part. * * 1. Read Time option backwards handling for old users. * * @since 4.0.2 * @return void */ function astra_theme_background_updater_4_0_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-0-2-update-migration'] ) && isset( $theme_options['blog-single-meta'] ) && in_array( 'read-time', $theme_options['blog-single-meta'] ) ) { if ( isset( $theme_options['ast-dynamic-single-post-metadata'] ) && ! in_array( 'read-time', $theme_options['ast-dynamic-single-post-metadata'] ) ) { $theme_options['ast-dynamic-single-post-metadata'][] = 'read-time'; $theme_options['v4-0-2-update-migration'] = true; update_option( 'astra-settings', $theme_options ); } } } /** * Handle backward compatibility on version 4.1.0 * * @since 4.1.0 * @return void */ function astra_theme_background_updater_4_1_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-1-0-update-migration'] ) ) { $theme_options['v4-1-0-update-migration'] = true; $current_payment_list = array(); $old_payment_list = isset( $theme_options['single-product-payment-list']['items'] ) ? $theme_options['single-product-payment-list']['items'] : array(); $visa_payment = isset( $theme_options['single-product-payment-visa'] ) ? $theme_options['single-product-payment-visa'] : ''; $mastercard_payment = isset( $theme_options['single-product-payment-mastercard'] ) ? $theme_options['single-product-payment-mastercard'] : ''; $discover_payment = isset( $theme_options['single-product-payment-discover'] ) ? $theme_options['single-product-payment-discover'] : ''; $paypal_payment = isset( $theme_options['single-product-payment-paypal'] ) ? $theme_options['single-product-payment-paypal'] : ''; $apple_pay_payment = isset( $theme_options['single-product-payment-apple-pay'] ) ? $theme_options['single-product-payment-apple-pay'] : ''; false !== $visa_payment ? array_push( $current_payment_list, array( 'id' => 'item-100', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-visa', 'image' => '', 'label' => __( 'Visa', 'astra' ), ) ) : ''; false !== $mastercard_payment ? array_push( $current_payment_list, array( 'id' => 'item-101', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-mastercard', 'image' => '', 'label' => __( 'Mastercard', 'astra' ), ) ) : ''; false !== $mastercard_payment ? array_push( $current_payment_list, array( 'id' => 'item-102', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-amex', 'image' => '', 'label' => __( 'Amex', 'astra' ), ) ) : ''; false !== $discover_payment ? array_push( $current_payment_list, array( 'id' => 'item-103', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-discover', 'image' => '', 'label' => __( 'Discover', 'astra' ), ) ) : ''; $paypal_payment ? array_push( $current_payment_list, array( 'id' => 'item-104', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-paypal', 'image' => '', 'label' => __( 'Paypal', 'astra' ), ) ) : ''; $apple_pay_payment ? array_push( $current_payment_list, array( 'id' => 'item-105', 'enabled' => true, 'source' => 'icon', 'icon' => 'cc-apple-pay', 'image' => '', 'label' => __( 'Apple Pay', 'astra' ), ) ) : ''; if ( $current_payment_list ) { $theme_options['single-product-payment-list'] = array( 'items' => array_merge( $current_payment_list, $old_payment_list ), ); update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['woo_support_global_settings'] ) ) { $theme_options['woo_support_global_settings'] = true; update_option( 'astra-settings', $theme_options ); } if ( isset( $theme_options['theme-dynamic-customizer-support'] ) ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-title-font-extras' ]['text-transform'] = ''; } update_option( 'astra-settings', $theme_options ); } } } /** * 4.1.4 backward handling cases. * * 1. Migrating users to combined color overlay option to new dedicated overlay options. * * @since 4.1.4 * @return void */ function astra_theme_background_updater_4_1_4() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-1-4-update-migration'] ) ) { $ast_bg_control_options = array( 'off-canvas-background', 'footer-adv-bg-obj', 'footer-bg-obj', ); foreach ( $ast_bg_control_options as $key => $bg_option ) { if ( isset( $theme_options[ $bg_option ] ) && ! isset( $theme_options[ $bg_option ]['overlay-type'] ) ) { $bg_type = isset( $theme_options[ $bg_option ]['background-type'] ) ? $theme_options[ $bg_option ]['background-type'] : ''; $theme_options[ $bg_option ]['overlay-type'] = 'none'; $theme_options[ $bg_option ]['overlay-color'] = ''; $theme_options[ $bg_option ]['overlay-opacity'] = ''; $theme_options[ $bg_option ]['overlay-gradient'] = ''; if ( 'image' === $bg_type ) { $bg_img = isset( $theme_options[ $bg_option ]['background-image'] ) ? $theme_options[ $bg_option ]['background-image'] : ''; $bg_color = isset( $theme_options[ $bg_option ]['background-color'] ) ? $theme_options[ $bg_option ]['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $bg_option ]['overlay-type'] = 'classic'; $theme_options[ $bg_option ]['overlay-color'] = $bg_color; $theme_options[ $bg_option ]['overlay-opacity'] = ''; $theme_options[ $bg_option ]['overlay-gradient'] = ''; } } } } $ast_resp_bg_control_options = array( 'hba-footer-bg-obj-responsive', 'hbb-footer-bg-obj-responsive', 'footer-bg-obj-responsive', 'footer-menu-bg-obj-responsive', 'hb-footer-bg-obj-responsive', 'hba-header-bg-obj-responsive', 'hbb-header-bg-obj-responsive', 'hb-header-bg-obj-responsive', 'header-mobile-menu-bg-obj-responsive', 'site-layout-outside-bg-obj-responsive', 'content-bg-obj-responsive', ); $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { $ast_resp_bg_control_options[] = 'ast-dynamic-archive-' . esc_attr( $post_type ) . '-banner-custom-bg'; $ast_resp_bg_control_options[] = 'ast-dynamic-single-' . esc_attr( $post_type ) . '-banner-background'; } $component_limit = defined( 'ASTRA_EXT_VER' ) ? Astra_Builder_Helper::$component_limit : Astra_Builder_Helper::$num_of_header_menu; for ( $index = 1; $index <= $component_limit; $index++ ) { $_prefix = 'menu' . $index; $ast_resp_bg_control_options[] = 'header-' . $_prefix . '-bg-obj-responsive'; } foreach ( $ast_resp_bg_control_options as $key => $resp_bg_option ) { // Desktop version. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( isset( $theme_options[ $resp_bg_option ]['desktop'] ) && is_array( $theme_options[ $resp_bg_option ]['desktop'] ) && ! isset( $theme_options[ $resp_bg_option ]['desktop']['overlay-type'] ) ) { // @codingStandardsIgnoreStart $desk_bg_type = isset( $theme_options[ $resp_bg_option ]['desktop']['background-type'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-type'] : ''; // @codingStandardsIgnoreEnd $theme_options[ $resp_bg_option ]['desktop']['overlay-type'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-color'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-gradient'] = ''; if ( 'image' === $desk_bg_type ) { $bg_img = isset( $theme_options[ $resp_bg_option ]['desktop']['background-image'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-image'] : ''; $bg_color = isset( $theme_options[ $resp_bg_option ]['desktop']['background-color'] ) ? $theme_options[ $resp_bg_option ]['desktop']['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $resp_bg_option ]['desktop']['overlay-type'] = 'classic'; $theme_options[ $resp_bg_option ]['desktop']['overlay-color'] = $bg_color; $theme_options[ $resp_bg_option ]['desktop']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['desktop']['overlay-gradient'] = ''; } } } // Tablet version. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( isset( $theme_options[ $resp_bg_option ]['tablet'] ) && is_array( $theme_options[ $resp_bg_option ]['tablet'] ) && ! isset( $theme_options[ $resp_bg_option ]['tablet']['overlay-type'] ) ) { // @codingStandardsIgnoreStart $tablet_bg_type = isset( $theme_options[ $resp_bg_option ]['tablet']['background-type'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-type'] : ''; // @codingStandardsIgnoreEnd $theme_options[ $resp_bg_option ]['tablet']['overlay-type'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-color'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-gradient'] = ''; if ( 'image' === $tablet_bg_type ) { $bg_img = isset( $theme_options[ $resp_bg_option ]['tablet']['background-image'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-image'] : ''; $bg_color = isset( $theme_options[ $resp_bg_option ]['tablet']['background-color'] ) ? $theme_options[ $resp_bg_option ]['tablet']['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $resp_bg_option ]['tablet']['overlay-type'] = 'classic'; $theme_options[ $resp_bg_option ]['tablet']['overlay-color'] = $bg_color; $theme_options[ $resp_bg_option ]['tablet']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['tablet']['overlay-gradient'] = ''; } } } // Mobile version. /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( isset( $theme_options[ $resp_bg_option ]['mobile'] ) && is_array( $theme_options[ $resp_bg_option ]['mobile'] ) && ! isset( $theme_options[ $resp_bg_option ]['mobile']['overlay-type'] ) ) { // @codingStandardsIgnoreStart $mobile_bg_type = isset( $theme_options[ $resp_bg_option ]['mobile']['background-type'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-type'] : ''; // @codingStandardsIgnoreEnd $theme_options[ $resp_bg_option ]['mobile']['overlay-type'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-color'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-gradient'] = ''; if ( 'image' === $mobile_bg_type ) { $bg_img = isset( $theme_options[ $resp_bg_option ]['mobile']['background-image'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-image'] : ''; $bg_color = isset( $theme_options[ $resp_bg_option ]['mobile']['background-color'] ) ? $theme_options[ $resp_bg_option ]['mobile']['background-color'] : ''; if ( '' !== $bg_img && '' !== $bg_color && ( ! is_numeric( strpos( $bg_color, 'linear-gradient' ) ) && ! is_numeric( strpos( $bg_color, 'radial-gradient' ) ) ) ) { $theme_options[ $resp_bg_option ]['mobile']['overlay-type'] = 'classic'; $theme_options[ $resp_bg_option ]['mobile']['overlay-color'] = $bg_color; $theme_options[ $resp_bg_option ]['mobile']['overlay-opacity'] = ''; $theme_options[ $resp_bg_option ]['mobile']['overlay-gradient'] = ''; } } } } $theme_options['v4-1-4-update-migration'] = true; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.1.6 * * @since 4.1.6 * @return void */ function astra_theme_background_updater_4_1_6() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['list-block-vertical-spacing'] ) ) { $theme_options['list-block-vertical-spacing'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Set flag to avoid direct reflections on live site & to maintain backward compatibility for existing users. * * @since 4.1.7 * @return void */ function astra_theme_background_updater_4_1_7() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['add-hr-styling-css'] ) ) { $theme_options['add-hr-styling-css'] = false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['astra-site-svg-logo-equal-height'] ) ) { $theme_options['astra-site-svg-logo-equal-height'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Migrating users to new container layout options * * @since 4.2.0 * @return void */ function astra_theme_background_updater_4_2_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-2-0-update-migration'] ) ) { $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); $theme_options = get_option( 'astra-settings' ); $blog_types = array( 'single', 'archive' ); $third_party_layouts = array( 'woocommerce', 'edd', 'lifterlms', 'lifterlms-course-lesson', 'learndash' ); // Global. if ( isset( $theme_options['site-content-layout'] ) ) { $theme_options = astra_apply_layout_migration( 'site-content-layout', 'ast-site-content-layout', 'site-content-style', 'site-sidebar-style', $theme_options ); } // Single, archive. foreach ( $blog_types as $index => $blog_type ) { foreach ( $post_types as $index => $post_type ) { $old_layout = $blog_type . '-' . esc_attr( $post_type ) . '-content-layout'; $new_layout = $blog_type . '-' . esc_attr( $post_type ) . '-ast-content-layout'; $content_style = $blog_type . '-' . esc_attr( $post_type ) . '-content-style'; $sidebar_style = $blog_type . '-' . esc_attr( $post_type ) . '-sidebar-style'; if ( isset( $theme_options[ $old_layout ] ) ) { $theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options ); } } } // Third party existing layout migrations to new layout options. foreach ( $third_party_layouts as $index => $layout ) { $old_layout = $layout . '-content-layout'; $new_layout = $layout . '-ast-content-layout'; $content_style = $layout . '-content-style'; $sidebar_style = $layout . '-sidebar-style'; if ( isset( $theme_options[ $old_layout ] ) ) { if ( 'lifterlms' === $layout ) { // Lifterlms course/lesson sidebar style migration case. $theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, 'lifterlms-course-lesson-sidebar-style', $theme_options ); } $theme_options = astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options ); } } if ( ! isset( $theme_options['fullwidth_sidebar_support'] ) ) { $theme_options['fullwidth_sidebar_support'] = false; } $theme_options['v4-2-0-update-migration'] = true; update_option( 'astra-settings', $theme_options ); } } /** * Handle migration from old to new layouts. * * Migration cases for old users, old layouts -> new layouts. * * @since 4.2.0 * @param mixed $old_layout old_layout. * @param mixed $new_layout new_layout. * @param mixed $content_style content_style. * @param mixed $sidebar_style sidebar_style. * @param array $theme_options theme_options. * @return array $theme_options The updated theme options. */ function astra_apply_layout_migration( $old_layout, $new_layout, $content_style, $sidebar_style, $theme_options ) { switch ( astra_get_option( $old_layout ) ) { case 'boxed-container': $theme_options[ $new_layout ] = 'normal-width-container'; $theme_options[ $content_style ] = 'boxed'; $theme_options[ $sidebar_style ] = 'boxed'; break; case 'content-boxed-container': $theme_options[ $new_layout ] = 'normal-width-container'; $theme_options[ $content_style ] = 'boxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; case 'plain-container': $theme_options[ $new_layout ] = 'normal-width-container'; $theme_options[ $content_style ] = 'unboxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; case 'page-builder': $theme_options[ $new_layout ] = 'full-width-container'; $theme_options[ $content_style ] = 'unboxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; case 'narrow-container': $theme_options[ $new_layout ] = 'narrow-width-container'; $theme_options[ $content_style ] = 'unboxed'; $theme_options[ $sidebar_style ] = 'unboxed'; break; default: $theme_options[ $new_layout ] = 'default'; $theme_options[ $content_style ] = 'default'; $theme_options[ $sidebar_style ] = 'default'; break; } return $theme_options; } /** * Handle backward compatibility on version 4.2.2 * * @since 4.2.2 * @return void */ function astra_theme_background_updater_4_2_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-2-2-core-form-btns-styling'] ) ) { $theme_options['v4-2-2-core-form-btns-styling'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.6.0 * * @since 4.4.0 * @return void */ function astra_theme_background_updater_4_4_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-4-0-backward-option'] ) ) { $theme_options['v4-4-0-backward-option'] = false; // Migrate primary button outline styles to secondary buttons. if ( isset( $theme_options['font-family-button'] ) ) { $theme_options['secondary-font-family-button'] = $theme_options['font-family-button']; } if ( isset( $theme_options['font-size-button'] ) ) { $theme_options['secondary-font-size-button'] = $theme_options['font-size-button']; } if ( isset( $theme_options['font-weight-button'] ) ) { $theme_options['secondary-font-weight-button'] = $theme_options['font-weight-button']; } if ( isset( $theme_options['font-extras-button'] ) ) { $theme_options['secondary-font-extras-button'] = $theme_options['font-extras-button']; } if ( isset( $theme_options['button-bg-color'] ) ) { $theme_options['secondary-button-bg-color'] = $theme_options['button-bg-color']; } if ( isset( $theme_options['button-bg-h-color'] ) ) { $theme_options['secondary-button-bg-h-color'] = $theme_options['button-bg-h-color']; } if ( isset( $theme_options['theme-button-border-group-border-color'] ) ) { $theme_options['secondary-theme-button-border-group-border-color'] = $theme_options['theme-button-border-group-border-color']; } if ( isset( $theme_options['theme-button-border-group-border-h-color'] ) ) { $theme_options['secondary-theme-button-border-group-border-h-color'] = $theme_options['theme-button-border-group-border-h-color']; } if ( isset( $theme_options['button-radius-fields'] ) ) { $theme_options['secondary-button-radius-fields'] = $theme_options['button-radius-fields']; } // Single - Article Featured Image visibility migration. $post_types = Astra_Posts_Structure_Loader::get_supported_post_types(); foreach ( $post_types as $index => $post_type ) { $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-position-layout-1' ] = 'none'; $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-position-layout-2' ] = 'none'; $theme_options[ 'ast-dynamic-single-' . esc_attr( $post_type ) . '-article-featured-image-ratio-type' ] = 'default'; } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.5.0. * * @since 4.5.0 * @return void */ function astra_theme_background_updater_4_5_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-5-0-backward-option'] ) ) { $theme_options['v4-5-0-backward-option'] = false; $palette_options = get_option( 'astra-color-palettes', Astra_Global_Palette::get_default_color_palette() ); if ( ! isset( $palette_options['presets'] ) ) { $palette_options['presets'] = astra_get_palette_presets(); update_option( 'astra-color-palettes', $palette_options ); } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.5.2. * * @since 4.5.2 * @return void */ function astra_theme_background_updater_4_5_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['scndry-btn-default-padding'] ) ) { $theme_options['scndry-btn-default-padding'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.6.0 * * @since 4.6.0 * @return void */ function astra_theme_background_updater_4_6_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-6-0-backward-option'] ) ) { $theme_options['v4-6-0-backward-option'] = false; /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $blog_post_structure = isset( $theme_options['blog-post-structure'] ) ? $theme_options['blog-post-structure'] : array( 'image', 'title-meta' ); /** @psalm-suppress PossiblyUndefinedStringArrayOffset */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort $migrated_post_structure = array(); if ( ! empty( $blog_post_structure ) ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort foreach ( $blog_post_structure as $key ) { /** @psalm-suppress PossiblyInvalidIterator */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort if ( 'title-meta' === $key ) { $migrated_post_structure[] = 'title'; $migrated_post_structure[] = 'title-meta'; } if ( 'image' === $key ) { $migrated_post_structure[] = 'image'; } } $migrated_post_structure[] = 'excerpt'; $migrated_post_structure[] = 'read-more'; $theme_options['blog-post-structure'] = $migrated_post_structure; } if ( defined( 'ASTRA_EXT_VER' ) ) { $theme_options['ast-sub-section-author-box-border-width'] = isset( $theme_options['author-box-border-width'] ) ? $theme_options['author-box-border-width'] : array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ); $theme_options['ast-sub-section-author-box-border-radius'] = isset( $theme_options['author-box-border-radius'] ) ? $theme_options['author-box-border-radius'] : array( 'top' => '', 'right' => '', 'bottom' => '', 'left' => '', ); $theme_options['ast-sub-section-author-box-border-color'] = isset( $theme_options['author-box-border-color'] ) ? $theme_options['author-box-border-color'] : ''; if ( isset( $theme_options['single-post-inside-spacing'] ) ) { $theme_options['ast-sub-section-author-box-padding'] = $theme_options['single-post-inside-spacing']; } if ( isset( $theme_options['font-family-post-meta'] ) ) { $theme_options['font-family-post-read-more'] = $theme_options['font-family-post-meta']; } if ( isset( $theme_options['font-extras-post-meta'] ) ) { $theme_options['font-extras-post-read-more'] = $theme_options['font-extras-post-meta']; } } if ( isset( $theme_options['single-post-inside-spacing'] ) ) { $theme_options['ast-sub-section-related-posts-padding'] = $theme_options['single-post-inside-spacing']; } $theme_options['single-content-images-shadow'] = false; $theme_options['ast-font-style-update'] = false; update_option( 'astra-settings', $theme_options ); } $docs_legacy_data = get_option( 'astra_docs_data', array() ); if ( ! empty( $docs_legacy_data ) ) { delete_option( 'astra_docs_data' ); } } /** * Handle backward compatibility on version 4.6.2. * * @since 4.6.2 * @return void */ function astra_theme_background_updater_4_6_2() { $theme_options = get_option( 'astra-settings', array() ); // Unset "featured image" for pages structure. if ( ! isset( $theme_options['v4-6-2-backward-option'] ) ) { $theme_options['v4-6-2-backward-option'] = false; $page_banner_layout = isset( $theme_options['ast-dynamic-single-page-layout'] ) ? $theme_options['ast-dynamic-single-page-layout'] : 'layout-1'; $page_structure = isset( $theme_options['ast-dynamic-single-page-structure'] ) ? $theme_options['ast-dynamic-single-page-structure'] : array( 'ast-dynamic-single-page-image', 'ast-dynamic-single-page-title' ); $layout_1_image_position = isset( $theme_options['ast-dynamic-single-page-article-featured-image-position-layout-1'] ) ? $theme_options['ast-dynamic-single-page-article-featured-image-position-layout-1'] : 'behind'; $migrated_page_structure = array(); if ( 'layout-1' === $page_banner_layout && 'none' === $layout_1_image_position && ! empty( $page_structure ) ) { foreach ( $page_structure as $key ) { if ( 'ast-dynamic-single-page-image' !== $key ) { $migrated_page_structure[] = $key; } } $theme_options['ast-dynamic-single-page-structure'] = $migrated_page_structure; } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility on version 4.6.4. * * @since 4.6.4 * @return void */ function astra_theme_background_updater_4_6_4() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['btn-stylings-upgrade'] ) ) { $theme_options['btn-stylings-upgrade'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for Elementor Pro heading's margin. * * @since 4.6.5 * @return void */ function astra_theme_background_updater_4_6_5() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['elementor-headings-style'] ) ) { $theme_options['elementor-headings-style'] = defined( 'ELEMENTOR_PRO_VERSION' ) ? true : false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for Elementor Loop block post div container padding. * * @since 4.6.6 * @return void */ function astra_theme_background_updater_4_6_6() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['elementor-container-padding-style'] ) ) { $theme_options['elementor-container-padding-style'] = defined( 'ELEMENTOR_PRO_VERSION' ) ? true : false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for Starter template library preview line height cases. * * @since 4.6.11 * @return void */ function astra_theme_background_updater_4_6_11() { $theme_options = get_option( 'astra-settings', array() ); if ( isset( $theme_options['global-headings-line-height-update'] ) ) { return; } $headers_fonts = array( 'h1' => '1.4', 'h2' => '1.3', 'h3' => '1.3', 'h4' => '1.2', 'h5' => '1.2', 'h6' => '1.25', ); foreach ( $headers_fonts as $header_tag => $header_font_value ) { if ( empty( $theme_options[ 'font-extras-' . $header_tag ]['line-height'] ) ) { $theme_options[ 'font-extras-' . $header_tag ]['line-height'] = $header_font_value; if ( empty( $theme_options[ 'font-extras-' . $header_tag ]['line-height-unit'] ) ) { $theme_options[ 'font-extras-' . $header_tag ]['line-height-unit'] = 'em'; } } } $theme_options['global-headings-line-height-update'] = true; update_option( 'astra-settings', $theme_options ); } /** * Handle backward compatibility for heading `clear:both` css in single posts and pages. * * @since 4.6.12 * @return void */ function astra_theme_background_updater_4_6_12() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['single_posts_pages_heading_clear_none'] ) ) { $theme_options['single_posts_pages_heading_clear_none'] = false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['elementor-btn-styling'] ) ) { $theme_options['elementor-btn-styling'] = defined( 'ELEMENTOR_VERSION' ) ? true : false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['remove_single_posts_navigation_mobile_device_padding'] ) ) { $theme_options['remove_single_posts_navigation_mobile_device_padding'] = true; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for following pointers. * * 1. unit less line-height support. * 2. H5 font size case. * * @since 4.6.14 * @return void */ function astra_theme_background_updater_4_6_14() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['enable-4-6-14-compatibility'] ) ) { $theme_options['enable-4-6-14-compatibility'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for following cases. * * 1. Making edd default option enable by default. * 2. Handle backward compatibility for Heading font size fix. * * @since 4.7.0 * @return void */ function astra_theme_background_updater_4_7_0() { $theme_options = get_option( 'astra-settings', array() ); if ( class_exists( 'Easy_Digital_Downloads' ) && ! isset( $theme_options['can-update-edd-featured-image-default'] ) ) { $theme_options['can-update-edd-featured-image-default'] = false; update_option( 'astra-settings', $theme_options ); } if ( ! isset( $theme_options['heading-widget-font-size'] ) ) { $theme_options['heading-widget-font-size'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility for version 4.7.1 * * @since 4.7.1 * @return void */ function astra_theme_background_updater_4_7_1() { $theme_options = get_option( 'astra-settings', array() ); // Setting same background color for above and below transparent headers as on transparent primary header. if ( isset( $theme_options['transparent-header-bg-color-responsive'] ) ) { if ( ! isset( $theme_options['hba-transparent-header-bg-color-responsive'] ) ) { $theme_options['hba-transparent-header-bg-color-responsive'] = $theme_options['transparent-header-bg-color-responsive']; } if ( ! isset( $theme_options['hbb-transparent-header-bg-color-responsive'] ) ) { $theme_options['hbb-transparent-header-bg-color-responsive'] = $theme_options['transparent-header-bg-color-responsive']; } update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility Spectra Heading max-width with Astra when fullwidth layout is selected. * * @since 4.8.0 * @return void */ function astra_theme_background_updater_4_8_0() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['enable-4-8-0-compatibility'] ) ) { $theme_options['enable-4-8-0-compatibility'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Handle backward compatibility Single post outside spacing issue. * * @since 4.8.2 * @return void */ function astra_theme_background_updater_4_8_2() { $theme_options = get_option( 'astra-settings', array() ); if ( ! isset( $theme_options['v4-8-2-backward-option'] ) ) { $theme_options['v4-8-2-backward-option'] = false; update_option( 'astra-settings', $theme_options ); } } /** * Astra Attributes Class. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.6.2 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } if ( ! class_exists( 'Astra_Attr' ) ) : /** * Class Astra_Attr */ class Astra_Attr { /** * Store Instance on Current Class. * * @var object instance */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Initialuze the Class. * * @since 1.6.2 */ private function __construct() {} /** * Build list of attributes into a string and apply contextual filter on string. * * The contextual filter is of the form `astra_attr_{context}_output`. * * @since 1.6.2 * * @param string $context The context, to build filter name. * @param array $attributes Optional. Extra attributes to merge with defaults. * @param array $args Optional. Custom data to pass to filter. * @return string String of HTML attributes and values. */ public function astra_attr( $context, $attributes = array(), $args = array() ) { $attributes = $this->astra_parse_attr( $context, $attributes, $args ); $output = ''; // Cycle through attributes, build tag attribute string. foreach ( $attributes as $key => $value ) { if ( ! $value ) { continue; } if ( true === $value ) { $output .= esc_html( $key ) . ' '; } else { $output .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) ); } } $output = apply_filters( "astra_attr_{$context}_output", $output, $attributes, $context, $args ); return trim( $output ); } /** * Merge array of attributes with defaults, and apply contextual filter on array. * * The contextual filter is of the form `astra_attr_{context}`. * * @since 1.6.2 * * @param string $context The context, to build filter name. * @param array $attributes Optional. Extra attributes to merge with defaults. * @param array $args Optional. Custom data to pass to filter. * @return array Merged and filtered attributes. */ public function astra_parse_attr( $context, $attributes = array(), $args = array() ) { $defaults = array( 'class' => sanitize_html_class( $context ), ); $attributes = wp_parse_args( $attributes, $defaults ); // Contextual filter. return apply_filters( "astra_attr_{$context}", $attributes, $context, $args ); } } endif; /** * Kicking this off by calling 'get_instance()' method */ Astra_Attr::get_instance(); /** * Astra functions and definitions. * Text Domain: astra * When using a child theme (see https://codex.wordpress.org/Theme_Development * and https://codex.wordpress.org/Child_Themes), you can override certain * functions (those wrapped in a function_exists() call) by defining them first * in your child theme's functions.php file. The child theme's functions.php * file is included before the parent theme's file, so the child theme * functions would be used. * * For more information on hooks, actions, and filters, * see https://codex.wordpress.org/Plugin_API * * Astra is a very powerful theme and virtually anything can be customized * via a child theme. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Astra_After_Setup_Theme initial setup * * @since 1.0.0 */ if ( ! class_exists( 'Astra_After_Setup_Theme' ) ) { /** * Astra_After_Setup_Theme initial setup */ class Astra_After_Setup_Theme { /** * Instance * * @var $instance */ private static $instance; /** * Initiator * * @since 1.0.0 * @return object */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_action( 'after_setup_theme', array( $this, 'setup_theme' ), 2 ); add_action( 'wp', array( $this, 'setup_content_width' ) ); } /** * Setup theme * * @since 1.0.0 */ public function setup_theme() { do_action( 'astra_class_loaded' ); /** * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Next, use a find and replace * to change 'astra' to the name of your theme in all the template files. */ load_theme_textdomain( 'astra', ASTRA_THEME_DIR . '/languages' ); /** * Theme Support */ // Gutenberg wide images. add_theme_support( 'align-wide' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); // Let WordPress manage the document title. add_theme_support( 'title-tag' ); // Enable support for Post Thumbnails on posts and pages. add_theme_support( 'post-thumbnails' ); // Add support for starter content ( wp preview ). if ( class_exists( 'Astra_Starter_Content', false ) ) { $astra_starter_content = new Astra_Starter_Content(); add_theme_support( 'starter-content', $astra_starter_content->get() ); } // Switch default core markup for search form, comment form, and comments. // to output valid HTML5. // Added a new value in HTML5 array 'navigation-widgets' as this was introduced in WP5.5 for better accessibility. add_theme_support( 'html5', array( 'navigation-widgets', 'search-form', 'gallery', 'caption', 'style', 'script', ) ); // Post formats. add_theme_support( 'post-formats', array( 'gallery', 'image', 'link', 'quote', 'video', 'audio', 'status', 'aside', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 180, 'height' => 60, 'flex-width' => true, 'flex-height' => true, ) ); // Customize Selective Refresh Widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ /* Directory and Extension */ $dir_name = 'minified'; $file_prefix = '.min'; if ( apply_filters( 'astra_theme_editor_style', true ) ) { add_editor_style( 'assets/css/' . $dir_name . '/editor-style' . $file_prefix . '.css' ); } if ( apply_filters( 'astra_fullwidth_oembed', true ) ) { // Filters the oEmbed process to run the responsive_oembed_wrapper() function. add_filter( 'embed_oembed_html', array( $this, 'responsive_oembed_wrapper' ), 10, 3 ); } // WooCommerce. add_theme_support( 'woocommerce' ); // Rank Math Breadcrumb. if ( true === apply_filters( 'astra_rank_math_theme_support', true ) ) { add_theme_support( 'rank-math-breadcrumbs' ); } // Native AMP Support. if ( true === apply_filters( 'astra_amp_support', true ) ) { add_theme_support( 'amp', apply_filters( 'astra_amp_theme_features', array( 'paired' => true, ) ) ); } // Remove Template Editor support until WP 5.9 since more Theme Blocks are going to be introduced. remove_theme_support( 'block-templates' ); // Let WooCommerce know, Astra is not compatible with New Product Editor. add_filter( 'option_woocommerce_feature_product_block_editor_enabled', '__return_false' ); add_filter( 'woocommerce_create_pages', array( $this, 'astra_enforce_woo_shortcode_pages' ), 99 ); } /** * Set the $content_width global variable used by WordPress to set image dimennsions. * * @since 1.5.5 * @return void */ public function setup_content_width() { global $content_width; /** * Content Width */ if ( ! isset( $content_width ) ) { if ( is_home() || is_post_type_archive( 'post' ) ) { $blog_width = astra_get_option( 'blog-width' ); if ( 'custom' === $blog_width ) { $content_width = apply_filters( 'astra_content_width', astra_get_option( 'blog-max-width', 1200 ) ); } else { $content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) ); } } elseif ( is_single() ) { if ( 'post' === get_post_type() ) { $single_post_max = astra_get_option( 'blog-single-width' ); if ( 'custom' === $single_post_max ) { $content_width = apply_filters( 'astra_content_width', astra_get_option( 'blog-single-max-width', 1200 ) ); } else { $content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) ); } } // For custom post types set the global content width. $content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) ); } else { $content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) ); } } } /** * Adds a responsive embed wrapper around oEmbed content * * @param string $html The oEmbed markup. * @param string $url The URL being embedded. * @param array $attr An array of attributes. * @param bool $core_yt_block Whether the oEmbed is being rendered by the core YouTube block. * * @return string Updated embed markup. */ public function responsive_oembed_wrapper( $html, $url, $attr, $core_yt_block = false ) { $add_astra_oembed_wrapper = apply_filters( 'astra_responsive_oembed_wrapper_enable', true ); $ast_embed_wrapper_class = apply_filters( 'astra_embed_wrapper_class', '' ); $allowed_providers = apply_filters( 'astra_allowed_fullwidth_oembed_providers', array( 'vimeo.com', 'youtube.com', 'youtu.be', 'wistia.com', 'wistia.net', 'spotify.com', 'soundcloud.com', 'animoto.com', 'cloudup.com', 'poll.fm', 'dai.ly', 'mixcloud.com', 'pca.st', 'reddit.com', 'scribd.com', 'slideshare.net', 'speakerdeck.com', 'tumblr.com', 'videopress.com', 'wordpress.org', 'wordpress.tv', 'imgur.com', 'ted.com', ) ); if ( astra_strposa( $url, $allowed_providers ) && $add_astra_oembed_wrapper ) { if ( $core_yt_block ) { $embed_html = wp_oembed_get( $url ); $html = false !== $embed_html ? '
' . $embed_html . '
' : ''; } else { $html = ( '' !== $html ) ? '
' . $html . '
' : ''; } } elseif ( '' === $html || $url === trim( $html ) ) { $embed_html = wp_oembed_get( $url, array( 'width' => 600 ) ); $html = $embed_html ? $embed_html : $url; wp_maybe_enqueue_oembed_host_js( $html ); } return $html; } /** * Enforce WooCommerce shortcode pages due to following reasons. * * 1. In WooCommerce 8.3 version cart & checkout pages are directly added with blocks and not with shortcodes. * 2. Due to which most of Astra extended features are not working on cart & checkout pages. * * This is temporary workaround, once Astra ready with WooCommerce 8.3 version, this will be removed. * * @since 4.5.1 * @param array $pages_data Array of WooCommerce pages. * * @return array */ public function astra_enforce_woo_shortcode_pages( $pages_data ) { $pages_data['cart']['content'] = '[woocommerce_cart]'; $pages_data['checkout']['content'] = '[woocommerce_checkout]'; return $pages_data; } } } /** * Kicking this off by calling 'get_instance()' method */ Astra_After_Setup_Theme::get_instance(); /** * 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(); /** * AMP Compatibility. * * @package Astra * @author Astra * @copyright Copyright (c) 2018, Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Astra BB Ultimate Addon Compatibility */ if ( ! class_exists( 'Astra_AMP' ) ) : /** * Class Astra_AMP */ class Astra_AMP { /** * Member Variable * * @var object instance */ private static $instance; /** * Initiator */ public static function get_instance() { if ( ! isset( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor */ public function __construct() { add_action( 'wp', array( $this, 'astra_amp_init' ) ); } /** * Init Astra Amp Compatibility. * This adds required actions and filters only if AMP endpoinnt is detected. * * @since 1.7.0 * @return void */ public function astra_amp_init() { // bail if AMP endpoint is not detected. if ( ! astra_is_amp_endpoint() ) { return; } add_filter( 'astra_nav_toggle_data_attrs', array( $this, 'add_nav_toggle_attrs' ) ); add_filter( 'astra_search_slide_toggle_data_attrs', array( $this, 'add_search_slide_toggle_attrs' ) ); add_filter( 'astra_search_field_toggle_data_attrs', array( $this, 'add_search_field_toggle_attrs' ) ); add_action( 'wp_footer', array( $this, 'render_amp_states' ) ); add_filter( 'astra_attr_ast-main-header-bar-alignment', array( $this, 'nav_menu_wrapper' ) ); add_filter( 'astra_attr_ast-menu-toggle', array( $this, 'menu_toggle_button' ), 20, 3 ); add_filter( 'astra_theme_dynamic_css', array( $this, 'dynamic_css' ) ); add_filter( 'astra_toggle_button_markup', array( $this, 'toggle_button_markup' ), 20, 2 ); add_filter( 'astra_schema_body', array( $this, 'body_id' ) ); /** * Scroll to top Addon. * * @since 4.0.0 */ if ( true === astra_get_option( 'scroll-to-top-enable' ) ) { remove_action( 'wp_footer', array( Astra_Scroll_To_Top_Loader::get_instance(), 'html_markup_loader' ) ); remove_filter( 'astra_dynamic_theme_css', 'astra_scroll_to_top_dynamic_css' ); } } /** * Add ID to body to toggleClasses on AMP actions. * * @since 1.7.0 * @param String $schema markup returned from theme. * @return String */ public function body_id( $schema ) { return $schema . 'id="astra-body"'; } /** * Dynamic CSS used for AMP pages. * This should be changed to main CSS in next versions, replacing JavaScript based interactions with pure CSS alternatives. * * @since 1.7.0 * @param String $compiled_css Dynamic CSS received to be enqueued on page. * * @return String Updated dynamic CSS with AMP specific changes. */ public function dynamic_css( $compiled_css ) { if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { $css = array( '#ast-desktop-header' => array( 'display' => 'none', ), '#ast-mobile-header' => array( 'display' => 'block', ), '.ast-amp.ast-main-header-nav-open .ast-mobile-header-content' => array( 'display' => 'block', ), '.ast-mobile-header-content .ast-main-header-bar-alignment.toggle-on .main-header-bar-navigation' => array( 'display' => 'block', ), '.ast-amp .ast-mobile-header-content .main-navigation ul .menu-item .menu-link' => array( 'padding' => '0 20px', 'display' => 'inline-block', 'width' => '100%', 'border' => '0', 'border-bottom-width' => '1px', 'border-style' => 'solid', 'border-color' => '#eaeaea', ), '.ast-amp .ast-mobile-header-content .toggled-on .main-header-bar-navigation' => array( 'line-height' => '3', 'display' => 'none', ), '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .sub-menu' => array( 'line-height' => '3', ), '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .menu-item-has-children .sub-menu' => array( 'display' => 'none', ), '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .menu-item-has-children .dropdown-open+ul.sub-menu' => array( 'display' => 'block', ), '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle' => array( 'display' => 'inline-block', 'position' => 'absolute', 'font-size' => 'inherit', 'top' => '-1px', 'right' => '20px', 'cursor' => 'pointer', 'webkit-font-smoothing' => 'antialiased', 'moz-osx-font-smoothing' => 'grayscale', 'padding' => '0 0.907em', 'font-weight' => 'normal', 'line-height' => 'inherit', 'transition' => 'all 0.2s', ), '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .ast-submenu-expanded > .ast-menu-toggle::before' => array( '-webkit-transform' => 'rotateX(180deg)', 'transform' => 'rotateX(180deg)', ), '.ast-amp .ast-mobile-header-content .main-header-bar-navigation .main-header-menu' => array( 'border-top-width' => '1px', 'border-style' => 'solid', 'border-color' => '#eaeaea', ), '.ast-amp .ast-below-header-bar, .ast-amp .main-header-bar, .ast-amp .ast-above-header-bar' => array( 'display' => 'grid', ), ); if ( false === Astra_Icons::is_svg_icons() ) { $css['.ast-amp .ast-mobile-header-content .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle::before'] = array( 'font-weight' => 'bold', 'content' => '"\e900"', 'font-family' => '"Astra"', 'text-decoration' => 'inherit', 'display' => 'inline-block', ); } } else { $css = array( '.ast-mobile-menu-buttons' => array( 'text-align' => 'right', '-js-display' => 'flex', 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-pack' => 'end', '-webkit-justify-content' => 'flex-end', '-moz-box-pack' => 'end', '-ms-flex-pack' => 'end', 'justify-content' => 'flex-end', '-webkit-align-self' => 'center', '-ms-flex-item-align' => 'center', 'align-self' => 'center', ), '.header-main-layout-1 .main-navigation' => array( 'padding' => '0', ), ); } $parse_css = $compiled_css . astra_parse_css( $css, '', astra_header_break_point() ); $css = array( '.site-header .main-header-bar-wrap .site-branding' => array( 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-flex' => '1', '-webkit-flex' => '1', '-moz-box-flex' => '1', '-ms-flex' => '1', 'flex' => '1', '-webkit-align-self' => 'center', '-ms-flex-item-align' => 'center', 'align-self' => 'center', ), '.ast-main-header-bar-alignment.toggle-on .main-header-bar-navigation' => array( 'display' => 'block', ), '.main-navigation' => array( 'display' => 'block', 'width' => '100%', ), '.main-header-menu > .menu-item > .menu-link' => array( 'padding' => '0 20px', 'display' => 'inline-block', 'width' => '100%', 'border-bottom-width' => '1px', 'border-style' => 'solid', 'border-color' => '#eaeaea', ), '.ast-main-header-bar-alignment.toggle-on' => array( 'display' => 'block', 'width' => '100%', '-webkit-box-flex' => '1', '-webkit-flex' => 'auto', '-moz-box-flex' => '1', '-ms-flex' => 'auto', 'flex' => 'auto', '-webkit-box-ordinal-group' => '5', '-webkit-order' => '4', '-moz-box-ordinal-group' => '5', '-ms-flex-order' => '4', 'order' => '4', ), '.main-header-menu .menu-item' => array( 'width' => '100%', 'text-align' => 'left', 'border-top' => '0', ), '.main-header-bar-navigation' => array( 'width' => '-webkit-calc( 100% + 40px)', 'width' => 'calc( 100% + 40px)', 'margin' => '0 -20px', ), '.main-header-bar .main-header-bar-navigation .main-header-menu' => array( 'border-top-width' => '1px', 'border-style' => 'solid', 'border-color' => '#eaeaea', ), '.main-header-bar .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle' => array( 'display' => 'inline-block', 'position' => 'absolute', 'font-size' => 'inherit', 'top' => '-1px', 'right' => '20px', 'cursor' => 'pointer', '-webkit-font-smoothing' => 'antialiased', '-moz-osx-font-smoothing' => 'grayscale', 'padding' => '0 0.907em', 'font-weight' => 'normal', 'line-height' => 'inherit', '-webkit-transition' => 'all .2s', 'transition' => 'all .2s', ), ); if ( false === Astra_Icons::is_svg_icons() ) { $css['.main-header-bar-navigation .menu-item-has-children > .menu-link:after'] = array( 'content' => 'none', ); $css['.ast-button-wrap .menu-toggle.toggled .menu-toggle-icon:before'] = array( 'content' => "\e5cd", ); $css['.main-header-bar .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle::before'] = array( 'font-weight' => 'bold', 'content' => '"\e900"', 'font-family' => 'Astra', 'text-decoration' => 'inherit', 'display' => 'inline-block', ); } $parse_css .= astra_parse_css( $css, '', astra_header_break_point() ); if ( true === Astra_Builder_Helper::$is_header_footer_builder_active ) { $astra_break_point_navigation = array( '.ast-amp .main-header-bar-navigation' => array( 'margin' => '0', ), ); } else { $astra_break_point_navigation = array( '.ast-amp .main-header-bar-navigation' => array( 'margin' => '0 -20px', ), '.ast-amp .ast-mobile-menu-buttons' => array( 'text-align' => 'right', '-js-display' => 'flex', 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-pack' => 'end', '-webkit-justify-content' => 'flex-end', '-moz-box-pack' => 'end', '-ms-flex-pack' => 'end', 'justify-content' => 'flex-end', '-webkit-align-self' => 'center', '-ms-flex-item-align' => 'center', 'align-self' => 'center', ), '.ast-theme.ast-header-custom-item-outside .main-header-bar .ast-search-icon' => array( 'margin-right' => '1em', ), '.ast-theme.ast-header-custom-item-inside .main-header-bar .main-header-bar-navigation .ast-search-icon' => array( 'display' => 'none', ), '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-field, .ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon.ast-inline-search .search-field' => array( 'width' => '100%', 'padding-right' => '5.5em', ), '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-submit' => array( 'display' => 'block', 'position' => 'absolute', 'height' => '100%', 'top' => '0', 'right' => '0', 'padding' => '0 1em', 'border-radius' => '0', ), '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-form' => array( 'padding' => '0', 'display' => 'block', 'overflow' => 'hidden', ), '.ast-amp .ast-header-custom-item' => array( 'background-color' => '#f9f9f9', ), '.ast-amp .ast-mobile-header-stack .site-description' => array( 'text-align' => 'center', ), '.ast-amp .ast-mobile-header-stack.ast-logo-title-inline .site-description' => array( 'text-align' => 'left', ), '.ast-theme.ast-header-custom-item-outside .ast-primary-menu-disabled .ast-mobile-menu-buttons' => array( 'display' => 'none', ), '.ast-amp .ast-hide-custom-menu-mobile .ast-masthead-custom-menu-items' => array( 'display' => 'none', ), '.ast-amp .ast-mobile-header-inline .site-branding' => array( 'text-align' => 'left', 'padding-bottom' => '0', ), '.ast-amp .ast-mobile-header-inline.header-main-layout-3 .site-branding' => array( 'text-align' => 'right', ), '.ast-amp ul li.ast-masthead-custom-menu-items a' => array( 'padding' => '0', 'width' => 'auto', 'display' => 'initial', ), '.ast-amp li.ast-masthead-custom-menu-items' => array( 'padding-left' => '20px', 'padding-right' => '20px', 'margin-bottom' => '1em', 'margin-top' => '1em', ), '.ast-theme.ast-header-custom-item-inside .ast-search-menu-icon' => array( 'position' => 'relative', 'display' => 'block', 'right' => 'auto', 'visibility' => 'visible', 'opacity' => '1', '-webkit-transform' => 'none', '-ms-transform' => 'none', 'transform' => 'none', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-menu-buttons' => array( '-webkit-box-ordinal-group' => '3', '-webkit-order' => '2', '-moz-box-ordinal-group' => '3', '-ms-flex-order' => '2', 'order' => '2', ), '.ast-theme.ast-header-custom-item-outside .main-header-bar-navigation' => array( '-webkit-box-ordinal-group' => '4', '-webkit-order' => '3', '-moz-box-ordinal-group' => '4', '-ms-flex-order' => '3', 'order' => '3', ), '.ast-theme.ast-header-custom-item-outside .ast-masthead-custom-menu-items' => array( '-webkit-box-ordinal-group' => '2', '-webkit-order' => '1', '-moz-box-ordinal-group' => '2', '-ms-flex-order' => '1', 'order' => '1', ), '.ast-theme.ast-header-custom-item-outside .header-main-layout-2 .ast-masthead-custom-menu-items' => array( 'text-align' => 'center', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .site-branding, .ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .ast-mobile-menu-buttons' => array( '-js-display' => 'flex', 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', ), '.ast-theme.ast-header-custom-item-outside.ast-header-custom-item-outside .header-main-layout-2 .ast-mobile-menu-buttons' => array( 'padding-bottom' => '0', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .ast-site-identity' => array( 'width' => '100%', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline.header-main-layout-3 .ast-site-identity' => array( 'width' => 'auto', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline.header-main-layout-2 .site-branding' => array( '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 auto', '-moz-box-flex' => '1', '-ms-flex' => '1 1 auto', 'flex' => '1 1 auto', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .site-branding' => array( 'text-align' => 'left', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-inline .site-title' => array( '-webkit-box-pack' => 'left', '-webkit-justify-content' => 'left', '-moz-box-pack' => 'left', '-ms-flex-pack' => 'left', 'justify-content' => 'left', ), '.ast-theme.ast-header-custom-item-outside .header-main-layout-2 .ast-mobile-menu-buttons' => array( 'padding-bottom' => '1em', ), '.ast-amp .ast-mobile-header-stack .main-header-container, .ast-amp .ast-mobile-header-inline .main-header-container' => array( '-js-display' => 'flex', 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', ), '.ast-amp .header-main-layout-1 .site-branding' => array( 'padding-right' => '1em', ), '.ast-amp .header-main-layout-1 .main-header-bar-navigation' => array( 'text-align' => 'left', ), '.ast-amp .header-main-layout-1 .main-navigation' => array( 'padding-left' => '0', ), '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items' => array( '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 100%', '-moz-box-flex' => '1', '-ms-flex' => '1 1 100%', 'flex' => '1 1 100%', ), '.ast-amp .ast-mobile-header-stack .site-branding' => array( 'padding-left' => '0', 'padding-right' => '0', 'padding-bottom' => '1em', '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 100%', '-moz-box-flex' => '1', '-ms-flex' => '1 1 100%', 'flex' => '1 1 100%', ), '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items, .ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .site-title, .ast-amp .ast-mobile-header-stack .ast-site-identity' => array( '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', 'text-align' => 'center', ), '.ast-amp .ast-mobile-header-stack.ast-logo-title-inline .site-title' => array( 'text-align' => 'left', ), '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 100%', '-moz-box-flex' => '1', '-ms-flex' => '1 1 100%', 'flex' => '1 1 100%', 'text-align' => 'center', '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', ), '.ast-amp .ast-mobile-header-stack.header-main-layout-3 .main-header-container' => array( 'flex-direction' => 'initial', ), '.ast-amp .header-main-layout-2 .ast-mobile-menu-buttons' => array( '-js-display' => 'flex', 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', ), '.ast-amp .header-main-layout-2 .main-header-bar-navigation, .ast-amp .header-main-layout-2 .widget' => array( 'text-align' => 'left', ), '.ast-theme.ast-header-custom-item-outside .header-main-layout-3 .main-header-bar .ast-search-icon' => array( 'margin-right' => 'auto', 'margin-left' => '1em', ), '.ast-amp .header-main-layout-3 .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( 'right' => 'auto', 'left' => '0', ), '.ast-amp .header-main-layout-3.ast-mobile-header-inline .ast-mobile-menu-buttons' => array( '-webkit-box-pack' => 'start', '-webkit-justify-content' => 'flex-start', '-moz-box-pack' => 'start', '-ms-flex-pack' => 'start', 'justify-content' => 'flex-start', ), '.ast-amp .header-main-layout-3 li .ast-search-menu-icon' => array( 'left' => '0', ), '.ast-amp .header-main-layout-3 .site-branding' => array( 'padding-left' => '1em', '-webkit-box-pack' => 'end', '-webkit-justify-content' => 'flex-end', '-moz-box-pack' => 'end', '-ms-flex-pack' => 'end', 'justify-content' => 'flex-end', ), '.ast-amp .header-main-layout-3 .main-navigation' => array( 'padding-right' => '0', ), '.ast-amp .header-main-layout-1 .site-branding' => array( 'padding-right' => '1em', ), '.ast-amp .header-main-layout-1 .main-header-bar-navigation' => array( 'text-align' => 'left', ), '.ast-amp .header-main-layout-1 .main-navigation' => array( 'padding-left' => '0', ), '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items' => array( '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 100%', '-moz-box-flex' => '1', '-ms-flex' => '1 1 100%', 'flex' => '1 1 100%', ), '.ast-amp .ast-mobile-header-stack .site-branding' => array( 'padding-left' => '0', 'padding-right' => '0', 'padding-bottom' => '1em', '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 100%', '-moz-box-flex' => '1', '-ms-flex' => '1 1 100%', 'flex' => '1 1 100%', ), '.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items, .ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .site-title, .ast-amp .ast-mobile-header-stack .ast-site-identity' => array( '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', 'text-align' => 'center', ), '.ast-amp .ast-mobile-header-stack.ast-logo-title-inline .site-title' => array( 'text-align' => 'left', ), '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( 'flex' => '1 1 100%', 'text-align' => 'center', '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', ), '.ast-amp .ast-mobile-header-stack.header-main-layout-3 .main-header-container' => array( 'flex-direction' => 'initial', ), '.ast-amp .header-main-layout-2 .ast-mobile-menu-buttons' => array( 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', ), '.ast-amp .header-main-layout-2 .main-header-bar-navigation, .ast-amp .header-main-layout-2 .widget' => array( 'text-align' => 'left', ), '.ast-theme.ast-header-custom-item-outside .header-main-layout-3 .main-header-bar .ast-search-icon' => array( 'margin-right' => 'auto', 'margin-left' => '1em', ), '.ast-amp .header-main-layout-3 .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( 'right' => 'auto', 'left' => '0', ), '.ast-amp .header-main-layout-3.ast-mobile-header-inline .ast-mobile-menu-buttons' => array( '-webkit-box-pack' => 'start', '-webkit-justify-content' => 'flex-start', '-moz-box-pack' => 'start', '-ms-flex-pack' => 'start', 'justify-content' => 'flex-start', ), '.ast-amp .header-main-layout-3 li .ast-search-menu-icon' => array( 'left' => '0', ), '.ast-amp .header-main-layout-3 .site-branding' => array( 'padding-left' => '1em', '-webkit-box-pack' => 'end', '-webkit-justify-content' => 'flex-end', '-moz-box-pack' => 'end', '-ms-flex-pack' => 'end', 'justify-content' => 'flex-end', ), '.ast-amp .header-main-layout-3 .main-navigation' => array( 'padding-right' => '0', ), '.ast-amp .ast-header-custom-item' => array( 'border-top' => '1px solid #eaeaea', ), '.ast-amp .ast-header-custom-item .ast-masthead-custom-menu-items' => array( 'padding-left' => '20px', 'padding-right' => '20px', 'margin-bottom' => '1em', 'margin-top' => '1em', ), '.ast-amp .ast-header-custom-item .widget:last-child' => array( 'margin-bottom' => '1em', ), '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item .menu-link' => array( 'display' => 'block', ), '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item' => array( 'padding-left' => '0', 'padding-right' => '0', 'margin-top' => '0', 'margin-bottom' => '0', ), '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item .ast-custom-button-link' => array( 'display' => 'none', ), '.ast-header-custom-item-inside.ast-amp .button-custom-menu-item .menu-link' => array( 'display' => 'block', ), '.ast-amp .woocommerce-custom-menu-item .ast-cart-menu-wrap' => array( 'width' => '2em', 'height' => '2em', 'font-size' => '1.4em', 'line-height' => '2', 'vertical-align' => 'middle', 'text-align' => 'right', ), '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-3 .ast-site-header-cart' => array( 'padding' => '0 0 1em 1em', ), '.ast-theme.ast-woocommerce-cart-menu.ast-header-custom-item-outside .ast-site-header-cart' => array( 'padding' => '0', ), '.ast-amp .ast-masthead-custom-menu-items.woocommerce-custom-menu-item' => array( 'margin-bottom' => '0', 'margin-top' => '0', ), '.ast-amp .ast-masthead-custom-menu-items.woocommerce-custom-menu-item .ast-site-header-cart' => array( 'padding' => '0', ), '.ast-amp .ast-masthead-custom-menu-items.woocommerce-custom-menu-item .ast-site-header-cart a' => array( 'border' => 'none', 'display' => 'inline-block', ), '.ast-theme.ast-header-custom-item-inside .main-header-bar .ast-search-menu-icon .search-form' => array( 'visibility' => 'visible', 'opacity' => '1', 'position' => 'relative', 'right' => 'auto', 'top' => 'auto', 'transform' => 'none', ), '.ast-theme.ast-header-custom-item-outside .ast-mobile-header-stack .main-header-bar .ast-search-icon' => array( 'margin' => '0', ), '.ast-amp .ast-mobile-header-stack .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( 'right' => '-1em', ), '.ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', 'text-align' => 'center', 'padding-bottom' => '0', ), '.ast-safari-browser-less-than-11.ast-woocommerce-cart-menu.ast-header-break-point .header-main-layout-2 .main-header-container' => array( 'display' => 'flex', ), ); // Tablet CSS. $astra_medium_break_point_navigation = array( '.ast-amp .footer-sml-layout-2 .ast-small-footer-section-2' => array( 'margin-top' => '1em', ), ); $parse_css .= astra_parse_css( $astra_medium_break_point_navigation, astra_get_tablet_breakpoint() ); // Mobile CSS. $astra_small_break_point_navigation = array( '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart' => array( 'padding-right' => '0', 'padding-left' => '0', ), '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .main-header-bar, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .main-header-bar' => array( 'text-align' => 'center', ), '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-site-header-cart, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .ast-site-header-cart' => array( 'display' => 'inline-block', ), '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-mobile-menu-buttons, .ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .ast-mobile-menu-buttons' => array( 'display' => 'inline-block', ), '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-2.ast-mobile-header-inline .site-branding' => array( 'flex' => 'auto', ), '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .site-branding' => array( 'flex' => '0 0 100%', ), '.ast-theme.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .main-header-container' => array( 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', ), '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( 'width' => '100%', ), '.ast-amp .ast-mobile-header-stack .site-branding, .ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( '-webkit-box-pack' => 'center', '-webkit-justify-content' => 'center', '-moz-box-pack' => 'center', '-ms-flex-pack' => 'center', 'justify-content' => 'center', ), '.ast-amp .ast-mobile-header-stack.header-main-layout-1 .main-header-bar-wrap .site-branding' => array( '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 auto', '-moz-box-flex' => '1', '-ms-flex' => '1 1 auto', '-webkit-box-flex' => '1', '-webkit-flex' => '1 1 auto', '-moz-box-flex' => '1', '-ms-flex' => '1 1 auto', 'flex' => '1 1 auto', ), '.ast-amp .ast-mobile-header-stack .ast-mobile-menu-buttons' => array( 'padding-top' => '0.8em', ), '.ast-amp .ast-mobile-header-stack.header-main-layout-2 .ast-mobile-menu-buttons' => array( 'padding-top' => '0.8em', ), '.ast-amp .ast-mobile-header-stack.header-main-layout-1 .site-branding' => array( 'padding-bottom' => '0', ), '.ast-header-custom-item-outside.ast-amp .ast-mobile-header-stack .ast-masthead-custom-menu-items' => array( 'padding' => '0.8em 1em 0 1em', 'text-align' => 'center', 'width' => '100%', ), '.ast-header-custom-item-outside.ast-amp .ast-mobile-header-stack.header-main-layout-3 .ast-mobile-menu-buttons, .ast-header-custom-item-outside.ast-amp .ast-mobile-header-stack.header-main-layout-3 .ast-masthead-custom-menu-items' => array( 'padding-top' => '0.8em', ), // Tablet CSS. '.ast-amp .footer-sml-layout-2 .ast-small-footer-section-2' => array( 'margin-top' => '1em', ), ); $parse_css .= astra_parse_css( $astra_small_break_point_navigation, '', astra_get_mobile_breakpoint() ); } $parse_css .= astra_parse_css( $astra_break_point_navigation, '', astra_header_break_point() ); // Move all header-break-point css from class based css to media query based CSS. $astra_break_point_navigation = array( '.ast-amp .entry-content .alignwide' => array( 'margin-left' => 'auto', 'margin-right' => 'auto', ), '.ast-amp .main-navigation' => array( 'padding-left' => '0', ), '.ast-amp .main-navigation ul .menu-item .menu-link, .ast-amp .main-navigation ul .button-custom-menu-item a' => array( 'padding' => '0 20px', 'display' => 'inline-block', 'width' => '100%', 'border-bottom-width' => '1px', 'border-style' => 'solid', 'border-color' => '#eaeaea', ), '.ast-amp .main-navigation .sub-menu .menu-item .menu-link' => array( 'padding-left' => '30px', ), '.ast-amp .main-navigation .sub-menu .menu-item .menu-item .menu-link' => array( 'padding-left' => '40px', ), '.ast-amp .main-navigation .sub-menu .menu-item .menu-item .menu-item .menu-link' => array(), '.ast-amp .main-navigation .sub-menu .menu-item .menu-item .menu-item .menu-item .menu-link' => array( 'padding-left' => '60px', ), '.ast-amp .main-header-menu' => array( 'background-color' => '#f9f9f9', ), '.ast-amp .main-header-menu ul' => array( 'background-color' => '#f9f9f9', 'position' => 'static', 'opacity' => '1', 'visibility' => 'visible', 'border' => '0', 'width' => 'auto', ), '.ast-amp .main-header-menu ul li.ast-left-align-sub-menu:hover > ul, .ast-amp .main-header-menu ul li.ast-left-align-sub-menu.focus > ul' => array( 'left' => '0', ), '.ast-amp .main-header-menu li.ast-sub-menu-goes-outside:hover > ul, .ast-amp .main-header-menu li.ast-sub-menu-goes-outside.focus > ul' => array( 'left' => '0', ), '.ast-amp .submenu-with-border .sub-menu' => array( 'border' => '0', ), '.ast-amp .user-select' => array( 'clear' => 'both', ), '.ast-amp .ast-mobile-menu-buttons' => array( 'display' => 'block', '-webkit-align-self' => 'center', '-ms-flex-item-align' => 'center', 'align-self' => 'center', ), '.ast-amp .main-header-bar-navigation' => array( '-webkit-box-flex' => '1', '-webkit-flex' => 'auto', '-moz-box-flex' => '1', '-ms-flex' => 'auto', 'flex' => 'auto', 'width' => '-webkit-calc( 100% + 40px)', 'width' => 'calc(100% + 40px )', ), '.ast-amp .ast-main-header-bar-alignment' => array( 'display' => 'block', 'width' => '100%', '-webkit-box-flex' => '1', '-webkit-flex' => 'auto', '-moz-box-flex' => '1', '-ms-flex' => 'auto', 'flex' => 'auto', '-webkit-box-ordinal-group' => '5', '-webkit-order' => '4', '-moz-box-ordinal-group' => '5', '-ms-flex-order' => '4', 'order' => '4', ), '.ast-amp .ast-mobile-menu-buttons' => array( 'text-align' => 'right', 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-pack' => 'end', '-webkit-justify-content' => 'flex-end', '-moz-box-pack' => 'end', '-ms-flex-pack' => 'end', 'justify-content' => 'flex-end', ), '.ast-amp .site-header .main-header-bar-wrap .site-branding' => array( '-js-display' => 'flex', 'display' => '-webkit-box', 'display' => '-webkit-flex', 'display' => '-moz-box', 'display' => '-ms-flexbox', 'display' => 'flex', '-webkit-box-flex' => '1', '-webkit-flex' => '1', '-moz-box-flex' => '1', '-ms-flex' => '1', 'flex' => '1', '-webkit-align-self' => 'center', '-ms-flex-item-align' => 'center', 'align-self' => 'center', ), '.ast-amp .ast-site-identity' => array( 'width' => '100%', ), '.ast-amp .main-header-bar-navigation .menu-item-has-children > .menu-link .sub-arrow:after' => array( 'display' => 'none', ), '.ast-amp .main-header-bar' => array( 'display' => 'block', 'line-height' => '3', ), '.ast-main-header-bar-alignment .main-header-bar-navigation' => array( 'line-height' => '3', 'display' => 'none', ), '.ast-amp .main-header-bar .toggled-on .main-header-bar-navigation' => array( 'line-height' => '3', 'display' => 'none', ), '.ast-amp .main-header-bar .main-header-bar-navigation .sub-menu' => array( 'line-height' => '3', ), '.ast-amp .main-header-bar .main-header-bar-navigation .menu-item-has-children .sub-menu' => array( 'display' => 'none', ), '.ast-amp .main-header-bar .main-header-bar-navigation .menu-item-has-children .dropdown-open+ul.sub-menu' => array( 'display' => 'block', ), '.ast-amp .main-header-bar .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle' => array( 'display' => 'inline-block', 'position' => 'absolute', 'font-size' => 'inherit', 'top' => '-1px', 'right' => '20px', 'cursor' => 'pointer', 'webkit-font-smoothing' => 'antialiased', 'moz-osx-font-smoothing' => 'grayscale', 'padding' => '0 0.907em', 'font-weight' => 'normal', 'line-height' => 'inherit', 'transition' => 'all 0.2s', ), '.ast-amp .main-header-bar .main-header-bar-navigation .ast-submenu-expanded > .ast-menu-toggle::before' => array( '-webkit-transform' => 'rotateX(180deg)', 'transform' => 'rotateX(180deg)', ), '.ast-amp .main-header-bar .main-header-bar-navigation .main-header-menu' => array( 'border-top-width' => '1px', 'border-style' => 'solid', 'border-color' => '#eaeaea', ), '.ast-amp .main-navigation' => array( 'display' => 'block', 'width' => '100%', ), '.ast-amp .main-navigation ul > li:first-child' => array( 'border-top' => '0', ), '.ast-amp .main-navigation ul ul' => array( 'left' => 'auto', 'right' => 'auto', ), '.ast-amp .main-navigation li' => array( 'width' => '100%', ), '.ast-amp .main-navigation .widget' => array( 'margin-bottom' => '1em', ), '.ast-amp .main-navigation .widget li' => array( 'width' => 'auto', ), '.ast-amp .main-navigation .widget:last-child' => array( 'margin-bottom' => '0', ), '.ast-amp .main-header-menu ul ul' => array( 'top' => '0', ), '.ast-amp .ast-has-mobile-header-logo .custom-logo-link, .ast-amp .ast-has-mobile-header-logo .astra-logo-svg' => array( 'display' => 'none', ), '.ast-amp .ast-has-mobile-header-logo .custom-mobile-logo-link' => array( 'display' => 'inline-block', ), '.ast-theme.ast-mobile-inherit-site-logo .ast-has-mobile-header-logo .custom-logo-link, .ast-theme.ast-mobile-inherit-site-logo .ast-has-mobile-header-logo .astra-logo-svg' => array( 'display' => 'block', ), '.ast-amp .ast-header-widget-area .widget' => array( 'margin' => '0.5em 0', 'display' => 'block', ), '.ast-amp .main-header-bar' => array( 'border' => '0', 'border-bottom-color' => '#eaeaea', 'border-bottom-style' => 'solid', ), '.ast-amp .nav-fallback-text' => array( 'float' => 'none', ), '.ast-amp .main-header-menu .woocommerce-custom-menu-item .ast-cart-menu-wrap' => array( 'height' => '3em', 'line-height' => '3', 'text-align' => 'left', ), '.ast-amp .ast-site-header-cart .widget_shopping_cart' => array( 'display' => 'none', ), '.ast-theme.ast-woocommerce-cart-menu .ast-site-header-cart' => array( 'order' => 'initial', 'line-height' => '3', 'padding' => '0 1em 1em 0', ), '.ast-amp .ast-edd-site-header-cart .widget_edd_cart_widget, .ast-amp .ast-edd-site-header-cart .ast-edd-header-cart-info-wrap' => array( 'display' => 'none', ), '.ast-amp div.ast-masthead-custom-menu-items.edd-custom-menu-item' => array( 'padding' => '0', ), '.ast-amp .main-header-bar .ast-search-menu-icon.slide-search .search-form' => array( 'right' => '0', ), '.ast-amp .main-header-menu .sub-menu' => array( 'box-shadow' => 'none', ), '.ast-amp .submenu-with-border .sub-menu a' => array( 'border-width' => '1px', ), '.ast-amp .submenu-with-border .sub-menu > li:last-child > a' => array( 'border-width' => '1px', ), ); if ( false === Astra_Icons::is_svg_icons() ) { $astra_break_point_navigation['.ast-amp .main-navigation ul.children li a:before, .ast-amp .main-navigation ul.sub-menu li a:before'] = array( 'content' => '"\e900"', 'font-family' => '"Astra"', 'font-size' => '0.65em', 'text-decoration' => 'inherit', 'display' => 'inline-block', 'transform' => 'translate(0, -2px) rotateZ(270deg)', 'margin-right' => '5px', ); $astra_break_point_navigation['.ast-amp .main-header-bar .main-header-bar-navigation .menu-item-has-children > .ast-menu-toggle::before'] = array( 'font-weight' => 'bold', 'content' => '"\e900"', 'font-family' => '"Astra"', 'text-decoration' => 'inherit', 'display' => 'inline-block', ); } else { $astra_break_point_navigation['[data-section="section-header-mobile-trigger"] .ast-button-wrap .ast-mobile-menu-buttons-minimal'] = array( 'background' => 'transparent', 'border' => 'none', ); } $parse_css .= astra_parse_css( $astra_break_point_navigation, '', astra_header_break_point() ); return $parse_css; } /** * Add AMP attributes to the nav menu wrapper. * * @since 1.7.0 * @param Array $attr HTML attributes to be added to the nav menu wrapper. * * @return Array updated HTML attributes. */ public function nav_menu_wrapper( $attr ) { $attr['[class]'] = '( astraAmpMenuExpanded ? \'ast-main-header-bar-alignment toggle-on\' : \'ast-main-header-bar-alignment\' )'; $attr['aria-expanded'] = 'false'; $attr['[aria-expanded]'] = '(astraAmpMenuExpanded ? \'true\' : \'false\')'; return $attr; } /** * Set AMP State for eeach sub menu toggle. * * @since 1.7.0 * @param String $item_output HTML markup for the menu item. * @param WP_Post $item Post object for the navigation menu. * * @return String HTML MArkup for the menu including the AML State. */ public function toggle_button_markup( $item_output, $item ) { $item_output .= ''; return $item_output; } /** * Add AMP attribites to the toggle button to add `.ast-submenu-expanded` class to parent li. * * @since 1.7.0 * @param array $attr Optional. Extra attributes to merge with defaults. * @param string $context The context, to build filter name. * @param array $args Optional. Custom data to pass to filter. * * @return Array updated HTML attributes. */ public function menu_toggle_button( $attr, $context, $args ) { $attr['[class]'] = '( astraNavMenuItemExpanded' . $args->ID . ' ? \' ast-menu-toggle dropdown-open\' : \'ast-menu-toggle\')'; $attr['on'] = 'tap:AMP.setState( { astraNavMenuItemExpanded' . $args->ID . ': ! astraNavMenuItemExpanded' . $args->ID . ' } )'; return $attr; } /** * Add amp states to the dom. */ public function render_amp_states() { echo ''; echo ''; echo ''; } /** * Add search slide data attributes. * * @param string $input the data attrs already existing in the nav. * * @return string */ public function add_search_slide_toggle_attrs( $input ) { $input .= ' on="tap:AMP.setState( { astraAmpSlideSearchMenuExpanded: ! astraAmpSlideSearchMenuExpanded } )" '; $input .= ' [class]="( astraAmpSlideSearchMenuExpanded ? \'ast-search-menu-icon slide-search ast-dropdown-active\' : \'ast-search-menu-icon slide-search\' )" '; $input .= ' aria-expanded="false" [aria-expanded]="astraAmpSlideSearchMenuExpanded ? \'true\' : \'false\'" '; return $input; } /** * Add search slide data attributes. * * @param string $input the data attrs already existing in the nav. * * @return string */ public function add_search_field_toggle_attrs( $input ) { $input .= ' on="tap:AMP.setState( { astraAmpSlideSearchMenuExpanded: astraAmpSlideSearchMenuExpanded } )" '; return $input; } /** * Add the nav toggle data attributes. * * @param string $input the data attrs already existing in nav toggle. * * @return string */ public function add_nav_toggle_attrs( $input ) { $input .= ' on="tap:AMP.setState( { astraAmpMenuExpanded: ! astraAmpMenuExpanded } ),astra-body.toggleClass(class=ast-main-header-nav-open)" '; $input .= ' [class]="\'menu-toggle main-header-menu-toggle ast-mobile-menu-buttons-minimal\' + ( astraAmpMenuExpanded ? \' toggled\' : \'\' )" '; $input .= ' aria-expanded="false" '; $input .= ' [aria-expanded]="astraAmpMenuExpanded ? \'true\' : \'false\'" '; return $input; } } endif; /** * Kicking this off by calling 'get_instance()' method */ Astra_AMP::get_instance(); /** * 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(); /** * Above Footer Styling Loader for Astra theme. * * @package Astra Builder * @author Brainstorm Force * @copyright Copyright (c) 2020, Brainstorm Force * @link https://www.brainstormforce.com * @since Astra 3.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Above Footer Initialization * * @since 3.0.0 */ class Astra_Above_Footer_Component_Loader { /** * Constructor * * @since 3.0.0 */ public function __construct() { add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 ); } /** * Customizer Preview * * @since 3.0.0 */ public function preview_scripts() { /** * Load unminified if SCRIPT_DEBUG is true. */ /* Directory and Extension */ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_script( 'astra-footer-above-customizer-preview-js', ASTRA_BUILDER_FOOTER_ABOVE_FOOTER_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true ); } } /** * Kicking this off by creating the object of the class. */ new Astra_Above_Footer_Component_Loader(); /** * Deprecated Functions of Astra Theme. * * @package Astra * @author Astra * @copyright Copyright (c) 2020, Astra * @link https://wpastra.com/ * @since Astra 1.0.23 */ if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Deprecating footer_menu_static_css function. * * Footer menu specific static CSS function. * * @since 3.7.4 * @deprecated footer_menu_static_css() Use astra_footer_menu_static_css() * @see astra_footer_menu_static_css() * * @return string Parsed CSS */ function footer_menu_static_css() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_footer_menu_static_css()' ); return astra_footer_menu_static_css(); } /** * Deprecating is_support_footer_widget_right_margin function. * * Backward managing function based on flag - 'support-footer-widget-right-margin' which fixes right margin issue in builder widgets. * * @since 3.7.4 * @deprecated is_support_footer_widget_right_margin() Use astra_support_footer_widget_right_margin() * @see astra_support_footer_widget_right_margin() * * @return bool true|false */ function is_support_footer_widget_right_margin() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_support_footer_widget_right_margin()' ); return astra_support_footer_widget_right_margin(); } /** * Deprecating prepare_button_defaults function. * * Default configurations for builder button components. * * @since 3.7.4 * @deprecated prepare_button_defaults() Use astra_prepare_button_defaults() * @param array $defaults Button default configs. * @param string $index builder button component index. * @see astra_prepare_button_defaults() * * @return array */ function prepare_button_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_button_defaults()' ); return astra_prepare_button_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_html_defaults function. * * Default configurations for builder HTML components. * * @since 3.7.4 * @deprecated prepare_html_defaults() Use astra_prepare_html_defaults() * @param array $defaults HTML default configs. * @param string $index builder HTML component index. * @see astra_prepare_html_defaults() * * @return array */ function prepare_html_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_html_defaults()' ); return astra_prepare_html_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_social_icon_defaults function. * * Default configurations for builder Social Icon components. * * @since 3.7.4 * @deprecated prepare_social_icon_defaults() Use astra_prepare_social_icon_defaults() * @param array $defaults Social Icon default configs. * @param string $index builder Social Icon component index. * @see astra_prepare_social_icon_defaults() * * @return array */ function prepare_social_icon_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_social_icon_defaults()' ); return astra_prepare_social_icon_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_widget_defaults function. * * Default configurations for builder Widget components. * * @since 3.7.4 * @deprecated prepare_widget_defaults() Use astra_prepare_widget_defaults() * @param array $defaults Widget default configs. * @param string $index builder Widget component index. * @see astra_prepare_widget_defaults() * * @return array */ function prepare_widget_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_widget_defaults()' ); return astra_prepare_widget_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_menu_defaults function. * * Default configurations for builder Menu components. * * @since 3.7.4 * @deprecated prepare_menu_defaults() Use astra_prepare_menu_defaults() * @param array $defaults Menu default configs. * @param string $index builder Menu component index. * @see astra_prepare_menu_defaults() * * @return array */ function prepare_menu_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_menu_defaults()' ); return astra_prepare_menu_defaults( $defaults, absint( $index ) ); } /** * Deprecating prepare_divider_defaults function. * * Default configurations for builder Divider components. * * @since 3.7.4 * @deprecated prepare_divider_defaults() Use astra_prepare_divider_defaults() * @param array $defaults Divider default configs. * @param string $index builder Divider component index. * @see astra_prepare_divider_defaults() * * @return array */ function prepare_divider_defaults( $defaults, $index ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_prepare_divider_defaults()' ); return astra_prepare_divider_defaults( $defaults, absint( $index ) ); } /** * Deprecating is_astra_pagination_enabled function. * * Checking if Astra's pagination enabled. * * @since 3.7.4 * @deprecated is_astra_pagination_enabled() Use astra_check_pagination_enabled() * @see astra_check_pagination_enabled() * * @return bool true|false */ function is_astra_pagination_enabled() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_check_pagination_enabled()' ); return astra_check_pagination_enabled(); } /** * Deprecating is_current_post_comment_enabled function. * * Checking if current post's comment enabled and comment section is open. * * @since 3.7.4 * @deprecated is_current_post_comment_enabled() Use astra_check_current_post_comment_enabled() * @see astra_check_current_post_comment_enabled() * * @return bool true|false */ function is_current_post_comment_enabled() { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_check_current_post_comment_enabled()' ); return astra_check_current_post_comment_enabled(); } /** * Deprecating ast_load_preload_local_fonts function. * * Preload Google Fonts - Feature of self-hosting font. * * @since 3.7.4 * @deprecated ast_load_preload_local_fonts() Use astra_load_preload_local_fonts() * @param string $google_font_url Google Font URL generated by customizer config. * @see astra_load_preload_local_fonts() * * @return string */ function ast_load_preload_local_fonts( $google_font_url ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_load_preload_local_fonts()' ); return astra_load_preload_local_fonts( $google_font_url ); } /** * Deprecating ast_get_webfont_url function. * * Getting webfont based Google font URL. * * @since 3.7.4 * @deprecated ast_get_webfont_url() Use astra_get_webfont_url() * @param string $google_font_url Google Font URL generated by customizer config. * @see astra_get_webfont_url() * * @return string */ function ast_get_webfont_url( $google_font_url ) { _deprecated_function( __FUNCTION__, '3.7.4', 'astra_get_webfont_url()' ); return astra_get_webfont_url( $google_font_url ); }