HEX
Server: LiteSpeed
System: Linux 111n6.sieutocviet.page 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User: nhathuocat (1048)
PHP: 7.4.30
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/nhathuocat/public_html/wp-content/plugins/fixed-toc/frontend/features/class-shortcode.php
<?php

/**
 * Add shortcode feature.
 *
 * @since 3.1.0
 */
class Fixedtoc_Shortcode {

	/**
	 * An object of TOC.
	 *
	 * @since 3.1.0
	 * @access private
	 *
	 * @var object
	 */
	private $obj_toc;

	/**
	 * Indicate if the shortcode has executed once.
	 *
	 * @since 3.1.0
	 * @access private
	 *
	 * @var boolean
	 */
//	private static $shortcoded_once = false;

	/**
	 * Constructor
	 *
	 * @since 3.1.0
	 * @access public
	 *
	 * @param Fixedtoc_Dom $obj_toc
	 */
	public function __construct( Fixedtoc_Dom $obj_toc ) {
		$this->obj_toc = $obj_toc;

		add_shortcode( 'toc', array( $this, 'to_toc' ) );
	}

	/**
	 * A callback function of the [toc] shortcode.
	 *
	 * @since 3.1.0
	 * @access public
	 *
	 * @param array $attrs
	 * @param string $content
	 * @param string $tag
	 *
	 * @return string
	 *
	 * @noinspection PhpUnusedParameterInspection
	 */
	public function to_toc( $attrs, $content, $tag ) {
//		if ( ! self::$shortcoded_once ) {
//			self::$shortcoded_once = true;
//
//			return $this->obj_toc->get_html();
//		}
//
//		return '';
		return $this->obj_toc->get_html();
	}

}