Coder Social home page Coder Social logo

elementor / wp2static Goto Github PK

View Code? Open in Web Editor NEW
1.4K 28.0 253.0 20.15 MB

WordPress static site generator for security, performance and cost benefits

Home Page: https://wp2static.com

License: The Unlicense

Shell 0.64% PHP 94.98% Nix 1.47% Clojure 2.42% Emacs Lisp 0.01% CSS 0.14% JavaScript 0.33%
wordpress-plugin static-site-generator wordpress netlify github-page security

wp2static's Introduction

WP2Static

A WordPress plugin for static site generation and deployment.

Latest: WP2Static joins Strattic, the leading WordPress to headless and static site end-to-end publishing platform!

Strattic is generously keeping the WP2Static plugin available and maintained for open source users!

Read Announcement

Installation options

Contributing

See CONTRIBUTING.md

Testing

WP2Static includes various types of code quality and functionality tests.

Tests are defined as Composer scripts within the composer.json file.

composer run-script test will run the main linting, static analysis and unit tests. It will not run code coverage by default. To run code coverage, use composer run-script coverage, this will require XDebug installed.

composer run-script test-integration will run end to end tests. This requires that you have the nix-shell command available from NixOS. More info on the intgration tests can be found in the README within the integration-tests directory.

You can run individual test stages by specifying any of the defined scripts within composer.json with a command like composer run-script phpunit. You can pass arguments, such as to skip slow external request making phpunit tests, run composer run-script phpunit -- --exclude-group ExternalRequests.

Continuous Integration is provided by GitHub Actions, which run code quality, unit and end to end tests.

wp2static's People

Contributors

amitay-elementor avatar bookwyrm avatar cameronvetter avatar chiriboga avatar dirtyf avatar dunklerfox avatar flynsarmy avatar fransallen avatar fromcouch avatar hikarine3 avatar ibes avatar janicak avatar john-shaffer avatar jts-fin avatar leonstafford avatar limmlingg avatar ohayn avatar palmiak avatar patrickdk77 avatar rotzbua avatar semonxue avatar sgerlach avatar stefanullinger avatar szepeviktor avatar thecodeassassin avatar thelq avatar utchy avatar vladstanca avatar yilinjuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp2static's Issues

add error reporting tools

for easier communication of errors by users / shorten feedback loop

  • error submission form on plugin page
  • standalone script able to be triggered

most users may not bother to signup/login to WP.org to report issue or open email client

Character encoding issues in archive

When exporting a site containing certain characters on a UTF-8 site, exported HTML pages contain mojibake. Exported site contents should match original.

Attached are sample before/after files with encoding issues

exported.htm.utf8.txt
wordpress.htm.utf8.txt

To test:

  • which processes are reading/writing text - debug at each stage
  • mbstring extension has effect?
  • multiple input/outputs of encodings, else default to UTF-8

Encoding issue when no charset meta defined as utf-8:

input

(#2 in URL Configurations)

output

(#2 in URL Configurations)Â

resolved by setting:

<meta charset="utf-8" />

by default, strip all WordPress references from static HTML (increase current meta stripping functions; rename wp-content to small randomised dir name -show to user, but don't allow changing in this release), ie 7 char hash; rm comments from style.css; rm xml-rpc, wp-json, etc.

Strip from content

  • wp emoji
  • <link rel='https://api.w.org/' href='http://172.17.0.3/wp-json/' />
  • <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://172.17.0.3/xmlrpc.php?rsd" />
  • <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://172.17.0.3/wp-includes/wlwmanifest.xml" />
     - [x] <meta name="generator" content="WordPress 4.9.6" />
     - [x] comments in css (show's theme info in style.css
  • *.w.org <link> tags
  • wp-embed js from wp-includes

ensure stripped from individual posts/pages:

  • <link rel='prev' title='Removing comments for a WordPress static website' href='http://172.17.0.3/2018/04/28/removing-comments-for-a-wordpress-static-website/' />
  • <link rel="canonical" href="http://172.17.0.3/2018/05/11/scheduling-exports-of-your-static-site-from-wordpress/" />
  • <link rel='shortlink' href='http://172.17.0.3/?p=8' />
  • <link rel="alternate" type="application/json+oembed" href="http://172.17.0.3/wp-json/oembed/1.0/embed?url=http%3A%2F%2F172.17.0.3%2F2018%2F05%2F11%2Fscheduling-exports-of-your-static-site-from-wordpress%2F" />
  • <link rel="alternate" type="text/xml+oembed" href="http://172.17.0.3/wp-json/oembed/1.0/embed?url=http%3A%2F%2F172.17.0.3%2F2018%2F05%2F11%2Fscheduling-exports-of-your-static-site-from-wordpress%2F&#038;format=xml" />
  • <link rel="pingback" href="http://172.17.0.3/xmlrpc.php">

Rewrite folder paths (wp-content etc)

Add user-editable, required fields for the following wp directories, using them in the cleanMeta function and in post processing of the export folder contents:

in code:

  • wp-content -> default contents
  • plugins -> default lib
  • themes -> default ui
  • theme dir -> theme
  • uploads -> data
  • wp-includes -> inc

in export file structure:

  • wp-content -> default contents
  • plugins -> default lib
  • themes -> default ui
  • theme dir -> theme
  • uploads -> data
  • wp-includes -> inc
  • user can still replace values with original WP paths if they want the URLs for indexed value

export multiple sites

ie, multiple rewrite and deployment options, to cover use case of demo site - wanting to publish to netlify, ftp, s3, etc. Each will have their own base url and possibly deployment methods.

can have unlimited* deployment scripts - options for their build triggers, if it's on each build or on demand. gives user more flexibility and this would cover use case of the other issue (#4) mentioning uat/production environment deployments...

library/aws/Aws/S3/Enum/CannedAcl.php failed to open stream

reported here

PHP Warning: require(/Users//S3StaticTest/wp-content/plugins/static-html-output-plugin/library/aws/Aws/S3/Enum/CannedAcl.php): failed to open stream: No such file or directory in /Users//S3StaticTest/wp-content/plugins/static-html-output-plugin/library/aws/aws-autoloader.php on line 1349

or

PHP Fatal error: require(): Failed opening required ‘/mycode/blog/wp-content/plugins/static-html-output-plugin/library/aws/Aws/S3/Enum/CannedAcl.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /mycode/blog/wp-content/plugins/static-html-output-plugin/library/aws/aws-autoloader.php on line 1349

TLS mismatch when fetching from localhost

From user-submitted email:

I forget the exact error I was dealing with, but here's the flow:

I am using TLS to protect my communication with the web server (wordpress).
I'd like to bring the web server behind the firewall so it is not exposed to attack.

I had issues with TLS hostname mismatch and your plugin, where whatever was fetching the pages before sending them off to S3 couldn't deal with the fact my private site had an invalid cert.

When the web server is behind the firewall letsencrypt (free TLS certs) won't work, and why would I pay for one for a firewall protected site?

I can install the TLS certificate locally to trust it manually, and I can probably install it into the web server system trust chain too if I can figure out which SSL library applies, but then I still have to deal with TLS mismatch if I've got multiple sites and one cert with no SANs.

If it's easy to just ignore TLS warning that would be great. If not, maybe I'll switch my entire site back to http. I can workaround the TLS issue so don't change libraries for me, but if its as simple as a checkbox and a runtime switch to your "fetch" library -- well thats great.

Add option to set export directory

The project I'm on cannot use the wp-content/uploads directory to export the static site to, even temporarily. I would like an option added to the export settings that lets you configure where the temporary files and zip file are written to.

export missing files using GeneratePress theme

files seeming to be missing:

<script type="text/javascript">
--
  | window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.4\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.4\/svg\/","svgExt":".svg","source":{"concatemoji":"http:\/\/172.17.0.3\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.9.5"}};

so can be a manual copy - just hardcode inclusion of it (may throw warning on older clients)

Plugin could not be activated because it triggered a fatal error. Parse error: syntax error, unexpected '[', expecting ')' in /var/www/wp-content/plugins/static-html-output-plugin/library/dropboxsdk/guzzlehttp/promises/src/functions.php on line 45

Issue activating plugin on PHP 5.3x (5.6 should be OK).

Look to detect capabilities and disable functionality (ie, Dropbox/Guzzle) in these cases..

Plugin could not be activated because it triggered a fatal error.

Parse error: syntax error, unexpected '[', expecting ')' in /var/www/wp-content/plugins/static-html-output-plugin/library/dropboxsdk/guzzlehttp/promises/src/functions.php on line 45

Empty Index.html

Hey. Great Plugin! After the last update (to 1.6) i'm getting on every export just an empty index.html (0 kb). Tryed with different sites. Then I've tryed with the old version 1.2 and everything works just fine. Wordpress 4.7.3

option to diff to previous export and skip identical files

pseudo steps:

  • add option to view "only deploy changes since last export" is checked

  • if checked

  • at start of export, cp contents (not symlink) of latest-1 to former dir

  • at end of post-processing stage, remove any files from outputdir, which are identical to those in the former

  • existing functionality for building deployment list from output dir should then work as usual, but have a lesser set of files to copy

This should usually skip all binaries and assets if only doing WP content updates.

BunnyCDN export option

From user Leif:

My ultimate use case would be to publish to BunnyCDN storage upon post update automatic .. If I could dream of a perfect scenario .. =)

I have authors that posts and they would need to see the new post direct when they hit publish .. =)

I uploaded a html site without any optimization to BunnyCDN storage and just connected the domain to it´s CDN solution with cname as an example, you can see the domain here https://www.copy24.se/elements.html nothing fancy, just some files I had on my harddrive .. So you could get a feel about BunnyCDN .. =)

If you would implement BunnyCDN Storage API they have 2 different API sites, one for the regular cdn api at https://bunnycdn.docs.apiary.io and the other for the storage api at https://bunnycdnstorage.docs.apiary.io

I can really recommend BunnyCDN because they are a really friendly new ( started in 2015; https://bunnycdn.com/about ) company from Slovenia and their performance is often faster then AWS Cloudfront for a minimum of just $10 a year and about 8 times cheaper than AWS Cloudfront on their CDN and $0.01 /GB per month for their ssd storage .. and if you have a small site and the total bill is under the minimum yearly $10 then it cost you only the minimum fee of $10 a year .. It´s so cheap .. and for static sites, you can host a lot of sites with your plugin and you do not have to worry about traffic surges if you get lucky on one article in traffic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.