Plugin Directory

Changeset 3841934


Ignore:
Timestamp:
12/03/2026 08:45:55 AM (6 hours ago)
Author:
tretiakov
Message:
  • Flexible link input: http://, https://, and www. are no longer required when adding links.
  • Lightbox UX: Images in the Design gallery can now be closed by clicking outside the image area, in addition to the close button.
  • Customizable header height: Added a header height setting in pixels (defaults to 400px).
Location:
projelio
Files:
16 added
10 edited

Legend:

Unmodified
Added
Removed
  • projelio/trunk/assets/css/admin.css

    r3841189 r3841934  
    7979.pj-field input[type="url"],
    8080.pj-field input[type="date"],
     81.pj-field input[type="number"],
    8182.pj-field select,
    8283.pj-field textarea {
  • projelio/trunk/assets/css/portal.css

    r3841189 r3841934  
    7777.pj-hero-header {
    7878    position: relative;
    79     min-height: 400px;
     79    min-height: var(--pj-header-height, 400px);
    8080    display: flex;
    8181    flex-direction: column;
    … …  
    473473.pj-lb-prev { position: fixed; left: 16px; top: 50%; transform: translateY(-50%); z-index: 5; }
    474474.pj-lb-next { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 5; }
    475 .pj-lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
    476 .pj-lb-img-box { position: relative; display: inline-block; max-width: 88vw; max-height: 82vh; }
     475.pj-lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
     476.pj-lb-img-box { position: relative; display: inline-block; max-width: 88vw; max-height: 82vh; cursor: default; }
    477477
    478478.pj-lb-img-box img { display: block; max-width: 88vw; max-height: 82vh; border-radius: 8px; user-select: none; }
    … …  
    486486}
    487487@media (max-width: 720px) {
    488     .pj-hero-header { min-height: 280px; }
    489488    .pj-bento-grid,
    490489    .pj-gallery-grid,
    … …  
    10801079@media (max-width: 720px) {
    10811080    .pj-hero-header {
    1082         min-height: 290px;
     1081        min-height: clamp(160px, calc(var(--pj-header-height, 400px) * 0.725), 600px);
    10831082        padding: 0 0 18px;
    10841083    }
  • projelio/trunk/assets/js/admin.js

    r3841189 r3841934  
    231231            '<div class="pj-repeater-row"><span class="dashicons dashicons-menu pj-drag"></span>' +
    232232            '<input type="text" name="pj_link_title[]" placeholder="' + tr('link_title_ph', 'Link title') + '" class="pj-grow">' +
    233             '<input type="url" name="pj_link_url[]" placeholder="https://..." class="pj-grow">' +
     233            '<input type="text" name="pj_link_url[]" placeholder="example.com/..." class="pj-grow">' +
    234234            '<button type="button" class="button pj-remove-row">✕</button></div>'
    235235        );
  • projelio/trunk/assets/js/portal.js

    r3841189 r3841934  
    9393        lightbox.querySelector('.pj-lb-prev').addEventListener('click', () => { currentIdx--; renderLightbox(); });
    9494        lightbox.querySelector('.pj-lb-next').addEventListener('click', () => { currentIdx++; renderLightbox(); });
     95        lightbox.addEventListener('click', e => {
     96            if (!e.target.closest('#pj-lb-img-box, .pj-lb-topbar, .pj-lb-prev, .pj-lb-next')) {
     97                closeLightbox();
     98            }
     99        });
    95100        document.addEventListener('keydown', e => {
    96101            if (!lightbox.classList.contains('is-open')) return;
  • projelio/trunk/includes/i18n.php

    r3841189 r3841934  
    9898                'font_label'            => 'Font',
    9999                'preview_label'         => 'Preview:',
    100                 'div_header'            => 'Project header (400px)',
     100                'div_header'            => 'Project header',
     101                'header_height_label'   => 'Header height (px)',
    101102                'header_bg'             => 'Header background',
    102103                'header_solid'          => 'Solid color',
    … …  
    322323                'font_label'            => 'Schriftart',
    323324                'preview_label'         => 'Vorschau:',
    324                 'div_header'            => 'Projekt-Header (400px)',
     325                'div_header'            => 'Projekt-Header',
     326                'header_height_label'   => 'Header-Höhe (px)',
    325327                'header_bg'             => 'Header-Hintergrund',
    326328                'header_solid'          => 'Volltonfarbe',
    … …  
    546548                'font_label'            => 'Шрифт',
    547549                'preview_label'         => 'Предпросмотр:',
    548                 'div_header'            => 'Шапка проекта (400px)',
     550                'div_header'            => 'Шапка проекта',
     551                'header_height_label'   => 'Высота шапки (px)',
    549552                'header_bg'             => 'Фон шапки',
    550553                'header_solid'          => 'Сплошной цвет',
    … …  
    10031006
    10041007    /**
     1008     * Normalize user-entered URL so links without https:// or www. work seamlessly
     1009     */
     1010    public static function normalize_url( $raw_url ) {
     1011        $clean = trim( (string) $raw_url );
     1012        if ( '' === $clean ) {
     1013            return '';
     1014        }
     1015        if ( ! preg_match( '#^([a-z][a-z0-9+\-.]*:|//|/)#i', $clean ) ) {
     1016            $clean = 'https://' . $clean;
     1017        }
     1018        return esc_url_raw( $clean );
     1019    }
     1020
     1021    /**
    10051022     * Format Telegram handle into full URL
    10061023     */
  • projelio/trunk/includes/settings.php

    r3841189 r3841934  
    3232            'font'              => 'system_sans',
    3333            'header_type'       => 'color',
     34            'header_height'     => 400,
    3435            'header_color'      => '#23211E',
    3536            'header_img_id'     => 0,
  • projelio/trunk/includes/wizard.php

    r3841189 r3841934  
    8585        $raw_header_type = isset( $_POST['projelio_header_type'] ) ? sanitize_key( wp_unslash( $_POST['projelio_header_type'] ) ) : $d['header_type'];
    8686        $header_type     = ( 'image' === $raw_header_type ) ? 'image' : 'color';
     87        $header_height   = isset( $_POST['projelio_header_height'] ) ? absint( $_POST['projelio_header_height'] ) : absint( $d['header_height'] ?? 400 );
     88        $header_height   = $header_height ? max( 160, min( 800, $header_height ) ) : 400;
    8789        $raw_hdr_color   = isset( $_POST['projelio_header_color'] ) ? sanitize_hex_color( wp_unslash( $_POST['projelio_header_color'] ) ) : $d['header_color'];
    8890        update_post_meta( $post_id, '_projelio_header_type', $header_type );
     91        update_post_meta( $post_id, '_projelio_header_height', $header_height );
    8992        update_post_meta( $post_id, '_projelio_header_color', $raw_hdr_color ?: $d['header_color'] );
    9093        update_post_meta( $post_id, '_projelio_header_img_id', absint( $_POST['projelio_header_img_id'] ?? $d['header_img_id'] ) );
    … …  
    272275                                    </div>
    273276                                    <div id="pj-header-img-preview" style="margin-top:8px;">
    274                                         <?php if ( $header_url ) : ?><img src="<?php echo esc_url( $header_url ); ?>" style="max-height:70px;border-radius:6px;"><?php endif; ?>
     277                                        <?php if ( $header_url ) : ?><img src="<?php echo esc_url( $header_url ); ?>" alt="" style="max-height:70px;border-radius:6px;"><?php endif; ?>
    275278                                    </div>
     279                                </div>
     280                                <div class="pj-field">
     281                                    <label for="projelio_header_height"><?php echo esc_html( Projelio_I18n::a( 'header_height_label' ) ); ?></label>
     282                                    <input type="number" id="projelio_header_height" name="projelio_header_height" value="<?php echo esc_attr( absint( $d['header_height'] ?? 400 ) ?: 400 ); ?>" min="160" max="800" step="10">
    276283                                </div>
    277284                            </div>
  • projelio/trunk/projelio.php

    r3841189 r3841934  
    33 * Plugin Name: Projelio
    44 * Description: Minimalist PIN-protected client portal for interior designers & architects: Project Wizard, EN/DE/RU, Light & Dark themes, GDPR-safe fonts, room galleries, interactive drawings viewer, protected documents, stages, tasks & threaded comments.
    5  * Version: 1.0.0
     5 * Version: 1.0.1
    66 * Author: Projelio
    77 * License: GPLv2 or later
    … …  
    1313}
    1414
    15 define( 'PROJELIO_VERSION', '1.0.0' );
     15define( 'PROJELIO_VERSION', '1.0.1' );
    1616define( 'PROJELIO_PATH', plugin_dir_path( __FILE__ ) );
    1717define( 'PROJELIO_URL', plugin_dir_url( __FILE__ ) );
    … …  
    426426
    427427        $header_type   = get_post_meta( $post->ID, '_projelio_header_type', true ) ?: $d['header_type'];
     428        $header_height = absint( get_post_meta( $post->ID, '_projelio_header_height', true ) ) ?: absint( $d['header_height'] ?? 400 );
    428429        $header_color  = get_post_meta( $post->ID, '_projelio_header_color', true ) ?: $d['header_color'];
    429430        $header_img_id = $is_new ? absint( $d['header_img_id'] ) : absint( get_post_meta( $post->ID, '_projelio_header_img_id', true ) );
    … …  
    528529                <div id="pj-header-img-preview" style="margin-top:8px;">
    529530                    <?php if ( $header_img_url ) : ?>
    530                         <img src="<?php echo esc_url( $header_img_url ); ?>" style="max-height:70px;border-radius:6px;">
     531                        <img src="<?php echo esc_url( $header_img_url ); ?>" alt="" style="max-height:70px;border-radius:6px;">
    531532                    <?php endif; ?>
    532533                </div>
     534            </div>
     535            <div class="pj-field">
     536                <label for="projelio_header_height"><?php echo esc_html( Projelio_I18n::a( 'header_height_label' ) ); ?></label>
     537                <input type="number" id="projelio_header_height" name="projelio_header_height" value="<?php echo esc_attr( $header_height ); ?>" min="160" max="800" step="10">
    533538            </div>
    534539
    … …  
    769774                    <span class="dashicons dashicons-menu pj-drag"></span>
    770775                    <input type="text" name="pj_link_title[]" value="<?php echo esc_attr( $lnk['title'] ?? '' ); ?>" placeholder="<?php echo esc_attr( Projelio_I18n::a( 'link_title_ph' ) ); ?>" class="pj-grow">
    771                     <input type="url" name="pj_link_url[]" value="<?php echo esc_url( $lnk['url'] ?? '' ); ?>" placeholder="https://..." class="pj-grow">
     776                    <input type="text" name="pj_link_url[]" value="<?php echo esc_attr( $lnk['url'] ?? '' ); ?>" placeholder="example.com/..." class="pj-grow">
    772777                    <button type="button" class="button pj-remove-row">✕</button>
    773778                </div>
    … …  
    841846        $raw_header_type = isset( $_POST['projelio_header_type'] ) ? sanitize_key( wp_unslash( $_POST['projelio_header_type'] ) ) : 'color';
    842847        $header_type     = ( 'image' === $raw_header_type ) ? 'image' : 'color';
     848        $header_height   = isset( $_POST['projelio_header_height'] ) ? absint( $_POST['projelio_header_height'] ) : 400;
     849        $header_height   = $header_height ? max( 160, min( 800, $header_height ) ) : 400;
    843850        $header_color    = isset( $_POST['projelio_header_color'] ) ? sanitize_hex_color( wp_unslash( $_POST['projelio_header_color'] ) ) : '#26282A';
    844851        update_post_meta( $post_id, '_projelio_header_type', $header_type );
     852        update_post_meta( $post_id, '_projelio_header_height', $header_height );
    845853        update_post_meta( $post_id, '_projelio_header_color', $header_color ?: '#26282A' );
    846854        update_post_meta( $post_id, '_projelio_header_img_id', absint( $_POST['projelio_header_img_id'] ?? 0 ) );
    … …  
    965973        // Contacts
    966974        $links       = array();
    967         $link_urls   = isset( $_POST['pj_link_url'] ) && is_array( $_POST['pj_link_url'] ) ? array_map( 'esc_url_raw', wp_unslash( $_POST['pj_link_url'] ) ) : array();
     975        $link_urls   = isset( $_POST['pj_link_url'] ) && is_array( $_POST['pj_link_url'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['pj_link_url'] ) ) : array();
    968976        $link_titles = isset( $_POST['pj_link_title'] ) && is_array( $_POST['pj_link_title'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['pj_link_title'] ) ) : array();
    969         foreach ( $link_urls as $i => $clean_lurl ) {
    970             $clean_lurl = trim( $clean_lurl );
     977        foreach ( $link_urls as $i => $raw_lurl ) {
     978            $clean_lurl = Projelio_I18n::normalize_url( $raw_lurl );
    971979            if ( '' === $clean_lurl ) {
    972980                continue;
    … …  
    974982            $ltitle  = $link_titles[ $i ] ?? '';
    975983            $links[] = array(
    976                 'title' => $ltitle ?: $clean_lurl,
     984                'title' => $ltitle ?: trim( $raw_lurl ),
    977985                'url'   => $clean_lurl,
    978986            );
  • projelio/trunk/readme.txt

    r3841306 r3841934  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    9090== Changelog ==
    9191
     92= 1.0.1 =
     93* Flexible link input: `http://`, `https://`, and `www.` are no longer required when adding links.
     94* Lightbox UX: Images in the Design gallery can now be closed by clicking outside the image area, in addition to the close button.
     95* Customizable header height: Added a header height setting in pixels (defaults to 400px).
     96
    9297= 1.0.0 =
    9398* Initial release of Projelio Free.
  • projelio/trunk/templates/single-projelio-project.php

    r3841189 r3841934  
    138138// Header
    139139$header_type   = get_post_meta( $post_id, '_projelio_header_type', true ) ?: 'color';
     140$header_height = absint( get_post_meta( $post_id, '_projelio_header_height', true ) ) ?: absint( $defaults['header_height'] ?? 400 );
     141$header_height = max( 160, min( 800, $header_height ?: 400 ) );
    140142$header_color  = get_post_meta( $post_id, '_projelio_header_color', true ) ?: '#23211E';
    141143$header_img_id = absint( get_post_meta( $post_id, '_projelio_header_img_id', true ) );
    … …  
    267269        . '--pj-font:' . $font_css . ';'
    268270        . '--pj-serif:' . $serif_css . ';'
     271        . '--pj-header-height:' . (int) $header_height . 'px;'
    269272        . '}';
    270273
    … …  
    755758                                <div class="pj-extra-links-inline">
    756759                                    <?php foreach ( $contacts['links'] as $lnk ) : ?>
    757                                         <a href="<?php echo esc_url( $lnk['url'] ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html( $lnk['title'] ); ?> ↗</a>
     760                                        <a href="<?php echo esc_url( Projelio_I18n::normalize_url( $lnk['url'] ) ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html( $lnk['title'] ); ?> ↗</a>
    758761                                    <?php endforeach; ?>
    759762                                </div>
Note: See TracChangeset for help on using the changeset viewer.