deleted plugin `WP2Static` version 6.6.7

This commit is contained in:
KawaiiPunk 2021-04-08 18:46:41 +00:00 committed by Gitium
parent d1bf360aac
commit 2b403ab680
99 changed files with 0 additions and 4337 deletions

View File

@ -1,74 +0,0 @@
msgid ""
msgstr ""
"Project-Id-Version: WP Static HTML Output Plugin\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-08-11 05:47+0800\n"
"PO-Revision-Date: 2012-08-11 05:48+0800\n"
"Last-Translator: Leon Stafford <leon.stafford@mac.com>\n"
"Language-Team: Leon Stafford <leon.stafford@mac.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: Japanese\n"
"X-Poedit-Country: JAPAN\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../wp-static-html-output.php:30
msgid "Settings"
msgstr "設定"
#: ../WP2Static.php:135
msgid "WP Static HTML Output"
msgstr "WordPress静的HTML出力"
#: ../views/options-page.phtml:11
msgid "WP Static HTML Output Plugin"
msgstr "WordPress静的HTML出力プラグイン"
#: ../views/options-page.phtml:26
msgid "Export Options"
msgstr "静的HTML化設定"
#: ../views/options-page.phtml:29
msgid "Base Url"
msgstr "ベースURL"
#: ../views/options-page.phtml:34
msgid "Additional Urls"
msgstr "その他のファイル"
#: ../views/options-page.phtml:40
msgid "Generate Zip archive of whole site"
msgstr "サイト全体をZIPファイルに圧縮する"
#: ../views/options-page.phtml:45
msgid "Retain generated static files on server"
msgstr "現場サーバーに書き出されたHTMLファイルを保存する"
#: ../views/options-page.phtml:50
msgid "Transfer files via FTP"
msgstr "FTPサーバーに送信する"
#: ../views/options-page.phtml:51
msgid "FTP functionality is in Beta testing: For large sites, page may seem unresponsive until complete. If in doubt, check your remote FTP directory for activity."
msgstr "FTPサーバーに送信する機能がまだテスト中なので不安定の場合もございます"
#: ../views/options-page.phtml:55
msgid "FTP Server"
msgstr "FTPサーバーアドレス"
#: ../views/options-page.phtml:60
msgid "FTP Username"
msgstr "FTPユーザ名"
#: ../views/options-page.phtml:65
msgid "FTP Password"
msgstr "FTPパスワード"
#: ../views/options-page.phtml:70
msgid "FTP Remote Path"
msgstr "FTPのリモートパス"

View File

@ -1,74 +0,0 @@
msgid ""
msgstr ""
"Project-Id-Version: WP Static HTML Output Plugin\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-08-11 05:47+0800\n"
"PO-Revision-Date: 2012-08-11 05:48+0800\n"
"Last-Translator: Leon Stafford <leon.stafford@mac.com>\n"
"Language-Team: Leon Stafford <leon.stafford@mac.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: Spanish\n"
"X-Poedit-Country: LATIN AMERICA\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../wp-static-html-output.php:30
msgid "Settings"
msgstr "Ajustes"
#: ../WP2Static.php:135
msgid "WP Static HTML Output"
msgstr "Salida WordPress en HTML"
#: ../views/options-page.phtml:11
msgid "WP Static HTML Output Plugin"
msgstr "Enchunfle de Salida Wordpress en HTML"
#: ../views/options-page.phtml:26
msgid "Export Options"
msgstr "Opciones de exportaciòn"
#: ../views/options-page.phtml:29
msgid "Base Url"
msgstr "Base URL"
#: ../views/options-page.phtml:34
msgid "Additional Urls"
msgstr "URLs Adicionales"
#: ../views/options-page.phtml:40
msgid "Generate Zip archive of whole site"
msgstr "Comprime todo el sitio en un archivo ZIP"
#: ../views/options-page.phtml:45
msgid "Retain generated static files on server"
msgstr "Guarde el archivo HTML exportado al servidor del sitio"
#: ../views/options-page.phtml:50
msgid "Transfer files via FTP"
msgstr "Transfiere archivos a travès de FTP"
#: ../views/options-page.phtml:51
msgid "FTP functionality is in Beta testing: For large sites, page may seem unresponsive until complete. If in doubt, check your remote FTP directory for activity."
msgstr "La funcionalidad de FTP est· en la prueba Beta: para sitios grandes, la p·gina puede parecer insensible hasta que se complete. En caso de duda, verifique su actividad en el directorio FTP remoto."
#: ../views/options-page.phtml:55
msgid "FTP Server"
msgstr "Servidor de FTP"
#: ../views/options-page.phtml:60
msgid "FTP Username"
msgstr "Nombre de uso de el FTP"
#: ../views/options-page.phtml:65
msgid "FTP Password"
msgstr "Contraseña de FTP"
#: ../views/options-page.phtml:70
msgid "FTP Remote Path"
msgstr "Ruta remota de FTP"

View File

@ -1,47 +0,0 @@
# WP Static HTML Output
msgid ""
msgstr ""
"Project-Id-Version: WP Static Site Generator 6.6.7\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/wp-static-html-output\n"
"POT-Creation-Date: 2018-04-25 14:34:12+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-Country: United States\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: "
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
"X-Poedit-Basepath: ../\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-Bookmarks: \n"
"X-Textdomain-Support: yes\n"
"X-Generator: grunt-wp-i18n1.0.2\n"
#. Plugin Name of the plugin/theme
msgid "WP Static Site Generator"
msgstr ""
#: wp-static-html-output.php:28
msgid "Settings"
msgstr ""
#. Author URI of the plugin/theme
msgid "https://leonstafford.github.io"
msgstr ""
#. Description of the plugin/theme
msgid ""
"Benefit from WordPress as a CMS but with the speed, performance and "
"portability of a static site"
msgstr ""
#. Author of the plugin/theme
msgid "Leon Stafford"
msgstr ""

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\CSSList; use Sabberworm\CSS\Property\AtRule; class AtRuleBlockList extends CSSBlockList implements AtRule { private $sType; private $sArgs; public function __construct($sType, $sArgs = '', $iLineNo = 0) { parent::__construct($iLineNo); $this->sType = $sType; $this->sArgs = $sArgs; } public function atRuleName() { return $this->sType; } public function atRuleArgs() { return $this->sArgs; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $sArgs = $this->sArgs; if($sArgs) { $sArgs = ' ' . $sArgs; } $sResult = "@{$this->sType}$sArgs{$oOutputFormat->spaceBeforeOpeningBrace()}{"; $sResult .= parent::render($oOutputFormat); $sResult .= '}'; return $sResult; } public function isRootList() { return false; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\CSSList; use Sabberworm\CSS\RuleSet\DeclarationBlock; use Sabberworm\CSS\RuleSet\RuleSet; use Sabberworm\CSS\Property\Selector; use Sabberworm\CSS\Rule\Rule; use Sabberworm\CSS\Value\ValueList; use Sabberworm\CSS\Value\CSSFunction; abstract class CSSBlockList extends CSSList { public function __construct($iLineNo = 0) { parent::__construct($iLineNo); } protected function allDeclarationBlocks(&$aResult) { foreach ($this->aContents as $mContent) { if ($mContent instanceof DeclarationBlock) { $aResult[] = $mContent; } else if ($mContent instanceof CSSBlockList) { $mContent->allDeclarationBlocks($aResult); } } } protected function allRuleSets(&$aResult) { foreach ($this->aContents as $mContent) { if ($mContent instanceof RuleSet) { $aResult[] = $mContent; } else if ($mContent instanceof CSSBlockList) { $mContent->allRuleSets($aResult); } } } protected function allValues($oElement, &$aResult, $sSearchString = null, $bSearchInFunctionArguments = false) { if ($oElement instanceof CSSBlockList) { foreach ($oElement->getContents() as $oContent) { $this->allValues($oContent, $aResult, $sSearchString, $bSearchInFunctionArguments); } } else if ($oElement instanceof RuleSet) { foreach ($oElement->getRules($sSearchString) as $oRule) { $this->allValues($oRule, $aResult, $sSearchString, $bSearchInFunctionArguments); } } else if ($oElement instanceof Rule) { $this->allValues($oElement->getValue(), $aResult, $sSearchString, $bSearchInFunctionArguments); } else if ($oElement instanceof ValueList) { if ($bSearchInFunctionArguments || !($oElement instanceof CSSFunction)) { foreach ($oElement->getListComponents() as $mComponent) { $this->allValues($mComponent, $aResult, $sSearchString, $bSearchInFunctionArguments); } } } else { $aResult[] = $oElement; } } protected function allSelectors(&$aResult, $sSpecificitySearch = null) { $aDeclarationBlocks = array(); $this->allDeclarationBlocks($aDeclarationBlocks); foreach ($aDeclarationBlocks as $oBlock) { foreach ($oBlock->getSelectors() as $oSelector) { if ($sSpecificitySearch === null) { $aResult[] = $oSelector; } else { $sComparison = "\$bRes = {$oSelector->getSpecificity()} $sSpecificitySearch;"; eval($sComparison); if ($bRes) { $aResult[] = $oSelector; } } } } } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\CSSList; use Sabberworm\CSS\Renderable; use Sabberworm\CSS\RuleSet\DeclarationBlock; use Sabberworm\CSS\RuleSet\RuleSet; use Sabberworm\CSS\Property\Selector; use Sabberworm\CSS\Comment\Commentable; abstract class CSSList implements Renderable, Commentable { protected $aComments; protected $aContents; protected $iLineNo; public function __construct($iLineNo = 0) { $this->aComments = array(); $this->aContents = array(); $this->iLineNo = $iLineNo; } public function getLineNo() { return $this->iLineNo; } public function append($oItem) { $this->aContents[] = $oItem; } public function remove($oItemToRemove) { $iKey = array_search($oItemToRemove, $this->aContents, true); if ($iKey !== false) { unset($this->aContents[$iKey]); return true; } return false; } public function setContents(array $aContents) { $this->aContents = array(); foreach ($aContents as $content) { $this->append($content); } } public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false) { if ($mSelector instanceof DeclarationBlock) { $mSelector = $mSelector->getSelectors(); } if (!is_array($mSelector)) { $mSelector = explode(',', $mSelector); } foreach ($mSelector as $iKey => &$mSel) { if (!($mSel instanceof Selector)) { $mSel = new Selector($mSel); } } foreach ($this->aContents as $iKey => $mItem) { if (!($mItem instanceof DeclarationBlock)) { continue; } if ($mItem->getSelectors() == $mSelector) { unset($this->aContents[$iKey]); if (!$bRemoveAll) { return; } } } } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $sResult = ''; $bIsFirst = true; $oNextLevel = $oOutputFormat; if(!$this->isRootList()) { $oNextLevel = $oOutputFormat->nextLevel(); } foreach ($this->aContents as $oContent) { $sRendered = $oOutputFormat->safely(function() use ($oNextLevel, $oContent) { return $oContent->render($oNextLevel); }); if($sRendered === null) { continue; } if($bIsFirst) { $bIsFirst = false; $sResult .= $oNextLevel->spaceBeforeBlocks(); } else { $sResult .= $oNextLevel->spaceBetweenBlocks(); } $sResult .= $sRendered; } if(!$bIsFirst) { $sResult .= $oOutputFormat->spaceAfterBlocks(); } return $sResult; } public abstract function isRootList(); public function getContents() { return $this->aContents; } public function addComments(array $aComments) { $this->aComments = array_merge($this->aComments, $aComments); } public function getComments() { return $this->aComments; } public function setComments(array $aComments) { $this->aComments = $aComments; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\CSSList; class Document extends CSSBlockList { public function __construct($iLineNo = 0) { parent::__construct($iLineNo); } public function getAllDeclarationBlocks() { $aResult = array(); $this->allDeclarationBlocks($aResult); return $aResult; } public function getAllSelectors() { return $this->getAllDeclarationBlocks(); } public function getAllRuleSets() { $aResult = array(); $this->allRuleSets($aResult); return $aResult; } public function getAllValues($mElement = null, $bSearchInFunctionArguments = false) { $sSearchString = null; if ($mElement === null) { $mElement = $this; } else if (is_string($mElement)) { $sSearchString = $mElement; $mElement = $this; } $aResult = array(); $this->allValues($mElement, $aResult, $sSearchString, $bSearchInFunctionArguments); return $aResult; } public function getSelectorsBySpecificity($sSpecificitySearch = null) { if (is_numeric($sSpecificitySearch) || is_numeric($sSpecificitySearch[0])) { $sSpecificitySearch = "== $sSpecificitySearch"; } $aResult = array(); $this->allSelectors($aResult, $sSpecificitySearch); return $aResult; } public function expandShorthands() { foreach ($this->getAllDeclarationBlocks() as $oDeclaration) { $oDeclaration->expandShorthands(); } } public function createShorthands() { foreach ($this->getAllDeclarationBlocks() as $oDeclaration) { $oDeclaration->createShorthands(); } } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat = null) { if($oOutputFormat === null) { $oOutputFormat = new \Sabberworm\CSS\OutputFormat(); } return parent::render($oOutputFormat); } public function isRootList() { return true; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\CSSList; use Sabberworm\CSS\Property\AtRule; class KeyFrame extends CSSList implements AtRule { private $vendorKeyFrame; private $animationName; public function __construct($iLineNo = 0) { parent::__construct($iLineNo); $this->vendorKeyFrame = null; $this->animationName = null; } public function setVendorKeyFrame($vendorKeyFrame) { $this->vendorKeyFrame = $vendorKeyFrame; } public function getVendorKeyFrame() { return $this->vendorKeyFrame; } public function setAnimationName($animationName) { $this->animationName = $animationName; } public function getAnimationName() { return $this->animationName; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{"; $sResult .= parent::render($oOutputFormat); $sResult .= '}'; return $sResult; } public function isRootList() { return false; } public function atRuleName() { return $this->vendorKeyFrame; } public function atRuleArgs() { return $this->animationName; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Comment; use Sabberworm\CSS\Renderable; class Comment implements Renderable { protected $iLineNo; protected $sComment; public function __construct($sComment = '', $iLineNo = 0) { $this->sComment = $sComment; $this->iLineNo = $iLineNo; } public function getComment() { return $this->sComment; } public function getLineNo() { return $this->iLineNo; } public function setComment($sComment) { $this->sComment = $sComment; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return '/*' . $this->sComment . '*/'; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Comment; interface Commentable { public function addComments(array $aComments); public function getComments(); public function setComments(array $aComments); }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Parsing; class OutputException extends SourceException { public function __construct($sMessage, $iLineNo = 0) { parent::__construct($sMessage, $iLineNo); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Parsing; class SourceException extends \Exception { private $iLineNo; public function __construct($sMessage, $iLineNo = 0) { $this->iLineNo = $iLineNo; if (!empty($iLineNo)) { $sMessage .= " [line no: $iLineNo]"; } parent::__construct($sMessage); } public function getLineNo() { return $this->iLineNo; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Parsing; class UnexpectedTokenException extends SourceException { private $sExpected; private $sFound; private $sMatchType; public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLineNo = 0) { $this->sExpected = $sExpected; $this->sFound = $sFound; $this->sMatchType = $sMatchType; $sMessage = "Token “{$sExpected}” ({$sMatchType}) not found. Got “{$sFound}”."; if($this->sMatchType === 'search') { $sMessage = "Search for “{$sExpected}” returned no results. Context: “{$sFound}”."; } else if($this->sMatchType === 'count') { $sMessage = "Next token was expected to have {$sExpected} chars. Context: “{$sFound}”."; } else if($this->sMatchType === 'identifier') { $sMessage = "Identifier expected. Got “{$sFound}"; } else if($this->sMatchType === 'custom') { $sMessage = trim("$sExpected $sFound"); } parent::__construct($sMessage, $iLineNo); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Property; use Sabberworm\CSS\Renderable; use Sabberworm\CSS\Comment\Commentable; interface AtRule extends Renderable, Commentable { const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values'; const SET_RULES = 'font-face/counter-style/page/swash/styleset/annotation'; public function atRuleName(); public function atRuleArgs(); }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Property; class CSSNamespace implements AtRule { private $mUrl; private $sPrefix; private $iLineNo; protected $aComments; public function __construct($mUrl, $sPrefix = null, $iLineNo = 0) { $this->mUrl = $mUrl; $this->sPrefix = $sPrefix; $this->iLineNo = $iLineNo; $this->aComments = array(); } public function getLineNo() { return $this->iLineNo; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return '@namespace '.($this->sPrefix === null ? '' : $this->sPrefix.' ').$this->mUrl->render($oOutputFormat).';'; } public function getUrl() { return $this->mUrl; } public function getPrefix() { return $this->sPrefix; } public function setUrl($mUrl) { $this->mUrl = $mUrl; } public function setPrefix($sPrefix) { $this->sPrefix = $sPrefix; } public function atRuleName() { return 'namespace'; } public function atRuleArgs() { $aResult = array($this->mUrl); if($this->sPrefix) { array_unshift($aResult, $this->sPrefix); } return $aResult; } public function addComments(array $aComments) { $this->aComments = array_merge($this->aComments, $aComments); } public function getComments() { return $this->aComments; } public function setComments(array $aComments) { $this->aComments = $aComments; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Property; class Charset implements AtRule { private $sCharset; protected $iLineNo; protected $aComment; public function __construct($sCharset, $iLineNo = 0) { $this->sCharset = $sCharset; $this->iLineNo = $iLineNo; $this->aComments = array(); } public function getLineNo() { return $this->iLineNo; } public function setCharset($sCharset) { $this->sCharset = $sCharset; } public function getCharset() { return $this->sCharset; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return "@charset {$this->sCharset->render($oOutputFormat)};"; } public function atRuleName() { return 'charset'; } public function atRuleArgs() { return $this->sCharset; } public function addComments(array $aComments) { $this->aComments = array_merge($this->aComments, $aComments); } public function getComments() { return $this->aComments; } public function setComments(array $aComments) { $this->aComments = $aComments; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Property; use Sabberworm\CSS\Value\URL; class Import implements AtRule { private $oLocation; private $sMediaQuery; protected $iLineNo; protected $aComments; public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0) { $this->oLocation = $oLocation; $this->sMediaQuery = $sMediaQuery; $this->iLineNo = $iLineNo; $this->aComments = array(); } public function getLineNo() { return $this->iLineNo; } public function setLocation($oLocation) { $this->oLocation = $oLocation; } public function getLocation() { return $this->oLocation; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return "@import ".$this->oLocation->render($oOutputFormat).($this->sMediaQuery === null ? '' : ' '.$this->sMediaQuery).';'; } public function atRuleName() { return 'import'; } public function atRuleArgs() { $aResult = array($this->oLocation); if($this->sMediaQuery) { array_push($aResult, $this->sMediaQuery); } return $aResult; } public function addComments(array $aComments) { $this->aComments = array_merge($this->aComments, $aComments); } public function getComments() { return $this->aComments; } public function setComments(array $aComments) { $this->aComments = $aComments; } }

View File

@ -1,25 +0,0 @@
<?php
namespace Sabberworm\CSS\Property; class Selector { const NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX = '/
(\.[\w]+) # classes
|
\[(\w+) # attributes
|
(\:( # pseudo classes
link|visited|active
|hover|focus
|lang
|target
|enabled|disabled|checked|indeterminate
|root
|nth-child|nth-last-child|nth-of-type|nth-last-of-type
|first-child|last-child|first-of-type|last-of-type
|only-child|only-of-type
|empty|contains
))
/ix'; const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/
((^|[\s\+\>\~]+)[\w]+ # elements
|
\:{1,2}( # pseudo-elements
after|before|first-letter|first-line|selection
))
/ix'; private $sSelector; private $iSpecificity; public function __construct($sSelector, $bCalculateSpecificity = false) { $this->setSelector($sSelector); if ($bCalculateSpecificity) { $this->getSpecificity(); } } public function getSelector() { return $this->sSelector; } public function setSelector($sSelector) { $this->sSelector = trim($sSelector); $this->iSpecificity = null; } public function __toString() { return $this->getSelector(); } public function getSpecificity() { if ($this->iSpecificity === null) { $a = 0; $aMatches = null; $b = substr_count($this->sSelector, '#'); $c = preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $this->sSelector, $aMatches); $d = preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $this->sSelector, $aMatches); $this->iSpecificity = ($a * 1000) + ($b * 100) + ($c * 10) + $d; } return $this->iSpecificity; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS; interface Renderable { public function __toString(); public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat); public function getLineNo(); }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Rule; use Sabberworm\CSS\Renderable; use Sabberworm\CSS\Value\RuleValueList; use Sabberworm\CSS\Value\Value; use Sabberworm\CSS\Comment\Commentable; class Rule implements Renderable, Commentable { private $sRule; private $mValue; private $bIsImportant; private $aIeHack; protected $iLineNo; protected $aComments; public function __construct($sRule, $iLineNo = 0) { $this->sRule = $sRule; $this->mValue = null; $this->bIsImportant = false; $this->aIeHack = array(); $this->iLineNo = $iLineNo; $this->aComments = array(); } public function getLineNo() { return $this->iLineNo; } public function setRule($sRule) { $this->sRule = $sRule; } public function getRule() { return $this->sRule; } public function getValue() { return $this->mValue; } public function setValue($mValue) { $this->mValue = $mValue; } public function setValues($aSpaceSeparatedValues) { $oSpaceSeparatedList = null; if (count($aSpaceSeparatedValues) > 1) { $oSpaceSeparatedList = new RuleValueList(' ', $this->iLineNo); } foreach ($aSpaceSeparatedValues as $aCommaSeparatedValues) { $oCommaSeparatedList = null; if (count($aCommaSeparatedValues) > 1) { $oCommaSeparatedList = new RuleValueList(',', $this->iLineNo); } foreach ($aCommaSeparatedValues as $mValue) { if (!$oSpaceSeparatedList && !$oCommaSeparatedList) { $this->mValue = $mValue; return $mValue; } if ($oCommaSeparatedList) { $oCommaSeparatedList->addListComponent($mValue); } else { $oSpaceSeparatedList->addListComponent($mValue); } } if (!$oSpaceSeparatedList) { $this->mValue = $oCommaSeparatedList; return $oCommaSeparatedList; } else { $oSpaceSeparatedList->addListComponent($oCommaSeparatedList); } } $this->mValue = $oSpaceSeparatedList; return $oSpaceSeparatedList; } public function getValues() { if (!$this->mValue instanceof RuleValueList) { return array(array($this->mValue)); } if ($this->mValue->getListSeparator() === ',') { return array($this->mValue->getListComponents()); } $aResult = array(); foreach ($this->mValue->getListComponents() as $mValue) { if (!$mValue instanceof RuleValueList || $mValue->getListSeparator() !== ',') { $aResult[] = array($mValue); continue; } if ($this->mValue->getListSeparator() === ' ' || count($aResult) === 0) { $aResult[] = array(); } foreach ($mValue->getListComponents() as $mValue) { $aResult[count($aResult) - 1][] = $mValue; } } return $aResult; } public function addValue($mValue, $sType = ' ') { if (!is_array($mValue)) { $mValue = array($mValue); } if (!$this->mValue instanceof RuleValueList || $this->mValue->getListSeparator() !== $sType) { $mCurrentValue = $this->mValue; $this->mValue = new RuleValueList($sType, $this->iLineNo); if ($mCurrentValue) { $this->mValue->addListComponent($mCurrentValue); } } foreach ($mValue as $mValueItem) { $this->mValue->addListComponent($mValueItem); } } public function addIeHack($iModifier) { $this->aIeHack[] = $iModifier; } public function setIeHack(array $aModifiers) { $this->aIeHack = $aModifiers; } public function getIeHack() { return $this->aIeHack; } public function setIsImportant($bIsImportant) { $this->bIsImportant = $bIsImportant; } public function getIsImportant() { return $this->bIsImportant; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $sResult = "{$this->sRule}:{$oOutputFormat->spaceAfterRuleName()}"; if ($this->mValue instanceof Value) { $sResult .= $this->mValue->render($oOutputFormat); } else { $sResult .= $this->mValue; } if (!empty($this->aIeHack)) { $sResult .= ' \\' . implode('\\', $this->aIeHack); } if ($this->bIsImportant) { $sResult .= ' !important'; } $sResult .= ';'; return $sResult; } public function addComments(array $aComments) { $this->aComments = array_merge($this->aComments, $aComments); } public function getComments() { return $this->aComments; } public function setComments(array $aComments) { $this->aComments = $aComments; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\RuleSet; use Sabberworm\CSS\Property\AtRule; class AtRuleSet extends RuleSet implements AtRule { private $sType; private $sArgs; public function __construct($sType, $sArgs = '', $iLineNo = 0) { parent::__construct($iLineNo); $this->sType = $sType; $this->sArgs = $sArgs; } public function atRuleName() { return $this->sType; } public function atRuleArgs() { return $this->sArgs; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $sArgs = $this->sArgs; if($sArgs) { $sArgs = ' ' . $sArgs; } $sResult = "@{$this->sType}$sArgs{$oOutputFormat->spaceBeforeOpeningBrace()}{"; $sResult .= parent::render($oOutputFormat); $sResult .= '}'; return $sResult; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\RuleSet; use Sabberworm\CSS\Rule\Rule; use Sabberworm\CSS\Renderable; use Sabberworm\CSS\Comment\Commentable; abstract class RuleSet implements Renderable, Commentable { private $aRules; protected $iLineNo; protected $aComments; public function __construct($iLineNo = 0) { $this->aRules = array(); $this->iLineNo = $iLineNo; $this->aComments = array(); } public function getLineNo() { return $this->iLineNo; } public function addRule(Rule $oRule, Rule $oSibling = null) { $sRule = $oRule->getRule(); if(!isset($this->aRules[$sRule])) { $this->aRules[$sRule] = array(); } $iPosition = count($this->aRules[$sRule]); if ($oSibling !== null) { $iSiblingPos = array_search($oSibling, $this->aRules[$sRule], true); if ($iSiblingPos !== false) { $iPosition = $iSiblingPos; } } array_splice($this->aRules[$sRule], $iPosition, 0, array($oRule)); } public function getRules($mRule = null) { if ($mRule instanceof Rule) { $mRule = $mRule->getRule(); } $aResult = array(); foreach($this->aRules as $sName => $aRules) { if(!$mRule || $sName === $mRule || (strrpos($mRule, '-') === strlen($mRule) - strlen('-') && (strpos($sName, $mRule) === 0 || $sName === substr($mRule, 0, -1)))) { $aResult = array_merge($aResult, $aRules); } } return $aResult; } public function setRules(array $aRules) { $this->aRules = array(); foreach ($aRules as $rule) { $this->addRule($rule); } } public function getRulesAssoc($mRule = null) { $aResult = array(); foreach($this->getRules($mRule) as $oRule) { $aResult[$oRule->getRule()] = $oRule; } return $aResult; } public function removeRule($mRule) { if($mRule instanceof Rule) { $sRule = $mRule->getRule(); if(!isset($this->aRules[$sRule])) { return; } foreach($this->aRules[$sRule] as $iKey => $oRule) { if($oRule === $mRule) { unset($this->aRules[$sRule][$iKey]); } } } else { foreach($this->aRules as $sName => $aRules) { if(!$mRule || $sName === $mRule || (strrpos($mRule, '-') === strlen($mRule) - strlen('-') && (strpos($sName, $mRule) === 0 || $sName === substr($mRule, 0, -1)))) { unset($this->aRules[$sName]); } } } } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $sResult = ''; $bIsFirst = true; foreach ($this->aRules as $aRules) { foreach($aRules as $oRule) { $sRendered = $oOutputFormat->safely(function() use ($oRule, $oOutputFormat) { return $oRule->render($oOutputFormat->nextLevel()); }); if($sRendered === null) { continue; } if($bIsFirst) { $bIsFirst = false; $sResult .= $oOutputFormat->nextLevel()->spaceBeforeRules(); } else { $sResult .= $oOutputFormat->nextLevel()->spaceBetweenRules(); } $sResult .= $sRendered; } } if(!$bIsFirst) { $sResult .= $oOutputFormat->spaceAfterRules(); } return $oOutputFormat->removeLastSemicolon($sResult); } public function addComments(array $aComments) { $this->aComments = array_merge($this->aComments, $aComments); } public function getComments() { return $this->aComments; } public function setComments(array $aComments) { $this->aComments = $aComments; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS; use Sabberworm\CSS\Rule\Rule; class Settings { public $bMultibyteSupport; public $sDefaultCharset = 'utf-8'; public $bLenientParsing = true; private function __construct() { $this->bMultibyteSupport = extension_loaded('mbstring'); } public static function create() { return new Settings(); } public function withMultibyteSupport($bMultibyteSupport = true) { $this->bMultibyteSupport = $bMultibyteSupport; return $this; } public function withDefaultCharset($sDefaultCharset) { $this->sDefaultCharset = $sDefaultCharset; return $this; } public function withLenientParsing($bLenientParsing = true) { $this->bLenientParsing = $bLenientParsing; return $this; } public function beStrict() { return $this->withLenientParsing(false); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class CSSFunction extends ValueList { protected $sName; public function __construct($sName, $aArguments, $sSeparator = ',', $iLineNo = 0) { if($aArguments instanceof RuleValueList) { $sSeparator = $aArguments->getListSeparator(); $aArguments = $aArguments->getListComponents(); } $this->sName = $sName; $this->iLineNo = $iLineNo; parent::__construct($aArguments, $sSeparator, $iLineNo); } public function getName() { return $this->sName; } public function setName($sName) { $this->sName = $sName; } public function getArguments() { return $this->aComponents; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $aArguments = parent::render($oOutputFormat); return "{$this->sName}({$aArguments})"; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class CSSString extends PrimitiveValue { private $sString; public function __construct($sString, $iLineNo = 0) { $this->sString = $sString; parent::__construct($iLineNo); } public function setString($sString) { $this->sString = $sString; } public function getString() { return $this->sString; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $sString = addslashes($this->sString); $sString = str_replace("\n", '\A', $sString); return $oOutputFormat->getStringQuotingType() . $sString . $oOutputFormat->getStringQuotingType(); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class CalcFunction extends CSSFunction { const T_OPERAND = 1; const T_OPERATOR = 2; }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class CalcRuleValueList extends RuleValueList { public function __construct($iLineNo = 0) { parent::__construct(array(), ',', $iLineNo); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return $oOutputFormat->implode(' ', $this->aComponents); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class Color extends CSSFunction { public function __construct($aColor, $iLineNo = 0) { parent::__construct(implode('', array_keys($aColor)), $aColor, ',', $iLineNo); } public function getColor() { return $this->aComponents; } public function setColor($aColor) { $this->setName(implode('', array_keys($aColor))); $this->aComponents = $aColor; } public function getColorDescription() { return $this->getName(); } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { if($oOutputFormat->getRGBHashNotation() && implode('', array_keys($this->aComponents)) === 'rgb') { $sResult = sprintf( '%02x%02x%02x', $this->aComponents['r']->getSize(), $this->aComponents['g']->getSize(), $this->aComponents['b']->getSize() ); return '#'.(($sResult[0] == $sResult[1]) && ($sResult[2] == $sResult[3]) && ($sResult[4] == $sResult[5]) ? "$sResult[0]$sResult[2]$sResult[4]" : $sResult); } return parent::render($oOutputFormat); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class LineName extends ValueList { public function __construct($aComponents = array(), $iLineNo = 0) { parent::__construct($aComponents, ' ', $iLineNo); } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return '[' . parent::render(\Sabberworm\CSS\OutputFormat::createCompact()) . ']'; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; abstract class PrimitiveValue extends Value { public function __construct($iLineNo = 0) { parent::__construct($iLineNo); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class RuleValueList extends ValueList { public function __construct($sSeparator = ',', $iLineNo = 0) { parent::__construct(array(), $sSeparator, $iLineNo); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class Size extends PrimitiveValue { const ABSOLUTE_SIZE_UNITS = 'px/cm/mm/mozmm/in/pt/pc/vh/vw/vm/vmin/vmax/rem'; const RELATIVE_SIZE_UNITS = '%/em/ex/ch/fr'; const NON_SIZE_UNITS = 'deg/grad/rad/s/ms/turns/Hz/kHz'; private $fSize; private $sUnit; private $bIsColorComponent; public function __construct($fSize, $sUnit = null, $bIsColorComponent = false, $iLineNo = 0) { parent::__construct($iLineNo); $this->fSize = floatval($fSize); $this->sUnit = $sUnit; $this->bIsColorComponent = $bIsColorComponent; } public function setUnit($sUnit) { $this->sUnit = $sUnit; } public function getUnit() { return $this->sUnit; } public function setSize($fSize) { $this->fSize = floatval($fSize); } public function getSize() { return $this->fSize; } public function isColorComponent() { return $this->bIsColorComponent; } public function isSize() { if (in_array($this->sUnit, explode('/', self::NON_SIZE_UNITS))) { return false; } return !$this->isColorComponent(); } public function isRelative() { if (in_array($this->sUnit, explode('/', self::RELATIVE_SIZE_UNITS))) { return true; } if ($this->sUnit === null && $this->fSize != 0) { return true; } return false; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { $l = localeconv(); $sPoint = preg_quote($l['decimal_point'], '/'); return preg_replace(array("/$sPoint/", "/^(-?)0\./"), array('.', '$1.'), $this->fSize) . ($this->sUnit === null ? '' : $this->sUnit); } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; class URL extends PrimitiveValue { private $oURL; public function __construct(CSSString $oURL, $iLineNo = 0) { parent::__construct($iLineNo); $this->oURL = $oURL; } public function setURL(CSSString $oURL) { $this->oURL = $oURL; } public function getURL() { return $this->oURL; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return "url({$this->oURL->render($oOutputFormat)})"; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; use Sabberworm\CSS\Renderable; abstract class Value implements Renderable { protected $iLineNo; public function __construct($iLineNo = 0) { $this->iLineNo = $iLineNo; } public function getLineNo() { return $this->iLineNo; } }

View File

@ -1,2 +0,0 @@
<?php
namespace Sabberworm\CSS\Value; abstract class ValueList extends Value { protected $aComponents; protected $sSeparator; public function __construct($aComponents = array(), $sSeparator = ',', $iLineNo = 0) { parent::__construct($iLineNo); if (!is_array($aComponents)) { $aComponents = array($aComponents); } $this->aComponents = $aComponents; $this->sSeparator = $sSeparator; } public function addListComponent($mComponent) { $this->aComponents[] = $mComponent; } public function getListComponents() { return $this->aComponents; } public function setListComponents($aComponents) { $this->aComponents = $aComponents; } public function getListSeparator() { return $this->sSeparator; } public function setListSeparator($sSeparator) { $this->sSeparator = $sSeparator; } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return $oOutputFormat->implode($oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator . $oOutputFormat->spaceAfterListArgumentSeparator($this->sSeparator), $this->aComponents); } }

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
namespace FtpClient; class FtpException extends \Exception {}

View File

@ -1,2 +0,0 @@
<?php
namespace FtpClient; class FtpWrapper { protected $conn; public function __construct(&$connection) { $this->conn = &$connection; } public function __call($function, array $arguments) { $function = 'ftp_' . $function; if (function_exists($function)) { array_unshift($arguments, $this->conn); return call_user_func_array($function, $arguments); } throw new FtpException("{$function} is not a valid FTP function"); } public function connect($host, $port = 21, $timeout = 90) { return ftp_connect($host, $port, $timeout); } public function ssl_connect($host, $port = 21, $timeout = 90) { return ftp_ssl_connect($host, $port, $timeout); } }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
class Archive extends WP2Static { public function __construct() { $this->loadSettings( array( 'wpenv' ) ); $this->path = ''; $this->name = ''; $this->crawl_list = ''; $this->export_log = ''; } public function setToCurrentArchive() { $handle = fopen( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt', 'r' ); $this->path = stream_get_line( $handle, 0 ); $this->name = basename( $this->path ); } public function currentArchiveExists() { return is_file( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt' ); } public function create() { $this->name = $this->settings['wp_uploads_path'] . '/wp-static-html-output-' . time(); $this->path = $this->name . '/'; $this->name = basename( $this->path ); if ( wp_mkdir_p( $this->path ) ) { $result = file_put_contents( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt', $this->path ); if ( ! $result ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'USER WORKING DIRECTORY NOT WRITABLE' ); } chmod( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt', 0664 ); } else { error_log( "Couldn't create archive directory at " . $this->path ); } } }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
class WPSHO_DBSettings { public static function get( $sets = array() ) { $plugin = WP2Static_Controller::getInstance(); $settings = array(); $key_sets = array(); $target_keys = array(); $key_sets['general'] = array( 'baseUrl', 'debug_mode', 'selected_deployment_option', ); $key_sets['crawling'] = array( 'additionalUrls', 'excludeURLs', 'useBasicAuth', 'basicAuthPassword', 'basicAuthUser', 'detection_level', 'crawl_delay', 'crawlPort', ); $key_sets['processing'] = array( 'removeConditionalHeadComments', 'allowOfflineUsage', 'baseHREF', 'rewrite_rules', 'rename_rules', 'removeWPMeta', 'removeWPLinks', 'useBaseHref', 'useRelativeURLs', 'removeConditionalHeadComments', 'removeWPMeta', 'removeWPLinks', 'removeHTMLComments', ); $key_sets['advanced'] = array( 'crawl_increment', 'completionEmail', 'delayBetweenAPICalls', 'deployBatchSize', ); $key_sets['folder'] = array( 'baseUrl-folder', 'targetFolder', ); $key_sets['zip'] = array( 'baseUrl-zip', 'allowOfflineUsage', ); $key_sets['github'] = array( 'baseUrl-github', 'ghBranch', 'ghPath', 'ghToken', 'ghRepo', 'ghCommitMessage', ); $key_sets['bitbucket'] = array( 'baseUrl-bitbucket', 'bbBranch', 'bbPath', 'bbToken', 'bbRepo', ); $key_sets['gitlab'] = array( 'baseUrl-gitlab', 'glBranch', 'glPath', 'glToken', 'glProject', ); $key_sets['ftp'] = array( 'baseUrl-ftp', 'ftpPassword', 'ftpRemotePath', 'ftpServer', 'ftpPort', 'ftpTLS', 'ftpUsername', 'useActiveFTP', ); $key_sets['bunnycdn'] = array( 'baseUrl-bunnycdn', 'bunnycdnStorageZoneAccessKey', 'bunnycdnPullZoneAccessKey', 'bunnycdnPullZoneID', 'bunnycdnStorageZoneName', 'bunnycdnRemotePath', ); $key_sets['s3'] = array( 'baseUrl-s3', 'cfDistributionId', 's3Bucket', 's3Key', 's3Region', 's3RemotePath', 's3Secret', ); $key_sets['netlify'] = array( 'baseUrl-netlify', 'netlifyHeaders', 'netlifyPersonalAccessToken', 'netlifyRedirects', 'netlifySiteID', ); $key_sets['wpenv'] = array( 'wp_site_url', 'wp_site_path', 'wp_site_subdir', 'wp_uploads_path', 'wp_uploads_url', 'wp_active_theme', 'wp_themes', 'wp_uploads', 'wp_plugins', 'wp_content', 'wp_inc', ); foreach ( $sets as $set ) { $target_keys = array_merge( $target_keys, $key_sets[ $set ] ); } foreach ( $target_keys as $key ) { $settings[ $key ] = $plugin->options->{ $key }; } require_once dirname( __FILE__ ) . '/../WP2Static/WPSite.php'; $wp_site = new WPSite(); foreach ( $key_sets['wpenv'] as $key ) { $settings[ $key ] = $wp_site->{ $key }; } $settings['crawl_increment'] = isset( $plugin->options->crawl_increment ) ? (int) $plugin->options->crawl_increment : 1; $settings['baseUrl'] = rtrim( $plugin->options->baseUrl, '/' ) . '/'; return array_filter( $settings ); } }

View File

@ -1,2 +0,0 @@
<?php
class Deployer extends WP2Static { public function __construct() { $this->loadSettings( array( 'advanced', ) ); } public function deploy( $test = false ) { $method = $this->settings['selected_deployment_option']; WP_CLI::log( 'Deploying static site via: ' . $method ); $start_time = microtime( true ); $deployers_dir = dirname( __FILE__ ) . '/../deployers'; switch ( $this->settings['selected_deployment_option'] ) { case 'folder': break; case 'zip': break; case 's3': require_once dirname( __FILE__ ) . '/../WP2Static/SitePublisher.php'; require_once $deployers_dir . '/S3.php'; if ( $test ) { error_log( 'testing s3 deploy' ); $s3->test_s3(); return; } $s3->bootstrap(); $s3->loadArchive(); $s3->prepareDeploy(); $s3->upload_files(); $s3->cloudfront_invalidate_all_items(); break; case 'bitbucket': require_once dirname( __FILE__ ) . '/../WP2Static/SitePublisher.php'; require_once $deployers_dir . '/Bitbucket.php'; if ( $test ) { error_log( 'testing bitbucket deploy' ); $bitbucket->test_upload(); return; } $bitbucket->bootstrap(); $bitbucket->loadArchive(); $bitbucket->prepareDeploy( true ); $bitbucket->upload_files(); break; case 'bunnycdn': require_once dirname( __FILE__ ) . '/../WP2Static/SitePublisher.php'; require_once $deployers_dir . '/BunnyCDN.php'; if ( $test ) { error_log( 'testing BunnyCDN deploy' ); $bunny->test_deploy(); return; } $bunny->bootstrap(); $bunny->loadArchive(); $bunny->prepareDeploy( true ); $bunny->upload_files(); $bunny->purge_all_cache(); break; case 'ftp': require_once dirname( __FILE__ ) . '/../WP2Static/SitePublisher.php'; require_once $deployers_dir . '/FTP.php'; if ( $test ) { error_log( 'testing FTP deploy' ); $ftp->test_ftp(); return; } $ftp->bootstrap(); $ftp->loadArchive(); $ftp->prepareDeploy(); $ftp->upload_files(); break; case 'github': require_once dirname( __FILE__ ) . '/../WP2Static/SitePublisher.php'; require_once $deployers_dir . '/GitHub.php'; if ( $test ) { error_log( 'testing GitHub deploy' ); $github->test_upload(); return; } $github->bootstrap(); $github->loadArchive(); $github->prepareDeploy( true ); $github->upload_files(); break; case 'gitlab': require_once dirname( __FILE__ ) . '/../WP2Static/SitePublisher.php'; require_once $deployers_dir . '/GitLab.php'; if ( $test ) { error_log( 'testing GitLab deploy' ); $gitlab->test_file_create(); return; } $gitlab->bootstrap(); $gitlab->loadArchive(); $gitlab->getListOfFilesInRepo(); $gitlab->prepareDeploy( true ); $gitlab->upload_files(); break; case 'netlify': require_once dirname( __FILE__ ) . '/../WP2Static/SitePublisher.php'; require_once $deployers_dir . '/Netlify.php'; if ( $test ) { error_log( 'testing Netlify deploy' ); $gitlab->loadArchive(); $netlify->test_netlify(); return; } $netlify->bootstrap(); $netlify->loadArchive(); $netlify->deploy(); break; } $end_time = microtime( true ); $duration = $end_time - $start_time; WP_CLI::success( 'Deployed to: ' . $method . ' in ' . date( 'H:i:s', $duration ) ); $this->finalizeDeployment(); } public function finalizeDeployment() { $this->emailDeployNotification(); $this->triggerPostDeployHooks(); } public function emailDeployNotification() { if ( ! isset( $this->settings['completionEmail'] ) ) { return; } if ( defined( 'WP_CLI' ) ) { WP_CLI::line( 'Sending confirmation email...' ); } $current_user = wp_get_current_user(); $to = $current_user->user_email; $subject = 'Static site deployment: ' . $site_title = get_bloginfo( 'name' ); $body = 'Your WordPress site has been automatically deployed.'; $headers = array( 'Content-Type: text/html; charset=UTF-8' ); wp_mail( $to, $subject, $body, $headers ); } public function triggerPostDeployHooks() { require_once dirname( __FILE__ ) . '/Archive.php'; $this->archive = new Archive(); $this->archive->setToCurrentArchive(); do_action( 'wp2static_post_deploy_trigger', $this->archive ); } }

View File

@ -1,2 +0,0 @@
<?php
$ajax_action = isset( $_POST['ajax_action'] ) ? $_POST['ajax_action'] : ''; $deployers_dir = dirname( __FILE__ ) . '/../deployers'; if ( $ajax_action === 'crawl_site' || $ajax_action === 'crawl_again' ) { require_once dirname( __FILE__ ) . '/WP2Static.php'; require_once dirname( __FILE__ ) . '/SiteCrawler.php'; wp_die(); return null; } elseif ( $ajax_action == 'bitbucket_prepare_export' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/Bitbucket.php'; wp_die(); return null; } elseif ( $ajax_action == 'bitbucket_upload_files' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/Bitbucket.php'; wp_die(); return null; } elseif ( $ajax_action == 'github_prepare_export' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/GitHub.php'; wp_die(); return null; } elseif ( $ajax_action == 'github_upload_files' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/GitHub.php'; wp_die(); return null; } elseif ( $ajax_action == 'test_github' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/GitHub.php'; wp_die(); return null; } elseif ( $ajax_action == 'gitlab_prepare_export' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/GitLab.php'; wp_die(); return null; } elseif ( $ajax_action == 'gitlab_upload_files' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/GitLab.php'; wp_die(); return null; } elseif ( $ajax_action == 'test_gitlab' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/GitLab.php'; wp_die(); return null; } elseif ( $ajax_action == 'test_bitbucket' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/Bitbucket.php'; wp_die(); return null; } elseif ( $ajax_action == 'test_netlify' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/Netlify.php'; wp_die(); return null; } elseif ( $ajax_action == 'netlify_do_export' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/Netlify.php'; wp_die(); return null; } elseif ( $ajax_action == 'test_s3' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/S3.php'; wp_die(); return null; } elseif ( $ajax_action == 's3_prepare_export' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/S3.php'; wp_die(); return null; } elseif ( $ajax_action == 's3_transfer_files' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/S3.php'; wp_die(); return null; } elseif ( $ajax_action == 'cloudfront_invalidate_all_items' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/S3.php'; wp_die(); return null; } elseif ( $ajax_action == 'test_ftp' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/FTP.php'; wp_die(); return null; } elseif ( $ajax_action == 'ftp_prepare_export' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/FTP.php'; wp_die(); return null; } elseif ( $ajax_action == 'ftp_transfer_files' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/FTP.php'; wp_die(); return null; } elseif ( $ajax_action == 'test_bunny' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/BunnyCDN.php'; wp_die(); return null; } elseif ( $ajax_action == 'bunnycdn_prepare_export' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/BunnyCDN.php'; wp_die(); return null; } elseif ( $ajax_action == 'bunnycdn_transfer_files' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/BunnyCDN.php'; wp_die(); return null; } elseif ( $ajax_action == 'bunnycdn_purge_cache' ) { require_once dirname( __FILE__ ) . '/SitePublisher.php'; require_once $deployers_dir . '/BunnyCDN.php'; wp_die(); return null; }

View File

@ -1,2 +0,0 @@
<?php
class Exporter extends WP2Static { public function __construct() { $this->loadSettings( array( 'wpenv', 'crawling', 'advanced', ) ); } public function pre_export_cleanup() { $files_to_clean = array( 'WP-STATIC-2ND-CRAWL-LIST.txt', 'WP-STATIC-404-LOG.txt', 'WP-STATIC-CRAWLED-LINKS.txt', 'WP-STATIC-DISCOVERED-URLS-LOG.txt', 'WP-STATIC-DISCOVERED-URLS.txt', 'WP2STATIC-FILES-TO-DEPLOY.txt', 'WP-STATIC-EXPORT-LOG.txt', 'WP-STATIC-FINAL-2ND-CRAWL-LIST.txt', 'WP-STATIC-FINAL-CRAWL-LIST.txt', 'WP2STATIC-GITLAB-FILES-IN-REPO.txt', ); foreach ( $files_to_clean as $file_to_clean ) { if ( file_exists( $this->settings['wp_uploads_path'] . '/' . $file_to_clean ) ) { unlink( $this->settings['wp_uploads_path'] . '/' . $file_to_clean ); } } } public function cleanup_working_files() { if ( is_file( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt' ) ) { $handle = fopen( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt', 'r' ); $this->settings['archive_dir'] = stream_get_line( $handle, 0 ); } $files_to_clean = array( '/WP-STATIC-2ND-CRAWL-LIST.txt', '/WP-STATIC-CRAWLED-LINKS.txt', '/WP-STATIC-DISCOVERED-URLS.txt', '/WP2STATIC-FILES-TO-DEPLOY.txt', '/WP-STATIC-FINAL-2ND-CRAWL-LIST.txt', '/WP-STATIC-FINAL-CRAWL-LIST.txt', '/WP2STATIC-GITLAB-FILES-IN-REPO.txt', ); foreach ( $files_to_clean as $file_to_clean ) { if ( file_exists( $this->settings['wp_uploads_path'] . '/' . $file_to_clean ) ) { unlink( $this->settings['wp_uploads_path'] . '/' . $file_to_clean ); } } } public function initialize_cache_files() { $crawled_links_file = $this->settings['wp_uploads_path'] . '/WP-STATIC-CRAWLED-LINKS.txt'; $resource = fopen( $crawled_links_file, 'w' ); fwrite( $resource, '' ); fclose( $resource ); } public function cleanup_leftover_archives() { $leftover_files = preg_grep( '/^([^.])/', scandir( $this->settings['wp_uploads_path'] ) ); foreach ( $leftover_files as $filename ) { if ( strpos( $filename, 'wp-static-html-output-' ) !== false ) { $deletion_target = $this->settings['wp_uploads_path'] . '/' . $filename; if ( is_dir( $deletion_target ) ) { WP2Static_FilesHelper::delete_dir_with_files( $deletion_target ); } else { unlink( $deletion_target ); } } } if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function generateModifiedFileList() { copy( $this->settings['wp_uploads_path'] . '/WP-STATIC-INITIAL-CRAWL-LIST.txt', $this->settings['wp_uploads_path'] . '/WP-STATIC-MODIFIED-CRAWL-LIST.txt' ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-MODIFIED-CRAWL-LIST.txt', 0664 ); if ( ! isset( $this->settings['excludeURLs'] ) && ! isset( $this->settings['additionalUrls'] ) ) { copy( $this->settings['wp_uploads_path'] . '/WP-STATIC-INITIAL-CRAWL-LIST.txt', $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-CRAWL-LIST.txt' ); return; } $modified_crawl_list = array(); $crawl_list = file( $this->settings['wp_uploads_path'] . '/WP-STATIC-MODIFIED-CRAWL-LIST.txt' ); if ( isset( $this->settings['excludeURLs'] ) ) { $exclusions = explode( "\n", str_replace( "\r", '', $this->settings['excludeURLs'] ) ); foreach ( $crawl_list as $url_to_crawl ) { $url_to_crawl = trim( $url_to_crawl ); $match = false; foreach ( $exclusions as $exclusion ) { $exclusion = trim( $exclusion ); if ( $exclusion != '' ) { if ( strpos( $url_to_crawl, $exclusion ) !== false ) { $this->logAction( 'Excluding ' . $url_to_crawl . ' because of rule ' . $exclusion ); $match = true; } } if ( ! $match ) { $modified_crawl_list[] = $url_to_crawl; } } } } else { $modified_crawl_list = $crawl_list; } if ( isset( $this->settings['additionalUrls'] ) ) { $inclusions = explode( "\n", str_replace( "\r", '', $this->settings['additionalUrls'] ) ); foreach ( $inclusions as $inclusion ) { $inclusion = trim( $inclusion ); $inclusion = $inclusion; $modified_crawl_list[] = $inclusion; } } $modified_crawl_list = array_unique( $modified_crawl_list ); $str = implode( PHP_EOL, $modified_crawl_list ); file_put_contents( $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-CRAWL-LIST.txt', $str ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-CRAWL-LIST.txt', 0664 ); } public function logAction( $action ) { if ( ! isset( $this->settings['debug_mode'] ) ) { return; } require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( $action ); } }

View File

@ -1,2 +0,0 @@
<?php
class FileCopier { public function __construct( $url, $wp_site_url, $wp_site_path ) { $this->url = $url; $this->wp_site_url = $wp_site_url; $this->wp_site_path = $wp_site_path; } public function getLocalFileForURL() { $local_file = str_replace( $this->wp_site_url, $this->wp_site_path, $this->url ); if ( is_file( $local_file ) ) { return $local_file; } else { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'ERROR: trying to copy local file: ' . $local_file . ' for URL: ' . $this->url . ' (FILE NOT FOUND/UNREADABLE)' ); } } public function copyFile( $archive_dir ) { $url_info = parse_url( $this->url ); $path_info = array(); $local_file = $this->getLocalFileForURL(); if ( ! isset( $url_info['path'] ) ) { return false; } $path_info = pathinfo( $url_info['path'] ); $directory_in_archive = isset( $path_info['dirname'] ) ? $path_info['dirname'] : ''; if ( ! empty( $this->settings['wp_site_subdir'] ) ) { $directory_in_archive = str_replace( $this->settings['wp_site_subdir'], '', $directory_in_archive ); } $file_dir = $archive_dir . ltrim( $directory_in_archive, '/' ); if ( ! file_exists( $file_dir ) ) { wp_mkdir_p( $file_dir ); } $file_extension = $path_info['extension']; $basename = $path_info['filename'] . '.' . $file_extension; $filename = $file_dir . '/' . $basename; $filename = str_replace( '//', '/', $filename ); if ( is_file( $local_file ) ) { copy( $local_file, $filename ); } else { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'ERROR: trying to copy local file: ' . $local_file . ' to: ' . $filename . ' in archive dir: ' . $archive_dir . ' (FILE NOT FOUND/UNREADABLE)' ); } } }

View File

@ -1,2 +0,0 @@
<?php
class FileWriter extends WP2Static { public function __construct( $url, $content, $file_type, $content_type ) { $this->url = $url; $this->content = $content; $this->file_type = $file_type; $this->content_type = $content_type; $this->loadSettings( array( 'wpenv', ) ); } public function saveFile( $archive_dir ) { $url_info = parse_url( $this->url ); $path_info = array(); if ( ! isset( $url_info['path'] ) ) { return false; } if ( $url_info['path'] != '/' ) { $path_info = pathinfo( $url_info['path'] ); } else { $path_info = pathinfo( 'index.html' ); } $directory_in_archive = isset( $path_info['dirname'] ) ? $path_info['dirname'] : ''; if ( ! empty( $this->settings['wp_site_subdir'] ) ) { $directory_in_archive = str_replace( $this->settings['wp_site_subdir'], '', $directory_in_archive ); } $file_dir = $archive_dir . ltrim( $directory_in_archive, '/' ); if ( empty( $path_info['extension'] ) && $path_info['basename'] === $path_info['filename'] ) { $file_dir .= '/' . $path_info['basename']; $path_info['filename'] = 'index'; } if ( ! file_exists( $file_dir ) ) { wp_mkdir_p( $file_dir ); } $file_extension = ''; if ( isset( $path_info['extension'] ) ) { $file_extension = $path_info['extension']; } elseif ( $this->file_type == 'html' ) { $file_extension = 'html'; } elseif ( $this->file_type == 'xml' ) { $file_extension = 'html'; } $filename = ''; if ( $url_info['path'] == '/' ) { $filename = rtrim( $file_dir, '.' ) . 'index.html'; } else { if ( ! empty( $this->settings['wp_site_subdir'] ) ) { $file_dir = str_replace( '/' . $this->settings['wp_site_subdir'], '/', $file_dir ); } $filename = $file_dir . '/' . $path_info['filename'] . '.' . $file_extension; } $file_contents = $this->content; if ( $file_contents ) { $this->logAction( 'SAVING ' . $this->url . ' to ' . $filename ); file_put_contents( $filename, $file_contents ); chmod( $filename, 0664 ); } else { $this->logAction( 'NOT SAVING EMTPY FILE ' . $this->url ); } } public function logAction( $action ) { if ( ! isset( $this->settings['debug_mode'] ) ) { return; } require_once dirname( __FILE__ ) . '/WsLog.php'; WsLog::l( $action ); } }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
class WP2Static_Options { protected $wp2static_options = array(); protected $wp2static_option_key = null; protected $wp2static_options_keys = array( 'additionalUrls', 'allowOfflineUsage', 'baseHREF', 'baseUrl', 'baseUrl-bitbucket', 'baseUrl-bunnycdn', 'baseUrl-folder', 'baseUrl-ftp', 'baseUrl-github', 'baseUrl-gitlab', 'baseUrl-netlify', 'baseUrl-s3', 'baseUrl-zip', 'baseUrl-zip', 'basicAuthPassword', 'basicAuthUser', 'bbBranch', 'bbPath', 'bbRepo', 'bbToken', 'bunnycdnStorageZoneAccessKey', 'bunnycdnPullZoneAccessKey', 'bunnycdnPullZoneID', 'bunnycdnStorageZoneName', 'bunnycdnRemotePath', 'cfDistributionId', 'completionEmail', 'crawl_delay', 'crawl_increment', 'crawlPort', 'debug_mode', 'detection_level', 'delayBetweenAPICalls', 'deployBatchSize', 'excludeURLs', 'ftpPassword', 'ftpRemotePath', 'ftpServer', 'ftpPort', 'ftpTLS', 'ftpUsername', 'ghBranch', 'ghCommitMessage', 'ghPath', 'ghRepo', 'ghToken', 'glBranch', 'glPath', 'glProject', 'glToken', 'netlifyHeaders', 'netlifyPersonalAccessToken', 'netlifyRedirects', 'netlifySiteID', 'removeConditionalHeadComments', 'removeHTMLComments', 'removeWPLinks', 'removeWPMeta', 'rewrite_rules', 'rename_rules', 's3Bucket', 's3Key', 's3Region', 's3RemotePath', 's3Secret', 'selected_deployment_option', 'targetFolder', 'useActiveFTP', 'useBaseHref', 'useBasicAuth', 'useRelativeURLs', ); protected $whitelisted_keys = array( 'additionalUrls', 'allowOfflineUsage', 'baseHREF', 'baseUrl', 'baseUrl-bitbucket', 'baseUrl-bunnycdn', 'baseUrl-folder', 'baseUrl-ftp', 'baseUrl-github', 'baseUrl-gitlab', 'baseUrl-netlify', 'baseUrl-s3', 'baseUrl-zip', 'baseUrl-zip', 'basicAuthUser', 'bbBranch', 'bbPath', 'bbRepo', 'bunnycdnPullZoneID', 'bunnycdnStorageZoneName', 'bunnycdnRemotePath', 'cfDistributionId', 'completionEmail', 'crawl_delay', 'crawl_increment', 'crawlPort', 'debug_mode', 'detection_level', 'delayBetweenAPICalls', 'deployBatchSize', 'excludeURLs', 'ftpRemotePath', 'ftpServer', 'ftpPort', 'ftpTLS', 'ftpUsername', 'ghBranch', 'ghCommitMessage', 'ghPath', 'ghRepo', 'glBranch', 'glPath', 'glProject', 'netlifyHeaders', 'netlifyRedirects', 'netlifySiteID', 'removeConditionalHeadComments', 'removeHTMLComments', 'removeWPLinks', 'removeWPMeta', 'rewrite_rules', 'rename_rules', 's3Bucket', 's3Key', 's3Region', 's3RemotePath', 'selected_deployment_option', 'targetFolder', 'useActiveFTP', 'useBaseHref', 'useBasicAuth', 'useRelativeURLs', ); public function __construct( $option_key ) { $options = get_option( $option_key ); if ( false === $options ) { $options = array(); } $this->wp2static_options = $options; $this->wp2static_option_key = $option_key; } public function __set( $name, $value ) { $this->wp2static_options[ $name ] = $value; return $this; } public function setOption( $name, $value ) { return $this->__set( $name, $value ); } public function __get( $name ) { $value = array_key_exists( $name, $this->wp2static_options ) ? $this->wp2static_options[ $name ] : null; return $value; } public function getOption( $name ) { return $this->__get( $name ); } public function getAllOptions( $reveal_sensitive_values = false ) { $options_array = array(); foreach ( $this->wp2static_options_keys as $key ) { $value = '*******************'; if ( in_array( $key, $this->whitelisted_keys ) ) { $value = $this->__get( $key ); } elseif ( $reveal_sensitive_values ) { $value = $this->__get( $key ); } $options_array[] = array( 'Option name' => $key, 'Value' => $value, ); } return $options_array; } public function optionExists( $name ) { return in_array( $name, $this->wp2static_options_keys ); } public function save() { return update_option( $this->wp2static_option_key, $this->wp2static_options ); } public function delete() { return delete_option( $this->wp2static_option_key ); } public function saveAllPostData() { foreach ( $this->wp2static_options_keys as $option ) { $this->setOption( $option, filter_input( INPUT_POST, $option ) ); $this->save(); } } }

View File

@ -1,2 +0,0 @@
<?php
class WPSHO_PostSettings { public static function get( $sets = array() ) { $settings = array(); $key_sets = array(); $target_keys = array(); $key_sets['general'] = array( 'baseUrl', 'debug_mode', 'selected_deployment_option', ); $key_sets['crawling'] = array( 'additionalUrls', 'excludeURLs', 'useBasicAuth', 'basicAuthPassword', 'basicAuthUser', 'detection_level', 'crawl_delay', 'crawlPort', ); $key_sets['processing'] = array( 'removeConditionalHeadComments', 'allowOfflineUsage', 'baseHREF', 'rewrite_rules', 'rename_rules', 'removeWPMeta', 'removeWPLinks', 'useBaseHref', 'useRelativeURLs', 'removeConditionalHeadComments', 'removeWPMeta', 'removeWPLinks', 'removeHTMLComments', ); $key_sets['advanced'] = array( 'crawl_increment', 'completionEmail', 'delayBetweenAPICalls', 'deployBatchSize', ); $key_sets['folder'] = array( 'baseUrl-folder', 'targetFolder', ); $key_sets['zip'] = array( 'baseUrl-zip', 'allowOfflineUsage', ); $key_sets['github'] = array( 'baseUrl-github', 'ghBranch', 'ghPath', 'ghToken', 'ghRepo', 'ghCommitMessage', ); $key_sets['bitbucket'] = array( 'baseUrl-bitbucket', 'bbBranch', 'bbPath', 'bbToken', 'bbRepo', ); $key_sets['gitlab'] = array( 'baseUrl-gitlab', 'glBranch', 'glPath', 'glToken', 'glProject', ); $key_sets['ftp'] = array( 'baseUrl-ftp', 'ftpPassword', 'ftpRemotePath', 'ftpServer', 'ftpPort', 'ftpTLS', 'ftpUsername', 'useActiveFTP', ); $key_sets['bunnycdn'] = array( 'baseUrl-bunnycdn', 'bunnycdnStorageZoneAccessKey', 'bunnycdnPullZoneAccessKey', 'bunnycdnPullZoneID', 'bunnycdnStorageZoneName', 'bunnycdnRemotePath', ); $key_sets['s3'] = array( 'baseUrl-s3', 'cfDistributionId', 's3Bucket', 's3Key', 's3Region', 's3RemotePath', 's3Secret', ); $key_sets['netlify'] = array( 'baseUrl-netlify', 'netlifyHeaders', 'netlifyPersonalAccessToken', 'netlifyRedirects', 'netlifySiteID', ); $key_sets['wpenv'] = array( 'wp_site_url', 'wp_site_path', 'wp_site_subdir', 'wp_uploads_path', 'wp_uploads_url', 'baseUrl', 'wp_active_theme', 'wp_themes', 'wp_uploads', 'wp_plugins', 'wp_content', 'wp_inc', ); foreach ( $sets as $set ) { $target_keys = array_merge( $target_keys, $key_sets[ $set ] ); } foreach ( $target_keys as $key ) { $settings[ $key ] = isset( $_POST[ $key ] ) ? $_POST[ $key ] : null; } $settings['crawl_increment'] = isset( $_POST['crawl_increment'] ) ? (int) $_POST['crawl_increment'] : 1; $settings['baseUrl'] = isset( $_POST['baseUrl'] ) ? rtrim( $_POST['baseUrl'], '/' ) . '/' : 'http://OFFLINEZIP.wpsho'; return array_filter( $settings ); } }

View File

@ -1,2 +0,0 @@
<?php
class ProgressLog { public static function l( $portion, $total ) { if ( $total === 0 ) { return; } $target_settings = array( 'wpenv', ); $wp_uploads_path = ''; if ( defined( 'WP_CLI' ) ) { require_once dirname( __FILE__ ) . '/DBSettings.php'; $settings = WPSHO_DBSettings::get( $target_settings ); $wp_uploads_path = $settings['wp_uploads_path']; } else { $wp_uploads_path = $_POST['wp_uploads_path']; } $log_file_path = $wp_uploads_path . '/WP-STATIC-PROGRESS.txt'; $progress_percent = floor( $portion / $total * 100 ); file_put_contents( $log_file_path, $progress_percent . PHP_EOL, LOCK_EX ); chmod( $log_file_path, 0664 ); } }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
class TXTProcessor extends WP2Static { public function __construct() { $this->loadSettings( array( 'crawling', 'wpenv', 'processing', 'advanced', ) ); } public function processTXT( $txt_document, $page_url ) { if ( $txt_document == '' ) { return false; } $this->txt_doc = $txt_document; $this->destination_protocol = $this->getTargetSiteProtocol( $this->settings['baseUrl'] ); $this->placeholder_url = $this->destination_protocol . 'PLACEHOLDER.wpsho/'; $this->rewriteSiteURLsToPlaceholder(); return true; } public function getTXT() { $processed_txt = $this->txt_doc; $processed_txt = $this->detectEscapedSiteURLs( $processed_txt ); $processed_txt = $this->detectUnchangedURLs( $processed_txt ); return $processed_txt; } public function detectEscapedSiteURLs( $processed_txt ) { $escaped_site_url = addcslashes( $this->placeholder_url, '/' ); if ( strpos( $processed_txt, $escaped_site_url ) !== false ) { return $this->rewriteEscapedURLs( $processed_txt ); } return $processed_txt; } public function detectUnchangedURLs( $processed_txt ) { $site_url = $this->placeholder_url; if ( strpos( $processed_txt, $site_url ) !== false ) { return $this->rewriteUnchangedURLs( $processed_txt ); } return $processed_txt; } public function rewriteUnchangedURLs( $processed_txt ) { if ( ! isset( $this->settings['rewrite_rules'] ) ) { $this->settings['rewrite_rules'] = ''; } $this->settings['rewrite_rules'] .= PHP_EOL . $this->placeholder_url . ',' . $this->settings['baseUrl']; $this->settings['rewrite_rules'] .= PHP_EOL . $this->getProtocolRelativeURL( $this->placeholder_url ) . ',' . $this->getProtocolRelativeURL( $this->settings['baseUrl'] ); $rewrite_from = array(); $rewrite_to = array(); $rewrite_rules = explode( "\n", str_replace( "\r", '', $this->settings['rewrite_rules'] ) ); foreach ( $rewrite_rules as $rewrite_rule_line ) { if ( $rewrite_rule_line ) { list($from, $to) = explode( ',', $rewrite_rule_line ); $rewrite_from[] = $from; $rewrite_to[] = $to; } } $rewritten_source = str_replace( $rewrite_from, $rewrite_to, $processed_txt ); return $rewritten_source; } public function rewriteEscapedURLs( $processed_txt ) { $processed_txt = str_replace( '%5C/', '\\/', $processed_txt ); $site_url = addcslashes( $this->placeholder_url, '/' ); $destination_url = addcslashes( $this->settings['baseUrl'], '/' ); if ( ! isset( $this->settings['rewrite_rules'] ) ) { $this->settings['rewrite_rules'] = ''; } $this->settings['rewrite_rules'] .= PHP_EOL . $site_url . ',' . $destination_url; $rewrite_from = array(); $rewrite_to = array(); $rewrite_rules = explode( "\n", str_replace( "\r", '', $this->settings['rewrite_rules'] ) ); foreach ( $rewrite_rules as $rewrite_rule_line ) { if ( $rewrite_rule_line ) { list($from, $to) = explode( ',', $rewrite_rule_line ); $rewrite_from[] = addcslashes( $from, '/' ); $rewrite_to[] = addcslashes( $to, '/' ); } } $rewritten_source = str_replace( $rewrite_from, $rewrite_to, $processed_txt ); return $rewritten_source; } public function rewriteSiteURLsToPlaceholder() { $patterns = array( $this->settings['wp_site_url'], $this->getProtocolRelativeURL( $this->settings['wp_site_url'] ), $this->getProtocolRelativeURL( rtrim( $this->settings['wp_site_url'], '/' ) ), $this->getProtocolRelativeURL( $this->settings['wp_site_url'] . '//' ), $this->getProtocolRelativeURL( addcslashes( $this->settings['wp_site_url'], '/' ) ), ); $replacements = array( $this->placeholder_url, $this->getProtocolRelativeURL( $this->placeholder_url ), $this->getProtocolRelativeURL( $this->placeholder_url ), $this->getProtocolRelativeURL( $this->placeholder_url . '/' ), $this->getProtocolRelativeURL( addcslashes( $this->placeholder_url, '/' ) ), ); if ( $this->destination_protocol === 'https' ) { $patterns[] = str_replace( 'http:', 'https:', $this->settings['wp_site_url'] ); $replacements[] = $this->placeholder_url; } $rewritten_source = str_replace( $patterns, $replacements, $this->txt_doc ); $this->txt_doc = $rewritten_source; } public function getTargetSiteProtocol( $url ) { $protocol = '//'; if ( strpos( $url, 'https://' ) !== false ) { $protocol = 'https://'; } elseif ( strpos( $url, 'http://' ) !== false ) { $protocol = 'http://'; } else { $protocol = '//'; } return $protocol; } public function getProtocolRelativeURL( $url ) { $this->destination_protocol_relative_url = str_replace( array( 'https:', 'http:', ), array( '', '', ), $url ); return $this->destination_protocol_relative_url; } }

View File

@ -1,17 +0,0 @@
<?php
class TemplateHelper { public function __construct() { } public function displayCheckbox( $tpl_vars, $field_name, $field_label ) { echo "
<fieldset>
<label for='{$field_name}'>
<input name='{$field_name}' id='{$field_name}' value='1' type='checkbox' " . ( $tpl_vars->options->{$field_name} === '1' ? 'checked' : '' ) . ' />
<span>' . __( $field_label, 'static-html-output-plugin' ) . '</span>
</label>
</fieldset>
'; } public function displayTextfield( $tpl_vars, $field_name, $field_label, $description, $type = 'text' ) { echo "
<input name='{$field_name}' class='regular-text' id='{$field_name}' type='{$type}' value='" . esc_attr( $tpl_vars->options->{$field_name} ) . "' placeholder='" . __( $field_label, 'static-html-output-plugin' ) . "' />
<span class='description'>$description</span>
<br>
"; } public function displaySelectMenu( $tpl_vars, $menu_options, $field_name, $field_label, $description, $type = 'text' ) { $menu_code = "
<select name='{$field_name}' id='{$field_name}'>
<option></option>"; foreach ( $menu_options as $value => $text ) { if ( $tpl_vars->options->{$field_name} === $value ) { $menu_code .= "
<option value='{$value}' selected>{$text}</option>"; } else { $menu_code .= "
<option value='{$value}'>{$text}</option>"; } } $menu_code .= '</select>'; echo $menu_code; } public function ifNotEmpty( $value, $substitute = '' ) { $value = $value ? $value : $substitute; echo $value; } }

View File

@ -1,2 +0,0 @@
<?php
class WP2Static_View { protected $variables = array(); protected $path = null; protected $directory = 'views'; protected $extension = '.phtml'; protected $template = null; public function __construct() { list($plugin_dir) = explode( '/', plugin_basename( __FILE__ ) ); $path_array = array( WP_PLUGIN_DIR, $plugin_dir, $this->directory ); $this->path = implode( '/', $path_array ); } public function setTemplate( $tpl ) { $this->template = $tpl; $this->variables = array(); return $this; } public function __set( $name, $value ) { $this->variables[ $name ] = $value; return $this; } public function assign( $name, $value ) { return $this->__set( $name, $value ); } public function __get( $name ) { $value = array_key_exists( $name, $this->variables ) ? $this->variables[ $name ] : null; return $value; } public function render() { $file = $this->path . '/' . $this->template . $this->extension; if ( ! is_readable( $file ) ) { error_log( 'Can\'t find view template: ' . $file ); } include $file; return $this; } public function fetch() { ob_start(); $this->render(); $contents = ob_get_contents(); ob_end_clean(); return $contents; } }

View File

@ -1,2 +0,0 @@
<?php
class WP2Static { public function loadSettings( $target_settings ) { $general_settings = array( 'general', ); $target_settings = array_merge( $general_settings, $target_settings ); if ( isset( $_POST['selected_deployment_option'] ) ) { require_once dirname( __FILE__ ) . '/PostSettings.php'; $this->settings = WPSHO_PostSettings::get( $target_settings ); } else { require_once dirname( __FILE__ ) . '/DBSettings.php'; $this->settings = WPSHO_DBSettings::get( $target_settings ); } } }

View File

@ -1,2 +0,0 @@
<?php
class WPSite { public function __construct() { $wp_upload_path_and_url = wp_upload_dir(); $this->uploads_url = $wp_upload_path_and_url['baseurl']; $this->site_url = get_home_url() . '/'; $this->parent_theme_url = get_template_directory_uri(); $this->wp_content_url = content_url(); $this->site_path = ABSPATH; $this->plugins_path = $this->getWPDirFullPath( 'plugins' ); $this->wp_uploads_path = $this->getWPDirFullPath( 'uploads' ); $this->wp_includes_path = $this->getWPDirFullPath( 'wp-includes' ); $this->wp_content_path = $this->getWPDirFullPath( 'wp-content' ); $this->theme_root_path = $this->getWPDirFullPath( 'theme-root' ); $this->parent_theme_path = $this->getWPDirFullPath( 'parent-theme' ); $this->child_theme_path = $this->getWPDirFullPath( 'child-theme' ); $this->child_theme_active = $this->parent_theme_path !== $this->child_theme_path; $this->permalink_structure = get_option( 'permalink_structure' ); $this->wp_inc = '/' . WPINC; $this->wp_content = WP_CONTENT_DIR; $this->wp_uploads = str_replace( ABSPATH, '/', $this->wp_uploads_path ); $this->wp_plugins = str_replace( ABSPATH, '/', WP_PLUGIN_DIR ); $this->wp_themes = str_replace( ABSPATH, '/', get_theme_root() ); $this->wp_active_theme = str_replace( home_url(), '', get_template_directory_uri() ); $this->detect_base_url(); $this->subdirectory = $this->isSiteInstalledInSubDirectory(); $this->wp_site_subdir = $this->subdirectory; $this->wp_site_url = $this->site_url; $this->wp_site_path = $this->site_path; $this->wp_uploads_url = $this->uploads_url; $this->uploads_writable = $this->uploadsPathIsWritable(); $this->permalinks_set = $this->permalinksAreDefined(); $this->curl_enabled = $this->hasCurlSupport(); } public function isSiteInstalledInSubDirectory() { $parsed_site_url = parse_url( rtrim( $this->site_url, '/' ) ); if ( isset( $parsed_site_url['path'] ) ) { return $parsed_site_url['path']; } return false; } public function uploadsPathIsWritable() { return $this->wp_uploads_path && is_writable( $this->wp_uploads_path ); } public function hasCurlSupport() { return extension_loaded( 'curl' ); } public function permalinksAreDefined() { return strlen( get_option( 'permalink_structure' ) ); } public function detect_base_url() { $site_url = get_option( 'siteurl' ); $home = get_option( 'home' ); } public function getWPDirFullPath( $wp_dir ) { $full_path = ''; switch ( $wp_dir ) { case 'wp-content': $full_path = WP_CONTENT_DIR; break; case 'uploads': $upload_dir_info = wp_upload_dir(); $full_path = $upload_dir_info['basedir']; break; case 'wp-includes': $full_path = ABSPATH . WPINC; break; case 'plugins': $full_path = WP_PLUGIN_DIR; break; case 'theme-root': $full_path = get_theme_root(); break; case 'parent-theme': $full_path = get_template_directory(); break; case 'child-theme': $full_path = get_stylesheet_directory(); break; } return rtrim( $full_path, '/' ); } public function getWPDirNameOnly( $wp_dir ) { $wp_dir_name = ''; switch ( $wp_dir ) { case 'child-theme': case 'parent-theme': case 'wp-content': case 'wp-includes': case 'uploads': case 'theme-root': case 'plugins': $wp_dir_name = $this->getLastPathSegment( $this->getWPDirFullPath( $wp_dir ) ); break; } return rtrim( $wp_dir_name, '/' ); } public function getLastPathSegment( $path ) { $path_segments = explode( '/', $path ); return end( $path_segments ); } public function getWPContentSubDirectory() { $parsed_url = parse_url( $this->parent_theme_url ); $path_segments = explode( '/', $parsed_url['path'] ); if ( count( $path_segments ) === 5 ) { return $path_segments[1] . '/'; } else { return ''; } } }

View File

@ -1,2 +0,0 @@
<?php
class WsLog { public static function l( $text ) { $target_settings = array( 'general', 'wpenv', ); $wp_uploads_path = ''; $settings = ''; if ( defined( 'WP_CLI' ) ) { require_once dirname( __FILE__ ) . '/DBSettings.php'; $settings = WPSHO_DBSettings::get( $target_settings ); } else { require_once dirname( __FILE__ ) . '/PostSettings.php'; $settings = WPSHO_PostSettings::get( $target_settings ); } if ( ! isset( $settings['debug_mode'] ) ) { return; } $wp_uploads_path = $settings['wp_uploads_path']; $log_file_path = $wp_uploads_path . '/WP-STATIC-EXPORT-LOG.txt'; file_put_contents( $log_file_path, $text . PHP_EOL, FILE_APPEND | LOCK_EX ); chmod( $log_file_path, 0664 ); } }

View File

@ -1,2 +0,0 @@
<?php
class WP2Static_BitBucket extends WP2Static_SitePublisher { public function __construct() { $this->loadSettings( 'bitbucket' ); list($this->user, $this->repository) = explode( '/', $this->settings['bbRepo'] ); $this->api_base = 'https://api.bitbucket.org/2.0/repositories/'; $this->previous_hashes_path = $this->settings['wp_uploads_path'] . '/WP2STATIC-BITBUCKET-PREVIOUS-HASHES.txt'; if ( defined( 'WP_CLI' ) ) { return; } switch ( $_POST['ajax_action'] ) { case 'bitbucket_prepare_export': $this->bootstrap(); $this->loadArchive(); $this->prepareDeploy( true ); break; case 'bitbucket_upload_files': $this->bootstrap(); $this->loadArchive(); $this->upload_files(); break; case 'test_bitbucket': $this->test_upload(); break; } } public function upload_files() { $this->files_remaining = $this->getRemainingItemsCount(); if ( $this->files_remaining < 0 ) { echo 'ERROR'; die(); } $this->initiateProgressIndicator(); $batch_size = $this->settings['deployBatchSize']; if ( $batch_size > $this->files_remaining ) { $batch_size = $this->files_remaining; } $lines = $this->getItemsToDeploy( $batch_size ); $this->openPreviousHashesFile(); $this->files_data = array(); foreach ( $lines as $line ) { $this->addFileToBatchForCommitting( $line ); $this->updateProgress(); } $this->sendBatchToBitbucket(); $this->writeFilePathAndHashesToFile(); $this->pauseBetweenAPICalls(); if ( $this->uploadsCompleted() ) { $this->finalizeDeployment(); } } public function test_upload() { require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $this->client = new WP2Static_Request(); try { $remote_path = $this->api_base . $this->settings['bbRepo'] . '/src'; $post_options = array( '.tmp_wp2static.txt' => 'Test WP2Static connectivity', '.tmp_wp2static.txt' => 'Test WP2Static connectivity #2', 'message' => 'WP2Static deployment test', ); $this->client->postWithArray( $remote_path, $post_options, $curl_options = array( CURLOPT_USERPWD => $this->user . ':' . $this->settings['bbToken'], ) ); $this->checkForValidResponses( $this->client->status_code, array( '200', '201', '301', '302', '304' ) ); } catch ( Exception $e ) { $this->handleException( $e ); } $this->finalizeDeployment(); } public function addFileToBatchForCommitting( $line ) { list($local_file, $this->target_path) = explode( ',', $line ); $local_file = $this->archive->path . $local_file; $this->files_data['message'] = 'WP2Static deployment'; if ( ! is_file( $local_file ) ) { return; } if ( isset( $this->settings['bbPath'] ) ) { $this->target_path = $this->settings['bbPath'] . '/' . $this->target_path; } $this->local_file_contents = file_get_contents( $local_file ); if ( isset( $this->file_paths_and_hashes[ $this->target_path ] ) ) { $prev = $this->file_paths_and_hashes[ $this->target_path ]; $current = crc32( $this->local_file_contents ); if ( $prev != $current ) { $this->files_data[ '/' . rtrim( $this->target_path ) ] = new CURLFile( $local_file ); $this->recordFilePathAndHashInMemory( $this->target_path, $this->local_file_contents ); } } else { $this->files_data[ '/' . rtrim( $this->target_path ) ] = new CURLFile( $local_file ); $this->recordFilePathAndHashInMemory( $this->target_path, $this->local_file_contents ); } } public function sendBatchToBitbucket() { require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $this->client = new WP2Static_Request(); $remote_path = $this->api_base . $this->settings['bbRepo'] . '/src'; $post_options = $this->files_data; try { $this->client->postWithArray( $remote_path, $post_options, $curl_options = array( CURLOPT_USERPWD => $this->user . ':' . $this->settings['bbToken'], ) ); $this->checkForValidResponses( $this->client->status_code, array( '200', '201', '301', '302', '304' ) ); } catch ( Exception $e ) { $this->handleException( $e ); } } } $bitbucket = new WP2Static_BitBucket();

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
class WP2Static_FTP extends WP2Static_SitePublisher { public function __construct() { $this->loadSettings( 'ftp' ); $this->previous_hashes_path = $this->settings['wp_uploads_path'] . '/WP2STATIC-FTP-PREVIOUS-HASHES.txt'; if ( defined( 'WP_CLI' ) ) { return; } switch ( $_POST['ajax_action'] ) { case 'ftp_prepare_export': $this->bootstrap(); $this->loadArchive(); $this->prepareDeploy(); break; case 'ftp_transfer_files': $this->bootstrap(); $this->loadArchive(); $this->upload_files(); break; case 'test_ftp': $this->test_ftp(); break; } } public function upload_files() { $this->files_remaining = $this->getRemainingItemsCount(); if ( $this->files_remaining < 0 ) { echo 'ERROR'; die(); } $this->initiateProgressIndicator(); $batch_size = $this->settings['deployBatchSize']; if ( $batch_size > $this->files_remaining ) { $batch_size = $this->files_remaining; } $lines = $this->getItemsToDeploy( $batch_size ); $this->openPreviousHashesFile(); require_once __DIR__ . '/../FTP/FtpClient.php'; require_once __DIR__ . '/../FTP/FtpException.php'; require_once __DIR__ . '/../FTP/FtpWrapper.php'; $this->ftp = new \FtpClient\FtpClient(); $port = isset( $this->settings['ftpPort'] ) ? $this->settings['ftpPort'] : 21; $use_ftps = isset( $this->settings['ftpTLS'] ); $this->ftp->connect( $this->settings['ftpServer'], $use_ftps, $port ); $this->ftp->login( $this->settings['ftpUsername'], $this->settings['ftpPassword'] ); if ( isset( $this->settings['activeFTP'] ) ) { $this->ftp->pasv( false ); } else { $this->ftp->pasv( true ); } foreach ( $lines as $line ) { list($this->local_file, $this->target_path) = explode( ',', $line ); $this->local_file = $this->archive->path . $this->local_file; if ( ! is_file( $this->local_file ) ) { continue; } if ( isset( $this->settings['ftpRemotePath'] ) ) { $this->target_path = $this->settings['ftpRemotePath'] . '/' . $this->target_path; } $this->local_file_contents = file_get_contents( $this->local_file ); $this->hash_key = $this->target_path . basename( $this->local_file ); if ( isset( $this->file_paths_and_hashes[ $this->hash_key ] ) ) { $prev = $this->file_paths_and_hashes[ $this->hash_key ]; $current = crc32( $this->local_file_contents ); if ( $prev != $current ) { $this->putFileViaFTP(); } } else { $this->putFileViaFTP(); } $this->recordFilePathAndHashInMemory( $this->hash_key, $this->local_file_contents ); $this->updateProgress(); } unset( $this->ftp ); $this->writeFilePathAndHashesToFile(); $this->pauseBetweenAPICalls(); if ( $this->uploadsCompleted() ) { $this->finalizeDeployment(); } } public function test_ftp() { require_once __DIR__ . '/../FTP/FtpClient.php'; require_once __DIR__ . '/../FTP/FtpException.php'; require_once __DIR__ . '/../FTP/FtpWrapper.php'; $this->ftp = new \FtpClient\FtpClient(); $port = isset( $this->settings['ftpPort'] ) ? $this->settings['ftpPort'] : 21; $use_ftps = isset( $this->settings['ftpTLS'] ); $this->ftp->connect( $this->settings['ftpServer'], $use_ftps, $port ); try { $this->ftp->login( $this->settings['ftpUsername'], $this->settings['ftpPassword'] ); if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } unset( $this->ftp ); return; } catch ( Exception $e ) { unset( $this->ftp ); $this->handleException( $e ); } } public function putFileViaFTP() { if ( ! $this->ftp->isdir( $this->target_path ) ) { $mkdir_result = $this->ftp->mkdir( $this->target_path, true ); } $this->ftp->chdir( $this->target_path ); $this->ftp->putFromPath( $this->local_file ); $this->ftp->chdir( '/' ); } } $ftp = new WP2Static_FTP();

View File

@ -1,14 +0,0 @@
<?php
class WP2Static_GitHub extends WP2Static_SitePublisher { public function __construct() { $this->loadSettings( 'github' ); list($this->user, $this->repository) = explode( '/', $this->settings['ghRepo'] ); $this->api_base = 'https://api.github.com/repos/'; $this->previous_hashes_path = $this->settings['wp_uploads_path'] . '/WP2STATIC-GITHUB-PREVIOUS-HASHES.txt'; if ( defined( 'WP_CLI' ) ) { return; } switch ( $_POST['ajax_action'] ) { case 'github_prepare_export': $this->bootstrap(); $this->loadArchive(); $this->prepareDeploy( true ); break; case 'github_upload_files': $this->bootstrap(); $this->loadArchive(); $this->upload_files(); break; case 'test_github': $this->test_upload(); break; } } public function upload_files() { $this->files_remaining = $this->getRemainingItemsCount(); if ( $this->files_remaining < 0 ) { echo 'ERROR'; die(); } $this->initiateProgressIndicator(); $batch_size = $this->settings['deployBatchSize']; if ( $batch_size > $this->files_remaining ) { $batch_size = $this->files_remaining; } $lines = $this->getItemsToDeploy( $batch_size ); $this->openPreviousHashesFile(); foreach ( $lines as $line ) { list($local_file, $this->target_path) = explode( ',', $line ); $local_file = $this->archive->path . $local_file; if ( ! is_file( $local_file ) ) { continue; } if ( isset( $this->settings['ghPath'] ) ) { $this->target_path = $this->settings['ghPath'] . '/' . $this->target_path; } $this->logAction( "Uploading {$local_file} to {$this->target_path} in GitHub" ); $this->local_file_contents = file_get_contents( $local_file ); if ( isset( $this->file_paths_and_hashes[ $this->target_path ] ) ) { $prev = $this->file_paths_and_hashes[ $this->target_path ]; $current = crc32( $this->local_file_contents ); if ( $prev != $current ) { if ( $this->fileExistsInGitHub() ) { $this->updateFileInGitHub(); } else { $this->createFileInGitHub(); } $this->recordFilePathAndHashInMemory( $this->target_path, $this->local_file_contents ); } else { $this->logAction( "Skipping {$this->target_path} as identical " . 'to deploy cache' ); } } else { if ( $this->fileExistsInGitHub() ) { $this->updateFileInGitHub(); } else { $this->createFileInGitHub(); } $this->recordFilePathAndHashInMemory( $this->target_path, $this->local_file_contents ); } $this->updateProgress(); } $this->writeFilePathAndHashesToFile(); $this->pauseBetweenAPICalls(); if ( $this->uploadsCompleted() ) { $this->finalizeDeployment(); } } public function test_upload() { try { $this->remote_path = $this->api_base . $this->settings['ghRepo'] . '/contents/' . '.WP2Static/' . uniqid(); $b64_file_contents = base64_encode( 'WP2Static test upload' ); $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $this->remote_path ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt( $ch, CURLOPT_HEADER, 0 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_USERAGENT, 'WP2Static.com' ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT' ); $post_options = array( 'message' => 'Test WP2Static connectivity', 'content' => $b64_file_contents, 'branch' => $this->settings['ghBranch'], ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $post_options ) ); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Authorization: ' . 'token ' . $this->settings['ghToken'], ) ); $output = curl_exec( $ch ); $status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close( $ch ); $good_response_codes = array( '200', '201', '301', '302', '304' ); if ( ! in_array( $status_code, $good_response_codes ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'BAD RESPONSE STATUS (' . $status_code . '): ' ); throw new Exception( 'GitHub API bad response status' ); } } catch ( Exception $e ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'GITHUB EXPORT: error encountered' ); WsLog::l( $e ); throw new Exception( $e ); return; } if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function fileExistsInGitHub() { $this->remote_path = $this->api_base . $this->settings['ghRepo'] . '/contents/' . $this->target_path; $this->query = <<<JSON
query{
repository(owner: "{$this->user}", name: "{$this->repository}") {
object(expression: "{$this->settings['ghBranch']}:{$this->target_path}") {
... on Blob {
oid
byteSize
}
}
}
}
JSON;
require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $this->client = new WP2Static_Request(); $post_options = array( 'query' => $this->query, 'variables' => '', ); $headers = array( 'Authorization: ' . 'token ' . $this->settings['ghToken'], ); $this->client->postWithJSONPayloadCustomHeaders( 'https://api.github.com/graphql', $post_options, $headers, $curl_options = array( CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, ) ); $this->logAction( "API response code {$this->client->status_code}" ); $this->logAction( "API response body {$this->client->body}" ); $this->checkForValidResponses( $this->client->status_code, array( '200', '201', '301', '302', '304' ) ); $gh_file_info = json_decode( $this->client->body, true ); $this->existing_file_object = $gh_file_info['data']['repository']['object']; $action = ''; $commit_message = ''; if ( ! empty( $this->existing_file_object ) ) { $this->logAction( "{$this->target_path} path exists in GitHub" ); return true; } } public function updateFileInGitHub() { $this->logAction( "Updating {$this->target_path} in GitHub" ); $action = 'UPDATE'; $existing_sha = $this->existing_file_object['oid']; $existing_bytesize = $this->existing_file_object['byteSize']; $b64_file_contents = base64_encode( $this->local_file_contents ); if ( isset( $this->settings['ghCommitMessage'] ) ) { $commit_message = str_replace( array( '%ACTION%', '%FILENAME%', ), array( $action, $this->target_path, ), $this->settings['ghCommitMessage'] ); } else { $commit_message = 'WP2Static ' . $action . ' ' . $this->target_path; } try { $post_options = array( 'message' => $commit_message, 'content' => $b64_file_contents, 'branch' => $this->settings['ghBranch'], 'sha' => $existing_sha, ); $headers = array( 'Authorization: ' . 'token ' . $this->settings['ghToken'], ); $this->client->putWithJSONPayloadCustomHeaders( $this->remote_path, $post_options, $headers, $curl_options = array( CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, ) ); $this->logAction( "API response code {$this->client->status_code}" ); $this->logAction( "API response body {$this->client->body}" ); $this->checkForValidResponses( $this->client->status_code, array( '200', '201', '301', '302', '304' ) ); } catch ( Exception $e ) { $this->handleException( $e ); } } public function createFileInGitHub() { $this->logAction( "Creating {$this->target_path} in GitHub" ); $action = 'CREATE'; $b64_file_contents = base64_encode( $this->local_file_contents ); if ( isset( $this->settings['ghCommitMessage'] ) ) { $commit_message = str_replace( array( '%ACTION%', '%FILENAME%', ), array( $action, $this->target_path, ), $this->settings['ghCommitMessage'] ); } else { $commit_message = 'WP2Static ' . $action . ' ' . $this->target_path; } try { $post_options = array( 'message' => $commit_message, 'content' => $b64_file_contents, 'branch' => $this->settings['ghBranch'], ); $headers = array( 'Authorization: ' . 'token ' . $this->settings['ghToken'], ); $this->client->putWithJSONPayloadCustomHeaders( $this->remote_path, $post_options, $headers, $curl_options = array( CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2, ) ); $this->logAction( "API response code {$this->client->status_code}" ); $this->logAction( "API response body {$this->client->body}" ); $this->checkForValidResponses( $this->client->status_code, array( '200', '201', '301', '302', '304' ) ); } catch ( Exception $e ) { $this->handleException( $e ); } } } $github = new WP2Static_GitHub();

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
class WP2Static_Netlify extends WP2Static_SitePublisher { public function __construct() { $this->loadSettings( 'netlify' ); $this->settings['netlifySiteID']; $this->settings['netlifyPersonalAccessToken']; $this->base_url = 'https://api.netlify.com'; $this->detectSiteID(); if ( defined( 'WP_CLI' ) ) { return; } switch ( $_POST['ajax_action'] ) { case 'test_netlify': $this->loadArchive(); $this->test_netlify(); break; case 'netlify_do_export': $this->bootstrap(); $this->loadArchive(); $this->deploy(); break; } } public function detectSiteID() { $this->site_id = $this->settings['netlifySiteID']; if ( strpos( $this->site_id, 'netlify.com' ) !== false ) { return; } elseif ( strpos( $this->site_id, '.' ) !== false ) { return; } elseif ( strlen( $this->site_id ) === 37 ) { return; } else { $this->site_id .= '.netlify.com'; } } public function deploy() { $this->zip_archive_path = $this->settings['wp_uploads_path'] . '/' . $this->archive->name . '.zip'; $zip_deploy_endpoint = $this->base_url . '/api/v1/sites/' . $this->site_id . '/deploys'; try { $headers = array( 'Authorization: Bearer ' . $this->settings['netlifyPersonalAccessToken'], 'Content-Type: application/zip', ); require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $this->client = new WP2Static_Request(); $this->client->postWithFileStreamAndHeaders( $zip_deploy_endpoint, $this->zip_archive_path, $headers ); $this->checkForValidResponses( $this->client->status_code, array( '200', '201', '301', '302', '304' ) ); $this->finalizeDeployment(); } catch ( Exception $e ) { $this->handleException( $e ); } } public function test_netlify() { $this->zip_archive_path = $this->settings['wp_uploads_path'] . '/' . $this->archive->name . '.zip'; $site_info_endpoint = $this->base_url . '/api/v1/sites/' . $this->site_id; try { $headers = array( 'Authorization: Bearer ' . $this->settings['netlifyPersonalAccessToken'], ); require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $this->client = new WP2Static_Request(); $this->client->getWithCustomHeaders( $site_info_endpoint, $headers ); if ( isset( $this->client->headers['x-ratelimit-limit'] ) ) { if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } else { $code = 404; require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'BAD RESPONSE STATUS FROM API (' . $code . ')' ); http_response_code( $code ); echo 'Netlify test error'; } } catch ( Exception $e ) { $this->handleException( $e ); } } } $netlify = new WP2Static_Netlify();

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
<?php
class WP2Static_CLI { public function diagnostics() { WP_CLI::line( PHP_EOL . 'WP2Static' . PHP_EOL ); $environmental_info = array( array( 'key' => 'PLUGIN VERSION', 'value' => WP2Static_Controller::VERSION, ), array( 'key' => 'PHP_VERSION', 'value' => phpversion(), ), array( 'key' => 'PHP MAX EXECUTION TIME', 'value' => ini_get( 'max_execution_time' ), ), array( 'key' => 'OS VERSION', 'value' => php_uname(), ), array( 'key' => 'WP VERSION', 'value' => get_bloginfo( 'version' ), ), array( 'key' => 'WP URL', 'value' => get_bloginfo( 'url' ), ), array( 'key' => 'WP SITEURL', 'value' => get_option( 'siteurl' ), ), array( 'key' => 'WP HOME', 'value' => get_option( 'home' ), ), array( 'key' => 'WP ADDRESS', 'value' => get_bloginfo( 'wpurl' ), ), ); WP_CLI\Utils\format_items( 'table', $environmental_info, array( 'key', 'value' ) ); $active_plugins = get_option( 'active_plugins' ); WP_CLI::line( PHP_EOL . 'Active plugins:' . PHP_EOL ); foreach ( $active_plugins as $active_plugin ) { WP_CLI::line( $active_plugin ); } WP_CLI::line( PHP_EOL ); WP_CLI::line( 'There are a total of ' . count( $active_plugins ) . ' active plugins on this site.' . PHP_EOL ); } public function microtime_diff( $start, $end = null ) { if ( ! $end ) { $end = microtime(); } list( $start_usec, $start_sec ) = explode( ' ', $start ); list( $end_usec, $end_sec ) = explode( ' ', $end ); $diff_sec = intval( $end_sec ) - intval( $start_sec ); $diff_usec = floatval( $end_usec ) - floatval( $start_usec ); return floatval( $diff_sec ) + $diff_usec; } public function generate() { $start_time = microtime(); $plugin = WP2Static_Controller::getInstance(); $plugin->generate_filelist_preview(); $plugin->prepare_for_export(); require_once dirname( __FILE__ ) . '/WP2Static/WP2Static.php'; require_once dirname( __FILE__ ) . '/WP2Static/SiteCrawler.php'; $site_crawler->crawl_site(); $site_crawler->crawl_discovered_links(); $plugin->post_process_archive_dir(); $end_time = microtime(); $duration = $this->microtime_diff( $start_time, $end_time ); WP_CLI::success( "Generated static site archive in $duration seconds" ); } public function deploy( $args, $assoc_args ) { $test = false; if ( ! empty( $assoc_args['test'] ) ) { $test = true; } if ( ! empty( $assoc_args['selected_deployment_option'] ) ) { switch ( $assoc_args['selected_deployment_option'] ) { case 'zip': break; } } require_once dirname( __FILE__ ) . '/WP2Static/Deployer.php'; $deployer = new Deployer(); $deployer->deploy( $test ); } } function wp2static_options( $args, $assoc_args ) { $action = isset( $args[0] ) ? $args[0] : null; $option_name = isset( $args[1] ) ? $args[1] : null; $value = isset( $args[2] ) ? $args[2] : null; $reveal_sensitive_values = false; if ( empty( $action ) ) { WP_CLI::error( 'Missing required argument: <get|set|list>' ); } $plugin = WP2Static_Controller::getInstance(); if ( $action === 'get' ) { if ( empty( $option_name ) ) { WP_CLI::error( 'Missing required argument: <option-name>' ); } if ( ! $plugin->options->optionExists( $option_name ) ) { WP_CLI::error( 'Invalid option name' ); } else { $option_value = $plugin->options->getOption( $option_name ); WP_CLI::line( $option_value ); } } if ( $action === 'set' ) { if ( empty( $option_name ) ) { WP_CLI::error( 'Missing required argument: <option-name>' ); } if ( empty( $value ) ) { WP_CLI::error( 'Missing required argument: <value>' ); } if ( ! $plugin->options->optionExists( $option_name ) ) { WP_CLI::error( 'Invalid option name' ); } else { $plugin->options->setOption( $option_name, $value ); $plugin->options->save(); $result = $plugin->options->getOption( $option_name ); if ( ! $result === $value ) { WP_CLI::error( 'Option not able to be updated' ); } } } if ( $action === 'list' ) { if ( isset( $assoc_args['reveal-sensitive-values'] ) ) { $reveal_sensitive_values = true; } $options = $plugin->options->getAllOptions( $reveal_sensitive_values ); WP_CLI\Utils\format_items( 'table', $options, array( 'Option name', 'Value' ) ); } } WP_CLI::add_command( 'wp2static', 'wp2static_cli' ); WP_CLI::add_command( 'wp2static options', 'wp2static_options' );

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +0,0 @@
<div class="bitbucket_settings_block" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl-bitbucket"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-bitbucket', 'http://mystaticsite.com', '', ''); ?><br>
<p><i><?php echo __("Set this to the URL you intend to host your static exported site on, ie http://mystaticsite.com. Do not set this to the same URL as the WordPress site you're currently using (the address in your browser above). This plugin will rewrite all URLs in the exported static html from your current WordPress URL to what you set here. Supports http, https and protocol relative URLs.", 'static-html-output-plugin');?></i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="bbToken"><?php echo __('Personl Access Token', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bbToken', 'Bitbucket Personal Access Token', '<a href="https://bitbucket.com/settings/tokens/new" target="_blank">How do I get this?</a>', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bbRepo"><?php echo __('Account & Repository Name', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bbRepo', 'Account / Repository Name', 'ie, leonstafford/wordpress-static-html-plugin'); ?><br>
<p><i>Repository cannot be empty, just create any file via the Bitbucket UI if needed</i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="bbBranch"><?php echo __('Branch', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bbBranch', 'Branch', 'usually \'master\' or \'bb-pages\''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bbPath"><?php echo __('Subdirectory', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bbPath', 'Path within repository', 'Usually the repository root (leave this blank) or the \'doc\' folder'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bb_test"><?php echo __('Test Bitbucket Settings', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="bitbucket-test-button" type="button" class="btn-primary button">Test Bitbucket Settings</button>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,64 +0,0 @@
<div class="bunnycdn_settings_block" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl-bunnycdn"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-bunnycdn', 'http://mystaticsite.com', '', ''); ?><br>
<p><i><?php echo __("Set this to the URL you intend to host your static exported site on, ie http://mystaticsite.com. Do not set this to the same URL as the WordPress site you're currently using (the address in your browser above). This plugin will rewrite all URLs in the exported static html from your current WordPress URL to what you set here. Supports http, https and protocol relative URLs.", 'static-html-output-plugin');?></i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="bunnycdnStorageZoneName"><?php echo __('Storage Zone', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bunnycdnStorageZoneName', 'Storage Zone Name', 'ie, mybunnystoragezone. This is where the files will be uploaded to. '); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bunnycdnStorageZoneAccessKey"><?php echo __('Storage Zone Access Key', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bunnycdnStorageZoneAccessKey', 'Storage Zone Access Key', 'Find in your Storage Zone settings', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bunnycdnPullZoneID"><?php echo __('Pull Zone ID', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bunnycdnPullZoneID', 'Pull Zone ID', 'Numeric. ie, 1234. This will do a cache purge once all files are transferred', 'number'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bunnycdnPullZoneAccessKey"><?php echo __('Pull Zone Access Key', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bunnycdnPullZoneAccessKey', 'Pull Zone Access Key', 'Find in your Account settings', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bunnycdnRemotePath"><?php echo __('Subdirectory', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'bunnycdnRemotePath', 'BunnyCDN Remote Path', 'will attempt to create folder recursively if non-existent'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="bunny_test"><?php echo __('Test BunnyCDN Settings', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="bunny-test-button" type="button" class="btn-primary button">Test BunnyCDN Settings</button>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,44 +0,0 @@
<div class="folder_settings_block">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl-folder"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-folder', 'http://mystaticsite.com', '', ''); ?><br>
<p><i>Set this to the URL your visitors will use to access your site.</i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="targetFolder"><?php echo __('Target Directory', 'static-html-output-plugin');?></label>
</th>
<td>
<input id="targetFolder" name="targetFolder" class="regular-text" style="width:100%;"
value="<?php echo $this->options->targetFolder ? $this->options->targetFolder : $this->wp_site->site_path . 'mystaticsite'; ?>" /><br>
<p>By exporting to a directory on your current server, you can check how it will look when published and make any adjustments needed. If you put this in a publicly accessible path and the links have been rewritten to support it, you may use this method to easily preview your static site without needing to leave your browser.</p>
<p>As a safeguard, this plugin will only allow you to export to a new directory, an empty directory, or one that contains a file named <code>.wp2static_safety</code> inside. You can write to any existing, populated directories, by placing a file named as such within.</p>
</td>
</tr>
<tr style="display:none;">
<th scope="row">
<label for="folder_test"><?php echo __('Test Directory', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="folder-test-button" type="button" class="btn-primary button">Test Folder is Writable</button>
<span id="folder_test_results"></span>
<p>This will check the folder exists, else try to create it, along with a test file and directory inside it. It will also create the <code>.wp2static_safety</code> file within.</p>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,82 +0,0 @@
<div class="ftp_settings_block" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl"><?php echo __('Base URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-ftp', 'http://mystaticsite.com', '', ''); ?><br>
<p> <i><?php echo __("Set this to the URL you intend to host your static exported site on, ie http://mystaticsite.com. Do not set this to the same URL as the WordPress site you're currently using (the address in your browser above). This plugin will rewrite all URLs in the exported static html from your current WordPress URL to what you set here. Supports http, https and protocol relative URLs.", 'static-html-output-plugin');?></i> </p>
</td>
</tr>
<tr>
<th scope="row">
<label for="ftpServer"><?php echo __('FTP Server', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ftpServer', '198.176.1.23', ''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ftpPort"><?php echo __('FTP Port', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ftpPort', '21', ''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ftpUsername"><?php echo __('FTP Username', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ftpUsername', 'FTP Username', ''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ftpPassword"><?php echo __('FTP Password', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ftpPassword', 'FTP Password', '', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ftpRemotePath"><?php echo __('FTP Remote Path', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ftpRemotePath', 'FTP Remote Path', 'will attempt to create folder recursively if non-existent'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ftpTLS"><?php echo __('Use FTPS (TLS)', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayCheckbox($this, 'ftpTLS', 'Use FTP with TLS'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="useActiveFTP"><?php echo __('Use active FTP', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayCheckbox($this, 'useActiveFTP', 'Use active FTP (defaults to passive mode) <a href="https://stackoverflow.com/q/1699145/1668057" target="_blank">What\'s the difference?</a>'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ftp_test"><?php echo __('Test FTP Credentials', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="ftp-test-button" type="button" class="btn-primary button">Test FTP Settings</button>
<div class="spinner is-active" style="float:none;width:auto;height:auto;padding:10px 0 10px 50px;;"> </div>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,66 +0,0 @@
<div class="github_settings_block" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl-github"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-github', 'http://mystaticsite.com', '', ''); ?><br>
<p><i><?php echo __("Set this to the URL you intend to host your static exported site on, ie http://mystaticsite.com. Do not set this to the same URL as the WordPress site you're currently using (the address in your browser above). This plugin will rewrite all URLs in the exported static html from your current WordPress URL to what you set here. Supports http, https and protocol relative URLs.", 'static-html-output-plugin');?></i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="ghToken"><?php echo __('Personl Access Token', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ghToken', 'GitHub Personal Access Token', '<a href="https://github.com/settings/tokens/new" target="_blank">How do I get this?</a>', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ghRepo"><?php echo __('Account & Repository Name', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ghRepo', 'Account / Repository Name', 'ie, leonstafford/wp2static'); ?><br>
</td>
</tr>
<tr>
<th scope="row">
<label for="ghBranch"><?php echo __('Branch', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ghBranch', 'Branch', 'usually \'master\' or \'gh-pages\''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ghPath"><?php echo __('Subdirectory', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ghPath', 'Path within repository', 'Usually the repository root (leave this blank) or the \'doc\' folder'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="ghCommitMessage"><?php echo __('Commit message', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'ghCommitMessage', 'WP2Static %ACTION% %FILENAME%', 'Anything you like, with special vars %ACTION% and %FILENAME% available'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="gh_test"><?php echo __('Test GitHub Settings', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="github-test-button" type="button" class="btn-primary button">Test GitHub Settings</button>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,56 +0,0 @@
<div class="gitlab_settings_block" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl-gitlab"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-gitlab', 'http://mystaticsite.com', '', ''); ?><br>
<p><i><?php echo __("Set this to the URL you intend to host your static exported site on, ie http://mystaticsite.com. Do not set this to the same URL as the WordPress site you're currently using (the address in your browser above). This plugin will rewrite all URLs in the exported static html from your current WordPress URL to what you set here. Supports http, https and protocol relative URLs.", 'static-html-output-plugin');?></i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="glToken"><?php echo __('Personl Access Token', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'glToken', 'GitLab Personal Access Token', '<a href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html" target="_blank">Get one here (with API access)</a>', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="glProject"><?php echo __('Project ID', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'glProject', 'Project ID', 'find this in your GitLab > Project > Details page'); ?><br>
</td>
</tr>
<tr>
<th scope="row">
<label for="glBranch"><?php echo __('Branch', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'glBranch', 'Branch', ''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="glPath"><?php echo __('Subdirectory', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'glPath', 'Path within repository', 'Usually the repository root (leave this blank) or the \'doc\' folder'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="gl_test"><?php echo __('Test GitLab Settings', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="gitlab-test-button" type="button" class="btn-primary button">Test GitLab Settings</button>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,17 +0,0 @@
<?php
/**
* @package WP Static HTML Output
*
* Copyright (c) 2011 Leon Stafford
*/
?>
<div class="updated fade">
<p><strong><?php echo $this->message; ?></strong></p>
</div>
<?php if (is_array($this->exportLog) && count($this->exportLog)): ?>
<h3>Export Log</h3>
<pre class="wpsho-export-log"><?php echo implode("\n", array_keys($this->exportLog)) ?></pre>
<?php endif ?>

View File

@ -1,59 +0,0 @@
<div class="netlify_settings_block" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl-netlify"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-netlify', 'http://mystaticsite.com', '', ''); ?><br>
<p><i><?php echo __("Set this to the URL you intend to host your static exported site on, ie http://mystaticsite.com. Do not set this to the same URL as the WordPress site you're currently using (the address in your browser above). This plugin will rewrite all URLs in the exported static html from your current WordPress URL to what you set here. Supports http, https and protocol relative URLs.", 'static-html-output-plugin');?></i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="netlifyPersonalAccessToken"><?php echo __('Personal Access Token', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'netlifyPersonalAccessToken', 'Netlify Personal Access Token', '<a href="https://app.netlify.com/account/applications/personal" target="_blank">How do I get this?</a>', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="netlifySiteID"><?php echo __('Site ID', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'netlifySiteID', 'Netlify Site ID', 'supports: mystaticsite, mystaticsite.netlify.com, mydomain.com, 3970e0fe-8564-4903-9a55-c5f8de49fb8b'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="netlifyRedirects"><?php echo __('Redirects File', 'static-html-output-plugin');?></label>
<p><a href="https://www.netlify.com/docs/redirects/" target="_blank">more info</a></p>
</th>
<td>
<textarea class="widefat" name="netlifyRedirects" id="netlifyRedirects" rows="5" cols="10"><?php echo $this->options->netlifyRedirects ? $this->options->netlifyRedirects : '' ?></textarea>
</td>
</tr>
<tr>
<th scope="row">
<label for="netlifyHeaders"><?php echo __('Headers File', 'static-html-output-plugin');?></label>
<p><a href="https://www.netlify.com/docs/headers-and-basic-auth/" target="_blank">more info</a></p>
</th>
<td>
<textarea class="widefat" name="netlifyHeaders" id="netlifyHeaders" rows="5" cols="10"><?php echo $this->options->netlifyHeaders ? $this->options->netlifyHeaders : '' ?></textarea>
</td>
</tr>
<tr>
<th scope="row">
<label for="netlify_test"><?php echo __('Test Netlify Settings', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="netlify-test-button" type="button" class="btn-primary button">Test Netlify Settings</button>
<span id="netlify_test_results"></span>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,174 +0,0 @@
<?php
/**
* @package WP2Static
*
* Copyright (c) 2011 Leon Stafford
*/
$ajax_nonce = wp_create_nonce( 'wpstatichtmloutput' );
require_once(__DIR__ . '/../plugin/WP2Static/TemplateHelper.php');
$tpl = new TemplateHelper();
?>
<div class="wrap wp2static">
<?php if ( PHP_VERSION < 5.4 ) : ?>
<div class="notice notice-error inline">
<h2 class="title">Outdated PHP version detected</h2>
<p>The current officially supported PHP versions can be found on <a href="http://php.net/supported-versions.php" target="_blank">PHP.net</a></p>
<p>Whilst the plugin tries to work on the most common PHP environments, it currently requires PHP 5.4 or higher.</p>
<p>As official security support drops for PHP 5.6 at the end of 2018, it is strongly recommended to upgraded your WordPress hosting environment to PHP 7, ideally, PHP 7.1 or 7.2, as 7.0 will also stop being supported in December, 2018.<br><br>For help on upgrading your environment, please join our support community at <a href="https://wp2static.com/community/" target="_blank">https://wp2static.com/community/</a></p>
<p>Your current PHP version is: <?php echo PHP_VERSION; ?></p>
</div>
<?php endif; ?>
<?php if ( ! $this->wp_site->uploads_writable ) : ?>
<div class="notice notice-error inline is-dismissible">
<h2 class="title">Your uploads directory is not writable</h2>
<p>Please ensure that <code><?php echo $this->wp_site->wp_uploads_path; ?></code>
is writable by your webserver.
</p>
</div>
<?php endif; ?>
<?php if ( ! $this->wp_site->curl_enabled ) : ?>
<div class="notice notice-error inline is-dismissible">
<h2 class="title">You need the cURL extension enabled on your web server</h2>
<p> This is a library that allows the plugin to better export your static site out to services like GitHub, S3, Dropbox, BunnyCDN, etc. It's usually an easy fix to get this working. You can try Googling "How to enable cURL extension for PHP", along with the name of the environment you are using to run your WordPress site. This may be something like DigitalOcean, GoDaddy or LAMP, MAMP, WAMP for your webserver on your local computer. If you're still having trouble, the developer of this plugin is easger to help you get up and running. Please ask for help on our <a href="https://forum.wp2static.com">forum</a>.</p>
</div>
<?php endif; ?>
<?php if ( ! $this->wp_site->permalinks_set ) : ?>
<div class="notice notice-error inline is-dismissible">
<h2 class="title">You need to set your WordPress Pemalinks</h2>
<p>Due to the nature of how static sites work, you'll need to have some kind of permalinks structure defined in your <a href="<?php echo admin_url( 'options-permalink.php' ); ?>">Permalink Settings</a> within WordPress. To learn more on how to do this, please see WordPress's official guide to the <a href="https://codex.wordpress.org/Settings_Permalinks_Screen">Settings Permalinks Screen</a>.</p>
</div>
<?php endif; ?>
<h2 class="nav-tab-wrapper">
<a href="#" class="nav-tab nav-tab-active">Deploy static website</a>
<a href="#" class="nav-tab">Crawling</a>
<a href="#" class="nav-tab">Processing</a>
<a href="#" class="nav-tab">Advanced options</a>
<a href="#" class="nav-tab">Help</a>
<a href="#" class="nav-tab">Logs</a>
<a href="#" class="nav-tab"><span class="dashicons dashicons-heart" style="color:red;margin-top:3px;"></span></a>
</h2>
<!-- main form containing options that get sent -->
<form id="general-options" class="options-form" method="post" action="">
<!-- placeholder input fields to allow select menu deployment options to use existing behaviour -->
<span class="hiddenExportOptions" style="display:none;">
<?php $tpl->displayCheckbox($this, 'createZip', 'Create a ZIP file of your statically exported site, ready for you to manually deploy. Download link will appear in the Export Log below'); ?>
</span>
<?php
function generateDeploymentMethodOptions() {
$options = array(
"folder" => array('Subdirectory on current server', 'free'),
"blank1" => array("--- Manual Deployment ---", 'free'),
"zip" => array('ZIP archive (.zip)'),
"blank2" => array("--- Automated Deployment ---"),
"s3" => array("Amazon S3"),
"bitbucket" => array("Bitbucket"),
"bunnycdn" => array("BunnyCDN"),
"github" => array("GitHub Pages"),
"gitlab" => array("GitLab"),
"netlify" => array("Netlify"),
"blank3" => array("--- Other Automated Deployments ---"),
"ftp" => array("FTP"),
);
foreach ($options as $key => $value) {
echo "<option value='$key'>$value[0]</option>";
}
}
?>
<?php require_once(__DIR__ . '/tab_export.phtml'); ?>
<?php require_once(__DIR__ . '/tab_crawling.phtml'); ?>
<?php require_once(__DIR__ . '/tab_processing.phtml'); ?>
<?php require_once(__DIR__ . '/tab_advanced.phtml'); ?>
<?php require_once(__DIR__ . '/tab_help.phtml'); ?>
<?php require_once(__DIR__ . '/tab_logs.phtml'); ?>
<?php require_once(__DIR__ . '/tab_love.phtml'); ?>
<br>
<span class="submit" style="display:none;">
<?php wp_nonce_field($this->onceAction) ?>
<input id="formActionHiddenField" class="hiddenActionField" type="hidden" name="action" value="wp_static_html_output_ajax" />
<input id="basedir" type="hidden" name="basedir" value="" />
<input id="wp_site_url" type="hidden" name="wp_site_url" value="" />
<input id="wp_uploads_path" type="hidden" name="wp_uploads_path" value="" />
<input id="wp_uploads_url" type="hidden" name="wp_uploads_url" value="" />
<input id="subdirectory" type="hidden" name="subdirectory" value="<?php echo $this->wp_site->subdirectory; ?>" />
<input id="wp_site_path" type="hidden" name="wp_site_path" value="" />
<input id="wp_inc" type="hidden" name="wp_inc" value="" />
<input id="wp_active_theme" type="hidden" name="wp_active_theme" value="" />
<input id="wp_uploads" type="hidden" name="wp_uploads" value="" />
<input id="hiddenNonceField" type="hidden" name="nonce" value="<?php echo $ajax_nonce; ?>" />
<input id="hiddenAJAXAction" type="hidden" name="ajax_action" value="" />
<input name="staticExportSettings" class="hiddenSettingsField" type="hidden" name="action" value="" />
</span>
</form>
</div>
</div>
<div id="wp2static-footer">
<div class="inside">
<div class="submit">
<?php wp_nonce_field($this->onceAction) ?>
<button id="startExportButton" class="button-primary button-hero" disabled>Start static site export</button>
<button class="saveSettingsButton button-secondary" disabled>Save current options</button>
<button class="button resetDefaultSettingsButton" disabled>Reset to default settings</button>
<button style="display:none;" class="button cancelExportButton">Cancel export</button>
<a href="" id="downloadZIP"><button class="button button-secondary button-call-to-action" target="_blank">Download ZIP</button></a>
<a href="#" class="button button-secondary button-call-to-action" target="_blank" id="goToMyStaticSite" style="display:none;">Go to my deployed site</a>
</div>
</div><!-- end inside -->
<div id="pbar-container">
<div id="pbar-fill">
</div>
<div id="progress-container">
<div id="progress">
<div class="pulsate-css"></div>
<div id="current_action">Starting export</div>
</div>
<p id="exportDuration" style="display:block;"></p>
</div>
</div>
</div><!-- end wp2static-footer -->
</div>

View File

@ -1,112 +0,0 @@
<div class="s3_settings_block" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="baseUrl-s3"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-s3', 'http://mystaticsite.com', '', ''); ?><br>
<p><i>Set this to the URL your visitors will use to access your site. For an S3 hosted website, you have a few options which will influence what you put in this field. </i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="s3Key"><?php echo __('Access Key ID', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 's3Key', 'Access Key ID', 'ie, AKIAIOSFODNN7EXAMPLE'); ?><br>
<p><i>Your S3 user will need permissions to put objects into the bucket. Check that the user whose Key you are using has the correct permissions for S3. You may attach the 'AmazonS3FullAccess' to the user or give more fine grained permissions control via <a href="https://aws.amazon.com/iam/" target="_blank">AWS's IAM</a>.</i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="s3Key"><?php echo __('Secret Access Key', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 's3Secret', 'Secret Access Key', 'ie, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="s3Region"><?php echo __('Region', 'static-html-output-plugin');?></label>
</th>
<td>
<?php
// TODO: shift to S3 model/helper
$s3_regions = array(
"us-east-1" => "US East (N. Virginia)",
"us-east-2" => "US East (Ohio)",
"us-west-1" => "US West (N. California)",
"us-west-2" => "US West (Oregon)",
"ca-central-1" => "Canada (Central)",
"ap-south-1" => "Asia Pacific (Mumbai)",
"ap-northeast-2" => "Asia Pacific (Seoul)",
"ap-southeast-1" => "Asia Pacific (Singapore)",
"ap-southeast-2" => "Asia Pacific (Sydney)",
"ap-northeast-1" => "Asia Pacific (Tokyo)",
"ap-northeast-3" => "Asia Pacific (Osaka-Local)",
"eu-central-1" => "EU (Frankfurt)",
"eu-west-1" => "EU (Ireland)",
"eu-west-2" => "EU (London)",
"eu-west-3" => "EU (Paris)",
"eu-north-1" => "EU (Stockholm)",
"sa-east-1" => "South America (São Paulo)",
"cn-north-1" => "China (Beijing)",
"cn-northwest-1" => "China (Ningxia)",
);
?>
<?php $tpl->displaySelectMenu($this, $s3_regions, 's3Region', 'Region', 'ie, my-static-site'); ?><br>
<span class="description">choose the AWS region your bucket was created in</span>
</td>
</tr>
<tr>
<th scope="row">
<label for="s3Bucket"><?php echo __('Bucket', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 's3Bucket', 'S3 Bucket', 'ie, my-static-site'); ?><br>
<p><i>Your bucket name as it appears in your <a href="https://s3.console.aws.amazon.com/s3/home" target="_blank">AWS Console for S3</a>.</i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="s3RemotePath"><?php echo __('Subdirectory', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 's3RemotePath', 'Subfolder in your bucket', 'ie, static-website'); ?><br>
<p><i>In case you want to put your site in a sub directory of a bucket, this will deploy all the static website files into the folder name you specify here.</i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="cfDistributionId"><?php echo __('CloudFront Cache Invalidation', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'cfDistributionId', 'CloudFront Distribution ID', 'ie, ABC123DEFX'); ?><br>
<p><i>If using CloudFront in your S3 static website setup, enter the CloudFront Distribution ID here and it will create an invalidation request for all files at the end of the deployment process. The invalidation usually happens within a few minutes. You can check any pending invalidations in your <a href="https://console.aws.amazon.com/cloudfront/home" target="_blank">AWS Console's CloudFront page</a>. You AWS user will need to have the CloudFrontFullAccess permissions or a more controlled policy, that includes the ability to send CloudFront invalidation requests.</i></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="s3_test"><?php echo __('Test S3 Settings', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="s3-test-button" type="button" class="btn-primary button">Test S3 Settings</button>
</td>
</tr>
</tbody>
</table>
<a href="https://docs.wp2static.com/en/deploying/deployment-options/amazon-s3/" target="_blank">Read the docs</a> for more on deploying your WordPress site to S3
</div>

View File

@ -1,139 +0,0 @@
<div class="advanced_settings" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="crawl_increment"><?php echo __('Crawl Increment', 'static-html-output-plugin');?></label>
</th>
<td>
<select name="crawl_increment" id="crawl_increment">
<?php
// TODO: shift this into helper function for select
$increments = array(1, 5, 10, 25, 50, 100, 500, 1000, 999999);
foreach($increments as $increment) :
if ($increment == 999999): ?>
<option value="999999"<?php echo $this->options->crawl_increment == $increment ? ' selected' : ''; ?>>Maximum</option>
<?php else: ?>
<option value="<?php echo $increment; ?>"<?php echo $this->options->crawl_increment == $increment ? ' selected' : ''; ?>><?php echo $increment; ?></option>
<?php endif;
endforeach; ?>
</select><br>
<p>This is set to 1, by default, in order to allow exporting on low-resource environments, such as shared hosting servers. Each increment is the amount of files the server will try to process on each request that the browser sends it. Incrementing this will speed up your exports, by processing more are a time. If your export is failing, due to resource (memory, CPU) limits being reached, try setting this to a lower number.</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="deployBatchSize"><?php echo __('Deployment Batch Size', 'static-html-output-plugin');?></label>
</th>
<td>
<select name="deployBatchSize" id="deployBatchSize">
<?php
// TODO: shift this into helper function for select
$increments = array(1, 5, 10, 25, 50, 100, 500, 1000, 999999);
foreach($increments as $increment) :
if ($increment == 999999): ?>
<option value="999999"<?php echo $this->options->deployBatchSize == $increment ? ' selected' : ''; ?>>Maximum</option>
<?php else: ?>
<option value="<?php echo $increment; ?>"<?php echo $this->options->deployBatchSize == $increment ? ' selected' : ''; ?>><?php echo $increment; ?></option>
<?php endif;
endforeach; ?>
</select><br>
<p>This is set to 1, by default, in order to avoid execution limit timeouts on restricted environments, such as shared hosting servers. Each increment is the amount of files the server will try to deploy on each request. Incrementing this will speed up your exports, by processing more are a time. If your export is failing, due to execution limits or API rate limits being reached, try setting this to a lower number.</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="delayBetweenAPICalls"><?php echo __('API Request Delay', 'static-html-output-plugin');?></label>
</th>
<td>
<select name="delayBetweenAPICalls" id="delayBetweenAPICalls">
<?php
// TODO: shift this into helper function for select
$increments = array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 10);
foreach($increments as $increment) : ?>
<option value="<?php echo $increment; ?>"<?php echo $this->options->delayBetweenAPICalls == $increment ? ' selected' : ''; ?>><?php echo $increment; ?></option>
<?php endforeach; ?>
</select><br>
<p>This is set to 0, by default, but if your deploy is hitting GitLab's API too rapidly, you can increase this to add a delay between each API request.</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="wp_cli"><?php echo __('WP-CLI', 'static-html-output-plugin');?></label>
</th>
<td>
<p>Replacing the former, limited support for scheduled deploys via WP-Cron, WP2Static now integrates with the great <a href="https://wp-cli.org/" target="_blank">WP-CLI</a> for programmatic access to deploying your WordPress site statically. Control settings and trigger deployments to better suit your development workflow.</p>
<p>More information available on the GitHub project page: <a href="https://github.com/leonstafford/wp2static" target="_blank">https://github.com/leonstafford/wp2static</a></p>
<br>
</td>
</tr>
<tr>
<th scope="row">
<label><?php echo __('Redirect this domain to your static site?', 'static-html-output-plugin');?></label>
</th>
<td>
<p>If you're happy with how your site is looking after exporting to a subdirectory, you can choose to start serving this content to your visitors, instead of your current WordPress site. To do this, you will need to adjust your <code>.htaccess</code> file. This <a href="" target="_blank">community guide</a> may be able to help you.
</td>
</tr>
<tr>
<th scope="row">
<label for="completionEmail"><?php echo __('Email upon completion', 'static-html-output-plugin');?></label>
</th>
<td>
<?php
$current_user = wp_get_current_user();
$to = $current_user->user_email;
$tpl->displayCheckbox($this, 'completionEmail', 'Will send to: ' . $to); ?>
<p>
Be alerted when your deployment process is complete.
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="delete_deploy_cache_button"><?php echo __('Delete deploy cache', 'static-html-output-plugin');?></label>
</th>
<td>
<button id="delete_deploy_cache_button" type="button" class="btn-primary button">Delete deploy cache</button>
<p>When deploying, WP2Static will check each file to see if it's changed since the last deployment. It will skip unchanged files based on this information. If you want to force an uncached deployment, click this button and any caches will be emptied, requiring a full deploy on the next run.</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="debug_mode"><?php echo __('Enable Debug Mode', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayCheckbox($this, 'debug_mode', ''); ?>
<p>
Will slow down operations, but give verbose output to the Export Log in the Logs tab. Use this when you have a failed export to help pinpoint the cause.
</p>
</td>
</tr>
</tbody>
</table>
</div> <!-- end advanced settings -->

View File

@ -1,138 +0,0 @@
<div class="crawl_settings" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="useBasicAuth"><?php echo __('Use basic authentication', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayCheckbox($this, 'useBasicAuth', 'My WP site requires Basic Auth to access'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="basicAuthUser"><?php echo __('Basic auth user', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'basicAuthUser', 'Basic Auth user', '', ''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="basicAuthPassword"><?php echo __('Basic auth password', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'basicAuthPassword', 'Basic Auth password', '', 'password'); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="crawlPort"><?php echo __('Custom crawling port', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'crawlPort', 'Custom crawling port', ''); ?>
</td>
</tr>
<tr>
<th scope="row">
<label><?php echo __('Initial crawl list', 'static-html-output-plugin');?></label>
</th>
<td>
<p>Before it starts to export your site, the plugin first generates a list of all WordPress URLs it thinks it should include. It takes these from what it knows about your posts, pages, tags, archives and media.</p>
<div id="initial_crawl_list_loader" class="spinner is-active" style="float:none;width:auto;height:auto;padding:10px 0 10px 50px;background-position:20px 0;">
Generating initial file list
</div>
<i><p id="initial_crawl_list_count"></p></i>
<br>
<a id="preview_initial_crawl_list_button" style="display:none;" href="<?php echo $this->wp_site->uploads_url; ?>/WP-STATIC-INITIAL-CRAWL-LIST.txt" class="button button-secondary" target="_blank">Preview initial crawl list</a>
</td>
</tr>
<tr>
<th scope="row">
<label for="detection_level"><?php echo __('Detection level', 'static-html-output-plugin');?></label>
</th>
<td>
<select name="detection_level" id="detection_level">
<?php
// TODO: shift this into helper function for select
$detection_levels = array(
'everything' => 'As much as possible',
'posts_and_pages' => 'Posts and pages only',
'homepage' => 'Homepage only'
);
foreach($detection_levels as $key => $level) : ?>
<option value="<?php echo $key; ?>"<?php echo $this->options->detection_level == $key ? ' selected' : ''; ?>><?php echo $level; ?></option>
<?php endforeach; ?>
</select>
<button class="button button-secondary" id="save-and-reload">Save and reload</button>
</td>
</tr>
<tr>
<th scope="row">
<label><?php echo __('Exclude certain URLs', 'static-html-output-plugin');?></label>
</th>
<td>
<p>Where the plugin has detected too many files and you want to exclude certain URLs from being crawled, please specify these URLs here.</p> <br>
<i><p>You can enter this as a partial string or full path</p> <br>
<?php echo $this->wp_site_url; ?>/wp-content/themes/twentyseventeen/banana.jpg<br>
/my_pricelist.pdf<br>
.js<br>
</i>
<br>
<textarea class="widefat" name="excludeURLs" id="excludeURLs" rows="5" cols="10"><?php echo $this->options->excludeURLs ? $this->options->excludeURLs : '' ?></textarea>
</td>
</tr>
<tr>
<th scope="row">
<label><?php echo __('Include additional URLs', 'static-html-output-plugin');?></label>
</th>
<td>
<p>Where the plugin fails to detect certain URLs that you know you want to include, please add these here. This will be applied after any exclusions, in case you want to exclude a whole directory, then include just one file from it.</p> <br>
<i><p>Supported formats are relative URLs</p> <br>
<?php echo $this->wp_site_url; ?><br>
<?php echo $this->wp_site_url; ?>/wp-content/themes/twentyseventeen/banana.jpg<br>
/my_pricelist.pdf<br>
</i>
<br>
<textarea class="widefat" name="additionalUrls" id="additionalUrls" rows="5" cols="10"><?php echo $this->options->additionalUrls ? $this->options->additionalUrls : '' ?></textarea>
</td>
</tr>
<tr>
<th scope="row">
<label for="crawl_delay"><?php echo __('Crawl Delay', 'static-html-output-plugin');?></label>
</th>
<td>
<select name="crawl_delay" id="crawl_delay">
<?php
// TODO: shift this into helper function for select
$delays = array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 10);
foreach($delays as $delay) : ?>
<option value="<?php echo $delay; ?>"<?php echo $this->options->crawl_delay == $delay ? ' selected' : ''; ?>><?php echo $delay; ?></option>
<?php endforeach; ?>
</select><br>
<p>This is set to 0, by default, for better performance, but if exports are failing and no error appears with Debug Log enabled or you see "Too many files open" or such errors in the server logs, try increasing this value until you get a successful export.</p>
</td>
</tr>
</tbody>
</table>
</div><!-- end crawl_setings -->

View File

@ -1,47 +0,0 @@
<div class="export_your_site">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="selected_deployment_option"><?php echo __('Where will you host the optimized version of your site?', 'static-html-output-plugin');?></label>
</th>
<td>
<select class="selected_deployment_method" name="selected_deployment_option">
<?php generateDeploymentMethodOptions(); ?>
</select>
</td>
</tr>
</tbody>
</table>
<!-- legacy multi-export functionality relied on the baseUrl field being first in the settings block -->
<input style="display:none;" type="text" id="baseUrl" name="baseUrl" value="<?php echo esc_attr($this->baseUrl) ?>" size="50" placeholder="http://mystaticsite.com" />
<?php
// load up each deployment settings block
$deployment_options = array(
'zip',
'ftp',
'folder',
's3',
'bunnycdn',
'netlify',
'github',
'gitlab',
'bitbucket',
);
foreach($deployment_options as $deployment_option) {
require_once(__DIR__ . '/' . $deployment_option . '_settings_block.phtml');
}
?>
</div> <!-- end export_your_site -->

View File

@ -1,67 +0,0 @@
<div class="help_troubleshooting" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<span class="dashicons dashicons-book-alt"></span>
<label><?php echo __('Documentation & Tutorials', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://wp2static.com" target="_blank">
Official documentation and tutorials at wp2static.com
</a>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-wordpress-alt"></span>
<label><?php echo __('Ask a WordPress expert', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://wordpress.stackexchange.com" target="_blank">
https://wordpress.stackexchange.com
</a>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-groups"></span>
<label><?php echo __('Community', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://forum.wp2static.com/" target="_blank">
Our support and development forum
</a>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-format-chat"></span>
<label><?php echo __('Community', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://t.me/wp2static" target="_blank">
Chat for users & developers via Telegram
</a>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-hammer"></span>
<label><?php echo __('Report a bug', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://github.com/WP2static/wp2static/" target="_blank">
Our project page on GitHub
</a>
</td>
</tr>
</tbody>
</table>
</div> <!-- end advanced settings -->

View File

@ -1,30 +0,0 @@
<div class="export_logs" style="display:none;">
<br>
<select id="log_switcher">
<option value="">Choose a log to view</option>
<option value="detected_wordpress_urls">Detected WordPress URLs</option>
<option value="modified_crawl_list">Modified crawl list</option>
<option value="discovered_urls">Discovered URLs during crawl</option>
<option value="crawled_links">Crawled links</option>
<option value="encountered_404s">404s encountered</option>
<option value="export_log">Export log</option>
</select>
<button id="reload_log_button" class="button-secondary">(Re)load log</button>
<div id="log_load_progress" class="pulsate-css" style="float:none;display:none;"></div>
<br>
<br>
<textarea id="export_log_textarea" style="width:100%;min-height:300px;" disabled>
Please select a log to view from the menu above
</textarea>
</div> <!-- end advanced settings -->

View File

@ -1,81 +0,0 @@
<div class="give_love" style="display:none;">
<p>
This is first and foremost free, <a href="" target="https://github.com/leonstafford/wordpress-static-html-plugin/">open source</a> software, but aiming to cover development, support and promotional costs via <a href="https://wp2static.com" target="_blank">licenses for commercial usage</a>.
</p>
<h2>Other ways to support this plugin</h2>
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<span class="dashicons dashicons-wordpress-alt"></span>
<label><?php echo __('Leave a review', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://wordpress.org/support/plugin/static-html-output-plugin/reviews/" target="_blank">
Official WordPress.org reviews for WP2Static
</a>
<p>Reviews play a large part in helping people decide to try a plugin. Try to include how the plugin helped you solve a particular problem.</p>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-book-alt"></span>
<label><?php echo __('Documentation', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://github.com/leonstafford/wp-static-site-generator-documentation" target="_blank">
Help write / translate our documentation
</a>
<p>A never-ending, continual improvement process that benefits from any input. Instructions on the linked page. If it's too technical, make contact and we can find another way to get your contributions.</p>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-twitter"></span>
<label><?php echo __('Spread the word', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://twitter.com/wp2static" target="_blank">
Tweet about @wp2static
</a>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-format-chat"></span>
<label><?php echo __('Help others', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://wp2static.com/community/" target="_blank">
Help other users in our forums, StackExchange, Slack, Twitter, GitHub Issues or official WordPress.org plugin support page.
</a>
<p>We want to help more people realize the benefits of going static and easing their transition. Be there to help answer questions and support each other.</p>
</td>
</tr>
<tr>
<th scope="row">
<span class="dashicons dashicons-video-alt3"></span>
<label><?php echo __('Video tutorials', 'static-html-output-plugin');?></label>
</th>
<td>
<a href="https://www.youtube.com/watch?v=JmU6lrB8bRs" target="_blank">
Create screencasts/tutorials
</a>
<p>Many people prefer to learn visually, with video tutorials a really effective way to convey the whole WordPress to static site solution. If you make a how-to video or other WordPress to static or general static website video, we'll happily promote it for you.</p>
</td>
</tr>
</tbody>
</table>
</div> <!-- end advanced settings -->

View File

@ -1,109 +0,0 @@
<div class="processing_settings" style="display:none;">
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="useRelativeURLs"><?php echo __('Use relative URLs', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayCheckbox($this, 'useRelativeURLs', 'Use relative URLs'); ?>
<p> URLs in the exported site will be rewritten as <a href="https://www.w3schools.com/tags/tag_base.asp" target="_blank">relative URLs</a>. ie, <code>http://mydomain.com/some_dir/some_file.jpg</code> will become <code>some_dir/some_file.jpg</code></p>
</td>
</tr>
<tr>
<th scope="row">
<label for="baseHREF"><?php echo __('Base HREF', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseHREF', 'Base HREF', '', ''); ?>
<p>Setting this will tell the browser to resolve all URLs using this as a base. ie, with a Base HREF of <code>/</code> and the relative URL setting enabled above, a relative link of <code>some_dir/some_file.jpg</code> will resolve to <code>/some_dir/some_file.jpg</code></p>
</td>
</tr>
<tr>
<th scope="row">
<label><?php echo __('Rewrite Links in source code', 'static-html-output-plugin');?></label>
</th>
<td>
<p>In order to hide any trace that your site uses WordPress, the following paths will be rewritten. You can leave these default options in, but for more control, you can overwrite them.</p><br>
<p>Replace, for example, default WordPress paths within the source code</p> <br>
<p>use the full path, such as:</p>
<pre>
wp-content/themes/twentyseventeen/,contents/ui/mytheme/
wp-includes/,inc/
</pre>
<i>URLs will be first checked to ensure they are part of this site, not an external WordPress site, which would mess up URLs of linked images, etc</i>
<br>
<?php
$default_rewrite_rules = '';
?>
<textarea class="widefat" name="rewrite_rules" id="rewrite_rules" rows="5" cols="10"><?php echo $this->options->rewrite_rules ? $this->options->rewrite_rules : $default_rewrite_rules; ?></textarea>
</td>
</tr>
<tr>
<th scope="row">
<label><?php echo __('Rename Exported Directories', 'static-html-output-plugin');?></label>
</th>
<td>
<p>Likely required if doing any URL rewriting above.</p><br>
<p>Set the source directory, then a comma and the target directory. </p
<p>
In order to move wp-content/themes/twentyseventeen to contents/ui/mytheme, we'd need:
</p>
<pre>
wp-content,contents
contents/themes,contents/ui
contents/ui/twentyseventeen,contents/ui/mytheme
wp-includes/,inc/
</pre>
<br>
<?php
$default_rename_rules = '';
?>
<textarea class="widefat" name="rename_rules" id="rename_rules" rows="5" cols="10"><?php echo $this->options->rename_rules ? $this->options->rename_rules : $default_rename_rules; ?></textarea>
</td>
</tr>
<tr>
<th scope="row">
<label for="stripping"><?php echo __('Remove cruft', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayCheckbox($this, 'removeConditionalHeadComments', 'Remove conditional comments within HEAD', 'checked'); ?>
<p>Mostly obsolete, previously used for detecting versions of Internet Explorer and serving different CSS or JS.</p><br>
<?php $tpl->displayCheckbox($this, 'removeWPMeta', 'Remove WP Meta tags'); ?>
<p>The <code>&lt;meta&gt; name="generator" content="WordPress 4.9.8" /&gt;</code> type tags.</p><br>
<?php $tpl->displayCheckbox($this, 'removeWPLinks', 'Remove WP &lt;link&gt; tags'); ?>
<p>ie, <code>&lt;link& rel="EditURI"...</code> type tags that usually aren't needed.</p><br>
<?php $tpl->displayCheckbox($this, 'removeHTMLComments', 'Remove HTML comments'); ?>
<p>ie, <code>&lt;!-- / Yoast SEO plugin. --&gt;</code> type comments that are ridiculously wasting bytes</p><br>
</td>
</tr>
</tbody>
</table>
</div><!-- end processing_setings -->

View File

@ -1,46 +0,0 @@
<div class="zip_settings_block" style="display:none;">
<?php if ( ! extension_loaded('zip') ) : ?>
<div class="notice notice-error inline">
<h2 class="title">WARNING: ZIP extension missing</h2>
<p>This can be a common issue but easy to fix. It means that the installation of the PHP programming language on your web host does not currently have support for reading and generating compressed ZIP files. This is needed for the plugin to be able to generate a .zip archive of your static website. Here's some hosting company and platform specific guides on how to fix:</p>
<ul>
<li><a target="_blank" href="https://godaddy.com/help/enable-custom-php-modules-12036">GoDaddy</a></li>
<li><a target="_blank" href="https://stackoverflow.com/questions/23564138/how-to-enable-zip-dll-in-xampp">XAMPP</a></li>
<li><a target="_blank" href="https://stackoverflow.com/questions/38104348/install-php-zip-on-php-5-6-on-ubuntu">Ubuntu</a></li>
<li><a target="_blank" href="https://www.digitalocean.com/community/questions/php-7-0-ziparchive-library-is-missing-or-disabled">DigitalOcean</a></li>
<li><a target="_blank" href="http://lmgtfy.com/?q=how+to+get+zip+extension+php">Ask Dr. Google</a></li>
</ul>
<p>After installing/enabling the ZIP extension for PHP, you will likely also need to restart your webserver (Apache or nginx) for it to be usable within WordPress and this plugin.</p>
</div>
<?php endif;?>
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<strong><?php echo __('Allow offline usage', 'static-html-output-plugin');?></strong>
</th>
<td>
<?php $tpl->displayCheckbox($this, 'allowOfflineUsage', "Check this if you're going to run your site locally, ie on a USB drive given to a client. All links will be made relative and no Destination URL will be used."); ?>
</td>
</tr>
<tr>
<th scope="row">
<label for="baseUrl"><?php echo __('Destination URL', 'static-html-output-plugin');?></label>
</th>
<td>
<?php $tpl->displayTextfield($this, 'baseUrl-zip', 'http://mystaticsite.com', '', ''); ?>
<p> <i><?php echo __("Set this to the URL you intend to host your static exported site on, ie http://mystaticsite.com. Do not set this to the same URL as the WordPress site you're currently using (the address in your browser above). This plugin will rewrite all URLs in the exported static html from your current WordPress URL to what you set here. Supports http, https and protocol relative URLs.", 'static-html-output-plugin');?></i> </p>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,164 +0,0 @@
@CHARSET "UTF-8";
.postbox p, li {
font-size: 1em;
line-height: 1.375em;
}
#downloadZIP {
display: none;
}
.intro-text {
font-size: large;
}
div.postbox-container {
float: none;
padding: 0;
min-width: 650px;
width: 100%;
}
div.postbox div.inside {
margin: 14px 18px 18px;
position: relative;
}
.wpsho-report ul {
list-style: disc;
list-style-position: inside;
}
.wpsho-report ul li {
padding-left: 2em;
}
.wpsho-export-log {
height: 200px;
overflow: auto;
border: 1px solid #DFDFDF;
color: #000;
background: #fff;
margin: 0 0 15px;
padding: 3px 4px;
width: 95%;
}
#exportStatus {
width: 100%;
}
#progress {
display: none;
}
#progress-container {
min-height: 40px;
position: absolute;
top: 0;
left: 0;
z-index: 99999;
width: 100%;
}
.error-help-text {
display: none;
padding-bottom: 25px;
}
.warning {
background-color: #ffe7b7;
}
@-webkit-keyframes pulsate {
0% {-webkit-transform: scale(0.1, 0.1); opacity: 0.0;}
50% {opacity: 1.0;}
100% {-webkit-transform: scale(1.2, 1.2); opacity: 0.0;}
}
.pulsate-css {
animation: pulsate 1s ease-out;
animation-iteration-count: infinite;
opacity: 0.0;
border: 3px solid #999;
border-radius: 30px;
height: 18px;
width: 18px;
position: relative;
display: inline-block;
margin-top: 0px;
margin-right: 10px;
text-align: center;
float: left;
}
#current_action {
padding-top: 3px;
font-size: 14px;
}
.button-call-to-action {
background-color: greenyellow !important;
}
.cancelExportButton{
background-color: orange !important;
}
p.submit{
margin-top: 0px !important;
}
#netlify_test_results {
line-height: 28px;
margin-left: 10px;
}
.spinner {
float:none;width:auto;height:auto;padding:10px 0 10px 50px;
}
/* 86% when full sidebar, needs to grow otherwise */
#wp2static-footer {
background: rgba(255, 255, 255, 0.9);
width: 100%;
position: fixed;
bottom: 0;
border-top: 1px solid black;
min-height: 110px;
margin-left: -20px;
padding-left: 20px;
}
.wrap.wp2static {
padding-bottom: 100px;
}
#wpfooter {
display: none;
}
#pbar-container {
background-color: #F7F7F7;
width: 100%;
display: block;
min-height: 30px;
margin-bottom: 20px;
position: relative;
}
#pbar-fill {
background-color: #C1C1C1;
width: 0%;
min-height: 30px;
position: absolute;
top: 0;
left: 0;
}

View File

@ -1,98 +0,0 @@
<?php
/**
* Plugin Name: WP2Static
* Plugin URI: https://wp2static.com
* Description: Security & Performance via static website publishing. One plugin to solve WordPress's biggest problems.
* Version: 6.6.7
* Author: Leon Stafford
* Author URI: https://leonstafford.github.io
* Text Domain: static-html-output-plugin
*
* @package WP_Static_HTML_Output
*/
// intercept low latency dependent actions and avoid boostrapping whole plugin
require_once dirname( __FILE__ ) .
'/plugin/WP2Static/Dispatcher.php';
require_once 'plugin/WP2Static/WP2Static.php';
require_once 'plugin/WP2Static/Options.php';
require_once 'plugin/WP2Static/TemplateHelper.php';
require_once 'plugin/WP2Static/View.php';
require_once 'plugin/WP2Static/WsLog.php';
require_once 'plugin/WP2Static/FilesHelper.php';
require_once 'plugin/WP2Static.php';
require_once 'plugin/URL2/URL2.php';
WP2Static_Controller::init( __FILE__ );
function plugin_action_links( $links ) {
$settings_link = '<a href="admin.php?page=wp2static">' . __( 'Settings', 'static-html-output-plugin' ) . '</a>';
array_unshift( $links, $settings_link );
return $links;
}
function wp_static_html_output_server_side_export() {
$plugin = WP2Static_Controller::getInstance();
$plugin->doExportWithoutGUI();
wp_die();
return null;
}
add_action( 'wp_static_html_output_server_side_export_hook', 'wp_static_html_output_server_side_export', 10, 0 );
function plugins_have_been_loaded() {
load_plugin_textdomain( 'static-html-output-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
return null;
}
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'plugin_action_links' );
add_action( 'plugins_loaded', 'plugins_have_been_loaded' );
add_action( 'wp_ajax_wp_static_html_output_ajax', 'wp_static_html_output_ajax' );
function wp_static_html_output_ajax() {
check_ajax_referer( 'wpstatichtmloutput', 'nonce' );
$instance_method = filter_input( INPUT_POST, 'ajax_action' );
if ( '' !== $instance_method && is_string( $instance_method ) ) {
$plugin_instance = WP2Static_Controller::getInstance();
call_user_func( array( $plugin_instance, $instance_method ) );
}
wp_die();
return null;
}
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
function wp_static_html_output_add_dashboard_widgets() {
wp_add_dashboard_widget(
'wp_static_html_output_dashboard_widget',
'Static HTML Output',
'wp_static_html_output_dashboard_widget_function'
);
}
// add_action( 'wp_dashboard_setup', 'wp_static_html_output_add_dashboard_widgets' );
function wp_static_html_output_dashboard_widget_function() {
echo '<p>Publish whole site as static HTML</p>';
echo "<button class='button button-primary'>Publish whole site</button>";
}
function wp_static_html_output_deregister_scripts() {
wp_deregister_script( 'wp-embed' );
wp_deregister_script( 'comment-reply' );
}
add_action( 'wp_footer', 'wp_static_html_output_deregister_scripts' );
remove_action( 'wp_head', 'wlwmanifest_link' );
// WP CLI support
if ( defined( 'WP_CLI' ) ) {
require_once dirname( __FILE__ ) . '/plugin/wp2static-wp-cli-commands.php';
}