tribe( string|null $slug_or_class = null )
Returns a ready to use instance of the requested class.
Example use:
tribe_singleton( 'common.main', 'Tribe__Main');
// some code later...
tribe( 'common.main' )->do_something();
Parameters
- $slug_or_class
-
(string|null) (Optional) Either the slug of a binding previously registered using
tribe_singleton
ortribe_register
or the full class name that should be automagically created ornull
to get the container instance itself.Default value: null
Return
(mixed|object|Tribe__Container) The instance of the requested class. Please note that the cardinality of the class is controlled registering it as a singleton using tribe_singleton
or tribe_register
; if the $slug_or_class
parameter is null then the container itself will be returned.
Source
File: src/Tribe/Container.php
function tribe( $slug_or_class = null ) { $container = Tribe__Container::init(); return null === $slug_or_class ? $container : $container->make( $slug_or_class ); }
Related
Uses
Uses | Description |
---|---|
src/Tribe/Container.php: Tribe__Container::init() |
Used By
Used By | Description |
---|---|
src/functions/transient.php: tec_timed_option() |
Checks if a file is from one of the specified plugins. |
src/Tribe/Field.php: Tribe__Field::color() |
Generate a color field. |
src/Tribe/Field.php: Tribe__Field::image() |
Generate an image field. |
src/Tribe/Log/Admin.php: Tribe__Log__Admin::should_enqueue_assets() |
Checks wether the assets should be enqueued. |
src/Tribe/Settings.php: Tribe__Settings::get_tab_url() |
Generate the URL for a tab. |
src/Tribe/Settings.php: Tribe__Settings::get_settings_page_url() |
Get the current settings page URL |
src/Tribe/Editor/Compatibility.php: Compatibility::register() | |
src/Tribe/Editor/Compatibility/Divi.php: Divi::is_divi_active() | |
src/Tribe/Onboarding/Hints_Abstract.php: Hints_Abstract::should_display() |
Should the hints display. |
src/Tribe/Onboarding/Tour_Abstract.php: Tour_Abstract::should_display() |
Should the tour display. |
src/functions/template-tags/general.php: tribe_doing_shortcode() |
Check whether a specific shortcode is being run. |
src/functions/utils.php: tribe_get_next_cached_increment() |
Get the next increment of a cached incremental value. |
src/Tribe/Admin/Notice/Date_Based.php: Date_Based::__construct() | |
src/Tribe/Admin/Notice/Service_Provider.php: Service_Provider::plugins_loaded() |
Setup for things that require plugins loaded first. |
src/Tribe/Utils/Theme_Compatibility.php: Theme_Compatibility::add_compatibility_classes() |
Add compatibility classes. |
src/Tribe/Cache.php: Tribe__Cache::data_size_over_packet_size() |
If NOT using an external object caching system, then check if the size, in bytes, of the data to write to the database would fit into the |
src/Tribe/Cache.php: Tribe__Cache::set_chunkable_transient() |
Sets a transient in the database with the knowledge that, if too large to be stored in one DB row, it will be chunked. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::get_rgb_color() |
Utility function for when we need a color in RGB format, since the Customizer always works with hex. Keepin’ it DRY. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::get_setting_link() |
Sugar function that returns the results of Tribe__Customizer->get_settings_url() for the specified setting in the _current section_. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::get_section_link() |
Sugar function that returns the results of Tribe__Customizer->get_section_link() for the current section. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::get_setting_url() |
Sugar function that returns the results of Tribe__Customizer->get_settings_url() for the specified setting in the _current section_. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::get_section_url() |
Sugar function that returns the results of Tribe__Customizer->get_section_url() for the current section. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::get_option() |
Function to simplify getting an option value. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::should_include_setting_css() |
Function that encapsulates the logic for if a setting should be added to the Customizer style template. |
src/functions/template-tags/general.php: tribe_asset_print_group() |
Prints the |
src/Tribe/Service_Providers/Body_Classes.php: Body_Classes::add_body_classes() |
Hook in and add FE body classes. |
src/Tribe/Service_Providers/Body_Classes.php: Body_Classes::add_admin_body_classes() |
Hook in and add admin body classes. |
src/functions/template-tags/general.php: tribe_cache() |
Returns the current Tribe Cache instance. |
src/Tribe/Feature_Detection.php: Tribe__Feature_Detection::get_mysql_max_packet_size() |
Returns the value of the |
src/Tribe/Cache.php: Tribe__Cache::warmup_post_caches() |
Warms up the caches for a collection of posts. |
src/functions/utils.php: tribe_get_class_instance() |
Gets the class instance / Tribe Container from the passed object or string. |
src/Tribe/Dialog/View.php: View::render_dialog() |
Public wrapper for build method. |
src/Tribe/Tooltip/View.php: View::render_tooltip() |
Public wrapper for build method |
src/Tribe/Service_Providers/Promoter.php: Tribe__Service_Providers__Promoter::add_promoter_logo_on_admin_bar() |
Add Admin Bar link to the promoter website |
src/Tribe/Service_Providers/Promoter.php: Tribe__Service_Providers__Promoter::should_load_promoter_styles() |
Only load the styles related to promoter if user is logged in and there’s a valid license for promoter |
src/Tribe/Log/Action_Logger.php: Action_Logger::use_log() |
Changes the Monolog logger channel to the specified one. |
src/Tribe/Log/Monolog_Logger.php: Monolog_Logger::set_global_channel() |
Clones this logger and replaces it in the |
src/functions/template-tags/general.php: tribe_context() |
A wrapper function to get the singleton, immutable, global context object. |
src/Tribe/Promise.php: Tribe__Promise::error_handler() |
A custom error handler to log any error tha might happen while invoking a promise callback. |
src/Tribe/PUE/Notices.php: Tribe__PUE__Notices::get_formatted_plugin_names_from_classes() |
Transforms a list of plugins into human readable string. |
src/Tribe/PUE/Update_Prevention.php: Update_Prevention::filter_upgrader_source_selection() |
Filters the source file location for the upgrade package for the PUE Update_Prevention engine. |
src/Tribe/Timezones.php: Tribe__Timezones::build_timezone_object() |
Returns a valid timezone object built from the passed timezone or from the site one if a timezone in not passed. |
src/functions/template-tags/general.php: tribe_asset_enqueue_group() |
Shortcut for Tribe__Assets::enqueue_group() include assets by groups. |
src/functions/template-tags/general.php: tribe_asset() |
Shortcut for Tribe__Assets::register(), include a single asset |
src/functions/template-tags/general.php: tribe_asset_enqueue() |
Shortcut for Tribe__Assets::enqueue() to include assets. |
src/functions/utils.php: tribe_register_plugin() |
Checks if this plugin has permission to run, if not it notifies the admin |
src/Tribe/Editor/Configuration.php: Tribe__Editor__Configuration::localize() |
Localize variables that are part of common |
src/Tribe/Editor/Provider.php: Tribe__Editor__Provider::register() |
Binds and sets up implementations. |
src/Tribe/Duplicate/Post.php: Tribe__Duplicate__Post::__construct() |
Tribe__Duplicate__Post constructor. |
src/Tribe/Process/Queue.php: Tribe__Process__Queue::dispatch() |
Overrides the base |
src/Tribe/Process/Queue.php: Tribe__Process__Queue::__construct() |
Tribe__Process__Queue constructor. |
src/Tribe/Process/Handler.php: Tribe__Process__Handler::dispatch() |
Overrides the base |
src/Tribe/Process/Handler.php: Tribe__Process__Handler::__construct() |
Tribe__Process__Handler constructor. |
src/Tribe/Service_Providers/Processes.php: Tribe__Service_Providers__Processes::register() |
Hooks the filters and binds the implementations needed to handle processes. |
src/Tribe/Main.php: Tribe__Main::init_libraries() |
initializes all required libraries |
src/Tribe/Main.php: Tribe__Main::load_localize_data() |
Load All localization data create by |
src/Tribe/Admin/Helpers.php: Tribe__Admin__Helpers::is_action() |
Matcher for administration pages action |
src/Tribe/Admin/Helpers.php: Tribe__Admin__Helpers::is_post_type_screen() |
Matcher for Admin Pages related to Post Types |
src/Tribe/Admin/Helpers.php: Tribe__Admin__Helpers::is_screen() |
Matcher for administration pages that are from Tribe the easier way |
src/Tribe/Admin/Help_Page.php: Tribe__Admin__Help_Page::get_addons() |
Get the Addons |
src/Tribe/Admin/Help_Page.php: Tribe__Admin__Help_Page::instance() |
Static Singleton Factory Method |
src/Tribe/Feature_Detection.php: Tribe__Feature_Detection::supports_async_process() |
Checks whether async, AJAX-based, background processing is supported or not. |
src/Tribe/Languages/Locations.php: Tribe__Languages__Locations::get_us_states() |
Returns an array of countries and their codes. |
src/Tribe/Languages/Locations.php: Tribe__Languages__Locations::get_countries() |
Returns an array of countries and their codes. |
src/Tribe/Post_Transient.php: Tribe__Post_Transient::instance() |
Get (and instantiate, if necessary) the instance of the class |
src/Tribe/Plugins_API.php: Tribe__Plugins_API::instance() |
Static Singleton Factory Method |
src/Tribe/Plugins_API.php: Tribe__Plugins_API::get_products() |
Get product info |
src/Tribe/Dependency.php: Tribe__Dependency::register_plugin() |
Register a Plugin |
src/Tribe/Dependency.php: Tribe__Dependency::has_valid_dependencies() |
Gets all dependencies or single class requirements if parent, co, add does not exist use array as is if they do exist check each one in turn. |
src/Tribe/Meta/Chunker.php: Tribe__Meta__Chunker::get_max_chunk_size() |
Returns the max chunk size in bytes. |
src/Tribe/View_Helpers.php: Tribe__View_Helpers::loadStates() |
Get the i18ned states available to the plugin. |
src/Tribe/View_Helpers.php: Tribe__View_Helpers::constructCountries() |
Get the countries being used and available for the plugin. |
src/Tribe/Timezones.php: Tribe__Timezones::wp_timezone_string() |
Returns the current site-wide timezone string. |
src/Tribe/Settings_Manager.php: Tribe__Settings_Manager::instance() |
Static Singleton Factory Method |
src/Tribe/Settings_Manager.php: Tribe__Settings_Manager::set_network_options() |
Saves the network options for the plugin |
src/Tribe/Promoter/Connector.php: Tribe__Promoter__Connector::notify_promoter_of_changes() |
Notify the Promoter app of changes within this system. |
src/Tribe/Promoter/View.php: Tribe__Promoter__View::display_auth_check_view() |
Display the auth check page when the correct permalink is loaded. |
src/Tribe/Settings.php: Tribe__Settings::validate() |
validate the settings |
src/Tribe/Settings.php: Tribe__Settings::save() |
Save the settings. |
src/Tribe/Settings.php: Tribe__Settings::initTabs() |
Init all the tabs. |
src/Tribe/Settings.php: Tribe__Settings::generatePage() |
Generate the main option page. |
src/Tribe/Settings.php: Tribe__Settings::instance() |
Static Singleton Factory Method. |
src/Tribe/Assets.php: Tribe__Assets::instance() |
Static Singleton Factory Method. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::__construct() |
Setup and Load hooks for this Section. |
src/Tribe/Customizer/Section.php: Tribe__Customizer__Section::register_settings() |
Overwrite this method to create the Fields/Settings for this section. |
src/Tribe/Main.php: Tribe__Main::tribe_plugins_loaded() |
Runs tribe_plugins_loaded action, should be hooked to the end of plugins_loaded |
src/Tribe/Main.php: Tribe__Main::load_assets() |
Registers resources that can/should be enqueued |