summaryrefslogtreecommitdiff
path: root/inc/core/class-astra-attr.php
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2021-07-21 16:19:29 -0500
committerZach van Rijn <me@zv.io>2021-07-21 16:19:29 -0500
commit69c17f9c1942fd0d6a5ea941636e87723b8a6fe2 (patch)
treee1d0212147048204b0eede0aa6ff79849ed479da /inc/core/class-astra-attr.php
parent74a7109a2a5ab0d191f26c917ae69e46f0d83b32 (diff)
downloadblog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.gz
blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.bz2
blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.xz
blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.zip
dos2unix on all .php files, begin paring down admin page and site branding.
Diffstat (limited to 'inc/core/class-astra-attr.php')
-rw-r--r--inc/core/class-astra-attr.php230
1 files changed, 115 insertions, 115 deletions
diff --git a/inc/core/class-astra-attr.php b/inc/core/class-astra-attr.php
index 2f55e46..9154c47 100644
--- a/inc/core/class-astra-attr.php
+++ b/inc/core/class-astra-attr.php
@@ -1,115 +1,115 @@
-<?php
-/**
- * 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();
+<?php
+/**
+ * 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();