Changeset 3801921
- Timestamp:
- 11/14/2026 12:56:58 PM (4 days ago)
- Location:
- mnpr-client-portal
- Files:
-
- 100 added
- 8 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/assets (added)
-
tags/1.2.0/assets/admin-appearance.js (added)
-
tags/1.2.0/assets/admin-builder.js (added)
-
tags/1.2.0/assets/admin-copy.js (added)
-
tags/1.2.0/assets/admin.css (added)
-
tags/1.2.0/assets/blocks.js (added)
-
tags/1.2.0/assets/frontend.css (added)
-
tags/1.2.0/assets/index.php (added)
-
tags/1.2.0/assets/portal.css (added)
-
tags/1.2.0/assets/portal.js (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/admin (added)
-
tags/1.2.0/includes/admin/class-mnprcp-admin-coming-soon.php (added)
-
tags/1.2.0/includes/admin/class-mnprcp-admin-display.php (added)
-
tags/1.2.0/includes/admin/class-mnprcp-admin-settings.php (added)
-
tags/1.2.0/includes/admin/class-mnprcp-admin-setup.php (added)
-
tags/1.2.0/includes/admin/class-mnprcp-admin-tools.php (added)
-
tags/1.2.0/includes/admin/class-mnprcp-admin.php (added)
-
tags/1.2.0/includes/admin/index.php (added)
-
tags/1.2.0/includes/class-mnprcp-abilities.php (added)
-
tags/1.2.0/includes/class-mnprcp-cli.php (added)
-
tags/1.2.0/includes/class-mnprcp-config.php (added)
-
tags/1.2.0/includes/class-mnprcp-io.php (added)
-
tags/1.2.0/includes/class-mnprcp-plugin.php (added)
-
tags/1.2.0/includes/class-mnprcp-presets.php (added)
-
tags/1.2.0/includes/class-mnprcp-roles.php (added)
-
tags/1.2.0/includes/class-mnprcp-sections.php (added)
-
tags/1.2.0/includes/class-mnprcp-settings.php (added)
-
tags/1.2.0/includes/class-mnprcp-validator.php (added)
-
tags/1.2.0/includes/class-mnprcp-values.php (added)
-
tags/1.2.0/includes/fields (added)
-
tags/1.2.0/includes/fields/class-mnprcp-field-type.php (added)
-
tags/1.2.0/includes/fields/class-mnprcp-field-types.php (added)
-
tags/1.2.0/includes/fields/index.php (added)
-
tags/1.2.0/includes/fields/types (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-checkbox.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-choice.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-date.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-datetime.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-email.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-file.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-gallery.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-group.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-image.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-number.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-phone.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-radio.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-repeater.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-rich-text.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-select.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-text.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-textarea.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-time.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-toggle.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-url.php (added)
-
tags/1.2.0/includes/fields/types/class-mnprcp-field-video.php (added)
-
tags/1.2.0/includes/fields/types/index.php (added)
-
tags/1.2.0/includes/frontend (added)
-
tags/1.2.0/includes/frontend/class-mnprcp-blocks.php (added)
-
tags/1.2.0/includes/frontend/class-mnprcp-coming-soon.php (added)
-
tags/1.2.0/includes/frontend/class-mnprcp-display.php (added)
-
tags/1.2.0/includes/frontend/class-mnprcp-frontend.php (added)
-
tags/1.2.0/includes/frontend/class-mnprcp-schema.php (added)
-
tags/1.2.0/includes/frontend/class-mnprcp-site-tools.php (added)
-
tags/1.2.0/includes/frontend/index.php (added)
-
tags/1.2.0/includes/functions.php (added)
-
tags/1.2.0/includes/index.php (added)
-
tags/1.2.0/includes/portal (added)
-
tags/1.2.0/includes/portal/class-mnprcp-form.php (added)
-
tags/1.2.0/includes/portal/class-mnprcp-portal-auth.php (added)
-
tags/1.2.0/includes/portal/class-mnprcp-portal-content.php (added)
-
tags/1.2.0/includes/portal/class-mnprcp-portal-view.php (added)
-
tags/1.2.0/includes/portal/class-mnprcp-portal.php (added)
-
tags/1.2.0/includes/portal/class-mnprcp-uploads.php (added)
-
tags/1.2.0/includes/portal/index.php (added)
-
tags/1.2.0/index.php (added)
-
tags/1.2.0/languages (added)
-
tags/1.2.0/languages/index.php (added)
-
tags/1.2.0/languages/mnpr-client-portal.pot (added)
-
tags/1.2.0/mnpr-client-portal.php (added)
-
tags/1.2.0/readme.txt (added)
-
tags/1.2.0/templates (added)
-
tags/1.2.0/templates/account.php (added)
-
tags/1.2.0/templates/coming-soon.php (added)
-
tags/1.2.0/templates/dashboard.php (added)
-
tags/1.2.0/templates/delete.php (added)
-
tags/1.2.0/templates/edit.php (added)
-
tags/1.2.0/templates/index.php (added)
-
tags/1.2.0/templates/layout-auth.php (added)
-
tags/1.2.0/templates/layout.php (added)
-
tags/1.2.0/templates/list.php (added)
-
tags/1.2.0/templates/login.php (added)
-
tags/1.2.0/templates/lost-password.php (added)
-
tags/1.2.0/templates/no-access.php (added)
-
tags/1.2.0/templates/not-found.php (added)
-
tags/1.2.0/templates/reset-password.php (added)
-
tags/1.2.0/templates/site-details.php (added)
-
tags/1.2.0/uninstall.php (added)
-
trunk/includes/admin/class-mnprcp-admin-settings.php (modified) (1 diff)
-
trunk/includes/class-mnprcp-abilities.php (added)
-
trunk/includes/class-mnprcp-config.php (modified) (1 diff)
-
trunk/includes/class-mnprcp-plugin.php (modified) (1 diff)
-
trunk/includes/class-mnprcp-settings.php (modified) (1 diff)
-
trunk/includes/portal/class-mnprcp-portal-content.php (modified) (1 diff)
-
trunk/languages/mnpr-client-portal.pot (modified) (2 diffs)
-
trunk/mnpr-client-portal.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mnpr-client-portal/trunk/includes/admin/class-mnprcp-admin-settings.php
r3801836 r3801921 97 97 check_admin_referer( 'mnprcp_save_appearance' ); 98 98 99 $current = MNPRCP_Settings::all();100 99 // phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- each value is unslashed and sanitised. 101 $new = array( 102 'portal_name' => isset( $_POST['portal_name'] ) ? sanitize_text_field( wp_unslash( $_POST['portal_name'] ) ) : '', 103 'login_text' => isset( $_POST['login_text'] ) ? sanitize_text_field( wp_unslash( $_POST['login_text'] ) ) : '', 104 'accent' => isset( $_POST['accent'] ) ? sanitize_hex_color( wp_unslash( $_POST['accent'] ) ) : '', 105 'logo' => isset( $_POST['logo'] ) ? absint( $_POST['logo'] ) : 0, 106 'slug' => isset( $_POST['slug'] ) ? sanitize_title( wp_unslash( $_POST['slug'] ) ) : '', 100 $result = MNPRCP_Settings::update( 101 array( 102 'portal_name' => isset( $_POST['portal_name'] ) ? sanitize_text_field( wp_unslash( $_POST['portal_name'] ) ) : '', 103 'login_text' => isset( $_POST['login_text'] ) ? sanitize_text_field( wp_unslash( $_POST['login_text'] ) ) : '', 104 'accent' => isset( $_POST['accent'] ) ? sanitize_hex_color( wp_unslash( $_POST['accent'] ) ) : '', 105 'logo' => isset( $_POST['logo'] ) ? absint( $_POST['logo'] ) : 0, 106 'slug' => isset( $_POST['slug'] ) ? sanitize_title( wp_unslash( $_POST['slug'] ) ) : '', 107 ) 107 108 ); 108 109 // phpcs:enable 109 110 $errors = array(); 111 if ( ! $new['accent'] ) { 112 $new['accent'] = $current['accent']; 113 $errors[] = __( 'The accent colour wasn\'t a valid colour, so it wasn\'t changed.', 'mnpr-client-portal' ); 114 } 115 if ( $new['logo'] && ! wp_attachment_is_image( $new['logo'] ) ) { 116 $new['logo'] = 0; 117 $errors[] = __( 'The logo must be an image.', 'mnpr-client-portal' ); 118 } 119 if ( '' === $new['slug'] ) { 120 $new['slug'] = 'portal'; 121 } 122 $taken = get_page_by_path( $new['slug'] ) || post_type_exists( $new['slug'] ) || in_array( $new['slug'], array( 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', 'feed' ), true ); 123 if ( $new['slug'] !== $current['slug'] && $taken ) { 124 /* translators: %s: address slug. */ 125 $errors[] = sprintf( __( '"%s" is already used on this site, so the portal address wasn\'t changed.', 'mnpr-client-portal' ), $new['slug'] ); 126 $new['slug'] = $current['slug']; 127 } 128 129 update_option( MNPRCP_Settings::OPTION, array_merge( $current, $new ) ); 130 if ( $new['slug'] !== $current['slug'] ) { 131 update_option( 'mnprcp_flush_rewrites', 1, false ); 132 } 110 $errors = $result['errors']; 133 111 134 112 if ( $errors ) { -
mnpr-client-portal/trunk/includes/class-mnprcp-config.php
r3801836 r3801921 63 63 } 64 64 return self::$cache; 65 } 66 67 /** 68 * The saved setup, validated but without add-ons' changes from the 69 * mnprcp_config filter. Used when editing the setup, so sections an add-on 70 * adds on the fly are never saved into it. 71 * 72 * @since 1.2.0 73 * 74 * @return array 75 */ 76 public static function stored() { 77 $stored = get_option( self::OPTION, array() ); 78 $result = MNPRCP_Validator::validate( is_array( $stored ) ? $stored : array() ); 79 return $result['config']; 80 } 81 82 /** 83 * Find a section by its key in a given setup. 84 * 85 * @since 1.2.0 86 * 87 * @param array $config Setup. 88 * @param string $key Section key. 89 * @return array|null 90 */ 91 public static function section_from( array $config, $key ) { 92 foreach ( $config['sections'] as $section ) { 93 if ( $section['key'] === $key ) { 94 return $section; 95 } 96 } 97 return null; 98 } 99 100 /** 101 * Find the section that manages a post type in a given setup. 102 * 103 * @since 1.2.0 104 * 105 * @param array $config Setup. 106 * @param string $post_type Post type name. 107 * @return array|null 108 */ 109 public static function section_for_post_type_from( array $config, $post_type ) { 110 foreach ( $config['sections'] as $section ) { 111 if ( $section['post_type'] === $post_type ) { 112 return $section; 113 } 114 } 115 return null; 65 116 } 66 117 -
mnpr-client-portal/trunk/includes/class-mnprcp-plugin.php
r3801836 r3801921 45 45 MNPRCP_Site_Tools::init(); 46 46 MNPRCP_Coming_Soon::init(); 47 MNPRCP_Abilities::init(); 47 48 add_action( 'init', array( __CLASS__, 'maybe_upgrade' ), 1 ); 48 49 -
mnpr-client-portal/trunk/includes/class-mnprcp-settings.php
r3801836 r3801921 70 70 71 71 /** 72 * Change some settings, checking each one. Settings that fail a check keep 73 * their current value and are described in the errors. 74 * 75 * @since 1.2.0 76 * 77 * @param array $changes Any of portal_name, login_text, accent, logo, slug (unslashed). 78 * @return array{settings:array,errors:string[]} 79 */ 80 public static function update( array $changes ) { 81 $current = self::all(); 82 $new = array(); 83 $errors = array(); 84 85 if ( array_key_exists( 'portal_name', $changes ) ) { 86 $new['portal_name'] = sanitize_text_field( (string) $changes['portal_name'] ); 87 } 88 if ( array_key_exists( 'login_text', $changes ) ) { 89 $new['login_text'] = sanitize_text_field( (string) $changes['login_text'] ); 90 } 91 if ( array_key_exists( 'accent', $changes ) ) { 92 $accent = sanitize_hex_color( (string) $changes['accent'] ); 93 if ( $accent ) { 94 $new['accent'] = $accent; 95 } else { 96 $errors[] = __( 'The accent colour wasn\'t a valid colour, so it wasn\'t changed.', 'mnpr-client-portal' ); 97 } 98 } 99 if ( array_key_exists( 'logo', $changes ) ) { 100 $logo = absint( $changes['logo'] ); 101 if ( $logo && ! wp_attachment_is_image( $logo ) ) { 102 $logo = 0; 103 $errors[] = __( 'The logo must be an image.', 'mnpr-client-portal' ); 104 } 105 $new['logo'] = $logo; 106 } 107 if ( array_key_exists( 'slug', $changes ) ) { 108 $slug = sanitize_title( (string) $changes['slug'] ); 109 if ( '' === $slug ) { 110 $slug = 'portal'; 111 } 112 $taken = get_page_by_path( $slug ) || post_type_exists( $slug ) || in_array( $slug, array( 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', 'feed' ), true ); 113 if ( $slug !== $current['slug'] && $taken ) { 114 /* translators: %s: address slug. */ 115 $errors[] = sprintf( __( '"%s" is already used on this site, so the portal address wasn\'t changed.', 'mnpr-client-portal' ), $slug ); 116 $slug = $current['slug']; 117 } 118 $new['slug'] = $slug; 119 } 120 121 $stored = get_option( self::OPTION, array() ); 122 update_option( self::OPTION, array_merge( is_array( $stored ) ? $stored : array(), $current, $new ) ); 123 if ( isset( $new['slug'] ) && $new['slug'] !== $current['slug'] ) { 124 update_option( 'mnprcp_flush_rewrites', 1, false ); 125 } 126 127 return array( 128 'settings' => array_intersect_key( self::all(), self::defaults() ), 129 'errors' => $errors, 130 ); 131 } 132 133 /** 72 134 * The name shown at the top of the portal. 73 135 * -
mnpr-client-portal/trunk/includes/portal/class-mnprcp-portal-content.php
r3801836 r3801921 386 386 * Make a title for sections without a title field, e.g. "The Fleece – 5 Dec 2026". 387 387 * 388 * Public since 1.2.0 (used by the abilities). 389 * 388 390 * @param array $section Section definition. 389 391 * @param array $values Clean values. 390 392 * @return string 391 393 */ 392 p rivatestatic function auto_title( array $section, array $values ) {394 public static function auto_title( array $section, array $values ) { 393 395 $parts = array(); 394 396 foreach ( $section['fields'] as $field ) { -
mnpr-client-portal/trunk/languages/mnpr-client-portal.pot
r3801836 r3801921 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: MNPR Client Portal 1. 1.1\n"5 "Project-Id-Version: MNPR Client Portal 1.2.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mnpr-client-portal\n" 7 7 "MIME-Version: 1.0\n" 8 8 "Content-Type: text/plain; charset=UTF-8\n" 9 9 "Content-Transfer-Encoding: 8bit\n" 10 "POT-Creation-Date: 2026-11-1 3T11:52:16+00:00\n"10 "POT-Creation-Date: 2026-11-14T12:22:48+00:00\n" 11 11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 2419 2419 msgid "Choose a field in the block settings." 2420 2420 msgstr "" 2421 2422 #: includes/class-mnprcp-abilities.php:49 2423 msgid "Set up MNPR Client Portal and manage the content clients edit in the portal." 2424 msgstr "" 2425 2426 #: includes/class-mnprcp-abilities.php:137 2427 msgid "Get the portal setup" 2428 msgstr "" 2429 2430 #: includes/class-mnprcp-abilities.php:143 2431 msgid "List field types" 2432 msgstr "" 2433 2434 #: includes/class-mnprcp-abilities.php:149 2435 msgid "List presets" 2436 msgstr "" 2437 2438 #: includes/class-mnprcp-abilities.php:155 2439 msgid "Apply a preset" 2440 msgstr "" 2441 2442 #: includes/class-mnprcp-abilities.php:173 2443 msgid "Export the setup" 2444 msgstr "" 2445 2446 #: includes/class-mnprcp-abilities.php:179 2447 msgid "Import a setup" 2448 msgstr "" 2449 2450 #: includes/class-mnprcp-abilities.php:202 2451 msgid "Add or change a section" 2452 msgstr "" 2453 2454 #: includes/class-mnprcp-abilities.php:224 2455 msgid "Remove a section" 2456 msgstr "" 2457 2458 #: includes/class-mnprcp-abilities.php:240 2459 msgid "Add or change a field" 2460 msgstr "" 2461 2462 #: includes/class-mnprcp-abilities.php:269 2463 msgid "Remove a field" 2464 msgstr "" 2465 2466 #: includes/class-mnprcp-abilities.php:292 2467 msgid "Get Site details" 2468 msgstr "" 2469 2470 #: includes/class-mnprcp-abilities.php:298 2471 msgid "Update Site details" 2472 msgstr "" 2473 2474 #: includes/class-mnprcp-abilities.php:315 2475 msgid "List entries in a section" 2476 msgstr "" 2477 2478 #: includes/class-mnprcp-abilities.php:343 2479 msgid "Get an entry" 2480 msgstr "" 2481 2482 #: includes/class-mnprcp-abilities.php:360 2483 msgid "Add or change an entry" 2484 msgstr "" 2485 2486 #: includes/class-mnprcp-abilities.php:393 2487 msgid "Move an entry to the bin" 2488 msgstr "" 2489 2490 #: includes/class-mnprcp-abilities.php:412 2491 msgid "Add media from a web address" 2492 msgstr "" 2493 2494 #: includes/class-mnprcp-abilities.php:433 2495 msgid "Update the portal appearance" 2496 msgstr "" 2497 2498 #: includes/class-mnprcp-abilities.php:453 2499 msgid "Get Coming soon mode" 2500 msgstr "" 2501 2502 #: includes/class-mnprcp-abilities.php:459 2503 msgid "Update Coming soon mode" 2504 msgstr "" 2505 -
mnpr-client-portal/trunk/mnpr-client-portal.php
r3801836 r3801921 3 3 * Plugin Name: MNPR Client Portal 4 4 * Description: Give clients a branded portal to manage their own site content, without wp-admin. 5 * Version: 1. 1.15 * Version: 1.2.0 6 6 * Requires at least: 6.5 7 7 * Requires PHP: 7.4 … … 20 20 } 21 21 22 define( 'MNPRCP_VERSION', '1. 1.1' );22 define( 'MNPRCP_VERSION', '1.2.0' ); 23 23 define( 'MNPRCP_FILE', __FILE__ ); 24 24 define( 'MNPRCP_DIR', plugin_dir_path( __FILE__ ) ); … … 47 47 require_once MNPRCP_DIR . 'includes/frontend/class-mnprcp-site-tools.php'; 48 48 require_once MNPRCP_DIR . 'includes/frontend/class-mnprcp-coming-soon.php'; 49 require_once MNPRCP_DIR . 'includes/class-mnprcp-abilities.php'; 49 50 require_once MNPRCP_DIR . 'includes/functions.php'; 50 51 require_once MNPRCP_DIR . 'includes/class-mnprcp-plugin.php'; -
mnpr-client-portal/trunk/readme.txt
r3801836 r3801921 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1. 1.17 Stable tag: 1.2.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 50 50 * **Cache clearing.** Common caching plugins are cleared when clients save, so changes show straight away. 51 51 * **Contact email routing.** Send form plugin emails to an address your client manages in Site details. 52 * **AI agent ready.** Set up in minutes, or ask your AI agent to do it for you. On WordPress 6.9 and later, agents connected through the MCP Adapter can set up sections and fields, fill in Site details and add content. Only administrators can use this, and every change gets the same checks as the admin screens. 52 53 * **Export and import** setups between sites, plus WP-CLI commands. 53 54 * **Translation-ready** and accessible, with suggested privacy policy text. … … 91 92 92 93 * `[mnprcp_list section="events" show="upcoming"]` lists a section's items. Options: show (all, upcoming, past), layout (list, cards), limit, fields, image, link, empty. 93 * `[mnprcp_field name="venue"]` shows one field of the current item. Add post_id="123"to show it from another item.94 * `[mnprcp_field name="venue"]` shows one field of the current item. Add `post_id="123"` to show it from another item. 94 95 * `[mnprcp_site name="phone"]` shows a Site detail anywhere. 95 96 … … 110 111 Your posts and their values are always kept. The plugin's settings are only removed if you first tick "Also delete the portal setup, appearance settings and Site details" under Client Portal → Tools. 111 112 113 = Can an AI agent set it up for me? = 114 115 Yes, on WordPress 6.9 and later. The plugin registers its own abilities with the WordPress Abilities API, so an AI agent connected to your site through the MCP Adapter plugin can see the setup, apply a starter, add, change and remove sections and fields, fill in Site details, add and edit entries, change the portal's appearance and switch Coming soon mode. Only administrators can use them. Every change goes through the same checks as the admin screens, anything that removes something needs a confirmation, and content is never deleted: removed sections and fields keep their stored values, and entries go to the bin. 116 112 117 = Is it translation-ready? = 113 118 … … 125 130 126 131 == Changelog == 132 133 = 1.2.0 = 134 * New: AI agent support. On WordPress 6.9 and later, AI agents (for example through the MCP Adapter) can set up the portal and add content using the plugin's abilities. Administrators only; every change is checked like the admin screens, and removals need a confirmation. 135 * New: developer methods `MNPRCP_Config::stored()` and `MNPRCP_Settings::update()`, and the `mnprcp_abilities` filter for add-ons. 136 * Fixed: the `post_id` shortcode example in the readme showed curly quotes on WordPress.org. 127 137 128 138 = 1.1.1 = … … 142 152 == Upgrade Notice == 143 153 154 = 1.2.0 = 155 Adds AI agent support: on WordPress 6.9 and later, agents can set up the portal and add content. 156 144 157 = 1.0.0 = 145 158 First public release.
Note:
See TracChangeset
for help on using the changeset viewer.