/** * Astra Theme Strings * * @package Astra * @link https://wpastra.com/ * @since Astra 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Default Strings */ if ( ! function_exists( 'astra_default_strings' ) ) { /** * Default Strings * * @since 1.0.0 * @param string $key String key. * @param bool $echo Print string. * @return mixed Return string or nothing. */ function astra_default_strings( $key, $echo = true ) { $post_comment_dynamic_string = true === Astra_Dynamic_CSS::astra_core_form_btns_styling() ? __( 'Post Comment', 'astra' ) : __( 'Post Comment »', 'astra' ); $defaults = apply_filters( 'astra_default_strings', array( // Header. 'string-header-skip-link' => __( 'Skip to content', 'astra' ), // 404 Page Strings. 'string-404-sub-title' => __( 'It looks like the link pointing here was faulty. Maybe try searching?', 'astra' ), // Search Page Strings. 'string-search-nothing-found' => __( 'Nothing Found', 'astra' ), 'string-search-nothing-found-message' => __( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'astra' ), 'string-full-width-search-message' => __( 'Start typing and press enter to search', 'astra' ), 'string-full-width-search-placeholder' => __( 'Search...', 'astra' ), 'string-header-cover-search-placeholder' => __( 'Search...', 'astra' ), 'string-search-input-placeholder' => __( 'Search...', 'astra' ), // Comment Template Strings. 'string-comment-reply-link' => __( 'Reply', 'astra' ), 'string-comment-edit-link' => __( 'Edit', 'astra' ), 'string-comment-awaiting-moderation' => __( 'Your comment is awaiting moderation.', 'astra' ), 'string-comment-title-reply' => __( 'Leave a Comment', 'astra' ), 'string-comment-cancel-reply-link' => __( 'Cancel Reply', 'astra' ), 'string-comment-label-submit' => $post_comment_dynamic_string, 'string-comment-label-message' => __( 'Type here..', 'astra' ), 'string-comment-label-name' => __( 'Name', 'astra' ), 'string-comment-label-email' => __( 'Email', 'astra' ), 'string-comment-label-website' => __( 'Website', 'astra' ), 'string-comment-closed' => __( 'Comments are closed.', 'astra' ), 'string-comment-navigation-title' => __( 'Comment navigation', 'astra' ), 'string-comment-navigation-next' => __( 'Newer Comments', 'astra' ), 'string-comment-navigation-previous' => __( 'Older Comments', 'astra' ), // Blog Default Strings. 'string-blog-page-links-before' => __( 'Pages:', 'astra' ), 'string-blog-meta-author-by' => __( 'By ', 'astra' ), 'string-blog-meta-leave-a-comment' => __( 'Leave a Comment', 'astra' ), 'string-blog-meta-one-comment' => __( '1 Comment', 'astra' ), 'string-blog-meta-multiple-comment' => __( '% Comments', 'astra' ), 'string-blog-navigation-next' => __( 'Next', 'astra' ) . ' ', 'string-blog-navigation-previous' => ' ' . __( 'Previous', 'astra' ), 'string-next-text' => __( 'Next', 'astra' ), 'string-previous-text' => __( 'Previous', 'astra' ), // Single Post Default Strings. 'string-single-page-links-before' => __( 'Pages:', 'astra' ), /* translators: 1: Post type label */ 'string-single-navigation-next' => __( 'Next %s', 'astra' ) . ' ', /* translators: 1: Post type label */ 'string-single-navigation-previous' => ' ' . __( 'Previous %s', 'astra' ), // Content None. 'string-content-nothing-found-message' => __( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'astra' ), ) ); if ( is_rtl() ) { $defaults['string-blog-navigation-next'] = __( 'Next', 'astra' ) . ' '; $defaults['string-blog-navigation-previous'] = ' ' . __( 'Previous', 'astra' ); /* translators: 1: Post type label */ $defaults['string-single-navigation-next'] = __( 'Next %s', 'astra' ) . ' '; /* translators: 1: Post type label */ $defaults['string-single-navigation-previous'] = ' ' . __( 'Previous %s', 'astra' ); } $output = isset( $defaults[ $key ] ) ? $defaults[ $key ] : ''; /** * Print or return */ if ( $echo ) { echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $output; } } }/** * Icons for Astra theme. * * @package Astra * @link https://www.brainstormforce.com * @since Astra 3.3.0 */ defined( 'ABSPATH' ) || exit; /** * Icons Initial Setup * * @since 3.3.0 */ class Astra_Icons { /** * Constructor function that initializes required actions and hooks */ public function __construct() { // Remove astra.woff and other format of Astra font files when SVG is enabled. if ( self::is_svg_icons() ) { add_filter( 'astra_enable_default_fonts', '__return_false' ); } } /** * Check if we need to load icons as SVG or fonts. * Returns true if SVG false if font. * * @since 3.3.0 * * @return bool should be svg or font. */ public static function is_svg_icons() { $astra_settings = astra_get_options(); return apply_filters( 'astra_is_svg_icons', isset( $astra_settings['can-update-astra-icons-svg'] ) ? $astra_settings['can-update-astra-icons-svg'] : true ); } /** * Returns an array of allowed SVG arguments. * * @return array An array of allowed SVG arguments. * @since 4.10.0 */ public static function allowed_svg_args() { return array( 'span' => array( 'class' => array() ), 'svg' => array( 'xmlns:xlink' => array(), 'version' => array(), 'id' => array(), 'x' => array(), 'y' => array(), 'enable-background' => array(), 'xml:space' => array(), 'class' => array(), 'aria-hidden' => array(), 'aria-labelledby' => array(), 'role' => array(), 'xmlns' => array(), 'width' => array(), 'height' => array(), 'viewbox' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), 'stroke-linecap' => array(), 'stroke-linejoin' => array(), ), 'title' => array( 'title' => array() ), 'g' => array( 'fill' => array(), 'stroke' => array(), 'transform' => array(), ), 'path' => array( 'd' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), 'fill-rule' => array(), ), 'circle' => array( 'cx' => array(), 'cy' => array(), 'r' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), ), 'rect' => array( 'x' => array(), 'y' => array(), 'width' => array(), 'height' => array(), 'rx' => array(), 'ry' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), ), 'line' => array( 'x1' => array(), 'y1' => array(), 'x2' => array(), 'y2' => array(), 'stroke' => array(), 'stroke-width' => array(), ), 'polygon' => array( 'points' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), ), 'polyline' => array( 'points' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), ), 'ellipse' => array( 'cx' => array(), 'cy' => array(), 'rx' => array(), 'ry' => array(), 'fill' => array(), 'stroke' => array(), 'stroke-width' => array(), ), 'defs' => array(), 'clipPath' => array( 'id' => array(), ), 'use' => array( 'xlink:href' => array(), 'href' => array(), // modern SVG2. ), ); } /** * Get SVG icons. * Returns the SVG icon you want to display. * * @since 3.3.0 * * @param string $icon Key for the SVG you want to load. * @param bool $is_echo whether to echo the output or return. * @param bool $replace load close markup for SVG. * @param string $menu_location Creates dynamic filter for passed parameter. * * @return string SVG for passed key. */ public static function get_icons( $icon, $is_echo = false, $replace = false, $menu_location = 'main' ) { $output = ''; if ( true === self::is_svg_icons() ) { switch ( $icon ) { case 'menu-bars': $output = ' '; break; case 'close': $output = ''; break; case 'search': $output = ' '; break; case 'arrow': $output = ' '; break; case 'cart': $output = ' '; break; case 'bag': $output = ' '; break; case 'basket': $output = ' '; break; default: $output = ''; break; } if ( $replace ) { $output .= ' '; } } else { if ( 'menu-bars' === $icon ) { $menu_icon = apply_filters( 'astra_' . $menu_location . '_menu_toggle_icon', 'menu-toggle-icon' ); $output = ''; } } $output = apply_filters( 'astra_svg_icon_element', $output, $icon ); $classes = array( 'ast-icon', 'icon-' . $icon, ); $output = apply_filters( 'astra_svg_icon', // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound sprintf( '%2$s', implode( ' ', $classes ), $output ), $icon ); if ( $is_echo !== true ) { return wp_kses( $output, self::allowed_svg_args() ); } echo wp_kses( $output, self::allowed_svg_args() ); } } new Astra_Icons();