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Dx3tDtDtDp^D_error', $e ); } return true; } /** * Returns whether the Custom Tables implementation should register, thus activate, * or not. * * @since 6.0.0 * * @return bool Whether the Custom Tables implementation should register or not. */ public static function is_active() { if ( defined( self::DISABLED ) && constant( self::DISABLED ) ) { // The disable constant is defined and it's truthy. return false; } if ( getenv( self::DISABLED ) ) { // The disable env var is defined and it's truthy. return false; } // Finally read an option value to determine if the feature should be active or not. $active = (bool) get_option( 'tec_custom_tables_v1_active', true ); /** * Allows filtering whether the whole Custom Tables v1 implementation * should be activated or not. * * Note: this filter will only apply if the disable constant or env var * are not set or are set to falsy values. * * @since 6.0.0 * * @param bool $activate Defaults to `true`. */ return (bool) apply_filters( 'tec_events_custom_tables_v1_enabled', $active ); } /** * Binds the implementations that will be required to run the Provider-level * code. * * @since 6.0.0 */ private function bind_implementations() { // Register this provider to make it easy to get hold of it. $this->container->singleton( 'tec.custom-tables.v1.provider', $this ); $this->container->singleton( self::class ); $this->container->singleton( Notices::class ); } /** * Hooks to the Filters API some general-purpose, high-level, code. * * Each action listed here can be removed by calling the provider * `unhook` method. * * @since 6.0.0 */ private function add_filters() { $on_error = $this->container->callback( Notices::class, 'on_error' ); add_action( 'tec_custom_tables_v1_error', $on_error ); $this->added_filters['tec_custom_tables_v1_error'] = [ $on_error, 10 ]; // If the plugin has been silently activated, then init it now. add_action( 'init', [ Activation::class, 'init' ] ); add_filter( 'tec_system_information', [ Activation::class, 'filter_include_migration_in_system_info' ] ); } /** * Removes all the actions and filters registered by the Provider, or * only the specified one. * * @since 6.0.0 * * @param string|null $filter Removes a filter or action hooked by * the provider, if any. * * @return int The number of removed filters. */ public function unhook( $filter = null ) { if ( null !== $filter ) { if ( isset( $this->added_filters[ $filter ] ) ) { remove_filter( $filter, ...$this->added_filters[ $filter ] ); } return 1; } $removed = 0; foreach ( $this->added_filters as $tag => list( $callback, $priority ) ) { remove_filter( $tag, $callback, $priority ); $removed ++; } return $removed; } /** * Logs the error. * * @since 6.1.3 * * @param \Throwable $error The error to log. */ public function log_errors( $error ): void { if ( ! $error instanceof \Throwable ) { return; } do_action( 'tribe_log', 'error', 'Caught Custom Tables V1 activation error.', [ 'message' => $error->getMessage(), 'file' => $error->getFile(), 'line' => $error->getLine(), ] ); } }