function shortcodeHandler( $atts, $content = '' ) {

		global $id; // This is the Post ID, [@see WP_Query::setup_postdata, ...]

		$a = shortcode_atts(
			[
				'numbered' => 'yes',
				'symbol' => '*',
				'suptext' => ' ',
			], $atts
		);

		if ( ! $content ) {
			return '';
		}

		if ( ! isset( $this->footnotes[ $id ] ) ) {
			$this->footnotes[ $id ] = [];
			if ( 'no' === $a['numbered'] ) {
				$this->numbered[ $id ] = false;
			} else {
				$this->numbered[ $id ] = true;
			}
		}

		$this->footnotes[ $id ][] = $content;
		$footnotes = $this->footnotes[ $id ];
		$num = count( $footnotes );
		$numlabel = "$id-$num";

		$retval = '<a class="footnote" title="' . \Pressbooks\Sanitize\sanitize_xml_attribute( wp_strip_all_tags( $content ) ) . '" id="return-footnote-' . $numlabel . '" href="#footnote-' . $numlabel . '"><sup class="footnote">[';

		if ( $this->numbered[ $id ] ) {
			$retval .= $num;
		} else {
			$retval .= $a['symbol'];
		}

		if ( trim( $a['suptext'] ) ) {
			if ( $this->numbered[ $id ] ) {
				$retval .= '. ';
			}

			$retval .= $a['suptext'];
		}
		$retval .= ']</sup></a>';

		return $retval;
	}
function shortcodeHandler( $atts, $content = '' ) {

		global $id; // This is the Post ID, [@see WP_Query::setup_postdata, ...]

		$a = shortcode_atts(
			[
				'numbered' => 'yes',
				'symbol' => '*',
				'suptext' => ' ',
			], $atts
		);

		if ( ! $content ) {
			return '';
		}

		if ( ! isset( $this->footnotes[ $id ] ) ) {
			$this->footnotes[ $id ] = [];
			if ( 'no' === $a['numbered'] ) {
				$this->numbered[ $id ] = false;
			} else {
				$this->numbered[ $id ] = true;
			}
		}

		$this->footnotes[ $id ][] = $content;
		$footnotes = $this->footnotes[ $id ];
		$num = count( $footnotes );
		$numlabel = "$id-$num";

		$retval = '<a class="footnote" title="' . \Pressbooks\Sanitize\sanitize_xml_attribute( wp_strip_all_tags( $content ) ) . '" id="return-footnote-' . $numlabel . '" href="#footnote-' . $numlabel . '"><sup class="footnote">[';

		if ( $this->numbered[ $id ] ) {
			$retval .= $num;
		} else {
			$retval .= $a['symbol'];
		}

		if ( trim( $a['suptext'] ) ) {
			if ( $this->numbered[ $id ] ) {
				$retval .= '. ';
			}

			$retval .= $a['suptext'];
		}
		$retval .= ']</sup></a>';

		return $retval;
	}
function shortcodeHandler ( $ atts , $ content = '' ) { global $ id ; // This is the Post ID, [@see WP_Query::setup_postdata, ...] $ a = shortcode_atts ( [ 'numbered' => 'yes' , 'symbol' => '*' , 'suptext' => ' ' , ] , $ atts ) ; if ( ! $ content ) { return '' ; } if ( ! isset ( $ this -> footnotes [ $ id ] ) ) { $ this -> footnotes [ $ id ] = [ ] ; if ( 'no' === $ a [ 'numbered' ] ) { $ this -> numbered [ $ id ] = false ; } else { $ this -> numbered [ $ id ] = true ; } } $ this -> footnotes [ $ id ] [ ] = $ content ; $ footnotes = $ this -> footnotes [ $ id ] ; $ num = count ( $ footnotes ) ; $ numlabel = "$id-$num" ; $ retval = '<a class="footnote" title="' . \ Pressbooks \ Sanitize \ sanitize_xml_attribute ( wp_strip_all_tags ( $ content ) ) . '" id="return-footnote-' . $ numlabel . '" href="#footnote-' . $ numlabel . '"><sup class="footnote">[' ; if ( $ this -> numbered [ $ id ] ) { $ retval .= $ num ; } else { $ retval .= $ a [ 'symbol' ] ; } if ( trim ( $ a [ 'suptext' ] ) ) { if ( $ this -> numbered [ $ id ] ) { $ retval .= '. ' ; } $ retval .= $ a [ 'suptext' ] ; } $ retval .= ']</sup></a>' ; return $ retval ; }
Pre-process footnote shortcode

@param array $atts
@param string $content

@return string
Pre - process footnote shortcode