'eicon-slider-push', 'product-card-swatches' => 'eicon-product-images', 'product-request' => 'eicon-form-horizontal', 'quote-basket' => 'eicon-cart-medium', 'brand-slider' => 'eicon-carousel', 'brand-rails' => 'eicon-slider-album', 'brand-azindex' => 'eicon-sort-amount-desc', 'brand-archive-hero' => 'eicon-header', 'brand-story' => 'eicon-text', 'brand-related' => 'eicon-link', 'taxonomy-archive-hero' => 'eicon-header', 'taxonomy-archive-footer' => 'eicon-footer', 'taxonomy-related-articles' => 'eicon-posts-grid', 'latest-posts-overlay' => 'eicon-posts-carousel', 'post-related-brands' => 'eicon-carousel', 'post-related-categories' => 'eicon-select', 'post-related-needs' => 'eicon-tags', 'semantic-related' => 'eicon-sitemap', 'toc' => 'eicon-table-of-contents', 'breadcrumb' => 'eicon-navigation-horizontal', 'competition' => 'eicon-trophy', 'competition-status' => 'eicon-countdown', 'event-registration' => 'eicon-calendar', 'loyalty-connection' => 'eicon-rating', 'custom-slot' => 'eicon-code', 'data-table' => 'eicon-table', 'sso-buttons-block' => 'eicon-lock-user', 'professional-signup' => 'eicon-person', 'store-map' => 'eicon-google-maps', 'form-button' => 'eicon-button', ); const RESPONSIVE = array( 'aieoPadD', 'aieoPadM', 'aieoMarD', 'aieoMarM', 'aieoFsD', 'aieoFsM', 'aieoEdge', 'aieoSlider' ); const HEADING = array( 'secHeading', 'secDesc', 'secHeadingUpper', 'secHeadingFeature', 'secDivider', 'secHeadingSize', 'secHeadingSizeM', 'secDescSize', 'secDescSizeM', 'secAlign' ); const CUSTOM_SLOT = 'custom-slot'; private static $booted = false; public static function bootstrap() { if ( self::$booted ) { return; } self::$booted = true; if ( did_action( 'init' ) && ! doing_action( 'init' ) ) { self::register(); return; } add_action( 'init', array( __CLASS__, 'register' ) ); } public static function register() { if ( ! function_exists( 'rooster_blocks_elementor' ) ) { return; } $factory = rooster_blocks_elementor(); if ( null === $factory ) { return; } $runs = array(); foreach ( self::list() as $name ) { $own = self::CUSTOM_SLOT === $name; if ( array() === $runs || $runs[ count( $runs ) - 1 ]['own'] !== $own ) { $runs[] = array( 'own' => $own, 'blocks' => array() ); } $runs[ count( $runs ) - 1 ]['blocks'][ 'aieo/' . $name ] = array( 'eicon' => isset( self::DEFAULT_BLOCKS[ $name ] ) ? self::DEFAULT_BLOCKS[ $name ] : '' ); } $label = __( 'Rooster One', 'ai-eshop-optimizer' ); $args = self::args(); foreach ( $runs as $run ) { $factory->register( self::CATEGORY, $label, $run['blocks'], $run['own'] ? array_merge( $args, array( 'print' => array( __CLASS__, 'print_custom_slot' ) ) ) : $args ); } } public static function args() { return array( 'id' => 'aieo', 'keywords' => array( 'rooster', 'aieo' ), 'labels' => array( __CLASS__, 'labels' ), 'skip' => self::RESPONSIVE, 'sections' => array( 'settings' => __( 'Settings', 'ai-eshop-optimizer' ), 'heading' => __( 'Section heading', 'ai-eshop-optimizer' ), ), 'sources' => array( 'slot' => array( __CLASS__, 'slots' ), 'archive_term' => array( __CLASS__, 'archive_terms' ) ), 'strings' => array( 'note' => __( 'This widget has no settings: it shows what the page and the viewer call for.', 'ai-eshop-optimizer' ) ), 'json' => array( __CLASS__, 'json' ), 'domain' => 'ai-eshop-optimizer', ); } public static function list() { $blocks = apply_filters( 'aieo_elementor_blocks', array_keys( self::DEFAULT_BLOCKS ) ); $out = array(); foreach ( (array) $blocks as $name ) { if ( is_string( $name ) && preg_match( '/^[a-z0-9-]+$/', $name ) ) { $out[] = $name; } } return array_values( array_unique( $out ) ); } public static function json( $block ) { $name = 0 === strpos( (string) $block, 'aieo/' ) ? substr( (string) $block, 5 ) : ''; if ( '' === $name || ! defined( 'AIEO_DIR' ) || ! preg_match( '/^[a-z0-9-]+$/', $name ) ) { return ''; } return AIEO_DIR . 'includes/dmm/blocks/' . $name . '/block.json'; } private static function form_choices() { $out = array( '' => __( '— Choose a form —', 'ai-eshop-optimizer' ) ); if ( ! class_exists( 'AIEO_Form_CPT' ) ) { return $out; } foreach ( get_posts( array( 'post_type' => AIEO_Form_CPT::POST_TYPE, 'post_status' => 'publish', 'numberposts' => 100, 'orderby' => 'title', 'order' => 'ASC', 'no_found_rows' => true ) ) as $post ) { $out[ (string) $post->post_name ] = '' !== $post->post_title ? (string) $post->post_title : (string) $post->post_name; } return $out; } private static function image_sizes() { return array( 'thumbnail' => __( 'Thumbnail', 'ai-eshop-optimizer' ), 'medium' => __( 'Medium', 'ai-eshop-optimizer' ), 'medium_large' => __( 'Medium large', 'ai-eshop-optimizer' ), 'large' => __( 'Large', 'ai-eshop-optimizer' ), 'full' => __( 'Full size', 'ai-eshop-optimizer' ), ); } public static function labels() { $competition = class_exists( 'AIEO_Competition_CPT' ) ? AIEO_Competition_CPT::POST_TYPE : 'aieo_competition'; $event = class_exists( 'AIEO_Event_CPT' ) ? AIEO_Event_CPT::POST_TYPE : 'aieo_event'; $labels = array( '*.secHeading' => array( 'label' => __( 'Section title', 'ai-eshop-optimizer' ), 'help' => __( 'Leave empty for no heading.', 'ai-eshop-optimizer' ) ), '*.secDesc' => array( 'label' => __( 'Section description', 'ai-eshop-optimizer' ) ), '*.secHeadingUpper' => array( 'label' => __( 'Uppercase title', 'ai-eshop-optimizer' ) ), '*.secHeadingFeature' => array( 'label' => __( 'Feature heading style (large, like product sliders)', 'ai-eshop-optimizer' ) ), '*.secDivider' => array( 'label' => __( 'Line under the title', 'ai-eshop-optimizer' ) ), '*.secHeadingSize' => array( 'label' => __( 'Title size (desktop)', 'ai-eshop-optimizer' ), 'help' => __( 'A CSS length, for example 2rem.', 'ai-eshop-optimizer' ) ), '*.secHeadingSizeM' => array( 'label' => __( 'Title size (mobile)', 'ai-eshop-optimizer' ) ), '*.secDescSize' => array( 'label' => __( 'Description size (desktop)', 'ai-eshop-optimizer' ) ), '*.secDescSizeM' => array( 'label' => __( 'Description size (mobile)', 'ai-eshop-optimizer' ) ), '*.secAlign' => array( 'label' => __( 'Heading alignment', 'ai-eshop-optimizer' ), 'options' => array( 'left' => __( 'Left', 'ai-eshop-optimizer' ), 'center' => __( 'Center', 'ai-eshop-optimizer' ), 'right' => __( 'Right', 'ai-eshop-optimizer' ) ) ), 'form-button.form' => array( 'label' => __( 'Form', 'ai-eshop-optimizer' ), 'options' => self::form_choices() ), 'form-button.label' => array( 'label' => __( 'Button words', 'ai-eshop-optimizer' ), 'help' => __( 'Empty: the form\'s own.', 'ai-eshop-optimizer' ) ), 'form-button.opens' => array( 'label' => __( 'Opens', 'ai-eshop-optimizer' ), 'options' => array( '' => __( 'As the form says', 'ai-eshop-optimizer' ), 'modal' => __( 'The form in a window', 'ai-eshop-optimizer' ), 'page' => __( 'The page that holds the form', 'ai-eshop-optimizer' ) ) ), 'form-button.page' => array( 'label' => __( 'Page (empty: the form\'s)', 'ai-eshop-optimizer' ), 'source' => 'post', 'post_type' => 'page', 'zero' => __( 'The form\'s page', 'ai-eshop-optimizer' ), 'condition' => array( 'opens' => 'page' ) ), 'form-button.contact' => array( 'label' => __( 'Contact buttons (none chosen: the form\'s)', 'ai-eshop-optimizer' ), 'multiple' => true, 'out' => 'csv', 'options' => array( 'call' => __( 'Call', 'ai-eshop-optimizer' ), 'whatsapp' => 'WhatsApp', 'viber' => 'Viber', 'messenger' => 'Messenger', 'none' => __( 'None', 'ai-eshop-optimizer' ) ) ), 'form-button.icons' => array( 'label' => __( 'Their look', 'ai-eshop-optimizer' ), 'options' => array( '' => __( 'As the form says', 'ai-eshop-optimizer' ), 'show' => __( 'Icon and words', 'ai-eshop-optimizer' ), 'hide' => __( 'Words only', 'ai-eshop-optimizer' ) ) ), 'form-button.location' => array( 'label' => __( 'Location', 'ai-eshop-optimizer' ), 'options' => array( '' => __( 'The form\'s (else the main location)', 'ai-eshop-optimizer' ) ) + ( class_exists( 'AIEO_Location_Contact' ) ? AIEO_Location_Contact::choices() : array() ) ), 'brand-archive-hero.showCounts' => array( 'label' => __( 'Show product counts', 'ai-eshop-optimizer' ) ), 'brand-archive-hero.showWishlist' => array( 'label' => __( 'Show the wishlist heart', 'ai-eshop-optimizer' ) ), 'brand-archive-hero.showRating' => array( 'label' => __( 'Show the rating', 'ai-eshop-optimizer' ) ), 'brand-azindex.showCounts' => array( 'label' => __( 'Show product counts', 'ai-eshop-optimizer' ) ), 'brand-azindex.showLogos' => array( 'label' => __( 'Show brand logos', 'ai-eshop-optimizer' ) ), 'brand-azindex.stickyBar' => array( 'label' => __( 'Sticky letter bar', 'ai-eshop-optimizer' ) ), 'brand-azindex.headingLevel' => array( 'label' => __( 'Heading level', 'ai-eshop-optimizer' ) ), 'brand-azindex.showHashBucket' => array( 'label' => __( 'Include "#" bucket for non-Latin brands', 'ai-eshop-optimizer' ) ), 'brand-rails.showFeatured' => array( 'label' => __( 'Show the Featured rail', 'ai-eshop-optimizer' ) ), 'brand-rails.showNew' => array( 'label' => __( 'Show the New rail', 'ai-eshop-optimizer' ) ), 'brand-rails.showFavourites' => array( 'label' => __( 'Show Your favourites', 'ai-eshop-optimizer' ) ), 'brand-rails.showTop' => array( 'label' => __( 'Show the Top rail', 'ai-eshop-optimizer' ) ), 'brand-rails.newMode' => array( 'label' => __( '"New" means', 'ai-eshop-optimizer' ), 'options' => array( 'new_product' => __( 'Brand whose newest product is most recent', 'ai-eshop-optimizer' ), 'new_brand' => __( 'Newest brand creation date', 'ai-eshop-optimizer' ) ) ), 'brand-rails.topLimit' => array( 'label' => __( 'Top: brands to show (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 30 ), 'brand-rails.featuredLimit' => array( 'label' => __( 'Featured: brands to show (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 30 ), 'brand-rails.newLimit' => array( 'label' => __( 'New: brands to show (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 30 ), 'brand-rails.favouritesLimit' => array( 'label' => __( 'Favourites: brands to show (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 30 ), 'brand-rails.topSlidesPerView' => array( 'label' => __( 'Top: slides per view (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 8 ), 'brand-rails.featuredSlidesPerView' => array( 'label' => __( 'Featured: slides per view (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 8 ), 'brand-rails.newSlidesPerView' => array( 'label' => __( 'New: slides per view (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 8 ), 'brand-rails.favouritesSlidesPerView' => array( 'label' => __( 'Favourites: slides per view (0 = the default)', 'ai-eshop-optimizer' ), 'max' => 8 ), 'brand-rails.limitPerRail' => array( 'label' => __( 'Default brands per rail', 'ai-eshop-optimizer' ), 'min' => 3, 'max' => 30 ), 'brand-rails.slidesPerView' => array( 'label' => __( 'Default slides per view', 'ai-eshop-optimizer' ), 'min' => 2, 'max' => 8 ), 'brand-related.showCategories' => array( 'label' => __( 'Show related categories', 'ai-eshop-optimizer' ) ), 'brand-related.showArticles' => array( 'label' => __( 'Show related articles', 'ai-eshop-optimizer' ) ), 'brand-related.showOtherBrands' => array( 'label' => __( 'Show other brands you love', 'ai-eshop-optimizer' ) ), 'brand-related.articlesLimit' => array( 'label' => __( 'Articles to show', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 12 ), 'brand-related.otherBrandsLimit' => array( 'label' => __( 'Other brands to show', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 24 ), 'brand-slider.mode' => array( 'label' => __( 'Mode', 'ai-eshop-optimizer' ), 'options' => array( 'top' => __( 'Top brands (by sales)', 'ai-eshop-optimizer' ), 'new_brand' => __( 'Newest brands (by creation date)', 'ai-eshop-optimizer' ), 'new_product' => __( 'Brand whose newest product is recent', 'ai-eshop-optimizer' ), 'favourites' => __( 'Your favourites (per logged-in user)', 'ai-eshop-optimizer' ), 'manual' => __( 'Manual brand selection', 'ai-eshop-optimizer' ) ) ), 'brand-slider.manualBrandIds' => array( 'label' => __( 'Brands', 'ai-eshop-optimizer' ), 'source' => 'term', 'taxonomy' => 'product_brand', 'multiple' => true, 'out' => 'array', 'condition' => array( 'mode' => 'manual' ) ), 'brand-slider.limit' => array( 'label' => __( 'Brands to show', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 50 ), 'brand-slider.slidesPerView' => array( 'label' => __( 'Slides per view (desktop)', 'ai-eshop-optimizer' ), 'min' => 2, 'max' => 8 ), 'brand-slider.title' => array( 'label' => __( 'Title', 'ai-eshop-optimizer' ) ), 'brand-slider.subtitle' => array( 'label' => __( 'Subtitle', 'ai-eshop-optimizer' ) ), 'brand-slider.headingFeature' => array( 'label' => __( 'Feature heading style (large, like product sliders)', 'ai-eshop-optimizer' ) ), 'brand-slider.ctaLabel' => array( 'label' => __( 'CTA label', 'ai-eshop-optimizer' ) ), 'brand-slider.ctaUrl' => array( 'label' => __( 'CTA URL', 'ai-eshop-optimizer' ) ), 'brand-slider.showCounts' => array( 'label' => __( 'Show product counts', 'ai-eshop-optimizer' ) ), 'brand-slider.cardStyle' => array( 'label' => __( 'Card style', 'ai-eshop-optimizer' ), 'options' => array( 'hero' => __( 'Hero (image / logo fallback)', 'ai-eshop-optimizer' ), 'logo' => __( 'Logo strip', 'ai-eshop-optimizer' ) ) ), 'brand-story.showHistory' => array( 'label' => __( 'Show the history', 'ai-eshop-optimizer' ) ), 'brand-story.showAmbassadors' => array( 'label' => __( 'Show the ambassadors', 'ai-eshop-optimizer' ) ), 'brand-story.showWebsite' => array( 'label' => __( 'Show the website', 'ai-eshop-optimizer' ) ), 'brand-story.showFooter' => array( 'label' => __( 'Show the footer copy', 'ai-eshop-optimizer' ) ), 'breadcrumb.separator' => array( 'label' => __( 'Separator', 'ai-eshop-optimizer' ) ), '*.taxonomy' => array( 'type' => 'skip' ), '*.termId' => array( 'label' => __( 'Shown for', 'ai-eshop-optimizer' ), 'help' => __( 'Empty: the archive the widget is on, as before.', 'ai-eshop-optimizer' ), 'source' => 'archive_term', 'taxonomy' => 'product_cat,product_tag,pa_need,product_brand', 'zero' => __( 'The page it is on', 'ai-eshop-optimizer' ) ), 'brand-archive-hero.termId' => array( 'label' => __( 'Shown for', 'ai-eshop-optimizer' ), 'help' => __( 'Empty: the brand archive the widget is on, as before.', 'ai-eshop-optimizer' ), 'source' => 'term', 'taxonomy' => 'product_brand', 'zero' => __( 'The page it is on', 'ai-eshop-optimizer' ) ), 'brand-related.termId' => array( 'label' => __( 'Shown for', 'ai-eshop-optimizer' ), 'help' => __( 'Empty: the brand archive the widget is on, as before.', 'ai-eshop-optimizer' ), 'source' => 'term', 'taxonomy' => 'product_brand', 'zero' => __( 'The page it is on', 'ai-eshop-optimizer' ) ), 'brand-story.termId' => array( 'label' => __( 'Shown for', 'ai-eshop-optimizer' ), 'help' => __( 'Empty: the brand archive the widget is on, as before.', 'ai-eshop-optimizer' ), 'source' => 'term', 'taxonomy' => 'product_brand', 'zero' => __( 'The page it is on', 'ai-eshop-optimizer' ) ), 'breadcrumb.termId' => array( 'label' => __( 'Trail of a term', 'ai-eshop-optimizer' ), 'help' => __( 'Used when no post is given. Empty: the page the widget is on.', 'ai-eshop-optimizer' ), 'source' => 'archive_term', 'taxonomy' => 'product_cat,product_tag,pa_need,product_brand,category,post_tag', 'zero' => __( 'The page it is on', 'ai-eshop-optimizer' ) ), 'breadcrumb.postId' => array( 'label' => __( 'Trail of a post (ID)', 'ai-eshop-optimizer' ), 'help' => __( 'A product, post, page, store or competition: its trail. Empty: the page the widget is on.', 'ai-eshop-optimizer' ), 'min' => 0 ), 'competition.competitionId' => array( 'label' => __( 'Which competition?', 'ai-eshop-optimizer' ), 'source' => 'post', 'post_type' => $competition, 'zero' => __( '— On this competition page —', 'ai-eshop-optimizer' ) ), 'competition-status.competitionId' => array( 'label' => __( 'Which competition?', 'ai-eshop-optimizer' ), 'source' => 'post', 'post_type' => $competition, 'zero' => __( '— On this competition page —', 'ai-eshop-optimizer' ) ), 'event-registration.eventId' => array( 'label' => __( 'Which event?', 'ai-eshop-optimizer' ), 'source' => 'post', 'post_type' => $event, 'zero' => __( '— On this event page —', 'ai-eshop-optimizer' ) ), 'custom-slot.slotId' => array( 'label' => __( 'Slot', 'ai-eshop-optimizer' ), 'source' => 'slot', 'zero' => __( '— Choose a slot —', 'ai-eshop-optimizer' ), 'help' => __( 'The slots of Rooster One > Custom Slots; a slot shows where its own placement allows.', 'ai-eshop-optimizer' ), 'sanitize' => 'sanitize_key' ), 'data-table.table' => array( 'label' => __( 'Table', 'ai-eshop-optimizer' ), 'options' => array( 'fast_finder' => __( 'Fast Finder', 'ai-eshop-optimizer' ) ) ), 'data-table.perPage' => array( 'label' => __( 'Rows per page', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 200 ), 'latest-posts-overlay.posts' => array( 'label' => __( 'Posts to show', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 12 ), 'latest-posts-overlay.imageSize' => array( 'label' => __( 'Image size', 'ai-eshop-optimizer' ), 'options' => self::image_sizes() ), 'latest-posts-overlay.excludeCurrent' => array( 'label' => __( 'Exclude current post', 'ai-eshop-optimizer' ) ), 'latest-posts-overlay.cardStyle' => array( 'label' => __( 'Card style', 'ai-eshop-optimizer' ), 'options' => array( 'overlay' => __( 'Overlay (dark gradient)', 'ai-eshop-optimizer' ), 'glass' => __( 'Glass (tall cards, frosted bar)', 'ai-eshop-optimizer' ) ) ), 'post-related-brands.autoRotate' => array( 'label' => __( 'Rotate automatically', 'ai-eshop-optimizer' ) ), 'post-related-brands.rotateMs' => array( 'label' => __( 'Rotation interval (ms)', 'ai-eshop-optimizer' ), 'min' => 1000, 'max' => 20000 ), 'post-related-brands.imageSize' => array( 'label' => __( 'Image size', 'ai-eshop-optimizer' ), 'options' => self::image_sizes() ), 'post-related-categories.label' => array( 'label' => __( 'Label', 'ai-eshop-optimizer' ) ), 'post-related-needs.heading' => array( 'label' => __( 'Heading', 'ai-eshop-optimizer' ) ), 'professional-signup.kind' => array( 'label' => __( 'Account type', 'ai-eshop-optimizer' ), 'options' => array( 'professional' => __( 'Professional account', 'ai-eshop-optimizer' ), 'student' => __( 'Student account', 'ai-eshop-optimizer' ) ) ), 'product-card-swatches.renderContext' => array( 'label' => __( 'Look', 'ai-eshop-optimizer' ), 'options' => array( 'archive' => __( 'As on a product card', 'ai-eshop-optimizer' ), 'product' => __( 'As on the product page', 'ai-eshop-optimizer' ) ) ), 'product-card-swatches.productId' => array( 'label' => __( 'Product', 'ai-eshop-optimizer' ), 'source' => 'post', 'post_type' => 'product', 'zero' => __( 'The product shown (in a loop, its product)', 'ai-eshop-optimizer' ) ), 'product-request.type' => array( 'label' => __( 'Request', 'ai-eshop-optimizer' ), 'options' => array( '' => __( 'The first type in the settings', 'ai-eshop-optimizer' ), 'quote' => __( 'Quote', 'ai-eshop-optimizer' ), 'contact' => __( 'Contact', 'ai-eshop-optimizer' ), 'callback' => __( 'Call back', 'ai-eshop-optimizer' ) ) ), 'product-request.productId' => array( 'label' => __( 'Product', 'ai-eshop-optimizer' ), 'source' => 'post', 'post_type' => 'product', 'zero' => __( 'The product shown', 'ai-eshop-optimizer' ) ), 'product-request.layout' => array( 'label' => __( 'Layout', 'ai-eshop-optimizer' ), 'options' => array( 'compact' => __( 'Compact', 'ai-eshop-optimizer' ), 'full' => __( 'Full', 'ai-eshop-optimizer' ) ) ), 'product-request.title' => array( 'label' => __( 'Title', 'ai-eshop-optimizer' ), 'help' => __( 'Blank uses the copy in the settings.', 'ai-eshop-optimizer' ) ), 'product-request.button' => array( 'label' => __( 'Button text', 'ai-eshop-optimizer' ), 'help' => __( 'Blank uses the copy in the settings.', 'ai-eshop-optimizer' ) ), 'product-request.fields' => array( 'label' => __( 'Fields', 'ai-eshop-optimizer' ), 'multiple' => true, 'out' => 'csv', 'options' => array( 'name' => __( 'Name', 'ai-eshop-optimizer' ), 'phone' => __( 'Phone', 'ai-eshop-optimizer' ), 'qty' => __( 'Quantity', 'ai-eshop-optimizer' ), 'message' => __( 'Message', 'ai-eshop-optimizer' ), 'consent' => __( 'Consent', 'ai-eshop-optimizer' ) ), 'help' => __( 'None chosen uses the settings.', 'ai-eshop-optimizer' ) ), 'product-slider.title' => array( 'label' => __( 'Title', 'ai-eshop-optimizer' ) ), 'product-slider.categories' => array( 'label' => __( 'Categories', 'ai-eshop-optimizer' ), 'source' => 'term', 'taxonomy' => 'product_cat', 'multiple' => true, 'out' => 'csv' ), 'product-slider.tags' => array( 'label' => __( 'Tags', 'ai-eshop-optimizer' ), 'source' => 'term', 'taxonomy' => 'product_tag', 'multiple' => true, 'out' => 'csv' ), 'product-slider.productIds' => array( 'label' => __( 'Products', 'ai-eshop-optimizer' ), 'source' => 'post', 'post_type' => 'product', 'multiple' => true, 'out' => 'csv' ), 'product-slider.limit' => array( 'label' => __( 'Limit', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 40 ), 'product-slider.orderby' => array( 'label' => __( 'Order by', 'ai-eshop-optimizer' ), 'options' => array( 'date' => __( 'Newest', 'ai-eshop-optimizer' ), 'popularity' => __( 'Popularity', 'ai-eshop-optimizer' ), 'rating' => __( 'Rating', 'ai-eshop-optimizer' ), 'price' => __( 'Price: low to high', 'ai-eshop-optimizer' ), 'price-desc' => __( 'Price: high to low', 'ai-eshop-optimizer' ), 'rand' => __( 'Random', 'ai-eshop-optimizer' ), 'menu_order' => __( 'Menu order', 'ai-eshop-optimizer' ) ) ), 'product-slider.showRating' => array( 'label' => __( 'Show rating', 'ai-eshop-optimizer' ) ), 'quote-basket.title' => array( 'label' => __( 'Title', 'ai-eshop-optimizer' ) ), 'sso-buttons-block.intent' => array( 'label' => __( 'Sign-in for', 'ai-eshop-optimizer' ), 'options' => array( 'checkout' => __( 'Checkout', 'ai-eshop-optimizer' ), 'login' => __( 'Log in', 'ai-eshop-optimizer' ), 'register' => __( 'Registration', 'ai-eshop-optimizer' ), 'my_account' => __( 'My account', 'ai-eshop-optimizer' ), 'subscribe' => __( 'Newsletter', 'ai-eshop-optimizer' ) ) ), 'sso-buttons-block.layout' => array( 'label' => __( 'Layout', 'ai-eshop-optimizer' ), 'options' => array( 'inline' => __( 'Side by side', 'ai-eshop-optimizer' ), 'stack' => __( 'Stacked', 'ai-eshop-optimizer' ), 'auto' => __( 'Automatic', 'ai-eshop-optimizer' ) ) ), 'sso-buttons-block.intro' => array( 'label' => __( 'Intro text', 'ai-eshop-optimizer' ), 'help' => __( 'Blank uses the default line.', 'ai-eshop-optimizer' ) ), 'semantic-related.title' => array( 'label' => __( 'Heading', 'ai-eshop-optimizer' ), 'help' => __( 'Leave empty to use the heading set in Internal Linking → Settings.', 'ai-eshop-optimizer' ) ), 'semantic-related.limit' => array( 'label' => __( 'Cards to show', 'ai-eshop-optimizer' ), 'max' => 24, 'help' => __( '0 uses the site-wide number. Fewer cards are shown when the engine has fewer to give.', 'ai-eshop-optimizer' ) ), 'semantic-related.objectId' => array( 'label' => __( 'Find relations for this page instead', 'ai-eshop-optimizer' ), 'help' => __( '0 = the page this block is on. Set an ID to show another page’s related content.', 'ai-eshop-optimizer' ) ), 'semantic-related.objectType' => array( 'label' => __( 'Treat the page as this content type', 'ai-eshop-optimizer' ), 'help' => __( 'This is the SOURCE type, not what gets shown. You almost never need it.', 'ai-eshop-optimizer' ) ), 'semantic-related.targetTypes' => array( 'label' => __( 'Show only these content types', 'ai-eshop-optimizer' ), 'help' => __( 'Comma-separated content type names, for example: post, listing. Leave empty to show whatever the engine related to this page — on a shop that is usually products.', 'ai-eshop-optimizer' ) ), 'store-map.provider' => array( 'label' => __( 'Map', 'ai-eshop-optimizer' ), 'options' => array( '' => __( 'Automatic: Google Maps with a Google key, else OpenStreetMap', 'ai-eshop-optimizer' ), 'osm' => __( 'OpenStreetMap', 'ai-eshop-optimizer' ), 'google' => __( 'Google Maps', 'ai-eshop-optimizer' ) ) ), 'store-map.locationSlug' => array( 'label' => __( 'Store (location slug)', 'ai-eshop-optimizer' ), 'help' => __( 'Empty: the store of the page the block is on.', 'ai-eshop-optimizer' ) ), 'store-map.aspect' => array( 'label' => __( 'Aspect ratio', 'ai-eshop-optimizer' ), 'help' => __( 'For example 8/5. Empty: the height below.', 'ai-eshop-optimizer' ) ), 'store-map.height' => array( 'label' => __( 'Height (px)', 'ai-eshop-optimizer' ), 'min' => 160, 'max' => 720 ), 'store-map.showDirections' => array( 'label' => __( 'Directions link', 'ai-eshop-optimizer' ) ), 'taxonomy-archive-hero.showCounts' => array( 'label' => __( 'Show product counts', 'ai-eshop-optimizer' ) ), 'taxonomy-archive-hero.showHeadline' => array( 'label' => __( 'Show the headline', 'ai-eshop-optimizer' ) ), 'taxonomy-related-articles.limit' => array( 'label' => __( 'Articles to show', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 12 ), 'taxonomy-related-articles.heading' => array( 'label' => __( 'Heading', 'ai-eshop-optimizer' ) ), 'toc.title' => array( 'label' => __( 'Title', 'ai-eshop-optimizer' ), 'help' => __( 'Blank prints “In this article”.', 'ai-eshop-optimizer' ) ), 'toc.levels' => array( 'label' => __( 'Heading levels', 'ai-eshop-optimizer' ), 'options' => array( 'h2' => __( 'H2 only', 'ai-eshop-optimizer' ), 'h2-h3' => __( 'H2 and H3', 'ai-eshop-optimizer' ) ) ), 'toc.numbered' => array( 'label' => __( 'Numbered', 'ai-eshop-optimizer' ) ), 'toc.sticky' => array( 'label' => __( 'Sticky (sidebar)', 'ai-eshop-optimizer' ), 'help' => __( 'Keeps the list in view while the reader scrolls. Use it in a sidebar column.', 'ai-eshop-optimizer' ) ), 'toc.collapsible' => array( 'label' => __( 'Collapsible', 'ai-eshop-optimizer' ) ), 'toc.minHeadings' => array( 'label' => __( 'Minimum headings to show the list', 'ai-eshop-optimizer' ), 'min' => 1, 'max' => 10 ), 'toc.postId' => array( 'label' => __( 'Post ID (0 = the post shown)', 'ai-eshop-optimizer' ) ), ); foreach ( self::HEADING as $order => $key ) { $labels[ '*.' . $key ]['section'] = 'heading'; $labels[ '*.' . $key ]['order'] = $order; } return $labels; } public static function archive_terms( array $control ) { $zero = isset( $control['zero'] ) ? (string) $control['zero'] : ''; $out = array( '0' => '' !== $zero ? $zero : '—' ); foreach ( array_filter( array_map( 'trim', explode( ',', (string) ( $control['taxonomy'] ?? '' ) ) ) ) as $taxonomy ) { $object = get_taxonomy( $taxonomy ); if ( ! $object ) { continue; } $terms = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => false, 'number' => 1201, 'orderby' => 'name' ) ); foreach ( is_array( $terms ) ? $terms : array() as $term ) { if ( count( $out ) > 1200 ) { return null; } $out[ (string) $term->term_id ] = $object->labels->singular_name . ' › ' . html_entity_decode( (string) $term->name, ENT_QUOTES ); } } return $out; } public static function slots( array $control ) { $zero = isset( $control['zero'] ) ? (string) $control['zero'] : ''; $out = array( '' => '' !== $zero ? $zero : '—' ); if ( ! class_exists( 'AIEO_DMM_Custom_Slots' ) || ! method_exists( 'AIEO_DMM_Custom_Slots', 'get_all_slots' ) ) { return $out; } foreach ( (array) AIEO_DMM_Custom_Slots::get_all_slots() as $slot ) { if ( is_array( $slot ) && ! empty( $slot['id'] ) ) { $out[ (string) $slot['id'] ] = ! empty( $slot['name'] ) ? (string) $slot['name'] : (string) $slot['id']; } } return $out; } public static function print_custom_slot( callable $markup ) { echo (string) call_user_func( $markup ); } } }