PATH:
home
/
letacommog
/
entrepro
/
wp-content
/
plugins
/
buddypress
/
bp-core
/
classes
<?php /** * Core component classes. * * @package BuddyPress * @subpackage Core * @since 2.7.0 */ /** * Generate markup for an HTML element. * * @since 2.7.0 */ class BP_Core_HTML_Element { /** * Open tag for an element. * * This would include attributes if applicable. eg. '<a href="" class="">' * * @since 2.7.0 * * @var string */ public $open_tag = ''; /** * Inner HTML for an element. * * For example, this could be anchor text within an <a> element. * * @since 2.7.0 * * @var string */ public $inner_html = ''; /** * Closing tag for an element. * * For example, "</a>". * * @since 2.7.0 * * @var string */ public $close_tag = ''; /** * Constructor. * * @since 2.7.0 * * @param array $r { * An array of arguments. * @type string $element The element to render. eg. 'a' for the anchor element. * @type array $attr Optional. The element's attributes set as key/value pairs. eg. * array( 'href' => 'http://example.com', 'class' => 'my-class' ) * @type string $inner_html Optional. The inner HTML for the element if applicable. Please note that * this isn't sanitized, so you should use your own sanitization routine * before using this parameter. * } */ public function __construct( $r = array() ) { $elem = sanitize_html_class( $r['element'] ); if ( empty( $elem ) ) { return; } // Render attributes. $attributes = ''; foreach( (array) $r['attr'] as $attr => $val ) { // If attribute is empty, skip. if ( empty( $val ) ) { continue; } if ( 'href' === $attr || 'formaction' === $attr || 'src' === $attr ) { $val = esc_url( $val ); } elseif ( 'id' === $attr ) { $val = sanitize_html_class( $val ); } else { $val = esc_attr( $val ); } $attributes .= sprintf( '%s="%s" ', sanitize_html_class( $attr ), $val ); } // <input> / <img> is self-closing. if ( 'input' === $elem || 'img' === $elem ) { $this->open_tag = sprintf( '<%1$s %2$s />', $elem, $attributes ); // All other elements. } else { $this->open_tag = sprintf( '<%1$s %2$s>', $elem, $attributes ); $this->inner_html = ! empty( $r['inner_html'] ) ? $r['inner_html'] : ''; $this->close_tag = sprintf( '</%1$s>', $elem ); } } /** * Returns a property from this class. * * @since 2.7.0 * * @param string $prop Property name. Either 'open_tag', 'inner_html', 'close_tag'. * @return string */ public function get( $prop = '' ) { if ( ! isset( $this->{$prop} ) ) { return ''; } return $this->{$prop}; } /** * Returns full contents of HTML element. * * @since 2.7.0 * * @return string */ public function contents() { return $this->open_tag . $this->inner_html . $this->close_tag; } }
[+]
..
[-] class-bp-walker-category-checklist.php
[edit]
[-] class-bp-component.php
[edit]
[-] class-bp-phpmailer.php
[edit]
[-] class-bp-core-bp-options-nav-backcompat.php
[edit]
[-] class-bp-core-html-element.php
[edit]
[-] class-bp-core-bp-nav-backcompat.php
[edit]
[-] class-bp-suggestions.php
[edit]
[-] class-bp-core-nav-item.php
[edit]
[-] class-bp-admin.php
[edit]
[-] class-bp-attachment.php
[edit]
[-] class-bp-button.php
[edit]
[-] class-bp-attachment-cover-image.php
[edit]
[-] class-bp-core.php
[edit]
[-] class-bp-attachment-avatar.php
[edit]
[-] class-bp-walker-nav-menu.php
[edit]
[-] class-bp-media-extractor.php
[edit]
[-] class-bp-date-query.php
[edit]
[-] class-bp-core-notification.php
[edit]
[-] class-bp-core-user.php
[edit]
[-] class-bp-core-nav.php
[edit]
[-] class-bp-members-suggestions.php
[edit]
[-] class-bp-core-login-widget.php
[edit]
[-] class-bp-embed.php
[edit]
[-] class-bp-email.php
[edit]
[-] class-bp-core-oembed-extension.php
[edit]
[-] class-bp-walker-nav-menu-checklist.php
[edit]
[-] class-bp-theme-compat.php
[edit]
[-] class-bp-customizer-control-range.php
[edit]
[-] class-bp-recursive-query.php
[edit]
[-] class-bp-user-query.php
[edit]
[-] class-bp-email-recipient.php
[edit]
[-] class-bp-email-delivery.php
[edit]