Skip to content

Commit e259e66

Browse files
committed
chore: publish wordpress 1.1.1
1 parent 06f8322 commit e259e66

File tree

15 files changed

+540
-24
lines changed

15 files changed

+540
-24
lines changed

wordpress/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ svn checkout https://plugins.svn.wordpress.org/simplepdf-embed svn
1717
wp_enqueue_script('simplepdf-web-embed-pdf', $script_src, array(), '<VERSION>', true);
1818
```
1919
2. Run the following
20+
2021
_Make sure to update TAG in [simplepdf-embed.php](./svn/trunk/simplepdf-embed.php), in [README.txt](./svn/trunk/README.txt) and in [blueprint.json](./svn/assets/blueprints/blueprint.json)_
2122
```bash
2223
npm run package-plugin

wordpress/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wordpress/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"package-plugin": "npm install && npm run copy-src && npm run copy-build"
66
},
77
"dependencies": {
8-
"@simplepdf/web-embed-pdf": "^1.7.0"
8+
"@simplepdf/web-embed-pdf": "^1.7.2"
99
}
1010
}

wordpress/svn/assets/blueprints/blueprint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"step": "installPlugin",
1414
"pluginZipFile": {
1515
"resource": "url",
16-
"url": "https://downloads.wordpress.org/plugin/simplepdf-embed.1.1.0.zip"
16+
"url": "https://downloads.wordpress.org/plugin/simplepdf-embed.1.1.1.zip"
1717
},
1818
"options": {
1919
"activate": true
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
=== SimplePDF Embed ===
2+
Contributors: bendersej
3+
Tags: pdf, embed pdf, fill & sign PDF, pdf editor
4+
Tested up to: 6.4.3
5+
Stable tag: 1.1.1
6+
License: GPLv2 or later
7+
License URI: https://www.gnu.org/licenses/gpl-2.0.html
8+
Requires at least: 5.8
9+
Requires PHP: 5.6.20
10+
11+
Your visitors can fill & sign PDFs without leaving your website.
12+
13+
== Description ==
14+
15+
A lightweight plugin that automatically opens any PDF file with SimplePDF: allowing your visitors to fill and edit PDFs (merge, rotate, delete pages) without leaving your website.
16+
17+
== Try it out! ==
18+
19+
https://wordpress.simplepdf.co/
20+
21+
== Features ==
22+
- Any .pdf link on your website is automatically opened with SimplePDF
23+
- Add text, checkboxes, pictures, signatures to PDFs
24+
- Fill fillable form
25+
- Add, delete, rotate, merge PDFs
26+
- Download the resulting PDF
27+
- Works on all browsers and mobile devices
28+
- Works with both Gutenber and the classic editor
29+
- Fully responsive
30+
31+
== Screenshots ==
32+
33+
1. SimplePDF Embed
34+
2. Admin settings of SimplePDF Embed
35+
3. Adding a PDF link using the Gutenber editor
36+
4. Adding a PDF link using the classic editor
37+
5. The PDF is opened on top of the existing website
38+
39+
== Installation ==
40+
41+
This section describes how to install the plugin and get it working.
42+
43+
e.g.
44+
45+
1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the wp-content/plugins/ directory of your WordPress installation.
46+
2. Activate the plugin through the ‘Plugins’ menu in WordPress.
47+
3. Optional: Go to Settings > SimplePDF Embed and enter your "Company Identifier" (requires a SimplePDF account)
48+
4. Now any PDF links in your wordpress pages are opened using SimplePDF (you can disable this behaviour in the settings: see 3.)
49+
50+
== Frequently Asked Questions ==
51+
= I have installed the plugin: what should I do next? =
52+
53+
All the existing PDF files will now open with SimplePDF.
54+
55+
If you wish to add new PDFs to your website, simply upload them to your Wordpress, copy the link and add it as a link to any page or paragraph in your wordpress.
56+
57+
= The PDF is not opened with SimplePDF =
58+
59+
Make sure that the link ends with ".pdf".
60+
61+
Example: https://wordpress.simplepdf.co/wp-content/uploads/2024/01/example_wordpress.pdf
62+
63+
= Do I need a SimplePDF account to use this plugin? =
64+
65+
No: the plugin does not require an account to work: all features are available without any account.
66+
67+
= What are the differences between using the plugin without and with a SimplePDF account? =
68+
69+
Without an account, the plugin will open the PDF editor allowing your visitors to fill in documents and download them.
70+
71+
With an account, the filled in documents will be automatically transmitted to you. You can configure to receive email notifications as well as use your own logo and loading.
72+
73+
= Where should I submit my feature request or bug report? =
74+
75+
Feel free to reach out to us at [email protected]!
76+
77+
= Where can I see the code? =
78+
79+
Our Github repository contains both the code for the Wordpress plugin as well as the underlying @simplepdf/web-embed-pdf code upon which it relies:
80+
- [Wordpress plugin source code](https://github.com/SimplePDF/simplepdf-embed/tree/main/wordpress)
81+
- [@simplepdf/web-embed-pdf](https://github.com/SimplePDF/simplepdf-embed/tree/main/web)
82+
83+
== Changelog ==
84+
85+
= 1.0.0 =
86+
* Initial release
87+
= 1.1.0 =
88+
* Add support for SimplePDF form links
89+
= 1.1.1 =
90+
* Move to SimplePDF.com (from SimplePDF.eu)
91+

wordpress/svn/tags/1.1.1/build/web-embed-pdf.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
/*
3+
Plugin Name: SimplePDF Embed
4+
Plugin URI: https://simplepdf.com/embed
5+
Author: SimplePDF
6+
Author URI: https://simplepdf.com
7+
Description: Your visitors can fill & sign PDFs without leaving your website.
8+
Version: 1.1.1
9+
License: GPL v2 or later
10+
License URI: https://www.gnu.org/licenses/gpl-2.0.html
11+
*/
12+
13+
if ( ! defined( 'ABSPATH' ) ) exit;
14+
15+
function simplepdf_settings_init() {
16+
add_option('simplepdf_auto_open_pdf', true);
17+
add_option('simplepdf_company_identifier');
18+
19+
add_submenu_page(
20+
'options-general.php',
21+
'SimplePDF Embed Settings',
22+
'SimplePDF Embed',
23+
'manage_options',
24+
'simplepdf_settings',
25+
'simplepdf_settings_page'
26+
);
27+
28+
29+
add_settings_section(
30+
'simplepdf_settings_section',
31+
'SimplePDF Settings',
32+
'simplepdf_settings_section_callback',
33+
'simplepdf_settings'
34+
);
35+
36+
add_settings_field(
37+
'simplepdf_auto_open_pdf',
38+
'Automatically open PDFs with SimplePDF',
39+
'simplepdf_auto_open_pdf_callback',
40+
'simplepdf_settings',
41+
'simplepdf_settings_section'
42+
);
43+
44+
add_settings_field(
45+
'simplepdf_company_identifier',
46+
'Company Identifier',
47+
'simplepdf_company_identifier_callback',
48+
'simplepdf_settings',
49+
'simplepdf_settings_section'
50+
);
51+
52+
register_setting('simplepdf_settings', 'simplepdf_auto_open_pdf');
53+
register_setting('simplepdf_settings', 'simplepdf_company_identifier');
54+
}
55+
56+
function simplepdf_settings_section_callback() {
57+
echo '<p>Configure the SimplePDF Embed settings:</p>';
58+
}
59+
60+
function simplepdf_auto_open_pdf_callback() {
61+
$value = get_option('simplepdf_auto_open_pdf');
62+
echo '<div style="display: flex; align-items: center;"><input type="checkbox" name="simplepdf_auto_open_pdf" value="1"' . checked(1, $value, false) . '>';
63+
echo '<i style="margin-left: 8px;">Links with the extension .pdf are opened with SimplePDF</i>';
64+
echo '</div>';
65+
}
66+
67+
function simplepdf_company_identifier_callback() {
68+
$value = get_option('simplepdf_company_identifier');
69+
echo '<input type="text" name="simplepdf_company_identifier" value="' . esc_attr($value) . '">';
70+
echo '<p style="margin-top: 8px; margin-bottom: 8px"><b>Signup to get your own company identifier: <a href="https://simplepdf.com/embed#wp" target="_blank">SimplePDF/embed</a>.</b></p>';
71+
echo '<ul style="list-style: circle;padding-left: 20px;">';
72+
echo '<li><a href="https://simplepdf.com/help/how-to/customize-the-pdf-editor-and-add-branding#wp" target="_blank">Use your own branding and loading</a></li>';
73+
echo '<li><a href="https://simplepdf.com/help/how-to/get-email-notifications-for-pdf-form-submissions#wp" target="_blank">Automatically receive the submissions in your inbox</a></li>';
74+
echo '<li><a href="https://simplepdf.com/help/how-to/customize-the-pdf-editor-and-add-branding#wp" target="_blank">Customize the editor: show or hide specific fields</a></li>';
75+
echo '</ul>';
76+
}
77+
78+
function enqueue_simplepdf_script() {
79+
80+
$auto_open_pdf = get_option('simplepdf_auto_open_pdf');
81+
82+
if ($auto_open_pdf) {
83+
$plugin_url = plugin_dir_url(__FILE__);
84+
$script_src = $plugin_url . 'build/web-embed-pdf.js';
85+
86+
wp_enqueue_script('simplepdf-web-embed-pdf', $script_src, array(), '1.7.2', true);
87+
88+
$company_identifier = get_option('simplepdf_company_identifier');
89+
$companyIdentifier = empty($company_identifier) ? 'wordpress' : $company_identifier;
90+
$inline_script = "window.simplePDF = {companyIdentifier: '" . esc_js($companyIdentifier) . "'};";
91+
92+
wp_add_inline_script('simplepdf-web-embed-pdf', $inline_script, 'before');
93+
}
94+
}
95+
96+
function simplepdf_settings_page() {
97+
?>
98+
<div class="wrap">
99+
<h1>SimplePDF Embed Settings</h1>
100+
<form method="post" action="options.php">
101+
<?php
102+
settings_fields('simplepdf_settings');
103+
do_settings_sections('simplepdf_settings');
104+
submit_button();
105+
?>
106+
</form>
107+
</div>
108+
<?php
109+
}
110+
111+
add_action('admin_menu', 'simplepdf_settings_init');
112+
add_action('wp_enqueue_scripts', 'enqueue_simplepdf_script');
113+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { SimplePDF } from "../types";
2+
3+
declare global {
4+
interface Window {
5+
simplePDF?: SimplePDF;
6+
}
7+
}
8+
9+
export {};
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import {
2+
getSimplePDFElements,
3+
handleAttachOnClick,
4+
handleOpenEditor,
5+
closeEditor,
6+
} from "./shared";
7+
import type { EditorConfig, Locale, SimplePDF } from "./types";
8+
9+
export { Locale, EditorConfig, SimplePDF };
10+
11+
const locale = ((): Locale => {
12+
const languageCode = (() => {
13+
try {
14+
const locale = new Intl.Locale(document.documentElement.lang);
15+
return locale.language;
16+
} catch (e) {
17+
return null;
18+
}
19+
})();
20+
21+
const inputLocale = (window["simplePDF"]?.locale ??
22+
document.currentScript?.getAttribute("locale") ??
23+
languageCode ??
24+
"en") as Locale;
25+
26+
switch (inputLocale) {
27+
case "en":
28+
case "de":
29+
case "es":
30+
case "fr":
31+
case "it":
32+
case "pt":
33+
return inputLocale;
34+
default:
35+
inputLocale satisfies never;
36+
return "en";
37+
}
38+
})();
39+
40+
const disableInit =
41+
window["simplePDF"]?.disableInit ??
42+
document.currentScript?.getAttribute("disableInit") !== null ??
43+
false;
44+
const isDebug = document.currentScript?.getAttribute("debug") !== null;
45+
46+
const companyIdentifier =
47+
window["simplePDF"]?.companyIdentifier ??
48+
document.currentScript?.getAttribute("companyIdentifier") ??
49+
"embed";
50+
51+
const log = (message: string, details: Record<string, unknown>) => {
52+
if (!isDebug) {
53+
return;
54+
}
55+
56+
console.warn(`@simplepdf/web-embed-pdf: ${message}`, details);
57+
};
58+
59+
const editorConfig: EditorConfig = {
60+
getFromConfig: (key: "companyIdentifier" | "locale") =>
61+
window["simplePDF"]?.[key] ?? null,
62+
log,
63+
};
64+
65+
const init = () => {
66+
if (disableInit === true) {
67+
return;
68+
}
69+
70+
const attachOnClick = handleAttachOnClick(editorConfig);
71+
72+
const elements = getSimplePDFElements();
73+
attachOnClick({ elements });
74+
};
75+
76+
init();
77+
78+
window["simplePDF"] = {
79+
locale,
80+
disableInit,
81+
companyIdentifier,
82+
openEditor: handleOpenEditor(editorConfig),
83+
closeEditor,
84+
};

0 commit comments

Comments
 (0)