Plugin Directory

Changeset 3822889


Ignore:
Timestamp:
11/25/2026 01:11:51 PM (11 hours ago)
Author:
phoenixsuperstar
Message:

PageNod 1.53.0

Location:
pagenod
Files:
20 added
32 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pagenod/tags/1.53.0/assets/css/reports.css

    r3813122 r3822889  
    136136.summary {
    137137        display: grid;
    138         grid-template-columns: repeat(5, minmax(0, 1fr));
     138        grid-template-columns: repeat(6, minmax(0, 1fr));
    139139        gap: 10px;
    140140        margin-bottom: 18px;
    … …  
    11121112        }
    11131113
    1114         .summary .stat:first-child {
     1114        .summary .stat:first-child,
     1115        .summary .stat:last-child {
    11151116                grid-column: 1 / -1;
    11161117        }
  • pagenod/tags/1.53.0/assets/js/reports.js

    r3813122 r3822889  
    22        var L10N = pagenodReports.L10N;
    33        var pg = document.getElementById('pg');
    4         // Status filter: one status at a time (or "All"); on load, the open reports.
     4        // Status filter: one status at a time, "To do" (everything not resolved) or "All"; on load, "To do".
    55        // An empty set means "All".
    6         var filter = { open: 1 }, q = document.getElementById('q'), who = document.getElementById('who'), cards = document.querySelectorAll('.card'), none = document.getElementById('none');
     6        var filter = { active: 1 }, q = document.getElementById('q'), who = document.getElementById('who'), cards = document.querySelectorAll('.card'), none = document.getElementById('none');
    77        // Filters are remembered (per tab) so that returning from a detail finds the list as it was left.
    88        var sort = document.getElementById('sort'), tagf = document.getElementById('tagf'), asgf = document.getElementById('asgf');
    … …  
    6666                if (r && r.indexOf(location.origin) === 0 && r.indexOf('pagenod_view=') !== -1 && !/[?&]report=/.test(r) && history.length > 1) { e.preventDefault(); history.back(); }
    6767        });
     68        function inStatus(s) { return !Object.keys(filter).length || (filter.active ? s !== 'done' : !!filter[s]); }
     69        // The numbers in the drop-down menus count the reports in the chosen status (the row at the top).
     70        var facets = [
     71                [pg, function (c, v) { return v.indexOf('type:') === 0 ? c.dataset.type === v.slice(5) : c.dataset.page === v; }],
     72                [who, function (c, v) { return c.dataset.who === v; }],
     73                [tagf, function (c, v) { return v === '-' ? (c.dataset.tags || '||') === '||' : (c.dataset.tags || '').indexOf('|' + v + '|') !== -1; }],
     74                [asgf, function (c, v) { return (c.dataset.asg || '').indexOf('|' + v + '|') !== -1; }]
     75        ].filter(function (f) { return f[0]; });
     76        var NUM = /\s*\(([\d.,\s\u00a0\u202f]+)\)$/;
     77        facets.forEach(function (f) {
     78                [].forEach.call(f[0].options, function (o) { if (o.value && NUM.test(o.text)) o.dataset.base = o.text.replace(NUM, ''); });
     79        });
     80        function facetCounts() {
     81                var sc = [].filter.call(cards, function (c) { return inStatus(c.dataset.status); });
     82                facets.forEach(function (f) {
     83                        [].forEach.call(f[0].options, function (o) {
     84                                if (o.dataset.base === undefined) return;
     85                                var n = 0;
     86                                sc.forEach(function (c) { if (f[1](c, o.value)) n++; });
     87                                o.text = o.dataset.base + ' (' + n.toLocaleString() + ')';
     88                        });
     89                });
     90        }
    6891        function apply() {
    6992                if (!cards.length) return;
    7093                save();
     94                facetCounts();
    7195                var term = q ? q.value.trim().toLowerCase() : '', person = who ? who.value : '', page = pg ? pg.value : '', tg = tagf ? tagf.value : '', ag = asgf ? asgf.value : '', shown = 0, counts = { '': 0 };
    7296                cards.forEach(function (c) {
    … …  
    77101                        var mine = (!person || c.dataset.who === person) && onPage && onTag && onAsg;
    78102                        // The counters at the top follow the chosen reporter and page.
    79                         if (mine) { counts[''] ++; counts[c.dataset.status] = (counts[c.dataset.status] || 0) + 1; }
    80                         var ok = mine && (!Object.keys(filter).length || filter[c.dataset.status]) && (!term || c.dataset.search.indexOf(term) !== -1);
     103                        if (mine) { counts[''] ++; counts[c.dataset.status] = (counts[c.dataset.status] || 0) + 1; if (c.dataset.status !== 'done') counts.active = (counts.active || 0) + 1; }
     104                        var ok = mine && inStatus(c.dataset.status) && (!term || c.dataset.search.indexOf(term) !== -1);
    81105                        c.hidden = !ok;
    82106                        if (ok) shown++;
  • pagenod/tags/1.53.0/assets/pagenod.css

    r3816747 r3822889  
    34953495}
    34963496
     3497/* The element is in the page but cannot be seen now (another slide, a closed tab): pin in transparency. */
     3498#pagenod-root .pagenod-pin.is-off,
     3499#pagenod-root .pagenod-tpin.is-off {
     3500        opacity: .3;
     3501        transition: opacity .2s ease;
     3502}
     3503
     3504#pagenod-root .pagenod-pin.is-off:hover,
     3505#pagenod-root .pagenod-pin.is-off:focus-visible,
     3506#pagenod-root .pagenod-pin.is-off.is-active,
     3507#pagenod-root .pagenod-tpin.is-off:hover,
     3508#pagenod-root .pagenod-tpin.is-off:focus-visible,
     3509#pagenod-root .pagenod-tpin.is-off.is-active {
     3510        opacity: 1;
     3511}
     3512
    34973513#pagenod-root .pagenod-tpop {
    34983514        width: min(360px, calc(100vw - 16px));
  • pagenod/tags/1.53.0/assets/pagenod.js

    r3816747 r3822889  
    15211521                // Places chosen after the question "where?" (same text in several contents).
    15221522                var pick = ed.tools.querySelector('.pagenod-edit-places input:checked');
    1523                 if (pick) (pick.value === '*' ? ed.keys : [pick.value]).forEach(function (k) { fd.append('only[]', k); });
     1523                if (pick && pick.value === 'one' && ed.one) {
     1524                        fd.append('only[]', ed.one.k);
     1525                        fd.append('one', JSON.stringify({ nth: ed.one.nth, of: ed.one.of }));
     1526                } else if (pick) (pick.value === '*' ? ed.keys : [pick.value]).forEach(function (k) { fd.append('only[]', k); });
    15241527                fetch(cfg.ajaxUrl, { method: 'POST', body: fd, credentials: 'same-origin' })
    15251528                        .then(function (x) { return x.json().catch(function () { throw new Error(t('invalidResponse', x.status)); }); })
    … …  
    15851588                                info.textContent = t('editWhere', d.choices[0].l);
    15861589                        } else if (d.choices.length === 1) {
    1587                                 // Several times in the same content (e.g. two titles of the page): they change together.
    1588                                 ed.spots = spotsShow(pageSpots(ed.orig, ed.el));
    1589                                 info.textContent = t('editAllSpots', d.total);
    1590                                 info.classList.add('is-warn');
     1590                                // Several times in the same content (e.g. a placeholder text used in two blocks):
     1591                                // only the one being edited, or all of them.
     1592                                info.remove();
     1593                                editScope(ed, d);
    15911594                        } else {
    15921595                                info.remove();
    … …  
    16011604                ed.spots = spotsShow(pageSpots(ed.orig, ed.el));
    16021605                ed.keys = d.choices.map(function (c) { return c.k; });
    1603                 var here = d.choices.filter(function (c) { return c.on; })[0];
    1604                 var opts = here
    1605                         ? '<label><input type="radio" name="pagenod-scope" value="' + esc(here.k) + '" checked> ' + th('editOnlyHere') + ' <small>' + esc(here.l) + '</small></label>'
    1606                         : d.choices.map(function (c) { return '<label><input type="radio" name="pagenod-scope" value="' + esc(c.k) + '"> ' + th('editOnlyIn', esc(c.l)) + '</label>'; }).join('');
     1606                var single = d.choices.length === 1;
     1607                var here = single ? d.choices[0] : d.choices.filter(function (c) { return c.on; })[0];
     1608                // The text is more than once in the content of this page: "only this one" changes just
     1609                // the place being edited (number shown on the page), the others stay as they are.
     1610                ed.one = null;
     1611                if (here && here.n > 1) {
     1612                        var dom = pageSpots(ed.orig), at = -1;
     1613                        dom.forEach(function (c, i) { if (at < 0 && (c === ed.el || c.contains(ed.el) || ed.el.contains(c))) at = i; });
     1614                        var num = ed.spots ? ed.spots.indexOf(ed.el) + 1 : 1;
     1615                        ed.one = { k: here.k, nth: at, of: dom.length };
     1616                }
     1617                var oneOpt = ed.one ? '<label><input type="radio" name="pagenod-scope" value="one" checked> ' + th('editOnlyThis', num || 1) + '</label>' : '';
     1618                var opts = single
     1619                        ? oneOpt
     1620                        : here
     1621                                ? oneOpt + '<label><input type="radio" name="pagenod-scope" value="' + esc(here.k) + '"' + (ed.one ? '' : ' checked') + '> ' + th('editOnlyHere') + ' <small>' + esc(here.l) + '</small></label>'
     1622                                : d.choices.map(function (c) { return '<label><input type="radio" name="pagenod-scope" value="' + esc(c.k) + '"> ' + th('editOnlyIn', esc(c.l)) + '</label>'; }).join('');
    16071623                var seen = ed.spots && ed.spots.length > 1 ? ' <small>' + esc(t('spotsMarked', ed.spots.length)) + '</small>' : '';
    1608                 var box = el('fieldset', { class: 'pagenod-edit-places' }, '<legend>' + th('editMany', d.total) + seen + '</legend>' + opts +
    1609                         '<label><input type="radio" name="pagenod-scope" value="*"> ' + th('editEverywhere', d.total) + '</label>');
     1624                var box = el('fieldset', { class: 'pagenod-edit-places' }, '<legend>' + th(single ? 'editManyHere' : 'editMany', d.total) + seen + '</legend>' + opts +
     1625                        '<label><input type="radio" name="pagenod-scope" value="*"> ' + th(single ? 'editAllSpotsOpt' : 'editEverywhere', d.total) + '</label>');
    16101626                ed.tools.insertBefore(box, ed.tools.querySelector('.pagenod-edit-msg'));
    16111627                var msgEl = ed.tools.querySelector('.pagenod-edit-msg');
    … …  
    18731889                return p.node;
    18741890        }
     1891        // Whether the element can be seen now: not made invisible (another slide of a slider, a closed tab)
     1892        // and the point (x, y) not cut off by a container that clips its content (a carousel's other slides).
     1893        function seen(n, x, y) {
     1894                if (getComputedStyle(n).visibility === 'hidden') return false;
     1895                for (var a = n; a && a.nodeType === 1 && a !== document.body; a = a.parentElement) {
     1896                        var cs = getComputedStyle(a);
     1897                        if (parseFloat(cs.opacity) < 0.1) return false;
     1898                        if (a === n) continue;
     1899                        var cx = cs.overflowX !== 'visible', cy = cs.overflowY !== 'visible';
     1900                        if (!cx && !cy) continue;
     1901                        var r = a.getBoundingClientRect();
     1902                        if (cx && (x < r.left - 2 || x > r.right + 2)) return false;
     1903                        if (cy && (y < r.top - 2 || y > r.bottom + 2)) return false;
     1904                }
     1905                return true;
     1906        }
    18751907        // Position on screen: on the element if it is there, otherwise where it was in the page.
    18761908        function where(p) {
    18771909                var n = target(p);
     1910                p.off = false;
    18781911                if (n) {
    18791912                        var r = n.getBoundingClientRect();
    18801913                        if (!r.width && !r.height) return null; // element hidden at this window size
    18811914                        p.approx = false;
    1882                         return { x: r.left + p.x * r.width, y: r.top + p.y * r.height };
     1915                        var w = { x: r.left + p.x * r.width, y: r.top + p.y * r.height };
     1916                        p.off = !seen(n, w.x, w.y);
     1917                        return w;
    18831918                }
    18841919                p.approx = true;
    … …  
    18911926                if (!out) b.style.transform = 'translate(' + Math.round(w.x) + 'px,' + Math.round(w.y) + 'px)';
    18921927                b.classList.toggle('is-approx', !!p.approx);
     1928                b.classList.toggle('is-off', !out && !!p.off);
    18931929                if (pinPop && pinPop._p === p) posPop(p);
    18941930        }
    … …  
    20432079        function tpPlace(p) {
    20442080                var b = p.btn, w = null;
     2081                p.off = false;
    20452082                if (tpOn) {
    20462083                        var n = tpTarget(p);
    20472084                        if (n) {
    20482085                                var r = n.getBoundingClientRect();
    2049                                 if (r.width || r.height) { w = { x: r.left, y: r.top }; p.approx = false; }
     2086                                if (r.width || r.height) {
     2087                                        w = { x: r.left, y: r.top }; p.approx = false;
     2088                                        p.off = !seen(n, r.left + Math.min(r.width / 2, 20), r.top + Math.min(r.height / 2, 10));
     2089                                }
    20502090                        } else if (p.vw) {
    20512091                                w = { x: p.px * window.innerWidth / (p.vw || window.innerWidth) - window.scrollX, y: p.py - window.scrollY };
    … …  
    20572097                if (!out) b.style.transform = 'translate(' + Math.round(w.x) + 'px,' + Math.round(w.y) + 'px)';
    20582098                b.classList.toggle('is-approx', !!p.approx);
     2099                b.classList.toggle('is-off', !out && !!p.off);
    20592100                if (pinPop && pinPop._p === p) posPop(p);
    20602101        }
  • pagenod/tags/1.53.0/includes/cloud.php

    r3817969 r3822889  
    8484 * @return true|WP_Error
    8585 */
    86 function pagenod_cloud_connect( $code ) {
     86/**
     87 * Connects the site with a code from the console. $ai: the AI assistant switches chosen when connecting
     88 * (array with read, write, files; null = leave them to the console). The console applies only what the
     89 * person who created the code could turn on there, and from then on they are changed in the console.
     90 */
     91function pagenod_cloud_connect( $code, $ai = null ) {
    8792        $parts = pagenod_cloud_decode_code( $code );
    8893        if ( ! $parts ) {
    … …  
    9297                'timeout' => 20,
    9398                'headers' => array( 'Content-Type' => 'application/json', 'Accept' => 'application/json' ),
    94                 'body'    => wp_json_encode( array_merge( array( 'code' => trim( (string) $code ) ), pagenod_cloud_site_info() ) ),
     99                'body'    => wp_json_encode( array_merge(
     100                        array( 'code' => trim( (string) $code ) ),
     101                        pagenod_cloud_site_info(),
     102                        is_array( $ai ) ? array( 'ai' => array_map( 'boolval', array_intersect_key( $ai + array( 'read' => false, 'write' => false, 'files' => false ), array_flip( array( 'read', 'write', 'files' ) ) ) ) ) : array()
     103                ) ),
    95104        ) );
    96105        if ( is_wp_error( $res ) ) {
    … …  
    113122                'last_error'   => '',
    114123                'mute_team'    => 1, // the team gets one digest for all sites from the console
     124                'settings_url' => esc_url_raw( (string) ( $body['settings_url'] ?? '' ) ), // where the AI assistant switches are changed
     125                'ai'           => is_array( $body['ai'] ?? null ) ? pagenod_cloud_ai_choice( $body['ai'] ) : null, // as applied when connecting
    115126        ), false );
    116127
    … …  
    119130        pagenod_cloud_schedule( true );
    120131        return true;
     132}
     133
     134/** The AI assistant switches as the console applied them when connecting. */
     135function pagenod_cloud_ai_choice( $ai ) {
     136        $skipped = array_values( array_intersect( array_map( 'strval', (array) ( $ai['skipped'] ?? array() ) ), array( 'read', 'write', 'files' ) ) );
     137        return array(
     138                'read'    => ! empty( $ai['read'] ),
     139                'write'   => ! empty( $ai['write'] ),
     140                'files'   => ! empty( $ai['files'] ),
     141                'skipped' => $skipped,
     142                'reason'  => sanitize_key( (string) ( $ai['reason'] ?? '' ) ),
     143        );
     144}
     145
     146/** Labels of the AI assistant switches, as in the console. */
     147function pagenod_cloud_ai_labels() {
     148        return array(
     149                'read'  => __( 'Reading', 'pagenod' ),
     150                'write' => __( 'Changes', 'pagenod' ),
     151                'files' => __( 'Theme and plugin files', 'pagenod' ),
     152        );
     153}
     154
     155/** What the console turned on when connecting and, if something was not turned on, why. */
     156function pagenod_cloud_ai_summary( $ai ) {
     157        if ( ! is_array( $ai ) ) {
     158                return '';
     159        }
     160        $labels = pagenod_cloud_ai_labels();
     161        $on     = array();
     162        foreach ( $labels as $key => $label ) {
     163                if ( ! empty( $ai[ $key ] ) ) {
     164                        $on[] = $label;
     165                }
     166        }
     167        /* translators: %s: list of switches, e.g. "Reading, Changes" */
     168        $text = $on ? sprintf( __( 'AI assistant: %s turned on.', 'pagenod' ), implode( ', ', $on ) ) : __( 'AI assistant: everything turned off.', 'pagenod' );
     169        if ( ! empty( $ai['skipped'] ) ) {
     170                $names = implode( ', ', array_intersect_key( $labels, array_flip( $ai['skipped'] ) ) );
     171                $why   = array(
     172                        'second_factor' => __( 'whoever created the connection code must first turn on two-step verification in the console', 'pagenod' ),
     173                        'owner'         => __( 'the connection code was not created by an owner of the agency', 'pagenod' ),
     174                        'plan'          => __( 'the plan of the agency does not include the AI assistant', 'pagenod' ),
     175                );
     176                /* translators: 1: list of switches, 2: reason */
     177                $text .= ' ' . sprintf( __( 'Not applied: %1$s, because %2$s. They can be turned on in the console.', 'pagenod' ), $names, $why[ $ai['reason'] ] ?? __( 'the console did not allow it', 'pagenod' ) );
     178        }
     179        return $text;
    121180}
    122181
    … …  
    143202                pagenod_cloud_enqueue_many( 'message', $msgs );
    144203        }
     204        pagenod_cloud_users_backfill();
    145205        pagenod_cloud_enqueue_many( 'site', array( 1 ) );
    146206}
    … …  
    265325                'timezone'       => wp_timezone_string(),
    266326                'command_url'    => rest_url( 'pagenod/v1/cloud' ),
     327                'ai_tools'       => pagenod_cloud_ai_tools(),
     328                // WordPress folder on the server: suggested in the console for the optional SSH mode (never sent to the AI by the site)
     329                'wp_path'        => untrailingslashit( ABSPATH ),
    267330        );
    268331}
    … …  
    469532                        } elseif ( 'page' === $r->type ) {
    470533                                $events[] = pagenod_cloud_page_event( $r->obj_id );
     534                        } elseif ( 'user' === $r->type ) {
     535                                $events[] = pagenod_cloud_user_event( $r->obj_id );
    471536                        } else {
    472537                                $events[] = array( 'type' => 'site.info', 'data' => pagenod_cloud_site_info() );
    … …  
    564629}
    565630
    566 /* Site details (name, versions…) sent again once a day. */
     631/* Site details (name, versions…) sent again once a day, and at once after an update of PageNod. */
    567632add_action( 'pagenod_cloud_daily', function () {
    568633        pagenod_cloud_enqueue( 'site', 1 );
     634} );
     635add_action( 'init', function () {
     636        if ( pagenod_cloud_connected() && PAGENOD_VERSION !== get_option( 'pagenod_cloud_info_v' ) ) {
     637                update_option( 'pagenod_cloud_info_v', PAGENOD_VERSION, false );
     638                pagenod_cloud_enqueue( 'site', 1 );
     639        }
    569640} );
    570641add_action( 'init', function () {
    … …  
    657728 * reach the client as usual. A command already run (same id) is not run again.
    658729 *
    659  * act: { report_id, message?, side? (team|note), status?, author: { name, email } }
     730 * act: { report_id, message?, side? (team|note), status?, tags? (list of names: replaces the tags),
     731 *        assign? (WordPress user ID of a collaborator or team member, 0 = nobody), assign_client? (bool),
     732 *        delete_note? (comment ID of an internal note of this report), author: { name, email } }
    660733 * @return array( 'id', 'ok', 'error'?, 'events'? )
    661734 */
    … …  
    664737        $data = is_array( $cmd ) && is_array( $cmd['data'] ?? null ) ? $cmd['data'] : array();
    665738        $out  = array( 'id' => $id, 'ok' => false );
     739        if ( '' !== $id && 'user' === ( $cmd['type'] ?? '' ) ) {
     740                return array_merge( $out, pagenod_cloud_user_execute( $id, $data ) );
     741        }
     742        if ( '' !== $id && 'ai' === ( $cmd['type'] ?? '' ) ) {
     743                return array_merge( $out, pagenod_cloud_ai_execute( $data ) ); // tools for Claude: read only, nothing to remember
     744        }
    666745        if ( '' === $id || 'act' !== ( $cmd['type'] ?? '' ) ) {
    667746                $out['error'] = 'unknown_command';
    … …  
    684763                        return $out;
    685764                }
    686                 if ( '' === trim( $text ) && '' === $status ) {
     765                // Tags: the whole list, chosen by the agency team in the console (team only, like in the plugin).
     766                $tags = null;
     767                if ( isset( $data['tags'] ) && is_array( $data['tags'] ) ) {
     768                        $tags = array();
     769                        foreach ( $data['tags'] as $n ) {
     770                                $n = mb_substr( trim( sanitize_text_field( (string) $n ) ), 0, 40 );
     771                                if ( '' !== $n ) {
     772                                        $tags[] = $n;
     773                                }
     774                        }
     775                        $tags = array_values( array_unique( $tags ) );
     776                }
     777                // Assignment chosen in the console: only people who can be assigned on the site (collaborators, team).
     778                $assign = null;
     779                if ( array_key_exists( 'assign', $data ) ) {
     780                        $assign = absint( $data['assign'] );
     781                        if ( $assign && ! pagenod_can_be_assigned( get_userdata( $assign ) ) ) {
     782                                $out['error'] = 'invalid_assignee';
     783                                return $out;
     784                        }
     785                }
     786                // Internal note deleted from the console: only notes (never messages the client sees) of this report.
     787                $delete_note = absint( $data['delete_note'] ?? 0 );
     788                if ( $delete_note ) {
     789                        $note = get_comment( $delete_note );
     790                        if ( ! $note ) {
     791                                $delete_note = 0; // already gone: nothing to do, not an error (the command may arrive twice)
     792                        } elseif ( (int) $note->comment_post_ID !== $report || 'note' !== pagenod_msg_side( $note ) ) {
     793                                $out['error'] = 'not_a_note';
     794                                return $out;
     795                        }
     796                }
     797                $gone = $delete_note ? 0 : absint( $data['delete_note'] ?? 0 );
     798                if ( '' === trim( $text ) && '' === $status && null === $tags && null === $assign && ! $delete_note && ! $gone ) {
    687799                        $out['error'] = 'nothing_to_do';
    688800                        return $out;
    … …  
    712824                        update_post_meta( $report, '_pagenod_status', $status );
    713825                }
     826                if ( null !== $assign ) {
     827                        pagenod_assign( $report, $assign, $assign && ! empty( $data['assign_client'] ) );
     828                }
     829                if ( $delete_note ) {
     830                        wp_delete_comment( $delete_note, true );
     831                }
     832                if ( null !== $tags ) {
     833                        $res = wp_set_post_terms( $report, $tags, PAGENOD_TAG_TAX, false );
     834                        if ( is_wp_error( $res ) ) {
     835                                wp_set_current_user( $prev );
     836                                $out['error'] = 'tags_failed';
     837                                return $out;
     838                        }
     839                }
    714840                wp_set_current_user( $prev );
    715841
    716                 $done[ $id ] = time();
    717                 if ( count( $done ) > 300 ) {
    718                         asort( $done );
    719                         $done = array_slice( $done, -300, null, true );
    720                 }
    721                 update_option( 'pagenod_cloud_done', $done, false );
     842                pagenod_cloud_mark_done( $id );
    722843        }
    723844
    724845        // The new state goes back at once, so the console shows it without waiting for the queue.
    725846        $events = array( pagenod_cloud_report_event( $report ) );
     847        if ( ! empty( $data['delete_note'] ) ) {
     848                $events[] = array( 'type' => 'message.delete', 'data' => array( 'id' => absint( $data['delete_note'] ) ) );
     849        }
    726850        foreach ( get_comments( array( 'post_id' => $report, 'type' => array( PAGENOD_MSG, 'comment' ), 'status' => 'approve', 'orderby' => 'comment_ID', 'order' => 'DESC', 'number' => 3 ) ) as $c ) {
    727851                $events[] = pagenod_cloud_message_event( $c->comment_ID );
    … …  
    730854        $out['events'] = $events;
    731855        return $out;
     856}
     857
     858/** Remembers the last 300 commands run, so a command delivered twice is not run again. */
     859function pagenod_cloud_mark_done( $id ) {
     860        $done = get_option( 'pagenod_cloud_done', array() );
     861        $done = is_array( $done ) ? $done : array();
     862        $done[ $id ] = time();
     863        if ( count( $done ) > 300 ) {
     864                asort( $done );
     865                $done = array_slice( $done, -300, null, true );
     866        }
     867        update_option( 'pagenod_cloud_done', $done, false );
    732868}
    733869
    … …  
    742878        $notice = 'ok';
    743879        if ( 'connect' === $do ) {
    744                 $r = pagenod_cloud_connect( sanitize_text_field( wp_unslash( $_POST['code'] ?? '' ) ) );
     880                $ai = array(
     881                        'read'  => ! empty( $_POST['ai_read'] ),
     882                        'write' => ! empty( $_POST['ai_write_console'] ),
     883                        'files' => ! empty( $_POST['ai_files'] ),
     884                );
     885                $r  = pagenod_cloud_connect( sanitize_text_field( wp_unslash( $_POST['code'] ?? '' ) ), $ai );
    745886                if ( is_wp_error( $r ) ) {
    746887                        set_transient( 'pagenod_cloud_notice_' . get_current_user_id(), $r->get_error_message(), MINUTE_IN_SECONDS );
    … …  
    754895        } elseif ( 'mute' === $do && pagenod_cloud_connected() ) {
    755896                pagenod_cloud_update( array( 'mute_team' => empty( $_POST['mute_team'] ) ? 0 : 1 ) );
     897                $notice = 'saved';
     898        } elseif ( 'ai_write' === $do ) {
     899                update_option( PAGENOD_CLOUD_AI_WRITE_OPTION, empty( $_POST['ai_write'] ) ? '0' : '1', false );
    756900                $notice = 'saved';
    757901        } elseif ( 'sync' === $do && pagenod_cloud_connected() ) {
    … …  
    774918                        <div class="notice notice-error inline"><p><?php echo esc_html( (string) get_transient( 'pagenod_cloud_notice_' . get_current_user_id() ) ); ?></p></div>
    775919                <?php elseif ( 'connected' === $notice ) : ?>
    776                         <div class="notice notice-success inline"><p><?php esc_html_e( 'Site connected. The existing reports are being sent to the console in the background.', 'pagenod' ); ?></p></div>
     920                        <div class="notice notice-success inline"><p><?php esc_html_e( 'Site connected. The existing reports are being sent to the console in the background.', 'pagenod' ); ?> <?php echo esc_html( pagenod_cloud_ai_summary( $c['ai'] ?? null ) ); ?></p></div>
    777921                <?php elseif ( 'disconnected' === $notice ) : ?>
    778922                        <div class="notice notice-success inline"><p><?php esc_html_e( 'Site disconnected: nothing more is sent to the console.', 'pagenod' ); ?></p></div>
    … …  
    830974                                </tr>
    831975                                <tr>
     976                                        <th scope="row"><?php esc_html_e( 'AI assistant', 'pagenod' ); ?></th>
     977                                        <td>
     978                                                <p class="description"><?php esc_html_e( 'Reading, changes and theme and plugin files for the AI assistant are chosen when connecting; from then on an owner of the agency changes them in the console.', 'pagenod' ); ?></p>
     979                                                <?php if ( ! empty( $c['ai'] ) ) : ?>
     980                                                        <p class="description"><?php echo esc_html( pagenod_cloud_ai_summary( $c['ai'] ) ); ?> <?php esc_html_e( '(when connecting)', 'pagenod' ); ?></p>
     981                                                <?php endif; ?>
     982                                                <p><a class="button" href="<?php echo esc_url( ! empty( $c['settings_url'] ) ? $c['settings_url'] : $c['url'] ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Change in the console', 'pagenod' ); ?></a></p>
     983                                        </td>
     984                                </tr>
     985                                <tr>
     986                                        <th scope="row"><?php esc_html_e( 'Changes by Claude', 'pagenod' ); ?></th>
     987                                        <td>
     988                                                <label><input type="checkbox" name="ai_write" value="1" <?php checked( pagenod_cloud_ai_write_enabled() ); ?>> <?php esc_html_e( 'Allow Claude, connected to PageNod Cloud by the agency, to change texts, pages, CSS, images, menus and custom fields of this site', 'pagenod' ); ?></label>
     989                                                <p class="description"><?php esc_html_e( 'Only when the agency also enables it for this site in the console. Every change can be undone from the console.', 'pagenod' ); ?></p>
     990                                                <p><button type="submit" name="do" value="ai_write" class="button"><?php esc_html_e( 'Save', 'pagenod' ); ?></button></p>
     991                                        </td>
     992                                </tr>
     993                                <?php pagenod_sso_render_settings_row(); ?>
     994                                <tr>
    832995                                        <th scope="row"></th>
    833996                                        <td>
    … …  
    8421005                                                <input type="text" class="large-text code" id="pagenod-cloud-code" name="code" placeholder="PNC1-…" autocomplete="off">
    8431006                                                <p class="description"><?php echo wp_kses_post( __( 'Create the code in the console under <b>Sites → Connect</b>. With WP-CLI: <code>wp pagenod cloud connect &lt;code&gt;</code>', 'pagenod' ) ); ?></p>
     1007                                                <fieldset style="margin-top:14px">
     1008                                                        <legend style="font-weight:600;margin-bottom:6px"><?php esc_html_e( 'AI assistant of the agency on this site', 'pagenod' ); ?></legend>
     1009                                                        <label style="display:block;margin:4px 0"><input type="checkbox" name="ai_read" value="1" checked> <?php esc_html_e( 'Reading: it can look at pages, Elementor structure, menus and the error log', 'pagenod' ); ?></label>
     1010                                                        <label style="display:block;margin:4px 0"><input type="checkbox" name="ai_write_console" value="1"> <?php esc_html_e( 'Changes: it can change texts, pages, CSS, images, menus and custom fields (every change can be undone)', 'pagenod' ); ?></label>
     1011                                                        <label style="display:block;margin:4px 0"><input type="checkbox" name="ai_files" value="1"> <?php esc_html_e( 'Theme and plugin files: it can read the code of themes and plugins and, with Changes, fix it', 'pagenod' ); ?></label>
     1012                                                        <p class="description"><?php esc_html_e( 'Applied when connecting, if whoever created the code could turn them on in the console (Changes also need two-step verification). Afterwards they are changed in the console.', 'pagenod' ); ?></p>
     1013                                                </fieldset>
    8441014                                                <p><button type="submit" name="do" value="connect" class="button button-primary"><?php esc_html_e( 'Connect', 'pagenod' ); ?></button></p>
    8451015                                        </td>
    … …  
    8671037                 * : Connection code (PNC1-…) from the console, under Sites → Connect.
    8681038                 *
    869                  * [--no-sync]
    870                  * : Only connect: the data is sent later by WP-Cron.
     1039                 * [--[no-]sync]
     1040                 * : Send the existing data right away (default). With --no-sync, only connect: the data is sent later by WP-Cron.
     1041                 *
     1042                 * [--ai=<switches>]
     1043                 * : AI assistant of the agency on this site, comma separated: read, write, files; or none.
     1044                 * Applied if whoever created the code could turn them on in the console. Without it the console decides.
     1045                 *
     1046                 * ## EXAMPLES
     1047                 *
     1048                 *     wp pagenod cloud connect PNC1-… --ai=read,write,files
    8711049                 */
    8721050                public function connect( $args, $assoc ) {
    873                         $r = pagenod_cloud_connect( $args[0] );
     1051                        $ai = null;
     1052                        if ( isset( $assoc['ai'] ) ) {
     1053                                $list = array_filter( array_map( 'trim', explode( ',', strtolower( (string) $assoc['ai'] ) ) ) );
     1054                                $bad  = array_diff( $list, array( 'read', 'write', 'files', 'none' ) );
     1055                                if ( $bad ) {
     1056                                        WP_CLI::error( 'Unknown --ai value: ' . implode( ', ', $bad ) . '. Use read, write, files or none.' );
     1057                                }
     1058                                $ai = array(
     1059                                        'read'  => in_array( 'read', $list, true ),
     1060                                        'write' => in_array( 'write', $list, true ),
     1061                                        'files' => in_array( 'files', $list, true ),
     1062                                );
     1063                        }
     1064                        $r = pagenod_cloud_connect( $args[0], $ai );
    8741065                        if ( is_wp_error( $r ) ) {
    8751066                                WP_CLI::error( $r->get_error_message() );
    … …  
    8771068                        $c = pagenod_cloud();
    8781069                        WP_CLI::log( sprintf( 'Connected to %s (%s).', $c['agency'], $c['url'] ) );
    879                         if ( empty( $assoc['no-sync'] ) ) {
     1070                        if ( ! empty( $c['ai'] ) ) {
     1071                                WP_CLI::log( pagenod_cloud_ai_summary( $c['ai'] ) );
     1072                        }
     1073                        if ( WP_CLI\Utils\get_flag_value( $assoc, 'sync', true ) ) {
    8801074                                $this->sync( array(), array() );
    8811075                        }
  • pagenod/tags/1.53.0/includes/console.php

    r3816674 r3822889  
    1212/** Can manage reports and pages: whoever can edit other users' content (editors, administrators). */
    1313function pagenod_can_manage() {
    14         return current_user_can( 'edit_others_posts' );
     14        return current_user_can( 'edit_others_posts' ) || ( function_exists( 'pagenod_sso_is_agent' ) && pagenod_sso_is_agent() );
     15}
     16
     17/** Can add project pages: editors, or the PageNod Cloud account used by the agency team. */
     18function pagenod_can_add_pages() {
     19        return current_user_can( 'publish_posts' ) || ( function_exists( 'pagenod_sso_is_agent' ) && pagenod_sso_is_agent() );
    1520}
    1621
    … …  
    163168
    164169                case 'page_add':
    165                         if ( ! current_user_can( 'publish_posts' ) ) {
     170                        if ( ! pagenod_can_add_pages() ) {
    166171                                wp_send_json_error( array( 'message' => __( 'Permission denied.', 'pagenod' ) ), 403 );
    167172                        }
    … …  
    188193
    189194                case 'pages_import':
    190                         if ( ! current_user_can( 'publish_posts' ) ) {
     195                        if ( ! pagenod_can_add_pages() ) {
    191196                                wp_send_json_error( array( 'message' => __( 'Permission denied.', 'pagenod' ) ), 403 );
    192197                        }
  • pagenod/tags/1.53.0/includes/frontend.php

    r3816747 r3822889  
    315315                'editMany'            => __( 'This text appears in %s places. Where do you want to change it?', 'pagenod' ),
    316316                'editOnlyHere'        => __( 'Only here', 'pagenod' ),
     317                /* translators: %s: number of places */
     318                'editManyHere'        => __( 'This text is in %s places of this content. Where do you want to change it?', 'pagenod' ),
     319                /* translators: %s: number shown on the page next to the text */
     320                'editOnlyThis'        => __( 'Only this one (number %s)', 'pagenod' ),
     321                /* translators: %s: number of places */
     322                'editAllSpotsOpt'     => __( 'In all %s places, marked by numbers', 'pagenod' ),
    317323                /* translators: %s: place where the text is */
    318324                'editOnlyIn'          => __( 'Only in %s', 'pagenod' ),
  • pagenod/tags/1.53.0/includes/guest.php

    r3813122 r3822889  
    5656
    5757function pagenod_guest_login( $user ) {
     58        if ( function_exists( 'pagenod_user_disabled' ) && pagenod_user_disabled( $user ) ) {
     59                wp_die( esc_html__( 'This account has been suspended. Contact the team that manages the site.', 'pagenod' ), '', array( 'response' => 403 ) );
     60        }
    5861        wp_set_current_user( $user->ID );
    5962        wp_set_auth_cookie( $user->ID, true, is_ssl() );
    … …  
    131134
    132135        $existing = get_user_by( 'email', $email );
     136        if ( $existing && function_exists( 'pagenod_user_disabled' ) && pagenod_user_disabled( $existing ) ) {
     137                $data['sent'] = true; // same answer as for any other address: nothing is revealed
     138                return;
     139        }
    133140        if ( $existing ) {
    134141                // Never log in someone else's account from a shared link: the owner of the address confirms by email.
  • pagenod/tags/1.53.0/includes/pages.php

    r3816674 r3822889  
    9595                return '';
    9696        }
     97        // PageNod Cloud account: the name of the team member who is using it now
     98        if ( function_exists( 'pagenod_sso_is_agent' ) && (int) $user->ID === get_current_user_id() && pagenod_sso_is_agent( $user ) && pagenod_sso_actor() ) {
     99                return pagenod_sso_actor()['name'];
     100        }
    97101        $full = trim( $user->first_name . ' ' . $user->last_name );
    98102        return '' !== $full ? $full : $user->user_login;
     103}
     104
     105/** Email of a user (for the PageNod Cloud account: the team member who is using it now). */
     106function pagenod_user_email( $user ) {
     107        if ( function_exists( 'pagenod_sso_is_agent' ) && $user instanceof WP_User && (int) $user->ID === get_current_user_id() && pagenod_sso_is_agent( $user ) && pagenod_sso_actor() ) {
     108                return pagenod_sso_actor()['email'];
     109        }
     110        return $user instanceof WP_User ? $user->user_email : '';
     111}
     112
     113/** Shared PageNod Cloud account: names are the ones saved with each report and message, not the account name. */
     114function pagenod_is_shared_author( $u ) {
     115        return $u && function_exists( 'pagenod_sso_is_agent' ) && pagenod_sso_is_agent( $u );
    99116}
    100117
    … …  
    102119function pagenod_comment_name( $c ) {
    103120        $u = $c->user_id ? get_userdata( (int) $c->user_id ) : false;
    104         return (string) apply_filters( 'pagenod_comment_name', $u ? pagenod_user_name( $u ) : $c->comment_author, $c );
     121        return (string) apply_filters( 'pagenod_comment_name', $u && ! pagenod_is_shared_author( $u ) ? pagenod_user_name( $u ) : $c->comment_author, $c );
    105122}
    106123
    … …  
    109126        $author = (int) get_post_field( 'post_author', $post_id );
    110127        $u      = $author ? get_userdata( $author ) : false;
    111         $name   = $u ? pagenod_user_name( $u ) : trim( preg_replace( '/\s*<[^>]+>/', '', (string) get_post_meta( $post_id, '_pagenod_reporter', true ) ) );
     128        $name   = $u && ! pagenod_is_shared_author( $u ) ? pagenod_user_name( $u ) : trim( preg_replace( '/\s*<[^>]+>/', '', (string) get_post_meta( $post_id, '_pagenod_reporter', true ) ) );
    112129        return (string) apply_filters( 'pagenod_reporter_name', $name, $post_id );
    113130}
    … …  
    417434add_filter( 'views_edit-' . PAGENOD_PAGE_PT, function ( $views ) {
    418435        $views['pagenod_pages_view'] = '<a href="' . esc_url( pagenod_pages_url() ) . '" target="_blank">' . esc_html__( 'Client progress page', 'pagenod' ) . ' ↗</a>';
    419         if ( current_user_can( 'publish_posts' ) ) {
     436        if ( pagenod_can_add_pages() ) {
    420437                $views['pagenod_pages_import'] = '<a href="' . esc_url( pagenod_pages_url() . '#importa' ) . '" target="_blank">' . esc_html__( 'Import site pages', 'pagenod' ) . ' ↗</a>'; // pages are chosen in the dialog on the site
    421438        }
    … …  
    494511add_action( 'admin_post_pagenod_pages_import', function () {
    495512        check_admin_referer( 'pagenod_pages_import' );
    496         if ( ! current_user_can( 'publish_posts' ) ) {
     513        if ( ! pagenod_can_add_pages() ) {
    497514                wp_die( esc_html__( 'Permission denied.', 'pagenod' ) );
    498515        }
  • pagenod/tags/1.53.0/includes/submit.php

    r3813122 r3822889  
    118118
    119119        $user     = wp_get_current_user();
    120         $reporter = pagenod_user_name( $user ) . ' <' . $user->user_email . '>';
     120        $reporter = pagenod_user_name( $user ) . ' <' . pagenod_user_email( $user ) . '>';
    121121
    122122        $post_id = wp_insert_post( array(
  • pagenod/tags/1.53.0/includes/text-apply.php

    r3816747 r3822889  
    863863}
    864864
    865 /** Writes the change in the places found ($loc); returns the log for "Undo", or a WP_Error. */
    866 function pagenod_tx_apply_raw( $o, $n, $loc, $only = array() ) {
     865/**
     866 * Calls $fn only on the texts inside the Elementor element $eid (its settings and children).
     867 */
     868function pagenod_tx_walk_el( &$v, $eid, $fn, $inside = false ) {
     869        if ( ! is_array( $v ) ) {
     870                if ( $inside && is_string( $v ) ) {
     871                        $r = $fn( $v );
     872                        if ( is_string( $r ) ) {
     873                                $v = $r;
     874                        }
     875                }
     876                return;
     877        }
     878        if ( ! $inside && isset( $v['id'], $v['elType'] ) && $v['id'] === $eid ) {
     879                $inside = true;
     880        }
     881        foreach ( $v as &$x ) {
     882                pagenod_tx_walk_el( $x, $eid, $fn, $inside );
     883        }
     884        unset( $x );
     885}
     886
     887/**
     888 * Writes the change in the places found ($loc); returns the log for "Undo", or a WP_Error.
     889 * $one: only one of the times the text is in the same content, array( 'eid' => Elementor widget
     890 * clicked, 'nth' => its position among the places on the page, 'of' => how many places the page shows).
     891 */
     892function pagenod_tx_apply_raw( $o, $n, $loc, $only = array(), $one = null ) {
    867893        if ( ! $loc['total'] ) {
    868894                return new WP_Error( 'missing', $loc['done'] ? __( 'The new text is already on the site.', 'pagenod' ) : __( 'The original text was not found in the site content: change it by hand.', 'pagenod' ) );
    … …  
    880906        $new   = pagenod_tx_norm( $n );
    881907        $items = array();
     908        if ( $one ) {
     909                if ( 1 !== count( $hits ) || ! empty( $hits[0][0]['eldef'] ) ) {
     910                        return new WP_Error( 'one', __( 'Only this place cannot be changed safely: choose all the places, or change it by hand.', 'pagenod' ) );
     911                }
     912                $whole = ! empty( $loc['whole'] );
     913                $match = function ( $s ) use ( $orig, $whole ) {
     914                        $proj = pagenod_tx_project( $s );
     915                        $ats  = pagenod_tx_find( $proj, $orig );
     916                        return ! $ats || ( $whole && ! pagenod_tx_whole( $proj, $orig ) ) ? array() : $ats;
     917                };
     918                $check = function ( $s ) use ( $new ) {
     919                        return '' === $new || (bool) pagenod_tx_find( pagenod_tx_project( $s ), $new );
     920                };
     921                $src = $hits[0][0];
     922                $raw = pagenod_tx_raw( $src );
     923                list( $val, $fmt ) = pagenod_tx_decode( $raw );
     924                $ok   = true;
     925                $done = 0;
     926                $eid  = (string) ( $one['eid'] ?? '' );
     927                // Elementor: the widget that was clicked, if the text is there and not in all of them.
     928                if ( '' !== $eid && 'json' === $fmt ) {
     929                        $in = 0;
     930                        pagenod_tx_walk_el( $val, $eid, function ( $s ) use ( $match, &$in ) {
     931                                $in += count( $match( $s ) );
     932                                return null;
     933                        } );
     934                        if ( $in && $in < (int) $hits[0][1] ) {
     935                                pagenod_tx_walk_el( $val, $eid, function ( $s ) use ( $match, $check, $orig, $new, &$ok, &$done ) {
     936                                        $ats = $match( $s );
     937                                        if ( ! $ats ) {
     938                                                return null;
     939                                        }
     940                                        $proj = pagenod_tx_project( $s );
     941                                        foreach ( array_reverse( $ats ) as $at ) {
     942                                                $s    = pagenod_tx_rewrite( $s, $proj, $at, $orig, $new );
     943                                                $proj = pagenod_tx_project( $s );
     944                                                $done++;
     945                                        }
     946                                        $ok = $ok && $check( $s );
     947                                        return $s;
     948                                } );
     949                        }
     950                }
     951                // Otherwise its position: the page must show exactly the times the text is stored.
     952                if ( ! $done ) {
     953                        $nth = (int) ( $one['nth'] ?? -1 );
     954                        if ( $nth < 0 || (int) ( $one['of'] ?? 0 ) !== (int) $hits[0][1] ) {
     955                                return new WP_Error( 'one', __( 'Only this place cannot be changed safely: choose all the places, or change it by hand.', 'pagenod' ) );
     956                        }
     957                        $i = 0;
     958                        pagenod_tx_walk( $val, function ( $s ) use ( $match, $check, $orig, $new, $nth, &$i, &$ok, &$done ) {
     959                                $ats = $match( $s );
     960                                if ( ! $ats ) {
     961                                        return null;
     962                                }
     963                                $hit = $nth - $i;
     964                                $i  += count( $ats );
     965                                if ( $hit < 0 || $hit >= count( $ats ) ) {
     966                                        return null;
     967                                }
     968                                $s = pagenod_tx_rewrite( $s, pagenod_tx_project( $s ), $ats[ $hit ], $orig, $new );
     969                                $done++;
     970                                $ok = $ok && $check( $s );
     971                                return $s;
     972                        } );
     973                }
     974                $after = pagenod_tx_encode( $val, $fmt );
     975                if ( ! $ok || 1 !== $done || ! is_string( $after ) || $after === $raw ) {
     976                        return new WP_Error( 'one', __( 'Only this place cannot be changed safely: choose all the places, or change it by hand.', 'pagenod' ) );
     977                }
     978                $hits  = array();
     979                $items = array( array( 'src' => $src, 'before' => $raw, 'after' => $after ) );
     980        }
    882981        foreach ( $hits as $h ) {
    883982                $src  = $h[0];
    … …  
    9381037                't'     => time(),
    9391038                'who'   => pagenod_user_name( wp_get_current_user() ),
     1039                'one'   => (bool) $one,
    9401040                'items' => array_map( function ( $it ) {
    9411041                        return array( 'src' => $it['src'], 'before' => $it['before'], 'md5' => md5( $it['after'] ) );
    … …  
    9461046/** How many times the text was in the places changed (the log of pagenod_tx_apply_raw). */
    9471047function pagenod_tx_log_count( $loc, $log ) {
     1048        if ( ! empty( $log['one'] ) ) {
     1049                return 1;
     1050        }
    9481051        $keys = array_map( function ( $it ) { return pagenod_tx_src_key( $it['src'] ); }, (array) ( $log['items'] ?? array() ) );
    9491052        $n    = 0;
    … …  
    12461349                }
    12471350        }
    1248         $log = pagenod_tx_apply_raw( $o, $n, $loc, $only );
     1351        // Only the place being edited, when the text is more than once in the same content.
     1352        $one = null;
     1353        $raw = json_decode( sanitize_text_field( wp_unslash( $_POST['one'] ?? '' ) ), true );
     1354        if ( is_array( $raw ) && 1 === count( $only ) ) {
     1355                $one = array(
     1356                        'eid' => sanitize_key( wp_unslash( $_POST['eid'] ?? '' ) ),
     1357                        'nth' => (int) ( $raw['nth'] ?? -1 ),
     1358                        'of'  => (int) ( $raw['of'] ?? 0 ),
     1359                );
     1360        }
     1361        $log = pagenod_tx_apply_raw( $o, $n, $loc, $only, $one );
    12491362        if ( is_wp_error( $log ) ) {
    12501363                wp_send_json_error( array( 'message' => $log->get_error_message() ), 400 );
  • pagenod/tags/1.53.0/includes/thread.php

    r3813122 r3822889  
    6767                'comment_type'         => 'note' === $side ? 'comment' : PAGENOD_MSG,
    6868                'comment_author'       => $name,
    69                 'comment_author_email' => $user && $user->exists() ? $user->user_email : '',
     69                'comment_author_email' => $user && $user->exists() ? pagenod_user_email( $user ) : '',
    7070                'user_id'              => $user && $user->exists() ? $user->ID : 0,
    7171                'comment_approved'     => 1,
  • pagenod/tags/1.53.0/includes/view.php

    r3816674 r3822889  
    163163
    164164        <div class="summary" role="group" aria-label="<?php esc_attr_e( 'Filter by status', 'pagenod' ); ?>">
     165                <?php /* "To do" (everything not resolved) comes first and is the default, "All" goes last, as in PageNod Cloud. */ ?>
     166                <button type="button" class="stat s-active" data-filter="active" aria-pressed="true"><b><?php echo (int) ( count( $posts ) - $counts['done'] ); ?></b><span><?php echo esc_html_x( 'To do', 'reports status filter', 'pagenod' ); ?></span></button>
     167                <?php foreach ( $statuses as $key => $label ) : ?>
     168                        <button type="button" class="stat s-<?php echo esc_attr( $key ); ?>" data-filter="<?php echo esc_attr( $key ); ?>" aria-pressed="false"><b><?php echo (int) $counts[ $key ]; ?></b><span><?php echo esc_html( $label ); ?></span></button>
     169                <?php endforeach; ?>
    165170                <button type="button" class="stat" data-filter="" aria-pressed="false"><b><?php echo count( $posts ); ?></b><span><?php echo esc_html_x( 'All', 'reports status filter', 'pagenod' ); ?></span></button>
    166                 <?php foreach ( $statuses as $key => $label ) : ?>
    167                         <button type="button" class="stat s-<?php echo esc_attr( $key ); ?>" data-filter="<?php echo esc_attr( $key ); ?>" aria-pressed="<?php echo 'open' === $key ? 'true' : 'false'; ?>"><b><?php echo (int) $counts[ $key ]; ?></b><span><?php echo esc_html( $label ); ?></span></button>
    168                 <?php endforeach; ?>
    169171        </div>
    170172
  • pagenod/tags/1.53.0/pagenod.php

    r3817969 r3822889  
    33 * Plugin Name: PageNod
    44 * Description: Website feedback with screenshots: the client clicks "Report", draws on the screenshot and describes the issue; URL, device and JavaScript errors are collected automatically. Admin list, client status page, email digest every 6 hours and approval of developed pages with progress charts.
    5  * Version: 1.45.0
     5 * Version: 1.53.0
    66 * Requires at least: 6.0
    77 * Requires PHP: 7.4
    … …  
    1515}
    1616
    17 define( 'PAGENOD_VERSION', '1.45.0' );
     17define( 'PAGENOD_VERSION', '1.53.0' );
    1818define( 'PAGENOD_URL', plugin_dir_url( __FILE__ ) );
    1919define( 'PAGENOD_FILE', __FILE__ );
    … …  
    4949require_once __DIR__ . '/includes/guide.php';
    5050require_once __DIR__ . '/includes/cloud.php';
     51require_once __DIR__ . '/includes/cloud-users.php';
     52require_once __DIR__ . '/includes/cloud-ai.php';
     53require_once __DIR__ . '/includes/cloud-ai-write.php';
     54require_once __DIR__ . '/includes/cloud-ai-media.php';
     55require_once __DIR__ . '/includes/cloud-ai-menus.php';
     56require_once __DIR__ . '/includes/cloud-ai-elementor.php';
     57require_once __DIR__ . '/includes/cloud-ai-abilities.php';
     58require_once __DIR__ . '/includes/cloud-ai-files.php';
     59require_once __DIR__ . '/includes/cloud-sso.php';
    5160
    5261register_activation_hook( __FILE__, 'pagenod_activate' );
  • pagenod/tags/1.53.0/readme.txt

    r3817969 r3822889  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.45.0
     7Stable tag: 1.53.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    9191* Safari: Apple Push Notification service – [Terms](https://www.apple.com/legal/internet-services/), [Privacy Policy](https://www.apple.com/legal/privacy/)
    9292
    93 **PageNod Cloud (optional, off by default).** An administrator can connect the site to the PageNod Cloud console of their agency (*Settings → PageNod Cloud*, or `wp pagenod cloud connect`). Nothing is sent until someone does. Once connected, the site sends the console a copy of the reports (text, page address, device and browser details, JavaScript errors, pin position, reporter name and email), their conversations and internal notes, screenshots and attachments, tags, assignments and the project progress, plus the site name, address and the WordPress, PHP and PageNod versions. Data is sent when it changes and when connecting; every request is signed with a secret key of the site. Disconnecting stops it at once. The console address is the one contained in the connection code.
     93**PageNod Cloud (optional, off by default).** An administrator can connect the site to the PageNod Cloud console of their agency (*Settings → PageNod Cloud*, or `wp pagenod cloud connect`). Nothing is sent until someone does. Once connected, the site sends the console a copy of the reports (text, page address, device and browser details, JavaScript errors, pin position, reporter name and email), their conversations and internal notes, screenshots and attachments, tags, assignments and the project progress, the people who use PageNod on the site (name, email, role, PageNod permissions, last access), plus the site name, address, folder on the server and the WordPress, PHP and PageNod versions. Data is sent when it changes and when connecting; every request is signed with a secret key of the site. Disconnecting stops it at once. The console address is the one contained in the connection code. From the console the agency can reply to reports and manage the PageNod Reporter and Collaborator accounts of the site; accounts with editing permissions are never changed from the console.
    9494
    9595* PageNod Cloud by Urka – [Terms of service](https://pagenod.cloud/terms), [Privacy policy](https://pagenod.cloud/privacy-policy)
    … …  
    9898
    9999== Changelog ==
     100
     101= 1.53.0 =
     102* PageNod Cloud: when connecting the site (settings page or `wp pagenod cloud connect --ai=read,write,files`) you can choose what the AI assistant of the agency may do on it: reading, changes, theme and plugin files. The console applies only what the person who created the code could turn on there; afterwards they are changed in the console.
     103* WP-CLI: `wp pagenod cloud connect --no-sync` is accepted again.
     104
     105= 1.52.1 =
     106* PageNod Cloud: the agency team can delete internal notes from the console.
     107
     108= 1.52.0 =
     109* PageNod Cloud: the agency team can assign a report (to a collaborator or a team member) and add or remove its tags from the console.
     110* PageNod Cloud: when the agency enables it, AI assistants can read, search and change the files of themes and plugins. PHP is checked before saving, the site is loaded after the change (as the WordPress file editor does) and a fatal error puts the file back; every change can be undone from the console. Sites with DISALLOW_FILE_EDIT are respected.
     111
     112= 1.51.1 =
     113* Pins and text-edit icons whose element cannot be seen right now (another slide of a slider, a closed tab) are shown in transparency until it appears.
     114
     115= 1.51.0 =
     116* PageNod Cloud: the site tells the console its WordPress folder, so the optional SSH mode for AI assistants fills it in by itself.
     117
     118= 1.50.0 =
     119* PageNod Cloud: Claude can use the abilities that plugins offer to AI (WordPress Abilities API, for example Elementor and Yoast SEO), only those the agency allows for the site. Abilities that change the site need changes to be enabled and cannot be undone from the console.
     120
     121= 1.49.1 =
     122* PageNod Cloud: Claude can also change the menus of block themes (Navigation block): text, link, order, add or remove an item, with undo.
     123
     124= 1.49.0 =
     125* PageNod Cloud: Claude can also replace images (wherever they are used, with any theme or page builder, also with an image the client attached to the report), change WordPress menus (text, link, order, add or remove an item), custom fields (ACF included) and, on Elementor sites, the style and visibility of an element or the global colours and fonts. Every change can be undone from the console.
     126
     127= 1.48.0 =
     128* PageNod Cloud: Claude can also change the site, when the agency enables it for the site in the console: texts (where they are stored, Elementor included), title, content and excerpt of a page, the Additional CSS. Every change is kept and can be undone from the console. The site administrator can turn this off in Settings → PageNod Cloud.
     129
     130= 1.47.0 =
     131* PageNod Cloud: when an agency connects Claude to its console, Claude can look at the site to diagnose a report: where a text is stored, a page and its Elementor structure, the PHP error log, versions and active plugins. Read only: nothing on the site is changed.
     132
     133= 1.46.2 =
     134* Reports page: the "To do" filter (everything not resolved yet) comes first and is selected by default; "All" is now last, as in PageNod Cloud.
     135* PageNod Cloud: access from the console. The agency team can open the site's reports and pins straight from the console, with a dedicated "PageNod Cloud" account that can only work on reports and project pages. It can be turned off in the PageNod Cloud settings.
     136
     137= 1.46.1 =
     138* Edit text: when the same text is in several places of the same content (for example a placeholder used in two blocks), you can now change only the one you are editing, or all of them.
     139
     140= 1.46.0 =
     141* PageNod Cloud: the agency can manage the site's PageNod users from the console, without logging into wp-admin: see reporters, collaborators, guests and the team; create a reporter or collaborator account (the person gets the usual email to choose a password); change name, email, role and the "can apply text changes" permission; send the access link again; suspend, reactivate or remove an account.
     142* Safety: the console can only act on accounts without editing permissions and can only give the PageNod Reporter or Collaborator role. Administrators, editors and authors are shown but never changed from the console.
     143* Suspended accounts cannot log in (password, guest link or password recovery) and their open sessions are closed. Removing an account keeps the reports and messages it sent.
     144* PageNod Cloud: the people who use PageNod on the site (name, email, role, permissions, last access) are now part of the data sent to the console.
    100145
    101146= 1.45.0 =
    … …  
    120165* "How to use" guide: new step "Every text keeps its versions", with screenshot and animation.
    121166
    122 = 1.43.2 =
    123 * Pencil pin: the versions show the plain texts; "Compare with the previous version" opens a window with the text before and after side by side, the changes highlighted, and the restore button. Places of a text are no longer repeated.
    124 
    125 = 1.43.1 =
    126 * Side list, "More options": two switches, "Hide reports" and "Hide text changes", each for its own pins; the pages to open (report list, project progress) are now buttons side by side below them.
    127 
    128 = 1.43.0 =
    129 * Text changes: every text now keeps its own history, up to 10 changes (approved from a report or made with "Edit text"), and any earlier version can be put back on the site. A restore is a new version itself.
    130 * On the page, the team (and the users allowed to change texts) see a pencil pin at the start of each changed text: it opens the versions, with what changed, when and who, and the button to restore one. "More options" in the side list shows or hides these pins.
    131 * "Text changes" page: one card per text, with the version on the site now and all the earlier ones.
    132 
    133 = 1.42.0 =
    134 * New "Text changes" page (Site review menu and admin bar): the last 10 text changes made with PageNod, newest first, with date, who, before/after, page and place. Each one can be restored to the previous version: only that text is written back, even if the page was edited afterwards; if the same text was changed again by PageNod, those later changes are undone too.
    135 
    136 = 1.41.9 =
    137 * Page switcher: the heading now reads e.g. "22 reports to handle in 2 pages".
    138 
    139 = 1.41.8 =
    140 * Page switcher of the side list: only pages with reports still to handle (open, in progress, waiting for information), with their total.
    141 
    142 = 1.41.7 =
    143 * Side list: the "On this page" header opens the list of the pages with reports (with how many are not resolved yet); choosing one opens that page with the side list already open.
    144 
    145 = 1.41.6 =
    146 * Side list more compact: "New report" and "Edit text" share one line, and the other options (pins, report list, progress, push notifications) are in a "More options" menu.
    147 
    148 = 1.41.5 =
    149 * The report window on the site no longer has the "Open in a new tab" button.
    150 * "Show the client’s name and email" appears only when a collaborator is chosen.
    151 
    152 = 1.41.4 =
    153 * Reports can be assigned to team members too (administrators and editors already registered on the site), not only to PageNod Collaborators. They are told by email, bell and push; collaborators remain the option for people outside the company.
    154 
    155 = 1.41.3 =
    156 * Browser notifications: the first time someone opens the review area (widget or reports pages), a card asks whether to turn them on; the browser asks for permission only after "Turn on". "Not now" hides it, it comes back once after 14 days.
    157 * Reports now come before Project progress in the admin bar menu, in the review area tabs and in the widget menu.
    158 
    159 = 1.41.2 =
    160 * After the plugin is activated, the "How to use" guide opens (not after bulk activations or from WP-CLI, where a notice links to it).
    161 
    162 = 1.41.1 =
    163 * Settings > Advanced: new option "Delete all PageNod data when the plugin is deleted" (off by default). When on, deleting the plugin removes reports, conversations, attachments, tags, project progress, guest accounts and settings; reviewers and collaborators become Subscribers.
    164 * "How to use" guide: animated steps (what PageNod does, sending a report, text changes, approving), collaborators, push notifications; link in the admin bar. The Tags screen is no longer in the menu (tags are managed from each report).
    165 
    166 = 1.41.0 =
    167 * New "How to use" guide: eight steps with screenshots (inviting the client, reports, text changes, statuses, project progress). A notice invites you to open it after installation; it is always available in the PageNod menu, in the Settings header and on the Plugins screen. Screenshots in Italian for Italian sites, in English for the others.
    168 
    169 = 1.40.7 =
    170 * New installs let clients report on all pages by default (Settings > Pages clients can report on). Existing sites keep their choice. The settings texts say "widget" instead of "button".
    171 
    172 = 1.40.6 =
    173 * Settings page reorganized into sections (General, Who can use PageNod, Email notifications, Text changes). Attachments, report limit, reopening, login page and system cron are under "Advanced settings", shown with a switch. The page header shows the PageNod logo.
    174 
    175 = 1.40.5 =
    176 * Settings: removed the "PageNod credit" option. The footer of the review pages shows the PageNod logo and name, without a link to external websites.
    177 
    178 = 1.40.4 =
    179 * Settings, guests: "Create a new link" is now a button that changes the link right away, after a confirmation, without saving the page.
    180 
    181 = 1.40.3 =
    182 * Settings: who can apply text changes can now be chosen by role too (by default administrators, editors and shop managers), besides individual users.
    183 
    184 = 1.40.2 =
    185 * Emails to collaborators (report assigned, report sent back) are collected and sent as a digest at the same interval as the client digest (30 minutes if that is off), one email per person; bell and push stay immediate.
    186 
    187 = 1.40.1 =
    188 * Report detail: status, assignment and deletion are in their own bar between the report and the conversation, no longer above the message box. The conversation keeps the message, "Send and mark …" and the internal note.
    189 
    190 = 1.40.0 =
    191 * New: assign reports to collaborators. Users with the new "PageNod Collaborator" role see only the reports assigned to them (and the ones they send); for each assignment the team chooses whether they see the client's name and email. Collaborators can change the status and write to the team, but cannot resolve: they mark the report "Done" and the team verifies it (the client does not see this step), then resolves it or sends it back. Email, bell and push notifications for assignments, "Done" and send-backs; "Assignment" filter in the reports list.
    192 * Fix: clients logged in to PageNod could not load public site data from the REST API (e.g. a timeline); only requests that would act as the user are refused now.
    193 
    194 = 1.39.10 =
    195 * Security hardening: every request value (form fields, JSON fields, cookies, uploaded file paths) is now sanitized with the WordPress functions as soon as it is read.
    196 
    197 = 1.39.9 =
    198 * With the list of reports open and the page scrolled sideways, the fixed bars of the site (sticky menus) move with the page too.
    199 
    200 = 1.39.8 =
    201 * Fix: opening a resolved report from a link or with the window arrows switched the "Resolved" filter on for good, so after reloading the page the list showed the resolved reports again. That filter now lasts until the page is reloaded, and the link no longer reopens the report on reload.
    202 * With the list of reports open, the page can be scrolled sideways to see what is underneath it.
    203 
    204 = 1.39.7 =
    205 * Fix: a text change whose only long word has an accent (e.g. "Qualità A/B.") was never found on the site, so it could not be approved or applied.
    206 
    207 = 1.39.6 =
    208 * Code: every script is now a separate file loaded through the WordPress API (the report window over the site had an inline script); JavaScript and CSS files are formatted for reading.
    209 * Login pages work on sites with plain permalinks (before, the login address needed pretty permalinks).
    210 * Text changes: stricter check of the database fields that can be edited.
    211 * Readme: new "External services" section (browser push services) and "Source code" section.
    212 
    213 = 1.39.5 =
    214 * The look of the plugin no longer depends on the theme: its rounded corners are kept even on themes that square every element (e.g. "body * { border-radius: 0 !important }").
    215 
    216 = 1.39.4 =
    217 * Pin popover: "Open the report" has the same eye icon as the side list.
    218 
    219 = 1.39.3 =
    220 * Side list: the button that opens a report in the window over the page now has an eye icon (the old arrow looked like a link to another page).
    221 
    222 = 1.39.2 =
    223 * Push notifications: the last 20 sends are logged (option pagenod_push_log) for troubleshooting.
    224 
    225 = 1.39.1 =
    226 * Side list: "Text changes only" is an on/off switch, without the number.
    227 
    228 = 1.39.0 =
    229 * When the team changes the status of a report, its reporter is told in the bell ("Report #N is now: …") and with a push notification. A change undone within 10 minutes is not notified.
    230 
    231 = 1.38.0 =
    232 * Push notifications can be turned on (and off) from the side list on the site too, not only from the bell of the reports pages: same subscription per browser. The team gets a push for every new report and every client message.
    233 
    234 = 1.37.2 =
    235 * Side list: "Hide pins" / "Show pins" without the number.
    236 
    237 = 1.37.1 =
    238 * Pin popover: the status is changed from a "Change status" menu (two clicks, no accidental changes), with "Undo" in the message.
    239 * A status change that cancels the previous one within 10 minutes removes both from the client notifications.
    240 
    241 = 1.37.0 =
    242 * Text changes: texts that Elementor shows from a widget default (the field was never changed, so nothing was saved) are now found through the widget that was clicked, and the new text is saved in that widget, as if it were edited in Elementor (with "Undo").
    243 
    244 = 1.36.2 =
    245 * Edit text: the button is now simply "Save".
    246 
    247 = 1.36.1 =
    248 * Text changes: whole words only, and a field holding exactly the text wins over longer texts that only contain it (editing "Antik" no longer offers "Antik SUP"). The places to choose from show the repeater row and what they say now.
    249 
    250 = 1.36.0 =
    251 * Text changes can be approved straight from the popover of their pin ("Approve and apply to the site", for the team and the enabled reviewers): the text changes on the page at once and the report is resolved, with "Undo" in the popover and in the message. When the text is in several places, the popover lists them with a checkbox each (the one on the page already checked).
    252 
    253 = 1.35.0 =
    254 * Side list: "New report" and "Edit text" one under the other, full width; new "Text changes only" filter (the pins on the page follow it).
    255 * The popover of a pin can be dragged by its header to see what is underneath; reopened, it starts again next to its pin.
    256 
    257 = 1.34.1 =
    258 * Approving (or undoing) a text change in the report window opened from a pin updates the text on the page underneath straight away, without reloading.
    259 
    260 = 1.34.0 =
    261 * Team: the status of a report can be changed straight from the popover of its pin (the pin, the list and the counters follow; the client is told as usual).
    262 
    263 = 1.33.0 =
    264 * Text changes are also found in the fields and descriptions of categories and other taxonomy terms (ACF on terms included).
    265 * In the report the button is now "Approve and apply to the site": applying the change also marks the report as resolved (the client is told as usual); "Undo" puts back the text and the previous status.
    266 
    267 = 1.32.0 =
    268 * Edit text: as soon as a text is opened, the bar says where it is. If it appears in several places it asks "Only here" or "In all N places" (the one shown on the page is recognized from the text around it, e.g. the selected tab); if it comes from the theme or a plugin it says so and saving is off.
    269 
    270 = 1.31.1 =
    271 * Text changes: a warning in the report when the new text has a line break but the field is a single line (ACF text, email or URL), since the page may show it as a space.
    272 
    273 = 1.31.0 =
    274 * "Edit text" in the side list (team and reviewers enabled in Settings): click a text on the page, rewrite it right there and save: it changes on the site at once, with "Undo". Each change is kept in the history as a resolved report with the comparison between the old and the new text.
    275 * Text changes: line breaks now work (a new line becomes a line break on the page, also in plain text fields; removing one joins the lines).
    276 
    277 = 1.30.0 =
    278 * Apply text changes to the site: in the report the team finds "Apply to the site". The original text is looked for wherever the content is kept, whatever built the page: post title, excerpt and content (Gutenberg, classic editor and builders that use it), custom fields (ACF included, also inside repeaters), page builder data (Elementor, Beaver Builder, Bricks and others), and also in other content shown on the page, templates, menus, widgets and option pages. Only the words that change are replaced, so bold, links and line breaks stay. When the text is in several places you choose where (the most likely are already checked). "Undo" puts back exactly what was there, if nobody changed it in the meantime. Elementor and the usual page caches are cleared.
    279 * Settings → "Can apply text changes": reviewers who can apply their own text changes, also straight away when sending the report, and edit texts directly on the page.
    280 
    281 = 1.29.2 =
    282 * Moving between reports with the arrows of the report window, the page underneath scrolls to the current report (its pin in the middle of the screen), so closing the window you are already there.
    283 
    284 = 1.29.1 =
    285 * The side list no longer opens by itself when a page loads: it opens only from the tab.
    286 
    287 = 1.29.0 =
    288 * The button in the bottom corner is gone: everything (New report, pins, project progress, report list) starts from the PageNod tab on the right edge. The "Button position" setting is removed.
    289 
    290 = 1.28.1 =
    291 * "New report" also at the top of the side list: it closes the list so the whole page is free to choose the point. The tab on the right edge shows the PageNod icon.
    292 
    293 = 1.28.0 =
    294 * The bottom corner holds only the "New report" button (its label appears on hover). The other menu items (show/hide pins, project progress, report list and any added with the pagenod_menu_items filter) are at the bottom of the side list, which opens from the tab on the right edge, now always present.
    295 
    296 = 1.27.2 =
    297 * The "Reports on this page" menu item is gone: the list opens from the tab on the right edge.
    298 
    299 = 1.27.1 =
    300 * The list of the page's reports closes when clicking on the page outside it (clicks on pins, their popover and the report window keep it open).
    301 
    302 = 1.27.0 =
    303 * A tab on the right edge of the page (with the number of open reports) opens and closes the list of the page's reports; the list is in number order.
    304 * Status filters in the list (several at once), resolved reports included on request; the pins on the page follow the filter and the choice is remembered.
    305 * Changing the status of a report (or deleting it) in the window opened from a pin updates its pin, the list and the counters straight away.
    306 
    307 = 1.26.0 =
    308 * List of the reports on the page: a side panel (a sheet at the bottom on phones) with the open reports of the page you are looking at, ordered from top to bottom, with a status filter. Hovering a row outlines its element; a click scrolls to the pin and opens it, the arrow opens the report. Open it from the tab on the right edge.
    309 
    310 = 1.25.0 =
    311 * Whoever sent a report can mark it as resolved or delete it, from the report page or from the window opened from the pin (the pin turns green or disappears). The team gets "Resolved by the client" in the email alert.
    312 
    313 = 1.24.0 =
    314 * Text changes: when the pin is on a text (title, paragraph, button…), the client can rewrite it right in the report window, seeing the changes as they type. The report keeps the original and the proposed text, shown as a word-by-word comparison (removed words struck through in red, added words in green) with "Original" and "Proposed" views and a "Copy the new text" button, in the report, in the pin popover and in the team emails.
    315 * From the pin popover, "Show the proposed text on the page" previews the new text in place (only on that screen).
    316 
    317 = 1.23.1 =
    318 * The report window opened from a pin has arrows (and the left/right keys) to go to the previous or next report of the page, with the position (e.g. 2 / 5).
    319 
    320 = 1.23.0 =
    321 * Every report now needs a pin: the "screenshot of the whole page" option is gone and the server refuses reports without a point on the page.
    322 * The pointer becomes a pin while choosing the point to report.
    323 * "Open the report" from a pin opens the report in a window over the page instead of a new tab (with a button to open it in a new tab). "Show on the page" inside it closes the window and points at the pin.
    324 
    325 = 1.22.2 =
    326 * While choosing the point to report, the bar moves to the bottom of the screen when the top is taken by a sticky menu or the header (and back when it is free), so the menu can be reported too. A new button moves it to the other edge by hand.
    327 
    328 = 1.22.1 =
    329 * Report sent: tidier confirmation (check mark, title, report number and the two buttons side by side), with spacing that the theme cannot override.
    330 
    331 = 1.22.0 =
    332 * Screenshot annotations: a click on a text opens it again for editing (with the Select or the Text tool); dragging it still moves it.
    333 * Rectangles can be resized: the selected rectangle has handles on corners and sides.
    334 
    335 = 1.21.0 =
    336 * Screenshot annotations as separate items: with the new Select tool every line, rectangle and text can be selected, moved, recoloured or deleted (× on the selection or the Delete key); a double click on a text edits it. Undo also covers moves, colour changes and deletions.
    337 
    338 = 1.20.0 =
    339 * Screenshot annotations: toolbar with pen, rectangle and text, six colours, undo and clear. Each tool has its own cursor (a pencil in the chosen colour, a crosshair for rectangles, a text cursor); text is typed straight on the image and placed with Enter.
    340 * "Something missing? Capture with the browser" replaces the longer hint under the screenshot.
    341 
    342 = 1.19.2 =
    343 * Report window: removed the hint text above the screenshot.
    344 
    345 = 1.19.1 =
    346 * Screenshot: it no longer stays stuck on "Capturing the screen…" on pages with videos. Visible videos are captured as a picture of their current frame, the ones out of view are left out; in any case after 25 seconds the window opens, with the option to capture with the browser.
    347 * Choosing the point: the bar shows the two options more clearly ("Click the point…" or "Screenshot of the whole page", with a camera icon) and sits below the WordPress toolbar.
    348 
    349 = 1.19.0 =
    350 * Pins on the page: when reporting, the client first clicks the exact point of the page (the element under the pointer is highlighted), or chooses "Screenshot of the whole page". The pin and the outline of the element are drawn on the screenshot.
    351 * Reports not yet resolved appear as numbered pins on their element when the page is reopened, also at a different window size; a click shows the message, the status and the link to the report. The pins can be hidden from the button menu.
    352 * Report detail: new "Show on the page" link, which opens the page, scrolls to the pin and highlights it.
    353 
    354 = 1.18.2 =
    355 * All scripts and styles are loaded through the WordPress script and style API (files in assets/), no more inline code.
    356 * Output of the review pages is filtered with wp_kses(); stricter permission check on the push notification endpoint.
    357 * Translations are loaded by WordPress (translate.wordpress.org); the plugin no longer calls load_plugin_textdomain().
    358 
    359 = 1.18.1 =
    360 * Progress: new "Move…" button to pick the destination of a page from a searchable list (before, after or inside another page), handy for long distances.
    361 * Progress: while dragging, the list shrinks to the page titles and the window scrolls by itself near the top and bottom edges.
    362 
    363 = 1.18.0 =
    364 * Guests: optional invitation link. People without an account enter name and email and can send reports straight away, without a password. An address that is already registered gets a one-time access link by email instead. Off by default; the link can be regenerated, and turning the option off blocks every guest.
    365 * Guests see only their own reports by default; Settings → Guests can let them see all reports.
    366 * Reports from guests are marked "guest" for the team.
    367 * Footer with the PageNod logo on the review pages; the link to the PageNod website is opt-in.
    368 * The page filter in the reports list shows the page address instead of the meta title.
    369 * Screenshots can be downloaded from the report detail and from the enlarged view.
    370 * Internal tags on reports: the team adds them from the report detail (or from the dashboard) and filters the list by tag. Never shown to the client.
    371 * Arrows (and keyboard/swipe) to move between all the images of a report in the enlarged view.
    372 * Page approvals reach the team in the email digest instead of one email each.
    373 * Names: first and last name are shown when set, otherwise the username.
    374 * Notifications: bell with the number of new reports and messages in the top bar; opening a report clears its notifications. A dot marks the reports with news in the list.
    375 * Email digests skip what each person has already seen in the app.
    376 * Browser push notifications (Web Push): each person turns them on from the bell and is alerted about new reports and messages even with the site closed. The push carries no content: the browser asks the site what is new with the person's own login. Keys are created on the site (see External services).
    377 * Copy button next to the page address in the report detail.
    378 * Clients can report only on pages in review or approved (Settings → Pages clients can report on); on the other pages the button shows a message instead of the report window. Posts and other content follow their template; other languages (WPML) follow the original page. The team can always report.
    379 * Deleting a report for good (emptying the trash) also deletes its media from the library: screenshot, attachments and files sent in the conversation.
    380 
    381 = 1.17.0 =
    382 * Internal prefix renamed from `snapnote_` to `pagenod_` (functions, constants, options, meta keys, post types, role, CSS classes). Existing data is migrated automatically on update; old links keep working.
    383 * Reports list: sort oldest first (default) or newest first.
    384 * Report detail: page address instead of its title, screen resolution and window size, and (for the team) all technical details.
    385 
    386 = 1.16.0 =
    387 * New PageNod logo: admin menu icon, report button on the site, settings page and email header.
    388 * Individual users (access and notification recipients) are picked with a tag-style search instead of a long list.
    389 
    390 = 1.15.0 =
    391 * The Reports page now lists compact previews; each report opens its own detail page with the screenshot, technical data and the conversation.
    392 * Email "Reply" links open the report detail directly.
    393 * Link to the WordPress dashboard in the top bar for users who can use it.
    394 * Reports are numbered with their own counter starting from 1 (existing reports are numbered from the oldest).
    395 * Client preview: approvals, change requests and messages are disabled. The Reports page no longer offers the client preview.
    396 * The digest of new reports for the team follows the "Email frequency" setting instead of the fixed 6-hour schedule.
    397 * Notification recipients are chosen by role and individual user, like access (administrators by default), instead of typing email addresses.
    398 
    399 = 1.14.0 =
    400 * Renamed from Snapnote to PageNod (folder `pagenod`, text domain `pagenod`). Settings, reports, pages and the reviewer role are kept.
    401 
    402 = 1.13.0 =
    403 * Plugin translated to English as source language, with Italian, French, German and Spanish translations.
    404 
    405 = 1.12.2 =
    406 * More reliable screenshots: a blank automatic capture is detected and the browser's screen capture is offered instead; a "Capture with the browser" link is also available when parts such as maps or videos are missing.
    407 
    408 = 1.12.0 =
    409 * Report limit per user on a fixed hourly window, configurable; the team has no limit.
    410 * Attachments in conversation messages, with drag and drop.
    411 * Reports as conversations, internal notes, reopening by the client within a configurable time, new status "Waiting for information".
    412 * Client digest includes team messages; team alerts when a client replies or reopens.
    413 
    414 = 1.11.0 =
    415 * Batched client email digest of status changes and replies.
    416 * "Template" entries to approve a content type once (news, products…).
    417 * New page status "Waiting for content"; filters by page and content type on reports.
    418 
    419 = 1.10.0 =
    420 * Approval with confirmation modal, reporter filter, charts per status, front-end console with drag and drop.
    421 
    422 = 1.9.0 =
    423 * Login page on a clean, configurable URL with conflict checks.
    424 
    425 = 1.8.0 =
    426 * Branded login page with password recovery and branded account emails.
    427 
    428 = 1.7.0 =
    429 * Front-end management console; grouping entries; log out button.
    430 
    431 = 1.6.0 =
    432 * Client email when the team replies; navigation between reports and progress; HTML emails; hierarchical pages.
    433 
    434 = 1.5.0 =
    435 * Page approval with progress charts.
    436 
    437 = 1.0.0 =
    438 * First release.
     167Older versions: see changelog.txt in the plugin folder.
    439168
    440169== Source code ==
  • pagenod/tags/1.53.0/uninstall.php

    r3817969 r3822889  
    7979        // Scheduled tasks and temporary upload chunks.
    8080        $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}pagenod_cloud_queue" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange -- PageNod Cloud queue
     81        $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}pagenod_ai_changes" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange -- changes made by Claude through PageNod Cloud
    8182        foreach ( array( 'pagenod_client_digest', 'pagenod_cleanup_uploads', 'pagenod_send_digest', 'pagenod_cloud_flush', 'pagenod_cloud_daily', 'pagenod_cloud_tick' ) as $hook ) {
    8283                wp_clear_scheduled_hook( $hook );
  • pagenod/trunk/assets/css/reports.css

    r3813122 r3822889  
    136136.summary {
    137137        display: grid;
    138         grid-template-columns: repeat(5, minmax(0, 1fr));
     138        grid-template-columns: repeat(6, minmax(0, 1fr));
    139139        gap: 10px;
    140140        margin-bottom: 18px;
    … …  
    11121112        }
    11131113
    1114         .summary .stat:first-child {
     1114        .summary .stat:first-child,
     1115        .summary .stat:last-child {
    11151116                grid-column: 1 / -1;
    11161117        }
  • pagenod/trunk/assets/js/reports.js

    r3813122 r3822889  
    22        var L10N = pagenodReports.L10N;
    33        var pg = document.getElementById('pg');
    4         // Status filter: one status at a time (or "All"); on load, the open reports.
     4        // Status filter: one status at a time, "To do" (everything not resolved) or "All"; on load, "To do".
    55        // An empty set means "All".
    6         var filter = { open: 1 }, q = document.getElementById('q'), who = document.getElementById('who'), cards = document.querySelectorAll('.card'), none = document.getElementById('none');
     6        var filter = { active: 1 }, q = document.getElementById('q'), who = document.getElementById('who'), cards = document.querySelectorAll('.card'), none = document.getElementById('none');
    77        // Filters are remembered (per tab) so that returning from a detail finds the list as it was left.
    88        var sort = document.getElementById('sort'), tagf = document.getElementById('tagf'), asgf = document.getElementById('asgf');
    … …  
    6666                if (r && r.indexOf(location.origin) === 0 && r.indexOf('pagenod_view=') !== -1 && !/[?&]report=/.test(r) && history.length > 1) { e.preventDefault(); history.back(); }
    6767        });
     68        function inStatus(s) { return !Object.keys(filter).length || (filter.active ? s !== 'done' : !!filter[s]); }
     69        // The numbers in the drop-down menus count the reports in the chosen status (the row at the top).
     70        var facets = [
     71                [pg, function (c, v) { return v.indexOf('type:') === 0 ? c.dataset.type === v.slice(5) : c.dataset.page === v; }],
     72                [who, function (c, v) { return c.dataset.who === v; }],
     73                [tagf, function (c, v) { return v === '-' ? (c.dataset.tags || '||') === '||' : (c.dataset.tags || '').indexOf('|' + v + '|') !== -1; }],
     74                [asgf, function (c, v) { return (c.dataset.asg || '').indexOf('|' + v + '|') !== -1; }]
     75        ].filter(function (f) { return f[0]; });
     76        var NUM = /\s*\(([\d.,\s\u00a0\u202f]+)\)$/;
     77        facets.forEach(function (f) {
     78                [].forEach.call(f[0].options, function (o) { if (o.value && NUM.test(o.text)) o.dataset.base = o.text.replace(NUM, ''); });
     79        });
     80        function facetCounts() {
     81                var sc = [].filter.call(cards, function (c) { return inStatus(c.dataset.status); });
     82                facets.forEach(function (f) {
     83                        [].forEach.call(f[0].options, function (o) {
     84                                if (o.dataset.base === undefined) return;
     85                                var n = 0;
     86                                sc.forEach(function (c) { if (f[1](c, o.value)) n++; });
     87                                o.text = o.dataset.base + ' (' + n.toLocaleString() + ')';
     88                        });
     89                });
     90        }
    6891        function apply() {
    6992                if (!cards.length) return;
    7093                save();
     94                facetCounts();
    7195                var term = q ? q.value.trim().toLowerCase() : '', person = who ? who.value : '', page = pg ? pg.value : '', tg = tagf ? tagf.value : '', ag = asgf ? asgf.value : '', shown = 0, counts = { '': 0 };
    7296                cards.forEach(function (c) {
    … …  
    77101                        var mine = (!person || c.dataset.who === person) && onPage && onTag && onAsg;
    78102                        // The counters at the top follow the chosen reporter and page.
    79                         if (mine) { counts[''] ++; counts[c.dataset.status] = (counts[c.dataset.status] || 0) + 1; }
    80                         var ok = mine && (!Object.keys(filter).length || filter[c.dataset.status]) && (!term || c.dataset.search.indexOf(term) !== -1);
     103                        if (mine) { counts[''] ++; counts[c.dataset.status] = (counts[c.dataset.status] || 0) + 1; if (c.dataset.status !== 'done') counts.active = (counts.active || 0) + 1; }
     104                        var ok = mine && inStatus(c.dataset.status) && (!term || c.dataset.search.indexOf(term) !== -1);
    81105                        c.hidden = !ok;
    82106                        if (ok) shown++;
  • pagenod/trunk/assets/pagenod.css

    r3816747 r3822889  
    34953495}
    34963496
     3497/* The element is in the page but cannot be seen now (another slide, a closed tab): pin in transparency. */
     3498#pagenod-root .pagenod-pin.is-off,
     3499#pagenod-root .pagenod-tpin.is-off {
     3500        opacity: .3;
     3501        transition: opacity .2s ease;
     3502}
     3503
     3504#pagenod-root .pagenod-pin.is-off:hover,
     3505#pagenod-root .pagenod-pin.is-off:focus-visible,
     3506#pagenod-root .pagenod-pin.is-off.is-active,
     3507#pagenod-root .pagenod-tpin.is-off:hover,
     3508#pagenod-root .pagenod-tpin.is-off:focus-visible,
     3509#pagenod-root .pagenod-tpin.is-off.is-active {
     3510        opacity: 1;
     3511}
     3512
    34973513#pagenod-root .pagenod-tpop {
    34983514        width: min(360px, calc(100vw - 16px));
  • pagenod/trunk/assets/pagenod.js

    r3816747 r3822889  
    15211521                // Places chosen after the question "where?" (same text in several contents).
    15221522                var pick = ed.tools.querySelector('.pagenod-edit-places input:checked');
    1523                 if (pick) (pick.value === '*' ? ed.keys : [pick.value]).forEach(function (k) { fd.append('only[]', k); });
     1523                if (pick && pick.value === 'one' && ed.one) {
     1524                        fd.append('only[]', ed.one.k);
     1525                        fd.append('one', JSON.stringify({ nth: ed.one.nth, of: ed.one.of }));
     1526                } else if (pick) (pick.value === '*' ? ed.keys : [pick.value]).forEach(function (k) { fd.append('only[]', k); });
    15241527                fetch(cfg.ajaxUrl, { method: 'POST', body: fd, credentials: 'same-origin' })
    15251528                        .then(function (x) { return x.json().catch(function () { throw new Error(t('invalidResponse', x.status)); }); })
    … …  
    15851588                                info.textContent = t('editWhere', d.choices[0].l);
    15861589                        } else if (d.choices.length === 1) {
    1587                                 // Several times in the same content (e.g. two titles of the page): they change together.
    1588                                 ed.spots = spotsShow(pageSpots(ed.orig, ed.el));
    1589                                 info.textContent = t('editAllSpots', d.total);
    1590                                 info.classList.add('is-warn');
     1590                                // Several times in the same content (e.g. a placeholder text used in two blocks):
     1591                                // only the one being edited, or all of them.
     1592                                info.remove();
     1593                                editScope(ed, d);
    15911594                        } else {
    15921595                                info.remove();
    … …  
    16011604                ed.spots = spotsShow(pageSpots(ed.orig, ed.el));
    16021605                ed.keys = d.choices.map(function (c) { return c.k; });
    1603                 var here = d.choices.filter(function (c) { return c.on; })[0];
    1604                 var opts = here
    1605                         ? '<label><input type="radio" name="pagenod-scope" value="' + esc(here.k) + '" checked> ' + th('editOnlyHere') + ' <small>' + esc(here.l) + '</small></label>'
    1606                         : d.choices.map(function (c) { return '<label><input type="radio" name="pagenod-scope" value="' + esc(c.k) + '"> ' + th('editOnlyIn', esc(c.l)) + '</label>'; }).join('');
     1606                var single = d.choices.length === 1;
     1607                var here = single ? d.choices[0] : d.choices.filter(function (c) { return c.on; })[0];
     1608                // The text is more than once in the content of this page: "only this one" changes just
     1609                // the place being edited (number shown on the page), the others stay as they are.
     1610                ed.one = null;
     1611                if (here && here.n > 1) {
     1612                        var dom = pageSpots(ed.orig), at = -1;
     1613                        dom.forEach(function (c, i) { if (at < 0 && (c === ed.el || c.contains(ed.el) || ed.el.contains(c))) at = i; });
     1614                        var num = ed.spots ? ed.spots.indexOf(ed.el) + 1 : 1;
     1615                        ed.one = { k: here.k, nth: at, of: dom.length };
     1616                }
     1617                var oneOpt = ed.one ? '<label><input type="radio" name="pagenod-scope" value="one" checked> ' + th('editOnlyThis', num || 1) + '</label>' : '';
     1618                var opts = single
     1619                        ? oneOpt
     1620                        : here
     1621                                ? oneOpt + '<label><input type="radio" name="pagenod-scope" value="' + esc(here.k) + '"' + (ed.one ? '' : ' checked') + '> ' + th('editOnlyHere') + ' <small>' + esc(here.l) + '</small></label>'
     1622                                : d.choices.map(function (c) { return '<label><input type="radio" name="pagenod-scope" value="' + esc(c.k) + '"> ' + th('editOnlyIn', esc(c.l)) + '</label>'; }).join('');
    16071623                var seen = ed.spots && ed.spots.length > 1 ? ' <small>' + esc(t('spotsMarked', ed.spots.length)) + '</small>' : '';
    1608                 var box = el('fieldset', { class: 'pagenod-edit-places' }, '<legend>' + th('editMany', d.total) + seen + '</legend>' + opts +
    1609                         '<label><input type="radio" name="pagenod-scope" value="*"> ' + th('editEverywhere', d.total) + '</label>');
     1624                var box = el('fieldset', { class: 'pagenod-edit-places' }, '<legend>' + th(single ? 'editManyHere' : 'editMany', d.total) + seen + '</legend>' + opts +
     1625                        '<label><input type="radio" name="pagenod-scope" value="*"> ' + th(single ? 'editAllSpotsOpt' : 'editEverywhere', d.total) + '</label>');
    16101626                ed.tools.insertBefore(box, ed.tools.querySelector('.pagenod-edit-msg'));
    16111627                var msgEl = ed.tools.querySelector('.pagenod-edit-msg');
    … …  
    18731889                return p.node;
    18741890        }
     1891        // Whether the element can be seen now: not made invisible (another slide of a slider, a closed tab)
     1892        // and the point (x, y) not cut off by a container that clips its content (a carousel's other slides).
     1893        function seen(n, x, y) {
     1894                if (getComputedStyle(n).visibility === 'hidden') return false;
     1895                for (var a = n; a && a.nodeType === 1 && a !== document.body; a = a.parentElement) {
     1896                        var cs = getComputedStyle(a);
     1897                        if (parseFloat(cs.opacity) < 0.1) return false;
     1898                        if (a === n) continue;
     1899                        var cx = cs.overflowX !== 'visible', cy = cs.overflowY !== 'visible';
     1900                        if (!cx && !cy) continue;
     1901                        var r = a.getBoundingClientRect();
     1902                        if (cx && (x < r.left - 2 || x > r.right + 2)) return false;
     1903                        if (cy && (y < r.top - 2 || y > r.bottom + 2)) return false;
     1904                }
     1905                return true;
     1906        }
    18751907        // Position on screen: on the element if it is there, otherwise where it was in the page.
    18761908        function where(p) {
    18771909                var n = target(p);
     1910                p.off = false;
    18781911                if (n) {
    18791912                        var r = n.getBoundingClientRect();
    18801913                        if (!r.width && !r.height) return null; // element hidden at this window size
    18811914                        p.approx = false;
    1882                         return { x: r.left + p.x * r.width, y: r.top + p.y * r.height };
     1915                        var w = { x: r.left + p.x * r.width, y: r.top + p.y * r.height };
     1916                        p.off = !seen(n, w.x, w.y);
     1917                        return w;
    18831918                }
    18841919                p.approx = true;
    … …  
    18911926                if (!out) b.style.transform = 'translate(' + Math.round(w.x) + 'px,' + Math.round(w.y) + 'px)';
    18921927                b.classList.toggle('is-approx', !!p.approx);
     1928                b.classList.toggle('is-off', !out && !!p.off);
    18931929                if (pinPop && pinPop._p === p) posPop(p);
    18941930        }
    … …  
    20432079        function tpPlace(p) {
    20442080                var b = p.btn, w = null;
     2081                p.off = false;
    20452082                if (tpOn) {
    20462083                        var n = tpTarget(p);
    20472084                        if (n) {
    20482085                                var r = n.getBoundingClientRect();
    2049                                 if (r.width || r.height) { w = { x: r.left, y: r.top }; p.approx = false; }
     2086                                if (r.width || r.height) {
     2087                                        w = { x: r.left, y: r.top }; p.approx = false;
     2088                                        p.off = !seen(n, r.left + Math.min(r.width / 2, 20), r.top + Math.min(r.height / 2, 10));
     2089                                }
    20502090                        } else if (p.vw) {
    20512091                                w = { x: p.px * window.innerWidth / (p.vw || window.innerWidth) - window.scrollX, y: p.py - window.scrollY };
    … …  
    20572097                if (!out) b.style.transform = 'translate(' + Math.round(w.x) + 'px,' + Math.round(w.y) + 'px)';
    20582098                b.classList.toggle('is-approx', !!p.approx);
     2099                b.classList.toggle('is-off', !out && !!p.off);
    20592100                if (pinPop && pinPop._p === p) posPop(p);
    20602101        }
  • pagenod/trunk/includes/cloud.php

    r3817969 r3822889  
    8484 * @return true|WP_Error
    8585 */
    86 function pagenod_cloud_connect( $code ) {
     86/**
     87 * Connects the site with a code from the console. $ai: the AI assistant switches chosen when connecting
     88 * (array with read, write, files; null = leave them to the console). The console applies only what the
     89 * person who created the code could turn on there, and from then on they are changed in the console.
     90 */
     91function pagenod_cloud_connect( $code, $ai = null ) {
    8792        $parts = pagenod_cloud_decode_code( $code );
    8893        if ( ! $parts ) {
    … …  
    9297                'timeout' => 20,
    9398                'headers' => array( 'Content-Type' => 'application/json', 'Accept' => 'application/json' ),
    94                 'body'    => wp_json_encode( array_merge( array( 'code' => trim( (string) $code ) ), pagenod_cloud_site_info() ) ),
     99                'body'    => wp_json_encode( array_merge(
     100                        array( 'code' => trim( (string) $code ) ),
     101                        pagenod_cloud_site_info(),
     102                        is_array( $ai ) ? array( 'ai' => array_map( 'boolval', array_intersect_key( $ai + array( 'read' => false, 'write' => false, 'files' => false ), array_flip( array( 'read', 'write', 'files' ) ) ) ) ) : array()
     103                ) ),
    95104        ) );
    96105        if ( is_wp_error( $res ) ) {
    … …  
    113122                'last_error'   => '',
    114123                'mute_team'    => 1, // the team gets one digest for all sites from the console
     124                'settings_url' => esc_url_raw( (string) ( $body['settings_url'] ?? '' ) ), // where the AI assistant switches are changed
     125                'ai'           => is_array( $body['ai'] ?? null ) ? pagenod_cloud_ai_choice( $body['ai'] ) : null, // as applied when connecting
    115126        ), false );
    116127
    … …  
    119130        pagenod_cloud_schedule( true );
    120131        return true;
     132}
     133
     134/** The AI assistant switches as the console applied them when connecting. */
     135function pagenod_cloud_ai_choice( $ai ) {
     136        $skipped = array_values( array_intersect( array_map( 'strval', (array) ( $ai['skipped'] ?? array() ) ), array( 'read', 'write', 'files' ) ) );
     137        return array(
     138                'read'    => ! empty( $ai['read'] ),
     139                'write'   => ! empty( $ai['write'] ),
     140                'files'   => ! empty( $ai['files'] ),
     141                'skipped' => $skipped,
     142                'reason'  => sanitize_key( (string) ( $ai['reason'] ?? '' ) ),
     143        );
     144}
     145
     146/** Labels of the AI assistant switches, as in the console. */
     147function pagenod_cloud_ai_labels() {
     148        return array(
     149                'read'  => __( 'Reading', 'pagenod' ),
     150                'write' => __( 'Changes', 'pagenod' ),
     151                'files' => __( 'Theme and plugin files', 'pagenod' ),
     152        );
     153}
     154
     155/** What the console turned on when connecting and, if something was not turned on, why. */
     156function pagenod_cloud_ai_summary( $ai ) {
     157        if ( ! is_array( $ai ) ) {
     158                return '';
     159        }
     160        $labels = pagenod_cloud_ai_labels();
     161        $on     = array();
     162        foreach ( $labels as $key => $label ) {
     163                if ( ! empty( $ai[ $key ] ) ) {
     164                        $on[] = $label;
     165                }
     166        }
     167        /* translators: %s: list of switches, e.g. "Reading, Changes" */
     168        $text = $on ? sprintf( __( 'AI assistant: %s turned on.', 'pagenod' ), implode( ', ', $on ) ) : __( 'AI assistant: everything turned off.', 'pagenod' );
     169        if ( ! empty( $ai['skipped'] ) ) {
     170                $names = implode( ', ', array_intersect_key( $labels, array_flip( $ai['skipped'] ) ) );
     171                $why   = array(
     172                        'second_factor' => __( 'whoever created the connection code must first turn on two-step verification in the console', 'pagenod' ),
     173                        'owner'         => __( 'the connection code was not created by an owner of the agency', 'pagenod' ),
     174                        'plan'          => __( 'the plan of the agency does not include the AI assistant', 'pagenod' ),
     175                );
     176                /* translators: 1: list of switches, 2: reason */
     177                $text .= ' ' . sprintf( __( 'Not applied: %1$s, because %2$s. They can be turned on in the console.', 'pagenod' ), $names, $why[ $ai['reason'] ] ?? __( 'the console did not allow it', 'pagenod' ) );
     178        }
     179        return $text;
    121180}
    122181
    … …  
    143202                pagenod_cloud_enqueue_many( 'message', $msgs );
    144203        }
     204        pagenod_cloud_users_backfill();
    145205        pagenod_cloud_enqueue_many( 'site', array( 1 ) );
    146206}
    … …  
    265325                'timezone'       => wp_timezone_string(),
    266326                'command_url'    => rest_url( 'pagenod/v1/cloud' ),
     327                'ai_tools'       => pagenod_cloud_ai_tools(),
     328                // WordPress folder on the server: suggested in the console for the optional SSH mode (never sent to the AI by the site)
     329                'wp_path'        => untrailingslashit( ABSPATH ),
    267330        );
    268331}
    … …  
    469532                        } elseif ( 'page' === $r->type ) {
    470533                                $events[] = pagenod_cloud_page_event( $r->obj_id );
     534                        } elseif ( 'user' === $r->type ) {
     535                                $events[] = pagenod_cloud_user_event( $r->obj_id );
    471536                        } else {
    472537                                $events[] = array( 'type' => 'site.info', 'data' => pagenod_cloud_site_info() );
    … …  
    564629}
    565630
    566 /* Site details (name, versions…) sent again once a day. */
     631/* Site details (name, versions…) sent again once a day, and at once after an update of PageNod. */
    567632add_action( 'pagenod_cloud_daily', function () {
    568633        pagenod_cloud_enqueue( 'site', 1 );
     634} );
     635add_action( 'init', function () {
     636        if ( pagenod_cloud_connected() && PAGENOD_VERSION !== get_option( 'pagenod_cloud_info_v' ) ) {
     637                update_option( 'pagenod_cloud_info_v', PAGENOD_VERSION, false );
     638                pagenod_cloud_enqueue( 'site', 1 );
     639        }
    569640} );
    570641add_action( 'init', function () {
    … …  
    657728 * reach the client as usual. A command already run (same id) is not run again.
    658729 *
    659  * act: { report_id, message?, side? (team|note), status?, author: { name, email } }
     730 * act: { report_id, message?, side? (team|note), status?, tags? (list of names: replaces the tags),
     731 *        assign? (WordPress user ID of a collaborator or team member, 0 = nobody), assign_client? (bool),
     732 *        delete_note? (comment ID of an internal note of this report), author: { name, email } }
    660733 * @return array( 'id', 'ok', 'error'?, 'events'? )
    661734 */
    … …  
    664737        $data = is_array( $cmd ) && is_array( $cmd['data'] ?? null ) ? $cmd['data'] : array();
    665738        $out  = array( 'id' => $id, 'ok' => false );
     739        if ( '' !== $id && 'user' === ( $cmd['type'] ?? '' ) ) {
     740                return array_merge( $out, pagenod_cloud_user_execute( $id, $data ) );
     741        }
     742        if ( '' !== $id && 'ai' === ( $cmd['type'] ?? '' ) ) {
     743                return array_merge( $out, pagenod_cloud_ai_execute( $data ) ); // tools for Claude: read only, nothing to remember
     744        }
    666745        if ( '' === $id || 'act' !== ( $cmd['type'] ?? '' ) ) {
    667746                $out['error'] = 'unknown_command';
    … …  
    684763                        return $out;
    685764                }
    686                 if ( '' === trim( $text ) && '' === $status ) {
     765                // Tags: the whole list, chosen by the agency team in the console (team only, like in the plugin).
     766                $tags = null;
     767                if ( isset( $data['tags'] ) && is_array( $data['tags'] ) ) {
     768                        $tags = array();
     769                        foreach ( $data['tags'] as $n ) {
     770                                $n = mb_substr( trim( sanitize_text_field( (string) $n ) ), 0, 40 );
     771                                if ( '' !== $n ) {
     772                                        $tags[] = $n;
     773                                }
     774                        }
     775                        $tags = array_values( array_unique( $tags ) );
     776                }
     777                // Assignment chosen in the console: only people who can be assigned on the site (collaborators, team).
     778                $assign = null;
     779                if ( array_key_exists( 'assign', $data ) ) {
     780                        $assign = absint( $data['assign'] );
     781                        if ( $assign && ! pagenod_can_be_assigned( get_userdata( $assign ) ) ) {
     782                                $out['error'] = 'invalid_assignee';
     783                                return $out;
     784                        }
     785                }
     786                // Internal note deleted from the console: only notes (never messages the client sees) of this report.
     787                $delete_note = absint( $data['delete_note'] ?? 0 );
     788                if ( $delete_note ) {
     789                        $note = get_comment( $delete_note );
     790                        if ( ! $note ) {
     791                                $delete_note = 0; // already gone: nothing to do, not an error (the command may arrive twice)
     792                        } elseif ( (int) $note->comment_post_ID !== $report || 'note' !== pagenod_msg_side( $note ) ) {
     793                                $out['error'] = 'not_a_note';
     794                                return $out;
     795                        }
     796                }
     797                $gone = $delete_note ? 0 : absint( $data['delete_note'] ?? 0 );
     798                if ( '' === trim( $text ) && '' === $status && null === $tags && null === $assign && ! $delete_note && ! $gone ) {
    687799                        $out['error'] = 'nothing_to_do';
    688800                        return $out;
    … …  
    712824                        update_post_meta( $report, '_pagenod_status', $status );
    713825                }
     826                if ( null !== $assign ) {
     827                        pagenod_assign( $report, $assign, $assign && ! empty( $data['assign_client'] ) );
     828                }
     829                if ( $delete_note ) {
     830                        wp_delete_comment( $delete_note, true );
     831                }
     832                if ( null !== $tags ) {
     833                        $res = wp_set_post_terms( $report, $tags, PAGENOD_TAG_TAX, false );
     834                        if ( is_wp_error( $res ) ) {
     835                                wp_set_current_user( $prev );
     836                                $out['error'] = 'tags_failed';
     837                                return $out;
     838                        }
     839                }
    714840                wp_set_current_user( $prev );
    715841
    716                 $done[ $id ] = time();
    717                 if ( count( $done ) > 300 ) {
    718                         asort( $done );
    719                         $done = array_slice( $done, -300, null, true );
    720                 }
    721                 update_option( 'pagenod_cloud_done', $done, false );
     842                pagenod_cloud_mark_done( $id );
    722843        }
    723844
    724845        // The new state goes back at once, so the console shows it without waiting for the queue.
    725846        $events = array( pagenod_cloud_report_event( $report ) );
     847        if ( ! empty( $data['delete_note'] ) ) {
     848                $events[] = array( 'type' => 'message.delete', 'data' => array( 'id' => absint( $data['delete_note'] ) ) );
     849        }
    726850        foreach ( get_comments( array( 'post_id' => $report, 'type' => array( PAGENOD_MSG, 'comment' ), 'status' => 'approve', 'orderby' => 'comment_ID', 'order' => 'DESC', 'number' => 3 ) ) as $c ) {
    727851                $events[] = pagenod_cloud_message_event( $c->comment_ID );
    … …  
    730854        $out['events'] = $events;
    731855        return $out;
     856}
     857
     858/** Remembers the last 300 commands run, so a command delivered twice is not run again. */
     859function pagenod_cloud_mark_done( $id ) {
     860        $done = get_option( 'pagenod_cloud_done', array() );
     861        $done = is_array( $done ) ? $done : array();
     862        $done[ $id ] = time();
     863        if ( count( $done ) > 300 ) {
     864                asort( $done );
     865                $done = array_slice( $done, -300, null, true );
     866        }
     867        update_option( 'pagenod_cloud_done', $done, false );
    732868}
    733869
    … …  
    742878        $notice = 'ok';
    743879        if ( 'connect' === $do ) {
    744                 $r = pagenod_cloud_connect( sanitize_text_field( wp_unslash( $_POST['code'] ?? '' ) ) );
     880                $ai = array(
     881                        'read'  => ! empty( $_POST['ai_read'] ),
     882                        'write' => ! empty( $_POST['ai_write_console'] ),
     883                        'files' => ! empty( $_POST['ai_files'] ),
     884                );
     885                $r  = pagenod_cloud_connect( sanitize_text_field( wp_unslash( $_POST['code'] ?? '' ) ), $ai );
    745886                if ( is_wp_error( $r ) ) {
    746887                        set_transient( 'pagenod_cloud_notice_' . get_current_user_id(), $r->get_error_message(), MINUTE_IN_SECONDS );
    … …  
    754895        } elseif ( 'mute' === $do && pagenod_cloud_connected() ) {
    755896                pagenod_cloud_update( array( 'mute_team' => empty( $_POST['mute_team'] ) ? 0 : 1 ) );
     897                $notice = 'saved';
     898        } elseif ( 'ai_write' === $do ) {
     899                update_option( PAGENOD_CLOUD_AI_WRITE_OPTION, empty( $_POST['ai_write'] ) ? '0' : '1', false );
    756900                $notice = 'saved';
    757901        } elseif ( 'sync' === $do && pagenod_cloud_connected() ) {
    … …  
    774918                        <div class="notice notice-error inline"><p><?php echo esc_html( (string) get_transient( 'pagenod_cloud_notice_' . get_current_user_id() ) ); ?></p></div>
    775919                <?php elseif ( 'connected' === $notice ) : ?>
    776                         <div class="notice notice-success inline"><p><?php esc_html_e( 'Site connected. The existing reports are being sent to the console in the background.', 'pagenod' ); ?></p></div>
     920                        <div class="notice notice-success inline"><p><?php esc_html_e( 'Site connected. The existing reports are being sent to the console in the background.', 'pagenod' ); ?> <?php echo esc_html( pagenod_cloud_ai_summary( $c['ai'] ?? null ) ); ?></p></div>
    777921                <?php elseif ( 'disconnected' === $notice ) : ?>
    778922                        <div class="notice notice-success inline"><p><?php esc_html_e( 'Site disconnected: nothing more is sent to the console.', 'pagenod' ); ?></p></div>
    … …  
    830974                                </tr>
    831975                                <tr>
     976                                        <th scope="row"><?php esc_html_e( 'AI assistant', 'pagenod' ); ?></th>
     977                                        <td>
     978                                                <p class="description"><?php esc_html_e( 'Reading, changes and theme and plugin files for the AI assistant are chosen when connecting; from then on an owner of the agency changes them in the console.', 'pagenod' ); ?></p>
     979                                                <?php if ( ! empty( $c['ai'] ) ) : ?>
     980                                                        <p class="description"><?php echo esc_html( pagenod_cloud_ai_summary( $c['ai'] ) ); ?> <?php esc_html_e( '(when connecting)', 'pagenod' ); ?></p>
     981                                                <?php endif; ?>
     982                                                <p><a class="button" href="<?php echo esc_url( ! empty( $c['settings_url'] ) ? $c['settings_url'] : $c['url'] ); ?>" target="_blank" rel="noopener"><?php esc_html_e( 'Change in the console', 'pagenod' ); ?></a></p>
     983                                        </td>
     984                                </tr>
     985                                <tr>
     986                                        <th scope="row"><?php esc_html_e( 'Changes by Claude', 'pagenod' ); ?></th>
     987                                        <td>
     988                                                <label><input type="checkbox" name="ai_write" value="1" <?php checked( pagenod_cloud_ai_write_enabled() ); ?>> <?php esc_html_e( 'Allow Claude, connected to PageNod Cloud by the agency, to change texts, pages, CSS, images, menus and custom fields of this site', 'pagenod' ); ?></label>
     989                                                <p class="description"><?php esc_html_e( 'Only when the agency also enables it for this site in the console. Every change can be undone from the console.', 'pagenod' ); ?></p>
     990                                                <p><button type="submit" name="do" value="ai_write" class="button"><?php esc_html_e( 'Save', 'pagenod' ); ?></button></p>
     991                                        </td>
     992                                </tr>
     993                                <?php pagenod_sso_render_settings_row(); ?>
     994                                <tr>
    832995                                        <th scope="row"></th>
    833996                                        <td>
    … …  
    8421005                                                <input type="text" class="large-text code" id="pagenod-cloud-code" name="code" placeholder="PNC1-…" autocomplete="off">
    8431006                                                <p class="description"><?php echo wp_kses_post( __( 'Create the code in the console under <b>Sites → Connect</b>. With WP-CLI: <code>wp pagenod cloud connect &lt;code&gt;</code>', 'pagenod' ) ); ?></p>
     1007                                                <fieldset style="margin-top:14px">
     1008                                                        <legend style="font-weight:600;margin-bottom:6px"><?php esc_html_e( 'AI assistant of the agency on this site', 'pagenod' ); ?></legend>
     1009                                                        <label style="display:block;margin:4px 0"><input type="checkbox" name="ai_read" value="1" checked> <?php esc_html_e( 'Reading: it can look at pages, Elementor structure, menus and the error log', 'pagenod' ); ?></label>
     1010                                                        <label style="display:block;margin:4px 0"><input type="checkbox" name="ai_write_console" value="1"> <?php esc_html_e( 'Changes: it can change texts, pages, CSS, images, menus and custom fields (every change can be undone)', 'pagenod' ); ?></label>
     1011                                                        <label style="display:block;margin:4px 0"><input type="checkbox" name="ai_files" value="1"> <?php esc_html_e( 'Theme and plugin files: it can read the code of themes and plugins and, with Changes, fix it', 'pagenod' ); ?></label>
     1012                                                        <p class="description"><?php esc_html_e( 'Applied when connecting, if whoever created the code could turn them on in the console (Changes also need two-step verification). Afterwards they are changed in the console.', 'pagenod' ); ?></p>
     1013                                                </fieldset>
    8441014                                                <p><button type="submit" name="do" value="connect" class="button button-primary"><?php esc_html_e( 'Connect', 'pagenod' ); ?></button></p>
    8451015                                        </td>
    … …  
    8671037                 * : Connection code (PNC1-…) from the console, under Sites → Connect.
    8681038                 *
    869                  * [--no-sync]
    870                  * : Only connect: the data is sent later by WP-Cron.
     1039                 * [--[no-]sync]
     1040                 * : Send the existing data right away (default). With --no-sync, only connect: the data is sent later by WP-Cron.
     1041                 *
     1042                 * [--ai=<switches>]
     1043                 * : AI assistant of the agency on this site, comma separated: read, write, files; or none.
     1044                 * Applied if whoever created the code could turn them on in the console. Without it the console decides.
     1045                 *
     1046                 * ## EXAMPLES
     1047                 *
     1048                 *     wp pagenod cloud connect PNC1-… --ai=read,write,files
    8711049                 */
    8721050                public function connect( $args, $assoc ) {
    873                         $r = pagenod_cloud_connect( $args[0] );
     1051                        $ai = null;
     1052                        if ( isset( $assoc['ai'] ) ) {
     1053                                $list = array_filter( array_map( 'trim', explode( ',', strtolower( (string) $assoc['ai'] ) ) ) );
     1054                                $bad  = array_diff( $list, array( 'read', 'write', 'files', 'none' ) );
     1055                                if ( $bad ) {
     1056                                        WP_CLI::error( 'Unknown --ai value: ' . implode( ', ', $bad ) . '. Use read, write, files or none.' );
     1057                                }
     1058                                $ai = array(
     1059                                        'read'  => in_array( 'read', $list, true ),
     1060                                        'write' => in_array( 'write', $list, true ),
     1061                                        'files' => in_array( 'files', $list, true ),
     1062                                );
     1063                        }
     1064                        $r = pagenod_cloud_connect( $args[0], $ai );
    8741065                        if ( is_wp_error( $r ) ) {
    8751066                                WP_CLI::error( $r->get_error_message() );
    … …  
    8771068                        $c = pagenod_cloud();
    8781069                        WP_CLI::log( sprintf( 'Connected to %s (%s).', $c['agency'], $c['url'] ) );
    879                         if ( empty( $assoc['no-sync'] ) ) {
     1070                        if ( ! empty( $c['ai'] ) ) {
     1071                                WP_CLI::log( pagenod_cloud_ai_summary( $c['ai'] ) );
     1072                        }
     1073                        if ( WP_CLI\Utils\get_flag_value( $assoc, 'sync', true ) ) {
    8801074                                $this->sync( array(), array() );
    8811075                        }
  • pagenod/trunk/includes/console.php

    r3816674 r3822889  
    1212/** Can manage reports and pages: whoever can edit other users' content (editors, administrators). */
    1313function pagenod_can_manage() {
    14         return current_user_can( 'edit_others_posts' );
     14        return current_user_can( 'edit_others_posts' ) || ( function_exists( 'pagenod_sso_is_agent' ) && pagenod_sso_is_agent() );
     15}
     16
     17/** Can add project pages: editors, or the PageNod Cloud account used by the agency team. */
     18function pagenod_can_add_pages() {
     19        return current_user_can( 'publish_posts' ) || ( function_exists( 'pagenod_sso_is_agent' ) && pagenod_sso_is_agent() );
    1520}
    1621
    … …  
    163168
    164169                case 'page_add':
    165                         if ( ! current_user_can( 'publish_posts' ) ) {
     170                        if ( ! pagenod_can_add_pages() ) {
    166171                                wp_send_json_error( array( 'message' => __( 'Permission denied.', 'pagenod' ) ), 403 );
    167172                        }
    … …  
    188193
    189194                case 'pages_import':
    190                         if ( ! current_user_can( 'publish_posts' ) ) {
     195                        if ( ! pagenod_can_add_pages() ) {
    191196                                wp_send_json_error( array( 'message' => __( 'Permission denied.', 'pagenod' ) ), 403 );
    192197                        }
  • pagenod/trunk/includes/frontend.php

    r3816747 r3822889  
    315315                'editMany'            => __( 'This text appears in %s places. Where do you want to change it?', 'pagenod' ),
    316316                'editOnlyHere'        => __( 'Only here', 'pagenod' ),
     317                /* translators: %s: number of places */
     318                'editManyHere'        => __( 'This text is in %s places of this content. Where do you want to change it?', 'pagenod' ),
     319                /* translators: %s: number shown on the page next to the text */
     320                'editOnlyThis'        => __( 'Only this one (number %s)', 'pagenod' ),
     321                /* translators: %s: number of places */
     322                'editAllSpotsOpt'     => __( 'In all %s places, marked by numbers', 'pagenod' ),
    317323                /* translators: %s: place where the text is */
    318324                'editOnlyIn'          => __( 'Only in %s', 'pagenod' ),
  • pagenod/trunk/includes/guest.php

    r3813122 r3822889  
    5656
    5757function pagenod_guest_login( $user ) {
     58        if ( function_exists( 'pagenod_user_disabled' ) && pagenod_user_disabled( $user ) ) {
     59                wp_die( esc_html__( 'This account has been suspended. Contact the team that manages the site.', 'pagenod' ), '', array( 'response' => 403 ) );
     60        }
    5861        wp_set_current_user( $user->ID );
    5962        wp_set_auth_cookie( $user->ID, true, is_ssl() );
    … …  
    131134
    132135        $existing = get_user_by( 'email', $email );
     136        if ( $existing && function_exists( 'pagenod_user_disabled' ) && pagenod_user_disabled( $existing ) ) {
     137                $data['sent'] = true; // same answer as for any other address: nothing is revealed
     138                return;
     139        }
    133140        if ( $existing ) {
    134141                // Never log in someone else's account from a shared link: the owner of the address confirms by email.
  • pagenod/trunk/includes/pages.php

    r3816674 r3822889  
    9595                return '';
    9696        }
     97        // PageNod Cloud account: the name of the team member who is using it now
     98        if ( function_exists( 'pagenod_sso_is_agent' ) && (int) $user->ID === get_current_user_id() && pagenod_sso_is_agent( $user ) && pagenod_sso_actor() ) {
     99                return pagenod_sso_actor()['name'];
     100        }
    97101        $full = trim( $user->first_name . ' ' . $user->last_name );
    98102        return '' !== $full ? $full : $user->user_login;
     103}
     104
     105/** Email of a user (for the PageNod Cloud account: the team member who is using it now). */
     106function pagenod_user_email( $user ) {
     107        if ( function_exists( 'pagenod_sso_is_agent' ) && $user instanceof WP_User && (int) $user->ID === get_current_user_id() && pagenod_sso_is_agent( $user ) && pagenod_sso_actor() ) {
     108                return pagenod_sso_actor()['email'];
     109        }
     110        return $user instanceof WP_User ? $user->user_email : '';
     111}
     112
     113/** Shared PageNod Cloud account: names are the ones saved with each report and message, not the account name. */
     114function pagenod_is_shared_author( $u ) {
     115        return $u && function_exists( 'pagenod_sso_is_agent' ) && pagenod_sso_is_agent( $u );
    99116}
    100117
    … …  
    102119function pagenod_comment_name( $c ) {
    103120        $u = $c->user_id ? get_userdata( (int) $c->user_id ) : false;
    104         return (string) apply_filters( 'pagenod_comment_name', $u ? pagenod_user_name( $u ) : $c->comment_author, $c );
     121        return (string) apply_filters( 'pagenod_comment_name', $u && ! pagenod_is_shared_author( $u ) ? pagenod_user_name( $u ) : $c->comment_author, $c );
    105122}
    106123
    … …  
    109126        $author = (int) get_post_field( 'post_author', $post_id );
    110127        $u      = $author ? get_userdata( $author ) : false;
    111         $name   = $u ? pagenod_user_name( $u ) : trim( preg_replace( '/\s*<[^>]+>/', '', (string) get_post_meta( $post_id, '_pagenod_reporter', true ) ) );
     128        $name   = $u && ! pagenod_is_shared_author( $u ) ? pagenod_user_name( $u ) : trim( preg_replace( '/\s*<[^>]+>/', '', (string) get_post_meta( $post_id, '_pagenod_reporter', true ) ) );
    112129        return (string) apply_filters( 'pagenod_reporter_name', $name, $post_id );
    113130}
    … …  
    417434add_filter( 'views_edit-' . PAGENOD_PAGE_PT, function ( $views ) {
    418435        $views['pagenod_pages_view'] = '<a href="' . esc_url( pagenod_pages_url() ) . '" target="_blank">' . esc_html__( 'Client progress page', 'pagenod' ) . ' ↗</a>';
    419         if ( current_user_can( 'publish_posts' ) ) {
     436        if ( pagenod_can_add_pages() ) {
    420437                $views['pagenod_pages_import'] = '<a href="' . esc_url( pagenod_pages_url() . '#importa' ) . '" target="_blank">' . esc_html__( 'Import site pages', 'pagenod' ) . ' ↗</a>'; // pages are chosen in the dialog on the site
    421438        }
    … …  
    494511add_action( 'admin_post_pagenod_pages_import', function () {
    495512        check_admin_referer( 'pagenod_pages_import' );
    496         if ( ! current_user_can( 'publish_posts' ) ) {
     513        if ( ! pagenod_can_add_pages() ) {
    497514                wp_die( esc_html__( 'Permission denied.', 'pagenod' ) );
    498515        }
  • pagenod/trunk/includes/submit.php

    r3813122 r3822889  
    118118
    119119        $user     = wp_get_current_user();
    120         $reporter = pagenod_user_name( $user ) . ' <' . $user->user_email . '>';
     120        $reporter = pagenod_user_name( $user ) . ' <' . pagenod_user_email( $user ) . '>';
    121121
    122122        $post_id = wp_insert_post( array(
  • pagenod/trunk/includes/text-apply.php

    r3816747 r3822889  
    863863}
    864864
    865 /** Writes the change in the places found ($loc); returns the log for "Undo", or a WP_Error. */
    866 function pagenod_tx_apply_raw( $o, $n, $loc, $only = array() ) {
     865/**
     866 * Calls $fn only on the texts inside the Elementor element $eid (its settings and children).
     867 */
     868function pagenod_tx_walk_el( &$v, $eid, $fn, $inside = false ) {
     869        if ( ! is_array( $v ) ) {
     870                if ( $inside && is_string( $v ) ) {
     871                        $r = $fn( $v );
     872                        if ( is_string( $r ) ) {
     873                                $v = $r;
     874                        }
     875                }
     876                return;
     877        }
     878        if ( ! $inside && isset( $v['id'], $v['elType'] ) && $v['id'] === $eid ) {
     879                $inside = true;
     880        }
     881        foreach ( $v as &$x ) {
     882                pagenod_tx_walk_el( $x, $eid, $fn, $inside );
     883        }
     884        unset( $x );
     885}
     886
     887/**
     888 * Writes the change in the places found ($loc); returns the log for "Undo", or a WP_Error.
     889 * $one: only one of the times the text is in the same content, array( 'eid' => Elementor widget
     890 * clicked, 'nth' => its position among the places on the page, 'of' => how many places the page shows).
     891 */
     892function pagenod_tx_apply_raw( $o, $n, $loc, $only = array(), $one = null ) {
    867893        if ( ! $loc['total'] ) {
    868894                return new WP_Error( 'missing', $loc['done'] ? __( 'The new text is already on the site.', 'pagenod' ) : __( 'The original text was not found in the site content: change it by hand.', 'pagenod' ) );
    … …  
    880906        $new   = pagenod_tx_norm( $n );
    881907        $items = array();
     908        if ( $one ) {
     909                if ( 1 !== count( $hits ) || ! empty( $hits[0][0]['eldef'] ) ) {
     910                        return new WP_Error( 'one', __( 'Only this place cannot be changed safely: choose all the places, or change it by hand.', 'pagenod' ) );
     911                }
     912                $whole = ! empty( $loc['whole'] );
     913                $match = function ( $s ) use ( $orig, $whole ) {
     914                        $proj = pagenod_tx_project( $s );
     915                        $ats  = pagenod_tx_find( $proj, $orig );
     916                        return ! $ats || ( $whole && ! pagenod_tx_whole( $proj, $orig ) ) ? array() : $ats;
     917                };
     918                $check = function ( $s ) use ( $new ) {
     919                        return '' === $new || (bool) pagenod_tx_find( pagenod_tx_project( $s ), $new );
     920                };
     921                $src = $hits[0][0];
     922                $raw = pagenod_tx_raw( $src );
     923                list( $val, $fmt ) = pagenod_tx_decode( $raw );
     924                $ok   = true;
     925                $done = 0;
     926                $eid  = (string) ( $one['eid'] ?? '' );
     927                // Elementor: the widget that was clicked, if the text is there and not in all of them.
     928                if ( '' !== $eid && 'json' === $fmt ) {
     929                        $in = 0;
     930                        pagenod_tx_walk_el( $val, $eid, function ( $s ) use ( $match, &$in ) {
     931                                $in += count( $match( $s ) );
     932                                return null;
     933                        } );
     934                        if ( $in && $in < (int) $hits[0][1] ) {
     935                                pagenod_tx_walk_el( $val, $eid, function ( $s ) use ( $match, $check, $orig, $new, &$ok, &$done ) {
     936                                        $ats = $match( $s );
     937                                        if ( ! $ats ) {
     938                                                return null;
     939                                        }
     940                                        $proj = pagenod_tx_project( $s );
     941                                        foreach ( array_reverse( $ats ) as $at ) {
     942                                                $s    = pagenod_tx_rewrite( $s, $proj, $at, $orig, $new );
     943                                                $proj = pagenod_tx_project( $s );
     944                                                $done++;
     945                                        }
     946                                        $ok = $ok && $check( $s );
     947                                        return $s;
     948                                } );
     949                        }
     950                }
     951                // Otherwise its position: the page must show exactly the times the text is stored.
     952                if ( ! $done ) {
     953                        $nth = (int) ( $one['nth'] ?? -1 );
     954                        if ( $nth < 0 || (int) ( $one['of'] ?? 0 ) !== (int) $hits[0][1] ) {
     955                                return new WP_Error( 'one', __( 'Only this place cannot be changed safely: choose all the places, or change it by hand.', 'pagenod' ) );
     956                        }
     957                        $i = 0;
     958                        pagenod_tx_walk( $val, function ( $s ) use ( $match, $check, $orig, $new, $nth, &$i, &$ok, &$done ) {
     959                                $ats = $match( $s );
     960                                if ( ! $ats ) {
     961                                        return null;
     962                                }
     963                                $hit = $nth - $i;
     964                                $i  += count( $ats );
     965                                if ( $hit < 0 || $hit >= count( $ats ) ) {
     966                                        return null;
     967                                }
     968                                $s = pagenod_tx_rewrite( $s, pagenod_tx_project( $s ), $ats[ $hit ], $orig, $new );
     969                                $done++;
     970                                $ok = $ok && $check( $s );
     971                                return $s;
     972                        } );
     973                }
     974                $after = pagenod_tx_encode( $val, $fmt );
     975                if ( ! $ok || 1 !== $done || ! is_string( $after ) || $after === $raw ) {
     976                        return new WP_Error( 'one', __( 'Only this place cannot be changed safely: choose all the places, or change it by hand.', 'pagenod' ) );
     977                }
     978                $hits  = array();
     979                $items = array( array( 'src' => $src, 'before' => $raw, 'after' => $after ) );
     980        }
    882981        foreach ( $hits as $h ) {
    883982                $src  = $h[0];
    … …  
    9381037                't'     => time(),
    9391038                'who'   => pagenod_user_name( wp_get_current_user() ),
     1039                'one'   => (bool) $one,
    9401040                'items' => array_map( function ( $it ) {
    9411041                        return array( 'src' => $it['src'], 'before' => $it['before'], 'md5' => md5( $it['after'] ) );
    … …  
    9461046/** How many times the text was in the places changed (the log of pagenod_tx_apply_raw). */
    9471047function pagenod_tx_log_count( $loc, $log ) {
     1048        if ( ! empty( $log['one'] ) ) {
     1049                return 1;
     1050        }
    9481051        $keys = array_map( function ( $it ) { return pagenod_tx_src_key( $it['src'] ); }, (array) ( $log['items'] ?? array() ) );
    9491052        $n    = 0;
    … …  
    12461349                }
    12471350        }
    1248         $log = pagenod_tx_apply_raw( $o, $n, $loc, $only );
     1351        // Only the place being edited, when the text is more than once in the same content.
     1352        $one = null;
     1353        $raw = json_decode( sanitize_text_field( wp_unslash( $_POST['one'] ?? '' ) ), true );
     1354        if ( is_array( $raw ) && 1 === count( $only ) ) {
     1355                $one = array(
     1356                        'eid' => sanitize_key( wp_unslash( $_POST['eid'] ?? '' ) ),
     1357                        'nth' => (int) ( $raw['nth'] ?? -1 ),
     1358                        'of'  => (int) ( $raw['of'] ?? 0 ),
     1359                );
     1360        }
     1361        $log = pagenod_tx_apply_raw( $o, $n, $loc, $only, $one );
    12491362        if ( is_wp_error( $log ) ) {
    12501363                wp_send_json_error( array( 'message' => $log->get_error_message() ), 400 );
  • pagenod/trunk/includes/thread.php

    r3813122 r3822889  
    6767                'comment_type'         => 'note' === $side ? 'comment' : PAGENOD_MSG,
    6868                'comment_author'       => $name,
    69                 'comment_author_email' => $user && $user->exists() ? $user->user_email : '',
     69                'comment_author_email' => $user && $user->exists() ? pagenod_user_email( $user ) : '',
    7070                'user_id'              => $user && $user->exists() ? $user->ID : 0,
    7171                'comment_approved'     => 1,
  • pagenod/trunk/includes/view.php

    r3816674 r3822889  
    163163
    164164        <div class="summary" role="group" aria-label="<?php esc_attr_e( 'Filter by status', 'pagenod' ); ?>">
     165                <?php /* "To do" (everything not resolved) comes first and is the default, "All" goes last, as in PageNod Cloud. */ ?>
     166                <button type="button" class="stat s-active" data-filter="active" aria-pressed="true"><b><?php echo (int) ( count( $posts ) - $counts['done'] ); ?></b><span><?php echo esc_html_x( 'To do', 'reports status filter', 'pagenod' ); ?></span></button>
     167                <?php foreach ( $statuses as $key => $label ) : ?>
     168                        <button type="button" class="stat s-<?php echo esc_attr( $key ); ?>" data-filter="<?php echo esc_attr( $key ); ?>" aria-pressed="false"><b><?php echo (int) $counts[ $key ]; ?></b><span><?php echo esc_html( $label ); ?></span></button>
     169                <?php endforeach; ?>
    165170                <button type="button" class="stat" data-filter="" aria-pressed="false"><b><?php echo count( $posts ); ?></b><span><?php echo esc_html_x( 'All', 'reports status filter', 'pagenod' ); ?></span></button>
    166                 <?php foreach ( $statuses as $key => $label ) : ?>
    167                         <button type="button" class="stat s-<?php echo esc_attr( $key ); ?>" data-filter="<?php echo esc_attr( $key ); ?>" aria-pressed="<?php echo 'open' === $key ? 'true' : 'false'; ?>"><b><?php echo (int) $counts[ $key ]; ?></b><span><?php echo esc_html( $label ); ?></span></button>
    168                 <?php endforeach; ?>
    169171        </div>
    170172
  • pagenod/trunk/pagenod.php

    r3817969 r3822889  
    33 * Plugin Name: PageNod
    44 * Description: Website feedback with screenshots: the client clicks "Report", draws on the screenshot and describes the issue; URL, device and JavaScript errors are collected automatically. Admin list, client status page, email digest every 6 hours and approval of developed pages with progress charts.
    5  * Version: 1.45.0
     5 * Version: 1.53.0
    66 * Requires at least: 6.0
    77 * Requires PHP: 7.4
    … …  
    1515}
    1616
    17 define( 'PAGENOD_VERSION', '1.45.0' );
     17define( 'PAGENOD_VERSION', '1.53.0' );
    1818define( 'PAGENOD_URL', plugin_dir_url( __FILE__ ) );
    1919define( 'PAGENOD_FILE', __FILE__ );
    … …  
    4949require_once __DIR__ . '/includes/guide.php';
    5050require_once __DIR__ . '/includes/cloud.php';
     51require_once __DIR__ . '/includes/cloud-users.php';
     52require_once __DIR__ . '/includes/cloud-ai.php';
     53require_once __DIR__ . '/includes/cloud-ai-write.php';
     54require_once __DIR__ . '/includes/cloud-ai-media.php';
     55require_once __DIR__ . '/includes/cloud-ai-menus.php';
     56require_once __DIR__ . '/includes/cloud-ai-elementor.php';
     57require_once __DIR__ . '/includes/cloud-ai-abilities.php';
     58require_once __DIR__ . '/includes/cloud-ai-files.php';
     59require_once __DIR__ . '/includes/cloud-sso.php';
    5160
    5261register_activation_hook( __FILE__, 'pagenod_activate' );
  • pagenod/trunk/readme.txt

    r3817969 r3822889  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.45.0
     7Stable tag: 1.53.0
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    9191* Safari: Apple Push Notification service – [Terms](https://www.apple.com/legal/internet-services/), [Privacy Policy](https://www.apple.com/legal/privacy/)
    9292
    93 **PageNod Cloud (optional, off by default).** An administrator can connect the site to the PageNod Cloud console of their agency (*Settings → PageNod Cloud*, or `wp pagenod cloud connect`). Nothing is sent until someone does. Once connected, the site sends the console a copy of the reports (text, page address, device and browser details, JavaScript errors, pin position, reporter name and email), their conversations and internal notes, screenshots and attachments, tags, assignments and the project progress, plus the site name, address and the WordPress, PHP and PageNod versions. Data is sent when it changes and when connecting; every request is signed with a secret key of the site. Disconnecting stops it at once. The console address is the one contained in the connection code.
     93**PageNod Cloud (optional, off by default).** An administrator can connect the site to the PageNod Cloud console of their agency (*Settings → PageNod Cloud*, or `wp pagenod cloud connect`). Nothing is sent until someone does. Once connected, the site sends the console a copy of the reports (text, page address, device and browser details, JavaScript errors, pin position, reporter name and email), their conversations and internal notes, screenshots and attachments, tags, assignments and the project progress, the people who use PageNod on the site (name, email, role, PageNod permissions, last access), plus the site name, address, folder on the server and the WordPress, PHP and PageNod versions. Data is sent when it changes and when connecting; every request is signed with a secret key of the site. Disconnecting stops it at once. The console address is the one contained in the connection code. From the console the agency can reply to reports and manage the PageNod Reporter and Collaborator accounts of the site; accounts with editing permissions are never changed from the console.
    9494
    9595* PageNod Cloud by Urka – [Terms of service](https://pagenod.cloud/terms), [Privacy policy](https://pagenod.cloud/privacy-policy)
    … …  
    9898
    9999== Changelog ==
     100
     101= 1.53.0 =
     102* PageNod Cloud: when connecting the site (settings page or `wp pagenod cloud connect --ai=read,write,files`) you can choose what the AI assistant of the agency may do on it: reading, changes, theme and plugin files. The console applies only what the person who created the code could turn on there; afterwards they are changed in the console.
     103* WP-CLI: `wp pagenod cloud connect --no-sync` is accepted again.
     104
     105= 1.52.1 =
     106* PageNod Cloud: the agency team can delete internal notes from the console.
     107
     108= 1.52.0 =
     109* PageNod Cloud: the agency team can assign a report (to a collaborator or a team member) and add or remove its tags from the console.
     110* PageNod Cloud: when the agency enables it, AI assistants can read, search and change the files of themes and plugins. PHP is checked before saving, the site is loaded after the change (as the WordPress file editor does) and a fatal error puts the file back; every change can be undone from the console. Sites with DISALLOW_FILE_EDIT are respected.
     111
     112= 1.51.1 =
     113* Pins and text-edit icons whose element cannot be seen right now (another slide of a slider, a closed tab) are shown in transparency until it appears.
     114
     115= 1.51.0 =
     116* PageNod Cloud: the site tells the console its WordPress folder, so the optional SSH mode for AI assistants fills it in by itself.
     117
     118= 1.50.0 =
     119* PageNod Cloud: Claude can use the abilities that plugins offer to AI (WordPress Abilities API, for example Elementor and Yoast SEO), only those the agency allows for the site. Abilities that change the site need changes to be enabled and cannot be undone from the console.
     120
     121= 1.49.1 =
     122* PageNod Cloud: Claude can also change the menus of block themes (Navigation block): text, link, order, add or remove an item, with undo.
     123
     124= 1.49.0 =
     125* PageNod Cloud: Claude can also replace images (wherever they are used, with any theme or page builder, also with an image the client attached to the report), change WordPress menus (text, link, order, add or remove an item), custom fields (ACF included) and, on Elementor sites, the style and visibility of an element or the global colours and fonts. Every change can be undone from the console.
     126
     127= 1.48.0 =
     128* PageNod Cloud: Claude can also change the site, when the agency enables it for the site in the console: texts (where they are stored, Elementor included), title, content and excerpt of a page, the Additional CSS. Every change is kept and can be undone from the console. The site administrator can turn this off in Settings → PageNod Cloud.
     129
     130= 1.47.0 =
     131* PageNod Cloud: when an agency connects Claude to its console, Claude can look at the site to diagnose a report: where a text is stored, a page and its Elementor structure, the PHP error log, versions and active plugins. Read only: nothing on the site is changed.
     132
     133= 1.46.2 =
     134* Reports page: the "To do" filter (everything not resolved yet) comes first and is selected by default; "All" is now last, as in PageNod Cloud.
     135* PageNod Cloud: access from the console. The agency team can open the site's reports and pins straight from the console, with a dedicated "PageNod Cloud" account that can only work on reports and project pages. It can be turned off in the PageNod Cloud settings.
     136
     137= 1.46.1 =
     138* Edit text: when the same text is in several places of the same content (for example a placeholder used in two blocks), you can now change only the one you are editing, or all of them.
     139
     140= 1.46.0 =
     141* PageNod Cloud: the agency can manage the site's PageNod users from the console, without logging into wp-admin: see reporters, collaborators, guests and the team; create a reporter or collaborator account (the person gets the usual email to choose a password); change name, email, role and the "can apply text changes" permission; send the access link again; suspend, reactivate or remove an account.
     142* Safety: the console can only act on accounts without editing permissions and can only give the PageNod Reporter or Collaborator role. Administrators, editors and authors are shown but never changed from the console.
     143* Suspended accounts cannot log in (password, guest link or password recovery) and their open sessions are closed. Removing an account keeps the reports and messages it sent.
     144* PageNod Cloud: the people who use PageNod on the site (name, email, role, permissions, last access) are now part of the data sent to the console.
    100145
    101146= 1.45.0 =
    … …  
    120165* "How to use" guide: new step "Every text keeps its versions", with screenshot and animation.
    121166
    122 = 1.43.2 =
    123 * Pencil pin: the versions show the plain texts; "Compare with the previous version" opens a window with the text before and after side by side, the changes highlighted, and the restore button. Places of a text are no longer repeated.
    124 
    125 = 1.43.1 =
    126 * Side list, "More options": two switches, "Hide reports" and "Hide text changes", each for its own pins; the pages to open (report list, project progress) are now buttons side by side below them.
    127 
    128 = 1.43.0 =
    129 * Text changes: every text now keeps its own history, up to 10 changes (approved from a report or made with "Edit text"), and any earlier version can be put back on the site. A restore is a new version itself.
    130 * On the page, the team (and the users allowed to change texts) see a pencil pin at the start of each changed text: it opens the versions, with what changed, when and who, and the button to restore one. "More options" in the side list shows or hides these pins.
    131 * "Text changes" page: one card per text, with the version on the site now and all the earlier ones.
    132 
    133 = 1.42.0 =
    134 * New "Text changes" page (Site review menu and admin bar): the last 10 text changes made with PageNod, newest first, with date, who, before/after, page and place. Each one can be restored to the previous version: only that text is written back, even if the page was edited afterwards; if the same text was changed again by PageNod, those later changes are undone too.
    135 
    136 = 1.41.9 =
    137 * Page switcher: the heading now reads e.g. "22 reports to handle in 2 pages".
    138 
    139 = 1.41.8 =
    140 * Page switcher of the side list: only pages with reports still to handle (open, in progress, waiting for information), with their total.
    141 
    142 = 1.41.7 =
    143 * Side list: the "On this page" header opens the list of the pages with reports (with how many are not resolved yet); choosing one opens that page with the side list already open.
    144 
    145 = 1.41.6 =
    146 * Side list more compact: "New report" and "Edit text" share one line, and the other options (pins, report list, progress, push notifications) are in a "More options" menu.
    147 
    148 = 1.41.5 =
    149 * The report window on the site no longer has the "Open in a new tab" button.
    150 * "Show the client’s name and email" appears only when a collaborator is chosen.
    151 
    152 = 1.41.4 =
    153 * Reports can be assigned to team members too (administrators and editors already registered on the site), not only to PageNod Collaborators. They are told by email, bell and push; collaborators remain the option for people outside the company.
    154 
    155 = 1.41.3 =
    156 * Browser notifications: the first time someone opens the review area (widget or reports pages), a card asks whether to turn them on; the browser asks for permission only after "Turn on". "Not now" hides it, it comes back once after 14 days.
    157 * Reports now come before Project progress in the admin bar menu, in the review area tabs and in the widget menu.
    158 
    159 = 1.41.2 =
    160 * After the plugin is activated, the "How to use" guide opens (not after bulk activations or from WP-CLI, where a notice links to it).
    161 
    162 = 1.41.1 =
    163 * Settings > Advanced: new option "Delete all PageNod data when the plugin is deleted" (off by default). When on, deleting the plugin removes reports, conversations, attachments, tags, project progress, guest accounts and settings; reviewers and collaborators become Subscribers.
    164 * "How to use" guide: animated steps (what PageNod does, sending a report, text changes, approving), collaborators, push notifications; link in the admin bar. The Tags screen is no longer in the menu (tags are managed from each report).
    165 
    166 = 1.41.0 =
    167 * New "How to use" guide: eight steps with screenshots (inviting the client, reports, text changes, statuses, project progress). A notice invites you to open it after installation; it is always available in the PageNod menu, in the Settings header and on the Plugins screen. Screenshots in Italian for Italian sites, in English for the others.
    168 
    169 = 1.40.7 =
    170 * New installs let clients report on all pages by default (Settings > Pages clients can report on). Existing sites keep their choice. The settings texts say "widget" instead of "button".
    171 
    172 = 1.40.6 =
    173 * Settings page reorganized into sections (General, Who can use PageNod, Email notifications, Text changes). Attachments, report limit, reopening, login page and system cron are under "Advanced settings", shown with a switch. The page header shows the PageNod logo.
    174 
    175 = 1.40.5 =
    176 * Settings: removed the "PageNod credit" option. The footer of the review pages shows the PageNod logo and name, without a link to external websites.
    177 
    178 = 1.40.4 =
    179 * Settings, guests: "Create a new link" is now a button that changes the link right away, after a confirmation, without saving the page.
    180 
    181 = 1.40.3 =
    182 * Settings: who can apply text changes can now be chosen by role too (by default administrators, editors and shop managers), besides individual users.
    183 
    184 = 1.40.2 =
    185 * Emails to collaborators (report assigned, report sent back) are collected and sent as a digest at the same interval as the client digest (30 minutes if that is off), one email per person; bell and push stay immediate.
    186 
    187 = 1.40.1 =
    188 * Report detail: status, assignment and deletion are in their own bar between the report and the conversation, no longer above the message box. The conversation keeps the message, "Send and mark …" and the internal note.
    189 
    190 = 1.40.0 =
    191 * New: assign reports to collaborators. Users with the new "PageNod Collaborator" role see only the reports assigned to them (and the ones they send); for each assignment the team chooses whether they see the client's name and email. Collaborators can change the status and write to the team, but cannot resolve: they mark the report "Done" and the team verifies it (the client does not see this step), then resolves it or sends it back. Email, bell and push notifications for assignments, "Done" and send-backs; "Assignment" filter in the reports list.
    192 * Fix: clients logged in to PageNod could not load public site data from the REST API (e.g. a timeline); only requests that would act as the user are refused now.
    193 
    194 = 1.39.10 =
    195 * Security hardening: every request value (form fields, JSON fields, cookies, uploaded file paths) is now sanitized with the WordPress functions as soon as it is read.
    196 
    197 = 1.39.9 =
    198 * With the list of reports open and the page scrolled sideways, the fixed bars of the site (sticky menus) move with the page too.
    199 
    200 = 1.39.8 =
    201 * Fix: opening a resolved report from a link or with the window arrows switched the "Resolved" filter on for good, so after reloading the page the list showed the resolved reports again. That filter now lasts until the page is reloaded, and the link no longer reopens the report on reload.
    202 * With the list of reports open, the page can be scrolled sideways to see what is underneath it.
    203 
    204 = 1.39.7 =
    205 * Fix: a text change whose only long word has an accent (e.g. "Qualità A/B.") was never found on the site, so it could not be approved or applied.
    206 
    207 = 1.39.6 =
    208 * Code: every script is now a separate file loaded through the WordPress API (the report window over the site had an inline script); JavaScript and CSS files are formatted for reading.
    209 * Login pages work on sites with plain permalinks (before, the login address needed pretty permalinks).
    210 * Text changes: stricter check of the database fields that can be edited.
    211 * Readme: new "External services" section (browser push services) and "Source code" section.
    212 
    213 = 1.39.5 =
    214 * The look of the plugin no longer depends on the theme: its rounded corners are kept even on themes that square every element (e.g. "body * { border-radius: 0 !important }").
    215 
    216 = 1.39.4 =
    217 * Pin popover: "Open the report" has the same eye icon as the side list.
    218 
    219 = 1.39.3 =
    220 * Side list: the button that opens a report in the window over the page now has an eye icon (the old arrow looked like a link to another page).
    221 
    222 = 1.39.2 =
    223 * Push notifications: the last 20 sends are logged (option pagenod_push_log) for troubleshooting.
    224 
    225 = 1.39.1 =
    226 * Side list: "Text changes only" is an on/off switch, without the number.
    227 
    228 = 1.39.0 =
    229 * When the team changes the status of a report, its reporter is told in the bell ("Report #N is now: …") and with a push notification. A change undone within 10 minutes is not notified.
    230 
    231 = 1.38.0 =
    232 * Push notifications can be turned on (and off) from the side list on the site too, not only from the bell of the reports pages: same subscription per browser. The team gets a push for every new report and every client message.
    233 
    234 = 1.37.2 =
    235 * Side list: "Hide pins" / "Show pins" without the number.
    236 
    237 = 1.37.1 =
    238 * Pin popover: the status is changed from a "Change status" menu (two clicks, no accidental changes), with "Undo" in the message.
    239 * A status change that cancels the previous one within 10 minutes removes both from the client notifications.
    240 
    241 = 1.37.0 =
    242 * Text changes: texts that Elementor shows from a widget default (the field was never changed, so nothing was saved) are now found through the widget that was clicked, and the new text is saved in that widget, as if it were edited in Elementor (with "Undo").
    243 
    244 = 1.36.2 =
    245 * Edit text: the button is now simply "Save".
    246 
    247 = 1.36.1 =
    248 * Text changes: whole words only, and a field holding exactly the text wins over longer texts that only contain it (editing "Antik" no longer offers "Antik SUP"). The places to choose from show the repeater row and what they say now.
    249 
    250 = 1.36.0 =
    251 * Text changes can be approved straight from the popover of their pin ("Approve and apply to the site", for the team and the enabled reviewers): the text changes on the page at once and the report is resolved, with "Undo" in the popover and in the message. When the text is in several places, the popover lists them with a checkbox each (the one on the page already checked).
    252 
    253 = 1.35.0 =
    254 * Side list: "New report" and "Edit text" one under the other, full width; new "Text changes only" filter (the pins on the page follow it).
    255 * The popover of a pin can be dragged by its header to see what is underneath; reopened, it starts again next to its pin.
    256 
    257 = 1.34.1 =
    258 * Approving (or undoing) a text change in the report window opened from a pin updates the text on the page underneath straight away, without reloading.
    259 
    260 = 1.34.0 =
    261 * Team: the status of a report can be changed straight from the popover of its pin (the pin, the list and the counters follow; the client is told as usual).
    262 
    263 = 1.33.0 =
    264 * Text changes are also found in the fields and descriptions of categories and other taxonomy terms (ACF on terms included).
    265 * In the report the button is now "Approve and apply to the site": applying the change also marks the report as resolved (the client is told as usual); "Undo" puts back the text and the previous status.
    266 
    267 = 1.32.0 =
    268 * Edit text: as soon as a text is opened, the bar says where it is. If it appears in several places it asks "Only here" or "In all N places" (the one shown on the page is recognized from the text around it, e.g. the selected tab); if it comes from the theme or a plugin it says so and saving is off.
    269 
    270 = 1.31.1 =
    271 * Text changes: a warning in the report when the new text has a line break but the field is a single line (ACF text, email or URL), since the page may show it as a space.
    272 
    273 = 1.31.0 =
    274 * "Edit text" in the side list (team and reviewers enabled in Settings): click a text on the page, rewrite it right there and save: it changes on the site at once, with "Undo". Each change is kept in the history as a resolved report with the comparison between the old and the new text.
    275 * Text changes: line breaks now work (a new line becomes a line break on the page, also in plain text fields; removing one joins the lines).
    276 
    277 = 1.30.0 =
    278 * Apply text changes to the site: in the report the team finds "Apply to the site". The original text is looked for wherever the content is kept, whatever built the page: post title, excerpt and content (Gutenberg, classic editor and builders that use it), custom fields (ACF included, also inside repeaters), page builder data (Elementor, Beaver Builder, Bricks and others), and also in other content shown on the page, templates, menus, widgets and option pages. Only the words that change are replaced, so bold, links and line breaks stay. When the text is in several places you choose where (the most likely are already checked). "Undo" puts back exactly what was there, if nobody changed it in the meantime. Elementor and the usual page caches are cleared.
    279 * Settings → "Can apply text changes": reviewers who can apply their own text changes, also straight away when sending the report, and edit texts directly on the page.
    280 
    281 = 1.29.2 =
    282 * Moving between reports with the arrows of the report window, the page underneath scrolls to the current report (its pin in the middle of the screen), so closing the window you are already there.
    283 
    284 = 1.29.1 =
    285 * The side list no longer opens by itself when a page loads: it opens only from the tab.
    286 
    287 = 1.29.0 =
    288 * The button in the bottom corner is gone: everything (New report, pins, project progress, report list) starts from the PageNod tab on the right edge. The "Button position" setting is removed.
    289 
    290 = 1.28.1 =
    291 * "New report" also at the top of the side list: it closes the list so the whole page is free to choose the point. The tab on the right edge shows the PageNod icon.
    292 
    293 = 1.28.0 =
    294 * The bottom corner holds only the "New report" button (its label appears on hover). The other menu items (show/hide pins, project progress, report list and any added with the pagenod_menu_items filter) are at the bottom of the side list, which opens from the tab on the right edge, now always present.
    295 
    296 = 1.27.2 =
    297 * The "Reports on this page" menu item is gone: the list opens from the tab on the right edge.
    298 
    299 = 1.27.1 =
    300 * The list of the page's reports closes when clicking on the page outside it (clicks on pins, their popover and the report window keep it open).
    301 
    302 = 1.27.0 =
    303 * A tab on the right edge of the page (with the number of open reports) opens and closes the list of the page's reports; the list is in number order.
    304 * Status filters in the list (several at once), resolved reports included on request; the pins on the page follow the filter and the choice is remembered.
    305 * Changing the status of a report (or deleting it) in the window opened from a pin updates its pin, the list and the counters straight away.
    306 
    307 = 1.26.0 =
    308 * List of the reports on the page: a side panel (a sheet at the bottom on phones) with the open reports of the page you are looking at, ordered from top to bottom, with a status filter. Hovering a row outlines its element; a click scrolls to the pin and opens it, the arrow opens the report. Open it from the tab on the right edge.
    309 
    310 = 1.25.0 =
    311 * Whoever sent a report can mark it as resolved or delete it, from the report page or from the window opened from the pin (the pin turns green or disappears). The team gets "Resolved by the client" in the email alert.
    312 
    313 = 1.24.0 =
    314 * Text changes: when the pin is on a text (title, paragraph, button…), the client can rewrite it right in the report window, seeing the changes as they type. The report keeps the original and the proposed text, shown as a word-by-word comparison (removed words struck through in red, added words in green) with "Original" and "Proposed" views and a "Copy the new text" button, in the report, in the pin popover and in the team emails.
    315 * From the pin popover, "Show the proposed text on the page" previews the new text in place (only on that screen).
    316 
    317 = 1.23.1 =
    318 * The report window opened from a pin has arrows (and the left/right keys) to go to the previous or next report of the page, with the position (e.g. 2 / 5).
    319 
    320 = 1.23.0 =
    321 * Every report now needs a pin: the "screenshot of the whole page" option is gone and the server refuses reports without a point on the page.
    322 * The pointer becomes a pin while choosing the point to report.
    323 * "Open the report" from a pin opens the report in a window over the page instead of a new tab (with a button to open it in a new tab). "Show on the page" inside it closes the window and points at the pin.
    324 
    325 = 1.22.2 =
    326 * While choosing the point to report, the bar moves to the bottom of the screen when the top is taken by a sticky menu or the header (and back when it is free), so the menu can be reported too. A new button moves it to the other edge by hand.
    327 
    328 = 1.22.1 =
    329 * Report sent: tidier confirmation (check mark, title, report number and the two buttons side by side), with spacing that the theme cannot override.
    330 
    331 = 1.22.0 =
    332 * Screenshot annotations: a click on a text opens it again for editing (with the Select or the Text tool); dragging it still moves it.
    333 * Rectangles can be resized: the selected rectangle has handles on corners and sides.
    334 
    335 = 1.21.0 =
    336 * Screenshot annotations as separate items: with the new Select tool every line, rectangle and text can be selected, moved, recoloured or deleted (× on the selection or the Delete key); a double click on a text edits it. Undo also covers moves, colour changes and deletions.
    337 
    338 = 1.20.0 =
    339 * Screenshot annotations: toolbar with pen, rectangle and text, six colours, undo and clear. Each tool has its own cursor (a pencil in the chosen colour, a crosshair for rectangles, a text cursor); text is typed straight on the image and placed with Enter.
    340 * "Something missing? Capture with the browser" replaces the longer hint under the screenshot.
    341 
    342 = 1.19.2 =
    343 * Report window: removed the hint text above the screenshot.
    344 
    345 = 1.19.1 =
    346 * Screenshot: it no longer stays stuck on "Capturing the screen…" on pages with videos. Visible videos are captured as a picture of their current frame, the ones out of view are left out; in any case after 25 seconds the window opens, with the option to capture with the browser.
    347 * Choosing the point: the bar shows the two options more clearly ("Click the point…" or "Screenshot of the whole page", with a camera icon) and sits below the WordPress toolbar.
    348 
    349 = 1.19.0 =
    350 * Pins on the page: when reporting, the client first clicks the exact point of the page (the element under the pointer is highlighted), or chooses "Screenshot of the whole page". The pin and the outline of the element are drawn on the screenshot.
    351 * Reports not yet resolved appear as numbered pins on their element when the page is reopened, also at a different window size; a click shows the message, the status and the link to the report. The pins can be hidden from the button menu.
    352 * Report detail: new "Show on the page" link, which opens the page, scrolls to the pin and highlights it.
    353 
    354 = 1.18.2 =
    355 * All scripts and styles are loaded through the WordPress script and style API (files in assets/), no more inline code.
    356 * Output of the review pages is filtered with wp_kses(); stricter permission check on the push notification endpoint.
    357 * Translations are loaded by WordPress (translate.wordpress.org); the plugin no longer calls load_plugin_textdomain().
    358 
    359 = 1.18.1 =
    360 * Progress: new "Move…" button to pick the destination of a page from a searchable list (before, after or inside another page), handy for long distances.
    361 * Progress: while dragging, the list shrinks to the page titles and the window scrolls by itself near the top and bottom edges.
    362 
    363 = 1.18.0 =
    364 * Guests: optional invitation link. People without an account enter name and email and can send reports straight away, without a password. An address that is already registered gets a one-time access link by email instead. Off by default; the link can be regenerated, and turning the option off blocks every guest.
    365 * Guests see only their own reports by default; Settings → Guests can let them see all reports.
    366 * Reports from guests are marked "guest" for the team.
    367 * Footer with the PageNod logo on the review pages; the link to the PageNod website is opt-in.
    368 * The page filter in the reports list shows the page address instead of the meta title.
    369 * Screenshots can be downloaded from the report detail and from the enlarged view.
    370 * Internal tags on reports: the team adds them from the report detail (or from the dashboard) and filters the list by tag. Never shown to the client.
    371 * Arrows (and keyboard/swipe) to move between all the images of a report in the enlarged view.
    372 * Page approvals reach the team in the email digest instead of one email each.
    373 * Names: first and last name are shown when set, otherwise the username.
    374 * Notifications: bell with the number of new reports and messages in the top bar; opening a report clears its notifications. A dot marks the reports with news in the list.
    375 * Email digests skip what each person has already seen in the app.
    376 * Browser push notifications (Web Push): each person turns them on from the bell and is alerted about new reports and messages even with the site closed. The push carries no content: the browser asks the site what is new with the person's own login. Keys are created on the site (see External services).
    377 * Copy button next to the page address in the report detail.
    378 * Clients can report only on pages in review or approved (Settings → Pages clients can report on); on the other pages the button shows a message instead of the report window. Posts and other content follow their template; other languages (WPML) follow the original page. The team can always report.
    379 * Deleting a report for good (emptying the trash) also deletes its media from the library: screenshot, attachments and files sent in the conversation.
    380 
    381 = 1.17.0 =
    382 * Internal prefix renamed from `snapnote_` to `pagenod_` (functions, constants, options, meta keys, post types, role, CSS classes). Existing data is migrated automatically on update; old links keep working.
    383 * Reports list: sort oldest first (default) or newest first.
    384 * Report detail: page address instead of its title, screen resolution and window size, and (for the team) all technical details.
    385 
    386 = 1.16.0 =
    387 * New PageNod logo: admin menu icon, report button on the site, settings page and email header.
    388 * Individual users (access and notification recipients) are picked with a tag-style search instead of a long list.
    389 
    390 = 1.15.0 =
    391 * The Reports page now lists compact previews; each report opens its own detail page with the screenshot, technical data and the conversation.
    392 * Email "Reply" links open the report detail directly.
    393 * Link to the WordPress dashboard in the top bar for users who can use it.
    394 * Reports are numbered with their own counter starting from 1 (existing reports are numbered from the oldest).
    395 * Client preview: approvals, change requests and messages are disabled. The Reports page no longer offers the client preview.
    396 * The digest of new reports for the team follows the "Email frequency" setting instead of the fixed 6-hour schedule.
    397 * Notification recipients are chosen by role and individual user, like access (administrators by default), instead of typing email addresses.
    398 
    399 = 1.14.0 =
    400 * Renamed from Snapnote to PageNod (folder `pagenod`, text domain `pagenod`). Settings, reports, pages and the reviewer role are kept.
    401 
    402 = 1.13.0 =
    403 * Plugin translated to English as source language, with Italian, French, German and Spanish translations.
    404 
    405 = 1.12.2 =
    406 * More reliable screenshots: a blank automatic capture is detected and the browser's screen capture is offered instead; a "Capture with the browser" link is also available when parts such as maps or videos are missing.
    407 
    408 = 1.12.0 =
    409 * Report limit per user on a fixed hourly window, configurable; the team has no limit.
    410 * Attachments in conversation messages, with drag and drop.
    411 * Reports as conversations, internal notes, reopening by the client within a configurable time, new status "Waiting for information".
    412 * Client digest includes team messages; team alerts when a client replies or reopens.
    413 
    414 = 1.11.0 =
    415 * Batched client email digest of status changes and replies.
    416 * "Template" entries to approve a content type once (news, products…).
    417 * New page status "Waiting for content"; filters by page and content type on reports.
    418 
    419 = 1.10.0 =
    420 * Approval with confirmation modal, reporter filter, charts per status, front-end console with drag and drop.
    421 
    422 = 1.9.0 =
    423 * Login page on a clean, configurable URL with conflict checks.
    424 
    425 = 1.8.0 =
    426 * Branded login page with password recovery and branded account emails.
    427 
    428 = 1.7.0 =
    429 * Front-end management console; grouping entries; log out button.
    430 
    431 = 1.6.0 =
    432 * Client email when the team replies; navigation between reports and progress; HTML emails; hierarchical pages.
    433 
    434 = 1.5.0 =
    435 * Page approval with progress charts.
    436 
    437 = 1.0.0 =
    438 * First release.
     167Older versions: see changelog.txt in the plugin folder.
    439168
    440169== Source code ==
  • pagenod/trunk/uninstall.php

    r3817969 r3822889  
    7979        // Scheduled tasks and temporary upload chunks.
    8080        $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}pagenod_cloud_queue" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange -- PageNod Cloud queue
     81        $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}pagenod_ai_changes" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange -- changes made by Claude through PageNod Cloud
    8182        foreach ( array( 'pagenod_client_digest', 'pagenod_cleanup_uploads', 'pagenod_send_digest', 'pagenod_cloud_flush', 'pagenod_cloud_daily', 'pagenod_cloud_tick' ) as $hook ) {
    8283                wp_clear_scheduled_hook( $hook );
Note: See TracChangeset for help on using the changeset viewer.