Esempio n. 1
0
        public void Compose(IUmbracoBuilder builder)
        {
            builder.Dashboards().Add <RedirectDashboard>();
            builder.Components().Append <DatabaseUpgradeComponent>();

            builder.Services.AddUnique <RedirectRepository>();
            builder.Services.AddUnique <ICacheManager, CacheManager>();

            builder.Services.Configure <SimpleRedirectsOptions>(builder.Config.GetSection(
                                                                    SimpleRedirectsOptions.Position));
            var onlyRedirectOn404 = builder.Config.GetSection(SimpleRedirectsOptions.Position)?.Get <SimpleRedirectsOptions>()?.OnlyRedirectOn404 ?? false;

            builder.Services.Configure <UmbracoPipelineOptions>(options => {
                options.AddFilter(new UmbracoPipelineFilter(
                                      "SimpleRedirects",
                                      applicationBuilder =>
                {
                    if (!onlyRedirectOn404)
                    {
                        applicationBuilder.UseMiddleware <SimpleRedirectsMiddleware>();
                    }
                },
                                      applicationBuilder => {
                    if (onlyRedirectOn404)
                    {
                        applicationBuilder.UseMiddleware <SimpleRedirectsMiddleware>();
                    }
                },
                                      applicationBuilder => { }
                                      ));
            });
        }
Esempio n. 2
0
        public static IUmbracoBuilder AddVendrReviews(this IUmbracoBuilder builder, Action <VendrReviewsSettings> defaultOptions = default)
        {
            // Register configuration
            var options = builder.Services.AddOptions <VendrReviewsSettings>()
                          .Bind(builder.Config.GetSection(Constants.System.ProductName));

            if (defaultOptions != default)
            {
                options.Configure(defaultOptions);
            }

            options.ValidateDataAnnotations();

            // Register services
            builder.Services.AddTransient <IReviewRepositoryFactory, ReviewRepositoryFactory>();
            builder.Services.AddSingleton <IReviewService, ReviewService>();
            builder.Services.AddSingleton <VendrReviewsApi>();

            // Register event handlers
#if NET
            builder.AddNotificationHandler <TreeNodesRenderingNotification, ReviewsTreeNodesNotification>();
#endif
            builder.AddVendrReviewsEventHandlers();

            // Register component
            builder.Components()
            .Append <VendrReviewsComponent>();

            return(builder);
        }
        public void Compose(IUmbracoBuilder builder)
        {
            builder.MapDefinitions().Add <MemberListItemMapDefinition>();

            builder.Components().Append <MemberIndexingComponent>();
            builder.AddNotificationHandler <ServerVariablesParsingNotification, ServerVariablesParsingHandler>();

            builder.Services.AddUnique <IMemberExtendedService, MemberExtendedService>();

            // Extend the Member Index fieldset.
            builder.Services.ConfigureOptions <ConfigureMemberIndexOptions>();
        }
 /// <inheritdoc />
 public virtual void Compose(IUmbracoBuilder builder)
 {
     builder.Components().Append <TComponent>();
 }
Esempio n. 5
0
        /// <summary>
        /// Adds all core collection builders
        /// </summary>
        internal static void AddAllCoreCollectionBuilders(this IUmbracoBuilder builder)
        {
            builder.CacheRefreshers()?.Add(() => builder.TypeLoader.GetCacheRefreshers());
            builder.DataEditors()?.Add(() => builder.TypeLoader.GetDataEditors());
            builder.Actions()?.Add(() => builder.TypeLoader.GetActions());

            // register known content apps
            builder.ContentApps()?
            .Append <ListViewContentAppFactory>()
            .Append <ContentEditorContentAppFactory>()
            .Append <ContentInfoContentAppFactory>()
            .Append <ContentTypeDesignContentAppFactory>()
            .Append <ContentTypeListViewContentAppFactory>()
            .Append <ContentTypePermissionsContentAppFactory>()
            .Append <ContentTypeTemplatesContentAppFactory>()
            .Append <MemberEditorContentAppFactory>()
            .Append <DictionaryContentAppFactory>();

            // all built-in finders in the correct order,
            // devs can then modify this list on application startup
            builder.ContentFinders()?
            .Append <ContentFinderByPageIdQuery>()
            .Append <ContentFinderByUrl>()
            .Append <ContentFinderByIdPath>()
            /*.Append<ContentFinderByUrlAndTemplate>() // disabled, this is an odd finder */
            .Append <ContentFinderByUrlAlias>()
            .Append <ContentFinderByRedirectUrl>();
            builder.EditorValidators()?.Add(() => builder.TypeLoader.GetTypes <IEditorValidator>());
            builder.HealthChecks()?.Add(() => builder.TypeLoader.GetTypes <HealthCheck>());
            builder.HealthCheckNotificationMethods()?.Add(() => builder.TypeLoader.GetTypes <IHealthCheckNotificationMethod>());
            builder.TourFilters();
            builder.UrlProviders()?
            .Append <AliasUrlProvider>()
            .Append <DefaultUrlProvider>();
            builder.MediaUrlProviders()?
            .Append <DefaultMediaUrlProvider>();
            // register back office sections in the order we want them rendered
            builder.Sections()?
            .Append <ContentSection>()
            .Append <MediaSection>()
            .Append <SettingsSection>()
            .Append <PackagesSection>()
            .Append <UsersSection>()
            .Append <MembersSection>()
            .Append <FormsSection>()
            .Append <TranslationSection>();
            builder.Components();
            // register core CMS dashboards and 3rd party types - will be ordered by weight attribute & merged with package.manifest dashboards
            builder.Dashboards()?
            .Add <ContentDashboard>()
            .Add <ExamineDashboard>()
            .Add <FormsDashboard>()
            .Add <HealthCheckDashboard>()
            .Add <ManifestDashboard>()
            .Add <MediaDashboard>()
            .Add <MembersDashboard>()
            .Add <ProfilerDashboard>()
            .Add <PublishedStatusDashboard>()
            .Add <RedirectUrlDashboard>()
            .Add <SettingsDashboard>()
            .Add(builder.TypeLoader.GetTypes <IDashboard>());
            builder.DataValueReferenceFactories();
            builder.PropertyValueConverters()?.Append(builder.TypeLoader.GetTypes <IPropertyValueConverter>());
            builder.UrlSegmentProviders()?.Append <DefaultUrlSegmentProvider>();
            builder.ManifestValueValidators()?
            .Add <RequiredValidator>()
            .Add <RegexValidator>()
            .Add <DelimitedValueValidator>()
            .Add <EmailValidator>()
            .Add <IntegerValidator>()
            .Add <DecimalValidator>();
            builder.ManifestFilters();
            builder.MediaUrlGenerators();
            // register OEmbed providers - no type scanning - all explicit opt-in of adding types, IEmbedProvider is not IDiscoverable
            builder.EmbedProviders()?
            .Append <YouTube>()
            .Append <Twitter>()
            .Append <Vimeo>()
            .Append <DailyMotion>()
            .Append <Flickr>()
            .Append <Slideshare>()
            .Append <Kickstarter>()
            .Append <GettyImages>()
            .Append <Ted>()
            .Append <Soundcloud>()
            .Append <Issuu>()
            .Append <Hulu>()
            .Append <Giphy>()
            .Append <LottieFiles>();
            builder.SearchableTrees()?.Add(() => builder.TypeLoader.GetTypes <ISearchableTree>());
            builder.BackOfficeAssets();
        }
Esempio n. 6
0
 /// <summary>
 /// Register a component.
 /// </summary>
 /// <typeparam name="T">The type of the component.</typeparam>
 /// <param name="builder">The builder.</param>
 public static IUmbracoBuilder AddComponent <T>(this IUmbracoBuilder builder)
     where T : class, IComponent
 {
     builder.Components().Append <T>();
     return(builder);
 }
 public void Compose(IUmbracoBuilder builder) => builder.Components().Append <MyComponent>();
Esempio n. 8
0
 public override void Compose(IUmbracoBuilder builder)
 {
     base.Compose(builder);
     builder.Components().Append <Component5a>();
 }