= count( self::$usedSC ) ) { return false; } foreach ( $shortcodes as $shortcode ) { if ( array_search( $shortcode, self::$usdeSC ) ) { return true; } } return false; } /** * Check if shortcode is used * @param string[] $shortcodes * @return bool */ public function didShortcode( $shortcode ) { if ( is_array( self::$usedSC ) && 0 >= count( self::$usedSC ) ) return false; if ( array_search( $shortcode, self::$usdeSC ) ) return true; return false; } /** * Init **/ /** * Public Initializer **/ public static function getInstance() { if ( null === self::$instance ) self::$instance = new Self(); return self::$instance; } /** * Constructor **/ protected function __construct() { $this->initVars(); $this->initHooks(); } protected function initVars() { add_action( ace()->getPrefixedActionHook( 'init_shortcodes' ) ); } protected function initHooks() { add_filter( 'do_shortcode_tag', array( $this, 'registerUsedSC' ), 1, 3 ); } public function registerUsedSC( $output, $tag, $attr = array() ) { $this->addUsedShortcode( $tag ); return $output; } }