diff --git a/wordpress/svn/assets/blueprints/blueprint.json b/wordpress/svn/assets/blueprints/blueprint.json index 3050e75..ff3b21b 100644 --- a/wordpress/svn/assets/blueprints/blueprint.json +++ b/wordpress/svn/assets/blueprints/blueprint.json @@ -13,7 +13,7 @@ "step": "installPlugin", "pluginZipFile": { "resource": "url", - "url": "https://downloads.wordpress.org/plugin/simplepdf-embed.1.2.0.zip" + "url": "https://downloads.wordpress.org/plugin/simplepdf-embed.1.2.1.zip" }, "options": { "activate": true diff --git a/wordpress/svn/assets/screenshot-2.png b/wordpress/svn/assets/screenshot-2.png index f8b3f20..a687692 100644 Binary files a/wordpress/svn/assets/screenshot-2.png and b/wordpress/svn/assets/screenshot-2.png differ diff --git a/wordpress/svn/assets/screenshot-3.png b/wordpress/svn/assets/screenshot-3.png index e14d180..2bd191b 100644 Binary files a/wordpress/svn/assets/screenshot-3.png and b/wordpress/svn/assets/screenshot-3.png differ diff --git a/wordpress/svn/trunk/README.txt b/wordpress/svn/trunk/README.txt index 6106a04..1968bb6 100644 --- a/wordpress/svn/trunk/README.txt +++ b/wordpress/svn/trunk/README.txt @@ -2,7 +2,7 @@ Contributors: bendersej Tags: pdf, pdf form, fill pdf, sign pdf, form submissions Tested up to: 7.1.2 -Stable tag: 1.2.0 +Stable tag: 1.2.1 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Requires at least: 5.8 @@ -37,7 +37,7 @@ Visitors fill and sign your PDFs, then download them. The document is filled in * Every PDF link opens in SimplePDF by default, whatever the extension case (`Consent.PDF`) or query string (`form.pdf?ver=2`) * Or limit it to the pages and posts you pick, and try it on a draft before going live -* The settings page lists the PDF links on your pages and posts, and where each one opens +* The settings page lists the PDF links on your pages, posts, Site Editor templates, patterns and menus, and where each one opens * Add the `exclude-simplepdf` class to a link to keep the browser's own PDF viewer * Visitors who browse with an AI assistant (ChatGPT's browser, Chrome with WebMCP) can ask it to fill the form for them, and check every answer before they submit. One checkbox turns it off. @@ -56,7 +56,7 @@ https://wordpress.simplepdf.co/ 1. Filled PDFs land in your SimplePDF dashboard 2. The settings page: the PDF links on your site and where each one opens -3. Every PDF link on your pages and posts, and where each one opens +3. Every PDF link visitors can reach, on pages, templates and menus, and where each one opens 4. Where it runs: everywhere, or only on the pages and posts you pick, and whether AI assistants can fill your forms 5. What a SimplePDF account adds 6. Adding a PDF link using the block editor @@ -98,13 +98,13 @@ Every PDF link on your site now opens in SimplePDF. Open Settings > SimplePDF Em = A PDF link does not open in SimplePDF = -Settings > SimplePDF Embed lists the PDF links on your pages and posts, with the reason next to any link that opens in the browser. The usual causes: +Settings > SimplePDF Embed lists the PDF links visitors can reach on your pages, posts, Site Editor templates, patterns and menus, and where each one opens. A link opens in the browser when: * The link does not point to a `.pdf` file * The link has the `exclude-simplepdf` class * The page is not picked in "Where it runs" -Links added by a page builder, a menu or a widget open the same way but are not listed. +Links added by a page builder, a classic menu or a widget open the same way but are not listed. = How do I keep one PDF in the browser's viewer? = @@ -127,17 +127,19 @@ The plugin and the script it bundles are open source: == External services == -This plugin connects to SimplePDF (https://simplepdf.com) in two ways. - -**The PDF editor.** When a visitor clicks a PDF link, the plugin opens the SimplePDF editor from `https://.simplepdf.com` (`wordpress.simplepdf.com` without an account) in a frame on your page. The visitor's browser loads the PDF and hands it to the editor (or passes the PDF's address when it cannot load it), and the PDF is filled in the browser. When the visitor submits a filled PDF to your SimplePDF account, the filled PDF is sent to SimplePDF, or to your own storage if you set one up. Nothing is sent before a visitor clicks a PDF link. - -**The account check.** On the plugin's settings page only, the plugin sends one request to `https://.simplepdf.com` to check that the account exists. It sends the plugin's version and nothing about your site or your visitors, and the result is cached for up to an hour. +This plugin uses [SimplePDF](https://simplepdf.com) to open your PDFs in an editor on your page. Filled PDFs stay in your visitors' browser, unless you have a SimplePDF account and they click Submit. The settings page also checks that your SimplePDF account exists. * [Terms of service](https://simplepdf.com/terms-of-service) * [Privacy policy](https://simplepdf.com/privacy-policy) == Changelog == += 1.2.1 = +* The PDF links report now also lists the links in your Site Editor templates, template parts, synced patterns and navigation menus, like your home page, header and footer +* It lists only what visitors can reach: published pages and posts, the drafts or private pages you picked to try it, and the templates, patterns and menus your site actually shows +* One line per PDF link, with where it opens in its own column, 20 pages or templates at a time +* In "Only on pages and posts I pick" mode, the report says once which pages it runs on, instead of a note on every row + = 1.2.0 = * New settings page: see every PDF link on your pages and posts, and where each one opens * Choose where it runs: everywhere, or only on the pages and posts you pick, drafts included diff --git a/wordpress/svn/trunk/simplepdf-embed.php b/wordpress/svn/trunk/simplepdf-embed.php index 540831a..c009923 100644 --- a/wordpress/svn/trunk/simplepdf-embed.php +++ b/wordpress/svn/trunk/simplepdf-embed.php @@ -5,7 +5,7 @@ Author: SimplePDF Author URI: https://simplepdf.com Description: Visitors fill and sign your PDFs right on your site. With a SimplePDF account, every filled PDF comes back to you, automatically. -Version: 1.2.0 +Version: 1.2.1 License: GPL v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html */ @@ -14,10 +14,11 @@ require_once __DIR__ . '/pdf-links.php'; -define('SIMPLEPDF_PLUGIN_VERSION', '1.2.0'); +define('SIMPLEPDF_PLUGIN_VERSION', '1.2.1'); define('SIMPLEPDF_SETTINGS_SCREEN', 'settings_page_simplepdf_settings'); define('SIMPLEPDF_POST_LIST_LIMIT', 300); define('SIMPLEPDF_PDF_PAGE_LIMIT', 100); +define('SIMPLEPDF_PDF_TABLE_PAGE_SIZE', 20); define('SIMPLEPDF_WEB_EMBED_VERSION', '1.9.0'); define('SIMPLEPDF_REVIEW_URL', 'https://wordpress.org/support/plugin/simplepdf-embed/reviews/#new-post'); define('SIMPLEPDF_PRICING_URL', 'https://simplepdf.com/pricing?ref=wordpress'); @@ -139,6 +140,33 @@ function simplepdf_get_selected_post_ids() { return array_map('absint', (array) get_option('simplepdf_selected_post_ids', array())); } +// The pages and posts picked in "Where it runs" that still exist, and only while it runs on picked pages. +function simplepdf_get_picked_post_ids() { + static $picked_post_ids = null; + if ( $picked_post_ids === null ) { + $selected_post_ids = simplepdf_get_load_scope() === 'selected' ? simplepdf_get_selected_post_ids() : array(); + $picked_post_ids = empty($selected_post_ids) ? array() : array_map('intval', get_posts(array( + 'post__in' => $selected_post_ids, + 'post_type' => array('page', 'post'), + 'post_status' => array('publish', 'private', 'draft'), + 'numberposts' => -1, + 'fields' => 'ids', + ))); + } + + return $picked_post_ids; +} + +// The SQL condition for pages and posts visitors can reach: published, or picked to try it (a draft or private page). +function simplepdf_get_reachable_condition($id_column, $status_column) { + $picked_post_ids = simplepdf_get_picked_post_ids(); + $picked_condition = empty($picked_post_ids) + ? '' + : ' OR ' . $id_column . ' IN (' . implode(', ', array_fill(0, count($picked_post_ids), '%d')) . ')'; + + return array('sql' => '(' . $status_column . " = 'publish'" . $picked_condition . ')', 'args' => $picked_post_ids); +} + function simplepdf_should_load_on_current_request() { if ( simplepdf_get_load_scope() === 'everywhere' ) { return true; @@ -307,11 +335,16 @@ function simplepdf_admin_css() { .simplepdf-step-text { display: flex; flex-direction: column; gap: 2px; } .simplepdf-get-started .button { margin-left: auto; min-width: 11rem; text-align: center; } .simplepdf-pdf-table { margin-top: 12px; } -.simplepdf-pdf-table td:first-child { width: 30%; } -.simplepdf-pdf-links { margin: 0; } -.simplepdf-pdf-links li { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; } -.simplepdf-link-text .description, .simplepdf-page-note { display: block; } -.simplepdf-pill { flex: none; display: inline-block; min-width: 64px; padding: 1px 8px; border-radius: 999px; background: #f0f0f1; color: #50575e; font-size: 12px; text-align: center; } +.simplepdf-pdf-pagination { margin: 8px 0 0; } +.simplepdf-pdf-table th:first-child { width: 35%; } +.simplepdf-pdf-table th:last-child { width: 30%; } +.simplepdf-pdf-table tbody + tbody { border-top: 1px solid #f0f0f1; } +.simplepdf-pdf-table tbody:nth-of-type(odd) { background: #f6f7f7; } +.simplepdf-pdf-table tbody th, .simplepdf-pdf-table td { padding-top: 6px; padding-bottom: 6px; } +.simplepdf-pdf-table tbody th { font-weight: 400; } +.simplepdf-pdf-table td .description { display: block; } +.simplepdf-edit-link { color: #a7aaad; } +.simplepdf-pill { display: inline-block; min-width: 64px; padding: 1px 8px; border-radius: 999px; background: #f0f0f1; color: #50575e; font-size: 12px; text-align: center; } .simplepdf-pill-on { background: #edfaef; color: #007017; } .simplepdf-pill-error { background: #fcf0f1; color: #b32d2e; } .simplepdf-save { margin: 16px 0 0; } @@ -354,26 +387,312 @@ function simplepdf_render_header() { __('%s (template)', 'simplepdf-embed'), + /* translators: %s: template part title, e.g. Header */ + 'wp_template_part' => __('%s (template part)', 'simplepdf-embed'), + /* translators: %s: synced pattern title */ + 'wp_block' => __('%s (pattern)', 'simplepdf-embed'), + /* translators: %s: navigation menu title */ + 'wp_navigation' => __('%s (menu)', 'simplepdf-embed'), + ); +} + +function simplepdf_is_site_part($post) { + return array_key_exists($post->post_type, simplepdf_site_part_label_formats()); +} + +// A navigation link saves its URL as a block attribute, not as an tag, wherever the block sits. +function simplepdf_get_navigation_link_html($blocks) { + $link_html = ''; + foreach ( $blocks as $block ) { + $is_navigation_link = in_array($block['blockName'], array('core/navigation-link', 'core/navigation-submenu'), true); + $url = $is_navigation_link && isset($block['attrs']['url']) && is_string($block['attrs']['url']) ? $block['attrs']['url'] : ''; + $link_html .= $url === '' ? '' : ''; + $link_html .= simplepdf_get_navigation_link_html($block['innerBlocks']); + } + + return $link_html; +} + +function simplepdf_get_linked_html($post) { + $has_navigation_links = strpos($post->post_content, '