golden hour
/var/www/html/wp-content/plugins/the-events-calendar/common/src/Tribe
⬆️ Go Up
Upload
File/Folder
Size
Actions
Abstract_Deactivation.php
1.65 KB
Del
OK
Abstract_Plugin_Register.php
1.25 KB
Del
OK
Admin
-
Del
OK
Ajax
-
Del
OK
App_Shop.php
9.87 KB
Del
OK
Asset
-
Del
OK
Assets.php
24.69 KB
Del
OK
Assets_Pipeline.php
1.7 KB
Del
OK
Autoloader.php
8.31 KB
Del
OK
Cache.php
18.13 KB
Del
OK
Cache_Listener.php
5.92 KB
Del
OK
Changelog_Reader.php
1.5 KB
Del
OK
Container.php
11.36 KB
Del
OK
Context
-
Del
OK
Context.php
48.65 KB
Del
OK
Cost_Utils.php
16.44 KB
Del
OK
Credits.php
2.9 KB
Del
OK
Customizer
-
Del
OK
Customizer.php
25.29 KB
Del
OK
DB_Lock.php
10.04 KB
Del
OK
Data.php
5.21 KB
Del
OK
Date_Utils.php
48.59 KB
Del
OK
Db.php
876 B
Del
OK
Debug.php
1.54 KB
Del
OK
Debug_Bar
-
Del
OK
Dependency.php
16.47 KB
Del
OK
Deprecation.php
4.84 KB
Del
OK
Dialog
-
Del
OK
Documentation
-
Del
OK
Duplicate
-
Del
OK
Editor
-
Del
OK
Editor.php
6.58 KB
Del
OK
Error.php
4.51 KB
Del
OK
Exception.php
2.08 KB
Del
OK
Extension.php
13 KB
Del
OK
Extension_Loader.php
3.96 KB
Del
OK
Feature_Detection.php
7.51 KB
Del
OK
Field.php
22.38 KB
Del
OK
Field_Conditional.php
2.37 KB
Del
OK
Freemius.php
1.34 KB
Del
OK
Image
-
Del
OK
JSON_LD
-
Del
OK
Languages
-
Del
OK
Log
-
Del
OK
Log.php
11.33 KB
Del
OK
Main.php
23.13 KB
Del
OK
Meta
-
Del
OK
Models
-
Del
OK
Notices.php
1.49 KB
Del
OK
PUE
-
Del
OK
Plugin_Meta_Links.php
3.45 KB
Del
OK
Plugins.php
5.32 KB
Del
OK
Plugins_API.php
12.2 KB
Del
OK
Post_History.php
2.96 KB
Del
OK
Post_Transient.php
5.76 KB
Del
OK
Process
-
Del
OK
Promise.php
9.04 KB
Del
OK
Promoter
-
Del
OK
REST
-
Del
OK
Repository
-
Del
OK
Repository.php
100.06 KB
Del
OK
Rewrite.php
34.63 KB
Del
OK
Service_Providers
-
Del
OK
Settings.php
23.81 KB
Del
OK
Settings_Manager.php
9.78 KB
Del
OK
Settings_Tab.php
6.93 KB
Del
OK
Shortcode
-
Del
OK
Simple_Table.php
4.01 KB
Del
OK
Support
-
Del
OK
Support.php
14.43 KB
Del
OK
Tabbed_View
-
Del
OK
Tabbed_View.php
8.1 KB
Del
OK
Template.php
43.65 KB
Del
OK
Template_Factory.php
5.45 KB
Del
OK
Template_Part_Cache.php
2.74 KB
Del
OK
Templates.php
1.79 KB
Del
OK
Terms.php
1.51 KB
Del
OK
Timezones.php
18.21 KB
Del
OK
Tooltip
-
Del
OK
Tracker.php
12.51 KB
Del
OK
Traits
-
Del
OK
Updater.php
3.78 KB
Del
OK
Utils
-
Del
OK
Validate.php
16.54 KB
Del
OK
Validator
-
Del
OK
View_Helpers.php
9.64 KB
Del
OK
Widget
-
Del
OK
Edit: Settings_Manager.php
<?php class Tribe__Settings_Manager { const OPTION_CACHE_VAR_NAME = 'Tribe__Settings_Manager:option_cache'; protected static $network_options; public static $tribe_events_mu_defaults; /** * constructor */ public function __construct() { $this->add_hooks(); // Load multisite defaults if ( is_multisite() ) { $tribe_events_mu_defaults = []; if ( file_exists( WP_CONTENT_DIR . '/tribe-events-mu-defaults.php' ) ) { require_once WP_CONTENT_DIR . '/tribe-events-mu-defaults.php'; } self::$tribe_events_mu_defaults = apply_filters( 'tribe_events_mu_defaults', $tribe_events_mu_defaults ); } } public function add_hooks() { // option pages add_action( '_network_admin_menu', [ $this, 'init_options' ] ); add_action( '_admin_menu', [ $this, 'init_options' ] ); add_action( 'admin_menu', [ $this, 'add_help_admin_menu_item' ], 50 ); add_action( 'tribe_settings_do_tabs', [ $this, 'do_setting_tabs' ] ); add_action( 'tribe_settings_do_tabs', [ $this, 'do_network_settings_tab' ], 400 ); add_action( 'tribe_settings_validate_tab_network', [ $this, 'save_all_tabs_hidden' ] ); add_action( 'updated_option', [ $this, 'update_options_cache' ], 10, 3 ); } /** * For performance reasons our options are saved in memory, but we need to make sure we update it when WordPress * updates the variable directly. * * @since 4.11.0 * * @param string $option Name of the updated option. * @param mixed $old_value The old option value. * @param mixed $value The new option value. * * @return void */ public function update_options_cache( $option, $old_value, $value ) { // Bail when no our option. if ( Tribe__Main::OPTIONNAME !== $option ) { return; } tribe_set_var( self::OPTION_CACHE_VAR_NAME, $value ); } /** * Init the settings API and add a hook to add your own setting tabs * * @return void */ public function init_options() { Tribe__Settings::instance(); } /** * Create setting tabs * * @return void */ public function do_setting_tabs() { // Make sure Thickbox is available regardless of which admin page we're on add_thickbox(); include_once Tribe__Main::instance()->plugin_path . 'src/admin-views/tribe-options-general.php'; include_once Tribe__Main::instance()->plugin_path . 'src/admin-views/tribe-options-display.php'; $showNetworkTabs = $this->get_network_option( 'showSettingsTabs', false ); new Tribe__Settings_Tab( 'general', esc_html__( 'General', 'tribe-common' ), $generalTab ); new Tribe__Settings_Tab( 'display', esc_html__( 'Display', 'tribe-common' ), $displayTab ); $this->do_licenses_tab(); } /** * Get all options for the Events Calendar * * @return array of options */ public static function get_options() { $options = tribe_get_var( self::OPTION_CACHE_VAR_NAME, [] ); if ( empty( $options ) ) { $options = (array) get_option( Tribe__Main::OPTIONNAME, [] ); tribe_set_var( self::OPTION_CACHE_VAR_NAME, $options ); } return $options; } /** * Get value for a specific option * * @param string $option_name name of option * @param string $default default value * * @return mixed results of option query */ public static function get_option( $option_name, $default = '' ) { if ( ! $option_name ) { return null; } $options = static::get_options(); $option = $default; if ( array_key_exists( $option_name, $options ) ) { $option = $options[ $option_name ]; } elseif ( is_multisite() && isset( self::$tribe_events_mu_defaults ) && is_array( self::$tribe_events_mu_defaults ) && in_array( $option_name, array_keys( self::$tribe_events_mu_defaults ) ) ) { $option = self::$tribe_events_mu_defaults[ $option_name ]; } return apply_filters( 'tribe_get_single_option', $option, $default, $option_name ); } /** * Saves the options for the plugin * * @param array $options formatted the same as from get_options() * @param bool $apply_filters * * @return bool */ public static function set_options( $options, $apply_filters = true ) { if ( ! is_array( $options ) ) { return false; } if ( true === $apply_filters ) { $options = apply_filters( 'tribe-events-save-options', $options ); } $updated = update_option( Tribe__Main::OPTIONNAME, $options ); if ( $updated ) { tribe_set_var( self::OPTION_CACHE_VAR_NAME, $options ); } return $updated; } /** * Set an option * * @param string $name * @param mixed $value * * @return bool */ public static function set_option( $name, $value ) { $options = self::get_options(); $options[ $name ] = $value; return self::set_options( $options ); } /** * Get all network options for the Events Calendar * * @return array of options * @TODO add force option, implement in setNetworkOptions */ public static function get_network_options() { if ( ! isset( self::$network_options ) ) { $options = get_site_option( Tribe__Main::OPTIONNAMENETWORK, [] ); self::$network_options = apply_filters( 'tribe_get_network_options', $options ); } return self::$network_options; } /** * Get value for a specific network option * * @param string $option_name name of option * @param string $default default value * * @return mixed results of option query */ public static function get_network_option( $option_name, $default = '' ) { if ( ! $option_name ) { return null; } if ( ! isset( self::$network_options ) ) { self::get_network_options(); } if ( isset( self::$network_options[ $option_name ] ) ) { $option = self::$network_options[ $option_name ]; } else { $option = $default; } return apply_filters( 'tribe_get_single_network_option', $option, $default ); } /** * Saves the network options for the plugin * * @param array $options formatted the same as from get_options() * @param bool $apply_filters * * @return void */ public static function set_network_options( $options, $apply_filters = true ) { if ( ! is_array( $options ) ) { return; } if ( $apply_filters == true ) { $options = apply_filters( 'tribe-events-save-network-options', $options ); } if ( update_site_option( Tribe__Main::OPTIONNAMENETWORK, $options ) ) { self::$network_options = apply_filters( 'tribe_get_network_options', $options ); } else { self::$network_options = self::get_network_options(); } } /** * Add the network admin options page * * @return void */ public static function add_network_options_page() { $tribe_settings = Tribe__Settings::instance(); add_submenu_page( 'settings.php', $tribe_settings->menuName, $tribe_settings->menuName, 'manage_network_options', 'tribe-common', [ $tribe_settings, 'generatePage', ] ); } /** * Render network admin options view * * @return void */ public static function do_network_settings_tab() { include_once Tribe__Main::instance()->plugin_path . 'src/admin-views/tribe-options-network.php'; new Tribe__Settings_Tab( 'network', esc_html__( 'Network', 'tribe-common' ), $networkTab ); } /** * Registers the license key management tab in the Events > Settings screen, * only if premium addons are detected. */ protected function do_licenses_tab() { $show_tab = ( current_user_can( 'activate_plugins' ) && $this->have_addons() ); /** * Provides an oppotunity to override the decision to show or hide the licenses tab * * Normally it will only show if the current user has the "activate_plugins" capability * and there are some currently-activated premium plugins. * * @var bool */ if ( ! apply_filters( 'tribe_events_show_licenses_tab', $show_tab ) ) { return; } /** * @var $licenses_tab */ include Tribe__Main::instance()->plugin_path . 'src/admin-views/tribe-options-licenses.php'; /** * Allows the fields displayed in the licenses tab to be modified. * * @var array */ $license_fields = apply_filters( 'tribe_license_fields', $licenses_tab ); new Tribe__Settings_Tab( 'licenses', esc_html__( 'Licenses', 'tribe-common' ), [ 'priority' => '40', 'fields' => $license_fields, 'network_admin' => is_network_admin() ? true : false, ] ); } /** * Create the help tab */ public function do_help_tab() { /** * Include Help tab Assets here */ include_once Tribe__Main::instance()->plugin_path . 'src/admin-views/help.php'; } /** * Add help menu item to the admin (unless blocked via network admin settings). * * @todo move to an admin class */ public function add_help_admin_menu_item() { $hidden_settings_tabs = self::get_network_option( 'hideSettingsTabs', [] ); if ( in_array( 'help', $hidden_settings_tabs ) ) { return; } $parent = class_exists( 'Tribe__Events__Main' ) ? Tribe__Settings::$parent_page : Tribe__Settings::$parent_slug; $title = esc_html__( 'Help', 'tribe-common' ); $slug = 'tribe-help'; add_submenu_page( $parent, $title, $title, 'manage_options', $slug, [ $this, 'do_help_tab' ] ); } /** * Tries to discover if licensable addons are activated on the same site. * * @return bool */ protected function have_addons() { $addons = apply_filters( 'tribe_licensable_addons', [] ); return ! empty( $addons ); } /** * Save hidden tabs * * @return void */ public function save_all_tabs_hidden() { $all_tabs_keys = array_keys( apply_filters( 'tribe_settings_all_tabs', [] ) ); $network_options = (array) get_site_option( Tribe__Main::OPTIONNAMENETWORK ); if ( isset( $_POST['hideSettingsTabs'] ) && $_POST['hideSettingsTabs'] == $all_tabs_keys ) { $network_options['allSettingsTabsHidden'] = '1'; } else { $network_options['allSettingsTabsHidden'] = '0'; } $this->set_network_options( $network_options ); } /** * Static Singleton Factory Method * * @return Tribe__Settings_Manager */ public static function instance() { return tribe( 'settings.manager' ); } }
Save