'aieo-store-head', 'data-rooster-ui' => self::UI, 'data-aieo-shops' => (string) wp_json_encode( AIEO_Store_Hours::config() ), ) ); $out = '
' . esc_html( $lead ) . '
'; } $out .= '' . implode( '
', array_map( 'esc_html', array_filter( array( $street, $town ), 'strlen' ) ) ) . '
' . esc_html( $words ) . '
'; } public static function title_word_em( $title ) { $title = trim( (string) $title ); if ( '' === $title || ! preg_match( '//u', $title ) ) { return '' === $title ? 0.0 : 0.66 * strlen( $title ); } $title = (string) preg_replace( '/([\x{3040}-\x{30FF}\x{3400}-\x{9FFF}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}])/u', ' $1 ', $title ); $words = preg_split( '/\s+|(?<=[\-\x{2010}-\x{2015}])/u', $title, -1, PREG_SPLIT_NO_EMPTY ); $most = 0.0; foreach ( (array) $words as $word ) { $em = 0.0; preg_match_all( '/\X/u', $word, $chars ); foreach ( $chars[0] as $g ) { $c = (string) preg_replace( '/^(.).*$/us', '$1', $g ); if ( preg_match( '/[\x{3040}-\x{30FF}\x{3400}-\x{9FFF}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]/u', $c ) ) { $em += 1.0; } elseif ( false !== strpos( "ijltfıιίϊΐIJΙ'’.,:;!|-\u{2010}", $c ) ) { $em += 0.40; } elseif ( false !== strpos( 'rsczεέζξςτΊ', $c ) ) { $em += 0.53; } elseif ( false !== strpos( 'mwMWΜΨΦΉΏΎΌ', $c ) ) { $em += 1.06; } elseif ( false !== strpos( 'ωώφψ&', $c ) || preg_match( '/\p{Lu}/u', $c ) ) { $em += 0.82; } else { $em += 0.66; } } $most = max( $most, $em ); } return $most; } public static function hours_scale( array $loc, $pid, $block = null ) { $iv = AIEO_Store_Hours::intervals( $loc ); if ( ! $iv ) { return ''; } $tz = AIEO_Store_Hours::timezone( $loc, (int) $pid ); $zone = AIEO_Store_Hours::zone_attrs( $tz ); $name = (string) ( $loc['label'] ?? '' ); $wrap = self::wrapper( $block, array( 'class' => 'aieo-hours-scale-wrap', 'data-rooster-ui' => self::UI, 'data-aieo-shops' => (string) wp_json_encode( AIEO_Store_Hours::config() ), ) ); AIEO_Store_Hours::need(); return '| ' . esc_html( $w['days'][ $d ] ) . ' | ' . '' . '' . ( $texts ? implode( ', ', array_map( static fn ( $t ) => '' . esc_html( $t ) . '', $texts ) ) : esc_html( $w['closedDay'] ) ) . ' |
|---|
' . esc_html__( 'Address', 'ai-eshop-optimizer' ) . ' ' . ( '' !== $maps ? '' . esc_html( $addr ) . '' : '' . esc_html( $addr ) . '' ) . '
'; } } $wanted = array_values( array_intersect( AIEO_Store_Contact::MEDIA, array_map( 'trim', explode( ',', (string) $attrs['media'] ) ) ) ); $media = ''; foreach ( $wanted as $medium ) { $value = AIEO_Store_Contact::value( $loc, $medium, $state, $now, 'span', 'aieo-store-contact__value' ); if ( '' === $value ) { continue; } $hidden = str_contains( $value, ' hidden>' ) ? ' hidden' : ''; $media .= '' . esc_html( $p['title'] ) . '
'; } $out .= '' . esc_html( $h['text'] ) . '
'; $out .= ''; if ( $names ) { $out .= '' . esc_html( sprintf( __( 'Works %s', 'ai-eshop-optimizer' ), wp_sprintf( '%l', $names ) ) ) . '
'; } if ( '' !== $p['about'] ) { $out .= '' . esc_html( $p['about'] ) . '
'; } $more = array(); foreach ( $p['elsewhere'] as $e ) { $other = AIEO_Store_Page::store( $e['store_id'] ); if ( ! $other ) { continue; } $on_days = array(); foreach ( $e['days'] as $iso ) { $on_days[] = $wpl ? (string) $wpl->get_weekday( $iso % 7 ) : gmdate( 'l', strtotime( 'Sunday +' . ( $iso % 7 ) . ' days' ) ); } $link = '' . esc_html( $other['name'] ) . ''; $more[] = '' . ( $on_days ? sprintf( esc_html__( 'Also in %1$s on %2$s', 'ai-eshop-optimizer' ), $link, esc_html( wp_sprintf( '%l', $on_days ) ) ) : sprintf( esc_html__( 'Also in %s', 'ai-eshop-optimizer' ), $link ) ) . '
'; } $out .= implode( '', $more ); if ( $p['services'] ) { $href = add_query_arg( 'appointment_host', $p['user_id'], $page ) . '#rooster-book'; $out .= '' . esc_html( sprintf( __( 'Book with %s', 'ai-eshop-optimizer' ), $p['first_name'] ) ) . ''; } $out .= '' . esc_html( $s['text'] ) . '
'; } if ( $s['minutes'] > 0 ) { $out .= '' . esc_html( sprintf( __( '%s min', 'ai-eshop-optimizer' ), number_format_i18n( $s['minutes'] ) ) ) . ''; } $out .= '' . esc_html( trim( (string) $pick['review_text'] ) ) . '
' . esc_html( '' !== $when ? sprintf( __( '%1$s, %2$s', 'ai-eshop-optimizer' ), $author, $when ) : $author ) . '
'; } if ( $rating > 0 && $count > 0 ) { $out .= '' . sprintf( esc_html( _n( '%1$s from %2$s Google review', '%1$s from %2$s Google reviews', $count, 'ai-eshop-optimizer' ) ), '' . esc_html( number_format_i18n( $rating, 1 ) ) . '', esc_html( number_format_i18n( $count ) ) ) . '
'; } if ( '' !== $maps ) { $out .= '' . esc_html__( 'Read them on Google', 'ai-eshop-optimizer' ) . '
'; } return $out . '' . esc_html( $lead ) . '
' : '' ) . '