From 69c17f9c1942fd0d6a5ea941636e87723b8a6fe2 Mon Sep 17 00:00:00 2001 From: Zach van Rijn Date: Wed, 21 Jul 2021 16:19:29 -0500 Subject: dos2unix on all .php files, begin paring down admin page and site branding. --- inc/class-astra-mobile-header.php | 458 +++++++++++++++++++------------------- 1 file changed, 229 insertions(+), 229 deletions(-) (limited to 'inc/class-astra-mobile-header.php') diff --git a/inc/class-astra-mobile-header.php b/inc/class-astra-mobile-header.php index 8ab0d61..438be40 100644 --- a/inc/class-astra-mobile-header.php +++ b/inc/class-astra-mobile-header.php @@ -1,229 +1,229 @@ -theme_location ) && in_array( $args->theme_location, $menu_locations ) ) { - if ( isset( $item->classes ) && in_array( 'menu-item-has-children', $item->classes ) ) { - $item_output = $this->menu_arrow_button_markup( $item_output, $item ); - } - } - } else { - if ( isset( $item->post_parent ) && 0 === $item->post_parent ) { - $item_output = $this->menu_arrow_button_markup( $item_output, $item ); - } - } - - return $item_output; - } - - /** - * Get Menu Arrow Button Mark up - * - * @param string $item_output The menu item's starting HTML output. - * @param WP_Post $item Menu item data object. - * - * @since 1.7.2 - * @return string Menu item arrow button markup. - */ - public function menu_arrow_button_markup( $item_output, $item ) { - $item_output = apply_filters( 'astra_toggle_button_markup', $item_output, $item ); - $item_output .= ''; - - return $item_output; - } - - /** - * Header Cart Icon Class - * - * @param array $classes Default argument array. - * - * @since 1.4.0 - * @return array; - */ - public function menu_toggle_classes( $classes ) { - return ' ast-mobile-menu-buttons-' . astra_get_option( 'mobile-header-toggle-btn-style' ) . ' '; - } - - /** - * Mobile Header Markup - * - * @return void - */ - public function mobile_header_markup() { - $mobile_header_logo = astra_get_option( 'mobile-header-logo' ); - $different_logo = astra_get_option( 'different-mobile-logo' ); - - if ( '' !== $mobile_header_logo && '1' == $different_logo ) { - add_filter( 'astra_has_custom_logo', '__return_true' ); - add_filter( 'get_custom_logo', array( $this, 'astra_mobile_header_custom_logo' ), 10, 2 ); - add_filter( 'astra_is_logo_attachment', array( $this, 'add_mobile_logo_svg_class' ), 10, 2 ); - } - } - - /** - * Replace logo with Mobile Header logo. - * - * @param sting $html Size name. - * @param int $blog_id Icon. - * @since 1.4.0 - * @return string html markup of logo. - */ - public function astra_mobile_header_custom_logo( $html, $blog_id ) { - - $mobile_header_logo = astra_get_option( 'mobile-header-logo' ); - - $custom_logo_id = attachment_url_to_postid( $mobile_header_logo ); - - $size = 'ast-mobile-header-logo-size'; - - if ( is_customize_preview() ) { - $size = 'full'; - } - - $logo = sprintf( - '', - esc_url( home_url( '/' ) ), - wp_get_attachment_image( - $custom_logo_id, - $size, - false, - array( - 'class' => 'ast-mobile-header-logo', - ) - ) - ); - - return $html . $logo; - - } - - /** - * Add svg class to mobile logo. - * - * @param bool $is_logo_attachment is attachment is logo image?. - * @param array $attachment attachment data. - * @since 2.1.0 - * @return bool return if attachment is mobile logo image. - */ - public function add_mobile_logo_svg_class( $is_logo_attachment, $attachment ) { - - $mobile_header_logo = astra_get_option( 'mobile-header-logo' ); - $custom_logo_id = attachment_url_to_postid( $mobile_header_logo ); - - if ( $custom_logo_id === $attachment->ID ) { - return true; - } - - return $is_logo_attachment; - } - - /** - * Add Body Classes - * - * @param array $classes Body Class Array. - * @return array - */ - public function add_body_class( $classes ) { - - /** - * Add class for header width - */ - $header_content_layout = astra_get_option( 'different-mobile-logo' ); - - if ( '0' == $header_content_layout ) { - $classes[] = 'ast-mobile-inherit-site-logo'; - } - - return $classes; - } - - } - - /** - * Initialize class object with 'get_instance()' method - */ - Astra_Mobile_Header::get_instance(); - -endif; +theme_location ) && in_array( $args->theme_location, $menu_locations ) ) { + if ( isset( $item->classes ) && in_array( 'menu-item-has-children', $item->classes ) ) { + $item_output = $this->menu_arrow_button_markup( $item_output, $item ); + } + } + } else { + if ( isset( $item->post_parent ) && 0 === $item->post_parent ) { + $item_output = $this->menu_arrow_button_markup( $item_output, $item ); + } + } + + return $item_output; + } + + /** + * Get Menu Arrow Button Mark up + * + * @param string $item_output The menu item's starting HTML output. + * @param WP_Post $item Menu item data object. + * + * @since 1.7.2 + * @return string Menu item arrow button markup. + */ + public function menu_arrow_button_markup( $item_output, $item ) { + $item_output = apply_filters( 'astra_toggle_button_markup', $item_output, $item ); + $item_output .= ''; + + return $item_output; + } + + /** + * Header Cart Icon Class + * + * @param array $classes Default argument array. + * + * @since 1.4.0 + * @return array; + */ + public function menu_toggle_classes( $classes ) { + return ' ast-mobile-menu-buttons-' . astra_get_option( 'mobile-header-toggle-btn-style' ) . ' '; + } + + /** + * Mobile Header Markup + * + * @return void + */ + public function mobile_header_markup() { + $mobile_header_logo = astra_get_option( 'mobile-header-logo' ); + $different_logo = astra_get_option( 'different-mobile-logo' ); + + if ( '' !== $mobile_header_logo && '1' == $different_logo ) { + add_filter( 'astra_has_custom_logo', '__return_true' ); + add_filter( 'get_custom_logo', array( $this, 'astra_mobile_header_custom_logo' ), 10, 2 ); + add_filter( 'astra_is_logo_attachment', array( $this, 'add_mobile_logo_svg_class' ), 10, 2 ); + } + } + + /** + * Replace logo with Mobile Header logo. + * + * @param sting $html Size name. + * @param int $blog_id Icon. + * @since 1.4.0 + * @return string html markup of logo. + */ + public function astra_mobile_header_custom_logo( $html, $blog_id ) { + + $mobile_header_logo = astra_get_option( 'mobile-header-logo' ); + + $custom_logo_id = attachment_url_to_postid( $mobile_header_logo ); + + $size = 'ast-mobile-header-logo-size'; + + if ( is_customize_preview() ) { + $size = 'full'; + } + + $logo = sprintf( + '', + esc_url( home_url( '/' ) ), + wp_get_attachment_image( + $custom_logo_id, + $size, + false, + array( + 'class' => 'ast-mobile-header-logo', + ) + ) + ); + + return $html . $logo; + + } + + /** + * Add svg class to mobile logo. + * + * @param bool $is_logo_attachment is attachment is logo image?. + * @param array $attachment attachment data. + * @since 2.1.0 + * @return bool return if attachment is mobile logo image. + */ + public function add_mobile_logo_svg_class( $is_logo_attachment, $attachment ) { + + $mobile_header_logo = astra_get_option( 'mobile-header-logo' ); + $custom_logo_id = attachment_url_to_postid( $mobile_header_logo ); + + if ( $custom_logo_id === $attachment->ID ) { + return true; + } + + return $is_logo_attachment; + } + + /** + * Add Body Classes + * + * @param array $classes Body Class Array. + * @return array + */ + public function add_body_class( $classes ) { + + /** + * Add class for header width + */ + $header_content_layout = astra_get_option( 'different-mobile-logo' ); + + if ( '0' == $header_content_layout ) { + $classes[] = 'ast-mobile-inherit-site-logo'; + } + + return $classes; + } + + } + + /** + * Initialize class object with 'get_instance()' method + */ + Astra_Mobile_Header::get_instance(); + +endif; -- cgit v1.2.3-70-g09d2