Plugin Directory

Changeset 3806592


Ignore:
Timestamp:
11/17/2026 06:03:25 AM (less than one hour ago)
Author:
wpmart
Message:

modified

Location:
wm-family-tree-organization-chart
Files:
8 added
9 edited

Legend:

Unmodified
Added
Removed
  • wm-family-tree-organization-chart/trunk/admin/class-ftree-6310-admin.php

    r3759236 r3806592  
    6464                        return;
    6565                }
    66                 $pro = ftree_6310_is_pro();
     66                $pro     = ftree_6310_is_pro();
     67                $license = FTree_6310_License::data();
     68                $demo    = $pro && FTree_6310_License::is_active() && FTree_6310_License::is_demo_key( $license['key'] );
    6769                ?>
    6870                <div class="ftree-6310-version-bar<?php echo $pro ? ' is-pro' : ' is-free'; ?>">
    … …  
    7274                                <span class="ftree-6310-vb-ver"><?php echo esc_html( 'v' . FTREE_6310_VERSION ); ?></span>
    7375                        </span>
    74                         <?php if ( $pro ) : ?>
     76                        <?php if ( $demo ) : ?>
     77                                <span class="ftree-6310-vb-badge is-demo"><span class="dashicons dashicons-clock" aria-hidden="true"></span> <?php esc_html_e( 'Pro Demo', 'wm-family-tree-organization-chart' ); ?></span>
     78                                <span class="ftree-6310-vb-note">
     79                                        <?php
     80                                        if ( $license['expires'] ) {
     81                                                /* translators: %s: date */
     82                                                echo esc_html( sprintf( __( 'Your demo key ends on %s. Upgrade to Pro to keep the Pro features.', 'wm-family-tree-organization-chart' ), date_i18n( get_option( 'date_format' ), strtotime( $license['expires'] ) ) ) );
     83                                        } else {
     84                                                esc_html_e( 'You are using a demo key. Upgrade to Pro to use the Pro features on your live site.', 'wm-family-tree-organization-chart' );
     85                                        }
     86                                        ?>
     87                                </span>
     88                                <a class="button button-primary ftree-6310-vb-buy" href="<?php echo esc_url( FTREE_6310_PRO_URL ); ?>" target="_blank" rel="noopener"><span class="dashicons dashicons-star-filled" aria-hidden="true"></span> <?php esc_html_e( 'Upgrade to Pro', 'wm-family-tree-organization-chart' ); ?></a>
     89                        <?php elseif ( $pro ) : ?>
    7590                                <span class="ftree-6310-vb-badge is-pro"><span class="dashicons dashicons-yes-alt" aria-hidden="true"></span> <?php esc_html_e( 'Pro Version', 'wm-family-tree-organization-chart' ); ?></span>
    7691                        <?php else : ?>
  • wm-family-tree-organization-chart/trunk/admin/views/templates.php

    r3753122 r3806592  
    4444        </div>
    4545
    46         <h2 class="ftree-6310-section-title"><?php esc_html_e( 'Choose a template', 'wm-family-tree-organization-chart' ); ?></h2>
    47         <p class="description"><?php esc_html_e( 'Click a template to create a new shortcode and customize it.', 'wm-family-tree-organization-chart' ); ?></p>
    48 
    49         <div class="ftree-6310-tpl-grid">
    50                 <?php foreach ( $templates as $tpl_id => $tpl ) : ?>
    51                         <form class="ftree-6310-tpl-card" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    52                                 <?php wp_nonce_field( 'ftree_6310_create_chart' ); ?>
    53                                 <input type="hidden" name="action" value="ftree_6310_create_chart" />
    54                                 <input type="hidden" name="template" value="<?php echo esc_attr( $tpl_id ); ?>" />
    55                                 <div class="ftree-6310-tpl-thumb" aria-hidden="true" inert>
    56                                         <div class="ftree-6310-tpl-thumb-inner">
    57                                                 <?php
    58                                                 echo FTree_6310_Renderer::render( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in renderer.
    59                                                         array(
    60                                                                 'template' => $tpl_id,
    61                                                                 'settings' => FTree_6310_Templates::defaults( $tpl_id ),
    62                                                                 'sample'   => true,
    63                                                         )
    64                                                 );
    65                                                 ?>
    66                                         </div>
    67                                 </div>
    68                                 <div class="ftree-6310-tpl-meta">
    69                                         <span class="ftree-6310-tpl-num"><?php echo esc_html( $tpl_id ); ?><?php echo empty( $tpl['pro'] ) ? ' <span class="ftree-6310-free-badge">FREE</span>' : ' <span class="ftree-6310-pro-badge">PRO</span>'; ?></span>
    70                                         <span class="ftree-6310-tpl-name"><?php echo esc_html( $tpl['label'] ); ?></span>
    71                                         <span class="ftree-6310-tpl-desc"><?php echo esc_html( $tpl['description'] ); ?></span>
    72                                 </div>
    73                                 <?php if ( FTree_6310_Templates::allowed( $tpl_id ) ) : ?>
    74                                         <button type="submit" class="button button-primary ftree-6310-tpl-cta"><?php echo esc_html( sprintf( /* translators: %s: template number */ __( 'Use template %s', 'wm-family-tree-organization-chart' ), $tpl_id ) ); ?> &rarr;</button>
    75                                 <?php else : ?>
    76                                         <a class="button ftree-6310-tpl-cta ftree-6310-tpl-locked" href="<?php echo esc_url( admin_url( 'edit.php?post_type=' . FTREE_6310_MEMBER_CPT . '&page=ftree-6310-license' ) ); ?>"><span class="dashicons dashicons-lock" aria-hidden="true"></span> <?php esc_html_e( 'Unlock with Pro', 'wm-family-tree-organization-chart' ); ?></a>
    77                                 <?php endif; ?>
    78                         </form>
    79                 <?php endforeach; ?>
    80         </div>
    81 
    8246        <h2 class="ftree-6310-section-title"><?php esc_html_e( 'Your shortcodes', 'wm-family-tree-organization-chart' ); ?></h2>
    8347
    8448        <?php if ( empty( $charts ) ) : ?>
    85                 <p class="ftree-6310-empty-box"><?php esc_html_e( 'No shortcodes yet. Pick a template above to create one.', 'wm-family-tree-organization-chart' ); ?></p>
     49                <p class="ftree-6310-empty-box"><?php esc_html_e( 'No shortcodes yet. Pick a template below to create one.', 'wm-family-tree-organization-chart' ); ?></p>
    8650        <?php else : ?>
    8751                <table class="widefat striped ftree-6310-charts-table">
    … …  
    12286                </table>
    12387        <?php endif; ?>
     88
     89        <h2 class="ftree-6310-section-title"><?php esc_html_e( 'Choose a template', 'wm-family-tree-organization-chart' ); ?></h2>
     90        <p class="description"><?php esc_html_e( 'Click a template to create a new shortcode and customize it.', 'wm-family-tree-organization-chart' ); ?></p>
     91
     92        <div class="ftree-6310-tpl-grid">
     93                <?php foreach ( $templates as $tpl_id => $tpl ) : ?>
     94                        <form class="ftree-6310-tpl-card" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
     95                                <?php wp_nonce_field( 'ftree_6310_create_chart' ); ?>
     96                                <input type="hidden" name="action" value="ftree_6310_create_chart" />
     97                                <input type="hidden" name="template" value="<?php echo esc_attr( $tpl_id ); ?>" />
     98                                <div class="ftree-6310-tpl-thumb" aria-hidden="true" inert>
     99                                        <div class="ftree-6310-tpl-thumb-inner">
     100                                                <?php
     101                                                echo FTree_6310_Renderer::render( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in renderer.
     102                                                        array(
     103                                                                'template' => $tpl_id,
     104                                                                'settings' => FTree_6310_Templates::defaults( $tpl_id ),
     105                                                                'sample'   => true,
     106                                                        )
     107                                                );
     108                                                ?>
     109                                        </div>
     110                                </div>
     111                                <div class="ftree-6310-tpl-meta">
     112                                        <span class="ftree-6310-tpl-num"><?php echo esc_html( $tpl_id ); ?><?php echo empty( $tpl['pro'] ) ? ' <span class="ftree-6310-free-badge">FREE</span>' : ' <span class="ftree-6310-pro-badge">PRO</span>'; ?></span>
     113                                        <span class="ftree-6310-tpl-name"><?php echo esc_html( $tpl['label'] ); ?></span>
     114                                        <span class="ftree-6310-tpl-desc"><?php echo esc_html( $tpl['description'] ); ?></span>
     115                                </div>
     116                                <?php if ( FTree_6310_Templates::allowed( $tpl_id ) ) : ?>
     117                                        <button type="submit" class="button button-primary ftree-6310-tpl-cta"><?php echo esc_html( sprintf( /* translators: %s: template number */ __( 'Use template %s', 'wm-family-tree-organization-chart' ), $tpl_id ) ); ?> &rarr;</button>
     118                                <?php else : ?>
     119                                        <a class="button ftree-6310-tpl-cta ftree-6310-tpl-locked" href="<?php echo esc_url( admin_url( 'edit.php?post_type=' . FTREE_6310_MEMBER_CPT . '&page=ftree-6310-license' ) ); ?>"><span class="dashicons dashicons-lock" aria-hidden="true"></span> <?php esc_html_e( 'Unlock with Pro', 'wm-family-tree-organization-chart' ); ?></a>
     120                                <?php endif; ?>
     121                        </form>
     122                <?php endforeach; ?>
     123        </div>
    124124</div>
  • wm-family-tree-organization-chart/trunk/assets/css/admin.css

    r3759236 r3806592  
    21202120}
    21212121
     2122.ftree-6310-vb-badge.is-demo {
     2123        background: #fcf9e8;
     2124        color: #8a6100;
     2125        border: 1px solid #dba617;
     2126}
     2127
     2128.ftree-6310-vb-note {
     2129        color: #646970;
     2130        font-size: 13px;
     2131}
     2132
    21222133.ftree-6310-version-bar .ftree-6310-vb-buy {
    21232134        margin-inline-start: auto;
  • wm-family-tree-organization-chart/trunk/family-tree.php

    r3759236 r3806592  
    2121}
    2222
    23 define( 'FTREE_6310_VERSION', '1.1' );
     23define( 'FTREE_6310_VERSION', '1.3.0' );
    2424define( 'FTREE_6310_FILE', __FILE__ );
    2525define( 'FTREE_6310_PATH', plugin_dir_path( __FILE__ ) );
  • wm-family-tree-organization-chart/trunk/includes/class-ftree-6310-post-types.php

    r3753122 r3806592  
    2020        public static function init() {
    2121                add_action( 'init', array( __CLASS__, 'register' ) );
     22                add_filter( 'rest_pre_dispatch', array( __CLASS__, 'protect_rest' ), 10, 3 );
     23        }
     24
     25        /**
     26         * Members are not public posts: the REST API is only enabled for the block editor, so visitors
     27         * must not be able to list every member (including ones that are on no chart) through it.
     28         *
     29         * @param mixed           $result  Response to replace the requested version with.
     30         * @param WP_REST_Server  $server  Server instance.
     31         * @param WP_REST_Request $request Request.
     32         * @return mixed
     33         */
     34        public static function protect_rest( $result, $server, $request ) {
     35                if ( null !== $result || ! $request instanceof WP_REST_Request ) {
     36                        return $result;
     37                }
     38                $base  = '/wp/v2/' . FTREE_6310_MEMBER_CPT;
     39                $route = untrailingslashit( (string) $request->get_route() );
     40                if ( ( $base === $route || 0 === strpos( $route, $base . '/' ) ) && ! current_user_can( 'edit_posts' ) ) {
     41                        return new WP_Error(
     42                                'rest_forbidden',
     43                                __( 'Sorry, you are not allowed to do that.', 'wm-family-tree-organization-chart' ),
     44                                array( 'status' => rest_authorization_required_code() )
     45                        );
     46                }
     47                return $result;
    2248        }
    2349
  • wm-family-tree-organization-chart/trunk/includes/class-ftree-6310-renderer.php

    r3759236 r3806592  
    2828         */
    2929        private static $rendering = false;
     30
     31        /**
     32         * Is the chart being rendered an admin preview (live customizer needs every part in the markup).
     33         *
     34         * @var bool
     35         */
     36        private static $preview = false;
     37
     38        /**
     39         * Card parts that hold personal data, and the display toggle that controls each one.
     40         * When the toggle is off the part is left out of the front-end HTML, not just hidden with CSS.
     41         *
     42         * @var array
     43         */
     44        private static $private_parts = array(
     45                'contacts' => 'show_contacts',
     46        );
    3047
    3148        /**
    … …  
    5572                }
    5673                self::$rendering = true;
     74                self::$preview   = ! empty( $args['preview'] );
    5775                $renderer        = new self();
    5876                $html            = $renderer->build( $args );
    5977                self::$rendering = false;
     78                self::$preview   = false;
    6079                return $html;
     80        }
     81
     82        /**
     83         * Should a card part be left out of the markup (its display toggle is off on the front end).
     84         *
     85         * @param string $name     Part name.
     86         * @param array  $settings Chart settings.
     87         * @return bool
     88         */
     89        public static function part_hidden( $name, $settings ) {
     90                if ( self::$preview || ! isset( self::$private_parts[ $name ] ) ) {
     91                        return false;
     92                }
     93                $toggle = self::$private_parts[ $name ];
     94                return isset( $settings[ $toggle ] ) && '1' !== (string) $settings[ $toggle ];
    6195        }
    6296
  • wm-family-tree-organization-chart/trunk/includes/class-ftree-6310-search.php

    r3759236 r3806592  
    147147
    148148                // Members matching by name / profile, or by designation / short details.
     149                // Password-protected profiles are hidden on the chart, so their text must not be searchable either
     150                // (otherwise a logged-in subscriber could probe for words in a protected profile).
    149151                $by_text = get_posts(
    150152                        array(
    … …  
    152154                                'post_status'    => 'publish',
    153155                                's'              => $term,
     156                                'has_password'   => false,
    154157                                'fields'         => 'ids',
    155158                                'posts_per_page' => self::MAX_MEMBERS,
  • wm-family-tree-organization-chart/trunk/includes/helpers.php

    r3759236 r3806592  
    342342        $has_popup = ! empty( $extra['has_popup'] );
    343343        $context   = isset( $extra['context'] ) ? $extra['context'] : 'card';
     344        // Personal data switched off for the cards is not printed at all (CSS alone would leave it in the page source).
     345        if ( 'card' === $context && FTree_6310_Renderer::part_hidden( $name, (array) $settings ) ) {
     346                return;
     347        }
    344348        include $file;
    345349}
  • wm-family-tree-organization-chart/trunk/readme.txt

    r3759236 r3806592  
    1717= Features =
    1818
    19 * **Members** with name, designation, short details, full profile (WordPress editor), picture and social icons.
    20 * **Visual tree builder** on each chart. Add, move, nest or remove members, or create a new member without leaving the page.
    21 * **Templates.** Pick a template and get a ready shortcode: `[ftree_6310_tree id="123"]`.
    22 * **Live customizer** for fonts, colors, spacing, alignment, image size, connector lines and buttons, with an instant preview.
    23 * **Profile popup** that shows the member's full profile.
    24 * **Expand and collapse** branches (Pro).
     19**Members**
     20
     21* Name, designation, short details, full profile (WordPress block editor), picture and social icons.
     22* 17 social networks: Facebook, X / Twitter, LinkedIn, Instagram, YouTube, TikTok, Pinterest, GitHub, WhatsApp, Telegram, Behance, Dribbble, Medium, Reddit, Twitch, Spotify and Website.
     23* Members are shared: add a person once and use them in as many charts as you like.
     24* The member list shows each member's picture, designation and the charts they are used in.
     25* Password-protected members keep their profile hidden until the visitor enters the password.
     26
     27**Charts and the tree builder**
     28
     29* **Visual tree builder** on each chart. Drag and drop to add, move, nest or remove members, add a member under another one, or create and edit a member (name, designation, short details, picture) without leaving the page.
     30* **Unlimited charts.** Create, duplicate and delete charts on the **Templates & Shortcodes** page. Each chart has its own tree, template and style.
     31* **6 templates:** Classic Card (free), Circle Avatar, Modern Header, Compact Horizontal, Minimal and Photo Profile (Pro). Pick one and get a ready shortcode: `[ftree_6310_tree id="123"]`.
     32
     33**Design**
     34
     35* **Live customizer** with an instant preview, grouped in tabs: Display, Card & Lines, Title (Name), Designation, Short Details, Skills & Contacts, Profile Button and Profile Popup.
     36* Show or hide the chart title, picture, designation, short details, social icons, skills, contacts and profile button per chart.
     37* Accent color, card background, border, radius, width and padding; picture size and shape (circle, rounded, square); connector line color and width; space between members and levels.
     38* Font size, weight, color, margin, alignment, line height and text transform for the name, designation and short details.
     39* Profile button text, size, colors and radius.
     40
     41**On the front end**
     42
     43* **Profile popup** with the member's picture, details, social icons, contacts, skills and full profile.
     44* **Profile popup styles.** Classic centered popup (free), plus side panel, full screen and bottom sheet (Pro), chosen per chart.
     45* **Expand and collapse** branches, with a count of the members under each one (Pro).
    2546* **Zoom in, zoom out, reset zoom and full screen** buttons, which you can turn on or off per chart (Pro).
    26 * **Profile popup styles.** Classic centered popup (free), plus side panel, full screen and bottom sheet (Pro), chosen per chart.
    27 * **Settings page** (Pro) for the popup close button (position, shape, size, colors, close on outside click / Esc) and the loading indicator shown while a profile opens (spinner, dots, pulse or bar).
    28 * **Export / Import.** Export members, charts and settings to a .json file; import it on another site (import is Pro).
     47* **Settings page** (Pro) for the popup close button (position, content, shape, size, colors, close on outside click / Esc) and the loading indicator shown while a profile opens (spinner, dots, pulse or bar, with color, size, text and page dimming).
     48* **Mobile responsive.** On small screens the chart becomes an easy-to-read indented list.
     49* **Accessible.** Keyboard friendly buttons, Esc to close the popup and screen reader labels.
     50
     51**Search, SEO and AI**
     52
    2953* **Search & AI ready.** Each chart adds schema.org structured data (JSON-LD) listing its people with name, job title, description, picture and social profiles, so Google and AI search tools (ChatGPT, Perplexity, Gemini, Copilot) can understand who is on the page. You can turn it off per chart.
    3054* **Found by site search.** WordPress search (and Relevanssi) finds the pages that show a chart when visitors search for a member's name, job title or short details. Pages that only hold a chart also get an automatic excerpt listing its members.
    31 * **Mobile responsive.** On small screens the chart becomes an easy-to-read indented list.
    32 * **Demo data.** Import 7 sample members and a chart on activation to get started quickly.
     55
     56**Tools**
     57
     58* **Export / Import.** Export members (with picture links), charts and settings to a .json file; import it on another site, optionally downloading the pictures (import is Pro). Imports always add new items and never overwrite existing ones.
     59* **Demo data.** Import 7 sample members with pictures, contacts, skills and social icons, a ready shortcode and (optionally) a draft page from the notice shown after activation. Remove it all again with one click.
    3360* **Theme overrides.** Copy any file from `templates/` into `your-theme/family-tree/` to change the markup.
    3461* **Translation ready** and compatible with **WPML**, **Polylang** and other multilingual plugins (see below). RTL languages are supported.
    … …  
    91118Yes. Copy a file from the plugin's `templates/` folder to `your-theme/family-tree/` and edit it there.
    92119
     120= Are hidden contacts still in the page source? =
     121
     122No. When "Contacts" is switched off for a chart, the contacts are not printed on the cards at all, so they cannot be read from the page source. They still show in the profile popup of members who have a full profile.
     123
     124= Who can manage charts? =
     125
     126Administrators (the `manage_options` capability). Change it with the `ftree_6310_capability` filter.
     127
     128= Developer hooks =
     129
     130* `ftree_6310_capability` – capability needed to manage charts, templates, settings and export / import.
     131* `ftree_6310_templates` – add or change templates.
     132* `ftree_6310_style_fields`, `ftree_6310_style_groups` – customizer fields and tabs.
     133* `ftree_6310_member_data` – member data passed to the templates.
     134* `ftree_6310_social_networks`, `ftree_6310_contact_types` – available social networks and contact types.
     135* `ftree_6310_template_path` – path of a template file.
     136* `ftree_6310_card_skills_limit` – number of skills shown on a card (default 3).
     137* `ftree_6310_structured_data` – the chart's JSON-LD (return an empty value to skip it).
     138* `ftree_6310_search_enabled` – turn the site search integration on or off.
     139* `ftree_6310_chart_saved` (action) – fires after a chart is saved.
     140
    93141= What happens to my data if I delete the plugin? =
    94142
    … …  
    97145== Screenshots ==
    98146
    99 1. A family tree on the front end.
    100 2. The profile popup.
    101 3. The tree builder on the Members tab.
    102 4. The live style customizer.
    103 5. Templates and shortcodes.
    104 6. The mobile layout.
     1471. An organization chart on the front end, with skills, social icons, zoom and full screen buttons.
     1482. The profile popup with picture, contacts, skills and the full profile.
     1493. Side panel popup style (Pro). Full screen and bottom sheet styles are also included.
     1504. On phones the chart becomes an easy-to-read indented list.
     1515. The drag-and-drop tree builder with a live preview.
     1526. The live style customizer: show or hide parts, colors, fonts, spacing and more.
     1537. Templates & Shortcodes: your charts and 6 ready-made templates.
     1548. The members list with picture, designation and the charts each member is used in.
    105155
    106156== External services ==
    … …  
    128178== Changelog ==
    129179= 1.1 =
    130 * More feature added.
     180* New: profile popup styles (side panel, full screen, bottom sheet), Settings page for the popup close button and loading indicator, zoom and full screen buttons.
     181* New: Export / Import of members, charts and settings.
     182* New: schema.org structured data and site search (and Relevanssi) integration.
     183* New: WPML and Polylang support.
     184* New: free demo key for trying Pro.
     185* New: "Your shortcodes" list is now shown at the top of the Templates & Shortcodes page.
     186* Security: contacts switched off for a chart are no longer printed (hidden) in the page source.
     187* Security: the text of password-protected member profiles can no longer be found through site search.
     188* Security: members can no longer be listed by visitors through the REST API (`/wp/v2/ftree_6310_member`).
    131189
    132190= 1.0 =
Note: See TracChangeset for help on using the changeset viewer.