diff --git a/includes/activity/class-event.php b/includes/activity/class-event.php new file mode 100644 index 0000000..b22af97 --- /dev/null +++ b/includes/activity/class-event.php @@ -0,0 +1,23 @@ + true], 'names' ); } /** diff --git a/includes/class-admin.php b/includes/class-admin.php index 866a8f7..cdf0a8c 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -25,7 +25,7 @@ class Admin { } add_filter( 'activitypub/transformers/is_transformer_enabled', function( $should_register, Transformer_Base $widget_instance ) { - return ! Options::is_element_disabled( $widget_instance->get_name() ); + return ! Options::is_transformer_disabled( $transformer_instance->get_name() ); }, 10, 2 ); } diff --git a/includes/managers/class-transformers-manager.php b/includes/managers/class-transformers-manager.php index 2d3721a..983e95a 100644 --- a/includes/managers/class-transformers-manager.php +++ b/includes/managers/class-transformers-manager.php @@ -7,6 +7,8 @@ namespace ActivityPub; +use function Activitypub\camel_to_snake_case; + if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } @@ -128,21 +130,44 @@ class Transformers_Manager { } /** - * Register controls. + * Init transformers. * - * This method creates a list of all the supported controls by requiring the - * control files and initializing each one of them. + * Initialize ActivityPub transformer manager. + * + * Include the builtin transformers by default and add third party ones. * - * The list of supported controls includes the regular controls and the group - * controls. - * - * External developers can register new controls by hooking to the - * `elementor/controls/controls_registered` action. - * - * @since 3.1.0 + * @since version_number_transformer_management_placeholder * @access private - */ - private function register_controls() { + */ + private function init_transformers() { + $builtin_transformers = [ + 'post' + ]; + + $this->_transformers = []; + + foreach ( $builtin_transformers as $transformer_name ) { + include ACTIVITYPUB_PLUGIN_DIR . 'includes/transformers/class-' . $transformer_name . '.php'; + + $class_name = camel_to_snake_case( $transformer_name ); + + $class_name = __NAMESPACE__ . '\Transformer_' . $class_name; + + $this->register( new $class_name() ); + } + + /** + * After the transformers are registered. + * + * Fires after the built-in Actiitypub transformers are registered. + * + * @since version_number_transformer_management_placeholder + * + * @param Transformer_Manager $this The widgets manager. + */ + do_action( 'activitypub/transformers/register', $this ); } -} \ No newline at end of file + +} +