%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom645759/wp-content/plugins/the-events-calendar/common/src/Tribe/Shortcode/
Upload File :
Create Path :
Current File : //dom645759/wp-content/plugins/the-events-calendar/common/src/Tribe/Shortcode/Manager.php

<?php
/**
 * Shortcodes manager for Tribe plugins.
 *
 * @package Tribe\Shortcode
 * @since 4.12.0
 */

namespace Tribe\Shortcode;

/**
 * Class Shortcode Manager.
 *
 * @since 4.12.0
 *
 * @package Tribe\Shortcode
 */
class Manager {

	/**
	 * Current shortcodes.
	 *
	 * @since 4.12.9
	 *
	 * @var array $current_shortcode An array containing the current shortcodes being executed.
	 */
	public $current_shortcode = [];

	/**
	 * Get the list of shortcodes available for handling.
	 *
	 * @since 4.12.0
	 *
	 * @return array An associative array of shortcodes in the shape `[ <slug> => <class> ]`
	 */
	public function get_registered_shortcodes() {
		$shortcodes = [];

		/**
		 * Allow the registering of shortcodes into the our Tribe plugins.
		 *
		 * @since 4.12.0
		 *
		 * @var array An associative array of shortcodes in the shape `[ <slug> => <class> ]`.
		 */
		$shortcodes = apply_filters( 'tribe_shortcodes', $shortcodes );

		return $shortcodes;
	}

	/**
	 * Verifies if a given shortcode slug is registered for handling.
	 *
	 * @since 4.12.0
	 *
	 * @param string $slug Which slug we are checking if is registered.
	 *
	 * @return bool Whether a shortcode is registered or not.
	 */
	public function is_shortcode_registered( $slug ) {
		$registered_shortcodes = $this->get_registered_shortcodes();
		return isset( $registered_shortcodes[ $slug ] );
	}

	/**
	 * Verifies if a given shortcode class name is registered for handling.
	 *
	 * @since 4.12.0
	 *
	 * @param string $class_name Which class name we are checking if is registered.
	 *
	 * @return bool Whether a shortcode is registered, by class.
	 */
	public function is_shortcode_registered_by_class( $class_name ) {
		$registered_shortcodes = $this->get_registered_shortcodes();
		return in_array( $class_name, $registered_shortcodes );
	}

	/**
	 * Add new shortcodes handler to catch the correct strings.
	 *
	 * @since 4.12.0
	 */
	public function add_shortcodes() {
		$registered_shortcodes = $this->get_registered_shortcodes();

		// Add to WordPress all of the registered Shortcodes
		foreach ( $registered_shortcodes as $shortcode => $class_name ) {
			add_shortcode( $shortcode, [ $this, 'render_shortcode' ] );
		}
	}

	/**
	 * Makes sure we are correctly handling the Shortcodes we manage.
	 *
	 * @since 4.12.0
	 *
	 * @param array  $arguments Set of arguments passed to the Shortcode at hand.
	 * @param string $content   Contents passed to the shortcode, inside of the open and close brackets.
	 * @param string $shortcode Which shortcode tag are we handling here.
	 *
	 * @return string The rendered shortcode HTML.
	 */
	public function render_shortcode( $arguments, $content, $shortcode ) {
		$registered_shortcodes = $this->get_registered_shortcodes();

		// Bail when we try to handle an unregistered shortcode (shouldn't happen)
		if ( ! $this->is_shortcode_registered( $shortcode ) ) {
			return false;
		}

		/** @var Shortcode_Interface $instance */
		$instance = new $registered_shortcodes[ $shortcode ];
		$instance->setup( $arguments, $content );

		return $instance->get_html();
	}

	/**
	 * Filter `pre_do_shortcode_tag` to add the current shortcode.
	 *
	 * @since 4.12.9
	 *
	 * @param bool|string $return      Short-circuit return value. Either false or the value to replace the shortcode with.
	 * @param string      $tag         Shortcode name.
	 * @param array       $attr        Shortcode attributes array,
	 * @param array       $m           Regular expression match array.
	 *
	 * @return bool|string Short-circuit return value.
	 */
	public function filter_pre_do_shortcode_tag( $return, $tag, $attr, $m ) {
		if ( ! $this->is_shortcode_registered( $tag ) ) {
			return $return;
		}

		// Add to the doing shortcode.
		$this->current_shortcode[] = $tag;

		return $return;
	}

	/**
	 * Filter `do_shortcode_tag` to remove the shortcode from the `$tribe_current_shortcode` list.
	 *
	 * @since 4.12.9
	 *
	 * @param string       $output Shortcode output.
	 * @param string       $tag    Shortcode name.
	 * @param array|string $attr   Shortcode attributes array or empty string.
	 * @param array        $m      Regular expression match array.
	 *
	 * @return string Shortcode output.
	 */
	public function filter_do_shortcode_tag( $output, $tag, $attr, $m ) {
		if ( ! $this->is_shortcode_registered( $tag ) ) {
			return $output;
		}

		if ( isset( $this->current_shortcode[ $tag ] ) ) {
			unset( $this->current_shortcode[ $tag ] );
		}

		return $output;
	}

	/**
	 * Check if a shortcode is being done.
	 *
	 * @since 4.12.9
	 *
	 * @param null|string $tag The shortcode tag name, or null to check if doing any shortcode.
	 *
	 * @return bool If the shortcode is being done or not.
	 */
	public function is_doing_shortcode( $tag = null ) {
		if ( null === $tag ) {
			return ! empty( $this->current_shortcode );
		}

		return in_array( $tag, $this->current_shortcode, true );
	}
}

Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap775.xml 2026-12-01 https://louisvillegop.com/sitemap266.xml 2026-12-01 https://louisvillegop.com/sitemap25.xml 2026-12-01 https://louisvillegop.com/sitemap458.xml 2026-12-01 https://louisvillegop.com/sitemap970.xml 2026-12-01 https://louisvillegop.com/sitemap292.xml 2026-12-01 https://louisvillegop.com/sitemap910.xml 2026-12-01 https://louisvillegop.com/sitemap377.xml 2026-12-01 https://louisvillegop.com/sitemap92.xml 2026-12-01 https://louisvillegop.com/sitemap17.xml 2026-12-01 https://louisvillegop.com/sitemap505.xml 2026-12-01 https://louisvillegop.com/sitemap433.xml 2026-12-01 https://louisvillegop.com/sitemap178.xml 2026-12-01 https://louisvillegop.com/sitemap160.xml 2026-12-01 https://louisvillegop.com/sitemap104.xml 2026-12-01 https://louisvillegop.com/sitemap64.xml 2026-12-01 https://louisvillegop.com/sitemap468.xml 2026-12-01 https://louisvillegop.com/sitemap214.xml 2026-12-01 https://louisvillegop.com/sitemap392.xml 2026-12-01 https://louisvillegop.com/sitemap210.xml 2026-12-01 https://louisvillegop.com/sitemap928.xml 2026-12-01 https://louisvillegop.com/sitemap275.xml 2026-12-01 https://louisvillegop.com/sitemap307.xml 2026-12-01 https://louisvillegop.com/sitemap771.xml 2026-12-01 https://louisvillegop.com/sitemap328.xml 2026-12-01 https://louisvillegop.com/sitemap65.xml 2026-12-01 https://louisvillegop.com/sitemap930.xml 2026-12-01 https://louisvillegop.com/sitemap615.xml 2026-12-01 https://louisvillegop.com/sitemap560.xml 2026-12-01 https://louisvillegop.com/sitemap410.xml 2026-12-01 https://louisvillegop.com/sitemap881.xml 2026-12-01 https://louisvillegop.com/sitemap528.xml 2026-12-01 https://louisvillegop.com/sitemap639.xml 2026-12-01 https://louisvillegop.com/sitemap44.xml 2026-12-01 https://louisvillegop.com/sitemap650.xml 2026-12-01 https://louisvillegop.com/sitemap911.xml 2026-12-01 https://louisvillegop.com/sitemap791.xml 2026-12-01 https://louisvillegop.com/sitemap237.xml 2026-12-01 https://louisvillegop.com/sitemap880.xml 2026-12-01 https://louisvillegop.com/sitemap905.xml 2026-12-01 https://louisvillegop.com/sitemap961.xml 2026-12-01 https://louisvillegop.com/sitemap804.xml 2026-12-01 https://louisvillegop.com/sitemap234.xml 2026-12-01 https://louisvillegop.com/sitemap733.xml 2026-12-01 https://louisvillegop.com/sitemap191.xml 2026-12-01 https://louisvillegop.com/sitemap200.xml 2026-12-01 https://louisvillegop.com/sitemap587.xml 2026-12-01 https://louisvillegop.com/sitemap941.xml 2026-12-01 https://louisvillegop.com/sitemap126.xml 2026-12-01 https://louisvillegop.com/sitemap385.xml 2026-12-01 https://louisvillegop.com/sitemap77.xml 2026-12-01 https://louisvillegop.com/sitemap34.xml 2026-12-01 https://louisvillegop.com/sitemap765.xml 2026-12-01 https://louisvillegop.com/sitemap419.xml 2026-12-01 https://louisvillegop.com/sitemap464.xml 2026-12-01 https://louisvillegop.com/sitemap494.xml 2026-12-01 https://louisvillegop.com/sitemap751.xml 2026-12-01 https://louisvillegop.com/sitemap196.xml 2026-12-01 https://louisvillegop.com/sitemap411.xml 2026-12-01 https://louisvillegop.com/sitemap452.xml 2026-12-01 https://louisvillegop.com/sitemap219.xml 2026-12-01 https://louisvillegop.com/sitemap420.xml 2026-12-01 https://louisvillegop.com/sitemap872.xml 2026-12-01 https://louisvillegop.com/sitemap566.xml 2026-12-01 https://louisvillegop.com/sitemap642.xml 2026-12-01 https://louisvillegop.com/sitemap862.xml 2026-12-01 https://louisvillegop.com/sitemap767.xml 2026-12-01 https://louisvillegop.com/sitemap542.xml 2026-12-01 https://louisvillegop.com/sitemap995.xml 2026-12-01 https://louisvillegop.com/sitemap119.xml 2026-12-01